mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 20:25:45 +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){
|
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;
|
none = null;
|
||||||
}else if(moneyReward == 1){
|
}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;
|
none = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,11 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
ConversationFactory convoCreator;
|
ConversationFactory convoCreator;
|
||||||
static final ChatColor BOLD = ChatColor.BOLD;
|
static final ChatColor BOLD = ChatColor.BOLD;
|
||||||
static final ChatColor AQUA = ChatColor.AQUA;
|
static final ChatColor AQUA = ChatColor.AQUA;
|
||||||
|
static final ChatColor DARKAQUA = ChatColor.DARK_AQUA;
|
||||||
static final ChatColor BLUE = ChatColor.BLUE;
|
static final ChatColor BLUE = ChatColor.BLUE;
|
||||||
static final ChatColor GOLD = ChatColor.GOLD;
|
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 RED = ChatColor.RED;
|
||||||
static final ChatColor DARKRED = ChatColor.DARK_RED;
|
static final ChatColor DARKRED = ChatColor.DARK_RED;
|
||||||
static final ChatColor YELLOW = ChatColor.YELLOW;
|
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;
|
return text;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -172,6 +193,18 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
return new RedoDelayPrompt();
|
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;
|
return null;
|
||||||
@ -239,14 +272,42 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if(quests.citizens.getNPCRegistry().getById(input.intValue()) == null){
|
if(quests.citizens.getNPCRegistry().getById(input.intValue()) == null){
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!");
|
context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!");
|
||||||
return new SetNpcStartPrompt();
|
return new SetNpcStartPrompt();
|
||||||
}else{
|
|
||||||
context.setSessionData("")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
context.setSessionData("npcStart", input);
|
||||||
return new CreateMenuPrompt();
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
return new CreateMenuPrompt();
|
||||||
|
|
||||||
|
@ -400,15 +400,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (economy.getBalance(quester.name) >= quest.moneyReq) {
|
if (economy.getBalance(quester.name) >= quest.moneyReq) {
|
||||||
if (quest.moneyReq == 1) {
|
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 {
|
} else {
|
||||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + economy.currencyNamePlural());
|
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + Quests.getCurrency(true));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (quest.moneyReq == 1) {
|
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 {
|
} 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) {
|
public static boolean removeItem(Inventory inventory, Material type, int amount) {
|
||||||
|
|
||||||
HashMap<Integer, ? extends ItemStack> allItems = inventory.all(type);
|
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