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

kcd-modder

v1.0.1

Published

Kingdom Come Deliverance modder

Downloads

21

Readme

Kingdom Come Deliverance modder npm version

After every update of Kingdom Come Deliverance all mods would have to be updated. This program describes the mods as changes to the XML files and executes these changes. So if Kingdom Come ever updates, just run this program again and all mods are updated.

The plugins are small js files with the modifications to the XML files. This modder applies those modifications and creates the mods. When multiple plugins use the same file, this modder automatically puts all those plugins in the same mod.

Install

npm install kcd-modder

Usage

const modKingdomCome = require('kcd-modder')

const gameDir = 'C:\\Program Files\\Steam\\SteamApps\\common\\KingdomComeDeliverance'

const plugins = [
  modKingdomCome.plugins['more-hares'],
  {
    name: 'alternate-food-spoil',
    files: [
      {
        file: 'Libs/Tables/item/food.xml',
        pakFile: null,
        modifyFile: async (doc, { findDeep, setAttr }) => {
          const rows = findDeep(doc.documentElement, { name: 'row', attr: { decay_time_hours: '' } })
          if (!rows.length) throw new Error(`[alternate-food-spoil][Libs/Tables/item/food.xml] Error: rows with attribute decay_time_hours not found`)

          for (const row of rows) {
            setAttr(row, 'decay_time_hours', '0')
          }
        }
      }
    ]
  }
]

modKingdomCome(gameDir, plugins).catch(error => console.error('KCD Modder Error', error))

Assumptions and limitations

  • Every data file is in 1 .pak file, a file cannot be in multiple pak files
  • This modder only works for XML files
  • The modder tries to output XML files that are the same as the original files. This means that when using a diff-tool, only the lines that are actually changed appear as changed in the diff-tool. This makes is it easier to check if all went well.

Done

  • Read KingDom Come Deliverance data folder .pak files
  • Bundle plugins in the same mod when the plugins modify the same file
  • Write mods to a temporary folder
  • Read XML into a DomDocument model and write it back to XML
  • Create some methods to easily modify DomDocument model

Roadmap (TODO)

  • Backup old mods in Kingdom Come Mods folder and install new ones
  • Create commandline tool

Linter

This repository uses StandardJS for linting the .js files