From a3ffd53f530463ef1663660157b8b063cf43c6a4 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 18 Jan 2025 20:53:34 -0600 Subject: [PATCH] Quest System Completed --- src/engine/QuestSystem/QuestManager.java | 8 +++++++- src/engine/QuestSystem/QuestObject.java | 6 +++--- src/engine/objects/Mob.java | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/engine/QuestSystem/QuestManager.java b/src/engine/QuestSystem/QuestManager.java index ee514c1a..112b5806 100644 --- a/src/engine/QuestSystem/QuestManager.java +++ b/src/engine/QuestSystem/QuestManager.java @@ -53,11 +53,17 @@ public class QuestManager { } acceptedQuests.put(pc,obj); + displayCurrentQuest(pc); } public static void completeQuest(PlayerCharacter pc, QuestObject obj){ + + if(obj.objectiveCount < obj.objectiveCountRequired) + return; + + //notify the player they have completed their quest - ErrorPopupMsg.sendErrorMsg(pc, "You have completed the quest: " + obj.QuestName); + ErrorPopupMsg.sendErrorMsg(pc, "You have completed the quest: " + obj.QuestName +"! " + "Experience Reward: " + (int) (Experience.maxXPPerKill(pc.getLevel()) * 10) + " Gold Reward: " + (int) Experience.maxXPPerKill(pc.getLevel())); //add completed quest to completion log if (completedQuests.containsKey(pc)) { diff --git a/src/engine/QuestSystem/QuestObject.java b/src/engine/QuestSystem/QuestObject.java index 802b79a6..6b91bdb5 100644 --- a/src/engine/QuestSystem/QuestObject.java +++ b/src/engine/QuestSystem/QuestObject.java @@ -24,8 +24,8 @@ public class QuestObject { else return; - if(this.objectiveCount >= this.objectiveCountRequired){ - QuestManager.completeQuest(this.owner,this); - } + //if(this.objectiveCount >= this.objectiveCountRequired){ + // //QuestManager.completeQuest(this.owner,this); + //} } } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 01750e6b..0fa504ff 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1277,6 +1277,7 @@ public class Mob extends AbstractIntelligenceAgent { PlayerCharacter pc = (PlayerCharacter)attacker; if(QuestManager.acceptedQuests.containsKey(pc)){ QuestManager.acceptedQuests.get(pc).tryProgress(this.firstName); + QuestManager.completeQuest(pc,QuestManager.acceptedQuests.get(pc)); }