This commit is contained in:
Blackvein 2013-11-06 22:12:56 -08:00
parent 5b90901f37
commit 1ca1da2cf1
7 changed files with 100 additions and 82 deletions

View File

@ -5,6 +5,7 @@ import java.util.LinkedList;
import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.ItemUtil;
import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.event.NPCDeathEvent; import net.citizensnpcs.api.event.NPCDeathEvent;
import net.citizensnpcs.api.event.NPCLeftClickEvent;
import net.citizensnpcs.api.event.NPCRightClickEvent; import net.citizensnpcs.api.event.NPCRightClickEvent;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -32,6 +33,11 @@ public class NpcListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onNPCRightClick(NPCRightClickEvent evt) { public void onNPCRightClick(NPCRightClickEvent evt) {
if(plugin.questFactory.selectingNPCs.contains(evt.getClicker())){
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + "ID " + evt.getNPC().getId());
return;
}
if (evt.getClicker().isConversing() == false) { if (evt.getClicker().isConversing() == false) {
final Player player = evt.getClicker(); final Player player = evt.getClicker();
@ -111,11 +117,11 @@ public class NpcListener implements Listener {
quester.questToTake = q.name; quester.questToTake = q.name;
String s = extracted(quester); String s = extracted(quester);
for (String msg : s.split("<br>")) { for (String msg : s.split("<br>")) {
player.sendMessage(msg); player.sendMessage(msg);
} }
plugin.conversationFactory.buildConversation((Conversable) player).begin(); plugin.conversationFactory.buildConversation((Conversable) player).begin();
} else if (quester.currentQuest.equals(q) == false) { } else if (quester.currentQuest.equals(q) == false) {
@ -135,7 +141,7 @@ public class NpcListener implements Listener {
} else { } else {
quester.questToTake = q.name; quester.questToTake = q.name;
String s = extracted(quester); String s = extracted(quester);
for (String msg : s.split("<br>")) { for (String msg : s.split("<br>")) {
player.sendMessage(msg); player.sendMessage(msg);
} }
@ -163,6 +169,15 @@ public class NpcListener implements Listener {
} }
} }
@EventHandler
public void onNPCLeftClick(NPCLeftClickEvent evt){
if(plugin.questFactory.selectingNPCs.contains(evt.getClicker())){
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + "ID " + evt.getNPC().getId());
}
}
@EventHandler @EventHandler
public void onNPCDeath(NPCDeathEvent evt) { public void onNPCDeath(NPCDeathEvent evt) {

View File

@ -653,6 +653,8 @@ public class PlayerListener implements Listener {
quester.saveData(); quester.saveData();
} }
if(plugin.questFactory.selectingNPCs.contains(evt.getPlayer()))
plugin.questFactory.selectingNPCs.remove(evt.getPlayer());
plugin.questers.remove(quester.name); plugin.questers.remove(quester.name);
} }

View File

@ -4,6 +4,7 @@ import me.blackvein.quests.util.ColorUtil;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,6 +38,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
Map<Player, Block> selectedBlockStarts = new HashMap<Player, Block>(); Map<Player, Block> selectedBlockStarts = new HashMap<Player, Block>();
public Map<Player, Block> selectedKillLocations = new HashMap<Player, Block>(); public Map<Player, Block> selectedKillLocations = new HashMap<Player, Block>();
public Map<Player, Block> selectedReachLocations = new HashMap<Player, Block>(); public Map<Player, Block> selectedReachLocations = new HashMap<Player, Block>();
public HashSet<Player> selectingNPCs = new HashSet<Player>();
public List<String> names = new LinkedList<String>(); public List<String> names = new LinkedList<String>();
ConversationFactory convoCreator; ConversationFactory convoCreator;
File questsFile; File questsFile;
@ -471,7 +473,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("questEditorEnterNPCStart"); selectingNPCs.add((Player) context.getForWhom());
return ChatColor.YELLOW + Lang.get("questEditorEnterNPCStart") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
} }
@ -486,12 +489,15 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
} }
context.setSessionData(CK.Q_START_NPC, input.intValue()); context.setSessionData(CK.Q_START_NPC, input.intValue());
selectingNPCs.remove((Player) context.getForWhom());
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} else if (input.intValue() == -1) { } else if (input.intValue() == -1) {
context.setSessionData(CK.Q_START_NPC, null); context.setSessionData(CK.Q_START_NPC, null);
selectingNPCs.remove((Player) context.getForWhom());
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} else if (input.intValue() == -2) { } else if (input.intValue() == -2) {
selectingNPCs.remove((Player) context.getForWhom());
return new CreateMenuPrompt(); return new CreateMenuPrompt();
} else { } else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
@ -888,7 +894,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<String> heroesClassRews = null; LinkedList<String> heroesClassRews = null;
LinkedList<Double> heroesExpRews = null; LinkedList<Double> heroesExpRews = null;
if (cc.getSessionData(CK.Q_REDO_DELAY) != null) { if (cc.getSessionData(CK.Q_REDO_DELAY) != null) {
redo = (Long) cc.getSessionData(CK.Q_REDO_DELAY); redo = (Long) cc.getSessionData(CK.Q_REDO_DELAY);
} }
@ -930,11 +936,11 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
mcMMOSkillReqs = (LinkedList<String>) cc.getSessionData(CK.REQ_MCMMO_SKILLS); mcMMOSkillReqs = (LinkedList<String>) cc.getSessionData(CK.REQ_MCMMO_SKILLS);
mcMMOAmountReqs = (LinkedList<Integer>) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS); mcMMOAmountReqs = (LinkedList<Integer>) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
} }
if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null) { if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null) {
heroesPrimaryReq = (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS); heroesPrimaryReq = (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS);
} }
if (cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null) { if (cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null) {
heroesSecondaryReq = (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS); heroesSecondaryReq = (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS);
} }
@ -989,7 +995,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
mcMMOSkillRews = (LinkedList<String>) cc.getSessionData(CK.REW_MCMMO_SKILLS); mcMMOSkillRews = (LinkedList<String>) cc.getSessionData(CK.REW_MCMMO_SKILLS);
mcMMOSkillAmounts = (LinkedList<Integer>) cc.getSessionData(CK.REW_MCMMO_AMOUNTS); mcMMOSkillAmounts = (LinkedList<Integer>) cc.getSessionData(CK.REW_MCMMO_AMOUNTS);
} }
if (cc.getSessionData(CK.REW_HEROES_CLASSES) != null) { if (cc.getSessionData(CK.REW_HEROES_CLASSES) != null) {
heroesClassRews = (LinkedList<String>) cc.getSessionData(CK.REW_HEROES_CLASSES); heroesClassRews = (LinkedList<String>) cc.getSessionData(CK.REW_HEROES_CLASSES);
heroesExpRews = (LinkedList<Double>) cc.getSessionData(CK.REW_HEROES_AMOUNTS); heroesExpRews = (LinkedList<Double>) cc.getSessionData(CK.REW_HEROES_AMOUNTS);
@ -1362,11 +1368,11 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
} }
System.out.println("HERE 1"); System.out.println("HERE 1");
if (moneyRew != null || questPointsRew != null || itemRews != null && itemRews.isEmpty() == false || permRews != null && permRews.isEmpty() == false || expRew != null || commandRews != null && commandRews.isEmpty() == false || mcMMOSkillRews != null || RPGItemRews != null || heroesClassRews != null && heroesClassRews.isEmpty() == false) { if (moneyRew != null || questPointsRew != null || itemRews != null && itemRews.isEmpty() == false || permRews != null && permRews.isEmpty() == false || expRew != null || commandRews != null && commandRews.isEmpty() == false || mcMMOSkillRews != null || RPGItemRews != null || heroesClassRews != null && heroesClassRews.isEmpty() == false) {
System.out.println("HERE 2"); System.out.println("HERE 2");
ConfigurationSection rews = cs.createSection("rewards"); ConfigurationSection rews = cs.createSection("rewards");
rews.set("items", (itemRews != null && itemRews.isEmpty() == false) ? itemRews : null); rews.set("items", (itemRews != null && itemRews.isEmpty() == false) ? itemRews : null);
@ -1385,7 +1391,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
} else { } else {
cs.set("rewards", null); cs.set("rewards", null);
} }
System.out.println("HERE 3"); System.out.println("HERE 3");
} }
@ -1482,7 +1488,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
cc.setSessionData(CK.REW_MCMMO_SKILLS, q.mcmmoSkills); cc.setSessionData(CK.REW_MCMMO_SKILLS, q.mcmmoSkills);
cc.setSessionData(CK.REW_MCMMO_AMOUNTS, q.mcmmoAmounts); cc.setSessionData(CK.REW_MCMMO_AMOUNTS, q.mcmmoAmounts);
} }
if (q.heroesClasses.isEmpty() == false) { if (q.heroesClasses.isEmpty() == false) {
cc.setSessionData(CK.REW_HEROES_CLASSES, q.heroesClasses); cc.setSessionData(CK.REW_HEROES_CLASSES, q.heroesClasses);
cc.setSessionData(CK.REW_HEROES_AMOUNTS, q.heroesAmounts); cc.setSessionData(CK.REW_HEROES_AMOUNTS, q.heroesAmounts);
@ -1492,7 +1498,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
cc.setSessionData(CK.REW_RPG_ITEM_IDS, q.rpgItemRewardIDs); cc.setSessionData(CK.REW_RPG_ITEM_IDS, q.rpgItemRewardIDs);
cc.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, q.rpgItemRewardAmounts); cc.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, q.rpgItemRewardAmounts);
} }
if(q.heroesClasses.isEmpty() == false) { if(q.heroesClasses.isEmpty() == false) {
cc.setSessionData(CK.REW_HEROES_CLASSES, q.heroesClasses); cc.setSessionData(CK.REW_HEROES_CLASSES, q.heroesClasses);
cc.setSessionData(CK.REW_HEROES_AMOUNTS, q.heroesAmounts); cc.setSessionData(CK.REW_HEROES_AMOUNTS, q.heroesAmounts);
@ -1818,29 +1824,28 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<String> used = new LinkedList<String>(); LinkedList<String> used = new LinkedList<String>();
for (Quest quest : quests.quests) { Quest found = quests.findQuest(input);
if (quest.name.equalsIgnoreCase(input) || quest.name.toLowerCase().contains(input.toLowerCase())) { if (found != null) {
for (Quest q : quests.quests) { for (Quest q : quests.quests) {
if (q.neededQuests.contains(q.name) || q.blockQuests.contains(q.name)) {
used.add(q.name);
}
if (q.neededQuests.contains(q.name) || q.blockQuests.contains(q.name)) {
used.add(q.name);
} }
if (used.isEmpty()) { }
context.setSessionData(CK.ED_QUEST_DELETE, quest.name);
return new DeletePrompt(); if (used.isEmpty()) {
} else { context.setSessionData(CK.ED_QUEST_DELETE, found.name);
((Player) context.getForWhom()).sendMessage(RED + Lang.get("questEditorQuestAsRequirement1") + " \"" + PURPLE + context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\" " + Lang.get("questEditorQuestAsRequirement2")); return new DeletePrompt();
for (String s : used) { } else {
((Player) context.getForWhom()).sendMessage(RED + "- " + DARKRED + s); ((Player) context.getForWhom()).sendMessage(RED + Lang.get("questEditorQuestAsRequirement1") + " \"" + PURPLE + context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\" " + Lang.get("questEditorQuestAsRequirement2"));
} for (String s : used) {
((Player) context.getForWhom()).sendMessage(RED + Lang.get("questEditorQuestAsRequirement3")); ((Player) context.getForWhom()).sendMessage(RED + "- " + DARKRED + s);
return new SelectDeletePrompt();
} }
((Player) context.getForWhom()).sendMessage(RED + Lang.get("questEditorQuestAsRequirement3"));
return new SelectDeletePrompt();
} }
} }
@ -1862,7 +1867,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
String text String text
= RED + Lang.get("questEditorDeleted") + " \"" + GOLD + (String) context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\"?\n"; = RED + Lang.get("questEditorDeleted") + " \"" + GOLD + (String) context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\"?\n";
text += YELLOW + Lang.get("yes") + "/" + Lang.get(Lang.get("no")); text += YELLOW + Lang.get("yes") + "/" + Lang.get("no");
return text; return text;
@ -1874,7 +1879,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
if (input.equalsIgnoreCase(Lang.get("yes"))) { if (input.equalsIgnoreCase(Lang.get("yes"))) {
deleteQuest(context); deleteQuest(context);
return Prompt.END_OF_CONVERSATION; return Prompt.END_OF_CONVERSATION;
} else if (input.equalsIgnoreCase(Lang.get(Lang.get("no")))) { } else if (input.equalsIgnoreCase(Lang.get("no"))) {
return new MenuPrompt(); return new MenuPrompt();
} else { } else {
return new DeletePrompt(); return new DeletePrompt();

View File

@ -511,16 +511,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} }
} }
Quest quest = null; Quest quest = findQuest(name);
for (Quest q : quests) {
if (q.name.toLowerCase().contains(name)) {
quest = q;
break;
}
}
if (quest != null) { if (quest != null) {
@ -815,16 +806,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} }
Quest questToFind = null; Quest questToFind = findQuest(name);
for (Quest q : quests) {
if (q.name.toLowerCase().contains(name)) {
questToFind = q;
break;
}
}
if (questToFind != null) { if (questToFind != null) {
@ -1407,14 +1389,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
} }
for (Quest q : quests) { questToGive = findQuest(name);
if (q.name.toLowerCase().contains(name)) {
questToGive = q;
break;
}
}
if (questToGive == null) { if (questToGive == null) {
@ -3409,7 +3384,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
if (Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-skills"), String.class)) { if (Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-skills"), String.class)) {
if (config.contains("quests." + s + ".rewards.mcmmo-levels")) { if (config.contains("quests." + s + ".rewards.mcmmo-levels")) {
if(Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-levels"), Integer.class)){ if(Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-levels"), Integer.class)){
boolean failed = false; boolean failed = false;
@ -3431,7 +3406,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
quest.mcmmoSkills.addAll(config.getStringList("quests." + s + ".rewards.mcmmo-skills")); quest.mcmmoSkills.addAll(config.getStringList("quests." + s + ".rewards.mcmmo-skills"));
quest.mcmmoAmounts.addAll(config.getIntegerList("quests." + s + ".rewards.mcmmo-levels")); quest.mcmmoAmounts.addAll(config.getIntegerList("quests." + s + ".rewards.mcmmo-levels"));
} else { } else {
printSevere("[Quests] mcmmo-levels: Reward in Quest " + quest.name + " is not a list of numbers!"); printSevere("[Quests] mcmmo-levels: Reward in Quest " + quest.name + " is not a list of numbers!");
continue; continue;
@ -3447,13 +3422,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
continue; continue;
} }
} }
if (config.contains("quests." + s + ".rewards.heroes-exp-classes")) { if (config.contains("quests." + s + ".rewards.heroes-exp-classes")) {
if (Quests.checkList(config.getList("quests." + s + ".rewards.heroes-exp-classes"), String.class)) { if (Quests.checkList(config.getList("quests." + s + ".rewards.heroes-exp-classes"), String.class)) {
if (config.contains("quests." + s + ".rewards.heroes-exp-amounts")) { if (config.contains("quests." + s + ".rewards.heroes-exp-amounts")) {
if (Quests.checkList(config.getList("quests." + s + ".rewards.heroes-exp-amounts"), Double.class)) { if (Quests.checkList(config.getList("quests." + s + ".rewards.heroes-exp-amounts"), Double.class)) {
boolean failed = false; boolean failed = false;
@ -3475,7 +3450,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
quest.heroesClasses.addAll(config.getStringList("quests." + s + ".rewards.heroes-exp-classes")); quest.heroesClasses.addAll(config.getStringList("quests." + s + ".rewards.heroes-exp-classes"));
quest.heroesAmounts.addAll(config.getDoubleList("quests." + s + ".rewards.heroes-exp-amounts")); quest.heroesAmounts.addAll(config.getDoubleList("quests." + s + ".rewards.heroes-exp-amounts"));
} else { } else {
printSevere("[Quests] heroes-exp-amounts: Reward in Quest " + quest.name + " is not a list of experience amounts (decimal numbers)!"); printSevere("[Quests] heroes-exp-amounts: Reward in Quest " + quest.name + " is not a list of experience amounts (decimal numbers)!");
continue; continue;
@ -4264,6 +4239,22 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
return null; return null;
} }
public Quest findQuest(String s) {
for(Quest q : quests) {
if(q.name.equalsIgnoreCase(s))
return q;
}
for(Quest q : quests) {
if(q.name.toLowerCase().contains(s.toLowerCase()))
return q;
}
return null;
}
public Event getEvent(String s) { public Event getEvent(String s) {
for (Event e : events) { for (Event e : events) {

View File

@ -1 +0,0 @@
Add Heroes class requirements to the RequirementsPrompt, saveQuest() and loadQuest() stages etc. etc.

View File

@ -1769,7 +1769,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
String text = GOLD + "- " + Lang.get("stageEditorDeliverItems") + " -\n"; String text = GOLD + "- " + Lang.get("stageEditorDeliverItems") + " -\n";
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) { if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
text += GRAY + " (" + Lang.get("noneSet") + ")\n"; text += GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorAddItem") + "\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += GRAY + "2 - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("stageEditorNoItemsSet") + ")\n"; text += GRAY + "2 - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("stageEditorNoItemsSet") + ")\n";
if (context.getSessionData(pref + CK.S_DELIVERY_MESSAGES) == null) { if (context.getSessionData(pref + CK.S_DELIVERY_MESSAGES) == null) {
text += BLUE + "3 - " + Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n"; text += BLUE + "3 - " + Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n";
@ -1792,7 +1792,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorAddItem") + "\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) == null) { if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("noneSet") + ")\n"; text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("noneSet") + ")\n";
@ -1956,7 +1956,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override @Override
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cmdCancel") == false) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(";"); String[] args = input.split(";");
LinkedList<String> messages = new LinkedList<String>(); LinkedList<String> messages = new LinkedList<String>();
@ -1976,7 +1976,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
return YELLOW + Lang.get("stageEditorNPCToTalkToPrompt"); questFactory.selectingNPCs.add((Player) context.getForWhom());
return YELLOW + Lang.get("stageEditorNPCToTalkToPrompt") + "\n" + GOLD + Lang.get("npcHint");
} }
@Override @Override
@ -2008,6 +2009,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
questFactory.selectingNPCs.remove((Player) context.getForWhom());
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs); context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs);
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -2016,6 +2018,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
return new CreateStagePrompt(stageNum, questFactory, citizens); return new CreateStagePrompt(stageNum, questFactory, citizens);
} }
@ -2073,13 +2076,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
protected Prompt acceptValidatedInput(ConversationContext context, String input) { protected Prompt acceptValidatedInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1")) { if (input.equalsIgnoreCase("1")) {
return new npcIdsToKillPrompt(); return new NpcIdsToKillPrompt();
} else if (input.equalsIgnoreCase("2")) { } else if (input.equalsIgnoreCase("2")) {
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) { if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoNPCs")); context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoNPCs"));
return new NPCKillListPrompt(); return new NPCKillListPrompt();
} else { } else {
return new npcAmountsToKillPrompt(); return new NpcAmountsToKillPrompt();
} }
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorKillNPCsCleared")); context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorKillNPCsCleared"));
@ -2123,12 +2126,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
private class npcIdsToKillPrompt extends StringPrompt { private class NpcIdsToKillPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
return YELLOW + Lang.get("stageEditorNPCPrompt"); questFactory.selectingNPCs.add((Player) context.getForWhom());
return YELLOW + Lang.get("stageEditorNPCPrompt") + "\n" + GOLD + Lang.get("npcHint");
} }
@Override @Override
@ -2148,13 +2152,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
npcs.add(i); npcs.add(i);
} else { } else {
context.getForWhom().sendRawMessage(PINK + "" + i + RED + " " + Lang.get("stageEditorInvalidNPC")); context.getForWhom().sendRawMessage(PINK + "" + i + RED + " " + Lang.get("stageEditorInvalidNPC"));
return new npcIdsToKillPrompt(); return new NpcIdsToKillPrompt();
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers"));
return new npcIdsToKillPrompt(); return new NpcIdsToKillPrompt();
} }
@ -2164,12 +2168,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
questFactory.selectingNPCs.remove((Player) context.getForWhom());
return new NPCKillListPrompt(); return new NPCKillListPrompt();
} }
} }
private class npcAmountsToKillPrompt extends StringPrompt { private class NpcAmountsToKillPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -2191,12 +2196,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
amounts.add(Integer.parseInt(s)); amounts.add(Integer.parseInt(s));
} else { } else {
context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorNotGreaterThanZero")); context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorNotGreaterThanZero"));
return new npcAmountsToKillPrompt(); return new NpcAmountsToKillPrompt();
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers"));
return new npcAmountsToKillPrompt(); return new NpcAmountsToKillPrompt();
} }
} }
@ -2295,7 +2300,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
text += DARKGRAY + "|--------------------------|"; text += DARKGRAY + "|--------------------------|\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("done");
@ -2486,7 +2491,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (Quests.getMobType(s) != null) { if (Quests.getMobType(s) != null) {
mobTypes.add(Quester.prettyMobString(Quests.getMobType(s))); mobTypes.add(s);
context.setSessionData(pref + CK.S_MOB_TYPES, mobTypes); context.setSessionData(pref + CK.S_MOB_TYPES, mobTypes);
} else { } else {

View File

@ -174,7 +174,7 @@ public class Lang {
en.put("stageEditorItemIDsPrompt", "Enter item IDs, separating each one by a space, or enter \'cancel\' to return."); en.put("stageEditorItemIDsPrompt", "Enter item IDs, separating each one by a space, or enter \'cancel\' to return.");
en.put("stageEditorNPCPrompt", "Enter NPC ids, separating each one by a space, or enter \'cancel\' to return."); en.put("stageEditorNPCPrompt", "Enter NPC ids, separating each one by a space, or enter \'cancel\' to return.");
en.put("stageEditorNPCToTalkToPrompt", "Enter NPC IDs, separating each one by a space, or enter \'clear\' to clear the NPC ID list, or \'cancel\' to return."); en.put("stageEditorNPCToTalkToPrompt", "Enter NPC IDs, separating each one by a space, or enter \'clear\' to clear the NPC ID list, or \'cancel\' to return.");
en.put("stageEditorDeliveryMessagesPrompt", "Enter delivery messages, separating each one by a \"semi-colon\" or enter \'cancel\' to return"); en.put("stageEditorDeliveryMessagesPrompt", "Enter delivery messages, separating each one by a semi-colon or enter \'cancel\' to return");
en.put("stageEditorKillNPCsPrompt", "Enter kill amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); en.put("stageEditorKillNPCsPrompt", "Enter kill amounts (numbers), separating each one by a space, or enter \'cancel\' to return.");
en.put("stageEditorMobsPrompt", "Enter mob names separating each one by a space, or enter \"cancel\" to return"); en.put("stageEditorMobsPrompt", "Enter mob names separating each one by a space, or enter \"cancel\" to return");
en.put("stageEditorMobAmountsPrompt", "Enter mob amounts separating each one by a space, or enter \"cancel\" to return"); en.put("stageEditorMobAmountsPrompt", "Enter mob amounts separating each one by a space, or enter \"cancel\" to return");
@ -482,6 +482,7 @@ public class Lang {
en.put("worlds", "Worlds"); en.put("worlds", "Worlds");
en.put("mobs", "Mobs"); en.put("mobs", "Mobs");
en.put("invalidOption", "Invalid option!"); en.put("invalidOption", "Invalid option!");
en.put("npcHint", "Note: You can left or right click on NPC's to get their ID.");
// //
// //