Commit aae34169 authored by nanahira's avatar nanahira

fix some vip stuff

parent 0e905591
...@@ -391,7 +391,7 @@ class DataManager { ...@@ -391,7 +391,7 @@ class DataManager {
let dialogue = await mdb.getRepository(UserDialog_1.UserDialog) let dialogue = await mdb.getRepository(UserDialog_1.UserDialog)
.createQueryBuilder("dialog") .createQueryBuilder("dialog")
.where("cardCode = :cardCode and userKey = :key", { cardCode, key }) .where("cardCode = :cardCode and userKey = :key", { cardCode, key })
.innerJoinAndSelect("dialog.user", "user") .leftJoinAndSelect("dialog.user", "user")
.getOne(); .getOne();
if (!dialogue) { if (!dialogue) {
dialogue = new UserDialog_1.UserDialog(); dialogue = new UserDialog_1.UserDialog();
......
...@@ -414,7 +414,7 @@ export class DataManager { ...@@ -414,7 +414,7 @@ export class DataManager {
let dialogue = await mdb.getRepository(UserDialog) let dialogue = await mdb.getRepository(UserDialog)
.createQueryBuilder("dialog") .createQueryBuilder("dialog")
.where("cardCode = :cardCode and userKey = :key", {cardCode, key}) .where("cardCode = :cardCode and userKey = :key", {cardCode, key})
.innerJoinAndSelect("dialog.user", "user") .leftJoinAndSelect("dialog.user", "user")
.getOne(); .getOne();
if(!dialogue) { if(!dialogue) {
dialogue = new UserDialog(); dialogue = new UserDialog();
......
...@@ -2048,8 +2048,6 @@ ygopro.ctos_follow 'PLAYER_INFO', true, (buffer, info, client, server, datas)-> ...@@ -2048,8 +2048,6 @@ ygopro.ctos_follow 'PLAYER_INFO', true, (buffer, info, client, server, datas)->
client.vpass = vpass client.vpass = vpass
client.name_vpass = if vpass then name + "$" + vpass else name client.name_vpass = if vpass then name + "$" + vpass else name
#console.log client.name, client.vpass #console.log client.name, client.vpass
if settings.modules.vip.enabled and await CLIENT_check_vip(client)
client.vip = true
if not settings.modules.i18n.auto_pick or client.is_local if not settings.modules.i18n.auto_pick or client.is_local
client.lang=settings.modules.i18n.default client.lang=settings.modules.i18n.default
...@@ -3260,6 +3258,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3260,6 +3258,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
cancel = _.startsWith(msg, "/") cancel = _.startsWith(msg, "/")
room.last_active_time = moment() unless cancel or not (room.random_type or room.arena) or room.duel_stage == ygopro.constants.DUEL_STAGE.FINGER or room.duel_stage == ygopro.constants.DUEL_STAGE.FIRSTGO or room.duel_stage == ygopro.constants.DUEL_STAGE.SIDING room.last_active_time = moment() unless cancel or not (room.random_type or room.arena) or room.duel_stage == ygopro.constants.DUEL_STAGE.FINGER or room.duel_stage == ygopro.constants.DUEL_STAGE.FIRSTGO or room.duel_stage == ygopro.constants.DUEL_STAGE.SIDING
cmd = msg.split(' ') cmd = msg.split(' ')
isVip = await CLIENT_check_vip(client)
switch cmd[0] switch cmd[0]
when '/投降', '/surrender' when '/投降', '/surrender'
if room.duel_stage == ygopro.constants.DUEL_STAGE.BEGIN or (room.hostinfo.mode==2 and !settings.modules.tag_duel_surrender) if room.duel_stage == ygopro.constants.DUEL_STAGE.BEGIN or (room.hostinfo.mode==2 and !settings.modules.tag_duel_surrender)
...@@ -3281,13 +3280,14 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3281,13 +3280,14 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
sur_player.surrend_confirm = true sur_player.surrend_confirm = true
when '/help' when '/help'
ygopro.stoc_send_chat(client, "${chat_order_main}") ygopro.stoc_send_chat(client, "${chat_order_main}")
ygopro.stoc_send_chat(client, "${chat_order_help}") ygopro.stoc_send_chat(client, "${chat_order_help}")
ygopro.stoc_send_chat(client, "${chat_order_roomname}") if !settings.modules.mycard.enabled ygopro.stoc_send_chat(client, "${chat_order_roomname}") if !settings.modules.mycard.enabled
ygopro.stoc_send_chat(client, "${chat_order_windbot}") if settings.modules.windbot.enabled ygopro.stoc_send_chat(client, "${chat_order_windbot}") if settings.modules.windbot.enabled
ygopro.stoc_send_chat(client, "${chat_order_tip}") if settings.modules.tips.enabled ygopro.stoc_send_chat(client, "${chat_order_tip}") if settings.modules.tips.enabled
ygopro.stoc_send_chat(client, "${chat_order_chatcolor_1}") if settings.modules.chat_color.enabled and (!(settings.modules.vip.enabled and settings.modules.chat_color.restrict_to_vip) or client.vip) ygopro.stoc_send_chat(client, "${chat_order_chatcolor_1}") if settings.modules.chat_color.enabled and (!(settings.modules.vip.enabled and settings.modules.chat_color.restrict_to_vip) or isVip)
ygopro.stoc_send_chat(client, "${chat_order_chatcolor_2}") if settings.modules.chat_color.enabled and (!(settings.modules.vip.enabled and settings.modules.chat_color.restrict_to_vip) or client.vip) ygopro.stoc_send_chat(client, "${chat_order_chatcolor_2}") if settings.modules.chat_color.enabled and (!(settings.modules.vip.enabled and settings.modules.chat_color.restrict_to_vip) or isVip)
ygopro.stoc_send_chat(client, "${chat_order_vip}") if settings.modules.vip.enabled ygopro.stoc_send_chat(client, "${chat_order_vip}") if settings.modules.vip.enabled
when '/tip' when '/tip'
...@@ -3315,7 +3315,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3315,7 +3315,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
when '/color' when '/color'
if settings.modules.chat_color.enabled if settings.modules.chat_color.enabled
cip = CLIENT_get_authorize_key(client) cip = CLIENT_get_authorize_key(client)
if settings.modules.vip.enabled and settings.modules.chat_color.restrict_to_vip and !client.vip if settings.modules.vip.enabled and settings.modules.chat_color.restrict_to_vip and !isVip
CLIENT_send_vip_status(client) CLIENT_send_vip_status(client)
else if cmsg = cmd[1] else if cmsg = cmd[1]
if cmsg.toLowerCase() == "help" if cmsg.toLowerCase() == "help"
...@@ -3367,7 +3367,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3367,7 +3367,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
when 2 when 2
ygopro.stoc_send_chat(client, "${vip_success_renew}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${vip_success_renew}", ygopro.constants.COLORS.BABYBLUE)
when 'dialogues' when 'dialogues'
if !await CLIENT_check_vip(client) if !isVip
CLIENT_send_vip_status(client) CLIENT_send_vip_status(client)
else else
code = cmd[2] code = cmd[2]
...@@ -3381,7 +3381,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3381,7 +3381,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
await dataManager.setUserDialogues(CLIENT_get_authorize_key(client), parseInt(code), word) await dataManager.setUserDialogues(CLIENT_get_authorize_key(client), parseInt(code), word)
ygopro.stoc_send_chat(client, "${vip_set_dialogues_part1}" + code + "${vip_set_dialogues_part2}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${vip_set_dialogues_part1}" + code + "${vip_set_dialogues_part2}", ygopro.constants.COLORS.BABYBLUE)
when 'words' when 'words'
if !client.vip if !isVip
CLIENT_send_vip_status(client) CLIENT_send_vip_status(client)
else else
word = concat_name(cmd, 2) word = concat_name(cmd, 2)
...@@ -3392,7 +3392,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3392,7 +3392,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
await dataManager.setUserWords(CLIENT_get_authorize_key(client), word) await dataManager.setUserWords(CLIENT_get_authorize_key(client), word)
ygopro.stoc_send_chat(client, "${vip_set_words}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${vip_set_words}", ygopro.constants.COLORS.BABYBLUE)
when 'victory' when 'victory'
if !client.vip if !isVip
CLIENT_send_vip_status(client) CLIENT_send_vip_status(client)
else else
word = concat_name(cmd, 2) word = concat_name(cmd, 2)
...@@ -3403,7 +3403,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3403,7 +3403,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
await dataManager.setUserVictoryWords(CLIENT_get_authorize_key(client), word) await dataManager.setUserVictoryWords(CLIENT_get_authorize_key(client), word)
ygopro.stoc_send_chat(client, "${vip_set_victory}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${vip_set_victory}", ygopro.constants.COLORS.BABYBLUE)
#when 'password' #when 'password'
# if !client.vip # if !isVip
# CLIENT_send_vip_status(client) # CLIENT_send_vip_status(client)
# else # else
# word = cmd[2] # word = cmd[2]
......
...@@ -2778,9 +2778,6 @@ ...@@ -2778,9 +2778,6 @@
client.vpass = vpass; client.vpass = vpass;
client.name_vpass = vpass ? name + "$" + vpass : name; client.name_vpass = vpass ? name + "$" + vpass : name;
//console.log client.name, client.vpass //console.log client.name, client.vpass
if (settings.modules.vip.enabled && (await CLIENT_check_vip(client))) {
client.vip = true;
}
if (!settings.modules.i18n.auto_pick || client.is_local) { if (!settings.modules.i18n.auto_pick || client.is_local) {
client.lang = settings.modules.i18n.default; client.lang = settings.modules.i18n.default;
} else { } else {
...@@ -4370,7 +4367,7 @@ ...@@ -4370,7 +4367,7 @@
//else //else
//log.info 'BIG BROTHER OK', response.statusCode, roomname, body //log.info 'BIG BROTHER OK', response.statusCode, roomname, body
ygopro.ctos_follow('CHAT', true, async function(buffer, info, client, server, datas) { ygopro.ctos_follow('CHAT', true, async function(buffer, info, client, server, datas) {
var buy_result, cancel, ccolor, cip, cmd, cmsg, cname, code, color, cvalue, key, msg, name, oldmsg, ref, room, struct, sur_player, uname, windbot, word; var buy_result, cancel, ccolor, cip, cmd, cmsg, cname, code, color, cvalue, isVip, key, msg, name, oldmsg, ref, room, struct, sur_player, uname, windbot, word;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
...@@ -4381,6 +4378,7 @@ ...@@ -4381,6 +4378,7 @@
room.last_active_time = moment(); room.last_active_time = moment();
} }
cmd = msg.split(' '); cmd = msg.split(' ');
isVip = (await CLIENT_check_vip(client));
switch (cmd[0]) { switch (cmd[0]) {
case '/投降': case '/投降':
case '/surrender': case '/surrender':
...@@ -4419,10 +4417,10 @@ ...@@ -4419,10 +4417,10 @@
if (settings.modules.tips.enabled) { if (settings.modules.tips.enabled) {
ygopro.stoc_send_chat(client, "${chat_order_tip}"); ygopro.stoc_send_chat(client, "${chat_order_tip}");
} }
if (settings.modules.chat_color.enabled && (!(settings.modules.vip.enabled && settings.modules.chat_color.restrict_to_vip) || client.vip)) { if (settings.modules.chat_color.enabled && (!(settings.modules.vip.enabled && settings.modules.chat_color.restrict_to_vip) || isVip)) {
ygopro.stoc_send_chat(client, "${chat_order_chatcolor_1}"); ygopro.stoc_send_chat(client, "${chat_order_chatcolor_1}");
} }
if (settings.modules.chat_color.enabled && (!(settings.modules.vip.enabled && settings.modules.chat_color.restrict_to_vip) || client.vip)) { if (settings.modules.chat_color.enabled && (!(settings.modules.vip.enabled && settings.modules.chat_color.restrict_to_vip) || isVip)) {
ygopro.stoc_send_chat(client, "${chat_order_chatcolor_2}"); ygopro.stoc_send_chat(client, "${chat_order_chatcolor_2}");
} }
if (settings.modules.vip.enabled) { if (settings.modules.vip.enabled) {
...@@ -4464,7 +4462,7 @@ ...@@ -4464,7 +4462,7 @@
case '/color': case '/color':
if (settings.modules.chat_color.enabled) { if (settings.modules.chat_color.enabled) {
cip = CLIENT_get_authorize_key(client); cip = CLIENT_get_authorize_key(client);
if (settings.modules.vip.enabled && settings.modules.chat_color.restrict_to_vip && !client.vip) { if (settings.modules.vip.enabled && settings.modules.chat_color.restrict_to_vip && !isVip) {
CLIENT_send_vip_status(client); CLIENT_send_vip_status(client);
} else if (cmsg = cmd[1]) { } else if (cmsg = cmd[1]) {
if (cmsg.toLowerCase() === "help") { if (cmsg.toLowerCase() === "help") {
...@@ -4534,7 +4532,7 @@ ...@@ -4534,7 +4532,7 @@
} }
break; break;
case 'dialogues': case 'dialogues':
if (!(await CLIENT_check_vip(client))) { if (!isVip) {
CLIENT_send_vip_status(client); CLIENT_send_vip_status(client);
} else { } else {
code = cmd[2]; code = cmd[2];
...@@ -4551,7 +4549,7 @@ ...@@ -4551,7 +4549,7 @@
} }
break; break;
case 'words': case 'words':
if (!client.vip) { if (!isVip) {
CLIENT_send_vip_status(client); CLIENT_send_vip_status(client);
} else { } else {
word = concat_name(cmd, 2); word = concat_name(cmd, 2);
...@@ -4565,7 +4563,7 @@ ...@@ -4565,7 +4563,7 @@
} }
break; break;
case 'victory': case 'victory':
if (!client.vip) { if (!isVip) {
CLIENT_send_vip_status(client); CLIENT_send_vip_status(client);
} else { } else {
word = concat_name(cmd, 2); word = concat_name(cmd, 2);
...@@ -4580,7 +4578,7 @@ ...@@ -4580,7 +4578,7 @@
} }
} else { } else {
//when 'password' //when 'password'
// if !client.vip // if !isVip
// CLIENT_send_vip_status(client) // CLIENT_send_vip_status(client)
// else // else
// word = cmd[2] // word = cmd[2]
......
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