Search in sources :

Example 1 with GameEvent

use of com.wynntils.core.events.custom.GameEvent in project Wynntils by Wynntils.

the class ClientEvents method onChat.

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onChat(GameEvent e) {
    AnalysePosition position;
    boolean fullRead = false;
    boolean readImmediately = false;
    if (e instanceof GameEvent.LevelUp) {
        if (e instanceof GameEvent.LevelUp.Profession)
            position = AnalysePosition.MINIQUESTS;
        else
            position = AnalysePosition.QUESTS;
        fullRead = true;
    } else if (e instanceof GameEvent.QuestCompleted.MiniQuest) {
        QuestManager.completeQuest(((GameEvent.QuestCompleted.MiniQuest) e).getQuestName(), true);
        return;
    } else if (e instanceof GameEvent.QuestCompleted) {
        QuestManager.completeQuest(((GameEvent.QuestCompleted) e).getQuestName(), false);
        return;
    } else if (e instanceof GameEvent.QuestStarted.MiniQuest) {
        position = AnalysePosition.MINIQUESTS;
        readImmediately = ((GameEvent.QuestStarted.MiniQuest) e).getQuest().equalsIgnoreCase(QuestManager.getTrackedQuestName());
    } else if (e instanceof GameEvent.QuestStarted) {
        position = AnalysePosition.QUESTS;
        // Update immediately if started the tracked quest
        readImmediately = ((GameEvent.QuestStarted) e).getQuest().equalsIgnoreCase(QuestManager.getTrackedQuestName());
    } else if (e instanceof GameEvent.QuestUpdated) {
        position = AnalysePosition.QUESTS;
        // Update immediately because the tracked quest may have updated
        readImmediately = QuestManager.hasTrackedQuest();
    } else if (e instanceof GameEvent.DiscoveryFound.Secret)
        position = AnalysePosition.SECRET_DISCOVERIES;
    else if (e instanceof GameEvent.DiscoveryFound)
        position = AnalysePosition.DISCOVERIES;
    else
        return;
    QuestManager.updateAnalysis(position, fullRead, readImmediately && QuestBookConfig.INSTANCE.autoUpdateQuestbook);
}
Also used : AnalysePosition(com.wynntils.modules.questbook.enums.AnalysePosition) GameEvent(com.wynntils.core.events.custom.GameEvent) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

GameEvent (com.wynntils.core.events.custom.GameEvent)1 AnalysePosition (com.wynntils.modules.questbook.enums.AnalysePosition)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1