Skip to content

Commit

Permalink
small fixes fight history #2276
Browse files Browse the repository at this point in the history
Co-authored-by: romain22222 <[email protected]>
Signed-off-by: BastLast <[email protected]>
  • Loading branch information
BastLast and romain22222 committed Feb 27, 2025
1 parent ab603d4 commit 621f741
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 32 deletions.
10 changes: 1 addition & 9 deletions Core/src/core/fights/fighter/MonsterFighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,14 @@ export class MonsterFighter extends Fighter {
setTimeout(async function() {
// await embed.delete();
await fightView.fightController.executeFightAction(fightAction, true, response);
}, RandomUtils.draftbotRandom.integer(500, 2000));
}, RandomUtils.draftbotRandom.integer(300, 1800));
return Promise.resolve();
}

endFight(): Promise<void> {
return Promise.resolve();
}

getMention(): string {
return this.name;
}

getName(): string {
return this.name;
}

startFight(): Promise<void> {
return Promise.resolve();
}
Expand Down
12 changes: 0 additions & 12 deletions Core/src/core/fights/fighter/PlayerFighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,4 @@ export class PlayerFighter extends Fighter {
}
}
}

/**
* Send the choice action embed message
* @private
* @param fightView
*/
private async sendChooseActionEmbed(fightView: FightView): Promise<void> {
/* const chooseActionEmbed = new DraftBotEmbed();
chooseActionEmbed.formatAuthor(fightView.fightTranslationModule.format("turnIndicationsTitle", {pseudo: this.getName()}), this.getUser());
chooseActionEmbed.setDescription(fightView.fightTranslationModule.get("turnIndicationsDescription"));
return await fightView.channel.send({embeds: [chooseActionEmbed]}); */
}
}
16 changes: 9 additions & 7 deletions Discord/src/messages/DraftbotFightStatusCachedMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ export class DraftbotFightStatusCachedMessage extends DraftbotCachedMessage<Comm

updateMessage = async (packet: CommandFightStatusPacket, context: PacketContext): Promise<void> => {
const interaction = DiscordCache.getInteraction(context.discord!.interaction)!;
const attacker = (await KeycloakUtils.getUserByKeycloakId(keycloakConfig, packet.fightInitiator.keycloakId))!;
const defender = packet.fightOpponent.keycloakId ?
(await KeycloakUtils.getUserByKeycloakId(keycloakConfig, packet.fightOpponent.keycloakId))!.attributes.gameUsername[0] :
i18n.t(`models:monster.${packet.fightOpponent.monsterId}`, {lng: interaction.userLanguage});
const attacker = packet.activeFighter.keycloakId ?
(await KeycloakUtils.getUserByKeycloakId(keycloakConfig, packet.activeFighter.keycloakId))!.attributes.gameUsername[0] :
i18n.t(`models:monster.${packet.activeFighter.monsterId}`, {lng: interaction.userLanguage});
const defender = packet.defendingFighter.keycloakId ?
(await KeycloakUtils.getUserByKeycloakId(keycloakConfig, packet.defendingFighter.keycloakId))!.attributes.gameUsername[0] :
i18n.t(`models:monster.${packet.defendingFighter.monsterId}`, {lng: interaction.userLanguage});
const keyProlongation = packet.numberOfTurn > packet.maxNumberOfTurn ? "prolongation" : "noProlongation";

const embed = new DraftBotEmbed()
Expand All @@ -37,19 +39,19 @@ export class DraftbotFightStatusCachedMessage extends DraftbotCachedMessage<Comm
}) +
i18n.t("commands:fight.summarize.attacker", {
lng: interaction.userLanguage,
pseudo: attacker.attributes.gameUsername[0]
pseudo: attacker
}) +
i18n.t("commands:fight.summarize.stats", {
lng: interaction.userLanguage,
...packet.fightInitiator.stats
...packet.activeFighter.stats
}) +
i18n.t("commands:fight.summarize.defender", {
lng: interaction.userLanguage,
pseudo: defender
}) +
i18n.t("commands:fight.summarize.stats", {
lng: interaction.userLanguage,
...packet.fightOpponent.stats
...packet.defendingFighter.stats
})
);

Expand Down
9 changes: 5 additions & 4 deletions Lib/src/packets/fights/FightStatusPacket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ export class CommandFightStatusPacket extends DraftBotPacket {

maxNumberOfTurn!: number;

fightInitiator!: {
keycloakId: string;
glory: number;
activeFighter!: {
keycloakId?: string;
monsterId?: string;
glory?: number;
stats: {
power: number;
attack: number;
Expand All @@ -20,7 +21,7 @@ export class CommandFightStatusPacket extends DraftBotPacket {
}
};

fightOpponent!: {
defendingFighter!: {
keycloakId?: string;
monsterId?: string;
glory?: number;
Expand Down

0 comments on commit 621f741

Please sign in to comment.