Ejemplo n.º 1
0
 public override void Load(bool startup)
 {
     OnPlayerMoveEvent.Register(HandlePlayerMove, Priority.High);
     OnPlayerDisconnectEvent.Register(HandlePlayerDisconnect, Priority.High);
     OnLevelUnloadEvent.Register(HandleLevelUnload, Priority.High);
     OnPlayerSpawningEvent.Register(HandlePlayerSpawning, Priority.High);
 }
Ejemplo n.º 2
0
 public override void Unload(bool shutdown)
 {
     OnPlayerMoveEvent.Unregister(HandlePlayerMove);
     OnPlayerDisconnectEvent.Unregister(HandlePlayerDisconnect);
     OnLevelUnloadEvent.Unregister(HandleLevelUnload);
     OnPlayerSpawningEvent.Unregister(HandlePlayerSpawning);
 }
Ejemplo n.º 3
0
        public override void Load(bool startup)
        {
            Command.Register(new CmdReloadEffects());
            Command.Register(new CmdEffect());
            Command.Register(new CmdSpawner());

            rnd = new Random();
            LoadEffects();
            DefineEffectsAll();


            OnPlayerFinishConnectingEvent.Register(OnPlayerFinishConnecting, Priority.Low);
            OnLevelLoadedEvent.Register(OnLevelLoaded, Priority.Low);
            OnLevelUnloadEvent.Register(OnLevelUnload, Priority.Low);
            OnLevelDeletedEvent.Register(OnLevelDeleted, Priority.Low);
            OnLevelCopiedEvent.Register(OnLevelCopied, Priority.Low);
            OnLevelRenamedEvent.Register(OnLevelRenamed, Priority.Low);

            SpawnersFile.cache = new ThreadSafeCache();
            if (!Directory.Exists(SpawnersFile.spawnerDirectory))
            {
                Directory.CreateDirectory(SpawnersFile.spawnerDirectory);
            }
            Level[] levels = LevelInfo.Loaded.Items;
            foreach (Level level in levels)
            {
                SpawnersFile.Load(level);
            }
            spawnerAccum = 0;
            ActivateSpawners();
        }
Ejemplo n.º 4
0
        protected virtual void UnhookEventHandlers()
        {
            OnLevelUnloadEvent.Unregister(HandleLevelUnload);
            OnSendingHeartbeatEvent.Unregister(HandleSendingHeartbeat);
            OnSQLSaveEvent.Unregister(SaveStats);

            OnPlayerActionEvent.Unregister(HandlePlayerAction);
            OnPlayerDisconnectEvent.Unregister(HandlePlayerDisconnect);
        }
Ejemplo n.º 5
0
        protected virtual void HookEventHandlers()
        {
            OnLevelUnloadEvent.Register(HandleLevelUnload, Priority.High);
            OnSendingHeartbeatEvent.Register(HandleSendingHeartbeat, Priority.High);
            OnSQLSaveEvent.Register(SaveStats, Priority.High);

            OnPlayerActionEvent.Register(HandlePlayerAction, Priority.High);
            OnPlayerDisconnectEvent.Register(HandlePlayerDisconnect, Priority.High);
        }
Ejemplo n.º 6
0
 public override void Unload(bool shutdown)
 {
     OnEntitySpawnedEvent.Unregister(HandleEntitySpawned);
     OnTabListEntryAddedEvent.Unregister(HandleTabListEntryAdded);
     OnMoneyChangedEvent.Unregister(HandleMoneyChanged);
     OnPlayerConnectEvent.Unregister(HandlePlayerConnect);
     OnPlayerDisconnectEvent.Unregister(HandlePlayerDisconnect);
     OnPlayerMoveEvent.Unregister(HandlePlayerMove);
     OnPlayerActionEvent.Unregister(HandlePlayerAction);
     OnPlayerSpawningEvent.Unregister(HandlePlayerSpawning);
     OnBlockChangeEvent.Unregister(HandleBlockChange);
     OnLevelUnloadEvent.Unregister(HandleLevelUnload);
 }
Ejemplo n.º 7
0
 public override void Load(bool startup)
 {
     OnEntitySpawnedEvent.Register(HandleEntitySpawned, Priority.High);
     OnTabListEntryAddedEvent.Register(HandleTabListEntryAdded, Priority.High);
     OnMoneyChangedEvent.Register(HandleMoneyChanged, Priority.High);
     OnPlayerConnectEvent.Register(HandlePlayerConnect, Priority.High);
     OnPlayerDisconnectEvent.Register(HandlePlayerDisconnect, Priority.High);
     OnPlayerMoveEvent.Register(HandlePlayerMove, Priority.High);
     OnPlayerActionEvent.Register(HandlePlayerAction, Priority.High);
     OnPlayerSpawningEvent.Register(HandlePlayerSpawning, Priority.High);
     OnBlockChangeEvent.Register(HandleBlockChange, Priority.High);
     OnLevelUnloadEvent.Register(HandleLevelUnload, Priority.High);
 }
Ejemplo n.º 8
0
        public override void Unload(bool shutdown)
        {
            OnPlayerDeathEvent.Unregister(HandlePlayerDeath);
            OnPlayerChatEvent.Unregister(HandlePlayerChat);
            OnPlayerCommandEvent.Unregister(HandlePlayerCommand);

            OnBlockChangeEvent.Unregister(HandleBlockChange);
            OnPlayerDisconnectEvent.Unregister(HandleDisconnect);
            OnLevelUnloadEvent.Unregister(HandleLevelUnload);

            OnPlayerSpawningEvent.Unregister(HandlePlayerSpawning);
            OnTabListEntryAddedEvent.Unregister(HandleTabListEntryAdded);
            OnJoinedLevelEvent.Unregister(HandleOnJoinedLevel);
        }
Ejemplo n.º 9
0
        public override void Load(bool startup)
        {
            OnPlayerDeathEvent.Register(HandlePlayerDeath, Priority.High);
            OnPlayerChatEvent.Register(HandlePlayerChat, Priority.High);
            OnPlayerCommandEvent.Register(HandlePlayerCommand, Priority.High);

            OnBlockChangeEvent.Register(HandleBlockChange, Priority.High);
            OnPlayerDisconnectEvent.Register(HandleDisconnect, Priority.High);
            OnLevelUnloadEvent.Register(HandleLevelUnload, Priority.High);

            OnPlayerSpawningEvent.Register(HandlePlayerSpawning, Priority.High);
            OnTabListEntryAddedEvent.Register(HandleTabListEntryAdded, Priority.High);
            OnJoinedLevelEvent.Register(HandleOnJoinedLevel, Priority.High);
        }
Ejemplo n.º 10
0
        void InitServerTask(SchedulerTask task)
        {
            Server.Start();
            // The first check for updates is run after 10 seconds, subsequent ones every two hours
            Server.Background.QueueRepeat(Updater.UpdaterTask, null, TimeSpan.FromSeconds(10));

            OnPlayerConnectEvent.Register(Player_PlayerConnect, Priority.Low);
            OnPlayerDisconnectEvent.Register(Player_PlayerDisconnect, Priority.Low);
            OnJoinedLevelEvent.Register(Player_OnJoinedLevel, Priority.Low);

            OnLevelLoadedEvent.Register(Level_LevelLoaded, Priority.Low);
            OnLevelUnloadEvent.Register(Level_LevelUnload, Priority.Low);

            RunOnUiThread(() => main_btnProps.Enabled = true);
        }
Ejemplo n.º 11
0
        public override void Unload(bool shutdown)
        {
            Command.Unregister(Command.Find("ReloadEffects"));
            Command.Unregister(Command.Find("Effect"));
            Command.Unregister(Command.Find("Spawner"));

            OnPlayerFinishConnectingEvent.Unregister(OnPlayerFinishConnecting);
            OnLevelLoadedEvent.Unregister(OnLevelLoaded);
            OnLevelUnloadEvent.Unregister(OnLevelUnload);
            OnLevelDeletedEvent.Unregister(OnLevelDeleted);
            OnLevelCopiedEvent.Unregister(OnLevelCopied);
            OnLevelRenamedEvent.Unregister(OnLevelRenamed);

            spawnersAtLevel.Clear();
            instance.Cancel(tickSpawners);
        }