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
This commit is contained in:
Sarjuuk
2013-06-28 21:47:08 +02:00
parent bbfc4f5820
commit 4c974f87c5
10 changed files with 122 additions and 25 deletions

View File

@@ -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) { }

View File

@@ -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(

View File

@@ -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(

View File

@@ -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(

View File

@@ -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(

View File

@@ -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)

View File

@@ -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].' <a href="?npc='.$effMV.'">'.CreatureList::getName($effMV).'</a> ('.$effMV.')';
$transform = new CreatureList(array(['ct.entry', $effMV]));
if (!$pageData['view3D'] && $transform)
$pageData['view3D'] = $transform->getRandomModelId();
$foo['name'] .= Lang::$colon.Util::$spellAuraStrings[$effAura].' <a href="?npc='.$effMV.'">'.$transform->getField('name', true).'</a> ('.$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

View File

@@ -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 dours','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 dours 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

View File

@@ -22,9 +22,8 @@
</table>
<div class="text">
<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur();
Links.show({ldelim} type: 6, typeId: {$lvData.page.id}, linkColor: 'ff71d5ff', linkId: 'spell:{$lvData.page.id}', linkName: '{$lvData.page.name}' {rdelim});">
<em><b><i>{$lang.links}</i></b><span>{$lang.links}</span></em></a>
<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur(); Links.show({ldelim} type: 6, typeId: {$lvData.page.id}, linkColor: 'ff71d5ff', linkId: 'spell:{$lvData.page.id}', linkName: '{$lvData.page.name}' {rdelim});"><em><b><i>{$lang.links}</i></b><span>{$lang.links}</span></em></a>
<a href="javascript:;" id="view3D-button" class="button-red{if $lvData.view3D}" onclick="this.blur(); ModelViewer.show({ldelim} type: 1, displayId: {$lvData.view3D} {rdelim}){else} button-red-disabled{/if}"><em><b><i>View in 3D</i></b><span>View in 3D</span></em></a>
<a href="http://old.wowhead.com/?{$query[0]}={$query[1]}" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
<h1>{$lvData.page.name}</h1>