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
00ec60e9
Commit
00ec60e9
authored
Dec 25, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add selectPlaceResponse ctos adapter
parent
553039ec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
0 deletions
+80
-0
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
+6
-0
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/selectPlace.ts
...cgcore/ocgAdapter/ctos/ctosGameMsgResponse/selectPlace.ts
+14
-0
src/api/ocgcore/ocgAdapter/util.ts
src/api/ocgcore/ocgAdapter/util.ts
+41
-0
src/api/ocgcore/ocgHelper.ts
src/api/ocgcore/ocgHelper.ts
+19
-0
No files found.
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
View file @
00ec60e9
...
...
@@ -2,6 +2,7 @@ import { ygopro } from "../../../idl/ocgcore";
import
{
YgoProPacket
}
from
"
../../packet
"
;
import
{
CTOS_RESPONSE
}
from
"
../../protoDecl
"
;
import
adaptSelectIdleCmdResponse
from
"
./selectIdleCmd
"
;
import
adaptSelectPlaceResponse
from
"
./selectPlace
"
;
/*
* CTOS CTOS_RESPONSE
...
...
@@ -22,6 +23,11 @@ export default class CtosResponsePacket extends YgoProPacket {
break
;
}
case
"
select_place
"
:
{
extraData
=
adaptSelectPlaceResponse
(
response
.
select_place
);
break
;
}
default
:
{
break
;
}
...
...
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/selectPlace.ts
0 → 100644
View file @
00ec60e9
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferWriter
}
from
"
../../bufferIO
"
;
import
{
cardZoneToNumber
}
from
"
../../util
"
;
export
default
(
response
:
ygopro
.
CtosGameMsgResponse
.
SelectPlaceResponse
)
=>
{
const
array
=
new
Uint8Array
(
3
);
const
writer
=
new
BufferWriter
(
array
,
true
);
writer
.
writeUint8
(
response
.
player
);
writer
.
writeUint8
(
cardZoneToNumber
(
response
.
zone
));
writer
.
writeUint8
(
response
.
sequence
);
return
array
;
};
src/api/ocgcore/ocgAdapter/util.ts
View file @
00ec60e9
...
...
@@ -2,6 +2,9 @@
* 一些基础函数。
*
* */
import
{
ygopro
}
from
"
../idl/ocgcore
"
;
export
const
UTF16_BUFFER_MAX_LEN
=
20
;
const
FILLING_TOKEN
:
number
=
0xcccc
;
...
...
@@ -72,3 +75,41 @@ export function utf8ArrayToStr(array: Uint8Array) {
return
out
;
}
export
function
cardZoneToNumber
(
zone
:
ygopro
.
CardZone
):
number
{
switch
(
zone
)
{
case
ygopro
.
CardZone
.
DECK
:
{
return
0x01
;
}
case
ygopro
.
CardZone
.
HAND
:
{
return
0x02
;
}
case
ygopro
.
CardZone
.
MZONE
:
{
return
0x04
;
}
case
ygopro
.
CardZone
.
SZONE
:
{
return
0x08
;
}
case
ygopro
.
CardZone
.
GRAVE
:
{
return
0x10
;
}
case
ygopro
.
CardZone
.
REMOVED
:
{
return
0x20
;
}
case
ygopro
.
CardZone
.
EXTRA
:
{
return
0x40
;
}
case
ygopro
.
CardZone
.
OVERLAY
:
{
return
0x80
;
}
case
ygopro
.
CardZone
.
ONFIELD
:
{
return
0x0c
;
}
case
ygopro
.
CardZone
.
FZONE
:
{
return
0x100
;
}
case
ygopro
.
CardZone
.
PZONE
:
{
return
0x200
;
}
}
}
src/api/ocgcore/ocgHelper.ts
View file @
00ec60e9
...
...
@@ -131,3 +131,22 @@ export function sendSelectIdleCmdResponse(value: number) {
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
export
function
sendSelectPlaceResponse
(
value
:
{
controler
:
number
;
zone
:
ygopro
.
CardZone
;
sequence
:
number
;
})
{
const
response
=
new
ygopro
.
YgoCtosMsg
({
ctos_response
:
new
ygopro
.
CtosGameMsgResponse
({
select_place
:
new
ygopro
.
CtosGameMsgResponse
.
SelectPlaceResponse
({
player
:
value
.
controler
,
zone
:
value
.
zone
,
sequence
:
value
.
sequence
,
}),
}),
});
const
payload
=
new
GameMsgResponse
(
response
).
serialize
();
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
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