- Error handling:

* replaced error-suppressions with proper checks
  * log php errors to db
  * use __callStatic() to access localization and thus handle erronous keys
- Setup:
  * fixed some erronous filenames when generating icons
  * increased alpha threshold for spawn maps (should improve spawn points)
- disentangled DB::Aowow and DB::World. Aowow should now be able to run
  with DB::World being on a different server
- added missing faction transfer pendants (title/quest/faction/..)
- fixed extended costs for specific vendors
This commit is contained in:
Sarjuuk
2015-02-03 01:22:12 +01:00
parent acbe969b8d
commit c7fe84b7e0
59 changed files with 926 additions and 592 deletions

View File

@@ -140,10 +140,10 @@ class CommunityContent
foreach ($comments as $idx => &$c)
{
if ($subj = @$subjCache[$c['type']][$c['typeId']])
if (!empty($subjCache[$c['type']][$c['typeId']]))
{
// apply subject
$c['subject'] = $subj;
$c['subject'] = $subjCache[$c['type']][$c['typeId']];
// format date
$c['date'] = date(Util::$dateFormatInternal, $c['date']);

View File

@@ -95,7 +95,44 @@ foreach ($sets as $k => $v)
}
// handle occuring errors
error_reporting($AoWoWconf && CFG_DEBUG ? (E_ALL & ~(E_DEPRECATED | E_USER_DEPRECATED | E_STRICT)) : 0);
$errHandled = false;
set_error_handler(function($errNo, $errStr, $errFile, $errLine) use (&$errHandled) {
$errName = 'unknown error'; // errors not in this list can not be handled by set_error_handler (as per documentation) or are ignored
if ($errNo == E_WARNING) // 0x0002
$errName = 'E_WARNING';
else if ($errNo == E_PARSE) // 0x0004
$errName = 'E_PARSE';
else if ($errNo == E_NOTICE) // 0x0008
$errName = 'E_NOTICE';
else if ($errNo == E_USER_ERROR) // 0x0100
$errName = 'E_USER_ERROR';
else if ($errNo == E_USER_WARNING) // 0x0200
$errName = 'E_USER_WARNING';
else if ($errNo == E_USER_NOTICE) // 0x0400
$errName = 'E_USER_NOTICE';
else if ($errNo == E_RECOVERABLE_ERROR) // 0x1000
$errName = 'E_RECOVERABLE_ERROR';
if (User::isInGroup(U_GROUP_STAFF))
{
if (!$errHandled)
{
Util::addNote(U_GROUP_STAFF, 'one or more php related error occured, while generating this page.');
$errHandled = true;
}
Util::addNote(U_GROUP_STAFF, $errName.' - '.$errStr.' @ '.$errFile. ':'.$errLine);
}
DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()',
AOWOW_REVISION, $errNo, $errFile, $errLine, CLI ? 'CLI' : $_SERVER['QUERY_STRING'], User::$groups, $errStr
);
return !(User::isInGroup(U_GROUP_STAFF) && defined('CFG_DEBUG') && CFG_DEBUG);
}, E_ALL & ~(E_DEPRECATED | E_USER_DEPRECATED | E_STRICT));
$secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || ($AoWoWconf && CFG_FORCE_SSL);
if (defined('CFG_STATIC_HOST')) // points js to images & scripts
@@ -141,8 +178,11 @@ if (!CLI)
}
// parse page-parameters .. sanitize before use!
@list($str, $trash) = explode('&', $_SERVER['QUERY_STRING'], 2);
@list($pageCall, $pageParam) = explode('=', $str, 2);
$str = explode('&', $_SERVER['QUERY_STRING'], 2)[0];
$_ = explode('=', $str, 2);
$pageCall = $_[0];
$pageParam = isset($_[1]) ? $_[1] : null;
Util::$wowheadLink = 'http://'.Util::$subDomains[User::$localeId].'.wowhead.com/'.$str;
}
else if ($AoWoWconf)

View File

@@ -89,7 +89,7 @@ class Loot
if (!$tableName || !$lootId)
return null;
$rows = DB::Aowow()->select('SELECT * FROM ?# WHERE entry = ?d{ AND groupid = ?d}', $tableName, $lootId, $groupId ?: DBSIMPLE_SKIP);
$rows = DB::World()->select('SELECT * FROM ?# WHERE entry = ?d{ AND groupid = ?d}', $tableName, $lootId, $groupId ?: DBSIMPLE_SKIP);
if (!$rows)
return null;
@@ -167,7 +167,10 @@ class Loot
}
else if ($entry['GroupId'] && $entry['Chance'])
{
@$groupChances[$entry['GroupId']] += $entry['Chance'];
if (empty($groupChances[$entry['GroupId']]))
$groupChances[$entry['GroupId']] = 0;
$groupChances[$entry['GroupId']] += $entry['Chance'];
$set['groupChance'] = $entry['Chance'];
}
else // shouldn't have happened
@@ -184,7 +187,7 @@ class Loot
$sum = $groupChances[$k];
if (!$sum)
$sum = 0;
else if ($sum > 100)
else if ($sum >= 100.01)
{
Util::addNote(U_GROUP_EMPLOYEE, 'Loot::getByContainerRecursive: entry '.$lootId.' / group '.$k.' has a total chance of '.number_format($sum, 2).'%. Some items cannot drop!');
$sum = 100;
@@ -298,9 +301,10 @@ class Loot
{
foreach ($fields as $idx => $field)
{
$val = isset($foo[$field]) ? $foo[$field] : 0;
if (!isset($base[$idx]))
$base[$idx] = @$foo[$field];
else if ($base[$idx] != @$foo[$field])
$base[$idx] = $val;
else if ($base[$idx] != $val)
$set |= 1 << $idx;
}
@@ -422,7 +426,7 @@ class Loot
/*
get references containing the item
*/
$newRefs = DB::Aowow()->select(
$newRefs = DB::World()->select(
sprintf($query, 'lt1.item = ?d AND lt1.reference = 0'),
LOOT_REFERENCE, LOOT_REFERENCE,
$this->entry
@@ -431,7 +435,7 @@ class Loot
while ($newRefs)
{
$curRefs = $newRefs;
$newRefs = DB::Aowow()->select(
$newRefs = DB::World()->select(
sprintf($query, 'lt1.reference IN (?a)'),
LOOT_REFERENCE, LOOT_REFERENCE,
array_keys($curRefs)
@@ -445,7 +449,7 @@ class Loot
*/
for ($i = 1; $i < count($this->lootTemplates); $i++)
{
$result = $calcChance(DB::Aowow()->select(
$result = $calcChance(DB::World()->select(
sprintf($query, '{lt1.reference IN (?a) OR }(lt1.reference = 0 AND lt1.item = ?d)'),
$this->lootTemplates[$i], $this->lootTemplates[$i],
$refResults ? array_keys($refResults) : DBSIMPLE_SKIP,

View File

@@ -13,11 +13,9 @@ class AchievementList extends BaseType
public $criteria = [];
protected $queryBase = 'SELECT `a`.*, `ar`.*, `lar`.*, `a`.`id` AS ARRAY_KEY FROM ?_achievement a';
protected $queryBase = 'SELECT `a`.*, `a`.`id` AS ARRAY_KEY FROM ?_achievement a';
protected $queryOpts = array(
'a' => [['ar', 'lar', 'si'], 'o' => 'orderInGroup ASC'],
'ar' => ['j' => ['achievement_reward ar ON ar.entry = a.id', true]],
'lar' => ['j' => ['locales_achievement_reward lar ON lar.entry = a.id', true]],
'a' => [['si'], 'o' => 'orderInGroup ASC'],
'si' => ['j' => ['?_spellicon si ON si.id = a.iconId', true], 's' => ', si.iconString'],
'ac' => ['j' => ['?_achievementcriteria AS `ac` ON `ac`.`refAchievementId` = `a`.`id`', true], 'g' => '`a`.`id`']
);
@@ -30,20 +28,31 @@ class AchievementList extends BaseType
{
parent::__construct($conditions, $miscData);
if ($this->error)
return;
// post processing
foreach ($this->iterate() as &$_curTpl)
$rewards = DB::World()->select('
SELECT ar.entry AS ARRAY_KEY, ar.*, lar.* FROM achievement_reward ar LEFT JOIN locales_achievement_reward lar ON lar.entry = ar.entry WHERE ar.entry IN (?a)',
$this->getFoundIDs()
);
foreach ($this->iterate() as $_id => &$_curTpl)
{
if (!empty($rewards[$_id]))
$_curTpl = array_merge($rewards[$_id], $_curTpl);
//"rewards":[[11,137],[3,138]] [type, typeId]
$_curTpl['rewards'] = [];
if ($_ = $_curTpl['item'])
$_curTpl['rewards'][] = [TYPE_ITEM, $_];
if ($_ = $_curTpl['itemExtra'])
$_curTpl['rewards'][] = [TYPE_ITEM, $_];
if ($_ = $_curTpl['title_A'])
$_curTpl['rewards'][] = [TYPE_TITLE, $_];
if ($_ = $_curTpl['title_H'])
if ($_ != $_curTpl['title_A'])
$_curTpl['rewards'][] = [TYPE_TITLE, $_];
if (!empty($_curTpl['item']))
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['item']];
if (!empty($_curTpl['itemExtra']))
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['itemExtra']];
if (!empty($_curTpl['title_A']))
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['title_A']];
if (!empty($_curTpl['title_H']))
if (empty($_curTpl['title_A']) || $_curTpl['title_A'] != $_curTpl['title_H'])
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['title_H']];
// icon
$_curTpl['iconString'] = $_curTpl['iconString'] ?: 'trade_engineering';
@@ -285,7 +294,7 @@ class AchievementListFilter extends Filter
case 6: // last in series [yn]
return $this->int2Bool($cr[1]) ? ['AND', ['series', 0, '!'], [['series', 0xFFFF, '&'], 0]] : [['series', 0xFFFF, '&'], 0, '!'];
case 11: // Related Event [enum]
$_ = @$this->enums[$cr[0]][$cr[1]];
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if (is_int($_))

View File

@@ -498,7 +498,6 @@ trait listviewHelper
return false;
}
}
/*
@@ -516,11 +515,7 @@ trait spawnHelper
SPAWNINFO_ZONES => null
);
/*
todo (med): map in tooltips is activated by either '#map' as anchor (will automatic open mapviewer, when hovering link) in the href or as parameterless rel-parameter e.g. rel="map" in the anchor
*/
private function createShortSpawns() // [zoneId, floor, [[x1, y1], [x2, y2], ..]] as tooltip2 if enabled by <a rel="map" ...> (one area, one floor, one creature, no survivor)
private function createShortSpawns() // [zoneId, floor, [[x1, y1], [x2, y2], ..]] as tooltip2 if enabled by <a rel="map" ...> or anchor #map (one area, one floor, one creature, no survivors)
{
// first get zone/floor with the most spawns
if ($res = DB::Aowow()->selectRow('SELECT areaId, floor FROM ?_spawns WHERE type = ?d && typeId = ?d GROUP BY areaId, floor ORDER BY count(1) DESC LIMIT 1', self::$type, $this->id))
@@ -547,7 +542,7 @@ trait spawnHelper
foreach ($spawns as $s)
{
// check, if we can attach waypoints to creature
// we will get a nice clusterfuck of dots if we do this for more GUIDs, than we have colors
// we will get a nice clusterfuck of dots if we do this for more GUIDs, than we have colors though
if (count($spawns) < 6 && self::$type == TYPE_NPC)
{
if ($wPoints = DB::Aowow()->select('SELECT * FROM ?_creature_waypoints WHERE creatureOrPath = ?d AND floor = ?d', $s['pathId'] ? -$s['pathId'] : $this->id, $s['floor']))
@@ -566,7 +561,10 @@ trait spawnHelper
$set['lines'] = [[$wPoints[$i - 1]['posX'], $wPoints[$i - 1]['posY']]];
$data[$s['areaId']][$s['floor']]['coords'][] = [$p['posX'], $p['posY'], $set];
@$wpSum[$s['areaId']][$s['floor']]++;
if (empty($wpSum[$s['areaId']][$s['floor']]))
$wpSum[$s['areaId']][$s['floor']] = 1;
else
$wpSum[$s['areaId']][$s['floor']]++;
}
$wpIdx++;
}

View File

@@ -13,13 +13,10 @@ class CreatureList extends BaseType
protected $queryBase = 'SELECT ct.*, ct.id AS ARRAY_KEY FROM ?_creature ct';
public $queryOpts = array(
'ct' => [['ft', 'clsMin', 'clsMax', 'qse']],
'ct' => [['ft', 'qse']],
'ft' => ['j' => '?_factiontemplate ft ON ft.id = ct.faction', 's' => ', ft.A, ft.H, ft.factionId'],
'clsMin' => ['j' => 'creature_classlevelstats clsMin ON ct.unitClass = clsMin.class AND ct.minLevel = clsMin.level', 's' => ', clsMin.attackpower AS mleAtkPwrMin, clsMin.rangedattackpower AS rngAtkPwrMin, clsMin.baseArmor * ct.armorMod AS armorMin, (CASE ct.exp WHEN 0 THEN clsMin.damage_base WHEN 1 THEN clsMin.damage_exp1 ELSE clsMin.damage_exp2 END) AS dmgMin, (CASE ct.exp WHEN 0 THEN clsMin.basehp0 WHEN 1 THEN clsMin.basehp1 ELSE clsMin.basehp2 END) * ct.healthMod AS healthMin, clsMin.baseMana * ct.manaMod AS manaMin'],
'clsMax' => ['j' => 'creature_classlevelstats clsMax ON ct.unitClass = clsMax.class AND ct.maxLevel = clsMax.level', 's' => ', clsMax.attackpower AS mleAtkPwrMax, clsMax.rangedattackpower AS rngAtkPwrMax, clsMax.baseArmor * ct.armorMod AS armorMax, (CASE ct.exp WHEN 0 THEN clsMin.damage_base WHEN 1 THEN clsMin.damage_exp1 ELSE clsMin.damage_exp2 END) AS dmgMax, (CASE ct.exp WHEN 0 THEN clsMax.basehp0 WHEN 1 THEN clsMax.basehp1 ELSE clsMax.basehp2 END) * ct.healthMod AS healthMax, clsMax.baseMana * ct.manaMod AS manaMax'],
'qse' => ['j' => ['?_quests_startend qse ON qse.type = 1 AND qse.typeId = ct.id', true], 's' => ', IF(min(qse.method) = 1 OR max(qse.method) = 3, 1, 0) AS startsQuests, IF(min(qse.method) = 2 OR max(qse.method) = 3, 1, 0) AS endsQuests', 'g' => 'ct.id'],
'qt' => ['j' => '?_quests qt ON qse.questId = qt.id'],
'rep' => ['j' => ['creature_onkill_reputation rep ON rep.creature_id = ct.id', true]],
's' => ['j' => '?_spawns s ON s.type = 1 AND s.typeId = ct.id']
);
@@ -48,19 +45,7 @@ class CreatureList extends BaseType
public static function getName($id)
{
$n = DB::Aowow()->SelectRow('
SELECT
name_loc0,
name_loc2,
name_loc3,
name_loc6,
name_loc8
FROM
?_creature
WHERE
id = ?d',
$id
);
$n = DB::Aowow()->SelectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM ?_creature WHERE id = ?d', $id);
return Util::localizedString($n, 'name');
}
@@ -134,6 +119,7 @@ class CreatureList extends BaseType
public function getBaseStats($type)
{
// i'm aware of the BaseVariance/RangedVariance fields ... i'm just totaly unsure about the whole damage calculation
switch ($type)
{
case 'health':
@@ -325,20 +311,19 @@ class CreatureListFilter extends Filter
switch ($cr[1])
{
case '=': // min > max is totally possible
$this->extraOpts['clsMin']['h'][] = 'IF(healthMin > healthMax, healthMax, healthMin) <= '.$cr[2];
$this->extraOpts['clsMax']['h'][] = 'IF(healthMin > healthMax, healthMin, healthMax) >= '.$cr[2];
$this->extraOpts['ct']['h'][] = 'healthMin = healthMax AND healthMin = '.$cr[2];
break;
case '>':
$this->extraOpts['clsMin']['h'][] = 'IF(healthMin > healthMax, healthMax, healthMin) > '.$cr[2];
$this->extraOpts['ct']['h'][] = 'IF(healthMin > healthMax, healthMax, healthMin) > '.$cr[2];
break;
case '>=':
$this->extraOpts['clsMin']['h'][] = 'IF(healthMin > healthMax, healthMax, healthMin) >= '.$cr[2];
$this->extraOpts['ct']['h'][] = 'IF(healthMin > healthMax, healthMax, healthMin) >= '.$cr[2];
break;
case '<':
$this->extraOpts['clsMax']['h'][] = 'IF(healthMin > healthMax, healthMin, healthMax) < '.$cr[2];
$this->extraOpts['ct']['h'][] = 'IF(healthMin > healthMax, healthMin, healthMax) < '.$cr[2];
break;
case '<=':
$this->extraOpts['clsMax']['h'][] = 'IF(healthMin > healthMax, healthMin, healthMax) <= '.$cr[2];
$this->extraOpts['ct']['h'][] = 'IF(healthMin > healthMax, healthMin, healthMax) <= '.$cr[2];
break;
}
return [1]; // always true, use post-filter
@@ -350,20 +335,19 @@ class CreatureListFilter extends Filter
switch ($cr[1])
{
case '=':
$this->extraOpts['clsMin']['h'][] = 'IF(manaMin > manaMax, manaMax, manaMin) <= '.$cr[2];
$this->extraOpts['clsMax']['h'][] = 'IF(manaMin > manaMax, manaMin, manaMax) => '.$cr[2];
$this->extraOpts['ct']['h'][] = 'manaMin = manaMax AND manaMin = '.$cr[2];
break;
case '>':
$this->extraOpts['clsMax']['h'][] = 'IF(manaMin > manaMax, manaMin, manaMax) > '.$cr[2];
$this->extraOpts['ct']['h'][] = 'IF(manaMin > manaMax, manaMin, manaMax) > '.$cr[2];
break;
case '>=':
$this->extraOpts['clsMax']['h'][] = 'IF(manaMin > manaMax, manaMin, manaMax) >= '.$cr[2];
$this->extraOpts['ct']['h'][] = 'IF(manaMin > manaMax, manaMin, manaMax) >= '.$cr[2];
break;
case '<':
$this->extraOpts['clsMin']['h'][] = 'IF(manaMin > manaMax, manaMax, manaMin) < '.$cr[2];
$this->extraOpts['ct']['h'][] = 'IF(manaMin > manaMax, manaMax, manaMin) < '.$cr[2];
break;
case '<=':
$this->extraOpts['clsMin']['h'][] = 'IF(manaMin > manaMax, manaMax, manaMin) <= '.$cr[2];
$this->extraOpts['ct']['h'][] = 'IF(manaMin > manaMax, manaMax, manaMin) <= '.$cr[2];
break;
}
return [1]; // always true, use post-filter
@@ -419,29 +403,42 @@ class CreatureListFilter extends Filter
if ($cr[1] == FILTER_ENUM_ANY)
{
$cGuids = DB::Aowow()->selectCol('SELECT DISTINCT gec.guid FROM game_event_creature gec JOIN ?_events e ON e.id = ABS(gec.eventEntry) WHERE e.holidayId <> 0');
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids];
}
else if ($cr[1] == FILTER_ENUM_NONE)
{
$cGuids = DB::Aowow()->selectCol('SELECT DISTINCT gec.guid FROM game_event_creature gec JOIN ?_events e ON e.id = ABS(gec.eventEntry) WHERE e.holidayId <> 0');
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids, '!'];
}
else if ($cr[1])
{
$cGuids = DB::Aowow()->selectCol('SELECT DISTINCT gec.guid FROM game_event_creature gec JOIN ?_events e ON e.id = ABS(gec.eventEntry) WHERE e.holidayId = ?d', $cr[1]);
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1]);
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids];
}
break;
case 42: // increasesrepwith [enum]
if (in_array($cr[1], $this->enums[3])) // reuse
return ['OR', ['AND', ['rep.RewOnKillRepFaction1', $cr[1]], ['rep.RewOnKillRepValue1', 0, '>']], ['AND', ['rep.RewOnKillRepFaction2', $cr[1]], ['rep.RewOnKillRepValue2', 0, '>']]];
{
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];
else
return [0];
}
break;
case 43: // decreasesrepwith [enum]
if (in_array($cr[1], $this->enums[3])) // reuse
return ['OR', ['AND', ['rep.RewOnKillRepFaction1', $cr[1]], ['rep.RewOnKillRepValue1', 0, '<']], ['AND', ['rep.RewOnKillRepFaction2', $cr[1]], ['rep.RewOnKillRepValue2', 0, '<']]];
{
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];
else
return [0];
}
break;
case 12: // averagemoneydropped [op] [int]

View File

@@ -36,19 +36,7 @@ class FactionList extends BaseType
public static function getName($id)
{
$n = DB::Aowow()->SelectRow('
SELECT
name_loc0,
name_loc2,
name_loc3,
name_loc6,
name_loc8
FROM
?_factions
WHERE
id = ?d',
$id
);
$n = DB::Aowow()->SelectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM ?_factions WHERE id = ?d', $id);
return Util::localizedString($n, 'name');
}

View File

@@ -58,19 +58,7 @@ class GameObjectList extends BaseType
public static function getName($id)
{
$n = DB::Aowow()->SelectRow('
SELECT
name,
name_loc2,
name_loc3,
name_loc6,
name_loc8
FROM
?_objects
WHERE
id = ?d',
$id
);
$n = DB::Aowow()->SelectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM ?_objects WHERE id = ?d', $id);
return Util::localizedString($n, 'name');
}
@@ -104,7 +92,7 @@ class GameObjectList extends BaseType
$x = '<table>';
$x .= '<tr><td><b class="q">'.$this->getField('name', true).'</b></td></tr>';
if ($_ = @Lang::$gameObject['type'][$this->curTpl['typeCat']])
if ($_ = Lang::gameObject('type', $this->curTpl['typeCat']))
$x .= '<tr><td>'.$_.'</td></tr>';
if (isset($this->curTpl['lockId']))
@@ -216,23 +204,26 @@ class GameObjectListFilter extends Filter
return [1];
}
break;
case 16; // relatedevent
case 16; // relatedevent (ignore removed by event)
if (!$this->isSaneNumeric($cr[1]))
break;
if ($cr[1] == FILTER_ENUM_ANY)
{
$goGuids = DB::Aowow()->selectCol('SELECT DISTINCT geo.guid FROM game_event_gameobject geo JOIN ?_events e ON e.id = ABS(geo.eventEntry) WHERE e.holidayId <> 0');
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $goGuids];
}
else if ($cr[1] == FILTER_ENUM_NONE)
{
$goGuids = DB::Aowow()->selectCol('SELECT DISTINCT geo.guid FROM game_event_gameobject geo JOIN ?_events e ON e.id = ABS(geo.eventEntry) WHERE e.holidayId <> 0');
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $goGuids, '!'];
}
else if ($cr[1])
{
$goGuids = DB::Aowow()->selectCol('SELECT DISTINCT geo.guid FROM game_event_gameobject geo JOIN ?_events e ON e.id = ABS(geo.eventEntry) WHERE e.holidayId = ?d', $cr[1]);
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1]);
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $goGuids];
}

View File

@@ -25,9 +25,9 @@ class ItemList extends BaseType
protected $queryBase = 'SELECT i.*, `is`.*, i.id AS id, i.id AS ARRAY_KEY FROM ?_items i';
protected $queryOpts = array(
'i' => [['is', 'src'], 'o' => 'i.quality DESC, i.itemLevel DESC'],
'is' => ['j' => ['?_item_stats AS `is` ON `is`.`id` = `i`.`id`', true]],
's' => ['j' => ['?_spell AS `s` ON s.effect1CreateItemId = i.id', true], 'g' => 'i.id'],
'i' => [['is', 'src'], 'o' => 'i.quality DESC, i.itemLevel DESC'],
'src' => ['j' => ['?_source src ON type = 3 AND typeId = i.id', true], 's' => ', moreType, moreTypeId, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24']
);
@@ -73,15 +73,7 @@ class ItemList extends BaseType
// use if you JUST need the name
public static function getName($id)
{
$n = DB::Aowow()->selectRow('
SELECT
name_loc0, name_loc2, name_loc3, name_loc6, name_loc8
FROM
?_items
WHERE
id = ?d',
$id
);
$n = DB::Aowow()->selectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM ?_items WHERE id = ?d', $id);
return Util::localizedString($n, 'name');
}
@@ -91,54 +83,65 @@ class ItemList extends BaseType
{
if (empty($this->vendors))
{
$ids = array_keys($this->templates);
$itemz = DB::Aowow()->select('
SELECT nv.item AS ARRAY_KEY1, nv.entry AS ARRAY_KEY2, 0 AS eventId, nv.maxcount, iec.* FROM npc_vendor nv LEFT JOIN ?_itemextendedcost iec ON nv.extendedCost = iec.id WHERE {nv.entry IN (?a) AND} nv.item IN (?a)
$itemz = DB::World()->select('
SELECT nv.item AS ARRAY_KEY1, nv.entry AS ARRAY_KEY2, 0 AS eventId, nv.maxcount, nv.extendedCost FROM npc_vendor nv WHERE {nv.entry IN (?a) AND} nv.item IN (?a)
UNION
SELECT genv.item AS ARRAY_KEY1, c.id AS ARRAY_KEY2, IFNULL(IF(e.holidayId, e.holidayId, -e.id), 0) AS eventId, genv.maxcount, iec.* FROM game_event_npc_vendor genv JOIN creature c ON c.guid = genv.guid LEFT JOIN ?_events e ON genv.eventEntry = e.id LEFT JOIN ?_itemextendedcost iec ON genv.extendedCost = iec.id {JOIN creature c ON c.guid = genv.guid AND 1= ?d} WHERE {c.id IN (?a) AND} genv.item IN (?a)',
SELECT genv.item AS ARRAY_KEY1, c.id AS ARRAY_KEY2, IFNULL(IF(ge.holiday, ge.holiday, -ge.eventEntry), 0) AS eventId, genv.maxcount, genv.extendedCost FROM game_event_npc_vendor genv LEFT JOIN game_event ge ON genv.eventEntry = ge.eventEntry JOIN creature c ON c.guid = genv.guid WHERE {c.id IN (?a) AND} genv.item IN (?a)',
empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : $filter[TYPE_NPC],
$ids,
empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : 1,
array_keys($this->templates),
empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : $filter[TYPE_NPC],
$ids
array_keys($this->templates)
);
$xCosts = [];
foreach ($itemz as $i => $vendors)
$xCosts = array_merge($xCosts, array_column($vendors, 'extendedCost'));
if ($xCosts)
$xCosts = DB::Aowow()->select('SELECT *, id AS ARRAY_KEY FROM ?_itemextendedcost WHERE id IN (?a)', $xCosts);
$cItems = [];
foreach ($itemz as $k => $vendors)
{
foreach ($vendors as $l => $costs)
foreach ($vendors as $l => $vInfo)
{
$costs = [];
if (!empty($xCosts[$vInfo['extendedCost']]))
$costs = $xCosts[$vInfo['extendedCost']];
$data = array(
'stock' => $costs['maxcount'] ? $costs['maxcount'] : -1,
'event' => $costs['eventId'],
'reqRtg' => $costs['reqPersonalRating']
'stock' => $vInfo['maxcount'] ?: -1,
'event' => $vInfo['eventId'],
'reqRtg' => $costs ? $costs['reqPersonalRating'] : 0
);
if ($_ = $this->getField('buyPrice')) // somewhat nonsense.. is identical for all vendors (obviously)
$data[0] = $_;
// hardcode arena(103) & honor(104)
if ($_ = @$costs['reqArenaPoints'])
if (!empty($costs['reqArenaPoints']))
{
$data[-103] = $_;
$data[-103] = $costs['reqArenaPoints'];
$this->jsGlobals[TYPE_CURRENCY][103] = 103;
}
if ($_ = @$costs['reqHonorPoints'])
if (!empty($costs['reqHonorPoints']))
{
$data[-104] = $_;
$data[-104] = $costs['reqHonorPoints'];
$this->jsGlobals[TYPE_CURRENCY][104] = 104;
}
for ($i = 1; $i < 6; $i++)
{
if (($_ = @$costs['reqItemId'.$i]) && $costs['itemCount'.$i] > 0)
if (!empty($costs['reqItemId'.$i]) && $costs['itemCount'.$i] > 0)
{
$data[$_] = $costs['itemCount'.$i];
$cItems[] = $_;
$data[$costs['reqItemId'.$i]] = $costs['itemCount'.$i];
$cItems[] = $costs['reqItemId'.$i];
}
}
// no extended cost or additional gold required
if (!$costs || $this->getField('flagsExtra') & 0x04)
if ($_ = $this->getField('buyPrice'))
$data[0] = $_;
$vendors[$l] = $data;
}
@@ -189,8 +192,8 @@ class ItemList extends BaseType
$result = $this->vendors;
// apply filter if given
$tok = @$filter[TYPE_ITEM];
$cur = @$filter[TYPE_CURRENCY];
$tok = !empty($filter[TYPE_ITEM]) ? $filter[TYPE_ITEM] : null;
$cur = !empty($filter[TYPE_CURRENCY]) ? $filter[TYPE_CURRENCY] : null;
foreach ($result as $itemId => &$data)
{
@@ -289,10 +292,12 @@ class ItemList extends BaseType
{
// just use the first results
// todo (med): dont use first result; search for the right one
if ($cost = @reset($this->getExtendedCost($miscData)[$this->id]))
if (!empty($this->getExtendedCost($miscData)[$this->id]))
{
$cost = reset($this->getExtendedCost($miscData)[$this->id]);
$currency = [];
$tokens = [];
foreach ($cost as $k => $qty)
{
if (is_string($k))
@@ -306,7 +311,7 @@ class ItemList extends BaseType
$data[$this->id]['stock'] = $cost['stock']; // display as column in lv
$data[$this->id]['avail'] = $cost['stock']; // display as number on icon
$data[$this->id]['cost'] = [$this->getField('buyPrice')];
$data[$this->id]['cost'] = [empty($cost[0]) ? 0 : $cost[0]];
if ($cost['event'])
{
@@ -320,8 +325,8 @@ class ItemList extends BaseType
if ($tokens)
$data[$this->id]['cost'][] = $tokens;
if ($_ = @$this->getExtendedCost($miscData)[$this->id]['reqRating'])
$data[$this->id]['reqarenartng'] = $_;
if (!empty($cost['reqRating']))
$data[$this->id]['reqarenartng'] = $cost['reqRating'];
}
if ($x = $this->curTpl['buyPrice'])
@@ -799,7 +804,7 @@ class ItemList extends BaseType
$x .= sprintf(Lang::$game['reqLevel'], $_reqLvl).'<br />';
// required arena team rating / personal rating / todo (low): sort out what kind of rating
if (@$this->getExtendedCost([], $reqRating)[$this->id] && $reqRating)
if (!empty($this->getExtendedCost([], $reqRating)[$this->id]) && $reqRating)
$x .= sprintf(Lang::$item['reqRating'], $reqRating).'<br />';
// item level
@@ -1140,11 +1145,18 @@ class ItemList extends BaseType
$this->itemMods[$this->id] = [];
foreach (Util::$itemMods as $mod)
{
if (isset($this->curTpl[$mod]) && ($_ = floatVal($this->curTpl[$mod])))
@$this->itemMods[$this->id][$mod] += $_;
{
if (!isset($this->itemMods[$this->id][$mod]))
$this->itemMods[$this->id][$mod] = 0;
$this->itemMods[$this->id][$mod] += $_;
}
}
// fetch and add socketbonusstats
if (@$this->json[$this->id]['socketbonus'] > 0)
if (!empty($this->json[$this->id]['socketbonus']))
$enchantments[$this->json[$this->id]['socketbonus']][] = $this->id;
// Item is a gem (don't mix with sockets)
@@ -1163,9 +1175,8 @@ class ItemList extends BaseType
{
if ($item > 0) // apply socketBonus
$this->json[$item]['socketbonusstat'] = $stats;
else /* if ($item < 0) */
foreach ($stats as $mod => $qty) // apply gemEnchantment
@$this->json[-$item][$mod] += $qty;
else /* if ($item < 0) */ // apply gemEnchantment
Util::arraySumByKey($this->json[-$item][$mod], $stats);
}
}
}
@@ -1199,8 +1210,7 @@ class ItemList extends BaseType
{
$eqpSplList = new SpellList(array(['s.id', $useSpells]));
foreach ($eqpSplList->getStatGain() as $stat)
foreach ($stat as $mId => $qty)
@$onUseStats[$mId] += $qty;
Util::arraySumByKey($onUseStats, $stat);
}
return $onUseStats;
@@ -1353,19 +1363,45 @@ class ItemList extends BaseType
if (!array_keys($this->templates))
return;
$ire = DB::Aowow()->select('
SELECT i.id AS ARRAY_KEY_1, ire.id AS ARRAY_KEY_2, iet.chance, ire.*
FROM ?_items i
JOIN item_enchantment_template iet ON iet.entry = ABS(i.randomenchant)
JOIN ?_itemrandomenchant ire ON IF(i.randomenchant > 0, ire.id = iet.ench, ire.id = -iet.ench)
WHERE i.id IN (?a)',
array_keys($this->templates)
$subItemIds = [];
foreach ($this->iterate() as $__)
if ($_ = $this->getField('randomEnchant'))
$subItemIds[abs($_)] = $_;
if (!$subItemIds)
return;
// remember: id < 0: randomSuffix; id > 0: randomProperty
$subItemTpls = DB::World()->select('
SELECT CAST( entry as SIGNED) AS ARRAY_KEY, CAST( ench as SIGNED) AS ARRAY_KEY2, chance FROM item_enchantment_template WHERE entry IN (?a) UNION
SELECT CAST(-entry as SIGNED) AS ARRAY_KEY, CAST(-ench as SIGNED) AS ARRAY_KEY2, chance FROM item_enchantment_template WHERE entry IN (?a)',
array_keys(array_filter($subItemIds, function ($v) { return $v > 0; })) ?: [0],
array_keys(array_filter($subItemIds, function ($v) { return $v < 0; })) ?: [0]
);
foreach ($ire as $mstItem => $subItem)
$randIds = [];
foreach ($subItemTpls as $tpl)
$randIds = array_merge($randIds, array_keys($tpl));
if (!$randIds)
return;
$randEnchants = DB::Aowow()->select('SELECT *, id AS ARRAY_KEY FROM ?_itemrandomenchant WHERE id IN (?a)', $randIds);
foreach ($this->iterate() as $mstItem => $__)
{
foreach ($subItem as $subId => $data)
if (!$this->getField('randomEnchant'))
continue;
if (empty($subItemTpls[$this->getField('randomEnchant')]))
continue;
foreach ($subItemTpls[$this->getField('randomEnchant')] as $subId => $data)
{
if (empty($randEnchants[$subId]))
continue;
$data = array_merge($randEnchants[$subId], $data);
$jsonEquip = [];
$jsonText = [];
$enchIds = [];
@@ -1419,6 +1455,7 @@ class ItemList extends BaseType
);
}
if (!empty($this->subItems[$mstItem]))
$this->json[$mstItem]['subitems'] = $this->subItems[$mstItem];
}
}
@@ -1508,8 +1545,8 @@ class ItemList extends BaseType
class ItemListFilter extends Filter
{
private $ubFilter = []; // usable-by - limit weapon/armor selection per CharClass - itemClass => available itemsubclasses
private $extCostQuery = 'SELECT item FROM npc_vendor nv JOIN ?_itemextendedcost iec ON iec.id = nv.extendedCost WHERE %s UNION
SELECT item FROM game_event_npc_vendor genv JOIN ?_itemextendedcost iec ON iec.id = genv.extendedCost WHERE %1$s';
private $extCostQuery = 'SELECT item FROM npc_vendor WHERE extendedCost IN (?a) UNION
SELECT item FROM game_event_npc_vendor WHERE extendedCost IN (?a)';
private $otFields = [18 => 4, 68 => 15, 69 => 16, 70 => 17, 72 => 2, 73 => 19, 75 => 21, 76 => 23, 88 => 20, 92 => 5, 93 => 3, 143 => 18, 171 => 8, 172 => 12];
public $extraOpts = []; // score for statWeights
@@ -1715,7 +1752,7 @@ class ItemListFilter extends Filter
foreach ($data['wt'] as $k => $v)
{
@$str = Util::$itemFilter[$v];
$str = isset(Util::$itemFilter[$v]) ? Util::$itemFilter[$v] : null;
$qty = intVal($data['wtv'][$k]);
if ($str && $qty)
@@ -1828,7 +1865,7 @@ class ItemListFilter extends Filter
break;
case 107: // effecttext [str] not yet parsed ['effectsParsed_loc'.User::$localeId, $cr[2]]
/* todo */ return [1];
case 132: // glyphtype [enum] susubclass not yet set
case 132: // glyphtype [enum]
switch ($cr[1])
{
case 1: // Major
@@ -1837,12 +1874,14 @@ class ItemListFilter extends Filter
}
break;
case 124: // randomenchants [str]
// joining this in one step results in hell .. so .. two steps
// todo (low): in _theory_ Filter::modularizeString() should also be applied here
$randIds = DB::Aowow()->selectCol('SELECT IF (ire.id > 0, iet.entry, -iet.entry) FROM item_enchantment_template iet JOIN ?_itemrandomenchant ire ON ABS(ire.id) = iet.ench WHERE ire.name_loc'.User::$localeId.' LIKE ?', '%'.$cr[2].'%');
$randIds = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, ABS(id) FROM ?_itemrandomenchant WHERE name_loc?d LIKE ?', User::$localeId, '%'.$cr[2].'%');
$tplIds = $randIds ? DB::World()->select('SELECT entry, ench FROM item_enchantment_template WHERE ench IN (?a)', $randIds) : [];
foreach ($tplIds as $k => &$set)
if (array_search($set['ench'], $randIds) < 0)
$set['entry'] *= -1;
if ($randIds)
return ['randomEnchant', $randIds];
if ($tplIds)
return ['randomEnchant', array_column($tplIds, 'entry')];
else
return [0]; // no results aren't really input errors
case 125: // reqarenartng [op] [int] todo (low): find out, why "IN (W, X, Y) AND IN (X, Y, Z)" doesn't result in "(X, Y)"
@@ -1850,12 +1889,13 @@ class ItemListFilter extends Filter
break;
$this->formData['extraCols'][] = $cr[0];
$query = sprintf($this->extCostQuery, 'iec.reqPersonalrating '.$cr[1].' '.$cr[2]);
return ['id', DB::Aowow()->selectCol($query)];
$costs = DB::Aowow()->selectCol('SELECT id FROM ?_itemextendedcost WHERE reqPersonalrating '.$cr[1].' '.$cr[2]);
$items = DB::World()->selectCol($this->extCostQuery, $costs, $costs);
return ['id', $items];
case 160: // relatedevent [enum] like 169 .. crawl though npc_vendor and loot_templates of event-related spawns
/* todo */ return [1];
case 152: // classspecific [enum]
$_ = @$this->enums[$cr[0]][$cr[1]];
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if (is_bool($_))
@@ -1865,7 +1905,7 @@ class ItemListFilter extends Filter
}
break;
case 153: // racespecific [enum]
$_ = @$this->enums[$cr[0]][$cr[1]];
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if (is_bool($_))
@@ -1886,7 +1926,7 @@ class ItemListFilter extends Filter
$this->formData['extraCols'][] = $cr[0];
return ['AND', ['armordamagemodifier', $cr[2], $cr[1]], ['class', ITEM_CLASS_ARMOR]];
case 86: // craftedprof [enum]
$_ = @$this->enums[99][$cr[1]]; // recycled enum
$_ = isset($this->enums[99][$cr[1]]) ? $this->enums[99][$cr[1]] : null;
if (is_bool($_))
return ['src.src1', null, $_ ? '!' : null];
else if (is_int($_))
@@ -1959,32 +1999,35 @@ class ItemListFilter extends Filter
else
break;
$query = sprintf($this->extCostQuery, 'iec.reqItemId1 IN (?a) OR iec.reqItemId2 IN (?a) OR iec.reqItemId3 IN (?a) OR iec.reqItemId4 IN (?a) OR iec.reqItemId5 IN (?a)');
if ($foo = DB::Aowow()->selectCol($query, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_))
return ['id', $foo];
$costs = DB::Aowow()->selectCol(
'SELECT id FROM ?_itemextendedcost WHERE reqItemId1 IN (?a) OR reqItemId2 IN (?a) OR reqItemId3 IN (?a) OR reqItemId4 IN (?a) OR reqItemId5 IN (?a)',
$_, $_, $_, $_, $_
);
if ($items = DB::World()->selectCol($this->extCostQuery, $costs, $costs))
return ['id', $items];
break;
case 144: // purchasablewithhonor [yn]
if ($this->int2Bool($cr[1]))
{
$query = sprintf($this->extCostQuery, 'iec.reqHonorPoints > 0');
if ($foo = DB::Aowow()->selectCol($query))
return ['id', $foo, $cr[1] ? null : '!'];
$costs = DB::Aowow()->selectCol('SELECT id FROM ?_itemextendedcost WHERE reqHonorPoints > 0');
if ($items = DB::World()->selectCol($this->extCostQuery, $costs, $costs))
return ['id', $items, $cr[1] ? null : '!'];
}
break;
case 145: // purchasablewitharena [yn]
if ($this->int2Bool($cr[1]))
{
$query = sprintf($this->extCostQuery, 'iec.reqArenaPoints > 0');
if ($foo = DB::Aowow()->selectCol($query))
return ['id', $foo, $cr[1] ? null : '!'];
$costs = DB::Aowow()->selectCol('SELECT id FROM ?_itemextendedcost WHERE reqArenaPoints > 0');
if ($items = DB::World()->selectCol($this->extCostQuery, $costs, $costs))
return ['id', $items, $cr[1] ? null : '!'];
}
break;
case 129: // soldbynpc [str-small]
if (!$this->isSaneNumeric($cr[2], true))
break;
if ($iIds = DB::Aowow()->selectCol('SELECT item FROM npc_vendor WHERE entry = ?d UNION SELECT item FROM game_event_npc_vendor v JOIN creature c ON c.guid = v.guid WHERE c.id = ?d', $cr[2], $cr[2]))
if ($iIds = DB::World()->selectCol('SELECT item FROM npc_vendor WHERE entry = ?d UNION SELECT item FROM game_event_npc_vendor v JOIN creature c ON c.guid = v.guid WHERE c.id = ?d', $cr[2], $cr[2]))
return ['i.id', $iIds];
else
return [0];
@@ -2023,7 +2066,7 @@ class ItemListFilter extends Filter
case 85: // objectivequest [side]
/* todo */ return [1];
case 87: // reagentforability [enum]
$_ = @$this->enums[99][$cr[1]]; // recycled enum
$_ = isset($this->enums[99][$cr[1]]) ? $this->enums[99][$cr[1]] : null;
if ($_ !== null)
{
$ids = [];
@@ -2063,7 +2106,7 @@ class ItemListFilter extends Filter
}
break;
case 128: // source [enum]
$_ = @$this->enums[$cr[0]][$cr[1]];
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if (is_int($_)) // specific

View File

@@ -166,7 +166,7 @@ class ProfileList extends BaseType
private function getTalentDistribution()
{
if (!empty($this->tDistribution))
$this->tDistribution[$this->curTpl['classId']] = DB::Aowow()->selectCol('SELECT COUNT(t.id) FROM dbc.talent t JOIN dbc.talenttab tt ON t.tabId = tt.id WHERE tt.classMask & ?d GROUP BY tt.id ORDER BY tt.tabNumber ASC', 1 << ($this->curTpl['classId'] - 1));
$this->tDistribution[$this->curTpl['classId']] = DB::Aowow()->selectCol('SELECT COUNT(t.id) FROM dbc_talent t JOIN dbc_talenttab tt ON t.tabId = tt.id WHERE tt.classMask & ?d GROUP BY tt.id ORDER BY tt.tabNumber ASC', 1 << ($this->curTpl['classId'] - 1));
$result = [];
$start = 0;

View File

@@ -368,9 +368,12 @@ class QuestList extends BaseType
$data[TYPE_TITLE][$this->curTpl['rewardTitleId']] = $this->curTpl['rewardTitleId'];
// currencies
if ($_ = @$this->rewards[$this->id][TYPE_CURRENCY])
if (!empty($this->rewards[$this->id][TYPE_CURRENCY]))
{
$_ = $this->rewards[$this->id][TYPE_CURRENCY];
$data[TYPE_CURRENCY] = array_combine(array_keys($_), array_keys($_));
}
}
if ($addMask & GLOBALINFO_SELF)
$data[TYPE_QUEST][$this->id] = ['name' => $this->getField('name', true)];
@@ -509,7 +512,7 @@ class QuestListFilter extends Filter
break;
case 37: // classspecific [enum]
$_ = @$this->enums[$cr[0]][$cr[1]];
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if ($_ === true)
@@ -521,7 +524,7 @@ class QuestListFilter extends Filter
}
break;
case 38: // racespecific [enum]
$_ = @$this->enums[$cr[0]][$cr[1]];
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if ($_ === true)

View File

@@ -32,19 +32,7 @@ class SkillList extends BaseType
public static function getName($id)
{
$n = DB::Aowow()->SelectRow('
SELECT
name_loc0,
name_loc2,
name_loc3,
name_loc6,
name_loc8
FROM
?_skillline
WHERE
id = ?d',
$id
);
$n = DB::Aowow()->SelectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM ?_skillline WHERE id = ?d', $id);
return Util::localizedString($n, 'name');
}

View File

@@ -125,13 +125,13 @@ class SpellList extends BaseType
}
if ($foo)
$this->relItems = new ItemList(array(['i.id', array_unique($foo)], 0));
$this->relItems = new ItemList(array(['i.id', array_unique($foo)], CFG_SQL_LIMIT_NONE));
}
// use if you JUST need the name
public static function getName($id)
{
$n = DB::Aowow()->SelectRow('SELECT * FROM ?_spell WHERE id = ?d', $id );
$n = DB::Aowow()->SelectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM ?_spell WHERE id = ?d', $id );
return Util::localizedString($n, 'name');
}
// end static use
@@ -167,10 +167,10 @@ class SpellList extends BaseType
if ($mv < 0) // all stats
{
for ($j = 0; $j < 5; $j++)
@$stats[ITEM_MOD_AGILITY + $j] += $pts;
Util::arraySumByKey($stats, [(ITEM_MOD_AGILITY + $j) => $pts]);
}
else // one stat
@$stats[ITEM_MOD_AGILITY + $mv] += $pts;
Util::arraySumByKey($stats, [(ITEM_MOD_AGILITY + $mv) => $pts]);
break;
}
@@ -178,7 +178,7 @@ class SpellList extends BaseType
case 230:
case 250:
{
@$stats[ITEM_MOD_HEALTH] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_HEALTH => $pts]);
break;
}
case 13: // damage splpwr + physical (dmg & any)
@@ -186,80 +186,80 @@ class SpellList extends BaseType
// + weapon damage
if ($mv == (1 << SPELL_SCHOOL_NORMAL))
{
@$stats[ITEM_MOD_WEAPON_DMG] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_WEAPON_DMG => $pts]);
break;
}
// full magic mask, also counts towards healing
if ($mv == 0x7E)
{
@$stats[ITEM_MOD_SPELL_POWER] += $pts;
@$stats[ITEM_MOD_SPELL_DAMAGE_DONE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_SPELL_POWER => $pts]);
Util::arraySumByKey($stats, [ITEM_MOD_SPELL_DAMAGE_DONE => $pts]);
}
else
{
// HolySpellpower (deprecated; still used in randomproperties)
if ($mv & (1 << SPELL_SCHOOL_HOLY))
@$stats[ITEM_MOD_HOLY_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_HOLY_POWER => $pts]);
// FireSpellpower (deprecated; still used in randomproperties)
if ($mv & (1 << SPELL_SCHOOL_FIRE))
@$stats[ITEM_MOD_FIRE_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_FIRE_POWER => $pts]);
// NatureSpellpower (deprecated; still used in randomproperties)
if ($mv & (1 << SPELL_SCHOOL_NATURE))
@$stats[ITEM_MOD_NATURE_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_NATURE_POWER => $pts]);
// FrostSpellpower (deprecated; still used in randomproperties)
if ($mv & (1 << SPELL_SCHOOL_FROST))
@$stats[ITEM_MOD_FROST_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_FROST_POWER => $pts]);
// ShadowSpellpower (deprecated; still used in randomproperties)
if ($mv & (1 << SPELL_SCHOOL_SHADOW))
@$stats[ITEM_MOD_SHADOW_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_SHADOW_POWER => $pts]);
// ArcaneSpellpower (deprecated; still used in randomproperties)
if ($mv & (1 << SPELL_SCHOOL_ARCANE))
@$stats[ITEM_MOD_ARCANE_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_ARCANE_POWER => $pts]);
}
break;
}
case 135: // healing splpwr (healing & any) .. not as a mask..
{
@$stats[ITEM_MOD_SPELL_HEALING_DONE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_SPELL_HEALING_DONE => $pts]);
break;
}
case 35: // ModPower - MiscVal:type see defined Powers only energy/mana in use
{
if ($mv == POWER_HEALTH)
@$stats[ITEM_MOD_HEALTH] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_HEALTH => $pts]);
if ($mv == POWER_ENERGY)
@$stats[ITEM_MOD_ENERGY] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_ENERGY => $pts]);
else if ($mv == POWER_MANA)
@$stats[ITEM_MOD_MANA] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_MANA => $pts]);
else if ($mv == POWER_RUNIC_POWER)
@$stats[ITEM_MOD_RUNIC_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_RUNIC_POWER => $pts]);
break;
}
case 189: // CombatRating MiscVal:ratingMask
case 220:
if ($mod = Util::itemModByRatingMask($mv))
@$stats[$mod] += $pts;
Util::arraySumByKey($stats, [$mod => $pts]);
break;
case 143: // Resistance MiscVal:school
case 83:
case 22:
if ($mv == 1) // Armor only if explicitly specified
{
@$stats[ITEM_MOD_ARMOR] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_ARMOR => $pts]);
break;
}
if ($mv == 2) // holy-resistance ONLY if explicitly specified (shouldn't even exist...)
{
@$stats[ITEM_MOD_HOLY_RESISTANCE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_HOLY_RESISTANCE => $pts]);
break;
}
@@ -271,19 +271,19 @@ class SpellList extends BaseType
switch ($j)
{
case 2:
@$stats[ITEM_MOD_FIRE_RESISTANCE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_FIRE_RESISTANCE => $pts]);
break;
case 3:
@$stats[ITEM_MOD_NATURE_RESISTANCE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_NATURE_RESISTANCE => $pts]);
break;
case 4:
@$stats[ITEM_MOD_FROST_RESISTANCE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_FROST_RESISTANCE => $pts]);
break;
case 5:
@$stats[ITEM_MOD_SHADOW_RESISTANCE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_SHADOW_RESISTANCE => $pts]);
break;
case 6:
@$stats[ITEM_MOD_ARCANE_RESISTANCE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_ARCANE_RESISTANCE => $pts]);
break;
}
}
@@ -291,22 +291,22 @@ class SpellList extends BaseType
case 8: // hp5
case 84:
case 161:
@$stats[ITEM_MOD_HEALTH_REGEN] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_HEALTH_REGEN => $pts]);
break;
case 85: // mp5
@$stats[ITEM_MOD_MANA_REGENERATION] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_MANA_REGENERATION => $pts]);
break;
case 99: // atkpwr
@$stats[ITEM_MOD_ATTACK_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_ATTACK_POWER => $pts]);
break; // ?carries over to rngatkpwr?
case 124: // rngatkpwr
@$stats[ITEM_MOD_RANGED_ATTACK_POWER] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_RANGED_ATTACK_POWER => $pts]);
break;
case 158: // blockvalue
@$stats[ITEM_MOD_BLOCK_VALUE] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_BLOCK_VALUE => $pts]);
break;
case 240: // ModExpertise
@$stats[ITEM_MOD_EXPERTISE_RATING] += $pts;
Util::arraySumByKey($stats, [ITEM_MOD_EXPERTISE_RATING => $pts]);
break;
}
}
@@ -490,7 +490,10 @@ class SpellList extends BaseType
}
}
return $targetId ? @$results[$targetId] : $results;
if ($targetId)
return !empty($results[$targetId]) ? $results[$targetId] : 0;
return $results;
}
private function createRangesForCurrent()
@@ -679,7 +682,10 @@ class SpellList extends BaseType
private function resolveEvaluation($formula)
{
// see Traits in javascript locales
$pl = $PL = $this->charLevel;
// if (character level is set manually (profiler only))
// $pl = $PL = $this->charLevel;
$PlayerName = Lang::$main['name'];
$ap = $AP = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.atkpwr[0]', Lang::$spell['traitShort']['atkpwr']) : Lang::$spell['traitShort']['atkpwr'];
$rap = $RAP = $this->interactive ? sprintf(Util::$dfnString, 'LANG.traits.rgdatkpwr[0]', Lang::$spell['traitShort']['rgdatkpwr']) : Lang::$spell['traitShort']['rgdatkpwr'];
@@ -715,7 +721,7 @@ class SpellList extends BaseType
foreach ($vars[0] as $var) // oh lord, forgive me this sin .. but is_callable seems to bug out and function_exists doesn't find lambda-functions >.<
{
$eval = eval('return '.$var.';');
$eval = eval('return @'.$var.';'); // attention: error suppression active here
if (getType($eval) == 'object')
continue;
else if (is_numeric($eval))
@@ -1085,7 +1091,7 @@ class SpellList extends BaseType
$formCurPos++;
}
if (@$formula[++$formCurPos] == '.')
if (isset($formula[++$formCurPos]) && $formula[$formCurPos] == '.')
{
$formPrecision = (int)$formula[++$formCurPos];
++$formCurPos; // for some odd reason the precision decimal survives if wo dont increment further..
@@ -1743,11 +1749,11 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
if ($addInfoMask & ITEMINFO_MODEL)
{
if ($mi = @$modelInfo[$this->id])
if (!empty($modelInfo[$this->id]))
{
$data[$this->id]['npcId'] = $mi['typeId'];
$data[$this->id]['displayId'] = $mi['displayId'];
$data[$this->id]['displayName'] = $mi['displayName'];
$data[$this->id]['npcId'] = $modelInfo[$this->id]['typeId'];
$data[$this->id]['displayId'] = $modelInfo[$this->id]['displayId'];
$data[$this->id]['displayName'] = $modelInfo[$this->id]['displayName'];
}
}
}
@@ -1801,9 +1807,9 @@ spells / buffspells = {
$extra[$id] = array(
'id' => $id,
'tooltip' => $tTip[0],
'buff' => @$buff[0],
'buff' => !empty($buff[0]) ? $buff[0] : null,
'spells' => $tTip[1],
'buffspells' => @$buff[1]
'buffspells' => !empty($buff[1]) ? $buff[1] : null
);
}
}
@@ -1964,7 +1970,7 @@ class SpellListFilter extends Filter
return ['OR', ['AND', ['powerType', [1, 6]], ['powerCost', (10 * $cr[2]), $cr[1]]], ['AND', ['powerType', [1, 6], '!'], ['powerCost', $cr[2], $cr[1]]]];
case 9: // source [enum]
$_ = @$this->enums[$cr[0]][$cr[1]];
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if (is_int($_)) // specific

View File

@@ -14,15 +14,7 @@ class ZoneList extends BaseType
// use if you JUST need the name
public static function getName($id)
{
$n = DB::Aowow()->selectRow('
SELECT
name_loc0, name_loc2, name_loc3, name_loc6, name_loc8
FROM
?_zones
WHERE
id = ?d',
$id
);
$n = DB::Aowow()->selectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM ?_zones WHERE id = ?d', $id );
return Util::localizedString($n, 'name');
}

View File

@@ -711,7 +711,7 @@ class Util
$notes = [];
foreach (self::$notes as $data)
if (!$restricted || ($data[0] && User::isInGroup($data[0])))
if (!$restricted || !$data[0] || User::isInGroup($data[0]))
$notes[] = $data[1];
return $notes;
@@ -1164,7 +1164,7 @@ class Util
switch ($e['type'.$h])
{
case 2:
@$jsonStats[ITEM_MOD_WEAPON_DMG] += $val;
$obj = ITEM_MOD_WEAPON_DMG;
break;
case 3:
case 7:
@@ -1172,41 +1172,49 @@ class Util
if ($spl->error)
break;
$gains = $spl->getStatGain();
foreach ($gains as $gain)
foreach ($gain as $k => $v) // array_merge screws up somehow...
@$jsonStats[$k] += $v;
Util::arraySumByKey($jsonStats, $spl->getStatGain()[$obj]);
$obj = null;
break;
case 4:
switch ($obj)
{
case 0: // Physical
@$jsonStats[ITEM_MOD_ARMOR] += $val;
$obj = ITEM_MOD_ARMOR;
break;
case 1: // Holy
@$jsonStats[ITEM_MOD_HOLY_RESISTANCE] += $val;
$obj = ITEM_MOD_HOLY_RESISTANCE;
break;
case 2: // Fire
@$jsonStats[ITEM_MOD_FIRE_RESISTANCE] += $val;
$obj = ITEM_MOD_FIRE_RESISTANCE;
break;
case 3: // Nature
@$jsonStats[ITEM_MOD_NATURE_RESISTANCE] += $val;
$obj = ITEM_MOD_NATURE_RESISTANCE;
break;
case 4: // Frost
@$jsonStats[ITEM_MOD_FROST_RESISTANCE] += $val;
$obj = ITEM_MOD_FROST_RESISTANCE;
break;
case 5: // Shadow
@$jsonStats[ITEM_MOD_SHADOW_RESISTANCE] += $val;
$obj = ITEM_MOD_SHADOW_RESISTANCE;
break;
case 6: // Arcane
@$jsonStats[ITEM_MOD_ARCANE_RESISTANCE] += $val;
$obj = ITEM_MOD_ARCANE_RESISTANCE;
break;
default:
$obj = null;
}
break;
case 5:
@$jsonStats[$obj] += $val;
break;
default: // skip assignment below
$obj = null;
}
if ($obj)
{
if (!isset($jsonStats[$obj]))
$jsonStats[$obj] = 0;
$jsonStats[$obj] += $val;
}
}
@@ -1321,8 +1329,8 @@ class Util
// note: omits required spell and chance in skill_discovery_template
$data = array_merge(
DB::Aowow()->selectCol('SELECT spellId FROM spell_learn_spell WHERE entry IN (?a)', $lookup),
DB::Aowow()->selectCol('SELECT spellId FROM skill_discovery_template WHERE reqSpell IN (?a)', $lookup),
DB::World()->selectCol('SELECT spellId FROM spell_learn_spell WHERE entry IN (?a)', $lookup),
DB::World()->selectCol('SELECT spellId FROM skill_discovery_template WHERE reqSpell IN (?a)', $lookup),
$extraIds
);
@@ -1570,8 +1578,8 @@ class Util
if (empty(self::$alphaMapCache[$areaId]))
self::$alphaMapCache[$areaId] = imagecreatefrompng($file);
// alphaMaps are 1000 x 1000, adapt points [0 => black => valid point]
if (imagecolorat(self::$alphaMapCache[$areaId], $set['posX'] * 10, $set['posY'] * 10))
// alphaMaps are 1000 x 1000, adapt points [black => valid point]
if (!imagecolorat(self::$alphaMapCache[$areaId], $set['posX'] * 10, $set['posY'] * 10))
$set = null;
return true;
@@ -1585,7 +1593,7 @@ class Util
$result = [];
$jsGlobals = [];
$conditions = DB::Aowow()->select(
$conditions = DB::World()->select(
'SELECT SourceTypeOrReferenceId, SourceEntry, SourceGroup, ElseGroup,
ConditionTypeOrReference, ConditionTarget, ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition
FROM conditions

View File

@@ -40,6 +40,24 @@ class Lang
self::$item['cat'][2][1][14] .= ' ('.self::$item['cat'][2][0].')';
}
// todo: make static props private and access through this
public static function __callStatic($name, $args)
{
if (!isset(self::$$name))
return null;
$var = self::$$name;
foreach ($args as $key)
{
if (!isset($var[$key]))
return null;
$var = $var[$key];
}
return $var;
}
// todo: expand
public static function getInfoBoxForFlags($flags)
{

View File

@@ -381,7 +381,8 @@ $lang = array(
'trap' => "Falle",
'triggeredBy' => "Ausgelöst durch",
'capturePoint' => "Eroberungspunkt",
'foundIn' => "Dieses Objekt befindet sich in"
'foundIn' => "Dieses Objekt befindet sich in",
'restock' => "Wird alle %s wieder aufgefüllt."
),
'npc' => array(
'classification'=> "Einstufung",
@@ -435,7 +436,8 @@ $lang = array(
'itemReward' => "Ihr bekommt",
'titleReward' => 'Euch wird der Titel "<a href="?title=%d">%s</a>" verliehen',
'slain' => "getötet",
'reqNumCrt' => "Benötigt"
'reqNumCrt' => "Benötigt",
'_transfer' => 'Dieser Erfolg wird mit <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> vertauscht, wenn Ihr zur <span class="icon-%s">%s</span> wechselt.',
),
'class' => array(
'racialLeader' => "Volksanführer",
@@ -474,6 +476,8 @@ $lang = array(
)
),
'quest' => array(
'_transfer' => 'Dieses Quest wird mit <a href="?quest=%d" class="q1">%s</a> vertauscht, wenn Ihr zur <span class="icon-%s">%s</span> wechselt.',
'questLevel' => "Stufe %s",
'requirements' => "Anforderungen",
'reqMoney' => "Benötigtes Geld",
@@ -603,6 +607,7 @@ $lang = array(
)
),
'title' => array(
'_transfer' => 'Dieser Titel wird mit <a href="?title=%d" class="q1">%s</a> vertauscht, wenn Ihr zur <span class="icon-%s">%s</span> wechselt.',
'cat' => array(
"Allgemein", "Spieler gegen Spieler", "Ruf", "Dungeon & Schlachtzug", "Quests", "Berufe", "Weltereignisse"
)
@@ -628,6 +633,8 @@ $lang = array(
'spilloverDesc' => "Für diese Fraktion erhaltener Ruf wird zusätzlich mit den unten aufgeführten Fraktionen anteilig verrechnet.",
'maxStanding' => "Max. Ruf",
'quartermaster' => "Rüstmeister",
'customRewRate' => "Abweichende Belohnungsraten",
'_transfer' => 'Die Reputation mit dieser Fraktion wird mit dem für <a href="?faction=%d" class="q1">%s</a> vertauscht, wenn Ihr zur <span class="icon-%s">%s</span> wechselt.',
'cat' => array(
1118 => ["Classic", 469 => "Allianz", 169 => "Dampfdruckkartell", 67 => "Horde", 891 => "Streitkräfte der Allianz", 892 => "Streitkräfte der Horde"],
980 => ["The Burning Crusade", 936 => "Shattrath"],
@@ -679,7 +686,7 @@ $lang = array(
'_inSlot' => "im Platz",
'_collapseAll' => "Alle einklappen",
'_expandAll' => "Alle ausklappen",
'_transfer' => 'Dieser Zauber wird mit <a href="?spell=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> vertauscht, wenn Ihr zur <span class="icon-%s">%s</span> wechselt.',
'discovered' => "Durch Geistesblitz erlernt",
'ppm' => "%s Auslösungen pro Minute",
'procChance' => "Procchance",

View File

@@ -376,7 +376,8 @@ $lang = array(
'trap' => "Trap",
'triggeredBy' => "Triggered by",
'capturePoint' => "Capture Point",
'foundIn' => "This object can be found in"
'foundIn' => "This object can be found in",
'restock' => "Restocks every %s."
),
'npc' => array(
'classification'=> "Classification",
@@ -430,7 +431,8 @@ $lang = array(
'itemReward' => "You will receive",
'titleReward' => 'You shall be granted the title "<a href="?title=%d">%s</a>"',
'slain' => "slain",
'reqNumCrt' => "Requires"
'reqNumCrt' => "Requires",
'_transfer' => 'This achievement will be converted to <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> if you transfer to <span class="icon-%s">%s</span>.',
),
'class' => array(
'racialLeader' => "Racial leader",
@@ -469,6 +471,8 @@ $lang = array(
)
),
'quest' => array(
'_transfer' => 'This quest will be converted to <a href="?quest=%d" class="q1">%s</a> if you transfer to <span class="icon-%s">%s</span>.',
'questLevel' => "Level %s",
'requirements' => "Requirements",
'reqMoney' => "Required money",
@@ -598,6 +602,7 @@ $lang = array(
)
),
'title' => array(
'_transfer' => 'This title will be converted to <a href="?title=%d" class="q1">%s</a> if you transfer to <span class="icon-%s">%s</span>.',
'cat' => array(
"General", "Player vs. Player", "Reputation", "Dungeons & Raids", "Quests", "Professions", "World Events"
)
@@ -620,9 +625,11 @@ $lang = array(
),
'faction' => array(
'spillover' => "Reputation Spillover",
'spilloverDesc' => "Gaining Reputation with this faction also yields a proportional gain with the factions listed below.",
'spilloverDesc' => "Gaining reputation with this faction also yields a proportional gain with the factions listed below.",
'maxStanding' => "Max. Standing",
'quartermaster' => "Quartermaster",
'customRewRate' => "Custom Reward Rate",
'_transfer' => 'The reputation with this faction will be converted to <a href="?faction=%d" class="q1">%s</a> if you transfer to <span class="icon-%s">%s</span>.',
'cat' => array(
1118 => ["Classic", 469 => "Alliance", 169 => "Steamwheedle Cartel", 67 => "Horde", 891 => "Alliance Forces", 892 => "Horde Forces"],
980 => ["The Burning Crusade", 936 => "Shattrath City"],
@@ -674,7 +681,7 @@ $lang = array(
'_inSlot' => "in slot",
'_collapseAll' => "Collapse All",
'_expandAll' => "Expand All",
'_transfer' => 'This spell will be converted to <a href="?spell=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> if you transfer to <span class="icon-%s">%s</span>.',
'discovered' => "Learned via discovery",
'ppm' => "%s procs per minute",
'procChance' => "Proc chance",

View File

@@ -381,7 +381,8 @@ $lang = array(
'focusDesc' => "[Spells requiring this Focus can be cast near this Object]",
'trap' => "Trampa",
'triggeredBy' => "Accionado por",
'capturePoint' => "Punto de captura"
'capturePoint' => "Punto de captura",
'restock' => "[Restocks every %s.]"
),
'npc' => array(
'classification'=> "Clasificación",
@@ -434,7 +435,8 @@ $lang = array(
'itemReward' => "Recibirás",
'titleReward' => 'Deberías obtener el título "<a href="?title=%d">%s</a>"',
'slain' => "matado",
'reqNumCrt' => "Requiere"
'reqNumCrt' => "Requiere",
'_transfer' => 'Este logro será convertido a <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> si lo transfieres a la <span class="icon-%s">%s</span>.',
),
'class' => array(
'racialLeader' => "Lider racial",
@@ -473,6 +475,8 @@ $lang = array(
)
),
'quest' => array(
'_transfer' => 'Esta misión será convertido a <a href="?quest=%d" class="q1">%s</a> si lo transfieres a la <span class="icon-%s">%s</span>.',
'questLevel' => 'Nivel %s',
'requirements' => 'Requisitos',
'reqMoney' => 'Dinero necesario',
@@ -602,6 +606,7 @@ $lang = array(
)
),
'title' => array(
'_transfer' => 'Este título será convertido a <a href="?title=%d" class="q1">%s</a> si lo transfieres a la <span class="icon-%s">%s</span>.',
'cat' => array(
"General", "Jugador contra Jugador", "Reputación", "Mazmorras y bandas", "Misiones", "Profesiones", "Eventos del mundo"
)
@@ -624,9 +629,11 @@ $lang = array(
),
'faction' => array(
'spillover' => "[Reputation Spillover]",
'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]",
'spilloverDesc' => "[Gaining reputation with this faction also yields a proportional gain with the factions listed below.]",
'maxStanding' => "Posición máxima",
'quartermaster' => "Intendente",
'customRewRate' => "[Custom Reward Rate]",
'_transfer' => '[The reputation with this faction will be converted to <a href="?faction=%d" class="q1">%s</a> if you transfer to <span class="icon-%s">%s</span>.]',
'cat' => array(
1118 => ["Clásicas", 469 => "Alianza", 169 => "Cártel Bonvapor", 67 => "Horda", 891 => "Fuerzas de la Alianza", 892 => "Fuerzas de la Horda"],
980 => ["The Burning Crusade", 936 => "Ciudad de Shattrath"],
@@ -678,7 +685,7 @@ $lang = array(
'_inSlot' => "en la casilla",
'_collapseAll' => "Contraer todo",
'_expandAll' => "Expandier todo",
'_transfer' => 'Este hechizo será convertido a <a href="?spell=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> si lo transfieres a la <span class="icon-%s">%s</span>.',
'discovered' => "Aprendido via descubrimiento",
'ppm' => "%s procs por minuto",
'procChance' => "Probabilidad de que accione",

View File

@@ -380,7 +380,8 @@ $lang = array(
'focusDesc' => "[Spells requiring this Focus can be cast near this Object]",
'trap' => "Piège",
'triggeredBy' => "Déclenché par",
'capturePoint' => "Point de capture"
'capturePoint' => "Point de capture",
'restock' => "[Restocks every %s.]"
),
'npc' => array(
'classification'=> "Classification",
@@ -433,7 +434,8 @@ $lang = array(
'itemReward' => "Vous recevrez",
'titleReward' => "Vous devriez recevoir le titre \"<a href=\"?title=%d\">%s</a>\"",
'slain' => "tué",
'reqNumCrt' => "Nécessite"
'reqNumCrt' => "Nécessite",
'_transfer' => 'Cet haut fait sera converti en <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> si vous transférez en <span class="icon-%s">%s</span>.',
),
'class' => array(
'racialLeader' => "Leader racial",
@@ -472,6 +474,8 @@ $lang = array(
)
),
'quest' => array(
'_transfer' => 'Cette quête sera converti en <a href="?quest=%d" class="q1">%s</a> si vous transférez en <span class="icon-%s">%s</span>.',
'questLevel' => "Niveau %s",
'requirements' => "Conditions",
'reqMoney' => "Argent requis",
@@ -600,6 +604,7 @@ $lang = array(
)
),
'title' => array(
'_transfer' => 'Ce titre sera converti en <a href="?title=%d" class="q1">%s</a> si vous transférez en <span class="icon-%s">%s</span>.',
'cat' => array(
"Général", "Joueur ctr. Joueur", "Réputation", "Donjons & raids", "Quêtes", "Métiers", "Évènements mondiaux"
)
@@ -622,9 +627,11 @@ $lang = array(
),
'faction' => array(
'spillover' => "[Reputation Spillover]",
'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]",
'spilloverDesc' => "[Gaining reputation with this faction also yields a proportional gain with the factions listed below.]",
'maxStanding' => "Niveau maximum",
'quartermaster' => "Intendant",
'customRewRate' => "[Custom Reward Rate]",
'_transfer' => '[The reputation with this faction will be converted to <a href="?faction=%d" class="q1">%s</a> if you transfer to <span class="icon-%s">%s</span>.]',
'cat' => array(
1118 => ["Classique", 469 => "Alliance", 169 => "Cartel Gentepression", 67 => "Horde", 891 => "Forces de l'Alliance", 892 => "Forces de la Horde"],
980 => ["The Burning Crusade", 936 => "Shattrath"],
@@ -676,7 +683,7 @@ $lang = array(
'_inSlot' => "dans l'emplacement",
'_collapseAll' => "Replier Tout",
'_expandAll' => "Déplier Tout",
'_transfer' => 'Cet sort sera converti en <a href="?spell=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a> si vous transférez en <span class="icon-%s">%s</span>.',
'discovered' => "Appris via une découverte",
'ppm' => "%s déclenchements par minute",
'procChance' => "Chance",

View File

@@ -380,7 +380,8 @@ $lang = array(
'focusDesc' => "[Spells requiring this Focus can be cast near this Object]",
'trap' => "Ловушки",
'triggeredBy' => "Срабатывает от",
'capturePoint' => "Точка захвата"
'capturePoint' => "Точка захвата",
'restock' => "[Restocks every %s.]"
),
'npc' => array(
'classification'=> "Классификация",
@@ -433,7 +434,8 @@ $lang = array(
'itemReward' => "Вы получите",
'titleReward' => 'Наградное звание: "<a href="?title=%d">%s</a>"',
'slain' => "убито",
'reqNumCrt' => "Требуется"
'reqNumCrt' => "Требуется",
'_transfer' => 'Этот предмет превратится в <a href="?achievement=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a>, если вы перейдете за <span class="icon-%s">%s</span>.',
),
'class' => array(
'racialLeader' => "Лидер расы",
@@ -472,6 +474,8 @@ $lang = array(
)
),
'quest' => array(
'_transfer' => 'Этот предмет превратится в <a href="?quest=%d" class="q1">%s</a>, если вы перейдете за <span class="icon-%s">%s</span>.',
'questLevel' => "%s-го уровня",
'requirements' => "Требования",
'reqMoney' => "Требуется денег",
@@ -601,6 +605,7 @@ $lang = array(
)
),
'title' => array(
'_transfer' => 'Этот предмет превратится в <a href="?title=%d" class="q1">%s</a>, если вы перейдете за <span class="icon-%s">%s</span>.',
'cat' => array(
'Общее", "PvP", "Репутация", "Подземелья и рейды", "Задания", "Профессии", "Игровые события'
)
@@ -623,9 +628,11 @@ $lang = array(
),
'faction' => array(
'spillover' => "[Reputation Spillover]",
'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]",
'spilloverDesc' => "[Gaining reputation with this faction also yields a proportional gain with the factions listed below.]",
'maxStanding' => "Макс Уровень",
'quartermaster' => "Интендант",
'customRewRate' => "[Custom Reward Rate]",
'_transfer' => '[The reputation with this faction will be converted to <a href="?faction=%d" class="q1">%s</a> if you transfer to <span class="icon-%s">%s</span>.]',
'cat' => array(
1118 => ["World of Warcraft", 469 => "Альянс", 169 => "Картель Хитрая Шестеренка", 67 => "Орда", 891 => "Силы Альянса", 892 => "Силы Орды"],
980 => ["The Burning Crusade", 936 => "Город Шаттрат"],
@@ -675,8 +682,9 @@ $lang = array(
'_radius' => "Радиус действия",
'_interval' => "Интервал",
'_inSlot' => "в слот",
'_collapseAll' => "[Collapse All]",
'_expandAll' => "[Expand All]",
'_collapseAll' => "Свернуть все",
'_expandAll' => "Развернуть все",
'_transfer' => 'Этот предмет превратится в <a href="?spell=%d" class="q%d icontiny tinyspecial" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/%s.gif)">%s</a>, если вы перейдете за <span class="icon-%s">%s</span>.',
'discovered' => "Изучается путём освоения местности",
'ppm' => "Срабатывает %s раз в минуту",

View File

@@ -24,6 +24,14 @@ class AccountPage extends GenericPage
protected $error = '';
protected $next = '';
private $_post = array(
'username' => [FILTER_SANITIZE_SPECIAL_CHARS, 0xC], // FILTER_FLAG_STRIP_LOW | *_HIGH
'password' => [FILTER_UNSAFE_RAW, null],
'c_password' => [FILTER_UNSAFE_RAW, null],
'remember_me' => [FILTER_CALLBACK, ['options' => 'AccountPage::rememberCallback']],
'email' => [FILTER_SANITIZE_EMAIL, null]
);
public function __construct($pageCall, $pageParam)
{
if ($pageParam)
@@ -31,6 +39,9 @@ class AccountPage extends GenericPage
parent::__construct($pageCall, $pageParam);
foreach ($this->_post as $k => &$v)
$v = !empty($_POST[$k]) ? filter_input(INPUT_POST, $k, $v[0], $v[1]) : null;
if ($pageParam)
{
// requires auth && not authed
@@ -42,6 +53,11 @@ class AccountPage extends GenericPage
}
}
private function rememberCallback($val)
{
return $val == 'yes' ? $val : null;
}
protected function generateContent()
{
if (!$this->category)
@@ -71,16 +87,16 @@ class AccountPage extends GenericPage
$this->tpl = 'acc-recover';
$this->resetPass = false;
if (isset($_POST['email']))
if ($this->_post['email'])
{
if (!Util::isValidEmail($_POST['email']))
if (!Util::isValidEmail($this->_post['email']))
$this->error = Lang::$account['emailInvalid'];
else if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE email = ?', $_POST['email']))
else if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE email = ?', $this->_post['email']))
$this->error = Lang::$account['emailNotFound'];
else if ($err = $this->doRecoverUser($_POST['email']))
else if ($err = $this->doRecoverUser())
$this->error = $err;
else
$this->text = sprintf(Lang::$account['recovUserSent']. $_POST['email']);
$this->text = sprintf(Lang::$account['recovUserSent']. $this->_post['email']);
}
$this->head = Lang::$account['recoverUser'];
@@ -88,7 +104,7 @@ class AccountPage extends GenericPage
case 'signin':
$this->tpl = 'acc-signIn';
$this->next = $this->getNext();
if (isset($_POST['username']) || isset($_POST['password']))
if ($this->_post['username'] || $this->_post['password'])
{
if ($err = $this->doSignIn())
$this->error = $err;
@@ -108,14 +124,14 @@ class AccountPage extends GenericPage
$this->tpl = 'acc-signUp';
$nStep = 1;
if (isset($_POST['username']) || isset($_POST['password']) || isset($_POST['c_password']) || isset($_POST['email']))
if ($this->_post['username'] || $this->_post['password'] || $this->_post['c_password'] || $this->_post['email'])
{
if ($err = $this->doSignUp())
$this->error = $err;
else
{
$nStep = 1.5;
$this->text = sprintf(Lang::$account['createAccSent'], $_POST['email']);
$this->text = sprintf(Lang::$account['createAccSent'], $this->_post['email']);
}
}
else if (!empty($_GET['token']) && ($newId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE status = ?d AND token = ?', ACC_STATUS_NEW, $_GET['token'])))
@@ -275,18 +291,18 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
{
$step = 1;
if (isset($_POST['email'])) // step 1
if ($this->_post['email']) // step 1
{
if (!Util::isValidEmail($_POST['email']))
if (!Util::isValidEmail($this->_post['email']))
$this->error = Lang::$account['emailInvalid'];
else if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE email = ?', $_POST['email']))
else if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE email = ?', $this->_post['email']))
$this->error = Lang::$account['emailNotFound'];
else if ($err = $this->doRecoverPass($_POST['email']))
else if ($err = $this->doRecoverPass())
$this->error = $err;
else
{
$step = 1.5;
$this->text = sprintf(Lang::$account['recovPassSent'], $_POST['email']);
$this->text = sprintf(Lang::$account['recovPassSent'], $this->_post['email']);
}
}
else if (isset($_GET['token'])) // step 2
@@ -295,7 +311,7 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
$this->resetPass = true;
$this->token = $_GET['token'];
}
else if (isset($_POST['token']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['c_password']))
else if ($this->_post['token'] && $this->_post['email'] && $this->_post['password'] && $this->_post['c_password'])
{
$step = 2;
$this->resetPass = true;
@@ -312,19 +328,15 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
private function doSignIn()
{
$username = @$_POST['username'];
$password = @$_POST['password'];
$doExpire = @$_POST['remember_me'] != 'yes';
// check username
if (!User::isValidName($username))
if (!User::isValidName($this->_post['username']))
return Lang::$account['userNotFound'];
// check password
if (!User::isValidPass($password))
if (!User::isValidPass($this->_post['password']))
return Lang::$account['wrongPass'];
switch (User::Auth($username, $password))
switch (User::Auth($this->_post['username'], $this->_post['password']))
{
case AUTH_OK:
if (!User::$ip)
@@ -333,8 +345,8 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
// reset account status, update expiration
DB::Aowow()->query('UPDATE ?_account SET prevIP = IF(curIp = ?, prevIP, curIP), curIP = IF(curIp = ?, curIP, ?), allowExpire = ?d, status = 0, statusTimer = 0, token = "" WHERE user = ?',
User::$ip, User::$ip, User::$ip,
$doExpire,
$username
$this->_post['remember_me'] != 'yes',
$this->_post['username']
);
if (User::init())
@@ -367,25 +379,19 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
private function doSignUp()
{
$username = @$_POST['username'];
$password = @$_POST['password'];
$cPassword = @$_POST['c_password'];
$email = @$_POST['email'];
$doExpire = @$_POST['remember_me'] != 'yes';
// check username
if (!User::isValidName($username, $e))
if (!User::isValidName($this->_post['username'], $e))
return Lang::$account[$e == 1 ? 'errNameLength' : 'errNameChars'];
// check password
if (!User::isValidPass($password, $e))
if (!User::isValidPass($this->_post['password'], $e))
return Lang::$account[$e == 1 ? 'errPassLength' : 'errPassChars'];
if ($password != $cPassword)
if ($this->_post['password'] != $this->_post['c_password'])
return Lang::$account['passMismatch'];
// check email
if (!Util::isValidEmail($email))
if (!Util::isValidEmail($this->_post['email']))
return Lang::$account['emailInvalid'];
// check ip
@@ -401,18 +407,18 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
}
// username taken
if ($_ = DB::Aowow()->SelectCell('SELECT user FROM ?_account WHERE (user = ? OR email = ?) AND (status <> ?d OR (status = ?d AND statusTimer > UNIX_TIMESTAMP()))', $username, $email, ACC_STATUS_NEW, ACC_STATUS_NEW))
return $_ == $username ? Lang::$account['nameInUse'] : Lang::$account['mailInUse'];
if ($_ = DB::Aowow()->SelectCell('SELECT user FROM ?_account WHERE (user = ? OR email = ?) AND (status <> ?d OR (status = ?d AND statusTimer > UNIX_TIMESTAMP()))', $this->_post['username'], $email, ACC_STATUS_NEW, ACC_STATUS_NEW))
return $_ == $this->_post['username'] ? Lang::$account['nameInUse'] : Lang::$account['mailInUse'];
// create..
$token = Util::createHash();
$id = DB::Aowow()->query('REPLACE INTO ?_account (user, passHash, displayName, email, joindate, curIP, allowExpire, locale, status, statusTimer, token) VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(), ?, ?d, ?d, ?d, UNIX_TIMESTAMP() + ?d, ?)',
$username,
User::hashCrypt($_POST['password']),
Util::ucFirst($username),
$email,
$this->_post['username'],
User::hashCrypt($this->_post['password']),
Util::ucFirst($this->_post['username']),
$this->_post['email'],
User::$ip,
$doExpire,
$this->_post['remember_me'] != 'yes',
User::$localeId,
ACC_STATUS_NEW,
CFG_ACCOUNT_CREATE_SAVE_DECAY,
@@ -420,7 +426,7 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
);
if (!$id) // something went wrong
return Lang::$main['intError'];
else if ($_ = $this->sendMail($email, Lang::$mail['accConfirm'][0], sprintf(Lang::$mail['accConfirm'][1], $token), CFG_ACCOUNT_CREATE_SAVE_DECAY))
else if ($_ = $this->sendMail(Lang::$mail['accConfirm'][0], sprintf(Lang::$mail['accConfirm'][1], $token), CFG_ACCOUNT_CREATE_SAVE_DECAY))
{
// success:: update ip-bans
if (!$ip || $ip['unbanDate'] < time())
@@ -432,61 +438,63 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
}
}
private function doRecoverPass($target)
private function doRecoverPass()
{
if ($_ = $this->initRecovery(ACC_STATUS_RECOVER_PASS, $target, CFG_ACCOUNT_RECOVERY_DECAY, $token))
if ($_ = $this->initRecovery(ACC_STATUS_RECOVER_PASS, CFG_ACCOUNT_RECOVERY_DECAY, $token))
return $_;
// send recovery mail
return $this->sendMail($target, Lang::$mail['resetPass'][0], sprintf(Lang::$mail['resetPass'][1], $token), CFG_ACCOUNT_RECOVERY_DECAY);
return $this->sendMail(Lang::$mail['resetPass'][0], sprintf(Lang::$mail['resetPass'][1], $token), CFG_ACCOUNT_RECOVERY_DECAY);
}
private function doResetPass()
{
$token = $_POST['token'];
$email = $_POST['email'];
$pass = $_POST['password'];
$cPass = $_POST['c_password'];
if ($pass != $cPass)
if ($this->_post['password'] != $this->_post['c_password'])
return Lang::$account['passCheckFail'];
$uRow = DB::Aowow()->selectRow('SELECT id, user, passHash FROM ?_account WHERE token = ? AND email = ? AND status = ?d AND statusTimer > UNIX_TIMESTAMP()', $token, $email, ACC_STATUS_RECOVER_PASS);
if (!$uRow)
if (!Util::isValidEmail($this->_post['email']))
return Lang::$account['emailInvalid'];
$uId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE token = ? AND email = ? AND status = ?d AND statusTimer > UNIX_TIMESTAMP()',
$this->_post['token'],
$this->_post['email'],
ACC_STATUS_RECOVER_PASS
);
if (!$uId)
return Lang::$account['emailNotFound']; // assume they didn't meddle with the token
if (!User::verifyCrypt($newPass))
return Lang::$account['newPassDiff'];
if (!DB::Aowow()->query('UPDATE ?_account SET passHash = ?, status = ?d WHERE id = ?d', User::hashcrypt($newPass), ACC_STATUS_OK, $uRow['id']))
if (!DB::Aowow()->query('UPDATE ?_account SET passHash = ?, status = ?d WHERE id = ?d', User::hashcrypt($newPass), ACC_STATUS_OK, $uId))
return Lang::$main['intError'];
}
private function doRecoverUser($target)
private function doRecoverUser()
{
if ($_ = $this->initRecovery(ACC_STATUS_RECOVER_USER, $target, CFG_ACCOUNT_RECOVERY_DECAY, $token))
if ($_ = $this->initRecovery(ACC_STATUS_RECOVER_USER, CFG_ACCOUNT_RECOVERY_DECAY, $token))
return $_;
// send recovery mail
return $this->sendMail($target, Lang::$mail['recoverUser'][0], sprintf(Lang::$mail['recoverUser'][1], $token), CFG_ACCOUNT_RECOVERY_DECAY);
return $this->sendMail(Lang::$mail['recoverUser'][0], sprintf(Lang::$mail['recoverUser'][1], $token), CFG_ACCOUNT_RECOVERY_DECAY);
}
private function initRecovery($type, $target, $delay, &$token)
private function initRecovery($type, $delay, &$token)
{
if (!$type)
return Lang::$main['intError'];
// check if already processing
if ($_ = DB::Aowow()->selectCell('SELECT statusTimer - UNIX_TIMESTAMP() FROM ?_account WHERE email = ? AND status <> ?d AND statusTimer > UNIX_TIMESTAMP()', $target, ACC_STATUS_OK))
if ($_ = DB::Aowow()->selectCell('SELECT statusTimer - UNIX_TIMESTAMP() FROM ?_account WHERE email = ? AND status <> ?d AND statusTimer > UNIX_TIMESTAMP()', $this->_post['email'], ACC_STATUS_OK))
return sprintf(lang::$account['isRecovering'], Util::formatTime($_ * 1000));
// create new token and write to db
$token = Util::createHash();
if (!DB::Aowow()->query('UPDATE ?_account SET token = ?, status = ?d, statusTimer = UNIX_TIMESTAMP() + ?d WHERE email = ?', $token, $type, $delay, $target))
if (!DB::Aowow()->query('UPDATE ?_account SET token = ?, status = ?d, statusTimer = UNIX_TIMESTAMP() + ?d WHERE email = ?', $token, $type, $delay, $this->_post['email']))
return Lang::$main['intError'];
}
private function sendMail($target, $subj, $msg, $delay = 300)
private function sendMail($subj, $msg, $delay = 300)
{
// send recovery mail
$subj = CFG_NAME_SHORT.Lang::$main['colon'] . $subj;
@@ -495,7 +503,7 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
'Reply-To: '.CFG_CONTACT_EMAIL . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (!mail($target, $subj, $msg, $header))
if (!mail($this->_post['email'], $subj, $msg, $header))
return sprintf(Lang::$main['intError2'], 'send mail');
}

View File

@@ -183,7 +183,23 @@ class AchievementPage extends GenericPage
$this->rewards['text'] = $this->subject->getField('reward', true);
// todo (low): create pendant from player_factionchange_achievement
// factionchange-equivalent
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_achievement WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId))
{
$altAcv = new AchievementList(array(['id', abs($pendant)]));
if (!$altAcv->error)
{
$this->transfer = sprintf(
Lang::$achievement['_transfer'],
$altAcv->id,
1, // quality
$altAcv->getField('iconString'),
$altAcv->getField('name', true),
$pendant > 0 ? 'alliance' : 'horde',
$pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2]
);
}
}
/**************/
/* Extra Tabs */

View File

@@ -43,6 +43,8 @@ class ClassPage extends GenericPage
protected function generateContent()
{
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
$_mask = 1 << ($this->typeId - 1);
$tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0]; // see TalentCalc.js

View File

@@ -42,6 +42,8 @@ class CurrencyPage extends GenericPage
protected function generateContent()
{
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
$_itemId = $this->subject->getField('itemId');
/***********/
@@ -59,7 +61,7 @@ class CurrencyPage extends GenericPage
/* Main Content */
/****************/
$this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$this->name = $this->subject->getField('name', true);
$this->headIcons = $this->typeId == 104 ? ['inv_bannerpvp_02', 'inv_bannerpvp_01'] : [$this->subject->getField('iconString')];
$this->redButtons = array(
@@ -98,8 +100,9 @@ class CurrencyPage extends GenericPage
// tab: sold by
$itemObj = new ItemList(array(['id', $_itemId]));
if ($vendors = @$itemObj->getExtendedCost()[$_itemId])
if (!empty($itemObj->getExtendedCost()[$_itemId]))
{
$vendors = $itemObj->getExtendedCost()[$_itemId];
$this->extendGlobalData($itemObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$soldBy = new CreatureList(array(['id', array_keys($vendors)]));
@@ -183,30 +186,29 @@ class CurrencyPage extends GenericPage
if ($this->typeId == 103)
{
$n = '?items&filter=cr=145;crs=1;crv=0';
$w = 'iec.reqArenaPoints > 0';
$w = 'reqArenaPoints > 0';
}
else if ($this->typeId == 104)
{
$n = '?items&filter=cr=144;crs=1;crv=0';
$w = 'iec.reqHonorPoints > 0';
$w = 'reqHonorPoints > 0';
}
else
{
$n = in_array($this->typeId, [42, 61, 81, 241, 121, 122, 123, 125, 126, 161, 201, 101, 102, 221, 301, 341]) ? '?items&filter=cr=158;crs='.$_itemId.';crv=0' : null;
$w = 'iec.reqItemId1 = '.$_itemId.' OR iec.reqItemId2 = '.$_itemId.' OR iec.reqItemId3 = '.$_itemId.' OR iec.reqItemId4 = '.$_itemId.' OR iec.reqItemId5 = '.$_itemId;
$w = 'reqItemId1 = '.$_itemId.' OR reqItemId2 = '.$_itemId.' OR reqItemId3 = '.$_itemId.' OR reqItemId4 = '.$_itemId.' OR reqItemId5 = '.$_itemId;
}
$boughtBy = DB::Aowow()->selectCol('
SELECT item FROM npc_vendor nv JOIN ?_itemextendedcost iec ON iec.id = nv.extendedCost WHERE '.$w.'
UNION
SELECT item FROM game_event_npc_vendor genv JOIN ?_itemextendedcost iec ON iec.id = genv.extendedCost WHERE '.$w
);
$xCosts = DB::Aowow()->selectCol('SELECT id FROM ?_itemextendedcost WHERE '.$w);
$boughtBy = DB::World()->selectCol('SELECT item FROM npc_vendor WHERE extendedCost IN (?a) UNION SELECT item FROM game_event_npc_vendor WHERE extendedCost IN (?a)', $xCosts, $xCosts);
if ($boughtBy)
{
$boughtBy = new ItemList(array(['id', $boughtBy]));
if (!$boughtBy->error)
{
if ($boughtBy->getMatches() <= CFG_SQL_LIMIT_DEFAULT)
$n = null;
$this->lvTabs[] = array(
'file' => 'item',
'data' => $boughtBy->getListviewData(ITEMINFO_VENDOR, [TYPE_CURRENCY => $this->typeId]),

View File

@@ -61,6 +61,8 @@ class EventPage extends GenericPage
protected function generateContent()
{
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
/***********/
/* Infobox */
/***********/
@@ -101,7 +103,7 @@ class EventPage extends GenericPage
$hasFilter = in_array($this->hId, [372, 283, 285, 353, 420, 400, 284, 201, 374, 409, 141, 324, 321, 424, 335, 327, 341, 181, 404, 398, 301]);
// tab: npcs
if ($npcIds = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, IF(ec.eventEntry > 0, 1, 0) AS added FROM creature c, game_event_creature ec WHERE ec.guid = c.guid AND ABS(ec.eventEntry) = ?d', $this->eId))
if ($npcIds = DB::World()->selectCol('SELECT id AS ARRAY_KEY, IF(ec.eventEntry > 0, 1, 0) AS added FROM creature c, game_event_creature ec WHERE ec.guid = c.guid AND ABS(ec.eventEntry) = ?d', $this->eId))
{
$creatures = new CreatureList(array(['id', array_keys($npcIds)]));
if (!$creatures->error)
@@ -119,7 +121,7 @@ class EventPage extends GenericPage
}
// tab: objects
if ($objectIds = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, IF(eg.eventEntry > 0, 1, 0) AS added FROM gameobject g, game_event_gameobject eg WHERE eg.guid = g.guid AND ABS(eg.eventEntry) = ?d', $this->eId))
if ($objectIds = DB::World()->selectCol('SELECT id AS ARRAY_KEY, IF(eg.eventEntry > 0, 1, 0) AS added FROM gameobject g, game_event_gameobject eg WHERE eg.guid = g.guid AND ABS(eg.eventEntry) = ?d', $this->eId))
{
$objects = new GameObjectList(array(['id', array_keys($objectIds)]));
if (!$objects->error)
@@ -193,7 +195,7 @@ class EventPage extends GenericPage
{
// vendor
$cIds = $creatures->getFoundIDs();
if ($sells = DB::Aowow()->selectCol('SELECT item FROM npc_vendor nv WHERE entry IN (?a) UNION SELECT item FROM game_event_npc_vendor genv JOIN creature c ON genv.guid = c.guid WHERE c.id IN (?a)', $cIds, $cIds))
if ($sells = DB::World()->selectCol('SELECT item FROM npc_vendor nv WHERE entry IN (?a) UNION SELECT item FROM game_event_npc_vendor genv JOIN creature c ON genv.guid = c.guid WHERE c.id IN (?a)', $cIds, $cIds))
$itemCnd[] = ['id', $sells];
}
@@ -215,7 +217,7 @@ class EventPage extends GenericPage
}
// tab: see also (event conditions)
if ($rel = DB::Aowow()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, -prerequisite_event, eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $this->eId, $this->eId, $this->eId))
if ($rel = DB::World()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, -prerequisite_event, eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $this->eId, $this->eId, $this->eId))
{
$list = [];
array_walk($rel, function($v, $k) use (&$list) {

View File

@@ -48,6 +48,8 @@ class FactionPage extends GenericPage
protected function generateContent()
{
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
/***********/
/* Infobox */
/***********/
@@ -91,7 +93,7 @@ class FactionPage extends GenericPage
// Spillover Effects
/* todo (low): also check on reputation_spillover_template (but its data is identical to calculation below
$rst = DB::Aowow()->selectRow('SELECT
$rst = DB::World()->selectRow('SELECT
CONCAT_WS(" ", faction1, faction2, faction3, faction4) AS faction,
CONCAT_WS(" ", rate_1, rate_2, rate_3, rate_4) AS rate,
CONCAT_WS(" ", rank_1, rank_2, rank_3, rank_4) AS rank
@@ -106,8 +108,8 @@ class FactionPage extends GenericPage
if ($p = $this->subject->getField('parentFactionId')) // linked via parent
$conditions[] = ['OR', ['id', $p], ['parentFactionId', $p]];
else
$conditions[] = ['parentFactionId', $this->typeId]; // self as parent
else // self as parent
$conditions[] = ['parentFactionId', $this->typeId];
$spillover = new FactionList($conditions);
$this->extendGlobalData($spillover->getJSGlobals());
@@ -121,8 +123,8 @@ class FactionPage extends GenericPage
$this->extraText .= '[h3 class=clear]'.Lang::$faction['spillover'].'[/h3][div margin=15px]'.Lang::$faction['spilloverDesc'].'[/div][table class=grid width=400px][tr][td width=150px][b]'.Util::ucFirst(Lang::$game['faction']).'[/b][/td][td width=100px][b]'.Lang::$spell['_value'].'[/b][/td][td width=150px][b]'.Lang::$faction['maxStanding'].'[/b][/td][/tr]'.$buff.'[/table]';
// reward rates
if ($rates = DB::Aowow()->selectRow('SELECT * FROM reputation_reward_rate WHERE faction = ?d', $this->typeId))
// reward rates (ultimately this should be calculated into each reward display)
if ($rates = DB::World()->selectRow('SELECT * FROM reputation_reward_rate WHERE faction = ?d', $this->typeId))
{
$buff = '';
foreach ($rates as $k => $v)
@@ -140,14 +142,28 @@ class FactionPage extends GenericPage
case 'spell_rate': $buff .= '[tr][td]'.Lang::$game['spells'].Lang::$main['colon'].'[/td]'; break;
}
$buff .= '[td width=30px align=right]x'.number_format($v, 1).'[/td][/tr]';
$buff .= '[td width=35px align=right][span class=q'.($v < 1 ? '10]' : '2]+').intVal(($v - 1) * 100).'%[/span][/td][/tr]';
}
if ($buff)
$this->extraText .= '[h3 class=clear][Custom Reward Rate][/h3][table]'.$buff.'[/table]';
$this->extraText .= '[h3 class=clear]'.Lang::faction('customRewRate').'[/h3][table]'.$buff.'[/table]';
}
// todo (low): create pendant from player_factionchange_reputations
// factionchange-equivalent
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_reputations WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId))
{
$altFac = new FactionList(array(['id', abs($pendant)]));
if (!$altFac->error)
{
$this->transfer = sprintf(
Lang::faction('_transfer'),
$altFac->id,
$altFac->getField('name', true),
$pendant > 0 ? 'alliance' : 'horde',
$pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2]
);
}
}
/**************/
/* Extra Tabs */
@@ -178,11 +194,12 @@ class FactionPage extends GenericPage
// tab: creatures with onKill reputation
if ($this->subject->getField('reputationIndex') != -1) // only if you can actually gain reputation by kills
{
$cIds = DB::Aowow()->selectCol('SELECT DISTINCT cor.creature_id FROM creature_onkill_reputation cor, ?_factions f WHERE
(cor.RewOnKillRepValue1 > 0 AND (cor.RewOnKillRepFaction1 = ?d OR (cor.RewOnKillRepFaction1 = f.id AND f.parentFactionId = ?d AND cor.IsTeamAward1 <> 0))) OR
(cor.RewOnKillRepValue2 > 0 AND (cor.RewOnKillRepFaction2 = ?d OR (cor.RewOnKillRepFaction2 = f.id AND f.parentFactionId = ?d AND cor.IsTeamAward2 <> 0)))',
$this->typeId, $this->subject->getField('parentFactionId'),
$this->typeId, $this->subject->getField('parentFactionId')
// inherit siblings/children from $spillover
$cIds = DB::World()->selectCol('SELECT DISTINCT creature_id FROM creature_onkill_reputation WHERE
(RewOnKillRepValue1 > 0 AND (RewOnKillRepFaction1 = ?d OR (RewOnKillRepFaction1 IN (?a) AND IsTeamAward1 <> 0))) OR
(RewOnKillRepValue2 > 0 AND (RewOnKillRepFaction2 = ?d OR (RewOnKillRepFaction2 IN (?a) AND IsTeamAward2 <> 0)))',
$this->typeId, $spillover->getFoundIDs(),
$this->typeId, $spillover->getFoundIDs()
);
if ($cIds)

View File

@@ -82,6 +82,7 @@ class GenericPage
private $cacheLoaded = [];
private $skipCache = 0x0;
private $memcached = null;
private $mysql = ['time' => 0, 'count' => 0];
public function __construct($pageCall/*, $pageParam */)
{
@@ -216,7 +217,7 @@ class GenericPage
}
$this->time = microtime(true) - $this->time;
$this->mysql = DB::Aowow()->getStatistics();
Util::arraySumByKey($this->mysql, DB::Aowow()->getStatistics(), DB::World()->getStatistics());
}
public function addJS($name, $unshift = false)
@@ -363,8 +364,8 @@ class GenericPage
public function notFound($typeStr) // unknown ID
{
$this->typeStr = $typeStr;
$this->mysql = DB::Aowow()->getStatistics();
$this->hasComContent = false;
Util::arraySumByKey($this->mysql, DB::Aowow()->getStatistics(), DB::World()->getStatistics());
if (isset($this->tabId))
$this->pageTemplate['activeTab'] = $this->tabId;
@@ -384,7 +385,7 @@ class GenericPage
$this->addArticle();
$this->mysql = DB::Aowow()->getStatistics();
Util::arraySumByKey($this->mysql, DB::Aowow()->getStatistics(), DB::World()->getStatistics());
$this->display('text-page-generic');
exit();
@@ -758,7 +759,10 @@ class GenericPage
$cache = explode("\n", $cache, 2);
$data = $cache[1];
@list($time, $rev, $type) = explode(' ', $cache[0]);
if (substr_count($cache[0], ' ') < 2)
return false;
list($time, $rev, $type) = explode(' ', $cache[0]);
if ($time + CFG_CACHE_DECAY <= time() || $rev < AOWOW_REVISION)
$cache = null;

View File

@@ -111,7 +111,7 @@ class ItemPage extends genericPage
protected function generateContent()
{
$this->addJS('?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
$this->addJS('?data=weight-presets.zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
$_flags = $this->subject->getField('flags');
$_slot = $this->subject->getField('slot');
@@ -177,12 +177,13 @@ class ItemPage extends genericPage
$infobox[] = Lang::$item['tool'].Lang::$main['colon'].'[url=?items&filter=cr=91;crs='.$tId.';crv=0]'.Util::localizedString($tName, 'name').'[/url]';
// extendedCost
if ($_ = @$this->subject->getExtendedCost([], $_reqRating)[$this->subject->id])
if (!empty($this->subject->getExtendedCost([], $_reqRating)[$this->subject->id]))
{
$vendors = $this->subject->getExtendedCost()[$this->subject->id];
$each = $this->subject->getField('stackable') > 1 ? '[color=q0] ('.Lang::$item['each'].')[/color]' : null;
$handled = [];
$costList = [];
foreach ($_ as $npcId => $data)
foreach ($vendors as $npcId => $data)
{
$tokens = [];
$currency = [];
@@ -348,7 +349,7 @@ class ItemPage extends genericPage
while ($next)
{
$row = DB::Aowow()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next);
$row = DB::World()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next);
$next = $row['next_page'];
$this->pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
}
@@ -382,7 +383,7 @@ class ItemPage extends genericPage
}
// factionchange-equivalent
if ($pendant = DB::Aowow()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_items WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId))
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_items WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId))
{
$altItem = new ItemList(array(['id', abs($pendant)]));
if (!$altItem->error)
@@ -761,8 +762,9 @@ class ItemPage extends genericPage
}
// tab: sold by
if ($vendors = @$this->subject->getExtendedCost([], $_reqRating)[$this->subject->id])
if (!empty($this->subject->getExtendedCost([], $_reqRating)[$this->subject->id]))
{
$vendors = $this->subject->getExtendedCost()[$this->subject->id];
$soldBy = new CreatureList(array(['id', array_keys($vendors)]));
if (!$soldBy->error)
{
@@ -794,7 +796,7 @@ class ItemPage extends genericPage
$this->extendGlobalIds(TYPE_ITEM, array_column($tokens, 0));
$row['stock'] = $vendors[$k]['stock'];
$row['cost'] = [$this->subject->getField('buyPrice')];
$row['cost'] = [empty($vendors[$k][0]) ? 0 : $vendors[$k][0]];
if ($e = $vendors[$k]['event'])
{
@@ -838,22 +840,31 @@ class ItemPage extends genericPage
// tab: currency for
// some minor trickery: get arenaPoints(43307) and honorPoints(43308) directly
if ($this->typeId == 43307)
$w = 'iec.reqArenaPoints > 0';
{
$n = '?items&filter=cr=145;crs=1;crv=0';
$w = 'reqArenaPoints > 0';
}
else if ($this->typeId == 43308)
$w = 'iec.reqHonorPoints > 0';
{
$n = '?items&filter=cr=144;crs=1;crv=0';
$w = 'reqHonorPoints > 0';
}
else
$w = 'iec.reqItemId1 = '.$this->typeId.' OR iec.reqItemId2 = '.$this->typeId.' OR iec.reqItemId3 = '.$this->typeId.' OR iec.reqItemId4 = '.$this->typeId.' OR iec.reqItemId5 = '.$this->typeId;
{
$n = in_array($this->typeId, [42, 61, 81, 241, 121, 122, 123, 125, 126, 161, 201, 101, 102, 221, 301, 341]) ? '?items&filter=cr=158;crs='.$_itemId.';crv=0' : null;
$w = 'reqItemId1 = '.$this->typeId.' OR reqItemId2 = '.$this->typeId.' OR reqItemId3 = '.$this->typeId.' OR reqItemId4 = '.$this->typeId.' OR reqItemId5 = '.$this->typeId;
}
$boughtBy = DB::Aowow()->selectCol('
SELECT item FROM npc_vendor nv JOIN ?_itemextendedcost iec ON iec.id = nv.extendedCost WHERE '.$w.'
UNION
SELECT item FROM game_event_npc_vendor genv JOIN ?_itemextendedcost iec ON iec.id = genv.extendedCost WHERE '.$w
);
$xCosts = DB::Aowow()->selectCol('SELECT id FROM ?_itemextendedcost WHERE '.$w);
$boughtBy = $xCosts ? DB::World()->selectCol('SELECT item FROM npc_vendor WHERE extendedCost IN (?a) UNION SELECT item FROM game_event_npc_vendor WHERE extendedCost IN (?a)', $xCosts, $xCosts) : null;
if ($boughtBy)
{
$boughtBy = new ItemList(array(['id', $boughtBy]));
if (!$boughtBy->error)
{
if ($boughtBy->getMatches() <= CFG_SQL_LIMIT_DEFAULT)
$n = null;
$iCur = new CurrencyList(array(['itemId', $this->typeId]));
$filter = $iCur->error ? [TYPE_ITEM => $this->typeId] : [TYPE_CURRENCY => $iCur->id];
@@ -863,7 +874,8 @@ class ItemPage extends genericPage
'params' => [
'name' => '$LANG.tab_currencyfor',
'id' => 'currency-for',
'extraCols' => "$[Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack'), Listview.extraCols.cost]"
'extraCols' => "$[Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack'), Listview.extraCols.cost]",
'note' => $n ? sprintf(Util::$filterResultString, $n) : null
]
);
$this->extendGlobalData($boughtBy->getJSGlobals(GLOBALINFO_ANY));
@@ -977,9 +989,12 @@ class ItemPage extends genericPage
$json = '';
foreach ($fields as $f)
{
if (($_ = @$this->subject->json[$this->subject->id][$f]) !== null)
if (isset($this->subject->json[$this->subject->id][$f]))
{
$_ = $f == 'name' ? (7 - $this->subject->getField('quality')).$_ : $_;
$_ = $this->subject->json[$this->subject->id][$f];
if ($f == 'name')
$_ = (7 - $this->subject->getField('quality')).$_;
$json .= ',"'.$f.'":'.$_;
}
}

View File

@@ -108,7 +108,7 @@ class ItemsPage extends GenericPage
$conditions[] = $_;
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter);
$this->filter['query'] = @$_GET['filter'] ?: NULL;
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $this->filterObj->getForm();
$menu = $this->createExtraMenus();
@@ -213,7 +213,7 @@ class ItemsPage extends GenericPage
);
$groups = [];
$nameSource = [];
$grouping = @$this->filter['gb'];
$grouping = isset($this->filter['gb']) ? $this->filter['gb'] : null;
$extraOpts = [];
$maxResults = CFG_SQL_LIMIT_DEFAULT;
@@ -438,9 +438,9 @@ class ItemsPage extends GenericPage
if (!$this->category)
return;
if (isset($this->category[2]))
if (isset($this->category[2]) && is_array(Lang::$item['cat'][$this->category[0]][1][$this->category[1]]))
$tPart = Lang::$item['cat'][$this->category[0]][1][$this->category[1]][1][$this->category[2]];
else if (isset($this->category[1]))
else if (isset($this->category[1]) && is_array(Lang::$item['cat'][$this->category[0]]))
$tPart = Lang::$item['cat'][$this->category[0]][1][$this->category[1]];
else
$tPart = Lang::$item['cat'][$this->category[0]];
@@ -524,9 +524,9 @@ class ItemsPage extends GenericPage
}
else
{
if (isset($this->category[2]))
if (isset($this->category[2]) && is_array(Lang::$item['cat'][$this->category[0]][1][$this->category[1]]))
$catList = Lang::$item['cat'][$this->category[0]][1][$this->category[1]][1][$this->category[2]];
else if (isset($this->category[1]))
else if (isset($this->category[1]) && is_array(Lang::$item['cat'][$this->category[0]]))
$catList = Lang::$item['cat'][$this->category[0]][1][$this->category[1]];
else
$catList = Lang::$item['cat'][$this->category[0]];

View File

@@ -32,8 +32,10 @@ class MorePage extends GenericPage
parent::__construct($pageCall, $subPage);
// chack if page is valid
if ($_ = @$this->validPages[$pageCall])
if (isset($this->validPages[$pageCall]))
{
$_ = $this->validPages[$pageCall];
// check if subpage is valid
if (!isset($_[1]))
{

View File

@@ -108,15 +108,15 @@ class NpcPage extends GenericPage
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// Event
if ($_ = DB::Aowow()->selectCol('SELECT DISTINCT IF(holidayId, holidayId, -e.id) FROM ?_events e, game_event_creature gec, creature c WHERE e.id = ABS(gec.eventEntry) AND c.guid = gec.guid AND c.id = ?d', $this->typeId))
// Event (ignore events, where the object only gets removed)
if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_creature gec, creature c WHERE ge.eventEntry = gec.eventEntry AND c.guid = gec.guid AND c.id = ?d', $this->typeId))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
$ev = [];
foreach ($_ as $idx => $id)
$ev[] = ($ev && !fmod(count($ev), 2) ? '[br]' : '') . '[event='.$id.']';
foreach ($_ as $i => $e)
$ev[] = ($i % 2 ? '[br]' : ' ') . '[event='.$e.']';
$infobox[] = Util::ucFirst(Lang::$game['eventShort']).Lang::$main['colon'].implode(', ', $ev);
$infobox[] = Util::ucFirst(Lang::$game['eventShort']).Lang::$main['colon'].implode(',', $ev);
}
// Level
@@ -286,7 +286,7 @@ class NpcPage extends GenericPage
// tab: abilities / tab_controlledabilities (dep: VehicleId)
// SMART_SCRIPT_TYPE_CREATURE = 0; SMART_ACTION_CAST = 11; SMART_ACTION_ADD_AURA = 75; SMART_ACTION_INVOKER_CAST = 85; SMART_ACTION_CROSS_CAST = 86
$smartSpells = DB::Aowow()->selectCol('SELECT action_param1 FROM smart_scripts WHERE source_type = 0 AND action_type IN (11, 75, 85, 86) AND entryOrGUID = ?d', $this->typeId);
$smartSpells = DB::World()->selectCol('SELECT action_param1 FROM smart_scripts WHERE source_type = 0 AND action_type IN (11, 75, 85, 86) AND entryOrGUID = ?d', $this->typeId);
$tplSpells = [];
$conditions = ['OR'];
@@ -411,7 +411,7 @@ class NpcPage extends GenericPage
WHERE t1.entry = ?d
';
if ($tSpells = DB::Aowow()->select($teachQuery, $this->typeId))
if ($tSpells = DB::World()->select($teachQuery, $this->typeId))
{
$teaches = new SpellList(array(['id', array_keys($tSpells)]));
if (!$teaches->error)
@@ -463,7 +463,7 @@ class NpcPage extends GenericPage
}
// tab: sells
if ($sells = DB::Aowow()->selectCol('SELECT item FROM npc_vendor nv WHERE entry = ?d UNION SELECT item FROM game_event_npc_vendor genv JOIN creature c ON genv.guid = c.guid WHERE c.id = ?d', $this->typeId, $this->typeId))
if ($sells = DB::World()->selectCol('SELECT item FROM npc_vendor nv WHERE entry = ?d UNION SELECT item FROM game_event_npc_vendor genv JOIN creature c ON genv.guid = c.guid WHERE c.id = ?d', $this->typeId, $this->typeId))
{
$soldItems = new ItemList(array(['id', $sells]));
if (!$soldItems->error)
@@ -472,7 +472,7 @@ class NpcPage extends GenericPage
if ($soldItems->hasSetFields(['condition']))
$extraCols[] = 'Listview.extraCols.condition';
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [TYPE_NPC => $this->typeId]);
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [TYPE_NPC => [$this->typeId]]);
$sc = Util::getServerConditions(CND_SRC_NPC_VENDOR, $this->typeId);
if (!empty($sc[0]))
@@ -695,7 +695,7 @@ class NpcPage extends GenericPage
}
// tab: passengers
if ($_ = DB::World()->selectCol('SELECT accessory_entry as ARRAY_KEY, GROUP_CONCAT(seat_id) FROM vehicle_template_accessory WHERE entry = ?d', $this->typeId))
if ($_ = DB::World()->selectCol('SELECT accessory_entry AS ARRAY_KEY, GROUP_CONCAT(seat_id) FROM vehicle_template_accessory WHERE entry = ?d GROUP BY accessory_entry', $this->typeId))
{
$passengers = new CreatureList(array(['id', array_keys($_)]));
if (!$passengers->error)
@@ -768,27 +768,34 @@ class NpcPage extends GenericPage
private function getRepForId($entries, &$spillover)
{
$result = [];
$q = 'SELECT f.id, f.parentFactionId, cor.creature_id AS npc,
IF(f.id = RewOnKillRepFaction1, RewOnKillRepValue1, RewOnKillRepValue2) AS qty,
IF(f.id = RewOnKillRepFaction1, MaxStanding1, MaxStanding2) AS maxRank,
IF(f.id = RewOnKillRepFaction1, isTeamAward1, isTeamAward2) AS spillover
FROM ?_factions f JOIN creature_onkill_reputation cor ON f.Id = cor.RewOnKillRepFaction1 OR f.Id = cor.RewOnKillRepFaction2 WHERE cor.creature_id IN (?a)';
foreach (DB::Aowow()->select($q, (array)$entries) as $_)
{
$set = array(
'id' => $_['id'],
'qty' => $_['qty'],
'name' => FactionList::getName($_['id']), // << this sucks .. maybe format this whole table with markdown and add name via globals?
'npc' => $_['npc'],
'cap' => $_['maxRank'] && $_['maxRank'] < REP_EXALTED ? Lang::$game['rep'][$_['maxRank']] : null
$rows = DB::World()->select('
SELECT creature_id AS npc, RewOnKillRepFaction1 AS faction, RewOnKillRepValue1 AS qty, MaxStanding1 AS maxRank, isTeamAward1 AS spillover
FROM creature_onkill_reputation WHERE creature_id IN (?a) AND RewOnKillRepFaction1 > 0 UNION
SELECT creature_id AS npc, RewOnKillRepFaction2 As faction, RewOnKillRepValue2 AS qty, MaxStanding2 AS maxRank, isTeamAward2 AS spillover
FROM creature_onkill_reputation WHERE creature_id IN (?a) AND RewOnKillRepFaction2 > 0',
(array)$entries, (array)$entries
);
if ($_['spillover'])
$factions = new FactionList(array(['id', array_column($rows, 'faction')]));
$result = [];
foreach ($rows as $row)
{
$spillover[$_['parentFactionId']] = [intVal($_['qty'] / 2), $_['maxRank']];
$set['spillover'] = $_['parentFactionId'];
if (!$factions->getEntry($row['faction']))
continue;
$set = array(
'id' => $row['faction'],
'qty' => $row['qty'],
'name' => $factions->getField('name', true),
'npc' => $row['npc'],
'cap' => $row['maxRank'] && $row['maxRank'] < REP_EXALTED ? Lang::$game['rep'][$row['maxRank']] : null
);
if ($row['spillover'])
{
$spillover[$factions->getField('cat')] = [intVal($row['qty'] / 2), $row['maxRank']];
$set['spillover'] = $factions->getField('cat');
}
$result[] = $set;
@@ -884,7 +891,7 @@ class NpcPage extends GenericPage
WHERE
ct.entry = ?d';
foreach (DB::Aowow()->select($quoteQuery, $this->typeId) as $text)
foreach (DB::World()->select($quoteQuery, $this->typeId) as $text)
{
$group = [];
foreach ($text as $t)

View File

@@ -62,11 +62,15 @@ class ObjectPage extends GenericPage
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// Event
if ($_ = DB::Aowow()->selectCell('SELECT IF(holidayId, holidayId, -e.id) FROM ?_events e, game_event_gameobject geg, gameobject g WHERE e.id = ABS(geg.eventEntry) AND g.guid = geg.guid AND g.id = ?d', $this->typeId))
// Event (ignore events, where the object only gets removed)
if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
$infobox[] = Util::ucFirst(Lang::$game['eventShort']).Lang::$main['colon'].'[event='.$_.']';
$ev = [];
foreach ($_ as $i => $e)
$ev[] = ($i % 2 ? '[br]' : ' ') . '[event='.$e.']';
$infobox[] = Util::ucFirst(Lang::$game['eventShort']).Lang::$main['colon'].implode(',', $ev);
}
// Reaction
@@ -137,7 +141,7 @@ class ObjectPage extends GenericPage
$buff .= Lang::$game['valueDelim'].$_[1];
// since Veins don't have charges anymore, the timer is questionable
$infobox[] = $_[2] > 1 ? '[tooltip name=restock][Recharges every '.Util::formatTime($_[2] * 1000).'][/tooltip][span class=tip tooltip=restock]'.$buff.'[/span]' : $buff;
$infobox[] = $_[2] > 1 ? '[tooltip name=restock]'.sprintf(Lang::gameObject('restock'), Util::formatTime($_[2] * 1000)).'[/tooltip][span class=tip tooltip=restock]'.$buff.'[/span]' : $buff;
}
// meeting stone [minLevel, maxLevel, zone]
@@ -202,7 +206,7 @@ class ObjectPage extends GenericPage
{
while ($next)
{
$row = DB::Aowow()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next);
$row = DB::World()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next);
$next = $row['next_page'];
$pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text'));
}
@@ -460,7 +464,7 @@ class ObjectPage extends GenericPage
$x = '$WowheadPower.registerObject('.$this->typeId.', '.User::$localeId.", {\n";
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n";
$x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($this->subject->renderTooltip())."'\n";
$x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($this->subject->renderTooltip())."',\n";
$x .= "\tmap: ".($s ? Util::toJSON(['zone' => $s[0], 'coords' => [$s[1] => $s[2]]]) : '{}')."\n";
$x .= "});";

View File

@@ -43,6 +43,8 @@ class PetPage extends GenericPage
protected function generateContent()
{
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
/***********/
/* Infobox */
/***********/

View File

@@ -120,7 +120,7 @@ class ProfilesPage extends GenericPage
private function getTalentDistribution($tString)
{
$classMask = 1 << ($this->character['classs'] - 1);
$distrib = DB::Aowow()->selectCol('SELECT COUNT(t.id) FROM dbc.talent t JOIN dbc.talenttab tt ON t.tabId = tt.id WHERE tt.classMask & ?d GROUP BY tt.id ORDER BY tt.tabNumber ASC', $classMask);
$distrib = DB::Aowow()->selectCol('SELECT COUNT(t.id) FROM dbc_talent t JOIN dbc_talenttab tt ON t.tabId = tt.id WHERE tt.classMask & ?d GROUP BY tt.id ORDER BY tt.tabNumber ASC', $classMask);
$result = [];
$start = 0;

View File

@@ -512,6 +512,8 @@ class QuestPage extends GenericPage
/* Mapper */
/**********/
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
/*
TODO (GODDAMNIT): jeez..
*/
@@ -547,7 +549,21 @@ class QuestPage extends GenericPage
if ($maTab)
$this->lvTabs[] = $maTab;
// todo (low): create pendant from player_factionchange_quests
// factionchange-equivalent
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_quests WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId))
{
$altQuest = new QuestList(array(['id', abs($pendant)]));
if (!$altQuest->error)
{
$this->transfer = sprintf(
Lang::quest('_transfer'),
$altQuest->id,
$altQuest->getField('name', true),
$pendant > 0 ? 'alliance' : 'horde',
$pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2]
);
}
}
/**************/
/* Extra Tabs */
@@ -690,8 +706,9 @@ class QuestPage extends GenericPage
$rewards['money'] = sprintf(Lang::$quest['expConvert2'], Util::formatMoney($questMoney + $comp), MAX_LEVEL);
// itemChoices
if ($c = @$this->subject->choices[$this->typeId][TYPE_ITEM])
if (!empty($this->subject->choices[$this->typeId][TYPE_ITEM]))
{
$c = $this->subject->choices[$this->typeId][TYPE_ITEM];
$choiceItems = new ItemList(array(['id', array_keys($c)]));
if (!$choiceItems->error)
{
@@ -711,8 +728,9 @@ class QuestPage extends GenericPage
}
// itemRewards
if ($ri = @$this->subject->rewards[$this->typeId][TYPE_ITEM])
if (!empty($this->subject->rewards[$this->typeId][TYPE_ITEM]))
{
$ri = $this->subject->rewards[$this->typeId][TYPE_ITEM];
$rewItems = new ItemList(array(['id', array_keys($ri)]));
if (!$rewItems->error)
{
@@ -731,8 +749,9 @@ class QuestPage extends GenericPage
}
}
if ($rc = @$this->subject->rewards[$this->typeId][TYPE_ITEM][TYPE_CURRENCY])
if (!empty($this->subject->rewards[$this->typeId][TYPE_ITEM][TYPE_CURRENCY]))
{
$rc = $this->subject->rewards[$this->typeId][TYPE_ITEM][TYPE_CURRENCY];
$rewCurr = new CurrencyList(array(['id', array_keys($rc)]));
if (!$rewCurr->error)
{

View File

@@ -178,7 +178,7 @@ class RacePage extends GenericPage
// Mounts
// ok, this sucks, but i rather hardcode the trainer, than fetch items by namepart
$items = isset($mountVendors[$this->typeId]) ? DB::Aowow()->selectCol('SELECT item FROM npc_vendor WHERE entry IN (?a)', $mountVendors[$this->typeId]) : 0;
$items = isset($mountVendors[$this->typeId]) ? DB::World()->selectCol('SELECT item FROM npc_vendor WHERE entry IN (?a)', $mountVendors[$this->typeId]) : 0;
$conditions = array(
['i.id', $items],

View File

@@ -23,7 +23,8 @@ class ScreenshotPage extends GenericPage
parent::__construct($pageCall, $pageParam);
$this->name = Lang::$main['ssEdit'];
$this->caption = @$_POST['screenshotcaption']; // do not htmlEscape. It's applied as textnode
// do not htmlEscape caption. It's applied as textnode
$this->caption = !empty($_POST['screenshotcaption']) ? $_POST['screenshotcaption'] : '';
// what are its other uses..? (finalize is custom)
if ($pageParam == 'finalize')
@@ -37,7 +38,7 @@ class ScreenshotPage extends GenericPage
// get screenshot destination
foreach ($_GET as $k => $v)
{
if ($v) // taret delivered as empty type.typeId key
if ($v) // target delivered as empty type.typeId key
continue;
$x = explode('_', $k); // . => _ as array key

View File

@@ -78,7 +78,7 @@ class SearchPage extends GenericPage
if ($_ = intVal($this->search)) // allow for search by Id
$this->query = $_;
$type = @intVal($_GET['type']);
$type = isset($_GET['type']) ? intVal($_GET['type']) : 0;
if (!empty($_GET['slots']))
$this->searchMask |= SEARCH_TYPE_JSON | 0x40;
@@ -249,19 +249,21 @@ class SearchPage extends GenericPage
if (!$asError)
{
if ($itemData = @$this->lvTabs[6]['data'])
// items
if (!empty($this->lvTabs[6]['data']))
{
$items = [];
foreach ($itemData as $k => $v)
foreach ($this->lvTabs[6]['data'] as $k => $v)
$items[] = Util::toJSON($v);
$outItems = "\t".implode(",\n\t", $items)."\n";
}
if ($setData = @$this->lvTabs[5]['data'])
// sets
if (!empty($this->lvTabs[5]['data']))
{
$sets = [];
foreach ($setData as $k => $v)
foreach ($this->lvTabs[5]['data'] as $k => $v)
{
unset($v['quality']);
if (!$v['heroic'])
@@ -586,7 +588,7 @@ class SearchPage extends GenericPage
if (($this->searchMask & SEARCH_TYPE_JSON) && ($this->searchMask & 0x20) && !empty($shared['pcsToSet']))
{
$cnd = [['i.id', array_keys($shared['pcsToSet'])], CFG_SQL_LIMIT_NONE];
$miscData = ['pcsToSet' => @$shared['pcsToSet']];
$miscData = ['pcsToSet' => $shared['pcsToSet']];
}
else if (($this->searchMask & SEARCH_TYPE_JSON) && ($this->searchMask & 0x40))
{
@@ -594,7 +596,7 @@ class SearchPage extends GenericPage
$cnd[] = ['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]];
$cnd[] = $cndAdd;
$slots = @explode(':', $_GET['slots']);
$slots = isset($_GET['slots']) ? explode(':', $_GET['slots']) : [];
array_walk($slots, function(&$v, $k) { $v = intVal($v); });
if ($_ = array_filter($slots))
$cnd[] = ['slot', $_];

View File

@@ -246,8 +246,8 @@ class SkillPage extends GenericPage
if (in_array($this->cat, [-5, 6, 7, 8, 9, 11]))
{
$list = [];
if (@$tt = Util::$trainerTemplates[TYPE_SKILL][$this->typeId])
$list = DB::Aowow()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', $tt);
if (!empty(Util::$trainerTemplates[TYPE_SKILL][$this->typeId]))
$list = DB::World()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', Util::$trainerTemplates[TYPE_SKILL][$this->typeId]);
else
{
$mask = 0;
@@ -255,19 +255,26 @@ class SkillPage extends GenericPage
if ($pair[1] == $this->typeId)
$mask |= 1 << $idx;
$list = DB::Aowow()->selectCol('
$spellIds = DB::Aowow()->selectCol(
'SELECT id FROM ?_spell WHERE typeCat IN (-11, 9) AND (skillLine1 = ?d OR (skillLine1 > 0 AND skillLine2OrMask = ?d) {OR (skillLine1 = -3 AND skillLine2OrMask = ?d)})',
$this->typeId,
$this->typeId,
$mask ?: DBSIMPLE_SKIP
);
$list = $spellIds ? DB::World()->selectCol('
SELECT IF(t1.entry > 200000, t2.entry, t1.entry)
FROM npc_trainer t1
JOIN ?_spell s ON s.id = t1.spell
LEFT JOIN npc_trainer t2 ON t2.spell = -t1.entry
WHERE s.typeCat IN (-11, 9) AND (s.skillLine1 = ?d OR (s.skillLine1 > 0 AND s.skillLine2OrMask = ?d) '.($mask ? ' OR (s.skilllIne1 = -3 AND s.skillLine2OrMask = '.$mask.')' : null).')',
$this->typeId,
$this->typeId
);
WHERE t1.spell IN (?a)',
$spellIds
) : [];
}
if ($list)
{
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
$trainer = new CreatureList(array(CFG_SQL_LIMIT_NONE, ['ct.id', $list], ['ct.spawns', 0, '>'], ['ct.npcflag', 0x10, '&']));
if (!$trainer->error)

View File

@@ -117,8 +117,16 @@ class SpellPage extends GenericPage
protected function generateContent()
{
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
$_cat = $this->subject->getField('typeCat');
$redButtons = array(
BUTTON_LINKS => ['color' => 'ff71d5ff', 'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$this->typeId],
BUTTON_VIEW3D => false,
BUTTON_WOWHEAD => true
);
/***********/
/* Infobox */
/***********/
@@ -203,17 +211,14 @@ class SpellPage extends GenericPage
}
}
// accquisition..
if ($_ = @$this->subject->sources[$this->subject->id])
{
if (array_key_exists(10, $_)) // ..starter spell
// accquisition.. 10: starter spell; 7: discovery
if (isset($this->subject->sources[$this->subject->id][10]))
$infobox[] = '[li]'.Lang::$spell['starter'].'[/li]';
else if (array_key_exists(7, $_)) // ..discovery
else if (isset($this->subject->sources[$this->subject->id][7]))
$infobox[] = '[li]'.Lang::$spell['discovered'].'[/li]';
}
// training cost
if ($cost = DB::Aowow()->selectCell('SELECT spellcost FROM npc_trainer WHERE spell = ?d', $this->subject->id))
if ($cost = DB::World()->selectCell('SELECT spellcost FROM npc_trainer WHERE spell = ?d', $this->subject->id))
$infobox[] = '[li]'.Lang::$spell['trainingCost'].Lang::$main['colon'].'[money='.$cost.'][/li]';
// used in mode
@@ -231,20 +236,14 @@ class SpellPage extends GenericPage
$glyphId = $this->subject->getField('effect'.$i.'MiscValue');
if ($_ = DB::Aowow()->selectCell('SELECT si.iconString FROM ?_glyphproperties gp JOIN ?_spellicon si ON gp.iconId = si.id WHERE gp.spellId = ?d { OR gp.id = ?d }', $this->typeId, $glyphId ?: DBSIMPLE_SKIP))
if (file_exists('static/images/wow/interface/Spellbook/'.$_.'.png'))
$infobox .= '[img src='.STATIC_URL.'/images/wow/interface/Spellbook/'.$_.'.png border=0 float=center margin=15]';
if (file_exists('static/images/wow/Interface/Spellbook/'.$_.'.png'))
$infobox .= '[img src='.STATIC_URL.'/images/wow/Interface/Spellbook/'.$_.'.png border=0 float=center margin=15]';
/****************/
/* Main Content */
/****************/
$redButtons = array(
BUTTON_LINKS => ['color' => 'ff71d5ff', 'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$this->typeId],
BUTTON_VIEW3D => false,
BUTTON_WOWHEAD => true
);
$this->reagents = $this->createReagentList();
$this->scaling = $this->createScalingData();
$this->items = $this->createRequiredItems();
@@ -280,23 +279,22 @@ class SpellPage extends GenericPage
$this->duration = Util::formatTime($_);
// factionchange-equivalent
/* nyi
$pendant = DB::Aowow()->selectCell('SELECT IF(hordethis->typeId = ?d, alliancethis->typeId, -hordethis->typeId) FROM player_factionchange_spells WHERE alliancethis->typeId = ?d OR hordethis->typeId = ?d', $this->typeId, $this->typeId, $this->typeId);
if ($pendant)
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_spells WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId))
{
$altiSpell = new SpellList(array(['id', abs($pendant)]));
$altSpell = new SpellList(array(['id', abs($pendant)]));
if (!$altSpell->error)
{
$this->transfer = array(
'id' => $altItem->id,
'icon' => $altItem->getField('iconString'),
'name' => $altItem->getField('name', true),
'facInt' => $pendant > 0 ? 'alliance' : 'horde',
'facName' => $pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2]
$this->transfer = sprintf(
Lang::$spell['_transfer'],
$altSpell->id,
1, // quality
$altSpell->getField('iconString'),
$altSpell->getField('name', true),
$pendant > 0 ? 'alliance' : 'horde',
$pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2]
);
)
}
*/
}
/**************/
/* Extra Tabs */
@@ -561,7 +559,7 @@ class SpellPage extends GenericPage
// tab: contains
// spell_loot_template & skill_extra_item_template
$extraItem = DB::Aowow()->selectRow('SELECT * FROM skill_extra_item_template WHERE spellid = ?d', $this->subject->id);
$extraItem = DB::World()->selectRow('SELECT * FROM skill_extra_item_template WHERE spellid = ?d', $this->subject->id);
$spellLoot = new Loot();
if ($spellLoot->getByContainer(LOOT_SPELL, $this->subject->id) || $extraItem)
@@ -610,7 +608,7 @@ class SpellPage extends GenericPage
// tab: exclusive with
if ($this->firstRank) {
$linkedSpells = DB::Aowow()->selectCol( // dont look too closely ..... please..?
$linkedSpells = DB::World()->selectCol( // dont look too closely ..... please..?
'SELECT IF(sg2.spell_id < 0, sg2.id, sg2.spell_id) AS ARRAY_KEY, IF(sg2.spell_id < 0, sg2.spell_id, sr.stack_rule)
FROM spell_group sg1
JOIN spell_group sg2
@@ -629,7 +627,7 @@ class SpellPage extends GenericPage
if ($v > 0)
continue;
$extraSpells += DB::Aowow()->selectCol( // recursive case (recursive and regular ids are not mixed in a group)
$extraSpells += DB::World()->selectCol( // recursive case (recursive and regular ids are not mixed in a group)
'SELECT sg2.spell_id AS ARRAY_KEY, sr.stack_rule
FROM spell_group sg1
JOIN spell_group sg2
@@ -673,7 +671,7 @@ class SpellPage extends GenericPage
}
// tab: linked with
$rows = DB::Aowow()->select('
$rows = DB::World()->select('
SELECT spell_trigger AS `trigger`,
spell_effect AS effect,
type,
@@ -753,7 +751,7 @@ class SpellPage extends GenericPage
['spell1', $this->typeId], ['spell2', $this->typeId], ['spell3', $this->typeId], ['spell4', $this->typeId],
['spell5', $this->typeId], ['spell6', $this->typeId], ['spell7', $this->typeId], ['spell8', $this->typeId]
);
if ($_ = DB::Aowow()->selectCol('SELECT entryOrGUID FROM smart_scripts WHERE entryorguid > 0 AND source_type = 0 AND action_type IN (11, 75, 85, 86) AND action_param1 = ?d', $this->typeId))
if ($_ = DB::World()->selectCol('SELECT entryOrGUID FROM smart_scripts WHERE entryorguid > 0 AND source_type = 0 AND action_type IN (11, 75, 85, 86) AND action_param1 = ?d', $this->typeId))
$conditions[] = ['id', $_];
$ubCreature = new CreatureList($conditions);
@@ -772,7 +770,7 @@ class SpellPage extends GenericPage
}
// tab: zone
if ($areas = DB::Aowow()->select('SELECT * FROM spell_area WHERE spell = ?d', $this->typeId))
if ($areas = DB::World()->select('SELECT * FROM spell_area WHERE spell = ?d', $this->typeId))
{
$zones = new ZoneList(array(['id', array_column($areas, 'area')]));
if (!$zones->error)
@@ -955,26 +953,27 @@ class SpellPage extends GenericPage
}
// tab: taught by npc (source:6 => trainer)
$src = @$this->subject->sources[$this->typeId];
if (!empty($src) && in_array(6, array_keys($src)))
if (!empty($this->subject->sources[$this->typeId][6]))
{
$src = $this->subject->sources[$this->typeId][6];
$list = [];
if (count($src[6]) == 1 && $src[6][0] == 0) // multiple trainer
if (count($src) == 1 && $src[0] == 0) // multiple trainer
{
$tt = null;
// Professions
if (in_array($_cat, [9, 11]))
$tt = @Util::$trainerTemplates[TYPE_SKILL][$this->subject->getField('skillLines')[0]];
if (in_array($_cat, [9, 11]) && isset(Util::$trainerTemplates[TYPE_SKILL][$this->subject->getField('skillLines')[0]]))
$tt = Util::$trainerTemplates[TYPE_SKILL][$this->subject->getField('skillLines')[0]];
// Class Spells
else if ($_cat == 7 && $this->subject->getField('reqClassMask'))
{
$clId = log($this->subject->getField('reqClassMask'), 2) + 1 ;
if (intVal($clId) == $clId) // only one class was set, so float == int
$tt = @Util::$trainerTemplates[TYPE_CLASS][$clId];
if (isset(Util::$trainerTemplates[TYPE_CLASS][$clId]))
$tt = Util::$trainerTemplates[TYPE_CLASS][$clId];
}
if ($tt)
$list = DB::Aowow()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', $tt);
$list = DB::World()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', $tt);
else
{
$mask = 0;
@@ -982,7 +981,7 @@ class SpellPage extends GenericPage
if ($pair[1] == $this->typeId)
$mask |= 1 << $idx;
$list = DB::Aowow()->selectCol('
$list = DB::World()->selectCol('
SELECT IF(t1.entry > 200000, t2.entry, t1.entry)
FROM npc_trainer t1
LEFT JOIN npc_trainer t2 ON t2.spell = -t1.entry
@@ -991,8 +990,8 @@ class SpellPage extends GenericPage
);
}
}
else if ($src[6])
$list = array_values($src[6]);
else if ($src)
$list = array_values($src);
if ($list)
{
@@ -1328,7 +1327,7 @@ class SpellPage extends GenericPage
'directAP' => 0,
'dotAP' => 0
),
(array)DB::Aowow()->selectRow('SELECT direct_bonus AS directSP, dot_bonus AS dotSP, ap_bonus AS directAP, ap_dot_bonus AS dotAP FROM spell_bonus_data WHERE entry = ?d', $this->firstRank)
(array)DB::World()->selectRow('SELECT direct_bonus AS directSP, dot_bonus AS dotSP, ap_bonus AS directAP, ap_dot_bonus AS dotAP FROM spell_bonus_data WHERE entry = ?d', $this->firstRank)
);
if (!$this->subject->isDamagingSpell() && !$this->subject->isHealingSpell())
@@ -1482,7 +1481,7 @@ class SpellPage extends GenericPage
private function createEffects(&$infobox, &$redButtons)
{
// proc data .. maybe use more information..?
$procData = DB::Aowow()->selectRow('SELECT IF(ppmRate > 0, -ppmRate, customChance) AS chance, cooldown FROM spell_proc_event WHERE entry = ?d', $this->typeId);
$procData = DB::World()->selectRow('SELECT IF(ppmRate > 0, -ppmRate, customChance) AS chance, cooldown FROM spell_proc_event WHERE entry = ?d', $this->typeId);
if (!isset($procData['cooldown']))
$procData['cooldown'] = 0;
@@ -1574,14 +1573,13 @@ class SpellPage extends GenericPage
$procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null
);
// parse masks and indizes
switch ($effId)
{
case 8: // Power Drain
case 30: // Energize
case 137: // Energize Pct
$_ = @Lang::$spell['powerTypes'][$effMV];
$_ = Lang::spell('powerTypes', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE))
$_ = sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_);
else if (!$_)
@@ -1611,7 +1609,7 @@ class SpellPage extends GenericPage
$foo['name'] .= Lang::$main['colon'].$_;
break;
case 33: // Open Lock
$_ = @Lang::$spell['lockType'][$effMV];
$_ = Lang::spell('lockType', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE))
$_ = sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_);
else if (!$_)
@@ -1629,7 +1627,7 @@ class SpellPage extends GenericPage
break;
case 38: // Dispel [miscValue => Types]
case 126: // Steal Aura
$_ = @Lang::$game['dt'][$effMV];
$_ = Lang::game('dt', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE))
$_ = sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_);
else if (!$_)
@@ -1638,7 +1636,7 @@ class SpellPage extends GenericPage
$foo['name'] .= ' ('.$_.')';
break;
case 39: // Learn Language
$_ = @Lang::$game['languages'][$effMV];
$_ = Lang::game('languages', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE))
$_ = sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_);
else if (!$_)
@@ -1690,7 +1688,7 @@ class SpellPage extends GenericPage
$foo['name'] .= ' ('.$_.')';
break;
case 108: // Dispel Mechanic
$_ = @Lang::$game['me'][$effMV];
$_ = Lang::game('me', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE))
$_ = sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_);
else if (!$_)
@@ -1705,7 +1703,7 @@ class SpellPage extends GenericPage
$foo['name'] .= Lang::$main['colon'].Util::ucFirst(Lang::$game['skill']).' #'.$effMV;;
break;
case 146: // Activate Rune
$_ = @Lang::$spell['powerRunes'][$effMV];
$_ = Lang::spell('powerRunes', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE))
$_ = sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_);
else if (!$_)
@@ -1737,12 +1735,12 @@ class SpellPage extends GenericPage
switch ($effAura)
{
case 17: // Mod Stealth Detection
if ($_ = @Lang::$spell['stealthType'][$effMV])
if ($_ = Lang::spell('stealthType', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
break;
case 19: // Mod Invisibility Detection
if ($_ = @Lang::$spell['invisibilityType'][$effMV])
if ($_ = Lang::spell('invisibilityType', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
break;
@@ -1751,7 +1749,7 @@ class SpellPage extends GenericPage
case 35: // Mod Increase Power
case 85: // Mod Power Regeneration
case 110: // Mod Power Regeneration Pct
if ($_ = @Lang::$spell['powerTypes'][$effMV])
if ($_ = Lang::spell('powerTypes', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
break;
@@ -1788,34 +1786,40 @@ class SpellPage extends GenericPage
}
break;
case 37: // Effect immunity
if ($_ = @Util::$spellEffectStrings[$effMV])
if (isset(Util::$spellEffectStrings[$effMV]))
{
$_ = Util::$spellEffectStrings[$effMV];
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
}
break;
case 38: // Aura immunity
if ($_ = @Util::$spellAuraStrings[$effMV])
if (isset(Util::$spellAuraStrings[$effMV]))
{
$_ = Util::$spellAuraStrings[$effMV];
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
}
break;
case 41: // Dispel Immunity
case 178: // Mod Debuff Resistance
case 245: // Mod Aura Duration By Dispel
if ($_ = @Lang::$game['dt'][$effMV])
if ($_ = Lang::game('dt', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
break;
case 44: // Track Creature
if ($_ = @Lang::$game['ct'][$effMV])
if ($_ = Lang::game('ct', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
break;
case 45: // Track Resource
if ($_ = @Lang::$spell['lockType'][$effMV])
if ($_ = Lang::spell('lockType', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
break;
case 75: // Language
if ($_ = @Lang::$game['languages'][$effMV])
if ($_ = Lang::game('languages', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
break;
@@ -1825,7 +1829,7 @@ class SpellPage extends GenericPage
case 234: // Mod Mechanic Duration (no stack)
case 255: // Mod Mechanic Damage Taken Pct
case 276: // Mod Mechanic Damage Done Percent
if ($_ = @Lang::$game['me'][$effMV])
if ($_ = Lang::game('me', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].Util::asHex($effMV), $_) : $_;
break;
@@ -1889,7 +1893,7 @@ class SpellPage extends GenericPage
break;
case 107: // Flat Modifier
case 108: // Pct Modifier
if ($_ = @Lang::$spell['spellModOp'][$effMV])
if ($_ = Lang::spell('spellModOp', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$effMV, $_) : $_;
break;
@@ -1917,7 +1921,7 @@ class SpellPage extends GenericPage
break;
case 249: // Convert Rune
$x = $this->subject->getField('effect'.$i.'MiscValueB');
if ($_ = @Lang::$spell['powerRunes'][$x])
if ($_ = Lang::spell('powerRunes', $x))
$bar = User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$main['colon'].$x, $_) : $_;
break;

View File

@@ -284,8 +284,9 @@ class SpellsPage extends GenericPage
['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->category[1]]]
];
if ($sf = @$this->shortFilter[$this->category[1]])
if (!empty($this->shortFilter[$this->category[1]]))
{
$sf = $this->shortFilter[$this->category[1]];
$txt = '';
if ($sf[0] && $sf[1])
$txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]) . Lang::$spell['relItems']['link'] . sprintf(Lang::$spell['relItems']['recipes'], $sf[1]);
@@ -323,8 +324,9 @@ class SpellsPage extends GenericPage
{
$conditions[] = ['s.skillLine1', $this->category[1]];
if ($sf = @$this->shortFilter[$this->category[1]])
if (!empty($this->shortFilter[$this->category[1]]))
{
$sf = $this->shortFilter[$this->category[1]];
$txt = '';
if ($sf[0] && $sf[1])
$txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]) . Lang::$spell['relItems']['link'] . sprintf(Lang::$spell['relItems']['recipes'], $sf[1]);

View File

@@ -80,7 +80,21 @@ class TitlePage extends GenericPage
BUTTON_LINKS => ['name' => $this->nameFixed]
);
// todo (low): create pendant from player_factionchange_titles
// factionchange-equivalent
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_titles WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId))
{
$altTitle = new TitleList(array(['id', abs($pendant)]));
if (!$altTitle->error)
{
$this->transfer = sprintf(
Lang::title('_transfer'),
$altTitle->id,
$altTitle->getHtmlizedName(),
$pendant > 0 ? 'alliance' : 'horde',
$pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2]
);
}
}
/**************/
/* Extra Tabs */

View File

@@ -291,7 +291,14 @@ class ZonePage extends GenericPage
$data = array_values($data);
if (!in_array($what, ['vein', 'herb', 'rare']))
$dataz = array_column($dataz, 0);
{
$foo = [];
foreach ($dataz as $d)
foreach ($d as $_)
$foo[] = $_;
$dataz = $foo;
}
}
// append paths between nodes

View File

@@ -51,6 +51,7 @@ if (!defined('AOWOW_REVISION'))
$mapWidth = 1002;
$mapHeight = 668;
$threshold = 95; // alpha threshold to define subZones: set it too low and you have unspawnable areas inside a zone; set it too high and the border regions overlap
$runTime = ini_get('max_execution_time');
$locStr = null;
$dbcPath = FileGen::$srcDir.'%sDBFilesClient/';
@@ -69,10 +70,12 @@ if (!defined('AOWOW_REVISION'))
$bgColor = imagecolorallocatealpha($img, 0, 0, 0, 127);
imagefilledrectangle($img, 0, 0, imagesx($img) - 1, imagesy($img) - 1, $bgColor);
imagecolordeallocate($img, $bgColor);
imagecolortransparent($img, $bgColor);
imagealphablending($img, true);
imagecolordeallocate($img, $bgColor);
return $img;
};
@@ -161,7 +164,7 @@ if (!defined('AOWOW_REVISION'))
return $ok;
};
$createSpawnMap = function($img, $zoneId) use ($mapHeight, $mapWidth)
$createSpawnMap = function($img, $zoneId) use ($mapHeight, $mapWidth, $threshold)
{
FileGen::status(' - creating spawn map');
@@ -174,7 +177,7 @@ if (!defined('AOWOW_REVISION'))
for ($x = 0; $x < 1000; $x++)
{
$a = imagecolorat($img, ($x * $mapWidth) / 1000, ($y * $mapHeight) / 1000) >> 24;
imagesetpixel($tmp, $x, $y, $a < 30 ? $cfg : $cbg);
imagesetpixel($tmp, $x, $y, $a < $threshold ? $cfg : $cbg);
}
}
@@ -480,7 +483,7 @@ if (!defined('AOWOW_REVISION'))
for ($my = 0; $my < imagesy($img); $my++)
for ($mx = 0; $mx < imagesx($img); $mx++)
if ((imagecolorat($img, $mx, $my) >> 24) < 30)
if ((imagecolorat($img, $mx, $my) >> 24) < $threshold)
imagesetpixel($row['maskimage'], $x + $mx, $y + $my, $row['maskcolor']);
}
@@ -566,7 +569,6 @@ if (!defined('AOWOW_REVISION'))
if (!$multiLeveled)
{
imagecolortransparent($overlay, imagecolorat($overlay, imagesx($overlay)-1, imagesy($overlay)-1));
imagecopymerge($map, $overlay, 0, 0, 0, 0, imagesx($overlay), imagesy($overlay), 100);
imagedestroy($overlay);
}
@@ -635,7 +637,7 @@ if (!defined('AOWOW_REVISION'))
if ($modeMask & 0x08) // optional tidbits (not used by default)
{
if (FileGen::writeDir($destDir.'interface/Glues/Credits/'))
if (FileGen::writeDir($destDir.'Interface/Glues/Credits/'))
{
// tile ordering
$order = array(
@@ -692,7 +694,7 @@ if (!defined('AOWOW_REVISION'))
$sum++;
$done = ' - '.str_pad($sum.'/'.$total, 8).str_pad('('.number_format($sum * 100 / $total, 2).'%)', 9);
$name = $destDir.'interface/Glues/Credits/'.$file;
$name = $destDir.'Interface/Glues/Credits/'.$file;
if (!isset(FileGen::$cliOpts['force']) && file_exists($name.'.png'))
{

View File

@@ -95,13 +95,13 @@ if (!defined('AOWOW_REVISION'))
'ui-paperdoll-slot-waist' => 'inventoryslot_waist',
'ui-paperdoll-slot-wrists' => 'inventoryslot_wrists'
),
3 => array(
['race_human_male', 'race_dwarf_male', 'race_gnome_male', 'race_nightelf_male', 'race_draenai_male' ],
['race_tauren_male', 'race_undead_male', 'race_troll_male', 'race_orc_male', 'race_bloodelf_male' ],
['race_human_female', 'race_dwarf_female', 'race_gnome_female', 'race_nightelf_female', 'race_draenai_female' ],
['race_tauren_female', 'race_undead_female', 'race_troll_female', 'race_orc_female', 'race_bloodelf_female']
3 => array( // uses nameINT from ChrRaces.dbc
['race_human_male', 'race_dwarf_male', 'race_gnome_male', 'race_nightelf_male', 'race_draenei_male' ],
['race_tauren_male', 'race_scourge_male', 'race_troll_male', 'race_orc_male', 'race_bloodelf_male' ],
['race_human_female', 'race_dwarf_female', 'race_gnome_female', 'race_nightelf_female', 'race_draenei_female' ],
['race_tauren_female', 'race_scourge_female', 'race_troll_female', 'race_orc_female', 'race_bloodelf_female']
),
4 => array(
4 => array( // uses nameINT from ChrClasses.dbc
['class_warrior', 'class_mage', 'class_rogue', 'class_druid' ],
['class_hunter', 'class_shaman', 'class_priest', 'class_warlock'],
['class_paladin', 'class_deathknight' ]

View File

@@ -673,9 +673,9 @@ if (typeof $WowheadPower == "undefined") {
zoom: 3,
zoomable: false,
buttons: false
});
}, true);
}
arr[id].map.update(json.map);
arr[id].map.update(json.map, true);
delete json.map;
}

View File

@@ -0,0 +1,52 @@
ALTER TABLE `aowow_creature`
ADD COLUMN `dmgMin` FLOAT UNSIGNED NOT NULL DEFAULT '0' AFTER `trainerRace`,
ADD COLUMN `dmgMax` FLOAT UNSIGNED NOT NULL DEFAULT '0' AFTER `dmgMin`,
ADD COLUMN `mleAtkPwrMin` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `dmgMax`,
ADD COLUMN `mleAtkPwrMax` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `mleAtkPwrMin`,
ADD COLUMN `rngAtkPwrMin` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `mleAtkPwrMax`,
ADD COLUMN `rngAtkPwrMax` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `rngAtkPwrMin`
ADD COLUMN `healthMin` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `aiName`
ADD COLUMN `healthMax` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `healthMin`
ADD COLUMN `manaMin` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `healthMax`
ADD COLUMN `manaMax` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `manaMin`
ADD COLUMN `armorMin` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `manaMax`
ADD COLUMN `armorMax` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `armorMin`
;
-- merge creature_classlevelstats into ?_creature to be searchable
-- edit the table names to fit
-- for min stats
/*
UPDATE
aowow.aowow_creature ac,
world.creature_template ct,
world.creature_classlevelstats cls
SET
ac.healthMin = (CASE ct.exp WHEN 0 THEN cls.basehp0 WHEN 1 THEN cls.basehp1 ELSE cls.basehp2 END) * ct.Health_mod,
ac.manaMin = cls.basemana * ct.Mana_mod,
ac.armorMin = cls.basearmor * ct.Armor_mod,
ac.rngAtkPwrMin = cls.rangedattackpower,
ac.mleAtkPwrMin = cls.attackpower,
ac.dmgMin = (CASE ct.exp WHEN 0 THEN cls.damage_base WHEN 1 THEN cls.damage_exp1 ELSE cls.damage_exp2 END)
WHERE
ac.id = ct.entry AND
ct.unit_class = cls.class AND
ct.minlevel = cls.level;
-- for max stats
UPDATE
aowow.aowow_creature ac,
world.creature_template ct,
world.creature_classlevelstats cls
SET
ac.healthMax = (CASE ct.exp WHEN 0 THEN cls.basehp0 WHEN 1 THEN cls.basehp1 ELSE cls.basehp2 END) * ct.Health_mod,
ac.manaMax = cls.basemana * ct.Mana_mod,
ac.armorMax = cls.basearmor * ct.Armor_mod,
ac.rngAtkPwrMax = cls.rangedattackpower,
ac.mleAtkPwrMax = cls.attackpower,
ac.dmgMax = (CASE ct.exp WHEN 0 THEN cls.damage_base WHEN 1 THEN cls.damage_exp1 ELSE cls.damage_exp2 END)
WHERE
ac.id = ct.entry AND
ct.unit_class = cls.class AND
ct.maxlevel = cls.level;
*/

View File

@@ -0,0 +1,11 @@
CREATE TABLE `aowow_errors` (
`date` INT(10) UNSIGNED NULL DEFAULT NULL,
`version` SMALLINT(5) UNSIGNED NOT NULL,
`phpError` SMALLINT(5) UNSIGNED NOT NULL,
`file` VARCHAR(250) NOT NULL,
`line` SMALLINT(5) UNSIGNED NOT NULL,
`query` VARCHAR(250) NOT NULL,
`userGroups` SMALLINT(5) UNSIGNED NOT NULL,
`message` TEXT NULL,
PRIMARY KEY (`file`, `line`, `phpError`, `version`, `userGroups`)
) COLLATE='utf8_general_ci' ENGINE=MyISAM;

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 B

View File

@@ -164,7 +164,7 @@ var mn_items = [
[9,"Hexenmeister",,[[1,"Erhebliche"],[2,"Geringe"]],{className:"c9",tinyIcon:"class_warlock"}],
[1,"Krieger",,[[1,"Erhebliche"],[2,"Geringe"]],{className:"c1",tinyIcon:"class_warrior"}]
]],
[7,"Trade Goods",,[
[7,"Handwerkswaren",,[
[14,"Rüstungsverzauberungen"],
[5,"Stoff"],
[3,"Geräte"],

View File

@@ -28,7 +28,7 @@ if ($rewards):
<script type="text/javascript">//<![CDATA[
<?php
foreach ($rewards as $k => $i):
echo ' $WH.ge(\'icontab-icon'.($k + 1 + $offset).'\').appendChild('.$i['globalStr'].'.createIcon('.$i['id'].', 1, '.(@$i['qty'] ?: 0)."));\n";
echo ' $WH.ge(\'icontab-icon'.($k + 1 + $offset).'\').appendChild('.$i['globalStr'].'.createIcon('.$i['id'].', 1, '.(empty($i['qty']) ? 0 : $i['qty'])."));\n";
endforeach;
?>
//]]></script>

View File

@@ -39,12 +39,12 @@ foreach ($this->criteria['data'] as $i => $cr):
echo '</th><td>';
if ($l = @$cr['link']):
echo '<a href="'.$l['href'].'"'.(isset($l['quality']) ? ' class="q'.$l['quality'].'"' : null).'>'.Util::htmlEscape($l['text']).'</a>';
if (!empty($cr['link'])):
echo '<a href="'.$cr['link']['href'].'"'.(isset($cr['link']['quality']) ? ' class="q'.$cr['link']['quality'].'"' : null).'>'.Util::htmlEscape($cr['link']['text']).'</a>';
endif;
if (!empty($l['count']) && $l['count'] > 1):
echo '&nbsp;('.$l['count'].')';
if (!empty($cr['link']['count']) && $cr['link']['count'] > 1):
echo '&nbsp;('.$cr['link']['count'].')';
endif;
if (isset($cr['extraText'])):
@@ -69,7 +69,7 @@ endforeach;
<script type="text/javascript">//<![CDATA[
<?php
foreach ($this->criteria['icons'] as $k => $ic):
echo ' $WH.ge(\'iconlist-icon'.$ic['itr'].'\').appendChild('.$ic['type'].'.createIcon('.$ic['id'].', 0, '.(@$ic['count'] ?: 0)."));\n";
echo ' $WH.ge(\'iconlist-icon'.$ic['itr'].'\').appendChild('.$ic['type'].'.createIcon('.$ic['id'].', 0, '.(!empty($ic['count']) ? $ic['count'] : 0)."));\n";
endforeach;
?>
//]]></script>
@@ -99,6 +99,10 @@ endif;
$this->brick('mail');
if (!empty($this->transfer)):
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;
?>
<h2 class="clear"><?php echo Lang::$main['related']; ?></h2>

View File

@@ -46,6 +46,11 @@ if (isset($this->unavailable)):
<b style="color: red"><?php echo Lang::$main['_unavailable']; ?></b>
<?php
endif;
if (!empty($this->transfer)):
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;
?>
<h2 class="clear"><?php echo Lang::$main['related']; ?></h2>
</div>

View File

@@ -35,7 +35,7 @@ if (!empty($f['slot'])):
<div style="float: left"><?php echo Lang::$item['slot'].Lang::$main['colon']; ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['sl[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::$main['clear']; ?></a></small>
<div class="clear"></div>
<select name="sl[]" size="<?php echo min(@count($f['slot']), 7); ?>" multiple="multiple" class="rightselect">
<select name="sl[]" size="<?php echo min(count($f['slot']), 7); ?>" multiple="multiple" class="rightselect">
<?php
foreach ($f['slot'] as $k => $str):
echo ' <option value="'.$k.'" '.(isset($f['sl']) && in_array($k, (array)$f['sl']) ? ' selected' : null).'>'.$str."</option>\n";
@@ -52,7 +52,7 @@ if (!empty($f['type'])):
<div style="float: left"><?php echo Lang::$game['type'].Lang::$main['colon']; ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::$main['clear']; ?></a></small>
<div class="clear"></div>
<select name="ty[]" size="<?php echo min(@count($f['type']), 7); ?>" multiple="multiple" class="rightselect">
<select name="ty[]" size="<?php echo min(count($f['type']), 7); ?>" multiple="multiple" class="rightselect">
<?php
foreach ($f['type'] as $k => $str):
echo ' <option value="'.$k.'" '.(isset($f['ty']) && in_array($k, (array)$f['ty']) ? ' selected' : null).'>'.$str."</option>\n";

View File

@@ -154,7 +154,7 @@ if ($r = $this->rewards):
echo " <div class=\"pad\"></div>\n";
endif;
$addData = ['rewards' => @$r['items'], 'offset' => $offset, 'extra' => @$r['money']];
$addData = ['rewards' => !empty($r['items']) ? $r['items'] : null, 'offset' => $offset, 'extra' => !empty($r['money']) ? $r['money'] : null];
$addData['rewTitle'] = empty($r['choice']) ? Lang::$quest['receiveItems'] : Lang::$quest['receiveAlso'];
$this->brick('rewards', $addData);
@@ -190,6 +190,10 @@ endif;
$this->brick('mail');
if (!empty($this->transfer)):
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;
?>
<h2 class="clear"><?php echo Lang::$main['related']; ?></h2>
</div>

View File

@@ -63,12 +63,10 @@ endif;
<?php $this->brick('article'); ?>
<?php /*
if !empty($transfer)}
<div class="pad"></div>
{$lang._transfer|sprintf:$transfer.id:´´:$transfer.icon:$transfer.name:$transfer.facInt:$transfer.facName}
{/if}
*/
<?php
if (!empty($this->transfer)):
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;
?>
<h3><?php echo Lang::$spell['_spellDetails']; ?></h3>