예제 #1
0
 public void MaievSendModule(ref WS_PlayerData.CharacterObject objCharacter)
 {
     if (!objCharacter.WardenData.Ready)
     {
         throw new ApplicationException("Maiev.mod not ready!");
     }
     WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_WARDEN_DATA [{2}]", objCharacter.client.IP, objCharacter.client.Port, WorldServiceLocator._WS_Warden.Maiev.ModuleName);
     Packets.PacketClass r = new Packets.PacketClass(Opcodes.SMSG_WARDEN_DATA);
     r.AddInt8(0);
     r.AddByteArray(WorldServiceLocator._WS_Warden.Maiev.WardenModule);
     r.AddByteArray(WorldServiceLocator._WS_Warden.Maiev.ModuleKey);
     r.AddUInt32(checked ((uint)WorldServiceLocator._WS_Warden.Maiev.ModuleSize));
     WorldServiceLocator._WS_Warden.SendWardenPacket(ref objCharacter, ref r);
 }
예제 #2
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();
            }
        }
예제 #3
0
 public void SendTradeUpdateToTarget()
 {
     if (Target == null)
     {
         return;
     }
     Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_TRADE_STATUS_EXTENDED);
     checked
     {
         try
         {
             packet.AddInt8(1);
             packet.AddInt32(7);
             packet.AddInt32(7);
             packet.AddUInt32(TraderGold);
             packet.AddInt32(0);
             int i = 0;
             do
             {
                 packet.AddInt8((byte)i);
                 if (TraderSlots[i] > 0)
                 {
                     byte       mySlot = (byte)(TraderSlots[i] & 0xFF);
                     byte       myBag  = (byte)(TraderSlots[i] >> 8);
                     ItemObject myItem = null;
                     myItem = ((myBag != 0) ? Trader.Items[myBag].Items[mySlot] : Trader.Items[mySlot]);
                     packet.AddInt32(myItem.ItemEntry);
                     packet.AddInt32(myItem.ItemInfo.Model);
                     packet.AddInt32(myItem.StackCount);
                     packet.AddInt32(0);
                     packet.AddUInt64(myItem.GiftCreatorGUID);
                     if (myItem.Enchantments.ContainsKey(0))
                     {
                         packet.AddInt32(myItem.Enchantments[0].ID);
                     }
                     else
                     {
                         packet.AddInt32(0);
                     }
                     packet.AddUInt64(myItem.CreatorGUID);
                     packet.AddInt32(myItem.ChargesLeft);
                     packet.AddInt32(0);
                     packet.AddInt32(myItem.RandomProperties);
                     packet.AddInt32(myItem.ItemInfo.Flags);
                     packet.AddInt32(myItem.ItemInfo.Durability);
                     packet.AddInt32(myItem.Durability);
                 }
                 else
                 {
                     int j = 0;
                     do
                     {
                         packet.AddInt32(0);
                         j++;
                     }while (j <= 14);
                 }
                 i++;
             }while (i <= 6);
             Target.client.Send(ref packet);
         }
         finally
         {
             packet.Dispose();
         }
     }
 }
예제 #4
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);
            }
        }
예제 #5
0
 public void On_CMSG_GET_MAIL_LIST(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 < 13)
         {
             return;
         }
         packet.GetInt16();
         ulong GameObjectGUID = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_GET_MAIL_LIST [GUID={2:X}]", client.IP, client.Port, GameObjectGUID);
         try
         {
             DataTable MySQLQuery = new DataTable();
             WorldServiceLocator._WorldServer.CharacterDatabase.Query($"SELECT mail_id FROM characters_mail WHERE mail_time < {WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now)};", ref MySQLQuery);
             if (MySQLQuery.Rows.Count > 0)
             {
                 byte b = (byte)(MySQLQuery.Rows.Count - 1);
                 byte j = 0;
                 while (j <= (uint)b)
                 {
                     WorldServiceLocator._WorldServer.CharacterDatabase.Update(string.Format("DELETE FROM characters_mail WHERE mail_id = {0};", RuntimeHelpers.GetObjectValue(MySQLQuery.Rows[j]["mail_id"])));
                     j = (byte)unchecked ((uint)(j + 1));
                 }
             }
             WorldServiceLocator._WorldServer.CharacterDatabase.Query($"SELECT * FROM characters_mail WHERE mail_receiver = {client.Character.GUID};", ref MySQLQuery);
             Packets.PacketClass response = new Packets.PacketClass(Opcodes.SMSG_MAIL_LIST_RESULT);
             response.AddInt8((byte)MySQLQuery.Rows.Count);
             if (MySQLQuery.Rows.Count > 0)
             {
                 byte b2 = (byte)(MySQLQuery.Rows.Count - 1);
                 byte i  = 0;
                 while (i <= (uint)b2)
                 {
                     response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_id"));
                     response.AddInt8(MySQLQuery.Rows[i].As <byte>("mail_type"));
                     object left = MySQLQuery.Rows[i]["mail_type"];
                     if (Operators.ConditionalCompareObjectEqual(left, MailTypeInfo.NORMAL, TextCompare: false))
                     {
                         response.AddUInt64(MySQLQuery.Rows[i].As <ulong>("mail_sender"));
                     }
                     else if (Operators.ConditionalCompareObjectEqual(left, MailTypeInfo.AUCTION, TextCompare: false))
                     {
                         response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_sender"));
                     }
                     response.AddString(MySQLQuery.Rows[i].As <string>("mail_subject"));
                     if (Operators.ConditionalCompareObjectNotEqual(MySQLQuery.Rows[i]["mail_body"], "", TextCompare: false))
                     {
                         response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_id"));
                     }
                     else
                     {
                         response.AddInt32(0);
                     }
                     response.AddInt32(0);
                     response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_stationary"));
                     if (decimal.Compare(new decimal(MySQLQuery.Rows[i].As <ulong>("item_guid")), 0m) > 0)
                     {
                         ItemObject tmpItem = WorldServiceLocator._WS_Items.LoadItemByGUID(MySQLQuery.Rows[i].As <ulong>("item_guid"));
                         response.AddInt32(tmpItem.ItemEntry);
                         if (tmpItem.Enchantments.ContainsKey(0))
                         {
                             packet.AddInt32(tmpItem.Enchantments[0].ID);
                         }
                         else
                         {
                             packet.AddInt32(0);
                         }
                         response.AddInt32(tmpItem.RandomProperties);
                         response.AddInt32(0);
                         response.AddInt8((byte)tmpItem.StackCount);
                         response.AddInt32(tmpItem.ChargesLeft);
                         response.AddInt32(tmpItem.ItemInfo.Durability);
                         response.AddInt32(tmpItem.Durability);
                     }
                     else
                     {
                         response.AddInt32(0);
                         response.AddInt32(0);
                         response.AddInt32(0);
                         response.AddInt32(0);
                         response.AddInt8(0);
                         response.AddInt32(0);
                         response.AddInt32(0);
                         response.AddInt32(0);
                     }
                     response.AddUInt32(MySQLQuery.Rows[i].As <uint>("mail_money"));
                     response.AddUInt32(MySQLQuery.Rows[i].As <uint>("mail_COD"));
                     response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_read"));
                     response.AddSingle((float)((MySQLQuery.Rows[i].As <uint>("mail_time") - WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now)) / 86400.0));
                     response.AddInt32(0);
                     i = (byte)unchecked ((uint)(i + 1));
                 }
             }
             client.Send(ref response);
             response.Dispose();
         }
         catch (Exception ex)
         {
             ProjectData.SetProjectError(ex);
             Exception e = ex;
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.FAILED, "Error getting mail list: {0}{1}", Environment.NewLine, e.ToString());
             ProjectData.ClearProjectError();
         }
     }
 }