Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

guild mark > html code (php code)

Status
Not open for further replies.
Junior Spellweaver
Loyal Member
Joined
Dec 27, 2004
Messages
108
Reaction score
16
I kinda prefer html over gd2. So here is the function that should ease up the converting of guild logos to a regular display in your web page.

Note that this works with all php versions and does not require the gd2 php extension to be loaded( it has performance issues + it is bigger in output size )

so i've created this little php function that should do the job and decided to share it

Create a file in your web root called sy_mark.php (for example) and fill the following code in it
Note that the code is well commented ^^
PHP:
<?php
/*

[  "MuMark to HTML" Script]
[            Author: Savoy]
[     savoy___@hotmail.com]

*/

// Create the function
function SYlogo($code,$xy=3) {

    // Turn hex into dec
    $code        = urlencode(bin2hex($code));
    $color[0]    = ''; $color[1]='#000000'; $color[2]='#8c8a8d'; $color[3]='#ffffff'; $color[4]='#fe0000'; $color[5]='#ff8a00'; $color[6]='#ffff00'; $color[7]='#8cff01'; $color[8]='#00ff00'; $color[9]='#01ff8d'; $color['a']='#00ffff'; $color['b']='#008aff'; $color['c']='#0000fe'; $color['d']='#8c00ff'; $color['e']='#ff00fe'; $color['f']='#ff008c'; 

    // Set the default zero position.
    $i        = 0; 
    $ii        = 0;

    // Create the table
    $it         = '<table style=\'width: '.(8*$xy).'px;height:'.(8*$xy).'px\' border=0 cellpadding=0 cellspacing=0><tr>';
    
    // Start the logo drawing cycle for each color slot
    while ($i<64) {

        // Get the slot color number
        $place    = $code{$i};

        // Increase the slot
        $i++;$ii++;
        
        // Get the color of the slot

        $add    = $color[$place];

        // Create the slot with its color

        $it     .= '<td class=\'guildlogo\' style=\'background-color: '.$add.';\' width=\''.$xy.'\' height=\''.$xy.'\'></td>';

        // In case we have a new line
        if ($ii==8) { 
            $it .=  '</tr>'; 
            if ($ii != 64) $it .='<tr>';
            $ii =0; 
        }
    }

    // Finish the table off
    $it .= '</table>';

    // What do we output
    return $it;
}
?>

How to use ? Its easy ..
just write down this in a file to test
PHP:
<?php
// Connect to database bullcrap - fill it in 

require 'sy_mark.php';

$guild  = 'TestGuildName'; // Change this to your guild name

// Using a regular query
$query = mssql_query("select [G_Mark] from [Guild] where [G_Name]='".$guild."'");
// Fetching the results as a dec array 
$result  = mssql_fetch_row($query);
// Fetching the first (& only) result - g_mark
$glogo  = $result[0];

// Set a variable with the output text
$mylogo = SYlogo($glogo,3); // You can change 3 with the size (in pixels) you want each slot to have

// You want to display it ???
print $mylogo;

?>

*Tested and working, don't bother to post if you can't get it working - i've explained as well as i can*

All credits for this : Savoy ( I'm a greedy MOFO, sue me, Barby !! )

lalala...
 

Vok

Junior Spellweaver
Joined
Mar 2, 2007
Messages
199
Reaction score
0
Re: [Release] guild mark > html code (php code)

ur the master of html and php. nice release!
 
hello
Loyal Member
Joined
Jun 24, 2004
Messages
726
Reaction score
158
Re: [Release] guild mark > html code (php code)

my congrats savoy, i was wondering for quite long how to do it, then i've abbadoned that idea. My sincere congrats.
 
Legendary Battlemage
Loyal Member
Joined
Nov 3, 2006
Messages
648
Reaction score
2
Re: [Release] guild mark > html code (php code)

Good job man 10/10 for that script :)
 
Experienced Elementalist
Joined
Apr 29, 2007
Messages
260
Reaction score
4
Re: [Release] guild mark > html code (php code)

good work but i like the =Master= guild mark php code more..
 
Newbie Spellweaver
Joined
Nov 6, 2004
Messages
21
Reaction score
0
Re: [Release] guild mark > html code (php code)

thanks, nice release savoy, how about guild creation via web? can you share that too? hehe
 
Junior Spellweaver
Loyal Member
Joined
Dec 27, 2004
Messages
108
Reaction score
16
Re: [Release] guild mark > html code (php code)

good work but i like the =Master= guild mark php code more..
If you are talking about the one that decodes the glogo from a request that is used in muweb..its not coded by master...i saw that in a mutoolz long ago everyone even knew how to do it...
And its not preferable cause GD2 is a messy extension that has its performance issues + a byte-size html loads faster than an image :)
thanks, nice release savoy, how about guild creation via web? can you share that too? hehe

In order something to be shared mustn't it be coded in the first place..why do you need it when you have a good enough guild creation in game ;)
 
Newbie Spellweaver
Joined
Jan 7, 2006
Messages
37
Reaction score
10
Re: [Release] guild mark > html code (php code)

Nice ! I will try run it. THanks for release
 
Status
Not open for further replies.
Back
Top