Browse Source

questing failsafes

lakebane-questing
FatBoy-DOTC 2 weeks ago
parent
commit
15bea0df04
  1. 25
      src/engine/QuestSystem/QuestManager.java

25
src/engine/QuestSystem/QuestManager.java

@ -81,8 +81,17 @@ public class QuestManager {
acceptedQuests.remove(pc); acceptedQuests.remove(pc);
//grant rewards //grant rewards
pc.grantXP((int) (Experience.maxXPPerKill(pc.getLevel()) * 10)); //only grant XP if level is below 75
pc.getCharItemManager().addGoldToInventory((int) Experience.maxXPPerKill(pc.getLevel()),false); 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(); pc.getCharItemManager().updateInventory();
} }
@ -97,17 +106,19 @@ public class QuestManager {
// Convert HashSet to a List // Convert HashSet to a List
ArrayList<AbstractWorldObject> mobList = new ArrayList<>(mobs); ArrayList<AbstractWorldObject> mobList = new ArrayList<>(mobs);
Mob mob = null;
while(mob == null || Mob.discDroppers.contains(mob)) {
// Generate a random index // Generate a random index
Random random = new Random(); Random random = new Random();
int randomIndex = random.nextInt(mobList.size()); int randomIndex = random.nextInt(mobList.size());
if (mobList.get(randomIndex) == null) {
if(mobList.get(randomIndex) == null) { continue;
return null;
} }
Mob mob = (Mob) mobList.get(randomIndex); mob = (Mob) mobList.get(randomIndex);
}
obj.progressionNames = new ArrayList<>(); obj.progressionNames = new ArrayList<>();
obj.progressionNames.add(mob.getFirstName()); obj.progressionNames.add(mob.getFirstName());

Loading…
Cancel
Save