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
d48085ca
Commit
d48085ca
authored
Mar 16, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate buffer
parent
facd3bfb
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
88 additions
and
125 deletions
+88
-125
src/api/ocgcore/ocgAdapter/bufferIO.ts
src/api/ocgcore/ocgAdapter/bufferIO.ts
+14
-52
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/move.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/move.ts
+4
-4
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
+13
-10
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectBattleCmd.ts
...pi/ocgcore/ocgAdapter/stoc/stocGameMsg/selectBattleCmd.ts
+9
-9
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectCard.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectCard.ts
+8
-8
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectChain.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectChain.ts
+11
-11
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectEffectYn.ts
...api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectEffectYn.ts
+5
-5
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectIdleCmd.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectIdleCmd.ts
+13
-15
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectUnselectCard.ts
...ocgcore/ocgAdapter/stoc/stocGameMsg/selectUnselectCard.ts
+11
-11
No files found.
src/api/ocgcore/ocgAdapter/bufferIO.ts
View file @
d48085ca
import
{
ygopro
}
from
"
../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../idl/ocgcore
"
;
import
{
numberToCardPosition
,
numberToCardZone
}
from
"
./util
"
;
import
{
numberToCardPosition
,
numberToCardZone
}
from
"
./util
"
;
// @ts-ignore
import
{
BufferReader
}
from
"
rust-src
"
;
const
OFFSET_UINT8
=
1
;
const
OFFSET_UINT8
=
1
;
const
OFFSET_INT8
=
1
;
const
OFFSET_INT8
=
1
;
const
OFFSET_UINT16
=
2
;
const
OFFSET_UINT32
=
4
;
const
OFFSET_UINT32
=
4
;
const
OFFSET_INT32
=
4
;
const
OFFSET_INT32
=
4
;
const
LOCATION_OVERLAY
=
0x80
;
const
LOCATION_OVERLAY
=
0x80
;
export
class
BufferReader
{
export
class
BufferReaderExt
{
dataView
:
DataView
;
inner
:
BufferReader
;
littleEndian
:
boolean
;
offset
:
number
;
constructor
(
data
:
Uint8Array
,
littleEndian
:
boolean
)
{
this
.
dataView
=
new
DataView
(
data
.
buffer
);
this
.
littleEndian
=
littleEndian
;
this
.
offset
=
0
;
}
readUint8
():
number
{
const
ret
=
this
.
dataView
.
getUint8
(
this
.
offset
);
this
.
offset
+=
OFFSET_UINT8
;
return
ret
;
}
readInt8
():
number
{
const
ret
=
this
.
dataView
.
getInt8
(
this
.
offset
);
this
.
offset
+=
OFFSET_INT8
;
return
ret
;
}
readUint16
():
number
{
const
ret
=
this
.
dataView
.
getUint16
(
this
.
offset
,
this
.
littleEndian
);
this
.
offset
+=
OFFSET_UINT16
;
return
ret
;
}
readUint32
():
number
{
const
ret
=
this
.
dataView
.
getUint32
(
this
.
offset
,
this
.
littleEndian
);
this
.
offset
+=
OFFSET_UINT32
;
return
ret
;
}
readInt32
():
number
{
const
ret
=
this
.
dataView
.
getInt32
(
this
.
offset
,
this
.
littleEndian
);
this
.
offset
+=
OFFSET_INT32
;
return
ret
;
constructor
(
data
:
Uint8Array
)
{
this
.
inner
=
new
BufferReader
(
data
);
}
}
readCardInfo
():
ygopro
.
CardInfo
{
readCardInfo
():
ygopro
.
CardInfo
{
const
code
=
this
.
readUint32
();
const
code
=
this
.
inner
.
readUint32
();
const
controler
=
this
.
readUint8
();
const
controler
=
this
.
inner
.
readUint8
();
const
location
=
numberToCardZone
(
this
.
readUint8
());
const
location
=
numberToCardZone
(
this
.
inner
.
readUint8
());
const
sequence
=
this
.
readUint8
();
const
sequence
=
this
.
inner
.
readUint8
();
return
new
ygopro
.
CardInfo
({
return
new
ygopro
.
CardInfo
({
code
,
code
,
...
@@ -69,10 +31,10 @@ export class BufferReader {
...
@@ -69,10 +31,10 @@ export class BufferReader {
}
}
readCardLocation
():
ygopro
.
CardLocation
{
readCardLocation
():
ygopro
.
CardLocation
{
const
controler
=
this
.
readUint8
();
const
controler
=
this
.
inner
.
readUint8
();
const
location
=
this
.
readUint8
();
const
location
=
this
.
inner
.
readUint8
();
const
sequence
=
this
.
readUint8
();
const
sequence
=
this
.
inner
.
readUint8
();
const
ss
=
this
.
readUint8
();
const
ss
=
this
.
inner
.
readUint8
();
if
(
location
&
LOCATION_OVERLAY
)
{
if
(
location
&
LOCATION_OVERLAY
)
{
// 超量素材
// 超量素材
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/move.ts
View file @
d48085ca
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
BufferReader
Ext
}
from
"
../../bufferIO
"
;
import
MsgMove
=
ygopro
.
StocGameMessage
.
MsgMove
;
import
MsgMove
=
ygopro
.
StocGameMessage
.
MsgMove
;
/*
/*
...
@@ -10,9 +10,9 @@ import MsgMove = ygopro.StocGameMessage.MsgMove;
...
@@ -10,9 +10,9 @@ import MsgMove = ygopro.StocGameMessage.MsgMove;
* */
* */
export
default
(
data
:
Uint8Array
)
=>
{
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
true
);
const
reader
=
new
BufferReader
Ext
(
data
);
const
code
=
reader
.
readUint32
();
const
code
=
reader
.
inner
.
readUint32
();
const
fromLocation
=
reader
.
readCardLocation
();
const
fromLocation
=
reader
.
readCardLocation
();
const
toLocation
=
reader
.
readCardLocation
();
const
toLocation
=
reader
.
readCardLocation
();
...
@@ -21,6 +21,6 @@ export default (data: Uint8Array) => {
...
@@ -21,6 +21,6 @@ export default (data: Uint8Array) => {
code
,
code
,
from
:
fromLocation
,
from
:
fromLocation
,
to
:
toLocation
,
to
:
toLocation
,
reason
:
reader
.
readUint8
(),
reason
:
reader
.
inner
.
readUint8
(),
});
});
};
};
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
View file @
d48085ca
//! 透传协议
//! 透传协议
import
PenetrateData
from
"
./penetrate.json
"
;
import
PenetrateData
from
"
./penetrate.json
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
BufferReader
Ext
}
from
"
../../bufferIO
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
numberToCardPosition
}
from
"
../../util
"
;
import
{
numberToCardPosition
}
from
"
../../util
"
;
type
Constructor
<
T
=
any
>
=
new
(...
args
:
any
[])
=>
T
;
type
Constructor
<
T
=
any
>
=
new
(...
args
:
any
[])
=>
T
;
const
ReadFieldHandlerMap
:
Map
<
string
,
readFieldHandler
>
=
new
Map
([
const
ReadFieldHandlerMap
:
Map
<
string
,
readFieldHandler
>
=
new
Map
([
[
"
uint8
"
,
((
reader
)
=>
reader
.
readUint8
())
as
readFieldHandler
],
[
"
uint8
"
,
((
reader
)
=>
reader
.
inner
.
readUint8
())
as
readFieldHandler
],
[
"
uint16
"
,
(
reader
)
=>
reader
.
readUint16
()],
[
"
uint16
"
,
(
reader
)
=>
reader
.
inner
.
readUint16
()],
[
"
uint32
"
,
(
reader
)
=>
reader
.
readUint32
()],
[
"
uint32
"
,
(
reader
)
=>
reader
.
inner
.
readUint32
()],
[
"
CardLocation
"
,
(
reader
)
=>
reader
.
readCardLocation
()],
[
"
CardLocation
"
,
(
reader
)
=>
reader
.
readCardLocation
()],
[
"
CardInfo
"
,
(
reader
)
=>
reader
.
readCardInfo
()],
[
"
CardInfo
"
,
(
reader
)
=>
reader
.
readCardInfo
()],
[
"
CardPosition
"
,
(
reader
)
=>
numberToCardPosition
(
reader
.
readUint8
())],
[
"
CardPosition
"
,
(
reader
)
=>
numberToCardPosition
(
reader
.
inner
.
readUint8
())],
]);
]);
const
MsgConstructorMap
:
Map
<
string
,
Constructor
>
=
new
Map
([
const
MsgConstructorMap
:
Map
<
string
,
Constructor
>
=
new
Map
([
[
"
move
"
,
ygopro
.
StocGameMessage
.
MsgMove
as
Constructor
],
[
"
move
"
,
ygopro
.
StocGameMessage
.
MsgMove
as
Constructor
],
...
@@ -32,7 +32,7 @@ export interface penetrateType {
...
@@ -32,7 +32,7 @@ export interface penetrateType {
}
}
interface
readFieldHandler
{
interface
readFieldHandler
{
(
reader
:
BufferReader
):
any
;
(
reader
:
BufferReader
Ext
):
any
;
}
}
class
PenetrateManager
{
class
PenetrateManager
{
...
@@ -44,7 +44,7 @@ class PenetrateManager {
...
@@ -44,7 +44,7 @@ class PenetrateManager {
this
.
config
=
_objToMap
(
config
);
this
.
config
=
_objToMap
(
config
);
}
}
private
readField
(
reader
:
BufferReader
,
fieldType
:
string
):
any
{
private
readField
(
reader
:
BufferReader
Ext
,
fieldType
:
string
):
any
{
const
handler
=
this
.
readFieldHandlerMap
.
get
(
fieldType
);
const
handler
=
this
.
readFieldHandlerMap
.
get
(
fieldType
);
if
(
handler
)
{
if
(
handler
)
{
...
@@ -53,11 +53,14 @@ class PenetrateManager {
...
@@ -53,11 +53,14 @@ class PenetrateManager {
return
undefined
;
return
undefined
;
}
}
private
readRepeatedField
(
reader
:
BufferReader
,
repeatedType
:
string
):
any
{
private
readRepeatedField
(
reader
:
BufferReaderExt
,
repeatedType
:
string
):
any
{
const
handler
=
this
.
readFieldHandlerMap
.
get
(
repeatedType
);
const
handler
=
this
.
readFieldHandlerMap
.
get
(
repeatedType
);
if
(
handler
)
{
if
(
handler
)
{
const
count
=
reader
.
readUint8
();
const
count
=
reader
.
inner
.
readUint8
();
let
repeated
=
[];
let
repeated
=
[];
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
...
@@ -80,7 +83,7 @@ class PenetrateManager {
...
@@ -80,7 +83,7 @@ class PenetrateManager {
penetrate
(
msgKey
:
number
,
gameMsg
:
any
,
gameData
:
Uint8Array
):
boolean
{
penetrate
(
msgKey
:
number
,
gameMsg
:
any
,
gameData
:
Uint8Array
):
boolean
{
const
config
=
this
.
config
.
get
(
msgKey
.
toString
());
const
config
=
this
.
config
.
get
(
msgKey
.
toString
());
const
reader
=
new
BufferReader
(
gameData
,
true
);
const
reader
=
new
BufferReader
Ext
(
gameData
);
if
(
config
)
{
if
(
config
)
{
const
protoType
=
config
.
protoType
;
const
protoType
=
config
.
protoType
;
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectBattleCmd.ts
View file @
d48085ca
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
BufferReader
Ext
}
from
"
../../bufferIO
"
;
import
MsgSelectBattleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectBattleCmd
;
import
MsgSelectBattleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectBattleCmd
;
/*
/*
...
@@ -11,20 +11,20 @@ import MsgSelectBattleCmd = ygopro.StocGameMessage.MsgSelectBattleCmd;
...
@@ -11,20 +11,20 @@ import MsgSelectBattleCmd = ygopro.StocGameMessage.MsgSelectBattleCmd;
* */
* */
export
default
(
data
:
Uint8Array
)
=>
{
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
true
);
const
reader
=
new
BufferReader
Ext
(
data
);
const
msg
=
new
MsgSelectBattleCmd
({});
const
msg
=
new
MsgSelectBattleCmd
({});
msg
.
player
=
reader
.
readUint8
();
msg
.
player
=
reader
.
inner
.
readUint8
();
// 可发动效果
// 可发动效果
const
activateCmd
=
new
MsgSelectBattleCmd
.
BattleCmd
({
const
activateCmd
=
new
MsgSelectBattleCmd
.
BattleCmd
({
battle_type
:
MsgSelectBattleCmd
.
BattleCmd
.
BattleType
.
ACTIVATE
,
battle_type
:
MsgSelectBattleCmd
.
BattleCmd
.
BattleType
.
ACTIVATE
,
battle_datas
:
[],
battle_datas
:
[],
});
});
const
activateCount
=
reader
.
readUint8
();
const
activateCount
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
activateCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
activateCount
;
i
++
)
{
const
cardInfo
=
reader
.
readCardInfo
();
const
cardInfo
=
reader
.
readCardInfo
();
const
effectDescription
=
reader
.
readUint32
();
const
effectDescription
=
reader
.
inner
.
readUint32
();
const
activateData
=
new
MsgSelectBattleCmd
.
BattleCmd
.
BattleData
({
const
activateData
=
new
MsgSelectBattleCmd
.
BattleCmd
.
BattleData
({
card_info
:
cardInfo
,
card_info
:
cardInfo
,
effect_description
:
effectDescription
,
effect_description
:
effectDescription
,
...
@@ -38,10 +38,10 @@ export default (data: Uint8Array) => {
...
@@ -38,10 +38,10 @@ export default (data: Uint8Array) => {
battle_type
:
MsgSelectBattleCmd
.
BattleCmd
.
BattleType
.
ATTACK
,
battle_type
:
MsgSelectBattleCmd
.
BattleCmd
.
BattleType
.
ATTACK
,
battle_datas
:
[],
battle_datas
:
[],
});
});
const
attackCount
=
reader
.
readUint8
();
const
attackCount
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
attackCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
attackCount
;
i
++
)
{
const
cardInfo
=
reader
.
readCardInfo
();
const
cardInfo
=
reader
.
readCardInfo
();
const
directAttackAble
=
reader
.
readUint8
();
const
directAttackAble
=
reader
.
inner
.
readUint8
();
const
attackData
=
new
MsgSelectBattleCmd
.
BattleCmd
.
BattleData
({
const
attackData
=
new
MsgSelectBattleCmd
.
BattleCmd
.
BattleData
({
card_info
:
cardInfo
,
card_info
:
cardInfo
,
direct_attackable
:
directAttackAble
==
1
,
direct_attackable
:
directAttackAble
==
1
,
...
@@ -53,9 +53,9 @@ export default (data: Uint8Array) => {
...
@@ -53,9 +53,9 @@ export default (data: Uint8Array) => {
msg
.
battle_cmds
=
[
activateCmd
,
attackCmd
];
msg
.
battle_cmds
=
[
activateCmd
,
attackCmd
];
// 是否可进入M2阶段
// 是否可进入M2阶段
msg
.
enable_m2
=
reader
.
readUint8
()
==
1
;
msg
.
enable_m2
=
reader
.
inner
.
readUint8
()
==
1
;
//时是否可结束回合
//时是否可结束回合
msg
.
enable_ep
=
reader
.
readUint8
()
==
1
;
msg
.
enable_ep
=
reader
.
inner
.
readUint8
()
==
1
;
return
msg
;
return
msg
;
};
};
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectCard.ts
View file @
d48085ca
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
BufferReader
Ext
}
from
"
../../bufferIO
"
;
import
MsgSelectCard
=
ygopro
.
StocGameMessage
.
MsgSelectCard
;
import
MsgSelectCard
=
ygopro
.
StocGameMessage
.
MsgSelectCard
;
/*
/*
...
@@ -10,18 +10,18 @@ import MsgSelectCard = ygopro.StocGameMessage.MsgSelectCard;
...
@@ -10,18 +10,18 @@ import MsgSelectCard = ygopro.StocGameMessage.MsgSelectCard;
* */
* */
export
default
(
data
:
Uint8Array
)
=>
{
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
true
);
const
reader
=
new
BufferReader
Ext
(
data
);
const
player
=
reader
.
readUint8
();
const
player
=
reader
.
inner
.
readUint8
();
const
cancelable
=
reader
.
readUint8
()
!=
0
;
const
cancelable
=
reader
.
inner
.
readUint8
()
!=
0
;
const
min
=
reader
.
readUint8
();
const
min
=
reader
.
inner
.
readUint8
();
const
max
=
reader
.
readUint8
();
const
max
=
reader
.
inner
.
readUint8
();
const
count
=
reader
.
readUint8
();
const
count
=
reader
.
inner
.
readUint8
();
const
msg
=
new
MsgSelectCard
({
player
,
cancelable
,
min
,
max
});
const
msg
=
new
MsgSelectCard
({
player
,
cancelable
,
min
,
max
});
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
const
code
=
reader
.
readUint32
();
const
code
=
reader
.
inner
.
readUint32
();
const
location
=
reader
.
readCardLocation
();
const
location
=
reader
.
readCardLocation
();
msg
.
cards
.
push
(
msg
.
cards
.
push
(
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectChain.ts
View file @
d48085ca
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
BufferReader
Ext
}
from
"
../../bufferIO
"
;
import
MsgSelectChain
=
ygopro
.
StocGameMessage
.
MsgSelectChain
;
import
MsgSelectChain
=
ygopro
.
StocGameMessage
.
MsgSelectChain
;
import
{
numberToChainFlag
}
from
"
../../util
"
;
import
{
numberToChainFlag
}
from
"
../../util
"
;
...
@@ -12,14 +12,14 @@ import { numberToChainFlag } from "../../util";
...
@@ -12,14 +12,14 @@ import { numberToChainFlag } from "../../util";
* */
* */
export
default
(
data
:
Uint8Array
)
=>
{
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
true
);
const
reader
=
new
BufferReader
Ext
(
data
);
const
player
=
reader
.
readUint8
();
const
player
=
reader
.
inner
.
readUint8
();
const
count
=
reader
.
readUint8
();
const
count
=
reader
.
inner
.
readUint8
();
const
spCount
=
reader
.
readUint8
();
const
spCount
=
reader
.
inner
.
readUint8
();
const
forced
=
reader
.
readUint8
()
!=
0
;
const
forced
=
reader
.
inner
.
readUint8
()
!=
0
;
const
hint0
=
reader
.
readUint32
();
const
hint0
=
reader
.
inner
.
readUint32
();
const
hint1
=
reader
.
readUint32
();
const
hint1
=
reader
.
inner
.
readUint32
();
const
msg
=
new
MsgSelectChain
({
const
msg
=
new
MsgSelectChain
({
player
,
player
,
...
@@ -31,10 +31,10 @@ export default (data: Uint8Array) => {
...
@@ -31,10 +31,10 @@ export default (data: Uint8Array) => {
});
});
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
const
flag
=
reader
.
readUint8
();
const
flag
=
reader
.
inner
.
readUint8
();
const
code
=
reader
.
readUint32
();
const
code
=
reader
.
inner
.
readUint32
();
const
location
=
reader
.
readCardLocation
();
const
location
=
reader
.
readCardLocation
();
const
effect_desc
=
reader
.
readUint32
();
const
effect_desc
=
reader
.
inner
.
readUint32
();
msg
.
chains
.
push
(
msg
.
chains
.
push
(
new
MsgSelectChain
.
Chain
({
new
MsgSelectChain
.
Chain
({
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectEffectYn.ts
View file @
d48085ca
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
BufferReader
Ext
}
from
"
../../bufferIO
"
;
import
MsgSelectEffectYn
=
ygopro
.
StocGameMessage
.
MsgSelectEffectYn
;
import
MsgSelectEffectYn
=
ygopro
.
StocGameMessage
.
MsgSelectEffectYn
;
/*
/*
...
@@ -11,12 +11,12 @@ import MsgSelectEffectYn = ygopro.StocGameMessage.MsgSelectEffectYn;
...
@@ -11,12 +11,12 @@ import MsgSelectEffectYn = ygopro.StocGameMessage.MsgSelectEffectYn;
* */
* */
export
default
(
data
:
Uint8Array
)
=>
{
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
true
);
const
reader
=
new
BufferReader
Ext
(
data
);
const
player
=
reader
.
readUint8
();
const
player
=
reader
.
inner
.
readUint8
();
const
code
=
reader
.
readUint32
();
const
code
=
reader
.
inner
.
readUint32
();
const
location
=
reader
.
readCardLocation
();
const
location
=
reader
.
readCardLocation
();
const
effect_description
=
reader
.
readUint32
();
const
effect_description
=
reader
.
inner
.
readUint32
();
return
new
MsgSelectEffectYn
({
return
new
MsgSelectEffectYn
({
player
,
player
,
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectIdleCmd.ts
View file @
d48085ca
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
BufferReader
Ext
}
from
"
../../bufferIO
"
;
import
MsgSelectIdleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
;
import
MsgSelectIdleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
;
const
LITTLE_ENDIAN
=
true
;
/*
/*
* Msg Select Idle Command
* Msg Select Idle Command
*
*
...
@@ -13,17 +11,17 @@ const LITTLE_ENDIAN = true;
...
@@ -13,17 +11,17 @@ const LITTLE_ENDIAN = true;
* */
* */
export
default
(
data
:
Uint8Array
)
=>
{
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
LITTLE_ENDIAN
);
const
reader
=
new
BufferReader
Ext
(
data
);
const
msg
=
new
MsgSelectIdleCmd
({});
const
msg
=
new
MsgSelectIdleCmd
({});
msg
.
player
=
reader
.
readUint8
();
msg
.
player
=
reader
.
inner
.
readUint8
();
// 通常召唤
// 通常召唤
const
summonCmd
=
new
MsgSelectIdleCmd
.
IdleCmd
({
const
summonCmd
=
new
MsgSelectIdleCmd
.
IdleCmd
({
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SUMMON
,
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SUMMON
,
idle_datas
:
[],
idle_datas
:
[],
});
});
const
summonCount
=
reader
.
readUint8
();
const
summonCount
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
summonCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
summonCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
card_info
:
reader
.
readCardInfo
(),
...
@@ -37,7 +35,7 @@ export default (data: Uint8Array) => {
...
@@ -37,7 +35,7 @@ export default (data: Uint8Array) => {
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SPSUMMON
,
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SPSUMMON
,
idle_datas
:
[],
idle_datas
:
[],
});
});
const
spSummonCount
=
reader
.
readUint8
();
const
spSummonCount
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
spSummonCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
spSummonCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
card_info
:
reader
.
readCardInfo
(),
...
@@ -51,7 +49,7 @@ export default (data: Uint8Array) => {
...
@@ -51,7 +49,7 @@ export default (data: Uint8Array) => {
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
POS_CHANGE
,
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
POS_CHANGE
,
idle_datas
:
[],
idle_datas
:
[],
});
});
const
posChangeCount
=
reader
.
readUint8
();
const
posChangeCount
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
posChangeCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
posChangeCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
card_info
:
reader
.
readCardInfo
(),
...
@@ -65,7 +63,7 @@ export default (data: Uint8Array) => {
...
@@ -65,7 +63,7 @@ export default (data: Uint8Array) => {
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
MSET
,
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
MSET
,
idle_datas
:
[],
idle_datas
:
[],
});
});
const
mSetCount
=
reader
.
readUint8
();
const
mSetCount
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
mSetCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
mSetCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
card_info
:
reader
.
readCardInfo
(),
...
@@ -79,7 +77,7 @@ export default (data: Uint8Array) => {
...
@@ -79,7 +77,7 @@ export default (data: Uint8Array) => {
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SSET
,
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
SSET
,
idle_datas
:
[],
idle_datas
:
[],
});
});
const
sSetCount
=
reader
.
readUint8
();
const
sSetCount
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
sSetCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
sSetCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
card_info
:
reader
.
readCardInfo
(),
...
@@ -93,11 +91,11 @@ export default (data: Uint8Array) => {
...
@@ -93,11 +91,11 @@ export default (data: Uint8Array) => {
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
ACTIVATE
,
idle_type
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleType
.
ACTIVATE
,
idle_datas
:
[],
idle_datas
:
[],
});
});
const
activateCount
=
reader
.
readUint8
();
const
activateCount
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
activateCount
;
i
++
)
{
for
(
let
i
=
0
;
i
<
activateCount
;
i
++
)
{
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
const
idleData
=
new
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
({
card_info
:
reader
.
readCardInfo
(),
card_info
:
reader
.
readCardInfo
(),
effect_description
:
reader
.
readUint32
(),
effect_description
:
reader
.
inner
.
readUint32
(),
response
:
(
i
<<
16
)
+
5
,
response
:
(
i
<<
16
)
+
5
,
});
});
activateCmd
.
idle_datas
.
push
(
idleData
);
activateCmd
.
idle_datas
.
push
(
idleData
);
...
@@ -113,11 +111,11 @@ export default (data: Uint8Array) => {
...
@@ -113,11 +111,11 @@ export default (data: Uint8Array) => {
];
];
// 进入战斗阶段
// 进入战斗阶段
msg
.
enable_bp
=
reader
.
readUint8
()
===
1
;
msg
.
enable_bp
=
reader
.
inner
.
readUint8
()
===
1
;
// 结束回合
// 结束回合
msg
.
enable_ep
=
reader
.
readUint8
()
===
1
;
msg
.
enable_ep
=
reader
.
inner
.
readUint8
()
===
1
;
// 切洗手牌
// 切洗手牌
msg
.
enable_shuffle
=
reader
.
readUint8
()
===
1
;
msg
.
enable_shuffle
=
reader
.
inner
.
readUint8
()
===
1
;
return
msg
;
return
msg
;
};
};
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/selectUnselectCard.ts
View file @
d48085ca
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
{
BufferReader
Ext
}
from
"
../../bufferIO
"
;
import
MsgSelectUnselectCard
=
ygopro
.
StocGameMessage
.
MsgSelectUnselectCard
;
import
MsgSelectUnselectCard
=
ygopro
.
StocGameMessage
.
MsgSelectUnselectCard
;
/*
/*
...
@@ -10,13 +10,13 @@ import MsgSelectUnselectCard = ygopro.StocGameMessage.MsgSelectUnselectCard;
...
@@ -10,13 +10,13 @@ import MsgSelectUnselectCard = ygopro.StocGameMessage.MsgSelectUnselectCard;
* @usage - 玩家选择未选择的卡牌
* @usage - 玩家选择未选择的卡牌
* */
* */
export
default
(
data
:
Uint8Array
)
=>
{
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
true
);
const
reader
=
new
BufferReader
Ext
(
data
);
const
player
=
reader
.
readUint8
();
const
player
=
reader
.
inner
.
readUint8
();
const
finishable
=
reader
.
readUint8
()
!=
0
;
const
finishable
=
reader
.
inner
.
readUint8
()
!=
0
;
const
cancelable
=
reader
.
readUint8
()
!=
0
;
const
cancelable
=
reader
.
inner
.
readUint8
()
!=
0
;
const
min
=
reader
.
readUint8
();
const
min
=
reader
.
inner
.
readUint8
();
const
max
=
reader
.
readUint8
();
const
max
=
reader
.
inner
.
readUint8
();
const
msg
=
new
MsgSelectUnselectCard
({
const
msg
=
new
MsgSelectUnselectCard
({
player
,
player
,
...
@@ -26,9 +26,9 @@ export default (data: Uint8Array) => {
...
@@ -26,9 +26,9 @@ export default (data: Uint8Array) => {
max
,
max
,
});
});
const
count1
=
reader
.
readUint8
();
const
count1
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
0
;
i
<
count1
;
i
++
)
{
for
(
let
i
=
0
;
i
<
count1
;
i
++
)
{
const
code
=
reader
.
readUint32
();
const
code
=
reader
.
inner
.
readUint32
();
const
location
=
reader
.
readCardLocation
();
const
location
=
reader
.
readCardLocation
();
msg
.
selectable_cards
.
push
(
msg
.
selectable_cards
.
push
(
...
@@ -36,9 +36,9 @@ export default (data: Uint8Array) => {
...
@@ -36,9 +36,9 @@ export default (data: Uint8Array) => {
);
);
}
}
const
count2
=
reader
.
readUint8
();
const
count2
=
reader
.
inner
.
readUint8
();
for
(
let
i
=
count1
;
i
<
count1
+
count2
;
i
++
)
{
for
(
let
i
=
count1
;
i
<
count1
+
count2
;
i
++
)
{
const
code
=
reader
.
readUint32
();
const
code
=
reader
.
inner
.
readUint32
();
const
location
=
reader
.
readCardLocation
();
const
location
=
reader
.
readCardLocation
();
msg
.
selected_cards
.
push
(
msg
.
selected_cards
.
push
(
...
...
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