Advertisement
Guest User

Untitled

a guest
Aug 25th, 2013
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. class remover : public WorldScript
  4. {
  5. public:
  6. remover() : WorldScript("remover") {}
  7. void OnStartup()
  8. {
  9. SpellInfoMap spellInfo;
  10. spellInfo.resize(sSpellStore.GetNumRows(), NULL);
  11. for(int i = 0; i < sSpellStore.GetNumRows(); ++i)
  12. {
  13. if (SpellEntry const* spellEntry = sSpellStore.LookupEntry(i))
  14. spellInfo[i] = new SpellInfo(spellEntry);
  15. }
  16.  
  17. sLog->outError(LOG_FILTER_GENERAL, "loaded %u spells, checking for all mounting spells...", spellInfo.size());
  18.  
  19. std::vector<uint32> mountedSpells;
  20.  
  21. for(SpellInfoMap::iterator itr = spellInfo.begin(); itr != spellInfo.end(); ++itr)
  22. {
  23. for(int i = 0; i < MAX_SPELL_EFFECTS; ++i)
  24. if(*itr && (*itr)->Effects[i].ApplyAuraName == SPELL_AURA_MOUNTED)
  25. mountedSpells.push_back((*itr)->Id);
  26. }
  27.  
  28. sLog->outError(LOG_FILTER_GENERAL, "loaded %u mounted spells, removing these spells from players...", mountedSpells.size());
  29.  
  30. uint32 counter = 0;
  31.  
  32. for(std::vector<uint32>::iterator itr = mountedSpells.begin(); itr != mountedSpells.end(); ++itr)
  33. {
  34. QueryResult result = CharacterDatabase.PQuery("SELECT * FROM `character_spell` WHERE `spell` = %u", *itr);
  35. if(!result)
  36. continue;
  37. CharacterDatabase.PExecute("DELETE FROM `character_spell` WHERE `spell` = %u", *itr);
  38. ++counter;
  39. }
  40.  
  41. sLog->outError(LOG_FILTER_GENERAL, "Removed %u spell(s) from characters", counter);
  42. }
  43. };
  44.  
  45. void AddSC_remover()
  46. {
  47. new remover;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement