This repository has been archived by the owner on May 5, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelper.php
executable file
·86 lines (76 loc) · 2.18 KB
/
helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* @author Branko Wilhelm <[email protected]>
* @link http://www.z-index.net
* @copyright (c) 2011 - 2015 Branko Wilhelm
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die;
class ModWorldOfLogsHelper extends WoWModuleAbstract
{
private $zones = array(
4812 => 'ICC',
4987 => 'RS',
4493 => 'OS',
4273 => 'Ulduar',
4722 => 'PDK',
3456 => 'Nax',
2159 => 'Ony',
4603 => 'VA',
4500 => 'Malygos',
5600 => 'BH',
5334 => 'BoT',
5094 => 'BWD',
5638 => 'T4W',
5723 => 'FL',
5892 => 'DS',
6125 => 'Mogu',
6297 => 'HoF',
6067 => 'ToES',
6622 => 'ToT',
6738 => 'SoO',
6996 => 'HM',
6967 => 'BF',
7545 => 'HC',
);
protected function getInternalData()
{
try
{
$result = WoW::getInstance()->getAdapter('WorldOfLogs')->getData($this->params->module->get('guild'));
} catch (Exception $e)
{
return $e->getMessage();
}
foreach ($result->body->rows as $key => $row)
{
$row->duration = $this->duration($row->duration);
if (!empty($row->zones))
{
$row->name = isset($this->zones[$row->zones[0]->id]) ? $this->zones[$row->zones[0]->id] : $row->zones[0]->name;
$row->limit = $row->zones[0]->playerLimit;
$row->mode = $row->zones[0]->difficulty;
} else
{
$row->name = 'Unknown';
$row->lmit = 0;
$row->mode = 0;
}
if ($key >= $this->params->module->get('raids'))
{
unset($result->body->rows[$key]);
continue;
}
}
return $result->body->rows;
}
private function duration($msec)
{
$hour = (int)($msec / 1000 / 60 / 60);
$msec = $msec - $hour * 60 * 60 * 1000;
$min = (int)($msec / 1000 / 60);
$msec = $msec - $min * 60 * 1000;
$sec = (int)($msec / 1000);
return $hour . ':' . $min;
}
}