## MAJOR CHANGE (API BREAKING) Moved the virtues to it's own system _VirtueSystem_. This should make it easier to extend or remove the virtue system. Virtues will be saved to a new folder called _Virtues_. ### Motivation The motivation was also two-fold, performance/stability, and to fix bugs. First, virtues is the second system (first is murders), that has a pre-world-save check on _every mobile in the game_ to atrophy virtue stats. This is taxing since it freexes the world and makes world saves take longer. Every mobile had Gain/Loss dates for each virtue, whether they needed them or not. Most players don't even use the virtue system, so this will increase performance considerably. Second, when I tried to optimize/refactor the code, I found several bugs that needed to be fixed. ### Major API Changes - [X] The properties on players related to virtues are gone. Use `pm.GetVirtues()?.<PropertyName>` instead. - [X] Virtues were removed from non-player Mobiles. - [X] `pm.JusticeProtectors` was removed. Use `JusticeVirtue.GetProtector()` or `JusticeVirtue.GetProtected()` instead. ### Screenshots <img width="221" alt="Props-1" src="https://github.com/modernuo/ModernUO/assets/3953314/5c09cb83-b8d5-44a2-b899-a7ed7cd736ac"> <img width="220" alt="props-2" src="https://github.com/modernuo/ModernUO/assets/3953314/aeade4d3-8df0-47bd-955a-a864d0946cf7">
87 lines
4 KiB
C#
87 lines
4 KiB
C#
using Server.Gumps;
|
|
using Server.Mobiles;
|
|
using Server.Network;
|
|
|
|
namespace Server.Engines.Virtues;
|
|
|
|
public class VirtueStatusGump : Gump
|
|
{
|
|
private readonly PlayerMobile _beholder;
|
|
|
|
public VirtueStatusGump(PlayerMobile beholder) : base(0, 0)
|
|
{
|
|
_beholder = beholder;
|
|
|
|
AddPage(0);
|
|
|
|
AddImage(30, 40, 2080);
|
|
AddImage(47, 77, 2081);
|
|
AddImage(47, 147, 2081);
|
|
AddImage(47, 217, 2081);
|
|
AddImage(47, 267, 2083);
|
|
AddImage(70, 213, 2091);
|
|
|
|
AddPage(1);
|
|
|
|
AddHtmlLocalized(140, 73, 200, 20, 1077972); // The Virtues
|
|
|
|
AddHtmlLocalized(80, 100, 100, 40, 1051000); // Humility
|
|
AddHtmlLocalized(80, 129, 100, 40, 1051001); // Sacrifice
|
|
AddHtmlLocalized(80, 159, 100, 40, 1051002); // Compassion
|
|
AddHtmlLocalized(80, 189, 100, 40, 1051003); // Spirituality
|
|
AddHtmlLocalized(200, 100, 200, 40, 1051004); // Valor
|
|
AddHtmlLocalized(200, 129, 200, 40, 1051005); // Honor
|
|
AddHtmlLocalized(200, 159, 200, 40, 1051006); // Justice
|
|
AddHtmlLocalized(200, 189, 200, 40, 1051007); // Honesty
|
|
|
|
AddHtmlLocalized(75, 224, 220, 60, 1052062); // Click on a blue gem to view your status in that virtue.
|
|
|
|
AddButton(60, 100, 1210, 1210, 1); // Humility
|
|
AddButton(60, 129, 1210, 1210, 2); // Sacrifice
|
|
AddButton(60, 159, 1210, 1210, 3); // Compassion
|
|
AddButton(60, 189, 1210, 1210, 4); // Spirituality
|
|
AddButton(180, 100, 1210, 1210, 5); // Valor
|
|
AddButton(180, 129, 1210, 1210, 6); // Honor
|
|
AddButton(180, 159, 1210, 1210, 7); // Justice
|
|
AddButton(180, 189, 1210, 1210, 8); // Honesty
|
|
|
|
AddButton(280, 43, 4014, 4014, 9);
|
|
}
|
|
|
|
private static int GetVirtueDescription(VirtueName virtue) =>
|
|
virtue switch
|
|
{
|
|
VirtueName.Humility => 1052051, // Humility is perceiving one's place in the world, not according to one's own accomplishments, but according to the intrinsic value of all individuals. One gains Humility through Humility Hunts.
|
|
VirtueName.Sacrifice => 1052053, // Sacrifice is the courage to give of oneself in the name of love. One gains in Sacrifice by giving away their fame to certain monsters to save them from their eternal torment.
|
|
VirtueName.Compassion => 1053000, // Compassion is the nonjudgmental empathy for one's fellow creatures. You gain in Compassion by escorting NPCs and prisoners safely to their destinations.
|
|
VirtueName.Spirituality => 1052056, // Spirituality is the concern with one's inner being and how one deals with truth, love, and courage. One gains Spirituality by healing others.
|
|
VirtueName.Valor => 1054033, // Valor is the courage to take actions in support of one's convictions. You gain in Valor by slaying creatures spawned in regions controlled by Champions of Evil.
|
|
VirtueName.Honor => 1052058, // Honor is the courage to stand for truth, against any odds. Honor is gained by entering Honorable combat with thy foes.
|
|
VirtueName.Justice => 1052059, // Justice is the devotion to truth, tempered by love. Justice is gained by making those who would murder innocents pay for their crimes.
|
|
VirtueName.Honesty => 1052060, // Honesty is the scrupulous respect for truth, the willingness to never deceive oneself or another.
|
|
_ => 0
|
|
};
|
|
|
|
public override void OnResponse(NetState state, RelayInfo info)
|
|
{
|
|
if (info.ButtonID == 9)
|
|
{
|
|
_beholder.SendGump(new VirtueGump(_beholder, _beholder));
|
|
return;
|
|
}
|
|
|
|
if (info.ButtonID is < 1 or > (int)VirtueName.Honesty)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var virtue = (VirtueName)(info.ButtonID - 1);
|
|
|
|
_beholder.SendGump(new VirtueInfoGump(
|
|
_beholder,
|
|
virtue,
|
|
GetVirtueDescription(virtue),
|
|
@$"https://uo.com/wiki/ultima-online-wiki/gameplay/the-virtues/#{virtue.GetLowerCaseName()}"
|
|
));
|
|
}
|
|
}
|