Example #1
0
        /// <summary>
        /// 给客户端发奖
        /// </summary>
        /// <param name="client"></param>
        /// <param name="award"></param>
        private static void _SendAward2Player(GameClient client, YueKaAward award)
        {
            // 如果1.4.1的功能没开放
            if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1))
            {
                return;
            }

            List <GoodsData> goodsDataList = award.GetGoodsByOcc(Global.CalcOriginalOccupationID(client));

            // 背包不足则邮件发送
            if (!Global.CanAddGoodsNum(client, goodsDataList.Count))
            {
                foreach (var item in goodsDataList)
                {
                    Global.UseMailGivePlayerAward(client, item, Global.GetLang("月卡返利"), string.Format(Global.GetLang("第{0}天月卡返利"), award.Day));
                }
            }
            else
            {
                foreach (var goodsData in goodsDataList)
                {
                    //向DBServer请求加入某个新的物品到背包中
                    goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, string.Format("第{0}天月卡返利", award.Day), false,
                                                                 goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true);
                }
            }

            //发钻石
            GameManager.ClientMgr.AddUserGold(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, award.BindZuanShi, string.Format("第{0}天月卡返利", award.Day));
        }
        /// <summary>
        /// 获取物品通关的物品奖励
        /// </summary>
        /// <param name="client"></param>
        public static void AddRewardToClient(GameClient client, List <GoodsData> goodNormal, int nExp, int nMoney, int nXinHun, string strTitle)
        {
            if (null != goodNormal)
            {
                // 如果背包格子不够 就发邮件-附件带物品给玩家
                if (!Global.CanAddGoodsNum(client, goodNormal.Count))
                {
                    Global.UseMailGivePlayerAward2(client, goodNormal, strTitle, strTitle);
                }
                else
                {
                    foreach (var item in goodNormal)
                    {
                        GoodsData goodsData = new GoodsData(item);

                        //向DBServer请求加入某个新的物品到背包中
                        //添加物品
                        goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality,
                                                                     goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, strTitle,
                                                                     true, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true);    // 卓越信息 [12/13/2013 LiaoWei]
                    }
                }
            }

            GameManager.ClientMgr.ModifyStarSoulValue(client, nXinHun, strTitle, true, true);
            GameManager.ClientMgr.ProcessRoleExperience(client, nExp, true, true);
            GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nMoney, "万魔塔", false);
        }
        public bool GiveAward(GameClient client, List <GoodsData> goodsData)
        {
            bool result;

            if (goodsData == null)
            {
                result = false;
            }
            else
            {
                foreach (GoodsData it in goodsData)
                {
                    if (Global.GetGoodsRebornEquip(it.GoodsID) == 1)
                    {
                        Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, it.GoodsID, it.GCount, it.Quality, it.Props, it.Forge_level, it.Binding, 15000, it.Jewellist, true, 1, "三周年回归活动累计充值奖励", false, "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, false, null, null, "1900-01-01 12:00:00", 0, true);
                    }
                    else
                    {
                        Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, it.GoodsID, it.GCount, it.Quality, it.Props, it.Forge_level, it.Binding, 0, it.Jewellist, true, 1, "三周年回归活动累计充值奖励", false, "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, false, null, null, "1900-01-01 12:00:00", 0, true);
                    }
                }
                result = true;
            }
            return(result);
        }
Example #4
0
 public static void InitForTestMode(GameClient client)
 {
     if (GameManager.TestGamePerformanceMode && (GameManager.TestGamePerformanceForAllUser || client.strUserID == null || client.strUserID.StartsWith("mu")))
     {
         if (GameManager.TestGamePerformanceAllPK)
         {
             client.ClientData.PKMode = 1;
         }
         if (client.ClientData.LoginNum <= 0)
         {
             int              occu           = Global.CalcOriginalOccupationID(client);
             int[]            nArray         = GameManager.TestRoleEquipsArrays[occu];
             List <GoodsData> usingGoodsList = Global.GetUsingGoodsList(client.ClientData);
             if (usingGoodsList == null || usingGoodsList.Count == 0)
             {
                 client.ClientData.Level           = 95;
                 client.ClientData.ChangeLifeCount = 7;
                 for (int i = 0; i < nArray.Length; i++)
                 {
                     GoodsData goodsData = new GoodsData
                     {
                         Id                    = -1,
                         GoodsID               = nArray[i],
                         Using                 = 0,
                         Forge_level           = 10,
                         Starttime             = "1900-01-01 12:00:00",
                         Endtime               = "1900-01-01 12:00:00",
                         Site                  = 0,
                         Quality               = 0,
                         Props                 = "",
                         GCount                = 1,
                         Binding               = 1,
                         Jewellist             = "",
                         BagIndex              = i,
                         AddPropIndex          = 0,
                         BornIndex             = 0,
                         Lucky                 = 1,
                         Strong                = 0,
                         ExcellenceInfo        = 63,
                         AppendPropLev         = 40,
                         ChangeLifeLevForEquip = 0
                     };
                     int      nDBid  = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, GLang.GetLang(515, new object[0]), false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true);
                     string   format = "{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}";
                     object[] array  = new object[9];
                     array[0] = client.ClientData.RoleID;
                     array[1] = 1;
                     array[2] = nDBid;
                     array[3] = goodsData.GoodsID;
                     array[4] = 1;
                     array[5] = 0;
                     array[6] = 1;
                     array[7] = goodsData.BagIndex;
                     string strCmd = string.Format(format, array);
                     Global.ModifyGoodsByCmdParams(client, strCmd, "客户端修改", null);
                 }
             }
         }
     }
 }
Example #5
0
        public static int AddGoodsDBCommand(GameClient client, GoodsData goodsData, bool useOldGrid, int newHint, string goodsFromWhere, bool onLine = true)
        {
            int dbRet    = 0;
            int goodsNum = goodsData.GCount;
            int goodsID  = goodsData.GoodsID;
            int gridNum  = Global.GetGoodsGridNumByID(goodsID);

            gridNum = Global.GMax(gridNum, 1);
            int result;

            if (goodsNum <= 0)
            {
                result = 0;
            }
            else
            {
                int addCount = (goodsNum - 1) / gridNum + 1;
                for (int i = 0; i < addCount; i++)
                {
                    int thisTimeNum = gridNum;
                    if (i >= addCount - 1 && goodsNum % gridNum > 0)
                    {
                        thisTimeNum = goodsNum % gridNum;
                    }
                    dbRet = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsID, thisTimeNum, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, goodsData.Site, goodsData.Jewellist, useOldGrid, newHint, goodsFromWhere, false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, false, goodsData.WashProps, goodsData.ElementhrtsProps, "1900-01-01 12:00:00", goodsData.JuHunID, onLine);
                    if (dbRet < 0)
                    {
                        return(dbRet);
                    }
                }
                result = dbRet;
            }
            return(result);
        }
Example #6
0
        /// <summary>
        /// 初始化压测帐号PK模式和装备等
        /// </summary>
        /// <param name="client"></param>
        public static void InitForTestMode(GameClient client)
        {
            if (GameManager.TestGamePerformanceMode && (GameManager.TestGamePerformanceForAllUser || client.strUserID == null || client.strUserID.StartsWith("mu")))
            {
                if (GameManager.TestGamePerformanceAllPK)
                {
                    client.ClientData.PKMode = (int)GPKModes.Whole;
                }

                if (client.ClientData.LoginNum <= 0)
                {
                    string           strCmd         = "";
                    int              occu           = Global.CalcOriginalOccupationID(client);
                    int[]            nArray1        = GameManager.TestRoleEquipsArrays[occu];
                    List <GoodsData> usingGoodsList = Global.GetUsingGoodsList(client.ClientData);
                    if (null == usingGoodsList || usingGoodsList.Count == 0)
                    {
                        client.ClientData.Level           = 95;
                        client.ClientData.ChangeLifeCount = 7;

                        for (int i = 0; i < nArray1.Length; ++i)
                        {
                            GoodsData goodsData = new GoodsData()
                            {
                                Id                    = -1,
                                GoodsID               = nArray1[i],
                                Using                 = 0,
                                Forge_level           = 10,
                                Starttime             = "1900-01-01 12:00:00",
                                Endtime               = Global.ConstGoodsEndTime,
                                Site                  = 0,
                                Quality               = 0,
                                Props                 = "",
                                GCount                = 1,
                                Binding               = 1,
                                Jewellist             = "",
                                BagIndex              = i,
                                AddPropIndex          = 0,
                                BornIndex             = 0,
                                Lucky                 = 1,
                                Strong                = 0,
                                ExcellenceInfo        = 63,
                                AppendPropLev         = 40,
                                ChangeLifeLevForEquip = 0,
                            };

                            int nDBid = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding,
                                                                      0, goodsData.Jewellist, true, 1, Global.GetLang("压测帐号装备"), false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky,
                                                                      goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true);

                            strCmd = string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}", client.ClientData.RoleID, 1, nDBid, goodsData.GoodsID, 1, 0, 1, goodsData.BagIndex, null);

                            Global.ModifyGoodsByCmdParams(client, strCmd);
                        }
                    }
                }
            }
        }
 public static void AddRewardToClient(GameClient client, List <GoodsData> goodNormal, int nExp, int nMoney, int nXinHun, string strTitle)
 {
     if (null != goodNormal)
     {
         if (!Global.CanAddGoodsNum(client, goodNormal.Count))
         {
             Global.UseMailGivePlayerAward2(client, goodNormal, Global.GetLang(strTitle), Global.GetLang(strTitle), 0, 0, 0);
         }
         else
         {
             foreach (GoodsData item in goodNormal)
             {
                 GoodsData goodsData = new GoodsData(item);
                 goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, strTitle, true, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true);
             }
         }
     }
     GameManager.ClientMgr.ModifyStarSoulValue(client, nXinHun, strTitle, true, true);
     GameManager.ClientMgr.ProcessRoleExperience(client, (long)nExp, true, true, false, "none");
     GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nMoney, "万魔塔", false);
 }
Example #8
0
 private static void _SendAward2Player(GameClient client, YueKaAward award)
 {
     if (!GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1))
     {
         List <GoodsData> goodsDataList = award.GetGoodsByOcc(Global.CalcOriginalOccupationID(client));
         if (!Global.CanAddGoodsNum(client, goodsDataList.Count))
         {
             foreach (GoodsData item in goodsDataList)
             {
                 Global.UseMailGivePlayerAward(client, item, GLang.GetLang(576, new object[0]), string.Format(GLang.GetLang(577, new object[0]), award.Day), 1.0);
             }
         }
         else
         {
             foreach (GoodsData goodsData in goodsDataList)
             {
                 goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, string.Format("第{0}天月卡返利", award.Day), false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true);
             }
         }
         GameManager.ClientMgr.AddUserGold(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, award.BindZuanShi, string.Format("第{0}天月卡返利", award.Day));
     }
 }
