@@ -6,71 +6,148 @@ import (
66)
77
88type Statistics struct {
9- Health int64 `json:"health"`
10- Power int64 `json:"power"`
9+ SpellCrit struct {
10+ Rating float64 `json:"rating"`
11+ RatingBonus float64 `json:"rating_bonus"`
12+ Value float64 `json:"value"`
13+ } `json:"spell_crit"`
14+ ManaRegenCombat float64 `json:"mana_regen_combat"`
15+ Power float64 `json:"power"`
16+ VersatilityDamageDoneBonus float64 `json:"versatility_damage_done_bonus"`
17+ MainHandDps float64 `json:"main_hand_dps"`
18+ OffHandDps float64 `json:"off_hand_dps"`
19+ Block struct {
20+ Rating float64 `json:"rating"`
21+ RatingBonus float64 `json:"rating_bonus"`
22+ Value float64 `json:"value"`
23+ } `json:"block"`
24+ RangedHaste struct {
25+ Rating float64 `json:"rating"`
26+ RatingBonus float64 `json:"rating_bonus"`
27+ Value float64 `json:"value"`
28+ } `json:"ranged_haste"`
1129 PowerType struct {
12- Name string `json:"name"`
13- Id int64 `json:"id"`
30+ Key struct {
31+ Href string `json:"href"`
32+ } `json:"key"`
33+ Name string `json:"name"`
34+ Id float64 `json:"id"`
1435 } `json:"power_type"`
15- Speed float64 `json:"speed"`
16- Strength PrimaryStat `json:"strength"`
17- Agility PrimaryStat `json:"agility"`
18- Intellect PrimaryStat `json:"intellect"`
19- Stamina PrimaryStat `json:"stamina"`
20- MeleeCrit Rating `json:"melee_crit"`
21- MeleeHaste Rating `json:"melee_haste"`
22- Mastery Rating `json:"mastery"`
23- BonusArmor float64 `json:"bonus_armor"`
24- Lifesteal Rating `json:"lifesteal"`
25- Versatility int64 `json:"versatility"`
26- VersatilityDamageDoneBonus float64 `json:"versatility_damage_done_bonus"`
27- VersatilityHealingDoneBonus float64 `json:"versatility_healing_done_bonus"`
28- VersatilityDamageTakenBonus float64 `json:"versatility_damage_taken_bonus"`
29- Avoidance Rating `json:"avoidance"`
30- AttackPower int64 `json:"attack_power"`
31- MainHandDamageMin float64 `json:"main_hand_damage_min"`
32- MainHandDamageMax float64 `json:"main_hand_damage_max"`
33- MainHandSpeed float64 `json:"main_hand_speed"`
34- MainHandDps float64 `json:"main_hand_dps"`
35- OffHandDamageMin float64 `json:"off_hand_damage_min"`
36- OffHandDamageMax float64 `json:"off_hand_damage_max"`
37- OffHandSpeed float64 `json:"off_hand_speed"`
38- OffHandDps float64 `json:"off_hand_dps"`
39- SpellPower int64 `json:"spell_power"`
40- SpellPenetration int64 `json:"spell_penetration"`
41- SpellCrit Rating `json:"spell_crit"`
42- ManaRegen float64 `json:"mana_regen"`
43- ManaRegenCombat float64 `json:"mana_regen_combat"`
44- Armor PrimaryStat `json:"armor"`
45- Dodge Rating `json:"dodge"`
46- Parry Rating `json:"parry"`
47- Block Rating `json:"block"`
48- RangedCrit Rating `json:"ranged_crit"`
49- RangedHaste Rating `json:"ranged_haste"`
50- SpellHaste Rating `json:"spell_haste"`
36+ Lifesteal struct {
37+ Rating float64 `json:"rating"`
38+ RatingBonus float64 `json:"rating_bonus"`
39+ Value float64 `json:"value"`
40+ } `json:"lifesteal"`
41+ VersatilityHealingDoneBonus float64 `json:"versatility_healing_done_bonus"`
42+ MainHandDamageMax float64 `json:"main_hand_damage_max"`
43+ Avoidance struct {
44+ Rating float64 `json:"rating"`
45+ RatingBonus float64 `json:"rating_bonus"`
46+ } `json:"avoidance"`
47+ ManaRegen float64 `json:"mana_regen"`
48+ Health float64 `json:"health"`
49+ Strength struct {
50+ Base float64 `json:"base"`
51+ Effective float64 `json:"effective"`
52+ } `json:"strength"`
53+ Intellect struct {
54+ Base float64 `json:"base"`
55+ Effective float64 `json:"effective"`
56+ } `json:"intellect"`
57+ VersatilityDamageTakenBonus float64 `json:"versatility_damage_taken_bonus"`
58+ Dodge struct {
59+ Rating float64 `json:"rating"`
60+ RatingBonus float64 `json:"rating_bonus"`
61+ Value float64 `json:"value"`
62+ } `json:"dodge"`
63+ Speed struct {
64+ RatingBonus float64 `json:"rating_bonus"`
65+ Rating float64 `json:"rating"`
66+ } `json:"speed"`
67+ MeleeCrit struct {
68+ Rating float64 `json:"rating"`
69+ RatingBonus float64 `json:"rating_bonus"`
70+ Value float64 `json:"value"`
71+ } `json:"melee_crit"`
72+ MainHandSpeed float64 `json:"main_hand_speed"`
73+ OffHandDamageMin float64 `json:"off_hand_damage_min"`
74+ OffHandSpeed float64 `json:"off_hand_speed"`
75+ SpellPower float64 `json:"spell_power"`
76+ RangedCrit struct {
77+ Rating float64 `json:"rating"`
78+ RatingBonus float64 `json:"rating_bonus"`
79+ Value float64 `json:"value"`
80+ } `json:"ranged_crit"`
81+ MainHandDamageMin float64 `json:"main_hand_damage_min"`
82+ OffHandDamageMax float64 `json:"off_hand_damage_max"`
83+ SpellPenetration float64 `json:"spell_penetration"`
84+ Parry struct {
85+ Rating float64 `json:"rating"`
86+ RatingBonus float64 `json:"rating_bonus"`
87+ Value float64 `json:"value"`
88+ } `json:"parry"`
89+ MeleeHaste struct {
90+ Rating float64 `json:"rating"`
91+ RatingBonus float64 `json:"rating_bonus"`
92+ Value float64 `json:"value"`
93+ } `json:"melee_haste"`
94+ Mastery struct {
95+ Rating float64 `json:"rating"`
96+ RatingBonus float64 `json:"rating_bonus"`
97+ Value float64 `json:"value"`
98+ } `json:"mastery"`
99+ BonusArmor float64 `json:"bonus_armor"`
100+ AttackPower float64 `json:"attack_power"`
101+ Character struct {
102+ Key struct {
103+ Href string `json:"href"`
104+ } `json:"key"`
105+ Name string `json:"name"`
106+ Id float64 `json:"id"`
107+ Realm struct {
108+ Slug string `json:"slug"`
109+ Key struct {
110+ Href string `json:"href"`
111+ } `json:"key"`
112+ Name string `json:"name"`
113+ Id float64 `json:"id"`
114+ } `json:"realm"`
115+ } `json:"character"`
116+ Agility struct {
117+ Base float64 `json:"base"`
118+ Effective float64 `json:"effective"`
119+ } `json:"agility"`
120+ SpellHaste struct {
121+ Value float64 `json:"value"`
122+ Rating float64 `json:"rating"`
123+ RatingBonus float64 `json:"rating_bonus"`
124+ } `json:"spell_haste"`
125+ Links struct {
126+ Self struct {
127+ Href string `json:"href"`
128+ } `json:"self"`
129+ } `json:"_links"`
130+ Stamina struct {
131+ Base float64 `json:"base"`
132+ Effective float64 `json:"effective"`
133+ } `json:"stamina"`
134+ Versatility float64 `json:"versatility"`
135+ Armor struct {
136+ Base float64 `json:"base"`
137+ Effective float64 `json:"effective"`
138+ } `json:"armor"`
51139}
52140
53- type PrimaryStat struct {
54- Base int64 `json:"base"`
55- Effective int64 `json:"effective"`
56- }
57-
58- type Rating struct {
59- Rating int `json:"rating"`
60- RatingBonus float64 `json:"rating_bonus"`
61- Value float64 `json:"value"`
62- }
63-
64- func (req RequestFunc ) CharacterStats (realm string , name string ) (stats interface {}, err error ) {
141+ func (req RequestFunc ) CharacterStatistics (realm string , name string ) (s Statistics , err error ) {
65142 url := fmt .Sprintf ("/profile/wow/character/%s/%s/statistics" , realm , name )
66143 body , err := req (url )
67144 if err != nil {
68- return nil , err
145+ return
69146 }
70147
71- err = json .Unmarshal (body , & stats )
148+ err = json .Unmarshal (body , & s )
72149 if err != nil {
73- return nil , err
150+ return
74151 }
75- return stats , nil
152+ return
76153}
0 commit comments