diff --git a/CoreBots.cs b/CoreBots.cs
index 764c9c92c..49a3abfaf 100644
--- a/CoreBots.cs
+++ b/CoreBots.cs
@@ -4058,7 +4058,11 @@ public void HuntMonsterQuestChoose(int questId, int rewardId, string? mapName =
/// Whether the item is temporary
///
///
- public void KillEscherion(string? item = null, int quant = 1, bool isTemp = false, bool log = true, bool publicRoom = false)
+ ///
+ ///
+ ///
+ ///
+ public void KillEscherion(string? item = null, int quant = 1, bool isTemp = false, bool log = true, bool publicRoom = false, bool FromSupplies = false, bool SellVoucher = false, bool ReturnDuring = false, string? ReturnItem = null)
{
if (item != null && (isTemp ? Bot.TempInv.Contains(item, quant) : CheckInventory(item, quant)))
return;
@@ -4068,8 +4072,10 @@ public void KillEscherion(string? item = null, int quant = 1, bool isTemp = fals
if (Bot.Player.Cell != "Boss")
Jump("Boss", "Left");
- if (item is not null && log)
- FarmingLogger(item, quant);
+ if (!FromSupplies)
+ if (item is not null && log)
+ FarmingLogger(item, quant);
+
if (item is not null && !isTemp)
AddDrop(item);
@@ -4095,7 +4101,7 @@ public void KillEscherion(string? item = null, int quant = 1, bool isTemp = fals
else
{
while (!Bot.ShouldExit && isTemp ? !Bot.TempInv.Contains(item, quant) : !CheckInventory(item, quant))
- _KillEscherion();
+ _KillEscherion(item, isTemp);
Rest();
if (!isTemp)
@@ -4136,6 +4142,27 @@ void _KillEscherion(string? item = null, bool isTemp = false)
Bot.Combat.Attack(target);
}
Sleep();
+
+ // Sell voucher area
+ if (item != "Voucher of Nulgath" && SellVoucher && CheckInventory("Voucher of Nulgath"))
+ {
+ while (!Bot.ShouldExit && (Bot.Player.HasTarget || Bot.Player.InCombat) && Bot.Player.Cell != "Enter")
+ {
+ Bot.Combat.CancelTarget();
+ Bot.Wait.ForCombatExit();
+ JumpWait();
+ Sleep();
+ }
+
+ if (Bot.Player.Gold < 100000000)
+ {
+ Bot.Wait.ForPickup("Voucher of Nulgath");
+ SellItem("Voucher of Nulgath", all: true);
+ Bot.Wait.ForItemSell();
+ }
+ }
+ DoSwindlesReturnArea(ReturnDuring, ReturnItem);
+
}
Bot.Options.AttackWithoutTarget = false;
@@ -4145,8 +4172,59 @@ void _KillEscherion(string? item = null, bool isTemp = false)
JumpWait();
Rest();
Bot.Options.HidePlayers = false;
+
+ void DoSwindlesReturnArea(bool returnPolicyActive, string? item = null)
+ {
+ // Return if the policy isn't active or required items are missing
+ if (!returnPolicyActive || !CheckInventory(new[] { Uni(1), Uni(6), Uni(9), Uni(16), Uni(20) }))
+ return;
+
+ bool retry = true;
+
+ while (!Bot.ShouldExit && retry)
+ {
+ retry = false; // Reset retry flag
+ ResetQuest(7551);
+ DarkMakaiItem("Dark Makai Rune");
+
+ // Load quest and find rewards
+ Quest? quest = InitializeWithRetries(() => Bot.Quests.EnsureLoad(7551));
+ if (quest == null)
+ {
+ Logger("Failed to load quest 7551, retrying...");
+ Sleep();
+ retry = true;
+ continue;
+ }
+
+ // Handle null `item` by skipping directly to reward selection
+ ItemBase? targetReward = item == null
+ ? null
+ : quest.Rewards.FirstOrDefault(r => r.Name == item && r.Name != "Receipt of Swindle");
+
+ int rewardID = targetReward?.ID ??
+ quest.Rewards.FirstOrDefault(r => !CheckInventory(r.ID, r.MaxStack))?.ID ?? -1;
+
+ if (rewardID != -1 && Bot.Quests.CanCompleteFullCheck(7551))
+ {
+ Logger($"Completing with: {quest.Rewards.First(r => r.ID == rewardID).Name} [ID: {rewardID}]");
+ EnsureComplete(7551, rewardID);
+ }
+ else
+ {
+ Logger("All rewards maxed. Completing with fallback reward ID: -1 (\"Receipt of Swindle\").");
+ EnsureComplete(7551);
+ }
+ }
+ }
+
+
+ string Uni(int nr)
+ => $"Unidentified {nr}";
+
}
+
///
/// Kill Vath for the desired item
///
diff --git a/Nation/CoreNation.cs b/Nation/CoreNation.cs
index 2901fbcf3..918047a94 100644
--- a/Nation/CoreNation.cs
+++ b/Nation/CoreNation.cs
@@ -835,7 +835,7 @@ public void Supplies(string? item = null, int quant = 1, bool UltraAlteon = fals
if (UltraAlteon)
Core.KillMonster("ultraalteon", "r10", "Left", "Ultra Alteon", log: false);
else
- Core.KillEscherion(log: false);
+ Core.KillEscherion(item, quant, log: false, FromSupplies: true, SellVoucher: sellMemVoucher, ReturnDuring: returnPolicyDuringSupplies, ReturnItem: ReturnItem);
Core.Sleep();
if (item != "Voucher of Nulgath" && sellMemVoucher && Core.CheckInventory("Voucher of Nulgath"))
@@ -914,7 +914,7 @@ public void Supplies(string? item = null, int quant = 1, bool UltraAlteon = fals
if (UltraAlteon)
Core.KillMonster("ultraalteon", "r10", "Left", "*", log: false);
else
- Core.KillEscherion(item, quant, log: false);
+ Core.KillEscherion(item, quant, log: false, FromSupplies: true, SellVoucher: sellMemVoucher, ReturnDuring: returnPolicyDuringSupplies, ReturnItem: ReturnItem);
// Sell voucher area
if (item != "Voucher of Nulgath" && sellMemVoucher && Core.CheckInventory("Voucher of Nulgath"))
@@ -950,40 +950,48 @@ public void Supplies(string? item = null, int quant = 1, bool UltraAlteon = fals
///
/// Indicates if the return policy is active.
/// The name of the specific reward item to prioritize.
- private void DoSwindlesReturnArea(bool returnPolicyActive, string? item)
+ void DoSwindlesReturnArea(bool returnPolicyActive, string? item = null)
{
// Return if the policy isn't active or required items are missing
if (!returnPolicyActive || !Core.CheckInventory(new[] { Uni(1), Uni(6), Uni(9), Uni(16), Uni(20) }))
return;
- Retry:
- Core.ResetQuest(7551);
- Core.DarkMakaiItem("Dark Makai Rune");
+ bool retry = true;
- // Try to find the specified reward item, skipping "Receipt of Swindle"
- Quest? quest = Core.InitializeWithRetries(() => Bot.Quests.EnsureLoad(7551));
- ItemBase? targetReward = quest?.Rewards.FirstOrDefault(r => r.Name == item && r.Name != "Receipt of Swindle");
+ while (!Bot.ShouldExit && retry)
+ {
+ retry = false; // Reset retry flag
+ Core.ResetQuest(7551);
+ Core.DarkMakaiItem("Dark Makai Rune");
- // Complete with targetReward if found, otherwise find a non-maxed reward or use -1 as fallback
- int rewardID = targetReward?.ID ??
- quest?.Rewards.FirstOrDefault(r => !Core.CheckInventory(r.ID, r.MaxStack))?.ID ?? -1;
+ // Load quest and find rewards
+ Quest? quest = Core.InitializeWithRetries(() => Bot.Quests.EnsureLoad(7551));
+ if (quest == null)
+ {
+ Core.Logger("Failed to load quest 7551, retrying...");
+ Core.Sleep();
+ retry = true;
+ continue;
+ }
- if (rewardID != -1 && Bot.Quests.CanCompleteFullCheck(7551))
- {
- if (quest != null)
+ // Handle null `item` by skipping directly to reward selection
+ ItemBase? targetReward = item == null
+ ? null
+ : quest.Rewards.FirstOrDefault(r => r.Name == item && r.Name != "Receipt of Swindle");
+
+ int rewardID = targetReward?.ID ??
+ quest.Rewards.FirstOrDefault(r => !Core.CheckInventory(r.ID, r.MaxStack))?.ID ?? -1;
+
+ if (rewardID != -1 && Bot.Quests.CanCompleteFullCheck(7551))
+ {
Core.Logger($"Completing with: {quest.Rewards.First(r => r.ID == rewardID).Name} [ID: {rewardID}]");
- Core.EnsureComplete(7551, rewardID);
- }
- else if (quest == null)
- {
- Core.Logger("Failed to load quest 7551, retrying...");
- Core.Sleep();
- goto Retry;
- }
- else
- {
- Core.Logger("All rewards maxed. Completing with fallback reward ID: -1 (\"Receipt of Swindle\").");
- Core.EnsureComplete(7551);
+ Core.EnsureComplete(7551, rewardID);
+ }
+ else
+ {
+ Core.Logger("All rewards maxed. Completing with fallback reward ID: -1 (\"Receipt of Swindle\").");
+ Core.EnsureComplete(7551);
+ }
}
}