use of client.MapleQuestStatus in project HeavenMS by ronancpl.
the class AbstractPlayerInteraction method getQuestProgress.
public int getQuestProgress(int qid) {
MapleQuestStatus status = c.getPlayer().getQuest(MapleQuest.getInstance(qid));
String progress = status.getProgress(status.getAnyProgressKey());
if (progress.isEmpty())
return 0;
return Integer.parseInt(progress);
}
use of client.MapleQuestStatus in project HeavenMS by ronancpl.
the class AbstractPlayerInteraction method setStringQuestProgress.
public void setStringQuestProgress(int qid, int pid, String progress) {
MapleQuestStatus status = c.getPlayer().getQuest(MapleQuest.getInstance(qid));
status.setProgress(pid, progress);
}
use of client.MapleQuestStatus in project HeavenMS by ronancpl.
the class MapleQuest method forfeit.
public void forfeit(MapleCharacter c) {
if (!c.getQuest(this).getStatus().equals(Status.STARTED)) {
return;
}
if (timeLimit > 0) {
c.announce(MaplePacketCreator.removeQuestTimeLimit(id));
}
MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.NOT_STARTED);
newStatus.setForfeited(c.getQuest(this).getForfeited() + 1);
c.updateQuest(newStatus);
}
use of client.MapleQuestStatus in project HeavenMS by ronancpl.
the class QuestRequirement method check.
@Override
public boolean check(MapleCharacter chr, Integer npcid) {
for (Integer questID : quests.keySet()) {
int stateReq = quests.get(questID);
MapleQuestStatus q = chr.getQuest(MapleQuest.getInstance(questID));
if (q == null && MapleQuestStatus.Status.getById(stateReq).equals(MapleQuestStatus.Status.NOT_STARTED))
continue;
if (q == null || !q.getStatus().equals(MapleQuestStatus.Status.getById(stateReq))) {
return false;
}
}
return true;
}
use of client.MapleQuestStatus in project HeavenMS by ronancpl.
the class MaplePacketCreator method addQuestInfo.
private static void addQuestInfo(final MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
mplew.writeShort(chr.getStartedQuestsSize());
for (MapleQuestStatus q : chr.getStartedQuests()) {
mplew.writeShort(q.getQuest().getId());
mplew.writeMapleAsciiString(q.getQuestData());
if (q.getQuest().getInfoNumber() > 0) {
mplew.writeShort(q.getQuest().getInfoNumber());
mplew.writeMapleAsciiString(q.getQuestData());
}
}
List<MapleQuestStatus> completed = chr.getCompletedQuests();
mplew.writeShort(completed.size());
for (MapleQuestStatus q : completed) {
mplew.writeShort(q.getQuest().getId());
mplew.writeLong(getTime(q.getCompletionTime()));
}
}
Aggregations