public bool Rob(Player robber, BankRobberyRegionConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (RunningRobberies.Any(c => c.Region.RegionId == configuration.RegionId)) { throw new Exception($"Robbery already running on region: {configuration.RegionId}"); } var robbery = new RunningRobbery(robber, configuration); RunningRobberies.Add(robbery); UnturnedChat.Say(Plugin.Instance.Translate("robbing", robber.channel.owner.playerID.characterName, configuration.RegionId), Color.yellow); return(true); }
public void Fail(RunningRobbery robbery) { UnturnedChat.Say(Plugin.Instance.Translate("ended", robbery.Robber.channel.owner.playerID.characterName, robbery.Region.RegionId)); RunningRobberies.Remove(robbery); Cooldowns.Add(robbery.Region.RegionId, DateTime.UtcNow.AddSeconds(robbery.Region.RobbingInterval)); }