diff --git a/Projects/UOContent/Engines/Spawners/Commands/ConvertPremiumSpawners.cs b/Projects/UOContent/Engines/Spawners/Commands/ConvertPremiumSpawners.cs index 7a83677f7..c68b77b4f 100644 --- a/Projects/UOContent/Engines/Spawners/Commands/ConvertPremiumSpawners.cs +++ b/Projects/UOContent/Engines/Spawners/Commands/ConvertPremiumSpawners.cs @@ -79,7 +79,7 @@ namespace Server.Engines.Spawners var fullOutputDir = Path.Combine(outputDir, stemDir); PathUtility.EnsureDirectory(fullOutputDir); - var outputFileName = $"{file.Name[..^file.Extension.Length]}.json"; + var outputFileName = $"{file.Name.AsSpan(0, file.Name.Length - file.Extension.Length)}.json"; ParsePremiumSpawnerFile(file.FullName, Path.Combine(fullOutputDir, outputFileName), options); } catch (Exception e) @@ -231,13 +231,11 @@ namespace Server.Engines.Spawners return TimeSpan.MinValue; } - time = time.ToLowerInvariant(); - - return time[^1] switch + return char.ToLowerInvariant(time[^1]) switch { - 'h' => TimeSpan.FromHours(double.Parse(time[..^1])), - 'm' => TimeSpan.FromMinutes(double.Parse(time[..^1])), - 's' => TimeSpan.FromSeconds(double.Parse(time[..^1])), + 'h' => TimeSpan.FromHours(double.Parse(time.AsSpan(0, time.Length - 1))), + 'm' => TimeSpan.FromMinutes(double.Parse(time.AsSpan(0, time.Length - 1))), + 's' => TimeSpan.FromSeconds(double.Parse(time.AsSpan(0, time.Length - 1))), _ => TimeSpan.FromMinutes(double.Parse(time)) }; } diff --git a/Projects/UOContent/Items/Skill Items/Musical Instruments/BaseInstrument.cs b/Projects/UOContent/Items/Skill Items/Musical Instruments/BaseInstrument.cs index 5dc0d5dca..c92f853f2 100644 --- a/Projects/UOContent/Items/Skill Items/Musical Instruments/BaseInstrument.cs +++ b/Projects/UOContent/Items/Skill Items/Musical Instruments/BaseInstrument.cs @@ -260,7 +260,10 @@ namespace Server.Items - Summoning Undead */ - var val = targ.HitsMax * 1.6 + targ.StamMax + targ.ManaMax; + // Before LBR, the success rate is actually your skill rate. + // We are going to fudge the numbers so it feels right without having two separate provocation calculations + // To do this, we should *undo* the 1.6x multiplier on HitsMaxSeed + var val = targ.HitsMax * (Core.LBR ? 1.6 : 0.625) + targ.StamMax + targ.ManaMax; val += targ.SkillsTotal / 10.0; diff --git a/Projects/UOContent/Misc/LanguageStatistics.cs b/Projects/UOContent/Misc/LanguageStatistics.cs index b19092a8f..f9c1ace53 100644 --- a/Projects/UOContent/Misc/LanguageStatistics.cs +++ b/Projects/UOContent/Misc/LanguageStatistics.cs @@ -166,16 +166,14 @@ namespace Server.Misc private static string GetFormattedInfo(string code) { - if (code?.Length != 3) + if (code?.Length == 3) { - return $"Unknown code {code}"; - } - - for (var i = 0; i < InternationalCodes.Length; i++) - { - if (code == InternationalCodes[i].Code) + for (var i = 0; i < InternationalCodes.Length; i++) { - return $"{InternationalCodes[i].GetName()}"; + if (code == InternationalCodes[i].Code) + { + return InternationalCodes[i].GetName(); + } } } diff --git a/Projects/UOContent/Misc/ShrinkTable.cs b/Projects/UOContent/Misc/ShrinkTable.cs index dbb8a6a64..2c4f71093 100644 --- a/Projects/UOContent/Misc/ShrinkTable.cs +++ b/Projects/UOContent/Misc/ShrinkTable.cs @@ -30,6 +30,7 @@ namespace Server private static int[] Load() { var path = "Data/shrink.json"; + var table = JsonConfig.Deserialize>(path); if (table == null) { diff --git a/Projects/UOContent/Misc/Titles.cs b/Projects/UOContent/Misc/Titles.cs index c9f6f9db0..98ada37ee 100644 --- a/Projects/UOContent/Misc/Titles.cs +++ b/Projects/UOContent/Misc/Titles.cs @@ -380,7 +380,7 @@ namespace Server.Misc if (mob.Female && skillTitle.EndsWithOrdinal("man")) { - skillTitle = $"{skillTitle[..^3]}woman"; + return $"{skillLevel} {skillTitle.AsSpan(0, skillTitle.Length - 3)}woman"; } return $"{skillLevel} {skillTitle}"; diff --git a/Projects/UOContent/Skills/Provocation.cs b/Projects/UOContent/Skills/Provocation.cs index ad5571005..0cd329333 100644 --- a/Projects/UOContent/Skills/Provocation.cs +++ b/Projects/UOContent/Skills/Provocation.cs @@ -63,9 +63,9 @@ namespace Server.SkillHandlers { from.RevealingAction(); m_Instrument.PlayInstrumentWell(from); - from.SendLocalizedMessage( - 1008085 - ); // You play your music and your target becomes angered. Whom do you wish them to attack? + + // You play your music and your target becomes angered. Whom do you wish them to attack? + from.SendLocalizedMessage(1008085); from.Target = new InternalSecondTarget(from, m_Instrument, creature); } } @@ -99,9 +99,8 @@ namespace Server.SkillHandlers { if (!m_Instrument.IsChildOf(from.Backpack)) { - from.SendLocalizedMessage( - 1062488 - ); // The instrument you are trying to play is no longer in your backpack! + // The instrument you are trying to play is no longer in your backpack! + from.SendLocalizedMessage(1062488); } else if (m_Creature.Unprovokable) { @@ -111,21 +110,18 @@ namespace Server.SkillHandlers { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } - else if (m_Creature.Map != creature.Map || !m_Creature.InRange( - creature, - BaseInstrument.GetBardRange(from, SkillName.Provocation) - )) + else if (m_Creature.Map != creature.Map || + !m_Creature.InRange(creature, BaseInstrument.GetBardRange(from, SkillName.Provocation))) { - from.SendLocalizedMessage( - 1049450 - ); // The creatures you are trying to provoke are too far away from each other for your music to have an effect. + // The creatures you are trying to provoke are too far away from each other for your music to have an effect. + from.SendLocalizedMessage(1049450); } else if (m_Creature != creature) { from.NextSkillTime = Core.TickCount + 10000; - var diff = (m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * - 0.5 - 5.0; + var diff = + (m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5 - 5.0; var music = from.Skills.Musicianship.Value; if (music > 100.0)