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;
}
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;
}
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;
}
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);
}
}
}
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);
}
Aggregations