mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
implemented detail-page for pets
- plus food and talents, minus zones (those are just madning) - also addes some bc/classic information on pet scaling * mucked about the modelviewer, always uses high quality version .. should muck about some more to add animation-info and remove the java-option * fixed some minor issues in spell maxaffectedtaregs in spell is displayed properly and erronous adding all classes/races to globals if none where selected * created own table for creatures which unifies creature_template, locales_creature, creature_template_addon and some creatureDisplayInfo.dbc information * more work against listviews and general structure in global.js .. should probably split this file by class and reassemble it for use
This commit is contained in:
@@ -10,8 +10,8 @@ class CreatureList extends BaseType
|
||||
|
||||
public $tooltips = [];
|
||||
|
||||
protected $setupQuery = 'SELECT *, ct.entry AS ARRAY_KEY, ct.entry AS id FROM creature_template ct LEFT JOIN locales_creature lc ON lc.entry = ct.entry LEFT JOIN creature_template_addon cta on cta.entry = ct.entry WHERE [filter] [cond]';
|
||||
protected $matchQuery = 'SELECT COUNT(*) FROM creature_template ct WHERE [filter] [cond]';
|
||||
protected $setupQuery = 'SELECT ct.*, ct.id AS ARRAY_KEY, ft.A, ft.H, ft.factionId FROM ?_creature ct LEFT JOIN ?_factiontemplate ft ON ft.id = ct.faction_A WHERE [filter] [cond]';
|
||||
protected $matchQuery = 'SELECT COUNT(*) FROM ?_creature ct WHERE [filter] [cond]';
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
@@ -23,13 +23,9 @@ class CreatureList extends BaseType
|
||||
name_loc6,
|
||||
name_loc8
|
||||
FROM
|
||||
creature_template ct
|
||||
LEFT JOIN
|
||||
locales_creature lc
|
||||
ON
|
||||
lc.entry = ct.entry
|
||||
?_creature
|
||||
WHERE
|
||||
ct.entry = ?d',
|
||||
id = ?d',
|
||||
$id
|
||||
);
|
||||
return Util::localizedString($n, 'name');
|
||||
@@ -95,8 +91,81 @@ class CreatureList extends BaseType
|
||||
return !$data ? 0 : $data[array_rand($data)];
|
||||
}
|
||||
|
||||
public function getListviewData() { }
|
||||
public function addGlobalsToJScript(&$refs) { }
|
||||
public function getListviewData($addInfoMask = 0x0)
|
||||
{
|
||||
/* looks like this data differs per occasion
|
||||
*
|
||||
* NPCINFO_TAMEABLE (0x1): include texture & react
|
||||
* NPCINFO_MODEL (0x2):
|
||||
*/
|
||||
|
||||
$data = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
if ($addInfoMask & NPCINFO_MODEL)
|
||||
{
|
||||
$texStr = strtolower($this->curTpl['textureString']);
|
||||
|
||||
if (isset($data[$texStr]))
|
||||
{
|
||||
if ($data[$texStr]['minlevel'] > $this->curTpl['minlevel'])
|
||||
$data[$texStr]['minlevel'] = $this->curTpl['minlevel'];
|
||||
|
||||
if ($data[$texStr]['maxlevel'] < $this->curTpl['maxlevel'])
|
||||
$data[$texStr]['maxlevel'] = $this->curTpl['maxlevel'];
|
||||
|
||||
$data[$texStr]['count']++;
|
||||
}
|
||||
else
|
||||
$data[$texStr] = array(
|
||||
'family' => $this->curTpl['family'],
|
||||
'minlevel' => $this->curTpl['minlevel'],
|
||||
'maxlevel' => $this->curTpl['maxlevel'],
|
||||
'modelId' => $this->curTpl['modelId'],
|
||||
'displayId' => $this->curTpl['displayId1'],
|
||||
'skin' => $texStr,
|
||||
'count' => 1
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data[$this->id] = array(
|
||||
'family' => $this->curTpl['family'],
|
||||
'minlevel' => $this->curTpl['minlevel'],
|
||||
'maxlevel' => $this->curTpl['maxlevel'],
|
||||
'id' => $this->id,
|
||||
'boss' => $this->curTpl['type_flags'] & 0x4,
|
||||
'rank' => $this->curTpl['rank'],
|
||||
'location' => json_encode($this->getSpawns(SPAWNINFO_ZONES), JSON_NUMERIC_CHECK),
|
||||
'name' => $this->getField('name', true),
|
||||
'tag' => $this->getField('subname', true),
|
||||
'type' => $this->curTpl['type']
|
||||
);
|
||||
|
||||
if ($addInfoMask & NPCINFO_TAMEABLE)
|
||||
{
|
||||
// only first skin of first model ... we're omitting potentially 11 skins here .. but the lv accepts only one .. w/e
|
||||
$data[$this->id]['skin'] = $this->curTpl['textureString'];
|
||||
|
||||
$data[$this->id]['react'] = '['.$this->curTpl['A'].', '.$this->curTpl['H'].']';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksort($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJScript(&$refs)
|
||||
{
|
||||
if (!isset($refs['gCreatures']))
|
||||
$refs['gCreatures'] = [];
|
||||
|
||||
while ($this->iterate())
|
||||
$refs['gCreatures'][$this->id] = ['name' => $this->getField('name', true)];
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$refs) { }
|
||||
|
||||
}
|
||||
|
||||
@@ -582,9 +582,9 @@ class SpellList extends BaseType
|
||||
case 'i': // MaxAffectedTargets
|
||||
case 'I':
|
||||
if ($lookup)
|
||||
$base = $this->refSpells[$lookup]->getField('targets');
|
||||
$base = $this->refSpells[$lookup]->getField('maxAffectedTargets');
|
||||
else
|
||||
$base = $this->getField('targets');
|
||||
$base = $this->getField('maxAffectedTargets');
|
||||
|
||||
if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base))
|
||||
eval("\$base = $base $op $oparg;");
|
||||
@@ -1606,8 +1606,11 @@ class SpellList extends BaseType
|
||||
);
|
||||
}
|
||||
|
||||
(new CharClassList(array(['id', $classes])))->addGlobalsToJScript($refs);
|
||||
(new CharRaceList(array(['id', $races])))->addGlobalsToJScript($refs);
|
||||
if ($classes)
|
||||
(new CharClassList(array(['id', $classes])))->addGlobalsToJScript($refs);
|
||||
|
||||
if ($races)
|
||||
(new CharRaceList(array(['id', $races])))->addGlobalsToJScript($refs);
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$refs) { }
|
||||
|
||||
@@ -80,7 +80,6 @@ define('U_GROUP_MODERATOR', (U_GROUP_ADMIN|U_GROUP_MOD|U_GROUP_B
|
||||
define('U_GROUP_COMMENTS_MODERATOR', (U_GROUP_MODERATOR|U_GROUP_LOCALIZER));
|
||||
define('U_GROUP_PREMIUM_PERMISSIONS', (U_GROUP_PREMIUM|U_GROUP_STAFF|U_GROUP_VIP));
|
||||
|
||||
|
||||
// Locales
|
||||
define('LOCALE_EN', 0);
|
||||
define('LOCALE_FR', 2);
|
||||
@@ -88,12 +87,19 @@ define('LOCALE_DE', 3);
|
||||
define('LOCALE_ES', 6);
|
||||
define('LOCALE_RU', 8);
|
||||
|
||||
// Additional info in item-listviews
|
||||
// conditional information in listviews
|
||||
define('ITEMINFO_JSON', 0x1);
|
||||
define('ITEMINFO_SUBITEMS', 0x2);
|
||||
define('ITEMINFO_VENDOR', 0x4);
|
||||
define('ITEMINFO_LOOT', 0x8);
|
||||
|
||||
define('NPCINFO_TAMEABLE', 0x1);
|
||||
define('NPCINFO_MODEL', 0x2);
|
||||
|
||||
define('SPAWNINFO_ZONES', 1); // not a mask, mutually exclusive
|
||||
define('SPAWNINFO_SHORT', 2);
|
||||
define('SPAWNINFO_FULL', 3);
|
||||
|
||||
/*
|
||||
* Game
|
||||
*/
|
||||
|
||||
@@ -87,7 +87,8 @@ abstract class BaseType
|
||||
|
||||
foreach ($c as $foo)
|
||||
if (is_array($foo))
|
||||
$sql[] = $resolveCondition($foo, $supLink);
|
||||
if ($x = $resolveCondition($foo, $supLink))
|
||||
$sql[] = $x;
|
||||
|
||||
return '('.implode($subLink, $sql).')';
|
||||
}
|
||||
@@ -99,6 +100,9 @@ abstract class BaseType
|
||||
$field = $resolveCondition($c[0], $supLink);
|
||||
else if ($c[0])
|
||||
$field = '`'.implode('`.`', explode('.', Util::sqlEscape($c[0]))).'`';
|
||||
else
|
||||
return null;
|
||||
|
||||
if (is_array($c[1]))
|
||||
{
|
||||
$val = implode(',', Util::sqlEscape($c[1]));
|
||||
@@ -128,10 +132,7 @@ abstract class BaseType
|
||||
if (isset($c[2]) && $c[2] != '!')
|
||||
$op = $c[2];
|
||||
|
||||
if (isset($field) && isset($op) && isset($val))
|
||||
return '('.$field.' '.$op.' '.$val.')';
|
||||
else
|
||||
return null;
|
||||
return '('.$field.' '.$op.' '.$val.')';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -152,6 +153,7 @@ abstract class BaseType
|
||||
unset($conditions[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($conditions as $c)
|
||||
if ($x = $resolveCondition($c, $linking))
|
||||
$sql[] = $x;
|
||||
@@ -308,7 +310,6 @@ trait listviewHelper
|
||||
|
||||
}
|
||||
|
||||
|
||||
trait spawnHelper
|
||||
{
|
||||
private static $spawnQuery = " SELECT a.guid AS ARRAY_KEY, map, position_x, position_y, spawnMask, phaseMask, spawntimesecs, eventEntry, pool_entry AS pool FROM ?# a LEFT JOIN ?# b ON a.guid = b.guid LEFT JOIN ?# c ON a.guid = c.guid WHERE id = ?d";
|
||||
@@ -329,17 +330,21 @@ trait spawnHelper
|
||||
}
|
||||
}
|
||||
|
||||
public function getSpawns($short = false)
|
||||
/*
|
||||
todo (med): implement this alpha-map-check-virtual-map-transform-wahey!
|
||||
note: map in tooltips is activated by either '#map' as anchor (will automatic open mapviewer, when clicking link) in the href or as parameterless rel-parameter e.g. rel="map" in the anchor
|
||||
*/
|
||||
public function getSpawns($spawnInfo)
|
||||
{
|
||||
// short: true => only the most populated area and only coordinates
|
||||
// SPAWNINFO_SHORT: true => only the most populated area and only coordinates
|
||||
$data = [];
|
||||
|
||||
$raw = $this->fetch();
|
||||
if (!$raw)
|
||||
return [];
|
||||
// $raw = $this->fetch();
|
||||
// if (!$raw)
|
||||
// return [];
|
||||
|
||||
/*
|
||||
long:
|
||||
SPAWNINFO_FULL:
|
||||
$data = array(
|
||||
areaId => array(
|
||||
floorNo => array (
|
||||
@@ -354,8 +359,9 @@ trait spawnHelper
|
||||
)
|
||||
)
|
||||
|
||||
short: zoneId, [pos-sets]
|
||||
$data = [6456, [[51,42.2],[51,43]]];
|
||||
SPAWNINFO_SHORT: [zoneId, [[x1, y1], [x2, y2], ..]] // only the most populated zone
|
||||
|
||||
SPAWNINFO_ZONES: [zoneId1, zoneId2, ..] // only zones
|
||||
*/
|
||||
|
||||
return $data;
|
||||
|
||||
Reference in New Issue
Block a user