d2jsp
Log InRegister
d2jsp Forums > d2jsp > Ladder Slasher > How To Make A Dynamic Ladder Slasher Signature > A Guide
Add Reply New Topic New Poll
Member
Posts: 10,965
Joined: Jun 12 2012
Gold: 0.00
Trader: Trusted
Jan 31 2020 01:07am
How To Make A Dynamic Ladder Slasher Stat Signature


Some basic info
This is a guide basically flapmo's guide (located here: https://forums.d2jsp.org/topic.php?t=22792192&f=272) but with a few improvements, updates, and added explanations.


Check your server
To check if your server is able to support this type of signature it needs to have PHP5 or better installed, and it needs to have GD library installed.

In notepad++ (you can use notepad but notepad++ is highly recommended) create a file called info.php5. Paste the following code inside that file:

In the info.php5:
Code
<?php
info();
?>


Save & upload the file to a directory on your webserver.

In your browser, open the info.php5 file (address would look like this: http://www.yourwebspace.com/DirectoryYouUploadedTheFileTo/info.php5)
Look for this:
Quote
gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled


Make sure that GD, and PNG support is enabled and ensure that the GD version is at least 2.0.01.

Help, it doesn't work!
Try the same thing but this time name your file info.php and check again. Your server may not be able to read php5.

If one of these things is missing, please post your issue below and I will answer it so people aren't asking the same questions.

The code:
Copy and paste everything contained within the code box below and save it into a file with a .png.php5 extension. The file would look like this: mysignaturename.png.php5 (it might look like mysignaturename.png and tell you that it is a php5 extension which is fine).

Code
<?php
Header ('Content-type: image/png');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

/******************************************************
* BASICS *
******************************************************/

// create the image from a png image. Replace "yourimage.png" with the file name of the image you would like to use.
$image = imagecreatefrompng('yourimage.png');

// set some colors for future use. The values are RGB (red value, green value, blue value)
$color = imagecolorallocate($image, 242, 53, 249);

// set the font and print text (can use ttf or otf files)
$font = 'yourfont.ttf';

/******************************************************
* LOAD DATA *
******************************************************/

// Create an array for determining the class you play.
// In the XML this is saved as an int number, the conversion is shown below.
$class_name = array( -1 => 'None',
0 => 'Fighter',
1 => 'Barbarian',
2 => 'Rogue',
3 => 'Magician',
4 => 'Guardian',
5 => 'Samurai',
6 => 'Paladin',
7 => 'Monk',
8 => 'Ninja',
9 => 'Warlock',
10 => 'Headhunter',
11=> 'Alchemist');

// This is where you load your own info from the xml d2jsp gives. Replace "yourcharacterid" with
// your character id. Replace "yourguildid" with your guild id. Replace "YourD2JspName" with
// your D2JSP name (case sensitive).
$data = simplexml_load_file('http://ladderslasher.d2jsp.org/xmlChar.php?i=yourcharacterid');
$guild = simplexml_load_file('http://ladderslasher.d2jsp.org/xmlGuild.php?i=yourguildid');
$temp = explode(";",$data->cprof);
foreach ((array) $temp as $value) {
$temp2 = explode(",",$value);
$cprof[(int)$temp2[0]] = (int)$temp2[1];
}
$temp3 = explode(";",$data->wprof);
foreach ((array) $temp3 as $value) {
$temp4 = explode(",",$value);
$wprof[(int)$temp4[0]] = (int)$temp4[1];
}
$temp5 = explode(";",$data->sprof);
foreach ((array) $temp5 as $value) {
$temp6 = explode(",",$value);
$sprof[(int)$temp6[0]] = (int)$temp6[1];
}
$name = $data->name;
$kills = $data->kills;
$class = $class_name[(int)$data->classid];
$exp = $data->exp;
$level = $data->level;
$hpmax = $data->hpmax;
$mqpasses = $data->mqpasses;
$mqattempts = $data->mqattempts;
$exp = (int)$exp;
$gps = getMemberGps($guild, 'YourD2JspName')['gps'];
$sword = $wprof[0];
$club = $wprof[1];
$axe = $wprof[2];
$dagger = $wprof[3];
$staff = $wprof[4];
$longsword = $wprof[5];
$warhammer = $wprof[6];
$battleaxe = $wprof[7];
$spear = $wprof[8];
$polearm = $wprof[9];
$ice = $cprof[0];
$fire = $cprof[1];
$lightning = $cprof[2];
$wind = $cprof[3];
$earth = $cprof[4];
$wheal = $cprof[5];
$heal = $cprof[6];
$focus = $cprof[7];
$fishing = $sprof[0];
$cooking = $sprof[1];
$glyphing = $sprof[2];
$transmuting = $sprof[3];
$suffusencing = $sprof[4];

/******************************************************
* TEXT PART *
******************************************************/

// Example; ImageTTFText ($image, textsize, angle, right indent, down indent, color, font, "text");
// The angle is counted clockwise. The indents are counted by pixels.

// show name
ImageTTFText ($image, 15, 0, 250, 30, $color, $font, "Name: ");
ImageTTFText ($image, 14, 0, 315, 30, $color, $font, $name);

// show class
ImageTTFText ($image, 12, 0, 280, 55, $color, $font, "Class: ");
ImageTTFText ($image, 10, 0, 330, 55, $color, $font, $class);

// show lvl
ImageTTFText ($image, 12, 0, 265, 90, $color, $font, "Level: ");
ImageTTFText ($image, 10, 0, 330, 90, $color, $font, $level);

// show experience
ImageTTFText ($image, 12, 0, 240, 112, $color, $font, "Experience: ");
ImageTTFText ($image, 10, 0, 330, 112, $color, $font, $exp);

// show kills
ImageTTFText ($image, 12, 0, 275, 70, $color, $font, "Kills: ");
ImageTTFText ($image, 10, 0, 330, 70, $color, $font, $kills);

// show max hp
ImageTTFText ($image, 15, 0, 122, 57, $color, $font, "HP: ");
ImageTTFText ($image, 15, 0, 145, 57, $color, $font, $hpmax);

// show MQ passes and attempts
ImageTTFText ($image, 12, 0, 295, 100, $color, $font, "MQ's: ");
ImageTTFText ($image, 10, 0, 345, 100, $color, $font, $mqpasses."/".$mqattempts);

// Whatever words you might want to display
ImageTTFText ($image, 15, 0, 122, 82, $color, $font, "Whatever");
ImageTTFText ($image, 15, 0, 122, 95, $color, $font, "You Want");

// Show guild points
ImageTTFText ($image, 12, 0, 260, 140, $color, $font, "Guild GPs: ");
ImageTTFText ($image, 10, 0, 375, 140, $color, $font, $gps);

// Show proficiencies
ImageTTFText ($image, 8, 0, 15, 99, $color, $font, $sword); // sword
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $club); // club
ImageTTFText ($image, 10, 0, 7, 26, $color, $font, $axe); // axe
ImageTTFText ($image, 10, 0, 28, 26, $color, $font, $dagger); // dagger
ImageTTFText ($image, 8, 0, 270, 125, $color, $font, $staff); // staff
ImageTTFText ($image, 8, 0, 270, 125, $color, $font, $longsword); // longsword
ImageTTFText ($image, 8, 0, 270, 125, $color, $font, $warhammer); // warhammer
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $battleaxe); // battleaxe
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $spear); // spear
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $polearm); // polearm
ImageTTFText ($image, 10, 0, 54, 26, $color, $font, $ice); // ice
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $fire); // fire
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $lightning); // lightning
ImageTTFText ($image, 8, 0, 46, 139, $color, $font, $wind); // wind
ImageTTFText ($image, 10, 0, 80, 26, $color, $font, $earth); // earth
ImageTTFText ($image, 8, 0, 15, 79, $color, $font, $wheal); // wild heal
ImageTTFText ($image, 10, 0, 106, 26, $color, $font, $heal); // heal
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $focus); // focus heal
ImageTTFText ($image, 8, 0, 46, 79, $color, $font, $fishing); // fishing
ImageTTFText ($image, 8, 0, 15, 119, $color, $font, $cooking); // cooking
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $glyphing); // glyphing
ImageTTFText ($image, 8, 0, 46, 119, $color, $font, $transmuting); // transmuting
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $suffusencing); // suffusencing

