perf: Migrate Quest gumps to DynamicGump (#2416)

## Summary

Migrates the Quest system gumps from legacy `Gump` to `DynamicGump` / `StaticGump<T>`.

**Renames** `Engines/ML Quests/Gumps/BaseQuestGump` to **`BaseMLQuestGump`** to
disambiguate from the Core quest abstract (`Engines/Quests/Core/QuestSystem.cs`).
Both abstracts now extend `DynamicGump`.

**Abstract bases**:
- `Server.Engines.Quests.BaseQuestGump` (Core) - now `abstract DynamicGump`. Holds constants and a static `AddHtmlObject(ref DynamicGumpBuilder, ...)` helper. Concrete subclasses each provide their own `BuildLayout`.
- `Server.Engines.MLQuests.Gumps.BaseMLQuestGump` (ML, renamed) - now `abstract DynamicGump` with a `protected abstract BuildContent(ref DynamicGumpBuilder)` hook. The base's `BuildLayout` draws shared chrome (background art, frame, label header) and then invokes `BuildContent`; subclasses use `BuildPage`, `SetTitle`, `RegisterButton`, `SetPageCount`, and content helpers (`AddDescription`, `AddObjectives`, `AddObjectivesProgress`, `AddRewardsPage`, `AddRewards`, `AddConversation`).

**Concrete Core gumps** migrated to `DynamicGump`:
- `QuestCancelGump`, `QuestOfferGump` (Core), `QuestObjectivesGump`, `QuestConversationsGump`, `QuestLogUpdatedGump`, `QuestItemInfoGump`, `SheetMusicOfferGump` (Impresario), `PaintedImageGump` (renamed from `PaintedImage.InternalGump`).

**Concrete ML gumps** migrated to `DynamicGump` (extending `BaseMLQuestGump` or directly):
- `InfoNPCGump`, `QuestConversationGump`, `QuestLogDetailedGump`, `QuestLogGump`, `QuestOfferGump` (ML), `QuestReportBackGump`, `QuestRewardGump`, `QuestCancelConfirmGump`, `RaceChangeConfirmGump`.

**`StaticGump<T>` migrations**:
- `ScrollOfAbraxusGump` (Dark Tides). Its layout is a single hard-coded cliloc (1060116) with no per-instance dynamic content - safe to cache.

**Cliloc rule**: Every other quest dialog bakes per-instance cliloc IDs into its layout (quest titles, NPC names, race-specific prompts, era-conditional progress messages, escort destinations). Per the cliloc rule, baking different cliloc numbers into a cached layout would defeat `StaticGump<T>` caching - so all of these are `DynamicGump`.

**Signature changes** to support the migration:
- `QuestObjective.RenderMessage`/`RenderProgress` now take `ref DynamicGumpBuilder builder` (15 overrides updated across Collector, Solen Matriarch, Ambitious Solen Queen, Study of the Solen Hive, Terrible Hatchlings, The Summoning, Uzeraan Turmoil, Witch Apprentice, Emino's Undertaking).
- ML `BaseObjective.WriteToGump` / `BaseObjectiveInstance.WriteToGump` / `BaseReward.WriteToGump` now take `ref DynamicGumpBuilder` (KillObjective, GainSkillObjective, EscortObjective, CollectObjective, DeliverObjective, BaseReward).

**Empty-gump and `Singleton` rules**: All concrete gumps now have private constructors with static `DisplayTo` entry points that null-check the player NetState before allocation. All gumps that shouldn't stack are `Singleton => true`.

**External callers updated**: `MLQuest.SendOffer`/`OnRefuse`, `MLQuestEntry.SendProgressGump`/`SendRewardGump`/`SendReportBackGump`, `MLQuestSystem.QuestGumpRequest` and `ViewQuestsCommand`, `BoonCollector` (Darius/Nedrick), `SirHelper.OnDoubleClick` (no longer caches a single shared `InfoNPCGump` instance - `DisplayTo` constructs one per click and the gump's `Singleton => true` handles deduplication), `RaceChangeDeed.OnDoubleClick`, `PaintedImage.OnDoubleClick`, `ScrollOfAbraxus.OnDoubleClick`, `Impresario.OnTalk`, and `PlayerMobile`'s `BaseQuestGump` alias is now `BaseMLQuestGump`.

**Concrete subclasses found beyond the listed entry points**: `SheetMusicOfferGump` (in Impresario.cs), `PaintedImageGump` (was `PaintedImage.InternalGump`), `QuestObjectivesGump`, `QuestConversationsGump`, `QuestLogUpdatedGump`, `QuestItemInfoGump` (the Core base has these embedded across `QuestSystem.cs`/`QuestObjective.cs`/`QuestConversation.cs`/`QuestItemInfo.cs`).

**Code-standards cleanup**: Renamed legacy `m_X` private fields to `_x` in rewritten files; braces on all control flow.
This commit is contained in:
Kamron Batman 2026-04-25 20:23:13 -07:00 • committed by GitHub
parent ab5f615840
commit b90ac0d481
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 1023 additions and 706 deletions

View file

@ -24,84 +24,92 @@ namespace Server.Engines.MLQuests.Gumps
Resign = 0x2EF5
}
public abstract class BaseQuestGump : Gump
public abstract class BaseMLQuestGump : DynamicGump
{
private readonly List<ButtonInfo> m_Buttons;
private int m_Label;
private int m_MaxPages;
private int m_Page;
private string m_Title;
private readonly List<ButtonInfo> _buttons;
private readonly int _label;
private int _maxPages;
private int _page;
private string _title;
// RunUO optimized version
public BaseQuestGump(int label)
: base(75, 25)
protected BaseMLQuestGump(int label) : base(75, 25)
{
m_Page = 0;
m_MaxPages = 0;
m_Label = label;
m_Title = null;
m_Buttons = new List<ButtonInfo>(2);
Closable = false;
AddPage(0);
AddImageTiled(50, 20, 400, 460, 0x1404);
AddImageTiled(50, 29, 30, 450, 0x28DC);
AddImageTiled(34, 140, 17, 339, 0x242F);
AddImage(48, 135, 0x28AB);
AddImage(-16, 285, 0x28A2);
AddImage(0, 10, 0x28B5);
AddImage(25, 0, 0x28B4);
AddImageTiled(83, 15, 350, 15, 0x280A);
AddImage(34, 479, 0x2842);
AddImage(442, 479, 0x2840);
AddImageTiled(51, 479, 392, 17, 0x2775);
AddImageTiled(415, 29, 44, 450, 0xA2D);
AddImageTiled(415, 29, 30, 450, 0x28DC);
// AddLabel( 100, 50, 0x481, "" );
AddImage(370, 50, 0x589);
AddImage(379, 60, 0x15A9);
AddImage(425, 0, 0x28C9);
AddImage(90, 33, 0x232D);
AddHtmlLocalized(130, 45, 270, 16, label, 0x7FFF);
AddImageTiled(130, 65, 175, 1, 0x238D);
_label = label;
_page = 0;
_maxPages = 0;
_title = null;
_buttons = new List<ButtonInfo>(2);
}
public void BuildPage()
protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
AddPage(++m_Page);
builder.SetNoClose();
if (m_Page > 1)
builder.AddPage();
builder.AddImageTiled(50, 20, 400, 460, 0x1404);
builder.AddImageTiled(50, 29, 30, 450, 0x28DC);
builder.AddImageTiled(34, 140, 17, 339, 0x242F);
builder.AddImage(48, 135, 0x28AB);
builder.AddImage(-16, 285, 0x28A2);
builder.AddImage(0, 10, 0x28B5);
builder.AddImage(25, 0, 0x28B4);
builder.AddImageTiled(83, 15, 350, 15, 0x280A);
builder.AddImage(34, 479, 0x2842);
builder.AddImage(442, 479, 0x2840);
builder.AddImageTiled(51, 479, 392, 17, 0x2775);
builder.AddImageTiled(415, 29, 44, 450, 0xA2D);
builder.AddImageTiled(415, 29, 30, 450, 0x28DC);
builder.AddImage(370, 50, 0x589);
builder.AddImage(379, 60, 0x15A9);
builder.AddImage(425, 0, 0x28C9);
builder.AddImage(90, 33, 0x232D);
builder.AddHtmlLocalized(130, 45, 270, 16, _label, 0x7FFF);
builder.AddImageTiled(130, 65, 175, 1, 0x238D);
// Reset paging for subclass content
_page = 0;
BuildContent(ref builder);
}
protected abstract void BuildContent(ref DynamicGumpBuilder builder);
protected void BuildPage(ref DynamicGumpBuilder builder)
{
builder.AddPage(++_page);
if (_page > 1)
{
AddButton(
builder.AddButton(
130,
430,
(int)ButtonGraphic.Previous,
(int)ButtonGraphic.Previous + 2,
0,
GumpButtonType.Page,
m_Page - 1
_page - 1
);
}
if (m_Page < m_MaxPages)
if (_page < _maxPages)
{
AddButton(
builder.AddButton(
275,
430,
(int)ButtonGraphic.Continue,
(int)ButtonGraphic.Continue + 2,
0,
GumpButtonType.Page,
m_Page + 1
_page + 1
);
}
foreach (var button in m_Buttons)
for (var i = 0; i < _buttons.Count; i++)
{
AddButton(
var button = _buttons[i];
builder.AddButton(
button.Position == ButtonPosition.Left ? 95 : 313,
455,
(int)button.Graphic,
@ -110,37 +118,37 @@ namespace Server.Engines.MLQuests.Gumps
);
}
if (m_Title != null)
if (_title != null)
{
AddHtmlLocalized(130, 68, 220, 48, 1114513, m_Title, 0x2710); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
builder.AddHtmlLocalized(130, 68, 220, 48, 1114513, _title, 0x2710); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
}
}
public void SetPageCount(int maxPages)
protected void SetPageCount(int maxPages)
{
m_MaxPages = maxPages;
_maxPages = maxPages;
}
public void SetTitle(TextDefinition def)
protected void SetTitle(TextDefinition def)
{
if (def.Number > 0)
{
m_Title = $"#{def.Number}"; // OSI does "@@#{0}" instead, why? KR client related?
_title = $"#{def.Number}"; // OSI does "@@#{0}" instead, why? KR client related?
}
else
{
m_Title = def.String;
_title = def.String;
}
}
public void RegisterButton(ButtonPosition position, ButtonGraphic graphic, int buttonID)
protected void RegisterButton(ButtonPosition position, ButtonGraphic graphic, int buttonID)
{
m_Buttons.Add(new ButtonInfo(position, graphic, buttonID));
_buttons.Add(new ButtonInfo(position, graphic, buttonID));
}
public void AddDescription(MLQuest quest)
protected static void AddDescription(ref DynamicGumpBuilder builder, MLQuest quest)
{
AddHtmlLocalized(
builder.AddHtmlLocalized(
98,
140,
312,
@ -149,14 +157,14 @@ namespace Server.Engines.MLQuests.Gumps
0x2710
);
quest.Description.AddHtmlText(this, 98, 156, 312, 240, false, true, 0x5F90, 0xBDE784);
quest.Description.AddHtmlText(ref builder, 98, 156, 312, 240, false, true, 0x5F90, 0xBDE784);
}
public void AddObjectives(MLQuest quest)
protected static void AddObjectives(ref DynamicGumpBuilder builder, MLQuest quest)
{
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
builder.AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
// All of the following / Only one of the following
AddHtmlLocalized(
builder.AddHtmlLocalized(
98,
156,
312,
@ -169,7 +177,7 @@ namespace Server.Engines.MLQuests.Gumps
foreach (var objective in quest.Objectives)
{
objective.WriteToGump(this, ref y);
objective.WriteToGump(ref builder, ref y);
if (objective.IsTimed)
{
@ -178,18 +186,18 @@ namespace Server.Engines.MLQuests.Gumps
y -= 16;
}
BaseObjectiveInstance.WriteTimeRemaining(this, ref y, objective.Duration);
BaseObjectiveInstance.WriteTimeRemaining(ref builder, ref y, objective.Duration);
}
}
}
public void AddObjectivesProgress(MLQuestInstance instance)
protected static void AddObjectivesProgress(ref DynamicGumpBuilder builder, MLQuestInstance instance)
{
var quest = instance.Quest;
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
builder.AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
// All of the following / Only one of the following
AddHtmlLocalized(
builder.AddHtmlLocalized(
98,
156,
312,
@ -202,55 +210,55 @@ namespace Server.Engines.MLQuests.Gumps
foreach (var objInstance in instance.Objectives)
{
objInstance.WriteToGump(this, ref y);
objInstance.WriteToGump(ref builder, ref y);
}
}
public void AddRewardsPage(MLQuest quest) // For the quest log/offer gumps
protected static void AddRewardsPage(ref DynamicGumpBuilder builder, MLQuest quest) // For the quest log/offer gumps
{
AddHtmlLocalized(98, 140, 312, 16, 1072201, 0x2710); // Reward
builder.AddHtmlLocalized(98, 140, 312, 16, 1072201, 0x2710); // Reward
var y = 162;
if (quest.Rewards.Count > 1)
{
// TODO: Is this what this is for? Does "Only one of the following" occur?
AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710); // All of the following
builder.AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710); // All of the following
y += 16;
}
AddRewards(quest, 105, y, 16);
AddRewards(ref builder, quest, 105, y, 16);
}
public void AddRewards(MLQuest quest) // For the claim rewards gump
protected static void AddRewards(ref DynamicGumpBuilder builder, MLQuest quest) // For the claim rewards gump
{
var y = 146;
if (quest.Rewards.Count > 1)
{
// TODO: Is this what this is for? Does "Only one of the following" occur?
AddHtmlLocalized(100, 140, 312, 16, 1072208, 0x2710); // All of the following
builder.AddHtmlLocalized(100, 140, 312, 16, 1072208, 0x2710); // All of the following
y += 16;
}
AddRewards(quest, 107, y, 26);
AddRewards(ref builder, quest, 107, y, 26);
}
public void AddRewards(MLQuest quest, int x, int y, int spacing)
protected static void AddRewards(ref DynamicGumpBuilder builder, MLQuest quest, int x, int y, int spacing)
{
var xReward = x + 28;
foreach (var reward in quest.Rewards)
{
AddImage(x, y + 1, 0x4B9);
reward.WriteToGump(this, xReward, ref y);
builder.AddImage(x, y + 1, 0x4B9);
reward.WriteToGump(ref builder, xReward, ref y);
y += spacing;
}
}
public void AddConversation(TextDefinition text)
protected static void AddConversation(ref DynamicGumpBuilder builder, TextDefinition text)
{
text.AddHtmlText(this, 98, 140, 312, 180, false, true, 0x5F90, 0xBDE784);
text.AddHtmlText(ref builder, 98, 140, 312, 180, false, true, 0x5F90, 0xBDE784);
}
/* OSI gump IDs:
@ -258,7 +266,7 @@ namespace Server.Engines.MLQuests.Gumps
* 801 - QuestCancelConfirmGump
* 802 - ?? (gets closed by Toggle Quest Item)
* 803 - QuestRewardGump
* 804 - ?? (gets closed by Toggle Quest Item)
* 804 - ?? (gets closed by Toggle Quest Item and most quest gumps)
* 805 - QuestLogGump
* 806 - QuestConversationGump (refuse / in progress)
* 807 - ?? (gets closed by Toggle Quest Item and most quest gumps)
@ -277,7 +285,7 @@ namespace Server.Engines.MLQuests.Gumps
gumps.Close<QuestCancelConfirmGump>();
}
private struct ButtonInfo
private readonly struct ButtonInfo
{
public ButtonPosition Position { get; }

View file

@ -1,17 +1,40 @@
using Server.Gumps;
namespace Server.Engines.MLQuests.Gumps
{
public class InfoNPCGump : BaseQuestGump
public class InfoNPCGump : BaseMLQuestGump
{
public InfoNPCGump(TextDefinition title, TextDefinition message)
private readonly TextDefinition _title;
private readonly TextDefinition _message;
public override bool Singleton => true;
private InfoNPCGump(TextDefinition title, TextDefinition message)
: base(1060668) // INFORMATION
{
_title = title;
_message = message;
RegisterButton(ButtonPosition.Left, ButtonGraphic.Close, 3);
SetPageCount(1);
}
BuildPage();
title.AddHtmlText(this, 160, 108, 250, 16, false, false, 0x2710, 0x4AC684);
message.AddHtmlText(this, 98, 156, 312, 180, false, true, 0x5F90, 0xBDE784);
public static void DisplayTo(Mobile from, TextDefinition title, TextDefinition message)
{
if (from?.NetState == null)
{
return;
}
from.SendGump(new InfoNPCGump(title, message));
}
protected override void BuildContent(ref DynamicGumpBuilder builder)
{
BuildPage(ref builder);
_title.AddHtmlText(ref builder, 160, 108, 250, 16, false, false, 0x2710, 0x4AC684);
_message.AddHtmlText(ref builder, 98, 156, 312, 180, false, true, 0x5F90, 0xBDE784);
}
}
}

View file

@ -3,52 +3,66 @@ using Server.Network;
namespace Server.Engines.MLQuests.Gumps
{
public class QuestCancelConfirmGump : Gump
public class QuestCancelConfirmGump : DynamicGump
{
private readonly bool m_CloseGumps;
private readonly MLQuestInstance m_Instance;
private readonly bool _closeGumps;
private readonly MLQuestInstance _instance;
public QuestCancelConfirmGump(MLQuestInstance instance, bool closeGumps = true)
: base(120, 50)
public override bool Singleton => true;
private QuestCancelConfirmGump(MLQuestInstance instance, bool closeGumps) : base(120, 50)
{
m_Instance = instance;
m_CloseGumps = closeGumps;
_instance = instance;
_closeGumps = closeGumps;
}
public static void DisplayTo(Mobile from, MLQuestInstance instance, bool closeGumps = true)
{
if (from?.NetState == null || instance == null)
{
return;
}
if (closeGumps)
{
BaseQuestGump.CloseOtherGumps(instance.Player);
BaseMLQuestGump.CloseOtherGumps(instance.Player);
}
AddPage(0);
from.SendGump(new QuestCancelConfirmGump(instance, closeGumps));
}
Closable = false;
protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
builder.SetNoClose();
AddImageTiled(0, 0, 348, 262, 0xA8E);
AddAlphaRegion(0, 0, 348, 262);
builder.AddPage();
AddImage(0, 15, 0x27A8);
AddImageTiled(0, 30, 17, 200, 0x27A7);
AddImage(0, 230, 0x27AA);
builder.AddImageTiled(0, 0, 348, 262, 0xA8E);
builder.AddAlphaRegion(0, 0, 348, 262);
AddImage(15, 0, 0x280C);
AddImageTiled(30, 0, 300, 17, 0x280A);
AddImage(315, 0, 0x280E);
builder.AddImage(0, 15, 0x27A8);
builder.AddImageTiled(0, 30, 17, 200, 0x27A7);
builder.AddImage(0, 230, 0x27AA);
AddImage(15, 244, 0x280C);
AddImageTiled(30, 244, 300, 17, 0x280A);
AddImage(315, 244, 0x280E);
builder.AddImage(15, 0, 0x280C);
builder.AddImageTiled(30, 0, 300, 17, 0x280A);
builder.AddImage(315, 0, 0x280E);
AddImage(330, 15, 0x27A8);
AddImageTiled(330, 30, 17, 200, 0x27A7);
AddImage(330, 230, 0x27AA);
builder.AddImage(15, 244, 0x280C);
builder.AddImageTiled(30, 244, 300, 17, 0x280A);
builder.AddImage(315, 244, 0x280E);
AddImage(333, 2, 0x2716);
AddImage(333, 248, 0x2716);
AddImage(2, 248, 0x2716);
AddImage(2, 2, 0x2716);
builder.AddImage(330, 15, 0x27A8);
builder.AddImageTiled(330, 30, 17, 200, 0x27A7);
builder.AddImage(330, 230, 0x27AA);
AddHtmlLocalized(25, 22, 200, 20, 1049000, 0x7D00); // Confirm Quest Cancellation
AddImage(25, 40, 0xBBF);
builder.AddImage(333, 2, 0x2716);
builder.AddImage(333, 248, 0x2716);
builder.AddImage(2, 248, 0x2716);
builder.AddImage(2, 2, 0x2716);
builder.AddHtmlLocalized(25, 22, 200, 20, 1049000, 0x7D00); // Confirm Quest Cancellation
builder.AddImage(25, 40, 0xBBF);
/*
* This quest will give you valuable information, skills
@ -57,28 +71,28 @@ namespace Server.Engines.MLQuests.Gumps
* <BR>
* Are you certain you wish to cancel at this time?
*/
AddHtmlLocalized(25, 55, 300, 120, 1060836, 0x7FFF);
builder.AddHtmlLocalized(25, 55, 300, 120, 1060836, 0x7FFF);
var quest = instance.Quest;
var quest = _instance.Quest;
if (quest.IsChainTriggered || quest.NextQuest != null)
{
AddRadio(25, 145, 0x25F8, 0x25FB, false, 2);
AddHtmlLocalized(60, 150, 280, 20, 1075023, 0x7FFF); // Yes, I want to quit this entire chain!
builder.AddRadio(25, 145, 0x25F8, 0x25FB, false, 2);
builder.AddHtmlLocalized(60, 150, 280, 20, 1075023, 0x7FFF); // Yes, I want to quit this entire chain!
}
AddRadio(25, 180, 0x25F8, 0x25FB, true, 1);
AddHtmlLocalized(60, 185, 280, 20, 1049005, 0x7FFF); // Yes, I really want to quit this quest!
builder.AddRadio(25, 180, 0x25F8, 0x25FB, true, 1);
builder.AddHtmlLocalized(60, 185, 280, 20, 1049005, 0x7FFF); // Yes, I really want to quit this quest!
AddRadio(25, 215, 0x25F8, 0x25FB, false, 0);
AddHtmlLocalized(60, 220, 280, 20, 1049006, 0x7FFF); // No, I don't want to quit.
builder.AddRadio(25, 215, 0x25F8, 0x25FB, false, 0);
builder.AddHtmlLocalized(60, 220, 280, 20, 1049006, 0x7FFF); // No, I don't want to quit.
AddButton(265, 220, 0xF7, 0xF8, 7);
builder.AddButton(265, 220, 0xF7, 0xF8, 7);
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (m_Instance.Removed)
if (_instance.Removed)
{
return;
}
@ -89,14 +103,14 @@ namespace Server.Engines.MLQuests.Gumps
{
if (info.IsSwitched(2))
{
m_Instance.Cancel(true);
_instance.Cancel(true);
}
else if (info.IsSwitched(1))
{
m_Instance.Cancel(false);
_instance.Cancel(false);
}
sender.Mobile.SendGump(new QuestLogGump(m_Instance.Player, m_CloseGumps));
QuestLogGump.DisplayTo(sender.Mobile, _instance.Player, _closeGumps);
break;
}
}

View file

@ -1,21 +1,41 @@
using Server.Gumps;
using Server.Mobiles;
namespace Server.Engines.MLQuests.Gumps
{
public class QuestConversationGump : BaseQuestGump
public class QuestConversationGump : BaseMLQuestGump
{
public QuestConversationGump(MLQuest quest, PlayerMobile pm, TextDefinition text)
private readonly TextDefinition _text;
public override bool Singleton => true;
private QuestConversationGump(MLQuest quest, TextDefinition text)
: base(3006156) // Quest Conversation
{
CloseOtherGumps(pm);
_text = text;
SetTitle(quest.Title);
RegisterButton(ButtonPosition.Right, ButtonGraphic.Close, 3);
SetPageCount(1);
}
BuildPage();
AddConversation(text);
public static void DisplayTo(PlayerMobile pm, MLQuest quest, TextDefinition text)
{
if (pm?.NetState == null || quest == null)
{
return;
}
CloseOtherGumps(pm);
pm.SendGump(new QuestConversationGump(quest, text));
}
protected override void BuildContent(ref DynamicGumpBuilder builder)
{
BuildPage(ref builder);
AddConversation(ref builder, _text);
}
}
}

View file

@ -3,51 +3,63 @@ using Server.Network;
namespace Server.Engines.MLQuests.Gumps
{
public class QuestLogDetailedGump : BaseQuestGump
public class QuestLogDetailedGump : BaseMLQuestGump
{
private readonly bool m_CloseGumps;
private readonly MLQuestInstance m_Instance;
private readonly bool _closeGumps;
private readonly MLQuestInstance _instance;
public override bool Singleton => true;
public QuestLogDetailedGump(MLQuestInstance instance, bool closeGumps = true)
private QuestLogDetailedGump(MLQuestInstance instance, bool closeGumps)
: base(1046026) // Quest Log
{
m_Instance = instance;
m_CloseGumps = closeGumps;
_instance = instance;
_closeGumps = closeGumps;
var pm = instance.Player;
var quest = instance.Quest;
if (closeGumps)
{
CloseOtherGumps(pm);
}
SetTitle(quest.Title);
SetTitle(instance.Quest.Title);
RegisterButton(ButtonPosition.Left, ButtonGraphic.Resign, 1);
RegisterButton(ButtonPosition.Right, ButtonGraphic.Okay, 2);
SetPageCount(3);
}
BuildPage();
AddDescription(quest);
if (instance.Failed) // only displayed on the first page
public static void DisplayTo(Mobile from, MLQuestInstance instance, bool closeGumps = true)
{
if (from?.NetState == null || instance == null)
{
AddHtmlLocalized(160, 80, 250, 16, 500039, 0x3C00); // Failed!
return;
}
BuildPage();
AddObjectivesProgress(instance);
if (closeGumps)
{
CloseOtherGumps(instance.Player);
}
BuildPage();
AddRewardsPage(quest);
from.SendGump(new QuestLogDetailedGump(instance, closeGumps));
}
protected override void BuildContent(ref DynamicGumpBuilder builder)
{
var quest = _instance.Quest;
BuildPage(ref builder);
AddDescription(ref builder, quest);
if (_instance.Failed) // only displayed on the first page
{
builder.AddHtmlLocalized(160, 80, 250, 16, 500039, 0x3C00); // Failed!
}
BuildPage(ref builder);
AddObjectivesProgress(ref builder, _instance);
BuildPage(ref builder);
AddRewardsPage(ref builder, quest);
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (m_Instance.Removed)
if (_instance.Removed)
{
return;
}
@ -57,17 +69,17 @@ namespace Server.Engines.MLQuests.Gumps
case 1: // Resign
{
// TODO: Custom reward loss protection? OSI doesn't have this
// if (m_Instance.ClaimReward)
// if (_instance.ClaimReward)
// pm.SendMessage( "You cannot cancel a quest with rewards pending." );
// else
sender.Mobile.SendGump(new QuestCancelConfirmGump(m_Instance, m_CloseGumps));
QuestCancelConfirmGump.DisplayTo(sender.Mobile, _instance, _closeGumps);
break;
}
case 2: // Okay
{
sender.Mobile.SendGump(new QuestLogGump(m_Instance.Player, m_CloseGumps));
QuestLogGump.DisplayTo(sender.Mobile, _instance.Player, _closeGumps);
break;
}

View file

@ -4,33 +4,57 @@ using Server.Network;
namespace Server.Engines.MLQuests.Gumps
{
public class QuestLogGump : BaseQuestGump
public class QuestLogGump : BaseMLQuestGump
{
private readonly bool m_CloseGumps;
private readonly PlayerMobile m_Owner;
private readonly bool _closeGumps;
private readonly PlayerMobile _owner;
public override bool Singleton => true;
public QuestLogGump(PlayerMobile pm, bool closeGumps = true)
private QuestLogGump(PlayerMobile pm, bool closeGumps)
: base(1046026) // Quest Log
{
m_Owner = pm;
m_CloseGumps = closeGumps;
_owner = pm;
_closeGumps = closeGumps;
RegisterButton(ButtonPosition.Right, ButtonGraphic.Okay, 3);
SetPageCount(1);
}
public static void DisplayTo(Mobile from, PlayerMobile pm, bool closeGumps = true)
{
if (from?.NetState == null || pm == null)
{
return;
}
if (closeGumps)
{
pm.CloseGump<QuestLogDetailedGump>();
}
RegisterButton(ButtonPosition.Right, ButtonGraphic.Okay, 3);
from.SendGump(new QuestLogGump(pm, closeGumps));
}
SetPageCount(1);
public static void DisplayTo(PlayerMobile pm)
{
if (pm?.NetState == null)
{
return;
}
BuildPage();
pm.CloseGump<QuestLogDetailedGump>();
pm.SendGump(new QuestLogGump(pm, true));
}
protected override void BuildContent(ref DynamicGumpBuilder builder)
{
BuildPage(ref builder);
int numberColor, stringColor;
var context = MLQuestSystem.GetContext(pm);
var context = MLQuestSystem.GetContext(_owner);
if (context != null)
{
@ -49,7 +73,7 @@ namespace Server.Engines.MLQuests.Gumps
}
instances[i].Quest.Title.AddHtmlText(
this,
ref builder,
98,
140 + 21 * i,
270,
@ -59,7 +83,7 @@ namespace Server.Engines.MLQuests.Gumps
numberColor,
stringColor
);
AddButton(368, 140 + 21 * i, 0x26B0, 0x26B1, 6 + i, GumpButtonType.Reply, 1);
builder.AddButton(368, 140 + 21 * i, 0x26B0, 0x26B1, 6 + i, GumpButtonType.Reply, 1);
}
}
}
@ -71,7 +95,7 @@ namespace Server.Engines.MLQuests.Gumps
return;
}
var context = MLQuestSystem.GetContext(m_Owner);
var context = MLQuestSystem.GetContext(_owner);
if (context == null)
{
@ -86,7 +110,7 @@ namespace Server.Engines.MLQuests.Gumps
return;
}
sender.Mobile.SendGump(new QuestLogDetailedGump(instances[index], m_CloseGumps));
QuestLogDetailedGump.DisplayTo(sender.Mobile, instances[index], _closeGumps);
}
}
}

View file

@ -4,35 +4,48 @@ using Server.Network;
namespace Server.Engines.MLQuests.Gumps
{
public class QuestOfferGump : BaseQuestGump
public class QuestOfferGump : BaseMLQuestGump
{
private readonly MLQuest m_Quest;
private readonly IQuestGiver m_Quester;
private readonly MLQuest _quest;
private readonly IQuestGiver _quester;
public override bool Singleton => true;
public QuestOfferGump(MLQuest quest, IQuestGiver quester, PlayerMobile pm)
private QuestOfferGump(MLQuest quest, IQuestGiver quester)
: base(1049010) // Quest Offer
{
m_Quest = quest;
m_Quester = quester;
CloseOtherGumps(pm);
_quest = quest;
_quester = quester;
SetTitle(quest.Title);
RegisterButton(ButtonPosition.Left, ButtonGraphic.Accept, 1);
RegisterButton(ButtonPosition.Right, ButtonGraphic.Refuse, 2);
SetPageCount(3);
}
BuildPage();
AddDescription(quest);
public static void DisplayTo(PlayerMobile pm, MLQuest quest, IQuestGiver quester)
{
if (pm?.NetState == null || quest == null)
{
return;
}
BuildPage();
AddObjectives(quest);
CloseOtherGumps(pm);
BuildPage();
AddRewardsPage(quest);
pm.SendGump(new QuestOfferGump(quest, quester));
}
protected override void BuildContent(ref DynamicGumpBuilder builder)
{
BuildPage(ref builder);
AddDescription(ref builder, _quest);
BuildPage(ref builder);
AddObjectives(ref builder, _quest);
BuildPage(ref builder);
AddRewardsPage(ref builder, _quest);
}
public override void OnResponse(NetState sender, in RelayInfo info)
@ -46,12 +59,12 @@ namespace Server.Engines.MLQuests.Gumps
{
case 1: // Accept
{
m_Quest.OnAccept(m_Quester, pm);
_quest.OnAccept(_quester, pm);
break;
}
case 2: // Refuse
{
m_Quest.OnRefuse(m_Quester, pm);
_quest.OnRefuse(_quester, pm);
break;
}
}

View file

@ -3,36 +3,48 @@ using Server.Network;
namespace Server.Engines.MLQuests.Gumps
{
public class QuestReportBackGump : BaseQuestGump
public class QuestReportBackGump : BaseMLQuestGump
{
private readonly MLQuestInstance m_Instance;
private readonly MLQuestInstance _instance;
public QuestReportBackGump(MLQuestInstance instance)
public override bool Singleton => true;
private QuestReportBackGump(MLQuestInstance instance)
: base(3006156) // Quest Conversation
{
m_Instance = instance;
_instance = instance;
var quest = instance.Quest;
var pm = instance.Player;
// TODO: Check close sequence
CloseOtherGumps(pm);
SetTitle(quest.Title);
SetTitle(instance.Quest.Title);
RegisterButton(ButtonPosition.Left, ButtonGraphic.Continue, 4);
RegisterButton(ButtonPosition.Right, ButtonGraphic.Close, 3);
SetPageCount(1);
}
BuildPage();
AddConversation(quest.CompletionMessage);
public static void DisplayTo(Mobile from, MLQuestInstance instance)
{
if (from?.NetState == null || instance == null)
{
return;
}
// TODO: Check close sequence
CloseOtherGumps(instance.Player);
from.SendGump(new QuestReportBackGump(instance));
}
protected override void BuildContent(ref DynamicGumpBuilder builder)
{
BuildPage(ref builder);
AddConversation(ref builder, _instance.Quest.CompletionMessage);
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (info.ButtonID == 4)
{
m_Instance.ContinueReportBack(true);
_instance.ContinueReportBack(true);
}
}
}

View file

@ -3,34 +3,46 @@ using Server.Network;
namespace Server.Engines.MLQuests.Gumps
{
public class QuestRewardGump : BaseQuestGump
public class QuestRewardGump : BaseMLQuestGump
{
private readonly MLQuestInstance m_Instance;
private readonly MLQuestInstance _instance;
public QuestRewardGump(MLQuestInstance instance)
public override bool Singleton => true;
private QuestRewardGump(MLQuestInstance instance)
: base(1072201) // Reward
{
m_Instance = instance;
_instance = instance;
var quest = instance.Quest;
var pm = instance.Player;
CloseOtherGumps(pm);
SetTitle(quest.Title);
SetTitle(instance.Quest.Title);
RegisterButton(ButtonPosition.Left, ButtonGraphic.Accept, 1);
SetPageCount(1);
}
BuildPage();
AddRewards(quest);
public static void DisplayTo(Mobile from, MLQuestInstance instance)
{
if (from?.NetState == null || instance == null)
{
return;
}
CloseOtherGumps(instance.Player);
from.SendGump(new QuestRewardGump(instance));
}
protected override void BuildContent(ref DynamicGumpBuilder builder)
{
BuildPage(ref builder);
AddRewards(ref builder, _instance.Quest);
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (info.ButtonID == 1)
{
m_Instance.ClaimRewards();
_instance.ClaimRewards();
}
}
}

View file

@ -19,58 +19,70 @@ namespace Server.Engines.MLQuests.Gumps
void OnCancel(PlayerMobile from);
}
public class RaceChangeConfirmGump : Gump
public class RaceChangeConfirmGump : DynamicGump
{
private static Dictionary<NetState, RaceChangeState> m_Pending;
private readonly PlayerMobile m_From;
private readonly IRaceChanger m_Owner;
private readonly Race m_Race;
private readonly IRaceChanger _owner;
private readonly Race _race;
public override bool Singleton => true;
public RaceChangeConfirmGump(IRaceChanger owner, PlayerMobile from, Race targetRace)
: base(50, 50)
private RaceChangeConfirmGump(IRaceChanger owner, Race targetRace) : base(50, 50)
{
m_Owner = owner;
m_From = from;
m_Race = targetRace;
_owner = owner;
_race = targetRace;
}
AddPage(0);
AddBackground(0, 0, 240, 135, 0x2422);
if (targetRace == Race.Human)
public static void DisplayTo(PlayerMobile from, IRaceChanger owner, Race targetRace)
{
if (from?.NetState == null || targetRace == null)
{
AddHtmlLocalized(15, 15, 210, 75, 1073643, 0); // Are you sure you wish to embrace your humanity?
return;
}
else if (targetRace == Race.Elf)
from.SendGump(new RaceChangeConfirmGump(owner, targetRace));
}
protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
builder.AddPage();
builder.AddBackground(0, 0, 240, 135, 0x2422);
if (_race == Race.Human)
{
AddHtmlLocalized(15, 15, 210, 75, 1073642, 0); // Are you sure you want to follow the elven ways?
builder.AddHtmlLocalized(15, 15, 210, 75, 1073643, 0); // Are you sure you wish to embrace your humanity?
}
else if (_race == Race.Elf)
{
builder.AddHtmlLocalized(15, 15, 210, 75, 1073642, 0); // Are you sure you want to follow the elven ways?
}
else
{
AddHtml(15, 15, 210, 75, $"Are you sure you want to change your race to {targetRace.Name}?");
builder.AddHtml(15, 15, 210, 75, $"Are you sure you want to change your race to {_race.Name}?");
}
AddButton(160, 95, 0xF7, 0xF8, 1);
AddButton(90, 95, 0xF2, 0xF1, 0);
builder.AddButton(160, 95, 0xF7, 0xF8, 1);
builder.AddButton(90, 95, 0xF2, 0xF1, 0);
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
var from = sender.Mobile;
switch (info.ButtonID)
{
case 0: // Cancel
{
m_Owner?.OnCancel(m_From);
_owner?.OnCancel((PlayerMobile)from);
break;
}
case 1: // Okay
{
if (m_Owner?.CheckComplete(m_From) != false)
if (_owner?.CheckComplete((PlayerMobile)from) != false)
{
Offer(m_Owner, m_From, m_Race);
Offer(_owner, (PlayerMobile)from, _race);
}
break;
@ -329,7 +341,7 @@ namespace Server.Engines.MLQuests.Gumps
if (CheckComplete(pm))
{
pm.SendGump(new RaceChangeConfirmGump(this, pm, pm.Race == Race.Human ? Race.Elf : Race.Human));
RaceChangeConfirmGump.DisplayTo(pm, this, pm.Race == Race.Human ? Race.Elf : Race.Human);
}
}
}

View file

@ -184,7 +184,7 @@ namespace Server.Engines.MLQuests
public virtual void SendOffer(IQuestGiver quester, PlayerMobile pm)
{
pm.SendGump(new QuestOfferGump(this, quester, pm));
QuestOfferGump.DisplayTo(pm, this, quester);
}
public virtual void OnAccept(IQuestGiver quester, PlayerMobile pm)
@ -213,7 +213,7 @@ namespace Server.Engines.MLQuests
public virtual void OnRefuse(IQuestGiver quester, PlayerMobile pm)
{
pm.SendGump(new QuestConversationGump(this, pm, RefusalMessage));
QuestConversationGump.DisplayTo(pm, this, RefusalMessage);
}
public virtual void GetRewards(MLQuestInstance instance)

View file

@ -234,7 +234,7 @@ namespace Server.Engines.MLQuests
public void SendProgressGump()
{
Player.SendGump(new QuestConversationGump(Quest, Player, Quest.InProgressMessage));
QuestConversationGump.DisplayTo(Player, Quest, Quest.InProgressMessage);
}
public void SendRewardOffer()
@ -260,7 +260,7 @@ namespace Server.Engines.MLQuests
}
else
{
Player.SendGump(new QuestRewardGump(this));
QuestRewardGump.DisplayTo(Player, this);
}
}
@ -272,7 +272,7 @@ namespace Server.Engines.MLQuests
}
else
{
Player.SendGump(new QuestReportBackGump(this));
QuestReportBackGump.DisplayTo(Player, this);
}
}

View file

@ -657,7 +657,7 @@ namespace Server.Engines.MLQuests
return;
}
pm.SendGump(new QuestLogGump(pm));
QuestLogGump.DisplayTo(pm);
}
public static MLQuest RandomStarterQuest(IQuestGiver quester, PlayerMobile pm, MLQuestContext context)
@ -833,7 +833,7 @@ namespace Server.Engines.MLQuests
from,
$"{from.AccessLevel} {CommandLogging.Format(from)} viewing quest overview of {CommandLogging.Format(pm)}"
);
from.SendGump(new QuestLogGump(pm, false));
QuestLogGump.DisplayTo(from, pm, false);
}
}

View file

@ -306,7 +306,7 @@ public partial class Darius : DoneQuestCollector
public override void OnComplete(PlayerMobile from)
{
from.SendGump(new RaceChangeConfirmGump(this, from, Race.Elf));
RaceChangeConfirmGump.DisplayTo(from, this, Race.Elf);
}
}
@ -382,6 +382,6 @@ public partial class Nedrick : DoneQuestCollector
public override void OnComplete(PlayerMobile from)
{
from.SendGump(new RaceChangeConfirmGump(this, from, Race.Human));
RaceChangeConfirmGump.DisplayTo(from, this, Race.Human);
}
}

View file

@ -1,7 +1,6 @@
using System;
using ModernUO.Serialization;
using Server.Engines.MLQuests.Gumps;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Network;
@ -11,7 +10,6 @@ namespace Server.Engines.MLQuests.Mobiles;
[SerializationGenerator(0)]
public partial class SirHelper : Mage
{
private static readonly Gump m_Gump = new InfoNPCGump(1078029, 1078028);
private static readonly TimeSpan m_ShoutDelay = TimeSpan.FromSeconds(20);
private static readonly TimeSpan
@ -77,7 +75,7 @@ public partial class SirHelper : Mage
}
MLQuestSystem.TurnToFace(this, from);
from.SendGump(m_Gump);
InfoNPCGump.DisplayTo(from, 1078029, 1078028);
// Paperdoll doesn't open
// base.OnDoubleClick( from );

View file

@ -11,7 +11,7 @@ namespace Server.Engines.MLQuests.Objectives
public virtual bool CanOffer(IQuestGiver quester, PlayerMobile pm, bool message) => true;
public abstract void WriteToGump(Gump g, ref int y);
public abstract void WriteToGump(ref DynamicGumpBuilder builder, ref int y);
public virtual BaseObjectiveInstance CreateInstance(MLQuestInstance instance) => null;
}
@ -46,18 +46,18 @@ namespace Server.Engines.MLQuests.Objectives
public virtual DataType ExtraDataType => DataType.None;
public virtual void WriteToGump(Gump g, ref int y)
public virtual void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
if (IsTimed)
{
WriteTimeRemaining(g, ref y, Utility.Max(EndTime - Core.Now, TimeSpan.Zero));
WriteTimeRemaining(ref builder, ref y, Utility.Max(EndTime - Core.Now, TimeSpan.Zero));
}
}
public static void WriteTimeRemaining(Gump g, ref int y, TimeSpan timeRemaining)
public static void WriteTimeRemaining(ref DynamicGumpBuilder builder, ref int y, TimeSpan timeRemaining)
{
g.AddHtmlLocalized(103, y, 120, 16, 1062379, 0x5F90); // Est. time remaining:
g.AddLabel(223, y, 0x481, timeRemaining.TotalSeconds.ToString("F0"));
builder.AddHtmlLocalized(103, y, 120, 16, 1062379, 0x5F90); // Est. time remaining:
builder.AddLabel(223, y, 0x481, $"{timeRemaining.TotalSeconds:F0}");
y += 16;
}

View file

@ -44,34 +44,34 @@ namespace Server.Engines.MLQuests.Objectives
return label - 1078872;
}
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
if (ShowDetailed)
{
var amount = DesiredAmount.ToString();
g.AddHtmlLocalized(98, y, 350, 16, 1072205, 0x5F90); // Obtain
g.AddLabel(143, y, 0x481, amount);
builder.AddHtmlLocalized(98, y, 350, 16, 1072205, 0x5F90); // Obtain
builder.AddLabel(143, y, 0x481, amount);
if (Name.Number > 0)
{
g.AddHtmlLocalized(143 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF);
g.AddItem(350, y, LabelToItemID(Name.Number));
builder.AddHtmlLocalized(143 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF);
builder.AddItem(350, y, LabelToItemID(Name.Number));
}
else if (Name.String != null)
{
g.AddLabel(143 + amount.Length * 15, y, 0x481, Name.String);
builder.AddLabel(143 + amount.Length * 15, y, 0x481, Name.String);
}
}
else
{
if (Name.Number > 0)
{
g.AddHtmlLocalized(98, y, 312, 32, Name.Number, 0x5F90);
builder.AddHtmlLocalized(98, y, 312, 32, Name.Number, 0x5F90);
}
else if (Name.String != null)
{
g.AddLabel(98, y, 0x481, Name.String);
builder.AddLabel(98, y, 0x481, Name.String);
}
}
@ -199,21 +199,21 @@ namespace Server.Engines.MLQuests.Objectives
// No message
}
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
Objective.WriteToGump(g, ref y);
Objective.WriteToGump(ref builder, ref y);
y -= 16;
if (Objective.ShowDetailed)
{
base.WriteToGump(g, ref y);
base.WriteToGump(ref builder, ref y);
g.AddHtmlLocalized(103, y, 120, 16, 3000087, 0x5F90); // Total
g.AddLabel(223, y, 0x481, GetCurrentTotal().ToString());
builder.AddHtmlLocalized(103, y, 120, 16, 3000087, 0x5F90); // Total
builder.AddLabel(223, y, 0x481, $"{GetCurrentTotal()}");
y += 16;
g.AddHtmlLocalized(103, y, 120, 16, 1074782, 0x5F90); // Return to
g.AddLabel(223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor(Instance.QuesterType));
builder.AddHtmlLocalized(103, y, 120, 16, 1074782, 0x5F90); // Return to
builder.AddLabel(223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor(Instance.QuesterType));
y += 16;
}
}

View file

@ -70,27 +70,27 @@ namespace Server.Engines.MLQuests.Objectives
}
}
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
var amount = Amount.ToString();
g.AddHtmlLocalized(98, y, 312, 16, 1072207, 0x5F90); // Deliver
g.AddLabel(143, y, 0x481, amount);
builder.AddHtmlLocalized(98, y, 312, 16, 1072207, 0x5F90); // Deliver
builder.AddLabel(143, y, 0x481, amount);
if (Name.Number > 0)
{
g.AddHtmlLocalized(143 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF);
g.AddItem(350, y, CollectObjective.LabelToItemID(Name.Number));
builder.AddHtmlLocalized(143 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF);
builder.AddItem(350, y, CollectObjective.LabelToItemID(Name.Number));
}
else if (Name.String != null)
{
g.AddLabel(143 + amount.Length * 15, y, 0x481, Name.String);
builder.AddLabel(143 + amount.Length * 15, y, 0x481, Name.String);
}
y += 32;
g.AddHtmlLocalized(103, y, 120, 16, 1072379, 0x5F90); // Deliver to
g.AddLabel(223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor(Destination));
builder.AddHtmlLocalized(103, y, 120, 16, 1072379, 0x5F90); // Deliver to
builder.AddLabel(223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor(Destination));
y += 16;
}
@ -225,11 +225,11 @@ namespace Server.Engines.MLQuests.Objectives
Instance.Player.SendLocalizedMessage(1074813); // You have failed to complete your delivery.
}
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
Objective.WriteToGump(g, ref y);
Objective.WriteToGump(ref builder, ref y);
base.WriteToGump(g, ref y);
base.WriteToGump(ref builder, ref y);
// No extra instance stuff printed for this objective
}

View file

@ -63,17 +63,17 @@ namespace Server.Engines.MLQuests.Objectives
return true;
}
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
g.AddHtmlLocalized(98, y, 312, 16, 1072206, 0x5F90); // Escort to
builder.AddHtmlLocalized(98, y, 312, 16, 1072206, 0x5F90); // Escort to
if (Destination.Name.Number > 0)
{
g.AddHtmlLocalized(173, y, 312, 20, Destination.Name.Number, 0x7FFF);
builder.AddHtmlLocalized(173, y, 312, 20, Destination.Name.Number, 0x7FFF);
}
else if (Destination.Name.String != null)
{
g.AddLabel(173, y, 0x481, Destination.Name.String);
builder.AddLabel(173, y, 0x481, Destination.Name.String);
}
y += 16;
@ -275,11 +275,11 @@ namespace Server.Engines.MLQuests.Objectives
Abandon();
}
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
m_Objective.WriteToGump(g, ref y);
m_Objective.WriteToGump(ref builder, ref y);
base.WriteToGump(g, ref y);
base.WriteToGump(ref builder, ref y);
// No extra instance stuff printed for this objective
}

View file

@ -68,12 +68,12 @@ namespace Server.Engines.MLQuests.Objectives
return true;
}
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
var skillLabel = AosSkillBonuses.GetLabel(Skill);
var args = $"#{skillLabel}\t{ThresholdFixed / 10.0:0.#}";
g.AddHtmlLocalized(98, y, 312, 16, 1077485, args, 0x5F90); // Increase ~1_SKILL~ to ~2_VALUE~
builder.AddHtmlLocalized(98, y, 312, 16, 1077485, args, 0x5F90); // Increase ~1_SKILL~ to ~2_VALUE~
y += 16;
}
@ -150,15 +150,15 @@ namespace Server.Engines.MLQuests.Objectives
OnQuestCancelled();
}
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
Objective.WriteToGump(g, ref y);
Objective.WriteToGump(ref builder, ref y);
base.WriteToGump(g, ref y);
base.WriteToGump(ref builder, ref y);
if (IsCompleted())
{
g.AddHtmlLocalized(113, y, 312, 20, 1055121, 0x7FFF); // Complete
builder.AddHtmlLocalized(113, y, 312, 20, 1055121, 0x7FFF); // Complete
y += 16;
}
}

