public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; byte slotId = packet.GetUint8(); Character Info = cclient.Characters.Get(slotId); MySqlCommand cmd = new MySqlCommand("DELETE FROM `clientstatus` WHERE `name` = @name", Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@name", Info.Name); cmd.ExecuteNonQuery(); } catch (MySqlException) { } finally { cmd.Dispose(); } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_INFO); if (Info == null) Out.WriteUInt32Reverse((uint)ResponseCodes.RC_FAILED); else { Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(Info.Slot); Out.WriteByte(Info.Gender); Out.WriteUInt32Reverse(Info.Playtime); Out.WriteUInt32Reverse(Info.Rank); Out.WriteByte(Info.Threat); Out.WriteUInt32Reverse(Info.Money); Out.WriteParsedString("APB-EMU", 60); byte[] Custom = Info.getCustom(); Out.Write(Custom, 0, Custom.Length); } cclient.Send(Out); return 0; }
public static void DropItem(Client client, PacketIn packet) { int IID = (int)packet.ReadUInt32(); PlayerItem pItem = PlayerItem.GetItem(IID); int quantity = (int)packet.ReadUInt32(); //check if the item exists if (pItem == null) { Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails); return; } //check if player owns the item if (pItem.PID != client.Character.Player.PID) { Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails); return; } CodeHandler handler = CodeManager.GetHandler(pItem.Item.Code); handler.Drop(pItem, quantity, client.Character, client); }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; PacketOut Out = new PacketOut((UInt32)Opcodes.LFG); if (cclient.LFG == 0) { MySqlCommand cmd = new MySqlCommand("UPDATE `clientstatus` SET `lfg` = 1 WHERE `name` = @name", WorldServer.Database.Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@name", cclient.Name); cmd.ExecuteNonQuery(); } catch (MySqlException e) { FrameWork.Logger.Log.Error("MySQL", e.ToString()); } finally { cmd.Dispose(); } cclient.LFG = 1; Out.WriteByte(1); } else if (cclient.LFG == 1) { MySqlCommand cmd = new MySqlCommand("UPDATE `clientstatus` SET `lfg` = 0 WHERE `name` = @name", WorldServer.Database.Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@name", cclient.Name); cmd.ExecuteNonQuery(); } catch (MySqlException e) { FrameWork.Logger.Log.Error("MySQL", e.ToString()); } finally { cmd.Dispose(); } cclient.LFG = 0; Out.WriteByte(0); } cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; UInt32 code = packet.GetUint32(); cclient.Send(new ANS_DISTRICT_RESERVE(code, packet.GetUint32(), cclient.Character.LFG, cclient)); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; byte[] clientModulus = new byte[64]; for (int i = 0; i < 64; ++i) clientModulus[i] = packet.GetUint8(); cclient.clientModulus = new FrameWork.NetWork.Crypto.BigInteger(1, clientModulus); UInt16 unk = packet.GetUint16(); byte[] Proof = new byte[20]; for (int i = 0; i < 20; ++i) Proof[i] = packet.GetUint8(); cclient.Proof = Proof; if (IsBanned(cclient)) { ANS_LOGIN_FAILED.Send(cclient, (int)ResponseCodes.RC_LOGIN_ACCOUNT_BLOCKED); cclient.Disconnect(); } else { if (IsValid(cclient)) { ANS_LOGIN_SUCCES.Send(cclient); cclient.ECrypt = new TCP.Encryption(cclient.SessionId); ANS_CHARACTER_INFO.Send(cclient); } else { ANS_LOGIN_FAILED.Send(cclient, (int)ResponseCodes.RC_LOGIN_INVALID_ACCOUNT); cclient.Disconnect(); } } return 0; }
public static void Login(Client client, PacketIn packet) { string user = packet.ReadString(); string pass = packet.ReadString(); ServerConsole.WriteLine("Login request from {0} on ip {1}.", MessageLevel.Message, user, client.IP.ToString()); client.UserLogin(user, pass); }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; Byte slotId = packet.GetUint8(); Character character = cclient.Characters.Get(slotId); if (character == null) Log.Error(cclient.Account.Email, "Wrong slot specified!"); World.World info = null; lock (Program.worldListener.Worlds) { Program.worldListener.Worlds.TryGetValue(character.WorldId, out info); } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (info == null) Out.WriteUInt32Reverse(1); else { info.Send(new AccountEnter(cclient.Account.Id, character.Id, cclient.SessionId)); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(info.IP1); Out.WriteByte(info.IP2); Out.WriteByte(info.IP3); Out.WriteByte(info.IP4); Out.WriteUInt16Reverse((UInt16)info.Port); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); } cclient.Send(Out); return 0; }
public static void EquipItem(Client client, PacketIn packet) { int itemId = (int)packet.ReadUInt32(); PlayerItem item = PlayerItem.Get(itemId); if(item == null) { ServerConsole.WriteLine( System.Drawing.Color.Red, "Player #{0} attempted to equip non-existant item!", client.Character.Player.PlayerId ); return; } if(item.PlayerId != client.Character.Player.PlayerId) { ServerConsole.WriteLine(System.Drawing.Color.Red, "Player #{0} attempted to equip item that belongs to #{1}!", client.Character.Player.PlayerId, item.PlayerId ); return; } if(!item.Wearable) { ServerConsole.WriteLine( System.Drawing.Color.Red, "Player #{0} attempted to equip non-equipable item #{1}!", item.PlayerId,item.ItemId ); return; } PlayerItem.Equip(item); client.Send(new Packets.EquipItem(item),"Equip Item"); }
public static void EndPlayerMove(Client client, PacketIn packet) { sbyte dx = packet.ReadSByte(); sbyte dy = packet.ReadSByte(); sbyte dz = packet.ReadSByte(); client.Character.MoveEnd(dx, dy, dz); }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; UInt32 WorldUid = packet.GetUint32Reversed(); string Name = packet.GetParsedString(); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK); if (Databases.CharacterTable.Count(c => c.Name == Name) == 0) { cclient.Pending = new CharacterEntry(); cclient.Pending.Index = Databases.CharacterTable.GenerateIndex(); cclient.Pending.AccountIndex = cclient.Account.Index; cclient.Pending.Name = Name; cclient.Pending.World = (int)WorldUid; cclient.Pending.Rank = 1; cclient.Pending.Money = 0; cclient.Pending.Threat = 1; cclient.Pending.Playtime = 0; cclient.Pending.Clan = "APB-EMU"; cclient.Pending.IsOnline = 0; cclient.Pending.DistrictID = 0; cclient.Pending.DistrictType = 0; cclient.Pending.LFG = 0; cclient.Pending.IsGroupPublic = 0; cclient.Pending.GroupInvite = 0; cclient.Pending.GroupStatus = 0; Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); } else { cclient.Pending = default(CharacterEntry); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_CHARACTER_NAME_CHECK_IN_USE); } cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; Byte slotId = packet.GetUint8(); CharacterEntry character = Databases.CharacterTable.SingleOrDefault(c => c.AccountIndex == cclient.Account.Index && c.Slot == slotId); if (character.Index < 1) Log.Error(cclient.Account.Username, "Wrong slot specified!"); World.World info = null; lock (Program.worldListener.Worlds) { Program.worldListener.Worlds.TryGetValue((uint)character.World, out info); } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (info == null) Out.WriteUInt32Reverse(1); else { info.Send(new AccountEnter((uint)cclient.Account.Index, (uint)character.Index, cclient.SessionId)); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(info.IP1); Out.WriteByte(info.IP2); Out.WriteByte(info.IP3); Out.WriteByte(info.IP4); Out.WriteUInt16Reverse((UInt16)info.Port); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); } cclient.Send(Out); return 0; }
public static void DropItem(Client client, PacketIn packet) { int itemId = (int)packet.ReadUInt32(); PlayerItem item = PlayerItem.Get(itemId); int quantity = (int)packet.ReadUInt32(); if(item == null) { ServerConsole.WriteLine( "Player #{0} attempted to drop non-existant item #{1} !", client.Character.Player.PlayerId, itemId ); return; } if(item.PlayerId != client.Character.Player.PlayerId) { ServerConsole.WriteLine( "Player #{0} attempted to drop item that belongs to #{1}!", client.Character.Player.PlayerId, item.PlayerId ); return; } uint worldId = World.NewId(); Server.WorldDrops[worldId] = new Drop(item,client.Character,quantity,worldId); client.Send(new Packets.SpawnDrop(Server.WorldDrops[worldId]),"Spawn Drop"); client.Send(new Packets.RemoveFromInventory(item.ItemId,quantity),"Update Inventory"); client.Character.Player.Inventory.Items.Remove(item); }
public static void LearnSkill(Client client, PacketIn packet) { byte skillId = packet.ReadByte(); if(client.Character.Player.SkillPoints >= 1) { if(!client.Character.Skills.ContainsKey(skillId)) { using(ISession session = Server.Factory.OpenSession()) { PlayerSkill skill = new PlayerSkill(); skill.Level = 1; skill.PlayerId = client.Character.Player.PlayerId; skill.SkillIndex = (int)skillId; client.Character.Skills[skillId] = skill; client.Send(new Packets.SkillSet(skillId,(byte)1)); using(ITransaction transaction = session.BeginTransaction()) { session.Save(skill); transaction.Commit(); } } client.Character.Player.SkillPoints--; client.Send(new Packets.ValueChange(0x18,(byte)client.Character.Player.SkillPoints)); } } }
public static void BuyNpcItem(Client client, PacketIn packet) { int npcWorldId = (int)packet.ReadUInt32(); byte v1 = packet.ReadByte(); byte amount = packet.ReadByte(); int totalPrice = 0; ushort[] items = new ushort[amount]; ushort[] amounts = new ushort[amount]; for(int i=0;i<amount;i++) { items[i] = packet.ReadUShort(); amounts[i] = packet.ReadUShort(); // TODO, calculate correct price totalPrice += 100 * amounts[i]; } // TODO, add geon amount check for(int i=0;i<amount;i++) { // should be items, not player items PlayerItem item = PlayerItem.Get((int)items[i]); client.Character.Player.Inventory.Items.Add(item); // update AddToInventory with generic item-object client.Send(new Packets.AddToInventory((int)items[i],(int)amounts[i]),"Buy Item"); // update amout of geons ! } }
public static void SkillRequest(Client client,PacketIn packet) { byte skillId = packet.ReadByte(); uint playerId = packet.ReadUInt32(); client.SkillHandler.Request(skillId,playerId); client.Send(new Packets.SkillExecute(client.Character,skillId,1)); }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; cclient.Characters.Delete(packet.GetUint8()); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_DELETE); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); cclient.Send(Out); return 0; }
public static void PlayerChange(Client client, PacketIn packet) { byte b = packet.ReadByte(); if(b == 1) { client.Send(new Packets.AcceptChange()); client.UnspawnPlayer(); client.SendPlayerList(); return; } }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; UInt32 whisperuid = packet.GetUint32Reversed(); String charname = packet.GetParsedString(); String message = packet.GetParsedString(); (client as WorldClient).Send(new ANS_CHAT_WHISPER(cclient, whisperuid, charname, message)); //cclient.Send(new CHAT_WHISPER(cclient.CharacterId, 1, message)); return 0; }
public PacketIn Decrypt(PacketIn packet) { byte[] data = packet.ToArray(); decryption.Process(data, 4, data.Length - 4); PacketIn result = new PacketIn(data, 0, data.Length); result.Size = result.GetUint32Reversed(); result.Opcode = result.GetUint32Reversed(); Log.Info("[CLIENT POST-ENCRYPT]", this.DumpData(data)); return result; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte FileId = packet.GetUint8(); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_LOAD); Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); Out.WriteByte(FileId); byte[] Result = ZlibMgr.Compress(Program.FileMgr.GetFileByte((int)cclient.Account.Id, FileId, true, "", "")); cclient.Send(Out); return 0; }
public static void NpcTalk(Client client, PacketIn packet) { Npc npc = Server.WorldNPCs[packet.ReadUInt32()]; if(npc != null) { if(npc.Talk != 0) { //ServerConsole.WriteLine("Talking with npc #{0} returning Talk #{1}",npc.NpcId,npc.Talk); client.Send(new Packets.OpenDialog(npc.Talk)); } } }
public PacketIn Decrypt(PacketIn packet) { byte[] data = packet.ToArray(); decryption.Process(data, 4, data.Length - 4); PacketIn result = new PacketIn(data, 0, data.Length); result.Size = result.GetUint32Reversed(); result.Opcode = result.GetUint32Reversed(); Console.Write("Dcrptd:"); for (int i = 0; i < result.ToArray().Length; i++) Console.Write(" "+ result.ToArray()[i]); Console.WriteLine(); return result; }
public static void SkillExecute(Client client, PacketIn packet) { byte skillId = packet.ReadByte(); byte skillLvl = packet.ReadByte(); client.SkillHandler.Execute(skillId,skillLvl); if(packet.PacketSize < 9) { client.Send(new Packets.SkillExecute(client.Character,skillId,skillLvl)); return; } }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; cclient.Character.IsOnline = 0; cclient.Character.LFG = 0; cclient.Character.DistrictID = 0; cclient.Character.DistrictType = 0; cclient.Character.GroupInvite = 0; cclient.Character.GroupStatus = 0; cclient.Character.IsGroupPublic = 0; Databases.CharacterTable.Update(cclient.Character); PacketOut Out = new PacketOut((UInt32)Opcodes.LOGOUT); cclient.Send(Out); cclient.Disconnect(); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; UInt32 accountId = packet.GetUint32Reversed(); Log.Debug("AskWorldEnter", "New client! Account = " + accountId); cclient.Account = Databases.AccountTable.SingleOrDefault(a => a.Index == accountId); cclient.Character = Databases.CharacterTable.SingleOrDefault(c => c.AccountIndex == accountId); lock (Program.expectingAccounts) { Program.expectingAccounts.TryGetValue(accountId, out cclient.account); } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (cclient.account == null) Out.WriteInt32Reverse((int)ResponseCodes.RC_FAILED); else { Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); Out.WriteUInt32Reverse(cclient.account.Character); Out.WriteUInt32Reverse((uint)cclient.Account.RTW_Points); Out.WriteByte(cclient.Account.IsAdmin); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); Out.WriteFloat(5.00f); Out.WriteByte(0); Out.WriteByte(0); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 1, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 2, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 3, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 4, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 5, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteByte(1); Out.WriteByte(cclient.Character.LFG); } cclient.Crypto = new TCP.Encryption(cclient.account.SessionId); cclient.Send(new DISTRICT_LIST()); cclient.Send(Out); lock (Program.expectingAccounts) { foreach (KeyValuePair<uint, Acc> a in Program.expectingAccounts) { if (a.Value == cclient.account) { Program.expectingAccounts.Remove(a.Key); break; } } } return 0; }
public static void SpawnPlayer(Client Client, PacketIn packet) { if(Client.Authenticated) { ServerWorld.AddEntity(Client.Character); Client.Send(new Packets.SendSkills(Client.Character.Player)); if(Client.Character.Inventory.Items.Count > 0) { Client.Send(new Packets.SendInventory(Client.Character.Inventory)); } else { Client.Send(new Packets.LoginAccepted()); } Client.Send(new Packets.SpawnPlayer(Client.Character, true)); } }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte FileId = packet.GetUint8(); UInt32 Version = packet.GetUint32Reversed(); byte[] File = new byte[packet.Length - packet.Position]; packet.Read(File, 0, File.Length); File = ZlibMgr.Decompress(File); Log.Debug("ConfigSave", "Config saved! FileId = " + FileId + " | Version = " + Version + " | Size = " + File.Length); Program.FileMgr.SaveInfo((int)cclient.Account.Index, FileId, File); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_SAVE); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(FileId); Out.Write(File, 0, File.Length); cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; MySqlCommand cmd = new MySqlCommand("DELETE FROM `clientstatus` WHERE `name` = @name", WorldServer.Database.Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@name", cclient.Name); cmd.ExecuteNonQuery(); } catch (MySqlException e) { Log.Error("MySQL", e.ToString()); } finally { cmd.Dispose(); } PacketOut Out = new PacketOut((UInt32)Opcodes.LOGOUT); cclient.Send(Out); cclient.Disconnect(); return 0; }
public PacketIn Decrypt(PacketIn packet) { byte[] data = packet.ToArray(); decryption.Process(data, 4, data.Length - 4); PacketIn result = new PacketIn(data, 0, data.Length); result.Size = result.GetUint32Reversed(); result.Opcode = result.GetUint32Reversed(); /* Console.Write("Dcrptd: "); for (int i = 0; i < result.ToArray().Length; i++) Console.Write(" "+ result.ToArray()[i]); Console.WriteLine(); */ Log.Info("[CLIENT POST-ENCRYPT]", this.DumpData(data)); return result; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; Byte slot = packet.GetUint8(); foreach(CharacterEntry ch in cclient.Characters) { if(ch.Slot == slot) { cclient.Characters.Remove(ch); Databases.CharacterTable.Remove(ch); break; } } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_DELETE); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); cclient.Send(Out); return 0; }
/// <summary> /// Callback method for async sends /// </summary> /// <param name="ar"></param> private static void AsyncTcpSendCallback(object sender, SocketAsyncEventArgs e) { StreamProcessor proc = (StreamProcessor)e.UserToken; BaseClient client = proc.m_client; try { Queue q = proc.m_tcpQueue; if (q == null || !client.Socket.Connected) { return; } int sent = e.BytesTransferred; byte[] data = proc.m_tcpSendBuffer; int count = 0; if (sent != e.Count) { //log.Error("Count:" + e.Count + ",sent:" + sent + ",offset:" + e.Offset + ",m_sendBufferLength:" + proc.m_sendBufferLength + ",client:" + client.TcpEndpoint); if (proc.m_sendBufferLength > sent) { count = proc.m_sendBufferLength - sent; Array.Copy(data, sent, data, 0, count); } } e.SetBuffer(0, 0); int firstOffset = proc.m_firstPkgOffset; lock (q.SyncRoot) { if (q.Count > 0) { do { PacketIn pak = (PacketIn)q.Peek(); int len = 0; if (client.Encryted) { int key = proc.send_fsm.getState(); //len = pak.CopyTo(data, count, firstOffset,key); len = pak.CopyTo3(data, count, firstOffset, client.SEND_KEY, ref client.numPacketProcces); //if (pak.m_sended == 0) //{ // log.Info("KeySendKey" + PrintArray(client.SEND_KEY)); // log.Info("Packet" + PrintArray(data, count, 8)); // log.Info(""); //} } else { len = pak.CopyTo(data, count, firstOffset); } firstOffset += len; count += len; if (pak.Length <= firstOffset) { q.Dequeue(); firstOffset = 0; if (client.Encryted) { proc.send_fsm.UpdateState(); // log.Info("Update KEy"); //client.numPacketProcces+=1; pak.isSended = true; } } if (data.Length == count) { //pak.isSended = true; break; } } while (q.Count > 0); } proc.m_firstPkgOffset = firstOffset; if (count <= 0) { proc.m_sendingTcp = false; return; } } proc.m_sendBufferLength = count; e.SetBuffer(0, count); if (client.SendAsync(e) == false) { AsyncTcpSendCallback(sender, e); } } catch (Exception ex) { log.Error("AsyncTcpSendCallback", ex); log.WarnFormat("It seems <{0}> went linkdead. Closing connection. (SendTCP, {1}: {2})", client, ex.GetType(), ex.Message); client.Disconnect(); } }
public static void F_INIT_PLAYER(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; Player Plr = cclient.Plr; if (Plr == null) { return; } // clear all lockouts if they are expired InstanceService.ClearLockouts(Plr); if (!Plr.IsInWorld()) // If the player is not on a map, then we add it to the map { ushort zoneId = Plr.Info.Value.ZoneId; ushort regionId = (ushort)Plr.Info.Value.RegionId; Zone_Info info = ZoneService.GetZone_Info(zoneId); if (info?.Type == 0) { RegionMgr region = WorldMgr.GetRegion(regionId, true); if (region.AddObject(Plr, zoneId, true)) { return; } } else if (info?.Type == 4 || info?.Type == 5 || info?.Type == 6) // login into a instance results in teleport outside { if (InstanceService._InstanceInfo.TryGetValue(zoneId, out Instance_Info II)) { Zone_jump ExitJump = null; if (Plr.Realm == Realms.REALMS_REALM_ORDER) { ExitJump = ZoneService.GetZoneJump(II.OrderExitZoneJumpID); } else if (Plr.Realm == Realms.REALMS_REALM_DESTRUCTION) { ExitJump = ZoneService.GetZoneJump(II.DestrExitZoneJumpID); } if (ExitJump == null) { Log.Error("Exit Jump in Instance", " " + zoneId + " missing!"); } else { Plr.Teleport(ExitJump.ZoneID, ExitJump.WorldX, ExitJump.WorldY, ExitJump.WorldZ, ExitJump.WorldO); } } return; } // Warp a player to their bind point if they attempt to load into a scenario map. RallyPoint rallyPoint = RallyPointService.GetRallyPoint(Plr.Info.Value.RallyPoint); if (rallyPoint != null) { Plr.Teleport(rallyPoint.ZoneID, rallyPoint.WorldX, rallyPoint.WorldY, rallyPoint.WorldZ, rallyPoint.WorldO); } else { CharacterInfo cInfo = CharMgr.GetCharacterInfo(Plr.Info.Career); Plr.Teleport(cInfo.ZoneId, (uint)cInfo.WorldX, (uint)cInfo.WorldY, (ushort)cInfo.WorldZ, (ushort)cInfo.WorldO); } } else { Plr.Loaded = false; Plr.StartInit(); } }
public void MailInteract(MailInteractType type, uint guid, PacketIn packet) { lock (_lockObject) { Character_mail mail = _mails.FirstOrDefault(match => match.Guid == guid); if (mail == null) { return; } switch (type) { case MailInteractType.OpenMail: if (!mail.Opened) { if (mail.ReadDate == 0) { mail.ReadDate = (uint)TCPManager.GetTimeStamp(); } mail.Opened = true; SendMailCount(); SendMailBox(); } SendMail(mail); break; case MailInteractType.ReturnMail: SendResult(ReturnMail(mail)); SendMailCount(); SendMailBox(); break; case MailInteractType.DeleteMail: CharMgr.DeleteMail(mail); SendMailCount(); SendMailBox(); break; case MailInteractType.ChangeReadMarker: packet.Skip(4); mail.Opened = packet.GetUint8() == 1; SendMailCount(); SendMailBox(); break; case MailInteractType.TakeItem: if (mail.Cr && mail.Money > 0) { if (!_Owner.GetPlayer().RemoveMoney(mail.Money)) { _Owner.GetPlayer().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_AUCTION_NOT_ENOUGH_MONEY); return; } MailHandlers.SendCOD(mail.SenderName, _Owner.GetPlayer(), mail.Money); mail.Money = 0; } packet.Skip(4); byte itemnum = packet.GetUint8(); if (mail.Items.Count < itemnum + 1) { return; } MailItem item = mail.Items.ElementAt(itemnum); ushort freeSlot = _Owner.GetPlayer().ItmInterface.GetFreeInventorySlot(ItemService.GetItem_Info(item.id), false); if (freeSlot == 0) { _Owner.GetPlayer().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS); return; } _Owner.GetPlayer().ItmInterface.CreateItem(ItemService.GetItem_Info(item.id), item.count, item.talisman, item.primary_dye, item.secondary_dye, false); mail.Items.Remove(item); mail.Dirty = true; CharMgr.Database.SaveObject(mail); SendMailUpdate(mail); SendMail(mail); break; case MailInteractType.TakeAll: if (mail.Money > 0) { if (mail.Cr) { if (!_Owner.GetPlayer().RemoveMoney(mail.Money)) { _Owner.GetPlayer().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_AUCTION_NOT_ENOUGH_MONEY); return; } MailHandlers.SendCOD(mail.SenderName, _Owner.GetPlayer(), mail.Money); } else { _Owner.GetPlayer().AddMoney(mail.Money); } mail.Money = 0; } // Take as many items as you can before inventory is full List <MailItem> toRemove = new List <MailItem>(); foreach (MailItem curritem in mail.Items) { ushort slot = _Owner.GetPlayer().ItmInterface.GetFreeInventorySlot(ItemService.GetItem_Info(curritem.id)); if (slot == 0) { _Owner.GetPlayer().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS); break; } _Owner.GetPlayer().ItmInterface.CreateItem(ItemService.GetItem_Info(curritem.id), curritem.count, curritem.talisman, curritem.primary_dye, curritem.secondary_dye, false); toRemove.Add(curritem); } foreach (MailItem remove in toRemove) { mail.Items.Remove(remove); } mail.Dirty = true; CharMgr.Database.SaveObject(mail); SendMailUpdate(mail); SendMail(mail); break; } } }
/// <summary> /// Using a Saving/Moving scroll. /// </summary> /// <param name="client"></param> /// <param name="packet"></param> public static void SetPlayerTeleport(Client client, PacketIn packet) { Utilities.DumpUnusedPacket("PT_Method", packet); }
public static void F_GROUP_COMMAND(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player player = cclient.Plr; Group worldGroup = cclient.Plr.WorldGroup; uint groupId = 0; bool isLeader = false; if (worldGroup != null) { lock (worldGroup) { if (worldGroup != null) { if (worldGroup._warbandHandler != null) { lock (worldGroup._warbandHandler) { if (worldGroup._warbandHandler != null) { groupId = worldGroup._warbandHandler.ZeroIndexGroupId; isLeader = worldGroup._warbandHandler.Leader == player; } } } else { groupId = worldGroup.GroupId; isLeader = worldGroup.Leader == player; } } } } packet.Skip(3); // unk byte subGroup = packet.GetUint8(); byte state = packet.GetUint8(); switch (state) { case 2: // Accept invitation player.GrpInterface.AcceptInvitation(); break; case 6: // Decline invitation player.GrpInterface.RejectInvitation(); break; case 3: // Leave group if (groupId != 0) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.PlayerLeave, player)); } break; case 4: // loot roundrobin if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeLootOption, player, subGroup.ToString())); } break; case 5: // Set master looter Player newMasterLooter; lock (Player._Players) Player.PlayersByCharId.TryGetValue(subGroup, out newMasterLooter); if (newMasterLooter != null) { if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeMasterLooter, player, newMasterLooter.Name)); } } break; case 10: // switch leader Player newLeader; lock (Player._Players) Player.PlayersByCharId.TryGetValue(subGroup, out newLeader); if (newLeader != null) { if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeLeader, cclient.Plr, newLeader.Name)); } } break; case 12: if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeNeedOnUse, player)); } break; case 13: player.ScnInterface.Scenario.AddPlayerToGroup(player, subGroup); break; case 14: player.ScnInterface.Scenario.RemovePlayerFromGroup(player); break; case 15: // Warband invitation acceptance player.GrpInterface.AcceptInvitation(); break; case 16: // Warband invitation rejection player.GrpInterface.RejectInvitation(); break; case 17: // Make set mainassist Player newMainAssist; lock (Player._Players) Player.PlayersByCharId.TryGetValue(subGroup, out newMainAssist); if (newMainAssist != null) { if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeMainAssist, player, newMainAssist.Name)); } } break; case 18: // autolootinrvr if (groupId != 0) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeAutoLoot, player)); } break; default: Log.Error("GroupHandler", "Unsupported type: " + state); break; } }
public static void F_ZONEJUMP(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (cclient.Plr == null || !cclient.Plr.IsInWorld()) { return; } //Log.Dump("Jump", packet, true); uint destinationId = packet.GetUint32(); byte responseType = packet.GetUint8(); //Log.Info("Jump", "Jump to :" + Id); if (cclient.Plr.Zone.Info.Type == 1) { if (responseType == 0) { cclient.Plr.SendDialog(Dialog.ScenarioLeave, 586); } else { Scenario sc = cclient.Plr.ScnInterface.Scenario; if (sc == null) { cclient.Plr.SendClientMessage("No active scenario.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); } else { sc.EnqueueScenarioAction(new ScenarioQueueAction(EScenarioQueueAction.RemovePlayer, cclient.Plr)); } } return; } Zone_jump Jump = null; // ZARU: zone jump out hackaround for LV leave if (destinationId == 272804328) { Instance_Info II; InstanceService._InstanceInfo.TryGetValue(260, out II); if (cclient.Plr.Realm == Realms.REALMS_REALM_ORDER) { Jump = ZoneService.GetZoneJump(II.OrderExitZoneJumpID); } else if (cclient.Plr.Realm == Realms.REALMS_REALM_DESTRUCTION) { Jump = ZoneService.GetZoneJump(II.DestrExitZoneJumpID); } if (Jump == null) { Jump = ZoneService.GetZoneJump(destinationId); } } else { Jump = ZoneService.GetZoneJump(destinationId); } if (Jump == null) { cclient.Plr.SendClientMessage("This portal's jump destination (" + destinationId + ") does not exist."); SendJumpFailed(cclient.Plr); return; } if (cclient.Plr.GmLevel > 0) { cclient.Plr.SendClientMessage("Portal Id: " + destinationId); } if (cclient.Plr.CbtInterface.IsInCombat) { cclient.Plr.SendClientMessage("You can't use a portal while in combat." + destinationId); cclient.Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_PLAYER_REGION_NOT_AVAILABLE); SendJumpFailed(cclient.Plr); return; } if (Jump.Type == 1 && cclient.Plr.WorldGroup == null) { cclient.Plr.SendClientMessage("You must be a member of a group in order to use this portal." + destinationId); cclient.Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_PLAYER_REGION_NOT_AVAILABLE); SendJumpFailed(cclient.Plr); return; } if (Jump.Type == 2 && cclient.Plr.Level < 30) { cclient.Plr.SendClientMessage("A Career Rank of 30 is required to use this portal." + destinationId); cclient.Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_PLAYER_REGION_NOT_AVAILABLE); SendJumpFailed(cclient.Plr); return; } if (Jump.Type == 3 && cclient.Plr.GldInterface.GetGuildLevel() < 6) { cclient.Plr.SendClientMessage("A Guild Rank of 6 is required to use this portal." + destinationId); cclient.Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_PLAYER_REGION_NOT_AVAILABLE); SendJumpFailed(cclient.Plr); return; } if (Jump.Type >= 4 && Jump.Type <= 6) { if (!WorldMgr.InstanceMgr.ZoneIn(cclient.Plr, Jump.Type, Jump)) { ; } SendJumpFailed(cclient.Plr); return; } if (Jump.Enabled || cclient.Plr.GmLevel > 1) { cclient.Plr.Teleport(Jump.ZoneID, Jump.WorldX, Jump.WorldY, Jump.WorldZ, Jump.WorldO); } else { cclient.Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_PLAYER_REGION_NOT_AVAILABLE); SendJumpFailed(cclient.Plr); } }
public void HandleTrade(PacketIn packet) { TradingUpdated = false; byte Status = packet.GetUint8(); byte Unk = packet.GetUint8(); UInt16 Oid = packet.GetUint16(); if (!_Owner.IsInWorld()) { return; } if (!_Owner.IsPlayer()) { return; } Player Plr = _Owner.GetPlayer(); if (Oid <= 0) { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_NO_TARGET); SendTradeClose(Oid); return; } if (Oid == _Owner.Oid) { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_CANT_TRADE_WITH_YOURSELF); SendTradeClose(Oid); return; } Log.Success("HandleTrade", "Status=" + Status + ",Oid=" + Oid); Trading = Plr.Region.GetPlayer(Oid); if (Trading == null) { SendTradeClose(Oid); return; } if (Status == 0 && TradingAccepted == 0) // Nouveau Trade { if (!CanTrading(Trading)) { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_TARGET_ALREADY_TRADING); CloseTrade(); return; } SendTradeInfo(this); Trading.ItmInterface.SendTradeInfo(this); TradingAccepted = 1; } else if (Status == 1 && IsTrading()) // Trade mis a jours { uint Money = packet.GetUint32(); byte Update = packet.GetUint8(); byte ItemCounts = packet.GetUint8(); //Log.Info("Trade", "Money=" + Money + ",Update=" + Update + ",Items=" + ItemCounts); Trading.ItmInterface.TradingAccepted = 1; TradingAccepted = 1; TradingMoney = Money; if (TradingMoney > Plr.GetMoney()) { TradingMoney = Plr.GetMoney(); Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_INSUFFICIENT_MONEY); SendTradeInfo(this); Trading.ItmInterface.SendTradeInfo(this); return; } SendTradeInfo(Trading.ItmInterface); Trading.ItmInterface.SendTradeInfo(this); } else if (Status == 2 && IsTrading()) // J'accept le trade { TradingAccepted = 2; Trading.ItmInterface.SendTradeInfo(this); if (TradingAccepted == 2 && Trading.ItmInterface.TradingAccepted == 2) { Trade(Trading.ItmInterface); } } else if (Status == 3 && IsTrading()) // Je Ferme le Trade { Trading.ItmInterface.SendTradeClose(_Owner.Oid); SendTradeClose(Oid); } }
static public void F_QUEST(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; UInt16 QuestID = packet.GetUint16(); UInt16 State = packet.GetUint16(); UInt16 Unk1 = packet.GetUint16(); byte Unk2 = packet.GetUint8(); byte Unk3 = packet.GetUint8(); UInt16 Unk4 = packet.GetUint16(); UInt16 CreatureOID = packet.GetUint16(); Creature Crea = cclient.Plr.Region.GetObject(CreatureOID) as Creature; if (Crea == null) { return; } switch (State) { case 1: // Show Quest { Log.Info("F_QUEST", "Show Quest : " + QuestID); if (Crea.QtsInterface.HasQuestStarter(QuestID)) { Crea.QtsInterface.BuildQuest(QuestID, cclient.Plr); } } break; case 2: // Accept Quest { Log.Info("F_QUEST", "Accept Quest : " + QuestID); if (Crea.QtsInterface.HasQuestStarter(QuestID)) { if (cclient.Plr.QtsInterface.AcceptQuest(QuestID)) { if (!Crea.QtsInterface.CreatureHasStartQuest(cclient.Plr)) { Crea.SendRemove(cclient.Plr); Crea.SendMeTo(cclient.Plr); } } } } break; case 3: // Quest Done { if (Crea.QtsInterface.hasQuestFinisher(QuestID)) { Log.Info("F_QUEST", "Done Quest : " + QuestID); if (cclient.Plr.QtsInterface.DoneQuest(QuestID)) { Crea.SendRemove(cclient.Plr); Crea.SendMeTo(cclient.Plr); } else { Crea.QtsInterface.BuildQuest(QuestID, cclient.Plr); } } } break; case 4: // Quest Done Info { if (Crea.QtsInterface.hasQuestFinisher(QuestID)) { Crea.QtsInterface.SendQuestDoneInfo(cclient.Plr, QuestID); } else if (Crea.QtsInterface.HasQuestStarter(QuestID)) { Log.Info("F_QUEST", "InProgress Quest : " + QuestID); Crea.QtsInterface.SendQuestInProgressInfo(cclient.Plr, QuestID); } } break; case 5: // Select Quest Reward { Log.Info("F_QUEST", "Select Quest Reward: " + QuestID); if (Crea.QtsInterface.hasQuestFinisher(QuestID)) { cclient.Plr.QtsInterface.SelectRewards(QuestID, Unk3); } } break; } ; }
public static void PlayersInSight(Client client, PacketIn packet) { Utilities.DumpUnusedPacket("PT_PlayersInSight", packet); }
static public void CMSG_MetricEventNotify(BaseClient client, PacketIn packet) { //do nothing }
public static void ToggleShop(Client client, PacketIn packet) { Utilities.DumpUnusedPacket("PT_ToggleShop", packet); }
public static void RemoveShopItem(Client client, PacketIn packet) { Utilities.DumpUnusedPacket("PT_RemoveShopItem", packet); }
public void BuildMail(PacketIn packet) { Player Plr = GetPlayer(); if (Plr == null) { return; } if (nextSend >= TCPServer.GetTimeStamp()) { SendResult(GameData.MailResult.TEXT_MAIL_RESULT6); return; } // Recipient read packet.Skip(1); byte NameSize = packet.GetUint8(); string Name = packet.GetString(NameSize); Character Receiver = CharMgr.GetCharacter(Name); if (Receiver == null || Receiver.Realm != (byte)Plr.Realm) { SendResult(GameData.MailResult.TEXT_MAIL_RESULT7); return; } if (Receiver.Name == Plr.Name) // You cannot mail yourself { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_PLAYER_CANT_MAIL_YOURSELF); return; } // Subject byte SubjectSize = packet.GetUint8(); packet.Skip(1); string Subject = packet.GetString(SubjectSize); // Message byte MessageSize = packet.GetUint8(); packet.Skip(1); string Message = packet.GetString(MessageSize); // Money UInt32 money = ByteOperations.ByteSwap.Swap(packet.GetUint32()); // COD? byte cr = packet.GetUint8(); // Item byte itemcounts = packet.GetUint8(); if (!Plr.RemoveMoney((cr == 0 ? money : 0) + MAIL_PRICE)) { SendResult(MailResult.TEXT_MAIL_RESULT8); return; } // Make a Mail Character_mail CMail = new Character_mail(); CMail.Guid = CharMgr.GenerateMailGUID(); CMail.CharacterId = Receiver.CharacterId; CMail.CharacterIdSender = Plr._Info.CharacterId; CMail.SenderName = Plr._Info.Name; CMail.ReceiverName = Name; CMail.SendDate = (uint)TCPManager.GetTimeStamp(); CMail.Title = Subject; CMail.Content = Message; CMail.Money = money; CMail.Cr = true; CMail.Opened = false; Log.Debug("Mail", "Itemcount: " + itemcounts + ""); for (byte i = 0; i < itemcounts; ++i) { UInt16 itmslot = ByteOperations.ByteSwap.Swap(packet.GetUint16()); packet.Skip(2); ByteOperations.ByteSwap.Swap(itmslot); Item itm = Plr.ItmInterface.GetItemInSlot(itmslot); if (itm != null) { CMail.Items.Add(new KeyValuePair <uint, ushort>(itm.Info.Entry, itm.CharItem.Counts)); Plr.ItmInterface.DeleteItem(itmslot, itm.CharItem.Counts, true); itm.Owner = null; } } SendResult(MailResult.TEXT_MAIL_RESULT4); CharMgr.Database.AddObject(CMail); //If player exists let them know they have mail. Player mailToPlayer = Player.GetPlayer(Name); if (mailToPlayer != null) { mailToPlayer.MlInterface.AddMail(CMail); } nextSend = (uint)TCPServer.GetTimeStamp() + 5; }
public static void BankAdd(Client client, PacketIn packet) { Utils.DumpUnusedPacket("PT_BankAdd", packet); }
public static void BankRetrieve(Client client, PacketIn packet) { Utils.DumpUnusedPacket("PT_BankRetrieve", packet); }
public ParsedUpdatePacket(PacketIn packet) : this(GetBytes(packet), false) { }
public int HandlePacket(BaseClient client, PacketIn packet) { SendDistrictEnter((WorldClient)client); return(0); }
protected override void OnReceive(byte[] packetBuffer) { // Wrap the input stream in a PacketIn Log.Debug("HandlePacket", $"Packet...{packetBuffer.Length}"); PacketIn inStream = new PacketIn(packetBuffer, 0, packetBuffer.Length, true, true); lock (this) { long bufferLength = inStream.Length; while (bufferLength > 0) { // Read the header if (!ReadingData) { if (bufferLength < 2) { Log.Debug("OnReceive", "Invalid header (buffer length " + bufferLength + ")"); return; } _packetSize = inStream.GetUint16(); bufferLength -= 2; if (bufferLength < _packetSize + 10) { return; } inStream.Size = (ulong)_packetSize + 10; Decrypt(inStream); SequenceID = inStream.GetUint16(); SessionID = inStream.GetUint16(); Unk1 = inStream.GetUint16(); Unk2 = inStream.GetUint8(); _opcode = inStream.GetUint8(); bufferLength -= 8; #if DEBUG if (bufferLength > _packetSize + 2) { Log.Debug("OnReceive", "Packet contains multiple opcodes " + bufferLength + ">" + (_packetSize + 2)); } #endif ReadingData = true; } else { ReadingData = false; if (bufferLength >= _packetSize + 2) { byte[] bPack = new byte[_packetSize + 2]; inStream.Read(bPack, 0, (int)(_packetSize + 2)); PacketIn packet = new PacketIn(bPack, 0, bPack.Length) { Opcode = _opcode, Size = (ulong)_packetSize }; if (PacketLog) { LogInPacket(packet); } PLogBuf.Enqueue(packet); if (Plr != null && Plr.IsInWorld()) { Plr.ReceivePacket(packet); } else { Server.HandlePacket(this, packet); } Log.Tcp("PacketSize", bPack, 0, bPack.Length); bufferLength -= _packetSize + 2; } else { Log.Error("OnReceive", "Packet size smaller than total received bytes: " + bufferLength + "<" + (_packetSize + 2)); break; } } } } }
public static void SetStats(Client client, PacketIn packet) { int start; byte value; switch (packet.ReadByte()) { // Strength case 0: { start = (client.Character.Player.ClassId == 0) ? 60 : 50; value = client.Character.Stats.Strength; _UpdateStats(client, start, value); client.Character.Stats.Strength += 1; client.Send(new Packets.StatPacket.Strength(client.Character.Stats)); break; } // Health case 1: { start = 50; value = client.Character.Stats.Health; _UpdateStats(client, start, value); client.Character.Stats.Health += 1; client.Send(new Packets.StatPacket.Health(client.Character.Stats)); break; } // Intelligence case 2: { start = (client.Character.Player.ClassId == 1) ? 60 : 50; value = client.Character.Stats.Intelligence; _UpdateStats(client, start, value); client.Character.Stats.Intelligence += 1; client.Send(new Packets.StatPacket.Intelligence(client.Character.Stats)); break; } // Wisdom case 3: { start = 50; value = client.Character.Stats.Wisdom; _UpdateStats(client, start, value); client.Character.Stats.Wisdom += 1; client.Send(new Packets.StatPacket.Wisdom(client.Character.Stats)); break; } // Agility case 4: { start = (client.Character.Player.ClassId == 2) ? 60 : 50; value = client.Character.Stats.Agility; _UpdateStats(client, start, value); client.Character.Stats.Agility += 1; client.Send(new Packets.StatPacket.Agility(client.Character.Stats)); break; } } }
/// <summary> /// Generates a system information objet from the given packet. /// </summary> /// <param name="inPacket">contains the system information in a raw, serialized format</param> public static ClientInformation ReadFromPacket(PacketIn packet) { var info = new ClientInformation(packet); return(info); }
public static void ResetStats(Client client, PacketIn packet) { Utils.DumpUnusedPacket("PT_ResetStats", packet); }
public static void OnRequestPvP(Client client, PacketIn packet) { Utils.DumpUnusedPacket("PT_OnRequestPvP", packet); }
/// <summary> /// The function which is used to proceed an incoming packet to the active TCPConnection /// </summary> /// <param name="con">The connection which received the packet</param> /// <param name="buf">byte[] array containing the raw content of the received packet</param> /// <param name="start">Start of the content in buf, usually 0</param> /// <param name="size">Size of the packet (minus start)</param> /// <returns>PacketIn -> Converted raw package to MemoryStream based PacketIn</returns> public PacketIn ProcessPacket(TCPConnection con, byte[] buf, int start, int size) { PacketIn packet = new PacketIn(buf, start, size); switch (packet.ID) { case 0: // ResultMsg var res = new AUTH_PACKETS.RESULT(packet.ReadUInt16(), packet.ReadUInt16(), packet.ReadInt32()); if (res.nRequestPacket == 2005) { if (res.nResult == 0) { con.SendTCP(CreateReportPacket()); con.SendTCP(CreateCharacterListPacket()); } else { con.Disconnect(); XLog.Log("Can't connect to game server. Result: {0} - disconnecting...", res.nResult); } } break; case 2004: // CharacterList m_iGameCharacterList = new GAME_PACKETS.CharacterList(packet); XLog.Log("Character selection. Please use /use ID to select a character."); for (int i = 0; i < m_iGameCharacterList.nCount; i++) { XLog.Log("-> Character {0}: {1}", i + 1, m_iGameCharacterList.nList[i].szName); } break; case 21: // ChatLocal var tmp = packet.ReadInt32(); string szSource = m_dHandles.ContainsKey(tmp) ? m_dHandles[tmp] : "INVALID-HANDLE:" + tmp; int nLen = packet.ReadByte(); int nType = packet.ReadByte(); XLog.AddMessage(szSource, packet.ReadString(nLen), nType); break; case 22: // ChatMsg var pMessage = new GAME_PACKETS.ChatMessage(packet); XLog.AddMessage(pMessage.szName, pMessage.szMessage, pMessage.nType); break; case 3: // Enter: Handle -> Name, small hack so we don't have to read the full packet (which is f*****g large) if (packet.ReadByte() == 0) { int key = packet.ReadInt32(); if (m_dHandles.ContainsKey(key)) { m_dHandles.Remove(key); } packet.Seek(77, System.IO.SeekOrigin.Current); string value = packet.ReadString(19); m_dHandles.Add(key, value); } break; case 507: // Property: Own Name -> Handle if (m_dHandles.ContainsKey(0) && m_tPingThread == null) { var szName = m_dHandles[0]; m_dHandles.Remove(0); m_dHandles.Add(packet.ReadInt32(), szName); m_tPingThread = new System.Threading.Thread(new System.Threading.ThreadStart(SendPingPacket)); m_tPingThread.IsBackground = true; m_tPingThread.Start(); } break; default: break; } return(packet); }
public static void ViewAssassinList(Client client, PacketIn packet) { Utils.DumpUnusedPacket("PT_ViewAssassinList", packet); }
public void SendPacketMail(PacketIn packet) { Player plr = GetPlayer(); if (plr == null) { return; } if (_nextSend >= TCPManager.GetTimeStamp()) { SendResult(MailResult.TEXT_MAIL_RESULT6); return; } // Recipient read packet.Skip(1); byte nameSize = packet.GetUint8(); string name = packet.GetString(nameSize); Character receiver = CharMgr.GetCharacter(Player.AsCharacterName(name), false); if (receiver == null || receiver.Realm != (byte)plr.Realm) { SendResult(MailResult.TEXT_MAIL_RESULT7); return; } if (receiver.Name == plr.Name) // You cannot mail yourself { plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_PLAYER_CANT_MAIL_YOURSELF); return; } // Subject (client is limited to send 30 chars but its probably a ushort anyway) ushort subjectSize = ByteSwap.Swap(packet.GetUint16()); string subject = packet.GetString(subjectSize); // Message ushort messageSize = ByteSwap.Swap(packet.GetUint16()); string message = packet.GetString(messageSize); // Money uint money = ByteSwap.Swap(packet.GetUint32()); // COD? byte cr = packet.GetUint8(); // Item byte itemcounts = packet.GetUint8(); Log.Debug("Mail", "Itemcount: " + itemcounts + ""); List <ushort> itemSlots = new List <ushort>(); for (byte i = 0; i < itemcounts; ++i) { ushort itmslot = ByteSwap.Swap(packet.GetUint16()); packet.Skip(2); Item itm = plr.ItmInterface.GetItemInSlot(itmslot); if (itm == null || itm.Info == null) { SendResult(MailResult.TEXT_MAIL_RESULT16); return; } if (itm.BoundtoPlayer || itm.Info.Bind == 1) { SendResult(MailResult.TEXT_MAIL_RESULT9); return; } itemSlots.Add(itmslot); } if ((cr == 0 && !plr.HasMoney(money)) || !plr.RemoveMoney((cr == 0 ? money : 0) + MAIL_PRICE)) { SendResult(MailResult.TEXT_MAIL_RESULT8); return; } SendMail(receiver, subject, message, money, cr == 1, itemSlots); }
public static void Revive(Client client, PacketIn packet) { Utilities.DumpUnusedPacket("PT_Revive", packet); }
static public void F_MAIL(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player Plr = cclient.Plr; byte Type = packet.GetUint8(); switch (Type) { case 0: // Mailbox closed { } break; case 1: // Mail sent { Plr.MlInterface.BuildMail(packet); } break; case 2: // Open mail case 3: // Return mail case 4: // Delete mail case 5: // Mark as read/unread case 7: // Take Item case 8: // Take money { byte Page = packet.GetUint8(); UInt32 Guid = ByteOperations.ByteSwap.Swap(packet.GetUint32()); Character_mail Mail = Plr.MlInterface.GetMail(Guid); switch (Type) { case 2: if (!Mail.Opened) { Mail.Opened = true; CharMgr.SaveMail(Mail); Plr.MlInterface.SendMailCounts(); Plr.MlInterface.SendMailBox(); } Plr.MlInterface.SendMail(Mail); break; case 3: //TODO Plr.MlInterface.SendResult(GameData.MailResult.TEXT_MAIL_RESULT11); break; case 4: Plr.MlInterface.RemoveMail(Mail); Plr.MlInterface.SendMailCounts(); Plr.MlInterface.SendMailBox(); break; case 5: packet.Skip(4); Mail.Opened = (packet.GetUint8() == 1); CharMgr.SaveMail(Mail); Plr.MlInterface.SendMailCounts(); Plr.MlInterface.SendMailBox(); break; case 7: packet.Skip(4); byte itemnum = packet.GetUint8(); if (Mail.ItemsReqInfo.Count < itemnum + 1) { return; } UInt16 FreeSlot = Plr.ItmInterface.GetFreeInventorySlot(); if (FreeSlot == 0) { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS); return; } Character_items item = Mail.ItemsReqInfo.ElementAt(itemnum); Plr.ItmInterface.CreateItem(item.Entry, item.Counts); Mail.ItemsReqInfo.Remove(item); CharMgr.SaveMail(Mail); Plr.MlInterface.SendMailUpdate(Mail); Plr.MlInterface.SendMail(Mail); break; case 8: if (Mail.Money > 0) { Plr.AddMoney(Mail.Money); Mail.Money = 0; } // Take as many items as you can before inventory is full foreach (Character_items curritem in Mail.ItemsReqInfo.ToArray()) { UInt16 Slot = Plr.ItmInterface.GetFreeInventorySlot(); if (Slot == 0) { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS); break; } Plr.ItmInterface.CreateItem(curritem.Entry, curritem.Counts); Mail.ItemsReqInfo.Remove(curritem); } CharMgr.SaveMail(Mail); Plr.MlInterface.SendMailUpdate(Mail); Plr.MlInterface.SendMail(Mail); break; } } break; } }
public static void F_PLAYER_STATE2(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; Player player = cclient.Plr; if (player == null || !player.IsInWorld()) { return; } bool skipSend = false; long pos = packet.Position; //Comments below are for testing State2 //byte[] data = packet.ToArray(); PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2, (int)packet.Size + 1); //Out.Write(data, (int)packet.Position, (int)packet.Size); // instead of the line below for testing Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size); Out.WriteByte(0); /* #if DEBUG * State2 stateTest = new State2(); * stateTest.Read(data, data.Length); * Log.Info("state2.HasEnemyTarget", stateTest.HasEnemyTarget.ToString()); * Log.Info("state2.FreeFall", stateTest.FreeFall.ToString()); * Log.Info("state2.Falltime", stateTest.FallTime.ToString()); #endif */ //End of the testing of state2 packet.Position = pos; byte[] data = packet.ToArray(); // Experimental throttling if too many players in range. This can be overridden later if the position update's forced if (player.PlayersInRange.Count > 150 && TCPManager.GetTimeStampMS() - player.LastStateRecvTime < 200) { skipSend = true; } ushort currentHeading = player.Heading; if (packet.Size > 9 && packet.Size < 18) { long state = System.Net.IPAddress.NetworkToHostOrder(BitConverter.ToInt64(data, 2)); long state2 = System.Net.IPAddress.NetworkToHostOrder(BitConverter.ToInt64(data, 10)); ushort x = ((ushort)(((state2 >> 56 & 0x1) << 15) | ((state >> 0 & 0xFF) << 7) | ((state >> 9 & 0x7F)))); ushort y = ((ushort)(((state2 >> 40 & 0x1) << 15) | ((state2 >> 48 & 0xFF) << 7) | ((state2 >> 57 & 0x7F)))); ushort z = ((ushort)(((state2 >> 16 & 0x3) << 14) | ((state2 >> 24 & 0xFF) << 6) | ((state2 >> 34 & 0x3F)))); ushort direction = ((ushort)(((state >> 16 & 0x7F) << 5) | ((state >> 27 & 0x1F)))); ushort zoneID = ((byte)(((state2 >> 32 & 0x1) << 7) | ((state2 >> 41 & 0x7F)))); bool grounded = ((((state >> 8 & 0x1))) == 1); byte fallState = ((byte)(((state >> 40 & 0x1F)))); bool walking = ((((state >> 48 & 0x1))) == 1); bool moving = ((((state >> 49 & 0x1))) == 1); bool notMoving = ((((state >> 63 & 0x1))) == 1); byte groundtype = ((byte)(((state2 >> 82 & 0x1F)))); //Hack Zone ID should be ushort but we only read a byte if (cclient.Plr.ZoneId > 255) { zoneID = (ushort)Utils.setBit(zoneID, 8, true); } //hardcode to not allow players into gunbad in case we miss to invalidate the zone on push #if (!DEBUG) /* * if (zoneID == 60 && player.Client.IsPlaying()) * { * if (player.Realm == Realms.REALMS_REALM_DESTRUCTION) * player.Teleport(161, 439815, 134493, 16865, 0); * * else if (player.Realm == Realms.REALMS_REALM_ORDER) * player.Teleport(162, 124084, 130213, 12572, 0); * } */ if (zoneID == 111 && player.Client.IsPlaying()) { if (player.Realm == Realms.REALMS_REALM_DESTRUCTION) { player.Teleport(202, 1411789, 1454421, 3516, 0); } else if (player.Realm == Realms.REALMS_REALM_ORDER) { player.Teleport(202, 1449783, 1459746, 3549, 0); } } #endif //lets move players instantly, if they are in a void (even staff) if ((zoneID == 0 && player.ZoneId.HasValue) && player.Client.IsPlaying()) { player.SendClientMessage("You managed to go outside of the worlds boundries, as such you have been forcefully moved to your capital", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE); if (player.Realm == Realms.REALMS_REALM_DESTRUCTION) { player.Teleport(161, 439815, 134493, 16865, 0); } else if (player.Realm == Realms.REALMS_REALM_ORDER) { player.Teleport(162, 124084, 130213, 12572, 0); } } //stop players from getting stuck below the world like below IC if (player.Z < 150 && !player.IsDead && player.Client.IsPlaying()) { player.SendClientMessage("You have fallen through the floor, instead of falling and getting stuck somewhere you get terminated.", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE); player.Terminate(); } //player should not be able to cast while in the air. if (!grounded) { if (player.AbtInterface.GetAbiityProcessor() != null && player.AbtInterface.GetAbiityProcessor().HasInfo() && player.AbtInterface.GetAbiityProcessor().AbInfo.Entry != 8090 && player.AbtInterface.GetAbiityProcessor().AbInfo.Entry != 9393) { player.AbtInterface.Cancel(true); } } if (fallState != 31 || ((moving || walking || !notMoving || !grounded) && player.Speed > 0)) { player.IsMoving = true; } else { player.IsMoving = false; } if (!player.WasGrounded) { if (grounded) { player.CalculateFallDamage(); player.AirCount = -1; player.ForceSendPosition = true; } } player.WasGrounded = grounded; if (!grounded) { player.FallState = fallState; } // Throttle pure rotation updates. if (player.X == x && player.Y == y && player.Z == z && TCPManager.GetTimeStampMS() - player.LastStateRecvTime < 150) { if (player.AirCount == -1) { player.AirCount = 0; } else { skipSend = true; } } if (player.IsStaggered || player.IsDisabled) { direction = currentHeading; } player.SetPosition(x, y, z, direction, zoneID); player.GroundType = (GROUNDTYPE)groundtype; //solid, exclude any zones that has to use a hardcode lava to not disable the damage instantly if (groundtype == 0) { //release lava damage if (_lavaBuffs.ContainsKey(player) && (zoneID != 190 || zoneID != 197)) { _lavaBuffs[player].BuffHasExpired = true; _lavaBuffs.Remove(player); } } //shallow water 1, have no use for it atm, shallow sludge 7 /* * if (groundtype == 1 || groundtype == 7) * { * * }*/ //deep water 17 in current implementation should be 2 by londos decode, deep sludge 23 if (groundtype == 17 || groundtype == 23) { player.Dismount(); } //lava and deep water/sludge, ref: ZARU long Now = TCPManager.GetTimeStampMS(); if (groundtype == 3 || groundtype == 19 || (player.Zone.ZoneId == 260 && groundtype == 17 || groundtype == 23)) //19 is deep lava, 17 is deep water, 23 is deep sludge { player.Dismount(); if (!player.IsDead) { //do lava dmg if (_lavatimer < Now) { player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff)); _lavatimer = Now + 1000; player.ResetMorale(); } } } //instadeath if (groundtype == 5 || groundtype == 21) //should be 4 according to londos notes 5=lotd shallow water 21=lotd deep water { if (!player.IsDead) { Log.Notice("groundstate instadeath: ", player.Name + " managed to trigger groundtype instadeath in zone: " + player.ZoneId); player.SendClientMessage("You have managed to trigger the instadeath code from river mortis, please screenshot your death and send to the devs on the bugtracker", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE); player.Terminate(); } } //bright wizard colleage lava if (zoneID == 197) { if (!player.IsDead && player.Z <= 23791) { if (_lavatimer < Now) { player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff)); _lavatimer = Now + 1000; player.ResetMorale(); } } else { if (_lavaBuffs.ContainsKey(player)) { _lavaBuffs[player].BuffHasExpired = true; _lavaBuffs.Remove(player); } } } if (zoneID == 190) { if (!player.IsDead && player.Z <= 7806) { if (_lavatimer < Now) { player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff)); _lavatimer = Now + 1000; player.ResetMorale(); } } else { if (_lavaBuffs.ContainsKey(player)) { _lavaBuffs[player].BuffHasExpired = true; _lavaBuffs.Remove(player); } } } if (player.Zone.Info.Illegal && player.GmLevel == 1) { if (!player.IsDead && player.BuffInterface.GetBuff(27960, player) == null) { player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(27960))); } } else if (!player.Zone.Info.Illegal) { if (player.BuffInterface.GetBuff(27960, player) != null) { player.BuffInterface.RemoveBuffByEntry(27960); } } if (player.ForceSendPosition) { skipSend = false; player.ForceSendPosition = false; } //gunbad has low points where we want to kill the player if (zoneID == 60 && player.Z < 17900) { player.Terminate(); } } #region Long seems to be when the player has a hostile target else if (packet.Size > 17) { long state = System.Net.IPAddress.NetworkToHostOrder(BitConverter.ToInt64(data, 2)); long state2 = System.Net.IPAddress.NetworkToHostOrder(BitConverter.ToInt64(data, 10)); ushort x = ((ushort)(((state2 >> 56 & 0x3) << 14) | ((state >> 0 & 0xFF) << 6) | ((state >> 10 & 0x3F)))); ushort y = ((ushort)(((state2 >> 40 & 0x3) << 14) | ((state2 >> 48 & 0xFF) << 6) | ((state2 >> 58 & 0x3F)))); ushort z = ((ushort)(((state2 >> 16 & 0x7) << 12) | ((state2 >> 24 & 0xFF) << 4) | ((state2 >> 36 & 0x0F)))); byte zoneID = ((byte)(((state2 >> 34 & 0x1) << 7) | ((state2 >> 32 & 0x3) << 5) | ((state2 >> 43 & 0x1F)))); ushort direction = ((ushort)(((state >> 16 & 0xFF) << 4) | ((state >> 28 & 0x0F)))); bool grounded = ((((state >> 9 & 0x1))) == 1); bool walking = ((((state >> 48 & 0x1))) == 1); bool moving = ((((state >> 49 & 0x1))) == 1); bool notMoving = ((((state >> 63 & 0x1))) == 1); byte fallState = ((byte)(((state >> 40 & 0x1F)))); byte groundtype = ((byte)(((state2 >> 73 & 0x1F)))); if (fallState != 31 || ((moving || walking || !notMoving || !grounded) && player.Speed > 0)) { player.IsMoving = true; } else { player.IsMoving = false; } //stop players from getting stuck below the world like below IC if (player.Z < 150 && !player.IsDead && player.Client.IsPlaying()) { player.SendClientMessage("You have fallen through the floor, instead of falling and getting stuck somewhere you get terminated.", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE); player.Terminate(); } //hardcode to not allow players into gunbad in case we miss to invalidate the zone on push #if (!DEBUG) /* * if (zoneID == 60 && player.Client.IsPlaying()) * { * if (player.Realm == Realms.REALMS_REALM_DESTRUCTION) * player.Teleport(161, 439815, 134493, 16865, 0); * * else if (player.Realm == Realms.REALMS_REALM_ORDER) * player.Teleport(162, 124084, 130213, 12572, 0); * } */ #endif //lets move players instantly, if they are in a void (even staff) if ((zoneID == 0 && player.ZoneId.HasValue) && player.Client.IsPlaying()) { player.SendClientMessage("You managed to go outside of the worlds boundries, as such you have been forcefully moved to your capital", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE); if (player.Realm == Realms.REALMS_REALM_DESTRUCTION) { player.Teleport(161, 439815, 134493, 16865, 0); } else if (player.Realm == Realms.REALMS_REALM_ORDER) { player.Teleport(162, 124084, 130213, 12572, 0); } } //player should not be able to cast while in the air. if (!grounded) { player.AbtInterface.Cancel(true); } if (!player.WasGrounded) { if (grounded) { player.CalculateFallDamage(); player.AirCount = -1; player.ForceSendPosition = true; } } player.WasGrounded = grounded; if (!grounded) { player.FallState = fallState; } if (player.IsStaggered || player.IsDisabled) { direction = currentHeading; } player.SetPosition(x, y, z, direction, zoneID); //solid, exclude any zones that has to use a hardcode lava to not disable the damage instantly if (groundtype == 0) { //release lava damage if (_lavaBuffs.ContainsKey(player) && (zoneID != 190 || zoneID != 197)) { _lavaBuffs[player].BuffHasExpired = true; _lavaBuffs.Remove(player); } } //shallow water 1, have no use for it atm... shallow sludge 7 /* * if (groundtype == 1 || groundtype == 7) * { * * }*/ //deep water 17 in current implementation should be 2 by londos decode, deep sludge 23 if (groundtype == 17 || groundtype == 23) { player.Dismount(); } //lava long Now = TCPManager.GetTimeStampMS(); if (groundtype == 3 || groundtype == 19) //19 is deep lava { player.Dismount(); if (!player.IsDead) { //do lava dmg if (_lavatimer < Now) { player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff)); _lavatimer = Now + 1000; player.ResetMorale(); } } } //instadeath if (groundtype == 5 || groundtype == 21) //should be 4 according to londos notes 5=lotd shallow water 21=lotd deep water { if (!player.IsDead) { Log.Notice("groundstate instadeath: ", player.Name + " managed to trigger groundtype instadeath in zone: " + player.ZoneId); player.SendClientMessage("You have managed to trigger the instadeath code from river mortis, please screenshot your death and send to the devs on the bugtracker", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE); player.Terminate(); } } //bright wizard colleage lava if (zoneID == 197) { if (!player.IsDead && player.Z <= 23791) { if (_lavatimer < Now) { player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff)); _lavatimer = Now + 1000; player.ResetMorale(); } } else { if (_lavaBuffs.ContainsKey(player)) { _lavaBuffs[player].BuffHasExpired = true; _lavaBuffs.Remove(player); } } } if (zoneID == 190) { if (!player.IsDead && player.Z <= 7806) { if (_lavatimer < Now) { player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff)); _lavatimer = Now + 1000; player.ResetMorale(); } } else { if (_lavaBuffs.ContainsKey(player)) { _lavaBuffs[player].BuffHasExpired = true; _lavaBuffs.Remove(player); } } } if (player.Zone.Info.Illegal && player.GmLevel == 1) { if (!player.IsDead && player.BuffInterface.GetBuff(27960, player) == null) { player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(27960))); } } else if (!player.Zone.Info.Illegal) { if (player.BuffInterface.GetBuff(27960, player) != null) { player.BuffInterface.RemoveBuffByEntry(27960); } } if (player.ForceSendPosition) { skipSend = false; player.ForceSendPosition = false; } //gunbad has low points where we want to kill the player if (zoneID == 60 && player.Z < 17900) { player.Terminate(); } } #endregion // Packets not conforming to the above are sent at 500ms intervals when the player is still. // I don't know their function, but it appears they're of no interest to the client. else { skipSend = true; player.ForceSendPosition = true; } // TODO: Conditional dispatch for Player State 2 if (skipSend) { return; } player.SendCounter++; //player.DebugMessage("F_PLAYER_STATE2: "+ (TCPManager.GetTimeStampMS() - player.LastStateRecvTime)); player.DispatchPacket(Out, false, true); player.LastStateRecvTime = TCPManager.GetTimeStampMS(); }
public static void EnchantItem(Client client, PacketIn packet) { Utilities.DumpUnusedPacket("PT_EnchantItem", packet); }
public static void Teleport(Client client, PacketIn packet) { Utils.DumpUnusedPacket("PT_Teleport", packet); }