mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Finished base Quest creation, doing Requirement setting
This commit is contained in:
parent
64bf6ca6ff
commit
9ce12999c4
@ -234,10 +234,10 @@ public class Quest {
|
||||
}
|
||||
|
||||
if(moneyReward > 1){
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.economy.currencyNamePlural());
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(true));
|
||||
none = null;
|
||||
}else if(moneyReward == 1){
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.economy.currencyNameSingular());
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(false));
|
||||
none = null;
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,11 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
ConversationFactory convoCreator;
|
||||
static final ChatColor BOLD = ChatColor.BOLD;
|
||||
static final ChatColor AQUA = ChatColor.AQUA;
|
||||
static final ChatColor DARKAQUA = ChatColor.DARK_AQUA;
|
||||
static final ChatColor BLUE = ChatColor.BLUE;
|
||||
static final ChatColor GOLD = ChatColor.GOLD;
|
||||
static final ChatColor PINK = ChatColor.LIGHT_PURPLE;
|
||||
static final ChatColor GREEN = ChatColor.GREEN;
|
||||
static final ChatColor RED = ChatColor.RED;
|
||||
static final ChatColor DARKRED = ChatColor.DARK_RED;
|
||||
static final ChatColor YELLOW = ChatColor.YELLOW;
|
||||
@ -149,6 +152,24 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
|
||||
}
|
||||
|
||||
if(quests.citizens != null){
|
||||
text += BLUE + "" + BOLD + "7" + RESET + DARKAQUA + " - Edit Requirements";
|
||||
}else{
|
||||
text += BLUE + "" + BOLD + "6" + RESET + DARKAQUA + " - Edit Requirements";
|
||||
}
|
||||
|
||||
if(quests.citizens != null){
|
||||
text += BLUE + "" + BOLD + "8" + RESET + PINK + " - Edit Stages";
|
||||
}else{
|
||||
text += BLUE + "" + BOLD + "7" + RESET + PINK + " - Edit Stages";
|
||||
}
|
||||
|
||||
if(quests.citizens != null){
|
||||
text += BLUE + "" + BOLD + "9" + RESET + GREEN + " - Edit Rewards";
|
||||
}else{
|
||||
text += BLUE + "" + BOLD + "8" + RESET + GREEN + " - Edit Rewards";
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
@ -172,6 +193,18 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
|
||||
return new RedoDelayPrompt();
|
||||
|
||||
}else if(input.equalsIgnoreCase("5")){
|
||||
|
||||
if(quests.citizens != null){
|
||||
return new SetNpcStartPrompt();
|
||||
}else{
|
||||
return new BlockStartPrompt();
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("6")){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -239,14 +272,42 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if(quests.citizens.getNPCRegistry().getById(input.intValue()) == null){
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!");
|
||||
return new SetNpcStartPrompt();
|
||||
}else{
|
||||
context.setSessionData("")
|
||||
}
|
||||
|
||||
}else{
|
||||
return new CreateMenuPrompt();
|
||||
context.setSessionData("npcStart", input);
|
||||
|
||||
}
|
||||
|
||||
return new CreateMenuPrompt();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class BlockStartPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context){
|
||||
|
||||
return ChatColor.YELLOW + "Enter location, in the format \"WorldName x y z\", or \"cancel\" to return";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input){
|
||||
|
||||
if(input.equalsIgnoreCase("input") == false){
|
||||
|
||||
if(Quests.getLocation(input) == null){
|
||||
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + "Invalid location.");
|
||||
return new BlockStartPrompt();
|
||||
|
||||
}
|
||||
|
||||
context.setSessionData("blockStart", Quests.getLocation(input));
|
||||
|
||||
}
|
||||
context.setSessionData("questName", input);
|
||||
|
||||
return new CreateMenuPrompt();
|
||||
|
||||
|
@ -400,15 +400,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
|
||||
if (economy.getBalance(quester.name) >= quest.moneyReq) {
|
||||
if (quest.moneyReq == 1) {
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + economy.currencyNameSingular());
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + Quests.getCurrency(false));
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + economy.currencyNamePlural());
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + Quests.getCurrency(true));
|
||||
}
|
||||
} else {
|
||||
if (quest.moneyReq == 1) {
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + quest.moneyReq + " " + economy.currencyNameSingular());
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + quest.moneyReq + " " + Quests.getCurrency(false));
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + quest.moneyReq + " " + economy.currencyNamePlural());
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + quest.moneyReq + " " + Quests.getCurrency(true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3490,6 +3490,22 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
|
||||
}
|
||||
|
||||
public static String getCurrency(boolean plural){
|
||||
|
||||
if(plural){
|
||||
if(Quests.economy.currencyNamePlural().trim().isEmpty())
|
||||
return "Money";
|
||||
else
|
||||
return Quests.economy.currencyNamePlural();
|
||||
}else{
|
||||
if(Quests.economy.currencyNameSingular().trim().isEmpty())
|
||||
return "Money";
|
||||
else
|
||||
return Quests.economy.currencyNameSingular();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean removeItem(Inventory inventory, Material type, int amount) {
|
||||
|
||||
HashMap<Integer, ? extends ItemStack> allItems = inventory.all(type);
|
||||
|
50
src/me/blackvein/quests/prompts/RequirementPrompt.java
Normal file
50
src/me/blackvein/quests/prompts/RequirementPrompt.java
Normal file
@ -0,0 +1,50 @@
|
||||
package me.blackvein.quests.prompts;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.FixedSetPrompt;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
|
||||
public class RequirementPrompt extends FixedSetPrompt{
|
||||
|
||||
static final ChatColor BOLD = ChatColor.BOLD;
|
||||
static final ChatColor AQUA = ChatColor.AQUA;
|
||||
static final ChatColor DARKAQUA = ChatColor.DARK_AQUA;
|
||||
static final ChatColor BLUE = ChatColor.BLUE;
|
||||
static final ChatColor GOLD = ChatColor.GOLD;
|
||||
static final ChatColor PINK = ChatColor.LIGHT_PURPLE;
|
||||
static final ChatColor GREEN = ChatColor.GREEN;
|
||||
static final ChatColor RED = ChatColor.RED;
|
||||
static final ChatColor DARKRED = ChatColor.DARK_RED;
|
||||
static final ChatColor YELLOW = ChatColor.YELLOW;
|
||||
static final ChatColor RESET = ChatColor.RESET;
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context){
|
||||
|
||||
String text;
|
||||
|
||||
text = DARKAQUA + "- " + AQUA + context.getSessionData("questName") + AQUA + " | Requirements -\n";
|
||||
|
||||
if(context.getSessionData("moneyReq") == null)
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money requirement (None set)\n";
|
||||
else{
|
||||
int moneyReq = (Integer) context.getSessionData("moneyReq");
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money requirement (" + context.getSessionData("moneyReq") + " " + (moneyReq > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + " )\n";
|
||||
}
|
||||
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input){
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user