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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
8eea7636
Commit
8eea7636
authored
Dec 04, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add idle_cmd
parent
6c849a0a
Pipeline
#18457
passed with stages
in 3 minutes and 33 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
0 deletions
+152
-0
src/api/ocgcore/ocgAdapter/bufferIO.ts
src/api/ocgcore/ocgAdapter/bufferIO.ts
+13
-0
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
+6
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectIdleCmd.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectIdleCmd.ts
+114
-0
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+8
-0
src/service/duel/selectIdleCmd.ts
src/service/duel/selectIdleCmd.ts
+10
-0
No files found.
src/api/ocgcore/ocgAdapter/bufferIO.ts
View file @
8eea7636
import
{
ygopro
}
from
"
../idl/ocgcore
"
;
const
OFFSET_UINT8
=
1
;
const
OFFSET_INT8
=
1
;
const
OFFSET_UINT16
=
2
;
...
...
@@ -49,4 +51,15 @@ export class BufferReader {
return
ret
;
}
readCardInfo
():
ygopro
.
StocGameMessage
.
CardInfo
{
const
cardInfo
=
new
ygopro
.
StocGameMessage
.
CardInfo
({});
cardInfo
.
code
=
this
.
readUint32
();
cardInfo
.
controler
=
this
.
readUint8
();
cardInfo
.
location
=
this
.
readUint8
();
cardInfo
.
sequence
=
this
.
readUint8
();
return
cardInfo
;
}
}
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
8eea7636
...
...
@@ -28,3 +28,4 @@ export const MSG_DRAW = 90;
export
const
MSG_NEW_TURN
=
40
;
export
const
MSG_NEW_PHASE
=
41
;
export
const
MSG_HINT
=
2
;
export
const
MSG_SELECT_IDLE_CMD
=
11
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
8eea7636
...
...
@@ -11,6 +11,7 @@ import MsgDrawAdapter from "./draw";
import
MsgNewTurnAdapter
from
"
./newTurn
"
;
import
MsgNewPhaseAdapter
from
"
./newPhase
"
;
import
MsgHintAdapter
from
"
./hint
"
;
import
MsgSelectIdleCmdAdapter
from
"
./selectIdleCmd
"
;
/*
* STOC GameMsg
...
...
@@ -61,6 +62,11 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
}
case
GAME_MSG
.
MSG_SELECT_IDLE_CMD
:
{
gameMsg
.
select_idle_cmd
=
MsgSelectIdleCmdAdapter
(
gameData
);
break
;
}
default
:
{
console
.
log
(
"
Unhandled GameMessage function=
"
,
func
);
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectIdleCmd.ts
0 → 100644
View file @
8eea7636
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
MsgSelectIdleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
;
const
LITTLE_ENDIAN
=
true
;
/*
* Msg Select Idle Command
*
* @param - see: https://code.mycard.moe/mycard/neos-protobuf/-/blob/main/idl/ocgcore.proto#L258
*
* @usage - 玩家可选择的操作
* */
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
LITTLE_ENDIAN
);
const
msg
=
new
MsgSelectIdleCmd
({});
msg
.
player
=
reader
.
readUint8
();
// summon
const
summonCmd
=
new
MsgSelectIdleCmd
.
IdleCmd
({
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SUMMON
,
idle_datas
:
[],
});
const
summonCount
=
reader
.
readUint8
();
for
(
let
i
=
0
;
i
<
summonCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
});
summonCmd
.
idle_datas
.
push
(
idleData
);
}
// spsummon
const
spSummonCmd
=
new
MsgSelectIdleCmd
.
IdleCmd
({
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SPSUMMON
,
idle_datas
:
[],
});
const
spSummonCount
=
reader
.
readUint8
();
for
(
let
i
=
0
;
i
<
spSummonCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
});
spSummonCmd
.
idle_datas
.
push
(
idleData
);
}
// pos change
const
posChangeCmd
=
new
MsgSelectIdleCmd
.
IdleCmd
({
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
POS_CHANGE
,
idle_datas
:
[],
});
const
posChangeCount
=
reader
.
readUint8
();
for
(
let
i
=
0
;
i
<
posChangeCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
});
posChangeCmd
.
idle_datas
.
push
(
idleData
);
}
// mset
const
mSetCmd
=
new
MsgSelectIdleCmd
.
IdleCmd
({
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
MSET
,
idle_datas
:
[],
});
const
mSetCount
=
reader
.
readUint8
();
for
(
let
i
=
0
;
i
<
mSetCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
});
mSetCmd
.
idle_datas
.
push
(
idleData
);
}
// sset
const
sSetCmd
=
new
MsgSelectIdleCmd
.
IdleCmd
({
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SSET
,
idle_datas
:
[],
});
const
sSetCount
=
reader
.
readUint8
();
for
(
let
i
=
0
;
i
<
sSetCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
});
sSetCmd
.
idle_datas
.
push
(
idleData
);
}
// activate
const
activateCmd
=
new
MsgSelectIdleCmd
.
IdleCmd
({
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
ACTIVATE
,
idle_datas
:
[],
});
const
activateCount
=
reader
.
readUint8
();
for
(
let
i
=
0
;
i
<
activateCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
effect_description
:
reader
.
readUint32
(),
});
activateCmd
.
idle_datas
.
push
(
idleData
);
}
msg
.
idle_cmds
=
[
summonCmd
,
spSummonCmd
,
posChangeCmd
,
mSetCmd
,
sSetCmd
,
activateCmd
,
];
msg
.
enable_bp
=
reader
.
readUint8
()
===
1
;
msg
.
enable_ep
=
reader
.
readUint8
()
===
1
;
msg
.
enable_shuffle
=
reader
.
readUint8
()
===
1
;
return
msg
;
};
src/service/duel/gameMsg.ts
View file @
8eea7636
...
...
@@ -5,6 +5,7 @@ import onMsgDraw from "./draw";
import
onMsgNewTurn
from
"
./newTurn
"
;
import
onMsgNewPhase
from
"
./newPhase
"
;
import
onMsgHint
from
"
./hint
"
;
import
onMsgSelectIdleCmd
from
"
./selectIdleCmd
"
;
export
default
function
handleGameMsg
(
pb
:
ygopro
.
YgoStocMsg
)
{
const
dispatch
=
store
.
dispatch
;
...
...
@@ -46,6 +47,13 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
select_idle_cmd
"
:
{
const
selectIdleCmd
=
msg
.
select_idle_cmd
;
onMsgSelectIdleCmd
(
selectIdleCmd
,
dispatch
);
break
;
}
default
:
{
break
;
}
...
...
src/service/duel/selectIdleCmd.ts
0 → 100644
View file @
8eea7636
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
export
default
(
selectIdleCmd
:
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
,
dispatch
:
AppDispatch
)
=>
{
// TODO
console
.
log
(
selectIdleCmd
);
};
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