Esempio n. 1
0
        protected bool GiveEffectiveTimeAward(GameClient client, AwardItem myAwardItem)
        {
            bool result;

            if (client == null || null == myAwardItem)
            {
                result = false;
            }
            else
            {
                if (myAwardItem.GoodsDataList != null)
                {
                    for (int i = 0; i < myAwardItem.GoodsDataList.Count; i++)
                    {
                        int nGoodsID = myAwardItem.GoodsDataList[i].GoodsID;
                        if (Global.IsCanGiveRewardByOccupation(client, nGoodsID))
                        {
                            client.ClientData.AddAwardRecord((RoleAwardMsg)this.ActivityType, myAwardItem.GoodsDataList[i], false);
                            Global.AddEffectiveTimeGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, myAwardItem.GoodsDataList[i].GoodsID, myAwardItem.GoodsDataList[i].GCount, myAwardItem.GoodsDataList[i].Quality, "", myAwardItem.GoodsDataList[i].Forge_level, myAwardItem.GoodsDataList[i].Binding, 0, "", false, 1, Activity.GetActivityChineseName((ActivityTypes)this.ActivityType), myAwardItem.GoodsDataList[i].Starttime, myAwardItem.GoodsDataList[i].Endtime, myAwardItem.GoodsDataList[i].AddPropIndex, myAwardItem.GoodsDataList[i].BornIndex, myAwardItem.GoodsDataList[i].Lucky, myAwardItem.GoodsDataList[i].Strong, myAwardItem.GoodsDataList[i].ExcellenceInfo, myAwardItem.GoodsDataList[i].AppendPropLev, myAwardItem.GoodsDataList[i].ChangeLifeLevForEquip, null, null);
                        }
                    }
                }
                if (myAwardItem.AwardYuanBao > 0)
                {
                    GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType), ActivityTypes.None, "");
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(386, new object[0]), new object[]
                    {
                        myAwardItem.AwardYuanBao
                    }), GameInfoTypeIndexes.Normal, ShowGameInfoTypes.OnlyErr, 0);
                    GameManager.DBCmdMgr.AddDBCmd(10113, string.Format("{0}:{1}:{2}", client.ClientData.RoleID, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType)), null, client.ServerId);
                }
                result = true;
            }
            return(result);
        }
Esempio n. 2
0
 public static bool QueryLevelUpMadman(GameClient client, TCPOutPacketPool pool, int nID, out TCPOutPacket tcpOutPacket)
 {
     tcpOutPacket = null;
     try
     {
         KingActivity       instActivity = (KingActivity)Global.GetActivity(ActivityTypes.NewZoneUpLevelMadman);
         NewZoneUpLevelData data         = new NewZoneUpLevelData();
         int count = instActivity.RoleLimit.Count;
         data.Items = new List <NewZoneUpLevelItemData>();
         for (int i = 1; i < count + 1; i++)
         {
             NewZoneUpLevelItemData item = new NewZoneUpLevelItemData();
             AwardItem awd = instActivity.GetAward(client, i);
             item.LeftNum  = awd.MinAwardCondionValue2 - Global.GetChongJiLingQuShenZhuangQuota(client, i);
             item.GetAward = !Global.CanGetChongJiLingQuShenZhuang(client, i);
             data.Items.Add(item);
         }
         tcpOutPacket = DataHelper.ObjectToTCPOutPacket <NewZoneUpLevelData>(data, pool, nID);
         return(true);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, "LevelUpMadman", false, false);
     }
     return(false);
 }
Esempio n. 3
0
        public override bool GiveAward(GameClient client, int _params1, int _params2)
        {
            AwardItem myAwardItem = null;

            if (this.AwardDict.ContainsKey(_params1))
            {
                myAwardItem = this.AwardDict[_params1];
            }
            bool result;

            if (null == myAwardItem)
            {
                result = false;
            }
            else
            {
                client.ClientData.ClearAwardRecord((RoleAwardMsg)this.ActivityType);
                base.GiveAward(client, myAwardItem);
                if (this.AwardDict2.ContainsKey(_params1))
                {
                    myAwardItem = this.AwardDict2[_params1];
                }
                if (null == myAwardItem)
                {
                    result = false;
                }
                else
                {
                    this.GiveAwardByOccupation(client, myAwardItem, _params2);
                    GameManager.ClientMgr.NotifyGetAwardMsg(client, (RoleAwardMsg)this.ActivityType, "");
                    result = true;
                }
            }
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        ///  查询冲级达人信息
        /// </summary>
        /// <param name="client"></param>
        /// <param name="pool"></param>
        /// <param name="nID"></param>
        /// <param name="tcpOutPacket"></param>
        /// <returns></returns>
        public static bool QueryLevelUpMadman(GameClient client, TCPOutPacketPool pool, int nID, out TCPOutPacket tcpOutPacket)
        {
            tcpOutPacket = null;
            try
            {
                KingActivity instActivity = (KingActivity)Global.GetActivity(ActivityTypes.NewZoneUpLevelMadman);

                NewZoneUpLevelData data = new NewZoneUpLevelData();

                int count = instActivity.RoleLimit.Count;
                data.Items = new List <NewZoneUpLevelItemData>();
                for (int i = 1; i < count + 1; i++)
                {
                    NewZoneUpLevelItemData item = new NewZoneUpLevelItemData();
                    AwardItem awd = instActivity.GetAward(client, i);
                    item.LeftNum  = awd.MinAwardCondionValue2 - Global.GetChongJiLingQuShenZhuangQuota(client, i);
                    item.GetAward = !Global.CanGetChongJiLingQuShenZhuang(client, i);
                    data.Items.Add(item);
                }

                #region 注释掉的代码
                //AwardItem awd = instActivity.GetAward(client, (int)GiftBtnIndex.BTN1);
                //item.LeftNum =awd.MinAwardCondionValue2 - Global.SafeConvertToInt32(GameManager.GameConfigMgr.GetGameConifgItem(GameConfigNames.ChongJiGift1));
                //item.GetAward =! Global.CanGetChongJiLingQuShenZhuang(client, (int)GiftBtnIndex.BTN1);
                //data.Items.Add(item);

                //item = new NewZoneUpLevelItemData();
                //awd = instActivity.GetAward(client, (int)GiftBtnIndex.BTN2);
                //item.LeftNum = awd.MinAwardCondionValue2 - Global.SafeConvertToInt32(GameManager.GameConfigMgr.GetGameConifgItem(GameConfigNames.ChongJiGift2));
                //item.GetAward = !Global.CanGetChongJiLingQuShenZhuang(client, (int)GiftBtnIndex.BTN2);
                //data.Items.Add(item);

                //item = new NewZoneUpLevelItemData();
                //awd = instActivity.GetAward(client, (int)GiftBtnIndex.BTN3);
                //item.LeftNum = awd.MinAwardCondionValue2 - Global.SafeConvertToInt32(GameManager.GameConfigMgr.GetGameConifgItem(GameConfigNames.ChongJiGift3));
                //item.GetAward = !Global.CanGetChongJiLingQuShenZhuang(client, (int)GiftBtnIndex.BTN3);
                //data.Items.Add(item);

                //item = new NewZoneUpLevelItemData();
                //awd = instActivity.GetAward(client, (int)GiftBtnIndex.BTN4);
                //item.LeftNum = awd.MinAwardCondionValue2 - Global.SafeConvertToInt32(GameManager.GameConfigMgr.GetGameConifgItem(GameConfigNames.ChongJiGift4));
                //item.GetAward = !Global.CanGetChongJiLingQuShenZhuang(client, (int)GiftBtnIndex.BTN4);
                //data.Items.Add(item);

                //item = new NewZoneUpLevelItemData();
                //awd = instActivity.GetAward(client, (int)GiftBtnIndex.BTN5);
                //item.LeftNum = awd.MinAwardCondionValue2 - Global.SafeConvertToInt32(GameManager.GameConfigMgr.GetGameConifgItem(GameConfigNames.ChongJiGift5));
                //item.GetAward = !Global.CanGetChongJiLingQuShenZhuang(client, (int)GiftBtnIndex.BTN5);
                //data.Items.Add(item);
                #endregion

                tcpOutPacket = DataHelper.ObjectToTCPOutPacket <NewZoneUpLevelData>(data, pool, nID);
                return(true);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "LevelUpMadman", false);
            }
            return(false);
        }
