diff --git a/README.md b/README.md index 009beae1..198bc179 100644 Binary files a/README.md and b/README.md differ diff --git a/includes/defines.php b/includes/defines.php index 84d6a481..fd330894 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -24,7 +24,9 @@ define('TYPE_CLASS', 13); define('TYPE_RACE', 14); define('TYPE_SKILL', 15); define('TYPE_CURRENCY', 17); -define('TYPE_USER', 100); // internal use only +// internal types (not published to js) +define('TYPE_USER', 500); +define('TYPE_EMOTE', 501); define('CACHE_TYPE_NONE', 0); // page will not be cached define('CACHE_TYPE_PAGE', 1); @@ -711,7 +713,7 @@ define('ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION', 46); // define('ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT', 51); define('ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS', 52); define('ACHIEVEMENT_CRITERIA_TYPE_HK_RACE', 53); -// define('ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE', 54); +define('ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE', 54); // define('ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE', 55); // define('ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS', 56); define('ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM', 57); diff --git a/includes/shared.php b/includes/shared.php index b134a807..9b5ce531 100644 --- a/includes/shared.php +++ b/includes/shared.php @@ -1,6 +1,6 @@ iterate() as $__) + { + $data[$this->id] = array( + 'id' => $this->curTpl['id'], + 'name' => $this->curTpl['cmd'], + 'preview' => $this->getField('self', true) ?: ($this->getField('noTarget', true) ?: $this->getField('target', true)) + ); + + // [nyi] sounds + } + + return $data; + } + + public function getJSGlobals($addMask = GLOBALINFO_ANY) + { + return []; + } + + public function renderTooltip() { } +} + +?> diff --git a/index.php b/index.php index 9cc47359..725b8d3c 100644 --- a/index.php +++ b/index.php @@ -29,6 +29,8 @@ switch ($pageCall) case 'currency': case 'currencies': case 'compare': // tool: item comparison + case 'emote': + case 'emotes': case 'event': case 'events': case 'faction': diff --git a/localization/lang.class.php b/localization/lang.class.php index b5c92723..beafdb37 100644 --- a/localization/lang.class.php +++ b/localization/lang.class.php @@ -29,6 +29,8 @@ class Lang private static $title; private static $zone; + private static $emote; + public static function load($loc) { if (!file_exists('localization/locale_'.$loc.'.php')) diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 0e89a619..1fc14ec3 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -173,6 +173,8 @@ $lang = array( 'difficulty' => "Modus", 'dispelType' => "Bannart", 'duration' => "Dauer", + 'emote' => "Emote", + 'emotes' => "Emotes", 'object' => "Objekt", 'objects' => "Objekte", 'glyphType' => "Glyphenart", @@ -378,8 +380,17 @@ $lang = array( 'recoverUser' => ["Benutzernamenanfrage", "Folgt diesem Link um euch anzumelden.\r\n\r\n".HOST_URL."?account=signin&token=%s\r\n\r\nFalls Ihr diese Mail nicht angefordert habt kann sie einfach ignoriert werden."], 'resetPass' => ["Kennwortreset", "Folgt diesem Link um euer Kennwort zurückzusetzen.\r\n\r\n".HOST_URL."?account=forgotpassword&token=%s\r\n\r\nFalls Ihr diese Mail nicht angefordert habt kann sie einfach ignoriert werden."] ), + 'emote' => array( + 'notFound' => "Dieses Emote existiert nicht.", + 'self' => "An Euch selbst", + 'target' => "An Andere mit Ziel", + 'noTarget' => "An Andere ohne Ziel", + 'isAnimated' => "Besitzt eine Animation", + 'aliases' => "Aliasse", + 'noText' => "Dieses Emote besitzt keinen Text.", + ), 'gameObject' => array( - 'notFound' => "Dieses Objekt existiert nicht .", + 'notFound' => "Dieses Objekt existiert nicht.", 'cat' => [0 => "Anderes", 9 => "Bücher", 3 => "Behälter", -5 => "Truhen", 25 => "Fischschwärme", -3 => "Kräuter", -4 => "Erzadern", -2 => "Quest", -6 => "Werkzeuge"], 'type' => [ 9 => "Buch", 3 => "Behälter", -5 => "Truhe", 25 => "", -3 => "Kraut", -4 => "Erzvorkommen", -2 => "Quest", -6 => ""], 'unkPosition' => "Der Standort dieses Objekts ist nicht bekannt.", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 3e115810..30aa4e3e 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -168,6 +168,8 @@ $lang = array( 'difficulty' => "Difficulty", 'dispelType' => "Dispel type", 'duration' => "Duration", + 'emote' => "Emote", + 'emotes' => "Emotes", 'object' => "object", 'objects' => "Objects", 'glyphType' => "Glyph type", @@ -373,6 +375,15 @@ $lang = array( 'recoverUser' => ["User Recovery", "Follow this link to log in.\r\n\r\n".HOST_URL."?account=signin&token=%s\r\n\r\nIf you did not request this mail simply ignore it."], 'resetPass' => ["Password Reset", "Follow this link to reset your password.\r\n\r\n".HOST_URL."?account=forgotpassword&token=%s\r\n\r\nIf you did not request this mail simply ignore it."] ), + 'emote' => array( + 'notFound' => "This Emote doesn't exist.", + 'self' => "To Yourself", + 'target' => "To others with a target", + 'noTarget' => "To others without a target", + 'isAnimated' => "Uses an animation", + 'aliases' => "Aliases", + 'noText' => "This Emote has no text.", + ), 'gameObject' => array( 'notFound' => "This object doesn't exist.", 'cat' => [0 => "Other", 9 => "Books", 3 => "Containers", -5 => "Chests", 25 => "Fishing Pools", -3 => "Herbs", -4 => "Mineral Veins", -2 => "Quest", -6 => "Tools"], diff --git a/localization/locale_eses.php b/localization/locale_eses.php index e158657a..a54e5f11 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -173,6 +173,8 @@ $lang = array( 'difficulty' => "Dificultad", 'dispelType' => "Tipo de disipación", 'duration' => "Duración", + 'emote' => "Emoción", + 'emotes' => "Emociones", 'object' => "entidad", 'objects' => "Entidades", 'glyphType' => "Tipo de glifo", @@ -379,6 +381,15 @@ $lang = array( 'recoverUser' => ["User Recovery", "Follow this link to log in.\r\n\r\n".HOST_URL."?account=signin&token=%s\r\n\r\nIf you did not request this mail simply ignore it."], 'resetPass' => ["Password Reset", "Follow this link to reset your password.\r\n\r\n".HOST_URL."?account=forgotpassword&token=%s\r\n\r\nIf you did not request this mail simply ignore it."] ), + 'emote' => array( + 'notFound' => "[This Emote doesn't exist.]", + 'self' => "[To Yourself]", + 'target' => "[To others with a target]", + 'noTarget' => "[To others without a target]", + 'isAnimated' => "[Uses an animation]", + 'aliases' => "[Aliases]", + 'noText' => "[This Emote has no text.]", + ), 'gameObject' => array( 'notFound' => "Este entidad no existe.", 'cat' => [0 => "Otros", 9 => "Libros", 3 => "Contenedores", -5 => "Cofres", 25 => "Bancos de peces", -3 => "Hierbas", -4 => "Venas de minerales", -2 => "Misiones", -6 => "Herramientas"], diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index 3ef26007..b9594603 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -173,6 +173,8 @@ $lang = array( 'difficulty' => "Difficulté", 'dispelType' => "Type de dissipation", 'duration' => "Durée", + 'emote' => "Emote", + 'emotes' => "Emotes", 'object' => "entité", 'objects' => "Entités", 'glyphType' => "Type de glyphe", @@ -378,6 +380,15 @@ $lang = array( 'recoverUser' => ["User Recovery", "Follow this link to log in.\r\n\r\n".HOST_URL."?account=signin&token=%s\r\n\r\nIf you did not request this mail simply ignore it."], 'resetPass' => ["Password Reset", "Follow this link to reset your password.\r\n\r\n".HOST_URL."?account=forgotpassword&token=%s\r\n\r\nIf you did not request this mail simply ignore it."] ), + 'emote' => array( + 'notFound' => "[This Emote doesn't exist.]", + 'self' => "[To Yourself]", + 'target' => "[To others with a target]", + 'noTarget' => "[To others without a target]", + 'isAnimated' => "[Uses an animation]", + 'aliases' => "[Aliases]", + 'noText' => "[This Emote has no text.]", + ), 'gameObject' => array( 'notFound' => "Cette entité n'existe pas.", 'cat' => [0 => "Autre", 9 => "Livres", 3 => "Conteneurs", -5 => "Coffres", 25 => "Bancs de poissons", -3 => "Herbes", -4 => "Filons de minerai", -2 => "Quêtes", -6 => "Outils"], diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index ced46cfc..7dab6a89 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -173,6 +173,8 @@ $lang = array( 'difficulty' => "Сложность", 'dispelType' => "Тип рассеивания", 'duration' => "Длительность", + 'emote' => "Эмоция", + 'emotes' => "Эмоции", 'object' => "объект", 'objects' => "Объекты", 'glyphType' => "Тип символа", @@ -378,6 +380,15 @@ $lang = array( 'recoverUser' => ["User Recovery", "Follow this link to log in.\r\n\r\n".HOST_URL."?account=signin&token=%s\r\n\r\nIf you did not request this mail simply ignore it."], 'resetPass' => ["Password Reset", "Follow this link to reset your password.\r\n\r\n".HOST_URL."?account=forgotpassword&token=%s\r\n\r\nIf you did not request this mail simply ignore it."] ), + 'emote' => array( + 'notFound' => "[This Emote doesn't exist.]", + 'self' => "[To Yourself]", + 'target' => "[To others with a target]", + 'noTarget' => "[To others without a target]", + 'isAnimated' => "[Uses an animation]", + 'aliases' => "[Aliases]", + 'noText' => "[This Emote has no text.]", + ), 'gameObject' => array( 'notFound' => "Такой объект не существует.", 'cat' => [0 => "Другое", 9 => "Книги", 3 => "Контейнеры", -5 => "Сундуки", 25 => "Рыболовные лунки",-3 => "Травы", -4 => "Полезные ископаемые", -2 => "Задания", -6 => "Инструменты"], diff --git a/pages/achievement.php b/pages/achievement.php index 0fc90127..6e5a6d26 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -418,6 +418,13 @@ class AchievementPage extends GenericPage 'text' => $crtName, ); break; + // link to emote + case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: + $tmp['link'] = array( + 'href' => '?emote='.$obj, + 'text' => $crtName, + ); + break; default: // Add a gold coin icon if required $tmp['extraText'] = $displayMoney ? Util::formatMoney($qty) : $crtName; diff --git a/pages/emote.php b/pages/emote.php new file mode 100644 index 00000000..f6524beb --- /dev/null +++ b/pages/emote.php @@ -0,0 +1,106 @@ +typeId = intVal($id); + + $this->subject = new EmoteList(array(['id', $this->typeId])); + if ($this->subject->error) + $this->notFound(Util::ucFirst(Lang::game('emote')), Lang::emote('notFound')); + + $this->name = Util::ucFirst($this->subject->getField('cmd')); + } + + protected function generatePath() { } + + protected function generateTitle() + { + array_unshift($this->title, $this->name, Util::ucFirst(Lang::game('emote'))); + } + + protected function generateContent() + { + /***********/ + /* Infobox */ + /***********/ + + $infobox = []; + + // has Animation + if ($this->subject->getField('isAnimated')) + $infobox[] = Lang::emote('isAnimated'); + + /****************/ + /* Main Content */ + /****************/ + + $text = ''; + if ($aliasses = DB::Aowow()->selectCol('SELECT command FROM ?_emotes_aliasses WHERE id = ?d AND locales & ?d', $this->typeId, 1 << User::$localeId)) + { + $text .= '[h3]'.Lang::emote('aliases').'[/h3][ul]'; + foreach ($aliasses as $a) + $text .= '[li]/'.$a.'[/li]'; + + $text .= '[/ul][br][br]'; + } + + $texts = []; + if ($_ = $this->subject->getField('self', true)) + $texts[Lang::emote('self')] = $_; + + if ($_ = $this->subject->getField('target', true)) + $texts[Lang::emote('target')] = $_; + + if ($_ = $this->subject->getField('noTarget', true)) + $texts[Lang::emote('noTarget')] = $_; + + if (!$texts) + $text .= '[div][i class=q0]'.Lang::emote('noText').'[/i][/div]'; + else + foreach ($texts as $h => $t) + $text .= '[pad][b]'.$h.'[/b][ul][li][span class=s4]'.preg_replace('/%\d?\$?s/', '<'.Util::ucFirst(Lang::main('name')).'>', $t).'[/span][/li][/ul]'; + + $this->extraText = $text; + $this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]'; + + /**************/ + /* Extra Tabs */ + /**************/ + + // tab: achievement + $condition = array( + ['ac.type', ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE], + ['ac.value1', $this->typeId], + ); + $acv = new AchievementList($condition); + + $this->lvTabs[] = array( + 'file' => 'achievement', + 'data' => $acv->getListviewData(), + 'params' => [] + ); + + $this->extendGlobalData($acv->getJsGlobals()); + } +} + +?> diff --git a/pages/emotes.php b/pages/emotes.php new file mode 100644 index 00000000..d7e76d7f --- /dev/null +++ b/pages/emotes.php @@ -0,0 +1,48 @@ +name = Util::ucFirst(Lang::game('emotes')); + } + + protected function generateContent() + { + $emotes = new EmoteList(); + if (!$emotes->error) + { + + $this->lvTabs[] = array( + 'file' => 'emote', + 'data' => $emotes->getListviewData(), + 'params' => [] + ); + }; + } + + protected function generateTitle() + { + array_unshift($this->title, $this->name); + } + + protected function generatePath() { } +} + +?> diff --git a/pages/search.php b/pages/search.php index 92a28d32..8f3aa2f7 100644 --- a/pages/search.php +++ b/pages/search.php @@ -52,6 +52,7 @@ class SearchPage extends GenericPage ['_searchProficiency'], ['_searchProfession'], ['_searchCompanion'], ['_searchMount'], ['_searchCreature'], ['_searchQuest'], ['_searchAchievement'], ['_searchStatistic'], ['_searchZone'], ['_searchObject'], ['_searchFaction'], ['_searchSkill'], ['_searchPet'], ['_searchCreatureAbility'], ['_searchSpell'], + ['_searchEmote'] ); public function __construct($pageCall, $pageParam) @@ -1409,9 +1410,30 @@ class SearchPage extends GenericPage return $result; } - // private function _searchCharacter($cndBase) { } // 25 Characters $searchMask & 0x2000000 - // private function _searchGuild($cndBase) { } // 26 Guilds $searchMask & 0x4000000 - // private function _searchArenaTeam($cndBase) { } // 27 Arena Teams $searchMask & 0x8000000 + private function _searchEmote($cndBase) // 25 Emotes $searchMask & 0x2000000 + { + $result = []; + $cnd = array_merge($cndBase, [$this->createLookup(['cmd', 'self_loc'.User::$localeId, 'target_loc'.User::$localeId, 'noTarget_loc'.User::$localeId])]); + $emote = new EmoteList($cnd); + + if ($data = $emote->getListviewData()) + { + $result = array( + 'type' => TYPE_EMOTE, + 'appendix' => ' (Emote)', + 'matches' => $emote->getMatches(), + 'file' => EmoteList::$brickFile, + 'data' => $data, + 'params' => [] + ); + } + + return $result; + } + + // private function _searchCharacter($cndBase) { } // 26 Characters $searchMask & 0x4000000 + // private function _searchGuild($cndBase) { } // 27 Guilds $searchMask & 0x8000000 + // private function _searchArenaTeam($cndBase) { } // 28 Arena Teams $searchMask & 0x10000000 } ?> diff --git a/setup/db_structure.sql b/setup/db_structure.sql index abba0c58..56f712bc 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -2,7 +2,7 @@ -- -- Host: localhost Database: sarjuuk_aowow -- ------------------------------------------------------ --- Server version 5.5.30-30.1 +-- Server version 5.5.30-30.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -518,6 +518,52 @@ CREATE TABLE `aowow_currencies` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `aowow_emotes` +-- + +DROP TABLE IF EXISTS `aowow_emotes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `aowow_emotes` ( + `id` smallint(5) unsigned NOT NULL, + `cmd` varchar(15) NOT NULL, + `isAnimated` tinyint(1) unsigned NOT NULL, + `target_loc0` varchar(65) NULL DEFAULT NULL, + `target_loc2` varchar(70) NULL DEFAULT NULL, + `target_loc3` varchar(95) NULL DEFAULT NULL, + `target_loc6` varchar(90) NULL DEFAULT NULL, + `target_loc8` varchar(70) NULL DEFAULT NULL, + `noTarget_loc0` varchar(65) NULL DEFAULT NULL, + `noTarget_loc2` varchar(110) NULL DEFAULT NULL, + `noTarget_loc3` varchar(85) NULL DEFAULT NULL, + `noTarget_loc6` varchar(75) NULL DEFAULT NULL, + `noTarget_loc8` varchar(60) NULL DEFAULT NULL, + `self_loc0` varchar(65) NULL DEFAULT NULL, + `self_loc2` varchar(115) NULL DEFAULT NULL, + `self_loc3` varchar(85) NULL DEFAULT NULL, + `self_loc6` varchar(75) NULL DEFAULT NULL, + `self_loc8` varchar(70) NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `aowow_emotes_aliasses` +-- + +DROP TABLE IF EXISTS `aowow_emotes_aliasses`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `aowow_emotes_aliasses` ( + `id` smallint(6) unsigned NOT NULL, + `locales` smallint(6) unsigned NOT NULL, + `command` varchar(15) NOT NULL, + UNIQUE INDEX `id_command` (`id`, `command`), + INDEX `id` (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `aowow_errors` -- @@ -2234,7 +2280,7 @@ CREATE TABLE `aowow_zones` ( -- -- Host: localhost Database: sarjuuk_aowow -- ------------------------------------------------------ --- Server version 5.5.30-30.1 +-- Server version 5.5.30-30.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/setup/tools/dbc.class.php b/setup/tools/dbc.class.php index ba2274a1..a400f380 100644 --- a/setup/tools/dbc.class.php +++ b/setup/tools/dbc.class.php @@ -58,6 +58,9 @@ class DBC 'dungeonmap' => 'niiffffi', 'durabilitycosts' => 'niiiiiiiiixiiiiiiiiiiixiiiixix', 'durabilityquality' => 'nf', + 'emotes' => 'nxixxxx', + 'emotestext' => 'nsiixxxixixxxxxxxxx', + 'emotestextdata' => 'nsxssxxsxsxxxxxxxx', 'faction' => 'nixxxxxxxxxxxxixxxiffixsxssxxsxsxxxxxxxxxxxxxxxxxxxxxxxxx', 'factiontemplate' => 'nixiiiiiiiiiii', 'gemproperties' => 'nixxi', @@ -137,6 +140,9 @@ class DBC 'dungeonmap' => 'Id,mapId,floor,minY,maxY,minX,maxX,areaId', 'durabilitycosts' => 'Id,w0,w1,w2,w3,w4,w5,w6,w7,w8,w10,w11,w12,w13,w14,w15,w16,w17,w18,w19,w20,a1,a2,a3,a4,a6', 'durabilityquality' => 'Id,mod', + 'emotes' => 'Id,animationId', + 'emotestext' => 'Id,command,emoteId,targetId,noTargetId,selfId', + 'emotestextdata' => 'Id,text_loc0,text_loc2,text_loc3,text_loc6,text_loc8', 'faction' => 'Id,repIdx,repFlags1,parentFaction,spilloverRateIn,spilloverRateOut,spilloverMaxRank,name_loc0,name_loc2,name_loc3,name_loc6,name_loc8', 'factiontemplate' => 'Id,factionId,ourMask,friendlyMask,hostileMask,enemyFactionId1,enemyFactionId2,enemyFactionId3,enemyFactionId4,friendFactionId1,friendFactionId2,friendFactionId3,friendFactionId4', 'gemproperties' => 'Id,enchantmentId,colorMask', diff --git a/setup/tools/sqlGen.class.php b/setup/tools/sqlGen.class.php index 9bc7445e..fe9f9f39 100644 --- a/setup/tools/sqlGen.class.php +++ b/setup/tools/sqlGen.class.php @@ -45,6 +45,7 @@ class SqlGen 'races' => [null, null, null, null], 'shapeshiftforms' => [null, null, null, null], 'skillline' => [null, null, null, null], + 'emotes' => [null, null, null, null], 'achievement' => [null, null, null, ['dbc_achievement']], 'creature' => [null, null, null, ['creature_template', 'locales_creature', 'creature_classlevelstats', 'instance_encounters']], 'currencies' => [null, null, null, ['item_template', 'locales_item']], diff --git a/setup/tools/sqlgen/emotes.func.php b/setup/tools/sqlgen/emotes.func.php new file mode 100644 index 00000000..0c1b6cb2 --- /dev/null +++ b/setup/tools/sqlgen/emotes.func.php @@ -0,0 +1,90 @@ +query('TRUNCATE ?_emotes_aliasses'); + + $path = sprintf($globStrPath, Util::$localeStrings[$lId].'/'); + if (CLISetup::fileExists($path)) + { + $locPath[$lId] = $path; + continue; + } + + // locale not found, try base mpqData + $path = sprintf($globStrPath, ''); + if (CLISetup::fileExists($path)) + { + $locPath[$lId] = $path; + continue; + } + + CLISetup::log('GlobalStrings.lua not found for selected locale '.CLISetup::bold(Util::$localeStrings[$lId]), CLISetup::LOG_WARN); + $allOK = false; + } + + DB::Aowow()->query('REPLACE INTO ?_emotes SELECT + et.Id, + LOWER(et.command), + IF(e.animationId, 1, 0), + etdT.text_loc0, etdT.text_loc2, etdT.text_loc3, etdT.text_loc6, etdT.text_loc8, + etdNT.text_loc0, etdNT.text_loc2, etdNT.text_loc3, etdNT.text_loc6, etdNT.text_loc8, + etdS.text_loc0, etdS.text_loc2, etdS.text_loc3, etdS.text_loc6, etdS.text_loc8 + FROM + dbc_emotestext et + LEFT JOIN + dbc_emotes e ON e.Id = et.emoteId + LEFT JOIN + dbc_emotestextdata etdT ON etdT.Id = et.targetId + LEFT JOIN + dbc_emotestextdata etdNT ON etdNT.Id = et.noTargetId + LEFT JOIN + dbc_emotestextdata etdS ON etdS.Id = et.selfId' + ); + + // i have no idea, how the indexing in this file works. + // sometimes the \d+ after EMOTE is the emoteTextId, but not nearly often enough + $aliasses = []; + foreach ($locPath as $lId => $path) + foreach (file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) + if (preg_match('/^EMOTE(\d+)_CMD\d+\s=\s\"\/([^"]+)\";$/', $line, $m)) + $aliasses[$m[1]][] = [$lId, $m[2]]; + + + $emotes = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, cmd FROM ?_emotes'); + + foreach($emotes as $eId => $cmd) + { + foreach ($aliasses as $gsId => $data) + { + if (in_array($cmd, array_column($data, 1))) + { + foreach ($data as $d) + DB::Aowow()->query('INSERT IGNORE INTO ?_emotes_aliasses VALUES (?d, ?d, ?) ON DUPLICATE KEY UPDATE locales = locales | ?d', $eId, (1 << $d[0]), strtolower($d[1]), (1 << $d[0])); + + break; + } + } + } + + return $allOK; +} + +?> \ No newline at end of file diff --git a/setup/updates/1437430574_01.sql b/setup/updates/1437430574_01.sql new file mode 100644 index 00000000..2d609c46 --- /dev/null +++ b/setup/updates/1437430574_01.sql @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS `aowow_emotes`; +CREATE TABLE `aowow_emotes` ( + `id` SMALLINT(5) UNSIGNED NOT NULL, + `cmd` VARCHAR(15) NOT NULL, + `isAnimated` TINYINT(1) UNSIGNED NOT NULL, + `target_loc0` VARCHAR(65) NULL DEFAULT NULL, + `target_loc2` VARCHAR(70) NULL DEFAULT NULL, + `target_loc3` VARCHAR(95) NULL DEFAULT NULL, + `target_loc6` VARCHAR(90) NULL DEFAULT NULL, + `target_loc8` VARCHAR(70) NULL DEFAULT NULL, + `noTarget_loc0` VARCHAR(65) NULL DEFAULT NULL, + `noTarget_loc2` VARCHAR(110) NULL DEFAULT NULL, + `noTarget_loc3` VARCHAR(85) NULL DEFAULT NULL, + `noTarget_loc6` VARCHAR(75) NULL DEFAULT NULL, + `noTarget_loc8` VARCHAR(60) NULL DEFAULT NULL, + `self_loc0` VARCHAR(65) NULL DEFAULT NULL, + `self_loc2` VARCHAR(115) NULL DEFAULT NULL, + `self_loc3` VARCHAR(85) NULL DEFAULT NULL, + `self_loc6` VARCHAR(75) NULL DEFAULT NULL, + `self_loc8` VARCHAR(70) NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +DROP TABLE IF EXISTS `aowow_emotes_aliasses`; +CREATE TABLE `aowow_emotes_aliasses` ( + `id` SMALLINT(6) UNSIGNED NOT NULL, + `locales` SMALLINT(6) UNSIGNED NOT NULL, + `command` VARCHAR(15) NOT NULL, + UNIQUE INDEX `id_command` (`id`, `command`), + INDEX `id` (`id`) +) ENGINE=MyISAM; diff --git a/static/js/locale_dede.js b/static/js/locale_dede.js index 0b4065ad..4cef5e36 100644 --- a/static/js/locale_dede.js +++ b/static/js/locale_dede.js @@ -836,6 +836,7 @@ var mn_database = [ [15,"Währungen","?currencies",mn_currencies], [11,"Weltereignisse","?events",mn_holidays], [1,"Zauber","?spells",mn_spells], + [100,"Emotes","?emotes",null] ]; var mn_tools = [ [0,"Talentrechner","?talent",mn_talentCalc], diff --git a/static/js/locale_enus.js b/static/js/locale_enus.js index b2e5f697..40eb796d 100644 --- a/static/js/locale_enus.js +++ b/static/js/locale_enus.js @@ -881,7 +881,8 @@ var mn_database = [ [1,"Spells","?spells",mn_spells], [10,"Titles","?titles",mn_titles], [11,"World Events","?events",mn_holidays], - [6,"Zones","?zones",mn_zones] + [6,"Zones","?zones",mn_zones], + [100,"Emotes","?emotes",null] ]; var mn_tools = [ [0,"Talent Calculator","?talent",mn_talentCalc], diff --git a/static/js/locale_eses.js b/static/js/locale_eses.js index 338c63e2..8effe0e0 100644 --- a/static/js/locale_eses.js +++ b/static/js/locale_eses.js @@ -835,7 +835,8 @@ var mn_database = [ [1,"Hechizos","?spells",mn_spells], [10,"Títulos","?titles",mn_titles], [11,"Eventos del mundo","?events",mn_holidays], - [6,"Zonas","?zones",mn_zones] + [6,"Zonas","?zones",mn_zones], + [100,"Emociones","?emotes",null] ]; var mn_tools = [ [0,"Calculadora de talentos","?talent",mn_talentCalc], diff --git a/static/js/locale_frfr.js b/static/js/locale_frfr.js index 43533018..67cb6ddc 100644 --- a/static/js/locale_frfr.js +++ b/static/js/locale_frfr.js @@ -835,7 +835,8 @@ var mn_database = [ [1,"Sorts","?spells",mn_spells], [10,"Titres","?titles",mn_titles], [11,"Évènements mondiaux","?events",mn_holidays], - [6,"Zones","?zones",mn_zones] + [6,"Zones","?zones",mn_zones], + [100,"Emotes","?emotes",null] ]; var mn_tools = [ [0,"Calculateur de talents","?talent",mn_talentCalc], diff --git a/static/js/locale_ruru.js b/static/js/locale_ruru.js index 83a5613a..04153054 100644 --- a/static/js/locale_ruru.js +++ b/static/js/locale_ruru.js @@ -835,7 +835,8 @@ var mn_database = [ [1,"Заклинания","?spells",mn_spells], [10,"Звания","?titles",mn_titles], [11,"Игровые события","?events",mn_holidays], - [6,"Местности","?zones",mn_zones] + [6,"Местности","?zones",mn_zones], + [100,"Эмоции", "?emotes", null] ]; var mn_tools = [ [0,"Расчёт талантов","?talent",mn_talentCalc], diff --git a/template/listviews/emote.tpl.php b/template/listviews/emote.tpl.php new file mode 100644 index 00000000..dc35641e --- /dev/null +++ b/template/listviews/emote.tpl.php @@ -0,0 +1,90 @@ +Listview.templates.emote = { + sort: [1], + searchable: 1, + filtrable: 1, + + columns: [ + { + id: 'name', + name: LANG.name, + type: 'text', + align: 'left', + value: 'name', + compute: function(emote, td, tr) { + var wrapper = $WH.ce('div'); + + var a = $WH.ce('a'); + a.style.fontFamily = 'Verdana, sans-serif'; + a.href = this.getItemLink(emote); + $WH.ae(a, $WH.ct(emote.name)); + + $WH.ae(wrapper, a); + + $WH.ae(td, wrapper); + }, + sortFunc: function(a, b, col) { + return $WH.strcmp(a.name, b.name); + }, + getVisibleText: function(emote) { + return emote.name; + } + }, + { + id: 'preview', + name: LANG.preview, + type: 'text', + align: 'left', + value: 'name', + compute: function(emote, td, tr) { + var prev = ''; + if (emote.preview) { + td.className = 's4'; + prev = emote.preview.replace(/%\d?\$?s/g, '<' + LANG.name + '>'); + $WH.ae(td, $WH.ct(prev)); + } + else { + td.className = 'q0'; + td.style.textAlign = 'right'; + td.style.Align = 'right'; + + var + sm = $WH.ce('small'), + i = $WH.ce('i'); + + sm.style.paddingRight = '8px'; + + $WH.ae(i, $WH.ct(LANG.lvnodata)); + $WH.ae(sm, i); + $WH.ae(td, sm); + } + }, + sortFunc: function(a, b, col) { + return $WH.strcmp(a.preview.replace(/%\d?\$?s/g, ''), b.preview.replace(/%\d?\$?s/g, '')); + }, + getVisibleText: function(emote) { + return emote.preview.replace(/%\d?\$?s/g, ''); + } + } + ], + getItemLink: function(emote) { + return '?emote=' + emote.id; + } +} + +new Listview({ + template:'emote', + $v): + if ($v[0] == '$'): + echo $k.':'.substr($v, 1).','; + elseif ($v): + echo $k.":'".$v."',"; + endif; + endforeach; +?> + data: +}); diff --git a/template/pages/quest.tpl.php b/template/pages/quest.tpl.php index db43e72a..1af2c987 100644 --- a/template/pages/quest.tpl.php +++ b/template/pages/quest.tpl.php @@ -174,7 +174,7 @@ if ($g = $this->gains): echo "