Skip to content

Commit

Permalink
missionShop done ! #2273
Browse files Browse the repository at this point in the history
  • Loading branch information
romain22222 committed Jan 15, 2025
1 parent 13a8e4f commit afda0e6
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 21 deletions.
2 changes: 0 additions & 2 deletions Core/src/commands/mission/MissionShopCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ function getSkipMapMissionShopItem(): ShopItem {
.build();

response.push(packet);


return false;
}
};
Expand Down
13 changes: 10 additions & 3 deletions Discord/src/commands/mission/MissionShop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export async function handleLovePointsValueShopItem(packet: CommandMissionShopPe
actualLP: packet.lovePoints,
diet: PetUtils.getDietDisplay(packet.diet, lng),
nextFeed: PetUtils.getFeedCooldownDisplay(packet.nextFeed, lng),
commentOnResult: StringUtils.getRandomTranslation(`commands:shop.shopItems.lovePointsValue.advice.${packet.loveLevel}`, lng)
commentOnResult: StringUtils.getRandomTranslation(`commands:shop.shopItems.lovePointsValue.advice.${packet.loveLevel}`, lng),
interpolation: {escapeValue: false}
}))
]
});
Expand All @@ -112,7 +113,9 @@ export async function skipMissionShopItemCollector(packet: ReactionCollectorCrea
.setDescription(`${i18n.t("commands:shop.shopItems.skipMission.giveDesc", {
lng: interaction.userLanguage
})}\n\n`);
const reactions: ReactionCollectorSkipMissionShopItemReaction[] = packet.reactions.map(reaction => reaction.data as ReactionCollectorSkipMissionShopItemReaction);
const reactions: ReactionCollectorSkipMissionShopItemReaction[] = packet.reactions
.map(reaction => reaction.data as ReactionCollectorSkipMissionShopItemReaction)
.filter(reaction => reaction.mission);
await DiscordCollectorUtils.createChoiceListCollector(
interaction,
embed,
Expand All @@ -125,7 +128,11 @@ export async function skipMissionShopItemCollector(packet: ReactionCollectorCrea

export async function skipMissionShopResult(packet: CommandMissionShopSkipMissionResult, context: PacketContext): Promise<void> {
const interaction = DiscordCache.getInteraction(context.discord!.interaction!);
await interaction?.followUp({
const buttonInteraction = DiscordCache.getButtonInteraction(context.discord!.buttonInteraction!);
if (!interaction) {
return;
}
await buttonInteraction?.editReply({
embeds: [
new DraftBotEmbed()
.formatAuthor(i18n.t("commands:shop.shopItems.skipMission.successTitle", {
Expand Down
2 changes: 1 addition & 1 deletion Discord/src/commands/player/ShopCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ async function manageBuyoutConfirmation(packet: ReactionCollectorCreationPacket,
}\n${EmoteUtils.translateEmojiToDiscord(DraftBotIcons.collectors.warning)}${
i18n.t(`commands:shop.shopItems.${shopItemTypeToId(shopItemId)}.info`, {
lng: interaction.userLanguage,
kingsMoneyAmount: data.additionnalShopData?.gemToMoneyRatio,
kingsMoneyAmount: data.additionnalShopData?.gemToMoneyRatio
})
}`)
],
Expand Down
2 changes: 1 addition & 1 deletion Discord/src/utils/ErrorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export async function handleClassicError(context: PacketContext, errorKey: strin
if (!interaction) {
return;
}
await (interaction.deferred ? interaction.editReply : interaction.reply)({
await (interaction.deferred ? interaction.editReply : interaction.replied ? interaction.followUp : interaction.reply)({
embeds: [
new DraftBotErrorEmbed(
interaction.user,
Expand Down
2 changes: 1 addition & 1 deletion Discord/src/utils/PetUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class PetUtils {
}

static getDietDisplay(diet: string | undefined, lng: Language): string {
return i18n.t(`models:diet.${diet}`, {lng});
return i18n.t("models:diet", {lng, context: diet ?? "omnivorous"});
}

static getFeedCooldownDisplay(nextFeed: number, lng: Language): string {
Expand Down
8 changes: 3 additions & 5 deletions Lang/fr/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -1331,9 +1331,7 @@
"commonFood_one": "friandise",
"commonFood_other": "friandises"
},
"diet": {
"diet_undefined": "{emote:diet.omnivorous} Omnivore",
"diet_herbivorous": "{emote:diet.herbivorous} Herbivore",
"diet_carnivorous": "{emote:diet.carnivorous} Carnivore"
}
"diet_omnivorous": "{emote:diet.omnivorous} Omnivore",
"diet_herbivorous": "{emote:diet.herbivorous} Herbivore",
"diet_carnivorous": "{emote:diet.carnivorous} Carnivore"
}
16 changes: 8 additions & 8 deletions Lib/src/constants/BadgeConstants.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
export abstract class BadgeConstants {
static readonly POWERFUL_GUILD: "💎";
export class BadgeConstants {
static readonly POWERFUL_GUILD = "💎";

static readonly VERY_POWERFUL_GUILD: "🪩";
static readonly VERY_POWERFUL_GUILD = "🪩";

static readonly STAFF_MEMBER: "⚙️";
static readonly STAFF_MEMBER = "⚙️";

static readonly QUEST_MASTER: "💍";
static readonly QUEST_MASTER = "💍";

static readonly RICH_PERSON: "🤑";
static readonly RICH_PERSON = "🤑";

static readonly PET_TAMER: "💞";
static readonly PET_TAMER = "💞";

static readonly LIST_FOR_GIVE_BADGE_COMMAND: [
static readonly LIST_FOR_GIVE_BADGE_COMMAND = [
"🏅",
"⚙️",
"✨",
Expand Down

0 comments on commit afda0e6

Please sign in to comment.