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 Chat(Client pClient, Packet pPacket) { string message; bool bubble; if (!pPacket.ReadString(out message) || !pPacket.ReadBool(out bubble)) { pClient.Disconnect(); return; } Packet packet = new Packet(EOpcode.SMSG_PLAYER_CHAT); packet.WriteInt(pClient.Player.Identifier); packet.WriteBool(pClient.Account.Level > 0); packet.WriteString(message); packet.WriteBool(bubble); pClient.Player.Map.SendPacketToAll(packet); }