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
b42b8997
Commit
b42b8997
authored
Jul 25, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c0edb987
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
27 deletions
+69
-27
data/i18n.json
data/i18n.json
+2
-0
ygopro-server.coffee
ygopro-server.coffee
+29
-12
ygopro-server.js
ygopro-server.js
+38
-15
No files found.
data/i18n.json
View file @
b42b8997
...
@@ -158,6 +158,7 @@
...
@@ -158,6 +158,7 @@
"vip_not_bought"
:
"You are not a supporter yet. enter /vip buy KEY to become one."
,
"vip_not_bought"
:
"You are not a supporter yet. enter /vip buy KEY to become one."
,
"vip_expired_part1"
:
"Your supporter identity have been expired at "
,
"vip_expired_part1"
:
"Your supporter identity have been expired at "
,
"vip_expired_part2"
:
". Welcome to support again."
,
"vip_expired_part2"
:
". Welcome to support again."
,
"vip_account_existed"
:
"Your username has already taken by other players. Please use another username to support."
,
"vip_key_not_found"
:
"Key not found."
,
"vip_key_not_found"
:
"Key not found."
,
"vip_success_new_part1"
:
"Support success. Use "
,
"vip_success_new_part1"
:
"Support success. Use "
,
"vip_success_new_part2"
:
" as your name to get the supporter goodies. Thanks for your support."
,
"vip_success_new_part2"
:
" as your name to get the supporter goodies. Thanks for your support."
,
...
@@ -470,6 +471,7 @@
...
@@ -470,6 +471,7 @@
"vip_not_bought"
:
"你还未成为捐助者。输入 /vip buy 卡密 进行捐助。"
,
"vip_not_bought"
:
"你还未成为捐助者。输入 /vip buy 卡密 进行捐助。"
,
"vip_expired_part1"
:
"你的捐助者特权已在 "
,
"vip_expired_part1"
:
"你的捐助者特权已在 "
,
"vip_expired_part2"
:
" 时到期。欢迎再次捐助。"
,
"vip_expired_part2"
:
" 时到期。欢迎再次捐助。"
,
"vip_account_existed"
:
"你的用户名已被其他人使用,请更换用户名进行捐助。"
,
"vip_key_not_found"
:
"卡密不存在。"
,
"vip_key_not_found"
:
"卡密不存在。"
,
"vip_success_new_part1"
:
"捐助成功。进房时输入 "
,
"vip_success_new_part1"
:
"捐助成功。进房时输入 "
,
"vip_success_new_part2"
:
" 即可享受捐助特权。感谢您对服务器的支持。"
,
"vip_success_new_part2"
:
" 即可享受捐助特权。感谢您对服务器的支持。"
,
...
...
ygopro-server.coffee
View file @
b42b8997
...
@@ -214,6 +214,20 @@ CLIENT_send_vip_status = (client, display) ->
...
@@ -214,6 +214,20 @@ CLIENT_send_vip_status = (client, display) ->
else
else
ygopro
.
stoc_send_chat
(
client
,
"${vip_expired_part1}"
+
vip_info
.
players
[
client
.
name
].
expire_date
+
"${vip_expired_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat
(
client
,
"${vip_expired_part1}"
+
vip_info
.
players
[
client
.
name
].
expire_date
+
"${vip_expired_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
concat_name
=
(
name
,
num
)
->
if
!
name
[
num
]
return
null
res
=
name
[
num
]
temp
=
null
count
=
num
+
1
while
true
temp
=
name
[
count
]
if
!
temp
break
res
=
res
+
" "
+
temp
count
++
return
res
# 读取配置
# 读取配置
default_config
=
loadJSON
(
'./data/default_config.json'
)
default_config
=
loadJSON
(
'./data/default_config.json'
)
try
try
...
@@ -2586,21 +2600,24 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -2586,21 +2600,24 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
when
'status'
when
'status'
CLIENT_send_vip_status
(
client
,
true
)
CLIENT_send_vip_status
(
client
,
true
)
when
'buy'
when
'buy'
key
=
cmd
[
2
]
if
vip_info
.
players
[
client
.
name
]
and
vip_info
.
players
[
client
.
name
].
password
!=
client
.
vpass
buy_result
=
CLIENT_use_cdkey
(
client
,
key
)
ygopro
.
stoc_send_chat
(
client
,
"${vip_account_existed}"
,
ygopro
.
constants
.
COLORS
.
RED
)
switch
buy_result
else
when
0
key
=
cmd
[
2
]
ygopro
.
stoc_send_chat
(
client
,
"${vip_key_not_found}"
,
ygopro
.
constants
.
COLORS
.
RED
)
buy_result
=
CLIENT_use_cdkey
(
client
,
key
)
when
1
switch
buy_result
ygopro
.
stoc_send_chat
(
client
,
"${vip_success_new_part1}"
+
client
.
name
+
"$"
+
client
.
vpass
+
"${vip_success_new_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
when
0
when
2
ygopro
.
stoc_send_chat
(
client
,
"${vip_key_not_found}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat
(
client
,
"${vip_success_renew}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
when
1
ygopro
.
stoc_send_chat
(
client
,
"${vip_success_new_part1}"
+
client
.
name
+
"$"
+
client
.
vpass
+
"${vip_success_new_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
when
2
ygopro
.
stoc_send_chat
(
client
,
"${vip_success_renew}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
when
'dialogues'
when
'dialogues'
if
!
client
.
vip
if
!
client
.
vip
CLIENT_send_vip_status
(
client
)
CLIENT_send_vip_status
(
client
)
else
else
code
=
cmd
[
2
]
code
=
cmd
[
2
]
word
=
c
md
[
3
]
word
=
c
oncat_name
(
cmd
,
3
)
if
!
code
or
!
parseInt
(
code
)
if
!
code
or
!
parseInt
(
code
)
ygopro
.
stoc_send_chat
(
client
,
"${vip_invalid_card_code}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat
(
client
,
"${vip_invalid_card_code}"
,
ygopro
.
constants
.
COLORS
.
RED
)
else
if
!
word
else
if
!
word
...
@@ -2615,7 +2632,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -2615,7 +2632,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
if
!
client
.
vip
if
!
client
.
vip
CLIENT_send_vip_status
(
client
)
CLIENT_send_vip_status
(
client
)
else
else
word
=
c
md
[
2
]
word
=
c
oncat_name
(
cmd
,
2
)
if
!
word
if
!
word
delete
vip_info
.
players
[
client
.
name
].
words
delete
vip_info
.
players
[
client
.
name
].
words
setting_save
(
vip_info
)
setting_save
(
vip_info
)
...
@@ -2628,7 +2645,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -2628,7 +2645,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
if
!
client
.
vip
if
!
client
.
vip
CLIENT_send_vip_status
(
client
)
CLIENT_send_vip_status
(
client
)
else
else
word
=
c
md
[
2
]
word
=
c
oncat_name
(
cmd
,
2
)
if
!
word
if
!
word
delete
vip_info
.
players
[
client
.
name
].
victory
delete
vip_info
.
players
[
client
.
name
].
victory
setting_save
(
vip_info
)
setting_save
(
vip_info
)
...
...
ygopro-server.js
View file @
b42b8997
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.7
(function() {
(function() {
var
CLIENT_check_vip
,
CLIENT_get_authorize_key
,
CLIENT_heartbeat_register
,
CLIENT_heartbeat_unregister
,
CLIENT_import_data
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
CLIENT_send_vip_status
,
CLIENT_use_cdkey
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
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
,
SERVER_clear_disconnect
,
VIP_generate_cdkeys
,
_
,
addCallback
,
badwords
,
ban_user
,
bunyan
,
challonge
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
default_config
,
default_data
,
dialogues
,
disconnect_list
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
import_datas
,
j
,
k
,
l
,
len
,
len1
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_dialogues_custom
,
load_tips
,
load_words
,
log
,
long_resolve_cards
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
oldwords
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
ref
,
ref1
,
ref2
,
release_disconnect
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
tips
,
url
,
users_cache
,
v
,
vip_info
,
wait_room_start
,
wait_room_start_arena
,
windbot_bin
,
windbot_parameters
,
windbot_process
,
windbots
,
words
,
ygopro
,
zlib
;
var CLIENT_check_vip, CLIENT_get_authorize_key, CLIENT_heartbeat_register, CLIENT_heartbeat_unregister, CLIENT_import_data, CLIENT_is_able_to_reconnect, CLIENT_is_player, CLIENT_kick, CLIENT_pre_reconnect, CLIENT_reconnect, CLIENT_reconnect_register, CLIENT_reconnect_unregister, CLIENT_send_pre_reconnect_info, CLIENT_send_reconnect_info, CLIENT_send_vip_status, CLIENT_use_cdkey, Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_clear_disconnect, 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, SERVER_clear_disconnect, VIP_generate_cdkeys, _, addCallback, badwords, ban_user, bunyan, challonge, chat_color, con
cat_name, con
fig, cppversion, crypto, date, default_config, default_data, dialogues, disconnect_list, duel_log, e, exec, execFile, fs, geoip, get_memory_usage, http, http_server, https, https_server, import_datas, j, k, l, len, len1, lflists, list, loadJSON, load_dialogues, load_dialogues_custom, load_tips, load_words, log, long_resolve_cards, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, oldwords, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, ref, ref1, ref2, release_disconnect, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, tips, url, users_cache, v, vip_info, wait_room_start, wait_room_start_arena, windbot_bin, windbot_parameters, windbot_process, windbots, words, ygopro, zlib;
net = require('net');
net = require('net');
...
@@ -253,6 +253,25 @@
...
@@ -253,6 +253,25 @@
}
}
};
};
concat_name = function(name, num) {
var count, res, temp;
if (!name[num]) {
return null;
}
res = name[num];
temp = null;
count = num + 1;
while (true) {
temp = name[count];
if (!temp) {
break;
}
res = res + " " + temp;
count++;
}
return res;
};
default_config = loadJSON('./data/default_config.json');
default_config = loadJSON('./data/default_config.json');
try {
try {
...
@@ -3263,17 +3282,21 @@
...
@@ -3263,17 +3282,21 @@
CLIENT_send_vip_status(client, true);
CLIENT_send_vip_status(client, true);
break;
break;
case 'buy':
case 'buy':
key
=
cmd
[
2
];
if (vip_info.players[client.name] && vip_info.players[client.name].password !== client.vpass) {
buy_result
=
CLIENT_use_cdkey
(
client
,
key
);
ygopro.stoc_send_chat(client, "${vip_account_existed}", ygopro.constants.COLORS.RED);
switch
(
buy_result
)
{
} else {
case
0
:
key = cmd[2];
ygopro
.
stoc_send_chat
(
client
,
"
${vip_key_not_found}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
buy_result = CLIENT_use_cdkey(client, key);
break
;
switch (buy_result) {
case
1
:
case 0:
ygopro
.
stoc_send_chat
(
client
,
"
${vip_success_new_part1}
"
+
client
.
name
+
"
$
"
+
client
.
vpass
+
"
${vip_success_new_part2}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro.stoc_send_chat(client, "${vip_key_not_found}", ygopro.constants.COLORS.RED);
break
;
break;
case
2
:
case 1:
ygopro
.
stoc_send_chat
(
client
,
"
${vip_success_renew}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro.stoc_send_chat(client, "${vip_success_new_part1}" + client.name + "$" + client.vpass + "${vip_success_new_part2}", ygopro.constants.COLORS.BABYBLUE);
break;
case 2:
ygopro.stoc_send_chat(client, "${vip_success_renew}", ygopro.constants.COLORS.BABYBLUE);
}
}
}
break;
break;
case 'dialogues':
case 'dialogues':
...
@@ -3281,7 +3304,7 @@
...
@@ -3281,7 +3304,7 @@
CLIENT_send_vip_status(client);
CLIENT_send_vip_status(client);
} else {
} else {
code = cmd[2];
code = cmd[2];
word
=
c
md
[
3
]
;
word = c
oncat_name(cmd, 3)
;
if (!code || !parseInt(code)) {
if (!code || !parseInt(code)) {
ygopro.stoc_send_chat(client, "${vip_invalid_card_code}", ygopro.constants.COLORS.RED);
ygopro.stoc_send_chat(client, "${vip_invalid_card_code}", ygopro.constants.COLORS.RED);
} else if (!word) {
} else if (!word) {
...
@@ -3299,7 +3322,7 @@
...
@@ -3299,7 +3322,7 @@
if (!client.vip) {
if (!client.vip) {
CLIENT_send_vip_status(client);
CLIENT_send_vip_status(client);
} else {
} else {
word
=
c
md
[
2
]
;
word = c
oncat_name(cmd, 2)
;
if (!word) {
if (!word) {
delete vip_info.players[client.name].words;
delete vip_info.players[client.name].words;
setting_save(vip_info);
setting_save(vip_info);
...
@@ -3315,7 +3338,7 @@
...
@@ -3315,7 +3338,7 @@
if (!client.vip) {
if (!client.vip) {
CLIENT_send_vip_status(client);
CLIENT_send_vip_status(client);
} else {
} else {
word
=
c
md
[
2
]
;
word = c
oncat_name(cmd, 2)
;
if (!word) {
if (!word) {
delete vip_info.players[client.name].victory;
delete vip_info.players[client.name].victory;
setting_save(vip_info);
setting_save(vip_info);
...
...
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