mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Profiler/Completion
* fix partial loading of quests in profiler * provide inital category totals on a per class & race basis
This commit is contained in:
@@ -59,14 +59,13 @@ class AjaxData extends AjaxHandler
|
||||
$result .= $this->loadProfilerData($set, '777');
|
||||
break;
|
||||
case 'quests':
|
||||
// &partial: im not doing this right
|
||||
// it expects a full quest dump on first lookup but will query subCats again if clicked..?
|
||||
// for now omiting the detail clicks with empty results and just set catg update
|
||||
$catg = isset($this->_get['catg']) ? $this->_get['catg'] : 'null';
|
||||
if ($catg == 'null')
|
||||
$result .= $this->loadProfilerData($set);
|
||||
else if ($this->_get['callback'])
|
||||
$result .= "\n\$WowheadProfiler.loadOnDemand('quests', ".$catg.");\n";
|
||||
Util::loadStaticFile('p-'.$set, $result, false);
|
||||
else
|
||||
Util::loadStaticFile('p-'.$set.'-'.$catg, $result, true);
|
||||
|
||||
$result .= "\n\$WowheadProfiler.loadOnDemand('".$set."', ".$catg.");\n";
|
||||
|
||||
break;
|
||||
case 'recipes':
|
||||
|
||||
@@ -613,10 +613,12 @@ class AjaxProfile extends AjaxHandler
|
||||
$profile['titles'] = $data;
|
||||
break;
|
||||
case Type::QUEST:
|
||||
foreach ($data as &$d)
|
||||
$d = 1;
|
||||
$qList = new QuestList(array(['id', array_keys($data)], CFG_SQL_LIMIT_NONE));
|
||||
$qResult = [];
|
||||
foreach ($qList->iterate() as $id => $__)
|
||||
$qResult[$id] = [$qList->getField('cat1'), $qList->getField('cat2')];
|
||||
|
||||
$profile['quests'] = $data;
|
||||
$profile['quests'] = $qResult;
|
||||
break;
|
||||
case Type::SPELL:
|
||||
foreach ($data as &$d)
|
||||
@@ -651,7 +653,7 @@ class AjaxProfile extends AjaxHandler
|
||||
}
|
||||
}
|
||||
|
||||
$buff = '';
|
||||
$gItems = [];
|
||||
|
||||
$usedSlots = [];
|
||||
if ($this->_get['items'])
|
||||
@@ -668,7 +670,12 @@ class AjaxProfile extends AjaxHandler
|
||||
if (in_array($sl, $invTypes) && !in_array($slot, $usedSlots))
|
||||
{
|
||||
// get and apply inventory
|
||||
$buff .= 'g_items.add('.$iId.', {name_'.User::$localeString.":'".Util::jsEscape($phItems->getField('name', true))."', quality:".$phItems->getField('quality').", icon:'".$phItems->getField('iconString')."', jsonequip:".Util::toJSON($data[$iId])."});\n";
|
||||
$gItems[$iId] = array(
|
||||
'name_'.User::$localeString => $phItems->getField('name', true),
|
||||
'quality' => $phItems->getField('quality'),
|
||||
'icon' => $phItems->getField('iconString'),
|
||||
'jsonequip' => $data[$iId]
|
||||
);
|
||||
$profile['inventory'][$slot] = [$iId, 0, 0, 0, 0, 0, 0, 0];
|
||||
|
||||
$usedSlots[] = $slot;
|
||||
@@ -684,22 +691,28 @@ class AjaxProfile extends AjaxHandler
|
||||
$itemz = new ItemList(array(['id', array_column($items, 'item')], CFG_SQL_LIMIT_NONE));
|
||||
if (!$itemz->error)
|
||||
{
|
||||
$data = $itemz->getListviewData(ITEMINFO_JSON | ITEMINFO_SUBITEMS);
|
||||
$data = $itemz->getListviewData(ITEMINFO_JSON | ITEMINFO_SUBITEMS);
|
||||
|
||||
foreach ($items as $i)
|
||||
{
|
||||
if ($itemz->getEntry($i['item']) && !in_array($i['slot'], $usedSlots))
|
||||
{
|
||||
// get and apply inventory
|
||||
$buff .= 'g_items.add('.$i['item'].', {name_'.User::$localeString.":'".Util::jsEscape($itemz->getField('name', true))."', quality:".$itemz->getField('quality').", icon:'".$itemz->getField('iconString')."', jsonequip:".Util::toJSON($data[$i['item']])."});\n";
|
||||
$gItems[$i['item']] = array(
|
||||
'name_'.User::$localeString => $itemz->getField('name', true),
|
||||
'quality' => $itemz->getField('quality'),
|
||||
'icon' => $itemz->getField('iconString'),
|
||||
'jsonequip' => $data[$i['item']]
|
||||
);
|
||||
$profile['inventory'][$i['slot']] = [$i['item'], $i['subItem'], $i['permEnchant'], $i['tempEnchant'], $i['gem1'], $i['gem2'], $i['gem3'], $i['gem4']];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($buff)
|
||||
$buff .= "\n";
|
||||
$buff = '';
|
||||
foreach ($gItems as $id => $item)
|
||||
$buff .= 'g_items.add('.$id.', '.Util::toJSON($item, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE).");\n";
|
||||
|
||||
|
||||
// if ($au = $char->getField('auras'))
|
||||
|
||||
@@ -727,6 +727,8 @@ class Profiler
|
||||
$data['guildRank'] = $guild['rank'];
|
||||
}
|
||||
|
||||
CLI::write(' ..basic guild data');
|
||||
|
||||
|
||||
// arena teams
|
||||
$teams = DB::Characters($realmId)->select('SELECT at.arenaTeamId AS ARRAY_KEY, at.name, at.type, IF(at.captainGuid = atm.guid, 1, 0) AS captain, atm.* FROM arena_team at JOIN arena_team_member atm ON atm.arenaTeamId = at.arenaTeamId WHERE atm.guid = ?d', $char['guid']);
|
||||
|
||||
@@ -652,6 +652,24 @@ class User
|
||||
return self::$profiles->getJSGlobals(PROFILEINFO_PROFILE);
|
||||
}
|
||||
|
||||
public static function getPinnedCharacter() : array
|
||||
{
|
||||
if (!self::$profiles)
|
||||
return [];
|
||||
|
||||
$realms = Profiler::getRealms();
|
||||
|
||||
foreach (self::$profiles->iterate() as $id => $_)
|
||||
if (self::$profiles->getField('cuFlags') & PROFILER_CU_PINNED)
|
||||
return [
|
||||
$id,
|
||||
self::$profiles->getField('name'),
|
||||
self::$profiles->getField('region') . '.' . Profiler::urlize($realms[self::$profiles->getField('realm')]['name'], true) . '.' . Profiler::urlize(self::$profiles->getField('name'), true, true)
|
||||
];
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function getGuides()
|
||||
{
|
||||
$result = [];
|
||||
|
||||
Reference in New Issue
Block a user