2019-01-07 01:52:03 +01:00
|
|
|
const Gamespy2 = require('./gamespy2');
|
|
|
|
|
|
|
|
class AmericasArmy extends Gamespy2 {
|
2019-01-07 07:52:29 +01:00
|
|
|
async run(state) {
|
|
|
|
await super.run(state);
|
2017-08-09 12:32:09 +02:00
|
|
|
state.name = this.stripColor(state.name);
|
|
|
|
state.map = this.stripColor(state.map);
|
|
|
|
for(const key of Object.keys(state.raw)) {
|
|
|
|
if(typeof state.raw[key] === 'string') {
|
2017-08-09 11:05:55 +02:00
|
|
|
state.raw[key] = this.stripColor(state.raw[key]);
|
|
|
|
}
|
2017-08-09 12:32:09 +02:00
|
|
|
}
|
|
|
|
for(const player of state.players) {
|
|
|
|
if(!('name' in player)) continue;
|
|
|
|
player.name = this.stripColor(player.name);
|
|
|
|
}
|
|
|
|
}
|
2017-08-09 11:05:55 +02:00
|
|
|
|
2017-08-09 12:32:09 +02:00
|
|
|
stripColor(str) {
|
|
|
|
// uses unreal 2 color codes
|
|
|
|
return str.replace(/\x1b...|[\x00-\x1a]/g,'');
|
|
|
|
}
|
2017-08-09 11:05:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = AmericasArmy;
|