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
52a95565
Commit
52a95565
authored
Jul 12, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
join room by title
parent
07a64929
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
ygopro-server.coffee
ygopro-server.coffee
+14
-3
ygopro-server.js
ygopro-server.js
+19
-2
No files found.
ygopro-server.coffee
View file @
52a95565
...
...
@@ -261,7 +261,11 @@ ROOM_find_or_create_ai = (name)->
ROOM_find_by_name
=
(
name
)
->
result
=
_
.
find
ROOM_all
,
(
room
)
->
return
room
and
room
.
name
==
name
#log.info 'find_by_name', name, result
return
result
ROOM_find_by_title
=
(
title
)
->
result
=
_
.
find
ROOM_all
,
(
room
)
->
return
room
and
room
.
title
==
title
return
result
ROOM_find_by_port
=
(
port
)
->
...
...
@@ -938,8 +942,9 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
# 1 create public room
# 2 create private room
# 3 join room
# 4 join match
# 3 join room by id
# 4 create or join room by id (use for match)
# 5 join room by title
switch
action
when
1
,
2
name
=
crypto
.
createHash
(
'md5'
).
update
(
info
.
pass
+
client
.
name
).
digest
(
'base64'
)[
0
...
10
].
replace
(
'+'
,
'-'
).
replace
(
'/'
,
'_'
)
...
...
@@ -976,6 +981,12 @@ 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
when
5
title
=
info
.
pass
.
slice
(
8
).
replace
(
String
.
fromCharCode
(
0xFEFF
),
' '
)
room
=
ROOM_find_by_title
(
title
)
if
(
!
room
)
ygopro
.
stoc_die
(
client
,
'${invalid_password_not_found}'
)
return
else
ygopro
.
stoc_die
(
client
,
'${invalid_password_action}'
)
return
...
...
ygopro-server.js
View file @
52a95565
// Generated by CoffeeScript 1.12.2
(
function
()
{
var
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_port
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
_
,
addCallback
,
ban_user
,
bunyan
,
cppversion
,
crypto
,
date
,
defaultconfig
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
list
,
load_dialogues
,
load_tips
,
log
,
moment
,
nconf
,
net
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
request
,
requestListener
,
roomlist
,
settings
,
spawn
,
spawnSync
,
url
,
users_cache
,
wait_room_start
,
windbot_process
,
ygopro
,
zlib
;
var
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_port
,
ROOM_find_
by_title
,
ROOM_find_
or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
_
,
addCallback
,
ban_user
,
bunyan
,
cppversion
,
crypto
,
date
,
defaultconfig
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
list
,
load_dialogues
,
load_tips
,
log
,
moment
,
nconf
,
net
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
request
,
requestListener
,
roomlist
,
settings
,
spawn
,
spawnSync
,
url
,
users_cache
,
wait_room_start
,
windbot_process
,
ygopro
,
zlib
;
net
=
require
(
'
net
'
);
...
...
@@ -360,6 +360,14 @@
return
result
;
};
ROOM_find_by_title
=
function
(
title
)
{
var
result
;
result
=
_
.
find
(
ROOM_all
,
function
(
room
)
{
return
room
&&
room
.
title
===
title
;
});
return
result
;
};
ROOM_find_by_port
=
function
(
port
)
{
return
_
.
find
(
ROOM_all
,
function
(
room
)
{
return
room
&&
room
.
port
===
port
;
...
...
@@ -1153,7 +1161,7 @@
return
(
checksum
&
0xFF
)
===
0
;
};
finish
=
function
(
buffer
)
{
var
action
,
j
,
len
,
name
,
opt1
,
opt2
,
opt3
,
options
,
ref
,
room
;
var
action
,
j
,
len
,
name
,
opt1
,
opt2
,
opt3
,
options
,
ref
,
room
,
title
;
action
=
buffer
.
readUInt8
(
1
)
>>
4
;
if
(
buffer
!==
decrypted_buffer
&&
(
action
===
1
||
action
===
2
||
action
===
4
))
{
ygopro
.
stoc_die
(
client
,
'
${invalid_password_unauthorized}
'
);
...
...
@@ -1202,7 +1210,16 @@
room
[
"
private
"
]
=
true
;
room
.
arena
=
settings
.
modules
.
arena_mode
.
mode
;
break
;
case
5
:
title
=
info
.
pass
.
slice
(
8
).
replace
(
String
.
fromCharCode
(
0xFEFF
),
'
'
);
room
=
ROOM_find_by_title
(
title
);
if
(
!
room
)
{
ygopro
.
stoc_die
(
client
,
'
${invalid_password_not_found}
'
);
return
;
}
break
;
default
:
console
.
log
(
1
);
ygopro
.
stoc_die
(
client
,
'
${invalid_password_action}
'
);
return
;
}
...
...
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