(X)Aseco+RASP Website Stats v3.6

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by Ant » 26 Jan 2011 10:57

Ok, those 2 fonts include loads of font files - do you know how I can go about merging them so each download is merged into 1 font?

What I mean is, can all the fonts in the FreeFont download be merged together and can the same be done with Vera ?

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by nocturne » 26 Jan 2011 11:25

The fonts are available in the standard sub-styles -- comparable to tahoma.ttf, tahomait.ttf, tahomawd.ttf, and tahomawdit.ttf. The naming format comes from the usage of the color parser's drawStyledString function, which by default appends 'wd' and 'it' onto the used font's name, in order to render an outputted image in the desired format. Simply rename the font files in the same context, and they should bear the desired effect if used properly. Of course they'd only have effect when using the color parser to draw strings, otherwise you can simply just specify a single default font when drawing to automatically negate any styles such as wide, bold, or italics.

FWIW, need 12 font substyles to render text as it appears in TMF... reg, reg italic, reg bold, reg bold italic, narrow, narrow bold, narrow bold italic, narrow italic, wide, wide bold, wide bold italic, wide italic. By default the color parser disregards narrow tags and pins bold as being the same as wide; which is how you end up with the standard 4 styles.

Edit: And to clarify, FreeFont has 3 complete styles making 3 separate fonts in the most standard of formats -- Serif (like Times New Roman), Sans-Serif (akin to Arial/Tahoma), and Mono Spaced (like Courier). The naming conventions are always dissimilar between fonts, but previewing can easily tell which is which.

Re-Edit: There are a few standard font's with rather open licenses available from MS through their 'core web fonts' initiative, though tahoma isn't included: http://corefonts.sourceforge.net/
Chief Janitorial Supervisor of the Let'sRock! TM community : www.LetsRock-TM.com

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by Ant » 27 Jan 2011 08:42

Thanks for the info and link, I might experiment with this after I know more from Ascender.

User avatar
DogDevil
cyclist
cyclist
Posts: 35
Joined: 21 May 2009 21:25
Owned TM-games: TMUF
Location: Switzerland
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by DogDevil » 28 Jan 2011 04:42

Hello

I have a great Problem
On my Stats-web-site all my banners not working!
Can anyone help me?

the tmfdatafetcher.config.php is correctly edited and in playerstats.php i have edited the line 24 to the ARIALUNI.TTF and this font is in the font directory!

here my stats-web-site
Image ;-) Image
Image ;-) Image

User avatar
w1lla
TM-Patrol
TM-Patrol
Posts: 1466
Joined: 23 May 2007 07:20
Owned TM-games: TMU, TMN, TMF
Manialink(s): intr
Location: Venray

Re: (X)Aseco+RASP Website Stats v3.2

Post by w1lla » 28 Jan 2011 08:37

Go find your problems yourself as it is stated here:

http://www.tmuserver.tk/stat/playerstat ... statsbox=5.

Code: Select all

tmnforever is nations and united makes it special. tmnforever has united. I need united!

User avatar
DogDevil
cyclist
cyclist
Posts: 35
Joined: 21 May 2009 21:25
Owned TM-games: TMUF
Location: Switzerland
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by DogDevil » 28 Jan 2011 08:50

w1lla, sorry, but im atm a noob in programming php... i learn this atm. please help me.
Image ;-) Image
Image ;-) Image

User avatar
DogDevil
cyclist
cyclist
Posts: 35
Joined: 21 May 2009 21:25
Owned TM-games: TMUF
Location: Switzerland
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by DogDevil » 29 Jan 2011 15:44

can't nobody help me?

sorry, but my english is bad
Image ;-) Image
Image ;-) Image

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by Ant » 29 Jan 2011 17:15

In your config.php did you add a space by mistake before the <?php start tag or is there a blank line before it? check this please and report back.

User avatar
DogDevil
cyclist
cyclist
Posts: 35
Joined: 21 May 2009 21:25
Owned TM-games: TMUF
Location: Switzerland
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by DogDevil » 29 Jan 2011 17:40

No, the first line beginning with:<?php
Image ;-) Image
Image ;-) Image

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by Ant » 29 Jan 2011 18:43