Esempio n. 5
0
        protected bool GiveAwardByOccupation(GameClient client, AwardItem myAwardItem, int occupation)
        {
            bool result;

            if (client == null || null == myAwardItem)
            {
                result = false;
            }
            else
            {
                if (myAwardItem.GoodsDataList != null && myAwardItem.GoodsDataList.Count > 0)
                {
                    int count = myAwardItem.GoodsDataList.Count;
                    for (int i = 0; i < count; i++)
                    {
                        GoodsData data = myAwardItem.GoodsDataList[i];
                        if (Global.IsCanGiveRewardByOccupation(client, data.GoodsID))
                        {
                            Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, data.GoodsID, data.GCount, data.Quality, "", data.Forge_level, data.Binding, 0, "", true, 1, Activity.GetActivityChineseName((ActivityTypes)this.ActivityType), "1900-01-01 12:00:00", data.AddPropIndex, data.BornIndex, data.Lucky, data.Strong, data.ExcellenceInfo, data.AppendPropLev, data.ChangeLifeLevForEquip, null, null, 0, true);
                        }
                    }
                }
                if (myAwardItem.AwardYuanBao > 0)
                {
                    GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType), ActivityTypes.None, "");
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(386, new object[0]), new object[]
                    {
                        myAwardItem.AwardYuanBao
                    }), GameInfoTypeIndexes.Normal, ShowGameInfoTypes.OnlyErr, 0);
                    GameManager.DBCmdMgr.AddDBCmd(10113, string.Format("{0}:{1}:{2}", client.ClientData.RoleID, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType)), null, client.ServerId);
                }
                result = true;
            }
            return(result);
        }
Esempio n. 6
0
        public override AwardItem GetAward(int _params)
        {
            AwardItem myAwardItem = null;
            int       day         = _params / 1000;
            int       index       = _params % 1000;
            AwardItem result;

            if (index < 1)
            {
                result = null;
            }
            else
            {
                if (this.DayAwardItemDict.ContainsKey(day))
                {
                    if (this.DayAwardItemDict[day].Count < index)
                    {
                        return(null);
                    }
                    myAwardItem = this.DayAwardItemDict[day][index - 1];
                }
                result = myAwardItem;
            }
            return(result);
        }
Esempio n. 7
0
        public override bool GiveAward(GameClient client, int _params1, int _params2)
        {
            AwardItem myAwardItem = null;

            if (this.AwardDict.ContainsKey(_params1))
            {
                myAwardItem = this.AwardDict[_params1];
            }
            bool result;

            if (null == myAwardItem)
            {
                result = false;
            }
            else
            {
                base.GiveAward(client, myAwardItem);
                myAwardItem = null;
                if (this.AwardDict2.ContainsKey(_params1))
                {
                    myAwardItem = this.AwardDict2[_params1];
                }
                if (null != myAwardItem)
                {
                    this.GiveAwardByOccupation(client, myAwardItem, _params2);
                }
                if (this.AwardDict3.ContainsKey(_params1))
                {
                    myAwardItem = this.AwardDict3[_params1].ToAwardItem();
                    base.GiveEffectiveTimeAward(client, myAwardItem);
                }
                result = true;
            }
            return(result);
        }
        public override bool GiveAward(GameClient client, int _params)
        {
            AwardItem myAwardItem = null;

            if (this.AwardDict.ContainsKey(_params))
            {
                myAwardItem = this.AwardDict[_params];
            }
            bool result;

            if (null == myAwardItem)
            {
                result = false;
            }
            else
            {
                client.ClientData.ClearAwardRecord((RoleAwardMsg)this.ActivityType);
                WeedEndInputActivity act = HuodongCachingMgr.GetWeekEndInputActivity();
                if (null != act)
                {
                    act.GiveAward(client, myAwardItem.MinAwardCondionValue);
                }
                bool ret = base.GiveAward(client, myAwardItem);
                GameManager.ClientMgr.NotifyGetAwardMsg(client, (RoleAwardMsg)this.ActivityType, "");
                result = ret;
            }
            return(result);
        }
Esempio n. 9
0
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client, int _params)
        {
            bool result;

            if (null == client)
            {
                result = false;
            }
            else
            {
                AwardItem        myAwardItem   = this.GetAward(client, _params);
                AwardItem        myOccAward    = this.GetOccAward(client, _params);
                List <GoodsData> GoodsDataList = new List <GoodsData>();
                if (myAwardItem != null && null != myAwardItem.GoodsDataList)
                {
                    GoodsDataList.AddRange(myAwardItem.GoodsDataList);
                }
                if (myOccAward != null && null != myOccAward.GoodsDataList)
                {
                    GoodsDataList.AddRange(myOccAward.GoodsDataList);
                }
                result = (GoodsDataList.Count <= 0 || Global.CanAddGoodsDataList(client, GoodsDataList));
            }
            return(result);
        }
        public override bool GiveAward(GameClient client, int _params)
        {
            bool result2;

            if (null == client)
            {
                result2 = false;
            }
            else
            {
                bool result = true;
                if (null != this.MyAwardItem)
                {
                    result = base.GiveAward(client, this.MyAwardItem);
                }
                if (result)
                {
                    int       occupation = client.ClientData.Occupation;
                    AwardItem myOccAward = this.GetOccAward(occupation);
                    if (null != myOccAward)
                    {
                        result = base.GiveAward(client, myOccAward);
                    }
                }
                result2 = result;
            }
            return(result2);
        }
Esempio n. 11
0
        public AwardItem GetOccAward(int key)
        {
            AwardItem myOccAward = null;

            if (this.OccAwardItemDict.ContainsKey(key))
            {
                myOccAward = this.OccAwardItemDict[key];
            }
            return(myOccAward);
        }
        public AwardItem GetOccAward(int _params)
        {
            AwardItem myOccAward = null;

            if (this.OccAwardItemDict.ContainsKey(_params))
            {
                myOccAward = this.OccAwardItemDict[_params];
            }
            return(myOccAward);
        }
Esempio n. 13
0
        public override AwardItem GetAward(int _params)
        {
            AwardItem AwardList = null;

            if (this.AwardDict.ContainsKey(_params))
            {
                AwardList = this.AwardDict[_params];
            }
            return(AwardList);
        }
        public override AwardItem GetAward(int _params)
        {
            AwardItem myAwardItem = null;

            if (this.AwardItemDict.ContainsKey(_params))
            {
                myAwardItem = this.AwardItemDict[_params];
            }
            return(myAwardItem);
        }
Esempio n. 15
0
        public override AwardItem GetAward(GameClient client, int day)
        {
            AwardItem myAward = null;

            if (this.AwardItemDict.ContainsKey(day))
            {
                myAward = this.AwardItemDict[day];
            }
            return(myAward);
        }
Esempio n. 16
0
        public AwardItem GetOccAward(int _params)
        {
            AwardItem myAwardItem = null;
            int       day         = _params / 1000;
            int       key         = _params % 1000;

            if (this.DayOccAwardItemDict.ContainsKey(day))
            {
                if (this.DayOccAwardItemDict[day].ContainsKey(key))
                {
                    myAwardItem = this.DayOccAwardItemDict[day][key];
                }
            }
            return(myAwardItem);
        }
