## Summary Overhauls the fame and karma system to be more era-accurate, based on original design documents and publish notes. ### Karma on player kill → karma on murder report - Removes karma gain/loss on player kill (was immediate on death) - Karma is now set to `Kills * -1000` on murder **report** instead - Fame on player kill now uses the same formula as monster kills (`Fame / 100`) This karma loss on murder report behaviour was tested on both the demo and live servers, behaviour was matching in terms of karma loss on report. Official UO servers karma loss AMOUNT match with my memory of T2A/UOR with one caveat - it's doubled on live servers (-2000 * kill count). I'm not sure when this changed and this behaviour has always had very poor and incorrect documentation, even 10-20 years ago. I was obsessed with the dread lord title on OSI and the only way I knew how to get it was reach 10 kills then macro them off. Even in publish 16 (when "The Murderer" title was removed) it still required 10 kills. Maybe it changed to -2000*Kills in AOS - that's where I've put the era gating diff. ### Era gates - **Karma lock** (ankh toggle + auto-lock on negative karma) gated to `Core.UOTD && !Core.AOS` — [didn't exist before Jan 28, 2001](https://web.archive.org/web/20010128092700/http://update.uo.com/design_300.html) - **Felucca fame/karma +30% bonus** gated to `Core.LBR` — [added in Publish 16, July 2002](https://uo.com/wiki/ultima-online-wiki/technical/previous-publishes/2002-2/publish-16-part-2-5-23rd-july/) - **Fame/karma splitting** among damage dealers gated to `Core.UOR` — pre-UOR awards go to last hit only ### Skill karma penalties - **Provocation** on innocent NPC: NPC says cliloc 501591, karma loss (floor -7500) - **Stealing** attempt: karma loss on every attempt (floor -5000). Stealing did not cause karma loss at all before! - **Summon Daemon**: karma loss on successful cast (floor -7000) - **Corpse carving** (human): -70 for innocent corpses (floor -7000), -20 for freely-aggressable (floor -2000) - **Bounty head turn-in**: karma gain capped at 2000 (was awarding flat +2000) ### Beneficial action karma - **Beneficial spells** (heal, cure, etc.): `AwardKarma(caster, target.Karma / 5)` — healing good targets raises karma, healing evil targets lowers it - source is UO98 demo scripts - **Bandages**: same formula but gain only (skipped if target karma ≤ 0) - see stratics link ("only ever gain karma, not lose it") Sources: UO98 Demo scripts and playing, [Fame and Karma wiki](https://uo.com/wiki/ultima-online-wiki/player/fame-and-karma/), [UO design doc (Jan 2001)](https://web.archive.org/web/20010128092700/http://update.uo.com/design_300.html), [Publish 16](https://uo.com/wiki/ultima-online-wiki/technical/previous-publishes/2002-2/publish-16-part-2-5-23rd-july/), [Stratics healing reference](https://web.archive.org/web/20001209014200fw_/http://uo.stratics.com/heal.shtml) ### Refactoring - Extracted `Titles.ComputeKillAwards(killed, map)` shared by player kill and creature kill paths - Extracted `Titles.SetKarma(m, value, message)` for direct karma assignment (used by murder report) - Extracted `SendKarmaMessage` and `CheckKarmaLock` helpers from `AwardKarma`
234 lines
6.6 KiB
C#
234 lines
6.6 KiB
C#
using System;
|
|
using ModernUO.Serialization;
|
|
using Server.Collections;
|
|
using Server.ContextMenus;
|
|
using Server.Engines.VeteranRewards;
|
|
using Server.Gumps;
|
|
using Server.Mobiles;
|
|
using Server.Network;
|
|
|
|
namespace Server.Items;
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class AnkhOfSacrificeComponent : AddonComponent
|
|
{
|
|
public AnkhOfSacrificeComponent(int itemID) : base(itemID)
|
|
{
|
|
}
|
|
|
|
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
|
public override int LabelNumber => 1027772; // Ankh of Sacrifice
|
|
|
|
public override void GetContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list)
|
|
{
|
|
base.GetContextMenuEntries(from, ref list);
|
|
|
|
if (Core.UOTD && !Core.AOS && from is PlayerMobile mobile)
|
|
{
|
|
list.Add(new Ankhs.LockKarmaEntry(mobile.KarmaLocked));
|
|
}
|
|
|
|
list.Add(new ResurrectEntry());
|
|
}
|
|
|
|
public static void Resurrect(PlayerMobile m, AnkhOfSacrificeAddon ankh)
|
|
{
|
|
if (m == null)
|
|
{
|
|
}
|
|
else if (!m.InRange(ankh.GetWorldLocation(), 2))
|
|
{
|
|
m.SendLocalizedMessage(500446); // That is too far away.
|
|
}
|
|
else if (m.Alive)
|
|
{
|
|
m.SendLocalizedMessage(1060197); // You are not dead, and thus cannot be resurrected!
|
|
}
|
|
else if (m.AnkhNextUse > Core.Now)
|
|
{
|
|
var delay = m.AnkhNextUse - Core.Now;
|
|
|
|
if (delay.TotalMinutes > 0)
|
|
{
|
|
// You must wait ~1_minutes~ minutes before you can use this item.
|
|
m.SendLocalizedMessage(1079265, Math.Round(delay.TotalMinutes).ToString());
|
|
}
|
|
else
|
|
{
|
|
// You must wait ~1_seconds~ seconds before you can use this item.
|
|
m.SendLocalizedMessage(1079263, Math.Round(delay.TotalSeconds).ToString());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m.SendGump(new AnkhResurrectGump(m, ResurrectMessage.VirtueShrine));
|
|
}
|
|
}
|
|
|
|
private class ResurrectEntry : ContextMenuEntry
|
|
{
|
|
public ResurrectEntry() : base(6195, 2)
|
|
{
|
|
}
|
|
|
|
public override void OnClick(Mobile from, IEntity target)
|
|
{
|
|
if (target is AnkhOfSacrificeAddon { Deleted: false } ankh)
|
|
{
|
|
Resurrect(from as PlayerMobile, ankh);
|
|
}
|
|
}
|
|
}
|
|
|
|
private class AnkhResurrectGump : ResurrectGump
|
|
{
|
|
public AnkhResurrectGump(Mobile owner, ResurrectMessage msg) : base(owner, msg)
|
|
{
|
|
}
|
|
|
|
public override void OnResponse(NetState state, in RelayInfo info)
|
|
{
|
|
if (info.ButtonID is not 1 and not 2)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var from = state.Mobile;
|
|
|
|
if (from.Map?.CanFit(from.Location, 16, false, false) != true)
|
|
{
|
|
from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
|
|
return;
|
|
}
|
|
|
|
if (from is PlayerMobile mobile)
|
|
{
|
|
mobile.AnkhNextUse = Core.Now + TimeSpan.FromHours(1);
|
|
}
|
|
|
|
base.OnResponse(state, info);
|
|
}
|
|
}
|
|
}
|
|
|
|
[SerializationGenerator(0)]
|
|
public partial class AnkhOfSacrificeAddon : BaseAddon, IRewardItem
|
|
{
|
|
[InvalidateProperties]
|
|
[SerializableField(0)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private bool _isRewardItem;
|
|
|
|
[Constructible]
|
|
public AnkhOfSacrificeAddon(bool east)
|
|
{
|
|
if (east)
|
|
{
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1D98), 0, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1D97), 0, 1, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD6), 1, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD4), 1, 1, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD0), 2, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CCE), 2, 1, 0);
|
|
}
|
|
else
|
|
{
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1E5D), 0, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1E5C), 1, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD2), 0, 1, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD8), 1, 1, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CCD), 0, 2, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CCE), 1, 2, 0);
|
|
}
|
|
}
|
|
|
|
public override bool HandlesOnMovement => true;
|
|
|
|
public override BaseAddonDeed Deed =>
|
|
new AnkhOfSacrificeDeed
|
|
{
|
|
IsRewardItem = _isRewardItem
|
|
};
|
|
|
|
public override void OnMovement(Mobile m, Point3D oldLocation)
|
|
{
|
|
if (!m.Alive && Utility.InRange(Location, m.Location, 1) && !Utility.InRange(Location, oldLocation, 1))
|
|
{
|
|
AnkhOfSacrificeComponent.Resurrect(m as PlayerMobile, this);
|
|
}
|
|
}
|
|
}
|
|
|
|
[SerializationGenerator(0)]
|
|
public partial class AnkhOfSacrificeDeed : BaseAddonDeed, IRewardItem, IRewardOption
|
|
{
|
|
private bool _east;
|
|
|
|
[InvalidateProperties]
|
|
[SerializableField(0)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private bool _isRewardItem;
|
|
|
|
[Constructible]
|
|
public AnkhOfSacrificeDeed(bool isRewardItem = false)
|
|
{
|
|
LootType = LootType.Blessed;
|
|
_isRewardItem = isRewardItem;
|
|
}
|
|
|
|
public override int LabelNumber => 1080397; // Deed For An Ankh Of Sacrifice
|
|
|
|
public override BaseAddon Addon =>
|
|
new AnkhOfSacrificeAddon(_east)
|
|
{
|
|
IsRewardItem = _isRewardItem
|
|
};
|
|
|
|
public void GetOptions(RewardOptionList list)
|
|
{
|
|
list.Add(1, 1080398); // Ankh of Sacrifice South
|
|
list.Add(2, 1080399); // Ankh of Sacrifice East
|
|
}
|
|
|
|
public void OnOptionSelected(Mobile from, int option)
|
|
{
|
|
_east = option switch
|
|
{
|
|
1 => false,
|
|
2 => true,
|
|
_ => _east
|
|
};
|
|
|
|
if (!Deleted)
|
|
{
|
|
base.OnDoubleClick(from);
|
|
}
|
|
}
|
|
|
|
public override void OnDoubleClick(Mobile from)
|
|
{
|
|
if (_isRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (IsChildOf(from.Backpack))
|
|
{
|
|
from.SendGump(new RewardOptionGump(this));
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
|
|
}
|
|
}
|
|
|
|
public override void GetProperties(IPropertyList list)
|
|
{
|
|
base.GetProperties(list);
|
|
|
|
if (_isRewardItem)
|
|
{
|
|
list.Add(1080457); // 10th Year Veteran Reward
|
|
}
|
|
}
|
|
}
|