From 13199744ef21c7fc6dfafb80e6cea87e975753f0 Mon Sep 17 00:00:00 2001 From: whiteblXK Date: Mon, 15 Apr 2019 18:14:17 +0200 Subject: [PATCH] Moved serverinfo to twig --- system/pages/serverinfo.php | 265 +++++++++----------------- system/templates/serverinfo.html.twig | 102 ++++++++++ 2 files changed, 195 insertions(+), 172 deletions(-) create mode 100644 system/templates/serverinfo.html.twig diff --git a/system/pages/serverinfo.php b/system/pages/serverinfo.php index f7b6ccb2..b3b21f19 100644 --- a/system/pages/serverinfo.php +++ b/system/pages/serverinfo.php @@ -5,184 +5,105 @@ * @package MyAAC * @author Gesior * @author Slawkens - * @copyright 2017 MyAAC + * @author whiteblXK + * @copyright 2019 MyAAC * @link http://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); $title = 'Server info'; if(isset($config['lua']['experience_stages'])) - $config['lua']['experienceStages'] = $config['lua']['experience_stages']; + $config['lua']['experienceStages'] = $config['lua']['experience_stages']; + +if(isset($config['lua']['min_pvp_level'])) + $config['lua']['protectionLevel'] = $config['lua']['min_pvp_level']; + +$rent = trim(strtolower($config['lua']['houseRentPeriod'])); +if($rent != 'yearly' && $rent != 'monthly' && $rent != 'weekly' && $rent != 'daily') + $rent = 'never'; + +if(isset($config['lua']['houseCleanOld'])) + $cleanOld = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60)); + +if(isset($config['lua']['rate_exp'])) + $config['lua']['rateExp'] = $config['lua']['rate_exp']; +if(isset($config['lua']['rateExperience'])) + $config['lua']['rateExp'] = $config['lua']['rateExperience']; +if(isset($config['lua']['rate_mag'])) + $config['lua']['rateMagic'] = $config['lua']['rate_mag']; +if(isset($config['lua']['rate_skill'])) + $config['lua']['rateSkill'] = $config['lua']['rate_skill']; +if(isset($config['lua']['rate_loot'])) + $config['lua']['rateLoot'] = $config['lua']['rate_loot']; +if(isset($config['lua']['rate_spawn'])) + $config['lua']['rateSpawn'] = $config['lua']['rate_spawn']; + +$house_level = NULL; +if(isset($config['lua']['levelToBuyHouse'])) + $house_level = $config['lua']['levelToBuyHouse']; +else if(isset($config['lua']['house_level'])) + $house_level = $config['lua']['house_level']; + +if(isset($config['lua']['in_fight_duration'])) + $config['lua']['pzLocked'] = $config['lua']['in_fight_duration']; + +$pzLocked = eval('return ' . $config['lua']['pzLocked'] . ';'); +$whiteSkullTime = isset($config['lua']['whiteSkullTime']) ? $config['lua']['whiteSkullTime'] : NULL; +if(!isset($whiteSkullTime) && isset($config['lua']['unjust_skull_duration'])) + $whiteSkullTime = $config['lua']['unjust_skull_duration']; + +if(isset($whiteSkullTime)) + $whiteSkullTime = eval('return ' . $whiteSkullTime . ';'); + +$redSkullLength = isset($config['lua']['redSkullLength']) ? $config['lua']['redSkullLength'] : NULL; +if(!isset($redSkullLength) && isset($config['lua']['red_skull_duration'])) + $redSkullLength = $config['lua']['red_skull_duration']; + +if(isset($redSkullLength)) + $redSkullLength = eval('return ' . $redSkullLength . ';'); + +$blackSkull = false; +$blackSkullLength = NULL; +if(isset($config['lua']['useBlackSkull']) && getBoolean($config['lua']['useBlackSkull'])) +{ + $blackSkullLength = $config['lua']['blackSkullLength']; + $blackSkull = true; +} +else if(isset($config['lua']['black_skull_duration'])) { + $blackSkullLength = eval('return ' . $config['lua']['blackSkullLength'] . ';'); + $blackSkull = true; +} + +$twig->display('serverinfo.html.twig', array( + 'experienceStages' => isset($config['lua']['experienceStages']) && getBoolean($config['lua']['experienceStages']) ? $config['lua']['experienceStages'] : null, + 'serverIp' => str_replace('/', '', str_replace('http://', '', $config['lua']['url'])), + 'clientVersion' => isset($status['online']) ? $status['clientVersion'] : null, + 'globalSaveHour' => isset($config['lua']['globalSaveEnabled']) && getBoolean($config['lua']['globalSaveEnabled']) ? $config['lua']['globalSaveHour'] : null, + 'protectionLevel' => $config['lua']['protectionLevel'], + 'houseRent' => $rent == 'never' ? 'disabled' : $rent, + 'houseOld' => isset($cleanOld) ? $cleanOld : null, + 'rateExp' => $config['lua']['rateExp'], + 'rateExpFromPlayers' => isset($config['lua']['rateExperienceFromPlayers']) ? $config['lua']['rateExperienceFromPlayers'] : null, + 'rateMagic' => $config['lua']['rateMagic'], + 'rateSkill' => $config['lua']['rateSkill'], + 'rateLoot' => $config['lua']['rateLoot'], + 'rateSpawn' => $config['lua']['rateSpawn'], + 'houseLevel' => $house_level, + 'pzLocked' => $pzLocked, + 'whiteSkullTime' => $whiteSkullTime, + 'redSkullLength' => $redSkullLength, + 'blackSkull' => $blackSkull, + 'blackSkullLength' => $blackSkullLength, + 'dailyFragsToRedSkull' => isset($config['lua']['dailyFragsToRedSkull']) ? $config['lua']['dailyFragsToRedSkull'] : $config['lua']['kills_per_day_red_skull'], + 'weeklyFragsToRedSkull' => isset($config['lua']['weeklyFragsToRedSkull']) ? $config['lua']['weeklyFragsToRedSkull'] : $config['lua']['kills_per_week_red_skull'], + 'monthlyFragsToRedSkull' => isset($config['lua']['monthlyFragsToRedSkull']) ? $config['lua']['monthlyFragsToRedSkull'] : $config['lua']['kills_per_month_red_skull'], + 'dailyFragsToBlackSkull' => isset($config['lua']['dailyFragsToBlackSkull']) ? $config['lua']['dailyFragsToBlackSkull'] : $config['lua']['kills_per_day_black_skull'], + 'weeklyFragsToBlackSkull' => isset($config['lua']['weeklyFragsToBlackSkull']) ? $config['lua']['weeklyFragsToBlackSkull'] : $config['lua']['kills_per_week_black_skull'], + 'monthlyFragsToBlackSkull' => isset($config['lua']['monthlyFragsToBlackSkull']) ? $config['lua']['monthlyFragsToBlackSkull'] : $config['lua']['kills_per_month_black_skull'], + 'banishmentLength' => isset($config['lua']['banishment_length']) ? eval('return (' . $config['lua']['banishment_length'] . ') / (24 * 60 * 60);') : null, + 'finalBanishmentLength' => isset($config['lua']['final_banishment_length']) ? eval('return (' . $config['lua']['final_banishment_length'] . ') / (24 * 60 * 60);') : null, + 'ipBanishmentLength' => isset($config['lua']['ip_banishment_length']) ? eval('return (' . $config['lua']['ip_banishment_length'] . ') / (24 * 60 * 60);') : null, +)); ?> -
-

