diff --git a/src/models/match.js b/src/models/match.js index 24bbc29..d7eee55 100644 --- a/src/models/match.js +++ b/src/models/match.js @@ -1,4 +1,5 @@ import BaseModel from './'; +import gameModeType from './resources/gameModes'; export default class Match extends BaseModel { @@ -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; } diff --git a/src/models/participant.js b/src/models/participant.js index 06f451e..044ed7d 100644 --- a/src/models/participant.js +++ b/src/models/participant.js @@ -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 { @@ -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; } diff --git a/src/models/resources/gameModes.js b/src/models/resources/gameModes.js new file mode 100644 index 0000000..e9f7640 --- /dev/null +++ b/src/models/resources/gameModes.js @@ -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', +}]; diff --git a/src/models/resources/karma.js b/src/models/resources/karma.js new file mode 100644 index 0000000..4c94459 --- /dev/null +++ b/src/models/resources/karma.js @@ -0,0 +1,10 @@ +export default [{ + serverName: 0, + name: 'Bad Karma', +}, { + serverName: 1, + name: 'Good Karma', +}, { + serverName: 2, + name: 'Great Karma', +}]; diff --git a/src/models/resources/skillTiers.js b/src/models/resources/skillTiers.js new file mode 100644 index 0000000..9917f8f --- /dev/null +++ b/src/models/resources/skillTiers.js @@ -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', +}];