Ejemplo n.º 1
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());
            }
        }
Ejemplo n.º 2
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]);
     }
 }
Ejemplo n.º 3
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);
        }