Commit 19073671 authored by timel's avatar timel

fix: remove useless await

parent 338735da
......@@ -36,6 +36,6 @@ export async function getStrings(description: number): Promise<string> {
const code = description >> 4;
const index = description & 0xf;
return getCardStr(await fetchCard(code), index) || "";
return getCardStr(fetchCard(code), index) || "";
}
}
......@@ -40,7 +40,7 @@ export default async (announce: MsgAnnounce) => {
case MsgAnnounce.AnnounceType.Card: {
const options = [];
for (const option of announce.options) {
const meta = await fetchCard(option.code);
const meta = fetchCard(option.code);
if (meta.text.name) {
options.push({
info: meta.text.name,
......
......@@ -18,7 +18,7 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => {
// 设置连锁序号
target.chainIndex = matStore.chains.length;
const meta = await fetchCard(chaining.code);
const meta = fetchCard(chaining.code);
// 这里不能设置`code`,因为存在一个场景:
// 对方的`魔神仪-曼德拉护肤草`发动效果后,后端会发一次`MSG_SHUFFLE_HAND`,但传给前端的codes全是0,如果这里设置了`code`的话,在后面的`MSG_SHUFFLE_HAND`处理就会有问题。
// target.code = meta.id;
......
......@@ -11,7 +11,7 @@ export default async (confirmCards: ygopro.StocGameMessage.MsgConfirmCards) => {
if (target) {
// 设置`occupant`
const meta = await fetchCard(card.code);
const meta = fetchCard(card.code);
target.meta = meta;
// 动画
await callCardFocus(target.uuid);
......
......@@ -17,7 +17,7 @@ export default async (draw: ygopro.StocGameMessage.MsgDraw) => {
for (const idx in newHands) {
const card = newHands[Number(idx)];
const code = draw.cards[idx];
const meta = await fetchCard(code);
const meta = fetchCard(code);
card.code = code;
card.meta = meta;
card.location.zone = ygopro.CardZone.HAND;
......
......@@ -34,7 +34,7 @@ export default async (move: MsgMove) => {
const to = move.to;
const reason = move.reason;
const meta = await fetchCard(code);
const meta = fetchCard(code);
if (meta.data.type !== undefined && (meta.data.type & TYPE_TOKEN) > 0) {
// 衍生物
if (from.zone === DECK) {
......
......@@ -32,6 +32,6 @@ export default async (selectEffectYn: MsgSelectEffectYn) => {
// TODO: 国际化文案
const desc = fetchStrings(Region.System, effect_description);
const meta = await fetchCard(code);
const meta = fetchCard(code);
await displayYesNoModal(textGenerator(desc, meta, location));
};
......@@ -13,7 +13,7 @@ export default async (selectOption: ygopro.StocGameMessage.MsgSelectOption) => {
fetchStrings(Region.System, 556),
await Promise.all(
options.map(async ({ code, response }) => {
const meta = await fetchCard(code >> 4);
const meta = fetchCard(code >> 4);
const msg = getCardStr(meta, code & 0xf) || "[?]";
return { msg, response };
}),
......
......@@ -6,7 +6,7 @@ type MsgSortCard = ygopro.StocGameMessage.MsgSortCard;
export default async (sortCard: MsgSortCard) => {
const options = await Promise.all(
sortCard.options.map(async ({ code, response }) => {
const meta = await fetchCard(code!);
const meta = fetchCard(code!);
return {
meta,
response: response!,
......
......@@ -106,7 +106,7 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
const genCard = (o: CardType) => {
const t = proxy(o);
subscribeKey(t, "code", async (code) => {
const meta = await fetchCard(code ?? 0);
const meta = fetchCard(code ?? 0);
t.meta = meta;
});
return t;
......
......@@ -16,7 +16,7 @@ export default async (updateData: MsgUpdateData) => {
if (target) {
// 目前只更新以下字段
if (action?.code >= 0) {
const newMeta = await fetchCard(action.code);
const newMeta = fetchCard(action.code);
target.code = action.code;
target.meta = newMeta;
}
......
......@@ -24,7 +24,7 @@ export default async function handleErrorMsg(errorMsg: ygopro.StocErrorMsg) {
case ErrorType.DECKERROR: {
const flag = error_code >> 28;
const code = error_code && 0xfffffff;
const card = await fetchCard(code);
const card = fetchCard(code);
const baseMsg = `卡组非法,请检查:${card.text.name}`;
switch (flag) {
case DECKERROR_LFLIST: {
......
......@@ -30,7 +30,7 @@ const helper = async (
code !== 0
? code
: cardStore.at(location.zone, controller, location.sequence)?.code || 0;
const meta = await fetchCard(newID);
const meta = fetchCard(newID);
const effectDesc = effect_description
? getCardStr(meta, effect_description & 0xf)
......
......@@ -22,7 +22,7 @@ export const fetchSelectHintMeta = async ({
let selectHintMeta = "";
if (selectHintData > DESCRIPTION_LIMIT) {
// 针对`MSG_SELECT_PLACE`的特化逻辑
const cardMeta = await fetchCard(selectHintData);
const cardMeta = fetchCard(selectHintData);
selectHintMeta = fetchStrings(Region.System, 569).replace(
"[%ls]",
cardMeta.text.name || "[?]",
......@@ -55,7 +55,7 @@ export const fetchEsHintMeta = async ({
? originMsg
: fetchStrings(Region.System, originMsg);
const cardMeta = cardID ? await fetchCard(cardID) : undefined;
const cardMeta = cardID ? fetchCard(cardID) : undefined;
let esHint = newOriginMsg;
......
......@@ -260,8 +260,8 @@ const Search: React.FC = () => {
] as const
).map(([label, onClick], key) => ({ key, label, onClick }));
const handleSearch = async (conditions: FtsConditions = searchConditions) => {
const result = (await searchCards({ query: searchWord, conditions }))
const handleSearch = (conditions: FtsConditions = searchConditions) => {
const result = searchCards({ query: searchWord, conditions })
.filter((card) => !isToken(card.data.type ?? 0))
.sort(sortRef.current); // 衍生物不显示
setSearchResult(() => result);
......
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