public void ActivationStarConstellationExtendProp(GameClient client, int nSiteID) { if (client != null && client.ClientData.RoleStarConstellationInfo != null) { int nStarSlot = 0; if (client.ClientData.RoleStarConstellationInfo.TryGetValue(nSiteID, out nStarSlot)) { StarConstellationTypeInfo scTypeInfo = null; if (this.m_StarConstellationTypeInfo.TryGetValue(nSiteID, out scTypeInfo) && scTypeInfo != null) { int nModulus = 1; if (nStarSlot > 0) { nModulus = this.GetExtendPropIndex(nStarSlot, scTypeInfo); } if (nModulus > 0) { PropertyInfo tmpProp = scTypeInfo.Propertyinfo; if (tmpProp != null) { this.ActivationStarConstellationProp(client, tmpProp, nModulus); } } } } } }
/// <summary> /// 找到扩展属性的下标值 /// </summary> public int GetExtendPropIndex(int nValue, StarConstellationTypeInfo starInfo) { if (nValue > 0) { for (int i = 0; i < starInfo.AddPropStarSiteLimit.Length; ++i) { if (nValue >= starInfo.AddPropStarSiteLimit[i]) { if (nValue == starInfo.AddPropStarSiteLimit[i]) { return(starInfo.AddPropModulus[i]); } else { if (nValue < starInfo.AddPropStarSiteLimit[i + 1]) { return(starInfo.AddPropModulus[i]); } } } } } return(-1); }
/// <summary> /// 处理星座额外属性 /// </summary> public void ActivationStarConstellationExtendProp(GameClient client, int nSiteID) { if (client == null || client.ClientData.RoleStarConstellationInfo == null) { return; } int nStarSlot = 0; if (!client.ClientData.RoleStarConstellationInfo.TryGetValue(nSiteID, out nStarSlot)) { return; } //if (nStarSlot < m_MaxStarSlotID) // return; StarConstellationTypeInfo scTypeInfo = null; if (m_StarConstellationTypeInfo.TryGetValue(nSiteID, out scTypeInfo) && scTypeInfo != null) { //bool bCanAddProp = false; int nModulus = 1; if (nStarSlot > 0) { nModulus = GetExtendPropIndex(nStarSlot, scTypeInfo); } //if (nStarSlot >= m_MaxStarSlotID) if (nModulus > 0) { PropertyInfo tmpProp = null; tmpProp = scTypeInfo.Propertyinfo; if (tmpProp == null) { return; } ActivationStarConstellationProp(client, tmpProp, nModulus); } } }
/// <summary> /// 星座类型静态数据 /// </summary> public void LoadStarConstellationTypeInfo() { try { string fileName = "Config/XingZuo/XingZuoType.xml"; XElement xmlFile = null; xmlFile = Global.GetGameResXml(string.Format(fileName)); if (null == xmlFile) { return; } IEnumerable <XElement> StarXEle = xmlFile.Elements("XingZuo").Elements(); foreach (var xmlItem in StarXEle) { if (null != xmlItem) { StarConstellationTypeInfo tmpInfo = new StarConstellationTypeInfo(); int ID = (int)Global.GetSafeAttributeDouble(xmlItem, "ID"); tmpInfo.TypeID = ID; string sLevelInfo = null; sLevelInfo = Global.GetSafeAttributeStr(xmlItem, "KaiQiLevel"); string[] sArrayLevelInfo = null; sArrayLevelInfo = sLevelInfo.Split(','); tmpInfo.ChangeLifeLimit = Global.SafeConvertToInt32(sArrayLevelInfo[0]); tmpInfo.LevelLimit = Global.SafeConvertToInt32(sArrayLevelInfo[1]); string strInfos = null; strInfos = Global.GetSafeAttributeStr(xmlItem, "ShuXiangJiaCheng"); string[] sArry = null; sArry = strInfos.Split('|'); string[] sArryInfo = null; if (sArry != null) { tmpInfo.Propertyinfo = new PropertyInfo(); for (int n = 0; n < sArry.Length; ++n) { sArryInfo = null; sArryInfo = sArry[n].Split(','); string strPorpName = null; strPorpName = sArryInfo[0]; string strPorpValue = null; strPorpValue = sArryInfo[1]; string[] strArrayPorpValue = null; strArrayPorpValue = strPorpValue.Split('-'); if (strPorpName == "Defense") { tmpInfo.Propertyinfo.PropertyID1 = (int)ExtPropIndexes.MinDefense; tmpInfo.Propertyinfo.AddPropertyMinValue1 = Global.SafeConvertToInt32(strArrayPorpValue[0]); tmpInfo.Propertyinfo.PropertyID2 = (int)ExtPropIndexes.MaxDefense; tmpInfo.Propertyinfo.AddPropertyMaxValue1 = Global.SafeConvertToInt32(strArrayPorpValue[1]); } else if (strPorpName == "Mdefense") { tmpInfo.Propertyinfo.PropertyID3 = (int)ExtPropIndexes.MinMDefense; tmpInfo.Propertyinfo.AddPropertyMinValue2 = Global.SafeConvertToInt32(strArrayPorpValue[0]); tmpInfo.Propertyinfo.PropertyID4 = (int)ExtPropIndexes.MaxMDefense; tmpInfo.Propertyinfo.AddPropertyMaxValue2 = Global.SafeConvertToInt32(strArrayPorpValue[1]); } else if (strPorpName == "Attack") { tmpInfo.Propertyinfo.PropertyID5 = (int)ExtPropIndexes.MinAttack; tmpInfo.Propertyinfo.AddPropertyMinValue3 = Global.SafeConvertToInt32(strArrayPorpValue[0]); tmpInfo.Propertyinfo.PropertyID6 = (int)ExtPropIndexes.MaxAttack; tmpInfo.Propertyinfo.AddPropertyMaxValue3 = Global.SafeConvertToInt32(strArrayPorpValue[1]); } else if (strPorpName == "Mattack") { tmpInfo.Propertyinfo.PropertyID7 = (int)ExtPropIndexes.MinMAttack; tmpInfo.Propertyinfo.AddPropertyMinValue4 = Global.SafeConvertToInt32(strArrayPorpValue[0]); tmpInfo.Propertyinfo.PropertyID8 = (int)ExtPropIndexes.MaxMAttack; tmpInfo.Propertyinfo.AddPropertyMaxValue4 = Global.SafeConvertToInt32(strArrayPorpValue[1]); } else if (strPorpName == "HitV") { tmpInfo.Propertyinfo.PropertyID9 = (int)ExtPropIndexes.HitV; tmpInfo.Propertyinfo.AddPropertyMinValue5 = Global.SafeConvertToInt32(strArrayPorpValue[0]); } else if (strPorpName == "Dodge") { tmpInfo.Propertyinfo.PropertyID10 = (int)ExtPropIndexes.Dodge; tmpInfo.Propertyinfo.AddPropertyMinValue6 = Global.SafeConvertToInt32(strArrayPorpValue[0]); } else if (strPorpName == "MaxLifeV") { tmpInfo.Propertyinfo.PropertyID11 = (int)ExtPropIndexes.MaxLifeV; tmpInfo.Propertyinfo.AddPropertyMinValue7 = Global.SafeConvertToInt32(strArrayPorpValue[0]); } } } strInfos = null; strInfos = Global.GetSafeAttributeStr(xmlItem, "JiaChengBiLie"); sArry = null; sArry = strInfos.Split('|'); sArryInfo = null; if (sArry != null) { tmpInfo.AddPropStarSiteLimit = new int[sArry.Length]; tmpInfo.AddPropModulus = new int[sArry.Length]; for (int n = 0; n < sArry.Length; ++n) { sArryInfo = null; sArryInfo = sArry[n].Split(','); tmpInfo.AddPropStarSiteLimit[n] = Global.SafeConvertToInt32(sArryInfo[0]); tmpInfo.AddPropModulus[n] = Global.SafeConvertToInt32(sArryInfo[1]); } } m_StarConstellationTypeInfo.Add(ID, tmpInfo); } } } catch (Exception ex) { throw new Exception(string.Format("load xml file : {0} fail" + ex.ToString(), string.Format("Config/XingZuoType.xml"))); } }
public void LoadStarConstellationTypeInfo() { try { string fileName = "Config/XingZuo/XingZuoType.xml"; XElement xmlFile = Global.GetGameResXml(string.Format(fileName, new object[0])); if (null != xmlFile) { IEnumerable <XElement> StarXEle = xmlFile.Elements("XingZuo").Elements <XElement>(); foreach (XElement xmlItem in StarXEle) { if (null != xmlItem) { StarConstellationTypeInfo tmpInfo = new StarConstellationTypeInfo(); int ID = (int)Global.GetSafeAttributeDouble(xmlItem, "ID"); tmpInfo.TypeID = ID; string sLevelInfo = Global.GetSafeAttributeStr(xmlItem, "KaiQiLevel"); string[] sArrayLevelInfo = sLevelInfo.Split(new char[] { ',' }); tmpInfo.ChangeLifeLimit = Global.SafeConvertToInt32(sArrayLevelInfo[0]); tmpInfo.LevelLimit = Global.SafeConvertToInt32(sArrayLevelInfo[1]); string strInfos = Global.GetSafeAttributeStr(xmlItem, "ShuXiangJiaCheng"); string[] sArry = strInfos.Split(new char[] { '|' }); if (sArry != null) { tmpInfo.Propertyinfo = new PropertyInfo(); for (int i = 0; i < sArry.Length; i++) { string[] sArryInfo = sArry[i].Split(new char[] { ',' }); string strPorpName = sArryInfo[0]; string strPorpValue = sArryInfo[1]; string[] strArrayPorpValue = strPorpValue.Split(new char[] { '-' }); if (strPorpName == "Defense") { tmpInfo.Propertyinfo.PropertyID1 = 3; tmpInfo.Propertyinfo.AddPropertyMinValue1 = Global.SafeConvertToInt32(strArrayPorpValue[0]); tmpInfo.Propertyinfo.PropertyID2 = 4; tmpInfo.Propertyinfo.AddPropertyMaxValue1 = Global.SafeConvertToInt32(strArrayPorpValue[1]); } else if (strPorpName == "Mdefense") { tmpInfo.Propertyinfo.PropertyID3 = 5; tmpInfo.Propertyinfo.AddPropertyMinValue2 = Global.SafeConvertToInt32(strArrayPorpValue[0]); tmpInfo.Propertyinfo.PropertyID4 = 6; tmpInfo.Propertyinfo.AddPropertyMaxValue2 = Global.SafeConvertToInt32(strArrayPorpValue[1]); } else if (strPorpName == "Attack") { tmpInfo.Propertyinfo.PropertyID5 = 7; tmpInfo.Propertyinfo.AddPropertyMinValue3 = Global.SafeConvertToInt32(strArrayPorpValue[0]); tmpInfo.Propertyinfo.PropertyID6 = 8; tmpInfo.Propertyinfo.AddPropertyMaxValue3 = Global.SafeConvertToInt32(strArrayPorpValue[1]); } else if (strPorpName == "Mattack") { tmpInfo.Propertyinfo.PropertyID7 = 9; tmpInfo.Propertyinfo.AddPropertyMinValue4 = Global.SafeConvertToInt32(strArrayPorpValue[0]); tmpInfo.Propertyinfo.PropertyID8 = 10; tmpInfo.Propertyinfo.AddPropertyMaxValue4 = Global.SafeConvertToInt32(strArrayPorpValue[1]); } else if (strPorpName == "HitV") { tmpInfo.Propertyinfo.PropertyID9 = 18; tmpInfo.Propertyinfo.AddPropertyMinValue5 = Global.SafeConvertToInt32(strArrayPorpValue[0]); } else if (strPorpName == "Dodge") { tmpInfo.Propertyinfo.PropertyID10 = 19; tmpInfo.Propertyinfo.AddPropertyMinValue6 = Global.SafeConvertToInt32(strArrayPorpValue[0]); } else if (strPorpName == "MaxLifeV") { tmpInfo.Propertyinfo.PropertyID11 = 13; tmpInfo.Propertyinfo.AddPropertyMinValue7 = Global.SafeConvertToInt32(strArrayPorpValue[0]); } } } strInfos = Global.GetSafeAttributeStr(xmlItem, "JiaChengBiLie"); sArry = strInfos.Split(new char[] { '|' }); if (sArry != null) { tmpInfo.AddPropStarSiteLimit = new int[sArry.Length]; tmpInfo.AddPropModulus = new int[sArry.Length]; for (int i = 0; i < sArry.Length; i++) { string[] sArryInfo = sArry[i].Split(new char[] { ',' }); tmpInfo.AddPropStarSiteLimit[i] = Global.SafeConvertToInt32(sArryInfo[0]); tmpInfo.AddPropModulus[i] = Global.SafeConvertToInt32(sArryInfo[1]); } } this.m_StarConstellationTypeInfo.Add(ID, tmpInfo); } } } } catch (Exception ex) { throw new Exception(string.Format("load xml file : {0} fail" + ex.ToString(), string.Format("Config/XingZuoType.xml", new object[0]))); } }