public bool Load(out string error)
 {
     error = string.Empty;
     try
     {
         foreach (Assembly asm in assemblies)
         {
             ObjectUpdateManager.SearchAssemblyForUpdateObjects(asm);
             foreach (Type type in asm.GetTypes())
             {
                 if (type.IsClass == false)
                 {
                     continue;
                 }
                 if (type.BaseType == typeof(PlayerObject))
                 {
                     if (PlayerObjectType != typeof(PlayerObject))
                     {
                         Unload();
                         error = "You can only have 1 custom player object in scripts.";
                         return(false);
                     }
                     PlayerObjectType = type;
                 }
                 if (type.IsDefined(typeof(ScriptPacketHandler), true))
                 {
                     RegisterScriptPacketHandler(type);
                 }
                 if (type.IsDefined(typeof(WorldPacketHandler), true))
                 {
                     RegisterClientPacketHandler(type);
                 }
                 if (type.IsDefined(typeof(ChatCmdHandler), true))
                 {
                     RegisterChatHandler(type);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Unload();
         error = e.Message;
         return(false);
     }
     WorldServer.Scripts = this;
     return(true);
 }
Exemplo n.º 2
0
 static WorldServer()
 {
     ObjectUpdateManager.SearchAssemblyForUpdateObjects(Assembly.GetExecutingAssembly());
     WorldPacketManager.SearchAssemblyForHandlers(Assembly.GetExecutingAssembly());
     m_scriptManager = ScriptManager.GetScriptManager();
 }