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

Commit

Permalink
Formatting skill tiers, game mode, and karma level
Browse files Browse the repository at this point in the history
  • Loading branch information
seripap committed Mar 20, 2017
1 parent 6210258 commit 3304f85
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/models/match.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BaseModel from './';
import gameModeType from './resources/gameModes';

export default class Match extends BaseModel {

Expand All @@ -19,10 +20,15 @@ export default class Match extends BaseModel {
return this.data.attributes.duration;
}

get gameMode() {
get _gameMode() {
return this.data.attributes.gameMode;
}

get gameMode() {
const normalizedGameMode = gameModeType.find(mode => mode.serverName === this._gameMode);
return normalizedGameMode ? normalizedGameMode.name : this._gameMode;
}

get patchVersion() {
return this.data.attributes.patchVersion;
}
Expand Down
4 changes: 4 additions & 0 deletions src/models/participant.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import BaseModel from './';
import actors from './resources/actors';
import items from './resources/items';
import skillTiers from './resources/skillTiers';
import karma from './resources/karma';

export default class Participant extends BaseModel {

Expand Down Expand Up @@ -41,6 +43,8 @@ export default class Participant extends BaseModel {
stats.itemGrants = this.replaceItem('itemGrants', stats);
stats.itemUses = this.replaceItem('itemUses', stats);
stats.items = this.replaceItem('items', stats);
stats.skillTier = skillTiers.find(tier => tier.serverName === stats.skillTier).name || stats.skillTier;
stats.karmaLevel = karma.find(k => k.serverName === stats.karmaLevel).name || stats.karmaLevel;
return stats;
}

Expand Down
32 changes: 32 additions & 0 deletions src/models/resources/gameModes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export default [{
name: 'Ranked',
serverName: 'ranked',
},
{
name: 'Casual',
serverName: 'casual',
},
{
name: 'Blitz',
serverName: 'blitz_pvp_ranked',
},
{
name: 'Battle Royal',
serverName: 'casual_aral',
},
{
name: 'Private',
serverName: 'private',
},
{
name: 'Private Ranked',
serverName: 'private_party_draft_match',
},
{
name: 'Private Blitz',
serverName: 'private_party_blitz_match',
},
{
name: 'Private Battle Royal',
serverName: 'private_party_aral_match',
}];
10 changes: 10 additions & 0 deletions src/models/resources/karma.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default [{
serverName: 0,
name: 'Bad Karma',
}, {
serverName: 1,
name: 'Good Karma',
}, {
serverName: 2,
name: 'Great Karma',
}];
94 changes: 94 additions & 0 deletions src/models/resources/skillTiers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
export default [{
serverName: -1,
name: 'Unranked'
}, {
serverName: 0,
name: 'Just Beginning - Bronze',
}, {
serverName: 1,
name: 'Just Beginning - Silver',
}, {
serverName: 2,
name: 'Just Beginning - Gold',
}, {
serverName: 3,
name: 'Getting There - Bronze',
}, {
serverName: 4,
name: 'Getting There - Silver',
}, {
serverName: 5,
name: 'Getting There - Gold',
}, {
serverName: 6,
name: 'Rock Solid - Bronze',
}, {
serverName: 7,
name: 'Rock Solid - Silver',
}, {
serverName: 8,
name: 'Rock Solid - Gold',
}, {
serverName: 9,
name: 'Worthy Foe - Bronze',
}, {
serverName: 10,
name: 'Worthy Foe - Silver',
}, {
serverName: 11,
name: 'Worthy Foe - Gold',
}, {
serverName: 12,
name: 'Got Swagger - Bronze',
}, {
serverName: 13,
name: 'Got Swagger - Silver',
}, {
serverName: 14,
name: 'Got Swagger - Gold',
}, {
serverName: 15,
name: 'Credible Threat - Bronze',
}, {
serverName: 16,
name: 'Credible Threat - Silver',
}, {
serverName: 17,
name: 'Credible Threat - Gold',
}, {
serverName: 18,
name: 'The Hotness - Bronze',
}, {
serverName: 19,
name: 'The Hotness - Silver',
}, {
serverName: 20,
name: 'The Hotness - Gold',
}, {
serverName: 21,
name: 'Simply Amazing - Bronze',
}, {
serverName: 22,
name: 'Simply Amazing - Silver',
}, {
serverName: 23,
name: 'Simply Amazing - Gold',
}, {
serverName: 24,
name: 'Pinnacle of Awesome - Bronze',
}, {
serverName: 25,
name: 'Pinnacle of Awesome - Silver',
}, {
serverName: 26,
name: 'Pinnacle of Awesome - Gold',
}, {
serverName: 27,
name: 'Vainglorious - Bronze',
}, {
serverName: 28,
name: 'Vainglorious - Silver',
}, {
serverName: 29,
name: 'Vainglorious - Gold',
}];

0 comments on commit 3304f85

Please sign in to comment.