mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Data
* move custom data from setup scripts to DB * move strings from DB to locale files * use common function to calculate coordinates of dungeon entrances instead of inline sql * fixed manual data zones and itemset * fixed typos across the board
This commit is contained in:
@@ -9,7 +9,7 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'achievement';
|
||||
|
||||
@@ -17,10 +17,6 @@ SqlGen::register(new class extends SetupScript
|
||||
protected $tblDependencyTC = ['dbc_achievement', 'disables'];
|
||||
protected $dbcSourceFiles = ['achievement_category', 'achievement', 'spellicon'];
|
||||
|
||||
private $customData = array(
|
||||
1956 => ['itemExtra' => 44738] // Higher Learning - item rewarded through gossip
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
/**************/
|
||||
|
||||
@@ -9,26 +9,12 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'classes';
|
||||
|
||||
protected $dbcSourceFiles = ['spell', 'charbaseinfo', 'skillraceclassinfo', 'skilllineability', 'chrclasses'];
|
||||
|
||||
// roles (1:heal; 2:mleDPS; 4:rngDPS; 8:tank)
|
||||
private $customData = array(
|
||||
1 => ['roles' => 0xA],
|
||||
2 => ['roles' => 0xB],
|
||||
3 => ['roles' => 0x4],
|
||||
4 => ['roles' => 0x2],
|
||||
5 => ['roles' => 0x5],
|
||||
6 => ['roles' => 0xA],
|
||||
7 => ['roles' => 0x7],
|
||||
8 => ['roles' => 0x4],
|
||||
9 => ['roles' => 0x4],
|
||||
11 => ['roles' => 0xF],
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
$classes = DB::Aowow()->select('SELECT *, id AS ARRAY_KEY FROM dbc_chrclasses');
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'currencies';
|
||||
|
||||
@@ -17,17 +17,6 @@ SqlGen::register(new class extends SetupScript
|
||||
protected $tblDependencyTC = ['item_template', 'item_template_locale'];
|
||||
protected $dbcSourceFiles = ['itemdisplayinfo', 'currencytypes'];
|
||||
|
||||
// hide test tokens and move them to unused
|
||||
private $customData = array(
|
||||
1 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||
2 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||
4 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||
22 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||
141 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||
103 => ['cap' => 10000], // Arena Points
|
||||
104 => ['cap' => 75000] // Honor Points
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
if (!$ids)
|
||||
|
||||
@@ -9,49 +9,12 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'factions';
|
||||
|
||||
protected $dbcSourceFiles = ['faction', 'factiontemplate'];
|
||||
|
||||
private $customData = array(
|
||||
47 => ['qmNpcIds' => '33310'],
|
||||
68 => ['qmNpcIds' => '33555'],
|
||||
69 => ['qmNpcIds' => '33653'],
|
||||
72 => ['qmNpcIds' => '33307'],
|
||||
76 => ['qmNpcIds' => '33553'],
|
||||
81 => ['qmNpcIds' => '33556'],
|
||||
922 => ['qmNpcIds' => '16528'],
|
||||
930 => ['qmNpcIds' => '33657'],
|
||||
932 => ['qmNpcIds' => '19321'],
|
||||
933 => ['qmNpcIds' => '20242 23007'],
|
||||
935 => ['qmNpcIds' => '21432'],
|
||||
941 => ['qmNpcIds' => '20241'],
|
||||
942 => ['qmNpcIds' => '17904'],
|
||||
946 => ['qmNpcIds' => '17657'],
|
||||
947 => ['qmNpcIds' => '17585'],
|
||||
970 => ['qmNpcIds' => '18382'],
|
||||
978 => ['qmNpcIds' => '20240'],
|
||||
989 => ['qmNpcIds' => '21643'],
|
||||
1011 => ['qmNpcIds' => '21655'],
|
||||
1012 => ['qmNpcIds' => '23159'],
|
||||
1037 => ['qmNpcIds' => '32773 32564'],
|
||||
1038 => ['qmNpcIds' => '23428'],
|
||||
1052 => ['qmNpcIds' => '32774 32565'],
|
||||
1073 => ['qmNpcIds' => '31916 32763'],
|
||||
1090 => ['qmNpcIds' => '32287'],
|
||||
1091 => ['qmNpcIds' => '32533'],
|
||||
1094 => ['qmNpcIds' => '34881'],
|
||||
1105 => ['qmNpcIds' => '31910'],
|
||||
1106 => ['qmNpcIds' => '30431'],
|
||||
1119 => ['qmNpcIds' => '32540'],
|
||||
1124 => ['qmNpcIds' => '34772'],
|
||||
1156 => ['qmNpcIds' => '37687'],
|
||||
1082 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
952 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
$factionQuery = '
|
||||
|
||||
@@ -10,41 +10,12 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'holidays';
|
||||
|
||||
protected $dbcSourceFiles = ['holidays', 'holidaydescriptions', 'holidaynames'];
|
||||
|
||||
private $customData = array(
|
||||
62 => ['iconString' => 'inv_misc_missilelarge_red' ],
|
||||
141 => ['iconString' => 'calendar_winterveilstart', 'achievementCatOrId' => 156 ],
|
||||
181 => ['iconString' => 'calendar_noblegardenstart', 'achievementCatOrId' => 159 ],
|
||||
201 => ['iconString' => 'calendar_childrensweekstart', 'achievementCatOrId' => 163 ],
|
||||
283 => ['iconString' => 'inv_jewelry_necklace_21' ],
|
||||
284 => ['iconString' => 'inv_misc_rune_07' ],
|
||||
285 => ['iconString' => 'inv_jewelry_amulet_07' ],
|
||||
301 => ['iconString' => 'calendar_fishingextravaganzastart' ],
|
||||
321 => ['iconString' => 'calendar_harvestfestivalstart' ],
|
||||
324 => ['iconString' => 'calendar_hallowsendstart', 'bossCreature' => 23682, 'achievementCatOrId' => 158 ],
|
||||
327 => ['iconString' => 'calendar_lunarfestivalstart', 'bossCreature' => 15467, 'achievementCatOrId' => 160 ],
|
||||
335 => ['iconString' => 'calendar_loveintheairstart' ],
|
||||
341 => ['iconString' => 'calendar_midsummerstart', 'bossCreature' => 25740, 'achievementCatOrId' => 161 ],
|
||||
353 => ['iconString' => 'spell_nature_eyeofthestorm' ],
|
||||
372 => ['iconString' => 'calendar_brewfeststart', 'bossCreature' => 23872, 'achievementCatOrId' => 162 ],
|
||||
374 => ['iconString' => 'calendar_darkmoonfaireelwynnstart' ],
|
||||
375 => ['iconString' => 'calendar_darkmoonfairemulgorestart' ],
|
||||
376 => ['iconString' => 'calendar_darkmoonfaireterokkarstart' ],
|
||||
398 => ['iconString' => 'calendar_piratesdaystart', 'achievementCatOrId' => -3457],
|
||||
400 => ['iconString' => 'achievement_bg_winsoa' ],
|
||||
404 => ['iconString' => 'calendar_harvestfestivalstart', 'achievementCatOrId' => 14981],
|
||||
406 => ['iconString' => 'achievement_boss_lichking' ],
|
||||
409 => ['iconString' => 'calendar_dayofthedeadstart', 'achievementCatOrId' => -3456],
|
||||
420 => ['iconString' => 'achievement_bg_winwsg' ],
|
||||
423 => ['iconString' => 'calendar_loveintheairstart', 'bossCreature' => 36296, 'achievementCatOrId' => 187 ],
|
||||
424 => ['iconString' => 'calendar_fishingextravaganzastart' ],
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
$query = '
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'items';
|
||||
|
||||
@@ -17,16 +17,6 @@ SqlGen::register(new class extends SetupScript
|
||||
protected $tblDependencyTC = ['item_template', 'item_template_locale', 'spell_group', 'game_event'];
|
||||
protected $dbcSourceFiles = ['gemproperties', 'itemdisplayinfo', 'spell', 'glyphproperties', 'durabilityquality', 'durabilitycosts'];
|
||||
|
||||
private $customData = array(
|
||||
33147 => ['class' => 9, 'subClass' => 8], // one stray enchanting recipe .. with a strange icon
|
||||
7948 => ['itemset' => 221], // v unsure if this should be fixed v
|
||||
7949 => ['itemset' => 221],
|
||||
7950 => ['itemset' => 221],
|
||||
7951 => ['itemset' => 221],
|
||||
7952 => ['itemset' => 221],
|
||||
7953 => ['itemset' => 221]
|
||||
);
|
||||
|
||||
private $skill2cat = array(
|
||||
773 => 11, // inscription
|
||||
356 => 9, // fishing
|
||||
|
||||
@@ -15,18 +15,12 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
|
||||
protected $command = 'itemset';
|
||||
|
||||
protected $tblDependencyAowow = ['spell'];
|
||||
protected $tblDependencyTC = ['item_template', 'game_event'];
|
||||
protected $dbcSourceFiles = ['itemset'];
|
||||
|
||||
private $customData = array(
|
||||
221 => ['item1' => 7948, 'item2' => 7949, 'item3' => 7950, 'item4' => 7951, 'item5' => 7952, 'item6' => 7953]
|
||||
);
|
||||
|
||||
private $setToHoliday = array (
|
||||
761 => 141, // Winterveil
|
||||
762 => 372, // Brewfest
|
||||
|
||||
@@ -9,27 +9,12 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'races';
|
||||
|
||||
protected $dbcSourceFiles = ['chrraces', 'charbaseinfo'];
|
||||
|
||||
private $customData = array(
|
||||
null,
|
||||
['leader' => 29611, 'factionId' => 72, 'startAreaId' => 12],
|
||||
['leader' => 4949, 'factionId' => 76, 'startAreaId' => 14],
|
||||
['leader' => 2784, 'factionId' => 47, 'startAreaId' => 1],
|
||||
['leader' => 7999, 'factionId' => 69, 'startAreaId' => 141],
|
||||
['leader' => 10181, 'factionId' => 68, 'startAreaId' => 85],
|
||||
['leader' => 3057, 'factionId' => 81, 'startAreaId' => 215],
|
||||
['leader' => 7937, 'factionId' => 54, 'startAreaId' => 1],
|
||||
['leader' => 10540, 'factionId' => 530, 'startAreaId' => 14],
|
||||
null,
|
||||
['leader' => 16802, 'factionId' => 911, 'startAreaId' => 3430],
|
||||
['leader' => 17468, 'factionId' => 930, 'startAreaId' => 3524]
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
/**********/
|
||||
|
||||
@@ -9,22 +9,12 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'shapeshiftforms';
|
||||
|
||||
protected $dbcSourceFiles = ['spellshapeshiftform'];
|
||||
|
||||
private $customData = array(
|
||||
1 => ['displayIdH' => 8571],
|
||||
15 => ['displayIdH' => 8571],
|
||||
5 => ['displayIdH' => 2289],
|
||||
8 => ['displayIdH' => 2289],
|
||||
14 => ['displayIdH' => 2289],
|
||||
27 => ['displayIdH' => 21244],
|
||||
29 => ['displayIdH' => 20872]
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
DB::Aowow()->query('
|
||||
|
||||
@@ -9,34 +9,13 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'skillline';
|
||||
|
||||
protected $tblDependencyAowow = ['icons'];
|
||||
protected $dbcSourceFiles = ['skillline', 'spell', 'skilllineability'];
|
||||
|
||||
private $customData = array(
|
||||
393 => ['professionMask' => 0x0000], // Skinning
|
||||
171 => ['professionMask' => 0x0001, 'recipeSubClass' => 6, 'specializations' => '28677 28675 28672'], // Alchemy
|
||||
164 => ['professionMask' => 0x0002, 'recipeSubClass' => 4, 'specializations' => '9788 9787 17041 17040 17039'], // Blacksmithing
|
||||
185 => ['professionMask' => 0x0004, 'recipeSubClass' => 5], // Cooking
|
||||
333 => ['professionMask' => 0x0008, 'recipeSubClass' => 8], // Enchanting
|
||||
202 => ['professionMask' => 0x0010, 'recipeSubClass' => 3, 'specializations' => '20219 20222'], // Engineering
|
||||
129 => ['professionMask' => 0x0020, 'recipeSubClass' => 7], // First Aid
|
||||
755 => ['professionMask' => 0x0040, 'recipeSubClass' => 10], // Jewelcrafting
|
||||
165 => ['professionMask' => 0x0080, 'recipeSubClass' => 1, 'specializations' => '10656 10658 10660'], // Leatherworking
|
||||
186 => ['professionMask' => 0x0100], // Mining
|
||||
197 => ['professionMask' => 0x0200, 'recipeSubClass' => 2, 'specializations' => '26798 26801 26797'], // Tailoring
|
||||
356 => ['professionMask' => 0x0400, 'recipeSubClass' => 9], // Fishing
|
||||
182 => ['professionMask' => 0x0800], // Herbalism
|
||||
773 => ['professionMask' => 0x1000, 'recipeSubClass' => 11], // Inscription
|
||||
785 => ['name_loc0' => 'Pet - Wasp'], // Pet - Wasp
|
||||
781 => ['name_loc2' => 'Familier - diablosaure exotique'], // Pet - Exotic Devilsaur
|
||||
758 => ['name_loc6' => 'Mascota: Evento - Control remoto', 'name_loc3' => 'Tier - Ereignis Ferngesteuert', 'categoryId' => 7], // Pet - Event - Remote Control
|
||||
788 => ['categoryId' => 7], // Pet - Exotic Spirit Beast
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
$baseQuery = '
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'sounds';
|
||||
|
||||
@@ -26,10 +26,6 @@ SqlGen::register(new class extends SetupScript
|
||||
'material', 'itemgroupsounds', 'itemdisplayinfo', 'weaponimpactsounds', 'itemsubclass', 'weaponswingsounds2' /*, 'sheathesoundlookups' data is redundant with material..? */
|
||||
);
|
||||
|
||||
private $customData = array(
|
||||
15407 => ['cat' => 10] // UR_Algalon_Summon03 (this is not an item pickup)
|
||||
);
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -46,70 +46,6 @@ SqlGen::register(new class extends SetupScript
|
||||
' - assembling waypoints from table waypoint_data', TYPE_NPC]
|
||||
);
|
||||
|
||||
private $alphaMapCache = [];
|
||||
|
||||
private function alphaMapCheck(int $areaId, array &$set) : bool
|
||||
{
|
||||
$file = 'setup/generated/alphaMaps/'.$areaId.'.png';
|
||||
if (!file_exists($file)) // file does not exist (probably instanced area)
|
||||
return false;
|
||||
|
||||
// invalid and corner cases (literally)
|
||||
if (!is_array($set) || empty($set['posX']) || empty($set['posY']) || $set['posX'] >= 100 || $set['posY'] >= 100)
|
||||
{
|
||||
$set = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (empty($this->alphaMapCache[$areaId]))
|
||||
$this->alphaMapCache[$areaId] = imagecreatefrompng($file);
|
||||
|
||||
// alphaMaps are 1000 x 1000, adapt points [black => valid point]
|
||||
if (!imagecolorat($this->alphaMapCache[$areaId], $set['posX'] * 10, $set['posY'] * 10))
|
||||
$set = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function checkCoords(array $points) : array
|
||||
{
|
||||
$result = [];
|
||||
$capitals = array( // capitals take precedence over their surroundings
|
||||
1497, 1637, 1638, 3487, // Undercity, Ogrimmar, Thunder Bluff, Silvermoon City
|
||||
1519, 1537, 1657, 3557, // Stormwind City, Ironforge, Darnassus, The Exodar
|
||||
3703, 4395 // Shattrath City, Dalaran
|
||||
);
|
||||
|
||||
foreach ($points as $res)
|
||||
{
|
||||
if ($this->alphaMapCheck($res['areaId'], $res))
|
||||
{
|
||||
if (!$res)
|
||||
continue;
|
||||
|
||||
// some rough measure how central the spawn is on the map (the lower the number, the better)
|
||||
// 0: perfect center; 1: touches a border
|
||||
$q = abs( (($res['posX'] - 50) / 50) * (($res['posY'] - 50) / 50) );
|
||||
|
||||
if (empty($result) || $result[0] > $q)
|
||||
$result = [$q, $res];
|
||||
}
|
||||
else if (in_array($res['areaId'], $capitals)) // capitals (auto-discovered) and no hand-made alphaMap available
|
||||
return $res;
|
||||
else if (empty($result)) // add with lowest quality if alpha map is missing
|
||||
$result = [1.0, $res];
|
||||
}
|
||||
|
||||
// spawn does not really match on a map, but we need at least one result
|
||||
if (!$result)
|
||||
{
|
||||
usort($points, function ($a, $b) { return ($a['dist'] < $b['dist']) ? -1 : 1; });
|
||||
$result = [1.0, $points[0]];
|
||||
}
|
||||
|
||||
return $result[1];
|
||||
}
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
/*********************/
|
||||
@@ -207,7 +143,7 @@ SqlGen::register(new class extends SetupScript
|
||||
if (in_array($spawn['map'], [564, 580])) // Black Temple and Sunwell floor offset bullshit
|
||||
$points[0]['floor']++;
|
||||
|
||||
$final = $area ? $points[0] : $this->checkCoords($points);
|
||||
$final = $area ? $points[0] : Game::checkCoords($points);
|
||||
}
|
||||
|
||||
if ($idx < 5)
|
||||
|
||||
@@ -9,18 +9,13 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'titles';
|
||||
|
||||
protected $tblDependencyTC = ['quest_template', 'game_event_seasonal_questrelation', 'game_event', 'achievement_reward'];
|
||||
protected $dbcSourceFiles = ['chartitles'];
|
||||
|
||||
private $customData = array(
|
||||
137 => ['gender' => 2],
|
||||
138 => ['gender' => 1]
|
||||
);
|
||||
|
||||
private $titleHoliday = array(
|
||||
137 => 201,
|
||||
138 => 201,
|
||||
|
||||
@@ -9,68 +9,39 @@ if (!CLI)
|
||||
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
use TrCustomData;
|
||||
use TrCustomData; // import custom data from DB
|
||||
|
||||
protected $command = 'zones';
|
||||
|
||||
protected $tblDependencyTC = ['access_requirement'];
|
||||
protected $dbcSourceFiles = ['worldmaptransforms', 'worldmaparea', 'map', 'mapdifficulty', 'areatable', 'lfgdungeons', 'battlemasterlist'];
|
||||
|
||||
private $customData = array(
|
||||
2257 => ['cuFlags' => 0, 'category' => 0, 'type' => 1], // deeprun tram => type: transit
|
||||
3698 => ['expansion' => 1], // arenas
|
||||
3702 => ['expansion' => 1],
|
||||
3968 => ['expansion' => 1],
|
||||
4378 => ['expansion' => 2],
|
||||
4406 => ['expansion' => 2],
|
||||
2597 => ['maxPlayer' => 40], // is 5 in battlemasterlist ... dafuq?
|
||||
4710 => ['maxPlayer' => 40],
|
||||
3456 => ['parentAreaId' => 65, 'parentX' => 87.3, 'parentY' => 51.1], // has no coordinates set in map.dbc
|
||||
// individual Tempest Keep ships
|
||||
3849 => ['parentAreaId' => 3523, 'parentX' => 70.5, 'parentY' => 69.6],
|
||||
3847 => ['parentAreaId' => 3523, 'parentX' => 71.7, 'parentY' => 55.1],
|
||||
3848 => ['parentAreaId' => 3523, 'parentX' => 74.3, 'parentY' => 57.8],
|
||||
3845 => ['parentAreaId' => 3523, 'parentX' => 73.5, 'parentY' => 63.7],
|
||||
// individual Icecrown Citadel wings
|
||||
4893 => ['parentAreaId' => 4812, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
4894 => ['parentAreaId' => 4812, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
4895 => ['parentAreaId' => 4812, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
4896 => ['parentAreaId' => 4812, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
4897 => ['parentAreaId' => 4812, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
// uncaught unused zones
|
||||
207 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
208 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
616 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||
1417 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW]
|
||||
);
|
||||
protected $dbcSourceFiles = ['worldmaptransforms', 'worldmaparea', 'map', 'mapdifficulty', 'areatable', 'lfgdungeons', 'battlemasterlist', 'dungeonmap'];
|
||||
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
// base query
|
||||
DB::Aowow()->query('
|
||||
REPLACE INTO ?_zones
|
||||
SELECT
|
||||
$baseData = DB::Aowow()->query('SELECT
|
||||
a.id,
|
||||
IFNULL(wmt.targetMapId, m.id), -- map
|
||||
m.id, -- mapBak
|
||||
a.areaTable, -- parentArea
|
||||
IFNULL(wmt.targetMapId, -- g_zone_categories
|
||||
IFNULL(wmt.targetMapId, m.id) AS map,
|
||||
m.id AS mapBak,
|
||||
a.areaTable AS parentArea,
|
||||
IFNULL(wmt.targetMapId,
|
||||
IF(m.areaType = 1, 2,
|
||||
IF(m.areaType = 2, 3,
|
||||
IF(m.areaType = 4, 9,
|
||||
IF(m.isBG = 1, 6,
|
||||
IF(m.id = 609, 1,
|
||||
IF(m.id = 571, 10,
|
||||
IF(m.id = 530, 8, m.id)))))))),
|
||||
IF(m.id = 571, 10,
|
||||
IF(m.id = 530, 8, m.id))))))) AS category,
|
||||
a.flags,
|
||||
IF(areaTable <> 0 OR -- cuFlags
|
||||
(wma.id IS NULL AND pa.areaId IS NULL AND (flags & 0x11000) = 0), ?d, 0),
|
||||
IF(a.mapId IN (13, 25, 37, 42, 169) OR
|
||||
(a.mapId IN (0, 1, 530, 571) AND wma.id IS NULL) OR
|
||||
a.areaTable <> 0 OR
|
||||
(a.soundAmbience = 0 AND a.mapId IN (0, 1, 530, 571)), ?d, 0) AS cuFlags,
|
||||
IF(a.flags & 0x01000000, 5, -- g_zone_territories
|
||||
IF(m.isBG = 1, 4,
|
||||
IF(m.areaType = 4, 4,
|
||||
IF(a.flags & 0x00000800, 3,
|
||||
IF(a.factionGroupMask = 6, 2,
|
||||
IF(a.factionGroupMask > 0, LOG2(a.factionGroupMask) - 1, 2)))))),
|
||||
IF(a.factionGroupMask > 0, LOG2(a.factionGroupMask) - 1, 2)))))) AS faction,
|
||||
m.expansion,
|
||||
IF(m.areaType = 0, 0, -- g_zone_instancetypes
|
||||
IF(m.isBG = 1, 4,
|
||||
@@ -78,27 +49,27 @@ SqlGen::register(new class extends SetupScript
|
||||
IF(md.modeMask & 0xC, 8,
|
||||
IF(md.minPl = 10 AND md.maxPL = 25, 7,
|
||||
IF(m.areaType = 2, 3,
|
||||
IF(m.areaType = 1 AND md.modeMask & 0x2, 5, 2))))))),
|
||||
IF(m.areaType = 1 AND md.modeMask & 0x2, 5, 2))))))) AS `type`,
|
||||
IF (md.minPl = 10 AND md.maxPl = 25, -2,
|
||||
IFNULL(bm.maxPlayers, IFNULL(md.maxPl, m.maxPlayers))),
|
||||
0, -- itemLevelN
|
||||
0, -- itemLevelH
|
||||
0, -- levelReq
|
||||
IFNULL(lfgIni.levelLFG, 0), -- levelReqLFG
|
||||
0, -- levelHeroic
|
||||
IF(a.flags & 0x8, 1, -- levelMin
|
||||
IFNULL(bm.maxPlayers, IFNULL(md.maxPl, m.maxPlayers))) AS maxPlayer,
|
||||
0 AS `itemLevelN`, --
|
||||
0 AS `itemLevelH`,
|
||||
0 AS `levelReq`,
|
||||
IFNULL(lfgIni.levelLFG, 0) AS `levelReqLFG`,
|
||||
0 AS `levelHeroic`,
|
||||
IF(a.flags & 0x8, 1,
|
||||
IFNULL(bm.minLevel,
|
||||
IFNULL(lfgIni.levelMin,
|
||||
IFNULL(lfgOpen.levelMin, 0)))),
|
||||
IF(a.flags & 0x8, ?d, -- levelMax
|
||||
IFNULL(lfgOpen.levelMin, 0)))) AS `levelMin`,
|
||||
IF(a.flags & 0x8, ?d,
|
||||
IFNULL(bm.maxLevel,
|
||||
IFNULL(lfgIni.levelMax,
|
||||
IFNULL(lfgOpen.levelMax, 0)))),
|
||||
"", -- attunements
|
||||
"", -- heroic attunements
|
||||
IFNULL(pa.areaId, 0),
|
||||
IFNULL(pa.posX, 0),
|
||||
IFNULL(pa.posY, 0),
|
||||
IFNULL(lfgOpen.levelMax, 0)))) AS `levelMax`,
|
||||
"" AS `attunementsN`,
|
||||
"" AS `attunementsH`,
|
||||
m.parentMapId, -- IFNULL(pa.areaId, 0),
|
||||
m.parentX, -- IFNULL(pa.posX, 0),
|
||||
m.parentY, -- IFNULL(pa.posY, 0),
|
||||
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc0, m.name_loc0),
|
||||
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc2, m.name_loc2),
|
||||
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc3, m.name_loc3),
|
||||
@@ -114,26 +85,6 @@ SqlGen::register(new class extends SetupScript
|
||||
) md ON md.mapId = m.id
|
||||
LEFT JOIN
|
||||
dbc_lfgdungeons lfgOpen ON a.mapId IN (0, 1, 530, 571) AND a.name_loc0 LIKE CONCAT("%", lfgOpen.name_loc0) AND lfgOpen.type = 4
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
mapId, m.id, `left`, `right`, `top`, `bottom`,
|
||||
IF((abs(((m.parentY - `right`) * 100 / (`left` - `right`)) - 50)) > abs(((m.parentX - `bottom`) * 100 / (`top` - `bottom`)) - 50),
|
||||
(abs(((m.parentY - `right`) * 100 / (`left` - `right`)) - 50)),
|
||||
(abs(((m.parentX - `bottom`) * 100 / (`top` - `bottom`)) - 50))) AS diff,
|
||||
areaId, -- parentArea
|
||||
100 - ROUND((m.parentY - `right`) * 100 / (`left` - `right`), 1) as posX,
|
||||
100 - ROUND((m.parentX - `bottom`) * 100 / (`top` - `bottom`), 1) as posY
|
||||
FROM
|
||||
dbc_worldmaparea wma
|
||||
JOIN
|
||||
dbc_map m ON m.parentMapId = wma.mapid
|
||||
WHERE
|
||||
m.parentMapId IN (0, 1, 530, 571) AND areaId <> 0 AND
|
||||
m.parentY BETWEEN `right` AND `left` AND
|
||||
m.parentX BETWEEN bottom AND top
|
||||
ORDER BY
|
||||
diff ASC
|
||||
) pa ON pa.id = m.id AND m.parentMapId > -1 AND m.parentX <> 0 AND m.parentY <> 0 AND m.parentMapId = pa.mapId AND m.parentY BETWEEN pa.`right` AND pa.`left` AND m.parentX BETWEEN pa.bottom AND pa.top
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
mapId,
|
||||
@@ -160,10 +111,30 @@ SqlGen::register(new class extends SetupScript
|
||||
wma.right > wmt.minY AND
|
||||
wma.top < wmt.maxX AND
|
||||
wma.bottom > wmt.minX
|
||||
GROUP BY
|
||||
a.id
|
||||
', CUSTOM_EXCLUDE_FOR_LISTVIEW, MAX_LEVEL);
|
||||
|
||||
foreach ($baseData as &$bd)
|
||||
{
|
||||
if (!in_array($bd['parentMapId'], [0, 1, 530, 571]))
|
||||
continue;
|
||||
|
||||
if ($gPos = Game::worldPosToZonePos($bd['parentMapId'], $bd['parentY'], $bd['parentX']))
|
||||
{
|
||||
$pos = Game::checkCoords($gPos);
|
||||
$bd['parentMapId'] = $pos['areaId'] ?? $gPos[0]['areaId'];
|
||||
$bd['parentX'] = $pos['posX'] ?? $gPos[0]['posX'];
|
||||
$bd['parentY'] = $pos['posY'] ?? $gPos[0]['posY'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$bd['parentMapId'] = 0;
|
||||
$bd['parentX'] = 0;
|
||||
$bd['parentY'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DB::Aowow()->query('REPLACE INTO ?_zones VALUES (?a)', $baseData);
|
||||
|
||||
// get requirements from world.access_requirement
|
||||
$zoneReq = DB::World()->select('
|
||||
SELECT
|
||||
@@ -205,7 +176,7 @@ SqlGen::register(new class extends SetupScript
|
||||
$aN[TYPE_ITEM][] = $_;
|
||||
|
||||
if ($req['reqItemH'] && ($entries = explode(' ', $req['reqItemH'])))
|
||||
if ($entries = array_diff($entries, @(array)$aN[TYPE_ITEM]))
|
||||
if ($entries = array_diff($entries, $aN[TYPE_ITEM] ?? []))
|
||||
foreach ($entries as $_)
|
||||
$aH[TYPE_ITEM][] = $_;
|
||||
|
||||
@@ -214,7 +185,7 @@ SqlGen::register(new class extends SetupScript
|
||||
$aN[TYPE_QUEST][] = $_;
|
||||
|
||||
if ($req['reqQuestH'] && ($entries = explode(' ', $req['reqQuestH'])))
|
||||
if ($entries = array_diff($entries, @(array)$aN[TYPE_QUEST]))
|
||||
if ($entries = array_diff($entries, $aN[TYPE_QUEST] ?? []))
|
||||
foreach ($entries as $_)
|
||||
$aH[TYPE_QUEST][] = $_;
|
||||
|
||||
@@ -223,7 +194,7 @@ SqlGen::register(new class extends SetupScript
|
||||
$aN[TYPE_ACHIEVEMENT][] = $_;
|
||||
|
||||
if ($req['reqAchievementH'] && ($entries = explode(' ', $req['reqAchievementH'])))
|
||||
if ($entries = array_diff($entries, @(array)$aN[TYPE_ACHIEVEMENT]))
|
||||
if ($entries = array_diff($entries, $aN[TYPE_ACHIEVEMENT] ?? []))
|
||||
foreach ($entries as $_)
|
||||
$aH[TYPE_ACHIEVEMENT][] = $_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user