public static void Send(LobbyClient client) { PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_LOGIN_SUCCESS); Out.WriteUnicodeString(client.Account.RealTag,48); Out.WriteUInt32R(21); // Account Type Out.WriteInt64R(TCPManager.GetTimeStamp()); // Temps avant expiration du compte Out.WriteByte(0x13); // ms Out.WriteByte(0x29); // sec Out.WriteUInt16R(0x12); // Hour // Date de création Out.WriteByte(0x0E); // day Out.WriteByte(0x07); // month Out.WriteUInt16R(2010); // Year Out.WriteInt32R(1450); // Temps de jeu (secondes) Out.WriteInt32R(client.Account.Points); // Points APB for(int i=1;i<6;++i) Out.WriteInt32R( Program.FileMgr.GetFileVersion(client.Account.Id, i, true, "", "")); // Config file, Server Version Out.WriteInt32R(0); Out.WriteUInt16(0x957D); Out.WriteUInt16(0x0400); Out.WriteUInt16(0x5052); Out.WriteUInt16(0x4F45); Out.WriteUInt16(0x552E); Out.WriteUInt16(0x3232); Out.WriteUInt16(0x3738); Out.WriteUInt16(0x3031); Out.WriteUInt16(0); Out.WriteUInt16(0x0067); Out.WriteUInt64(0x526C624331313256); Out.WriteUInt64(0x486E314100000000); Out.WriteUInt16(0); Out.WriteStringBytes(""); Out.WriteByte(0); client.SendTCP(Out); ANS_CHARACTER_INFO.Send(client); }
public static void Send(LobbyClient client) { List<WorldInfo> _Worlds = Program.CharMgr.GetWorlds(); PacketOut Out = new PacketOut((UInt32)Opcodes.WORLD_LIST); Out.WriteInt32R(0); // Returned Code Out.WriteUInt16R((UInt16)_Worlds.Count); // World Count foreach (WorldInfo Info in _Worlds) { Out.WriteUInt32R((UInt32)Info._Info.Id); // WorldUid Out.WriteUnicodeString(Info._Info.Name, 32); // WorldName Out.WriteByte((byte)(Info.RpcID == 0 ? 0 : 1)); // Status Out.WriteByte(Info._Info.Population); // Pop 0:Low 1:Medium 2:High Out.WriteByte(Info._Info.Enf); // enf recommended , true or false Out.WriteByte(Info._Info.Crim); // crim recommended , true or false } client.SendTCP(Out); }
public static void HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte sloid = packet.GetUint8(); Program.CharMgr.SetEnter(cclient.Account.Id, sloid); WorldInfo Info = Program.CharMgr.GetWorldInfo(cclient.Account.WorldId); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (Info == null) Out.WriteUInt32R(1); else { Out.WriteUInt32R(0); Out.WriteInt32R(Info.Ip); // WorldServerIp Out.WriteUInt16R((UInt16)Info.Port); // Port Out.WriteInt64R(TCPManager.GetTimeStamp()); } cclient.SendTCP(Out); }
public static byte[] BuildCharacters(int AccountId) { Log.Debug("BuildCharacters", "AcocuntId = " + AccountId); Character[] Chars = GetAccountChar(AccountId)._Chars; UInt16 Count = 0; // On Compte le nombre de personnages existant du joueur for (UInt16 c = 0; c < Chars.Length; ++c) if (Chars[c] != null) ++Count; PacketOut Out = new PacketOut(0); Out.Position = 0; Out.WriteByte(MAX_SLOT); Out.WriteUInt32(0xFF); Out.WriteByte(0x14); Character Char = null; for (int i = 0; i < MAX_SLOT; ++i) { Char = Chars[i]; if (Char == null) Out.Fill(0, 284); // 284 else { List<Character_item> Items = CharMgr.GetItemChar(Char.CharacterId); Out.FillString(Char.Name, 48); Out.WriteByte(Char.Value.Level); Out.WriteByte(Char.Career); Out.WriteByte(Char.Realm); Out.WriteByte(Char.Sex); Out.WriteByte(Char.ModelId); Out.WriteUInt16(Char.Value.ZoneId); Out.Fill(0, 5); Character_item Item = null; for (UInt16 SlotId = 14; SlotId < 30; ++SlotId) { Item = Items.Find(item => item != null && item.SlotId == SlotId); if (Item == null) Out.WriteUInt32(0); else Out.WriteUInt32R(Item.ModelId); Out.Fill(0, 4); } Out.Fill(0, 6); for (int j = 0; j < 5; ++j) { Out.Fill(0, 6); Out.WriteUInt16(0xFF00); } for (UInt16 SlotId = 10; SlotId < 13; ++SlotId) { Item = Items.Find(item => item != null && item.SlotId == SlotId); Out.WriteUInt16(0); if (Item == null) Out.WriteUInt16(0); else Out.WriteUInt16R((ushort)Item.ModelId); } Out.Fill(0, 10); Out.WriteUInt16(0xFF00); Out.WriteByte(0); Out.WriteByte(Char.Race); Out.WriteUInt16(0); Out.Write(Char.bTraits, 0, Char.bTraits.Length); Out.Fill(0, 14);// 272 } } return Out.ToArray(); }
// 1.3.5 public void SendMaxInventory(Player Plr) { PacketOut Out = new PacketOut((byte)Opcodes.F_BAG_INFO); Out.WriteByte(0x0F); Out.WriteByte(GetTotalSlot()); // Nombre de slots disponibles Out.WriteUInt16((UInt16)INVENTORY_SLOT_COUNT); Out.WriteByte(0); Out.WriteUInt16R(GetBagPrice()); byte[] Data = new byte[] { 0x00,0x00, 0x50,0x00,0x08, 0x00,0x60, 0xEA, 0x00,0x00 }; Out.Write(Data, 0, Data.Length); Plr.SendPacket(Out); }
public void SendInitComplete() { PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_INIT_COMPLETE); Out.WriteUInt16R(_ObjectId); SendPacket(Out); }
public void Update() { Log.Debug("Group", "Updating Group"); if (Leader == null || Members.Count < 1 || (Members.Count == 1 && Leader == Members.First())) { Delete(); return; } PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO); Out.WriteUInt16(0x0602); // Group info Out.WriteUInt16(0xB536); // Group id Out.WriteByte((byte)Members.Count); foreach (Player Plr in Members) { Out.WriteUInt32(0xA8BF3B0C); Out.WriteByte((byte)Plr._Info.ModelId); Out.WriteByte((byte)Plr._Info.Race); Out.WriteByte((byte)Plr.Level); Out.WriteUInt16((ushort)Plr._Info.CareerLine); Out.WriteByte(1); Out.WriteByte(0); // Will be 1 for at least one member. Perhaps Leader? Out.WriteByte(0); Out.WriteByte(1); // Online = 1, Offline = 0 Out.WriteByte((byte)Plr.Name.Length); Out.Fill(0, 3); Out.WriteStringBytes(Plr.Name); Out.WriteByte(0); // Name length. Pet? Target? Out.Fill(0, 3); //Out.WriteStringBytes(Pet name? Target?); Out.WriteByte(0x8B); Out.WriteUInt16R((ushort)650); // X ? Out.WriteByte(0xD3); Out.WriteUInt16R((ushort)650); // y ? byte[] data = { 0xC8, 0x50, 0x27, 0x25, 0x05, 0x40, 0x01, 0x02 }; Out.Write(data); Out.WriteByte((byte)(Plr._Value.ZoneId*2)); Out.WriteByte(1); Out.WriteByte(1); Out.WriteByte((byte)Plr.PctHealth); Out.WriteByte((byte)Plr.PctAp); // action points Out.WriteByte(0); } SendToGroup(Out); }
public virtual void SendState(Player Plr) { if (!IsInWorld()) return; if (MvtInterface.CurrentSpeed != 0 && !IsPlayer()) { SendState(Plr, (ushort)MvtInterface.TargetPosition.X, (ushort)MvtInterface.TargetPosition.Y, (ushort)MvtInterface.TargetPosition.Z, (byte)(MvtInterface.CurrentSpeed >= 50 ? 3 : 1)); } else { PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_STATE); Out.WriteUInt16(Oid); Out.WriteUInt16((ushort)X); Out.WriteUInt16((ushort)Y); Out.WriteUInt16((ushort)Z); Out.WriteByte(PctHealth); Out.WriteByte(0); // Movement Type 0 None, 1 Walk, 2 ?, 3 Run Out.WriteByte((byte)Zone.ZoneId); Out.Fill(0, 5); Out.WriteUInt16R(Heading); if (Plr == null) DispatchPacket(Out, false); else Plr.SendPacket(Out); } if (MvtInterface.CurrentSpeed != 0) SendAnimation(); }
public static byte[] BuildCharactersList(int AccountId) { Log.Debug("BuildCharactersList", "AcocuntId = " + AccountId); Character[] Chars = GetAccountChar(AccountId)._Chars; int count = 0; PacketOut Out = new PacketOut(0); Out.Position = 0; Character Char = null; for (int k = 0; k < MAX_SLOT; ++k) { Char = Chars[k]; if (Char != null) { List<Character_items> Items = CharMgr.GetItemChar(Char.CharacterId); /**** char slot start ****/ Out.FillString(Char.Name, 48); // name Out.WriteByte(Char.Value[0].Level); // Level Out.WriteByte(Char.Career); //career Out.WriteByte(Char.Realm); // realm Out.WriteByte(Char.Sex); // gender Out.WriteUInt16R(Char.ModelId); //model id Out.WriteUInt16R(Char.Value[0].ZoneId); // zone id Out.Fill(0, 12); // unk Character_items Item = null; for (UInt16 SlotId = 14; SlotId < 30; ++SlotId) { Item = Items.Find(item => item != null && item.SlotId == SlotId); if (Item == null) { Out.WriteInt32(0); Out.WriteInt32(0); } else { Out.WriteInt32((int)Item.ModelId); Out.WriteUInt16R(0); // primary dye Out.WriteUInt16R(0); // secondary dye } } Out.WriteUInt32(0x00); // 0x00000000 for (int i = 0; i < 4; i++) { Out.WriteUInt32(0xFF000000); Out.WriteUInt32(0x00); } Out.WriteUInt32(0xFF000000); //weapons for (UInt16 SlotId = 10; SlotId < 13; ++SlotId) { Item = Items.Find(item => item != null && item.SlotId == SlotId); if (Item == null) Out.WriteUInt32(0); else { Out.WriteUInt16R((ushort)Item.ModelId); Out.WriteUInt16(0); } } Out.Fill(0, 8); Out.WriteUInt16(0xFF00); Out.WriteByte(0); Out.WriteByte(Char.Race); // char slot position Out.WriteUInt16(0x00); //unk /* //Traits [8 bytes] Out.WriteByte(1); //face Out.WriteByte(4); //jewel Out.WriteByte(4); //scar Out.WriteByte(0); //hair Out.WriteByte(3); //hair color Out.WriteByte(2); //skin color Out.WriteByte(0); //eye color Out.WriteByte(5); //metal color */ Out.Write(Char.bTraits, 0, Char.bTraits.Length); Out.Fill(0, 14); //unk count++; } } for (int i = 0; i < (MAX_SLOT - count); ++i) Out.Write(new byte[284], 0, 284); return Out.ToArray(); }
public static void F_PLAYER_ENTER_FULL(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; UInt16 SID; byte unk1, serverID, characterSlot; SID = packet.GetUint16(); unk1 = packet.GetUint8(); serverID = packet.GetUint8(); string CharName = packet.GetString(24); packet.Skip(2); string Language = packet.GetString(2); packet.Skip(4); characterSlot = packet.GetUint8(); Log.Debug("F_PLAYER_ENTER_FULL", "Entrer en jeu de : " + CharName + ",Slot=" + characterSlot); if (Program.Rm.RealmId != serverID) cclient.Disconnect(); else { PacketOut Out = new PacketOut((byte)Opcodes.S_PID_ASSIGN); Out.WriteUInt16R((ushort)cclient.Id); cclient.SendPacket(Out); } }
public virtual void SendState(Player Plr) { if (IsPlayer()) return; if (!IsInWorld()) return; PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_STATE); Out.WriteUInt16(Oid); Out.WriteUInt16((ushort)X); Out.WriteUInt16((ushort)Y); Out.WriteUInt16((ushort)Z); Out.WriteByte(PctHealth); Out.WriteUInt16(Zone.ZoneId); Out.Fill(0, 5); Out.WriteUInt16R(Heading); if (Plr == null) DispatchPacket(Out, false); else Plr.SendPacket(Out); }
public void RemoveEffect() { PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_EFFECTS); Out.WriteByte(1); Out.WriteByte(2); Out.WriteUInt16(0); Out.WriteUInt16(Interface._Owner.Oid); Out.WriteByte(BuffId); Out.WriteByte(0); Out.WriteUInt16R(Info.Entry); // Entry Out.WriteByte(0); Interface._Owner.DispatchPacket(Out, true); }
public void InitEffect(byte Seconds, Player Plr = null) { PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_EFFECTS); Out.WriteByte(1); Out.WriteByte(1); Out.WriteUInt16(0); Out.WriteUInt16(Interface._Owner.Oid); Out.WriteByte(BuffId); Out.WriteByte(0); Out.WriteUInt16R(Info.Entry); // Entry Out.WriteByte((byte)(Seconds * 2)); // Time * 2 ? Out.WriteByte(0x37); Out.WriteUInt16(0x81); Out.WriteByte(0x02); Out.WriteByte(01); Out.WriteUInt16(0xA4); Out.WriteByte(1); Out.WriteByte(00); if (Plr == null) Interface._Owner.DispatchPacket(Out, true); else Plr.SendPacket(Out); }