ModernUO/Projects/UOContent/Engines/Quests/Terrible Hatchlings/Objectives.cs
Kamron Batman 622250b8f4
fix: Fixes issue with cached static gump strings. Fixes bad gump colors (#1771)
### Summary
- Fixes an issue that causes CUO to crash due to bad string caching in static gumps
- Fixes wrong/bad 16bit html gump hues.
- Moves `C16232` (16-bit to 32-bit) and `C32216` (32-bit to 16-bit) to Utility class for broader use.

TODO:
- Some gumps have different 32bit (for string content) vs 16bit (for localized content) strings. Does this matter?
2024-05-10 22:44:16 -07:00

133 lines
3.5 KiB
C#

using Server.Items;
using Server.Mobiles;
namespace Server.Engines.Quests.Zento
{
public class FirstKillObjective : QuestObjective
{
public override object Message => 1063316;
public override void RenderProgress(BaseQuestGump gump)
{
if (!Completed)
{
// Deathwatch Beetle Hatchlings killed:
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0xC6BF);
gump.AddLabel(70, 280, 0x64, "0");
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, "10");
}
else
{
base.RenderProgress(gump);
}
}
public override void OnKill(BaseCreature creature, Container corpse)
{
if (creature is DeathwatchBeetleHatchling)
{
Complete();
}
}
public override void OnComplete()
{
System.AddObjective(new SecondKillObjective());
}
}
public class SecondKillObjective : QuestObjective
{
public override object Message => 1063320;
public override void RenderProgress(BaseQuestGump gump)
{
if (!Completed)
{
// Deathwatch Beetle Hatchlings killed:
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0xC6BF);
gump.AddLabel(70, 280, 0x64, "1");
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, "10");
}
else
{
base.RenderProgress(gump);
}
}
public override void OnKill(BaseCreature creature, Container corpse)
{
if (creature is DeathwatchBeetleHatchling)
{
Complete();
System.AddObjective(new ThirdKillObjective(2));
}
}
public override void OnRead()
{
if (!Completed)
{
Complete();
System.AddObjective(new ThirdKillObjective(1));
}
}
}
public class ThirdKillObjective : QuestObjective
{
public ThirdKillObjective(int startingProgress) => CurProgress = startingProgress;
public ThirdKillObjective()
{
}
public override object Message => 1063319;
public override int MaxProgress => 10;
public override void RenderProgress(BaseQuestGump gump)
{
if (!Completed)
{
// Deathwatch Beetle Hatchlings killed:
gump.AddHtmlLocalized(70, 260, 270, 100, 1063318, 0xC6BF);
gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
gump.AddLabel(100, 280, 0x64, "/");
gump.AddLabel(130, 280, 0x64, "10");
}
else
{
base.RenderProgress(gump);
}
}
public override void OnKill(BaseCreature creature, Container corpse)
{
if (creature is DeathwatchBeetleHatchling)
{
CurProgress++;
}
}
public override void OnComplete()
{
System.AddObjective(new ReturnObjective());
}
}
public class ReturnObjective : QuestObjective
{
public override object Message => 1063313;
public override void OnComplete()
{
System.AddConversation(new EndConversation());
}
}
}