View file

@ -23,35 +23,35 @@ namespace Server.Engines.MLQuests.Objectives
public QuestArea Area { get; set; }
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
var amount = DesiredAmount.ToString();
g.AddHtmlLocalized(98, y, 312, 16, 1072204, 0x5F90); // Slay
g.AddLabel(133, y, 0x481, amount);
builder.AddHtmlLocalized(98, y, 312, 16, 1072204, 0x5F90); // Slay
builder.AddLabel(133, y, 0x481, amount);
if (Name.Number > 0)
{
g.AddHtmlLocalized(133 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF);
builder.AddHtmlLocalized(133 + amount.Length * 15, y, 190, 18, Name.Number, 0x77BF);
}
else if (Name.String != null)
{
g.AddLabel(133 + amount.Length * 15, y, 0x481, Name.String);
builder.AddLabel(133 + amount.Length * 15, y, 0x481, Name.String);
}
y += 16;
if (Area != null)
{
g.AddHtmlLocalized(103, y, 312, 20, 1018327, 0x5F90); // Location
builder.AddHtmlLocalized(103, y, 312, 20, 1018327, 0x5F90); // Location
if (Area.Name.Number > 0)
{
g.AddHtmlLocalized(223, y, 312, 20, Area.Name.Number, 0x7FFF);
builder.AddHtmlLocalized(223, y, 312, 20, Area.Name.Number, 0x7FFF);
}
else if (Area.Name.String != null)
{
g.AddLabel(223, y, 0x481, Area.Name.String);
builder.AddLabel(223, y, 0x481, Area.Name.String);
}
y += 16;
@ -121,18 +121,18 @@ namespace Server.Engines.MLQuests.Objectives
public override bool IsCompleted() => Slain >= Objective.DesiredAmount;
public override void WriteToGump(Gump g, ref int y)
public override void WriteToGump(ref DynamicGumpBuilder builder, ref int y)
{
Objective.WriteToGump(g, ref y);
Objective.WriteToGump(ref builder, ref y);
base.WriteToGump(g, ref y);
base.WriteToGump(ref builder, ref y);
g.AddHtmlLocalized(103, y, 120, 16, 3000087, 0x5F90); // Total
g.AddLabel(223, y, 0x481, Slain.ToString());
builder.AddHtmlLocalized(103, y, 120, 16, 3000087, 0x5F90); // Total
builder.AddLabel(223, y, 0x481, $"{Slain}");
y += 16;
g.AddHtmlLocalized(103, y, 120, 16, 1074782, 0x5F90); // Return to
g.AddLabel(223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor(Instance.QuesterType));
builder.AddHtmlLocalized(103, y, 120, 16, 1074782, 0x5F90); // Return to
builder.AddLabel(223, y, 0x481, QuesterNameAttribute.GetQuesterNameFor(Instance.QuesterType));
y += 16;
}

View file

@ -12,9 +12,9 @@ namespace Server.Engines.MLQuests.Rewards
protected virtual int LabelHeight => 16;
public void WriteToGump(Gump g, int x, ref int y)
public void WriteToGump(ref DynamicGumpBuilder builder, int x, ref int y)
{
Name.AddHtmlText(g, x, y, 280, LabelHeight, false, false, 0x5F90, 0xBDE784);
Name.AddHtmlText(ref builder, x, y, 280, LabelHeight, false, false, 0x5F90, 0xBDE784);
}
public abstract void AddRewardItems(PlayerMobile pm, List<Item> rewards);