コード例 #1
0
 private static bool LoadAngelTempleAuctionAwardData(out List <AuctionAwardConfig> _AuctionAwardList)
 {
     _AuctionAwardList = new List <AuctionAwardConfig>();
     try
     {
         XElement xml = CheckHelper.LoadXml(Global.GameResPath("Config/AngelTempleAuctionAward.xml"), true);
         if (null == xml)
         {
             LogManager.WriteLog(LogTypes.Fatal, string.Format("读取 {0} null == xml", "Config/AngelTempleAuctionAward.xml"), null, true);
             return(false);
         }
         IEnumerable <XElement> xmlItems = xml.Elements();
         foreach (XElement xmlItem in xmlItems)
         {
             if (null != xmlItem)
             {
                 AuctionAwardConfig myData = new AuctionAwardConfig();
                 myData.ID   = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                 myData.Name = Global.GetSafeAttributeStr(xmlItem, "Name");
                 string strTemp = Global.GetSafeAttributeStr(xmlItem, "GoodsID");
                 if (!string.IsNullOrEmpty(strTemp))
                 {
                     string[] temp = strTemp.Split(new char[]
                     {
                         '|'
                     });
                     myData.strGoodsList = temp.ToList <string>();
                     HuodongCachingMgr.ParseGoodsDataList(temp, "Config/AngelTempleAuctionAward.xml");
                 }
                 myData.StartValues = (int)Global.GetSafeAttributeLong(xmlItem, "StartValues");
                 myData.EndValues   = (int)Global.GetSafeAttributeLong(xmlItem, "EndValues");
                 if (myData.EndValues - myData.StartValues < 0 || myData.StartValues < 0)
                 {
                     LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现问题, 第{1} 条数据 StartValues EndValues 值不对 ", "Config/AngelTempleAuctionAward.xml", _AuctionAwardList.Count + 1), null, true);
                 }
                 _AuctionAwardList.Add(myData);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/AngelTempleAuctionAward.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
コード例 #2
0
 public void KillBossAddAuction(int KillBossRole, long BossLife, List <AuctionRoleData> PointInfoList, AuctionEnum AuctionSource)
 {
     try
     {
         lock (this.AuctionMsgMutex)
         {
             AuctionAwardConfig AuctionAwardCfg = GoldAuctionConfigModel.RandAuctionAwardConfig();
             if (null == AuctionAwardCfg)
             {
                 LogManager.WriteLog(LogTypes.Error, "[ljl]KillBossAddAuction RandAuctionAwardConfig null == config", null, true);
             }
             else
             {
                 AuctionConfig AuctionCfg = GoldAuctionConfigModel.GetAuctionConfig((int)AuctionSource);
                 if (null == AuctionCfg)
                 {
                     LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]GoldAuctionConfigModel.GetAuctionConfig({0}) null == config", AuctionSource), null, true);
                 }
                 else
                 {
                     GoldAuctionItem item = new GoldAuctionItem();
                     item.AuctionSource      = (int)AuctionSource;
                     item.KillBossRoleID     = KillBossRole;
                     item.UpDBWay            = 2;
                     item.ProductionTime     = TimeUtil.NowDataTimeString("yyyy-MM-dd HH:mm:ss.fff");
                     item.BuyerData          = new AuctionRoleData();
                     item.BuyerData.m_RoleID = 0;
                     item.BuyerData.Value    = (long)AuctionCfg.OriginPrice;
                     int index = Global.GetRandomNumber(AuctionAwardCfg.StartValues, AuctionAwardCfg.EndValues) - 1;
                     index         = Math.Min(index, AuctionAwardCfg.strGoodsList.Count - 1);
                     item.StrGoods = AuctionAwardCfg.strGoodsList[index];
                     if (null == GlobalNew.ParseGoodsData(AuctionAwardCfg.strGoodsList[index]))
                     {
                         LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]null == item.Goods index={0}  ,  GoodsList.Count = {1}", index, AuctionAwardCfg.strGoodsList.Count), null, true);
                     }
                     else
                     {
                         item.BossLife = 0L;
                         foreach (AuctionRoleData PointInfo in PointInfoList)
                         {
                             item.BossLife += PointInfo.Value;
                             if (PointInfo.Value >= GameManager.systemParamsList.GetParamValueIntByName("AngelTempleAuction", -1))
                             {
                                 AuctionRoleData RoleData = new AuctionRoleData();
                                 CopyData.Copy <AuctionRoleData>(PointInfo, ref RoleData);
                                 item.RoleList.Add(RoleData);
                             }
                         }
                         if (item.BossLife < 1L)
                         {
                             item.BossLife = BossLife;
                         }
                         bool addFlag = false;
                         for (int i = 0; i < AuctionCfg.OrderList.Count; i++)
                         {
                             if (GoldAuctionManager.IsOpenAuction((AuctionOrderEnum)AuctionCfg.OrderList[i]))
                             {
                                 item.AuctionType = AuctionCfg.OrderList[i];
                                 item.LifeTime    = AuctionCfg.TimeList[i];
                                 if (item.AuctionType > 0 && item.AuctionType < 3)
                                 {
                                     if (this.GoldAuctionMgr.SendUpdate2DB(item))
                                     {
                                         this.GoldAuctionMgr.AddNewAuctionItem(item);
                                     }
                                     else
                                     {
                                         LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]新拍卖物品存库失败 未加入 time={0},AuctionSource={1}", item.ProductionTime, AuctionSource), null, true);
                                     }
                                     addFlag = true;
                                     break;
                                 }
                                 LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]AuctionType ={1} err,AuctionSource={0}", AuctionSource, item.AuctionType), null, true);
                             }
                         }
                         if (!addFlag)
                         {
                             int roleID = item.GetMaxmDamageID();
                             this.GoldAuctionMgr.SendItem(roleID, item.RoleList.Find((AuctionRoleData x) => x.m_RoleID == roleID), item, AuctionCfg);
                             LogManager.WriteLog(LogTypes.Info, string.Format("[ljl]新拍卖物品未加入 直接邮件发送给玩家第一名 time={0},AuctionSource={1}", item.ProductionTime, AuctionSource), null, true);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }