You are not logged in.

#126 11 Aug 2008 1:47 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Hmmm, it wouldn't crash if I had the stats on seperate pages and just included the pages would it? I still cannot get the array merge to work, so I think it's time for more alternative approaches.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#127 11 Aug 2008 3:26 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

see if this does anything different:

Code:

function _get_stats() {        
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
    $results = $this->_query_ea($url);
    $this->stats = $this->_get_result_set($results);
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=mtm-,mwn-,mls-";
    $results = $this->_query_ea($url);
    $map_info = $this->_get_result_set($results);
    $this->stats = array_merge($this->stats, $map_info);    
    $stats_keys = array("mbr-0", "mbr-1", "mbr-2", "mbr-3", "mbr-4", "mbr-5", "mbr-6", "mbr-12", "mbr-100", "mbr-101", "mbr-102", "mbr-103", "mbr-105", "mbr-300", "mbr-301", "mbr-302", "mbr-303", "mbr-304", "mbr-305", "mbr-306", "mbr-307", "mbr-601", "mbr-602", "mwn-0", "mwn-1", "mwn-2", "mwn-3", "mwn-4", "mwn-5", "mwn-12", "mwn-100", "mwn-101", "mwn-102", "mwn-103", "mwn-105", "mwn-300", "mwn-301", "mwn-302", "mwn-303", "mwn-304", "mwn-305", "mwn-306", "mwn-307", "mwn-601", "mwn-602", "mls-0", "mls-1", "mls-2", "mls-3", "mls-4", "mls-5", "mls-12", "mls-100", "mls-101", "mls-102", "mls-103", "mls-105",  "mls-300", "mls-301", "mls-302", "mls-303", "mls-304", "mls-305", "mls-306", "mls-307", "mls-601", "mls-602", "mtm-0", "mtm-1", "mtm-2", "mtm-3", "mtm-4", "mtm-5", "mtm-12", "mtm-100", "mtm-101", "mtm-102", "mtm-103", "mtm-105",  "mtm-300", "mtm-301", "mtm-302", "mtm-303", "mtm-304", "mtm-305", "mtm-306", "mtm-307", "mtm-601", "mtm-602", "mcm-0", "mcm-1", "mcm-2", "mcm-3", "mcm-4", "mcm-5", "mcm-12", "mcm-100", "mcm-101", "mcm-102", "mcm-103", "mcm-105", "mcm-300", "mcm-301", "mcm-302", "mcm-303", "mcm-304", "mcm-305", "mcm-306", "mcm-307", "mcm-601", "mcm-602", "mic-0", "mic-1", "mic-2", "mic-3", "mic-4", "mic-5", "mic-12", "mic-100", "mic-101", "mic-102", "mic-103", "mic-105", "mic-300", "mic-301", "mic-302", "mic-303", "mic-304", "mic-305", "mic-306", "mic-307", "mic-601", "mic-602");
    foreach($stats_keys as $k) {
        if(!isset($this->stats[$k])) $this->stats[$k] = 0;
    }
    $url = "";
}

Offline

 

#128 12 Aug 2008 8:49 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Yeah, he gives me an Parse error: syntax error, unexpected '=' on if(!isset($this->stats[$k])) = $this->stats[$k] = 0;. Not really sure why, both $this->stats and $k are referenced in the function.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#129 12 Aug 2008 9:08 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

oops, had an error there.  remove the = character in between "$k]))" and "$this"

I edited my previous code block if that helps.

Offline

 

#130 12 Aug 2008 9:37 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Hmmm, it still returns most of them as 0, but he still parses the original map variables.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#131 12 Aug 2008 11:35 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

if there are no stats for a particular field, it will no be included in the query results.  in order for smarties to correctly display variables, you have to make sure there are elements in the array that match all your smarty tags.  we assign them to 0 to make sure they exist in the array you're using to fill out the fields.  if the info is missing from the original query, then data will be missing.  do these happen to be results that are returned from that second query?  if not you may have to include the 3rd and final query (that the game makes when you look at stats in game).

Offline

 

#132 12 Aug 2008 11:43 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Yes, it is everything in the second query. I'd dare to say that it either isn't coming through (query doesn't get an answer), or that the smarty tags are not working (but aren't the smarty tags assigned from this array alltogether?).


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#133 12 Aug 2008 1:57 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

I think it depends on how you set it up.

best way to test it is to create a page similar to the bf2 one that uses a static array (where you specify the key/values yourself) and see how it turns out.

Offline

 

#134 13 Aug 2008 8:40 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

So, basically get all values I want and run them in one query?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#135 13 Aug 2008 11:12 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

I was thinking more along the lines of creating an array by hand (not from the bf2 stats), and creating a smarty template and see what the results are.  that way you control both ends of the page creation (both the array being parsed by smarty's and the smarty code itself)

Offline

 

#136 13 Aug 2008 12:22 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Hmmm, don't think I've ever written an array before, I've only seen the output of it. Seems like it is just a variable and a number in brackets, like:

$array[0] = 'Butcher';
$array[1] = 'car';
$array[2] = 'walks';
$array[3] = 'grilled chicken!';

So echo "' . $array[0] . ' can't afford a ' . $array[1] . ', so he ' . $array[2] . ' a lot, and he likes to eat ' . $array[3] . '"; should do Butcher can't afford a car, so he walks a lot, and he likes to eat grilled chicken. (Thats my "remember how to array" explanation, in case I forget it again, lol) But how do I use smarty with this array? Their documentation is mildly confusing, but it seems I somehow just assign a variable to a smarty variable, and then the smarty variable is replaced when the page is parsed?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#137 13 Aug 2008 12:56 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

it would be something like this (where your keys are the names of your smarty tags).

Code:

$test = array(
    "key1"=>"value1",
    "key2"=>"value2",
    "key5..."=>4);

I'm assuming at some point smarty breaks out the array into individual variables w/ something like extract

so that your smarty tags reference ${key1}, ${key2} and so on.

Offline

 

#138 13 Aug 2008 2:29 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Ok, did a test using this:
test2.php:

Code:

<?php
$stats_keys = array(
"key1" => "jalla2",
"key2" => "satan2",
"key3" => "woof",
);
//foreach($stats_keys as $k) {
//if(!isset($this->stats[$k])) $this->stats[$k] = 0;
//}
$file_contents = file_get_contents('templates/jall.tpl');
foreach ($stats_keys as $k => $v) {
$file_contents = str_replace('${'.$k.'}', '${'.$v.'}', $file_contents);
}
echo $file_contents;
?>

jall.tpl:

Code:

<html>
<body>
${key1}
<br>
${key2}
<br>
${key3}
</body>
</html>

echoes to:

Code:

${jalla2} 
${satan2} 
${woof}

So I guess I discovered how it goes from array to smarty variable (copied functions from index.php and bf2_player.php, and tested through it until I got this). But somehow along the process, I lost track of what I am looking for... How does this tell me anything about half the map information missing?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#139 13 Aug 2008 2:49 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

lol, no use smarty for the test page, we know it will work if we replace things ourselves.

keep what you have but use smarty to process the template.

Offline

 

#140 13 Aug 2008 3:06 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Ok, it does actually, running on the original tpl (though copied to a new file for harrassing).

test3.php:

Code:

<?php
$stats_keys = array(
    "asof" => 1218637793,
    "pid" => 43344896,
    "nick" => "=[BC]=Butcher",
    "scor" => 68481,
    "jond" => 1118441340,
    "wins" => 1748,
    "loss" => 1259,
    "mode0" => 3007,
    "mode1" => "JALL",
    "mode2" => "JALL",
    "time" => 2327332,
    "smoc" => "JALL",
    "cmsc" => 44288,
    "osaa" => 19,
    "kill" => 22144,
    "kila" => 2751,
    "deth" => 21058,
    "suic" => 531,
    "bksk" => 57,
    "wdsk" => 16,
    "tvcr" => 43543570,
    "topr" => 44006598,
    "klpm" => 0.57,
    "dtpm" => 0.54,
    "ospm" => 1.77,
    "klpr" => 7.36,
    "dtpr" => 7.00,
    "twsc" => 19651,
    "cpcp" => 3566,
    "cacp" => 2602,
    "dfcp" => 964,
    "heal" => 554,
    "rviv" => 984,
    "rsup" => 1519,
    "rpar" => 71,
    "tgte" => "JALL",
    "dkas" => "JALL",
    "dsab" => 4695,
    "cdsc" => 9796,
    "rank" => 12,
    "kick" => 33,
    "bbrs" => 174,
    "tcdr" => 251095,
    "ban" => "JALL",
    "lbtl" => 1218565680,
    "vrk" => "JALL",
    "tsql" => 646926,
    "tsqm" => 1185757,
    "tlwf" => 242395,
    "mvks" => 10,
    "vmks" => 7,
    "mvns" => "[GB33]Sledge",
    "mvrs" => 16,
    "vmns" => "Phil-ganja",
    "vmrs" => 8,
    "fkit" => 4,
    "fmap" => 4,
    "fveh" => 3,
    "fwea" => 2,
    "tnv" => "JALL",
    "tgm" => "JALL",
    "wtm-0" => 225518,
    "wtm-1" => 17582,
    "wtm-2" => 325384,
    "wtm-3" => 65489,
    "wtm-4" => 226745,
    "wtm-5" => 69462,
    "wtm-6" => 77953,
    "wtm-7" => 47938,
    "wtm-8" => 94468,
    "wtm-9" => 14419,
    "wtm-10" => 8429,
    "wtm-11" => 91192,
    "wtm-12" => 51161,
    "wtm-13" => 827,
    "wkl-0" => 2714,
    "wkl-1" => 190,
    "wkl-2" => 1782,
    "wkl-3" => 340,
    "wkl-4" => 1164,
    "wkl-5" => 318,
    "wkl-6" => 610,
    "wkl-7" => 329,
    "wkl-8" => 871,
    "wkl-9" => 365,
    "wkl-10" => 3,
    "wkl-11" => 1697,
    "wkl-12" => 1227,
    "wkl-13" => "JALL",
    "wdt-0" => 2875,
    "wdt-1" => 255,
    "wdt-2" => 3562,
    "wdt-3" => 687,
    "wdt-4" => 1689,
    "wdt-5" => 737,
    "wdt-6" => 1047,
    "wdt-7" => 562,
    "wdt-8" => 1188,
    "wdt-9" => 261,
    "wdt-10" => 231,
    "wdt-11" => 1171,
    "wdt-12" => 754,
    "wdt-13" => 1,
    "wac-0" => 19,
    "wac-1" => 47,
    "wac-2" => 19,
    "wac-3" => 13,
    "wac-4" => 39,
    "wac-5" => 12,
    "wac-6" => 39,
    "wac-7" => 16,
    "wac-8" => 9,
    "wac-9" => 10,
    "wac-10" => 66,
    "wac-11" => 22,
    "wac-12" => 25,
    "wac-13" => "JALL",
    "wkd-0" => "118:125",
    "wkd-1" => "38:51",
    "wkd-2" => "891:1781",
    "wkd-3" => "340:687",
    "wkd-4" => "388:563",
    "wkd-5" => "318:737",
    "wkd-6" => "610:1047",
    "wkd-7" => "329:562",
    "wkd-8" => "871:1188",
    "wkd-9" => "365:261",
    "wkd-10" => "1:77",
    "wkd-11" => "1697:1171",
    "wkd-12" => "1227:754",
    "wkd-13" => "0:1",
    "vtm-0" => 137588,
    "vtm-1" => 139917,
    "vtm-2" => 26626,
    "vtm-3" => 323922,
    "vtm-4" => 199152,
    "vtm-5" => "JALL",
    "vtm-6" => 3647,
    "vkl-0" => 2086,
    "vkl-1" => 1918,
    "vkl-2" => 319,
    "vkl-3" => 3534,
    "vkl-4" => 1723,
    "vkl-5" => "JALL",
    "vkl-6" => 61,
    "vdt-0" => 774,
    "vdt-1" => 1051,
    "vdt-2" => 187,
    "vdt-3" => 2361,
    "vdt-4" => 1708,
    "vdt-5" => "JALL",
    "vdt-6" => 64,
    "vkd-0" => "1043:387",
    "vkd-1" => "1918:1051",
    "vkd-2" => "29:17",
    "vkd-3" => "1178:787",
    "vkd-4" => "1723:1708",
    "vkd-5" => "JALL",
    "vkd-6" => "61:64",
    "vkr-0" => 183,
    "vkr-1" => 160,
    "vkr-2" => 36,
    "vkr-3" => 392,
    "vkr-4" => 496,
    "vkr-5" => "JALL",
    "vkr-6" => 3,
    "atm-0" => 1190785,
    "atm-1" => 591293,
    "atm-2" => 452830,
    "atm-3" => 3146,
    "atm-4" => 24819,
    "atm-5" => 14514,
    "atm-6" => 11653,
    "atm-7" => 8765,
    "atm-8" => 27728,
    "atm-9" => "JALL",
    "awn-0" => 977,
    "awn-1" => 374,
    "awn-2" => 336,
    "awn-3" => 6,
    "awn-4" => 23,
    "awn-5" => 10,
    "awn-6" => "JALL",
    "awn-7" => 6,
    "awn-8" => 15,
    "awn-9" => "JALL",
    "alo-0" => 633,
    "alo-1" => 340,
    "alo-2" => 226,
    "alo-3" => "JALL",
    "alo-4" => 11,
    "alo-5" => 12,
    "alo-6" => 14,
    "alo-7" => 5,
    "alo-8" => 18,
    "alo-9" => "JALL",
    "abr-0" => 113,
    "abr-1" => 164,
    "abr-2" => 130,
    "abr-3" => 29,
    "abr-4" => 144,
    "abr-5" => 35,
    "abr-6" => 48,
    "abr-7" => 108,
    "abr-8" => 174,
    "abr-9" => "JALL",
    "ktm-0" => 297022,
    "ktm-1" => 121906,
    "ktm-2" => 103828,
    "ktm-3" => 352201,
    "ktm-4" => 666088,
    "ktm-5" => 171743,
    "ktm-6" => 471909,
    "kkl-0" => 3029,
    "kkl-1" => 1286,
    "kkl-2" => 1121,
    "kkl-3" => 3955,
    "kkl-4" => 6351,
    "kkl-5" => 1520,
    "kkl-6" => 4882,
    "kdt-0" => 3279,
    "kdt-1" => 1404,
    "kdt-2" => 855,
    "kdt-3" => 3827,
    "kdt-4" => 6335,
    "kdt-5" => 1407,
    "kdt-6" => 3951,
    "kkd-0" => "3029:3279",
    "kkd-1" => "643:702",
    "kkd-2" => "59:45",
    "kkd-3" => "3955:3827",
    "kkd-4" => "6351:6335",
    "kkd-5" => "1520:1407",
    "kkd-6" => "4882:3951",
    "de-6" => 712,
    "de-7" => 405,
    "de-8" => 48,
    "mtm-0" => 224793,
    "mtm-1" => 249208,
    "mtm-2" => 34901,
    "mtm-3" => 28819,
    "mtm-4" => 299987,
    "mtm-5" => 243059,
    "mtm-6" => 71400,
    "mtm-100" => 207564,
    "mtm-101" => 197161,
    "mtm-102" => 237097,
    "mtm-103" => 25427,
    "mtm-104" => "JALL",
    "mtm-105" => 106324,
    "mtm-601" => 203121,
    "mtm-300" => 20,
    "mtm-301" => 6032,
    "mtm-302" => 8110,
    "mtm-303" => 42416,
    "mtm-304" => 8747,
    "mtm-305" => 10437,
    "mtm-306" => 8697,
    "mtm-307" => 7856,
    "mtm-10" => "JALL",
    "mtm-11" => "JALL",
    "mtm-110" => "JALL",
    "mtm-200" => "JALL",
    "mtm-201" => "JALL",
    "mtm-202" => "JALL",
    "mtm-12" => 105202,
    "mwn-0" => 181,
    "mwn-1" => 211,
    "mwn-2" => 20,
    "mwn-3" => 33,
    "mwn-4" => 213,
    "mwn-5" => 146,
    "mwn-6" => 50,
    "mwn-100" => 151,
    "mwn-101" => 159,
    "mwn-102" => 138,
    "mwn-103" => 19,
    "mwn-104" => "JALL",
    "mwn-105" => 88,
    "mwn-601" => 170,
    "mwn-300" => "JALL",
    "mwn-301" => 5,
    "mwn-302" => 7,
    "mwn-303" => 27,
    "mwn-304" => 1,
    "mwn-305" => 4,
    "mwn-306" => 9,
    "mwn-307" => 7,
    "mwn-10" => "JALL",
    "mwn-11" => "JALL",
    "mwn-110" => "JALL",
    "mwn-200" => "JALL",
    "mwn-201" => "JALL",
    "mwn-202" => "JALL",
    "mwn-12" => 107,
    "mls-0" => 85,
    "mls-1" => 135,
    "mls-2" => 20,
    "mls-3" => 11,
    "mls-4" => 163,
    "mls-5" => 150,
    "mls-6" => 34,
    "mls-100" => 135,
    "mls-101" => 142,
    "mls-102" => 115,
    "mls-103" => 12,
    "mls-104" => "JALL",
    "mls-105" => 49,
    "mls-601" => 98,
    "mls-300" => 1,
    "mls-301" => 4,
    "mls-302" => 5,
    "mls-303" => 22,
    "mls-304" => 9,
    "mls-305" => 11,
    "mls-306" => 3,
    "mls-307" => 5,
    "mls-10" => "JALL",
    "mls-11" => "JALL",
    "mls-110" => "JALL",
    "mls-200" => "JALL",
    "mls-201" => "JALL",
    "mls-202" => "JALL",
    "mls-12" => 50,
    "mbr-0" => "JALL",
    "mbr-1" => "JALL",
    "mbr-2" => "JALL",
    "mbr-3" => "JALL",
    "mbr-4" => "JALL",
    "mbr-5" => "JALL",
    "mbr-6" => "JALL",
    "mbr-12" => "JALL",
    "mbr-100" => "JALL",
    "mbr-101" => "JALL",
    "mbr-102" => "JALL",
    "mbr-103" => "JALL",
    "mbr-105" => "JALL",
    "mbr-300" => "JALL",
    "mbr-301" => "JALL",
    "mbr-302" => "JALL",
    "mbr-303" => "JALL",
    "mbr-304" => "JALL",
    "mbr-305" => "JALL",
    "mbr-306" => "JALL",
    "mbr-307" => "JALL",
    "mbr-601" => "JALL",
    "mbr-602" => "JALL",
    "mwn-602" => "JALL",
    "mls-602" => "JALL",
    "mtm-602" => "JALL",
    "mcm-0" => "JALL",
    "mcm-1" => "JALL",
    "mcm-2" => "JALL",
    "mcm-3" => "JALL",
    "mcm-4" => "JALL",
    "mcm-5" => "JALL",
    "mcm-12" => "JALL",
    "mcm-100" => "JALL",
    "mcm-101" => "JALL",
    "mcm-102" => "JALL",
    "mcm-103" => "JALL",
    "mcm-105" => "JALL",
    "mcm-300" => "JALL",
    "mcm-301" => "JALL",
    "mcm-302" => "JALL",
    "mcm-303" => "JALL",
    "mcm-304" => "JALL",
    "mcm-305" => "JALL",
    "mcm-306" => "JALL",
    "mcm-307" => "JALL",
    "mcm-601" => "JALL",
    "mcm-602" => "JALL",
    "mic-0" => "JALL",
    "mic-1" => "JALL",
    "mic-2" => "JALL",
    "mic-3" => "JALL",
    "mic-4" => "JALL",
    "mic-5" => "JALL",
    "mic-12" => "JALL",
    "mic-100" => "JALL",
    "mic-101" => "JALL",
    "mic-102" => "JALL",
    "mic-103" => "JALL",
    "mic-105" => "JALL",
    "mic-300" => "JALL",
    "mic-301" => "JALL",
    "mic-302" => "JALL",
    "mic-303" => "JALL",
    "mic-304" => "JALL",
    "mic-305" => "JALL",
    "mic-306" => "JALL",
    "mic-307" => "JALL",
    "mic-601" => "JALL",
    "mic-602" => "JALL",
);
$file_contents = file_get_contents('templates/jall2.tpl');
foreach ($stats_keys as $k => $v) {
$file_contents = str_replace('${'.$k.'}', ''.$v.'', $file_contents);
}
echo $file_contents;
?>

Yeah, I know that was a ridiculous amount of code, I copied the array and just commented it right to make it work. He does infact parse the variables (I changed the amount from 0 to JALL). You can see it at http://www.bamboocommandos.com/bf2stats/test3.php, that at least proves that smarty is working. Something wrong with the query result then?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#141 14 Aug 2008 7:18 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

is that the same bit of code running on your other page that's not working right?  that code is my simple template system not smarty.  w/ smarty you can do a lot more from within the template.

it lets you add variables, formatting, and flow control logic (foreach, if, ...).  If you're going to do your pages w/ templates I'd highly suggest you use their engine instead.

instead of adding all the keys to the stats array, w/ smarty's you can do something like this in the template:

Code:

<html>
<!-- other code removed ... -->
<div class="leftrow">
{if !isset($bf2_player->stats['mtm-0'])}Never Played
{else} {$bf2_player->stats['mtm-0']}
{/if}
</div></html>

Offline

 

#142 14 Aug 2008 7:36 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Thats modified code, ripping apart the array. I like the current way, it's simple to edit and simple to maintain, only issue is that I still haven't gotten the query results to work. As you say it's a simple template system you made, did you store exact template variables somewhere, so I need to add the new map variables somewhere to have them work?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#143 14 Aug 2008 7:54 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

for each ${key} in your template there should be a matching "key" index in the bf2_player->stats array (ex: $bf2_player->stats["key"]).  any values you add to the stats array will become available in your template, for example if you calculate the progress in % of a player from one rank to the next, you can create an entry in the stats array (ex $bf2_player->stats["percentage_rank"] = $some_calculated_value;) and add an entry in your template (ex: ${percentage_rank}) and its value will be placed into the resulting page.

all stats results should come back from gamespy for maps if you've played them.  if you have variables in your template that don't exist in the stats array, they'll be left in the page in the ${key} form.  this was the only reason I suggested filling the array w/ the results prior to pulling stats from gamespy.

if you see the individual stats in the raw display of the data pulled from gamespy but they're not showing up in the template then there's a bug in the way we're searching for the variables (perhaps a regex replace would be better). but if they're just not coming back from the query then its gamespy's problem and there's not much anyone can do about it.

Offline

 

#144 15 Aug 2008 5:41 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

I tried testing it manually, putting the whole query into my web browser, and it returns nothing. But the examplified;

Code:

http://bf2web.gamespy.com/ASP/getplayerinfo.aspx?pid=43861616&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-

Returns everything in it, so it definately is not possible running it all in one query, and it seems many people have their doubts about merging arrays (did some googling). I'm gonna see if it is effective running the queries seperately (rather than in one array).

For example, I can run this:

Code:

http://bf2web.gamespy.com/ASP/getplayerinfo.aspx?pid=43344896&info=mtm-,mwn-,mls-

But not this:

Code:

http://bf2web.gamespy.com/ASP/getplayerinfo.aspx?pid=43344896&info=mbr-,mcm-,mic-

So obviously Gamespy only accepts certain combinations of query variables. Just need to figure out what is accepted and what is not accepted, and from there build an array (or seperate arrays).

Last edited by Butcher (15 Aug 2008 5:47 am)


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#145 15 Aug 2008 6:10 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

the server checks the useragent field sent by your browser, and unless its "GameSpyHTTP/1.0" it won't return any results.  in firefox/moz you can override the useragent string w/ about:conf type in useragent in the search box, and add a new key that is the same as the other useragent keys  "something.useragent.override" and set it to GameSpyHTTP/1.0.  I don't know how to do it in opera (which is I think what you use).

also the only query's they accept are the ones at the top of the bf2_player.php file in the comments.  these are the ones the game sends, and are the only combo they accept.

Offline

 

#146 15 Aug 2008 6:29 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Then how does anyone and their grandmother get the rest of the map information? BF2s gets it, I tried another stats script (here), and it gets it too. And I get the results from the "working example" in Opera, Mozilla and IE. Seems a mystery to me...


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#147 15 Aug 2008 7:53 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

exactly which stats are you expecting that you don't get?

these are the raw, unmodified values I get for you:

Array
(
    [asof] => 1218784882
    [pid] => 43344896
    [nick] => =[BC]=Butcher
    [scor] => 68481
    [jond] => 1118441340
    [wins] => 1748
    [loss] => 1259
    [mode0] => 3007
    [mode1] => 0
    [mode2] => 0
    [time] => 2327332
    [smoc] => 0
    [cmsc] => 44288
    [osaa] => 19
    [kill] => 22144
    [kila] => 2751
    [deth] => 21058
    [suic] => 531
    [bksk] => 57
    [wdsk] => 16
    [tvcr] => 43543570
    [topr] => 44006598
    [klpm] => 0.57
    [dtpm] => 0.54
    [ospm] => 1.77
    [klpr] => 7.36
    [dtpr] => 7.00
    [twsc] => 19651
    [cpcp] => 3566
    [cacp] => 2602
    [dfcp] => 964
    [heal] => 554
    [rviv] => 984
    [rsup] => 1519
    [rpar] => 71
    [tgte] => 0
    [dkas] => 0
    [dsab] => 4695
    [cdsc] => 9796
    [rank] => 12
    [kick] => 33
    [bbrs] => 174
    [tcdr] => 251095
    [ban] => 0
    [lbtl] => 1218565680
    [vrk] => 0
    [tsql] => 646926
    [tsqm] => 1185757
    [tlwf] => 242395
    [mvks] => 10
    [vmks] => 7
    [mvns] => [GB33]Sledge
    [mvrs] => 16
    [vmns] => Phil-ganja
    [vmrs] => 8
    [fkit] => 4
    [fmap] => 4
    [fveh] => 3
    [fwea] => 2
    [tnv] => 0
    [tgm] => 0
    [wtm-0] => 225518
    [wtm-1] => 17582
    [wtm-2] => 325384
    [wtm-3] => 65489
    [wtm-4] => 226745
    [wtm-5] => 69462
    [wtm-6] => 77953
    [wtm-7] => 47938
    [wtm-8] => 94468
    [wtm-9] => 14419
    [wtm-10] => 8429
    [wtm-11] => 91192
    [wtm-12] => 51161
    [wtm-13] => 827
    [wkl-0] => 2714
    [wkl-1] => 190
    [wkl-2] => 1782
    [wkl-3] => 340
    [wkl-4] => 1164
    [wkl-5] => 318
    [wkl-6] => 610
    [wkl-7] => 329
    [wkl-8] => 871
    [wkl-9] => 365
    [wkl-10] => 3
    [wkl-11] => 1697
    [wkl-12] => 1227
    [wkl-13] => 0
    [wdt-0] => 2875
    [wdt-1] => 255
    [wdt-2] => 3562
    [wdt-3] => 687
    [wdt-4] => 1689
    [wdt-5] => 737
    [wdt-6] => 1047
    [wdt-7] => 562
    [wdt-8] => 1188
    [wdt-9] => 261
    [wdt-10] => 231
    [wdt-11] => 1171
    [wdt-12] => 754
    [wdt-13] => 1
    [wac-0] => 19
    [wac-1] => 47
    [wac-2] => 19
    [wac-3] => 13
    [wac-4] => 39
    [wac-5] => 12
    [wac-6] => 39
    [wac-7] => 16
    [wac-8] => 9
    [wac-9] => 10
    [wac-10] => 66
    [wac-11] => 22
    [wac-12] => 25
    [wac-13] => 0
    [wkd-0] => 118:125
    [wkd-1] => 38:51
    [wkd-2] => 891:1781
    [wkd-3] => 340:687
    [wkd-4] => 388:563
    [wkd-5] => 318:737
    [wkd-6] => 610:1047
    [wkd-7] => 329:562
    [wkd-8] => 871:1188
    [wkd-9] => 365:261
    [wkd-10] => 1:77
    [wkd-11] => 1697:1171
    [wkd-12] => 1227:754
    [wkd-13] => 0:1
    [vtm-0] => 137588
    [vtm-1] => 139917
    [vtm-2] => 26626
    [vtm-3] => 323922
    [vtm-4] => 199152
    [vtm-5] => 0
    [vtm-6] => 3647
    [vkl-0] => 2086
    [vkl-1] => 1918
    [vkl-2] => 319
    [vkl-3] => 3534
    [vkl-4] => 1723
    [vkl-5] => 0
    [vkl-6] => 61
    [vdt-0] => 774
    [vdt-1] => 1051
    [vdt-2] => 187
    [vdt-3] => 2361
    [vdt-4] => 1708
    [vdt-5] => 0
    [vdt-6] => 64
    [vkd-0] => 1043:387
    [vkd-1] => 1918:1051
    [vkd-2] => 29:17
    [vkd-3] => 1178:787
    [vkd-4] => 1723:1708
    [vkd-5] => 0
    [vkd-6] => 61:64
    [vkr-0] => 183
    [vkr-1] => 160
    [vkr-2] => 36
    [vkr-3] => 392
    [vkr-4] => 496
    [vkr-5] => 0
    [vkr-6] => 3
    [atm-0] => 1190785
    [atm-1] => 591293
    [atm-2] => 452830
    [atm-3] => 3146
    [atm-4] => 24819
    [atm-5] => 14514
    [atm-6] => 11653
    [atm-7] => 8765
    [atm-8] => 27728
    [atm-9] => 0
    [awn-0] => 977
    [awn-1] => 374
    [awn-2] => 336
    [awn-3] => 6
    [awn-4] => 23
    [awn-5] => 10
    [awn-6] => 0
    [awn-7] => 6
    [awn-8] => 15
    [awn-9] => 0
    [alo-0] => 633
    [alo-1] => 340
    [alo-2] => 226
    [alo-3] => 0
    [alo-4] => 11
    [alo-5] => 12
    [alo-6] => 14
    [alo-7] => 5
    [alo-8] => 18
    [alo-9] => 0
    [abr-0] => 113
    [abr-1] => 164
    [abr-2] => 130
    [abr-3] => 29
    [abr-4] => 144
    [abr-5] => 35
    [abr-6] => 48
    [abr-7] => 108
    [abr-8] => 174
    [abr-9] => 0
    [ktm-0] => 297022
    [ktm-1] => 121906
    [ktm-2] => 103828
    [ktm-3] => 352201
    [ktm-4] => 666088
    [ktm-5] => 171743
    [ktm-6] => 471909
    [kkl-0] => 3029
    [kkl-1] => 1286
    [kkl-2] => 1121
    [kkl-3] => 3955
    [kkl-4] => 6351
    [kkl-5] => 1520
    [kkl-6] => 4882
    [kdt-0] => 3279
    [kdt-1] => 1404
    [kdt-2] => 855
    [kdt-3] => 3827
    [kdt-4] => 6335
    [kdt-5] => 1407
    [kdt-6] => 3951
    [kkd-0] => 3029:3279
    [kkd-1] => 643:702
    [kkd-2] => 59:45
    [kkd-3] => 3955:3827
    [kkd-4] => 6351:6335
    [kkd-5] => 1520:1407
    [kkd-6] => 4882:3951
    [de-6] => 712
    [de-7] => 405
    [de-8] => 48
    [mtm-0] => 224793
    [mtm-1] => 249208
    [mtm-2] => 34901
    [mtm-3] => 28819
    [mtm-4] => 299987
    [mtm-5] => 243059
    [mtm-6] => 71400
    [mtm-100] => 207564
    [mtm-101] => 197161
    [mtm-102] => 237097
    [mtm-103] => 25427
    [mtm-104] => 0
    [mtm-105] => 106324
    [mtm-601] => 203121
    [mtm-300] => 20
    [mtm-301] => 6032
    [mtm-302] => 8110
    [mtm-303] => 42416
    [mtm-304] => 8747
    [mtm-305] => 10437
    [mtm-306] => 8697
    [mtm-307] => 7856
    [mtm-10] => 0
    [mtm-11] => 0
    [mtm-110] => 0
    [mtm-200] => 0
    [mtm-201] => 0
    [mtm-202] => 0
    [mtm-12] => 105202
    [mwn-0] => 181
    [mwn-1] => 211
    [mwn-2] => 20
    [mwn-3] => 33
    [mwn-4] => 213
    [mwn-5] => 146
    [mwn-6] => 50
    [mwn-100] => 151
    [mwn-101] => 159
    [mwn-102] => 138
    [mwn-103] => 19
    [mwn-104] => 0
    [mwn-105] => 88
    [mwn-601] => 170
    [mwn-300] => 0
    [mwn-301] => 5
    [mwn-302] => 7
    [mwn-303] => 27
    [mwn-304] => 1
    [mwn-305] => 4
    [mwn-306] => 9
    [mwn-307] => 7
    [mwn-10] => 0
    [mwn-11] => 0
    [mwn-110] => 0
    [mwn-200] => 0
    [mwn-201] => 0
    [mwn-202] => 0
    [mwn-12] => 107
    [mls-0] => 85
    [mls-1] => 135
    [mls-2] => 20
    [mls-3] => 11
    [mls-4] => 163
    [mls-5] => 150
    [mls-6] => 34
    [mls-100] => 135
    [mls-101] => 142
    [mls-102] => 115
    [mls-103] => 12
    [mls-104] => 0
    [mls-105] => 49
    [mls-601] => 98
    [mls-300] => 1
    [mls-301] => 4
    [mls-302] => 5
    [mls-303] => 22
    [mls-304] => 9
    [mls-305] => 11
    [mls-306] => 3
    [mls-307] => 5
    [mls-10] => 0
    [mls-11] => 0
    [mls-110] => 0
    [mls-200] => 0
    [mls-201] => 0
    [mls-202] => 0
    [mls-12] => 50
)

using only this:

Code:

function _get_stats() {        
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
    $results = $this->_query_ea($url);
    $this->stats = $this->_get_result_set($results);   
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=mtm-,mwn-,mls-";
    $results = $this->_query_ea($url);
    $map_info = $this->_get_result_set($results);
    $this->stats = array_merge($this->stats, $map_info);
    $url = "";        
}

Offline

 

#148 15 Aug 2008 8:04 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

I am trying to get: mbr-,mcm-,mic- (well, I am really trying to get everything, but so far, these three are the main issue), but for some reason, they always return empty.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#149 15 Aug 2008 8:09 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

my guess is that those stats are not displayed in game and that only users of the private stats feed provided to sites like bf2s and bf2player by gamespy in the early days of bf2 can pull dynamic stats (stats that the game doesn't directly pull).

if the game shows it, then you can get it from the stats servers.  if not, then I think you have to use their private stats feed.  notice brainpecker's stats don't include those either (I checked their source, they're pulling the exact same stats my script does).  if the game does pull it, we'll have to get the URL it uses.  last time I checked, it only sends those 3 getplayerinfo requests to the gamespy stats servers.

Offline

 

#150 15 Aug 2008 8:40 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Ahh, so only stats seen in-game (playing on a server) are available? Never tought about that, tought that anything pulled in the profile thingy in the game could be queried. Guess that is just unobtainable then (unless someone found a method of hacking it, but doing that would probably get my IP banned from the query port).


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 



© 2003 - 2019 NullFX
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License