Esempio n. 1
0
        private static bool JugeSucess(int mergeItemID, CacheMergeItem cacheMergeItem, int addSuccessPercent)
        {
            int    randNum   = Global.GetRandomNumber(0, 101);
            double awardmuti = 0.0;

            if (50 == mergeItemID)
            {
                JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null != activity)
                {
                    JieRiMultConfig config = activity.GetConfig(13);
                    if (null != config)
                    {
                        awardmuti += config.GetMult();
                    }
                }
                SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                if (null != spAct)
                {
                    awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_MergeFruit);
                }
            }
            awardmuti = Math.Max(1.0, awardmuti);
            int successRate = (int)((double)cacheMergeItem.SuccessRate * awardmuti);

            return(randNum <= successRate + addSuccessPercent);
        }
Esempio n. 2
0
        private void ProcessAddRoleExperience(GameClient client)
        {
            long exp = this.GetBattleExpByLevel(client, client.ClientData.Level);

            if (exp > 0L)
            {
                double awardmuti = 0.0;
                JieRiMultAwardActivity jieriact = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null != jieriact)
                {
                    JieRiMultConfig config = jieriact.GetConfig(2);
                    if (null != config)
                    {
                        awardmuti += config.GetMult();
                    }
                }
                SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                if (null != spAct)
                {
                    awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_Battle);
                }
                awardmuti = Math.Max(1.0, awardmuti);
                exp       = (long)((double)exp * awardmuti);
                GameManager.ClientMgr.ProcessRoleExperience(client, exp, true, false, false, "none");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 判断是否成功
        /// </summary>
        /// <param name="cacheMergeItem"></param>
        /// <returns></returns>
        private static bool JugeSucess(int mergeItemID, CacheMergeItem cacheMergeItem, int addSuccessPercent)
        {
            int randNum = Global.GetRandomNumber(0, 101);

            double awardmuti = 1.0;

            if (50 == mergeItemID)
            {
                // 合服果实
                JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null != activity)
                {
                    JieRiMultConfig config = activity.GetConfig((int)MultActivityType.MergeFruitCoe);
                    if (null != config)
                    {
                        awardmuti += config.GetMult();
                    }
                }
            }

            int successRate = (int)(cacheMergeItem.SuccessRate * awardmuti);

            if (randNum <= (successRate + addSuccessPercent))
            {
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        /// <summary>
        /// 给予奖励
        /// </summary>
        /// <param name="client"></param>
        public void GiveAwardAngelTempleScene(bool bBossKilled)
        {
            List <Object> objsList = GameManager.ClientMgr.GetMapClients(m_AngelTempleData.MapCode); //发送给所有地图的用户

            if (null == objsList)
            {
                return;
            }

            //拷贝一份伤害列表
            int roleCount = 0;
            List <AngelTemplePointInfo> pointList = new List <AngelTemplePointInfo>();

            lock (m_PointDamageInfoMutex)
            {
                for (int i = 0; i < objsList.Count; ++i)
                {
                    if (!(objsList[i] is GameClient))
                    {
                        continue;
                    }

                    GameClient client = (objsList[i] as GameClient);

                    AngelTemplePointInfo tmpInfo;
                    if (!m_RoleDamageAngelValue.TryGetValue(client.ClientData.RoleID, out tmpInfo))
                    {
                        SendAngelTempleAwardMsg(client, -1, 0, 0, Global.GetLang("无"), "", bBossKilled);
                        continue;
                    }
                    if (tmpInfo.LeaveScene)
                    {
                        continue;
                    }
                    if (Interlocked.CompareExchange(ref tmpInfo.m_GetAwardFlag, 1, 0) != 0)
                    {
                        continue;
                    }

                    if (tmpInfo.m_DamagePoint < AngelTempleMinHurt)
                    {
                        SendAngelTempleAwardMsg(client, -1, 0, 0, Global.GetLang("无"), "", bBossKilled);
                        continue;
                    }

                    roleCount++;
                    pointList.Add(tmpInfo);
                }
            }

            //按伤害排序
            pointList.Sort(AngelTemplePointInfo.Compare_static); //从大到小排序

            //计算排名奖励
            if (bBossKilled)
            {
                foreach (var kv in GameManager.AngelTempleAward.SystemXmlItemDict)
                {
                    if (null != kv.Value)
                    {
                        int    id         = kv.Value.GetIntValue("ID");
                        int    minPaiMing = kv.Value.GetIntValue("MinPaiMing");
                        int    maxPaiMing = kv.Value.GetIntValue("MaxPaiMing");
                        int    shengWang  = kv.Value.GetIntValue("ShengWang");
                        int    gold       = kv.Value.GetIntValue("Gold");
                        string goodsStr   = kv.Value.GetStringValue("Goods");

                        minPaiMing = Global.GMax(0, minPaiMing - 1);
                        maxPaiMing = Global.GMin(10000, maxPaiMing - 1);
                        for (int i = minPaiMing; i <= maxPaiMing && i < roleCount; i++)
                        {
                            pointList[i].m_AwardPaiMing    = i + 1;
                            pointList[i].m_AwardShengWang += shengWang;
                            pointList[i].m_AwardGold      += gold;
                            pointList[i].GoodsList.AddNoRepeat(goodsStr);
                        }
                    }
                }

                //计算幸运奖励
                int[] luckPaiMings = new int[roleCount];
                for (int i = 0; i < roleCount; i++)
                {
                    luckPaiMings[i] = i;
                }
                int luckAwardsCount = 0; //幸运奖励计数
                foreach (var kv in GameManager.AngelTempleLuckyAward.SystemXmlItemDict)
                {
                    if (null != kv.Value)
                    {
                        int    awardID        = kv.Value.GetIntValue("ID");
                        int    awardNum       = kv.Value.GetIntValue("Number");
                        string luckAwardsName = Global.GetLang(kv.Value.GetStringValue("Name"));
                        string luckAwardGoods = kv.Value.GetStringValue("Goods");
                        for (int count = 0; count < awardNum && luckAwardsCount < roleCount; count++, luckAwardsCount++)
                        {
                            int rand = Global.GetRandomNumber(luckAwardsCount, roleCount); //在剩下的角色里面随机抽取一个
                            int t    = luckPaiMings[luckAwardsCount];
                            luckPaiMings[luckAwardsCount] = luckPaiMings[rand];
                            luckPaiMings[rand]            = t;

                            int index = luckPaiMings[luckAwardsCount]; //此幸运获奖者在伤害排行中的位置
                            //pointList[index].m_LuckPaiMingID = awardID;
                            pointList[index].m_LuckPaiMingName = luckAwardsName;
                            pointList[index].GoodsList.AddNoRepeat(luckAwardGoods);
                        }
                    }
                }
            }
            else
            {
                SystemXmlItem xmlItem = null;
                foreach (var kv in GameManager.AngelTempleAward.SystemXmlItemDict)
                {
                    if (null != kv.Value)
                    {
                        xmlItem = kv.Value;
                    }
                }

                if (null != xmlItem)
                {
                    int    id        = xmlItem.GetIntValue("ID");
                    int    shengWang = xmlItem.GetIntValue("ShengWang");
                    int    gold      = xmlItem.GetIntValue("Gold");
                    string goodsStr  = xmlItem.GetStringValue("Goods");

                    for (int i = 0; i < roleCount; i++)
                    {
                        pointList[i].m_AwardPaiMing    = -1;
                        pointList[i].m_LuckPaiMingName = Global.GetLang("无");
                        pointList[i].m_AwardShengWang  = shengWang;
                        pointList[i].m_AwardGold       = gold;
                        pointList[i].GoodsList.AddNoRepeat(goodsStr);
                    }
                }
            }

            // 节日活动的多倍处理
            double awardmuti = 1.0;
            JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();

            if (null != activity)
            {
                JieRiMultConfig config = activity.GetConfig((int)MultActivityType.AngelTemple);
                if (null != config)
                {
                    awardmuti += config.GetMult();
                }
            }

            if (awardmuti > 1.0)
            {
                foreach (var dp in pointList)
                {
                    dp.m_AwardGold      = (int)(dp.m_AwardGold * awardmuti);
                    dp.m_AwardShengWang = (int)(dp.m_AwardShengWang * awardmuti);
                    foreach (var item in dp.GoodsList.Items)
                    {
                        item.GoodsNum = (int)(item.GoodsNum * awardmuti);
                    }
                }
            }

            //发放奖励
            foreach (var dp in pointList)
            {
                GameClient gc = GameManager.ClientMgr.FindClient(dp.m_RoleID);
                if (null != gc)
                {
                    if (dp.m_AwardGold > 0)
                    {
                        GameManager.ClientMgr.AddUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, gc, dp.m_AwardGold, "天使神殿奖励");
                    }
                    if (dp.m_AwardShengWang > 0)
                    {
                        GameManager.ClientMgr.ModifyShengWangValue(gc, dp.m_AwardShengWang, "天使神殿", true);
                        //GameManager.ClientMgr.ModifyZhanHunValue(gc, dp.m_AwardShengWang, false, true);
                    }

                    foreach (var item in dp.GoodsList.Items)
                    {
                        Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, gc, item.GoodsID, item.GoodsNum, 0, "", item.Level, item.Binding, 0, "", true, 1, "天使神殿奖励物品", Global.ConstGoodsEndTime, 0, 0, item.IsHaveLuckyProp, 0, item.ExcellencePorpValue, item.AppendLev);
                    }
                    SendAngelTempleAwardMsg(gc, dp.m_AwardPaiMing, dp.m_AwardGold, dp.m_AwardShengWang, dp.m_LuckPaiMingName, dp.GoodsList.ToString(), bBossKilled);
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 执行炼制
        /// </summary>
        /// <param name="type">炼制类型: 0 金币,1 绑钻,2钻石</param>
        /// <param name="count">炼制次数: 非正数表示全部剩余次数</param>
        /// <returns></returns>
        public bool ExecLianZhi(GameClient client, int type, int count)
        {
            int        roleID   = client.ClientData.RoleID;
            int        vipLevel = client.ClientData.VipLevel;
            int        nID      = (int)TCPGameServerCmds.CMD_SPR_EXEC_LIANZHI;
            string     useMsg   = "炼制系统";
            List <int> result   = new List <int>();

            result.Add(StdErrorCode.Error_Success);
            result.Add(type);
            result.Add(count);

            //验证配置和参数
            if (!ConfigLoadSuccess)
            {
                result[0] = StdErrorCode.Error_Config_Fault;
                client.sendCmd(nID, result);
            }
            else if (type < 0 || type > 2)
            {
                result[0] = StdErrorCode.Error_Invalid_Operation;
                client.sendCmd(nID, result);
            }
            else
            {
                int  needJinBi    = 0;
                int  needBangZuan = 0;
                int  needZuanShi  = 0;
                long addExp       = 0;
                int  addXingHun   = 0;
                int  addJinBi     = 0;

                int lianZhiCount    = 0;  //当日已用此数
                int lianZhiDayID    = -1; //使用的日期
                int lianZhiMaxCount = 0;  //最大次数限制
                int dayID           = TimeUtil.NowDateTime().DayOfYear;

                //整理次数、消耗和奖励信息
                if (type == 0)
                {
                    useMsg          = "金币炼制";
                    lianZhiCount    = Global.GetRoleParamsInt32FromDB(client, RoleParamName.LianZhiJinBiCount);
                    lianZhiDayID    = Global.GetRoleParamsInt32FromDB(client, RoleParamName.LianZhiJinBiDayID);
                    lianZhiMaxCount = JinBiLianZhi[2] + VIPJinBiLianZhi[Math.Min(VIPJinBiLianZhi.Length - 1, vipLevel)];
                    needJinBi       = JinBiLianZhi[0];
                    addExp          = JinBiLianZhi[1];

                    JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                    if (null != activity)
                    {
                        JieRiMultConfig config = activity.GetConfig((int)MultActivityType.ZhuanHuanCount);
                        if (null != config)
                        {
                            lianZhiMaxCount = lianZhiMaxCount * ((int)config.GetMult() + 1);
                        }
                        config = activity.GetConfig((int)MultActivityType.ZhuanHuanAward);
                        if (null != config)
                        {
                            addExp += (int)(addExp * config.GetMult());
                        }
                    }
                }
                else if (type == 1)
                {
                    useMsg          = "绑钻炼制";
                    lianZhiCount    = Global.GetRoleParamsInt32FromDB(client, RoleParamName.LianZhiBangZuanCount);
                    lianZhiDayID    = Global.GetRoleParamsInt32FromDB(client, RoleParamName.LianZhiBangZuanDayID);
                    lianZhiMaxCount = BangZuanLianZhi[2] + VIPBangZuanLianZhi[Math.Min(VIPBangZuanLianZhi.Length - 1, vipLevel)];
                    needBangZuan    = BangZuanLianZhi[0];
                    addXingHun      = BangZuanLianZhi[1];

                    JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                    if (null != activity)
                    {
                        JieRiMultConfig config = activity.GetConfig((int)MultActivityType.ZhuanHuanCount);
                        if (null != config)
                        {
                            lianZhiMaxCount = lianZhiMaxCount * ((int)config.GetMult() + 1);
                        }
                        config = activity.GetConfig((int)MultActivityType.ZhuanHuanAward);
                        if (null != config)
                        {
                            addXingHun += (int)(addXingHun * config.GetMult());
                        }
                    }
                }
                else if (type == 2)
                {
                    useMsg          = "钻石炼制";
                    lianZhiCount    = Global.GetRoleParamsInt32FromDB(client, RoleParamName.LianZhiZuanShiCount);
                    lianZhiDayID    = Global.GetRoleParamsInt32FromDB(client, RoleParamName.LianZhiZuanShiDayID);
                    lianZhiMaxCount = ZuanShiLianZhi[4] + VIPZuanShiLianZhi[Math.Min(VIPZuanShiLianZhi.Length - 1, vipLevel)];
                    needZuanShi     = ZuanShiLianZhi[0];
                    addExp          = ZuanShiLianZhi[1];
                    addXingHun      = ZuanShiLianZhi[2];
                    addJinBi        = ZuanShiLianZhi[3];

                    JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                    if (null != activity)
                    {
                        JieRiMultConfig config = activity.GetConfig((int)MultActivityType.ZhuanHuanCount);
                        if (null != config)
                        {
                            lianZhiMaxCount = lianZhiMaxCount * ((int)config.GetMult() + 1);
                        }
                        config = activity.GetConfig((int)MultActivityType.ZhuanHuanAward);
                        if (null != config)
                        {
                            addExp     += (int)(addExp * config.GetMult());
                            addXingHun += (int)(addXingHun * config.GetMult());
                            addJinBi   += (int)(addJinBi * config.GetMult());
                        }
                    }
                }

                //炼制日期已经不是今天,则次数归零
                if (lianZhiDayID != dayID)
                {
                    lianZhiCount = 0;
                }

                //如果传入0及以下的次数,则默认为最大次数
                if (count <= 0)
                {
                    count = lianZhiMaxCount - lianZhiCount;
                }

                //验证剩余次数
                if (count <= 0 || lianZhiCount + count > lianZhiMaxCount)
                {
                    result[0] = StdErrorCode.Error_No_Residue_Degree;
                    client.sendCmd(nID, result);
                }
                else
                {
                    needJinBi    *= count;
                    needBangZuan *= count;
                    needZuanShi  *= count;
                    addExp       *= count;
                    addXingHun   *= count;
                    addJinBi     *= count;

                    addExp = Global.GetExpMultiByZhuanShengExpXiShu(client, addExp);

                    //扣除消耗所需
                    if (needJinBi > 0 && !Global.SubBindTongQianAndTongQian(client, needJinBi, useMsg))
                    {
                        result[0] = StdErrorCode.Error_JinBi_Not_Enough;
                        client.sendCmd(nID, result);
                    }
                    else if (needBangZuan > 0 && !GameManager.ClientMgr.SubUserGold(client, needBangZuan, useMsg))
                    {
                        result[0] = StdErrorCode.Error_BangZuan_Not_Enough;
                        client.sendCmd(nID, result);
                    }
                    else if (needZuanShi > 0 && !GameManager.ClientMgr.SubUserMoney(client, needZuanShi, useMsg))
                    {
                        result[0] = StdErrorCode.Error_ZuanShi_Not_Enough;
                        client.sendCmd(nID, result);
                    }
                    else
                    {
                        //既然该扣的都扣除了,下面可以给奖励了
                        if (addExp > 0)
                        {
                            GameManager.ClientMgr.ProcessRoleExperience(client, addExp);
                        }
                        if (addJinBi > 0)
                        {
                            GameManager.ClientMgr.AddMoney1(client, addJinBi, useMsg);
                        }
                        if (addXingHun > 0)
                        {
                            GameManager.ClientMgr.ModifyStarSoulValue(client, addXingHun, useMsg, true);
                        }

                        //计次存盘
                        lianZhiCount += count;
                        lianZhiDayID  = dayID;
                        if (type == 0)
                        {
                            // 七日活动
                            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.JinBiZhuanHuanTimes));

                            Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.LianZhiJinBiCount, lianZhiCount, true);
                            Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.LianZhiJinBiDayID, lianZhiDayID, true);
                        }
                        else if (type == 1)
                        {
                            // 七日活动
                            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.BangZuanZhuanHuanTimes));

                            Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.LianZhiBangZuanCount, lianZhiCount, true);
                            Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.LianZhiBangZuanDayID, lianZhiDayID, true);
                        }
                        else if (type == 2)
                        {
                            // 七日活动
                            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.ZuanShiZhuanHuanTimes));

                            Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.LianZhiZuanShiCount, lianZhiCount, true);
                            Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.LianZhiZuanShiDayID, lianZhiDayID, true);
                        }

                        //返回结果
                        client.sendCmd(nID, result);
                    }
                }
            }

            return(true);
        }
Esempio n. 6
0
 private void ProcessAward(GameClient client)
 {
     if (this.BattlingState >= BattleStates.StartFight)
     {
         if (this.BattlingState == BattleStates.StartFight)
         {
             long ticks = TimeUtil.NOW();
             if (ticks < this.StateStartTicks + 1000L)
             {
                 return;
             }
         }
         lock (this.mutex)
         {
             int nFlag;
             if (!this.TheKingOfPKGetawardFlag.TryGetValue(client.ClientData.RoleID, out nFlag))
             {
                 return;
             }
             if (nFlag > 0)
             {
                 return;
             }
             this.TheKingOfPKGetawardFlag[client.ClientData.RoleID] = 1;
         }
         if (client.ClientData.KingOfPkCurrentPoint > this.TheKingOfPKTopPoint)
         {
             this.SetTotalPointInfo(client.ClientData.RoleName, client.ClientData.KingOfPkCurrentPoint);
         }
         string   strPkAward  = GameManager.systemParamsList.GetParamValueByName("PkAward");
         string[] strChengJiu = null;
         string[] strExp      = null;
         if (!string.IsNullOrEmpty(strPkAward))
         {
             string[] strFild = strPkAward.Split(new char[]
             {
                 '|'
             });
             string strInfo = strFild[0];
             strChengJiu = strInfo.Split(new char[]
             {
                 ','
             });
             strInfo = strFild[1];
             strExp  = strInfo.Split(new char[]
             {
                 ','
             });
         }
         HeFuAwardTimesActivity activity = HuodongCachingMgr.GetHeFuAwardTimesActivity();
         JieRiMultAwardActivity jieriact = HuodongCachingMgr.GetJieRiMultAwardActivity();
         SpecPriorityActivity   spAct    = HuodongCachingMgr.GetSpecPriorityActivity();
         double actTimes = 0.0;
         if (activity != null && activity.InActivityTime() && (double)activity.activityTimes > 0.0)
         {
             actTimes += (double)activity.activityTimes;
         }
         if (null != jieriact)
         {
             JieRiMultConfig config = jieriact.GetConfig(3);
             if (null != config)
             {
                 actTimes += config.GetMult();
             }
         }
         if (null != spAct)
         {
             actTimes += spAct.GetMult(SpecPActivityBuffType.SPABT_PKKing);
         }
         actTimes = Math.Max(1.0, actTimes);
         int nChengjiuPoint = Global.SafeConvertToInt32(strChengJiu[0]) + Global.GMin(Global.SafeConvertToInt32(strChengJiu[1]), client.ClientData.KingOfPkCurrentPoint) * Global.SafeConvertToInt32(strChengJiu[2]);
         nChengjiuPoint *= (int)actTimes;
         if (nChengjiuPoint > 0)
         {
             ChengJiuManager.AddChengJiuPoints(client, "角斗赛", nChengjiuPoint, true, true);
         }
         double nRate         = Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount];
         long   nExp          = (long)((int)((double)Global.SafeConvertToInt32(strExp[0]) * nRate + (double)(Global.GMin(Global.SafeConvertToInt32(strExp[1]), client.ClientData.KingOfPkCurrentPoint) * Global.SafeConvertToInt32(strExp[2])) * nRate));
         double dblExperience = 1.0;
         dblExperience += actTimes;
         nExp           = (long)((int)((double)nExp * dblExperience));
         if (nExp > 0L)
         {
             GameManager.ClientMgr.ProcessRoleExperience(client, nExp, true, true, false, "none");
         }
         string strCmd = string.Format("{0}:{1}:{2}", client.ClientData.KingOfPkCurrentPoint, nChengjiuPoint, nExp);
         client.ClientData.KingOfPkCurrentPoint = 0;
         GameManager.ClientMgr.SendToClient(client, strCmd, 569);
         ProcessTask.ProcessAddTaskVal(client, TaskTypes.PKKing, -1, 1, new object[0]);
     }
 }
