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
cc2f4cab
Commit
cc2f4cab
authored
Oct 23, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix small
parent
fec7bf6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
src/api/ocgcore/ocgAdapter/ctosJoinGame.ts
src/api/ocgcore/ocgAdapter/ctosJoinGame.ts
+1
-1
src/api/ocgcore/ocgAdapter/packet.ts
src/api/ocgcore/ocgAdapter/packet.ts
+14
-12
src/service/room/joinGame.ts
src/service/room/joinGame.ts
+2
-0
No files found.
src/api/ocgcore/ocgAdapter/ctosJoinGame.ts
View file @
cc2f4cab
...
@@ -15,7 +15,7 @@ export default class CtosJoinGamePacket extends ygoProPacket {
...
@@ -15,7 +15,7 @@ export default class CtosJoinGamePacket extends ygoProPacket {
const
exDataLen
=
2
+
4
+
passWd
.
length
;
const
exDataLen
=
2
+
4
+
passWd
.
length
;
const
exData
=
new
Uint8Array
(
exDataLen
);
const
exData
=
new
Uint8Array
(
exDataLen
);
const
dataView
=
new
DataView
(
exData
);
const
dataView
=
new
DataView
(
exData
.
buffer
);
dataView
.
setUint16
(
0
,
version
,
littleEndian
);
dataView
.
setUint16
(
0
,
version
,
littleEndian
);
dataView
.
setUint8
(
2
,
gameId
&
0xff
);
dataView
.
setUint8
(
2
,
gameId
&
0xff
);
...
...
src/api/ocgcore/ocgAdapter/packet.ts
View file @
cc2f4cab
...
@@ -20,7 +20,7 @@ export class ygoProPacket {
...
@@ -20,7 +20,7 @@ export class ygoProPacket {
const
exData
=
this
.
exData
||
new
Uint8Array
();
const
exData
=
this
.
exData
||
new
Uint8Array
();
const
array
=
new
Uint8Array
(
packetLen
+
2
);
const
array
=
new
Uint8Array
(
packetLen
+
2
);
const
dataView
=
new
DataView
(
array
);
const
dataView
=
new
DataView
(
array
.
buffer
);
dataView
.
setUint16
(
0
,
packetLen
,
littleEndian
);
dataView
.
setUint16
(
0
,
packetLen
,
littleEndian
);
dataView
.
setUint8
(
2
,
proto
);
dataView
.
setUint8
(
2
,
proto
);
...
@@ -31,22 +31,24 @@ export class ygoProPacket {
...
@@ -31,22 +31,24 @@ export class ygoProPacket {
}
}
export
class
ygoArrayBuilder
extends
ygoProPacket
{
export
class
ygoArrayBuilder
extends
ygoProPacket
{
constructor
(
array
:
Uint8Array
)
{
constructor
(
array
:
ArrayBuffer
)
{
try
{
try
{
if
(
array
.
length
<
PACKET_MIN_LEN
)
{
if
(
array
.
byteLength
<
PACKET_MIN_LEN
)
{
throw
new
Error
(
"
Packet length too short, length =
"
+
array
.
length
);
throw
new
Error
(
}
else
{
"
Packet length too short, length =
"
+
array
.
byteLength
const
dataView
=
new
DataView
(
array
);
);
const
packetLen
=
dataView
.
getInt16
(
0
,
littleEndian
);
const
proto
=
dataView
.
getInt8
(
2
);
const
exData
=
array
.
slice
(
3
,
packetLen
+
2
);
super
(
packetLen
,
proto
,
exData
);
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
[e][ygoProPacket][constructor]
"
+
e
);
console
.
log
(
"
[e][ygoProPacket][constructor]
"
+
e
);
}
}
const
dataView
=
new
DataView
(
array
);
const
packetLen
=
dataView
.
getInt16
(
0
,
littleEndian
);
const
proto
=
dataView
.
getInt8
(
2
);
const
exData
=
array
.
slice
(
3
,
packetLen
+
2
);
super
(
packetLen
,
proto
,
new
Uint8Array
(
exData
));
}
}
}
}
...
...
src/service/room/joinGame.ts
View file @
cc2f4cab
...
@@ -3,6 +3,8 @@ import { store } from "../../store";
...
@@ -3,6 +3,8 @@ import { store } from "../../store";
import
{
setJoined
}
from
"
../../reducers/joinSlice
"
;
import
{
setJoined
}
from
"
../../reducers/joinSlice
"
;
export
default
function
handleJoinGame
(
pb
:
ygopro
.
YgoStocMsg
)
{
export
default
function
handleJoinGame
(
pb
:
ygopro
.
YgoStocMsg
)
{
console
.
log
(
"
Game joined!
"
);
const
dispatch
=
store
.
dispatch
;
const
dispatch
=
store
.
dispatch
;
const
msg
=
pb
.
stoc_join_game
;
const
msg
=
pb
.
stoc_join_game
;
...
...
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