Skip to content

Commit

Permalink
Merge pull request #10322 from DestinyItemManager/clarity-schema-1.9
Browse files Browse the repository at this point in the history
Clarity Stats schema 1.9
  • Loading branch information
bhollis authored Apr 14, 2024
2 parents 2f743cf + 3fdb62b commit 41a99f7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
1 change: 1 addition & 0 deletions config/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,7 @@
"StrafingSpeed": "Strafing",
"CrouchingSpeed": "Crouching",
"TotalHP": "Total HP",
"ShieldHP": "Shield HP",
"DamageResistance": "PvE Damage Resist",
"FlinchResistance": "Flinch Resist"
},
Expand Down
20 changes: 9 additions & 11 deletions src/app/clarity/descriptions/character-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export interface Ability {
Cooldowns: number[];
/** Represents the behavior of certain abilities possessing additional scaling on their cooldown depending on the number of stored ability charges. The array's length represents the number of charges an ability has intrinsically. Numbers at every array index represent the Charge Rate scalar for the ability with [index] number of stored ability charges. As this is a Charge Rate scalar, cooldown times can be calculated by dividing the times in the Cooldowns member of abilities by the scalars in this array. Do note that this is not a required member of Ability objects and will only be present if an ability has multiple charges. (Therefore, if this property is absent, it is to be assumed that the ability only has a single charge by default) */
ChargeBasedScaling?: number[];
/** Abilities receive different amounts of 'chunk energy' from things like mods and other sources depending on their base cooldown. So let's say an armor mod gives you 10% grenade energy when popping your class ability — you'd multiply that 10% by the number listed here to arrive at the final amount you'll actually receive. An user-facing explanation of this property is available at the top level of the CharacterStat object under <ChunkEnergyScalarDescription>. */
ChunkEnergyScalar?: number;
/** This number represents the scalar for how much benefit you get from active super regeneration with your super ability. This ranges from 0.8 for a Tier 1 super to 1.2 for a Tier 5 super. Active Regen refers to any source of super energy that isn't just passively waiting for it to recharge. So aside from the normal passive regen and other effects that are 'additional base super regen', these influence everything. Be it collecting orbs of power, killing enemies (including assists), taking and dealing damage, armor mods, this covers everything else. */
ActiveRegenScalar?: number;
}

/** Contains a locale ID that you can use to grab the description for the item in your selected language. The ID is provided in a [key].[value] format where there can be an arbitrary number of keys (though it'll be 2-3 at most). Then you can use these keys and values to query the './locale/[language code].json' files for the desired description. */
Expand All @@ -29,12 +33,6 @@ export interface SuperAbility {
Hash: number;
/** Array index represents the Character Stat tier. Cooldowns are in seconds. Rounded to 2 decimal points. Note: Rounding to 2 decimal places is solely for improving math precision when combined with Override objects. When displaying these cooldown times, it is STRONGLY recommended to round them to an integer. */
Cooldowns: number[];
/** Numbers are provided in Damage Resist percentages and represent the Damage Resistance the super provied inside PvP. If the array is empty, the DR value is still unknown. If the array only contains one value, it represents the passive DR of the super. If the value is -9999, the value is still unknown (workaround that allows only inputting one of the PvE or PvP values. If other values are present, check the condition array for the conditions of each of them. */
PvPDamageResistance: number[];
/** Same length as the PvPDamageResistance array and works the exact same way except it stores the DR values for PvE. */
PvEDamageResistance: number[];
/** Array length matches the length of the DamageResistance arrays. This property can be ignored when the length of the arrays is 1 as that represents the passive DR of the Super that doesn't have a condition. The array contains the condition for each Damage Resist value at the same index in the DamageResistance arrays. Unfortunately, there is no way to realistically account for all the different conditions without using simple text for it so these will be succinct descriptions instead of item hashes or the like. */
DRCondition: Description[];
}

