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
02574a7e
Commit
02574a7e
authored
Jan 15, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update penetrate.ts and penetrate.json
parent
6f421e01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
+14
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
+23
-2
No files found.
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
View file @
02574a7e
...
@@ -20,4 +20,18 @@
...
@@ -20,4 +20,18 @@
}
}
]
]
}
}
"33"
:
{
"protoType"
:
"shuffle_hand"
,
"fields"
:
[
{
"fieldName"
:
"player"
,
"fieldType"
:
"uint8"
},
{
"fieldName"
:
"hands"
,
"fieldType"
:
"repeated"
,
"repeatedType"
:
"uint32"
}
]
}
}
}
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
View file @
02574a7e
...
@@ -13,7 +13,8 @@ const ReadFieldHandlerMap: Map<string, readFieldHandler> = new Map([
...
@@ -13,7 +13,8 @@ const ReadFieldHandlerMap: Map<string, readFieldHandler> = new Map([
[
"
CardLocation
"
,
(
reader
)
=>
reader
.
readCardLocation
()],
[
"
CardLocation
"
,
(
reader
)
=>
reader
.
readCardLocation
()],
]);
]);
const
MsgConstructorMap
:
Map
<
string
,
Constructor
>
=
new
Map
([
const
MsgConstructorMap
:
Map
<
string
,
Constructor
>
=
new
Map
([
[
"
move
"
,
ygopro
.
StocGameMessage
.
MsgMove
],
[
"
move
"
,
ygopro
.
StocGameMessage
.
MsgMove
as
Constructor
],
[
"
shuffle_hand
"
,
ygopro
.
StocGameMessage
.
MsgShuffleHand
],
]);
]);
export
interface
penetrateType
{
export
interface
penetrateType
{
...
@@ -21,6 +22,7 @@ export interface penetrateType {
...
@@ -21,6 +22,7 @@ export interface penetrateType {
fields
:
{
fields
:
{
fieldName
:
string
;
fieldName
:
string
;
fieldType
:
string
;
fieldType
:
string
;
repeatedType
?:
string
;
}[];
}[];
}
}
...
@@ -46,6 +48,22 @@ class PenetrateManager {
...
@@ -46,6 +48,22 @@ class PenetrateManager {
return
undefined
;
return
undefined
;
}
}
private
readRepeatedField
(
reader
:
BufferReader
,
repeatedType
:
string
):
any
{
const
handler
=
this
.
readFieldHandlerMap
.
get
(
repeatedType
);
if
(
handler
)
{
const
count
=
reader
.
readUint8
();
let
repeated
=
[];
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
repeated
.
push
(
handler
(
reader
));
}
return
repeated
;
}
return
undefined
;
}
private
constructMsg
(
protoType
:
string
,
object
:
any
):
any
{
private
constructMsg
(
protoType
:
string
,
object
:
any
):
any
{
const
constructor
=
this
.
msgConstructorMap
.
get
(
protoType
);
const
constructor
=
this
.
msgConstructorMap
.
get
(
protoType
);
...
@@ -65,7 +83,10 @@ class PenetrateManager {
...
@@ -65,7 +83,10 @@ class PenetrateManager {
let
object
:
any
=
{};
let
object
:
any
=
{};
for
(
let
field
of
fields
)
{
for
(
let
field
of
fields
)
{
object
[
field
.
fieldName
]
=
this
.
readField
(
reader
,
field
.
fieldType
);
object
[
field
.
fieldName
]
=
field
.
fieldType
===
"
repeated
"
&&
field
.
repeatedType
?
this
.
readRepeatedField
(
reader
,
field
.
repeatedType
)
:
this
.
readField
(
reader
,
field
.
fieldType
);
}
}
gameMsg
[
protoType
]
=
this
.
constructMsg
(
protoType
,
object
);
gameMsg
[
protoType
]
=
this
.
constructMsg
(
protoType
,
object
);
...
...
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