// output and destroy
imagepng($image);
imagedestroy($image);


/******************************************************
* FUNCTIONS *
******************************************************/

/***
* Calculate member GPS
***/

function getMemberGps($guild, $name) {
foreach ($guild as $member) {
if (reset($member['name']) === $name) {
return reset($member);
}
}

return false;
}

?>


Just place "//" before the line of any stat you do not wish to display.


Getting everything on the server:
As of now, you should have atleast three files:
1. yoursignature.png.php5
2. yourimage.png
3. yourfont.ttf (You can get these from any font sites. I use dafont.)

We need to create a fourth file named: .htaccess (no extension .txt behind it!). Within the file write:
Code
Options MultiViews

and save the file.
What this does is it tells the directory that the .htaccess file is saved to that files within the directory can be read in multiple ways.

Now, upload the following files into one directory:
1. mysignaturename.png.php5
2. .htaccess
3. yourimage.png
4. yourfont.ttf

Now you can reference your image by using the .png extension (or .png.php5 extension if wanted). So it would be on http://www.yourwebspace.com/DirectoryYouUploadedFilesTo/mysignaturename.png.


That's it!

Please, if you have any questions, feel free to post them below. I will answer them as soon as I can. :)
Member
Posts: 16,117
Joined: Aug 2 2006
Gold: 123,360.09
Jan 31 2020 02:00am
Very nice :o
Retired Moderator
Posts: 13,352
Joined: May 10 2007
Gold: 25,002.69
Trader: Trusted
Jan 31 2020 12:12pm
Great guide, nice work :)

:thumbsup:
Member
Posts: 5,753
Joined: Dec 26 2007
Gold: 10,400.72
Jan 31 2020 02:35pm
Thanks for posting such a useful guide :D
Member
Posts: 10,965
Joined: Jun 12 2012
Gold: 0.00
Trader: Trusted
Jan 31 2020 03:57pm
Quote (Formee @ Jan 30 2020 10:00pm)
Very nice :o


Quote (MikeG99 @ Jan 31 2020 08:12am)
Great guide, nice work :)

:thumbsup:


Quote (bdan @ Jan 31 2020 10:35am)
Thanks for posting such a useful guide :D


Thanks and of course.

Also, if anyone is stuck on something or having trouble with anything, feel free to post below or pm me and I will help you with it ASAP :thumbsup:
Member
Posts: 10,965
Joined: Jun 12 2012
Gold: 0.00
Trader: Trusted
Feb 5 2020 02:57pm
If anyone would like the code for exp bar showing % to mq, lmk.
Go Back To Ladder Slasher Topic List
Add Reply New Topic New Poll