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
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
srvpro
Commits
d7c5a50c
Commit
d7c5a50c
authored
Nov 15, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make athletic arena post score if player escape before match starts
parent
c12e2ad3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
21 deletions
+58
-21
i18n.json
i18n.json
+2
-1
ygopro-server.coffee
ygopro-server.coffee
+20
-7
ygopro-server.js
ygopro-server.js
+36
-13
No files found.
i18n.json
View file @
d7c5a50c
...
...
@@ -179,7 +179,8 @@
"unwelcome_warn_part1"
:
"如果您经常"
,
"unwelcome_warn_part2"
:
",您的对手可能会离你而去。"
,
"unwelcome_tip_part1"
:
"因为您的对手有"
,
"unwelcome_tip_part2"
:
"行为,现在您可以直接离开游戏或投降,不视为强退。"
"unwelcome_tip_part2"
:
"行为,现在您可以直接离开游戏或投降,不视为强退。"
,
"athletic_arena_tip"
:
"在竞技匹配中,比赛开始前退出游戏也会视为投降。"
},
"ko-kr"
:
{
"random_duel_enter_room_waiting"
:
"땅콩: 게임을 진행하게 준비 또는 시작을 하십시오."
,
...
...
ygopro-server.coffee
View file @
d7c5a50c
...
...
@@ -448,13 +448,15 @@ class Room
delete
:
->
return
if
@
deleted
#log.info 'room-delete', this.name, ROOM_all.length
if
@
started
and
settings
.
modules
.
arena_mode
.
enabled
and
@
arena
#log.info @scores
score_array
=
[]
for
name
,
score
of
@
scores
score_array
.
push
{
name
:
name
,
score
:
score
}
score_array
=
[]
for
name
,
score
of
@
scores
score_array
.
push
{
name
:
name
,
score
:
score
}
if
score_array
.
length
>
0
and
settings
.
modules
.
arena_mode
.
enabled
and
@
arena
#log.info 'SCORE', score_array, @start_time
if
score_array
.
length
==
2
end_time
=
moment
().
format
()
if
!
@
start_time
@
start_time
=
end_time
request
.
post
{
url
:
settings
.
modules
.
arena_mode
.
post_score
,
form
:
{
accesskey
:
settings
.
modules
.
arena_mode
.
accesskey
,
usernameA
:
score_array
[
0
].
name
,
...
...
@@ -462,7 +464,7 @@ class Room
userscoreA
:
score_array
[
0
].
score
,
userscoreB
:
score_array
[
1
].
score
,
start
:
@
start_time
,
end
:
moment
().
format
()
,
end
:
end_time
,
arena
:
@
arena
}},
(
error
,
response
,
body
)
=>
if
error
...
...
@@ -575,9 +577,13 @@ class Room
@
watchers
.
splice
(
index
,
1
)
unless
index
==
-
1
#client.room = null
else
#log.info(client.name, @started, @disconnector, @random_type, @players.length)
if
@
arena
==
"athletic"
and
!
@
started
and
@
players
.
length
==
2
for
player
in
@
players
when
player
.
pos
!=
7
@
scores
[
player
.
name
]
=
0
@
scores
[
client
.
name
]
=
-
9
index
=
_
.
indexOf
(
@
players
,
client
)
@
players
.
splice
(
index
,
1
)
unless
index
==
-
1
#log.info(@started,@disconnector,@random_type)
if
@
started
and
@
disconnector
!=
'server'
and
(
client
.
pos
<
4
or
client
.
is_host
)
@
finished
=
true
@
scores
[
client
.
name
]
=
-
9
...
...
@@ -991,6 +997,9 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
room
=
ROOM_find_or_create_by_name
(
'M#'
+
info
.
pass
.
slice
(
8
))
room
.
private
=
true
room
.
arena
=
settings
.
modules
.
arena_mode
.
mode
if
room
.
arena
==
"athletic"
room
.
max_player
=
2
room
.
welcome
=
"${athletic_arena_tip}"
when
5
title
=
info
.
pass
.
slice
(
8
).
replace
(
String
.
fromCharCode
(
0xFEFF
),
' '
)
room
=
ROOM_find_by_title
(
title
)
...
...
@@ -1304,6 +1313,10 @@ ygopro.ctos_follow 'HS_KICK', true, (buffer, info, client, server)->
return
unless
room
for
player
in
room
.
players
if
player
and
player
.
pos
==
info
.
pos
and
player
!=
client
if
room
.
arena
==
"athletic"
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
${kicked_by_system}"
,
ygopro
.
constants
.
COLORS
.
RED
)
client
.
destroy
()
return
true
client
.
kick_count
=
if
client
.
kick_count
then
client
.
kick_count
+
1
else
1
if
client
.
kick_count
>=
5
and
room
.
random_type
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
${kicked_by_system}"
,
ygopro
.
constants
.
COLORS
.
RED
)
...
...
ygopro-server.js
View file @
d7c5a50c
...
...
@@ -605,21 +605,25 @@
}
Room
.
prototype
[
"
delete
"
]
=
function
()
{
var
index
,
log_rep_id
,
name
,
player_ips
,
player_names
,
recorder_buffer
,
ref
,
replay_id
,
score
,
score_array
;
var
end_time
,
index
,
log_rep_id
,
name
,
player_ips
,
player_names
,
recorder_buffer
,
ref
,
replay_id
,
score
,
score_array
;
if
(
this
.
deleted
)
{
return
;
}
if
(
this
.
started
&&
settings
.
modules
.
arena_mode
.
enabled
&&
this
.
arena
)
{
score_array
=
[]
;
ref
=
this
.
scores
;
for
(
name
in
ref
)
{
score
=
ref
[
name
];
score_array
.
push
({
name
:
name
,
score
:
score
});
}
score_array
=
[];
ref
=
this
.
scores
;
for
(
name
in
ref
)
{
score
=
ref
[
name
];
score_array
.
push
({
name
:
name
,
score
:
score
});
}
if
(
score_array
.
length
>
0
&&
settings
.
modules
.
arena_mode
.
enabled
&&
this
.
arena
)
{
if
(
score_array
.
length
===
2
)
{
end_time
=
moment
().
format
();
if
(
!
this
.
start_time
)
{
this
.
start_time
=
end_time
;
}
request
.
post
({
url
:
settings
.
modules
.
arena_mode
.
post_score
,
form
:
{
...
...
@@ -629,7 +633,7 @@
userscoreA
:
score_array
[
0
].
score
,
userscoreB
:
score_array
[
1
].
score
,
start
:
this
.
start_time
,
end
:
moment
().
format
()
,
end
:
end_time
,
arena
:
this
.
arena
}
},
(
function
(
_this
)
{
...
...
@@ -763,7 +767,7 @@
};
Room
.
prototype
.
disconnect
=
function
(
client
,
error
)
{
var
index
;
var
index
,
j
,
len
,
player
,
ref
;
if
(
client
.
is_post_watcher
)
{
ygopro
.
stoc_send_chat_to_room
(
this
,
(
client
.
name
+
"
${quit_watch}
"
)
+
(
error
?
"
:
"
+
error
:
''
));
index
=
_
.
indexOf
(
this
.
watchers
,
client
);
...
...
@@ -771,6 +775,16 @@
this
.
watchers
.
splice
(
index
,
1
);
}
}
else
{
if
(
this
.
arena
===
"
athletic
"
&&
!
this
.
started
&&
this
.
players
.
length
===
2
)
{
ref
=
this
.
players
;
for
(
j
=
0
,
len
=
ref
.
length
;
j
<
len
;
j
++
)
{
player
=
ref
[
j
];
if
(
player
.
pos
!==
7
)
{
this
.
scores
[
player
.
name
]
=
0
;
}
}
this
.
scores
[
client
.
name
]
=
-
9
;
}
index
=
_
.
indexOf
(
this
.
players
,
client
);
if
(
index
!==
-
1
)
{
this
.
players
.
splice
(
index
,
1
);
...
...
@@ -1213,6 +1227,10 @@
room
=
ROOM_find_or_create_by_name
(
'
M#
'
+
info
.
pass
.
slice
(
8
));
room
[
"
private
"
]
=
true
;
room
.
arena
=
settings
.
modules
.
arena_mode
.
mode
;
if
(
room
.
arena
===
"
athletic
"
)
{
room
.
max_player
=
2
;
room
.
welcome
=
"
${athletic_arena_tip}
"
;
}
break
;
case
5
:
title
=
info
.
pass
.
slice
(
8
).
replace
(
String
.
fromCharCode
(
0xFEFF
),
'
'
);
...
...
@@ -1559,6 +1577,11 @@
for
(
j
=
0
,
len
=
ref
.
length
;
j
<
len
;
j
++
)
{
player
=
ref
[
j
];
if
(
player
&&
player
.
pos
===
info
.
pos
&&
player
!==
client
)
{
if
(
room
.
arena
===
"
athletic
"
)
{
ygopro
.
stoc_send_chat_to_room
(
room
,
client
.
name
+
"
${kicked_by_system}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
client
.
destroy
();
return
true
;
}
client
.
kick_count
=
client
.
kick_count
?
client
.
kick_count
+
1
:
1
;
if
(
client
.
kick_count
>=
5
&&
room
.
random_type
)
{
ygopro
.
stoc_send_chat_to_room
(
room
,
client
.
name
+
"
${kicked_by_system}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
...
...
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