-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Black Ops 4 data with full TS interfaces and move other cods t…
…o legacy object
- Loading branch information
jakejrichards
committed
Nov 27, 2018
1 parent
3fa701a
commit 36333f8
Showing
17 changed files
with
1,486 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
export interface BaseStats { | ||
killsRevenge: number; | ||
top10PlacementTeam: number; | ||
kdratio: number; | ||
killsUnderwaterEnemy: number; | ||
downsEliminatedTeam: number; | ||
ekia: number; | ||
score: number; | ||
distanceTraveledWingsuit: number; | ||
rank: number; | ||
deaths: number; | ||
frackingBlastDoorsOpened: number; | ||
killsEliminated: number; | ||
wins: number; | ||
itemsDropped: number; | ||
squads2Eliminated: number; | ||
winStreak: number; | ||
distanceTraveledVehicleLand: number; | ||
headshotDamage: number; | ||
top5PlacementPlayer: number; | ||
revives: number; | ||
activationCountBroadcast: number; | ||
rankxp: number; | ||
placementxp: number; | ||
killsWithoutDamage: number; | ||
downsEliminated: number; | ||
shots: number; | ||
killsAfterRevive: number; | ||
top10PlacementTeamNoCircleDamage: number; | ||
timePlayedTotal: number; | ||
killxp: number; | ||
killsLongshotSniper: number; | ||
top15PlacementTeam: number; | ||
top5PlacementTeam: number; | ||
killsEquipment: number; | ||
winsLastAlive: number; | ||
itemsPickedUp: number; | ||
totalDamage: number; | ||
plevel: number; | ||
killsEnemyInVehicleWater: number; | ||
squads4Eliminated: number; | ||
downsRevived: number; | ||
misses: number; | ||
squadsEliminatedUnassisted: number; | ||
basketsMade: number; | ||
hitsHeadshot: number; | ||
killStreak: number; | ||
itemsHealthUsed: number; | ||
killsEnemyInVehicleLand: number; | ||
winxp: number; | ||
top10PlacementTeamPerks: number; | ||
hits: number; | ||
itemsBackpacksUsed: number; | ||
killsLongshot: number; | ||
challengexp: number; | ||
mostKillsInAGame: number; | ||
longestFiringRangeBullseye: number; | ||
killsVehiclePassenger: number; | ||
activationCountCrane: number; | ||
tanborFudgelyInteractions: number; | ||
losses: number; | ||
vehicleScavengerWater: number; | ||
totalGamesPlayed: number; | ||
killsUnderwater: number; | ||
killsEnemyInVehicleAir: number; | ||
winsWithoutDown: number; | ||
totalShots: number; | ||
wlratio: number; | ||
destroyEquipment: number; | ||
killsEarly: number; | ||
characterQuestsCompleted: number; | ||
distanceTraveledWingsuitMiles: number; | ||
downs: number; | ||
top5FirstInventory: number; | ||
distanceTraveledVehicleWater: number; | ||
curWinStreak: number; | ||
vehicleEscapes: number; | ||
distanceTraveledVehicleLandMiles: number; | ||
vehicleScavengerAir: number; | ||
killsUnarmed: number; | ||
killsAfterDamage: number; | ||
top25PlacementPlayer: number; | ||
vehiclesDestroyed: number; | ||
vehicleUsedAll: number; | ||
killsZombie: number; | ||
winsFirst: number; | ||
killsAfterDamageUnarmed: number; | ||
vehicleLockExits: number; | ||
distanceTraveledVehicleAir: number; | ||
killsWhileStunned: number; | ||
kills: number; | ||
distanceTraveledVehicleAirMiles: number; | ||
vehiclesDestroyedOccupied: number; | ||
top10PlacementPlayer: number; | ||
top5Avenger: number; | ||
vehicleDamageOccupied: number; | ||
activationCountJukebox: number; | ||
distanceTraveledFoot: number; | ||
killsVehicleDriver: number; | ||
headshots: number; | ||
assists: number; | ||
itemsPaintCansCollected: number; | ||
ties: number; | ||
vehicleDamage: number; | ||
longestDistanceKill: number; | ||
distanceTraveledVehicleWaterMiles: number; | ||
vehiclesDestroyedOccupiedUsingVehicle: number; | ||
itemsNPaintCansCollected: number; | ||
maxFiringRangeBullseye: number; | ||
itemsArmorUsed: number; | ||
killsAvenged: number; | ||
winsWithoutKills: number; | ||
cargoSupplyOpened: number; | ||
vehicleScavengerLand: number; | ||
mostDamageInAGame: number; | ||
timePlayedAlive: number; | ||
squads3Eliminated: number; | ||
} | ||
|
||
export interface BlackoutOverall extends BaseStats { | ||
topPlacementsAll: number; | ||
accuracy: number; | ||
damagePerMinute: number; | ||
ekiadRatio: number; | ||
killsEarlyPercentage: number; | ||
winPercentage: number; | ||
damagePerGame: number; | ||
ekiaPerGame: number; | ||
headshotPercentage: number; | ||
topPlacementsPlayer: number; | ||
topPlacementsTeam: number; | ||
revivesPerGame: number; | ||
avgLifeTime: number; | ||
killsPerGame: number; | ||
} | ||
|
||
export interface Mode { | ||
warzone_duo: BaseStats; | ||
warzone_quad: BaseStats; | ||
warzone_solo: BaseStats; | ||
} | ||
|
||
export interface Lifetime { | ||
all: BlackoutOverall; | ||
mode: Mode; | ||
} | ||
|
||
export interface Mp { | ||
lifetime: Lifetime; | ||
level: number; | ||
maxLevel: number; | ||
levelXpRemainder: number; | ||
levelXpGained: number; | ||
prestige: number; | ||
prestigeId: number; | ||
maxPrestige: number; | ||
} | ||
|
||
export interface Data { | ||
title: string; | ||
platform: string; | ||
username: string; | ||
mp: Mp; | ||
engagement: any; | ||
} | ||
|
||
export interface RawBlackoutObject { | ||
status: string; | ||
data: Data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { COD_API_ENDPOINT, getDataFromAPI } from './utils'; | ||
import { RawBlackoutObject } from './blackout'; | ||
import { RawMultiplayerObject } from './multiplayer'; | ||
import { RawZombiesObject } from './zombies'; | ||
|
||
const BO4_ENDPOINT = `${COD_API_ENDPOINT}/crm/cod/v2/title/bo4`; | ||
|
||
type Platform = 'psn' | 'xbl' | 'battle'; | ||
|
||
export function getRawBlackoutStats(username: string, platform: Platform) { | ||
const uri = `${BO4_ENDPOINT}/platform/${platform}/gamer/${username}/profile?type=blackout`; | ||
return getDataFromAPI<RawBlackoutObject>(uri); | ||
} | ||
|
||
export function getRawMultiplayerStats(username: string, platform: Platform) { | ||
const uri = `${BO4_ENDPOINT}/platform/${platform}/gamer/${username}/profile?type=mp`; | ||
return getDataFromAPI<RawMultiplayerObject>(uri) | ||
} | ||
|
||
export function getRawZombiesStats(username: string, platform: Platform) { | ||
const uri = `${BO4_ENDPOINT}/platform/${platform}/gamer/${username}/profile?type=zombies`; | ||
return getDataFromAPI<RawZombiesObject>(uri); | ||
} | ||
|
||
export async function getOverallBlackoutStats(username: string, platform: Platform) { | ||
const rawBlackoutObject = await getRawBlackoutStats(username, platform); | ||
return rawBlackoutObject.data.mp.lifetime.all; | ||
} | ||
|
||
/* These Blackout Methods are not populated with data yet | ||
export async function getSoloBlackoutStats(username: string, platform: Platform) { | ||
const rawBlackoutObject = await getRawBlackoutStats(username, platform); | ||
return rawBlackoutObject.data.mp.lifetime.mode.warzone_solo; | ||
} | ||
export async function getDuoBlackoutStats(username: string, platform: Platform) { | ||
const rawBlackoutObject = await getRawBlackoutStats(username, platform); | ||
return rawBlackoutObject.data.mp.lifetime.mode.warzone_duo; | ||
} | ||
export async function getQuadBlackoutStats(username: string, platform: Platform) { | ||
const rawBlackoutObject = await getRawBlackoutStats(username, platform); | ||
return rawBlackoutObject.data.mp.lifetime.mode.warzone_quad; | ||
} | ||
*/ | ||
|
||
export async function getOverallZombiesStats(username: string, platform: Platform) { | ||
const rawZombiesObject = await getRawZombiesStats(username, platform); | ||
return rawZombiesObject.data.mp.lifetime.all; | ||
} | ||
|
||
export async function getLifetimeMultiplayerStats(username: string, platform: Platform) { | ||
const rawMultiplayerObject = await getRawMultiplayerStats(username, platform); | ||
return rawMultiplayerObject.data.mp.lifetime; | ||
} | ||
|
||
export async function getWeeklyMultiplayerStats(username: string, platform: Platform) { | ||
const rawMultiplayerObject = await getRawMultiplayerStats(username, platform); | ||
return rawMultiplayerObject.data.mp.weekly; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const { BO4 } = require('../dist/index'); | ||
|
||
const username = 'Consisttt'; // username | ||
const platform = 'psn'; // psn | xbl | battle | ||
|
||
// Retrieve Raw Responses | ||
|
||
BO4.getRawMultiplayerStats(username, platform) | ||
.then(raw => { | ||
console.log(`${username} (${platform}) is prestige ${raw.data.mp.prestige} level ${raw.data.mp.level} in Black Ops 4 Multiplayer`); | ||
}); | ||
|
||
BO4.getRawBlackoutStats(username, platform) | ||
.then(raw => { | ||
console.log(`${username} (${platform}) is level ${raw.data.mp.level} in Black Ops 4 Blackout`); | ||
}); | ||
|
||
BO4.getRawZombiesStats(username, platform) | ||
.then(raw => { | ||
console.log(`${username} (${platform}) is level ${raw.data.mp.level} in Black Ops 4 Zombies`); | ||
}); | ||
|
||
// Specific Methods | ||
|
||
BO4.getLifetimeMultiplayerStats(username, platform) | ||
.then(data => { | ||
console.log(`${username} (${platform}) has ${data.all.kills} total kill(s) in Black Ops 4 Multiplayer`); | ||
}); | ||
|
||
BO4.getWeeklyMultiplayerStats(username, platform) | ||
.then(data => { | ||
console.log(`${username} (${platform}) has ${data.all.wins} win(s) this week in Black Ops 4 Multiplayer`); | ||
}); | ||
|
||
BO4.getOverallZombiesStats(username, platform) | ||
.then(data => { | ||
console.log(`${username} (${platform}) has ${data.kills} total kill(s) in Black Ops 4 Zombies`); | ||
}); | ||
|
||
BO4.getOverallBlackoutStats(username, platform) | ||
.then(data => { | ||
console.log(`${username} (${platform}) has ${data.wins} total win(s) in Black Ops 4 Blackout`); | ||
}); | ||
|
||
// Not yet supported methods | ||
// BO4.getSoloBlackoutStats | ||
// BO4.getDuoBlackoutStats | ||
// BO4.getQuadBlackoutStats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.