/// <summary> /// Initializes a new instance of the <see cref="InventoryItem"/> class. /// </summary> /// <param name="itemKey">Unique identifier of the item to wrap.</param> /// <param name="defaultPreUseSleep">Default number of milliseconds to wait before using the item.</param> /// <param name="defaultPostUseSleep">Default number of milliseconds to wait after using the item.</param> /// <param name="defaultMaxTimeout">Default timeout for item action to execute.</param> /// <param name="defaultMountBehavior">Default mount behavior. Set to true if player should dismount when /// using the item action.</param> public InventoryItem(InventoryItemKey itemKey, int defaultPreUseSleep = 500, int defaultPostUseSleep = 1500, TimeSpan?defaultMaxTimeout = null, bool defaultMountBehavior = false) { if (itemKey == null || itemKey.Id == 0) { throw new ArgumentException("InventoryItem(itemId) must be defined with an Id greater than 0."); } this.itemKey = itemKey; this.defaultMaxTimeout = defaultMaxTimeout ?? new TimeSpan(0, 0, 0, DEFAULT_TIMEOUT_SECONDS); this.defaultMountBehavior = defaultMountBehavior; this.defaultPreUseSleep = defaultPreUseSleep; this.defaultPostUseSleep = defaultPostUseSleep; this.itemData = new Lazier <Item>(GetItem, LazyThreadSafetyMode.ExecutionAndPublication, true); this.spellData = new Lazier <SpellData>(GetBackingAction, LazyThreadSafetyMode.ExecutionAndPublication, true); }
protected bool Equals(InventoryItemKey other) { return(Id == other.Id && Hq == other.Hq); }