Browse Source

questing failsafes

lakebane-questing
FatBoy-DOTC 1 week ago
parent
commit
15bea0df04
  1. 31
      src/engine/QuestSystem/QuestManager.java

31
src/engine/QuestSystem/QuestManager.java

@ -81,8 +81,17 @@ public class QuestManager { @@ -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 { @@ -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;
}
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());

Loading…
Cancel
Save