コード例 #1
0
ファイル: Action1501.cs プロジェクト: jinfei426/Scut
        public override void BuildPacket()
        {
            PushIntoStack(pageCount);
            PushIntoStack(ContextUser.ExpNum);
            PushIntoStack(queueID);
            PushIntoStack(coldTime);
            PushIntoStack(userMagicArray.Count);
            foreach (UserMagic magic in userMagicArray)
            {
                magicInfo = new ConfigCacheSet<MagicInfo>().FindKey(magic.MagicID);
                if (IsUp(magic.MagicID, magic.MagicLv, ContextUser))
                {
                    isUp = 1;
                }
                else
                {
                    isUp = 0;
                }

                DataStruct ds = new DataStruct();
                ds.PushIntoStack(magic.MagicID);
                ds.PushIntoStack((int)magic.MagicType);
                ds.PushIntoStack(magicInfo == null ? string.Empty : magicInfo.MagicName.ToNotNullString());
                ds.PushIntoStack(magicInfo == null ? string.Empty : magicInfo.HeadID.ToNotNullString());
                ds.PushIntoStack((short)magic.MagicLv);
                ds.PushIntoStack(isUp);
                ds.PushIntoStack(magic.IsOpen ? 1 : 0);
                ds.PushIntoStack(magic.IsLv);
                PushIntoStack(ds);
            }
        }
コード例 #2
0
ファイル: Action1502.cs プロジェクト: jinfei426/Scut
        public override bool TakeAction()
        {
            magicInfo = new ConfigCacheSet<MagicInfo>().FindKey(magicID);
            userMagicArray = new GameDataCacheSet<UserMagic>().FindAll(ContextUser.UserID, u => u.MagicID == magicID);
            if (userMagicArray.Count > 0)
            {
                magicLv = userMagicArray[0].MagicLv;
            }
            int upgradeLv = MathUtils.Addition(magicLv, 1, int.MaxValue);
            if (upgradeLv <= 10)
            {
                magicLvInfo = new ConfigCacheSet<MagicLvInfo>().FindKey(magicID, upgradeLv);
            }

            return true;
        }
