Template/Update (Part 6)

* convert talent calculators
This commit is contained in:
Sarjuuk
2025-08-06 17:14:10 +02:00
parent 24cb218060
commit d5275b1bf8
10 changed files with 98 additions and 79 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class PetcalcBaseResponse extends TemplateResponse
{
protected string $template = 'talent';
protected string $pageName = 'petcalc';
protected ?int $activeTab = parent::TAB_TOOLS;
protected array $breadcrumb = [1, 2];
protected array $dataLoader = ['pet-talents', 'pets'];
protected array $scripts = array(
[SC_JS_FILE, 'js/TalentCalc.js'],
[SC_CSS_FILE, 'css/talentcalc.css'],
[SC_CSS_FILE, 'css/talent.css'],
[SC_JS_FILE, 'js/petcalc.js'],
[SC_JS_FILE, 'js/swfobject.js'],
[SC_CSS_FILE, 'css/petcalc.css']
);
public bool $gDataKey = true;
public string $tcType = 'pc'; // PetCalculator
public string $chooseType;
protected function generate() : void
{
$this->h1 = Lang::main('petCalc');
$this->chooseType = Lang::main('chooseFamily');
array_unshift($this->title, $this->h1);
parent::generate();
}
}
?>

View File

@@ -0,0 +1,39 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class TalentBaseResponse extends TemplateResponse
{
protected string $template = 'talent';
protected string $pageName = 'talent';
protected ?int $activeTab = parent::TAB_TOOLS;
protected array $breadcrumb = [1, 0];
protected array $dataLoader = ['glyphs'];
protected array $scripts = array(
[SC_JS_FILE, 'js/TalentCalc.js'],
[SC_CSS_FILE, 'css/talentcalc.css'],
[SC_CSS_FILE, 'css/talent.css'],
[SC_JS_FILE, 'js/talent.js']
);
public bool $gDataKey = true;
public string $tcType = 'tc'; // TalentCalculator
public string $chooseType;
protected function generate() : void
{
$this->h1 = Lang::main('talentCalc');
$this->chooseType = Lang::main('chooseClass');
array_unshift($this->title, $this->h1);
parent::generate();
}
}
?>

View File

@@ -118,8 +118,8 @@ $lang = array(
'compareTool' => "Gegenstandsvergleichswerkzeug",
'talentCalc' => "Talentrechner",
'petCalc' => "Begleiterrechner",
'chooseClass' => "Wählt eine Klasse",
'chooseFamily' => "Wählt eine Tierart",
'chooseClass' => "Wählt eine Klasse:",
'chooseFamily' => "Wählt eine Tierart:",
// search
'search' => "Suche",

View File

@@ -118,8 +118,8 @@ $lang = array(
'compareTool' => "Item Comparison Tool",
'talentCalc' => "Talent Calculator",
'petCalc' => "Hunter Pet Calculator",
'chooseClass' => "Choose a class",
'chooseFamily' => "Choose a pet family",
'chooseClass' => "Choose a class:",
'chooseFamily' => "Choose a pet family:",
// search
'search' => "Search",

View File

@@ -118,8 +118,8 @@ $lang = array(
'compareTool' => "Herramienta de comparación de objetos",
'talentCalc' => "Calculadora de talentos",
'petCalc' => "Calculadora de mascotas",
'chooseClass' => "Escoge una clase",
'chooseFamily' => "Escoge una familia de mascota",
'chooseClass' => "Escoge una clase:",
'chooseFamily' => "Escoge una familia de mascota:",
// search
'search' => "Búsqueda",

View File

@@ -118,8 +118,8 @@ $lang = array(
'compareTool' => "Outil de comparaison d'objets",
'talentCalc' => "Calculateur de Talents",
'petCalc' => "Calculateur de familiers",
'chooseClass' => "Choisissez une classe",
'chooseFamily' => "Choisissez un familier",
'chooseClass' => "Choisissez une classe :",
'chooseFamily' => "Choisissez un familier :",
// search
'search' => "Recherche",

View File

@@ -118,8 +118,8 @@ $lang = array(
'compareTool' => "Инструмент сравнения предметов",
'talentCalc' => "Расчёт талантов",
'petCalc' => "Расчёт умений питомцев",
'chooseClass' => "Выберите класс",
'chooseFamily' => "Выберите семейство питомцев",
'chooseClass' => "Выберите класс:",
'chooseFamily' => "Выберите семейство питомцев:",
// search
'search' => "Поиск",

View File

@@ -119,8 +119,8 @@ $lang = array(
'compareTool' => "物品比较工具",
'talentCalc' => "天赋模拟器",
'petCalc' => "猎人宠物模拟器",
'chooseClass' => "选择一个职业",
'chooseFamily' => "选择一个宠物家族",
'chooseClass' => "选择一个职业",
'chooseFamily' => "选择一个宠物家族",
// search
'search' => "搜索",

View File

@@ -1,64 +0,0 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
// tabId 1: Tools g_initHeader()
class TalentPage extends GenericPage
{
protected $tpl = 'talent';
protected $tabId = 1;
protected $path = [1];
protected $mode = CACHE_TYPE_NONE;
protected $gDataKey = true;
protected $scripts = array(
[SC_JS_FILE, 'js/TalentCalc.js'],
[SC_CSS_FILE, 'css/talentcalc.css'],
[SC_CSS_FILE, 'css/talent.css']
);
protected $tcType = 'tc'; // tc: TalentCalculator; pc: PetCalculator
private $isPetCalc = false;
public function __construct($pageCall, $__)
{
parent::__construct($pageCall, $__);
$this->isPetCalc = $pageCall == 'petcalc';
$this->name = $this->isPetCalc ? Lang::main('petCalc') : Lang::main('talentCalc');
}
protected function generateContent()
{
// add conditional js & css
if ($this->isPetCalc)
$this->addScript(
[SC_JS_FILE, '?data=pet-talents.pets'],
[SC_JS_FILE, 'js/petcalc.js'],
[SC_JS_FILE, 'js/swfobject.js'],
[SC_CSS_FILE, 'css/petcalc.css']
);
else
$this->addScript(
[SC_JS_FILE, '?data=glyphs'],
[SC_JS_FILE, 'js/talent.js']
);
$this->tcType = $this->isPetCalc ? 'pc' : 'tc';
}
protected function generateTitle()
{
array_unshift($this->title, $this->name);
}
protected function generatePath()
{
$this->path[] = $this->isPetCalc ? 2 : 0;
}
}
?>

View File

@@ -1,7 +1,10 @@
<?php namespace Aowow; ?>
<?php
namespace Aowow\Template;
<?php $this->brick('header'); ?>
use \Aowow\Lang;
$this->brick('header');
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
@@ -14,7 +17,7 @@
<div id="<?=$this->tcType; ?>-classes">
<div id="<?=$this->tcType; ?>-classes-outer">
<div id="<?=$this->tcType; ?>-classes-inner"><p><?=($this->tcType == 'tc' ? Lang::main('chooseClass') : Lang::main('chooseFamily')) . Lang::main('colon'); ?></p></div>
<div id="<?=$this->tcType; ?>-classes-inner"><p><?=$this->chooseType; ?></p></div>
</div>
</div>
<div id="<?=$this->tcType; ?>-itself"></div>