示例#1
0
        public InvUpdate(WorldPacket data)
        {
            Items = new List <InvItem>();
            int size = data.ReadBits <int>(2);

            for (int i = 0; i < size; ++i)
            {
                var item = new InvItem
                {
                    ContainerSlot = data.ReadUInt8(),
                    Slot          = data.ReadUInt8()
                };
                Items.Add(item);
            }
        }
示例#2
0
        public void Read(WorldPacket data)
        {
            data.ResetBitPos();

            uint nameLength    = data.ReadBits <uint>(10);
            uint versionLength = data.ReadBits <uint>(10);

            Loaded   = data.HasBit();
            Disabled = data.HasBit();
            if (nameLength > 1)
            {
                Name = data.ReadString(nameLength - 1);
                data.ReadUInt8(); // null terminator
            }
            if (versionLength > 1)
            {
                Version = data.ReadString(versionLength - 1);
                data.ReadUInt8(); // null terminator
            }
        }
示例#3
0
        public void Read(WorldPacket data)
        {
            Context = (ItemContext)data.ReadUInt8();
            uint bonusListIdSize = data.ReadUInt32();

            BonusListIDs = new List <uint>();
            for (uint i = 0u; i < bonusListIdSize; ++i)
            {
                uint bonusId = data.ReadUInt32();
                BonusListIDs.Add(bonusId);
            }
        }
示例#4
0
        public void Read(WorldPacket data)
        {
            Guid      = data.ReadPackedGuid();
            Status    = data.ReadUInt8();
            Moderator = data.ReadUInt8();

            bool hasUnused801_1 = data.HasBit();
            bool hasUnused801_2 = data.HasBit();
            bool hasUnused801_3 = data.HasBit();

            if (hasUnused801_1)
            {
                Unused801_1.Set(data.ReadPackedGuid());
            }
            if (hasUnused801_2)
            {
                Unused801_2.Set(data.ReadUInt64());
            }
            if (hasUnused801_3)
            {
                Unused801_3.Set(data.ReadUInt64());
            }
        }
示例#5
0
        public void Read(WorldPacket data)
        {
            ClubID      = data.ReadUInt64();
            EventID     = data.ReadUInt64();
            ModeratorID = data.ReadUInt64();
            EventType   = data.ReadUInt8();
            TextureID   = data.ReadUInt32();
            Time        = data.ReadPackedTime();
            Flags       = data.ReadUInt32();

            byte   titleLen = data.ReadBits <byte>(8);
            ushort descLen  = data.ReadBits <ushort>(11);

            Title       = data.ReadString(titleLen);
            Description = data.ReadString(descLen);
        }
示例#6
0
        public void Read(WorldPacket data)
        {
            byte   titleLength       = data.ReadBits <byte>(8);
            ushort descriptionLength = data.ReadBits <ushort>(11);

            EventType = data.ReadUInt8();
            TextureID = data.ReadInt32();
            Time      = data.ReadPackedTime();
            Flags     = data.ReadUInt32();
            var InviteCount = data.ReadUInt32();

            Title       = data.ReadString(titleLength);
            Description = data.ReadString(descriptionLength);

            for (var i = 0; i < InviteCount; ++i)
            {
                CalendarAddEventInviteInfo invite = new CalendarAddEventInviteInfo();
                invite.Read(data);
                Invites[i] = invite;
            }
        }
示例#7
0
            public void Read(WorldPacket data)
            {
                Timestamp  = data.ReadInt32();
                AuthorGUID = data.ReadPackedGuid();

                bool hasClubID       = data.HasBit();
                bool hasChannelGUID  = data.HasBit();
                bool hasRealmAddress = data.HasBit();
                bool hasSlashCmd     = data.HasBit();
                uint textLength      = data.ReadBits <uint>(12);

                if (hasClubID)
                {
                    ClubID.HasValue = true;
                    ClubID.Value    = data.ReadUInt64();
                }

                if (hasChannelGUID)
                {
                    ChannelGUID.HasValue = true;
                    ChannelGUID.Value    = data.ReadPackedGuid();
                }

                if (hasRealmAddress)
                {
                    RealmAddress.HasValue = true;
                    RealmAddress.Value.VirtualRealmAddress = data.ReadUInt32();
                    RealmAddress.Value.field_4             = data.ReadUInt16();
                    RealmAddress.Value.field_6             = data.ReadUInt8();
                }

                if (hasSlashCmd)
                {
                    SlashCmd.HasValue = true;
                    SlashCmd.Value    = data.ReadInt32();
                }

                Text = data.ReadString(textLength);
            }
