Achievement:

- improved handling of rewards

Spell:
- moved calcuation of effectValue to separate function, use realPointsPerLevel
- eval: applied proper format, fixed evalable string when facing multiple signs in a row
- display modelviewer for summons

Titles:
- looks like titles behave differently when using "faction" or "side"

Achievement:
- implemented rewards (which i have forgotten for almost 2 years)

* reworked pet-setup
* typos and forgotten changes, that broke code here and there
This commit is contained in:
Sarjuuk
2013-07-06 16:33:30 +02:00
parent a3f16f0e0d
commit 9c9d03dbb8
13 changed files with 219 additions and 122 deletions

View File

@@ -24,15 +24,19 @@ class AchievementList extends BaseType
$this->templates[$this->id]['iconString'] = 'INV_Misc_QuestionMark'; $this->templates[$this->id]['iconString'] = 'INV_Misc_QuestionMark';
//"rewards":[[11,137],[3,138]] [type, typeId] //"rewards":[[11,137],[3,138]] [type, typeId]
$rewards = [TYPE_ITEM => [], TYPE_TITLE => []];
if (!empty($this->curTpl['rewardIds'])) if (!empty($this->curTpl['rewardIds']))
{ {
$rewards = [];
$rewIds = explode(" ", $this->curTpl['rewardIds']); $rewIds = explode(" ", $this->curTpl['rewardIds']);
foreach ($rewIds as $rewId) foreach ($rewIds as $rewId)
$rewards[] = ($rewId > 0 ? [TYPE_ITEM => $rewId] : ($rewId < 0 ? [TYPE_TITLE => -$rewId] : NULL)); {
if ($rewId > 0)
$this->templates[$this->id]['rewards'] = $rewards; $rewards[TYPE_ITEM][] = $rewId;
else if ($rewId < 0)
$rewards[TYPE_TITLE][] = -$rewId;
}
} }
$this->templates[$this->id]['rewards'] = $rewards;
} }
$this->reset(); // restore 'iterator' $this->reset(); // restore 'iterator'
@@ -40,27 +44,23 @@ class AchievementList extends BaseType
public function addRewardsToJScript(&$refs) public function addRewardsToJScript(&$refs)
{ {
// collect Ids to execute in single query $items = [];
$lookup = []; $titles = [];
while ($this->iterate()) while ($this->iterate())
{ {
$rewards = explode(" ", $this->curTpl['rewardIds']); foreach ($this->curTpl['rewards'][TYPE_ITEM] as $_)
$items[] = $_;
foreach ($rewards as $reward) foreach ($this->curTpl['rewards'][TYPE_TITLE] as $_)
{ $titles[] = $_;
if ($reward > 0)
$lookup['item'][] = $reward;
else if ($reward < 0)
$lookup['title'][] = -$reward;
}
} }
if (isset($lookup['item'])) if ($items)
(new ItemList(array(['i.entry', array_unique($lookup['item'])])))->addGlobalsToJscript($refs); (new ItemList(array(['i.entry', $items])))->addGlobalsToJscript($refs);
if (isset($lookup['title'])) if ($titles)
(new TitleList(array(['id', array_unique($lookup['title'])])))->addGlobalsToJscript($refs); (new TitleList(array(['id', $titles])))->addGlobalsToJscript($refs);
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$refs)
@@ -97,18 +97,15 @@ class AchievementList extends BaseType
if ($this->curTpl['flags'] & ACHIEVEMENT_FLAG_COUNTER && $this->curTpl['parentCat'] != 1) if ($this->curTpl['flags'] & ACHIEVEMENT_FLAG_COUNTER && $this->curTpl['parentCat'] != 1)
$data[$this->id]['type'] = 1; $data[$this->id]['type'] = 1;
if (!empty($this->curTpl['rewards'])) $rewards = [];
{ foreach ($this->curTpl['rewards'] as $type => $rIds)
$rewards = []; foreach ($rIds as $rId)
$rewards[] = '['.$type.','.$rId.']';
foreach ($this->curTpl['rewards'] as $pair)
$rewards[] = '['.key($pair).','.current($pair).']';
if ($rewards)
$data[$this->id]['rewards'] = '['.implode(',', $rewards).']'; $data[$this->id]['rewards'] = '['.implode(',', $rewards).']';
} else if (!empty($this->curTpl['reward']))
else if (!empty ($this->curTpl['reward']))
$data[$this->id]['reward'] = Util::localizedString($this->curTpl, 'reward'); $data[$this->id]['reward'] = Util::localizedString($this->curTpl, 'reward');
} }
return $data; return $data;

View File

@@ -17,7 +17,7 @@ class CreatureList extends BaseType
{ {
$n = DB::Aowow()->SelectRow(' $n = DB::Aowow()->SelectRow('
SELECT SELECT
name, name_loc0,
name_loc2, name_loc2,
name_loc3, name_loc3,
name_loc6, name_loc6,
@@ -85,7 +85,7 @@ class CreatureList extends BaseType
$data = []; $data = [];
for ($i = 1; $i < 5; $i++) for ($i = 1; $i < 5; $i++)
if ($_ = $this->curTpl['modelid'.$i]) if ($_ = $this->curTpl['displayId'.$i])
$data[] = $_; $data[] = $_;
return !$data ? 0 : $data[array_rand($data)]; return !$data ? 0 : $data[array_rand($data)];

View File

@@ -420,6 +420,44 @@ class SpellList extends BaseType
return ''; return '';
} }
// formulae base from TC
private function calculateAmountForCurrent($effIdx, $altTpl = null)
{
$ref = $altTpl ? $altTpl : $this;
$level = $this->charLevel;
$rppl = $ref->getField('effect'.$effIdx.'RealPointsPerLevel');
$base = $ref->getField('effect'.$effIdx.'BasePoints');
$add = $ref->getField('effect'.$effIdx.'DieSides');
$maxLvl = $ref->getField('maxLevel');
$baseLvl = $ref->getField('baseLevel');
if ($this->curTpl['attributes1'] & 0x200) // never a referenced spell, ALWAYS $this; SPELL_ATTR1_MELEE_COMBAT_SPELL: 0x200
{
if ($level > $maxLvl && $maxLvl > 0)
$level = $maxLvl;
else if ($level < $baseLvl)
$level = $baseLvl;
$level -= $ref->getField('spellLevel');
$base += (int)($level * $rppl);
}
switch ($add) // roll in a range <1;EffectDieSides> as of patch 3.3.3
{
case 0:
case 1: // range 1..1
return [
$base + $add,
$base + $add
];
default:
return [
$base + 1,
$base + $add
];
}
}
// description-, buff-parsing component // description-, buff-parsing component
private function resolveEvaluation($formula) private function resolveEvaluation($formula)
{ {
@@ -479,6 +517,9 @@ class SpellList extends BaseType
return eval('return '.$formula.';'); return eval('return '.$formula.';');
} }
// hm, minor eval-issue. eval doesnt understand two operators without a space between them (eg. spelll: 18126)
$formula = preg_replace('/(\+|-|\*|\/)(\+|-|\*|\/)/i', '\1 \2', $formula);
// there should not be any letters without a leading $ // there should not be any letters without a leading $
return eval('return '.$formula.';'); return eval('return '.$formula.';');
} }
@@ -656,15 +697,13 @@ class SpellList extends BaseType
case 'O': case 'O':
if ($lookup) if ($lookup)
{ {
$base = $this->refSpells[$lookup]->getField('effect'.$effIdx.'BasePoints'); list($min, $max) = $this->calculateAmountForCurrent($effIdx, $this->refSpells[$lookup]);
$add = $this->refSpells[$lookup]->getField('effect'.$effIdx.'DieSides');
$periode = $this->refSpells[$lookup]->getField('effect'.$effIdx.'Periode'); $periode = $this->refSpells[$lookup]->getField('effect'.$effIdx.'Periode');
$duration = $this->refSpells[$lookup]->getField('duration'); $duration = $this->refSpells[$lookup]->getField('duration');
} }
else else
{ {
$base = $this->getField('effect'.$effIdx.'BasePoints'); list($min, $max) = $this->calculateAmountForCurrent($effIdx);
$add = $this->getField('effect'.$effIdx.'DieSides');
$periode = $this->getField('effect'.$effIdx.'Periode'); $periode = $this->getField('effect'.$effIdx.'Periode');
$duration = $this->getField('duration'); $duration = $this->getField('duration');
} }
@@ -672,12 +711,11 @@ class SpellList extends BaseType
if (!$periode) if (!$periode)
$periode = 3000; $periode = 3000;
$tick = $duration / $periode; $min *= $duration / $periode;
$min = abs($base + 1) * $tick; $max *= $duration / $periode;
$max = abs($base + $add) * $tick;
$equal = $min == $max; $equal = $min == $max;
if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base)) if (in_array($op, $signs) && is_numeric($oparg))
if ($equal) if ($equal)
eval("\$min = $min $op $oparg;"); eval("\$min = $min $op $oparg;");
@@ -708,24 +746,19 @@ class SpellList extends BaseType
case 'S': case 'S':
if ($lookup) if ($lookup)
{ {
$base = $this->refSpells[$lookup]->getField('effect'.$effIdx.'BasePoints'); list($min, $max) = $this->calculateAmountForCurrent($effIdx, $this->refSpells[$lookup]);
$add = $this->refSpells[$lookup]->getField('effect'.$effIdx.'DieSides');
$mv = $this->refSpells[$lookup]->getField('effect'.$effIdx.'MiscValue'); $mv = $this->refSpells[$lookup]->getField('effect'.$effIdx.'MiscValue');
$aura = $this->refSpells[$lookup]->getField('effect'.$effIdx.'AuraId'); $aura = $this->refSpells[$lookup]->getField('effect'.$effIdx.'AuraId');
} }
else else
{ {
$base = $this->getField('effect'.$effIdx.'BasePoints'); list($min, $max) = $this->calculateAmountForCurrent($effIdx);
$add = $this->getField('effect'.$effIdx.'DieSides');
$mv = $this->getField('effect'.$effIdx.'MiscValue'); $mv = $this->getField('effect'.$effIdx.'MiscValue');
$aura = $this->getField('effect'.$effIdx.'AuraId'); $aura = $this->getField('effect'.$effIdx.'AuraId');
} }
$min = abs($base + 1);
$max = abs($base + $add);
$equal = $min == $max; $equal = $min == $max;
if (in_array($op, $signs) && is_numeric($oparg) && is_numeric($base)) if (in_array($op, $signs) && is_numeric($oparg))
if ($equal) if ($equal)
eval("\$min = $min $op $oparg;"); eval("\$min = $min $op $oparg;");
@@ -878,7 +911,7 @@ class SpellList extends BaseType
// step 3: try to evaluate result // step 3: try to evaluate result
$evaled = $this->resolveEvaluation($str); $evaled = $this->resolveEvaluation($str);
$return = is_numeric($evaled) ? number_format($evaled, $precision) : $evaled; $return = is_numeric($evaled) ? number_format($evaled, $precision, '.', '') : $evaled;
return $return.$suffix; return $return.$suffix;
} }

View File

@@ -107,13 +107,27 @@ class TitleList extends BaseType
// Quest-source // Quest-source
if (isset($src[4])) if (isset($src[4]))
{
foreach ($src[4] as $s) foreach ($src[4] as $s)
{
if (isset($sources[4][$s]['s']))
$this->faction2Side($sources[4][$s]['s']);
$tmp[4][] = $sources[4][$s]; $tmp[4][] = $sources[4][$s];
}
}
// Achievement-source // Achievement-source
if (isset($src[12])) if (isset($src[12]))
{
foreach ($src[12] as $s) foreach ($src[12] as $s)
{
if (isset($sources[12][$s]['s']))
$this->faction2Side($sources[12][$s]['s']);
$tmp[12][] = $sources[12][$s]; $tmp[12][] = $sources[12][$s];
}
}
// other source (only one item possible, so no iteration needed) // other source (only one item possible, so no iteration needed)
if (isset($src[13])) if (isset($src[13]))
@@ -131,6 +145,14 @@ class TitleList extends BaseType
public function addRewardsToJScript(&$ref) { } public function addRewardsToJScript(&$ref) { }
public function renderTooltip() { } public function renderTooltip() { }
private function faction2Side(&$faction) // thats weird.. and hopefully unique to titles
{
if ($faction == 2) // Horde
$faction = 0;
else if ($faction != 1) // Alliance
$faction = 3; // Both
}
} }
?> ?>

View File

