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);
        }
示例#2
0
 internal void SendControl(bool pTakeControl)
 {
     if (mController != null)
     {
         Packet packet = new Packet(EOpcode.SMSG_MOB_CONTROL);
         packet.WriteBool(pTakeControl);
         packet.WriteInt(UniqueIdentifier);
         if (pTakeControl)
         {
             packet.WriteByte(0x05);
             packet.WriteInt(mData.MobIdentifier);
             WriteStatus(packet);
             packet.WriteCoordinates(mPosition);
             packet.WriteByte((byte)(0x02 | (FacingLeft ? 0x01 : 0x00)));
             packet.WriteUShort(mFoothold);
             packet.WriteUShort(mData.Foothold);
             packet.WriteBool(false);
             packet.WriteByte(0xFF);
             packet.WriteInt(0);
         }
         mController.SendPacket(packet);
     }
 }
示例#3
0
        internal void SendMobDetails(Player pPlayer)
        {
            foreach (Mob mob in mMobs)
            {
                Packet packet = new Packet(EOpcode.SMSG_MOB_DETAILS);
                packet.WriteInt(mob.UniqueIdentifier);
                packet.WriteByte(0x00);
                packet.WriteInt(mob.Data.MobIdentifier);
                mob.WriteStatus(packet);
                packet.WriteCoordinates(mob.Position);
                byte bits = 0x02;
                if (mob.FacingLeft) bits |= 0x01;
                packet.WriteByte(bits);
                packet.WriteUShort(mob.Foothold);
                packet.WriteUShort(mob.Data.Foothold);
                packet.WriteSByte(-1);
                packet.WriteSByte(0);
                packet.WriteInt(0);
                pPlayer.SendPacket(packet);

            }
        }
示例#4
0
        internal Packet GetPlayerDetails()
        {
            Packet packet = new Packet(EOpcode.SMSG_PLAYER_DETAILS);
            packet.WriteInt(mIdentifier);
            packet.WriteString(mName);

            packet.WriteString("");
            packet.WriteUShort(0);
            packet.WriteByte(0x00);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteByte(0xF8);
            packet.WriteByte(0x03);
            packet.WriteUShort(0);

            byte[] types = mBuffs.MapTypes;
            packet.WriteBytes(types, PlayerBuffs.BUFF_BYTE_5, 4);
            packet.WriteBytes(types, PlayerBuffs.BUFF_BYTE_1, 4);
            for (byte index = 0; index < PlayerBuffs.BUFF_ENTRY_ORDER.Length; ++index)
            {
                byte entryIndex = PlayerBuffs.BUFF_ENTRY_ORDER[index];
                if (types[entryIndex] != 0)
                {
                    foreach (KeyValuePair<byte, PlayerBuffs.MapValue> kv in mBuffs.MapValues[entryIndex])
                    {
                        if (kv.Value.Debuff)
                        {
                            if (!(kv.Key == 0x01 && entryIndex == PlayerBuffs.BUFF_BYTE_5))
                            {
                                packet.WriteUShort(kv.Value.SkillIdentifier);
                                packet.WriteShort(kv.Value.Value);
                            }
                        }
                        else if (kv.Value.Use)
                        {
                            if (entryIndex == PlayerBuffs.BUFF_BYTE_3)
                            {
                                if (kv.Key == 0x20) packet.WriteByte((byte)(mBuffs.Combo + 1));
                                else if (kv.Key == 0x40) packet.WriteInt(mBuffs.ChargeSkillIdentifier);
                            }
                            else if (entryIndex == PlayerBuffs.BUFF_BYTE_5) packet.WriteShort(kv.Value.Value);
                            else packet.WriteByte((byte)kv.Value.Value);
                        }
                    }
                }
            }
            packet.WriteUShort(0);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteInt(mBuffs.MountIdentifier);
            packet.WriteInt(mBuffs.MountSkillIdentifier);
            packet.WriteUInt(1065638850);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUInt(0);
            packet.WriteUInt(0);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUInt(0);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteUShort(mJob);
            WriteAppearance(packet);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteCoordinates(mPosition);
            packet.WriteByte(0x00);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteByte(0x00);
            packet.WriteUShort(1);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUShort(0);

            return packet;
        }