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
f7f028cb
Commit
f7f028cb
authored
Mar 14, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add DeckCode
parent
00071a3b
Pipeline
#2633
passed with stages
in 1 minute and 54 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
4 deletions
+30
-4
Game/GameBehavior.cs
Game/GameBehavior.cs
+22
-4
Game/GameClient.cs
Game/GameClient.cs
+2
-0
Program.cs
Program.cs
+4
-0
WindBotInfo.cs
WindBotInfo.cs
+2
-0
No files found.
Game/GameBehavior.cs
View file @
f7f028cb
...
...
@@ -18,6 +18,7 @@ namespace WindBot.Game
public
Deck
Deck
{
get
;
private
set
;
}
public
Deck
DeckForWin
{
get
;
private
set
;
}
public
Deck
DeckForLose
{
get
;
private
set
;
}
public
string
DeckCode
{
get
;
private
set
;
}
private
GameAI
_ai
;
...
...
@@ -47,10 +48,15 @@ namespace WindBot.Game
_ai
=
new
GameAI
(
Game
,
_duel
);
_ai
.
Executor
=
DecksManager
.
Instantiate
(
_ai
,
_duel
);
string
deckName
=
Game
.
DeckFile
??
_ai
.
Executor
.
Deck
;
Deck
=
Deck
.
Load
(
deckName
);
DeckForWin
=
Deck
.
Load
(
"Win/"
+
deckName
);
DeckForLose
=
Deck
.
Load
(
"Lose/"
+
deckName
);
if
(
Game
.
DeckCode
!=
null
)
{
DeckCode
=
Game
.
DeckCode
;
}
else
{
DeckCode
=
null
;
string
deckName
=
Game
.
DeckFile
??
_ai
.
Executor
.
Deck
;
Deck
=
Deck
.
Load
(
deckName
);
DeckForWin
=
Deck
.
Load
(
"Win/"
+
deckName
);
DeckForLose
=
Deck
.
Load
(
"Lose/"
+
deckName
);
}
_select_hint
=
0
;
lastDuelResult
=
2
;
}
...
...
@@ -152,6 +158,15 @@ namespace WindBot.Game
private
BinaryWriter
buildUpdateDeck
(
Deck
targetDeck
)
{
BinaryWriter
deck
=
GamePacketFactory
.
Create
(
CtosMessage
.
UpdateDeck
);
if
(
DeckCode
!=
null
)
{
try
{
byte
[]
deckContent
=
Convert
.
FromBase64String
(
DeckCode
);
deck
.
Write
(
deckContent
);
}
catch
{
_ai
.
OnDeckError
(
"base64 decode"
);
}
return
deck
;
}
deck
.
Write
(
targetDeck
.
Cards
.
Count
+
targetDeck
.
ExtraCards
.
Count
);
//Logger.WriteLine("Main + Extra: " + targetDeck.Cards.Count + targetDeck.ExtraCards.Count);
deck
.
Write
(
targetDeck
.
SideCards
.
Count
);
...
...
@@ -179,6 +194,9 @@ namespace WindBot.Game
}
private
Deck
pickDeckOnResult
()
{
if
(
DeckCode
!=
null
)
{
return
null
;
}
if
(
lastDuelResult
==
0
&&
DeckForWin
!=
null
)
{
//Logger.WriteLine("Using deck for win: " + DeckForWin.SideCards[2].Name);
return
DeckForWin
;
...
...
Game/GameClient.cs
View file @
f7f028cb
...
...
@@ -14,6 +14,7 @@ namespace WindBot.Game
public
string
Username
;
public
string
Deck
;
public
string
DeckFile
;
public
string
DeckCode
;
public
string
Dialog
;
public
int
Hand
;
public
bool
Debug
;
...
...
@@ -31,6 +32,7 @@ namespace WindBot.Game
Username
=
Info
.
Name
;
Deck
=
Info
.
Deck
;
DeckFile
=
Info
.
DeckFile
;
DeckCode
=
Info
.
DeckCode
;
Dialog
=
Info
.
Dialog
;
Hand
=
Info
.
Hand
;
Debug
=
Info
.
Debug
;
...
...
Program.cs
View file @
f7f028cb
...
...
@@ -69,6 +69,7 @@ namespace WindBot
Info
.
Name
=
Config
.
GetString
(
"Name"
,
Info
.
Name
);
Info
.
Deck
=
Config
.
GetString
(
"Deck"
,
Info
.
Deck
);
Info
.
DeckFile
=
Config
.
GetString
(
"DeckFile"
,
Info
.
DeckFile
);
Info
.
DeckCode
=
Config
.
GetString
(
"DeckCode"
,
Info
.
DeckCode
);
Info
.
Dialog
=
Config
.
GetString
(
"Dialog"
,
Info
.
Dialog
);
Info
.
Host
=
Config
.
GetString
(
"Host"
,
Info
.
Host
);
Info
.
Port
=
Config
.
GetInt
(
"Port"
,
Info
.
Port
);
...
...
@@ -108,6 +109,9 @@ namespace WindBot
string
deckfile
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"deckfile"
);
if
(
deckfile
!=
null
)
Info
.
DeckFile
=
deckfile
;
string
deckcode
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"deckcode"
);
if
(
deckcode
!=
null
)
Info
.
DeckCode
=
deckcode
;
string
dialog
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"dialog"
);
if
(
dialog
!=
null
)
Info
.
Dialog
=
dialog
;
...
...
WindBotInfo.cs
View file @
f7f028cb
...
...
@@ -7,6 +7,7 @@ namespace WindBot
public
string
Name
{
get
;
set
;
}
public
string
Deck
{
get
;
set
;
}
public
string
DeckFile
{
get
;
set
;
}
public
string
DeckCode
{
get
;
set
;
}
public
string
Dialog
{
get
;
set
;
}
public
string
Host
{
get
;
set
;
}
public
int
Port
{
get
;
set
;
}
...
...
@@ -20,6 +21,7 @@ namespace WindBot
Name
=
"WindBot"
;
Deck
=
null
;
DeckFile
=
null
;
DeckCode
=
null
;
Dialog
=
"default"
;
Host
=
"127.0.0.1"
;
Port
=
7911
;
...
...
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