mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
IconDB
* initial implementation * this includes a complete reindexing of everything touching icons * this also means, no linking to red-rocket-site though, they index them differently
This commit is contained in:
@@ -16,14 +16,47 @@ if (!CLI)
|
||||
$customData = array(
|
||||
1956 => ['itemExtra' => 44738]
|
||||
);
|
||||
$reqDBC = ['achievement_category', 'achievement'];
|
||||
$reqDBC = ['achievement_category', 'achievement', 'spellicon'];
|
||||
|
||||
function achievement(array $ids = [])
|
||||
{
|
||||
if ($ids)
|
||||
DB::Aowow()->query('DELETE FROM ?_achievement WHERE id IN (?a)', $ids);
|
||||
else
|
||||
DB::Aowow()->query('INSERT IGNORE INTO ?_achievement SELECT a.id, 2 - a.faction, a.map, 0, 0, a.category, ac.parentCategory, a.points, a.orderInGroup, a.iconId, a.flags, a.reqCriteriaCount, a.refAchievement, 0, 0, a.name_loc0, a.name_loc2, a.name_loc3, a.name_loc6, a.name_loc8, a.description_loc0, a.description_loc2, a.description_loc3, a.description_loc6, a.description_loc8, a.reward_loc0, a.reward_loc2, a.reward_loc3, a.reward_loc6, a.reward_loc8 FROM dbc_achievement a LEFT JOIN dbc_achievement_category ac ON ac.id = a.category');
|
||||
{
|
||||
DB::Aowow()->query('
|
||||
REPLACE INTO
|
||||
?_achievement
|
||||
SELECT
|
||||
a.id,
|
||||
2 - a.faction,
|
||||
a.map,
|
||||
0,
|
||||
0,
|
||||
a.category,
|
||||
ac.parentCategory,
|
||||
a.points,
|
||||
a.orderInGroup,
|
||||
IFNULL(i.id, 0),
|
||||
a.iconId,
|
||||
a.flags,
|
||||
a.reqCriteriaCount,
|
||||
a.refAchievement,
|
||||
0,
|
||||
0,
|
||||
a.name_loc0, a.name_loc2, a.name_loc3, a.name_loc6, a.name_loc8,
|
||||
a.description_loc0, a.description_loc2, a.description_loc3, a.description_loc6, a.description_loc8,
|
||||
a.reward_loc0, a.reward_loc2, a.reward_loc3, a.reward_loc6, a.reward_loc8
|
||||
FROM
|
||||
dbc_achievement a
|
||||
LEFT JOIN
|
||||
dbc_achievement_category ac ON ac.id = a.category
|
||||
LEFT JOIN
|
||||
dbc_spellicon si ON si.id = a.iconId
|
||||
LEFT JOIN
|
||||
?_icons i ON LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1)) = i.name
|
||||
');
|
||||
}
|
||||
|
||||
// serverside achievements
|
||||
$serverAchievements = DB::World()->select('SELECT ID, IF(requiredFaction = -1, 3, IF(requiredFaction = 0, 2, 1)) AS "faction", mapID, points, flags, count, refAchievement FROM achievement_dbc{ WHERE id IN (?a)}',
|
||||
|
||||
@@ -40,7 +40,7 @@ function currencies(array $ids = [])
|
||||
else
|
||||
{
|
||||
CLISetup::log('item #'.$itemId.' required by currency #'.$cId.' not in item_template', CLISetup::LOG_WARN);
|
||||
$strings = ['name_loc0' => 'Item #'.$itemId.' not in DB', 'iconId' => -1240, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3];
|
||||
$strings = ['name_loc0' => 'Item #'.$itemId.' not in DB', 'iconId' => 0, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3];
|
||||
}
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_currencies SET ?a WHERE itemId = ?d', $strings, $itemId);
|
||||
@@ -49,7 +49,18 @@ function currencies(array $ids = [])
|
||||
// apply icons
|
||||
$displayIds = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, displayid FROM item_template WHERE entry IN (?a)', $moneyItems);
|
||||
foreach ($displayIds as $itemId => $iconId)
|
||||
DB::Aowow()->query('UPDATE ?_currencies SET iconId = ?d WHERE itemId = ?d', -$iconId, $itemId);
|
||||
DB::Aowow()->query('
|
||||
UPDATE
|
||||
?_currencies c,
|
||||
?_icons i,
|
||||
dbc_itemdisplayinfo idi
|
||||
SET
|
||||
c.iconId = i.id
|
||||
WHERE
|
||||
i.name = LOWER(idi.inventoryIcon1) AND
|
||||
idi.id = ?d AND
|
||||
c.itemId = ?d
|
||||
', $iconId, $itemId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
20
setup/tools/sqlgen/glyphproperties.func.php
Normal file
20
setup/tools/sqlgen/glyphproperties.func.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
if (!CLI)
|
||||
die('not in cli mode');
|
||||
|
||||
$reqDBC = ['glyphproperties', 'spellicon'];
|
||||
|
||||
function glyphproperties()
|
||||
{
|
||||
DB::Aowow()->query('REPLACE INTO ?_glyphproperties SELECT id, spellId, typeFlags, 0, iconId FROM dbc_glyphproperties');
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_glyphproperties gp, ?_icons ic, dbc_spellicon si SET gp.iconId = ic.id WHERE gp.iconIdBak = si.id AND ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1))');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -13,12 +13,20 @@ $reqDBC = ['spellicon', 'itemdisplayinfo'];
|
||||
|
||||
function icons()
|
||||
{
|
||||
DB::Aowow()->query('TRUNCATE ?_icons');
|
||||
DB::Aowow()->query('ALTER TABLE ?_icons AUTO_INCREMENT = 1');
|
||||
|
||||
$baseQuery = '
|
||||
REPLACE INTO
|
||||
?_icons
|
||||
SELECT Id, LOWER(SUBSTRING_INDEX(iconPath, "\\\\", -1)) FROM dbc_spellicon
|
||||
INSERT INTO ?_icons (`name`) SELECT x FROM
|
||||
(
|
||||
(SELECT LOWER(SUBSTRING_INDEX(iconPath, "\\\\", -1)) AS x FROM dbc_spellicon WHERE iconPath LIKE "%icons%")
|
||||
UNION
|
||||
SELECT -Id, LOWER(inventoryIcon1) FROM dbc_itemdisplayinfo';
|
||||
(SELECT LOWER(inventoryIcon1) AS x FROM dbc_itemdisplayinfo WHERE inventoryIcon1 <> "")
|
||||
) y
|
||||
GROUP BY
|
||||
x
|
||||
ORDER BY
|
||||
x ASC';
|
||||
|
||||
DB::Aowow()->query($baseQuery);
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ function items(array $ids = [])
|
||||
SoundOverrideSubclass,
|
||||
IFNULL(sg.id, 0) AS subSubClass,
|
||||
name, IFNULL(li.name_loc2, ""), IFNULL(li.name_loc3, ""), IFNULL(li.name_loc6, ""), IFNULL(li.name_loc8, ""),
|
||||
0 AS iconId,
|
||||
displayid,
|
||||
0 AS spellVisualId,
|
||||
Quality,
|
||||
@@ -153,6 +154,9 @@ function items(array $ids = [])
|
||||
// get modelString
|
||||
DB::Aowow()->query('UPDATE ?_items i, dbc_itemdisplayinfo idi SET i.model = IF(idi.leftModelName = "", idi.rightModelName, idi.leftModelName) WHERE i.displayId = idi.id');
|
||||
|
||||
// get iconId
|
||||
DB::Aowow()->query('UPDATE ?_items i, dbc_itemdisplayinfo idi, ?_icons ic SET i.iconId = ic.id WHERE i.displayId = idi.id AND LOWER(idi.inventoryIcon1) = ic.name');
|
||||
|
||||
// unify slots: Robes => Chest; Ranged (right) => Ranged
|
||||
DB::Aowow()->query('UPDATE ?_items SET slot = 15 WHERE slotbak = 26');
|
||||
DB::Aowow()->query('UPDATE ?_items SET slot = 5 WHERE slotbak = 20');
|
||||
|
||||
@@ -33,12 +33,14 @@ function pet(array $ids = [])
|
||||
0, -- exotic
|
||||
0, -- expansion
|
||||
name_loc0, name_loc2, name_loc3, name_lo6, name_loc8,
|
||||
LOWER(SUBSTRING_INDEX(iconString, "\\\\", -1)),
|
||||
ic.id,
|
||||
skillLine1,
|
||||
0, 0, 0, 0, -- spell[1-4]
|
||||
0, 0, 0 -- armor, damage, health
|
||||
FROM
|
||||
dbc_creaturefamily f
|
||||
LEFT JOIN
|
||||
?_icons ic ON ic.name = LOWER(SUBSTRING_INDEX(f.iconString, "\\\\", -1))
|
||||
WHERE
|
||||
petTalentType <> -1';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ if (!CLI)
|
||||
die('not in cli mode');
|
||||
|
||||
$customData = array(
|
||||
393 => ['professionMask' => 0x0000, 'iconId' => 736], // Skinning
|
||||
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
|
||||
@@ -21,7 +21,6 @@ $customData = array(
|
||||
356 => ['professionMask' => 0x0400, 'recipeSubClass' => 9], // Fishing
|
||||
182 => ['professionMask' => 0x0800], // Herbalism
|
||||
773 => ['professionMask' => 0x1000, 'recipeSubClass' => 11], // Inscription
|
||||
633 => ['iconId' => 936], // lockpicking
|
||||
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
|
||||
@@ -35,7 +34,7 @@ function skillline()
|
||||
REPLACE INTO
|
||||
?_skillline
|
||||
SELECT
|
||||
Id, categoryId, 0, categoryId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, description_loc0, description_loc2, description_loc3, description_loc6, description_loc8, iconId, 0, 0, ""
|
||||
Id, categoryId, 0, categoryId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, description_loc0, description_loc2, description_loc3, description_loc6, description_loc8, 0, iconId, 0, 0, ""
|
||||
FROM
|
||||
dbc_skillline';
|
||||
|
||||
@@ -47,11 +46,30 @@ function skillline()
|
||||
DB::Aowow()->query('UPDATE ?_skillline SET typeCat = -6 WHERE id IN (778, 788, 758) OR (categoryId = 7 AND name_loc0 LIKE "%pet%")');
|
||||
|
||||
// more complex fixups
|
||||
DB::Aowow()->query('UPDATE ?_skillline sl, dbc_spell s, dbc_skilllineability sla SET sl.iconId = s.iconId WHERE (s.effect1Id IN (25, 26, 40) OR s.effect2Id = 60) AND sla.spellId = s.id AND sl.id = sla.skillLineId');
|
||||
DB::Aowow()->query('UPDATE ?_skillline SET name_loc8 = REPLACE(name_loc8, " - ", ": ") WHERE categoryId = 7 OR id IN (758, 788)');
|
||||
DB::Aowow()->query('UPDATE ?_skillline SET iconId = ?d WHERE iconId = 0', 1776); // inv_misc_questionmark
|
||||
DB::Aowow()->query('UPDATE ?_skillline SET cuFlags = ?d WHERE id IN (?a)', CUSTOM_EXCLUDE_FOR_LISTVIEW, [142, 148, 149, 150, 152, 155, 183, 533, 553, 554, 713, 769]);
|
||||
|
||||
// apply icons
|
||||
DB::Aowow()->query('UPDATE ?_skillline sl, ?_icons ic, dbc_spellicon si SET sl.iconId = ic.id WHERE sl.iconIdBak = si.id AND ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1))');
|
||||
DB::Aowow()->query('
|
||||
UPDATE
|
||||
?_skillline sl,
|
||||
dbc_spell s,
|
||||
dbc_skilllineability sla,
|
||||
?_icons ic,
|
||||
dbc_spellicon si
|
||||
SET
|
||||
sl.iconId = ic.id
|
||||
WHERE
|
||||
(s.effect1Id IN (25, 26, 40) OR s.effect2Id = 60) AND
|
||||
ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1)) AND
|
||||
s.iconId = si.id AND
|
||||
sla.spellId = s.id AND
|
||||
sl.id = sla.skillLineId
|
||||
');
|
||||
DB::Aowow()->query('UPDATE ?_skillline sl, ?_icons ic SET sl.iconId = ic.id WHERE ic.name = ? AND sl.id = ?d', 'inv_misc_pelt_wolf_01', 393);
|
||||
DB::Aowow()->query('UPDATE ?_skillline sl, ?_icons ic SET sl.iconId = ic.id WHERE ic.name = ? AND sl.id = ?d', 'inv_misc_key_03', 633);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ $reqDBC = [
|
||||
'skillraceclassinfo',
|
||||
'talent',
|
||||
'talenttab',
|
||||
'glyphproperties'
|
||||
'glyphproperties',
|
||||
'spellicon'
|
||||
];
|
||||
|
||||
function spell()
|
||||
@@ -85,8 +86,8 @@ function spell()
|
||||
EffectSpellClassMaskA1, EffectSpellClassMaskA2, EffectSpellClassMaskA3,
|
||||
EffectSpellClassMaskB1, EffectSpellClassMaskB2, EffectSpellClassMaskB3,
|
||||
EffectSpellClassMaskC1, EffectSpellClassMaskC2, EffectSpellClassMaskC3,
|
||||
0 AS spellVisualId1, 0 AS spellVisualId2,
|
||||
0 AS iconId, 0 AS iconIdActive,
|
||||
0 AS iconId, 0 AS iconIdAlt,
|
||||
0 AS rankId, 0 AS spellVisualId1,
|
||||
CONCAT("Serverside - ",Comment) AS name_loc0,CONCAT("Serverside - ",Comment) AS name_loc2,CONCAT("Serverside - ",Comment) AS name_loc3,CONCAT("Serverside - ",Comment) AS name_loc6,CONCAT("Serverside - ",Comment) AS name_loc8,
|
||||
"" AS rank_loc0, "" AS rank_loc2, "" AS rank_loc3, "" AS rank_loc6, "" AS rank_loc8,
|
||||
"" AS description_loc0, "" AS description_loc2, "" AS description_loc3, "" AS description_loc6, "" AS description_loc8,
|
||||
@@ -175,9 +176,8 @@ function spell()
|
||||
effect1SpellClassMaskC, effect2SpellClassMaskC, effect3SpellClassMaskC,
|
||||
effect1DamageMultiplier, effect2DamageMultiplier, effect3DamageMultiplier,
|
||||
effect1BonusMultiplier, effect2BonusMultiplier, effect3BonusMultiplier,
|
||||
iconId, 0 AS iconIdAlt,
|
||||
0 AS rankId,
|
||||
spellVisualId1,
|
||||
0 AS iconId, iconId AS iconIdBak, 0 AS iconIdAlt,
|
||||
0 AS rankId, spellVisualId1,
|
||||
name_loc0, name_loc2, name_loc3, name_loc6, name_loc8,
|
||||
rank_loc0, rank_loc2, rank_loc3, rank_loc6, rank_loc8,
|
||||
description_loc0, description_loc2, description_loc3, description_loc6, description_loc8,
|
||||
@@ -286,6 +286,8 @@ function spell()
|
||||
ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL = 2 not used for now
|
||||
*/
|
||||
|
||||
CLISetup::log(' - linking with skillineability');
|
||||
|
||||
$results = DB::Aowow()->select('SELECT spellId AS ARRAY_KEY, Id AS ARRAY_KEY2, skillLineId, reqRaceMask, reqClassMask, reqSkillLevel, acquireMethod, skillLevelGrey, skillLevelYellow FROM dbc_skilllineability sla');
|
||||
foreach ($results as $spellId => $sets)
|
||||
{
|
||||
@@ -443,6 +445,8 @@ function spell()
|
||||
/* talent related */
|
||||
/******************/
|
||||
|
||||
CLISetup::log(' - linking with talent');
|
||||
|
||||
for ($i = 1; $i < 6; $i++)
|
||||
{
|
||||
// classMask
|
||||
@@ -463,6 +467,8 @@ function spell()
|
||||
/* Other */
|
||||
/*********/
|
||||
|
||||
CLISetup::log(' - misc fixups & icons');
|
||||
|
||||
// FU [FixUps]
|
||||
DB::Aowow()->query('UPDATE ?_spell SET reqRaceMask = ?d WHERE skillLine1 = ?d', 1 << 10, 760); // Draenai Racials
|
||||
DB::Aowow()->query('UPDATE ?_spell SET reqRaceMask = ?d WHERE skillLine1 = ?d', 1 << 9, 756); // Bloodelf Racials
|
||||
@@ -494,7 +500,7 @@ function spell()
|
||||
$itemInfo = DB::World()->select('SELECT entry AS ARRAY_KEY, displayId AS d, Quality AS q FROM item_template WHERE entry IN (?a)', $itemSpells);
|
||||
foreach ($itemSpells as $sId => $itemId)
|
||||
if (isset($itemInfo[$itemId]))
|
||||
DB::Aowow()->query('UPDATE ?_spell SET iconIdAlt = ?d, cuFlags = cuFlags | ?d WHERE id = ?d', -$itemInfo[$itemId]['d'], ((7 - $itemInfo[$itemId]['q']) << 8), $sId);
|
||||
DB::Aowow()->query('UPDATE ?_spell s, ?_icons ic, dbc_spellicon si SET s.iconIdAlt = ?d, s.cuFlags = s.cuFlags | ?d WHERE s.iconIdBak = si.id AND ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1)) AND s.id = ?d', -$itemInfo[$itemId]['d'], ((7 - $itemInfo[$itemId]['q']) << 8), $sId);
|
||||
|
||||
// apply specializations [trainerTemplate => reqSpell]
|
||||
$specs = array(
|
||||
@@ -516,11 +522,15 @@ function spell()
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_spell SET reqSpellId = id WHERE id IN (?a)', [9788, 9787, 20222, 20219, 10660, 10656, 10658, 26797, 26798, 26801, 17039, 17040, 17041]);
|
||||
|
||||
// setting icons
|
||||
DB::Aowow()->query('UPDATE ?_spell s, ?_icons ic, dbc_spellicon si SET s.iconId = ic.id WHERE s.iconIdBak = si.id AND ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1))');
|
||||
|
||||
/**************/
|
||||
/* Categories */
|
||||
/**************/
|
||||
|
||||
CLISetup::log(' - applying categories');
|
||||
|
||||
// player talents (-2)
|
||||
DB::Aowow()->query('UPDATE ?_spell s, dbc_talent t SET s.typeCat = -2 WHERE t.tabId NOT IN (409, 410, 411) AND (s.Id = t.rank1 OR s.Id = t.rank2 OR s.Id = t.rank3 OR s.Id = t.rank4 OR s.Id = t.rank5)');
|
||||
|
||||
@@ -635,6 +645,8 @@ function spell()
|
||||
/* Glyphs */
|
||||
/**********/
|
||||
|
||||
CLISetup::log(' - fixing glyph data');
|
||||
|
||||
// glyphSpell => affectedSpell
|
||||
$glyphAffects = array(
|
||||
63959 => 50842, // Pestilence
|
||||
@@ -667,8 +679,10 @@ function spell()
|
||||
);
|
||||
|
||||
$queryIcons = '
|
||||
SELECT s.id, s.name_loc0, s.skillLine1 as skill, s.iconId as icon, s.typeCat * s.typeCat AS prio
|
||||
SELECT s.id, s.name_loc0, s.skillLine1 as skill, ic.id as icon, s.typeCat * s.typeCat AS prio
|
||||
FROM ?_spell s
|
||||
LEFT JOIN dbc_spellicon si ON s.iconIdBak = si.id
|
||||
LEFT JOIN ?_icons ic ON ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1))
|
||||
WHERE [WHERE] AND (s.cuFlags & ?d) = 0 AND s.typeCat IN (0, 7, -2) -- not triggered; class spells first, talents second, unk last
|
||||
ORDER BY prio DESC
|
||||
';
|
||||
@@ -704,10 +718,8 @@ function spell()
|
||||
// first: manuall replace
|
||||
if ($applyId == 57144) // has no skillLine.. :/
|
||||
{
|
||||
$icons = [
|
||||
'skill' => 253,
|
||||
'icon' => 163 // ability_poisonsting
|
||||
];
|
||||
DB::Aowow()->query('UPDATE ?_spell s, ?_icons ic SET s.skillLine1 = ?d, s.iconIdAlt = ic.id WHERE s.id = ?d AND ic.name = ?', 253, 57144, 'ability_poisonsting');
|
||||
continue;
|
||||
}
|
||||
|
||||
// second: search by name and Family equality
|
||||
|
||||
Reference in New Issue
Block a user