Пример #1
0
		public LootItem(ItemTemplate templ, int amount, uint index, uint randomPropertyId)
		{
			Template = templ;
			Amount = amount;
			Index = index;
			RandomPropertyId = randomPropertyId;
		}
Пример #2
0
		public int GetHappinessGain(ItemTemplate food)
		{
			if (food == null) return 0;

			// TODO: Replace constants with named Variables
			var diff = (Level - (int)food.Level);
			if (diff > 0)
			{
				if (diff < 16)
				{
					return PetMgr.MaxFeedPetHappinessGain;
				}
				if (diff < 26)
				{
					return (PetMgr.MaxFeedPetHappinessGain / 2);
				}
				if (diff < 36)
				{
					return (PetMgr.MaxFeedPetHappinessGain / 4);
				}
			}
			else
			{
				if (diff > -16)
				{
					return PetMgr.MaxFeedPetHappinessGain;
				}
			}
			return 0;
		}
Пример #3
0
		public void FinalizeDataHolder()
		{
			Template = ItemMgr.GetTemplate(ItemId);
			if (Template == null)
			{
				ContentMgr.OnInvalidDBData("{0} has invalid ItemId: {1} ({2})", this, ItemId, (int)ItemId);
			}
			else
			{
				var list = NPCMgr.GetOrCreateVendorList(VendorId);

				// set defaults
				if (StockAmount < 0)
				{
					StockAmount = Template.StockAmount;
				}
				if (StockRefillDelay < 0)
				{
					StockRefillDelay = Template.StockRefillDelay;
				}

				remainingStackAmount = StockAmount;
				list.Add(this);
			}
		}
Пример #4
0
		/// <param name="template">The ItemTemplate for this item.</param>
		/// <param name="numStacksForSale">The maximum number of lots of this item the vendor can sell per period of time. 0xFFFFFFFF means infinite.</param>
		/// <param name="buyStackSize">The vendor sells these items in lots of buyStackSize.</param>
		/// <param name="regenTime">If the vendor has a limited number of this item to sell, this is the time it takes to regen one item.</param>
		public VendorItem( ItemTemplate template, uint numStacksForSale, uint buyStackSize, uint regenTime )
		{
			Template = template;
			this.numStacksForSale = numStacksForSale;
			maxStacksForSale = numStacksForSale;
			BuyStackSize = buyStackSize;

			lastUpdate = DateTime.Now;
			this.regenTime = regenTime;
		}
Пример #5
0
		public static void SendItemNameQueryResponse(IPacketReceiver client, ItemTemplate item)
		{
			using (var outPacket = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_NAME_QUERY_RESPONSE, 4 + item.DefaultName.Length))
			{
				outPacket.WriteInt(item.Id);
				outPacket.WriteCString(item.DefaultName);

				client.Send(outPacket);
			}
		}
Пример #6
0
		public override SpellFailedReason CheckValidTarget(WorldObject target)
		{
			var templId = Effect.ItemId;
			templ = ItemMgr.GetTemplate(templId);
			amount = CalcEffectValue();

			if (templ == null)
			{
				log.Warn("Spell {0} referred to invalid Item {1}", Effect.Spell, templId);
				return SpellFailedReason.ItemNotFound;
			}

		    // find a free slot
		    slotId = ((Character)target).Inventory.FindFreeSlotCheck(templ, amount);
		    if (slotId.Slot == BaseInventory.INVALID_SLOT)
		    {
		        ItemHandler.SendInventoryError((Character)target, InventoryError.INVENTORY_FULL);
		        return SpellFailedReason.DontReport;
		    }

		    return SpellFailedReason.Ok;
		}
