Search in sources :

Example 1 with QuestStage

use of gg.projecteden.nexus.features.events.models.QuestStage in project Nexus by ProjectEdenGG.

the class Pugmas20Command method progress.

@Path("progress [player]")
@Description("View your event progress")
void progress(@Arg(value = "self", permission = Group.STAFF) Pugmas20User user) {
    LocalDate now = LocalDate.now();
    if (isBeforePugmas(now))
        now = now.withYear(2020).withMonth(12).withDayOfMonth(1);
    if (isPastPugmas(now))
        error("Next year!");
    if (isSecondChance(now))
        now = now.withYear(2020).withMonth(12).withDayOfMonth(25);
    int day = now.getDayOfMonth();
    line(2);
    send(PREFIX + "Event progress (Day &e#" + day + "&3):");
    line();
    String advent;
    AdventChest adventChest = AdventChests.getAdventChest(day);
    if (user.getFoundDays().size() == 25)
        advent = "&a☑ &3Complete";
    else if (user.getFoundDays().contains(day))
        advent = "&a☑ &3Found today's chest";
    else if (day == 25)
        if (user.getFoundDays().size() != 24)
            advent = "&7☐ &3Find all chests before #25";
        else
            advent = "&7☐ &3Find the last chest";
    else
        advent = "&7☐ &3Find today's chest (&e#" + day + " &3in the &e" + adventChest.getDistrict().getName() + " District&3)";
    send("&6&lAdvent Chests");
    send(json("&f  " + advent + " &7- Click for info").hover("Click to open the Advent menu").command("/pugmas advent"));
    line();
    send("&6&lQuests");
    for (Pugmas20QuestStageHelper quest : Pugmas20QuestStageHelper.values()) {
        QuestStage stage = quest.getter().apply(user);
        String instructions = Pugmas20Quest.valueOf(quest.name()).getInstructions(user, stage);
        JsonBuilder json = json();
        if (quest == Pugmas20QuestStageHelper.THE_MINES && stage == QuestStage.STARTED) {
            List<String> tradesLeft = getIngotTradesLeft(user);
            if (tradesLeft.isEmpty()) {
                json.next("&f  &a☑ &3" + camelCase(quest) + " &7- &aCompleted daily quest &7- Come back tomorrow for more");
            } else {
                json.next("&f  &7☐ &3" + camelCase(quest) + " &7- &eIn progress &7- " + instructions);
                tradesLeft.add(0, "&6Today's available trades:");
                json.next(" &7&o(Hover for info)").hover(String.join("\n", tradesLeft));
            }
        } else {
            if (stage == QuestStage.COMPLETE) {
                json.next("&f  &a☑ &3" + camelCase(quest) + " &7- &aComplete");
            } else if (stage == QuestStage.NOT_STARTED || stage == QuestStage.INELIGIBLE) {
                json.next("&f  &7☐ &3" + camelCase(quest) + " &7- &cNot started" + (instructions == null ? "" : " &7- " + instructions));
            } else {
                json.next("&f  &7☐ &3" + camelCase(quest) + " &7- &eIn progress &7- ");
                if (instructions == null)
                    json.next("&c???").hover(camelCase(stage));
                else
                    json.next("&7" + instructions);
            }
            if (quest == Pugmas20QuestStageHelper.TOY_TESTING && stage == QuestStage.STARTED) {
                List<String> toysLeft = getUnplayedToysList(user);
                toysLeft.add(0, "&6Toys left to test:");
                json.next(" &7&o(Hover for info)").hover(String.join("\n&f", toysLeft));
            }
            if (quest == Pugmas20QuestStageHelper.ORNAMENT_VENDOR && stage != QuestStage.NOT_STARTED) {
                List<String> lore = getOrnamentTradesLeft(user);
                if (!lore.isEmpty()) {
                    lore.add(0, "&6Available ornament trades:");
                    if (stage == QuestStage.COMPLETE)
                        json.next(" &7- More trades available");
                    lore.add("&f");
                    lore.add("&fYou get to keep any extra ornaments");
                    json.next(" &7&o(Hover for info)").hover(String.join("\n&f", lore));
                }
            }
        }
        send(json);
    }
    line();
    if (day < 25) {
        send("&3Next day begins in &e" + Timespan.of(now.plusDays(1)).format());
        line();
    }
}
Also used : JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) Pugmas20QuestStageHelper(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.Quests.Pugmas20QuestStageHelper) QuestStage(gg.projecteden.nexus.features.events.models.QuestStage) LocalDate(java.time.LocalDate) AdventChest(gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest) Pugmas20.showWaypoint(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.showWaypoint) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Example 2 with QuestStage

use of gg.projecteden.nexus.features.events.models.QuestStage in project Nexus by ProjectEdenGG.

the class BearFair21StatsCommand method getQuestStages.

private List<String> getQuestStages(List<BearFair21User> users, BearFair21UserQuestStageHelper quest) {
    Map<QuestStage, Integer> questStageMap = new HashMap<>();
    for (QuestStage questStage : QuestStage.values()) {
        for (BearFair21User user : users) {
            if (quest.getter().apply(user).equals(questStage)) {
                int count = questStageMap.getOrDefault(questStage, 0);
                questStageMap.put(questStage, ++count);
            }
        }
    }
    List<String> lines = new ArrayList<>();
    questStageMap.keySet().stream().sorted(Comparator.comparing(Enum::ordinal)).forEach(questStage -> {
        int count = questStageMap.get(questStage);
        if (count > 0)
            lines.add(StringUtils.camelCase(questStage) + ": " + count);
    });
    return lines;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BearFair21User(gg.projecteden.nexus.models.bearfair21.BearFair21User) QuestStage(gg.projecteden.nexus.features.events.models.QuestStage)

Aggregations

QuestStage (gg.projecteden.nexus.features.events.models.QuestStage)2 Pugmas20.showWaypoint (gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.showWaypoint)1 AdventChest (gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest)1 Pugmas20QuestStageHelper (gg.projecteden.nexus.features.events.y2020.pugmas20.quests.Quests.Pugmas20QuestStageHelper)1 Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)1 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)1 BearFair21User (gg.projecteden.nexus.models.bearfair21.BearFair21User)1 JsonBuilder (gg.projecteden.nexus.utils.JsonBuilder)1 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1