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
0de28045
Commit
0de28045
authored
Mar 31, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve death option
parent
d60d2217
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
ygopro-server.coffee
ygopro-server.coffee
+12
-7
ygopro-server.js
ygopro-server.js
+14
-8
No files found.
ygopro-server.coffee
View file @
0de28045
...
@@ -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
...
@@ -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
and
settings
.
modules
.
http
.
quick_death_rule
!=
2
if
settings
.
modules
.
http
.
quick_death_rule
==
1
room
.
death
=
-
1
room
.
death
=
-
1
else
else
room
.
death
=
5
room
.
death
=
5
...
@@ -2245,8 +2250,8 @@ if settings.modules.http
...
@@ -2245,8 +2250,8 @@ 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
if
settings
.
modules
.
http
.
quick_death_rule
==
2
when
2
if
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
==
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
if
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
==
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
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
)
...
@@ -2254,12 +2259,12 @@ if settings.modules.http
...
@@ -2254,12 +2259,12 @@ if settings.modules.http
win_pos
=
if
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
>
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
then
0
else
1
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
)
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
()
room
.
dueling_players
[
1
-
win_pos
].
destroy
()
else
when
1
room
.
death
=
-
1
room
.
death
=
-
1
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start_quick}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_start_quick}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
else
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
)
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 @
0de28045
...
@@ -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
{
...
@@ -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
&&
settings
.
modules
.
http
.
quick_death_rule
!==
2
)
{
if
(
settings
.
modules
.
http
.
quick_death_rule
===
1
)
{
room
.
death
=
-
1
;
room
.
death
=
-
1
;
}
else
{
}
else
{
room
.
death
=
5
;
room
.
death
=
5
;
...
@@ -2863,8 +2868,8 @@
...
@@ -2863,8 +2868,8 @@
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
)
{
if
(
settings
.
modules
.
http
.
quick_death_rule
===
2
)
{
case
2
:
if
(
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
===
room
.
scores
[
room
.
dueling_players
[
1
].
name
])
{
if
(
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
===
room
.
scores
[
room
.
dueling_players
[
1
].
name
])
{
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
);
...
@@ -2873,13 +2878,14 @@
...
@@ -2873,13 +2878,14 @@
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death2_finish_part1}
"
+
room
.
dueling_players
[
win_pos
].
name
+
"
${death2_finish_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
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
();
room
.
dueling_players
[
1
-
win_pos
].
destroy
();
}
}
}
else
{
break
;
case
1
:
room
.
death
=
-
1
;
room
.
death
=
-
1
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start_quick}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_start_quick}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
break
;
}
else
{
default
:
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
);
}
}
}
}
}
}
...
...
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