Esempio n. 7
0
        private void ProcessRoleBattleExpAndFlagAward(GameClient client, int successSide, int paiMing)
        {
            ProcessTask.ProcessAddTaskVal(client, TaskTypes.Battle, -1, 1, new object[0]);
            List <BattleManager.Award> awardByScore = this.BattleAwardByScore;

            if (null == awardByScore)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("处理大乱斗结束奖励时, 奖励列表项未空", new object[0]), null, true);
            }
            else
            {
                double                 expAward       = 0.0;
                double                 MoJingAward    = 0.0;
                double                 chengJiuAward  = 0.0;
                AwardsItemList         awardsItemList = new AwardsItemList();
                bool                   successed      = successSide == client.ClientData.BattleWhichSide;
                double                 awardmuti      = 0.0;
                HeFuAwardTimesActivity hefuact        = HuodongCachingMgr.GetHeFuAwardTimesActivity();
                if (hefuact != null && hefuact.InActivityTime())
                {
                    awardmuti += (double)hefuact.activityTimes;
                }
                JieRiMultAwardActivity jieriact = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null != jieriact)
                {
                    JieRiMultConfig config = jieriact.GetConfig(2);
                    if (null != config)
                    {
                        awardmuti += config.GetMult();
                    }
                }
                SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                if (null != spAct)
                {
                    awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_Battle);
                }
                awardmuti = Math.Max(1.0, awardmuti);
                foreach (BattleManager.Award award in awardByScore)
                {
                    if (client.ClientData.BattleKilledNum >= award.MinJiFen && client.ClientData.BattleKilledNum < award.MaxJiFen)
                    {
                        expAward = (double)(client.ClientData.BattleKilledNum * award.ExpXiShu);
                        if (award.MoJingXiShu > 0.0)
                        {
                            MoJingAward = (double)((int)((double)client.ClientData.BattleKilledNum * award.MoJingXiShu));
                        }
                        if (award.ChengJiuXiShu > 0.0)
                        {
                            chengJiuAward = (double)((int)((double)client.ClientData.BattleKilledNum * award.ChengJiuXiShu));
                        }
                        if (!successed)
                        {
                            if (expAward > 0.0)
                            {
                                expAward *= 0.8;
                            }
                            if (MoJingAward > 0.0)
                            {
                                MoJingAward *= 0.8;
                            }
                            if (chengJiuAward > 0.0)
                            {
                                chengJiuAward *= 0.8;
                            }
                        }
                        expAward      = (double)((long)(expAward * Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount]));
                        expAward      = Math.Max(expAward, (double)award.MinExp * Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount]);
                        expAward      = Math.Min(expAward, (double)award.MaxExp * Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount]);
                        MoJingAward   = Math.Max(MoJingAward, (double)award.MinMoJing);
                        MoJingAward   = Math.Min(MoJingAward, (double)award.MaxMoJing);
                        chengJiuAward = Math.Max(chengJiuAward, (double)award.MinChengJiu);
                        chengJiuAward = Math.Min(chengJiuAward, (double)award.MaxChengJiu);
                        if (expAward > 0.0)
                        {
                            expAward = (double)((int)(expAward * awardmuti));
                        }
                        if (MoJingAward > 0.0)
                        {
                            MoJingAward = (double)((int)(MoJingAward * awardmuti));
                        }
                        if (chengJiuAward > 0.0)
                        {
                            chengJiuAward = (double)((int)(chengJiuAward * awardmuti));
                        }
                        break;
                    }
                }
                foreach (SystemXmlItem xml in GameManager.SystemBattlePaiMingAwards.SystemXmlItemDict.Values)
                {
                    if (null != xml)
                    {
                        int min = xml.GetIntValue("MinPaiMing", -1) - 1;
                        int max = xml.GetIntValue("MaxPaiMing", -1) - 1;
                        if (paiMing >= min && paiMing <= max)
                        {
                            awardsItemList.AddNoRepeat(xml.GetStringValue("Goods"));
                        }
                    }
                }
                if (expAward > 0.0)
                {
                    GameManager.ClientMgr.ProcessRoleExperience(client, (long)expAward, true, false, false, "none");
                }
                if (MoJingAward > 0.0)
                {
                    GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, (int)MoJingAward, "阵营战", false, true, false);
                }
                if (chengJiuAward > 0.0)
                {
                    GameManager.ClientMgr.ModifyChengJiuPointsValue(client, (int)chengJiuAward, "阵营战", false, true);
                }
                List <GoodsData> goodsDataList = Global.ConvertToGoodsDataList(awardsItemList.Items, -1);
                if (!Global.CanAddGoodsDataList(client, goodsDataList))
                {
                    GameManager.ClientMgr.SendMailWhenPacketFull(client, goodsDataList, GLang.GetLang(13, new object[0]), string.Format(GLang.GetLang(14, new object[0]), paiMing + 1));
                }
                else
                {
                    for (int i = 0; i < goodsDataList.Count; i++)
                    {
                        Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, goodsDataList[i].GoodsID, goodsDataList[i].GCount, goodsDataList[i].Quality, "", goodsDataList[i].Forge_level, goodsDataList[i].Binding, 0, "", true, 1, "阵营战排名奖励", "1900-01-01 12:00:00", 0, goodsDataList[i].BornIndex, goodsDataList[i].Lucky, 0, goodsDataList[i].ExcellenceInfo, goodsDataList[i].AppendPropLev, 0, null, null, 0, true);
                    }
                }
                GameManager.ClientMgr.NotifySelfSuiTangBattleAward(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, this.TangKilledNum, this.SuiKilledNum, (long)expAward, (int)MoJingAward, (int)chengJiuAward, successed, paiMing, awardsItemList.ToString());
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 给奖励
        /// </summary>
        private void ProcessAward(GameClient client)
        {
            int nFlag;

            if (BattlingState < BattleStates.StartFight)
            {
                //开始战斗前离开不给奖励
                return;
            }
            else if (BattlingState == BattleStates.StartFight)
            {
                long ticks = DateTime.Now.Ticks / 10000;
                if (ticks < StateStartTicks + 1000) //进场1秒后退出才给奖励,防止卡时间点刷奖励
                {
                    return;
                }
            }

            lock (mutex)
            {
                if (!TheKingOfPKGetawardFlag.TryGetValue(client.ClientData.RoleID, out nFlag))
                {
                    return;
                }

                if (nFlag > 0)
                {
                    return;
                }

                TheKingOfPKGetawardFlag[client.ClientData.RoleID] = 1;
            }

            if (client.ClientData.KingOfPkCurrentPoint > TheKingOfPKTopPoint)
            {
                SetTotalPointInfo(client.ClientData.RoleName, client.ClientData.KingOfPkCurrentPoint);
            }

            // 1.成就=系数1+Min(系数2,积分)*系数3   2.经验=Min(400,转生级别*400+人物等级)*系数1+Min(系数2,积分)*系数3  2014.4.21改成 人物级别*转生级别对应比例*系数1 +Min(系数2,积分)*系数3
            // 经验=系数1*SystemParams.xml定义的ZhuanShengExpXiShu参数值+Min(系数2,积分)*系数3*SystemParams.xml定义的ZhuanShengExpXiShu参数值

            string strPkAward = GameManager.systemParamsList.GetParamValueByName("PkAward");

            string[] strChengJiu    = null;
            string[] strExp         = null;
            int      nChengjiuPoint = 0;
            long     nExp           = 0;


            if (!string.IsNullOrEmpty(strPkAward))
            {
                string[] strFild = strPkAward.Split('|');

                string strInfo = strFild[0];

                strChengJiu = strInfo.Split(',');

                strInfo = strFild[1];

                strExp = strInfo.Split(',');
            }

            nChengjiuPoint = Global.SafeConvertToInt32(strChengJiu[0]) + Global.GMin(Global.SafeConvertToInt32(strChengJiu[1]), client.ClientData.KingOfPkCurrentPoint) *
                             Global.SafeConvertToInt32(strChengJiu[2]);

            if (nChengjiuPoint > 0)
            {
                ChengJiuManager.AddChengJiuPoints(client, "角斗赛", nChengjiuPoint, true, true);
            }

            //nExp = Global.GMin(400, client.ClientData.ChangeLifeCount * 400 + client.ClientData.Level) * Global.SafeConvertToInt32(strExp[0]) +
            //            Global.GMin(Global.SafeConvertToInt32(strExp[1]), client.ClientData.KingOfPkCurrentPoint) * Global.SafeConvertToInt32(strExp[2]);

            double nRate = 0.0;

            /*if (client.ClientData.ChangeLifeCount == 0)
             *  nRate = 1;
             * else
             *  nRate = Data.ChangeLifeInfoList[client.ClientData.ChangeLifeCount].ExpProportion;*/

            nRate = Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount];

            //(int)(client.ClientData.Level * nRate * Global.SafeConvertToInt32(strExp[0]) + Global.GMin(Global.SafeConvertToInt32(strExp[1]), client.ClientData.KingOfPkCurrentPoint) * Global.SafeConvertToInt32(strExp[2]));
            nExp = (int)(Global.SafeConvertToInt32(strExp[0]) * nRate + Global.GMin(Global.SafeConvertToInt32(strExp[1]), client.ClientData.KingOfPkCurrentPoint) * Global.SafeConvertToInt32(strExp[2]) * nRate);

            double dblExperience = 1.0;
            // 合服期间奖励翻倍
            // 活动时间内
            HeFuAwardTimesActivity activity = HuodongCachingMgr.GetHeFuAwardTimesActivity();

            if (null != activity && activity.InActivityTime() && activity.activityTimes > 0.0)
            {
                dblExperience += activity.activityTimes - 1;
            }
            // 节日多倍奖励
            JieRiMultAwardActivity jieriact = HuodongCachingMgr.GetJieRiMultAwardActivity();

            if (null != jieriact)
            {
                JieRiMultConfig config = jieriact.GetConfig((int)MultActivityType.TheKingOfPK);
                if (null != config)
                {
                    dblExperience += config.GetMult();
                }
            }


            nExp = (int)(nExp * dblExperience);

            if (nExp > 0)
            {
                GameManager.ClientMgr.ProcessRoleExperience(client, nExp);
            }

            string strCmd = "";

            // 1.自己的积分 2.获得成就积分 3.获得经验
            strCmd = string.Format("{0}:{1}:{2}", client.ClientData.KingOfPkCurrentPoint, nChengjiuPoint, nExp);

            client.ClientData.KingOfPkCurrentPoint = 0;

            GameManager.ClientMgr.SendToClient(client, strCmd, (int)TCPGameServerCmds.CMD_SPR_NOTIFYTHEKINGOFPKAWARDINFO);
        }
        public void GiveAwardAngelTempleScene(bool bBossKilled)
        {
            List <object> objsList = GameManager.ClientMgr.GetMapClients(this.m_AngelTempleData.MapCode);

            if (null != objsList)
            {
                int roleCount = 0;
                List <AngelTemplePointInfo> pointList = new List <AngelTemplePointInfo>();
                lock (this.m_PointDamageInfoMutex)
                {
                    for (int i = 0; i < objsList.Count; i++)
                    {
                        if (objsList[i] is GameClient)
                        {
                            GameClient           client = objsList[i] as GameClient;
                            AngelTemplePointInfo tmpInfo;
                            if (!this.m_RoleDamageAngelValue.TryGetValue(client.ClientData.RoleID, out tmpInfo))
                            {
                                this.SendAngelTempleAwardMsg(client, -1, 0, 0, GLang.GetLang(6, new object[0]), "", bBossKilled);
                            }
                            else if (!tmpInfo.LeaveScene)
                            {
                                if (Interlocked.CompareExchange(ref tmpInfo.m_GetAwardFlag, 1, 0) == 0)
                                {
                                    if (tmpInfo.m_DamagePoint < this.AngelTempleMinHurt)
                                    {
                                        this.SendAngelTempleAwardMsg(client, -1, 0, 0, GLang.GetLang(6, new object[0]), "", bBossKilled);
                                    }
                                    else
                                    {
                                        roleCount++;
                                        pointList.Add(tmpInfo);
                                    }
                                }
                            }
                        }
                    }
                }
                pointList.Sort(new Comparison <AngelTemplePointInfo>(AngelTemplePointInfo.Compare_static));
                if (bBossKilled)
                {
                    foreach (KeyValuePair <int, SystemXmlItem> kv in GameManager.AngelTempleAward.SystemXmlItemDict)
                    {
                        if (null != kv.Value)
                        {
                            int    id         = kv.Value.GetIntValue("ID", -1);
                            int    minPaiMing = kv.Value.GetIntValue("MinPaiMing", -1);
                            int    maxPaiMing = kv.Value.GetIntValue("MaxPaiMing", -1);
                            int    shengWang  = kv.Value.GetIntValue("ShengWang", -1);
                            int    gold       = kv.Value.GetIntValue("Gold", -1);
                            string goodsStr   = kv.Value.GetStringValue("Goods");
                            minPaiMing = Global.GMax(0, minPaiMing - 1);
                            maxPaiMing = Global.GMin(10000, maxPaiMing - 1);
                            int i = minPaiMing;
                            while (i <= maxPaiMing && i < roleCount)
                            {
                                pointList[i].m_AwardPaiMing    = i + 1;
                                pointList[i].m_AwardShengWang += shengWang;
                                pointList[i].m_AwardGold      += gold;
                                pointList[i].GoodsList.AddNoRepeat(goodsStr);
                                i++;
                            }
                        }
                    }
                    int[] luckPaiMings = new int[roleCount];
                    for (int i = 0; i < roleCount; i++)
                    {
                        luckPaiMings[i] = i;
                    }
                    int luckAwardsCount = 0;
                    foreach (KeyValuePair <int, SystemXmlItem> kv in GameManager.AngelTempleLuckyAward.SystemXmlItemDict)
                    {
                        if (null != kv.Value)
                        {
                            int    awardID        = kv.Value.GetIntValue("ID", -1);
                            int    awardNum       = kv.Value.GetIntValue("Number", -1);
                            string luckAwardsName = Global.GetLang(kv.Value.GetStringValue("Name"));
                            string luckAwardGoods = kv.Value.GetStringValue("Goods");
                            int    count          = 0;
                            while (count < awardNum && luckAwardsCount < roleCount)
                            {
                                int rand = Global.GetRandomNumber(luckAwardsCount, roleCount);
                                int t    = luckPaiMings[luckAwardsCount];
                                luckPaiMings[luckAwardsCount] = luckPaiMings[rand];
                                luckPaiMings[rand]            = t;
                                int index = luckPaiMings[luckAwardsCount];
                                pointList[index].m_LuckPaiMingName = luckAwardsName;
                                pointList[index].GoodsList.AddNoRepeat(luckAwardGoods);
                                count++;
                                luckAwardsCount++;
                            }
                        }
                    }
                }
                else
                {
                    SystemXmlItem xmlItem = null;
                    foreach (KeyValuePair <int, SystemXmlItem> kv in GameManager.AngelTempleAward.SystemXmlItemDict)
                    {
                        if (null != kv.Value)
                        {
                            xmlItem = kv.Value;
                        }
                    }
                    if (null != xmlItem)
                    {
                        int    id        = xmlItem.GetIntValue("ID", -1);
                        int    shengWang = xmlItem.GetIntValue("ShengWang", -1);
                        int    gold      = xmlItem.GetIntValue("Gold", -1);
                        string goodsStr  = xmlItem.GetStringValue("Goods");
                        for (int i = 0; i < roleCount; i++)
                        {
                            pointList[i].m_AwardPaiMing    = -1;
                            pointList[i].m_LuckPaiMingName = GLang.GetLang(6, new object[0]);
                            pointList[i].m_AwardShengWang  = shengWang;
                            pointList[i].m_AwardGold       = gold;
                            pointList[i].GoodsList.AddNoRepeat(goodsStr);
                        }
                    }
                }
                double awardmuti = 0.0;
                JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                if (null != activity)
                {
                    JieRiMultConfig config = activity.GetConfig(1);
                    if (null != config)
                    {
                        awardmuti += config.GetMult();
                    }
                }
                SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                if (null != spAct)
                {
                    awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_AngelTemple);
                }
                awardmuti = Math.Max(1.0, awardmuti);
                if (awardmuti > 1.0)
                {
                    foreach (AngelTemplePointInfo dp in pointList)
                    {
                        dp.m_AwardGold      = (int)((double)dp.m_AwardGold * awardmuti);
                        dp.m_AwardShengWang = (int)((double)dp.m_AwardShengWang * awardmuti);
                        foreach (AwardsItemData item in dp.GoodsList.Items)
                        {
                            item.GoodsNum = (int)((double)item.GoodsNum * awardmuti);
                        }
                    }
                }
                foreach (AngelTemplePointInfo dp in pointList)
                {
                    GameClient gc = GameManager.ClientMgr.FindClient(dp.m_RoleID);
                    if (null != gc)
                    {
                        ProcessTask.ProcessAddTaskVal(gc, TaskTypes.AngelTemple, -1, 1, new object[0]);
                        if (dp.m_AwardGold > 0)
                        {
                            GameManager.ClientMgr.AddUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, gc, dp.m_AwardGold, "天使神殿奖励", false);
                        }
                        if (dp.m_AwardShengWang > 0)
                        {
                            GameManager.ClientMgr.ModifyShengWangValue(gc, dp.m_AwardShengWang, "天使神殿", true, true);
                        }
                        foreach (AwardsItemData item in dp.GoodsList.Items)
                        {
                            Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, gc, item.GoodsID, item.GoodsNum, 0, "", item.Level, item.Binding, 0, "", true, 1, "天使神殿奖励物品", "1900-01-01 12:00:00", 0, 0, item.IsHaveLuckyProp, 0, item.ExcellencePorpValue, item.AppendLev, 0, null, null, 0, true);
                        }
                        this.SendAngelTempleAwardMsg(gc, dp.m_AwardPaiMing, dp.m_AwardGold, dp.m_AwardShengWang, dp.m_LuckPaiMingName, dp.GoodsList.ToString(), bBossKilled);
                    }
                }
            }
        }
Esempio n. 10
0
        public bool ExecLianZhi(GameClient client, int type, int count)
        {
            int        roleID   = client.ClientData.RoleID;
            int        vipLevel = client.ClientData.VipLevel;
            int        nID      = 668;
            string     useMsg   = "炼制系统";
            List <int> result   = new List <int>();

            result.Add(1);
            result.Add(type);
            result.Add(count);
            if (!this.ConfigLoadSuccess)
            {
                result[0] = -3;
                client.sendCmd <List <int> >(nID, result, false);
            }
            else if (type < 0 || type > 2)
            {
                result[0] = -5;
                client.sendCmd <List <int> >(nID, result, false);
            }
            else
            {
                int  needJinBi       = 0;
                int  needBangZuan    = 0;
                int  needZuanShi     = 0;
                long addExp          = 0L;
                int  addXingHun      = 0;
                int  addJinBi        = 0;
                int  lianZhiCount    = 0;
                int  lianZhiDayID    = -1;
                int  lianZhiMaxCount = 0;
                int  dayID           = TimeUtil.NowDateTime().DayOfYear;
                if (type == 0)
                {
                    useMsg          = "金币炼制";
                    lianZhiCount    = Global.GetRoleParamsInt32FromDB(client, "LianZhiJinBiCount");
                    lianZhiDayID    = Global.GetRoleParamsInt32FromDB(client, "LianZhiJinBiDayID");
                    lianZhiMaxCount = this.JinBiLianZhi[2] + this.VIPJinBiLianZhi[Math.Min(this.VIPJinBiLianZhi.Length - 1, vipLevel)];
                    needJinBi       = this.JinBiLianZhi[0];
                    addExp          = (long)this.JinBiLianZhi[1];
                    ProcessTask.ProcessAddTaskVal(client, TaskTypes.LianZhi_JinBi, -1, 1, new object[0]);
                    double awardmuti                = 0.0;
                    double awardmuticount           = 0.0;
                    double awardcount               = 0.0;
                    JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                    if (null != activity)
                    {
                        JieRiMultConfig config = activity.GetConfig(6);
                        if (null != config)
                        {
                            awardmuticount += config.GetMult();
                        }
                        config = activity.GetConfig(9);
                        if (null != config)
                        {
                            awardmuti += config.GetMult();
                        }
                    }
                    SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                    if (null != spAct)
                    {
                        awardmuti  += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanAward);
                        awardcount += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanCount);
                    }
                    awardmuti       = Math.Max(1.0, awardmuti);
                    awardmuticount  = Math.Max(1.0, awardmuticount);
                    addExp          = (long)((int)((double)addExp * awardmuti));
                    lianZhiMaxCount = lianZhiMaxCount * (int)awardmuticount + (int)awardcount;
                }
                else if (type == 1)
                {
                    useMsg          = "绑钻炼制";
                    lianZhiCount    = Global.GetRoleParamsInt32FromDB(client, "LianZhiBangZuanCount");
                    lianZhiDayID    = Global.GetRoleParamsInt32FromDB(client, "LianZhiBangZuanDayID");
                    lianZhiMaxCount = this.BangZuanLianZhi[2] + this.VIPBangZuanLianZhi[Math.Min(this.VIPBangZuanLianZhi.Length - 1, vipLevel)];
                    needBangZuan    = this.BangZuanLianZhi[0];
                    addXingHun      = this.BangZuanLianZhi[1];
                    double awardmuti                = 0.0;
                    double awardmuticount           = 0.0;
                    double awardcount               = 0.0;
                    JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                    if (null != activity)
                    {
                        JieRiMultConfig config = activity.GetConfig(6);
                        if (null != config)
                        {
                            awardmuticount += config.GetMult();
                        }
                        config = activity.GetConfig(9);
                        if (null != config)
                        {
                            awardmuti += config.GetMult();
                        }
                    }
                    SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                    if (null != spAct)
                    {
                        awardmuti  += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanAward);
                        awardcount += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanCount);
                    }
                    awardmuti       = Math.Max(1.0, awardmuti);
                    awardmuticount  = Math.Max(1.0, awardmuticount);
                    addXingHun      = (int)((double)addXingHun * awardmuti);
                    lianZhiMaxCount = lianZhiMaxCount * (int)awardmuticount + (int)awardcount;
                }
                else if (type == 2)
                {
                    useMsg          = "钻石炼制";
                    lianZhiCount    = Global.GetRoleParamsInt32FromDB(client, "LianZhiZuanShiCount");
                    lianZhiDayID    = Global.GetRoleParamsInt32FromDB(client, "LianZhiZuanShiDayID");
                    lianZhiMaxCount = this.ZuanShiLianZhi[4] + this.VIPZuanShiLianZhi[Math.Min(this.VIPZuanShiLianZhi.Length - 1, vipLevel)];
                    needZuanShi     = this.ZuanShiLianZhi[0];
                    addExp          = (long)this.ZuanShiLianZhi[1];
                    addXingHun      = this.ZuanShiLianZhi[2];
                    addJinBi        = this.ZuanShiLianZhi[3];
                    double awardmuti                = 0.0;
                    double awardmuticount           = 0.0;
                    double awardcount               = 0.0;
                    JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                    if (null != activity)
                    {
                        JieRiMultConfig config = activity.GetConfig(6);
                        if (null != config)
                        {
                            awardmuticount += config.GetMult();
                        }
                        config = activity.GetConfig(9);
                        if (null != config)
                        {
                            awardmuti += config.GetMult();
                        }
                    }
                    SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                    if (null != spAct)
                    {
                        awardmuti  += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanAward);
                        awardcount += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanCount);
                    }
                    awardmuti       = Math.Max(1.0, awardmuti);
                    awardmuticount  = Math.Max(1.0, awardmuticount);
                    addExp          = (long)((int)((double)addExp * awardmuti));
                    addXingHun      = (int)((double)addXingHun * awardmuti);
                    addJinBi        = (int)((double)addJinBi * awardmuti);
                    lianZhiMaxCount = lianZhiMaxCount * (int)awardmuticount + (int)awardcount;
                }
                if (lianZhiDayID != dayID)
                {
                    lianZhiCount = 0;
                }
                if (count <= 0)
                {
                    count = lianZhiMaxCount - lianZhiCount;
                }
                if (count <= 0 || lianZhiCount + count > lianZhiMaxCount)
                {
                    result[0] = -16;
                    client.sendCmd <List <int> >(nID, result, false);
                }
                else
                {
                    needJinBi    *= count;
                    needBangZuan *= count;
                    needZuanShi  *= count;
                    addExp       *= (long)count;
                    addXingHun   *= count;
                    addJinBi     *= count;
                    addExp        = Global.GetExpMultiByZhuanShengExpXiShu(client, addExp);
                    if (needJinBi > 0 && !Global.SubBindTongQianAndTongQian(client, needJinBi, useMsg))
                    {
                        result[0] = -9;
                        client.sendCmd <List <int> >(nID, result, false);
                    }
                    else if (needBangZuan > 0 && !GameManager.ClientMgr.SubUserGold(client, needBangZuan, useMsg))
                    {
                        result[0] = -17;
                        client.sendCmd <List <int> >(nID, result, false);
                    }
                    else if (needZuanShi > 0 && !GameManager.ClientMgr.SubUserMoney(client, needZuanShi, useMsg, true, true, true, true, DaiBiSySType.None))
                    {
                        result[0] = -10;
                        client.sendCmd <List <int> >(nID, result, false);
                    }
                    else
                    {
                        if (addExp > 0L)
                        {
                            GameManager.ClientMgr.ProcessRoleExperience(client, addExp, true, true, false, "none");
                        }
                        if (addJinBi > 0)
                        {
                            GameManager.ClientMgr.AddMoney1(client, addJinBi, useMsg, true);
                        }
                        if (addXingHun > 0)
                        {
                            GameManager.ClientMgr.ModifyStarSoulValue(client, addXingHun, useMsg, true, true);
                        }
                        lianZhiCount += count;
                        lianZhiDayID  = dayID;
                        if (type == 0)
                        {
                            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.JinBiZhuanHuanTimes));
                            Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiJinBiCount", lianZhiCount, true);
                            Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiJinBiDayID", lianZhiDayID, true);
                        }
                        else if (type == 1)
                        {
                            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.BangZuanZhuanHuanTimes));
                            Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiBangZuanCount", lianZhiCount, true);
                            Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiBangZuanDayID", lianZhiDayID, true);
                        }
                        else if (type == 2)
                        {
                            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.ZuanShiZhuanHuanTimes));
                            Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiZuanShiCount", lianZhiCount, true);
                            Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiZuanShiDayID", lianZhiDayID, true);
                        }
                        client.sendCmd <List <int> >(nID, result, false);
                    }
                }
            }
            return(true);
        }