/// <summary> /// Add/Subtract stacked item or add a item to inventory /// </summary> /// <param name="ie"></param> public void InventoryReplaceAdd(InventoryEntries ie) { lock (Inventory) { ItemHandler.Item it = new ItemHandler.Item(ie.Item.lowID); // if (it.isStackable()) { foreach (InventoryEntries ia in Inventory) { if ((ia.Item.lowID == ie.Item.lowID) && (ia.Item.highID == ie.Item.highID) && (ia.Container == -1)) { ia.Item.multiplecount += ie.Item.multiplecount; if (ia.Item.multiplecount == 0) { Inventory.Remove(ia); } return; } } } Inventory.Add(ie); } }
/// <summary> /// Transfer item from bank account to inventory /// </summary> /// <param name="_from">from bank location</param> /// <param name="_to">to inventory location</param> public void TransferItemfromBank(int _from, int _to) { lock (this) { int placement = GetNextFreeInventory(0x68); AOItem tempitem = null; foreach (AOItem aoi in Bank) { if (aoi.flags == _from) { tempitem = aoi; break; } } if (tempitem == null) { Console.WriteLine("Not valid item..."); return; } InventoryEntries mi = new InventoryEntries(); ItemHandler.Item it = new ItemHandler.Item(tempitem.lowID); mi.Placement = placement; mi.Container = 104; mi.Item.lowID = tempitem.lowID; mi.Item.highID = tempitem.highID; mi.Item.Quality = tempitem.Quality; mi.Item.multiplecount = Math.Max(1, (int)tempitem.multiplecount); Inventory.Add(mi); Bank.Remove(tempitem); writeBankContentstoSQL(); writeInventorytoSQL(); } }
public bool LoadTemplate(string hash) { SqlWrapper Sql = new SqlWrapper(); DataTable dt = Sql.ReadDT("SELECT * from vendortemplate WHERE HASH='" + hash + "'"); if (dt.Rows.Count > 0) { TemplateID = (Int32)dt.Rows[0]["itemtemplate"]; Name = (string)dt.Rows[0]["Name"]; ItemHandler.Item it = new ItemHandler.Item(TemplateID); foreach (AOItemAttribute ia in it.ItemAttributes) { this.Stats.Set(ia.Stat, (uint)ia.Value); } Sql.sqlclose(); fillInventory(); return true; } return false; }
public bool LoadTemplate(int id) { ItemHandler.Item it = new ItemHandler.Item(id); foreach (AOItemAttribute ia in it.ItemAttributes) { this.Stats.Set(ia.Stat, (uint)ia.Value); } fillInventory(); return true; }
public void Create(int _templateid) { ItemHandler.Item i = new ItemHandler.Item(_templateid); int c; for (c = 0; c < i.ItemAttributes.Count; c++) { Stats.Set(i.ItemAttributes[c].Stat, (uint)i.ItemAttributes[c].Value); } i.applyon(this, ItemHandler.eventtype_ontrade, false, false, 0); }