Commit bfee7219 authored by timel's avatar timel Committed by Chunchi Che

fix: change double equal sign to triple equal sign

parent b12eaa4c
Pipeline #22361 failed with stages
in 11 minutes and 55 seconds
...@@ -47,7 +47,7 @@ export class WebSocketStream { ...@@ -47,7 +47,7 @@ export class WebSocketStream {
reader.read().then(async function process({ done, value }): Promise<void> { reader.read().then(async function process({ done, value }): Promise<void> {
if (done) { if (done) {
if (ws.readyState == WebSocket.CLOSED) { if (ws.readyState === WebSocket.CLOSED) {
// websocket connection has been closed // websocket connection has been closed
console.info("WebSocket closed, stream complete."); console.info("WebSocket closed, stream complete.");
......
...@@ -8,8 +8,8 @@ export default async (announce: MsgAnnounce) => { ...@@ -8,8 +8,8 @@ export default async (announce: MsgAnnounce) => {
const type_ = announce.announce_type; const type_ = announce.announce_type;
let min = announce.min; let min = announce.min;
if ( if (
type_ == MsgAnnounce.AnnounceType.Card || type_ === MsgAnnounce.AnnounceType.Card ||
type_ == MsgAnnounce.AnnounceType.Number type_ === MsgAnnounce.AnnounceType.Number
) { ) {
min = 1; min = 1;
} }
......
...@@ -37,11 +37,11 @@ export default async (move: MsgMove) => { ...@@ -37,11 +37,11 @@ export default async (move: MsgMove) => {
const meta = await fetchCard(code); const meta = await fetchCard(code);
if (meta.data.type !== undefined && (meta.data.type & TYPE_TOKEN) > 0) { if (meta.data.type !== undefined && (meta.data.type & TYPE_TOKEN) > 0) {
// 衍生物 // 衍生物
if (from.zone == DECK) { if (from.zone === DECK) {
// 衍生物出场的场景,设置`from.zone`为`TZONE` // 衍生物出场的场景,设置`from.zone`为`TZONE`
from.zone = TZONE; from.zone = TZONE;
} }
if (to.zone == DECK) { if (to.zone === DECK) {
// 衍生物离开场上的场合,设置`to.zone`为`TZONE` // 衍生物离开场上的场合,设置`to.zone`为`TZONE`
to.zone = TZONE; to.zone = TZONE;
} }
...@@ -89,9 +89,9 @@ export default async (move: MsgMove) => { ...@@ -89,9 +89,9 @@ export default async (move: MsgMove) => {
} }
// 超量 // 超量
if (to.is_overlay && from.zone == MZONE) { if (to.is_overlay && from.zone === MZONE) {
// 准备超量召唤,超量素材入栈 // 准备超量召唤,超量素材入栈
if (reason == REASON_MATERIAL) { if (reason === REASON_MATERIAL) {
to.zone = MZONE; to.zone = MZONE;
overlayStack.push(to); overlayStack.push(to);
} }
...@@ -168,7 +168,7 @@ export default async (move: MsgMove) => { ...@@ -168,7 +168,7 @@ export default async (move: MsgMove) => {
} }
// 超量素材位置跟随超量怪兽移动 // 超量素材位置跟随超量怪兽移动
if (from.zone == MZONE && !from.is_overlay) { if (from.zone === MZONE && !from.is_overlay) {
for (const overlay of cardStore.findOverlay( for (const overlay of cardStore.findOverlay(
from.zone, from.zone,
from.controller, from.controller,
......
...@@ -18,9 +18,9 @@ export default async (selectChain: MsgSelectChain) => { ...@@ -18,9 +18,9 @@ export default async (selectChain: MsgSelectChain) => {
let handle_flag = 0; let handle_flag = 0;
if (!forced) { if (!forced) {
// 无强制发动的卡 // 无强制发动的卡
if (spCount == 0) { if (spCount === 0) {
// 无关键卡 // 无关键卡
if (chains.length == 0) { if (chains.length === 0) {
// 直接回答 // 直接回答
handle_flag = 0; handle_flag = 0;
} else { } else {
...@@ -34,7 +34,7 @@ export default async (selectChain: MsgSelectChain) => { ...@@ -34,7 +34,7 @@ export default async (selectChain: MsgSelectChain) => {
} }
} else { } else {
// 有关键卡 // 有关键卡
if (chains.length == 0) { if (chains.length === 0) {
// 根本没卡,直接回答 // 根本没卡,直接回答
handle_flag = 0; handle_flag = 0;
} else { } else {
...@@ -44,7 +44,7 @@ export default async (selectChain: MsgSelectChain) => { ...@@ -44,7 +44,7 @@ export default async (selectChain: MsgSelectChain) => {
} }
} else { } else {
// 有强制发动的卡 // 有强制发动的卡
if (chains.length == 1) { if (chains.length === 1) {
// 只有一个强制发动的连锁项,直接回应 // 只有一个强制发动的连锁项,直接回应
handle_flag = 4; handle_flag = 4;
} else { } else {
......
...@@ -11,7 +11,7 @@ export default async (selectEffectYn: MsgSelectEffectYn) => { ...@@ -11,7 +11,7 @@ export default async (selectEffectYn: MsgSelectEffectYn) => {
const effect_description = selectEffectYn.effect_description; const effect_description = selectEffectYn.effect_description;
const textGenerator = const textGenerator =
effect_description == 0 || effect_description == 221 effect_description === 0 || effect_description === 221
? ( ? (
desc: string, desc: string,
cardMeta: CardMeta, cardMeta: CardMeta,
......
...@@ -13,7 +13,7 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -13,7 +13,7 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
// 先初始化`matStore` // 先初始化`matStore`
matStore.selfType = start.playerType; matStore.selfType = start.playerType;
const opponent = const opponent =
start.playerType == ygopro.StocGameMessage.MsgStart.PlayerType.FirstStrike start.playerType === ygopro.StocGameMessage.MsgStart.PlayerType.FirstStrike
? 1 ? 1
: 0; : 0;
......
...@@ -10,9 +10,9 @@ export default async (toss: MsgToss) => { ...@@ -10,9 +10,9 @@ export default async (toss: MsgToss) => {
const prefix = fetchStrings("!system", matStore.isMe(player) ? 102 : 103); 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 = prefix + 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 =
prefix + prefix +
fetchStrings("!system", 1623) + fetchStrings("!system", 1623) +
......
...@@ -12,7 +12,7 @@ export default async (updateData: MsgUpdateData) => { ...@@ -12,7 +12,7 @@ export default async (updateData: MsgUpdateData) => {
const sequence = action.location?.sequence; const sequence = action.location?.sequence;
if (typeof sequence !== "undefined") { if (typeof sequence !== "undefined") {
const target = field const target = field
.filter((card) => card.location.sequence == sequence) .filter((card) => card.location.sequence === sequence)
.at(0); .at(0);
if (target) { if (target) {
// 目前只更新以下字段 // 目前只更新以下字段
......
...@@ -4,10 +4,10 @@ import { fetchEsHintMeta, matStore } from "@/stores"; ...@@ -4,10 +4,10 @@ import { fetchEsHintMeta, matStore } from "@/stores";
import MsgUpdateHp = ygopro.StocGameMessage.MsgUpdateHp; import MsgUpdateHp = ygopro.StocGameMessage.MsgUpdateHp;
export default (msgUpdateHp: MsgUpdateHp) => { export default (msgUpdateHp: MsgUpdateHp) => {
if (msgUpdateHp.type_ == MsgUpdateHp.ActionType.DAMAGE) { if (msgUpdateHp.type_ === MsgUpdateHp.ActionType.DAMAGE) {
fetchEsHintMeta({ originMsg: "玩家收到伤害时" }); // TODO: i18n fetchEsHintMeta({ originMsg: "玩家收到伤害时" }); // TODO: i18n
matStore.initInfo.of(msgUpdateHp.player).life -= msgUpdateHp.value; matStore.initInfo.of(msgUpdateHp.player).life -= msgUpdateHp.value;
} else if (msgUpdateHp.type_ == MsgUpdateHp.ActionType.RECOVER) { } else if (msgUpdateHp.type_ === MsgUpdateHp.ActionType.RECOVER) {
fetchEsHintMeta({ originMsg: "玩家生命值回复时" }); // TODO: i18n fetchEsHintMeta({ originMsg: "玩家生命值回复时" }); // TODO: i18n
matStore.initInfo.of(msgUpdateHp.player).life += msgUpdateHp.value; matStore.initInfo.of(msgUpdateHp.player).life += msgUpdateHp.value;
} }
......
...@@ -19,7 +19,7 @@ export default function handleSocketOpen( ...@@ -19,7 +19,7 @@ export default function handleSocketOpen(
) { ) {
console.log("WebSocket opened."); console.log("WebSocket opened.");
if (ws && ws.readyState == 1) { if (ws && ws.readyState === 1) {
ws.binaryType = "arraybuffer"; ws.binaryType = "arraybuffer";
sendPlayerInfo(ws, player); sendPlayerInfo(ws, player);
......
...@@ -29,23 +29,23 @@ export default function handleHsPlayerChange(pb: ygopro.YgoStocMsg) { ...@@ -29,23 +29,23 @@ export default function handleHsPlayerChange(pb: ygopro.YgoStocMsg) {
break; break;
} }
case ygopro.StocHsPlayerChange.State.READY: { case ygopro.StocHsPlayerChange.State.READY: {
playerStore[change.pos == 0 ? "player0" : "player1"].state = playerStore[change.pos === 0 ? "player0" : "player1"].state =
READY_STATE; READY_STATE;
break; break;
} }
case ygopro.StocHsPlayerChange.State.NO_READY: { case ygopro.StocHsPlayerChange.State.NO_READY: {
playerStore[change.pos == 0 ? "player0" : "player1"].state = playerStore[change.pos === 0 ? "player0" : "player1"].state =
NO_READY_STATE; NO_READY_STATE;
break; break;
} }
case ygopro.StocHsPlayerChange.State.LEAVE: { case ygopro.StocHsPlayerChange.State.LEAVE: {
playerStore[change.pos == 0 ? "player0" : "player1"] = {}; playerStore[change.pos === 0 ? "player0" : "player1"] = {};
break; break;
} }
case ygopro.StocHsPlayerChange.State.TO_OBSERVER: { case ygopro.StocHsPlayerChange.State.TO_OBSERVER: {
playerStore[change.pos == 0 ? "player0" : "player1"] = {}; // todo: 有没有必要? playerStore[change.pos === 0 ? "player0" : "player1"] = {}; // TODO: 有没有必要?
playerStore.observerCount += 1; playerStore.observerCount += 1;
break; break;
} }
......
...@@ -8,6 +8,6 @@ export default function handleHsPlayerEnter(pb: ygopro.YgoStocMsg) { ...@@ -8,6 +8,6 @@ export default function handleHsPlayerEnter(pb: ygopro.YgoStocMsg) {
if (pos > 1) { if (pos > 1) {
console.log("Currently only supported 2v2 mode."); console.log("Currently only supported 2v2 mode.");
} else { } else {
playerStore[pos == 0 ? "player0" : "player1"].name = name; playerStore[pos === 0 ? "player0" : "player1"].name = name;
} }
} }
...@@ -34,11 +34,11 @@ export const playerStore = proxy<PlayerState>({ ...@@ -34,11 +34,11 @@ export const playerStore = proxy<PlayerState>({
isHost: false, isHost: false,
selfType: SelfType.UNKNOWN, selfType: SelfType.UNKNOWN,
getMePlayer() { getMePlayer() {
if (this.selfType == SelfType.PLAYER1) return this.player0; if (this.selfType === SelfType.PLAYER1) return this.player0;
return this.player1; return this.player1;
}, },
getOpPlayer() { getOpPlayer() {
if (this.selfType == SelfType.PLAYER1) return this.player1; if (this.selfType === SelfType.PLAYER1) return this.player1;
return this.player0; return this.player0;
}, },
}); });
...@@ -24,7 +24,7 @@ export const CheckCounterModal = () => { ...@@ -24,7 +24,7 @@ export const CheckCounterModal = () => {
const [selected, setSelected] = useState(new Array(options.length)); const [selected, setSelected] = useState(new Array(options.length));
const sum = selected.reduce((sum, current) => sum + current, 0); const sum = selected.reduce((sum, current) => sum + current, 0);
const finishable = sum == min; const finishable = sum === min;
const onFinish = () => { const onFinish = () => {
sendSelectCounterResponse(selected); sendSelectCounterResponse(selected);
......
...@@ -89,7 +89,7 @@ export const SelectActionsModal: FC = () => { ...@@ -89,7 +89,7 @@ export const SelectActionsModal: FC = () => {
: sumLevel1 === totalLevels || sumLevel2 === totalLevels; : sumLevel1 === totalLevels || sumLevel2 === totalLevels;
setSubmitable( setSubmitable(
single single
? response.length == 1 ? response.length === 1
: response.length >= min && response.length <= max && levelMatched : response.length >= min && response.length <= max && levelMatched
); );
}, [response.length]); }, [response.length]);
......
...@@ -50,7 +50,7 @@ export const SortCardModal = () => { ...@@ -50,7 +50,7 @@ export const SortCardModal = () => {
if (active.id !== over?.id) { if (active.id !== over?.id) {
setItems((items) => { setItems((items) => {
const oldIndex = items.findIndex((item) => item.response == active.id); const oldIndex = items.findIndex((item) => item.response === active.id);
const newIndex = items.findIndex((item) => item.response === over?.id); const newIndex = items.findIndex((item) => item.response === over?.id);
// @ts-ignore // @ts-ignore
return arrayMove(items, oldIndex, newIndex); return arrayMove(items, oldIndex, newIndex);
......
...@@ -50,7 +50,7 @@ const NeosConfig = useConfig(); ...@@ -50,7 +50,7 @@ const NeosConfig = useConfig();
function getCardImgUrl(code: number, back = false) { function getCardImgUrl(code: number, back = false) {
const ASSETS_BASE = const ASSETS_BASE =
import.meta.env.BASE_URL == "/" import.meta.env.BASE_URL === "/"
? NeosConfig.assetsPath ? NeosConfig.assetsPath
: `${import.meta.env.BASE_URL}${NeosConfig.assetsPath}`; : `${import.meta.env.BASE_URL}${NeosConfig.assetsPath}`;
if (back) { if (back) {
......
...@@ -80,7 +80,7 @@ const WaitRoom = () => { ...@@ -80,7 +80,7 @@ const WaitRoom = () => {
// 初始化wasm // 初始化wasm
const url = const url =
import.meta.env.BASE_URL == "/" import.meta.env.BASE_URL === "/"
? undefined ? undefined
: new URL("rust_src_bg.wasm", `${import.meta.env.BASE_URL}assets/`); : new URL("rust_src_bg.wasm", `${import.meta.env.BASE_URL}assets/`);
await rustInit(url); await rustInit(url);
...@@ -122,9 +122,9 @@ const WaitRoom = () => { ...@@ -122,9 +122,9 @@ const WaitRoom = () => {
if ( if (
!( !(
deck.main.length == 0 && deck.main.length === 0 &&
deck.extra.length == 0 && deck.extra.length === 0 &&
deck.side.length == 0 deck.side.length === 0
) )
) { ) {
// YDK解析成功 // YDK解析成功
......
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