示例#8
0
        //[WorldPacketHandler(ClientOpcodes.MasterLootItem)]
        void HandleLootMasterGive(WorldPacket packet)
        {
            ObjectGuid lootguid          = packet.ReadPackedGuid();
            byte       slotid            = packet.ReadUInt8();
            ObjectGuid target_playerguid = packet.ReadPackedGuid();

            if (GetPlayer().GetGroup() == null || GetPlayer().GetGroup().GetLooterGuid() != GetPlayer().GetGUID() || GetPlayer().GetGroup().GetLootMethod() != LootMethod.MasterLoot)
            {
                GetPlayer().SendLootError(lootguid, ObjectGuid.Empty, LootError.DidntKill);
                return;
            }

            // player on other map
            Player target = Global.ObjAccessor.GetPlayer(_player, target_playerguid);

            if (!target)
            {
                GetPlayer().SendLootError(lootguid, ObjectGuid.Empty, LootError.PlayerNotFound);
                return;
            }

            Log.outDebug(LogFilter.Network, "HandleLootMasterGive (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [{0}].", target.GetName());

            if (GetPlayer().GetLootGUID() != lootguid)
            {
                GetPlayer().SendLootError(lootguid, ObjectGuid.Empty, LootError.DidntKill);
                return;
            }

            if (!GetPlayer().IsInRaidWith(target) || !GetPlayer().IsInMap(target))
            {
                GetPlayer().SendLootError(lootguid, ObjectGuid.Empty, LootError.MasterOther);
                Log.outInfo(LogFilter.Loot, "MasterLootItem: Player {0} tried to give an item to ineligible player {1}!", GetPlayer().GetName(), target.GetName());
                return;
            }

            Loot loot = null;

            if (GetPlayer().GetLootGUID().IsCreatureOrVehicle())
            {
                Creature creature = GetPlayer().GetMap().GetCreature(lootguid);
                if (creature == null)
                {
                    return;
                }

                loot = creature.loot;
            }
            else if (GetPlayer().GetLootGUID().IsGameObject())
            {
                GameObject pGO = GetPlayer().GetMap().GetGameObject(lootguid);
                if (pGO == null)
                {
                    return;
                }

                loot = pGO.loot;
            }

            if (loot == null)
            {
                return;
            }

            if (slotid >= loot.items.Count + loot.quest_items.Count)
            {
                Log.outDebug(LogFilter.Loot, "MasterLootItem: Player {0} might be using a hack! (slot {1}, size {2})",
                             GetPlayer().GetName(), slotid, loot.items.Count);
                return;
            }

            LootItem item = slotid >= loot.items.Count ? loot.quest_items[slotid - loot.items.Count] : loot.items[slotid];

            List <ItemPosCount> dest = new List <ItemPosCount>();
            InventoryResult     msg  = target.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.itemid, item.count);

            if (item.follow_loot_rules && !item.AllowedForPlayer(target))
            {
                msg = InventoryResult.CantEquipEver;
            }
            if (msg != InventoryResult.Ok)
            {
                if (msg == InventoryResult.ItemMaxCount)
                {
                    GetPlayer().SendLootError(lootguid, ObjectGuid.Empty, LootError.MasterUniqueItem);
                }
                else if (msg == InventoryResult.InvFull)
                {
                    GetPlayer().SendLootError(lootguid, ObjectGuid.Empty, LootError.MasterInvFull);
                }
                else
                {
                    GetPlayer().SendLootError(lootguid, ObjectGuid.Empty, LootError.MasterOther);
                }

                target.SendEquipError(msg, null, null, item.itemid);
                return;
            }

            // not move item from loot to target inventory
            Item newitem = target.StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);

            target.SendNewItem(newitem, item.count, false, false, true);
            target.UpdateCriteria(CriteriaTypes.LootItem, item.itemid, item.count);
            target.UpdateCriteria(CriteriaTypes.LootType, item.itemid, item.count, (ulong)loot.loot_type);
            target.UpdateCriteria(CriteriaTypes.LootEpicItem, item.itemid, item.count);

            // mark as looted
            item.count     = 0;
            item.is_looted = true;

            loot.NotifyItemRemoved(slotid);
            --loot.unlootedCount;
        }
示例#9
0
 public void Read(WorldPacket data)
 {
     Value = data.ReadUInt32();
     Type  = (ItemModifier)data.ReadUInt8();
 }
示例#10
0
 public void Read(WorldPacket data)
 {
     Slot = data.ReadUInt8();
     Item.Read(data);
 }
示例#11
0
 public void Read(WorldPacket data)
 {
     PvPTalentID = data.ReadUInt16();
     Slot        = data.ReadUInt8();
 }
示例#12
0
 public void Read(WorldPacket data)
 {
     Guid      = data.ReadPackedGuid();
     Status    = data.ReadUInt8();
     Moderator = data.ReadUInt8();
 }