private async void MissionLoadingTimer_Tick(object sender, EventArgs e, Player player) { switch (player.MissionStep) { case 1: player.MissionStep = 2; player.DisableCheckpoint(); player.MissionTextDraw.Text = $"~w~Transporting ~b~{player.MissionCargo.Name}~w~ from {player.FromLocation.Name} to ~r~{player.ToLocation.Name}~w~"; player.SetCheckpoint(player.ToLocation.Position, 7.0f); player.SendClientMessage(Color.GreenYellow, Messages.MissionTruckerDeliverTo, player.MissionCargo.Name, player.ToLocation.Name); break; case 2: BasePlayer.SendClientMessageToAll(Color.White, $"Pilot {{FF00FF}}{player.Name}{{FFFFFF}} succesfully transported {{0000FF}}{player.MissionCargo.Name}"); BasePlayer.SendClientMessageToAll(Color.White, $"from {{00FF00}}{player.FromLocation.Name}{{FFFFFF}} to {{00FF00}}{player.ToLocation.Name}{{FFFFFF}}."); var payment = MissionsController.CalculatePayment(player.FromLocation, player.ToLocation, player.MissionCargo); await player.RewardAsync(payment); player.SendClientMessage(Color.GreenYellow, $"You finished the mission and earned ${payment}."); var playerAccount = player.Account; playerAccount.PilotJobs++; await AccountRepository.UpdateAsync(playerAccount); EndMission(player); break; } player.ToggleControllable(true); player.Vehicle.Engine = true; }
public static async Task CancelConvoyAsync(MissionConvoy convoy) { foreach (var member in convoy.Members) { member.Convoy = null; member.IsInConvoy = false; convoy.MemberText.Hide(member); convoy.LeaderText.Hide(member); await MissionsController.ClassEndMissionAsync(member); member.SendClientMessage(Color.White, "{FF0000}The leader cancelled the convoy."); } convoy.MissionCargo = null; convoy.FromLocation = null; convoy.ToLocation = null; convoy.Status = ConvoyStatus.Empty; convoy.MissionStep = 0; convoy.ConvoyTrailerModel = 0; convoy.IsLeaderInformed = false; convoy.Members.Clear(); convoy.Timer.Dispose(); }
public void GetResponderEmails_EmptyRoster() { var responders = new InMemoryDbSet <MissionRoster>(); var dataMock = new Mock <IKcsarContext>(); dataMock.SetupGet(f => f.MissionRosters).Returns(responders); var controller = new MissionsController(dataMock.Object, new AlwaysYesAuth(), new ConsoleLogger()); var result = controller.GetResponderEmails(Guid.NewGuid(), null); Assert.IsEmpty(result); }
private void Awake() { missionsController = FindObjectOfType <MissionsController>(); animator = GetComponent <Animator>(); Events.Missions.NewMission += AddMission; Events.Missions.FulfillMission += EliminateMission; Events.Level.Start += OpenPanel; Events.Level.Finish += ClosePanel; Events.Drain.Start += ShakePanel; Events.Drain.Stop += StopShake; }
public override void OnInspectorGUI() { MissionsController control = (MissionsController)target; if (DrawDefaultInspector()) { //mapGen.generateNavMesh(); } if (GUILayout.Button("Generate")) { control.ScanForMissions(); } }
public static async Task PlayerLeaveConvoyAsync(Player player) { var convoy = player.Convoy; if (convoy == null) { return; } if (convoy.Members.Count == 1) { await CancelConvoyAsync(convoy); return; } player.IsInConvoy = false; player.Convoy = null; convoy.MemberText.Hide(player); convoy.LeaderText.Hide(player); if (!player.MissionTextDraw.IsDisposed) { player.MissionTextDraw.Text = Messages.NoMissionText; } if (convoy.Members[0] == player) { convoy.Members.Remove(player); var newLeader = convoy.Members[0]; convoy.MemberText.Hide(newLeader); } else { convoy.Members.Remove(player); await MissionsController.ClassEndMissionAsync(player); } }
private static bool SetRandomMission(Player player) { if (!player.IsDriving()) { return(false); } switch (player.Vehicle.Model) { case VehicleModelType.Nevada: case VehicleModelType.Shamal: player.MissionCargo = MissionCargo.GetRandomCargo(MissionCargoVehicleType.Plane); player.FromLocation = MissionCargo.GetRandomStartLocation(player.MissionCargo); player.ToLocation = MissionCargo.GetRandomEndLocation(player.MissionCargo); player.MissionVehicle = (Vehicle)player.Vehicle; while (!MissionsController.CheckDistanceBetweenLocations(player.ToLocation, player.FromLocation, 1000.0f)) { player.ToLocation = MissionCargo.GetRandomEndLocation(player.MissionCargo); } return(true); case VehicleModelType.Maverick: case VehicleModelType.Cargobob: player.MissionCargo = MissionCargo.GetRandomCargo(MissionCargoVehicleType.Helicopter); player.FromLocation = MissionCargo.GetRandomStartLocation(player.MissionCargo); player.ToLocation = MissionCargo.GetRandomEndLocation(player.MissionCargo); player.MissionVehicle = (Vehicle)player.Vehicle; while (!MissionsController.CheckDistanceBetweenLocations(player.ToLocation, player.FromLocation, 1000.0f)) { player.ToLocation = MissionCargo.GetRandomEndLocation(player.MissionCargo); } return(true); } return(false); }
private async void MafiaMissionLoadingTimer_Tick(object sender, EventArgs e, Player player) { switch (player.MissionStep) { case 1: player.MissionStep = 2; player.DisableCheckpoint(); player.MissionTextDraw.Text = $"~w~Hauling ~b~{player.MissionCargo.Name}~w~ from {player.FromLocation.Name} to ~r~{player.ToLocation.Name}~w~"; player.SetCheckpoint(player.ToLocation.Position, 7.0f); await player.SetWantedLevelAsync(player.Account.Wanted + 4); PoliceController.SendMessage(Color.GreenYellow, $"Mafia {{FFFF00}}{player.Name}{{00FF00}} is transporting illegal goods, pursue and fine him."); player.SendClientMessage(Color.GreenYellow, $"Deliver the {player.MissionCargo.Name} to {player.ToLocation.Name}."); break; case 2: BasePlayer.SendClientMessageToAll(Color.White, $"Mafia {{FF00FF}}{player.Name}{{FFFFFF}} succesfully transported {{0000FF}}{player.MissionCargo.Name}"); BasePlayer.SendClientMessageToAll(Color.White, $"from {{00FF00}}{player.FromLocation.Name}{{FFFFFF}} to {{00FF00}}{player.ToLocation.Name}."); var payment = MissionsController.CalculatePayment(player.FromLocation, player.ToLocation, player.MissionCargo); await player.RewardAsync(payment, 2); player.SendClientMessage(Color.GreenYellow, $"You finished the mission and earned ${payment}."); var playerAccount = player.Account; playerAccount.MafiaJobs++; await new PlayerAccountRepository(ConnectionFactory.GetConnection).UpdateAsync(playerAccount); await EndMissionAsync(player); break; } player.ToggleControllable(true); }
public static async Task JailPlayerAsync(Player finedPlayer, int jailSeconds) { var finedPlayerAccount = finedPlayer.Account; finedPlayer.RemoveFromVehicle(); finedPlayer.VirtualWorld = Configuration.Instance.JailWorld; finedPlayer.Interior = 10; finedPlayer.Position = new Vector3(220.0, 110.0, 999.1); finedPlayerAccount.Jailed = jailSeconds; await AccountRepository.UpdateAsync(finedPlayerAccount); finedPlayer.JailingTimer?.Dispose(); finedPlayer.JailingTimer = new Timer(TimeSpan.FromSeconds(1), true); finedPlayer.JailingTimer.Tick += (sender, e) => JailingTimer_Tick(sender, e, finedPlayer); if (finedPlayer.IsDoingMission) { await MissionsController.ClassEndMissionAsync(finedPlayer); finedPlayer.GameText($"~w~You ~r~failed~w~ your mission. You lost ~y~${Configuration.Instance.FailedMissionPrice}~w~ to cover expenses.", 5000, 4); await finedPlayer.RewardAsync(-Configuration.Instance.FailedMissionPrice); } }
private async void TruckerLoadUnload_Tick(object sender, EventArgs e, Player player) { if (player.IsInConvoy) { if (player.MissionStep == 1) { player.MissionStep = 2; player.MissionTextDraw.Text = Messages.MissionConvoyWaitingMembersToLoadCargo; } if (player.MissionStep == 3) { player.MissionStep = 4; player.MissionTextDraw.Text = Messages.MissionConvoyWaitingMembersToUnLoadCargo; } player.DisableCheckpoint(); player.ToggleControllable(true); return; } switch (player.MissionStep) { case 1: player.MissionStep = 2; player.DisableCheckpoint(); await SetRandomOverloadAsync(player); var routeText = string.Format(Messages.MissionTruckerHaulingToDeliverCargo, player.MissionCargo.Name, player.FromLocation.Name, player.ToLocation.Name); if (player.IsOverloaded) { _ = string.Concat(routeText, "~r~(OL)~w~"); player.SendClientMessage(Messages.MissionTruckerOverloaded); } if (player.MissionCargo.IsWantedByMafia) { _ = string.Concat(routeText, "~r~(ML)~w~"); player.GameText(Messages.MissionTruckerMafiaInterested, 5000, 4); player.IsMafiaLoaded = true; if (player.MissionTrailer == null) { player.MissionVehicle.IsWantedByMafia = true; } else { player.MissionTrailer.IsWantedByMafia = true; } } player.MissionTextDraw.Text = routeText; player.SetCheckpoint(player.ToLocation.Position, 7.0f); player.ToggleControllable(true); player.SendClientMessage(Messages.MissionTruckerDeliverTo, player.MissionCargo.Name, player.ToLocation.Name); break; case 2: BasePlayer.SendClientMessageToAll(Messages.MissionTruckerCompleted, player.Name, player.MissionCargo.Name); BasePlayer.SendClientMessageToAll(Messages.MissionTruckerCompletedInfo, player.FromLocation.Name, player.ToLocation.Name); var payment = MissionsController.CalculatePayment(player.FromLocation, player.ToLocation, player.MissionCargo); if (!BonusMission.IsMissionFinished && BonusMission.RandomCargo == player.MissionCargo && BonusMission.RandomFromLocation == player.FromLocation && BonusMission.RandomToLocation == player.ToLocation) { payment *= 2; BonusMission.IsMissionFinished = true; BasePlayer.SendClientMessageToAll( $"{{00BBFF}}Player {{FFBB00}}{player.Name}{{00BBFF}} has finished the bonus mission."); } await player.RewardAsync(payment); player.SendClientMessage(Messages.MissionReward, payment); if (player.IsOverloaded) { var bonus = payment * 25 / 100; await player.RewardAsync(bonus); player.SendClientMessage(Messages.MissionTruckerBonusOverload, bonus); } if (player.IsMafiaLoaded) { var bonus = payment * 50 / 100; await player.RewardAsync(bonus); player.SendClientMessage(Messages.MissionTruckerBonusMafia, bonus); } if (player.MissionVehicle.IsOwned) { var bonus = payment * 10 / 100; await player.RewardAsync(bonus); player.SendClientMessage(Messages.MissionTruckerBonusOwnedVehicle, bonus); } await player.RewardAsync(0, MissionsController.GetDistance(player.FromLocation, player.ToLocation) > 3000.0f? 2 : 1); var account = player.Account; account.TruckerJobs++; await AccountRepository.UpdateAsync(account); await EndMissionAsync(player); player.ToggleControllable(true); break; } }
//rivate List<SpellSlot> // Use this for initialization void Start() { sceneManager = GameObject.FindGameObjectWithTag("SceneManager") .GetComponent <FortressSceneManager>(); missionController = SharedSceneController.Instance.missionController; sceneManager.chaos.Subscribe(x => { // StartCoroutine("UpdateChaosText", x); var num = Math.Round(x).ToString("0."); chaosText.text = (num == "0" ? "Zero" : num) + "%"; chaosEffect.Stop(false, ParticleSystemStopBehavior.StopEmitting); chaosEffect.Play(); }); playerCharacter.spellCaster.currentMana.Subscribe(x => { playerManaBar.fillAmount = x / playerCharacter.spellCaster.maxMana.Value; }); playerCharacter.spellCaster.selectedSpell.Subscribe(x => { castSpellText.text = x?.spellName ?? ""; switch (x?.spellTarget) { case SpellTarget.MISSILE: spellMouseUI.SetActive(true); break; default: spellMouseUI.SetActive(false); break; } }); playerCharacter.showCurrentMissionElement.Subscribe(x => { currentMissionElement.SetActive(x); }); SharedSceneController.Instance.missionController.selectedMission.Subscribe(x => { currentMissionName.text = x?.missionName ?? "No mission selected"; currentMissionDescription.text = x?.desc ?? $"Open the fortress menu to select your next mission."; missionDoneElement.SetActive(false); missionDone?.Dispose(); missionDone = x?.done.Subscribe(done => { missionDoneElement.SetActive(done); if (done) { currentMissionName.text = x?.missionName + " DONE"; currentMissionDescription.text = ""; } }); }); playerCharacter.showMinimap.Subscribe(x => { minimapElement.gameObject.SetActive(x); }); RefreshSpells(); }
public static async void ConvoyTimer_Tick(object sender, EventArgs e, MissionConvoy convoy) { convoy.UpdateTextDraw(); var leader = convoy.Members[0]; switch (convoy.MissionStep) { case 0: var isSameTrailer = true; if (leader.IsDoingMission) { convoy.MissionCargo = leader.MissionCargo; convoy.FromLocation = leader.FromLocation; convoy.ToLocation = leader.ToLocation; convoy.ConvoyTrailerModel = leader.Vehicle?.Trailer?.Model ?? 0; if (convoy.ConvoyTrailerModel != 0) { foreach (var member in convoy.Members) { if (member == leader) { continue; } if (member.Vehicle?.Trailer?.Model == convoy.ConvoyTrailerModel) { continue; } switch (convoy.ConvoyTrailerModel) { case VehicleModelType.ArticleTrailer: case VehicleModelType.ArticleTrailer3: member.MissionTextDraw.Text = Messages.MissionConvoyCargoTrailerNeeded; break; case VehicleModelType.ArticleTrailer2: member.MissionTextDraw.Text = Messages.MissionConvoyOreTrailerNeeded; break; case VehicleModelType.PetrolTrailer: member.MissionTextDraw.Text = Messages.MissionConvoyFluidsTrailerNeeded; break; } isSameTrailer = false; } } else { foreach (var member in convoy.Members) { if (member == leader) { continue; } if (member.Vehicle?.Model == VehicleModelType.DFT30 && member.Vehicle?.Model == VehicleModelType.Flatbed) { continue; } isSameTrailer = false; member.MissionTextDraw.Text = Messages.MissionConvoyNoTrailerVehicleNeeded; } } if (isSameTrailer) { leader.SendClientMessage(Color.GreenYellow, Messages.MissionConvoyReadyToGo); foreach (var member in convoy.Members) { if (member == leader) { continue; } convoy.StartMemberJob(member); } convoy.MissionStep = 1; convoy.Status = ConvoyStatus.Closed; } else { if (!convoy.IsLeaderInformed) { leader.SendClientMessage(Color.Red, Messages.MissionConvoyCantGo); convoy.IsLeaderInformed = true; } } } break; case 1: var areAllMembersLoaded = true; foreach (var member in convoy.Members) { if (member.MissionStep != 2) { areAllMembersLoaded = false; } } if (areAllMembersLoaded) { leader.SendClientMessage(Color.GreenYellow, Messages.MissionConvoyMembersLoaded); foreach (var member in convoy.Members) { convoy.UpdateMemberJob(member); } convoy.MissionStep = 2; } break; case 2: var didAllMembersUnloaded = true; foreach (var member in convoy.Members) { if (member.MissionStep != 4) { didAllMembersUnloaded = false; } } if (didAllMembersUnloaded) { convoy.MissionStep = 3; } break; case 3: var numberOfMembers = convoy.Members.Count; var payment = MissionsController.CalculatePayment(convoy.FromLocation, convoy.ToLocation, convoy.MissionCargo); if (!BonusMission.IsMissionFinished && BonusMission.RandomCargo == convoy.MissionCargo && BonusMission.RandomFromLocation == convoy.FromLocation && BonusMission.RandomToLocation == convoy.ToLocation) { payment *= 2; BonusMission.IsMissionFinished = true; BasePlayer.SendClientMessageToAll( $"{{00BBFF}}Convoy with leader {{FFBB00}}{leader.Name}{{00BBFF}} has finished the bonus mission."); } var bonus = numberOfMembers * 25 + 100; payment = payment * bonus / 100; foreach (var member in convoy.Members) { await member.RewardAsync(payment, 5); var memberAccount = member.Account; memberAccount.ConvoyJobs++; await AccountRepository.UpdateAsync(memberAccount); await MissionsController.ClassEndMissionAsync(member); member.SendClientMessage(Color.White, $"{{00FF00}}You finished the convoy and earned ${payment}"); if (member != convoy.Members[0]) { member.MissionTextDraw.Text = Messages.MissionConvoyWaitingForLeader; } } convoy.MissionCargo = null; convoy.FromLocation = null; convoy.ToLocation = null; convoy.Status = ConvoyStatus.Open; convoy.MissionStep = 0; convoy.ConvoyTrailerModel = 0; convoy.IsLeaderInformed = false; break; } }
void Awake() { instance = this; go = new List <GameObject>(GameObject.FindGameObjectsWithTag("Robots")); enemiesCount = go.Count; }