Exemple #1
0
        public void AddRestBonus(RestTypes restType, float restBonus)
        {
            // Don't add extra rest bonus to max level players. Note: Might need different condition in next expansion for honor XP (PLAYER_LEVEL_MIN_HONOR perhaps).
            if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
            {
                restBonus = 0;
            }

            float totalRestBonus = GetRestBonus(restType) + restBonus;

            SetRestBonus(restType, totalRestBonus);
        }
Exemple #2
0
        public float CalcExtraPerSec(RestTypes restType, float bubble)
        {
            switch (restType)
            {
            case RestTypes.Honor:
                return(_player.m_activePlayerData.HonorNextLevel / 72000.0f * bubble);

            case RestTypes.XP:
                return(_player.m_activePlayerData.NextLevelXP / 72000.0f * bubble);

            default:
                return(0.0f);
            }
        }
Exemple #3
0
        public float CalcExtraPerSec(RestTypes restType, float bubble)
        {
            switch (restType)
            {
            case RestTypes.Honor:
                return((_player.GetUInt32Value(ActivePlayerFields.HonorNextLevel)) / 72000.0f * bubble);

            case RestTypes.XP:
                return((_player.GetUInt32Value(ActivePlayerFields.NextLevelXp)) / 72000.0f * bubble);

            default:
                return(0.0f);
            }
        }
Exemple #4
0
        public uint GetRestBonusFor(RestTypes restType, uint xp)
        {
            uint rested_bonus = (uint)GetRestBonus(restType); // xp for each rested bonus

            if (rested_bonus > xp)                            // max rested_bonus == xp or (r+x) = 200% xp
            {
                rested_bonus = xp;
            }

            SetRestBonus(restType, GetRestBonus(restType) - rested_bonus);

            Log.outDebug(LogFilter.Player, "RestMgr.GetRestBonus: Player '{0}' ({1}) gain {2} xp (+{3} Rested Bonus). Rested points={4}",
                         _player.GetGUID().ToString(), _player.GetName(), xp + rested_bonus, rested_bonus, GetRestBonus(restType));
            return(rested_bonus);
        }
        private async void BindProperties(Vouchers voucher)
        {
            if (voucher != null)
            {
                Voucher = voucher;
            }

            Clients = await GetClients();

            Hotels = await GetHotels();

            RestTypes = await GetRestTypes();

            AdditionalServices = await GetAdditionalServices();

            Stuffs = await GetStuffs();

            PaymentStatuses = new List <string> {
                "Оплачено", "Не оплачено"
            };
            BookingStatuses = new List <string> {
                "Забронирован", "Не забронирован"
            };

            if (_handleType == HandleType.Add)
            {
                return;
            }
            Client        = Clients.FirstOrDefault(p => Voucher.ClientId == p.Id);
            Hotel         = Hotels.FirstOrDefault(p => Voucher.HotelId == p.Id);
            RestType      = RestTypes.FirstOrDefault(p => Voucher.RestTypeId == p.Id);
            Stuff         = Stuffs.FirstOrDefault(p => Voucher.StuffId == p.Id);
            PaymentStatus = Voucher.PaymentStatus;
            BookingStatus = Voucher.BookingStatus;
            StartDate     = Voucher.StartDate;
            EndDate       = Voucher.EndDate;

            AdditionalService1 = AdditionalServices.FirstOrDefault(p => Voucher.AdditService1Id == p.Id);
            AdditionalService2 = AdditionalServices.FirstOrDefault(p => Voucher.AdditService2Id == p.Id);
            AdditionalService3 = AdditionalServices.FirstOrDefault(p => Voucher.AdditService3Id == p.Id);
        }
Exemple #6
0
        public uint GetRestBonusFor(RestTypes restType, uint xp)
        {
            uint rested_bonus = (uint)GetRestBonus(restType); // xp for each rested bonus

            if (rested_bonus > xp)                            // max rested_bonus == xp or (r+x) = 200% xp
            {
                rested_bonus = xp;
            }

            uint rested_loss = rested_bonus;

            if (restType == RestTypes.XP)
            {
                MathFunctions.AddPct(ref rested_loss, _player.GetTotalAuraModifier(AuraType.ModRestedXpConsumption));
            }

            SetRestBonus(restType, GetRestBonus(restType) - rested_loss);

            Log.outDebug(LogFilter.Player, "RestMgr.GetRestBonus: Player '{0}' ({1}) gain {2} xp (+{3} Rested Bonus). Rested points={4}",
                         _player.GetGUID().ToString(), _player.GetName(), xp + rested_bonus, rested_bonus, GetRestBonus(restType));
            return(rested_bonus);
        }
Exemple #7
0
 public float GetRestBonus(RestTypes restType)
 {
     return(_restBonus[(int)restType]);
 }
Exemple #8
0
 public void LoadRestBonus(RestTypes restType, PlayerRestState state, float restBonus)
 {
     _restBonus[(int)restType] = restBonus;
     _player.SetRestState(restType, state);
     _player.SetRestThreshold(restType, (uint)restBonus);
 }
