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
700e81a1
Commit
700e81a1
authored
Oct 23, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add joinGame adapt
parent
11a8bd57
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
4 deletions
+36
-4
src/api/ocgcore/ocgAdapter/ctosJoinGame.ts
src/api/ocgcore/ocgAdapter/ctosJoinGame.ts
+30
-0
src/api/ocgcore/ocgAdapter/ctosPlayerInfo.ts
src/api/ocgcore/ocgAdapter/ctosPlayerInfo.ts
+2
-2
src/api/ocgcore/ocgHelper.ts
src/api/ocgcore/ocgHelper.ts
+4
-2
No files found.
src/api/ocgcore/ocgAdapter/ctosJoinGame.ts
0 → 100644
View file @
700e81a1
import
{
ygopro
}
from
"
../idl/ocgcore
"
;
import
{
ygoProPacket
}
from
"
./packet
"
;
const
littleEndian
:
boolean
=
true
;
const
CtosJoinGame
=
18
;
export
default
class
joinGamePacket
extends
ygoProPacket
{
constructor
(
pb
:
ygopro
.
YgoCtosMsg
)
{
const
encoder
=
new
TextEncoder
();
const
joinGame
=
pb
.
ctos_join_game
;
const
version
=
joinGame
.
version
;
const
gameId
=
joinGame
.
gameid
;
const
passWd
=
encoder
.
encode
(
joinGame
.
passwd
);
const
exDataLen
=
2
+
4
+
passWd
.
length
;
const
exData
=
new
Uint8Array
(
exDataLen
);
const
dataView
=
new
DataView
(
exData
);
dataView
.
setUint16
(
0
,
version
,
littleEndian
);
dataView
.
setUint8
(
2
,
gameId
&
0xff
);
dataView
.
setUint8
(
3
,
(
gameId
>>
8
)
&
0xff
);
dataView
.
setUint8
(
4
,
(
gameId
>>
16
)
&
0xff
);
dataView
.
setUint8
(
5
,
(
gameId
>>
32
)
&
0xff
);
exData
.
slice
(
6
,
exDataLen
).
set
(
passWd
);
super
(
exData
.
length
+
1
,
CtosJoinGame
,
exData
);
}
}
src/api/ocgcore/ocgAdapter/
p
layerInfo.ts
→
src/api/ocgcore/ocgAdapter/
ctosP
layerInfo.ts
View file @
700e81a1
import
{
ygopro
}
from
"
../idl/ocgcore
"
;
import
{
ygoProPacket
}
from
"
./packet
"
;
const
CtosPlayerInfo
=
16
;
const
CtosPlayerInfo
=
16
;
// todo: move protos in one place
export
class
playerInfoPacket
extends
ygoProPacket
{
export
default
class
playerInfoPacket
extends
ygoProPacket
{
constructor
(
pb
:
ygopro
.
YgoCtosMsg
)
{
const
encoder
=
new
TextEncoder
();
...
...
src/api/ocgcore/ocgHelper.ts
View file @
700e81a1
import
{
ygopro
}
from
"
./idl/ocgcore
"
;
import
socketMiddleWare
,
{
socketCmd
}
from
"
../../middleware/socket
"
;
import
{
IDeck
}
from
"
../Card
"
;
import
{
playerInfoPacket
}
from
"
./ocgAdapter/playerInfo
"
;
import
playerInfoPacket
from
"
./ocgAdapter/ctosPlayerInfo
"
;
import
joinGamePacket
from
"
./ocgAdapter/ctosJoinGame
"
;
export
function
sendUpdateDeck
(
deck
:
IDeck
)
{
const
updateDeck
=
new
ygopro
.
YgoCtosMsg
({
...
...
@@ -50,6 +51,7 @@ export function sendJoinGame(ws: WebSocket, version: number, passWd: string) {
passwd
:
passWd
,
}),
});
const
packet
=
new
joinGamePacket
(
joinGame
);
ws
.
send
(
joinGame
.
serialize
());
ws
.
send
(
packet
.
serialize
());
}
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