Example #1
0
        public void RemoveProjban(string regionName, short projId)
        {
            RtRegion rt = GetRtRegionByName(regionName);

            if (rt == null)
            {
                throw new Exception("Invalid region!");
            }
            var p = new Projectile();

            p.SetDefaults(projId);
            if (!rt.ProjectileIsBanned(projId))
            {
                throw new Exception($"{p.name} is not banned in this region.");
            }
            var origin = rt.Projbans;

            if (rt.RemoveBannedProjectile(projId) &&
                _database.Query("UPDATE RtRegions SET Projbans = @0 WHERE Id = @1", rt.Projbans, rt.Id) != 0)
            {
                return;
            }

            rt.Projbans = origin;
            throw new Exception("Database error: No affected rows.");
        }
Example #2
0
        public void RemoveProjban(RtRegion rt, short projId)
        {
            if (!rt.ProjectileIsBanned(projId))
            {
                return;
            }

            var origin = rt.Projbans;

            if (rt.RemoveBannedProjectile(projId) &&
                _database.Query("UPDATE RtRegions SET Projbans = @0 WHERE Id = @1", rt.Projbans, rt.Id) != 0)
            {
                return;
            }

            rt.Projbans = origin;
            throw new Exception("Database error: No affected rows.");
        }