#W# Added: Now tracking player deaths, mobs kill (need to drop gold) and total gold, doesn't have to be looted.

This commit is contained in:
WarrentyExpired 2026-10-03 20:07:08 -04:00
parent ce9983b081
commit 65d434c44a
4 changed files with 67 additions and 34 deletions

View file

@ -100,8 +100,8 @@ public static partial class CharacterCreation
public static readonly CityInfo[] NewHavenStartingCities =
[
new("Fairwinds", "The Bountiful Harvest Inn", 1150168, 2272, 2812, 0, Map.Trammel),
new("Bastion", "The Wayfarer's Inn", 1075074, 1839, 2004, 0, Map.Trammel),
new("Fairwinds", "The Bountiful Harvest Inn", 1150168, 2272, 2812, 0, Map.Trammel),
];
public static readonly CityInfo[] StartingCitiesSA =

View file

@ -68,29 +68,27 @@ namespace Server.Custom.UI
if (m_IsVertical)
{
AddBackground(0, 0, 150, 200, 9270);
AddBackground(0, 0, 150, 175, 9270);
AddHtml(15, 15, 120, 20, $"<BASEFONT COLOR=#FCCA03>Fame:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.Fame}</BASEFONT>", false, false);
AddHtml(15, 40, 120, 20, $"<BASEFONT COLOR=#FCCA03>Karma:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.Karma}</BASEFONT>", false, false);
AddHtml(15, 65, 120, 20, $"<BASEFONT COLOR=#FCCA03>Hunger:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.Hunger}/20</BASEFONT>", false, false);
AddHtml(15, 90, 120, 20, $"<BASEFONT COLOR=#FCCA03>Thirst:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.Thirst}/20</BASEFONT>", false, false);
AddHtml(15, 115, 120, 20, $"<BASEFONT COLOR=#FCCA03>Tithing:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.TithingPoints}</BASEFONT>", false, false);
AddHtml(15, 140, 120, 20, $"<BASEFONT COLOR=#FCCA03>Kills:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.MonsterKillPoints}</BASEFONT>", false, false);
AddButton(115, 167, 9720, 9722, 2, GumpButtonType.Reply, 0);
AddButton(115, 142, 9720, 9722, 2, GumpButtonType.Reply, 0);
}
else
{
AddBackground(0, 0, 650, 45, 9270);
AddBackground(0, 0, 550, 45, 9270);
AddHtml(15, 12, 110, 20, $"<BASEFONT COLOR=#FCCA03>Fame:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.Fame}</BASEFONT>", false, false);
AddHtml(110, 12, 110, 20, $"<BASEFONT COLOR=#FCCA03>Karma:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.Karma}</BASEFONT>", false, false);
AddHtml(215, 12, 110, 20, $"<BASEFONT COLOR=#FCCA03>Hunger:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.Hunger}/20</BASEFONT>", false, false);
AddHtml(315, 12, 110, 20, $"<BASEFONT COLOR=#FCCA03>Thirst:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.Thirst}/20</BASEFONT>", false, false);
AddHtml(410, 12, 110, 20, $"<BASEFONT COLOR=#FCCA03>Tithing:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.TithingPoints}</BASEFONT>", false, false);
AddHtml(510, 12, 110, 20, $"<BASEFONT COLOR=#FCCA03>Kills:</BASEFONT> <BASEFONT COLOR=#FFFFFF>{pm.MonsterKillPoints}</BASEFONT>", false, false);
AddButton(625, 15, 9720, 9722, 2, GumpButtonType.Reply, 0);
AddButton(525, 15, 9720, 9722, 2, GumpButtonType.Reply, 0);
}
}

View file

@ -3453,17 +3453,6 @@ namespace Server.Mobiles
Paragon.GiveArtifactTo(mob);
}
}
if (mob is PlayerMobile player)
{
int points = this.Fame / 200;
if (points > 0)
{
player.MonsterKillPoints += points;
player.SendMessage(0x43, $"You earned {points} kill points. (Total: {player.MonsterKillPoints})");
}
}
}
public override void OnDeath(Container c)
@ -3655,6 +3644,32 @@ namespace Server.Mobiles
base.OnDeath(c);
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)
{
killer = pet.ControlMaster;
}
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)
{
pm.TotalGoldLooted += goldFound;
pm.TotalMonstersKilled += 1;
int points = this.Fame /200;
if (points > 0)
{
pm.MonsterKillPoints += points;
}
}
}
}
if (DeleteCorpseOnDeath)
{
c.Delete();

View file

@ -732,17 +732,34 @@ namespace Server.Mobiles
private int m_MonsterKillPoints;
[CommandProperty(AccessLevel.GameMaster)]
public int MonsterKillPoints {
public int MonsterKillPoints
{
get => m_MonsterKillPoints;
set
{
int oldValue = m_MonsterKillPoints;
if (oldValue != value)
{
m_MonsterKillPoints = value;
OnMonsterKillPointsChanged(oldValue);
}
}
set => m_MonsterKillPoints = value;
}
private int m_TotalGoldLooted;
[CommandProperty(AccessLevel.GameMaster)]
public int TotalGoldLooted
{
get => m_TotalGoldLooted;
set => m_TotalGoldLooted = value;
}
private int m_TotalMonstersKilled;
[CommandProperty(AccessLevel.GameMaster)]
public int TotalMonstersKilled
{
get => m_TotalMonstersKilled;
set => m_TotalMonstersKilled = value;
}
private int m_TotalPlayerDeaths;
[CommandProperty(AccessLevel.GameMaster)]
public int TotalPlayerDeaths
{
get => m_TotalPlayerDeaths;
set => m_TotalPlayerDeaths = value;
}
public HonorContext ReceivedHonorContext { get; set; }
@ -2497,6 +2514,8 @@ namespace Server.Mobiles
{
base.OnDeath(c);
m_TotalPlayerDeaths += 1;
EquipSnapshot = null;
HueMod = -1;
@ -2789,6 +2808,9 @@ namespace Server.Mobiles
{
case 35:
{
m_TotalPlayerDeaths = reader.ReadInt();
m_TotalMonstersKilled = reader.ReadInt();
m_TotalGoldLooted = reader.ReadInt();
m_MonsterKillPoints = reader.ReadInt();
goto case 34;
}
@ -3141,7 +3163,10 @@ namespace Server.Mobiles
writer.Write(35); // version
writer.Write(MonsterKillPoints);
writer.Write(m_TotalPlayerDeaths);
writer.Write(m_TotalMonstersKilled);
writer.Write(m_TotalGoldLooted);
writer.Write(m_MonsterKillPoints);
if (Stabled == null)
{
@ -3839,11 +3864,6 @@ namespace Server.Mobiles
StatusBar.Refresh(this);
}
public virtual void OnMonsterKillPointsChanged(int oldValue)
{
StatusBar.Refresh(this);
}
public override void OnSkillChange(SkillName skill, double oldBase)
{
if (Young && SkillsTotal >= 4500)