@wise-old-man/utils 2.0.0-beta.5 → 2.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +272 -292
  2. package/dist/index.js +24 -11
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -459,20 +459,20 @@ declare const Skill: {
459
459
  };
460
460
  declare type Skill = typeof Skill[keyof typeof Skill];
461
461
  declare const Activity: {
462
- LEAGUE_POINTS: string;
463
- BOUNTY_HUNTER_HUNTER: string;
464
- BOUNTY_HUNTER_ROGUE: string;
465
- CLUE_SCROLLS_ALL: string;
466
- CLUE_SCROLLS_BEGINNER: string;
467
- CLUE_SCROLLS_EASY: string;
468
- CLUE_SCROLLS_MEDIUM: string;
469
- CLUE_SCROLLS_HARD: string;
470
- CLUE_SCROLLS_ELITE: string;
471
- CLUE_SCROLLS_MASTER: string;
472
- LAST_MAN_STANDING: string;
473
- PVP_ARENA: string;
474
- SOUL_WARS_ZEAL: string;
475
- GUARDIANS_OF_THE_RIFT: string;
462
+ readonly LEAGUE_POINTS: "league_points";
463
+ readonly BOUNTY_HUNTER_HUNTER: "bounty_hunter_hunter";
464
+ readonly BOUNTY_HUNTER_ROGUE: "bounty_hunter_rogue";
465
+ readonly CLUE_SCROLLS_ALL: "clue_scrolls_all";
466
+ readonly CLUE_SCROLLS_BEGINNER: "clue_scrolls_beginner";
467
+ readonly CLUE_SCROLLS_EASY: "clue_scrolls_easy";
468
+ readonly CLUE_SCROLLS_MEDIUM: "clue_scrolls_medium";
469
+ readonly CLUE_SCROLLS_HARD: "clue_scrolls_hard";
470
+ readonly CLUE_SCROLLS_ELITE: "clue_scrolls_elite";
471
+ readonly CLUE_SCROLLS_MASTER: "clue_scrolls_master";
472
+ readonly LAST_MAN_STANDING: "last_man_standing";
473
+ readonly PVP_ARENA: "pvp_arena";
474
+ readonly SOUL_WARS_ZEAL: "soul_wars_zeal";
475
+ readonly GUARDIANS_OF_THE_RIFT: "guardians_of_the_rift";
476
476
  };
477
477
  declare type Activity = typeof Activity[keyof typeof Activity];
