private string GetItemName(string strGoods) { try { return(Global.GetGoodsName(GlobalNew.ParseGoodsData(strGoods))); } catch { } return("道具"); }
private static bool Load_DuiHuanShangCheng(out List <DuiHuanShangChengConfig> _DuiHuanShangChengCgfList) { _DuiHuanShangChengCgfList = new List <DuiHuanShangChengConfig>(); try { XElement xml = CheckHelper.LoadXml(Global.GameResPath("Config/DuiHuanShangCheng.xml"), true); if (null == xml) { LogManager.WriteLog(LogTypes.Fatal, string.Format("读取 {0} null == xml", "Config/DuiHuanShangCheng.xml"), null, true); return(false); } IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { if (null != xmlItem) { DuiHuanShangChengConfig myData = new DuiHuanShangChengConfig(); myData.ID = (int)Global.GetSafeAttributeLong(xmlItem, "ID"); myData.DaiBiJiaGe = (int)Global.GetSafeAttributeLong(xmlItem, "DaiBiJiaGe"); myData.MeiRiShangXianDan = (int)Global.GetSafeAttributeLong(xmlItem, "MeiRiShangXianDan"); myData.Name = Global.GetSafeAttributeStr(xmlItem, "Name"); myData.WuPinID = Global.GetSafeAttributeStr(xmlItem, "WuPinID"); if (null == GlobalNew.ParseGoodsData(myData.WuPinID)) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析 WuPinID={1} err", "Config/DuiHuanShangCheng.xml", myData.WuPinID), null, true); } else { _DuiHuanShangChengCgfList.Add(myData); } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/DuiHuanShangCheng.xml", ex.Message), null, true); return(false); } return(true); }
public static bool Copy2AuctionItemS2C(GoldAuctionItem sData, out AuctionItemS2C rData, string Seach, int Color) { rData = new AuctionItemS2C(); try { rData.Goods = GlobalNew.ParseGoodsData(sData.StrGoods); int goodsID = rData.Goods.GoodsID; if (!string.IsNullOrEmpty(Seach)) { List <int> goodsIDs = Global.StringToIntList(Seach, '#'); if (goodsIDs.Find((int x) => x == goodsID) < 1) { return(false); } } int color = Global.GetEquipColor(rData.Goods); if (Color > 0 && (1 << color - 1 & Color) == 0) { return(false); } rData.BuyRoleId = sData.BuyerData.m_RoleID; rData.Price = sData.BuyerData.Value; rData.AuctionItemKey = string.Format("{0}|{1}", sData.ProductionTime.Replace(':', ','), sData.AuctionSource); AuctionConfig cfg = GoldAuctionConfigModel.GetAuctionConfig(sData.AuctionSource); if (null != cfg) { rData.MaxPrice = (long)cfg.MaxPrice; rData.UnitPrice = (long)cfg.UnitPrice; } rData.LastTime = TimeUtil.GetDiffTimeSeconds(DateTime.Parse(sData.AuctionTime).AddHours((double)sData.LifeTime), TimeUtil.NowDateTime(), false); return(true); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true); } return(false); }
private string BuyItem(GameClient client, int nID, string[] cmdParams) { string msgInfo = ""; try { if (GameManager.systemParamsList.GetParamValueIntByName("HuanLeDuiHuan", -1) < 1L) { return(string.Format("{0}{1}", msgInfo, 7)); } int ID = Convert.ToInt32(cmdParams[1]); int BuyNum = Convert.ToInt32(cmdParams[2]); string WuPinID = cmdParams[3]; msgInfo = string.Format("{0}:{1}:{2}:", cmdParams[1], cmdParams[2], cmdParams[3]); DuiHuanShangChengConfig cfg = BoCaiConfigMgr.GetBoCaiShopConfig(ID, WuPinID); if (null == cfg) { return(string.Format("{0}{1}", msgInfo, 14)); } int useItemNum = cfg.DaiBiJiaGe * BuyNum; GoodsData Goods = GlobalNew.ParseGoodsData(WuPinID); if (null == Goods) { return(string.Format("{0}{1}", msgInfo, 14)); } if (!HuanLeDaiBiManager.GetInstance().HuanledaibiEnough(client, useItemNum)) { return(string.Format("{0}{1}", msgInfo, 4)); } if (!Global.CanAddGoods3(client, Goods.GoodsID, BuyNum, Goods.Binding, "1900-01-01 12:00:00", true)) { return(string.Format("{0}{1}", msgInfo, 13)); } KFBoCaiShopDB item = new KFBoCaiShopDB(); item.BuyNum = BuyNum; item.ID = ID; item.WuPinID = WuPinID; item.RoleID = client.ClientData.RoleID; item.Periods = Convert.ToInt32(TimeUtil.NowDataTimeString("yyMMdd")); if (cfg.MeiRiShangXianDan > -1) { if (BuyNum > cfg.MeiRiShangXianDan) { return(string.Format("{0}{1}", msgInfo, 17)); } if (!BoCaiShopManager.GetInstance().CanBuyItem(item, cfg.MeiRiShangXianDan)) { return(string.Format("{0}{1}", msgInfo, 18)); } } if (!HuanLeDaiBiManager.GetInstance().UseHuanledaibi(client, useItemNum)) { return(string.Format("{0}{1}", msgInfo, 4)); } int ret = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, Goods.GoodsID, BuyNum, Goods.Quality, Goods.Props, Goods.Forge_level, Goods.Binding, Goods.Site, Goods.Jewellist, true, 1, "博彩商店购买", "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, null, null, 0, true); LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_博彩] 博彩商店购买 放在背包ret={1},RoleID={0},WuPinID={2},name={3}", new object[] { client.ClientData.RoleID, ret, WuPinID, client.ClientData.RoleName }), null, true); return(string.Format("{0}{1}", msgInfo, 0)); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true); } return(string.Format("{0}{1}", msgInfo, 100)); }
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); } }
public void SendItem(int roleID, AuctionRoleData roleData, GoldAuctionItem AuctionItem, AuctionConfig AuctionCfg) { lock (this.AuctionMutex) { try { if (roleID <= 0) { LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]SendItem roleid=0,ProductionTime={0},AuctionSource={1}", AuctionItem.ProductionTime, AuctionItem.AuctionSource), null, true); } else { List <GoodsData> goodsData = new List <GoodsData>(); GoodsData goods = GlobalNew.ParseGoodsData(AuctionItem.StrGoods); if (null == goods) { LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]SendItem null == goods,ProductionTime={0},AuctionSource={1}", AuctionItem.ProductionTime, AuctionItem.AuctionSource), null, true); } else { goodsData.Add(goods); string ItemName = this.GetItemName(AuctionItem.StrGoods); if (null == roleData) { roleData = new AuctionRoleData(); GameClient client = GameManager.ClientMgr.FindClient(roleID); if (client != null) { roleData.m_RoleID = roleID; roleData.strUserID = client.strUserID; roleData.m_RoleName = client.ClientData.RoleName; roleData.ZoneID = client.ClientData.ZoneID; roleData.ServerId = client.ServerId; } } string strTitle; string strIntro; if (roleID == AuctionItem.BuyerData.m_RoleID) { strTitle = "购买成功"; strIntro = "在金团拍卖购买成功"; } else { strTitle = AuctionCfg.FailTitle; strIntro = string.Format(AuctionCfg.FailIntro, ItemName); } if (!Global.UseMailGivePlayerAward3(roleID, goodsData, strTitle, strIntro, 0, 0, 0)) { GameManager.logDBCmdMgr.AddMessageLog(-1, ItemName, "邮件发放金团结算失败", roleData.m_RoleName, roleData.m_RoleName, "增加", goods.GCount, roleData.ZoneID, roleData.strUserID, -1, roleData.ServerId, AuctionItem.StrGoods); LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]SendItem 邮件发放金团结算失败 roleid={0}, item = {1}", roleID, AuctionItem.StrGoods), null, true); } else { GameManager.logDBCmdMgr.AddDBLogInfo(-1, ItemName, "邮件发放金团结算", "系统", roleData.m_RoleName, "增加", goods.GCount, roleData.ZoneID, roleData.strUserID, -1, roleData.ServerId, null); } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]SendItem send email roleid={0}, item = {1}", roleID, AuctionItem.StrGoods, ex.ToString()), null, true); } } }