warscript
Version:
A typescript library for Warcraft III using Warpack.
63 lines (62 loc) • 7.33 kB
TypeScript
/** @noSelfInFile */
/** @noselfinfile */
declare global {
interface Destroyable {
destroy(): void;
}
}
declare namespace ns {
/**
* Converts a numeric rawid into its string representation.
*/
function id2s(id: number | string): string;
/**
* Converts a string rawid into its numeric representation.
*/
function s2id(id: string | number): number;
/**
* Creates a "context" object unique to the specified id,
* that will stay the same even across map reloads.
*/
function context<T>(id: string, initial: T): T;
/**
* Same as @see context , but uses a closure to compute the
* context value. The closure will be ran exactly once for
* each unique id.
*/
function contextFn<T>(id: string, initializer: () => T): T;
/**
* Clones an array, preserving order.
*/
function cloneArray<T>(array: readonly T[]): T[];
}
declare global {
var util: typeof ns;
}
declare global {
interface String {
/**
* Partitions a string into equal-sized chunks. The last chunk may be smaller if
* the string is not equally divisible by the specified length.
*
* @param length size of chunk
*/
partition(length: number): string[];
}
}
type KeysOfType<T, U> = {
[P in Exclude<keyof T, "hook">]: T[P] extends U ? P : never;
}[Exclude<keyof T, "hook">];
declare global {
function hook<P extends KeysOfType<typeof globalThis, Exclude<(...args: any[]) => void, Record<string, unknown>>>>(p: P, hook: (...args: Parameters<(typeof globalThis)[P]>) => void): void;
}
declare global {
function fourCC(id: string): number;
}
declare namespace inner {
const orderId: (id: "blink" | "stop" | "load" | "sleep" | "absorb" | "acidbomb" | "acolyteharvest" | "ambush" | "ancestralspirit" | "ancestralspirittarget" | "animatedead" | "antimagicshell" | "attack" | "attackground" | "attackonce" | "attributemodskill" | "auraunholy" | "auravampiric" | "autodispel" | "autodispeloff" | "autodispelon" | "autoentangle" | "autoentangleinstant" | "autoharvestgold" | "autoharvestlumber" | "avatar" | "avengerform" | "awaken" | "banish" | "barkskin" | "barkskinoff" | "barkskinon" | "battleroar" | "battlestations" | "bearform" | "berserk" | "blackarrow" | "blackarrowoff" | "blackarrowon" | "blight" | "blizzard" | "bloodlust" | "bloodlustoff" | "bloodluston" | "board" | "breathoffire" | "breathoffrost" | "build" | "burrow" | "cannibalize" | "carrionscarabs" | "carrionscarabsinstant" | "carrionscarabsoff" | "carrionscarabson" | "carrionswarm" | "chainlightning" | "channel" | "charm" | "chemicalrage" | "cloudoffog" | "clusterrockets" | "coldarrows" | "coldarrowstarg" | "controlmagic" | "corporealform" | "corrosivebreath" | "coupleinstant" | "coupletarget" | "creepanimatedead" | "creepdevour" | "creepheal" | "creephealoff" | "creephealon" | "creepthunderbolt" | "creepthunderclap" | "cripple" | "curse" | "curseoff" | "curseon" | "cyclone" | "darkconversion" | "darkportal" | "darkritual" | "darksummoning" | "deathanddecay" | "deathcoil" | "deathpact" | "decouple" | "defend" | "detectaoe" | "detonate" | "devour" | "devourmagic" | "disassociate" | "disenchant" | "dismount" | "dispel" | "divineshield" | "doom" | "drain" | "dreadlordinferno" | "dropitem" | "drunkenhaze" | "earthquake" | "eattree" | "elementalfury" | "ensnare" | "ensnareoff" | "ensnareon" | "entangle" | "entangleinstant" | "entanglingroots" | "etherealform" | "evileye" | "faeriefire" | "faeriefireoff" | "faeriefireon" | "fanofknives" | "farsight" | "fingerofdeath" | "firebolt" | "flamestrike" | "flamingarrows" | "flamingarrowstarg" | "flamingattack" | "flamingattacktarg" | "flare" | "forceboard" | "forceofnature" | "forkedlightning" | "freezingbreath" | "frenzy" | "frenzyoff" | "frenzyon" | "frostarmor" | "frostarmoroff" | "frostarmoron" | "frostnova" | "getitem" | "gold2lumber" | "grabtree" | "harvest" | "heal" | "healingspray" | "healingward" | "healingwave" | "healoff" | "healon" | "hex" | "holdposition" | "holybolt" | "howlofterror" | "humanbuild" | "immolation" | "impale" | "incineratearrow" | "incineratearrowoff" | "incineratearrowon" | "inferno" | "innerfire" | "innerfireoff" | "innerfireon" | "instant" | "invisibility" | "lavamonster" | "lightningshield" | "loadarcher" | "loadcorpse" | "loadcorpseinstant" | "locustswarm" | "lumber2gold" | "magicdefense" | "magicleash" | "magicundefense" | "manaburn" | "manaflareoff" | "manaflareon" | "manashieldoff" | "manashieldon" | "massteleport" | "mechanicalcritter" | "metamorphosis" | "militia" | "militiaconvert" | "militiaoff" | "militiaunconvert" | "mindrot" | "mirrorimage" | "monsoon" | "mount" | "mounthippogryph" | "move" | "moveAI" | "nagabuild" | "neutraldetectaoe" | "neutralinteract" | "neutralspell" | "nightelfbuild" | "orcbuild" | "parasite" | "parasiteoff" | "parasiteon" | "patrol" | "patrolAI" | "phaseshift" | "phaseshiftinstant" | "phaseshiftoff" | "phaseshifton" | "phoenixfire" | "phoenixmorph" | "poisonarrows" | "poisonarrowstarg" | "polymorph" | "possession" | "preservation" | "purge" | "rainofchaos" | "rainoffire" | "raisedead" | "raisedeadoff" | "raisedeadon" | "ravenform" | "recharge" | "rechargeoff" | "rechargeon" | "rejuvination" | "renew" | "renewoff" | "renewon" | "repair" | "repairoff" | "repairon" | "replenish" | "replenishlife" | "replenishlifeoff" | "replenishlifeon" | "replenishmana" | "replenishmanaoff" | "replenishmanaon" | "replenishoff" | "replenishon" | "request_hero" | "requestsacrifice" | "restoration" | "restorationoff" | "restorationon" | "resumebuild" | "resumeharvesting" | "resurrection" | "returnresources" | "revenge" | "revive" | "roar" | "robogoblin" | "root" | "sacrifice" | "sanctuary" | "scout" | "selfdestruct" | "selfdestructoff" | "selfdestructon" | "sentinel" | "follow" | "smart" | "setrally" | "shadowsight" | "shadowstrike" | "shockwave" | "silence" | "slow" | "slowoff" | "slowon" | "soulburn" | "soulpreservation" | "spellshield" | "spellshieldaoe" | "spellsteal" | "spellstealoff" | "spellstealon" | "spies" | "spiritlink" | "spiritofvengeance" | "spirittroll" | "spiritwolf" | "stampede" | "standdown" | "starfall" | "stasistrap" | "steal" | "stomp" | "stoneform" | "stunned" | "submerge" | "summonfactory" | "summongrizzly" | "summonphoenix" | "summonquillbeast" | "summonwareagle" | "tankdroppilot" | "tankloadpilot" | "tankpilot" | "taunt" | "thunderbolt" | "thunderclap" | "tornado" | "townbelloff" | "townbellon" | "tranquility" | "transmute" | "unavatar" | "unavengerform" | "unbearform" | "unburrow" | "uncoldarrows" | "uncorporealform" | "undeadbuild" | "undefend" | "undivineshield" | "unetherealform" | "unflamingarrows" | "unflamingattack" | "unholyfrenzy" | "unimmolation" | "unload" | "unloadall" | "unloadallcorpses" | "unloadallinstant" | "unpoisonarrows" | "unravenform" | "unrobogoblin" | "unroot" | "unstableconcoction" | "unstoneform" | "unsubmerge" | "unsummon" | "unwindwalk" | "vengeance" | "vengeanceinstant" | "vengeanceoff" | "vengeanceon" | "volcano" | "voodoo" | "ward" | "waterelemental" | "wateryminion" | "web" | "weboff" | "webon" | "whirlwind" | "windwalk" | "wispharvest") => number;
}
declare global {
function orderId(...args: Parameters<typeof inner.orderId>): ReturnType<typeof inner.orderId>;
}
export {};