示例#1
0
        /// <summary>
        /// 获取五行奇阵的奖励,一天只能获取一次
        /// </summary>
        /// <param name="client"></param>
        public static void ProcessWuXingAward(GameClient client)
        {
            //已经领取过了,就不能再领取
            if (!CanGetWuXingAward(client))
            {
                return;
            }

            if (null == TheWuXingMapAwardItem)
            {
                return;
            }

            if (null != TheWuXingMapAwardItem.GoodsDataList)
            {
                //判断背包是否空间足够
                if (!Global.CanAddGoodsDataList(client, TheWuXingMapAwardItem.GoodsDataList))
                {
                    GameManager.ClientMgr.NotifyImportantMsg(
                        Global._TCPManager.MySocketListener,
                        Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("背包中空格不足,请清理出足够的空格后,再获取五行奇阵的奖励")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, (int)HintErrCodeTypes.NoBagGrid);
                    return;
                }
            }

            int blessPoint = 0;

            //判断如果有坐骑的祝福点奖励,则要判断是否在骑乘状态
            if (TheWuXingMapAwardItem.MinBlessPoint >= 0 && TheWuXingMapAwardItem.MaxBlessPoint >= 0)
            {
                blessPoint = Global.GetRandomNumber(TheWuXingMapAwardItem.MinBlessPoint, TheWuXingMapAwardItem.MaxBlessPoint);
                if (blessPoint > 0)
                {
                    if (client.ClientData.HorseDbID <= 0)
                    {
                        GameManager.ClientMgr.NotifyImportantMsg(
                            Global._TCPManager.MySocketListener,
                            Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(Global.GetLang("获取五行奇阵的奖励的坐骑临时养成点,必须处于骑乘状态")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, (int)HintErrCodeTypes.None);

                        return;
                    }
                }
            }

            if (Global.FilterFallGoods(client)) //是否奖励物品
            {
                //奖励用户物品
                if (null != TheWuXingMapAwardItem.GoodsDataList)
                {
                    for (int i = 0; i < TheWuXingMapAwardItem.GoodsDataList.Count; i++)
                    {
                        //想DBServer请求加入某个新的物品到背包中
                        //添加物品
                        Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool,
                                                 client, TheWuXingMapAwardItem.GoodsDataList[i].GoodsID, TheWuXingMapAwardItem.GoodsDataList[i].GCount, TheWuXingMapAwardItem.GoodsDataList[i].Quality, "", TheWuXingMapAwardItem.GoodsDataList[i].Forge_level, TheWuXingMapAwardItem.GoodsDataList[i].Binding, 0, "", true, 1, "五行奇阵奖励物品", Global.ConstGoodsEndTime, TheWuXingMapAwardItem.GoodsDataList[i].AddPropIndex, TheWuXingMapAwardItem.GoodsDataList[i].BornIndex, TheWuXingMapAwardItem.GoodsDataList[i].Lucky, TheWuXingMapAwardItem.GoodsDataList[i].Strong);
                    }
                }
            }

            //添加角色的ID+日期的ID的奖励领取状态
            //更新角色的日常数据_五行奇阵领取奖励数量
            GameManager.ClientMgr.UpdateRoleDailyData_WuXingNum(client, 1);

            //奖励用户经验
            //异步写数据库,写入经验和级别
            double expXiShu   = TheWuXingMapAwardItem.ExpXiShu;
            int    experience = (int)Math.Pow(client.ClientData.Level, expXiShu);

            //处理VIP月卡
            if (DBRoleBufferManager.ProcessMonthVIP(client) > 0.0)
            {
                experience = (int)(experience * 1.50);
            }

            //处理角色经验
            GameManager.ClientMgr.ProcessRoleExperience(client, experience, true, false);

            //五行奇阵通关获取经验通知
            Global.BroadcastWuXingExperience(client, experience);

            //奖励用户金钱
            //异步写数据库,写入金钱
            int money = TheWuXingMapAwardItem.Money1;

            if (-1 != money)
            {
                //过滤金币奖励
                money = Global.FilterValue(client, money);

                //更新用户的铜钱
                GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, "五行奇阵", false);

                GameManager.SystemServerEvents.AddEvent(string.Format("角色获取金钱, roleID={0}({1}), Money={2}, newMoney={3}", client.ClientData.RoleID, client.ClientData.RoleName, client.ClientData.Money1, money), EventLevels.Record);
            }

            //获取当前正在骑乘的坐骑的进阶养成点
            int currentHorseBlessPoint = ProcessHorse.GetCurrentHorseBlessPoint(client);

            if (currentHorseBlessPoint > 0 && blessPoint > 0)
            {
                double blessPointPercent = blessPoint / 100.0;
                blessPoint = (int)(blessPointPercent * currentHorseBlessPoint);

                //过滤养成点奖励
                blessPoint = Global.FilterValue(client, blessPoint);

                //为指定的坐骑增加养成点(临时或者永久)
                ProcessHorse.ProcessAddHorseAwardLucky(client, blessPoint, true, "五行奇阵奖励");
            }

            Global.AddWuXingAwardEvent(client, experience, blessPoint);
        }
示例#2
0
 public static void ProcessWuXingAward(GameClient client)
 {
     if (WuXingMapMgr.CanGetWuXingAward(client))
     {
         if (null != WuXingMapMgr.TheWuXingMapAwardItem)
         {
             if (null != WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList)
             {
                 if (!Global.CanAddGoodsDataList(client, WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList))
                 {
                     GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(574, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 1);
                     return;
                 }
             }
             int blessPoint = 0;
             if (WuXingMapMgr.TheWuXingMapAwardItem.MinBlessPoint >= 0 && WuXingMapMgr.TheWuXingMapAwardItem.MaxBlessPoint >= 0)
             {
                 blessPoint = Global.GetRandomNumber(WuXingMapMgr.TheWuXingMapAwardItem.MinBlessPoint, WuXingMapMgr.TheWuXingMapAwardItem.MaxBlessPoint);
                 if (blessPoint > 0)
                 {
                     if (client.ClientData.HorseDbID <= 0)
                     {
                         GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(575, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                         return;
                     }
                 }
             }
             if (Global.FilterFallGoods(client))
             {
                 if (null != WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList)
                 {
                     for (int i = 0; i < WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList.Count; i++)
                     {
                         Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].GoodsID, WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].GCount, WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].Quality, "", WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].Forge_level, WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].Binding, 0, "", true, 1, "五行奇阵奖励物品", "1900-01-01 12:00:00", WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].AddPropIndex, WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].BornIndex, WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].Lucky, WuXingMapMgr.TheWuXingMapAwardItem.GoodsDataList[i].Strong, 0, 0, 0, null, null, 0, true);
                     }
                 }
             }
             GameManager.ClientMgr.UpdateRoleDailyData_WuXingNum(client, 1);
             double expXiShu   = WuXingMapMgr.TheWuXingMapAwardItem.ExpXiShu;
             int    experience = (int)Math.Pow((double)client.ClientData.Level, expXiShu);
             if (DBRoleBufferManager.ProcessMonthVIP(client) > 0.0)
             {
                 experience = (int)((double)experience * 1.5);
             }
             GameManager.ClientMgr.ProcessRoleExperience(client, (long)experience, true, false, false, "none");
             Global.BroadcastWuXingExperience(client, experience);
             int money = WuXingMapMgr.TheWuXingMapAwardItem.Money1;
             if (-1 != money)
             {
                 money = Global.FilterValue(client, money);
                 GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, "五行奇阵", false);
                 GameManager.SystemServerEvents.AddEvent(string.Format("角色获取金钱, roleID={0}({1}), Money={2}, newMoney={3}", new object[]
                 {
                     client.ClientData.RoleID,
                     client.ClientData.RoleName,
                     client.ClientData.Money1,
                     money
                 }), EventLevels.Record);
             }
             int currentHorseBlessPoint = ProcessHorse.GetCurrentHorseBlessPoint(client);
             if (currentHorseBlessPoint > 0 && blessPoint > 0)
             {
                 double blessPointPercent = (double)blessPoint / 100.0;
                 blessPoint = (int)(blessPointPercent * (double)currentHorseBlessPoint);
                 blessPoint = Global.FilterValue(client, blessPoint);
                 ProcessHorse.ProcessAddHorseAwardLucky(client, blessPoint, true, "五行奇阵奖励");
             }
             Global.AddWuXingAwardEvent(client, experience, blessPoint);
         }
     }
 }