/// <summary> /// Determine if a base profession may use this GameTalent. /// </summary> /// <param name="profession"></param> /// <returns></returns> public bool IsProfessionElgible(Character.ClassType profession) { return(m_professions == null || Array.IndexOf(m_professions, (Character.ClassType)profession) > -1 || Array.IndexOf(m_professions, Character.ClassType.All) > -1); }
private static int GetProfessionAdjustment(Character.ClassType baseProfession, Combat.SavingThrow savingThrow) { int PPD = 0; int PP = 0; int RSW = 0; int S = 0; int BW = 0; switch (baseProfession) { case Character.ClassType.Berserker: #region PPD+++, PP+++, RSW+, S+, BW++ PPD += -4; PP += -4; RSW += -0; S += -0; BW += 2; break; #endregion case Character.ClassType.Sorcerer: #region PPD++, PP++, RSW+, S++, BW PPD += -2; PP += -2; RSW += -1; S += -2; BW += 0; break; #endregion case Character.ClassType.Ravager: #region PPD+++, PP+++, RSW++, S++, BW+++ PPD += -3; PP += -3; RSW += -2; S += -2; BW += -3; break; #endregion case Character.ClassType.Fighter: #region PPD++, PP++, RSW+, S, BW PPD += -2; PP += -2; RSW += -1; S += 0; BW += 0; break; #endregion case Character.ClassType.Knight: #region PPD++++, PP++++, RSW++, S++, BW+ PPD += -4; PP += -4; RSW += -2; S += -2; BW += -1; break; #endregion case Character.ClassType.Thaumaturge: #region PPD++, PP++, RSW, S+, BW PPD += -2; PP += -2; RSW += 0; S += -1; BW += 0; break; #endregion case Character.ClassType.Thief: #region PPD+++++, PP++, RSW+, S+, BW+ PPD += -5; PP += -2; RSW += -1; S += -1; BW += 1; break; #endregion case Character.ClassType.Martial_Artist: #region PPD++, PP++, RSW+, S, BW PPD += -2; PP += -2; RSW += -1; S += 0; BW += 0; break; #endregion case Character.ClassType.Wizard: #region PPD, PP, RSW+++, S+++, BW+ PPD += 0; PP += 0; RSW += -3; S += -3; BW += -1; break; #endregion default: break; } switch (savingThrow) { case Combat.SavingThrow.BreathWeapon: return(BW); case Combat.SavingThrow.ParalyzationPoisonDeath: return(PPD); case Combat.SavingThrow.PetrificationPolymorph: return(PP); case Combat.SavingThrow.RodStaffWand: return(RSW); case Combat.SavingThrow.Spell: return(S); default: return(0); } }
private List <string> GetScoresList(string classAbbreviation, short amount, bool devRequest, bool pvp) { string classFullName = ""; string playerName = ""; Character.ClassType classType = Character.ClassType.None; List <string> list = new List <string>(); #region Profession Selection switch (classAbbreviation.ToLower()) { case "all": classType = Character.ClassType.None; classFullName = "All Classes"; break; case "b": case "bers": case "berserker": case "berserkers": classType = Character.ClassType.Berserker; classFullName = "Berserkers"; break; case "k": case "ki": case "kn": case "knight": case "knights": classType = Character.ClassType.Knight; classFullName = "Knights"; break; case "f": case "fi": case "fighter": case "fighters": classType = Character.ClassType.Fighter; classFullName = "Fighters"; break; case "m": case "ma": case "martial": case "martialartist": case "martialartists": classType = Character.ClassType.Martial_Artist; classFullName = "Martial Artists"; break; case "t": case "th": case "thaum": case "thaums": case "thaumaturge": case "thaumaturges": classType = Character.ClassType.Thaumaturge; classFullName = "Thaumaturges"; break; case "w": case "wi": case "wiz": case "wizard": case "mage": case "wizards": classType = Character.ClassType.Wizard; classFullName = "Wizards"; break; case "r": case "ran": case "rang": case "ranger": case "rangers": classType = Character.ClassType.Ranger; classFullName = "Rangers"; break; case "rav": case "ravager": case "ravagers": classType = Character.ClassType.Ravager; classFullName = "Ravagers"; break; case "tf": case "thief": case "thiefs": case "thieves": classType = Character.ClassType.Thief; classFullName = "Thieves"; break; case "s": case "sr": case "sorc": case "sorcs": case "sorcerer": case "sorcerers": classType = Character.ClassType.Sorcerer; classFullName = "Sorcerers"; break; case "dr": case "druid": case "druids": classType = Character.ClassType.Druid; classFullName = "Druids"; break; default: if (PC.PlayerExists(classAbbreviation)) { playerName = classAbbreviation; } break; } #endregion if (playerName == "") { list.Add("Top " + amount + " " + classFullName + " of " + DragonsSpineMain.Instance.Settings.ServerName); } bool evils = Array.IndexOf(World.EvilProfessions, classType) != -1; if (evils) { list.Add(" Rank Name Profession Level Experience KPH Last Online Karma"); } else { list.Add(" Rank Name Profession Level Experience KPH Last Online"); } string anonymous = ""; try { var scores = DAL.DBWorld.GetScoresWithoutSP(classType, amount, devRequest, playerName, pvp); if (scores.Count < 1) { if (playerName != "") { list.Clear(); list.Add("No player named \"" + classAbbreviation + "\" found in the scores list."); return(list); } list.Clear(); list.Add("No scores found that match your search arguments."); return(list); } foreach (PC score in scores) { if (devRequest && score.IsAnonymous) { anonymous = " [ANON]"; } else if (devRequest && score.ImpLevel > Globals.eImpLevel.USER) { score.showStaffTitle = true; anonymous = " " + Conference.GetStaffTitle(score); } else { anonymous = ""; } // rank, name, profession, level, experience, KPH, last online list.Add(Convert.ToInt32(score.TemporaryStorage).ToString().PadLeft(4, ' ') + ". " + score.Name.PadRight(16, ' ') + Utils.FormatEnumString(score.BaseProfession.ToString()).PadRight(15, ' ') + score.Level.ToString().PadLeft(5, ' ') + score.Experience.ToString().PadLeft(11, ' ') + Rules.CalculateKillsPerHour(score).ToString().PadLeft(5, ' ') + " " + score.lastOnline.ToShortDateString().PadLeft(11, ' ') + (evils ? score.currentKarma.ToString().PadLeft(6, ' ') : "") + " " + anonymous); } return(list); } catch (Exception e) { Utils.Log("World.getScoresList(" + classType + ", " + amount + ", " + Convert.ToString(devRequest) + ", " + Convert.ToString(pvp) + ") " + e.Message + " Stack: " + e.StackTrace, Utils.LogType.Exception); Utils.LogException(e); return(null); } }
internal static List <PC> GetScoresWithoutSP(Character.ClassType classType, int amount, bool devRequest, string playerName, bool pvp) { using (var conn = DataAccess.GetSQLConnection()) { var scoresList = new List <PC>(); var score = new PC(); int rank = 1; try { var selectScores = new SqlCommand(); var selectByClassType = classType != Character.ClassType.None && classType != Character.ClassType.All ? "WHERE classType = '" + classType.ToString() + "'" : ""; var selectDevRequest = devRequest ? "1" : "0"; selectScores.Connection = conn; selectScores.CommandText = "SELECT [playerID], land, [name], classType, classFullName, [level], [exp], numKills, roundsPlayed, lastOnline, pvpKills, pvpDeaths, currentKarma, impLevel"; selectScores.CommandText += " FROM Player " + selectByClassType; if (!devRequest) { if (selectByClassType.Length > 0) { selectScores.CommandText += " AND impLevel = '0'"; } else { selectScores.CommandText += "WHERE impLevel = '0'"; } } selectScores.CommandText = selectScores.CommandText.TrimEnd(); selectScores.CommandText += " ORDER BY [exp] DESC"; DataTable dtScores = new DataTable(); selectScores.Connection.Open(); dtScores.Load(selectScores.ExecuteReader()); selectScores.Connection.Close(); foreach (DataRow dr in dtScores.Rows) { if (playerName != "") { if (dr["name"].ToString().ToLower() == playerName.ToString().ToLower()) { score = new PC(); score.UniqueID = Convert.ToInt32(dr["playerID"]); score.IsAnonymous = (bool)PC.GetField(score.UniqueID, "anonymous", score.IsAnonymous, null); if (score.IsAnonymous) { if (devRequest) { score.TemporaryStorage = rank; score = ConvertRowToScore(score, dr, devRequest); scoresList.Add(score); } return(scoresList); } else { score.TemporaryStorage = rank; score = ConvertRowToScore(score, dr, devRequest); scoresList.Add(score); return(scoresList); } } if (Convert.ToInt32(dr["impLevel"]) == 0 || score.Name.ToLower() == playerName.ToLower()) { rank++; } } else { if (amount == 0) { break; } score = new PC(); score.UniqueID = Convert.ToInt32(dr["playerID"]); score.IsAnonymous = (bool)PC.GetField(score.UniqueID, "anonymous", score.IsAnonymous, null); if (devRequest) // devs get to see a list of everyone { score.TemporaryStorage = rank; // player ID is used to store the player's rank score = ConvertRowToScore(score, dr, devRequest); scoresList.Add(score); if (!score.IsAnonymous && score.ImpLevel == Globals.eImpLevel.USER) { amount--; } } else // only add the score to the list if they are not anonymous { score.TemporaryStorage = rank; score = ConvertRowToScore(score, dr, devRequest); scoresList.Add(score); amount--; } rank++; } } return(scoresList); } catch (Exception e) { Utils.LogException(e); } } return(null); }
internal static List <PC> GetScores(Character.ClassType classType, int amount, bool devRequest, string playerName, bool pvp) { var scoresList = new List <PC>(); var score = new PC(); int rank = 1; using (var conn = DataAccess.GetSQLConnection()) { try { SqlStoredProcedure sp = new SqlStoredProcedure("prApp_Scores_Select", conn); sp.AddParameter("@devRequest", SqlDbType.Bit, 1, ParameterDirection.Input, devRequest); sp.AddParameter("@classType", SqlDbType.VarChar, 50, ParameterDirection.Input, classType.ToString()); DataTable dtScores = sp.ExecuteDataTable(); foreach (DataRow dr in dtScores.Rows) { if (playerName != "") { if (dr["name"].ToString().ToLower() == playerName.ToString().ToLower()) { score = new PC(); score.UniqueID = Convert.ToInt32(dr["playerID"]); score.IsAnonymous = (bool)PC.GetField(score.UniqueID, "anonymous", score.IsAnonymous, null); if (score.IsAnonymous) { if (devRequest) { score.TemporaryStorage = rank; score = ConvertRowToScore(score, dr, devRequest); scoresList.Add(score); } return(scoresList); } else { score.TemporaryStorage = rank; score = ConvertRowToScore(score, dr, devRequest); scoresList.Add(score); return(scoresList); } } if (Convert.ToInt32(dr["impLevel"]) == 0 || score.Name.ToLower() == playerName.ToLower()) { rank++; } } else { if (amount == 0) { break; } score = new PC(); score.UniqueID = Convert.ToInt32(dr["playerID"]); score.IsAnonymous = (bool)PC.GetField(score.UniqueID, "anonymous", score.IsAnonymous, null); if (devRequest) // devs get to see a list of everyone { score.TemporaryStorage = rank; // player ID is used to store the player's rank score = ConvertRowToScore(score, dr, devRequest); scoresList.Add(score); if (!score.IsAnonymous && score.ImpLevel == Globals.eImpLevel.USER) { amount--; } } else // only add the score to the list if they are not anonymous { score.TemporaryStorage = rank; score = ConvertRowToScore(score, dr, devRequest); scoresList.Add(score); amount--; } rank++; } } return(scoresList); } catch (Exception e) { Utils.LogException(e); return(null); } } }
public bool OnCast(Character caster, string args) { #region Determine number of pets. Return false if at or above MAX_PETS. if (!caster.IsImmortal) { int petCount = 0; foreach (NPC pet in caster.Pets) { if (pet.QuestList.Count == 0) { petCount++; } } if (petCount >= GameSpell.MAX_PETS) { caster.WriteToDisplay("You do not possess the mental fortitude to summon an ally."); return(false); } } #endregion args = args.Replace(ReferenceSpell.Command, ""); args = args.Trim(); string[] sArgs = args.Split(" ".ToCharArray()); #region Determine Power int magicSkillLevel = Skills.GetSkillLevel(caster.magic); int power = magicSkillLevel; if (sArgs.Length > 0) { try { power = Convert.ToInt32(sArgs[0]); if (power > magicSkillLevel && !caster.IsImmortal) { power = magicSkillLevel; } } catch (Exception) { power = magicSkillLevel; } } // Rangers get the spell at skill level 3, acts as skill level 1. if (!caster.IsImmortal && caster.BaseProfession != Character.ClassType.Druid) { power = power - 3; } if (power < 1) { power = 1; } #endregion List <Entity> availableEntities = new List <Entity>(); foreach (Tuple <int, Entity, bool> tuple in AlliesAvailable) { if (tuple.Item1 > power) { break; // Allies are in sequential power order. } if (tuple.Item1 <= power) { // Not all allies can be summoned indoors. if (caster.CurrentCell.IsOutdoors || (!caster.CurrentCell.IsOutdoors && !tuple.Item3)) { availableEntities.Add(tuple.Item2); } else { continue; } } } if (availableEntities.Count <= 0) { return(false); } Entity entity = availableEntities[Rules.Dice.Next(0, availableEntities.Count - 1)]; Autonomy.EntityBuilding.EntityBuilder builder = new Autonomy.EntityBuilding.EntityBuilder(); string profession = "fighter"; // If human or humanoid, possibly switch to another profession besides fighter. if (Autonomy.EntityBuilding.EntityLists.IsHumanOrHumanoid(entity)) { Character.ClassType[] availableProfessions = new Character.ClassType[] { Character.ClassType.Fighter, Character.ClassType.Thaumaturge, Character.ClassType.Wizard }; Character.ClassType randomProfession = availableProfessions[Rules.Dice.Next(0, availableProfessions.Length - 1)]; switch (randomProfession) { case Character.ClassType.Fighter: profession = Autonomy.EntityBuilding.EntityBuilder.FIGHTER_SYNONYMS[Rules.Dice.Next(0, Autonomy.EntityBuilding.EntityBuilder.FIGHTER_SYNONYMS.Length - 1)]; break; case Character.ClassType.Thaumaturge: profession = Autonomy.EntityBuilding.EntityBuilder.THAUMATURGE_SYNONYMS[Rules.Dice.Next(0, Autonomy.EntityBuilding.EntityBuilder.THAUMATURGE_SYNONYMS.Length - 1)]; break; case Character.ClassType.Wizard: profession = Autonomy.EntityBuilding.EntityBuilder.WIZARD_SYNONYMS[Rules.Dice.Next(0, Autonomy.EntityBuilding.EntityBuilder.WIZARD_SYNONYMS.Length - 1)]; break; } } NPC ally = builder.BuildEntity("nature allied", entity, caster.Map.ZPlanes[caster.Z], profession); // Set level. ally.Level = Math.Max(caster.Level, magicSkillLevel) + Rules.Dice.Next(-1, 1); // magic skill should be set to higher skill if using impcast if (ally.Level <= 0) { ally.Level = 1; } builder.SetOnTheFlyVariables(ally); ally.Alignment = caster.Alignment; builder.SetName(ally, ally.BaseProfession.ToString()); builder.SetDescriptions("", ally, caster.Map.ZPlanes[caster.Z], ally.BaseProfession.ToString().ToLower()); Autonomy.EntityBuilding.EntityBuilder.SetGender(ally, caster.Map.ZPlanes[caster.Z]); Autonomy.EntityBuilding.EntityBuilder.SetVisualKey(ally.entity, ally); if (ally.spellDictionary.Count > 0) { ally.magic = Skills.GetSkillForLevel(ally.Level + Rules.Dice.Next(-1, 1)); } GameSpell.FillSpellLists(ally); if (Autonomy.EntityBuilding.EntityLists.IsHumanOrHumanoid(ally)) { List <int> armorToWear; if (power <= 13) { armorToWear = Autonomy.ItemBuilding.ArmorSets.ArmorSet.ArmorSetDictionary[Autonomy.ItemBuilding.ArmorSets.ArmorSet.FULL_STUDDED_LEATHER].GetArmorList(ally); } else if (power < 16) { armorToWear = Autonomy.ItemBuilding.ArmorSets.ArmorSet.ArmorSetDictionary[Autonomy.ItemBuilding.ArmorSets.ArmorSet.FULL_CHAINMAIL].GetArmorList(ally); } else { armorToWear = Autonomy.ItemBuilding.ArmorSets.ArmorSet.ArmorSetDictionary[Autonomy.ItemBuilding.ArmorSets.ArmorSet.FULL_BANDED_MAIL].GetArmorList(ally); } foreach (int id in armorToWear) { Item armor = Item.CopyItemFromDictionary(id); // It's basic armor sets only. Label them as ethereal. (They will go back with the phantasm to their home plane. Given items drop.) armor.special += " " + Item.EXTRAPLANAR; ally.WearItem(armor); } } if (Autonomy.EntityBuilding.EntityLists.IsHumanOrHumanoid(ally) || Autonomy.EntityBuilding.EntityLists.ANIMALS_WIELDING_WEAPONS.Contains(ally.entity)) { List <int> weaponsList = Autonomy.ItemBuilding.LootManager.GetBasicWeaponsFromArmory(ally, true); if (weaponsList.Count > 0) { ally.EquipRightHand(Item.CopyItemFromDictionary(weaponsList[Rules.Dice.Next(weaponsList.Count - 1)])); } weaponsList = Autonomy.ItemBuilding.LootManager.GetBasicWeaponsFromArmory(ally, false); if (weaponsList.Count > 0) { ally.EquipLeftHand(Item.CopyItemFromDictionary(weaponsList[Rules.Dice.Next(weaponsList.Count - 1)])); } if (ally.RightHand != null) { ally.RightHand.special += " " + Item.EXTRAPLANAR; } if (ally.LeftHand != null) { ally.LeftHand.special += " " + Item.EXTRAPLANAR; } } ally.Hits = ally.HitsFull; ally.Mana = ally.ManaFull; ally.Stamina = ally.StaminaFull; ally.Age = GameWorld.World.AgeCycles[Rules.Dice.Next(0, GameWorld.World.AgeCycles.Count - 1)]; ally.special = "despawn summonnaturesally"; int twoMinutes = Utils.TimeSpanToRounds(new TimeSpan(0, 2, 0)); // 18 minutes + 2 minutes for every skill level past 3 ally.RoundsRemaining = (twoMinutes * 9) + ((magicSkillLevel - ReferenceSpell.RequiredLevel) * twoMinutes); //ally.species = Globals.eSpecies.Magical; // this may need to be changed for AI to work properly ally.canCommand = true; ally.IsMobile = true; ally.IsSummoned = true; ally.IsUndead = false; ally.FollowID = caster.UniqueID; ally.PetOwner = caster; caster.Pets.Add(ally); if (ally.CurrentCell != caster.CurrentCell) { ally.CurrentCell = caster.CurrentCell; } ReferenceSpell.SendGenericCastMessage(caster, null, true); ally.EmitSound(ally.idleSound); caster.WriteToDisplay((ally.longDesc.StartsWith("evil") ? "An " : "A ") + ally.longDesc + " answers your call for assistance."); ally.AddToWorld(); return(true); }
public ICharacterBuilderAge As(Character.ClassType classType) { _character.Class = classType; return(this); }
public bool OnCommand(Character chr, string args) { if (args == null) { chr.WriteToDisplay("impgotonpc <name> or impgotonpc <id>"); return(false); } else { chr.BreakFollowMode(); string[] sArgs = args.Split(" ".ToCharArray()); if (sArgs.Length == 1) { if (sArgs[0].ToLower() != "adventurer") { Character.ClassType baseProfession = Character.ClassType.None; #region Base Profession if (Enum.TryParse <Character.ClassType>(sArgs[0], true, out baseProfession)) { foreach (NPC npc in Character.NPCInGameWorld) { if (npc.MapID == chr.MapID && npc.BaseProfession == baseProfession) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to " + npc.GetLogString() + "."); return(true); } } foreach (NPC npc in Character.NPCInGameWorld) { if (npc.BaseProfession == baseProfession) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to " + npc.GetLogString() + "."); return(true); } } } #endregion int id = -1; #region NPC Unique ID or NPCID. // check if the argument provided is an integer, then match up an ID -- if no match, return false if (Int32.TryParse(sArgs[0], out id)) { foreach (NPC npc in Character.NPCInGameWorld) { if (id < 0 ? npc.UniqueID == id : npc.npcID == id) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to " + npc.GetLogString() + "."); return(true); } } chr.WriteToDisplay("Could not find NPC matching ID number: " + args + "."); return(false); } #endregion #region NPC name. // check current Map first foreach (Character npc in Character.NPCInGameWorld) { if (npc.Name.ToLower() == args.ToLower() && npc.MapID == chr.MapID) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to " + npc.GetLogString() + "."); return(true); } } // if not npc with name is found on current map, check entire world foreach (Character npc in Character.NPCInGameWorld) { if (npc.Name.ToLower() == args.ToLower()) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to " + npc.GetLogString() + "."); return(true); } } #endregion } else { foreach (Character npc in Character.NPCInGameWorld) { if (npc is Adventurer && npc.MapID == chr.MapID) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to the Adventurer " + npc.GetLogString() + "."); return(true); } } foreach (Character npc in Character.NPCInGameWorld) { if (npc is Adventurer) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to the Adventurer " + npc.GetLogString() + "."); return(true); } } } } else if (sArgs.Length == 2) // impgotonpc <npc name> <npc class> { foreach (Character npc in Character.NPCInGameWorld) { if (npc.Name.ToLower() == sArgs[0].ToLower() && npc.BaseProfession.ToString().ToLower() == sArgs[1].ToLower()) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to " + npc.GetLogString() + "."); return(true); } if (npc.Name.ToLower() == sArgs[0].ToLower() + " " + sArgs[1].ToLower()) { chr.CurrentCell = npc.CurrentCell; chr.WriteToDisplay("You have teleported to " + npc.GetLogString() + "."); return(true); } } } chr.WriteToDisplay("Could not find NPC matching args: " + args + "."); return(false); } }