public WeeklyController() { NfManager = new NightFallManager(); VendorManager = new VendorManager(); PrisonManager = new PrisonManager(); BountyManager = new BountyManager(); }
public static void ReleaseFromPrison(CommandArgs args) { if (args.Parameters.Count < 1 || args.Parameters.Count > 1) { args.Player.SendMessage("Invalid syntax! Proper syntax: /releaseprisoner <user>", Color.Red); return; } PrisonManager manager = new PrisonManager(TShock.DB); PrisonHelper prisoner = manager.GetPrisonerUser(args.Parameters[0]); if (prisoner != null) { Release(manager, prisoner); if (args.Player != null) { args.Player.SendMessage("Prisoner has been released.", Color.Green); } } else { if (args.Player != null) { args.Player.SendMessage("No prisoner matched your query", Color.Red); } } }
public IContainer GetContainerById(string id) { Container tempResult = null; Container result = null; try { var prison = PrisonManager.LoadPrisonAndAttach(new Guid(id)); if (prison == null) { return(null); } tempResult = new Container(prison); result = tempResult; tempResult = null; } finally { if (result != null) { result.Dispose(); } } return(result); }
public void LoadPrison() { // Arrange PrisonConfiguration prisonRules = new PrisonConfiguration(); prisonRules.PrisonHomeRootPath = @"c:\prison_tests\p1"; prisonRules.Rules = RuleTypes.WindowStation; prison.Lockdown(prisonRules); // Act var prisonLoaded = PrisonManager.LoadPrisonAndAttach(prison.Id); Process process = prison.Execute( @"c:\windows\system32\cmd.exe", @"/c exit 667"); process.WaitForExit(); // Assert Process process2 = prisonLoaded.Execute( @"c:\windows\system32\cmd.exe", @"/c exit 667"); process2.WaitForExit(); // Assert Assert.AreEqual(667, process.ExitCode); }
public static void ClearPrison(CommandArgs args) { PrisonManager manager = new PrisonManager(TShock.DB); foreach (PrisonHelper prioner in manager.GetAllCurrentPrisoners()) { Release(manager, prioner); } }
public void DestroyContainer(string id) { var p = PrisonManager.LoadPrisonAndAttach(new Guid(id)); if (p == null) { throw new ArgumentException("Container ID not found"); } p.Destroy(); }
public string[] ListContainerIds() { var res = new List <string>(); var all = PrisonManager.ReadAllPrisonsNoAttach(); foreach (var p in all) { res.Add(p.Id.ToString()); } return(res.ToArray()); }
public PrisonCell(PrisonManager manager, IMyMotorStator rotor) { this.rotor = rotor; this.manager = manager; var m = Util.NameRegex(rotor, PrisonManager.CellPattern); if (m.Success) { this.id = int.Parse(m.Groups[1].Value); InitChambers(); } }
override protected void Start() { _PersoManager = GameObject.Find("GameManager").GetComponent <PersoManager>(); _prisonManager = GameObject.Find("GameManager").GetComponent <PrisonManager>(); _monSon = GetComponent <AudioSource>(); imgLevier = transform.Find("AfficheLevier"); if (_door) { if (_maPrison == PrisonManager.Prison.c0) { toggleLevier(); } } }
private void ServerHooks_Join(int ply, HandledEventArgs args) { var tPlayer = TShock.Players[ply]; var player = new ExtendedTSPlayer(tPlayer); Players[ply] = player; PrisonManager prisonManager = new PrisonManager(TShock.DB); if (prisonManager.IPInPrison(player.Player.IP)) { player.PrisonRecord = prisonManager.GetPrisonRecordByIP(player.Player.IP); } }
public void SavePrison() { // Arrange PrisonConfiguration prisonRules = new PrisonConfiguration(); prisonRules.PrisonHomeRootPath = @"c:\prison_tests\p1"; prisonRules.Rules = RuleTypes.None; // Act prison.Lockdown(prisonRules); // Assert Assert.IsTrue(PrisonManager.ReadAllPrisonsNoAttach().Any(p => p.Id == prison.Id)); }
public static bool Prefix(ref NitrogenLevel __instance, Player player) { if (GameModeUtils.RequiresOxygen() && !PrisonManager.IsInsideAquarium(player.gameObject.transform.position)) { float depthOf = Ocean.main.GetDepthOf(player.gameObject); // Player's personal crush depth if (crushEnabled) { if (Player.main.GetDepthClass() == Ocean.DepthClass.Crush) { if (!crushed) { ErrorMessage.AddMessage("Personal crush depth exceeded. Return to safe depth!"); crushed = true; } if (UnityEngine.Random.value < 0.5f) { float crushDepth = DeathRun.saveData.playerSave.crushDepth; if (depthOf > crushDepth) { float crush = depthOf - crushDepth; if (crush < 50) { DamagePlayer(4); } else if (crush < 100) { DamagePlayer(8); } else if (crush < 200) { DamagePlayer(16); } else { DamagePlayer(32); // "Okay, Sparky..." } } } } else { crushed = false; } } } return(false); }
public static void ExtendSentence(CommandArgs args) { if (args.Parameters.Count < 2 || args.Parameters.Count > 2) { args.Player.SendMessage("Invalid syntax! Proper syntax: /extendsentence <player> <minutes>", Color.Red); return; } var player = TShock.Utils.FindPlayer(args.Parameters[0]); if (player.Count == 0) { args.Player.SendMessage("No player found with that query.", Color.Red); return; } if (player.Count > 1) { args.Player.SendMessage("More than one player matched query.", Color.Red); return; } if (args.Parameters[1].ToIntegerOrDefault(-1) < 1) { args.Player.SendMessage("Invalid number of minutes.", Color.Red); return; } PrisonManager manager = new PrisonManager(TShock.DB); if (manager.IPInPrison(player[0].IP)) { manager.ExtendSentence(player[0], args.Parameters[1].ToIntegerOrDefault(-1)); var ePlayer = ExtendedAdmin.Players[player[0].Index]; ePlayer.PrisonRecord.Until = ePlayer.PrisonRecord.Until.AddMinutes(args.Parameters[1].ToIntegerOrDefault(-1)); ePlayer.Player.SendMessage(string.Format("Your sentence has been extended by {0} minute(s)", args.Parameters[1].ToIntegerOrDefault(-1)), Color.Red); TShock.Utils.Broadcast(string.Format("{0}'s sentence has been extended!", ePlayer.Player.Name), Color.Goldenrod); } else { args.Player.SendMessage("Player is not currently in prison.", Color.Red); return; } }
public void LoadedPrisonIsLocked() { // Arrange PrisonConfiguration prisonRules = new PrisonConfiguration(); prisonRules.PrisonHomeRootPath = @"c:\prison_tests\p1"; prisonRules.Rules = RuleTypes.WindowStation; prison.Lockdown(prisonRules); // Act var prisonLoaded = PrisonManager.LoadPrisonAndAttach(prison.Id); // Assert Assert.IsTrue(prisonLoaded.IsLocked); }
public PrisonCell(PrisonManager manager, IMyMotorStator rotor) { this.rotor = rotor; this.manager = manager; var m = Util.NameRegex(rotor, PrisonManager.CellPattern); if (m.Success) { this.id = int.Parse(m.Groups[1].Value); InitChambers(); InitIndicator(); UpdateIndicator(); } else { throw ArgumentException("Unable to create Prison Cell for " + rotor); } }
private static void Release(PrisonManager manager, PrisonHelper prioner) { manager.Release(prioner.PrisonID); var player = TShock.Players.FirstOrDefault(p => p != null && p.UserAccountName == prioner.User && p.RealPlayer); UpdateGroup(player, prioner.User, prioner.Group); if (player != null) { var ePlayer = ExtendedAdmin.Players[player.Index]; ePlayer.PrisonRecord = null; player.Teleport(Main.spawnTileX, Main.spawnTileY); player.SendMessage("You have been freed from prison", Color.Green); TShock.Utils.Broadcast(string.Format("{0} has been released from prison!", player.Name), Color.Goldenrod); } }
public ActionResult Destiny1Index(bool noLayout = false) { if (CacheExpired) { var featuredRaid = VendorManager.GetFeaturedRaid(); var weekly = NfManager.GetWeekly(); var weeklyBounties = BountyManager.GetBounties("Strike"); var raidChallenges = VendorManager.GetRaidChallenges(); var challengeElders = PrisonManager.GetDetailedChallenge(); var weeklyCrucible = NfManager.GetDetailedCrucibleWeekly(); var ironBannerBounties = BountyManager.GetWeeklyBounties("IronBanner"); var ironBannerRewards = BountyManager.GetWeeklyRewards("IronBanner"); var weeklyPlaylist = NfManager.GetWeeklyStory(); Cache = new WeeklyDataModel() { ThisWeekly = weekly, StrikeBounties = weeklyBounties, RaidChallenges = raidChallenges, EldersChallenge = challengeElders, WeeklyCrucible = weeklyCrucible, IronBannerBounties = ironBannerBounties, IronBannerRewards = ironBannerRewards, FeaturedRaid = featuredRaid, WeeklyPlaylist = weeklyPlaylist, ExpiryTime = DateTime.Now.AddHours(1), StartTime = DateTime.Now }; } if (noLayout) { return(View("Destiny1/PartialIndex", Cache)); } else { ViewBag.HtmlTagOverride = @"data-redirect=""/#weekly"""; return(View("Destiny1/Index", Cache)); } }
void Start() { manager = GameObject.Find("GameStateManager").GetComponent <PrisonManager> (); inventory = GameObject.Find("FirstPersonCharacter").GetComponent <Interact> (); player = GameObject.Find("Player"); }
public static void SendToPrison(CommandArgs args) { if (args.Parameters.Count < 2 || args.Parameters.Count > 2) { args.Player.SendMessage("Invalid syntax! Proper syntax: /sendtoprison <player> <minutes>", Color.Red); return; } var player = TShock.Utils.FindPlayer(args.Parameters[0]); if (player == null || player.Count == 0) { args.Player.SendMessage("No player matched your query.", Color.Red); return; } if (player.Count > 1) { args.Player.SendMessage("More than one player matched your query.", Color.Red); return; } int minutes = args.Parameters[1].ToIntegerOrDefault(-1); if (minutes < 1) { args.Player.SendMessage("Invalid number of minutes.", Color.Red); return; } ExtendedTSPlayer ePlayer = ExtendedAdmin.Players[player[0].Index]; PrisonManager manager = new PrisonManager(TShock.DB); manager.AddPrisonRecord(player[0], DateTime.Now.AddMinutes(minutes)); ServerPointSystem.ServerPointSystem.Deduct(new CommandArgs("deduct", player[0], new List <string>() { player[0].Name, ExtendedAdmin.Config.PrisonShards.ToString() })); UpdateGroup(player[0], player[0].UserAccountName, ExtendedAdmin.Config.PrisonGroup); ePlayer.PrisonRecord = manager.GetPrisonerUser(player[0].UserAccountName); var warp = TShock.Warps.FindWarp(ExtendedAdmin.Config.PrisonWarp); if (warp.WarpPos != Vector2.Zero) { player[0].Teleport((int)warp.WarpPos.X, (int)warp.WarpPos.Y + 3); } else { player[0].Spawn(); } args.Player.SendMessage("Player sent to prison.", Color.Green); player[0].SendMessage(string.Format("You have been sent to prison for {0} minute(s)", minutes), Color.Red); TShock.Utils.Broadcast(string.Format("{0} has been sent to prison!", player[0].Name), Color.Goldenrod); }
void Start() { inventoryScript = GameObject.Find("Player").transform.GetChild(0).GetComponent <Interact> (); manager = GameObject.Find("GameStateManager").GetComponent <PrisonManager> (); }
// Start is called before the first frame update void Start() { manager = GameObject.Find("GameStateManager").GetComponent <PrisonManager> (); }
void Start() { playerTransform = GameObject.Find("Player").transform; manager = GameObject.Find("GameStateManager").GetComponent <PrisonManager> (); InvokeRepeating("Wander", wanderRate, wanderRate); }