public static void Action(Client pClient, Packet pPacket) { int uniqueIdentifier; short moveIdentifier; bool isUsingAbility; byte usingAbility; Coordinates projectileTarget; if (!pPacket.ReadInt(out uniqueIdentifier) || !pPacket.ReadShort(out moveIdentifier) || !pPacket.ReadBool(out isUsingAbility) || !pPacket.ReadByte(out usingAbility) || !pPacket.ReadCoordinates(out projectileTarget) || !pPacket.ReadSkip(5)) { pClient.Disconnect(); return; } Mob mob = pClient.Player.Map.GetMob(uniqueIdentifier); if (mob == null || mob.Controller != pClient.Player) return; int rewindOffset = pPacket.Cursor; Coordinates unknownPosition; if (!pPacket.ReadCoordinates(out unknownPosition) || !pClient.Player.Map.ReadMovement(mob, pPacket)) { pClient.Disconnect(); return; } Packet packet = new Packet(EOpcode.SMSG_MOB_ACTION_CONFIRM); packet.WriteInt(uniqueIdentifier); packet.WriteShort(moveIdentifier); packet.WriteBool(isUsingAbility); packet.WriteUShort((ushort)mob.Mana); packet.WriteByte(0x00); // Ability Identifier packet.WriteByte(0x00); // Ability Level pClient.SendPacket(packet); pPacket.Rewind(rewindOffset); packet = new Packet(EOpcode.SMSG_MOB_ACTION); packet.WriteInt(uniqueIdentifier); packet.WriteBool(isUsingAbility); packet.WriteByte(usingAbility); packet.WriteCoordinates(projectileTarget); packet.WriteBytes(pPacket.InnerBuffer, pPacket.Cursor, pPacket.Remaining); pClient.Player.Map.SendPacketToAllExcept(packet, pClient.Player); pClient.Player.Map.UpdateMobControllers(true); }
public static void Move(Client pClient, Packet pPacket) { if (!pPacket.ReadSkip(9)) { pClient.Disconnect(); return; } int rewindOffset = pPacket.Cursor; pClient.Player.Map.ReadMovement(pClient.Player, pPacket); pPacket.Rewind(rewindOffset); Packet packet = new Packet(EOpcode.SMSG_PLAYER_MOVE); packet.WriteInt(pClient.Player.Identifier); packet.WriteInt(0); packet.WriteBytes(pPacket.InnerBuffer, pPacket.Cursor, pPacket.Remaining); pClient.Player.Map.SendPacketToAllExcept(packet, pClient.Player); if (pClient.Player.Foothold == 0) { } else pClient.Player.FallCount = 0; pClient.Player.Map.UpdateMobControllers(true); }