Пример #1
0
        public static Item Create(ItemTemplate template)
        {
            if(template == null) {
                return null;
            }
            Item item = !template.IsContainer
                            ? new Item(template)
                            : new Container(template) { NumSlots = (uint)template.ContainerSlots };
            item.Entry = (uint)template.Id;
            item.Durability = (uint)template.MaxDurability;
            item.MaxDurability = (uint)template.MaxDurability;
            item.Flags = (uint)template.Flags;
            item.Duration = (uint)template.AttackTime;
            item.StackCount = (uint)template.MaxAmount;

            return item;
        }
Пример #2
0
        private static IPacket GetItemQuerySingleResponsePkt(ItemTemplate template)
        {
            IPacket packet = WorldPacketFactory.Create(WMSG.SMSG_ITEM_QUERY_SINGLE_RESPONSE);
            BinaryWriter writer = packet.CreateWriter();
            writer.Write(template.Id);
            writer.Write(template.ObjectClass);
            writer.Write(template.SubClass);
            writer.Write(template.Unk1);
            writer.WriteCString(template.Name);
            writer.WriteCString(template.Name2);
            writer.WriteCString(template.Name3);
            writer.WriteCString(template.Name4);
            writer.Write(template.DisplayId);
            writer.Write(template.Quality);
            writer.Write(template.Flags);
            writer.Write(template.Faction);
            writer.Write(template.BuyPrice);
            writer.Write(template.SellPrice);
            writer.Write((int)template.InventoryType);
            writer.Write(template.RequiredClassMask);
            writer.Write(template.RequiredRaceMask);
            writer.Write(template.Level);
            writer.Write(template.RequiredLevel);
            writer.Write(template.RequiredSkill);
            writer.Write(template.RequiredSkillValue);
            writer.Write(template.RequiredSpell);
            writer.Write(template.RequiredPvPRank);
            writer.Write(template.RequiredPvPMedal);
            writer.Write(template.RequiredFaction);
            writer.Write(template.RequiredFactionStanding);
            writer.Write(template.UniqueCount);
            writer.Write(template.MaxAmount);
            writer.Write(template.ContainerSlots);

            writer.Write(10);
            for(int i = 0; i < 10; i++) {
                writer.Write(template.bonuses[i].Type);
                writer.Write(template.bonuses[i].Value);
            }

            writer.Write(0); // NEW 3.0.2 ScalingStatDistribution.dbc
            writer.Write(0); // NEW 3.0.2 ScalingStatFlags

            for(int i = 0; i < 2; i++) {
                writer.Write(template.damages[i].Min);
                writer.Write(template.damages[i].Max);
                writer.Write(template.damages[i].School);
            }

            for(int i = 0; i < 7; i++) {
                writer.Write(template.Resistance[i]);
            }

            writer.Write(template.AttackTime); //
            writer.Write(template.ProjectileType);
            writer.Write(template.RangeModifier);

            for(int i = 0; i < 5; i++) {
                writer.Write(template.spells[i].Id);
                writer.Write(template.spells[i].Trigger);
                writer.Write(template.spells[i].Charges);
                writer.Write(template.spells[i].Cooldown);
                writer.Write(template.spells[i].CategoryId);
                writer.Write(template.spells[i].CategoryCooldown);
            }

            writer.Write(template.BondType);
            writer.WriteCString(template.Description);
            writer.Write(template.PageTextId);
            writer.Write(template.PaeCount);
            writer.Write(template.PageMaterial);
            writer.Write(template.QuestId);
            writer.Write(template.LockId);
            writer.Write(template.Material);
            writer.Write(template.SheathType);
            writer.Write(template.RandomPropertiesId);
            writer.Write(template.RandomSuffixId);
            writer.Write(template.BlockValue);
            writer.Write(template.SetId);
            writer.Write(template.MaxDurability);
            writer.Write(template.ZoneId);
            writer.Write(template.MapId);
            writer.Write(template.BagFamily);
            writer.Write(template.TotemCategory);

            for(int i = 0; i < 3; i++) {
                writer.Write(template.sockets[i].Color);
                writer.Write(template.sockets[i].Content);
            }

            writer.Write(template.SocketBonusEnchantId);
            writer.Write(template.GemPropertiesId);
            writer.Write(template.RequiredDisenchantingLevel);
            writer.Write(template.ArmorModifier);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            return packet;
        }
Пример #3
0
 public void SendItemQuerySingleResponse(ItemTemplate template)
 {
     Send(GetItemQuerySingleResponsePkt(template));
 }
Пример #4
0
 public Item(ItemTemplate template)
 {
     this.template = template;
     Type |= ObjectTypes.Item;
 }
Пример #5
0
 public Container(ItemTemplate template)
     : base(template)
 {
     Type |= ObjectTypes.Container;
     inventory = new ContainerInventory(this, (uint)template.ContainerSlots);
 }