Example #9
0
        public ESevenDayActErrorCode HandleClientBuy(GameClient client, int id, int cnt)
        {
            int currDay;
            ESevenDayActErrorCode result;

            if (!SingletonTemplate <SevenDayActivityMgr> .Instance().IsInActivityTime(client, out currDay))
            {
                result = ESevenDayActErrorCode.NotInActivityTime;
            }
            else
            {
                SevenDayBuyAct._BuyGoodsData goodsConfig = null;
                lock (this.ConfigMutex)
                {
                    if (this._BuyGoodsDict == null || !this._BuyGoodsDict.TryGetValue(id, out goodsConfig))
                    {
                        return(ESevenDayActErrorCode.ServerConfigError);
                    }
                }
                if (goodsConfig == null || goodsConfig.Goods == null)
                {
                    result = ESevenDayActErrorCode.ServerConfigError;
                }
                else if (goodsConfig.Day > currDay)
                {
                    result = ESevenDayActErrorCode.NotReachCondition;
                }
                else
                {
                    Dictionary <int, SevenDayItemData> itemDict = SingletonTemplate <SevenDayActivityMgr> .Instance().GetActivityData(client, ESevenDayActType.Buy);

                    lock (itemDict)
                    {
                        SevenDayItemData itemData = null;
                        if (!itemDict.TryGetValue(id, out itemData))
                        {
                            itemData     = new SevenDayItemData();
                            itemDict[id] = itemData;
                        }
                        if (cnt <= 0 || itemData.Params1 + cnt > goodsConfig.MaxBuyCount)
                        {
                            result = ESevenDayActErrorCode.NoEnoughGoodsCanBuy;
                        }
                        else if (client.ClientData.UserMoney < cnt * goodsConfig.CurrPrice)
                        {
                            result = ESevenDayActErrorCode.ZuanShiNotEnough;
                        }
                        else if (!Global.CanAddGoods(client, goodsConfig.Goods.GoodsID, goodsConfig.Goods.GCount * cnt, goodsConfig.Goods.Binding, "1900-01-01 12:00:00", true, false))
                        {
                            result = ESevenDayActErrorCode.NoBagSpace;
                        }
                        else
                        {
                            itemData.Params1 += cnt;
                            if (!SingletonTemplate <SevenDayActivityMgr> .Instance().UpdateDb(client.ClientData.RoleID, ESevenDayActType.Buy, id, itemData, client.ServerId))
                            {
                                itemData.Params1 -= cnt;
                                result            = ESevenDayActErrorCode.DBFailed;
                            }
                            else
                            {
                                if (!GameManager.ClientMgr.SubUserMoney(client, cnt * goodsConfig.CurrPrice, "七日抢购", true, true, true, true, DaiBiSySType.None))
                                {
                                    LogManager.WriteLog(LogTypes.Error, string.Format("玩家七日抢购物品,检查钻石足够,但是扣除失败,roleid={0}, id={1}", client.ClientData.RoleID, id), null, true);
                                }
                                GoodsData goodsData = goodsConfig.Goods;
                                Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount * cnt, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, string.Format("七日抢购", new object[0]), false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true);
                                result = ESevenDayActErrorCode.Success;
                            }
                        }
                    }
                }
            }
            return(result);
        }
Example #10
0
        private static YueKaError _GetYueKaAward(GameClient client, int day)
        {
            // 如果1.4.1的功能没开放
            if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1))
            {
                return(YueKaError.YK_CannotAward_HasNotYueKa);
            }

            //传来的天数错误
            if (day <= 0 || day > DAYS_PER_YUE_KA)
            {
                return(YueKaError.YK_CannotAward_ParamInvalid);
            }

            lock (client.ClientData.YKDetail)
            {
                //非月卡用户不可领取
                if (client.ClientData.YKDetail.HasYueKa == 0)
                {
                    return(YueKaError.YK_CannotAward_HasNotYueKa);
                }

                //过去的天数不可领取
                if (day < client.ClientData.YKDetail.CurDayOfPerYueKa())
                {
                    return(YueKaError.YK_CannotAward_DayHasPassed);
                }

                //未来的天数不可领取
                if (day > client.ClientData.YKDetail.CurDayOfPerYueKa())
                {
                    return(YueKaError.YK_CannotAward_TimeNotReach);
                }

                string awardInfo = client.ClientData.YKDetail.AwardInfo;
                //今日已领取
                if (awardInfo.Length < day || awardInfo[day - 1] == '1')
                {
                    return(YueKaError.YK_CannotAward_AlreadyAward);
                }

                YueKaAward awardData = null;
                AllGoodsDict.TryGetValue(day, out awardData);
                if (awardData == null)
                {
                    return(YueKaError.YK_CannotAward_ConfigError);
                }

                List <GoodsData> goodsDataList = awardData.GetGoodsByOcc(Global.CalcOriginalOccupationID(client));
                if (goodsDataList != null && goodsDataList.Count > 0)
                {
                    if (!Global.CanAddGoodsNum(client, goodsDataList.Count))
                    {
                        return(YueKaError.YK_CannotAward_BagNotEnough);
                    }

                    foreach (var goodsData in goodsDataList)
                    {
                        //向DBServer请求加入某个新的物品到背包中
                        goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, string.Format("第{0}天月卡返利", awardData.Day), false,
                                                                     goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true);
                    }
                }

                //发钻石
                GameManager.ClientMgr.AddUserGold(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, awardData.BindZuanShi, string.Format("第{0}天月卡返利", awardData.Day));

                // _SendAward2Player(client, awardData);

                client.ClientData.YKDetail.AwardInfo = awardInfo.Substring(0, day - 1) + "1";
                _UpdateYKDetail2DB(client, client.ClientData.YKDetail);
                if (client._IconStateMgr.CheckFuLiYueKaFanLi(client))
                {
                    client._IconStateMgr.SendIconStateToClient(client);
                }
            }

            return(YueKaError.YK_Success);
        }
Example #11
0
        /// <summary>
        /// 给予完成每日活跃的奖励 进行完成与否 与是否已经领取的判断
        /// </summary>
        /// <param name="client"></param>
        public static int GiveDailyActiveAward(GameClient client, int nid)
        {
            // 未完成成就不能领取
            //if (!IsDailyActiveCompleted(client, DailyActiveID))
            //    return -1;
            int awardDailyActiveValue = 0;

            SystemXmlItem itemDailyActive = null;

            if (GameManager.systemDailyActiveAward.SystemXmlItemDict.TryGetValue(nid, out itemDailyActive))
            {
                awardDailyActiveValue = Math.Max(0, itemDailyActive.GetIntValue("NeedhuoYue"));
            }

            if (awardDailyActiveValue > client.ClientData.DailyActiveValues)
            {
                return(-3);
            }

            // 奖励领取过了不能再领
            if (IsDailyActiveAwardFetched(client, nid) > 0)
            {
                return(-2);
            }

            // 经与策划确定,此处不需要减的。
            // client.ClientData.DailyActiveValues -= awardDailyActiveValue;

            ModifyDailyActiveInfor(client, (uint)client.ClientData.DailyActiveValues, DailyActiveDataField1.DailyActiveValue, true);

            List <GoodsData> goodsDataList = new List <GoodsData>();

            string strGoods = itemDailyActive.GetStringValue("GoodsID");

            if (!string.IsNullOrEmpty(strGoods))
            {
                string[] fields = strGoods.Split('|');
                if (null != fields)
                {
                    for (int i = 0; i < fields.Length; i++)
                    {
                        string strID = fields[i];

                        string[] strinfro = null;
                        strinfro = fields[i].Split(',');

                        if (strinfro != null && strinfro.Length == 7)
                        {
                            GoodsData good = new GoodsData()
                            {
                                Id                    = -1,
                                GoodsID               = Convert.ToInt32(strinfro[0]),
                                Using                 = 0,
                                Forge_level           = Convert.ToInt32(strinfro[3]),
                                Starttime             = "1900-01-01 12:00:00",
                                Endtime               = Global.ConstGoodsEndTime,
                                Site                  = 0,
                                Quality               = 0,
                                Props                 = "",
                                GCount                = Convert.ToInt32(strinfro[1]),
                                Binding               = Convert.ToInt32(strinfro[2]),
                                Jewellist             = "",
                                BagIndex              = 0,
                                AddPropIndex          = 0,
                                BornIndex             = 0,
                                Lucky                 = Convert.ToInt32(strinfro[5]),
                                Strong                = 0,
                                ExcellenceInfo        = Convert.ToInt32(strinfro[6]),
                                AppendPropLev         = Convert.ToInt32(strinfro[4]),
                                ChangeLifeLevForEquip = 0,
                            };
                            goodsDataList.Add(good);
                        }
                    }

                    // 如果背包格子不够 就发邮件-附件带物品给玩家
                    if (!Global.CanAddGoodsNum(client, goodsDataList.Count))
                    {
                        foreach (var item in goodsDataList)
                        {
                            Global.UseMailGivePlayerAward(client, item, "每日活跃领取奖励", "每日活跃领取奖励");
                        }
                    }
                    else
                    {
                        foreach (var item in goodsDataList)
                        {
                            GoodsData goodsData = new GoodsData()
                            {
                                Id                    = -1,
                                GoodsID               = item.GoodsID,
                                Using                 = 0,
                                Forge_level           = item.Forge_level,
                                Starttime             = "1900-01-01 12:00:00",
                                Endtime               = Global.ConstGoodsEndTime,
                                Site                  = 0,
                                Quality               = item.Quality,
                                Props                 = item.Props,
                                GCount                = item.GCount,
                                Binding               = item.Binding,
                                Jewellist             = item.Jewellist,
                                BagIndex              = 0,
                                AddPropIndex          = item.AddPropIndex,
                                BornIndex             = item.BornIndex,
                                Lucky                 = item.Lucky,
                                Strong                = item.Strong,
                                ExcellenceInfo        = item.ExcellenceInfo,
                                AppendPropLev         = item.AppendPropLev,
                                ChangeLifeLevForEquip = item.ChangeLifeLevForEquip,
                            };

                            //向DBServer请求加入某个新的物品到背包中
                            //添加物品
                            goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality,
                                                                         goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, "副本通关获取物品", false,
                                                                         goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true);    // 卓越信息 [12/13/2013 LiaoWei]
                        }
                    }
                }
            }

            // 设置领取标志位
            //UpdateDailyActiveFlag(client, DailyActiveID, true);
            UpdateDailyActiveAwardFlag(client, nid);

            return(1);
        }
        public RegressActiveOpcode ProcessRegressAcitveStore(GameClient client, int StoreConfID, int Level, int GoodsID, int Count)
        {
            RegressActiveOpen   iflAct = HuodongCachingMgr.GetRegressActiveOpen();
            RegressActiveOpcode result;
            string Regtime;

            if (iflAct == null || !iflAct.InActivityTime())
            {
                result = RegressActiveOpcode.RegressActiveOpenErr;
            }
            else if (!iflAct.CanGiveAward())
            {
                result = RegressActiveOpcode.RegressActiveNotIn;
            }
            else if (!UserRegressActiveManager.GetRegressMinRegtime(client, out Regtime) || Regtime == null || Regtime.Equals(""))
            {
                result = RegressActiveOpcode.RegressActiveGetRegTime;
            }
            else
            {
                int ConfID;
                int CaleLevel = iflAct.GetUserActiveFile(Regtime, out ConfID);
                if (0 == CaleLevel)
                {
                    result = RegressActiveOpcode.RegressActiveGetFile;
                }
                else if (CaleLevel != Level)
                {
                    result = RegressActiveOpcode.RegressActiveStoreCheckFail;
                }
                else
                {
                    DateTime nowDateTime = TimeUtil.NowDateTime();
                    string   CurrDate    = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, nowDateTime.Hour, nowDateTime.Minute, nowDateTime.Second).ToString("yyyy-MM-dd HH:mm:ss");
                    int      CDate       = Global.GetOffsetDay(DateTime.Parse(CurrDate)) - Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate));
                    if (CDate < 0)
                    {
                        result = RegressActiveOpcode.RegressActiveStoreCheckDayFail;
                    }
                    else
                    {
                        RegressActiveStore StoreAct = HuodongCachingMgr.GetRegressActiveStore();
                        if (null == StoreAct)
                        {
                            result = RegressActiveOpcode.RegressActiveStoreConfErr;
                        }
                        else
                        {
                            string    stage = string.Format("{0}_{1}", Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)), Global.GetOffsetDay(DateTime.Parse(iflAct.ToDate)));
                            int       needYuanBao;
                            int       Sum;
                            GoodsData goodData;
                            if (!StoreAct.RegressStoreGoodsBuyCheck(client, StoreConfID, Level, CDate + 1, GoodsID, Count, stage, out needYuanBao, out Sum, out goodData))
                            {
                                result = RegressActiveOpcode.RegressActiveStoreBuyFail;
                            }
                            else if (goodData == null)
                            {
                                result = RegressActiveOpcode.RegressActiveStoreCheckGoodFail;
                            }
                            else if (Sum <= 0 || needYuanBao <= 0)
                            {
                                result = RegressActiveOpcode.RegressActiveStoreCheckParmErr;
                            }
                            else
                            {
                                int BagInt;
                                if (!RebornEquip.OneIsCanIntoRebornOrBaseBag(client, goodData, out BagInt))
                                {
                                    if (BagInt == 1)
                                    {
                                        return(RegressActiveOpcode.RegressActiveSignRebornBagFail);
                                    }
                                    if (BagInt == 2)
                                    {
                                        return(RegressActiveOpcode.RegressActiveSignBaseBagFail);
                                    }
                                }
                                if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, needYuanBao, "三周年商城购买物品", true, true, false, DaiBiSySType.None))
                                {
                                    result = RegressActiveOpcode.RegressActiveStoreUserYuanBaoFail;
                                }
                                else
                                {
                                    string GetInfoStr = string.Format("{0}:{1}:{2}:{3}:{4}", new object[]
                                    {
                                        client.ClientData.RoleID,
                                        StoreConfID,
                                        CDate,
                                        Sum,
                                        stage
                                    });
                                    string[] dbResult;
                                    if (TCPProcessCmdResults.RESULT_FAILED == Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 14135, GetInfoStr, out dbResult, 0))
                                    {
                                        result = RegressActiveOpcode.RegressActiveStoreInsertInfoErr;
                                    }
                                    else if (dbResult == null || dbResult.Length != 2 || Convert.ToInt32(dbResult[1]) != 0)
                                    {
                                        result = RegressActiveOpcode.RegressActiveStoreInsertInfoErr;
                                    }
                                    else
                                    {
                                        if (Global.GetGoodsRebornEquip(goodData.GoodsID) == 1)
                                        {
                                            Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodData.GoodsID, Count, goodData.Quality, goodData.Props, goodData.Forge_level, goodData.Binding, 15000, goodData.Jewellist, true, 1, "三周年商城购买", false, "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, false, null, null, "1900-01-01 12:00:00", 0, true);
                                        }
                                        else
                                        {
                                            Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodData.GoodsID, Count, goodData.Quality, goodData.Props, goodData.Forge_level, goodData.Binding, 0, goodData.Jewellist, true, 1, "三周年商城购买", false, "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, false, null, null, "1900-01-01 12:00:00", 0, true);
                                        }
                                        result = RegressActiveOpcode.RegressActiveSucc;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Example #13
0
        /// <summary>
        /// 检测发奖
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        private int CheckGiveAward(GameClient client)
        {
            if (client == null)
            {
                return(0);
            }
            DateTime now = TimeUtil.NowDateTime();
            int      awardWeek;

            if (!_Config.IsInAwardTime(now, out awardWeek))
            {
                return(0);
            }

            lock (Mutex)
            {
                string   szAwardFlag = Global.GetRoleParamByName(client, RoleParamName.CoupleWishWeekAward);
                string[] fields      = string.IsNullOrEmpty(szAwardFlag) ? null : szAwardFlag.Split(',');
                if (fields != null && fields.Length == 2 && Convert.ToInt32(fields[0]) == awardWeek)
                {
                    return(0);
                }

                if (awardWeek != SyncData.LastWeek.Week)
                {
                    return(0);
                }

                int idx;
                if (!SyncData.LastWeek.RoleIndex.TryGetValue(client.ClientData.RoleID, out idx))
                {
                    return(0);
                }

                CoupleWishCoupleDataK coupleData = SyncData.LastWeek.RankList[idx];
                if (coupleData == null)
                {
                    return(0);
                }
                if (coupleData.Man.RoleId != client.ClientData.RoleID && coupleData.Wife.RoleId != client.ClientData.RoleID)
                {
                    return(0);
                }

                var wishAward = _Config.RankAwardCfgList.Find(_r => coupleData.Rank >= _r.StartRank && (_r.EndRank <= 0 || coupleData.Rank <= _r.EndRank));
                if (wishAward == null)
                {
                    return(0);
                }

                List <GoodsData> goodsList = new List <GoodsData>();
                goodsList.AddRange(wishAward.GoodsOneTag as List <GoodsData>);
                goodsList.AddRange((wishAward.GoodsTwoTag as List <GoodsData>).FindAll(_g => Global.IsCanGiveRewardByOccupation(client, _g.GoodsID)));
                if (Global.CanAddGoodsDataList(client, goodsList))
                {
                    foreach (var goodsData in goodsList)
                    {
                        Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, "情侣排行榜", false,
                                                      goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true);
                    }
                }
                else
                {
                    Global.UseMailGivePlayerAward3(client.ClientData.RoleID, goodsList, "情侣祝福榜", string.Format("情侣祝福榜第{0}名奖励,请查收!", coupleData.Rank), 0);
                }

                Global.SaveRoleParamsStringToDB(client, RoleParamName.CoupleWishWeekAward, string.Format("{0},{1}", awardWeek, wishAward.Id), true);
                CheckTipsIconState(client);
                return(wishAward.Id);
            }

            return(0);
        }
