diff --git a/Projects/UOContent/Gumps/MyStats.cs b/Projects/UOContent/Gumps/MyStats.cs new file mode 100644 index 000000000..307b604f4 --- /dev/null +++ b/Projects/UOContent/Gumps/MyStats.cs @@ -0,0 +1,76 @@ +using System; +using Server; +using Server.Gumps; +using Server.Mobiles; +using Server.Commands; +using Server.Network; + +namespace Server.Custom.UI +{ + public class PlayerStats + { + public static void Initialize() + { + CommandSystem.Register("MyStats", AccessLevel.Player, new CommandEventHandler(OnCommand)); + } + + [Usage("MyStats")] + [Description("Opens the player statistics gump.")] + public static void OnCommand(CommandEventArgs e) + { + if (e.Mobile is PlayerMobile pm) + { + pm.CloseGump(); + pm.SendGump(new PlayerStatsGump(pm)); + } + } + } + + public class PlayerStatsGump : Gump + { + public PlayerStatsGump(PlayerMobile pm) : base(50, 50) + { + Closable = true; + Disposable = true; + Draggable = true; + Resizable = false; + + AddPage(0); + + AddBackground(0, 0, 300, 260, 9270); + AddAlphaRegion(10, 10, 280, 240); + + AddLabel(85, 15, 1152, "PLAYER STATISTICS"); + + int y = 55; + + AddLabel(25, y, 1152, "Total Player Deaths:"); + AddLabel(180, y, 1152, pm.TotalPlayerDeaths.ToString("N0")); + y += 30; + + AddLabel(25, y, 1152, "Total Monsters Killed:"); + AddLabel(180, y, 1152, pm.TotalMonstersKilled.ToString("N0")); + y += 30; + + AddLabel(25, y, 1152, "Total Gold Looted:"); + AddLabel(180, y, 1152, pm.TotalGoldLooted.ToString("N0")); + y += 30; + + AddLabel(25, y, 1152, "Spendable Kill Points:"); + AddLabel(180, y, 1152, pm.MonsterKillPoints.ToString("N0")); + y += 30; + + AddLabel(25, y, 1152, "Lifetime Kill Points:"); + AddLabel(180, y, 1152, pm.LifetimeKillPoints.ToString("N0")); + y += 45; + + AddButton(25, y, 4017, 4019, 0, GumpButtonType.Reply, 0); + AddLabel(60, y, 1152, "Close Menu"); + } + + public override void OnResponse(NetState sender, in RelayInfo info) + { + // ButtonID 0 handles the close button automatically, so no additional logic is needed here + } + } +} diff --git a/Projects/UOContent/Mobiles/BaseCreature.cs b/Projects/UOContent/Mobiles/BaseCreature.cs index 467b3a8ef..797f7b34e 100644 --- a/Projects/UOContent/Mobiles/BaseCreature.cs +++ b/Projects/UOContent/Mobiles/BaseCreature.cs @@ -3646,7 +3646,6 @@ namespace Server.Mobiles if (c != null) { - // Identify the killer (this naturally routes credit from tamed pets to their owner) Mobile killer = this.LastKiller; if (killer is BaseCreature pet && pet.ControlMaster != null) { @@ -3655,7 +3654,6 @@ namespace Server.Mobiles if (killer is PlayerMobile pm) { - // Scan the newly generated corpse for the exact amount of gold created int goldFound = c.GetAmount(typeof(Gold)); if (goldFound > 0) @@ -3666,6 +3664,7 @@ namespace Server.Mobiles if (points > 0) { pm.MonsterKillPoints += points; + pm.LifetimeKillPoints += points; } } } diff --git a/Projects/UOContent/Mobiles/PlayerMobile.cs b/Projects/UOContent/Mobiles/PlayerMobile.cs index f140a068d..f4085d5aa 100644 --- a/Projects/UOContent/Mobiles/PlayerMobile.cs +++ b/Projects/UOContent/Mobiles/PlayerMobile.cs @@ -754,6 +754,14 @@ namespace Server.Mobiles set => m_TotalMonstersKilled = value; } + private int m_LifetimeKillPoints; + [CommandProperty(AccessLevel.GameMaster)] + public int LifetimeKillPoints + { + get => m_LifetimeKillPoints; + set => m_LifetimeKillPoints = value; + } + private int m_TotalPlayerDeaths; [CommandProperty(AccessLevel.GameMaster)] public int TotalPlayerDeaths @@ -2808,6 +2816,7 @@ namespace Server.Mobiles { case 35: { + m_LifetimeKillPoints = reader.ReadInt(); m_TotalPlayerDeaths = reader.ReadInt(); m_TotalMonstersKilled = reader.ReadInt(); m_TotalGoldLooted = reader.ReadInt(); @@ -3163,6 +3172,7 @@ namespace Server.Mobiles writer.Write(35); // version + writer.Write(m_LifetimeKillPoints); writer.Write(m_TotalPlayerDeaths); writer.Write(m_TotalMonstersKilled); writer.Write(m_TotalGoldLooted);