internal void LoadItems(IQueryAdapter dbClient) { Items = new Dictionary <uint, Item>(); dbClient.setQuery("SELECT * FROM items_base"); DataTable ItemData = dbClient.getTable(); if (ItemData != null) { uint id; int spriteID; string publicName; string itemName; string type; int width; int length; double height; bool allowStack; bool allowWalk; bool allowSit; bool allowRecycle; bool allowTrade; bool allowMarketplace; bool allowGift; bool allowInventoryStack; InteractionType interactionType; int cycleCount; string vendingIDS; foreach (DataRow dRow in ItemData.Rows) { try { id = Convert.ToUInt16(dRow[0]); spriteID = (int)dRow[1]; publicName = (string)dRow[2]; itemName = (string)dRow[3]; type = (string)dRow[4]; width = (int)dRow[5]; length = (int)dRow[6]; height = Convert.ToDouble(dRow[7]); allowStack = Convert.ToInt32(dRow[8]) == 1; allowWalk = Convert.ToInt32(dRow[9]) == 1; allowSit = Convert.ToInt32(dRow[10]) == 1; allowRecycle = Convert.ToInt32(dRow[11]) == 1; allowTrade = Convert.ToInt32(dRow[12]) == 1; allowMarketplace = Convert.ToInt32(dRow[13]) == 1; allowGift = Convert.ToInt32(dRow[14]) == 1; allowInventoryStack = Convert.ToInt32(dRow[15]) == 1; interactionType = InterractionTypes.GetTypeFromString((string)dRow[16]); cycleCount = (int)dRow[17]; vendingIDS = (string)dRow[18]; Item item = new Item(id, spriteID, publicName, itemName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, cycleCount, vendingIDS); Items.Add(id, item); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.ReadKey(); Logging.WriteLine("Could not load item #" + Convert.ToUInt32(dRow[0]) + ", please verify the data is okay."); } } } }
internal void LoadItems(IQueryAdapter dbClient) { Items = new Dictionary <uint, Item>(); dbClient.setQuery("SELECT * FROM items_base"); DataTable ItemData = dbClient.getTable(); if (ItemData != null) { uint id; int spriteID; string itemName; string type; int width; int length; double height; bool allowStack; bool allowWalk; bool allowSit; bool allowRecycle; bool allowTrade; bool allowMarketplace; bool allowInventoryStack; bool allowRotations; InteractionType interactionType; int cycleCount; string vendingIDS; int limitedStack; string multiHeight; foreach (DataRow dRow in ItemData.Rows) { try { id = Convert.ToUInt16(dRow["item_id"]); spriteID = (int)dRow["sprite_id"]; itemName = (string)dRow["item_name"]; type = (string)dRow["type"]; width = (int)dRow["width"]; length = (int)dRow["length"]; height = Convert.ToDouble(dRow["height"]); allowStack = Convert.ToInt32(dRow["allow_stack"]) == 1; allowWalk = Convert.ToInt32(dRow["allow_walk"]) == 1; allowSit = Convert.ToInt32(dRow["allow_sit"]) == 1; allowRecycle = Convert.ToInt32(dRow["allow_recycle"]) == 1; allowTrade = Convert.ToInt32(dRow["allow_trade"]) == 1; allowMarketplace = Convert.ToInt32(dRow["allow_marketplace_sell"]) == 1; allowInventoryStack = Convert.ToInt32(dRow["allow_inventory_stack"]) == 1; allowRotations = Convert.ToInt32(dRow["allow_rotation"]) == 1; interactionType = InterractionTypes.GetTypeFromString((string)dRow["interaction_type"]); cycleCount = (int)dRow["cycle_count"]; vendingIDS = (string)dRow["vending_ids"]; limitedStack = (int)dRow["maxLtdItems"]; multiHeight = (string)dRow["multi_height"]; Item item = new Item(id, spriteID, itemName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowInventoryStack, allowRotations, interactionType, cycleCount, vendingIDS, limitedStack, multiHeight); Items.Add(id, item); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.ReadKey(); Logging.WriteLine("Could not load item #" + Convert.ToUInt32(dRow[0]) + ", please verify the data is okay."); } } } }