Commit 9e33544d authored by nanahira's avatar nanahira

Merge branch 'master' of ../srvpro into koishi

parents ff022124 396a593a
Pipeline #27238 passed with stages
in 11 minutes and 59 seconds
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
"32": "HS_PLAYER_ENTER", "32": "HS_PLAYER_ENTER",
"33": "HS_PLAYER_CHANGE", "33": "HS_PLAYER_CHANGE",
"34": "HS_WATCH_CHANGE", "34": "HS_WATCH_CHANGE",
"35": "TEAMMATE_SURRENDER",
"48": "FIELD_FINISH" "48": "FIELD_FINISH"
}, },
"PLAYERCHANGE":{ "PLAYERCHANGE":{
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
"full": "服务器已爆满", "full": "服务器已爆满",
"max_rooms_count": 0, "max_rooms_count": 0,
"side_timeout": false, "side_timeout": false,
"tag_duel_surrender": true,
"replay_delay": true, "replay_delay": true,
"hide_name": false, "hide_name": false,
"display_watchers": false, "display_watchers": false,
......
...@@ -3271,13 +3271,13 @@ ygopro.ctos_follow 'SURRENDER', true, (buffer, info, client, server, datas)-> ...@@ -3271,13 +3271,13 @@ ygopro.ctos_follow 'SURRENDER', true, (buffer, info, client, server, datas)->
ygopro.stoc_send_chat(client, "${surrender_denied}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${surrender_denied}", ygopro.constants.COLORS.BABYBLUE)
return true return true
if room.hostinfo.mode == 2 if room.hostinfo.mode == 2
if !settings.modules.tag_duel_surrender if !client.surrend_confirm and !CLIENT_get_partner(client).closed and !CLIENT_get_partner(client).is_local
return true
else if !client.surrend_confirm and !CLIENT_get_partner(client).closed and !CLIENT_get_partner(client).is_local
sur_player = CLIENT_get_partner(client) sur_player = CLIENT_get_partner(client)
ygopro.stoc_send_chat(sur_player, "${surrender_confirm_tag}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(sur_player, "${surrender_confirm_tag}", ygopro.constants.COLORS.BABYBLUE)
ygopro.stoc_send_chat(client, "${surrender_confirm_sent}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${surrender_confirm_sent}", ygopro.constants.COLORS.BABYBLUE)
sur_player.surrend_confirm = true sur_player.surrend_confirm = true
for player in [client, sur_player]
ygopro.stoc_send(client, 'TEAMMATE_SURRENDER')
return true return true
await return false await return false
...@@ -3312,7 +3312,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3312,7 +3312,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
isVip = await CLIENT_check_vip(client) 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
return cancel return cancel
if room.random_type and room.turn < 3 and !client.flee_free if room.random_type and room.turn < 3 and !client.flee_free
ygopro.stoc_send_chat(client, "${surrender_denied}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${surrender_denied}", ygopro.constants.COLORS.BABYBLUE)
...@@ -3326,6 +3326,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3326,6 +3326,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
if room.hostinfo.mode==2 and sur_player != client if room.hostinfo.mode==2 and sur_player != client
ygopro.stoc_send_chat(sur_player, "${surrender_confirm_tag}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(sur_player, "${surrender_confirm_tag}", ygopro.constants.COLORS.BABYBLUE)
ygopro.stoc_send_chat(client, "${surrender_confirm_sent}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${surrender_confirm_sent}", ygopro.constants.COLORS.BABYBLUE)
for player in [client, sur_player]
ygopro.stoc_send(client, 'TEAMMATE_SURRENDER')
else else
ygopro.stoc_send_chat(client, "${surrender_confirm}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${surrender_confirm}", ygopro.constants.COLORS.BABYBLUE)
sur_player.surrend_confirm = true sur_player.surrend_confirm = true
......
...@@ -4363,7 +4363,7 @@ ...@@ -4363,7 +4363,7 @@
}); });
ygopro.ctos_follow('SURRENDER', true, async function(buffer, info, client, server, datas) { ygopro.ctos_follow('SURRENDER', true, async function(buffer, info, client, server, datas) {
var room, sur_player; var j, len, player, ref, room, sur_player;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
...@@ -4376,13 +4376,16 @@ ...@@ -4376,13 +4376,16 @@
return true; return true;
} }
if (room.hostinfo.mode === 2) { if (room.hostinfo.mode === 2) {
if (!settings.modules.tag_duel_surrender) { if (!client.surrend_confirm && !CLIENT_get_partner(client).closed && !CLIENT_get_partner(client).is_local) {
return true;
} else if (!client.surrend_confirm && !CLIENT_get_partner(client).closed && !CLIENT_get_partner(client).is_local) {
sur_player = CLIENT_get_partner(client); sur_player = CLIENT_get_partner(client);
ygopro.stoc_send_chat(sur_player, "${surrender_confirm_tag}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(sur_player, "${surrender_confirm_tag}", ygopro.constants.COLORS.BABYBLUE);
ygopro.stoc_send_chat(client, "${surrender_confirm_sent}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${surrender_confirm_sent}", ygopro.constants.COLORS.BABYBLUE);
sur_player.surrend_confirm = true; sur_player.surrend_confirm = true;
ref = [client, sur_player];
for (j = 0, len = ref.length; j < len; j++) {
player = ref[j];
ygopro.stoc_send(client, 'TEAMMATE_SURRENDER');
}
return true; return true;
} }
} }
...@@ -4418,7 +4421,7 @@ ...@@ -4418,7 +4421,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, isVip, key, msg, name, oldmsg, ref, room, session_key, struct, sur_player, uname, windbot, word; var buy_result, cancel, ccolor, cip, cmd, cmsg, cname, code, color, cvalue, isVip, j, key, len, msg, name, oldmsg, player, ref, ref1, room, session_key, struct, sur_player, uname, windbot, word;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
...@@ -4433,7 +4436,7 @@ ...@@ -4433,7 +4436,7 @@
switch (cmd[0]) { switch (cmd[0]) {
case '/投降': case '/投降':
case '/surrender': case '/surrender':
if (room.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN || (room.hostinfo.mode === 2 && !settings.modules.tag_duel_surrender)) { if (room.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN) {
return cancel; return cancel;
} }
if (room.random_type && room.turn < 3 && !client.flee_free) { if (room.random_type && room.turn < 3 && !client.flee_free) {
...@@ -4450,6 +4453,11 @@ ...@@ -4450,6 +4453,11 @@
if (room.hostinfo.mode === 2 && sur_player !== client) { if (room.hostinfo.mode === 2 && sur_player !== client) {
ygopro.stoc_send_chat(sur_player, "${surrender_confirm_tag}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(sur_player, "${surrender_confirm_tag}", ygopro.constants.COLORS.BABYBLUE);
ygopro.stoc_send_chat(client, "${surrender_confirm_sent}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${surrender_confirm_sent}", ygopro.constants.COLORS.BABYBLUE);
ref = [client, sur_player];
for (j = 0, len = ref.length; j < len; j++) {
player = ref[j];
ygopro.stoc_send(client, 'TEAMMATE_SURRENDER');
}
} else { } else {
ygopro.stoc_send_chat(client, "${surrender_confirm}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${surrender_confirm}", ygopro.constants.COLORS.BABYBLUE);
} }
...@@ -4530,9 +4538,9 @@ ...@@ -4530,9 +4538,9 @@
} else if (cmsg = cmd[1]) { } else 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);
ref = ygopro.constants.COLORS; ref1 = ygopro.constants.COLORS;
for (cname in ref) { for (cname in ref1) {
cvalue = ref[cname]; cvalue = ref1[cname];
if (cvalue > 10) { if (cvalue > 10) {
ygopro.stoc_send_chat(client, cname, cvalue); ygopro.stoc_send_chat(client, cname, cvalue);
} }
...@@ -4678,19 +4686,19 @@ ...@@ -4678,19 +4686,19 @@
Authorization: `Bearer ${settings.modules.chatgpt.token}` Authorization: `Bearer ${settings.modules.chatgpt.token}`
} }
}).then(function(res) { }).then(function(res) {
var chunk, chunks, j, len, line, lines, results, text; var chunk, chunks, l, len1, line, lines, results, text;
text = res.data.data.text; text = res.data.data.text;
lines = text.split("\n"); lines = text.split("\n");
results = []; results = [];
for (j = 0, len = lines.length; j < len; j++) { for (l = 0, len1 = lines.length; l < len1; l++) {
line = lines[j]; line = lines[l];
if (line) { if (line) {
chunks = _.chunk(line, 100); chunks = _.chunk(line, 100);
results.push((function() { results.push((function() {
var l, len1, results1; var len2, m, results1;
results1 = []; results1 = [];
for (l = 0, len1 = chunks.length; l < len1; l++) { for (m = 0, len2 = chunks.length; m < len2; m++) {
chunk = chunks[l]; chunk = chunks[m];
results1.push(ygopro.stoc_send_chat_to_room(room, chunk.join(''), 1 - client.pos)); results1.push(ygopro.stoc_send_chat_to_room(room, chunk.join(''), 1 - client.pos));
} }
return results1; return results1;
......
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