Correct disclosure of objectives within stage categories, fixes #1126

This commit is contained in:
PikaMug 2020-03-19 00:24:34 -04:00
parent da24ff2bd0
commit 085bcd321d
2 changed files with 77 additions and 57 deletions

View File

@ -86,6 +86,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
public String getAdditionalText(ConversationContext context, int number) { public String getAdditionalText(ConversationContext context, int number) {
switch(number) { switch(number) {
case 1: case 1:
System.out.println("block= " + context.getSessionData(pref + CK.S_BREAK_NAMES));
if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) { if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else { } else {

View File

@ -220,6 +220,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
&& context.getSessionData(stagePrefix + CK.S_USE_NAMES) == null && context.getSessionData(stagePrefix + CK.S_USE_NAMES) == null
&& context.getSessionData(stagePrefix + CK.S_CUT_NAMES) == null) { && context.getSessionData(stagePrefix + CK.S_CUT_NAMES) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return "";
} }
case 2: case 2:
if (context.getSessionData(stagePrefix + CK.S_CRAFT_ITEMS) == null if (context.getSessionData(stagePrefix + CK.S_CRAFT_ITEMS) == null
@ -227,12 +229,16 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
&& context.getSessionData(stagePrefix + CK.S_ENCHANT_TYPES) == null && context.getSessionData(stagePrefix + CK.S_ENCHANT_TYPES) == null
&& context.getSessionData(stagePrefix + CK.S_BREW_ITEMS) == null) { && context.getSessionData(stagePrefix + CK.S_BREW_ITEMS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return "";
} }
case 3: case 3:
if (context.getSessionData(stagePrefix + CK.S_DELIVERY_NPCS) == null if (context.getSessionData(stagePrefix + CK.S_DELIVERY_NPCS) == null
&& context.getSessionData(stagePrefix + CK.S_NPCS_TO_TALK_TO) == null && context.getSessionData(stagePrefix + CK.S_NPCS_TO_TALK_TO) == null
&& context.getSessionData(stagePrefix + CK.S_NPCS_TO_KILL) == null) { && context.getSessionData(stagePrefix + CK.S_NPCS_TO_KILL) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return "";
} }
case 4: case 4:
if (context.getSessionData(stagePrefix + CK.S_MOB_TYPES) == null if (context.getSessionData(stagePrefix + CK.S_MOB_TYPES) == null
@ -240,6 +246,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
&& context.getSessionData(stagePrefix + CK.S_TAME_TYPES) == null && context.getSessionData(stagePrefix + CK.S_TAME_TYPES) == null
&& context.getSessionData(stagePrefix + CK.S_SHEAR_COLORS) == null) { && context.getSessionData(stagePrefix + CK.S_SHEAR_COLORS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return "";
} }
case 5: case 5:
if (context.getSessionData(stagePrefix + CK.S_PLAYER_KILL) == null) { if (context.getSessionData(stagePrefix + CK.S_PLAYER_KILL) == null) {
@ -301,6 +309,15 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
case 9: case 9:
if (!hasObjective) { if (!hasObjective) {
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")"; return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
} else if (context.getSessionData(stagePrefix + CK.S_START_EVENT) == null
&& context.getSessionData(stagePrefix + CK.S_FINISH_EVENT) == null
&& context.getSessionData(stagePrefix + CK.S_DEATH_EVENT) == null
&& context.getSessionData(stagePrefix + CK.S_DISCONNECT_EVENT) == null
&& context.getSessionData(stagePrefix + CK.S_CHAT_EVENTS) == null
&& context.getSessionData(stagePrefix + CK.S_COMMAND_EVENTS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return "";
} }
case 10: case 10:
if (!hasObjective) { if (!hasObjective) {
@ -314,7 +331,9 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
} }
} }
case 11: case 11:
if (context.getSessionData(stagePrefix + CK.S_DELAY) == null) { if (!hasObjective) {
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
} else if (context.getSessionData(stagePrefix + CK.S_DELAY) == null) {
return ChatColor.GRAY + "(" + Lang.get("noDelaySet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noDelaySet") + ")";
} else if (context.getSessionData(stagePrefix + CK.S_DELAY_MESSAGE) == null) { } else if (context.getSessionData(stagePrefix + CK.S_DELAY_MESSAGE) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
@ -418,7 +437,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
return new CustomObjectivesPrompt(); return new CustomObjectivesPrompt();
case 9: case 9:
if (hasObjective) { if (hasObjective) {
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
return new StageMainPrompt(stageNum, context); return new StageMainPrompt(stageNum, context);
@ -904,9 +923,9 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
} }
} }
private class EventListPrompt extends FixedSetPrompt { private class ActionListPrompt extends FixedSetPrompt {
public EventListPrompt() { public ActionListPrompt() {
super("1", "2", "3", "4", "5", "6", "7"); super("1", "2", "3", "4", "5", "6", "7");
} }
@ -985,26 +1004,26 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
@Override @Override
protected Prompt acceptValidatedInput(ConversationContext context, String input) { protected Prompt acceptValidatedInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1")) { if (input.equalsIgnoreCase("1")) {
return new StartEventPrompt(); return new StartActionPrompt();
} else if (input.equalsIgnoreCase("2")) { } else if (input.equalsIgnoreCase("2")) {
return new FinishEventPrompt(); return new FinishActionPrompt();
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
return new DeathEventPrompt(); return new DeathActionPrompt();
} else if (input.equalsIgnoreCase("4")) { } else if (input.equalsIgnoreCase("4")) {
return new DisconnectEventPrompt(); return new DisconnectActionPrompt();
} else if (input.equalsIgnoreCase("5")) { } else if (input.equalsIgnoreCase("5")) {
return new ChatEventPrompt(); return new ChatActionPrompt();
} else if (input.equalsIgnoreCase("6")) { } else if (input.equalsIgnoreCase("6")) {
return new CommandEventPrompt(); return new CommandActionPrompt();
} else if (input.equalsIgnoreCase("7")) { } else if (input.equalsIgnoreCase("7")) {
return new StageMainPrompt(stageNum, context); return new StageMainPrompt(stageNum, context);
} else { } else {
return new EventListPrompt(); return new ActionListPrompt();
} }
} }
} }
private class StartEventPrompt extends StringPrompt { private class StartActionPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -1034,24 +1053,24 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
if (found == null) { if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent")); + Lang.get("stageEditorInvalidEvent"));
return new StartEventPrompt(); return new StartActionPrompt();
} else { } else {
context.setSessionData(stagePrefix + CK.S_START_EVENT, found.getName()); context.setSessionData(stagePrefix + CK.S_START_EVENT, found.getName());
return new EventListPrompt(); return new ActionListPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt(); return new ActionListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(stagePrefix + CK.S_START_EVENT, null); context.setSessionData(stagePrefix + CK.S_START_EVENT, null);
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorStartEventCleared")); player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorStartEventCleared"));
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
return new StartEventPrompt(); return new StartActionPrompt();
} }
} }
} }
private class FinishEventPrompt extends StringPrompt { private class FinishActionPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -1081,24 +1100,24 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
if (found == null) { if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent")); + Lang.get("stageEditorInvalidEvent"));
return new FinishEventPrompt(); return new FinishActionPrompt();
} else { } else {
context.setSessionData(stagePrefix + CK.S_FINISH_EVENT, found.getName()); context.setSessionData(stagePrefix + CK.S_FINISH_EVENT, found.getName());
return new EventListPrompt(); return new ActionListPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt(); return new ActionListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(stagePrefix + CK.S_FINISH_EVENT, null); context.setSessionData(stagePrefix + CK.S_FINISH_EVENT, null);
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorFinishEventCleared")); player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorFinishEventCleared"));
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
return new FinishEventPrompt(); return new FinishActionPrompt();
} }
} }
} }
private class DeathEventPrompt extends StringPrompt { private class DeathActionPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -1128,24 +1147,24 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
if (found == null) { if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent")); + Lang.get("stageEditorInvalidEvent"));
return new DeathEventPrompt(); return new DeathActionPrompt();
} else { } else {
context.setSessionData(stagePrefix + CK.S_DEATH_EVENT, found.getName()); context.setSessionData(stagePrefix + CK.S_DEATH_EVENT, found.getName());
return new EventListPrompt(); return new ActionListPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt(); return new ActionListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(stagePrefix + CK.S_DEATH_EVENT, null); context.setSessionData(stagePrefix + CK.S_DEATH_EVENT, null);
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDeathEventCleared")); player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDeathEventCleared"));
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
return new DeathEventPrompt(); return new DeathActionPrompt();
} }
} }
} }
private class DisconnectEventPrompt extends StringPrompt { private class DisconnectActionPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -1175,24 +1194,24 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
if (found == null) { if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent")); + Lang.get("stageEditorInvalidEvent"));
return new DisconnectEventPrompt(); return new DisconnectActionPrompt();
} else { } else {
context.setSessionData(stagePrefix + CK.S_DISCONNECT_EVENT, found.getName()); context.setSessionData(stagePrefix + CK.S_DISCONNECT_EVENT, found.getName());
return new EventListPrompt(); return new ActionListPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt(); return new ActionListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(stagePrefix + CK.S_DISCONNECT_EVENT, null); context.setSessionData(stagePrefix + CK.S_DISCONNECT_EVENT, null);
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDisconnectEventCleared")); player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDisconnectEventCleared"));
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
return new DisconnectEventPrompt(); return new DisconnectActionPrompt();
} }
} }
} }
private class ChatEventPrompt extends StringPrompt { private class ChatActionPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -1222,25 +1241,25 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
if (found == null) { if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent")); + Lang.get("stageEditorInvalidEvent"));
return new ChatEventPrompt(); return new ChatActionPrompt();
} else { } else {
context.setSessionData(stagePrefix + CK.S_CHAT_TEMP_EVENT, found.getName()); context.setSessionData(stagePrefix + CK.S_CHAT_TEMP_EVENT, found.getName());
return new ChatEventTriggerPrompt(); return new ChatActionTriggerPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt(); return new ActionListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(stagePrefix + CK.S_CHAT_EVENTS, null); context.setSessionData(stagePrefix + CK.S_CHAT_EVENTS, null);
context.setSessionData(stagePrefix + CK.S_CHAT_EVENT_TRIGGERS, null); context.setSessionData(stagePrefix + CK.S_CHAT_EVENT_TRIGGERS, null);
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorChatEventsCleared")); player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorChatEventsCleared"));
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
return new ChatEventPrompt(); return new ChatActionPrompt();
} }
} }
} }
private class ChatEventTriggerPrompt extends StringPrompt { private class ChatActionTriggerPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -1264,7 +1283,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
chatEventTriggers.add(input.trim()); chatEventTriggers.add(input.trim());
context.setSessionData(stagePrefix + CK.S_CHAT_EVENTS, chatEvents); context.setSessionData(stagePrefix + CK.S_CHAT_EVENTS, chatEvents);
context.setSessionData(stagePrefix + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers); context.setSessionData(stagePrefix + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
LinkedList<String> chatEvents LinkedList<String> chatEvents
= (LinkedList<String>) context.getSessionData(stagePrefix + CK.S_CHAT_EVENTS); = (LinkedList<String>) context.getSessionData(stagePrefix + CK.S_CHAT_EVENTS);
@ -1275,17 +1294,17 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
chatEventTriggers.add(input.trim()); chatEventTriggers.add(input.trim());
context.setSessionData(stagePrefix + CK.S_CHAT_EVENTS, chatEvents); context.setSessionData(stagePrefix + CK.S_CHAT_EVENTS, chatEvents);
context.setSessionData(stagePrefix + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers); context.setSessionData(stagePrefix + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
return new EventListPrompt(); return new ActionListPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
return new ChatEventTriggerPrompt(); return new ChatActionTriggerPrompt();
} }
} }
} }
private class CommandEventPrompt extends StringPrompt { private class CommandActionPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -1315,25 +1334,25 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
if (found == null) { if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent")); + Lang.get("stageEditorInvalidEvent"));
return new CommandEventPrompt(); return new CommandActionPrompt();
} else { } else {
context.setSessionData(stagePrefix + CK.S_COMMAND_TEMP_EVENT, found.getName()); context.setSessionData(stagePrefix + CK.S_COMMAND_TEMP_EVENT, found.getName());
return new CommandEventTriggerPrompt(); return new CommandActionTriggerPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt(); return new ActionListPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENTS, null); context.setSessionData(stagePrefix + CK.S_COMMAND_EVENTS, null);
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENT_TRIGGERS, null); context.setSessionData(stagePrefix + CK.S_COMMAND_EVENT_TRIGGERS, null);
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorCommandEventsCleared")); player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorCommandEventsCleared"));
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
return new CommandEventPrompt(); return new CommandActionPrompt();
} }
} }
} }
private class CommandEventTriggerPrompt extends StringPrompt { private class CommandActionTriggerPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -1357,7 +1376,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
commandEventTriggers.add(input.trim()); commandEventTriggers.add(input.trim());
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENTS, commandEvents); context.setSessionData(stagePrefix + CK.S_COMMAND_EVENTS, commandEvents);
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers); context.setSessionData(stagePrefix + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers);
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
LinkedList<String> commandEvents LinkedList<String> commandEvents
= (LinkedList<String>) context.getSessionData(stagePrefix + CK.S_COMMAND_EVENTS); = (LinkedList<String>) context.getSessionData(stagePrefix + CK.S_COMMAND_EVENTS);
@ -1368,12 +1387,12 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
commandEventTriggers.add(input.trim()); commandEventTriggers.add(input.trim());
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENTS, commandEvents); context.setSessionData(stagePrefix + CK.S_COMMAND_EVENTS, commandEvents);
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers); context.setSessionData(stagePrefix + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers);
return new EventListPrompt(); return new ActionListPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new EventListPrompt(); return new ActionListPrompt();
} else { } else {
return new CommandEventTriggerPrompt(); return new CommandActionTriggerPrompt();
} }
} }
} }