mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Pages/Achievements
* display additional crosslinkable conditions from achievement_criteria_data
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
define('AOWOW_REVISION', 19);
|
||||
define('AOWOW_REVISION', 20);
|
||||
define('CLI', PHP_SAPI === 'cli');
|
||||
|
||||
|
||||
|
||||
@@ -250,6 +250,12 @@ class AchievementPage extends GenericPage
|
||||
|
||||
$iconId = 1;
|
||||
$rightCol = [];
|
||||
$scripts = [];
|
||||
|
||||
// serverside extra-Data
|
||||
$crtIds = array_column($this->subject->getCriteria(), 'id');
|
||||
Util::checkNumeric($crtIds);
|
||||
$crtExtraData = DB::World()->select('SELECT criteria_id AS ARRAY_KEY, type AS ARRAY_KEY2, value1, value2, ScriptName FROM achievement_criteria_data WHERE criteria_id IN (?a)', $crtIds);
|
||||
|
||||
foreach ($this->subject->getCriteria() as $i => $crt)
|
||||
{
|
||||
@@ -419,6 +425,72 @@ class AchievementPage extends GenericPage
|
||||
$tmp['extraText'] = $displayMoney ? Util::formatMoney($qty) : $crtName;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($crtExtraData[$crt['id']]))
|
||||
{
|
||||
$tmp['extraData'] = [];
|
||||
foreach ($crtExtraData[$crt['id']] as $xType => $xData)
|
||||
{
|
||||
// just pick stuff, that can actually be linked
|
||||
switch ($xType)
|
||||
{
|
||||
case 1: // TYPE_T_CREATURE
|
||||
$tmp['extraData'][] = ['?npc='.$xData['value1'], CreatureList::getName($xData['value1'])];
|
||||
break;
|
||||
case 2: // TYPE_T_PLAYER_CLASS_RACE
|
||||
case 21: // TYPE_S_PLAYER_CLASS_RACE
|
||||
if ($xData['value1'])
|
||||
$tmp['extraData'][] = ['?class='.$xData['value1'], (new CharClassList(array(['id', $xData['value1']])))->getField('name', true)];
|
||||
|
||||
if ($xData['value2'])
|
||||
$tmp['extraData'][] = ['?race='.$xData['value2'], (new CharRaceList(array(['id', $xData['value2']])))->getField('name', true)];
|
||||
|
||||
break;
|
||||
// case 3: // TYPE_T_PLAYER_LESS_HEALTH
|
||||
// case 4: // TYPE_T_PLAYER_DEAD
|
||||
case 5: // TYPE_S_AURA
|
||||
case 7: // TYPE_T_AURA
|
||||
$tmp['extraData'][] = ['?spell='.$xData['value1'], SpellList::getName($xData['value1'])];
|
||||
break;
|
||||
case 6: // TYPE_S_AREA
|
||||
$tmp['extraData'][] = ['?zone='.$xData['value1'], ZoneList::getName($xData['value1'])];
|
||||
break;
|
||||
// case 8: // TYPE_VALUE
|
||||
// case 9: // TYPE_T_LEVEL
|
||||
// case 10: // TYPE_T_GENDER
|
||||
case 11: // TYPE_SCRIPT
|
||||
if ($xData['ScriptName'])
|
||||
$scripts[] = $xData['ScriptName'];
|
||||
|
||||
break;
|
||||
// case 12: // TYPE_MAP_DIFFICULTY
|
||||
// case 13: // TYPE_MAP_PLAYER_COUNT
|
||||
// case 14: // TYPE_T_TEAM
|
||||
// case 15: // TYPE_S_DRUNK
|
||||
case 16: // TYPE_HOLIDAY
|
||||
if ($we = new WorldEventList(array(['holidayId', $xData['value1']])))
|
||||
$tmp['extraData'][] = ['?event='.$we->id, $we->getField('name', true)];
|
||||
|
||||
break;
|
||||
// case 17: // TYPE_BG_LOSS_TEAM_SCORE
|
||||
// case 18: // TYPE_INSTANCE_SCRIPT
|
||||
// case 19: // TYPE_S_EQUIPED_ITEM
|
||||
case 20: // TYPE_MAP_ID
|
||||
if ($z = new ZoneList(array(['mapIdBak', $xData['value1']])))
|
||||
$tmp['extraData'][] = ['?zone='.$z->id, $z->getField('name', true)];
|
||||
|
||||
break;
|
||||
// case 22: // TYPE_NTH_BIRTHDAY
|
||||
case 23: // TYPE_S_KNOWN_TITLE
|
||||
$tmp['extraData'][] = ['?title='.$xData['value1'], trim(str_replace('%s', '', (new TitleList(array(['id', $xData['value1']])))->getField('male', true)))];
|
||||
break;
|
||||
}
|
||||
|
||||
// moar stuffz
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// If the right column
|
||||
if ($i % 2)
|
||||
$this->criteria['data'][] = $tmp;
|
||||
@@ -429,6 +501,13 @@ class AchievementPage extends GenericPage
|
||||
// If you found the second column - merge data from it to the end of the main body
|
||||
if ($rightCol)
|
||||
$this->criteria['data'] = array_merge($this->criteria['data'], $rightCol);
|
||||
|
||||
// criteria have scripts
|
||||
if (User::isInGroup(U_GROUP_EMPLOYEE) && $scripts)
|
||||
{
|
||||
$s = '[li]Script'.Lang::main('colon').'[ul][li]'.implode('[/li][li]', array_unique($scripts)).'[/li][/ul][/li]';
|
||||
$this->infobox = substr_replace($this->infobox, $s, -5, 0);
|
||||
}
|
||||
}
|
||||
|
||||
protected function generateTooltip($asError = false)
|
||||
|
||||
@@ -621,10 +621,10 @@ class NpcPage extends GenericPage
|
||||
);
|
||||
|
||||
if (!empty($sf['note']))
|
||||
$lootTab['note'] = $sf['note'];
|
||||
$tabData['note'] = $sf['note'];
|
||||
|
||||
if ($sf[4])
|
||||
$lootTab['hiddenCols'] = $sf[4];
|
||||
$tabData['hiddenCols'] = $sf[4];
|
||||
|
||||
$this->lvTabs[] = ['item', $tabData];
|
||||
}
|
||||
|
||||
@@ -51,7 +51,18 @@ foreach ($this->criteria['data'] as $i => $cr):
|
||||
echo ' '.$cr['extraText'];
|
||||
endif;
|
||||
|
||||
echo '</span></td></tr>';
|
||||
echo '</span>';
|
||||
|
||||
if (!empty($cr['extraData'])):
|
||||
$buff = [];
|
||||
foreach ($cr['extraData'] as $xd):
|
||||
$buff[] = $xd[0] ? '<a href="'.$xd[0].'">'.$xd[1].'</a>' : '<span>'.$xd[1].'</span>';
|
||||
endforeach;
|
||||
|
||||
echo '<br /><sup style="margin-left:8px;">('.implode(', ', $buff).')</sup>';
|
||||
endif;
|
||||
|
||||
echo '</td></tr>';
|
||||
|
||||
// every odd number of elements
|
||||
if ($i + 1 == round(count($this->criteria['data']) / 2)):
|
||||
|
||||
Reference in New Issue
Block a user