Misc/Fixups

* made emotes random-searchable
 * fixed error with pageTexts on Item Detail Page
This commit is contained in:
Sarjuuk
2015-07-21 11:49:35 +02:00
parent 4ab558858f
commit 8fa83eab64
7 changed files with 39 additions and 35 deletions

View File

@@ -6,8 +6,6 @@ if (!defined('AOWOW_REVISION'))
class EmoteList extends BaseType class EmoteList extends BaseType
{ {
use ListviewHelper;
public static $type = TYPE_EMOTE; public static $type = TYPE_EMOTE;
public static $brickFile = 'emote'; public static $brickFile = 'emote';

View File

@@ -39,13 +39,16 @@ class Util
public static $typeClasses = array( public static $typeClasses = array(
null, 'CreatureList', 'GameObjectList', 'ItemList', 'ItemsetList', 'QuestList', 'SpellList', null, 'CreatureList', 'GameObjectList', 'ItemList', 'ItemsetList', 'QuestList', 'SpellList',
'ZoneList', 'FactionList', 'PetList', 'AchievementList', 'TitleList', 'WorldEventList', 'CharClassList', 'ZoneList', 'FactionList', 'PetList', 'AchievementList', 'TitleList', 'WorldEventList', 'CharClassList',
'CharRaceList', 'SkillList', null, 'CurrencyList' 'CharRaceList', 'SkillList', null, 'CurrencyList',
TYPE_EMOTE => 'EmoteList'
); );
public static $typeStrings = array( // zero-indexed public static $typeStrings = array( // zero-indexed
null, 'npc', 'object', 'item', 'itemset', 'quest', 'spell', 'zone', 'faction', null, 'npc', 'object', 'item', 'itemset', 'quest', 'spell', 'zone', 'faction',
'pet', 'achievement', 'title', 'event', 'class', 'race', 'skill', null, 'currency', 'pet', 'achievement', 'title', 'event', 'class', 'race', 'skill', null, 'currency',
TYPE_USER => 'user' TYPE_USER => 'user',
TYPE_EMOTE => 'emote'
); );
public static $combatRatingToItemMod = array( // zero-indexed idx:CR; val:Mod public static $combatRatingToItemMod = array( // zero-indexed idx:CR; val:Mod

View File

@@ -4,8 +4,8 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
// menuId 8: Pets g_initPath() // menuId 100: Emotes g_initPath()
// tabid 0: Database g_initHeader() // tabid 0: Database g_initHeader()
class EmotePage extends GenericPage class EmotePage extends GenericPage
{ {
use DetailPage; use DetailPage;
@@ -43,7 +43,7 @@ class EmotePage extends GenericPage
/* Infobox */ /* Infobox */
/***********/ /***********/
$infobox = []; $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// has Animation // has Animation
if ($this->subject->getField('isAnimated')) if ($this->subject->getField('isAnimated'))

View File

@@ -4,8 +4,8 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
// menuId 8: Pets g_initPath() // menuId 100: Emotes g_initPath()
// tabid 0: Database g_initHeader() // tabid 0: Database g_initHeader()
class EmotesPage extends GenericPage class EmotesPage extends GenericPage
{ {
use ListPage; use ListPage;

View File

@@ -328,8 +328,35 @@ class ItemPage extends genericPage
$_cu = in_array($_class, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]) || $this->subject->getField('gemEnchantmentId'); $_cu = in_array($_class, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]) || $this->subject->getField('gemEnchantmentId');
// pageText
$pageText = [];
if ($next = $this->subject->getField('pageTextId'))
{
while ($next)
{
if ($row = DB::World()->selectRow('SELECT *, Text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.ID = lpt.entry WHERE pt.ID = ?d', $next))
{
$next = $row['NextPageID'];
$pageText = Util::parseHtmlText(Util::localizedString($row, 'Text'));
}
else
{
trigger_error('Referenced PageTextId #'.$next.' is not in DB', E_USER_WARNING);
break;
}
}
}
// add conditional js & css
if ($pageText)
{
$this->addJS('Book.js');
$this->addCSS(['path' => 'Book.css']);
}
$this->headIcons = [$this->subject->getField('iconString'), $this->subject->getField('stackable')]; $this->headIcons = [$this->subject->getField('iconString'), $this->subject->getField('stackable')];
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null; $this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$this->pageText = $pageText;
$this->tooltip = $this->subject->renderTooltip(true); $this->tooltip = $this->subject->renderTooltip(true);
$this->redButtons = array( $this->redButtons = array(
BUTTON_WOWHEAD => true, BUTTON_WOWHEAD => true,
@@ -343,31 +370,6 @@ class ItemPage extends genericPage
// availablility // availablility
$this->disabled = false; // todo (med): get itemSources (which are not yet in DB :x) or $this->disabled = false; // todo (med): get itemSources (which are not yet in DB :x) or
// pageText
if ($next = $this->subject->getField('pageTextId'))
{
while ($next)
{
if ($row = DB::World()->selectRow('SELECT *, Text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.ID = lpt.entry WHERE pt.ID = ?d', $next))
{
$next = $row['NextPageID'];
$this->pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
}
else
{
trigger_error('Referenced PageTextId #'.$next.' is not in DB', E_USER_WARNING);
break;
}
}
}
// add conditional js & css
if ($this->pageText)
{
$this->addJS('Book.js');
$this->addCSS(['path' => 'Book.css']);
}
// subItems // subItems
$this->subject->initSubItems(); $this->subject->initSubItems();
if (!empty($this->subject->subItems[$this->typeId])) if (!empty($this->subject->subItems[$this->typeId]))

View File

@@ -65,7 +65,7 @@ class UtilityPage extends GenericPage
switch ($this->page) switch ($this->page)
{ {
case 'random': case 'random':
$type = array_rand(array_keys(array_filter(Util::$typeClasses))); $type = array_rand(array_filter(Util::$typeClasses));
$typeId = (new Util::$typeClasses[$type](null))->getRandomId(); $typeId = (new Util::$typeClasses[$type](null))->getRandomId();
header('Location: ?'.Util::$typeStrings[$type].'='.$typeId, true, 302); header('Location: ?'.Util::$typeStrings[$type].'='.$typeId, true, 302);

View File

@@ -529,6 +529,7 @@ CREATE TABLE `aowow_emotes` (
`id` smallint(5) unsigned NOT NULL, `id` smallint(5) unsigned NOT NULL,
`cmd` varchar(15) NOT NULL, `cmd` varchar(15) NOT NULL,
`isAnimated` tinyint(1) unsigned NOT NULL, `isAnimated` tinyint(1) unsigned NOT NULL,
`cuFlags` int(10) unsigned NOT NULL,
`target_loc0` varchar(65) NULL DEFAULT NULL, `target_loc0` varchar(65) NULL DEFAULT NULL,
`target_loc2` varchar(70) NULL DEFAULT NULL, `target_loc2` varchar(70) NULL DEFAULT NULL,
`target_loc3` varchar(95) NULL DEFAULT NULL, `target_loc3` varchar(95) NULL DEFAULT NULL,