Search in sources :

Example 31 with IQuest

use of betterquesting.api.questing.IQuest in project BetterQuesting by Funwayguy.

the class QuestDatabase method removeKey.

@Override
public boolean removeKey(Integer id) {
    IQuest remQ = database.remove(id);
    if (remQ == null) {
        return false;
    }
    for (IQuest quest : this.getAllValues()) {
        // Remove from all pre-requisites
        quest.getPrerequisites().remove(remQ);
    }
    // Clear quest from quest lines
    QuestLineDatabase.INSTANCE.removeQuest(id);
    return true;
}
Also used : IQuest(betterquesting.api.questing.IQuest)

Example 32 with IQuest

use of betterquesting.api.questing.IQuest in project BetterQuesting by Funwayguy.

the class QuestDatabase method writeToJson_Progress.

private NBTTagList writeToJson_Progress(NBTTagList json) {
    for (Entry<Integer, IQuest> entry : database.entrySet()) {
        NBTTagCompound jq = new NBTTagCompound();
        entry.getValue().writeToNBT(jq, EnumSaveType.PROGRESS);
        jq.setInteger("questID", entry.getKey());
        json.appendTag(jq);
    }
    return json;
}
Also used : IQuest(betterquesting.api.questing.IQuest) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 33 with IQuest

use of betterquesting.api.questing.IQuest in project BetterQuesting by Funwayguy.

the class QuestDatabase method writeToJson_Config.

private NBTTagList writeToJson_Config(NBTTagList json) {
    for (Entry<Integer, IQuest> entry : database.entrySet()) {
        NBTTagCompound jq = new NBTTagCompound();
        entry.getValue().writeToNBT(jq, EnumSaveType.CONFIG);
        jq.setInteger("questID", entry.getKey());
        json.appendTag(jq);
    }
    return json;
}
Also used : IQuest(betterquesting.api.questing.IQuest) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 34 with IQuest

use of betterquesting.api.questing.IQuest in project BetterQuesting by Funwayguy.

the class QuestDatabase method readFromJson_Progress.

private void readFromJson_Progress(NBTTagList json) {
    for (int i = 0; i < json.tagCount(); i++) {
        NBTBase entry = json.get(i);
        if (entry == null || entry.getId() != 10) {
            continue;
        }
        NBTTagCompound qTag = (NBTTagCompound) entry;
        int qID = qTag.hasKey("questID", 99) ? qTag.getInteger("questID") : -1;
        if (qID < 0) {
            continue;
        }
        IQuest quest = getValue(qID);
        if (quest != null) {
            quest.readFromNBT(qTag, EnumSaveType.PROGRESS);
        }
    }
}
Also used : NBTBase(net.minecraft.nbt.NBTBase) IQuest(betterquesting.api.questing.IQuest) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 35 with IQuest

use of betterquesting.api.questing.IQuest in project BetterQuesting by Funwayguy.

the class QuestInstance method isUnlocked.

public boolean isUnlocked(UUID uuid) {
    int A = 0;
    int B = preRequisites.size();
    if (B <= 0) {
        return true;
    }
    for (IQuest quest : preRequisites) {
        if (quest != null && quest.isComplete(uuid)) {
            A++;
        }
    }
    return qInfo.getProperty(NativeProps.LOGIC_QUEST).getResult(A, B);
}
Also used : IQuest(betterquesting.api.questing.IQuest)

Aggregations

IQuest (betterquesting.api.questing.IQuest)44 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)12 ITask (betterquesting.api.questing.tasks.ITask)9 UUID (java.util.UUID)9 QuestInstance (betterquesting.questing.QuestInstance)8 ArrayList (java.util.ArrayList)6 GuiButtonQuestInstance (betterquesting.api.client.gui.controls.GuiButtonQuestInstance)5 QuestingPacket (betterquesting.api.network.QuestingPacket)4 IQuestLine (betterquesting.api.questing.IQuestLine)4 HashMap (java.util.HashMap)4 NBTBase (net.minecraft.nbt.NBTBase)4 GuiButtonThemed (betterquesting.api.client.gui.controls.GuiButtonThemed)3 IQuestLineEntry (betterquesting.api.questing.IQuestLineEntry)3 PanelButtonStorage (betterquesting.api2.client.gui.controls.PanelButtonStorage)3 QuestLineEntry (betterquesting.questing.QuestLineEntry)3 List (java.util.List)3 Minecraft (net.minecraft.client.Minecraft)3 CommandException (net.minecraft.command.CommandException)3 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)3 IPanelButton (betterquesting.api2.client.gui.controls.IPanelButton)2