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
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
windbot
Commits
787e3cab
Commit
787e3cab
authored
Aug 20, 2018
by
mercury233
Committed by
GitHub
Aug 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add random bot in bot wrapper (#71)
parent
e0c8515b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
20 deletions
+94
-20
BotWrapper/BotWrapper.cs
BotWrapper/BotWrapper.cs
+61
-2
BotWrapper/bot.conf
BotWrapper/bot.conf
+33
-18
No files found.
BotWrapper/BotWrapper.cs
View file @
787e3cab
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
using
System.IO
;
using
System.IO
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
using
System.Linq
;
namespace
BotWrapper
namespace
BotWrapper
{
{
...
@@ -12,6 +14,8 @@ namespace BotWrapper
...
@@ -12,6 +14,8 @@ namespace BotWrapper
[
DllImport
(
"User32.dll"
,
CharSet
=
CharSet
.
Unicode
)]
[
DllImport
(
"User32.dll"
,
CharSet
=
CharSet
.
Unicode
)]
public
static
extern
int
MessageBox
(
IntPtr
hWnd
,
string
lpText
,
string
lpCaption
,
int
uType
);
public
static
extern
int
MessageBox
(
IntPtr
hWnd
,
string
lpText
,
string
lpCaption
,
int
uType
);
const
int
MB_ICONERROR
=
0x00000010
;
static
void
Main
(
string
[]
args
)
static
void
Main
(
string
[]
args
)
{
{
ProcessStartInfo
startInfo
=
new
ProcessStartInfo
();
ProcessStartInfo
startInfo
=
new
ProcessStartInfo
();
...
@@ -24,7 +28,19 @@ namespace BotWrapper
...
@@ -24,7 +28,19 @@ namespace BotWrapper
startInfo
.
CreateNoWindow
=
true
;
startInfo
.
CreateNoWindow
=
true
;
startInfo
.
WindowStyle
=
ProcessWindowStyle
.
Hidden
;
startInfo
.
WindowStyle
=
ProcessWindowStyle
.
Hidden
;
string
arg
=
args
[
0
].
Replace
(
"'"
,
"\""
);
string
arg
=
args
[
0
];
Match
match
=
Regex
.
Match
(
arg
,
"Random=(.*)"
);
if
(
match
.
Success
)
{
string
randomFlag
=
match
.
Groups
[
1
].
Value
;
ReadBots
();
arg
=
GetRandomBot
(
randomFlag
);
if
(
arg
==
""
)
{
MessageBox
((
IntPtr
)
0
,
"Can't find random bot with this flag!\n\nA totally random bot will appear instead."
,
"WindBot"
,
MB_ICONERROR
);
}
}
arg
=
arg
.
Replace
(
"'"
,
"\""
);
if
(
int
.
Parse
(
args
[
1
])
==
1
)
if
(
int
.
Parse
(
args
[
1
])
==
1
)
{
{
arg
+=
" Hand=1"
;
arg
+=
" Hand=1"
;
...
@@ -39,8 +55,51 @@ namespace BotWrapper
...
@@ -39,8 +55,51 @@ namespace BotWrapper
}
}
catch
catch
{
{
MessageBox
((
IntPtr
)
0
,
"WindBot can't be started!"
,
"WindBot"
,
0x00000010
);
// MB_ICONERROR
MessageBox
((
IntPtr
)
0
,
"WindBot can't be started!"
,
"WindBot"
,
MB_ICONERROR
);
}
}
}
}
public
class
BotInfo
{
public
string
name
;
public
string
command
;
public
string
desc
;
public
string
[]
flags
;
}
static
public
IList
<
BotInfo
>
Bots
=
new
List
<
BotInfo
>();
static
void
ReadBots
()
{
using
(
StreamReader
reader
=
new
StreamReader
(
"bot.conf"
))
{
while
(!
reader
.
EndOfStream
)
{
string
line
=
reader
.
ReadLine
().
Trim
();
if
(
line
.
Length
>
0
&&
line
[
0
]
==
'!'
)
{
BotInfo
newBot
=
new
BotInfo
();
newBot
.
name
=
line
;
newBot
.
command
=
reader
.
ReadLine
().
Trim
();
newBot
.
desc
=
reader
.
ReadLine
().
Trim
();
line
=
reader
.
ReadLine
().
Trim
();
newBot
.
flags
=
line
.
Split
(
' '
);
Bots
.
Add
(
newBot
);
}
}
}
}
static
string
GetRandomBot
(
string
flag
)
{
IList
<
BotInfo
>
foundBots
=
Bots
.
Where
(
bot
=>
bot
.
flags
.
Contains
(
flag
)).
ToList
();
if
(
foundBots
.
Count
>
0
)
{
Random
rand
=
new
Random
();
BotInfo
bot
=
foundBots
[
rand
.
Next
(
foundBots
.
Count
)];
return
bot
.
command
;
}
return
""
;
}
}
}
}
}
BotWrapper/bot.conf
View file @
787e3cab
...
@@ -4,25 +4,40 @@
...
@@ -4,25 +4,40 @@
# description
# description
# flags (avail flags: SUPPORT_MASTER_RULE_3, SUPPORT_NEW_MASTER_RULE)
# flags (avail flags: SUPPORT_MASTER_RULE_3, SUPPORT_NEW_MASTER_RULE)
!随机-非常简单
Random
=
AI_LV1
主要是一些沙包。
SUPPORT_NEW_MASTER_RULE
!随机-简单
Random
=
AI_LV2
一些比较弱的卡组。
SUPPORT_NEW_MASTER_RULE
!随机-普通
Random
=
AI_LV3
一些环境里可以看到的卡组。
SUPPORT_NEW_MASTER_RULE
!谜之剑士
LV4
-龙骑星爆
!谜之剑士
LV4
-龙骑星爆
Name
=谜之剑士
LV4
Deck
=
Dragunity
Dialog
=
swordsman
.
zh
-
CN
Name
=谜之剑士
LV4
Deck
=
Dragunity
Dialog
=
swordsman
.
zh
-
CN
龙骑轴星尘龙爆裂体卡组。
龙骑轴星尘龙爆裂体卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!谜之剑士
LV4
-
R5
!谜之剑士
LV4
-
R5
Name
=谜之剑士
LV4
Deck
=
'Rank V'
Dialog
=
swordsman
.
zh
-
CN
Name
=谜之剑士
LV4
Deck
=
'Rank V'
Dialog
=
swordsman
.
zh
-
CN
5
阶超量卡组。
5
阶超量卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!谜之剑士
LV4
-异热同心武器
!谜之剑士
LV4
-异热同心武器
Name
=谜之剑士
LV4
Deck
=
'Zexal Weapons'
Dialog
=
swordsman
.
zh
-
CN
Name
=谜之剑士
LV4
Deck
=
'Zexal Weapons'
Dialog
=
swordsman
.
zh
-
CN
神装电光皇卡组。
神装电光皇卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!琪露诺-彩虹
!琪露诺-彩虹
Name
=琪露诺
Deck
=
Rainbow
Dialog
=
cirno
.
zh
-
CN
Name
=琪露诺
Deck
=
Rainbow
Dialog
=
cirno
.
zh
-
CN
全属性凡骨卡组。
全属性凡骨卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!琪露诺-饼蛙
!琪露诺-饼蛙
Name
=琪露诺
Deck
=
'Toadally Awesome'
Dialog
=
cirno
.
zh
-
CN
Name
=琪露诺
Deck
=
'Toadally Awesome'
Dialog
=
cirno
.
zh
-
CN
...
@@ -32,7 +47,7 @@ SUPPORT_MASTER_RULE_3
...
@@ -32,7 +47,7 @@ SUPPORT_MASTER_RULE_3
!复制植物-青眼
!复制植物-青眼
Name
=复制植物
Deck
=
Blue
-
Eyes
Dialog
=
copy
.
zh
-
CN
Name
=复制植物
Deck
=
Blue
-
Eyes
Dialog
=
copy
.
zh
-
CN
青眼卡组。
青眼卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!复制植物-十二兽
!复制植物-十二兽
Name
=复制植物
Deck
=
Zoodiac
Dialog
=
copy
.
zh
-
CN
Name
=复制植物
Deck
=
Zoodiac
Dialog
=
copy
.
zh
-
CN
...
@@ -42,64 +57,64 @@ SUPPORT_MASTER_RULE_3
...
@@ -42,64 +57,64 @@ SUPPORT_MASTER_RULE_3
!尼亚-妖仙兽
!尼亚-妖仙兽
Name
=尼亚
Deck
=
Yosenju
Dialog
=
near
.
zh
-
CN
Name
=尼亚
Deck
=
Yosenju
Dialog
=
near
.
zh
-
CN
妖仙兽卡组。
妖仙兽卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!尼亚-机壳
!尼亚-机壳
Name
=尼亚
Deck
=
Qliphort
Dialog
=
near
.
zh
-
CN
Name
=尼亚
Deck
=
Qliphort
Dialog
=
near
.
zh
-
CN
机壳卡组。
机壳卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!尼亚-淘气仙星
!尼亚-淘气仙星
Name
=尼亚
Deck
=
Trickstar
Dialog
=
near
.
zh
-
CN
Name
=尼亚
Deck
=
Trickstar
Dialog
=
near
.
zh
-
CN
淘气仙星卡组。
淘气仙星卡组。
SUPPORT_NEW_MASTER_RULE
AI_LV3
SUPPORT_NEW_MASTER_RULE
!永远之魂-削血
!永远之魂-削血
Name
=永远之魂
Deck
=
Burn
Dialog
=
soul
.
zh
-
CN
Name
=永远之魂
Deck
=
Burn
Dialog
=
soul
.
zh
-
CN
老式削血卡组。
老式削血卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV1
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!永远之魂-青蛙
!永远之魂-青蛙
Name
=永远之魂
Deck
=
Frog
Dialog
=
soul
.
zh
-
CN
Name
=永远之魂
Deck
=
Frog
Dialog
=
soul
.
zh
-
CN
老式青蛙卡组。
老式青蛙卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV1
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!永远之魂-荷鲁斯
!永远之魂-荷鲁斯
Name
=永远之魂
Deck
=
Horus
Dialog
=
soul
.
zh
-
CN
Name
=永远之魂
Deck
=
Horus
Dialog
=
soul
.
zh
-
CN
老式龙族卡组。
老式龙族卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV1
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!悠悠
!悠悠
Name
=悠悠
Deck
=
MokeyMokey
Dialog
=
mokey
.
zh
-
CN
Name
=悠悠
Deck
=
MokeyMokey
Dialog
=
mokey
.
zh
-
CN
沙包。
沙包。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV1
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!悠悠王
!悠悠王
Name
=悠悠王
Deck
=
MokeyMokeyKing
Dialog
=
mokey
.
zh
-
CN
Name
=悠悠王
Deck
=
MokeyMokeyKing
Dialog
=
mokey
.
zh
-
CN
大沙包。
大沙包。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV1
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!试作型机器人
1732
!试作型机器人
1732
Name
=试作型机器人
1732
Deck
=
ST1732
Dialog
=
zh
-
CN
Name
=试作型机器人
1732
Deck
=
ST1732
Dialog
=
zh
-
CN
由三盒
ST17
和三盒
SD32
组成的卡组。
由三盒
ST17
和三盒
SD32
组成的卡组。
SUPPORT_NEW_MASTER_RULE
AI_LV2
SUPPORT_NEW_MASTER_RULE
!奇異果
!奇異果
Name
=奇異果
Deck
=
LightswornShaddoldinosour
Dialog
=
kiwi
.
zh
-
TW
Name
=奇異果
Deck
=
LightswornShaddoldinosour
Dialog
=
kiwi
.
zh
-
TW
光道影依恐龙卡组。
光道影依恐龙卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!奇魔果
!奇魔果
Name
=奇魔果
Deck
=
DarkMagician
Dialog
=
kiwi
.
zh
-
TW
Name
=奇魔果
Deck
=
DarkMagician
Dialog
=
kiwi
.
zh
-
TW
黑魔术师卡组。
黑魔术师卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!燃血鬥士
!燃血鬥士
Name
=燃血鬥士
Deck
=
ChainBurn
Dialog
=
kiwi
.
zh
-
TW
Name
=燃血鬥士
Deck
=
ChainBurn
Dialog
=
kiwi
.
zh
-
TW
连锁烧卡组。
连锁烧卡组。
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
!复制梁龙-闪刀姬
!复制梁龙-闪刀姬
Name
=复制梁龙
Deck
=
SkyStriker
Dialog
=
anothercopy
.
zh
-
CN
Name
=复制梁龙
Deck
=
SkyStriker
Dialog
=
anothercopy
.
zh
-
CN
纯闪刀姬卡组。
纯闪刀姬卡组。
SUPPORT_NEW_MASTER_RULE
AI_LV3
SUPPORT_NEW_MASTER_RULE
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