Permalink
Browse files

Core/Spells: Cleaned up and removed hack code from aura 332.

thats to: Darkpeninsula

Signed-off-by: Bootz <bootz@projectskyfire.org>
  • Loading branch information...
1 parent 99e7886 commit 5f8cbe0cc0ef6ce1b1d9ce9f8327b73286a63930 @Bootz Bootz committed May 2, 2012
@@ -0,0 +1,21 @@
+CREATE TABLE IF NOT EXISTS `spell_override` (
+ `overrideSpell` INT(10) UNSIGNED NOT NULL DEFAULT '0',
+ `affSpell` INT(10) NOT NULL DEFAULT '0',
+ `aura` INT(10) NOT NULL DEFAULT '0',
+ `comment` LONGTEXT NOT NULL DEFAULT '',
+ PRIMARY KEY (`overrideSpell`)
+) ENGINE=MYISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;
+
+INSERT INTO spell_override VALUES
+(93402,8921,48517,"Eclipse (Solar)"),
+(91183,82731,0,"Frostfire orb"),
+(88625,2050,0,"Chakra: Holy Word: Chastise"),
+(88684,88625,0,"Chakra: Holy Word: Serenity"),
+(88685,88625,0,"Chakra: Holy Word: Sanctuary"),
+-- idky these are on spell-override there not aura 332
+(86213,86121,0,"Soul Swap: Exhale"),
+(91711,6229,9173,"Nether Ward Talent"),
+(92315,11366,0,"Pyroblast!"),
+(82928,19434,0,"Aimed Shot!"),
+(89420,689,0,"Drain Life"),
+(81170,6785,0,"Ravage");
@@ -6107,61 +6107,23 @@ void AuraEffect::HandleAuraSwapSpells(AuraApplication const * aurApp, uint8 mode
uint32 overrideId = GetAmount();
- if (!overrideId)
- return;
- SpellEntry const* spell = sSpellStore.LookupEntry(overrideId);
- if (!spell)
- return;
- uint32 affspell = 0;
+ ActionBarSpellOverride const* spellOverride = sSpellMgr->GetActionBarSpellOverride(overrideId);
- if (overrideId == 93402) // Sunfire
- {
- if (target->HasAura(48517)) // Sunfire talent
- affspell = 8921; // Moonfire
- else
- return;
- }
-
- if (overrideId == 91711)
- {
- if (target->HasAura(91713)) // The nether ward talent
- affspell = 6229;
- else
- return;
- }
-
- if (overrideId == 92315) // Pyroblast
- affspell = 11366;
-
- if (overrideId == 82928) // Fire!
- affspell = 19434;
-
- if (overrideId == 89420) // Drain Life
- affspell = 689;
-
- if (overrideId == 81170) // Ravage
- affspell = 6785;
-
- if (overrideId == 93402) // Eclipse (Solar)
- affspell = 8921;
-
- if (overrideId == 92283) // Frostfire Orb Override
- affspell = 82731;
-
- if (overrideId == 88625) // Chakra: Serenity
- affspell = 2050;
+ if(!spellOverride)
+ return;
- if (overrideId == 86213) // Soul Swap: Exhale
- affspell = 86121;
+ uint32 aura = spellOverride->aura;
+ uint32 affSpell = spellOverride->affSpell;
- if (overrideId == 88684 || overrideId == 88685) // Chakra
- affspell = 88625;
+ //Check Aura
+ if(aura > 0 && !target->HasAura(aura))
+ return;
if (apply)
{
target->AddTemporarySpell(overrideId);
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
- data << uint32(affspell); // here should be affected spell - not really necessary, after casting the real spell again, it auto-fixes
+ data << uint32(affSpell);
data << uint32(overrideId);
target->GetSession()->SendPacket(&data);
}
@@ -6170,7 +6132,7 @@ void AuraEffect::HandleAuraSwapSpells(AuraApplication const * aurApp, uint8 mode
target->RemoveTemporarySpell(overrideId);
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(overrideId);
- data << uint32(affspell); // here should be affected spell - not really necessary, after casting the real spell again, it auto-fixes
+ data << uint32(affSpell);
target->GetSession()->SendPacket(&data);
}
}
@@ -2696,6 +2696,61 @@ void SpellMgr::LoadSpellAreas()
sLog->outString();
}
+void SpellMgr::LoadActionBarSpellOverride()
+{
+ uint32 oldMSTime = getMSTime();
+ mActionBarSpellOverrideMap.clear();
+
+ QueryResult result = WorldDatabase.Query("SELECT overrideSpell, affSpell, aura FROM spell_override ORDER BY overrideSpell ASC");
+
+ if (!result)
+ {
+ sLog->outString(">> Loaded 0 actionbar spell overrides. DB table `spell_override` is empty.");
+ sLog->outString();
+ return;
+ }
+
+ do
+ {
+ Field *fields = result->Fetch();
+
+ uint32 overrideSpell = fields[0].GetUInt32();
+ uint32 affSpell = fields[1].GetUInt32();
+ uint32 aura = fields[2].GetUInt32();
+
+ if(!sSpellStore.LookupEntry(overrideSpell))
+ {
+ sLog->outErrorDb("Spell (overrideSpell) %u listed in `spell_override` does not exist", overrideSpell);
+ continue;
+ }
+
+ if(!sSpellStore.LookupEntry(affSpell))
+ {
+ sLog->outErrorDb("Spell (affSpell) %u listed in `spell_override` does not exist", affSpell);
+ continue;
+ }
+
+ if(aura > 0)
+ {
+ if(!sSpellStore.LookupEntry(aura))
+ {
+ sLog->outErrorDb("Spell (aura) %u listed in `spell_override` does not exist", aura);
+ continue;
+ }
+ }
+
+ ActionBarSpellOverride actbarSpellov;
+ actbarSpellov.affSpell = affSpell;
+ actbarSpellov.aura = aura;
+
+ mActionBarSpellOverrideMap[overrideSpell]= actbarSpellov;
+ }
+ while (result->NextRow());
+
+ sLog->outString(">> Loaded %u actionbar spell overrides in %u ms", mActionBarSpellOverrideMap.size(), GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
+}
+
void SpellMgr::LoadSpellInfoStore()
{
uint32 oldMSTime = getMSTime();
@@ -2830,6 +2885,16 @@ void SpellMgr::LoadSpellInfoStore()
sLog->outString();
}
+ActionBarSpellOverride const* SpellMgr::GetActionBarSpellOverride(uint32 overrideSpell) const
+{
+ ActionBarSpellOverrideMap::const_iterator itr = mActionBarSpellOverrideMap.find(overrideSpell);
+
+ if(itr == mActionBarSpellOverrideMap.end())
+ return NULL;
+ else
+ return &itr->second;
+}
+
void SpellMgr::UnloadSpellInfoStore()
{
for (uint32 i = 0; i < mSpellInfoMap.size(); ++i)
@@ -337,6 +337,14 @@ enum SpellGroup
SPELL_GROUP_CORE_RANGE_MAX = 5,
};
+struct ActionBarSpellOverride
+{
+ uint32 affSpell;
+ uint32 aura;
+};
+
+typedef UNORDERED_MAP<uint32, ActionBarSpellOverride> ActionBarSpellOverrideMap;
+
#define SPELL_GROUP_DB_RANGE_MIN 1000
// spell_id, group_id
@@ -548,9 +556,9 @@ class SpellMgr
SpellMgr();
~SpellMgr();
- // Accessors (const or static functions)
+ // Assessors (const or static functions)
public:
- // Spell correctess for client using
+ // Spell correctness for client using
static bool IsSpellValid(SpellInfo const* spellInfo, Player* player = NULL, bool msg = true);
// Spell difficulty
@@ -605,6 +613,9 @@ class SpellMgr
SpellProcEntry const* GetSpellProcEntry(uint32 spellId) const;
bool CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo);
+ // Actionbar override spell
+ ActionBarSpellOverride const* GetActionBarSpellOverride(uint32 overrideSpell) const;
+
// Spell bonus data table
SpellBonusEntry const* GetSpellBonusData(uint32 spellId) const;
@@ -662,6 +673,7 @@ class SpellMgr
void UnloadSpellInfoStore();
//void UnloadSpellInfoImplicitTargetConditionLists();
void LoadSpellCustomAttr();
+ void LoadActionBarSpellOverride();
private:
SpellDifficultySearcherMap mSpellDifficultySearcherMap;
@@ -692,6 +704,7 @@ class SpellMgr
PetLevelupSpellMap mPetLevelupSpellMap;
PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry
SpellInfoMap mSpellInfoMap;
+ ActionBarSpellOverrideMap mActionBarSpellOverrideMap;
};
#define sSpellMgr ACE_Singleton<SpellMgr, ACE_Null_Mutex>::instance()
@@ -1336,6 +1336,9 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading spell custom attributes...");
sSpellMgr->LoadSpellCustomAttr();
+ sLog->outString("Loading Actionbar Spell overrides...");
+ sSpellMgr->LoadActionBarSpellOverride();
+
sLog->outString("Loading Script Names...");
sObjectMgr->LoadScriptNames();

6 comments on commit 5f8cbe0

Contributor

Bootz replied May 2, 2012

nice typo... thats to = thanks to :/

Contributor

Kr4v3n5 replied May 2, 2012

Great work, thanx

Contributor

tuxity replied May 2, 2012

Should be done with SpellFamilyFlags/SpellClassMask not ugly like that :P

SMSG_SUPERCEDED_SPELL ain't the real opcode.

We still have to find it :)

Contributor

totomakers replied May 2, 2012

Ahah, thx but i have made a pull request and they have told me "No it's Hacky"
https://github.com/seraphinchaos/SkyFireEMU/commit/80739afbba662ab637790a46897815548da329e0

Contributor

tuxity replied May 2, 2012

Don't worry, still hacky ! :P

Please sign in to comment.