//Replace the entire method static bool Prefix(ItemMenuVM __instance, int result, bool isCompared, ref Color __result) { //if (MobileParty.MainParty != null && (MobileParty.MainParty.HasPerk(DefaultPerks.Trade.WholeSeller) || MobileParty.MainParty.HasPerk(DefaultPerks.Trade.Appraiser))) //{ // return Colors.Black; //} // Code above is from original method, the intention was probably to turn on red/green colours on the purchase price of any goods in your inventory as the Perk says "Profits are marked" // But this function is also used for equipment stat comparisons, so this is the wrong place to enable those perks. if (result != -1) { if (result != 1) { __result = Colors.Black; return(false); } if (!isCompared) { __result = UIColors.PositiveIndicator; return(false); } __result = UIColors.NegativeIndicator; return(false); } else { if (!isCompared) { __result = UIColors.NegativeIndicator; return(false); } __result = UIColors.PositiveIndicator; return(false); } }
private static ItemMenuTooltipPropertyVM AddTargetItemProperties(ItemMenuVM itemMenuVM, string definition, string value, Color color) { ItemMenuTooltipPropertyVM itemMenuTooltipPropertyVM = new ItemMenuTooltipPropertyVM(definition, value, 0, color, false, null); itemMenuVM.TargetItemProperties.Add(itemMenuTooltipPropertyVM); return(itemMenuTooltipPropertyVM); }
private static void Prefix(ItemMenuVM __instance, MBBindingList <ItemFlagVM> list, ref WeaponComponentData weapon) { var character = (BasicCharacterObject)ItemMenuVmCharacterField.GetValue(__instance); if (weapon.WeaponClass == WeaponClass.Crossbow) // Make sure we're always using the correct value, in case this overwrites some shared WeaponComponentData { weapon.WeaponFlags = HeroHasPerk(character, _crossbowExpert) ? weapon.WeaponFlags & ~WeaponFlags.CantReloadOnHorseback : weapon.WeaponFlags; } }
private static void Prefix(ItemMenuVM __instance, MBBindingList <ItemFlagVM> list, ref WeaponComponentData weapon) { var character = (BasicCharacterObject)typeof(ItemMenuVM).GetField("_character", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); if (weapon.WeaponClass == WeaponClass.Crossbow) // Make sure we're always using the correct value, in case this overwrites some shared WeaponComponentData { weapon.WeaponFlags = HeroHasPerk(character, CrossbowCavalry) ? weapon.WeaponFlags & ~WeaponFlags.CantReloadOnHorseback : weapon.WeaponFlags; } }
private static void Prefix(ItemMenuVM __instance, MBBindingList <ItemFlagVM> list, ref WeaponComponentData weapon) { var character = (BasicCharacterObject)ItemMenuVmCharacterField.GetValue(__instance); if (weapon.ItemUsage == "long_bow") // Make sure we're always using the correct value, in case this overwrites some shared WeaponComponentData { WeaponComponentDataItemUsageMethod .Invoke(weapon, new[] { HeroHasPerk(character, _bowExpert) ? "bow" : weapon.ItemUsage }); } }
private static void Prefix(ItemMenuVM __instance, MBBindingList <ItemFlagVM> list, ref WeaponComponentData weapon) { var character = (BasicCharacterObject)typeof(ItemMenuVM).GetField("_character", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); if (weapon.ItemUsage == "long_bow") // Make sure we're always using the correct value, in case this overwrites some shared WeaponComponentData { typeof(WeaponComponentData) .GetMethod("set_ItemUsage", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly) .Invoke(weapon, new[] { HeroHasPerk(character, MountedArcher) ? "bow" : weapon.ItemUsage }); } }
private static bool AddWeaponItemFlags(ItemMenuVM __instance, ref BasicCharacterObject ____character, MBBindingList <ItemFlagVM> list, WeaponComponentData weapon) { var hero = (CharacterObject)____character; var blowCanMount = weapon.WeaponClass == WeaponClass.Bow && hero.IsHero && (hero.GetPerkValue(DefaultPerks.Bow.MountedArcher) || hero.GetPerkValue(DefaultPerks.Riding.BowExpert)); var crossBlowCanReloadMount = weapon.WeaponClass == WeaponClass.Crossbow && hero.IsHero && (hero.GetPerkValue(DefaultPerks.Crossbow.CrossbowCavalry) || hero.GetPerkValue(DefaultPerks.Riding.CrossbowExpert)); if (weapon.RelevantSkill == DefaultSkills.Bow) { list.Add(new ItemFlagVM("Weapons\\bow", GameTexts.FindText("str_inventory_flag_bow").ToString())); } if (weapon.RelevantSkill == DefaultSkills.Crossbow) { list.Add(new ItemFlagVM("Weapons\\crossbow", GameTexts.FindText("str_inventory_flag_crossbow").ToString())); } if (weapon.RelevantSkill == DefaultSkills.Polearm) { list.Add(new ItemFlagVM("Weapons\\polearm", GameTexts.FindText("str_inventory_flag_polearm").ToString())); } if (weapon.RelevantSkill == DefaultSkills.OneHanded) { list.Add(new ItemFlagVM("Weapons\\one_handed", GameTexts.FindText("str_inventory_flag_one_handed").ToString())); } if (weapon.RelevantSkill == DefaultSkills.TwoHanded) { list.Add(new ItemFlagVM("Weapons\\two_handed", GameTexts.FindText("str_inventory_flag_two_handed").ToString())); } if (weapon.RelevantSkill == DefaultSkills.Throwing) { list.Add(new ItemFlagVM("Weapons\\throwing", GameTexts.FindText("str_inventory_flag_throwing").ToString())); } if (weapon.WeaponFlags.HasAnyFlag(WeaponFlags.CantReloadOnHorseback) && !crossBlowCanReloadMount) { list.Add(new ItemFlagVM("Weapons\\cant_reload_on_horseback", GameTexts.FindText("str_inventory_flag_cant_reload_on_horseback").ToString())); } if (weapon.WeaponFlags.HasAnyFlag(WeaponFlags.BonusAgainstShield)) { list.Add(new ItemFlagVM("Weapons\\bonus_against_shield", GameTexts.FindText("str_inventory_flag_bonus_against_shield").ToString())); } ItemObject.ItemUsageSetFlags p = PerkHelp.GetItemUsageSetFlag(weapon); if (p.HasAnyFlag(ItemObject.ItemUsageSetFlags.RequiresNoMount) && !blowCanMount) { list.Add(new ItemFlagVM("Weapons\\cant_use_with_horse", GameTexts.FindText("str_inventory_flag_cant_use_with_mounts").ToString())); } if (p.HasAnyFlag(ItemObject.ItemUsageSetFlags.RequiresNoShield)) { list.Add(new ItemFlagVM("Weapons\\cant_use_with_shields", GameTexts.FindText("str_inventory_flag_cant_use_with_shields").ToString())); } return(false); }