npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fxr-reloader

v4.0.2

Published

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

Downloads

19

Readme

FXR Reloader

This is a library for controlling the FXR WebSocket Reloader DLL mod for Elden Ring from JavaScript.

The primary purpose of it is to allow scripts using the @cccode/fxr library to directly put the FXR that is being created or edited into the game and respawn it so that it can be viewed without any manual interaction with the game. This effectively makes the game an almost live preview of the effect while you're working on it.

Installation

npm i fxr-reloader

Note that this library does not do anything on its own. It requires the FXR WebSocket Reloader DLL mod for Elden Ring to be installed and running. See the README for that on how to install it.

Usage

This library exports a default function that should be all you need in most cases. It simply takes an FXR object from the @cccode/fxr library, or an ArrayBuffer or ArrayBufferView of the contents of the FXR file, and optionally some extra settings for controlling if and how the SFX is respawned, and what WebSocket address to connect to.

Example

import { BasicNode, BillboardEx, FXR, Game } from '@cccode/fxr'
import reloadFXR, { Weapon, Affinity } from 'fxr-reloader'

// Use @cccode/fxr to create a new FXR with a big red square
const fxr = new FXR(402030)
fxr.root.nodes = [
  new BasicNode([
    new BillboardEx({
      color1: [1, 0, 0, 1]
    })
  ])
]

// Reload the FXR and respawn it by attaching it to the Short Sword (with
// standard affinity) at dummy poly 120
await reloadFXR(fxr, true, Weapon.ShortSword + Affinity.Standard, 120)

The weapon and dummy poly IDs used there are the defaults, so this would be equivalent in this case:

await reloadFXR(fxr, true)

You can also just reload the effect without respawning it:

await reloadFXR(fxr)

If you also provide a port number or URL, it will try to connect to that WebSocket server instead of the default (ws://localhost:24621). The DLL mod's port can be changed by editing its JSON config file.

// Try to connect to ws://localhost:9003
await reloadFXR(fxr, true, Weapon.ShortSword, 120, 9003)

// Try to connect to ws://example.com:9003
await reloadFXR(fxr, true, Weapon.ShortSword, 120, 'ws://example.com:9003')

Advanced usage

The default function should be all you need for most cases, but there are some cases where it would have poor performance compared to other methods, or you may want to do something else than just reloading and respawning a weapon effect.

If you need to use these functions, I recommend just checking out the source code in this repo. It's nice and short, and decently documented with JSDoc comments.

Here's a very brief overview of the named exports:

  • Weapon: An enum with IDs for all weapons in Elden Ring.
  • Affinity: An enum with ID offsets for all weapon affinities in Elden Ring.
  • connect: This function takes a port number or a URL string and uses that to try to connect to a WebSocket server. It returns a promise that resolves with a reloader object containing the WebSocket object, a request function, and a reload function.
  • request: This function makes a request to a given WebSocket. It automatically handles the request ID, and it returns a promise that resolves when it has received a response from the server. If the request did not succeed, the returned promise rejects with the status from the response.
  • reloadFXR: This is the same as the default export.
  • reloadLanternFXR: This function reloads an effect and respawns it by replacing the lantern effect instead of a weapon effect.
  • setParams: This function can be used to edit any game parameters live, similar to the param hot reload feature in DSMS/Smithbox.

Command line

This package also provides a command that can reload an FXR file:

npx reload-fxr <file path> [<weapon ID>] [<dummy poly ID>] [<port or URL>]

Examples:

# Reload f000402030.fxr
npx reload-fxr f000402030.fxr

# Reload and respawn f000402030.fxr
npx reload-fxr f000402030.fxr ShortSword 120

# Using the raw weapon ID instead of the name
npx reload-fxr f000402030.fxr 2010000 120

# Using a different weapon affinity than standard
npx reload-fxr f000402030.fxr ShortSword+Keen 120

# Reload and respawn f000402030.fxr using port 9003 for the WebSocket
npx reload-fxr f000402030.fxr ShortSword 120 9003

If you want to use the command from any folder, install the library globally:

npm i -g fxr-reloader

This allows you to use it from anywhere, and without npx:

reload-fxr f000402030.fxr ShortSword 120