Jump to content

New game extension - index.js script


PiersAS

Recommended Posts

I am trying to get vortex to support Fallen Enchantress legendary heroes.

 

Mods just involve copying files into the "C:\Users\<MyName>\Documents\My Games\legendaryheroes\Mods" directory.

 

So I am following the instructions in Creating a game extension for Vortex I copied some of the code for nevewinter nights 2

 

The mod appears in the extensions list with no errors, but not in the Games/Unmanaged list so clearly I have messed up somewhere. Anyone spot my mistake?

 

A lot of the documentation I found about the games page seems to be out of date.

const Promise = require('bluebird');
const { app, remote } = require('electron');
const path = require('path');
const winapi = require('winapi-bindings');
const { fs, util } = require('vortex-api');

const appUni = app || remote.app;

// Nexus Mods domain for the game. e.g. nexusmods.com/bloodstainedritualofthenight
const GAME_ID = 'fallenenchantresslegendaryheroes';

//Steam Application ID, you can get this from https://steamdb.info/apps/
const STEAMAPP_ID = '228260';

//GOG Application ID, you can get this from https://www.gogdb.org/
const GOGAPP_ID = '1445591825';

 function findGame() {
  try {
    const instPath = winapi.RegGetValue(
      'HKEY_LOCAL_MACHINE',
      'SOFTWARE\\WOW6432Node\\GOG.com\\Games\\' + GOGAPP_ID,
      'PATH');
    if (!instPath) {
      throw new Error('empty registry key');
    }
    return Promise.resolve(instPath.value);
  } catch (err) {
    return util.GameStoreHelper.findByAppId([STEAMAPP_ID, GOGAPP_ID])
      .then(game => game.gamePath);
  }
}

function modPath() {
  return path.join(appUni.getPath('documents'), 'My Games','legendaryheroes','Mods');
}

function install(files) {
  return Promise.resolve({ instructions });
}


function prepareForModding(discovery) {
  return fs.ensureDirWritableAsync(modPath(), () => Promise.resolve());
}

function main(context) {
  context.registerGame({
    id: GAME_ID,
    name: 'Fallen Enchantress: Legendary Heroes',
    mergeMods: true,
    queryPath: findGame,
    queryModPath: modPath,
    logo: 'gameart.jpg',
    executable: () => 'LegendaryHeroes.exe',
    requiredFiles: [
      'LegendaryHeroes.exe',
    ],
    setup: prepareForModding,
	    environment: {
      SteamAPPId: STEAMAPP_ID,
    },
    details: {
      steamAppId: STEAMAPP_ID,
      gogAppId: GOGAPP_ID,
    },
  });

  return true;
}

module.exports = {
  default: main
};
{
  "name": "Game: Fallen Enchantress Legendary Heroes",
  "author": "Pickysaurus",
  "version": "0.0.1",
  "description": "Support for Elemental fallen enchantress legendary heroes"
}
Edited by PiersAS
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...