From 2e7c7fd54cde4ac976c611b2747a340e22127916 Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Sat, 7 Sep 2024 00:01:52 -0300 Subject: [PATCH 1/2] created worlds page and changed from online page. --- index.php | 2 +- system/compat/pages.php | 3 +- system/pages/lastkills.php | 3 - system/pages/online.php | 14 +- system/pages/worlds.php | 31 ++ ...l.twig => character.search.form.html.twig} | 0 system/templates/worlds.html.twig | 361 ++++++++++++++++++ .../images/header/headline-worlds.gif | Bin 0 -> 1235 bytes templates/tibiacom/index.php | 2 +- 9 files changed, 399 insertions(+), 17 deletions(-) create mode 100644 system/pages/worlds.php rename system/templates/{online.form.html.twig => character.search.form.html.twig} (100%) create mode 100644 system/templates/worlds.html.twig create mode 100644 templates/tibiacom/images/header/headline-worlds.gif diff --git a/index.php b/index.php index 996d24297f..18b12bfbf4 100644 --- a/index.php +++ b/index.php @@ -129,7 +129,7 @@ "/^gallery\/{$regexes['number']}\/?$/" => array("subtopic" => "gallery", "image" => "$1"), "/^gifts\/history\/?$/" => array("subtopic" => "gifts", "action" => "show_history"), "/^guilds\/{$regexes['special']}$/" => array("subtopic" => "guilds", "action" => "show", "guild" => "$1"), - "/^online\/{$regexes['special']}$/" => array("subtopic" => "online", "world" => "$1"), + "/^worlds\/{$regexes['special']}$/" => array("subtopic" => "worlds", "world" => "$1"), "/^highscores\/{$regexes['url']}\/{$regexes['special']}\/{$regexes['text']}\/{$regexes['number']}\/?$/" => array("subtopic" => "highscores", "list" => "$1", "world" => "$2", "vocation" => "$3", "page" => "$4"), "/^highscores\/{$regexes['url']}\/{$regexes['special']}\/{$regexes['number']}\/?$/" => array("subtopic" => "highscores", "list" => "$1", "world" => "$2", "page" => "$3"), "/^highscores\/{$regexes['url']}\/{$regexes['special']}\/{$regexes['text']}\/?$/" => array("subtopic" => "highscores", "list" => "$1", "world" => "$2", "vocation" => "$3"), diff --git a/system/compat/pages.php b/system/compat/pages.php index 927edf484e..b013b1b43a 100644 --- a/system/compat/pages.php +++ b/system/compat/pages.php @@ -19,7 +19,8 @@ break; case 'whoisonline': - $page = 'online'; + case 'online': + $page = 'worlds'; break; case 'latestnews': diff --git a/system/pages/lastkills.php b/system/pages/lastkills.php index 6d1c175dfe..4a69d80f5b 100644 --- a/system/pages/lastkills.php +++ b/system/pages/lastkills.php @@ -55,6 +55,3 @@ 'lastkills' => $last_kills, 'world' => $world, )); - -//search bar -$twig->display('online.form.html.twig'); diff --git a/system/pages/online.php b/system/pages/online.php index 94a2cf4f42..0ab84f4ff2 100644 --- a/system/pages/online.php +++ b/system/pages/online.php @@ -12,16 +12,11 @@ defined('MYAAC') or die('Direct access not allowed!'); $title = 'Who is online?'; -if ($w = $_POST['world'] ?? null) { - header("Location: ?online/$w"); -} - -if ($world = $_GET['world'] ?? null) { +$w_sql = ''; +if ($world = $_POST['world'] ?? null) { $world = $db->query("SELECT * FROM `worlds` WHERE `name` = {$db->quote(urldecode($world))}")->fetch(PDO::FETCH_ASSOC) ?? null; -} else { - $world = count(WORLDS) == 1 ? WORLDS[0] : $world; + $w_sql = $world ? " AND `players`.`world_id` = {$world['id']} " : ""; } -$w_sql = $world ? " AND `players`.`world_id` = {$world['id']} " : ""; if ($config['account_country']) require SYSTEM . 'countries.conf.php'; @@ -116,6 +111,3 @@ 'vocations' => $vocations, 'world' => $world, )); - -//search bar -$twig->display('online.form.html.twig'); diff --git a/system/pages/worlds.php b/system/pages/worlds.php new file mode 100644 index 0000000000..5a290fef31 --- /dev/null +++ b/system/pages/worlds.php @@ -0,0 +1,31 @@ +query("SELECT * FROM `worlds` WHERE `name` = {$db->quote(urldecode($world))}")->fetch(PDO::FETCH_ASSOC) ?? null; +} + +$twig->display('worlds.html.twig', [ + '_worlds' => $db->query("SELECT * FROM `worlds`")->fetchAll(PDO::FETCH_ASSOC), + 'world' => $world, + 'overall_maximum' => number_format(0) . ' players (on ' . date('M d Y, H:i:s', time()) . ')', + 'status' => $world ? ($status[$world['id']] ?? $status) : null, //todo remove $status in other PR +]); + +if ($world) { +// search character + $twig->display('character.search.form.html.twig'); +} diff --git a/system/templates/online.form.html.twig b/system/templates/character.search.form.html.twig similarity index 100% rename from system/templates/online.form.html.twig rename to system/templates/character.search.form.html.twig diff --git a/system/templates/worlds.html.twig b/system/templates/worlds.html.twig new file mode 100644 index 0000000000..0684f35fb4 --- /dev/null +++ b/system/templates/worlds.html.twig @@ -0,0 +1,361 @@ +{% if world is empty %} + + + + + + +
+
+
+
+ + + + +
Game World Overview
+ + + + +
+
+ + + + + + +
+
+
+
+
+ + + + + + + + + + + + +
+
+ + + + + + +
Overall Maximum:   {{ overall_maximum }} +
+
+
+
+ + + + + + +
Regular Worlds
+
+
+
+ + + + + + + + + + {% set i = 0 %} + {% for w in _worlds %} + {% set i = i + 1 %} + + + + {# #} + + + + + {% endfor %} + +
WorldOnlineLocationPvP TypeAdditional Information
+ {{ w.name }} + {{ status.players }}{{ status[w.id].players }}{{ w.location }}{{ getWorldType(w.type) }}
+
+
+
+
+
+
+{% endif %} + +{% if world %} + {% if worlds|length > 1 %} + + + + + + +
+
+
+
+ + + + +
World Selection
+ + + + +
+
+ + + + + + +
+
+ + + + + + + + + + +
World Name: + + {% set button_name = 'Submit' %} + {% include('buttons.base.html.twig') %}
+
+
+
+
+
+ {% endif %} + + + + + + + +
+
+
+
+ + + + +
World Information
+ + + + +
+
+ + + + + + +
+
+ + + + + + + {% if status.online %} + + + + + {% endif %} + + + + + + + + + + + + + + + + + + + + + +
Status: + {{ world.name }} World is {% if status.online %}Online{% else %} Offline{% endif %} +
Players Online:{{ players|length }} Players Online
Online Record:{{ record|raw }}
Creation Date:{{ world.creation|date('F Y') }}
Location:{{ world.location }}
PvP Type:{{ getWorldType(world.type) }}
Frags: + + + + + + + + + + + + +
: 1 - 6 Frags
: 6+ Frags or Red Skull
: 10+ Frags or Black Skull
+
+
+
+
+
+
+ + + + + + + +
+
+
+
+ + + + +
Players Online
+ + + + +
+
+ + + + + + +
+
+ + + + + + +
+
+ + + {% if players|length == 0 %} + + + + {% else %} + + {% if config.account_country %} + + {% endif %} + {% if config.online_outfit %} + + {% endif %} + + + + + {% set i = 0 %} + {% for player in players %} + {% set i = i + 1 %} + + {% if config.account_country %} + + {% endif %} + {% if config.online_outfit %} + + {% endif %} + + + + + {% endfor %} + {% endif %} + +
Currently, no one is playing on {{ world.name }}.
#OutfitNameLevelVocation
{{ player.country_image|raw }}player outfit{{ player.name|raw }}{{ player.skull }}{{ player.level }}{{ player.vocation }}
+
+
+
+
+
+
+
+{% endif %} diff --git a/templates/tibiacom/images/header/headline-worlds.gif b/templates/tibiacom/images/header/headline-worlds.gif new file mode 100644 index 0000000000000000000000000000000000000000..34716b8ac8905faa9193524563a30c8156f50a49 GIT binary patch literal 1235 zcmd6k|4$nQ0L8E0;Gm@(Z31?S!N#!Kpj&V$ z?Uk=xX|a46)LEd8fgJ%P%qT-B9TY6sD3Qg0ArTcL$u{7J=?_HqU-*80@AF>rii(x8 z+^T;8KJW(sFzL+t4>b50bb6p3IRU#`b=tS^jTxu)rdCrTm!=^wj}x4*dbeBEVY!{>C~)XFmu{*iggI@w#lyX@j{IU1!jIBJ!q zA|9L0aFwv$Aemvz>7&#MzV;$cmdW{XaB#}%?XBlTatNi=KT4sg2w9F(dJ@ln&Tm-O=%> zv$Lza=XP(O>$5wbyZZ+QJzv}%x;H%XrT4z$Wg$18f{U}_iV|KOoqjlT|D;HiW1&Y8 zB0~7ucPp#?yZ{ktP9xUYmeXijpK3j+30@T8;vaVY>OLb0l$in4cY*@Ki-A7a2ezCJ zxVS_%tO}z!*irHJ7N}xua8bdw=LS;1a}y4;-ufI9!p!VeVrqsLQ?C@mw5hODiX9y%@BZ?}2Mh528NiliPi2d?(h z7y%|U(GWDb*F>6Z6-$IvHAgQ&p*|@gwU=IpT01sD6YZLjn(R6=P}b_YinJqQJ;}mag!(>-5P58KoHvqir72hrr9cWP0pb z`@*rdYMzOZnUO{Oy!m6hpU$pDn!|-tr%s6xX1rfeRNIN2%|rIF*PDKEaw27_L4TKt zJdX*}1%;ggfP-C#&XR+VE;W~pypO~R_lE@uDsw8#h8#pVb4M^sJGou>7(9nPo1^(8 zRkWxGuyPYb->Wsp(pM^XS@}Ee0@f3(zoD1D<2LisgJXYBJG?RDiscord - + From f36ee60a6c675c77a912c2e84bfe7e1cb0dab46f Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Sat, 7 Sep 2024 00:04:24 -0300 Subject: [PATCH 2/2] updated schema changing url who is online to Worlds. --- install/includes/schema.sql | 2 +- system/migrations/17.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install/includes/schema.sql b/install/includes/schema.sql index e405b13c82..896960bfd9 100644 --- a/install/includes/schema.sql +++ b/install/includes/schema.sql @@ -163,7 +163,7 @@ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VA INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Report Bug', 'bugtracker', 2, 5); /* MENU_CATEGORY_COMMUNITY tibiacom */ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Characters', 'characters', 3, 0); -INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Who Is Online?', 'online', 3, 1); +INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Worlds', 'worlds', 3, 1); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Highscores', 'highscores', 3, 2); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Last Kills', 'lastkills', 3, 3); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Houses', 'houses', 3, 4); diff --git a/system/migrations/17.php b/system/migrations/17.php index 027219a565..dae257276d 100644 --- a/system/migrations/17.php +++ b/system/migrations/17.php @@ -28,8 +28,8 @@ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Downloads', 'downloads', 5, 4); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Report Bug', 'bugtracker', 2, 5); /* MENU_CATEGORY_COMMUNITY kathrine */ -INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Who is Online?', 'online', 3, 0); -INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Characters', 'characters', 3, 1); +INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Characters', 'characters', 3, 0); +INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Worlds', 'worlds', 3, 1); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Guilds', 'guilds', 3, 2); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Highscores', 'highscores', 3, 3); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Last Deaths', 'lastkills', 3, 4); @@ -63,7 +63,7 @@ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Report Bug', 'bugtracker', 2, 5); /* MENU_CATEGORY_COMMUNITY tibiacom */ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Characters', 'characters', 3, 0); -INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Who Is Online?', 'online', 3, 1); +INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Worlds', 'worlds', 3, 1); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Highscores', 'highscores', 3, 2); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Last Kills', 'lastkills', 3, 3); INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Houses', 'houses', 3, 4);