Advertisement
Guest User

Untitled

a guest
Sep 29th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1.     public static class SpellHandler
  2.     {
  3.         static Dictionary<int,ISpellHandler> _spellHandlers = new Dictionary<int, ISpellHandler>();
  4.  
  5.         public static void Initialize()
  6.         {
  7.             EventManager.SpellEvent += HandleSpellEvent;
  8.             AddHandler(349 /* Fiery Strike */, new FieryStrikeHandler());
  9.         }
  10.  
  11.         public static void AddHandler(int spellId, ISpellHandler handler)
  12.         {
  13.             if (_spellHandlers.ContainsKey(spellId))
  14.                 _spellHandlers[spellId] = handler;
  15.             else
  16.                 _spellHandlers.Add(spellId, handler);
  17.         }
  18.  
  19.         private static int HandleSpellEvent(SpellEventArgs args)
  20.         {
  21.             if (_spellHandlers.ContainsKey(args.Spell.Id))
  22.                 return _spellHandlers[args.Spell.Id].Handle(args);
  23.             return 0;
  24.         }
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement