Commit 1b7e9441 authored by Chunchi Che's avatar Chunchi Che Committed by WANG HE

add StocHsWatchChange adapt

parent b782b679
......@@ -7,3 +7,4 @@ export const STOC_JOIN_GAME = 18;
export const STOC_CHAT = 25;
export const STOC_HS_PLAYER_ENTER = 32;
export const STOC_HS_PLAYER_CHANGE = 33;
export const STOC_HS_WATCH_CHANGE = 34;
import { ygopro } from "../../idl/ocgcore";
import { ygoProPacket, ygoProtobuf } from "../packet";
export default class StocHsWatchChange implements ygoProtobuf {
packet: ygoProPacket;
constructor(packet: ygoProPacket) {
this.packet = packet;
}
adapt(): ygopro.YgoStocMsg {
const count = new DataView(this.packet.exData.buffer).getUint16(0, true);
return new ygopro.YgoStocMsg({
stoc_hs_watch_change: new ygopro.StocHsWatchChange({
count,
}),
});
}
}
......@@ -11,11 +11,13 @@ import {
STOC_CHAT,
STOC_HS_PLAYER_CHANGE,
STOC_HS_PLAYER_ENTER,
STOC_HS_WATCH_CHANGE,
STOC_JOIN_GAME,
} from "../api/ocgcore/ocgAdapter/protoDecl";
import StocChat from "../api/ocgcore/ocgAdapter/stoc/stocChat";
import StocHsPlayerEnter from "../api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter";
import StocHsPlayerChange from "../api/ocgcore/ocgAdapter/stoc/stocHsPlayerChange";
import StocHsWatchChange from "../api/ocgcore/ocgAdapter/stoc/stocHsWatchChange";
export default function handleSocketMessage(e: MessageEvent) {
const packet = new ygoArrayBuilder(e.data);
......@@ -43,6 +45,11 @@ export default function handleSocketMessage(e: MessageEvent) {
break;
}
case STOC_HS_WATCH_CHANGE: {
pb = new StocHsWatchChange(packet).adapt();
break;
}
default: {
break;
}
......
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