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
ddf917aa
Commit
ddf917aa
authored
Mar 03, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
ee9a1bea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
201 deletions
+30
-201
ygopro-server.coffee
ygopro-server.coffee
+7
-5
ygopro-server.js
ygopro-server.js
+23
-196
No files found.
ygopro-server.coffee
View file @
ddf917aa
...
@@ -1711,19 +1711,21 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1711,19 +1711,21 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
when
'/color'
when
'/color'
if
settings
.
modules
.
chat_color
.
enabled
if
settings
.
modules
.
chat_color
.
enabled
cip
=
(
if
settings
.
modules
.
mycard
.
enabled
then
client
.
name
else
client
.
ip
.
slice
(
7
))
cip
=
if
settings
.
modules
.
mycard
.
enabled
then
client
.
name
else
client
.
ip
if
cmsg
=
cmd
[
1
]
if
cmsg
=
cmd
[
1
]
if
cmsg
.
toLowerCase
()
==
"help"
if
cmsg
.
toLowerCase
()
==
"help"
ygopro
.
stoc_send_chat
(
client
,
"${show_color_list}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat
(
client
,
"${show_color_list}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
for
cname
,
cvalue
of
ygopro
.
constants
.
COLORS
when
cvalue
>
10
for
cname
,
cvalue
of
ygopro
.
constants
.
COLORS
when
cvalue
>
10
ygopro
.
stoc_send_chat
(
client
,
cname
,
cvalue
)
ygopro
.
stoc_send_chat
(
client
,
cname
,
cvalue
)
else
if
cmsg
.
toLowerCase
()
==
"default"
else
if
cmsg
.
toLowerCase
()
==
"default"
setting_change
(
chat_color
,
'save_list:'
+
cip
,
false
)
chat_color
.
save_list
[
cip
]
=
false
setting_save
(
chat_color
)
ygopro
.
stoc_send_chat
(
client
,
"${set_chat_color_default}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat
(
client
,
"${set_chat_color_default}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
else
else
ccolor
=
cmsg
.
toUpperCase
()
ccolor
=
cmsg
.
toUpperCase
()
if
ygopro
.
constants
.
COLORS
[
ccolor
]
and
ygopro
.
constants
.
COLORS
[
ccolor
]
>
10
if
ygopro
.
constants
.
COLORS
[
ccolor
]
and
ygopro
.
constants
.
COLORS
[
ccolor
]
>
10
and
ygopro
.
constants
.
COLORS
[
ccolor
]
<
20
setting_change
(
chat_color
,
'save_list:'
+
cip
,
ccolor
)
chat_color
.
save_list
[
cip
]
=
ccolor
setting_save
(
chat_color
)
ygopro
.
stoc_send_chat
(
client
,
"${set_chat_color_part1}"
+
ccolor
+
"${set_chat_color_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat
(
client
,
"${set_chat_color_part1}"
+
ccolor
+
"${set_chat_color_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
else
else
ygopro
.
stoc_send_chat
(
client
,
"${color_not_found_part1}"
+
ccolor
+
"${color_not_found_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat
(
client
,
"${color_not_found_part1}"
+
ccolor
+
"${color_not_found_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
...
@@ -1909,7 +1911,7 @@ ygopro.stoc_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1909,7 +1911,7 @@ ygopro.stoc_follow 'CHAT', true, (buffer, info, client, server)->
for
player
in
room
.
players
when
player
and
player
.
pos
==
pid
for
player
in
room
.
players
when
player
and
player
.
pos
==
pid
tplayer
=
player
tplayer
=
player
return
unless
tplayer
return
unless
tplayer
tcolor
=
chat_color
.
save_list
[
(
if
settings
.
modules
.
mycard
.
enabled
then
tplayer
.
name
else
tplayer
.
ip
.
slice
(
7
))
]
tcolor
=
chat_color
.
save_list
[
if
settings
.
modules
.
mycard
.
enabled
then
tplayer
.
name
else
tplayer
.
ip
]
if
tcolor
if
tcolor
ygopro
.
stoc_send
client
,
'CHAT'
,
{
ygopro
.
stoc_send
client
,
'CHAT'
,
{
player
:
ygopro
.
constants
.
COLORS
[
tcolor
]
player
:
ygopro
.
constants
.
COLORS
[
tcolor
]
...
...
ygopro-server.js
View file @
ddf917aa
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
(
function
()
{
(
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_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
,
badwords
,
ban_user
,
bunyan
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
default_config
,
default_data
,
dialogues
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
lflists
,
list
,
load_dialogues
,
load_tips
,
log
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
tips
,
url
,
users_cache
,
wait_room_start
,
wait_room_start_arena
,
windbot_bin
,
windbot_parameters
,
windbot_process
,
windbots
,
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
,
badwords
,
ban_user
,
bunyan
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
default_config
,
default_data
,
dialogues
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
lflists
,
list
,
load_dialogues
,
load_tips
,
log
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
tips
,
url
,
users_cache
,
wait_room_start
,
wait_room_start_arena
,
windbot_bin
,
windbot_parameters
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
var
words
,
oldwords
;
net
=
require
(
'
net
'
);
net
=
require
(
'
net
'
);
http
=
require
(
'
http
'
);
http
=
require
(
'
http
'
);
...
@@ -75,13 +73,6 @@
...
@@ -75,13 +73,6 @@
fs
.
writeFileSync
(
oldtips
.
file
,
JSON
.
stringify
(
oldtips
,
null
,
2
));
fs
.
writeFileSync
(
oldtips
.
file
,
JSON
.
stringify
(
oldtips
,
null
,
2
));
delete
oldconfig
.
tips
;
delete
oldconfig
.
tips
;
}
}
if
(
oldconfig
.
words
)
{
oldwords
=
{};
oldwords
.
file
=
'
./config/words.json
'
;
oldwords
.
words
=
oldconfig
.
words
;
fs
.
writeFileSync
(
oldwords
.
file
,
JSON
.
stringify
(
oldwords
,
null
,
2
));
delete
oldconfig
.
words
;
}
if
(
oldconfig
.
dialogues
)
{
if
(
oldconfig
.
dialogues
)
{
olddialogues
=
{};
olddialogues
=
{};
olddialogues
.
file
=
'
./config/dialogues.json
'
;
olddialogues
.
file
=
'
./config/dialogues.json
'
;
...
@@ -176,13 +167,6 @@
...
@@ -176,13 +167,6 @@
setting_save
(
tips
);
setting_save
(
tips
);
}
}
try
{
words
=
require
(
'
./config/words.json
'
);
}
catch
(
error1
)
{
words
=
default_data
.
words
;
setting_save
(
words
);
}
try
{
try
{
dialogues
=
require
(
'
./config/dialogues.json
'
);
dialogues
=
require
(
'
./config/dialogues.json
'
);
}
catch
(
error1
)
{
}
catch
(
error1
)
{
...
@@ -220,36 +204,20 @@
...
@@ -220,36 +204,20 @@
}
}
lflists
=
(
function
()
{
lflists
=
(
function
()
{
var
j
,
len
,
ref
,
ref_custom
,
results
;
var
j
,
len
,
ref
,
results
;
ref
=
fs
.
readFileSync
(
'
ygopro/lflist.conf
'
,
'
utf8
'
).
match
(
/!.*/g
);
results
=
[];
results
=
[];
try
{
for
(
j
=
0
,
len
=
ref
.
length
;
j
<
len
;
j
++
)
{
ref_custom
=
fs
.
readFileSync
(
'
ygopro/expansions/lflist.conf
'
,
'
utf8
'
).
match
(
/!.*/g
);
list
=
ref
[
j
];
for
(
j
=
0
,
len
=
ref_custom
.
length
;
j
<
len
;
j
++
)
{
date
=
list
.
match
(
/!
([\d\.]
+
)
/
);
list
=
ref_custom
[
j
];
if
(
!
date
)
{
date
=
list
.
match
(
/!
([\d\.]
+
)
/
);
continue
;
if
(
!
date
)
{
}
continue
;
results
.
push
({
}
date
:
moment
(
list
.
match
(
/!
([\d\.]
+
)
/
)[
1
],
'
YYYY.MM.DD
'
).
utcOffset
(
"
-08:00
"
),
results
.
push
({
tcg
:
list
.
indexOf
(
'
TCG
'
)
!==
-
1
date
:
moment
(
list
.
match
(
/!
([\d\.]
+
)
/
)[
1
],
'
YYYY.MM.DD
'
).
utcOffset
(
"
-08:00
"
),
});
tcg
:
list
.
indexOf
(
'
TCG
'
)
!==
-
1
}
});
}
}
catch
(
error1
)
{}
try
{
ref
=
fs
.
readFileSync
(
'
ygopro/lflist.conf
'
,
'
utf8
'
).
match
(
/!.*/g
);
for
(
j
=
0
,
len
=
ref
.
length
;
j
<
len
;
j
++
)
{
list
=
ref
[
j
];
date
=
list
.
match
(
/!
([\d\.]
+
)
/
);
if
(
!
date
)
{
continue
;
}
results
.
push
({
date
:
moment
(
list
.
match
(
/!
([\d\.]
+
)
/
)[
1
],
'
YYYY.MM.DD
'
).
utcOffset
(
"
-08:00
"
),
tcg
:
list
.
indexOf
(
'
TCG
'
)
!==
-
1
});
}
}
catch
(
error1
)
{}
return
results
;
return
results
;
})();
})();
...
@@ -605,8 +573,6 @@
...
@@ -605,8 +573,6 @@
}
else
if
(
name
.
slice
(
0
,
3
)
===
'
AI#
'
)
{
}
else
if
(
name
.
slice
(
0
,
3
)
===
'
AI#
'
)
{
this
.
hostinfo
.
rule
=
2
;
this
.
hostinfo
.
rule
=
2
;
this
.
hostinfo
.
lflist
=
-
1
;
this
.
hostinfo
.
lflist
=
-
1
;
this
.
hostinfo
.
time_limit
=
0
;
this
.
hostinfo
.
no_check_deck
=
true
;
}
else
if
((
param
=
name
.
match
(
/^
(\d)(\d)(
T|F
)(
T|F
)(
T|F
)(\d
+
)
,
(\d
+
)
,
(\d
+
)
/i
)))
{
}
else
if
((
param
=
name
.
match
(
/^
(\d)(\d)(
T|F
)(
T|F
)(
T|F
)(\d
+
)
,
(\d
+
)
,
(\d
+
)
/i
)))
{
this
.
hostinfo
.
rule
=
parseInt
(
param
[
1
]);
this
.
hostinfo
.
rule
=
parseInt
(
param
[
1
]);
this
.
hostinfo
.
mode
=
parseInt
(
param
[
2
]);
this
.
hostinfo
.
mode
=
parseInt
(
param
[
2
]);
...
@@ -1548,13 +1514,6 @@
...
@@ -1548,13 +1514,6 @@
if
(
!
room
)
{
if
(
!
room
)
{
return
;
return
;
}
}
if
(
settings
.
modules
.
words
.
enabled
&&
words
.
words
[
client
.
name
])
{
var
player_words
=
_
.
lines
(
words
.
words
[
client
.
name
][
Math
.
floor
(
Math
.
random
()
*
words
.
words
[
client
.
name
].
length
)]);
for
(
j
=
0
,
len
=
player_words
.
length
;
j
<
len
;
j
++
)
{
line
=
player_words
[
j
];
ygopro
.
stoc_send_chat_to_room
(
room
,
line
,
ygopro
.
constants
.
COLORS
.
PINK
);
}
}
if
(
settings
.
modules
.
welcome
)
{
if
(
settings
.
modules
.
welcome
)
{
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
);
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
);
}
}
...
@@ -1627,26 +1586,6 @@
...
@@ -1627,26 +1586,6 @@
}
}
});
});
var
load_words
=
function
()
{
request
({
url
:
settings
.
modules
.
words
.
get
,
json
:
true
},
function
(
error
,
response
,
body
)
{
if
(
_
.
isString
(
body
))
{
log
.
warn
(
"
words bad json
"
,
body
);
}
else
if
(
error
||
!
body
)
{
log
.
warn
(
'
words error
'
,
error
,
response
);
}
else
{
setting_change
(
words
,
"
words
"
,
body
);
log
.
info
(
"
words loaded
"
,
_
.
size
(
words
.
words
));
}
});
};
if
(
settings
.
modules
.
words
.
get
)
{
load_words
();
}
load_dialogues
=
function
()
{
load_dialogues
=
function
()
{
request
({
request
({
url
:
settings
.
modules
.
dialogues
.
get
,
url
:
settings
.
modules
.
dialogues
.
get
,
...
@@ -1665,7 +1604,7 @@
...
@@ -1665,7 +1604,7 @@
if
(
settings
.
modules
.
dialogues
.
get
)
{
if
(
settings
.
modules
.
dialogues
.
get
)
{
load_dialogues
();
load_dialogues
();
}
}
ygopro
.
stoc_follow
(
'
GAME_MSG
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
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
,
playertype
,
pos
,
reason
,
ref
,
ref1
,
ref2
,
room
,
val
;
...
@@ -1774,16 +1713,6 @@
...
@@ -1774,16 +1713,6 @@
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${lp_low_self}
"
,
ygopro
.
constants
.
COLORS
.
PINK
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${lp_low_self}
"
,
ygopro
.
constants
.
COLORS
.
PINK
);
}
}
}
}
if
(
settings
.
modules
.
music
.
enabled
)
{
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
HINT
'
)
{
var
hint_type
=
buffer
.
readUInt8
(
1
);
pos
=
buffer
.
readUInt8
(
2
);
var
music_id
=
buffer
.
readUInt32LE
(
3
);
if
(
hint_type
===
11
&&
music_list_rev
[
music_id
])
{
ygopro
.
stoc_send_chat
(
client
,
"
${play_music}
"
+
music_list_rev
[
music_id
],
ygopro
.
constants
.
COLORS
.
PINK
);
}
}
}
if
(
settings
.
modules
.
dialogues
.
enabled
)
{
if
(
settings
.
modules
.
dialogues
.
enabled
)
{
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
SUMMONING
'
||
ygopro
.
constants
.
MSG
[
msg
]
===
'
SPSUMMONING
'
)
{
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
SUMMONING
'
||
ygopro
.
constants
.
MSG
[
msg
]
===
'
SPSUMMONING
'
)
{
card
=
buffer
.
readUInt32LE
(
1
);
card
=
buffer
.
readUInt32LE
(
1
);
...
@@ -1997,8 +1926,6 @@
...
@@ -1997,8 +1926,6 @@
if
(
settings
.
modules
.
tips
.
get
)
{
if
(
settings
.
modules
.
tips
.
get
)
{
load_tips
();
load_tips
();
}
if
(
settings
.
modules
.
tips
.
enabled
)
{
setInterval
(
function
()
{
setInterval
(
function
()
{
var
j
,
len
,
room
;
var
j
,
len
,
room
;
for
(
j
=
0
,
len
=
ROOM_all
.
length
;
j
<
len
;
j
++
)
{
for
(
j
=
0
,
len
=
ROOM_all
.
length
;
j
<
len
;
j
++
)
{
...
@@ -2012,34 +1939,6 @@
...
@@ -2012,34 +1939,6 @@
},
30000
);
},
30000
);
}
}
var
music_list
=
{};
var
music_list_rev
=
{};
var
music_count
=
0
;
if
(
settings
.
modules
.
music
.
enabled
)
{
var
sqlite3
=
require
(
'
sqlite3
'
).
verbose
();
var
db
=
new
sqlite3
.
Database
(
"
./ygopro/
"
+
settings
.
modules
.
music
.
dbpath
);
db
.
each
(
"
select * from datas,texts where datas.id=texts.id
"
,
function
(
err
,
result
)
{
if
(
err
)
{
log
.
info
(
"
music load errored
"
,
err
);
return
;
}
else
{
for
(
i
=
1
,
len
=
16
;
i
<=
len
;
i
++
)
{
var
song_name
=
result
[
"
str
"
+
i
];
if
(
song_name
)
{
var
music_id
=
result
.
id
*
16
+
i
-
1
;
music_list_rev
[
music_id
]
=
song_name
;
if
(
!
music_list
[
song_name
])
{
music_list
[
song_name
]
=
music_id
;
music_count
++
;
}
}
}
}
},
function
()
{
log
.
info
(
"
music loaded
"
,
music_count
);
});
}
ygopro
.
stoc_follow
(
'
DUEL_START
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
ygopro
.
stoc_follow
(
'
DUEL_START
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var
deck_arena
,
deck_name
,
deck_text
,
j
,
len
,
player
,
ref
,
room
;
var
deck_arena
,
deck_name
,
deck_text
,
j
,
len
,
player
,
ref
,
room
;
room
=
ROOM_all
[
client
.
rid
];
room
=
ROOM_all
[
client
.
rid
];
...
@@ -2234,57 +2133,9 @@
...
@@ -2234,57 +2133,9 @@
ygopro
.
stoc_send_chat
(
client
,
"
${room_name}
"
+
room
.
name
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat
(
client
,
"
${room_name}
"
+
room
.
name
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
}
break
;
break
;
case
'
/command
'
:
if
(
settings
.
modules
.
command
.
enabled
&&
(
!
settings
.
modules
.
command
.
identity
||
(
settings
.
modules
.
command
.
identity
[
client
.
name
]
&&
settings
.
modules
.
command
.
identity
[
client
.
name
]
===
room
.
name
)))
{
var
cname
=
cmd
[
1
];
if
(
!
cname
)
{
ygopro
.
stoc_send_chat
(
client
,
"
Please enter the command.
"
,
ygopro
.
constants
.
COLORS
.
RED
);
break
;
}
var
command_info
=
settings
.
modules
.
command
.
command_list
[
cname
];
if
(
!
command_info
)
{
ygopro
.
stoc_send_chat
(
client
,
"
Command '
"
+
cname
+
"
' not found.
"
,
ygopro
.
constants
.
COLORS
.
RED
);
break
;
}
ygopro
.
stoc_send_chat
(
client
,
"
Started running command '
"
+
cname
+
"
' .
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
try
{
var
proc
=
spawn
(
command_info
.
command
,
command_info
.
args
,
{
cwd
:
command_info
.
path
,
env
:
process
.
env
});
proc
.
stdout
.
setEncoding
(
'
utf8
'
);
proc
.
stdout
.
on
(
'
data
'
,
function
(
data
)
{
ygopro
.
stoc_send_chat
(
client
,
data
,
ygopro
.
constants
.
COLORS
.
LIGHTBLUE
);
});
proc
.
stderr
.
setEncoding
(
'
utf8
'
);
proc
.
stderr
.
on
(
'
data
'
,
function
(
data
)
{
ygopro
.
stoc_send_chat
(
client
,
data
,
ygopro
.
constants
.
COLORS
.
RED
);
});
proc
.
on
(
'
close
'
,
function
(
code
)
{
ygopro
.
stoc_send_chat
(
client
,
"
Finished running command '
"
+
cname
+
"
' .
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
});
}
catch
(
e
)
{}
}
break
;
/*
case '/music':
var music = msg.slice(7);
if (settings.modules.music.enabled) {
if (!music || music.length <= 0) {
ygopro.stoc_send_hint_music(client, 0, 11);
ygopro.stoc_send_chat(client, "${stop_music}", ygopro.constants.COLORS.BABYBLUE);
break;
}
var music_id = music_list[music];
if (music_id) {
ygopro.stoc_send_hint_music(client, music_id, 11);
ygopro.stoc_send_chat(client, "${play_music}"+music, ygopro.constants.COLORS.BABYBLUE);
} else {
ygopro.stoc_send_chat(client, "${music_not_found_1}"+music+"${music_not_found_2}", ygopro.constants.COLORS.RED);
}
}
break;
*/
case
'
/color
'
:
case
'
/color
'
:
if
(
settings
.
modules
.
chat_color
.
enabled
)
{
if
(
settings
.
modules
.
chat_color
.
enabled
)
{
cip
=
(
settings
.
modules
.
mycard
.
enabled
?
client
.
name
:
client
.
ip
.
slice
(
7
))
;
cip
=
settings
.
modules
.
mycard
.
enabled
?
client
.
name
:
client
.
ip
;
if
(
cmsg
=
cmd
[
1
])
{
if
(
cmsg
=
cmd
[
1
])
{
if
(
cmsg
.
toLowerCase
()
===
"
help
"
)
{
if
(
cmsg
.
toLowerCase
()
===
"
help
"
)
{
ygopro
.
stoc_send_chat
(
client
,
"
${show_color_list}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat
(
client
,
"
${show_color_list}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
...
@@ -2296,12 +2147,14 @@
...
@@ -2296,12 +2147,14 @@
}
}
}
}
}
else
if
(
cmsg
.
toLowerCase
()
===
"
default
"
)
{
}
else
if
(
cmsg
.
toLowerCase
()
===
"
default
"
)
{
setting_change
(
chat_color
,
'
save_list:
'
+
cip
,
false
);
chat_color
.
save_list
[
cip
]
=
false
;
setting_save
(
chat_color
);
ygopro
.
stoc_send_chat
(
client
,
"
${set_chat_color_default}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat
(
client
,
"
${set_chat_color_default}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
else
{
}
else
{
ccolor
=
cmsg
.
toUpperCase
();
ccolor
=
cmsg
.
toUpperCase
();
if
(
ygopro
.
constants
.
COLORS
[
ccolor
]
&&
ygopro
.
constants
.
COLORS
[
ccolor
]
>
10
)
{
if
(
ygopro
.
constants
.
COLORS
[
ccolor
]
&&
ygopro
.
constants
.
COLORS
[
ccolor
]
>
10
&&
ygopro
.
constants
.
COLORS
[
ccolor
]
<
20
)
{
setting_change
(
chat_color
,
'
save_list:
'
+
cip
,
ccolor
);
chat_color
.
save_list
[
cip
]
=
ccolor
;
setting_save
(
chat_color
);
ygopro
.
stoc_send_chat
(
client
,
"
${set_chat_color_part1}
"
+
ccolor
+
"
${set_chat_color_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat
(
client
,
"
${set_chat_color_part1}
"
+
ccolor
+
"
${set_chat_color_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
else
{
}
else
{
ygopro
.
stoc_send_chat
(
client
,
"
${color_not_found_part1}
"
+
ccolor
+
"
${color_not_found_part2}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ygopro
.
stoc_send_chat
(
client
,
"
${color_not_found_part1}
"
+
ccolor
+
"
${color_not_found_part2}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
...
@@ -2440,7 +2293,7 @@
...
@@ -2440,7 +2293,7 @@
room
.
waiting_for_player
=
room
.
waiting_for_player2
;
room
.
waiting_for_player
=
room
.
waiting_for_player2
;
}
}
room
.
last_active_time
=
moment
();
room
.
last_active_time
=
moment
();
}
else
if
(
!
room
.
started
&&
settings
.
modules
.
tournament_mode
.
enabled
&&
settings
.
modules
.
tournament_mode
.
deck_check
&&
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
).
length
)
{
}
else
if
(
!
room
.
started
&&
room
.
hostinfo
.
mode
===
1
&&
settings
.
modules
.
tournament_mode
.
enabled
&&
settings
.
modules
.
tournament_mode
.
deck_check
)
{
struct
=
ygopro
.
structs
[
"
deck
"
];
struct
=
ygopro
.
structs
[
"
deck
"
];
struct
.
_setBuff
(
buffer
);
struct
.
_setBuff
(
buffer
);
struct
.
set
(
"
mainc
"
,
1
);
struct
.
set
(
"
mainc
"
,
1
);
...
@@ -2555,7 +2408,7 @@
...
@@ -2555,7 +2408,7 @@
if
(
!
tplayer
)
{
if
(
!
tplayer
)
{
return
;
return
;
}
}
tcolor
=
chat_color
.
save_list
[
(
settings
.
modules
.
mycard
.
enabled
?
tplayer
.
name
:
tplayer
.
ip
.
slice
(
7
))
];
tcolor
=
chat_color
.
save_list
[
settings
.
modules
.
mycard
.
enabled
?
tplayer
.
name
:
tplayer
.
ip
];
if
(
tcolor
)
{
if
(
tcolor
)
{
ygopro
.
stoc_send
(
client
,
'
CHAT
'
,
{
ygopro
.
stoc_send
(
client
,
'
CHAT
'
,
{
player
:
ygopro
.
constants
.
COLORS
[
tcolor
],
player
:
ygopro
.
constants
.
COLORS
[
tcolor
],
...
@@ -2792,7 +2645,7 @@
...
@@ -2792,7 +2645,7 @@
ref
=
room
.
players
;
ref
=
room
.
players
;
results1
=
[];
results1
=
[];
for
(
k
=
0
,
len1
=
ref
.
length
;
k
<
len1
;
k
++
)
{
for
(
k
=
0
,
len1
=
ref
.
length
;
k
<
len1
;
k
++
)
{
player
=
ref
[
k
];
player
=
ref
[
k
];
if
(
player
.
pos
!=
null
)
{
if
(
player
.
pos
!=
null
)
{
results1
.
push
({
results1
.
push
({
id
:
(
-
1
).
toString
(),
id
:
(
-
1
).
toString
(),
...
@@ -2932,26 +2785,6 @@
...
@@ -2932,26 +2785,6 @@
return
;
return
;
}
}
if
(
u
.
query
.
shout
)
{
if
(
u
.
query
.
shout
)
{
/*
if (u.query.shout.slice(0, 7) === "/music " && settings.modules.music.enabled) {
var music = u.query.shout.slice(7);
var music_id = music_list[music];
if (music_id) {
for (j = 0, len = ROOM_all.length; j < len; j++) {
room = ROOM_all[j];
if (room && room.established) {
ygopro.stoc_send_hint_music_to_room(room, music_id, 11);
ygopro.stoc_send_chat_to_room(room, "${play_music}"+music, ygopro.constants.COLORS.YELLOW);
}
}
response.writeHead(200);
response.end(addCallback(u.query.callback, "['music ok', '" + u.query.shout + "']"));
} else {
response.writeHead(200);
response.end(addCallback(u.query.callback, "['music not found', '" + u.query.shout + "']"));
}
} else {
*/
for
(
k
=
0
,
len1
=
ROOM_all
.
length
;
k
<
len1
;
k
++
)
{
for
(
k
=
0
,
len1
=
ROOM_all
.
length
;
k
<
len1
;
k
++
)
{
room
=
ROOM_all
[
k
];
room
=
ROOM_all
[
k
];
if
(
room
&&
room
.
established
)
{
if
(
room
&&
room
.
established
)
{
...
@@ -2960,8 +2793,6 @@
...
@@ -2960,8 +2793,6 @@
}
}
response
.
writeHead
(
200
);
response
.
writeHead
(
200
);
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"
['shout ok', '
"
+
u
.
query
.
shout
+
"
']
"
));
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"
['shout ok', '
"
+
u
.
query
.
shout
+
"
']
"
));
// }
}
else
if
(
u
.
query
.
stop
)
{
}
else
if
(
u
.
query
.
stop
)
{
if
(
u
.
query
.
stop
===
'
false
'
)
{
if
(
u
.
query
.
stop
===
'
false
'
)
{
u
.
query
.
stop
=
false
;
u
.
query
.
stop
=
false
;
...
@@ -2984,10 +2815,6 @@
...
@@ -2984,10 +2815,6 @@
load_dialogues
();
load_dialogues
();
response
.
writeHead
(
200
);
response
.
writeHead
(
200
);
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"
['loading dialogues', '
"
+
settings
.
modules
.
dialogues
.
get
+
"
']
"
));
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"
['loading dialogues', '
"
+
settings
.
modules
.
dialogues
.
get
+
"
']
"
));
}
else
if
(
u
.
query
.
loadwords
)
{
load_words
();
response
.
writeHead
(
200
);
response
.
end
(
addCallback
(
u
.
query
.
callback
,
"
['loading words', '
"
+
settings
.
modules
.
words
.
get
+
"
']
"
));
}
else
if
(
u
.
query
.
ban
)
{
}
else
if
(
u
.
query
.
ban
)
{
ban_user
(
u
.
query
.
ban
);
ban_user
(
u
.
query
.
ban
);
response
.
writeHead
(
200
);
response
.
writeHead
(
200
);
...
...
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