mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 02:25:42 +01:00
Continuing
This commit is contained in:
parent
9cbe3663bf
commit
be51074332
@ -150,7 +150,7 @@ public abstract class CustomObjective implements Listener {
|
||||
if(index > -1){
|
||||
|
||||
if(quester.customObjectiveCounts.get(obj.getName()) >= quester.currentStage.customObjectiveCounts.get(index)){
|
||||
quester.finishObjective("customObj", null, null, null, null, null, null, null, null, obj);
|
||||
quester.finishObjective("customObj", null, null, null, null, null, null, null, null, null, obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -192,6 +192,12 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (quester.hasObjective("password")) {
|
||||
|
||||
quester.sayPass(evt.getMessage());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ public class Quester {
|
||||
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
|
||||
Map<EntityType, Integer> mobsTamed = new EnumMap<EntityType, Integer>(EntityType.class);
|
||||
Map<DyeColor, Integer> sheepSheared = new EnumMap<DyeColor, Integer>(DyeColor.class);
|
||||
Map<String, Boolean> passwordsSaid = new HashMap<String, Boolean>();
|
||||
public Map<String, Integer> customObjectiveCounts = new HashMap<String, Integer>();
|
||||
public Map<String, Boolean> eventFired = new HashMap<String, Boolean>();
|
||||
final Random random = new Random();
|
||||
@ -151,6 +152,11 @@ public class Quester {
|
||||
LinkedList<String> finishedObjectives = new LinkedList<String>();
|
||||
LinkedList<String> objectives = new LinkedList<String>();
|
||||
|
||||
if (currentStage.objectiveOverride != null) {
|
||||
objectives.add(ChatColor.GREEN + currentStage.objectiveOverride);
|
||||
return objectives;
|
||||
}
|
||||
|
||||
for (Entry<Material, Integer> e : currentStage.blocksToDamage.entrySet()) {
|
||||
|
||||
for (Entry<Material, Integer> e2 : blocksDamaged.entrySet()) {
|
||||
@ -504,37 +510,50 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
for (String s : currentStage.passwordPhrases) {
|
||||
|
||||
if (passwordsSaid.get(s) == false) {
|
||||
|
||||
unfinishedObjectives.add(ChatColor.GREEN + currentStage.passwordDisplays.get(currentStage.passwordPhrases.indexOf(s)));
|
||||
|
||||
} else {
|
||||
|
||||
finishedObjectives.add(ChatColor.GRAY + currentStage.passwordDisplays.get(currentStage.passwordPhrases.indexOf(s)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (CustomObjective co : currentStage.customObjectives) {
|
||||
|
||||
for (Entry<String, Integer> entry : customObjectiveCounts.entrySet()) {
|
||||
|
||||
|
||||
if (co.getName().equals(entry.getKey())) {
|
||||
|
||||
|
||||
String display = co.getDisplay();
|
||||
|
||||
|
||||
Map<String, Object> datamap = currentStage.customObjectiveData.get(index);
|
||||
for(String key : co.datamap.keySet()){
|
||||
for (String key : co.datamap.keySet()) {
|
||||
display = display.replaceAll("%" + ((String) key) + "%", ((String) datamap.get(key)));
|
||||
}
|
||||
|
||||
|
||||
if (entry.getValue() < currentStage.customObjectiveCounts.get(index)){
|
||||
if(co.isCountShown() && co.isEnableCount()){
|
||||
|
||||
if (entry.getValue() < currentStage.customObjectiveCounts.get(index)) {
|
||||
if (co.isCountShown() && co.isEnableCount()) {
|
||||
display = display.replaceAll("%count%", entry.getValue() + "/" + currentStage.customObjectiveCounts.get(index));
|
||||
}
|
||||
unfinishedObjectives.add(ChatColor.GREEN + display);
|
||||
}else{
|
||||
if(co.isCountShown() && co.isEnableCount()){
|
||||
unfinishedObjectives.add(ChatColor.GREEN + display);
|
||||
} else {
|
||||
if (co.isCountShown() && co.isEnableCount()) {
|
||||
display = display.replaceAll("%count%", currentStage.customObjectiveCounts.get(index) + "/" + currentStage.customObjectiveCounts.get(index));
|
||||
}
|
||||
finishedObjectives.add(ChatColor.GRAY + display);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
@ -597,35 +616,38 @@ public class Quester {
|
||||
} else if (s.equalsIgnoreCase("craftItem")) {
|
||||
return !currentStage.itemsToCraft.isEmpty();
|
||||
|
||||
} else if (s.equalsIgnoreCase("password")) {
|
||||
return !currentStage.passwordPhrases.isEmpty();
|
||||
|
||||
} else {
|
||||
return !currentStage.locationsToReach.isEmpty();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean hasCustomObjective(String s){
|
||||
|
||||
if(customObjectiveCounts.containsKey(s)){
|
||||
|
||||
|
||||
public boolean hasCustomObjective(String s) {
|
||||
|
||||
if (customObjectiveCounts.containsKey(s)) {
|
||||
|
||||
int count = customObjectiveCounts.get(s);
|
||||
|
||||
|
||||
int index = -1;
|
||||
for(int i = 0; i < currentStage.customObjectives.size(); i++){
|
||||
if(currentStage.customObjectives.get(i).getName().equals(s)){
|
||||
for (int i = 0; i < currentStage.customObjectives.size(); i++) {
|
||||
if (currentStage.customObjectives.get(i).getName().equals(s)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int count2 = currentStage.customObjectiveCounts.get(index);
|
||||
|
||||
|
||||
return count <= count2;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void damageBlock(Material m) {
|
||||
@ -637,7 +659,7 @@ public class Quester {
|
||||
blocksDamaged.put(m, (i + 1));
|
||||
|
||||
if (blocksDamaged.get(m).equals(currentStage.blocksToDamage.get(m))) {
|
||||
finishObjective("damageBlock", m, null, null, null, null, null, null, null, null);
|
||||
finishObjective("damageBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -655,7 +677,7 @@ public class Quester {
|
||||
blocksBroken.put(m, (i + 1));
|
||||
|
||||
if (blocksBroken.get(m).equals(currentStage.blocksToBreak.get(m))) {
|
||||
finishObjective("breakBlock", m, null, null, null, null, null, null, null, null);
|
||||
finishObjective("breakBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -672,7 +694,7 @@ public class Quester {
|
||||
blocksPlaced.put(m, (i + 1));
|
||||
|
||||
if (blocksPlaced.get(m).equals(currentStage.blocksToPlace.get(m))) {
|
||||
finishObjective("placeBlock", m, null, null, null, null, null, null, null, null);
|
||||
finishObjective("placeBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -689,7 +711,7 @@ public class Quester {
|
||||
blocksUsed.put(m, (i + 1));
|
||||
|
||||
if (blocksUsed.get(m).equals(currentStage.blocksToUse.get(m))) {
|
||||
finishObjective("useBlock", m, null, null, null, null, null, null, null, null);
|
||||
finishObjective("useBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -707,7 +729,7 @@ public class Quester {
|
||||
blocksCut.put(m, (i + 1));
|
||||
|
||||
if (blocksCut.get(m).equals(currentStage.blocksToCut.get(m))) {
|
||||
finishObjective("cutBlock", m, null, null, null, null, null, null, null, null);
|
||||
finishObjective("cutBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -722,7 +744,7 @@ public class Quester {
|
||||
fishCaught++;
|
||||
|
||||
if (((Integer) fishCaught).equals(currentStage.fishToCatch)) {
|
||||
finishObjective("catchFish", null, null, null, null, null, null, null, null, null);
|
||||
finishObjective("catchFish", null, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -745,7 +767,7 @@ public class Quester {
|
||||
itemsEnchanted.put(entry.getKey(), num);
|
||||
|
||||
if (num.equals(entry2.getValue())) {
|
||||
finishObjective("enchantItem", m, null, e, null, null, null, null, null, null);
|
||||
finishObjective("enchantItem", m, null, e, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -786,7 +808,7 @@ public class Quester {
|
||||
mobNumKilled.set(index, numKilledInteger);
|
||||
|
||||
if ((numKilledInteger).equals(currentStage.mobNumToKill.get(index))) {
|
||||
finishObjective("killMob", null, null, null, e, null, null, null, null, null);
|
||||
finishObjective("killMob", null, null, null, e, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -804,7 +826,7 @@ public class Quester {
|
||||
mobNumKilled.set(mobsKilled.indexOf(e), mobNumKilled.get(mobsKilled.indexOf(e)) + 1);
|
||||
|
||||
if ((mobNumKilled.get(mobsKilled.indexOf(e))).equals(currentStage.mobNumToKill.get(mobsKilled.indexOf(e)))) {
|
||||
finishObjective("killMob", null, null, null, e, null, null, null, null, null);
|
||||
finishObjective("killMob", null, null, null, e, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -838,7 +860,7 @@ public class Quester {
|
||||
playersKilled++;
|
||||
|
||||
if (((Integer) playersKilled).equals(currentStage.playersToKill)) {
|
||||
finishObjective("killPlayer", null, null, null, null, null, null, null, null, null);
|
||||
finishObjective("killPlayer", null, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -851,7 +873,7 @@ public class Quester {
|
||||
|
||||
if (citizensInteracted.get(n.getId()) == false) {
|
||||
citizensInteracted.put(n.getId(), true);
|
||||
finishObjective("talkToNPC", null, null, null, null, null, n, null, null, null);
|
||||
finishObjective("talkToNPC", null, null, null, null, null, n, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -866,7 +888,7 @@ public class Quester {
|
||||
if (citizenNumKilled.get(index) < currentStage.citizenNumToKill.get(index)) {
|
||||
citizenNumKilled.set(index, citizenNumKilled.get(index) + 1);
|
||||
if (citizenNumKilled.get(index) == currentStage.citizenNumToKill.get(index)) {
|
||||
finishObjective("killNPC", null, null, null, null, null, n, null, null, null);
|
||||
finishObjective("killNPC", null, null, null, null, null, n, null, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -890,7 +912,7 @@ public class Quester {
|
||||
if (hasReached.get(index) == false) {
|
||||
|
||||
hasReached.set(index, true);
|
||||
finishObjective("reachLocation", null, null, null, null, null, null, location, null, null);
|
||||
finishObjective("reachLocation", null, null, null, null, null, null, location, null, null, null);
|
||||
|
||||
}
|
||||
|
||||
@ -911,7 +933,7 @@ public class Quester {
|
||||
mobsTamed.put(entity, (mobsTamed.get(entity) + 1));
|
||||
|
||||
if (mobsTamed.get(entity).equals(currentStage.mobsToTame.get(entity))) {
|
||||
finishObjective("tameMob", null, null, null, entity, null, null, null, null, null);
|
||||
finishObjective("tameMob", null, null, null, entity, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -925,7 +947,7 @@ public class Quester {
|
||||
sheepSheared.put(color, (sheepSheared.get(color) + 1));
|
||||
|
||||
if (sheepSheared.get(color).equals(currentStage.sheepToShear.get(color))) {
|
||||
finishObjective("shearSheep", null, null, null, null, null, null, null, color, null);
|
||||
finishObjective("shearSheep", null, null, null, null, null, null, null, color, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -960,14 +982,14 @@ public class Quester {
|
||||
i.setAmount(i.getAmount() - (req - amount)); //Take away the remaining amount needed to be delivered from the item stack
|
||||
player.getInventory().setItem(index, i);
|
||||
player.updateInventory();
|
||||
finishObjective("deliverItem", null, found, null, null, null, null, null, null, null);
|
||||
finishObjective("deliverItem", null, found, null, null, null, null, null, null, null, null);
|
||||
|
||||
} else if ((i.getAmount() + amount) == req) {
|
||||
|
||||
itemsDelivered.put(found, req);
|
||||
player.getInventory().setItem(player.getInventory().first(i), null);
|
||||
player.updateInventory();
|
||||
finishObjective("deliverItem", null, found, null, null, null, null, null, null, null);
|
||||
finishObjective("deliverItem", null, found, null, null, null, null, null, null, null, null);
|
||||
|
||||
} else {
|
||||
|
||||
@ -985,11 +1007,46 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
public void finishObjective(String objective, Material material, ItemStack itemstack, Enchantment enchantment, EntityType mob, String player, NPC npc, Location location, DyeColor color, CustomObjective co) {
|
||||
public void sayPass(String s) {
|
||||
|
||||
for (String pass : currentStage.passwordPhrases) {
|
||||
|
||||
if (pass.equalsIgnoreCase(s)) {
|
||||
|
||||
String display = currentStage.passwordDisplays.get(currentStage.passwordPhrases.indexOf(pass));
|
||||
passwordsSaid.put(pass, true);
|
||||
finishObjective("password", null, null, null, null, null, null, null, null, display, null);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void finishObjective(String objective, Material material, ItemStack itemstack, Enchantment enchantment, EntityType mob, String player, NPC npc, Location location, DyeColor color, String pass, CustomObjective co) {
|
||||
|
||||
Player p = plugin.getServer().getPlayerExact(name);
|
||||
|
||||
if (objective.equalsIgnoreCase("damageBlock")) {
|
||||
if (currentStage.objectiveOverride != null) {
|
||||
|
||||
if (testComplete()) {
|
||||
String message = ChatColor.GREEN + "(Completed) " + currentStage.objectiveOverride;
|
||||
p.sendMessage(message);
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (objective.equalsIgnoreCase("password")) {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) " + pass;
|
||||
p.sendMessage(message);
|
||||
if (testComplete()) {
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
|
||||
} else if (objective.equalsIgnoreCase("damageBlock")) {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) Damage " + prettyItemString(material.getId());
|
||||
message = message + " " + currentStage.blocksToDamage.get(material) + "/" + currentStage.blocksToDamage.get(material);
|
||||
@ -1132,29 +1189,30 @@ public class Quester {
|
||||
}
|
||||
|
||||
} else if (co != null) {
|
||||
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) " + co.getDisplay();
|
||||
|
||||
|
||||
int index = -1;
|
||||
for(int i = 0; i < currentStage.customObjectives.size(); i++){
|
||||
if(currentStage.customObjectives.get(i).getName().equals(co.getName())){
|
||||
for (int i = 0; i < currentStage.customObjectives.size(); i++) {
|
||||
if (currentStage.customObjectives.get(i).getName().equals(co.getName())) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> datamap = currentStage.customObjectiveData.get(index);
|
||||
for(String key : co.datamap.keySet()){
|
||||
for (String key : co.datamap.keySet()) {
|
||||
message = message.replaceAll("%" + ((String) key) + "%", (String) datamap.get(key));
|
||||
}
|
||||
|
||||
if(co.isCountShown() && co.isEnableCount())
|
||||
|
||||
if (co.isCountShown() && co.isEnableCount()) {
|
||||
message = message.replaceAll("%count%", currentStage.customObjectiveCounts.get(index) + "/" + currentStage.customObjectiveCounts.get(index));
|
||||
}
|
||||
p.sendMessage(message);
|
||||
if (testComplete()) {
|
||||
currentQuest.nextStage(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1300,9 +1358,15 @@ public class Quester {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (currentStage.passwordPhrases.isEmpty() == false) {
|
||||
for (String pass : currentStage.passwordPhrases) {
|
||||
passwordsSaid.put(pass, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentStage.customObjectives.isEmpty() == false) {
|
||||
for(CustomObjective co : currentStage.customObjectives){
|
||||
for (CustomObjective co : currentStage.customObjectives) {
|
||||
customObjectiveCounts.put(co.getName(), 0);
|
||||
}
|
||||
}
|
||||
@ -1910,22 +1974,39 @@ public class Quester {
|
||||
data.set("sheep-sheared", shearAmounts);
|
||||
|
||||
}
|
||||
|
||||
if (customObjectiveCounts.isEmpty() == false){
|
||||
|
||||
|
||||
if (passwordsSaid.isEmpty() == false) {
|
||||
|
||||
LinkedList<String> passwords = new LinkedList<String>();
|
||||
LinkedList<Boolean> said = new LinkedList<Boolean>();
|
||||
|
||||
for (Entry<String, Boolean> entry : passwordsSaid.entrySet()) {
|
||||
|
||||
passwords.add(entry.getKey());
|
||||
said.add(entry.getValue());
|
||||
|
||||
}
|
||||
|
||||
data.set("passwords", passwords);
|
||||
data.set("passwords-said", said);
|
||||
|
||||
}
|
||||
|
||||
if (customObjectiveCounts.isEmpty() == false) {
|
||||
|
||||
LinkedList<String> customObj = new LinkedList<String>();
|
||||
LinkedList<Integer> customObjCounts = new LinkedList<Integer>();
|
||||
|
||||
for(Entry<String, Integer> entry : customObjectiveCounts.entrySet()){
|
||||
|
||||
|
||||
for (Entry<String, Integer> entry : customObjectiveCounts.entrySet()) {
|
||||
|
||||
customObj.add(entry.getKey());
|
||||
customObjCounts.add(entry.getValue());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
data.set("custom-objectives", customObj);
|
||||
data.set("custom-objective-counts", customObjCounts);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (delayTimeLeft > 0) {
|
||||
@ -1948,7 +2029,7 @@ public class Quester {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
data.set("currentQuest", "none");
|
||||
@ -2564,18 +2645,28 @@ public class Quester {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.contains("custom-objectives")){
|
||||
|
||||
List<String> customObj = data.getStringList("custom-objectives");
|
||||
List<Integer> customObjCount = data.getIntegerList("custom-objective-counts");
|
||||
|
||||
for(int i = 0; i < customObj.size(); i++){
|
||||
customObjectiveCounts.put(customObj.get(i), customObjCount.get(i));
|
||||
|
||||
if (data.contains("passwords")) {
|
||||
|
||||
List<String> passwords = data.getStringList("passwords");
|
||||
List<Boolean> said = data.getBooleanList("passwords-said");
|
||||
for(int i = 0; i < passwords.size(); i++){
|
||||
passwordsSaid.put(passwords.get(i), said.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.contains("custom-objectives")) {
|
||||
|
||||
List<String> customObj = data.getStringList("custom-objectives");
|
||||
List<Integer> customObjCount = data.getIntegerList("custom-objective-counts");
|
||||
|
||||
for (int i = 0; i < customObj.size(); i++) {
|
||||
customObjectiveCounts.put(customObj.get(i), customObjCount.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.contains("stage-delay")) {
|
||||
|
||||
delayTimeLeft = data.getLong("stage-delay");
|
||||
|
@ -3267,6 +3267,32 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".password-displays")) {
|
||||
|
||||
List<String> displays = config.getStringList("quests." + s + ".stages.ordered." + s2 + ".password-displays");
|
||||
|
||||
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".password-phrases")) {
|
||||
|
||||
List<String> phrases = config.getStringList("quests." + s + ".stages.ordered." + s2 + ".password-phrases");
|
||||
if(displays.size() == phrases.size()) {
|
||||
|
||||
oStage.passwordDisplays.addAll(displays);
|
||||
oStage.passwordPhrases.addAll(phrases);
|
||||
|
||||
} else {
|
||||
printSevere("[Quests] password-displays and password-phrases in Stage " + s2 + " of Quest " + quest.name + " are not the same size!");
|
||||
stageFailed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
printSevere("[Quests] Stage " + s2 + " of Quest " + quest.name + " is missing password-phrases!");
|
||||
stageFailed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".custom-objectives")) {
|
||||
|
||||
@ -3317,6 +3343,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".objective-override")) {
|
||||
|
||||
oStage.objectiveOverride = config.getString("quests." + s + ".stages.ordered." + s2 + ".objective-override");
|
||||
|
||||
}
|
||||
|
||||
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".start-event")) {
|
||||
|
||||
Event evt = Event.loadEvent(config.getString("quests." + s + ".stages.ordered." + s2 + ".start-event"), this);
|
||||
|
@ -117,7 +117,8 @@ public class Stage {
|
||||
public LinkedList<Integer> customObjectiveCounts = new LinkedList<Integer>();
|
||||
public LinkedList<String> customObjectiveDisplays = new LinkedList<String>();
|
||||
public LinkedList<Map<String, Object>> customObjectiveData = new LinkedList<Map<String, Object>>();
|
||||
public LinkedList<String>
|
||||
public LinkedList<String> passwordDisplays = new LinkedList<String>();
|
||||
public LinkedList<String> passwordPhrases = new LinkedList<String>();
|
||||
public String script;
|
||||
public Event startEvent = null;
|
||||
public Event deathEvent = null;
|
||||
@ -256,6 +257,22 @@ public class Stage {
|
||||
if (other.customObjectives.equals(customObjectives) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.customObjectiveDisplays.equals(customObjectiveDisplays) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.customObjectiveData.equals(customObjectiveData) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.passwordDisplays.equals(passwordDisplays) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.passwordPhrases.equals(passwordPhrases) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.script != null && script != null) {
|
||||
if (other.script.equals(script) == false) {
|
||||
|
@ -40,7 +40,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
public CreateStagePrompt(int stageNum, QuestFactory qf, CitizensPlugin cit) {
|
||||
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24");
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26");
|
||||
this.stageNum = stageNum;
|
||||
this.pref = "stage" + stageNum;
|
||||
this.citizens = cit;
|
||||
@ -315,30 +315,47 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
}
|
||||
|
||||
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) == null) {
|
||||
text += PINK + "" + BOLD + "20 " + RESET + PINK + "- Password Objectives" + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
LinkedList<String> passPhrases = (LinkedList<String>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
|
||||
LinkedList<String> passDisplays = (LinkedList<String>) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS);
|
||||
text += PINK + "" + BOLD + "20 " + RESET + PINK + "- Password Objectives\n";
|
||||
for(int i = 0; i < passPhrases.size(); i++){
|
||||
text += AQUA + " - " + ITALIC + "\"" + passDisplays.get(i) + "\"" + RESET + DARKAQUA + "(" + passPhrases.get(i) + ")" + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) == null) {
|
||||
text += PINK + "" + BOLD + "20 " + RESET + PINK + "- Custom Objectives" + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += PINK + "" + BOLD + "21 " + RESET + PINK + "- Custom Objectives" + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
LinkedList<String> customObjs = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
|
||||
text += PINK + "" + BOLD + "20 " + RESET + PINK + "- Custom Objectives" + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += PINK + "" + BOLD + "21 " + RESET + PINK + "- Custom Objectives\n";
|
||||
for(String s : customObjs){
|
||||
text += PINK + " - " + GOLD + s + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
|
||||
text += PINK + "" + BOLD + "21 " + RESET + PURPLE + "- " + Lang.get("stageEditorStartMessage") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += PINK + "" + BOLD + "22 " + RESET + PURPLE + "- " + Lang.get("stageEditorStartMessage") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += PINK + "" + BOLD + "21 " + RESET + PURPLE + "- " + Lang.get("stageEditorStartMessage") + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + CK.S_START_MESSAGE) + "\"" + GRAY + ")\n";
|
||||
text += PINK + "" + BOLD + "22 " + RESET + PURPLE + "- " + Lang.get("stageEditorStartMessage") + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + CK.S_START_MESSAGE) + "\"" + GRAY + ")\n";
|
||||
}
|
||||
|
||||
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
|
||||
text += PINK + "" + BOLD + "22 " + RESET + PURPLE + "- " + Lang.get("stageEditorCompleteMessage") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += PINK + "" + BOLD + "23 " + RESET + PURPLE + "- " + Lang.get("stageEditorCompleteMessage") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += PINK + "" + BOLD + "22 " + RESET + PURPLE + "- " + Lang.get("stageEditorCompleteMessage") + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + GRAY + ")\n";
|
||||
text += PINK + "" + BOLD + "23 " + RESET + PURPLE + "- " + Lang.get("stageEditorCompleteMessage") + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + GRAY + ")\n";
|
||||
}
|
||||
|
||||
text += RED + "" + BOLD + "23 " + RESET + PURPLE + "- " + Lang.get("stageEditorDelete") + "\n";
|
||||
text += GREEN + "" + BOLD + "24 " + RESET + PURPLE + "- " + Lang.get("done") + "\n";
|
||||
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
|
||||
text += PINK + "" + BOLD + "24 " + RESET + PURPLE + "- Objective Display Override " + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += PINK + "" + BOLD + "24 " + RESET + PURPLE + "- Objective Display Override " + GRAY + "(" + DARKAQUA + "\"" + context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + GRAY + ")\n";
|
||||
}
|
||||
|
||||
text += RED + "" + BOLD + "25 " + RESET + PURPLE + "- " + Lang.get("stageEditorDelete") + "\n";
|
||||
text += GREEN + "" + BOLD + "26 " + RESET + PURPLE + "- " + Lang.get("done") + "\n";
|
||||
|
||||
return text;
|
||||
|
||||
@ -411,20 +428,127 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
|
||||
return new DenizenPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("20")) {
|
||||
return new CustomObjectivesPrompt();
|
||||
return new PasswordListPrompt();
|
||||
} else if (input.equalsIgnoreCase("21")) {
|
||||
return new StartMessagePrompt();
|
||||
return new CustomObjectivesPrompt();
|
||||
} else if (input.equalsIgnoreCase("22")) {
|
||||
return new CompleteMessagePrompt();
|
||||
return new StartMessagePrompt();
|
||||
} else if (input.equalsIgnoreCase("23")) {
|
||||
return new DeletePrompt();
|
||||
return new CompleteMessagePrompt();
|
||||
} else if (input.equalsIgnoreCase("24")) {
|
||||
return new OverrideDisplayPrompt();
|
||||
} else if (input.equalsIgnoreCase("25")) {
|
||||
return new DeletePrompt();
|
||||
} else if (input.equalsIgnoreCase("26")) {
|
||||
return new StagesPrompt(questFactory);
|
||||
} else {
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PasswordListPrompt extends FixedSetPrompt {
|
||||
|
||||
public PasswordListPrompt() {
|
||||
|
||||
super("1", "2", "3", "4");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
String text = GOLD + "- Password Objectives -\n";
|
||||
if (context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) == null) {
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add password display (" + Lang.get("noneSet") + ")\n";
|
||||
text += GRAY + "2 - " + "Add password phrase (No password displays set)\n";
|
||||
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add password display\n";
|
||||
for (String display : getPasswordDisplays(context)) {
|
||||
|
||||
text += GRAY + " - " + AQUA + display + "\n";
|
||||
|
||||
}
|
||||
|
||||
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) == null) {
|
||||
text += GRAY + "2 - " + "Add password phrase (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += GRAY + "2 - " + "Add password phrase\n";
|
||||
for (String phrase : getPasswordPhrases(context)) {
|
||||
|
||||
text += GRAY + " - " + DARKAQUA + phrase + "\n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
|
||||
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new PasswordDisplayPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
if (context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) == null) {
|
||||
context.getForWhom().sendRawMessage(RED + "You must add at least one password display first!");
|
||||
return new PasswordListPrompt();
|
||||
} else {
|
||||
return new PasswordPhrasePrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
context.getForWhom().sendRawMessage(YELLOW + "Password Objectives cleared.");
|
||||
context.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, null);
|
||||
context.setSessionData(pref + CK.S_PASSWORD_PHRASES, null);
|
||||
return new PasswordListPrompt();
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
|
||||
int one;
|
||||
int two;
|
||||
|
||||
if (context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) != null) {
|
||||
one = ((List<String>) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS)).size();
|
||||
} else {
|
||||
one = 0;
|
||||
}
|
||||
|
||||
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null) {
|
||||
two = ((List<String>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES)).size();
|
||||
} else {
|
||||
two = 0;
|
||||
}
|
||||
|
||||
if (one == two) {
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(RED + "The password display and password phrase lists are not the same size!");
|
||||
return new PasswordListPrompt();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private List<String> getPasswordDisplays(ConversationContext context) {
|
||||
return (List<String>) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS);
|
||||
}
|
||||
|
||||
private List<String> getPasswordPhrases(ConversationContext context) {
|
||||
return (List<String>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class BreakBlockListPrompt extends FixedSetPrompt {
|
||||
|
||||
|
@ -98,6 +98,9 @@ public class CK {
|
||||
public static final String S_DENIZEN = "denizen";
|
||||
public static final String S_COMPLETE_MESSAGE = "completeMessage";
|
||||
public static final String S_START_MESSAGE = "startMessage";
|
||||
public static final String S_OVERRIDE_DISPLAY = "overrideDisplay";
|
||||
public static final String S_PASSWORD_DISPLAYS = "passwordDisplays";
|
||||
public static final String S_PASSWORD_PHRASES = "passwordPhrases";
|
||||
public static final String S_CUSTOM_OBJECTIVES = "customObjectives";
|
||||
public static final String S_CUSTOM_OBJECTIVES_COUNT = "customObjectiveCounts";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA = "customObjectiveData";
|
||||
|
Loading…
Reference in New Issue
Block a user