-

- - Experience stages: Look here
- - Commands: Look here
- Team: Look here
-

-
-
    -

    Server Info:

    -
  • IP: (Port: )
  • -Client: ' . $status['clientVersion'] . ''; -?> -
  • Online: 24/7
  • -Global save: ' . $config['lua']['globalSaveHour'] . ':00'; - - if(isset($config['lua']['min_pvp_level'])){ - $config['lua']['protectionLevel'] = $config['lua']['min_pvp_level']; - } - - if(isset($config['lua']['protectionLevel'])): -?> -
  • World type: PVP (Protection level: >)
  • -House rent: ' . ($rent == 'never' ? 'disabled' : $rent) . '.'; - - if(isset($config['lua']['houseCleanOld'])) { - $cleanOld = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60)); - if($cleanOld > 0) - echo '
  • Houses with inactive owners are cleaned after 30 days.
  • '; - } - - if(isset($config['lua']['rate_exp'])) - $config['lua']['rateExp'] = $config['lua']['rate_exp']; - if(isset($config['lua']['rate_mag'])) - $config['lua']['rateMagic'] = $config['lua']['rate_mag']; - if(isset($config['lua']['rate_skill'])) - $config['lua']['rateSkill'] = $config['lua']['rate_skill']; - if(isset($config['lua']['rate_loot'])) - $config['lua']['rateLoot'] = $config['lua']['rate_loot']; - if(isset($config['lua']['rate_spawn'])) - $config['lua']['rateSpawn'] = $config['lua']['rate_spawn']; -?> -
    - -

    Rates

    - -
  • Exp Rate: x
  • - -
  • Magic Level: x
  • - -
  • Skills: x
  • - -
  • Loot: x
  • - -
  • Spawn: x
  • - - -
  • Houses: level
  • - -
  • Guilds: level (Create via website)
  • -
    - - -

    Frags & Skull system

    -
  • PZ Lock: min
  • - -
  • White Skull Time: min
  • - -
  • Red skull length: days
  • - -
  • Black skull length: days
  • - -
  • Kills to red skull:
  • - -
  • -

    Red skull

    -
      -
    • frags daily
    • -
    • frags weekly
    • -
    • frags monthly
    • -
    - -

    Black skull

    -
      -
    • frags daily
    • -
    • frags weekly
    • -
    • frags monthly
    • -
    - -

    Banishment

    -
      -
    • frags daily
    • -
    • frags weekly
    • -
    • frags monthly
    • -
    - -
  • - -
  • Banishment length: days
  • - -
  • Final banishment length: days
  • - -
  • IP banishment length: days
  • - -
    -

    Other

    -
  • Respect our rules.
  • -
  • Please report rule violations (Botters, players breaking rules etc) with CTRL + R.
  • -
diff --git a/system/templates/serverinfo.html.twig b/system/templates/serverinfo.html.twig new file mode 100644 index 00000000..2202ba74 --- /dev/null +++ b/system/templates/serverinfo.html.twig @@ -0,0 +1,102 @@ +
+

{{ config.lua.serverName }}

+

+ {% if experienceStages %} + Experience stages: {{ experienceStages }}
+ {% endif %} + Commands: Look here
+ Team: Look here
+

+
+ +
    +

    Server Info:

    +
  • IP: {{ serverIp }} (Port: {{ config.lua.loginPort }})
  • + {% if clientVersion %} +
  • Client: {{ clientVersion }}
  • + {% endif %} +
  • Online: 24/7
  • + {% if globalSaveHour %} +
  • Global save: {{ globalSaveHour }}:00
  • + {% endif %} +
  • World type: {{ config.lua.worldType|upper }} (Protection level: {{ protectionLevel }})
  • +
  • House rent: {{ houseRent }}.

  • + {% if houseOld %} +
  • Houses with inactive owners are cleaned after 30 days.
  • + {% endif %} + +

    Rates

    + {% if rateExp is defined %} +
  • Exp Rate: x{{ rateExp }}
  • + {% endif %} + {% if rateExpFromPlayers %} +
  • Exp Rate from Players: x{{ rateExpFromPlayers }}
  • + {% endif %} + {% if rateMagic is defined %} +
  • Magic Level: x{{ rateMagic }}
  • + {% endif %} + {% if rateSkill is defined %} +
  • Skills: x{{ rateSkill }}
  • + {% endif %} + {% if rateLoot is defined %} +
  • Loot: x{{ rateLoot }}
  • + {% endif %} + {% if rateSpawn is defined %} +
  • Spawn: x{{ rateSpawn }}
  • + {% endif %} + {% if houseLevel %} +
  • Houses: {{ houseLevel }} level
  • + {% endif %} +
  • Guilds: {{ config.guild_need_level }} level (Create via website)
  • +
    + +

    Frags & Skull system

    +
  • PZ Lock: {{ pzLocked / (60 * 1000) }} min
  • + {% if whiteSkullTime %} +
  • White Skull Time: {{ whiteSkullTime }} min
  • + {% endif %} +
  • Red skull length: {{ redSkullLength / (24 * 60 * 60) }} days
  • + {% if blackSkull %} +
  • Black skull length: {{ blackSkullLength / (24 * 60 * 60) }} days
  • + {% endif %} + {% if killsToRedSkull is defined %} +
  • Kills to red skull: {{ config.lua.killsToRedSkull }}
  • + {% elseif config.lua.dailyFragsToRedSkull is defined or config.lua.kills_per_day_red_skull is defined %} +
  • +

    Red skull

    +
      +
    • {{ dailyFragsToRedSkull }} frags daily
    • +
    • {{ weeklyFragsToRedSkull }} frags weekly
    • +
    • {{ monthlyFragsToRedSkull }} frags monthly
    • +
    + {% if blackSkull and config.lua.dailyFragsToBlackSkull is defined or config.lua.kills_per_day_black_skull is defined %} +

    Black skull

    +
      +
    • {{ dailyFragsToBlackSkull }} frags daily
    • +
    • {{ weeklyFragsToBlackSkull }} frags weekly
    • +
    • {{ monthlyFragsToBlackSkull }} frags monthly
    • +
    + {% elseif config.lua.dailyFragsToBanishment is defined %} +

    Banishment

    +
      +
    • {{ config.lua.dailyFragsToBanishment }} frags daily
    • +
    • {{ config.lua.weeklyFragsToBanishment }} frags weekly
    • +
    • {{ config.lua.monthlyFragsToBanishment }} frags monthly
    • +
    + {% endif %} +
  • + {% endif %} + {% if banishmentLength %} +
  • Banishment length: {{ banishmentLength }} days
  • + {% endif %} + {% if finalBanishmentLength %} +
  • Final banishment length: {{ finalBanishmentLength }} days
  • + {% endif %} + {% if ipBanishmentLength %} +
  • IP banishment length: {{ ipBanishmentLength }} days
  • + {% endif %} +
    +

    Other

    +
  • Respect our rules.
  • +
  • Please report rule violations (Botters, players breaking rules etc) with CTRL + R.
  • +
\ No newline at end of file