Added 9 more slots for quest kill objectives, and an option for kill quests to progress only if a player kills an NPC with that name.

Added quest interface support to get and modify data from specific quest types.
This commit is contained in:
luisc committed 2022-01-27 05:40:51 -06:00
1 parent 989effb5c5
commit f876f13d77
15 files changed
+155 -32

No files matched your search

@@ -14,19 +14,23 @@ import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.controllers.PlayerQuestData;
import noppes.npcs.controllers.QuestData;
import noppes.npcs.scripted.CustomNPCsException;
import noppes.npcs.scripted.handler.data.IQuestKill;
import noppes.npcs.scripted.handler.data.IQuestObjective;
public class QuestKill extends QuestInterface{
public class QuestKill extends QuestInterface implements IQuestKill {
public HashMap<String,Integer> targets = new HashMap<String,Integer>();
public int targetType = 0;
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
targets = NBTTags.getStringIntegerMap(compound.getTagList("QuestDialogs", 10));
targetType = compound.getInteger("TargetType");
}
@Override
public void writeEntityToNBT(NBTTagCompound compound) {
compound.setTag("QuestDialogs", NBTTags.nbtStringIntegerMap(targets));
compound.setInteger("TargetType",targetType);
}
@Override
@@ -90,6 +94,18 @@ public class QuestKill extends QuestInterface{
return (IQuestObjective[])list.toArray(new IQuestObjective[list.size()]);
}
public void setTargetType(int type) {
if(type < 0)
type = 0;
if(type > 1)
type = 1;
this.targetType = type;
}
public int getTargetType() {
return this.targetType;
}
class QuestKillObjective implements IQuestObjective {
private final QuestKill parent;
private final EntityPlayer player;