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
8b1f8400
Commit
8b1f8400
authored
Mar 30, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add recorder for cloud replay
and ygopro should send hand cards data to Marshtomp
parent
b35e9dd0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
6 deletions
+56
-6
room.coffee
room.coffee
+4
-2
room.js
room.js
+5
-3
ygopro-server.coffee
ygopro-server.coffee
+22
-0
ygopro-server.js
ygopro-server.js
+25
-1
No files found.
room.coffee
View file @
8b1f8400
...
...
@@ -149,6 +149,7 @@ class Room
@
started
=
false
@
established
=
false
@
watcher_buffers
=
[]
@
recorder_buffers
=
[]
@
watchers
=
[]
@
random_type
=
''
@
welcome
=
''
...
...
@@ -359,8 +360,8 @@ class Room
_
.
each
@
player_datas
,
(
player
)
=>
player_ips
.
push
(
player
.
ip
)
return
watcher_buffer
=
Buffer
.
concat
(
@
watch
er_buffers
)
zlib
.
deflate
watch
er_buffer
,
(
err
,
replay_buffer
)
=>
recorder_buffer
=
Buffer
.
concat
(
@
record
er_buffers
)
zlib
.
deflate
record
er_buffer
,
(
err
,
replay_buffer
)
=>
replay_buffer
=
replay_buffer
.
toString
(
'binary'
)
#log.info err, replay_buffer
date_time
=
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
)
...
...
@@ -379,6 +380,7 @@ class Room
return
return
@
watcher_buffers
=
[]
@
recorder_buffers
=
[]
@
players
=
[]
@
watcher
.
end
()
if
@
watcher
@
deleted
=
true
...
...
room.js
View file @
8b1f8400
...
...
@@ -208,6 +208,7 @@
this
.
started
=
false
;
this
.
established
=
false
;
this
.
watcher_buffers
=
[];
this
.
recorder_buffers
=
[];
this
.
watchers
=
[];
this
.
random_type
=
''
;
this
.
welcome
=
''
;
...
...
@@ -457,7 +458,7 @@
}
Room
.
prototype
[
"
delete
"
]
=
function
()
{
var
index
,
player_ips
,
player_names
,
watch
er_buffer
;
var
index
,
player_ips
,
player_names
,
record
er_buffer
;
if
(
this
.
deleted
)
{
return
;
}
...
...
@@ -469,8 +470,8 @@
player_ips
.
push
(
player
.
ip
);
};
})(
this
));
watcher_buffer
=
Buffer
.
concat
(
this
.
watch
er_buffers
);
zlib
.
deflate
(
watch
er_buffer
,
(
function
(
_this
)
{
recorder_buffer
=
Buffer
.
concat
(
this
.
record
er_buffers
);
zlib
.
deflate
(
record
er_buffer
,
(
function
(
_this
)
{
return
function
(
err
,
replay_buffer
)
{
var
date_time
,
recorded_ip
,
replay_id
;
replay_buffer
=
replay_buffer
.
toString
(
'
binary
'
);
...
...
@@ -490,6 +491,7 @@
})(
this
));
}
this
.
watcher_buffers
=
[];
this
.
recorder_buffers
=
[];
this
.
players
=
[];
if
(
this
.
watcher
)
{
this
.
watcher
.
end
();
...
...
ygopro-server.coffee
View file @
8b1f8400
...
...
@@ -577,6 +577,27 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if
client
.
room
.
welcome
ygopro
.
stoc_send_chat
client
,
client
.
room
.
welcome
,
14
if
settings
.
modules
.
enable_cloud_replay
and
!
client
.
room
.
recorder
client
.
room
.
recorder
=
recorder
=
net
.
connect
client
.
room
.
port
,
->
ygopro
.
ctos_send
recorder
,
'PLAYER_INFO'
,
{
name
:
"Marshtomp"
}
ygopro
.
ctos_send
recorder
,
'JOIN_GAME'
,
{
version
:
settings
.
version
,
gameid
:
2577
,
some_unknown_mysterious_fucking_thing
:
0
pass
:
""
}
ygopro
.
ctos_send
recorder
,
'HS_TOOBSERVER'
return
recorder
.
on
'data'
,
(
data
)
->
return
unless
client
.
room
client
.
room
.
recorder_buffers
.
push
data
recorder
.
on
'error'
,
(
error
)
->
return
if
settings
.
modules
.
enable_halfway_watch
and
!
client
.
room
.
watcher
client
.
room
.
watcher
=
watcher
=
net
.
connect
client
.
room
.
port
,
->
ygopro
.
ctos_send
watcher
,
'PLAYER_INFO'
,
{
...
...
@@ -780,6 +801,7 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
return
ygopro
.
ctos_follow
'CHAT'
,
true
,
(
buffer
,
info
,
client
,
server
)
->
return
unless
client
.
room
cancel
=
_
.
startsWith
(
_
.
trim
(
info
.
msg
),
"/"
)
client
.
room
.
last_active_time
=
moment
()
unless
cancel
or
not
client
.
room
.
random_type
switch
_
.
trim
(
info
.
msg
)
...
...
ygopro-server.js
View file @
8b1f8400
...
...
@@ -637,7 +637,7 @@
});
ygopro
.
stoc_follow
(
'
JOIN_GAME
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var
watcher
;
var
recorder
,
watcher
;
if
(
!
client
.
room
)
{
return
;
}
...
...
@@ -647,6 +647,27 @@
if
(
client
.
room
.
welcome
)
{
ygopro
.
stoc_send_chat
(
client
,
client
.
room
.
welcome
,
14
);
}
if
(
settings
.
modules
.
enable_cloud_replay
&&
!
client
.
room
.
recorder
)
{
client
.
room
.
recorder
=
recorder
=
net
.
connect
(
client
.
room
.
port
,
function
()
{
ygopro
.
ctos_send
(
recorder
,
'
PLAYER_INFO
'
,
{
name
:
"
Marshtomp
"
});
ygopro
.
ctos_send
(
recorder
,
'
JOIN_GAME
'
,
{
version
:
settings
.
version
,
gameid
:
2577
,
some_unknown_mysterious_fucking_thing
:
0
,
pass
:
""
});
ygopro
.
ctos_send
(
recorder
,
'
HS_TOOBSERVER
'
);
});
recorder
.
on
(
'
data
'
,
function
(
data
)
{
if
(
!
client
.
room
)
{
return
;
}
return
client
.
room
.
recorder_buffers
.
push
(
data
);
});
recorder
.
on
(
'
error
'
,
function
(
error
)
{});
}
if
(
settings
.
modules
.
enable_halfway_watch
&&
!
client
.
room
.
watcher
)
{
client
.
room
.
watcher
=
watcher
=
net
.
connect
(
client
.
room
.
port
,
function
()
{
ygopro
.
ctos_send
(
watcher
,
'
PLAYER_INFO
'
,
{
...
...
@@ -932,6 +953,9 @@
ygopro
.
ctos_follow
(
'
CHAT
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
var
cancel
;
if
(
!
client
.
room
)
{
return
;
}
cancel
=
_
.
startsWith
(
_
.
trim
(
info
.
msg
),
"
/
"
);
if
(
!
(
cancel
||
!
client
.
room
.
random_type
))
{
client
.
room
.
last_active_time
=
moment
();
...
...
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