Popular Post KeyWorld Posted July 17, 2013 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Popular Post Share Posted July 17, 2013 (edited) ROChargenPHP Quote 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. Client 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. How to use Really url-friendly: myserver.com/chargen/<controller>/<data> // with url-rewriting myserver.com/chargen/index.php/<controller>/<data> // without url-rewriting Example for my character called "KeyWorld": myserver.com/chargen/avatar/KeyWorld // avatar myserver.com/chargen/signature/KeyWorld // signature myserver.com/chargen/character/KeyWorld // full Character myserver.com/chargen/characterhead/KeyWorld // Character's head You can change the default link by modify the array $routes in the index.php file: // $routes['url'] = controller $routes['/avatar/(.*)'] = 'Avatar'; $routes['/character/(.*)'] = 'Character'; $routes['/characterhead/(.*)'] = 'CharacterHead'; $routes['/monster/(\d+)'] = 'Monster'; $routes['/signature/(.*)'] = 'Signature'; Custom display At least, the tool is really easy to use, here an example on how to display a static character: $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 client and cache folder. Thanks to Khazou for the acces to his server to fully testing the tool Edited April 25, 2019 by Emistry Fix broken url. 19 Link to comment Share on other sites More sharing options...
Myth Posted July 17, 2013 Group: Members Topic Count: 59 Topics Per Day: 0.01 Content Count: 225 Reputation: 5 Joined: 05/30/12 Last Seen: March 21 Share Posted July 17, 2013 Cool i will try this Link to comment Share on other sites More sharing options...
KeyWorld Posted July 17, 2013 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Author Share Posted July 17, 2013 (edited) Seriously: wtf. I spent 50 minutes of my life trying to fix bbcodes bugs in my first post, see the result. Edit: Finally able to have a not bad rendering by using some tricks: bbcode [-b] to jump line if use too much [-code], the code switch to inline mode (wth ?) ... Edited July 17, 2013 by KeyWorld Link to comment Share on other sites More sharing options...
Neo-Mind Posted July 17, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 806 Reputation: 221 Joined: 03/13/12 Last Seen: September 17, 2024 Share Posted July 17, 2013 Excellent work man Seriously: wtf.I spent 50 minutes of my life trying to fix bbcodes bugs in my first post, see the result. I understand your pain....To amend the words of Sheldon Cooper "BBCode thy art a heartless bitch" Link to comment Share on other sites More sharing options...
pr3p Posted July 17, 2013 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 197 Reputation: 13 Joined: 05/14/12 Last Seen: October 29, 2024 Share Posted July 17, 2013 awesome let me try this one Link to comment Share on other sites More sharing options...
Vincent Posted July 17, 2013 Group: Members Topic Count: 130 Topics Per Day: 0.03 Content Count: 528 Reputation: 18 Joined: 09/11/12 Last Seen: March 5, 2020 Share Posted July 17, 2013 Thanks great work. Link to comment Share on other sites More sharing options...
rosfus Posted July 17, 2013 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 75 Reputation: 3 Joined: 04/12/13 Last Seen: August 15, 2014 Share Posted July 17, 2013 great i will try it, thx Link to comment Share on other sites More sharing options...
KeyWorld Posted July 18, 2013 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Author Share Posted July 18, 2013 You're welcome I forget to talk about three known problems related to PHP GD (it sucks !). I show you this problems in only one monster : The Bloody Knight ! Do you see the fire ? There is a white rectangle around. this problems occurs on RGBA images in Sprite files when you try to merge them with the main image. Check the shield, there is a white border around it. When rotating an image it's possible to have this problem : the image border is merging with the transparent background (which is white) and cause this bug. I replace the transparent background by a transparent white background to avoid getting a magenta border (or other flashy border). Check the shield again, poor quality ! Due to image rotation + image scale. The problem n°1 just occurred in some monsters (effects), I don't think there is one hat or character using RGBA frames for now in RO. The problem n°2 and 3 can occurred in all monsters/characters, depend of the scale and rotation. To conclude, PHP GD sucks, I have noone of this problems in javascript (<3). 4 Link to comment Share on other sites More sharing options...
Talaysen Posted July 28, 2013 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 161 Reputation: 5 Joined: 02/07/13 Last Seen: March 25, 2016 Share Posted July 28, 2013 Not sure what I'm doing wrong, I can't get the index (or any other subsequent page) to load. I've edited the data.ini for my GRF, uploaded the grf, and edited index.php with my database details. All I get is a blank white page. :| Link to comment Share on other sites More sharing options...
AngelRO Posted July 28, 2013 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 34 Reputation: 2 Joined: 09/25/12 Last Seen: November 23, 2020 Share Posted July 28, 2013 Not sure what I'm doing wrong, I can't get the index (or any other subsequent page) to load. I've edited the data.ini for my GRF, uploaded the grf, and edited index.php with my database details. All I get is a blank white page. :| Same. Link to comment Share on other sites More sharing options...
Gerome Posted July 29, 2013 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 185 Reputation: 26 Joined: 12/07/11 Last Seen: January 31 Share Posted July 29, 2013 with this tool it helps me to insert the game characters in my site/cp (e.g fluxcp/cerescp). hoping for more updates to come. awesome work! 2 Link to comment Share on other sites More sharing options...
KeyWorld Posted July 29, 2013 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Author Share Posted July 29, 2013 Not sure what I'm doing wrong, I can't get the index (or any other subsequent page) to load. I've edited the data.ini for my GRF, uploaded the grf, and edited index.php with my database details. All I get is a blank white page. :| Same.To spot the error, change this in index.php://ini_set('display_errors', 1); //error_reporting(E_ALL); To: ini_set('display_errors', 1); error_reporting(E_ALL); Maybe a problem with writing access on cache directory, try to change: Cache::$time = 15 * 60 ; // cache for 15 mins (set to 0 if you want to disable cache). To: Cache::$time = 15 * 60 * 0 ; // cache for 15 mins (set to 0 if you want to disable cache). And: Client::$AutoExtract = true ; // If true, client will save extracted files from GRF into the data folder. To: Client::$AutoExtract = false ; // If true, client will save extracted files from GRF into the data folder. 1 Link to comment Share on other sites More sharing options...
AngelRO Posted July 29, 2013 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 34 Reputation: 2 Joined: 09/25/12 Last Seen: November 23, 2020 Share Posted July 29, 2013 (edited) It worked but I can't see my character, the image is blank (but it shows the my name and level). I will double check my grf configuration. Edit: Still no success. Edited July 29, 2013 by AngelRO Link to comment Share on other sites More sharing options...
BBaking Posted July 30, 2013 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 10 Reputation: 0 Joined: 01/21/13 Last Seen: May 8, 2017 Share Posted July 30, 2013 I want nginx rewrite rule. plz. Link to comment Share on other sites More sharing options...
KeyWorld Posted July 30, 2013 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Author Share Posted July 30, 2013 @GeromeI didn't see your post, sorry.Thank you, what are the next updates you want to see in this tool ? @AngelROYeah, check the DATA.INI name and the GRF name, it's maybe case sensitive.If you don't see, PM me and we will do some tests to figure out what's your problem. @BBakingI never use nginx to do rewrite url, but by checking google it should be something like this: server { # basic configs before... # unless the request is for a valid file, send to bootstrap if (!-e $request_filename) { rewrite ^(.*)$ /index.php/$1 last; } # Avoid user to read .htaccess/.htpasswd files location ~ /\.ht { deny all; } } But I have no idea if it will work.@AllI'm planning to do a debug mode (or an installation mode) to help configuring it.If you have some idea for this tool, don't hesitate and share it. 3 Link to comment Share on other sites More sharing options...
ericklucas Posted July 30, 2013 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 3 Reputation: 0 Joined: 09/22/12 Last Seen: November 20, 2013 Share Posted July 30, 2013 Can you post the recommended data (.zip)? I'm having the same problem, the image is blank! Nice work! thanks for has shared Link to comment Share on other sites More sharing options...
Elf0 Posted July 30, 2013 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 23 Reputation: 3 Joined: 01/05/13 Last Seen: February 3, 2021 Share Posted July 30, 2013 (edited) Why not head appears? @edit [Data] 0=sdata.grf File is in the folder Edited July 30, 2013 by Elf0 Link to comment Share on other sites More sharing options...
Talaysen Posted July 31, 2013 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 161 Reputation: 5 Joined: 02/07/13 Last Seen: March 25, 2016 Share Posted July 31, 2013 (edited) For the life of me, I still can't get this to work. >_> I turned on the error reporting, still getting a blank white page, nothing else happens. I downloaded GRF Editor, created a new GRF saved as 0x200, containing a data folder with '/palette', '/sprite', and '/luafiles514' My grf is named correctly in the data.ini (all lowercase), name matches what I named my grf. I've also disabled the cache, disabled AutoExtract, etc. Any suggestions would be appreciated. Edit: When I go to /signature/Talaysen or /avatar/Talaysen, I get: Image cannot be displayed because it contains errors Edit: Alright, I was 'missing' the Cache file, when I uploaded everything, somehow I managed to miss that one. It loads the images accordingly (IE: /avatar/Talaysen) shows my characters avatar. However, the Index page is still blank/white for me. Also, I placed the contents of the GRF directly in the client folder (the data folder with all it's parts), any reason I shouldn't do that, or does it not matter? On this particular server, I also don't have access to anything outside of the web root (this is one of my shared hosting servers), is there anything (security/issues) that I should worry about leaving the client folder in the web root? Edited July 31, 2013 by Talaysen Link to comment Share on other sites More sharing options...
Elf0 Posted July 31, 2013 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 23 Reputation: 3 Joined: 01/05/13 Last Seen: February 3, 2021 Share Posted July 31, 2013 (edited) Sucess HOHOHO! @Edit @KeyWorld Found no bug, the staff is having trouble installing sorry my bad English Edited July 31, 2013 by Elf0 1 Link to comment Share on other sites More sharing options...
KeyWorld Posted July 31, 2013 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Author Share Posted July 31, 2013 @ericklucasI don't have one sorry, I'm using two old bigs outdated GRFs.You can use your own GRF without removing files, it will work if properly repack. But it will be faster if you just have the needed files (all files in data/sprite and data/palette), same thing if you're using the data folder, you can upload the whole data or just upload data/sprite and data/palette. @Elf0Good news @TalaysenThere is no security issue, It's just a problem if you have some files you don't want to share in your data. User can guess the location to this file and download it (I will add .htaccess to deny access from user in the next update).@All and @TalaysenIf you have problem installing the tool, I did an update last night.Install the latest version, configure it, and once it's done open index.php and uncomment this line : // Set on the debug //Debug::enable(); Once it's done all info and errors will be reporting when rendering an image: If you still don't get what the error is, just contact me and I will try to figure what's your problem. 2 Link to comment Share on other sites More sharing options...
Elf0 Posted July 31, 2013 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 23 Reputation: 3 Joined: 01/05/13 Last Seen: February 3, 2021 Share Posted July 31, 2013 (edited) Problems in sprites 3rd Class ... Sorcerer, Minstrel, Genetic Shadow Chaser. Genetic 4071 => "Å©¸®¿¡ÀÌÅÍ", 4078 => "Å©¸®¿¡ÀÌÅÍ", 4107 => "Å©¸®¿¡ÀÌÅÍ", // Genetic Shadow Chaser 4072 => "½ºÅäÄ¿", 4079 => "½ºÅäÄ¿", 4108 => "½ºÅäÄ¿", // Shadow_Chaser The other manually added.. @KeyWorld How to do to display the table of login information? for example 'userid' Edited July 31, 2013 by Elf0 Link to comment Share on other sites More sharing options...
KeyWorld Posted July 31, 2013 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Author Share Posted July 31, 2013 Can someone confirm the 3rd job filename error ?I don't have an updated GRF with 3rd job right now and I don't have the same informations by checking the web.---------------To display the userid in the signature for example ? Open controllers/signature, search for: login.sex, So add here what you want to get: login.sex, login.userid, Go to the render() method, and add: $color = imagecolorallocate($output, 255 /*r*/, 0 /*g*/, 0 /*b*/); imagestring($output, 2, 0 /*x*/, 0 /*y*/, $data['userid'], $color); Link to comment Share on other sites More sharing options...
BBaking Posted July 31, 2013 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 10 Reputation: 0 Joined: 01/21/13 Last Seen: May 8, 2017 Share Posted July 31, 2013 (edited) success. thanks, KeyWorld 성공했습니다. 감사합니다. Hope asks if you support semi-transparent shadows. 희망이 있다면 그림자는 반투명 지원 부탁합니다. Oh, and the front wings and the character will backpack.Please confirm. 아, 그리고 날개나 배낭은 캐릭터 앞을 가립니다.확인부탁드립니다. http://ro.myvnc.com/index.php Edited July 31, 2013 by BBaking Link to comment Share on other sites More sharing options...
KeyWorld Posted July 31, 2013 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Author Share Posted July 31, 2013 @BBakingIt support it, but not properly because of another problem with PHP GD which, instead of outputting some pixels with an alpha value, it merge them with the background (white transparent background).I didn't find a proper way to fix it.You can remove the shadow if you want by editing render/class.CharacterRender.php and commenting this lines: if ( $this->action !== self::ACTION_SIT && $this->action !== self::ACTION_DIE ) $this->renderImage( $img, array( "path" => "data/sprite/shadow", "scale" => DB::get_shadow_factor($view['class']) )); About the robe it should work fine, do you have a problem with it ? Link to comment Share on other sites More sharing options...
Elf0 Posted July 31, 2013 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 23 Reputation: 3 Joined: 01/05/13 Last Seen: February 3, 2021 Share Posted July 31, 2013 Custom ROChargenPHP In PTBR 1 Link to comment Share on other sites More sharing options...
Recommended Posts