forked from phenom/healer-man
Update class mechanics, stat rulesets, and CoA reference catalogs
This commit is contained in:
1 parent
b16821e92e
commit
39458d5de6
221 files changed
+2584962
-568
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { archiveRowsToDbc } from "./archive-dbc.mjs";
|
||||
|
||||
test("archive positional reconstruction preserves signed bits, inferred floats and localized text", () => {
|
||||
const types = Array(234).fill("int");
|
||||
types[229] = "float";
|
||||
const row = Object.fromEntries(types.map((_, index) => [`f${index}`, 0]));
|
||||
Object.assign(row, { f0: 100, f4: -2147483648, f41: -2, f47: 1101004800, f136: "New spell", f136i: 54321, f170: 43210, f170s: "Alternate decoded description", f229: 0.375 });
|
||||
const buffer = archiveRowsToDbc([row], types);
|
||||
assert.equal(buffer.readUInt32LE(4), 1);
|
||||
assert.equal(buffer.readUInt32LE(8), 234);
|
||||
assert.equal(buffer.readUInt32LE(20 + 4 * 4), 2147483648);
|
||||
assert.equal(buffer.readInt32LE(20 + 41 * 4), -2);
|
||||
assert.equal(buffer.readFloatLE(20 + 47 * 4), 20);
|
||||
assert.equal(buffer.readFloatLE(20 + 229 * 4), 0.375);
|
||||
const stringStart = 20 + 234 * 4;
|
||||
for (const [field, text] of [[136, "New spell"], [170, "Alternate decoded description"]]) {
|
||||
const start = stringStart + buffer.readUInt32LE(20 + field * 4);
|
||||
assert.equal(buffer.toString("utf8", start, buffer.indexOf(0, start)), text);
|
||||
}
|
||||
const malformed = { ...row };
|
||||
delete malformed.f71;
|
||||
assert.throws(() => archiveRowsToDbc([malformed], types), /missing f71/);
|
||||
});
|
||||
Reference in new issue
Block a user