/// <summary> /// Начислить награду за патрулирование /// </summary> public void SetPatrolReward(Client player) { var workInfo = _workInfoManager.GetWorkInfo(player, WorkType.Police); var reward = _workReward[workInfo.Level]; _playerInfoManager.SetExperience(player, reward.Exp); _workInfoManager.SetSalary(player, WorkType.Police, reward.Salary); _workInfoManager.SetExperience(player, WorkType.Police, reward.WorkExp); }
/// <summary> /// Выдать награду водителю фургона с едой /// </summary> public void SetTruckDriverRevard(string driverName, int foodPrice, string clientName) { var truckDriver = API.getAllPlayers().First(e => e.socialClubName == driverName); API.sendNotificationToPlayer(truckDriver, $"~g~{clientName} купил у вас еду"); var workLevel = _workInfoManager.GetWorkInfo(truckDriver, WorkType.FoodTrunk).Level; var reward = _truckRewards[workLevel]; _workInfoManager.SetSalary(truckDriver, WorkType.FoodTrunk, foodPrice * reward.Salary); _workInfoManager.SetExperience(truckDriver, WorkType.FoodTrunk, reward.WorkExp); _playerInfoManager.SetExperience(truckDriver, reward.Exp); }
/// <summary> /// Завершение рабочей точки /// </summary> private void FinishPoint(Client player, object[] args) { player.resetSyncedData(FISH_BITES_EVENT); if ((bool)args[0]) { var workLevel = _workInfoManager.GetActiveWork(player).Level; var reward = _rewards[workLevel]; var isBoat = player.hasSyncedData(WorkData.IS_FISHERMAN_ON_BOAT); var salary = isBoat ? reward.Salary * 2 : reward.Salary; var exp = isBoat ? (int)(reward.Exp * 1.5) : reward.Exp; _workInfoManager.SetSalary(player, WorkType.Fisherman, salary); _workInfoManager.SetExperience(player, WorkType.Fisherman, reward.WorkExp); _playerInfoManager.SetExperience(player, exp); } else { API.sendNotificationToPlayer(player, "~m~Вы упустили рыбу"); } var pointBaits = (int)player.getData(POINT_BAITS_COUNT); if (pointBaits < 5) { SetFishBites(player); player.setData(POINT_BAITS_COUNT, pointBaits + 1); } else { API.stopPlayerAnimation(player); ShowNextPoint(player); player.setData(POINT_BAITS_COUNT, 0); } }
/// <summary> /// Обработчик получения повреждений /// </summary> public void OnPlayerDamaged(Client player, Client enemy, int cause, int id) { if (player.health <= 0 || IsEnemyIncorrect(enemy)) { return; } if (enemy.hasData(WorkData.IS_POLICEMAN)) { var playerInfo = _playerInfoManager.GetInfo(player); if (playerInfo.Wanted.WantedLevel == 0) { API.sendNotificationToPlayer(enemy, "~b~Постарайтесь не причинять вред игроку"); _workInfoManager.SetSalary(enemy, WorkType.Police, POLICEMAN_PENALTY); } return; } _policeAlertManager.SendAlert(enemy.position, PoliceAlertManager.HASSLE_ALERT); var info = _playerInfoManager.GetInfo(enemy); var oldWanted = info.Wanted.WantedLevel; info.Wanted.Beatings += 1; _playerInfoManager.RefreshUI(enemy, info); if (oldWanted != info.Wanted.WantedLevel) { API.sendNotificationToPlayer(enemy, $"~m~Уровень розыска увеличен до: {info.Wanted.WantedLevel}"); } }
/// <summary> /// Зачислить зарплату таксисту /// </summary> private void SetDriverReward(Client player, int taxiFee) { var workInfo = _workInfoManager.GetWorkInfo(player, WorkType.TaxiDriver); var reward = _workRewards[workInfo.Level]; _workInfoManager.SetSalary(player, WorkType.TaxiDriver, taxiFee * reward.Salary); _workInfoManager.SetExperience(player, WorkType.TaxiDriver, reward.WorkExp); _playerInfoManager.SetExperience(player, taxiFee * reward.Exp); }
/// <summary> /// Выдать награду /// </summary> private void SetReward(Client player, int salaryCoef = 1) { var workLevel = _workInfoManager.GetWorkInfo(player, WorkType.TractorDriver).Level; var reward = _rewards[workLevel]; _playerInfoManager.SetExperience(player, reward.Exp); _workInfoManager.SetSalary(player, WorkType.TractorDriver, reward.Salary * salaryCoef); _workInfoManager.SetExperience(player, WorkType.TractorDriver, reward.WorkExp); }
/// <summary> /// Выдает награду игроку /// </summary> private void SetReward(Client player, bool evacuationCorrect) { var workLevel = _workInfoManager.GetWorkInfo(player, WorkType.Wrecker).Level; var reward = evacuationCorrect ? _rewards[workLevel] : _penalty; _workInfoManager.SetSalary(player, WorkType.Wrecker, reward.Salary); _workInfoManager.SetExperience(player, WorkType.Wrecker, reward.WorkExp); _playerInfoManager.SetExperience(player, reward.Exp); }
/// <summary> /// Выдает награду игроку /// </summary> private void SetReward(Client player) { var workLevel = _workInfoManager.GetWorkInfo(player, WorkType.Farmer).Level; var reward = _rewards[workLevel]; _playerInfoManager.SetExperience(player, reward.Exp); _workInfoManager.SetSalary(player, WorkType.Farmer, reward.Salary); _workInfoManager.SetExperience(player, WorkType.Farmer, reward.WorkExp); }
/// <summary> /// Выдает награду за доставку груза /// </summary> private void SetReward(Client player) { var workLevel = _workInfoManager.GetWorkInfo(player, WorkType.Trucker).Level; var contract = PlayerHelper.GetData <DeliveryContract>(player, WorkData.DELIVERY_CONTRACT, null); var reward = _rewards[workLevel]; _workInfoManager.SetSalary(player, WorkType.Trucker, contract.Reward + reward.Salary); _workInfoManager.SetExperience(player, WorkType.Trucker, reward.WorkExp); _playerInfoManager.SetExperience(player, reward.Exp); API.sendNotificationToPlayer(player, $"~g~Бонус от уровня работы: {reward.Salary}$"); }
/// <summary> /// Завершение рабочей точки /// </summary> private void FinishPoint(Client player, object[] args) { API.stopPlayerAnimation(player); var workInfo = _workInfoManager.GetActiveWork(player); if (workInfo == null) { return; } var reward = _rewards[workInfo.Level]; _workInfoManager.SetSalary(player, WorkType.Builder, reward.Salary); _workInfoManager.SetExperience(player, WorkType.Builder, reward.WorkExp); _playerInfoManager.SetExperience(player, reward.Exp); ShowNextPoint(player); }
/// <summary> /// Обработчик убийцы /// </summary> private void ProcessKiller(Client player, NetHandle handle, PlayerInfo deathPlayerInfo) { var killer = API.getPlayerFromHandle(handle); if (killer == null || player == killer) { return; } if (killer.hasData(WorkData.IS_POLICEMAN)) { var playerInfo = _playerInfoManager.GetInfo(player); if (playerInfo.Wanted.WantedLevel > 0) { player.setData(PoliceManager.PRISONER_KEY, killer); } else { API.sendNotificationToPlayer(killer, "~b~Постарайтесь не причинять вред игрокам"); _workInfoManager.SetSalary(killer, WorkType.Police, POLICEMAN_PENALTY); } return; } _policeAlertManager.SendAlert(killer.position, PoliceAlertManager.MURDER_ALERT); var killerInfo = _playerInfoManager.GetInfo(killer); var oldWanted = killerInfo.Wanted.WantedLevel; killerInfo.Wanted.Kills += 1; killerInfo.Wanted.TotalKills += 1; if (BothHasClan(deathPlayerInfo, killerInfo)) { var reputation = deathPlayerInfo.Clan.ClanId != killerInfo.Clan.ClanId ? 3 : -5; _clanManager.SetReputation(killer, reputation, killerInfo); _playerInfoManager.SetExperience(killer, CLAN_WAR_EXP); } _playerInfoManager.RefreshUI(killer, killerInfo); if (oldWanted != killerInfo.Wanted.WantedLevel) { API.sendNotificationToPlayer(killer, $"~m~Уровень розыска увеличен до: {killerInfo.Wanted.WantedLevel}"); } }
/// <summary> /// Обработчик доставки /// </summary> private void ProcessDelivery(Client player, object[] args) { if (!player.hasData(ON_TARGET)) { return; } var workLevel = _workInfoManager.GetWorkInfo(player, WorkType.Pilot).Level; var contract = (DeliveryContract)player.getData(WorkData.DELIVERY_CONTRACT); var reward = _rewards[workLevel]; _playerInfoManager.SetExperience(player, reward.Exp); _workInfoManager.SetSalary(player, WorkType.Pilot, contract.Reward + reward.Salary); _workInfoManager.SetExperience(player, WorkType.Pilot, reward.WorkExp); API.sendNotificationToPlayer(player, $"~g~Бонус от уровня работы: {reward.Salary}$"); var reputation = GetClanReputation(contract); if (reputation > 0) { _clanManager.SetReputation(player, reputation); } player.resetData(WorkData.DELIVERY_CONTRACT); player.resetData(ON_TARGET); API.triggerClientEvent(player, ServerEvent.HIDE_PILOT_TARGET_POINT); }
/// <summary> /// Обновить прогресс текущей рабочей смены /// </summary> private void SetPlayerReward(Client player, WorkReward reward) { _workInfoManager.SetSalary(player, WorkType.Forklift, reward.Salary); _workInfoManager.SetExperience(player, WorkType.Forklift, reward.WorkExp); _playerInfoManager.SetExperience(player, reward.Exp); }