Exemplo n.º 1
0
 public void SendActionButtons(ref WS_Network.ClientClass client, ref WS_PlayerData.CharacterObject Character)
 {
     Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_ACTION_BUTTONS);
     try
     {
         byte i = 0;
         do
         {
             checked
             {
                 if (Character.ActionButtons.ContainsKey(i))
                 {
                     packet.AddUInt16((ushort)Character.ActionButtons[i].Action);
                     packet.AddInt8(Character.ActionButtons[i].ActionType);
                     packet.AddInt8(Character.ActionButtons[i].ActionMisc);
                 }
                 else
                 {
                     packet.AddInt32(0);
                 }
                 i = (byte)unchecked ((uint)(i + 1));
             }
         }while (i <= 119u);
         client.Send(ref packet);
     }
     finally
     {
         packet.Dispose();
     }
 }
Exemplo n.º 2
0
        public void MaievSendTransfer(ref WS_PlayerData.CharacterObject objCharacter)
        {
            if (!objCharacter.WardenData.Ready)
            {
                throw new ApplicationException("Maiev.mod not ready!");
            }
            FileStream file = new FileStream($"warden\\{WorldServiceLocator._WS_Warden.Maiev.ModuleName}.bin", FileMode.Open, FileAccess.Read);

            checked
            {
                int size;
                for (size = (int)file.Length; size > 500; size -= 500)
                {
                    Packets.PacketClass r = new Packets.PacketClass(Opcodes.SMSG_WARDEN_DATA);
                    r.AddInt8(1);
                    r.AddInt16(500);
                    int i = 1;
                    do
                    {
                        r.AddInt8((byte)file.ReadByte());
                        i++;
                    }while (i <= 500);
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_WARDEN_DATA [data]", objCharacter.client.IP, objCharacter.client.Port);
                    WorldServiceLocator._WS_Warden.SendWardenPacket(ref objCharacter, ref r);
                }
                if (size > 0)
                {
                    Packets.PacketClass r2 = new Packets.PacketClass(Opcodes.SMSG_WARDEN_DATA);
                    r2.AddInt8(1);
                    r2.AddUInt16((ushort)size);
                    int num = size;
                    for (int j = 1; j <= num; j++)
                    {
                        r2.AddInt8((byte)file.ReadByte());
                    }
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_WARDEN_DATA [done]", objCharacter.client.IP, objCharacter.client.Port);
                    WorldServiceLocator._WS_Warden.SendWardenPacket(ref objCharacter, ref r2);
                }
            }
        }
Exemplo n.º 3
0
 public void SendInitialSpells(ref WS_Network.ClientClass client, ref WS_PlayerData.CharacterObject Character)
 {
     Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_INITIAL_SPELLS);
     checked
     {
         try
         {
             packet.AddInt8(0);
             int countPos = packet.Data.Length;
             packet.AddInt16(0);
             int spellCount = 0;
             Dictionary <int, KeyValuePair <uint, int> > spellCooldowns = new Dictionary <int, KeyValuePair <uint, int> >();
             foreach (KeyValuePair <int, WS_Spells.CharacterSpell> Spell in Character.Spells)
             {
                 if (Spell.Value.Active == 1)
                 {
                     packet.AddUInt16((ushort)Spell.Key);
                     packet.AddInt16(0);
                     spellCount++;
                     if (Spell.Value.Cooldown != 0)
                     {
                         spellCooldowns.Add(Spell.Key, new KeyValuePair <uint, int>(Spell.Value.Cooldown, 0));
                     }
                 }
             }
             packet.AddInt16((short)spellCount, countPos);
             spellCount = 0;
             countPos   = packet.Data.Length;
             packet.AddInt16(0);
             foreach (KeyValuePair <int, KeyValuePair <uint, int> > Cooldown in spellCooldowns)
             {
                 if (WorldServiceLocator._WS_Spells.SPELLs.ContainsKey(Cooldown.Key))
                 {
                     packet.AddUInt16((ushort)Cooldown.Key);
                     int timeLeft = 0;
                     if (Cooldown.Value.Key > WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now))
                     {
                         timeLeft = (int)(checked (Cooldown.Value.Key - WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now)) * 1000L);
                     }
                     packet.AddUInt16((ushort)Cooldown.Value.Value);
                     packet.AddUInt16((ushort)WorldServiceLocator._WS_Spells.SPELLs[Cooldown.Key].Category);
                     if (WorldServiceLocator._WS_Spells.SPELLs[Cooldown.Key].CategoryCooldown > 0)
                     {
                         packet.AddInt32(0);
                         packet.AddInt32(timeLeft);
                     }
                     else
                     {
                         packet.AddInt32(timeLeft);
                         packet.AddInt32(0);
                     }
                     spellCount++;
                 }
             }
             packet.AddInt16((short)spellCount, countPos);
             client.Send(ref packet);
         }
         finally
         {
             packet.Dispose();
         }
     }
 }
