Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
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
srvpro
Commits
b35e9dd0
Commit
b35e9dd0
authored
Mar 30, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add switches
parent
21ca68db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
50 deletions
+61
-50
config.bot.json
config.bot.json
+39
-0
config.json
config.json
+9
-41
ygopro-server.coffee
ygopro-server.coffee
+6
-4
ygopro-server.js
ygopro-server.js
+7
-5
No files found.
config.bot.json
0 → 100644
View file @
b35e9dd0
{
"windbots"
:
[
{
"name"
:
"琪露诺"
,
"deck"
:
"Burn"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"琪露诺"
,
"deck"
:
"Frog"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"琪露诺"
,
"deck"
:
"Horus"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"琪露诺"
,
"deck"
:
"OldSchool"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"谜之剑士LV4"
,
"deck"
:
"Dragunity"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"谜之剑士LV4"
,
"deck"
:
"Rank V"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"谜之剑士LV4"
,
"deck"
:
"Zexal Weapons"
,
"dialog"
:
"zh-CN"
}
]
}
\ No newline at end of file
config.json
View file @
b35e9dd0
...
...
@@ -5,58 +5,26 @@
"welcome"
:
"YGOPRO Server"
,
"update"
:
"请更新游戏版本"
,
"stop"
:
false
,
"tips"
:
"http://mercury233.me/ygosrv233tips.json"
,
"tips"
:
"http://mercury233.me/ygosrv233
/
tips.json"
,
"dialogues"
:
"http://mercury233.me/ygosrv233/dialogues.json"
,
"enable_websocket_roomlist"
:
false
,
"enable_random_duel"
:
false
,
"enable_halfway_watch"
:
true
,
"enable_TCG_as_default"
:
false
,
"enable_cloud_replay"
:
false
,
"enable_windbot"
:
false
,
"enable_websocket_roomlist"
:
false
,
"redis_port"
:
6379
,
"mycard_auth"
:
false
,
"hang_timeout"
:
90
,
"http"
:
{
"port"
:
7922
,
"password"
:
"123456"
,
"ssl"
:
{
"enabled"
:
false
}
},
"windbot"
:
[
{
"name"
:
"琪露诺"
,
"deck"
:
"Burn"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"琪露诺"
,
"deck"
:
"Frog"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"琪露诺"
,
"deck"
:
"Horus"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"琪露诺"
,
"deck"
:
"OldSchool"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"谜之剑士LV4"
,
"deck"
:
"Dragunity"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"谜之剑士LV4"
,
"deck"
:
"Rank V"
,
"dialog"
:
"zh-CN"
},
{
"name"
:
"谜之剑士LV4"
,
"deck"
:
"Zexal Weapons"
,
"dialog"
:
"zh-CN"
"enabled"
:
false
,
"port"
:
7923
,
"cert"
:
"ssl/ygopro-server.crt"
,
"key"
:
"ssl/ygopro-server.key"
}
]
}
}
}
ygopro-server.coffee
View file @
b35e9dd0
...
...
@@ -25,7 +25,6 @@ moment = require 'moment'
settings
=
require
'./config.json'
settings
.
BANNED_user
=
[]
settings
.
BANNED_IP
=
[]
settings
.
modules
.
hang_timeout
=
90
settings
.
version
=
parseInt
(
fs
.
readFileSync
(
'ygopro/gframe/game.cpp'
,
'utf8'
).
match
(
/PRO_VERSION = ([x\d]+)/
)[
1
],
'16'
)
settings
.
lflist
=
(
for
list
in
fs
.
readFileSync
(
'ygopro/lflist.conf'
,
'utf8'
).
match
(
/!.*/g
)
date
=
list
.
match
(
/!([\d\.]+)/
)
...
...
@@ -37,6 +36,9 @@ if settings.modules.enable_cloud_replay
zlib
=
require
'zlib'
redisdb
=
redis
.
createClient
host
:
"127.0.0.1"
,
port
:
settings
.
modules
.
redis_port
if
settings
.
modules
.
enable_windbot
settings
.
modules
.
windbots
=
require
(
'./config.bot.json'
).
windbots
#组件
ygopro
=
require
'./ygopro.js'
Room
=
require
'./room.js'
...
...
@@ -330,11 +332,11 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
}
client
.
end
()
else
if
settings
.
modules
.
windbot
and
info
.
pass
[
0
...
2
]
==
'AI'
else
if
settings
.
modules
.
enable_
windbot
and
info
.
pass
[
0
...
2
]
==
'AI'
if
info
.
pass
.
length
>
3
and
info
.
pass
[
0
...
3
]
==
'AI#'
or
info
.
pass
[
0
...
3
]
==
'AI_'
name
=
info
.
pass
.
slice
(
3
)
windbot
=
_
.
sample
_
.
filter
settings
.
modules
.
windbot
,
(
w
)
->
windbot
=
_
.
sample
_
.
filter
settings
.
modules
.
windbot
s
,
(
w
)
->
w
.
name
==
name
or
w
.
deck
==
name
if
!
windbot
ygopro
.
stoc_send_chat
(
client
,
'主机密码不正确 (Invalid Windbot Name)'
,
11
)
...
...
@@ -345,7 +347,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client
.
end
()
return
else
windbot
=
_
.
sample
settings
.
modules
.
windbot
windbot
=
_
.
sample
settings
.
modules
.
windbot
s
room
=
Room
.
find_or_create_by_name
(
'AI#'
+
Math
.
floor
(
Math
.
random
()
*
100000
))
# 这个 AI# 没有特殊作用, 仅作为标记
room
.
windbot
=
windbot
...
...
ygopro-server.js
View file @
b35e9dd0
...
...
@@ -36,8 +36,6 @@
settings
.
BANNED_IP
=
[];
settings
.
modules
.
hang_timeout
=
90
;
settings
.
version
=
parseInt
(
fs
.
readFileSync
(
'
ygopro/gframe/game.cpp
'
,
'
utf8
'
).
match
(
/PRO_VERSION =
([
x
\d]
+
)
/
)[
1
],
'
16
'
);
settings
.
lflist
=
(
function
()
{
...
...
@@ -67,6 +65,10 @@
});
}
if
(
settings
.
modules
.
enable_windbot
)
{
settings
.
modules
.
windbots
=
require
(
'
./config.bot.json
'
).
windbots
;
}
ygopro
=
require
(
'
./ygopro.js
'
);
Room
=
require
(
'
./room.js
'
);
...
...
@@ -386,10 +388,10 @@
code
:
2
});
client
.
end
();
}
else
if
(
settings
.
modules
.
windbot
&&
info
.
pass
.
slice
(
0
,
2
)
===
'
AI
'
)
{
}
else
if
(
settings
.
modules
.
enable_
windbot
&&
info
.
pass
.
slice
(
0
,
2
)
===
'
AI
'
)
{
if
(
info
.
pass
.
length
>
3
&&
info
.
pass
.
slice
(
0
,
3
)
===
'
AI#
'
||
info
.
pass
.
slice
(
0
,
3
)
===
'
AI_
'
)
{
name
=
info
.
pass
.
slice
(
3
);
windbot
=
_
.
sample
(
_
.
filter
(
settings
.
modules
.
windbot
,
function
(
w
)
{
windbot
=
_
.
sample
(
_
.
filter
(
settings
.
modules
.
windbot
s
,
function
(
w
)
{
return
w
.
name
===
name
||
w
.
deck
===
name
;
}));
if
(
!
windbot
)
{
...
...
@@ -402,7 +404,7 @@
return
;
}
}
else
{
windbot
=
_
.
sample
(
settings
.
modules
.
windbot
);
windbot
=
_
.
sample
(
settings
.
modules
.
windbot
s
);
}
room
=
Room
.
find_or_create_by_name
(
'
AI#
'
+
Math
.
floor
(
Math
.
random
()
*
100000
));
room
.
windbot
=
windbot
;
...
...
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