@@ -240,7 +240,7 @@ $lang = array(
) )
), ),
'pet' => array( 'pet' => array(
'exotic' => "Exotique" 'exotic' => "Exotique",
"cat" => ["Férocité", "Tenacité", "Ruse"] "cat" => ["Férocité", "Tenacité", "Ruse"]
), ),
'itemset' => array( 'itemset' => array(

View File

@@ -82,10 +82,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// infobox content // infobox content
switch ($acv->getField('faction')) switch ($acv->getField('faction'))
{ {
case 0: case 1:
$pageData['infoBox'][] = Lang::$main['side'].': <span class="alliance-icon">'.Lang::$game['si'][SIDE_ALLIANCE].'</span>'; $pageData['infoBox'][] = Lang::$main['side'].': <span class="alliance-icon">'.Lang::$game['si'][SIDE_ALLIANCE].'</span>';
break; break;
case 1: case 2:
$pageData['infoBox'][] = Lang::$main['side'].': <span class="horde-icon">'.Lang::$game['si'][SIDE_HORDE].'</span>'; $pageData['infoBox'][] = Lang::$main['side'].': <span class="horde-icon">'.Lang::$game['si'][SIDE_HORDE].'</span>';
break; break;
default: // case 3 default: // case 3
@@ -106,7 +106,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$pageData['page']['saParams'] = array( $pageData['page']['saParams'] = array(
'id' => 'see-also', 'id' => 'see-also',
'name' => '$LANG.tab_seealso', 'name' => '$LANG.tab_seealso',
'visibleCols' => "$['category']" 'visibleCols' => "$['category']",
'tabs' => '$tabsRelated'
); );
$saList->addRewardsToJscript($pageData); $saList->addRewardsToJscript($pageData);
@@ -124,7 +125,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$pageData['page']['coParams'] = array( $pageData['page']['coParams'] = array(
'id' => 'criteria-of', 'id' => 'criteria-of',
'name' => '$LANG.tab_criteriaof', 'name' => '$LANG.tab_criteriaof',
'visibleCols' => "$['category']" 'visibleCols' => "$['category']",
'tabs' => '$tabsRelated'
); );
$coList->addRewardsToJscript($pageData); $coList->addRewardsToJscript($pageData);
@@ -135,8 +137,24 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$pageData['page']['titleReward'] = []; $pageData['page']['titleReward'] = [];
$pageData['page']['itemReward'] = []; $pageData['page']['itemReward'] = [];
foreach ($pageData['page']['titleReward'] as $k => $v) if ($foo = $acv->getField('rewards')[TYPE_ITEM])
$pageData['page']['titleReward'][$k] = sprintf(Lang::$achievement['titleReward'], $k, trim(str_replace('%s', '', $v['name']))); {
$bar = new ItemList(array(['i.entry', $foo]));
while ($bar->iterate())
{
$pageData['page']['itemReward'][$bar->id] = array(
'name' => $bar->getField('name', true),
'quality' => $bar->getField('Quality')
);
}
}
if ($foo = $acv->getField('rewards')[TYPE_TITLE])
{
$bar = new TitleList(array(['id', $foo]));
while ($bar->iterate())
$pageData['page']['titleReward'][] = sprintf(Lang::$achievement['titleReward'], $bar->id, trim(str_replace('%s', '', $bar->getField('male', true))));
}
// ***** // *****
// ACHIEVEMENT CRITERIA // ACHIEVEMENT CRITERIA
@@ -296,7 +314,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
break; break;
// link to faction (/w target reputation) // link to faction (/w target reputation)
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
$crtName = Faction::getName($obj); $crtName = FactionList::getName($obj);
$tmp['link'] = array( $tmp['link'] = array(
'href' => '?faction='.$obj, 'href' => '?faction='.$obj,
'text' => $crtName ? $crtName : $crtName, 'text' => $crtName ? $crtName : $crtName,

View File

@@ -145,7 +145,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($mask & (1 << $i)) if ($mask & (1 << $i))
{ {
if ($mask == (1 << $i)) // only bit set, add path if ($mask == (1 << $i)) // only bit set, add path
$path[] = $i; $path[] = $i + 1;
break; // break anyway (cant set multiple classes) break; // break anyway (cant set multiple classes)
} }
@@ -189,7 +189,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($ta && count($path) == 3) if ($ta && count($path) == 3)
{ {
$rel[] = ['id', $id, '!']; $rel[] = ['id', $id, '!'];
$rel[] = ['classMask', 1 << end($path), '&']; $rel[] = ['classMask', 1 << (end($path) - 1), '&'];
$rel[] = ['contentGroup', (int)$ta]; $rel[] = ['contentGroup', (int)$ta];
} }
else if ($ev) else if ($ev)

View File

@@ -20,7 +20,7 @@ if (isset($_GET['power']))
if (!$smarty->loadCache($cacheKeyTooltip, $x)) if (!$smarty->loadCache($cacheKeyTooltip, $x))
{ {
$npc = new CreatureList(array(['ct.entry', $id])); $npc = new CreatureList(array(['ct.id', $id]));
if ($npc->error) if ($npc->error)
die('$WowheadPower.registerNpc(\''.$id.'\', '.User::$localeId.', {})'); die('$WowheadPower.registerNpc(\''.$id.'\', '.User::$localeId.', {})');
@@ -41,7 +41,7 @@ if (isset($_GET['power']))
// regular page // regular page
if (!$smarty->loadCache($cacheKeyPage, $pageData)) if (!$smarty->loadCache($cacheKeyPage, $pageData))
{ {
$npc = new CreatureList(array(['ct.entry', $id])); $npc = new CreatureList(array(['ct.id', $id]));
if ($npc->error) if ($npc->error)
$smarty->notFound(Lang::$game['npc']); $smarty->notFound(Lang::$game['npc']);

View File

@@ -30,9 +30,9 @@ if (isset($_GET['power']))
$pt[] = "\tname_".User::$localeString.": '".Util::jsEscape($n)."'"; $pt[] = "\tname_".User::$localeString.": '".Util::jsEscape($n)."'";
if ($i = $spell->getField('iconString')) if ($i = $spell->getField('iconString'))
$pt[] = "\ticon: '".Util::jsEscape($i)."'"; $pt[] = "\ticon: '".Util::jsEscape($i)."'";
if ($t = $spell->renderTooltip($id)) if ($t = $spell->renderTooltip())
$pt[] = "\ttooltip_".User::$localeString.": '".Util::jsEscape($t)."'"; $pt[] = "\ttooltip_".User::$localeString.": '".Util::jsEscape($t)."'";
if ($b = $spell->renderBuff($id)) if ($b = $spell->renderBuff())
$pt[] = "\tbuff_".User::$localeString.": '".Util::jsEscape($b)."'"; $pt[] = "\tbuff_".User::$localeString.": '".Util::jsEscape($b)."'";
$x .= implode(",\n", $pt)."\n});"; $x .= implode(",\n", $pt)."\n});";
@@ -238,6 +238,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$effMV = (int)$spell->getField('effect'.$i.'MiscValue'); $effMV = (int)$spell->getField('effect'.$i.'MiscValue');
$effBP = (int)$spell->getField('effect'.$i.'BasePoints'); $effBP = (int)$spell->getField('effect'.$i.'BasePoints');
$effDS = (int)$spell->getField('effect'.$i.'DieSides'); $effDS = (int)$spell->getField('effect'.$i.'DieSides');
$effRPPL = $spell->getField('effect'.$i.'RealPointsPerLevel');
$effAura = (int)$spell->getField('effect'.$i.'AuraId'); $effAura = (int)$spell->getField('effect'.$i.'AuraId');
$foo = &$pageData['page']['effect'][]; $foo = &$pageData['page']['effect'][];
@@ -283,6 +284,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if (($effBP + $effDS) && !$spell->getField('effect'.$i.'CreateItemId') && (!$spell->getField('effect'.$i.'TriggerSpell') || in_array($effAura, [225, 227]))) if (($effBP + $effDS) && !$spell->getField('effect'.$i.'CreateItemId') && (!$spell->getField('effect'.$i.'TriggerSpell') || in_array($effAura, [225, 227])))
$foo['value'] = ($effDS != 1 ? ($effBP + 1).Lang::$game['valueDelim'] : null).($effBP + $effDS); $foo['value'] = ($effDS != 1 ? ($effBP + 1).Lang::$game['valueDelim'] : null).($effBP + $effDS);
if ($effRPPL != 0)
$foo['value'] = (isset($foo['value']) ? $foo['value'] : '0') . sprintf(Lang::$spell['costPerLevel'], $effRPPL);
if($spell->getField('effect'.$i.'Periode') > 0) if($spell->getField('effect'.$i.'Periode') > 0)
$foo['interval'] = $spell->getField('effect'.$i.'Periode') / 1000; $foo['interval'] = $spell->getField('effect'.$i.'Periode') / 1000;
@@ -303,7 +307,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
case 88: // Summon Totem (slot 2) case 88: // Summon Totem (slot 2)
case 89: // Summon Totem (slot 3) case 89: // Summon Totem (slot 3)
case 90: // Summon Totem (slot 4) case 90: // Summon Totem (slot 4)
$foo['name'] .= ': <a href="?npc='.$effMV.'">'.CreatureList::getName($effMV).'</a> ('.$effMV.')'; $summon = new CreatureList(array(['ct.id', $effMV]));
if (!$pageData['view3D'] && $summon)
$pageData['view3D'] = $summon->getRandomModelId();
$foo['name'] .= ': <a href="?npc='.$effMV.'">'.$summon->getField('name', true).'</a> ('.$effMV.')';
break; break;
case 33: // open Lock case 33: // open Lock
$foo['name'] .= ' ('.sprintf(Util::$dfnString, @Util::$lockType[$effMV], $effMV).')'; $foo['name'] .= ' ('.sprintf(Util::$dfnString, @Util::$lockType[$effMV], $effMV).')';
@@ -327,6 +336,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
case 105: // Summon Object (slot 2) case 105: // Summon Object (slot 2)
case 106: // Summon Object (slot 3) case 106: // Summon Object (slot 3)
case 107: // Summon Object (slot 4) case 107: // Summon Object (slot 4)
// todo (low): create modelviewer-data
$foo['name'] .= ': <a href="?object='.$effMV.'">'.GameObjectList::getName($effMV).'</a> ('.$effMV.')'; $foo['name'] .= ': <a href="?object='.$effMV.'">'.GameObjectList::getName($effMV).'</a> ('.$effMV.')';
break; break;
case 74: // Apply Glyph case 74: // Apply Glyph
@@ -334,7 +344,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$foo['name'] .= ': <a href="?spell='.$_.'">'.SpellList::getName($_).'</a> ('.$effMV.')'; $foo['name'] .= ': <a href="?spell='.$_.'">'.SpellList::getName($_).'</a> ('.$effMV.')';
break; break;
case 95: // Skinning case 95: // Skinning
// todo: sort this out - 0:skinning (corpse, beast), 1:hearb (GO), 2: ineral (GO), 3: engineer (corpse, mechanic) // todo (low): sort this out - 0:skinning (corpse, beast), 1:hearb (GO), 2: mineral (GO), 3: engineer (corpse, mechanic)
$foo['name'] .= ' ('.sprintf(Util::$dfnString, 'NYI]', $effMV).')'; $foo['name'] .= ' ('.sprintf(Util::$dfnString, 'NYI]', $effMV).')';
break; break;
case 108: // Dispel Mechanic case 108: // Dispel Mechanic
@@ -511,7 +521,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
case 78: // Mounted case 78: // Mounted
case 56: // Transform case 56: // Transform
{ {
$transform = new CreatureList(array(['ct.entry', $effMV])); $transform = new CreatureList(array(['ct.id', $effMV]));
if (!$pageData['view3D'] && $transform) if (!$pageData['view3D'] && $transform)
$pageData['view3D'] = $transform->getRandomModelId(); $pageData['view3D'] = $transform->getRandomModelId();

View File

@@ -50,6 +50,7 @@ if (!defined('AOWOW_REVISION'))
{ {
$talents = DB::Aowow()->select(' $talents = DB::Aowow()->select('
SELECT SELECT
t.id AS tId,
t.*, t.*,
s.* s.*
FROM FROM
@@ -72,7 +73,7 @@ if (!defined('AOWOW_REVISION'))
{ {
$petFamId = log($tabs[$l]['pets'], 2); $petFamId = log($tabs[$l]['pets'], 2);
$result[$l]['icon'] = $petFamIcons[$petFamId]; $result[$l]['icon'] = $petFamIcons[$petFamId];
$petCategories = DB::Aowow()->SelectCol('SELECT Id AS ARRAY_KEY, categoryEnumId FROM ?_creatureFamily WHERE petTalentType = ?d', $petFamId); $petCategories = DB::Aowow()->SelectCol('SELECT Id AS ARRAY_KEY, category FROM ?_pet WHERE type = ?d', $petFamId);
$result[$l]['f'] = array_keys($petCategories); $result[$l]['f'] = array_keys($petCategories);
} }
@@ -82,11 +83,11 @@ if (!defined('AOWOW_REVISION'))
for($j = 0; $j < count($talents); $j++) for($j = 0; $j < count($talents); $j++)
{ {
$tNums[$talents[$j]['id']] = $j; $tNums[$talents[$j]['tId']] = $j;
$d = []; $d = [];
$s = []; $s = [];
$i = $talents[$j]['id']; $i = $talents[$j]['tId'];
$n = Util::localizedString($talents[$j], 'name'); $n = Util::localizedString($talents[$j], 'name');
$x = $talents[$j]['col']; $x = $talents[$j]['col'];
$y = $talents[$j]['row']; $y = $talents[$j]['row'];
@@ -114,7 +115,7 @@ if (!defined('AOWOW_REVISION'))
for ($k = 0; $k <= ($m - 1); $k++) for ($k = 0; $k <= ($m - 1); $k++)
{ {
$tSpell = new SpellList(array(['s.id', $talents[$j]['rank'.($k + 1)]])); $tSpell = new SpellList(array(['s.id', (int)$talents[$j]['rank'.($k + 1)]]));
$d[] = $tSpell->parseText(); $d[] = $tSpell->parseText();
$s[] = $talents[$j]['rank'.($k + 1)]; $s[] = $talents[$j]['rank'.($k + 1)];
@@ -154,10 +155,10 @@ if (!defined('AOWOW_REVISION'))
$result[$l]['t'][$j]['iconname'] = $icon; $result[$l]['t'][$j]['iconname'] = $icon;
// If this talent is a reference, add it to the array of talent dependencies // If this talent is a reference, add it to the array of talent dependencies
if (isset($depLinks[$talents[$j]['id']])) if (isset($depLinks[$talents[$j]['tId']]))
{ {
$result[$l]['t'][$depLinks[$talents[$j]['id']]]['r'][0] = $j; $result[$l]['t'][$depLinks[$talents[$j]['tId']]]['r'][0] = $j;
unset($depLinks[$talents[$j]['id']]); unset($depLinks[$talents[$j]['tId']]);
} }
} }
@@ -203,7 +204,7 @@ if (!defined('AOWOW_REVISION'))
// PetCalc // PetCalc
if (empty($petIcons)) if (empty($petIcons))
{ {
$pets = DB::Aowow()->SelectCol('SELECT Id AS ARRAY_KEY, iconString FROM ?_creatureFamily WHERE petTalentType <> -1'); $pets = DB::Aowow()->SelectCol('SELECT Id AS ARRAY_KEY, iconString FROM ?_pet');
$petIcons = json_encode($pets, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); $petIcons = json_encode($pets, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
} }

View File

@@ -5,6 +5,66 @@ if (!defined('AOWOW_REVISION'))
class PetSetup extends PetList class PetSetup extends PetList
{ {
private static $setup = array(
'CREATE TABLE `aowow_pet` (
`id` int(11) NOT NULL ,
`category` mediumint(8) NOT NULL ,
`minLevel` smallint(6) NOT NULL ,
`maxLevel` smallint(6) NOT NULL ,
`foodMask` int(11) NOT NULL ,
`type` tinyint(4) NOT NULL ,
`exotic` tinyint(4) NOT NULL ,
`expansion` tinyint(4) NOT NULL ,
`name_loc0` varchar(64) NOT NULL ,
`name_loc2` varchar(64) NOT NULL ,
`name_loc3` varchar(64) NOT NULL ,
`name_loc6` varchar(64) NOT NULL ,
`name_loc8` varchar(64) NOT NULL ,
`iconString` varchar(128) NOT NULL ,
`skillLineId` mediumint(9) NOT NULL ,
`spellId1` mediumint(9) NOT NULL ,
`spellId2` mediumint(9) NOT NULL ,
`spellId3` mediumint(9) NOT NULL ,
`spellId4` mediumint(9) NOT NULL ,
`armor` mediumint(9) NOT NULL ,
`damage` mediumint(9) NOT NULL ,
`health` mediumint(9) NOT NULL ,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci ENGINE=MyISAM',
'INSERT INTO aowow_pet SELECT
f.id,
categoryEnumId,
min(ct.minlevel),
max(ct.maxlevel),
itemPetFoodMask,
petTalentType,
IF(ct.type_flags & 0x10000, 1, 0), -- exotic
0, -- expansion (static data :/)
nameEN, nameFR, nameDE, nameES, nameRU,
SUBSTRING_INDEX(iconFile, '\\', -1),
skillLine1,
0, 0, 0, 0, -- spells
0, 0, 0 -- mods (from "Tamed Pet Passive (DND)")
FROM
dbc.creatureFamily f
LEFT JOIN
?_creature ct ON
f.id = ct.family
JOIN
world.creature c ON -- check if it is spawned (for min/max level)
ct.id = c.id
WHERE
pettalentType <> -1 AND
ct.type_flags & 0x1
GROUP BY
f.id;
',
'UPDATE aowow_pet SET expansion = 1 WHERE id IN (30, 31, 32, 33, 34)',
'UPDATE aowow_pet SET expansion = 2 WHERE id IN (37, 38, 39, 41, 42, 43, 44, 45, 46)'
);
private static $classicMods = array( // [Armor, Damage, Health] (see related "Tamed Pet Passive (DND)" spells per family. All values are set to +5% in wotlk) private static $classicMods = array( // [Armor, Damage, Health] (see related "Tamed Pet Passive (DND)" spells per family. All values are set to +5% in wotlk)
1 => [ 5, 0, 0], // Wolf 1 => [ 5, 0, 0], // Wolf
2 => [ 0, 10, -2], // Cat 2 => [ 0, 10, -2], // Cat
@@ -31,22 +91,11 @@ class PetSetup extends PetList
35 => [ 0, 0, 0] // Serpent 35 => [ 0, 0, 0] // Serpent
); );
private static $addonInfo = array( // i could have sworn that was somewhere in dbc public function __construct($params)
30 => [1, 0], {
31 => [1, 0], foreach ($this->setup as $query)
32 => [1, 0], DB::Aowow()->query($query);
33 => [1, 0], }
34 => [1, 0],
37 => [2, 0],
38 => [2, 1],
39 => [2, 1],
41 => [2, 1],
42 => [2, 1],
43 => [2, 1],
44 => [2, 0],
45 => [2, 1],
46 => [2, 1]
),
function setupPetSpells() function setupPetSpells()
{ {
@@ -71,15 +120,9 @@ class PetSetup extends PetList
function setupClassicMods() function setupClassicMods()
{ {
foreach (self::$classicMods as $pet => $mods) foreach ($this->classicMods as $pet => $mods)
DB::Aowow()->query('UPDATE ?_pet SET armor = ?d, damage = ?d, health = ?d WHERE id = ?d', $mods[0], $mods[1], $mods[2], $pet); DB::Aowow()->query('UPDATE ?_pet SET armor = ?d, damage = ?d, health = ?d WHERE id = ?d', $mods[0], $mods[1], $mods[2], $pet);
} }
function setupAddonInfo()
{
foreach (self::$addonInfo as $pet => $info)
DB::Aowow()->query('UPDATE ?_pet SET expansion = ?d, exotic = ?d WHERE id = ?d', $info[0], $info[1], $pet);
}
} }
?> ?>

View File

@@ -1,7 +1,7 @@
{strip} {strip}
new Listview({ldelim} new Listview({ldelim}
template:'npc', template:'npc',
{if !isset($params.id)}id:'spells',{/if} {if !isset($params.id)}id:'npcs',{/if}
{if !isset($params.name)}name:LANG.tab_npcs,{/if} {if !isset($params.name)}name:LANG.tab_npcs,{/if}
{if !isset($params.parent)}parent:'listview-generic',{/if} {if !isset($params.parent)}parent:'listview-generic',{/if}
{foreach name=params from=$params key=k item=v} {foreach name=params from=$params key=k item=v}

View File

@@ -12246,33 +12246,6 @@ Listview.templates = {
} }
} }
}, },
/* old: doesn't support text sent by server
getVisibleText: function(l) {
var h = {
achievements: g_achievements,
quests: g_quests
},
m = "",
d = 0;
for (var f in h) {
var g = h[f],
a = l[f];
if (!g || !a) {
continue
}
for (var e = 0, c = a.length; e < c; ++e) {
if (g[a[e]]) {
var b = (f == "achievements" ? "name": "name_" + g_locale.name);
if (d++>0) {
m += " "
}
m += g[a[e]][b]
}
}
}
return m
},
*/
getVisibleText: function(title) { getVisibleText: function(title) {
var buff = ''; var buff = '';