private void SendHandshake(short pXorPos) { Packet packet = new Packet(SH2Type.SetXorKeyPosition); packet.WriteShort(pXorPos); SendPacket(packet); }
public static void SendError(WorldClient client, ServerError error) { using (Packet pack = new Packet(SH3Type.Error)) { pack.WriteShort((byte)error); client.SendPacket(pack); } }
public static void BySPStoneHandler(ZoneClient client, Packet packet) { short Amount; if (packet.TryReadShort(out Amount)) { client.Character.ChangeMoney(client.Character.Character.Money -= client.Character.BaseStats.PriceSPStone); short Am = Amount += client.Character.StonesSP; client.Character.StonesHP = Am; using (var p = new Packet(SH20Type.ChangeSPStones)) { p.WriteShort(Am); client.SendPacket(p); } } }
public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet) { packet.WriteInt(wchar.Character.ID); //charid packet.FillPadding(wchar.Character.Name, 0x10); packet.WriteInt(0);//unk packet.WriteShort((short)wchar.Character.CharLevel); //level packet.WriteByte(wchar.Character.Slot); MapInfo mapinfo; if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.PositionInfo.Map, out mapinfo)) { Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.PositionInfo.Map); wchar.Character.PositionInfo.Map = 0; packet.FillPadding(mapinfo.ShortName, 0x0D); //townname } else { packet.FillPadding(mapinfo.ShortName, 0x0D); //townname } //packet.WriteByte(0); // UNK packet.WriteInt(0); // Random seed WriteLook(wchar,packet); WriteEquipment(wchar,packet); WriteRefinement(wchar,packet); packet.WriteByte(0); packet.WriteByte(0xF0); packet.WriteByte(0xFF);//unk packet.WriteByte(0xFF); packet.FillPadding(mapinfo.ShortName, 0x0c); packet.WriteInt(0); //pos packet.WriteInt(0); //pos packet.WriteUShort(0xdb78); packet.WriteUShort(4910);//unk packet.WriteUShort(25600); packet.Fill(4, 0); }
public static void VersionInfo(LoginClient pClient, Packet pPacket) { string year; ushort version; if (!pPacket.TryReadString(out year, 20) || !pPacket.TryReadUShort(out version)) { Log.WriteLine(LogLevel.Warn, "Invalid client version."); pClient.Disconnect(); return; } Log.WriteLine(LogLevel.Debug, "Client version {0}:{1}.", year, version); using (Packet response = new Packet(SH3Type.VersionAllowed)) { response.WriteShort(1); pClient.SendPacket(response); } }
public static void UseTeleporter(ZoneClient client, Packet packet) { byte anwser; if (packet.TryReadByte(out anwser)) { using (Packet Packet = new Packet(SH6Type.TelePorter)) { Packet.WriteShort(6593);//code for normal teleport client.SendPacket(Packet); } switch (anwser) { case 0: client.Character.ChangeMap(0, 4199, 4769);//Roumen break; case 1: client.Character.ChangeMap(9, 11802, 10466);//Eldrine break; case 2: client.Character.ChangeMap(75, 9069, 9312);//EldGbl02 break; case 3: client.Character.ChangeMap(5,13658,7812);//RouVal01 break; default: Log.WriteLine(LogLevel.Warn,"Unkown Teleport Answer {1}",anwser); break; } } }
public static void FriendListDelete(WorldClient pClient, Packet pPacket) { string sender, target; if (!pPacket.TryReadString(out sender, 16) || !pPacket.TryReadString(out target, 16)) { Log.WriteLine(LogLevel.Warn, "Error parsing friend delete request."); return; } if (pClient.Character.DeleteFriend(target)) { WorldClient client = ClientManager.Instance.GetClientByCharname(target); if (client != null) { using (var pack = new Packet(SH21Type.FriendDeleteSend)) { pack.WriteString(sender, 16); client.SendPacket(pack); } Friend friend = pClient.Character.Friends.Find(f => f.Name == target); if(friend != null) pClient.Character.Friends.Remove(friend); } using (var pack = new Packet(SH21Type.FriendDeleteSend)) { pack.WriteString(sender, 16); pack.WriteString(target, 16); pack.WriteShort(0x0951); pClient.SendPacket(pack); } } else { using (var pack = new Packet(SH21Type.FriendInviteResponse)) { pack.WriteString(target, 16); pack.WriteString(sender, 16); pack.WriteUShort(0x0946); // Cannot find ${Target} pClient.SendPacket(pack); } } }
public void WriteCharacterDisplay(Packet packet) { packet.WriteUShort(MapObjectID); packet.WriteString(Name, 16); packet.WriteInt(Position.X); packet.WriteInt(Position.Y); packet.WriteByte(Rotation); // Rotation packet.WriteByte((byte)State); // Player State (1,2 - Player, 3 - Dead, 4 - Resting, 5 - Vendor, 6 - On Mount) packet.WriteByte((byte)Job); if (State != PlayerState.Resting && State != PlayerState.Vendor && this.House == null) { WriteLook(packet); WriteEquipment(packet); } else { this.House.WritePacket(packet); } WriteRefinement(packet); //(IsMale ? 1 : 0) int mount = (this.Mount != null) ? (int) this.Mount.Handle : (int)0xffff; packet.WriteUShort((ushort)mount); // Mount Handle packet.WriteUShort(0xffff); packet.WriteByte(0xff); // Emote (0xff = nothing) packet.WriteUShort(0xffff); packet.WriteShort(0); packet.WriteUShort(0); // Mob ID (title = 10) packet.Fill(55, 0); // Buff Bits? Something like that if (this.Character.GuildID > 1) { packet.WriteInt(this.Guild.ID); } else if (this.Character.AcademyID > 0) { packet.WriteInt(this.Character.AcademyID); } else { packet.WriteInt(0); } packet.WriteByte(0x02); // UNK (0x02) packet.WriteBool(this.IsInaAcademy); // In Guild Academy (0 - No, 1 - Yes) packet.WriteBool(true); // Pet AutoPickup (0 - Off, 1 - On) packet.WriteByte(this.Level); }
public void WriteDetailedInfo(Packet pPacket) { pPacket.WriteInt(ID); pPacket.WriteString(this.Name, 16); pPacket.WriteByte(this.Slot); pPacket.WriteByte(this.Level); pPacket.WriteLong(this.Exp); pPacket.WriteInt(0); // UNK pPacket.WriteShort(this.StonesHP); pPacket.WriteShort(this.StonesSP); pPacket.WriteUInt(this.HP); pPacket.WriteUInt(this.SP); pPacket.Fill(4, 0); //UNK pPacket.WriteInt(this.Fame); // Fame pPacket.WriteLong(this.Money); //TODO: inventory class pPacket.WriteString(this.Map.MapInfo.ShortName, 12); pPacket.WriteInt(this.Position.X); pPacket.WriteInt(this.Position.Y); pPacket.WriteByte(this.Rotation); pPacket.WriteByte(this.Str); // Str bonus pPacket.WriteByte(this.End); // End bonus pPacket.WriteByte(this.Dex); // Dex bonus pPacket.WriteByte(this.Int); // Int bonus pPacket.WriteByte(this.Spr); // Spr bonus pPacket.WriteShort(0); // UNK pPacket.WriteUInt(0); // Killpoints pPacket.Fill(7, 0); // UNK }
public static void sendPartyMatchingList(WorldClient client) { using (var packet = new Packet(SH14Type.PartyMatchingSystem)) { packet.WriteShort(0); // UNK packet.WriteShort(20); packet.WriteShort(1); packet.WriteInt(Program.Entity.PartyMatchingSystems.Count()); foreach (PartyMatchingSystem v in Program.Entity.PartyMatchingSystems) { packet.WriteInt(client.Character.ID); //unk packet.WriteString(v.Name, 16); packet.WriteString(v.Message, 128); packet.WriteUShort(0); //unk } client.SendPacket(packet); } }
public static void PartyInviteToCharacter(WorldClient client, Packet packet) { string charname; if (!packet.TryReadString(out charname, 16)) { Log.WriteLine(LogLevel.Error, "PartySystem :: Got unknown Party request from Character {0}", client.Character.Character.Name); return; } WorldClient otherclient = ClientManager.Instance.GetClientByCharname(charname); if (otherclient != null) { if (Program.Entity.Parties.Count(c => c.CharNo == otherclient.Character.Character.ID) == 1) { using (var ppacket = new Packet(SH14Type.PartyInviteAnswer)) { ppacket.WriteString(charname, 16); ppacket.WriteByte(0); ppacket.WriteShort(1220); client.SendPacket(ppacket); } } else { using (var ppacket = new Packet(SH14Type.PartyRequestFromCharacter)) { ppacket.WriteString(client.CharacterName, 16); otherclient.SendPacket(ppacket); } } } else { Log.WriteLine(LogLevel.Error, "PartySystem :: Client not found from {0}", client.CharacterName); } }
public static void On_GameClient_LeaveGuild(WorldClient Client, Packet pPacket) { if (Client.Character.Guild == null) { return; } GuildMember member; if (Client.Character.Guild.GetMember(Client.Character.Character.Name, out member)) { Client.Character.Guild.RemoveMember(member, null, true); using (var packet = new Packet(SH29Type.LeaveGuildResponse)) { packet.WriteShort(3137); Client.SendPacket(packet); } } }
public void WriteDetailedInfo(Packet pPacket) { pPacket.WriteInt(ID); pPacket.WriteString(this.Name, 16); pPacket.WriteByte(this.Slot); pPacket.WriteByte(this.Level); pPacket.WriteLong(this.Exp); pPacket.WriteInt(12345678); // UNK pPacket.WriteShort(this.StonesHP); pPacket.WriteShort(this.StonesSP); pPacket.WriteUInt(this.HP); pPacket.WriteUInt(this.SP); pPacket.WriteInt(this.Fame); pPacket.WriteLong(this.Inventory.Money); pPacket.WriteString(this.Map.MapInfo.ShortName, 12); pPacket.WriteInt(this.Position.X); pPacket.WriteInt(this.Position.Y); pPacket.WriteByte(this.Rotation); pPacket.WriteByte(this.Str);// -. pPacket.WriteByte(this.End);// | pPacket.WriteByte(this.Dex);// | Boni pPacket.WriteByte(this.Int);// | pPacket.WriteByte(this.Spr);// -' pPacket.WriteShort(0); // UNK pPacket.WriteUInt(0); // Killpoints (TODO) pPacket.Fill(7, 0); // UNK }
public void WriteEquipStats(Packet packet) { byte StatCount = 0; if (Str > 0) StatCount++; if (End > 0) StatCount++; if (Dex > 0) StatCount++; if (Spr > 0) StatCount++; if (Int > 0) StatCount++; packet.WriteUShort(ItemID); switch (this.SlotType) { case ItemSlot.Helm: case ItemSlot.Armor: case ItemSlot.Pants: case ItemSlot.Boots: packet.WriteByte(this.Upgrades); // Refinement packet.WriteByte(0); packet.WriteShort(0); // Or int? packet.WriteShort(0); packet.WriteByte(0); packet.WriteInt(0); //Temp packet.WriteByte(0x01); //Temp break; // case ItemSlot.Bow: // Shield = same case ItemSlot.Weapon2: case ItemSlot.Weapon: packet.WriteByte(this.Upgrades); // Refinement packet.WriteByte(0); packet.WriteShort(0); // Or int? packet.WriteShort(0); if (this.SlotType == ItemSlot.Weapon || (this.SlotType == ItemSlot.Weapon2 && Info.TwoHand)) { packet.WriteByte(0); // Licence data packet.WriteUShort(0xFFFF); // Nr.1 - Mob ID packet.WriteUInt(0); // Nr.1 - Kill count packet.WriteUShort(0xFFFF); // Nr.2 - Mob ID packet.WriteUInt(0); // Nr.2 - Kill count packet.WriteUShort(0xFFFF); // Nr.3 - Mob ID packet.WriteUInt(0); // Nr.3 - Kill count packet.WriteUShort(0xFFFF); // UNK packet.WriteString("", 16); // First licence adder name } packet.WriteByte(0); packet.Fill(9, (byte)0xFF); packet.Fill(7, 0x00); //packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires) break; case ItemSlot.Pet: packet.WriteByte(this.Upgrades); // Pet Refinement Lol packet.Fill(2, 0); // UNK packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires) packet.WriteUInt(0); // Time? (1992027391 - never expires) break; case ItemSlot.Earings: case ItemSlot.Necklace: case ItemSlot.Ring: packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires) packet.WriteUInt(0); // Time? (1992027391 - never expires) packet.WriteByte(this.Upgrades); // Refinement // Stats added while refining packet.WriteUShort(0); // it may be byte + byte too (some kind of counter when item downgrades) packet.WriteUShort(0); // STR packet.WriteUShort(0); // END packet.WriteUShort(0); // DEX packet.WriteUShort(0); // INT packet.WriteUShort(0); // SPR break; case ItemSlot.CostumeWeapon: case ItemSlot.CostumeShield: packet.WriteUInt(25000); // Skin Durability break; default: //packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires) //packet.WriteUInt(0); // Time? (1992027391 - never expires) break; } //// Random stats data (Not those what were added in refinement) //switch (this.SlotType) //{ // Stat count (StatCount << 1 | Visible(0 or 1 are stats shown or not)) // case ItemSlot.Earings: // packet.WriteByte((byte)(StatCount << 1 | 1)); // break; // case ItemSlot.Necklace: // case ItemSlot.Ring: // packet.WriteByte((byte)(StatCount << 1 | 1)); // break; // case ItemSlot.Helm: // case ItemSlot.Armor: // case ItemSlot.Pants: // case ItemSlot.Boots: // case ItemSlot.Weapon2: // case ItemSlot.Weapon: // packet.WriteByte((byte)(StatCount << 1 | 1)); // break; // case ItemSlot.Pet: // Yes!! Its possible to give stats to pet also (It overrides default one(s)). // packet.WriteByte((byte)(StatCount << 1 | 1)); // break; //} //// foreach stat ////pPacket.WriteByte(type); // Stat type ( 0 = STR, 1 = END, 2 = DEX, 3 = INT, 4 = SPR ) ////pPacket.WriteUShort(amount); // Amount //// end foreach //if (Str > 0) { packet.WriteByte(0); packet.WriteUShort(Str); } //if (End > 0) { packet.WriteByte(1); packet.WriteUShort(End); } //if (Dex > 0) { packet.WriteByte(2); packet.WriteUShort(Dex); } //if (Spr > 0) { packet.WriteByte(3); packet.WriteUShort(Spr); } //if (Int > 0) { packet.WriteByte(4); packet.WriteUShort(Int); } }
public void WriteCharacterDisplay(Packet packet) { packet.WriteUShort(MapObjectID); packet.WriteString(Name, 16); packet.WriteInt(Position.X); packet.WriteInt(Position.Y); packet.WriteByte(Rotation); // Rotation packet.WriteByte((byte)State); // Player State (1,2 - Player, 3 - Dead, 4 - Resting, 5 - Vendor, 6 - On Mount) packet.WriteByte((byte)Job); if (State != PlayerState.Resting && State != PlayerState.Vendor && this.House == null) { WriteLook(packet); WriteEquipment(packet); } else { this.House.WritePacket(packet); } WriteRefinement(packet); packet.WriteUShort(0); // Mount Handle packet.WriteUShort(0xffff); packet.WriteByte(0xff); // Emote (0xff = nothing) packet.WriteUShort(0xffff); packet.WriteShort(0); packet.WriteUShort(0); // Mob ID (title = 10) packet.Fill(81, 0); // Buff Bits? Something like that packet.WriteInt(character.GuildID.HasValue ? character.GuildID.Value : 0); // Guild ID packet.WriteByte(0x02); // UNK (0x02) packet.WriteBool(false); // In Guild Academy (0 - No, 1 - Yes) packet.WriteBool(true); // Pet AutoPickup (0 - Off, 1 - On) packet.WriteByte(this.Level); packet.Fill(32, 0); packet.Fill(2, 0xFF); packet.WriteUShort(522); }
public static void SendQuestListDone(ZoneCharacter character) { using (var packet = new Packet(SH4Type.CharacterQuestsDone)) { packet.WriteInt(character.ID); packet.WriteShort(0); //quest count character.Client.SendPacket(packet); } }
public void BuySPStones(Packet packet, Packet ppacket, short amount) { this.StonesSP += amount; this.Money -= (DataProvider.Instance.GetBaseStats(this.Job, this.Level).PriceSPStone * amount); packet.WriteShort(this.StonesSP); ppacket.WriteLong(this.Money); }
public static void SendTitleList(ZoneCharacter character) { using (var packet = new Packet(SH4Type.CharacterTitles)) { packet.WriteInt(0); //current title ID packet.WriteShort(0); //title count //here comes shit loop (see old zepheus) character.Client.SendPacket(packet); } }
public static void GotIngame(WorldClient client, Packet packet) { /* using (var p1 = new Packet(SH4Type.CharacterGuildacademyinfo)) { if(client.Character.GuildAcademy != null) { } else { p1.Fill(5, 0); } client.SendPacket(p1); } using (var p2 = new Packet(SH4Type.CharacterGuildinfo)) { if (client.Character.Guild != null) { client.Character.Guild.Details.WriteMessageAsGuildMember(p2, client.Character.Guild); } else { p2.WriteInt(0); } client.SendPacket(p2); }*/ // dafuq no op code.. using (var p = new Packet(0x581C)) { //p.WriteShort(); p.WriteUInt(0x4d0bc167); // 21h client.SendPacket(p); } // dafuq no op code.. using (var p3 = new Packet(0x581D)) { p3.WriteShort(0); //zero kingdom quests! client.SendPacket(p3); } using (var p4 = new Packet(21, 7)) { p4.WriteByte((byte)client.Character.Friends.Count); client.Character.WriteFriendData(p4); client.SendPacket(p4); } using (var p5 = new Packet(SH2Type.UnkTimePacket)) { p5.WriteShort(256); client.SendPacket(p5); } if (!client.Character.IsIngame) { client.Character.IsIngame = true; client.Character.OneIngameLoginLoad(); MasterManager.Instance.SendMasterList(client); //SendMasterList(pClient); } Managers.CharacterManager.InvokdeIngame(client.Character); client.Character.OnGotIngame(); }
public void WriteGuildInfo(Packet Packet) { Packet.WriteInt(ID); Packet.WriteInt(ID); // academy id? Packet.WriteString(Name, 16); Packet.Fill(24, 0x00); //unk Packet.WriteUShort(38); Packet.WriteInt(100); Packet.Fill(233, 0x00);//unk Packet.WriteUShort(11779); Packet.WriteShort(20082); Packet.WriteInt(31); Packet.WriteInt(55); Packet.WriteInt(18);//unk Packet.WriteInt(15); Packet.WriteInt(8);//unk Packet.WriteInt(111);//unk Packet.WriteInt(4); Packet.Fill(136, 0);//buff or string Packet.WriteUShort(1824); Packet.WriteUShort(20152); Packet.WriteInt(16); Packet.WriteInt(28); Packet.WriteInt(MessageCreateTime.Minute);//createDetails Guild Minutes Date Packet.WriteInt(MessageCreateTime.Hour); //create Details Guild Hours Date Packet.WriteInt(MessageCreateTime.Day);//create details Guild Day Date Packet.WriteInt(MessageCreateTime.Month);//create details Month Packet.WriteInt(MessageCreateTime.Year - 1900);//creae details year 1900- 2012 Packet.WriteInt(10);//unk Packet.WriteUShort(2); Packet.Fill(6, 0);//unk if(MessageCreater.Character.Name == null) { Packet.WriteString("", 16); } else { Packet.WriteString(MessageCreater.Character.Name, 16); } Packet.WriteString(Message, 512);//details message }