From 4c974f87c58f69b067925f0011ade5e8656ccdd1 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Fri, 28 Jun 2013 21:47:08 +0200 Subject: [PATCH] display modelviewer button for spells with transform, mount or shapeshift parsed SpellShapeshiftForm.dbc to db and added Horde displayIds manually use table for modelIds and spells speciffic to this form --- includes/class.creature.php | 11 ++++++ localization/locale_enus.php | 2 +- localization/locale_eses.php | 2 +- localization/locale_frfr.php | 2 +- localization/locale_ruru.php | 2 +- pages/itemset.php | 2 +- pages/spell.php | 51 +++++++++++++++++-------- setup/aowow_shapeshiftForms.sql | 68 +++++++++++++++++++++++++++++++++ template/js/global.js | 2 +- template/spell.tpl | 5 +-- 10 files changed, 122 insertions(+), 25 deletions(-) create mode 100644 setup/aowow_shapeshiftForms.sql diff --git a/includes/class.creature.php b/includes/class.creature.php index 32d217ef..300c113e 100644 --- a/includes/class.creature.php +++ b/includes/class.creature.php @@ -84,6 +84,17 @@ class CreatureList extends BaseType return $x; } + public function getRandomModelId() + { + $data = []; + + for ($i = 1; $i < 5; $i++) + if ($_ = $this->curTpl['modelid'.$i]) + $data[] = $_; + + return !$data ? 0 : $data[array_rand($data)]; + } + public function getListviewData() { } public function addGlobalsToJScript(&$refs) { } public function addRewardsToJScript(&$refs) { } diff --git a/localization/locale_enus.php b/localization/locale_enus.php index feb8d196..2aa51714 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -118,6 +118,7 @@ $lang = array( 'school' => "School", 'spell' => "spell", 'spells' => "Spells", + 'type' => "Type", 'valueDelim' => " to ", 'zone' => "zone", 'zones' => "Zones", @@ -292,7 +293,6 @@ $lang = array( '_conveyBonus' => "Wearing more pieces of this set will convey bonuses to your character.", '_pieces' => "pieces", '_unavailable' => "This item set is not available to players.", - '_type' => "Type", '_tag' => "Tag", 'notes' => array( diff --git a/localization/locale_eses.php b/localization/locale_eses.php index 80a18c6a..c280ce98 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -115,6 +115,7 @@ $lang = array( 'school' => "Escuela", 'spell' => "hechizo", 'spells' => "Hechizos", + 'type' => "Tipo", 'valueDelim' => " - ", 'zone' => "zona", 'zones' => "Zonas", @@ -250,7 +251,6 @@ $lang = array( '_conveyBonus' => "Tener puestos mas objetos de este conjunto le aplicará una bonificación a tu personaje.", '_pieces' => "piezas", '_unavailable' => "Este conjunto de objetos no está disponible para jugadores.", - '_type' => "Tipo", '_tag' => "Etiqueta", 'notes' => array( diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index 3752434c..e0795ddc 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -115,6 +115,7 @@ $lang = array( 'school' => "École", 'spell' => "sort", 'spells' => "Sorts", + 'type' => "Type", 'valueDelim' => " - ", 'zone' => "zone", 'zones' => "Zones", @@ -249,7 +250,6 @@ $lang = array( '_conveyBonus' => "Plus d'objets de cet ensemble sont équipés, plus votre personnage aura des bonus de caractéristiques.", '_pieces' => "pièces", '_unavailable' => "Cet objet n'est plus disponible aux joueurs.", - '_type' => "Type", '_tag' => "Étiquette", 'notes' => array( diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index 4b1bfe20..d9e3324d 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -115,6 +115,7 @@ $lang = array( 'school' => "Школа", 'spell' => "заклинание", 'spells' => "Заклинания", + 'type' => "Тип", 'valueDelim' => " - ", 'zone' => "игровая зона", 'zones' => "Местности", @@ -249,7 +250,6 @@ $lang = array( '_conveyBonus' => "Ношение большего числа предметов из этого комплекта предоставит бонусы для вашего персонажа.", '_pieces' => "частей", '_unavailable' => "Этот набор предметов не доступен игрокам.", - '_type' => "Тип", '_tag' => "Тэг", 'notes' => array( diff --git a/pages/itemset.php b/pages/itemset.php index 332ff9ef..90cf8983 100644 --- a/pages/itemset.php +++ b/pages/itemset.php @@ -68,7 +68,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // type if ($ty) - $infobox[] = Lang::$itemset['_type'].lang::$colon.Lang::$itemset['types'][$ty]; + $infobox[] = Lang::$game['type'].lang::$colon.Lang::$itemset['types'][$ty]; // tag if ($ta) diff --git a/pages/spell.php b/pages/spell.php index dcedcd29..9bccc2a4 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -111,14 +111,14 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $pageData['page']['buff'] = $spell->renderBuff(MAX_LEVEL, true); // infobox - $parts = []; + $infobox = []; if (!in_array($cat, [-5, -6])) // not mount or vanity pet { if ($_ = $spell->getField('talentLevel')) // level - $parts[] = '[li]'.(in_array($cat, [-2, 7, -13]) ? sprintf(Lang::$game['reqLevel'], $_) : Lang::$game['level'].Lang::$colon.$_).'[/li]'; + $infobox[] = '[li]'.(in_array($cat, [-2, 7, -13]) ? sprintf(Lang::$game['reqLevel'], $_) : Lang::$game['level'].Lang::$colon.$_).'[/li]'; else if ($_ = $spell->getField('spellLevel')) - $parts[] = '[li]'.(in_array($cat, [-2, 7, -13]) ? sprintf(Lang::$game['reqLevel'], $_) : Lang::$game['level'].Lang::$colon.$_).'[/li]'; + $infobox[] = '[li]'.(in_array($cat, [-2, 7, -13]) ? sprintf(Lang::$game['reqLevel'], $_) : Lang::$game['level'].Lang::$colon.$_).'[/li]'; } if ($mask = $spell->getField('reqRaceMask')) // race @@ -129,7 +129,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $bar[] = (!fMod(count($bar) + 1, 3) ? '\n' : null) . '[race='.($i + 1).']'; $t = count($bar) == 1 ? Lang::$game['race'] : Lang::$game['races']; - $parts[] = '[li]'.Util::ucFirst($t).Lang::$colon.implode(', ', $bar).'[/li]'; + $infobox[] = '[li]'.Util::ucFirst($t).Lang::$colon.implode(', ', $bar).'[/li]'; } if ($mask = $spell->getField('reqClassMask')) // class @@ -140,13 +140,13 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $bar[] = (!fMod(count($bar) + 1, 3) ? '\n' : null) . '[class='.($i + 1).']'; $t = count($bar) == 1 ? Lang::$game['class'] : Lang::$game['classes']; - $parts[] = '[li]'.Util::ucFirst($t).Lang::$colon.implode(', ', $bar).'[/li]'; + $infobox[] = '[li]'.Util::ucFirst($t).Lang::$colon.implode(', ', $bar).'[/li]'; } if ($_ = $spell->getField('spellFocusObject')) // spellFocus { $bar = DB::Aowow()->selectRow('SELECT * FROM ?_spellFocusObject WHERE id = ?d', $_); - $parts[] = '[li]'.Lang::$game['requires2'].' '.Util::localizedString($bar, 'name').'[/li]'; + $infobox[] = '[li]'.Lang::$game['requires2'].' '.Util::localizedString($bar, 'name').'[/li]'; } if (in_array($cat, [9, 11])) // primary & secondary trades @@ -156,11 +156,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if ($_ = $spell->getField('learnedAt')) $bar .= ' ('.$_.')'; - $parts[] = '[li]'.sprintf(Lang::$game['requires'], $bar).'[/li]'; + $infobox[] = '[li]'.sprintf(Lang::$game['requires'], $bar).'[/li]'; // specialization if ($_ = $spell->getField('reqSpellId')) - $parts[] = '[li]'.Lang::$game['requires2'].' '.SpellList::getName($_).'[/li]'; + $infobox[] = '[li]'.Lang::$game['requires2'].' '.SpellList::getName($_).'[/li]'; // difficulty if ($_ = $spell->getColorsForCurrent()) @@ -170,19 +170,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if ($_[$i]) $bar[] = '[color=r'.($i + 1).']'.$_[$i].'[/color]'; - $parts[] = '[li]'.Lang::$game['difficulty'].Lang::$colon.implode(' ', $bar).'[/li]'; + $infobox[] = '[li]'.Lang::$game['difficulty'].Lang::$colon.implode(' ', $bar).'[/li]'; } } // flag starter spell if (isset($spell->sources[$spell->id]) && array_key_exists(10, $spell->sources[$spell->id])) - $parts[] = '[li]'.Lang::$spell['starter'].'[/li]'; + $infobox[] = '[li]'.Lang::$spell['starter'].'[/li]'; // training cost if ($cost = DB::Aowow()->selectCell('SELECT spellcost FROM npc_trainer WHERE spell = ?d', $spell->id)) - $parts[] = '[li]'.Lang::$spell['trainingCost'].Lang::$colon.'[money='.$cost.'][/li]'; - - $pageData['infobox'] = $parts ? '[ul]'.implode('', $parts).'[/ul]' : null; + $infobox[] = '[li]'.Lang::$spell['trainingCost'].Lang::$colon.'[money='.$cost.'][/li]'; // title $pageData['title'] = [$spell->getField('name', true), Util::ucFirst(Lang::$game['spell'])]; @@ -228,6 +226,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // Iterate through all effects: $pageData['page']['effect'] = []; $spell->reset(); + + $pageData['view3D'] = 0; + for ($i = 1; $i < 4; $i++) { if ($spell->getField('effect'.$i.'Id') <= 0) @@ -397,7 +398,15 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $foo['name'] .= Lang::$colon.Util::$spellAuraStrings[$effAura].' ('.sprintf(Util::$dfnString, implode(', ', $bar), $effMV).')'; break; case 36: // Shapeshift - $foo['name'] .= Lang::$colon.Util::$spellAuraStrings[$effAura].' ('.sprintf(Util::$dfnString, @Lang::$game['st'][$effMV], $effMV).')'; + $st = DB::Aowow()->selectRow('SELECT *, displayIdA as model1, displayIdH as model2 FROM ?_shapeshiftForms WHERE id = ?d', $effMV); + + if ($st['creatureType'] > 0) + $infobox[] = '[li]'.Lang::$game['type'].Lang::$colon.Lang::$game['ct'][$st['creatureType']].'[/li]'; + + if (!$pageData['view3D'] && $st) + $pageData['view3D'] = $st['model2'] ? $st['model'.rand(1,2)]: $st['model1']; + + $foo['name'] .= Lang::$colon.Util::$spellAuraStrings[$effAura].' ('.sprintf(Util::$dfnString, Util::localizedString($st, 'name'), $effMV).')'; break; case 37: // Effect immunity $foo['name'] .= Lang::$colon.Util::$spellAuraStrings[$effAura].' ('.sprintf(Util::$dfnString, @Util::$spellEffectStrings[$effMV], $effMV).')'; @@ -502,7 +511,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case 78: // Mounted case 56: // Transform { - $foo['name'] .= Lang::$colon.Util::$spellAuraStrings[$effAura].' '.CreatureList::getName($effMV).' ('.$effMV.')'; + $transform = new CreatureList(array(['ct.entry', $effMV])); + + if (!$pageData['view3D'] && $transform) + $pageData['view3D'] = $transform->getRandomModelId(); + + $foo['name'] .= Lang::$colon.Util::$spellAuraStrings[$effAura].' '.$transform->getField('name', true).' ('.$effMV.')'; break; } default: @@ -531,6 +545,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) unset($foo['value']); } + $pageData['infobox'] = $infobox ? '[ul]'.implode('', $infobox).'[/ul]' : null; + /******* * extra tabs *******/ @@ -719,7 +735,10 @@ $smarty->updatePageVars(array( 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), 'tab' => 0, 'type' => TYPE_SPELL, - 'typeId' => $id + 'typeId' => $id, + 'reqJS' => array ( + array('path' => 'template/js/swfobject.js') + ) )); $smarty->assign('community', CommunityContent::getAll(TYPE_SPELL, $id)); // comments, screenshots, videos diff --git a/setup/aowow_shapeshiftForms.sql b/setup/aowow_shapeshiftForms.sql new file mode 100644 index 00000000..71f13a9f --- /dev/null +++ b/setup/aowow_shapeshiftForms.sql @@ -0,0 +1,68 @@ +-- MySQL dump 10.13 Distrib 5.5.27, for Win32 (x86) +-- +-- Host: localhost Database: world +-- ------------------------------------------------------ +-- Server version 5.5.27 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `aowow_shapeshiftforms` +-- + +DROP TABLE IF EXISTS `aowow_shapeshiftforms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `aowow_shapeshiftforms` ( + `Id` bigint(20) NOT NULL, + `name_loc0` text NOT NULL, + `name_loc2` text NOT NULL, + `name_loc3` text NOT NULL, + `name_loc6` text NOT NULL, + `name_loc8` text NOT NULL, + `flags` bigint(20) NOT NULL, + `creatureType` bigint(20) NOT NULL, + `iconString` varchar(64) NOT NULL, + `displayIdA` bigint(20) NOT NULL, + `displayIdH` bigint(20) NOT NULL, + `spellId1` bigint(20) NOT NULL, + `spellId2` bigint(20) NOT NULL, + `spellId3` bigint(20) NOT NULL, + `spellId4` bigint(20) NOT NULL, + `spellId5` bigint(20) NOT NULL, + `spellId6` bigint(20) NOT NULL, + `spellId7` bigint(20) NOT NULL, + `spellId8` bigint(20) NOT NULL, + PRIMARY KEY (`Id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `aowow_shapeshiftforms` +-- + +LOCK TABLES `aowow_shapeshiftforms` WRITE; +/*!40000 ALTER TABLE `aowow_shapeshiftforms` DISABLE KEYS */; +INSERT INTO `aowow_shapeshiftforms` VALUES (1,'Cat Form','Forme de félin','Katzengestalt','Forma felina','Облик кошки',760,1,'Ability_Druid_CatFormAttack',892,8571,0,0,0,0,0,0,0,0),(2,'Tree of Life Form','Forme d\'arbre de vie','Baum des Lebens','Forma de árbol de vida','Облик Древа жизни',2257,4,'',864,0,0,0,0,0,0,0,0,0),(3,'Travel Form','Forme de voyage','Reisegestalt','Forma de viaje','Походный облик',216,1,'',918,0,0,0,0,0,0,0,0,0),(4,'Aquatic Form','Forme aquatique','Wassergestalt','Forma acuática','Водный облик',216,1,'',2428,0,0,0,0,0,0,0,0,0),(5,'Bear Form','Forme d’ours','Bärengestalt','Forma de oso','Облик медведя',728,1,'Ability_Druid_Swipe',2281,2289,0,0,0,0,0,0,0,0),(6,'Ambient','Ambiant','Umgebung','Ambiente','Фауна',0,0,'',328,0,0,0,0,0,0,0,0,0),(7,'Ghoul','Goule','Ghul','Necrófago','Вурдалак',9689,6,'',25527,0,6603,47468,47481,47482,47480,0,47484,47496),(8,'Dire Bear Form','Forme d’ours redoutable','Terrorbärengestalt','Forma de oso temible','Облик лютого медведя',728,1,'Ability_Druid_Swipe',2281,2289,0,0,0,0,0,0,0,0),(9,'Steve\'s Ghoul','Goule de Steve','Steves Ghul','Steve\'s Ghoul','Вурдалак Стива',128,-1,'',24994,0,0,0,0,0,0,0,0,0),(10,'Tharon\'ja Skeleton','Squelette de Tharon\'ja','Skelett von Tharon\'ja','Esqueleto Tharon\'ja','Скелет Тарон\'джа',1034,6,'',9784,0,50799,49613,49609,49617,0,0,0,0),(11,'Darkmoon - Test of Strength','Sombrelune - épreuve de force','Dunkelmond-Test der Stärke','Luna Negra - Prueba de fuerza','Ярмарка Новолуния - испытание силы',1226,-1,'',0,0,62022,62023,62024,62025,0,0,0,0),(12,'BLB Player','Joueur BLB','BLB Spieler','BLB Player','BLB Player',0,-1,'',0,0,44029,44752,44083,44010,44012,44817,0,0),(13,'Shadow Dance','Danse de l\'ombre','Schattentanz','Danza de las Sombras','Танец теней',1,-1,'',0,0,0,0,0,0,0,0,0,0),(14,'Creature - Bear','Créature - Ours','Kreatur - Bär','Criatura: oso','Существо: медведь',0,1,'',2281,0,0,0,0,0,0,0,0,0),(15,'Creature - Cat','Créature - Félin','Kreatur - Katze','Criatura: felino','Существо: кошка',0,1,'',892,0,0,0,0,0,0,0,0,0),(16,'Ghost Wolf','Loup fantôme','Geisterwolf','Lobo fantasmal','Призрачный волк',216,1,'',4613,0,0,0,0,0,0,0,0,0),(17,'Battle Stance','Posture de combat','Kampfhaltung','Actitud de batalla','Боевая стойка',7,-1,'',0,0,0,0,0,0,0,0,0,0),(18,'Defensive Stance','Posture défensive','Verteidigungshaltung','Actitud defensiva','Оборонительная стойка',7,-1,'',0,0,0,0,0,0,0,0,0,0),(19,'Berserker Stance','Posture berserker','Berserkerhaltung','Actitud rabiosa','Стойка берсерка',7,0,'',0,0,0,0,0,0,0,0,0,0),(20,'Test','Test','Test','Test','Тест',0,-1,'',0,0,6603,20577,0,0,0,0,0,0),(21,'Zombie','Zombie','Zombie','Zombi','Зомби',5150,6,'',26942,0,57596,51230,56560,43949,56528,0,0,0),(22,'Metamorphosis','Métamorphose','Metamorphose','Metamorfosis','Метаморфоза',216,3,'',25277,0,0,0,0,0,0,0,0,0),(25,'Undead','Mort-vivant','Untotes Wesen','No-muerto','Нежить',205,6,'',0,0,0,0,0,0,0,0,0,0),(26,'Frenzy','Frénésie','Raserei','Furia','Бешенство',216,1,'',17170,0,0,0,0,0,0,0,0,0),(27,'Flight Form, Epic','Forme de vol, épique','Epische Fluggestalt','Forma voladora, épica','Облик стремительной птицы',8,1,'',21243,21244,0,0,0,0,0,0,0,0),(28,'Shadowform','Forme d\'ombre','Schattengestalt','Forma de las Sombras','Облик Тьмы',9,-1,'',0,0,0,0,0,0,0,0,0,0),(29,'Flight Form','Forme de vol','Fluggestalt','Forma de vuelo','Облик птицы',8,1,'',20857,20872,0,0,0,0,0,0,0,0),(30,'Stealth','Camouflage','Verstohlenheit','Sigilo','Незаметность',1,0,'',0,0,0,0,0,0,0,0,0,0),(31,'Moonkin Form','Forme de sélénien','Mondkingestalt','Forma de lechúcico lunar','Облик лунного совуха',2753,-1,'',15374,15375,0,0,0,0,0,0,0,0),(32,'Spirit of Redemption','Esprit de rédemption','Geist der Erlösung','Espíritu redentor','Дух воздаяния',16640,-1,'',16031,0,0,0,0,0,0,0,0,0); +/*!40000 ALTER TABLE `aowow_shapeshiftforms` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2013-06-28 21:48:34 diff --git a/template/js/global.js b/template/js/global.js index 4118de06..c842d91f 100644 --- a/template/js/global.js +++ b/template/js/global.js @@ -14446,7 +14446,7 @@ var Lightbox = new function() { prepared, lastId; - function hookEvents() { + function hookEvents() { aE(overlay, 'click', hide); aE(document, 'keydown', onKeyDown); aE(window, 'resize', onResize); diff --git a/template/spell.tpl b/template/spell.tpl index b656326a..63cbd1ce 100644 --- a/template/spell.tpl +++ b/template/spell.tpl @@ -22,9 +22,8 @@
- - {$lang.links}{$lang.links} + {$lang.links}{$lang.links} + View in 3DView in 3D WowheadWowhead

{$lvData.page.name}