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 impsetstat(string args) { if ((_chr as PC).ImpLevel < Globals.eImpLevel.DEV) { _chr.WriteToDisplay("I don't understand your command."); return; } else { if (args == null) { _chr.WriteToDisplay("impsetstat ('str ... cha, implevel, invis, align') (value) (player)"); return; } else { String[] sArgs = args.Split(" ".ToCharArray()); if (sArgs.Length < 3) { _chr.WriteToDisplay("impsetstat ('str ... cha, implevel, invis, align') (value) (player)"); return; } string stat = sArgs[0].ToLower(); int num = 0; Int32.TryParse(sArgs[1], out num); PC target = null; foreach (PC chra in Character.PCInGameWorld) { if (chra.Name.ToLower() == sArgs[2].ToLower()) { target = chra; } } if (target != null) { switch (stat) { case "con": _chr.WriteToDisplay(target.Name + "'s constitution changed from " + target.Constitution + " to " + num + "."); target.Constitution = num; break; case "str": _chr.WriteToDisplay(target.Name + "'s strength changed from " + target.Strength + " to " + num + "."); target.Strength = num; break; case "dex": _chr.WriteToDisplay(target.Name + "'s dexterity changed from " + target.Dexterity + " to " + num + "."); target.Dexterity = num; break; case "int": _chr.WriteToDisplay(target.Name + "'s intelligence changed from " + target.Intelligence + " to " + num + "."); target.Intelligence = num; break; case "wis": _chr.WriteToDisplay(target.Name + "'s wisdom changed from " + target.Wisdom + " to " + num + "."); target.Wisdom = num; break; case "cha": _chr.WriteToDisplay(target.Name + "'s charisma changed from " + target.Charisma + " to " + num + "."); target.Charisma = num; break; case "implevel": _chr.WriteToDisplay(target.Name + "'s implevel changed from " + target.ImpLevel + " to " + num + "."); target.ImpLevel = (Globals.eImpLevel)num; break; case "invis": if (num == 1) { _chr.WriteToDisplay(target.Name + " is now invisible."); if (target.Name != _chr.Name) { target.WriteToDisplay("You are now invisible."); } target.IsInvisible = true; } else { _chr.WriteToDisplay(target.Name + " is no longer invisible."); if (target.Name != _chr.Name) { target.WriteToDisplay("You are no longer invisible."); } target.IsInvisible = false; } break; case "align": case "alignment": { Globals.eAlignment alignment = target.Alignment; try { alignment = (Globals.eAlignment)Enum.Parse(typeof(Globals.eAlignment), sArgs[1], false); } catch { _chr.WriteToDisplay("Invalid alignment '" + sArgs[2] + "'"); } _chr.WriteToDisplay(target.Name + "'s alignment changed from " + target.Alignment + " to " + alignment + "."); target.Alignment = alignment; } break; default: break; } } return; } } }
public bool OnCommand(Character chr, string args) { if (args == null) { chr.WriteToDisplay("impsetstat ('str ... cha, implevel, invis, align') (value) (player)"); return(true); } else { String[] sArgs = args.Split(" ".ToCharArray()); if (sArgs.Length < 3) { chr.WriteToDisplay("impsetstat ('str ... cha, implevel, invis, align') (value) (player)"); return(true); } string stat = sArgs[0].ToLower(); Int32.TryParse(sArgs[1], out int num); PC target = null; foreach (PC chra in Character.PCInGameWorld) { if (chra.Name.ToLower() == sArgs[2].ToLower()) { target = chra; } } if (target == null) { GameSystems.Targeting.TargetAquisition.FindTargetInView(chr, sArgs[0], 0); } if (target != null) { switch (stat.ToLower()) { case "hitsmax": case "hpmax": chr.WriteToDisplay(target.Name + "'s HitsMax changed from " + target.HitsMax + " to " + num + "."); target.HitsMax = num; break; case "staminamax": case "stammax": chr.WriteToDisplay(target.Name + "'s StaminaMax changed from " + target.StaminaMax + " to " + num + "."); target.StaminaMax = num; break; case "manamax": chr.WriteToDisplay(target.Name + "'s ManaMax changed from " + target.ManaMax + " to " + num + "."); target.ManaMax = num; break; case "constitution": case "con": chr.WriteToDisplay(target.Name + "'s constitution changed from " + target.Constitution + " to " + num + "."); target.Constitution = num; break; case "strength": case "str": chr.WriteToDisplay(target.Name + "'s strength changed from " + target.Strength + " to " + num + "."); target.Strength = num; break; case "dexterity": case "dex": chr.WriteToDisplay(target.Name + "'s dexterity changed from " + target.Dexterity + " to " + num + "."); target.Dexterity = num; break; case "intelligence": case "int": chr.WriteToDisplay(target.Name + "'s intelligence changed from " + target.Intelligence + " to " + num + "."); target.Intelligence = num; break; case "wisdom": case "wis": chr.WriteToDisplay(target.Name + "'s wisdom changed from " + target.Wisdom + " to " + num + "."); target.Wisdom = num; break; case "charisma": case "cha": chr.WriteToDisplay(target.Name + "'s charisma changed from " + target.Charisma + " to " + num + "."); target.Charisma = num; break; case "implevel": chr.WriteToDisplay(target.Name + "'s implevel changed from " + target.ImpLevel + " to " + num + "."); target.ImpLevel = (Globals.eImpLevel)num; break; case "invis": if (num == 1) { chr.WriteToDisplay(target.Name + " is now invisible."); if (target.Name != chr.Name) { target.WriteToDisplay("You are now invisible."); } target.IsInvisible = true; } else { chr.WriteToDisplay(target.Name + " is no longer invisible."); if (target.Name != chr.Name) { target.WriteToDisplay("You are no longer invisible."); } target.IsInvisible = false; } break; case "align": case "alignment": { Globals.eAlignment alignment = target.Alignment; try { alignment = (Globals.eAlignment)Enum.Parse(typeof(Globals.eAlignment), sArgs[1], false); } catch { chr.WriteToDisplay("Invalid alignment '" + sArgs[2] + "'"); } chr.WriteToDisplay(target.Name + "'s alignment changed from " + target.Alignment + " to " + alignment + "."); target.Alignment = alignment; } break; default: break; } foreach (Globals.eSkillType skillType in Enum.GetValues(typeof(Globals.eSkillType))) { if (stat.ToLower() == skillType.ToString().ToLower()) { target.SetSkillExperience(skillType, Skills.GetSkillForLevel(Convert.ToInt32(sArgs[1]))); chr.WriteToDisplay(target.GetNameForActionResult(false) + "'s " + Utils.FormatEnumString(skillType.ToString()) + " set to skill level " + sArgs[1] + "."); break; } } } return(true); } }