mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Types
dropped single-item classes for all types, because it doesn't make much difference to use a list with a single item instead, especially if it's preselected. Additionally it is now easier to chain certain queries together and execute them all at once. additionally, additionally certain data can now be cahced and shared between types of the same .. type, that were previously in different instances alltogether. And you may now specify a limit to sql-queries (while setting up a typeList), it will default to the config-limit if no value is given.
This commit is contained in:
@@ -3,51 +3,133 @@
|
|||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
class Achievement extends BaseType
|
class AchievementList extends BaseType
|
||||||
{
|
{
|
||||||
public $criteria = [];
|
public $criteria = [];
|
||||||
public $tooltip = '';
|
public $tooltip = [];
|
||||||
|
|
||||||
protected $setupQuery = "SELECT * FROM ?_achievement WHERE `Id` = ?";
|
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_achievement WHERE [filter] [cond] GROUP BY Id ORDER BY `orderInGroup` ASC';
|
||||||
|
protected $matchQuery = 'SELECT COUNT(1) FROM ?_achievement WHERE [filter] [cond]';
|
||||||
|
|
||||||
public function __construct($data)
|
public function __construct($conditions)
|
||||||
{
|
{
|
||||||
parent::__construct($data);
|
parent::__construct($conditions);
|
||||||
|
|
||||||
// post processing
|
// post processing
|
||||||
if (!$this->template['iconString'])
|
while ($this->iterate())
|
||||||
$this->template['iconString'] = 'INV_Misc_QuestionMark';
|
{
|
||||||
|
if (!$this->curTpl['iconString'])
|
||||||
|
$this->templates[$this->Id]['iconString'] = 'INV_Misc_QuestionMark';
|
||||||
|
|
||||||
|
//"rewards":[[11,137],[3,138]] [type, typeId]
|
||||||
|
if (!empty($this->curTpl['rewardIds']))
|
||||||
|
{
|
||||||
|
$rewards = [];
|
||||||
|
$rewIds = explode(" ", $this->curTpl['rewardIds']);
|
||||||
|
foreach ($rewIds as $rewId)
|
||||||
|
$rewards[] = ($rewId > 0 ? [TYPE_ITEM => $rewId] : ($rewId < 0 ? [TYPE_TITLE => -$rewId] : NULL));
|
||||||
|
|
||||||
|
$this->templates[$this->Id]['rewards'] = $rewards;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->reset(); // restore 'iterator'
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addRewardsToJScript(&$refs)
|
||||||
|
{
|
||||||
|
// collect Ids to execute in single query
|
||||||
|
$lookup = [];
|
||||||
|
|
||||||
|
while ($this->iterate())
|
||||||
|
{
|
||||||
|
$rewards = explode(" ", $this->curTpl['rewardIds']);
|
||||||
|
|
||||||
|
foreach ($rewards as $reward)
|
||||||
|
{
|
||||||
|
if ($reward > 0)
|
||||||
|
$lookup['item'][] = $reward;
|
||||||
|
else if ($reward < 0)
|
||||||
|
$lookup['title'][] = -$reward;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($lookup['item']))
|
||||||
|
(new ItemList(array(['i.entry', array_unique($lookup['item'])])))->addGlobalsToJscript($refs);
|
||||||
|
|
||||||
|
if (isset($lookup['title']))
|
||||||
|
(new TitleList(array(['Id', array_unique($lookup['title'])])))->addGlobalsToJscript($refs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addGlobalsToJscript(&$refs)
|
||||||
|
{
|
||||||
|
if (!isset($refs['gAchievements']))
|
||||||
|
$refs['gAchievements'] = [];
|
||||||
|
|
||||||
|
while ($this->iterate())
|
||||||
|
{
|
||||||
|
$refs['gAchievements'][$this->Id] = array(
|
||||||
|
'icon' => $this->curTpl['iconString'],
|
||||||
|
'name' => Util::localizedString($this->curTpl, 'name')
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getListviewData()
|
public function getListviewData()
|
||||||
{
|
{
|
||||||
return array(
|
$data = [];
|
||||||
'id' => $this->Id,
|
|
||||||
'name' => Util::localizedString($this->template, 'name'),
|
while ($this->iterate())
|
||||||
'description' => Util::localizedString($this->template, 'description'),
|
{
|
||||||
'points' => $this->template['points'],
|
$data[$this->Id] = array(
|
||||||
'faction' => $this->template['faction'] + 1,
|
'id' => $this->Id,
|
||||||
'category' => $this->template['category'],
|
'name' => Util::localizedString($this->curTpl, 'name'),
|
||||||
'parentCat' => $this->template['parentCat'],
|
'description' => Util::localizedString($this->curTpl, 'description'),
|
||||||
'rewards' => empty($this->template['rewards']) ? NULL : $this->template['rewards'],
|
'points' => $this->curTpl['points'],
|
||||||
'reward' => empty($this->template['reward_loc'.User::$localeId]) ? NULL : Util::localizedString($this->template, 'reward'),
|
'faction' => $this->curTpl['faction'] + 1,
|
||||||
);
|
'category' => $this->curTpl['category'],
|
||||||
|
'parentCat' => $this->curTpl['parentCat'],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!empty($this->curTpl['rewards']))
|
||||||
|
{
|
||||||
|
$rewards = [];
|
||||||
|
|
||||||
|
foreach ($this->curTpl['rewards'] as $pair)
|
||||||
|
$rewards[] = '['.key($pair).','.current($pair).']';
|
||||||
|
|
||||||
|
$data[$this->Id]['rewards'] = '['.implode(',', $rewards).']';
|
||||||
|
}
|
||||||
|
else if (!empty ($this->curTpl['reward']))
|
||||||
|
$data[$this->Id]['reward'] = Util::localizedString($this->curTpl, 'reward');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hmm, really needed? .. probably .. needs rename? .. also probably
|
// hmm, really needed? .. probably .. needs rename? .. also probably
|
||||||
public function getDetailedData()
|
public function getDetailedData()
|
||||||
{
|
{
|
||||||
return array(
|
$data = [];
|
||||||
'id' => $this->Id,
|
|
||||||
'name' => Util::localizedString($this->template, 'name'),
|
while ($this->iterate())
|
||||||
'description' => Util::localizedString($this->template, 'description'),
|
{
|
||||||
'points' => $this->template['points'],
|
$data[$this->Id] = array(
|
||||||
'iconname' => $this->template['iconString'],
|
'id' => $this->Id,
|
||||||
'count' => $this->template['reqCriteriaCount'],
|
'name' => Util::localizedString($this->curTpl, 'name'),
|
||||||
'reward' => empty($this->template['reward_loc'.User::$localeId]) ? NULL : Util::localizedString($this->template, 'reward'),
|
'description' => Util::localizedString($this->curTpl, 'description'),
|
||||||
);
|
'points' => $this->curTpl['points'],
|
||||||
|
'iconname' => $this->curTpl['iconString'],
|
||||||
|
'count' => $this->curTpl['reqCriteriaCount'],
|
||||||
|
'reward' => empty($this->curTpl['reward_loc'.User::$localeId]) ? NULL : Util::localizedString($this->curTpl, 'reward')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only for current template
|
||||||
public function getCriteria($idx = -1)
|
public function getCriteria($idx = -1)
|
||||||
{
|
{
|
||||||
if (empty($this->criteria))
|
if (empty($this->criteria))
|
||||||
@@ -57,63 +139,29 @@ class Achievement extends BaseType
|
|||||||
return [];
|
return [];
|
||||||
|
|
||||||
if (is_array($result[0]))
|
if (is_array($result[0]))
|
||||||
$this->criteria = $result;
|
$this->criteria[$this->Id] = $result;
|
||||||
else
|
else
|
||||||
$this->criteria[] = $result;
|
$this->criteria[$this->Id][] = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($idx < 0)
|
if ($idx < 0)
|
||||||
return $this->criteria;
|
return $this->criteria[$this->Id];
|
||||||
else
|
else
|
||||||
return $this->criteria[$idx];
|
return $this->criteria[$this->Id][$idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addGlobalsToJScript(&$gAchievements)
|
public function renderTooltip()
|
||||||
{
|
{
|
||||||
$gAchievements[$this->Id] = array(
|
if (!empty($this->tooltip[$this->Id]))
|
||||||
'icon' => $this->template['iconString'],
|
return $this->tooltip[$this->Id];
|
||||||
'name' => Util::localizedString($this->template, 'name'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addRewardsToJscript(&$gItems, &$gTitles)
|
|
||||||
{
|
|
||||||
$rewards = explode(" ", $this->template['rewardIds']);
|
|
||||||
|
|
||||||
$lookup = [];
|
|
||||||
foreach ($rewards as $reward)
|
|
||||||
{
|
|
||||||
if ($reward > 0)
|
|
||||||
$lookup['item'][] = $reward;
|
|
||||||
else if ($reward < 0)
|
|
||||||
$lookup['title'][] = -$reward;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($lookup['item']))
|
|
||||||
{
|
|
||||||
$rewItems = new ItemList(array(['i.entry', $lookup['item']]));
|
|
||||||
$rewItems->addGlobalsToJScript($gItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($lookup['title']))
|
|
||||||
{
|
|
||||||
$rewTitles = new TitleList(array(['Id', $lookup['title']]));
|
|
||||||
$rewTitles->addGlobalsToJScript($gTitles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function createTooltip()
|
|
||||||
{
|
|
||||||
if (!empty($this->tooltip))
|
|
||||||
return $this->tooltip;
|
|
||||||
|
|
||||||
$criteria = $this->getCriteria();
|
$criteria = $this->getCriteria();
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
$rows = [];
|
$rows = [];
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($criteria as $_row)
|
foreach ($criteria as $_row)
|
||||||
{
|
{
|
||||||
if($i++ % 2)
|
if ($i++ % 2)
|
||||||
$tmp[] = $_row;
|
$tmp[] = $_row;
|
||||||
else
|
else
|
||||||
$rows[] = $_row;
|
$rows[] = $_row;
|
||||||
@@ -121,9 +169,9 @@ class Achievement extends BaseType
|
|||||||
if ($tmp)
|
if ($tmp)
|
||||||
$rows = array_merge($rows, $tmp);
|
$rows = array_merge($rows, $tmp);
|
||||||
|
|
||||||
$description = Util::localizedString($this->template, 'description');
|
$description = Util::localizedString($this->curTpl, 'description');
|
||||||
$name = Util::localizedString($this->template, 'name');
|
$name = Util::localizedString($this->curTpl, 'name');
|
||||||
$criteria = '';
|
$criteria = '';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($rows as $crt)
|
foreach ($rows as $crt)
|
||||||
@@ -148,7 +196,7 @@ class Achievement extends BaseType
|
|||||||
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
|
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
|
||||||
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
|
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
|
||||||
if (!$crtName)
|
if (!$crtName)
|
||||||
$crtName = Item::getName($crt['value1']);
|
$crtName = Util::getItemName($crt['value1']);
|
||||||
break;
|
break;
|
||||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
|
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
|
||||||
if (!$crtName)
|
if (!$crtName)
|
||||||
@@ -184,88 +232,29 @@ class Achievement extends BaseType
|
|||||||
$x .= '</td></tr></table>';
|
$x .= '</td></tr></table>';
|
||||||
|
|
||||||
// Completed
|
// Completed
|
||||||
$this->tooltip = $x;
|
$this->tooltip[$this->Id] = $x;
|
||||||
|
|
||||||
return $this->tooltip;
|
return $this->tooltip[$this->Id];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSourceData()
|
public function getSourceData()
|
||||||
{
|
{
|
||||||
return array(
|
$data = [];
|
||||||
"n" => Util::localizedString($this->template, 'name'),
|
|
||||||
"s" => $this->template['faction'],
|
|
||||||
"t" => TYPE_ACHIEVEMENT,
|
|
||||||
"ti" => $this->Id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
while ($this->iterate())
|
||||||
|
|
||||||
class AchievementList extends BaseTypeList
|
|
||||||
{
|
|
||||||
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_achievement WHERE [filter] [cond] GROUP BY Id ORDER BY `orderInGroup` ASC';
|
|
||||||
|
|
||||||
public function __construct($conditions)
|
|
||||||
{
|
|
||||||
// may be called without filtering
|
|
||||||
if (class_exists('AchievementFilter'))
|
|
||||||
{
|
{
|
||||||
$this->filter = new AchievementFilter();
|
$data[$this->Id] = array(
|
||||||
if (($fiData = $this->filter->init()) === false)
|
"n" => Util::localizedString($this->curTpl, 'name'),
|
||||||
return;
|
"s" => $this->curTpl['faction'],
|
||||||
|
"t" => TYPE_ACHIEVEMENT,
|
||||||
|
"ti" => $this->Id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($conditions);
|
return $data;
|
||||||
|
|
||||||
// post processing
|
|
||||||
foreach ($this->container as $k => $acv)
|
|
||||||
{
|
|
||||||
//"rewards":[[11,137],[3,138]] [what, entry] 3:item; 11:title, 6:spell(unused)
|
|
||||||
if (!empty($acv->template['rewardIds']))
|
|
||||||
{
|
|
||||||
$rewards = [];
|
|
||||||
$rewIds = explode(" ", $acv->template['rewardIds']);
|
|
||||||
foreach ($rewIds as $rewId)
|
|
||||||
$rewards[] = ($rewId > 0 ? "[3,".$rewId."]" : ($rewId < 0 ? "[11,".-$rewId."]" : NULL));
|
|
||||||
|
|
||||||
$this->container[$k]->template['rewards'] = "[".implode(",",$rewards)."]";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRewardsToJScript(&$gItems, &$gTitles)
|
// run once .. should this even be here..?
|
||||||
{
|
|
||||||
// collect Ids to execute in single query
|
|
||||||
$lookup = [];
|
|
||||||
|
|
||||||
foreach ($this->container as $id => $data)
|
|
||||||
{
|
|
||||||
$rewards = explode(" ", $data->template['rewardIds']);
|
|
||||||
|
|
||||||
foreach ($rewards as $reward)
|
|
||||||
{
|
|
||||||
if ($reward > 0)
|
|
||||||
$lookup['item'][] = $reward;
|
|
||||||
else if ($reward < 0)
|
|
||||||
$lookup['title'][] = -$reward;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($lookup['item']))
|
|
||||||
{
|
|
||||||
$rewItems = new ItemList(array(['i.entry', array_unique($lookup['item'])]));
|
|
||||||
$rewItems->addGlobalsToJScript($gItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($lookup['title']))
|
|
||||||
{
|
|
||||||
$rewTitles = new TitleList(array(['Id', array_unique($lookup['title'])]));
|
|
||||||
$rewTitles->addGlobalsToJScript($gTitles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// run once
|
|
||||||
public function setupAchievements()
|
public function setupAchievements()
|
||||||
{
|
{
|
||||||
set_time_limit(120);
|
set_time_limit(120);
|
||||||
@@ -309,21 +298,21 @@ class AchievementList extends BaseTypeList
|
|||||||
world.achievement_dbc"
|
world.achievement_dbc"
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($this->container as $acv)
|
while ($this->iterate())
|
||||||
{
|
{
|
||||||
// set iconString
|
// set iconString
|
||||||
$icon = DB::Aowow()->SelectCell('SELECT iconname FROM ?_spellicons WHERE id = ?d', $acv->template['iconId']);
|
$icon = DB::Aowow()->SelectCell('SELECT iconname FROM ?_spellicons WHERE id = ?d', $this->curTpl['iconId']);
|
||||||
|
|
||||||
// set parentCat
|
// set parentCat
|
||||||
$parentCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE Id = ?d', $acv->template['category']);
|
$parentCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE Id = ?d', $this->curTpl['category']);
|
||||||
|
|
||||||
// series parent(16) << child(16)
|
// series parent(16) << child(16)
|
||||||
$series = $acv->template['parent'] << 16;
|
$series = $this->curTpl['parent'] << 16;
|
||||||
$series |= DB::Aowow()->SelectCell('SELECT Id FROM ?_achievement WHERE parent = ?d', $acv->Id);
|
$series |= DB::Aowow()->SelectCell('SELECT Id FROM ?_achievement WHERE parent = ?d', $acv->Id);
|
||||||
|
|
||||||
// set rewards
|
// set rewards
|
||||||
$rewardIds = [];
|
$rewardIds = [];
|
||||||
if ($rStr = $acv->template['reward_loc0'])
|
if ($rStr = $this->curTpl['reward_loc0'])
|
||||||
{
|
{
|
||||||
|
|
||||||
// i can haz title?
|
// i can haz title?
|
||||||
@@ -384,4 +373,5 @@ class AchievementList extends BaseTypeList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
?>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,29 +3,42 @@
|
|||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
class Quest extends BaseType
|
class QuestList extends BaseType
|
||||||
{
|
{
|
||||||
public $cat1 = 0;
|
public $cat1 = 0;
|
||||||
public $cat2 = 0;
|
public $cat2 = 0;
|
||||||
|
|
||||||
protected $setupQuery = 'SELECT * FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE a.Id = ?';
|
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE [filter] [cond] ORDER BY Id ASC';
|
||||||
|
protected $matchQuery = 'SELECT COUNT(1) FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE [filter] [cond]';
|
||||||
|
|
||||||
public function __construct($data)
|
// parent::__construct does the job
|
||||||
|
|
||||||
|
public function iterate($qty = 1)
|
||||||
{
|
{
|
||||||
parent::__construct($data);
|
$r = parent::iterate($qty);
|
||||||
|
|
||||||
// post process
|
if (!$this->Id)
|
||||||
$this->cat1 = $this->template['ZoneOrSort']; // should probably be in a method...
|
|
||||||
foreach (Util::$questClasses as $k => $arr)
|
|
||||||
{
|
{
|
||||||
if (in_array($this->cat1, $arr))
|
$this->cat1 = 0;
|
||||||
|
$this->cat2 = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->cat1 = $this->curTpl['ZoneOrSort']; // should probably be in a method...
|
||||||
|
foreach (Util::$questClasses as $k => $arr)
|
||||||
{
|
{
|
||||||
$this->cat2 = $k;
|
if (in_array($this->cat1, $arr))
|
||||||
break;
|
{
|
||||||
|
$this->cat2 = $k;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static use START
|
||||||
public static function getName($id)
|
public static function getName($id)
|
||||||
{
|
{
|
||||||
$n = DB::Aowow()->SelectRow('
|
$n = DB::Aowow()->SelectRow('
|
||||||
@@ -54,160 +67,114 @@ class Quest extends BaseType
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// static use END
|
||||||
|
|
||||||
public function getSourceData()
|
public function getSourceData()
|
||||||
{
|
{
|
||||||
return array(
|
$data = [];
|
||||||
"n" => Util::localizedString($this->template, 'Title'),
|
|
||||||
"t" => TYPE_QUEST,
|
|
||||||
"ti" => $this->Id,
|
|
||||||
"c" => $this->cat1,
|
|
||||||
"c2" => $this->cat2
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getListviewData()
|
while ($this->iterate())
|
||||||
{
|
{
|
||||||
$data = array(
|
$data[$this->Id] = array(
|
||||||
'category' => $this->cat1,
|
"n" => Util::localizedString($this->curTpl, 'Title'),
|
||||||
'category2' => $this->cat2,
|
"t" => TYPE_QUEST,
|
||||||
'id' => $this->Id,
|
"ti" => $this->Id,
|
||||||
'level' => $this->template['Level'],
|
"c" => $this->cat1,
|
||||||
'reqlevel' => $this->template['MinLevel'],
|
"c2" => $this->cat2
|
||||||
'name' => Util::localizedString($this->template, 'Title'),
|
);
|
||||||
'side' => Util::sideByRaceMask($this->template['RequiredRaces'])
|
}
|
||||||
);
|
|
||||||
|
|
||||||
$rewards = [];
|
|
||||||
for ($i = 1; $i < 5; $i++)
|
|
||||||
if ($this->template['RewardItemId'.$i])
|
|
||||||
$rewards[] = [$this->template['RewardItemId'.$i], $this->template['RewardItemCount'.$i]];
|
|
||||||
|
|
||||||
$choices = [];
|
|
||||||
for ($i = 1; $i < 7; $i++)
|
|
||||||
if ($this->template['RewardChoiceItemId'.$i])
|
|
||||||
$choices[] = [$this->template['RewardChoiceItemId'.$i], $this->template['RewardChoiceItemCount'.$i]];
|
|
||||||
|
|
||||||
if (!empty($rewards))
|
|
||||||
$data['itemrewards'] = $rewards;
|
|
||||||
|
|
||||||
if (!empty($choices))
|
|
||||||
$data['itemchoices'] = $choices;
|
|
||||||
|
|
||||||
if ($this->template['RewardTitleId'])
|
|
||||||
$data['titlereward'] = $this->template['RewardTitleId'];
|
|
||||||
|
|
||||||
// todo reprewards .. accesses QuestFactionReward.dbc
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRewardsToJscript(&$gItems, &$gSpells, &$gTitles)
|
public function getListviewData()
|
||||||
{
|
{
|
||||||
// items
|
$data = [];
|
||||||
$items = [];
|
|
||||||
for ($i = 1; $i < 5; $i++)
|
|
||||||
if ($this->template['RewardItemId'.$i])
|
|
||||||
$items[] = $this->template['RewardItemId'.$i];
|
|
||||||
|
|
||||||
for ($i = 1; $i < 7; $i++)
|
while ($this->iterate())
|
||||||
if ($this->template['RewardChoiceItemId'.$i])
|
|
||||||
$items[] = $this->template['RewardChoiceItemId'.$i];
|
|
||||||
|
|
||||||
if (!empty($items))
|
|
||||||
{
|
{
|
||||||
$items = new ItemList(array(['entry', $items]));
|
$set = array(
|
||||||
$items->addSelfToJScipt($gItems);
|
'category' => $this->cat1,
|
||||||
|
'category2' => $this->cat2,
|
||||||
|
'id' => $this->Id,
|
||||||
|
'level' => $this->curTpl['Level'],
|
||||||
|
'reqlevel' => $this->curTpl['MinLevel'],
|
||||||
|
'name' => Util::localizedString($this->curTpl, 'Title'),
|
||||||
|
'side' => Util::sideByRaceMask($this->curTpl['RequiredRaces'])
|
||||||
|
);
|
||||||
|
|
||||||
|
$rewards = [];
|
||||||
|
for ($i = 1; $i < 5; $i++)
|
||||||
|
if ($this->curTpl['RewardItemId'.$i])
|
||||||
|
$rewards[] = [$this->curTpl['RewardItemId'.$i], $this->curTpl['RewardItemCount'.$i]];
|
||||||
|
|
||||||
|
$choices = [];
|
||||||
|
for ($i = 1; $i < 7; $i++)
|
||||||
|
if ($this->curTpl['RewardChoiceItemId'.$i])
|
||||||
|
$choices[] = [$this->curTpl['RewardChoiceItemId'.$i], $this->curTpl['RewardChoiceItemCount'.$i]];
|
||||||
|
|
||||||
|
if ($rewards)
|
||||||
|
$set['itemrewards'] = $rewards;
|
||||||
|
|
||||||
|
if ($choices)
|
||||||
|
$set['itemchoices'] = $choices;
|
||||||
|
|
||||||
|
if ($this->curTpl['RewardTitleId'])
|
||||||
|
$set['titlereward'] = $this->curTpl['RewardTitleId'];
|
||||||
|
|
||||||
|
// todo reprewards .. accesses QuestFactionReward.dbc
|
||||||
}
|
}
|
||||||
|
|
||||||
// spells
|
return $data;
|
||||||
$spells = [];
|
|
||||||
if ($this->template['RewardSpell'])
|
|
||||||
$spells[] = $this->template['RewardSpell'];
|
|
||||||
|
|
||||||
if ($this->template['RewardSpellCast'])
|
|
||||||
$spells[] = $this->template['RewardSpellCast'];
|
|
||||||
|
|
||||||
if (!empty($spells))
|
|
||||||
{
|
|
||||||
$spells = new SpellList(array(['id', $spells]));
|
|
||||||
$spells->addSelfToJScipt($gSpells);
|
|
||||||
}
|
|
||||||
|
|
||||||
// titles
|
|
||||||
if ($tId = $this->template['RewardTitleId'])
|
|
||||||
{
|
|
||||||
$title = new Title($tId);
|
|
||||||
$title->addGlobalsToJScript($gTitles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QuestList extends BaseTypeList
|
|
||||||
{
|
|
||||||
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE [filter] [cond] ORDER BY Id ASC';
|
|
||||||
|
|
||||||
public function __construct($conditions)
|
|
||||||
{
|
|
||||||
// may be called without filtering
|
|
||||||
if (class_exists('QuestFilter'))
|
|
||||||
{
|
|
||||||
$this->filter = new QuestFilter();
|
|
||||||
if (($fiData = $this->filter->init()) === false)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct($conditions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRewardsToJscript(&$gItems, &$gSpells, &$gTitles)
|
public function addRewardsToJscript(&$refs)
|
||||||
{
|
{
|
||||||
$items = [];
|
$items = [];
|
||||||
$spells = [];
|
$spells = [];
|
||||||
$titles = [];
|
$titles = [];
|
||||||
|
|
||||||
foreach ($this->container as $quest)
|
while ($this->iterate())
|
||||||
{
|
{
|
||||||
// items
|
// items
|
||||||
for ($i = 1; $i < 5; $i++)
|
for ($i = 1; $i < 5; $i++)
|
||||||
if ($quest->template['RewardItemId'.$i])
|
if ($this->curTpl['RewardItemId'.$i] > 0)
|
||||||
$items[] = $quest->template['RewardItemId'.$i];
|
$items[] = $this->curTpl['RewardItemId'.$i];
|
||||||
|
|
||||||
for ($i = 1; $i < 7; $i++)
|
for ($i = 1; $i < 7; $i++)
|
||||||
if ($quest->template['RewardChoiceItemId'.$i])
|
if ($this->curTpl['RewardChoiceItemId'.$i] > 0)
|
||||||
$items[] = $quest->template['RewardChoiceItemId'.$i];
|
$items[] = $this->curTpl['RewardChoiceItemId'.$i];
|
||||||
|
|
||||||
// spells
|
// spells
|
||||||
if ($quest->template['RewardSpell'])
|
if ($this->curTpl['RewardSpell'] > 0)
|
||||||
$spells[] = $quest->template['RewardSpell'];
|
$spells[] = $this->curTpl['RewardSpell'];
|
||||||
|
|
||||||
if ($quest->template['RewardSpellCast'])
|
if ($this->curTpl['RewardSpellCast'] > 0)
|
||||||
$spells[] = $quest->template['RewardSpellCast'];
|
$spells[] = $this->curTpl['RewardSpellCast'];
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
if ($quest->template['RewardTitleId'])
|
if ($this->curTpl['RewardTitleId'] > 0)
|
||||||
$titles[] = $quest->template['RewardTitleId'];
|
$titles[] = $this->curTpl['RewardTitleId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($items))
|
if ($items)
|
||||||
{
|
(new ItemList(array(['i.entry', $items])))->addGlobalsToJscript($refs);
|
||||||
$items = new ItemList(array(['i.entry', $items]));
|
|
||||||
$items->addGlobalsToJScript($gItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($spells))
|
if ($spells)
|
||||||
{
|
(new SpellList(array(['Id', $spells])))->addGlobalsToJscript($refs);
|
||||||
$spells = new SpellList(array(['id', $spells]));
|
|
||||||
$spells->addGlobalsToJScript($gSpells);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($titles))
|
if ($titles)
|
||||||
{
|
(new TitleList(array(['Id', $titles])))->addGlobalsToJscript($refs);
|
||||||
$titles = new TitleList(array(['id', $titles]));
|
}
|
||||||
$titles->addGlobalsToJScript($gTitles);
|
|
||||||
}
|
public function renderTooltip()
|
||||||
|
{
|
||||||
|
// todo
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addGlobalsToJScript(&$refs)
|
||||||
|
{
|
||||||
|
// todo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,45 +3,57 @@
|
|||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
class Title extends BaseType
|
class TitleList extends BaseType
|
||||||
{
|
{
|
||||||
public $name = [];
|
private $sources = [];
|
||||||
public $source = [];
|
|
||||||
|
|
||||||
protected $setupQuery = "SELECT * FROM ?_titles WHERE `Id` = ?";
|
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC';
|
||||||
|
protected $matchQuery = 'SELECT COUNT(1) FROM ?_titles WHERE [cond]';
|
||||||
|
|
||||||
public function __construct($data)
|
public function __construct($data)
|
||||||
{
|
{
|
||||||
parent::__construct($data);
|
parent::__construct($data);
|
||||||
|
|
||||||
// post processing
|
// post processing
|
||||||
$this->name[GENDER_MALE] = Util::localizedString($this->template, 'male');
|
while ($this->iterate())
|
||||||
if ($this->template['female_loc0'] || $this->template['female_loc'.User::$localeId])
|
|
||||||
$this->name[GENDER_FEMALE] = Util::localizedString($this->template, 'female');
|
|
||||||
|
|
||||||
// preparse sources
|
|
||||||
if (!empty($this->template['source']))
|
|
||||||
{
|
{
|
||||||
$sources = explode(' ', $this->template['source']);
|
// overwrite names with gender-speciffics
|
||||||
foreach ($sources as $src)
|
$this->names[$this->Id][GENDER_MALE] = Util::localizedString($this->curTpl, 'male');
|
||||||
|
if ($this->curTpl['female_loc0'] || $this->curTpl['female_loc'.User::$localeId])
|
||||||
|
$this->names[$this->Id][GENDER_FEMALE] = Util::localizedString($this->curTpl, 'female');
|
||||||
|
|
||||||
|
// preparse sources
|
||||||
|
if (!empty($this->curTpl['source']))
|
||||||
{
|
{
|
||||||
$src = explode(':', $src);
|
$sources = explode(' ', $this->curTpl['source']);
|
||||||
$this->source[$src[0]][] = $src[1];
|
foreach ($sources as $src)
|
||||||
|
{
|
||||||
|
$src = explode(':', $src);
|
||||||
|
$this->sources[$this->Id][$src[0]][] = $src[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getListviewData()
|
public function getListviewData()
|
||||||
{
|
{
|
||||||
$data = array(
|
$data = [];
|
||||||
'id' => $this->Id,
|
$this->createSource();
|
||||||
'name' => $this->name[GENDER_MALE],
|
|
||||||
'side' => $this->template['side'],
|
while ($this->iterate())
|
||||||
'gender' => $this->template['gender'],
|
{
|
||||||
'expansion' => $this->template['expansion'],
|
$data[$this->Id] = array(
|
||||||
'category' => $this->template['category'],
|
'Id' => $this->Id,
|
||||||
'source' => $this->source
|
'name' => $this->names[$this->Id][GENDER_MALE],
|
||||||
);
|
'side' => $this->curTpl['side'],
|
||||||
|
'gender' => $this->curTpl['gender'],
|
||||||
|
'expansion' => $this->curTpl['expansion'],
|
||||||
|
'category' => $this->curTpl['category']
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!empty($this->curTpl['source']))
|
||||||
|
$data[$this->Id]['source'] = $this->curTpl['source'];
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($this->name[GENDER_FEMALE]))
|
if (isset($this->name[GENDER_FEMALE]))
|
||||||
$data['namefemale'] = $this->name[GENDER_FEMALE];
|
$data['namefemale'] = $this->name[GENDER_FEMALE];
|
||||||
@@ -49,27 +61,77 @@ class Title extends BaseType
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addGlobalsToJScript(&$gTitles)
|
public function addGlobalsToJscript(&$refs)
|
||||||
{
|
{
|
||||||
$gTitles[$this->Id] = ['name' => Util::jsEscape($this->name[GENDER_MALE])];
|
if (!isset($refs['gTitles']))
|
||||||
|
$refs['gTitles'] = [];
|
||||||
|
|
||||||
if (isset($this->name[GENDER_FEMALE]))
|
while ($this->iterate())
|
||||||
$gTitles[$this->Id]['namefemale'] = Util::jsEscape($this->name[GENDER_FEMALE]);
|
{
|
||||||
|
$refs['gTitles'][$this->Id]['name'] = Util::jsEscape($this->names[$this->Id][GENDER_MALE]);
|
||||||
|
|
||||||
return true;
|
if (isset($this->names[$this->Id][GENDER_FEMALE]))
|
||||||
|
$refs['gTitles'][$this->Id]['namefemale'] = Util::jsEscape($this->names[$this->Id][GENDER_FEMALE]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function createSource()
|
||||||
|
{
|
||||||
|
$sources = array(
|
||||||
|
4 => [], // Quest
|
||||||
|
12 => [], // Achievements
|
||||||
|
13 => [] // simple text
|
||||||
|
);
|
||||||
|
|
||||||
|
while ($this->iterate())
|
||||||
|
{
|
||||||
|
if (empty($this->sources[$this->Id]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
foreach (array_keys($sources) as $srcKey)
|
||||||
|
if (isset($this->sources[$this->Id][$srcKey]))
|
||||||
|
$sources[$srcKey] = array_merge($sources[$srcKey], $this->sources[$this->Id][$srcKey]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill in the details
|
||||||
|
if (!empty($sources[4]))
|
||||||
|
$sources[4] = (new QuestList(array(['Id', $sources[4]])))->getSourceData();
|
||||||
|
|
||||||
|
if (!empty($sources[12]))
|
||||||
|
$sources[12] = (new AchievementList(array(['Id', $sources[12]])))->getSourceData();
|
||||||
|
|
||||||
|
if (!empty($sources[13]))
|
||||||
|
$sources[13] = DB::Aowow()->SELECT('SELECT *, Id AS ARRAY_KEY FROM ?_sourceStrings WHERE Id IN (?a)', $sources[13]);
|
||||||
|
|
||||||
|
foreach ($this->sources as $Id => $src)
|
||||||
|
{
|
||||||
|
$tmp = [];
|
||||||
|
|
||||||
|
// Quest-source
|
||||||
|
if (isset($src[4]))
|
||||||
|
foreach ($src[4] as $s)
|
||||||
|
$tmp[4][] = $sources[4][$s];
|
||||||
|
|
||||||
|
// Achievement-source
|
||||||
|
if (isset($src[12]))
|
||||||
|
foreach ($src[12] as $s)
|
||||||
|
$tmp[12][] = $sources[12][$s];
|
||||||
|
|
||||||
|
// other source (only one item possible, so no iteration needed)
|
||||||
|
if (isset($src[13]))
|
||||||
|
$tmp[13] = [Util::localizedString($sources[13][$this->sources[$Id][13][0]], 'source')];
|
||||||
|
|
||||||
|
$this->templates[$Id]['source'] = json_encode($tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHtmlizedName($gender = GENDER_MALE)
|
public function getHtmlizedName($gender = GENDER_MALE)
|
||||||
{
|
{
|
||||||
return str_replace('%s', '<span class="q0"><Name></span>', $this->name[$gender]);
|
return str_replace('%s', '<span class="q0"><'.Lang::$main['name'].'></span>', $this->name[$gender]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
public function addRewardsToJScript(&$ref) { }
|
||||||
|
public function renderTooltip() { }
|
||||||
class TitleList extends BaseTypeList
|
|
||||||
{
|
|
||||||
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
class WorldEvent
|
class WorldEvent extends BaseType
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function getName($id)
|
public static function getName($id)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ define('TYPE_FACTION', 8);
|
|||||||
define('TYPE_PET', 9);
|
define('TYPE_PET', 9);
|
||||||
define('TYPE_ACHIEVEMENT', 10);
|
define('TYPE_ACHIEVEMENT', 10);
|
||||||
define('TYPE_TITLE', 11);
|
define('TYPE_TITLE', 11);
|
||||||
define('TYPE_EVENT', 12);
|
define('TYPE_WORLDEVENT', 12);
|
||||||
define('TYPE_CLASS', 13);
|
define('TYPE_CLASS', 13);
|
||||||
define('TYPE_RACE', 14);
|
define('TYPE_RACE', 14);
|
||||||
define('TYPE_SKILL', 15);
|
define('TYPE_SKILL', 15);
|
||||||
@@ -33,8 +33,8 @@ define('CACHETYPE_SEARCH', 3);
|
|||||||
define('SEARCH_TYPE_REGULAR', 0x10000000);
|
define('SEARCH_TYPE_REGULAR', 0x10000000);
|
||||||
define('SEARCH_TYPE_OPEN', 0x20000000);
|
define('SEARCH_TYPE_OPEN', 0x20000000);
|
||||||
define('SEARCH_TYPE_JSON', 0x40000000);
|
define('SEARCH_TYPE_JSON', 0x40000000);
|
||||||
define('SEARCH_MASK_OPEN', 0x03FFFFFF);
|
define('SEARCH_MASK_OPEN', 0x017F807F); // open search
|
||||||
define('SEARCH_MASK_ALL', 0x03FFFFFF);
|
define('SEARCH_MASK_ALL', 0x07FFFFFF); // normal search
|
||||||
|
|
||||||
// Databases
|
// Databases
|
||||||
define('DB_AOWOW', 0);
|
define('DB_AOWOW', 0);
|
||||||
@@ -94,6 +94,12 @@ define('LOCALE_DE', 3);
|
|||||||
define('LOCALE_ES', 6);
|
define('LOCALE_ES', 6);
|
||||||
define('LOCALE_RU', 8);
|
define('LOCALE_RU', 8);
|
||||||
|
|
||||||
|
// Additional info in item-listviews
|
||||||
|
define('ITEMINFO_JSON', 0x1);
|
||||||
|
define('ITEMINFO_SUBITEMS', 0x2);
|
||||||
|
define('ITEMINFO_VENDOR', 0x4);
|
||||||
|
define('ITEMINFO_LOOT', 0x8);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Game
|
* Game
|
||||||
*/
|
*/
|
||||||
@@ -185,6 +191,7 @@ define('SPELL_SCHOOL_NATURE', 3);
|
|||||||
define('SPELL_SCHOOL_FROST', 4);
|
define('SPELL_SCHOOL_FROST', 4);
|
||||||
define('SPELL_SCHOOL_SHADOW', 5);
|
define('SPELL_SCHOOL_SHADOW', 5);
|
||||||
define('SPELL_SCHOOL_ARCANE', 6);
|
define('SPELL_SCHOOL_ARCANE', 6);
|
||||||
|
define('SPELL_ALL_SCHOOLS', 0x7F);
|
||||||
|
|
||||||
// CharacterSlot
|
// CharacterSlot
|
||||||
define('SLOT_HEAD', 0);
|
define('SLOT_HEAD', 0);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ require 'includes/class.database.php';
|
|||||||
|
|
||||||
// autoload any List-Classes
|
// autoload any List-Classes
|
||||||
spl_autoload_register(function ($class) {
|
spl_autoload_register(function ($class) {
|
||||||
if (!strpos($class, 'Mysql') && !strpos($class, 'Filter'))
|
if (strpos($class, 'List'))
|
||||||
require 'includes/class.'.strtr($class, ['List' => '']).'.php';
|
require 'includes/class.'.strtr($class, ['List' => '']).'.php';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ class Smarty_AoWoW extends Smarty
|
|||||||
if (!$cache)
|
if (!$cache)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$cache = explode("\n", $cache, 2);
|
$cache = explode("\n", $cache);
|
||||||
|
|
||||||
@list($time, $rev) = explode(' ', $cache[0]);
|
@list($time, $rev) = explode(' ', $cache[0]);
|
||||||
$expireTime = $time + $this->config['page']['cacheTimer'];
|
$expireTime = $time + $this->config['page']['cacheTimer'];
|
||||||
|
|||||||
@@ -3,48 +3,19 @@
|
|||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
class BaseType
|
abstract class BaseType
|
||||||
{
|
{
|
||||||
public $template = null;
|
public $names = [];
|
||||||
public $Id = 0;
|
public $Id = 0;
|
||||||
|
public $matches = 0; // total matches unaffected by sqlLimit in config
|
||||||
protected $setupQuery = '';
|
public $error = true;
|
||||||
|
|
||||||
public function __construct($data)
|
protected $templates = [];
|
||||||
{
|
protected $curTpl = []; // lets iterate!
|
||||||
if (!$this->setupQuery)
|
protected $filter = null;
|
||||||
return false;
|
|
||||||
|
|
||||||
if (is_array($data))
|
|
||||||
$this->template = $data;
|
|
||||||
else
|
|
||||||
$this->template = DB::Aowow()->SelectRow($this->setupQuery, intVal($data));
|
|
||||||
|
|
||||||
if (empty($this->template))
|
|
||||||
{
|
|
||||||
$this->template = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->Id = isset($this->template['Id']) ? (int)$this->template['Id'] : (int)$this->template['entry'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// should return data required to display a listview of any kind
|
|
||||||
public function getListviewData() { }
|
|
||||||
|
|
||||||
// should return data to extend global js variables for a certain type (e.g. g_items)
|
|
||||||
public function addGlobalsToJScript(&$ref) { }
|
|
||||||
|
|
||||||
// should return data to extend global js variables for the rewards provided by this type (e.g. g_titles)
|
|
||||||
public function addRewardsToJscript(&$ref1, &$ref2 = null, &$ref3 = null) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
class BaseTypeList
|
|
||||||
{
|
|
||||||
public $container = [];
|
|
||||||
public $filter = null;
|
|
||||||
|
|
||||||
protected $setupQuery = '';
|
protected $setupQuery = '';
|
||||||
|
protected $matchQuery = '';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* condition as array [field, value, operator]
|
* condition as array [field, value, operator]
|
||||||
@@ -56,19 +27,34 @@ class BaseTypeList
|
|||||||
* ! - negated default value (NOT LIKE; <>; NOT IN)
|
* ! - negated default value (NOT LIKE; <>; NOT IN)
|
||||||
* condition as str
|
* condition as str
|
||||||
* defines linking (AND || OR)
|
* defines linking (AND || OR)
|
||||||
|
* condition as int
|
||||||
|
* defines LIMIT
|
||||||
*
|
*
|
||||||
* example:
|
* example:
|
||||||
* array(['id', 45], ['name', 'test', '!'], 'OR')
|
* array(['id', 45], ['name', 'test', '!'], 'OR', 5)
|
||||||
* results in
|
* results in
|
||||||
* WHERE id = 45 OR name NOT LIKE %test%;
|
* WHERE id = 45 OR name NOT LIKE %test% LIMIT 5;
|
||||||
*/
|
*/
|
||||||
public function __construct($conditions)
|
public function __construct($conditions = [])
|
||||||
{
|
{
|
||||||
if (!$this->setupQuery)
|
global $AoWoWconf; // yes i hate myself..
|
||||||
return false;
|
|
||||||
|
|
||||||
$sql = [];
|
$sql = [];
|
||||||
$linking = ' AND ';
|
$linking = ' AND ';
|
||||||
|
$limit = ' LIMIT '.$AoWoWconf['sqlLimit'];
|
||||||
|
$className = strtr(get_class($this), ['List' => '']);
|
||||||
|
|
||||||
|
if (!$this->setupQuery || !$this->matchQuery)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// may be called without filtering
|
||||||
|
if (class_exists($className.'Filter'))
|
||||||
|
{
|
||||||
|
$fiName = $className.'Filter';
|
||||||
|
$this->filter = new $fiName();
|
||||||
|
if ($this->filter->init() === false)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($conditions as $c)
|
foreach ($conditions as $c)
|
||||||
{
|
{
|
||||||
@@ -90,6 +76,9 @@ class BaseTypeList
|
|||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (isset($c[2]) && $c[2] != '!')
|
||||||
|
$op = $c[2];
|
||||||
|
|
||||||
if (is_array($c[1]))
|
if (is_array($c[1]))
|
||||||
{
|
{
|
||||||
$op = (isset($c[2]) && $c[2] == '!') ? 'NOT IN' : 'IN';
|
$op = (isset($c[2]) && $c[2] == '!') ? 'NOT IN' : 'IN';
|
||||||
@@ -109,52 +98,84 @@ class BaseTypeList
|
|||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (isset($c[2]) && $c[2] != '!')
|
|
||||||
$op = $c[2];
|
|
||||||
|
|
||||||
$sql[] = $field.' '.$op.' '.$val;
|
$sql[] = $field.' '.$op.' '.$val;
|
||||||
}
|
}
|
||||||
else if (is_string($c))
|
else if (is_string($c))
|
||||||
$linking = $c == 'OR' ? ' OR ' : ' AND ';
|
$linking = $c == 'AND' ? ' AND ' : ' OR ';
|
||||||
else
|
else if (is_int($c))
|
||||||
|
$limit = $c > 0 ? ' LIMIT '.$c : '';
|
||||||
continue; // ignore other possibilities
|
continue; // ignore other possibilities
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: add strings propperly without them being escaped by simpleDB..?
|
// todo: add strings propperly without them being escaped by simpleDB..?
|
||||||
$this->setupQuery = str_replace('[filter]', $this->filter && $this->filter->buildFilterQuery() ? $this->filter->query.' AND ' : NULL, $this->setupQuery);
|
$this->setupQuery = str_replace('[filter]', $this->filter && $this->filter->buildFilterQuery() ? $this->filter->query.' AND ' : NULL, $this->setupQuery);
|
||||||
$this->setupQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->setupQuery);
|
$this->setupQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->setupQuery);
|
||||||
|
$this->setupQuery .= $limit;
|
||||||
|
|
||||||
$rows = DB::Aowow()->Select($this->setupQuery);
|
$this->matchQuery = str_replace('[filter]', $this->filter && $this->filter->buildFilterQuery() ? $this->filter->query.' AND ' : NULL, $this->matchQuery);
|
||||||
$className = str_replace('List', '', get_class($this));
|
$this->matchQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->matchQuery);
|
||||||
|
|
||||||
foreach ($rows as $k => $row)
|
$rows = DB::Aowow()->Select($this->setupQuery);
|
||||||
$this->container[$k] = new $className($row); // free dirty mindfuck galore here...
|
if (!$rows)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$this->matches = DB::Aowow()->SelectCell($this->matchQuery);
|
||||||
|
|
||||||
|
foreach ($rows as $k => $tpl)
|
||||||
|
{
|
||||||
|
$this->names[$k] = Util::localizedString($tpl, Util::getNameFieldName($tpl));
|
||||||
|
$this->templates[$k] = $tpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->reset();
|
||||||
|
|
||||||
|
$this->error = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getListviewData()
|
public function iterate($qty = 1)
|
||||||
{
|
{
|
||||||
$data = [];
|
if (!$this->curTpl) // exceeded end of line .. array .. in last iteration
|
||||||
// no extra queries required, just call recursively
|
reset($this->templates);
|
||||||
foreach ($this->container as $type)
|
|
||||||
$data[] = $type->getListviewData();
|
|
||||||
|
|
||||||
return $data;
|
$this->curTpl = current($this->templates);
|
||||||
|
$field = $this->curTpl ? Util::getIdFieldName($this->curTpl) : null;
|
||||||
|
$this->Id = $this->curTpl ? $this->curTpl[$field] : 0;
|
||||||
|
|
||||||
|
while ($qty--)
|
||||||
|
next($this->templates);
|
||||||
|
|
||||||
|
return $this->Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addGlobalsToJScript(&$ref)
|
public function reset()
|
||||||
{
|
{
|
||||||
// no extra queries required, just call recursively
|
$this->curTpl = reset($this->templates);
|
||||||
foreach ($this->container as $type)
|
$this->Id = $this->curTpl[Util::getIdFieldName($this->curTpl)];
|
||||||
$type->addGlobalsToJScript($ref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRewardsToJScript(&$ref1, &$ref2 = null, &$ref3 = null)
|
// read-access to templates
|
||||||
|
public function getField($field)
|
||||||
{
|
{
|
||||||
// no extra queries required, just call recursively
|
if (!$this->curTpl || !isset($this->curTpl[$field]))
|
||||||
foreach ($this->container as $type)
|
return null;
|
||||||
$type->addRewardsToJScript($ref1, $ref2, $ref3);
|
|
||||||
|
return $this->curTpl[$field];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// should return data required to display a listview of any kind
|
||||||
|
// this is a rudimentary example, that will not suffice for most Types
|
||||||
|
abstract public function getListviewData();
|
||||||
|
|
||||||
|
// should return data to extend global js variables for a certain type (e.g. g_items)
|
||||||
|
abstract public function addGlobalsToJScript(&$ref);
|
||||||
|
|
||||||
|
// should return data to extend global js variables for the rewards provided by this type (e.g. g_titles)
|
||||||
|
// rewards will not always be required and only by Achievement and Quest .. but yeah.. maybe it should be merged with addGlobalsToJScript
|
||||||
|
abstract public function addRewardsToJScript(&$ref);
|
||||||
|
|
||||||
|
// NPC, GO, Item, Quest, Spell, Achievement, Profile would require this
|
||||||
|
abstract public function renderTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
class Lang
|
class Lang
|
||||||
@@ -234,7 +255,7 @@ class Lang
|
|||||||
|
|
||||||
public static function getMagicSchools($schoolMask)
|
public static function getMagicSchools($schoolMask)
|
||||||
{
|
{
|
||||||
$schoolMask &= 0x7F; // clamp to available schools..
|
$schoolMask &= SPELL_ALL_SCHOOLS; // clamp to available schools..
|
||||||
|
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
$i = 1;
|
$i = 1;
|
||||||
@@ -335,7 +356,7 @@ class Util
|
|||||||
'enus', null, 'frfr', 'dede', null, null, 'eses', null, 'ruru'
|
'enus', null, 'frfr', 'dede', null, null, 'eses', null, 'ruru'
|
||||||
);
|
);
|
||||||
|
|
||||||
private static $typeStrings = array( // zero-indexed
|
public static $typeStrings = array( // zero-indexed
|
||||||
null, 'npc', 'object', 'item', 'itemset', 'quest', 'spell', 'zone', 'faction',
|
null, 'npc', 'object', 'item', 'itemset', 'quest', 'spell', 'zone', 'faction',
|
||||||
'pet', 'achievement', 'title', 'event', 'class', 'race', 'skill', null, 'currency'
|
'pet', 'achievement', 'title', 'event', 'class', 'race', 'skill', null, 'currency'
|
||||||
);
|
);
|
||||||
@@ -1055,10 +1076,10 @@ class Util
|
|||||||
return strtr(trim($string), array(
|
return strtr(trim($string), array(
|
||||||
'\\' => '\\\\',
|
'\\' => '\\\\',
|
||||||
"'" => "\\'",
|
"'" => "\\'",
|
||||||
'"' => '\\"',
|
// '"' => '\\"',
|
||||||
"\r" => '\\r',
|
"\r" => '\\r',
|
||||||
"\n" => '\\n',
|
"\n" => '\\n',
|
||||||
'</' => '<\/',
|
// '</' => '<\/',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1070,7 +1091,7 @@ class Util
|
|||||||
if (!empty($data[$field.'_loc'.User::$localeId]))
|
if (!empty($data[$field.'_loc'.User::$localeId]))
|
||||||
return $data[$field.'_loc'.User::$localeId];
|
return $data[$field.'_loc'.User::$localeId];
|
||||||
|
|
||||||
// locale not enUS; aowow-type localization available
|
// locale not enUS; aowow-type localization available; add brackets
|
||||||
else if (User::$localeId != LOCALE_EN && isset($data[$field.'_loc0']) && !empty($data[$field.'_loc0']))
|
else if (User::$localeId != LOCALE_EN && isset($data[$field.'_loc0']) && !empty($data[$field.'_loc0']))
|
||||||
return '['.$data[$field.'_loc0'].']';
|
return '['.$data[$field.'_loc0'].']';
|
||||||
|
|
||||||
@@ -1124,7 +1145,7 @@ class Util
|
|||||||
return sprintf(Lang::$item['ratingString'], '<!--rtg%'.$type.'-->' . $result, '<!--lvl-->' . $level);
|
return sprintf(Lang::$item['ratingString'], '<!--rtg%'.$type.'-->' . $result, '<!--lvl-->' . $level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function powerUseLocale($domain)
|
public static function powerUseLocale($domain = 'www')
|
||||||
{
|
{
|
||||||
foreach (Util::$localeStrings as $k => $v)
|
foreach (Util::$localeStrings as $k => $v)
|
||||||
{
|
{
|
||||||
@@ -1138,7 +1159,6 @@ class Util
|
|||||||
|
|
||||||
if ($domain == 'www')
|
if ($domain == 'www')
|
||||||
{
|
{
|
||||||
/* todo: dont .. should use locale given by inclusion of aowowPower .. should be fixed in aowowPower.js */
|
|
||||||
User::useLocale(LOCALE_EN);
|
User::useLocale(LOCALE_EN);
|
||||||
Lang::load(User::$localeString);
|
Lang::load(User::$localeString);
|
||||||
}
|
}
|
||||||
@@ -1172,8 +1192,9 @@ class Util
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
case 7:
|
case 7:
|
||||||
$spl = new Spell($enchant['object'.$h]);
|
$spl = new SpellList(array(['Id', (int)$enchant['object'.$h]]));
|
||||||
$gain = $spl->getStatGain();
|
$gain = $spl->getStatGain();
|
||||||
|
|
||||||
foreach ($gain as $k => $v) // array_merge screws up somehow...
|
foreach ($gain as $k => $v) // array_merge screws up somehow...
|
||||||
@$jsonStats[$k] += $v;
|
@$jsonStats[$k] += $v;
|
||||||
break;
|
break;
|
||||||
@@ -1219,6 +1240,35 @@ class Util
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// BaseType::_construct craaap!
|
||||||
|
// todo: unify names
|
||||||
|
public static function getNameFieldName($tpl)
|
||||||
|
{
|
||||||
|
if (isset($tpl['name']) || isset($tpl['name_loc0']))
|
||||||
|
return 'name';
|
||||||
|
else if (isset($tpl['title']) || isset($tpl['title_loc0']))
|
||||||
|
return 'title';
|
||||||
|
else if (isset($tpl['male']) || isset($tpl['male_loc']))
|
||||||
|
return 'male';
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BaseType::iterate craaaaaaaaap!!!
|
||||||
|
// todo: unify indizes
|
||||||
|
public static function getIdFieldName($tpl)
|
||||||
|
{
|
||||||
|
if (isset($tpl['entry']))
|
||||||
|
return 'entry';
|
||||||
|
else if (isset($tpl['Id']))
|
||||||
|
return 'Id';
|
||||||
|
else if (isset($tpl['ID']))
|
||||||
|
return 'ID';
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -96,12 +96,12 @@ if ($_type & 0x18) { // 3 | 4
|
|||||||
$iList = new ItemList($conditions);
|
$iList = new ItemList($conditions);
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
foreach ($iList->container as $id => $item)
|
while ($iList->iterate())
|
||||||
{
|
{
|
||||||
$item->getJsonStats($pieceAssoc);
|
$iList->extendJsonStats($pieceAssoc);
|
||||||
|
|
||||||
$stats = [];
|
$stats = [];
|
||||||
foreach ($item->json as $k => $v)
|
foreach ($iList->json[$iList->Id] as $k => $v)
|
||||||
{
|
{
|
||||||
if (!$v && $k != 'classs' && $k != 'subclass')
|
if (!$v && $k != 'classs' && $k != 'subclass')
|
||||||
continue;
|
continue;
|
||||||
@@ -109,10 +109,10 @@ if ($_type & 0x18) { // 3 | 4
|
|||||||
$stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"';
|
$stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($item->itemMods as $k => $v)
|
foreach ($iList->itemMods[$iList->Id] as $k => $v)
|
||||||
$stats[] = '"'.Util::$itemMods[$k].'":'.$v.'';
|
$stats[] = '"'.Util::$itemMods[$k].'":'.$v.'';
|
||||||
|
|
||||||
$items[$id] = "\t{".implode(',', $stats)."}";
|
$items[$iList->Id] = "\t{".implode(',', $stats)."}";
|
||||||
}
|
}
|
||||||
echo implode(",\n", $items)."\n],[\n";
|
echo implode(",\n", $items)."\n],[\n";
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
enum(array( // AcctError
|
enum(array( // AcctError
|
||||||
'ACCT_USERNAME_LENGTH' => 'activate_usernamelength',
|
'ACCT_USERNAME_LENGTH' => 'activate_usernamelength',
|
||||||
'ACCT_PASSWORD_LENGTH' => 'activate_passwordlength',
|
'ACCT_PASSWORD_LENGTH' => 'activate_passwordlength',
|
||||||
'ACCT_USERNAME_SYMBOLS' => 'activate_invalidusername',
|
'ACCT_USERNAME_SYMBOLS' => 'activate_invalidusername',
|
||||||
'ACCT_PASSWORD_SYMBOLS' => 'activate_invalidpassword',
|
'ACCT_PASSWORD_SYMBOLS' => 'activate_invalidpassword',
|
||||||
'ACCT_EMAIL_SYMBOLS' => 'signup_emailinvalid',
|
'ACCT_EMAIL_SYMBOLS' => 'signup_emailinvalid',
|
||||||
|
|
||||||
'ACCT_PASSWORDS_NOT_EQUAL' => 'signup_passwordsnotequal',
|
'ACCT_PASSWORDS_NOT_EQUAL' => 'signup_passwordsnotequal',
|
||||||
'ACCT_USERNAME_EXISTS' => 'activate_usernameinuse',
|
'ACCT_USERNAME_EXISTS' => 'activate_usernameinuse',
|
||||||
'ACCT_NO_SUCH_ACCT' => 'signin_un_or_pass_fail',
|
'ACCT_NO_SUCH_ACCT' => 'signin_un_or_pass_fail',
|
||||||
'ACCT_IP_LOCKED' => 'signin_ip_locked',
|
'ACCT_IP_LOCKED' => 'signin_ip_locked',
|
||||||
|
|
||||||
'ACCT_SIGNUP_BLOCKED' => 'signup_blocked',
|
'ACCT_SIGNUP_BLOCKED' => 'signup_blocked',
|
||||||
'ACCT_SIGNIN_BLOCKED' => 'signin_blocked',
|
'ACCT_SIGNIN_BLOCKED' => 'signin_blocked',
|
||||||
|
|
||||||
'ACCT_INTERNAL_ERROR' => 'internal_error',
|
'ACCT_INTERNAL_ERROR' => 'internal_error',
|
||||||
));
|
));
|
||||||
|
|
||||||
enum(array( // UserPropsLimits
|
enum(array( // UserPropsLimits
|
||||||
@@ -97,7 +97,8 @@ function signin()
|
|||||||
|
|
||||||
function signup()
|
function signup()
|
||||||
{
|
{
|
||||||
/* $username = Get(GET_STRING, 'username', 'POST');
|
/*
|
||||||
|
$username = Get(GET_STRING, 'username', 'POST');
|
||||||
$password = Get(GET_STRING, 'password', 'POST');
|
$password = Get(GET_STRING, 'password', 'POST');
|
||||||
$pwd2 = Get(GET_STRING, 'password2', 'POST');
|
$pwd2 = Get(GET_STRING, 'password2', 'POST');
|
||||||
$email = Get(GET_STRING, 'email', 'POST');
|
$email = Get(GET_STRING, 'email', 'POST');
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
$pageData = array(
|
$pageData = array(
|
||||||
'summary' => '[]',
|
'items' => null,
|
||||||
'items' => []
|
'summary' => '[]'
|
||||||
);
|
);
|
||||||
$compareString = '';
|
$compareString = '';
|
||||||
|
|
||||||
// prefer $_GET over $_COOKIE
|
// prefer $_GET over $_COOKIE
|
||||||
if (!empty($_GET['compare']))
|
if (!empty($_GET['compare']))
|
||||||
@@ -48,22 +48,23 @@ if ($compareString)
|
|||||||
$pageData['summary'] = "[".implode(',', $outSet)."]";
|
$pageData['summary'] = "[".implode(',', $outSet)."]";
|
||||||
|
|
||||||
$iList = new ItemList(array(['i.entry', $items]));
|
$iList = new ItemList(array(['i.entry', $items]));
|
||||||
foreach ($iList->container as $item)
|
while ($iList->iterate())
|
||||||
{
|
{
|
||||||
$item->getJsonStats();
|
$iList->extendJsonStats();
|
||||||
$stats = [];
|
$stats = [];
|
||||||
foreach ($item->json as $k => $v)
|
|
||||||
|
foreach ($iList->json[$iList->Id] as $k => $v)
|
||||||
$stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"';
|
$stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"';
|
||||||
|
|
||||||
foreach ($item->itemMods as $k => $v)
|
foreach ($iList->itemMods[$iList->Id] as $k => $v)
|
||||||
if ($v)
|
if ($v)
|
||||||
$stats[] = '"'.Util::$itemMods[$k].'":'.$v;
|
$stats[] = '"'.Util::$itemMods[$k].'":'.$v;
|
||||||
|
|
||||||
$pageData['items'][] = [
|
$pageData['items'][] = [
|
||||||
$item->Id,
|
$iList->Id,
|
||||||
Util::jsEscape(Util::localizedString($item->template, 'name')),
|
Util::jsEscape($iList->names[$iList->Id]),
|
||||||
$item->template['Quality'],
|
$iList->getField('Quality'),
|
||||||
$item->template['icon'],
|
$iList->getField('icon'),
|
||||||
"{".implode(",", $stats)."}"
|
"{".implode(",", $stats)."}"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,20 +11,18 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
// require 'includes/class.community.php'; // wo dont need those .. yet
|
// require 'includes/class.community.php'; // wo dont need those .. yet
|
||||||
|
|
||||||
$id = intVal($pageParam);
|
$id = intVal($pageParam);
|
||||||
$item = new Item($id);
|
$item = new ItemList(array(['i.entry', $id]));
|
||||||
|
|
||||||
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ITEM, $id, -1, User::$localeId]);
|
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ITEM, $id, -1, User::$localeId]);
|
||||||
|
|
||||||
if (isset($_GET['xml']))
|
if (isset($_GET['xml']))
|
||||||
{
|
die('unsupported, as i do not see the point');
|
||||||
// output item info as xml
|
|
||||||
// why should i implement this..?
|
if (isset($_GET['power']))
|
||||||
}
|
|
||||||
else if (isset($_GET['power']))
|
|
||||||
{
|
{
|
||||||
header('Content-type: application/x-javascript; charsetUTF-8');
|
header('Content-type: application/x-javascript; charsetUTF-8');
|
||||||
|
|
||||||
Util::powerUseLocale($_GET['domain']);
|
Util::powerUseLocale(@$_GET['domain']);
|
||||||
|
|
||||||
$enh = [];
|
$enh = [];
|
||||||
$itemString = $id;
|
$itemString = $id;
|
||||||
@@ -50,21 +48,20 @@ else if (isset($_GET['power']))
|
|||||||
$itemString .= 's';
|
$itemString .= 's';
|
||||||
}
|
}
|
||||||
|
|
||||||
// : are not accepted in filenames
|
|
||||||
$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_ITEM, str_replace(':', ',', $itemString), -1, User::$localeId]);
|
$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_ITEM, str_replace(':', ',', $itemString), -1, User::$localeId]);
|
||||||
|
|
||||||
// output json for tooltips
|
// output json for tooltips
|
||||||
if (!$smarty->loadCache($cacheKeyTooltip, $x))
|
if (!$smarty->loadCache($cacheKeyTooltip, $x))
|
||||||
{
|
{
|
||||||
if (!$item->template)
|
if ($item->error)
|
||||||
die('$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.', {})');
|
die('$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.', {})');
|
||||||
|
|
||||||
$item->createTooltip($enh);
|
$item->renderTooltip($enh);
|
||||||
$x .= '$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.", {\n";
|
$x .= '$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.", {\n";
|
||||||
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($item->name)."',\n";
|
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($item->names[$item->Id])."',\n";
|
||||||
$x .= "\tquality: ".$item->template['Quality'].",\n";
|
$x .= "\tquality: ".$item->getField('Quality').",\n";
|
||||||
$x .= "\ticon: '".Util::jsEscape($item->template['icon'])."',\n";
|
$x .= "\ticon: '".Util::jsEscape($item->getField('icon'))."',\n";
|
||||||
$x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($item->tooltip)."'\n";
|
$x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($item->tooltip[$item->Id])."'\n";
|
||||||
$x .= "});";
|
$x .= "});";
|
||||||
|
|
||||||
$smarty->saveCache($cacheKeyTooltip, $x);
|
$smarty->saveCache($cacheKeyTooltip, $x);
|
||||||
|
|||||||
@@ -8,33 +8,33 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
// require 'includes/allquests.php';
|
// require 'includes/allquests.php';
|
||||||
// require 'includes/class.community.php'; // not needed .. yet
|
// require 'includes/class.community.php'; // not needed .. yet
|
||||||
|
|
||||||
$id = intVal($pageParam);
|
$Id = intVal($pageParam);
|
||||||
$spell = new Spell($id);
|
|
||||||
|
|
||||||
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_SPELL, $id, -1, User::$localeId]);
|
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_SPELL, $Id, -1, User::$localeId]);
|
||||||
$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_SPELL, $id, -1, User::$localeId]);
|
$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_SPELL, $Id, -1, User::$localeId]);
|
||||||
|
|
||||||
if (isset($_GET['power']))
|
if (isset($_GET['power']))
|
||||||
{
|
{
|
||||||
header('Content-type: application/x-javascript; charsetUTF-8');
|
header('Content-type: application/x-javascript; charsetUTF-8');
|
||||||
|
|
||||||
Util::powerUseLocale($_GET['domain']);
|
Util::powerUseLocale(@$_GET['domain']);
|
||||||
|
|
||||||
if (!$smarty->loadCache($cacheKeyTooltip, $x))
|
if (!$smarty->loadCache($cacheKeyTooltip, $x))
|
||||||
{
|
{
|
||||||
$spell = new Spell($id);
|
$spell = new SpellList(array(['Id', $Id]));
|
||||||
if (!$spell->template)
|
|
||||||
die('$WowheadPower.registerSpell(\''.$id.'\', '.User::$localeId.', {})');
|
|
||||||
|
|
||||||
$x = '$WowheadPower.registerSpell('.$id.', '.User::$localeId.",{\n";
|
if ($spell->error)
|
||||||
if ($n = Util::localizedString($spell->template, 'spellname'))
|
die('$WowheadPower.registerSpell('.$Id.', '.User::$localeId.', {});');
|
||||||
|
|
||||||
|
$x = '$WowheadPower.registerSpell('.$Id.', '.User::$localeId.", {\n";
|
||||||
|
if ($n = $spell->names[$Id])
|
||||||
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($n)."',\n";
|
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($n)."',\n";
|
||||||
if ($i = $spell->template['iconString'])
|
if ($i = $spell->getField('iconString'))
|
||||||
$x .= "\ticon: '".Util::jsEscape($i)."',\n";
|
$x .= "\ticon: '".Util::jsEscape($i)."',\n";
|
||||||
if ($spell->getTooltip())
|
if ($t = $spell->renderTooltip($Id))
|
||||||
$x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($spell->tooltip)."'";
|
$x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($t)."'";
|
||||||
if ($spell->getBuff())
|
if ($b = $spell->renderBuff($Id))
|
||||||
$x .= ",\n\tbuff_".User::$localeString.": '".Util::jsEscape($spell->buff)."'\n";
|
$x .= ",\n\tbuff_".User::$localeString.": '".Util::jsEscape($b)."'\n";
|
||||||
$x .= '});';
|
$x .= '});';
|
||||||
|
|
||||||
$smarty->saveCache($cacheKeyTooltip, $x);
|
$smarty->saveCache($cacheKeyTooltip, $x);
|
||||||
@@ -42,16 +42,14 @@ if (isset($_GET['power']))
|
|||||||
die($x);
|
die($x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||||
|
{
|
||||||
|
$spell = new SpellList(array(['Id', $Id]));
|
||||||
|
|
||||||
// v there be dragons v
|
// v there be dragons v
|
||||||
|
|
||||||
|
|
||||||
if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
|
||||||
{
|
|
||||||
unset($spell);
|
|
||||||
|
|
||||||
// Spelldata
|
// Spelldata
|
||||||
if ($spellObj = new Spell($id))
|
if ($spellObj = new SpellList(array(['Id', $Id])))
|
||||||
{
|
{
|
||||||
$row = $spellObj->template; // equivalent to 5 layers of panzertape
|
$row = $spellObj->template; // equivalent to 5 layers of panzertape
|
||||||
|
|
||||||
@@ -142,7 +140,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
|||||||
$spell['stances'] = Lang::getStances($row['stanceMask']);
|
$spell['stances'] = Lang::getStances($row['stanceMask']);
|
||||||
|
|
||||||
// Btt - Buff TollTip
|
// Btt - Buff TollTip
|
||||||
if ($buff = $spellObj->getBuff())
|
if ($buff = $spellObj->renderBuff())
|
||||||
$spell['btt'] = $buff;
|
$spell['btt'] = $buff;
|
||||||
|
|
||||||
// Iterate through all effects:
|
// Iterate through all effects:
|
||||||
@@ -566,7 +564,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
|||||||
FROM ?_spellicons s, ?_achievementcriteria c, ?_achievement a
|
FROM ?_spellicons s, ?_achievementcriteria c, ?_achievement a
|
||||||
LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID
|
LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID
|
||||||
WHERE
|
WHERE
|
||||||
a.iconId = s.id
|
a.icon = s.id
|
||||||
AND a.id = c.refAchievement
|
AND a.id = c.refAchievement
|
||||||
AND c.type IN (?a)
|
AND c.type IN (?a)
|
||||||
AND c.value1 = ?d
|
AND c.value1 = ?d
|
||||||
|
|||||||
@@ -12,43 +12,54 @@ $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, $Id, -1, User::$locale
|
|||||||
|
|
||||||
if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||||
{
|
{
|
||||||
$title = new Title($Id);
|
$title = new TitleList(array(['Id', $Id]));
|
||||||
if ($title->template)
|
if ($title->error)
|
||||||
{
|
{
|
||||||
$title->addGlobalsToJScript($pageData['gTitles']);
|
$smarty->updatePageVars(array(
|
||||||
|
'subject' => ucfirst(Lang::$game['title']),
|
||||||
|
'id' => $Id,
|
||||||
|
'notFound' => sprintf(Lang::$main['pageNotFound'], Lang::$game['title']),
|
||||||
|
));
|
||||||
|
$smarty->assign('lang', Lang::$main);
|
||||||
|
$smarty->display('404.tpl');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$title->addGlobalsToJscript($pageData);
|
||||||
|
|
||||||
$infobox = [];
|
$infobox = [];
|
||||||
$colon = User::$localeId == LOCALE_FR ? ' : ' : ': '; // Je suis un prick! <_<
|
$colon = User::$localeId == LOCALE_FR ? ' : ' : ': '; // Je suis un prick! <_<
|
||||||
if ($title->template['side'] == 1)
|
if ($title->getField('side') == 1)
|
||||||
$infobox[] = Lang::$main['side'].$colon.'[span class=alliance-icon]'.Lang::$game['alliance'].'[/span]';
|
$infobox[] = Lang::$main['side'].$colon.'[span class=alliance-icon]'.Lang::$game['alliance'].'[/span]';
|
||||||
else if ($title->template['side'] == 2)
|
else if ($title->getField('side') == 2)
|
||||||
$infobox[] = Lang::$main['side'].$colon.'[span class=horde-icon]'.Lang::$game['horde'].'[/span]';
|
$infobox[] = Lang::$main['side'].$colon.'[span class=horde-icon]'.Lang::$game['horde'].'[/span]';
|
||||||
else
|
else
|
||||||
$infobox[] = Lang::$main['side'].$colon.Lang::$main['both'];
|
$infobox[] = Lang::$main['side'].$colon.Lang::$main['both'];
|
||||||
|
|
||||||
if ($title->template['gender'])
|
if ($g = $title->getField('gender'))
|
||||||
$infobox[] = Lang::$main['gender'].$colon.'[span class='.($title->template['gender'] == 2 ? 'female' : 'male').'-icon]'.Lang::$main['sex'][$title->template['gender']].'[/span]';
|
$infobox[] = Lang::$main['gender'].$colon.'[span class='.($g == 2 ? 'female' : 'male').'-icon]'.Lang::$main['sex'][$g].'[/span]';
|
||||||
|
|
||||||
if ($title->template['eventId'])
|
if ($e = $title->getField('eventId'))
|
||||||
$infobox[] = Lang::$game['eventShort'].$colon.'[url=?event='.$title->template['eventId'].']'.WorldEvent::getName($title->template['eventId']).'[/url]';
|
$infobox[] = Lang::$game['eventShort'].$colon.'[url=?event='.$e.']'.WorldEvent::getName($e).'[/url]';
|
||||||
|
|
||||||
$pageData = array(
|
$pageData = array(
|
||||||
'page' => array(
|
'page' => array(
|
||||||
'name' => $title->getHtmlizedName(),
|
'name' => $title->getHtmlizedName(),
|
||||||
'id' => $title->Id,
|
'id' => $Id,
|
||||||
'expansion' => Util::$expansionString[$title->template['expansion']]
|
'expansion' => Util::$expansionString[$title->getField('expansion')]
|
||||||
),
|
),
|
||||||
'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]',
|
'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($title->source as $type => $entries)
|
foreach ($title->sources[$Id] as $type => $entries)
|
||||||
{
|
{
|
||||||
// todo: hidden-/visibleCols by actual use
|
// todo: hidden-/visibleCols by actual use
|
||||||
switch ($type)
|
switch ($type)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
$quests = new QuestList(array(['id', $entries]));
|
$quests = new QuestList(array(['Id', $entries]));
|
||||||
$quests->addRewardsToJscript($pageData['gItems'], $pageData['gSpells'], $pageData['gTitles']);
|
$quests->addRewardsToJscript($pageData);
|
||||||
|
|
||||||
$pageData['page']['questReward'] = $quests->getListviewData();
|
$pageData['page']['questReward'] = $quests->getListviewData();
|
||||||
$pageData['page']['questParams'] = array(
|
$pageData['page']['questParams'] = array(
|
||||||
@@ -59,9 +70,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
$acvs = new AchievementList(array(['id', $entries]));
|
$acvs = new AchievementList(array(['Id', $entries]));
|
||||||
$acvs->addGlobalsToJScript($pageData['gAchievements']);
|
$acvs->addGlobalsToJscript($pageData);
|
||||||
$acvs->addRewardsToJscript($pageData['gItems'], $pageData['gTitles']);
|
$acvs->addRewardsToJscript($pageData);
|
||||||
|
|
||||||
$pageData['page']['acvReward'] = $acvs->getListviewData();
|
$pageData['page']['acvReward'] = $acvs->getListviewData();
|
||||||
$pageData['page']['acvParams'] = array(
|
$pageData['page']['acvParams'] = array(
|
||||||
@@ -76,30 +87,21 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pageData['title'] = ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->name[0]))));
|
$pageData['title'] = ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->name[0]))));
|
||||||
|
$pageData['path'] = '[0, 10, '.$title->getField('category').']';
|
||||||
|
|
||||||
$smarty->saveCache($cacheKeyPage, $pageData);
|
$smarty->saveCache($cacheKeyPage, $pageData);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$smarty->updatePageVars(array(
|
|
||||||
'subject' => ucfirst(Lang::$game['title']),
|
|
||||||
'id' => $Id,
|
|
||||||
'notFound' => sprintf(Lang::$main['pageNotFound'], Lang::$game['title']),
|
|
||||||
));
|
|
||||||
$smarty->assign('lang', Lang::$main);
|
|
||||||
$smarty->display('404.tpl');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$smarty->updatePageVars(array(
|
$smarty->updatePageVars(array(
|
||||||
'title' => $pageData['title']." - ".ucfirst(Lang::$game['title']),
|
'title' => $pageData['title']." - ".ucfirst(Lang::$game['title']),
|
||||||
'path' => "[0, 10, ".$title->template['category']."]",
|
'path' => $pageData['path'],
|
||||||
'tab' => 0, // for g_initHeader($tab)
|
'tab' => 0, // for g_initHeader($tab)
|
||||||
'type' => TYPE_TITLE, // 11:Titles
|
'type' => TYPE_TITLE, // 11:Titles
|
||||||
'typeId' => $Id
|
'typeId' => $Id
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "title" OR page = "*")');
|
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "title" OR page = "*")');
|
||||||
foreach ($announcements as $k => $v)
|
foreach ($announcements as $k => $v)
|
||||||
|
|||||||
@@ -19,65 +19,14 @@ if (!$smarty->loadCache($cacheKey, $pageData))
|
|||||||
$titles = new TitleList(isset($cat) ? array(['category', (int)$cat]) : []);
|
$titles = new TitleList(isset($cat) ? array(['category', (int)$cat]) : []);
|
||||||
$listview = $titles->getListviewData();
|
$listview = $titles->getListviewData();
|
||||||
|
|
||||||
$sources = array(
|
$pageData = array(
|
||||||
4 => [], // Quest
|
'page' => $listview,
|
||||||
12 => [], // Achievement
|
'params' => array(
|
||||||
13 => [] // DB-Text
|
'parent' => false,
|
||||||
|
'tabs' => false
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// parse sources
|
|
||||||
foreach ($listview as $lvTitle)
|
|
||||||
{
|
|
||||||
if(!isset($lvTitle['source']))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
foreach (array_keys($sources) as $srcKey)
|
|
||||||
if (isset($lvTitle['source'][$srcKey]))
|
|
||||||
$sources[$srcKey] = array_merge($sources[$srcKey], $lvTitle['source'][$srcKey]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// replace with suitable objects
|
|
||||||
if (!empty($sources[4]))
|
|
||||||
$sources[4] = new QuestList(array(['Id', $sources[4]]));
|
|
||||||
|
|
||||||
if (!empty($sources[12]))
|
|
||||||
$sources[12] = new AchievementList(array(['Id', $sources[12]]));
|
|
||||||
|
|
||||||
if (!empty($sources[13]))
|
|
||||||
$sources[13] = DB::Aowow()->SELECT('SELECT *, Id AS ARRAY_KEY FROM ?_sourceStrings WHERE Id IN (?a)', $sources[13]);
|
|
||||||
|
|
||||||
foreach ($listview as $k => $lvTitle)
|
|
||||||
{
|
|
||||||
if(!isset($lvTitle['source']))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Quest-source
|
|
||||||
if (isset($lvTitle['source'][4]))
|
|
||||||
{
|
|
||||||
$ids = $lvTitle['source'][4];
|
|
||||||
$listview[$k]['source'][4] = [];
|
|
||||||
foreach ($ids as $id)
|
|
||||||
$listview[$k]['source'][4][] = $sources[4]->container[$id]->getSourceData();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Achievement-source
|
|
||||||
if (isset($lvTitle['source'][12]))
|
|
||||||
{
|
|
||||||
$ids = $lvTitle['source'][12];
|
|
||||||
$listview[$k]['source'][12] = [];
|
|
||||||
foreach ($ids as $id)
|
|
||||||
$listview[$k]['source'][12][] = $sources[12]->container[$id]->getSourceData();
|
|
||||||
}
|
|
||||||
|
|
||||||
// other source (only one item possible, so no iteration needed)
|
|
||||||
if (isset($lvTitle['source'][13]))
|
|
||||||
$listview[$k]['source'][13] = [$sources[13][$lvTitle['source'][13][0]]];
|
|
||||||
|
|
||||||
$listview[$k]['source'] = json_encode($listview[$k]['source']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pageData['page'] = $listview;
|
|
||||||
|
|
||||||
$smarty->saveCache($cacheKey, $pageData);
|
$smarty->saveCache($cacheKey, $pageData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
// from g_item_slots: 13:"One-Hand", 26:"Ranged", 17:"Two-Hand",
|
// from g_item_slots: 13:"One-Hand", 26:"Ranged", 17:"Two-Hand",
|
||||||
$slotPointer = [13, 17, 26, 26, 13, 17, 17, 13, 17, null, 17, null, null, 13, null, 13, null, null, null, null, 17];
|
$slotPointer = [13, 17, 26, 26, 13, 17, 17, 13, 17, null, 17, null, null, 13, null, 13, null, null, null, null, 17];
|
||||||
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
|
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
|
||||||
$enchantSpells = new SpellList([['effect1Id', '=', '53'], ['name_loc0', 'NOT LIKE', 'QA%']]); // enchantItemPermanent && !qualityAssurance
|
$enchantSpells = new SpellList([['effect1Id', 53], ['name_loc0', 'QA%', '!']]); // enchantItemPermanent && !qualityAssurance
|
||||||
$castItems = [];
|
$castItems = [];
|
||||||
$jsonEnchants = [];
|
$jsonEnchants = [];
|
||||||
|
|
||||||
@@ -72,29 +72,29 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
|
|
||||||
$enchantsOut = [];
|
$enchantsOut = [];
|
||||||
|
|
||||||
foreach ($enchantSpells->spellList as $spl)
|
while ($enchantSpells->iterate())
|
||||||
{
|
{
|
||||||
$enchant = DB::Aowow()->SelectRow('SELECT * FROM ?_itemEnchantment WHERE Id = ?d', $spl->template['effect1MiscValue']);
|
$enchant = DB::Aowow()->SelectRow('SELECT * FROM ?_itemEnchantment WHERE Id = ?d', $enchantSpells->getField('effect1MiscValue'));
|
||||||
if (!$enchant) // 'shouldn't' happen
|
if (!$enchant) // 'shouldn't' happen
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// slots have to be recalculated
|
// slots have to be recalculated
|
||||||
$slot = 0;
|
$slot = 0;
|
||||||
if ($spl->template['equippedItemClass'] == 4) // armor
|
if ($enchantSpells->getField('equippedItemClass') == 4) // armor
|
||||||
{
|
{
|
||||||
if ($invType = $spl->template['equippedItemInventoryTypeMask'])
|
if ($invType = $enchantSpells->getField('equippedItemInventoryTypeMask'))
|
||||||
$slot = $spl->template['equippedItemInventoryTypeMask'] >> 1;
|
$slot = $enchantSpells->getField('equippedItemInventoryTypeMask') >> 1;
|
||||||
else /* if (equippedItemSubClassMask == 64) */ // shields have it their own way <_<
|
else /* if (equippedItemSubClassMask == 64) */ // shields have it their own way <_<
|
||||||
$slot = (1 << (14 - 1));
|
$slot = (1 << (14 - 1));
|
||||||
}
|
}
|
||||||
else if ($spl->template['equippedItemClass'] == 2) // weapon
|
else if ($enchantSpells->getField('equippedItemClass') == 2) // weapon
|
||||||
{
|
{
|
||||||
foreach ($slotPointer as $i => $sp)
|
foreach ($slotPointer as $i => $sp)
|
||||||
{
|
{
|
||||||
if (!$sp)
|
if (!$sp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((1 << $i) & $spl->template['equippedItemSubClassMask'])
|
if ((1 << $i) & $enchantSpells->getField('equippedItemSubClassMask'))
|
||||||
{
|
{
|
||||||
if ($sp == 13) // also mainHand & offHand *siiigh*
|
if ($sp == 13) // also mainHand & offHand *siiigh*
|
||||||
$slot |= ((1 << (21 - 1)) | (1 << (22 - 1)));
|
$slot |= ((1 << (21 - 1)) | (1 << (22 - 1)));
|
||||||
@@ -112,7 +112,7 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
$ench = array(
|
$ench = array(
|
||||||
'name' => [], // set by skill or item
|
'name' => [], // set by skill or item
|
||||||
'quality' => -1, // modified if item
|
'quality' => -1, // modified if item
|
||||||
'icon' => strToLower($spl->template['iconString']), // item over spell
|
'icon' => strToLower($enchantSpells->getField('iconString')), // item over spell
|
||||||
'source' => [], // <0: item; >0:spell
|
'source' => [], // <0: item; >0:spell
|
||||||
'skill' => -1, // modified if skill
|
'skill' => -1, // modified if skill
|
||||||
'slots' => [], // determied per spell but set per item
|
'slots' => [], // determied per spell but set per item
|
||||||
@@ -132,37 +132,38 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
$ench['jsonequip']['reqlevel'] = $enchant['requiredLevel'];
|
$ench['jsonequip']['reqlevel'] = $enchant['requiredLevel'];
|
||||||
|
|
||||||
// check if the spell has an entry in skill_line_ability -> Source:Profession
|
// check if the spell has an entry in skill_line_ability -> Source:Profession
|
||||||
if ($skill = DB::Aowow()->SelectCell('SELECT skillId FROM ?_skill_line_ability WHERE spellId = ?d', $spl->Id))
|
if ($skill = DB::Aowow()->SelectCell('SELECT skillId FROM ?_skill_line_ability WHERE spellId = ?d', $enchantSpells->Id))
|
||||||
{
|
{
|
||||||
$ench['name'][] = Util::jsEscape(Util::localizedString($spl->template, 'name'));
|
$ench['name'][] = Util::jsEscape($enchantSpells->names[$enchantSpells->Id]));
|
||||||
$ench['source'][] = $spl->Id;
|
$ench['source'][] = $enchantSpells->Id;
|
||||||
$ench['skill'] = $skill;
|
$ench['skill'] = $skill;
|
||||||
$ench['slots'][] = $slot;
|
$ench['slots'][] = $slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if this item can be cast via item -> Source:Item
|
// check if this item can be cast via item -> Source:Item
|
||||||
if (!isset($castItems[$spl->Id]))
|
if (!isset($castItems[$enchantSpells->Id]))
|
||||||
$castItems[$spl->Id] = new ItemList([['spellid_1', '=', $spl->Id], ['name', 'NOT LIKE', 'Scroll of Enchant%']]); // do not reuse enchantment scrolls
|
$castItems[$enchantSpells->Id] = new ItemList([['spellid_1', $enchantSpells->Id], ['name', 'Scroll of Enchant%', '!']]); // do not reuse enchantment scrolls
|
||||||
|
|
||||||
foreach ($castItems[$spl->Id]->container as $item)
|
$cI &= $castItems[$enchantSpells->Id]; // this construct is a bit .. unwieldy
|
||||||
|
while ($cI->iterate())
|
||||||
{
|
{
|
||||||
$ench['name'][] = Util::jsEscape(Util::localizedString($item->template, 'name'));
|
$ench['name'][] = Util::jsEscape($cI->names[$cI->Id]);
|
||||||
$ench['source'][] = -$item->Id;
|
$ench['source'][] = -$cI->Id;
|
||||||
$ench['icon'] = strTolower($item->template['icon']);
|
$ench['icon'] = strTolower($cI->getField('icon'));
|
||||||
$ench['slots'][] = $slot;
|
$ench['slots'][] = $slot;
|
||||||
|
|
||||||
if ($item->template['Quality'] > $ench['quality'])
|
if ($cI->getField('Quality') > $ench['quality'])
|
||||||
$ench['quality'] = $item->template['Quality'];
|
$ench['quality'] = $cI->getField('Quality');
|
||||||
|
|
||||||
if ($item->template['AllowableClass'] > 0)
|
if ($cI->getField('AllowableClass') > 0)
|
||||||
{
|
{
|
||||||
$ench['classes'] = $item->template['AllowableClass'];
|
$ench['classes'] = $cI->getField('AllowableClass');
|
||||||
$ench['jsonequip']['classes'] = $item->template['AllowableClass'];
|
$ench['jsonequip']['classes'] = $cI->getField('AllowableClass');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($ench['jsonequip']['reqlevel']))
|
if (!isset($ench['jsonequip']['reqlevel']))
|
||||||
if ($item->template['RequiredLevel'] > 0)
|
if ($cI->getField('RequiredLevel') > 0)
|
||||||
$ench['jsonequip']['reqlevel'] = $item->template['RequiredLevel'];
|
$ench['jsonequip']['reqlevel'] = $cI->getField('RequiredLevel');
|
||||||
}
|
}
|
||||||
|
|
||||||
// enchant spell not in use
|
// enchant spell not in use
|
||||||
|
|||||||
@@ -127,6 +127,13 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
|
|
||||||
echo "script set up in ".Util::execTime()."<br>\n";
|
echo "script set up in ".Util::execTime()."<br>\n";
|
||||||
|
|
||||||
|
$glyphSpells = [];
|
||||||
|
foreach ($glyphList as $pop)
|
||||||
|
if ($pop['glyphEffect'])
|
||||||
|
$glyphSpells[] = $pop['glyphEffect'];
|
||||||
|
|
||||||
|
$glyphSpells = new SpellList(array(['Id', $glyphSpells]));
|
||||||
|
|
||||||
foreach ($locales as $lId)
|
foreach ($locales as $lId)
|
||||||
{
|
{
|
||||||
User::useLocale($lId);
|
User::useLocale($lId);
|
||||||
@@ -138,16 +145,17 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
if (!$pop['glyphEffect'])
|
if (!$pop['glyphEffect'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$spl = new Spell($pop['glyphEffect']);
|
while ($glyphSpells->Id != $pop['glyphEffect'])
|
||||||
|
$glyphSpells->iterate();
|
||||||
|
|
||||||
if ($spl->template['effect1Id'] != 6 && $spl->template['effect2Id'] != 6 && $spl->template['effect3Id'] != 6)
|
if ($glyphSpells->getField('effect1Id') != 6 && $glyphSpells->getField('effect2Id') != 6 && $glyphSpells->getField('effect3Id') != 6)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ($pop['itemId'] == 42958) // Crippling Poison has no skillLine.. oO => hardcode
|
if ($pop['itemId'] == 42958) // Crippling Poison has no skillLine.. oO => hardcode
|
||||||
{
|
{
|
||||||
$glyphsOut[$pop['itemId']] = array(
|
$glyphsOut[$pop['itemId']] = array(
|
||||||
'name' => Util::jsEscape(Util::localizedString($pop, 'name')),
|
'name' => Util::jsEscape(Util::localizedString($pop, 'name')),
|
||||||
'description' => Util::jsEscape($spl->parseText()),
|
'description' => Util::jsEscape($glyphSpells->parseText()),
|
||||||
'icon' => 'ability_poisonsting',
|
'icon' => 'ability_poisonsting',
|
||||||
'type' => 0,
|
'type' => 0,
|
||||||
'classs' => $pop['classs'],
|
'classs' => $pop['classs'],
|
||||||
@@ -158,7 +166,7 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$description = $spl->parseText();
|
$description = $glyphSpells->parseText();
|
||||||
$spellFamily = $class2Family[$pop['classs']];
|
$spellFamily = $class2Family[$pop['classs']];
|
||||||
$classId = $pop['classs'] - 1;
|
$classId = $pop['classs'] - 1;
|
||||||
$skill = 0;
|
$skill = 0;
|
||||||
@@ -181,11 +189,11 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
while (empty($icons) && $i < 3)
|
while (empty($icons) && $i < 3)
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
$m1 = $spl->template['effect1SpellClassMask'.$l[$i]];
|
$m1 = $glyphSpells->getField('effect1SpellClassMask'.$l[$i]);
|
||||||
$m2 = $spl->template['effect2SpellClassMask'.$l[$i]];
|
$m2 = $glyphSpells->getField('effect2SpellClassMask'.$l[$i]);
|
||||||
$m3 = $spl->template['effect3SpellClassMask'.$l[$i]];
|
$m3 = $glyphSpells->getField('effect3SpellClassMask'.$l[$i]);
|
||||||
|
|
||||||
if ($spl->template['effect'.$i.'Id'] != 6 || (!$m1 && !$m2 && !$m3))
|
if ($glyphSpells->getField('effect'.$i.'Id') != 6 || (!$m1 && !$m2 && !$m3))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$where = "SpellFamilyId = ?d AND ((SpellFamilyFlags3 & 0xFFFFFFFF) & ?d OR (SpellFamilyFlags2 & 0xFFFFFFFF) & ?d OR (SpellFamilyFlags1 & 0xFFFFFFFF) & ?d)";
|
$where = "SpellFamilyId = ?d AND ((SpellFamilyFlags3 & 0xFFFFFFFF) & ?d OR (SpellFamilyFlags2 & 0xFFFFFFFF) & ?d OR (SpellFamilyFlags1 & 0xFFFFFFFF) & ?d)";
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
// costy and locale-independant -> cache
|
// costy and locale-independant -> cache
|
||||||
if (!isset($jsonBonus[$set['spell'.$i]]))
|
if (!isset($jsonBonus[$set['spell'.$i]]))
|
||||||
{
|
{
|
||||||
$bSpell = new Spell($set['spell'.$i]);
|
$bSpell = new SpellList(array(['Id', $set['spell'.$i]]));
|
||||||
$jsonBonus[$set['spell'.$i]] = $bSpell->getStatGain();
|
$jsonBonus[$set['spell'.$i]] = $bSpell->getStatGain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,12 +114,12 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
|
|
||||||
for ($k = 0; $k <= ($m - 1); $k++)
|
for ($k = 0; $k <= ($m - 1); $k++)
|
||||||
{
|
{
|
||||||
$tSpell = new Spell($talents[$j]['rank'.($k + 1)]);
|
$tSpell = new SpellList(array(['Id', $talents[$j]['rank'.($k + 1)]]));
|
||||||
$d[] = $tSpell->parseText();
|
$d[] = $tSpell->parseText();
|
||||||
$s[] = $talents[$j]['rank'.($k + 1)];
|
$s[] = $talents[$j]['rank'.($k + 1)];
|
||||||
|
|
||||||
if ($talents[$j]['isSpell'])
|
if ($talents[$j]['isSpell'])
|
||||||
$t[] = $tSpell->getTalentHead();
|
$t[] = $tSpell->getTalentHeadForCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($talents[$j]['dependsOn'])
|
if ($talents[$j]['dependsOn'])
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<div id="lv-titles" class="listview"></div>
|
<div id="lv-titles" class="listview"></div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{include file='bricks/title_table.tpl' data=$data.page params=null}
|
{include file='bricks/title_table.tpl' data=$data.page params=$data.params}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user