Пример #1
0
        private static void CompleteSpawning()
        {
            if (_spawnMatrix == MatrixD.Identity)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Coords Could Not Be Calculated. Aborting Process", DebugTypeEnum.Spawn);
                PerformNextSpawn();
                return;
            }

            Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Sending SpawnData to MES", DebugTypeEnum.Spawn);
            var velocity = Vector3D.Transform(_currentSpawn.RelativeSpawnVelocity, _spawnMatrix) - _spawnMatrix.Translation;
            var result   = MESApi.CustomSpawnRequest(_currentSpawn.SpawnGroups, _spawnMatrix, velocity, _currentSpawn.IgnoreSafetyChecks, _currentSpawn.CurrentFactionTag, _currentSpawn.ProfileSubtypeId);

            if (result == true)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Successful", DebugTypeEnum.Spawn);
                _currentSpawn.SpawnCount++;
                _currentSpawn.LastSpawnTime = MyAPIGateway.Session.GameDateTime;
            }
            else
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Failed", DebugTypeEnum.Spawn);
            }

            PerformNextSpawn();
        }
Пример #2
0
        private static void CompleteSpawning()
        {
            if (_spawnMatrix == MatrixD.Identity)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Coords Could Not Be Calculated. Aborting Process", DebugTypeEnum.Spawn);
                PerformNextSpawn();
                return;
            }

            if (_currentSpawn.SpawningType == SpawnTypeEnum.CustomSpawn)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Sending CustomSpawn Data to MES", DebugTypeEnum.Spawn);
                var velocity = Vector3D.Transform(_currentSpawn.RelativeSpawnVelocity, _spawnMatrix) - _spawnMatrix.Translation;
                var result   = MESApi.CustomSpawnRequest(_currentSpawn.SpawnGroups, _spawnMatrix, velocity, _currentSpawn.IgnoreSafetyChecks, _currentSpawn.CurrentFactionTag, _currentSpawn.ProfileSubtypeId);

                if (result == true)
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Successful", DebugTypeEnum.Spawn);
                    _currentSpawn.SpawnCount++;
                    _currentSpawn.LastSpawnTime = MyAPIGateway.Session.GameDateTime;
                }
                else
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Failed", DebugTypeEnum.Spawn);
                }
            }

            if (_currentSpawn.SpawningType == SpawnTypeEnum.SpaceCargoShip)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Sending SpaceCargoShip Data to MES", DebugTypeEnum.Spawn);
                var spawns = _currentSpawn.SpawnGroups.Count > 0 ? _currentSpawn.SpawnGroups : null;
                var result = MESApi.SpawnSpaceCargoShip(_spawnMatrix.Translation, spawns);

                if (result == true)
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Successful", DebugTypeEnum.Spawn);
                    _currentSpawn.SpawnCount++;
                    _currentSpawn.LastSpawnTime = MyAPIGateway.Session.GameDateTime;
                }
                else
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Failed", DebugTypeEnum.Spawn);
                }
            }

            if (_currentSpawn.SpawningType == SpawnTypeEnum.RandomEncounter)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Sending RandomEncounter Data to MES", DebugTypeEnum.Spawn);
                var spawns = _currentSpawn.SpawnGroups.Count > 0 ? _currentSpawn.SpawnGroups : null;
                var result = MESApi.SpawnRandomEncounter(_spawnMatrix.Translation, spawns);

                if (result == true)
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Successful", DebugTypeEnum.Spawn);
                    _currentSpawn.SpawnCount++;
                    _currentSpawn.LastSpawnTime = MyAPIGateway.Session.GameDateTime;
                }
                else
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Failed", DebugTypeEnum.Spawn);
                }
            }

            if (_currentSpawn.SpawningType == SpawnTypeEnum.PlanetaryCargoShip)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Sending PlanetaryCargoShip Data to MES", DebugTypeEnum.Spawn);
                var spawns = _currentSpawn.SpawnGroups.Count > 0 ? _currentSpawn.SpawnGroups : null;
                var result = MESApi.SpawnPlanetaryCargoShip(_spawnMatrix.Translation, spawns);

                if (result == true)
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Successful", DebugTypeEnum.Spawn);
                    _currentSpawn.SpawnCount++;
                    _currentSpawn.LastSpawnTime = MyAPIGateway.Session.GameDateTime;
                }
                else
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Failed", DebugTypeEnum.Spawn);
                }
            }

            if (_currentSpawn.SpawningType == SpawnTypeEnum.PlanetaryInstallation)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Sending PlanetaryInstallation Data to MES", DebugTypeEnum.Spawn);
                var spawns = _currentSpawn.SpawnGroups.Count > 0 ? _currentSpawn.SpawnGroups : null;
                var result = MESApi.SpawnPlanetaryInstallation(_spawnMatrix.Translation, spawns);

                if (result == true)
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Successful", DebugTypeEnum.Spawn);
                    _currentSpawn.SpawnCount++;
                    _currentSpawn.LastSpawnTime = MyAPIGateway.Session.GameDateTime;
                }
                else
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Failed", DebugTypeEnum.Spawn);
                }
            }

            if (_currentSpawn.SpawningType == SpawnTypeEnum.BossEncounter)
            {
                Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Sending BossEncounter Data to MES", DebugTypeEnum.Spawn);
                var spawns = _currentSpawn.SpawnGroups.Count > 0 ? _currentSpawn.SpawnGroups : null;
                var result = MESApi.SpawnBossEncounter(_spawnMatrix.Translation, spawns);

                if (result == true)
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Successful", DebugTypeEnum.Spawn);
                    _currentSpawn.SpawnCount++;
                    _currentSpawn.LastSpawnTime = MyAPIGateway.Session.GameDateTime;
                }
                else
                {
                    Logger.MsgDebug(_currentSpawn.ProfileSubtypeId + ": Spawn Failed", DebugTypeEnum.Spawn);
                }
            }

            PerformNextSpawn();
        }