コード例 #1
0
        public bool Rob(Player robber, BankRobberyRegionConfig 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);
        }
コード例 #2
0
 public RunningRobbery(Player robber, BankRobberyRegionConfig region)
 {
     Robber       = robber ?? throw new ArgumentNullException(nameof(robber));
     Region       = region ?? throw new ArgumentNullException(nameof(region));
     StartedAtUtc = DateTime.UtcNow;
 }