KeyWorld
New member
ROChargenPHP
ROChargenPHP is a PHP tool made for Ragnarok Online private server to help them to solved a big problem : how to display game characters on the website ? So this tool comes at the rescue, parsing game data to render as an image the character/monster of your choice, base on your database or direct informations.
It required PHP5 with the PDO and GD drivers installed. And atleast your game data uploaded to the server (data or/and GRF).
Features
Core
- Support for .spr, .act, .pal, .grf, ...
- .act file completed support (transparency, scale, color, rotate, ...)
- Characters fully implemented ( body, head, hats, weapon, shield, robe, mount) with palettes support.
- Can modify action, animation and direction.
- Class to generate : Full Character / Character Head only / Monster-NPC-Homunculus / Avatar / Signature.
- Cache system available (and can be set off) with configurable time to cache.
- Emblem Loader available.
- Data.ini file support (to list your GRFs)
- Support GRF (0x200 version only without DES encryption - repack before uploading) - the data folder is always read first.
- Auto-Extract files from GRF if needed (optimize performance)
- Updater script available to convert some lua files to PHP.
Really url-friendly:
myserver.com/chargen/<controller>/<data> // with url-rewritingmyserver.com/chargen/index.php/<controller>/<data> // without url-rewriting Example for my character called "KeyWorld":
Code:
myserver.com/chargen/avatar/KeyWorld // avatarmyserver.com/chargen/signature/KeyWorld // signaturemyserver.com/chargen/character/KeyWorld // full Charactermyserver.com/chargen/characterhead/KeyWorld // Character's head
You can change the default link by modify the array $routes in the index.php file:
Code:
// $routes['url'] = controller$routes['/avatar/(.*)'] = 'Avatar';$routes['/character/(.*)'] = 'Character';$routes['/characterhead/(.*)'] = 'CharacterHead';$routes['/monster/(d+)'] = 'Monster';$routes['/signature/(.*)'] = 'Signature';
At least, the tool is really easy to use, here an example on how to display a static character:
Code:
$chargen = new CharacterRender();
$chargen->action = CharacterRender::ACTION_READYFIGHT;
$chargen->direction = CharacterRender::DIRECTION_SOUTHEAST;
$chargen->body_animation = 0;
$chargen->doridori = 0;
// Custom data:
$chargen->sex = "M";
$chargen->class = 4002;
$chargen->clothes_color = 0;
$chargen->hair = 5;
$chargen->hair_color = 12;
// ... head_top, head_mid, head_bottom, robe, weapon, shield, ...
// Generate Image
$img = $chargen->render();
imagepng($img);
Examples / Demos
Sources

Get the source
(Thanks to report all bugs)

License
Instead of selling it, I give a try to "Open Source project with Donation".
So if you think, you would have buy it if i was selling it, think to give a donation ?
Notes
- A directory "client" is in the project, it will be a good idea to move it to a directory not accessible by the user (for example /home/client/).
- If you use generate images from GRFs you have to know it's a little slower, i recommend you in this case to allow the "AutoExtract" option to gain performance.
- GRFs have to be save as 0x200 version without any encryption (even the official DES), good idea is to remove unused folders ( textures, wav, models)..
- If you use the options Cache and AutoExtract, don't forget the script need to have a write access to the
[*]Thanks to Khazou for the acces to his server to fully testing the tool