mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
save ticks in summary
This commit is contained in:
parent
f93ae7a6ac
commit
7c191e369c
1 changed files with 11 additions and 5 deletions
14
parser.js
14
parser.js
|
|
@ -42,7 +42,7 @@ Parser.prototype.readHeader = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
Parser.prototype.parseBody = function () {
|
Parser.prototype.parseBody = function () {
|
||||||
var message, i;
|
var message, i, tick = 0;
|
||||||
while (message = this.readMessage()) {
|
while (message = this.readMessage()) {
|
||||||
if (message.parse) {
|
if (message.parse) {
|
||||||
var packets = message.parse();
|
var packets = message.parse();
|
||||||
|
|
@ -52,11 +52,15 @@ Parser.prototype.parseBody = function () {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (packet.packetType) {
|
switch (packet.packetType) {
|
||||||
|
case 'netTick':
|
||||||
|
tick = packet.tick;
|
||||||
|
break;
|
||||||
case 'sayText2':
|
case 'sayText2':
|
||||||
this.state.chat.push({
|
this.state.chat.push({
|
||||||
kind: packet.kind,
|
kind: packet.kind,
|
||||||
from: packet.from,
|
from: packet.from,
|
||||||
text: packet.text
|
text: packet.text,
|
||||||
|
tick: tick
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'stringTable':
|
case 'stringTable':
|
||||||
|
|
@ -77,14 +81,16 @@ Parser.prototype.parseBody = function () {
|
||||||
killer : packet.event.values.attacker,
|
killer : packet.event.values.attacker,
|
||||||
assister: assister,
|
assister: assister,
|
||||||
victim : packet.event.values.userid,
|
victim : packet.event.values.userid,
|
||||||
weapon : packet.event.values.weapon
|
weapon : packet.event.values.weapon,
|
||||||
|
tick : tick
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'teamplay_round_win':
|
case 'teamplay_round_win':
|
||||||
if (packet.event.values.winreason !== 6) {// 6 = timelimit
|
if (packet.event.values.winreason !== 6) {// 6 = timelimit
|
||||||
this.state.rounds.push({
|
this.state.rounds.push({
|
||||||
winner : packet.event.values.team === 2 ? 'red' : 'blue',
|
winner : packet.event.values.team === 2 ? 'red' : 'blue',
|
||||||
length: packet.event.values.round_time
|
length : packet.event.values.round_time,
|
||||||
|
end_tick: tick
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue