Core&DB/Spells: Move custom spell attributes from code to DB, spell_custom_attr table

`spell_custom_attr`
- `entry` uint PK
- `attributes` uint (enum SpellCustomAttributes of SpellInfo.h)
This commit is contained in:
Duarte Duarte committed 2014-01-31 04:32:03 +00:00
1 parent 9495194bf2
commit d749b72193
2 files changed
+199 -166

No files matched your search

+32 -166
View File
@@ -2714,8 +2714,39 @@ void SpellMgr::UnloadSpellInfoImplicitTargetConditionLists()
void SpellMgr::LoadSpellInfoCustomAttributes()
{
uint32 oldMSTime = getMSTime();
uint32 oldMSTime2 = oldMSTime;
SpellInfo* spellInfo = NULL;
QueryResult result = WorldDatabase.Query("SELECT entry, attributes FROM spell_custom_attr");
if (!result)
TC_LOG_INFO("server.loading", ">> Loaded 0 spell custom attributes from DB. DB table `spell_custom_attr` is empty.");
else
{
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 spellId = fields[0].GetUInt32();
uint32 attributes = fields[1].GetUInt32();
spellInfo = mSpellInfoMap[spellId];
if (!spellInfo)
{
TC_LOG_ERROR("sql.sql", "Table `spell_custom_attr` has wrong spell (entry: %u), ignored.", spellId);
continue;
}
// TODO: validate attributes
spellInfo->AttributesCu |= attributes;
++count;
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u spell custom attributes from DB in %u ms", count, GetMSTimeDiffToNow(oldMSTime2));
}
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
spellInfo = mSpellInfoMap[i];
@@ -2826,171 +2857,6 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
if (spellInfo->SpellVisual[0] == 3879)
spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_BACK;
switch (spellInfo->Id)
{
case 1776: // Gouge
case 1777:
case 8629:
case 11285:
case 11286:
case 12540:
case 13579:
case 24698:
case 28456:
case 29425:
case 34940:
case 36862:
case 38764:
case 38863:
case 52743: // Head Smack
spellInfo->AttributesCu |= SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER;
break;
case 53: // Backstab
case 2589:
case 2590:
case 2591:
case 7159:
case 8627:
case 8721:
case 11279:
case 11280:
case 11281:
case 15582:
case 15657:
case 22416:
case 25300:
case 26863:
case 37685:
case 48656:
case 48657:
case 703: // Garrote
case 8631:
case 8632:
case 8633:
case 11289:
case 11290:
case 26839:
case 26884:
case 48675:
case 48676:
case 5221: // Shred
case 6800:
case 8992:
case 9829:
case 9830:
case 27001:
case 27002:
case 48571:
case 48572:
case 8676: // Ambush
case 8724:
case 8725:
case 11267:
case 11268:
case 11269:
case 27441:
case 48689:
case 48690:
case 48691:
case 6785: // Ravage
case 6787:
case 9866:
case 9867:
case 27005:
case 48578:
case 48579:
case 21987: // Lash of Pain
case 23959: // Test Stab R50
case 24825: // Test Backstab
case 58563: // Assassinate Restless Lookout
spellInfo->AttributesCu |= SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET;
break;
case 26029: // Dark Glare
case 37433: // Spout
case 43140: // Flame Breath
case 43215: // Flame Breath
case 70461: // Coldflame Trap
case 72133: // Pain and Suffering
case 73788: // Pain and Suffering
case 73789: // Pain and Suffering
case 73790: // Pain and Suffering
spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_LINE;
break;
case 24340: // Meteor
case 26558: // Meteor
case 28884: // Meteor
case 36837: // Meteor
case 38903: // Meteor
case 41276: // Meteor
case 57467: // Meteor
case 26789: // Shard of the Fallen Star
case 31436: // Malevolent Cleave
case 35181: // Dive Bomb
case 40810: // Saber Lash
case 43267: // Saber Lash
case 43268: // Saber Lash
case 42384: // Brutal Swipe
case 45150: // Meteor Slash
case 64688: // Sonic Screech
case 72373: // Shared Suffering
case 71904: // Chaos Bane
case 70492: // Ooze Eruption
case 72505: // Ooze Eruption
case 72624: // Ooze Eruption
case 72625: // Ooze Eruption
// ONLY SPELLS WITH SPELLFAMILY_GENERIC and EFFECT_SCHOOL_DAMAGE
spellInfo->AttributesCu |= SPELL_ATTR0_CU_SHARE_DAMAGE;
break;
case 18500: // Wing Buffet
case 33086: // Wild Bite
case 49749: // Piercing Blow
case 52890: // Penetrating Strike
case 53454: // Impale
case 59446: // Impale
case 62383: // Shatter
case 64777: // Machine Gun
case 65239: // Machine Gun
case 65919: // Impale
case 67858: // Impale
case 67859: // Impale
case 67860: // Impale
case 69293: // Wing Buffet
case 74439: // Machine Gun
case 63278: // Mark of the Faceless (General Vezax)
case 62544: // Thrust (Argent Tournament)
case 64588: // Thrust (Argent Tournament)
case 66479: // Thrust (Argent Tournament)
case 68505: // Thrust (Argent Tournament)
case 62709: // Counterattack! (Argent Tournament)
case 62626: // Break-Shield (Argent Tournament, Player)
case 64590: // Break-Shield (Argent Tournament, Player)
case 64342: // Break-Shield (Argent Tournament, NPC)
case 64686: // Break-Shield (Argent Tournament, NPC)
case 65147: // Break-Shield (Argent Tournament, NPC)
case 68504: // Break-Shield (Argent Tournament, NPC)
case 62874: // Charge (Argent Tournament, Player)
case 68498: // Charge (Argent Tournament, Player)
case 64591: // Charge (Argent Tournament, Player)
case 63003: // Charge (Argent Tournament, NPC)
case 63010: // Charge (Argent Tournament, NPC)
case 68321: // Charge (Argent Tournament, NPC)
case 72255: // Mark of the Fallen Champion (Deathbringer Saurfang)
case 72444: // Mark of the Fallen Champion (Deathbringer Saurfang)
case 72445: // Mark of the Fallen Champion (Deathbringer Saurfang)
case 72446: // Mark of the Fallen Champion (Deathbringer Saurfang)
spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR;
break;
case 64422: // Sonic Screech (Auriaya)
spellInfo->AttributesCu |= SPELL_ATTR0_CU_SHARE_DAMAGE;
spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR;
break;
case 72293: // Mark of the Fallen Champion (Deathbringer Saurfang)
spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0;
break;
default:
break;
}
switch (spellInfo->SpellFamilyName)
{
case SPELLFAMILY_WARRIOR: