Adds support for a lot of additional quest tasks
This commit is contained in:
parent
a0266f30f3
commit
473d643621
@ -82,7 +82,7 @@ public class BlacksmithHandler extends AbstractTraitHandler {
|
|||||||
"<br><b>Enchantment chance:</b> " + npcSettings.getExtraEnchantmentChance() + "<br><b>Delay:</b> " +
|
"<br><b>Enchantment chance:</b> " + npcSettings.getExtraEnchantmentChance() + "<br><b>Delay:</b> " +
|
||||||
npcSettings.getMinReforgeDelay() + " to " + npcSettings.getMaxReforgeDelay() +
|
npcSettings.getMinReforgeDelay() + " to " + npcSettings.getMaxReforgeDelay() +
|
||||||
" seconds<br><b>Cool-down:</b> " + npcSettings.getReforgeCoolDown() + " seconds<br><b>Drop item:</b> " +
|
" seconds<br><b>Cool-down:</b> " + npcSettings.getReforgeCoolDown() + " seconds<br><b>Drop item:</b> " +
|
||||||
npcSettings.getDropItem();
|
npcSettings.getDropItem() + "<br><b>Max enchantments:</b> " + npcSettings.getMaxEnchantments();
|
||||||
if (!npcSettings.getReforgeAbleItems().isEmpty()) {
|
if (!npcSettings.getReforgeAbleItems().isEmpty()) {
|
||||||
info += "<br><b>Reforge-able items:</b> " + getReforgeAbleItemsString(npcSettings.getReforgeAbleItems());
|
info += "<br><b>Reforge-able items:</b> " + getReforgeAbleItemsString(npcSettings.getReforgeAbleItems());
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import me.blackvein.quests.quests.IQuest;
|
|||||||
import me.blackvein.quests.quests.IStage;
|
import me.blackvein.quests.quests.IStage;
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
import net.citizensnpcs.api.npc.NPCRegistry;
|
||||||
import net.knarcraft.dynmapcitizens.DynmapCitizens;
|
import net.knarcraft.dynmapcitizens.DynmapCitizens;
|
||||||
import net.knarcraft.dynmapcitizens.Icon;
|
import net.knarcraft.dynmapcitizens.Icon;
|
||||||
import net.knarcraft.dynmapcitizens.UpdateRate;
|
import net.knarcraft.dynmapcitizens.UpdateRate;
|
||||||
@ -122,19 +123,68 @@ public class QuestsHandler extends AbstractTraitHandler {
|
|||||||
*/
|
*/
|
||||||
private String getQuestStagesInfo(IQuest quest) {
|
private String getQuestStagesInfo(IQuest quest) {
|
||||||
StringBuilder questInfo = new StringBuilder();
|
StringBuilder questInfo = new StringBuilder();
|
||||||
|
NPCRegistry registry = CitizensAPI.getNPCRegistry();
|
||||||
for (IStage stage : quest.getStages()) {
|
for (IStage stage : quest.getStages()) {
|
||||||
questInfo.append("<br><b>Tasks:</b> ");
|
questInfo.append("<br><b>Tasks:</b> ");
|
||||||
int mobTypes = stage.getMobsToKill().size();
|
int mobTypes = stage.getMobsToKill().size();
|
||||||
for (int i = 0; i < mobTypes; i++) {
|
for (int i = 0; i < mobTypes; i++) {
|
||||||
questInfo.append("<br>Kill ").append(stage.getMobNumToKill().get(i)).append(" ").append(
|
questInfo.append("<br>Kill ").append(normalizeName(stage.getMobsToKill().get(i).name())).append(
|
||||||
normalizeName(stage.getMobsToKill().get(i).name()));
|
" X ").append(stage.getMobNumToKill().get(i));
|
||||||
}
|
}
|
||||||
int deliveries = stage.getItemDeliveryTargets().size();
|
int deliveries = stage.getItemDeliveryTargets().size();
|
||||||
for (int i = 0; i < deliveries; i++) {
|
for (int i = 0; i < deliveries; i++) {
|
||||||
NPC npc = CitizensAPI.getNPCRegistry().getByUniqueId(stage.getItemDeliveryTargets().get(i));
|
NPC npc = registry.getByUniqueId(stage.getItemDeliveryTargets().get(i));
|
||||||
questInfo.append("<br>Deliver ").append(getItemStackString(stage.getItemsToDeliver().get(i))).append(
|
questInfo.append("<br>Deliver ").append(getItemStackString(stage.getItemsToDeliver().get(i))).append(
|
||||||
" to ").append(npc.getName());
|
" to ").append(npc.getName());
|
||||||
}
|
}
|
||||||
|
if (stage.getFishToCatch() != null) {
|
||||||
|
questInfo.append("<br>Catch ").append(stage.getFishToCatch()).append(" fish");
|
||||||
|
}
|
||||||
|
for (UUID npcId : stage.getNpcsToKill()) {
|
||||||
|
questInfo.append("<br>Kill NPC ").append(registry.getByUniqueId(npcId).getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getBlocksToBreak(), "<br>Break "));
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getBlocksToCut(), "<br>Cut "));
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getBlocksToDamage(), "<br>Damage "));
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getBlocksToUse(), "<br>Use "));
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getBlocksToPlace(), "<br>Place "));
|
||||||
|
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getItemsToBrew(), "<br>Brew "));
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getItemsToConsume(), "<br>Consume "));
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getItemsToCraft(), "<br>Craft "));
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getItemsToEnchant(), "<br>Enchant "));
|
||||||
|
questInfo.append(getQuestItemsTaskString(stage.getItemsToSmelt(), "<br>Smelt "));
|
||||||
|
|
||||||
|
int sheepTypes = stage.getSheepToShear().size();
|
||||||
|
for (int i = 0; i < sheepTypes; i++) {
|
||||||
|
questInfo.append("<br>Shear ").append(stage.getSheepNumToShear().get(i)).append(" ").append(
|
||||||
|
normalizeName(stage.getSheepToShear().get(i).name())).append(" sheep");
|
||||||
|
}
|
||||||
|
if (stage.getCowsToMilk() != null) {
|
||||||
|
questInfo.append("<br>Milk ").append(stage.getCowsToMilk()).append(" cows");
|
||||||
|
}
|
||||||
|
|
||||||
|
int mobTamingEntries = stage.getMobsToTame().size();
|
||||||
|
for (int i = 0; i < mobTamingEntries; i++) {
|
||||||
|
questInfo.append("<br>Tame ").append(stage.getMobNumToTame().get(i)).append(" ").append(
|
||||||
|
normalizeName(stage.getMobsToTame().get(i).name()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return questInfo.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a string to display a quest task involving some action on an item
|
||||||
|
*
|
||||||
|
* @param items <p>The items that are part of the task</p>
|
||||||
|
* @param explanation <p>The explanation of what the player needs to do with the items</p>
|
||||||
|
* @return <p>A string describing the necessary tasks</p>
|
||||||
|
*/
|
||||||
|
private String getQuestItemsTaskString(List<ItemStack> items, String explanation) {
|
||||||
|
StringBuilder questInfo = new StringBuilder();
|
||||||
|
for (ItemStack itemStack : items) {
|
||||||
|
questInfo.append(explanation).append(getItemStackString(itemStack));
|
||||||
}
|
}
|
||||||
return questInfo.toString();
|
return questInfo.toString();
|
||||||
}
|
}
|
||||||
@ -146,7 +196,7 @@ public class QuestsHandler extends AbstractTraitHandler {
|
|||||||
* @return <p>The string representation of the item stack</p>
|
* @return <p>The string representation of the item stack</p>
|
||||||
*/
|
*/
|
||||||
private String getItemStackString(ItemStack itemStack) {
|
private String getItemStackString(ItemStack itemStack) {
|
||||||
return itemStack.getAmount() + " " + normalizeName(itemStack.getType().name());
|
return normalizeName(itemStack.getType().name()) + " X " + itemStack.getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user