Esempio n. 17
0
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client)
        {
            int needSpace = 0;
            int maxKey    = -1;
            int nOccu     = Global.CalcOriginalOccupationID(client);

            foreach (int key in this.AwardDict.Keys)
            {
                int tmpNeedSpace = this.AwardDict[key].GoodsDataList.Count;
                tmpNeedSpace += ((this.AwardDict2[key].GoodsDataList.Count > 0) ? 1 : 0);
                tmpNeedSpace += this.AwardDict3[key].GoodsCnt();
                if (needSpace < tmpNeedSpace)
                {
                    needSpace = tmpNeedSpace;
                    maxKey    = key;
                }
            }
            bool result;

            if (-1 == maxKey)
            {
                result = true;
            }
            else
            {
                List <GoodsData> lData = new List <GoodsData>();
                foreach (GoodsData item in this.AwardDict[maxKey].GoodsDataList)
                {
                    lData.Add(item);
                }
                int count = this.AwardDict2[maxKey].GoodsDataList.Count;
                for (int i = 0; i < count; i++)
                {
                    GoodsData data = this.AwardDict2[maxKey].GoodsDataList[i];
                    if (Global.IsRoleOccupationMatchGoods(nOccu, data.GoodsID))
                    {
                        lData.Add(data);
                    }
                }
                AwardItem tmpAwardItem = this.AwardDict3[maxKey].ToAwardItem();
                foreach (GoodsData item in tmpAwardItem.GoodsDataList)
                {
                    lData.Add(item);
                }
                result = Global.CanAddGoodsDataList(client, lData);
            }
            return(result);
        }
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client)
        {
            bool result;

            if (null == client)
            {
                result = false;
            }
            else
            {
                int       occupation = client.ClientData.Occupation;
                AwardItem myOccAward = this.GetOccAward(occupation);
                result = ((this.MyAwardItem.GoodsDataList.Count <= 0 && (myOccAward == null || myOccAward.GoodsDataList.Count <= 0)) || Global.CanAddGoodsDataList(client, this.MyAwardItem.GoodsDataList));
            }
            return(result);
        }
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client, int _params)
        {
            AwardItem        myAwardItem    = this.GetAward(_params);
            AwardItem        myOccAwardItem = this.GetOccAward(_params);
            List <GoodsData> GoodsDataList  = new List <GoodsData>();

            if (null != myAwardItem)
            {
                GoodsDataList.AddRange(myAwardItem.GoodsDataList);
            }
            if (null != myOccAwardItem)
            {
                GoodsDataList.AddRange(myOccAwardItem.GoodsDataList);
            }
            return(GoodsDataList.Count <= 0 || Global.CanAddGoodsDataList(client, GoodsDataList));
        }
Esempio n. 20
0
        public override bool GiveAward(GameClient client, int _params)
        {
            AwardItem myAwardItem = this.GetAward(_params);
            bool      result      = true;

            if (null != myAwardItem)
            {
                result = base.GiveAward(client, myAwardItem);
            }
            if (result)
            {
                AwardItem myOccAward = this.GetOccAward(_params);
                if (null != myOccAward)
                {
                    result = base.GiveAward(client, myOccAward);
                }
            }
            return(result);
        }
Esempio n. 21
0
        public AwardItem GetOccAward(GameClient client, int day)
        {
            AwardItem result;

            if (null == client)
            {
                result = null;
            }
            else
            {
                AwardItem myOccAward = null;
                int       key        = day * 100 + client.ClientData.Occupation;
                if (this.OccAwardItemDict.ContainsKey(key))
                {
                    myOccAward = this.OccAwardItemDict[key];
                }
                result = myOccAward;
            }
            return(result);
        }
Esempio n. 22
0
        public override bool GiveAward(GameClient client, int _params)
        {
            AwardItem myAwardItem = null;

            if (this.AwardDict.ContainsKey(_params))
            {
                myAwardItem = this.AwardDict[_params];
            }
            bool result;

            if (null == myAwardItem)
            {
                result = false;
            }
            else
            {
                this.GiveAward(client, _params, client.ClientData.Occupation);
                result = true;
            }
            return(result);
        }
        public AwardItem ToAwardItem()
        {
            AwardItem result = new AwardItem();

            if (this.GoodsDataList != null)
            {
                for (int i = 0; i < this.GoodsDataList.Count; i++)
                {
                    GoodsData goods  = this.GoodsDataList[i];
                    bool      bSetOk = false;
                    if (this.GoodsTimeList != null && this.GoodsTimeList.Count > i)
                    {
                        AwardEffectTimeItem.TimeDetail time = this.GoodsTimeList[i];
                        if (time.Type == AwardEffectTimeItem.EffectTimeType.ETT_LastMinutesFromNow)
                        {
                            DateTime now = TimeUtil.NowDateTime();
                            goods.Starttime = now.ToString("yyyy-MM-dd HH:mm:ss");
                            goods.Endtime   = now.AddMinutes((double)time.LastMinutes).ToString("yyyy-MM-dd HH:mm:ss");
                            bSetOk          = true;
                        }
                        else if (time.Type == AwardEffectTimeItem.EffectTimeType.ETT_AbsoluteLastTime)
                        {
                            goods.Starttime = time.AbsoluteStartTime;
                            goods.Endtime   = time.AbsoluteEndTime;
                            bSetOk          = true;
                        }
                    }
                    if (!bSetOk)
                    {
                        goods.Starttime = "1900-01-01 12:00:00";
                        goods.Endtime   = "1900-01-01 12:00:00";
                    }
                    result.GoodsDataList.Add(goods);
                }
            }
            return(result);
        }
        public override bool GiveAward(GameClient client, int _params)
        {
            AwardItem myAwardItem = this.GetAward(_params);
            bool      result      = true;

            if (null != myAwardItem)
            {
                result = base.GiveAward(client, myAwardItem);
            }
            if (result)
            {
                AwardItem myOccAward = this.GetOccAward(_params);
                if (null != myOccAward)
                {
                    result = base.GiveAward(client, myOccAward);
                }
                if (result)
                {
                    string strResList = "";
                    if (null != myAwardItem)
                    {
                        strResList = EventLogManager.MakeGoodsDataPropString(myAwardItem.GoodsDataList);
                    }
                    if (!string.IsNullOrEmpty(strResList))
                    {
                        strResList += "@";
                    }
                    if (null != myOccAward)
                    {
                        strResList += EventLogManager.MakeGoodsDataPropString(myOccAward.GoodsDataList);
                    }
                    EventLogManager.AddJieriCZSongEvent(client, _params, strResList);
                }
            }
            return(result);
        }
Esempio n. 25
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);
 }
Esempio n. 26
0
        public new bool HasEnoughBagSpaceForAwardGoods(GameClient client, int _param)
        {
            AwardItem awardData = this.GetAward(_param);

            return(awardData == null || awardData.GoodsDataList.Count <= 0 || Global.CanAddGoodsDataList(client, awardData.GoodsDataList));
        }
Esempio n. 27
0
        public override bool CheckCondition(GameClient client, int extTag)
        {
            AwardItem myAwardItem = null;

            if (this.AwardDict.ContainsKey(extTag))
            {
                myAwardItem = this.AwardDict[extTag];
            }
            bool result;

            if (null == myAwardItem)
            {
                result = false;
            }
            else
            {
                ActivityTypes activityType = (ActivityTypes)this.ActivityType;
                switch (activityType)
                {
                case ActivityTypes.JieriWing:
                    if (client.ClientData.MyWingData == null || client.ClientData.MyWingData.Using == 0)
                    {
                        return(false);
                    }
                    if (client.ClientData.MyWingData.WingID < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    if (client.ClientData.MyWingData.WingID == myAwardItem.MinAwardCondionValue && client.ClientData.MyWingData.ForgeLevel < myAwardItem.MinAwardCondionValue2)
                    {
                        return(false);
                    }
                    goto IL_3A3;

                case ActivityTypes.JieriAddon:
                    if (client.UsingEquipMgr.GetUsingEquipAllAppendPropLeva() < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    goto IL_3A3;

                case ActivityTypes.JieriStrengthen:
                    if (client.UsingEquipMgr.GetUsingEquipAllForge() < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    goto IL_3A3;

                case ActivityTypes.JieriAchievement:
                    if (ChengJiuManager.GetChengJiuLevel(client) < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    goto IL_3A3;

                case ActivityTypes.JieriMilitaryRank:
                    if (GameManager.ClientMgr.GetShengWangLevelValue(client) < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    goto IL_3A3;

                case ActivityTypes.JieriVIPFanli:
                    if (client.ClientData.VipLevel < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    goto IL_3A3;

                case ActivityTypes.JieriAmulet:
                {
                    GoodsData hufugoods = client.UsingEquipMgr.GetGoodsDataByCategoriy(client, 22);
                    if (null == hufugoods)
                    {
                        return(false);
                    }
                    SystemXmlItem systemGoods = null;
                    if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(hufugoods.GoodsID, out systemGoods))
                    {
                        return(false);
                    }
                    int nSuitID = systemGoods.GetIntValue("SuitID", -1);
                    if (nSuitID < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    goto IL_3A3;
                }

                case ActivityTypes.JieriArchangel:
                    if (client.UsingEquipMgr.GetUsingEquipArchangelWeaponSuit() < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    goto IL_3A3;

                case ActivityTypes.JieriLianXuCharge:
                    break;

                case ActivityTypes.JieriMarriage:
                    if (client.ClientData.MyMarriageData == null || -1 == client.ClientData.MyMarriageData.byMarrytype || (int)client.ClientData.MyMarriageData.byGoodwilllevel < myAwardItem.MinAwardCondionValue)
                    {
                        return(false);
                    }
                    goto IL_3A3;

                default:
                    switch (activityType)
                    {
                    case ActivityTypes.JieRiHuiJi:
                    {
                        EmblemStarInfo starInfo = HuiJiManager.getInstance().GetHuiJiStartInfo(client);
                        if (null == starInfo)
                        {
                            return(false);
                        }
                        if (starInfo.EmblemLevel < myAwardItem.MinAwardCondionValue)
                        {
                            return(false);
                        }
                        if (starInfo.EmblemLevel == myAwardItem.MinAwardCondionValue && starInfo.EmblemStar < myAwardItem.MinAwardCondionValue2)
                        {
                            return(false);
                        }
                        goto IL_3A3;
                    }

                    case ActivityTypes.JieRiFuWen:
                        if (ShenShiManager.getInstance().GetCurrentTabTotalLevel(client) < myAwardItem.MinAwardCondionValue)
                        {
                            return(false);
                        }
                        goto IL_3A3;
                    }
                    break;
                }
                return(false);

IL_3A3:
                result = true;
            }
            return(result);
        }
Esempio n. 28
0
        public override bool HasEnoughBagSpaceForAwardGoods(GameClient client, int _params)
        {
            AwardItem myAwardItem = this.GetAward(_params);

            return(null == myAwardItem || myAwardItem.GoodsDataList.Count <= 0 || Global.CanAddGoodsDataList(client, myAwardItem.GoodsDataList));
        }
Esempio n. 29
0
        public override bool GiveAward(GameClient client, int _params)
        {
            AwardItem myAwardItem = this.GetAward(_params);

            return(null != myAwardItem && base.GiveAward(client, myAwardItem));
        }
Esempio n. 30
0
        /// <summary>
        /// 获得冲级狂人奖励
        /// </summary>
        /// <param name="client"></param>
        /// <param name="pool"></param>
        /// <param name="nID"></param>
        /// <param name="nRoleID"></param>
        /// <param name="nActivityType"></param>
        /// <param name="nBtnIndex"></param>
        /// <param name="tcpOutPacket"></param>
        /// <returns></returns>
        private static TCPProcessCmdResults GetNewLevelUpMadmanAward(GameClient client, TCPOutPacketPool pool, int nID, int nRoleID, int nActivityType, int nBtnIndex, out TCPOutPacket tcpOutPacket)
        {
            string   strcmd       = "";
            Activity instActivity = Global.GetActivity((ActivityTypes)nActivityType);

            // 判断背包是否够用
            if (!instActivity.HasEnoughBagSpaceForAwardGoods(client, nBtnIndex))
            {
                strcmd       = string.Format("{0}:{1}:0", -20, nActivityType);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }


            //
            int nOcc = Global.CalcOriginalOccupationID(client);

            // MU 修改逻辑
            //int nRoleLev = client.ClientData.Level;
            int       nChangeLifeLev = client.ClientData.ChangeLifeCount;
            AwardItem tmpItem        = instActivity.GetAward(client, nOcc, 1);

            if (tmpItem == null)
            {
                strcmd       = string.Format("{0}:{1}:0", -1, nActivityType);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);

                return(TCPProcessCmdResults.RESULT_DATA);
            }
            //是否在领取奖励期限内
            if (!instActivity.CanGiveAward())
            {
                strcmd       = string.Format("{0}:{1}:0", -10, nActivityType);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            tmpItem = instActivity.GetAward(client, nBtnIndex);
            if (nChangeLifeLev < tmpItem.MinAwardCondionValue)
            {
                strcmd       = string.Format("{0}:{1}:0", -100, nActivityType);     //您当前的转生次数未达到要求
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            if (nChangeLifeLev == tmpItem.MinAwardCondionValue && client.ClientData.Level < tmpItem.MinAwardCondionValue3)
            {
                strcmd       = string.Format("{0}:{1}:0", -101, nActivityType);     //您当前的等级尚未达到领取等级要求
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }

            // 检测当前的角色是否已经领取了该项豪礼
            if (!Global.CanGetChongJiLingQuShenZhuang(client, nBtnIndex))
            {
                strcmd       = string.Format("{0}:{1}:0", -103, nActivityType);    //您已领取过该等级段奖励,无法再次进行领取
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }

            // 检测当前是否还有领取的名额
            int nQuota = Global.GetChongJiLingQuShenZhuangQuota(client, nBtnIndex);

            if (nQuota >= tmpItem.MinAwardCondionValue2)
            {
                strcmd       = string.Format("{0}:{1}:0", -102, nActivityType); // 该等级段的奖励名额已满,无法进行领取
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }

            //添加物品
            instActivity.GiveAward(client, nBtnIndex, nOcc);

            //完成冲级神装领取
            Global.CompleteChongJiLingQuShenZhuang(client, nBtnIndex, nQuota + 1);

            //冲级领取神装大礼领取提示
            AwardItem tmpItem1 = instActivity.GetAward(client, nBtnIndex, 2);

            if (tmpItem1 != null && tmpItem1.GoodsDataList.Count > 0)
            {
                Global.BroadcastChongJiLingQuShengZhuangHint(client, nBtnIndex, tmpItem1.GoodsDataList[nOcc].GoodsID);
            }

            //告诉客户端已经点击了
            // string resoult = "" + nBtnIndex + "," + 1;
            strcmd       = string.Format("{0}:{1}:{2}", 1, nActivityType, nBtnIndex);
            tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
            return(TCPProcessCmdResults.RESULT_DATA);
        }