예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <summary>
        /// Выдать зарплату
        /// </summary>
        protected void PayOut(Client player, WorkInfo activeWork)
        {
            var workInfo = WorkInfoManager.GetWorkInfo(player, activeWork.Type);

            PlayerInfoManager.SetBalance(player, workInfo.Salary);
            workInfo.Salary = 0;
            WorkInfoManager.SetWorkInfo(player, workInfo);
        }
        /// <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>
        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>
        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);
        }
예제 #6
0
        /// <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);
        }
예제 #7
0
        /// <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);
        }
예제 #8
0
        /// <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}$");
        }
예제 #9
0
        /// <summary>
        /// Обработчик сдачи предмета
        /// </summary>
        public bool OnPutThing(ColShape shape, Client player)
        {
            if (!(ForkliftCorrect(player, () => player.hasData(THING_KEY)) && IsRightPutPoint(shape, player)))
            {
                return(false);
            }
            PutThing(player);
            var workLevel = _workInfoManager.GetWorkInfo(player, WorkType.Forklift).Level;

            SetPlayerReward(player, _workRewards[workLevel]);
            return(true);
        }
예제 #10
0
        /// <summary>
        /// Обработчик сдачи предмета
        /// </summary>
        public bool OnPutThing(ColShape shape, Client player)
        {
            if (!(IsRightPutPoint(shape, player) && LoaderCanPut(player)))
            {
                return(false);
            }
            var workLevel = _workInfoManager.GetWorkInfo(player, WorkType.Loader).Level;

            PutThing(player);
            SetPlayerReward(player, _workRewards[workLevel]);
            return(true);
        }
예제 #11
0
        /// <summary>
        /// Проверка, что игрок может ездить на такой машине
        /// </summary>
        private bool PlayerCanEnter(Client player, NetHandle vehicle)
        {
            const int police3MinLvl = 3;
            const int police2MinLvl = 4;

            if (!PlayerHelper.GetData(player, WorkData.IS_POLICEMAN, false))
            {
                API.sendNotificationToPlayer(player, "~r~Вы не работаете в полиции", true);
                return(false);
            }
            var workInfo = _workInfoManager.GetWorkInfo(player, WorkType.Police);

            if (VehicleHash.Police3 == (VehicleHash)API.getEntityModel(vehicle) && workInfo.Level < police3MinLvl)
            {
                API.sendNotificationToPlayer(player, $"~r~Необходим {police3MinLvl}-й уровень работы и выше", true);
                return(false);
            }
            if (VehicleHash.Police2 == (VehicleHash)API.getEntityModel(vehicle) && workInfo.Level < police2MinLvl)
            {
                API.sendNotificationToPlayer(player, $"~r~Необходим {police2MinLvl}-й уровень работы и выше", true);
                return(false);
            }
            return(true);
        }
예제 #12
0
        /// <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);
        }