-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WoW] Add support for Character Statistics APIs
- Loading branch information
Showing
5 changed files
with
113 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@blizzard-api/wow': minor | ||
--- | ||
|
||
Add support for Character Statistics APIs |
20 changes: 20 additions & 0 deletions
20
packages/wow/src/character-statistics/character-statistics.test.ts
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,20 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { characterStatisticsSummary } from './character-statistics'; | ||
|
||
describe('characterStatisticsSummary', () => { | ||
it('should return the correct protected resource object', () => { | ||
const realmSlug = 'test-realm'; | ||
const characterName = 'test-character'; | ||
const token = 'test-token'; | ||
|
||
const expectedResource = { | ||
namespace: 'profile', | ||
path: `/profile/wow/character/${realmSlug}/${characterName}/statistics`, | ||
token, | ||
}; | ||
|
||
const result = characterStatisticsSummary(realmSlug, characterName, token); | ||
|
||
expect(result).toEqual(expectedResource); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/wow/src/character-statistics/character-statistics.ts
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,14 @@ | ||
import type { ProtectedResource } from '@blizzard-api/core'; | ||
import type { CharacterStatisticsSummaryResponse } from './types'; | ||
|
||
export function characterStatisticsSummary( | ||
realmSlug: string, | ||
characterName: string, | ||
token: string, | ||
): ProtectedResource<CharacterStatisticsSummaryResponse> { | ||
return { | ||
namespace: 'profile', | ||
path: `/profile/wow/character/${realmSlug}/${characterName}/statistics`, | ||
token, | ||
}; | ||
} |
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,68 @@ | ||
import type { NameIdKey, ResponseBase } from '../base'; | ||
|
||
export interface CharacterStatisticsSummaryResponse extends ResponseBase { | ||
agility: BaseEffectiveStat; | ||
armor: BaseEffectiveStat; | ||
attack_power: number; | ||
avoidance: Rating; | ||
block: RatingWithValue; | ||
bonus_armor: number; | ||
character: Character; | ||
dodge: RatingWithValue; | ||
health: number; | ||
intellect: BaseEffectiveStat; | ||
lifesteal: RatingWithValue; | ||
main_hand_damage_max: number; | ||
main_hand_damage_min: number; | ||
main_hand_dps: number; | ||
main_hand_speed: number; | ||
mana_regen: number; | ||
mana_regen_combat: number; | ||
mastery: RatingWithValue; | ||
melee_crit: RatingWithValue; | ||
melee_haste: RatingWithValue; | ||
off_hand_damage_max: number; | ||
off_hand_damage_min: number; | ||
off_hand_dps: number; | ||
off_hand_speed: number; | ||
parry: RatingWithValue; | ||
power: number; | ||
power_type: Character; | ||
ranged_crit: RatingWithValue; | ||
ranged_haste: RatingWithValue; | ||
speed: Rating; | ||
spell_crit: RatingWithValue; | ||
spell_haste: RatingWithValue; | ||
spell_penetration: number; | ||
spell_power: number; | ||
stamina: BaseEffectiveStat; | ||
strength: BaseEffectiveStat; | ||
versatility: number; | ||
versatility_damage_done_bonus: number; | ||
versatility_damage_taken_bonus: number; | ||
versatility_healing_done_bonus: number; | ||
} | ||
|
||
interface BaseEffectiveStat { | ||
base: number; | ||
effective: number; | ||
} | ||
|
||
interface Rating { | ||
rating: number; | ||
rating_bonus: number; | ||
} | ||
|
||
interface RatingWithValue { | ||
rating: number; | ||
rating_bonus: number; | ||
value: number; | ||
} | ||
|
||
interface Realm extends NameIdKey { | ||
slug: string; | ||
} | ||
|
||
interface Character extends NameIdKey { | ||
realm: Realm; | ||
} |
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