mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 03:09:22 +02:00
otbr: client12: Event Schedule
Implements support for https://github.com/opentibiabr/otservbr-global/pull/1932
This commit is contained in:
parent
0b5fc15a41
commit
a2dea09163
105
login.php
105
login.php
@ -44,40 +44,77 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
|
|||||||
|
|
||||||
case 'eventschedule':
|
case 'eventschedule':
|
||||||
// {"type":"eventschedule"}
|
// {"type":"eventschedule"}
|
||||||
sendMessage(array(
|
$eventlist = [];
|
||||||
'eventlist' => array()
|
$file_path = $config['server_path'] . 'data/XML/events.xml';
|
||||||
));
|
/* <?xml version="1.0" encoding="UTF-8"?>
|
||||||
/*
|
<events>
|
||||||
array(
|
<event name="Otservbr example 1" startdate="11/03/2020" enddate="11/30/2020" >
|
||||||
array(
|
<ingame exprate="250" lootrate="200" spawnrate="100" skillrate="200" />
|
||||||
'description' => "Description text.\n\nTest",
|
<description description="Otserver br example 1 description double exp and a half, double loot !chance!, regular spawn and double skill" />
|
||||||
'startdate' => 1590979202,
|
<colors colordark="#235c00" colorlight="#2d7400" />
|
||||||
'colordark' => "#735D10", // HEX color code
|
<details displaypriority="6" isseasonal="0" specialevent="0" />
|
||||||
'name' => "Full Moon",
|
</event>
|
||||||
'enddate' => 1590979202 + (300 * 24 * 60 * 60),
|
<event name="Otservbr example 2" startdate="12/01/2020" enddate="12/26/2020" >
|
||||||
'isseasonal' => false,
|
<ingame exprate="50" lootrate="300" spawnrate="150" skillrate="100" />
|
||||||
'colorlight' => "#8B6D05"
|
<description description="Otserver br example 2 description 50% less exp, triple loot !chance!, 50% faster spawn and regular skill" />
|
||||||
),
|
<colors colordark="#735D10" colorlight="#8B6D05" />
|
||||||
array(
|
<details displaypriority="6" isseasonal="0" specialevent="0" />
|
||||||
'description' => "Winterberries can now be found all over Tibia!",
|
</event>
|
||||||
'startdate' => 1590979202,
|
</events>
|
||||||
'colordark' => "#7A4C1F",
|
*/
|
||||||
'name' => "Annual Autumn Vintage",
|
if (!file_exists($file_path)) {
|
||||||
'enddate' => 1590979202 + (7 * 24 * 60 * 60),
|
sendMessage(array(
|
||||||
'isseasonal' => false,
|
'eventlist' => array()
|
||||||
'colorlight' => "#935416"
|
));
|
||||||
),
|
}
|
||||||
array(
|
$xml = new DOMDocument;
|
||||||
'description' => "This is the time of witches, ghosts and vampires.",
|
$xml->load($file_path);
|
||||||
'startdate' => 1590979202,
|
$tmplist = [];
|
||||||
'colordark' => "#235c00",
|
$tableevent = $xml->getElementsByTagName('event');
|
||||||
'name' => "Halloween Event",
|
|
||||||
'enddate' => 1590979202 + (30 * 24 * 60 * 60),
|
if (!function_exists("parseEvent")) {
|
||||||
'isseasonal' => false,
|
function parseEvent($table1, $date, $table2) {
|
||||||
'colorlight' => "#2d7400"
|
if ($table1) {
|
||||||
)
|
if ($date) {
|
||||||
)
|
if ($table2) {
|
||||||
*/
|
$date = $table1->getAttribute('startdate');
|
||||||
|
return date_create("{$date}")->format('U');
|
||||||
|
} else {
|
||||||
|
$date = $table1->getAttribute('enddate');
|
||||||
|
return date_create("{$date}")->format('U');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach($table1 as $attr) {
|
||||||
|
if ($attr) {
|
||||||
|
return $attr->getAttribute($table2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($tableevent as $event) {
|
||||||
|
if ($event) {
|
||||||
|
$eventlist[] = array(
|
||||||
|
'colorlight' => parseEvent($event->getElementsByTagName('colors'), false, 'colorlight'),
|
||||||
|
'colordark' => parseEvent($event->getElementsByTagName('colors'), false, 'colordark'),
|
||||||
|
'description' => parseEvent($event->getElementsByTagName('description'), false, 'description'),
|
||||||
|
'displaypriority' => intval(parseEvent($event->getElementsByTagName('details'), false, 'displaypriority')),
|
||||||
|
'enddate' => intval(parseEvent($event, true, false)),
|
||||||
|
'isseasonal' => (intval(parseEvent($event->getElementsByTagName('details'), false, 'isseasonal')) == 1) ? true : false,
|
||||||
|
'name' => $event->getAttribute('name'),
|
||||||
|
'startdate' => intval(parseEvent($event, true, true)),
|
||||||
|
'specialevent' => intval(parseEvent($event->getElementsByTagName('details'), false, 'specialevent'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendMessage(array(
|
||||||
|
'eventlist' => $eventlist,
|
||||||
|
'lastupdatetimestamp' => time()
|
||||||
|
));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'boostedcreature':
|
case 'boostedcreature':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user