private static HitData.DamageModifier GetNewDamageTypeMod(NewDamageTypes type, ItemDrop.ItemData chestItem, ItemDrop.ItemData legItem, ItemDrop.ItemData helmetItem, ItemDrop.ItemData shoulderItem) { HitData.DamageModPair modPair = new HitData.DamageModPair(); if (chestItem != null) { modPair = chestItem.m_shared.m_damageModifiers.FirstOrDefault(s => (int)s.m_type == (int)type); } if (legItem != null) { var leg = legItem.m_shared.m_damageModifiers.FirstOrDefault(s => (int)s.m_type == (int)type); if (ShouldOverride(modPair.m_modifier, leg.m_modifier)) { modPair = leg; } } if (helmetItem != null) { var helm = helmetItem.m_shared.m_damageModifiers.FirstOrDefault(s => (int)s.m_type == (int)type); if (ShouldOverride(modPair.m_modifier, helm.m_modifier)) { modPair = helm; } } if (shoulderItem != null) { var shoulder = shoulderItem.m_shared.m_damageModifiers.FirstOrDefault(s => (int)s.m_type == (int)type); if (ShouldOverride(modPair.m_modifier, shoulder.m_modifier)) { modPair = shoulder; } } return(modPair.m_modifier); }
private static HitData.DamageModifier GetNewDamageTypeMod(NewDamageTypes type, Character character) { Traverse t = Traverse.Create(character); return(GetNewDamageTypeMod(type, t.Field("m_chestItem").GetValue <ItemDrop.ItemData>(), t.Field("m_legItem").GetValue <ItemDrop.ItemData>(), t.Field("m_helmetItem").GetValue <ItemDrop.ItemData>(), t.Field("m_shoulderItem").GetValue <ItemDrop.ItemData>())); }