Example #14
0
        private int CheckGiveAward(GameClient client)
        {
            int result;

            if (client == null)
            {
                result = 0;
            }
            else
            {
                DateTime now = TimeUtil.NowDateTime();
                int      awardWeek;
                if (!this._Config.IsInAwardTime(now, out awardWeek))
                {
                    result = 0;
                }
                else
                {
                    lock (this.Mutex)
                    {
                        string   szAwardFlag = Global.GetRoleParamByName(client, "29");
                        string[] fields      = string.IsNullOrEmpty(szAwardFlag) ? null : szAwardFlag.Split(new char[]
                        {
                            ','
                        });
                        int idx;
                        if (fields != null && fields.Length == 2 && Convert.ToInt32(fields[0]) == awardWeek)
                        {
                            result = 0;
                        }
                        else if (awardWeek != this.SyncData.LastWeek.Week)
                        {
                            result = 0;
                        }
                        else if (!this.SyncData.LastWeek.RoleIndex.TryGetValue(client.ClientData.RoleID, out idx))
                        {
                            result = 0;
                        }
                        else
                        {
                            CoupleWishCoupleDataK coupleData = this.SyncData.LastWeek.RankList[idx];
                            if (coupleData == null)
                            {
                                result = 0;
                            }
                            else if (coupleData.Man.RoleId != client.ClientData.RoleID && coupleData.Wife.RoleId != client.ClientData.RoleID)
                            {
                                result = 0;
                            }
                            else
                            {
                                CoupleWishRankAwardConfig wishAward = this._Config.RankAwardCfgList.Find((CoupleWishRankAwardConfig _r) => coupleData.Rank >= _r.StartRank && (_r.EndRank <= 0 || coupleData.Rank <= _r.EndRank));
                                if (wishAward == null)
                                {
                                    result = 0;
                                }
                                else
                                {
                                    List <GoodsData> goodsList = new List <GoodsData>();
                                    goodsList.AddRange(wishAward.GoodsOneTag as List <GoodsData>);
                                    goodsList.AddRange((wishAward.GoodsTwoTag as List <GoodsData>).FindAll((GoodsData _g) => Global.IsCanGiveRewardByOccupation(client, _g.GoodsID)));
                                    if (Global.CanAddGoodsDataList(client, goodsList))
                                    {
                                        foreach (GoodsData goodsData in goodsList)
                                        {
                                            Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, "情侣排行榜", false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true);
                                        }
                                    }
                                    else
                                    {
                                        Global.UseMailGivePlayerAward3(client.ClientData.RoleID, goodsList, GLang.GetLang(479, new object[0]), string.Format(GLang.GetLang(480, new object[0]), coupleData.Rank), 0, 0, 0);
                                    }
                                    Global.SaveRoleParamsStringToDB(client, "29", string.Format("{0},{1}", awardWeek, wishAward.Id), true);
                                    this.CheckTipsIconState(client);
                                    result = wishAward.Id;
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Example #15
0
        private static YueKaError _GetYueKaAward(GameClient client, int day)
        {
            YueKaError result;

            if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1))
            {
                result = YueKaError.YK_CannotAward_HasNotYueKa;
            }
            else if (day <= 0 || day > YueKaManager.DAYS_PER_YUE_KA)
            {
                result = YueKaError.YK_CannotAward_ParamInvalid;
            }
            else
            {
                lock (client.ClientData.YKDetail)
                {
                    if (client.ClientData.YKDetail.HasYueKa == 0)
                    {
                        return(YueKaError.YK_CannotAward_HasNotYueKa);
                    }
                    if (day < client.ClientData.YKDetail.CurDayOfPerYueKa())
                    {
                        return(YueKaError.YK_CannotAward_DayHasPassed);
                    }
                    if (day > client.ClientData.YKDetail.CurDayOfPerYueKa())
                    {
                        return(YueKaError.YK_CannotAward_TimeNotReach);
                    }
                    string awardInfo = client.ClientData.YKDetail.AwardInfo;
                    if (awardInfo.Length < day || awardInfo[day - 1] == '1')
                    {
                        return(YueKaError.YK_CannotAward_AlreadyAward);
                    }
                    YueKaAward awardData = null;
                    YueKaManager.AllGoodsDict.TryGetValue(day, out awardData);
                    if (awardData == null)
                    {
                        return(YueKaError.YK_CannotAward_ConfigError);
                    }
                    List <GoodsData> goodsDataList = awardData.GetGoodsByOcc(Global.CalcOriginalOccupationID(client));
                    if (goodsDataList != null && goodsDataList.Count > 0)
                    {
                        if (!Global.CanAddGoodsNum(client, goodsDataList.Count))
                        {
                            return(YueKaError.YK_CannotAward_BagNotEnough);
                        }
                        foreach (GoodsData goodsData in goodsDataList)
                        {
                            goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, string.Format("第{0}天月卡返利", awardData.Day), false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true);
                        }
                        client.ClientData.AddAwardRecord(RoleAwardMsg.YueKaoAward, goodsDataList, false);
                    }
                    GameManager.ClientMgr.AddUserGold(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, awardData.BindZuanShi, string.Format("第{0}天月卡返利", awardData.Day));
                    client.ClientData.AddAwardRecord(RoleAwardMsg.YueKaoAward, MoneyTypes.BindYuanBao, awardData.BindZuanShi);
                    GameManager.ClientMgr.NotifyGetAwardMsg(client, RoleAwardMsg.YueKaoAward, "");
                    client.ClientData.YKDetail.AwardInfo = awardInfo.Substring(0, day - 1) + "1";
                    YueKaManager._UpdateYKDetail2DB(client, client.ClientData.YKDetail);
                    if (client._IconStateMgr.CheckFuLiYueKaFanLi(client))
                    {
                        client._IconStateMgr.SendIconStateToClient(client);
                    }
                }
                result = YueKaError.YK_Success;
            }
            return(result);
        }
        public static int GiveDailyActiveAward(GameClient client, int nid)
        {
            int           awardDailyActiveValue = 0;
            SystemXmlItem itemDailyActive       = null;

            if (GameManager.systemDailyActiveAward.SystemXmlItemDict.TryGetValue(nid, out itemDailyActive))
            {
                awardDailyActiveValue = Math.Max(0, itemDailyActive.GetIntValue("NeedhuoYue", -1));
            }
            int result;

            if (awardDailyActiveValue > client.ClientData.DailyActiveValues)
            {
                result = -3;
            }
            else if (DailyActiveManager.IsDailyActiveAwardFetched(client, nid) > 0)
            {
                result = -2;
            }
            else
            {
                DailyActiveManager.ModifyDailyActiveInfor(client, (uint)client.ClientData.DailyActiveValues, DailyActiveDataField1.DailyActiveValue, true);
                List <GoodsData> goodsDataList = new List <GoodsData>();
                string           strGoods      = itemDailyActive.GetStringValue("GoodsID");
                if (!string.IsNullOrEmpty(strGoods))
                {
                    string[] fields = strGoods.Split(new char[]
                    {
                        '|'
                    });
                    if (null != fields)
                    {
                        for (int i = 0; i < fields.Length; i++)
                        {
                            string   strID    = fields[i];
                            string[] strinfro = fields[i].Split(new char[]
                            {
                                ','
                            });
                            if (strinfro != null && strinfro.Length == 7)
                            {
                                GoodsData good = new GoodsData
                                {
                                    Id                    = -1,
                                    GoodsID               = Convert.ToInt32(strinfro[0]),
                                    Using                 = 0,
                                    Forge_level           = Convert.ToInt32(strinfro[3]),
                                    Starttime             = "1900-01-01 12:00:00",
                                    Endtime               = "1900-01-01 12:00:00",
                                    Site                  = 0,
                                    Quality               = 0,
                                    Props                 = "",
                                    GCount                = Convert.ToInt32(strinfro[1]),
                                    Binding               = Convert.ToInt32(strinfro[2]),
                                    Jewellist             = "",
                                    BagIndex              = 0,
                                    AddPropIndex          = 0,
                                    BornIndex             = 0,
                                    Lucky                 = Convert.ToInt32(strinfro[5]),
                                    Strong                = 0,
                                    ExcellenceInfo        = Convert.ToInt32(strinfro[6]),
                                    AppendPropLev         = Convert.ToInt32(strinfro[4]),
                                    ChangeLifeLevForEquip = 0
                                };
                                goodsDataList.Add(good);
                            }
                        }
                        if (!Global.CanAddGoodsNum(client, goodsDataList.Count))
                        {
                            foreach (GoodsData item in goodsDataList)
                            {
                                Global.UseMailGivePlayerAward(client, item, GLang.GetLang(100, new object[0]), GLang.GetLang(100, new object[0]), 1.0);
                            }
                        }
                        else
                        {
                            foreach (GoodsData item in goodsDataList)
                            {
                                GoodsData goodsData = new GoodsData
                                {
                                    Id                    = -1,
                                    GoodsID               = item.GoodsID,
                                    Using                 = 0,
                                    Forge_level           = item.Forge_level,
                                    Starttime             = "1900-01-01 12:00:00",
                                    Endtime               = "1900-01-01 12:00:00",
                                    Site                  = 0,
                                    Quality               = item.Quality,
                                    Props                 = item.Props,
                                    GCount                = item.GCount,
                                    Binding               = item.Binding,
                                    Jewellist             = item.Jewellist,
                                    BagIndex              = 0,
                                    AddPropIndex          = item.AddPropIndex,
                                    BornIndex             = item.BornIndex,
                                    Lucky                 = item.Lucky,
                                    Strong                = item.Strong,
                                    ExcellenceInfo        = item.ExcellenceInfo,
                                    AppendPropLev         = item.AppendPropLev,
                                    ChangeLifeLevForEquip = item.ChangeLifeLevForEquip
                                };
                                goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, "副本通关获取物品", false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true);
                            }
                            client.ClientData.AddAwardRecord(RoleAwardMsg.DailyActive, goodsDataList, false);
                            GameManager.ClientMgr.NotifyGetAwardMsg(client, RoleAwardMsg.DailyActive, "");
                        }
                    }
                }
                DailyActiveManager.UpdateDailyActiveAwardFlag(client, nid);
                result = 1;
            }
            return(result);
        }
Example #17
0
        /// <summary>
        /// 玩家购买物品
        /// </summary>
        public ESevenDayActErrorCode HandleClientBuy(GameClient client, int id, int cnt)
        {
            int currDay;

            if (!SevenDayActivityMgr.Instance().IsInActivityTime(client, out currDay))
            {
                return(ESevenDayActErrorCode.NotInActivityTime);
            }

            _BuyGoodsData goodsConfig = null;

            lock (ConfigMutex)
            {
                if (_BuyGoodsDict == null || !_BuyGoodsDict.TryGetValue(id, out goodsConfig))
                {
                    return(ESevenDayActErrorCode.ServerConfigError);
                }
            }
            if (goodsConfig == null || goodsConfig.Goods == null)
            {
                return(ESevenDayActErrorCode.ServerConfigError);
            }

            if (goodsConfig.Day > currDay)
            {
                return(ESevenDayActErrorCode.NotReachCondition);
            }

            Dictionary <int, SevenDayItemData> itemDict = SevenDayActivityMgr.Instance().GetActivityData(client, ESevenDayActType.Buy);

            lock (itemDict)
            {
                SevenDayItemData itemData = null;
                if (!itemDict.TryGetValue(id, out itemData))
                {
                    itemData     = new SevenDayItemData();
                    itemDict[id] = itemData;
                }

                if (cnt <= 0 || itemData.Params1 + cnt > goodsConfig.MaxBuyCount)
                {
                    return(ESevenDayActErrorCode.NoEnoughGoodsCanBuy);
                }

                if (client.ClientData.UserMoney < cnt * goodsConfig.CurrPrice)
                {
                    return(ESevenDayActErrorCode.ZuanShiNotEnough);
                }


                if (!Global.CanAddGoods(client, goodsConfig.Goods.GoodsID, goodsConfig.Goods.GCount * cnt, goodsConfig.Goods.Binding))
                {
                    return(ESevenDayActErrorCode.NoBagSpace);
                }

                // 检查背包
                itemData.Params1 += cnt;
                if (!SevenDayActivityMgr.Instance().UpdateDb(client.ClientData.RoleID, ESevenDayActType.Buy, id, itemData, client.ServerId))
                {
                    itemData.Params1 -= cnt;
                    return(ESevenDayActErrorCode.DBFailed);
                }

                if (!GameManager.ClientMgr.SubUserMoney(client, cnt * goodsConfig.CurrPrice, "七日抢购"))
                {
                    // 之前已经检查过了
                    LogManager.WriteLog(LogTypes.Error, string.Format("玩家七日抢购物品,检查钻石足够,但是扣除失败,roleid={0}, id={1}", client.ClientData.RoleID, id));
                }

                GoodsData goodsData = goodsConfig.Goods;
                Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount * cnt, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, string.Format("七日抢购"), false,
                                              goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true);
                // 发物品

                return(ESevenDayActErrorCode.Success);
            }
        }