Skip to content

Commit

Permalink
updated blocking constant + add romain stupid but funny suggestion #2273
Browse files Browse the repository at this point in the history
  • Loading branch information
BastLast committed Jan 13, 2025
1 parent c157fc3 commit a59fad4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Core/src/commands/player/FightCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default class FightCommand {
},
endCallback
)
.block(player.id, BlockingConstants.REASONS.FIGHT)
.block(player.id, BlockingConstants.REASONS.FIGHT_CONFIRMATION)
.build();

response.push(collectorPacket);
Expand Down
6 changes: 6 additions & 0 deletions Discord/src/commands/player/FightCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ import {
} from "../../../../Lib/src/packets/commands/CommandFightPacket";
import {ReactionCollectorFightData} from "../../../../Lib/src/packets/interaction/ReactionCollectorFight";
import {KeycloakUser} from "../../../../Lib/src/keycloak/KeycloakUser";
import {RandomUtils} from "../../../../Lib/src/utils/RandomUtils";
import {FightConstants} from "../../../../Lib/src/constants/FightConstants";

export async function createFightCollector(packet: ReactionCollectorCreationPacket, context: PacketContext): Promise<void> {
const interaction = DiscordCache.getInteraction(context.discord!.interaction)!;
await interaction.deferReply();
const data = packet.data.data as ReactionCollectorFightData;
const subTextKey = RandomUtils.draftbotRandom.bool(FightConstants.RARE_SUB_TEXT_INTRO) ? "rare" : "common"

Check failure on line 26 in Discord/src/commands/player/FightCommand.ts

View workflow job for this annotation

GitHub Actions / eslint-discord-module

Missing semicolon
const embed = new DraftBotEmbed().formatAuthor(i18n.t("commands:fight.title", {
lng: interaction.userLanguage,
pseudo: interaction.user.displayName
Expand All @@ -29,6 +32,9 @@ export async function createFightCollector(packet: ReactionCollectorCreationPack
i18n.t("commands:fight.confirmDesc", {
lng: interaction.userLanguage,
pseudo: interaction.user.displayName,
confirmSubText: i18n.t("commands:fight.confirmSubTexts."+ subTextKey, {

Check warning on line 35 in Discord/src/commands/player/FightCommand.ts

View workflow job for this annotation

GitHub Actions / eslint-discord-module

Operator '+' must be spaced
lng: interaction.userLanguage
}),
glory: i18n.t("commands:fight:information.glory", {
lng: interaction.userLanguage,
gloryPoints: data.playerStats.fightRanking.glory
Expand Down
6 changes: 5 additions & 1 deletion Lang/fr/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,11 @@
"fight": {
"title": "{{pseudo}}, vous êtes sur le point de démarrer un combat",
"canceledTitle": "{{pseudo}}, vous avez annulé la recherche",
"confirmDesc": ":crossed_swords: | **{{pseudo}}**, vous souhaitez lancer une recherche de combat ? Pour accepter, cliquez sur le bouton ci-dessous.\n\n:crossed_swords: | **Combattant : {{pseudo}}** | {{glory}} | {{className}}\n\n{{stats}}",
"confirmDesc": ":crossed_swords: | **{{pseudo}}**{{confirmSubText}}\n\n:crossed_swords: | **Combattant : {{pseudo}}** | {{glory}} | {{className}}\n\n{{stats}}",
"confirmSubTexts": {
"common": ", vous souhaitez lancer une recherche de combat ?",
"rare": ", voudriez-vous participer à la recherche d'un combattant adéquat à votre puissance personnelle afin d'effectuer le duel subséquent ?"
},
"canceledDesc": "Vous avez refusé la recherche de combat.",
"information": {
"glory": ":sparkles: {{gloryPoints}}",
Expand Down
1 change: 1 addition & 0 deletions Lang/fr/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"descriptionEdit": "édition de la description de guilde",
"drink": "choix de boire une potion ou non",
"fight": "combat",
"fightConfirmation": "choix de débuter un combat ou non",
"fightPetChoose": "choix d'une action pour le combat de familier",
"gobletChoose": "choix d'un gobelet",
"guildCreate": "création d'une guilde",
Expand Down
1 change: 1 addition & 0 deletions Lib/src/constants/BlockingConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export abstract class BlockingConstants {
CLASS: "class",
DRINK: "drink",
FIGHT: "fight",
FIGHT_CONFIRMATION: "fightConfirmation",
GOBLET_CHOOSE: "gobletChoose",
WITCH_CHOOSE: "witchChoose",
FIGHT_PET_CHOOSE: "fightPetChoose",
Expand Down
2 changes: 2 additions & 0 deletions Lib/src/constants/FightConstants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export abstract class FightConstants {
static readonly RARE_SUB_TEXT_INTRO = 0.001 // chance of having rare subtext (1=100%)

Check warning on line 2 in Lib/src/constants/FightConstants.ts

View workflow job for this annotation

GitHub Actions / eslint-lib-module

Multiple spaces found before 'RARE_SUB_TEXT_INTRO'

Check failure on line 2 in Lib/src/constants/FightConstants.ts

View workflow job for this annotation

GitHub Actions / eslint-lib-module

Missing semicolon

Check failure on line 2 in Lib/src/constants/FightConstants.ts

View workflow job for this annotation

GitHub Actions / eslint-lib-module

Comments should not begin with a lowercase character

Check warning on line 2 in Lib/src/constants/FightConstants.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Lib/src/constants/FightConstants.ts#L2

Comments should not begin with a lowercase character.

static readonly MAX_TURNS = 24;

static readonly REQUIRED_LEVEL = 8;
Expand Down

0 comments on commit a59fad4

Please sign in to comment.