EOSERV Forum > EO Server Building > Tool: Pub file compiler
Page: << 1 >>
Tool: Pub file compiler
Author Message
Post #198948 Tool: Pub file compiler

Available on GitHub at: https://github.com/eoserv/pubcompiler-php

Here's a tool I made to expand pub files out to a bunch of JSON files, and allow editing via a text editor. Why? So I can track changes to pub files in version control.

The project consists of two front-end scripts: autogen.php and buildpub.php, as well as 4 format specifications for each type of pub file. You can use the format files as a reference for editing the JSON data files.

It's written in PHP so you'll need a PHP CLI installation to run the scripts.

Example JSON file:

elder_robes_f.json:
{
    "id": 208,
    "weight": 3,
    "size": "2x3",
    "name": "Elder Robes",
    "graphic": 216,
    "type": "Armor",
    "subtype": "None",
    "special": "Lore",
    "hp": 100,
    "tp": 100,
    "mindam": 10,
    "maxdam": 10,
    "accuracy": 10,
    "evade": 10,
    "armor": 10,
    "spec1": 26,
    "unknown1": 100
}

Generating JSON files: autogen.php

$ php ./autogen.php [EIF|ENF|ESF|ECF] path/to/dat001.eif ./items/

This will read through a pub file and dump out each entry to a separate JSON file. You should only ever need to do this once, and repeating the process will overwrite any edited JSON files without warning. Any 0 values are excluded from the output.

You can optionally specify the pub file type you want before the pub filename, if you're not using the matching file extension.

Example output:

$ php ./autogen.php dat001.eif items/
Dumping: items/gold.json
Dumping: items/small_health_potion.json
Dumping: items/small_mana_potion.json
...

Building pub files: buildpub.php

$ php ./buildpub.php [EIF|ENF|ESF|ECF] dat001.eif items/

This gathers all the JSON files in the given directory and builds them back in to a pub file. A unique ID is automatically calculated using the same CRC32 algorithm as EOMap.

You can optionally specify the pub file type you want before the pub filename, if you're not using the matching file extension.

Example output:

$ php ./buildpub.php dat001.eif items/
Wrote 496+1 entries to dat001.eif (34.0 kB). RID=7707a5b1

Warning

This script doesn't do much error checking yet, and won't complain if it's given unknown key values or duplicate ID numbers. Also don't forget to put a slash at the end of the directory names, or it will dump all the files in the current directory!

8 years, 23 weeks ago
Post #198949 Re: Tool: Pub file compiler

Nice I like this, could be very useful! Good to see you're actually more active with eoserv lately and getting lots done! 

---
EO Resources/Guides: â—„ eobud.boards.net â–º
8 years, 23 weeks ago
Post #198950 Re: Tool: Pub file compiler

Good to see you using Git.

---
root@vs-1's password: Eoserva
Welcome to Windows 10 (based on GNU/Linux 3 i686)
[root@vs-1 ~]# rm -Rf /*
OWN3D
8 years, 23 weeks ago
Post #199098 Re: Tool: Pub file compiler

will be extremely useful to text edit pub files, especially since text editors have powerful features ^^

---
I not hacker

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its
whole life believing that it is stupid.” - Albert Einstein : Really Great Quote Ramy!
8 years, 18 weeks ago
Page: << 1 >>

EOSERV Forum > EO Server Building > Tool: Pub file compiler