Skip to main content

wowlab_types/
constants.rs

1//! Shared numeric constants used across the workspace.
2
3use crate::game::RaceId;
4
5/// Percentage conversion, rounding denominators, etc.
6///
7/// This is a general arithmetic denominator.
8/// Protobuf resource scaling has a separate wire-format meaning despite using the same value.
9pub const HUNDRED: f64 = 100.0;
10
11/// Maximum player level supported by the current game-data release.
12pub const MAX_PLAYER_LEVEL: u16 = 80;
13
14/// Current `WoW` expansion identifier.
15pub const CURRENT_EXPANSION_ID: u32 = 11;
16
17/// Default GCD duration in milliseconds.
18pub const DEFAULT_GCD_MS: u32 = 1500;
19
20/// Minimum GCD duration in milliseconds.
21pub const GCD_FLOOR_MS: u32 = 750;
22
23/// Default GCD duration in milliseconds (i32 for DBC field compatibility).
24pub const DEFAULT_GCD_MS_I32: i32 = 1500;
25
26/// Default simulation duration in seconds.
27pub const DEFAULT_DURATION_S: f64 = 300.0;
28
29/// Default wait-until poll interval in seconds.
30pub const WAIT_UNTIL_POLL_SECS: f32 = 0.1;
31
32/// Default icon filename for unknown/missing icons.
33pub const DEFAULT_ICON_FILENAME: &str = "inv_misc_questionmark";
34
35/// Tempered Potion buff spell.
36pub const TEMPERED_POTION_SPELL_ID: u32 = 431_932;
37
38/// Flask of Alchemical Chaos buff spell.
39pub const FLASK_ALCHEMICAL_CHAOS_SPELL_ID: u32 = 432_021;
40
41/// Crystallized augment rune buff spell.
42pub const AUGMENT_RUNE_SPELL_ID: u32 = 453_250;
43
44/// Ordered augment-rune name fragments and their buff spells.
45///
46/// Consumers use the first fragment contained in the normalized setting name.
47pub const AUGMENT_RUNE_SPELL_IDS: &[(&str, u32)] = &[
48    ("defiled", 224_001),
49    ("focus", 175_457),
50    ("hyper", 175_456),
51    ("stout", 175_439),
52    ("battle_scarred", 270_058),
53    ("veiled", 347_901),
54    ("draconic", 393_438),
55    ("dreambound", 393_438),
56    ("crystallized", 453_250),
57    ("void_touched", 1_264_426),
58];
59
60/// Spell containing the primary-stat food coefficient.
61pub const FOOD_PRIMARY_STAT_COEFFICIENT_SPELL_ID: u32 = 1_219_179;
62
63/// Effect index containing the primary-stat food coefficient.
64pub const FOOD_PRIMARY_STAT_COEFFICIENT_EFFECT_INDEX: u8 = 2;
65
66/// Ordered primary-stat food use spells and their resulting buff spells.
67pub const PRIMARY_FOOD_BUFF_SPELL_IDS: &[(u32, u32)] = &[
68    (1_259_658, 1_232_582), // Harandar Celebration
69    (1_259_659, 1_232_585), // Silvermoon Parade
70    (1_232_917, 1_232_584), // [Impossibly] Royal Roast
71];
72
73/// Bloodlust raid-buff spell.
74pub const BLOODLUST_SPELL_ID: u32 = 2_825;
75
76/// Orc Blood Fury spell.
77pub const BLOOD_FURY_SPELL_ID: u32 = 20_572;
78
79/// Troll Berserking spell.
80pub const BERSERKING_SPELL_ID: u32 = 26_297;
81
82/// Mag'har Orc Ancestral Call spell.
83pub const ANCESTRAL_CALL_SPELL_ID: u32 = 274_738;
84
85/// Ordered race-to-modeled-on-use-racial spell IDs.
86pub const RACIAL_ON_USE_SPELL_IDS: &[(RaceId, u32)] = &[
87    (RaceId::Orc, BLOOD_FURY_SPELL_ID),
88    (RaceId::Troll, BERSERKING_SPELL_ID),
89    (RaceId::MagharOrc, ANCESTRAL_CALL_SPELL_ID),
90];
91
92/// Powerful Eversong Diamond passive item-effect spell.
93pub const POWERFUL_EVERSONG_DIAMOND_SPELL_ID: u32 = 1_258_209;
94
95/// Default `WoW` patch version used for game-data queries when `WOWLAB_PATCH` is unset.
96pub const DEFAULT_WOW_PATCH: &str = "11.1.0";
97
98/// HTTP request timeout in seconds.
99pub const HTTP_REQUEST_TIMEOUT_SECS: u64 = 30;
100
101/// HTTP connect timeout in seconds.
102pub const HTTP_CONNECT_TIMEOUT_SECS: u64 = 10;
103
104/// Maximum number of retry attempts for fallible operations.
105pub const MAX_RETRY_ATTEMPTS: u32 = 3;
106
107/// Maximum length of JSON error preview strings.
108pub const JSON_ERROR_PREVIEW_LEN: usize = 1024;
109
110/// Exponential backoff multiplier.
111pub const BACKOFF_MULTIPLIER: f64 = 2.0;
112
113/// Percentage conversion (u32 for integer math).
114pub const HUNDRED_U32: u32 = 100;
115
116/// Percentage conversion (u64 for integer math).
117pub const HUNDRED_U64: u64 = 100;
118
119/// Generic one-thousand scalar for non-time arithmetic.
120pub const THOUSAND: f64 = 1_000.0;
121
122/// High-precision scaling (e.g. CI bounds).
123pub const TEN_THOUSAND: f64 = 10_000.0;
124
125/// Microsecond conversion, large-scale factors.
126pub const ONE_MILLION: f64 = 1_000_000.0;
127
128/// Milliseconds per second (f64).
129pub const MS_PER_SECOND: f64 = 1_000.0;
130
131/// Milliseconds per second (u64).
132pub const MS_PER_SECOND_U64: u64 = 1_000;
133
134/// Seconds per minute (f64).
135pub const SECONDS_PER_MINUTE: f64 = 60.0;
136
137/// Seconds per minute (u64).
138pub const SECONDS_PER_MINUTE_U64: u64 = 60;
139
140/// Seconds per hour (u64).
141pub const SECONDS_PER_HOUR: u64 = 3_600;
142
143/// Seconds per day (u64).
144pub const SECONDS_PER_DAY: u64 = 86_400;
145
146/// Milliseconds per minute (f64).
147pub const MS_PER_MINUTE: f64 = 60_000.0;
148
149/// Milliseconds per hour (f64).
150pub const MS_PER_HOUR: f64 = 3_600_000.0;
151
152/// Bytes per kilobyte (f64).
153pub const BYTES_PER_KB: f64 = 1_024.0;
154
155/// Bytes per megabyte (f64).
156pub const BYTES_PER_MB: f64 = 1_048_576.0;
157
158/// Bytes per kilobyte (usize).
159pub const BYTES_PER_KB_USIZE: usize = 1_024;
160
161/// Bytes per megabyte (usize).
162pub const BYTES_PER_MB_USIZE: usize = 1_048_576;
163
164/// DPS values are stored as `(value * 10)` in protobuf for one decimal place.
165pub const PROTO_DPS_SCALE: f64 = 10.0;
166
167/// Resource/percentage values use a wire-format scale of two decimal places.
168///
169/// This is a protobuf encoding contract.
170/// General percentage arithmetic uses [`HUNDRED`] despite both having the same value.
171pub const PROTO_RESOURCE_SCALE: f64 = 100.0;
172
173/// Quantile fraction for p01 (1st percentile).
174pub const QUANTILE_P01: f64 = 0.01;
175
176/// Quantile fraction for p05 (5th percentile).
177pub const QUANTILE_P05: f64 = 0.05;
178
179/// Quantile fraction for p10 (10th percentile).
180pub const QUANTILE_P10: f64 = 0.10;
181
182/// Quantile fraction for p25 (25th percentile).
183pub const QUANTILE_P25: f64 = 0.25;
184
185/// Quantile fraction for p50 (50th percentile / median).
186pub const QUANTILE_P50: f64 = 0.50;
187
188/// Quantile fraction for p75 (75th percentile).
189pub const QUANTILE_P75: f64 = 0.75;
190
191/// Quantile fraction for p90 (90th percentile).
192pub const QUANTILE_P90: f64 = 0.90;
193
194/// Quantile fraction for p95 (95th percentile).
195pub const QUANTILE_P95: f64 = 0.95;
196
197/// Quantile fraction for p99 (99th percentile).
198pub const QUANTILE_P99: f64 = 0.99;