UNPKG

fxr-reloader

Version:

Reload, respawn, and extract FXRs in Elden Ring while the game is running.

710 lines (709 loc) 23 kB
export declare enum Weapon { Unarmed = 110000, Dagger = 1000000, BlackKnife = 1010000, ParryingDagger = 1020000, Misericorde = 1030000, Reduvia = 1040000, CrystalKnife = 1050000, CelebrantsSickle = 1060000, GlintstoneKris = 1070000, ScorpionsStinger = 1080000, GreatKnife = 1090000, Wakizashi = 1100000, Cinquedea = 1110000, IvorySickle = 1130000, BloodstainedDagger = 1140000, ErdsteelDagger = 1150000, BladeOfCalling = 1160000, Longsword = 2000000, ShortSword = 2010000, Broadsword = 2020000, RoyalSoldierStraightSword = 2030000, LordswornsStraightSword = 2040000, WeatheredStraightSword = 2050000, OrnamentalStraightSword = 2060000, GoldenEpitaph = 2070000, NoxFlowingSword = 2080000, InseparableSword = 2090000, CodedSword = 2110000, SwordOfNightAndFlame = 2140000, CrystalSword = 2150000, CarianKnightsSword = 2180000, SwordOfStTrina = 2190000, MiquellanKnightsSword = 2200000, CaneSword = 2210000, RegaliaOfEochaid = 2220000, NoblesSlenderSword = 2230000, WarhawksTalon = 2240000, LazuliGlintstoneSword = 2250000, RottenCrystalSword = 2260000, BastardSword = 3000000, ForkedGreatsword = 3010000, IronGreatsword = 3020000, LordswornsGreatsword = 3030000, KnightsGreatsword = 3040000, Flamberge = 3050000, OrdovissGreatsword = 3060000, AlabasterLordsSword = 3070000, BanishedKnightsGreatsword = 3080000, DarkMoonGreatsword = 3090000, SacredRelicSword = 3100000, HelphensSteeple = 3130000, BlasphemousBlade = 3140000, MaraisExecutionersSword = 3150000, SwordOfMilos = 3160000, GoldenOrderGreatsword = 3170000, Claymore = 3180000, GargoylesGreatsword = 3190000, DeathsPoker = 3200000, GargoylesBlackblade = 3210000, Greatsword = 4000000, WatchdogsGreatsword = 4010000, MalikethsBlackBlade = 4020000, TrollsGoldenSword = 4030000, Zweihander = 4040000, StarscourgeGreatsword = 4050000, RoyalGreatsword = 4060000, GodslayersGreatsword = 4070000, RuinsGreatsword = 4080000, GraftedBladeGreatsword = 4100000, TrollKnightsSword = 4110000, Estoc = 5000000, CleanrotKnightsSword = 5010000, Rapier = 5020000, RogiersRapier = 5030000, AntspurRapier = 5040000, FrozenNeedle = 5050000, NoblesEstoc = 5060000, BloodyHelice = 6000000, GodskinStitcher = 6010000, GreatEpee = 6020000, DragonKingsCragblade = 6040000, Falchion = 7000000, BeastmansCurvedSword = 7010000, Shotel = 7020000, Shamshir = 7030000, BanditsCurvedSword = 7040000, MagmaBlade = 7050000, FlowingCurvedSword = 7060000, WingOfAstel = 7070000, ScavengersCurvedSword = 7080000, SharktoothCurvedSword = 7090000, EclipseShotel = 7100000, SerpentGodsCurvedSword = 7110000, MantisBlade = 7120000, Scimitar = 7140000, Grossmesser = 7150000, OnyxLordsGreatsword = 8010000, Dismounter = 8020000, BloodhoundsFang = 8030000, MagmaWyrmsScalesword = 8040000, ZamorCurvedSword = 8050000, OmenCleaver = 8060000, MonksFlameblade = 8070000, BeastmansCleaver = 8080000, MorgottsCursedSword = 8100000, HolyInfernoGreatsword = 8110000, Uchigatana = 9000000, Nagakiba = 9010000, HandOfMalenia = 9020000, MeteoricOreBlade = 9030000, RiversOfBlood = 9040000, Moonveil = 9060000, DragonscaleBlade = 9070000, SerpentboneBlade = 9080000, Twinblade = 10000000, GodskinPeeler = 10010000, TwinnedKnightSwords = 10030000, EleonorasPoleblade = 10050000, AbundanceAndDecayTwinblade = 10060000, AbundanceTwinblade = 10070000, GargoylesTwinblade = 10080000, GargoylesBlackBlades = 10090000, Mace = 11000000, Club = 11010000, CurvedClub = 11030000, Warpick = 11040000, MorningStar = 11050000, VarresBouquet = 11060000, SpikedClub = 11070000, Hammer = 11080000, MonksFlamemace = 11090000, EnvoysHorn = 11100000, ScepterOfTheAllKnowing = 11110000, NoxFlowingHammer = 11120000, RingedFinger = 11130000, StoneClub = 11140000, MarikasHammer = 11150000, FatherMarikasHammer = 11160000, LargeClub = 12000000, GreathornHammer = 12010000, BattleHammer = 12020000, GreatMace = 12060000, CurvedGreatClub = 12080000, CelebrantsSkull = 12130000, Pickaxe = 12140000, BeastclawGreathammer = 12150000, EnvoysLongHorn = 12160000, CranialVesselCandlestand = 12170000, GreatStars = 12180000, BrickHammer = 12190000, DevourersScepter = 12200000, RottenBattleHammer = 12210000, NightriderFlail = 13000000, Flail = 13010000, FamilyHeads = 13020000, BastardsStars = 13030000, ChainlinkFlail = 13040000, BattleAxe = 14000000, ForkedHatchet = 14010000, HandAxe = 14020000, JawboneAxe = 14030000, IronCleaver = 14040000, RippleBlade = 14050000, CelebrantsCleaver = 14060000, IcerindHatchet = 14080000, HighlandAxe = 14100000, SacrificialAxe = 14110000, RosusAxe = 14120000, BurialAxe = 14130000, StormhawkAxe = 14140000, Greataxe = 15000000, WarpedAxe = 15010000, GreatOmenkillerCleaver = 15020000, CrescentMoonAxe = 15030000, AxeOfGodrick = 15040000, LonghaftAxe = 15050000, RustedAnchor = 15060000, ExecutionersGreataxe = 15080000, WingedGreathorn = 15110000, ButcheringKnife = 15120000, GargoylesGreatAxe = 15130000, GargoylesBlackAxe = 15140000, ShortSpear = 16000000, Spear = 16010000, CrystalSpear = 16020000, ClaymansHarpoon = 16030000, CleanrotSpear = 16040000, Partisan = 16050000, CelebrantsRibRake = 16060000, Pike = 16070000, Torchpole = 16080000, BoltOfGransax = 16090000, CrossNaginata = 16110000, DeathRitualSpear = 16120000, InquisitorsGirandole = 16130000, SpikedSpear = 16140000, IronSpear = 16150000, RottenCrystalSpear = 16160000, MohgwynsSacredSpear = 17010000, SiluriasTree = 17020000, SerpentHunter = 17030000, VykesWarSpear = 17050000, Lance = 17060000, Treespear = 17070000, Halberd = 18000000, PestsGlaive = 18010000, Lucerne = 18020000, BanishedKnightsHalberd = 18030000, CommandersStandard = 18040000, NightriderGlaive = 18050000, RippleCrescentHalberd = 18060000, VulgarMilitiaSaw = 18070000, GoldenHalberd = 18080000, Glaive = 18090000, LorettasWarSickle = 18100000, GuardiansSwordspear = 18110000, VulgarMilitiaShotel = 18130000, DragonHalberd = 18140000, GargoylesHalberd = 18150000, GargoylesBlackHalberd = 18160000, Scythe = 19000000, GraveScythe = 19010000, HaloScythe = 19020000, HereticsHook = 19050000, WingedScythe = 19060000, Whip = 20000000, ThornedWhip = 20020000, MagmaWhipCandlestick = 20030000, HoslowsPetalWhip = 20050000, GiantsRedBraid = 20060000, Urumi = 20070000, Caestus = 21000000, SpikedCaestus = 21010000, GraftedDragon = 21060000, IronBall = 21070000, StarFist = 21080000, Katar = 21100000, ClingingBone = 21110000, VeteransProsthesis = 21120000, CipherPata = 21130000, Hookclaws = 22000000, VenomousFang = 22010000, BloodhoundClaws = 22020000, RaptorTalons = 22030000, PrelatesInfernoCrozier = 23000000, WatchdogsStaff = 23010000, GreatClub = 23020000, EnvoysGreathorn = 23030000, DuelistGreataxe = 23040000, AxeOfGodfrey = 23050000, DragonGreatclaw = 23060000, StaffOfTheAvatar = 23070000, FallingstarBeastJaw = 23080000, GhizasWheel = 23100000, GiantCrusher = 23110000, GolemsHalberd = 23120000, TrollsHammer = 23130000, RottenStaff = 23140000, RottenGreataxe = 23150000, Torch = 24000000, SteelWireTorch = 24020000, StTrinasTorch = 24040000, GhostflameTorch = 24050000, BeastRepellentTorch = 24060000, SentrysTorch = 24070000, Buckler = 30000000, PerfumersShield = 30010000, ManSerpentsShield = 30020000, RicketyShield = 30030000, PilloryShield = 30040000, BeastmansJarShield = 30060000, RedThornRoundshield = 30070000, ScriptureWoodenShield = 30080000, RivetedWoodenShield = 30090000, BlueWhiteWoodenShield = 30100000, RiftShield = 30110000, IronRoundshield = 30120000, GildedIronShield = 30130000, IceCrestShield = 30140000, SmolderingShield = 30150000, SpiralhornShield = 30190000, CoilShield = 30200000, KiteShield = 31000000, MarredLeatherShield = 31010000, MarredWoodenShield = 31020000, BanishedKnightsShield = 31030000, AlbinauricShield = 31040000, SunRealmShield = 31050000, SilverMirrorshield = 31060000, RoundShield = 31070000, ScorpionKiteShield = 31080000, TwinbirdKiteShield = 31090000, BlueGoldKiteShield = 31100000, BrassShield = 31130000, GreatTurtleShell = 31140000, ShieldOfTheGuilty = 31170000, CarianKnightsShield = 31190000, LargeLeatherShield = 31230000, HorseCrestWoodenShield = 31240000, CandletreeWoodenShield = 31250000, FlameCrestWoodenShield = 31260000, HawkCrestWoodenShield = 31270000, BeastCrestHeaterShield = 31280000, RedCrestHeaterShield = 31290000, BlueCrestHeaterShield = 31300000, EclipseCrestHeaterShield = 31310000, InvertedHawkHeaterShield = 31320000, HeaterShield = 31330000, BlackLeatherShield = 31340000, DragonTowershield = 32000000, DistinguishedGreatshield = 32020000, CrucibleHornshield = 32030000, DragonclawShield = 32040000, BriarGreatshield = 32050000, ErdtreeGreatshield = 32080000, GoldenBeastCrestShield = 32090000, JellyfishShield = 32120000, FingerprintStoneShield = 32130000, IconShield = 32140000, OneEyedShield = 32150000, VisageShield = 32160000, SpikedPalisadeShield = 32170000, ManorTowershield = 32190000, CrossedTreeTowershield = 32200000, InvertedHawkTowershield = 32210000, AntsSkullPlate = 32220000, RedmaneGreatshield = 32230000, EclipseCrestGreatshield = 32240000, CuckooGreatshield = 32250000, GoldenGreatshield = 32260000, GildedGreatshield = 32270000, HaligtreeCrestGreatshield = 32280000, WoodenGreatshield = 32290000, LordswornsShield = 32300000, GlintstoneStaff = 33000000, CrystalStaff = 33040000, GelmirGlintstoneStaff = 33050000, DemiHumanQueensStaff = 33060000, CarianRegalScepter = 33090000, DiggersStaff = 33120000, AstrologersStaff = 33130000, CarianGlintbladeStaff = 33170000, PrinceOfDeathsStaff = 33180000, AlbinauricStaff = 33190000, AcademyGlintstoneStaff = 33200000, CarianGlintstoneStaff = 33210000, AzursGlintstoneStaff = 33230000, LusatsGlintstoneStaff = 33240000, MeteoriteStaff = 33250000, StaffOfTheGuilty = 33260000, RottenCrystalStaff = 33270000, StaffOfLoss = 33280000, FingerSeal = 34000000, GodslayersSeal = 34010000, GiantsSeal = 34020000, GravelStoneSeal = 34030000, ClawmarkSeal = 34040000, GoldenOrderSeal = 34060000, ErdtreeSeal = 34070000, DragonCommunionSeal = 34080000, FrenziedFlameSeal = 34090000, Shortbow = 40000000, MisbegottenShortbow = 40010000, RedBranchShortbow = 40020000, HarpBow = 40030000, CompositeBow = 40050000, Longbow = 41000000, AlbinauricBow = 41010000, HornBow = 41020000, ErdtreeBow = 41030000, SerpentBow = 41040000, PulleyBow = 41060000, BlackBow = 41070000, LionGreatbow = 42000000, GolemGreatbow = 42010000, ErdtreeGreatbow = 42030000, Greatbow = 42040000, SoldiersCrossbow = 43000000, LightCrossbow = 43020000, HeavyCrossbow = 43030000, PulleyCrossbow = 43050000, FullMoonCrossbow = 43060000, Arbalest = 43080000, BuckshotCrossbow = 43100000, CrepussBlackKeyCrossbow = 43110000, HandBallista = 44000000, JarCannon = 44010000, Maingauche = 1500000, FireKnightsShortsword = 1510000, VelvetSwordOfStTrina = 2510000, StarLinedSword = 2520000, CarianSorcerySword = 2530000, StoneSheathedSword = 2540000, SwordOfLight = 2550000, SwordOfDarkness = 2560000, SwordLance = 3500000, GreatswordOfDamnation = 3510000, LizardGreatsword = 3520000, GreatswordOfSolitude = 3550000, AncientMeteoricOreGreatsword = 4500000, FireKnightsGreatsword = 4520000, GreatswordOfRadahnLord = 4530000, MoonrithyllsKnightSword = 4540000, GreatswordOfRadahnLight = 4550000, QueelignsGreatsword = 6500000, SpiritSword = 7500000, Falx = 7510000, DancingBladeOfRanah = 7520000, HornedWarriorsSword = 7530000, PutrescenceCleaver = 8500000, FreyjasGreatsword = 8510000, HornedWarriorsGreatsword = 8520000, SwordOfNight = 9500000, Euporia = 10500000, BlackSteelTwinblade = 10510000, FlowerstoneGavel = 11500000, SmithscriptGreathammer = 12500000, AnvilHammer = 12510000, BlackSteelGreathammer = 12520000, BloodfiendsArm = 12530000, SerpentFlail = 13500000, SmithscriptAxe = 14500000, DeathKnightsTwinAxes = 14510000, MessmerSoldiersAxe = 14520000, ForkedTongueHatchet = 14540000, DeathKnightsLonghaftAxe = 15500000, BonnyButcheringKnife = 15510000, SmithscriptSpear = 16500000, SwiftSpear = 16520000, BloodfiendsFork = 16540000, BloodfiendsSacredSpear = 16550000, SpearOfTheImpaler = 17500000, MessmerSoldiersSpear = 17510000, BarbedStaffSpear = 17520000, SpiritGlaive = 18500000, PolebladeOfTheBud = 18510000, ObsidianLamina = 19500000, ToothWhip = 20500000, ThiolliersHiddenNeedle = 21500000, Pata = 21510000, PoisonedHand = 21520000, MaddingHand = 21530000, GolemFist = 21540000, ShieldOfNight = 21550000, ClawsOfNight = 22500000, DevoniasHammer = 23500000, ShadowSunflowerBlossom = 23510000, GazingFinger = 23520000, NanayasTorch = 24500000, LamentingVisage = 24510000, SmithscriptShield = 30510000, MessmerSoldierShield = 31500000, WolfCrestShield = 31510000, SerpentCrestShield = 31520000, GoldenLionShield = 31530000, BlackSteelGreatshield = 32500000, VerdigrisGreatshield = 32520000, StaffOfTheGreatBeyond = 33510000, MaternalStaff = 33520000, DryleafSeal = 34500000, FireKnightsSeal = 34510000, SpiraltreeSeal = 34520000, BoneBow = 40500000, AnsbachsLongbow = 41510000, IgonsGreatbow = 42500000, RepeatingCrossbow = 43500000, SpreadCrossbow = 43510000, RabbathsCannon = 44500000, PiqueboneArrowFletched = 50540000, PiqueboneArrow = 50550000, IgonsHarpoon = 51500000, PiqueboneBolt = 52520000, RabbathsGreatbolt = 53500000, DryleafArts = 60500000, DanesFootwork = 60510000, FiresparkPerfumeBottle = 61500000, ChillingPerfumeBottle = 61510000, FrenzyflamePerfumeBottle = 61520000, LightningPerfumeBottle = 61530000, DeadlyPoisonPerfumeBottle = 61540000, DuelingShield = 62500000, CarianThrustingShield = 62510000, SmithscriptDagger = 63500000, BackhandBlade = 64500000, SmithscriptCirque = 64510000, CursebladesCirque = 64520000, GreatKatana = 66500000, DragonHuntersGreatKatana = 66510000, RakshasasGreatKatana = 66520000, Milady = 67500000, LedasSword = 67510000, RellanasTwinBlades = 67520000, BeastClaw = 68500000, RedBearsClaw = 68510000 } export declare enum Affinity { Standard = 0, Heavy = 100, Keen = 200, Quality = 300, Fire = 400, FlameArt = 500, Lightning = 600, Sacred = 700, Magic = 800, Cold = 900, Poison = 1000, Blood = 1100, Occult = 1200 } export declare enum RequestType { ReloadFXRs = 0, SetResidentSFX = 1, SetSpEffectSFX = 2, GetFXR = 3, GetFXRs = 4, ListFXRs = 5 } export type ReloaderResponse = { request_id: string; success: boolean; message: string; data?: any; }; export type GameName = 'DarkSouls3' | 'Sekiro' | 'EldenRing' | 'ArmoredCore6' | 'Nightreign'; export interface FXRLike { toArrayBuffer(game: number): ArrayBuffer; } export interface ReloadOptions { /** * If set to true, this will disable the resident SFX on a {@link weapon} for * a short time and then enable it again, effectively respawning the SFX. * This allows an SFX attached to a weapon to automatically update without * manual interaction with the game. * * **Default**: false */ respawn?: boolean; /** * When {@link respawn} is enabled, this is the numerical ID for * the weapon to change the resident SFX of. Use the {@link Weapon} * and {@link Affinity} enums to select a weapon easily. * * **Default**: {@link Weapon.ShortSword} */ weapon?: number; /** * When {@link respawn} is enabled, this is the ID of the dummy poly to * attach the SFX to. * * **Default**: 120 */ dummyPoly?: number; } export type FXRReloader = { /** * A WebSocket connected to fxr-ws-reloader.dll. */ readonly ws: WebSocket; /** * The version number of fxr-ws-reloader.dll that the WebSocket is connected * to. */ readonly version: string; /** * The game that the WebSocket is connected to. */ readonly game: GameName; /** * Support for different features of the reloader. * | Feature | Description | * |-|-| * | `reload` | Allows FXRs to be reloaded. | * | `params` | Allows params to be read or modified. | * | `extract` | Allows FXRs to be listed or extracted. | */ readonly features: { /** * Allows FXRs to be reloaded. */ readonly reload: boolean; /** * Allows params to be read or modified. */ readonly params: boolean; /** * Allows FXRs to be listed or extracted. */ readonly extract: boolean; }; /** * Close the WebSocket connection. */ disconnect(): void; /** * Make a request to fxr-ws-reloader.dll to do something. This is used * internally to make the necessary requests to the server. */ request(obj: any): Promise<ReloaderResponse>; /** * Reload multiple FXR files. */ reload(fxrs: (ArrayBuffer | ArrayBufferView | FXRLike)[]): Promise<void>; /** * Reload an FXR file, and optionally respawn it as a resident SFX of a given * weapon. */ reload(fxr: ArrayBuffer | ArrayBufferView | FXRLike, options?: ReloadOptions): Promise<void>; /** * Set the resident SFX for a weapon. */ setResidentSFX(weapon: Weapon | number, sfx: number, dmy?: number): Promise<ReloaderResponse>; /** * Set the midst SFX for a SpEffect. */ setSpEffectSFX(spEffect: number, sfx: number, dmy?: number, vfx?: number): Promise<ReloaderResponse>; /** * Get a loaded FXR from the game as a byte array. */ fetch(id: number): Promise<Uint8Array>; /** * Get multiple loaded FXRs from the game as an array of byte arrays. */ fetch(ids: number[]): Promise<(Uint8Array | null)[]>; /** * Get a list of all loaded FXR IDs. */ list(): Promise<number[]>; }; export declare class ReloaderError extends Error { type: 'connection' | 'request' | 'response'; constructor(type: 'connection' | 'request' | 'response', message: string); } /** * Connects to a WebSocket server and sets up the necessary event handlers for * reloading FXRs. * @param endpoint The port number or URL string to connect to. By default, it * will try to connect to `ws://localhost:24621`, and setting only the port * will just replace the port number. */ export declare function connect(endpoint?: number | string): Promise<FXRReloader>; /** * Reloads an FXR and respawns the lantern SpEffectVfx and updates its * midstSfxId. * @param fxr An FXR object, or an ArrayBuffer or ArrayBufferView containing * the contents of the FXR file. * @param dummyPoly The ID of the dummy poly to attach the SFX to. * * **Default**: 160 * @param endpoint The port number or URL string to connect to. By default, it * will try to connect to `ws://localhost:24621`, and setting only the port * will just replace the port number. */ export declare function reloadLanternFXR(fxr: ArrayBuffer | ArrayBufferView | FXRLike, dummyPoly?: number, endpoint?: number | string): Promise<void>; /** * Fetch a loaded FXR from the game's memory. * @param id The ID of the FXR to fetch. * @param endpoint The port number or URL string to connect to. By default, it * will try to connect to `ws://localhost:24621`, and setting only the port * will just replace the port number. */ export declare function fetchFXR(id: number, endpoint?: number | string): Promise<Uint8Array<ArrayBufferLike>>; /** * Fetch a list of loaded FXRs from the game's memory. * @param id The IDs of the FXRs to fetch. * @param endpoint The port number or URL string to connect to. By default, it * will try to connect to `ws://localhost:24621`, and setting only the port * will just replace the port number. */ export declare function fetchFXRs(ids: number[], endpoint?: number | string): Promise<Uint8Array<ArrayBufferLike>[]>; /** * List all loaded FXRs in the game by their IDs. * @param endpoint The port number or URL string to connect to. By default, it * will try to connect to `ws://localhost:24621`, and setting only the port * will just replace the port number. */ export declare function listFXRs(endpoint?: number | string): Promise<number[]>; /** * Reload multiple FXRs. * @param fxr An FXR object, or an ArrayBuffer or ArrayBufferView containing * the contents of the FXR file. * @param options An object containing various options for reloading the FXR. */ export declare function reloadFXR(fxrs: (ArrayBuffer | ArrayBufferView | FXRLike)[], options?: { /** * The port number or URL string to connect to. By default, it will try to * connect to `ws://localhost:24621`, and setting only the port will just * replace the port number. */ endpoint?: number | string; }): Promise<void>; /** * Reload an FXR, and optionally respawn it as a resident SFX of a given * weapon. * @param fxr An FXR object, or an ArrayBuffer or ArrayBufferView containing * the contents of the FXR file. * @param options An object containing various options for reloading and * respawning the FXR. */ export declare function reloadFXR(fxr: ArrayBuffer | ArrayBufferView | FXRLike, options?: ReloadOptions & { /** * The port number or URL string to connect to. By default, it will try to * connect to `ws://localhost:24621`, and setting only the port will just * replace the port number. */ endpoint?: number | string; }): Promise<void>; export default reloadFXR;