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
b2ade927
Commit
b2ade927
authored
Feb 02, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
side tip and side timeout for mycard
parent
a8b4148b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
24 deletions
+68
-24
ygopro-server.coffee
ygopro-server.coffee
+30
-12
ygopro-server.js
ygopro-server.js
+38
-12
No files found.
ygopro-server.coffee
View file @
b2ade927
...
...
@@ -1354,7 +1354,7 @@ if settings.modules.tips.get
load_tips
()
setInterval
()
->
for
room
in
ROOM_all
when
room
and
room
.
established
ygopro.stoc_send_random_tip_to_room(room)
unless room and room.started
ygopro
.
stoc_send_random_tip_to_room
(
room
)
if
!
room
.
started
or
room
.
changing_side
return
,
30000
...
...
@@ -1538,7 +1538,7 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)->
buff_side
=
(
info
.
deckbuf
[
i
]
for
i
in
[
info
.
mainc
...
info
.
mainc
+
info
.
sidec
])
client
.
main
=
buff_main
client
.
side
=
buff_side
if room.random_type
if
room
.
random_type
or
room
.
arena
if
client
.
is_host
room
.
waiting_for_player
=
room
.
waiting_for_player2
room
.
last_active_time
=
moment
()
...
...
@@ -1585,7 +1585,7 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)->
ygopro
.
ctos_follow
'RESPONSE'
,
false
,
(
buffer
,
info
,
client
,
server
)
->
room
=
ROOM_all
[
client
.
rid
]
return unless room and
room.random_type
return
unless
room
and
(
room
.
random_type
or
room
.
arena
)
room
.
last_active_time
=
moment
()
return
...
...
@@ -1615,19 +1615,23 @@ ygopro.stoc_follow 'SELECT_HAND', false, (buffer, info, client, server)->
ygopro
.
stoc_follow
'SELECT_TP'
,
false
,
(
buffer
,
info
,
client
,
server
)
->
room
=
ROOM_all
[
client
.
rid
]
return unless room and room.random_type
room.waiting_for_player = client
room.last_active_time = moment()
return
unless
room
room
.
changing_side
=
false
if
room
.
random_type
room
.
waiting_for_player
=
client
room
.
last_active_time
=
moment
()
return
ygopro
.
stoc_follow
'CHANGE_SIDE'
,
false
,
(
buffer
,
info
,
client
,
server
)
->
room
=
ROOM_all
[
client
.
rid
]
return unless room and room.random_type
if client.is_host
room.waiting_for_player = client
else
room.waiting_for_player2 = client
room.last_active_time = moment()
return
unless
room
room
.
changing_side
=
true
if
room
.
random_type
or
room
.
arena
if
client
.
is_host
room
.
waiting_for_player
=
client
else
room
.
waiting_for_player2
=
client
room
.
last_active_time
=
moment
()
return
ygopro
.
stoc_follow
'REPLAY'
,
true
,
(
buffer
,
info
,
client
,
server
)
->
...
...
@@ -1680,6 +1684,20 @@ if settings.modules.random_duel.enabled
return
,
1000
if
settings
.
modules
.
mycard
.
enabled
setInterval
()
->
for
room
in
ROOM_all
when
room
and
room
.
started
and
room
.
arena
and
room
.
changing_side
and
room
.
last_active_time
and
room
.
waiting_for_player
time_passed
=
Math
.
floor
((
moment
()
-
room
.
last_active_time
)
/
1000
)
#log.info time_passed
if
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
room
.
last_active_time
=
moment
()
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
room
.
waiting_for_player
.
name
}
${kicked_by_system}"
,
ygopro
.
constants
.
COLORS
.
RED
)
room
.
waiting_for_player
.
server
.
destroy
()
else
if
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
and
not
(
time_passed
%
10
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
room
.
waiting_for_player
.
name
}
${afk_warn_part1}
#{
settings
.
modules
.
random_duel
.
hang_timeout
-
time_passed
}
${afk_warn_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
return
,
1000
# spawn windbot
if
settings
.
modules
.
windbot
.
spawn
windbot_process
=
spawn
'mono'
,
[
'WindBot.exe'
,
settings
.
modules
.
windbot
.
port
],
{
cwd
:
'windbot'
}
...
...
ygopro-server.js
View file @
b2ade927
...
...
@@ -1651,7 +1651,7 @@
for
(
j
=
0
,
len
=
ROOM_all
.
length
;
j
<
len
;
j
++
)
{
room
=
ROOM_all
[
j
];
if
(
room
&&
room
.
established
)
{
if
(
!
(
room
&&
room
.
started
)
)
{
if
(
!
room
.
started
||
room
.
changing_side
)
{
ygopro
.
stoc_send_random_tip_to_room
(
room
);
}
}
...
...
@@ -1912,7 +1912,7 @@
})();
client
.
main
=
buff_main
;
client
.
side
=
buff_side
;
if
(
room
.
random_type
)
{
if
(
room
.
random_type
||
room
.
arena
)
{
if
(
client
.
is_host
)
{
room
.
waiting_for_player
=
room
.
waiting_for_player2
;
}
...
...
@@ -1973,7 +1973,7 @@
ygopro
.
ctos_follow
(
'
RESPONSE
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var
room
;
room
=
ROOM_all
[
client
.
rid
];
if
(
!
(
room
&&
room
.
random_type
))
{
if
(
!
(
room
&&
(
room
.
random_type
||
room
.
arena
)
))
{
return
;
}
room
.
last_active_time
=
moment
();
...
...
@@ -2017,25 +2017,31 @@
ygopro
.
stoc_follow
(
'
SELECT_TP
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var
room
;
room
=
ROOM_all
[
client
.
rid
];
if
(
!
(
room
&&
room
.
random_type
)
)
{
if
(
!
room
)
{
return
;
}
room
.
waiting_for_player
=
client
;
room
.
last_active_time
=
moment
();
room
.
changing_side
=
false
;
if
(
room
.
random_type
)
{
room
.
waiting_for_player
=
client
;
room
.
last_active_time
=
moment
();
}
});
ygopro
.
stoc_follow
(
'
CHANGE_SIDE
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var
room
;
room
=
ROOM_all
[
client
.
rid
];
if
(
!
(
room
&&
room
.
random_type
)
)
{
if
(
!
room
)
{
return
;
}
if
(
client
.
is_host
)
{
room
.
waiting_for_player
=
client
;
}
else
{
room
.
waiting_for_player2
=
client
;
room
.
changing_side
=
true
;
if
(
room
.
random_type
||
room
.
arena
)
{
if
(
client
.
is_host
)
{
room
.
waiting_for_player
=
client
;
}
else
{
room
.
waiting_for_player2
=
client
;
}
room
.
last_active_time
=
moment
();
}
room
.
last_active_time
=
moment
();
});
ygopro
.
stoc_follow
(
'
REPLAY
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
...
...
@@ -2116,6 +2122,26 @@
},
1000
);
}
if
(
settings
.
modules
.
mycard
.
enabled
)
{
setInterval
(
function
()
{
var
j
,
len
,
room
,
time_passed
;
for
(
j
=
0
,
len
=
ROOM_all
.
length
;
j
<
len
;
j
++
)
{
room
=
ROOM_all
[
j
];
if
(
!
(
room
&&
room
.
started
&&
room
.
arena
&&
room
.
changing_side
&&
room
.
last_active_time
&&
room
.
waiting_for_player
))
{
continue
;
}
time_passed
=
Math
.
floor
((
moment
()
-
room
.
last_active_time
)
/
1000
);
if
(
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
)
{
room
.
last_active_time
=
moment
();
ygopro
.
stoc_send_chat_to_room
(
room
,
room
.
waiting_for_player
.
name
+
"
${kicked_by_system}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
room
.
waiting_for_player
.
server
.
destroy
();
}
else
if
(
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
&&
!
(
time_passed
%
10
))
{
ygopro
.
stoc_send_chat_to_room
(
room
,
room
.
waiting_for_player
.
name
+
"
${afk_warn_part1}
"
+
(
settings
.
modules
.
random_duel
.
hang_timeout
-
time_passed
)
+
"
${afk_warn_part2}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
},
1000
);
}
if
(
settings
.
modules
.
windbot
.
spawn
)
{
windbot_process
=
spawn
(
'
mono
'
,
[
'
WindBot.exe
'
,
settings
.
modules
.
windbot
.
port
],
{
cwd
:
'
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