public bool MatchSimilarArmorComponent(Globals.eWearLocation wearLocation, int itemID, Type t) { switch (wearLocation) { case Globals.eWearLocation.Hands: if (t == typeof(BasicLeatherArmorSet) || t == typeof(FullLeatherArmorSet)) { if (itemID == Item.ID_LEATHER_GAUNTLETS || itemID == Item.ID_LEATHER_GAUNTLETS_PLUS_ONE || itemID == Item.ID_LEATHER_GAUNTLETS_PLUS_TWO) { return(true); } } break; case Globals.eWearLocation.Bicep: if (t == typeof(FullSteelArmorSet)) { if (itemID == Item.ID_STEEL_ARMBAND_PLUS_ONE || itemID == Item.ID_STEEL_ARMBAND_PLUS_THREE || itemID == Item.ID_STEEL_ARMBAND_PLUS_SIX) { return(true); } } break; } return(false); }
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 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 } } }
public bool OnCommand(Character chr, string args) { if (args == null) { chr.WriteToDisplay("Remove what?"); return(true); } // quick escape "remove ring" command if (args == "ring") { if (chr.RightHand != null && chr.LeftHand != null) { chr.WriteToDisplay("Your hands are full!"); return(true); } if (chr.LeftHand == null) { return(GameCommand.GameCommandDictionary["remove"].Handler.OnCommand(chr, "1 ring from right")); } else if (chr.RightHand == null) { return(GameCommand.GameCommandDictionary["remove"].Handler.OnCommand(chr, "1 ring from left")); } } string[] sArgs = args.Split(" ".ToCharArray()); sArgs[0] = sArgs[0].ToLower(); // remove left bracelet if (sArgs.Length == 2) { foreach (Item item in chr.wearing) { if (item.name == sArgs[1] && item.wearOrientation.ToString().ToLower() == sArgs[0].ToLower()) { if (chr.RightHand == null) { chr.RightHand = item; chr.RemoveWornItem(item); } else if (chr.LeftHand == null) { chr.LeftHand = item; chr.RemoveWornItem(item); } else { chr.WriteToDisplay("Your hands are full!"); } return(true); } } chr.WriteToDisplay("You are not wearing a " + sArgs[1] + " there."); return(true); } if (sArgs[0] != "ring" && sArgs.Length == 1) { foreach (Item item in chr.wearing) { if (item.name.ToLower() == sArgs[0].ToLower()) { if (item.wearOrientation != Globals.eWearOrientation.None) { string[] wearLocs = Enum.GetNames(typeof(Globals.eWearLocation)); for (int a = 0; a < wearLocs.Length; a++) { if (wearLocs[a] == item.wearLocation.ToString()) { if (Globals.Max_Wearable.Length >= a + 1) { if (Globals.Max_Wearable[a] > 1) { chr.WriteToDisplay("Use \"remove <left | right> <item>\"."); return(true); } } } } } if (chr.RightHand == null) { chr.RightHand = item; chr.RemoveWornItem(sArgs[0]); } else if (chr.LeftHand == null) { chr.LeftHand = item; chr.RemoveWornItem(sArgs[0]); } else { chr.WriteToDisplay("Your hands are full!"); return(true); } return(true); } } chr.WriteToDisplay("You are not wearing a " + sArgs[0] + "."); return(true); } // Trap "remove ring", "remove ring from L/R" and "remove x ring" here. // run findfirstRing functions, reparse sArgs, continue. if ((sArgs[0] == "ring" || sArgs[1] == "ring") && sArgs.Length < 4) { #region remove ring, remove ring from left/right and remove x ring //can't remove a ring if wearing gauntlets foreach (Item wItem in chr.wearing) { if (wItem.wearLocation == Globals.eWearLocation.Hands) { chr.WriteToDisplay("You need to remove your " + wItem.name + " first."); return(true); } } int firstRightRing = chr.FindFirstRightRing(); int firstLeftRing = chr.FindFirstLeftRing(); int firstRing = 0; if (firstLeftRing == 0 && firstRightRing == 0) { chr.WriteToDisplay("You aren't wearing any rings."); return(true); } else { if (sArgs.Length == 3) //"remove ring from left/right" { if (sArgs[2] == "left") { if (firstLeftRing == 0) { chr.WriteToDisplay("You aren't wearing a ring on that hand."); return(true); } firstRing = firstLeftRing + 4; } else if (sArgs[2] == "right") { if (firstRightRing == 0) { chr.WriteToDisplay("You aren't wearing a ring on that hand."); return(true); } firstRing = firstRightRing; } else { chr.WriteToDisplay("I don't understand that command."); return(true); } } else if (sArgs.Length == 2) //"remove x ring" { switch (sArgs[0]) { case "1": if (chr.RightRing1 != null) { firstRing = 1; } else { firstRing = 5; } break; case "2": if (chr.RightRing2 != null) { firstRing = 2; } else { firstRing = 6; } break; case "3": if (chr.RightRing3 != null) { firstRing = 3; } else { firstRing = 7; } break; case "4": if (chr.RightRing4 != null) { firstRing = 4; } else { firstRing = 8; } break; default: chr.WriteToDisplay("I don't understand that command."); return(true); } } else if (sArgs.Length == 1) //"remove ring" { if (firstRightRing > 0) { firstRing = firstRightRing; } else { firstRing = firstLeftRing + 4; } } switch (firstRing) //Now reparse { case 1: args = "1 ring from right"; break; case 2: args = "2 ring from right"; break; case 3: args = "3 ring from right"; break; case 4: args = "4 ring from right"; break; case 5: args = "1 ring from left"; break; case 6: args = "2 ring from left"; break; case 7: args = "3 ring from left"; break; case 8: args = "4 ring from left"; break; } return(new CommandTasker(chr)["remove", args]); } #endregion } if (sArgs.Length == 4) { Item tItem = null; // remove x ring from right/left if (sArgs[1].ToLower() == "ring") { #region removing a ring //can't remove a ring if wearing gauntlets foreach (Item wItem in chr.wearing) { if (wItem.wearLocation == Globals.eWearLocation.Hands) { chr.WriteToDisplay("You need to remove your " + wItem.name + " first."); return(true); } } if (sArgs[3] == "right") { #region remove x ring from right if (chr.LeftHand != null) { chr.WriteToDisplay("Your left hand must be empty."); return(true); } switch (sArgs[0]) { case "1": if (chr.RightRing1 == null) { chr.WriteToDisplay("You do not have a ring on that finger."); return(true); } tItem = chr.RightRing1; if (tItem.isRecall) // it is a recall ring { if (!Item.VerifyRecallMagic(chr, tItem)) { chr.WriteToDisplay("A powerful force cancels your recall magic!"); } else { Item.Recall(chr, tItem, (int)Globals.eWearOrientation.Left); } } if (tItem.wasRecall) // was it a recall ring that was reset { tItem.wasRecall = false; tItem.isRecall = true; } chr.RightRing1 = null; if (tItem.effectType.Length > 0) { Effect.RemoveWornEffectFromCharacter(chr, tItem); } break; case "2": if (chr.RightRing2 == null) { chr.WriteToDisplay("You do not have a ring on that finger."); return(true); } tItem = chr.RightRing2; if (tItem.isRecall) // it is a recall ring { if (!Item.VerifyRecallMagic(chr, tItem)) { chr.WriteToDisplay("A powerful force cancels your recall magic!"); } else { Item.Recall(chr, tItem, (int)Globals.eWearOrientation.Left); } } if (tItem.wasRecall) // was it a recall ring that was reset { tItem.wasRecall = false; tItem.isRecall = true; } chr.RightRing2 = null; if (tItem.effectType.Length > 0) { Effect.RemoveWornEffectFromCharacter(chr, tItem); } break; case "3": if (chr.RightRing3 == null) { chr.WriteToDisplay("You do not have a ring on that finger."); return(true); } tItem = chr.RightRing3; if (tItem.isRecall) // it is a recall ring { if (!Item.VerifyRecallMagic(chr, tItem)) { chr.WriteToDisplay("A powerful force cancels your recall magic!"); } else { Item.Recall(chr, tItem, (int)Globals.eWearOrientation.Left); } } if (tItem.wasRecall) // was it a recall ring that was reset { tItem.wasRecall = false; tItem.isRecall = true; } chr.RightRing3 = null; if (tItem.effectType.Length > 0) { Effect.RemoveWornEffectFromCharacter(chr, tItem); } break; case "4": if (chr.RightRing4 == null) { chr.WriteToDisplay("You do not have a ring on that finger."); return(true); } tItem = chr.RightRing4; if (tItem.isRecall) // it is a recall ring { if (!Item.VerifyRecallMagic(chr, tItem)) { chr.WriteToDisplay("A powerful force cancels your recall magic!"); } else { Item.Recall(chr, tItem, (int)Globals.eWearOrientation.Left); } } if (tItem.wasRecall) // was it a recall ring that was reset { tItem.wasRecall = false; tItem.isRecall = true; } chr.RightRing4 = null; if (tItem.effectType.Length > 0) { Effect.RemoveWornEffectFromCharacter(chr, tItem); } break; default: chr.WriteToDisplay("That is not a valid ring finger."); return(true); } if (chr.LeftHand == null) { chr.LeftHand = tItem; } #endregion } else if (sArgs[3] == "left") { #region remove x ring from left if (chr.RightHand != null) { chr.WriteToDisplay("Your right hand must be empty."); return(true); } switch (sArgs[0]) { case "1": if (chr.LeftRing1 == null) { chr.WriteToDisplay("You do not have a ring on that finger."); return(true); } tItem = chr.LeftRing1; if (tItem.isRecall) // it is a recall ring { if (!Item.VerifyRecallMagic(chr, tItem)) { chr.WriteToDisplay("A powerful force cancels your recall magic!"); } else { Item.Recall(chr, tItem, (int)Globals.eWearOrientation.Right); } } if (tItem.wasRecall) // was it a recall ring that was reset { tItem.wasRecall = false; tItem.isRecall = true; } chr.LeftRing1 = null; if (tItem.effectType.Length > 0) { Effect.RemoveWornEffectFromCharacter(chr, tItem); } break; case "2": if (chr.LeftRing2 == null) { chr.WriteToDisplay("You do not have a ring on that finger."); return(true); } tItem = chr.LeftRing2; if (tItem.isRecall) // it is a recall ring { if (!Item.VerifyRecallMagic(chr, tItem)) { chr.WriteToDisplay("A powerful force cancels your recall magic!"); } else { Item.Recall(chr, tItem, (int)Globals.eWearOrientation.Right); } } if (tItem.wasRecall) // was it a recall ring that was reset { tItem.wasRecall = false; tItem.isRecall = true; } chr.LeftRing2 = null; if (tItem.effectType.Length > 0) { Effect.RemoveWornEffectFromCharacter(chr, tItem); } break; case "3": if (chr.LeftRing3 == null) { chr.WriteToDisplay("You do not have a ring on that finger."); return(true); } tItem = chr.LeftRing3; if (tItem.isRecall) // it is a recall ring { if (!Item.VerifyRecallMagic(chr, tItem)) { chr.WriteToDisplay("A powerful force cancels your recall magic!"); } else { Item.Recall(chr, tItem, (int)Globals.eWearOrientation.Right); } } if (tItem.wasRecall) // was it a recall ring that was reset { tItem.wasRecall = false; tItem.isRecall = true; } chr.LeftRing3 = null; if (tItem.effectType.Length > 0) { Effect.RemoveWornEffectFromCharacter(chr, tItem); } break; case "4": if (chr.LeftRing4 == null) { chr.WriteToDisplay("You do not have a ring on that finger."); return(true); } tItem = chr.LeftRing4; if (tItem.isRecall) // it is a recall ring { if (!Item.VerifyRecallMagic(chr, tItem)) { chr.WriteToDisplay("A powerful force cancels your recall magic!"); } else { Item.Recall(chr, tItem, (int)Globals.eWearOrientation.Right); } } if (tItem.wasRecall) // was it a recall ring that was reset { tItem.wasRecall = false; tItem.isRecall = true; } chr.LeftRing4 = null; if (tItem.effectType.Length > 0) { Effect.RemoveWornEffectFromCharacter(chr, tItem); } break; default: chr.WriteToDisplay("That is not a valid ring finger."); return(true); } if (chr.RightHand == null) { chr.RightHand = tItem; } #endregion } else { chr.WriteToDisplay("You do not have any rings there."); return(true); } #endregion } else if (sArgs[3].ToLower() == "wrist" || sArgs[3].ToLower() == "bicep") { #region remove <item> from <orientation> <location> if (sArgs[2].ToLower() == "right" && chr.LeftHand != null) { chr.WriteToDisplay("Your left hand must be empty."); return(true); } else if (sArgs[2].ToLower() == "left" && chr.RightHand != null) { chr.WriteToDisplay("Your right hand must be empty."); return(true); } Globals.eWearLocation wLocation = Globals.eWearLocation.None; Globals.eWearOrientation wOrientation = Globals.eWearOrientation.None; try { wLocation = (Globals.eWearLocation)Enum.Parse(typeof(Globals.eWearLocation), sArgs[3], true); wOrientation = (Globals.eWearOrientation)Enum.Parse(typeof(Globals.eWearOrientation), sArgs[2], true); } catch { chr.WriteToDisplay("You are not wearing a " + sArgs[0] + " on your " + sArgs[2] + " " + sArgs[3] + "."); return(true); } // remove <item> from <orientation> <location> foreach (Item wItem in chr.wearing) { if (wItem.name.ToLower() == sArgs[0].ToLower() && wItem.wearLocation == wLocation && wItem.wearOrientation == wOrientation) { tItem = wItem; break; } } if (tItem == null) { chr.WriteToDisplay("You are not wearing a " + sArgs[0] + " on your " + sArgs[2] + " " + sArgs[3] + "."); return(true); } else { chr.RemoveWornItem(tItem); if (wOrientation == Globals.eWearOrientation.Right) { chr.EquipLeftHand(tItem); } else if (wOrientation == Globals.eWearOrientation.Left) { chr.EquipRightHand(tItem); } } #endregion } else { chr.WriteToDisplay("I don't understand your command. For a full list of game commands visit the Dragon's Spine forums."); } } return(true); }