public static void Process(ReceivablePacket packet) { long objectId = packet.ReadLong(); CharacterDataHolder characterData = new CharacterDataHolder(); characterData.SetName(packet.ReadString()); characterData.SetRace((byte)packet.ReadByte()); characterData.SetHeight(packet.ReadFloat()); characterData.SetBelly(packet.ReadFloat()); characterData.SetHairType((byte)packet.ReadByte()); characterData.SetHairColor(packet.ReadInt()); characterData.SetSkinColor(packet.ReadInt()); characterData.SetEyeColor(packet.ReadInt()); characterData.SetHeadItem(packet.ReadInt()); characterData.SetChestItem(packet.ReadInt()); characterData.SetLegsItem(packet.ReadInt()); characterData.SetHandsItem(packet.ReadInt()); characterData.SetFeetItem(packet.ReadInt()); characterData.SetLeftHandItem(packet.ReadInt()); characterData.SetRightHandItem(packet.ReadInt()); characterData.SetX(packet.ReadFloat()); characterData.SetY(packet.ReadFloat()); characterData.SetZ(packet.ReadFloat()); characterData.SetHeading(packet.ReadFloat()); characterData.SetCurrentHp(packet.ReadLong()); characterData.SetMaxHp(packet.ReadLong()); WorldManager.Instance.UpdateObject(objectId, characterData); }
public static void Process(ReceivablePacket packet) { // Server information. long objectId = packet.ReadLong(); CharacterDataHolder npcTemplate = NpcData.GetNpc(packet.ReadInt()); CharacterDataHolder characterData = new CharacterDataHolder(); characterData.SetX(packet.ReadFloat()); characterData.SetY(packet.ReadFloat()); characterData.SetZ(packet.ReadFloat()); characterData.SetHeading(packet.ReadFloat()); characterData.SetCurrentHp(packet.ReadLong()); // Client information. characterData.SetName(npcTemplate.GetName()); characterData.SetRace(npcTemplate.GetRace()); characterData.SetHeight(npcTemplate.GetHeight()); characterData.SetBelly(npcTemplate.GetBelly());; characterData.SetHairType(npcTemplate.GetHairType()); characterData.SetHairColor(npcTemplate.GetHairColor()); characterData.SetSkinColor(npcTemplate.GetSkinColor()); characterData.SetEyeColor(npcTemplate.GetEyeColor()); characterData.SetHeadItem(npcTemplate.GetHeadItem()); characterData.SetChestItem(npcTemplate.GetChestItem()); characterData.SetLegsItem(npcTemplate.GetLegsItem()); characterData.SetHandsItem(npcTemplate.GetHandsItem()); characterData.SetFeetItem(npcTemplate.GetFeetItem()); characterData.SetLeftHandItem(npcTemplate.GetLeftHandItem()); characterData.SetRightHandItem(npcTemplate.GetRightHandItem()); characterData.SetMaxHp(npcTemplate.GetMaxHp()); characterData.SetTargetable(npcTemplate.IsTargetable()); WorldManager.Instance.UpdateObject(objectId, characterData); }
public ObjectInfoRequest(GameClient client, ReceivablePacket packet) { // Read data. long objectId = packet.ReadLong(); // Get the acting player. Player player = client.GetActiveChar(); // Send the information. List <WorldObject> objects = WorldManager.GetVisibleObjects(player); for (int i = 0; i < objects.Count; i++) { WorldObject obj = objects[i]; if (obj.GetObjectId() == objectId) { if (obj.IsPlayer()) { client.ChannelSend(new PlayerInformation(obj.AsPlayer())); } else if (obj.IsNpc()) { client.ChannelSend(new NpcInformation(obj.AsNpc())); } // Send delayed animation update in case object was already moving. Task.Delay(1000).ContinueWith(task => SendAnimationInfo(client, obj)); break; } } }
public TargetUpdateRequest(GameClient client, ReceivablePacket packet) { // Read data. long targetObjectId = packet.ReadLong(); // Get player. Player player = client.GetActiveChar(); // Remove target. if (targetObjectId < 0) { player.SetTarget(null); return; } // Find target WorldObject. List <WorldObject> objects = WorldManager.GetVisibleObjects(player); for (int i = 0; i < objects.Count; i++) { WorldObject obj = objects[i]; if (obj != null && obj.GetObjectId() == targetObjectId) { player.SetTarget(obj); return; } } }
public ObjectInfoRequest(GameClient client, ReceivablePacket packet) { // Read data. long objectId = packet.ReadLong(); // Get the acting player. Player player = client.GetActiveChar(); // Send the information. foreach (WorldObject obj in WorldManager.GetVisibleObjects(player)) { if (obj.GetObjectId() == objectId) { if (obj.IsPlayer()) { client.ChannelSend(new PlayerInformation(obj.AsPlayer())); } // TODO: Other objects - NpcInformation? // Send delayed animation update in case object was already moving. Task.Delay(1000).ContinueWith(task => SendAnimationInfo(client, obj)); break; } } }
public TargetUpdateRequest(GameClient client, ReceivablePacket packet) { // Read data. long targetObjectId = packet.ReadLong(); // Get player. Player player = client.GetActiveChar(); // Remove target. if (targetObjectId < 0) { player.SetTarget(null); return; } // Find target WorldObject. foreach (WorldObject obj in WorldManager.GetVisibleObjects(player)) { if (obj != null && obj.GetObjectId() == targetObjectId) { player.SetTarget(obj); return; } } }
public static void Notify(ReceivablePacket packet) { // Get player list size. int listSize = packet.ReadByte(); // Read the data. List <CharacterDataHolder> characterList = new List <CharacterDataHolder>(listSize); for (int i = 0; i < listSize; i++) { CharacterDataHolder characterData = new CharacterDataHolder(); characterData.SetName(packet.ReadString()); characterData.SetSlot((byte)packet.ReadByte()); characterData.SetSelected(packet.ReadByte() == 1 ? true : false); characterData.SetRace((byte)packet.ReadByte()); characterData.SetHeight(packet.ReadFloat()); characterData.SetBelly(packet.ReadFloat()); characterData.SetHairType(packet.ReadByte()); characterData.SetHairColor(packet.ReadInt()); characterData.SetSkinColor(packet.ReadInt()); characterData.SetEyeColor(packet.ReadInt()); characterData.SetHeadItem(packet.ReadInt()); characterData.SetChestItem(packet.ReadInt()); characterData.SetLegsItem(packet.ReadInt()); characterData.SetHandsItem(packet.ReadInt()); characterData.SetFeetItem(packet.ReadInt()); characterData.SetLeftHandItem(packet.ReadInt()); characterData.SetRightHandItem(packet.ReadInt()); characterData.SetX(packet.ReadFloat()); characterData.SetY(packet.ReadFloat()); characterData.SetZ(packet.ReadFloat()); characterData.SetHeading(packet.ReadFloat()); characterData.SetExperience(packet.ReadLong()); characterData.SetCurrentHp(packet.ReadLong()); characterData.SetMaxHp(packet.ReadLong()); characterData.SetCurrentMp(packet.ReadLong()); characterData.SetMaxMp(packet.ReadLong()); characterData.SetAccessLevel((byte)packet.ReadByte()); characterList.Add(characterData); } // Send the data. MainManager.Instance.SetCharacterList(characterList); // Enable player selection. CharacterSelectionManager.Instance.SetWaitingServer(false); }
public static void Notify(ReceivablePacket packet) { long objectId = packet.ReadLong(); float posX = packet.ReadFloat(); float posY = packet.ReadFloat(); float posZ = packet.ReadFloat(); float heading = packet.ReadFloat(); ((IDictionary <long, MovementHolder>)WorldManager.Instance.moveQueue).Remove(objectId); WorldManager.Instance.moveQueue.TryAdd(objectId, new MovementHolder(posX, posY, posZ, heading)); }
public static void notify(ReceivablePacket packet) { // Get player list size. int listSize = packet.ReadByte(); // Read the data. ArrayList characterList = new ArrayList(listSize); for (int i = 0; i < listSize; i++) { CharacterDataHolder characterData = new CharacterDataHolder(); characterData.SetName(packet.ReadString()); characterData.SetSlot((byte)packet.ReadByte()); characterData.SetSelected(packet.ReadByte() == 1 ? true : false); characterData.SetClassId((byte)packet.ReadByte()); characterData.SetLocationName(packet.ReadString()); characterData.SetX(packet.ReadFloat()); characterData.SetY(packet.ReadFloat()); characterData.SetZ(packet.ReadFloat()); characterData.SetHeading(packet.ReadInt()); characterData.SetExperience(packet.ReadLong()); characterData.SetHp(packet.ReadLong()); characterData.SetMp(packet.ReadLong()); characterData.SetAccessLevel((byte)packet.ReadByte()); characterData.SetItemHead(packet.ReadInt()); characterData.SetItemChest(packet.ReadInt()); characterData.SetItemGloves(packet.ReadInt()); characterData.SetItemLegs(packet.ReadInt()); characterData.SetItemBoots(packet.ReadInt()); characterData.SetItemRightHand(packet.ReadInt()); characterData.SetItemLeftHand(packet.ReadInt()); characterList.Add(characterData); } // Send the data. PlayerManager.instance.characterList = characterList; // Enable player selection. CharacterSelectionManager.instance.waitingServer = false; }
public static void Process(ReceivablePacket packet) { // Read data. long objectId = packet.ReadLong(); float velocityX = packet.ReadFloat(); float velocityZ = packet.ReadFloat(); bool triggerJump = packet.ReadByte() == 1; bool isInWater = packet.ReadByte() == 1; bool isGrounded = packet.ReadByte() == 1; ((IDictionary <long, AnimationHolder>)WorldManager.Instance.GetAnimationQueue()).Remove(objectId); WorldManager.Instance.GetAnimationQueue().TryAdd(objectId, new AnimationHolder(velocityX, velocityZ, triggerJump, isInWater, isGrounded)); }
public ObjectInfoRequest(GameClient client, ReceivablePacket packet) { // Read data. long objectId = packet.ReadLong(); // Get the acting player. Player player = client.GetActiveChar(); // Send the information. foreach (WorldObject obj in WorldManager.GetVisibleObjects(player)) { if (obj.GetObjectId() == objectId) { if (obj.IsPlayer()) { client.ChannelSend(new PlayerInformation(obj.AsPlayer())); } // TODO: Other objects - NpcInformation? break; } } }
public static void Process(ReceivablePacket packet) { long objectId = packet.ReadLong(); WorldManager.Instance.DeleteObject(objectId); }
public static void Handle(GameClient client, ReceivablePacket packet) { /* * switch (packet.ReadShort()) // Packet id. * { * case 1: * new AccountAuthenticationRequest(client, packet); * break; * * case 2: * new CharacterSelectionInfoRequest(client, packet); * break; * * case 3: * new CharacterCreationRequest(client, packet); * break; * * case 4: * new CharacterDeletionRequest(client, packet); * break; * * case 5: * new CharacterSlotUpdate(client, packet); * break; * * case 6: * new CharacterSelectUpdate(client, packet); * break; * * case 7: * new EnterWorldRequest(client, packet); * break; * * case 8: * new ExitWorldRequest(client, packet); * break; * * case 9: * new LocationUpdateRequest(client, packet); * break; * * case 10: * new AnimatorUpdateRequest(client, packet); * break; * * case 11: * new ObjectInfoRequest(client, packet); * break; * * case 12: * new PlayerOptionsUpdate(client, packet); * break; * * case 13: * new ChatRequest(client, packet); * break; * } */ // Test receive. LogManager.Log("" + packet.ReadByte()); LogManager.Log("" + packet.ReadShort()); LogManager.Log("" + packet.ReadInt()); LogManager.Log("" + packet.ReadLong()); LogManager.Log("" + packet.ReadFloat()); LogManager.Log("" + packet.ReadDouble()); LogManager.Log("" + packet.ReadString()); // Test send. SendablePacket send = new SendablePacket(); send.WriteShort(1); // id send.WriteString("All is good!"); client.ChannelSend(send); }