Ok, its unlikely that this could be the problem but after the ?> closing tag, can you make sure there is no extra space there too ?

I say its unlikely because your error message
Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\stat\config.php:1) in E:\xampp\htdocs\stat\playerstats.php on line 190

Warning: imagettftext() [function.imagettftext]: any2eucjp(): something happen in E:\xampp\htdocs\stat\playerstats.php on line 198
states the problem is coming from line 1 in config.php which is why I suggested the first check.

Also, can you try this version of playerstats.php please ?

Code: Select all

<?php
/*************************************************
*                                                *
*   Stats for XAseco+RASP                        *
*   __________________________________________   *
*                                                *
*   Copyright (c) 2007-2008 by oS.Cypher         *
*   Developed as a Project of Old School Gaming  *
*                                                *
*   http://www.os-gaming.de                      *
*                                                *
*************************************************/

require("config.php");
require("includes/globals.php");
require("includes/functions.php");
include("languages/".$lang.".php");
require("includes/ColorParser.php");
require("includes/tmfdatafetcher.inc.php");
include("includes/db_connect.php");

$cp = new ColorParser();
$arial = "fonts/tahoma";
$arial2 = "fonts/ARIALUNI.TTF";

/**
* Summary: Strips all display formatting from an input string, suitable for display
*          within the game ('$$' escape pairs are preserved) and for logging
* Params : $input - The input string to strip formatting from
*          $for_tm - Optional flag to double up '$' into '$$' (default, for TM) or not (for logs, etc)
* Returns: The content portions of $input without formatting
* Authors: Bilge/Assembler Maniac/Xymph/Slig
*/

function stripFormatting($input, $for_tm = true) {
    return
        //Replace all occurrences of a null character back with a pair of dollar
        //signs for displaying in TM, or a single dollar for log messages etc.
        str_replace("\0", ($for_tm ? '$$' : '$'),
            //Replace links (introduced in TMU)
            preg_replace(
                '/
                #Strip TMF H, L & P links by stripping everything between each square
                #bracket pair until another $H, $L or $P sequence (or EoS) is found;
                #this allows a $H to close a $L and vice versa, as does the game
                \\$[hlp](.*?)(?:\\[.*?\\](.*?))*(?:\\$[hlp]|$)
                /ixu',
                //Keep the second and third capturing groups if present
                '$1$2',
                //Replace various patterns beginning with an unescaped dollar
                preg_replace(
                    '/
                    #Match a single dollar sign and any of the following:
                    \\$
                    (?:
                        #Strip color codes by matching any hexadecimal character and
                        #any other two characters following it (except $)
                        [0-9a-f][^$][^$]
                        #Strip any incomplete color codes by matching any hexadecimal
                        #character followed by another character (except $)
                        |[0-9a-f][^$]
                        #Strip any single style code (including an invisible UTF8 char)
                        #that is not an H, L or P link or a bracket ($[ and $])
                        |[^][hlp]
                        #Strip the dollar sign if it is followed by [ or ], but do not
                        #strip the brackets themselves
                        |(?=[][])
                        #Strip the dollar sign if it is at the end of the string
                        |$
                    )
                    #Ignore alphabet case, ignore whitespace in pattern & use UTF-8 mode
                    /ixu',
                    //Replace any matches with nothing (i.e. strip matches)
                    '',
                    //Replace all occurrences of dollar sign pairs with a null character
                    str_replace('$$', "\0", $input)
                )
            )
        )
    ;
}

function stripColors($str, $for_tm_drawing = true)
{
	$str2 = str_replace("$", "\001", preg_replace("`[\001\002]`","","a".$str) );

	if($for_tm_drawing)
		$str2 = str_replace("\001\001","$$", $str2);
	else
		$str2 = str_replace("\001\001","$", $str2);

	$str2 = preg_replace("`\001[hlHL]`","\002",$str2);
	$str2 = preg_replace("`\002\[([^\]]*)\]([^\002]*)\002`","$2",$str2);
	$str2 = preg_replace("`\002\[([^\]]*)\]`","",$str2);
	$str2 = str_replace("\002","", $str2);
	$str2 = str_replace('{/LINK}', '</a>', $str2);
	$str2 = preg_replace("`\001([0-9a-fA-F][0-9a-zA-Z][0-9a-zA-Z]|[^\001])`","",$str2);
	$str2 = str_replace("\001","$$", substr($str2,1) );

	return $str2;
}

$timeout = 5;
$fp = @fsockopen($ip2[$serv], $server_port[$serv], $errno, $errstr, $timeout);
if($fp) {
	fclose($fp);
	require("includes/GbxRemote.inc.php");
	$client = new IXR_Client_Gbx;
	if (!$client->InitWithIp($ip[$serv], $port[$serv])) {
   		die('An error occurred - '.$client->getErrorCode().":".$client->getErrorMessage());
	}
	if (!$client->query("Authenticate", $user[$serv], $pass[$serv])) {
		Error($client->getErrorMessage(), $client->getErrorCode());
		print "login failed !<br/>";
	}
	if($client->query('GetServerOptions')) {
		$ServerOptions = $client->getResponse();
		$servername=$ServerOptions['Name'];
		$servername1 = $servername;
		$servername = preg_replace("`\\$(w|s|n|i|z|g|m|r|>|<|o|l|h)`", "", $servername);
		$servername = preg_replace("`\\[[A-Za-z0-9]+\.[A-Za-z0-9]+\.[A-Za-z0-9]+\]`", "", $servername);
		$servername = preg_replace("`\\[[A-Za-z0-9]+\.[A-Za-z0-9]+\-[A-Za-z0-9]+\.[A-Za-z0-9]+\.[A-Za-z0-9]+\]`", "", $servername);
		$servername = preg_replace("`\\$[a-f0-9]{3}`",  "", $servername);
		$servername = preg_replace("`\\$[a-f0-9]{2}`","", $servername);
		$servername = preg_replace("`\\$[a-f0-9]{1}`", "", $servername);
	}
}

$sql = "SELECT * FROM rs_rank ORDER BY avg ASC";
$result = mysql_query($sql);
$rank = 1;

while($data = mysql_fetch_array($result)){
	if($data['playerID'] == $plid) {
		// Player is ranked
		$playerrank = $rank;
		$avg = $data['avg']/10000;
		$avg = sprintf("%.1f", $avg);
		break;
	} else {
		$rank++;
	}
}

if (!isset($playerrank)) {
	// Player is not ranked
	$playerrank = "-";
	$avg = "-";
}

$sql = "SELECT * FROM players WHERE Id=$plid";
$result = mysql_query($sql);
$data = mysql_fetch_array($result);
$playerlogin = $data['Login'];
$fetcher = new TMFDataFetcher($playerlogin);
$playername = $data['NickName'];
$playername1 = $playername;
$playername = preg_replace("`\\$(w|s|n|i|z|g|m|r|>|<|o|l|h)`", "", $playername);
$playername = preg_replace("`\\[[A-Za-z0-9]+\.[A-Za-z0-9]+\.[A-Za-z0-9]+\]`", "", $playername);
$playername = preg_replace("`\\[[A-Za-z0-9]+\.[A-Za-z0-9]+\-[A-Za-z0-9]+\.[A-Za-z0-9]+\.[A-Za-z0-9]+\]`", "", $playername);
$playername = preg_replace("`\\$[a-f0-9]{3}`", "", $playername);
$playername = preg_replace("`\\$[a-f0-9]{2}`", "", $playername);
$playername = preg_replace("`\\$[a-f0-9]{1}`", "", $playername);
$nation = $data['Nation'];
$flag = ($nation ? "img/flags/".$nation.".png" : "img/flags/UKN.png");
$MwTime = $data['TimePlayed'];
$hours = floor($MwTime/3600);
$minutes = floor(($MwTime/60-$hours*60));
$seconds = substr($MwTime-$minutes*60-$hours*3600,-2);
$time = sprintf("%02dh %02dm %02ds", $hours, $minutes, $seconds);



