Exemplo n.º 1
0
 private void UpdatePlantQuailty(UserPlantQuality plantQuality, PlantQualityType pQualityType, int totalNum)
 {
     plantQuality.GeneralID    = generalID;
     plantQuality.PlantQuality = pQualityType;
     plantQuality.RefreshDate  = DateTime.Now;
     plantQuality.RefreshNum   = MathUtils.Addition(totalNum, 1, int.MaxValue);
 }
Exemplo n.º 2
0
        public override bool TakeAction()
        {
            PlantType        pType            = (PlantType)Enum.Parse(typeof(PlantType), plantType.ToString());
            UserPlantQuality userPlantQuality = new GameDataCacheSet <UserPlantQuality>().FindKey(ContextUser.UserID, generalID, pType);

            if (userPlantQuality != null)
            {
                plantQualityType = (short)userPlantQuality.PlantQuality;
            }
            else
            {
                UserPlantQuality plant = new UserPlantQuality()
                {
                    UserID       = ContextUser.UserID,
                    GeneralID    = generalID,
                    PlantQuality = PlantQualityType.PuTong,
                    PlantType    = pType,
                    RefreshNum   = 0,
                    RefreshDate  = DateTime.Now,
                };
                new GameDataCacheSet <UserPlantQuality>().Add(plant);
                plantQualityType = 1;
            }
            PlantQualityType qualityType = (PlantQualityType)Enum.Parse(typeof(PlantQualityType), plantQualityType.ToString());
            short            generalLv   = 0;

            userGeneral = new GameDataCacheSet <UserGeneral>().FindKey(ContextUser.UserID, generalID);
            if (userGeneral == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            if (pType == PlantType.Experience)
            {
                generalLv = ContextUser.UserLv;
            }
            else if (pType == PlantType.GameGoin)
            {
                generalLv = userGeneral.GeneralLv;
            }
            plantInfo = new ConfigCacheSet <PlantInfo>().FindKey(generalLv, plantType, qualityType);
            double addNum = FestivalHelper.SurplusPurchased(ContextUser.UserID, FestivalType.ManorAddition);//活动加成

            rewardNum = plantInfo.GainNum;
            UserLand land = new GameDataCacheSet <UserLand>().FindKey(ContextUser.UserID, landPostion);

            if (land != null && land.IsRedLand == 1)
            {
                rewardNum = MathUtils.Addition(rewardNum, (int)(rewardNum * 0.2), int.MaxValue);
            }
            if (land != null && land.IsBlackLand == 1)
            {
                rewardNum = MathUtils.Addition(rewardNum, (int)(rewardNum * 0.4), int.MaxValue);
            }
            rewardNum = (rewardNum * addNum).ToInt();
            return(true);
        }
Exemplo n.º 3
0
        private void AppendPlantQuality(PlantType pType, PlantQualityType plantQualityType)
        {
            UserPlantQuality plant = new UserPlantQuality()
            {
                UserID       = ContextUser.UserID,
                GeneralID    = generalID,
                PlantType    = pType,
                PlantQuality = plantQualityType,
                RefreshNum   = 1,
                RefreshDate  = DateTime.Now
            };

            new GameDataCacheSet <UserPlantQuality>().Add(plant, GameEnvironment.CacheUserPeriod);
        }
Exemplo n.º 4
0
        private void AppendPlantQuality(PlantType pType, PlantQualityType plantQualityType)
        {
            UserPlantQuality plant = new UserPlantQuality()
            {
                UserID       = ContextUser.UserID,
                GeneralID    = generalID,
                PlantType    = pType,
                PlantQuality = plantQualityType,
                RefreshNum   = 1,
                RefreshDate  = DateTime.Now
            };

            new PersonalCacheStruct <UserPlantQuality>().Add(plant);
        }