diff --git a/Projects/Server/Mobiles/Mobile.cs b/Projects/Server/Mobiles/Mobile.cs index 9d25693fe..b86353f1b 100644 --- a/Projects/Server/Mobiles/Mobile.cs +++ b/Projects/Server/Mobiles/Mobile.cs @@ -2429,8 +2429,6 @@ public partial class Mobile : IHued, IComparable, ISpawnable, IObjectPro DropHolding(); - Region.OnRegionChange(this, m_Region, null); - if (Alive) { mobilesDeletedCounter.Add(1, new KeyValuePair[] { @@ -2439,6 +2437,8 @@ public partial class Mobile : IHued, IComparable, ISpawnable, IObjectPro }); } + Region.OnRegionChange(this, m_Region, null); + m_Region = null; // Is the above line REALLY needed? The old Region system did NOT have said line // and worked fine, because of this a LOT of extra checks have to be done everywhere... diff --git a/Projects/UOContent/Mobiles/PlayerMobile.cs b/Projects/UOContent/Mobiles/PlayerMobile.cs index f9b607cc9..5af206a61 100644 --- a/Projects/UOContent/Mobiles/PlayerMobile.cs +++ b/Projects/UOContent/Mobiles/PlayerMobile.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.Metrics; using ModernUO.CodeGeneratedEvents; using Server.Accounting; using Server.Collections; @@ -99,6 +100,7 @@ namespace Server.Mobiles public partial class PlayerMobile : Mobile, IHonorTarget, IHasSteps { + public static readonly Counter playerDeathCounter = Telemetry.MobilesMeter.CreateCounter("player_death_count"); private static bool m_NoRecursion; private static readonly Point3D[] m_TrammelDeathDestinations = @@ -2542,6 +2544,12 @@ namespace Server.Mobiles base.OnDeath(c); + playerDeathCounter.Add(1, new KeyValuePair[] + { + new("Map", Map?.Name), + new("Region", Region?.Name), + }); + EquipSnapshot = null; HueMod = -1; diff --git a/Projects/UOContent/Spells/Base/Spell.cs b/Projects/UOContent/Spells/Base/Spell.cs index f6407a178..fa4dcfdce 100644 --- a/Projects/UOContent/Spells/Base/Spell.cs +++ b/Projects/UOContent/Spells/Base/Spell.cs @@ -944,6 +944,15 @@ namespace Server.Spells if (_spell.State == SpellState.Casting && caster.Spell == _spell) { _spell.State = SpellState.Sequencing; + + spellCastCount.Add(1, new KeyValuePair[] + { + new("SpellName", _spell.Name), + new("Skill", $"{_spell.CastSkill}"), + new("Map", caster.Map?.Name), + new("Region", caster.Region?.Name), + }); + _spell._castTimer = null; caster.OnSpellCast(_spell); caster.Region?.OnSpellCast(caster, _spell); @@ -961,14 +970,6 @@ namespace Server.Spells caster.Target?.BeginTimeout(caster, 30000); // 30 seconds } - spellCastCount.Add(1, new KeyValuePair[] - { - new("SpellName", _spell.Name), - new("Skill", $"{_spell.CastSkill}"), - new("Map", $"{caster.Map.Name}"), - new("Region", $"{caster.Region?.Name}"), - }); - _spell._castTimer = null; } }