// STATS BANNERS
if($statsbox == 1) {
	//create small Statusgraphic
	Header ("Content-type: image/png");
	$im = ImageCreateFromPNG ("img/statsbox/playerstats_big.png"); // Open of the Master-Picture
	$white = ImageColorAllocate ($im, 255, 255, 255);  // white
	$black = ImageColorAllocate ($im, 0, 0, 0); // black
	$cp->drawStyledString($im, 10, 85, 14, $white, $arial, $playername1." @ ".$servername1);
	//imagettftext($im, 10, 0, 300, 14, $white, $arial2, "@ ".$servername);
	//$cp->drawStyledString($im, 10, 310, 14, $white, $arial, $servername1);
	imagettftext($im, 10, 0, 60, 34, $black, $arial2, $lng_stats_server." ".$lng_trecords_id.": ".$playerrank."    ".$lng_players_avg.": ".$avg);
	imagettftext($im, 10, 0, 60, 54, $black, $arial2, $lng_players_timeplayed.": ".$time);
	$nationflag = imagecreatefrompng($flag);
	imagealphablending($im, 1);
	imagealphablending($nationflag, 1);
	imagecopy($im, $nationflag, 60,4,0,0,18,11);
	ImagePng ($im); // Als PNG ausgeben
	ImageDestroy ($im); // Resourcen freigeben
}

if($statsbox == 2){
	//create small Statusgraphic
	Header ("Content-type: image/png");
	$im = ImageCreateFromPNG ("img/statsbox/playerstats_middle.png"); // Open of the Master-Picture
	$white = ImageColorAllocate ($im, 255, 255, 255);  // white
	$black = ImageColorAllocate ($im, 0, 0, 0); // black
	imagettftext($im, 8, 0, 10, 12, $white, $arial2, $playername." @ ".$lng_stats_server);
	imagettftext($im, 8, 0, 10, 25, $white, $arial2, $servername);
	imagettftext($im, 8, 0, 5, 32, $white, $arial2, "--------------------------------------------------");
	imagettftext($im, 8, 0, 10, 42, $white, $arial2, $lng_stats_server." ".$lng_trecords_id.": ".$playerrank);
	imagettftext($im, 8, 0, 10, 55, $white, $arial2, $lng_players_avg.": ".$avg);
	ImagePng ($im); // Als PNG ausgeben
	ImageDestroy ($im); // Resourcen freigeben
}

if($statsbox == 3){
	//create small Statusgraphic
	Header ("Content-type: image/png");
	$im = ImageCreateFromPNG ("img/statsbox/playerstats_small.png"); // Open of the Master-Picture
	$white = ImageColorAllocate ($im, 255, 255, 255);  // white
	$black = ImageColorAllocate ($im, 0, 0, 0); // black
	imagettftext($im, 7, 0, 110, 9, $white, $arial2, $playername." @ ".$lng_stats_server." ".$servername);
	imagettftext($im, 6, 0, 110, 18, $white, $arial2, $lng_stats_server." ".$lng_trecords_id.": ".$playerrank."  --  ".$lng_players_avg.": ".$avg."  --  ".$lng_players_timeplayed.": ".$time);
	ImagePng ($im); // Als PNG ausgeben
	ImageDestroy ($im); // Resourcen freigeben
}

if($statsbox == 4){
	//create World-TMN Statusgraphic
	Header ("Content-type: image/png");
	$im = ImageCreateFromPNG ("img/statsbox/signature.png"); // Open of the Master-Picture
	$text1 = stripFormatting($fetcher->nickname);
	$white = ImageColorAllocate ($im, 255, 255, 255);  // white
	$black = ImageColorAllocate ($im, 0, 0, 0); // black
	imagettftext($im, 10, 0, 29, 18, $white, $arial2, "Nick: $text1");
	imagettftext($im, 10, 0, 29, 33, $white, $arial2, "Nationrank: $fetcher->nationrank");
	imagettftext($im, 10, 0, 29, 48, $white, $arial2, "Worldrank: $fetcher->worldrank");
	$zonetext = "Homezone: $fetcher->homezone";
	$box = imagettfbbox(10, 0, $arial2, $zonetext);
	imagettftext($im, 10, 0, 29, 63, $white, $arial2, $zonetext);
	imagettftext($im, 10, 0, 29, 80, $white, $arial2, "LP: $fetcher->ladderpoints");
	imagettftext($im, 10, 0, 29, 95, $white, $arial2, $fetcher->nationshort);
	if ($homeflag = getZoneFlag($fetcher->homezoneflagURL, $fetcher->homezone))
		imagecopy($im, $homeflag, 34 + abs($box[2] - $box[0]), 53, 0, 0, 18, 12);
	if ($nationflag = getNationFlag($fetcher->nationiconURL, $fetcher->nationshort))
		imagecopy($im, $nationflag, 60, 85, 0, 0, 18, 12);
	ImagePng ($im);
	ImageDestroy ($homeflag);
	ImageDestroy ($nationflag);
	ImageDestroy ($im);
}

if($statsbox == 5){
	Header ("Content-type: image/png");
	$im = ImageCreateFromPNG ("img/statsbox/signature_player.png"); // Open of the Master-Picture
	$white = ImageColorAllocate ($im, 255, 255, 255);
	$name = stripFormatting($fetcher->nickname);
	$textX = 21;
	$textY = 12;
	$textsize = 9;
	$lineheight = 17;
	imagettftext($im, $textsize, 0, $textY, $textX, $white, $arial2, "Nickname: $name");
	imagettftext($im, $textsize, 0, $textY, $textX+=$lineheight, $white, $arial2, "Nationrank: $fetcher->nationrank");
	imagettftext($im, $textsize, 0, $textY, $textX+=$lineheight, $white, $arial2, "Worldrank: $fetcher->worldrank");
	imagettftext($im, $textsize, 0, $textY, $textX+=$lineheight, $white, $arial2, "Ladderpoints: $fetcher->ladderpoints");
	imagettftext($im, $textsize, 0, $textY, $textX+=$lineheight, $white, $arial2, "Country: $fetcher->nationshort");
	//imagettftext($im, $textsize, 0, 10, $textpos+=$lineheight, $white, $arial2, "Zone: $fetcher->homezone");
	if ($nationflag = $nationflag = getNationFlag($fetcher->nationiconURL, $fetcher->nationshort))
		imagecopy($im, $nationflag, 93, 78, 0, 0, 18, 12);
	//if ($homeflag = $homeflag = getZoneFlag($fetcher->homezoneflagURL, $fetcher->homezone))
	//	imagecopy($im, $homeflag, 118, 78, 0, 0, 12, 12);
	ImagePng ($im);
	//ImageDestroy ($homeflag);
	ImageDestroy ($nationflag);
	ImageDestroy ($im);
}

?>
Make sure you have ARIALUNI.TTF in the fonts directory if you use this code.

User avatar
DogDevil
cyclist
cyclist
Posts: 35
Joined: 21 May 2009 21:25
Owned TM-games: TMUF
Location: Switzerland
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by DogDevil » 29 Jan 2011 19:05

I have the same problem.
No Banners and yes, i have the ARIALUNI.TTF in the fontdirectory (22MB)
Image ;-) Image
Image ;-) Image

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by Ant » 29 Jan 2011 19:08

I just checked your site (after your last post) it doesn't look like you are using that version of playerstats.php that I posted.

User avatar
DogDevil
cyclist
cyclist
Posts: 35
Joined: 21 May 2009 21:25
Owned TM-games: TMUF
Location: Switzerland
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by DogDevil » 29 Jan 2011 19:20

I have change the playerstats.php with your posted playerstats.php
Image ;-) Image
Image ;-) Image

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by Ant » 29 Jan 2011 19:52

Well its just strange that the header lines are still being referenced from the playerstats.php that's included in the download - if you had changed this file I would have expected to at least see a change there.

User avatar
DogDevil
cyclist
cyclist
Posts: 35
Joined: 21 May 2009 21:25
Owned TM-games: TMUF
Location: Switzerland
Contact:

Re: (X)Aseco+RASP Website Stats v3.2

Post by DogDevil » 29 Jan 2011 20:01

no, i have nothing changed...
only i edit the "include/tmfdatafetcher.config.php" and the "config.php" files and i setting the $tmx_info = 2
Image ;-) Image
Image ;-) Image

Post Reply