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
c452e487
Commit
c452e487
authored
Feb 13, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow show private room in started roomlist
parent
0f10dfcb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
20 deletions
+28
-20
roomlist.coffee
roomlist.coffee
+5
-5
roomlist.js
roomlist.js
+13
-5
ygopro-server.coffee
ygopro-server.coffee
+5
-5
ygopro-server.js
ygopro-server.js
+5
-5
No files found.
roomlist.coffee
View file @
c452e487
...
...
@@ -20,23 +20,23 @@ init = (http_server, ROOM_all)->
connection
.
filter
=
url
.
parse
(
connection
.
upgradeReq
.
url
,
true
).
query
.
filter
||
'waiting'
connection
.
send
JSON
.
stringify
event
:
'init'
data
:
room_data
(
room
)
for
room
in
ROOM_all
when
room
and
room
.
established
and
!
room
.
private
and
(
room
.
started
==
(
connection
.
filter
==
'started'
))
data
:
room_data
(
room
)
for
room
in
ROOM_all
when
room
and
room
.
established
and
(
connection
.
filter
==
'started'
or
!
room
.
private
)
and
(
room
.
started
==
(
connection
.
filter
==
'started'
))
create
=
(
room
)
->
broadcast
(
'create'
,
room_data
(
room
),
'waiting'
)
broadcast
(
'create'
,
room_data
(
room
),
'waiting'
)
if
!
room
.
private
update
=
(
room
)
->
broadcast
(
'update'
,
room_data
(
room
),
'waiting'
)
broadcast
(
'update'
,
room_data
(
room
),
'waiting'
)
if
!
room
.
private
start
=
(
room
)
->
broadcast
(
'delete'
,
room_data
(
room
),
'waiting'
)
broadcast
(
'delete'
,
room_data
(
room
),
'waiting'
)
if
!
room
.
private
broadcast
(
'create'
,
room_data
(
room
),
'started'
)
_delete
=
(
room
)
->
if
(
room
.
started
)
broadcast
(
'delete'
,
room
.
name
,
'started'
)
else
broadcast
(
'delete'
,
room
.
name
,
'waiting'
)
broadcast
(
'delete'
,
room
.
name
,
'waiting'
)
if
!
room
.
private
broadcast
=
(
event
,
data
,
filter
)
->
return
if
!
server
...
...
roomlist.js
View file @
c452e487
...
...
@@ -50,7 +50,7 @@
results
=
[];
for
(
i
=
0
,
len
=
ROOM_all
.
length
;
i
<
len
;
i
++
)
{
room
=
ROOM_all
[
i
];
if
(
room
&&
room
.
established
&&
!
room
[
"
private
"
]
&&
(
room
.
started
===
(
connection
.
filter
===
'
started
'
)))
{
if
(
room
&&
room
.
established
&&
(
connection
.
filter
===
'
started
'
||
!
room
[
"
private
"
])
&&
(
room
.
started
===
(
connection
.
filter
===
'
started
'
)))
{
results
.
push
(
room_data
(
room
));
}
}
...
...
@@ -61,15 +61,21 @@
};
create
=
function
(
room
)
{
if
(
!
room
[
"
private
"
])
{
return
broadcast
(
'
create
'
,
room_data
(
room
),
'
waiting
'
);
}
};
update
=
function
(
room
)
{
if
(
!
room
[
"
private
"
])
{
return
broadcast
(
'
update
'
,
room_data
(
room
),
'
waiting
'
);
}
};
start
=
function
(
room
)
{
if
(
!
room
[
"
private
"
])
{
broadcast
(
'
delete
'
,
room_data
(
room
),
'
waiting
'
);
}
return
broadcast
(
'
create
'
,
room_data
(
room
),
'
started
'
);
};
...
...
@@ -77,8 +83,10 @@
if
(
room
.
started
)
{
return
broadcast
(
'
delete
'
,
room
.
name
,
'
started
'
);
}
else
{
if
(
!
room
[
"
private
"
])
{
return
broadcast
(
'
delete
'
,
room
.
name
,
'
waiting
'
);
}
}
};
broadcast
=
function
(
event
,
data
,
filter
)
{
...
...
ygopro-server.coffee
View file @
c452e487
...
...
@@ -415,7 +415,7 @@ class Room
@
process
.
stdout
.
setEncoding
(
'utf8'
)
@
process
.
stdout
.
once
'data'
,
(
data
)
=>
@
established
=
true
roomlist
.
create
(
this
)
if
!
@
private
and
settings
.
modules
.
http
.
websocket_roomlist
roomlist
.
create
(
this
)
if
settings
.
modules
.
http
.
websocket_roomlist
@
port
=
parseInt
data
_
.
each
@
players
,
(
player
)
=>
player
.
server
.
connect
@
port
,
'127.0.0.1'
,
->
...
...
@@ -509,7 +509,7 @@ class Room
index
=
_
.
indexOf
(
ROOM_all
,
this
)
ROOM_all
[
index
]
=
null
unless
index
==
-
1
#ROOM_all.splice(index, 1) unless index == -1
roomlist
.
delete
this
if
!
@
private
and
@
established
and
settings
.
modules
.
http
.
websocket_roomlist
roomlist
.
delete
this
if
@
established
and
settings
.
modules
.
http
.
websocket_roomlist
return
get_playing_player
:
->
...
...
@@ -553,7 +553,7 @@ class Room
ROOM_players_oppentlist
[
client
.
ip
]
=
null
if
@
established
roomlist
.
update
(
this
)
if
!
@
private
and
!
@
started
and
settings
.
modules
.
http
.
websocket_roomlist
roomlist
.
update
(
this
)
if
!
@
started
and
settings
.
modules
.
http
.
websocket_roomlist
client
.
server
.
connect
@
port
,
'127.0.0.1'
,
->
client
.
server
.
write
buffer
for
buffer
in
client
.
pre_establish_buffers
client
.
established
=
true
...
...
@@ -578,7 +578,7 @@ class Room
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"${random_ban_reason_flee}"
)
if
@
players
.
length
and
!
(
@
windbot
and
client
.
is_host
)
ygopro
.
stoc_send_chat_to_room
this
,
"
#{
client
.
name
}
${left_game}"
+
if
error
then
":
#{
error
}
"
else
''
roomlist
.
update
(
this
)
if
!
@
private
and
!
@
started
and
settings
.
modules
.
http
.
websocket_roomlist
roomlist
.
update
(
this
)
if
!
@
started
and
settings
.
modules
.
http
.
websocket_roomlist
#client.room = null
else
@
process
.
kill
()
...
...
@@ -1370,7 +1370,7 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
unless
room
.
started
#first start
room
.
started
=
true
room
.
start_time
=
moment
().
format
()
roomlist
.
start
room
if
settings
.
modules
.
http
.
websocket_roomlist
and
not
room
.
private
roomlist
.
start
room
if
settings
.
modules
.
http
.
websocket_roomlist
#room.duels = []
room
.
dueling_players
=
[]
for
player
in
room
.
players
when
player
.
pos
!=
7
...
...
ygopro-server.js
View file @
c452e487
...
...
@@ -555,7 +555,7 @@
this
.
process
.
stdout
.
once
(
'
data
'
,
(
function
(
_this
)
{
return
function
(
data
)
{
_this
.
established
=
true
;
if
(
!
_this
[
"
private
"
]
&&
settings
.
modules
.
http
.
websocket_roomlist
)
{
if
(
settings
.
modules
.
http
.
websocket_roomlist
)
{
roomlist
.
create
(
_this
);
}
_this
.
port
=
parseInt
(
data
);
...
...
@@ -682,7 +682,7 @@
if
(
index
!==
-
1
)
{
ROOM_all
[
index
]
=
null
;
}
if
(
!
this
[
"
private
"
]
&&
this
.
established
&&
settings
.
modules
.
http
.
websocket_roomlist
)
{
if
(
this
.
established
&&
settings
.
modules
.
http
.
websocket_roomlist
)
{
roomlist
[
"
delete
"
](
this
);
}
};
...
...
@@ -737,7 +737,7 @@
}
}
if
(
this
.
established
)
{
if
(
!
this
[
"
private
"
]
&&
!
this
.
started
&&
settings
.
modules
.
http
.
websocket_roomlist
)
{
if
(
!
this
.
started
&&
settings
.
modules
.
http
.
websocket_roomlist
)
{
roomlist
.
update
(
this
);
}
client
.
server
.
connect
(
this
.
port
,
'
127.0.0.1
'
,
function
()
{
...
...
@@ -775,7 +775,7 @@
}
if
(
this
.
players
.
length
&&
!
(
this
.
windbot
&&
client
.
is_host
))
{
ygopro
.
stoc_send_chat_to_room
(
this
,
(
client
.
name
+
"
${left_game}
"
)
+
(
error
?
"
:
"
+
error
:
''
));
if
(
!
this
[
"
private
"
]
&&
!
this
.
started
&&
settings
.
modules
.
http
.
websocket_roomlist
)
{
if
(
!
this
.
started
&&
settings
.
modules
.
http
.
websocket_roomlist
)
{
roomlist
.
update
(
this
);
}
}
else
{
...
...
@@ -1674,7 +1674,7 @@
if
(
!
room
.
started
)
{
room
.
started
=
true
;
room
.
start_time
=
moment
().
format
();
if
(
settings
.
modules
.
http
.
websocket_roomlist
&&
!
room
[
"
private
"
]
)
{
if
(
settings
.
modules
.
http
.
websocket_roomlist
)
{
roomlist
.
start
(
room
);
}
room
.
dueling_players
=
[];
...
...
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