478
478
  declare const Boss: {
@@ -586,20 +586,20 @@ declare const Metric: {
586
586
  readonly WINTERTODT: "wintertodt";
587
587
  readonly ZALCANO: "zalcano";
588
588
  readonly ZULRAH: "zulrah";
589
- readonly LEAGUE_POINTS: string;
590
- readonly BOUNTY_HUNTER_HUNTER: string;
591
- readonly BOUNTY_HUNTER_ROGUE: string;
592
- readonly CLUE_SCROLLS_ALL: string;
593
- readonly CLUE_SCROLLS_BEGINNER: string;
594
- readonly CLUE_SCROLLS_EASY: string;
595
- readonly CLUE_SCROLLS_MEDIUM: string;
596
- readonly CLUE_SCROLLS_HARD: string;
597
- readonly CLUE_SCROLLS_ELITE: string;
598
- readonly CLUE_SCROLLS_MASTER: string;
599
- readonly LAST_MAN_STANDING: string;
600
- readonly PVP_ARENA: string;
601
- readonly SOUL_WARS_ZEAL: string;
602
- readonly GUARDIANS_OF_THE_RIFT: string;
589
+ readonly LEAGUE_POINTS: "league_points";
590
+ readonly BOUNTY_HUNTER_HUNTER: "bounty_hunter_hunter";
591
+ readonly BOUNTY_HUNTER_ROGUE: "bounty_hunter_rogue";
592
+ readonly CLUE_SCROLLS_ALL: "clue_scrolls_all";
593
+ readonly CLUE_SCROLLS_BEGINNER: "clue_scrolls_beginner";
594
+ readonly CLUE_SCROLLS_EASY: "clue_scrolls_easy";
595
+ readonly CLUE_SCROLLS_MEDIUM: "clue_scrolls_medium";
596
+ readonly CLUE_SCROLLS_HARD: "clue_scrolls_hard";
597
+ readonly CLUE_SCROLLS_ELITE: "clue_scrolls_elite";
598
+ readonly CLUE_SCROLLS_MASTER: "clue_scrolls_master";
599
+ readonly LAST_MAN_STANDING: "last_man_standing";
600
+ readonly PVP_ARENA: "pvp_arena";
601
+ readonly SOUL_WARS_ZEAL: "soul_wars_zeal";
602
+ readonly GUARDIANS_OF_THE_RIFT: "guardians_of_the_rift";
603
603
  readonly OVERALL: "overall";
604
604
  readonly ATTACK: "attack";
605
605
  readonly DEFENCE: "defence";
@@ -1187,233 +1187,6 @@ declare const Country: {
1187
1187
  };
1188
1188
  declare type Country = typeof Country[keyof typeof Country];
1189
1189
 
1190
- declare enum CompetitionStatus {
1191
- UPCOMING = "upcoming",
1192
- ONGOING = "ongoing",
1193
- FINISHED = "finished"
1194
- }
1195
- declare type CompetitionStatusPropsMap = {
1196
- [status in CompetitionStatus]: {
1197
- name: string;
1198
- };
1199
- };
1200
- declare type CompetitionTypePropsMap = {
1201
- [type in CompetitionType]: {
1202
- name: string;
1203
- };
1204
- };
1205
- declare const CompetitionTypeProps: CompetitionTypePropsMap;
1206
- declare const CompetitionStatusProps: CompetitionStatusPropsMap;
1207
- declare const COMPETITION_TYPES: ("classic" | "team")[];
1208
- declare const COMPETITION_STATUSES: CompetitionStatus[];
1209
- declare function isCompetitionType(typeString: string): typeString is CompetitionType;
1210
- declare function isCompetitionStatus(statusString: string): statusString is CompetitionStatus;
1211
-
1212
- interface CountryDetails {
1213
- code: Country;
1214
- name: string;
1215
- }
1216
- declare type CountryPropsMap = {
1217
- [c in Country]: CountryDetails;
1218
- };
1219
- declare const CountryProps: CountryPropsMap;
1220
- declare const COUNTRY_CODES: ("AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW")[];
1221
- declare function isCountry(countryCodeString: string): countryCodeString is Country;
1222
- declare function findCountry(countryIdentifier: string): CountryDetails | undefined;
1223
- declare function findCountryByName(countryName: string): CountryDetails | undefined;
1224
- declare function findCountryByCode(countryCode: string): CountryDetails | undefined;
1225
-
1226
- declare const MAX_LEVEL = 99;
1227
- declare const MAX_VIRTUAL_LEVEL = 126;
1228
- declare const MAX_SKILL_EXP = 200000000;
1229
- declare const SKILL_EXP_AT_99 = 13034431;
1230
- declare const CAPPED_MAX_TOTAL_XP: number;
1231
- declare function getExpForLevel(level: number): number;
1232
- declare function getLevel(exp: number, virtual?: boolean): number;
1233
- declare function getCombatLevel(attack: number, strength: number, defence: number, ranged: number, magic: number, hitpoints: number, prayer: number): number;
1234
-
1235
- declare const GROUP_ROLES: ("magic" | "slayer" | "hunter" | "achiever" | "adamant" | "adept" | "administrator" | "admiral" | "adventurer" | "air" | "anchor" | "apothecary" | "archer" | "armadylean" | "artillery" | "artisan" | "asgarnian" | "assassin" | "assistant" | "astral" | "athlete" | "attacker" | "bandit" | "bandosian" | "barbarian" | "battlemage" | "beast" | "berserker" | "blisterwood" | "blood" | "blue" | "bob" | "body" | "brassican" | "brawler" | "brigadier" | "brigand" | "bronze" | "bruiser" | "bulwark" | "burglar" | "burnt" | "cadet" | "captain" | "carry" | "champion" | "chaos" | "cleric" | "collector" | "colonel" | "commander" | "competitor" | "completionist" | "constructor" | "cook" | "coordinator" | "corporal" | "cosmic" | "councillor" | "crafter" | "crew" | "crusader" | "cutpurse" | "death" | "defender" | "defiler" | "deputy_owner" | "destroyer" | "diamond" | "diseased" | "doctor" | "dogsbody" | "dragon" | "dragonstone" | "druid" | "duellist" | "earth" | "elite" | "emerald" | "enforcer" | "epic" | "executive" | "expert" | "explorer" | "farmer" | "feeder" | "fighter" | "fire" | "firemaker" | "firestarter" | "fisher" | "fletcher" | "forager" | "fremennik" | "gamer" | "gatherer" | "general" | "gnome_child" | "gnome_elder" | "goblin" | "gold" | "goon" | "green" | "grey" | "guardian" | "guthixian" | "harpoon" | "healer" | "hellcat" | "helper" | "herbologist" | "hero" | "holy" | "hoarder" | "ignitor" | "illusionist" | "imp" | "infantry" | "inquisitor" | "iron" | "jade" | "justiciar" | "kandarin" | "karamjan" | "kharidian" | "kitten" | "knight" | "labourer" | "law" | "leader" | "learner" | "legacy" | "legend" | "legionnaire" | "lieutenant" | "looter" | "lumberjack" | "magician" | "major" | "maple" | "marshal" | "master" | "maxed" | "mediator" | "medic" | "mentor" | "member" | "merchant" | "mind" | "miner" | "minion" | "misthalinian" | "mithril" | "moderator" | "monarch" | "morytanian" | "mystic" | "myth" | "natural" | "nature" | "necromancer" | "ninja" | "noble" | "novice" | "nurse" | "oak" | "officer" | "onyx" | "opal" | "oracle" | "orange" | "owner" | "page" | "paladin" | "pawn" | "pilgrim" | "pine" | "pink" | "prefect" | "priest" | "private" | "prodigy" | "proselyte" | "prospector" | "protector" | "pure" | "purple" | "pyromancer" | "quester" | "racer" | "raider" | "ranger" | "record_chaser" | "recruit" | "recruiter" | "red_topaz" | "red" | "rogue" | "ruby" | "rune" | "runecrafter" | "sage" | "sapphire" | "saradominist" | "saviour" | "scavenger" | "scholar" | "scourge" | "scout" | "scribe" | "seer" | "senator" | "sentry" | "serenist" | "sergeant" | "shaman" | "sheriff" | "short_green_guy" | "skiller" | "skulled" | "smiter" | "smith" | "smuggler" | "sniper" | "soul" | "specialist" | "speed_runner" | "spellcaster" | "squire" | "staff" | "steel" | "strider" | "striker" | "summoner" | "superior" | "supervisor" | "teacher" | "templar" | "therapist" | "thief" | "tirannian" | "trialist" | "trickster" | "tzkal" | "tztok" | "unholy" | "vagrant" | "vanguard" | "walker" | "wanderer" | "warden" | "warlock" | "warrior" | "water" | "wild" | "willow" | "wily" | "wintumber" | "witch" | "wizard" | "worker" | "wrath" | "xerician" | "yellow" | "yew" | "zamorakian" | "zarosian" | "zealot" | "zenyte")[];
1236
- declare const PRIVELEGED_GROUP_ROLES: GroupRole[];
1237
- declare type GroupRolePropsMap = {
1238
- [role in GroupRole]: {
1239
- name: string;
1240
- isPriveleged: boolean;
1241
- };
1242
- };
1243
- declare const GroupRoleProps: GroupRolePropsMap;
1244
- declare function findGroupRole(roleName: string): GroupRole | null;
1245
- declare function isGroupRole(roleString: string): roleString is GroupRole;
1246
-
1247
- declare enum MetricType {
1248
- SKILL = "skill",
1249
- BOSS = "boss",
1250
- ACTIVITY = "activity",
1251
- COMPUTED = "computed"
1252
- }
1253
- declare enum MetricMeasure {
1254
- EXPERIENCE = "experience",
1255
- KILLS = "kills",
1256
- SCORE = "score",
1257
- VALUE = "value"
1258
- }
1259
- interface SkillProperties {
1260
- name: string;
1261
- isCombat: boolean;
1262
- isMembers: boolean;
1263
- type: MetricType;
1264
- measure: MetricMeasure;
1265
- }
1266
- interface BossProperties {
1267
- name: string;
1268
- minimumKc: number;
1269
- isMembers: boolean;
1270
- type: MetricType;
1271
- measure: MetricMeasure;
1272
- }
1273
- interface ComputedMetricProperties {
1274
- name: string;
1275
- type: MetricType;
1276
- measure: MetricMeasure;
1277
- }
1278
- declare const MetricProps: {
1279
- ehp: ComputedMetricProperties;
1280
- ehb: ComputedMetricProperties;
1281
- abyssal_sire: BossProperties;
1282
- alchemical_hydra: BossProperties;
1283
- barrows_chests: BossProperties;
1284
- bryophyta: BossProperties;
1285
- callisto: BossProperties;
1286
- cerberus: BossProperties;
1287
- chambers_of_xeric: BossProperties;
1288
- chambers_of_xeric_challenge_mode: BossProperties;
1289
- chaos_elemental: BossProperties;
1290
- chaos_fanatic: BossProperties;
1291
- commander_zilyana: BossProperties;
1292
- corporeal_beast: BossProperties;
1293
- crazy_archaeologist: BossProperties;
1294
- dagannoth_prime: BossProperties;
1295
- dagannoth_rex: BossProperties;
1296
- dagannoth_supreme: BossProperties;
1297
- deranged_archaeologist: BossProperties;
1298
- general_graardor: BossProperties;
1299
- giant_mole: BossProperties;
1300
- grotesque_guardians: BossProperties;
1301
- hespori: BossProperties;
1302
- kalphite_queen: BossProperties;
1303
- king_black_dragon: BossProperties;
1304
- kraken: BossProperties;
1305
- kreearra: BossProperties;
1306
- kril_tsutsaroth: BossProperties;
1307
- mimic: BossProperties;
1308
- nex: BossProperties;
1309
- nightmare: BossProperties;
1310
- phosanis_nightmare: BossProperties;
1311
- obor: BossProperties;
1312
- sarachnis: BossProperties;
1313
- scorpia: BossProperties;
1314
- skotizo: BossProperties;
1315
- tempoross: BossProperties;
1316
- the_gauntlet: BossProperties;
1317
- the_corrupted_gauntlet: BossProperties;
1318
- theatre_of_blood: BossProperties;
1319
- theatre_of_blood_hard_mode: BossProperties;
1320
- thermonuclear_smoke_devil: BossProperties;
1321
- tombs_of_amascut: BossProperties;
1322
- tombs_of_amascut_expert: BossProperties;
1323
- tzkal_zuk: BossProperties;
1324
- tztok_jad: BossProperties;
1325
- venenatis: BossProperties;
1326
- vetion: BossProperties;
1327
- vorkath: BossProperties;
1328
- wintertodt: BossProperties;
1329
- zalcano: BossProperties;
1330
- zulrah: BossProperties;
1331
- overall: SkillProperties;
1332
- attack: SkillProperties;
1333
- defence: SkillProperties;
1334
- strength: SkillProperties;
1335
- hitpoints: SkillProperties;
1336
- ranged: SkillProperties;
1337
- prayer: SkillProperties;
1338
- magic: SkillProperties;
1339
- cooking: SkillProperties;
1340
- woodcutting: SkillProperties;
1341
- fletching: SkillProperties;
1342
- fishing: SkillProperties;
1343
- firemaking: SkillProperties;
1344
- crafting: SkillProperties;
1345
- smithing: SkillProperties;
1346
- mining: SkillProperties;
1347
- herblore: SkillProperties;
1348
- agility: SkillProperties;
1349
- thieving: SkillProperties;
1350
- slayer: SkillProperties;
1351
- farming: SkillProperties;
1352
- runecrafting: SkillProperties;
1353
- hunter: SkillProperties;
1354
- construction: SkillProperties;
1355
- };
1356
- declare const METRICS: string[];
1357
- declare const SKILLS: ("overall" | "attack" | "defence" | "strength" | "hitpoints" | "ranged" | "prayer" | "magic" | "cooking" | "woodcutting" | "fletching" | "fishing" | "firemaking" | "crafting" | "smithing" | "mining" | "herblore" | "agility" | "thieving" | "slayer" | "farming" | "runecrafting" | "hunter" | "construction")[];
1358
- declare const BOSSES: ("abyssal_sire" | "alchemical_hydra" | "barrows_chests" | "bryophyta" | "callisto" | "cerberus" | "chambers_of_xeric" | "chambers_of_xeric_challenge_mode" | "chaos_elemental" | "chaos_fanatic" | "commander_zilyana" | "corporeal_beast" | "crazy_archaeologist" | "dagannoth_prime" | "dagannoth_rex" | "dagannoth_supreme" | "deranged_archaeologist" | "general_graardor" | "giant_mole" | "grotesque_guardians" | "hespori" | "kalphite_queen" | "king_black_dragon" | "kraken" | "kreearra" | "kril_tsutsaroth" | "mimic" | "nex" | "nightmare" | "phosanis_nightmare" | "obor" | "sarachnis" | "scorpia" | "skotizo" | "tempoross" | "the_gauntlet" | "the_corrupted_gauntlet" | "theatre_of_blood" | "theatre_of_blood_hard_mode" | "thermonuclear_smoke_devil" | "tombs_of_amascut" | "tombs_of_amascut_expert" | "tzkal_zuk" | "tztok_jad" | "venenatis" | "vetion" | "vorkath" | "wintertodt" | "zalcano" | "zulrah")[];
1359
- declare const ACTIVITIES: string[];
1360
- declare const COMPUTED_METRICS: ("ehp" | "ehb")[];
1361
- declare const REAL_SKILLS: ("overall" | "attack" | "defence" | "strength" | "hitpoints" | "ranged" | "prayer" | "magic" | "cooking" | "woodcutting" | "fletching" | "fishing" | "firemaking" | "crafting" | "smithing" | "mining" | "herblore" | "agility" | "thieving" | "slayer" | "farming" | "runecrafting" | "hunter" | "construction")[];
1362
- declare const F2P_BOSSES: ("abyssal_sire" | "alchemical_hydra" | "barrows_chests" | "bryophyta" | "callisto" | "cerberus" | "chambers_of_xeric" | "chambers_of_xeric_challenge_mode" | "chaos_elemental" | "chaos_fanatic" | "commander_zilyana" | "corporeal_beast" | "crazy_archaeologist" | "dagannoth_prime" | "dagannoth_rex" | "dagannoth_supreme" | "deranged_archaeologist" | "general_graardor" | "giant_mole" | "grotesque_guardians" | "hespori" | "kalphite_queen" | "king_black_dragon" | "kraken" | "kreearra" | "kril_tsutsaroth" | "mimic" | "nex" | "nightmare" | "phosanis_nightmare" | "obor" | "sarachnis" | "scorpia" | "skotizo" | "tempoross" | "the_gauntlet" | "the_corrupted_gauntlet" | "theatre_of_blood" | "theatre_of_blood_hard_mode" | "thermonuclear_smoke_devil" | "tombs_of_amascut" | "tombs_of_amascut_expert" | "tzkal_zuk" | "tztok_jad" | "venenatis" | "vetion" | "vorkath" | "wintertodt" | "zalcano" | "zulrah")[];
1363
- declare const MEMBER_SKILLS: ("overall" | "attack" | "defence" | "strength" | "hitpoints" | "ranged" | "prayer" | "magic" | "cooking" | "woodcutting" | "fletching" | "fishing" | "firemaking" | "crafting" | "smithing" | "mining" | "herblore" | "agility" | "thieving" | "slayer" | "farming" | "runecrafting" | "hunter" | "construction")[];
1364
- declare const COMBAT_SKILLS: ("overall" | "attack" | "defence" | "strength" | "hitpoints" | "ranged" | "prayer" | "magic" | "cooking" | "woodcutting" | "fletching" | "fishing" | "firemaking" | "crafting" | "smithing" | "mining" | "herblore" | "agility" | "thieving" | "slayer" | "farming" | "runecrafting" | "hunter" | "construction")[];
1365
- declare function findMetric(metricName: string): Metric | null;
1366
- declare function isMetric(metricString: string): metricString is Metric;
1367
- declare function isSkill(metric: Metric | string): metric is Skill;
1368
- declare function isActivity(metric: Metric | string): metric is Activity;
1369
- declare function isBoss(metric: Metric | string): metric is Boss;
1370
- declare function isComputedMetric(metric: Metric | string): metric is ComputedMetric;
1371
- declare function getMetricRankKey(metric: Metric): string;
1372
- declare function getMetricValueKey(metric: Metric): string;
1373
- declare function getMetricMeasure(metric: Metric): any;
1374
- declare function getMetricName(metric: Metric): any;
1375
- declare function getMinimumBossKc(metric: Metric): number;
1376
- declare function getParentEfficiencyMetric(metric: Metric): "ehp" | "ehb";
1377
- declare function parseMetricAbbreviation(abbreviation: string): string | null;
1378
-
1379
- declare type PeriodPropsMap = {
1380
- [period in Period]: {
1381
- name: string;
1382
- milliseconds: number;
1383
- };
1384
- };
1385
- declare const PeriodProps: PeriodPropsMap;
1386
- declare const PERIODS: ("five_min" | "day" | "week" | "month" | "year")[];
1387
- declare function findPeriod(periodName: string): Period | null;
1388
- declare function isPeriod(periodString: string): periodString is Period;
1389
- declare function parsePeriodExpression(periodExpression: string): {
1390
- expression: string;
1391
- durationMs: number;
1392
- };
1393
-
1394
- declare type PlayerTypePropsMap = {
1395
- [playerType in PlayerType]: {
1396
- name: string;
1397
- };
1398
- };
1399
- declare type PlayerBuildPropsMap = {
1400
- [playerBuild in PlayerBuild]: {
1401
- name: string;
1402
- };
1403
- };
1404
- declare const PlayerTypeProps: PlayerTypePropsMap;
1405
- declare const PlayerBuildProps: PlayerBuildPropsMap;
1406
- declare const PLAYER_TYPES: ("unknown" | "regular" | "ironman" | "hardcore" | "ultimate")[];
1407
- declare const PLAYER_BUILDS: ("main" | "f2p" | "lvl3" | "zerker" | "def1" | "hp10")[];
1408
- declare function isPlayerType(typeString: string): typeString is PlayerType;
1409
- declare function isPlayerBuild(buildString: string): buildString is PlayerBuild;
1410
- declare function findPlayerType(typeName: string): PlayerType | null;
1411
- declare function findPlayerBuild(buildName: string): PlayerBuild | null;
1412
-
1413
- declare function formatNumber(num: number, withLetters?: boolean): string | -1;
1414
- declare function padNumber(value: number): string;
1415
- declare function round(num: number, cases: number): number;
1416
-
1417
1190
  declare type Achievement = Omit<Prisma_Base_Achievement, 'threshold'> & {
1418
1191
  threshold: number;
1419
1192
  };
@@ -1486,18 +1259,10 @@ interface PlayerDeltasArray {
1486
1259
  computed: Array<ComputedMetricDelta>;
1487
1260
  }
1488
1261
  interface PlayerDeltasMap {
1489
- skills: {
1490
- [skill in Skill]?: SkillDelta;
1491
- };
1492
- bosses: {
1493
- [boss in Boss]?: BossDelta;
1494
- };
1495
- activities: {
1496
- [activity in Activity]?: ActivityDelta;
1497
- };
1498
- computed: {
1499
- [computedMetric in ComputedMetric]?: ComputedMetricDelta;
1500
- };
1262
+ skills: MapOf<Skill, SkillDelta>;
1263
+ bosses: MapOf<Boss, BossDelta>;
1264
+ activities: MapOf<Activity, ActivityDelta>;
1265
+ computed: MapOf<ComputedMetric, ComputedMetricDelta>;
1501
1266
  }
1502
1267
  interface DeltaLeaderboardEntry {
1503
1268
  player: Player;
@@ -1541,18 +1306,10 @@ interface FormattedSnapshot {
1541
1306
  createdAt: Date;
1542
1307
  importedAt: Date | null;
1543
1308
  data: {
1544
- skills: {
1545
- [skill in Skill]?: SkillValue;
1546
- };
1547
- bosses: {
1548
- [boss in Boss]?: BossValue;
1549
- };
1550
- activities: {
1551
- [activity in Activity]?: ActivityValue;
1552
- };
1553
- computed: {
1554
- [computed in ComputedMetric]?: ComputedMetric;
1555
- };
1309
+ skills: MapOf<Skill, SkillValue>;
1310
+ bosses: MapOf<Boss, BossValue>;
1311
+ activities: MapOf<Activity, ActivityValue>;
1312
+ computed: MapOf<ComputedMetric, ComputedMetricValue>;
1556
1313
  };
1557
1314
  }
1558
1315
 
@@ -1646,15 +1403,9 @@ declare type Top5ProgressResult = Array<{
1646
1403
  }>;
1647
1404
  }>;
1648
1405
 
1649
- declare type ExperienceMap = {
1650
- [skill in Skill]?: number;
1651
- };
1652
- declare type KillcountMap = {
1653
- [boss in Boss]?: number;
1654
- };
1655
- declare type EfficiencyMap = {
1656
- [m in Skill | Boss]?: number;
1657
- };
1406
+ declare type ExperienceMap = MapOf<Skill, number>;
1407
+ declare type KillcountMap = MapOf<Boss, number>;
1408
+ declare type EfficiencyMap = ExperienceMap & KillcountMap;
1658
1409
  declare enum BonusType {
1659
1410
  START = 0,
1660
1411
  END = 1
@@ -1699,9 +1450,7 @@ interface EfficiencyAlgorithm {
1699
1450
  calculateSkillEHP(skill: Skill, experienceMap: ExperienceMap): number;
1700
1451
  calculateBossEHB(boss: Boss, killcountMap: KillcountMap): number;
1701
1452
  }
1702
- declare type AlgorithmCache = {
1703
- [a in EfficiencyAlgorithmType]: EfficiencyAlgorithm;
1704
- };
1453
+ declare type AlgorithmCache = MapOf<EfficiencyAlgorithmType, EfficiencyAlgorithm>;
1705
1454
 
1706
1455
  declare type NameChangeDetails = {
1707
1456
  nameChange: NameChange;
@@ -1729,6 +1478,237 @@ declare type RecordLeaderboardEntry = Record & {
1729
1478
  player: Player;
1730
1479
  };
1731
1480
 
1481
+ declare type MapOf<K extends keyof any, T> = {
1482
+ [P in K]: T;
1483
+ };
1484
+
1485
+ declare enum CompetitionStatus {
1486
+ UPCOMING = "upcoming",
1487
+ ONGOING = "ongoing",
1488
+ FINISHED = "finished"
1489
+ }
1490
+ declare const CompetitionTypeProps: MapOf<CompetitionType, {
1491
+ name: string;
1492
+ }>;
1493
+ declare const CompetitionStatusProps: MapOf<CompetitionStatus, {
1494
+ name: string;
1495
+ }>;
1496
+ declare const COMPETITION_TYPES: ("classic" | "team")[];
1497
+ declare const COMPETITION_STATUSES: CompetitionStatus[];
1498
+ declare function isCompetitionType(typeString: string): typeString is CompetitionType;
1499
+ declare function isCompetitionStatus(statusString: string): statusString is CompetitionStatus;
1500
+
1501
+ interface CountryDetails {
1502
+ code: Country;
1503
+ name: string;
1504
+ }
1505
+ declare const CountryProps: MapOf<Country, CountryDetails>;
1506
+ declare const COUNTRY_CODES: ("AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW")[];
1507
+ declare function isCountry(countryCodeString: string): countryCodeString is Country;
1508
+ declare function findCountry(countryIdentifier: string): CountryDetails | undefined;
1509
+ declare function findCountryByName(countryName: string): CountryDetails | undefined;
1510
+ declare function findCountryByCode(countryCode: string): CountryDetails | undefined;
1511
+
1512
+ declare const MAX_LEVEL = 99;
1513
+ declare const MAX_VIRTUAL_LEVEL = 126;
1514
+ declare const MAX_SKILL_EXP = 200000000;
1515
+ declare const SKILL_EXP_AT_99 = 13034431;
1516
+ declare const CAPPED_MAX_TOTAL_XP: number;
1517
+ declare function getExpForLevel(level: number): number;
1518
+ declare function getLevel(exp: number, virtual?: boolean): number;
1519
+ declare function getCombatLevel(attack: number, strength: number, defence: number, ranged: number, magic: number, hitpoints: number, prayer: number): number;
1520
+
1521
+ declare const GROUP_ROLES: ("magic" | "slayer" | "hunter" | "achiever" | "adamant" | "adept" | "administrator" | "admiral" | "adventurer" | "air" | "anchor" | "apothecary" | "archer" | "armadylean" | "artillery" | "artisan" | "asgarnian" | "assassin" | "assistant" | "astral" | "athlete" | "attacker" | "bandit" | "bandosian" | "barbarian" | "battlemage" | "beast" | "berserker" | "blisterwood" | "blood" | "blue" | "bob" | "body" | "brassican" | "brawler" | "brigadier" | "brigand" | "bronze" | "bruiser" | "bulwark" | "burglar" | "burnt" | "cadet" | "captain" | "carry" | "champion" | "chaos" | "cleric" | "collector" | "colonel" | "commander" | "competitor" | "completionist" | "constructor" | "cook" | "coordinator" | "corporal" | "cosmic" | "councillor" | "crafter" | "crew" | "crusader" | "cutpurse" | "death" | "defender" | "defiler" | "deputy_owner" | "destroyer" | "diamond" | "diseased" | "doctor" | "dogsbody" | "dragon" | "dragonstone" | "druid" | "duellist" | "earth" | "elite" | "emerald" | "enforcer" | "epic" | "executive" | "expert" | "explorer" | "farmer" | "feeder" | "fighter" | "fire" | "firemaker" | "firestarter" | "fisher" | "fletcher" | "forager" | "fremennik" | "gamer" | "gatherer" | "general" | "gnome_child" | "gnome_elder" | "goblin" | "gold" | "goon" | "green" | "grey" | "guardian" | "guthixian" | "harpoon" | "healer" | "hellcat" | "helper" | "herbologist" | "hero" | "holy" | "hoarder" | "ignitor" | "illusionist" | "imp" | "infantry" | "inquisitor" | "iron" | "jade" | "justiciar" | "kandarin" | "karamjan" | "kharidian" | "kitten" | "knight" | "labourer" | "law" | "leader" | "learner" | "legacy" | "legend" | "legionnaire" | "lieutenant" | "looter" | "lumberjack" | "magician" | "major" | "maple" | "marshal" | "master" | "maxed" | "mediator" | "medic" | "mentor" | "member" | "merchant" | "mind" | "miner" | "minion" | "misthalinian" | "mithril" | "moderator" | "monarch" | "morytanian" | "mystic" | "myth" | "natural" | "nature" | "necromancer" | "ninja" | "noble" | "novice" | "nurse" | "oak" | "officer" | "onyx" | "opal" | "oracle" | "orange" | "owner" | "page" | "paladin" | "pawn" | "pilgrim" | "pine" | "pink" | "prefect" | "priest" | "private" | "prodigy" | "proselyte" | "prospector" | "protector" | "pure" | "purple" | "pyromancer" | "quester" | "racer" | "raider" | "ranger" | "record_chaser" | "recruit" | "recruiter" | "red_topaz" | "red" | "rogue" | "ruby" | "rune" | "runecrafter" | "sage" | "sapphire" | "saradominist" | "saviour" | "scavenger" | "scholar" | "scourge" | "scout" | "scribe" | "seer" | "senator" | "sentry" | "serenist" | "sergeant" | "shaman" | "sheriff" | "short_green_guy" | "skiller" | "skulled" | "smiter" | "smith" | "smuggler" | "sniper" | "soul" | "specialist" | "speed_runner" | "spellcaster" | "squire" | "staff" | "steel" | "strider" | "striker" | "summoner" | "superior" | "supervisor" | "teacher" | "templar" | "therapist" | "thief" | "tirannian" | "trialist" | "trickster" | "tzkal" | "tztok" | "unholy" | "vagrant" | "vanguard" | "walker" | "wanderer" | "warden" | "warlock" | "warrior" | "water" | "wild" | "willow" | "wily" | "wintumber" | "witch" | "wizard" | "worker" | "wrath" | "xerician" | "yellow" | "yew" | "zamorakian" | "zarosian" | "zealot" | "zenyte")[];
1522
+ declare const PRIVELEGED_GROUP_ROLES: GroupRole[];
1523
+ declare type GroupRolePropsMap = MapOf<GroupRole, {
1524
+ name: string;
1525
+ isPriveleged: boolean;
1526
+ }>;
1527
+ declare const GroupRoleProps: GroupRolePropsMap;
1528
+ declare function findGroupRole(roleName: string): GroupRole | null;
1529
+ declare function isGroupRole(roleString: string): roleString is GroupRole;
1530
+
1531
+ declare enum MetricType {
1532
+ SKILL = "skill",
1533
+ BOSS = "boss",
1534
+ ACTIVITY = "activity",
1535
+ COMPUTED = "computed"
1536
+ }
1537
+ declare enum MetricMeasure {
1538
+ EXPERIENCE = "experience",
1539
+ KILLS = "kills",
1540
+ SCORE = "score",
1541
+ VALUE = "value"
1542
+ }
1543
+ interface SkillProperties {
1544
+ name: string;
1545
+ isCombat: boolean;
1546
+ isMembers: boolean;
1547
+ type: MetricType;
1548
+ measure: MetricMeasure;
1549
+ }
1550
+ interface BossProperties {
1551
+ name: string;
1552
+ minimumKc: number;
1553
+ isMembers: boolean;
1554
+ type: MetricType;
1555
+ measure: MetricMeasure;
1556
+ }
1557
+ interface ActivityProperties {
1558
+ name: string;
1559
+ type: MetricType;
1560
+ measure: MetricMeasure;
1561
+ }
1562
+ interface ComputedMetricProperties {
1563
+ name: string;
1564
+ type: MetricType;
1565
+ measure: MetricMeasure;
1566
+ }
1567
+ declare const MetricProps: {
1568
+ readonly ehp: ComputedMetricProperties;
1569
+ readonly ehb: ComputedMetricProperties;
1570
+ readonly league_points: ActivityProperties;
1571
+ readonly bounty_hunter_hunter: ActivityProperties;
1572
+ readonly bounty_hunter_rogue: ActivityProperties;
1573
+ readonly clue_scrolls_all: ActivityProperties;
1574
+ readonly clue_scrolls_beginner: ActivityProperties;
1575
+ readonly clue_scrolls_easy: ActivityProperties;
1576
+ readonly clue_scrolls_medium: ActivityProperties;
1577
+ readonly clue_scrolls_hard: ActivityProperties;
1578
+ readonly clue_scrolls_elite: ActivityProperties;
1579
+ readonly clue_scrolls_master: ActivityProperties;
1580
+ readonly last_man_standing: ActivityProperties;
1581
+ readonly pvp_arena: ActivityProperties;
1582
+ readonly soul_wars_zeal: ActivityProperties;
1583
+ readonly guardians_of_the_rift: ActivityProperties;
1584
+ readonly abyssal_sire: BossProperties;
1585
+ readonly alchemical_hydra: BossProperties;
1586
+ readonly barrows_chests: BossProperties;
1587
+ readonly bryophyta: BossProperties;
1588
+ readonly callisto: BossProperties;
1589
+ readonly cerberus: BossProperties;
1590
+ readonly chambers_of_xeric: BossProperties;
1591
+ readonly chambers_of_xeric_challenge_mode: BossProperties;
1592
+ readonly chaos_elemental: BossProperties;
1593
+ readonly chaos_fanatic: BossProperties;
1594
+ readonly commander_zilyana: BossProperties;
1595
+ readonly corporeal_beast: BossProperties;
1596
+ readonly crazy_archaeologist: BossProperties;
1597
+ readonly dagannoth_prime: BossProperties;
1598
+ readonly dagannoth_rex: BossProperties;
1599
+ readonly dagannoth_supreme: BossProperties;
1600
+ readonly deranged_archaeologist: BossProperties;
1601
+ readonly general_graardor: BossProperties;
1602
+ readonly giant_mole: BossProperties;
1603
+ readonly grotesque_guardians: BossProperties;
1604
+ readonly hespori: BossProperties;
1605
+ readonly kalphite_queen: BossProperties;
1606
+ readonly king_black_dragon: BossProperties;
1607
+ readonly kraken: BossProperties;
1608
+ readonly kreearra: BossProperties;
1609
+ readonly kril_tsutsaroth: BossProperties;
1610
+ readonly mimic: BossProperties;
1611
+ readonly nex: BossProperties;
1612
+ readonly nightmare: BossProperties;
1613
+ readonly phosanis_nightmare: BossProperties;
1614
+ readonly obor: BossProperties;
1615
+ readonly sarachnis: BossProperties;
1616
+ readonly scorpia: BossProperties;
1617
+ readonly skotizo: BossProperties;
1618
+ readonly tempoross: BossProperties;
1619
+ readonly the_gauntlet: BossProperties;
1620
+ readonly the_corrupted_gauntlet: BossProperties;
1621
+ readonly theatre_of_blood: BossProperties;
1622
+ readonly theatre_of_blood_hard_mode: BossProperties;
1623
+ readonly thermonuclear_smoke_devil: BossProperties;
1624
+ readonly tombs_of_amascut: BossProperties;
1625
+ readonly tombs_of_amascut_expert: BossProperties;
1626
+ readonly tzkal_zuk: BossProperties;
1627
+ readonly tztok_jad: BossProperties;
1628
+ readonly venenatis: BossProperties;
1629
+ readonly vetion: BossProperties;
1630
+ readonly vorkath: BossProperties;
1631
+ readonly wintertodt: BossProperties;
1632
+ readonly zalcano: BossProperties;
1633
+ readonly zulrah: BossProperties;
1634
+ readonly overall: SkillProperties;
1635
+ readonly attack: SkillProperties;
1636
+ readonly defence: SkillProperties;
1637
+ readonly strength: SkillProperties;
1638
+ readonly hitpoints: SkillProperties;
1639
+ readonly ranged: SkillProperties;
1640
+ readonly prayer: SkillProperties;
1641
+ readonly magic: SkillProperties;
1642
+ readonly cooking: SkillProperties;
1643
+ readonly woodcutting: SkillProperties;
1644
+ readonly fletching: SkillProperties;
1645
+ readonly fishing: SkillProperties;
1646
+ readonly firemaking: SkillProperties;
1647
+ readonly crafting: SkillProperties;
1648
+ readonly smithing: SkillProperties;
1649
+ readonly mining: SkillProperties;
1650
+ readonly herblore: SkillProperties;
1651
+ readonly agility: SkillProperties;
1652
+ readonly thieving: SkillProperties;
1653
+ readonly slayer: SkillProperties;
1654
+ readonly farming: SkillProperties;
1655
+ readonly runecrafting: SkillProperties;
1656
+ readonly hunter: SkillProperties;
1657
+ readonly construction: SkillProperties;
1658
+ };
1659
+ declare const METRICS: Metric[];
1660
+ declare const SKILLS: Skill[];
1661
+ declare const BOSSES: Boss[];
1662
+ declare const ACTIVITIES: Activity[];
1663
+ declare const COMPUTED_METRICS: ComputedMetric[];
1664
+ declare const REAL_SKILLS: Skill[];
1665
+ declare const F2P_BOSSES: Boss[];
1666
+ declare const MEMBER_SKILLS: Skill[];
1667
+ declare const COMBAT_SKILLS: Skill[];
1668
+ declare function findMetric(metricName: string): Metric | null;
1669
+ declare function isMetric(metric: Metric | string): metric is Metric;
1670
+ declare function isSkill(metric: Metric | string): metric is Skill;
1671
+ declare function isActivity(metric: Metric | string): metric is Activity;
1672
+ declare function isBoss(metric: Metric | string): metric is Boss;
1673
+ declare function isComputedMetric(metric: Metric | string): metric is ComputedMetric;
1674
+ declare function getMetricRankKey(metric: Metric): string;
1675
+ declare function getMetricValueKey(metric: Metric): string;
1676
+ declare function getMetricMeasure(metric: Metric): MetricMeasure;
1677
+ declare function getMetricName(metric: Metric): string;
1678
+ declare function getMinimumBossKc(metric: Metric): number;
1679
+ declare function getParentEfficiencyMetric(metric: Metric): "ehp" | "ehb";
1680
+ declare function parseMetricAbbreviation(abbreviation: string): Metric | null;
1681
+
1682
+ declare type PeriodPropsMap = MapOf<Period, {
1683
+ name: string;
1684
+ milliseconds: number;
1685
+ }>;
1686
+ declare const PeriodProps: PeriodPropsMap;
1687
+ declare const PERIODS: ("five_min" | "day" | "week" | "month" | "year")[];
1688
+ declare function findPeriod(periodName: string): Period | null;
1689
+ declare function isPeriod(periodString: string): periodString is Period;
1690
+ declare function parsePeriodExpression(periodExpression: string): {
1691
+ expression: string;
1692
+ durationMs: number;
1693
+ };
1694
+
1695
+ declare const PlayerTypeProps: MapOf<PlayerType, {
1696
+ name: string;
1697
+ }>;
1698
+ declare const PlayerBuildProps: MapOf<PlayerBuild, {
1699
+ name: string;
1700
+ }>;
1701
+ declare const PLAYER_TYPES: ("unknown" | "regular" | "ironman" | "hardcore" | "ultimate")[];
1702
+ declare const PLAYER_BUILDS: ("main" | "f2p" | "lvl3" | "zerker" | "def1" | "hp10")[];
1703
+ declare function isPlayerType(typeString: string): typeString is PlayerType;
1704
+ declare function isPlayerBuild(buildString: string): buildString is PlayerBuild;
1705
+ declare function findPlayerType(typeName: string): PlayerType | null;
1706
+ declare function findPlayerBuild(buildName: string): PlayerBuild | null;
1707
+
1708
+ declare function formatNumber(num: number, withLetters?: boolean, decimalPrecision?: number): string | -1;
1709
+ declare function padNumber(value: number): string;
1710
+ declare function round(num: number, cases: number): number;
1711
+
1732
1712
  interface GenericCountMessageResponse {
1733
1713
  count: number;
1734
1714
  message: string;
@@ -2148,4 +2128,4 @@ declare class WOMClient {
2148
2128
  constructor(options?: WOMClientOptions);
2149
2129
  }
2150
2130
 
2151
- export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, ActivityValue, AlgorithmCache, AssertPlayerTypeResponse, BOSSES, Bonus, BonusType, Boss, BossDelta, BossMetaConfig, BossValue, CAPPED_MAX_TOTAL_XP, CMLGroupData, COMBAT_SKILLS, COMPETITION_STATUSES, COMPETITION_TYPES, COMPUTED_METRICS, COUNTRY_CODES, ChangeMemberRolePayload, CompetitionDetails, CompetitionListItem, CompetitionStatus, CompetitionStatusProps, CompetitionType, CompetitionTypeProps, CompetitionWithParticipations, CompetitionsSearchFilter, ComputedMetric, ComputedMetricDelta, ComputedMetricValue, Country, CountryDetails, CountryProps, CreateCompetitionPayload, CreateCompetitionResponse, CreateGroupPayload, CreateGroupResponse, DeltaLeaderboardEntry, DeltaLeaderboardFilter, EditCompetitionPayload, EditGroupPayload, EfficiencyAlgorithm, EfficiencyAlgorithmType, EfficiencyAlgorithmTypeUnion, EfficiencyLeaderboardsFilter, EfficiencyMap, ExperienceMap, ExtendedAchievement, F2P_BOSSES, FormattedSnapshot, GROUP_ROLES, GenericCountMessageResponse, GenericMessageResponse, GetGroupGainsFilter, GetPlayerGainsResponse, GroupDetails, GroupHiscoresActivityItem, GroupHiscoresBossItem, GroupHiscoresComputedMetricItem, GroupHiscoresEntry, GroupHiscoresSkillItem, GroupListItem, GroupMemberFragment, GroupRecordsFilter, GroupRole, GroupRoleProps, GroupStatistics, KillcountMap, MAX_LEVEL, MAX_SKILL_EXP, MAX_VIRTUAL_LEVEL, MEMBER_SKILLS, METRICS, MeasuredDeltaProgress, MemberInput, MembershipWithGroup, MembershipWithPlayer, Metric, MetricMeasure, MetricProps, MetricType, MigrationDataSource, NameChangeDetails, NameChangeStatus, NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, ParticipationWithCompetition, ParticipationWithPlayer, ParticipationWithPlayerAndProgress, Period, PeriodProps, Player, PlayerBuild, PlayerBuildProps, PlayerDeltasArray, PlayerDeltasMap, PlayerDetails, PlayerRecordsFilter, PlayerResolvable, PlayerType, PlayerTypeProps, REAL_SKILLS, Record, RecordLeaderboardEntry, RecordLeaderboardFilter, SKILLS, SKILL_EXP_AT_99, Skill, SkillDelta, SkillMetaConfig, SkillValue, Snapshot, SnapshotDataSource, SnapshotFragment, Team, TempleGroupData, TimeRangeFilter, Top5ProgressResult, WOMClient, findCountry, findCountryByCode, findCountryByName, findGroupRole, findMetric, findPeriod, findPlayerBuild, findPlayerType, formatNumber, getCombatLevel, getExpForLevel, getLevel, getMetricMeasure, getMetricName, getMetricRankKey, getMetricValueKey, getMinimumBossKc, getParentEfficiencyMetric, isActivity, isBoss, isCompetitionStatus, isCompetitionType, isComputedMetric, isCountry, isGroupRole, isMetric, isPeriod, isPlayerBuild, isPlayerType, isSkill, padNumber, parseMetricAbbreviation, parsePeriodExpression, round };
2131
+ export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, ActivityValue, AlgorithmCache, AssertPlayerTypeResponse, BOSSES, Bonus, BonusType, Boss, BossDelta, BossMetaConfig, BossValue, CAPPED_MAX_TOTAL_XP, CMLGroupData, COMBAT_SKILLS, COMPETITION_STATUSES, COMPETITION_TYPES, COMPUTED_METRICS, COUNTRY_CODES, ChangeMemberRolePayload, CompetitionDetails, CompetitionListItem, CompetitionStatus, CompetitionStatusProps, CompetitionType, CompetitionTypeProps, CompetitionWithParticipations, CompetitionsSearchFilter, ComputedMetric, ComputedMetricDelta, ComputedMetricValue, Country, CountryDetails, CountryProps, CreateCompetitionPayload, CreateCompetitionResponse, CreateGroupPayload, CreateGroupResponse, DeltaLeaderboardEntry, DeltaLeaderboardFilter, EditCompetitionPayload, EditGroupPayload, EfficiencyAlgorithm, EfficiencyAlgorithmType, EfficiencyAlgorithmTypeUnion, EfficiencyLeaderboardsFilter, EfficiencyMap, ExperienceMap, ExtendedAchievement, F2P_BOSSES, FormattedSnapshot, GROUP_ROLES, GenericCountMessageResponse, GenericMessageResponse, GetGroupGainsFilter, GetPlayerGainsResponse, GroupDetails, GroupHiscoresActivityItem, GroupHiscoresBossItem, GroupHiscoresComputedMetricItem, GroupHiscoresEntry, GroupHiscoresSkillItem, GroupListItem, GroupMemberFragment, GroupRecordsFilter, GroupRole, GroupRoleProps, GroupStatistics, KillcountMap, MAX_LEVEL, MAX_SKILL_EXP, MAX_VIRTUAL_LEVEL, MEMBER_SKILLS, METRICS, MapOf, MeasuredDeltaProgress, MemberInput, MembershipWithGroup, MembershipWithPlayer, Metric, MetricMeasure, MetricProps, MetricType, MigrationDataSource, NameChangeDetails, NameChangeStatus, NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, ParticipationWithCompetition, ParticipationWithPlayer, ParticipationWithPlayerAndProgress, Period, PeriodProps, Player, PlayerBuild, PlayerBuildProps, PlayerDeltasArray, PlayerDeltasMap, PlayerDetails, PlayerRecordsFilter, PlayerResolvable, PlayerType, PlayerTypeProps, REAL_SKILLS, Record, RecordLeaderboardEntry, RecordLeaderboardFilter, SKILLS, SKILL_EXP_AT_99, Skill, SkillDelta, SkillMetaConfig, SkillValue, Snapshot, SnapshotDataSource, SnapshotFragment, Team, TempleGroupData, TimeRangeFilter, Top5ProgressResult, WOMClient, findCountry, findCountryByCode, findCountryByName, findGroupRole, findMetric, findPeriod, findPlayerBuild, findPlayerType, formatNumber, getCombatLevel, getExpForLevel, getLevel, getMetricMeasure, getMetricName, getMetricRankKey, getMetricValueKey, getMinimumBossKc, getParentEfficiencyMetric, isActivity, isBoss, isCompetitionStatus, isCompetitionType, isComputedMetric, isCountry, isGroupRole, isMetric, isPeriod, isPlayerBuild, isPlayerType, isSkill, padNumber, parseMetricAbbreviation, parsePeriodExpression, round };
package/dist/index.js CHANGED
@@ -1903,8 +1903,8 @@ function findMetric(metricName) {
1903
1903
  }
1904
1904
  return null;
1905
1905
  }
1906
- function isMetric(metricString) {
1907
- return metricString in MetricProps;
1906
+ function isMetric(metric) {
1907
+ return metric in MetricProps;
1908
1908
  }
1909
1909
  function isSkill(metric) {
1910
1910
  return metric in SkillProps;
@@ -1944,7 +1944,11 @@ function parseMetricAbbreviation(abbreviation) {
1944
1944
  if (!abbreviation || abbreviation.length === 0) {
1945
1945
  return null;
1946
1946
  }
1947
- switch (abbreviation.toLowerCase()) {
1947
+ const fixedAbbreviation = abbreviation.toLowerCase();
1948
+ if (isMetric(fixedAbbreviation)) {
1949
+ return fixedAbbreviation;
1950
+ }
1951
+ switch (fixedAbbreviation) {
1948
1952
  // Bosses
1949
1953
  case 'sire':
1950
1954
  return Metric.ABYSSAL_SIRE;
@@ -2176,7 +2180,7 @@ function parseMetricAbbreviation(abbreviation) {
2176
2180
  case 'const':
2177
2181
  return Metric.CONSTRUCTION;
2178
2182
  default:
2179
- return abbreviation;
2183
+ return null;
2180
2184
  }
2181
2185
  }
2182
2186
 
@@ -2265,25 +2269,34 @@ function findPlayerBuild(buildName) {
2265
2269
  return null;
2266
2270
  }
2267
2271
 
2268
- function formatNumber(num, withLetters = false) {
2272
+ function formatNumber(num, withLetters = false, decimalPrecision = 2) {
2269
2273
  if (num === undefined || num === null)
2270
2274
  return -1;
2271
2275
  // If number is float
2272
2276
  if (num % 1 !== 0) {
2273
- return (Math.round(num * 100) / 100).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
2277
+ return (Math.round(num * 100) / 100).toLocaleString();
2274
2278
  }
2275
2279
  if ((num < 10000 && num > -10000) || !withLetters) {
2276
- return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
2280
+ return num.toLocaleString();
2277
2281
  }
2278
2282
  // < 10 million
2279
2283
  if (num < 10000000 && num > -10000000) {
2280
- return `${Math.floor(num / 1000)}k`;
2284
+ // If has no decimals, return as whole number instead (10.00k => 10k)
2285
+ if ((num / 1000) % 1 === 0)
2286
+ return `${num / 1000}k`;
2287
+ return `${(num / 1000).toFixed(decimalPrecision)}k`;
2281
2288
  }
2282
2289
  // < 1 billion
2283
2290
  if (num < 1000000000 && num > -1000000000) {
2284
- return `${Math.round((num / 1000000 + Number.EPSILON) * 100) / 100}m`;
2285
- }
2286
- return `${Math.round((num / 1000000000 + Number.EPSILON) * 100) / 100}b`;
2291
+ // If has no decimals, return as whole number instead (10.00m => 10m)
2292
+ if ((num / 1000000) % 1 === 0)
2293
+ return `${num / 1000000}m`;
2294
+ return `${(num / 1000000).toFixed(decimalPrecision)}m`;
2295
+ }
2296
+ // If has no decimals, return as whole number instead (10.00b => 10b)
2297
+ if ((num / 1000000000) % 1 === 0)
2298
+ return `${num / 1000000000}b`;
2299
+ return `${(num / 1000000000).toFixed(decimalPrecision)}b`;
2287
2300
  }
2288
2301
  function padNumber(value) {
2289
2302
  if (!value)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise-old-man/utils",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "scripts": {
11
11
  "prepublish": "npm run build",
12
12
  "prebuild": "cd ../server && npm run prisma:generate",
13
- "build": "rm -rf ./dist && npx rollup -c && node prisma-transform.js"
13
+ "build": "rm -rf ./dist && npx rollup -c && node prisma-transform.js && tsc dist/index.d.ts"
14
14
  },
15
15
  "keywords": [],
16
16
  "author": "",