Jump to content
KeyWorld

ROChargenPHP - Free PHP Character Viewer

Recommended Posts

Happy to see you like it ! :)

 

 

where can i put the custom display can someone teach me

 

Without using the core files and controllers, you have to do this (good to build a char simulator as ratemyserver has) :

<?php
 
define('__ROOT__', dirname(__FILE__) . '/'); 
 
 
// Loading CORE files
require_once( __ROOT__ . 'core/class.Controller.php');
require_once( __ROOT__ . 'core/class.Cache.php');
require_once( __ROOT__ . 'core/class.Client.php');
require_once( __ROOT__ . 'core/class.DB.php');
 
 
// Initialize the client (load GRF, load DB, etc.)
Client::init();
 
 
// What do you want to display ?
// Full Character ?
// So include the render needed
require_once(  __ROOT__ . 'render/class.CharacterRender.php' );
 
 
// Set up the header
header('Content-type:image/png');
 
// Since you use class.CharacterRender, use it :
$chargen                 = new CharacterRender();
 
// Set your datas here
$chargen->action         = CharacterRender::ACTION_READYFIGHT;   // You can see constants in
$chargen->direction      = CharacterRender::DIRECTION_SOUTHEAST; // render/class.RORender.php
$chargen->body_animation = 0;
$chargen->doridori       = 0;
$chargen->sex            = "M";
$chargen->class          = 4002;
$chargen->clothes_color  = 0;
$chargen->hair           = 5;
$chargen->hair_color     = 12;
$chargen->head_top       = 0;
$chargen->head_mid       = 0;
$chargen->head_bottom    = 0;
$chargen->weapon         = 0;
$chargen->shield         = 0;
$chargen->robe           = 0;
$chargen->option         = 0;
 
 
// Generate the image and display it
$img = $chargen->render();
imagepng($img);
 
?>

Share this post


Link to post
Share on other sites

why i cant see the avatar of my character?

 

Maybe it can't connect to your DB, or you don't have any files set in the client folder ?

Try using the debug mode, uncomment the two lines in index.php to know if there is an error:

ini_set('display_errors', 1);
error_reporting(E_ALL);

Edited by KeyWorld

Share this post


Link to post
Share on other sites

Ok so it's a problem of data.

You have to put a data folder with all your sprites and palette on client/data/.

Or add your GRFs in client/ and modify data.ini with your grf files to load.

 

If you don't have data, it can't render anything.

Share this post


Link to post
Share on other sites

GMs accounts are supported but don't render the GM skin (just the basic job).

Try to remove the cache (index.php) during the test:

Cache::$time = 15 * 60 ; // cache for 15 mins (set to 0 if you want to disable cache).

 

Set it to 0, so if there is a change, you will see it in an instant instead of waiting 15 minutes.

Try to check that your data files are in the proper location.

 

You can also add a little check on core/class.Client.php to see if some files are not properly loaded:

Replace:

 return "data://application/octet-stream;base64," . base64_encode($content);
}
}

return false;
}

 

By

 return "data://application/octet-stream;base64," . base64_encode($content);
}
}
header('Content-type:text/plain');
exit("Exiting. File not found {$local_path}.");
return false;
}

Share this post


Link to post
Share on other sites

Awesome! Thank you very much KeyWorld!

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 !

 1268.png

[*]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).

Share this post


Link to post
Share on other sites

Addded a debug mode to trace errors in the latest version if you have problem installing it.

Just open index.php and uncomment the line:

// Set on the debug//Debug::enable();

Once it's done you will have access to all debugs, infos and errors:

 


debug.png

 

 

Hope it helps :)

Share this post


Link to post
Share on other sites

awesome release Keyword ^_^ ... where to upload the grf's?

Edited by pr3p

Share this post


Link to post
Share on other sites

awesome release Keyword ^_^ ... where to upload the grf's?

 

Thank you :)

You have to upload it in the client folder (and complete the data.ini file).

Share this post


Link to post
Share on other sites

Updates :

  • [*]Correct 3rd job file name. [*]Robes are now fully working (it was missing the inherent job list). [*]Background color can be change in RORender::$background_color. [*]Add htaccess to avoid access to client directory (if you have content you don't want to share...)

 

Suggestions ? Bugs ? Problems ? Report it :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.