Build your own modern FFXIV overlay with npm.
This library needs to be used along with ngld/OverlayPlugin.
You can install it from npm registry:
npm install ffxiv-overlay-api --save
Or import the library from jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/overlay.min.js"></script>
After installation, you can import the library:
import OverlayAPI from 'ffxiv-overlay-api';
const overlay = new OverlayAPI();
Note that this library only works in browser.
You can also pass options to constructor:
const overlay = new OverlayAPI({
extendData: true,
silentMode: false,
});
Then you can add bunch of different listeners.
const overlay = new OverlayAPI();
overlay.addListener('CombatData', (data) => {
console.log('Listener of CombatData', data);
});
overlay.addListener('ChangeZone', (data) => {
console.log('Listener of ChangeZone', data);
});
Call this function once youβre done adding all of your listeners:
overlay.startEvent();
Once this function has been called, OverlayPlugin will start sending events. Some events will be raised immediately with current state information like ChangeZone
or ChangePrimaryPlayer
.
After that, put the URL of your overlay into OverlayPlugin, or use the WebSocket URL when enabled. Checkout the index.html for example usage, you can download this file and load it from the OverlayPlugin. Enable WebSocked in your plugin and add ?OVERLAY_WS=ws://127.0.0.1:[port]/ws
after you overlay URL to access the WebSocket server.
Checkout Development section for more details.
Option | Default | Description |
---|---|---|
extendData |
false |
Parse and add cleaner data to listeners of CombatData |
silentMode |
false |
For production use, do not log all API stats info |
You can find all events available in https://ngld.github.io/OverlayPlugin/devs/event_types.
Add an event listener.
@param {String} event
Event to listen@param {Function} cb
Callback function
Remove a listener.
@param {String} event
Event type which listener belongs to@param {Function} cb
Function of which listener to remove
Remove all listener of one event type.
@param {String} event
Event type which listener belongs to
Get all listeners of a event.
@param {String} event
Event type which listener belongs to
Start listening event.
Ends current encounter and save it.
This function allows you to call an overlay handler. These handlers are declared by Event Sources (either built into OverlayPlugin or loaded through addons like Cactbot). Returns a Promise.
@param {Object} msg
Message send to OverlayPlugin
Pass some fake data object to start simulation, or do not pass params to disable simulation.
@param {Object|undefined} fakeData
Simulation fake combat data object like https://github.com/amzrk2/ffxiv-overlay-api/blob/master/test/fake_cn.json or usesimulateData()
to disable it.
Clone this repo, then:
npm install
npm start
You can access the test overlay at http://localhost:5000/test/
and http://localhost:5000/test/?OVERLAY_WS=ws://127.0.0.1:[port]/ws
.
Remember to run npm run build
before release commit.
Please use the .prettierrc
at the root of the project along with Prettier default settings to format your code.
- ngld/OverlayPlugin - MIT License
- hibiyasleep/OverlayPlugin - MIT License
- RainbowMage/OverlayPlugin - MIT License
Β© 2020 DSRKafuU Twitter @amzrk2