# ntdf-modding-toolkit

> This is a library for reading and writing game data from Neopets: The Darkest Faerie. For a GUI frontend to this library, see [ntdf-editor](https://github.com/monster860/ntdf-editor). It currently supports reading and writing of 3D models, collision data,

Latest version **0.2.2** (published 2022-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install ntdf-modding-toolkit
pnpm add ntdf-modding-toolkit
yarn add ntdf-modding-toolkit
bun add ntdf-modding-toolkit
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2022-11-23 |
| First published | 2022-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 359.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ella Nikitin |
| Maintainers | monster860 |

## Links

- npm: https://www.npmjs.com/package/ntdf-modding-toolkit
- Repository: https://github.com/monster860/ntdf-modding-toolkit
- Homepage: https://github.com/monster860/ntdf-modding-toolkit#readme
- Issues: https://github.com/monster860/ntdf-modding-toolkit/issues
- npm.io page: https://npm.io/package/ntdf-modding-toolkit

## Dependencies (5)

- [pngjs](https://npm.io/package/pngjs.md) ^6.0.0
- [earcut](https://npm.io/package/earcut.md) ^2.2.3
- [cross-blob](https://npm.io/package/cross-blob.md) ^3.0.0
- [fetch-blob](https://npm.io/package/fetch-blob.md) ^3.1.4
- [martinez-polygon-clipping](https://npm.io/package/martinez-polygon-clipping.md) ^0.7.1

## Recent versions

- 0.2.2 (latest) — 2022-11-23
- 0.2.1 — 2022-11-23
- 0.2.0 — 2022-03-06
- 0.1.1 — 2022-03-04
- 0.1.0 — 2022-02-19
- 0.0.1 — 2022-02-17
- 0.0.0 — 2022-02-16

## README

# ntdf-modding-toolkit

This is a library for reading and writing game data from Neopets: The Darkest Faerie. For a GUI frontend to this library, see [ntdf-editor](https://github.com/monster860/ntdf-editor). It currently supports reading and writing of 3D models, collision data, lighting data, dialogue tables, materials, and image data.

[Documentation](https://monster860.github.io/ntdf-modding-toolkit/)

## Blobs

This library relies on JS's Blob objects. While these are supported in most browsers, if you are using node.js, you must use a library like [fetch-blob](https://www.npmjs.com/package/fetch-blob) to ponyfill blobs. Make sure you use version 3.1.4 or later, as earlier versions have a bug with the slice implementation. 

## Example

```js
import { fileFromSync } from 'fetch-blob/from.js';
import { Gamefile, ChunkType, MaterialsChunk } from 'ntdf-modding-toolkit';
import { createWriteStream } from 'node:fs';
import { Readable } from 'node:stream';

let iso_blob = fileFromSync("./darkestfaerie.iso");
Gamefile.from_iso(iso_blob).then(async gamefile => {
	// Read file 0x38D (which is Ellis Family Farm)
	let ellis_farm = await gamefile.get_chunk_file(0x38D);
	// Read the materials
	let materials = await MaterialsChunk.from_blob(ellis_farm.get_chunk_of_type(ChunkType.Materials).contents);
	// Make the grass materials scroll once per second
	materials.materials[1].passes[0].scroll_rate_x = 1/60;
	materials.materials[6].passes[0].scroll_rate_x = 1/60;
	materials.materials[8].passes[0].scroll_rate_x = 1/60;
	// Write them back to the file
	ellis_farm.get_chunk_of_type(ChunkType.Materials).contents = materials.to_blob();
	// Write the file back to the gamefile
	gamefile.replace_chunk_file(0x38D, ellis_farm);
	// Create a modified .iso file
	let modified_iso_blob = await gamefile.patch_iso(iso_blob);
	// Save the modified .iso file
	const output_filename = './darkestfaerie-modified.iso';
	Readable.from(modified_iso_blob.stream()).pipe(createWriteStream(output_filename))
});

```

---
_Source: https://npm.io/package/ntdf-modding-toolkit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
