Skip to content

Commit

Permalink
fix: mission stats coming up empty (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
SlayerOrnstein authored May 17, 2024
1 parent 8308ea7 commit 6574225
Show file tree
Hide file tree
Showing 34 changed files with 436 additions and 79 deletions.
5 changes: 5 additions & 0 deletions src/ArchonCrystal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { archonShardColor, archonShardUpgradeType } from 'warframe-worldstate-da
* @module
*/
export default class ArchonCrystal {
/**
*
* @param {Object} crystal The archon crystal object
* @param {string} local The locale to get translations in
*/
constructor(crystal, local) {
/**
* Archon shard color
Expand Down
4 changes: 4 additions & 0 deletions src/ChallengeProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* @module
*/
export default class ChallengeProgress {
/**
*
* @param {Object} challenge The challenge object to parse
*/
constructor(challenge) {
/**
* Name of the challenge
Expand Down
1 change: 1 addition & 0 deletions src/Enemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
export default class Enemy {
/**
*
* @param {Object} enemy The enemy
*/
constructor(enemy) {
Expand Down
4 changes: 4 additions & 0 deletions src/Intrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* @module
*/
export default class Intrinsics {
/**
*
* @param {Object} skills The intrinsics object
*/
constructor(skills) {
// I know this is railjack but I'm not sure what the context is
/**
Expand Down
16 changes: 8 additions & 8 deletions src/ItemConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { colors, find } from 'warframe-items/utilities';
import { colors } from 'warframe-items/utilities';

import Skin from './Skin.js';
import mapToHex from './Util.js';

/**
Expand All @@ -8,16 +9,15 @@ import mapToHex from './Util.js';
*/
export default class ItemConfig {
/**
*
* @param {Object} config The configuration
*/
constructor(config) {
/**
* Array of unique names for the skins applied to item
* @type {Array<String>}
*/
this.skins = config.Skins.filter(Boolean)
.map((s) => find.findItem(s))
.filter(Boolean);
this.skins = config.Skins.filter(Boolean).map((s) => new Skin({ ItemType: s }));

/**
* Array of PVP unique name upgrades applied
Expand All @@ -27,25 +27,25 @@ export default class ItemConfig {

/**
* Primary colors applied to item if they exist
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (config.pricol) this.primaryColor = colors.mapColors(mapToHex(config.pricol));

/**
* Sigil colors applied to item if they exist
* @type {module:"warframe-items".ColorMap}
* @type {module:("warframe-items").ColorMap | undefined}
*/
if (config.sigcol) this.sigilColor = colors.mapColors(mapToHex(config.sigcol));

/**
* Attachment colors applied to item if they exist
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (config.attcol) this.attachmentsColor = colors.mapColors(mapToHex(config.attcol));

/**
* Syandana colors applied to item if they exist
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (config.syancol) this.syandanaColor = colors.mapColors(mapToHex(config.syancol));
}
Expand Down
8 changes: 6 additions & 2 deletions src/LoadOutInventory.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import LoadOutItem from './LoadOutItem.js';
import WeaponSkin from './WeaponSkin.js';
import Skin from './Skin.js';
import XpInfo from './XpInfo.js';

/**
* Player loudout
* @module
*/
export default class LoadOutInventory {
/**
*
* @param {Object} item The loadout data
*/
constructor(item) {
/**
* Skins applied to weapons
* @type {WeaponSkin}
*/
this.weaponSkins = item.WeaponSkins.map((s) => new WeaponSkin(s));
this.weaponSkins = item.WeaponSkins.map((s) => new Skin(s));

/**
* An array of the player's currently equiped Warframe (or powersuits)
Expand Down
14 changes: 9 additions & 5 deletions src/LoadOutItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import Polarity from './Polarity.js';
* @module
*/
export default class LoadOutItem {
/**
*
* @param {Object} weapon The loadout item from LoadoutInventory
*/
constructor(weapon) {
/**
* Item ID
Expand Down Expand Up @@ -108,31 +112,31 @@ export default class LoadOutItem {

/**
* Primary colors applied to item if they exist
* @type {ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (weapon.pricol) this.primaryColor = colors.mapColors(weapon.pricol);

/**
* Sigil colors applied to item if they exist
* @type {ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (weapon.sigcol) this.sigilColor = colors.mapColors(weapon.sigcol.toString(16));

/**
* Attachment colors applied to item if they exist
* @type {ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (weapon.attcol) this.attachmentsColor = colors.mapColors(weapon.attcol.toString(16));

/**
* Syandana colors applied to item if they exist
* @type {ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (weapon.syancol) this.syandanaColor = colors.mapColors(weapon.syancol.toString(16));

/**
* If set will show when the player's warframe was infested.
* @type {ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (weapon.InfestationDate) this.infestationDate = parseDate(weapon.InfestationDate);
}
Expand Down
20 changes: 14 additions & 6 deletions src/Mission.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import { node, nodeEnemy, nodeMissionType } from 'warframe-worldstate-data/utili
* @module
*/
export default class Mission {
/**
*
* @param {Object} mission The mission data
* @param {string} locale The locale to return in
*/
constructor(mission, locale) {
const uniqueName = mission.Type || mission.Tag;
const uniqueName = mission.type || mission.Tag;

/**
* Node name
Expand All @@ -18,7 +23,7 @@ export default class Mission {
* Node mission type
* @type {String}
*/
this.misstionType = nodeMissionType(uniqueName, locale);
this.missionType = nodeMissionType(uniqueName, locale);

/**
* Node faction
Expand All @@ -28,17 +33,20 @@ export default class Mission {

/**
* Highest score earned in this mission
* @type {number}
* @type {number | undefined}
*/
if (mission.highScore) this.highScore = mission.HighScore;
if (mission.highScore) this.highScore = mission.highScore;

/**
* How many times the mission was completed
* @type {number}
* @type {number | undefined}
*/
if (mission.Completes) this.completes = mission.Completes;

// Not sure.
/**
* Denotes a steel path node
* @type {number | undefined}
*/
if (mission.Tier) this.tier = mission.Tier;
}
}
23 changes: 14 additions & 9 deletions src/OperatorLoadOuts.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { colors } from 'warframe-items/utilities';

import Skin from './Skin.js';
import mapToHex from './Util.js';

/**
* Player's operator loadout
* @module
*/
export default class OperatorLoadOuts {
/**
*
* @param {Object} loadout The operator loadout
*/
constructor(loadout) {
/**
* Skins that have been applied to the player's operator.
* @type {Array<String>}
* @type {Array<Skin>}
*/
this.skins = loadout.Skins;
this.skins = loadout.Skins.filter(Boolean).map((s) => new Skin({ ItemType: s }));

/**
* Operator amp ID
Expand All @@ -29,43 +34,43 @@ export default class OperatorLoadOuts {

/**
* Operator primary colors
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (loadout.pricol) this.primaryColor = colors.mapColors(mapToHex(loadout.pricol));

/**
* Operator sigil colors
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (loadout.sigcol) this.sigilColor = colors.mapColors(mapToHex(loadout.sigcol));

/**
* Operator attachment colors
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (loadout.attcol) this.attachmentsColor = colors.mapColors(mapToHex(loadout.attcol));

/**
* Operator syandana colors
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (loadout.syancol) this.syandanaColor = colors.mapColors(mapToHex(loadout.syancol));

/**
* Operator eye colors
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (loadout.eyecol) this.eyeColor = colors.mapColors(mapToHex(loadout.eyecol));

/**
* Operator facial colors
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (loadout.facial) this.facial = colors.mapColors(mapToHex(loadout.facial));

/**
* Operator cloth colors
* @type {module:"warframe-items".ColorMap}
* @type {module:"warframe-items".ColorMap | undefined}
*/
if (loadout.cloth) this.cloth = colors.mapColors(mapToHex(loadout.cloth));
}
Expand Down
4 changes: 4 additions & 0 deletions src/Polarity.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { translatePolarity } from 'warframe-worldstate-data/utilities';
* @module
*/
export default class Polarity {
/**
*
* @param {Object} polarity The polarity to parse
*/
constructor(polarity) {
/**
* Polarity name
Expand Down
5 changes: 5 additions & 0 deletions src/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import Syndicate from './Syndicate.js';
* @module
*/
export default class Profile {
/**
*
* @param {Object} profile The profile data to parse
* @param {string} locale The locale to return in where possible
*/
constructor(profile, locale) {
/**
* Player's acount ID
Expand Down
5 changes: 5 additions & 0 deletions src/ProfileParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import Stats from './Stats.js';
* @module
*/
export default class ProfileParser {
/**
*
* @param {Object} data The data returned by getProfile endpoint
* @param {string} locale The locale to return where possible
*/
constructor(data, locale) {
/**
* Player's profile
Expand Down
10 changes: 7 additions & 3 deletions src/Pvp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* @module
*/
export default class Pvp {
/**
*
* @param {Object} pvp PVP data to parse
*/
constructor(pvp) {
/**
* PVP match unique name
Expand All @@ -12,19 +16,19 @@ export default class Pvp {

/**
* Deaths for this match
* @type {number}
* @type {number | undefined}
*/
this.suitDeaths = pvp.suitDeaths;

/**
* Warframe kills
* @type {number}
* @type {number | undefined}
*/
this.suitKills = pvp.suitKills;

/**
* Weapon killes
* @type {number}
* @type {number | undefined}
*/
this.weaponKills = pvp.weaponKills;
}
Expand Down
Loading

0 comments on commit 6574225

Please sign in to comment.