diff --git a/Core/src/commands/player/ReportCommand.ts b/Core/src/commands/player/ReportCommand.ts index 0ac26afbe..01c3e9a19 100644 --- a/Core/src/commands/player/ReportCommand.ts +++ b/Core/src/commands/player/ReportCommand.ts @@ -53,6 +53,7 @@ import {Possibility} from "../../data/events/Possibility"; import {applyPossibilityOutcome} from "../../data/events/PossibilityOutcome"; import {ErrorPacket} from "../../../../Lib/src/packets/commands/ErrorPacket"; import {Effect} from "../../../../Lib/src/enums/Effect"; +import {MapLocationDataController} from "../../data/MapLocation"; export default class ReportCommand { @packetHandler(CommandReportPacketReq) @@ -205,7 +206,7 @@ async function doPossibility( const newMapLink = await applyPossibilityOutcome(event.id, possibility[0], randomOutcome, player, time, context, response); - if (!await player.killIfNeeded(response, NumberChangeReason.BIG_EVENT) && newMapLink) { + if (!await player.killIfNeeded(response, NumberChangeReason.BIG_EVENT) && !newMapLink) { await chooseDestination(context, player, newMapLink, response); } @@ -322,9 +323,11 @@ async function doRandomBigEvent( */ async function automaticChooseDestination(forcedLink: MapLink, player: Player, destinationMaps: number[], response: DraftBotPacket[]): Promise { const newLink = forcedLink && forcedLink.id !== -1 ? forcedLink : MapLinkDataController.instance.getLinkByLocations(player.getDestinationId(), destinationMaps[0]); + const endMap = MapLocationDataController.instance.getById(newLink.endMap); await Maps.startTravel(player, newLink, Date.now()); response.push(makePacket(CommandReportChooseDestinationRes, { mapId: newLink.endMap, + mapTypeId: endMap.type, tripDuration: newLink.tripDuration })); } @@ -359,9 +362,14 @@ async function chooseDestination( const mapReactions: ReactionCollectorChooseDestinationReaction[] = destinationMaps.map((mapId) => { const mapLink = MapLinkDataController.instance.getLinkByLocations(player.getDestinationId(), mapId); + const mapTypeId = MapLocationDataController.instance.getById(mapId).type; const isPveMap = MapCache.allPveMapLinks.includes(mapLink.id); - return {mapId, tripDuration: isPveMap || RandomUtils.draftbotRandom.bool() ? mapLink.tripDuration : null}; + return { + mapId, + mapTypeId, + tripDuration: isPveMap || RandomUtils.draftbotRandom.bool() ? mapLink.tripDuration : null + }; }); const collector = new ReactionCollectorChooseDestination(mapReactions); @@ -372,9 +380,11 @@ async function chooseDestination( (firstReaction.reaction.data as ReactionCollectorChooseDestinationReaction).mapId : (RandomUtils.draftbotRandom.pick(collector.creationPacket.reactions).data as ReactionCollectorChooseDestinationReaction).mapId; const newLink = MapLinkDataController.instance.getLinkByLocations(player.getDestinationId(), mapId); + const endMap = MapLocationDataController.instance.getById(mapId); await Maps.startTravel(player, newLink, Date.now()); response.push(makePacket(CommandReportChooseDestinationRes, { mapId: newLink.endMap, + mapTypeId: endMap.type, tripDuration: newLink.tripDuration })); BlockingUtils.unblockPlayer(player.id, BlockingConstants.REASONS.CHOOSE_DESTINATION); diff --git a/Core/src/core/database/logs/LogsDatabase.ts b/Core/src/core/database/logs/LogsDatabase.ts index cbc16d8e9..ec5307109 100644 --- a/Core/src/core/database/logs/LogsDatabase.ts +++ b/Core/src/core/database/logs/LogsDatabase.ts @@ -438,15 +438,15 @@ export class LogsDatabase extends Database { * Log the appearance of a big event * @param keycloakId * @param eventId - * @param possibilityEmote + * @param possibilityName * @param outcome */ - public async logBigEvent(keycloakId: string, eventId: number, possibilityEmote: string, outcome: string): Promise { + public async logBigEvent(keycloakId: string, eventId: number, possibilityName: string, outcome: string): Promise { const player = await LogsDatabase.findOrCreatePlayer(keycloakId); const [possibility] = await LogsPossibilities.findOrCreate({ where: { bigEventId: eventId, - emote: possibilityEmote === "end" ? null : possibilityEmote, + possibilityName: possibilityName === "end" ? null : possibilityName, issueIndex: parseInt(outcome) } }); diff --git a/Core/src/core/database/logs/migrations/006-v5.ts b/Core/src/core/database/logs/migrations/006-v5.ts index af332f039..c4eae961c 100644 --- a/Core/src/core/database/logs/migrations/006-v5.ts +++ b/Core/src/core/database/logs/migrations/006-v5.ts @@ -1,5 +1,5 @@ -import {QueryInterface} from "sequelize"; -import {Effect} from "../../../../../../Lib/src/enums/Effect"; +import {DataTypes, QueryInterface} from "sequelize"; +import {Effect} from "../../../../../../Lib/src/enums/Effect"; // eslint-disable-next-line new-cap // Populated by v5 migration of game // Map discordId => new ID @@ -12,14 +12,18 @@ export async function up({context}: { context: QueryInterface }): Promise await context.sequelize.query(`UPDATE players SET discordId = "${id[1]}" WHERE discordId = "${id[0]}"`); } - await context.renameColumn("players", "discordId", "keycloakId"); + await context.renameColumn("players", "gameId", "keycloakId"); // Change alterations name in logs for (const effect of Effect.getAll()) { await context.sequelize.query(`UPDATE alterations SET alteration = "${effect.id}" WHERE alteration = "${effect.v4Id}"`); } + + // Extend logs possibilities emote length + rename + await context.changeColumn("possibilities", "emote", DataTypes.STRING(256)); // eslint-disable-line new-cap + await context.renameColumn("possibilities", "emote", "possibilityName"); } export async function down({context}: { context: QueryInterface }): Promise { - await context.renameColumn("players", "keycloakId", "discordId"); + await context.renameColumn("players", "keycloakId", "gameId"); } \ No newline at end of file diff --git a/Core/src/core/database/logs/models/LogsPossibilities.ts b/Core/src/core/database/logs/models/LogsPossibilities.ts index 49867b729..dbb474c79 100644 --- a/Core/src/core/database/logs/models/LogsPossibilities.ts +++ b/Core/src/core/database/logs/models/LogsPossibilities.ts @@ -5,7 +5,7 @@ export class LogsPossibilities extends Model { declare readonly bigEventId: number; - declare readonly emote: string; + declare readonly possibilityName: string; declare readonly issueIndex: number; } @@ -21,8 +21,8 @@ export function initModel(sequelize: Sequelize): void { type: DataTypes.SMALLINT.UNSIGNED, allowNull: false }, - emote: { - type: DataTypes.STRING(5), // eslint-disable-line new-cap + possibilityName: { + type: DataTypes.STRING(256), // eslint-disable-line new-cap allowNull: true // Null for end }, issueIndex: { diff --git a/Discord/src/commands/player/ReportCommand.ts b/Discord/src/commands/player/ReportCommand.ts index 99f8495fd..bb4e4c2c5 100644 --- a/Discord/src/commands/player/ReportCommand.ts +++ b/Discord/src/commands/player/ReportCommand.ts @@ -9,7 +9,6 @@ import { import {KeycloakUser} from "../../../../Lib/src/keycloak/KeycloakUser"; import { ReactionCollectorCreationPacket, - ReactionCollectorReactPacket } from "../../../../Lib/src/packets/interaction/ReactionCollectorPacket"; import { ReactionCollectorBigEventData, @@ -26,10 +25,13 @@ import { import {DiscordCache} from "../../bot/DiscordCache"; import {DraftBotIcons} from "../../../../Lib/src/DraftBotIcons"; import {sendInteractionNotForYou} from "../../utils/ErrorUtils"; -import {DiscordWebSocket} from "../../bot/Websocket"; import {Constants} from "../../../../Lib/src/constants/Constants"; import {Effect} from "../../../../Lib/src/enums/Effect"; import {minutesDisplay} from "../../../../Lib/src/utils/TimeUtils"; +import {DraftBotEmbed} from "../../messages/DraftBotEmbed"; +import {ReactionCollectorChooseDestinationReaction} from "../../../../Lib/src/packets/interaction/ReactionCollectorChooseDestination"; +import {Language} from "../../../../Lib/src/Language"; +import {DiscordCollectorUtils} from "../../utils/DiscordCollectorUtils"; async function getPacket(interaction: DraftbotInteraction, user: KeycloakUser): Promise { await interaction.deferReply(); @@ -71,35 +73,7 @@ export async function createBigEventCollector(packet: ReactionCollectorCreationP const respondToEvent = (possibilityName: string, buttonInteraction: ButtonInteraction | null): void => { if (!responded) { responded = true; - - const responsePacket = makePacket( - ReactionCollectorReactPacket, - { - id: packet.id, - keycloakId: user.id, - reactionIndex: reactions.findIndex((reaction) => reaction.name === possibilityName) - } - ); - - if (buttonInteraction) { - DiscordCache.cacheButtonInteraction(buttonInteraction); - } - DiscordWebSocket.socket!.send(JSON.stringify({ - packet: { - name: responsePacket.constructor.name, - data: responsePacket - }, - context: { - keycloakId: user.id, - discord: { - user: interaction.user.id, - channel: interaction.channel.id, - interaction: interaction.id, - buttonInteraction: buttonInteraction?.id, - language: interaction.userLanguage - } - } - })); + DiscordCollectorUtils.sendReaction(packet, context, user, buttonInteraction, reactions.findIndex((reaction) => reaction.name === possibilityName)); } }; @@ -123,20 +97,17 @@ export async function createBigEventCollector(packet: ReactionCollectorCreationP buttonCollector.on("end", async (collected) => { const firstReaction = collected.first() as ButtonInteraction; - if (!firstReaction) { - respondToEvent("end", null); - } - else { + if (firstReaction) { await firstReaction.deferReply(); respondToEvent(firstReaction.customId, firstReaction); } }); endCollector.on("collect", () => { - respondToEvent("end", null); - buttonCollector.stop(); endCollector.stop(); + + respondToEvent("end", null); }); } @@ -146,41 +117,41 @@ export async function reportResult(packet: CommandReportBigEventResultRes, conte let result = ""; if (packet.score) { - result += i18n.t("commands:report.points", { lng: interaction.channel.language, score: packet.score }); + result += i18n.t("commands:report.points", { lng: interaction.userLanguage, score: packet.score }); } if (packet.money < 0) { - result += i18n.t("commands:report.moneyLoose", { lng: interaction.channel.language, money: -packet.money }); + result += i18n.t("commands:report.moneyLoose", { lng: interaction.userLanguage, money: -packet.money }); } else if (packet.money > 0) { - result += i18n.t("commands:report.money", { lng: interaction.channel.language, money: packet.money }); + result += i18n.t("commands:report.money", { lng: interaction.userLanguage, money: packet.money }); } if (packet.health < 0) { - result += i18n.t("commands:report.healthLoose", { lng: interaction.channel.language, health: -packet.health }); + result += i18n.t("commands:report.healthLoose", { lng: interaction.userLanguage, health: -packet.health }); } else if (packet.health > 0) { - result += i18n.t("commands:report.health", { lng: interaction.channel.language, health: packet.health }); + result += i18n.t("commands:report.health", { lng: interaction.userLanguage, health: packet.health }); } if (packet.energy) { - result += i18n.t("commands:report.energy", { lng: interaction.channel.language, energy: packet.energy }); + result += i18n.t("commands:report.energy", { lng: interaction.userLanguage, energy: packet.energy }); } if (packet.gems) { - result += i18n.t("commands:report.gems", { lng: interaction.channel.language, gems: packet.gems }); + result += i18n.t("commands:report.gems", { lng: interaction.userLanguage, gems: packet.gems }); } if (packet.experience) { - result += i18n.t("commands:report.experience", { lng: interaction.channel.language, experience: packet.experience }); + result += i18n.t("commands:report.experience", { lng: interaction.userLanguage, experience: packet.experience }); } if (packet.effect && packet.effect.name === Effect.OCCUPIED.id) { - result += i18n.t("commands:report.timeLost", { lng: interaction.channel.language, timeLost: minutesDisplay(packet.effect.time) }); + result += i18n.t("commands:report.timeLost", { lng: interaction.userLanguage, timeLost: minutesDisplay(packet.effect.time) }); } const content = i18n.t("commands:report.doPossibility", { - lng: interaction.channel.language, + lng: interaction.userLanguage, interpolation: { escapeValue: false }, pseudo: user.attributes.gameUsername, result, - event: i18n.t(`events:${packet.eventId}.possibilities.${packet.possibilityId}.outcomes.${packet.outcomeId}`), + event: i18n.t(`events:${packet.eventId}.possibilities.${packet.possibilityId}.outcomes.${packet.outcomeId}`, { lng: interaction.userLanguage }), emoji: packet.possibilityId === "end" ? (DraftBotIcons.events[packet.eventId].end as { [outcomeId: string]: string })[packet.outcomeId] : DraftBotIcons.events[packet.possibilityId], - alte: packet.effect ? DraftBotIcons.effects[packet.effect.name] : "" + alte: packet.effect && packet.effect.name !== Effect.OCCUPIED.id ? DraftBotIcons.effects[packet.effect.name] : "" }); const buttonInteraction = context.discord?.buttonInteraction ? DiscordCache.getButtonInteraction(context.discord?.buttonInteraction) : null; @@ -193,6 +164,76 @@ export async function reportResult(packet: CommandReportBigEventResultRes, conte } } +const destinationChoiceEmotes = ["1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣"]; + +/** + * Creates the description for a chooseDestination embed + * @param reactions + * @param language + */ +function createDescriptionChooseDestination(reactions: ReactionCollectorChooseDestinationReaction[], language: Language): string { + let desc = `${i18n.t("commands:report.chooseDestinationIndications", { lng: language })}\n`; + for (let i = 0; i < reactions.length; ++i) { + const reaction = reactions[i]; + const duration = reaction.tripDuration ? minutesDisplay(reaction.tripDuration) : "?h"; + desc += `${destinationChoiceEmotes[i]} - ${DraftBotIcons.map_types[reaction.mapTypeId]} ${i18n.t(`models:map_locations.${reaction.mapId}.name`, { lng: language })} (${duration})\n`; + } + return desc; +} + +export async function chooseDestinationCollector(packet: ReactionCollectorCreationPacket, context: PacketContext): Promise { + const user = (await KeycloakUtils.getUserByKeycloakId(keycloakConfig, context.keycloakId!))!; + const interaction = DiscordCache.getInteraction(context.discord!.interaction)!; + + const embed = new DraftBotEmbed(); + embed.formatAuthor(i18n.t("commands:report.destinationTitle", { + lng: interaction.userLanguage, + pseudo: user.attributes.gameUsername + }), interaction.user); + embed.setDescription( + createDescriptionChooseDestination( + packet.reactions.map(reaction => reaction.data) as ReactionCollectorChooseDestinationReaction[], + interaction.userLanguage + ) + ); + + const row = new ActionRowBuilder(); + + for (let i = 0; i < packet.reactions.length; ++i) { + const button = new ButtonBuilder() + .setEmoji(parseEmoji(destinationChoiceEmotes[i])!) + .setCustomId(i.toString()) + .setStyle(ButtonStyle.Secondary); + row.addComponents(button); + } + + const msg = await interaction?.channel.send({ + embeds: [embed], + components: [row] + }) as Message; + + const buttonCollector = msg.createMessageComponentCollector({ + time: packet.endTime - Date.now() + }); + + buttonCollector.on("collect", async (buttonInteraction: ButtonInteraction) => { + if (buttonInteraction.user.id !== context.discord?.user) { + await sendInteractionNotForYou(buttonInteraction.user, buttonInteraction, interaction.userLanguage); + return; + } + + buttonCollector.stop(); + }); + buttonCollector.on("end", async (collected) => { + const firstReaction = collected.first() as ButtonInteraction; + + if (firstReaction) { + await firstReaction.deferReply(); + DiscordCollectorUtils.sendReaction(packet, context, user, firstReaction, parseInt(firstReaction.customId)); + } + }); +} + export const commandInfo: ICommand = { slashCommandBuilder: SlashCommandBuilderGenerator.generateBaseCommand("report"), getPacket, diff --git a/Discord/src/packetHandlers/handlers/ErrorHandler.ts b/Discord/src/packetHandlers/handlers/ErrorHandler.ts index 66e28ec8a..b12974db7 100644 --- a/Discord/src/packetHandlers/handlers/ErrorHandler.ts +++ b/Discord/src/packetHandlers/handlers/ErrorHandler.ts @@ -18,15 +18,7 @@ export default class ErrorHandler { .setTitle(i18n.t("error:unexpectedError", {lng: interaction?.channel?.language})) .setDescription(packet.message); - if (interaction?.deferred && !interaction.replyEdited) { - interaction?.editReply({embeds: [embed]}); - } - else if (!interaction?.deferred && !interaction?.replied) { - interaction?.reply({embeds: [embed]}); - } - else { - interaction?.channel.send({embeds: [embed]}); - } + await interaction?.channel.send({embeds: [embed]}); } @packetHandler(BlockedPacket) diff --git a/Discord/src/packetHandlers/handlers/NotificationsHandlers.ts b/Discord/src/packetHandlers/handlers/NotificationsHandlers.ts new file mode 100644 index 000000000..4e86a8b32 --- /dev/null +++ b/Discord/src/packetHandlers/handlers/NotificationsHandlers.ts @@ -0,0 +1,53 @@ +import {packetHandler} from "../PacketHandler"; +import {WebSocket} from "ws"; +import {PacketContext} from "../../../../Lib/src/packets/DraftBotPacket"; +import {DiscordCache} from "../../bot/DiscordCache"; +import i18n from "../../translations/i18n"; +import {DraftBotEmbed} from "../../messages/DraftBotEmbed"; +import {CommandReportChooseDestinationRes} from "../../../../Lib/src/packets/commands/CommandReportPacket"; +import {KeycloakUtils} from "../../../../Lib/src/keycloak/KeycloakUtils"; +import {keycloakConfig} from "../../bot/DraftBotShard"; +import {DraftBotIcons} from "../../../../Lib/src/DraftBotIcons"; +import {minutesToHours} from "../../../../Lib/src/utils/TimeUtils"; + +export default class NotificationsHandlers { + @packetHandler(CommandReportChooseDestinationRes) + async chooseDestinationRes(socket: WebSocket, packet: CommandReportChooseDestinationRes, context: PacketContext): Promise { + const user = (await KeycloakUtils.getUserByKeycloakId(keycloakConfig, context.keycloakId!))!; + const interaction = DiscordCache.getInteraction(context.discord!.interaction); + + if (interaction) { + const embed = new DraftBotEmbed(); + embed.formatAuthor(i18n.t("commands:report.destinationTitle", { + lng: interaction.userLanguage, + pseudo: user.attributes.gameUsername + }), interaction.user); + + let time = packet.tripDuration; + let i18nTr: string; + if (time < 60) { + i18nTr = "commands:report.choseMapMinutes"; + } + else { + time = Math.round(minutesToHours(packet.tripDuration)); + i18nTr = "commands:report.choseMap"; + } + embed.setDescription(i18n.t(i18nTr, { + count: time, + lng: interaction.userLanguage, + mapPrefix: i18n.t(`models:map_types.${packet.mapTypeId}.prefix`, { lng: interaction.userLanguage }), + mapType: (i18n.t(`models:map_types.${packet.mapTypeId}.name`, { lng: interaction.userLanguage }) as string).toLowerCase(), + mapEmote: DraftBotIcons.map_types[packet.mapTypeId], + mapName: i18n.t(`models:map_locations.${packet.mapId}.name`, { lng: interaction.userLanguage }), + time + })); + + if (context.discord?.buttonInteraction) { + await DiscordCache.getButtonInteraction(context.discord?.buttonInteraction)?.editReply({embeds: [embed]}); + } + else { + await interaction?.channel.send({embeds: [embed]}); + } + } + } +} \ No newline at end of file diff --git a/Discord/src/packetHandlers/handlers/ReactionCollectorHandlers.ts b/Discord/src/packetHandlers/handlers/ReactionCollectorHandlers.ts index 2cf96a07a..a3e7542cf 100644 --- a/Discord/src/packetHandlers/handlers/ReactionCollectorHandlers.ts +++ b/Discord/src/packetHandlers/handlers/ReactionCollectorHandlers.ts @@ -3,7 +3,8 @@ import {WebSocket} from "ws"; import {PacketContext} from "../../../../Lib/src/packets/DraftBotPacket"; import {ReactionCollectorCreationPacket} from "../../../../Lib/src/packets/interaction/ReactionCollectorPacket"; import { ReactionCollectorBigEventData} from "../../../../Lib/src/packets/interaction/ReactionCollectorBigEvent"; -import {createBigEventCollector} from "../../commands/player/ReportCommand"; +import {chooseDestinationCollector, createBigEventCollector} from "../../commands/player/ReportCommand"; +import {ReactionCollectorChooseDestinationData} from "../../../../Lib/src/packets/interaction/ReactionCollectorChooseDestination"; export default class ReactionCollectorHandler { @packetHandler(ReactionCollectorCreationPacket) @@ -12,6 +13,9 @@ export default class ReactionCollectorHandler { case ReactionCollectorBigEventData.name: await createBigEventCollector(packet, context); break; + case ReactionCollectorChooseDestinationData.name: + await chooseDestinationCollector(packet, context); + break; default: throw `Unknown collector with data: ${packet.data.type}`; // Todo error embed } diff --git a/Discord/src/utils/DiscordCollectorUtils.ts b/Discord/src/utils/DiscordCollectorUtils.ts new file mode 100644 index 000000000..611aad8d5 --- /dev/null +++ b/Discord/src/utils/DiscordCollectorUtils.ts @@ -0,0 +1,42 @@ +import {makePacket, PacketContext} from "../../../Lib/src/packets/DraftBotPacket"; +import { + ReactionCollectorCreationPacket, + ReactionCollectorReactPacket +} from "../../../Lib/src/packets/interaction/ReactionCollectorPacket"; +import {DiscordCache} from "../bot/DiscordCache"; +import {DiscordWebSocket} from "../bot/Websocket"; +import {KeycloakUser} from "../../../Lib/src/keycloak/KeycloakUser"; +import {ButtonInteraction} from "discord.js"; + +export class DiscordCollectorUtils { + static sendReaction(packet: ReactionCollectorCreationPacket, context: PacketContext, user: KeycloakUser, button: ButtonInteraction | null, reactionIndex: number): void { + const responsePacket = makePacket( + ReactionCollectorReactPacket, + { + id: packet.id, + keycloakId: user.id, + reactionIndex: reactionIndex + } + ); + + if (button) { + DiscordCache.cacheButtonInteraction(button); + } + DiscordWebSocket.socket!.send(JSON.stringify({ + packet: { + name: responsePacket.constructor.name, + data: responsePacket + }, + context: { + keycloakId: user.id, + discord: { + user: context.discord!.user, + channel: context.discord!.channel, + interaction: context.discord!.interaction, + buttonInteraction: button?.id, + language: context.discord!.language + } + } + })); + } +} \ No newline at end of file diff --git a/Lang/de/commands.json b/Lang/de/commands.json index 82cc7fb8d..53c6ed1fa 100644 --- a/Lang/de/commands.json +++ b/Lang/de/commands.json @@ -318,10 +318,10 @@ "report": { "adviceTitle": "Tipp:", "chooseDestinationIndications": "Wählen Sie ein Ziel für Ihre Reise:", - "choseMapMinutes_one": "Sie haben entschieden, in Richtung {{mapPrefix}} {{mapType}} **{{mapName}}** zu gehen. Dieser Pfad wird ca. **{{time}} Minuten * * dauern.", - "choseMapMinutes_other": "Sie haben entschieden, in Richtung {{mapPrefix}} {{mapType}} **{{mapName}}** zu gehen. Dieser Pfad wird ca. **{{time}} Minuten * * dauern.", - "choseMap_one": "Sie haben entschieden, in Richtung {{mapPrefix}} {{mapType}} **{{mapName}}** zu gehen. Dieser Pfad wird ca. **{{time}} Std. * * dauern.", - "choseMap_other": "Sie haben entschieden, in Richtung {{mapPrefix}} {{mapType}} **{{mapName}}** zu gehen. Dieser Pfad wird ca. **{{time}} Stunden * * dauern.", + "choseMapMinutes_one": "Sie haben entschieden, in Richtung {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}** zu gehen. Dieser Pfad wird ca. **{{time}} Minuten * * dauern.", + "choseMapMinutes_other": "Sie haben entschieden, in Richtung {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}** zu gehen. Dieser Pfad wird ca. **{{time}} Minuten * * dauern.", + "choseMap_one": "Sie haben entschieden, in Richtung {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}** zu gehen. Dieser Pfad wird ca. **{{time}} Std. * * dauern.", + "choseMap_other": "Sie haben entschieden, in Richtung {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}** zu gehen. Dieser Pfad wird ca. **{{time}} Stunden * * dauern.", "collectedPointsTitle": "geerntete Punkte:", "commandDescription": "Holen Sie sich einen Bericht über die Situation Ihres Charakters.", "commandName": "Bericht", diff --git a/Lang/en/commands.json b/Lang/en/commands.json index 904a841d6..d157c53e8 100644 --- a/Lang/en/commands.json +++ b/Lang/en/commands.json @@ -351,10 +351,10 @@ "report": { "adviceTitle": "Advice:", "chooseDestinationIndications": "Choose the destination of your travel:", - "choseMapMinutes_one": "You chose to go in the direction {{mapPrefix}} **{{mapName}}** {{mapType}}. You'll travel for about **{{time}} minute**.", - "choseMapMinutes_other": "You chose to go in the direction {{mapPrefix}} **{{mapName}}** {{mapType}}. You'll travel for about **{{time}} minutes**.", - "choseMap_one": "You chose to go in the direction {{mapPrefix}} **{{mapName}}** {{mapType}}. You'll travel for about **{{time}} hour**.", - "choseMap_other": "You chose to go in the direction {{mapPrefix}} **{{mapName}}** {{mapType}}. You'll travel for about **{{time}} hours**.", + "choseMapMinutes_one": "You chose to go in the direction {{mapPrefix}} {{mapEmote}} **{{mapName}}** {{mapType}}. You'll travel for about **{{time}} minute**.", + "choseMapMinutes_other": "You chose to go in the direction {{mapPrefix}} {{mapEmote}} **{{mapName}}** {{mapType}}. You'll travel for about **{{time}} minutes**.", + "choseMap_one": "You chose to go in the direction {{mapPrefix}} {{mapEmote}} **{{mapName}}** {{mapType}}. You'll travel for about **{{time}} hour**.", + "choseMap_other": "You chose to go in the direction {{mapPrefix}} {{mapEmote}} **{{mapName}}** {{mapType}}. You'll travel for about **{{time}} hours**.", "collectedPointsTitle": "Collected points:", "commandDescription": "Get a report on your character's situation.", "commandName": "report", diff --git a/Lang/es/commands.json b/Lang/es/commands.json index bd738e29a..62068529f 100644 --- a/Lang/es/commands.json +++ b/Lang/es/commands.json @@ -318,10 +318,10 @@ "report": { "adviceTitle": "Consejos :", "chooseDestinationIndications": "Elija un destino para su viaje:", - "choseMapMinutes_one": "Ha decidido dirigirse a {{mapPrefix}} {{mapType}} **{{mapName}}**. Este trayecto durará aproximadamente **{{time}} minuto**.", - "choseMapMinutes_other": "Ha decidido dirigirse a {{mapPrefix}} {{mapType}} **{{mapName}}**. Este trayecto durará aproximadamente **{{time}} minutos**.", - "choseMap_one": "Ha decidido dirigirse a {{mapPrefix}} {{mapType}} **{{mapName}}**. Este viaje durará aproximadamente **{{time}} hora**.", - "choseMap_other": "Ha decidido dirigirse a {{mapPrefix}} {{mapType}} **{{mapName}}**. El viaje durará aproximadamente **{{time}} horas**.", + "choseMapMinutes_one": "Ha decidido dirigirse a {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}**. Este trayecto durará aproximadamente **{{time}} minuto**.", + "choseMapMinutes_other": "Ha decidido dirigirse a {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}**. Este trayecto durará aproximadamente **{{time}} minutos**.", + "choseMap_one": "Ha decidido dirigirse a {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}**. Este viaje durará aproximadamente **{{time}} hora**.", + "choseMap_other": "Ha decidido dirigirse a {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}**. El viaje durará aproximadamente **{{time}} horas**.", "collectedPointsTitle": "Puntos recogidos :", "commandDescription": "Obtén un informe sobre la situación de tu personaje.", "commandName": "informe", diff --git a/Lang/fr/commands.json b/Lang/fr/commands.json index f5460845a..d4fcef337 100644 --- a/Lang/fr/commands.json +++ b/Lang/fr/commands.json @@ -351,10 +351,10 @@ "report": { "adviceTitle": "Conseil :", "chooseDestinationIndications": "Choisissez une destination pour votre voyage:", - "choseMapMinutes_one": "Vous avez décidé de partir en direction {{mapPrefix}} {{mapType}} **{{mapName}}**. Ce trajet durera environ **{{time}} minute**.", - "choseMapMinutes_other": "Vous avez décidé de partir en direction {{mapPrefix}} {{mapType}} **{{mapName}}**. Ce trajet durera environ **{{time}} minutes**.", - "choseMap_one": "Vous avez décidé de partir en direction {{mapPrefix}} {{mapType}} **{{mapName}}**. Ce trajet durera environ **{{time}} heure**.", - "choseMap_other": "Vous avez décidé de partir en direction {{mapPrefix}} {{mapType}} **{{mapName}}**. Ce trajet durera environ **{{time}} heures**.", + "choseMapMinutes_one": "Vous avez décidé de partir en direction {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}**. Ce trajet durera environ **{{time}} minute**.", + "choseMapMinutes_other": "Vous avez décidé de partir en direction {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}**. Ce trajet durera environ **{{time}} minutes**.", + "choseMap_one": "Vous avez décidé de partir en direction {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}**. Ce trajet durera environ **{{time}} heure**.", + "choseMap_other": "Vous avez décidé de partir en direction {{mapPrefix}} {{mapType}} {{mapEmote}} **{{mapName}}**. Ce trajet durera environ **{{time}} heures**.", "collectedPointsTitle": "Points récoltés :", "commandDescription": "Obtenir un rapport sur la situation de votre personnage.", "commandName": "rapport", diff --git a/Lib/src/DraftBotIcons.ts b/Lib/src/DraftBotIcons.ts index 828f45d3e..72bed5fe6 100644 --- a/Lib/src/DraftBotIcons.ts +++ b/Lib/src/DraftBotIcons.ts @@ -7,6 +7,9 @@ export const DraftBotIcons: { [possibilityName: string]: string | { [outcomeId: string]: string } } } + map_types: { + [mapType: string]: string + }, } = { "effects": { "not_started": "👶", @@ -685,5 +688,32 @@ export const DraftBotIcons: { "help": "🔎", "skip": "▶️" } + }, + "map_types": { + "be": "🏖", + "castle_entrance": "🏰", + "castle_throne": "🪑", + "ci": "🏘", + "continent": "🏞", + "crystal_cavern": "💎", + "de": "🏜", + "fo": "🌳", + "ice_beach": "🌨", + "ice_cavern": "🧊", + "ice_lake": "❄", + "la": "🚣‍♂", + "mine": "🪨", + "mo": "⛰", + "pl": "🌺", + "pve_exit": "⛴", + "ri": "🏞", + "ro": "🛣", + "ruins": "🏚", + "snow_mountain": "🏔", + "snowmen_field": "☃", + "test_zone": "👾", + "tundra": "🌲", + "vi": "🛖", + "volcano": "🌋" } }; \ No newline at end of file diff --git a/Lib/src/packets/commands/CommandReportPacket.ts b/Lib/src/packets/commands/CommandReportPacket.ts index dad5f9659..c8e657227 100644 --- a/Lib/src/packets/commands/CommandReportPacket.ts +++ b/Lib/src/packets/commands/CommandReportPacket.ts @@ -52,6 +52,8 @@ export class CommandReportRefusePveFightRes extends DraftBotPacket { export class CommandReportChooseDestinationRes extends DraftBotPacket { mapId!: number; + mapTypeId!: string; + tripDuration!: number; } diff --git a/Lib/src/packets/interaction/ReactionCollectorChooseDestination.ts b/Lib/src/packets/interaction/ReactionCollectorChooseDestination.ts index 53ad31f03..f1a936d1b 100644 --- a/Lib/src/packets/interaction/ReactionCollectorChooseDestination.ts +++ b/Lib/src/packets/interaction/ReactionCollectorChooseDestination.ts @@ -8,6 +8,8 @@ import { export class ReactionCollectorChooseDestinationReaction extends ReactionCollectorReaction { mapId!: number; + mapTypeId!: string; + tripDuration?: number; }