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
702b3eb1
Commit
702b3eb1
authored
Mar 09, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tag lp track
parent
b48fe04e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
20 deletions
+54
-20
ygopro-server.coffee
ygopro-server.coffee
+16
-6
ygopro-server.js
ygopro-server.js
+38
-14
No files found.
ygopro-server.coffee
View file @
702b3eb1
...
...
@@ -1362,9 +1362,10 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
room
.
turn
=
room
.
turn
+
1
if
room
.
death
if
room
.
turn
>=
room
.
death
if
room
.
dueling_players
[
0
].
lp
!=
room
.
dueling_players
[
1
].
lp
and
room
.
turn
>
1
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_finish_part1}"
+
(
if
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
1
].
lp
then
room
.
dueling_players
[
0
]
else
room
.
dueling_players
[
1
]).
name
+
"${death_finish_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
ctos_send
((
if
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
1
].
lp
then
room
.
dueling_players
[
1
]
else
room
.
dueling_players
[
0
]).
server
,
'SURRENDER'
)
oppo_pos
=
if
room
.
hostinfo
.
mode
==
2
then
2
else
1
if
room
.
dueling_players
[
0
].
lp
!=
room
.
dueling_players
[
oppo_pos
].
lp
and
room
.
turn
>
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
.
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'
)
else
room
.
death
=
-
1
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_remain_final}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
...
...
@@ -1377,6 +1378,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
if
ygopro
.
constants
.
MSG
[
msg
]
==
'WIN'
and
client
.
pos
==
0
pos
=
buffer
.
readUInt8
(
1
)
pos
=
1
-
pos
unless
client
.
is_first
or
pos
==
2
pos
=
pos
*
2
if
pos
>=
0
and
room
.
hostinfo
.
mode
==
2
reason
=
buffer
.
readUInt8
(
2
)
#log.info {winner: pos, reason: reason}
#room.duels.push {winner: pos, reason: reason}
...
...
@@ -1396,6 +1398,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
if
ygopro
.
constants
.
MSG
[
msg
]
==
'DAMAGE'
and
client
.
pos
==
0
pos
=
buffer
.
readUInt8
(
1
)
pos
=
1
-
pos
unless
client
.
is_first
pos
=
pos
*
2
if
pos
>=
0
and
room
.
hostinfo
.
mode
==
2
val
=
buffer
.
readInt32LE
(
2
)
room
.
dueling_players
[
pos
].
lp
-=
val
if
0
<
room
.
dueling_players
[
pos
].
lp
<=
100
...
...
@@ -1404,18 +1407,21 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
if
ygopro
.
constants
.
MSG
[
msg
]
==
'RECOVER'
and
client
.
pos
==
0
pos
=
buffer
.
readUInt8
(
1
)
pos
=
1
-
pos
unless
client
.
is_first
pos
=
pos
*
2
if
pos
>=
0
and
room
.
hostinfo
.
mode
==
2
val
=
buffer
.
readInt32LE
(
2
)
room
.
dueling_players
[
pos
].
lp
+=
val
if
ygopro
.
constants
.
MSG
[
msg
]
==
'LPUPDATE'
and
client
.
pos
==
0
pos
=
buffer
.
readUInt8
(
1
)
pos
=
1
-
pos
unless
client
.
is_first
pos
=
pos
*
2
if
pos
>=
0
and
room
.
hostinfo
.
mode
==
2
val
=
buffer
.
readInt32LE
(
2
)
room
.
dueling_players
[
pos
].
lp
=
val
if
ygopro
.
constants
.
MSG
[
msg
]
==
'PAY_LPCOST'
and
client
.
pos
==
0
pos
=
buffer
.
readUInt8
(
1
)
pos
=
1
-
pos
unless
client
.
is_first
pos
=
pos
*
2
if
pos
>=
0
and
room
.
hostinfo
.
mode
==
2
val
=
buffer
.
readInt32LE
(
2
)
room
.
dueling_players
[
pos
].
lp
-=
val
if
0
<
room
.
dueling_players
[
pos
].
lp
<=
100
...
...
@@ -1977,8 +1983,12 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
if
client
.
pos
==
0
dueltime
=
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
)
replay_filename
=
dueltime
for
player
,
i
in
room
.
dueling_players
replay_filename
=
replay_filename
+
(
if
i
>
0
then
" VS "
else
" "
)
+
player
.
name
if
room
.
hostinfo
.
mode
==
2
for
player
,
i
in
room
.
dueling_players
replay_filename
=
replay_filename
+
(
if
i
>
0
then
" VS "
else
" "
)
+
player
.
name
else
for
player
,
i
in
room
.
dueling_players
replay_filename
=
replay_filename
+
(
if
i
>
0
then
(
if
i
==
2
then
" VS "
else
" & "
)
else
" "
)
+
player
.
name
replay_filename
=
replay_filename
.
replace
(
/[\/\\\?\*]/g
,
'_'
)
+
".yrp"
duellog
=
{
time
:
dueltime
,
...
...
@@ -2085,7 +2095,7 @@ if settings.modules.http
needpass
:
(
room
.
name
.
indexOf
(
'$'
)
!=
-
1
).
toString
(),
users
:
(
for
player
in
room
.
players
when
player
.
pos
?
id
:
(
-
1
).
toString
(),
name
:
player
.
name
+
(
if
settings
.
modules
.
http
.
show_ip
and
pass_validated
and
!
player
.
is_local
then
(
" (IP: "
+
player
.
ip
.
slice
(
7
)
+
")"
)
else
""
)
+
(
if
settings
.
modules
.
http
.
show_info
and
room
.
started
and
not
(
room
.
hostinfo
.
mode
==
2
and
player
.
pos
>
1
)
then
(
" (Score:"
+
room
.
scores
[
player
.
name
]
+
" LP:"
+
(
if
player
.
lp
?
then
player
.
lp
else
room
.
hostinfo
.
start_lp
)
+
")"
)
else
""
),
name
:
player
.
name
+
(
if
settings
.
modules
.
http
.
show_ip
and
pass_validated
and
!
player
.
is_local
then
(
" (IP: "
+
player
.
ip
.
slice
(
7
)
+
")"
)
else
""
)
+
(
if
settings
.
modules
.
http
.
show_info
and
room
.
started
and
not
(
room
.
hostinfo
.
mode
==
2
and
player
.
pos
%
2
>
0
)
then
(
" (Score:"
+
room
.
scores
[
player
.
name
]
+
" LP:"
+
(
if
player
.
lp
?
then
player
.
lp
else
room
.
hostinfo
.
start_lp
)
+
")"
)
else
""
),
pos
:
player
.
pos
),
istart
:
if
room
.
started
then
(
if
settings
.
modules
.
http
.
show_info
then
(
"Duel:"
+
room
.
duel_count
+
" "
+
(
if
room
.
changing_side
then
"Siding"
else
"Turn:"
+
(
if
room
.
turn
?
then
room
.
turn
else
0
)
+
(
if
room
.
death
then
"/"
+
(
if
room
.
death
>
0
then
room
.
death
-
1
else
"Death"
)
else
""
)))
else
'start'
)
else
'wait'
...
...
ygopro-server.js
View file @
702b3eb1
...
...
@@ -1607,7 +1607,7 @@
}
ygopro
.
stoc_follow
(
'
GAME_MSG
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var
card
,
j
,
len
,
line
,
msg
,
playertype
,
pos
,
reason
,
ref
,
ref1
,
ref2
,
room
,
val
;
var
card
,
j
,
len
,
line
,
msg
,
oppo_pos
,
playertype
,
pos
,
reason
,
ref
,
ref1
,
ref2
,
room
,
val
;
room
=
ROOM_all
[
client
.
rid
];
if
(
!
room
)
{
return
;
...
...
@@ -1638,9 +1638,10 @@
room
.
turn
=
room
.
turn
+
1
;
if
(
room
.
death
)
{
if
(
room
.
turn
>=
room
.
death
)
{
if
(
room
.
dueling_players
[
0
].
lp
!==
room
.
dueling_players
[
1
].
lp
&&
room
.
turn
>
1
)
{
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_finish_part1}
"
+
(
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
1
].
lp
?
room
.
dueling_players
[
0
]
:
room
.
dueling_players
[
1
]).
name
+
"
${death_finish_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
ctos_send
((
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
1
].
lp
?
room
.
dueling_players
[
1
]
:
room
.
dueling_players
[
0
]).
server
,
'
SURRENDER
'
);
oppo_pos
=
room
.
hostinfo
.
mode
===
2
?
2
:
1
;
if
(
room
.
dueling_players
[
0
].
lp
!==
room
.
dueling_players
[
oppo_pos
].
lp
&&
room
.
turn
>
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
.
ctos_send
((
room
.
dueling_players
[
0
].
lp
>
room
.
dueling_players
[
oppo_pos
].
lp
?
room
.
dueling_players
[
oppo_pos
]
:
room
.
dueling_players
[
0
]).
server
,
'
SURRENDER
'
);
}
else
{
room
.
death
=
-
1
;
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${death_remain_final}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
...
...
@@ -1660,6 +1661,9 @@
if
(
!
(
client
.
is_first
||
pos
===
2
))
{
pos
=
1
-
pos
;
}
if
(
pos
>=
0
&&
room
.
hostinfo
.
mode
===
2
)
{
pos
=
pos
*
2
;
}
reason
=
buffer
.
readUInt8
(
2
);
room
.
winner
=
pos
;
room
.
turn
=
0
;
...
...
@@ -1680,6 +1684,9 @@
if
(
!
client
.
is_first
)
{
pos
=
1
-
pos
;
}
if
(
pos
>=
0
&&
room
.
hostinfo
.
mode
===
2
)
{
pos
=
pos
*
2
;
}
val
=
buffer
.
readInt32LE
(
2
);
room
.
dueling_players
[
pos
].
lp
-=
val
;
if
((
0
<
(
ref
=
room
.
dueling_players
[
pos
].
lp
)
&&
ref
<=
100
))
{
...
...
@@ -1691,6 +1698,9 @@
if
(
!
client
.
is_first
)
{
pos
=
1
-
pos
;
}
if
(
pos
>=
0
&&
room
.
hostinfo
.
mode
===
2
)
{
pos
=
pos
*
2
;
}
val
=
buffer
.
readInt32LE
(
2
);
room
.
dueling_players
[
pos
].
lp
+=
val
;
}
...
...
@@ -1699,6 +1709,9 @@
if
(
!
client
.
is_first
)
{
pos
=
1
-
pos
;
}
if
(
pos
>=
0
&&
room
.
hostinfo
.
mode
===
2
)
{
pos
=
pos
*
2
;
}
val
=
buffer
.
readInt32LE
(
2
);
room
.
dueling_players
[
pos
].
lp
=
val
;
}
...
...
@@ -1707,6 +1720,9 @@
if
(
!
client
.
is_first
)
{
pos
=
1
-
pos
;
}
if
(
pos
>=
0
&&
room
.
hostinfo
.
mode
===
2
)
{
pos
=
pos
*
2
;
}
val
=
buffer
.
readInt32LE
(
2
);
room
.
dueling_players
[
pos
].
lp
-=
val
;
if
((
0
<
(
ref1
=
room
.
dueling_players
[
pos
].
lp
)
&&
ref1
<=
100
))
{
...
...
@@ -2483,7 +2499,7 @@
});
ygopro
.
stoc_follow
(
'
REPLAY
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
var
duellog
,
dueltime
,
i
,
j
,
len
,
player
,
ref
,
replay_filename
,
room
;
var
duellog
,
dueltime
,
i
,
j
,
k
,
len
,
len1
,
player
,
ref
,
ref1
,
replay_filename
,
room
;
room
=
ROOM_all
[
client
.
rid
];
if
(
!
room
)
{
return
settings
.
modules
.
tournament_mode
.
enabled
&&
settings
.
modules
.
tournament_mode
.
replay_safe
;
...
...
@@ -2495,10 +2511,18 @@
if
(
client
.
pos
===
0
)
{
dueltime
=
moment
().
format
(
'
YYYY-MM-DD HH:mm:ss
'
);
replay_filename
=
dueltime
;
ref
=
room
.
dueling_players
;
for
(
i
=
j
=
0
,
len
=
ref
.
length
;
j
<
len
;
i
=
++
j
)
{
player
=
ref
[
i
];
replay_filename
=
replay_filename
+
(
i
>
0
?
"
VS
"
:
"
"
)
+
player
.
name
;
if
(
room
.
hostinfo
.
mode
===
2
)
{
ref
=
room
.
dueling_players
;
for
(
i
=
j
=
0
,
len
=
ref
.
length
;
j
<
len
;
i
=
++
j
)
{
player
=
ref
[
i
];
replay_filename
=
replay_filename
+
(
i
>
0
?
"
VS
"
:
"
"
)
+
player
.
name
;
}
}
else
{
ref1
=
room
.
dueling_players
;
for
(
i
=
k
=
0
,
len1
=
ref1
.
length
;
k
<
len1
;
i
=
++
k
)
{
player
=
ref1
[
i
];
replay_filename
=
replay_filename
+
(
i
>
0
?
(
i
===
2
?
"
VS
"
:
"
&
"
)
:
"
"
)
+
player
.
name
;
}
}
replay_filename
=
replay_filename
.
replace
(
/
[\/\\\?\*]
/g
,
'
_
'
)
+
"
.yrp
"
;
duellog
=
{
...
...
@@ -2508,11 +2532,11 @@
cloud_replay_id
:
"
R#
"
+
room
.
cloud_replay_id
,
replay_filename
:
replay_filename
,
players
:
(
function
()
{
var
k
,
len1
,
ref1
,
results
;
ref
1
=
room
.
dueling_players
;
var
l
,
len2
,
ref2
,
results
;
ref
2
=
room
.
dueling_players
;
results
=
[];
for
(
k
=
0
,
len1
=
ref1
.
length
;
k
<
len1
;
k
++
)
{
player
=
ref
1
[
k
];
for
(
l
=
0
,
len2
=
ref2
.
length
;
l
<
len2
;
l
++
)
{
player
=
ref
2
[
l
];
results
.
push
({
name
:
player
.
name
+
(
settings
.
modules
.
tournament_mode
.
show_ip
&&
!
player
.
is_local
?
"
(IP:
"
+
player
.
ip
.
slice
(
7
)
+
"
)
"
:
""
)
+
(
settings
.
modules
.
tournament_mode
.
show_info
&&
!
(
room
.
hostinfo
.
mode
===
2
&&
player
.
pos
>
1
)
?
"
(Score:
"
+
room
.
scores
[
player
.
name
]
+
"
LP:
"
+
(
player
.
lp
!=
null
?
player
.
lp
:
room
.
hostinfo
.
start_lp
)
+
"
)
"
:
""
),
winner
:
player
.
pos
===
room
.
winner
...
...
@@ -2649,7 +2673,7 @@
if
(
player
.
pos
!=
null
)
{
results1
.
push
({
id
:
(
-
1
).
toString
(),
name
:
player
.
name
+
(
settings
.
modules
.
http
.
show_ip
&&
pass_validated
&&
!
player
.
is_local
?
"
(IP:
"
+
player
.
ip
.
slice
(
7
)
+
"
)
"
:
""
)
+
(
settings
.
modules
.
http
.
show_info
&&
room
.
started
&&
!
(
room
.
hostinfo
.
mode
===
2
&&
player
.
pos
>
1
)
?
"
(Score:
"
+
room
.
scores
[
player
.
name
]
+
"
LP:
"
+
(
player
.
lp
!=
null
?
player
.
lp
:
room
.
hostinfo
.
start_lp
)
+
"
)
"
:
""
),
name
:
player
.
name
+
(
settings
.
modules
.
http
.
show_ip
&&
pass_validated
&&
!
player
.
is_local
?
"
(IP:
"
+
player
.
ip
.
slice
(
7
)
+
"
)
"
:
""
)
+
(
settings
.
modules
.
http
.
show_info
&&
room
.
started
&&
!
(
room
.
hostinfo
.
mode
===
2
&&
player
.
pos
%
2
>
0
)
?
"
(Score:
"
+
room
.
scores
[
player
.
name
]
+
"
LP:
"
+
(
player
.
lp
!=
null
?
player
.
lp
:
room
.
hostinfo
.
start_lp
)
+
"
)
"
:
""
),
pos
:
player
.
pos
});
}
...
...
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