Structure/Types

* move distributed constant values to object
 * move reused iterators and checks to object
This commit is contained in:
Sarjuuk
2022-03-21 15:20:31 +01:00
parent e109a6deed
commit 33a870ef78
126 changed files with 970 additions and 885 deletions

View File

@@ -50,7 +50,7 @@ class AjaxAccount extends AjaxHandler
$type = $this->_post['type'];
$ids = $this->_post['id'];
if (!isset(Util::$typeStrings[$type]) || empty($ids))
if (!Type::exists($type) || empty($ids))
{
trigger_error('AjaxAccount::handleExclude - invalid type #'.$type.(empty($ids) ? ' or id-list empty' : ''), E_USER_ERROR);
return;
@@ -146,16 +146,10 @@ class AjaxAccount extends AjaxHandler
if ($type = $this->_post['add'])
{
if (empty(Util::$typeClasses[$type]))
$tc = Type::newList($type, [['id', $typeId]]);
if (!$tc || $tc->error)
{
trigger_error('AjaxAccount::handleFavorites - invalid type #'.$type, E_USER_ERROR);
return;
}
$tc = new Util::$typeClasses[$type]([['id', $typeId]]);
if ($tc->error)
{
trigger_error('AjaxAccount::handleFavorites - invalid typeId #'.$typeId.' for type '.$tc::$brickFile, E_USER_ERROR);
trigger_error('AjaxAccount::handleFavorites - invalid typeId #'.$typeId.' for type #'.$type, E_USER_ERROR);
return;
}

View File

@@ -186,7 +186,7 @@ class AjaxAdmin extends AjaxHandler
DB::Aowow()->query('UPDATE ?_screenshots SET status = ?d, userIdApprove = ?d WHERE id = ?d', CC_FLAG_APPROVED, User::$id, $id);
Util::gainSiteReputation($ssEntry['userIdOwner'], SITEREP_ACTION_UPLOAD, ['id' => $id, 'what' => 1, 'date' => $ssEntry['date']]);
// flag DB entry as having screenshots
if (Util::$typeClasses[$ssEntry['type']] && ($tbl = get_class_vars(Util::$typeClasses[$ssEntry['type']])['dataTable']))
if ($tbl = Type::getClassAttrib($ssEntry['type'], 'dataTable'))
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags | ?d WHERE id = ?d', CUSTOM_HAS_SCREENSHOT, $ssEntry['typeId']);
}
else
@@ -267,7 +267,7 @@ class AjaxAdmin extends AjaxHandler
{
$typeIds = explode(',', $typeIds);
$toUnflag = DB::Aowow()->selectCol('SELECT typeId AS ARRAY_KEY, IF(BIT_OR(`status`) & ?d, 1, 0) AS hasMore FROM ?_screenshots WHERE `type` = ?d AND typeId IN (?a) GROUP BY typeId HAVING hasMore = 0', CC_FLAG_APPROVED, $type, $typeIds);
if ($toUnflag && Util::$typeClasses[$type] && ($tbl = get_class_vars(Util::$typeClasses[$type])['dataTable']))
if ($toUnflag && ($tbl = Type::getClassAttrib($type, 'dataTable')))
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags & ~?d WHERE id IN (?a)', CUSTOM_HAS_SCREENSHOT, array_keys($toUnflag));
}
}
@@ -286,8 +286,8 @@ class AjaxAdmin extends AjaxHandler
[$type, $oldTypeId] = array_values(DB::Aowow()->selectRow('SELECT type, typeId FROM ?_screenshots WHERE id = ?d', $id));
$typeId = (int)$this->_get['typeid'];
$tc = new Util::$typeClasses[$type]([['id', $typeId]]);
if (!$tc->error)
$tc = Type::newList($type, [['id', $typeId]]);
if ($tc && !$tc->error)
{
// move screenshot
DB::Aowow()->query('UPDATE ?_screenshots SET typeId = ?d WHERE id = ?d', $typeId, $id);
@@ -301,7 +301,7 @@ class AjaxAdmin extends AjaxHandler
DB::Aowow()->query('UPDATE '.$tc::$dataTable.' SET cuFlags = cuFlags & ~?d WHERE id = ?d', CUSTOM_HAS_SCREENSHOT, $oldTypeId);
}
else
trigger_error('AjaxAdmin::ssRelocate - invalid typeId #'.$typeId.' for type '.$tc::$brickFile, E_USER_ERROR);
trigger_error('AjaxAdmin::ssRelocate - invalid typeId #'.$typeId.' for type #'.$type, E_USER_ERROR);
}
protected function confAdd() : string
@@ -405,7 +405,7 @@ class AjaxAdmin extends AjaxHandler
$area = $this->_get['area'];
$floor = $this->_get['floor'];
if (!in_array($type, [TYPE_NPC, TYPE_OBJECT, TYPE_SOUND, TYPE_AREATRIGGER]))
if (!in_array($type, [Type::NPC, Type::OBJECT, Type::SOUND, Type::AREATRIGGER]))
return '-3';
DB::Aowow()->query('REPLACE INTO ?_spawns_override VALUES (?d, ?d, ?d, ?d, ?d)', $type, $guid, $area, $floor, AOWOW_REVISION);
@@ -423,7 +423,7 @@ class AjaxAdmin extends AjaxHandler
);
// if creature try for waypoints
if ($type == TYPE_NPC)
if ($type == Type::NPC)
{
$jobs = array(
'SELECT -w.id AS `entry`, w.point AS `pointId`, w.position_y AS `posX`, w.position_x AS `posY` FROM creature_addon ca JOIN waypoint_data w ON w.id = ca.path_id WHERE ca.guid = ?d AND ca.path_id <> 0',
@@ -467,6 +467,11 @@ class AjaxAdmin extends AjaxHandler
return '-1';
}
/***************************/
/* additional input filter */
/***************************/
protected static function checkKey(string $val) : string
{
// expecting string

View File

@@ -39,12 +39,12 @@ class AjaxArenaTeam extends AjaxHandler
{
if ($teams = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_arena_team WHERE id IN (?a)', $this->_get['id']))
foreach ($teams as $t)
Profiler::scheduleResync(TYPE_ARENA_TEAM, $t['realm'], $t['realmGUID']);
Profiler::scheduleResync(Type::ARENA_TEAM, $t['realm'], $t['realmGUID']);
if ($this->_get['profile'])
if ($chars = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_profiles p JOIN ?_profiler_arena_team_member atm ON atm.profileId = p.id WHERE atm.arenaTeamId IN (?a)', $this->_get['id']))
foreach ($chars as $c)
Profiler::scheduleResync(TYPE_PROFILE, $c['realm'], $c['realmGUID']);
Profiler::scheduleResync(Type::PROFILE, $c['realm'], $c['realmGUID']);
return '1';
}
@@ -74,7 +74,7 @@ class AjaxArenaTeam extends AjaxHandler
*/
protected function handleStatus() : string
{
$response = Profiler::resyncStatus(TYPE_ARENA_TEAM, $this->_get['id']);
$response = Profiler::resyncStatus(Type::ARENA_TEAM, $this->_get['id']);
return Util::toJSON($response);
}
}

View File

@@ -77,14 +77,14 @@ class AjaxComment extends AjaxHandler
// i .. have problems believing, that everything uses nifty ajax while adding comments requires a brutal header(Loacation: <wherever>), yet, thats how it is
protected function handleCommentAdd() : string
{
if (!$this->_get['typeid'] || !$this->_get['type'] || !isset(Util::$typeClasses[$this->_get['type']]))
if (!$this->_get['typeid'] || !$this->_get['type'] || !Type::exists($this->_get['type']))
{
trigger_error('AjaxComment::handleCommentAdd - malforemd request received', E_USER_ERROR);
return ''; // whatever, we cant even send him back
}
// this type cannot be commented on
if (!(get_class_vars(Util::$typeClasses[$this->_get['type']])['contribute'] & CONTRIBUTE_CO))
if (!Type::checkClassAttrib($this->_get['type'], 'contribute', CONTRIBUTE_CO))
{
trigger_error('AjaxComment::handleCommentAdd - tried to comment on unsupported type #'.$this->_get['type'], E_USER_ERROR);
return '';
@@ -106,7 +106,7 @@ class AjaxComment extends AjaxHandler
DB::Aowow()->query('INSERT INTO ?_comments_rates (commentId, userId, value) VALUES (?d, 0, 1)', $postIdx);
// flag target with hasComment
if ($tbl = get_class_vars(Util::$typeClasses[$this->_get['type']])['dataTable'])
if ($tbl = Type::getClassAttrib($this->_get['type'], 'dataTable'))
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags | ?d WHERE id = ?d', CUSTOM_HAS_COMMENT, $this->_get['typeid']);
}
else
@@ -122,7 +122,7 @@ class AjaxComment extends AjaxHandler
$_SESSION['error']['co'] = Lang::main('cannotComment');
$this->doRedirect = true;
return '?'.Util::$typeStrings[$this->_get['type']].'='.$this->_get['typeid'].'#comments';
return '?'.Type::getFileString($this->_get['type']).'='.$this->_get['typeid'].'#comments';
}
protected function handleCommentEdit() : void
@@ -186,7 +186,7 @@ class AjaxComment extends AjaxHandler
$this->_post['id']
);
if (!$coInfo['hasMore'] && Util::$typeClasses[$coInfo['type']] && ($tbl = get_class_vars(Util::$typeClasses[$coInfo['type']])['dataTable']))
if (!$coInfo['hasMore'] && ($tbl = Type::getClassAttrib($coInfo['type'], 'dataTable')))
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags & ~?d WHERE id = ?d', CUSTOM_HAS_COMMENT, $coInfo['typeId']);
}
else
@@ -212,7 +212,7 @@ class AjaxComment extends AjaxHandler
if ($ok)
{
$coInfo = DB::Aowow()->selectRow('SELECT type, typeId FROM ?_comments WHERE id = ?d', $this->_post['id']);
if (Util::$typeClasses[$coInfo['type']] && ($tbl = get_class_vars(Util::$typeClasses[$coInfo['type']])['dataTable']))
if ($tbl = Type::getClassAttrib($coInfo['type'], 'dataTable'))
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags | ?d WHERE id = ?d', CUSTOM_HAS_COMMENT, $coInfo['typeId']);
}
else

View File

@@ -27,7 +27,7 @@ class AjaxGotocomment extends AjaxHandler
return '.'; // go home
if ($_ = DB::Aowow()->selectRow('SELECT IFNULL(c2.id, c1.id) AS id, IFNULL(c2.type, c1.type) AS type, IFNULL(c2.typeId, c1.typeId) AS typeId FROM ?_comments c1 LEFT JOIN ?_comments c2 ON c1.replyTo = c2.id WHERE c1.id = ?d', $this->_get['id']))
return '?'.Util::$typeStrings[$_['type']].'='.$_['typeId'].'#comments:id='.$_['id'].($_['id'] != $this->_get['id'] ? ':reply='.$this->_get['id'] : null);
return '?'.Type::getFileString(intVal($_['type'])).'='.$_['typeId'].'#comments:id='.$_['id'].($_['id'] != $this->_get['id'] ? ':reply='.$this->_get['id'] : null);
else
trigger_error('AjaxGotocomment::handleGoToComment - could not find comment #'.$this->get['id'], E_USER_ERROR);

View File

@@ -39,12 +39,12 @@ class AjaxGuild extends AjaxHandler
{
if ($guilds = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_guild WHERE id IN (?a)', $this->_get['id']))
foreach ($guilds as $g)
Profiler::scheduleResync(TYPE_GUILD, $g['realm'], $g['realmGUID']);
Profiler::scheduleResync(Type::GUILD, $g['realm'], $g['realmGUID']);
if ($this->_get['profile'])
if ($chars = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_profiles WHERE guild IN (?a)', $this->_get['id']))
foreach ($chars as $c)
Profiler::scheduleResync(TYPE_PROFILE, $c['realm'], $c['realmGUID']);
Profiler::scheduleResync(Type::PROFILE, $c['realm'], $c['realmGUID']);
return '1';
}
@@ -74,7 +74,7 @@ class AjaxGuild extends AjaxHandler
*/
protected function handleStatus() : string
{
$response = Profiler::resyncStatus(TYPE_GUILD, $this->_get['id']);
$response = Profiler::resyncStatus(Type::GUILD, $this->_get['id']);
return Util::toJSON($response);
}
}

View File

@@ -258,7 +258,7 @@ class AjaxProfile extends AjaxHandler
if ($chars = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_profiles WHERE id IN (?a)', $this->_get['id']))
{
foreach ($chars as $c)
Profiler::scheduleResync(TYPE_PROFILE, $c['realm'], $c['realmGUID']);
Profiler::scheduleResync(Type::PROFILE, $c['realm'], $c['realmGUID']);
}
else
trigger_error('AjaxProfile::handleResync - profiles '.implode(', ', $this->_get['id']).' not found in db', E_USER_ERROR);
@@ -305,7 +305,7 @@ class AjaxProfile extends AjaxHandler
return Util::toJSON([1, [PR_QUEUE_STATUS_ERROR, 0, 0, PR_QUEUE_ERROR_CHAR]]);
}
$response = Profiler::resyncStatus(TYPE_PROFILE, $ids);
$response = Profiler::resyncStatus(Type::PROFILE, $ids);
return Util::toJSON($response);
}
@@ -603,28 +603,28 @@ class AjaxProfile extends AjaxHandler
{
switch ($type)
{
case TYPE_FACTION: // factionId => amount
case Type::FACTION: // factionId => amount
$profile['reputation'] = array_combine(array_keys($data), array_column($data, 'cur'));
break;
case TYPE_TITLE:
case Type::TITLE:
foreach ($data as &$d)
$d = 1;
$profile['titles'] = $data;
break;
case TYPE_QUEST:
case Type::QUEST:
foreach ($data as &$d)
$d = 1;
$profile['quests'] = $data;
break;
case TYPE_SPELL:
case Type::SPELL:
foreach ($data as &$d)
$d = 1;
$profile['spells'] = $data;
break;
case TYPE_ACHIEVEMENT:
case Type::ACHIEVEMENT:
$achievements = array_filter($data, function ($x) { return $x['max'] === null; });
$statistics = array_filter($data, function ($x) { return $x['max'] !== null; });
@@ -642,7 +642,7 @@ class AjaxProfile extends AjaxHandler
$profile['statistics'] = array_combine(array_keys($statistics), array_column($statistics, 'max'));
$profile['activity'] = $activity;
break;
case TYPE_SKILL:
case Type::SKILL:
foreach ($data as &$d)
$d = [$d['cur'], $d['max']];

View File

@@ -440,7 +440,7 @@ abstract class BaseType
'q': cssQuality [Items]
'z': zone [set when all happens in here]
'p': PvP [pvpSourceId]
's': TYPE_TITLE: side; TYPE_SPELL: skillId (yeah, double use. Ain't life just grand)
's': Type::TITLE: side; Type::SPELL: skillId (yeah, double use. Ain't life just grand)
'c': category [Spells / Quests]
'c2': subCat [Quests]
'icon': iconString
@@ -590,7 +590,7 @@ trait spawnHelper
{
// check, if we can attach waypoints to creature
// we will get a nice clusterfuck of dots if we do this for more GUIDs, than we have colors though
if (count($spawns) < 6 && self::$type == TYPE_NPC)
if (count($spawns) < 6 && self::$type == Type::NPC)
{
if ($wPoints = DB::Aowow()->select('SELECT * FROM ?_creature_waypoints WHERE creatureOrPath = ?d AND floor = ?d', $s['pathId'] ? -$s['pathId'] : $this->id, $s['floor']))
{
@@ -645,7 +645,7 @@ trait spawnHelper
$info[4] = Lang::game('mode').Lang::main('colon').implode(', ', $_);
}
if (self::$type == TYPE_AREATRIGGER)
if (self::$type == Type::AREATRIGGER)
{
$o = Util::O2Deg($this->getField('orientation'));
$info[5] = 'Orientation'.Lang::main('colon').$o[0].'° ('.$o[1].')';
@@ -752,7 +752,7 @@ trait spawnHelper
private function createQuestSpawns() // [zoneId => [floor => [[x1, y1], [x2, y2], ..]]] mapper on quest detail page
{
if (self::$type == TYPE_SOUND)
if (self::$type == Type::SOUND)
return;
$res = DB::Aowow()->select('SELECT areaId, floor, typeId, posX, posY FROM ?_spawns WHERE type = ?d AND typeId IN (?a) AND posX > 0 AND posY > 0', self::$type, $this->getFoundIDs());
@@ -785,7 +785,7 @@ trait spawnHelper
public function getSpawns($mode)
{
// only Creatures, GOs and SoundEmitters can be spawned
if (!self::$type || !$this->getfoundIDs() || (self::$type != TYPE_NPC && self::$type != TYPE_OBJECT && self::$type != TYPE_SOUND && self::$type != TYPE_AREATRIGGER))
if (!self::$type || !$this->getfoundIDs() || (self::$type != Type::NPC && self::$type != Type::OBJECT && self::$type != Type::SOUND && self::$type != Type::AREATRIGGER))
return [];
switch ($mode)

View File

@@ -118,32 +118,9 @@ class CommunityContent
if (!$_)
continue;
$cnd = [CFG_SQL_LIMIT_NONE, ['id', $_]];
switch ($type)
{
case TYPE_NPC: $obj = new CreatureList($cnd); break;
case TYPE_OBJECT: $obj = new GameobjectList($cnd); break;
case TYPE_ITEM: $obj = new ItemList($cnd); break;
case TYPE_ITEMSET: $obj = new ItemsetList($cnd); break;
case TYPE_QUEST: $obj = new QuestList($cnd); break;
case TYPE_SPELL: $obj = new SpellList($cnd); break;
case TYPE_ZONE: $obj = new ZoneList($cnd); break;
case TYPE_FACTION: $obj = new FactionList($cnd); break;
case TYPE_PET: $obj = new PetList($cnd); break;
case TYPE_ACHIEVEMENT: $obj = new AchievementList($cnd); break;
case TYPE_TITLE: $obj = new TitleList($cnd); break;
case TYPE_WORLDEVENT: $obj = new WorldEventList($cnd); break;
case TYPE_CLASS: $obj = new CharClassList($cnd); break;
case TYPE_RACE: $obj = new CharRaceList($cnd); break;
case TYPE_SKILL: $obj = new SkillList($cnd); break;
case TYPE_CURRENCY: $obj = new CurrencyList($cnd); break;
case TYPE_EMOTE: $obj = new EmoteList($cnd); break;
case TYPE_ENCHANTMENT: $obj = new EnchantmentList($cnd); break;
case TYPE_SOUND: $obj = new SoundList($cnd); break;
case TYPE_ICON: $obj = new IconList($cnd); break;
default: continue 2;
}
$obj = Type::newList($type, [CFG_SQL_LIMIT_NONE, ['id', $_]]);
if (!$obj)
continue;
foreach ($obj->iterate() as $id => $__)
self::$subjCache[$type][$id] = $obj->getField('name', true);
@@ -323,8 +300,7 @@ class CommunityContent
if ($pages)
{
// limit to one actually existing type each
$types = array_intersect(array_unique(array_column($pages, 'type')), array_keys(Util::$typeClasses));
foreach ($types as $t)
foreach (array_unique(array_column($pages, 'type')) as $t)
{
$ids = [];
foreach ($pages as $row)
@@ -334,11 +310,14 @@ class CommunityContent
if (!$ids)
continue;
$tClass = new Util::$typeClasses[$t](array(['id', $ids], CFG_SQL_LIMIT_NONE));
$obj = Type::newList($t, [CFG_SQL_LIMIT_NONE, ['id', $ids]]);
if (!$obj || $obj->error)
continue;
foreach ($pages as &$p)
if ($p['type'] == $t)
if ($tClass->getEntry($p['typeId']))
$p['name'] = $tClass->getField('name', true);
if ($obj->getEntry($p['typeId']))
$p['name'] = $obj->getField('name', true);
}
foreach ($pages as &$p)
@@ -371,7 +350,7 @@ class CommunityContent
{
(new Markup($r['body']))->parseGlobalsFromText(self::$jsGlobals);
self::$jsGlobals[TYPE_USER][$r['userId']] = $r['userId'];
self::$jsGlobals[Type::USER][$r['userId']] = $r['userId'];
$c = array(
'commentv2' => 1, // always 1.. enables some features i guess..?

View File

@@ -26,35 +26,6 @@ define('ERR_MISSING_FILE', 'file %s not found');
define('ERR_NONE', 'created file %s');
define('ERR_MISSING_INCL', 'required function %s() could not be found at %s');
// TypeIds
define('TYPE_NPC', 1);
define('TYPE_OBJECT', 2);
define('TYPE_ITEM', 3);
define('TYPE_ITEMSET', 4);
define('TYPE_QUEST', 5);
define('TYPE_SPELL', 6);
define('TYPE_ZONE', 7);
define('TYPE_FACTION', 8);
define('TYPE_PET', 9);
define('TYPE_ACHIEVEMENT', 10);
define('TYPE_TITLE', 11);
define('TYPE_WORLDEVENT', 12);
define('TYPE_CLASS', 13);
define('TYPE_RACE', 14);
define('TYPE_SKILL', 15);
define('TYPE_CURRENCY', 17);
define('TYPE_SOUND', 19);
define('TYPE_ICON', 29);
define('TYPE_PROFILE', 100);
// internal types (not published to js)
define('TYPE_GUILD', 101);
define('TYPE_ARENA_TEAM', 102);
define('TYPE_USER', 500);
define('TYPE_EMOTE', 501);
define('TYPE_ENCHANTMENT', 502);
define('TYPE_AREATRIGGER', 503);
define('TYPE_MAIL', 504);
define('CACHE_TYPE_NONE', 0); // page will not be cached
define('CACHE_TYPE_PAGE', 1);
define('CACHE_TYPE_TOOLTIP', 2);
@@ -1674,4 +1645,5 @@ define('AT_TYPE_TELEPORT', 2);
define('AT_TYPE_OBJECTIVE', 3);
define('AT_TYPE_SMART', 4);
define('AT_TYPE_SCRIPT', 5);
?>

View File

@@ -285,16 +285,16 @@ class Game
switch ($type)
{
case TYPE_NPC:
case Type::NPC:
$result = DB::World()->select('SELECT `guid` AS ARRAY_KEY, `id`, `map` AS `mapId`, `position_y` AS `posX`, `position_x` AS `posY` FROM creature WHERE `guid` IN (?a)', $guids);
break;
case TYPE_OBJECT:
case Type::OBJECT:
$result = DB::World()->select('SELECT `guid` AS ARRAY_KEY, `id`, `map` AS `mapId`, `position_y` AS `posX`, `position_x` AS `posY` FROM gameobject WHERE `guid` IN (?a)', $guids);
break;
case TYPE_SOUND:
case Type::SOUND:
$result = DB::AoWoW()->select('SELECT `soundId` AS ARRAY_KEY, `soundId` AS `id`, `mapId`, `posX`, `posY` FROM dbc_soundemitters WHERE `soundId` IN (?a)', $guids);
break;
case TYPE_AREATRIGGER:
case Type::AREATRIGGER:
$result = DB::AoWoW()->select('SELECT `id` AS ARRAY_KEY, `id`, `mapId`, `posX`, `posY` FROM dbc_areatrigger WHERE `id` IN (?a)', $guids);
break;
default:

View File

@@ -328,7 +328,7 @@ class Loot
);
$this->results[] = array_merge($base, $data);
$this->jsGlobals[TYPE_ITEM][$loot['reference']] = $data;
$this->jsGlobals[Type::ITEM][$loot['reference']] = $data;
}
}

View File

@@ -40,7 +40,7 @@ class Markup
{
$sm = explode(',', $submatch[1]);
for ($i = 0; $i < count($sm); $i+=2)
$this->jsGlobals[TYPE_ITEM][$sm[$i]] = $sm[$i];
$this->jsGlobals[Type::ITEM][$sm[$i]] = $sm[$i];
}
}
@@ -50,11 +50,11 @@ class Markup
{
$sm = explode(',', $submatch[1]);
for ($i = 0; $i < count($sm); $i+=2)
$this->jsGlobals[TYPE_CURRENCY][$sm[$i]] = $sm[$i];
$this->jsGlobals[Type::CURRENCY][$sm[$i]] = $sm[$i];
}
}
}
else if ($type = array_search($match[1], Util::$typeStrings))
else if ($type = Type::getIndexFrom(Type::IDX_FILE_STR, $match[1]))
$this->jsGlobals[$type][$match[2]] = $match[2];
}
}
@@ -82,8 +82,8 @@ class Markup
$sm = explode(',', $submatch[1]);
for ($i = 0; $i < count($sm); $i += 2)
{
if (!empty($globals[TYPE_ITEM][1][$sm[$i]]))
$moneys[] = $globals[TYPE_ITEM][1][$sm[$i]]['name'];
if (!empty($globals[Type::ITEM][1][$sm[$i]]))
$moneys[] = $globals[Type::ITEM][1][$sm[$i]]['name'];
else
$moneys[] = Util::ucFirst(Lang::game('item')).' #'.$sm[$i];
}
@@ -97,8 +97,8 @@ class Markup
$sm = explode(',', $submatch[1]);
for ($i = 0; $i < count($sm); $i += 2)
{
if (!empty($globals[TYPE_CURRENCY][1][$sm[$i]]))
$moneys[] = $globals[TYPE_CURRENCY][1][$sm[$i]]['name'];
if (!empty($globals[Type::CURRENCY][1][$sm[$i]]))
$moneys[] = $globals[Type::CURRENCY][1][$sm[$i]]['name'];
else
$moneys[] = Util::ucFirst(Lang::game('curency')).' #'.$sm[$i];
}
@@ -107,8 +107,7 @@ class Markup
return Lang::concat($moneys);
}
if ($type = array_search($match[1], Util::$typeStrings))
if ($type = Type::getIndexFrom(Type::IDX_FILE_STR, $match[1]))
{
if (!empty($globals[$type][1][$match[2]]))
return $globals[$type][1][$match[2]]['name'];

View File

@@ -234,19 +234,19 @@ class Profiler
switch ($type)
{
case TYPE_PROFILE:
case Type::PROFILE:
if ($newId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID = ?d', $realmId, $guid))
self::queueInsert($realmId, $guid, TYPE_PROFILE, $newId);
self::queueInsert($realmId, $guid, Type::PROFILE, $newId);
break;
case TYPE_GUILD:
case Type::GUILD:
if ($newId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_guild WHERE realm = ?d AND realmGUID = ?d', $realmId, $guid))
self::queueInsert($realmId, $guid, TYPE_GUILD, $newId);
self::queueInsert($realmId, $guid, Type::GUILD, $newId);
break;
case TYPE_ARENA_TEAM:
case Type::ARENA_TEAM:
if ($newId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_arena_team WHERE realm = ?d AND realmGUID = ?d', $realmId, $guid))
self::queueInsert($realmId, $guid, TYPE_ARENA_TEAM, $newId);
self::queueInsert($realmId, $guid, Type::ARENA_TEAM, $newId);
break;
default:
@@ -547,7 +547,7 @@ class Profiler
DB::Aowow()->query('DELETE FROM ?_profiler_completion WHERE id = ?d', $profileId);
// done quests
if ($quests = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, quest AS typeId FROM character_queststatus_rewarded WHERE guid = ?d', $profileId, TYPE_QUEST, $char['guid']))
if ($quests = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, quest AS typeId FROM character_queststatus_rewarded WHERE guid = ?d', $profileId, Type::QUEST, $char['guid']))
foreach (Util::createSqlBatchInsert($quests) as $q)
DB::Aowow()->query('INSERT INTO ?_profiler_completion (?#) VALUES '.$q, array_keys($quests[0]));
@@ -556,7 +556,7 @@ class Profiler
// known skills (professions only)
$skAllowed = DB::Aowow()->selectCol('SELECT id FROM ?_skillline WHERE typeCat IN (9, 11) AND (cuFlags & ?d) = 0', CUSTOM_EXCLUDE_FOR_LISTVIEW);
$skills = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, skill AS typeId, `value` AS cur, max FROM character_skills WHERE guid = ?d AND skill IN (?a)', $profileId, TYPE_SKILL, $char['guid'], $skAllowed);
$skills = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, skill AS typeId, `value` AS cur, max FROM character_skills WHERE guid = ?d AND skill IN (?a)', $profileId, Type::SKILL, $char['guid'], $skAllowed);
// manually apply racial profession bonuses
foreach ($skills as &$sk)
@@ -595,7 +595,7 @@ class Profiler
acquireMethod = 1 AND
(reqRaceMask = 0 OR reqRaceMask & ?d) AND
(reqClassMask = 0 OR reqClassMask & ?d)',
$profileId, TYPE_SPELL,
$profileId, Type::SPELL,
array_column($skills, 'typeId'),
1 << ($char['race'] - 1),
1 << ($char['class'] - 1)
@@ -623,7 +623,7 @@ class Profiler
((baseRepClassMask4 & ?d) || !baseRepClassMask4)
', $ra, $cl, $ra, $cl, $ra, $cl, $ra, $cl);
if ($reputation = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, faction AS typeId, standing AS cur FROM character_reputation WHERE guid = ?d AND (flags & 0x4) = 0', $profileId, TYPE_FACTION, $char['guid']))
if ($reputation = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, faction AS typeId, standing AS cur FROM character_reputation WHERE guid = ?d AND (flags & 0x4) = 0', $profileId, Type::FACTION, $char['guid']))
{
// merge back base values for encountered factions
foreach ($reputation as &$set)
@@ -640,7 +640,7 @@ class Profiler
foreach ($baseRep as $id => $val)
$reputation[] = array(
'id' => $profileId,
'type' => TYPE_FACTION,
'type' => Type::FACTION,
'typeId' => $id,
'cur' => $val
);
@@ -660,13 +660,13 @@ class Profiler
$indizes[] = $j + ($i * 32);
if ($indizes)
DB::Aowow()->query('INSERT INTO ?_profiler_completion SELECT ?d, ?d, id, NULL, NULL FROM ?_titles WHERE bitIdx IN (?a)', $profileId, TYPE_TITLE, $indizes);
DB::Aowow()->query('INSERT INTO ?_profiler_completion SELECT ?d, ?d, id, NULL, NULL FROM ?_titles WHERE bitIdx IN (?a)', $profileId, Type::TITLE, $indizes);
CLI::write(' ..titles');
// achievements
if ($achievements = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, achievement AS typeId, date AS cur FROM character_achievement WHERE guid = ?d', $profileId, TYPE_ACHIEVEMENT, $char['guid']))
if ($achievements = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, achievement AS typeId, date AS cur FROM character_achievement WHERE guid = ?d', $profileId, Type::ACHIEVEMENT, $char['guid']))
{
foreach (Util::createSqlBatchInsert($achievements) as $a)
DB::Aowow()->query('INSERT INTO ?_profiler_completion (?#) VALUES '.$a, array_keys($achievements[0]));
@@ -678,7 +678,7 @@ class Profiler
// raid progression
if ($progress = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, criteria AS typeId, date AS cur, counter AS `max` FROM character_achievement_progress WHERE guid = ?d AND criteria IN (?a)', $profileId, TYPE_ACHIEVEMENT, $char['guid'], self::$raidProgression))
if ($progress = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, criteria AS typeId, date AS cur, counter AS `max` FROM character_achievement_progress WHERE guid = ?d AND criteria IN (?a)', $profileId, Type::ACHIEVEMENT, $char['guid'], self::$raidProgression))
{
array_walk($progress, function (&$val) { $val['typeId'] = array_search($val['typeId'], self::$raidProgression); });
foreach (Util::createSqlBatchInsert($progress) as $p)
@@ -689,7 +689,7 @@ class Profiler
// known spells
if ($spells = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, spell AS typeId FROM character_spell WHERE guid = ?d AND disabled = 0', $profileId, TYPE_SPELL, $char['guid']))
if ($spells = DB::Characters($realmId)->select('SELECT ?d AS id, ?d AS `type`, spell AS typeId FROM character_spell WHERE guid = ?d AND disabled = 0', $profileId, Type::SPELL, $char['guid']))
foreach (Util::createSqlBatchInsert($spells) as $s)
DB::Aowow()->query('INSERT INTO ?_profiler_completion (?#) VALUES '.$s, array_keys($spells[0]));

View File

@@ -33,7 +33,7 @@ class SmartAI
SAI_ACTION_MOUNT_TO_ENTRY_OR_MODEL => [1 => $npcId]
);
if ($npcGuids = DB::Aowow()->selectCol('SELECT guid FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d', TYPE_NPC, $npcId))
if ($npcGuids = DB::Aowow()->selectCol('SELECT guid FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d', Type::NPC, $npcId))
if ($groups = DB::World()->selectCol('SELECT `groupId` FROM spawn_group WHERE `spawnType` = 0 AND `spawnId` IN (?a)', $npcGuids))
foreach ($groups as $g)
$lookup[SAI_ACTION_SPAWN_SPAWNGROUP][1] = $g;
@@ -57,7 +57,7 @@ class SmartAI
SAI_ACTION_SUMMON_GO => [1 => $objectId]
);
if ($objGuids = DB::Aowow()->selectCol('SELECT guid FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d', TYPE_OBJECT, $objectId))
if ($objGuids = DB::Aowow()->selectCol('SELECT guid FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d', Type::OBJECT, $objectId))
if ($groups = DB::World()->selectCol('SELECT `groupId` FROM spawn_group WHERE `spawnType` = 1 AND `spawnId` IN (?a)', $objGuids))
foreach ($groups as $g)
$lookup[SAI_ACTION_SPAWN_SPAWNGROUP][1] = $g;
@@ -100,15 +100,15 @@ class SmartAI
$genLimit = $talLimit = [];
switch ($typeFilter)
{
case TYPE_NPC:
case Type::NPC:
$genLimit = [SAI_SRC_TYPE_CREATURE, SAI_SRC_TYPE_ACTIONLIST];
$talLimit = [SAI_SRC_TYPE_CREATURE];
break;
case TYPE_OBJECT:
case Type::OBJECT:
$genLimit = [SAI_SRC_TYPE_OBJECT, SAI_SRC_TYPE_ACTIONLIST];
$talLimit = [SAI_SRC_TYPE_OBJECT];
break;
case TYPE_AREATRIGGER:
case Type::AREATRIGGER:
$genLimit = [SAI_SRC_TYPE_AREATRIGGER, SAI_SRC_TYPE_ACTIONLIST];
$talLimit = [SAI_SRC_TYPE_AREATRIGGER];
break;
@@ -158,9 +158,9 @@ class SmartAI
foreach ($smartG as [$st, $eog])
{
if ($st == SAI_SRC_TYPE_CREATURE)
$q[] = '`type` = '.TYPE_NPC.' AND `guid` = '.-$eog;
$q[] = '`type` = '.Type::NPC.' AND `guid` = '.-$eog;
else if ($st == SAI_SRC_TYPE_OBJECT)
$q[] = '`type` = '.TYPE_OBJECT.' AND `guid` = '.-$eog;
$q[] = '`type` = '.Type::OBJECT.' AND `guid` = '.-$eog;
}
if ($q)
@@ -170,11 +170,11 @@ class SmartAI
foreach ($smartS as [$st, $eog])
{
if ($st == SAI_SRC_TYPE_CREATURE)
$result[TYPE_NPC][] = $eog;
$result[Type::NPC][] = $eog;
else if ($st == SAI_SRC_TYPE_OBJECT)
$result[TYPE_OBJECT][] = $eog;
$result[Type::OBJECT][] = $eog;
else if ($st == SAI_SRC_TYPE_AREATRIGGER)
$result[TYPE_AREATRIGGER][] = $eog;
$result[Type::AREATRIGGER][] = $eog;
}
return $result;
@@ -208,7 +208,7 @@ class SmartAI
{
$grp = $moreInfo[SAI_ACTION_SPAWN_SPAWNGROUP];
if ($sgs = DB::World()->selectCol('SELECT `spawnId` FROM spawn_group WHERE `spawnType` = ?d AND `groupId` IN (?a)', 0 /*0:SUMMONER_TYPE_CREATURE*/, $grp))
if ($ids = DB::Aowow()->selectCol('SELECT DISTINCT `typeId` FROM ?_spawns WHERE `type` = ?d AND `guid` IN (?a)', TYPE_NPC, $sgs))
if ($ids = DB::Aowow()->selectCol('SELECT DISTINCT `typeId` FROM ?_spawns WHERE `type` = ?d AND `guid` IN (?a)', Type::NPC, $sgs))
$result = array_merge($result, $ids);
}
@@ -229,7 +229,7 @@ class SmartAI
{
$grp = $moreInfo[SAI_ACTION_SPAWN_SPAWNGROUP];
if ($sgs = DB::World()->selectCol('SELECT `spawnId` FROM spawn_group WHERE `spawnType` = ?d AND `groupId` IN (?a)', 1 /*1:SUMMONER_TYPE_GAMEOBJECT*/, $grp))
if ($ids = DB::Aowow()->selectCol('SELECT DISTINCT `typeId` FROM ?_spawns WHERE `type` = ?d AND `guid` IN (?a)', TYPE_OBJECT, $sgs))
if ($ids = DB::Aowow()->selectCol('SELECT DISTINCT `typeId` FROM ?_spawns WHERE `type` = ?d AND `guid` IN (?a)', Type::OBJECT, $sgs))
$result = array_merge($result, $ids);
}
@@ -721,13 +721,13 @@ class SmartAI
// creature link
case SAI_TARGET_CREATURE_RANGE: // 9
if ($t['param'][0])
$this->jsGlobals[TYPE_NPC][] = $t['param'][0];
$this->jsGlobals[Type::NPC][] = $t['param'][0];
$t['param'][10] = $getDist($t['param'][1], $t['param'][2]);
break;
case SAI_TARGET_CREATURE_GUID: // 10
if ($t['param'][10] = DB::World()->selectCell('SELECT id FROM creature WHERE guid = ?d', $t['param'][0]))
$this->jsGlobals[TYPE_NPC][] = $t['param'][10];
$this->jsGlobals[Type::NPC][] = $t['param'][10];
else
trigger_error('SmartAI::resloveTarget - creature with guid '.$t['param'][0].' not in DB');
break;
@@ -736,12 +736,12 @@ class SmartAI
$t['param'][10] = $getDist(0, $t['param'][1]);
if ($t['param'][0])
$this->jsGlobals[TYPE_NPC][] = $t['param'][0];
$this->jsGlobals[Type::NPC][] = $t['param'][0];
break;
// gameobject link
case SAI_TARGET_GAMEOBJECT_GUID: // 14
if ($t['param'][10] = DB::World()->selectCell('SELECT id FROM gameobject WHERE guid = ?d', $t['param'][0]))
$this->jsGlobals[TYPE_OBJECT][] = $t['param'][10];
$this->jsGlobals[Type::OBJECT][] = $t['param'][10];
else
trigger_error('SmartAI::resloveTarget - gameobject with guid '.$t['param'][0].' not in DB');
break;
@@ -749,7 +749,7 @@ class SmartAI
$t['param'][10] = $getDist($t['param'][1], $t['param'][2]);
if ($t['param'][0])
$this->jsGlobals[TYPE_OBJECT][] = $t['param'][0];
$this->jsGlobals[Type::OBJECT][] = $t['param'][0];
break;
case SAI_TARGET_GAMEOBJECT_DISTANCE: // 15
case SAI_TARGET_CLOSEST_GAMEOBJECT: // 20
@@ -757,7 +757,7 @@ class SmartAI
$t['param'][10] = $getDist(0, $t['param'][1]);
if ($t['param'][0])
$this->jsGlobals[TYPE_OBJECT][] = $t['param'][0];
$this->jsGlobals[Type::OBJECT][] = $t['param'][0];
break;
// error
default:
@@ -859,7 +859,7 @@ class SmartAI
$footer = $time;
if ($e['param'][3] && !$e['param'][2])
$this->jsGlobals[TYPE_NPC][] = $e['param'][3];
$this->jsGlobals[Type::NPC][] = $e['param'][3];
break;
case SAI_EVENT_SPELLHIT: // 8 - On Creature/Gameobject Spell Hit
case SAI_EVENT_HAS_AURA: // 23 - On Creature Has Aura
@@ -872,11 +872,11 @@ class SmartAI
$e['param'][10] = Lang::getMagicSchools($e['param'][1]);
if ($e['param'][0])
$this->jsGlobals[TYPE_SPELL][] = $e['param'][0];
$this->jsGlobals[Type::SPELL][] = $e['param'][0];
break;
case SAI_EVENT_VICTIM_CASTING: // 13 - On Target Casting Spell
if ($e['param'][2])
$this->jsGlobals[TYPE_SPELL][$e['param'][2]];
$this->jsGlobals[Type::SPELL][$e['param'][2]];
// do not break;
case SAI_EVENT_PASSENGER_BOARDED: // 27 -
case SAI_EVENT_PASSENGER_REMOVED: // 28 -
@@ -887,7 +887,7 @@ class SmartAI
case SAI_EVENT_SUMMONED_UNIT: // 17 - On Creature/Gameobject Summoned Unit
case SAI_EVENT_SUMMONED_UNIT_DIES: // 82 - On Summoned Unit Dies
if ($e['param'][0])
$this->jsGlobals[TYPE_NPC][] = $e['param'][0];
$this->jsGlobals[Type::NPC][] = $e['param'][0];
// do not break;
case SAI_EVENT_FRIENDLY_IS_CC: // 15 -
case SAI_EVENT_SUMMON_DESPAWNED: // 35 - On Summoned Unit Despawned
@@ -897,19 +897,19 @@ class SmartAI
case SAI_EVENT_ACCEPTED_QUEST: // 19 - On Target Accepted Quest
case SAI_EVENT_REWARD_QUEST: // 20 - On Target Rewarded Quest
if ($e['param'][0])
$this->jsGlobals[TYPE_QUEST][] = $e['param'][0];
$this->jsGlobals[Type::QUEST][] = $e['param'][0];
if ($time = $this->numRange('event', 1, true))
$footer = $time;
break;
case SAI_EVENT_RECEIVE_EMOTE: // 22 - On Receive Emote.
$this->jsGlobals[TYPE_EMOTE][] = $e['param'][0];
$this->jsGlobals[Type::EMOTE][] = $e['param'][0];
if ($time = $this->numRange('event', 1, true))
$footer = $time;
break;
case SAI_EVENT_TEXT_OVER: // 52 - On TEXT_OVER Event Triggered After SMART_ACTION_TALK
if ($e['param'][1])
$this->jsGlobals[TYPE_NPC][] = $e['param'][1];
$this->jsGlobals[Type::NPC][] = $e['param'][1];
break;
case SAI_EVENT_LINK: // 61 - Used to link together multiple events as a chain of events.
$e['param'][10] = LANG::concat(DB::World()->selectCol('SELECT CONCAT("#[b]", id, "[/b]") FROM smart_scripts WHERE link = ?d AND entryorguid = ?d AND source_type = ?d', $this->itr['id'], $this->entry, $this->srcType), false);
@@ -931,7 +931,7 @@ class SmartAI
break;
case SAI_EVENT_GAME_EVENT_START: // 68 - On game_event started.
case SAI_EVENT_GAME_EVENT_END: // 69 - On game_event ended.
$this->jsGlobals[TYPE_WORLDEVENT][] = $e['param'][0];
$this->jsGlobals[Type::WORLDEVENT][] = $e['param'][0];
break;
case SAI_EVENT_DISTANCE_CREATURE: // 75 - On creature guid OR any instance of creature entry is within distance.
if ($e['param'][0])
@@ -946,7 +946,7 @@ class SmartAI
trigger_error('SmartAI::event - entity for event #'.$e['type'].' not defined');
if ($e['param'][10])
$this->jsGlobals[TYPE_NPC][] = $e['param'][10];
$this->jsGlobals[Type::NPC][] = $e['param'][10];
if ($e['param'][3])
$footer = Util::formatTime($e['param'][3], true);
@@ -1040,36 +1040,36 @@ class SmartAI
case SAI_ACTION_PLAY_EMOTE: // 5 -> any target
case SAI_ACTION_SET_EMOTE_STATE: // 17 -> any target
if ($a['param'][0])
$this->jsGlobals[TYPE_EMOTE][] = $a['param'][0];
$this->jsGlobals[Type::EMOTE][] = $a['param'][0];
break;
case SAI_ACTION_FAIL_QUEST: // 6 -> any target
case SAI_ACTION_OFFER_QUEST: // 7 -> invoker
case SAI_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS:// 15 -> any target
case SAI_ACTION_CALL_GROUPEVENTHAPPENS: // 26 -> invoker
if ($a['param'][0])
$this->jsGlobals[TYPE_QUEST][] = $a['param'][0];
$this->jsGlobals[Type::QUEST][] = $a['param'][0];
break;
case SAI_ACTION_REMOVEAURASFROMSPELL: // 28 -> any target
if ($a['param'][2])
$footer = true;
case SAI_ACTION_ADD_AURA: // 75 -> any target
if ($a['param'][0])
$this->jsGlobals[TYPE_SPELL][] = $a['param'][0];
$this->jsGlobals[Type::SPELL][] = $a['param'][0];
break;
case SAI_ACTION_CALL_KILLEDMONSTER: // 33 -> any target
case SAI_ACTION_UPDATE_TEMPLATE: // 36 -> self
if ($a['param'][0])
$this->jsGlobals[TYPE_NPC][] = $a['param'][0];
$this->jsGlobals[Type::NPC][] = $a['param'][0];
break;
case SAI_ACTION_ADD_ITEM: // 56 -> invoker
case SAI_ACTION_REMOVE_ITEM: // 57 -> invoker
if ($a['param'][0])
$this->jsGlobals[TYPE_ITEM][] = $a['param'][0];
$this->jsGlobals[Type::ITEM][] = $a['param'][0];
break;
case SAI_ACTION_GAME_EVENT_STOP: // 111 -> doesnt matter
case SAI_ACTION_GAME_EVENT_START: // 112 -> doesnt matter
if ($a['param'][0])
$this->jsGlobals[TYPE_WORLDEVENT][] = $a['param'][0];
$this->jsGlobals[Type::WORLDEVENT][] = $a['param'][0];
break;
// simple preparse from param[0] to param[6]
case SAI_ACTION_SET_REACT_STATE: // 8 -> any target
@@ -1125,18 +1125,18 @@ class SmartAI
if ($a['param'][0])
{
$a['param'][6] = DB::Aowow()->selectCell('SELECT factionId FROM ?_factiontemplate WHERE id = ?d', $a['param'][0]);
$this->jsGlobals[TYPE_FACTION][] = $a['param'][6];
$this->jsGlobals[Type::FACTION][] = $a['param'][6];
}
break;
case SAI_ACTION_MORPH_TO_ENTRY_OR_MODEL: // 3 -> self
if ($a['param'][0])
$this->jsGlobals[TYPE_NPC][] = $a['param'][0];
$this->jsGlobals[Type::NPC][] = $a['param'][0];
else if (!$a['param'][1])
$a['param'][6] = 1;
break;
case SAI_ACTION_SOUND: // 4 -> self [param3 set in DB but not used in core?]
$this->jsGlobals[TYPE_SOUND][] = $a['param'][0];
$this->jsGlobals[Type::SOUND][] = $a['param'][0];
if ($a['param'][2])
$footer = true;
@@ -1149,18 +1149,18 @@ class SmartAI
continue;
$buff[] = '[emote='.$a['param'][$i].']';
$this->jsGlobals[TYPE_EMOTE][] = $a['param'][$i];
$this->jsGlobals[Type::EMOTE][] = $a['param'][$i];
}
$a['param'][6] = Lang::concat($buff, false);
break;
case SAI_ACTION_CAST: // 11 -> any target
$this->jsGlobals[TYPE_SPELL][] = $a['param'][0];
$this->jsGlobals[Type::SPELL][] = $a['param'][0];
if ($_ = $this->castFlags('action', 1))
$footer = $_;
break;
case SAI_ACTION_SUMMON_CREATURE: // 12 -> any target
$this->jsGlobals[TYPE_NPC][] = $a['param'][0];
$this->jsGlobals[Type::NPC][] = $a['param'][0];
if ($a['param'][2])
$a['param'][6] = Util::formatTime($a['param'][2], true);
@@ -1181,7 +1181,7 @@ class SmartAI
$footer = true;
break;
case SAI_ACTION_FOLLOW: // 29 -> any target [what the heck are param 4 & 5]
$this->jsGlobals[TYPE_NPC][] = $a['param'][2];
$this->jsGlobals[Type::NPC][] = $a['param'][2];
if ($a['param'][1])
$a['param'][6] = Util::O2Deg($a['param'][1])[0];
if ($a['param'][3] || $a['param'][4])
@@ -1212,7 +1212,7 @@ class SmartAI
break;
case SAI_ACTION_MOUNT_TO_ENTRY_OR_MODEL: // 43 -> self
if ($a['param'][0])
$this->jsGlobals[TYPE_NPC][] = $a['param'][0];
$this->jsGlobals[Type::NPC][] = $a['param'][0];
else if (!$a['param'][1])
$a['param'][6] = 1;
break;
@@ -1220,7 +1220,7 @@ class SmartAI
$a['param'][6] = $a['param'][0] ? Lang::concat(Util::mask2bits($a['param'][0])) : 0;
break;
case SAI_ACTION_SUMMON_GO: // 50 -> self, world coords
$this->jsGlobals[TYPE_OBJECT][] = $a['param'][0];
$this->jsGlobals[Type::OBJECT][] = $a['param'][0];
$a['param'][6] = Util::formatTime($a['param'][1] * 1000, true);
if (!$a['param'][2])
@@ -1242,7 +1242,7 @@ class SmartAI
case SAI_ACTION_WP_START: // 53 -> any .. why tho?
$a['param'][7] = $this->reactState($a['param'][5]);
if ($a['param'][3])
$this->jsGlobals[TYPE_QUEST][] = $a['param'][3];
$this->jsGlobals[Type::QUEST][] = $a['param'][3];
if ($a['param'][4])
$a['param'][6] = Util::formatTime($a['param'][4], true);
if ($a['param'][2])
@@ -1258,7 +1258,7 @@ class SmartAI
if ($a['param'][1])
{
$this->jsGlobals[TYPE_QUEST][] = $a['param'][1];
$this->jsGlobals[Type::QUEST][] = $a['param'][1];
$a['param'][$a['param'][2] ? 7 : 8] = 1;
}
@@ -1268,7 +1268,7 @@ class SmartAI
break;
case SAI_ACTION_TELEPORT: // 62 -> invoker [resolved coords already stored in areatrigger entry]
$a['param'][6] = $this->miscData['teleportA'];
$this->jsGlobals[TYPE_ZONE][] = $a['param'][6];
$this->jsGlobals[Type::ZONE][] = $a['param'][6];
break;
case SAI_ACTION_SET_ORIENTATION: // 66 -> any target
if ($this->itr['target']['type'] == SAI_TARGET_POSITION)
@@ -1301,7 +1301,7 @@ class SmartAI
$items = DB::World()->selectRow('SELECT ItemID1, ItemID2, ItemID3 FROM creature_equip_template WHERE CreatureID = ?d AND ID = ?d', $this->miscData['baseEntry'] ?: $this->entry, $a['param'][0]);
foreach ($items as $i)
$this->jsGlobals[TYPE_ITEM][] = $i;
$this->jsGlobals[Type::ITEM][] = $i;
foreach ($slots as $s)
if ($_ = $items['ItemID'.$s])
@@ -1311,17 +1311,17 @@ class SmartAI
{
if ($_ = $a['param'][2])
{
$this->jsGlobals[TYPE_ITEM][] = $_;
$this->jsGlobals[Type::ITEM][] = $_;
$buff[] = '[item='.$_.']';
}
if ($_ = $a['param'][3])
{
$this->jsGlobals[TYPE_ITEM][] = $_;
$this->jsGlobals[Type::ITEM][] = $_;
$buff[] = '[item='.$_.']';
}
if ($_ = $a['param'][4])
{
$this->jsGlobals[TYPE_ITEM][] = $_;
$this->jsGlobals[Type::ITEM][] = $_;
$buff[] = '[item='.$_.']';
}
}
@@ -1383,7 +1383,7 @@ class SmartAI
// do not break;
case SAI_ACTION_SELF_CAST: // 85 -> self
case SAI_ACTION_INVOKER_CAST: // 134 -> any target
$this->jsGlobals[TYPE_SPELL][] = $a['param'][0];
$this->jsGlobals[Type::SPELL][] = $a['param'][0];
if ($_ = $this->castFlags('action', 1))
$footer = $_;
break;
@@ -1435,7 +1435,7 @@ class SmartAI
break;
case SAI_ACTION_INTERRUPT_SPELL: // 92 -> self
if ($_ = $a['param'][1])
$this->jsGlobals[TYPE_SPELL][] = $a['param'][1];
$this->jsGlobals[Type::SPELL][] = $a['param'][1];
if ($a['param'][0] || $a['param'][2])
$footer = [$a['param'][0]];
@@ -1475,7 +1475,7 @@ class SmartAI
{
foreach ($this->summons[$a['param'][0]] as $id => $n)
{
$this->jsGlobals[TYPE_NPC][] = $id;
$this->jsGlobals[Type::NPC][] = $id;
$buff[] = $n.'x [npc='.$id.']';
}
}
@@ -1497,7 +1497,7 @@ class SmartAI
{
if ($x = $a['param'][$i])
{
$this->jsGlobals[TYPE_SOUND][] = $x;
$this->jsGlobals[Type::SOUND][] = $x;
$a['param'][6] .= '[sound='.$x.']';
}
}
@@ -1531,7 +1531,7 @@ class SmartAI
if (!$i)
continue;
$this->jsGlobals[TYPE_ITEM][] = $i;
$this->jsGlobals[Type::ITEM][] = $i;
$buff[] = '[item='.$i.']';
}
}
@@ -1553,16 +1553,16 @@ class SmartAI
$n = 5;
foreach ($entities as [$spawnType, $guid])
{
$type = TYPE_NPC;
$type = Type::NPC;
if ($spawnType == 1)
$type == TYPE_GAMEOBJECT;
$type == Type::GAMEOBJECT;
$a['param'][7] = $this->spawnFlags('action', 3);
if ($_ = DB::Aowow()->selectCell('SELECT `typeId` FROM ?_spawns WHERE `type` = ?d AND `guid` = ?d', $type, $guid))
{
$this->jsGlobals[$type][] = $_;
$a['param'][8] .= '[li]['.Util::$typeStrings[$type].'='.$_.'][small class=q0] (GUID: '.$guid.')[/small][/li]';
$a['param'][8] .= '[li]['.Type::getFileString($type).'='.$_.'][small class=q0] (GUID: '.$guid.')[/small][/li]';
}
else
$a['param'][8] .= '[li]'.Lang::smartAI('entityUNK').'[small class=q0] (GUID: '.$guid.')[/small][/li]';
@@ -1580,12 +1580,12 @@ class SmartAI
$footer = [$time];
break;
case SAI_ACTION_RESPAWN_BY_SPAWNID: // 133
$type = TYPE_NPC;
$type = Type::NPC;
if ($a['param'][0] == 1)
$type == TYPE_GAMEOBJECT;
$type == Type::GAMEOBJECT;
if ($_ = DB::Aowow()->selectCell('SELECT `typeId` FROM ?_spawns WHERE `type` = ?d AND `guid` = ?d', $type, $a['param'][1]))
$a['param'][6] = '['.Util::$typeStrings[$type].'='.$_.']';
$a['param'][6] = '['.Type::getFileString($type).'='.$_.']';
else
$a['param'][6] = Lang::smartAI('entityUNK');
break;
@@ -1593,11 +1593,11 @@ class SmartAI
$a['param'][6] = $a['param'][1] + $a['param'][2] / pow(10, floor(log10($a['param'][2] ?: 1.0) + 1)); // i know string concatenation is a thing. don't @ me!
break;
case SAI_ACTION_OVERRIDE_LIGHT: // 138
$this->jsGlobals[TYPE_ZONE][] = $a['param'][0];
$this->jsGlobals[Type::ZONE][] = $a['param'][0];
$footer = [Util::formatTime($a['param'][2], true)];
break;
case SAI_ACTION_OVERRIDE_WEATHER: // 139
$this->jsGlobals[TYPE_ZONE][] = $a['param'][0];
$this->jsGlobals[Type::ZONE][] = $a['param'][0];
if (!($a['param'][6] = Lang::smartAI('weatherStates', $a['param'][1])))
$a['param'][6] = Lang::smartAI('weatherStateUNK', [$a['param'][1]]);
break;

View File

@@ -8,7 +8,7 @@ class AchievementList extends BaseType
{
use listviewHelper;
public static $type = TYPE_ACHIEVEMENT;
public static $type = Type::ACHIEVEMENT;
public static $brickFile = 'achievement';
public static $dataTable = '?_achievement';
@@ -71,25 +71,25 @@ class AchievementList extends BaseType
// $mailSrc = new Loot();
// $mailSrc->getByContainer(LOOT_MAIL, $rewards[$_id]['MailTemplateID']);
// foreach ($mailSrc->iterate() as $loot)
// $_curTpl['rewards'][] = [TYPE_ITEM, $loot['id']];
// $_curTpl['rewards'][] = [Type::ITEM, $loot['id']];
// lets just assume for now, that mailRewards for achievements do not contain references
$mailRew = DB::World()->selectCol('SELECT Item FROM mail_loot_template WHERE Reference <= 0 AND entry = ?d', $rewards[$_id]['MailTemplateID']);
foreach ($mailRew AS $mr)
$_curTpl['rewards'][] = [TYPE_ITEM, $mr];
$_curTpl['rewards'][] = [Type::ITEM, $mr];
}
}
//"rewards":[[11,137],[3,138]] [type, typeId]
if (!empty($_curTpl['ItemID']))
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['ItemID']];
$_curTpl['rewards'][] = [Type::ITEM, $_curTpl['ItemID']];
if (!empty($_curTpl['itemExtra']))
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['itemExtra']];
$_curTpl['rewards'][] = [Type::ITEM, $_curTpl['itemExtra']];
if (!empty($_curTpl['TitleA']))
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['TitleA']];
$_curTpl['rewards'][] = [Type::TITLE, $_curTpl['TitleA']];
if (!empty($_curTpl['TitleH']))
if (empty($_curTpl['TitleA']) || $_curTpl['TitleA'] != $_curTpl['TitleH'])
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['TitleH']];
$_curTpl['rewards'][] = [Type::TITLE, $_curTpl['TitleH']];
// icon
$_curTpl['iconString'] = $_curTpl['iconString'] ?: 'trade_engineering';
@@ -103,7 +103,7 @@ class AchievementList extends BaseType
foreach ($this->iterate() as $__)
{
if ($addMask & GLOBALINFO_SELF)
$data[TYPE_ACHIEVEMENT][$this->id] = ['icon' => $this->curTpl['iconString'], 'name' => $this->getField('name', true)];
$data[Type::ACHIEVEMENT][$this->id] = ['icon' => $this->curTpl['iconString'], 'name' => $this->getField('name', true)];
if ($addMask & GLOBALINFO_REWARDS)
foreach ($this->curTpl['rewards'] as $_)
@@ -266,7 +266,7 @@ class AchievementList extends BaseType
$data[$this->id] = array(
"n" => $this->getField('name', true),
"s" => $this->curTpl['faction'],
"t" => TYPE_ACHIEVEMENT,
"t" => Type::ACHIEVEMENT,
"ti" => $this->id
);
}

View File

@@ -8,7 +8,7 @@ class AreaTriggerList extends BaseType
{
use spawnHelper;
public static $type = TYPE_AREATRIGGER;
public static $type = Type::AREATRIGGER;
public static $brickFile = 'areatrigger';
public static $dataTable = '?_areatrigger';

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class CharClassList extends BaseType
{
public static $type = TYPE_CLASS;
public static $type = Type::CHR_CLASS;
public static $brickFile = 'class';
public static $dataTable = '?_classes';

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class CharRaceList extends BaseType
{
public static $type = TYPE_RACE;
public static $type = Type::CHR_RACE;
public static $brickFile = 'race';
public static $dataTable = '?_races';
@@ -40,7 +40,7 @@ class CharRaceList extends BaseType
$data = [];
foreach ($this->iterate() as $__)
$data[TYPE_RACE][$this->id] = ['name' => $this->getField('name', true)];
$data[Type::CHR_RACE][$this->id] = ['name' => $this->getField('name', true)];
return $data;
}

View File

@@ -8,7 +8,7 @@ class CreatureList extends BaseType
{
use spawnHelper;
public static $type = TYPE_NPC;
public static $type = Type::NPC;
public static $brickFile = 'creature';
public static $dataTable = '?_creature';
@@ -252,7 +252,7 @@ class CreatureList extends BaseType
$data = [];
foreach ($this->iterate() as $__)
$data[TYPE_NPC][$this->id] = ['name' => $this->getField('name', true)];
$data[Type::NPC][$this->id] = ['name' => $this->getField('name', true)];
return $data;
}
@@ -265,7 +265,7 @@ class CreatureList extends BaseType
{
$data[$this->id] = array(
'n' => $this->getField('parentId') ? $this->getField('parent', true) : $this->getField('name', true),
't' => TYPE_NPC,
't' => Type::NPC,
'ti' => $this->getField('parentId') ?: $this->id,
// 'bd' => (int)($this->curTpl['cuFlags'] & NPC_CU_INSTANCE_BOSS || ($this->curTpl['typeFlags'] & 0x4 && $this->curTpl['rank']))
// 'z' where am i spawned

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class CurrencyList extends BaseType
{
public static $type = TYPE_CURRENCY;
public static $type = Type::CURRENCY;
public static $brickFile = 'currency';
public static $dataTable = '?_currencies';
@@ -57,7 +57,7 @@ class CurrencyList extends BaseType
else
$icon = [$this->curTpl['iconString'], $this->curTpl['iconString']];
$data[TYPE_CURRENCY][$this->id] = ['name' => $this->getField('name', true), 'icon' => $icon];
$data[Type::CURRENCY][$this->id] = ['name' => $this->getField('name', true), 'icon' => $icon];
}
return $data;

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class EmoteList extends BaseType
{
public static $type = TYPE_EMOTE;
public static $type = Type::EMOTE;
public static $brickFile = 'emote';
public static $dataTable = '?_emotes';
@@ -47,7 +47,7 @@ class EmoteList extends BaseType
$data = [];
foreach ($this->iterate() as $__)
$data[TYPE_EMOTE][$this->id] = ['name' => $this->getField('cmd')];
$data[Type::EMOTE][$this->id] = ['name' => $this->getField('cmd')];
return $data;
}

View File

@@ -8,7 +8,7 @@ class EnchantmentList extends BaseType
{
use listviewHelper;
public static $type = TYPE_ENCHANTMENT;
public static $type = Type::ENCHANTMENT;
public static $brickFile = 'enchantment';
public static $dataTable = '?_itemenchantment';
@@ -17,7 +17,7 @@ class EnchantmentList extends BaseType
private $triggerIds = [];
protected $queryBase = 'SELECT ie.*, ie.id AS ARRAY_KEY FROM ?_itemenchantment ie';
protected $queryOpts = array( // 502 => TYPE_ENCHANTMENT
protected $queryOpts = array( // 502 => Type::ENCHANTMENT
'ie' => [['is']],
'is' => ['j' => ['?_item_stats `is` ON `is`.`type` = 502 AND `is`.`typeId` = `ie`.`id`', true], 's' => ', `is`.*'],
);
@@ -216,7 +216,7 @@ class EnchantmentList extends BaseType
if ($addMask & GLOBALINFO_SELF)
foreach ($this->iterate() as $__)
$data[TYPE_ENCHANTMENT][$this->id] = ['name' => $this->getField('name', true)];
$data[Type::ENCHANTMENT][$this->id] = ['name' => $this->getField('name', true)];
if ($addMask & GLOBALINFO_RELATED)
{
@@ -224,8 +224,8 @@ class EnchantmentList extends BaseType
$data = $this->relSpells->getJSGlobals(GLOBALINFO_SELF);
foreach ($this->triggerIds as $tId)
if (empty($data[TYPE_SPELL][$tId]))
$data[TYPE_SPELL][$tId] = $tId;
if (empty($data[Type::SPELL][$tId]))
$data[Type::SPELL][$tId] = $tId;
}
return $data;

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class FactionList extends BaseType
{
public static $type = TYPE_FACTION;
public static $type = Type::FACTION;
public static $brickFile = 'faction';
public static $dataTable = '?_factions';
@@ -75,7 +75,7 @@ class FactionList extends BaseType
$data = [];
foreach ($this->iterate() as $__)
$data[TYPE_FACTION][$this->id] = ['name' => $this->getField('name', true)];
$data[Type::FACTION][$this->id] = ['name' => $this->getField('name', true)];
return $data;
}

View File

@@ -8,7 +8,7 @@ class GameObjectList extends BaseType
{
use listviewHelper, spawnHelper;
public static $type = TYPE_OBJECT;
public static $type = Type::OBJECT;
public static $brickFile = 'object';
public static $dataTable = '?_objects';
@@ -115,7 +115,7 @@ class GameObjectList extends BaseType
$data = [];
foreach ($this->iterate() as $__)
$data[TYPE_OBJECT][$this->id] = ['name' => $this->getField('name', true)];
$data[Type::OBJECT][$this->id] = ['name' => $this->getField('name', true)];
return $data;
}
@@ -128,7 +128,7 @@ class GameObjectList extends BaseType
{
$data[$this->id] = array(
'n' => $this->getField('name', true),
't' => TYPE_OBJECT,
't' => Type::OBJECT,
'ti' => $this->id
// 'bd' => bossdrop
// 'dd' => dungeondifficulty

View File

@@ -8,7 +8,7 @@ class IconList extends BaseType
{
use listviewHelper;
public static $type = TYPE_ICON;
public static $type = Type::ICON;
public static $brickFile = 'icon';
public static $dataTable = '?_icons';
public static $contribute = CONTRIBUTE_CO;
@@ -24,7 +24,7 @@ class IconList extends BaseType
protected $queryBase = 'SELECT ic.*, ic.id AS ARRAY_KEY FROM ?_icons ic';
/* this works, but takes ~100x more time than i'm comfortable with .. kept as reference
protected $queryOpts = array( // 29 => TYPE_ICON
protected $queryOpts = array( // 29 => Type::ICON
'ic' => [['s', 'i', 'a', 'c', 'p'], 'g' => 'ic.id'],
'i' => ['j' => ['?_items `i` ON `i`.`iconId` = `ic`.`id`', true], 's' => ', COUNT(DISTINCT `i`.`id`) AS nItems'],
's' => ['j' => ['?_spell `s` ON `s`.`iconId` = `ic`.`id`', true], 's' => ', COUNT(DISTINCT `s`.`id`) AS nSpells'],
@@ -90,7 +90,7 @@ class IconList extends BaseType
$data = [];
foreach ($this->iterate() as $__)
$data[TYPE_ICON][$this->id] = ['name' => $this->getField('name', true, true), 'icon' => $this->getField('name', true, true)];
$data[Type::ICON][$this->id] = ['name' => $this->getField('name', true, true), 'icon' => $this->getField('name', true, true)];
return $data;
}

View File

@@ -8,7 +8,7 @@ class ItemList extends BaseType
{
use ListviewHelper;
public static $type = TYPE_ITEM;
public static $type = Type::ITEM;
public static $brickFile = 'item';
public static $dataTable = '?_items';
@@ -25,7 +25,7 @@ class ItemList extends BaseType
private $jsGlobals = []; // getExtendedCost creates some and has no access to template
protected $queryBase = 'SELECT i.*, i.block AS tplBlock, i.id AS ARRAY_KEY, i.id AS id FROM ?_items i';
protected $queryOpts = array( // 3 => TYPE_ITEM
protected $queryOpts = array( // 3 => Type::ITEM
'i' => [['is', 'src', 'ic'], 'o' => 'i.quality DESC, i.itemLevel DESC'],
'ic' => ['j' => ['?_icons `ic` ON `ic`.`id` = `i`.`iconId`', true], 's' => ', ic.name AS iconString'],
'is' => ['j' => ['?_item_stats `is` ON `is`.`type` = 3 AND `is`.`typeId` = `i`.`id`', true], 's' => ', `is`.*'],
@@ -105,9 +105,9 @@ class ItemList extends BaseType
SELECT nv.item, nv.entry, 0 AS eventId, nv.maxcount, nv.extendedCost FROM npc_vendor nv WHERE {nv.entry IN (?a) AND} nv.item IN (?a)
UNION
SELECT genv.item, c.id AS `entry`, ge.eventEntry AS eventId, genv.maxcount, genv.extendedCost FROM game_event_npc_vendor genv LEFT JOIN game_event ge ON genv.eventEntry = ge.eventEntry JOIN creature c ON c.guid = genv.guid WHERE {c.id IN (?a) AND} genv.item IN (?a)',
empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : $filter[TYPE_NPC],
empty($filter[Type::NPC]) || !is_array($filter[Type::NPC]) ? DBSIMPLE_SKIP : $filter[Type::NPC],
array_keys($this->templates),
empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : $filter[TYPE_NPC],
empty($filter[Type::NPC]) || !is_array($filter[Type::NPC]) ? DBSIMPLE_SKIP : $filter[Type::NPC],
array_keys($this->templates)
);
@@ -147,13 +147,13 @@ class ItemList extends BaseType
if (!empty($costs['reqArenaPoints']))
{
$data[-103] = $costs['reqArenaPoints'];
$this->jsGlobals[TYPE_CURRENCY][103] = 103;
$this->jsGlobals[Type::CURRENCY][103] = 103;
}
if (!empty($costs['reqHonorPoints']))
{
$data[-104] = $costs['reqHonorPoints'];
$this->jsGlobals[TYPE_CURRENCY][104] = 104;
$this->jsGlobals[Type::CURRENCY][104] = 104;
}
for ($i = 1; $i < 6; $i++)
@@ -212,7 +212,7 @@ class ItemList extends BaseType
}
if (!$found)
$this->jsGlobals[TYPE_ITEM][$k] = $k;
$this->jsGlobals[Type::ITEM][$k] = $k;
}
}
$costData[$itr] = $cost;
@@ -229,8 +229,8 @@ class ItemList extends BaseType
$result = $this->vendors;
// apply filter if given
$tok = !empty($filter[TYPE_ITEM]) ? $filter[TYPE_ITEM] : null;
$cur = !empty($filter[TYPE_CURRENCY]) ? $filter[TYPE_CURRENCY] : null;
$tok = !empty($filter[Type::ITEM]) ? $filter[Type::ITEM] : null;
$cur = !empty($filter[Type::CURRENCY]) ? $filter[Type::CURRENCY] : null;
foreach ($result as $itemId => &$data)
{
@@ -366,7 +366,7 @@ class ItemList extends BaseType
if ($entries['event'])
{
$this->jsGlobals[TYPE_WORLDEVENT][$entries['event']] = $entries['event'];
$this->jsGlobals[Type::WORLDEVENT][$entries['event']] = $entries['event'];
$costArr['condition'][0][$this->id][] = [[CND_ACTIVE_EVENT, $entries['event']]];
}
@@ -464,7 +464,7 @@ class ItemList extends BaseType
{
if ($addMask & GLOBALINFO_SELF)
{
$data[TYPE_ITEM][$id] = array(
$data[Type::ITEM][$id] = array(
'name' => $this->getField('name', true),
'quality' => $this->curTpl['quality'],
'icon' => $this->curTpl['iconString']
@@ -878,8 +878,8 @@ class ItemList extends BaseType
if ($classes = Lang::getClassString($this->curTpl['requiredClass'], $jsg))
{
foreach ($jsg as $js)
if (empty($this->jsGlobals[TYPE_CLASS][$js]))
$this->jsGlobals[TYPE_CLASS][$js] = $js;
if (empty($this->jsGlobals[Type::CHR_CLASS][$js]))
$this->jsGlobals[Type::CHR_CLASS][$js] = $js;
$x .= Lang::game('classes').Lang::main('colon').$classes.'<br />';
}
@@ -888,8 +888,8 @@ class ItemList extends BaseType
if ($races = Lang::getRaceString($this->curTpl['requiredRace'], $jsg))
{
foreach ($jsg as $js)
if (empty($this->jsGlobals[TYPE_RACE][$js]))
$this->jsGlobals[TYPE_RACE][$js] = $js;
if (empty($this->jsGlobals[Type::CHR_RACE][$js]))
$this->jsGlobals[Type::CHR_ACE][$js] = $js;
$x .= Lang::game('races').Lang::main('colon').$races.'<br />';
}
@@ -1302,7 +1302,7 @@ class ItemList extends BaseType
if ($enchantments)
{
$eStats = DB::Aowow()->select('SELECT *, typeId AS ARRAY_KEY FROM ?_item_stats WHERE `type` = ?d AND typeId IN (?a)', TYPE_ENCHANTMENT, array_keys($enchantments));
$eStats = DB::Aowow()->select('SELECT *, typeId AS ARRAY_KEY FROM ?_item_stats WHERE `type` = ?d AND typeId IN (?a)', Type::ENCHANTMENT, array_keys($enchantments));
Util::checkNumeric($eStats);
// and merge enchantments back
@@ -1362,7 +1362,7 @@ class ItemList extends BaseType
{
$data[$this->id] = array(
'n' => $this->getField('name', true),
't' => TYPE_ITEM,
't' => Type::ITEM,
'ti' => $this->id,
'q' => $this->curTpl['quality'],
// 'p' => PvP [NYI]
@@ -1424,7 +1424,7 @@ class ItemList extends BaseType
$buff[$_curTpl['moreType']][] = $_curTpl['moreTypeId'];
foreach ($buff as $type => $ids)
$this->sourceMore[$type] = (new Util::$typeClasses[$type](array(['id', $ids])))->getSourceData();
$this->sourceMore[$type] = (Type::newList($type, [['id', $ids]]))?->getSourceData();
}
$s = array_keys($this->sources[$this->id]);

View File

@@ -8,7 +8,7 @@ class ItemsetList extends BaseType
{
use ListviewHelper;
public static $type = TYPE_ITEMSET;
public static $type = Type::ITEMSET;
public static $brickFile = 'itemset';
public static $dataTable = '?_itemset';
@@ -80,14 +80,14 @@ class ItemsetList extends BaseType
$data = [];
if ($this->classes && ($addMask & GLOBALINFO_RELATED))
$data[TYPE_CLASS] = array_combine($this->classes, $this->classes);
$data[Type::CHR_CLASS] = array_combine($this->classes, $this->classes);
if ($this->pieceToSet && ($addMask & GLOBALINFO_SELF))
$data[TYPE_ITEM] = array_combine(array_keys($this->pieceToSet), array_keys($this->pieceToSet));
$data[Type::ITEM] = array_combine(array_keys($this->pieceToSet), array_keys($this->pieceToSet));
if ($addMask & GLOBALINFO_SELF)
foreach ($this->iterate() as $id => $__)
$data[TYPE_ITEMSET][$id] = ['name' => $this->getField('name', true)];
$data[Type::ITEMSET][$id] = ['name' => $this->getField('name', true)];
return $data;
}

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class MailList extends BaseType
{
public static $type = TYPE_MAIL;
public static $type = Type::MAIL;
public static $brickFile = 'mail';
public static $dataTable = '?_mails';
@@ -63,7 +63,7 @@ class MailList extends BaseType
foreach ($this->iterate() as $__)
if ($a = $this->curTpl['attachment'])
$data[TYPE_ITEM][$a] = $a;
$data[Type::ITEM][$a] = $a;
return $data;
}

View File

@@ -8,7 +8,7 @@ class PetList extends BaseType
{
use ListviewHelper;
public static $type = TYPE_PET;
public static $type = Type::PET;
public static $brickFile = 'pet';
public static $dataTable = '?_pet';
@@ -59,10 +59,10 @@ class PetList extends BaseType
if ($addMask & GLOBALINFO_RELATED)
for ($i = 1; $i <= 4; $i++)
if ($this->curTpl['spellId'.$i] > 0)
$data[TYPE_SPELL][$this->curTpl['spellId'.$i]] = $this->curTpl['spellId'.$i];
$data[Type::SPELL][$this->curTpl['spellId'.$i]] = $this->curTpl['spellId'.$i];
if ($addMask & GLOBALINFO_SELF)
$data[TYPE_PET][$this->id] = ['icon' => $this->curTpl['iconString']];
$data[Type::PET][$this->id] = ['icon' => $this->curTpl['iconString']];
}
return $data;

View File

@@ -417,7 +417,7 @@ class ProfileListFilter extends Filter
if ($this->useLocalList)
{
$this->extraOpts[$k] = array(
'j' => ['?_profiler_completion '.$k.' ON '.$k.'.id = p.id AND '.$k.'.`type` = '.TYPE_SKILL.' AND '.$k.'.typeId = '.$skillId.' AND '.$k.'.cur '.$cr[1].' '.$cr[2], true],
'j' => ['?_profiler_completion '.$k.' ON '.$k.'.id = p.id AND '.$k.'.`type` = '.Type::SKILL.' AND '.$k.'.typeId = '.$skillId.' AND '.$k.'.cur '.$cr[1].' '.$cr[2], true],
's' => [', '.$k.'.cur AS '.$col]
);
return [$k.'.typeId', null, '!'];
@@ -444,7 +444,7 @@ class ProfileListFilter extends Filter
if ($this->useLocalList)
{
$this->extraOpts[$k] = ['j' => ['?_profiler_completion '.$k.' ON '.$k.'.id = p.id AND '.$k.'.`type` = '.TYPE_ACHIEVEMENT.' AND '.$k.'.typeId = '.$cr[2], true]];
$this->extraOpts[$k] = ['j' => ['?_profiler_completion '.$k.' ON '.$k.'.id = p.id AND '.$k.'.`type` = '.Type::ACHIEVEMENT.' AND '.$k.'.typeId = '.$cr[2], true]];
return [$k.'.typeId', null, '!'];
}
else
@@ -754,7 +754,7 @@ class LocalProfileList extends ProfileList
$realms = Profiler::getRealms();
// post processing
$acvPoints = DB::Aowow()->selectCol('SELECT pc.id AS ARRAY_KEY, SUM(a.points) FROM ?_profiler_completion pc LEFT JOIN ?_achievement a ON a.id = pc.typeId WHERE pc.`type` = ?d AND pc.id IN (?a) GROUP BY pc.id', TYPE_ACHIEVEMENT, $this->getFoundIDs());
$acvPoints = DB::Aowow()->selectCol('SELECT pc.id AS ARRAY_KEY, SUM(a.points) FROM ?_profiler_completion pc LEFT JOIN ?_achievement a ON a.id = pc.typeId WHERE pc.`type` = ?d AND pc.id IN (?a) GROUP BY pc.id', Type::ACHIEVEMENT, $this->getFoundIDs());
foreach ($this->iterate() as $id => &$curTpl)
{

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class QuestList extends BaseType
{
public static $type = TYPE_QUEST;
public static $type = Type::QUEST;
public static $brickFile = 'quest';
public static $dataTable = '?_quests';
@@ -49,18 +49,18 @@ class QuestList extends BaseType
for ($i = 1; $i < 7; $i++)
{
if ($_ = $_curTpl['reqItemId'.$i])
$requires[TYPE_ITEM][] = $_;
$requires[Type::ITEM][] = $_;
if ($i > 4)
continue;
if ($_curTpl['reqNpcOrGo'.$i] > 0)
$requires[TYPE_NPC][] = $_curTpl['reqNpcOrGo'.$i];
$requires[Type::NPC][] = $_curTpl['reqNpcOrGo'.$i];
else if ($_curTpl['reqNpcOrGo'.$i] < 0)
$requires[TYPE_OBJECT][] = -$_curTpl['reqNpcOrGo'.$i];
$requires[Type::OBJECT][] = -$_curTpl['reqNpcOrGo'.$i];
if ($_ = $_curTpl['reqSourceItemId'.$i])
$requires[TYPE_ITEM][] = $_;
$requires[Type::ITEM][] = $_;
}
if ($requires)
$this->requires[$id] = $requires;
@@ -70,24 +70,24 @@ class QuestList extends BaseType
$choices = [];
if ($_ = $_curTpl['rewardTitleId'])
$rewards[TYPE_TITLE][] = $_;
$rewards[Type::TITLE][] = $_;
if ($_ = $_curTpl['rewardHonorPoints'])
$rewards[TYPE_CURRENCY][104] = $_;
$rewards[Type::CURRENCY][104] = $_;
if ($_ = $_curTpl['rewardArenaPoints'])
$rewards[TYPE_CURRENCY][103] = $_;
$rewards[Type::CURRENCY][103] = $_;
for ($i = 1; $i < 7; $i++)
{
if ($_ = $_curTpl['rewardChoiceItemId'.$i])
$choices[TYPE_ITEM][$_] = $_curTpl['rewardChoiceItemCount'.$i];
$choices[Type::ITEM][$_] = $_curTpl['rewardChoiceItemCount'.$i];
if ($i > 5)
continue;
if ($_ = $_curTpl['rewardFactionId'.$i])
$rewards[TYPE_FACTION][$_] = $_curTpl['rewardFactionValue'.$i];
$rewards[Type::FACTION][$_] = $_curTpl['rewardFactionValue'.$i];
if ($i > 4)
continue;
@@ -96,9 +96,9 @@ class QuestList extends BaseType
{
$qty = $_curTpl['rewardItemCount'.$i];
if (in_array($_, $currencies))
$rewards[TYPE_CURRENCY][array_search($_, $currencies)] = $qty;
$rewards[Type::CURRENCY][array_search($_, $currencies)] = $qty;
else
$rewards[TYPE_ITEM][$_] = $qty;
$rewards[Type::ITEM][$_] = $qty;
}
}
if ($rewards)
@@ -156,7 +156,7 @@ class QuestList extends BaseType
{
$data[$this->id] = array(
"n" => $this->getField('name', true),
"t" => TYPE_QUEST,
"t" => Type::QUEST,
"ti" => $this->id,
"c" => $this->curTpl['cat1'],
"c2" => $this->curTpl['cat2']
@@ -214,16 +214,16 @@ class QuestList extends BaseType
'xp' => $this->curTpl['rewardXP']
);
if (!empty($this->rewards[$this->id][TYPE_CURRENCY]))
foreach ($this->rewards[$this->id][TYPE_CURRENCY] as $iId => $qty)
if (!empty($this->rewards[$this->id][Type::CURRENCY]))
foreach ($this->rewards[$this->id][Type::CURRENCY] as $iId => $qty)
$data[$this->id]['currencyrewards'][] = [$iId, $qty];
if (!empty($this->rewards[$this->id][TYPE_ITEM]))
foreach ($this->rewards[$this->id][TYPE_ITEM] as $iId => $qty)
if (!empty($this->rewards[$this->id][Type::ITEM]))
foreach ($this->rewards[$this->id][Type::ITEM] as $iId => $qty)
$data[$this->id]['itemrewards'][] = [$iId, $qty];
if (!empty($this->choices[$this->id][TYPE_ITEM]))
foreach ($this->choices[$this->id][TYPE_ITEM] as $iId => $qty)
if (!empty($this->choices[$this->id][Type::ITEM]))
foreach ($this->choices[$this->id][Type::ITEM] as $iId => $qty)
$data[$this->id]['itemchoices'][] = [$iId, $qty];
if ($_ = $this->curTpl['rewardTitleId'])
@@ -390,31 +390,31 @@ class QuestList extends BaseType
// items
for ($i = 1; $i < 5; $i++)
if ($this->curTpl['rewardItemId'.$i] > 0)
$data[TYPE_ITEM][$this->curTpl['rewardItemId'.$i]] = $this->curTpl['rewardItemId'.$i];
$data[Type::ITEM][$this->curTpl['rewardItemId'.$i]] = $this->curTpl['rewardItemId'.$i];
for ($i = 1; $i < 7; $i++)
if ($this->curTpl['rewardChoiceItemId'.$i] > 0)
$data[TYPE_ITEM][$this->curTpl['rewardChoiceItemId'.$i]] = $this->curTpl['rewardChoiceItemId'.$i];
$data[Type::ITEM][$this->curTpl['rewardChoiceItemId'.$i]] = $this->curTpl['rewardChoiceItemId'.$i];
// spells
if ($this->curTpl['rewardSpell'] > 0)
$data[TYPE_SPELL][$this->curTpl['rewardSpell']] = $this->curTpl['rewardSpell'];
$data[Type::SPELL][$this->curTpl['rewardSpell']] = $this->curTpl['rewardSpell'];
if ($this->curTpl['rewardSpellCast'] > 0)
$data[TYPE_SPELL][$this->curTpl['rewardSpellCast']] = $this->curTpl['rewardSpellCast'];
$data[Type::SPELL][$this->curTpl['rewardSpellCast']] = $this->curTpl['rewardSpellCast'];
// titles
if ($this->curTpl['rewardTitleId'] > 0)
$data[TYPE_TITLE][$this->curTpl['rewardTitleId']] = $this->curTpl['rewardTitleId'];
$data[Type::TITLE][$this->curTpl['rewardTitleId']] = $this->curTpl['rewardTitleId'];
// currencies
if (!empty($this->rewards[$this->id][TYPE_CURRENCY]))
foreach ($this->rewards[$this->id][TYPE_CURRENCY] as $id => $__)
$data[TYPE_CURRENCY][$id] = $id;
if (!empty($this->rewards[$this->id][Type::CURRENCY]))
foreach ($this->rewards[$this->id][Type::CURRENCY] as $id => $__)
$data[Type::CURRENCY][$id] = $id;
}
if ($addMask & GLOBALINFO_SELF)
$data[TYPE_QUEST][$this->id] = ['name' => $this->getField('name', true)];
$data[Type::QUEST][$this->id] = ['name' => $this->getField('name', true)];
}
return $data;
@@ -581,11 +581,11 @@ class QuestListFilter extends Filter
switch ($cr[1])
{
case 1: // npc
return ['AND', ['qse.type', TYPE_NPC], ['qse.method', $flags, '&']];
return ['AND', ['qse.type', Type::NPC], ['qse.method', $flags, '&']];
case 2: // object
return ['AND', ['qse.type', TYPE_OBJECT], ['qse.method', $flags, '&']];
return ['AND', ['qse.type', Type::OBJECT], ['qse.method', $flags, '&']];
case 3: // item
return ['AND', ['qse.type', TYPE_ITEM], ['qse.method', $flags, '&']];
return ['AND', ['qse.type', Type::ITEM], ['qse.method', $flags, '&']];
}
return false;

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class SkillList extends BaseType
{
public static $type = TYPE_SKILL;
public static $type = Type::SKILL;
public static $brickFile = 'skill';
public static $dataTable = '?_skillline';

View File

@@ -8,7 +8,7 @@ class SoundList extends BaseType
{
use spawnHelper;
public static $type = TYPE_SOUND;
public static $type = Type::SOUND;
public static $brickFile = 'sound';
public static $dataTable = '?_sounds';
public static $contribute = CONTRIBUTE_CO;

View File

@@ -12,7 +12,7 @@ class SpellList extends BaseType
public $relItems = null;
public $sources = [];
public static $type = TYPE_SPELL;
public static $type = Type::SPELL;
public static $brickFile = 'spell';
public static $dataTable = '?_spell';
@@ -54,7 +54,7 @@ class SpellList extends BaseType
protected $queryBase = 'SELECT s.*, s.id AS ARRAY_KEY FROM ?_spell s';
protected $queryOpts = array(
's' => [['src', 'sr', 'ic', 'ica']], // 6: TYPE_SPELL
's' => [['src', 'sr', 'ic', 'ica']], // 6: Type::SPELL
'ic' => ['j' => ['?_icons ic ON ic.id = s.iconId', true], 's' => ', ic.name AS iconString'],
'ica' => ['j' => ['?_icons ica ON ica.id = s.iconIdAlt', true], 's' => ', ica.name AS iconStringAlt'],
'sr' => ['j' => ['?_spellrange sr ON sr.id = s.rangeId'], 's' => ', sr.rangeMinHostile, sr.rangeMinFriend, sr.rangeMaxHostile, sr.rangeMaxFriend, sr.name_loc0 AS rangeText_loc0, sr.name_loc2 AS rangeText_loc2, sr.name_loc3 AS rangeText_loc3, sr.name_loc4 AS rangeText_loc4, sr.name_loc6 AS rangeText_loc6, sr.name_loc8 AS rangeText_loc8'],
@@ -161,7 +161,7 @@ class SpellList extends BaseType
// Enchant Item Permanent (53) / Temporary (54)
if (in_array($this->curTpl['effect'.$i.'Id'], [53, 54]))
{
if ($mv && ($json = DB::Aowow()->selectRow('SELECT * FROM ?_item_stats WHERE `type` = ?d AND `typeId` = ?d', TYPE_ENCHANTMENT, $mv)))
if ($mv && ($json = DB::Aowow()->selectRow('SELECT * FROM ?_item_stats WHERE `type` = ?d AND `typeId` = ?d', Type::ENCHANTMENT, $mv)))
{
$mods = [];
foreach ($json as $str => $val)
@@ -637,18 +637,18 @@ class SpellList extends BaseType
// GO Model from MiscVal
if (in_array($this->curTpl['effect'.$i.'Id'], [50, 76, 104, 105, 106, 107]))
{
if (isset($displays[TYPE_OBJECT][$id]))
$displays[TYPE_OBJECT][$id][0][] = $i;
if (isset($displays[Type::OBJECT][$id]))
$displays[Type::OBJECT][$id][0][] = $i;
else
$displays[TYPE_OBJECT][$id] = [[$i], $effMV];
$displays[Type::OBJECT][$id] = [[$i], $effMV];
}
// NPC Model from MiscVal
else if (in_array($this->curTpl['effect'.$i.'Id'], [28, 90, 56, 112, 134]) || in_array($this->curTpl['effect'.$i.'AuraId'], [56, 78]))
{
if (isset($displays[TYPE_NPC][$id]))
$displays[TYPE_NPC][$id][0][] = $i;
if (isset($displays[Type::NPC][$id]))
$displays[Type::NPC][$id][0][] = $i;
else
$displays[TYPE_NPC][$id] = [[$i], $effMV];
$displays[Type::NPC][$id] = [[$i], $effMV];
}
// Shapeshift
else if ($this->curTpl['effect'.$i.'AuraId'] == 36)
@@ -679,12 +679,12 @@ class SpellList extends BaseType
$results = $displays[0];
if (!empty($displays[TYPE_NPC]))
if (!empty($displays[Type::NPC]))
{
$nModels = new CreatureList(array(['id', array_column($displays[TYPE_NPC], 1)]));
$nModels = new CreatureList(array(['id', array_column($displays[Type::NPC], 1)]));
foreach ($nModels->iterate() as $nId => $__)
{
foreach ($displays[TYPE_NPC] as $srcId => [$indizes, $npcId])
foreach ($displays[Type::NPC] as $srcId => [$indizes, $npcId])
{
if ($npcId == $nId)
{
@@ -701,12 +701,12 @@ class SpellList extends BaseType
}
}
if (!empty($displays[TYPE_OBJECT]))
if (!empty($displays[Type::OBJECT]))
{
$oModels = new GameObjectList(array(['id', array_column($displays[TYPE_OBJECT], 1)]));
$oModels = new GameObjectList(array(['id', array_column($displays[Type::OBJECT], 1)]));
foreach ($oModels->iterate() as $oId => $__)
{
foreach ($displays[TYPE_OBJECT] as $srcId => [$indizes, $objId])
foreach ($displays[Type::OBJECT] as $srcId => [$indizes, $objId])
{
if ($objId == $oId)
{
@@ -2205,24 +2205,24 @@ class SpellList extends BaseType
if ($mask = $this->curTpl['reqClassMask'])
for ($i = 0; $i < 11; $i++)
if ($mask & (1 << $i))
$data[TYPE_CLASS][$i + 1] = $i + 1;
$data[Type::CHR_CLASS][$i + 1] = $i + 1;
if ($mask = $this->curTpl['reqRaceMask'])
for ($i = 0; $i < 11; $i++)
if ($mask & (1 << $i))
$data[TYPE_RACE][$i + 1] = $i + 1;
$data[Type::CHR_RACE][$i + 1] = $i + 1;
// play sound effect
for ($i = 1; $i < 4; $i++)
if ($this->getField('effect'.$i.'Id') == 131 || $this->getField('effect'.$i.'Id') == 132)
$data[TYPE_SOUND][$this->getField('effect'.$i.'MiscValue')] = $this->getField('effect'.$i.'MiscValue');
$data[Type::SOUND][$this->getField('effect'.$i.'MiscValue')] = $this->getField('effect'.$i.'MiscValue');
}
if ($addMask & GLOBALINFO_SELF)
{
$iconString = $this->curTpl['iconStringAlt'] ? 'iconStringAlt' : 'iconString';
$data[TYPE_SPELL][$id] = array(
$data[Type::SPELL][$id] = array(
'icon' => $this->curTpl[$iconString],
'name' => $this->getField('name', true),
);
@@ -2234,12 +2234,12 @@ class SpellList extends BaseType
$tTip = $this->renderTooltip(MAX_LEVEL, true);
foreach ($tTip[1] as $relId => $_)
if (empty($data[TYPE_SPELL][$relId]))
$data[TYPE_SPELL][$relId] = $relId;
if (empty($data[Type::SPELL][$relId]))
$data[Type::SPELL][$relId] = $relId;
foreach ($buff[1] as $relId => $_)
if (empty($data[TYPE_SPELL][$relId]))
$data[TYPE_SPELL][$relId] = $relId;
if (empty($data[Type::SPELL][$relId]))
$data[Type::SPELL][$relId] = $relId;
$extra[$id] = array(
'id' => $id,
@@ -2336,7 +2336,7 @@ class SpellList extends BaseType
{
$data[$this->id] = array(
'n' => $this->getField('name', true),
't' => TYPE_SPELL,
't' => Type::SPELL,
'ti' => $this->id,
's' => empty($this->curTpl['skillLines']) ? 0 : $this->curTpl['skillLines'][0],
'c' => $this->curTpl['typeCat'],

View File

@@ -8,7 +8,7 @@ class TitleList extends BaseType
{
use listviewHelper;
public static $type = TYPE_TITLE;
public static $type = Type::TITLE;
public static $brickFile = 'title';
public static $dataTable = '?_titles';
@@ -16,7 +16,7 @@ class TitleList extends BaseType
protected $queryBase = 'SELECT t.*, id AS ARRAY_KEY FROM ?_titles t';
protected $queryOpts = array(
't' => [['src']], // 11: TYPE_TITLE
't' => [['src']], // 11: Type::TITLE
'src' => ['j' => ['?_source src ON type = 11 AND typeId = t.id', true], 's' => ', src13, moreType, moreTypeId']
);
@@ -28,9 +28,9 @@ class TitleList extends BaseType
foreach ($this->iterate() as $id => &$_curTpl)
{
// preparse sources - notice: under this system titles can't have more than one source (or two for achivements), which is enough for standard TC cases but may break custom cases
if ($_curTpl['moreType'] == TYPE_ACHIEVEMENT)
if ($_curTpl['moreType'] == Type::ACHIEVEMENT)
$this->sources[$this->id][12][] = $_curTpl['moreTypeId'];
else if ($_curTpl['moreType'] == TYPE_QUEST)
else if ($_curTpl['moreType'] == Type::QUEST)
$this->sources[$this->id][4][] = $_curTpl['moreTypeId'];
else if ($_curTpl['src13'])
$this->sources[$this->id][13][] = $_curTpl['src13'];
@@ -81,10 +81,10 @@ class TitleList extends BaseType
foreach ($this->iterate() as $__)
{
$data[TYPE_TITLE][$this->id]['name'] = $this->getField('male', true);
$data[Type::TITLE][$this->id]['name'] = $this->getField('male', true);
if ($_ = $this->getField('female', true))
$data[TYPE_TITLE][$this->id]['namefemale'] = $_;
$data[Type::TITLE][$this->id]['namefemale'] = $_;
}
return $data;

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class UserList extends BaseType
{
public static $type = TYPE_USER;
public static $type = Type::USER;
public static $brickFile = 'user';
public static $dataTable = ''; // doesn't have community content
@@ -52,7 +52,7 @@ class UserList extends BaseType
// border: seen as null|1|3 .. changes the border around the avatar (i suspect its meaning changed and got decupled from premium-status with the introduction of patron-status)
}
return [TYPE_USER => $data];
return [Type::USER => $data];
}
public function renderTooltip() { }

View File

@@ -6,7 +6,7 @@ if (!defined('AOWOW_REVISION'))
class WorldEventList extends BaseType
{
public static $type = TYPE_WORLDEVENT;
public static $type = Type::WORLDEVENT;
public static $brickFile = 'event';
public static $dataTable = '?_events';
@@ -162,7 +162,7 @@ class WorldEventList extends BaseType
$data = [];
foreach ($this->iterate() as $__)
$data[TYPE_WORLDEVENT][$this->id] = ['name' => $this->getField('name', true), 'icon' => $this->curTpl['iconString']];
$data[Type::WORLDEVENT][$this->id] = ['name' => $this->getField('name', true), 'icon' => $this->curTpl['iconString']];
return $data;
}

View File

@@ -8,7 +8,7 @@ class ZoneList extends BaseType
{
use listviewHelper;
public static $type = TYPE_ZONE;
public static $type = Type::ZONE;
public static $brickFile = 'zone';
public static $dataTable = '?_zones';
@@ -100,7 +100,7 @@ class ZoneList extends BaseType
$data = [];
foreach ($this->iterate() as $__)
$data[TYPE_ZONE][$this->id] = ['name' => $this->getField('name', true)];
$data[Type::ZONE][$this->id] = ['name' => $this->getField('name', true)];
return $data;
}

View File

@@ -663,11 +663,8 @@ class User
$data = [];
foreach ($res as $type => $ids)
{
if (empty(Util::$typeClasses[$type]))
continue;
$tc = new Util::$typeClasses[$type]([['id', array_values($ids)]]);
if ($tc->error)
$tc = Type::newList($type, [['id', array_values($ids)]]);
if (!$tc || $tc->error)
continue;
$entities = [];

View File

@@ -116,7 +116,7 @@ trait TrRequestData
}
}
class CLI
abstract class CLI
{
const CHR_BELL = 7;
const CHR_BACK = 8;
@@ -411,7 +411,7 @@ class CLI
}
class Util
abstract class Util
{
const FILE_ACCESS = 0777;
@@ -432,29 +432,6 @@ class Util
'us', 'eu', 'kr', 'tw', 'cn'
);
public static $typeClasses = array(
null, 'CreatureList', 'GameObjectList', 'ItemList', 'ItemsetList', 'QuestList', 'SpellList',
'ZoneList', 'FactionList', 'PetList', 'AchievementList', 'TitleList', 'WorldEventList', 'CharClassList',
'CharRaceList', 'SkillList', null, 'CurrencyList', null, 'SoundList',
TYPE_ICON => 'IconList',
TYPE_EMOTE => 'EmoteList',
TYPE_ENCHANTMENT => 'EnchantmentList',
TYPE_AREATRIGGER => 'AreatriggerList',
TYPE_MAIL => 'MailList'
);
public static $typeStrings = array( // zero-indexed
null, 'npc', 'object', 'item', 'itemset', 'quest', 'spell', 'zone', 'faction',
'pet', 'achievement', 'title', 'event', 'class', 'race', 'skill', null, 'currency',
null, 'sound',
TYPE_ICON => 'icon',
TYPE_USER => 'user',
TYPE_EMOTE => 'emote',
TYPE_ENCHANTMENT => 'enchantment',
TYPE_AREATRIGGER => 'areatrigger',
TYPE_MAIL => 'mail'
);
# todo (high): find a sensible way to write data here on setup
private static $gtCombatRatings = array(
12 => 1.5, 13 => 13.8, 14 => 13.8, 15 => 5, 16 => 10, 17 => 10, 18 => 8, 19 => 14, 20 => 14,
@@ -1031,7 +1008,7 @@ class Util
foreach ($arr as $type => $data)
{
// bad data or empty
if (empty(Util::$typeStrings[$type]) || !is_array($data) || !$data)
if (!Type::exists($type) || !is_array($data) || !$data)
continue;
if (!isset($master[$type]))
@@ -1159,7 +1136,7 @@ class Util
case CND_SRC_SPELL_CLICK_EVENT: // 18
case CND_SRC_VEHICLE_SPELL: // 21
case CND_SRC_NPC_VENDOR: // 23
$jsGlobals[TYPE_NPC][] = $c['SourceGroup'];
$jsGlobals[Type::NPC][] = $c['SourceGroup'];
break;
}
@@ -1168,12 +1145,12 @@ class Util
case CND_AURA: // 1
$c['ConditionValue2'] = null; // do not use his param
case CND_SPELL: // 25
$jsGlobals[TYPE_SPELL][] = $c['ConditionValue1'];
$jsGlobals[Type::SPELL][] = $c['ConditionValue1'];
break;
case CND_ITEM: // 2
$c['ConditionValue3'] = null; // do not use his param
case CND_ITEM_EQUIPPED: // 3
$jsGlobals[TYPE_ITEM][] = $c['ConditionValue1'];
$jsGlobals[Type::ITEM][] = $c['ConditionValue1'];
break;
case CND_MAPID: // 22 - break down to area or remap for use with g_zone_categories
switch ($c['ConditionValue1'])
@@ -1197,7 +1174,7 @@ class Util
$zone = new ZoneList($cnd);
if (!$zone->error)
{
$jsGlobals[TYPE_ZONE][] = $zone->getField('id');
$jsGlobals[Type::ZONE][] = $zone->getField('id');
$c['ConditionTypeOrReference'] = CND_ZONEID;
$c['ConditionValue1'] = $zone->getField('id');
break;
@@ -1207,50 +1184,50 @@ class Util
}
case CND_ZONEID: // 4
case CND_AREAID: // 23
$jsGlobals[TYPE_ZONE][] = $c['ConditionValue1'];
$jsGlobals[Type::ZONE][] = $c['ConditionValue1'];
break;
case CND_REPUTATION_RANK: // 5
$jsGlobals[TYPE_FACTION][] = $c['ConditionValue1'];
$jsGlobals[Type::FACTION][] = $c['ConditionValue1'];
break;
case CND_SKILL: // 7
$jsGlobals[TYPE_SKILL][] = $c['ConditionValue1'];
$jsGlobals[Type::SKILL][] = $c['ConditionValue1'];
break;
case CND_QUESTREWARDED: // 8
case CND_QUESTTAKEN: // 9
case CND_QUEST_NONE: // 14
case CND_QUEST_COMPLETE: // 28
$jsGlobals[TYPE_QUEST][] = $c['ConditionValue1'];
$jsGlobals[Type::QUEST][] = $c['ConditionValue1'];
break;
case CND_ACTIVE_EVENT: // 12
$jsGlobals[TYPE_WORLDEVENT][] = $c['ConditionValue1'];
$jsGlobals[Type::WORLDEVENT][] = $c['ConditionValue1'];
break;
case CND_ACHIEVEMENT: // 17
$jsGlobals[TYPE_ACHIEVEMENT][] = $c['ConditionValue1'];
$jsGlobals[Type::ACHIEVEMENT][] = $c['ConditionValue1'];
break;
case CND_TITLE: // 18
$jsGlobals[TYPE_TITLE][] = $c['ConditionValue1'];
$jsGlobals[Type::TITLE][] = $c['ConditionValue1'];
break;
case CND_NEAR_CREATURE: // 29
$jsGlobals[TYPE_NPC][] = $c['ConditionValue1'];
$jsGlobals[Type::NPC][] = $c['ConditionValue1'];
break;
case CND_NEAR_GAMEOBJECT: // 30
$jsGlobals[TYPE_OBJECT][] = $c['ConditionValue1'];
$jsGlobals[Type::OBJECT][] = $c['ConditionValue1'];
break;
case CND_CLASS: // 15
for ($i = 0; $i < 11; $i++)
if ($c['ConditionValue1'] & (1 << $i))
$jsGlobals[TYPE_CLASS][] = $i + 1;
$jsGlobals[Type::CHR_CLASS][] = $i + 1;
break;
case CND_RACE: // 16
for ($i = 0; $i < 11; $i++)
if ($c['ConditionValue1'] & (1 << $i))
$jsGlobals[TYPE_RACE][] = $i + 1;
$jsGlobals[Type::CHR_RACE][] = $i + 1;
break;
case CND_OBJECT_ENTRY: // 31
if ($c['ConditionValue1'] == 3)
$jsGlobals[TYPE_NPC][] = $c['ConditionValue2'];
$jsGlobals[Type::NPC][] = $c['ConditionValue2'];
else if ($c['ConditionValue1'] == 5)
$jsGlobals[TYPE_OBJECT][] = $c['ConditionValue2'];
$jsGlobals[Type::OBJECT][] = $c['ConditionValue2'];
break;
case CND_TEAM: // 6
if ($c['ConditionValue1'] == 469) // Alliance
@@ -1673,4 +1650,223 @@ class Util
}
}
abstract class Type
{
public const NPC = 1;
public const OBJECT = 2;
public const ITEM = 3;
public const ITEMSET = 4;
public const QUEST = 5;
public const SPELL = 6;
public const ZONE = 7;
public const FACTION = 8;
public const PET = 9;
public const ACHIEVEMENT = 10;
public const TITLE = 11;
public const WORLDEVENT = 12;
public const CHR_CLASS = 13;
public const CHR_RACE = 14;
public const SKILL = 15;
public const STATISTIC = 16;
public const CURRENCY = 17;
// PROJECT = 18;
public const SOUND = 19;
// BUILDING = 20;
// FOLLOWER = 21;
// MISSION_ABILITY = 22;
// MISSION = 23;
// SHIP = 25;
// THREAT = 26;
// RESOURCE = 27;
// CHAMPION = 28;
public const ICON = 29;
// ORDER_ADVANCEMENT = 30;
// FOLLOWER_ALLIANCE = 31;
// FOLLOWER_HORDE = 32;
// SHIP_ALLIANCE = 33;
// SHIP_HORDE = 34;
// CHAMPION_ALLIANCE = 35;
// CHAMPION_HORDE = 36;
// TRANSMOG_ITEM = 37;
// BFA_CHAMPION = 38;
// BFA_CHAMPION_ALLIANCE = 39;
// AFFIX = 40;
// BFA_CHAMPION_HORDE = 41;
// AZERITE_ESSENCE_POWER = 42;
// AZERITE_ESSENCE = 43;
// STORYLINE = 44;
// ADVENTURE_COMBATANT_ABILITY = 46;
// ENCOUNTER = 47;
// COVENANT = 48;
// SOULBIND = 49;
// DI_ITEM = 50;
// GATHERER_SCREENSHOT = 91;
// GATHERER_GUIDE_IMAGE = 98;
public const PROFILE = 100;
// our own things
public const GUILD = 101;
// TRANSMOG_SET = 101; // future conflict inc.
public const ARENA_TEAM = 102;
// OUTFIT = 110;
// GEAR_SET = 111;
// GATHERER_LISTVIEW = 158;
// GATHERER_SURVEY_COVENANTS = 161;
// NEWS_POST = 162;
// BATTLE_PET_ABILITY = 200;
public const GUIDE = 300; // should have been 100, but conflicts with old version of Profile/List
public const USER = 500;
public const EMOTE = 501;
public const ENCHANTMENT = 502;
public const AREATRIGGER = 503;
public const MAIL = 504;
// Blizzard API things
// MOUNT = -1000;
// RECIPE = -1001;
// BATTLE_PET = -1002;
public const FLAG_NONE = 0x0;
public const FLAG_RANDOM_SEARCHABLE = 0x1;
/* public const FLAG_SEARCHABLE = 0x2 general search? */
public const IDX_LIST_OBJ = 0;
public const IDX_FILE_STR = 1;
public const IDX_JSG_TPL = 2;
public const IDX_FLAGS = 3;
private static /* array */ $data = array(
self::NPC => ['CreatureList', 'npc', 'g_npcs', 0x1],
self::OBJECT => ['GameObjectList', 'object', 'g_objects', 0x1],
self::ITEM => ['ItemList', 'item', 'g_items', 0x1],
self::ITEMSET => ['ItemsetList', 'itemset', 'g_itemsets', 0x1],
self::QUEST => ['QuestList', 'quest', 'g_quests', 0x1],
self::SPELL => ['SpellList', 'spell', 'g_spells', 0x1],
self::ZONE => ['ZoneList', 'zone', 'g_gatheredzones', 0x1],
self::FACTION => ['FactionList', 'faction', 'g_factions', 0x1],
self::PET => ['PetList', 'pet', 'g_pets', 0x1],
self::ACHIEVEMENT => ['AchievementList', 'achievement', 'g_achievements', 0x1],
self::TITLE => ['TitleList', 'title', 'g_titles', 0x1],
self::WORLDEVENT => ['WorldEventList', 'event', 'g_holidays', 0x1],
self::CHR_CLASS => ['CharClassList', 'class', 'g_classes', 0x1],
self::CHR_RACE => ['CharRaceList', 'race', 'g_races', 0x1],
self::SKILL => ['SkillList', 'skill', 'g_skills', 0x1],
self::STATISTIC => ['AchievementList', 'achievement', 'g_achievements', 0x1], // alias for achievements; exists only for Markup
self::CURRENCY => ['CurrencyList', 'currency', 'g_gatheredcurrencies',0x1],
self::SOUND => ['SoundList', 'sound', 'g_sounds', 0x1],
self::ICON => ['IconList', 'icon', 'g_icons', 0x1],
self::GUIDE => ['GuideList', 'guide', '', 0x0],
self::PROFILE => ['ProfileList', '', '', 0x0], // x - not known in javascript
self::GUILD => ['GuildList', '', '', 0x0], // x
self::ARENA_TEAM => ['ArenaTeamList', '', '', 0x0], // x
self::USER => ['UserList', 'user', 'g_users', 0x0], // x
self::EMOTE => ['EmoteList', 'emote', 'g_emotes', 0x1],
self::ENCHANTMENT => ['EnchantmentList', 'enchantment', 'g_enchantments', 0x1],
self::AREATRIGGER => ['AreatriggerList', 'areatrigger', '', 0x0],
self::MAIL => ['MailList', 'mail', '', 0x1]
);
/********************/
/* Field Operations */
/********************/
public static function newList(int $type, ?array $conditions = []) : ?BaseType
{
if (!self::exists($type))
return null;
return new (self::$data[$type][self::IDX_LIST_OBJ])($conditions);
}
public static function getFileString(int $type) : string
{
if (!self::exists($type))
return '';
return self::$data[$type][self::IDX_FILE_STR];
}
public static function getJSGlobalString(int $type) : string
{
if (!self::exists($type))
return '';
return self::$data[$type][self::IDX_JSG_TPL];
}
public static function getJSGlobalTemplate(int $type) : array
{
if (!self::exists($type))
return [];
// [key, [data], [extraData]]
return [self::$data[$type][self::IDX_JSG_TPL], [], []];
}
public static function checkClassAttrib(int $type, string $attr, ?int $attrVal = null) : bool
{
if (!self::exists($type))
return false;
return isset((self::$data[$type][self::IDX_LIST_OBJ])::$$attr) && ($attrVal === null || ((self::$data[$type][self::IDX_LIST_OBJ])::$$attr & $attrVal));
}
public static function getClassAttrib(int $type, string $attr) : mixed
{
if (!self::exists($type))
return null;
return (self::$data[$type][self::IDX_LIST_OBJ])::$$attr ?? null;
}
public static function exists(int $type) : bool
{
return !empty(self::$data[$type]);
}
public static function getIndexFrom(int $idx, string $match) : int
{
$i = array_search($match, array_column(self::$data, $idx));
if ($i === false)
return 0;
return array_keys(self::$data)[$i];
}
/*********************/
/* Column Operations */
/*********************/
public static function getClassesFor(int $flags = 0x0, string $attr = '', ?int $attrVal = null) : array
{
$x = [];
foreach (self::$data as $k => [$o, , , $f])
if ($o && (!$flags || $flags & $f))
if (!$attr || self::checkClassAttrib($attr, $attrVal))
$x[$k] = $o;
return $x;
}
public static function getFileStringsFor(int $flags = 0x0) : array
{
$x = [];
foreach (self::$data as $k => [, $s, , $f])
if ($s && (!$flags || $flags & $f))
$x[$k] = $s;
return $x;
}
public static function getJSGTemplatesFor(int $flags = 0x0) : array
{
$x = [];
foreach (self::$data as $k => [, , $a, $f])
if ($a && (!$flags || $flags & $f))
$x[$k] = $a;
return $x;
}
}
?>

View File

@@ -245,7 +245,7 @@ class Lang
else if ($interactive && !$asHTML)
{
$name = '[item='.$prop.']';
$ids[TYPE_ITEM][] = $prop;
$ids[Type::ITEM][] = $prop;
}
}
else if ($lock['type'.$i] == LOCK_TYPE_SKILL)
@@ -269,7 +269,7 @@ class Lang
else if ($interactive && !$asHTML)
{
$name = '[skill='.$skills[$prop].']';
$ids[TYPE_SKILL][] = $skills[$prop];
$ids[Type::SKILL][] = $skills[$prop];
}
if ($rank > 0)
@@ -283,7 +283,7 @@ class Lang
else if ($interactive && !$asHTML)
{
$name = '[spell=1842]';
$ids[TYPE_SPELL][] = 1842;
$ids[Type::SPELL][] = 1842;
}
}
// exclude unusual stuff
@@ -481,6 +481,12 @@ class Lang
return number_format($number, $decimals, $seps[User::$localeId][1], $no1k ? '' : $seps[User::$localeId][0]);
}
public static function typeName(int $type) : string
{
return Util::ucFirst(self::game(Type::getFileString($type)));
}
private static function vspf($var, $args)
{
if (is_array($var))

View File

@@ -25,7 +25,7 @@ class AchievementPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_ACHIEVEMENT;
protected $type = Type::ACHIEVEMENT;
protected $typeId = 0;
protected $tpl = 'achievement';
protected $path = [0, 9];
@@ -107,7 +107,7 @@ class AchievementPage extends GenericPage
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
$this->extendGlobalIds(Type::ICON, $_);
}
// realm first available?
@@ -140,7 +140,7 @@ class AchievementPage extends GenericPage
$series[$pos][] = array(
'side' => $chainAcv->getField('faction'),
'typeStr' => Util::$typeStrings[TYPE_ACHIEVEMENT],
'typeStr' => Type::getFileString(Type::ACHIEVEMENT),
'typeId' => $aId,
'name' => $chainAcv->getField('name', true)
);
@@ -160,7 +160,7 @@ class AchievementPage extends GenericPage
BUTTON_WOWHEAD => !($this->subject->getField('cuFlags') & CUSTOM_SERVERSIDE),
BUTTON_LINKS => array(
'linkColor' => 'ffffff00',
'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$this->typeId.':&quot;..UnitGUID(&quot;player&quot;)..&quot;:0:0:0:0:0:0:0:0',
'linkId' => Type::getFileString(Type::ACHIEVEMENT).':'.$this->typeId.':&quot;..UnitGUID(&quot;player&quot;)..&quot;:0:0:0:0:0:0:0:0',
'linkName' => $this->name,
'type' => $this->type,
'typeId' => $this->typeId
@@ -179,7 +179,7 @@ class AchievementPage extends GenericPage
if ($foo = $this->subject->getField('rewards'))
{
array_walk($foo, function(&$item) {
$item = $item[0] != TYPE_ITEM ? null : $item[1];
$item = $item[0] != Type::ITEM ? null : $item[1];
});
$bar = new ItemList(array(['i.id', $foo]));
@@ -188,9 +188,9 @@ class AchievementPage extends GenericPage
$this->rewards['item'][] = array(
'name' => $bar->getField('name', true),
'quality' => $bar->getField('quality'),
'typeStr' => Util::$typeStrings[TYPE_ITEM],
'typeStr' => Type::getFileString(Type::ITEM),
'id' => $id,
'globalStr' => 'g_items'
'globalStr' => Type::getJSGlobalString(Type::ITEM)
);
}
}
@@ -198,7 +198,7 @@ class AchievementPage extends GenericPage
if ($foo = $this->subject->getField('rewards'))
{
array_walk($foo, function(&$item) {
$item = $item[0] != TYPE_TITLE ? null : $item[1];
$item = $item[0] != Type::TITLE ? null : $item[1];
});
$bar = new TitleList(array(['id', $foo]));
@@ -366,10 +366,10 @@ class AchievementPage extends GenericPage
$tmp['icon'] = $iconId;
$this->criteria['icons'][] = array(
'itr' => $iconId++,
'type' => 'g_achievements',
'type' => Type::getJSGlobalString(Type::ACHIEVEMENT),
'id' => $obj,
);
$this->extendGlobalIds(TYPE_ACHIEVEMENT, $obj);
$this->extendGlobalIds(Type::ACHIEVEMENT, $obj);
break;
// link to quest
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
@@ -389,11 +389,11 @@ class AchievementPage extends GenericPage
'href' => '?spell='.$obj,
'text' => ($crtName ?: SpellList::getName($obj))
);
$this->extendGlobalIds(TYPE_SPELL, $obj);
$this->extendGlobalIds(Type::SPELL, $obj);
$tmp['icon'] = $iconId;
$this->criteria['icons'][] = array(
'itr' => $iconId++,
'type' => 'g_spells',
'type' => Type::getJSGlobalString(Type::SPELL),
'id' => $obj,
);
break;
@@ -413,7 +413,7 @@ class AchievementPage extends GenericPage
$tmp['icon'] = $iconId;
$this->criteria['icons'][] = array(
'itr' => $iconId++,
'type' => 'g_items',
'type' => Type::getJSGlobalString(Type::ITEM),
'id' => $obj,
'count' => $qty,
);

View File

@@ -10,7 +10,7 @@ class AchievementsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_ACHIEVEMENT;
protected $type = Type::ACHIEVEMENT;
protected $tpl = 'achievements';
protected $path = [0, 9];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class AreaTriggerPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_AREATRIGGER;
protected $type = Type::AREATRIGGER;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 102];

View File

@@ -10,7 +10,7 @@ class AreaTriggersPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_AREATRIGGER;
protected $type = Type::AREATRIGGER;
protected $tpl = 'areatriggers';
protected $path = [0, 102];
protected $tabId = 0;

View File

@@ -12,7 +12,7 @@ class ArenaTeamPage extends GenericPage
protected $lvTabs = [];
protected $type = TYPE_ARENA_TEAM;
protected $type = Type::ARENA_TEAM;
protected $tabId = 1;
protected $path = [1, 5, 3];
@@ -134,7 +134,7 @@ class ArenaTeamPage extends GenericPage
private function handleIncompleteData($teamGuid)
{
//display empty page and queue status
$newId = Profiler::scheduleResync(TYPE_ARENA_TEAM, $this->realmId, $teamGuid);
$newId = Profiler::scheduleResync(Type::ARENA_TEAM, $this->realmId, $teamGuid);
$this->doResync = ['arena-team', $newId];
$this->initialSync();

View File

@@ -10,7 +10,7 @@ class ArenaTeamsPage extends GenericPage
{
use TrProfiler;
protected $type = TYPE_ARENA_TEAM;
protected $type = Type::ARENA_TEAM;
protected $tabId = 1;
protected $path = [1, 5, 3];

View File

@@ -10,7 +10,7 @@ class ClassPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_CLASS;
protected $type = Type::CHR_CLASS;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 12];

View File

@@ -10,7 +10,7 @@ class ClassesPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_CLASS;
protected $type = Type::CHR_CLASS;
protected $tpl = 'list-page-generic';
protected $path = [0, 12];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class CurrenciesPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_CURRENCY;
protected $type = Type::CURRENCY;
protected $tpl = 'list-page-generic';
protected $path = [0, 15];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class CurrencyPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_CURRENCY;
protected $type = Type::CURRENCY;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 15];
@@ -68,7 +68,7 @@ class CurrencyPage extends GenericPage
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
$this->extendGlobalIds(Type::ICON, $_);
}
/****************/
@@ -138,7 +138,7 @@ class CurrencyPage extends GenericPage
if (count($extraCols) == 3) // not already pushed
$extraCols[] = '$Listview.extraCols.condition';
$this->extendGlobalIds(TYPE_WORLDEVENT, $vendors[$k][0]['event']);
$this->extendGlobalIds(Type::WORLDEVENT, $vendors[$k][0]['event']);
$row['condition'][0][$this->typeId][] = [[CND_ACTIVE_EVENT, $vendors[$k][0]['event']]];
}
@@ -208,7 +208,7 @@ class CurrencyPage extends GenericPage
if (!$boughtBy->error)
{
$tabData = array(
'data' => array_values($boughtBy->getListviewData(ITEMINFO_VENDOR, [TYPE_CURRENCY => $this->typeId])),
'data' => array_values($boughtBy->getListviewData(ITEMINFO_VENDOR, [Type::CURRENCY => $this->typeId])),
'name' => '$LANG.tab_currencyfor',
'id' => 'currency-for',
'extraCols' => ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'],

View File

@@ -10,7 +10,7 @@ class EmotePage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_EMOTE;
protected $type = Type::EMOTE;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 100];

View File

@@ -10,7 +10,7 @@ class EmotesPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_EMOTE;
protected $type = Type::EMOTE;
protected $tpl = 'list-page-generic';
protected $path = [0, 100];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class EnchantmentPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_ENCHANTMENT;
protected $type = Type::ENCHANTMENT;
protected $typeId = 0;
protected $tpl = 'enchantment';
protected $path = [0, 101];
@@ -64,7 +64,7 @@ class EnchantmentPage extends GenericPage
// reqskill
if ($_ = $this->subject->getField('skillLine'))
{
$this->extendGlobalIds(TYPE_SKILL, $_);
$this->extendGlobalIds(Type::SKILL, $_);
$foo = sprintf(Lang::game('requires'), '&nbsp;[skill='.$_.']');
if ($_ = $this->subject->getField('skillLevel'))

View File

@@ -10,7 +10,7 @@ class EnchantmentsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_ENCHANTMENT;
protected $type = Type::ENCHANTMENT;
protected $tpl = 'enchantments';
protected $path = [0, 101];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class EventPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_WORLDEVENT;
protected $type = Type::WORLDEVENT;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 11];
@@ -78,7 +78,7 @@ class EventPage extends GenericPage
// boss
if ($_ = $this->subject->getField('bossCreature'))
{
$this->extendGlobalIds(TYPE_NPC, $_);
$this->extendGlobalIds(Type::NPC, $_);
$this->infobox[] = Lang::npc('rank', 3).Lang::main('colon').'[npc='.$_.']';
}
@@ -187,10 +187,10 @@ class EventPage extends GenericPage
$this->lvTabs[] = ['quest', $tabData];
$questItems = [];
foreach (array_column($quests->rewards, TYPE_ITEM) as $arr)
foreach (array_column($quests->rewards, Type::ITEM) as $arr)
$questItems = array_merge($questItems, $arr);
foreach (array_column($quests->requires, TYPE_ITEM) as $arr)
foreach (array_column($quests->requires, Type::ITEM) as $arr)
$questItems = array_merge($questItems, $arr);
if ($questItems)
@@ -250,7 +250,7 @@ class EventPage extends GenericPage
if ($r <= 0)
continue;
$this->extendGlobalIds(TYPE_WORLDEVENT, $r);
$this->extendGlobalIds(Type::WORLDEVENT, $r);
$d = $this->subject->getListviewData();
$d[$this->eId]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, $r]];

View File

@@ -10,7 +10,7 @@ class EventsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_WORLDEVENT;
protected $type = Type::WORLDEVENT;
protected $tpl = 'list-page-generic';
protected $path = [0, 11];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class FactionPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_FACTION;
protected $type = Type::FACTION;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 7];
@@ -58,7 +58,7 @@ class FactionPage extends GenericPage
// Quartermaster if any
if ($ids = $this->subject->getField('qmNpcIds'))
{
$this->extendGlobalIds(TYPE_NPC, ...$ids);
$this->extendGlobalIds(Type::NPC, ...$ids);
$qmStr = Lang::faction('quartermaster').Lang::main('colon');

View File

@@ -10,7 +10,7 @@ class FactionsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_FACTION;
protected $type = Type::FACTION;
protected $tpl = 'list-page-generic';
protected $path = [0, 7];
protected $tabId = 0;

View File

@@ -739,7 +739,7 @@ class GenericPage
foreach ($data as $k => $v)
{
// localizes expected fields .. except for icons .. icons are special
if (in_array($k, ['name', 'namefemale']) && $struct[0] != 'g_icons')
if (in_array($k, ['name', 'namefemale']) && $struct[0] != Type::getJSGlobalString(Type::ICON))
{
$data[$k.'_'.User::$localeString] = $v;
unset($data[$k]);
@@ -859,31 +859,8 @@ class GenericPage
if (isset($jsg[$type]))
return;
switch ($type)
{ // [varName, [data], [extra]]
case TYPE_NPC: $jsg[TYPE_NPC] = ['g_npcs', [], []]; break;
case TYPE_OBJECT: $jsg[TYPE_OBJECT] = ['g_objects', [], []]; break;
case TYPE_ITEM: $jsg[TYPE_ITEM] = ['g_items', [], []]; break;
case TYPE_ITEMSET: $jsg[TYPE_ITEMSET] = ['g_itemsets', [], []]; break;
case TYPE_QUEST: $jsg[TYPE_QUEST] = ['g_quests', [], []]; break;
case TYPE_SPELL: $jsg[TYPE_SPELL] = ['g_spells', [], []]; break;
case TYPE_ZONE: $jsg[TYPE_ZONE] = ['g_gatheredzones', [], []]; break;
case TYPE_FACTION: $jsg[TYPE_FACTION] = ['g_factions', [], []]; break;
case TYPE_PET: $jsg[TYPE_PET] = ['g_pets', [], []]; break;
case TYPE_ACHIEVEMENT: $jsg[TYPE_ACHIEVEMENT] = ['g_achievements', [], []]; break;
case TYPE_TITLE: $jsg[TYPE_TITLE] = ['g_titles', [], []]; break;
case TYPE_WORLDEVENT: $jsg[TYPE_WORLDEVENT] = ['g_holidays', [], []]; break;
case TYPE_CLASS: $jsg[TYPE_CLASS] = ['g_classes', [], []]; break;
case TYPE_RACE: $jsg[TYPE_RACE] = ['g_races', [], []]; break;
case TYPE_SKILL: $jsg[TYPE_SKILL] = ['g_skills', [], []]; break;
case TYPE_CURRENCY: $jsg[TYPE_CURRENCY] = ['g_gatheredcurrencies', [], []]; break;
case TYPE_SOUND: $jsg[TYPE_SOUND] = ['g_sounds', [], []]; break;
case TYPE_ICON: $jsg[TYPE_ICON] = ['g_icons', [], []]; break;
// well, this is awkward
case TYPE_USER: $jsg[TYPE_USER] = ['g_users', [], []]; break;
case TYPE_EMOTE: $jsg[TYPE_EMOTE] = ['g_emotes', [], []]; break;
case TYPE_ENCHANTMENT: $jsg[TYPE_ENCHANTMENT] = ['g_enchantments', [], []]; break;
}
if ($tpl = Type::getJSGlobalTemplate($type))
$jsg[$type] = $tpl;
}
// lookup jsGlobals from collected typeIds
@@ -900,34 +877,9 @@ class GenericPage
$this->initJSGlobal($type);
$cnd = [CFG_SQL_LIMIT_NONE, ['id', array_unique($ids, SORT_NUMERIC)]];
switch ($type)
{
case TYPE_NPC: $obj = new CreatureList($cnd); break;
case TYPE_OBJECT: $obj = new GameobjectList($cnd); break;
case TYPE_ITEM: $obj = new ItemList($cnd); break;
case TYPE_ITEMSET: $obj = new ItemsetList($cnd); break;
case TYPE_QUEST: $obj = new QuestList($cnd); break;
case TYPE_SPELL: $obj = new SpellList($cnd); break;
case TYPE_ZONE: $obj = new ZoneList($cnd); break;
case TYPE_FACTION: $obj = new FactionList($cnd); break;
case TYPE_PET: $obj = new PetList($cnd); break;
case TYPE_ACHIEVEMENT: $obj = new AchievementList($cnd); break;
case TYPE_TITLE: $obj = new TitleList($cnd); break;
case TYPE_WORLDEVENT: $obj = new WorldEventList($cnd); break;
case TYPE_CLASS: $obj = new CharClassList($cnd); break;
case TYPE_RACE: $obj = new CharRaceList($cnd); break;
case TYPE_SKILL: $obj = new SkillList($cnd); break;
case TYPE_CURRENCY: $obj = new CurrencyList($cnd); break;
case TYPE_SOUND: $obj = new SoundList($cnd); break;
case TYPE_ICON: $obj = new IconList($cnd); break;
// "um, eh":, he ums and ehs.
case TYPE_USER: $obj = new UserList($cnd); break;
case TYPE_EMOTE: $obj = new EmoteList($cnd); break;
case TYPE_ENCHANTMENT: $obj = new EnchantmentList($cnd); break;
default: continue 2;
}
$obj = Type::newList($type, [CFG_SQL_LIMIT_NONE, ['id', array_unique($ids, SORT_NUMERIC)]]);
if (!$obj)
continue;
$this->extendGlobalData($obj->getJSGlobals(GLOBALINFO_SELF));

View File

@@ -12,7 +12,7 @@ class GuildPage extends GenericPage
protected $lvTabs = [];
protected $type = TYPE_GUILD;
protected $type = Type::GUILD;
protected $tabId = 1;
protected $path = [1, 5, 2];
@@ -138,7 +138,7 @@ class GuildPage extends GenericPage
private function handleIncompleteData($teamGuid)
{
//display empty page and queue status
$newId = Profiler::scheduleResync(TYPE_GUILD, $this->realmId, $teamGuid);
$newId = Profiler::scheduleResync(Type::GUILD, $this->realmId, $teamGuid);
$this->doResync = ['guild', $newId];
$this->initialSync();

View File

@@ -10,7 +10,7 @@ class GuildsPage extends GenericPage
{
use TrProfiler;
protected $type = TYPE_GUILD;
protected $type = Type::GUILD;
protected $tabId = 1;
protected $path = [1, 5, 2];

View File

@@ -10,7 +10,7 @@ class IconPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_ICON;
protected $type = Type::ICON;
protected $typeId = 0;
protected $tpl = 'icon';
protected $path = [0, 31];

View File

@@ -10,7 +10,7 @@ class IconsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_ICON;
protected $type = Type::ICON;
protected $tpl = 'icons';
protected $path = [0, 31];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class ItemPage extends genericPage
{
use TrDetailPage;
protected $type = TYPE_ITEM;
protected $type = Type::ITEM;
protected $typeId = 0;
protected $tpl = 'item';
protected $path = [0, 0];
@@ -159,7 +159,7 @@ class ItemPage extends genericPage
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
$this->extendGlobalIds(Type::ICON, $_);
}
// consumable / not consumable
@@ -187,7 +187,7 @@ class ItemPage extends genericPage
// related holiday
if ($eId = $this->subject->getField('eventId'))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $eId);
$this->extendGlobalIds(Type::WORLDEVENT, $eId);
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$eId.']';
}
@@ -225,12 +225,12 @@ class ItemPage extends genericPage
if ($c < 0) // currency items (and honor or arena)
{
$currency[] = -$c.','.($qty / $stack);
$this->extendGlobalIds(TYPE_CURRENCY, -$c);
$this->extendGlobalIds(Type::CURRENCY, -$c);
}
else if ($c > 0) // plain items (item1,count1,item2,count2,...)
{
$tokens[$c] = $c.','.($qty / $stack);
$this->extendGlobalIds(TYPE_ITEM, $c);
$this->extendGlobalIds(Type::ITEM, $c);
}
}
@@ -360,7 +360,7 @@ class ItemPage extends genericPage
$this->tooltip = $this->subject->renderTooltip(true);
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_VIEW3D => in_array($_slot, $_visSlots) && $_model ? ['displayId' => $this->subject->getField('displayId'), 'slot' => $_slot, 'type' => TYPE_ITEM, 'typeId' => $this->typeId] : false,
BUTTON_VIEW3D => in_array($_slot, $_visSlots) && $_model ? ['displayId' => $this->subject->getField('displayId'), 'slot' => $_slot, 'type' => Type::ITEM, 'typeId' => $this->typeId] : false,
BUTTON_COMPARE => $_cu,
BUTTON_EQUIP => in_array($_class, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]),
BUTTON_UPGRADE => ($_cu ? ['class' => $_class, 'slot' => $_slot] : false),
@@ -441,7 +441,7 @@ class ItemPage extends genericPage
{
$data['percent'] = $perfItem[$sId]['perfectCreateChance'];
$data['condition'][0][$this->typeId] = [[[CND_SPELL, $perfItem[$sId]['requiredSpecialization']]]];
$this->extendGlobalIDs(TYPE_SPELL, $perfItem[$sId]['requiredSpecialization']);
$this->extendGlobalIDs(Type::SPELL, $perfItem[$sId]['requiredSpecialization']);
}
$this->lvTabs[] = ['spell', array(
@@ -535,11 +535,11 @@ class ItemPage extends genericPage
foreach ($reqQuests->iterate() as $qId => $__)
{
if (empty($reqQuests->requires[$qId][TYPE_ITEM]))
if (empty($reqQuests->requires[$qId][Type::ITEM]))
continue;
foreach ($reqIds as $rId)
if (in_array($rId, $reqQuests->requires[$qId][TYPE_ITEM]))
if (in_array($rId, $reqQuests->requires[$qId][Type::ITEM]))
$reqQuest[$rId] = $reqQuests->id;
}
}
@@ -803,7 +803,7 @@ class ItemPage extends genericPage
if (count($extraCols) == 3)
$extraCols[] = '$Listview.extraCols.condition';
$this->extendGlobalIds(TYPE_WORLDEVENT, $e);
$this->extendGlobalIds(Type::WORLDEVENT, $e);
$row['condition'][0][$this->typeId][] = [[CND_ACTIVE_EVENT, $e]];
}
@@ -860,7 +860,7 @@ class ItemPage extends genericPage
if (!$boughtBy->error)
{
$iCur = new CurrencyList(array(['itemId', $this->typeId]));
$filter = $iCur->error ? [TYPE_ITEM => $this->typeId] : [TYPE_CURRENCY => $iCur->id];
$filter = $iCur->error ? [Type::ITEM => $this->typeId] : [Type::CURRENCY => $iCur->id];
$tabData = array(
'data' => array_values($boughtBy->getListviewData(ITEMINFO_VENDOR, $filter)),

View File

@@ -10,7 +10,7 @@ class ItemsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_ITEM;
protected $type = Type::ITEM;
protected $tpl = 'items';
protected $path = [0, 0];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class ItemsetPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_ITEMSET;
protected $type = Type::ITEMSET;
protected $typeId = 0;
protected $tpl = 'itemset';
protected $path = [0, 2];
@@ -77,7 +77,7 @@ class ItemsetPage extends GenericPage
if ($e = $this->subject->getField('eventId'))
{
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$e.']';
$this->extendGlobalIds(TYPE_WORLDEVENT, $e);
$this->extendGlobalIds(Type::WORLDEVENT, $e);
}
// itemLevel
@@ -96,7 +96,7 @@ class ItemsetPage extends GenericPage
$jsg = [];
if ($cl = Lang::getClassString($this->subject->getField('classMask'), $jsg, false))
{
$this->extendGlobalIds(TYPE_CLASS, ...$jsg);
$this->extendGlobalIds(Type::CHR_CLASS, ...$jsg);
$t = count($jsg)== 1 ? Lang::game('class') : Lang::game('classes');
$infobox[] = Util::ucFirst($t).Lang::main('colon').$cl;
}
@@ -166,7 +166,7 @@ class ItemsetPage extends GenericPage
$this->redButtons = array(
BUTTON_WOWHEAD => $this->typeId > 0, // bool only
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList],
BUTTON_VIEW3D => ['type' => Type::ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList],
BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt]
);
$this->summary = array(

View File

@@ -10,7 +10,7 @@ class ItemsetsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_ITEMSET;
protected $type = Type::ITEMSET;
protected $tpl = 'itemsets';
protected $path = [0, 2];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class MailPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_MAIL;
protected $type = Type::MAIL;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 103];
@@ -47,7 +47,7 @@ class MailPage extends GenericPage
if ($npcId = DB::World()->selectCell('SELECT Sender FROM achievement_reward WHERE ID = ?d', -$this->typeId))
{
$infobox[] = Lang::mail('sender').Lang::main('colon').'[npc='.$npcId.']';
$this->extendGlobalIds(TYPE_NPC, $npcId);
$this->extendGlobalIds(Type::NPC, $npcId);
}
}
else if ($mlr = DB::World()->selectRow('SELECT * FROM mail_level_reward WHERE mailTemplateId = ?d', $this->typeId)) // level rewards
@@ -59,11 +59,11 @@ class MailPage extends GenericPage
if ($r = Lang::getRaceString($mlr['raceMask'], $rIds, false))
{
$infobox[] = Lang::game('races').Lang::main('colon').$r;
$this->extendGlobalIds(TYPE_RACE, ...$rIds);
$this->extendGlobalIds(Type::CHR_RACE, ...$rIds);
}
$infobox[] = Lang::mail('sender').Lang::main('colon').'[npc='.$mlr['senderEntry'].']';
$this->extendGlobalIds(TYPE_NPC, $mlr['senderEntry']);
$this->extendGlobalIds(Type::NPC, $mlr['senderEntry']);
}
else // achievement or quest
{
@@ -72,12 +72,12 @@ class MailPage extends GenericPage
if ($npcId= DB::World()->selectCell('SELECT RewardMailSenderEntry FROM quest_mail_sender WHERE QuestId = ?d', $q['id']))
{
$infobox[] = Lang::mail('sender').Lang::main('colon').'[npc='.$npcId.']';
$this->extendGlobalIds(TYPE_NPC, $npcId);
$this->extendGlobalIds(Type::NPC, $npcId);
}
else if ($npcId = DB::Aowow()->selectCell('SELECT typeId FROM ?_quests_startend WHERE questId = ?d AND type = ?d AND method & ?d', $q['id'], TYPE_NPC, 0x2))
else if ($npcId = DB::Aowow()->selectCell('SELECT typeId FROM ?_quests_startend WHERE questId = ?d AND type = ?d AND method & ?d', $q['id'], Type::NPC, 0x2))
{
$infobox[] = Lang::mail('sender').Lang::main('colon').'[npc='.$npcId.']';
$this->extendGlobalIds(TYPE_NPC, $npcId);
$this->extendGlobalIds(Type::NPC, $npcId);
}
if ($q['rewardMailDelay'] > 0)
@@ -86,7 +86,7 @@ class MailPage extends GenericPage
else if ($npcId = DB::World()->selectCell('SELECT Sender FROM achievement_reward WHERE MailTemplateId = ?d', $this->typeId))
{
$infobox[] = Lang::mail('sender').Lang::main('colon').'[npc='.$npcId.']';
$this->extendGlobalIds(TYPE_NPC, $npcId);
$this->extendGlobalIds(Type::NPC, $npcId);
}
}
@@ -139,7 +139,7 @@ class MailPage extends GenericPage
else if ($npcId = DB::World()->selectCell('SELECT ID FROM achievement_reward WHERE MailTemplateId = ?d', $this->typeId))
{
$infobox[] = '[Sender]: [npc='.$npcId.']';
$this->extendGlobalIds(TYPE_NPC, $npcId);
$this->extendGlobalIds(Type::NPC, $npcId);
}
else // used by: quest

View File

@@ -10,7 +10,7 @@ class MailsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_MAIL;
protected $type = Type::MAIL;
protected $tpl = 'list-page-generic';
protected $path = [0, 103];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class NpcPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_NPC;
protected $type = Type::NPC;
protected $typeId = 0;
protected $tpl = 'npc';
protected $path = [0, 4];
@@ -87,7 +87,7 @@ class NpcPage extends GenericPage
// try to determine, if it's spawned in a dungeon or raid (shaky at best, if spawned by script)
$mapType = 0;
if ($maps = DB::Aowow()->selectCol('SELECT DISTINCT areaId from ?_spawns WHERE type = ?d AND typeId = ?d', TYPE_NPC, $this->typeId))
if ($maps = DB::Aowow()->selectCol('SELECT DISTINCT areaId from ?_spawns WHERE type = ?d AND typeId = ?d', Type::NPC, $this->typeId))
{
if (count($maps) == 1) // should only exist in one instance
{
@@ -122,7 +122,7 @@ class NpcPage extends GenericPage
// Event (ignore events, where the object only gets removed)
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.eventEntry FROM game_event ge, game_event_creature gec, creature c WHERE ge.eventEntry = gec.eventEntry AND c.guid = gec.guid AND c.id = ?d', $this->typeId))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, ...$_);
$this->extendGlobalIds(Type::WORLDEVENT, ...$_);
$ev = [];
foreach ($_ as $i => $e)
$ev[] = ($i % 2 ? '[br]' : ' ') . '[event='.$e.']';
@@ -160,7 +160,7 @@ class NpcPage extends GenericPage
$infobox[] = Lang::npc('react').Lang::main('colon').'[color=q'.$_($this->subject->getField('A')).']A[/color] [color=q'.$_($this->subject->getField('H')).']H[/color]';
// Faction
$this->extendGlobalIds(TYPE_FACTION, $this->subject->getField('factionId'));
$this->extendGlobalIds(Type::FACTION, $this->subject->getField('factionId'));
$infobox[] = Util::ucFirst(Lang::game('faction')).Lang::main('colon').'[faction='.$this->subject->getField('factionId').']';
// Tameable
@@ -398,7 +398,7 @@ class NpcPage extends GenericPage
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_VIEW3D => ['type' => TYPE_NPC, 'typeId' => $this->typeId, 'displayId' => $this->subject->getRandomModelId()]
BUTTON_VIEW3D => ['type' => Type::NPC, 'typeId' => $this->typeId, 'displayId' => $this->subject->getRandomModelId()]
);
if ($this->subject->getField('humanoid'))
@@ -507,9 +507,9 @@ class NpcPage extends GenericPage
// tab: summoned by [NPC]
$sb = SmartAI::getOwnerOfNPCSummon($this->typeId);
if (!empty($sb[TYPE_NPC]))
if (!empty($sb[Type::NPC]))
{
$sbNPC = new CreatureList(array(['id', $sb[TYPE_NPC]]));
$sbNPC = new CreatureList(array(['id', $sb[Type::NPC]]));
if (!$sbNPC->error)
{
$this->extendGlobalData($sbNPC->getJSGlobals());
@@ -523,9 +523,9 @@ class NpcPage extends GenericPage
}
// tab: summoned by [Object]
if (!empty($sb[TYPE_OBJECT]))
if (!empty($sb[Type::OBJECT]))
{
$sbGO = new GameObjectList(array(['id', $sb[TYPE_OBJECT]]));
$sbGO = new GameObjectList(array(['id', $sb[Type::OBJECT]]));
if (!$sbGO->error)
{
$this->extendGlobalData($sbGO->getJSGlobals());
@@ -566,7 +566,7 @@ class NpcPage extends GenericPage
{
if (count($data[$sId]['skill']) == 1 && $_ != $data[$sId]['skill'][0])
{
$this->extendGlobalIds(TYPE_SKILL, $_);
$this->extendGlobalIds(Type::SKILL, $_);
if (!isset($extra[0]))
$extra[0] = '$Listview.extraCols.condition';
@@ -578,7 +578,7 @@ class NpcPage extends GenericPage
{
if ($_ = $train['reqSpellId'.$i])
{
$this->extendGlobalIds(TYPE_SPELL, $_);
$this->extendGlobalIds(Type::SPELL, $_);
if (!isset($extra[0]))
$extra[0] = '$Listview.extraCols.condition';
@@ -625,7 +625,7 @@ class NpcPage extends GenericPage
if ($soldItems->hasSetFields(['condition']))
$extraCols[] = '$Listview.extraCols.condition';
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [TYPE_NPC => [$this->typeId]]);
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [Type::NPC => [$this->typeId]]);
$sc = Util::getServerConditions(CND_SRC_NPC_VENDOR, $this->typeId);
if (!empty($sc[0]))
@@ -752,18 +752,18 @@ class NpcPage extends GenericPage
foreach ($reqQuests->iterate() as $qId => $__)
{
if (empty($reqQuests->requires[$qId][TYPE_ITEM]))
if (empty($reqQuests->requires[$qId][Type::ITEM]))
continue;
foreach ($reqIds as $rId)
if (in_array($rId, $reqQuests->requires[$qId][TYPE_ITEM]))
if (in_array($rId, $reqQuests->requires[$qId][Type::ITEM]))
$reqQuest[$rId] = $reqQuests->id;
}
}
// tab: starts quest
// tab: ends quest
$startEnd = new QuestList(array(['qse.type', TYPE_NPC], ['qse.typeId', $this->typeId]));
$startEnd = new QuestList(array(['qse.type', Type::NPC], ['qse.typeId', $this->typeId]));
if (!$startEnd->error)
{
$this->extendGlobalData($startEnd->getJSGlobals());

View File

@@ -10,7 +10,7 @@ class NpcsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_NPC;
protected $type = Type::NPC;
protected $tpl = 'npcs';
protected $path = [0, 4];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class ObjectPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_OBJECT;
protected $type = Type::OBJECT;
protected $typeId = 0;
protected $tpl = 'object';
protected $path = [0, 5];
@@ -62,7 +62,7 @@ class ObjectPage extends GenericPage
// Event (ignore events, where the object only gets removed)
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.eventEntry FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, ...$_);
$this->extendGlobalIds(Type::WORLDEVENT, ...$_);
$ev = [];
foreach ($_ as $i => $e)
$ev[] = ($i % 2 ? '[br]' : ' ') . '[event='.$e.']';
@@ -73,7 +73,7 @@ class ObjectPage extends GenericPage
// Faction
if ($_ = DB::Aowow()->selectCell('SELECT factionId FROM ?_factiontemplate WHERE id = ?d', $this->subject->getField('faction')))
{
$this->extendGlobalIds(TYPE_FACTION, $_);
$this->extendGlobalIds(Type::FACTION, $_);
$infobox[] = Util::ucFirst(Lang::game('faction')).Lang::main('colon').'[faction='.$_.']';
}
@@ -125,7 +125,7 @@ class ObjectPage extends GenericPage
// linked trap
if ($_ = $this->subject->getField('linkedTrap'))
{
$this->extendGlobalIds(TYPE_OBJECT, $_);
$this->extendGlobalIds(Type::OBJECT, $_);
$infobox[] = Lang::gameObject('trap').Lang::main('colon').'[object='.$_.']';
}
@@ -158,7 +158,7 @@ class ObjectPage extends GenericPage
{
if ($_ = $this->subject->getField('mStone'))
{
$this->extendGlobalIds(TYPE_ZONE, $_[2]);
$this->extendGlobalIds(Type::ZONE, $_[2]);
$m = Lang::game('meetingStone').Lang::main('colon').'[zone='.$_[2].']';
$l = $_[0];
@@ -278,7 +278,7 @@ class ObjectPage extends GenericPage
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId],
BUTTON_VIEW3D => ['displayId' => $this->subject->getField('displayId'), 'type' => TYPE_OBJECT, 'typeId' => $this->typeId]
BUTTON_VIEW3D => ['displayId' => $this->subject->getField('displayId'), 'type' => Type::OBJECT, 'typeId' => $this->typeId]
);
@@ -343,7 +343,7 @@ class ObjectPage extends GenericPage
// tab: starts quest
// tab: ends quest
$startEnd = new QuestList(array(['qse.type', TYPE_OBJECT], ['qse.typeId', $this->typeId]));
$startEnd = new QuestList(array(['qse.type', Type::OBJECT], ['qse.typeId', $this->typeId]));
if (!$startEnd->error)
{
$this->extendGlobalData($startEnd->getJSGlobals());
@@ -448,11 +448,11 @@ class ObjectPage extends GenericPage
foreach ($reqQuests->iterate() as $qId => $__)
{
if (empty($reqQuests->requires[$qId][TYPE_ITEM]))
if (empty($reqQuests->requires[$qId][Type::ITEM]))
continue;
foreach ($reqIds as $rId)
if (in_array($rId, $reqQuests->requires[$qId][TYPE_ITEM]))
if (in_array($rId, $reqQuests->requires[$qId][Type::ITEM]))
$reqQuest[$rId] = $reqQuests->id;
}
}

View File

@@ -10,7 +10,7 @@ class ObjectsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_OBJECT;
protected $type = Type::OBJECT;
protected $tpl = 'objects';
protected $path = [0, 5];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class PetPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_PET;
protected $type = Type::PET;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 8];
@@ -62,7 +62,7 @@ class PetPage extends GenericPage
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
$this->extendGlobalIds(Type::ICON, $_);
}
/****************/

View File

@@ -10,7 +10,7 @@ class PetsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_PET;
protected $type = Type::PET;
protected $tpl = 'list-page-generic';
protected $path = [0, 8];
protected $tabId = 0;

View File

@@ -13,7 +13,7 @@ class ProfilePage extends GenericPage
protected $gDataKey = true;
protected $mode = CACHE_TYPE_PAGE;
protected $type = TYPE_PROFILE;
protected $type = Type::PROFILE;
protected $tabId = 1;
protected $path = [1, 5, 1];
@@ -166,11 +166,11 @@ class ProfilePage extends GenericPage
/* Anub, Faerlina, Maexxna, Noth, Heigan, Loatheb, Razuvious, Gothik, Patchwerk, Grobbulus, Gluth, Thaddius, Sapphiron, Kel'Thuzad */
/* nax */ 15956, 15953, 15952, 15954, 15936, 16011, 16061, 16060, 16028, 15931, 15932, 15928, 15989, 15990
);
$this->extendGlobalIds(TYPE_NPC, ...$bossIds);
$this->extendGlobalIds(Type::NPC, ...$bossIds);
// dummy title from dungeon encounter
foreach (Lang::profiler('encounterNames') as $id => $name)
$this->extendGlobalData([TYPE_NPC => [$id => ['name_'.User::$localeString => $name]]]);
$this->extendGlobalData([Type::NPC => [$id => ['name_'.User::$localeString => $name]]]);
}
protected function generatePath()
@@ -242,7 +242,7 @@ class ProfilePage extends GenericPage
$this->mode = CACHE_TYPE_NONE;
// queue full fetch
$newId = Profiler::scheduleResync(TYPE_PROFILE, $this->realmId, $guid);
$newId = Profiler::scheduleResync(Type::PROFILE, $this->realmId, $guid);
$this->doResync = ['profile', $newId];
$this->initialSync();

View File

@@ -12,7 +12,7 @@ class ProfilesPage extends GenericPage
protected $roster = 0; // $_GET['roster'] = 1|2|3|4 .. 2,3,4 arenateam-size (4 => 5-man), 1 guild .. it puts a resync button on the lv...
protected $type = TYPE_PROFILE;
protected $type = Type::PROFILE;
protected $tabId = 1;
protected $path = [1, 5, 0];

View File

@@ -10,7 +10,7 @@ class QuestPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_QUEST;
protected $type = Type::QUEST;
protected $typeId = 0;
protected $tpl = 'quest';
protected $path = [0, 3];
@@ -90,7 +90,7 @@ class QuestPage extends GenericPage
// event (todo: assign eventData)
if ($_ = $this->subject->getField('eventId'))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
$this->extendGlobalIds(Type::WORLDEVENT, $_);
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$_.']';
}
@@ -164,7 +164,7 @@ class QuestPage extends GenericPage
// races
if ($_ = Lang::getRaceString($this->subject->getField('reqRaceMask'), $jsg, false))
{
$this->extendGlobalIds(TYPE_RACE, ...$jsg);
$this->extendGlobalIds(Type::CHR_RACE, ...$jsg);
$t = count($jsg) == 1 ? Lang::game('race') : Lang::game('races');
$infobox[] = Util::ucFirst($t).Lang::main('colon').$_;
}
@@ -172,7 +172,7 @@ class QuestPage extends GenericPage
// classes
if ($_ = Lang::getClassString($this->subject->getField('reqClassMask'), $jsg, false))
{
$this->extendGlobalIds(TYPE_CLASS, ...$jsg);
$this->extendGlobalIds(Type::CHR_CLASS, ...$jsg);
$t = count($jsg) == 1 ? Lang::game('class') : Lang::game('classes');
$infobox[] = Util::ucFirst($t).Lang::main('colon').$_;
}
@@ -180,7 +180,7 @@ class QuestPage extends GenericPage
// profession / skill
if ($_ = $this->subject->getField('reqSkillId'))
{
$this->extendGlobalIds(TYPE_SKILL, $_);
$this->extendGlobalIds(Type::SKILL, $_);
$sk = '[skill='.$_.']';
if ($_ = $this->subject->getField('reqSkillPoints'))
$sk .= ' ('.$_.')';
@@ -202,7 +202,7 @@ class QuestPage extends GenericPage
if ($se['method'] & 0x1)
{
$this->extendGlobalIds($se['type'], $se['typeId']);
$s[] = ($s ? '[span=invisible]'.$start.'[/span] ' : $start.' ') .'['.Util::$typeStrings[$se['type']].'='.$se['typeId'].']';
$s[] = ($s ? '[span=invisible]'.$start.'[/span] ' : $start.' ') .'['.Type::getFileString($se['type']).'='.$se['typeId'].']';
}
}
@@ -217,7 +217,7 @@ class QuestPage extends GenericPage
if ($se['method'] & 0x2)
{
$this->extendGlobalIds($se['type'], $se['typeId']);
$e[] = ($e ? '[span=invisible]'.$end.'[/span] ' : $end.' ') . '['.Util::$typeStrings[$se['type']].'='.$se['typeId'].']';
$e[] = ($e ? '[span=invisible]'.$end.'[/span] ' : $end.' ') . '['.Type::getFileString($se['type']).'='.$se['typeId'].']';
}
}
@@ -276,7 +276,7 @@ class QuestPage extends GenericPage
array(
array(
'side' => $_side,
'typeStr' => Util::$typeStrings[TYPE_QUEST],
'typeStr' => Type::getFileString(Type::QUEST),
'typeId' => $this->typeId,
'name' => $this->name,
'_next' => $this->subject->getField('nextQuestIdChain')
@@ -299,7 +299,7 @@ class QuestPage extends GenericPage
array_unshift($chain, array(
array(
'side' => Game::sideByRaceMask($_['reqRaceMask']),
'typeStr' => Util::$typeStrings[TYPE_QUEST],
'typeStr' => Type::getFileString(Type::QUEST),
'typeId' => $_['typeId'],
'name' => Util::htmlEscape(Lang::trimTextClean($n, 40)),
)
@@ -319,7 +319,7 @@ class QuestPage extends GenericPage
array_push($chain, array(
array(
'side' => Game::sideByRaceMask($_['reqRaceMask']),
'typeStr' => Util::$typeStrings[TYPE_QUEST],
'typeStr' => Type::getFileString(Type::QUEST),
'typeId' => $_['typeId'],
'name' => Util::htmlEscape(Lang::trimTextClean($n, 40)),
'_next' => $_['_next'],
@@ -345,7 +345,7 @@ class QuestPage extends GenericPage
$n = $list->getField('name', true);
$chain[] = array(array(
'side' => Game::sideByRaceMask($list->getField('reqRaceMask')),
'typeStr' => Util::$typeStrings[TYPE_QUEST],
'typeStr' => Type::getFileString(Type::QUEST),
'typeId' => $id,
'name' => Util::htmlEscape(Lang::trimTextClean($n, 40))
));
@@ -421,7 +421,7 @@ class QuestPage extends GenericPage
$providedRequired = true;
$this->objectiveList[] = array(
'typeStr' => Util::$typeStrings[TYPE_ITEM],
'typeStr' => Type::getFileString(Type::ITEM),
'id' => $itemId,
'name' => $olItemData->json[$itemId]['name'],
'qty' => $qty > 1 ? $qty : 0,
@@ -478,7 +478,7 @@ class QuestPage extends GenericPage
continue;
$ol = array(
'typeStr' => Util::$typeStrings[TYPE_NPC],
'typeStr' => Type::getFileString(Type::NPC),
'id' => $i,
'name' => $pair[1] ?: Util::localizedString($olNPCData->getEntry($i), 'name'),
'qty' => $pair[0] > 1 ? $pair[0] : 0,
@@ -505,7 +505,7 @@ class QuestPage extends GenericPage
continue;
$this->objectiveList[] = array(
'typeStr' => Util::$typeStrings[TYPE_OBJECT],
'typeStr' => Type::getFileString(Type::OBJECT),
'id' => $i,
'name' => $pair[1] ?: Util::localizedString($olGOData->getEntry($i), 'name'),
'qty' => $pair[0] > 1 ? $pair[0] : 0,
@@ -536,7 +536,7 @@ class QuestPage extends GenericPage
continue;
$this->objectiveList[] = array(
'typeStr' => Util::$typeStrings[TYPE_FACTION],
'typeStr' => Type::getFileString(Type::FACTION),
'id' => $i,
'name' => Util::localizedString($olFactionsData->getEntry($i), 'name'),
'qty' => sprintf(Util::$dfnString, $val.' '.Lang::achievement('points'), Lang::getReputationLevelForPoints($val)),
@@ -548,9 +548,9 @@ class QuestPage extends GenericPage
// granted spell
if ($_ = $this->subject->getField('sourceSpellId'))
{
$this->extendGlobalIds(TYPE_SPELL, $_);
$this->extendGlobalIds(Type::SPELL, $_);
$this->objectiveList[] = array(
'typeStr' => Util::$typeStrings[TYPE_SPELL],
'typeStr' => Type::getFileString(Type::SPELL),
'id' => $_,
'name' => SpellList::getName($_),
'qty' => 0,
@@ -665,11 +665,11 @@ class QuestPage extends GenericPage
// POI: start + end
foreach ($startEnd as $se)
{
if ($se['type'] == TYPE_NPC)
if ($se['type'] == Type::NPC)
$mapNPCs[] = [$se['typeId'], $se['method'], 0];
else if ($se['type'] == TYPE_OBJECT)
else if ($se['type'] == Type::OBJECT)
$mapGOs[] = [$se['typeId'], $se['method'], 0];
else if ($se['type'] == TYPE_ITEM)
else if ($se['type'] == Type::ITEM)
$getItemSource($se['typeId'], $se['method']);
}
@@ -698,12 +698,12 @@ class QuestPage extends GenericPage
// areatrigger
if ($atir = DB::Aowow()->selectCol('SELECT id FROM ?_areatrigger WHERE type = ?d AND quest = ?d', AT_TYPE_OBJECTIVE, $this->typeId))
{
if ($atSpawns = DB::AoWoW()->select('SELECT typeId AS ARRAY_KEY, posX, posY, floor, areaId FROM ?_spawns WHERE `type` = ?d AND `typeId` IN (?a)', TYPE_AREATRIGGER, $atir))
if ($atSpawns = DB::AoWoW()->select('SELECT typeId AS ARRAY_KEY, posX, posY, floor, areaId FROM ?_spawns WHERE `type` = ?d AND `typeId` IN (?a)', Type::AREATRIGGER, $atir))
{
foreach ($atSpawns as $atId => $atsp)
{
$atSpawn = array (
'type' => User::isInGroup(U_GROUP_STAFF) ? TYPE_AREATRIGGER : -1,
'type' => User::isInGroup(U_GROUP_STAFF) ? Type::AREATRIGGER : -1,
'id' => $atId,
'point' => 'requirement',
'name' => $this->subject->parseText('end', false),
@@ -1017,13 +1017,13 @@ class QuestPage extends GenericPage
if ($_ = $this->subject->getField('reqMinRepFaction'))
{
$cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0][] = [CND_REPUTATION_RANK, $_, 1 << Game::getReputationLevelForPoints($this->subject->getField('reqMinRepValue'))];
$this->extendGlobalIds(TYPE_FACTION, $_);
$this->extendGlobalIds(Type::FACTION, $_);
}
if ($_ = $this->subject->getField('reqMaxRepFaction'))
{
$cnd[CND_SRC_QUEST_ACCEPT][$this->typeId][0][] = [-CND_REPUTATION_RANK, $_, 1 << Game::getReputationLevelForPoints($this->subject->getField('reqMaxRepValue'))];
$this->extendGlobalIds(TYPE_FACTION, $_);
$this->extendGlobalIds(Type::FACTION, $_);
}
$_ = Util::getServerConditions([CND_SRC_QUEST_ACCEPT, CND_SRC_QUEST_SHOW_MARK], null, $this->typeId);
@@ -1091,9 +1091,9 @@ class QuestPage extends GenericPage
$rewards['money'] = sprintf(Lang::quest('expConvert2'), Util::formatMoney($realComp), MAX_LEVEL);
// itemChoices
if (!empty($this->subject->choices[$this->typeId][TYPE_ITEM]))
if (!empty($this->subject->choices[$this->typeId][Type::ITEM]))
{
$c = $this->subject->choices[$this->typeId][TYPE_ITEM];
$c = $this->subject->choices[$this->typeId][Type::ITEM];
$choiceItems = new ItemList(array(['id', array_keys($c)]));
if (!$choiceItems->error)
{
@@ -1101,21 +1101,21 @@ class QuestPage extends GenericPage
foreach ($choiceItems->Iterate() as $id => $__)
{
$rewards['choice'][] = array(
'typeStr' => Util::$typeStrings[TYPE_ITEM],
'typeStr' => Type::getFileString(Type::ITEM),
'id' => $id,
'name' => $choiceItems->getField('name', true),
'quality' => $choiceItems->getField('quality'),
'qty' => $c[$id],
'globalStr' => 'g_items'
'globalStr' => Type::getJSGlobalString(Type::ITEM)
);
}
}
}
// itemRewards
if (!empty($this->subject->rewards[$this->typeId][TYPE_ITEM]))
if (!empty($this->subject->rewards[$this->typeId][Type::ITEM]))
{
$ri = $this->subject->rewards[$this->typeId][TYPE_ITEM];
$ri = $this->subject->rewards[$this->typeId][Type::ITEM];
$rewItems = new ItemList(array(['id', array_keys($ri)]));
if (!$rewItems->error)
{
@@ -1123,20 +1123,20 @@ class QuestPage extends GenericPage
foreach ($rewItems->Iterate() as $id => $__)
{
$rewards['items'][] = array(
'typeStr' => Util::$typeStrings[TYPE_ITEM],
'typeStr' => Type::getFileString(Type::ITEM),
'id' => $id,
'name' => $rewItems->getField('name', true),
'quality' => $rewItems->getField('quality'),
'qty' => $ri[$id],
'globalStr' => 'g_items'
'globalStr' => Type::getJSGlobalString(Type::ITEM)
);
}
}
}
if (!empty($this->subject->rewards[$this->typeId][TYPE_CURRENCY]))
if (!empty($this->subject->rewards[$this->typeId][Type::CURRENCY]))
{
$rc = $this->subject->rewards[$this->typeId][TYPE_CURRENCY];
$rc = $this->subject->rewards[$this->typeId][Type::CURRENCY];
$rewCurr = new CurrencyList(array(['id', array_keys($rc)]));
if (!$rewCurr->error)
{
@@ -1144,12 +1144,12 @@ class QuestPage extends GenericPage
foreach ($rewCurr->Iterate() as $id => $__)
{
$rewards['items'][] = array(
'typeStr' => Util::$typeStrings[TYPE_CURRENCY],
'typeStr' => Type::getFileString(Type::CURRENCY),
'id' => $id,
'name' => $rewCurr->getField('name', true),
'quality' => 1,
'qty' => $rc[$id] * ($side == 2 ? -1 : 1), // toggles the icon
'globalStr' => 'g_gatheredcurrencies'
'globalStr' => Type::getJSGlobalString(Type::CURRENCY)
);
}
}
@@ -1179,10 +1179,10 @@ class QuestPage extends GenericPage
{
$rewards['spells']['extra'] = $extra;
$rewards['spells']['cast'][] = array(
'typeStr' => Util::$typeStrings[TYPE_SPELL],
'typeStr' => Type::getFileString(Type::SPELL),
'id' => $cast,
'name' => Util::localizedString($_, 'name'),
'globalStr' => 'g_spells'
'globalStr' => Type::getJSGlobalString(Type::SPELL)
);
}
}
@@ -1198,20 +1198,20 @@ class QuestPage extends GenericPage
{
$rewards['spells']['extra'] = null;
$rewards['spells'][$teach ? 'learn' : 'cast'][] = array(
'typeStr' => Util::$typeStrings[TYPE_SPELL],
'typeStr' => Type::getFileString(Type::SPELL),
'id' => $displ,
'name' => Util::localizedString($_, 'name'),
'globalStr' => 'g_spells'
'globalStr' => Type::getJSGlobalString(Type::SPELL)
);
}
else if (($_ = $rewSpells->getEntry($cast)) && !$teach)
{
$rewards['spells']['extra'] = null;
$rewards['spells']['cast'][] = array(
'typeStr' => Util::$typeStrings[TYPE_SPELL],
'typeStr' => Type::getFileString(Type::SPELL),
'id' => $cast,
'name' => Util::localizedString($_, 'name'),
'globalStr' => 'g_spells'
'globalStr' => Type::getJSGlobalString(Type::SPELL)
);
}
else
@@ -1224,10 +1224,10 @@ class QuestPage extends GenericPage
foreach ($taught->iterate() as $id => $__)
{
$rewards['spells']['learn'][] = array(
'typeStr' => Util::$typeStrings[TYPE_SPELL],
'typeStr' => Type::getFileString(Type::SPELL),
'id' => $id,
'name' => $taught->getField('name', true),
'globalStr' => 'g_spells'
'globalStr' => Type::getJSGlobalString(Type::SPELL)
);
}
}
@@ -1261,7 +1261,7 @@ class QuestPage extends GenericPage
$senderTypeId = $_;
else
foreach ($startEnd as $se)
if (($se['method'] & 0x2) && $se['type'] == TYPE_NPC)
if (($se['method'] & 0x2) && $se['type'] == Type::NPC)
$senderTypeId = $se['typeId'];
if ($ti = CreatureList::getName($senderTypeId))
@@ -1275,12 +1275,12 @@ class QuestPage extends GenericPage
foreach ($mailLoot->getResult() as $loot)
{
$mail['attachments'][] = array(
'typeStr' => Util::$typeStrings[TYPE_ITEM],
'typeStr' => Type::getFileString(Type::ITEM),
'id' => $loot['id'],
'name' => substr($loot['name'], 1),
'quality' => 7 - $loot['name'][0],
'qty' => $loot['stack'][0],
'globalStr' => 'g_items'
'globalStr' => Type::getJSGlobalString(Type::ITEM)
);
}
}

View File

@@ -9,7 +9,7 @@ class QuestsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_QUEST;
protected $type = Type::QUEST;
protected $tpl = 'quests';
protected $path = [0, 3];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class RacePage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_RACE;
protected $type = Type::CHR_RACE;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 13];
@@ -72,14 +72,14 @@ class RacePage extends GenericPage
// leader
if ($_ = $this->subject->getField('leader'))
{
$this->extendGlobalIds(TYPE_NPC, $_);
$this->extendGlobalIds(Type::NPC, $_);
$infobox[] = Lang::race('racialLeader').Lang::main('colon').'[npc='.$_.']';
}
// start area
if ($_ = $this->subject->getField('startAreaId'))
{
$this->extendGlobalIds(TYPE_ZONE, $_);
$this->extendGlobalIds(Type::ZONE, $_);
$infobox[] = Lang::race('startZone').Lang::main('colon').'[zone='.$_.']';
}

View File

@@ -10,7 +10,7 @@ class RacesPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_RACE;
protected $type = Type::CHR_RACE;
protected $tpl = 'list-page-generic';
protected $path = [0, 13];
protected $tabId = 0;

View File

@@ -49,21 +49,14 @@ class ScreenshotPage extends GenericPage
// target delivered as screenshot=<command>&<type>.<typeId>.<hash:16> (hash is optional)
if (preg_match('/^screenshot=\w+&(-?\d+)\.(-?\d+)(\.(\w{16}))?$/i', $_SERVER['QUERY_STRING'] ?? '', $m))
{
// no such type
if (empty(Util::$typeClasses[$m[1]]))
// no such type or this type cannot receive screenshots
if (!Type::checkClassAttrib($m[1], 'contribute', CONTRIBUTE_SS))
$this->error();
// this type cannot receive screenshots
if (!(get_class_vars(Util::$typeClasses[$m[1]])['contribute'] & CONTRIBUTE_SS))
$this->error();
$t = Util::$typeClasses[$m[1]];
$c = [['id', intVal($m[2])]];
$this->destination = new $t($c);
$this->destination = Type::newList($m[1], [['id', intVal($m[2])]]);
// no such typeId
if ($this->destination->error)
if (!$this->destination || $this->destination->error)
$this->error();
// only accept/expect hash for crop & complete
@@ -89,7 +82,7 @@ class ScreenshotPage extends GenericPage
if ($this->handleAdd())
header('Location: ?screenshot=crop&'.$this->destType.'.'.$this->destTypeId.'.'.$this->imgHash, true, 302);
else
header('Location: ?'.Util::$typeStrings[$this->destType].'='.$this->destTypeId.'#submit-a-screenshot', true, 302);
header('Location: ?'.Type::getFileString($this->destType).'='.$this->destTypeId.'#submit-a-screenshot', true, 302);
die();
case 'crop':
$this->handleCrop();
@@ -184,7 +177,7 @@ class ScreenshotPage extends GenericPage
$this->cropper['minCrop'] = $this->minSize;
// target
$this->infobox = sprintf(Lang::screenshot('displayOn'), Util::ucFirst(Lang::game(Util::$typeStrings[$this->destType])), Util::$typeStrings[$this->destType], $this->destTypeId);
$this->infobox = sprintf(Lang::screenshot('displayOn'), Lang::typeName($this->destType), Type::getFileString($this->destType), $this->destTypeId);
$this->extendGlobalIds($this->destType, $this->destTypeId);
}
@@ -240,7 +233,7 @@ class ScreenshotPage extends GenericPage
private function handleThankyou() : void
{
$this->extraHTML = Lang::screenshot('thanks', 'contrib').'<br><br>';
$this->extraHTML .= sprintf(Lang::screenshot('thanks', 'goBack'), Util::$typeStrings[$this->destType], $this->destTypeId)."<br /><br />\n";
$this->extraHTML .= sprintf(Lang::screenshot('thanks', 'goBack'), Type::getFileString($this->destType), $this->destTypeId)."<br /><br />\n";
$this->extraHTML .= '<i>'.Lang::screenshot('thanks', 'note').'</i>';
}

View File

@@ -96,9 +96,9 @@ class SearchPage extends GenericPage
if ($this->_get['slots'])
$this->searchMask |= SEARCH_TYPE_JSON | 0x40;
else if ($this->_get['type'] == TYPE_ITEMSET)
else if ($this->_get['type'] == Type::ITEMSET)
$this->searchMask |= SEARCH_TYPE_JSON | 0x60;
else if ($this->_get['type'] == TYPE_ITEM)
else if ($this->_get['type'] == Type::ITEM)
$this->searchMask |= SEARCH_TYPE_JSON | 0x40;
}
else if ($this->_get['opensearch'])
@@ -187,7 +187,7 @@ class SearchPage extends GenericPage
if ($foundTotal == 1) // only one match -> redirect to find
{
$tab = array_pop($this->lvTabs);
$type = Util::$typeStrings[$tab[3][0]];
$type = Type::getFileString($tab[3][0]);
$typeId = array_pop($tab[1]['data'])['id'];
header('Location: ?'.$type.'='.$typeId, true, 302);
@@ -304,7 +304,7 @@ class SearchPage extends GenericPage
$hasQ = is_numeric($data['name'][0]) || $data['name'][0] == '@';
$result[1][] = ($hasQ ? mb_substr($data['name'], 1) : $data['name']).$osInfo[1];
$result[3][] = HOST_URL.'/?'.Util::$typeStrings[$osInfo[0]].'='.$data['id'];
$result[3][] = HOST_URL.'/?'.Type::getFileString($osInfo[0]).'='.$data['id'];
$extra = [$osInfo[0], $data['id']]; // type, typeId
@@ -381,7 +381,7 @@ class SearchPage extends GenericPage
if ($data = $classes->getListviewData())
{
$result['data'] = array_values($data);
$osInfo = [TYPE_CLASS, ' (Class)', $classes->getMatches(), []];
$osInfo = [Type::CHR_CLASS, ' (Class)', $classes->getMatches(), []];
if ($this->searchMask & SEARCH_TYPE_OPEN)
foreach ($classes->iterate() as $id => $__)
@@ -407,7 +407,7 @@ class SearchPage extends GenericPage
if ($data = $races->getListviewData())
{
$result['data'] = array_values($data);
$osInfo = [TYPE_RACE, ' (Race)', $races->getMatches(), []];
$osInfo = [Type::CHR_RACE, ' (Race)', $races->getMatches(), []];
if ($this->searchMask & SEARCH_TYPE_OPEN)
foreach ($races->iterate() as $id => $__)
@@ -433,7 +433,7 @@ class SearchPage extends GenericPage
if ($data = $titles->getListviewData())
{
$result['data'] = array_values($data);
$osInfo = [TYPE_TITLE, ' (Title)', $titles->getMatches(), []];
$osInfo = [Type::TITLE, ' (Title)', $titles->getMatches(), []];
if ($this->searchMask & SEARCH_TYPE_OPEN)
foreach ($titles->iterate() as $id => $__)
@@ -468,7 +468,7 @@ class SearchPage extends GenericPage
$this->extendGlobalData($wEvents->getJSGlobals());
$result['data'] = array_values($data);
$osInfo = [TYPE_WORLDEVENT, ' (World Event)', $wEvents->getMatches()];
$osInfo = [Type::WORLDEVENT, ' (World Event)', $wEvents->getMatches()];
// as allways: dates are updated in postCache-step
@@ -492,7 +492,7 @@ class SearchPage extends GenericPage
if ($data = $money->getListviewData())
{
$result['data'] = array_values($data);
$osInfo = [TYPE_CURRENCY, ' (Currency)', $money->getMatches()];
$osInfo = [Type::CURRENCY, ' (Currency)', $money->getMatches()];
if ($this->searchMask & SEARCH_TYPE_OPEN)
foreach ($money->iterate() as $id => $__)
@@ -521,7 +521,7 @@ class SearchPage extends GenericPage
$this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF));
$result['data'] = array_values($data);
$osInfo = [TYPE_ITEMSET, ' (Item Set)', $sets->getMatches()];
$osInfo = [Type::ITEMSET, ' (Item Set)', $sets->getMatches()];
if ($this->searchMask & SEARCH_TYPE_OPEN)
foreach ($sets->iterate() as $id => $__)
@@ -591,7 +591,7 @@ class SearchPage extends GenericPage
foreach ($data[$itemId]['subitems'] as &$si)
$si['enchantment'] = implode(', ', $si['enchantment']);
$osInfo = [TYPE_ITEM, ' (Item)', $items->getMatches(), [], []];
$osInfo = [Type::ITEM, ' (Item)', $items->getMatches(), [], []];
$result['data'] = array_values($data);
if ($this->searchMask & SEARCH_TYPE_OPEN)
@@ -653,7 +653,7 @@ class SearchPage extends GenericPage
$vis[] = $multiClass > 1 ? 'classes' : 'singleclass';
$osInfo = [TYPE_SPELL, ' (Ability)', $abilities->getMatches(), [], []];
$osInfo = [Type::SPELL, ' (Ability)', $abilities->getMatches(), [], []];
$result = array(
'data' => array_values($data),
'id' => 'abilities',
@@ -704,7 +704,7 @@ class SearchPage extends GenericPage
if ($talents->hasSetFields(['reagent1']))
$vis[] = 'reagents';
$osInfo = [TYPE_SPELL, ' (Talent)', $talents->getMatches(), [], []];
$osInfo = [Type::SPELL, ' (Talent)', $talents->getMatches(), [], []];
$result = array(
'data' => array_values($data),
'id' => 'talents',
@@ -751,7 +751,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($glyphs->getJSGlobals(GLOBALINFO_SELF));
$osInfo = [TYPE_SPELL, ' (Glyph)', $glyphs->getMatches(), []];
$osInfo = [Type::SPELL, ' (Glyph)', $glyphs->getMatches(), []];
$result = array(
'data' => array_values($data),
'id' => 'glyphs',
@@ -793,7 +793,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($prof->getJSGlobals(GLOBALINFO_SELF));
$osInfo = [TYPE_SPELL, ' (Proficiency)', $prof->getMatches(), []];
$osInfo = [Type::SPELL, ' (Proficiency)', $prof->getMatches(), []];
$result = array(
'data' => array_values($data),
'id' => 'proficiencies',
@@ -835,7 +835,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($prof->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$osInfo = [TYPE_SPELL, ' (Profession)', $prof->getMatches()];
$osInfo = [Type::SPELL, ' (Profession)', $prof->getMatches()];
$result = array(
'data' => array_values($data),
'id' => 'professions',
@@ -877,7 +877,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($vPets->getJSGlobals());
$osInfo = [TYPE_SPELL, ' (Companion)', $vPets->getMatches(), []];
$osInfo = [Type::SPELL, ' (Companion)', $vPets->getMatches(), []];
$result = array(
'data' => array_values($data),
'id' => 'companions',
@@ -919,7 +919,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($mounts->getJSGlobals(GLOBALINFO_SELF));
$osInfo = [TYPE_SPELL, ' (Mount)', $mounts->getMatches(), []];
$osInfo = [Type::SPELL, ' (Mount)', $mounts->getMatches(), []];
$result = array(
'data' => array_values($data),
'id' => 'mounts',
@@ -958,7 +958,7 @@ class SearchPage extends GenericPage
if ($data = $npcs->getListviewData())
{
$osInfo = [TYPE_NPC, ' (NPC)', $npcs->getMatches()];
$osInfo = [Type::NPC, ' (NPC)', $npcs->getMatches()];
$result = array(
'data' => array_values($data),
'id' => 'npcs',
@@ -992,7 +992,7 @@ class SearchPage extends GenericPage
if ($data = $quests->getListviewData())
{
$osInfo = [TYPE_QUEST, ' (Quest)', $quests->getMatches()];
$osInfo = [Type::QUEST, ' (Quest)', $quests->getMatches()];
$result['data'] = array_values($data);
if ($this->searchMask & SEARCH_TYPE_REGULAR)
@@ -1028,7 +1028,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($acvs->getJSGlobals());
$osInfo = [TYPE_ACHIEVEMENT, ' (Achievement)', $acvs->getMatches(), []];
$osInfo = [Type::ACHIEVEMENT, ' (Achievement)', $acvs->getMatches(), []];
$result = array(
'data' => array_values($data),
'visibleCols' => ['category']
@@ -1068,7 +1068,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($stats->getJSGlobals(GLOBALINFO_SELF));
$osInfo = [TYPE_ACHIEVEMENT, ' (Statistic)', $stats->getMatches()];
$osInfo = [Type::ACHIEVEMENT, ' (Statistic)', $stats->getMatches()];
$result = array(
'data' => array_values($data),
'visibleCols' => ['category'],
@@ -1104,7 +1104,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($zones->getJSGlobals());
$osInfo = [TYPE_ZONE, ' (Zone)', $zones->getMatches()];
$osInfo = [Type::ZONE, ' (Zone)', $zones->getMatches()];
$result['data'] = array_values($data);
if ($zones->getMatches() > $this->maxResults)
@@ -1129,7 +1129,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($objects->getJSGlobals());
$osInfo = [TYPE_OBJECT, ' (Object)', $objects->getMatches()];
$osInfo = [Type::OBJECT, ' (Object)', $objects->getMatches()];
$result['data'] = array_values($data);
if ($objects->getMatches() > $this->maxResults)
@@ -1156,7 +1156,7 @@ class SearchPage extends GenericPage
if ($data = $factions->getListviewData())
{
$osInfo = [TYPE_FACTION, ' (Faction)', $factions->getMatches()];
$osInfo = [Type::FACTION, ' (Faction)', $factions->getMatches()];
$result['data'] = array_values($data);
if ($factions->getMatches() > $this->maxResults)
@@ -1178,7 +1178,7 @@ class SearchPage extends GenericPage
if ($data = $skills->getListviewData())
{
$osInfo = [TYPE_SKILL, ' (Skill)', $skills->getMatches(), []];
$osInfo = [Type::SKILL, ' (Skill)', $skills->getMatches(), []];
$result['data'] = array_values($data);
if ($this->searchMask & SEARCH_TYPE_OPEN)
@@ -1204,7 +1204,7 @@ class SearchPage extends GenericPage
if ($data = $pets->getListviewData())
{
$osInfo = [TYPE_PET, ' (Pet)', $pets->getMatches(), []];
$osInfo = [Type::PET, ' (Pet)', $pets->getMatches(), []];
$result = array(
'data' => array_values($data),
'computeDataFunc' => '$_'
@@ -1239,7 +1239,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($npcAbilities->getJSGlobals(GLOBALINFO_SELF));
$osInfo = [TYPE_SPELL, ' (Spell)', $npcAbilities->getMatches(), []];
$osInfo = [Type::SPELL, ' (Spell)', $npcAbilities->getMatches(), []];
$result = array(
'data' => array_values($data),
'id' => 'npc-abilities',
@@ -1288,7 +1288,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($misc->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$osInfo = [TYPE_SPELL, ' (Spell)', $misc->getMatches(), []];
$osInfo = [Type::SPELL, ' (Spell)', $misc->getMatches(), []];
$result = array(
'data' => array_values($data),
'name' => '$LANG.tab_uncategorizedspells',
@@ -1324,7 +1324,7 @@ class SearchPage extends GenericPage
if ($data = $emote->getListviewData())
{
$osInfo = [TYPE_EMOTE, ' (Emote)', $emote->getMatches()];
$osInfo = [Type::EMOTE, ' (Emote)', $emote->getMatches()];
$result = array(
'data' => array_values($data),
'name' => Util::ucFirst(Lang::game('emotes'))
@@ -1345,7 +1345,7 @@ class SearchPage extends GenericPage
{
$this->extendGlobalData($enchantment->getJSGlobals());
$osInfo = [TYPE_ENCHANTMENT, ' (Enchantment)', $enchantment->getMatches()];
$osInfo = [Type::ENCHANTMENT, ' (Enchantment)', $enchantment->getMatches()];
$result = array(
'data' => array_values($data),
'name' => Util::ucFirst(Lang::game('enchantments'))
@@ -1379,7 +1379,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
$this->extendGlobalData($sounds->getJSGlobals());
$osInfo = [TYPE_SOUND, ' (Sound)', $sounds->getMatches()];
$osInfo = [Type::SOUND, ' (Sound)', $sounds->getMatches()];
$result['data'] = array_values($data);
if ($sounds->getMatches() > $this->maxResults)

View File

@@ -10,7 +10,7 @@ class SkillPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_SKILL;
protected $type = Type::SKILL;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 14];
@@ -55,7 +55,7 @@ class SkillPage extends GenericPage
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
$this->extendGlobalIds(Type::ICON, $_);
}
/****************/

View File

@@ -10,7 +10,7 @@ class SkillsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_SKILL;
protected $type = Type::SKILL;
protected $tpl = 'list-page-generic';
protected $path = [0, 14];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class SoundPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_SOUND;
protected $type = Type::SOUND;
protected $tpl = 'sound';
protected $path = [0, 19];
protected $tabId = 0;
@@ -98,7 +98,7 @@ class SoundPage extends GenericPage
BUTTON_WOWHEAD => true,
BUTTON_PLAYLIST => true,
BUTTON_LINKS => array(
'type' => TYPE_SOUND,
'type' => Type::SOUND,
'typeId' => $this->typeId,
'sound' => str_replace('\\', '\\\\', $fullpath) // escape for wow client
)
@@ -274,8 +274,8 @@ class SoundPage extends GenericPage
$creatureIds = DB::World()->selectCol('SELECT ct.CreatureID FROM creature_text ct LEFT JOIN broadcast_text bct ON bct.ID = ct.BroadCastTextId WHERE bct.SoundEntriesID = ?d OR ct.Sound = ?d', $this->typeId, $this->typeId);
// can objects or areatrigger play sound...?
if ($goosp = SmartAI::getOwnerOfSoundPlayed($this->typeId, TYPE_NPC))
$creatureIds = array_merge($creatureIds, $goosp[TYPE_NPC]);
if ($goosp = SmartAI::getOwnerOfSoundPlayed($this->typeId, Type::NPC))
$creatureIds = array_merge($creatureIds, $goosp[Type::NPC]);
// tab: NPC (dialogues...?, generic creature sound)
// skipping (always empty): transforms, footsteps

View File

@@ -10,7 +10,7 @@ class SoundsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_SOUND;
protected $type = Type::SOUND;
protected $tpl = 'sounds';
protected $path = [0, 19];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class SpellPage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_SPELL;
protected $type = Type::SPELL;
protected $typeId = 0;
protected $tpl = 'spell';
protected $path = [0, 1];
@@ -139,7 +139,7 @@ class SpellPage extends GenericPage
BUTTON_WOWHEAD => true,
BUTTON_LINKS => array(
'linkColor' => 'ff71d5ff',
'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$this->typeId,
'linkId' => Type::getFileString(Type::SPELL).':'.$this->typeId,
'linkName' => $this->name,
'type' => $this->type,
'typeId' => $this->typeId
@@ -165,7 +165,7 @@ class SpellPage extends GenericPage
// races
if ($_ = Lang::getRaceString($this->subject->getField('reqRaceMask'), $jsg, false))
{
$this->extendGlobalIds(TYPE_RACE, ...$jsg);
$this->extendGlobalIds(Type::CHR_RACE, ...$jsg);
$t = count($jsg) == 1 ? Lang::game('race') : Lang::game('races');
$infobox[] = Util::ucFirst($t).Lang::main('colon').$_;
}
@@ -173,7 +173,7 @@ class SpellPage extends GenericPage
// classes
if ($_ = Lang::getClassString($this->subject->getField('reqClassMask'), $jsg, false))
{
$this->extendGlobalIds(TYPE_CLASS, ...$jsg);
$this->extendGlobalIds(Type::CHR_CLASS, ...$jsg);
$t = count($jsg) == 1 ? Lang::game('class') : Lang::game('classes');
$infobox[] = Util::ucFirst($t).Lang::main('colon').$_;
}
@@ -235,7 +235,7 @@ class SpellPage extends GenericPage
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
$this->extendGlobalIds(Type::ICON, $_);
}
// used in mode
@@ -614,8 +614,8 @@ class SpellPage extends GenericPage
['onUseSpell', $this->subject->id], ['onSuccessSpell', $this->subject->id],
['auraSpell', $this->subject->id], ['triggeredSpell', $this->subject->id]
);
if (!empty($ubSAI[TYPE_OBJECT]))
$conditions[] = ['id', $ubSAI[TYPE_OBJECT]];
if (!empty($ubSAI[Type::OBJECT]))
$conditions[] = ['id', $ubSAI[Type::OBJECT]];
$ubObjects = new GameObjectList($conditions);
if (!$ubObjects->error)
@@ -632,9 +632,9 @@ class SpellPage extends GenericPage
// tab: used by - areatrigger
if (User::isInGroup(U_GROUP_EMPLOYEE))
{
if (!empty($ubSAI[TYPE_AREATRIGGER]))
if (!empty($ubSAI[Type::AREATRIGGER]))
{
$ubTriggers = new AreaTriggerList(array(['id', $ubSAI[TYPE_AREATRIGGER]]));
$ubTriggers = new AreaTriggerList(array(['id', $ubSAI[Type::AREATRIGGER]]));
if (!$ubTriggers->error)
{
$this->lvTabs[] = ['areatrigger', array(
@@ -689,7 +689,7 @@ class SpellPage extends GenericPage
$lv[$bar] = $foo[$bar];
$lv[$bar]['percent'] = $extraItem['additionalCreateChance'];
$lv[$bar]['condition'][0][$this->typeId][] = [[CND_SPELL, $extraItem['requiredSpecialization']]];
$this->extendGlobalIds(TYPE_SPELL, $extraItem['requiredSpecialization']);
$this->extendGlobalIds(Type::SPELL, $extraItem['requiredSpecialization']);
$extraCols[] = '$Listview.extraCols.condition';
if ($max = ($extraItem['additionalMaxNum'] - 1))
$lv[$bar]['stack'] = [1, $max];
@@ -849,8 +849,8 @@ class SpellPage extends GenericPage
['spell1', $this->typeId], ['spell2', $this->typeId], ['spell3', $this->typeId], ['spell4', $this->typeId],
['spell5', $this->typeId], ['spell6', $this->typeId], ['spell7', $this->typeId], ['spell8', $this->typeId]
);
if (!empty($ubSAI[TYPE_NPC]))
$conditions[] = ['id', $ubSAI[TYPE_NPC]];
if (!empty($ubSAI[Type::NPC]))
$conditions[] = ['id', $ubSAI[Type::NPC]];
$ubCreature = new CreatureList($conditions);
if (!$ubCreature->error)
@@ -884,13 +884,13 @@ class SpellPage extends GenericPage
$condition = [];
if ($a['aura_spell'])
{
$this->extendGlobalIds(TYPE_SPELL, abs($a['aura_spell']));
$this->extendGlobalIds(Type::SPELL, abs($a['aura_spell']));
$condition[0][$this->typeId][] = [[$a['aura_spell'] > 0 ? CND_AURA : -CND_AURA, abs($a['aura_spell'])]];
}
if ($a['quest_start']) // status for quests needs work
{
$this->extendGlobalIds(TYPE_QUEST, $a['quest_start']);
$this->extendGlobalIds(Type::QUEST, $a['quest_start']);
$group = [];
for ($i = 0; $i < 7; $i++)
{
@@ -913,7 +913,7 @@ class SpellPage extends GenericPage
if ($a['quest_end'] && $a['quest_end'] != $a['quest_start'])
{
$this->extendGlobalIds(TYPE_QUEST, $a['quest_end']);
$this->extendGlobalIds(Type::QUEST, $a['quest_end']);
$group = [];
for ($i = 0; $i < 7; $i++)
{
@@ -941,7 +941,7 @@ class SpellPage extends GenericPage
if ($a['racemask'] & (1 << $i))
$foo[] = $i + 1;
$this->extendGlobalIds(TYPE_RACE, ...$foo);
$this->extendGlobalIds(Type::CHR_RACE, ...$foo);
$condition[0][$this->typeId][] = [[CND_RACE, $a['racemask']]];
}
@@ -1246,19 +1246,19 @@ class SpellPage extends GenericPage
if (!$item)
return false;
$this->extendGlobalIds(TYPE_ITEM, $item['id']);
$this->extendGlobalIds(Type::ITEM, $item['id']);
$_level++;
$data = array(
'type' => TYPE_ITEM,
'type' => Type::ITEM,
'typeId' => $item['id'],
'typeStr' => Util::$typeStrings[TYPE_ITEM],
'typeStr' => Type::getFileString(Type::ITEM),
'quality' => $item['quality'],
'name' => Util::localizedString($item, 'name'),
'icon' => $item['iconString'],
'qty' => $_qty * $_mult,
'path' => $_path.'.'.TYPE_ITEM.'-'.$item['id'],
'path' => $_path.'.'.Type::ITEM.'-'.$item['id'],
'level' => $_level
);
@@ -1299,16 +1299,16 @@ class SpellPage extends GenericPage
if (in_array(-$sId, $alreadyUsed))
continue;
$this->extendGlobalIds(TYPE_SPELL, $sId);
$this->extendGlobalIds(Type::SPELL, $sId);
$data = array(
'type' => TYPE_SPELL,
'type' => Type::SPELL,
'typeId' => $sId,
'typeStr' => Util::$typeStrings[TYPE_SPELL],
'typeStr' => Type::getFileString(Type::SPELL),
'name' => Util::localizedString($row, 'name'),
'icon' => $row['iconString'],
'qty' => $_qty,
'path' => $_path.'.'.TYPE_SPELL.'-'.$sId,
'path' => $_path.'.'.Type::SPELL.'-'.$sId,
'level' => $_level,
);
@@ -1354,14 +1354,14 @@ class SpellPage extends GenericPage
continue;
$data = array(
'type' => TYPE_ITEM,
'type' => Type::ITEM,
'typeId' => $iId,
'typeStr' => Util::$typeStrings[TYPE_ITEM],
'typeStr' => Type::getFileString(Type::ITEM),
'quality' => $this->subject->relItems->getField('quality'),
'name' => $this->subject->relItems->getField('name', true),
'icon' => $this->subject->relItems->getField('iconString'),
'qty' => $reagents[$iId][1],
'path' => TYPE_ITEM.'-'.$iId, // id of the html-element
'path' => Type::ITEM.'-'.$iId, // id of the html-element
'level' => 0 // depths in array, used for indentation
);
@@ -1702,7 +1702,7 @@ class SpellPage extends GenericPage
case 112: // Summon Demon
case 134: // Kill Credit2
if ($summon = $this->subject->getModelInfo($this->typeId, $i))
$redButtons[BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $summon['displayId']];
$redButtons[BUTTON_VIEW3D] = ['type' => Type::NPC, 'displayId' => $summon['displayId']];
$_ = Lang::game('npc').' #'.$effMV;
if ($n = CreatureList::getName($effMV))
@@ -1754,7 +1754,7 @@ class SpellPage extends GenericPage
case 106: // Summon Object (slot 3)
case 107: // Summon Object (slot 4)
if ($summon = $this->subject->getModelInfo($this->typeId, $i))
$redButtons[BUTTON_VIEW3D] = ['type' => TYPE_OBJECT, 'displayId' => $summon['displayId']];
$redButtons[BUTTON_VIEW3D] = ['type' => Type::OBJECT, 'displayId' => $summon['displayId']];
$_ = Util::ucFirst(Lang::game('object')).' #'.$effMV;
if ($n = GameobjectList::getName($effMV))
@@ -1920,7 +1920,7 @@ class SpellPage extends GenericPage
if ($st = $this->subject->getModelInfo($this->typeId, $i))
{
$redButtons[BUTTON_VIEW3D] = array(
'type' => TYPE_NPC,
'type' => Type::NPC,
'displayId' => $st['displayId']
);
@@ -2093,7 +2093,7 @@ class SpellPage extends GenericPage
case 56: // Transform
if ($transform = $this->subject->getModelInfo($this->typeId, $i))
{
$redButtons[BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $transform['displayId']];
$redButtons[BUTTON_VIEW3D] = ['type' => Type::NPC, 'displayId' => $transform['displayId']];
$bar = $transform['typeId'] ? ' (<a href="?npc='.$transform['typeId'].'">'.$transform['displayName'].'</a>)' : ' (#0)';
}
else
@@ -2115,7 +2115,7 @@ class SpellPage extends GenericPage
{
if ($x = $so['spellId'.$j])
{
$this->extendGlobalData([TYPE_SPELL => [$x]]);
$this->extendGlobalData([Type::SPELL => [$x]]);
$buff[] = '[spell='.$x.']';
}
}

View File

@@ -10,7 +10,7 @@ class SpellsPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_SPELL;
protected $type = Type::SPELL;
protected $tpl = 'spells';
protected $path = [0, 1];
protected $tabId = 0;

View File

@@ -10,7 +10,7 @@ class TitlePage extends GenericPage
{
use TrDetailPage;
protected $type = TYPE_TITLE;
protected $type = Type::TITLE;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 10];
@@ -63,7 +63,7 @@ class TitlePage extends GenericPage
if ($eId = $this->subject->getField('eventId'))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $eId);
$this->extendGlobalIds(Type::WORLDEVENT, $eId);
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$eId.']';
}

View File

@@ -10,7 +10,7 @@ class TitlesPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_TITLE;
protected $type = Type::TITLE;
protected $tpl = 'list-page-generic';
protected $path = [0, 10];
protected $tabId = 0;

View File

@@ -69,10 +69,10 @@ class UtilityPage extends GenericPage
switch ($this->page)
{
case 'random':
$type = array_rand(array_filter(Util::$typeClasses));
$typeId = (new Util::$typeClasses[$type](null))->getRandomId();
$type = array_rand(Type::getClassesFor(Type::FLAG_RANDOM_SEARCHABLE));
$typeId = (Type::newList($type, null))?->getRandomId();
header('Location: ?'.Util::$typeStrings[$type].'='.$typeId, true, 302);
header('Location: ?'.Type::getFileString($type).'='.$typeId, true, 302);
die();
case 'latest-comments': // rss
$data = CommunityContent::getCommentPreviews(dateFmt: false);
@@ -83,7 +83,7 @@ class UtilityPage extends GenericPage
{
// todo (low): preview should be html-formated
$this->feedData[] = array(
'title' => [true, [], Util::ucFirst(Lang::game(Util::$typeStrings[$d['type']])).Lang::main('colon').htmlentities($d['subject'])],
'title' => [true, [], Lang::typeName($d['type']).Lang::main('colon').htmlentities($d['subject'])],
'link' => [false, [], HOST_URL.'/?go-to-comment&amp;id='.$d['id']],
'description' => [true, [], htmlentities($d['preview'])."<br /><br />".Lang::main('byUser', [$d['user'], '']) . Util::formatTimeDiff($d['date'], true)],
'pubDate' => [false, [], date(DATE_RSS, $d['date'])],
@@ -103,19 +103,19 @@ class UtilityPage extends GenericPage
{
foreach ($data as $d)
{
$desc = '<a href="'.HOST_URL.'/?'.Util::$typeStrings[$d['type']].'='.$d['typeId'].'#screenshots:id='.$d['id'].'"><img src="'.STATIC_URL.'/uploads/screenshots/thumb/'.$d['id'].'.jpg" alt="" /></a>';
$desc = '<a href="'.HOST_URL.'/?'.Type::getFileString($d['type']).'='.$d['typeId'].'#screenshots:id='.$d['id'].'"><img src="'.STATIC_URL.'/uploads/screenshots/thumb/'.$d['id'].'.jpg" alt="" /></a>';
if ($d['caption'])
$desc .= '<br />'.$d['caption'];
$desc .= "<br /><br />".Lang::main('byUser', [$d['user'], '']) . Util::formatTimeDiff($d['date'], true);
// enclosure/length => filesize('static/uploads/screenshots/thumb/'.$d['id'].'.jpg') .. always set to this placeholder value though
$this->feedData[] = array(
'title' => [true, [], Util::ucFirst(Lang::game(Util::$typeStrings[$d['type']])).Lang::main('colon').htmlentities($d['subject'])],
'link' => [false, [], HOST_URL.'/?'.Util::$typeStrings[$d['type']].'='.$d['typeId'].'#screenshots:id='.$d['id']],
'title' => [true, [], Lang::typeName($d['type']).Lang::main('colon').htmlentities($d['subject'])],
'link' => [false, [], HOST_URL.'/?'.Type::getFileString($d['type']).'='.$d['typeId'].'#screenshots:id='.$d['id']],
'description' => [true, [], $desc],
'pubDate' => [false, [], date(DATE_RSS, $d['date'])],
'enclosure' => [false, ['url' => STATIC_URL.'/uploads/screenshots/thumb/'.$d['id'].'.jpg', 'length' => 12345, 'type' => 'image/jpeg'], null],
'guid' => [false, [], HOST_URL.'/?'.Util::$typeStrings[$d['type']].'='.$d['typeId'].'#screenshots:id='.$d['id']],
'guid' => [false, [], HOST_URL.'/?'.Type::getFileString($d['type']).'='.$d['typeId'].'#screenshots:id='.$d['id']],
// 'domain' => [false, [], live|ptr]
);
}
@@ -131,19 +131,19 @@ class UtilityPage extends GenericPage
{
foreach ($data as $d)
{
$desc = '<a href="'.HOST_URL.'/?'.Util::$typeStrings[$d['type']].'='.$d['typeId'].'#videos:id='.$d['id'].'"><img src="//i3.ytimg.com/vi/'.$d['videoId'].'/default.jpg" alt="" /></a>';
$desc = '<a href="'.HOST_URL.'/?'.Type::getFileString($d['type']).'='.$d['typeId'].'#videos:id='.$d['id'].'"><img src="//i3.ytimg.com/vi/'.$d['videoId'].'/default.jpg" alt="" /></a>';
if ($d['caption'])
$desc .= '<br />'.$d['caption'];
$desc .= "<br /><br />".Lang::main('byUser', [$d['user'], '']) . Util::formatTimeDiff($d['date'], true);
// is enclosure/length .. is this even relevant..?
$this->feedData[] = array(
'title' => [true, [], Util::ucFirst(Lang::game(Util::$typeStrings[$d['type']])).Lang::main('colon').htmlentities($d['subject'])],
'link' => [false, [], HOST_URL.'/?'.Util::$typeStrings[$d['type']].'='.$d['typeId'].'#videos:id='.$d['id']],
'title' => [true, [], Lang::typeName($d['type']).Lang::main('colon').htmlentities($d['subject'])],
'link' => [false, [], HOST_URL.'/?'.Type::getFileString($d['type']).'='.$d['typeId'].'#videos:id='.$d['id']],
'description' => [true, [], $desc],
'pubDate' => [false, [], date(DATE_RSS, $d['date'])],
'enclosure' => [false, ['url' => '//i3.ytimg.com/vi/'.$d['videoId'].'/default.jpg', 'length' => 12345, 'type' => 'image/jpeg'], null],
'guid' => [false, [], HOST_URL.'/?'.Util::$typeStrings[$d['type']].'='.$d['typeId'].'#videos:id='.$d['id']],
'guid' => [false, [], HOST_URL.'/?'.Type::getFileString($d['type']).'='.$d['typeId'].'#videos:id='.$d['id']],
// 'domain' => [false, [], live|ptr]
);
}
@@ -167,14 +167,9 @@ class UtilityPage extends GenericPage
if (!User::isInGroup(U_GROUP_EMPLOYEE))
$cnd[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
foreach (Util::$typeClasses as $type => $classStr)
foreach (Type::getClassesFor(Type::FLAG_NONE, 'contribute', CONTRIBUTE_SS) as $type => $classStr)
{
if (!$classStr)
continue;
if (!($classStr::$contribute & CONTRIBUTE_SS))
continue;
$typeObj = new $classStr($cnd);
if (!$typeObj->error)
{
@@ -192,11 +187,8 @@ class UtilityPage extends GenericPage
'sort' => ['-ncomments']
);
foreach (Util::$typeClasses as $type => $classStr)
foreach (Type::getClassesFor() as $type => $classStr)
{
if (!$classStr)
continue;
$comments = DB::Aowow()->selectCol('
SELECT `typeId` AS ARRAY_KEY, count(1) FROM ?_comments
WHERE `replyTo` = 0 AND (`flags` & ?d) = 0 AND `type`= ?d AND `date` > (UNIX_TIMESTAMP() - ?d)
@@ -219,9 +211,9 @@ class UtilityPage extends GenericPage
foreach ($data as $typeId => &$d)
{
$this->feedData[] = array(
'title' => [true, [], htmlentities(Util::$typeStrings[$type] == 'item' ? mb_substr($d['name'], 1) : $d['name'])],
'type' => [false, [], Util::$typeStrings[$type]],
'link' => [false, [], HOST_URL.'/?'.Util::$typeStrings[$type].'='.$d['id']],
'title' => [true, [], htmlentities(Type::getFileString($type) == 'item' ? mb_substr($d['name'], 1) : $d['name'])],
'type' => [false, [], Type::getFileString($type)],
'link' => [false, [], HOST_URL.'/?'.Type::getFileString($type).'='.$d['id']],
'ncomments' => [false, [], $comments[$typeId]]
);
}

View File

@@ -12,7 +12,7 @@ class ZonePage extends GenericPage
protected $path = [0, 6];
protected $tabId = 0;
protected $type = TYPE_ZONE;
protected $type = Type::ZONE;
protected $tpl = 'detail-page-generic';
protected $js = [[JS_FILE, 'ShowOnMap.js']];
@@ -100,10 +100,10 @@ class ZonePage extends GenericPage
$this->extendGlobalIds($type, ...array_map('abs', $ids));
foreach ($ids as $id)
{
if ($type == TYPE_ITEM)
if ($type == Type::ITEM)
$infobox[] = Lang::zone('key', (int)($id < 0)).Lang::main('colon').'[item='.abs($id).']';
else
$infobox[] = Lang::zone('attunement', (int)($id < 0)).Lang::main('colon').'['.Util::$typeStrings[$type].'='.abs($id).']';
$infobox[] = Lang::zone('attunement', (int)($id < 0)).Lang::main('colon').'['.Type::getFileString($type).'='.abs($id).']';
}
}
}
@@ -111,7 +111,7 @@ class ZonePage extends GenericPage
// Instances
if ($_ = DB::Aowow()->selectCol('SELECT id FROM ?_zones WHERE parentAreaId = ?d AND (flags & ?d) = 0', $this->typeId, CUSTOM_EXCLUDE_FOR_LISTVIEW))
{
$this->extendGlobalIds(TYPE_ZONE, ...$_);
$this->extendGlobalIds(Type::ZONE, ...$_);
$infobox[] = Lang::maps('Instances').Lang::main('colon')."\n[zone=".implode("], \n[zone=", $_).']';
}
@@ -165,13 +165,13 @@ class ZonePage extends GenericPage
if ($_ = $this->subject->getField('parentArea'))
{
$this->extraText = sprintf(Lang::zone('zonePartOf'), $_);
$this->extendGlobalIds(TYPE_ZONE, $_);
$this->extendGlobalIds(Type::ZONE, $_);
}
// we cannot fetch spawns via lists. lists are grouped by entry
$oSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, TYPE_OBJECT);
$cSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, TYPE_NPC);
$aSpawns = User::isInGroup(U_GROUP_STAFF) ? DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, TYPE_AREATRIGGER) : [];
$oSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, Type::OBJECT);
$cSpawns = DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, Type::NPC);
$aSpawns = User::isInGroup(U_GROUP_STAFF) ? DB::Aowow()->select('SELECT * FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, Type::AREATRIGGER) : [];
$conditions = [CFG_SQL_LIMIT_NONE, ['s.areaId', $this->typeId]];
if (!User::isInGroup(U_GROUP_STAFF))
@@ -237,7 +237,7 @@ class ZonePage extends GenericPage
'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'],
'name' => $n,
'type' => TYPE_OBJECT,
'type' => Type::OBJECT,
'id' => $tpl['id']
);
@@ -249,18 +249,18 @@ class ZonePage extends GenericPage
if ($tpl['startsQuests'])
{
$started = new QuestList(array(['qse.method', 1, '&'], ['qse.type', TYPE_OBJECT], ['qse.typeId', $tpl['id']]));
$started = new QuestList(array(['qse.method', 1, '&'], ['qse.type', Type::OBJECT], ['qse.typeId', $tpl['id']]));
if ($started->error)
continue;
// store data for misc tabs
foreach ($started->getListviewData() as $id => $data)
{
if (!empty($started->rewards[$id][TYPE_ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][TYPE_ITEM]));
if (!empty($started->rewards[$id][Type::ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][Type::ITEM]));
if (!empty($started->choices[$id][TYPE_ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->choices[$id][TYPE_ITEM]));
if (!empty($started->choices[$id][Type::ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->choices[$id][Type::ITEM]));
$questsLV[$id] = $data;
}
@@ -272,7 +272,7 @@ class ZonePage extends GenericPage
'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'],
'name' => $n,
'type' => TYPE_OBJECT,
'type' => Type::OBJECT,
'id' => $tpl['id'],
'side' => (($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2)),
'quests' => array_values($_)
@@ -283,7 +283,7 @@ class ZonePage extends GenericPage
'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'],
'name' => $n,
'type' => TYPE_OBJECT,
'type' => Type::OBJECT,
'id' => $tpl['id'],
'side' => (($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2)),
'quests' => array_values($_)
@@ -337,7 +337,7 @@ class ZonePage extends GenericPage
'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'],
'name' => $n,
'type' => TYPE_NPC,
'type' => Type::NPC,
'id' => $tpl['id'],
'reacthorde' => $tpl['H'] ?: 1, // no neutral (0) setting
'reactalliance' => $tpl['A'] ?: 1,
@@ -346,18 +346,18 @@ class ZonePage extends GenericPage
if ($tpl['startsQuests'])
{
$started = new QuestList(array(['qse.method', 1, '&'], ['qse.type', TYPE_NPC], ['qse.typeId', $tpl['id']]));
$started = new QuestList(array(['qse.method', 1, '&'], ['qse.type', Type::NPC], ['qse.typeId', $tpl['id']]));
if ($started->error)
continue;
// store data for misc tabs
foreach ($started->getListviewData() as $id => $data)
{
if (!empty($started->rewards[$id][TYPE_ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][TYPE_ITEM]));
if (!empty($started->rewards[$id][Type::ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->rewards[$id][Type::ITEM]));
if (!empty($started->choices[$id][TYPE_ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->choices[$id][TYPE_ITEM]));
if (!empty($started->choices[$id][Type::ITEM]))
$rewardsLV = array_merge($rewardsLV, array_keys($started->choices[$id][Type::ITEM]));
$questsLV[$id] = $data;
}
@@ -369,7 +369,7 @@ class ZonePage extends GenericPage
'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'],
'name' => $n,
'type' => TYPE_NPC,
'type' => Type::NPC,
'id' => $tpl['id'],
'reacthorde' => $tpl['H'],
'reactalliance' => $tpl['A'],
@@ -382,7 +382,7 @@ class ZonePage extends GenericPage
'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'],
'name' => $n,
'type' => TYPE_NPC,
'type' => Type::NPC,
'id' => $tpl['id'],
'reacthorde' => $tpl['H'],
'reactalliance' => $tpl['A'],
@@ -402,7 +402,7 @@ class ZonePage extends GenericPage
'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'],
'name' => Util::localizedString($tpl, 'name', true, true),
'type' => TYPE_AREATRIGGER,
'type' => Type::AREATRIGGER,
'id' => $spawn['typeId'],
'description' => 'Type: '.Lang::areatrigger('types', $tpl['type'])
));
@@ -550,9 +550,9 @@ class ZonePage extends GenericPage
SELECT qse.typeId AS ARRAY_KEY, moreType, moreTypeId, moreZoneId
FROM ?_quests_startend qse JOIN ?_source src ON src.type = qse.type AND src.typeId = qse.typeId
WHERE src.src2 IS NOT NULL AND qse.type = ?d AND (moreZoneId = ?d OR (moreType = ?d AND moreTypeId IN (?a)) OR (moreType = ?d AND moreTypeId IN (?a)))',
TYPE_ITEM, $this->typeId,
TYPE_NPC, array_unique(array_column($cSpawns, 'typeId')) ?: [0],
TYPE_OBJECT, array_unique(array_column($oSpawns, 'typeId')) ?: [0]
Type::ITEM, $this->typeId,
Type::NPC, array_unique(array_column($cSpawns, 'typeId')) ?: [0],
Type::OBJECT, array_unique(array_column($oSpawns, 'typeId')) ?: [0]
);
if ($questStartItem)
@@ -635,13 +635,13 @@ class ZonePage extends GenericPage
$condition = [];
if ($a['aura_spell'])
{
$this->extendGlobalIds(TYPE_SPELL, abs($a['aura_spell']));
$this->extendGlobalIds(Type::SPELL, abs($a['aura_spell']));
$condition[0][$this->typeId][] = [[$a['aura_spell'] > 0 ? CND_AURA : -CND_AURA, abs($a['aura_spell'])]];
}
if ($a['quest_start']) // status for quests needs work
{
$this->extendGlobalIds(TYPE_QUEST, $a['quest_start']);
$this->extendGlobalIds(Type::QUEST, $a['quest_start']);
$group = [];
for ($i = 0; $i < 7; $i++)
{
@@ -664,7 +664,7 @@ class ZonePage extends GenericPage
if ($a['quest_end'] && $a['quest_end'] != $a['quest_start'])
{
$this->extendGlobalIds(TYPE_QUEST, $a['quest_end']);
$this->extendGlobalIds(Type::QUEST, $a['quest_end']);
$group = [];
for ($i = 0; $i < 7; $i++)
{
@@ -692,7 +692,7 @@ class ZonePage extends GenericPage
if ($a['racemask'] & (1 << $i))
$foo[] = $i + 1;
$this->extendGlobalIds(TYPE_RACE, ...$foo);
$this->extendGlobalIds(Type::CHR_RACE, ...$foo);
$condition[0][$this->typeId][] = [[CND_RACE, $a['racemask']]];
}
@@ -754,7 +754,7 @@ class ZonePage extends GenericPage
x.soundId, x.worldStateId, x.worldStateValue
', $areaIds, $areaIds, $areaIds, $areaIds, $areaIds);
if ($sSpawns = DB::Aowow()->selectCol('SELECT typeId FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, TYPE_SOUND))
if ($sSpawns = DB::Aowow()->selectCol('SELECT typeId FROM ?_spawns WHERE areaId = ?d AND type = ?d', $this->typeId, Type::SOUND))
$soundIds = array_merge($soundIds, $sSpawns);
if ($zoneMusic)

View File

@@ -10,7 +10,7 @@ class ZonesPage extends GenericPage
{
use TrListPage;
protected $type = TYPE_ZONE;
protected $type = Type::ZONE;
protected $tpl = 'list-page-generic';
protected $path = [0, 6];
protected $tabId = 0;

View File

@@ -67,7 +67,7 @@ if (!CLI)
// get locations
// again: caching will save you time and nerves
if (!isset($locations[$pet['id']]))
$locations[$pet['id']] = DB::Aowow()->SelectCol('SELECT DISTINCT areaId FROM ?_spawns WHERE type = ?d AND typeId = ?d', TYPE_NPC, $pet['id']);
$locations[$pet['id']] = DB::Aowow()->SelectCol('SELECT DISTINCT areaId FROM ?_spawns WHERE type = ?d AND typeId = ?d', Type::NPC, $pet['id']);
$petsOut[$pet['id']] = array(
'id' => $pet['id'],

View File

@@ -52,19 +52,19 @@ if (!CLI)
switch ($questz->getField('reqSkillId'))
{
case 356:
$exAdd(TYPE_QUEST, $id, PR_EXCLUDE_GROUP_REQ_FISHING);
$exAdd(Type::QUEST, $id, PR_EXCLUDE_GROUP_REQ_FISHING);
break;
case 202:
$exAdd(TYPE_QUEST, $id, PR_EXCLUDE_GROUP_REQ_ENGINEERING);
$exAdd(Type::QUEST, $id, PR_EXCLUDE_GROUP_REQ_ENGINEERING);
break;
case 197:
$exAdd(TYPE_QUEST, $id, PR_EXCLUDE_GROUP_REQ_TAILORING);
$exAdd(Type::QUEST, $id, PR_EXCLUDE_GROUP_REQ_TAILORING);
break;
}
}
$_ = [];
$currencies = array_column($questz->rewards, TYPE_CURRENCY);
$currencies = array_column($questz->rewards, Type::CURRENCY);
foreach ($currencies as $curr)
foreach ($curr as $cId => $qty)
$_[] = $cId;
@@ -110,7 +110,7 @@ if (!CLI)
// get titles for exclusion
foreach ($titlez->iterate() as $id => $__)
if (empty($titlez->sources[$id][4]) && empty($titlez->sources[$id][12]))
$exAdd(TYPE_TITLE, $id, PR_EXCLUDE_GROUP_UNAVAILABLE);
$exAdd(Type::TITLE, $id, PR_EXCLUDE_GROUP_UNAVAILABLE);
foreach (CLISetup::$localeIds as $l)
{
@@ -159,9 +159,9 @@ if (!CLI)
foreach ($conditionSet as $mount => $skill)
{
if ($skill == 202)
$exAdd(TYPE_SPELL, $mount, PR_EXCLUDE_GROUP_REQ_ENGINEERING);
$exAdd(Type::SPELL, $mount, PR_EXCLUDE_GROUP_REQ_ENGINEERING);
else if ($skill == 197)
$exAdd(TYPE_SPELL, $mount, PR_EXCLUDE_GROUP_REQ_TAILORING);
$exAdd(Type::SPELL, $mount, PR_EXCLUDE_GROUP_REQ_TAILORING);
}
foreach (CLISetup::$localeIds as $l)

View File

@@ -123,7 +123,7 @@ SqlGen::register(new class extends SetupScript
if ($criteria = DB::World()->selectCol('SELECT entry FROM disables WHERE sourceType = 4'))
DB::Aowow()->query('UPDATE aowow_achievement a JOIN aowow_achievementcriteria ac ON a.id = ac.refAchievementId SET a.cuFlags = ?d WHERE ac.id IN (?a)', CUSTOM_DISABLED, $criteria);
$this->reapplyCCFlags('achievement', TYPE_ACHIEVEMENT);
$this->reapplyCCFlags('achievement', Type::ACHIEVEMENT);
return true;
}

View File

@@ -80,7 +80,7 @@ SqlGen::register(new class extends SetupScript
foreach ($addData as $id => $ad)
DB::Aowow()->query('UPDATE ?_areatrigger SET ?a WHERE id = ?d', $ad, $id);
$this->reapplyCCFlags('areatrigger', TYPE_AREATRIGGER);
$this->reapplyCCFlags('areatrigger', Type::AREATRIGGER);
return true;
}

Some files were not shown because too many files have changed in this diff Show More