Commit 8a94c84f authored by nanahira's avatar nanahira

fix name length

parent 4c6e0050
......@@ -173,6 +173,7 @@
"vip_cleared_victory": "Your victory word have been deleted.",
"vip_set_victory": "Your victory word have been set.",
"vip_password_changed": "Password changed.",
"vip_player_name_too_long": "Your username or password is too long to log in. Please change your username and try again.",
"athletic_arena_tip": "During an athletic match, a game quit behavior is regarded as a surrender."
},
"es-es": {
......@@ -486,6 +487,7 @@
"vip_cleared_victory": "已删除胜利台词。",
"vip_set_victory": "已设置胜利台词。",
"vip_password_changed": "密码修改成功。",
"vip_player_name_too_long": "你的用户名或设置的密码太长,使用此用户名可能会无法登陆。请更换用户名重试。",
"athletic_arena_tip": "在竞技匹配中,比赛开始前退出游戏也会视为投降。"
},
"ko-kr": {
......
......@@ -180,7 +180,10 @@ CLIENT_use_cdkey = (client, pkey) ->
client.vip = true
new_vip = false
if vip_info.players[client.name]
vip_info.players[client.name].expire_date = moment().add(found_type, 'd').format('YYYY-MM-DD HH:mm:ss')
current_date = moment()
if current_date.isSameOrBefore(vip_info.players[client.name].expire_date)
current_date = moment(vip_info.players[client.name].expire_date, 'YYYY-MM-DD HH:mm:ss')
vip_info.players[client.name].expire_date = current_date.add(found_type, 'd').format('YYYY-MM-DD HH:mm:ss')
else
if !client.vpass
client.vpass = Math.floor(Math.random() * 100000).toString()
......@@ -1417,6 +1420,7 @@ ygopro.ctos_follow 'PLAYER_INFO', true, (buffer, info, client, server)->
buffer = struct.buffer
client.name = name
client.vpass = vpass
console.log client.name, client.vpass
if settings.modules.vip.enabled and CLIENT_check_vip(client)
client.vip = true
......@@ -2605,6 +2609,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
when 'buy'
if vip_info.players[client.name] and vip_info.players[client.name].password != client.vpass
ygopro.stoc_send_chat(client, "${vip_account_existed}", ygopro.constants.COLORS.RED)
else if (!client.vpass and client.name.length > 13) or (client.vpass and (client.name.length + client.vpass.length) > 18)
ygopro.stoc_send_chat(client, "${vip_player_name_too_long}", ygopro.constants.COLORS.RED)
else
key = cmd[2]
buy_result = CLIENT_use_cdkey(client, key)
......
......@@ -175,7 +175,7 @@
};
CLIENT_use_cdkey = function(client, pkey) {
var found_type, index, j, key, keys, len, new_vip, ref, type;
var current_date, found_type, index, j, key, keys, len, new_vip, ref, type;
if (!(settings.modules.vip.enabled && pkey)) {
return 0;
}
......@@ -208,7 +208,11 @@
client.vip = true;
new_vip = false;
if (vip_info.players[client.name]) {
vip_info.players[client.name].expire_date = moment().add(found_type, 'd').format('YYYY-MM-DD HH:mm:ss');
current_date = moment();
if (current_date.isSameOrBefore(vip_info.players[client.name].expire_date)) {
current_date = moment(vip_info.players[client.name].expire_date, 'YYYY-MM-DD HH:mm:ss');
}
vip_info.players[client.name].expire_date = current_date.add(found_type, 'd').format('YYYY-MM-DD HH:mm:ss');
} else {
if (!client.vpass) {
client.vpass = Math.floor(Math.random() * 100000).toString();
......@@ -1799,6 +1803,7 @@
buffer = struct.buffer;
client.name = name;
client.vpass = vpass;
console.log(client.name, client.vpass);
if (settings.modules.vip.enabled && CLIENT_check_vip(client)) {
client.vip = true;
}
......@@ -3290,6 +3295,8 @@
case 'buy':
if (vip_info.players[client.name] && vip_info.players[client.name].password !== client.vpass) {
ygopro.stoc_send_chat(client, "${vip_account_existed}", ygopro.constants.COLORS.RED);
} else if ((!client.vpass && client.name.length > 13) || (client.vpass && (client.name.length + client.vpass.length) > 18)) {
ygopro.stoc_send_chat(client, "${vip_player_name_too_long}", ygopro.constants.COLORS.RED);
} else {
key = cmd[2];
buy_result = CLIENT_use_cdkey(client, key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment