public static void GarageRetrieveChecks(UnturnedPlayer player, out EResponseType responseType, string[] commands) { responseType = EResponseType.SUCCESS; var oneArg = commands.Length == 1; switch (oneArg) { case true: if (!SelectedGarageCheck(player)) { responseType = EResponseType.GARAGE_NOT_SELECTED; return; } if (!GarageCheck(player, Plugin.SelectedGarageDict[player.CSteamID], out responseType, true)) { return; } if (!Plugin.DbManager.IsVehicleExist(player.CSteamID.m_SteamID.ToString(), Plugin.SelectedGarageDict[player.CSteamID].Name, commands[0])) { responseType = EResponseType.DONT_HAVE_VEHICLE; } break; case false: if (!GarageCheck(player, GarageModel.Parse(commands[0]), out responseType, true)) { return; } if (!Plugin.DbManager.IsVehicleExist(player.CSteamID.m_SteamID.ToString(), GarageModel.Parse(commands[0]).Name, commands[1])) { responseType = EResponseType.DONT_HAVE_VEHICLE; } break; } }
/// <summary> /// Constructs a new CalloutData object. /// </summary> /// <param name="callName">The name of the callout.</param> /// <param name="shortName">A short name for the callout; this could be anything, such as a radio/penal code, or abbreviation.</param> /// <param name="location">The location of the call.</param> /// <param name="response">Whether the call requires a Code 2 or Code 3 response.</param> /// <param name="description">The description of the call, as received by 911.</param> /// <param name="status">The status of the call. Set this to Created or Dispatched, and then update it to UnitResponding when the player accepts the call.</param> /// <param name="callPeds">The list of peds to be added to the call. Can be null to not add any peds; peds can always be added later on (for example, you can add a victim ped now, and then add a suspect ped after the player meets him/her).</param> /// <param name="callVehicles">The list of vehicles to be added to the call. Can be null to not add any vehicles; vehicles can always be added later on, for example, after the player encounters a suspect vehicle).</param> public CalloutData(string callName, string shortName, Vector3 location, EResponseType response, string description = "", ECallStatus status = ECallStatus.Created, List <Ped> callPeds = null, List <Vehicle> callVehicles = null) { ID = Guid.NewGuid(); Name = callName; ShortName = shortName; mDescription = description; Location = location; TimeReceived = DateTime.UtcNow; mTimeConcluded = null; ResponseType = response; mStatus = status; mPeds = new List <Ped>(); mVehicles = new List <Vehicle>(); if (callPeds != null) { Peds.AddRange(callPeds); } if (callVehicles != null) { Vehicles.AddRange(callVehicles); } mLastUpdated = DateTime.UtcNow; mUpdates = new List <CalloutUpdate>(); mIsPlayerAssigned = true; mPrimaryUnit = Configs.UnitNumber; }
public static void GarageRetrieveAllChecks(UnturnedPlayer player, out EResponseType responseType, string[] commands) { responseType = EResponseType.SUCCESS; if (!GarageCheck(player, GarageModel.Parse(commands[0]), out responseType, true)) { return; } if (!Plugin.DbManager.IsVehicleExist(player.CSteamID.m_SteamID.ToString(), GarageModel.Parse(commands[0]).Name)) { responseType = EResponseType.DONT_HAVE_VEHICLE; } }
public static void SuperGarageRetrieveChecks(UnturnedPlayer player, out EResponseType responseType, string[] commands) { responseType = EResponseType.SUCCESS; if (!ulong.TryParse(commands[0], out var steamID)) { responseType = EResponseType.INVALID_STEAM_ID; return; } if (commands[1].ToLower() != "drown" && !GarageCheck(player, GarageModel.Parse(commands[1]), out responseType, isSuper: true)) { return; } if (!Plugin.DbManager.IsVehicleExist(commands[0], commands[1].ToLower() != "drown" ? GarageModel.Parse(commands[1]).Name : "Drown", commands[2])) { responseType = EResponseType.DONT_HAVE_VEHICLE; } }
public ServerResponseAS(string userId, EResponseType type, string message) : base(userId, type, message) { Queues = new QueueModel("empty"); }
public ServerResponseAS(string userId, EResponseType type, string message, QueueModel queue) : base(userId, type, message) { this.queues = queue; }
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); }
public static void SuperGarageListCheck(UnturnedPlayer player, string steamID, GarageModel garageModel, out EResponseType responseType, bool noGarage = false) { responseType = EResponseType.SUCCESS; if (!ulong.TryParse(steamID, out var value)) { responseType = EResponseType.INVALID_STEAM_ID; return; } if (UnturnedPlayer.FromName(steamID) == null) { responseType = EResponseType.PLAYER_NOT_ONLINE; return; } if (!noGarage && !GarageCheck(player, garageModel, out responseType, isSuper: true)) { return; } }
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); }
public ServerResponseUpdate(string userId, EResponseType type, string message) : base(userId, type, message) { }
public static void GarageAddAllChecks(UnturnedPlayer player, InteractableVehicle vehicle, out EResponseType responseType, out ushort blacklistedID) { responseType = EResponseType.SUCCESS; blacklistedID = 0; BlacklistCheck(player, vehicle, out responseType, out blacklistedID); }
public static void GarageAddChecks(UnturnedPlayer player, string[] commands, out InteractableVehicle vehicle, out BarricadeRegion vehicleRegion, out EResponseType responseType, out ushort blacklistedID) { responseType = EResponseType.SUCCESS; blacklistedID = 0; vehicle = null; vehicleRegion = null; var oneArg = commands.Length == 1; switch (oneArg) { case true: if (!SelectedGarageCheck(player)) { responseType = EResponseType.GARAGE_NOT_SELECTED; return; } if (Plugin.Conf.VirtualGarages.Any(g => string.Equals(g.Name, commands[0], StringComparison.CurrentCultureIgnoreCase))) { responseType = EResponseType.SAME_NAME_AS_GARAGE; return; } if (!VehicleCheck(player, out vehicle, out vehicleRegion)) { responseType = EResponseType.VEHICLE_NOT_FOUND; return; } if (!OwnerCheck(player, vehicle)) { responseType = EResponseType.VEHICLE_NOT_OWNER; return; } if (!GarageCheck(player, Plugin.SelectedGarageDict[player.CSteamID], out responseType)) { return; } BlacklistCheck(player, vehicle, out responseType, out blacklistedID); break; case false: if (Plugin.Conf.VirtualGarages.Any(g => string.Equals(g.Name, commands[1], StringComparison.CurrentCultureIgnoreCase))) { responseType = EResponseType.SAME_NAME_AS_GARAGE; return; } if (!VehicleCheck(player, out vehicle, out vehicleRegion)) { responseType = EResponseType.VEHICLE_NOT_FOUND; return; } if (!OwnerCheck(player, vehicle)) { responseType = EResponseType.VEHICLE_NOT_OWNER; return; } if (!GarageCheck(player, GarageModel.Parse(commands[0]), out responseType)) { return; } BlacklistCheck(player, vehicle, out responseType, out blacklistedID); break; } }
public ResponseData(EResponseType InType, EResultCode InCode) { Code = InCode; Type = InType; Body = ""; }
public ResponseData(EResponseType InType, String InBody) { Code = EResultCode.OK; Type = InType; Body = InBody; }
public ResponseData(EResponseType InType) { Code = EResultCode.Error; Type = InType; Body = ""; }
public SimpleServiceResponse(EResponseType responseType, T data, string errorMessage = "") { Data = data; ResponseType = responseType; ErrorMessage = errorMessage; }
public static void SuperGarageAddChecks(UnturnedPlayer player, string[] commands, out InteractableVehicle vehicle, out BarricadeRegion vehicleRegion, out EResponseType responseType) { responseType = EResponseType.SUCCESS; vehicle = null; vehicleRegion = null; if (!ulong.TryParse(commands[0], out var steamID)) { responseType = EResponseType.INVALID_STEAM_ID; return; } if (Plugin.Conf.VirtualGarages.Any(g => string.Equals(g.Name, commands[2], StringComparison.CurrentCultureIgnoreCase))) { responseType = EResponseType.SAME_NAME_AS_GARAGE; return; } if (!VehicleCheck(player, out vehicle, out vehicleRegion)) { responseType = EResponseType.VEHICLE_NOT_FOUND; return; } if (!GarageCheck(player, GarageModel.Parse(commands[1]), out responseType, isSuper: true)) { } }
public RepositoryResponse(EResponseType responseType, string message, string queueName, string id) : base(id, responseType, message) { this.queueName = queueName; }