コード例 #1
0
ファイル: SpellMgr.cs プロジェクト: SkelletonX/DDTServer
        public static void OnScriptCompiled(RoadEvent ev, object sender, EventArgs args)
        {
            SpellMgr.handles.Clear();
            int count = SpellMgr.SearchSpellHandlers(Assembly.GetAssembly(typeof(BaseGame)));

            //if (SpellMgr.log.IsInfoEnabled)
            //{
            SpellMgr.log.Info("SpellMgr: Loaded " + count + " spell handlers from GameServer Assembly!");
            //}
        }
コード例 #2
0
ファイル: SpellMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void ExecuteSpell(BaseGame game, Player player, ItemInfo item)
 {
     try
     {
         ISpellHandler spellHandler = SpellMgr.LoadSpellHandler(item.Template.Property3);
         spellHandler.Execute(game, player, item);
     }
     catch (Exception ex)
     {
         SpellMgr.log.Error("Execute Spell Error:", ex);
     }
 }
コード例 #3
0
        protected static int SearchSpellHandlers(Assembly assembly)
        {
            int num = 0;

            Type[] types = assembly.GetTypes();
            for (int i = 0; i < types.Length; i++)
            {
                Type type = types[i];
                if (type.IsClass && type.GetInterface("Game.Logic.Spells.ISpellHandler") != null)
                {
                    SpellAttibute[] array = (SpellAttibute[])type.GetCustomAttributes(typeof(SpellAttibute), true);
                    if (array.Length > 0)
                    {
                        num++;
                        SpellMgr.RegisterSpellHandler(array[0].Type, Activator.CreateInstance(type) as ISpellHandler);
                    }
                }
            }
            return(num);
        }