Exemplo n.º 4
0
        public void SendInitWorldStates(ref WS_Network.ClientClass client, ref WS_PlayerData.CharacterObject Character)
        {
            Character.ZoneCheck();
            ushort NumberOfFields;

            switch (Character.ZoneID)
            {
            case 0:
            case 1:
            case 4:
            case 8:
            case 10:
            case 11:
            case 12:
            case 36:
            case 38:
            case 40:
            case 41:
            case 51:
            case 267:
            case 1519:
            case 1537:
            case 2257:
            case 2918:
                NumberOfFields = 6;
                break;

            case 2597:
                NumberOfFields = 81;
                break;

            case 3277:
                NumberOfFields = 14;
                break;

            case 3358:
            case 3820:
                NumberOfFields = 38;
                break;

            case 3483:
                NumberOfFields = 22;
                break;

            case 3519:
                NumberOfFields = 36;
                break;

            case 3521:
                NumberOfFields = 35;
                break;

            case 3698:
            case 3702:
            case 3968:
                NumberOfFields = 9;
                break;

            case 3703:
                NumberOfFields = 9;
                break;

            default:
                NumberOfFields = 10;
                break;
            }
            Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_INIT_WORLD_STATES);
            try
            {
                packet.AddUInt32(Character.MapID);
                packet.AddInt32(Character.ZoneID);
                packet.AddInt32(Character.AreaID);
                packet.AddUInt16(NumberOfFields);
                packet.AddUInt32(2264u);
                packet.AddUInt32(0u);
                packet.AddUInt32(2263u);
                packet.AddUInt32(0u);
                packet.AddUInt32(2262u);
                packet.AddUInt32(0u);
                packet.AddUInt32(2261u);
                packet.AddUInt32(0u);
                packet.AddUInt32(2260u);
                packet.AddUInt32(0u);
                packet.AddUInt32(2259u);
                packet.AddUInt32(0u);
                switch (Character.ZoneID)
                {
                case 3968:
                    packet.AddUInt32(3000u);
                    packet.AddUInt32(0u);
                    packet.AddUInt32(3001u);
                    packet.AddUInt32(0u);
                    packet.AddUInt32(3002u);
                    packet.AddUInt32(0u);
                    break;

                default:
                    packet.AddUInt32(2324u);
                    packet.AddUInt32(0u);
                    packet.AddUInt32(2323u);
                    packet.AddUInt32(0u);
                    packet.AddUInt32(2322u);
                    packet.AddUInt32(0u);
                    packet.AddUInt32(2325u);
                    packet.AddUInt32(0u);
                    break;

                case 1:
                case 11:
                case 12:
                case 38:
                case 40:
                case 51:
                case 1519:
                case 1537:
                case 2257:
                case 2597:
                case 3277:
                case 3358:
                case 3820:
                    break;
                }
                client.Send(ref packet);
            }
            finally
            {
                packet.Dispose();
            }
        }
Exemplo n.º 5
0
        public Packets.PacketClass BuildPartyMemberStats(ref WS_PlayerData.CharacterObject objCharacter, uint flag)
        {
            Opcodes opCode = Opcodes.SMSG_PARTY_MEMBER_STATS;

            if (flag == 1015 || flag == 524279)
            {
                opCode = Opcodes.SMSG_PARTY_MEMBER_STATS_FULL;
                if (objCharacter.ManaType != 0)
                {
                    flag |= 8u;
                }
            }
            Packets.PacketClass packet = new Packets.PacketClass(opCode);
            packet.AddPackGUID(objCharacter.GUID);
            packet.AddUInt32(flag);
            if ((flag & (true ? 1u : 0u)) != 0)
            {
                byte memberFlags = 1;
                if (objCharacter.isPvP)
                {
                    memberFlags = (byte)(memberFlags | 2);
                }
                if (objCharacter.DEAD)
                {
                    memberFlags = (byte)(memberFlags | 0x10);
                }
                packet.AddInt8(memberFlags);
            }
            checked
            {
                if ((flag & 2u) != 0)
                {
                    packet.AddUInt16((ushort)objCharacter.Life.Current);
                }
                if ((flag & 4u) != 0)
                {
                    packet.AddUInt16((ushort)objCharacter.Life.Maximum);
                }
                if ((flag & 8u) != 0)
                {
                    packet.AddInt8((byte)objCharacter.ManaType);
                }
                if ((flag & 0x10u) != 0)
                {
                    if (objCharacter.ManaType == ManaTypes.TYPE_RAGE)
                    {
                        packet.AddUInt16((ushort)objCharacter.Rage.Current);
                    }
                    else if (objCharacter.ManaType == ManaTypes.TYPE_ENERGY)
                    {
                        packet.AddUInt16((ushort)objCharacter.Energy.Current);
                    }
                    else
                    {
                        packet.AddUInt16((ushort)objCharacter.Mana.Current);
                    }
                }
                if ((flag & 0x20u) != 0)
                {
                    if (objCharacter.ManaType == ManaTypes.TYPE_RAGE)
                    {
                        packet.AddUInt16((ushort)objCharacter.Rage.Maximum);
                    }
                    else if (objCharacter.ManaType == ManaTypes.TYPE_ENERGY)
                    {
                        packet.AddUInt16((ushort)objCharacter.Energy.Maximum);
                    }
                    else
                    {
                        packet.AddUInt16((ushort)objCharacter.Mana.Maximum);
                    }
                }
                if ((flag & 0x40u) != 0)
                {
                    packet.AddUInt16(objCharacter.Level);
                }
                if ((flag & 0x80u) != 0)
                {
                    packet.AddUInt16((ushort)objCharacter.ZoneID);
                }
                if ((flag & 0x100u) != 0)
                {
                    packet.AddInt16((short)objCharacter.positionX);
                    packet.AddInt16((short)objCharacter.positionY);
                }
                if ((flag & 0x200u) != 0)
                {
                    ulong auraMask2 = 0uL;
                    int   auraPos2  = packet.Data.Length;
                    packet.AddUInt64(0uL);
                    int num = WorldServiceLocator._Global_Constants.MAX_AURA_EFFECTs_VISIBLE - 1;
                    for (int j = 0; j <= num; j++)
                    {
                        if (objCharacter.ActiveSpells[j] != null)
                        {
                            unchecked
                            {
                                auraMask2 |= (ulong)(1L << checked ((int)(ulong)j));
                            }
                            packet.AddUInt16((ushort)objCharacter.ActiveSpells[j].SpellID);
                            packet.AddInt8(1);
                        }
                    }
                    packet.AddUInt64(auraMask2, auraPos2);
                }
                if ((flag & 0x400u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        packet.AddUInt64(objCharacter.Pet.GUID);
                    }
                    else
                    {
                        packet.AddInt64(0L);
                    }
                }
                if ((flag & 0x800u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        packet.AddString(objCharacter.Pet.PetName);
                    }
                    else
                    {
                        packet.AddString("");
                    }
                }
                if ((flag & 0x1000u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        packet.AddUInt16((ushort)objCharacter.Pet.Model);
                    }
                    else
                    {
                        packet.AddInt16(0);
                    }
                }
                if ((flag & 0x2000u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        packet.AddUInt16((ushort)objCharacter.Pet.Life.Current);
                    }
                    else
                    {
                        packet.AddInt16(0);
                    }
                }
                if ((flag & 0x4000u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        packet.AddUInt16((ushort)objCharacter.Pet.Life.Maximum);
                    }
                    else
                    {
                        packet.AddInt16(0);
                    }
                }
                if ((flag & 0x8000u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        packet.AddInt8(2);
                    }
                    else
                    {
                        packet.AddInt8(0);
                    }
                }
                if ((flag & 0x10000u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        packet.AddUInt16((ushort)objCharacter.Pet.Mana.Current);
                    }
                    else
                    {
                        packet.AddInt16(0);
                    }
                }
                if ((flag & 0x20000u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        packet.AddUInt16((ushort)objCharacter.Pet.Mana.Maximum);
                    }
                    else
                    {
                        packet.AddInt16(0);
                    }
                }
                if ((flag & 0x40000u) != 0)
                {
                    if (objCharacter.Pet != null)
                    {
                        ulong auraMask = 0uL;
                        int   auraPos  = packet.Data.Length;
                        packet.AddUInt64(0uL);
                        int num2 = WorldServiceLocator._Global_Constants.MAX_AURA_EFFECTs_VISIBLE - 1;
                        for (int i = 0; i <= num2; i++)
                        {
                            if (objCharacter.Pet.ActiveSpells[i] != null)
                            {
                                unchecked
                                {
                                    auraMask |= (ulong)(1L << checked ((int)(ulong)i));
                                }
                                packet.AddUInt16((ushort)objCharacter.Pet.ActiveSpells[i].SpellID);
                                packet.AddInt8(1);
                            }
                        }
                        packet.AddUInt64(auraMask, auraPos);
                    }
                    else
                    {
                        packet.AddInt64(0L);
                    }
                }
                return(packet);
            }
        }