Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
windbot
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
nanahira
windbot
Commits
92faa770
Commit
92faa770
authored
Jun 21, 2025
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into patch-v1362
parents
cb634664
b08d0a2d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
5 deletions
+32
-5
Game/GameBehavior.cs
Game/GameBehavior.cs
+3
-0
Game/GameClient.cs
Game/GameClient.cs
+2
-3
YGOSharp.Network/Utils/BinaryExtensions.cs
YGOSharp.Network/Utils/BinaryExtensions.cs
+27
-2
No files found.
Game/GameBehavior.cs
View file @
92faa770
...
...
@@ -298,6 +298,8 @@ namespace WindBot.Game
string
otherName
=
(
player
==
0
)
?
_room
.
Names
[
1
]
:
_room
.
Names
[
0
];
if
(
player
<
4
)
Logger
.
DebugWriteLine
(
otherName
+
" say to "
+
myName
+
": "
+
message
);
else
Logger
.
DebugWriteLine
(
"System message("
+
player
+
"): "
+
message
);
}
private
void
OnErrorMsg
(
BinaryReader
packet
)
...
...
@@ -308,6 +310,7 @@ namespace WindBot.Game
packet
.
ReadByte
();
packet
.
ReadByte
();
int
pcode
=
packet
.
ReadInt32
();
Logger
.
DebugWriteLine
(
"Error message received: "
+
msg
+
", code: "
+
pcode
);
if
(
msg
==
2
)
//ERRMSG_DECKERROR
{
int
code
=
pcode
&
0xFFFFFFF
;
...
...
Game/GameClient.cs
View file @
92faa770
...
...
@@ -73,7 +73,7 @@ namespace WindBot.Game
packet
=
GamePacketFactory
.
Create
(
CtosMessage
.
JoinGame
);
packet
.
Write
(
_proVersion
);
packet
.
Write
(
junk
);
packet
.
WriteUnicode
(
_roomInfo
,
3
0
);
packet
.
WriteUnicode
(
_roomInfo
,
2
0
);
Connection
.
Send
(
packet
);
}
...
...
@@ -84,9 +84,8 @@ namespace WindBot.Game
public
void
Chat
(
string
message
)
{
byte
[]
content
=
Encoding
.
Unicode
.
GetBytes
(
message
+
"\0"
);
BinaryWriter
chat
=
GamePacketFactory
.
Create
(
CtosMessage
.
Chat
);
chat
.
Write
(
content
);
chat
.
Write
UnicodeAutoLength
(
message
,
255
);
Connection
.
Send
(
chat
);
}
...
...
YGOSharp.Network/Utils/BinaryExtensions.cs
View file @
92faa770
...
...
@@ -6,15 +6,40 @@ namespace YGOSharp.Network.Utils
{
public
static
class
BinaryExtensions
{
// fixed length strings
public
static
void
WriteUnicode
(
this
BinaryWriter
writer
,
string
text
,
int
len
)
{
byte
[]
unicode
=
Encoding
.
Unicode
.
GetBytes
(
text
);
byte
[]
result
=
new
byte
[
len
*
2
];
int
max
=
len
*
2
-
2
;
Array
.
Copy
(
unicode
,
result
,
unicode
.
Length
>
max
?
max
:
unicode
.
Length
);
int
copy
=
unicode
.
Length
;
if
(
unicode
.
Length
>
len
*
2
-
2
)
{
copy
=
len
*
2
-
2
;
#if DEBUG
throw
new
ArgumentException
(
"String '"
+
text
+
"' is too long for fixed length "
+
len
+
"."
);
#endif
}
Array
.
Copy
(
unicode
,
result
,
copy
);
writer
.
Write
(
result
);
}
// variable length strings
public
static
void
WriteUnicodeAutoLength
(
this
BinaryWriter
writer
,
string
text
,
int
maxlen
)
{
byte
[]
result
=
Encoding
.
Unicode
.
GetBytes
(
text
+
"\0"
);
int
len
=
result
.
Length
/
2
;
if
(
len
>
maxlen
)
{
len
=
maxlen
;
result
[
len
*
2
-
2
]
=
0
;
result
[
len
*
2
-
1
]
=
0
;
#if DEBUG
throw
new
ArgumentException
(
"String '"
+
text
+
"' is too long for max length "
+
maxlen
+
"."
);
#endif
}
writer
.
Write
(
result
,
0
,
len
*
2
);
}
public
static
string
ReadUnicode
(
this
BinaryReader
reader
,
int
len
)
{
byte
[]
unicode
=
reader
.
ReadBytes
(
len
*
2
);
...
...
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