Commit df3f1d64 authored by Chunchi Che's avatar Chunchi Che

finish sibyl_name

parent 8839359e
Pipeline #22625 passed with stages
in 16 minutes and 7 seconds
...@@ -13,17 +13,21 @@ export default (data: Uint8Array) => { ...@@ -13,17 +13,21 @@ export default (data: Uint8Array) => {
const decoder = new TextDecoder("utf-16"); const decoder = new TextDecoder("utf-16");
let offset = 0; let offset = 0;
const name_0 = decoder.decode(data.slice(offset, offset + LEN)); const name_0 = cutString(decoder.decode(data.slice(offset, offset + LEN)));
offset += LEN; offset += LEN;
const name_0_tag = decoder.decode(data.slice(offset, offset + LEN)); const name_0_tag = cutString(
decoder.decode(data.slice(offset, offset + LEN))
);
offset += LEN; offset += LEN;
const name_0_c = decoder.decode(data.slice(offset, offset + LEN)); const name_0_c = cutString(decoder.decode(data.slice(offset, offset + LEN)));
offset += LEN; offset += LEN;
const name_1 = decoder.decode(data.slice(offset, offset + LEN)); const name_1 = cutString(decoder.decode(data.slice(offset, offset + LEN)));
offset += LEN; offset += LEN;
const name_1_tag = decoder.decode(data.slice(offset, offset + LEN)); const name_1_tag = cutString(
decoder.decode(data.slice(offset, offset + LEN))
);
offset += LEN; offset += LEN;
const name_1_c = decoder.decode(data.slice(offset, offset + LEN)); const name_1_c = cutString(decoder.decode(data.slice(offset, offset + LEN)));
return new MsgSibylName({ return new MsgSibylName({
name_0, name_0,
...@@ -34,3 +38,8 @@ export default (data: Uint8Array) => { ...@@ -34,3 +38,8 @@ export default (data: Uint8Array) => {
name_1_c, name_1_c,
}); });
}; };
function cutString(str: string): string {
const end = str.indexOf("\0");
return str.substring(0, end);
}
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { playerStore } from "@/stores";
type MsgSibylName = ygopro.StocGameMessage.MsgSibylName; type MsgSibylName = ygopro.StocGameMessage.MsgSibylName;
export default (sibylName: MsgSibylName) => { export default (sibylName: MsgSibylName) => {
console.log(sibylName); playerStore.getMePlayer().name = sibylName.name_0;
playerStore.getOpPlayer().name = sibylName.name_1;
}; };
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