fix: Optimizes TextDefinition to eliminate allocations. Removes TextDefinition ctor. (#1221)

### BREAKING CHANGE ###
The constructor for `TextDefinition` has been removed. Instead use `TextDefinition.Of()` or cast the integer/string to TextDefinition.
This commit is contained in:
Kamron Batman 2022-10-30 16:53:23 -07:00 • committed by GitHub
parent 213b7025af
commit 910e06767b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 790 additions and 722 deletions

View file

@ -12,13 +12,14 @@ namespace Server.Engines.MLQuests.Definitions
{
Activated = true;
Title = 1075392; // Honest Beggar
Description =
1075393; // Beg pardon, sir. I mean, madam. Uh, can I ask a favor of you? I found this jeweled ring. Most people would sell it and keep the money, but not me. I ain't never stole nothing, and I ain't about to start. I tried to take it over to Brit castle, figgerin' it must belong to some highborn lady, but the guards threw me out. You look like they might let you pass. Will you take the ring over there and see if you can find the owner?
// Beg pardon, sir. I mean, madam. Uh, can I ask a favor of you? I found this jeweled ring. Most people would sell it and keep the money, but not me. I ain't never stole nothing, and I ain't about to start. I tried to take it over to Brit castle, figgerin' it must belong to some highborn lady, but the guards threw me out. You look like they might let you pass. Will you take the ring over there and see if you can find the owner?
Description = 1075393;
RefusalMessage = 1075395; // I see. Too good to help an honest beggar like me, eh?
InProgressMessage =
1075396; // A jewel like this must be worth a lot, so it must belong to some noble or another. I would show it around the castle. Someone's bound to recognize it.
CompletionMessage =
1075397; // Didst thou find my ring? I thank thee very much! It is an old ring, and a gift from my husband. I was most distraught when I realized it was missing.
// A jewel like this must be worth a lot, so it must belong to some noble or another. I would show it around the castle. Someone's bound to recognize it.
InProgressMessage = 1075396;
// Didst thou find my ring? I thank thee very much! It is an old ring, and a gift from my husband. I was most distraught when I realized it was missing.
CompletionMessage = 1075397;
CompletionNotice = CompletionNoticeShort;
Objectives.Add(new DeliverObjective(typeof(ReginasRing), 1, "Regina's Ring", typeof(Regina)));

View file

@ -17,17 +17,16 @@ namespace Server.Engines.MLQuests
public class MLQuest
{
public static readonly TextDefinition
CompletionNoticeDefault =
new(1072273); // You've completed a quest! Don't forget to collect your reward.
// You've completed a quest! Don't forget to collect your reward.
public static TextDefinition CompletionNoticeDefault = 1072273;
public static readonly TextDefinition CompletionNoticeShort = new(1046258); // Your quest is complete.
public static TextDefinition CompletionNoticeShort = 1046258; // Your quest is complete.
public static readonly TextDefinition
CompletionNoticeShortReturn = new(1073775); // Your quest is complete. Return for your reward.
// Your quest is complete. Return for your reward.
public static TextDefinition CompletionNoticeShortReturn = 1073775;
public static readonly TextDefinition
CompletionNoticeCraft = new(1073967); // You obtained what you seek, now receive your reward.
// You obtained what you seek, now receive your reward.
public static TextDefinition CompletionNoticeCraft = 1073967;
public MLQuest()
{

View file

@ -5,8 +5,7 @@ namespace Server.Engines.MLQuests.Rewards
{
public class DummyReward : BaseReward
{
public DummyReward(TextDefinition name)
: base(name)
public DummyReward(TextDefinition name) : base(name)
{
}

View file

@ -41,8 +41,7 @@ namespace Server.Engines.MLQuests.Rewards
private readonly Type m_Type;
public ItemReward(TextDefinition name = null, Type type = null, int amount = 1)
: base(name)
public ItemReward(TextDefinition name = null, Type type = null, int amount = 1) : base(name)
{
m_Type = type;
m_Amount = amount;