Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 14th, 2012  |  syntax: None  |  size: 2.03 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * Copyright (C) 2005-2011 MaNGOS <http://www.getmangos.com/>
  3.  *
  4.  * Copyright (C) 2008-2011 Trinity <http://www.trinitycore.org/>
  5.  *
  6.  * Copyright (C) 2010-2011 Project SkyFire <http://www.projectskyfire.org/>
  7.  *
  8.  * This program is free software; you can redistribute it and/or modify
  9.  * it under the terms of the GNU General Public License as published by
  10.  * the Free Software Foundation; either version 2 of the License, or
  11.  * (at your option) any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16.  * GNU General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to the Free Software
  20.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21.  */
  22.  
  23. #include "gamePCH.h"
  24. #include "MagePlayer.h"
  25. #include "ScriptPCH.h"
  26.  
  27. class player_mage_scripts : public PlayerScript
  28. {
  29. public:
  30.     player_mage_scripts() : PlayerScript("player_mage_scripts") {}
  31.  
  32.     void OnSpellCastWithProto(Player* player, SpellEntry const *spellProto)
  33.     {
  34.         if (player->getClass() == CLASS_MAGE && spellProto->Id != 7268 && spellProto->Id != 5143 && !player->HasAura(79683))
  35.         {
  36.             if (SpellEffectEntry const* spellEffect = spellProto->GetSpellEffect(EFFECT_0))
  37.             {
  38.                 if (spellEffect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
  39.                 {
  40.                     uint32 Chance = urand(1, 5); // Every number has %20 chance
  41.                     if (player->HasSpell(5143) && (Chance == 1 || Chance == 2)) // 40% Chance
  42.                         player->CastSpell(player, 79683, true);
  43.                 }
  44.             }
  45.         }
  46.     }
  47.     void OnAura(Player* player, SpellEntry const *spellProto)
  48.     {
  49.         if (spellProto->Id == 80353 && !player->HasAura(80354))
  50.             player->AddAura(80354, player);
  51.     }
  52. };
  53.  
  54. void AddSC_player_mage_scripts()
  55. {
  56.     new player_mage_scripts;
  57. }