public ItemStackTemplate(Asda2ItemId id) : this(ItemMgr.GetTemplate(id), 1) { if (m_Template == null) { throw new ArgumentException("ItemId " + id + " is invalid."); } }
public ItemStackTemplate(ItemId id, int amount) : this(ItemMgr.GetTemplate(id), amount) { if (m_Template == null) { throw new ArgumentException("id " + id + " is invalid."); } }
public ItemStackTemplate(Asda2ItemId id, int amount) { this = new ItemStackTemplate(ItemMgr.GetTemplate(id), amount); if (this.m_Template == null) { throw new ArgumentException("id " + (object)id + " is invalid."); } }
/// <summary> /// Tries to add an Item with the given template and amount ot the given slot. /// Make sure the given targetSlot is valid before calling this method. /// </summary> /// <returns>The result (InventoryError.OK in case that it worked)</returns> public InventoryError TryAdd(ItemId id, ref int amount, int targetSlot, ItemReceptionType reception = ItemReceptionType.Receive) { var templ = ItemMgr.GetTemplate(id); if (templ != null) { return(TryAdd(templ, ref amount, targetSlot, reception)); } return(InventoryError.ITEM_NOT_FOUND); }
/// <summary> /// Tries to add ONE new item with the given template to the given slot. /// Make sure the given targetSlot is valid before calling this method. /// </summary> /// <returns>The result (InventoryError.OK in case that it worked)</returns> public InventoryError TryAdd(ItemId id, int targetSlot, ItemReceptionType reception = ItemReceptionType.Receive) { var templ = ItemMgr.GetTemplate(id); if (templ != null) { return(TryAdd(templ, targetSlot, reception)); } return(InventoryError.Invalid); }
/// <summary> /// Tries to add ONE new item with the given template to the given slot. /// Make sure the given targetSlot is valid before calling this method. /// </summary> /// <returns>The result (InventoryError.OK in case that it worked)</returns> public InventoryError TryAdd(Asda2ItemId id, InventorySlot targetSlot, ItemReceptionType reception = ItemReceptionType.Receive) { var templ = ItemMgr.GetTemplate(id); if (templ != null) { return(TryAdd(templ, (int)targetSlot, reception)); } return(InventoryError.ITEM_NOT_FOUND); }
/// <summary> /// Tries to add an Item with the given template and amount ot the given slot. /// Make sure the given targetSlot is valid before calling this method. /// </summary> /// <returns>The result (InventoryError.OK in case that it worked)</returns> public InventoryError TryAdd(Asda2ItemId id, ref int amount, int targetSlot, ItemReceptionType reception = ItemReceptionType.Receive) { ItemTemplate template = ItemMgr.GetTemplate(id); if (template != null) { return(this.TryAdd(template, ref amount, targetSlot, reception)); } return(InventoryError.ITEM_NOT_FOUND); }
/// <summary> /// Tries to add ONE new item with the given template to the given slot. /// Make sure the given targetSlot is valid before calling this method. /// </summary> /// <returns>The result (InventoryError.OK in case that it worked)</returns> public InventoryError TryAdd(Asda2ItemId id, int targetSlot, ItemReceptionType reception = ItemReceptionType.Receive) { ItemTemplate template = ItemMgr.GetTemplate(id); if (template != null) { return(this.TryAdd(template, targetSlot, reception)); } return(InventoryError.Invalid); }
/// <summary> /// Tries to add a new item with the given template and amount ot the given slot. /// Make sure the given targetSlot is valid before calling this method. /// If slot is occupied, method will find another unoccupied slot. /// </summary> /// <returns>The result (InventoryError.OK in case that it worked)</returns> public InventoryError TryAdd(Asda2ItemId id, ref int amount, InventorySlot targetSlot, ItemReceptionType reception = ItemReceptionType.Receive) { ItemTemplate template = ItemMgr.GetTemplate(id); if (template != null) { return(TryAdd(template, ref amount, (int)targetSlot, reception)); } return(InventoryError.Invalid); }
public Item AddUnchecked(int slot, ItemId id, int amount, bool isNew) { var templ = ItemMgr.GetTemplate(id); return(AddUnchecked(slot, templ, amount, isNew)); }
/// <summary> /// Tries to add a new item with the given id to a free slot. /// </summary> /// <returns>The result (InventoryError.OK in case that it worked)</returns> public InventoryError TryAdd(ItemId id, ItemReceptionType reception = ItemReceptionType.Receive) { return(TryAdd(ItemMgr.GetTemplate(id), reception)); }
public Item AddUnchecked(int slot, Asda2ItemId id, int amount, bool isNew) { ItemTemplate template = ItemMgr.GetTemplate(id); return(this.AddUnchecked(slot, template, amount, isNew)); }
internal static void EnsureItemQuestRelations() { foreach (QuestTemplate template1 in QuestMgr.Templates) { if (template1 != null && template1.CollectableItems != null) { foreach (Asda2ItemStackDescription collectableItem in template1.CollectableItems) { ItemTemplate template2 = ItemMgr.GetTemplate(collectableItem.ItemId); if (template2 == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", (object)template1, (object)collectableItem); } else if (template2.CollectQuests == null) { template2.CollectQuests = new QuestTemplate[1] { template1 }; } else { int num = (int)ArrayUtil.AddOnlyOne <QuestTemplate>(ref template2.CollectQuests, template1); } } foreach (Asda2ItemStackDescription collectableSourceItem in template1.CollectableSourceItems) { ItemTemplate template2 = ItemMgr.GetTemplate(collectableSourceItem.ItemId); if (template2 == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", (object)template1, (object)collectableSourceItem); } else if (template2.CollectQuests == null) { template2.CollectQuests = new QuestTemplate[1] { template1 }; } else { int num = (int)ArrayUtil.AddOnlyOne <QuestTemplate>(ref template2.CollectQuests, template1); } } } } foreach (ItemTemplate template1 in ItemMgr.Templates) { if (template1 != null && template1.QuestId != 0U) { QuestTemplate template2 = QuestMgr.GetTemplate(template1.QuestId); if (template2 == null) { ContentMgr.OnInvalidDBData("Item {0} had invalid QuestId: {1}", (object)template1, (object)template1.QuestId); } else { template2.Starters.Add((IQuestHolderEntry)template1); } } } }