Skip to content

Commit

Permalink
Fixed Tera Status
Browse files Browse the repository at this point in the history
  • Loading branch information
God Mod committed Apr 27, 2015
1 parent fb70880 commit 07ac6ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions tera/status.class.php
Expand Up @@ -47,7 +47,7 @@ public static function __shortcuts(){
protected $game_name = 'tera';

/* URL to load serverstatus from */
private $status_url = 'http://tera-europe.com/server-status.html';
private $status_url = 'http://en.tera.gameforge.com/community/serverstatus';

/* cache time in seconds default 30 minutes = 1800 seconds */
private $cachetime = 1800;
Expand Down Expand Up @@ -120,11 +120,11 @@ protected function getOutput($servers){

// output status
switch ($serverdata['status']){
case 'online':
case 'status_green':
$output .= '<div class="td"><img src="'.$this->image_path.'server_on.png" alt="Online" title="'.$servername.'" /></div>';
$isUnknown = false;
break;
case 'offline':
case 'status_red':
$output .= '<div class="td"><img src="'.$this->image_path.'server_off.png" alt="Offline" title="'.$servername.'" /></div>';
$isUnknown = false;
break;
Expand Down Expand Up @@ -247,8 +247,9 @@ private function loadServerStatus(){

// process the server lists
$tera_servers = $server_list->getServers();

if (is_array($tera_servers)){
foreach ($tera_servers as $server){
foreach ($tera_servers as $server){
$servers[$server->name] = array(
'status' => $server->status,
'population' => intval($server->population),
Expand Down
7 changes: 4 additions & 3 deletions tera/tera_html.class.php
Expand Up @@ -77,7 +77,8 @@ public function clear(){
*/
private function process(){
// get the DOM list for the servers
$server_list = $this->dom->find("div[id=serverstatus]", 0);
$server_list = $this->dom->find("div[class=server_status_box]", 0);

if ($server_list)
$this->tera_servers = new tera_html_serverlist($server_list);
}
Expand Down Expand Up @@ -161,8 +162,8 @@ public function __get($name){
case 'status':
$node = $this->dom->find('td', 0);
if (!$node) return 'unknown';
$img_node = $node->find('img', 0);
return ($img_node ? $img_node->attr['alt'] : 'unknown');
$span_node = $node->find('span', 0);
return ($node ? trim($span_node->class) : 'unknown');
case 'name':
$node = $this->dom->find('td', 1);
return ($node ? trim($node->text()) : 'Unknown');
Expand Down

0 comments on commit 07ac6ad

Please sign in to comment.