Пример #7
0
		public override SpellFailedReason InitializeTarget(WorldObject target)
		{
			var templId = Effect.ItemId;
			templ = ItemMgr.GetTemplate(templId);
			amount = CalcEffectValue();

			if (templ == null)
			{
				log.Warn("Spell {0} referred to invalid Item {1}", Effect.Spell, templId);
				return SpellFailedReason.ItemNotFound;
			}

			// find a free slot
			// TODO: Add & use HoldFreeSlotCheck instead, so slot won't get occupied
			InventoryError error;
			slotId = ((Character)target).Inventory.FindFreeSlotCheck(templ, amount, out error);
			if (error != InventoryError.OK)
			{
				ItemHandler.SendInventoryError((Character)target, error);
				return SpellFailedReason.DontReport;
			}

			return SpellFailedReason.Ok;
		}
Пример #8
0
		public InventoryError Ensure(ItemTemplate templ, int amount, bool equip)
		{
			if (equip && templ.EquipmentSlots == null)
			{
				return InventoryError.ITEM_CANT_BE_EQUIPPED;
			}

			if (templ.EquipmentSlots != null)
			{
				for (var i = 0; i < templ.EquipmentSlots.Length; i++)
				{
					var slot = templ.EquipmentSlots[i];
					var item = m_Items[(int)slot];
					if (item != null && item.Template.Id == templ.Id)
					{
						// done
						return InventoryError.OK;
					}
				}
			}

			var found = 0;
			if (Iterate(item =>
			{
				if (item.Template == templ)
				{
					found += item.Amount;
					if (equip && !item.IsEquipped)
					{
						TryEquip(this, item.Slot);
						return false;
					}
					else if (found >= amount)
					{
						return false;
					}
				}
				return true;
			}))
			{
				// didn't add everything yet
				amount -= found;
				if (!equip)
				{
					return TryAdd(templ, ref amount);
				}

				var slot = GetEquipSlot(templ, true);
				if (slot == InventorySlot.Invalid)
				{
					return InventoryError.INVENTORY_FULL;
				}
				return TryAdd(templ, slot);
			}
			return InventoryError.OK;
		}
Пример #9
0
		public InventoryError Ensure(ItemTemplate templ, int amount)
		{
			return Ensure(templ, amount, AutoEquipNewItems);
		}
Пример #10
0
		/// <summary>
		/// Tries to add a single new item with the given template to the given slot.
		/// Make sure the given targetSlot is valid before calling this method.
		/// </summary>
		public InventoryError TryAdd(ItemTemplate template, EquipmentSlot targetSlot)
		{
			var amount = 1;
			return TryAdd(template, ref amount, (int)targetSlot, true);
		}
Пример #11
0
		/// <summary>
		/// Finds a free slot after checking for uniqueness
		/// </summary>
		/// <param name="templ"></param>
		/// <param name="amount"></param>
		/// <returns></returns>
		public SimpleSlotId FindFreeSlotCheck(ItemTemplate templ, int amount)
		{
			var err = InventoryError.OK;
			var possibleAmount = amount;
			CheckUniqueness(templ, ref possibleAmount, ref err, true);
			if (possibleAmount != amount)
			{
				return SimpleSlotId.Default;
			}

			return FindFreeSlot(templ, amount);
		}
Пример #12
0
 private static void SendRefundInfo(IRealmClient client, ItemTemplate item)
 {
     //throw new NotImplementedException();
 }
Пример #13
0
        /// <summary>
        /// Sends the Item's PushResult (required after adding items).
        /// </summary>
        public static void SendItemPushResult(Character owner, Item item, ItemTemplate templ, int amount, ItemReceptionType reception)
        {
            bool isStacked;
            int contSlot;
            uint propertySeed, randomPropid;
            if (item != null)
            {
                contSlot = item.Container.Slot;
                isStacked = item.Amount != amount; // item.Amount == amount means that it was not added to an existing stack
                propertySeed = item.PropertySeed;
                randomPropid = item.RandomPropertiesId;
            }
            else
            {
                contSlot = BaseInventory.INVALID_SLOT;
                isStacked = true;													// we did not have an item -> stacked
                propertySeed = 0;
                randomPropid = 0;
            }

            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_PUSH_RESULT, 45))
            {
                packet.Write(owner.EntityId);
                packet.Write((ulong)reception);

                //packet.Write(received ? 1 : 0);										// 0 = "You looted...", 1 = "You received..."
                //packet.Write(isNew ? 1 : 0);										// 0 = "You received/looted...", 1 = "You created..."

                packet.Write(1);													// log message
                packet.Write((byte)contSlot);
                packet.Write(isStacked ? -1 : item.Slot);
                packet.Write(templ.Id);
                packet.Write(propertySeed);
                packet.Write(randomPropid);
                packet.Write(amount);												// amount added
                packet.Write(owner.Inventory.GetAmount(templ.ItemId));				// amount of that type of item in inventory

                owner.Send(packet);
            }
        }
