Commit 8975e6c7 authored by nanahira's avatar nanahira

merge

parents 1a56baff 7a59c845
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
"23": "SELECT_SUM", "23": "SELECT_SUM",
"24": "SELECT_DISFIELD", "24": "SELECT_DISFIELD",
"25": "SORT_CARD", "25": "SORT_CARD",
"26": "SELECT_UNSELECT_CARD",
"30": "CONFIRM_DECKTOP", "30": "CONFIRM_DECKTOP",
"31": "CONFIRM_CARDS", "31": "CONFIRM_CARDS",
"32": "SHUFFLE_DECK", "32": "SHUFFLE_DECK",
...@@ -103,8 +104,10 @@ ...@@ -103,8 +104,10 @@
"36": "SHUFFLE_SET_CARD", "36": "SHUFFLE_SET_CARD",
"37": "REVERSE_DECK", "37": "REVERSE_DECK",
"38": "DECK_TOP", "38": "DECK_TOP",
"39": "MSG_SHUFFLE_EXTRA",
"40": "NEW_TURN", "40": "NEW_TURN",
"41": "NEW_PHASE", "41": "NEW_PHASE",
"42": "CONFIRM_EXTRATOP",
"50": "MOVE", "50": "MOVE",
"53": "POS_CHANGE", "53": "POS_CHANGE",
"54": "SET", "54": "SET",
...@@ -148,6 +151,8 @@ ...@@ -148,6 +151,8 @@
"123": "RELEASE_RELATION", "123": "RELEASE_RELATION",
"130": "TOSS_COIN", "130": "TOSS_COIN",
"131": "TOSS_DICE", "131": "TOSS_DICE",
"132": "ROCK_PAPER_SCISSORS",
"133": "HAND_RES",
"140": "ANNOUNCE_RACE", "140": "ANNOUNCE_RACE",
"141": "ANNOUNCE_ATTRIB", "141": "ANNOUNCE_ATTRIB",
"142": "ANNOUNCE_CARD", "142": "ANNOUNCE_CARD",
......
...@@ -1354,7 +1354,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)-> ...@@ -1354,7 +1354,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
return unless room return unless room
msg = buffer.readInt8(0) msg = buffer.readInt8(0)
if msg >= 10 and msg < 30 #SELECT开头的消息 if (msg >= 10 and msg < 30) or msg == 132 or (msg >= 140 and msg < 144) #SELECT和ANNOUNCE开头的消息
room.waiting_for_player = client room.waiting_for_player = client
room.last_active_time = moment() room.last_active_time = moment()
#log.info("#{ygopro.constants.MSG[msg]}等待#{room.waiting_for_player.name}") #log.info("#{ygopro.constants.MSG[msg]}等待#{room.waiting_for_player.name}")
...@@ -1364,6 +1364,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)-> ...@@ -1364,6 +1364,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
playertype = buffer.readUInt8(1) playertype = buffer.readUInt8(1)
client.is_first = !(playertype & 0xf) client.is_first = !(playertype & 0xf)
client.lp = room.hostinfo.start_lp client.lp = room.hostinfo.start_lp
client.card_count = 0 if room.hostinfo.mode != 2
if client.pos == 0 if client.pos == 0
room.turn = 0 room.turn = 0
room.duel_count = room.duel_count + 1 room.duel_count = room.duel_count + 1
...@@ -1447,6 +1448,25 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)-> ...@@ -1447,6 +1448,25 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
if 0 < room.dueling_players[pos].lp <= 100 if 0 < room.dueling_players[pos].lp <= 100
ygopro.stoc_send_chat_to_room(room, "${lp_low_self}", ygopro.constants.COLORS.PINK) ygopro.stoc_send_chat_to_room(room, "${lp_low_self}", ygopro.constants.COLORS.PINK)
#track card count
#todo: track card count in tag mode
if ygopro.constants.MSG[msg] == 'MOVE' and client.pos == 0 and room.hostinfo.mode != 2
pos = buffer.readUInt8(5)
pos = 1 - pos unless client.is_first
loc = buffer.readUInt8(6)
room.dueling_players[pos].card_count-- if (loc & 0xe)
pos = buffer.readUInt8(9)
pos = 1 - pos unless client.is_first
loc = buffer.readUInt8(10)
room.dueling_players[pos].card_count++ if (loc & 0xe)
if ygopro.constants.MSG[msg] == 'DRAW' and room.hostinfo.mode != 2
pos = buffer.readUInt8(1)
pos = 1 - pos unless client.is_first
if pos == 0
count = buffer.readInt8(2)
client.card_count += count
#登场台词 #登场台词
if settings.modules.dialogues.enabled if settings.modules.dialogues.enabled
if ygopro.constants.MSG[msg] == 'SUMMONING' or ygopro.constants.MSG[msg] == 'SPSUMMONING' or ygopro.constants.MSG[msg] == 'CHAINING' if ygopro.constants.MSG[msg] == 'SUMMONING' or ygopro.constants.MSG[msg] == 'SPSUMMONING' or ygopro.constants.MSG[msg] == 'CHAINING'
...@@ -2022,7 +2042,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)-> ...@@ -2022,7 +2042,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
replay_filename: replay_filename, replay_filename: replay_filename,
roommode: room.hostinfo.mode, roommode: room.hostinfo.mode,
players: (for player in room.dueling_players players: (for player in room.dueling_players
name: player.name + (if settings.modules.tournament_mode.show_ip and !player.is_local then (" (IP: " + player.ip.slice(7) + ")") else "") + (if settings.modules.tournament_mode.show_info and not (room.hostinfo.mode == 2 and player.pos % 2 > 0) then (" (Score:" + room.scores[player.name] + " LP:" + (if player.lp? then player.lp else room.hostinfo.start_lp) + ")") else ""), name: player.name + (if settings.modules.tournament_mode.show_ip and !player.is_local then (" (IP: " + player.ip.slice(7) + ")") else "") + (if settings.modules.tournament_mode.show_info and not (room.hostinfo.mode == 2 and player.pos % 2 > 0) then (" (Score:" + room.scores[player.name] + " LP:" + (if player.lp? then player.lp else room.hostinfo.start_lp) + (if room.hostinfo.mode != 2 then (" Cards:" + (if player.card_count? then player.card_count else room.hostinfo.start_hand)) else "") + ")") else ""),
winner: player.pos == room.winner winner: player.pos == room.winner
) )
} }
...@@ -2121,7 +2141,7 @@ if settings.modules.http ...@@ -2121,7 +2141,7 @@ if settings.modules.http
needpass: (room.name.indexOf('$') != -1).toString(), needpass: (room.name.indexOf('$') != -1).toString(),
users: (for player in room.players when player.pos? users: (for player in room.players when player.pos?
id: (-1).toString(), id: (-1).toString(),
name: player.name + (if settings.modules.http.show_ip and pass_validated and !player.is_local then (" (IP: " + player.ip.slice(7) + ")") else "") + (if settings.modules.http.show_info and room.started and player.pos != 7 and not (room.hostinfo.mode == 2 and player.pos % 2 > 0) then (" (Score:" + room.scores[player.name] + " LP:" + (if player.lp? then player.lp else room.hostinfo.start_lp) + ")") else ""), name: player.name + (if settings.modules.http.show_ip and pass_validated and !player.is_local then (" (IP: " + player.ip.slice(7) + ")") else "") + (if settings.modules.http.show_info and room.started and player.pos != 7 and not (room.hostinfo.mode == 2 and player.pos % 2 > 0) then (" (Score:" + room.scores[player.name] + " LP:" + (if player.lp? then player.lp else room.hostinfo.start_lp) + (if room.hostinfo.mode != 2 then (" Cards:" + (if player.card_count? then player.card_count else room.hostinfo.start_hand)) else "") + ")") else ""),
pos: player.pos pos: player.pos
), ),
istart: if room.started then (if settings.modules.http.show_info then ("Duel:" + room.duel_count + " " + (if room.changing_side then "Siding" else "Turn:" + (if room.turn? then room.turn else 0) + (if room.death then "/" + (if room.death > 0 then room.death - 1 else "Death") else ""))) else 'start') else 'wait' istart: if room.started then (if settings.modules.http.show_info then ("Duel:" + room.duel_count + " " + (if room.changing_side then "Siding" else "Turn:" + (if room.turn? then room.turn else 0) + (if room.death then "/" + (if room.death > 0 then room.death - 1 else "Death") else ""))) else 'start') else 'wait'
......
...@@ -1702,13 +1702,13 @@ ...@@ -1702,13 +1702,13 @@
} }
ygopro.stoc_follow('GAME_MSG', false, function(buffer, info, client, server) { ygopro.stoc_follow('GAME_MSG', false, function(buffer, info, client, server) {
var card, l, len2, line, msg, playertype, pos, reason, ref2, ref3, ref4, room, trigger_location, val, win_pos; var card, count, l, len2, line, loc, msg, playertype, pos, reason, ref2, ref3, ref4, room, trigger_location, val, win_pos;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
} }
msg = buffer.readInt8(0); msg = buffer.readInt8(0);
if (msg >= 10 && msg < 30) { if ((msg >= 10 && msg < 30) || msg === 132 || (msg >= 140 && msg < 144)) {
room.waiting_for_player = client; room.waiting_for_player = client;
room.last_active_time = moment(); room.last_active_time = moment();
} }
...@@ -1716,6 +1716,9 @@ ...@@ -1716,6 +1716,9 @@
playertype = buffer.readUInt8(1); playertype = buffer.readUInt8(1);
client.is_first = !(playertype & 0xf); client.is_first = !(playertype & 0xf);
client.lp = room.hostinfo.start_lp; client.lp = room.hostinfo.start_lp;
if (room.hostinfo.mode !== 2) {
client.card_count = 0;
}
if (client.pos === 0) { if (client.pos === 0) {
room.turn = 0; room.turn = 0;
room.duel_count = room.duel_count + 1; room.duel_count = room.duel_count + 1;
...@@ -1830,6 +1833,34 @@ ...@@ -1830,6 +1833,34 @@
ygopro.stoc_send_chat_to_room(room, "${lp_low_self}", ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat_to_room(room, "${lp_low_self}", ygopro.constants.COLORS.PINK);
} }
} }
if (ygopro.constants.MSG[msg] === 'MOVE' && client.pos === 0 && room.hostinfo.mode !== 2) {
pos = buffer.readUInt8(5);
if (!client.is_first) {
pos = 1 - pos;
}
loc = buffer.readUInt8(6);
if (loc & 0xe) {
room.dueling_players[pos].card_count--;
}
pos = buffer.readUInt8(9);
if (!client.is_first) {
pos = 1 - pos;
}
loc = buffer.readUInt8(10);
if (loc & 0xe) {
room.dueling_players[pos].card_count++;
}
}
if (ygopro.constants.MSG[msg] === 'DRAW' && room.hostinfo.mode !== 2) {
pos = buffer.readUInt8(1);
if (!client.is_first) {
pos = 1 - pos;
}
if (pos === 0) {
count = buffer.readInt8(2);
client.card_count += count;
}
}
if (settings.modules.music.enabled) { if (settings.modules.music.enabled) {
if (ygopro.constants.MSG[msg] === 'HINT') { if (ygopro.constants.MSG[msg] === 'HINT') {
var hint_type = buffer.readUInt8(1); var hint_type = buffer.readUInt8(1);
...@@ -2738,7 +2769,7 @@ ...@@ -2738,7 +2769,7 @@
for (n = 0, len4 = ref4.length; n < len4; n++) { for (n = 0, len4 = ref4.length; n < len4; n++) {
player = ref4[n]; player = ref4[n];
results.push({ results.push({
name: player.name + (settings.modules.tournament_mode.show_ip && !player.is_local ? " (IP: " + player.ip.slice(7) + ")" : "") + (settings.modules.tournament_mode.show_info && !(room.hostinfo.mode === 2 && player.pos % 2 > 0) ? " (Score:" + room.scores[player.name] + " LP:" + (player.lp != null ? player.lp : room.hostinfo.start_lp) + ")" : ""), name: player.name + (settings.modules.tournament_mode.show_ip && !player.is_local ? " (IP: " + player.ip.slice(7) + ")" : "") + (settings.modules.tournament_mode.show_info && !(room.hostinfo.mode === 2 && player.pos % 2 > 0) ? " (Score:" + room.scores[player.name] + " LP:" + (player.lp != null ? player.lp : room.hostinfo.start_lp) + (room.hostinfo.mode !== 2 ? " Cards:" + (player.card_count != null ? player.card_count : room.hostinfo.start_hand) : "") + ")" : ""),
winner: player.pos === room.winner winner: player.pos === room.winner
}); });
} }
...@@ -2874,7 +2905,7 @@ ...@@ -2874,7 +2905,7 @@
if (player.pos != null) { if (player.pos != null) {
results1.push({ results1.push({
id: (-1).toString(), id: (-1).toString(),
name: player.name + (settings.modules.http.show_ip && pass_validated && !player.is_local ? " (IP: " + player.ip.slice(7) + ")" : "") + (settings.modules.http.show_info && room.started && player.pos !== 7 && !(room.hostinfo.mode === 2 && player.pos % 2 > 0) ? " (Score:" + room.scores[player.name] + " LP:" + (player.lp != null ? player.lp : room.hostinfo.start_lp) + ")" : ""), name: player.name + (settings.modules.http.show_ip && pass_validated && !player.is_local ? " (IP: " + player.ip.slice(7) + ")" : "") + (settings.modules.http.show_info && room.started && player.pos !== 7 && !(room.hostinfo.mode === 2 && player.pos % 2 > 0) ? " (Score:" + room.scores[player.name] + " LP:" + (player.lp != null ? player.lp : room.hostinfo.start_lp) + (room.hostinfo.mode !== 2 ? " Cards:" + (player.card_count != null ? player.card_count : room.hostinfo.start_hand) : "") + ")" : ""),
pos: player.pos pos: player.pos
}); });
} }
......
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