mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* work against more correctly assigning instance mode to entities and loot
- added manually collected data for difficulty versions of gameobjects, just boss chests for now.
update setup/source to default object source to base difficulty version if able
- update spelldifficulty table to contain the (likely) mapmode it will be used in
* refactored class loot
- implement loot mode indicators on listview for creature and gameobject loot
- show 'drops' listview tab on instance zone page
- fixes against tribute chest systems (toc / ulduar)
- fix icc gunship battle chest ownership
83 lines
3.4 KiB
PHP
83 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace Aowow;
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
if (!CLI)
|
|
die('not in cli mode');
|
|
|
|
|
|
CLISetup::registerSetup("sql", new class extends SetupScript
|
|
{
|
|
protected $info = array(
|
|
'spelldifficulty' => [[], CLISetup::ARGV_PARAM, 'Compiles supplemental data for type: Spell from dbc and world db.']
|
|
);
|
|
|
|
protected $dbcSourceFiles = ['spelldifficulty'];
|
|
protected $worldDependency = ['spelldifficulty_dbc'];
|
|
protected $setupAfter = [['creature', 'spawns'], []];
|
|
|
|
public function generate(array $ids = []) : bool
|
|
{
|
|
DB::Aowow()->query('TRUNCATE TABLE ?_spelldifficulty');
|
|
|
|
DB::Aowow()->query('INSERT INTO ?_spelldifficulty SELECT GREATEST(`normal10`, 0), GREATEST(`normal25`, 0), GREATEST(`heroic10`, 0), GREATEST(`heroic25`, 0), IF(`heroic10` > 0, 2, 0) FROM dbc_spelldifficulty');
|
|
|
|
$rows = DB::World()->select('SELECT `spellid0`, `spellid1`, `spellid2`, `spellid3`, IF(`spellid2` > 0, 2, 0) FROM spelldifficulty_dbc');
|
|
foreach ($rows as $r)
|
|
DB::Aowow()->query('INSERT INTO ?_spelldifficulty VALUES (?a)', array_values($r));
|
|
|
|
|
|
CLI::write('[spelldifficulty] - trying to assign map type by traversing creature spells > spawns');
|
|
|
|
// try to update mode of ambiguous entries
|
|
$baseSpells = DB::Aowow()->selectCol('SELECT `normal10` FROM ?_spelldifficulty WHERE `heroic10` = 0 AND `heroic25` = 0');
|
|
|
|
for ($i = 1; $i < 9; $i++)
|
|
DB::Aowow()->query(
|
|
'UPDATE ?_spelldifficulty sd,
|
|
(SELECT c.?# AS "spell", BIT_OR(CASE WHEN z.`type` = ?d THEN 1 WHEN z.`type` = ?d THEN 2 WHEN z.`type` = ?d THEN 2 ELSE 0 END) AS "mapType"
|
|
FROM ?_creature c
|
|
JOIN ?_spawns s ON c.id = s.typeId AND s.type = ?d
|
|
JOIN ?_zones z ON z.id = s.areaId
|
|
WHERE c.?# IN (?a)
|
|
GROUP BY c.?#
|
|
HAVING c.?# <> 0) x
|
|
SET sd.`mapType` = x.`mapType`
|
|
WHERE sd.`normal10` = x.`spell`',
|
|
'spell'.$i, MAP_TYPE_DUNGEON_HC, MAP_TYPE_MMODE_RAID, MAP_TYPE_MMODE_RAID_HC,
|
|
Type::NPC, 'spell'.$i, $baseSpells, 'spell'.$i, 'spell'.$i
|
|
);
|
|
|
|
|
|
CLI::write('[spelldifficulty] - trying to assign map type by traversing smart_scripts > spawns');
|
|
|
|
$smartCaster = [];
|
|
foreach ($baseSpells as $bs)
|
|
if ($owner = SmartAI::getOwnerOfSpellCast($bs))
|
|
foreach ($owner as $type => $caster)
|
|
$smartCaster[$type][$bs] = $caster;
|
|
|
|
foreach ($smartCaster as $type => $spells)
|
|
foreach ($spells as $spellId => $casterEntries)
|
|
DB::Aowow()->query(
|
|
'UPDATE ?_spelldifficulty sd,
|
|
(SELECT BIT_OR(CASE WHEN z.`type` = ?d THEN 1 WHEN z.`type` = ?d THEN 2 WHEN z.`type` = ?d THEN 2 ELSE 0 END) AS "mapType"
|
|
FROM ?_spawns s
|
|
JOIN ?_zones z ON z.id = s.areaId
|
|
WHERE s.type = ?d AND s.typeId IN (?a) ) sp
|
|
SET sd.`mapType` = IF(sp.`mapType` > 2, 0, sp.`mapType`)
|
|
WHERE sd.`normal10` = ?d',
|
|
MAP_TYPE_DUNGEON_HC, MAP_TYPE_MMODE_RAID, MAP_TYPE_MMODE_RAID_HC,
|
|
$type, $casterEntries,
|
|
$spellId
|
|
);
|
|
|
|
return true;
|
|
}
|
|
});
|
|
|
|
?>
|