Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- class remover : public WorldScript
- {
- public:
- remover() : WorldScript("remover") {}
- void OnStartup()
- {
- SpellInfoMap spellInfo;
- spellInfo.resize(sSpellStore.GetNumRows(), NULL);
- for(int i = 0; i < sSpellStore.GetNumRows(); ++i)
- {
- if (SpellEntry const* spellEntry = sSpellStore.LookupEntry(i))
- spellInfo[i] = new SpellInfo(spellEntry);
- }
- sLog->outError(LOG_FILTER_GENERAL, "loaded %u spells, checking for all mounting spells...", spellInfo.size());
- std::vector<uint32> mountedSpells;
- for(SpellInfoMap::iterator itr = spellInfo.begin(); itr != spellInfo.end(); ++itr)
- {
- for(int i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if(*itr && (*itr)->Effects[i].ApplyAuraName == SPELL_AURA_MOUNTED)
- mountedSpells.push_back((*itr)->Id);
- }
- sLog->outError(LOG_FILTER_GENERAL, "loaded %u mounted spells, removing these spells from players...", mountedSpells.size());
- uint32 counter = 0;
- for(std::vector<uint32>::iterator itr = mountedSpells.begin(); itr != mountedSpells.end(); ++itr)
- {
- QueryResult result = CharacterDatabase.PQuery("SELECT * FROM `character_spell` WHERE `spell` = %u", *itr);
- if(!result)
- continue;
- CharacterDatabase.PExecute("DELETE FROM `character_spell` WHERE `spell` = %u", *itr);
- ++counter;
- }
- sLog->outError(LOG_FILTER_GENERAL, "Removed %u spell(s) from characters", counter);
- }
- };
- void AddSC_remover()
- {
- new remover;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement