Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-proxy
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
MyCard
ygopro-proxy
Commits
86e9f109
Commit
86e9f109
authored
Sep 25, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add transformJoinGame_
parent
8669b58a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
3 deletions
+57
-3
DarkNeos/transform.go
DarkNeos/transform.go
+57
-3
No files found.
DarkNeos/transform.go
View file @
86e9f109
// todo: use interface
package
darkneos
import
(
"bytes"
"encoding/binary"
"errors"
"fmt"
"log"
"unicode/utf16"
"github.com/sktt1ryze/ygopro-proxy/DarkNeos/ygopropb"
...
...
@@ -23,7 +26,8 @@ const (
CtosProtoPlayerInfo
=
16
CtosProtoJoinGame
=
18
StocChat
=
25
StocJoinGame
=
18
StocChat
=
25
)
type
YgoPacket
struct
{
...
...
@@ -32,6 +36,19 @@ type YgoPacket struct {
Exdata
[]
byte
}
type
HostInfo
struct
{
Lflist
uint32
Rule
uint8
Mode
uint8
DuelRule
uint8
NoCheckDeck
bool
NoShuffleDeck
bool
StartLp
uint32
StartHand
uint8
DrawCount
uint8
TimeLimit
uint16
}
func
packetToBuffer
(
pkt
YgoPacket
)
[]
byte
{
buf
:=
make
([]
byte
,
0
)
...
...
@@ -97,6 +114,11 @@ func Transform(src []byte, tranformType int) ([]byte, error) {
pb
=
ygopropb
.
YgoStocMsg
{
Msg
:
&
msg
,
}
case
StocJoinGame
:
msg
:=
transformJoinGame_
(
packet
)
pb
=
ygopropb
.
YgoStocMsg
{
Msg
:
&
msg
,
}
default
:
return
nil
,
errors
.
New
(
"Unhandled YgoStocMsg type"
)
}
...
...
@@ -107,8 +129,6 @@ func Transform(src []byte, tranformType int) ([]byte, error) {
}
}
// todo: use interface
// +++++ Client To Server +++++
// @Name: [20]uint16
...
...
@@ -161,6 +181,40 @@ func transformChat(pkt YgoPacket) ygopropb.YgoStocMsg_StocChat {
}
}
// @lflist: uint32
// @rule: uint8
// @mode: uint8
// @duel_rule: uint8
// @no_check_deck: bool
// @no_shuffle_deck: bool
// @start_lp: uint32
// @start_hand: uint8
// @draw_count: uint8
// @time_limit: uint16
func
transformJoinGame_
(
pkt
YgoPacket
)
ygopropb
.
YgoStocMsg_StocJoinGame
{
hostInfo
:=
HostInfo
{}
exData
:=
bytes
.
NewBuffer
(
pkt
.
Exdata
)
if
err
:=
binary
.
Read
(
exData
,
binary
.
LittleEndian
,
&
hostInfo
);
err
!=
nil
{
log
.
Fatal
(
err
)
}
return
ygopropb
.
YgoStocMsg_StocJoinGame
{
StocJoinGame
:
&
ygopropb
.
StocJoinGame
{
Lflist
:
int32
(
hostInfo
.
Lflist
),
Rule
:
int32
(
hostInfo
.
Rule
),
Mode
:
int32
(
hostInfo
.
Mode
),
DuelRule
:
int32
(
hostInfo
.
DuelRule
),
NoCheckDeck
:
hostInfo
.
NoCheckDeck
,
NoShuffleDeck
:
hostInfo
.
NoShuffleDeck
,
StartLp
:
int32
(
hostInfo
.
StartLp
),
StartHand
:
int32
(
hostInfo
.
StartHand
),
DrawCount
:
int32
(
hostInfo
.
DrawCount
),
TimeLimit
:
int32
(
hostInfo
.
TimeLimit
),
},
}
}
// +++++ Util Functions +++++
func
strToUtf16Buffer
(
s
string
)
[]
uint16
{
...
...
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