private void populatePlayerComboBoxes() { int a; currentPC = new PC(); for (a = 0; a < Enum.GetNames(currentPC.gender.GetType()).Length; a++) // gender combo box { cmbobxPlayerGender.Items.Add(Enum.GetName(currentPC.gender.GetType(), a)); } for (a = 0; a < Enum.GetNames(currentPC.BaseProfession.GetType()).Length; a++) // class type combo box { cmbobxPlayerClass.Items.Add(Utils.FormatEnumString(Enum.GetName(currentPC.BaseProfession.GetType(), a))); } for (a = 0; a < Enum.GetNames(currentPC.Alignment.GetType()).Length; a++) // alignment combo box { cmbobxPlayerAlignment.Items.Add(Enum.GetName(currentPC.Alignment.GetType(), a)); } for (a = 0; a < World.GetFacetByIndex(0).Lands.Count; a++) // lands combo box { cmbobxPlayerLand.Items.Add(World.GetFacetByIndex(0).GetLandByIndex(a).Name); } for (a = 0; a < Enum.GetNames(currentPC.ImpLevel.GetType()).Length; a++) // implevel combo box { cmbobxPlayerImpLevel.Items.Add(Enum.GetName(currentPC.ImpLevel.GetType(), a) + "(" + a.ToString() + ")"); } }
public bool OnCommand(Character chr, string args) { if (chr.CurrentCell == null || !chr.CurrentCell.IsOrnicLocker) { chr.WriteToDisplay("You can't do that here."); return(true); } int hand = chr.WhichHand("coins"); if (hand == (int)Globals.eWearOrientation.None) { hand = chr.WhichHand("coin"); } if (hand == (int)Globals.eWearOrientation.None) { hand = chr.WhichHand("gem"); } Item coinage = null; switch (hand) { case (int)Globals.eWearOrientation.Right: coinage = chr.RightHand; chr.UnequipRightHand(coinage); break; case (int)Globals.eWearOrientation.Left: coinage = chr.LeftHand; chr.UnequipLeftHand(coinage); break; default: chr.WriteToDisplay("You are not holding anything that can be deposited here."); return(true); } if (coinage != null) { if (coinage.coinValue <= 0) { chr.WriteToDisplay("Invalid coin amount."); return(true); } World.CollectFeeForLottery((coinage.itemType != Globals.eItemType.Coin ? World.FEE_ATM_USE_ITEMS : World.FEE_ATM_USE_COINS), chr.LandID, ref coinage.coinValue); (chr as PC).bankGold += coinage.coinValue; chr.WriteToDisplay("You now have " + (chr as PC).bankGold + " coin" + (coinage.coinValue > 1 ? "s" : "") + " in your bank account."); return(true); } 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; }
/// <summary> /// Get a random name for a Character (with a race, typically human or humanoid). /// </summary> /// <param name="ch">The Character object requiring a name.</param> /// <returns>A new, random name.</returns> public static string GetRandomName(Character ch) { if (ch.race == "Leng" || ch.species == Globals.eSpecies.Human && (World.GetFacetByIndex(0).GetLandByID(ch.LandID).Name == "Leng" || World.GetFacetByIndex(0).GetLandByID(ch.LandID).Name == "Torii")) { return(NameGenerator.GetJapaneseName(ch.gender)); } else if (ch.race == "" || (ch.species != Globals.eSpecies.Human || Rules.RollD(1, 100) >= 20)) { return(NameGenerator.GenerateRandomName(ch)); } if (ch.gender == Globals.eGender.Male) { return(HUMAN_MALE_NAMES[Rules.Dice.Next(0, HUMAN_MALE_NAMES.Length - 1)]); } else { return(HUMAN_FEMALE_NAMES[Rules.Dice.Next(0, HUMAN_FEMALE_NAMES.Length - 1)]); } }
private void populatePlayerGroup() { if (!npcMode) { if (currentPC != null) { tbxPlayerName.Text = currentPC.Name; cmbobxPlayerGender.SelectedIndex = (int)currentPC.gender; cmbobxPlayerClass.SelectedIndex = (int)currentPC.BaseProfession; tbxPlayerClassFull.Text = currentPC.classFullName; cmbobxPlayerRace.Items.Clear(); // TODO: cmbobxPlayerAlignment.SelectedIndex = (int)currentPC.Alignment; numPlayerAge.Value = currentPC.Age; numPlayerStrength.Value = currentPC.Strength; numPlayerDexterity.Value = currentPC.Dexterity; numPlayerIntelligence.Value = currentPC.Intelligence; numPlayerWisdom.Value = currentPC.Wisdom; numPlayerConstitution.Value = currentPC.Constitution; numPlayerCharisma.Value = currentPC.Charisma; numPlayerStrengthAdd.Value = currentPC.strengthAdd; numPlayerDexterityAdd.Value = currentPC.dexterityAdd; cmbobxPlayerLand.SelectedIndex = currentPC.LandID; for (int a = 0; a < currentPC.Land.MapDictionary.Count; a++) // maps combo box { cmbobxPlayerMap.Items.Add(World.GetFacetByIndex(0).GetLandByIndex(currentPC.LandID).GetMapByIndex(a).Name); } cmbobxPlayerMap.SelectedIndex = currentPC.MapID; numPlayerXCord.Value = currentPC.X; numPlayerYCord.Value = currentPC.Y; cmbobxPlayerImpLevel.SelectedIndex = (int)currentPC.ImpLevel; numPlayerHits.Value = currentPC.Hits; numPlayerHitsMax.Value = currentPC.HitsMax; numPlayerMana.Value = currentPC.Mana; numPlayerManaMax.Value = currentPC.ManaMax; numPlayerStamLeft.Value = currentPC.Stamina; numPlayerStamina.Value = currentPC.StaminaMax; numPlayerLevel.Value = currentPC.Level; numPlayerExperience.Value = currentPC.Experience; numPlayerBankGold.Value = (decimal)currentPC.bankGold; chkPlayerDead.Checked = currentPC.IsDead; chkPlayerHidden.Checked = currentPC.IsHidden; chkPlayerBlind.Checked = currentPC.IsBlind; tbxPlayerNumKills.Text = currentPC.Kills.ToString(); tbxPlayerNumDeaths.Text = currentPC.Deaths.ToString(); if (currentPC.spellDictionary.Count > 0) { spellsGrid.Enabled = true; spellsGrid.ColumnCount = 2; spellsGrid.RowCount = currentPC.spellDictionary.Count; // TODO: make this a foreach loop through the Keys in the spellList Dictionary //for (int a = 0; a < currentPC.spellList.Count; a++) //{ // spellsGrid[0, a].OwningRow.HeaderCell.Value = Spell.GetSpell((int)currentPC.spellList..ints[a]).Name; // spellsGrid[0, a].Value = ((int)currentPC.spellList.ints[a]).ToString(); // spellsGrid[1, a].Value = currentPC.spellList.GetString(a); //} } else { spellsGrid.Enabled = false; } tbxPlayerBirthday.Text = currentPC.birthday.ToString(); tbxPlayerLastOnline.Text = currentPC.lastOnline.ToString(); tbxPlayerNotes.Text = currentPC.Notes; } } else { if (currentNPC != null) { tbxPlayerName.Text = currentNPC.Name; cmbobxPlayerGender.SelectedIndex = (int)currentNPC.gender; cmbobxPlayerClass.SelectedIndex = (int)currentNPC.BaseProfession; tbxPlayerClassFull.Text = currentNPC.classFullName; cmbobxPlayerRace.Items.Clear(); // TODO: cmbobxPlayerAlignment.SelectedIndex = (int)currentNPC.Alignment; numPlayerAge.Value = currentNPC.Age; numPlayerStrength.Value = currentNPC.Strength; numPlayerDexterity.Value = currentNPC.Dexterity; numPlayerIntelligence.Value = currentNPC.Intelligence; numPlayerWisdom.Value = currentNPC.Wisdom; numPlayerConstitution.Value = currentNPC.Constitution; numPlayerCharisma.Value = currentNPC.Charisma; numPlayerStrengthAdd.Value = currentNPC.strengthAdd; numPlayerDexterityAdd.Value = currentNPC.dexterityAdd; cmbobxPlayerLand.SelectedIndex = currentNPC.LandID; for (int a = 0; a < currentNPC.Land.MapDictionary.Count; a++) // maps combo box { cmbobxPlayerMap.Items.Add(World.GetFacetByIndex(0).GetLandByIndex(currentNPC.LandID).GetMapByIndex(a).Name); } cmbobxPlayerMap.SelectedIndex = currentNPC.MapID; numPlayerXCord.Value = currentNPC.X; numPlayerYCord.Value = currentNPC.Y; //cmbobxPlayerImpLevel.SelectedIndex = (int)currentNPC.ImpLevel; numPlayerHits.Value = currentNPC.Hits; numPlayerHitsMax.Value = currentNPC.HitsMax; numPlayerMana.Value = currentNPC.Mana; numPlayerManaMax.Value = currentNPC.ManaMax; numPlayerStamLeft.Value = currentNPC.Stamina; numPlayerStamina.Value = currentNPC.StaminaMax; numPlayerLevel.Value = currentNPC.Level; numPlayerExperience.Value = currentNPC.Experience; //numPlayerBankGold.Value = (decimal)currentNPC.bankGold; chkPlayerDead.Checked = currentNPC.IsDead; chkPlayerHidden.Checked = currentNPC.IsHidden; chkPlayerBlind.Checked = currentNPC.IsBlind; tbxPlayerNumKills.Text = currentNPC.Kills.ToString(); tbxPlayerNumDeaths.Text = currentNPC.Deaths.ToString(); if (currentNPC.spellDictionary.Count > 0) { spellsGrid.Enabled = true; spellsGrid.ColumnCount = 2; spellsGrid.RowCount = currentNPC.spellDictionary.Count; // TODO: make this a foreach through the Keys in the spellList Dictionary //for (int a = 0; a < currentNPC.spellList.Count; a++) //{ // spellsGrid[0, a].OwningRow.HeaderCell.Value = Spell.GetSpell((int)currentNPC.spellList.ints[a]).Name; // spellsGrid[0, a].Value = ((int)currentNPC.spellList.ints[a]).ToString(); // spellsGrid[1, a].Value = currentNPC.spellList.GetString(a); //} } else { spellsGrid.Enabled = false; } tbxPlayerBirthday.Text = (currentNPC as PC).birthday.ToString(); tbxPlayerLastOnline.Text = (currentNPC as PC).lastOnline.ToString(); tbxPlayerNotes.Text = currentNPC.Notes; } } }
/// <summary> /// Called when a Character object has been killed. /// </summary> /// <param name="target">The Character object becoming a corpse.</param> /// <returns>The newly created Corpse object.</returns> public static Corpse MakeCorpse(Character target) { if (target == null) { return(null); } if (target.CurrentCell != null && target.CurrentCell.ContainsNPCCorpse(target.UniqueID)) { return(null); } // Create a new Corpse object. Corpse corpse = (Corpse)CopyItemFromDictionary(ID_CORPSE); // If the dead is immune to fire then the corpse will not be flammable. if (target.immuneFire) { corpse.flammable = false; } //if (target is PC) // corpse.longDesc = "the corpse of " + target.Name; //if ((target as NPC).HasRandomName) // corpse.longDesc = "the corpse of a " + Utils.FormatEnumString(target.entity.ToString()).ToLower() + " " + target.classFullName.ToLower() + " named " + target.Name; //else // corpse.longDesc = "the corpse of a " + (target as NPC).longDesc; // Corpse weight. corpse.weight = target.Strength * 10; if (target is PC) { corpse.Ghost = target; corpse.itemID = ID_RESERVED_FOR_PLAYER_CORPSE; corpse.special = target.Name; corpse.longDesc = "the corpse of " + target.Name; target.CurrentCell.Add(corpse); } else { NPC npc = target as NPC; corpse.Ghost = npc; if ((target as NPC).HasRandomName) { corpse.longDesc = "the corpse of a " + Utils.FormatEnumString(target.entity.ToString()).ToLower() + " " + target.classFullName.ToLower() + " named " + target.Name; } else if (target.entity.ToString().ToLower().StartsWith("the_")) { corpse.longDesc = "the corpse of " + (target as NPC).longDesc; } else { corpse.longDesc = "the corpse of " + (target as NPC).longDesc; } bool incorporeal = EntityLists.INCORPOREAL.Contains(npc.entity) || npc.IsSpectral; bool summoned = EntityLists.SUMMONED.Contains(npc.entity) || npc.IsSummoned; Rules.CorpseSack(npc, corpse); Rules.CorpsePouch(npc, corpse); Rules.CorpseBelt(npc, corpse); if (!incorporeal && !summoned) { Rules.CorpseWearing(npc, corpse); Rules.CorpseRings(npc, corpse); } // decrease number of spawns if (World.GetFacetByID(npc.FacetID).Spawns.ContainsKey(npc.SpawnZoneID)) { World.GetFacetByID(npc.FacetID).Spawns[npc.SpawnZoneID].NumberInZone--; } // place corpse on ground if (npc.CurrentCell != null) { if (incorporeal || summoned) { DumpCorpse(corpse, npc.CurrentCell); } else { npc.CurrentCell.Add(corpse); // place corpse on ground } } npc.RemoveFromWorld(); // done with the npc - remove it. } return(corpse); }