public void DetailedInfo(string input) { if (!PlayersHanger.ParseInput(input, out int ID)) { Chat.Respond($"Grid {input} could not be found!"); return; } PlayersHanger = new PlayerHangar(SteamID, Chat); PlayersHanger.DetailedReport(ID); }
public void LoadGrid(int ID, bool LoadNearPlayer) { if (!PerformMainChecks(false)) { return; } if (!PlayersHanger.LoadGrid(ID, out IEnumerable <MyObjectBuilder_CubeGrid> Grids, out GridStamp Stamp)) { Log.Error($"Loading grid {ID} failed for {IdentityID}!"); Chat.Respond("Loading grid failed! Report this to staff and check logs for more info!"); return; } if (!PlayersHanger.CheckLimits(Stamp, Grids)) { return; } if (!CheckEnemyDistance(Config.LoadType, Stamp.GridSavePosition)) { return; } if (!RequireLoadCurrency(Stamp)) { return; } PluginDependencies.BackupGrid(Grids.ToList(), IdentityID); Vector3D SpawnPos = DetermineSpawnPosition(Stamp.GridSavePosition, PlayerPosition, out bool KeepOriginalPosition, LoadNearPlayer); if (!CheckDistanceToLoadPoint(SpawnPos)) { return; } ParallelSpawner Spawner = new ParallelSpawner(Grids, Chat, !KeepOriginalPosition, SpawnedGridsSuccessful); Log.Info("Attempting Grid Spawning @" + SpawnPos.ToString()); if (Spawner.Start(KeepOriginalPosition, SpawnPos)) { Chat?.Respond("Spawning Complete!"); PlayersHanger.RemoveGridStamp(Stamp); } else { Chat?.Respond("An error occured while spawning the grid!"); } }
public void RemoveGrid(string input) { if (!PlayersHanger.ParseInput(input, out int ID)) { Chat.Respond($"Grid {input} could not be found!"); return; } PlayersHanger = new PlayerHangar(SteamID, Chat); if (PlayersHanger.RemoveGridStamp(ID)) { Chat.Respond("Successfully removed grid!"); } }
public void LoadGrid(string input, bool LoadNearPlayer) { if (!PerformMainChecks(false)) { return; } if (!PlayersHanger.ParseInput(input, out int ID)) { Chat.Respond($"Grid {input} could not be found!"); return; } if (!PlayersHanger.TryGetGridStamp(ID, out GridStamp Stamp)) { return; } //Check to see if the grid is for sale. We need to let the player know if it is if (!CheckGridForSale(Stamp, ID)) { return; } if (!PlayersHanger.LoadGrid(Stamp, out IEnumerable <MyObjectBuilder_CubeGrid> Grids)) { Log.Error($"Loading grid {ID} failed for {IdentityID}!"); Chat.Respond("Loading grid failed! Report this to staff and check logs for more info!"); return; } if (!PlayersHanger.CheckLimits(Stamp, Grids)) { return; } if (!CheckEnemyDistance(Config.LoadType, Stamp.GridSavePosition) && !Config.AllowLoadNearEnemy) { return; } if (!RequireLoadCurrency(Stamp)) { return; } PluginDependencies.BackupGrid(Grids.ToList(), IdentityID); Vector3D SpawnPos = DetermineSpawnPosition(Stamp.GridSavePosition, PlayerPosition, out bool KeepOriginalPosition, LoadNearPlayer); if (!CheckDistanceToLoadPoint(SpawnPos)) { return; } if (PluginDependencies.NexusInstalled && Config.NexusAPI && NexusSupport.RelayLoadIfNecessary(SpawnPos, ID, LoadNearPlayer, Chat, SteamID, IdentityID, PlayerPosition)) { return; } ParallelSpawner Spawner = new ParallelSpawner(Grids, Chat, SpawnedGridsSuccessful); Log.Info("Attempting Grid Spawning @" + SpawnPos.ToString()); if (Spawner.Start(SpawnPos, KeepOriginalPosition)) { Chat?.Respond("Spawning Complete!"); PlayersHanger.RemoveGridStamp(ID); } else { Chat?.Respond("An error occured while spawning the grid!"); } }
public async void SaveGrid() { if (!PerformMainChecks(true)) { return; } if (!PlayersHanger.CheckHanagarLimits()) { return; } GridResult Result = new GridResult(); //Gets grids player is looking at if (!Result.GetGrids(Chat, UserCharacter)) { return; } if (IsAnyGridInsideSafeZone(Result)) { return; } //Calculates incoming grids data GridStamp GridData = Result.GenerateGridStamp(); //PlayersHanger.CheckGridLimits(GridData); //Checks for single and all slot block and grid limits if (!PlayersHanger.ExtensiveLimitChecker(GridData)) { return; } if (!CheckEnemyDistance(Config.LoadType, PlayerPosition)) { return; } if (!RequireSaveCurrency(Result)) { return; } PlayersHanger.SelectedPlayerFile.FormatGridName(GridData); bool val = await PlayersHanger.SaveGridsToFile(Result, GridData.GridName); if (val) { PlayersHanger.SaveGridStamp(GridData); Chat?.Respond("Save Complete!"); } else { Chat?.Respond("Saved Failed!"); return; } }