Пример #14
0
		public override bool Distribute(ItemTemplate template, ref int amount)
		{
			// distribute to ammo
			if (m_ammo != null && m_ammo.Template == template)
			{
				var diff = template.MaxAmount - m_ammo.Amount;
				if (diff > 0)
				{
					if (amount <= diff)
					{
						m_ammo.Amount += amount;
						return true;		// done
					}

					m_ammo.Amount += diff;
					amount -= diff;
				}
			}
			return base.Distribute(template, ref amount);
		}
Пример #15
0
		/// <summary>
		/// Set the Item at the given slot on this corpse.
		/// </summary>
		public void SetItem(EquipmentSlot slot, ItemTemplate template)
		{
			//var id = (template.DisplayId & 0x00FFFFFF) | (uint)((int)template.InventorySlotType << 24);
			var id = template.DisplayId | (uint)((int)template.InventorySlotType << 24);
			var slotId = (int)CorpseFields.ITEM + (int)slot;
            
            SetUInt32(slotId, id);

			//Array.Copy(characterFields, (int)PlayerFields.VISIBLE_ITEM_1_0,
			//    m_updateValues, (int)CorpseFields.ITEM, EmptyItemFields.Length);

			//if (!m_queuedForUpdate && m_isInWorld)
			//{
			//    RequestUpdate();
			//}
		}
Пример #16
0
 public ItemStackTemplate(ItemTemplate templ)
     : this(templ, templ.MaxAmount)
 {
 }
Пример #17
0
 /// <summary>
 /// For templates of Containers only, checks whether the given
 /// Template may be added
 /// </summary>
 /// <param name="templ"></param>
 /// <returns></returns>
 public bool MayAddToContainer(ItemTemplate templ)
 {
     return BagFamily == 0 || templ.BagFamily.HasAnyFlag(BagFamily);
 }
Пример #18
0
 public ItemStackTemplate(ItemTemplate templ, int amount)
 {
     m_Template = templ;
     m_Amount = amount;
 }
Пример #19
0
		internal bool CheckEquippedGems(ItemTemplate gemTempl)
		{
			if (gemTempl != null && gemTempl.Flags.HasFlag(ItemFlags.UniqueEquipped))
			{
				// may only equip a certain maximum of this kind of gem
				for (var slot = EquipmentSlot.Head; slot < EquipmentSlot.Bag1; slot++)
				{
					var item = this[slot];
					if (item != null && item.HasGem(gemTempl.ItemId))
					{
						return false;
					}
				}
			}
			return true;
		}
Пример #20
0
		public static ItemRecord CreateRecord(ItemTemplate templ)
		{
			var item = CreateRecord();
			item.EntryId = templ.Id;

			item.Amount = templ.MaxAmount;
			item.Durability = templ.MaxDurability;
			item.Flags = templ.Flags;
			item.ItemTextId = templ.PageTextId;
			item.RandomProperty = (int)(templ.RandomPropertiesId != 0 ? templ.RandomPropertiesId : templ.RandomSuffixId);
			item.RandomSuffix = (int) templ.RandomSuffixId;
			item.Duration = templ.Duration;

			if (templ.UseSpell != null)
			{
				item.Charges = (short)templ.UseSpell.Charges;
			}
			return item;
		}
Пример #21
0
		/// <summary>
		/// Finds a free slot after checking for uniqueness
		/// </summary>
		/// <param name="templ"></param>
		/// <param name="amount"></param>
		/// <returns></returns>
		public SimpleSlotId FindFreeSlotCheck(ItemTemplate templ, int amount, out InventoryError err)
		{
			err = InventoryError.OK;
			var possibleAmount = amount;
			CheckUniqueness(templ, ref possibleAmount, ref err, true);
			if (possibleAmount != amount)
			{
				return SimpleSlotId.Default;
			}

			var slot = FindFreeSlot(templ, amount);
			if (slot.Slot == INVALID_SLOT)
			{
				err = InventoryError.INVENTORY_FULL;
			}
			return slot;
		}
Пример #22
0
        public static void SendItemQueryResponse(RealmClient client, ItemTemplate item)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE, 630))
            {
                packet.Write(item.Id);
                packet.WriteInt((int)item.ItemClass);
                packet.WriteInt((int)item.ItemSubClass);
                packet.WriteInt(-1); // unknown

                packet.WriteCString(item.Name);
                packet.WriteByte(0);// name2
                packet.WriteByte(0);// name3
                packet.WriteByte(0);// name4

                packet.WriteInt(item.DisplayId);
                packet.WriteInt((int)item.Quality);
                packet.WriteInt((int)item.Flags);
                packet.WriteInt(item.BuyPrice);
                packet.WriteInt(item.SellPrice);
                packet.WriteInt((int)item.InventorySlot);
                packet.WriteInt((int)item.RequiredClassMask);
                packet.WriteInt((int)item.RequiredRaceMask);
                packet.WriteInt(item.Level);
                packet.WriteInt(item.RequiredLevel);
                packet.WriteInt(item.RequiredSkill != null ? (int)item.RequiredSkill.Id : 0);
                packet.WriteInt(item.RequiredSkillLevel);
                packet.WriteInt(item.RequiredProfession != null ? (int)item.RequiredProfession.Id : 0);
                packet.WriteInt(item.RequiredPvPRank);
                packet.WriteInt(item.UnknownRank);// city rank?
                packet.WriteInt(item.RequiredFaction != null ? (int)item.RequiredFaction.Id : 0);
                packet.WriteInt((int)item.RequiredFactionStanding);
                packet.WriteInt(item.UniqueCount);
                packet.WriteInt(item.MaxAmount);
                packet.WriteInt(item.ContainerSlots);
               foreach (var stat in item.Mods)
                {
					packet.WriteUInt((uint)stat.Type);
                    packet.WriteInt(stat.Value);
                }

                foreach (var dmg in item.Damages)
                {
					packet.WriteFloat(dmg.Minimum);
					packet.WriteFloat(dmg.Maximum);
					packet.WriteUInt((uint)dmg.DamageSchool);
                }

                foreach (var res in item.Resistances)
                {
                    packet.WriteUInt(res);
                }

                packet.WriteUInt(item.WeaponSpeed);
				packet.WriteUInt((uint)item.ProjectileType);
                packet.WriteFloat(item.RangeModifier);

                for (int i = 0; i < 5; i++)
                {
					packet.WriteUInt(item.Spells[i].Id);
					packet.WriteUInt((int)item.Spells[i].Trigger);
					packet.WriteUInt(item.Spells[i].Charges);
                    packet.WriteInt(item.Spells[i].Cooldown);
                    packet.WriteUInt(item.Spells[i].CategoryId);
                    packet.WriteInt(item.Spells[i].CategoryCooldown);
                }

				packet.WriteUInt((int)item.BondType);
                packet.WriteCString(item.Description);

				packet.Write(item.PageTextId);
				packet.Write(item.PageCount);
				packet.Write(item.PageMaterial);
				packet.Write(item.QuestId);
				packet.Write(item.RequiredLockpickSkill);
				packet.Write(item.Material);
				packet.Write((uint)item.SheathType);
				packet.Write(item.RandomPropertyId);
				packet.Write(item.RandomSuffixId);
				packet.Write(item.BlockValue);
				packet.Write(item.SetId);
				packet.Write(item.MaxDurability);
				packet.Write((uint)item.ZoneId);
				packet.Write((uint)item.MapId);
				packet.Write((uint)item.BagFamily);
				packet.Write(item.TotemCategory);

				for (int i = 0; i < ItemTemplate.MaxSocketCount; i++)
                {
                    packet.WriteInt(item.Sockets[i].SocketColor);
                    packet.WriteInt(item.Sockets[i].Unknown);
                }
                packet.WriteInt(item.SocketBonusId);
                packet.WriteInt(item.GemProperties);
                packet.WriteInt(item.ExtendedCost);
                packet.WriteInt(item.RequiredArenaRanking);
                packet.WriteInt(item.RequiredDisenchantingLevel);
                packet.WriteFloat(item.ArmorModifier);

                client.Send(packet);
            }
        }
