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
e9720098
Commit
e9720098
authored
Apr 03, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/moecube/srvpro
into mc
parents
5a7cf228
b0152b7e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
25 deletions
+75
-25
README.md
README.md
+6
-0
data/i18n.json
data/i18n.json
+2
-0
ygopro-server.coffee
ygopro-server.coffee
+30
-11
ygopro-server.js
ygopro-server.js
+37
-14
No files found.
README.md
View file @
e9720098
...
@@ -14,6 +14,12 @@
...
@@ -14,6 +14,12 @@
*
先行卡一键更新
*
先行卡一键更新
*
WindBot在线AI
*
WindBot在线AI
*
萌卡用户登陆
*
萌卡用户登陆
*
竞赛模式锁定玩家卡组
*
竞赛模式后台保存录像
*
竞赛模式自动加时赛系统(规则可调)
*
0 正常加时赛规则
*
1 YGOCore战队联盟第十二届联赛使用规则
*
2 正常加时赛规则 + 1胜规则
### 不支持功能
### 不支持功能
*
在线聊天室
*
在线聊天室
...
...
data/i18n.json
View file @
e9720098
...
@@ -209,6 +209,8 @@
...
@@ -209,6 +209,8 @@
"death_remain_final"
:
"若本回合基本分发生变动,在该回合结束时决斗即告结束,生命值多的玩家获得本场决斗的胜利。"
,
"death_remain_final"
:
"若本回合基本分发生变动,在该回合结束时决斗即告结束,生命值多的玩家获得本场决斗的胜利。"
,
"death_finish_part1"
:
"加时赛决斗结束,恭喜 "
,
"death_finish_part1"
:
"加时赛决斗结束,恭喜 "
,
"death_finish_part2"
:
" 获得本次决斗的胜利。"
,
"death_finish_part2"
:
" 获得本次决斗的胜利。"
,
"death2_finish_part1"
:
"加时赛结束,恭喜 "
,
"death2_finish_part2"
:
" 获得本次比赛的胜利。"
,
"side_timeout_part1"
:
"你现在有"
,
"side_timeout_part1"
:
"你现在有"
,
"side_timeout_part2"
:
"分钟来更换副卡组。"
,
"side_timeout_part2"
:
"分钟来更换副卡组。"
,
"side_overtime"
:
"你因为更换副卡组超时,本次比赛已被判负。"
,
"side_overtime"
:
"你因为更换副卡组超时,本次比赛已被判负。"
,
...
...
ygopro-server.coffee
View file @
e9720098
...
@@ -122,6 +122,11 @@ catch
...
@@ -122,6 +122,11 @@ catch
config
=
{}
config
=
{}
settings
=
global
.
settings
=
merge
(
default_config
,
config
,
{
arrayMerge
:
(
destination
,
source
)
->
source
})
settings
=
global
.
settings
=
merge
(
default_config
,
config
,
{
arrayMerge
:
(
destination
,
source
)
->
source
})
#reset http.quick_death_rule from true to 1
if
settings
.
modules
.
http
.
quick_death_rule
==
true
settings
.
modules
.
http
.
quick_death_rule
=
1
setting_save
(
settings
)
# 读取数据
# 读取数据
default_data
=
loadJSON
(
'./data/default_data.json'
)
default_data
=
loadJSON
(
'./data/default_data.json'
)
try
try
...
@@ -1364,10 +1369,10 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
...
@@ -1364,10 +1369,10 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
room
.
turn
=
room
.
turn
+
1
room
.
turn
=
room
.
turn
+
1
if
room
.
death
if
room
.
death
if
room
.
turn
>=
room
.
death
if
room
.
turn
>=
room
.
death
oppo_pos
=
if
room
.
hostinfo
.
mode
==
2
then
2
else
1
if
room
.
dueling_players
[
0
].
lp
!=
room
.
dueling_players
[
1
].
lp
and
room
.
turn
>
1
if
room
.
dueling_players
[
0
].
lp
!=
room
.
dueling_players
[
oppo_pos
].
lp
and
room
.
turn
>
1
win_pos
=
if
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
1
].
lp
then
0
else
1
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_finish_part1}"
+
(
if
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
oppo_pos
].
lp
then
room
.
dueling_players
[
0
]
else
room
.
dueling_players
[
oppo_pos
])
.
name
+
"${death_finish_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_finish_part1}"
+
room
.
dueling_players
[
win_pos
]
.
name
+
"${death_finish_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
ctos_send
(
(
if
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
oppo_pos
].
lp
then
room
.
dueling_players
[
oppo_pos
]
else
room
.
dueling_players
[
0
])
.
server
,
'SURRENDER'
)
ygopro
.
ctos_send
(
room
.
dueling_players
[
1
-
win_pos
]
.
server
,
'SURRENDER'
)
else
else
room
.
death
=
-
1
room
.
death
=
-
1
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_remain_final}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_remain_final}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
...
@@ -1391,7 +1396,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
...
@@ -1391,7 +1396,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
#log.info room.dueling_players, pos
#log.info room.dueling_players, pos
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
if
room
.
death
if
room
.
death
if
settings
.
modules
.
http
.
quick_death_rule
if
settings
.
modules
.
http
.
quick_death_rule
==
1
room
.
death
=
-
1
room
.
death
=
-
1
else
else
room
.
death
=
5
room
.
death
=
5
...
@@ -1838,6 +1843,11 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)->
...
@@ -1838,6 +1843,11 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)->
clearInterval
client
.
side_interval
clearInterval
client
.
side_interval
client
.
side_interval
=
null
client
.
side_interval
=
null
client
.
side_tcount
=
null
client
.
side_tcount
=
null
if
settings
.
modules
.
http
.
quick_death_rule
==
2
and
room
.
started
and
room
.
death
and
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
!=
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
win_pos
=
if
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
>
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
then
0
else
1
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death2_finish_part1}"
+
room
.
dueling_players
[
win_pos
].
name
+
"${death2_finish_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
room
.
dueling_players
[
1
-
win_pos
].
destroy
()
return
true
if
room
.
random_type
or
room
.
arena
if
room
.
random_type
or
room
.
arena
if
client
.
pos
==
0
if
client
.
pos
==
0
room
.
waiting_for_player
=
room
.
waiting_for_player2
room
.
waiting_for_player
=
room
.
waiting_for_player2
...
@@ -2245,12 +2255,21 @@ if settings.modules.http
...
@@ -2245,12 +2255,21 @@ if settings.modules.http
room
.
death
=
(
if
room
.
turn
then
room
.
turn
+
4
else
5
)
room
.
death
=
(
if
room
.
turn
then
room
.
turn
+
4
else
5
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
else
else
if
settings
.
modules
.
http
.
quick_death_rule
switch
settings
.
modules
.
http
.
quick_death_rule
room
.
death
=
-
1
when
2
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start_quick}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
if
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
==
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
else
room
.
death
=
5
room
.
death
=
5
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start_siding}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start_siding}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
else
win_pos
=
if
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
>
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
then
0
else
1
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death2_finish_part1}"
+
room
.
dueling_players
[
win_pos
].
name
+
"${death2_finish_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
room
.
dueling_players
[
1
-
win_pos
].
destroy
()
when
1
room
.
death
=
-
1
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start_quick}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
else
room
.
death
=
5
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start_siding}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
response
.
writeHead
(
200
)
response
.
writeHead
(
200
)
if
death_room_found
if
death_room_found
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"['death ok', '"
+
u
.
query
.
death
+
"']"
))
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"['death ok', '"
+
u
.
query
.
death
+
"']"
))
...
...
ygopro-server.js
View file @
e9720098
...
@@ -160,6 +160,11 @@
...
@@ -160,6 +160,11 @@
}
}
});
});
if
(
settings
.
modules
.
http
.
quick_death_rule
===
true
)
{
settings
.
modules
.
http
.
quick_death_rule
=
1
;
setting_save
(
settings
);
}
default_data
=
loadJSON
(
'
./data/default_data.json
'
);
default_data
=
loadJSON
(
'
./data/default_data.json
'
);
try
{
try
{
...
@@ -1609,7 +1614,7 @@
...
@@ -1609,7 +1614,7 @@
}
}
ygopro
.
stoc_follow
(
'
GAME_MSG
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
ygopro
.
stoc_follow
(
'
GAME_MSG
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var
card
,
j
,
len
,
line
,
msg
,
oppo_pos
,
playertype
,
pos
,
reason
,
ref
,
ref1
,
ref2
,
room
,
trigger_location
,
val
;
var
card
,
j
,
len
,
line
,
msg
,
playertype
,
pos
,
reason
,
ref
,
ref1
,
ref2
,
room
,
trigger_location
,
val
,
win_pos
;
room
=
ROOM_all
[
client
.
rid
];
room
=
ROOM_all
[
client
.
rid
];
if
(
!
room
)
{
if
(
!
room
)
{
return
;
return
;
...
@@ -1640,10 +1645,10 @@
...
@@ -1640,10 +1645,10 @@
room
.
turn
=
room
.
turn
+
1
;
room
.
turn
=
room
.
turn
+
1
;
if
(
room
.
death
)
{
if
(
room
.
death
)
{
if
(
room
.
turn
>=
room
.
death
)
{
if
(
room
.
turn
>=
room
.
death
)
{
oppo_pos
=
room
.
hostinfo
.
mode
===
2
?
2
:
1
;
if
(
room
.
dueling_players
[
0
].
lp
!==
room
.
dueling_players
[
1
].
lp
&&
room
.
turn
>
1
)
{
if
(
room
.
dueling_players
[
0
].
lp
!==
room
.
dueling_players
[
oppo_pos
].
lp
&&
room
.
turn
>
1
)
{
win_pos
=
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
1
].
lp
?
0
:
1
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_finish_part1}
"
+
(
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
oppo_pos
].
lp
?
room
.
dueling_players
[
0
]
:
room
.
dueling_players
[
oppo_pos
])
.
name
+
"
${death_finish_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_finish_part1}
"
+
room
.
dueling_players
[
win_pos
]
.
name
+
"
${death_finish_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
ctos_send
(
(
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
oppo_pos
].
lp
?
room
.
dueling_players
[
oppo_pos
]
:
room
.
dueling_players
[
0
])
.
server
,
'
SURRENDER
'
);
ygopro
.
ctos_send
(
room
.
dueling_players
[
1
-
win_pos
]
.
server
,
'
SURRENDER
'
);
}
else
{
}
else
{
room
.
death
=
-
1
;
room
.
death
=
-
1
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_remain_final}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_remain_final}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
...
@@ -1674,7 +1679,7 @@
...
@@ -1674,7 +1679,7 @@
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
;
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
;
}
}
if
(
room
.
death
)
{
if
(
room
.
death
)
{
if
(
settings
.
modules
.
http
.
quick_death_rule
)
{
if
(
settings
.
modules
.
http
.
quick_death_rule
===
1
)
{
room
.
death
=
-
1
;
room
.
death
=
-
1
;
}
else
{
}
else
{
room
.
death
=
5
;
room
.
death
=
5
;
...
@@ -2285,7 +2290,7 @@
...
@@ -2285,7 +2290,7 @@
});
});
ygopro
.
ctos_follow
(
'
UPDATE_DECK
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
ygopro
.
ctos_follow
(
'
UPDATE_DECK
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
var
buff_main
,
buff_side
,
card
,
current_deck
,
deck
,
deck_array
,
deck_main
,
deck_side
,
deck_text
,
deckbuf
,
decks
,
found_deck
,
i
,
j
,
k
,
len
,
len1
,
line
,
room
,
struct
;
var
buff_main
,
buff_side
,
card
,
current_deck
,
deck
,
deck_array
,
deck_main
,
deck_side
,
deck_text
,
deckbuf
,
decks
,
found_deck
,
i
,
j
,
k
,
len
,
len1
,
line
,
room
,
struct
,
win_pos
;
room
=
ROOM_all
[
client
.
rid
];
room
=
ROOM_all
[
client
.
rid
];
if
(
!
room
)
{
if
(
!
room
)
{
return
false
;
return
false
;
...
@@ -2313,6 +2318,12 @@
...
@@ -2313,6 +2318,12 @@
client
.
side_interval
=
null
;
client
.
side_interval
=
null
;
client
.
side_tcount
=
null
;
client
.
side_tcount
=
null
;
}
}
if
(
settings
.
modules
.
http
.
quick_death_rule
===
2
&&
room
.
started
&&
room
.
death
&&
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
!==
room
.
scores
[
room
.
dueling_players
[
1
].
name
])
{
win_pos
=
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
>
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
?
0
:
1
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death2_finish_part1}
"
+
room
.
dueling_players
[
win_pos
].
name
+
"
${death2_finish_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
room
.
dueling_players
[
1
-
win_pos
].
destroy
();
return
true
;
}
if
(
room
.
random_type
||
room
.
arena
)
{
if
(
room
.
random_type
||
room
.
arena
)
{
if
(
client
.
pos
===
0
)
{
if
(
client
.
pos
===
0
)
{
room
.
waiting_for_player
=
room
.
waiting_for_player2
;
room
.
waiting_for_player
=
room
.
waiting_for_player2
;
...
@@ -2649,7 +2660,7 @@
...
@@ -2649,7 +2660,7 @@
return
callback
+
"
(
"
+
text
+
"
);
"
;
return
callback
+
"
(
"
+
text
+
"
);
"
;
};
};
requestListener
=
function
(
request
,
response
)
{
requestListener
=
function
(
request
,
response
)
{
var
archive_args
,
archive_name
,
archive_process
,
check
,
death_room_found
,
duellog
,
error
,
filename
,
getpath
,
j
,
k
,
l
,
len
,
len1
,
len2
,
len3
,
m
,
parseQueryString
,
pass_validated
,
player
,
ref
,
replay
,
room
,
roomsjson
,
u
;
var
archive_args
,
archive_name
,
archive_process
,
check
,
death_room_found
,
duellog
,
error
,
filename
,
getpath
,
j
,
k
,
l
,
len
,
len1
,
len2
,
len3
,
m
,
parseQueryString
,
pass_validated
,
player
,
ref
,
replay
,
room
,
roomsjson
,
u
,
win_pos
;
parseQueryString
=
true
;
parseQueryString
=
true
;
u
=
url
.
parse
(
request
.
url
,
parseQueryString
);
u
=
url
.
parse
(
request
.
url
,
parseQueryString
);
pass_validated
=
u
.
query
.
pass
===
settings
.
modules
.
http
.
password
;
pass_validated
=
u
.
query
.
pass
===
settings
.
modules
.
http
.
password
;
...
@@ -2863,12 +2874,24 @@
...
@@ -2863,12 +2874,24 @@
room
.
death
=
(
room
.
turn
?
room
.
turn
+
4
:
5
);
room
.
death
=
(
room
.
turn
?
room
.
turn
+
4
:
5
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
else
{
}
else
{
if
(
settings
.
modules
.
http
.
quick_death_rule
)
{
switch
(
settings
.
modules
.
http
.
quick_death_rule
)
{
room
.
death
=
-
1
;
case
2
:
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start_quick}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
if
(
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
===
room
.
scores
[
room
.
dueling_players
[
1
].
name
])
{
}
else
{
room
.
death
=
5
;
room
.
death
=
5
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start_siding}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start_siding}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
else
{
win_pos
=
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
>
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
?
0
:
1
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death2_finish_part1}
"
+
room
.
dueling_players
[
win_pos
].
name
+
"
${death2_finish_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
room
.
dueling_players
[
1
-
win_pos
].
destroy
();
}
break
;
case
1
:
room
.
death
=
-
1
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start_quick}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
break
;
default
:
room
.
death
=
5
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start_siding}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
}
}
}
}
}
...
...
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