private int GetMaxLife() { int genLv = 0; int currMaxLv = 0; GameUser userinfo = new PersonalCacheStruct<GameUser>().FindKey(UserID); if (userinfo != null) { currMaxLv = userinfo.UserLv; } if (currMaxLv > 0 && GeneralLv > currMaxLv) { genLv = userinfo.UserLv; } else { genLv = GeneralLv; } //��ʼ����+(�ȼ�-1)*ְҵ�ӳ� + װ������+����ˮ������+ħ����������+������+��ħ���� int lifeNum = 0; CareerInfo careerInfo = new ShareCacheStruct<CareerInfo>().FindKey(CareerID); if (careerInfo == null) { return lifeNum; } var tempLv = MathUtils.Subtraction(genLv, 1, 0); if (IsUserGeneral) { lifeNum = MathUtils.Addition(careerInfo.LifeNum, careerInfo.LifeIncreaseNum * tempLv, int.MaxValue); } else { GeneralInfo generalInfo = new ShareCacheStruct<GeneralInfo>().FindKey(GeneralID); if (generalInfo != null) { lifeNum = MathUtils.Addition(generalInfo.LifeNum, careerInfo.LifeIncreaseNum * tempLv, int.MaxValue); } } //����ˮ������ var packageCrystal = UserCrystalPackage.Get(UserID); if (packageCrystal != null && packageCrystal.CrystalPackage != null) { UserCrystalInfo[] crystalList = packageCrystal.CrystalPackage.FindAll(m => m.GeneralID.Equals(GeneralID)).ToArray(); foreach (UserCrystalInfo item in crystalList) { short upLv = 0; if (item.CrystalLv < 10) { upLv = item.CrystalLv; //item.CrystalLv.Addition(1, short.MaxValue); } else { upLv = 10; } //AbilityType abilityType = new ShareCacheStruct<CrystalInfo>().FindKey(item.CrystalID).AbilityID; var cacheSetCrystal = new ShareCacheStruct<CrystalInfo>(); var crystalInfo = cacheSetCrystal.FindKey(item.CrystalID); AbilityType abilityType = crystalInfo != null ? crystalInfo.AbilityID : AbilityType.AttackLife; decimal effectNum = 0; CrystalLvInfo lvInfo = new ShareCacheStruct<CrystalLvInfo>().FindKey(item.CrystalID, upLv); if (lvInfo != null) { effectNum = lvInfo.AbilityNum; } if (abilityType == AbilityType.ShengMing) { lifeNum = MathUtils.Addition(lifeNum, effectNum.ToInt(), int.MaxValue); } } } //װ������ var package = UserItemPackage.Get(UserID); if (package != null && package.ItemPackage != null) { var equList = package.ItemPackage.FindAll(m => !m.IsRemove && m.GeneralID.Equals(GeneralID) && m.ItemStatus.Equals(ItemStatus.YongBing)); foreach (var item in equList) { ItemEquAttrInfo equAttr = new ShareCacheStruct<ItemEquAttrInfo>().FindKey(item.ItemID, AbilityType.ShengMing); if (equAttr != null) { lifeNum = MathUtils.Addition(lifeNum, equAttr.GetEffectNum(item.ItemLv), int.MaxValue); } //��������� var user = new PersonalCacheStruct<GameUser>().FindKey(UserID); if (user != null && user.SparePartList != null && user.SparePartList.Count > 0) { var sparepartList = user.SparePartList.FindAll(m => string.Equals(m.UserItemID, item.UserItemID)); foreach (var sparepart in sparepartList) { foreach (var property in sparepart.Propertys) { if (property.AbilityType == AbilityType.ShengMing) { lifeNum = MathUtils.Addition(lifeNum, property.Num.ToInt()); } } } } } } //ħ������������������ var userMagicList = new PersonalCacheStruct<UserMagic>().FindAll(UserID, u => u.MagicID != 1); foreach (UserMagic item in userMagicList) { //�����ȼ�Ϊ10�� int mlv = 0; if (item.MagicType == MagicType.MoFaZhen && item.MagicLv > 10) { mlv = 10; } else if (item.MagicType == MagicType.JiNeng && item.MagicLv > currMaxLv) { mlv = currMaxLv; } else { mlv = item.MagicLv; } MagicLvInfo magicLvItem = new ShareCacheStruct<MagicLvInfo>().FindKey(item.MagicID, mlv); if (magicLvItem != null && magicLvItem.AbilityType == AbilityType.ShengMing) { int errNum = magicLvItem.EffectNum.ToInt(); lifeNum = MathUtils.Addition(lifeNum, errNum, int.MaxValue); } } // Ӷ���øжȵȼ��ӳ����� FeelLvInfo fellLvInfo = new ShareCacheStruct<FeelLvInfo>().FindKey(FeelLv); if (fellLvInfo != null && fellLvInfo.Property != null) { GeneralProperty property = fellLvInfo.Property.Find(m => m.AbilityType.Equals(AbilityType.ShengMing)); if (property != null) { int effectNum = property.AbilityValue.ToInt(); lifeNum = MathUtils.Addition(lifeNum, effectNum, int.MaxValue); } } //���������ӳ� UserTrump userTrump = new PersonalCacheStruct<UserTrump>().FindKey(UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.LiftNum > 0 && GeneralID == 10000) { TrumpInfo trumpInfo = new ShareCacheStruct<TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, userTrump.TrumpLv); if (trumpInfo != null && trumpInfo.Property != null && trumpInfo.Property.Count > 0) { int maxMatureNum = ConfigEnvSet.GetInt("Trump.MaxMatrueNum"); decimal mature = (decimal)userTrump.MatureNum / maxMatureNum; GeneralProperty property = trumpInfo.Property.Find(m => m.AbilityType == AbilityType.ShengMing); if (property != null) { lifeNum = MathUtils.Addition(lifeNum, (int)Math.Floor(mature * property.AbilityValue)); } } if (userTrump.PropertyInfo.Count > 0) { GeneralProperty property = userTrump.PropertyInfo.Find(m => m.AbilityType == AbilityType.ShengMing); if (property != null) { lifeNum = MathUtils.Addition(lifeNum, (int)property.AbilityValue); } } } //��ħ���� var itempackage = UserItemPackage.Get(UserID); var enchantPackage = UserEnchant.Get(UserID); if (itempackage != null && itempackage.ItemPackage != null && enchantPackage != null && enchantPackage.EnchantPackage != null) { var useritem = itempackage.ItemPackage.Find(m => !m.IsRemove && m.GeneralID == GeneralID && m.Equparts == EquParts.WuQi); if (useritem != null) { var enchantList = enchantPackage.EnchantPackage.FindAll(m => m.UserItemID == useritem.UserItemID && m.AbilityType == AbilityType.ShengMing); foreach (var info in enchantList) { EnchantLvInfo enchantLvInfo = new ShareCacheStruct<EnchantLvInfo>().FindKey(info.EnchantID, info.EnchantLv); if (enchantLvInfo != null) { int maxEnchantMature = ConfigEnvSet.GetInt("Enchant.MaxEnchantMature"); decimal growthrate = enchantLvInfo.Num * info.MaxMature / maxEnchantMature * info.EnchantLv; lifeNum = MathUtils.Addition(lifeNum, (int)growthrate); } } } } //Ӷ���������� if (Attribute.Count > 0) { var generalPro = Attribute.Find(s => s.AbilityType == AbilityType.ShengMing); if (generalPro != null) { lifeNum = MathUtils.Addition(lifeNum, generalPro.AbilityValue.ToInt()); } } return lifeNum; }
private int GetMaxLife() { int genLv = 0; int currMaxLv = 0; GameUser userinfo = new PersonalCacheStruct <GameUser>().FindKey(UserID); if (userinfo != null) { currMaxLv = userinfo.UserLv; } if (currMaxLv > 0 && GeneralLv > currMaxLv) { genLv = userinfo.UserLv; } else { genLv = GeneralLv; } //��ʼ����+(�ȼ�-1)*ְҵ�ӳ� + װ������+����ˮ������+ħ����������+������+��ħ���� int lifeNum = 0; CareerInfo careerInfo = new ShareCacheStruct <CareerInfo>().FindKey(CareerID); if (careerInfo == null) { return(lifeNum); } var tempLv = MathUtils.Subtraction(genLv, 1, 0); if (IsUserGeneral) { lifeNum = MathUtils.Addition(careerInfo.LifeNum, careerInfo.LifeIncreaseNum * tempLv, int.MaxValue); } else { GeneralInfo generalInfo = new ShareCacheStruct <GeneralInfo>().FindKey(GeneralID); if (generalInfo != null) { lifeNum = MathUtils.Addition(generalInfo.LifeNum, careerInfo.LifeIncreaseNum * tempLv, int.MaxValue); } } //����ˮ������ var packageCrystal = UserCrystalPackage.Get(UserID); if (packageCrystal != null && packageCrystal.CrystalPackage != null) { UserCrystalInfo[] crystalList = packageCrystal.CrystalPackage.FindAll(m => m.GeneralID.Equals(GeneralID)).ToArray(); foreach (UserCrystalInfo item in crystalList) { short upLv = 0; if (item.CrystalLv < 10) { upLv = item.CrystalLv; //item.CrystalLv.Addition(1, short.MaxValue); } else { upLv = 10; } //AbilityType abilityType = new ShareCacheStruct<CrystalInfo>().FindKey(item.CrystalID).AbilityID; var cacheSetCrystal = new ShareCacheStruct <CrystalInfo>(); var crystalInfo = cacheSetCrystal.FindKey(item.CrystalID); AbilityType abilityType = crystalInfo != null ? crystalInfo.AbilityID : AbilityType.AttackLife; decimal effectNum = 0; CrystalLvInfo lvInfo = new ShareCacheStruct <CrystalLvInfo>().FindKey(item.CrystalID, upLv); if (lvInfo != null) { effectNum = lvInfo.AbilityNum; } if (abilityType == AbilityType.ShengMing) { lifeNum = MathUtils.Addition(lifeNum, effectNum.ToInt(), int.MaxValue); } } } //װ������ var package = UserItemPackage.Get(UserID); if (package != null && package.ItemPackage != null) { var equList = package.ItemPackage.FindAll(m => !m.IsRemove && m.GeneralID.Equals(GeneralID) && m.ItemStatus.Equals(ItemStatus.YongBing)); foreach (var item in equList) { ItemEquAttrInfo equAttr = new ShareCacheStruct <ItemEquAttrInfo>().FindKey(item.ItemID, AbilityType.ShengMing); if (equAttr != null) { lifeNum = MathUtils.Addition(lifeNum, equAttr.GetEffectNum(item.ItemLv), int.MaxValue); } //��������� var user = new PersonalCacheStruct <GameUser>().FindKey(UserID); if (user != null && user.SparePartList != null && user.SparePartList.Count > 0) { var sparepartList = user.SparePartList.FindAll(m => string.Equals(m.UserItemID, item.UserItemID)); foreach (var sparepart in sparepartList) { foreach (var property in sparepart.Propertys) { if (property.AbilityType == AbilityType.ShengMing) { lifeNum = MathUtils.Addition(lifeNum, property.Num.ToInt()); } } } } } } //ħ������������������ var userMagicList = new PersonalCacheStruct <UserMagic>().FindAll(UserID, u => u.MagicID != 1); foreach (UserMagic item in userMagicList) { //�����ȼ�Ϊ10�� int mlv = 0; if (item.MagicType == MagicType.MoFaZhen && item.MagicLv > 10) { mlv = 10; } else if (item.MagicType == MagicType.JiNeng && item.MagicLv > currMaxLv) { mlv = currMaxLv; } else { mlv = item.MagicLv; } MagicLvInfo magicLvItem = new ShareCacheStruct <MagicLvInfo>().FindKey(item.MagicID, mlv); if (magicLvItem != null && magicLvItem.AbilityType == AbilityType.ShengMing) { int errNum = magicLvItem.EffectNum.ToInt(); lifeNum = MathUtils.Addition(lifeNum, errNum, int.MaxValue); } } // Ӷ���øжȵȼ��ӳ����� FeelLvInfo fellLvInfo = new ShareCacheStruct <FeelLvInfo>().FindKey(FeelLv); if (fellLvInfo != null && fellLvInfo.Property != null) { GeneralProperty property = fellLvInfo.Property.Find(m => m.AbilityType.Equals(AbilityType.ShengMing)); if (property != null) { int effectNum = property.AbilityValue.ToInt(); lifeNum = MathUtils.Addition(lifeNum, effectNum, int.MaxValue); } } //���������ӳ� UserTrump userTrump = new PersonalCacheStruct <UserTrump>().FindKey(UserID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.LiftNum > 0 && GeneralID == 10000) { TrumpInfo trumpInfo = new ShareCacheStruct <TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, userTrump.TrumpLv); if (trumpInfo != null && trumpInfo.Property != null && trumpInfo.Property.Count > 0) { int maxMatureNum = ConfigEnvSet.GetInt("Trump.MaxMatrueNum"); decimal mature = (decimal)userTrump.MatureNum / maxMatureNum; GeneralProperty property = trumpInfo.Property.Find(m => m.AbilityType == AbilityType.ShengMing); if (property != null) { lifeNum = MathUtils.Addition(lifeNum, (int)Math.Floor(mature * property.AbilityValue)); } } if (userTrump.PropertyInfo.Count > 0) { GeneralProperty property = userTrump.PropertyInfo.Find(m => m.AbilityType == AbilityType.ShengMing); if (property != null) { lifeNum = MathUtils.Addition(lifeNum, (int)property.AbilityValue); } } } //��ħ���� var itempackage = UserItemPackage.Get(UserID); var enchantPackage = UserEnchant.Get(UserID); if (itempackage != null && itempackage.ItemPackage != null && enchantPackage != null && enchantPackage.EnchantPackage != null) { var useritem = itempackage.ItemPackage.Find(m => !m.IsRemove && m.GeneralID == GeneralID && m.Equparts == EquParts.WuQi); if (useritem != null) { var enchantList = enchantPackage.EnchantPackage.FindAll(m => m.UserItemID == useritem.UserItemID && m.AbilityType == AbilityType.ShengMing); foreach (var info in enchantList) { EnchantLvInfo enchantLvInfo = new ShareCacheStruct <EnchantLvInfo>().FindKey(info.EnchantID, info.EnchantLv); if (enchantLvInfo != null) { int maxEnchantMature = ConfigEnvSet.GetInt("Enchant.MaxEnchantMature"); decimal growthrate = enchantLvInfo.Num * info.MaxMature / maxEnchantMature * info.EnchantLv; lifeNum = MathUtils.Addition(lifeNum, (int)growthrate); } } } } //Ӷ���������� if (Attribute.Count > 0) { var generalPro = Attribute.Find(s => s.AbilityType == AbilityType.ShengMing); if (generalPro != null) { lifeNum = MathUtils.Addition(lifeNum, generalPro.AbilityValue.ToInt()); } } return(lifeNum); }
private static int GetEquAttrEffect(UserItemInfo item, AbilityType abilityType) { ItemEquAttrInfo equAttr = new ShareCacheStruct<ItemEquAttrInfo>().FindKey(item.ItemID, abilityType); return (equAttr != null ? equAttr.GetEffectNum(item.ItemLv) : 0); }