mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Template/Endpoints (Prep)
* modernize DB-Types - long term: should be split in class that describes the DB-Type and container class that handles multiples * make unchanging filter props static, allow lookup of criteria indizes through filter * move username/mail/password checks to util and make them usable as input filter
This commit is contained in:
64
includes/dbtypes/charclass.class.php
Normal file
64
includes/dbtypes/charclass.class.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
class CharClassList extends DBTypeList
|
||||
{
|
||||
public static int $type = Type::CHR_CLASS;
|
||||
public static string $brickFile = 'class';
|
||||
public static string $dataTable = '?_classes';
|
||||
|
||||
protected string $queryBase = 'SELECT c.*, id AS ARRAY_KEY FROM ?_classes c';
|
||||
|
||||
public function __construct($conditions = [], array $miscData = [])
|
||||
{
|
||||
parent::__construct($conditions, $miscData);
|
||||
|
||||
foreach ($this->iterate() as $k => &$_curTpl)
|
||||
$_curTpl['skills'] = explode(' ', $_curTpl['skills']);
|
||||
}
|
||||
|
||||
public function getListviewData() : array
|
||||
{
|
||||
$data = [];
|
||||
|
||||
foreach ($this->iterate() as $__)
|
||||
{
|
||||
$data[$this->id] = array(
|
||||
'id' => $this->id,
|
||||
'name' => $this->getField('name', true),
|
||||
'races' => $this->curTpl['raceMask'],
|
||||
'roles' => $this->curTpl['roles'],
|
||||
'weapon' => $this->curTpl['weaponTypeMask'],
|
||||
'armor' => $this->curTpl['armorTypeMask'],
|
||||
'power' => $this->curTpl['powerType'],
|
||||
);
|
||||
|
||||
if ($this->curTpl['flags'] & 0x40)
|
||||
$data[$this->id]['hero'] = 1;
|
||||
|
||||
if ($this->curTpl['expansion'])
|
||||
$data[$this->id]['expansion'] = $this->curTpl['expansion'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getJSGlobals(int $addMask = 0) : array
|
||||
{
|
||||
$data = [];
|
||||
|
||||
foreach ($this->iterate() as $__)
|
||||
$data[self::$type][$this->id] = ['name' => $this->getField('name', true)];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function renderTooltip() : ?string { return null; }
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user