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
a5b413eb
Commit
a5b413eb
authored
Jan 07, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ctos selectPositionAdapter and helper
parent
d3d1bc0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-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/selectPosition.ts
...ore/ocgAdapter/ctos/ctosGameMsgResponse/selectPosition.ts
+37
-0
src/api/ocgcore/ocgHelper.ts
src/api/ocgcore/ocgHelper.ts
+13
-0
No files found.
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
View file @
a5b413eb
...
...
@@ -6,6 +6,7 @@ import adaptSelectPlaceResponse from "./selectPlace";
import
adaptSelectCardResponse
from
"
./selectCard
"
;
import
adaptSelectChainResponse
from
"
./selectChain
"
;
import
adaptSelectEffectYnResponse
from
"
./selectEffectYn
"
;
import
adaptSelectPositionResponse
from
"
./selectPosition
"
;
/*
* CTOS CTOS_RESPONSE
...
...
@@ -46,6 +47,11 @@ export default class CtosResponsePacket extends YgoProPacket {
break
;
}
case
"
select_position
"
:
{
extraData
=
adaptSelectPositionResponse
(
response
.
select_position
);
break
;
}
default
:
{
break
;
}
...
...
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/selectPosition.ts
0 → 100644
View file @
a5b413eb
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferWriter
}
from
"
../../bufferIO
"
;
export
default
(
response
:
ygopro
.
CtosGameMsgResponse
.
SelectPositionResponse
)
=>
{
const
array
=
new
Uint8Array
(
4
);
const
writer
=
new
BufferWriter
(
array
,
true
);
switch
(
response
.
position
)
{
case
ygopro
.
CardPosition
.
FACEUP_ATTACK
:
{
writer
.
writeUint32
(
0x1
);
break
;
}
case
ygopro
.
CardPosition
.
FACEDOWN_ATTACK
:
{
writer
.
writeUint32
(
0x2
);
break
;
}
case
ygopro
.
CardPosition
.
FACEUP_DEFENSE
:
{
writer
.
writeUint32
(
0x4
);
break
;
}
case
ygopro
.
CardPosition
.
FACEDOWN_DEFENSE
:
{
writer
.
writeUint32
(
0x8
);
break
;
}
default
:
{
console
.
warn
(
`Unsupported position type:
${
response
.
position
}
`
);
}
}
return
array
;
};
src/api/ocgcore/ocgHelper.ts
View file @
a5b413eb
...
...
@@ -189,3 +189,16 @@ export function sendSelectEffectYnResponse(value: boolean) {
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
export
function
sendSelectPositionResponse
(
value
:
ygopro
.
CardPosition
)
{
const
response
=
new
ygopro
.
YgoCtosMsg
({
ctos_response
:
new
ygopro
.
CtosGameMsgResponse
({
select_position
:
new
ygopro
.
CtosGameMsgResponse
.
SelectPositionResponse
({
position
:
value
,
}),
}),
});
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