fix: Overhauls virtue system (#1376)
## 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">
This commit is contained in:
parent
063d878276
commit
f77dd91811
37 changed files with 2105 additions and 1839 deletions
|
|
@ -16,8 +16,10 @@
|
|||
using System.Diagnostics;
|
||||
using Microsoft.Toolkit.HighPerformance;
|
||||
using Server.Diagnostics;
|
||||
using Server.Engines.Virtues;
|
||||
using Server.Exceptions;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Network;
|
||||
|
||||
|
|
@ -184,7 +186,7 @@ public static class IncomingPlayerPackets
|
|||
{
|
||||
var virtueID = Utility.ToInt32(command) - 1;
|
||||
|
||||
EventSink.InvokeVirtueMacroRequest(from, virtueID);
|
||||
VirtueGump.RequestVirtueMacro((PlayerMobile)from, virtueID);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -460,11 +462,11 @@ public static class IncomingPlayerPackets
|
|||
|
||||
if (buttonID == 1 && switchCount > 0)
|
||||
{
|
||||
var beheld = World.FindMobile((Serial)reader.ReadUInt32());
|
||||
var beheld = World.FindEntity<PlayerMobile>((Serial)reader.ReadUInt32());
|
||||
|
||||
if (beheld != null)
|
||||
{
|
||||
EventSink.InvokeVirtueGumpRequest(state.Mobile, beheld);
|
||||
VirtueGump.RequestVirtueGump((PlayerMobile)state.Mobile, beheld);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -473,7 +475,7 @@ public static class IncomingPlayerPackets
|
|||
|
||||
if (beheld != null)
|
||||
{
|
||||
EventSink.InvokeVirtueItemRequest(state.Mobile, beheld, buttonID);
|
||||
VirtueGump.RequestVirtueItem((PlayerMobile)state.Mobile, beheld, buttonID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue