Commit 277c93c4 authored by Chunchi Che's avatar Chunchi Che

fix

parent 2549ef0e
import { fetchStrings, ygopro } from "@/api"; import { fetchStrings, ygopro } from "@/api";
import { sleep } from "@/infra";
import { matStore } from "@/stores"; import { matStore } from "@/stores";
import MsgToss = ygopro.StocGameMessage.MsgToss; import MsgToss = ygopro.StocGameMessage.MsgToss;
export default (toss: MsgToss) => { export default async (toss: MsgToss) => {
const player = toss.player;
const tossType = toss.toss_type; const tossType = toss.toss_type;
const prefix = fetchStrings("!system", matStore.isMe(player) ? 102 : 103);
for (const x of toss.res) { for (const x of toss.res) {
if (tossType == MsgToss.TossType.DICE) { if (tossType == MsgToss.TossType.DICE) {
matStore.tossResult = fetchStrings("!system", 1624) + x; matStore.tossResult = prefix + fetchStrings("!system", 1624) + x;
} else if (tossType == MsgToss.TossType.COIN) { } else if (tossType == MsgToss.TossType.COIN) {
matStore.tossResult = matStore.tossResult =
fetchStrings("!system", 1623) + fetchStrings("!system", 60 + x); prefix +
fetchStrings("!system", 1623) +
fetchStrings("!system", 61 - x);
} else { } else {
console.log(`Unknown tossType = ${tossType}`); console.log(`Unknown tossType = ${tossType}`);
} }
// 等待1s,不然多个结果刷新太快了
await sleep(1000);
} }
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment