コード例 #1
0
        public DanBiChongZhiAwardDetail GetDanBiChongZhiAwardDetail(GameClient client, int danBiID)
        {
            DanBiChongZhiAwardDetail danBiChongZhiAwardDetail = null;

            lock (this.DanBiChongZhiAwardDic)
            {
                this.DanBiChongZhiAwardDic.TryGetValue(danBiID, out danBiChongZhiAwardDetail);
            }
            return(danBiChongZhiAwardDetail);
        }
コード例 #2
0
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client, int danBIID)
        {
            DanBiChongZhiAwardDetail danBiChongZhiAwardDetail = null;

            lock (this.DanBiChongZhiAwardDic)
            {
                if (!this.DanBiChongZhiAwardDic.TryGetValue(danBIID, out danBiChongZhiAwardDetail))
                {
                    return(false);
                }
            }
            int totalCnt = danBiChongZhiAwardDetail.TotalAwardCntWithOcc(client);

            return(Global.CanAddGoodsNum(client, totalCnt));
        }
コード例 #3
0
        public override bool GiveAward(GameClient client, int danBiID)
        {
            DanBiChongZhiAwardDetail danBiChongZhiAwardDetail = null;

            lock (this.DanBiChongZhiAwardDic)
            {
                if (!this.DanBiChongZhiAwardDic.TryGetValue(danBiID, out danBiChongZhiAwardDetail))
                {
                    return(false);
                }
            }
            bool result;

            if (null == danBiChongZhiAwardDetail.AwardDict)
            {
                result = false;
            }
            else
            {
                base.GiveAward(client, danBiChongZhiAwardDetail.AwardDict);
                if (null == danBiChongZhiAwardDetail.AwardDict2)
                {
                    result = false;
                }
                else
                {
                    this.GiveAwardByOccupation(client, danBiChongZhiAwardDetail.AwardDict2, client.ClientData.Occupation);
                    if (null == danBiChongZhiAwardDetail.EffectTimeAwardDict)
                    {
                        result = false;
                    }
                    else
                    {
                        base.GiveEffectiveTimeAward(client, danBiChongZhiAwardDetail.EffectTimeAwardDict.ToAwardItem());
                        result = true;
                    }
                }
            }
            return(result);
        }
コード例 #4
0
        public bool CheckDanBiChongZhiCountOK(GameClient client, int danBiId)
        {
            DanBiChongZhiAwardDetail danBiChongZhiAwardDetail = this.GetDanBiChongZhiAwardDetail(client, danBiId);
            bool result;

            if (danBiChongZhiAwardDetail == null)
            {
                result = false;
            }
            else
            {
                int maxCount;
                if (danBiChongZhiAwardDetail.SinglePurchase > 127)
                {
                    maxCount = 127;
                }
                else
                {
                    maxCount = danBiChongZhiAwardDetail.SinglePurchase;
                }
                string sCmd = string.Format("{0}:{1}:{2}:{3}", new object[]
                {
                    client.ClientData.RoleID,
                    this.FromDate.Replace(':', '$'),
                    this.ToDate.Replace(':', '$'),
                    this.DBQueryInfoCmd()
                });
                Dictionary <string, string> danBiDicInfo = Global.sendToDB <Dictionary <string, string>, string>(947, sCmd, client.ServerId);
                if (danBiDicInfo != null && danBiDicInfo.Count <KeyValuePair <string, string> >() > 0)
                {
                    string key   = string.Format("{0}_{1}", danBiChongZhiAwardDetail.MinYuanBao, danBiChongZhiAwardDetail.MaxYuanBao);
                    string value = null;
                    if (danBiDicInfo.TryGetValue(key, out value))
                    {
                        string[] spiltArr = value.Split(new char[]
                        {
                            '_'
                        });
                        if (spiltArr.Length != 2)
                        {
                            result = false;
                        }
                        else
                        {
                            int inputCount = Convert.ToInt32(spiltArr[0]);
                            int awardCount = Convert.ToInt32(spiltArr[1]);
                            result = (awardCount <maxCount && inputCount> awardCount);
                        }
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
コード例 #5
0
 public bool init()
 {
     this.DanBiChongZhiAwardDic.Clear();
     try
     {
         string fileName = "Config/JieRiGifts/JieRiDanBiChongZhi.xml";
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("Activities");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
             this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
             this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
         }
         args = xml.Element("GiftList");
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     DanBiChongZhiAwardDetail danBiChongZhiAwardDetail = new DanBiChongZhiAwardDetail();
                     AwardItem           myAwardItem         = new AwardItem();
                     AwardItem           myAwardItem2        = new AwardItem();
                     AwardEffectTimeItem effectTimeAwardItem = new AwardEffectTimeItem();
                     string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                     if (string.IsNullOrEmpty(goodsIDs))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("读取单笔充值活动配置文件中的物品配置项1失败", new object[0]), null, true);
                     }
                     else
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取单笔充值活动配置文件中的物品配置项失败", new object[0]), null, true);
                         }
                         else
                         {
                             myAwardItem.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "单笔充值活动配置");
                         }
                     }
                     goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                     if (string.IsNullOrEmpty(goodsIDs))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("读取单笔充值活动配置文件中的物品配置项1失败", new object[0]), null, true);
                     }
                     else
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取单笔充值活动配置文件中的物品配置项失败", new object[0]), null, true);
                         }
                         else
                         {
                             myAwardItem2.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "单笔充值活动配置");
                         }
                     }
                     string timeGoods = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                     string timeList  = Global.GetSafeAttributeStr(xmlItem, "EffectiveTime");
                     effectTimeAwardItem.Init(timeGoods, timeList, fileName + " 时效性物品");
                     int minYuanBao     = (int)Global.GetSafeAttributeLong(xmlItem, "MinYuanBao");
                     int maxYuanBao     = (int)Global.GetSafeAttributeLong(xmlItem, "MaxYuanBao");
                     int singlePurchase = (int)Global.GetSafeAttributeLong(xmlItem, "SinglePurchase");
                     int ID             = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     danBiChongZhiAwardDetail.ID                  = ID;
                     danBiChongZhiAwardDetail.AwardDict           = myAwardItem;
                     danBiChongZhiAwardDetail.AwardDict2          = myAwardItem2;
                     danBiChongZhiAwardDetail.EffectTimeAwardDict = effectTimeAwardItem;
                     danBiChongZhiAwardDetail.MinYuanBao          = minYuanBao;
                     danBiChongZhiAwardDetail.MaxYuanBao          = maxYuanBao;
                     danBiChongZhiAwardDetail.SinglePurchase      = singlePurchase;
                     this.DanBiChongZhiAwardDic[ID]               = danBiChongZhiAwardDetail;
                 }
             }
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, "Config/JieRiGifts/JieRiDanBiChongZhi.xml解析出现异常", ex, true);
         return(false);
     }
     return(true);
 }