fix: Overhauls champion titles & codegen champion system (#1430)
## MAJOR CHANGE Added a champion title system to facilitate the existing champion titles. This should make it easier to extend or create other related game content. Champion titles will be saved in a folder called _ChampionTitles_. ### Motivation The motivation to refactor was two-folder, but mostly related to performance in two ways. First, every player had a ChampionTitleInfo object with an array of ChamptionTitleInfo. We want to eliminate the need for this information unless a player actually uses it. This should save a considerable amount of memory. Second, to facilitate the atrophy mechanic, the champion titles would run atrophy post-world save, adding to the time that the server is frozen. Eliminating this post-world save side effect unlocks our ability to further optimize the world save process since there are no direct side effects. ### Bugs fixed - [X] Fixed titles getting cut off on the paperdoll - [X] Fixed champion title not displaying overhead (OPL) ### Screenshots <img width="216" alt="image" src="https://github.com/modernuo/ModernUO/assets/3953314/8916f895-8d68-4fb0-892e-108a0c43be90">
This commit is contained in:
parent
4dddc8d3f1
commit
51ecee6caa
44 changed files with 3028 additions and 2785 deletions
|
|
@ -4,6 +4,7 @@ using Server.Accounting;
|
|||
using Server.Collections;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.BulkOrders;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Engines.Help;
|
||||
|
|
@ -206,8 +207,6 @@ namespace Server.Mobiles
|
|||
|
||||
m_GameTime = TimeSpan.Zero;
|
||||
m_GuildRank = RankDefinition.Lowest;
|
||||
|
||||
ChampionTitles = new ChampionTitleInfo();
|
||||
}
|
||||
|
||||
public PlayerMobile(Serial s) : base(s)
|
||||
|
|
@ -693,8 +692,8 @@ namespace Server.Mobiles
|
|||
set => SetFlag(PlayerFlag.DisplayChampionTitle, value);
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ChampionTitleInfo ChampionTitles { get; private set; }
|
||||
[CommandProperty(AccessLevel.GameMaster, canModify: true)]
|
||||
public ChampionTitleContext ChampionTitles => this.GetOrCreateChampionTitleContext();
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ShortTermMurders
|
||||
|
|
@ -1859,21 +1858,13 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (AutoRenewInsurance)
|
||||
{
|
||||
list.Add(
|
||||
new CallbackEntry(
|
||||
6202,
|
||||
CancelRenewInventoryInsurance
|
||||
)
|
||||
); // Cancel Renewing Inventory Insurance
|
||||
// Cancel Renewing Inventory Insurance
|
||||
list.Add(new CallbackEntry(6202, CancelRenewInventoryInsurance));
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(
|
||||
new CallbackEntry(
|
||||
6200,
|
||||
AutoRenewInventoryInsurance
|
||||
)
|
||||
); // Auto Renew Inventory Insurance
|
||||
// Auto Renew Inventory Insurance
|
||||
list.Add(new CallbackEntry(6200, AutoRenewInventoryInsurance));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2855,6 +2846,7 @@ namespace Server.Mobiles
|
|||
|
||||
switch (version)
|
||||
{
|
||||
case 33: // Removes champion title
|
||||
case 32: // Removes virtue properties
|
||||
case 31: // Removed Short/Long Term Elapse
|
||||
case 30:
|
||||
|
|
@ -2928,7 +2920,11 @@ namespace Server.Mobiles
|
|||
}
|
||||
case 23:
|
||||
{
|
||||
ChampionTitles = new ChampionTitleInfo(reader);
|
||||
if (version < 33)
|
||||
{
|
||||
ChampionTitles.Deserialize(reader);
|
||||
}
|
||||
|
||||
goto case 22;
|
||||
}
|
||||
case 22:
|
||||
|
|
@ -3165,8 +3161,6 @@ namespace Server.Mobiles
|
|||
LastOnline = ((Account)Account).LastLogin;
|
||||
}
|
||||
|
||||
ChampionTitles ??= new ChampionTitleInfo();
|
||||
|
||||
if (AccessLevel > AccessLevel.Player)
|
||||
{
|
||||
IgnoreMobiles = true;
|
||||
|
|
@ -3184,8 +3178,6 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
CheckAtrophies();
|
||||
|
||||
if (Hidden) // Hiding is the only buff where it has an effect that's serialized.
|
||||
{
|
||||
AddBuff(new BuffInfo(BuffIcon.HidingAndOrStealth, 1075655));
|
||||
|
|
@ -3196,7 +3188,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(32); // version
|
||||
writer.Write(33); // version
|
||||
|
||||
if (Stabled == null)
|
||||
{
|
||||
|
|
@ -3251,8 +3243,6 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
ChampionTitleInfo.Serialize(writer, ChampionTitles);
|
||||
|
||||
writer.WriteEncodedInt(ToTItemsTurnedIn);
|
||||
writer.Write(ToTTotalMonsterFame); // This ain't going to be a small #.
|
||||
|
||||
|
|
@ -3317,22 +3307,6 @@ namespace Server.Mobiles
|
|||
writer.Write(GameTime);
|
||||
}
|
||||
|
||||
// Do we need to run an after serialize?
|
||||
public override bool ShouldExecuteAfterSerialize => ShouldAtrophy();
|
||||
|
||||
public override void AfterSerialize()
|
||||
{
|
||||
base.AfterSerialize();
|
||||
CheckAtrophies();
|
||||
}
|
||||
|
||||
public bool ShouldAtrophy() => ChampionTitleInfo.ShouldAtrophy(this);
|
||||
|
||||
public void CheckAtrophies()
|
||||
{
|
||||
ChampionTitleInfo.CheckAtrophy(this);
|
||||
}
|
||||
|
||||
public override bool CanSee(Mobile m)
|
||||
{
|
||||
if (m is CharacterStatue statue)
|
||||
|
|
@ -3439,6 +3413,17 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Add the Titles Menu for later Eras:
|
||||
// https://uo.com/wiki/ultima-online-wiki/player/skill-titles-order/
|
||||
if (DisplayChampionTitle)
|
||||
{
|
||||
var titleLabel = this.GetChampionTitleLabel();
|
||||
if (titleLabel > 0)
|
||||
{
|
||||
list.Add(titleLabel);
|
||||
}
|
||||
}
|
||||
|
||||
if (Core.ML && AllFollowers != null)
|
||||
{
|
||||
foreach (var follower in AllFollowers)
|
||||
|
|
@ -4457,6 +4442,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
|
||||
DisplayChampionTitle = !DisplayChampionTitle;
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public virtual bool HasRecipe(Recipe r) => r != null && HasRecipe(r.ID);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue