* fixed display of reputation columns on listviews on detail page
This commit is contained in:
Sarjuuk
2015-08-04 21:23:49 +02:00
parent 7ce72bf623
commit a0887f189f
5 changed files with 35 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
define('AOWOW_REVISION', 12); define('AOWOW_REVISION', 13);
define('CLI', PHP_SAPI === 'cli'); define('CLI', PHP_SAPI === 'cli');

View File

@@ -195,23 +195,31 @@ class FactionPage extends GenericPage
if ($this->subject->getField('reputationIndex') != -1) // only if you can actually gain reputation by kills if ($this->subject->getField('reputationIndex') != -1) // only if you can actually gain reputation by kills
{ {
// inherit siblings/children from $spillover // inherit siblings/children from $spillover
$cIds = DB::World()->selectCol('SELECT DISTINCT creature_id FROM creature_onkill_reputation WHERE $cRep = DB::World()->selectCol('SELECT DISTINCT creature_id AS ARRAY_KEY, qty FROM (
(RewOnKillRepValue1 > 0 AND (RewOnKillRepFaction1 = ?d{ OR (RewOnKillRepFaction1 IN (?a) AND IsTeamAward1 <> 0)})) OR SELECT creature_id, RewOnKillRepValue1 as qty FROM creature_onkill_reputation WHERE RewOnKillRepValue1 > 0 AND (RewOnKillRepFaction1 = ?d{ OR (RewOnKillRepFaction1 IN (?a) AND IsTeamAward1 <> 0)}) UNION
(RewOnKillRepValue2 > 0 AND (RewOnKillRepFaction2 = ?d{ OR (RewOnKillRepFaction2 IN (?a) AND IsTeamAward2 <> 0)}))', SELECT creature_id, RewOnKillRepValue2 as qty FROM creature_onkill_reputation WHERE RewOnKillRepValue2 > 0 AND (RewOnKillRepFaction2 = ?d{ OR (RewOnKillRepFaction2 IN (?a) AND IsTeamAward2 <> 0)})
) x',
$this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP, $this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP,
$this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP $this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP
); );
if ($cIds) if ($cRep)
{ {
$killCreatures = new CreatureList(array(['id', $cIds])); $killCreatures = new CreatureList(array(['id', array_keys($cRep)]));
if (!$killCreatures->error) if (!$killCreatures->error)
{ {
$data = $killCreatures->getListviewData();
foreach ($data as $id => &$d)
$d['reputation'] = $cRep[$id];
$tab = array( $tab = array(
'file' => 'creature', 'file' => 'creature',
'data' => $killCreatures->getListviewData(), 'data' => $data,
'showRep' => true, 'showRep' => true,
'params' => [] 'params' => array(
'extraCols' => '$_',
'sort' => "$['-reputation', 'name']"
)
); );
if ($killCreatures->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($killCreatures->getMatches() > CFG_SQL_LIMIT_DEFAULT)

View File

@@ -1,3 +1,20 @@
<?php
if (!empty($params['extraCols']) && strpos($params['extraCols'], '_')):
?>
var _ = [
{
id: 'reputation',
after: 'location',
name: LANG.rep,
tooltip: LANG.tooltip_repgain,
width: '8%',
value: 'reputation'
}
];
<?php
endif;
?>
new Listview({ new Listview({
template:'npc', template:'npc',
<?php <?php

View File

@@ -1,5 +1,5 @@
<?php <?php
if (!empty($lv['showRep'])): if (!empty($params['extraCols']) && strpos($params['extraCols'], '_')):
?> ?>
var _ = [ var _ = [
{ {

View File

@@ -1,5 +1,5 @@
<?php <?php
if (!empty($lv['showRep'])): if (!empty($params['extraCols']) && strpos($params['extraCols'], '_')):
?> ?>
var _ = [ var _ = [
{ {