Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Commit

Permalink
Better replace for actors (#26)
Browse files Browse the repository at this point in the history
* Better replace for actors

* HeroesToken: Making some requested changes

* Slight modifications
  • Loading branch information
PierreAndreis authored and seripap committed Nov 10, 2017
1 parent 7751c29 commit 5880111
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 161 deletions.
17 changes: 14 additions & 3 deletions src/models/participant.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BaseModel from './';
import actors from './resources/actors';
import items from './resources/items';
import skillTiers from './resources/skillTiers';
import karma from './resources/karma';
Expand Down Expand Up @@ -41,8 +40,20 @@ export default class Participant extends BaseModel {
}

get actor() {
const normalizedActor = actors.find(actor => actor.serverName === this.raw.attributes.actor);
return normalizedActor ? normalizedActor.name : this.raw.attributes.actor;
const badServerTokenMapping = {
'*Hero009*': 'Krul',
'*Hero010*': 'Skaarf',
'*Sayoc*': 'Taka',
'*Hero016*': 'Rona',
};

const match = /^\*(.*)\*$/.exec(token);

if (match) {
return badServerTokenMapping[token] || null;
}

return token.replace(/\*/g, '');
}

get _stats() {
Expand Down
158 changes: 0 additions & 158 deletions src/models/resources/actors.js

This file was deleted.

0 comments on commit 5880111

Please sign in to comment.