mirror of
https://github.com/Zrips/Jobs.git
synced 2025-03-25 13:11:12 +01:00
Actual multi-objective quest thingy
This commit is contained in:
parent
f870e7f5dd
commit
03c18a98a1
@ -2,6 +2,7 @@ package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -11,9 +12,11 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.QuestObjective;
|
||||
import com.gamingmesh.jobs.container.QuestProgression;
|
||||
import com.gamingmesh.jobs.CMILib.RawMessage;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
public class quests implements Cmd {
|
||||
|
||||
@ -53,13 +56,13 @@ public class quests implements Cmd {
|
||||
for (JobProgression jobProg : jPlayer.getJobProgression()) {
|
||||
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
|
||||
for (QuestProgression q : list) {
|
||||
String progressLine = Jobs.getCommandManager().jobProgressMessage(q.getQuest().getAmount(), q.getAmountDone());
|
||||
String progressLine = Jobs.getCommandManager().jobProgressMessage(q.getTotalAmountNeeded(), q.getTotalAmountDone());
|
||||
|
||||
if (q.isCompleted())
|
||||
progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed");
|
||||
RawMessage rm = new RawMessage();
|
||||
String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine", "[progress]",
|
||||
progressLine, "[questName]", q.getQuest().getQuestName(), "[done]", q.getAmountDone(), "[required]", q.getQuest().getAmount());
|
||||
progressLine, "[questName]", q.getQuest().getQuestName(), "[done]", q.getTotalAmountDone(), "[required]", q.getTotalAmountNeeded());
|
||||
|
||||
List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover");
|
||||
List<String> hoverList = new ArrayList<>();
|
||||
@ -74,6 +77,18 @@ public class quests implements Cmd {
|
||||
}
|
||||
} else
|
||||
hoverList.add(current);
|
||||
|
||||
}
|
||||
|
||||
for (Entry<String, QuestObjective> oneObjective : q.getQuest().getObjectives().entrySet()) {
|
||||
|
||||
hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " +
|
||||
Jobs.getNameTranslatorManager().Translate(oneObjective.getKey(), oneObjective.getValue().getAction(), oneObjective.getValue().getTargetId(), oneObjective.getValue()
|
||||
.getTargetMeta(), oneObjective.getValue().getTargetName())
|
||||
+ " " + q.getAmountDone(oneObjective.getValue()) + "/"
|
||||
+ oneObjective.getValue().getAmount());
|
||||
|
||||
|
||||
}
|
||||
|
||||
String hover = "";
|
||||
|
@ -58,6 +58,7 @@ import com.gamingmesh.jobs.container.JobItems;
|
||||
import com.gamingmesh.jobs.container.JobLimitedItems;
|
||||
import com.gamingmesh.jobs.container.JobPermission;
|
||||
import com.gamingmesh.jobs.container.Quest;
|
||||
import com.gamingmesh.jobs.container.QuestObjective;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||
@ -870,29 +871,47 @@ public class ConfigManager {
|
||||
ConfigurationSection sqsection = qsection.getConfigurationSection(one);
|
||||
|
||||
String name = sqsection.getString("Name", one);
|
||||
Quest quest = new Quest(name, job);
|
||||
|
||||
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
|
||||
KeyValues kv = null;
|
||||
if (sqsection.isString("Target")) {
|
||||
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
|
||||
kv = getKeyValue(sqsection.getString("Target"), actionType, jobName);
|
||||
} else if (sqsection.isList("Target")) {
|
||||
List<String> list = sqsection.getStringList("Target");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
kv = getKeyValue(list.get(i), actionType, jobName);
|
||||
|
||||
if (kv != null) {
|
||||
int amount = sqsection.getInt("Amount", 1);
|
||||
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(), kv.getType() + kv.getSubType(), amount);
|
||||
quest.addObjective(objective);
|
||||
}
|
||||
}
|
||||
|
||||
if (kv == null)
|
||||
kv = getKeyValue("STONE", actionType, jobName);
|
||||
if (sqsection.isList("Objectives")) {
|
||||
List<String> list = sqsection.getStringList("Objectives");
|
||||
for (String oneObjective : list) {
|
||||
String[] split = oneObjective.split(";");
|
||||
if (split.length != 3) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobKey + " has incorrect quest objective (" + oneObjective + ")!");
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
ActionType actionType = ActionType.getByName(split[0]);
|
||||
kv = getKeyValue(split[1], actionType, jobName);
|
||||
if (kv != null) {
|
||||
int amount = Integer.parseInt(split[2]);
|
||||
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(), kv.getType() + kv.getSubType(), amount);
|
||||
quest.addObjective(objective);
|
||||
}
|
||||
} catch (Exception | Error e) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobKey + " has incorrect quest objective (" + oneObjective + ")!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int amount = sqsection.getInt("Amount");
|
||||
int chance = sqsection.getInt("Chance", 100);
|
||||
|
||||
List<String> commands = sqsection.getStringList("RewardCommands");
|
||||
List<String> desc = sqsection.getStringList("RewardDesc");
|
||||
|
||||
Quest quest = new Quest(name, job, actionType);
|
||||
|
||||
if (sqsection.isInt("fromLevel"))
|
||||
quest.setMinLvl(sqsection.getInt("fromLevel"));
|
||||
|
||||
@ -900,11 +919,7 @@ public class ConfigManager {
|
||||
quest.setMaxLvl(sqsection.getInt("toLevel"));
|
||||
|
||||
quest.setConfigName(one);
|
||||
quest.setAmount(amount);
|
||||
quest.setChance(chance);
|
||||
quest.setTargetId(kv.getId());
|
||||
quest.setTargetMeta(kv.getMeta());
|
||||
quest.setTargetName(kv.getType() + kv.getSubType());
|
||||
quest.setRewardCmds(commands);
|
||||
quest.setDescription(desc);
|
||||
quests.add(quest);
|
||||
|
@ -15,6 +15,7 @@ import com.gamingmesh.jobs.CMILib.ConfigReader;
|
||||
import com.gamingmesh.jobs.CMILib.ItemManager.CMIEntityType;
|
||||
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
|
||||
import com.gamingmesh.jobs.CMILib.ItemManager.CMIPotionType;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.JobInfo;
|
||||
import com.gamingmesh.jobs.container.NameList;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
@ -28,9 +29,13 @@ public class NameTranslatorManager {
|
||||
public ArrayList<NameList> ListOfColors = new ArrayList<>();
|
||||
|
||||
public String Translate(String materialName, JobInfo info) {
|
||||
return Translate(materialName, info.getActionType(), info.getId(), info.getMeta(), info.getName());
|
||||
}
|
||||
|
||||
public String Translate(String materialName, ActionType action, Integer id, String meta, String mame) {
|
||||
// Translating name to user friendly
|
||||
if (Jobs.getGCManager().UseCustomNames)
|
||||
switch (info.getActionType()) {
|
||||
switch (action) {
|
||||
case BREAK:
|
||||
case TNTBREAK:
|
||||
case EAT:
|
||||
@ -50,13 +55,13 @@ public class NameTranslatorManager {
|
||||
}
|
||||
for (NameList one : ListOfNames) {
|
||||
String ids = one.getId() + ":" + one.getMeta();
|
||||
if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(info.getId() + ":" + info.getMeta()) && !one.getId().equalsIgnoreCase("0")) {
|
||||
if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(id + ":" + meta) && !one.getId().equalsIgnoreCase("0")) {
|
||||
return one.getName();
|
||||
}
|
||||
}
|
||||
for (NameList one : ListOfNames) {
|
||||
String ids = one.getId();
|
||||
if (ids.equalsIgnoreCase(String.valueOf(info.getId())) && !one.getId().equalsIgnoreCase("0")) {
|
||||
if (ids.equalsIgnoreCase(String.valueOf(id)) && !one.getId().equalsIgnoreCase("0")) {
|
||||
return one.getName();
|
||||
}
|
||||
}
|
||||
@ -67,15 +72,15 @@ public class NameTranslatorManager {
|
||||
case TAME:
|
||||
for (NameList one : ListOfEntities) {
|
||||
String ids = one.getId() + ":" + one.getMeta();
|
||||
if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(info.getId() + ":" + info.getMeta()) && !one.getId().equalsIgnoreCase("0")) {
|
||||
if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(id + ":" + meta) && !one.getId().equalsIgnoreCase("0")) {
|
||||
return one.getName();
|
||||
}
|
||||
ids = one.getId();
|
||||
if (ids.equalsIgnoreCase(String.valueOf(info.getId())) && !one.getId().equalsIgnoreCase("0")) {
|
||||
if (ids.equalsIgnoreCase(String.valueOf(id)) && !one.getId().equalsIgnoreCase("0")) {
|
||||
return one.getName();
|
||||
}
|
||||
ids = one.getMinecraftName();
|
||||
if (ids.equalsIgnoreCase(info.getName())) {
|
||||
if (ids.equalsIgnoreCase(mame)) {
|
||||
return one.getName();
|
||||
}
|
||||
}
|
||||
@ -99,7 +104,7 @@ public class NameTranslatorManager {
|
||||
case SHEAR:
|
||||
for (NameList one : ListOfColors) {
|
||||
String ids = one.getMinecraftName();
|
||||
if (ids.equalsIgnoreCase(info.getName())) {
|
||||
if (ids.equalsIgnoreCase(mame)) {
|
||||
return one.getName();
|
||||
}
|
||||
}
|
||||
@ -110,7 +115,7 @@ public class NameTranslatorManager {
|
||||
case DRINK:
|
||||
for (NameList one : ListOfPotionNames) {
|
||||
String ids = one.getMinecraftName();
|
||||
if (ids.equalsIgnoreCase(info.getName())) {
|
||||
if (ids.equalsIgnoreCase(mame)) {
|
||||
return one.getName();
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ package com.gamingmesh.jobs.container;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
|
||||
public class JobInfo {
|
||||
private ActionType actionType;
|
||||
|
@ -33,6 +33,7 @@ import com.gamingmesh.jobs.dao.JobsDAO;
|
||||
import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
|
||||
@ -691,7 +692,7 @@ public class JobsPlayer {
|
||||
honorific = builder.toString().trim();
|
||||
if (honorific.length() > 0)
|
||||
honorific = org.bukkit.ChatColor.translateAlternateColorCodes('&',
|
||||
Jobs.getGCManager().getModifyChatPrefix() + honorific + Jobs.getGCManager().getModifyChatSuffix());
|
||||
Jobs.getGCManager().getModifyChatPrefix() + honorific + Jobs.getGCManager().getModifyChatSuffix());
|
||||
|
||||
}
|
||||
|
||||
@ -846,8 +847,15 @@ public class JobsPlayer {
|
||||
|
||||
for (Entry<String, QuestProgression> one : qpl.entrySet()) {
|
||||
QuestProgression prog = one.getValue();
|
||||
if (!prog.isEnded() && (type == null || type.name().equals(prog.getQuest().getAction().name())))
|
||||
ls.add(prog.getQuest().getConfigName().toLowerCase());
|
||||
if (prog.isEnded())
|
||||
continue;
|
||||
|
||||
for (Entry<String, QuestObjective> oneObjective : prog.getQuest().getObjectives().entrySet()) {
|
||||
if (type == null || type.name().equals(oneObjective.getValue().getAction().name())) {
|
||||
ls.add(prog.getQuest().getConfigName().toLowerCase());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ls;
|
||||
@ -899,12 +907,17 @@ public class JobsPlayer {
|
||||
|
||||
g.put(qp.getQuest().getConfigName(), qp);
|
||||
}
|
||||
|
||||
if (qp.getQuest() == null) {
|
||||
g.remove(one.getKey());
|
||||
continue;
|
||||
}
|
||||
if (type == null || type.name().equals(qp.getQuest().getAction().name())) {
|
||||
tmp.put(qp.getQuest().getConfigName(), qp);
|
||||
|
||||
for (Entry<String, QuestObjective> oneObjective : qp.getQuest().getObjectives().entrySet()) {
|
||||
if (type == null || type.name().equals(oneObjective.getValue().getAction().name())) {
|
||||
tmp.put(qp.getQuest().getConfigName(), qp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -917,8 +930,13 @@ public class JobsPlayer {
|
||||
QuestProgression qp = new QuestProgression(q);
|
||||
g.put(qp.getQuest().getConfigName(), qp);
|
||||
|
||||
if (type == null || type.name().equals(qp.getQuest().getAction().name()))
|
||||
tmp.put(qp.getQuest().getConfigName(), qp);
|
||||
for (Entry<String, QuestObjective> oneObjective : qp.getQuest().getObjectives().entrySet()) {
|
||||
if (type == null || type.name().equals(oneObjective.getValue().getAction().name())) {
|
||||
tmp.put(qp.getQuest().getConfigName(), qp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,11 @@ package com.gamingmesh.jobs.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
@ -11,50 +15,21 @@ public class Quest {
|
||||
private String configName;
|
||||
private String questName;
|
||||
private Job job;
|
||||
private ActionType action = null;
|
||||
private Long validUntil = 0L;
|
||||
|
||||
private int id;
|
||||
private String meta;
|
||||
private String name;
|
||||
|
||||
private int chance = 0;
|
||||
private Integer minLvl = null;
|
||||
private Integer maxLvl = null;
|
||||
|
||||
private int amount = Integer.MAX_VALUE;
|
||||
|
||||
private List<String> rewardCmds = new ArrayList<>();
|
||||
private List<String> rewards = new ArrayList<>();
|
||||
|
||||
public Quest(String questName, Job job, ActionType action) {
|
||||
private HashMap<String, QuestObjective> objectives = new HashMap<String, QuestObjective>();
|
||||
private Set<ActionType> actions = new HashSet<ActionType>();
|
||||
|
||||
public Quest(String questName, Job job) {
|
||||
this.questName = questName;
|
||||
this.job = job;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public int getTargetId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setTargetId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTargetMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setTargetMeta(String meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public String getTargetName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setTargetName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<String> getRewardCmds() {
|
||||
@ -73,14 +48,6 @@ public class Quest {
|
||||
this.rewards = rewards;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Long getValidUntil() {
|
||||
if (validUntil < System.currentTimeMillis()) {
|
||||
int hour = Jobs.getGCManager().getResetTimeHour();
|
||||
@ -108,14 +75,6 @@ public class Quest {
|
||||
this.validUntil = validUntil;
|
||||
}
|
||||
|
||||
public ActionType getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(ActionType action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public Job getJob() {
|
||||
return Jobs.getJob(this.job.getName());
|
||||
}
|
||||
@ -177,4 +136,34 @@ public class Quest {
|
||||
return true;
|
||||
}
|
||||
|
||||
public HashMap<String, QuestObjective> getObjectives() {
|
||||
return objectives;
|
||||
}
|
||||
|
||||
public boolean hasObjective(QuestObjective objective) {
|
||||
for (Entry<String, QuestObjective> one : this.objectives.entrySet()) {
|
||||
if (one.getValue().getTargetId() == objective.getTargetId() &&
|
||||
one.getValue().getAction() == objective.getAction() &&
|
||||
objective.getAmount() == one.getValue().getAmount() &&
|
||||
objective.getTargetName() == one.getValue().getTargetName())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setObjectives(HashMap<String, QuestObjective> objectives) {
|
||||
this.objectives = objectives;
|
||||
for (Entry<String, QuestObjective> one : objectives.entrySet()) {
|
||||
actions.add(one.getValue().getAction());
|
||||
}
|
||||
}
|
||||
|
||||
public void addObjective(QuestObjective objective) {
|
||||
this.objectives.put(objective.getTargetName(), objective);
|
||||
actions.add(objective.getAction());
|
||||
}
|
||||
|
||||
public boolean hasAction(ActionType action) {
|
||||
return this.actions.contains(action);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
public class QuestObjective {
|
||||
|
||||
private int id;
|
||||
private String meta;
|
||||
private String name;
|
||||
private int amount = Integer.MAX_VALUE;
|
||||
private ActionType action = null;
|
||||
|
||||
public QuestObjective(ActionType action, int id, String meta, String name, int amount) {
|
||||
this.action = action;
|
||||
this.id = id;
|
||||
this.meta = meta;
|
||||
this.name = name;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public int getTargetId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setTargetId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTargetMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setTargetMeta(String meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public String getTargetName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setTargetName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public ActionType getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(ActionType action) {
|
||||
this.action = action;
|
||||
}
|
||||
}
|
@ -1,14 +1,18 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
|
||||
public class QuestProgression {
|
||||
|
||||
private Quest quest;
|
||||
private int amountDone = 0;
|
||||
// private int amountDone = 0;
|
||||
private Long validUntil;
|
||||
private boolean givenReward = false;
|
||||
private HashMap<QuestObjective, Integer> done = new HashMap<QuestObjective, Integer>();
|
||||
|
||||
public QuestProgression(Quest quest) {
|
||||
this.quest = quest;
|
||||
@ -23,12 +27,30 @@ public class QuestProgression {
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
public int getAmountDone() {
|
||||
public int getTotalAmountNeeded() {
|
||||
int amountNeeded = 0;
|
||||
for (Entry<String, QuestObjective> one : quest.getObjectives().entrySet()) {
|
||||
amountNeeded += one.getValue().getAmount();
|
||||
}
|
||||
return amountNeeded;
|
||||
}
|
||||
|
||||
public int getTotalAmountDone() {
|
||||
int amountDone = 0;
|
||||
for (Entry<QuestObjective, Integer> one : done.entrySet()) {
|
||||
amountDone += one.getValue();
|
||||
}
|
||||
return amountDone;
|
||||
}
|
||||
|
||||
public void setAmountDone(int amountDone) {
|
||||
this.amountDone = amountDone;
|
||||
public int getAmountDone(QuestObjective objective) {
|
||||
Integer amountDone = done.get(objective);
|
||||
return amountDone == null ? 0 : amountDone;
|
||||
}
|
||||
|
||||
public void setAmountDone(QuestObjective objective, int amountDone) {
|
||||
if (quest.hasObjective(objective))
|
||||
done.put(objective, amountDone);
|
||||
}
|
||||
|
||||
public Long getValidUntil() {
|
||||
@ -48,19 +70,35 @@ public class QuestProgression {
|
||||
}
|
||||
|
||||
public boolean isCompleted() {
|
||||
return amountDone >= quest.getAmount();
|
||||
for (Entry<String, QuestObjective> one : quest.getObjectives().entrySet()) {
|
||||
Integer amountDone = this.done.get(one.getValue());
|
||||
if (amountDone == null || amountDone < one.getValue().getAmount())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void processQuest(JobsPlayer jPlayer, ActionInfo action) {
|
||||
|
||||
if (!quest.getAction().name().equals(action.getType().name()))
|
||||
if (!quest.hasAction(action.getType()))
|
||||
return;
|
||||
|
||||
if (!quest.getTargetName().equalsIgnoreCase(action.getName()) && !quest.getTargetName().equalsIgnoreCase(action.getNameWithSub()))
|
||||
if (!quest.getObjectives().containsKey(action.getName()) && !quest.getObjectives().containsKey(action.getNameWithSub()))
|
||||
return;
|
||||
|
||||
if (!isCompleted())
|
||||
amountDone++;
|
||||
if (!isCompleted()) {
|
||||
QuestObjective objective = quest.getObjectives().get(action.getName());
|
||||
if (objective == null)
|
||||
objective = quest.getObjectives().get(action.getNameWithSub());
|
||||
Integer old = done.get(objective);
|
||||
if (old == null)
|
||||
old = 0;
|
||||
if (old < objective.getAmount())
|
||||
done.put(objective, old + 1);
|
||||
else {
|
||||
done.put(objective, objective.getAmount());
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCompleted())
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user