XML feed with char data

Report issues and ask questions here that need to be answered.
Post Reply
Wimpie
Posts: 7

XML feed with char data

Post by Wimpie »

Dear SmolderForge Team,

I'm planning to make the guild website of "BWL Back-Up Squad" and was planning to give all chars of our guild a banner with their char information so we can put those beneath the forums on wich we are active. With a link to "www.smolderforge.com" so we can promote the server aswell.

I just need a XML feed or a XML look a like feed. If you want this it would be great because I tryed to export the data from the armory just with "file_get_content()" but its just to slow.. and needed to RIP the whole data I needed.

I got a example beneath:

Code: Select all

<?php
// ------------------------
//XML FEED
//MADE BY: Jan Willem
// ------------------------
// Never tested this..

// 	=============================
//		DATABASE
// 	=============================
//Settings from the Server
$db_host = "localhost";
$db_user = "root";
$db_pass = "mangos";
$db_database = "mangos";

// De database connectie zelf
$db_connectie = mysql_connect($db_host, $db_user, $db_pass);
if (!$db_connectie) {
    die('Error: <br><b>' . mysql_error() .'</b>');
}
// Database selecteren
$db_select = mysql_select_db($db_database, $db_connectie);
if (!$db_select) {
    die ('Error: <br><b>' . mysql_error() .'</b>');
}
// 	=============================
//		END DATABASE CONNECTION
// 	=============================


// $_GET['n'] = Name of the player
// $_GET['r'] = The name of the Realm

if(isset($_GET['n']) && isset($_GET['r'])){
	if($_GET['n'] != "" && $_GET['r'] != ""){
		//Uhmm I don't know if it works at all as I don't have a server standing by. But you can ofc edit this.
		//I just seen the Database ERD on forum so thats the only information I got
		//
		
		$mysql_query = mysql_query("SELECT * FROM `characters` WHERE `name` = '".$_GET['n']."'") or print mysql_error();
		if(!mysql_num_rows($mysql_query)){
			$do_query = 0;
			echo "Char: ".$_GET['n']. ", don't existst on realm ".$_GET['r'];
		}
		$data = mysql_fetch_assoc($StatQuery);
		$statistic_data = explode(' ',$data['data']);
		$array_data = array(
			'name' => $data['name'],
			'race' => $data['race'],
			'class' => $data['class'],
			'health' => $statistic_data[28],
			'mana' => $statistic_data[29],
			'rage' => $statistic_data[30],
			'energy' => $statistic_data[32],
			'lvl' => $statistic_data[34],
			'gender' => $statistic_data[36],
			'meele_mainhand_att_time' => $statistic_data[147],
			'meele_offhand_att_time' => $statistic_data[148],
			'range_att_time' => $statistic_data[149],
			'meele_mainhand_min_dmg' => $statistic_data[155],
			'meele_mainhand_max_dmg' => $statistic_data[156],
			'meele_offhand_min_dmg' => $statistic_data[157],
			'meele_offhand_max_dmg' => $statistic_data[158],
			'armor' => $statistic_data[186],
			'holyress' => $statistic_data[187],
			'fireress' => $statistic_data[188],
			'natureress' => $statistic_data[189],
			'frostress' => $statistic_data[190],
			'shadowress' => $statistic_data[191],
			'arcaneress' => $statistic_data[192],
			'melee_apbase' => $statistic_data[210],
			'melee_apbonus' => $statistic_data[211],
			'ranged_apbase' => $statistic_data[213],
			'ranged_apbonus' => $statistic_data[214],
			'ranged_min_dmg' => $statistic_data[216],
			'ranged_max_dmg' => $statistic_data[217],
			'guild' => $statistic_data[237],
			'guidrank' => $statistic_data[238],
			'skilldata' => $statistic_data[928],
			'kills' => $statistic_data[1517],
			'honor' => $statistic_data[1562]
		);
		echo "<pre>";
			print_r($array_data);
		echo "</pre>";
		
		
	}
	else{
		//They left the value's empty
		echo "Error";
	}
}
else{
	//They didn't add n or r in the URL
	echo "Error";
}

?>
I never put it to the test. Because I don't have a server standing by.

If you got any questions or you don't want to do this.. :( or you want my script for the banners afher I made it... just reply on this topic.

Greetings Jan Willem (Wimpie)
EDIT: maybe was beter for Suggestion topic...
User avatar
Henhouse
Administrator
Administrator
Posts: 7855
Location: Sweden
Contact:

Re: XML feed with char data

Post by Henhouse »

The problem is that only the columns name, race and class would be possible to retrieve. I have no idea where you got the rest of the those column names, I'll just guess and say probably ArcEmu or something unrelated to MaNGOS/Trinity structure.

A lot of these variables are stored in the datablob, and many are not used anymore. Stuff like shadow resistance, etc is calculated on login -- not stored.

I believe there was a patch written for mangos to allow the feature of stats to be sent to a separate table specifically for 3rd-party website tools such as this. However, I don't really have an interest in backporting it or taking the time to look it up yet. Especially considering we've yet to extract appropriate data from the data blob yet at Oregon.
Administrator - Project Lead / Server Management / Core Development
Wimpie
Posts: 7

Re: XML feed with char data

Post by Wimpie »

I will look up how the MBA Armory works they have to get their data from somewhere.. as you can see I'm extracting the data with the explode(wich put it in a array and then later I call the number in.)...

I think this should work but if the database structuur is different then ofc not. But I will look up the Armory you use. Because that gives the data corectly only its slow to recieve data from.

Greetings Jan Willem (Wimpie)
I will tell you what I found out.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest