Hi there everyone,
I'm using this class to get data from game servers for use locally. Recently, I've begun to notice that the functions I'm using doesn't provide all the data available(and that I would love to have). For instance, here's an example of what the function is providing and what's being provided by the game server.
from the function:
code used to get info:
$achievements = $guild->getAchievements('timestamp','desc');
print_r($achievements);
[0] => Array
(
[id] => 5782
[timestamp] => 1341957333000
[url] => http://www.wowhead.com/achievement=5782&who=A Clash of Kings&when=1341957333000
[name] => A Difficult Challenge
)
This is what's actually provided directly from the game server:
{"id":5782,"title":"A Difficult Challenge","points":10,"description":"Complete 100 guild challenges.","rewardItems":[],"icon":"inv_helm_robe_raidmage_i_01","criteria":[{"id":17006,"description":"Complete 100 guild challenges"}]}
So you can see there's a lot more available than what the function is providing. I would like to modify the classes to allow me access to this information.
The problem I have is that I'm not smart enough yet to figure out how to modify what's being returned in the array. I've searched all the files for "achievement":
The obvious:
class Achievements {
private $data;
private $datas;
function __construct($id_list,$type,$region) {
$jsonConnect = new jsonConnect();
$this->data = $jsonConnect->getAchievements($region,$id_list,$type);
$count = count($this->data);
for ($i=0; $i < $count; $i++){
$this->datas[$this->data[$i]['id']] = $this->data[$i];
}
#print_r($this->datas);
}
public function getAchievement($id,$field){
return $this->datas[$id][$field];
}
}
And it seems to reference the jsonConnect file quite a bit, so I looked in there:
public function getAchievements($region,$id_list,$type){
$url = 'http://'.$this->regions[$region].$this->databaseURL.$type.'/achievements';
$data = $this->getData($url, FALSE, $region,'Achievements',$id_list);
#print_r($data);
return $data;
}
(there's more files referenced but I don't want to clutter the thread just yet until I have a better idea of what might be needed )
So it seems I need to modify $data somehow. I just have no idea how.
Could someone help by guiding me at the beginning of my path of understanding to modifying what gets returned? I'd be greatly appreciative!