├── SilkroadInformationAPI ├── obj │ └── Debug │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ │ ├── SilkroadInformationAPI.dll │ │ ├── SilkroadInformationAPI.pdb │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ ├── SilkroadInformationAPI.csprojResolveAssemblyReference.cache │ │ └── SilkroadInformationAPI.csproj.FileListAbsolute.txt ├── bin │ └── Debug │ │ ├── PK2Reader.dll │ │ ├── SilkroadSecurityApi.dll │ │ ├── SilkroadInformationAPI.dll │ │ └── SilkroadInformationAPI.pdb ├── Media │ ├── DataInfo │ │ ├── MediaModel.cs │ │ ├── Region.cs │ │ ├── Division.cs │ │ ├── Shops │ │ │ ├── ShopGroup.cs │ │ │ ├── ShopTab.cs │ │ │ ├── ShopItemPackage.cs │ │ │ └── Shop.cs │ │ ├── ServerInfo.cs │ │ ├── Item.cs │ │ ├── Base.cs │ │ └── Skill.cs │ └── Data.cs ├── Client │ ├── Information │ │ ├── Spells │ │ │ ├── Mastery.cs │ │ │ └── Skill.cs │ │ ├── Quests │ │ │ ├── Objective.cs │ │ │ └── Quest.cs │ │ ├── Objects │ │ │ ├── BuffArea.cs │ │ │ ├── Mob.cs │ │ │ ├── Base.cs │ │ │ ├── CharacterInfo │ │ │ │ └── CharacterItem.cs │ │ │ ├── Structure.cs │ │ │ ├── Item.cs │ │ │ ├── COS.cs │ │ │ ├── Object.cs │ │ │ └── Character.cs │ │ ├── BasicInfo │ │ │ ├── State.cs │ │ │ ├── Movement.cs │ │ │ └── Position.cs │ │ ├── Gateway │ │ │ └── Shard.cs │ │ ├── Guilds │ │ │ └── Guild.cs │ │ ├── Chat │ │ │ └── ChatMessage.cs │ │ ├── InventoryItem.cs │ │ ├── Party │ │ │ ├── PartyMatchingEntry.cs │ │ │ └── Party.cs │ │ ├── Stalls │ │ │ └── Stall.cs │ │ └── Info.cs │ ├── Packets │ │ ├── Gateway │ │ │ ├── ShardRequest.cs │ │ │ ├── CaptchaCodeRequest.cs │ │ │ ├── CaptchaReceived.cs │ │ │ ├── PatchRequest.cs │ │ │ ├── LoginRequest.cs │ │ │ ├── AgentAuthRequest.cs │ │ │ ├── AgentAuthResponse.cs │ │ │ ├── PatchResponse.cs │ │ │ ├── CaptchaCodeResponse.cs │ │ │ ├── ShardResponse.cs │ │ │ └── LoginResponse.cs │ │ ├── Stall │ │ │ ├── Leave.cs │ │ │ ├── Closed.cs │ │ │ ├── NameUpdated.cs │ │ │ ├── Created.cs │ │ │ ├── StallUtility.cs │ │ │ ├── Entered.cs │ │ │ ├── Updated.cs │ │ │ └── Action.cs │ │ ├── Inventory │ │ │ ├── ItemCountUpdatedEventArgs.cs │ │ │ ├── ItemCountUpdatedDueAlchemyEventArgs.cs │ │ │ ├── UpdateItemDurability.cs │ │ │ ├── ItemCountUpdated.cs │ │ │ ├── ItemCountUpdatedDueAlchemy.cs │ │ │ ├── StorageInfoResponse.cs │ │ │ ├── InventoryOperationEventArgs.cs │ │ │ └── InventoryOperation.cs │ │ ├── Character │ │ │ ├── LogOut.cs │ │ │ ├── InfoUpdate.cs │ │ │ ├── StatsUpdate.cs │ │ │ └── ExpSPUpdate.cs │ │ ├── BattleArena │ │ │ ├── BattleArenaScoreEventArgs.cs │ │ │ ├── BattleArenaStateEventArgs.cs │ │ │ ├── BattleArenaResponseEventArgs.cs │ │ │ ├── BattleArenaResultEventArgs.cs │ │ │ ├── BattleArenaTimeEventArgs.cs │ │ │ └── Operation.cs │ │ ├── CharacterSelection │ │ │ ├── CharacterJoinRequest.cs │ │ │ ├── CharacterJoinResponse.cs │ │ │ ├── CharacterListRequest.cs │ │ │ └── CharacterListResponse.cs │ │ ├── Entity │ │ │ ├── CelestialPosition.cs │ │ │ ├── EntitySelected.cs │ │ │ ├── SpeedUpdate.cs │ │ │ ├── ItemEquip.cs │ │ │ ├── ItemUnequip.cs │ │ │ ├── PVPUpdate.cs │ │ │ ├── LevelUpAnimation.cs │ │ │ ├── StateChange.cs │ │ │ ├── PositionUpdate.cs │ │ │ └── HPMPUpdate.cs │ │ ├── Quest │ │ │ └── Update.cs │ │ ├── Global │ │ │ └── ModuleIdentification.cs │ │ ├── Game │ │ │ └── Invite.cs │ │ ├── Alchemy │ │ │ ├── FuseResultEventArgs.cs │ │ │ ├── AlchemyUtility.cs │ │ │ └── EnchantResult.cs │ │ ├── Party │ │ │ ├── PartyMatchingEntryDeleted.cs │ │ │ ├── EnteredParty.cs │ │ │ ├── PartyMatchingRequestJoin.cs │ │ │ ├── PartyUtility.cs │ │ │ ├── PartyMatchingEntryFormed.cs │ │ │ ├── PartyMatchingResponse.cs │ │ │ └── PartyUpdate.cs │ │ ├── Spells │ │ │ ├── ClientSkillChannel.cs │ │ │ ├── ClientSkillWithdraw.cs │ │ │ ├── ClientSkillLearn.cs │ │ │ ├── BuffEnded.cs │ │ │ ├── SpellUsed.cs │ │ │ └── BuffStart.cs │ │ ├── Utility.cs │ │ ├── Spawn │ │ │ ├── Despawn.cs │ │ │ └── GroupSpawn.cs │ │ ├── COS │ │ │ ├── COSUPdate.cs │ │ │ ├── RideState.cs │ │ │ └── COSData.cs │ │ └── Chat │ │ │ └── ChatUpdated.cs │ ├── Actions │ │ ├── Mapping.cs │ │ ├── CaptchaImage.cs │ │ └── Utility.cs │ └── Client.cs ├── Plugins │ ├── Signal.cs │ └── IPluginInterface.cs ├── Properties │ └── AssemblyInfo.cs └── Enums.cs ├── .vs └── SilkroadInformationAPI │ └── v14 │ └── .suo ├── README.md ├── SilkroadInformationAPI.sln ├── .gitattributes └── .gitignore /SilkroadInformationAPI/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vs/SilkroadInformationAPI/v14/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/.vs/SilkroadInformationAPI/v14/.suo -------------------------------------------------------------------------------- /SilkroadInformationAPI/bin/Debug/PK2Reader.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/SilkroadInformationAPI/bin/Debug/PK2Reader.dll -------------------------------------------------------------------------------- /SilkroadInformationAPI/bin/Debug/SilkroadSecurityApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/SilkroadInformationAPI/bin/Debug/SilkroadSecurityApi.dll -------------------------------------------------------------------------------- /SilkroadInformationAPI/bin/Debug/SilkroadInformationAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/SilkroadInformationAPI/bin/Debug/SilkroadInformationAPI.dll -------------------------------------------------------------------------------- /SilkroadInformationAPI/bin/Debug/SilkroadInformationAPI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/SilkroadInformationAPI/bin/Debug/SilkroadInformationAPI.pdb -------------------------------------------------------------------------------- /SilkroadInformationAPI/obj/Debug/SilkroadInformationAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/SilkroadInformationAPI/obj/Debug/SilkroadInformationAPI.dll -------------------------------------------------------------------------------- /SilkroadInformationAPI/obj/Debug/SilkroadInformationAPI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/SilkroadInformationAPI/obj/Debug/SilkroadInformationAPI.pdb -------------------------------------------------------------------------------- /SilkroadInformationAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/SilkroadInformationAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /SilkroadInformationAPI/obj/Debug/SilkroadInformationAPI.csprojResolveAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i3dprogrammer/SilkroadInformationAPI/HEAD/SilkroadInformationAPI/obj/Debug/SilkroadInformationAPI.csprojResolveAssemblyReference.cache -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SilkroadInformationAPI 2 | Silkroad data information collector. 3 | 4 | Hello and welcome to SilkroadInformationAPI! 5 | 6 | 3DProgrammer here from epvp. I was bored so I decided to create a DLL to collect the information from packets we usually use in Silkroad daily .i.e (Getting character skills, getting surrounding objects and their info, ...). 7 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/MediaModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo 8 | { 9 | public class MediaModel : Base 10 | { 11 | public ModelType Type; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Spells/Mastery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Spells 8 | { 9 | public class Mastery 10 | { 11 | public uint ID; 12 | public byte Level; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Plugins/Signal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Plugins 8 | { 9 | public class Signal 10 | { 11 | public static event Action OnSignal; 12 | public static void Rise() 13 | { 14 | OnSignal?.Invoke(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Region.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo 8 | { 9 | public class Region 10 | { 11 | public ushort RegionID; 12 | public string RegionTranslationName; 13 | public string RegionMediaName; 14 | public bool SafeZone; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Plugins/IPluginInterface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadInformationAPI; 7 | using System.Windows.Forms; 8 | namespace SilkroadInformationAPI.PluginInterface 9 | { 10 | public interface IPluginInterface 11 | { 12 | string PluginName { get; } 13 | 14 | TabPage Initialize(Dictionary SharedVariables); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Quests/Objective.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Quests 8 | { 9 | public class Objective 10 | { 11 | public int ID; 12 | public int Status; 13 | public string Name; 14 | public int TaskCount; 15 | public List TaskValues = new List(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/ShardRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class ShardRequest 11 | { 12 | public static void Send() 13 | { 14 | Packet p = new Packet(0x6101, true); 15 | SroClient.RemoteSecurity.Send(p); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Division.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo 8 | { 9 | public class Division 10 | { 11 | public string Name; 12 | public List IPs; 13 | 14 | public Division(string _name, List _ip) 15 | { 16 | Name = _name; 17 | IPs = _ip; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Stall/Leave.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.Stall 8 | { 9 | public class Leave 10 | { 11 | public static event System.Action OnClientLeaveStall; 12 | public static void Parse() 13 | { 14 | Client.CharacterInStall = false; 15 | OnClientLeaveStall?.Invoke(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Inventory/ItemCountUpdatedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.Inventory 8 | { 9 | public class ItemCountUpdatedEventArgs 10 | { 11 | Information.InventoryItem Item; 12 | 13 | public ItemCountUpdatedEventArgs(Information.InventoryItem _item) 14 | { 15 | Item = _item; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/BuffArea.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects 8 | { 9 | public class BuffArea : Base 10 | { 11 | /// 12 | /// Reference skill ID being used from (skilldata), 13 | /// you cannot get it from ModelID. 14 | /// 15 | public uint ReferenceSkillID { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Character/LogOut.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Character 9 | { 10 | public class LogOut 11 | { 12 | public static void Send() 13 | { 14 | var p = new Packet(0x7005); 15 | p.WriteUInt8(1); 16 | SroClient.RemoteSecurity.Send(p); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Shops/ShopGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo.Shops 8 | { 9 | public class ShopGroup 10 | { 11 | public string GroupName { get; set; } 12 | public List GroupTabs; 13 | public ShopGroup(string name) 14 | { 15 | this.GroupName = name; 16 | GroupTabs = new List(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/ServerInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo 8 | { 9 | public class ServerInfo 10 | { 11 | public List LoginDivisons; 12 | public uint Version; 13 | public ushort Port; 14 | public byte Locale; 15 | 16 | public ServerInfo() 17 | { 18 | LoginDivisons = new List(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/CaptchaCodeRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class CaptchaCodeRequest 11 | { 12 | public static void Send(string code) 13 | { 14 | Packet p = new Packet(0x6323); 15 | p.WriteAscii(code); 16 | SroClient.RemoteSecurity.Send(p); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Shops/ShopTab.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo.Shops 8 | { 9 | public class ShopTab 10 | { 11 | public string TabName { get; set; } 12 | public List TabItems; 13 | public ShopTab(string tabName) 14 | { 15 | this.TabName = tabName; 16 | TabItems = new List(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Inventory/ItemCountUpdatedDueAlchemyEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.Inventory 8 | { 9 | public class ItemCountUpdatedDueAlchemyEventArgs : EventArgs 10 | { 11 | public Information.InventoryItem item; 12 | public ItemCountUpdatedDueAlchemyEventArgs(Information.InventoryItem _Item) 13 | { 14 | item = _Item; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/BattleArena/BattleArenaScoreEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.BattleArena 8 | { 9 | public class BattleArenaScoreEventArgs : EventArgs 10 | { 11 | public uint TeamScore; 12 | public uint EnemyScore; 13 | 14 | public BattleArenaScoreEventArgs(uint team, uint enemy) 15 | { 16 | TeamScore = team; 17 | EnemyScore = enemy; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Actions/Mapping.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Actions 8 | { 9 | class Mapping 10 | { 11 | public static string GetCharNameFromUID(uint UniqueID) 12 | { 13 | if(UniqueID != 0 && Client.NearbyCharacters.ContainsKey(UniqueID)) 14 | { 15 | return Client.NearbyCharacters[UniqueID].Name; 16 | } 17 | 18 | return ""; 19 | } 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/CharacterSelection/CharacterJoinRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.CharacterSelection 9 | { 10 | public class CharacterJoinRequest 11 | { 12 | public static void Send(string characterName) 13 | { 14 | Packet p = new Packet(0x7001); 15 | p.WriteAscii(characterName); 16 | SroClient.RemoteSecurity.Send(p); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/CharacterSelection/CharacterJoinResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | namespace SilkroadInformationAPI.Client.Packets.CharacterSelection 8 | { 9 | public class CharacterJoinResponse 10 | { 11 | public static event Action OnCharacterSuccessfullyJoined; 12 | public static void Parse(Packet p) 13 | { 14 | if (p.ReadUInt8() == 1) 15 | OnCharacterSuccessfullyJoined?.Invoke(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Quests/Quest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Quests 8 | { 9 | public class Quest 10 | { 11 | public int QuestID; 12 | public int AchievementCount; 13 | public int RequiresAutoShareParty; 14 | public int Type; 15 | public int RemainingTime; 16 | public int Status; 17 | public int ObjectiveCount; 18 | public List Objectives = new List(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/CharacterSelection/CharacterListRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.CharacterSelection 9 | { 10 | public class CharacterListRequest 11 | { 12 | public static void Send() 13 | { 14 | Packet answer = new Packet(0x7007); //Character screen 15 | answer.WriteInt8(0x02); //Request character list 16 | SroClient.RemoteSecurity.Send(answer); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/CaptchaReceived.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class CaptchaReceived 11 | { 12 | public static event Action OnGatewayCaptchaReceived; 13 | 14 | public static void Parse(Packet p) 15 | { 16 | uint[] Pixels = Actions.CaptchaImage.GeneratePacketCaptcha(p); 17 | 18 | OnGatewayCaptchaReceived?.Invoke(Pixels); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/BattleArena/BattleArenaStateEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.BattleArena 8 | { 9 | public class BattleArenaStateEventArgs : EventArgs 10 | { 11 | public ArenaType BattleArenaType; 12 | public ArenaState BattleArenaState; 13 | 14 | public BattleArenaStateEventArgs(ArenaType _type, ArenaState _state) 15 | { 16 | BattleArenaType = _type; 17 | BattleArenaState = _state; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/CelestialPosition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.Entity 10 | { 11 | public class CelestialPosition 12 | { 13 | public static event Action OnClientTeleport; 14 | public static void Parse(Packet p) 15 | { 16 | uint uid = p.ReadUInt32(); 17 | if(uid == Client.Info.UniqueID) 18 | { 19 | OnClientTeleport?.Invoke(); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Item.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo 8 | { 9 | public class Item : Base 10 | { 11 | public int MaxStack; 12 | public ItemType Type; 13 | public int Degree; 14 | public long Duration; 15 | public long Cooldown; 16 | public string Description; 17 | public bool SOX = false; 18 | public bool Plusable = false; 19 | 20 | public Item() 21 | { 22 | Degree = 1; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Shops/ShopItemPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo.Shops 8 | { 9 | public class ShopItemPackage 10 | { 11 | public string PackageName { get; set; } 12 | public string ItemMediaName { get; set; } 13 | public int PackagePosition { get; set; } 14 | 15 | public ShopItemPackage(string packName, int packPos) 16 | { 17 | this.PackageName = packName; 18 | this.PackagePosition = packPos; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/PatchRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class PatchRequest 11 | { 12 | public static void Send(string Module, byte Locale, uint Version) 13 | { 14 | Packet p = new Packet(0x6100, false, true); 15 | p.WriteUInt8(Locale); 16 | p.WriteAscii(Module); 17 | p.WriteUInt32(Version); 18 | SroClient.RemoteSecurity.Send(p); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/BasicInfo/State.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.BasicInfo 8 | { 9 | public class State 10 | { 11 | public bool LifeState; 12 | public CharMotionState MotionState; 13 | public CharStatus Status; 14 | public float WalkSpeed; 15 | public float RunSpeed; 16 | public float HwanSpeed; 17 | public byte BuffCount; 18 | public bool Returning = false; 19 | 20 | public Dictionary Buffs = new Dictionary(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/BattleArena/BattleArenaResponseEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.BattleArena 8 | { 9 | public class BattleArenaResponseEventArgs : EventArgs 10 | { 11 | public ArenaResponse BattleArenaResponse; 12 | /// 13 | /// Available if ally team got the flag, or someone put the flag. 14 | /// 15 | public string AssociatedCharName; 16 | 17 | /// 18 | /// Ignore for now. 19 | /// 20 | public byte FlagPole; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/BattleArena/BattleArenaResultEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.BattleArena 8 | { 9 | public class BattleArenaResultEventArgs : EventArgs 10 | { 11 | public byte CountEarned; 12 | public ArenaResult ArenaResult; 13 | public uint EarnedRefItemID; 14 | 15 | public BattleArenaResultEventArgs(byte count, ArenaResult res, uint itemID) 16 | { 17 | CountEarned = count; 18 | ArenaResult = res; 19 | EarnedRefItemID = itemID; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/LoginRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.Gateway 10 | { 11 | public class LoginRequest 12 | { 13 | public static void Send(byte Locale, string username, string password, ushort shardID) 14 | { 15 | Packet p = new Packet(0x6102); 16 | p.WriteUInt8(Locale); 17 | p.WriteAscii(username); 18 | p.WriteAscii(password); 19 | p.WriteUInt16(shardID); 20 | SroClient.RemoteSecurity.Send(p); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Quest/Update.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Quest 9 | { 10 | public class Update 11 | { 12 | public static event Action OnQuestFinished; 13 | 14 | public static void Parse(Packet p) 15 | { 16 | byte flag = p.ReadUInt8(); 17 | if(flag == 0x03) //Quest completed. 18 | { 19 | OnQuestFinished?.Invoke(); 20 | } else if(flag == 0x04) //Quest abandoned. 21 | { 22 | //.. 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Base.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo 8 | { 9 | public class Base 10 | { 11 | public uint ObjRefID; 12 | public string MediaName; 13 | public string TranslationName; 14 | public Types Classes; 15 | 16 | public Base() 17 | { 18 | Classes = new Types(); 19 | } 20 | 21 | } 22 | 23 | public struct Types { 24 | public int A; 25 | public int B; 26 | public int C; 27 | public int D; 28 | public int E; 29 | public int F; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Inventory/UpdateItemDurability.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.Inventory 10 | { 11 | public class UpdateItemDurability 12 | { 13 | public static event Action OnItemDurabilityChange; 14 | public static void Parse(Packet p) //0x3052 15 | { 16 | byte slot = p.ReadUInt8(); 17 | if (Client.InventoryItems.ContainsKey(slot)) 18 | Client.InventoryItems[slot].Stats["DURABILITY"] = p.ReadInt32(); 19 | OnItemDurabilityChange?.Invoke(slot); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/Mob.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects 8 | { 9 | public class Mob : Base 10 | { 11 | /// 12 | /// Mob type (General, Party, Giant, Giant Party, etc..) 13 | /// 14 | public byte Rarity { get; set; } 15 | 16 | /// 17 | /// TODO: ??? 18 | /// 19 | public byte Appearance { get; set; } 20 | 21 | public uint CurrentHP { get; set; } 22 | 23 | public uint MaxHP { get; set; } 24 | 25 | public bool BadStatus { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Skill.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo 8 | { 9 | public class Skill : Base 10 | { 11 | public long Duration; 12 | public long Cooldown; 13 | public bool Buff; 14 | public string Description; 15 | public string Params; 16 | public bool UseOnAlly; 17 | public bool UseOnSelf; 18 | public bool UseOnUnknown; 19 | public bool RequireTarget; 20 | public bool UseOnEnemy; 21 | public SkillType Type; 22 | public string Position; 23 | 24 | public Skill() 25 | { 26 | 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Gateway/Shard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Gateway 8 | { 9 | public class Shard 10 | { 11 | public ushort ID; 12 | public string Name; 13 | public ushort OnlineCount; 14 | public ushort Capacity; 15 | public bool ServerStatus; 16 | 17 | public Shard(ushort _id, string _name, ushort _count, ushort _capacity, byte status) 18 | { 19 | ID = _id; 20 | Name = _name; 21 | OnlineCount = _count; 22 | Capacity = _capacity; 23 | ServerStatus = (status == 0); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/Base.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects 8 | { 9 | public class Base 10 | { 11 | /// 12 | /// The Reference ID in Media.pk2 (Usually found in characterdata, itemdata, teleportbuildings) 13 | /// 14 | public uint ModelID { get; set; } 15 | 16 | /// 17 | /// The Unique ID of the object, each object has it's own distinct unique id. 18 | /// 19 | public uint UniqueID { get; set; } = 0; 20 | 21 | public BasicInfo.Position Position = new BasicInfo.Position(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/CharacterInfo/CharacterItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects.CharacterInfo 8 | { 9 | public class CharacterItem 10 | { 11 | /// 12 | /// The item reference id in (itemdata). 13 | /// 14 | public uint ModelID { get; set; } 15 | 16 | /// 17 | /// The item plus value. 18 | /// 19 | public uint PlusValue { get; set; } 20 | 21 | public CharacterItem(uint id, uint opt) 22 | { 23 | ModelID = id; 24 | PlusValue = opt; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Stall/Closed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Stall 9 | { 10 | public class Closed 11 | { 12 | public static event Action OnCharacterCloseStall; 13 | 14 | public static void Parse(Packet p) 15 | { 16 | uint uid = p.ReadUInt32(); 17 | 18 | if (Client.NearbyCharacters.ContainsKey(uid)) 19 | { 20 | Client.NearbyCharacters[uid].Stall.StallCreated = false; 21 | OnCharacterCloseStall?.Invoke(Client.NearbyCharacters[uid]); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/AgentAuthRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class AgentAuthRequest 11 | { 12 | public static void Send(uint SessionID, string Username, string Password, byte Locale) 13 | { 14 | Packet p = new Packet(0x6103, true); 15 | p.WriteUInt32(SessionID); 16 | p.WriteAscii(Username); 17 | p.WriteAscii(Password); 18 | p.WriteUInt8(Locale); 19 | p.WriteUInt32(0); 20 | p.WriteUInt16(0); 21 | SroClient.RemoteSecurity.Send(p); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Global/ModuleIdentification.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Global 9 | { 10 | public class ModuleIdentification 11 | { 12 | 13 | /// 14 | /// Received after connecting to the server with SilkroadSecurityApi, the obj returned is the Service Module Name. 15 | /// 16 | public static event Action OnGlobalModuleIdentification; 17 | 18 | public static void Parse(Packet p) 19 | { 20 | string serviceName = p.ReadAscii(); 21 | 22 | OnGlobalModuleIdentification?.Invoke(serviceName); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/BattleArena/BattleArenaTimeEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.BattleArena 8 | { 9 | public class BattleArenaTimeEventArgs : EventArgs 10 | { 11 | /// 12 | /// Arena total time in milliseconds. 13 | /// 14 | public uint TotalTime; 15 | 16 | /// 17 | /// Time elapsed since arena started in milliseconds. 18 | /// 19 | public uint TimeElapsed; 20 | 21 | public BattleArenaTimeEventArgs(uint total, uint elapsed) 22 | { 23 | TotalTime = total; 24 | TimeElapsed = elapsed; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/AgentAuthResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class AgentAuthResponse 11 | { 12 | public static event Action OnAgentAuthResponseSuccess; 13 | public static event Action OnAgentAuthResponseFailed; 14 | 15 | public static void Parse(Packet p) 16 | { 17 | byte result = p.ReadUInt8(); 18 | if(result == 0x01) 19 | { 20 | OnAgentAuthResponseSuccess?.Invoke(); 21 | } else 22 | { 23 | OnAgentAuthResponseFailed?.Invoke(); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Game/Invite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Game 9 | { 10 | public class Invite 11 | { 12 | public static void Parse(Packet p) //0x3080 TODO: Add events 13 | { 14 | byte RequestType = p.ReadUInt8(); 15 | switch (RequestType) 16 | { 17 | case 0x02: //Party invitation 18 | case 0x03: //Party invitation 19 | break; 20 | case 0x05: //Guild invitation 21 | break; 22 | case 0x09: //Academy invitation 23 | break; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/PatchResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class PatchResponse 11 | { 12 | public static event Action OnPatchResponseSuccess; 13 | public static event Action OnPatchResponseFailed; 14 | public static void Parse(Packet p) 15 | { 16 | byte result = p.ReadUInt8(); 17 | if(result == 0x01) //No patching is required -> success 18 | { 19 | OnPatchResponseSuccess?.Invoke(); 20 | } else 21 | { 22 | OnPatchResponseFailed?.Invoke(); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Stall/NameUpdated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.Stall 10 | { 11 | public class NameUpdated 12 | { 13 | public static event System.Action OnCharacterStallNameUpdated; 14 | public static void Parse(Packet p) 15 | { 16 | uint uid = p.ReadUInt32(); 17 | string title = p.ReadAscii(); 18 | if (Client.NearbyCharacters.ContainsKey(uid)) 19 | { 20 | Client.NearbyCharacters[uid].Stall.StallName = title; 21 | OnCharacterStallNameUpdated?.Invoke(Client.NearbyCharacters[uid]); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Alchemy/FuseResultEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.Alchemy 8 | { 9 | public class FuseResultEventArgs : EventArgs 10 | { 11 | /// 12 | /// The state of the fuse, whether it succeded or failed. 13 | /// 14 | public bool EnchantSuccess; 15 | 16 | /// 17 | /// The item associated with the fuse. 18 | /// 19 | public Information.InventoryItem AssociatedItem; 20 | 21 | public FuseResultEventArgs(bool success, Information.InventoryItem item) 22 | { 23 | EnchantSuccess = success; 24 | AssociatedItem = item; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Party/PartyMatchingEntryDeleted.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Party 9 | { 10 | public class PartyMatchingEntryDeleted 11 | { 12 | public static event Action OnPartyMatchingEntryDeleted; 13 | 14 | public static void Parse(Packet p) 15 | { 16 | byte success = p.ReadUInt8(); 17 | if(success == 1) 18 | { 19 | uint DeletedEntryNumber = p.ReadUInt32(); 20 | if (Client.Party.PartyMatching.PartyNumber == DeletedEntryNumber) 21 | Client.Party.PartyMatching = null; 22 | OnPartyMatchingEntryDeleted?.Invoke(); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/EntitySelected.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Entity 9 | { 10 | public class EntitySelected //TODO: DOO 11 | { 12 | public static void Parse(Packet p) 13 | { 14 | byte success = p.ReadUInt8(); 15 | if (success == 1) 16 | { 17 | Client.SelectedUniqueID = p.ReadUInt32(); 18 | if (Client.NearbyMobs.ContainsKey(Client.SelectedUniqueID)) 19 | { 20 | Console.WriteLine(Client.SelectedUniqueID + " : " + Client.NearbyMobs[Client.SelectedUniqueID].Rarity); 21 | } 22 | } 23 | Console.WriteLine("ENTITY SELECTED!"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Spells/ClientSkillChannel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Spells 9 | { 10 | public class ClientSkillChannel 11 | { 12 | public static event Action OnClientStartChanneling; 13 | public static event Action OnClientEndChanneling; 14 | 15 | public static void Parse(Packet p) 16 | { 17 | byte flag1 = p.ReadUInt8(); 18 | byte flag2 = p.ReadUInt8(); 19 | if(flag1 == 0x01 && flag2 == 0x01) 20 | { 21 | OnClientStartChanneling?.Invoke(); 22 | } else if(flag1 == 0x02 && flag2 == 0x00) 23 | { 24 | OnClientEndChanneling?.Invoke(); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/SpeedUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Entity 9 | { 10 | class SpeedUpdate 11 | { 12 | public static void Parse(Packet p) 13 | { 14 | uint uid = p.ReadUInt32(); 15 | 16 | if(Client.Info.UniqueID == uid) 17 | { 18 | Client.State.WalkSpeed = p.ReadSingle(); 19 | Client.State.RunSpeed = p.ReadSingle(); 20 | } 21 | 22 | if (Client.NearbyCharacters.ContainsKey(uid)) 23 | { 24 | Client.NearbyCharacters[uid].State.WalkSpeed = p.ReadSingle(); 25 | Client.NearbyCharacters[uid].State.RunSpeed = p.ReadSingle(); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Alchemy/AlchemyUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | using SilkroadInformationAPI.Client.Information; 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.Alchemy 10 | { 11 | class AlchemyUtility 12 | { 13 | public static Dictionary ParseBlues(Packet p, int count) 14 | { 15 | var Blues = new Dictionary(); 16 | for(int i = 0; i < count; i++) 17 | { 18 | int blueID = p.ReadInt32(); 19 | int blueValue = p.ReadInt32(); 20 | if (Media.Data.MediaBlues.ContainsKey(blueID)) 21 | Blues.Add((ItemBlues)Enum.Parse(typeof(ItemBlues), Media.Data.MediaBlues[blueID]), blueValue); 22 | } 23 | 24 | return Blues; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | using SilkroadSecurityApi; 8 | 9 | namespace SilkroadInformationAPI.Client.Packets 10 | { 11 | class Utility 12 | { 13 | public static void LogPacket(Packet p) 14 | { 15 | string data = string.Format("[{0}][{1:X4}][{2} bytes]{3}{4}{6}{5}{6}", "S->C", p.Opcode, p.GetBytes().Length, p.Encrypted ? "[Encrypted]" : "", p.Massive ? "[Massive]" : "", SilkroadSecurityApi.Utility.HexDump(p.GetBytes()), Environment.NewLine); 16 | File.AppendAllText(Environment.CurrentDirectory + "\\" + "Packets.txt", Environment.NewLine + data); 17 | } 18 | public static void LogPacket(string data) 19 | { 20 | File.AppendAllText(Environment.CurrentDirectory + "\\" + "PacketLog.txt", Environment.NewLine + data); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/ItemEquip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Entity 9 | { 10 | public class ItemEquip 11 | { 12 | public static void Parse(Packet p) 13 | { 14 | uint uid = p.ReadUInt32(); 15 | if(Client.Info.UniqueID == uid) // 0x3038 16 | { 17 | byte EquippingSlot = p.ReadUInt8(); 18 | uint RefItemID = p.ReadUInt32(); 19 | } 20 | else if (Client.NearbyCharacters.ContainsKey(uid)) 21 | { 22 | byte PlusValue = p.ReadUInt8(); 23 | uint RefItemID = p.ReadUInt32(); 24 | Client.NearbyCharacters[uid].Inventory.Add(new Information.Objects.CharacterInfo.CharacterItem(RefItemID, PlusValue)); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Inventory/ItemCountUpdated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | namespace SilkroadInformationAPI.Client.Packets.Inventory 8 | { 9 | public class ItemCountUpdated 10 | { 11 | public delegate void ItemCountUpdatedHandler(ItemCountUpdatedEventArgs e); 12 | public static event ItemCountUpdatedHandler OnItemCountUpdate; 13 | 14 | public static void Parse(Packet p) 15 | { 16 | int flag = p.ReadInt8(); //0x01 = item used succesfully, 0x02 error occured 17 | if(flag == 0x01) 18 | { 19 | int itemSlot = p.ReadInt8(); 20 | int count = p.ReadInt16(); 21 | Client.InventoryItems[itemSlot].Stack = count; 22 | 23 | OnItemCountUpdate?.Invoke(new ItemCountUpdatedEventArgs(Client.InventoryItems[itemSlot])); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Stall/Created.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Stall 9 | { 10 | public class Created 11 | { 12 | public static event Action OnCharacterCreateStall; 13 | public static void Parse(Packet p) 14 | { 15 | uint uid = p.ReadUInt32(); 16 | string title = p.ReadAscii(); 17 | uint dec = p.ReadUInt32(); //Decoration 18 | 19 | if (Client.NearbyCharacters.ContainsKey(uid)) 20 | { 21 | Client.NearbyCharacters[uid].Stall.Update(title, true, dec); 22 | OnCharacterCreateStall?.Invoke(Client.NearbyCharacters[uid]); 23 | } else if(Client.Info.UniqueID == uid) 24 | { 25 | Client.CurrentStall.Message = title; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Guilds/Guild.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Guilds 8 | { 9 | public class Guild 10 | { 11 | /// 12 | /// Guild name. 13 | /// 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// Guild ID. 18 | /// 19 | public uint ID { get; set; } 20 | 21 | /// 22 | /// Union ID, if there is any. 23 | /// 24 | public uint UnionID { get; set; } 25 | 26 | /// 27 | /// Guild grant name. 28 | /// 29 | public string Nickname { get; set; } 30 | 31 | /// 32 | /// Determines whether the guild is friendly or hostile (0 = Hostile, 1 = Friendly) 33 | /// 34 | public byte IsFriendly { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Stall/StallUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Stall 9 | { 10 | class StallUtility 11 | { 12 | public static void ParseCurrentStallItems(Packet p) 13 | { 14 | while (true) 15 | { 16 | var item = Inventory.InventoryUtility.ParseItem(p); 17 | if (item == null) 18 | break; 19 | 20 | p.ReadUInt8(); // ?? 21 | item.Stack = p.ReadUInt16(); 22 | item.Price = p.ReadUInt64(); 23 | 24 | Client.CurrentStall.StallItems.Add((byte)item.Slot, item); 25 | } 26 | } 27 | 28 | public static void ClearCurrentStall() 29 | { 30 | Client.CurrentStall.StallItems.Clear(); 31 | Client.CurrentStall.PeopleInStall.Clear(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SilkroadInformationAPI.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilkroadInformationAPI", "SilkroadInformationAPI\SilkroadInformationAPI.csproj", "{B70A0FAF-D077-493E-907A-592B44A040C9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B70A0FAF-D077-493E-907A-592B44A040C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {B70A0FAF-D077-493E-907A-592B44A040C9}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {B70A0FAF-D077-493E-907A-592B44A040C9}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {B70A0FAF-D077-493E-907A-592B44A040C9}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/Structure.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects 8 | { 9 | public class Structure : Base 10 | { 11 | 12 | /// 13 | /// HP of the structure, only available in fortress war? 14 | /// 15 | public uint HP { get; set; } 16 | 17 | /// 18 | /// ??? 19 | /// 20 | public uint RefEventStructID { get; set; } 21 | 22 | /// 23 | /// Returns the state of the structure (Burning, destroyed, etc..) *test for values*. 24 | /// 25 | public ushort State { get; set; } 26 | 27 | /// 28 | /// Owner name in case of Dimension holes. 29 | /// 30 | public string OwnerName { get; set; } 31 | 32 | /// 33 | /// The unique ID of the owner 34 | /// 35 | public uint OwnerUniqueID { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Inventory/ItemCountUpdatedDueAlchemy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.Inventory 10 | { 11 | public class ItemCountUpdatedDueAlchemy 12 | { 13 | 14 | public delegate void ItemCountUpdatedDueAlchemyHandler(ItemCountUpdatedDueAlchemyEventArgs e); 15 | 16 | public static event ItemCountUpdatedDueAlchemyHandler OnItemCountUpdatedDueAlchemyEvent; 17 | 18 | public static void Parse(Packet p) 19 | { 20 | int slot = p.ReadInt8(); 21 | int flag = p.ReadInt8(); 22 | if(flag == 0x08) 23 | { 24 | int newCount = p.ReadInt8(); 25 | Client.InventoryItems[slot].Stack = newCount; 26 | ItemCountUpdatedDueAlchemyEventArgs args = new ItemCountUpdatedDueAlchemyEventArgs(Client.InventoryItems[slot]); 27 | 28 | OnItemCountUpdatedDueAlchemyEvent?.Invoke(args); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Spells/ClientSkillWithdraw.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Spells 9 | { 10 | public class ClientSkillWithdraw 11 | { 12 | public static event Action OnClientSkillWithdrawl; 13 | public static void Parse(Packet p) 14 | { 15 | if(p.ReadUInt8() == 1) //Success 16 | { 17 | uint refID = p.ReadUInt32(); 18 | if (Client.Skills.Exists(x => x.Position == Media.Data.MediaSkills[refID].Position)) 19 | { 20 | Client.Skills.Remove(Client.Skills.Single(x => x.Position == Media.Data.MediaSkills[refID].Position)); 21 | Client.Skills.Add(Media.Data.MediaSkills[refID]); 22 | } 23 | else 24 | { 25 | throw new Exception("WTF?"); 26 | } 27 | OnClientSkillWithdrawl?.Invoke(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Spells/ClientSkillLearn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Spells 9 | { 10 | public class ClientSkillLearn 11 | { 12 | public static event Action OnClientSkillLearn; 13 | public static void Parse(Packet p) 14 | { 15 | if(p.ReadUInt8() == 1) //Skill learnt succesfully. 16 | { 17 | uint refID = p.ReadUInt32(); 18 | if(Client.Skills.Exists(x => x.Position == Media.Data.MediaSkills[refID].Position)) 19 | { 20 | Client.Skills.Remove(Client.Skills.Single(x => x.Position == Media.Data.MediaSkills[refID].Position)); 21 | Client.Skills.Add(Media.Data.MediaSkills[refID]); 22 | } else 23 | { 24 | Client.Skills.Add(Media.Data.MediaSkills[refID]); 25 | } 26 | OnClientSkillLearn?.Invoke(); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Character/InfoUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Character 9 | { 10 | public class InfoUpdate 11 | { 12 | public static event Action OnGoldUpdate; 13 | public static event Action OnZerkActive; 14 | public static event Action OnSPChange; 15 | 16 | public static void Parse(Packet p) 17 | { 18 | int flag = p.ReadInt8(); 19 | if (flag == 0x01) 20 | { 21 | Client.Info.Gold = p.ReadUInt64(); 22 | OnGoldUpdate?.Invoke(); 23 | } 24 | else if (flag == 0x02) //SP UP 25 | { 26 | Client.Info.SP = p.ReadUInt32(); 27 | OnSPChange?.Invoke(); 28 | } 29 | else if (flag == 0x03) //Zerk update 30 | { 31 | Client.Info.Zerk = (p.ReadUInt8() == 5); 32 | OnZerkActive?.Invoke(); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/DataInfo/Shops/Shop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media.DataInfo.Shops 8 | { 9 | public class Shop 10 | { 11 | public string StoreName { get; set; } 12 | public string StoreGroupName { get; set; } 13 | public string NPCName { get; set; } 14 | public List ShopGroups; 15 | 16 | public Shop(string name) 17 | { 18 | this.StoreName = name; 19 | ShopGroups = new List(); 20 | } 21 | 22 | public ShopTab GetTabFromIndex(byte index) 23 | { 24 | int total = 0; 25 | for(int i=0;i x.ModelID == RefItemID).Count() > 0) 25 | { 26 | Client.NearbyCharacters[uid].Inventory.Remove( 27 | Client.NearbyCharacters[uid].Inventory.First(x => x.ModelID == RefItemID)); 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Spells/BuffEnded.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Spells 9 | { 10 | public class BuffEnded 11 | { 12 | public static event Action OnClientBuffEnded; 13 | public static event Action OnCharacterBuffEnded; 14 | public static void Parse(Packet p) 15 | { 16 | if(p.ReadUInt8() == 1) 17 | { 18 | uint sUID = p.ReadUInt32(); 19 | if (Client.State.Buffs.ContainsKey(sUID)) 20 | { 21 | Client.State.Buffs.Remove(sUID); 22 | OnClientBuffEnded?.Invoke(sUID); 23 | } 24 | if (Client.NearbyCharacters.Any(x => x.Value.State.Buffs.ContainsKey(sUID))) 25 | { 26 | Client.NearbyCharacters.Single(x => x.Value.State.Buffs.ContainsKey(sUID)).Value.State.Buffs.Remove(sUID); 27 | OnCharacterBuffEnded?.Invoke(sUID); 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Spawn/Despawn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Spawn 9 | { 10 | class Despawn 11 | { 12 | public static void Parse(Packet p) 13 | { 14 | uint uid = p.ReadUInt32(); 15 | 16 | if (Client.NearbyBuffAreas.ContainsKey(uid)) 17 | Client.NearbyBuffAreas.Remove(uid); 18 | if (Client.NearbyCharacters.ContainsKey(uid)) 19 | Client.NearbyCharacters.Remove(uid); 20 | if (Client.NearbyCOSs.ContainsKey(uid)) 21 | Client.NearbyCOSs.Remove(uid); 22 | if (Client.NearbyItems.ContainsKey(uid)) 23 | Client.NearbyItems.Remove(uid); 24 | if (Client.NearbyMobs.ContainsKey(uid)) 25 | Client.NearbyMobs.Remove(uid); 26 | if (Client.NearbyNPCs.ContainsKey(uid)) 27 | Client.NearbyNPCs.Remove(uid); 28 | if (Client.NearbyStructures.ContainsKey(uid)) 29 | Client.NearbyStructures.Remove(uid); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Chat/ChatMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Chat 8 | { 9 | public class ChatMessage 10 | { 11 | /// 12 | /// The message sent in chat. 13 | /// 14 | public string Message { get; set; } 15 | 16 | /// 17 | /// Character name who sent the message, this is not available in case of NPC ChatType. 18 | /// 19 | public string CharacterName { get; set; } = ""; 20 | 21 | /// 22 | /// The Unique ID of the person who sent the message. 23 | /// 24 | public uint UniqueID { get; set; } = 0; 25 | 26 | /// 27 | /// Chat type. 28 | /// 29 | public ChatType Type { get; set; } = ChatType.All; 30 | 31 | public ChatMessage(string msg, string name, uint UID, ChatType type) 32 | { 33 | this.Message = msg; 34 | this.CharacterName = name; 35 | this.UniqueID = UID; 36 | this.Type = type; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Spells/Skill.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Spells 8 | { 9 | public class Skill 10 | { 11 | /// 12 | /// Skill reference id in (skilldata). 13 | /// 14 | public uint SkillID { get; set; } 15 | 16 | /// 17 | /// If the character is the creator of the skill (Recovery division, etc..) 18 | /// 19 | public bool isCreator { get; set; } 20 | 21 | /// 22 | /// The temporary unique id assigned to the skill. 23 | /// 24 | public uint TemporaryID { get; set; } 25 | 26 | public Skill(uint id, byte _enabled) 27 | { 28 | SkillID = id; 29 | Enabled = _enabled; 30 | } 31 | 32 | public Skill(uint id, uint temp, bool creator) 33 | { 34 | SkillID = id; 35 | TemporaryID = temp; 36 | isCreator = creator; 37 | } 38 | 39 | public Skill() 40 | { 41 | 42 | } 43 | 44 | public byte Enabled; //?? 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/PVPUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Entity 9 | { 10 | public class PVPUpdate 11 | { 12 | public static Action OnClientFreePVP; 13 | public static Action OnCharacterFreePVP; 14 | 15 | public static void Parse(Packet p) 16 | { 17 | byte result = p.ReadUInt8(); 18 | if(result == 0x01) 19 | { 20 | uint uid = p.ReadUInt32(); 21 | if (Client.NearbyCharacters.ContainsKey(uid)) 22 | { 23 | Client.NearbyCharacters[uid].PVPCape = (FRPVPMode)p.ReadUInt8(); 24 | OnCharacterFreePVP?.Invoke(Client.NearbyCharacters[uid].PVPCape, Client.NearbyCharacters[uid]); 25 | } 26 | else if (Client.Info.UniqueID == uid) 27 | { 28 | Client.Info.PVPCape = (FRPVPMode)p.ReadUInt8(); 29 | OnClientFreePVP?.Invoke(Client.Info.PVPCape); 30 | } 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Inventory/StorageInfoResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Inventory 9 | { 10 | class StorageInfoResponse 11 | { 12 | 13 | private static Packet StorageInfoPacket; 14 | 15 | public static void StorageInfoStart() 16 | { 17 | StorageInfoPacket = new Packet(0x3013, false, true); 18 | } 19 | 20 | public static void StorageInfoData(Packet p) 21 | { 22 | StorageInfoPacket.WriteUInt8Array(p.GetBytes()); 23 | } 24 | 25 | public static void StorageInfoEnd() 26 | { 27 | Parse(StorageInfoPacket); 28 | } 29 | 30 | private static void Parse(Packet p) 31 | { 32 | Client.StorageItems.Clear(); 33 | 34 | int maxItems = p.ReadInt8(); 35 | int currentItems = p.ReadInt8(); 36 | for (int i = 0; i < currentItems; i++) { 37 | Information.InventoryItem item = InventoryUtility.ParseItem(p); 38 | Client.StorageItems.Add(item.Slot, item); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Stall/Entered.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Stall 9 | { 10 | public class Entered 11 | { 12 | public static event System.Action OnClientEnterStall; 13 | 14 | public static void Parse(Packet p) 15 | { 16 | if(p.ReadUInt8() == 1) //Successfully entered the stall. 17 | { 18 | StallUtility.ClearCurrentStall(); 19 | Client.CharacterInStall = true; 20 | 21 | Client.CurrentStall.UniqueID = p.ReadUInt32(); 22 | Client.CurrentStall.Message = p.ReadAscii(); 23 | Client.CurrentStall.Opened = (p.ReadUInt8() == 1); 24 | p.ReadUInt8(); //?? 25 | 26 | StallUtility.ParseCurrentStallItems(p); 27 | 28 | byte peopleInStallCount = p.ReadUInt8(); 29 | for (int i = 0; i < peopleInStallCount; i++) { 30 | uint uid = p.ReadUInt32(); 31 | Client.CurrentStall.PeopleInStall.Add(uid, Actions.Mapping.GetCharNameFromUID(uid)); 32 | } 33 | 34 | OnClientEnterStall?.Invoke(); 35 | } 36 | 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Party/EnteredParty.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Party 9 | { 10 | public class EnteredParty 11 | { 12 | 13 | /// 14 | /// This gets called when the client enters a party, the new party information is stored in Client.Party 15 | /// 16 | public static event Action OnClientEnterParty; 17 | 18 | public static void Parse(Packet p) 19 | { 20 | Client.Party = new Information.Party.Party(); 21 | p.ReadUInt8(); //0xFF?? PVPFlag maybe? 22 | p.ReadUInt32(); //?? 23 | Client.Party.MasterUniqueID = p.ReadUInt32(); 24 | Client.Party.Type = (PartyType)p.ReadUInt8(); 25 | Client.Party.MembersCount = p.ReadUInt8(); 26 | for(int i = 0; i < Client.Party.MembersCount; i++) 27 | { 28 | var member = PartyUtility.ParseMember(p); 29 | Client.Party.PartyMembers.Add(member.UniqueID, member); 30 | } 31 | Client.Party.PartyMaster = Client.Party.PartyMembers[Client.Party.MasterUniqueID].Name; 32 | 33 | OnClientEnterParty?.Invoke(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/CaptchaCodeResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class CaptchaCodeResponse 11 | { 12 | 13 | /// 14 | /// This is received upon entering a successful captcha. 15 | /// 16 | public static event Action OnCaptchaCodeResponseSuccess; 17 | 18 | /// 19 | /// This is received upon entering a wrong captcha. 20 | /// first obj is the Current attempts to enter the captcha, the second obj is the maximum attempts. 21 | /// 22 | public static event Action OnCaptchaCodeResponseFailed; 23 | public static void Parse(Packet p) 24 | { 25 | byte result = p.ReadUInt8(); 26 | if(result == 0x01) //Captcha is correct 27 | { 28 | OnCaptchaCodeResponseSuccess?.Invoke(); 29 | } else 30 | { 31 | uint MaxAttempts = p.ReadUInt32(); 32 | uint CurrentAttempts = p.ReadUInt32(); 33 | OnCaptchaCodeResponseFailed?.Invoke(CurrentAttempts, MaxAttempts); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Spawn/GroupSpawn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Spawn 9 | { 10 | class GroupSpawn 11 | { 12 | private static Packet GroupSpawnPacket; 13 | private static byte GroupSpawnType; 14 | private static ushort GroupSpawnAmount; 15 | 16 | public static void GroupSpawnStart(Packet packet) 17 | { 18 | GroupSpawnType = packet.ReadUInt8(); 19 | GroupSpawnAmount = packet.ReadUInt16(); 20 | GroupSpawnPacket = new Packet(0x3019); 21 | } 22 | 23 | public static void GroupSpawnEnd(Packet packet) 24 | { 25 | GroupSpawnPacket.Lock(); 26 | 27 | for (int i = 0; i < GroupSpawnAmount; i++) 28 | { 29 | if (GroupSpawnType == 0x01) 30 | { 31 | SingleSpawn.Parse(GroupSpawnPacket); 32 | } 33 | else 34 | { 35 | Despawn.Parse(GroupSpawnPacket); 36 | } 37 | } 38 | } 39 | 40 | public static void GroupSpawnData(Packet packet) 41 | { 42 | GroupSpawnPacket.WriteUInt8Array(packet.GetBytes()); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Party/PartyMatchingRequestJoin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Party 9 | { 10 | public class PartyMatchingRequestJoin 11 | { 12 | public delegate void PartyMatchingRequestJoinHandler(PartyMatchingRequestJoinEventArgs e); 13 | public static event PartyMatchingRequestJoinHandler OnPartyMatchingRequestJoin; 14 | 15 | public static void Parse(Packet p) 16 | { 17 | p.ReadUInt32(); //UNK 18 | uint requesterUID = p.ReadUInt32(); //Unique ID 19 | uint EntryNumber = p.ReadUInt32(); 20 | p.ReadUInt32(); //Mastery tree 1 21 | p.ReadUInt32(); //Mastery tree 2 22 | p.ReadUInt8(); //UNK 23 | 24 | var member = PartyUtility.ParseMember(p); 25 | 26 | OnPartyMatchingRequestJoin?.Invoke(new Party.PartyMatchingRequestJoinEventArgs(member)); 27 | } 28 | } 29 | 30 | public class PartyMatchingRequestJoinEventArgs : EventArgs 31 | { 32 | public Information.Party.Party.PartyMember MemberRequesting; 33 | 34 | public PartyMatchingRequestJoinEventArgs(Information.Party.Party.PartyMember member) 35 | { 36 | MemberRequesting = member; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Character/StatsUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Character 9 | { 10 | public class StatsUpdate 11 | { 12 | public static event Action OnStatsUpdated; 13 | 14 | public static void Parse(Packet p) 15 | { 16 | Client.Info.MinimumPhysicalAttack = p.ReadUInt32(); 17 | Client.Info.MaximumPhysicalAttack = p.ReadUInt32(); 18 | Client.Info.MinimumMagicalAttack = p.ReadUInt32(); 19 | Client.Info.MaximumMagicalAttack = p.ReadUInt32(); 20 | Client.Info.PhysicalDefense = p.ReadUInt16(); 21 | Client.Info.MagicalDefense = p.ReadUInt16(); 22 | Client.Info.HitRate = p.ReadUInt16(); 23 | Client.Info.ParryRate = p.ReadUInt16(); 24 | Client.Info.MaxHP = p.ReadUInt32(); 25 | Client.Info.MaxMP = p.ReadUInt32(); 26 | Client.Info.STR = p.ReadUInt16(); 27 | Client.Info.INT = p.ReadUInt16(); 28 | 29 | if (Client.Info.CurrentHP > Client.Info.MaxHP) 30 | Client.Info.CurrentHP = Client.Info.MaxHP; 31 | if (Client.Info.CurrentMP > Client.Info.MaxMP) 32 | Client.Info.CurrentMP = Client.Info.MaxMP; 33 | 34 | OnStatsUpdated?.Invoke(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/COS/COSUPdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.COS 9 | { 10 | public class COSUpdate 11 | { 12 | public static event Action OnCOSHGPUpdate; 13 | public static void Parse(Packet p) 14 | { 15 | uint uid = p.ReadUInt32(); 16 | byte changeFlag = p.ReadUInt8(); 17 | if(changeFlag == 0x01) //Termination 18 | { //WE DON'T NEED TO DESPAWN HERE, SINCE THE 3016 SINGLE DESPAWN PACKET COMES FIRST 19 | //if (Client.NearbyCOSs.ContainsKey(uid)) 20 | //{ 21 | // Client.NearbyCOSs.Remove(uid); 22 | 23 | // if (Client.Info.CharacterCOS.ContainsKey(uid)) 24 | // Client.Info.CharacterCOS.Remove(uid); 25 | //} 26 | } else if(changeFlag == 0x04) //HGP Update?? 27 | { 28 | //TODO: ADD HGP 29 | OnCOSHGPUpdate?.Invoke(Client.NearbyCOSs[uid]); 30 | } 31 | else if(changeFlag == 0x05) //Name changed 32 | { 33 | string newName = p.ReadAscii(); 34 | if (Client.NearbyCOSs.ContainsKey(uid)) 35 | { 36 | Client.NearbyCOSs[uid].COSName = newName; 37 | } 38 | 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/BasicInfo/Movement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.BasicInfo 8 | { 9 | public class Movement 10 | { 11 | public byte HasDestination; 12 | public byte Type; 13 | public ushort DestinationRegion; 14 | public uint DestinationOffsetX; 15 | public uint DestinationOffsetY; 16 | public uint DestinationOffsetZ; 17 | public byte Source; 18 | public ushort Angle; 19 | 20 | public int GetRealX() 21 | { 22 | if (DestinationOffsetX > 32768) 23 | DestinationOffsetX = 65536 - DestinationOffsetX; 24 | byte xSec = (byte)(DestinationRegion >> 8); 25 | byte ySec = (byte)((ushort)(DestinationRegion << 8) / 256); 26 | return (int)((xSec - 135) * 192 + DestinationOffsetX / 10); 27 | } 28 | 29 | /// 30 | /// Returns the Y Coordinates of the object. 31 | /// 32 | /// uint representing the Y value 33 | public int GetRealY() 34 | { 35 | if (DestinationOffsetY > 32768) 36 | DestinationOffsetY = 6556 - DestinationOffsetY; 37 | byte xSec = (byte)(DestinationRegion >> 8); 38 | byte ySec = (byte)((ushort)(DestinationRegion << 8) / 256); 39 | return (int)((ySec - 92) * 192 + DestinationOffsetY / 10); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/BasicInfo/Position.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.BasicInfo 8 | { 9 | public class Position 10 | { 11 | public int RegionID; 12 | public float X; 13 | public float Y; 14 | public float Z; 15 | public int Angle; 16 | 17 | /// 18 | /// Returns the X Coordinates of the object. 19 | /// 20 | /// uint representing the X value 21 | public int GetRealX() 22 | { 23 | if (X > 32768) 24 | X = 65536 - X; 25 | byte xSec = (byte)((ushort)(RegionID << 8) / 256); 26 | return (int)((xSec - 135) * 192 + X / 10); 27 | } 28 | 29 | /// 30 | /// Returns the Y Coordinates of the object. 31 | /// 32 | /// uint representing the Y value 33 | public int GetRealY() 34 | { 35 | if (Y > 32768) 36 | Y = 6556 - Y; 37 | byte ySec = (byte)(RegionID >> 8); 38 | return (int)((ySec - 92) * 192 + Y / 10); 39 | } 40 | 41 | public Position() 42 | { 43 | 44 | } 45 | 46 | public Position(int _ReigonID, float _X, float _Y, float _Z) 47 | { 48 | RegionID = _ReigonID; 49 | X = _X; 50 | Y = _Y; 51 | Z = _Z; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SilkroadInformationAPI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("SilkroadInformationAPI")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b70a0faf-d077-493e-907a-592b44a040c9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/InventoryItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | using System.Runtime.Serialization.Formatters.Binary; 8 | 9 | namespace SilkroadInformationAPI.Client.Information 10 | { 11 | [Serializable] 12 | public class InventoryItem : Media.DataInfo.Item 13 | { 14 | public int Stack; 15 | public int PlusValue; 16 | public int Slot; 17 | public ulong Price; 18 | public bool HasAdvance; 19 | public Dictionary Blues; 20 | public Dictionary Stats; 21 | 22 | public InventoryItem(uint ID) 23 | { 24 | var mediaItem = Media.Data.MediaItems[ID]; 25 | 26 | MediaName = mediaItem.MediaName; 27 | TranslationName = mediaItem.TranslationName; 28 | ObjRefID = ID; 29 | Type = mediaItem.Type; 30 | Classes = mediaItem.Classes; 31 | Degree = mediaItem.Degree; 32 | Cooldown = mediaItem.Cooldown; 33 | Duration = mediaItem.Duration; 34 | MaxStack = mediaItem.MaxStack; 35 | 36 | Stack = 1; 37 | PlusValue = 0; 38 | Slot = 0; 39 | HasAdvance = false; 40 | Blues = new Dictionary(); 41 | Stats = new Dictionary(); 42 | } 43 | 44 | public InventoryItem Clone() 45 | { 46 | return (InventoryItem)this.MemberwiseClone(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/LevelUpAnimation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Entity 9 | { 10 | public class LevelUpAnimation 11 | { 12 | /// 13 | /// NOTE: This gets called when level up animation occurs(If a character gaiend 5 levels at once -> this gets called one time, 14 | /// If a character gained 1 level -> this gets called one time) this basically starts the level up particles for a specific character. 15 | /// The object returned is the Information.Objects.Character getting the level up particles. 16 | /// 17 | public static event Action OnCharacterLevelUpAnimation; 18 | 19 | 20 | /// 21 | /// This gets called once the level up particles starts for the client. 22 | /// NOTE this does not mean the character gained 1 level, could be more than 1. 23 | /// 24 | public static event Action OnClientLevelUpAnimation; 25 | 26 | public static void Parse(Packet p) 27 | { 28 | uint uid = p.ReadUInt32(); 29 | 30 | if(Client.NearbyCharacters.ContainsKey(uid)) 31 | OnCharacterLevelUpAnimation?.Invoke(Client.NearbyCharacters[uid]); 32 | if (Client.Info.UniqueID == uid) 33 | OnClientLevelUpAnimation?.Invoke(); 34 | } 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Spells/SpellUsed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Spells 9 | { 10 | public class SpellUsed 11 | { 12 | 13 | public delegate void EntitySpellUsedHandler(EntitySpellUsedEventArgs e); 14 | public static event EntitySpellUsedHandler OnEntitySpellUsed; 15 | 16 | public static void Parse(Packet p) 17 | { 18 | if(p.ReadUInt8() == 0x01) 19 | { 20 | if(p.ReadUInt8() == 0x02) 21 | { 22 | if(p.ReadUInt8() == 0x30) 23 | { 24 | uint spell_id = p.ReadUInt32(); 25 | uint attacker_id = p.ReadUInt32(); 26 | p.ReadUInt32(); //Spell temp id 27 | uint victim_id = p.ReadUInt32(); 28 | OnEntitySpellUsed?.Invoke(new EntitySpellUsedEventArgs() { SpellID = spell_id, AttackerID = attacker_id, VictimID = victim_id }); 29 | } 30 | } 31 | else 32 | { 33 | if(p.ReadUInt8() == 0x30) 34 | { 35 | //?? 36 | } 37 | } 38 | } 39 | } 40 | } 41 | 42 | public class EntitySpellUsedEventArgs : EventArgs 43 | { 44 | public uint SpellID; 45 | public uint AttackerID; 46 | public uint VictimID; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Party/PartyMatchingEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Party 8 | { 9 | public class PartyMatchingEntry 10 | { 11 | public uint PartyNumber { get; set; } 12 | private CharacterRace Race { get; set; } 13 | public string MasterName { get; set; } 14 | public uint MasterUniqueID { get; set; } 15 | public string Title { get; set; } 16 | public PartyObjective Purpose { get; set; } = PartyObjective.Hunting; 17 | public byte MinLevel { get; set; } 18 | public byte MaxLevel { get; set; } 19 | public byte CurrMembers { get; set; } 20 | public byte MaxMembers { get; set; } 21 | public PartyType Type { get; set; } 22 | 23 | 24 | public PartyMatchingEntry(uint _number, string _name, uint _uid, string _title, PartyObjective _purpose, byte _min, byte _max, byte _currMembers, PartyType _type) 25 | { 26 | PartyNumber = _number; 27 | //Race = _race; 28 | MasterName = _name; 29 | MasterUniqueID = _uid; 30 | Title = _title; 31 | Purpose = _purpose; 32 | MinLevel = _min; 33 | MaxLevel = _max; 34 | CurrMembers = _currMembers; 35 | MaxMembers = 8; 36 | Type = _type; 37 | 38 | if (Type == PartyType.ExpFreeForAll_ItemFreeForAll || Type == PartyType.ExpFreeForAll_ItemShare) 39 | MaxMembers = 4; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/Item.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects 8 | { 9 | public class Item : Base 10 | { 11 | 12 | /// 13 | /// The plus value of the dropped item, this is only available if the item type is enchantable. 14 | /// 15 | public byte PlusValue { get; set; } = 0; 16 | 17 | /// 18 | /// If the item has an owner, you cannot pick it for while. If not the OwnerID is 0xFFFF? (Need to be tested) 19 | /// 20 | public uint OwnerID { get; set; } = 0xFFFF; 21 | 22 | /// 23 | /// The unique id of the type who dropped the item. 24 | /// 25 | public uint DropperUniqueID { get; set; } 26 | 27 | /// 28 | /// This is the source that dropped the item *Used as integers for now*. 29 | /// 30 | public byte DropSource { get; set; } 31 | 32 | /// 33 | /// This is only available if the dropped item is either a Quest or a Trade. 34 | /// 35 | public string OwnerName { get; set; } 36 | 37 | 38 | /// 39 | /// Item rarity state (SOX, Normal, etc..) 40 | /// 41 | public byte Rarity { get; set; } 42 | 43 | /// 44 | /// Amount of gold dropped, this will have a value in case of the item is gold only. 45 | /// 46 | public uint Amount { get; set; } = 0; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/COS/RideState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.COS 10 | { 11 | class RideState 12 | { 13 | public static void Parse(Packet p) 14 | { 15 | int success = p.ReadInt8(); 16 | if(success == 1) 17 | { 18 | uint charUID = p.ReadUInt32(); //Character unique ID associated with the COS Ride State Change 19 | byte RideState = p.ReadUInt8(); 20 | uint cosUID = p.ReadUInt32(); 21 | if (Client.NearbyCharacters.ContainsKey(charUID)) 22 | { 23 | if (RideState == 1) 24 | { 25 | Client.NearbyCharacters[charUID].OnTransport = true; 26 | Client.NearbyCharacters[charUID].TransportUniqueID = cosUID; 27 | } 28 | else 29 | { 30 | Client.NearbyCharacters[charUID].OnTransport = false; 31 | Client.NearbyCharacters[charUID].TransportUniqueID = 0; 32 | } 33 | } else if (Client.Info.UniqueID == charUID) 34 | { 35 | Client.Info.TransportFlag = RideState; 36 | if (RideState == 0) 37 | Client.Info.TransportUniqueID = 0; 38 | else 39 | Client.Info.TransportUniqueID = cosUID; 40 | } 41 | } 42 | 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/obj/Debug/SilkroadInformationAPI.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\3DProgrammer\Documents\College\Algorithms\SilkroadInformationAPI\SilkroadInformationAPI\bin\Debug\SilkroadInformationAPI.dll 2 | C:\Users\3DProgrammer\Documents\College\Algorithms\SilkroadInformationAPI\SilkroadInformationAPI\bin\Debug\SilkroadInformationAPI.pdb 3 | C:\Users\3DProgrammer\Documents\College\Algorithms\SilkroadInformationAPI\SilkroadInformationAPI\bin\Debug\PK2Reader.dll 4 | C:\Users\3DProgrammer\Documents\College\Algorithms\SilkroadInformationAPI\SilkroadInformationAPI\obj\Debug\SilkroadInformationAPI.csprojResolveAssemblyReference.cache 5 | C:\Users\3DProgrammer\Documents\College\Algorithms\SilkroadInformationAPI\SilkroadInformationAPI\obj\Debug\SilkroadInformationAPI.dll 6 | C:\Users\3DProgrammer\Documents\College\Algorithms\SilkroadInformationAPI\SilkroadInformationAPI\obj\Debug\SilkroadInformationAPI.pdb 7 | C:\Users\3DProgrammer\Documents\College\Algorithms\SilkroadInformationAPI\SilkroadInformationAPI\bin\Debug\SilkroadSecurityApi.dll 8 | C:\Users\3DProgrammer\Source\Repos\SilkroadInformationAPI\SilkroadInformationAPI\obj\Debug\SilkroadInformationAPI.csprojResolveAssemblyReference.cache 9 | C:\Users\3DProgrammer\Source\Repos\SilkroadInformationAPI\SilkroadInformationAPI\obj\Debug\SilkroadInformationAPI.dll 10 | C:\Users\3DProgrammer\Source\Repos\SilkroadInformationAPI\SilkroadInformationAPI\obj\Debug\SilkroadInformationAPI.pdb 11 | C:\Users\3DProgrammer\Source\Repos\SilkroadInformationAPI\SilkroadInformationAPI\bin\Debug\SilkroadInformationAPI.dll 12 | C:\Users\3DProgrammer\Source\Repos\SilkroadInformationAPI\SilkroadInformationAPI\bin\Debug\SilkroadInformationAPI.pdb 13 | C:\Users\3DProgrammer\Source\Repos\SilkroadInformationAPI\SilkroadInformationAPI\bin\Debug\PK2Reader.dll 14 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Party/Party.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Party 8 | { 9 | public class Party 10 | { 11 | public string PartyMaster { get; set; } 12 | public uint MasterUniqueID { get; set; } 13 | public PartyMatchingEntry PartyMatching; 14 | public byte MembersCount { get; set; } = 0; 15 | public PartyType Type { get; set; } 16 | public Dictionary PartyMembers = new Dictionary(); 17 | 18 | public Party() 19 | { 20 | PartyMembers = new Dictionary(); 21 | } 22 | 23 | public class PartyMember 24 | { 25 | public uint UniqueID { get; set; } 26 | public string Name { get; set; } 27 | public string GuildName { get; set; } 28 | public byte Level { get; set; } 29 | public uint RefModelID { get; set; } 30 | public byte HPPercentage { get; set; } 31 | public byte MPPercentage { get; set; } 32 | public BasicInfo.Position Position { get; set; } 33 | 34 | public PartyMember(uint _unique, string name, string _guildName, byte level, uint modelID, byte HP, byte MP, BasicInfo.Position pos) 35 | { 36 | UniqueID = _unique; 37 | Name = name; 38 | GuildName = _guildName; 39 | Level = level; 40 | RefModelID = modelID; 41 | HPPercentage = HP; 42 | MPPercentage = MP; 43 | Position = pos; 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Stalls/Stall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Stalls 8 | { 9 | public class Stall 10 | { 11 | 12 | /// 13 | /// True if the character have a stall created. 14 | /// 15 | public bool StallCreated { get; set; } = false; 16 | 17 | /// 18 | /// Returns the stall name. 19 | /// 20 | public string StallName { get; set; } 21 | 22 | /// 23 | /// Returns the reference id from (characterdata) used as a stall decoration. 24 | /// 25 | public uint DecorationModelID { get; set; } 26 | 27 | /// 28 | /// Determines whether the stall is opened or closed. 29 | /// 30 | public bool Opened { get; set; } = false; 31 | 32 | /// 33 | /// Stall message. 34 | /// 35 | public string Message { get; set; } = ""; 36 | 37 | /// 38 | /// List of current stall items. 39 | /// 40 | public Dictionary StallItems = new Dictionary(); 41 | 42 | 43 | public Dictionary PeopleInStall = new Dictionary(); 44 | 45 | public uint UniqueID { get; set; } 46 | 47 | public void Update(string _StallName, bool _StallCreated, uint _Decoration) 48 | { 49 | this.StallCreated = _StallCreated; 50 | this.StallName = _StallName; 51 | this.DecorationModelID = _Decoration; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/ShardResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class ShardResponse 11 | { 12 | public delegate void ShardResponseHandler(ShardResponseEventArgs ServerShards); 13 | public static event ShardResponseHandler OnGatewayShardResponse; 14 | 15 | public static void Parse(Packet p) 16 | { 17 | List Shards = new List(); 18 | while (p.ReadUInt8() == 1) 19 | { 20 | p.ReadUInt8(); //Farm ID 21 | p.ReadAscii(); //Farm name 22 | } 23 | 24 | //Servers 25 | while (p.ReadUInt8() == 1) 26 | { 27 | ushort shardID = p.ReadUInt16(); 28 | string shardName = p.ReadAscii(); 29 | ushort OnlineCount = p.ReadUInt16(); 30 | ushort Capacity = p.ReadUInt16(); 31 | byte Status = p.ReadUInt8(); 32 | p.ReadUInt8(); //Farm ID 33 | 34 | Shards.Add(new Information.Gateway.Shard(shardID, shardName, OnlineCount, Capacity, Status)); 35 | } 36 | 37 | OnGatewayShardResponse?.Invoke(new Gateway.ShardResponseEventArgs(Shards)); 38 | } 39 | } 40 | 41 | public class ShardResponseEventArgs : EventArgs 42 | { 43 | public List ServerShards; 44 | 45 | public ShardResponseEventArgs(List shards) 46 | { 47 | ServerShards = shards; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Party/PartyUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Party 9 | { 10 | class PartyUtility 11 | { 12 | public static Information.Party.Party.PartyMember ParseMember(Packet p) 13 | { 14 | Information.BasicInfo.Position pos = new Information.BasicInfo.Position(); 15 | p.ReadUInt8(); //0xFF?? PVPFlag maybe? 16 | uint uid = p.ReadUInt32(); 17 | string name = p.ReadAscii(); 18 | uint modelID = p.ReadUInt32(); 19 | byte Level = p.ReadUInt8(); 20 | byte MPHP = p.ReadUInt8(); 21 | pos.RegionID = p.ReadUInt16(); 22 | if (pos.RegionID < short.MaxValue) 23 | { //World 24 | pos.X = p.ReadUInt16(); 25 | pos.Y = p.ReadUInt16(); 26 | pos.Z = p.ReadUInt16(); 27 | } 28 | else 29 | { //Dungeon 30 | pos.X = p.ReadUInt32(); 31 | pos.Y = p.ReadUInt32(); 32 | pos.Z = p.ReadUInt32(); 33 | } 34 | p.ReadUInt32(); //TODO, need to sleep 35 | string guildName = p.ReadAscii(); //Guild name 36 | p.ReadUInt8(); //TODO 37 | p.ReadUInt32(); //Mastery Tree 1 38 | p.ReadUInt32(); //Mastery Tree 2 39 | 40 | return new Information.Party.Party.PartyMember(uid, name, guildName, Level, modelID, 41 | Convert.ToByte(MPHP.ToString("X2")[1].ToString(), 16), 42 | Convert.ToByte(MPHP.ToString("X2")[0].ToString(), 16), pos); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Stall/Updated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Stall 9 | { 10 | class Updated 11 | { 12 | public static void Parse(Packet p) 13 | { 14 | byte result = p.ReadUInt8(); 15 | byte flag = p.ReadUInt8(); 16 | 17 | if(flag == 0x01) //Item updated in stall 18 | { 19 | byte slot = p.ReadUInt8(); 20 | 21 | if (Client.CurrentStall.StallItems.ContainsKey(slot)) 22 | { 23 | Client.CurrentStall.StallItems[slot].Stack = p.ReadUInt16(); 24 | Client.CurrentStall.StallItems[slot].Price = p.ReadUInt64(); 25 | } 26 | } else if(flag == 0x02) //Item added 27 | { 28 | p.ReadUInt16(); //?? 29 | 30 | StallUtility.ClearCurrentStall(); 31 | StallUtility.ParseCurrentStallItems(p); 32 | } else if(flag == 0x03) //Item removed 33 | { 34 | p.ReadUInt16(); //?? 35 | 36 | byte slot = p.ReadUInt8(); 37 | if (Client.CurrentStall.StallItems.ContainsKey(slot)) 38 | Client.CurrentStall.StallItems.Remove(slot); 39 | } else if(flag == 0x05) 40 | { 41 | Client.CurrentStall.Opened = (p.ReadUInt8() == 1); 42 | } else if(flag == 0x06) 43 | { 44 | Client.CurrentStall.Message = p.ReadAscii(); 45 | } else if(flag == 0x07) 46 | { 47 | NameUpdated.Parse(p); 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Stall/Action.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Stall 9 | { 10 | public class Action 11 | { 12 | public static event System.Action OnCharacterEnterCurrentStall; 13 | public static event System.Action OnCharacterLeaveCurrentStall; 14 | public static event System.Action OnCharacterBuyingItem; 15 | 16 | public static void Parse(Packet p) 17 | { 18 | byte action = p.ReadUInt8(); 19 | if(action == 1) //Character left 20 | { 21 | uint uid = p.ReadUInt32(); 22 | if (Client.CurrentStall.PeopleInStall.ContainsKey(uid)) 23 | { 24 | OnCharacterLeaveCurrentStall?.Invoke(Client.CurrentStall.PeopleInStall[uid]); 25 | Client.CurrentStall.PeopleInStall.Remove(uid); 26 | } 27 | } else if(action == 2) //Character entered 28 | { 29 | uint uid = p.ReadUInt32(); 30 | Client.CurrentStall.PeopleInStall.Add(uid, Actions.Mapping.GetCharNameFromUID(uid)); 31 | OnCharacterEnterCurrentStall?.Invoke(Client.CurrentStall.PeopleInStall[uid]); 32 | } else if(action == 3) //Item bought 33 | { 34 | byte slot = p.ReadUInt8(); //Bought slot 35 | string name = p.ReadAscii(); //Buying character name 36 | OnCharacterBuyingItem?.Invoke(Client.CurrentStall.StallItems[slot], name); 37 | Client.CurrentStall.StallItems.Remove(slot); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Spells/BuffStart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Spells 9 | { 10 | public class BuffStarted 11 | { 12 | public delegate void BuffStartedHandler(BuffStartedEventArgs e); 13 | public static event BuffStartedHandler OnBuffAdded; 14 | public static void Parse(Packet p) 15 | { 16 | uint BuffedUID = p.ReadUInt32(); 17 | uint BuffRefID = p.ReadUInt32(); 18 | uint SkillUID = p.ReadUInt32(); 19 | if (SkillUID != 0) 20 | { 21 | if (Client.Info.UniqueID == BuffedUID) 22 | { 23 | if (Client.State.Buffs.ContainsKey(SkillUID)) 24 | Client.State.Buffs.Remove(SkillUID); 25 | Client.State.Buffs.Add(SkillUID, new Information.Spells.Skill(BuffRefID, 0)); 26 | } 27 | else if (Client.NearbyCharacters.ContainsKey(BuffedUID)) 28 | { 29 | if (Client.NearbyCharacters[BuffedUID].State.Buffs.ContainsKey(SkillUID)) 30 | Client.NearbyCharacters[BuffedUID].State.Buffs.Remove(SkillUID); 31 | Client.NearbyCharacters[BuffedUID].State.Buffs.Add(SkillUID, new Information.Spells.Skill(BuffRefID, 0)); 32 | } 33 | OnBuffAdded?.Invoke(new BuffStartedEventArgs() { BuffedCharacterUniqueID = BuffedUID, BuffObjectRefID = BuffRefID, SkillUniqueID = SkillUID }); 34 | } 35 | } 36 | } 37 | public class BuffStartedEventArgs : EventArgs 38 | { 39 | public uint BuffedCharacterUniqueID; 40 | public uint BuffObjectRefID; 41 | public uint SkillUniqueID; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Party/PartyMatchingEntryFormed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Party 9 | { 10 | public class PartyMatchingEntryFormed 11 | { 12 | /// 13 | /// This is called upon the creation of party matching entry, the entry details is stored in Client.Party.PartyMatching 14 | /// NOTE: This is only called if the client is creating the matching entry. 15 | /// 16 | public static event Action OnPartyMatchingEntryFormed; 17 | 18 | /// 19 | /// This is called upon party matching entry changing. 20 | /// 21 | public static event Action OnPartyMatchingEntryEdited; 22 | public static void Parse(Packet p) 23 | { 24 | byte success = p.ReadUInt8(); 25 | if(success == 1) 26 | { 27 | uint EntryNumber = p.ReadUInt32(); 28 | p.ReadUInt32(); // ?? 29 | var Type = (PartyType)p.ReadUInt8(); 30 | var Purpose = (PartyObjective)p.ReadUInt8(); 31 | var MinLevel = p.ReadUInt8(); 32 | var MaxLevel = p.ReadUInt8(); 33 | var Title = p.ReadAscii(); 34 | 35 | Client.Party.PartyMatching = new Information.Party.PartyMatchingEntry(EntryNumber, Client.Info.CharacterName, Client.Info.UniqueID, Title, Purpose, MinLevel, MaxLevel, Client.Party.MembersCount, Type); 36 | 37 | if(p.Opcode == 0xB069) // Entry formed event 38 | { 39 | OnPartyMatchingEntryFormed?.Invoke(); 40 | } else if(p.Opcode == 0xB06A) //Entry changed event 41 | { 42 | OnPartyMatchingEntryEdited?.Invoke(); 43 | } 44 | 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Media/Data.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Media 8 | { 9 | public class Data 10 | { 11 | public static Dictionary MediaModels = new Dictionary(); 12 | public static Dictionary MediaItems = new Dictionary(); 13 | public static Dictionary MediaSkills = new Dictionary(); 14 | public static List MediaShops = new List(); 15 | public static Dictionary MediaRegions = new Dictionary(); 16 | public static Dictionary> refshoptab = new Dictionary>(); 17 | public static Dictionary> refshopgoods = new Dictionary>(); 18 | public static Dictionary refscrapofpackageitem = new Dictionary(); 19 | public static Dictionary> refmappingshopwithtab = new Dictionary>(); 20 | public static Dictionary refmappingshopgroup = new Dictionary(); 21 | public static Dictionary refshopgroup = new Dictionary(); 22 | public static Dictionary MediaBlues = new Dictionary(); 23 | public static Dictionary Translation = new Dictionary(); 24 | public static Dictionary LevelDataMaxEXP = new Dictionary(); 25 | public static Dictionary TextZoneName = new Dictionary(); 26 | public static DataInfo.ServerInfo ServerInfo = new DataInfo.ServerInfo(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Party/PartyMatchingResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadInformationAPI.Client.Information.Party; 7 | using SilkroadSecurityApi; 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.Party 10 | { 11 | public class PartyMatchingResponse 12 | { 13 | public delegate void MatchingListPartyHandler(MatchingListEventArgs e); 14 | /// 15 | /// This is called after requesting party list(0x706C) 16 | /// 17 | public static event MatchingListPartyHandler OnMatchingListReceive; 18 | 19 | public static void Parse(Packet p) 20 | { 21 | var list = new List(); 22 | 23 | byte flag1 = p.ReadUInt8(); 24 | byte flag2 = p.ReadUInt8(); 25 | if(flag1 == 1 && flag2 == 1) 26 | { 27 | p.ReadUInt8(); 28 | int count = p.ReadUInt8(); 29 | for(int i = 0; i < count; i++) 30 | { 31 | uint number = p.ReadUInt32(); 32 | uint uid = p.ReadUInt32(); 33 | string MasterName = p.ReadAscii(); 34 | var Race = (CharacterRace)p.ReadUInt8(); 35 | byte CurrMembers = p.ReadUInt8(); 36 | var Type = (PartyType)p.ReadUInt8(); 37 | var Purpose = (PartyObjective)p.ReadUInt8(); 38 | byte MinLevel = p.ReadUInt8(); 39 | byte MaxLevel = p.ReadUInt8(); 40 | string Title = p.ReadAscii(); 41 | 42 | list.Add(new PartyMatchingEntry(number, MasterName, uid, Title, Purpose, MinLevel, MaxLevel, CurrMembers, Type)); 43 | } 44 | } 45 | 46 | OnMatchingListReceive?.Invoke(new MatchingListEventArgs(list)); 47 | } 48 | } 49 | 50 | public class MatchingListEventArgs : EventArgs 51 | { 52 | public List MatchingListParty; 53 | 54 | public MatchingListEventArgs(List _match) 55 | { 56 | MatchingListParty = _match; 57 | } 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/COS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects 8 | { 9 | public class COS : Base 10 | { 11 | 12 | /// 13 | /// Pet name only available in case of Pickup pet, Attack pet 14 | /// 15 | public string COSName { get; set; } 16 | 17 | /// 18 | /// Guild name only available in case of Guild COS, Fortress COS 19 | /// 20 | public string COSGuildName { get; set; } 21 | 22 | 23 | /// 24 | /// Guild ID, only available in case of Fortrses COS 25 | /// 26 | public uint FortressCOSGuildID { get; set; } 27 | 28 | /// 29 | /// Guild Name, only available in case of Fortrses COS 30 | /// 31 | public string FortressCOSGuildName { get; set; } 32 | 33 | /// 34 | /// Owner name in case of Pickup COS, Attack COS 35 | /// 36 | public string OwnerName { get; set; } 37 | 38 | /// 39 | /// The unique ID of the owner 40 | /// 41 | public uint OwnerUniqueID { get; set; } 42 | 43 | /// 44 | /// Maximum inventory slots, in case of Job/Pickup pet. 45 | /// 46 | public byte MaxInventorySlots { get; set; } 47 | 48 | /// 49 | /// Current PET HP, this is not always available 50 | /// 51 | public uint CurrentHP { get; set; } 52 | 53 | /// 54 | /// Whether or not the COS has bad status effect. 55 | /// 56 | public bool BadStatus { get; set; } 57 | 58 | /// 59 | /// COS Max Hp 60 | /// 61 | public uint MaxHP { get; set; } 62 | 63 | public ushort MaxHGP { get; set; } = 10000; 64 | public ushort CurrentHGP { get; set; } 65 | 66 | public Dictionary Inventory = new Dictionary(); 67 | 68 | /// 69 | /// Summon type (Pickup pet, Fortress pet, Guild pet..) 70 | /// 71 | public COS_Type Type = COS_Type.None; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Chat/ChatUpdated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Chat 9 | { 10 | public class ChatUpdated 11 | { 12 | public static event Action OnChatReceive; 13 | public static void Parse(Packet p) 14 | { 15 | uint uniqueID = 0; 16 | string name = ""; 17 | 18 | byte chatFlag = p.ReadUInt8(); 19 | var chatType = (ChatType)chatFlag; 20 | if (chatType == ChatType.All || 21 | chatType == ChatType.AllGM || 22 | chatType == ChatType.NPC) 23 | { 24 | uniqueID = p.ReadUInt32(); 25 | 26 | } 27 | else if (chatType == ChatType.PM || 28 | chatType == ChatType.Party || 29 | chatType == ChatType.Guild || 30 | chatType == ChatType.Global || 31 | chatType == ChatType.Stall || 32 | chatType == ChatType.Union || 33 | chatType == ChatType.Accademy) 34 | { 35 | name = p.ReadAscii(); 36 | } 37 | 38 | string message = p.ReadAscii(); 39 | 40 | if(name == "") 41 | name = Actions.Mapping.GetCharNameFromUID(uniqueID); 42 | 43 | OnChatReceive?.Invoke(new Information.Chat.ChatMessage(message, name, uniqueID, chatType)); 44 | 45 | if (Client.Chat.ContainsKey(chatType)) 46 | Client.Chat[chatType].Add(new Information.Chat.ChatMessage(message, name, uniqueID, chatType)); 47 | else 48 | Client.Chat.Add(chatType, new List() { new Information.Chat.ChatMessage(message, name, uniqueID, chatType) }); 49 | 50 | if (Client.Chat.ContainsKey(ChatType.All) && chatType != ChatType.All) 51 | Client.Chat[ChatType.All].Add(new Information.Chat.ChatMessage(message, name, uniqueID, chatType)); 52 | else if (!Client.Chat.ContainsKey(ChatType.All) && chatType != ChatType.All) 53 | Client.Chat.Add(ChatType.All, new List() { new Information.Chat.ChatMessage(message, name, uniqueID, chatType) }); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Alchemy/EnchantResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Alchemy 9 | { 10 | public class EnchantResult 11 | { 12 | public delegate void ReinforcementResultHandler(FuseResultEventArgs e); 13 | /// 14 | /// This event gets called whenever packet 0xB150 is received, after elixir is added on the item. 15 | /// NOTE: This is called AFTER 0x3040(Item count updated due to alchemy). 16 | /// 17 | public static event ReinforcementResultHandler OnReinforceResult; 18 | 19 | public delegate void EnchantmentResultHandler(FuseResultEventArgs e); 20 | /// 21 | /// This event gets called whenever packet 0xB151 is received, after a stone is added on the item. 22 | /// NOTE: This is called AFTER 0x3040(Item count updated due to alchemy). 23 | /// 24 | public static event EnchantmentResultHandler OnEnchantResult; 25 | 26 | public static void Parse(Packet p) 27 | { 28 | byte flag1 = p.ReadUInt8(); 29 | if(flag1 == 0x01) //No errrors 30 | { 31 | byte flag2 = p.ReadUInt8(); 32 | if(flag2 == 0x02) // ?? 33 | { 34 | bool EnchantSuccess = (p.ReadUInt8() == 1); 35 | byte ItemSlot = p.ReadUInt8(); 36 | p.ReadUInt32(); //Rent Type 37 | p.ReadUInt32(); //Item ref id, why? 38 | Client.InventoryItems[ItemSlot].PlusValue = p.ReadUInt8(); 39 | Client.InventoryItems[ItemSlot].Stats = Actions.Utility.CalculateWhiteStats(p.ReadUInt64(), Client.InventoryItems[ItemSlot].Type); //White stats 40 | Client.InventoryItems[ItemSlot].Stats.Add("DURABILITY", p.ReadInt32()); //DURABILITY 41 | byte currBlues = p.ReadUInt8(); 42 | Client.InventoryItems[ItemSlot].Blues = AlchemyUtility.ParseBlues(p, currBlues); 43 | 44 | if(p.Opcode == 0xB151) 45 | OnEnchantResult?.Invoke(new FuseResultEventArgs(EnchantSuccess, Client.InventoryItems[ItemSlot])); 46 | else 47 | OnReinforceResult?.Invoke(new FuseResultEventArgs(EnchantSuccess, Client.InventoryItems[ItemSlot])); 48 | } 49 | } 50 | 51 | } 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/COS/COSData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.COS 9 | { 10 | class COSData 11 | { 12 | public static void Parse(Packet p) 13 | { 14 | uint uid = p.ReadUInt32(); //Unique ID 15 | uint refID = p.ReadUInt32(); //Model ID, can skip since the spawn packet comes first. 16 | var obj = Media.Data.MediaModels[refID]; 17 | 18 | Client.NearbyCOSs[uid].MaxHP = p.ReadUInt32(); // MaxHP? 19 | p.ReadUInt32(); // MaxHP? 20 | 21 | if (obj.Classes.F == 1) //Normal COS 22 | { 23 | p.ReadUInt8(); // UNK ?? something with spawned pet count 24 | } else if(obj.Classes.F == 2) //Job COS 25 | { 26 | p.ReadUInt8(); //Max transport slots 27 | byte currCount = p.ReadUInt8(); //Current transport items 28 | for (int i = 0; i < currCount; i++) 29 | Inventory.InventoryUtility.ParseItem(p); 30 | p.ReadUInt32(); //Owner Unique ID 31 | } 32 | else if(obj.Classes.F == 3) //Attack COS 33 | { 34 | p.ReadUInt64(); //Pet EXP 35 | p.ReadUInt8(); //Level? 36 | Client.NearbyCOSs[uid].CurrentHGP = p.ReadUInt16(); //HGP Points 37 | p.ReadUInt32(); //?? 38 | p.ReadAscii(); //COS Name 39 | p.ReadUInt8(); //?? 40 | p.ReadUInt32(); //Owned unique id 41 | p.ReadUInt8(); // UNK ?? something with spawned pet count 42 | } else if(obj.Classes.F == 4) //Pickup COS 43 | { 44 | Client.NearbyCOSs[uid].Inventory.Clear(); 45 | 46 | p.ReadUInt32(); //Pet settings in binary 47 | p.ReadAscii(); //COS Name 48 | p.ReadUInt8(); //COS inventory size 49 | byte currCount = p.ReadUInt8(); 50 | for (int i = 0; i < currCount; i++) 51 | { 52 | var item = Inventory.InventoryUtility.ParseItem(p); 53 | Client.NearbyCOSs[uid].Inventory.Add(item.Slot, item); 54 | } 55 | p.ReadUInt32(); //Owner unique id 56 | p.ReadUInt8(); // UNK ?? something with spawned pet count 57 | } else if(obj.Classes.F == 5) //Guild COS 58 | { 59 | //TODO: test on a server with active Guild COS 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Info.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information 8 | { 9 | public class Info 10 | { 11 | public int RegionID { get; set; } 12 | public int ModelID { get; set; } 13 | public uint UniqueID { get; set; } 14 | public int Level { get; set; } 15 | public int MaxGameLevel { get; set; } 16 | public ulong MaxEXP { get; set; } 17 | public ulong CurrentExp { get; set; } 18 | public int SPLoadingBar { get; set; } 19 | public ulong Gold { get; set; } 20 | public uint SP { get; set; } 21 | public short StatPoints { get; set; } 22 | public bool Zerk { get; set; } 23 | public uint MaxHP { get; set; } 24 | public uint MaxMP { get; set; } 25 | public uint CurrentHP { get; set; } 26 | public uint CurrentMP { get; set; } 27 | public int MaxInventorySlots { get; set; } 28 | public int CurrentInvItemsCount { get; set; } 29 | public string CharacterName { get; set; } 30 | public string JobName { get; set; } 31 | public byte JobType { get; set; } 32 | public byte JobLevel { get; set; } 33 | public uint JobExp { get; set; } 34 | public uint JobContribution { get; set; } 35 | public uint JobReward { get; set; } 36 | public byte PVPState { get; set; } 37 | public byte TransportFlag { get; set; } 38 | public uint TransportUniqueID { get; set; } = 0; 39 | public byte InCombat { get; set; } 40 | public byte PVPFlag { get; set; } 41 | public ulong GuideFlag { get; set; } 42 | public uint JID { get; set; } // ? 43 | public byte GMFlag { get; set; } 44 | public bool BadStatus { get; set; } 45 | public uint BadStatusID { get; set; } 46 | public bool ZerkOn { get; set; } = false; 47 | public FRPVPMode PVPCape { get; set; } = FRPVPMode.None; 48 | public CharacterRace Race { get; set; } = CharacterRace.None; 49 | //public Dictionary CharacterCOSe = new Dictionary(); 50 | 51 | //STATS 52 | public uint MinimumPhysicalAttack; 53 | public uint MaximumPhysicalAttack; 54 | public uint MinimumMagicalAttack; 55 | public uint MaximumMagicalAttack; 56 | public ushort PhysicalDefense; 57 | public ushort MagicalDefense; 58 | public ushort HitRate; 59 | public ushort ParryRate; 60 | public ushort STR; 61 | public ushort INT; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/Object.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects 8 | { 9 | class Object : Base 10 | { 11 | public string Name { get; set; } 12 | public byte Scale { get; set; } 13 | public byte PVPCape { get; set; } 14 | public byte PVPState { get; set; } 15 | public byte TransportFlag { get; set; } 16 | public uint TransportUniqueID { get; set; } 17 | public byte InCombat { get; set; } 18 | public byte UsingScroll { get; set; } 19 | public byte InventorySize { get; set; } 20 | public byte JobType { get; set; } 21 | public byte JobLevel { get; set; } 22 | public byte InteractMode { get; set; } 23 | public Stalls.Stall Stall = new Stalls.Stall(); 24 | public bool WearingMask { get; set; } = false; 25 | public Guilds.Guild Guild = new Guilds.Guild(); 26 | public List Inventory = new List(); 27 | public List AvatarInventory = new List(); 28 | public BasicInfo.Movement Movement = new BasicInfo.Movement(); 29 | public BasicInfo.State State = new BasicInfo.State(); 30 | public byte PVPEquipCooldown { get; set; } 31 | 32 | //COS 33 | public string PetGuildName; 34 | public string Owner; 35 | public COS_Type COSType = COS_Type.None; 36 | 37 | //Structure 38 | public uint HP; 39 | public uint EventStructID; 40 | public ushort StructureState; 41 | 42 | //NPC 43 | public byte TalkableNPC; 44 | public byte Rarity; 45 | public byte Appearance; 46 | 47 | //ITEMS 48 | public byte OptValue; 49 | public uint Amount; 50 | public uint OwnerID; 51 | public uint DropperUniqueID; 52 | public byte DropSource; 53 | 54 | //EVENT_ZONE 55 | public uint SkillID; 56 | 57 | public bool CharacterInJobSuit() 58 | { 59 | for(int i = 0; i < Inventory.Count; i++) 60 | { 61 | var item = Media.Data.MediaModels[Inventory[i].ModelID]; 62 | if(item.Classes.C == 3 && item.Classes.D == 1 && item.Classes.E == 7 && item.Classes.F != 5) 63 | { 64 | return true; 65 | } 66 | } 67 | return false; 68 | } 69 | 70 | 71 | public byte type { get; set; } = 0; //Character = 0, NPC = 1, MOB = 2, Item = 3, COS = 4, struct = 5, Buff area = 6; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Character/ExpSPUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Character 9 | { 10 | public class ExpSpUpdate 11 | { 12 | /// 13 | /// This gets called when the client gains exp. 14 | /// The returned object represents the amount of exp gained, you can still get the current total EXP from Client.Info.CurrentExp 15 | /// 16 | public static event Action OnExpGained; 17 | public static event Action OnClientLevelUp; 18 | //public delegate void ClientLevelUpHandler(ClientLevelUpEventArgs e); 19 | ///// 20 | ///// This is called when the client levels up. 21 | ///// 22 | //public static event ClientLevelUpHandler OnClientLevelUp; 23 | 24 | public static void Parse(Packet p) 25 | { 26 | uint source_uid = p.ReadUInt32(); 27 | ulong exp = p.ReadUInt64(); 28 | ulong SP = p.ReadUInt64(); //TODO: Configure SP 29 | Client.Info.SP += (uint)(SP / 400.0); 30 | p.ReadUInt8(); //?? 31 | try { 32 | 33 | if (Client.Info.CurrentExp + exp >= Client.Info.MaxEXP) //If current exp + gained exp is > max "current level" exp, if so then the character gained one or more levels. 34 | { 35 | int OldLevel = Client.Info.Level; 36 | int NewLevel = (p.ReadUInt16() / 3) + 1; 37 | Client.Info.CurrentExp += exp; 38 | for (int i = Client.Info.Level; i < NewLevel; i++) 39 | { 40 | Client.Info.CurrentExp -= Media.Data.LevelDataMaxEXP[i]; 41 | } 42 | Client.Info.Level = NewLevel; 43 | Client.Info.MaxEXP = Media.Data.LevelDataMaxEXP[NewLevel]; 44 | //OnClientLevelUp?.Invoke(new ClientLevelUpEventArgs(NewLevel, OldLevel)); 45 | OnClientLevelUp?.Invoke(); 46 | } else 47 | { 48 | Client.Info.CurrentExp += exp; 49 | } 50 | } catch { } 51 | 52 | OnExpGained?.Invoke(exp); 53 | 54 | } 55 | } 56 | 57 | //public class ClientLevelUpEventArgs : EventArgs 58 | //{ 59 | // public int NewLevel; 60 | // public int OldLevel; 61 | 62 | // public ClientLevelUpEventArgs(int _newLevel, int _oldLevel) 63 | // { 64 | // NewLevel = _newLevel; 65 | // OldLevel = _oldLevel; 66 | // } 67 | //} 68 | } 69 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Inventory/InventoryOperationEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Packets.Inventory 8 | { 9 | public class InventoryOperationEventArgs : EventArgs 10 | { 11 | Information.InventoryItem item; 12 | Information.InventoryItem associated; 13 | 14 | public ChangeType ItemChangeType; 15 | 16 | public InventoryOperationEventArgs(Information.InventoryItem _item, Information.InventoryItem _associated = null) 17 | { 18 | item = _item; 19 | associated = _associated; 20 | ItemChangeType = ChangeType.None; 21 | } 22 | 23 | public InventoryOperationEventArgs(Information.InventoryItem _item, ChangeType _itemChangeType, Information.InventoryItem _associated = null) 24 | { 25 | item = _item; 26 | associated = _associated; 27 | ItemChangeType = _itemChangeType; 28 | } 29 | 30 | /// 31 | /// The item with the change taking place. 32 | /// 33 | /// 34 | public Information.InventoryItem EffectedItem() 35 | { 36 | return item; 37 | } 38 | 39 | /// 40 | /// The item associated with the changes i.e. (if it got swapped with another item, this returns the other item) 41 | /// 42 | /// The associated SilkroadInformationAPI.Client.Information.Item 43 | public Information.InventoryItem AssociatedItem() 44 | { 45 | return associated; 46 | } 47 | 48 | public enum ChangeType 49 | { 50 | Inv_ItemSwappedWithAnotherItem, 51 | Inv_ItemTotallyAddedOnAnotherInstance, 52 | Inv_ItemPartiallyAddedOnAnotherInstance, 53 | Inv_ItemSplitted, 54 | Inv_ItemSlotChanged, 55 | Inv_ItemLooted, 56 | Inv_ItemThrown, 57 | Inv_ItemSoldToNPC, 58 | Inv_ItemBoughtbackFromNPC, 59 | Inv_ItemDisappeared, 60 | Inv_ItemBought, 61 | Storage_ItemSwappedWithAnotherItem, 62 | Storage_ItemSlotChanged, 63 | Storage_ItemAddedToStorage, 64 | Storage_ItemTakenFromStorage, 65 | Storage_ItemTotallyAddedOnAnotherInstance, 66 | Storage_ItemPartiallyAddedOnAnotherInstance, 67 | GuildStorage_ItemSwappedWithAnotherItem, 68 | GuildStorage_ItemSlotChanged, 69 | GuildStorage_ItemAddedStorage, 70 | GuildStorage_ItemTakenFromStorage, 71 | GuildStorage_ItemTotallyAddedOnAnotherInstance, 72 | GuildStorage_ItemPartiallyAddedOnAnotherInstance, 73 | PetInventory_ItemSwappedWithAnotherItem, 74 | PetInventory_ItemSlotChanged, 75 | PetInventory_ItemAddedToInventory, 76 | PetInventory_ItemTakenFromInventory, 77 | PetInventory_ItemTotallyAddedOnAnotherInstance, 78 | PetInventory_ItemPartiallyAddedOnAnotherInstance, 79 | None 80 | } 81 | 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Gateway/LoginResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Gateway 9 | { 10 | public class LoginResponse 11 | { 12 | 13 | public delegate void LoginResponseSuccessHandler(LoginResponseSuccessEventArgs AgentInfo); 14 | public static event LoginResponseSuccessHandler OnGatewayLoginResponseSuccess; 15 | 16 | public delegate void LoginResponseFailedHandler(LoginResponseFailedEventArgs FailureCode); 17 | public static event LoginResponseFailedHandler OnGatewayLoginResponseFailed; 18 | 19 | public static void Parse(Packet p) 20 | { 21 | byte result = p.ReadUInt8(); 22 | if(result == 0x01) 23 | { 24 | uint session = p.ReadUInt32(); 25 | string agentIP = p.ReadAscii(); 26 | ushort agentPort = p.ReadUInt16(); 27 | OnGatewayLoginResponseSuccess?.Invoke(new LoginResponseSuccessEventArgs(session, agentIP, agentPort)); 28 | } else if(result == 0x02) 29 | { 30 | byte error = p.ReadUInt8(); 31 | LoginErrorType errorCode = (LoginErrorType)error; 32 | var args = new LoginResponseFailedEventArgs(errorCode); 33 | if (error == 0x01) 34 | { 35 | args.MaxAttempts = p.ReadUInt32(); 36 | args.CurrentAttempts = p.ReadUInt32(); 37 | } else if(error == 0x02) 38 | { 39 | byte blockType = p.ReadUInt8(); 40 | errorCode = (LoginErrorType)(100 + blockType); 41 | 42 | if (errorCode == LoginErrorType.Banned) 43 | args.BlockReason = p.ReadAscii(); 44 | 45 | args.ErrorCode = errorCode; 46 | } 47 | 48 | OnGatewayLoginResponseFailed?.Invoke(args); 49 | } 50 | } 51 | } 52 | 53 | public class LoginResponseSuccessEventArgs : EventArgs 54 | { 55 | public uint SessionID; 56 | public string AgentIP; 57 | public ushort AgentPort; 58 | 59 | public LoginResponseSuccessEventArgs(uint _session, string _ip, ushort _port) 60 | { 61 | SessionID = _session; 62 | AgentIP = _ip; 63 | AgentPort = _port; 64 | } 65 | } 66 | public class LoginResponseFailedEventArgs : EventArgs 67 | { 68 | public LoginErrorType ErrorCode; 69 | 70 | /// 71 | /// This is only available in case of error being wrong password. 72 | /// 73 | public uint MaxAttempts; 74 | 75 | /// 76 | /// This is only available in case of error being wrong password. 77 | /// 78 | public uint CurrentAttempts; 79 | 80 | /// 81 | /// This is only available in case of error being punishment. 82 | /// 83 | public string BlockReason; 84 | 85 | public LoginResponseFailedEventArgs(LoginErrorType error) 86 | { 87 | ErrorCode = error; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/CharacterSelection/CharacterListResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.CharacterSelection 9 | { 10 | public class CharacterListResponse 11 | { 12 | public delegate void CharacterListHandler(CharacterLsitEventArgs e); 13 | public static event CharacterListHandler OnCharacterListReceive; 14 | 15 | public static void Parse(Packet p) 16 | { 17 | p.ReadUInt8(); 18 | if(p.ReadUInt8() == 0x01) 19 | { 20 | var Chars = new List(); 21 | byte count = p.ReadUInt8(); 22 | for(int i = 0; i < count; i++) 23 | { 24 | var Char = new CharacterLsitEventArgs.SelectionCharacter(); 25 | Char.RefObjID = p.ReadUInt32(); 26 | Char.Name = p.ReadAscii(); 27 | p.ReadUInt8(); //Scale 28 | Char.CurrentLevel = p.ReadUInt8(); 29 | p.ReadUInt64(); //Exp 30 | Char.STR = p.ReadUInt16(); 31 | Char.INT = p.ReadUInt16(); 32 | Char.StatPoints = p.ReadUInt16(); 33 | Char.CurrentHP= p.ReadUInt32(); 34 | Char.CurrentMP = p.ReadUInt32(); 35 | Char.BeingDeleted = (p.ReadUInt8() == 0x01); 36 | if (Char.BeingDeleted) 37 | Char.DeleteTime = p.ReadUInt32(); 38 | p.ReadUInt8(); //Guild 39 | byte flag = p.ReadUInt8(); 40 | if (flag == 0x01) 41 | p.ReadAscii(); 42 | p.ReadUInt8(); //Academy 43 | 44 | byte count2 = p.ReadUInt8(); 45 | for (byte j = 0; j < count2; j++) 46 | Char.Inventory.Add(new Tuple(p.ReadUInt32(), p.ReadUInt8())); 47 | count2 = p.ReadUInt8(); 48 | for (byte j = 0; j < count2; j++) 49 | Char.AvatarInventory.Add(new Tuple(p.ReadUInt32(), p.ReadUInt8())); 50 | Chars.Add(Char); 51 | } 52 | OnCharacterListReceive?.Invoke(new CharacterLsitEventArgs() { Characters = Chars }); 53 | } else 54 | { 55 | //Error code 56 | } 57 | } 58 | } 59 | 60 | public class CharacterLsitEventArgs : EventArgs 61 | { 62 | public List Characters; 63 | 64 | public class SelectionCharacter 65 | { 66 | public uint RefObjID; 67 | public string Name; 68 | public byte CurrentLevel; 69 | public ushort STR; 70 | public ushort INT; 71 | public ushort StatPoints; 72 | public uint CurrentHP; 73 | public uint CurrentMP; 74 | public bool BeingDeleted; 75 | public uint DeleteTime; 76 | public List> Inventory = new List>(); 77 | public List> AvatarInventory = new List>(); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/StateChange.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Entity 9 | { 10 | public class StateChange 11 | { 12 | public static event Action OnMobDie; 13 | public static event Action OnCharacterLifeStateChange; 14 | public static event Action OnClientLifeStateChange; 15 | public static event Action OnCharacterMotionStateChange; 16 | public static event Action OnClientMotionStateChange; 17 | public static event Action OnCharacterStatusChange; 18 | public static event Action OnClientStatusChange; 19 | public static event Action OnCharacterReturnStateChange; 20 | public static event Action OnClientReturnStateChange; 21 | public static void Parse(Packet p) 22 | { 23 | uint uid = p.ReadUInt32(); 24 | byte flag1 = p.ReadUInt8(); 25 | if (flag1 == 0x00) //Object died 26 | { 27 | byte idr = p.ReadUInt8(); 28 | if (Client.NearbyMobs.ContainsKey(uid) && idr == 2) 29 | OnMobDie?.Invoke(uid); 30 | else if (Client.Info.UniqueID == uid) 31 | { 32 | Client.State.LifeState = (idr == 1); 33 | OnClientLifeStateChange?.Invoke(); 34 | } else if(Client.NearbyCharacters.ContainsKey(uid)) 35 | { 36 | Client.NearbyCharacters[uid].State.LifeState = (idr == 1); 37 | OnCharacterLifeStateChange?.Invoke(uid); 38 | } 39 | } else if(flag1 == 0x01) //Motion state change 40 | { 41 | if (Client.NearbyCharacters.ContainsKey(uid)) 42 | { 43 | Client.NearbyCharacters[uid].State.MotionState = (CharMotionState)p.ReadUInt8(); 44 | OnCharacterMotionStateChange?.Invoke(uid); 45 | } else if(Client.Info.UniqueID == uid) 46 | { 47 | Client.State.MotionState = (CharMotionState)p.ReadUInt8(); 48 | OnClientMotionStateChange?.Invoke(); 49 | } 50 | } else if(flag1 == 0x04) //Status change 51 | { 52 | if (Client.NearbyCharacters.ContainsKey(uid)) 53 | { 54 | Client.NearbyCharacters[uid].State.Status = (CharStatus)p.ReadUInt8(); 55 | if(Client.NearbyCharacters[uid].State.Status == CharStatus.Hwan) 56 | p.ReadUInt8(); //Zerk level 57 | OnCharacterStatusChange?.Invoke(uid); 58 | } else if(Client.Info.UniqueID == uid) 59 | { 60 | Client.State.Status = (CharStatus)p.ReadUInt8(); 61 | OnClientStatusChange?.Invoke(); 62 | } 63 | } else if(flag1 == 0x0B) 64 | { 65 | bool returning = (p.ReadUInt8() == 1); 66 | if(Client.Info.UniqueID == uid) 67 | { 68 | Client.State.Returning = returning; 69 | OnClientReturnStateChange?.Invoke(); 70 | } else if(Client.NearbyCharacters.ContainsKey(uid)) 71 | { 72 | Client.NearbyCharacters[uid].State.Returning = returning; 73 | OnCharacterReturnStateChange?.Invoke(uid); 74 | } 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Information/Objects/Character.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI.Client.Information.Objects 8 | { 9 | public class Character : Base 10 | { 11 | /// 12 | /// Character name 13 | /// 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// PVP Cape Color 18 | /// 19 | public FRPVPMode PVPCape { get; set; } = FRPVPMode.None; 20 | 21 | /// 22 | /// PK State of the character 23 | /// 24 | public PK_State PKState { get; set; } = PK_State.Neutral; 25 | 26 | /// 27 | /// True if the character is on COS, false otherwise. 28 | /// 29 | public bool OnTransport { get; set; } = false; 30 | 31 | /// 32 | /// Unique ID of Transport only if OnTransport = true. 33 | /// 34 | public uint TransportUniqueID { get; set; } 35 | 36 | /// 37 | /// Scroll type If the character is channeling a scroll (0 = None, 1 = Return Scroll, 2 = Bandit Return Scroll). 38 | /// 39 | public byte UsingScroll { get; set; } 40 | 41 | /// 42 | /// Character job type. 43 | /// 44 | public JOB_Type JobType { get; set; } = JOB_Type.None; 45 | 46 | /// 47 | /// Character job level 48 | /// 49 | public byte JobLevel { get; set; } 50 | 51 | /// 52 | /// Character stall information. 53 | /// 54 | public Stalls.Stall Stall = new Stalls.Stall(); 55 | 56 | /// 57 | /// Character is wearing a mask (rouge/warlock skills). 58 | /// 59 | public bool WearingMask { get; set; } = false; 60 | 61 | /// 62 | /// Character guild information. 63 | /// 64 | public Guilds.Guild Guild = new Guilds.Guild(); 65 | 66 | /// 67 | /// The items character is wearing. 68 | /// 69 | public List Inventory = new List(); 70 | 71 | /// 72 | /// The avatar items character is wearing. 73 | /// 74 | public List AvatarInventory = new List(); 75 | 76 | /// 77 | /// Character state information 78 | /// 79 | public BasicInfo.State State = new BasicInfo.State(); 80 | 81 | /// 82 | /// Character is in zerk state. 83 | /// 84 | public bool ZerkOn { get; set; } = false; 85 | 86 | /// 87 | /// PVP Cape Timeleft for wearing. 88 | /// 89 | public byte PVPEquipCooldown { get; set; } 90 | 91 | public int X; //TODO: Real X 92 | public int Y; //TODO: Real Y 93 | 94 | /// 95 | /// If there's a bad effect on the character stun, sleep, etc.. 96 | /// 97 | public bool BadStatus { get; set; } = false; 98 | 99 | /// 100 | /// Determines if the character is wearing job suit or no *Checks via ItemTypes*. 101 | /// 102 | /// True if the character is wearing a suit, no otherwise. 103 | public bool CharacterInJobSuit() 104 | { 105 | for (int i = 0; i < Inventory.Count; i++) 106 | { 107 | var item = Media.Data.MediaModels[Inventory[i].ModelID]; 108 | if (item.Classes.C == 3 && item.Classes.D == 1 && item.Classes.E == 7 && item.Classes.F != 5) 109 | { 110 | return true; 111 | } 112 | } 113 | return false; 114 | } 115 | 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Client.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadInformationAPI.Client.Information; 7 | using SilkroadInformationAPI.Client.Information.Spells; 8 | using SilkroadInformationAPI.Client.Information.Quests; 9 | using SilkroadSecurityApi; 10 | 11 | namespace SilkroadInformationAPI.Client 12 | { 13 | public class Client 14 | { 15 | public static Info Info = new Info(); 16 | public static Information.Party.Party Party = new Information.Party.Party(); 17 | 18 | public static Dictionary InventoryItems = new Dictionary(); 19 | public static Dictionary StorageItems = new Dictionary(); 20 | 21 | public static List SoldItems = new List(); 22 | public static List Quests = new List(); 23 | public static List Masteries = new List(); 24 | public static List Skills = new List(); 25 | 26 | public static Information.BasicInfo.Position Position = new Information.BasicInfo.Position(); 27 | public static Information.BasicInfo.Movement Movement = new Information.BasicInfo.Movement(); 28 | public static Information.BasicInfo.State State = new Information.BasicInfo.State(); 29 | 30 | public static Dictionary NearbyCharacters = new Dictionary(); 31 | public static Dictionary NearbyNPCs = new Dictionary(); 32 | public static Dictionary NearbyMobs = new Dictionary(); 33 | public static Dictionary NearbyItems = new Dictionary(); 34 | public static Dictionary NearbyBuffAreas = new Dictionary(); 35 | public static Dictionary NearbyCOSs = new Dictionary(); 36 | public static Dictionary NearbyStructures = new Dictionary(); 37 | 38 | public static Dictionary> Chat = new Dictionary>(); 39 | public static Information.Stalls.Stall CurrentStall = new Information.Stalls.Stall(); 40 | public static bool CharacterInStall = false; 41 | public static uint SelectedUniqueID; 42 | 43 | public static void RefreshClient() 44 | { 45 | Info = new Info(); 46 | Party = new Information.Party.Party(); 47 | 48 | InventoryItems = new Dictionary(); 49 | StorageItems = new Dictionary(); 50 | 51 | SoldItems = new List(); 52 | Quests = new List(); 53 | Masteries = new List(); 54 | Skills = new List(); 55 | 56 | Position = new Information.BasicInfo.Position(); 57 | Movement = new Information.BasicInfo.Movement(); 58 | State = new Information.BasicInfo.State(); 59 | 60 | NearbyCharacters = new Dictionary(); 61 | NearbyNPCs = new Dictionary(); 62 | NearbyMobs = new Dictionary(); 63 | NearbyItems = new Dictionary(); 64 | NearbyBuffAreas = new Dictionary(); 65 | NearbyCOSs = new Dictionary(); 66 | NearbyStructures = new Dictionary(); 67 | 68 | Chat = new Dictionary>(); 69 | CurrentStall = new Information.Stalls.Stall(); 70 | CharacterInStall = false; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/PositionUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Entity 9 | { 10 | public class PositionUpdate 11 | { 12 | 13 | public delegate void CharacterPositionUpdateHandler(CharacterPositionUpdateEventArgs e); 14 | /// 15 | /// This is called upon receiving 0xB021 Packet(Position update packet), this is not called for the main client. 16 | /// 17 | public static event CharacterPositionUpdateHandler OnCharacterPositionChange; 18 | 19 | /// 20 | /// This is called AFTER client changing position. 21 | /// 22 | public static event Action OnClientPositionUpdate; 23 | 24 | public static void Parse(Packet p) 25 | { 26 | bool onHorse = false; 27 | uint UniqueID = p.ReadUInt32(); 28 | if (Client.NearbyCharacters.Where(x => x.Value.TransportUniqueID == UniqueID).Count() > 0) 29 | { 30 | onHorse = true; 31 | UniqueID = Client.NearbyCharacters.First(x => x.Value.TransportUniqueID == UniqueID).Key; 32 | } 33 | 34 | int moving = p.ReadInt8(); 35 | if (moving == 1) 36 | { 37 | ushort RegionID = p.ReadUInt16(); 38 | short xcoord = p.ReadInt16(); 39 | short zcoord = p.ReadInt16(); 40 | short ycoord = p.ReadInt16(); 41 | 42 | if (Client.NearbyCharacters.ContainsKey(UniqueID)) 43 | { 44 | int oldX = Client.NearbyCharacters[UniqueID].Position.GetRealX(); 45 | int oldY = Client.NearbyCharacters[UniqueID].Position.GetRealY(); 46 | 47 | Client.NearbyCharacters[UniqueID].Position = new Information.BasicInfo.Position(RegionID, xcoord, ycoord, zcoord); 48 | //Console.WriteLine("{ " + Actions.Mapping.GetCharNameFromUID(UniqueID) + " } [" + Client.NearbyCharacters[UniqueID].Position.GetRealX() + ", " + 49 | // Client.NearbyCharacters[UniqueID].Position.GetRealY() + "]"); 50 | OnCharacterPositionChange?.Invoke(new CharacterPositionUpdateEventArgs(oldX, oldY, Client.NearbyCharacters[UniqueID].Position.GetRealX(), 51 | Client.NearbyCharacters[UniqueID].Position.GetRealY(), Client.NearbyCharacters[UniqueID], onHorse)); 52 | 53 | } 54 | if (Client.NearbyCOSs.ContainsKey(UniqueID)) 55 | Client.NearbyCOSs[UniqueID].Position = new Information.BasicInfo.Position(RegionID, xcoord, ycoord, zcoord); 56 | if (Client.NearbyMobs.ContainsKey(UniqueID)) 57 | Client.NearbyMobs[UniqueID].Position = new Information.BasicInfo.Position(RegionID, xcoord, ycoord, zcoord); 58 | if (Client.NearbyNPCs.ContainsKey(UniqueID)) 59 | Client.NearbyNPCs[UniqueID].Position = new Information.BasicInfo.Position(RegionID, xcoord, ycoord, zcoord); 60 | if (Client.NearbyStructures.ContainsKey(UniqueID)) 61 | Client.NearbyStructures[UniqueID].Position = new Information.BasicInfo.Position(RegionID, xcoord, ycoord, zcoord); 62 | 63 | if (Client.Info.UniqueID == UniqueID || Client.Info.TransportUniqueID == UniqueID) 64 | { 65 | Client.Position = new Information.BasicInfo.Position(RegionID, xcoord, ycoord, zcoord); 66 | OnClientPositionUpdate?.Invoke(); 67 | 68 | } 69 | } else 70 | { 71 | //Sky walking, spinning. 72 | } 73 | } 74 | } 75 | 76 | public class CharacterPositionUpdateEventArgs : EventArgs 77 | { 78 | public int oldX; 79 | public int oldY; 80 | 81 | public int newX; 82 | public int newY; 83 | 84 | public bool OnHorse = false; 85 | public Information.Objects.Character Character; 86 | 87 | public CharacterPositionUpdateEventArgs(int _oldX, int _oldY, int _newX, int _newY, Information.Objects.Character _char, bool horse) 88 | { 89 | oldX = _oldX; 90 | oldY = _oldY; 91 | newX = _newX; 92 | newY = _newY; 93 | Character = _char; 94 | OnHorse = horse; 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | /SilkroadInformationAPI/Client/Packets/Spawn/DEBUGSingleSpawn.cs 244 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Actions/CaptchaImage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using SilkroadSecurityApi; 8 | using System.IO; 9 | using System.Windows; 10 | using System.Drawing; 11 | 12 | namespace SilkroadInformationAPI.Client.Actions 13 | { 14 | public class CaptchaImage 15 | { 16 | [DllImport("ZlibDll.dll", CallingConvention = CallingConvention.Cdecl)] 17 | public static extern int Decompress(byte[] compressed_buffer, int compressed_size, byte[] decompressed_buffer, ref int decompressed_size); 18 | 19 | [DllImport("ZlibDll.dll", CallingConvention = CallingConvention.Cdecl)] 20 | public static extern int Compress(byte[] decompressed_buffer, int decompressed_size, byte[] compressed_buffer, ref int compressed_size); 21 | 22 | public static UInt32[] GeneratePacketCaptcha(Packet packet) 23 | { 24 | byte flag = packet.ReadUInt8(); 25 | UInt16 remain = packet.ReadUInt16(); 26 | UInt16 compressed = packet.ReadUInt16(); 27 | UInt16 uncompressed = packet.ReadUInt16(); 28 | UInt16 width = packet.ReadUInt16(); 29 | UInt16 height = packet.ReadUInt16(); 30 | 31 | if (width != 200 || height != 64) 32 | { 33 | throw new NotImplementedException("The captcha is expected to be 200 x 64 pixels."); 34 | } 35 | 36 | byte[] compressed_buffer = packet.ReadUInt8Array(compressed); 37 | 38 | if (packet.RemainingRead() != 0) 39 | { 40 | throw new Exception("Unknown captcha packet."); 41 | } 42 | 43 | Int32 uncompressed_size = uncompressed; 44 | 45 | byte[] uncompressed_buffer = new byte[uncompressed]; 46 | 47 | int result = Decompress(compressed_buffer, compressed, uncompressed_buffer, ref uncompressed_size); 48 | 49 | if (result != 0) 50 | { 51 | throw new Exception("Error occurred!"); 52 | } 53 | 54 | byte[] uncompressed_bytes = new byte[uncompressed_size]; 55 | Buffer.BlockCopy(uncompressed_buffer, 0, uncompressed_bytes, 0, uncompressed_size); 56 | uncompressed_buffer = null; 57 | 58 | UInt32[] pixels = new UInt32[width * height]; 59 | 60 | int ind_ = 0; 61 | for (int row_ = 0; row_ < height; ++row_) 62 | { 63 | for (int col_ = 0; col_ < width; ++col_) 64 | { 65 | UInt32 write_index = (UInt32)(row_ * width + col_); 66 | pixels[write_index] = (UInt32)((byte)(Math.Pow(2.0f, ind_++ % 8)) & uncompressed_bytes[write_index / 8]); 67 | if (pixels[write_index] == 0) 68 | { 69 | pixels[write_index] = 0xFF000000; 70 | } 71 | else 72 | { 73 | pixels[write_index] = 0xFFFFFFFF; 74 | } 75 | } 76 | } 77 | 78 | return pixels; 79 | } 80 | 81 | public static Image SaveCaptchaToBMP(UInt32[] pixels, String filename) 82 | { 83 | const Int32 width = 200; 84 | const Int32 height = 64; 85 | 86 | // Hard coded image header for the type the captcha uses 87 | byte[] header = new byte[] 88 | { 89 | 0x42, 0x4D, 0x7A, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x00, 0x00, 0x00, 0x6C, 0x00, 90 | 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x03, 0x00, 91 | 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, 92 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 94 | 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 96 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 97 | }; 98 | 99 | using (FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write)) 100 | { 101 | using (BinaryWriter bw = new BinaryWriter(fs)) 102 | { 103 | bw.Write(header); 104 | for (int c = height - 1; c >= 0; --c) 105 | { 106 | for (int r = 0; r < width; ++r) 107 | { 108 | bw.Write((UInt32)pixels[c * width + r]); 109 | } 110 | } 111 | bw.Flush(); 112 | } 113 | } 114 | 115 | return Image.FromFile(filename); 116 | } 117 | 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Entity/HPMPUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Entity 9 | { 10 | public class HPMPUpdate 11 | { 12 | public static event Action OnClientBadStatus; 13 | public static event Action OnClientBadStatusRemoved; 14 | public static event Action OnClientHPUpdate; 15 | public static event Action OnClientMPUpdate; 16 | public static event Action OnClientHPMPUpdate; 17 | 18 | public static event Action OnCOSHPUpdate; 19 | public static event Action OnCOSBadStatus; 20 | public static event Action OnCOSBadStatusRemoved; 21 | 22 | public static event Action OnCharacterBadStatus; 23 | public static event Action OnCharacterBadStatusRemoved; 24 | 25 | public static event Action OnMobHPUpdate; 26 | public static event Action OnMobBadStatus; 27 | public static event Action OnMobBadStatusRemoved; 28 | 29 | public static void Parse(Packet p) 30 | { 31 | uint uid = p.ReadUInt32(); 32 | p.ReadUInt16(); //UNK 33 | if (Client.Info.UniqueID == uid) 34 | { 35 | byte flag = p.ReadUInt8(); 36 | switch (flag) 37 | { 38 | case 0x01: //HP update 39 | Client.Info.CurrentHP = p.ReadUInt32(); 40 | OnClientHPUpdate?.Invoke(); 41 | break; 42 | case 0x02: //MP update 43 | Client.Info.CurrentMP = p.ReadUInt32(); 44 | OnClientMPUpdate?.Invoke(); 45 | break; 46 | case 0x03: //HP&MP update 47 | Client.Info.CurrentHP = p.ReadUInt32(); 48 | Client.Info.CurrentMP = p.ReadUInt32(); 49 | OnClientHPMPUpdate?.Invoke(); 50 | break; 51 | case 0x04: //Bad status update 52 | Client.Info.BadStatusID = p.ReadUInt32(); 53 | if (Client.Info.BadStatusID == 0) 54 | { 55 | Client.Info.BadStatus = false; 56 | OnClientBadStatusRemoved?.Invoke(); 57 | } 58 | else 59 | { 60 | Client.Info.BadStatus = true; 61 | OnClientBadStatus?.Invoke(); 62 | } 63 | break; 64 | } 65 | } else if (Client.NearbyCharacters.ContainsKey(uid)) 66 | { 67 | byte flag = p.ReadUInt8(); //TODO: Check for other flag values. 68 | switch (flag) 69 | { 70 | case 0x04: //Bad status update 71 | if (p.ReadUInt32() == 0) 72 | { 73 | Client.NearbyCharacters[uid].BadStatus = false; 74 | OnCharacterBadStatus?.Invoke(Client.NearbyCharacters[uid]); 75 | } 76 | else 77 | { 78 | Client.NearbyCharacters[uid].BadStatus = true; 79 | OnCharacterBadStatusRemoved?.Invoke(Client.NearbyCharacters[uid]); 80 | } 81 | break; 82 | } 83 | } 84 | else if (Client.NearbyMobs.ContainsKey(uid)) 85 | { 86 | byte flag = p.ReadUInt8(); 87 | switch (flag) 88 | { 89 | case 0x05: //HP 90 | Client.NearbyMobs[uid].CurrentHP = p.ReadUInt32(); 91 | OnMobHPUpdate?.Invoke(Client.NearbyMobs[uid]); 92 | break; 93 | case 0x04: //Bad status update 94 | if (p.ReadUInt32() == 0) 95 | { 96 | Client.NearbyMobs[uid].BadStatus = false; 97 | OnMobBadStatus?.Invoke(Client.NearbyMobs[uid]); 98 | } 99 | else 100 | { 101 | Client.NearbyMobs[uid].BadStatus = true; 102 | OnMobBadStatusRemoved?.Invoke(Client.NearbyMobs[uid]); 103 | } 104 | break; 105 | } 106 | } 107 | else if (Client.NearbyCOSs.ContainsKey(uid)) 108 | { 109 | byte flag = p.ReadUInt8(); 110 | switch (flag) 111 | { 112 | case 0x05: //HP 113 | Client.NearbyCOSs[uid].CurrentHP = p.ReadUInt32(); 114 | OnCOSHPUpdate?.Invoke(Client.NearbyCOSs[uid]); 115 | break; 116 | case 0x04: //Bad status update 117 | if (p.ReadUInt32() == 0) 118 | { 119 | Client.NearbyCOSs[uid].BadStatus = false; 120 | OnCOSBadStatus?.Invoke(Client.NearbyCOSs[uid]); 121 | } 122 | else 123 | { 124 | Client.NearbyCOSs[uid].BadStatus = true; 125 | OnCOSBadStatusRemoved?.Invoke(Client.NearbyCOSs[uid]); 126 | } 127 | break; 128 | } 129 | } 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Party/PartyUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.Party 9 | { 10 | public class PartyUpdate 11 | { 12 | /// 13 | /// Event is called upon party disbanding. 14 | /// 15 | public static event Action OnPartyDisband; 16 | 17 | /// 18 | /// The event is called AFTER member joins the party, with the object being the new member. 19 | /// 20 | public static event Action OnPartyMemberJoin; 21 | 22 | /// 23 | /// This is called BEFORE member leaving the party, with the object being member "leaving" the party. 24 | /// 25 | public static event Action OnPartyMemberLeave; 26 | 27 | /// 28 | /// This is called BEFORE member get kicked from party. 29 | /// 30 | public static event Action OnPartyMemberKicked; 31 | 32 | 33 | /// 34 | /// This is called after member hp or mp update, with the object being the member getting the change. 35 | /// 36 | public static event Action OnPartyMemberHPMPUpdate; 37 | 38 | /// 39 | /// This is called after member position ON MAP update. 40 | /// 41 | public static event Action OnPartyMemberPositionUpdate; 42 | 43 | /// 44 | /// This event is called when the party master changes 45 | /// 46 | public static event Action OnPartyMasterUpdate; 47 | 48 | public static void Parse(Packet p) 49 | { 50 | uint uid; 51 | byte flag = p.ReadUInt8(); 52 | switch (flag) //TODO: Parse other cases 53 | { 54 | case 0x01: //party disbanded 55 | Client.Party.PartyMembers.Clear(); 56 | Client.Party.MembersCount = 1; 57 | OnPartyDisband?.Invoke(); 58 | break; 59 | case 0x02: //Someone joined 60 | var member = PartyUtility.ParseMember(p); 61 | Client.Party.PartyMembers.Add(member.UniqueID, member); 62 | Client.Party.MembersCount += 1; 63 | OnPartyMemberJoin?.Invoke(member); 64 | break; 65 | case 0x03: //Party member left 66 | uid = p.ReadUInt32(); 67 | byte reason = p.ReadUInt8(); 68 | if (Client.Party.PartyMembers.ContainsKey(uid)) 69 | { 70 | if (reason == 0x02) 71 | OnPartyMemberLeave?.Invoke(Client.Party.PartyMembers[uid]); 72 | else if (reason == 0x04) 73 | OnPartyMemberKicked?.Invoke(Client.Party.PartyMembers[uid]); 74 | Client.Party.PartyMembers.Remove(uid); 75 | } 76 | Client.Party.MembersCount -= 1; 77 | break; 78 | case 0x06: //Party member info update 79 | uid = p.ReadUInt32(); 80 | byte action = p.ReadUInt8(); 81 | if (action == 0x04) //HP MP Update 82 | { 83 | byte MPHP = p.ReadUInt8(); 84 | byte HP = Convert.ToByte(MPHP.ToString("X2")[1].ToString(), 16); 85 | byte MP = Convert.ToByte(MPHP.ToString("X2")[0].ToString(), 16); 86 | Client.Party.PartyMembers[uid].HPPercentage = HP; 87 | Client.Party.PartyMembers[uid].MPPercentage = MP; 88 | OnPartyMemberHPMPUpdate?.Invoke(Client.Party.PartyMembers[uid]); 89 | } 90 | else if (action == 0x08) 91 | { 92 | p.ReadUInt32(); //Mastery Tree 1 93 | p.ReadUInt32(); //Mastery Tree 2 94 | } 95 | else if (action == 0x20) //Position Update 96 | { 97 | Information.BasicInfo.Position pos = new Information.BasicInfo.Position(); 98 | pos.RegionID = p.ReadUInt16(); 99 | if (pos.RegionID < short.MaxValue) 100 | { //World 101 | pos.X = p.ReadUInt16(); 102 | pos.Y = p.ReadUInt16(); 103 | pos.Z = p.ReadUInt16(); 104 | } 105 | else 106 | { //Dungeon 107 | pos.X = p.ReadUInt32(); // Probably 16bit a mistake. 108 | pos.Y = p.ReadUInt32(); 109 | pos.Z = p.ReadUInt32(); 110 | } 111 | Client.Party.PartyMembers[uid].Position = pos; 112 | OnPartyMemberPositionUpdate?.Invoke(Client.Party.PartyMembers[uid]); 113 | } 114 | break; 115 | case 0x09: //Party master updated 116 | uid = p.ReadUInt32(); 117 | if (Client.Party.PartyMembers.ContainsKey(uid)) 118 | { 119 | Client.Party.MasterUniqueID = uid; 120 | Client.Party.PartyMaster = Client.Party.PartyMembers[uid].Name; 121 | } 122 | OnPartyMasterUpdate?.Invoke(Client.Party.PartyMembers[uid]); 123 | break; 124 | } 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/BattleArena/Operation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Packets.BattleArena 9 | { 10 | public class Operation 11 | { 12 | public delegate void BattleArenaStateHandler(BattleArenaStateEventArgs e); 13 | /// 14 | /// This is called when arena ends, starts, registration ends, 10minutes left, 5minutes left, 1minute left. 15 | /// 16 | public static event BattleArenaStateHandler OnBattleArenaStateChange; 17 | 18 | public delegate void BattleArenaResultHandler(BattleArenaResultEventArgs e); 19 | /// 20 | /// This is only called if the client is in arena and it ends. 21 | /// 22 | public static event BattleArenaResultHandler OnBattleArenaResult; 23 | 24 | public delegate void BattleArenaScoreHandler(BattleArenaScoreEventArgs e); 25 | /// 26 | /// This is called when the score changes in a match. 27 | /// 28 | public static event BattleArenaScoreHandler OnBattleArenaScoreChange; 29 | 30 | public delegate void BattleArenaTimeHandler(BattleArenaTimeEventArgs e); 31 | /// 32 | /// This is called when the score changes in a match. 33 | /// 34 | public static event BattleArenaTimeHandler OnBattleArenaTimeChange; 35 | 36 | public delegate void BattleArenaResponseHandler(BattleArenaResponseEventArgs e); 37 | 38 | /// 39 | /// This is called upon SilkroadInformationAPI.ArenaResponse values. 40 | /// 41 | public static event BattleArenaResponseHandler OnBattleArenaReceiveResponse; 42 | 43 | public static void Parse(Packet p) 44 | { 45 | byte flag = p.ReadUInt8(); //Operation Flag 46 | 47 | if (flag == 0x02 || flag == 0x0D || flag == 0x0E) //0x02 = 10minutes left, 0x0D = 5minutes left, 0x0E = 1minute left 48 | { 49 | byte Type = p.ReadUInt8(); //Arena type [nRegister values] 50 | if(flag == 0x02) 51 | OnBattleArenaStateChange?.Invoke(new BattleArenaStateEventArgs((ArenaType)Type, ArenaState.TenMinutesLeftToStartArena)); 52 | if (flag == 0x0D) 53 | OnBattleArenaStateChange?.Invoke(new BattleArenaStateEventArgs((ArenaType)Type, ArenaState.FiveMinutesLeftToStartArena)); 54 | if (flag == 0x0E) 55 | OnBattleArenaStateChange?.Invoke(new BattleArenaStateEventArgs((ArenaType)Type, ArenaState.OneMinuteLeftToStartArena)); 56 | } 57 | else if (flag == 0x05) //Arena ended 58 | { 59 | byte Type = p.ReadUInt8(); //Arena type [nRegister values] 60 | OnBattleArenaStateChange?.Invoke(new BattleArenaStateEventArgs((ArenaType)Type, ArenaState.ArenaEnded)); 61 | } 62 | else if (flag == 0x04) //Arena started 63 | { 64 | byte Type = p.ReadUInt8(); //Arena type [nRegister values] 65 | OnBattleArenaStateChange?.Invoke(new BattleArenaStateEventArgs((ArenaType)Type, ArenaState.ArenaStarted)); 66 | } 67 | else if (flag == 0x03) //Registration closed 68 | { 69 | byte Type = p.ReadUInt8(); //Arena type [nRegister values] 70 | OnBattleArenaStateChange?.Invoke(new BattleArenaStateEventArgs((ArenaType)Type, ArenaState.RegistrationClosed)); 71 | } 72 | else if (flag == 0xFF) //Registration response 73 | { 74 | byte result = p.ReadUInt8(); 75 | BattleArenaResponseEventArgs args = new BattleArenaResponseEventArgs(); 76 | try 77 | { 78 | args.BattleArenaResponse = (ArenaResponse)result; 79 | } 80 | catch 81 | { 82 | args.BattleArenaResponse = ArenaResponse.Unknown; 83 | } 84 | 85 | if (result == 0x80) //Team got flag 86 | args.AssociatedCharName = p.ReadAscii(); 87 | else if (result == 0x84) //Someone put flag 88 | { 89 | args.FlagPole = p.ReadUInt8(); //Team flagpole or enemy flagpole [0x00 == Our flagpole[red], 0x01 == Their flagpole[blue]] 90 | args.AssociatedCharName = p.ReadAscii(); //character name of the person whom put the flag. 91 | } 92 | 93 | if (result == 0xF0) //Time update 94 | { 95 | uint totalTime = p.ReadUInt32(); //in milliseconds 96 | uint timeElapsed = p.ReadUInt32(); //in milliseconds 97 | OnBattleArenaTimeChange?.Invoke(new BattleArenaTimeEventArgs(totalTime, timeElapsed)); 98 | } 99 | else if (result == 0x88) //Update score 100 | { 101 | uint TeamScore = p.ReadUInt32(); //Team score 102 | uint EnemyScore = p.ReadUInt32(); //Enemy score 103 | OnBattleArenaScoreChange?.Invoke(new BattleArenaScoreEventArgs(TeamScore, EnemyScore)); 104 | } else 105 | { 106 | OnBattleArenaReceiveResponse?.Invoke(args); 107 | } 108 | 109 | //TODO: Anaylze more scenario's 110 | } 111 | else if (flag == 8) //TODO 112 | { 113 | 114 | } 115 | else if (flag == 9) //Arena result 116 | { 117 | byte type = p.ReadUInt8(); 118 | byte result = p.ReadUInt8(); 119 | byte coins = p.ReadUInt8(); 120 | OnBattleArenaResult?.Invoke(new BattleArenaResultEventArgs(coins, ((result == 0) ? ArenaResult.Won : (result == 2) ? ArenaResult.Lost : ArenaResult.Draw), p.ReadUInt32())); 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Actions/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SilkroadSecurityApi; 7 | 8 | namespace SilkroadInformationAPI.Client.Actions 9 | { 10 | public class Utility 11 | { 12 | public static Dictionary CalculateWhiteStats(ulong variance, ItemType type) //By stratii 13 | { 14 | Dictionary whiteStats = new Dictionary(); 15 | 16 | var stats = new List(); 17 | 18 | while (variance > 0) 19 | { 20 | var stat = (byte)(variance & 0x1f); 21 | variance >>= 5; 22 | 23 | stats.Add(stat); 24 | } 25 | 26 | try 27 | { 28 | switch (type) 29 | { 30 | case ItemType.Shield: 31 | whiteStats.Add("ShieldDurabilitySlot", stats[0]); 32 | whiteStats.Add("ShieldPhySpecSlot", stats[1]); 33 | whiteStats.Add("ShieldMagSpecSlot", stats[2]); 34 | whiteStats.Add("ShieldBlockRatioSlot", stats[3]); 35 | whiteStats.Add("ShieldPhyDefSlot", stats[4]); 36 | whiteStats.Add("ShieldPhyDefSlot", stats[5]); 37 | break; 38 | case ItemType.Protector: 39 | whiteStats.Add("ArmorDurabilitySlot", stats[0]); 40 | whiteStats.Add("ArmorPhySpecSlot", stats[1]); 41 | whiteStats.Add("ArmorMagSpecSlot", stats[2]); 42 | whiteStats.Add("ArmorPhyDefSlot", stats[3]); 43 | whiteStats.Add("ArmorMagDefSlot", stats[4]); 44 | whiteStats.Add("ArmorEvasionRatioSlot", stats[5]); 45 | break; 46 | case ItemType.Weapon: 47 | whiteStats.Add("WeaponDurabilitySlot", stats[0]); 48 | whiteStats.Add("WeaponPhySpecSlot", stats[1]); 49 | whiteStats.Add("WeaponMagSpecSlot", stats[2]); 50 | whiteStats.Add("WeaponHitRatioSlot", stats[3]); 51 | whiteStats.Add("WeaponPhyDmgSlot", stats[4]); 52 | whiteStats.Add("WeaponMagDmgSlot", stats[5]); 53 | whiteStats.Add("WeaponMagDmgSlot", stats[6]); 54 | break; 55 | case ItemType.Accessory: 56 | whiteStats.Add("AccessoryPhyAbsorpSlot", stats[0]); 57 | whiteStats.Add("AccessoryMagAbsorpSlot", stats[1]); 58 | break; 59 | } 60 | } catch 61 | { 62 | 63 | } 64 | return whiteStats; 65 | 66 | } 67 | public static void WalkTo(int X, int Y) 68 | { 69 | uint xPos = 0; 70 | uint yPos = 0; 71 | 72 | if (X > 0 && Y > 0) 73 | { 74 | xPos = (uint)((X % 192) * 10); 75 | yPos = (uint)((Y % 192) * 10); 76 | } 77 | else 78 | { 79 | if (X < 0 && Y > 0) 80 | { 81 | xPos = (uint)((192 + (X % 192)) * 10); 82 | yPos = (uint)((Y % 192) * 10); 83 | } 84 | else 85 | { 86 | if (X > 0 && Y < 0) 87 | { 88 | xPos = (uint)((X % 192) * 10); 89 | yPos = (uint)((192 + (Y % 192)) * 10); 90 | } 91 | } 92 | } 93 | 94 | byte xSector = (byte)((X - (int)(xPos / 10)) / 192 + 135); 95 | byte ySector = (byte)((Y - (int)(yPos / 10)) / 192 + 92); 96 | ushort xPosition = (ushort)((X - (int)((xSector - 135) * 192)) * 10); 97 | ushort yPosition = (ushort)((Y - (int)((ySector - 92) * 192)) * 10); 98 | 99 | var p = new Packet(0x0); 100 | 101 | if(Client.Info.TransportUniqueID == 0) 102 | { 103 | p = new Packet(0x7021); 104 | } else 105 | { 106 | p = new Packet(0x70C5); 107 | p.WriteUInt32(Client.Info.TransportUniqueID); 108 | p.WriteUInt8(0x01); 109 | } 110 | p.WriteUInt8(0x01); 111 | p.WriteUInt8(xSector); 112 | p.WriteUInt8(ySector); 113 | p.WriteUInt16(xPosition); 114 | p.WriteUInt16(0x0000); 115 | p.WriteUInt16(yPosition); 116 | SroClient.RemoteSecurity?.Send(p); 117 | } 118 | 119 | public static void UseReturn() 120 | { 121 | if (Client.State.Returning == false) 122 | { 123 | if (!UseItemType(ItemType.ReturnScroll)) 124 | Console.WriteLine("No return scroll is found!"); 125 | } else 126 | { 127 | Console.WriteLine("Client is already returning!"); 128 | } 129 | } 130 | 131 | public static bool UseItemType(ItemType type) 132 | { 133 | if (Client.InventoryItems.Where(x => x.Value.Type == type).Count() > 0) 134 | { 135 | SroClient.UseItem(Client.InventoryItems.First(x => x.Value.Type == type).Key); 136 | return true; 137 | } 138 | else 139 | { 140 | return false; 141 | } 142 | } 143 | 144 | public static bool UseItemType(ItemType type, byte otherItemSlot) 145 | { 146 | if (Client.InventoryItems.Where(x => x.Value.Type == type).Count() > 0) 147 | { 148 | SroClient.UseItem(Client.InventoryItems.First(x => x.Value.Type == type).Key, otherItemSlot); 149 | return true; 150 | } 151 | else 152 | { 153 | return false; 154 | } 155 | } 156 | 157 | public static bool UseItemType(ItemType type, uint targetUID) 158 | { 159 | if (Client.InventoryItems.Where(x => x.Value.Type == type).Count() > 0) 160 | { 161 | SroClient.UseItem(Client.InventoryItems.First(x => x.Value.Type == type).Key, targetUID); 162 | return true; 163 | } 164 | else 165 | { 166 | return false; 167 | } 168 | } 169 | 170 | 171 | public static bool UseSkillName(string name) 172 | { 173 | if (Client.Skills.Where(x => x.TranslationName == name).Count() > 0) 174 | { 175 | SroClient.UseSpell(Client.Skills.Single(x => x.TranslationName == name).ObjRefID); 176 | return true; 177 | } 178 | else 179 | return false; 180 | } 181 | 182 | public static bool UseSkillName(string name, uint target) 183 | { 184 | if (Client.Skills.Where(x => x.TranslationName == name).Count() > 0) 185 | { 186 | SroClient.UseSpell(Client.Skills.Single(x => x.TranslationName == name).ObjRefID, target); 187 | return true; 188 | } 189 | else 190 | return false; 191 | } 192 | 193 | 194 | public static ushort GenerateItemType(uint itemID) 195 | { 196 | var item = Media.Data.MediaItems[itemID]; 197 | return (ushort)(1 * item.Classes.A + 2 * item.Classes.B + 4 * item.Classes.C + 32 * item.Classes.D + 128 * item.Classes.E + 2048 * item.Classes.F); 198 | } 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Enums.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SilkroadInformationAPI 8 | { 9 | public enum ModelType 10 | { 11 | Structure, //0 1 1 2 5 * 12 | FortressFlagsNPC, //0 1 1 2 4 * 13 | PickupPet, //0 1 1 2 3 4 14 | AttackPet, //0 1 1 2 3 3 15 | NormalPet, //0 1 1 2 3 1 16 | //AttackAndRidePet, //0 1 1 2 3 3 17 | JobPet, //0 1 1 2 3 2 18 | JobSilkPet, //1 1 1 2 3 2 19 | NPC, //0 1 1 2 2 0 20 | NPCMob, // 0 1 1 2 1 2 21 | Mob, //0 1 1 2 1 * 22 | Character, //0 1 1 1 0 0 23 | Portal1, //0 0 4 1 1 * 24 | Portal2, //0 0 4 1 2 0 25 | Gate, 26 | Gold, //0 0 3 3 5 0 27 | QuestItem, //0 0 3 3 9 0 28 | CountableItem, //0 0 3 3 * * 29 | PlusItem, //0 0 3 1 * * 30 | MallCountItem, //1 0 3 3 * * 31 | MallPlusItem, //1 0 3 3 * * 32 | StonesType, //0 0 3 3 11 * 33 | Unknown 34 | } 35 | public enum ItemType 36 | { 37 | WeaponElixir, 38 | ProtectorElixir, 39 | ShieldElixir, 40 | AccessoryElixir, 41 | Weapon, 42 | Protector, 43 | Shield, 44 | Accessory, 45 | LuckStone, 46 | SteadyStone, 47 | AstralStone, 48 | ImmortalStone, 49 | LuckyPowder, 50 | PlusItem, 51 | PickupPet, 52 | AttackPet, 53 | ItemExchangeCoupon, 54 | Stones, 55 | MagicCube, 56 | MonsterMask, 57 | Tablets, 58 | HpPotion, 59 | MpPotion, 60 | VigorPotion, 61 | Arrows, 62 | Bolts, 63 | UniversalPills, 64 | PurificationPills, 65 | ReturnScroll, 66 | None, 67 | PetRecoveryKit, 68 | PetRevival, 69 | PetHGP, 70 | PetASRP, 71 | RidePet, 72 | TradeRidePet 73 | } 74 | public enum SkillType 75 | { 76 | Passive, 77 | Unk, 78 | Active, 79 | } 80 | public enum COS_Type 81 | { 82 | None, 83 | Normal, 84 | Job, 85 | AttackPet, 86 | PickupPet, 87 | Guild, 88 | Fortress, 89 | } 90 | public enum Mob_Type 91 | { 92 | Normal = 0, 93 | Champion = 1, 94 | Giant = 4, 95 | Party = 16, 96 | GiantParty = 20, 97 | } 98 | public enum PVP_Cape 99 | { 100 | None = 0, 101 | Red = 1, 102 | Gray = 2, 103 | Blue = 3, 104 | White = 4, 105 | Orange = 5, 106 | } 107 | public enum PK_State 108 | { 109 | Neutral = 0, 110 | Assaulter = 1, 111 | Murderer = 2, 112 | } 113 | 114 | public enum JOB_Type 115 | { 116 | None = 0, 117 | Trader = 1, 118 | Thief = 2, 119 | Hunter = 3, 120 | } 121 | 122 | public enum ChatType 123 | { 124 | All = 1, 125 | PM = 2, 126 | AllGM = 3, 127 | Party = 4, 128 | Guild = 5, 129 | Global = 6, 130 | Notice = 7, 131 | Stall = 9, 132 | Union = 11, 133 | NPC = 13, 134 | Accademy = 16, 135 | } 136 | 137 | public enum ArenaType 138 | { 139 | Random = 0, 140 | Party = 1, 141 | Guild = 2, 142 | Job = 3, 143 | } 144 | 145 | public enum ArenaState 146 | { 147 | TenMinutesLeftToStartArena, 148 | FiveMinutesLeftToStartArena, 149 | OneMinuteLeftToStartArena, 150 | ArenaStarted, 151 | ArenaEnded, 152 | RegistrationClosed 153 | } 154 | 155 | public enum ArenaResult 156 | { 157 | Won, 158 | Lost, 159 | Draw, 160 | } 161 | 162 | public enum ArenaResponse 163 | { 164 | RegistrationSuccess = 0x00, 165 | YouAreAlreadyRegistered = 0x02, 166 | YouMayNotRegisterAtThisTime = 0x04, 167 | MatchHasBeenCanceledDueToNotEnoughPlayers = 0x06, 168 | UnableToRegisterYouAreNoInparty = 0x0B, 169 | YouAreNotWearingJobSuit = 0x0D, 170 | TeamGotFlag = 0x80, 171 | EnemyTeamGotFlag = 0x81, 172 | FlagChannelling = 0x82, 173 | FlagDropped = 0x83, 174 | FlagHasBeenPutAtFlagpole = 0x84, 175 | Unknown, 176 | } 177 | 178 | public enum CharMotionState 179 | { 180 | None = 0, 181 | Walking = 2, 182 | Running = 3, 183 | Sitting = 4, 184 | } 185 | 186 | public enum CharStatus 187 | { 188 | None = 0, 189 | Hwan = 1, 190 | Untouchable = 2, 191 | Invincible = 3, 192 | GMInvisible = 5, 193 | Sealth = 6, 194 | Invisible = 7, 195 | } 196 | 197 | /// 198 | /// DaxterSoul 199 | /// 200 | public enum FRPVPMode 201 | { 202 | None = 0, 203 | 204 | /// 205 | /// Team Red Hawk 206 | /// 207 | Red = 1, 208 | 209 | /// 210 | /// Team Black Turtle 211 | /// 212 | Black = 2, 213 | 214 | /// 215 | /// Team Blue Dragon 216 | /// 217 | Blue = 3, 218 | 219 | /// 220 | /// Team White Tiger 221 | /// 222 | White = 4, 223 | 224 | /// 225 | /// Team Giraffe 226 | /// 227 | Yellow = 5, 228 | } 229 | 230 | public enum CharacterRace 231 | { 232 | Chinese, 233 | Europe, 234 | None, 235 | } 236 | 237 | public enum PartyObjective 238 | { 239 | Hunting, 240 | Quest, 241 | Trade, 242 | Thief, 243 | } 244 | 245 | public enum PartyType 246 | { 247 | ExpShare_ItemShare = 0x03, 248 | ExpFreeForAll_ItemFreeForAll = 0x04, 249 | ExpShare_ItemFreeForAll = 0x05, 250 | ExpFreeForAll_ItemShare = 0x06, 251 | } 252 | 253 | public enum ItemBlues 254 | { 255 | MATTR_DEC_MAXDUR, 256 | MATTR_INT, 257 | MATTR_STR, 258 | MATTR_RESIST_FROSTBITE, 259 | MATTR_RESIST_ESHOCK, 260 | MATTR_RESIST_BURN, 261 | MATTR_RESIST_POISON, 262 | MATTR_RESIST_ZOMBIE, 263 | MATTR_ATHANASIA, 264 | MATTR_SOLID, 265 | MATTR_LUCK, 266 | MATTR_NOT_REPARABLE, 267 | MATTR_REINFORCE_ITEM, 268 | MATTR_DUR, 269 | MATTR_HR, 270 | MATTR_EVADE_BLOCK, 271 | MATTR_EVADE_CRITICAL, 272 | MATTR_ER, 273 | MATTR_HP, 274 | MATTR_MP, 275 | MATTR_ASTRAL, 276 | MATTR_CRITICAL, 277 | MATTR_BLOCKRATE, 278 | MATTR_AVATAR_MPRG, 279 | MATTR_AVATAR_HPRG, 280 | MATTR_AVATAR_MDIA, 281 | MATTR_AVATAR_DARA, 282 | MATTR_AVATAR_DRUA, 283 | MATTR_STR_3JOB, 284 | MATTR_INT_3JOB, 285 | MATTR_INT_AVATAR, 286 | MATTR_STR_AVATAR, 287 | MATTR_REPAIR, 288 | MATTR_AVATAR_INT, 289 | MATTR_AVATAR_STR, 290 | MATTR_AVATAR_HR, 291 | MATTR_AVATAR_ER, 292 | MATTR_AVATAR_HP, 293 | MATTR_AVATAR_MP, 294 | MATTR_RESIST_STUN, 295 | MATTR_REGENHPMP, 296 | MATTR_RESIST_CSMP, 297 | MATTR_RESIST_DISEASE, 298 | MATTR_RESIST_SLEEP, 299 | MATTR_RESIST_FEAR, 300 | MATTR_NASRUN_UMDU, 301 | MATTR_NASRUN_MPNA, 302 | MATTR_NASRUN_HPNA, 303 | MATTR_NASRUN_BLOCKRATE, 304 | MATTR_STR_SET, 305 | MATTR_INT_SET, 306 | MATTR_ER_SET, 307 | MATTR_HP_SET, 308 | MATTR_MP_SET, 309 | MATTR_DUR_SET, 310 | MATTR_LUCK_SET, 311 | MATTR_AVATAR_STR_2, 312 | MATTR_AVATAR_STR_3, 313 | MATTR_AVATAR_STR_4, 314 | MATTR_AVATAR_INT_2, 315 | MATTR_AVATAR_INT_3, 316 | MATTR_AVATAR_INT_4, 317 | MATTR_AVATAR_MDIA_2, 318 | MATTR_AVATAR_MDIA_3, 319 | MATTR_AVATAR_MDIA_4, 320 | MATTR_AVATAR_LUCK, 321 | MATTR_AVATAR_LUCK_2, 322 | MATTR_AVATAR_LUCK_3, 323 | MATTR_AVATAR_LUCK_4, 324 | MATTR_APE, 325 | MATTR_REINFORCE_ITEM_SET, 326 | MATTR_RESIST_ALL_SET, 327 | 328 | } 329 | 330 | public enum LoginErrorType 331 | { 332 | WrongPassword = 1, 333 | Banned = 101, 334 | ServerInspection = 102, 335 | UserAlreadyConnected = 3, 336 | C5Error = 4, 337 | ServerFull = 5, 338 | C7Error = 6, 339 | C8Error = 7, 340 | IPLimitExceeded = 8, 341 | DamagedDLLs = 10, 342 | } 343 | } 344 | -------------------------------------------------------------------------------- /SilkroadInformationAPI/Client/Packets/Inventory/InventoryOperation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using SilkroadSecurityApi; 8 | 9 | namespace SilkroadInformationAPI.Client.Packets.Inventory 10 | { 11 | public class InventoryOperation 12 | { 13 | public delegate void ItemSlotUpdatedHandler(InventoryOperationEventArgs InvOperationArgs); 14 | public static event ItemSlotUpdatedHandler OnInventoryOperation; 15 | 16 | public static void Parse(Packet p) 17 | { 18 | int succeeded = 0; 19 | try //Erorrs will occur because Parse(p) recursion. 20 | { 21 | succeeded = p.ReadInt8(); 22 | } catch { } 23 | 24 | if (succeeded != 1) 25 | return; 26 | 27 | int flag = p.ReadInt8(); 28 | 29 | InventoryOperationEventArgs args = null; 30 | 31 | if (flag == 0x00) //Item update in inventory 32 | { 33 | args = InventoryUtility.ParseSlotChangedUpdate(p, Client.InventoryItems, "Inv"); 34 | } 35 | else if (flag == 0x01) //Item slot changed in storage 36 | { 37 | args = InventoryUtility.ParseSlotChangedUpdate(p, Client.StorageItems, "Storage"); 38 | } 39 | else if (flag == 0x02) //Item added to storage 40 | { 41 | int oldSlot = p.ReadInt8(); 42 | int newSlotInStorage = p.ReadInt8(); 43 | 44 | var item = Client.InventoryItems[oldSlot]; 45 | item.Slot = newSlotInStorage; 46 | 47 | Client.InventoryItems.Remove(oldSlot); 48 | Client.StorageItems.Add(newSlotInStorage, item); 49 | 50 | args = new InventoryOperationEventArgs(Client.StorageItems[newSlotInStorage]); 51 | args.ItemChangeType = InventoryOperationEventArgs.ChangeType.Storage_ItemAddedToStorage; 52 | } 53 | else if (flag == 0x03) //Item taken from storage 54 | { 55 | int itemSlotInStorage = p.ReadInt8(); 56 | int newSlotInInventory = p.ReadInt8(); 57 | 58 | Information.InventoryItem item = Client.StorageItems[itemSlotInStorage]; 59 | item.Slot = newSlotInInventory; 60 | 61 | Client.InventoryItems.Add(newSlotInInventory, item); 62 | Client.StorageItems.Remove(itemSlotInStorage); 63 | 64 | args = new InventoryOperationEventArgs(Client.InventoryItems[newSlotInInventory]); 65 | args.ItemChangeType = InventoryOperationEventArgs.ChangeType.Storage_ItemTakenFromStorage; 66 | 67 | } 68 | else if (flag == 0x06) //Item picked from the ground 69 | { 70 | int itemSlot = p.ReadInt8(); 71 | 72 | if (Client.InventoryItems.ContainsKey(itemSlot)) //Removes the item if it's already in the inventory *If the item stacks* 73 | Client.InventoryItems.Remove(itemSlot); 74 | 75 | Information.InventoryItem item = InventoryUtility.ParseItem(p); 76 | 77 | Client.InventoryItems.Add(itemSlot, item); //Re-adds the item with the new info. 78 | 79 | args = new InventoryOperationEventArgs(Client.InventoryItems[itemSlot]); 80 | args.ItemChangeType = InventoryOperationEventArgs.ChangeType.Inv_ItemLooted; 81 | } 82 | else if (flag == 0x07) //Item thrown to the ground 83 | { 84 | int oldSlot = p.ReadInt8(); 85 | 86 | args = new InventoryOperationEventArgs(Client.InventoryItems[oldSlot]); 87 | args.ItemChangeType = InventoryOperationEventArgs.ChangeType.Inv_ItemThrown; 88 | 89 | Client.InventoryItems.Remove(oldSlot); 90 | } 91 | else if (flag == 0x08) //Item bought from NPC 92 | { 93 | uint RefID = Client.NearbyNPCs[Client.SelectedUniqueID].ModelID; 94 | string NPCMediaName = Media.Data.MediaModels[RefID].MediaName; 95 | byte TabIndex = p.ReadUInt8(); 96 | byte ItemIndex = p.ReadUInt8(); 97 | var shopItem = Media.Data.MediaShops.First(x => x.NPCName == NPCMediaName).GetTabFromIndex(TabIndex).TabItems.First(x => x.PackagePosition == ItemIndex); //WTF??? 98 | byte CountBought = p.ReadUInt8(); 99 | for (int i = 0; i < CountBought; i++) 100 | { 101 | var item = new Information.InventoryItem(Media.Data.MediaItems.First(x => x.Value.MediaName == shopItem.ItemMediaName).Value.ObjRefID); 102 | Console.WriteLine("BOUGHT: " + item.MediaName); 103 | item.Slot = p.ReadUInt8(); 104 | Client.InventoryItems.Add(item.Slot, item); 105 | } 106 | 107 | args = new InventoryOperationEventArgs(null); 108 | args.ItemChangeType = InventoryOperationEventArgs.ChangeType.Inv_ItemBought; 109 | } 110 | else if (flag == 0x09) //Item sold to NPC 111 | { 112 | if (Client.SoldItems.Count == 5) 113 | Client.SoldItems.Remove(Client.SoldItems.Last()); 114 | 115 | int itemSlot = p.ReadInt8(); 116 | int countSold = p.ReadInt16(); 117 | int NPCID = p.ReadInt32(); 118 | int indexInNPC = p.ReadInt8(); 119 | 120 | var item = Client.InventoryItems[itemSlot].Clone(); 121 | item.Stack = countSold; 122 | 123 | Client.SoldItems.Insert(0, item); 124 | 125 | if (countSold == Client.InventoryItems[itemSlot].Stack) 126 | Client.InventoryItems.Remove(itemSlot); 127 | else 128 | Client.InventoryItems[itemSlot].Stack -= countSold; 129 | 130 | args = new InventoryOperationEventArgs(item); 131 | args.ItemChangeType = InventoryOperationEventArgs.ChangeType.Inv_ItemSoldToNPC; 132 | 133 | //Console.WriteLine("Sold {0} to NPCID: {1}, Registered with ID: {2}", item.MediaName, NPCID, indexInNPC - 1); 134 | } 135 | else if (flag == 0x0A) 136 | { 137 | //Gold thrown to ground, we also get sent godl change packet 138 | //so this is useless. 139 | } 140 | else if (flag == 0x18) //Item bought from Item Mall 141 | { 142 | //TODO: PARSE PACKET 143 | } 144 | else if (flag == 0x22) //Item boughtback from NPC 145 | { 146 | int newSlotInInventory = p.ReadInt8(); 147 | int indexInNPC = p.ReadInt8(); 148 | int returnCount = p.ReadInt16(); 149 | 150 | //Console.WriteLine("Buying back ID: {0}", Client.SoldItems.Count - (1 + indexInNPC)); 151 | 152 | var item = Client.SoldItems[Client.SoldItems.Count - (1 + indexInNPC)]; 153 | 154 | Client.InventoryItems.Add(newSlotInInventory, item); 155 | Client.SoldItems.Remove(item); 156 | 157 | args = new InventoryOperationEventArgs(item); 158 | args.ItemChangeType = InventoryOperationEventArgs.ChangeType.Inv_ItemBoughtbackFromNPC; 159 | } 160 | else if (flag == 0x0E) //Item appeared in inventory 161 | { 162 | int invSlot = p.ReadUInt8(); 163 | var item = InventoryUtility.ParseItem(p); 164 | item.Slot = invSlot; 165 | Client.InventoryItems.Add(invSlot, item); 166 | } 167 | else if (flag == 0x0F) //Item disappeared 168 | { 169 | int oldSlot = p.ReadInt8(); 170 | 171 | args = new InventoryOperationEventArgs(Client.InventoryItems[oldSlot]); 172 | args.ItemChangeType = InventoryOperationEventArgs.ChangeType.Inv_ItemDisappeared; 173 | 174 | Client.InventoryItems.Remove(oldSlot); 175 | } 176 | else if (flag == 0x1B) //Item moved from inventory to pet 177 | { 178 | uint COS_uid = p.ReadUInt32(); 179 | if (Client.NearbyCOSs.ContainsKey(COS_uid)) 180 | { 181 | byte oldSlot = p.ReadUInt8(); 182 | byte newSlotInPet = p.ReadUInt8(); 183 | Client.NearbyCOSs[COS_uid].Inventory.Add(newSlotInPet, Client.InventoryItems[oldSlot]); 184 | Client.InventoryItems.Remove(oldSlot); 185 | } 186 | } 187 | else if (flag == 0x1A) //Item moved from pet to inventory 188 | { 189 | uint COS_uid = p.ReadUInt32(); 190 | if (Client.NearbyCOSs.ContainsKey(COS_uid)) 191 | { 192 | byte oldSlot = p.ReadUInt8(); 193 | byte newSlotInPet = p.ReadUInt8(); 194 | Client.InventoryItems.Add(newSlotInPet, Client.NearbyCOSs[COS_uid].Inventory[oldSlot]); 195 | Client.NearbyCOSs[COS_uid].Inventory.Remove(oldSlot); 196 | } 197 | } 198 | else if (flag == 0x10) //Item slot changed within pet 199 | { 200 | uint COS_uid = p.ReadUInt32(); 201 | if (Client.NearbyCOSs.ContainsKey(COS_uid)) 202 | { 203 | args = InventoryUtility.ParseSlotChangedUpdate(p, Client.NearbyCOSs[COS_uid].Inventory, "PetInventory"); 204 | } 205 | } 206 | 207 | if(args != null) 208 | OnInventoryOperation?.Invoke(args); 209 | } 210 | 211 | 212 | } 213 | } 214 | --------------------------------------------------------------------------------