public static void SetToolTips(CombatHUDWeaponSlot slot, Dictionary <string, Func <AttackModifier> > factors) { try { AttackPos = ActiveState.PreviewPos; tip = slot.ToolTipHoverElement; thisModifier = "(Init)"; int TotalModifiers = 0; foreach (var modifier in factors) { thisModifier = modifier.Key; AttackModifier mod = modifier.Value(); TotalModifiers += AddToolTipDetail(mod); } if (TotalModifiers < 0 && !CombatConstants.ResolutionConstants.AllowTotalNegativeModifier) { TotalModifiers = 0; } tip.BasicModifierInt = Settings.ReverseInCombatModifier ? -TotalModifiers : TotalModifiers; } catch (Exception) { // Reset before giving up tip?.DebuffStrings.Clear(); tip?.BuffStrings.Clear(); throw; } }
public static void Postfix(CombatHUDVehicleArmorHover __instance) { HUDVehicleArmorReadout ___Readout = (HUDVehicleArmorReadout)Traverse.Create(__instance).Property("Readout").GetValue(); CombatHUDTooltipHoverElement ___ToolTip = (CombatHUDTooltipHoverElement)Traverse.Create(__instance).Property("ToolTip").GetValue(); if (___Readout != null && ___Readout.DisplayedVehicle != null && ___Readout.DisplayedVehicle.Combat != null && ___ToolTip != null) { Vehicle target = ___Readout.DisplayedVehicle; if (!target.Combat.HostilityMatrix.IsLocalPlayerFriendly(target.TeamId)) { SensorScanType scanType = SensorLockHelper.CalculateSharedLock(target, ModState.LastPlayerActorActivated); if (scanType < SensorScanType.AllInformation) { ___ToolTip.BuffStrings.Clear(); ___ToolTip.DebuffStrings.Clear(); } } } }
public static bool OverridePaperDollTooltip(CombatHUDMechTrayArmorHover __instance, Mech mech, ArmorLocation location) { try { if (!FriendOrFoe(mech, Settings.ShowAmmoInTooltip, Settings.ShowEnemyAmmoInTooltip)) { return(true); } CombatHUDMechTrayArmorHover me = __instance; CombatHUDTooltipHoverElement ToolTip = (CombatHUDTooltipHoverElement)MechTrayArmorHoverToolTipProp.GetValue(me, null); ToolTip.BuffStrings.Clear(); ToolTip.DebuffStrings.Clear(); ToolTip.BasicString = Mech.GetLongArmorLocation(location); foreach (MechComponent mechComponent in mech.GetComponentsForLocation(MechStructureRules.GetChassisLocationFromArmorLocation(location), ComponentType.NotSet)) { string componentName = mechComponent.UIName.ToString(); int allAmmo = 1; if (mechComponent is Weapon weaponComp && !weaponComp.AmmoCategoryValue.Is_NotSet) { componentName += "<size=80%> (x" + (allAmmo = weaponComp.CurrentAmmo) + ")"; } else if (mechComponent is AmmunitionBox ammo) { int curr = ammo.CurrentAmmo, max = ammo.AmmoCapacity; componentName += "<size=80%> (" + curr + "/" + max + ")"; if (curr < max / 2) { componentName = "<#808080>" + componentName; } } if (mechComponent.DamageLevel >= ComponentDamageLevel.NonFunctional || allAmmo <= 0) { ToolTip.DebuffStrings.Add(new Text(componentName)); } else { ToolTip.BuffStrings.Add(new Text(componentName)); } }