questing failsafes

This commit is contained in:
2025-01-19 15:41:02 -06:00
parent 7f3d37e4f7
commit 15bea0df04
+21 -10
View File
@@ -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<AbstractWorldObject> 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;
if (mobList.get(randomIndex) == null) {
continue;
}
mob = (Mob) mobList.get(randomIndex);
}
Mob mob = (Mob) mobList.get(randomIndex);
obj.progressionNames = new ArrayList<>();
obj.progressionNames.add(mob.getFirstName());