public void License() // LICENSE SCENARIO { Logger.LogTrivial(this.GetType().Name, "License()"); scenario = EScenario.License; GameFiber.StartNew(delegate { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterLicenseAnswers.GetRandomElement(), 2500); hunter.Tasks.PlayAnimation("mp_WildernessCallouts.Common", "givetake1_a", 2.5f, AnimationFlags.None); isPursuitRunning = false; WildernessCallouts.Common.HuntingLicense(hunter); while (true) { GameFiber.Yield(); if (breakForceEnd) { break; } Game.DisplayHelp("Press ~b~" + Controls.PrimaryAction.ToUserFriendlyName() + "~w~ to let the hunter leave~n~Press ~r~" + Controls.SecondaryAction.ToUserFriendlyName() + "~w~ if the license is invalid"); if (Controls.PrimaryAction.IsJustPressed()) { Game.DisplaySubtitle("~b~" + Settings.General.Name + ": ~w~" + policeLicenseGood.GetRandomElement(), 2500); state = EIllegalHuntingState.End; hunter.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Speech.GENERIC_THANKS : Speech.GENERIC_BYE); break; } else if (Controls.SecondaryAction.IsJustPressed()) { Game.DisplaySubtitle("~b~" + Settings.General.Name + ": ~w~" + policeLicenseBad.GetRandomElement(), 2500); licenseHasBeenGiven = true; GameFiber.Wait(2250); int rndState = Globals.Random.Next(101); if (rndState <= 8) { Shoot(); } else if (rndState >= 30 && rndState < 55) { NoLicenseFlee(); } else { NoLicenseStay(); } break; } } }); }
public RequestInfoListItemsDTO GetLimitedRequestInfos(EScenario scenario, int offset, int limit) { var rh = RequestHandlerFactory.Instance.GetHandler(scenario); if (rh == null) { throw new NotImplementedException(); } rh.Offset = offset; rh.Limit = limit; return(rh.LimitedRequestInfos()); }
public ServiceRequestDTO GetServiceRequest(string user, EScenario scenario, string serviceId) { var rh = RequestHandlerFactory.Instance.GetHandler(scenario); if (rh == null) { throw new NotImplementedException(); } rh.User = new UserAndRoleDTO { Username = user }; rh.ServiceId = serviceId; return(rh.View()); }
public string GetNewServiceRequestId(string user, EScenario scenario, string requestInfoId = null) { var rh = RequestHandlerFactory.Instance.GetHandler(scenario); if (rh == null) { throw new NotImplementedException(); } rh.User = new UserAndRoleDTO { Username = user }; rh.RequestInfoId = requestInfoId; return(rh.New()); }
// SCENARIOS public void Shoot() // SHOOT SCENARIO { Logger.LogTrivial(this.GetType().Name, "Shoot()"); scenario = EScenario.Shoot; GameFiber.StartNew(delegate { if (!licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterNoLicenseAndAttackAnswers.GetRandomElement(), 2500); } else if (licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterLicenseSuspended.GetRandomElement(), 2500); } hunter.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Speech.GENERIC_FUCK_YOU : Speech.GENERIC_INSULT_HIGH : Speech.GENERIC_INSULT_MED); Game.SetRelationshipBetweenRelationshipGroups("HUNTER", "COP", Relationship.Hate); Game.SetRelationshipBetweenRelationshipGroups("HUNTER", "PLAYER", Relationship.Hate); this.pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(this.pursuit, this.hunter); Functions.SetPursuitIsActiveForPlayer(pursuit, true); isPursuitRunning = true; while (true) { GameFiber.Yield(); if (breakForceEnd) { break; } if (hunter.Exists() && hunter.IsAlive && !hunter.IsInAnyVehicle(false) && !LSPD_First_Response.Mod.API.Functions.IsPedGettingArrested(hunter) && !LSPD_First_Response.Mod.API.Functions.IsPedArrested(hunter)) { hunter.AttackPed(Game.LocalPlayer.Character); } state = EIllegalHuntingState.End; } }); }
public void NoLicenseStay() // NO LICENSE AND STAY SCENARIO { Logger.LogTrivial(this.GetType().Name, "NoLicenseStay()"); scenario = EScenario.NoLicenseStay; hunter.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Speech.GENERIC_CURSE_HIGH : Speech.GENERIC_CURSE_MED); GameFiber.StartNew(delegate { if (!licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterNoLicenseAndStayAnswers.GetRandomElement(), 2500); } else if (licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterLicenseSuspended.GetRandomElement(), 2500); } isPursuitRunning = false; Game.DisplayHelp("Press " + Controls.ForceCalloutEnd.ToUserFriendlyName() + " to finish the callout"); }); }
public RequestHandlerBase GetHandler(EScenario scenario) { RequestHandlerBase handler = null; switch (scenario) { case EScenario.BROKEN_DEVICE: handler = new BrokenDeviceReqHandler(); break; case EScenario.NEW_SCENARIO: handler = new NewScenarioReqHandler(); break; case EScenario.ERROR_CHARGES: handler = new ErrorChargesReqHandler(); break; case EScenario.NEW_CONTRACT: handler = new NewContractReqHandler(); break; case EScenario.RETURN_DEVICE: handler = new ReturnDeviceReqHandler(); break; case EScenario.TERMINATION: handler = new TerminationReqHandler(); break; case EScenario.TRANSFER_ASSET: handler = new TransferAssetReqHandler(); break; } if (handler != null) { return(handler); } throw new NotImplementedException(); }
public long GetTotalRequestInfos(EScenario scenario) { return(RequestHandlerFactory.Instance.GetHandler(scenario).Count()); }
public RequestInfoListItemsDTO GetAllRequestInfos(EScenario scenario) { return(RequestHandlerFactory.Instance.GetHandler(scenario).RequestInfos()); }
public void NoLicenseFlee() // NO LICENSE AND FLEE SCENARIO { Logger.LogTrivial(this.GetType().Name, "NoLicenseFlee()"); scenario = EScenario.NoLicenseFlee; GameFiber.StartNew(delegate { Game.SetRelationshipBetweenRelationshipGroups("HUNTER", "COP", Relationship.Dislike); Game.SetRelationshipBetweenRelationshipGroups("HUNTER", "PLAYER", Relationship.Dislike); if (!licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterNoLicenseAndFleeAnswers.GetRandomElement(), 2500); } else if (licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterLicenseSuspended.GetRandomElement(), 2500); } hunter.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Speech.GENERIC_CURSE_HIGH : Speech.GENERIC_CURSE_MED : Speech.GENERIC_FUCK_YOU : Speech.GENERIC_INSULT_HIGH : Speech.GENERIC_INSULT_MED); hunter.EnterVehicle(hunterVeh, 8000, EVehicleSeats.Driver, 2.0f, 1); while (true) { GameFiber.Yield(); if (breakForceEnd || !hunter.Exists() || hunter.IsInAnyVehicle(false) || hunter.IsDead || Functions.IsPedArrested(hunter)) { break; } } VehicleDrivingFlags driveFlags = VehicleDrivingFlags.None; switch (Globals.Random.Next(3)) { case 0: driveFlags = (VehicleDrivingFlags)20; break; case 1: driveFlags = (VehicleDrivingFlags)786468; break; case 2: if (!hunterVeh.Model.IsBike || !hunterVeh.Model.IsBicycle) { driveFlags = (VehicleDrivingFlags)1076; } else { driveFlags = (VehicleDrivingFlags)786468; } break; default: break; } if (hunter.Exists()) { if (hunter.IsInAnyVehicle(false) && hunter.IsAlive) { hunter.Tasks.CruiseWithVehicle(hunterVeh, 200.0f, driveFlags); } this.pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(this.pursuit, this.hunter); Functions.SetPursuitIsActiveForPlayer(pursuit, true); isPursuitRunning = true; } state = EIllegalHuntingState.End; }); }