public static void ParseExtprops(double[] extProps, string str, string splitChars = "|,") { try { string[] valueFileds = str.Split(new char[] { splitChars[0] }); foreach (string value in valueFileds) { string[] KvpFileds = value.Split(new char[] { ',' }); if (KvpFileds.Length == 2) { ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]); if (index < ExtPropIndexes.Max) { extProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]); } } } } catch (Exception ex) { LogManager.WriteException(ex.ToString()); throw ex; } }
static ConfigParser() { for (ExtPropIndexes i = ExtPropIndexes.Strong; i < ExtPropIndexes.Max; i++) { ConfigParser.ExtPropName2ExtPropIndexDict[i.ToString()] = i; } }
public static double GetExtProp(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsIndex) { int[] goodsIds = AdvanceBufferPropsMgr.GetCachingIDsByID((int)bufferItemType); double result; if (null == goodsIds) { result = 0.0; } else if (goodsIndex < 0 || goodsIndex >= goodsIds.Length) { result = 0.0; } else { int goodsID = goodsIds[goodsIndex]; EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID); if (null == item) { result = 0.0; } else { result = item.ExtProps[(int)extPropIndexe]; } } return(result); }
/// <summary> /// 静态构造函数 /// </summary> static ConfigParser() { for (ExtPropIndexes i = (ExtPropIndexes)0; i < ExtPropIndexes.Max; i++) { ExtPropName2ExtPropIndexDict[i.ToString()] = i; } }
/// <summary> /// 获取扩展属性接口 /// </summary> /// <param name="bufferItemType"></param> /// <param name="extPropIndexe"></param> /// <returns></returns> public static double GetExtPropByGoodsID(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsID) { EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID); if (null == item) { return(0.0); } return(item.ExtProps[(int)extPropIndexe]); }
public static void ParseXiLianShuXing(XElement node) { XiLianShuXing xiLianShuXing = new XiLianShuXing(); xiLianShuXing.ID = (int)Global.GetSafeAttributeLong(node, "ID"); xiLianShuXing.Name = Global.GetSafeAttributeStr(node, "Name"); xiLianShuXing.NeedJinBi = (int)Global.GetSafeAttributeLong(node, "NeedJinBi"); xiLianShuXing.NeedZuanShi = (int)Global.GetSafeAttributeLong(node, "NeedZuanShi"); long[] args = Global.GetSafeAttributeLongArray(node, "NeedGoods", 2); if (null != args) { xiLianShuXing.NeedGoodsIDs.Add((int)args[0]); xiLianShuXing.NeedGoodsCounts.Add((int)args[1]); } foreach (var propsID in PropsIds) { string attributeName; ExtPropIndexes propIndex = (ExtPropIndexes)propsID; attributeName = string.Format("JinBi{0}", propIndex.ToString()); args = Global.GetSafeAttributeLongArray(node, attributeName); if (null != args && args.Length > 0) { xiLianShuXing.PromoteJinBiRange.Add(propsID, new List <long>(args)); } attributeName = string.Format("ZuanShi{0}", propIndex.ToString()); args = Global.GetSafeAttributeLongArray(node, attributeName); if (null != args && args.Length > 0) { xiLianShuXing.PromoteZuanShiRange.Add(propsID, new List <long>(args)); } xiLianShuXing.PromotePropLimit.Add((int)propIndex, (int)Global.GetSafeAttributeLong(node, propIndex.ToString())); } XiLianShuXingDict.Add(xiLianShuXing.ID, xiLianShuXing); }
/// <summary> /// 获取扩展属性接口 /// </summary> /// <param name="bufferItemType"></param> /// <param name="extPropIndexe"></param> /// <returns></returns> public static double GetExtProp(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsIndex) { /// 根据BufferID获取缓存的物品ID列表 int[] goodsIds = GetCachingIDsByID((int)bufferItemType); if (null == goodsIds) { return(0.0); } if (goodsIndex < 0 || goodsIndex >= goodsIds.Length) { return(0.0); } int goodsID = goodsIds[goodsIndex]; EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID); if (null == item) { return(0.0); } return(item.ExtProps[(int)extPropIndexe]); }
private ShenJiFuWenEffectData ParseShenJiFuWenEffectData(XElement xmlItem, string Key) { string TempValueString = Global.GetSafeAttributeStr(xmlItem, string.Format("Effect{0}", Key)); string[] ValueFileds = TempValueString.Split(new char[] { '|' }); ShenJiFuWenEffectData result; if (ValueFileds.Length == 0) { result = null; } else { ShenJiFuWenEffectData data = new ShenJiFuWenEffectData(); foreach (string value in ValueFileds) { string[] KvpFileds = value.Split(new char[] { ',' }); if (KvpFileds.Length == 2) { ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]); if (index != ExtPropIndexes.Max) { data.ExtProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]); } } } result = data; } return(result); }
public static double GetNegativeRate(IObject self, IObject obj, double baseRate, ExtPropIndexes extPropIndex, MagicActionIDs actionId) { int selfZhuanSheng = 0; if (self is GameClient) { selfZhuanSheng = (self as GameClient).ClientData.ChangeLifeCount; baseRate = RoleAlgorithm.GetRoleNegativeRate(self as GameClient, baseRate, extPropIndex); } else if (self is Monster) { selfZhuanSheng = (self as Monster).MonsterInfo.ChangeLifeCount; } int objZhuanSheng = 0; if (obj is GameClient) { if ((obj as GameClient).buffManager.IsBuffEnabled(116)) { return(0.0); } if (actionId != MagicActionIDs.MU_ADD_JITUI && (obj as GameClient).buffManager.IsBuffEnabled(113)) { return(0.0); } if (CaiJiLogic.IsCaiJiState(obj as GameClient) && (extPropIndex == ExtPropIndexes.StateDingShen || extPropIndex == ExtPropIndexes.StateMoveSpeed || extPropIndex == ExtPropIndexes.StateJiTui || extPropIndex == ExtPropIndexes.StateHunMi)) { return(0.0); } objZhuanSheng = (obj as GameClient).ClientData.ChangeLifeCount; } else if (obj is Monster) { objZhuanSheng = (obj as Monster).MonsterInfo.ChangeLifeCount; } else if (obj is FakeRoleItem) { objZhuanSheng = (obj as FakeRoleItem).GetFakeRoleData().MyRoleDataMini.ChangeLifeCount; } double result; if (selfZhuanSheng > objZhuanSheng) { result = baseRate + 0.1 * Math.Pow((double)(selfZhuanSheng - objZhuanSheng), 2.0); } else { result = baseRate - 0.1 * Math.Pow((double)(selfZhuanSheng - objZhuanSheng), 2.0); } return(result); }
public void LoadAwakenLevelXml() { string fileName = ""; try { fileName = Global.GameResPath(JueXingConsts.AwakenLevel); XElement xml = CheckHelper.LoadXml(fileName, true); if (null != xml) { Dictionary <int, AwakenLevelItem> awakenLevelDict = new Dictionary <int, AwakenLevelItem>(); IEnumerable <XElement> nodes = xml.Elements(); double[] extProps = new double[177]; foreach (XElement xmlItem in nodes) { if (xmlItem != null) { int id = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0")); string tempValueString = Global.GetSafeAttributeStr(xmlItem, "AdvancedEffect"); string[] valueFileds = tempValueString.Split(new char[] { '|' }); if (valueFileds.Length > 0) { foreach (string value in valueFileds) { string[] KvpFileds = value.Split(new char[] { ',' }); if (KvpFileds.Length == 2) { ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]); if (index < ExtPropIndexes.Max) { extProps[(int)index] += Global.SafeConvertToDouble(KvpFileds[1]); } } } } awakenLevelDict[id] = new AwakenLevelItem { ID = id, Order = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Order", "0")), Star = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Star", "0")), Awakenment = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Awakenment", "0")), AwakenAdvancedment = Global.GetDefAttributeStr(xmlItem, "AwakenAdvancedment", "0"), EnlargeRate = Convert.ToDouble(Global.GetDefAttributeStr(xmlItem, "EnlargeRate", "0")), ExtProps = (double[])extProps.Clone() }; } } lock (this.JueXingRunTimeData.Mutex) { this.JueXingRunTimeData.AwakenLevelDict = awakenLevelDict; } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true); } }
public void LoadAwakenSuitXml() { string fileName = ""; try { fileName = Global.GameResPath(JueXingConsts.AwakenSuit); XElement xml = CheckHelper.LoadXml(fileName, true); if (null != xml) { Dictionary <int, TaoZhuang> taoZhuangDict = new Dictionary <int, TaoZhuang>(); IEnumerable <XElement> nodes = xml.Elements(); foreach (XElement xmlItem in nodes) { if (xmlItem != null) { int id = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0")); string tempValueString = Global.GetSafeAttributeStr(xmlItem, "TaoZhuangProps1"); string[] valueFileds = tempValueString.Split(new char[] { '|' }); double[] extProps = new double[177]; foreach (string value in valueFileds) { string[] KvpFileds = value.Split(new char[] { ',' }); if (KvpFileds.Length == 2) { ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]); if (index < ExtPropIndexes.Max) { extProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]); } } } tempValueString = Global.GetSafeAttributeStr(xmlItem, "TaoZhuangProps2"); valueFileds = tempValueString.Split(new char[] { '|' }); double[] extProps2 = new double[177]; foreach (string value in valueFileds) { string[] KvpFileds = value.Split(new char[] { ',' }); if (KvpFileds.Length == 2) { ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]); if (index < ExtPropIndexes.Max) { extProps2[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]); } } } tempValueString = Global.GetSafeAttributeStr(xmlItem, "TaoZhuangProps3"); valueFileds = tempValueString.Split(new char[] { '|' }); double[] extProps3 = new double[177]; foreach (string value in valueFileds) { string[] KvpFileds = value.Split(new char[] { ',' }); if (KvpFileds.Length == 2) { ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]); if (index < ExtPropIndexes.Max) { extProps3[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]); } } } string[] weaponStr = Global.GetDefAttributeStr(xmlItem, "WeaponMaster", "").Split(new char[] { ',' }); int weaponNum = 0; int weaponType = 0; if (weaponStr.Length > 1) { weaponNum = Convert.ToInt32(weaponStr[0]); weaponType = Convert.ToInt32(weaponStr[1]); } List <List <int> > passiveSkill = new List <List <int> >(); string[] passiveSkillList = Global.GetDefAttributeStr(xmlItem, "Magic", "").Split(new char[] { '|' }); foreach (string one in passiveSkillList) { if (!string.IsNullOrEmpty(one)) { string[] skillItem = one.Split(new char[] { ',' }); if (skillItem.Length > 1) { passiveSkill.Add(Array.ConvertAll <string, int>(skillItem, (string x) => Convert.ToInt32(x)).ToList <int>()); } } } List <List <int> > passiveEffect = new List <List <int> >(); string[] passiveEffectList = Global.GetDefAttributeStr(xmlItem, "PassiveEffect", "").Split(new char[] { '|' }); foreach (string one in passiveEffectList) { if (!string.IsNullOrEmpty(one)) { string[] passiveItem = one.Split(new char[] { ',' }); if (passiveItem.Length > 1) { passiveEffect.Add(Array.ConvertAll <string, int>(passiveItem, (string x) => Convert.ToInt32(x)).ToList <int>()); } } } Dictionary <int, TaoZhuang> dictionary = taoZhuangDict; int key = id; TaoZhuang taoZhuang = new TaoZhuang(); taoZhuang.ID = id; taoZhuang.Type = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Type", "0")); taoZhuang.AwakenList = Array.ConvertAll <string, int>(Global.GetDefAttributeStr(xmlItem, "AwakenID", "").Split(new char[] { ',' }), (string x) => Convert.ToInt32(x)).ToList <int>(); taoZhuang.TaoZhuangProps1Num = Global.SafeConvertToInt32(Global.GetDefAttributeStr(xmlItem, "TaoZhuangProps1Num", "0")); taoZhuang.TaoZhuangProps1 = extProps; taoZhuang.TaoZhuangProps2Num = Global.SafeConvertToInt32(Global.GetDefAttributeStr(xmlItem, "TaoZhuangProps2Num", "0")); taoZhuang.TaoZhuangProps2 = extProps2; taoZhuang.TaoZhuangProps3Num = Global.SafeConvertToInt32(Global.GetDefAttributeStr(xmlItem, "TaoZhuangProps3Num", "0")); taoZhuang.TaoZhuangProps3 = extProps3; taoZhuang.WeaponMasterNum = weaponNum; taoZhuang.WeaponMasterType = weaponType; taoZhuang.PassiveSkill = passiveSkill; taoZhuang.PassiveEffect = passiveEffect; dictionary[key] = taoZhuang; } } lock (this.JueXingRunTimeData.Mutex) { this.JueXingRunTimeData.TaoZhuangDict = taoZhuangDict; foreach (TaoZhuang item in taoZhuangDict.Values) { foreach (int id in item.AwakenList) { if (this.JueXingRunTimeData.JueXingShiDict.ContainsKey(id)) { this.JueXingRunTimeData.JueXingShiDict[id].SuitParent = item.ID; } } } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true); } }
public void LoadAwakenActivationXml() { string fileName = ""; try { fileName = Global.GameResPath(JueXingConsts.AwakenActivation); XElement xml = CheckHelper.LoadXml(fileName, true); if (null != xml) { Dictionary <int, JueXingShiItem> jueXingShiDict = new Dictionary <int, JueXingShiItem>(); IEnumerable <XElement> nodes = xml.Elements(); foreach (XElement xmlItem in nodes) { if (xmlItem != null) { int id = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0")); int[] material = Array.ConvertAll <string, int>(Global.GetDefAttributeStr(xmlItem, "Material", "").Split(new char[] { ',' }), (string x) => Convert.ToInt32(x)); if (material.Length < 2) { LogManager.WriteLog(LogTypes.Error, string.Format("加载xml配置文件:{0}, 错误。", fileName), null, true); } else { string tempValueString = Global.GetSafeAttributeStr(xmlItem, "BaseProps"); string[] valueFileds = tempValueString.Split(new char[] { '|' }); double[] extProps = new double[177]; foreach (string value in valueFileds) { string[] KvpFileds = value.Split(new char[] { ',' }); if (KvpFileds.Length == 2) { ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]); if (index < ExtPropIndexes.Max) { extProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]); } } } jueXingShiDict[id] = new JueXingShiItem { ID = id, Position = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Position", "0")), NeedGoodsID = material[0], NeedGoodsNum = material[1], ExtProps = extProps }; lock (this.JueXingRunTimeData.Mutex) { this.JueXingRunTimeData.JueXingShiDict = jueXingShiDict; } } } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true); } }
//属性更新 private void ProcessAction(GameClient client, MagicActionIDs id, double[] actionParams, int nPropsSystemTypes, sbyte sShengWu_slot, sbyte sBuJian_slot) { switch (id) { case MagicActionIDs.POTION: //药水效果:Potion,百分比 药水:GoodsID=1010、1011、1012、1013、1110、1111 效果:基础效果(1+ X.X) case MagicActionIDs.HOLYWATER: //圣水效果:HolyWater,百分比 圣水:GoodsID=1000、1001、1002、1100、1101、1102 效果:基础效果(1+ X.X) case MagicActionIDs.RECOVERLIFEV: //自动恢复生命效果:RecoverLifeV,百分比 效果:基础恢复生命效果*(1+X.X) case MagicActionIDs.ADDDEFENSE: case MagicActionIDs.ADDATTACK: //对应SystemMagicAction属性枚举 case MagicActionIDs.FATALHURT: //卓越伤害加成:FatalHurt,百分比 效果:卓越一击伤害加成*(1+X.X) case MagicActionIDs.HITV: case MagicActionIDs.ADDATTACKINJURE: case MagicActionIDs.LIFESTEAL: //击中恢复效果:LifeStealV,固定值 效果:击中恢复生命+XX case MagicActionIDs.DAMAGETHORN: case MagicActionIDs.COUNTERACTINJUREVALUE: case MagicActionIDs.DODGE: case MagicActionIDs.MAXLIFEPERCENT: case MagicActionIDs.AddAttackPercent: case MagicActionIDs.AddDefensePercent: //case MagicActionIDs.RECOVERMAGICV: //自动恢复魔法效果:RecoverMagicV,百分比 效果:基础恢复魔法效果+X.X //case MagicActionIDs.LIFESTEALPERCENT: //击中恢复效果:LifeStealPercent,百分比 效果:击中恢复生命*(1+X.X) { ExtPropIndexes eExtProp = ExtPropIndexes.Max; switch (id) { case MagicActionIDs.AddAttackPercent: eExtProp = ExtPropIndexes.AddAttackPercent; break; case MagicActionIDs.AddDefensePercent: eExtProp = ExtPropIndexes.AddDefensePercent; break; case MagicActionIDs.MAXLIFEPERCENT: eExtProp = ExtPropIndexes.MaxLifePercent; break; case MagicActionIDs.POTION: eExtProp = ExtPropIndexes.Potion; break; case MagicActionIDs.HOLYWATER: eExtProp = ExtPropIndexes.Holywater; break; case MagicActionIDs.RECOVERLIFEV: eExtProp = ExtPropIndexes.RecoverLifeV; break; //case MagicActionIDs.RECOVERMAGICV: // eExtProp = ExtPropIndexes.RecoverMagicV; // break; case MagicActionIDs.LIFESTEAL: eExtProp = ExtPropIndexes.LifeSteal; break; //case MagicActionIDs.LIFESTEALPERCENT: // eExtProp = ExtPropIndexes.LifeStealPercent; // break; case MagicActionIDs.FATALHURT: eExtProp = ExtPropIndexes.Fatalhurt; break; case MagicActionIDs.ADDATTACK: eExtProp = ExtPropIndexes.AddAttack; break; case MagicActionIDs.ADDATTACKINJURE: eExtProp = ExtPropIndexes.AddAttackInjure; break; case MagicActionIDs.HITV: eExtProp = ExtPropIndexes.HitV; break; case MagicActionIDs.ADDDEFENSE: eExtProp = ExtPropIndexes.AddDefense; break; case MagicActionIDs.COUNTERACTINJUREVALUE: eExtProp = ExtPropIndexes.CounteractInjureValue; break; case MagicActionIDs.DAMAGETHORN: eExtProp = ExtPropIndexes.DamageThorn; break; case MagicActionIDs.DODGE: eExtProp = ExtPropIndexes.Dodge; break; } if (eExtProp == ExtPropIndexes.Max) { break; } client.ClientData.PropsCacheManager.SetExtPropsSingle(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, 1000, (int)eExtProp, actionParams[0]); } break; case MagicActionIDs.CONSTITUTION: client.ClientData.PropsCacheManager.SetBaseProps(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, (int)UnitPropIndexes.Constitution, new double[] { 0.0d, 0.0d, 0.0d, actionParams[0] }); break; case MagicActionIDs.DEXTERITY: client.ClientData.PropsCacheManager.SetBaseProps(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, (int)UnitPropIndexes.Dexterity, new double[] { 0.0d, 0.0d, actionParams[0], 0.0d }); break; case MagicActionIDs.INTELLIGENCE: client.ClientData.PropsCacheManager.SetBaseProps(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, (int)UnitPropIndexes.Intelligence, new double[] { 0.0d, actionParams[0], 0.0d, 0.0d }); break; case MagicActionIDs.STRENGTH: client.ClientData.PropsCacheManager.SetBaseProps(nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, (int)UnitPropIndexes.Strength, new double[] { actionParams[0], 0.0d, 0.0d, 0.0d }); break; } }
/// <summary> /// 解析通用的扩展属性加成配置,目前需要扩展属性 /// </summary> /// <param name="str"></param> /// <param name="verifyColumn"></param> /// <param name="splitChar1"></param> /// <param name="splitChar2"></param> public static EquipPropItem ParseEquipPropItem(string str, bool verifyColumn = true, char splitChar1 = '|', char splitChar2 = ',', char splitChar3 = '-') { EquipPropItem equipPropItem = new EquipPropItem(); if (!string.IsNullOrEmpty(str)) { string[] propertyConfigArray = str.Split(splitChar1); foreach (var propertyConfigItem in propertyConfigArray) { string[] nameValueArray = propertyConfigItem.Split(splitChar2); if (nameValueArray.Length == 2) { ExtPropIndexes propIndex = ConfigParser.GetPropIndexByPropName(nameValueArray[0]); if (propIndex < ExtPropIndexes.Max) { double propValue; if (double.TryParse(nameValueArray[1], out propValue)) { equipPropItem.ExtProps[(int)propIndex] = propValue; } } else { //其他特殊配置类型 int propIndex0 = -1; int propIndex1 = -1; switch (nameValueArray[0]) { case "Attack": { propIndex0 = (int)ExtPropIndexes.MinAttack; propIndex1 = (int)ExtPropIndexes.MaxAttack; } break; case "Mattack": { propIndex0 = (int)ExtPropIndexes.MinMAttack; propIndex1 = (int)ExtPropIndexes.MaxMAttack; } break; case "Defense": { propIndex0 = (int)ExtPropIndexes.MinDefense; propIndex1 = (int)ExtPropIndexes.MaxDefense; } break; case "Mdefense": { propIndex0 = (int)ExtPropIndexes.MinMDefense; propIndex1 = (int)ExtPropIndexes.MaxMDefense; } break; } string[] valueArray = nameValueArray[1].Split(splitChar3); double propValue; if (propIndex0 >= 0 && double.TryParse(valueArray[0], out propValue)) { equipPropItem.ExtProps[propIndex0] = propValue; } if (propIndex1 >= 0 && double.TryParse(valueArray[1], out propValue)) { equipPropItem.ExtProps[propIndex1] = propValue; } } } } } return(equipPropItem); }
public static void LoadWeaponMaster() { string fileName = "Config\\WeaponMaster.xml"; try { fileName = Global.GameResPath(fileName); XElement xml = CheckHelper.LoadXml(fileName, true); if (null != xml) { IEnumerable <XElement> nodes = xml.Elements(); foreach (XElement xmlItem in nodes) { if (xmlItem != null) { int type = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Type", "0")); List <WeaponMaster.WeaponMasterItem> weaponMasterList; if (!WeaponMaster.WeaponMasterXml.TryGetValue(type, out weaponMasterList)) { weaponMasterList = new List <WeaponMaster.WeaponMasterItem>(); WeaponMaster.WeaponMasterXml[type] = weaponMasterList; } string weaponType = Global.GetDefAttributeStr(xmlItem, "WeaponType1", ""); string weaponType2 = Global.GetDefAttributeStr(xmlItem, "WeaponType2", ""); string tempValueString = Global.GetSafeAttributeStr(xmlItem, "WeaponMasterProps"); string[] valueFileds = tempValueString.Split(new char[] { '|' }); double[] extProps = new double[177]; foreach (string value in valueFileds) { string[] KvpFileds = value.Split(new char[] { ',' }); if (KvpFileds.Length == 2) { ExtPropIndexes index = ConfigParser.GetPropIndexByPropName(KvpFileds[0]); if (index < ExtPropIndexes.Max) { extProps[(int)index] = Global.SafeConvertToDouble(KvpFileds[1]); } } } List <WeaponMaster.WeaponMasterItem> list = weaponMasterList; WeaponMaster.WeaponMasterItem weaponMasterItem = new WeaponMaster.WeaponMasterItem(); WeaponMaster.WeaponMasterItem weaponMasterItem2 = weaponMasterItem; List <int> weaponType3; if (!("" == weaponType)) { weaponType3 = Array.ConvertAll <string, int>(weaponType.Split(new char[] { ',' }), (string x) => Convert.ToInt32(x)).ToList <int>(); } else { weaponType3 = new List <int>(); } weaponMasterItem2.WeaponType1 = weaponType3; WeaponMaster.WeaponMasterItem weaponMasterItem3 = weaponMasterItem; List <int> weaponType4; if (!("" == weaponType2)) { weaponType4 = Array.ConvertAll <string, int>(weaponType2.Split(new char[] { ',' }), (string x) => Convert.ToInt32(x)).ToList <int>(); } else { weaponType4 = new List <int>(); } weaponMasterItem3.WeaponType2 = weaponType4; weaponMasterItem.ExtProps = extProps; list.Add(weaponMasterItem); } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex, true); } }
private void ProcessAction(GameClient client, MagicActionIDs id, double[] actionParams, int nPropsSystemTypes, sbyte sShengWu_slot, sbyte sBuJian_slot) { switch (id) { case MagicActionIDs.POTION: case MagicActionIDs.HOLYWATER: case MagicActionIDs.RECOVERLIFEV: case MagicActionIDs.LIFESTEAL: case MagicActionIDs.FATALHURT: case MagicActionIDs.ADDATTACK: case MagicActionIDs.ADDATTACKINJURE: case MagicActionIDs.HITV: case MagicActionIDs.ADDDEFENSE: case MagicActionIDs.COUNTERACTINJUREVALUE: case MagicActionIDs.DAMAGETHORN: case MagicActionIDs.DODGE: case MagicActionIDs.MAXLIFEPERCENT: case MagicActionIDs.AddAttackPercent: case MagicActionIDs.AddDefensePercent: case MagicActionIDs.HitPercent: { ExtPropIndexes eExtProp = ExtPropIndexes.Max; switch (id) { case MagicActionIDs.POTION: eExtProp = ExtPropIndexes.Potion; break; case MagicActionIDs.HOLYWATER: eExtProp = ExtPropIndexes.Holywater; break; case MagicActionIDs.RECOVERLIFEV: eExtProp = ExtPropIndexes.RecoverLifeV; break; case MagicActionIDs.LIFESTEAL: eExtProp = ExtPropIndexes.LifeSteal; break; case MagicActionIDs.FATALHURT: eExtProp = ExtPropIndexes.Fatalhurt; break; case MagicActionIDs.ADDATTACK: eExtProp = ExtPropIndexes.AddAttack; break; case MagicActionIDs.ADDATTACKINJURE: eExtProp = ExtPropIndexes.AddAttackInjure; break; case MagicActionIDs.HITV: eExtProp = ExtPropIndexes.HitV; break; case MagicActionIDs.ADDDEFENSE: eExtProp = ExtPropIndexes.AddDefense; break; case MagicActionIDs.COUNTERACTINJUREVALUE: eExtProp = ExtPropIndexes.CounteractInjureValue; break; case MagicActionIDs.DAMAGETHORN: eExtProp = ExtPropIndexes.DamageThorn; break; case MagicActionIDs.DODGE: eExtProp = ExtPropIndexes.Dodge; break; case MagicActionIDs.MAXLIFEPERCENT: eExtProp = ExtPropIndexes.MaxLifePercent; break; case MagicActionIDs.AddAttackPercent: eExtProp = ExtPropIndexes.AddAttackPercent; break; case MagicActionIDs.AddDefensePercent: eExtProp = ExtPropIndexes.AddDefensePercent; break; case MagicActionIDs.HitPercent: eExtProp = ExtPropIndexes.HitPercent; break; } if (eExtProp != ExtPropIndexes.Max) { client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, 1000, (int)eExtProp, actionParams[0] }); } break; } case MagicActionIDs.STRENGTH: { PropsCacheManager propsCacheManager = client.ClientData.PropsCacheManager; object[] array = new object[5]; array[0] = nPropsSystemTypes; array[1] = (int)sShengWu_slot; array[2] = (int)sBuJian_slot; array[3] = 0; object[] array2 = array; int num = 4; double[] array3 = new double[4]; array3[0] = actionParams[0]; array2[num] = array3; propsCacheManager.SetBaseProps(array); break; } case MagicActionIDs.CONSTITUTION: client.ClientData.PropsCacheManager.SetBaseProps(new object[] { nPropsSystemTypes, (int)sShengWu_slot, (int)sBuJian_slot, 3, new double[] { 0.0, 0.0, 0.0, actionParams[0] } }); break; case MagicActionIDs.DEXTERITY: { PropsCacheManager propsCacheManager2 = client.ClientData.PropsCacheManager; object[] array = new object[5]; array[0] = nPropsSystemTypes; array[1] = (int)sShengWu_slot; array[2] = (int)sBuJian_slot; array[3] = 2; object[] array4 = array; int num2 = 4; double[] array3 = new double[4]; array3[2] = actionParams[0]; array4[num2] = array3; propsCacheManager2.SetBaseProps(array); break; } case MagicActionIDs.INTELLIGENCE: { PropsCacheManager propsCacheManager3 = client.ClientData.PropsCacheManager; object[] array = new object[5]; array[0] = nPropsSystemTypes; array[1] = (int)sShengWu_slot; array[2] = (int)sBuJian_slot; array[3] = 1; object[] array5 = array; int num3 = 4; double[] array3 = new double[4]; array3[1] = actionParams[0]; array5[num3] = array3; propsCacheManager3.SetBaseProps(array); break; } } }
public static EquipPropItem ParseEquipPropItem(string str, bool verifyColumn = true, char splitChar1 = '|', char splitChar2 = ',', char splitChar3 = '-') { EquipPropItem equipPropItem = new EquipPropItem(); if (!string.IsNullOrEmpty(str)) { string[] propertyConfigArray = str.Split(new char[] { splitChar1 }); foreach (string propertyConfigItem in propertyConfigArray) { string[] nameValueArray = propertyConfigItem.Split(new char[] { splitChar2 }); if (nameValueArray.Length == 2) { ExtPropIndexes propIndex = ConfigParser.GetPropIndexByPropName(nameValueArray[0]); if (propIndex < ExtPropIndexes.Max) { double propValue; if (double.TryParse(nameValueArray[1], out propValue)) { equipPropItem.ExtProps[(int)propIndex] = propValue; } } else { int propIndex2 = -1; int propIndex3 = -1; string text = nameValueArray[0]; if (text != null) { if (!(text == "Attack")) { if (!(text == "Mattack")) { if (!(text == "Defense")) { if (text == "Mdefense") { propIndex2 = 5; propIndex3 = 6; } } else { propIndex2 = 3; propIndex3 = 4; } } else { propIndex2 = 9; propIndex3 = 10; } } else { propIndex2 = 7; propIndex3 = 8; } } string[] valueArray = nameValueArray[1].Split(new char[] { splitChar3 }); double propValue; if (propIndex2 >= 0 && double.TryParse(valueArray[0], out propValue)) { equipPropItem.ExtProps[propIndex2] = propValue; } if (propIndex3 >= 0 && double.TryParse(valueArray[1], out propValue)) { equipPropItem.ExtProps[propIndex3] = propValue; } } } } } return(equipPropItem); }
/// <summary> /// 负面效果概率公式(击退,昏迷等) /// </summary> /// <param name="self"></param> /// <param name="obj"></param> /// <param name="baseRate"></param> /// <returns></returns> public static double GetNegativeRate(IObject self, IObject obj, double baseRate, ExtPropIndexes extPropIndex) { int selfZhuanSheng = 0; if (self is GameClient) { selfZhuanSheng = (self as GameClient).ClientData.ChangeLifeCount; baseRate = RoleAlgorithm.GetRoleNegativeRate(self as GameClient, baseRate, extPropIndex); } else if (self is Monster) { selfZhuanSheng = (self as Monster).MonsterInfo.ChangeLifeCount; } int objZhuanSheng = 0; if (obj is GameClient) { objZhuanSheng = (obj as GameClient).ClientData.ChangeLifeCount; } else if (obj is Monster) { objZhuanSheng = (obj as Monster).MonsterInfo.ChangeLifeCount; } else if (obj is FakeRoleItem) { objZhuanSheng = (obj as FakeRoleItem).GetFakeRoleData().MyRoleDataMini.ChangeLifeCount; } if (selfZhuanSheng > objZhuanSheng) { return(baseRate + 0.1 * Math.Pow(selfZhuanSheng - objZhuanSheng, 2)); } else { return(baseRate - 0.1 * Math.Pow(selfZhuanSheng - objZhuanSheng, 2)); } }