public MarryOtherResult ChangeRing(GameClient client, int nRingID) { MarryOtherResult result; if (-1 == client.ClientData.MyMarriageData.byMarrytype) { result = MarryOtherResult.NotMarriaged; } else if (nRingID - client.ClientData.MyMarriageData.nRingID != 1) { result = MarryOtherResult.NotNexRise; } else { SystemXmlItem RingXmlItem = null; if (!this.WeddingRingDic.SystemXmlItemDict.TryGetValue(nRingID, out RingXmlItem) || null == RingXmlItem) { result = MarryOtherResult.NotRing; } else { SystemXmlItem NowRingXmlItem = null; if (!this.WeddingRingDic.SystemXmlItemDict.TryGetValue(client.ClientData.MyMarriageData.nRingID, out NowRingXmlItem) || null == NowRingXmlItem) { result = MarryOtherResult.NotRing; } else { string strCostList = ""; int oldUserMoney = client.ClientData.UserMoney; int oldUserGlod = client.ClientData.Gold; int nCostGam = RingXmlItem.GetIntValue("NeedZuanShi", -1); int nBeforeCostGam = NowRingXmlItem.GetIntValue("NeedZuanShi", -1); int chajia = nCostGam - nBeforeCostGam; if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, chajia, "更换婚戒扣除", true, true, false, DaiBiSySType.None)) { result = MarryOtherResult.NeedGam; } else { strCostList += EventLogManager.NewResPropString(ResLogType.FristBindZuanShi, new object[] { -chajia, oldUserGlod, client.ClientData.Gold, oldUserMoney, client.ClientData.UserMoney }); client.ClientData.MyMarriageData.nRingID = nRingID; EventLogManager.AddRingBuyEvent(client, 1, nRingID, (int)client.ClientData.MyMarriageData.byGoodwilllevel, (int)client.ClientData.MyMarriageData.byGoodwilllevel, (int)client.ClientData.MyMarriageData.byGoodwillstar, (int)client.ClientData.MyMarriageData.byGoodwillstar, strCostList); this.UpdateRingAttr(client, true, false); MarryFuBenMgr.UpdateMarriageData2DB(client); this.SendMarriageDataToClient(client, true); result = MarryOtherResult.Success; } } } } return(result); }
public static void ParseWuXingAwardItem(SystemXmlItem systemXmlItem) { List <GoodsData> goodsDataList = null; string goodsIDs = systemXmlItem.GetStringValue("GoodsIDs"); if (!string.IsNullOrEmpty(goodsIDs)) { string[] fields = goodsIDs.Split(new char[] { '|' }); if (fields.Length > 0) { goodsDataList = WuXingMapMgr.ParseGoodsDataList(fields); } else { LogManager.WriteLog(LogTypes.Error, string.Format("解析WuXingAwards.xml配置项中的物品奖励失败, MapCode={0}", systemXmlItem.GetIntValue("MapCode", -1)), null, true); } } else { LogManager.WriteLog(LogTypes.Error, string.Format("解析WuXingAwards.xml配置项中的物品奖励失败, MapCode={0}", systemXmlItem.GetIntValue("MapCode", -1)), null, true); } WuXingMapMgr.TheWuXingMapAwardItem = new WuXingMapAwardItem { MapCode = systemXmlItem.GetIntValue("MapCode", -1), Money1 = systemXmlItem.GetIntValue("Moneyaward", -1), ExpXiShu = systemXmlItem.GetDoubleValue("ExpXiShu"), GoodsDataList = goodsDataList, MinBlessPoint = systemXmlItem.GetIntValue("MinBlessPoint", -1), MaxBlessPoint = systemXmlItem.GetIntValue("MaxBlessPoint", -1) }; }
public static void LoadXuXingConfig() { XElement xml = null; string fileName = "Config/WuXing.xml"; try { xml = XElement.Load(Global.GameResPath(fileName)); if (null == xml) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } } catch (Exception) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } IEnumerable <XElement> nodes = xml.Elements(); foreach (XElement node in nodes) { SystemXmlItem systemXmlItem = new SystemXmlItem { XMLNode = node }; WuXingMapMgr.ParseWuXingXmlItem(systemXmlItem); } }
public static void LoadHorseEnchanceItems() { string fileName = ""; XElement xml = null; try { fileName = string.Format("Config/Horses/HorseEnchance.xml", new object[0]); xml = XElement.Load(Global.GameResPath(fileName)); if (null == xml) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } } catch (Exception) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } IEnumerable <XElement> levelXmlItems = xml.Elements("Levels"); foreach (XElement levelXmlItem in levelXmlItems) { IEnumerable <XElement> propItems = levelXmlItem.Elements(); foreach (XElement propItem in propItems) { SystemXmlItem systemXmlItem = new SystemXmlItem { XMLNode = propItem }; string key = string.Format("{0}_{1}", Global.GetSafeAttributeStr(levelXmlItem, "level"), propItem.Name); HorseCachingManager.HorseItemsDict[key] = systemXmlItem; } } }
/// <summary> /// 获取当前正在骑乘的坐骑的进阶养成点 /// </summary> /// <param name="client"></param> /// <returns></returns> public static int GetCurrentHorseBlessPoint(GameClient client) { int horseDbID = client.ClientData.HorseDbID; if (horseDbID <= 0) { return(0); } //获取坐骑数据 HorseData horseData = Global.GetHorseDataByDbID(client, horseDbID); if (null == horseData) { return(0); } SystemXmlItem horseUpXmlNode = Global.GetHorseUpXmlNode(horseData.HorseID + 1); if (null == horseUpXmlNode) { return(0); } int horseBlessPoint = horseUpXmlNode.GetIntValue("BlessPoint"); return(horseBlessPoint); }
/// <summary> /// 加载弹窗列表 /// </summary> public static void LoadPopupWinItemList() { XElement xml = null; string fileName = "Config/PopupWin.xml"; try { xml = XElement.Load(Global.GameResPath(fileName)); if (null == xml) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } } catch (Exception) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } List <PopupWinItem> popupWinItemList = new List <PopupWinItem>(); SystemXmlItem systemXmlItem = null; IEnumerable <XElement> nodes = xml.Elements(); foreach (var node in nodes) { systemXmlItem = new SystemXmlItem() { XMLNode = node, }; //解析Xml项 ParseXmlItem(systemXmlItem, popupWinItemList); } PopupWinItemList = popupWinItemList; }
public EquipPropItem FindEquipPropItem(int equipID) { EquipPropItem equipPropItem = null; lock (this._EquipPropsDict) { if (this._EquipPropsDict.TryGetValue(equipID, out equipPropItem)) { return(equipPropItem); } } SystemXmlItem systemGoods = null; EquipPropItem result; if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(equipID, out systemGoods)) { result = null; } else { this.ParseEquipProps(systemGoods, out equipPropItem); if (null != equipPropItem) { lock (this._EquipPropsDict) { this._EquipPropsDict[equipID] = equipPropItem; } } result = equipPropItem; } return(result); }
public void ParseEquipProps(SystemXmlItem systemGoods, out EquipPropItem equipPropItem) { equipPropItem = null; string props = systemGoods.GetStringValue("EquipProps"); string[] fields = props.Split(new char[] { ',' }); if (fields.Length != 177) { LogManager.WriteLog(LogTypes.Fatal, string.Format("解析物品属性失败: EquipID={0},EquipProps属性期望个数{1},实际个数{2}", systemGoods.GetIntValue("ID", -1), 177, fields.Length), null, true); } double[] arryDoubles = null; try { arryDoubles = Global.StringArray2DoubleArray(fields); } catch (Exception) { LogManager.WriteLog(LogTypes.Error, string.Format("转换物品属性数组: EquipID={0}", systemGoods.GetIntValue("ID", -1)), null, true); return; } equipPropItem = new EquipPropItem(); int i = 0; while (i < 177 && i < arryDoubles.Length) { equipPropItem.ExtProps[i] = arryDoubles[i]; i++; } }
/// <summary> /// 解析装备属性 /// </summary> /// <param name="systemGoods"></param> /// <param name="equipPropItem"></param> public void ParseEquipProps(SystemXmlItem systemGoods, out EquipPropItem equipPropItem) { equipPropItem = null; string props = systemGoods.GetStringValue("EquipProps"); string[] fields = props.Split(','); if (fields.Length != (int)ExtPropIndexes.Max_Configed) //属性个数不符合 { LogManager.WriteLog(LogTypes.Fatal, string.Format("解析物品属性失败: EquipID={0},EquipProps属性期望个数{1},实际个数{2}", systemGoods.GetIntValue("ID"), (int)ExtPropIndexes.Max_Configed, fields.Length)); } double[] arryDoubles = null; try { arryDoubles = Global.StringArray2DoubleArray(fields); } catch (Exception) { LogManager.WriteLog(LogTypes.Error, string.Format("转换物品属性数组: EquipID={0}", systemGoods.GetIntValue("ID"))); return; } equipPropItem = new EquipPropItem(); //for (int i = 0; i < 5; i++) //{ // equipPropItem.BaseProps[i] = arryDoubles[i]; //} for (int i = 0; i < (int)ExtPropIndexes.Max_Configed && i < arryDoubles.Length; i++) { equipPropItem.ExtProps[i] = arryDoubles[i]; } }
public static int GetCurrentHorseBlessPoint(GameClient client) { int horseDbID = client.ClientData.HorseDbID; int result; if (horseDbID <= 0) { result = 0; } else { HorseData horseData = Global.GetHorseDataByDbID(client, horseDbID); if (null == horseData) { result = 0; } else { SystemXmlItem horseUpXmlNode = Global.GetHorseUpXmlNode(horseData.HorseID + 1); if (null == horseUpXmlNode) { result = 0; } else { int horseBlessPoint = horseUpXmlNode.GetIntValue("BlessPoint", -1); result = horseBlessPoint; } } } return(result); }
public void LoadGuildCopyMapOrder() { this.GuildCopyMapOrderList.Clear(); this.GuildCopyMapOrderList.Add(this.FirstGuildCopyMapOrder); int beginOrder = this.FirstGuildCopyMapOrder; for (;;) { SystemXmlItem systemFuBenItem = null; if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(beginOrder, out systemFuBenItem)) { break; } if (null == systemFuBenItem) { break; } int nDownCopyID = systemFuBenItem.GetIntValue("DownCopyID", -1); if (nDownCopyID <= 0) { goto Block_3; } beginOrder = nDownCopyID; this.GuildCopyMapOrderList.Add(nDownCopyID); } return; Block_3: this.LastGuildCopyMapOrder = beginOrder; }
/// <summary> /// 解析Xml项 /// </summary> /// <param name="systemXmlItem"></param> private static void ParseXmlItem(SystemXmlItem systemXmlItem, List <PopupWinItem> popupWinItemList) { int id = systemXmlItem.GetIntValue("ID"); int hintFileID = systemXmlItem.GetIntValue("HintFileID"); string times = systemXmlItem.GetStringValue("Times"); if (string.IsNullOrEmpty(times)) { //LogManager.WriteLog(LogTypes.Error, string.Format("解析弹窗配置表中的时间项失败, ID={0}", id)); return; } PopupWinTimeItem[] popupWinTimeItemArray = ParsePopupWinTimeItems(times); if (null == popupWinTimeItemArray) { LogManager.WriteLog(LogTypes.Error, string.Format("解析弹窗配置表中的时间项为数组时失败, ID={0}", id)); return; } PopupWinItem popupWinItem = new PopupWinItem() { ID = id, HintFileID = hintFileID, Times = popupWinTimeItemArray, }; popupWinItemList.Add(popupWinItem); }
/// <summary> /// 通过物品ID获取属性 /// </summary> /// <param name="equipID"></param> /// <returns></returns> public EquipPropItem FindEquipPropItem(int equipID) { EquipPropItem equipPropItem = null; lock (_EquipPropsDict) { if (_EquipPropsDict.TryGetValue(equipID, out equipPropItem)) { return(equipPropItem); } } //先查找缓存 SystemXmlItem systemGoods = null; if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(equipID, out systemGoods)) { return(null); } ParseEquipProps(systemGoods, out equipPropItem); if (null != equipPropItem) { lock (_EquipPropsDict) { _EquipPropsDict[equipID] = equipPropItem; } } return(equipPropItem); }
public static void LoadJingMaiItemsByOccupation(int occupation) { string fileName = ""; XElement xml = null; try { fileName = string.Format("Config/JingMais/{0}.xml", occupation); xml = XElement.Load(Global.GameResPath(fileName)); if (null == xml) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } } catch (Exception) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } IEnumerable <XElement> JingMaiXmlItems = xml.Elements("JingMai"); foreach (XElement JingMaiItem in JingMaiXmlItems) { IEnumerable <XElement> ChongItems = JingMaiItem.Elements("Chong"); foreach (XElement ChongItem in ChongItems) { SystemXmlItem systemXmlItem = new SystemXmlItem { XMLNode = ChongItem }; string key = string.Format("{0}_{1}_{2}", occupation, (int)Global.GetSafeAttributeLong(JingMaiItem, "ID"), (int)Global.GetSafeAttributeLong(ChongItem, "ID")); JingMaiCacheManager.JingMaiItemsDict[key] = systemXmlItem; } } }
public static SystemXmlItem GetEquipUpgradeItemByGoodsID(int goodsID, int maxSuiItID) { SystemXmlItem systemGoods = null; SystemXmlItem result; if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsID, out systemGoods)) { result = null; } else { int categoriy = systemGoods.GetIntValue("Categoriy", -1); if (categoriy < 0 || categoriy >= 49) { result = null; } else { int suitID = systemGoods.GetIntValue("SuitID", -1); if (suitID < 1 || suitID > maxSuiItID) { suitID = 1; } result = EquipUpgradeCacheMgr.GetEquipUpgradeCacheItem(categoriy, suitID); } } return(result); }
/// <summary> /// 加载任务章节配置信息,RangeKey记录适用该章节属性的任务ID范围 /// </summary> public static void InitTaskZhangJieInfo() { try { GameManager.TaskZhangJieDict.Clear(); int startTaskID = 0; int endTaskID = 0; SystemXmlItem preXmlItem = null; foreach (var kv in GameManager.TaskZhangJie.SystemXmlItemDict) { endTaskID = kv.Value.GetIntValue("EndTaskID"); if (startTaskID != 0) { GameManager.TaskZhangJieDict.Add(new RangeKey(startTaskID, endTaskID - 1, preXmlItem)); } startTaskID = endTaskID; preXmlItem = kv.Value; } GameManager.TaskZhangJieDict.Add(new RangeKey(endTaskID, int.MaxValue, preXmlItem)); } catch (Exception) { throw new Exception(string.Format("Init xml file : {0} fail", string.Format("Config/TaskZhangJie.xml"))); } }
public static int ProcessAddHorseAwardLucky(GameClient client, int luckyValue, bool usedTimeLimited, string getType) { int result; if (0 == luckyValue) { result = 0; } else { int horseDbID = client.ClientData.HorseDbID; if (horseDbID <= 0) { result = -300; } else { HorseData horseData = Global.GetHorseDataByDbID(client, horseDbID); if (null == horseData) { result = -1; } else { SystemXmlItem horseUpXmlNode = Global.GetHorseUpXmlNode(horseData.HorseID + 1); if (null == horseUpXmlNode) { result = -35; } else { int horseBlessPoint = horseUpXmlNode.GetIntValue("BlessPoint", -1); int jinJieFailedNum = Global.GetHorseFailedNum(horseData); if (horseData.HorseID >= Global.MaxHorseID) { result = -10; } else { int addLuckValue = Global.GMin(luckyValue, horseBlessPoint - jinJieFailedNum); addLuckValue = Global.GMax(0, addLuckValue); if (!usedTimeLimited) { Global.AddHorseFailedNum(horseData, addLuckValue); } else { Global.AddHorseTempJiFen(horseData, addLuckValue); } Global.UpdateHorseIDDBCommand(Global._TCPManager.TcpOutPacketPool, client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID); Global.AddRoleHorseUpgradeEvent(client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID, getType); result = addLuckValue; } } } } } return(result); }
private Dictionary <int, SystemXmlItem> _LoadFromXMlFile(string fileName, string rootName, string keyName, int resType) { XElement xml = null; try { string fullPathFileName = ""; if (0 == resType) { fullPathFileName = Global.GameResPath(fileName); } else if (1 == resType) { fullPathFileName = Global.IsolateResPath(fileName); } fullPathFileName = WorldLevelManager.getInstance().GetJieRiConfigFileName(fullPathFileName); xml = XElement.Load(fullPathFileName); if (null == xml) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fullPathFileName)); } this.FileName = fileName; this.RootName = rootName; this.KeyName = keyName; this.ResType = resType; } catch (Exception ex) { throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。\r\n{1}", fileName, ex.ToString())); } IEnumerable <XElement> nodes; if ("" == rootName) { nodes = xml.Elements(); } else { nodes = xml.Elements(rootName).Elements <XElement>(); } Dictionary <int, SystemXmlItem> systemXmlItemDict = new Dictionary <int, SystemXmlItem>(); foreach (XElement node in nodes) { SystemXmlItem systemXmlItem = new SystemXmlItem { XMLNode = node }; int key = (int)Global.GetSafeAttributeLong(node, keyName); systemXmlItemDict[key] = systemXmlItem; if (key > this.MaxKey) { this.MaxKey = key; } } this.FirstLoadOK = true; return(systemXmlItemDict); }
/// <summary> /// 添加物品冷却 /// </summary> /// <param name="magicCode"></param> public void AddGoodsCoolDown(GameClient client, int goodsID) { // 物品名字索引管理 SystemXmlItem systemGoods = null; if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsID, out systemGoods)) { return; } int cdTime = systemGoods.GetIntValue("CDTime"); if (cdTime <= 0) //不需要CD时间 { return; } int pubCDTime = systemGoods.GetIntValue("PubCDTime"); int cdGroup = systemGoods.GetIntValue("ShareGroupID"); long nowTicks = TimeUtil.NOW(); Global.AddCoolDownItem(GoodsCoolDownDict, goodsID, nowTicks, cdTime * 1000); if (cdGroup > 0) { if (null != client.ClientData.GoodsDataList) { for (int i = 0; i < client.ClientData.GoodsDataList.Count; i++) { GoodsData goodsData = client.ClientData.GoodsDataList[i]; if (null == goodsData) { continue; } if (goodsData.Using > 0) { continue; } SystemXmlItem systemGoods2 = null; if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsData.GoodsID, out systemGoods2)) { continue; } if (null == systemGoods2) { continue; } if (cdGroup == systemGoods2.GetIntValue("ShareGroupID")) //同组 { Global.AddCoolDownItem(GoodsCoolDownDict, goodsData.GoodsID, nowTicks, pubCDTime * 1000); } } } } }
public void InitAngelTemple() { Global.QueryDayActivityTotalPointInfoToDB(SpecialActivityTypes.AngelTemple); this.AngelTempleMonsterUpgradePercent = Global.SafeConvertToDouble(GameManager.GameConfigMgr.GetGameConifgItem("AngelTempleMonsterUpgradeNumber")); this.AngelTempleMinHurt = GameManager.systemParamsList.GetParamValueIntByName("AngelTempleMinHurt", -1); double[] AngelTempleBossUpgradeParams = GameManager.systemParamsList.GetParamValueDoubleArrayByName("AngelTempleBossUpgrade", ','); if (AngelTempleBossUpgradeParams != null && AngelTempleBossUpgradeParams.Length == 4) { this.AngelTempleBossUpgradeTime = (int)AngelTempleBossUpgradeParams[0]; this.AngelTempleBossUpgradeParam1 = AngelTempleBossUpgradeParams[1]; this.AngelTempleBossUpgradeParam2 = AngelTempleBossUpgradeParams[2]; this.AngelTempleBossUpgradeParam3 = AngelTempleBossUpgradeParams[3]; } this.m_sKillBossRoleName = GameManager.GameConfigMgr.GetGameConifgItem("AngelTempleRole"); for (int i = 0; i < 5; i++) { AngelTemplePointInfo tmp = new AngelTemplePointInfo(); tmp.m_RoleID = 0; tmp.m_DamagePoint = 0L; tmp.m_GetAwardFlag = 0; tmp.m_RoleName = ""; this.m_PointInfoArray[i] = tmp; } this.m_BossHP = 10000L; SystemXmlItem ItemAngelTempleData = null; GameManager.systemAngelTempleData.SystemXmlItemDict.TryGetValue(1, out ItemAngelTempleData); if (ItemAngelTempleData == null) { throw new Exception("AngelTemple Scene ERROR"); } this.m_AngelTempleData.MapCode = ItemAngelTempleData.GetIntValue("MapCode", -1); this.m_AngelTempleData.MinChangeLifeNum = ItemAngelTempleData.GetIntValue("MinZhuangSheng", -1); this.m_AngelTempleData.MinLevel = ItemAngelTempleData.GetIntValue("MinLevel", -1); List <string> strTimeList = new List <string>(); string timePoints = ItemAngelTempleData.GetStringValue("TimePoints"); if (timePoints != null && timePoints != "") { string[] sField = timePoints.Split(new char[] { ',' }); for (int i = 0; i < sField.Length; i++) { strTimeList.Add(sField[i].Trim()); } } this.m_AngelTempleData.BeginTime = strTimeList; this.m_AngelTempleData.PrepareTime = Global.GMax(ItemAngelTempleData.GetIntValue("PrepareSecs", -1), ItemAngelTempleData.GetIntValue("WaitingEnterSecs", -1)); this.m_AngelTempleData.DurationTime = ItemAngelTempleData.GetIntValue("FightingSecs", -1); this.m_AngelTempleData.LeaveTime = ItemAngelTempleData.GetIntValue("ClearRolesSecs", -1); this.m_AngelTempleData.MinPlayerNum = ItemAngelTempleData.GetIntValue("MinRequestNum", -1); this.m_AngelTempleData.MaxPlayerNum = ItemAngelTempleData.GetIntValue("MaxEnterNum", -1); this.m_AngelTempleData.BossID = ItemAngelTempleData.GetIntValue("BossID", -1); this.m_AngelTempleData.BossPosX = ItemAngelTempleData.GetIntValue("BossPosX", -1); this.m_AngelTempleData.BossPosY = ItemAngelTempleData.GetIntValue("BossPosY", -1); }
public static void UpdateRoleAttr(GameClient client, int weaponType, bool needBrocast = false) { try { List <WeaponMaster.WeaponMasterItem> weaponMasterList; if (WeaponMaster.WeaponMasterXml.TryGetValue(weaponType, out weaponMasterList)) { int begin = 11; int end = 21; List <int> equipHandleList = new List <int>(); foreach (GoodsData _g in client.ClientData.GoodsDataList) { if (_g.Using == 1) { int cateGoriy = -1; SystemXmlItem systemGoods = null; if (GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(_g.GoodsID, out systemGoods)) { cateGoriy = systemGoods.GetIntValue("Categoriy", -1); } if (cateGoriy >= begin && cateGoriy <= end) { equipHandleList.Add(cateGoriy); } } } if (equipHandleList.Count >= 1 && equipHandleList.Count <= 2) { WeaponMaster.WeaponMasterItem weaponItem = null; foreach (WeaponMaster.WeaponMasterItem _w in weaponMasterList) { if (WeaponMaster.WeaponIsMatch(_w.WeaponType1, _w.WeaponType2, equipHandleList) || WeaponMaster.WeaponIsMatch(_w.WeaponType2, _w.WeaponType1, equipHandleList)) { weaponItem = _w; break; } } double[] ExtProps = (weaponItem == null) ? new double[177] : weaponItem.ExtProps; client.ClientData.PropsCacheManager.SetExtProps(new object[] { PropsSystemTypes.WeaponMaster, ExtProps }); if (needBrocast) { GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7); } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, string.Format("WeaponMaster :: 更新角色武器大师属性加成:{0}, 失败。", new object[0]), ex, true); } }
public bool TryGetValue(int intKey, out SystemXmlItem systemMagic) { bool result; lock (this._MagicItemsDict) { result = this._MagicItemsDict.TryGetValue(intKey, out systemMagic); } return(result); }
/// <summary> /// 加载魔法的职业/级别/技能ID索引 /// </summary> /// <param name="systemMagicMgr"></param> public void LoadMagicItemsDict(SystemXmlItems systemMagicMgr) { foreach (var key in systemMagicMgr.SystemXmlItemDict.Keys) { SystemXmlItem systemMagic = systemMagicMgr.SystemXmlItemDict[key]; int intKey = systemMagic.GetIntValue("ID"); _MagicItemsDict[intKey] = systemMagic; } }
/// <summary> /// 解析任务奖励 /// </summary> /// <param name="systemTask"></param> private void ParseAwards(SystemXmlItem systemTask, out List <AwardsItemData> taskAwardsList, out List <AwardsItemData> otherAwardsList) { taskAwardsList = otherAwardsList = null; AwardsItemData awardsItem = null; string taskAwardsString = systemTask.GetStringValue("Taskaward").Trim(); if (!string.IsNullOrEmpty(taskAwardsString)) { string[] taskAwardsFields = taskAwardsString.Split('|'); if (null != taskAwardsFields) { taskAwardsList = new List <AwardsItemData>(); for (int i = 0; i < taskAwardsFields.Length; i++) { // 解析任务装备奖励 awardsItem = null; ParseTaskAwardsItem(taskAwardsFields[i], out awardsItem); if (null != awardsItem) { taskAwardsList.Add(awardsItem); } else { LogManager.WriteLog(LogTypes.Error, string.Format("解析任务装备奖励失败: TaskID={0}", systemTask.GetIntValue("ID"))); } } } } string goodsEndTime = systemTask.GetStringValue("GoodsEndTime").Trim(); string otherAwardsString = systemTask.GetStringValue("OtherTaskaward").Trim(); if (!string.IsNullOrEmpty(otherAwardsString)) { string[] otherAwardsFields = otherAwardsString.Split('|'); if (null != otherAwardsFields) { otherAwardsList = new List <AwardsItemData>(); for (int i = 0; i < otherAwardsFields.Length; i++) { // 解析任务装备奖励 awardsItem = null; ParseOtherAwardsItem(otherAwardsFields[i], out awardsItem, goodsEndTime); if (null != awardsItem) { otherAwardsList.Add(awardsItem); } else { LogManager.WriteLog(LogTypes.Error, string.Format("解析任务其他奖励失败: TaskID={0}", systemTask.GetIntValue("ID"))); } } } } }
/// <summary> /// 更换婚戒属性 /// </summary> public MarryOtherResult ChangeRing(GameClient client, int nRingID) { //结婚给戒指不会走该函数 所以不存在扣费用和婚戒id为-1的情况 //看看是不是结婚了 if (-1 == client.ClientData.MyMarriageData.byMarrytype) { return(MarryOtherResult.NotMarriaged); } //不是下一等级戒指 if (nRingID - client.ClientData.MyMarriageData.nRingID != 1) { return(MarryOtherResult.NotNexRise); } SystemXmlItem RingXmlItem = null; if (false == WeddingRingDic.SystemXmlItemDict.TryGetValue(nRingID, out RingXmlItem) || null == RingXmlItem) { return(MarryOtherResult.NotRing); } SystemXmlItem NowRingXmlItem = null; if (false == WeddingRingDic.SystemXmlItemDict.TryGetValue(client.ClientData.MyMarriageData.nRingID, out NowRingXmlItem) || null == NowRingXmlItem) { return(MarryOtherResult.NotRing); } //策划修改为直接扣除婚戒差价 int nCostGam = RingXmlItem.GetIntValue("NeedZuanShi"); int nBeforeCostGam = NowRingXmlItem.GetIntValue("NeedZuanShi"); int chajia = nCostGam - nBeforeCostGam; if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, chajia, "更换婚戒扣除")) { return(MarryOtherResult.NeedGam); } //都好了更换婚戒 client.ClientData.MyMarriageData.nRingID = nRingID; //更新婚戒属性 UpdateRingAttr(client, true); MarryFuBenMgr.UpdateMarriageData2DB(client); //发送给客户端更新数据 SendMarriageDataToClient(client, true); return(MarryOtherResult.Success); }
/// <summary> /// 解析Xml项 /// </summary> /// <param name="systemXmlItem"></param> private static void ParseXmlItem(SystemXmlItem systemXmlItem, List <BroadcastInfoItem> broadcastInfoItemList) { int id = systemXmlItem.GetIntValue("ID"); int infoClass = systemXmlItem.GetIntValue("InfoClass"); int hintErrID = systemXmlItem.GetIntValue("HintErrID"); int timeType = systemXmlItem.GetIntValue("TimeType"); int kaiFuStartDay = systemXmlItem.GetIntValue("StartDay"); int kaiFuShowType = systemXmlItem.GetIntValue("ShowType"); string weekDays = systemXmlItem.GetStringValue("WeekDays"); string times = systemXmlItem.GetStringValue("Times"); string text = systemXmlItem.GetStringValue("Text"); string onlineNotice = systemXmlItem.GetStringValue("OnlineNotice"); int minZhuanSheng = systemXmlItem.GetIntValue("MinZhuanSheng"); int minLevel = systemXmlItem.GetIntValue("MinLevel"); if (string.IsNullOrEmpty(times)) { LogManager.WriteLog(LogTypes.Error, string.Format("解析广播配置表中的时间项失败, ID={0}", id)); return; } BroadcastTimeItem[] broadcastTimeItemArray = ParseBroadcastTimeItems(times); if (null == broadcastTimeItemArray) { LogManager.WriteLog(LogTypes.Error, string.Format("解析广播配置表中的时间项为数组时失败, ID={0}", id)); return; } if (string.IsNullOrEmpty(text)) { LogManager.WriteLog(LogTypes.Error, string.Format("解析广播配置表中的时间项失败, ID={0}", id)); return; } DateTimeRange[] onlineNoticeTimeRanges = Global.ParseDateTimeRangeStr(onlineNotice); BroadcastInfoItem broadcastInfoItem = new BroadcastInfoItem() { ID = id, InfoClass = infoClass, HintErrID = hintErrID, TimeType = timeType, KaiFuStartDay = kaiFuStartDay, KaiFuShowType = kaiFuShowType, WeekDays = weekDays, Times = broadcastTimeItemArray, OnlineNoticeTimeRanges = onlineNoticeTimeRanges, Text = text.Replace(":", ""), //防止出现半角的冒号 MinZhuanSheng = minZhuanSheng, MinLevel = minLevel, }; broadcastInfoItemList.Add(broadcastInfoItem); }
/// <summary> /// 获取指定任务编号的任务名称 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public static string GetTaskName(int taskId) { //修改目标NPC的状态 SystemXmlItem systemTask = null; if (!GameManager.SystemTasksMgr.SystemXmlItemDict.TryGetValue(taskId, out systemTask)) { return(taskId.ToString()); } return(systemTask.GetStringValue("Title")); }
public void LoadMagicItemsDict(SystemXmlItems systemMagicMgr) { lock (this._MagicItemsDict) { foreach (int key in systemMagicMgr.SystemXmlItemDict.Keys) { SystemXmlItem systemMagic = systemMagicMgr.SystemXmlItemDict[key]; int intKey = systemMagic.GetIntValue("ID", -1); this._MagicItemsDict[intKey] = systemMagic; } } }
public void LoadGoodsItemsDict(SystemXmlItems systemGoodsMgr) { Dictionary <string, SystemXmlItem> goodsItemsDict = new Dictionary <string, SystemXmlItem>(); foreach (int key in systemGoodsMgr.SystemXmlItemDict.Keys) { SystemXmlItem systemGoods = systemGoodsMgr.SystemXmlItemDict[key]; string strKey = systemGoods.GetStringValue("Title"); goodsItemsDict[strKey] = systemGoods; } this._GoodsItemsDict = goodsItemsDict; }
/// <summary> /// 从缓存中读取坐骑强化项 /// </summary> /// <param name="level"></param> /// <param name="extIndex"></param> /// <returns></returns> public static SystemXmlItem GetHorseEnchanceItem(int level, HorseExtIndexes extIndex) { string key = string.Format("{0}_{1}", level, XmlItemNames[(int)extIndex]); SystemXmlItem systemHorseEnchanceItem = null; if (!HorseItemsDict.TryGetValue(key, out systemHorseEnchanceItem)) { return(null); } return(systemHorseEnchanceItem); }