Commit aae34169 authored by nanahira's avatar nanahira

fix some vip stuff

parent 0e905591
......@@ -391,7 +391,7 @@ class DataManager {
let dialogue = await mdb.getRepository(UserDialog_1.UserDialog)
.createQueryBuilder("dialog")
.where("cardCode = :cardCode and userKey = :key", { cardCode, key })
.innerJoinAndSelect("dialog.user", "user")
.leftJoinAndSelect("dialog.user", "user")
.getOne();
if (!dialogue) {
dialogue = new UserDialog_1.UserDialog();
......
......@@ -414,7 +414,7 @@ export class DataManager {
let dialogue = await mdb.getRepository(UserDialog)
.createQueryBuilder("dialog")
.where("cardCode = :cardCode and userKey = :key", {cardCode, key})
.innerJoinAndSelect("dialog.user", "user")
.leftJoinAndSelect("dialog.user", "user")
.getOne();
if(!dialogue) {
dialogue = new UserDialog();
......
......@@ -2048,8 +2048,6 @@ ygopro.ctos_follow 'PLAYER_INFO', true, (buffer, info, client, server, datas)->
client.vpass = vpass
client.name_vpass = if vpass then name + "$" + vpass else name
#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
client.lang=settings.modules.i18n.default
......@@ -3260,6 +3258,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
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
cmd = msg.split(' ')
isVip = await CLIENT_check_vip(client)
switch cmd[0]
when '/投降', '/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)->
sur_player.surrend_confirm = true
when '/help'
ygopro.stoc_send_chat(client, "${chat_order_main}")
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_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_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_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_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 isVip)
ygopro.stoc_send_chat(client, "${chat_order_vip}") if settings.modules.vip.enabled
when '/tip'
......@@ -3315,7 +3315,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
when '/color'
if settings.modules.chat_color.enabled
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)
else if cmsg = cmd[1]
if cmsg.toLowerCase() == "help"
......@@ -3367,7 +3367,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
when 2
ygopro.stoc_send_chat(client, "${vip_success_renew}", ygopro.constants.COLORS.BABYBLUE)
when 'dialogues'
if !await CLIENT_check_vip(client)
if !isVip
CLIENT_send_vip_status(client)
else
code = cmd[2]
......@@ -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)
ygopro.stoc_send_chat(client, "${vip_set_dialogues_part1}" + code + "${vip_set_dialogues_part2}", ygopro.constants.COLORS.BABYBLUE)
when 'words'
if !client.vip
if !isVip
CLIENT_send_vip_status(client)
else
word = concat_name(cmd, 2)
......@@ -3392,7 +3392,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
await dataManager.setUserWords(CLIENT_get_authorize_key(client), word)
ygopro.stoc_send_chat(client, "${vip_set_words}", ygopro.constants.COLORS.BABYBLUE)
when 'victory'
if !client.vip
if !isVip
CLIENT_send_vip_status(client)
else
word = concat_name(cmd, 2)
......@@ -3403,7 +3403,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
await dataManager.setUserVictoryWords(CLIENT_get_authorize_key(client), word)
ygopro.stoc_send_chat(client, "${vip_set_victory}", ygopro.constants.COLORS.BABYBLUE)
#when 'password'
# if !client.vip
# if !isVip
# CLIENT_send_vip_status(client)
# else
# word = cmd[2]
......
......@@ -2778,9 +2778,6 @@
client.vpass = vpass;
client.name_vpass = vpass ? name + "$" + vpass : name;
//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) {
client.lang = settings.modules.i18n.default;
} else {
......@@ -4370,7 +4367,7 @@
//else
//log.info 'BIG BROTHER OK', response.statusCode, roomname, body
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];
if (!room) {
return;
......@@ -4381,6 +4378,7 @@
room.last_active_time = moment();
}
cmd = msg.split(' ');
isVip = (await CLIENT_check_vip(client));
switch (cmd[0]) {
case '/投降':
case '/surrender':
......@@ -4419,10 +4417,10 @@
if (settings.modules.tips.enabled) {
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}");
}
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}");
}
if (settings.modules.vip.enabled) {
......@@ -4464,7 +4462,7 @@
case '/color':
if (settings.modules.chat_color.enabled) {
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);
} else if (cmsg = cmd[1]) {
if (cmsg.toLowerCase() === "help") {
......@@ -4534,7 +4532,7 @@
}
break;
case 'dialogues':
if (!(await CLIENT_check_vip(client))) {
if (!isVip) {
CLIENT_send_vip_status(client);
} else {
code = cmd[2];
......@@ -4551,7 +4549,7 @@
}
break;
case 'words':
if (!client.vip) {
if (!isVip) {
CLIENT_send_vip_status(client);
} else {
word = concat_name(cmd, 2);
......@@ -4565,7 +4563,7 @@
}
break;
case 'victory':
if (!client.vip) {
if (!isVip) {
CLIENT_send_vip_status(client);
} else {
word = concat_name(cmd, 2);
......@@ -4580,7 +4578,7 @@
}
} else {
//when 'password'
// if !client.vip
// if !isVip
// CLIENT_send_vip_status(client)
// else
// 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