Пример #23
0
		/// <summary>
		/// Sets slotId to the slot that the given templ would prefer (if it has any bag preference).
		/// </summary>
		/// <param name="templ"></param>
		/// <param name="slotId"></param>
		public void GetPreferredSlot(ItemTemplate templ, int amount, ref SimpleSlotId slotId)
		{
			if (templ.IsKey)
			{
				slotId.Container = this;
				slotId.Slot = KeyRing.FindFreeSlot();
			}
			else if (!templ.IsContainer && templ.BagFamily != ItemBagFamilyMask.None)
			{
				for (var slot = InventorySlot.Bag1; slot <= InventorySlot.BagLast; slot++)
				{
					var bag = this[slot] as Container;
					if (bag != null && bag.Template.BagFamily != 0)
					{
						var inv = bag.BaseInventory;
						if (bag.Template.MayAddToContainer(templ))
						{
							slotId.Slot = inv.FindFreeSlot();
							if (slotId.Slot != INVALID_SLOT)
							{
								slotId.Container = inv;
								break;
							}
						}
					}
				}
			}
		}
Пример #24
0
			public static bool AddItem(Character chr, ItemTemplate templ, int amount, bool autoEquip, bool ensureOnly)
			{
				var actualAmount = amount;
				var inv = chr.Inventory;

				InventoryError err;
				if (ensureOnly)
				{
					// only add if necessary
					err = inv.Ensure(templ, amount, autoEquip);
				}
				else
				{
					if (autoEquip)
					{
						// auto-equip
						var slot = inv.GetEquipSlot(templ, true);
						if (slot == InventorySlot.Invalid)
						{
							err = InventoryError.INVENTORY_FULL;
						}
						else
						{
							err = inv.TryAdd(templ, slot);
						}
					}
					else
					{
						// just add
						err = inv.TryAdd(templ, ref amount);
					}
				}

				if (err != InventoryError.OK || amount < actualAmount)
				{
					// something went wrong
					if (err != InventoryError.OK)
					{
						ItemHandler.SendInventoryError(chr.Client, null, null, err);
					}
					return false;
				}
				return true;
			}
Пример #25
0
		/// <summary>
		/// Adds a new default Item to the given slot, if not already existing
		/// </summary>
		public Item EnsureItem(ItemTemplate template, int amount)
		{
			var slotId = m_inventory.FindFreeSlot(template, amount);
			Assert.AreNotEqual(BaseInventory.INVALID_SLOT, slotId.Slot);

			var item = slotId.Container.AddUnchecked(slotId.Slot, template, amount, true);
			Assert.IsTrue(item.IsInWorld);
			return item;
		}
Пример #26
0
		/// <summary>
		/// Returns a free EquipmentSlot (or the first allowed slot). 
		/// If force is set and there is no free slot and the backpack still has space, it will unequip the
		/// item in the first possible slot to the backpack or an equipped bag.
		/// </summary>
		public InventorySlot GetEquipSlot(ItemTemplate templ, bool force)
		{
			var possibleSlots = templ.EquipmentSlots;

			if (templ.IsMeleeWeapon)
			{
				// special case: Trying to equip 1h weapon when 2h weapon is equipped
				var mhWeapon = this[EquipmentSlot.MainHand];
				if (mhWeapon != null && mhWeapon.Template.IsTwoHandWeapon)
				{
					return InventorySlot.MainHand;
				}
			}

			// see if we got a free slot
			for (var i = 0; i < possibleSlots.Length; i++)
			{
				var slot = possibleSlots[i];
				if (slot == EquipmentSlot.OffHand && !m_owner.Skills.CanDualWield)
				{
					continue;
				}

				var occupyingItem = this[(int)slot];
				if (occupyingItem == null)
				{
					return (InventorySlot)slot;
				}
			}

			// no free slot, use the first one
			var firstSlot = possibleSlots[0];
			if (force)
			{
				// var lastSlot = possibleSlots[possibleSlots.Length - 1];
				if (!EnsureEmpty(firstSlot))
				{
					return InventorySlot.Invalid;
				}
			}

			return (InventorySlot)firstSlot;
		}
Пример #27
0
        public static void SendItemQueryResponse(IRealmClient client, ItemTemplate item)
        {
            var locale = client.Info.Locale;
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE, 630))
            {
                packet.Write(item.Id);
                packet.Write((uint)item.Class);
                packet.Write((uint)item.SubClass);
                packet.Write(item.Unk0); // unknown

                packet.WriteCString(item.Names.Localize(locale));
                packet.Write((byte)0);// name2
                packet.Write((byte)0);// name3
                packet.Write((byte)0);// name4

                packet.Write(item.DisplayId);
                packet.Write((uint)item.Quality);
                packet.Write((uint)item.Flags);
                packet.Write((uint)item.Flags2);		// new 3.2.0
                packet.Write(item.BuyPrice);
                packet.Write(item.SellPrice);
                packet.Write((uint)item.InventorySlotType);
                packet.Write((uint)item.RequiredClassMask);
                packet.Write((uint)item.RequiredRaceMask);
                packet.Write(item.Level);
                packet.Write(item.RequiredLevel);
                packet.Write(item.RequiredSkill != null ? (int)item.RequiredSkill.Id : 0);
                packet.Write(item.RequiredSkillValue);
                packet.Write(item.RequiredProfession != null ? item.RequiredProfession.Id : 0);
                packet.Write(item.RequiredPvPRank);
                packet.Write(item.UnknownRank);// PVP Medal
                packet.Write(item.RequiredFaction != null ? (int)item.RequiredFaction.Id : 0);
                packet.Write((uint)item.RequiredFactionStanding);
                packet.Write(item.UniqueCount);
                packet.Write(item.MaxAmount);
                packet.Write(item.ContainerSlots);

                packet.Write(item.Mods.Length);
                for (var m = 0; m < item.Mods.Length; m++)
                {
                    packet.Write((uint)item.Mods[m].Type);
                    packet.Write(item.Mods[m].Value);
                }

                packet.Write(item.ScalingStatDistributionId);// NEW 3.0.2 ScalingStatDistribution.dbc
                packet.Write(item.ScalingStatValueFlags);// NEW 3.0.2 ScalingStatFlags

                // In 3.1 there are only 2 damages instead of 5
                for (var i = 0; i < ItemConstants.MaxDmgCount; i++)
                {
                    if(i >= item.Damages.Length)
                    {
                        packet.WriteFloat(0f);
                        packet.WriteFloat(0f);
                        packet.WriteUInt(0u);
                        continue;
                    }

                    var dmg = item.Damages[i];

                    packet.Write(dmg.Minimum);
                    packet.Write(dmg.Maximum);
                    packet.Write((uint)dmg.School);
                }

                for (var i = 0; i < ItemConstants.MaxResCount; i++)
                {
                    var res = item.Resistances[i];
                    packet.Write(res);
                }

                packet.Write(item.AttackTime);
                packet.Write((uint)item.ProjectileType);
                packet.Write(item.RangeModifier);

                for (var s = 0; s < ItemConstants.MaxSpellCount; s++)
                {
                    ItemSpell spell;
                    if(s < item.Spells.Length && (spell = item.Spells[s]) != null)
                    {
                        packet.Write((uint)spell.Id);
                        packet.Write((uint)spell.Trigger);
                        packet.Write((uint)Math.Abs(spell.Charges));
                        packet.Write(spell.Cooldown);
                        packet.Write(spell.CategoryId);
                        packet.Write(spell.CategoryCooldown);
                    }
                    else
                    {
                        packet.WriteUInt(0u);
                        packet.WriteUInt(0u);
                        packet.WriteUInt(0u);
                        packet.Write(-1);
                        packet.WriteUInt(0u);
                        packet.Write(-1);
                    }
                }

                packet.Write((uint)item.BondType);
                packet.WriteCString(item.Descriptions.Localize(locale));

                packet.Write(item.PageTextId);
                packet.Write((uint)item.LanguageId);
                packet.Write((uint)item.PageMaterial);
                packet.Write(item.QuestId);
                packet.Write(item.LockId);
                packet.Write((int)item.Material);
                packet.Write((uint)item.SheathType);
                packet.Write(item.RandomPropertiesId);
                packet.Write(item.RandomSuffixId);
                packet.Write(item.BlockValue);
                packet.Write((uint)item.SetId);
                packet.Write(item.MaxDurability);
                packet.Write((uint)item.ZoneId);
                packet.Write((uint)item.MapId);
                packet.Write((uint)item.BagFamily);
                packet.Write((uint)item.ToolCategory);

                for (var i = 0; i < ItemConstants.MaxSocketCount; i++)
                {
                    packet.Write((uint)item.Sockets[i].Color);
                    packet.Write(item.Sockets[i].Content);
                }

                packet.Write(item.SocketBonusEnchantId);
                packet.Write(item.GemPropertiesId);
                packet.Write(item.RequiredDisenchantingLevel);
                packet.Write(item.ArmorModifier);

                packet.Write(item.Duration);// Exisiting duration in seconds
                packet.Write(item.ItemLimitCategoryId);// NEW 3.0.2 ItemLimitCategory.dbc

                packet.Write(item.HolidayId); // NEW 3.1.0 Holidays.dbc

                client.Send(packet);
            }
        }
Пример #28
0
		internal void ModUniqueCount(ItemTemplate templ, int delta)
		{
			if (templ.UniqueCount > 0)
			{
				int count;
				UniqueCounts.TryGetValue(templ.ItemId, out count);
				UniqueCounts[templ.ItemId] = count + delta;
			}
		}
Пример #29
0
		static void SetupBow()
		{
			// Farstrider's Bow (ID: 24136 [FarstridersBow])
			Bow = new ItemTemplate
			{
				Id = ItemMinId,
				AttackTime = 1000,
				DefaultName = "Sample Bow",
				Class = ItemClass.Weapon,
				SubClass = ItemSubClass.WeaponBow,
				DisplayId = 18350,
				Quality = ItemQuality.Uncommon,
				BuyPrice = 1421,
				SellPrice = 284,
				Level = 12,
				InventorySlotType = InventorySlotType.WeaponRanged,
				Damages = new[] { new DamageInfo { Minimum = 14, Maximum = 25 } },
				BondType = ItemBondType.OnPickup,
				Material = Material.Wood,
				MaxDurability = 35,

				RequiredDisenchantingLevel = 1,
				RequiredClassMask = ClassMask.Hunter
			};

			Bow.FinalizeDataHolder();
		}
Пример #30
0
		public ItemRecord AddItem(ItemTemplate template)
		{
			var record = ItemRecord.CreateRecord(template);
			AddItem(record);
			return record;
		}