mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Achievements/Rewards
* fix createing bogus ItemLists or TitleLists when displaying achievement rewards * don't display empty related-achievements tab on Emotes DetailPage
This commit is contained in:
@@ -178,32 +178,27 @@ class AchievementPage extends GenericPage
|
||||
// create rewards
|
||||
if ($foo = $this->subject->getField('rewards'))
|
||||
{
|
||||
array_walk($foo, function(&$item) {
|
||||
$item = $item[0] != Type::ITEM ? null : $item[1];
|
||||
});
|
||||
|
||||
$bar = new ItemList(array(['i.id', $foo]));
|
||||
foreach ($bar->iterate() as $id => $__)
|
||||
if ($itemRewards = array_filter($foo, function($x) { return $x[0] == Type::ITEM; }))
|
||||
{
|
||||
$this->rewards['item'][] = array(
|
||||
'name' => $bar->getField('name', true),
|
||||
'quality' => $bar->getField('quality'),
|
||||
'typeStr' => Type::getFileString(Type::ITEM),
|
||||
'id' => $id,
|
||||
'globalStr' => Type::getJSGlobalString(Type::ITEM)
|
||||
);
|
||||
$bar = new ItemList(array(['i.id', array_column($itemRewards, 1)]));
|
||||
foreach ($bar->iterate() as $id => $__)
|
||||
{
|
||||
$this->rewards['item'][] = array(
|
||||
'name' => $bar->getField('name', true),
|
||||
'quality' => $bar->getField('quality'),
|
||||
'typeStr' => Type::getFileString(Type::ITEM),
|
||||
'id' => $id,
|
||||
'globalStr' => Type::getJSGlobalString(Type::ITEM)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($foo = $this->subject->getField('rewards'))
|
||||
{
|
||||
array_walk($foo, function(&$item) {
|
||||
$item = $item[0] != Type::TITLE ? null : $item[1];
|
||||
});
|
||||
|
||||
$bar = new TitleList(array(['id', $foo]));
|
||||
foreach ($bar->iterate() as $__)
|
||||
$this->rewards['title'][] = sprintf(Lang::achievement('titleReward'), $bar->id, trim(str_replace('%s', '', $bar->getField('male', true))));
|
||||
if ($titleRewards = array_filter($foo, function($x) { return $x[0] == Type::TITLE; }))
|
||||
{
|
||||
$bar = new TitleList(array(['id', array_column($titleRewards, 1)]));
|
||||
foreach ($bar->iterate() as $__)
|
||||
$this->rewards['title'][] = sprintf(Lang::achievement('titleReward'), $bar->id, trim(str_replace('%s', '', $bar->getField('male', true))));
|
||||
}
|
||||
}
|
||||
|
||||
$this->rewards['text'] = $this->subject->getField('reward', true);
|
||||
|
||||
@@ -153,10 +153,12 @@ class EmotePage extends GenericPage
|
||||
['ac.value1', $this->typeId],
|
||||
);
|
||||
$acv = new AchievementList($condition);
|
||||
if (!$acv->error)
|
||||
{
|
||||
$this->lvTabs[] = [AchievementList::$brickFile, ['data' => array_values($acv->getListviewData())]];
|
||||
|
||||
$this->lvTabs[] = [AchievementList::$brickFile, ['data' => array_values($acv->getListviewData())]];
|
||||
|
||||
$this->extendGlobalData($acv->getJsGlobals());
|
||||
$this->extendGlobalData($acv->getJsGlobals());
|
||||
}
|
||||
|
||||
// tab: sound
|
||||
if ($em = DB::Aowow()->select('SELECT soundId AS ARRAY_KEY, BIT_OR(1 << (raceId - 1)) AS raceMask, BIT_OR(1 << (gender - 1)) AS gender FROM ?_emotes_sounds WHERE -emoteId = ?d GROUP BY soundId', $this->typeId > 0 ? $this->subject->getField('parentEmote') : $this->typeId))
|
||||
|
||||
Reference in New Issue
Block a user