mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
NPCs / Quests
display reputattion change in list when using corresponding filters
This commit is contained in:
@@ -183,6 +183,7 @@ define('ITEMINFO_MODEL', 0x20);
|
|||||||
|
|
||||||
define('NPCINFO_TAMEABLE', 0x1);
|
define('NPCINFO_TAMEABLE', 0x1);
|
||||||
define('NPCINFO_MODEL', 0x2);
|
define('NPCINFO_MODEL', 0x2);
|
||||||
|
define('NPCINFO_REP', 0x4);
|
||||||
|
|
||||||
define('ACHIEVEMENTINFO_PROFILE', 0x1);
|
define('ACHIEVEMENTINFO_PROFILE', 0x1);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('AOWOW_REVISION', 7);
|
define('AOWOW_REVISION', 8);
|
||||||
define('CLI', PHP_SAPI === 'cli');
|
define('CLI', PHP_SAPI === 'cli');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -667,10 +667,11 @@ abstract class Filter
|
|||||||
|
|
||||||
protected $fiData = ['c' => [], 'v' =>[]];
|
protected $fiData = ['c' => [], 'v' =>[]];
|
||||||
protected $formData = array( // data to fill form fields
|
protected $formData = array( // data to fill form fields
|
||||||
'form' => [], // base form - unsanitized
|
'form' => [], // base form - unsanitized
|
||||||
'setCriteria' => [], // dynamic criteria list - index checked
|
'setCriteria' => [], // dynamic criteria list - index checked
|
||||||
'setWeights' => [], // dynamic weights list - index checked
|
'setWeights' => [], // dynamic weights list - index checked
|
||||||
'extraCols' => [] // extra columns for LV - added as required
|
'extraCols' => [], // extra columns for LV - added as required
|
||||||
|
'reputationCols' => [] // simlar and exclusive to extraCols - added as required
|
||||||
);
|
);
|
||||||
|
|
||||||
// parse the provided request into a usable format; recall self with GET-params if nessecary
|
// parse the provided request into a usable format; recall self with GET-params if nessecary
|
||||||
@@ -856,6 +857,7 @@ abstract class Filter
|
|||||||
$form[$name] = $raw ? $data : 'fi_setWeights('.Util::toJSON($data).', 0, 1, 1);';
|
$form[$name] = $raw ? $data : 'fi_setWeights('.Util::toJSON($data).', 0, 1, 1);';
|
||||||
break;
|
break;
|
||||||
case 'form':
|
case 'form':
|
||||||
|
case 'reputationCols':
|
||||||
if ($key == $name) // only if explicitely specified
|
if ($key == $name) // only if explicitely specified
|
||||||
$form[$name] = $data;
|
$form[$name] = $data;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -161,9 +161,21 @@ class CreatureList extends BaseType
|
|||||||
*
|
*
|
||||||
* NPCINFO_TAMEABLE (0x1): include texture & react
|
* NPCINFO_TAMEABLE (0x1): include texture & react
|
||||||
* NPCINFO_MODEL (0x2):
|
* NPCINFO_MODEL (0x2):
|
||||||
|
* NPCINFO_REP (0x4): include repreward
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
$rewRep = [];
|
||||||
|
|
||||||
|
if ($addInfoMask & NPCINFO_REP)
|
||||||
|
{
|
||||||
|
$rewRep = DB::World()->selectCol('
|
||||||
|
SELECT creature_id AS ARRAY_KEY, RewOnKillRepFaction1 AS ARRAY_KEY2, RewOnKillRepValue1 FROM creature_onkill_reputation WHERE creature_id IN (?a) AND RewOnKillRepFaction1 > 0 UNION
|
||||||
|
SELECT creature_id AS ARRAY_KEY, RewOnKillRepFaction2 AS ARRAY_KEY2, RewOnKillRepValue2 FROM creature_onkill_reputation WHERE creature_id IN (?a) AND RewOnKillRepFaction2 > 0',
|
||||||
|
$this->getFoundIDs(),
|
||||||
|
$this->getFoundIDs()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->iterate() as $__)
|
foreach ($this->iterate() as $__)
|
||||||
{
|
{
|
||||||
@@ -215,6 +227,14 @@ class CreatureList extends BaseType
|
|||||||
|
|
||||||
if ($addInfoMask & NPCINFO_TAMEABLE) // only first skin of first model ... we're omitting potentially 11 skins here .. but the lv accepts only one .. w/e
|
if ($addInfoMask & NPCINFO_TAMEABLE) // only first skin of first model ... we're omitting potentially 11 skins here .. but the lv accepts only one .. w/e
|
||||||
$data[$this->id]['skin'] = $this->curTpl['textureString'];
|
$data[$this->id]['skin'] = $this->curTpl['textureString'];
|
||||||
|
|
||||||
|
if ($addInfoMask & NPCINFO_REP)
|
||||||
|
{
|
||||||
|
$data[$this->id]['reprewards'] = [];
|
||||||
|
if ($rewRep[$this->id])
|
||||||
|
foreach ($rewRep[$this->id] as $fac => $val)
|
||||||
|
$data[$this->id]['reprewards'][] = [$fac, $val];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,6 +447,9 @@ class CreatureListFilter extends Filter
|
|||||||
case 42: // increasesrepwith [enum]
|
case 42: // increasesrepwith [enum]
|
||||||
if (in_array($cr[1], $this->enums[3])) // reuse
|
if (in_array($cr[1], $this->enums[3])) // reuse
|
||||||
{
|
{
|
||||||
|
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
|
||||||
|
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
|
||||||
|
|
||||||
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 > 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 > 0)', $cr[1], $cr[1]))
|
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 > 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 > 0)', $cr[1], $cr[1]))
|
||||||
return ['id', $cIds];
|
return ['id', $cIds];
|
||||||
else
|
else
|
||||||
@@ -437,6 +460,9 @@ class CreatureListFilter extends Filter
|
|||||||
case 43: // decreasesrepwith [enum]
|
case 43: // decreasesrepwith [enum]
|
||||||
if (in_array($cr[1], $this->enums[3])) // reuse
|
if (in_array($cr[1], $this->enums[3])) // reuse
|
||||||
{
|
{
|
||||||
|
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
|
||||||
|
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
|
||||||
|
|
||||||
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 < 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 < 0)', $cr[1], $cr[1]))
|
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 < 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 < 0)', $cr[1], $cr[1]))
|
||||||
return ['id', $cIds];
|
return ['id', $cIds];
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -457,6 +457,9 @@ class QuestListFilter extends Filter
|
|||||||
case 1: // increasesrepwith
|
case 1: // increasesrepwith
|
||||||
if ($this->isSaneNumeric($cr[1]) && $cr[1] > 0)
|
if ($this->isSaneNumeric($cr[1]) && $cr[1] > 0)
|
||||||
{
|
{
|
||||||
|
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
|
||||||
|
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'OR',
|
'OR',
|
||||||
['AND', ['rewardFactionId1', $cr[1]], ['rewardFactionValue1', 0, '>']],
|
['AND', ['rewardFactionId1', $cr[1]], ['rewardFactionValue1', 0, '>']],
|
||||||
@@ -470,6 +473,9 @@ class QuestListFilter extends Filter
|
|||||||
case 10: // decreasesrepwith
|
case 10: // decreasesrepwith
|
||||||
if ($this->isSaneNumeric($cr[1]) && $cr[1] > 0)
|
if ($this->isSaneNumeric($cr[1]) && $cr[1] > 0)
|
||||||
{
|
{
|
||||||
|
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
|
||||||
|
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'OR',
|
'OR',
|
||||||
['AND', ['rewardFactionId1', $cr[1]], ['rewardFactionValue1', 0, '<']],
|
['AND', ['rewardFactionId1', $cr[1]], ['rewardFactionValue1', 0, '<']],
|
||||||
|
|||||||
@@ -57,13 +57,17 @@ class NpcsPage extends GenericPage
|
|||||||
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
|
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
|
||||||
$this->filter['fi'] = $this->filterObj->getForm();
|
$this->filter['fi'] = $this->filterObj->getForm();
|
||||||
|
|
||||||
|
$repCols = $this->filterObj->getForm('reputationCols');
|
||||||
|
|
||||||
$lv = array(
|
$lv = array(
|
||||||
'file' => 'creature',
|
'file' => 'creature',
|
||||||
'data' => $npcs->getListviewData(), // listview content
|
'data' => $npcs->getListviewData($repCols ? NPCINFO_REP : 0x0),
|
||||||
'params' => []
|
'params' => []
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($this->filter['fi']['extraCols']))
|
if ($repCols)
|
||||||
|
$lv['params']['extraCols'] = '$fi_getReputationCols('.Util::toJSON($repCols).')';
|
||||||
|
else if (!empty($this->filter['fi']['extraCols']))
|
||||||
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
|
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
|
||||||
|
|
||||||
if ($this->category)
|
if ($this->category)
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ class QuestsPage extends GenericPage
|
|||||||
'params' => []
|
'params' => []
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($this->filter['fi']['extraCols']))
|
if ($_ = $this->filterObj->getForm('reputationCols'))
|
||||||
|
$lv['params']['extraCols'] = '$fi_getReputationCols('.Util::toJSON($_).')';
|
||||||
|
else if (!empty($this->filter['fi']['extraCols']))
|
||||||
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
|
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
|
||||||
|
|
||||||
// create note if search limit was exceeded
|
// create note if search limit was exceeded
|
||||||
|
|||||||
Reference in New Issue
Block a user