Example #1
0
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client, int id)
        {
            JieriVIPYouHuiActivityConfig configData = null;
            bool result;

            if (!this.VIPYouHuiCofigDict.TryGetValue(id, out configData))
            {
                result = false;
            }
            else
            {
                int nOccu = Global.CalcOriginalOccupationID(client);
                List <GoodsData> lData = new List <GoodsData>();
                foreach (GoodsData item in configData.GoodsDataListOne)
                {
                    lData.Add(item);
                }
                int count = configData.GoodsDataListTwo.Count;
                for (int i = 0; i < count; i++)
                {
                    GoodsData data = configData.GoodsDataListTwo[i];
                    if (Global.IsCanGiveRewardByOccupation(client, data.GoodsID))
                    {
                        lData.Add(data);
                    }
                }
                AwardItem tmpAwardItem = configData.GoodsDataListThr.ToAwardItem();
                foreach (GoodsData item in tmpAwardItem.GoodsDataList)
                {
                    lData.Add(item);
                }
                result = Global.CanAddGoodsDataList(client, lData);
            }
            return(result);
        }
Example #2
0
        public override bool CheckCondition(GameClient client, int extTag)
        {
            bool result;

            if (!this.InActivityTime())
            {
                result = false;
            }
            else
            {
                JieriVIPYouHuiActivityConfig configData = null;
                result = (this.VIPYouHuiCofigDict.TryGetValue(extTag, out configData) && (configData.MinVIPLev < 0 || client.ClientData.VipLevel >= configData.MinVIPLev) && client.ClientData.UserMoney >= configData.Price && this.GetSinglePurchase(client, extTag) < configData.SinglePurchase && this.GetFullPurchase(client, extTag) < configData.FullPurchase);
            }
            return(result);
        }
Example #3
0
        public override bool GiveAward(GameClient client, int _params)
        {
            bool result;

            if (!this.InAwardTime())
            {
                result = false;
            }
            else
            {
                JieriVIPYouHuiActivityConfig configData = null;
                if (!this.VIPYouHuiCofigDict.TryGetValue(_params, out configData))
                {
                    result = false;
                }
                else
                {
                    if (configData.Price > 0)
                    {
                        if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, configData.Price, "节日活动VIP优惠", true, true, false, DaiBiSySType.None))
                        {
                            return(false);
                        }
                    }
                    AwardItem myAwardItem = new AwardItem();
                    myAwardItem.GoodsDataList = configData.GoodsDataListOne;
                    base.GiveAward(client, myAwardItem);
                    myAwardItem.GoodsDataList = configData.GoodsDataListTwo;
                    base.GiveAward(client, myAwardItem);
                    myAwardItem = configData.GoodsDataListThr.ToAwardItem();
                    base.GiveEffectiveTimeAward(client, myAwardItem);
                    this.UpdateSinglePurchase(client, _params);
                    this.UpdateFullPurchase(client, _params);
                    result = true;
                }
            }
            return(result);
        }
Example #4
0
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/JieRiGifts/VIPYouHuiLiBao.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/JieRiGifts/VIPYouHuiLiBao.xml"));
         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.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
         }
         args = xml.Element("GiftList");
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     JieriVIPYouHuiActivityConfig myConfigItem = new JieriVIPYouHuiActivityConfig();
                     myConfigItem.ID             = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     myConfigItem.MinVIPLev      = (int)Global.GetSafeAttributeLong(xmlItem, "VIPLevel");
                     myConfigItem.Price          = (int)Global.GetSafeAttributeLong(xmlItem, "Price");
                     myConfigItem.SinglePurchase = (int)Global.GetSafeAttributeLong(xmlItem, "SinglePurchase");
                     myConfigItem.FullPurchase   = (int)Global.GetSafeAttributeLong(xmlItem, "FullPurchase");
                     string   goodsIDsOne = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                     string[] fields      = goodsIDsOne.Split(new char[]
                     {
                         '|'
                     });
                     if (fields.Length <= 0)
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("解析节日活动VIP优惠配置文件中的物品配置项1失败", new object[0]), null, true);
                     }
                     else
                     {
                         myConfigItem.GoodsDataListOne = HuodongCachingMgr.ParseGoodsDataList(fields, "节日活动VIP优惠配置1");
                     }
                     string goodsIDsTwo = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                     if (!string.IsNullOrEmpty(goodsIDsTwo))
                     {
                         fields = goodsIDsTwo.Split(new char[]
                         {
                             '|'
                         });
                         myConfigItem.GoodsDataListTwo = HuodongCachingMgr.ParseGoodsDataList(fields, "节日活动VIP优惠配置2");
                     }
                     string goodsIDsThr = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                     myConfigItem.GoodsDataListThr.Init(goodsIDsThr, Global.GetSafeAttributeStr(xmlItem, "EffectiveTime"), "节日活动VIP优惠配置3");
                     this.VIPYouHuiCofigDict[myConfigItem.ID] = myConfigItem;
                 }
             }
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/JieRiGifts/ChongZhiDuiHuan.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }