Commit 29eca851 authored by nanahira's avatar nanahira

add card count display

parent cc513078
......@@ -1364,6 +1364,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
playertype = buffer.readUInt8(1)
client.is_first = !(playertype & 0xf)
client.lp = room.hostinfo.start_lp
client.card_count = 0 if room.hostinfo.mode != 2
if client.pos == 0
room.turn = 0
room.duel_count = room.duel_count + 1
......@@ -1447,6 +1448,25 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
if 0 < room.dueling_players[pos].lp <= 100
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 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)->
replay_filename: replay_filename,
roommode: room.hostinfo.mode,
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
)
}
......@@ -2121,7 +2141,7 @@ if settings.modules.http
needpass: (room.name.indexOf('$') != -1).toString(),
users: (for player in room.players when player.pos?
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
),
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'
......
......@@ -1632,7 +1632,7 @@
}
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];
if (!room) {
return;
......@@ -1646,6 +1646,9 @@
playertype = buffer.readUInt8(1);
client.is_first = !(playertype & 0xf);
client.lp = room.hostinfo.start_lp;
if (room.hostinfo.mode !== 2) {
client.card_count = 0;
}
if (client.pos === 0) {
room.turn = 0;
room.duel_count = room.duel_count + 1;
......@@ -1760,6 +1763,34 @@
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.dialogues.enabled) {
if (ygopro.constants.MSG[msg] === 'SUMMONING' || ygopro.constants.MSG[msg] === 'SPSUMMONING' || ygopro.constants.MSG[msg] === 'CHAINING') {
card = buffer.readUInt32LE(1);
......@@ -2574,7 +2605,7 @@
for (n = 0, len4 = ref4.length; n < len4; n++) {
player = ref4[n];
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
});
}
......@@ -2710,7 +2741,7 @@
if (player.pos != null) {
results1.push({
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
});
}
......
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