export interface Override {
Expand All @@ -43,7 +41,7 @@ export interface Override {
/** The inventoryItem hash of each ability that is required to trigger the effects of this 'Override'. Only overrides 'Abilities' under the same Character Stat as the 'Override'. Any one of these will trigger its effect defined in the other 'Override' properties. Wildcards: if the requirements array only contains 1 item and it's a 0, any ability tied to this Character Stat will have its cooldown overwritten. Negative numbers in the array indicate filters, these will be the inventoryItem hashes of subclasses multiplied by -1. Any abilities tied to the given subclass will have their cooldowns overwritten. */
Requirements: number[];

// One of CooldownOverride, Scalar, or FlatIncrease will be set.
// One of CooldownOverride, Scalar, or ChunkEnergyOverride will be set.

/** Array index represents the Character Stat tier. Cooldowns are in seconds. Rounded to 2 decimal points. Overrides the cooldowns of the items listed in the 'Requirements' array before the scalar is applied. Identical to the 'Cooldowns' array of the 'Ability' object. */
CooldownOverride?: number[];
Expand All @@ -52,9 +50,9 @@ export interface Override {
*/
Scalar?: number[];
/**
* Length of the array is equal to the length of the 'Requirements' array. Each item represents a flat increase to the cooldown time of the abilities (of a subclass) listed in the 'Requirements' array at the same array index. If 'CooldownOverride' or 'Scalar' property is specified: Time is added to the cooldown times at every tier after 'CooldownOverride's and 'Scalar's have been applied.
* Length of the array is equal to the length of the <Requirements> array. Each item represents an override of the <ChunkEnergyScalar> property of the abilities (of a subclass) listed in the <Requirements> array at the same array index. If <CooldownOverride> or <Scalar> property is specified: Time is added to the cooldown times at every tier after <CooldownOverride>s and <Scalar>s have been applied.
*/
FlatIncrease?: number[];
ChunkEnergyOverride?: number[];
}

export interface StatAbilities {
Expand Down Expand Up @@ -91,8 +89,8 @@ export interface Recovery extends StatAbilities {
}

export interface Resilience extends StatAbilities {
/** Array index represents the Resilience tier. The numbers represent your total HP at each tier. 'Health' is a static 70 HP, the rest are what Bungie calls 'Shields' in-game. If you wish to display them separately, just subtract 70 from the numbers to get your shield HP. */
TotalHP: DescriptionArray;
/** Array index represents the Resilience tier. The numbers represent how much HP your <Shields> have at each tier. <Shields> are the 115 to 130 HP 'right-side portion' of your Total HP alongside <Health>. The amount of <Health> you have depends on the activity: 100 HP in most Crucible playlists (excluding Momentum Control and Mayhem) and 70 HP everywhere else. */
ShieldHP: DescriptionArray;
/** Array index represents the Resilience tier. The numbers represent the percentage damage resistance granted IN PVE at each tier. */
PvEDamageResistance: DescriptionArray;
/** Array index represents the Resilience tier. The numbers represent the percentage flinch resistance granted at each tier. */
Expand Down
2 changes: 1 addition & 1 deletion src/app/clarity/descriptions/loadDescriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const urls = {
statsVersion: `${CLARITY_BASE}Character-Stats/update.json`,
} as const;

const CLARITY_STATS_SUPPORTED_SCHEMA = '1.8';
const CLARITY_STATS_SUPPORTED_SCHEMA = '1.9';

const fetchClarity = async <T>(type: keyof typeof urls, version?: string) => {
const url = urls[type];
Expand Down
14 changes: 6 additions & 8 deletions src/app/store-stats/ClarityCharacterStat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ export default function ClarityCharacterStat({
if (scalar) {
cooldowns = cooldowns.map((v) => scalar * v);
}
const flatIncrease = o.FlatIncrease?.[abilityIndex];
if (flatIncrease) {
cooldowns = cooldowns.map((v) => v + flatIncrease);
}
overrides.push(defs.InventoryItem.get(o.Hash));
}
}
Expand Down Expand Up @@ -137,12 +133,14 @@ export default function ClarityCharacterStat({
unit={t('Stats.MetersPerSecond')}
/>,
);
} else if ('TotalHP' in clarityStatData) {
} else if ('ShieldHP' in clarityStatData) {
intrinsicCooldowns.push(
<StatTableRow
key="TotalHP"
name={t('Stats.TotalHP')}
cooldowns={clarityStatData.TotalHP.Array}
key="ShieldHP"
// t('Stats.TotalHP')
// keep this around maybe?
name={t('Stats.ShieldHP')}
cooldowns={clarityStatData.ShieldHP.Array}
tier={tier}
unit={t('Stats.HP')}
/>,
Expand Down
1 change: 1 addition & 0 deletions src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,7 @@
"PowerModifier": "Power granted by seasonal experience progression",
"Prestige": "Prestige Level: {{level}}\n{{exp}}xp until 5 motes of light.",
"Quality": "Stats quality",
"ShieldHP": "Shield HP",
"StrafingSpeed": "Strafing",
"Strength": "Strength",
"Sunset": "Sunset",
Expand Down

0 comments on commit 41a99f7

Please sign in to comment.