Пример #1
0
        public void UpdateVIPForUser()
        {
            if (m_character.LastVIPPackTime >= DateTime.Now.AddDays(-7) && m_character.VIPExpireDay >= DateTime.Now)
            {
                m_character.CanTakeVipReward = true;
            }
            else { m_character.CanTakeVipReward = false; }

            if (m_character.VIPExpireDay >= DateTime.Now)
            {
                if (m_character.VIPNextLevelDaysNeeded == 0)
                {
                    m_character.VIPNextLevelDaysNeeded = m_character.DaysNeeded(m_character.VIPLevel);
                }
                if (m_character.VIPLastDate.Date != DateTime.Now.Date)
                {
                    m_character.VIPExp += 10;
                    m_character.VipUpdate();
                }
                m_character.VIPNextLevelDaysNeeded = m_character.DaysNeeded(m_character.VIPLevel) - m_character.VIPExp / 10;

            }
            else
            {
                if (m_character.VIPExp >= 5)
                {
                    if (m_character.VIPLastDate.Date != DateTime.Now.Date)
                    {
                        m_character.VIPExp -= 5;
                        m_character.VipUpdate();
                    }
                    if (m_character.VIPExp < 0)
                    {
                        m_character.VIPExp = 0;
                    }
                    m_character.VIPNextLevelDaysNeeded = m_character.DaysNeeded(m_character.VIPLevel) - m_character.VIPExp / 10;

                }

            }
            using (PlayerBussiness db = new PlayerBussiness())
            {
                db.VIPLastdate(m_character.ID);
            }
        }