Exemplo n.º 1
0
        public static CallSpriteResult CallPet(GameClient client, int times, out string strGetGoods)
        {
            strGetGoods = "";
            CallSpriteResult result;

            if (times != 1 && times != 10)
            {
                result = CallSpriteResult.ErrorParams;
            }
            else
            {
                CallPetType TypeData = CallPetManager.GetCallPetType(1);
                if (null == TypeData)
                {
                    result = CallSpriteResult.ErrorConfig;
                }
                else if (client.ClientData.Level < TypeData.MinLevel)
                {
                    result = CallSpriteResult.ErrorLevel;
                }
                else if (client.ClientData.Level > TypeData.MaxLevel)
                {
                    result = CallSpriteResult.ErrorLevel;
                }
                else if (client.ClientData.ChangeLifeCount < TypeData.MinZhuanSheng)
                {
                    result = CallSpriteResult.ErrorLevel;
                }
                else if (client.ClientData.ChangeLifeCount > TypeData.MaxZhuanSheng)
                {
                    result = CallSpriteResult.ErrorLevel;
                }
                else
                {
                    bool bFreeCall = false;
                    bool bUseGoods = false;
                    int  bind      = 0;
                    if (1 == times)
                    {
                        if (CallPetManager.getFreeSec(client) <= 0L)
                        {
                            bFreeCall = true;
                            bind      = 1;
                        }
                    }
                    if (!bFreeCall && CallPetManager.CallPetGoodsID > 0)
                    {
                        if (1 == times)
                        {
                            if (null != Global.GetGoodsByID(client, CallPetManager.CallPetGoodsID))
                            {
                                bUseGoods = true;
                                bind      = 1;
                            }
                        }
                    }
                    int nNeedLuckStar = CallPetManager.GetCallPetPrice(times);
                    if (nNeedLuckStar < 0)
                    {
                        result = CallSpriteResult.ErrorConfig;
                    }
                    else
                    {
                        if (!bFreeCall && !bUseGoods)
                        {
                            if (Global.IsRoleHasEnoughMoney(client, nNeedLuckStar, 163) < 0 && !HuanLeDaiBiManager.GetInstance().HuanledaibiReplaceEnough(client, nNeedLuckStar, DaiBiSySType.JingLingLieQu))
                            {
                                return(CallSpriteResult.ZuanShiNotEnough);
                            }
                        }
                        if (CallPetManager.GetMaxPetCount() - CallPetManager.GetPetListCount(client) < times)
                        {
                            result = CallSpriteResult.SpriteBagIsFull;
                        }
                        else
                        {
                            if (!bFreeCall)
                            {
                                if (bUseGoods)
                                {
                                    bool usedBinding     = false;
                                    bool usedTimeLimited = false;
                                    if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, CallPetManager.CallPetGoodsID, 1, false, out usedBinding, out usedTimeLimited, false))
                                    {
                                        bUseGoods = false;
                                    }
                                }
                            }
                            if (!bFreeCall && !bUseGoods)
                            {
                                if (!GameManager.ClientMgr.ModifyLuckStarValue(client, -nNeedLuckStar, "精灵召唤", false, DaiBiSySType.JingLingLieQu))
                                {
                                    return(CallSpriteResult.ZuanShiNotEnough);
                                }
                                bind = 0;
                            }
                            for (int i = 0; i < times; i++)
                            {
                                CallPetConfig        CfgData = null;
                                List <CallPetConfig> CfgList = CallPetManager.GetCallPetConfigList(bFreeCall || bUseGoods);
                                if (CfgList == null || CfgList.Count <= 0)
                                {
                                    return(CallSpriteResult.ErrorConfig);
                                }
                                int random = Global.GetRandomNumber(1, 100001);
                                foreach (CallPetConfig item in CfgList)
                                {
                                    if (random >= item.StartValues && random <= item.EndValues)
                                    {
                                        CfgData = item;
                                        break;
                                    }
                                }
                                LogManager.WriteLog(LogTypes.Info, string.Format("获取精灵随机数: random = {0}, GoodsID = {1}", random, CfgData.GoodsID), null, true);
                                if (null != CfgData)
                                {
                                    int nExcellenceProp = 0;
                                    if (CfgData.ZhuoYueFallID != -1)
                                    {
                                        nExcellenceProp = GameManager.GoodsPackMgr.GetExcellencePropertysID(CfgData.GoodsID, CfgData.ZhuoYueFallID);
                                    }
                                    Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, CfgData.GoodsID, CfgData.Num, 0, "", 0, bind, 4000, "", false, 1, "精灵召唤", "1900-01-01 12:00:00", 0, 0, 0, 0, nExcellenceProp, 0, 0, null, null, 0, true);
                                    strGetGoods += string.Format("{0},{1},{2},{3},{4},{5},{6}|", new object[]
                                    {
                                        CfgData.GoodsID,
                                        CfgData.Num,
                                        bind,
                                        0,
                                        0,
                                        0,
                                        nExcellenceProp
                                    });
                                }
                            }
                            if (bFreeCall)
                            {
                                Global.UpdateRoleParamByName(client, "CallPetFreeTime", Global.GetOffsetSecond(TimeUtil.NowDateTime()).ToString(), true);
                                if (client._IconStateMgr.CheckPetIcon(client))
                                {
                                    client._IconStateMgr.SendIconStateToClient(client);
                                }
                            }
                            else if (!bUseGoods)
                            {
                                int nPetJiFen = (int)((double)nNeedLuckStar * CallPetManager.ConsumeCallPetJiFen);
                                GameManager.ClientMgr.ModifyPetJiFenValue(client, nPetJiFen, "精灵召唤", false, true);
                            }
                            result = CallSpriteResult.Success;
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 召唤精灵
        /// </summary>
        public static CallSpriteResult CallPet(GameClient client, int times, out string strGetGoods)
        {
            strGetGoods = "";

            if (times != 1 && times != 10)
            {
                return(CallSpriteResult.ErrorParams);
            }

            // 检查等级
            CallPetType TypeData = GetCallPetType();

            if (null == TypeData)
            {
                return(CallSpriteResult.ErrorConfig);
            }

            // 判断条件
            if (client.ClientData.Level < TypeData.MinLevel)
            {
                return(CallSpriteResult.ErrorLevel);
            }

            if (client.ClientData.Level > TypeData.MaxLevel)
            {
                return(CallSpriteResult.ErrorLevel);
            }

            if (client.ClientData.ChangeLifeCount < TypeData.MinZhuanSheng)
            {
                return(CallSpriteResult.ErrorLevel);
            }

            if (client.ClientData.ChangeLifeCount > TypeData.MaxZhuanSheng)
            {
                return(CallSpriteResult.ErrorLevel);
            }

            // 抽取一次 是不是到达免费次数了
            // 免费抽取的精灵为绑定状态,钻石抽取的精灵为不绑定状态
            bool bFreeCall = false;
            bool bUseGoods = false;
            int  bind      = 0;

            if (1 == times)
            {
                if (getFreeSec(client) <= 0)
                {
                    bFreeCall = true;
                    bind      = 1;
                }
            }

            // 不是免费 看看有没有道具
            if (bFreeCall == false && CallPetGoodsID > 0)
            {
                if (1 == times)
                {
                    if (null != Global.GetGoodsByID(client, CallPetGoodsID))
                    {
                        bUseGoods = true;
                        bind      = 1;
                    }
                }
            }

            // 检查金钱是否足够
            int nNeedZuanShi = GetCallPetPrice(times);

            if (nNeedZuanShi < 0)
            {
                return(CallSpriteResult.ErrorConfig);
            }

            if (false == bFreeCall && false == bUseGoods)
            {
                if (client.ClientData.UserMoney < nNeedZuanShi)
                {
                    return(CallSpriteResult.ZuanShiNotEnough);
                }
            }

            // 检查精灵背包是否足够
            if (GetMaxPetCount() - GetPetListCount(client) < times)
            {
                return(CallSpriteResult.SpriteBagIsFull);
            }

            if (bFreeCall)
            {
                //do nothing;
            }
            // 扣道具
            else if (bUseGoods)
            {
                bool usedBinding     = false;
                bool usedTimeLimited = false;
                // 消耗物品
                if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool,
                                                          Global._TCPManager.TcpOutPacketPool, client, CallPetGoodsID, 1, false, out usedBinding, out usedTimeLimited))
                {
                    bUseGoods = false;
                }
            }

            // 再扣钱
            if (false == bFreeCall && false == bUseGoods)
            {
                if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nNeedZuanShi, "精灵召唤"))
                {
                    return(CallSpriteResult.ZuanShiNotEnough);
                }
                bind = 0;
            }

            // 生成道具
            for (int i = 0; i < times; ++i)
            {
                CallPetConfig        CfgData = null;
                List <CallPetConfig> CfgList = GetCallPetConfigList(bFreeCall || bUseGoods);
                if (null == CfgList || CfgList.Count <= 0)
                {
                    return(CallSpriteResult.ErrorConfig);
                }

                int random = Global.GetRandomNumber(1, 100001);
                foreach (var item in CfgList)
                {
                    if (random >= item.StartValues && random <= item.EndValues)
                    {
                        CfgData = item;
                        break;
                    }
                }

                LogManager.WriteLog(LogTypes.Info, string.Format("获取精灵随机数: random = {0}, GoodsID = {1}", random, CfgData.GoodsID));

                if (null == CfgData)
                {
                    continue;
                }

                // 生成卓越属性
                int nExcellenceProp = 0;

                if (CfgData.ZhuoYueFallID != -1)
                {
                    nExcellenceProp = GameManager.GoodsPackMgr.GetExcellencePropertysID(CfgData.ZhuoYueFallID);
                }

                // 加道具
                Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client,
                                         CfgData.GoodsID, CfgData.Num /*GCount*/,
                                         0, "" /*props*/, 0 /*forgelevel*/,
                                         bind /*binding*/, (int)SaleGoodsConsts.PetBagGoodsID, "" /*jewelList*/, false, 1,
                                         /**/ "精灵召唤", Global.ConstGoodsEndTime, 0, 0, 0, 0 /*Strong*/, nExcellenceProp /*ExcellenceProperty*/, 0, 0);

                // 返回4个参数 1.返回值 2.抽奖类型 3.抽中的物品列表(物品ID, 物品ID|物品数量|是否绑定|强化等级|追加等级|是否有幸运|卓越属性,...) 4.免费祈福的剩余时间
                strGetGoods += String.Format("{0},{1},{2},{3},{4},{5},{6}|", CfgData.GoodsID, CfgData.Num, bind, 0, 0, 0, nExcellenceProp);
            }

            // 如果是免费的 更新下上次召唤的时间
            if (true == bFreeCall)
            {
                double currSec = Global.GetOffsetSecond(TimeUtil.NowDateTime());
                Global.UpdateRoleParamByName(client, RoleParamName.CallPetFreeTime, currSec.ToString(), true);

                if (client._IconStateMgr.CheckPetIcon(client))
                {
                    client._IconStateMgr.SendIconStateToClient(client);
                }
            }
            else if (true == bUseGoods)
            {
                // do nothing
            }
            else
            {
                int nPetJiFen = (int)(nNeedZuanShi * ConsumeCallPetJiFen);
                GameManager.ClientMgr.ModifyPetJiFenValue(client, nPetJiFen, "精灵召唤");
            }

            return(CallSpriteResult.Success);
        }
