mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Pets
* move custom data from pet script to db
This commit is contained in:
File diff suppressed because one or more lines are too long
22
setup/sql/updates/1763200071_01.sql
Normal file
22
setup/sql/updates/1763200071_01.sql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
UPDATE `aowow_pet` SET `expansion` = 1 WHERE `id` IN (30, 31, 32, 33, 34);
|
||||||
|
UPDATE `aowow_pet` SET `expansion` = 2 WHERE `id` IN (37, 38, 39, 41, 42, 43, 44, 45, 46);
|
||||||
|
|
||||||
|
DELETE FROM `aowow_setup_custom_data` WHERE `command` = 'pet' AND `field` = 'expansion';
|
||||||
|
INSERT INTO `aowow_setup_custom_data` VALUES
|
||||||
|
('pet', 30, 'expansion', 1, 'Pet - Dragonhawk: BC'),
|
||||||
|
('pet', 31, 'expansion', 1, 'Pet - Ravager: BC'),
|
||||||
|
('pet', 32, 'expansion', 1, 'Pet - Warp Stalker: BC'),
|
||||||
|
('pet', 33, 'expansion', 1, 'Pet - Sporebat: BC'),
|
||||||
|
('pet', 34, 'expansion', 1, 'Pet - Nether Ray: BC'),
|
||||||
|
('pet', 37, 'expansion', 2, 'Pet - Moth: WotLK'),
|
||||||
|
('pet', 38, 'expansion', 2, 'Pet - Chimaera: WotLK'),
|
||||||
|
('pet', 39, 'expansion', 2, 'Pet - Devilsaur: WotLK'),
|
||||||
|
('pet', 41, 'expansion', 2, 'Pet - Silithid: WotLK'),
|
||||||
|
('pet', 42, 'expansion', 2, 'Pet - Worm: WotLK'),
|
||||||
|
('pet', 43, 'expansion', 2, 'Pet - Rhino: WotLK'),
|
||||||
|
('pet', 44, 'expansion', 2, 'Pet - Wasp: WotLK'),
|
||||||
|
('pet', 45, 'expansion', 2, 'Pet - Core Hound: WotLK'),
|
||||||
|
('pet', 46, 'expansion', 2, 'Pet - Spirit Beast: WotLK')
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' pet');
|
||||||
@@ -11,6 +11,8 @@ if (!CLI)
|
|||||||
|
|
||||||
CLISetup::registerSetup("sql", new class extends SetupScript
|
CLISetup::registerSetup("sql", new class extends SetupScript
|
||||||
{
|
{
|
||||||
|
use TrCustomData;
|
||||||
|
|
||||||
protected $info = array(
|
protected $info = array(
|
||||||
'pet' => [[], CLISetup::ARGV_PARAM, 'Compiles data for type: Pet from dbc and world db.']
|
'pet' => [[], CLISetup::ARGV_PARAM, 'Compiles data for type: Pet from dbc and world db.']
|
||||||
);
|
);
|
||||||
@@ -25,69 +27,64 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
|||||||
|
|
||||||
// basic copy from creaturefamily.dbc
|
// basic copy from creaturefamily.dbc
|
||||||
DB::Aowow()->query(
|
DB::Aowow()->query(
|
||||||
'INSERT INTO ?_pet
|
'INSERT INTO ?_pet
|
||||||
SELECT f.id,
|
SELECT f.`id`,
|
||||||
categoryEnumId,
|
`categoryEnumId`,
|
||||||
0, -- cuFlags
|
0, -- cuFlags
|
||||||
0, -- minLevel
|
0, -- minLevel
|
||||||
0, -- maxLevel
|
0, -- maxLevel
|
||||||
petFoodMask,
|
`petFoodMask`,
|
||||||
petTalentType,
|
`petTalentType`,
|
||||||
0, -- exotic
|
0, -- exotic
|
||||||
0, -- expansion
|
0, -- expansion
|
||||||
name_loc0, name_loc2, name_loc3, name_loc4, name_loc6, name_loc8,
|
`name_loc0`, `name_loc2`, `name_loc3`, `name_loc4`, `name_loc6`, `name_loc8`,
|
||||||
ic.id,
|
ic.`id`,
|
||||||
skillLine1,
|
`skillLine1`,
|
||||||
0, 0, 0, 0, -- spell[1-4]
|
0, 0, 0, 0, -- spell[1-4]
|
||||||
0, 0, 0 -- armor, damage, health
|
0, 0, 0 -- armor, damage, health
|
||||||
FROM dbc_creaturefamily f
|
FROM dbc_creaturefamily f
|
||||||
LEFT JOIN ?_icons ic ON ic.name = LOWER(SUBSTRING_INDEX(f.iconString, "\\\\", -1))
|
LEFT JOIN ?_icons ic ON ic.`name` = LOWER(SUBSTRING_INDEX(f.`iconString`, "\\\\", -1))
|
||||||
WHERE petTalentType <> -1'
|
WHERE `petTalentType` <> -1'
|
||||||
);
|
);
|
||||||
|
|
||||||
// stats from craeture_template
|
// stats from craeture_template
|
||||||
$spawnInfo = DB::World()->query(
|
$spawnInfo = DB::World()->query(
|
||||||
'SELECT ct.family AS ARRAY_KEY,
|
'SELECT ct.`family` AS ARRAY_KEY,
|
||||||
MIN(ct.minlevel) AS minLevel,
|
MIN(ct.`minlevel`) AS "minLevel",
|
||||||
MAX(ct.maxlevel) AS maxLevel,
|
MAX(ct.`maxlevel`) AS "maxLevel",
|
||||||
IF(ct.type_flags & 0x10000, 1, 0) AS exotic
|
IF(ct.`type_flags` & ?d, 1, 0) AS "exotic"
|
||||||
FROM creature_template ct
|
FROM creature_template ct
|
||||||
JOIN creature c ON ct.entry = c.id
|
JOIN creature c ON ct.`entry` = c.`id`
|
||||||
WHERE ct.type_flags & 0x1
|
WHERE ct.`type_flags` & ?d
|
||||||
GROUP BY ct.family'
|
GROUP BY ct.`family`',
|
||||||
|
NPC_TYPEFLAG_EXOTIC_PET, NPC_TYPEFLAG_TAMEABLE
|
||||||
);
|
);
|
||||||
foreach ($spawnInfo as $id => $info)
|
foreach ($spawnInfo as $id => $info)
|
||||||
DB::Aowow()->query('UPDATE ?_pet SET ?a WHERE id = ?d', $info, $id);
|
DB::Aowow()->query('UPDATE ?_pet SET ?a WHERE id = ?d', $info, $id);
|
||||||
|
|
||||||
// add petFamilyModifier to health, mana, dmg
|
// add petFamilyModifier to health, mana, dmg
|
||||||
DB::Aowow()->query(
|
DB::Aowow()->query(
|
||||||
'UPDATE ?_pet p,
|
'UPDATE ?_pet p,
|
||||||
dbc_skilllineability sla,
|
dbc_skilllineability sla,
|
||||||
dbc_spell s
|
dbc_spell s
|
||||||
SET armor = s.effect2BasePoints + s.effect2DieSides,
|
SET `armor` = s.`effect2BasePoints` + s.`effect2DieSides`,
|
||||||
damage = s.effect1BasePoints + s.effect1DieSides,
|
`damage` = s.`effect1BasePoints` + s.`effect1DieSides`,
|
||||||
health = s.effect3BasePoints + s.effect3DieSides
|
`health` = s.`effect3BasePoints` + s.`effect3DieSides`
|
||||||
WHERE p.skillLineId = sla.skillLineId AND
|
WHERE p.`skillLineId` = sla.`skillLineId` AND
|
||||||
sla.spellId = s.id AND
|
sla.`spellId` = s.`id` AND
|
||||||
s.name_loc0 = "Tamed Pet Passive (DND)"'
|
s.`name_loc0` = "Tamed Pet Passive (DND)"'
|
||||||
);
|
);
|
||||||
|
|
||||||
// add expansion manually
|
|
||||||
/********************/
|
|
||||||
/* TODO: MOVE TO DB */
|
|
||||||
/********************/
|
|
||||||
DB::Aowow()->query('UPDATE ?_pet SET expansion = 1 WHERE id IN (30, 31, 32, 33, 34)');
|
|
||||||
DB::Aowow()->query('UPDATE ?_pet SET expansion = 2 WHERE id IN (37, 38, 39, 41, 42, 43, 44, 45, 46)');
|
|
||||||
|
|
||||||
// assign pet spells
|
// assign pet spells
|
||||||
$pets = DB::Aowow()->select(
|
$pets = DB::Aowow()->select(
|
||||||
'SELECT p.id, MAX(s.id) AS spell
|
'SELECT p.`id`, MAX(s.`id`) AS "spell"
|
||||||
FROM dbc_skilllineability sla
|
FROM dbc_skilllineability sla
|
||||||
JOIN ?_pet p ON p.skillLineId = sla.skillLineId
|
JOIN ?_pet p ON p.`skillLineId` = sla.`skillLineId`
|
||||||
JOIN dbc_spell s ON sla.spellId = s.id
|
JOIN dbc_spell s ON sla.`spellId` = s.`id`
|
||||||
LEFT OUTER JOIN dbc_talent t ON s.id = t.rank1
|
LEFT OUTER JOIN dbc_talent t ON s.`id` = t.`rank1`
|
||||||
WHERE (s.attributes0 & 0x40) = 0 AND t.id IS NULL
|
WHERE (s.`attributes0` & ?d) = 0 AND t.`id` IS NULL
|
||||||
GROUP BY s.name_loc0, p.id'
|
GROUP BY s.`name_loc0`, p.`id`',
|
||||||
|
SPELL_ATTR0_PASSIVE
|
||||||
);
|
);
|
||||||
|
|
||||||
$petSpells = [];
|
$petSpells = [];
|
||||||
@@ -100,7 +97,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($petSpells as $petId => $row)
|
foreach ($petSpells as $petId => $row)
|
||||||
DB::Aowow()->query('UPDATE ?_pet SET ?a WHERE id = ?d', $row, $petId);
|
DB::Aowow()->query('UPDATE ?_pet SET ?a WHERE `id` = ?d', $row, $petId);
|
||||||
|
|
||||||
$this->reapplyCCFlags('pet', Type::PET);
|
$this->reapplyCCFlags('pet', Type::PET);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user