public void ProcessPlayerWatchList()
        {
            PlayerList.Clear();
            MyAPIGateway.Players.GetPlayers(PlayerList);

            foreach (var player in PlayerList)
            {
                if (player.IsBot == true || player.Character == null)
                {
                    continue;
                }

                if (playerWatchList.ContainsKey(player) == true)
                {
                    //Regular Timers

                    if (Settings.General.EnableSpaceCargoShips == true)
                    {
                        playerWatchList[player].SpaceCargoShipTimer -= Settings.General.PlayerWatcherTimerTrigger;
                    }

                    if (Settings.General.EnablePlanetaryCargoShips == true)
                    {
                        playerWatchList[player].AtmoCargoShipTimer -= Settings.General.PlayerWatcherTimerTrigger;
                    }

                    if (Settings.General.EnableRandomEncounters == true)
                    {
                        //CoolDown Timers
                        if (playerWatchList[player].RandomEncounterCoolDownTimer > 0)
                        {
                            playerWatchList[player].RandomEncounterCoolDownTimer -= Settings.General.PlayerWatcherTimerTrigger;
                        }
                        else
                        {
                            playerWatchList[player].RandomEncounterCheckTimer -= Settings.General.PlayerWatcherTimerTrigger;
                        }

                        if (playerWatchList[player].RandomEncounterDistanceCoordCheck == Vector3D.Zero)
                        {
                            playerWatchList[player].RandomEncounterDistanceCoordCheck = player.GetPosition();
                        }
                    }

                    if (Settings.General.EnablePlanetaryInstallations == true)
                    {
                        if (playerWatchList[player].PlanetaryInstallationCooldownTimer > 0)
                        {
                            playerWatchList[player].PlanetaryInstallationCooldownTimer -= Settings.General.PlayerWatcherTimerTrigger;
                        }
                        else
                        {
                            playerWatchList[player].PlanetaryInstallationCheckTimer -= Settings.General.PlayerWatcherTimerTrigger;
                        }
                    }

                    if (Settings.General.EnableBossEncounters == true)
                    {
                        if (BossEncounterSpawner.IsPlayerInBossEncounter(player.IdentityId) == false)
                        {
                            if (playerWatchList[player].BossEncounterCooldownTimer > 0)
                            {
                                playerWatchList[player].BossEncounterCooldownTimer -= Settings.General.PlayerWatcherTimerTrigger;
                            }
                            else
                            {
                                playerWatchList[player].BossEncounterCheckTimer -= Settings.General.PlayerWatcherTimerTrigger;
                            }
                        }
                    }

                    //Apply Increment to Timers and Engage Spawners When Appropriate
                    if (playerWatchList[player].SpaceCargoShipTimer <= 0 && NPCWatcher.PendingNPCs.Count == 0)
                    {
                        playerWatchList[player].SpaceCargoShipTimer = rnd.Next(Settings.SpaceCargoShips.MinSpawnTime, Settings.SpaceCargoShips.MaxSpawnTime);
                        Logger.SkipNextMessage = true;
                        Logger.AddMsg("Attempting Space/Lunar Cargo Ship Spawn Near Player: " + player.DisplayName);
                        Logger.SkipNextMessage = true;
                        var spawnResult = SpaceCargoShipSpawner.AttemptSpawn(player.GetPosition());
                        Logger.AddMsg(spawnResult);
                    }

                    if (playerWatchList[player].AtmoCargoShipTimer <= 0 && NPCWatcher.PendingNPCs.Count == 0)
                    {
                        playerWatchList[player].AtmoCargoShipTimer = rnd.Next(Settings.PlanetaryCargoShips.MinSpawnTime, Settings.PlanetaryCargoShips.MaxSpawnTime);
                        Logger.SkipNextMessage = true;
                        Logger.AddMsg("Attempting Planetary Cargo Ship Spawn Near Player: " + player.DisplayName);
                        Logger.SkipNextMessage = true;
                        var spawnResult = PlanetaryCargoShipSpawner.AttemptSpawn(player.GetPosition());
                        Logger.AddMsg(spawnResult);
                    }

                    if (playerWatchList[player].RandomEncounterCheckTimer <= 0 && playerWatchList[player].RandomEncounterCoolDownTimer <= 0 && NPCWatcher.PendingNPCs.Count == 0)
                    {
                        playerWatchList[player].RandomEncounterCheckTimer = Settings.RandomEncounters.SpawnTimerTrigger;

                        if (Vector3D.Distance(player.GetPosition(), playerWatchList[player].RandomEncounterDistanceCoordCheck) >= Settings.RandomEncounters.PlayerTravelDistance)
                        {
                            playerWatchList[player].RandomEncounterDistanceCoordCheck = player.GetPosition();
                            Logger.SkipNextMessage = true;
                            Logger.AddMsg("Attempting Random Encounter Spawn Near Player: " + player.DisplayName);
                            Logger.SkipNextMessage = true;
                            var spawnResult = RandomEncounterSpawner.AttemptSpawn(player.GetPosition());
                            Logger.AddMsg(spawnResult);

                            if (spawnResult.StartsWith("Spawning Group - ") == true)
                            {
                                playerWatchList[player].RandomEncounterCoolDownTimer = Settings.RandomEncounters.PlayerSpawnCooldown;
                            }
                        }
                    }

                    if (playerWatchList[player].PlanetaryInstallationCheckTimer <= 0 && playerWatchList[player].PlanetaryInstallationCooldownTimer <= 0 && NPCWatcher.PendingNPCs.Count == 0)
                    {
                        playerWatchList[player].PlanetaryInstallationCheckTimer = Settings.PlanetaryInstallations.SpawnTimerTrigger;
                        Logger.SkipNextMessage = true;
                        Logger.AddMsg("Attempting Planetary Installation Spawn Near Player: " + player.DisplayName);
                        Logger.SkipNextMessage = true;
                        var spawnResult = PlanetaryInstallationSpawner.AttemptSpawn(player.GetPosition(), player);
                        Logger.AddMsg(spawnResult);

                        if (spawnResult.StartsWith("Spawning Group - ") == true)
                        {
                            playerWatchList[player].PlanetaryInstallationCooldownTimer = Settings.PlanetaryInstallations.PlayerSpawnCooldown;
                        }
                    }

                    if (playerWatchList[player].BossEncounterCheckTimer <= 0 && NPCWatcher.PendingNPCs.Count == 0)
                    {
                        playerWatchList[player].BossEncounterCheckTimer = Settings.BossEncounters.SpawnTimerTrigger;
                        Logger.SkipNextMessage = true;
                        Logger.AddMsg("Attempting Boss Encounter Spawn Near Player: " + player.DisplayName);
                        Logger.SkipNextMessage = true;
                        var spawnResult = BossEncounterSpawner.AttemptSpawn(player.GetPosition());
                        Logger.AddMsg(spawnResult);

                        if (spawnResult.StartsWith("Boss Encounter GPS Created") == true)
                        {
                            playerWatchList[player].BossEncounterCooldownTimer = Settings.BossEncounters.PlayerSpawnCooldown;
                        }
                    }
                }
                else
                {
                    var newPlayerWatcher = new PlayerWatcher();
                    playerWatchList.Add(player, newPlayerWatcher);
                }
            }
        }
示例#2
0
        //SpawnPlanetaryInstallation
        public static bool SpawnPlanetaryInstallation(Vector3D coords, List <string> spawnGroups)
        {
            var result = PlanetaryInstallationSpawner.AttemptSpawn(coords, null, spawnGroups);

            return(result.StartsWith("Spawning Group - "));
        }