Skip to content

Commit

Permalink
Refactor quest reward handling to check for null values before bankin…
Browse files Browse the repository at this point in the history
…g rewards
  • Loading branch information
PUNK3DAF committed Nov 12, 2024
1 parent 609213b commit 2f38bc5
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions Seasonal/HarvestDay/BirthdayFeastQuestRewards.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Skua.Core.Interfaces;
using Skua.Core.Models.Items;
using Skua.Core.Options;
using Skua.Core.Models.Quests;


public class BirthdayFeastQuestRewards
Expand Down Expand Up @@ -45,23 +46,41 @@ public void configure()
if (Bot.Config!.Get<bool>("ArlettesQuests"))
{
ArlettesQuests();
Core.ToBank(Core.EnsureLoad(8385).Rewards.ToString());
Quest? arlettesQuest = Core.InitializeWithRetries(() => Core.EnsureLoad(8385));
if (arlettesQuest != null)
{
Core.ToBank(arlettesQuest.Rewards.Select(r => r.Name).ToArray());
}
}

if (Bot.Config!.Get<bool>("InanitasQuests"))
{
InanitasQuests();
Core.ToBank(Core.EnsureLoad(8384).Rewards.ToString());
Quest? inanitasQuest = Core.InitializeWithRetries(() => Core.EnsureLoad(8384));
if (inanitasQuest != null)
{
Core.ToBank(inanitasQuest.Rewards.Select(r => r.Name).ToArray());
}
}

if (Bot.Config!.Get<bool>("MemetsQuests"))
{
MemetsQuests();
Core.ToBank(Core.EnsureLoad(8382).Rewards.ToString());
Quest? memetsQuest = Core.InitializeWithRetries(() => Core.EnsureLoad(8382));
if (memetsQuest != null)
{
Core.ToBank(memetsQuest.Rewards.Select(r => r.Name).ToArray());
}
}

if (Bot.Config!.Get<bool>("KotarosQuests"))
{
KotarosQuests();
Core.ToBank(Core.EnsureLoad(8383).Rewards.ToString());
Quest? kotarosQuest = Core.InitializeWithRetries(() => Core.EnsureLoad(8383));
if (kotarosQuest != null)
{
Core.ToBank(kotarosQuest.Rewards.Select(r => r.Name).ToArray());
}
}
}

Expand Down

0 comments on commit 2f38bc5

Please sign in to comment.