mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-09 04:23:01 -05:00
Support new |:| and |c:| messages
These message types are used to send message times, replacing the old |ct| system, and are more efficient server-side.
This commit is contained in:
parent
d33c71836b
commit
05ae8ea6fb
|
|
@ -816,6 +816,15 @@
|
|||
this.addChat(row[1], row.slice(2).join('|'));
|
||||
break;
|
||||
|
||||
case ':':
|
||||
this.timeOffset = ~~(Date.now()/1000) - parseInt(row[1], 10);
|
||||
break;
|
||||
case 'c:':
|
||||
if (/[a-zA-Z0-9]/.test(row[2].charAt(0))) row[2] = ' '+row[2];
|
||||
var deltaTime = ~~(Date.now()/1000) - this.timeOffset - parseInt(row[1], 10);
|
||||
this.addChat(row[2], row.slice(3).join('|'), false, deltaTime);
|
||||
break;
|
||||
|
||||
case 'tc':
|
||||
if (/[a-zA-Z0-9]/.test(row[2].charAt(0))) row[2] = ' '+row[2];
|
||||
this.addChat(row[2], row.slice(3).join('|'), false, row[1]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user