mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
Upgrade syntax of everything to more modern javascript
This commit is contained in:
parent
f8d903b982
commit
69288baebc
43 changed files with 1499 additions and 1521 deletions
|
|
@ -1,20 +1,23 @@
|
|||
module.exports = require('./gamespy2').extend({
|
||||
finalizeState: function(state) {
|
||||
this._super(state);
|
||||
class AmericasArmy extends require('./gamespy2') {
|
||||
finalizeState(state) {
|
||||
super.finalizeState(state);
|
||||
state.name = this.stripColor(state.name);
|
||||
state.map = this.stripColor(state.map);
|
||||
for(var i in state.raw) {
|
||||
if(!(typeof state.raw[i] == 'string')) continue;
|
||||
state.raw[i] = this.stripColor(state.raw[i]);
|
||||
for(const key of Object.keys(state.raw)) {
|
||||
if(typeof state.raw[key] === 'string') {
|
||||
state.raw[key] = this.stripColor(state.raw[key]);
|
||||
}
|
||||
}
|
||||
for(var i = 0; i < state.players.length; i++) {
|
||||
var player = state.players[i];
|
||||
for(const player of state.players) {
|
||||
if(!('name' in player)) continue;
|
||||
player.name = this.stripColor(player.name);
|
||||
}
|
||||
},
|
||||
stripColor: function(str) {
|
||||
}
|
||||
|
||||
stripColor(str) {
|
||||
// uses unreal 2 color codes
|
||||
return str.replace(/\x1b...|[\x00-\x1a]/g,'');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = AmericasArmy;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue