public Item(System.Data.DataRow dr) { this.UniqueID = World.GetNextWorldItemID(); this.catalogID = Convert.ToInt32(dr["catalogID"]); this.notes = dr["notes"].ToString(); this.combatAdds = Convert.ToInt32(dr["combatAdds"]); this.itemID = Convert.ToInt32(dr["itemID"]); this.itemType = (Globals.eItemType)Enum.Parse(typeof(Globals.eItemType), dr["itemType"].ToString()); this.baseType = (Globals.eItemBaseType)Enum.Parse(typeof(Globals.eItemBaseType), dr["baseType"].ToString()); this.name = dr["name"].ToString(); this.visualKey = dr["visualKey"].ToString(); this.unidentifiedName = dr["unidentifiedName"].ToString(); this.identifiedName = dr["identifiedName"].ToString(); this.shortDesc = dr["shortDesc"].ToString(); this.longDesc = dr["longDesc"].ToString(); this.wearLocation = (Globals.eWearLocation)Enum.Parse(typeof(Globals.eWearLocation), dr["wearLocation"].ToString()); this.weight = Convert.ToDouble(dr["weight"]); this.coinValue = Convert.ToInt32(dr["coinValue"]); this.size = (Globals.eItemSize)Enum.Parse(typeof(Globals.eItemSize), dr["size"].ToString()); this.effectType = dr["effectType"].ToString(); this.effectAmount = dr["effectAmount"].ToString(); this.effectDuration = dr["effectDuration"].ToString(); this.special = dr["special"].ToString(); this.minDamage = Convert.ToInt32(dr["minDamage"]); this.maxDamage = Convert.ToInt32(dr["maxDamage"]); this.skillType = (Globals.eSkillType)Enum.Parse(typeof(Globals.eSkillType), dr["skillType"].ToString()); this.vRandLow = Convert.ToInt32(dr["vRandLow"]); this.vRandHigh = Convert.ToInt32(dr["vRandHigh"]); this.key = dr["key"].ToString(); this.isRecall = Convert.ToBoolean(dr["recall"]); this.alignment = (Globals.eAlignment)Enum.Parse(typeof(Globals.eAlignment), dr["alignment"].ToString()); this.spell = Convert.ToInt16(dr["spell"]); this.spellPower = Convert.ToInt16(dr["spellPower"]); this.charges = Convert.ToInt16(dr["charges"]); try { this.attackType = (Globals.eAttackType)Enum.Parse(typeof(Globals.eAttackType), dr["attackType"].ToString()); } catch { this.attackType = Globals.eAttackType.None; } this.blueglow = Convert.ToBoolean(dr["blueglow"]); this.flammable = Convert.ToBoolean(dr["flammable"]); this.fragile = Convert.ToBoolean(dr["fragile"]); this.lightning = Convert.ToBoolean(dr["lightning"]); this.returning = Convert.ToBoolean(dr["returning"]); this.silver = Convert.ToBoolean(dr["silver"]); this.attuneType = (Globals.eAttuneType)Enum.Parse(typeof(Globals.eAttuneType), dr["attuneType"].ToString()); this.figExp = Convert.ToInt32(dr["figExp"]); this.armorClass = Convert.ToDouble(dr["armorClass"]); this.armorType = (Globals.eArmorType)Enum.Parse(typeof(Globals.eArmorType), dr["armorType"].ToString()); this.lootTable = dr["lootTable"].ToString(); }
//public int[] identified; // if the player has identified this item it contains their playerID TODO: add this to tables/sp's #region Constructors (3) public Item() { itemID = -1; itemType = Globals.eItemType.Miscellaneous; baseType = Globals.eItemBaseType.Unknown; name = "undefined"; shortDesc = null; longDesc = null; weight = -1; coinValue = -1; special = null; timeCreated = DateTime.Now; whoCreated = "SYSTEM"; }
public Item(Item item) : base() { //TODO iterate through variables in Reflection and set them that way this.catalogID = item.catalogID; this.UniqueID = World.GetNextWorldItemID(); this.notes = item.notes; this.combatAdds = item.combatAdds; this.itemID = item.itemID; this.itemType = item.itemType; this.baseType = item.baseType; this.name = item.name; this.unidentifiedName = item.unidentifiedName; this.identifiedName = item.identifiedName; this.identifiedList = item.identifiedList; this.shortDesc = item.shortDesc; this.longDesc = item.longDesc; this.visualKey = item.visualKey; this.wearLocation = item.wearLocation; this.weight = item.weight; this.coinValue = item.coinValue; this.size = item.size; this.effectType = item.effectType; this.effectAmount = item.effectAmount; this.effectDuration = item.effectDuration; this.special = item.special; this.minDamage = item.minDamage; this.maxDamage = item.maxDamage; this.skillType = item.skillType; this.vRandLow = item.vRandLow; this.vRandHigh = item.vRandHigh; this.key = item.key; this.isRecall = item.isRecall; this.alignment = item.alignment; this.spell = item.spell; this.spellPower = item.spellPower; this.charges = item.charges; this.attackType = item.attackType; this.blueglow = item.blueglow; this.flammable = item.flammable; this.fragile = item.fragile; this.lightning = item.lightning; this.returning = item.returning; this.silver = item.silver; this.attuneType = item.attuneType; this.figExp = item.figExp; this.armorClass = item.armorClass; this.armorType = item.armorType; this.lootTable = item.lootTable; }
public void OneTimeBuildAndInsert(Globals.eItemType itemType, Globals.eItemBaseType itemBaseType, Globals.eWearLocation wearLocation) { var selectedRows = new List <System.Data.DataRow>(); // for armor, leather tunic -- modify AC, name, shortDesc, longDesc, flammable?, "special" and other special attributes // grab the default item from the database, modify it then insert if it does not already exist foreach (int itemID in Item.ItemDictionary.Keys) { Item item = Item.CopyItemFromDictionary(itemID); if (item.itemType == itemType && item.baseType == itemBaseType && item.wearLocation == wearLocation) { // need to create a new item now Item newItem = new Item(item); // now we modify AC, name, shortDesc, longDesc, flammable and special attributes // then insert into database after performing a check if certain data already exists } } }