diff --git a/includes/types/emote.class.php b/includes/types/emote.class.php index 579b71c3..09d52503 100644 --- a/includes/types/emote.class.php +++ b/includes/types/emote.class.php @@ -6,8 +6,6 @@ if (!defined('AOWOW_REVISION')) class EmoteList extends BaseType { - use ListviewHelper; - public static $type = TYPE_EMOTE; public static $brickFile = 'emote'; diff --git a/includes/utilities.php b/includes/utilities.php index 9e79a2d7..4183a0e4 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -39,13 +39,16 @@ class Util public static $typeClasses = array( null, 'CreatureList', 'GameObjectList', 'ItemList', 'ItemsetList', 'QuestList', 'SpellList', 'ZoneList', 'FactionList', 'PetList', 'AchievementList', 'TitleList', 'WorldEventList', 'CharClassList', - 'CharRaceList', 'SkillList', null, 'CurrencyList' + 'CharRaceList', 'SkillList', null, 'CurrencyList', + TYPE_EMOTE => 'EmoteList' ); public static $typeStrings = array( // zero-indexed null, 'npc', 'object', 'item', 'itemset', 'quest', 'spell', 'zone', 'faction', '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 diff --git a/pages/emote.php b/pages/emote.php index f6524beb..f66889b9 100644 --- a/pages/emote.php +++ b/pages/emote.php @@ -4,8 +4,8 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -// menuId 8: Pets g_initPath() -// tabid 0: Database g_initHeader() +// menuId 100: Emotes g_initPath() +// tabid 0: Database g_initHeader() class EmotePage extends GenericPage { use DetailPage; @@ -43,7 +43,7 @@ class EmotePage extends GenericPage /* Infobox */ /***********/ - $infobox = []; + $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // has Animation if ($this->subject->getField('isAnimated')) diff --git a/pages/emotes.php b/pages/emotes.php index d7e76d7f..84c897af 100644 --- a/pages/emotes.php +++ b/pages/emotes.php @@ -4,8 +4,8 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -// menuId 8: Pets g_initPath() -// tabid 0: Database g_initHeader() +// menuId 100: Emotes g_initPath() +// tabid 0: Database g_initHeader() class EmotesPage extends GenericPage { use ListPage; diff --git a/pages/item.php b/pages/item.php index 744d7091..a4e4f242 100644 --- a/pages/item.php +++ b/pages/item.php @@ -328,8 +328,35 @@ class ItemPage extends genericPage $_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->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null; + $this->pageText = $pageText; $this->tooltip = $this->subject->renderTooltip(true); $this->redButtons = array( BUTTON_WOWHEAD => true, @@ -343,31 +370,6 @@ class ItemPage extends genericPage // availablility $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 $this->subject->initSubItems(); if (!empty($this->subject->subItems[$this->typeId])) diff --git a/pages/utility.php b/pages/utility.php index 5f12ef43..b01bf6b5 100644 --- a/pages/utility.php +++ b/pages/utility.php @@ -65,7 +65,7 @@ class UtilityPage extends GenericPage switch ($this->page) { 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(); header('Location: ?'.Util::$typeStrings[$type].'='.$typeId, true, 302); diff --git a/setup/db_structure.sql b/setup/db_structure.sql index 56f712bc..baab5ded 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -529,6 +529,7 @@ CREATE TABLE `aowow_emotes` ( `id` smallint(5) unsigned NOT NULL, `cmd` varchar(15) NOT NULL, `isAnimated` tinyint(1) unsigned NOT NULL, + `cuFlags` int(10) unsigned NOT NULL, `target_loc0` varchar(65) NULL DEFAULT NULL, `target_loc2` varchar(70) NULL DEFAULT NULL, `target_loc3` varchar(95) NULL DEFAULT NULL,