Medal quest system tweak + Proximity check on quests + DB leak fix
Rebalanced the EXTREMELY low level section of the equipment level up system. Added support code for quests on Kerning Square and Mushroom Castle. Added quest scripts for many missing scripted quests. Refactored medal quests, now using a default script system for uncoded medal questid's. Fixed a DB leak regarding quest status and medal maps tables. Added proximity check for NPCs to start/complete quests that doesn't use the lightbulb system. Added "debuff" command, that debuffs people nearby.
This commit is contained in:
@@ -23,6 +23,7 @@ package scripting.quest;
|
||||
|
||||
import client.MapleClient;
|
||||
import scripting.npc.NPCConversationManager;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.quest.MapleQuest;
|
||||
|
||||
/**
|
||||
@@ -69,4 +70,9 @@ public class QuestActionManager extends NPCConversationManager {
|
||||
public void completeQuest() {
|
||||
forceCompleteQuest();
|
||||
}
|
||||
|
||||
public String getMedalName() { // usable only for medal quests (id 299XX)
|
||||
MapleQuest q = MapleQuest.getInstance(quest);
|
||||
return MapleItemInformationProvider.getInstance().getName(q.getMedalRequirement());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import javax.script.Invocable;
|
||||
import scripting.AbstractScriptManager;
|
||||
import server.quest.MapleQuest;
|
||||
import tools.FilePrinter;
|
||||
import constants.GameConstants;
|
||||
import client.MapleClient;
|
||||
import client.MapleQuestStatus;
|
||||
|
||||
@@ -45,40 +46,44 @@ public class QuestScriptManager extends AbstractScriptManager {
|
||||
public synchronized static QuestScriptManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
public void start(MapleClient c, short questid, int npc) {
|
||||
MapleQuest quest = MapleQuest.getInstance(questid);
|
||||
if (!c.getPlayer().getQuest(quest).getStatus().equals(MapleQuestStatus.Status.NOT_STARTED)) {
|
||||
dispose(c);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
QuestActionManager qm = new QuestActionManager(c, questid, npc, true);
|
||||
if (qms.containsKey(c)) {
|
||||
return;
|
||||
}
|
||||
if(c.canClickNPC()) {
|
||||
qms.put(c, qm);
|
||||
Invocable iv = getInvocable("quest/" + questid + ".js", c);
|
||||
if (iv == null) {
|
||||
FilePrinter.printError(FilePrinter.QUEST_UNCODED, "START Quest " + questid + " is uncoded.\r\n");
|
||||
}
|
||||
if (iv == null || QuestScriptManager.getInstance() == null) {
|
||||
qm.dispose();
|
||||
return;
|
||||
}
|
||||
engine.put("qm", qm);
|
||||
scripts.put(c, iv);
|
||||
c.setClickedNPC();
|
||||
iv.invokeFunction("start", (byte) 1, (byte) 0, 0);
|
||||
}
|
||||
} catch (final UndeclaredThrowableException ute) {
|
||||
FilePrinter.printError(FilePrinter.QUEST + questid + ".txt", ute);
|
||||
dispose(c);
|
||||
} catch (final Throwable t) {
|
||||
FilePrinter.printError(FilePrinter.QUEST + getQM(c).getQuest() + ".txt", t);
|
||||
dispose(c);
|
||||
}
|
||||
MapleQuest quest = MapleQuest.getInstance(questid);
|
||||
if (!quest.canStartWithoutRequirements(c.getPlayer())) {
|
||||
dispose(c);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
QuestActionManager qm = new QuestActionManager(c, questid, npc, true);
|
||||
if (qms.containsKey(c)) {
|
||||
return;
|
||||
}
|
||||
if(c.canClickNPC()) {
|
||||
qms.put(c, qm);
|
||||
Invocable iv = getInvocable("quest/" + questid + ".js", c);
|
||||
if (iv == null) {
|
||||
if(GameConstants.isMedalQuest(questid)) { // start generic medal quest
|
||||
iv = getInvocable("quest/medalQuest.js", c);
|
||||
} else {
|
||||
FilePrinter.printError(FilePrinter.QUEST_UNCODED, "START Quest " + questid + " is uncoded.\r\n");
|
||||
}
|
||||
}
|
||||
if (iv == null || QuestScriptManager.getInstance() == null) {
|
||||
qm.dispose();
|
||||
return;
|
||||
}
|
||||
engine.put("qm", qm);
|
||||
scripts.put(c, iv);
|
||||
c.setClickedNPC();
|
||||
iv.invokeFunction("start", (byte) 1, (byte) 0, 0);
|
||||
}
|
||||
} catch (final UndeclaredThrowableException ute) {
|
||||
FilePrinter.printError(FilePrinter.QUEST + questid + ".txt", ute);
|
||||
dispose(c);
|
||||
} catch (final Throwable t) {
|
||||
FilePrinter.printError(FilePrinter.QUEST + getQM(c).getQuest() + ".txt", t);
|
||||
dispose(c);
|
||||
}
|
||||
}
|
||||
|
||||
public void start(MapleClient c, byte mode, byte type, int selection) {
|
||||
@@ -96,7 +101,7 @@ public class QuestScriptManager extends AbstractScriptManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void end(MapleClient c, short questid, int npc) {
|
||||
MapleQuest quest = MapleQuest.getInstance(questid);
|
||||
if (!c.getPlayer().getQuest(quest).getStatus().equals(MapleQuestStatus.Status.STARTED) || !c.getPlayer().getMap().containsNPC(npc)) {
|
||||
@@ -112,9 +117,13 @@ public class QuestScriptManager extends AbstractScriptManager {
|
||||
qms.put(c, qm);
|
||||
Invocable iv = getInvocable("quest/" + questid + ".js", c);
|
||||
if (iv == null) {
|
||||
FilePrinter.printError(FilePrinter.QUEST_UNCODED, "END Quest " + questid + " is uncoded.\r\n");
|
||||
qm.dispose();
|
||||
return;
|
||||
if(GameConstants.isMedalQuest(questid)) { // start generic medal quest
|
||||
iv = getInvocable("quest/medalQuest.js", c);
|
||||
} else {
|
||||
FilePrinter.printError(FilePrinter.QUEST_UNCODED, "END Quest " + questid + " is uncoded.\r\n");
|
||||
qm.dispose();
|
||||
return;
|
||||
}
|
||||
}
|
||||
engine.put("qm", qm);
|
||||
scripts.put(c, iv);
|
||||
|
||||
Reference in New Issue
Block a user