Expose quest ID when editing

This commit is contained in:
PikaMug 2020-01-30 01:23:35 -05:00
parent c6bbff9bab
commit 23e664365c
2 changed files with 10 additions and 6 deletions

View File

@ -239,7 +239,9 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
public String getTitle(ConversationContext context) { public String getTitle(ConversationContext context) {
return Lang.get("quest") + ": " + context.getSessionData(CK.Q_NAME); return Lang.get("quest") + ": " + context.getSessionData(CK.Q_NAME) + " " + ChatColor.GRAY
+ (context.getSessionData(CK.Q_ID) != null ? "(" + Lang.get("id") + ":"
+ context.getSessionData(CK.Q_ID) + ")": "");
} }
public ChatColor getNumberColor(ConversationContext context, int number) { public ChatColor getNumberColor(ConversationContext context, int number) {
@ -565,6 +567,7 @@ public class QuestFactory implements ConversationAbandonedListener {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void loadQuest(ConversationContext cc, Quest q) { public static void loadQuest(ConversationContext cc, Quest q) {
cc.setSessionData(CK.ED_QUEST_EDIT, q.getName()); cc.setSessionData(CK.ED_QUEST_EDIT, q.getName());
cc.setSessionData(CK.Q_ID, q.getId());
cc.setSessionData(CK.Q_NAME, q.getName()); cc.setSessionData(CK.Q_NAME, q.getName());
if (q.npcStart != null) { if (q.npcStart != null) {
cc.setSessionData(CK.Q_START_NPC, q.npcStart.getId()); cc.setSessionData(CK.Q_START_NPC, q.npcStart.getId());
@ -1333,7 +1336,7 @@ public class QuestFactory implements ConversationAbandonedListener {
public String getQueryText(ConversationContext context) { public String getQueryText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + ChatColor.AQUA return ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + ChatColor.AQUA
+ context.getSessionData(CK.Q_NAME) + ChatColor.YELLOW + "\"?\n"; + context.getSessionData(CK.Q_NAME) + ChatColor.YELLOW + "\"?";
} }
@Override @Override
@ -1342,7 +1345,7 @@ public class QuestFactory implements ConversationAbandonedListener {
= new QuestsEditorPostOpenSavePromptEvent(QuestFactory.this, context); = new QuestsEditorPostOpenSavePromptEvent(QuestFactory.this, context);
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
String text = getQueryText(context); String text = getQueryText(context) + "\n";
for (int i = 1; i <= size; i++) { for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + "\n"; + getSelectionText(context, i) + "\n";
@ -1428,7 +1431,7 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
public String getQueryText(ConversationContext context) { public String getQueryText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("confirmDelete") + "\n"; return ChatColor.YELLOW + Lang.get("confirmDelete");
} }
@Override @Override
@ -1437,7 +1440,7 @@ public class QuestFactory implements ConversationAbandonedListener {
= new QuestsEditorPostOpenExitPromptEvent(QuestFactory.this, context); = new QuestsEditorPostOpenExitPromptEvent(QuestFactory.this, context);
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
String text = getQueryText(context); String text = getQueryText(context) + "\n";
for (int i = 1; i <= size; i++) { for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + "\n"; + getSelectionText(context, i) + "\n";

View File

@ -19,6 +19,7 @@ public class CK {
public static final String ED_QUEST_DELETE = "delQuest"; public static final String ED_QUEST_DELETE = "delQuest";
public static final String ED_EVENT_DELETE = "delEvent"; public static final String ED_EVENT_DELETE = "delEvent";
// Quests // Quests
public static final String Q_ID = "questId";
public static final String Q_NAME = "questName"; public static final String Q_NAME = "questName";
public static final String Q_ASK_MESSAGE = "askMessage"; public static final String Q_ASK_MESSAGE = "askMessage";
public static final String Q_FINISH_MESSAGE = "finishMessage"; public static final String Q_FINISH_MESSAGE = "finishMessage";