コード例 #3
0
ファイル: Action1503.cs プロジェクト: huyanoperation/Scut
        public override bool TakeAction()
        {
            //List<UserQueue> queueList = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.MagicStrong);
            //if (queueList.Count > 0)
            //{
            //    if (queueList[0].StrengNum >= 2 && queueList[0].DoRefresh() > 0)
            //    {
            //        ErrorCode = LanguageManager.GetLang().ErrorCode;
            //        ErrorInfo = LanguageManager.GetLang().St1503_MagicColding;
            //        return false;
            //    }
            //}
            magicInfo = new ConfigCacheSet<MagicInfo>().FindKey(magicID);
            if (magicInfo == null)
            {
                return false;
            }
            int maxMagicLv = ConfigEnvSet.GetInt("Queue.MaxLength");

            UserMagic userMagic = new GameDataCacheSet<UserMagic>().FindKey(ContextUser.UserID, magicID);
            if (userMagic == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1503_MagicIDNotEnough;
                return false;
            }
            sumMagicLv = MathUtils.Addition(userMagic.MagicLv, (short)1, (short)100);
            MagicLvInfo magicLvInfo = new ConfigCacheSet<MagicLvInfo>().FindKey(magicID, sumMagicLv);
            if (magicLvInfo == null || userMagic.MagicLv == maxMagicLv)
            {
                guideID = 1;
                //等级已达到最高
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1503_MaxMagicLv;
                return false;
            }
            if (ContextUser.UserLv < magicLvInfo.EscalateMinLv)
            {
                //超出用户等级
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1503_MagicLevel;
                return false;
            }

            experience = magicLvInfo.ExpNum;
            //codeTime = magicLvInfo.ColdTime;
            if (experience > ContextUser.ExpNum)
            {
                guideID = 3;
                //阅历不足
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1503_UpgradeExpNum);
                return false;
            }
            int useGold = 0;
            if (ops == 1)
            {
                if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.EquXiaoChuLengQueShiJian))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion;
                    return false;
                }
                useGold = (codeTime / 60);
                if (ContextUser.GoldNum < useGold)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return false;
                }

                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue);
            }
            else
            {
                //放入队列中
                // List<UserQueue> queueList = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType ==QueueType.MagicStrong);
                //todo
                //if (queueList.Count > 0)
                //{
                //    UserQueue queue = queueList[0];
                //    if (queue.DoRefresh() > 0 && queue.StrengNum < 2)
                //    {
                //        queue.TotalColdTime = MathUtils.Addition(queue.TotalColdTime, codeTime, int.MaxValue);
                //        queue.ColdTime = MathUtils.Addition(queue.ColdTime, codeTime, int.MaxValue);
                //        queue.IsSuspend = false;
                //        queue.StrengNum = MathUtils.Addition(queue.StrengNum, 1, int.MaxValue);
                //        //queue.Update();
                //    }
                //    else
                //    {
                //        queue.TotalColdTime = codeTime;
                //        queue.Timing = DateTime.Now;
                //        queue.ColdTime = codeTime;
                //        queue.IsSuspend = false;
                //        queue.StrengNum = 1;
                //        //queue.Update();
                //    }
                //}
                //else
                //{
                //    UserQueue userQueue = new UserQueue()
                //    {
                //        QueueID = Guid.NewGuid().ToString(),
                //        UserID = ContextUser.UserID,
                //        QueueType = QueueType.MagicStrong,
                //        QueueName = QueueType.MagicStrong.ToString(),
                //        TotalColdTime = codeTime,
                //        Timing = DateTime.Now,
                //        ColdTime = codeTime,
                //        StrengNum = 1,
                //        IsSuspend = false
                //    };
                //    new GameDataCacheSet<UserQueue>().Add(userQueue);
                //}
            }

            if (userMagic != null)
            {
                if (userMagic.MagicType == MagicType.MoFaZhen)
                {
                    MagicLvInfo mLvInfo = new ConfigCacheSet<MagicLvInfo>().FindKey(userMagic.MagicID, userMagic.MagicLv);
                    string[] mGridRange = mLvInfo.GridRange.Split(',');
                    foreach (string gridRange in mGridRange)
                    {
                        UserEmbattle userEmbattle = new GameDataCacheSet<UserEmbattle>().FindKey(ContextUser.UserID, userMagic.MagicID, gridRange.ToShort());
                        if (userEmbattle == null)
                        {
                            UserEmbattle embattle = new UserEmbattle()
                            {
                                UserID = ContextUser.UserID,
                                MagicID = userMagic.MagicID,
                                Position = gridRange.ToShort(),
                                GeneralID = 0
                            };
                            new GameDataCacheSet<UserEmbattle>().Add(embattle);
                        }
                    }
                }

                if (experience < ContextUser.ExpNum)
                {
                    ContextUser.ExpNum = MathUtils.Subtraction(ContextUser.ExpNum, experience, 0);
                    userMagic.MagicLv = MathUtils.Addition(userMagic.MagicLv, (short)1, (short)maxMagicLv);
                }
                UserLogHelper.AppenStrongLog(ContextUser.UserID, 1, null, magicID, 2, (short)userMagic.MagicLv, useGold, 0);
            }

            List<UserGeneral> userGeneralsArray = new GameDataCacheSet<UserGeneral>().FindAll(ContextUser.UserID, s => s.GeneralStatus == GeneralStatus.DuiWuZhong && s.GeneralType != GeneralType.Soul);
            foreach (UserGeneral general in userGeneralsArray)
            {
                general.RefreshMaxLife();
            }
            //日常任务-魔术升级
            TaskHelper.TriggerDailyTask(Uid, 4004);
            return true;
        }