Exemple #9
0
        public void SetRestBonus(RestTypes restType, float restBonus)
        {
            uint next_level_xp;
            bool affectedByRaF = false;

            switch (restType)
            {
            case RestTypes.XP:
                // Reset restBonus (XP only) for max level players
                if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
                {
                    restBonus = 0;
                }

                next_level_xp = _player.m_activePlayerData.NextLevelXP;
                affectedByRaF = true;
                break;

            case RestTypes.Honor:
                // Reset restBonus (Honor only) for players with max honor level.
                if (_player.IsMaxHonorLevel())
                {
                    restBonus = 0;
                }

                next_level_xp = _player.m_activePlayerData.HonorNextLevel;
                break;

            default:
                return;
            }

            float rest_bonus_max = next_level_xp * 1.5f / 2;

            if (restBonus < 0)
            {
                restBonus = 0;
            }

            if (restBonus > rest_bonus_max)
            {
                restBonus = rest_bonus_max;
            }

            _restBonus[(int)restType] = restBonus;

            uint oldBonus = (uint)_restBonus[(int)restType];

            if (oldBonus == restBonus)
            {
                return;
            }

            // update data for client
            if (affectedByRaF && _player.GetsRecruitAFriendBonus(true) && (_player.GetSession().IsARecruiter() || _player.GetSession().GetRecruiterId() != 0))
            {
                _player.SetRestState(restType, PlayerRestState.RAFLinked);
            }
            else
            {
                if (_restBonus[(int)restType] > 10)
                {
                    _player.SetRestState(restType, PlayerRestState.Rested);
                }
                else if (_restBonus[(int)restType] <= 1)
                {
                    _player.SetRestState(restType, PlayerRestState.NotRAFLinked);
                }
            }

            // RestTickUpdate
            _player.SetRestThreshold(restType, (uint)_restBonus[(int)restType]);
        }
Exemple #10
0
 public void LoadRestBonus(RestTypes restType, PlayerRestState state, float restBonus)
 {
     _restBonus[(int)restType] = restBonus;
     _player.SetUInt32Value(ActivePlayerFields.RestInfo + (int)restType * 2, (uint)state);
     _player.SetUInt32Value(ActivePlayerFields.RestInfo + (int)restType * 2 + 1, (uint)restBonus);
 }
Exemple #11
0
        public void SetRestBonus(RestTypes restType, float restBonus)
        {
            byte rest_rested_offset;
            byte rest_state_offset;
            ActivePlayerFields next_level_xp_field;
            bool affectedByRaF = false;

            switch (restType)
            {
            case RestTypes.XP:
                // Reset restBonus (XP only) for max level players
                if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
                {
                    restBonus = 0;
                }

                rest_rested_offset  = PlayerFieldOffsets.RestRestedXp;
                rest_state_offset   = PlayerFieldOffsets.RestStateXp;
                next_level_xp_field = ActivePlayerFields.NextLevelXp;
                affectedByRaF       = true;
                break;

            case RestTypes.Honor:
                // Reset restBonus (Honor only) for players with max honor level.
                if (_player.IsMaxHonorLevel())
                {
                    restBonus = 0;
                }

                rest_rested_offset  = PlayerFieldOffsets.RestRestedHonor;
                rest_state_offset   = PlayerFieldOffsets.RestStateHonor;
                next_level_xp_field = ActivePlayerFields.HonorNextLevel;
                break;

            default:
                return;
            }

            if (restBonus < 0)
            {
                restBonus = 0;
            }

            float rest_bonus_max = (float)(_player.GetUInt32Value(next_level_xp_field)) * 1.5f / 2;

            if (restBonus > rest_bonus_max)
            {
                _restBonus[(int)restType] = rest_bonus_max;
            }
            else
            {
                _restBonus[(int)restType] = restBonus;
            }

            // update data for client
            if (affectedByRaF && _player.GetsRecruitAFriendBonus(true) && (_player.GetSession().IsARecruiter() || _player.GetSession().GetRecruiterId() != 0))
            {
                _player.SetUInt32Value(ActivePlayerFields.RestInfo + rest_state_offset, (uint)PlayerRestState.RAFLinked);
            }
            else
            {
                if (_restBonus[(int)restType] > 10)
                {
                    _player.SetUInt32Value(ActivePlayerFields.RestInfo + rest_state_offset, (uint)PlayerRestState.Rested);
                }
                else if (_restBonus[(int)restType] <= 1)
                {
                    _player.SetUInt32Value(ActivePlayerFields.RestInfo + rest_state_offset, (uint)PlayerRestState.NotRAFLinked);
                }
            }

            // RestTickUpdate
            _player.SetUInt32Value(ActivePlayerFields.RestInfo + rest_rested_offset, (uint)_restBonus[(int)restType]);
        }