mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
- implemented factions basics (search, listview and details)
- added forgotten shared brick for tooltips
This commit is contained in:
@@ -136,6 +136,7 @@ define('CUSTOM_HAS_VIDEO', 0x04000000);
|
||||
define('CUSTOM_DISABLED', 0x08000000);
|
||||
define('CUSTOM_SERVERSIDE', 0x10000000);
|
||||
define('CUSTOM_UNAVAILABLE', 0x20000000);
|
||||
define('CUSTOM_EXCLUDE_FOR_LISTVIEW', 0x40000000); // will not show up in search or on listPage (override for staff)
|
||||
|
||||
// Custom Flags (per type)
|
||||
define('SPELL_CU_TALENT', 0x0001); // passive talent
|
||||
@@ -147,7 +148,7 @@ define('SPELL_CU_PET_TALENT_TYPE2', 0x0020); // Cunning
|
||||
define('SPELL_CU_GLYPH_MAJOR', 0x0040);
|
||||
define('SPELL_CU_GLYPH_MINOR', 0x0080);
|
||||
define('SPELL_CU_QUALITY_MASK', 0x0F00); // set if spell creates an item: (7 - Quality) << 8
|
||||
define('SPELL_CU_EXCLUDE_CATEGORY_SEARCH', 0x1000); // only display, when searching for spells in general (!cat || cat = 0)
|
||||
// define('SPELL_CU_EXCLUDE_CATEGORY_SEARCH', 0x1000); // migrate to CUSTOM_EXCLUDE_FOR_LISTVIEW
|
||||
define('SPELL_CU_FIRST_RANK', 0x2000); // used by filter
|
||||
define('SPELL_CU_LAST_RANK', 0x4000);
|
||||
|
||||
|
||||
@@ -6,7 +6,33 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class FactionList extends BaseType
|
||||
{
|
||||
public static $type = TYPE_FACTION;
|
||||
public static $type = TYPE_FACTION;
|
||||
|
||||
protected $queryBase = 'SELECT f1.*, f1.id AS ARRAY_KEY, f1.parentFactionId AS cat FROM ?_factions f1';
|
||||
protected $queryOpts = array(
|
||||
'f1' => [['f2']],
|
||||
'f2' => ['j' => ['?_factions f2 ON f1.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat2']
|
||||
);
|
||||
|
||||
public function __construct($conditions = [])
|
||||
{
|
||||
parent::__construct($conditions);
|
||||
|
||||
if ($this->error)
|
||||
return;
|
||||
|
||||
// post processing
|
||||
foreach ($this->iterate() as &$_curTpl)
|
||||
{
|
||||
// prepare factionTemplates
|
||||
if ($_curTpl['templateIds'])
|
||||
$_curTpl['templateIds'] = explode(' ', $_curTpl['templateIds']);
|
||||
|
||||
// prepare quartermaster
|
||||
if ($_curTpl['qmNpcIds'])
|
||||
$_curTpl['qmNpcIds'] = explode(' ', $_curTpl['qmNpcIds']);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
@@ -20,24 +46,37 @@ class FactionList extends BaseType
|
||||
FROM
|
||||
?_factions
|
||||
WHERE
|
||||
factionID = ?d',
|
||||
id = ?d',
|
||||
$id
|
||||
);
|
||||
return Util::localizedString($n, 'name');
|
||||
}
|
||||
|
||||
public function reactsAgainst($faction)
|
||||
public function getListviewData()
|
||||
{
|
||||
// see factionTemplate
|
||||
/*
|
||||
1: friendly
|
||||
0: neutral
|
||||
-1: hostile
|
||||
*/
|
||||
$data = [];
|
||||
|
||||
foreach ($this->iterate() as $__)
|
||||
{
|
||||
$data[$this->id] = array(
|
||||
'category' => $this->curTpl['cat'],
|
||||
'category2' => $this->curTpl['cat2'],
|
||||
'expansion' => $this->curTpl['expansion'],
|
||||
'id' => $this->id,
|
||||
'side' => $this->curTpl['side'],
|
||||
'name' => $this->getField('name', true)
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJScript(&$template, $addMask = 0)
|
||||
{
|
||||
foreach ($this->iterate() as $__)
|
||||
$template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
|
||||
}
|
||||
|
||||
public function getListviewData() { }
|
||||
public function addGlobalsToJScript(&$template, $addMask = 0) { }
|
||||
public function renderTooltip() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -316,7 +316,10 @@ class ItemList extends BaseType
|
||||
$data[$this->id]['reqfaction'] = $x;
|
||||
|
||||
if ($x = $this->curTpl['requiredFactionRank'])
|
||||
$data[$this->id]['reqrep'] = $x;
|
||||
{
|
||||
$data[$this->id]['reqrep'] = $x;
|
||||
$data[$this->id]['standing'] = $x; // used in /faction item-listing
|
||||
}
|
||||
|
||||
if ($x = $this->curTpl['slots'])
|
||||
$data[$this->id]['nslots'] = $x;
|
||||
@@ -1237,6 +1240,9 @@ class ItemList extends BaseType
|
||||
{
|
||||
$this->ssd[$this->id] = DB::Aowow()->selectRow("SELECT * FROM ?_scalingstatdistribution WHERE id = ?", $this->curTpl['scalingStatDistribution']);
|
||||
|
||||
if (!$this->ssd[$this->id])
|
||||
return;
|
||||
|
||||
// stats and ratings
|
||||
for ($i = 1; $i <= 10; $i++)
|
||||
{
|
||||
|
||||
@@ -112,7 +112,7 @@ class QuestList extends BaseType
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getListviewData()
|
||||
public function getListviewData($extraFactionId = 0) // i should formulate a propper parameter..
|
||||
{
|
||||
$data = [];
|
||||
|
||||
@@ -170,6 +170,7 @@ class QuestList extends BaseType
|
||||
$data[$this->id]['weekly'] = true;
|
||||
|
||||
// flags & 64: Hostile - there are quests, that flag the player for pvp when taken .. where is that set..?
|
||||
// wflags: &1: disabled/historical; &32: AutoAccept; &64: Hostile(?)
|
||||
if ($this->curTpl['Flags'] & 0x4000) // Unavailable (todo (med): get disables)
|
||||
{
|
||||
$data[$this->id]['historical'] = true; // post 5.0
|
||||
@@ -179,7 +180,23 @@ class QuestList extends BaseType
|
||||
if ($this->curTpl['Flags'] & 0x80000) // Auto Accept
|
||||
$data[$this->id]['wflags'] |= 0x20;
|
||||
|
||||
// todo reprewards .. accesses QuestFactionReward.dbc
|
||||
$data[$this->id]['reprewards'] = [];
|
||||
for ($i = 1; $i < 6; $i++)
|
||||
{
|
||||
$foo = $this->curTpl['RewardFactionId'.$i];
|
||||
$bar = $this->curTpl['RewardFactionValueIdOverride'.$i] / 100;
|
||||
|
||||
if (!$bar && ($_ = $this->curTpl['RewardFactionValueId'.$i]))
|
||||
$bar = Util::$questFactionReward[abs($_)] * ($_ < 0 ? -1 : 1);
|
||||
|
||||
if ($foo && $bar)
|
||||
{
|
||||
$data[$this->id]['reprewards'][] = [$foo, $bar];
|
||||
|
||||
if ($extraFactionId == $foo)
|
||||
$data[$this->id]['reputation'] = $bar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -53,7 +53,6 @@ class SkillList extends BaseType
|
||||
|
||||
foreach ($this->iterate() as $__)
|
||||
{
|
||||
|
||||
$data[$this->id] = array(
|
||||
'category' => $this->curTpl['typeCat'],
|
||||
'categorybak' => $this->curTpl['categoryId'],
|
||||
|
||||
@@ -18,6 +18,7 @@ class Lang
|
||||
public static $class;
|
||||
public static $currency;
|
||||
public static $event;
|
||||
public static $faction;
|
||||
public static $item;
|
||||
public static $itemset;
|
||||
public static $maps;
|
||||
@@ -344,7 +345,7 @@ class SmartyAoWoW extends Smarty
|
||||
|
||||
if ($article)
|
||||
{
|
||||
$tv['article'] = ['text' => $article['article']];
|
||||
$tv['article'] = ['text' => Util::jsEscape($article['article'])];
|
||||
if (empty($tv['infobox']) && !empty($article['quickInfo']))
|
||||
$tv['infobox'] = $article['quickInfo'];
|
||||
|
||||
@@ -493,7 +494,7 @@ class SmartyAoWoW extends Smarty
|
||||
case TYPE_NPC: (new CreatureList(array(['ct.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
|
||||
case TYPE_OBJECT: (new GameobjectList(array(['gt.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
|
||||
case TYPE_ITEM: (new ItemList(array(['i.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
|
||||
case TYPE_QUEST: (new QuestList(array(['qt.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
|
||||
case TYPE_QUEST: (new QuestList(array(['qt.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
|
||||
case TYPE_SPELL: (new SpellList(array(['s.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
|
||||
case TYPE_ZONE: (new ZoneList(array(['z.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
|
||||
case TYPE_FACTION: (new FactionList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
|
||||
@@ -638,6 +639,11 @@ class Util
|
||||
10 => [ 65, 66, 67, 210, 394, 495, 3537, 3711, 4024, 4197, 4395]
|
||||
);
|
||||
|
||||
public static $questFactionReward = array( // from QuestFactionReward.dbc
|
||||
0, 10, 25, 75, 150, 250, 350, 500, 1000, 5
|
||||
);
|
||||
|
||||
|
||||
/* why:
|
||||
Because petSkills (and ranged weapon skills) are the only ones with more than two skillLines attached. Because Left Joining ?_spell with ?_skillLineAbility causes more trouble than it has uses.
|
||||
Because this is more or less the only reaonable way to fit all that information into one database field, so..
|
||||
@@ -750,8 +756,7 @@ class Util
|
||||
null, 4, 10, 9, 8, 6, 15, 11, 3, 5, null, 7
|
||||
);
|
||||
|
||||
// from DurabilityQuality.dbc
|
||||
public static $itemDurabilityQualityMod = array(
|
||||
public static $itemDurabilityQualityMod = array( // from DurabilityQuality.dbc
|
||||
null, 1.0, 0.6, 1.0, 0.8, 1.0, 1.0, 1.2, 1.25, 1.44, 2.5, 1.728, 3.0, 0.0, 0.0, 1.2, 1.25
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user