* added quests to search

* added forgotten localizations
This commit is contained in:
Sarjuuk
2013-08-03 21:10:49 +02:00
parent e834f1aee3
commit 06e5fb7278
12 changed files with 160 additions and 43 deletions

View File

@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
class ItemList extends BaseType
{
use ListviewHelper;
public static $type = TYPE_ITEM;
public $tooltip = '';
@@ -34,6 +36,15 @@ class ItemList extends BaseType
// readdress itemset .. is wrong for virtual sets
if ($pieceToSet && isset($pieceToSet[$this->id]))
$this->json[$this->id]['itemset'] = $pieceToSet[$this->id];
// unify those pesky masks
$_ = $this->curTpl['AllowableClass'];
if ($_ < 0 || ($_ & CLASS_MASK_ALL) == CLASS_MASK_ALL)
$this->templates[$this->id]['AllowableClass'] = 0;
$_ = $this->curTpl['AllowableRace'];
if ($_ < 0 || ($_ & RACE_MASK_ALL) == RACE_MASK_ALL)
$this->templates[$this->id]['AllowableRace'] = 0;
}
$this->reset(); // restore 'iterator'
@@ -134,13 +145,15 @@ class ItemList extends BaseType
if ($x = $this->curTpl['ContainerSlots'])
$data[$this->id]['nslots'] = $x;
$_ = $this->curTpl['AllowableRace'];
if ($_ && $_ & RACE_MASK_ALLIANCE != RACE_MASK_ALLIANCE && $_ & RACE_MASK_HORDE != RACE_MASK_HORDE)
$data[$this->id]['reqrace'] = $_;
if (!in_array($this->curTpl['AllowableRace'], [-1, 0]) && $this->curTpl['AllowableRace'] & RACE_MASK_ALL != RACE_MASK_ALL &&
$this->curTpl['AllowableRace'] & RACE_MASK_ALLIANCE != RACE_MASK_ALLIANCE && $this->curTpl['AllowableRace'] & RACE_MASK_HORDE != RACE_MASK_HORDE)
$data[$this->id]['reqrace'] = $this->curTpl['AllowableRace'];
if ($_ = $this->curTpl['AllowableClass'])
$data[$this->id]['reqclass'] = $_; // $data[$this->id]['classes'] ??
if (!in_array($this->curTpl['AllowableClass'], [-1, 0]) && $this->curTpl['AllowableClass'] & CLASS_MASK_ALL != CLASS_MASK_ALL)
$data[$this->id]['reqclass'] = $this->curTpl['AllowableClass']; // $data[$this->id]['classes'] ??
if ($this->curTpl['Flags'] & ITEM_FLAG_HEROIC)
$data[$this->id]['heroic'] = true;
}
/* even more complicated crap
@@ -486,7 +499,8 @@ class ItemList extends BaseType
// required races
if ($races = Lang::getRaceString($this->curTpl['AllowableRace']))
$x .= Lang::$game['races'].Lang::$colon.$races['name'].'<br />';
if ($races['side'] != SIDE_BOTH)
$x .= Lang::$game['races'].Lang::$colon.$races['name'].'<br />';
// required honorRank (not used anymore)
if ($this->curTpl['requiredhonorrank'])
@@ -876,7 +890,7 @@ class ItemList extends BaseType
}
foreach ($this->json[$this->id] as $k => $v)
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality']) && $v == "0"))
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality', 'side']) && $v == "0"))
unset($this->json[$this->id][$k]);
}
@@ -1049,7 +1063,7 @@ class ItemList extends BaseType
// clear zero-values afterwards
foreach ($json as $k => $v)
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality']) && $v == "0"))
if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality', 'side']) && $v == "0"))
unset($json[$k]);
$this->json[$json['id']] = $json;

View File

@@ -11,7 +11,7 @@ class QuestList extends BaseType
public $cat2 = 0;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM quest_template qt LEFT JOIN locales_quest lq ON qt.Id = lq.entry WHERE [filter] [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM quest_template WHERE [filter] [cond]';
protected $matchQuery = 'SELECT COUNT(1) FROM quest_template qt LEFT JOIN locales_quest lq ON qt.Id = lq.entry WHERE [filter] [cond]';
// parent::__construct does the job
@@ -61,11 +61,13 @@ class QuestList extends BaseType
return Util::localizedString($n, 'title');
}
public static function RewardXP($QuestLevel, $XPId)
public static function getXPReward($questLevel, $xpId)
{
if ($xp = DB::Aowow()->SelectCell('SELECT Field?d FROM ?_questxp WHERE Id = ?d', $XPId, $QuestLevel)) {
if (!is_numeric($xpId) || $xpId < 0 || $xpId > 8)
return 0;
if ($xp = DB::Aowow()->selectCell('SELECT Field?d FROM ?_questxp WHERE Id = ?d', $xpId, $questLevel))
return $xp;
}
else
return 0;
}
@@ -102,7 +104,9 @@ class QuestList extends BaseType
'level' => $this->curTpl['Level'],
'reqlevel' => $this->curTpl['MinLevel'],
'name' => $this->getField('Title', true),
'side' => Util::sideByRaceMask($this->curTpl['RequiredRaces'])
'side' => Util::sideByRaceMask($this->curTpl['RequiredRaces']),
'wflags' => 0x0,
'xp' => self::getXPReward($this->curTpl['Level'], $this->curTpl['RewardXPId'])
);
$rewards = [];
@@ -121,8 +125,37 @@ class QuestList extends BaseType
if ($choices)
$data[$this->id]['itemchoices'] = $choices;
if ($this->curTpl['RewardTitleId'])
$data[$this->id]['titlereward'] = $this->curTpl['RewardTitleId'];
if ($_ = $this->curTpl['RewardTitleId'])
$data[$this->id]['titlereward'] = $_;
if ($_ = $this->curTpl['Type'])
$data[$this->id]['type'] = $_;
if ($_ = $this->curTpl['RequiredClasses'])
$data[$this->id]['reqclass'] = $_;
if ($_ = $this->curTpl['RequiredRaces'])
$data[$this->id]['reqrace'] = $_;
if ($_ = $this->curTpl['RewardOrRequiredMoney'])
if ($_ > 0)
$data[$this->id]['money'] = $_;
if ($this->curTpl['Flags'] & 0x1000)
$data[$this->id]['daily'] = true;
if ($this->curTpl['Flags'] & 0x8000)
$data[$this->id]['weekly'] = true;
// flags & 64: Hostile - there are quests, that flag the player for pvp when taken .. where is that set..?
if ($this->curTpl['Flags'] & 0x4000) // Unavailable (todo (med): get disables)
{
$data[$this->id]['historical'] = true; // post 5.0
$data[$this->id]['wflags'] |= 0x1; // pre 5.0
}
if ($this->curTpl['Flags'] & 0x80000) // Auto Accept
$data[$this->id]['wflags'] |= 0x20;
// todo reprewards .. accesses QuestFactionReward.dbc
}

View File

@@ -400,6 +400,7 @@ class Lang
public static $error;
public static $search;
public static $profiler;
public static $compare;
public static $talent;
@@ -1722,16 +1723,19 @@ class Util
public static function sideByRaceMask($race)
{
if (!$race || $race == RACE_MASK_ALL) // Any
// Any
if (!$race || ($race & RACE_MASK_ALL) == RACE_MASK_ALL)
return 3;
if ($race & RACE_MASK_HORDE) // Horde
// Horde
if ($race & RACE_MASK_HORDE && !($race & RACE_MASK_ALLIANCE))
return 2;
if ($race & RACE_MASK_ALLIANCE) // Alliance
// Alliance
if ($race & RACE_MASK_ALLIANCE && !($race & RACE_MASK_HORDE))
return 1;
return 0;
return 3;
}
public static function asHex($val)