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