Exemplo n.º 3
0
 public static void LoadCallPetConfig()
 {
     try
     {
         lock (CallPetManager._CallPetMutex)
         {
             CallPetManager.CallPetConfigList.Clear();
             CallPetManager.FreeCallPetConfigList.Clear();
             CallPetManager.HuoDongCallPetConfigList.Clear();
             CallPetManager.TeQuanCallPetConfigList.Clear();
             string fileName = "Config/CallPet.xml";
             GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
             XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
             if (null == xml)
             {
                 LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPet.xml时出错!!!文件不存在", null, true);
             }
             else
             {
                 IEnumerable <XElement> xmlItems = xml.Elements();
                 foreach (XElement xmlItem in xmlItems)
                 {
                     CallPetConfig CfgData = new CallPetConfig();
                     CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");
                     CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                     CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");
                     CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");
                     CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability");
                     CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");
                     CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");
                     CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");
                     CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");
                     CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");
                     CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");
                     CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");
                     CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                     CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                     CallPetManager.CallPetConfigList.Add(CfgData);
                 }
                 fileName = "Config/FreeCallPet.xml";
                 GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                 xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                 if (null == xml)
                 {
                     LogManager.WriteLog(LogTypes.Fatal, "加载Config/FreeCallPet.xml时出错!!!文件不存在", null, true);
                 }
                 else
                 {
                     xmlItems = xml.Elements();
                     foreach (XElement xmlItem in xmlItems)
                     {
                         CallPetConfig CfgData = new CallPetConfig();
                         CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                         CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");
                         CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                         CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");
                         CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");
                         CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability");
                         CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");
                         CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");
                         CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");
                         CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");
                         CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");
                         CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");
                         CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");
                         CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                         CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                         CallPetManager.FreeCallPetConfigList.Add(CfgData);
                     }
                     fileName = "Config/HuoDongCallPet.xml";
                     GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                     xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                     if (null == xml)
                     {
                         LogManager.WriteLog(LogTypes.Fatal, "加载Config/HuoDongCallPet.xml时出错!!!文件不存在", null, true);
                     }
                     else
                     {
                         xmlItems = xml.Elements();
                         foreach (XElement xmlItem in xmlItems)
                         {
                             CallPetConfig CfgData = new CallPetConfig();
                             CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                             CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");
                             CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                             CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");
                             CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");
                             CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability");
                             CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");
                             CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");
                             CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");
                             CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");
                             CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");
                             CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");
                             CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");
                             CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                             CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                             CallPetManager.HuoDongCallPetConfigList.Add(CfgData);
                         }
                         fileName = "Config/TeQuanCallPet.xml";
                         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                         xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                         if (null == xml)
                         {
                             LogManager.WriteLog(LogTypes.Fatal, "加载Config/TeQuanBuHuo.xml时出错!!!文件不存在", null, true);
                         }
                         else
                         {
                             xmlItems = xml.Elements();
                             foreach (XElement xmlItem in xmlItems)
                             {
                                 CallPetConfig CfgData = new CallPetConfig();
                                 CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                                 CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");
                                 CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");
                                 CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");
                                 CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");
                                 CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability");
                                 CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");
                                 CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");
                                 CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");
                                 CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");
                                 CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");
                                 CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");
                                 CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");
                                 CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                                 CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                                 CallPetManager.TeQuanCallPetConfigList.Add(CfgData);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPet.xml或FreeCallPet.xml时文件出错", ex, true);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 加载CallPet.xml
        /// </summary>
        public static void LoadCallPetConfig()
        {
            try
            {
                lock (_CallPetMutex)
                {
                    CallPetConfigList.Clear();
                    FreeCallPetConfigList.Clear();
                    HuoDongCallPetConfigList.Clear();

                    string fileName = "Config/CallPet.xml";
                    GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                    XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                    if (null == xml)
                    {
                        LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPet.xml时出错!!!文件不存在");
                        return;
                    }

                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        CallPetConfig CfgData = new CallPetConfig();
                        CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");              // 流水号
                        CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");         // 物品ID
                        CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");             // 数量
                        CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");  // 强化掉落ID
                        CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");   // 追加掉落ID
                        CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability"); // 幸运掉落概率
                        CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");   // 卓越掉落ID
                        CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");        // 最小金币
                        CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");        // 最大金币
                        CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");  // 最少绑定元宝
                        CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");  // 最大绑定元宝
                        CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");          // 最少经验
                        CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");          // 最大经验
                        CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");     // 起始值
                        CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");       // 结束值
                        CallPetConfigList.Add(CfgData);
                    }

                    fileName = "Config/FreeCallPet.xml";
                    GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                    xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                    if (null == xml)
                    {
                        LogManager.WriteLog(LogTypes.Fatal, "加载Config/FreeCallPet.xml时出错!!!文件不存在");
                        return;
                    }

                    xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        CallPetConfig CfgData = new CallPetConfig();
                        CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");              // 流水号
                        CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");         // 物品ID
                        CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");             // 数量
                        CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");  // 强化掉落ID
                        CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");   // 追加掉落ID
                        CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability"); // 幸运掉落概率
                        CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");   // 卓越掉落ID
                        CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");        // 最小金币
                        CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");        // 最大金币
                        CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");  // 最少绑定元宝
                        CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");  // 最大绑定元宝
                        CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");          // 最少经验
                        CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");          // 最大经验
                        CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");     // 起始值
                        CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");       // 结束值
                        FreeCallPetConfigList.Add(CfgData);
                    }

                    fileName = "Config/HuoDongCallPet.xml";
                    GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
                    xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
                    if (null == xml)
                    {
                        LogManager.WriteLog(LogTypes.Fatal, "加载Config/HuoDongCallPet.xml时出错!!!文件不存在");
                        return;
                    }

                    xmlItems = xml.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        CallPetConfig CfgData = new CallPetConfig();
                        CfgData.ID              = (int)Global.GetSafeAttributeLong(xmlItem, "ID");              // 流水号
                        CfgData.GoodsID         = (int)Global.GetSafeAttributeLong(xmlItem, "GoodsID");         // 物品ID
                        CfgData.Num             = (int)Global.GetSafeAttributeLong(xmlItem, "Num");             // 数量
                        CfgData.QiangHuaFallID  = (int)Global.GetSafeAttributeLong(xmlItem, "QiangHuaFallID");  // 强化掉落ID
                        CfgData.ZhuiJiaFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuiJiaFallID");   // 追加掉落ID
                        CfgData.LckyProbability = (int)Global.GetSafeAttributeLong(xmlItem, "LckyProbability"); // 幸运掉落概率
                        CfgData.ZhuoYueFallID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhuoYueFallID");   // 卓越掉落ID
                        CfgData.MinMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MinMoney");        // 最小金币
                        CfgData.MaxMoney        = (int)Global.GetSafeAttributeLong(xmlItem, "MaxMoney");        // 最大金币
                        CfgData.MinBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MinBindYuanBao");  // 最少绑定元宝
                        CfgData.MaxBindYuanBao  = (int)Global.GetSafeAttributeLong(xmlItem, "MaxBindYuanBao");  // 最大绑定元宝
                        CfgData.MinExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MinExp");          // 最少经验
                        CfgData.MaxExp          = (int)Global.GetSafeAttributeLong(xmlItem, "MaxExp");          // 最大经验
                        CfgData.StartValues     = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");     // 起始值
                        CfgData.EndValues       = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");       // 结束值
                        HuoDongCallPetConfigList.Add(CfgData);
                    }
                }
            }

            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/CallPet.xml或FreeCallPet.xml时文件出错", ex);
            }
        }