From 15bea0df041a08e71d414cb1ebc2443c42603684 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 19 Jan 2025 15:41:02 -0600 Subject: [PATCH] questing failsafes --- src/engine/QuestSystem/QuestManager.java | 31 ++++++++++++++++-------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/engine/QuestSystem/QuestManager.java b/src/engine/QuestSystem/QuestManager.java index 6c99e050..9f49fab4 100644 --- a/src/engine/QuestSystem/QuestManager.java +++ b/src/engine/QuestSystem/QuestManager.java @@ -81,8 +81,17 @@ public class QuestManager { acceptedQuests.remove(pc); //grant rewards - pc.grantXP((int) (Experience.maxXPPerKill(pc.getLevel()) * 10)); - pc.getCharItemManager().addGoldToInventory((int) Experience.maxXPPerKill(pc.getLevel()),false); + //only grant XP if level is below 75 + if(pc.level < 75) { + int xpGrant = (int) (Experience.maxXPPerKill(pc.getLevel()) * 10); + pc.grantXP(xpGrant); + ChatManager.chatSystemInfo(pc, "Your Quest Has Granted you: " + xpGrant + " Experience Points"); + } + + int goldGrant = (int) Experience.maxXPPerKill(pc.getLevel()); + pc.getCharItemManager().addGoldToInventory(goldGrant,false); + ChatManager.chatSystemInfo(pc, "Your Quest Has Granted you: " + goldGrant + " Gold Coins"); + pc.getCharItemManager().updateInventory(); } @@ -97,17 +106,19 @@ public class QuestManager { // Convert HashSet to a List ArrayList mobList = new ArrayList<>(mobs); - // Generate a random index - Random random = new Random(); - int randomIndex = random.nextInt(mobList.size()); + Mob mob = null; + while(mob == null || Mob.discDroppers.contains(mob)) { + // Generate a random index + Random random = new Random(); + int randomIndex = random.nextInt(mobList.size()); - if(mobList.get(randomIndex) == null) { - return null; - } - - Mob mob = (Mob) mobList.get(randomIndex); + if (mobList.get(randomIndex) == null) { + continue; + } + mob = (Mob) mobList.get(randomIndex); + } obj.progressionNames = new ArrayList<>(); obj.progressionNames.add(mob.getFirstName());