Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        public static void LoadConfig()
        {
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(YueKaManager.YUE_KA_GOODS_FILE));
            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(YueKaManager.YUE_KA_GOODS_FILE));

            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", YueKaManager.YUE_KA_GOODS_FILE), null, true);
            }
            else
            {
                try
                {
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (XElement xmlItem in xmlItems)
                    {
                        if (null != xmlItem)
                        {
                            YueKaAward award = new YueKaAward();
                            award.Init(xmlItem);
                            YueKaManager.AllGoodsDict[award.Day] = award;
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时异常{1}", YueKaManager.YUE_KA_GOODS_FILE, ex), null, true);
                }
            }
        }
Ejemplo n.º 3
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));
     }
 }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }