mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
- fixed variable names and ; in config.php.in
- moved effect- and aura-ids used to determine the type of a spell to static prop in spell.class.php - directly get achievements by criteria (automatic join) in spell.php - reverted back points needed for 1% arPen to 335 values (whyever i changed them in the first place)
This commit is contained in:
@@ -11,55 +11,56 @@ $AoWoWconf['aowow'] = array(
|
||||
'user' => 'root',
|
||||
'pass' => '',
|
||||
'db' => 'aowow',
|
||||
'prefix' => '',
|
||||
'prefix' => ''
|
||||
);
|
||||
|
||||
// -- World Database --
|
||||
// used to generate data-tables
|
||||
$AoWoWconf['world'] = array(
|
||||
'host' => '127.0.0.1';
|
||||
'user' => 'root';
|
||||
'pass' => '';
|
||||
'db' => 'world';
|
||||
'prefix' => '';
|
||||
'host' => '127.0.0.1',
|
||||
'user' => 'root',
|
||||
'pass' => '',
|
||||
'db' => 'world',
|
||||
'prefix' => ''
|
||||
);
|
||||
|
||||
// -- Auth Database --
|
||||
// used to generate user-tables
|
||||
$AoWoWconf['auth'] = array(
|
||||
'host' => '127.0.0.1';
|
||||
'user' => 'root';
|
||||
'pass' => '';
|
||||
'db' => 'auth';
|
||||
'prefix' => '';
|
||||
'host' => '127.0.0.1',
|
||||
'user' => 'root',
|
||||
'pass' => '',
|
||||
'db' => 'auth',
|
||||
'prefix' => ''
|
||||
);
|
||||
|
||||
// -- Characters Database --
|
||||
// used to display profiles
|
||||
$AoWoWconf['characters'][0] = array(
|
||||
'host' => '127.0.0.1';
|
||||
'user' => 'root';
|
||||
'pass' => '';
|
||||
'db' => 'characters';
|
||||
'prefix' => '';
|
||||
'host' => '127.0.0.1',
|
||||
'user' => 'root',
|
||||
'pass' => '',
|
||||
'db' => 'characters',
|
||||
'prefix' => ''
|
||||
);
|
||||
// add other realms if necessary
|
||||
// $AoWoWconf['characters'][1] = array();
|
||||
// $AoWoWconf['characters'][] = [];
|
||||
|
||||
// -- Site Configuration --
|
||||
$AoWoWconf['page']['cacheTimer'] = 60*60*24*7; // Time to keep cache in seconds (Default: 1 week)
|
||||
$AoWoWconf['page']['name'] = 'Aowow Database Viewer (ADV)'; // Title of the website
|
||||
$AoWoWconf['page']['shortName'] = 'Aowow'; // used in Feeds
|
||||
$AoWoWconf['ttl'] = 60; // time to live for RSS
|
||||
$AoWowConf['cookieTimeout'] = 5*60*1000; // cookie times out in time() + X
|
||||
$AoWoWconf['register'] = true; // Allow account creating
|
||||
// $AoWoWconf['loginFailCount'] = 5; // how often invalid passwords are tollerated
|
||||
// $AoWoWconf['loginFailTime'] = 15*60; // how long an account is closed after exceeding above limit
|
||||
// $AoWoWconf['contactEmail'] = "feedback@aowow.org"; // ah well...
|
||||
$AoWoWconf['limit'] = 300; // Limit of some SQL queries
|
||||
$AoWoWconf['debug'] = true; // Disable cache, show smarty console panel, enable sql-errors
|
||||
$AoWoWconf['map_grouping'] = 0; // Map object grouping factor. Meters = 10^param. 0:disabled; 1|2|3:enabled (1:recommended)
|
||||
$AoWoWconf['battlegroup'] = 'Pure Pwnage'; // pretend, we belong to a battlegroup to satisfy profiler-related Jscripts; region can be determined from realmlist.timezone
|
||||
$AoWoWconf['maintainance'] = false; // brb gnomes say hi
|
||||
$AoWoWconf['page']['cacheTimer'] = 1 * WEEK; // Time to keep cache in seconds (Default: 1 week)
|
||||
$AoWoWconf['page']['name'] = 'Aowow Database Viewer (ADV)'; // Title of the website
|
||||
$AoWoWconf['page']['shortName'] = 'Aowow'; // used in Feeds
|
||||
$AoWoWconf['ttl'] = 60; // time to live for RSS
|
||||
$AoWowConf['sessionTimeout'] = 1 * HOUR; // non-permanent session times out in time() + X
|
||||
$AoWoWconf['register'] = true; // Allow account creating
|
||||
// $AoWoWconf['loginFailCount'] = 5; // how often invalid passwords are tollerated
|
||||
// $AoWoWconf['loginFailTime'] = 15 * MINUTE; // how long an account is closed after exceeding above limit
|
||||
// $AoWoWconf['contactEmail'] = "feedback@aowow.org"; // ah well...
|
||||
$AoWoWconf['boardUrl'] = "http://www.wowhead.com/forums?board="; // a javascript thing..
|
||||
$AoWoWconf['sqlLimit'] = 300; // Limit of some SQL queries
|
||||
$AoWoWconf['debug'] = true; // Disable cache, show smarty console panel, enable sql-errors
|
||||
$AoWoWconf['map_grouping'] = 0; // Map object grouping factor. Meters = 10^param. 0:disabled; 1|2|3:enabled (1:recommended)
|
||||
$AoWoWconf['battlegroup'] = 'Pure Pwnage'; // pretend, we belong to a battlegroup to satisfy profiler-related Jscripts; region can be determined from realmlist.timezone
|
||||
$AoWoWconf['maintainance'] = false; // brb gnomes say hi
|
||||
|
||||
?>
|
||||
|
||||
@@ -25,7 +25,7 @@ $WH.g_convertRatingToPercent.RB = {
|
||||
35: 25,
|
||||
36: 10,
|
||||
37: 2.5,
|
||||
44: 3.756097412109376
|
||||
44: 4.69512176513672 / 1.1
|
||||
};
|
||||
|
||||
$WH.g_convertScalingFactor.SV = {
|
||||
|
||||
@@ -22,13 +22,27 @@ class SpellList extends BaseType
|
||||
10 => [98, 109, 111, 113, 115, 137, 138, 139, 140, 141, 313, 315, 673, 759], // Languages
|
||||
11 => [164, 165, 171, 182, 186, 197, 202, 333, 393, 755, 773] // prim. Professions
|
||||
);
|
||||
|
||||
public static $spellTypes = array(
|
||||
6 => 1,
|
||||
8 => 2,
|
||||
10 => 4
|
||||
);
|
||||
|
||||
public static $effects = array(
|
||||
'heal' => [ 0, 3, 10, 67, 75, 136 ], // <no effect>, Dummy, Heal, Heal Max Health, Heal Mechanical, Heal Percent
|
||||
'damage' => [ 0, 2, 3, 9, 62 ], // <no effect>, Dummy, School Damage, Health Leech, Power Burn
|
||||
'itemCreate' => [24, 34, 59, 66, 157 ], // createItem, changeItem, randomItem, createManaGem, createItem2
|
||||
'trigger' => [ 3, 32, 64, 101, 142, 148, 151, 152, 155, 160, 164], // dummy, trigger missile, trigger spell, feed pet, force cast, force cast with value, unk, trigger spell 2, unk, dualwield 2H, unk, remove aura
|
||||
'teach' => [36, 57, 133 ] // learn spell, learn pet spell, unlearn specialization
|
||||
);
|
||||
public static $auras = array(
|
||||
'heal' => [ 4, 8, 62, 69, 97, 226 ], // Dummy, Periodic Heal, Periodic Health Funnel, School Absorb, Mana Shield, Periodic Dummy
|
||||
'damage' => [ 3, 4, 15, 53, 89, 162, 226 ], // Periodic Damage, Dummy, Damage Shield, Periodic Health Leech, Periodic Damage Percent, Power Burn Mana, Periodic Dummy
|
||||
'itemCreate' => [86 ], // Channel Death Item
|
||||
'trigger' => [ 4, 23, 42, 48, 109, 226, 227, 231, 236, 284 ], // dummy; 23/227: periodic trigger spell (with value); 42/231: proc trigger spell (with value); 48: unk; 109: add target trigger; 226: periodic dummy; 236: control vehicle; 284: linked
|
||||
'teach' => [ ]
|
||||
);
|
||||
|
||||
private $spellVars = [];
|
||||
private $refSpells = [];
|
||||
private $tools = [];
|
||||
@@ -475,10 +489,8 @@ class SpellList extends BaseType
|
||||
public function canCreateItem()
|
||||
{
|
||||
$idx = [];
|
||||
// effect - 24: createItem; 34: changeItem; 59: randomItem; 66: createManaGem; 157: createItem2
|
||||
// aura - 86: channelDeathItem
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
if (in_array($this->curTpl['effect'.$i.'Id'], [24, 34, 59, 66, 157]) || in_array($this->curTpl['effect'.$i.'AuraId'], [86]))
|
||||
if (in_array($this->curTpl['effect'.$i.'Id'], SpellList::$effects['itemCreate']) || in_array($this->curTpl['effect'.$i.'AuraId'], SpellList::$auras['itemCreate']))
|
||||
if ($this->curTpl['effect'.$i.'CreateItemId'] > 0)
|
||||
$idx[] = $i;
|
||||
|
||||
@@ -488,16 +500,25 @@ class SpellList extends BaseType
|
||||
public function canTriggerSpell()
|
||||
{
|
||||
$idx = [];
|
||||
// effect - 3: dummy; 32: trigger missile; 36: learn spell; 57: learn pet spell; 64/151: trigger spell (2); 101: feed pet; 133: unlearn specialization; 140/142: force cast (with value); 148/152/160: unk; 155: dualwield 2H; 164: remove aura
|
||||
// aura - 4: dummy; 23/227: periodic trigger spell (with value); 42/231: proc trigger spell (with value); 48: unk; 109: add target trigger; 226: periodic dummy; 236: control vehicle; 284: linked
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
if (in_array($this->curTpl['effect'.$i.'Id'], [3, 32, 36, 57, 64, 101, 133, 142, 148, 151, 152, 155, 160, 164]) || in_array($this->curTpl['effect'.$i.'AuraId'], [4, 23, 42, 48, 109, 226, 227, 231, 236, 284]))
|
||||
if (in_array($this->curTpl['effect'.$i.'Id'], SpellList::$effects['trigger']) || in_array($this->curTpl['effect'.$i.'AuraId'], SpellList::$auras['trigger']))
|
||||
if ($this->curTpl['effect'.$i.'TriggerSpell'] > 0 || $this->curTpl['effect'.$i.'MiscValue'] > 0)
|
||||
$idx[] = $i;
|
||||
|
||||
return $idx;
|
||||
}
|
||||
|
||||
public function canTeachSpell()
|
||||
{
|
||||
$idx = [];
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
if (in_array($this->curTpl['effect'.$i.'Id'], SpellList::$effects['teach']) || in_array($this->curTpl['effect'.$i.'AuraId'], SpellList::$auras['teach']))
|
||||
if ($this->curTpl['effect'.$i.'TriggerSpell'] > 0)
|
||||
$idx[] = $i;
|
||||
|
||||
return $idx;
|
||||
}
|
||||
|
||||
public function isChanneledSpell()
|
||||
{
|
||||
return $this->curTpl['attributes1'] & 0x44;
|
||||
@@ -505,11 +526,8 @@ class SpellList extends BaseType
|
||||
|
||||
public function isHealingSpell()
|
||||
{
|
||||
$eff = [0, 3, 10, 67, 75, 136]; // <no effect>, Dummy, Heal, Heal Max Health, Heal Mechanical, Heal Percent
|
||||
$aur = [4, 8, 62, 69, 97, 226]; // Dummy, Periodic Heal, Periodic Health Funnel, School Absorb, Mana Shield, Periodic Dummy
|
||||
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
if (!in_array($this->curTpl['effect'.$i.'Id'], $eff) && !in_array($this->curTpl['effect'.$i.'AuraId'], $aur))
|
||||
if (!in_array($this->curTpl['effect'.$i.'Id'], SpellList::$effects['heal']) && !in_array($this->curTpl['effect'.$i.'AuraId'], SpellList::$auras['heal']))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -517,11 +535,8 @@ class SpellList extends BaseType
|
||||
|
||||
public function isDamagingSpell()
|
||||
{
|
||||
$eff = [0, 2, 3, 9, 62]; // <no effect>, Dummy, School Damage, Health Leech, Power Burn
|
||||
$aur = [3, 4, 15, 53, 89, 162, 226]; // Periodic Damage, Dummy, Damage Shield, Periodic Health Leech, Periodic Damage Percent, Power Burn Mana, Periodic Dummy
|
||||
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
if (!in_array($this->curTpl['effect'.$i.'Id'], $eff) && !in_array($this->curTpl['effect'.$i.'AuraId'], $aur))
|
||||
if (!in_array($this->curTpl['effect'.$i.'Id'], SpellList::$effects['damage']) && !in_array($this->curTpl['effect'.$i.'AuraId'], SpellList::$auras['damage']))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1583,15 +1598,12 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
|
||||
$data[$this->id]['type'] = $type;
|
||||
|
||||
// creates item
|
||||
for ($i = 1; $i <= 3; $i++)
|
||||
foreach ($this->canCreateItem() as $idx)
|
||||
{
|
||||
if ($this->curTpl['effect'.$i.'Id'] != 24)
|
||||
continue;
|
||||
$max = $this->curTpl['effect'.$idx.'DieSides'] + $this->curTpl['effect'.$idx.'BasePoints'];
|
||||
$min = $this->curTpl['effect'.$idx.'DieSides'] > 1 ? 1 : $max;
|
||||
|
||||
$max = $this->curTpl['effect'.$i.'DieSides'] + $this->curTpl['effect'.$i.'BasePoints'];
|
||||
$min = $this->curTpl['effect'.$i.'DieSides'] > 1 ? 1 : $max;
|
||||
|
||||
$data[$this->id]['creates'] = [$this->curTpl['effect'.$i.'CreateItemId'], $min, $max];
|
||||
$data[$this->id]['creates'] = [$this->curTpl['effect'.$idx.'CreateItemId'], $min, $max];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class Lang
|
||||
for ($i = 1; $i <= 5; $i++)
|
||||
{
|
||||
$prop = $lock['properties'.$i];
|
||||
$rnk = $lock['reqSkill'.$i];
|
||||
$rank = $lock['reqSkill'.$i];
|
||||
$name = '';
|
||||
|
||||
if ($lock['type'.$i] == 1) // opened by item
|
||||
@@ -87,7 +87,8 @@ class Lang
|
||||
}
|
||||
else if ($lock['type'.$i] == 2) // opened by skill
|
||||
{
|
||||
if (!in_array($prop, [1, 2, 3, 4, 9, 16, 20])) // exclude unusual stuff
|
||||
// exclude unusual stuff
|
||||
if (!in_array($prop, [1, 2, 3, 4, 9, 16, 20]))
|
||||
continue;
|
||||
|
||||
$txt = DB::Aowow()->selectRow('SELECT * FROM ?_locktype WHERE id = ?d', $prop); // todo (low): convert to static text
|
||||
@@ -110,8 +111,8 @@ class Lang
|
||||
$name = '<a href="?skill='.$skill.'">'.$name.'</a>';
|
||||
}
|
||||
|
||||
if ($rnk > 0)
|
||||
$name .= ' ('.$rnk.')';
|
||||
if ($rank > 0)
|
||||
$name .= ' ('.$rank.')';
|
||||
}
|
||||
else
|
||||
continue;
|
||||
@@ -167,7 +168,7 @@ class Lang
|
||||
$tmp = [];
|
||||
$strs = Lang::$spell[$class == ITEM_CLASS_ARMOR ? 'armorSubClass' : 'weaponSubClass'];
|
||||
foreach ($strs as $k => $str)
|
||||
if ($mask & 1 << $k && $str)
|
||||
if ($mask & (1 << $k) && $str)
|
||||
$tmp[] = $str;
|
||||
|
||||
return implode(', ', $tmp);
|
||||
@@ -602,10 +603,10 @@ class Util
|
||||
29, 30, null, null, null, 37, 44
|
||||
);
|
||||
|
||||
public static $gtCombatRatings = array(
|
||||
public static $gtCombatRatings = array( // 44 => 4.69512176513672 / 1.1
|
||||
12 => 1.5, 13 => 12, 14 => 15, 15 => 5, 16 => 10, 17 => 10, 18 => 8, 19 => 14, 20 => 14,
|
||||
21 => 14, 22 => 10, 23 => 10, 24 => 0, 25 => 0, 26 => 0, 27 => 0, 28 => 10, 29 => 10,
|
||||
30 => 10, 31 => 10, 32 => 14, 33 => 0, 34 => 0, 35 => 25, 36 => 10, 37 => 2.5, 44 => 3.756097412109376
|
||||
30 => 10, 31 => 10, 32 => 14, 33 => 0, 34 => 0, 35 => 25, 36 => 10, 37 => 2.5, 44 => 4.2682925138
|
||||
);
|
||||
|
||||
public static $lvlIndepRating = array( // rating doesn't scale with level
|
||||
@@ -1703,7 +1704,7 @@ class Util
|
||||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
return (is_int($keys) && in_array($keys, $struct)) || (is_array($keys) && isset($struct[$keys[0]]));
|
||||
return (is_int($keys) && in_array($keys, $struct)) || (is_array($keys) && (isset($struct[$keys[0]]) || $keys[0] === null && count($keys) == 1));
|
||||
case 2:
|
||||
if (!isset($struct[$keys[0]]))
|
||||
return false;
|
||||
|
||||
332
pages/spell.php
332
pages/spell.php
@@ -467,8 +467,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
// Iterate through all effects:
|
||||
$pageData['page']['effect'] = [];
|
||||
|
||||
$triggerIdx = $spell->canTriggerSpell();
|
||||
$itemIdx = $spell->canCreateItem();
|
||||
$spellIdx = array_unique(array_merge($spell->canTriggerSpell(), $spell->canTeachSpell()));
|
||||
$itemIdx = $spell->canCreateItem();
|
||||
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
{
|
||||
@@ -506,7 +506,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
$foo['icon']['count'] = "'".($effBP + 1).'-'.$foo['icon']['count']."'";
|
||||
}
|
||||
// .. from spell
|
||||
else if (in_array($i, $triggerIdx))
|
||||
else if (in_array($i, $spellIdx))
|
||||
{
|
||||
$_ = $spell->getField('effect'.$i.'TriggerSpell');
|
||||
if (!$_)
|
||||
@@ -529,7 +529,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
if ($spell->getField('effect'.$i.'RadiusMax') > 0)
|
||||
$foo['radius'] = $spell->getField('effect'.$i.'RadiusMax');
|
||||
|
||||
if (($effBP + $effDS) && !($itemIdx && $spell->relItems && !$spell->relItems->error) && (!in_array($i, $triggerIdx) || in_array($effAura, [225, 227])))
|
||||
if (($effBP + $effDS) && !($itemIdx && $spell->relItems && !$spell->relItems->error) && (!in_array($i, $spellIdx) || in_array($effAura, [225, 227])))
|
||||
$foo['value'] = ($effDS != 1 ? ($effBP + 1).Lang::$game['valueDelim'] : null).($effBP + $effDS);
|
||||
|
||||
if ($effRPPL != 0)
|
||||
@@ -1156,25 +1156,26 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
$ubItems->addGlobalsToJScript($smarty, GLOBALINFO_SELF);
|
||||
}
|
||||
|
||||
// tab: criteria of
|
||||
$_ = [ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL];
|
||||
if ($crs = DB::Aowow()->selectCol('SELECT refAchievement FROM ?_achievementCriteria WHERE type IN (?a) AND value1 = ?d', $_, $spell->id))
|
||||
$conditions = array(
|
||||
['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL,
|
||||
ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL]
|
||||
],
|
||||
['ac.value1', $_id]
|
||||
);
|
||||
$coAchievemnts = new AchievementList($conditions);
|
||||
if (!$coAchievemnts->error)
|
||||
{
|
||||
$coAchievemnts = new AchievementList(array(['id', $crs]));
|
||||
if (!$coAchievemnts->error)
|
||||
{
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'achievement',
|
||||
'data' => $coAchievemnts->getListviewData(),
|
||||
'params' => [
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'criteria-of',
|
||||
'name' => '$LANG.tab_criteriaof'
|
||||
]
|
||||
);
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'achievement',
|
||||
'data' => $coAchievemnts->getListviewData(),
|
||||
'params' => [
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'criteria-of',
|
||||
'name' => '$LANG.tab_criteriaof'
|
||||
]
|
||||
);
|
||||
|
||||
$coAchievemnts->addGlobalsToJScript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED);
|
||||
}
|
||||
$coAchievemnts->addGlobalsToJScript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED);
|
||||
}
|
||||
|
||||
// tab: contains
|
||||
@@ -1343,13 +1344,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
|
||||
|
||||
// tab: triggered by
|
||||
$eff = [3, 32, 64, 101, 133, 142, 148, 151, 152, 160, 164];
|
||||
$aur = [4, 23, 42, 48, 109, 226, 227, 231, 236, 284];
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['OR', ['effect1Id', $eff], ['effect1AuraId', $aur]], ['effect1TriggerSpell', $spell->id]],
|
||||
['AND', ['OR', ['effect2Id', $eff], ['effect2AuraId', $aur]], ['effect2TriggerSpell', $spell->id]],
|
||||
['AND', ['OR', ['effect3Id', $eff], ['effect3AuraId', $aur]], ['effect3TriggerSpell', $spell->id]],
|
||||
['AND', ['OR', ['effect1Id', SpellList::$effects['trigger']], ['effect1AuraId', SpellList::$auras['trigger']]], ['effect1TriggerSpell', $spell->id]],
|
||||
['AND', ['OR', ['effect2Id', SpellList::$effects['trigger']], ['effect2AuraId', SpellList::$auras['trigger']]], ['effect2TriggerSpell', $spell->id]],
|
||||
['AND', ['OR', ['effect3Id', SpellList::$effects['trigger']], ['effect3AuraId', SpellList::$auras['trigger']]], ['effect3TriggerSpell', $spell->id]],
|
||||
);
|
||||
|
||||
$trigger = new SpellList($conditions);
|
||||
@@ -1368,127 +1367,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
$trigger->addGlobalsToJScript($smarty, GLOBALINFO_SELF);
|
||||
}
|
||||
|
||||
// tab: taught by npc (source:6 => trainer)
|
||||
if (!empty($spell->sources[$_id]) && in_array(6, array_keys($spell->sources[$_id])))
|
||||
{
|
||||
$list = [];
|
||||
if (count($spell->sources[$_id][6]) == 1 && $spell->sources[$_id][6][0] == 0) // multiple trainer
|
||||
{
|
||||
$tt = null;
|
||||
if (in_array($_cat, [9, 11])) // Professions
|
||||
$tt = @Util::$trainerTemplates[TYPE_SKILL][$spell->getField('skillLines')[0]];
|
||||
else if ($_cat == 7 && $spell->getField('reqClassMask')) // Class Spells
|
||||
{
|
||||
$clId = log($spell->getField('reqClassMask'), 2) + 1 ;
|
||||
if (intVal($clId) == $clId) // only one class was set, so float == int
|
||||
$tt = @Util::$trainerTemplates[TYPE_CLASS][$clId];
|
||||
}
|
||||
|
||||
if ($tt)
|
||||
$list = DB::Aowow()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', $tt);
|
||||
else
|
||||
{
|
||||
$mask = 0;
|
||||
foreach (Util::$skillLineMask[-3] as $idx => $pair)
|
||||
if ($pair[1] == $_id)
|
||||
$mask |= 1 << $idx;
|
||||
|
||||
$list = DB::Aowow()->selectCol('
|
||||
SELECT IF(t1.entry > 200000, t2.entry, t1.entry)
|
||||
FROM npc_trainer t1
|
||||
LEFT JOIN npc_trainer t2 ON t2.spell = -t1.entry
|
||||
WHERE t1.spell = ?d',
|
||||
$_id
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
$list = [];
|
||||
|
||||
if ($list)
|
||||
{
|
||||
$tbTrainer = new CreatureList(array(0, ['ct.id', $list], ['ct.spawns', 0, '>'], ['ct.npcflag', 0x10, '&']));
|
||||
if (!$tbTrainer->error)
|
||||
{
|
||||
$tbTrainer->addGlobalsToJscript($smarty);
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'creature',
|
||||
'data' => $tbTrainer->getListviewData(),
|
||||
'params' => array(
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'taught-by-npc',
|
||||
'name' => '$LANG.tab_taughtby',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tab: taught by spell (36:self, 57:pet)
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['effect1Id', [36, 57]], ['effect1TriggerSpell', $spell->id]],
|
||||
['AND', ['effect2Id', [36, 57]], ['effect2TriggerSpell', $spell->id]],
|
||||
['AND', ['effect3Id', [36, 57]], ['effect3TriggerSpell', $spell->id]],
|
||||
);
|
||||
|
||||
$tbSpell = new SpellList($conditions);
|
||||
if (!$tbSpell->error)
|
||||
{
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'spell',
|
||||
'data' => $tbSpell->getListviewData(),
|
||||
'params' => [
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'taught-by-spell',
|
||||
'name' => '$LANG.tab_taughtby'
|
||||
]
|
||||
);
|
||||
|
||||
$tbSpell->addGlobalsToJScript($smarty, GLOBALINFO_SELF);
|
||||
}
|
||||
|
||||
// tab: taught by item (i'd like to precheck $spell->sources, but there is no source:item only complicated crap like "drop" and "vendor")
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['spellTrigger1', 6], ['spellId1', $spell->id]],
|
||||
['AND', ['spellTrigger2', 6], ['spellId2', $spell->id]],
|
||||
['AND', ['spellTrigger3', 6], ['spellId3', $spell->id]],
|
||||
['AND', ['spellTrigger4', 6], ['spellId4', $spell->id]],
|
||||
['AND', ['spellTrigger5', 6], ['spellId5', $spell->id]],
|
||||
);
|
||||
|
||||
|
||||
$tbItem = new ItemList($conditions);
|
||||
if (!$tbItem->error)
|
||||
{
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'item',
|
||||
'data' => $tbItem->getListviewData(),
|
||||
'params' => [
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'taught-by-item',
|
||||
'name' => '$LANG.tab_taughtby'
|
||||
]
|
||||
);
|
||||
|
||||
$tbItem->addGlobalsToJScript($smarty, GLOBALINFO_SELF);
|
||||
}
|
||||
|
||||
// find associated NPC, Item and merge results
|
||||
// taughtbypets (unused..?)
|
||||
// taughtbyquest
|
||||
// taughtbytrainers
|
||||
// taughtbyitem
|
||||
|
||||
// tab: teaches
|
||||
// -> spell_learn_spell
|
||||
// -> skill_discovery_template
|
||||
|
||||
/* NEW
|
||||
conditions
|
||||
*/
|
||||
|
||||
// used by - creature
|
||||
// SMART_SCRIPT_TYPE_CREATURE = 0; SMART_ACTION_CAST = 11; SMART_ACTION_ADD_AURA = 75; SMART_ACTION_INVOKER_CAST = 85; SMART_ACTION_CROSS_CAST = 86
|
||||
$smart = DB::Aowow()->selectCol('SELECT entryOrGUID FROM smart_scripts WHERE entryorguid > 0 AND source_type = 0 AND action_type IN (11, 75, 85, 86) AND action_param1 = ?d', $_id);
|
||||
@@ -1537,6 +1415,166 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
}
|
||||
}
|
||||
|
||||
// tab: teaches
|
||||
$_ = [];
|
||||
foreach ($spell->canTeachSpell() as $idx)
|
||||
$_[] = $spell->getField('effect'.$idx.'TriggerSpell');
|
||||
|
||||
$ids = array_merge(
|
||||
DB::Aowow()->selectCol('SELECT spellId FROM spell_learn_spell WHERE entry = ?d', $_id),
|
||||
DB::Aowow()->selectCol('SELECT spellId FROM skill_discovery_template WHERE reqSpell = ?d', $_id), // note: omits required spell and chance
|
||||
$_
|
||||
);
|
||||
|
||||
if ($ids)
|
||||
{
|
||||
$teaches = new SpellList(array(['id', $ids]));
|
||||
if (!$teaches->error)
|
||||
{
|
||||
$teaches->addGlobalsToJScript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED);
|
||||
$vis = ['level', 'schools'];
|
||||
$hid = [];
|
||||
if (!$teaches->hasSetFields(['skillLines']))
|
||||
$hid[] = 'skill';
|
||||
|
||||
foreach ($teaches->iterate() as $__)
|
||||
{
|
||||
if (!$teaches->canCreateItem())
|
||||
continue;
|
||||
|
||||
$vis[] = 'reagents';
|
||||
break;
|
||||
}
|
||||
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'spell',
|
||||
'data' => $teaches->getListviewData(),
|
||||
'params' => [
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'teaches-spell',
|
||||
'name' => '$LANG.tab_teaches',
|
||||
'visibleCols' => '$'.json_encode($vis),
|
||||
'hiddenCols' => $hid ? '$'.json_encode($hid) : null
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// tab: taught by npc (source:6 => trainer)
|
||||
if (!empty($spell->sources[$_id]) && in_array(6, array_keys($spell->sources[$_id])))
|
||||
{
|
||||
$list = [];
|
||||
if (count($spell->sources[$_id][6]) == 1 && $spell->sources[$_id][6][0] == 0) // multiple trainer
|
||||
{
|
||||
$tt = null;
|
||||
if (in_array($_cat, [9, 11])) // Professions
|
||||
$tt = @Util::$trainerTemplates[TYPE_SKILL][$spell->getField('skillLines')[0]];
|
||||
else if ($_cat == 7 && $spell->getField('reqClassMask')) // Class Spells
|
||||
{
|
||||
$clId = log($spell->getField('reqClassMask'), 2) + 1 ;
|
||||
if (intVal($clId) == $clId) // only one class was set, so float == int
|
||||
$tt = @Util::$trainerTemplates[TYPE_CLASS][$clId];
|
||||
}
|
||||
|
||||
if ($tt)
|
||||
$list = DB::Aowow()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', $tt);
|
||||
else
|
||||
{
|
||||
$mask = 0;
|
||||
foreach (Util::$skillLineMask[-3] as $idx => $pair)
|
||||
if ($pair[1] == $_id)
|
||||
$mask |= 1 << $idx;
|
||||
|
||||
$list = DB::Aowow()->selectCol('
|
||||
SELECT IF(t1.entry > 200000, t2.entry, t1.entry)
|
||||
FROM npc_trainer t1
|
||||
LEFT JOIN npc_trainer t2 ON t2.spell = -t1.entry
|
||||
WHERE t1.spell = ?d',
|
||||
$_id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($list)
|
||||
{
|
||||
$tbTrainer = new CreatureList(array(0, ['ct.id', $list], ['ct.spawns', 0, '>'], ['ct.npcflag', 0x10, '&']));
|
||||
if (!$tbTrainer->error)
|
||||
{
|
||||
$tbTrainer->addGlobalsToJscript($smarty);
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'creature',
|
||||
'data' => $tbTrainer->getListviewData(),
|
||||
'params' => array(
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'taught-by-npc',
|
||||
'name' => '$LANG.tab_taughtby',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tab: taught by spell
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['effect1Id', SpellList::$effects['teach']], ['effect1TriggerSpell', $spell->id]],
|
||||
['AND', ['effect2Id', SpellList::$effects['teach']], ['effect2TriggerSpell', $spell->id]],
|
||||
['AND', ['effect3Id', SpellList::$effects['teach']], ['effect3TriggerSpell', $spell->id]],
|
||||
);
|
||||
|
||||
$tbSpell = new SpellList($conditions);
|
||||
if (!$tbSpell->error)
|
||||
{
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'spell',
|
||||
'data' => $tbSpell->getListviewData(),
|
||||
'params' => [
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'taught-by-spell',
|
||||
'name' => '$LANG.tab_taughtby'
|
||||
]
|
||||
);
|
||||
|
||||
$tbSpell->addGlobalsToJScript($smarty, GLOBALINFO_SELF);
|
||||
}
|
||||
|
||||
// tab: taught by item (i'd like to precheck $spell->sources, but there is no source:item only complicated crap like "drop" and "vendor")
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['spellTrigger1', 6], ['spellId1', $spell->id]],
|
||||
['AND', ['spellTrigger2', 6], ['spellId2', $spell->id]],
|
||||
['AND', ['spellTrigger3', 6], ['spellId3', $spell->id]],
|
||||
['AND', ['spellTrigger4', 6], ['spellId4', $spell->id]],
|
||||
['AND', ['spellTrigger5', 6], ['spellId5', $spell->id]],
|
||||
);
|
||||
|
||||
$tbItem = new ItemList($conditions);
|
||||
if (!$tbItem->error)
|
||||
{
|
||||
$pageData['relTabs'][] = array(
|
||||
'file' => 'item',
|
||||
'data' => $tbItem->getListviewData(),
|
||||
'params' => [
|
||||
'tabs' => '$tabsRelated',
|
||||
'id' => 'taught-by-item',
|
||||
'name' => '$LANG.tab_taughtby'
|
||||
]
|
||||
);
|
||||
|
||||
$tbItem->addGlobalsToJScript($smarty, GLOBALINFO_SELF);
|
||||
}
|
||||
|
||||
// find associated NPC, Item and merge results
|
||||
// taughtbypets (unused..?)
|
||||
// taughtbyquest (usually the spell casted as quest reward teaches something; exclude those seplls from taughtBySpell)
|
||||
// taughtbytrainers
|
||||
// taughtbyitem
|
||||
|
||||
|
||||
/* NEW
|
||||
conditions
|
||||
*/
|
||||
|
||||
$smarty->saveCache($cacheKeyPage, $pageData);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user