Search in sources :

Example 11 with MapleQuestStatus

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);
}
Also used : MapleQuestStatus(client.MapleQuestStatus)

Example 12 with MapleQuestStatus

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);
}
Also used : MapleQuestStatus(client.MapleQuestStatus)

Example 13 with MapleQuestStatus

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);
}
Also used : MapleQuestStatus(client.MapleQuestStatus)

Example 14 with MapleQuestStatus

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;
}
Also used : MapleQuestStatus(client.MapleQuestStatus)

Example 15 with MapleQuestStatus

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()));
    }
}
Also used : MapleQuestStatus(client.MapleQuestStatus)

Aggregations

MapleQuestStatus (client.MapleQuestStatus)16 MapleQuest (server.quest.MapleQuest)2 Item (client.inventory.Item)1 MaplePet (client.inventory.MaplePet)1 Point (java.awt.Point)1 ArrayList (java.util.ArrayList)1 MapleAlliance (net.server.guild.MapleAlliance)1 MapleGuild (net.server.guild.MapleGuild)1 CashItem (server.CashShop.CashItem)1 SpecialCashItem (server.CashShop.SpecialCashItem)1 MapleShopItem (server.MapleShopItem)1 MapleMapItem (server.maps.MapleMapItem)1 MaplePlayerShopItem (server.maps.MaplePlayerShopItem)1 MaplePacketLittleEndianWriter (tools.data.output.MaplePacketLittleEndianWriter)1