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
baichixing
Neos
Commits
e9163718
Commit
e9163718
authored
Mar 19, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle updateData
parent
f0516423
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
246 additions
and
0 deletions
+246
-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/updateData.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/updateData.ts
+202
-0
src/common.ts
src/common.ts
+24
-0
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+6
-0
src/service/duel/updateData.ts
src/service/duel/updateData.ts
+7
-0
No files found.
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
e9163718
...
...
@@ -49,3 +49,4 @@ export const MSG_RECOVER = 92;
export
const
MSG_PAY_LP_COST
=
100
;
export
const
MSG_WIN
=
5
;
export
const
MSG_WAITING
=
3
;
export
const
MSG_UPDATE_DATA
=
6
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
e9163718
...
...
@@ -25,6 +25,7 @@ import MsgWaitAdapter from "./wait";
import
MsgDamage
from
"
./damage
"
;
import
MsgRecover
from
"
./recover
"
;
import
MsgWin
from
"
./win
"
;
import
MsgUpdateDataAdapter
from
"
./updateData
"
;
import
PENETRATE
from
"
./penetrate
"
;
/*
...
...
@@ -148,6 +149,11 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
}
case
GAME_MSG
.
MSG_UPDATE_DATA
:
{
gameMsg
.
update_data
=
MsgUpdateDataAdapter
(
gameData
);
break
;
}
default
:
{
gameMsg
.
unimplemented
=
new
ygopro
.
StocGameMessage
.
MsgUnimplemented
({
command
:
func
,
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/updateData.ts
0 → 100644
View file @
e9163718
import
{
QUERY_ALIAS
,
QUERY_ATTACK
,
QUERY_ATTRIBUTE
,
QUERY_BASE_ATTACK
,
QUERY_BASE_DEFENSE
,
QUERY_CODE
,
QUERY_COUNTERS
,
QUERY_DEFENSE
,
QUERY_EQUIP_CARD
,
QUERY_LEVEL
,
QUERY_LINK
,
QUERY_LSCALE
,
QUERY_OVERLAY_CARD
,
QUERY_OWNER
,
QUERY_POSITION
,
QUERY_RACE
,
QUERY_RANK
,
QUERY_REASON
,
QUERY_REASON_CARD
,
QUERY_RSCALE
,
QUERY_STATUS
,
QUERY_TARGET_CARD
,
QUERY_TYPE
,
}
from
"
../../../../../common
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReaderExt
}
from
"
../../bufferIO
"
;
import
{
numberToCardZone
}
from
"
../../util
"
;
import
MsgUpdateData
=
ygopro
.
StocGameMessage
.
MsgUpdateData
;
/*
* Msg UpdateData
*
* @param - todo
*
* @usage - ygopro后端通知前端更新卡片元数据
* */
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReaderExt
(
data
);
const
player
=
reader
.
inner
.
readUint8
();
const
zone
=
numberToCardZone
(
reader
.
inner
.
readUint8
());
const
msg
=
new
MsgUpdateData
({
player
,
zone
,
actions
:
[],
});
try
{
while
(
true
)
{
const
len
=
reader
.
inner
.
readInt32
();
if
(
len
==
4
)
continue
;
const
pos
=
reader
.
inner
.
offset
();
const
action
=
_readUpdateAction
(
reader
);
if
(
action
)
{
msg
.
actions
.
push
(
action
);
}
reader
.
inner
.
setOffset
(
pos
+
len
-
4
);
}
}
catch
(
e
)
{
// console.log(e)
}
};
function
_readUpdateAction
(
reader
:
BufferReaderExt
):
MsgUpdateData
.
Action
|
undefined
{
const
flag
=
reader
.
inner
.
readInt32
();
if
(
flag
==
0
)
return
undefined
;
let
code
;
let
location
;
let
alias
;
let
type_
;
let
level
;
let
rank
;
let
attribute
;
let
race
;
let
attack
;
let
defense
;
let
base_attack
;
let
base_defense
;
let
reason
;
let
reason_card
;
let
equip_card
;
let
target_cards
=
[];
let
overlay_cards
=
[];
let
counters
=
new
Map
<
number
,
number
>
();
let
owner
;
let
status
;
let
lscale
;
let
rscale
;
let
link
;
if
(
flag
&
QUERY_CODE
)
{
code
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_POSITION
)
{
location
=
reader
.
readCardLocation
();
}
if
(
flag
&
QUERY_ALIAS
)
{
alias
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_TYPE
)
{
type_
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_LEVEL
)
{
level
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_RANK
)
{
rank
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_ATTRIBUTE
)
{
attribute
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_RACE
)
{
race
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_ATTACK
)
{
attack
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_DEFENSE
)
{
defense
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_BASE_ATTACK
)
{
base_attack
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_BASE_DEFENSE
)
{
base_defense
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_REASON
)
{
reason
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_REASON_CARD
)
{
reason_card
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_EQUIP_CARD
)
{
equip_card
=
reader
.
readCardLocation
();
}
if
(
flag
&
QUERY_TARGET_CARD
)
{
const
count
=
reader
.
inner
.
readInt32
();
for
(
let
i
=
0
;
i
<
count
;
i
+=
1
)
{
target_cards
.
push
(
reader
.
readCardLocation
());
}
}
if
(
flag
&
QUERY_OVERLAY_CARD
)
{
const
count
=
reader
.
inner
.
readInt32
();
for
(
let
i
=
0
;
i
<
count
;
i
+=
1
)
{
overlay_cards
.
push
(
reader
.
inner
.
readInt32
());
}
}
if
(
flag
&
QUERY_COUNTERS
)
{
const
count
=
reader
.
inner
.
readInt32
();
for
(
let
i
=
0
;
i
<
count
;
i
+=
1
)
{
const
ctype
=
reader
.
inner
.
readUint16
();
const
ccount
=
reader
.
inner
.
readUint16
();
counters
.
set
(
ctype
,
ccount
);
}
}
if
(
flag
&
QUERY_OWNER
)
{
owner
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_STATUS
)
{
status
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_LSCALE
)
{
lscale
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_RSCALE
)
{
rscale
=
reader
.
inner
.
readInt32
();
}
if
(
flag
&
QUERY_LINK
)
{
link
=
reader
.
inner
.
readInt32
();
}
return
new
MsgUpdateData
.
Action
({
code
,
location
,
alias
,
type_
,
level
,
rank
,
attribute
,
race
,
attack
,
defense
,
base_attack
,
base_defense
,
reason
,
reason_card
,
equip_card
,
target_cards
,
overlay_cards
,
counters
,
owner
,
status
,
lscale
,
rscale
,
link
,
});
}
src/common.ts
View file @
e9163718
...
...
@@ -196,3 +196,27 @@ export const REASON_MATERIAL = 0x8; //
// const REASON_REVEAL = 0x8000000; //
// const REASON_LINK = 0x10000000; //
// const REASON_LOST_OVERLAY = 0x20000000; //
export
const
QUERY_CODE
=
0x1
;
export
const
QUERY_POSITION
=
0x2
;
export
const
QUERY_ALIAS
=
0x4
;
export
const
QUERY_TYPE
=
0x8
;
export
const
QUERY_LEVEL
=
0x10
;
export
const
QUERY_RANK
=
0x20
;
export
const
QUERY_ATTRIBUTE
=
0x40
;
export
const
QUERY_RACE
=
0x80
;
export
const
QUERY_ATTACK
=
0x100
;
export
const
QUERY_DEFENSE
=
0x200
;
export
const
QUERY_BASE_ATTACK
=
0x400
;
export
const
QUERY_BASE_DEFENSE
=
0x800
;
export
const
QUERY_REASON
=
0x1000
;
export
const
QUERY_REASON_CARD
=
0x2000
;
export
const
QUERY_EQUIP_CARD
=
0x4000
;
export
const
QUERY_TARGET_CARD
=
0x8000
;
export
const
QUERY_OVERLAY_CARD
=
0x10000
;
export
const
QUERY_COUNTERS
=
0x20000
;
export
const
QUERY_OWNER
=
0x40000
;
export
const
QUERY_STATUS
=
0x80000
;
export
const
QUERY_LSCALE
=
0x200000
;
export
const
QUERY_RSCALE
=
0x400000
;
export
const
QUERY_LINK
=
0x800000
;
src/service/duel/gameMsg.ts
View file @
e9163718
...
...
@@ -22,6 +22,7 @@ import onMsgUpdateHp from "./updateHp";
import
onMsgWin
from
"
./win
"
;
import
onMsgWait
from
"
./wait
"
;
import
onUnimplemented
from
"
./unimplemented
"
;
import
onMsgUpdateData
from
"
./updateData
"
;
import
{
setWaiting
}
from
"
../../reducers/duel/mod
"
;
const
ActiveList
=
[
...
...
@@ -151,6 +152,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
update_data
"
:
{
onMsgUpdateData
(
msg
.
update_data
,
dispatch
);
break
;
}
case
"
unimplemented
"
:
{
onUnimplemented
(
msg
.
unimplemented
,
dispatch
);
...
...
src/service/duel/updateData.ts
0 → 100644
View file @
e9163718
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
MsgUpdateData
=
ygopro
.
StocGameMessage
.
MsgUpdateData
;
export
default
(
updateData
:
MsgUpdateData
,
dispatch
:
AppDispatch
)
=>
{
console
.
log
(
updateData
);
};
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