Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
be7b2323
Commit
be7b2323
authored
Oct 24, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add StocHsPlayerEnter adapt
parent
d26cac3a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
2 deletions
+45
-2
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter.ts
src/api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter.ts
+32
-0
src/api/ocgcore/ocgAdapter/util.ts
src/api/ocgcore/ocgAdapter/util.ts
+1
-1
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+11
-1
No files found.
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
be7b2323
...
...
@@ -5,3 +5,4 @@ export const CTOS_HS_READY = 34;
export
const
STOC_JOIN_GAME
=
18
;
export
const
STOC_CHAT
=
25
;
export
const
STOC_HS_PLAYER_ENTER
=
32
;
src/api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter.ts
0 → 100644
View file @
be7b2323
import
{
ygopro
}
from
"
../../idl/ocgcore
"
;
import
{
ygoProPacket
,
ygoProtobuf
}
from
"
../packet
"
;
import
{
UTF16_BUFFER_MAX_LEN
}
from
"
../util
"
;
const
UINT8_PER_UINT16
=
2
;
export
default
class
StocHsPlayerEnter
implements
ygoProtobuf
{
packet
:
ygoProPacket
;
constructor
(
packet
:
ygoProPacket
)
{
this
.
packet
=
packet
;
}
adapt
():
ygopro
.
YgoStocMsg
{
const
exData
=
this
.
packet
.
exData
;
const
decoder
=
new
TextDecoder
(
"
utf-16
"
);
const
name
=
decoder
.
decode
(
exData
.
slice
(
0
,
UTF16_BUFFER_MAX_LEN
*
UINT8_PER_UINT16
)
);
const
dataView
=
new
DataView
(
exData
.
buffer
);
const
pos
=
dataView
.
getInt8
(
UTF16_BUFFER_MAX_LEN
*
UINT8_PER_UINT16
)
&
0x3
;
return
new
ygopro
.
YgoStocMsg
({
stoc_hs_player_enter
:
new
ygopro
.
StocHsPlayerEnter
({
name
,
pos
,
}),
});
}
}
src/api/ocgcore/ocgAdapter/util.ts
View file @
be7b2323
const
UTF16_BUFFER_MAX_LEN
=
20
;
export
const
UTF16_BUFFER_MAX_LEN
=
20
;
const
FILLING_TOKEN
:
number
=
0xcccc
;
export
function
strEncodeUTF16
(
str
:
string
)
{
...
...
src/service/onSocketMessage.ts
View file @
be7b2323
...
...
@@ -7,8 +7,13 @@ import handleChat from "./room/chat";
import
handleHsWatchChange
from
"
./room/hsWatchChange
"
;
import
{
ygoArrayBuilder
}
from
"
../api/ocgcore/ocgAdapter/packet
"
;
import
StocJoinGame
from
"
../api/ocgcore/ocgAdapter/stoc/stocJoinGame
"
;
import
{
STOC_CHAT
,
STOC_JOIN_GAME
}
from
"
../api/ocgcore/ocgAdapter/protoDecl
"
;
import
{
STOC_CHAT
,
STOC_HS_PLAYER_ENTER
,
STOC_JOIN_GAME
,
}
from
"
../api/ocgcore/ocgAdapter/protoDecl
"
;
import
StocChat
from
"
../api/ocgcore/ocgAdapter/stoc/stocChat
"
;
import
StocHsPlayerEnter
from
"
../api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter
"
;
export
default
function
handleSocketMessage
(
e
:
MessageEvent
)
{
const
packet
=
new
ygoArrayBuilder
(
e
.
data
);
...
...
@@ -26,6 +31,11 @@ export default function handleSocketMessage(e: MessageEvent) {
break
;
}
case
STOC_HS_PLAYER_ENTER
:
{
pb
=
new
StocHsPlayerEnter
(
packet
).
adapt
();
break
;
}
default
:
{
break
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment