Esempio n. 1
0
        public static bool GarageCheck(UnturnedPlayer player, GarageModel garageModel, out EResponseType responseType, bool isRetrieveOrList = false, bool isSuper = false)
        {
            if (garageModel == null)
            {
                responseType = EResponseType.GARAGE_NOT_FOUND;
                return(false);
            }
            if (!isSuper && !player.CheckPermission(garageModel.Permission))
            {
                responseType = EResponseType.GARAGE_NO_PERMISSION;
                return(false);
            }
            if (!isRetrieveOrList && !isSuper)
            {
                if (!Plugin.DbManager.IsGarageFull(player.CSteamID.m_SteamID.ToString(), garageModel))
                {
                    responseType = EResponseType.GARAGE_FULL;
                    return(false);
                }
            }

            responseType = EResponseType.SUCCESS;
            return(true);
        }
Esempio n. 2
0
 public static GarageModel GetFirstGarage(UnturnedPlayer player)
 {
     return(Plugin.Conf.VirtualGarages.FirstOrDefault(garage => player.CheckPermission(garage.Permission)));
 }
Esempio n. 3
0
        private static bool BlacklistCheck(UnturnedPlayer player, InteractableVehicle vehicle, out EResponseType responseType, out ushort blacklistedID)
        {
            blacklistedID = 0;
            responseType  = EResponseType.SUCCESS;

            if (Plugin.Conf.BlacklistedVehicles.Any(blacklist => blacklist.Assets.Any(asset =>
                                                                                      vehicle.id == asset.ID && !player.CheckPermission(blacklist.BypassPermission))))
            {
                responseType  = EResponseType.BLACKLIST_VEHICLE;
                blacklistedID = vehicle.id;
                return(false);
            }
            if (vehicle.trunkItems != null && (vehicle.trunkItems != null || vehicle.trunkItems.items.Count != 0))
            {
                foreach (var item in Plugin.Conf.BlacklistedTrunkItems.SelectMany(blacklist => blacklist.Assets.SelectMany(asset => vehicle.trunkItems.items.Where(item => item.item.id == asset.ID && !player.CheckPermission(blacklist.BypassPermission)))))
                {
                    responseType  = EResponseType.BLACKLIST_TRUNK_ITEM;
                    blacklistedID = item.item.id;
                    return(false);
                }
            }
            if (BarricadeManager.tryGetPlant(vehicle.transform, out _, out _, out _, out var region) && region.barricades != null && region.barricades.Count != 0)
            {
                foreach (var asset in Plugin.Conf.BlacklistedBarricades.SelectMany(blacklist => blacklist.Assets.Where(asset => region.drops.Any(drop =>
                                                                                                                                                 drop.asset.id == asset.ID && !player.CheckPermission(blacklist.BypassPermission)))))
                {
                    responseType  = EResponseType.BLACKLIST_BARRICADE;
                    blacklistedID = asset.ID;
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 4
0
 public static List <GarageModel> GetAllGarages(UnturnedPlayer player)
 {
     return(Plugin.Conf.VirtualGarages.Where(garage => player.CheckPermission(garage.Permission)).ToList());
 }