예제 #1
0
        public override bool TakeAction()
        {
            UserHelper.GetFeelHunger(ContextUser.UserID, generalID);
            UserHelper.ChechDailyRestrain(ContextUser.UserID);
            generalInfo = new ShareCacheStruct <GeneralInfo>().FindKey(generalID);
            if (generalInfo != null)
            {
                giftName = GiftHelper.GetGiftTypeName(generalInfo.GiftType);
                if (generalInfo.ReplaceSkills != null)
                {
                    demandLv = generalInfo.ReplaceSkills.FeelLv;
                    AbilityInfo abilityInfo =
                        new ShareCacheStruct <AbilityInfo>().FindKey(generalInfo.ReplaceSkills.AbilityID);
                    if (abilityInfo != null)
                    {
                        skillName = abilityInfo.AbilityName;
                        skillDesc = abilityInfo.AbilityDesc;
                    }
                }
            }
            userGeneral = new PersonalCacheStruct <UserGeneral>().FindKey(ContextUser.UserID, generalID);
            if (userGeneral != null)
            {
                FeelLvInfo feelLvInfo = new ShareCacheStruct <FeelLvInfo>().FindKey(userGeneral.FeelLv);
                if (feelLvInfo != null)
                {
                    propertyList = feelLvInfo.Property.ToList();
                }
                short      feelLv       = MathUtils.Addition(userGeneral.FeelLv, (short)1, GiftHelper.maxFeelLv);
                FeelLvInfo upfeelLvInfo = new ShareCacheStruct <FeelLvInfo>().FindKey(feelLv);
                if (upfeelLvInfo != null)
                {
                    upExperience = upfeelLvInfo.Experience;
                }
                if (demandLv > 0 && userGeneral.FeelLv >= demandLv)
                {
                    isLearn = 1;
                }
                else
                {
                    isLearn = 0;
                }
            }

            goldNum = GiftHelper.SurplusGoldNum(ContextUser.UserID);
            int _itemid   = 5050; //消除饱食度物品ID
            var package   = UserItemPackage.Get(ContextUser.UserID);
            var itemArray =
                package.ItemPackage.FindAll(
                    m => m.ItemStatus.Equals(ItemStatus.BeiBao) && m.ItemID.Equals(_itemid));

            if (itemArray.Count > 0)
            {
                isSaturation = 1;
            }
            else
            {
                isSaturation = 0;
            }

            return(true);
        }