public static string ComputeFameTitle(Mobile beheld) { int fame = beheld.Fame; int karma = beheld.Karma; for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame <= fe.m_Fame || i == (m_FameEntries.Length - 1)) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; if (karma <= ke.m_Karma || j == (karmaEntries.Length - 1)) { return(String.Format(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord")); } } return(String.Empty); } } return(String.Empty); }
public static List <string> GetFameKarmaEntries(Mobile m) { List <string> list = new List <string>(); int fame = m.Fame; int karma = m.Karma; for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame >= fe.m_Fame) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; StringBuilder title = new StringBuilder(); if ((karma >= 0 && ke.m_Karma >= 0 && karma >= ke.m_Karma) || (karma < 0 && ke.m_Karma < 0 && karma < ke.m_Karma)) { list.Add(title.AppendFormat(ke.m_Title, m.Name, m.Female ? "Lady" : "Lord").ToString()); } } } } return(list); }
/// <summary> /// Calculates the reputation title of the specified mobile /// </summary> /// <returns>the <code>Mobile</code>'s reputation title</returns> public static string GetNameTitle(Mobile beholder, Mobile beheld) { StringBuilder builder = new StringBuilder(); /*if ( beheld.Kills >= 5 ) * { * title.AppendFormat( beheld.Fame >= 10000 ? "The Murderer {1} {0}" : "The Murderer {0}", beheld.Name, beheld.Female ? "Lady" : "Lord" ); * } * else*/ if (beheld.ShowFameTitle || (beholder == beheld)) { for (int i = 0; i < m_FameEntries.Length; i++) { FameEntry fe = m_FameEntries[i]; if (beheld.Fame <= fe.m_Fame || i == (m_FameEntries.Length - 1)) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; j++) { KarmaEntry ke = karmaEntries[j]; if (beheld.Karma <= ke.m_Karma || (j == karmaEntries.Length - 1)) { builder.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord"); break; } } break; } } } else { builder.Append(beheld.Name); } return(builder.ToString()); }
public static string ComputeTitle(Mobile beholder, Mobile beheld) { StringBuilder title = new StringBuilder(); int fame = beheld.Fame; int karma = beheld.Karma; if (beheld.AccessLevel > AccessLevel.Player) { string staffTitle; if (beheld.AccessLevel == AccessLevel.GameMaster) { staffTitle = "Game Master"; } else { staffTitle = beheld.AccessLevel.ToString(); } title.AppendFormat("{0} {1}", staffTitle, beheld.Name); } else if (beheld.Kills >= 5) { title.AppendFormat(beheld.Fame >= 10000 ? "The Murderer {1} {0}" : "The Murderer {0}", beheld.Name, beheld.Female ? "Lady" : "Lord"); } else if (beheld.Criminal) { title.AppendFormat(beheld.Fame >= 10000 ? "The Criminal {1} {0}" : "The Criminal {0}", beheld.Name, beheld.Female ? "Lady" : "Lord"); } else { for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame <= fe.m_Fame || i == (m_FameEntries.Length - 1)) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; if (karma <= ke.m_Karma || j == (karmaEntries.Length - 1)) { title.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord"); break; } } break; } } } if (beheld.Guild != null && !beheld.Guild.Disbanded && !string.IsNullOrEmpty(beheld.Guild.Abbreviation)) { if (beheld.DisplayGuildTitle) { title.AppendFormat(" [{0}]", beheld.Guild.Abbreviation); } } if (beheld is PlayerMobile && ((PlayerMobile)beheld).DisplayChampionTitle) { PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)beheld).ChampionTitles; if (info.Harrower > 0) { title.AppendFormat(": {0} of Evil", HarrowerTitles[Math.Min(HarrowerTitles.Length, info.Harrower) - 1]); } else { int highestValue = 0, highestType = 0; for (int i = 0; i < ChampionSpawnInfo.Table.Length; i++) { int v = info.GetValue(i); if (v > highestValue) { highestValue = v; highestType = i; } } int offset = 0; if (highestValue > 800) { offset = 3; } else if (highestValue > 300) { offset = (highestValue / 300); } if (offset > 0) { ChampionSpawnInfo champInfo = ChampionSpawnInfo.GetInfo((ChampionSpawnType)highestType); title.AppendFormat(": {0} of the {1}", champInfo.LevelNames[Math.Min(offset, champInfo.LevelNames.Length) - 1], champInfo.Name); } } } string customTitle = beheld.Title; if (customTitle != null && (customTitle = customTitle.Trim()).Length > 0) { title.AppendFormat(" {0}", customTitle); } else if (beheld.Guild != null && !beheld.Guild.Disbanded && beheld.DisplayGuildTitle && !string.IsNullOrEmpty(beheld.GuildTitle)) { title.AppendFormat(", {0}", beheld.GuildTitle); } else if (beheld.Player && (beheld.AccessLevel == AccessLevel.Player || beholder == beheld)) { string skillTitle = GetSkillTitle(beheld); if (skillTitle != null) { title.Append(", ").Append(skillTitle); } } return(title.ToString()); }
public static string ComputeTitle(Mobile beholder, Mobile beheld) { StringBuilder title = new StringBuilder(); int fame = beheld.Fame; int karma = beheld.Karma; bool showSkillTitle = beheld.ShowFameTitle && ((beholder == beheld) || (fame >= 5000)); /*if ( beheld.Kills >= 5 ) * { * title.AppendFormat( beheld.Fame >= 10000 ? "The Murderer {1} {0}" : "The Murderer {0}", beheld.Name, beheld.Female ? "Lady" : "Lord" ); * } * else*/if (beheld.ShowFameTitle || (beholder == beheld)) { for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame <= fe.m_Fame || i == (m_FameEntries.Length - 1)) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; if (karma <= ke.m_Karma || j == (karmaEntries.Length - 1)) { title.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord"); break; } } break; } } } else { title.Append(beheld.Name); } if (beheld is PlayerMobile && ((PlayerMobile)beheld).DisplayChampionTitle) { PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)beheld).ChampionTitles; if (info.Harrower > 0) { title.AppendFormat(": {0} of Evil", HarrowerTitles[Math.Min(HarrowerTitles.Length, info.Harrower) - 1]); } else { int highestValue = 0, highestType = 0; for (int i = 0; i < ChampionSpawnInfo.Table.Length; i++) { int v = info.GetValue(i); if (v > highestValue) { highestValue = v; highestType = i; } } int offset = 0; if (highestValue > 800) { offset = 3; } else if (highestValue > 300) { offset = (int)(highestValue / 300); } if (offset > 0) { ChampionSpawnInfo champInfo = ChampionSpawnInfo.GetInfo((ChampionSpawnType)highestType); title.AppendFormat(": {0} of the {1}", champInfo.LevelNames[Math.Min(offset, champInfo.LevelNames.Length) - 1], champInfo.Name); } } } string customTitle = beheld.Title; if (customTitle != null && (customTitle = customTitle.Trim()).Length > 0) { title.AppendFormat(" {0}", customTitle); } else if (showSkillTitle && beheld.Player) { string skillTitle = GetSkillTitle(beheld); if (skillTitle != null) { title.Append(", ").Append(skillTitle); } } return(title.ToString()); }
public static string ComputeTitle(Mobile beholder, Mobile beheld) { StringBuilder title = new StringBuilder(); int fame = beheld.Fame; int karma = beheld.Karma; bool showSkillTitle = beheld.ShowFameTitle && ((beholder == beheld) || (fame >= 5000)); if (beheld.Murderer) { title.AppendFormat(beheld.Fame >= 10000 ? "The Murderer {1} {0}" : "The Murderer {0}", beheld.Name, beheld.Female ? "Lady" : "Lord"); } else if (beheld.ShowFameTitle || (beholder == beheld)) { for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame <= fe.m_Fame || i == (m_FameEntries.Length - 1)) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; if (karma <= ke.m_Karma || j == (karmaEntries.Length - 1)) { title.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord"); break; } } break; } } } else { title.Append(beheld.Name); } #region Champion Monster Titles PlayerMobile pm = beheld as PlayerMobile; string championTitle = GetChampionTitle(pm); if (pm != null && pm.DisplayChampionTitle && championTitle != null) { title.AppendFormat(": {0}", championTitle); } #endregion string customTitle = beheld.Title; if (customTitle != null && (customTitle = customTitle.Trim()).Length > 0) { title.AppendFormat(" {0}", customTitle); } else if (showSkillTitle && beheld.Player) { Skill highest = GetHighestSkill(beheld); // beheld.Skills.Highest; if (highest != null && highest.BaseFixedPoint >= 300) { string skillLevel = (string)Utility.GetArrayCap(m_Levels, (highest.BaseFixedPoint - 300) / 100); if (highest.Info.SkillId == 0x34) { skillLevel = (string)Utility.GetArrayCap(m_Levels_Samurai, (highest.BaseFixedPoint - 300) / 100); } if (highest.Info.SkillId == 0x35) { skillLevel = (string)Utility.GetArrayCap(m_Levels_Ninja, (highest.BaseFixedPoint - 300) / 100); } string skillTitle = highest.Info.Title; if (beheld.Female) { if (skillTitle.EndsWith("man")) { skillTitle = skillTitle.Substring(0, skillTitle.Length - 3) + "woman"; } } title.AppendFormat(", {0} {1}", skillLevel, skillTitle); } } return(title.ToString()); }
/* ** OSI MODEL ** * 1. Legendary 120 * 2. Elder 110 * 3. Grandmaster 100 * 4. Master 90 * 5. Adept 80 * 6. Expert 70 * 7. Journeyman 60 * 8. Apprentice 50 * 9. Novice 40 * 10. Neophyte 30 * No Title 29 or below */ public static string ComputeTitle(Mobile beholder, Mobile beheld) { StringBuilder title = new StringBuilder(); try { int fame = beheld.Fame; int karma = beheld.Karma; bool showFameTitle = beheld.ShowFameTitle; bool showSkillTitle = showFameTitle && ((beholder == beheld) || (fame >= 5000)); /* Publish February 24,1999 * Members of the Thieves Guild do not display professional titles on the paperdoll to anyone except themselves, regardless of skill level or fame. * http://www.uoguide.com/Publish_-_February_24,_1999#Stealing */ if ((beheld is PlayerMobile && beholder is PlayerMobile) && beholder != beheld && (beheld as PlayerMobile).NpcGuild == NpcGuild.ThievesGuild && !(Core.UOAI || Core.UOAR || Core.UOMO)) { // no titles unless looking at self showFameTitle = showSkillTitle = false; } if (beheld.Murderer && (Core.UOAI || Core.UOAR || Core.UOMO)) { title.AppendFormat(fame >= 10000 ? "{3}{1} {0}, Murderer of {2}" : "{3}{0}, Murderer of {2}", beheld.Name, beheld.Female ? "Lady" : "Lord", beheld.LongTermMurders, beheld.LongTermMurders >= 200 ? "The Legendary " : ""); } else if (showFameTitle || (beholder == beheld)) { for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame <= fe.m_Fame || i == (m_FameEntries.Length - 1)) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; if (karma <= ke.m_Karma || j == (karmaEntries.Length - 1)) { title.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord"); break; } } break; } } } else { title.Append(beheld.Name); } if (beheld is PlayerMobile) { PlayerMobile pm = (PlayerMobile)beheld; #region mortal if (pm.Mortal) { title.Append(" the Mortal"); } #endregion #region Ethics if (Core.OldEthics) { // old-school Hero/Evil titles // You will gain the title of "the Evil," and you will have "[evil]" attached to your name when looked at. Ethics.Ethic ethic = Ethics.Ethic.Find(pm); if (ethic == Ethics.Ethic.Hero && (pm.EthicPlayer.Power == 0 || pm.EthicPlayer.History == 0)) { title.Append(" the Fallen Hero"); } else if (ethic == Ethics.Ethic.Hero) { title.Append(" the Hero"); } else if (ethic == Ethics.Ethic.Evil) { title.Append(" the Evil"); } } #endregion #region IOB string iobtitle = ""; if (pm.IOBAlignment != IOBAlignment.None) { try { iobtitle = IOBRankTitle.rank[(int)pm.IOBAlignment, (int)pm.IOBRank]; } catch (Exception exc) { LogHelper.LogException(exc); System.Console.WriteLine("Caught exception in Titles: " + exc.Message); System.Console.WriteLine(exc.StackTrace); } if (iobtitle.Length > 0) { title.AppendFormat(", {0}", iobtitle); } } #endregion } string customTitle = beheld.Title; if (customTitle != null && (customTitle = customTitle.Trim()).Length > 0) { title.AppendFormat(" {0}", customTitle); } else if (showSkillTitle && beheld.Player && beheld.LongTermMurders < 5) { Skill highest = GetHighestSkill(beheld); // beheld.Skills.Highest; if (highest != null && highest.BaseFixedPoint >= 300) { string skillLevel = (string)Utility.GetArrayCap(m_Levels, (highest.BaseFixedPoint - 300) / 100); string skillTitle = ComputeSkillTitle(beheld); if (beheld.Female) { if (skillTitle.EndsWith("man")) { skillTitle = skillTitle.Substring(0, skillTitle.Length - 3) + "woman"; } } title.AppendFormat(", {0} {1}", skillLevel, skillTitle); } } } catch (Exception ex) { LogHelper.LogException(ex); } return(title.ToString()); }
public static string ComputeTitle(Mobile beholder, Mobile beheld) { StringBuilder title = new StringBuilder(); int fame = beheld.Fame; int karma = beheld.Karma; bool showSkillTitle = beheld.ShowFameTitle && (beholder == beheld || fame >= 5000); /*if ( beheld.Kills >= 5 ) * { * title.AppendFormat( beheld.Fame >= 10000 ? "The Murderer {1} {0}" : "The Murderer {0}", beheld.Name, beheld.Female ? "Lady" : "Lord" ); * } * else*/if (beheld.ShowFameTitle || beholder == beheld) { for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame <= fe.m_Fame || i == m_FameEntries.Length - 1) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; if (karma <= ke.m_Karma || j == karmaEntries.Length - 1) { title.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord"); break; } } break; } } } else { title.Append(beheld.Name); } string customTitle = beheld.Title; if (customTitle != null && (customTitle = customTitle.Trim()).Length > 0) { title.AppendFormat(" {0}", customTitle); } else if (showSkillTitle && beheld.Player) { string skillTitle = GetSkillTitle(beheld); if (skillTitle != null) { title.Append(", ").Append(skillTitle); } } return(title.ToString()); }
public static string ComputeTitle(Mobile beholder, Mobile beheld, bool include_ipy_prefix) { StringBuilder title = new StringBuilder(); int fame = beheld.Fame; int karma = beheld.Karma; bool showSkillTitle = beheld.ShowFameTitle && ((beholder == beheld) || (fame >= 5000)); if (beheld.ShowFameTitle || (beholder == beheld)) { for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame <= fe.m_Fame || i == (m_FameEntries.Length - 1)) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; if (karma <= ke.m_Karma || j == (karmaEntries.Length - 1)) { //title.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord"); title.Append(ke.m_Title); break; } } break; } } } if (beheld.Fame >= 10000) { title.AppendFormat(title.Length > 0 ? " {0}" : "{0}", beheld.Female ? "Lady" : "Lord"); } title.AppendFormat(title.Length > 0 ? " {0}" : "{0}", beheld.Name); string customTitle = beheld.Title; if (customTitle != null && customTitle.Trim().Length > 0) { title.AppendFormat(customTitle.IndexOf("the", 0, 5) == -1 ? ", {0}" : " {0}", customTitle.Trim()); } if (customTitle == null || customTitle.Trim().Length == 0) { if (showSkillTitle && beheld.Player) { string skillTitle = GetSkillTitle(beheld); if (skillTitle != null) { title.Append(", ").Append(skillTitle); } } } return(title.ToString()); }
/* ** OSI MODEL ** * 1. Legendary 120 * 2. Elder 110 * 3. Grandmaster 100 * 4. Master 90 * 5. Adept 80 * 6. Expert 70 * 7. Journeyman 60 * 8. Apprentice 50 * 9. Novice 40 * 10. Neophyte 30 * No Title 29 or below */ public static string ComputeTitle(Mobile beholder, Mobile beheld) { StringBuilder title = new StringBuilder(); try { int fame = beheld.Fame; int karma = beheld.Karma; bool showSkillTitle = beheld.ShowFameTitle && ((beholder == beheld) || (fame >= 5000)); /*if ( beheld.Kills >= 5 ) * { * title.AppendFormat( beheld.Fame >= 10000 ? "The Murderer {1} {0}" : "The Murderer {0}", beheld.Name, beheld.Female ? "Lady" : "Lord" ); * } * else*/ if (beheld.ShowFameTitle || (beholder == beheld)) { for (int i = 0; i < m_FameEntries.Length; ++i) { FameEntry fe = m_FameEntries[i]; if (fame <= fe.m_Fame || i == (m_FameEntries.Length - 1)) { KarmaEntry[] karmaEntries = fe.m_Karma; for (int j = 0; j < karmaEntries.Length; ++j) { KarmaEntry ke = karmaEntries[j]; if (karma <= ke.m_Karma || j == (karmaEntries.Length - 1)) { title.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord"); break; } } break; } } } else { title.Append(beheld.Name); } if (beheld is PlayerMobile) { PlayerMobile pm = (PlayerMobile)beheld; if (pm.Mortal) { title.Append(" the Mortal"); } string iobtitle = ""; if (pm.IOBAlignment != IOBAlignment.None) { try { iobtitle = IOBRankTitle.rank[(int)pm.IOBAlignment, (int)pm.IOBRank]; } catch (Exception exc) { LogHelper.LogException(exc); System.Console.WriteLine("Caught exception in Titles: " + exc.Message); System.Console.WriteLine(exc.StackTrace); } if (iobtitle.Length > 0) { title.AppendFormat(", {0}", iobtitle); } } } string customTitle = beheld.Title; if (customTitle != null && (customTitle = customTitle.Trim()).Length > 0) { title.AppendFormat(" {0}", customTitle); } else if (showSkillTitle && beheld.Player) { Skill highest = GetHighestSkill(beheld); // beheld.Skills.Highest; if (highest != null && highest.BaseFixedPoint >= 300) { string skillLevel = (string)Utility.GetArrayCap(m_Levels, (highest.BaseFixedPoint - 300) / 100); string skillTitle = highest.Info.Title; if (beheld.Female) { if (skillTitle.EndsWith("man")) { skillTitle = skillTitle.Substring(0, skillTitle.Length - 3) + "woman"; } } title.AppendFormat(", {0} {1}", skillLevel, skillTitle); } } } catch (Exception ex) { LogHelper.LogException(ex); } return(title.ToString()); }