RogueLibs' logo

Creating a Custom Big Quest

RogueLibs provides classes and methods to create custom big quests, their quest markers and allows overriding their progress tracking.

CustomBigQuest class

To make a custom big quest, you need to create a class deriving from CustomBigQuest:

/MyAwesomeProject/MyAwesomeBigQuest.cs
public class MyAwesomeBigQuest : CustomBigQuest{    /* ... */}

These are the methods that you can override:

/MyAwesomeProject/MyAwesomeBigQuest.cs
public class MyAwesomeBigQuest : CustomBigQuest{    public override void Update() { /* ... */ }    public override void SetupQuestMarkers() { /* ... */ }    public override bool CheckCompleted() { /* ... */}    public override bool IsBigQuestObject(PlayfieldObject Object) { /* ... */}    public override string GetProgress() { /* ... */ }}

Update is called every frame while your big quest is active.
SetupQuestMarkers is called once per level.
CheckCompleted should return true if the big quest is completed on this floor; otherwise, false.
IsBigQuestObject should return true if an object is related to this big quest. You can use this, if just the PlayfieldObject.isBigQuestObject field is not enough. This also affects map markers.
GetProgress returns the localized text, that's displayed to the right of the map. You'd probably want to have the big quest's description and actual progress here.

Initialization

Just call the CreateCustomBigQuest method with your big quest's type as a parameter:

/MyAwesomeProject/MyAwesomeBigQuest.cs
public class MyAwesomeBigQuest : CustomBigQuest{    [RLSetup]    public static void Setup()    {        RogueLibs.CreateCustomBigQuest<MyAwesomeBigQuest>();    }}
note

See more about the RLSetup attribute here.

You can set your big quest's name and description using WithName and WithDescription methods:

/MyAwesomeProject/MyAwesomeBigQuest.cs
public class MyAwesomeBigQuest : CustomBigQuest{    [RLSetup]    public static void Setup()    {        RogueLibs.CreateCustomBigQuest<MyAwesomeBigQuest>()            .WithName(new CustomNameInfo("My Awesome Big Quest"))            .WithDescription(new CustomNameInfo("My Awesome Big Quest is very cool and does a lot of great stuff, and it's also awesome."));    }}
info

See Custom Names for more info.

Examples

A simple big quest, where you need to free all slaves on each level.

/MyAwesomeProject/AntiSlaveryService.cs
using RogueLibsCore;namespace MyAwesomeMod{    public class AntiSlaveryService : CustomBigQuest, IDoUpdate    {        private bool Failed;        [RLSetup]        public static void Setup()        {            RogueLibs.CreateCustomBigQuest<AntiSlaveryService>()                .WithUnlock(new BigQuestUnlock(nameof(AntiSlaveryService)))                .WithName(new("[DS] Anti-Slavery Service"))                .WithDescription(new("Higher levels are going to enslave all of us, we need to free all slaves before they do that!"));        }        public void Update()        {            int cur = 0;            int total = 0;            foreach (Agent agent2 in gc.agentList)            {                if (agent2.hasFormerSlaveOwner)                {                    cur++;                    total++;                    agent2.noBigQuestMarker = true;                }                else if ((agent2.slaveOwners?.Count ?? 0) > 0 )                {                    total++;                }            }            if (total < Total)            {                Failed = true;            }            Current = cur;        }        public override void SetupQuestMarkers()        {            foreach (Agent agent2 in gc.agentList)            {                if (agent2.slaveOwners.Count > 0)                {                    Total++;                    agent2.isBigQuestObject = true;                    agent2.noBigQuestMarker = false;                    agent2.bigQuestType = nameof(AntiSlaveryService);                    agent2.showBigQuestMarker = true;                    agent2.bigQuestMarkerAlwaysSeen = true;                    if (!gc.quests.bigQuestObjectList.Contains(agent2))                    {                        gc.quests.bigQuestObjectList.Add(agent);                    }                    agent2.SpawnNewMapMarker();                }            }        }        public override string GetProgress()        {            const string desc = "Free all slaves!\n";            string text = $"<color=white>Floor: {Current}/{Total}</color>";            if (Current == Total)            {                text = "<color=lime>Floor Clear!</color>";            }            if (Failed)            {                text = "<color=red>Failed!</color>";            }            return desc + text;        }    }}