- removed tooltip buffer from TypeClasses (only used by setup and caused bugs with the localization to boot)

- fixed broken dataset-scripts
- removed base-info.php wich wasn't really a dataset-script
This commit is contained in:
Sarjuuk
2014-09-01 23:51:30 +02:00
parent 0ab0cf133e
commit 96056161bd
21 changed files with 278 additions and 324 deletions

View File

@@ -12,7 +12,6 @@ class AchievementList extends BaseType
public static $brickFile = 'achievement'; public static $brickFile = 'achievement';
public $criteria = []; public $criteria = [];
public $tooltip = [];
protected $queryBase = 'SELECT `a`.*, `ar`.*, `lar`.*, `a`.`id` AS ARRAY_KEY FROM ?_achievement a'; protected $queryBase = 'SELECT `a`.*, `ar`.*, `lar`.*, `a`.`id` AS ARRAY_KEY FROM ?_achievement a';
protected $queryOpts = array( protected $queryOpts = array(
@@ -116,9 +115,6 @@ class AchievementList extends BaseType
public function renderTooltip() public function renderTooltip()
{ {
if (isset($this->tooltip[$this->id]))
return $this->tooltip[$this->id];
$criteria = $this->getCriteria(); $criteria = $this->getCriteria();
$tmp = []; $tmp = [];
$rows = []; $rows = [];
@@ -209,10 +205,7 @@ class AchievementList extends BaseType
if ($description || $criteria) if ($description || $criteria)
$x .= '</td></tr></table>'; $x .= '</td></tr></table>';
// Completed return $x;
$this->tooltip[$this->id] = $x;
return $this->tooltip[$this->id];
} }
public function getSourceData() public function getSourceData()

View File

@@ -294,7 +294,11 @@ abstract class BaseType
public function getEntry($id) public function getEntry($id)
{ {
if (isset($this->templates[$id])) if (isset($this->templates[$id]))
{
$this->curTpl = $this->templates[$id];
$this->id = $id;
return $this->templates[$id]; return $this->templates[$id];
}
return null; return null;
} }

View File

@@ -8,13 +8,11 @@ class CreatureList extends BaseType
{ {
use spawnHelper; use spawnHelper;
public static $type = TYPE_NPC; public static $type = TYPE_NPC;
public static $brickFile = 'creature'; public static $brickFile = 'creature';
public $tooltips = []; protected $queryBase = 'SELECT ct.*, ct.id AS ARRAY_KEY FROM ?_creature ct';
public $queryOpts = array(
protected $queryBase = 'SELECT ct.*, ct.id AS ARRAY_KEY FROM ?_creature ct';
public $queryOpts = array(
'ct' => [['ft', 'clsMin', 'clsMax', 'qse']], 'ct' => [['ft', 'clsMin', 'clsMax', 'qse']],
'ft' => ['j' => '?_factiontemplate ft ON ft.id = ct.faction', 's' => ', ft.A, ft.H, ft.factionId'], '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) * ct.dmgMultiplier 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'], '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) * ct.dmgMultiplier 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'],
@@ -47,9 +45,6 @@ class CreatureList extends BaseType
if (!$this->curTpl) if (!$this->curTpl)
return null; return null;
if (isset($this->tooltips[$this->id]))
return $this->tooltips[$this->id];
$level = '??'; $level = '??';
$type = $this->curTpl['type']; $type = $this->curTpl['type'];
$row3 = [Lang::$game['level']]; $row3 = [Lang::$game['level']];
@@ -88,8 +83,6 @@ class CreatureList extends BaseType
$x .= '</table>'; $x .= '</table>';
$this->tooltips[$this->id] = $x;
return $x; return $x;
} }

View File

@@ -8,11 +8,11 @@ class GameObjectList extends BaseType
{ {
use listviewHelper, spawnHelper; use listviewHelper, spawnHelper;
public static $type = TYPE_OBJECT; public static $type = TYPE_OBJECT;
public static $brickFile = 'object'; public static $brickFile = 'object';
protected $queryBase = 'SELECT o.*, o.id AS ARRAY_KEY FROM ?_objects o'; protected $queryBase = 'SELECT o.*, o.id AS ARRAY_KEY FROM ?_objects o';
protected $queryOpts = array( protected $queryOpts = array(
'o' => [['ft', 'qse']], 'o' => [['ft', 'qse']],
'ft' => ['j' => ['?_factiontemplate ft ON ft.id = o.faction', true], 's' => ', ft.factionId, ft.A, ft.H'], 'ft' => ['j' => ['?_factiontemplate ft ON ft.id = o.faction', true], 's' => ', ft.factionId, ft.A, ft.H'],
'qse' => ['j' => ['?_quests_startend qse ON qse.type = 2 AND qse.typeId = o.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' => 'o.id'], 'qse' => ['j' => ['?_quests_startend qse ON qse.type = 2 AND qse.typeId = o.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' => 'o.id'],
@@ -100,9 +100,6 @@ class GameObjectList extends BaseType
if (!$this->curTpl) if (!$this->curTpl)
return array(); return array();
if (isset($this->tooltips[$this->id]))
return $this->tooltips[$this->id];
$x = '<table>'; $x = '<table>';
$x .= '<tr><td><b class="q">'.$this->getField('name', true).'</b></td></tr>'; $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']])
@@ -115,9 +112,7 @@ class GameObjectList extends BaseType
$x .= '</table>'; $x .= '</table>';
$this->tooltips[$this->id] = $x; return $x;
return $this->tooltips[$this->id];
} }
public function getJSGlobals($addMask = 0) public function getJSGlobals($addMask = 0)

View File

@@ -11,7 +11,6 @@ class ItemList extends BaseType
public static $type = TYPE_ITEM; public static $type = TYPE_ITEM;
public static $brickFile = 'item'; public static $brickFile = 'item';
public $tooltip = [];
public $json = []; public $json = [];
public $itemMods = []; public $itemMods = [];
@@ -407,9 +406,6 @@ class ItemList extends BaseType
if ($this->error) if ($this->error)
return; return;
if (!empty($this->tooltip[$this->id]))
return $this->tooltip[$this->id];
$_name = $this->getField('name', true); $_name = $this->getField('name', true);
$_reqLvl = $this->curTpl['requiredLevel']; $_reqLvl = $this->curTpl['requiredLevel'];
$_quality = $this->curTpl['quality']; $_quality = $this->curTpl['quality'];
@@ -1035,9 +1031,7 @@ class ItemList extends BaseType
$x .= '<!--?'.implode(':', $link).'-->'; $x .= '<!--?'.implode(':', $link).'-->';
} }
$this->tooltip[$this->id] = $x; return $x;
return $this->tooltip[$this->id];
} }
// from Trinity // from Trinity
@@ -1122,14 +1116,13 @@ class ItemList extends BaseType
$this->itemMods[$this->id] = []; $this->itemMods[$this->id] = [];
foreach (Util::$itemMods as $mod) foreach (Util::$itemMods as $mod)
if (!empty($this->curTpl[$mod])) if (isset($this->curTpl[$mod]) && ($_ = floatVal($this->curTpl[$mod])))
@$this->itemMods[$this->id][$mod] += $this->curTpl[$mod]; @$this->itemMods[$this->id][$mod] += $_;
// fetch and add socketbonusstats // fetch and add socketbonusstats
if (@$this->json[$this->id]['socketbonus'] > 0) if (@$this->json[$this->id]['socketbonus'] > 0)
$enchantments[$this->json[$this->id]['socketbonus']][] = $this->id; $enchantments[$this->json[$this->id]['socketbonus']][] = $this->id;
// Item is a gem (don't mix with sockets) // Item is a gem (don't mix with sockets)
if ($geId = $this->curTpl['gemEnchantmentId']) if ($geId = $this->curTpl['gemEnchantmentId'])
$enchantments[$geId][] = -$this->id; $enchantments[$geId][] = -$this->id;

View File

@@ -9,11 +9,11 @@ if (!defined('AOWOW_REVISION'))
// class ArenaTeamList extends BaseType // class ArenaTeamList extends BaseType
class ProfileList extends BaseType class ProfileList extends BaseType
{ {
public static $type = 0; // profiles dont actually have one public static $type = 0; // profiles dont actually have one
public static $brickFile = 'profile'; public static $brickFile = 'profile';
protected $queryBase = ''; // SELECT p.*, p.id AS ARRAY_KEY FROM ?_profiles p'; protected $queryBase = ''; // SELECT p.*, p.id AS ARRAY_KEY FROM ?_profiles p';
protected $queryOpts = array( protected $queryOpts = array(
'p' => [['pa', 'pg']], 'p' => [['pa', 'pg']],
'pam' => [['?_profiles_arenateam_member pam ON pam.memberId = p.id', true], 's' => ', pam.status'], 'pam' => [['?_profiles_arenateam_member pam ON pam.memberId = p.id', true], 's' => ', pam.status'],
'pa' => ['?_profiles_arenateam pa ON pa.id = pam.teamId', 's' => ', pa.mode, pa.name'], 'pa' => ['?_profiles_arenateam pa ON pa.id = pam.teamId', 's' => ', pa.mode, pa.name'],
@@ -149,9 +149,6 @@ class ProfileList extends BaseType
if (!$this->curTpl) if (!$this->curTpl)
return []; return [];
if (isset($this->tooltips[$this->id]))
return $this->tooltips[$this->id];
$x = '<table>'; $x = '<table>';
$x .= '<tr><td><b class="q">'.$this->getField('name').'</b></td></tr>'; $x .= '<tr><td><b class="q">'.$this->getField('name').'</b></td></tr>';
if ($g = $this->getField('name')) if ($g = $this->getField('name'))
@@ -161,9 +158,7 @@ class ProfileList extends BaseType
$x .= '<tr><td>'.Lang::$game['level'].' '.$this->getField('level').' '.Lang::$game['ra'][$this->curTpl['race']].' '.Lang::$game['cl'][$this->curTpl['classs']].'</td></tr>'; $x .= '<tr><td>'.Lang::$game['level'].' '.$this->getField('level').' '.Lang::$game['ra'][$this->curTpl['race']].' '.Lang::$game['cl'][$this->curTpl['classs']].'</td></tr>';
$x .= '</table>'; $x .= '</table>';
$this->tooltips[$this->id] = $x; return $x;
return $this->tooltips[$this->id];
} }
public function getJSGlobals($addMask = 0) {} public function getJSGlobals($addMask = 0) {}

View File

@@ -273,9 +273,6 @@ class QuestList extends BaseType
if (!$this->curTpl) if (!$this->curTpl)
return null; return null;
if (isset($this->tooltips[$this->id]))
return $this->tooltips[$this->id];
$title = Util::jsEscape($this->getField('name', true)); $title = Util::jsEscape($this->getField('name', true));
$level = $this->curTpl['level']; $level = $this->curTpl['level'];
if ($level < 0) if ($level < 0)
@@ -339,8 +336,6 @@ class QuestList extends BaseType
$x .= '</td></tr></table>'; $x .= '</td></tr></table>';
$this->tooltips[$this->id] = $x;
return $x; return $x;
} }

View File

@@ -8,8 +8,6 @@ class SpellList extends BaseType
{ {
use listviewHelper; use listviewHelper;
public $tooltips = [];
public $buffs = [];
public $ranks = []; public $ranks = [];
public $relItems = null; public $relItems = null;
public $sources = []; public $sources = [];
@@ -1438,9 +1436,6 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
if (!$this->curTpl) if (!$this->curTpl)
return array(); return array();
if (isset($this->buffs[$this->id]))
return $this->buffs[$this->id];
// doesn't have a buff // doesn't have a buff
if (!$this->getField('buff', true)) if (!$this->getField('buff', true))
return array(); return array();
@@ -1473,9 +1468,7 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
// scaling information - spellId:min:max:curr // scaling information - spellId:min:max:curr
$x .= '<!--?'.$this->id.':1:'.($scaling ? MAX_LEVEL : 1).':'.$level.'-->'; $x .= '<!--?'.$this->id.':1:'.($scaling ? MAX_LEVEL : 1).':'.$level.'-->';
$this->buffs[$this->id] = array($x, $btt[1]); return array($x, $btt[1]);
return $this->buffs[$this->id];
} }
public function renderTooltip($level = MAX_LEVEL, $interactive = false) public function renderTooltip($level = MAX_LEVEL, $interactive = false)
@@ -1483,9 +1476,6 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
if (!$this->curTpl) if (!$this->curTpl)
return array(); return array();
if (isset($this->tooltips[$this->id]))
return $this->tooltips[$this->id];
$this->interactive = $interactive; $this->interactive = $interactive;
// fetch needed texts // fetch needed texts
@@ -1627,9 +1617,7 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
// scaling information - spellId:min:max:curr // scaling information - spellId:min:max:curr
$x .= '<!--?'.$this->id.':1:'.($scaling ? MAX_LEVEL : 1).':'.$level.'-->'; $x .= '<!--?'.$this->id.':1:'.($scaling ? MAX_LEVEL : 1).':'.$level.'-->';
$this->tooltips[$this->id] = array($x, $desc ? $desc[1] : null); return array($x, $desc ? $desc[1] : null);
return $this->tooltips[$this->id];
} }
public function getTalentHeadForCurrent() public function getTalentHeadForCurrent()

View File

@@ -83,7 +83,7 @@ class User
self::setLocale(intVal($query['locale'])); // reset, if changed self::setLocale(intVal($query['locale'])); // reset, if changed
// stuff, that update on daily basis goes here (if you keep you session alive indefinitly, the signin-handler doesn't do very much) // stuff, that updates on a daily basis goes here (if you keep you session alive indefinitly, the signin-handler doesn't do very much)
// - conscutive visits // - conscutive visits
// - votes per day // - votes per day
// - reputation for daily visit // - reputation for daily visit
@@ -228,7 +228,7 @@ class User
if (!DB::isConnectable(DB_AUTH)) if (!DB::isConnectable(DB_AUTH))
return AUTH_INTERNAL_ERR; return AUTH_INTERNAL_ERR;
$wow = DB::Auth()->selectRow('SELECT a.id, a.sha_pass_hash, ab.active AS hasBan FROM account a LEFT JOIN account_banned ab ON ab.id = a.id WHERE username = ? AND ORDER BY ab.active DESC LIMIT 1', $name); $wow = DB::Auth()->selectRow('SELECT a.id, a.sha_pass_hash, ab.active AS hasBan FROM account a LEFT JOIN account_banned ab ON ab.id = a.id AND active <> 0 WHERE username = ? DESC LIMIT 1', $name);
if (!$wow) if (!$wow)
return AUTH_WRONGUSER; return AUTH_WRONGUSER;
@@ -493,23 +493,20 @@ class User
public static function getCharacters() public static function getCharacters()
{ {
// todo: do after profiler
@include('datasets/ProfilerExampleChar');
// existing chars on realm(s) // existing chars on realm(s)
$characters = array( $characters = array(
array( // array(
'id' => $character['id'], // 'id' => 22,
'name' => $character['name'], // 'name' => 'Example Char',
'realmname' => $character['realm'][1], // 'realmname' => 'Example Realm',
'region' => $character['region'][0], // 'region' => 'eu',
'realm' => $character['realm'][0], // 'realm' => 'example-realm',
'race' => $character['race'], // 'race' => 6,
'classs' => $character['classs'], // 'classs' => 11,
'level' => $character['level'], // 'level' => 80,
'gender' => $character['gender'], // 'gender' => 1,
'pinned' => $character['pinned'] // 'pinned' => 1
) // )
); );
return $characters; return $characters;
@@ -517,11 +514,10 @@ class User
public static function getProfiles() public static function getProfiles()
{ {
// todo => do after profiler
// chars build in profiler // chars build in profiler
$profiles = array( $profiles = array(
array('id' => 21, 'name' => 'Example Profile 1', 'race' => 4, 'classs' => 5, 'level' => 72, 'gender' => 1, 'icon' => 'inv_axe_04'), // array('id' => 21, 'name' => 'Example Profile 1', 'race' => 4, 'classs' => 5, 'level' => 72, 'gender' => 1, 'icon' => 'inv_axe_04'),
array('id' => 23, 'name' => 'Example Profile 2', 'race' => 11, 'classs' => 3, 'level' => 17, 'gender' => 0) // array('id' => 23, 'name' => 'Example Profile 2', 'race' => 11, 'classs' => 3, 'level' => 17, 'gender' => 0)
); );
return $profiles; return $profiles;

View File

@@ -910,12 +910,11 @@ class ItemPage extends genericPage
if ($asError) if ($asError)
return '$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.', {})'; return '$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.', {})';
$this->subject->renderTooltip(false, 0, $this->enhancedTT);
$x = '$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.", {\n"; $x = '$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.", {\n";
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n"; $x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n";
$x .= "\tquality: ".$this->subject->getField('quality').",\n"; $x .= "\tquality: ".$this->subject->getField('quality').",\n";
$x .= "\ticon: '".urlencode($this->subject->getField('iconString'))."',\n"; $x .= "\ticon: '".urlencode($this->subject->getField('iconString'))."',\n";
$x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($this->subject->tooltip[$this->typeId])."'\n"; $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($this->subject->renderTooltip(false, 0, $this->enhancedTT))."'\n";
$x .= "});"; $x .= "});";
return $x; return $x;
@@ -967,7 +966,7 @@ class ItemPage extends genericPage
} }
$xml->addChild('json')->addCData(substr($json, 1)); $xml->addChild('json')->addCData(substr($json, 1));
// jsonEquip missing: avgbuyout, cooldown // jsonEquip missing: avgbuyout, cooldown, source, sourcemore
$json = ''; $json = '';
if ($_ = $this->subject->getField('sellPrice')) // sellprice if ($_ = $this->subject->getField('sellPrice')) // sellprice
$json .= ',"sellprice":'.$_; $json .= ',"sellprice":'.$_;

View File

@@ -1,53 +0,0 @@
<?php
/*
$clMasks = [];
$raMasks = [];
$tbl = DB::Aowow()->Select('SELECT * FROM dbc.CharBaseInfo');
foreach ($tbl as $data)
{
$cl = $data['class'];
$ra = $data['race'];
@$clMasks[$ra] |= (1 << ($cl - 1));
@$raMasks[$cl] |= (1 << ($ra - 1));
}
foreach ($clMasks as $ra => $msk)
DB::Aowow()->Query('UPDATE ?_races SET classmask = ?d WHERE Id = ?d', $msk, $ra);
foreach ($raMasks as $cl => $msk)
DB::Aowow()->Query('UPDATE ?_classes SET racemask = ?d WHERE Id = ?d', $msk, $cl);
DB::Aowow()->Query('UPDATE ?_races SET side = side + 1');
DB::Aowow()->Query('UPDATE ?_races SET side = 0 WHERE side = 3');
*/
// manually add infos about races
// leader, faction, startArea
$info = array(
null,
[29611, 72, 12],
[39605, 76, 14],
[2784, 47, 1],
[7999, 96, 141],
[10181, 68, 85],
[36648, 81, 215],
[7937, 54, 1],
[10540, 530, 14],
null,
[16802, 911, 3430],
[17468, 930, 3524]
);
foreach ($info as $id => $data)
if ($data)
DB::Aowow()->query(
'UPDATE ?_races SET leader = ?d, factionId = ?d, startAreaId = ?d WHERE Id = ?d',
$data[0],
$data[1],
$data[2],
$id
)
?>

View File

@@ -63,15 +63,22 @@ if (!defined('AOWOW_REVISION'))
if (!is_dir('datasets\\'.$dir)) if (!is_dir('datasets\\'.$dir))
mkdir('datasets\\'.$dir, 0755, true); mkdir('datasets\\'.$dir, 0755, true);
$enchIds = [];
foreach ($enchantSpells->iterate() as $__)
$enchIds[] = $enchantSpells->getField('effect1MiscValue');
$enchMisc = [];
$enchJSON = Util::parseItemEnchantment($enchIds, false, $enchMisc);
echo "script set up in ".Util::execTime()."<br>\n"; echo "script set up in ".Util::execTime()."<br>\n";
foreach ($locales as $lId) foreach ($locales as $lId)
{ {
set_time_limit(180); set_time_limit(180);
User::useLocale($lId); User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$enchantsOut = []; $enchantsOut = [];
foreach ($enchantSpells->iterate() as $__) foreach ($enchantSpells->iterate() as $__)
{ {
// slots have to be recalculated // slots have to be recalculated
@@ -101,7 +108,6 @@ if (!defined('AOWOW_REVISION'))
} }
$eId = $enchantSpells->getField('effect1MiscValue'); $eId = $enchantSpells->getField('effect1MiscValue');
$jsonequip = Util::parseItemEnchantment($eId, false, $misc);
// defaults // defaults
$ench = array( $ench = array(
@@ -111,20 +117,20 @@ if (!defined('AOWOW_REVISION'))
'source' => [], // <0: item; >0:spell 'source' => [], // <0: item; >0:spell
'skill' => -1, // modified if skill 'skill' => -1, // modified if skill
'slots' => [], // determined per spell but set per item 'slots' => [], // determined per spell but set per item
'enchantment' => $misc['name'], 'enchantment' => Util::localizedString($enchMisc[$eId]['text'], 'text'),
'jsonequip' => $jsonequip, 'jsonequip' => @$enchJSON[$eId] ?: [],
'temp' => 0, // always 0 'temp' => 0, // always 0
'classes' => 0, // modified by item 'classes' => 0, // modified by item
); );
if (isset($misc['reqskill'])) if (isset($enchMisc[$eId]['reqskill']))
$ench['jsonequip']['reqskill'] = $misc['reqskill']; $ench['jsonequip']['reqskill'] = $enchMisc[$eId]['reqskill'];
if (isset($misc['reqskillrank'])) if (isset($enchMisc[$eId]['reqskillrank']))
$ench['jsonequip']['reqskill'] = $misc['reqskillrank']; $ench['jsonequip']['reqskill'] = $enchMisc[$eId]['reqskillrank'];
if (isset($misc['requiredLevel'])) if (isset($enchMisc[$eId]['requiredLevel']))
$ench['jsonequip']['requiredLevel'] = $misc['requiredLevel']; $ench['jsonequip']['requiredLevel'] = $enchMisc[$eId]['requiredLevel'];
// check if the spell has an entry in skill_line_ability -> Source:Profession // check if the spell has an entry in skill_line_ability -> Source:Profession
if ($skill = DB::Aowow()->SelectCell('SELECT skillLineId FROM dbc.skilllineability WHERE spellId = ?d', $enchantSpells->id)) if ($skill = DB::Aowow()->SelectCell('SELECT skillLineId FROM dbc.skilllineability WHERE spellId = ?d', $enchantSpells->id))
@@ -196,17 +202,15 @@ if (!defined('AOWOW_REVISION'))
} }
// walk over each entry and strip single-item arrays // walk over each entry and strip single-item arrays
foreach ($enchantsOut as $eId => $ench) foreach ($enchantsOut as &$ench)
{ {
foreach ($ench as $k => $v) foreach ($ench as $k => $v)
if (is_array($v) && count($v) == 1 && $k != 'jsonequip') if (is_array($v) && count($v) == 1 && $k != 'jsonequip')
$enchantsOut[$eId][$k] = $v[0]; $ench[$k] = $v[0];
} }
ksort($enchantsOut);
$toFile = "var g_enchants = "; $toFile = "var g_enchants = ";
$toFile .= json_encode($enchantsOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); $toFile .= json_encode($enchantsOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$toFile .= ";"; $toFile .= ";";
$file = 'datasets\\'.User::$localeString.'\\enchants'; $file = 'datasets\\'.User::$localeString.'\\enchants';
@@ -219,9 +223,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done"; echo "<br>\nall done";
User::useLocale(LOCALE_EN); Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics(); $stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?> ?>

View File

@@ -26,22 +26,20 @@ if (!defined('AOWOW_REVISION'))
$gemQuery = " $gemQuery = "
SELECT SELECT
it.entry as itemId, it.entry AS itemId,
it.name, it.name,
li.*, li.*,
IF (it.entry < 36000 OR it.ItemLevel < 70, 1 , 2) AS expansion, IF (it.entry < 36000 OR it.ItemLevel < 70, 1 , 2) AS expansion,
(it.Quality) AS quality, it.Quality AS quality,
i.inventoryicon1 as icon, i.inventoryicon1 AS icon,
ie.*, gp.spellItemEnchantmentId AS enchId,
gp.colorMask as colors gp.colorMask AS colors
FROM FROM
item_template it item_template it
LEFT JOIN LEFT JOIN
locales_item li ON li.entry = it.entry locales_item li ON li.entry = it.entry
JOIN JOIN
dbc.gemProperties gp ON gp.Id = it.GemProperties dbc.gemproperties gp ON gp.Id = it.GemProperties
JOIN
?_itemEnchantment ie ON gp.spellItemEnchantmentId = ie.Id
JOIN JOIN
dbc.itemdisplayinfo i ON i.Id = it.displayid dbc.itemdisplayinfo i ON i.Id = it.displayid
WHERE WHERE
@@ -51,41 +49,44 @@ if (!defined('AOWOW_REVISION'))
; ;
"; ";
$gems = Db::Aowow()->Select($gemQuery); $gems = DB::Aowow()->Select($gemQuery);
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU]; $locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
$jsonGems = [];
// check directory-structure // check directory-structure
foreach (Util::$localeStrings as $dir) foreach (Util::$localeStrings as $dir)
if (!is_dir('datasets\\'.$dir)) if (!is_dir('datasets\\'.$dir))
mkdir('datasets\\'.$dir, 0755, true); mkdir('datasets\\'.$dir, 0755, true);
$enchIds = [];
foreach ($gems as $pop)
$enchIds[] = $pop['enchId'];
$enchMisc = [];
$enchJSON = Util::parseItemEnchantment($enchIds, false, $enchMisc);
echo "script set up in ".Util::execTime()."<br>\n"; echo "script set up in ".Util::execTime()."<br>\n";
foreach ($locales as $lId) foreach ($locales as $lId)
{ {
User::useLocale($lId); User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$gemsOut = []; $gemsOut = [];
foreach ($gems as $pop) foreach ($gems as $pop)
{ {
// costy and locale-independant -> cache
if (!isset($jsonGems[$pop['itemId']]))
$jsonGems[$pop['itemId']] = Util::parseItemEnchantment($pop);
$gemsOut[$pop['itemId']] = array( $gemsOut[$pop['itemId']] = array(
'name' => Util::localizedString($pop, 'name'), 'name' => Util::localizedString($pop, 'name'),
'quality' => $pop['quality'], 'quality' => $pop['quality'],
'icon' => strToLower($pop['icon']), 'icon' => strToLower($pop['icon']),
'enchantment' => Util::localizedString($pop, 'text'), 'enchantment' => Util::localizedString(@$enchMisc[$pop['enchId']]['text'] ?: [], 'text'),
'jsonequip' => $jsonGems[$pop['itemId']], 'jsonequip' => @$enchJSON[$pop['enchId']] ?: [],
'colors' => $pop['colors'], 'colors' => $pop['colors'],
'expansion' => $pop['expansion'] 'expansion' => $pop['expansion']
); );
} }
$toFile = "var g_gems = "; $toFile = "var g_gems = ";
$toFile .= json_encode($gemsOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); $toFile .= json_encode($gemsOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$toFile .= ";"; $toFile .= ";";
$file = 'datasets\\'.User::$localeString.'\\gems'; $file = 'datasets\\'.User::$localeString.'\\gems';
@@ -98,9 +99,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done"; echo "<br>\nall done";
User::useLocale(LOCALE_EN); Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics(); $stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?> ?>

View File

@@ -22,38 +22,31 @@ if (!defined('AOWOW_REVISION'))
$queryGlyphs = ' $queryGlyphs = '
SELECT SELECT
i.entry as itemId, i.id AS itemId,
i.name, i.*,
li.*, IF (g.typeFlags & 0x1, 2, 1) AS type,
IF (g.typeFlags & 0x1, 2, 1) as type, i.subclass AS classs,
i.subclass as classs, i.requiredLevel AS level,
i.requiredLevel as level, s1.Id AS glyphSpell,
s1.Id as glyphSpell, s1.iconStringAlt AS icon,
s1.iconStringAlt as icon, s1.skillLine1 AS skillId,
s1.skillLine1 as skillId, s2.Id AS glyphEffect,
s2.Id as glyphEffect, s2.Id AS ARRAY_KEY
s2.Id as ARRAY_KEY
FROM FROM
item_template i ?_items i
LEFT JOIN JOIN
locales_item li ON ?_spell s1 ON s1.Id = i.spellid1
i.entry = li.entry JOIN
LEFT JOIN ?_glyphproperties g ON g.Id = s1.effect1MiscValue
?_spell s1 ON JOIN
s1.Id = i.spellid_1 ?_spell s2 ON s2.Id = g.spellId
LEFT JOIN
?_glyphproperties g ON
g.Id = s1.effect1MiscValue
LEFT JOIN
?_spell s2 ON
s2.Id = g.spellId
WHERE WHERE
i.class = 16 i.classBak = 16
; ;
'; ';
$glyphList = DB::Aowow()->Select($queryGlyphs); $glyphList = DB::Aowow()->Select($queryGlyphs);
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU]; $locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
// check directory-structure // check directory-structure
foreach (Util::$localeStrings as $dir) foreach (Util::$localeStrings as $dir)
@@ -62,11 +55,12 @@ if (!defined('AOWOW_REVISION'))
echo "script set up in ".Util::execTime()."<br>\n"; echo "script set up in ".Util::execTime()."<br>\n";
$glyphSpells = new SpellList(array(['s.id', array_keys($glyphList)], 0)); $glyphSpells = new SpellList(array(['s.id', array_keys($glyphList)], CFG_SQL_LIMIT_NONE));
foreach ($locales as $lId) foreach ($locales as $lId)
{ {
User::useLocale($lId); User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$glyphsOut = []; $glyphsOut = [];
foreach ($glyphSpells->iterate() as $__) foreach ($glyphSpells->iterate() as $__)
@@ -104,9 +98,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done"; echo "<br>\nall done";
User::useLocale(LOCALE_EN); Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics(); $stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?> ?>

View File

@@ -4,7 +4,7 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
// Create 'itemsets'-file for available locales (and should probably order the itemests_dbc-table too (see below)) // Create 'itemsets'-file for available locales
// this script requires the following dbc-files to be parsed and available // this script requires the following dbc-files to be parsed and available
// GlyphProperties, Spells, SkillLineAbility // GlyphProperties, Spells, SkillLineAbility
@@ -29,32 +29,6 @@ if (!defined('AOWOW_REVISION'))
}, },
*/ */
/* Todo:
well .. strictly spoken this script is bogus. All data has to be assembled beforehand either by hand or by querying wowhead
we would need this script to prevent this type-fest and do it propperly ourselves.. *dang*
probably like this:
virtualId = 0
get itemsetIds ordered ascending
foreach itemsetId
lookup pieces
sort pieces by slot
if slots conflict
group items by ItemLevel ordered ascending
assign: first group => regularId
assign: other groups => --virtualId
end if
end foreach
this will probably screw the order of your set-pieces and will not result in the same virtualIds like wowhead, but
they are years beyond our content anyway, so what gives...
lets assume, you've done something like that, so ...
... onwards!
*/
$setList = DB::Aowow()->Select('SELECT * FROM ?_itemset ORDER BY refSetId DESC'); $setList = DB::Aowow()->Select('SELECT * FROM ?_itemset ORDER BY refSetId DESC');
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU]; $locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
$jsonBonus = []; $jsonBonus = [];
@@ -69,11 +43,13 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $lId) foreach ($locales as $lId)
{ {
User::useLocale($lId); User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$itemsetOut = []; $itemsetOut = [];
foreach ($setList as $set) foreach ($setList as $set)
{ {
set_time_limit(15);
$setOut = array( $setOut = array(
'id' => $set['id'], 'id' => $set['id'],
'name' => (7 - $set['quality']).Util::jsEscape(Util::localizedString($set, 'name')), 'name' => (7 - $set['quality']).Util::jsEscape(Util::localizedString($set, 'name')),
@@ -112,18 +88,13 @@ if (!defined('AOWOW_REVISION'))
// costy and locale-independant -> cache // costy and locale-independant -> cache
if (!isset($jsonBonus[$set['spell'.$i]])) if (!isset($jsonBonus[$set['spell'.$i]]))
{ $jsonBonus[$set['spell'.$i]] = (new SpellList(array(['s.id', (int)$set['spell'.$i]])))->getStatGain()[$set['spell'.$i]];
$bSpell = new SpellList(array(['s.id', $set['spell'.$i]]));
$jsonBonus[$set['spell'.$i]] = $bSpell->getStatGain()[$set['spell'.$i]];
}
if (isset($setOut['setbonus'][$set['bonus'.$i]])) if (!isset($setOut['setbonus'][$set['bonus'.$i]]))
{ $setOut['setbonus'][$set['bonus'.$i]] = $jsonBonus[$set['spell'.$i]];
else
foreach ($jsonBonus[$set['spell'.$i]] as $k => $v) foreach ($jsonBonus[$set['spell'.$i]] as $k => $v)
@$setOut['setbonus'][$set['bonus'.$i]][$k] += $v; @$setOut['setbonus'][$set['bonus'.$i]][$k] += $v;
}
else
$setOut['setbonus'][$set['bonus'.$i]] = $jsonBonus[$set['spell'.$i]];
} }
foreach ($setOut['setbonus'] as $k => $v) foreach ($setOut['setbonus'] as $k => $v)
@@ -150,7 +121,7 @@ if (!defined('AOWOW_REVISION'))
} }
$toFile = "var g_itemsets = "; $toFile = "var g_itemsets = ";
$toFile .= json_encode($itemsetOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); $toFile .= json_encode($itemsetOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$toFile .= ";"; $toFile .= ";";
$file = 'datasets\\'.User::$localeString.'\\itemsets'; $file = 'datasets\\'.User::$localeString.'\\itemsets';
@@ -163,9 +134,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done"; echo "<br>\nall done";
User::useLocale(LOCALE_EN); Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics(); $stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?> ?>

View File

@@ -33,28 +33,28 @@ if (!defined('AOWOW_REVISION'))
$petQuery = ' $petQuery = '
SELECT SELECT
ct.entry as id, ct.entry AS id,
ct.name, ct.name,
lc.*, lc.*,
ct.minlevel, ct.minlevel,
ct.maxlevel, ct.maxlevel,
CONCAT("[", ft.A, ", ", ft.H, "]") as react, CONCAT("[", ft.A, ", ", ft.H, "]") AS react,
ct.rank as classification, ct.rank AS classification,
ct.family, ct.family,
ct.modelId1 as displayId, ct.modelId1 AS displayId,
cdi.skin1 as skin, cdi.skin1 AS skin,
SUBSTRING_INDEX(cf.iconFile, "\\\\", -1) as icon, SUBSTRING_INDEX(cf.iconFile, "\\\\", -1) AS icon,
cf.petTalentType as type cf.petTalentType AS type
FROM FROM
world.creature_template ct creature_template ct
JOIN JOIN
?_factiontemplate ft ON ?_factiontemplate ft ON
ft.Id = ct.faction -- no beast has different faction set for Horde ft.Id = ct.faction
JOIN JOIN
dbc.creaturefamily cf ON dbc.creaturefamily cf ON
cf.Id = ct.family cf.Id = ct.family
LEFT JOIN LEFT JOIN
world.locales_creature lc ON locales_creature lc ON
lc.entry = ct.entry lc.entry = ct.entry
JOIN JOIN
dbc.creaturedisplayinfo cdi ON dbc.creaturedisplayinfo cdi ON
@@ -68,9 +68,9 @@ if (!defined('AOWOW_REVISION'))
$queryZones = ' $queryZones = '
SELECT DISTINCT SELECT DISTINCT
z.id AS location z.id
FROM FROM
world.creature c creature c
JOIN JOIN
?_zones z ON ?_zones z ON
z.xMin < c.position_x AND z.xMin < c.position_x AND
@@ -84,9 +84,9 @@ if (!defined('AOWOW_REVISION'))
$queryInstanceZone = ' $queryInstanceZone = '
SELECT DISTINCT SELECT DISTINCT
z.id AS location z.id
FROM FROM
world.creature c, creature c,
?_zones z ?_zones z
WHERE WHERE
z.mapId = c.map AND z.mapId = c.map AND
@@ -107,9 +107,9 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $lId) foreach ($locales as $lId)
{ {
User::useLocale($lId); User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$petsOut = []; $petsOut = [];
foreach ($petList as $pet) foreach ($petList as $pet)
{ {
// get locations // get locations
@@ -124,7 +124,7 @@ if (!defined('AOWOW_REVISION'))
$locations[$pet['id']][] = $z; $locations[$pet['id']][] = $z;
} }
$pet = array( $petsOut[$pet['id']] = array(
'id' => $pet['id'], 'id' => $pet['id'],
'name' => Util::localizedString($pet, 'name'), 'name' => Util::localizedString($pet, 'name'),
'minlevel' => $pet['minlevel'], 'minlevel' => $pet['minlevel'],
@@ -138,12 +138,10 @@ if (!defined('AOWOW_REVISION'))
'icon' => $pet['icon'], 'icon' => $pet['icon'],
'type' => $pet['type'] 'type' => $pet['type']
); );
$petsOut[$pet['id']] = $pet;
} }
$toFile = "var g_pets = "; $toFile = "var g_pets = ";
$toFile .= json_encode($petsOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); $toFile .= json_encode($petsOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$toFile .= ";"; $toFile .= ";";
$file = 'datasets\\'.User::$localeString.'\\pets'; $file = 'datasets\\'.User::$localeString.'\\pets';
@@ -156,9 +154,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done"; echo "<br>\nall done";
User::useLocale(LOCALE_EN); Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics(); $stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?> ?>

View File

@@ -40,18 +40,21 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l) foreach ($locales as $l)
{ {
set_time_limit(20);
User::useLocale($l); User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-quests', "w"); $handle = fOpen('datasets\\'.User::$localeString.'\\p-quests', "w");
if (!$handle) if (!$handle)
die('could not create quests file '.$l); die('could not create quests file '.$l);
$buff = "var _ = g_gatheredcurrencies;\n"; $buff = "var _ = g_gatheredcurrencies;\n";
foreach($relCurr->getListviewData() as $id => $data) foreach($relCurr->getListviewData() as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n"; $buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
$buff .= "\n\nvar _ = g_quests;\n"; $buff .= "\n\nvar _ = g_quests;\n";
foreach($questz->getListviewData() as $id => $data) foreach($questz->getListviewData() as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n"; $buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
$buff .= "\ng_quest_catorder = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n"; $buff .= "\ng_quest_catorder = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n";
@@ -68,6 +71,8 @@ if (!defined('AOWOW_REVISION'))
/* Achievements */ /* Achievements */
/****************/ /****************/
{ {
set_time_limit(10);
$cnd = array( $cnd = array(
CFG_SQL_LIMIT_NONE, CFG_SQL_LIMIT_NONE,
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0],
@@ -77,6 +82,7 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l) foreach ($locales as $l)
{ {
User::useLocale($l); User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-achievements', "w"); $handle = fOpen('datasets\\'.User::$localeString.'\\p-achievements', "w");
if (!$handle) if (!$handle)
die('could not create achievements file '.$l); die('could not create achievements file '.$l);
@@ -86,7 +92,7 @@ if (!defined('AOWOW_REVISION'))
foreach ($achievez->getListviewData(ACHIEVEMENTINFO_PROFILE) as $id => $data) foreach ($achievez->getListviewData(ACHIEVEMENTINFO_PROFILE) as $id => $data)
{ {
$sumPoints += $data['points']; $sumPoints += $data['points'];
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n"; $buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
} }
// categories to sort by // categories to sort by
@@ -107,6 +113,8 @@ if (!defined('AOWOW_REVISION'))
/* Titles */ /* Titles */
/**********/ /**********/
{ {
set_time_limit(10);
$cnd = array( $cnd = array(
CFG_SQL_LIMIT_NONE, CFG_SQL_LIMIT_NONE,
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0],
@@ -117,6 +125,7 @@ if (!defined('AOWOW_REVISION'))
foreach ([0, 1] as $g) // gender foreach ([0, 1] as $g) // gender
{ {
User::useLocale($l); User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-titles-'.$g, "w"); $handle = fOpen('datasets\\'.User::$localeString.'\\p-titles-'.$g, "w");
if (!$handle) if (!$handle)
die('could not create titles file '.$l.' '.$g); die('could not create titles file '.$l.' '.$g);
@@ -126,7 +135,7 @@ if (!defined('AOWOW_REVISION'))
{ {
$data['name'] = Util::localizedString($titlez->getEntry($id), $g ? 'female' : 'male'); $data['name'] = Util::localizedString($titlez->getEntry($id), $g ? 'female' : 'male');
unset($data['namefemale']); unset($data['namefemale']);
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n"; $buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
} }
fWrite($handle, $buff); fWrite($handle, $buff);
fClose($handle); fClose($handle);
@@ -142,6 +151,8 @@ if (!defined('AOWOW_REVISION'))
/* Mounts */ /* Mounts */
/**********/ /**********/
{ {
set_time_limit(10);
$cnd = array( $cnd = array(
CFG_SQL_LIMIT_NONE, CFG_SQL_LIMIT_NONE,
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0],
@@ -151,13 +162,18 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l) foreach ($locales as $l)
{ {
User::useLocale($l); User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-mounts', "w"); $handle = fOpen('datasets\\'.User::$localeString.'\\p-mounts', "w");
if (!$handle) if (!$handle)
die('could not create mounts file '.$l); die('could not create mounts file '.$l);
$buff = "var _ = g_spells;\n"; $buff = "var _ = g_spells;\n";
foreach ($mountz->getListviewData(ITEMINFO_MODEL) as $id => $data) foreach ($mountz->getListviewData(ITEMINFO_MODEL) as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n"; {
$data['quality'] = $data['name'][0];
$data['name'] = substr($data['name'], 1);
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
}
fWrite($handle, $buff); fWrite($handle, $buff);
fClose($handle); fClose($handle);
@@ -172,6 +188,8 @@ if (!defined('AOWOW_REVISION'))
/* Companions */ /* Companions */
/**************/ /**************/
{ {
set_time_limit(10);
$cnd = array( $cnd = array(
CFG_SQL_LIMIT_NONE, CFG_SQL_LIMIT_NONE,
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0],
@@ -181,13 +199,18 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l) foreach ($locales as $l)
{ {
User::useLocale($l); User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-companions', "w"); $handle = fOpen('datasets\\'.User::$localeString.'\\p-companions', "w");
if (!$handle) if (!$handle)
die('could not create companions file '.$l); die('could not create companions file '.$l);
$buff = "var _ = g_spells;\n"; $buff = "var _ = g_spells;\n";
foreach ($companionz->getListviewData(ITEMINFO_MODEL) as $id => $data) foreach ($companionz->getListviewData(ITEMINFO_MODEL) as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n"; {
$data['quality'] = $data['name'][0];
$data['name'] = substr($data['name'], 1);
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
}
fWrite($handle, $buff); fWrite($handle, $buff);
fClose($handle); fClose($handle);
@@ -202,6 +225,8 @@ if (!defined('AOWOW_REVISION'))
/* Factions */ /* Factions */
/************/ /************/
{ {
set_time_limit(10);
// todo (med): exclude non-gaining reputation-header // todo (med): exclude non-gaining reputation-header
$cnd = array( $cnd = array(
CFG_SQL_LIMIT_NONE, CFG_SQL_LIMIT_NONE,
@@ -211,13 +236,14 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l) foreach ($locales as $l)
{ {
User::useLocale($l); User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-factions', "w"); $handle = fOpen('datasets\\'.User::$localeString.'\\p-factions', "w");
if (!$handle) if (!$handle)
die('could not create factions file '.$l); die('could not create factions file '.$l);
$buff = "var _ = g_factions;\n"; $buff = "var _ = g_factions;\n";
foreach ($factionz->getListviewData() as $id => $data) foreach ($factionz->getListviewData() as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n"; $buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
$buff .= "\ng_faction_order = [0, 469, 891, 1037, 1118, 67, 1052, 892, 936, 1117, 169, 980, 1097];\n"; $buff .= "\ng_faction_order = [0, 469, 891, 1037, 1118, 67, 1052, 892, 936, 1117, 169, 980, 1097];\n";
@@ -245,6 +271,8 @@ if (!defined('AOWOW_REVISION'))
); );
foreach ($skills as $s) foreach ($skills as $s)
{ {
set_time_limit(20);
$file = is_array($s) ? 'sec' : (string)$s; $file = is_array($s) ? 'sec' : (string)$s;
$cnd = array_merge($baseCnd, [['skillLine1', $s]]); $cnd = array_merge($baseCnd, [['skillLine1', $s]]);
$recipez = new SpellList($cnd); $recipez = new SpellList($cnd);
@@ -261,13 +289,11 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l) foreach ($locales as $l)
{ {
User::useLocale($l); User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$buff = ''; $buff = '';
foreach ($recipez->getListviewData() as $id => $data) foreach ($recipez->getListviewData() as $id => $data)
{ $buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
$data['name'] = $data['quality'].$data['name'];
unset($data['quality']);
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
}
if (!$buff) if (!$buff)
{ {
echo " - file: ".$file." has no content => skipping<br>\n"; echo " - file: ".$file." has no content => skipping<br>\n";
@@ -293,8 +319,10 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\n"; echo "<br>\n";
} }
User::useLocale(LOCALE_EN);
echo "<br>\nall done"; echo "<br>\nall done";
Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics(); $stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?> ?>

View File

@@ -86,7 +86,7 @@ if (!defined('AOWOW_REVISION'))
$offset = [20, 20, 20, 20, 20]; $offset = [20, 20, 20, 20, 20];
$rows = DB::Aowow()->select('SELECT pls.level AS ARRAY_KEY, str-?d, agi-?d, sta-?d, inte-?d, spi-?d, basehp, IF(basemana <> 0, basemana, 100), mlecrt.chance*100, splcrt.chance*100, mlecrt.chance*100 * ?f, baseHP5.ratio*1, extraHP5.ratio*1 ' . $rows = DB::Aowow()->select('SELECT pls.level AS ARRAY_KEY, str-?d, agi-?d, sta-?d, inte-?d, spi-?d, basehp, IF(basemana <> 0, basemana, 100), mlecrt.chance*100, splcrt.chance*100, mlecrt.chance*100 * ?f, baseHP5.ratio*1, extraHP5.ratio*1 ' .
'FROM world.player_levelstats pls JOIN world.player_classlevelstats pcls ON pls.level = pcls.level AND pls.class = pcls.class JOIN' . 'FROM player_levelstats pls JOIN player_classlevelstats pcls ON pls.level = pcls.level AND pls.class = pcls.class JOIN' .
' dbc.gtchancetomeleecrit mlecrt ON mlecrt.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' . ' dbc.gtchancetomeleecrit mlecrt ON mlecrt.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' .
' dbc.gtchancetospellcrit splcrt ON splcrt.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' . ' dbc.gtchancetospellcrit splcrt ON splcrt.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' .
' dbc.gtoctregenhp baseHP5 ON baseHP5.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' . ' dbc.gtoctregenhp baseHP5 ON baseHP5.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' .

View File

@@ -9,30 +9,16 @@ if (!defined('AOWOW_REVISION'))
// this script requires the following dbc-files to be parsed and available // this script requires the following dbc-files to be parsed and available
// Talent, TalentTab, Spell // Talent, TalentTab, Spell
$query = ' $query = 'SELECT s.iconString FROM ?_spell s JOIN dbc.talent t ON t.rank1 = s.Id JOIN dbc.talenttab tt ON tt.Id = t.tabId WHERE tt.?# = ?d AND tt.tabNumber = ?d ORDER BY t.row, t.column, t.petCategory1 ASC;';
SELECT
s.iconString
FROM
?_spell s
JOIN
dbc.talent t On
t.rank1 = s.Id
JOIN
dbc.talenttab tt ON
tt.Id = t.tabId
WHERE
tt.?# = ?d AND
tt.tabNumber = ?d
ORDER BY
t.row, t.column, t.petCategory1 ASC ;
';
$dims = 36; //v-pets $dims = 36; //v-pets
$filenames = ['icons', 'warrior', 'paladin', 'hunter', 'rogue', 'priest', 'deathknight', 'shaman', 'mage', 'warlock', null, 'druid']; $filenames = ['icons', 'warrior', 'paladin', 'hunter', 'rogue', 'priest', 'deathknight', 'shaman', 'mage', 'warlock', null, 'druid'];
// create directory if missing // create directory if missing
if (!is_dir('images\\talent\\classes\\icons')) if (!is_dir('static\\images\\wow\\talents\\icons'))
mkdir('images\\talent\\classes\\icons', 0755, true); mkdir('static\\images\\wow\\talents\\icons', 0755, true);
if (!is_dir('static\\images\\wow\\hunterpettalents'))
mkdir('static\\images\\wow\\hunterpettalents', 0755, true);
echo "script set up in ".Util::execTime()."<br>\n"; echo "script set up in ".Util::execTime()."<br>\n";
@@ -41,12 +27,14 @@ if (!defined('AOWOW_REVISION'))
if (!$v) if (!$v)
continue; continue;
set_time_limit(10);
for ($tree = 0; $tree < 3; $tree++) for ($tree = 0; $tree < 3; $tree++)
{ {
$what = $k ? 'classMask' : 'creatureFamilyMask'; $what = $k ? 'classMask' : 'creatureFamilyMask';
$set = $k ? 1 << ($k - 1) : 1 << $tree; $set = $k ? 1 << ($k - 1) : 1 << $tree;
$subset = $k ? $tree : 0; $subset = $k ? $tree : 0;
$path = $k ? 'classes\\icons' : 'pets'; $path = $k ? 'talents\\icons' : 'hunterpettalents';
$icons = DB::Aowow()->SelectCol($query, $what, $set, $subset); $icons = DB::Aowow()->SelectCol($query, $what, $set, $subset);
@@ -57,7 +45,7 @@ if (!defined('AOWOW_REVISION'))
for($i = 0; $i < count($icons); $i++) for($i = 0; $i < count($icons); $i++)
{ {
$im = @imagecreatefromjpeg('images\\icons\\medium\\'.$icons[$i].'.jpg'); $im = @imagecreatefromjpeg('static\\images\\wow\\icons\\medium\\'.$icons[$i].'.jpg');
if(!$im) if(!$im)
die('error: raw image '.$icons[$i]. ' not found'); die('error: raw image '.$icons[$i]. ' not found');
@@ -71,12 +59,12 @@ if (!defined('AOWOW_REVISION'))
for ($j = 0; $j < imagecolorstotal($im); $j++) for ($j = 0; $j < imagecolorstotal($im); $j++)
{ {
$color = imagecolorsforindex($im, $j); $color = imagecolorsforindex($im, $j);
$gray = round(0.299 * $color['red'] + 0.587 * $color['green'] + 0.114 * $color['blue']); $gray = round(0.299 * $color['red'] + 0.587 * $color['green'] + 0.114 * $color['blue']);
imagecolorset($im, $j, $gray, $gray, $gray); imagecolorset($im, $j, $gray, $gray, $gray);
} }
imagecopymerge($res, $im, $i * $dims, $dims, 0, 0, imageSX($im), imageSY($im), 100); imagecopymerge($res, $im, $i * $dims, $dims, 0, 0, imageSX($im), imageSY($im), 100);
if (!@imagejpeg($res, 'images\\talent\\'.$path.'\\'.$v.'_'.($tree + 1).'.jpg')) if (@!imagejpeg($res, 'static\\images\\wow\\'.$path.'\\'.$v.'_'.($tree + 1).'.jpg'))
die('error: '.$v.'_'.($tree + 1).'.jpg could not be written!'); die('error: '.$v.'_'.($tree + 1).'.jpg could not be written!');
} }
} }
@@ -86,8 +74,6 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done"; echo "<br>\nall done";
User::useLocale(LOCALE_EN);
$stats = DB::Aowow()->getStatistics(); $stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);

View File

@@ -25,9 +25,8 @@ if (!defined('AOWOW_REVISION'))
// t - array of talent-objects // t - array of talent-objects
// f - array:int [pets only] creatureFamilies in that category // f - array:int [pets only] creatureFamilies in that category
function buildTree($class) $buildTree = function ($class) use (&$petFamIcons, &$tSpells)
{ {
global $petFamIcons; // h8!
$petCategories = []; $petCategories = [];
$mask = $class ? 1 << ($class - 1) : 0; $mask = $class ? 1 << ($class - 1) : 0;
@@ -116,12 +115,14 @@ if (!defined('AOWOW_REVISION'))
for ($k = 0; $k <= ($m - 1); $k++) for ($k = 0; $k <= ($m - 1); $k++)
{ {
$tSpell = new SpellList(array(['s.id', (int)$talents[$j]['rank'.($k + 1)]])); if (!$tSpells->getEntry($talents[$j]['rank'.($k + 1)]))
$d[] = $tSpell->parseText()[0]; continue;
$d[] = $tSpells->parseText()[0];
$s[] = $talents[$j]['rank'.($k + 1)]; $s[] = $talents[$j]['rank'.($k + 1)];
if ($talents[$j]['talentSpell']) if ($talents[$j]['talentSpell'])
$t[] = $tSpell->getTalentHeadForCurrent(); $t[] = $tSpells->getTalentHeadForCurrent();
} }
if ($talents[$j]['reqTalent']) if ($talents[$j]['reqTalent'])
@@ -130,7 +131,7 @@ if (!defined('AOWOW_REVISION'))
if (!isset($tNums[$talents[$j]['reqTalent']])) if (!isset($tNums[$talents[$j]['reqTalent']]))
$depLinks[$talents[$j]['reqTalent']] = $j; $depLinks[$talents[$j]['reqTalent']] = $j;
$r = [$tNums[$talents[$j]['reqTalent']], $talents[$j]['reqRank'] + 1]; $r = @[$tNums[$talents[$j]['reqTalent']], $talents[$j]['reqRank'] + 1];
} }
$result[$l]['t'][$j] = array( $result[$l]['t'][$j] = array(
@@ -169,7 +170,7 @@ if (!defined('AOWOW_REVISION'))
} }
return $result; return $result;
} };
$classes = [CLASS_WARRIOR, CLASS_PALADIN, CLASS_HUNTER, CLASS_ROGUE, CLASS_PRIEST, CLASS_DEATHKNIGHT, CLASS_SHAMAN, CLASS_MAGE, CLASS_WARLOCK, CLASS_DRUID]; $classes = [CLASS_WARRIOR, CLASS_PALADIN, CLASS_HUNTER, CLASS_ROGUE, CLASS_PRIEST, CLASS_DEATHKNIGHT, CLASS_SHAMAN, CLASS_MAGE, CLASS_WARLOCK, CLASS_DRUID];
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU]; $locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
@@ -182,11 +183,15 @@ if (!defined('AOWOW_REVISION'))
if (!is_dir('datasets\\'.$dir)) if (!is_dir('datasets\\'.$dir))
mkdir('datasets\\'.$dir, 0755, true); mkdir('datasets\\'.$dir, 0755, true);
$tSpellIds = DB::Aowow()->selectCol('SELECT rank1 FROM dbc.talent UNION SELECT rank2 FROM dbc.talent UNION SELECT rank3 FROM dbc.talent UNION SELECT rank4 FROM dbc.talent UNION SELECT rank5 FROM dbc.talent');
$tSpells = new SpellList(array(['s.id', $tSpellIds], CFG_SQL_LIMIT_NONE));
echo "script set up in ".Util::execTime()."<br>\n"; echo "script set up in ".Util::execTime()."<br>\n";
foreach ($locales as $lId) foreach ($locales as $lId)
{ {
User::useLocale($lId); User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
// TalentCalc // TalentCalc
foreach ($classes as $cMask) foreach ($classes as $cMask)
@@ -195,7 +200,7 @@ if (!defined('AOWOW_REVISION'))
$cId = log($cMask, 2) + 1; $cId = log($cMask, 2) + 1;
$file = 'datasets\\'.User::$localeString.'\\talents-'.$cId; $file = 'datasets\\'.User::$localeString.'\\talents-'.$cId;
$toFile = '$WowheadTalentCalculator.registerClass('.$cId.', '.json_encode(buildTree($cId), JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK).')'; $toFile = '$WowheadTalentCalculator.registerClass('.$cId.', '.json_encode($buildTree($cId), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).')';
$handle = fOpen($file, "w"); $handle = fOpen($file, "w");
fWrite($handle, $toFile); fWrite($handle, $toFile);
@@ -208,11 +213,11 @@ if (!defined('AOWOW_REVISION'))
if (empty($petIcons)) if (empty($petIcons))
{ {
$pets = DB::Aowow()->SelectCol('SELECT Id AS ARRAY_KEY, iconString FROM ?_pet'); $pets = DB::Aowow()->SelectCol('SELECT Id AS ARRAY_KEY, iconString FROM ?_pet');
$petIcons = json_encode($pets, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); $petIcons = json_encode($pets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
} }
$toFile = "var g_pet_icons = ".$petIcons."\n\n"; $toFile = "var g_pet_icons = ".$petIcons."\n\n";
$toFile .= 'var g_pet_talents = '.json_encode(buildTree(0), JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); $toFile .= 'var g_pet_talents = '.json_encode($buildTree(0), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$file = 'datasets\\'.User::$localeString.'\\pet-talents'; $file = 'datasets\\'.User::$localeString.'\\pet-talents';
$handle = fOpen($file, "w"); $handle = fOpen($file, "w");
@@ -224,9 +229,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done"; echo "<br>\nall done";
User::useLocale(LOCALE_EN); Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics(); $stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?> ?>

File diff suppressed because one or more lines are too long