public static void GetTooltipPostfix(ref string __result, ItemDrop.ItemData item, int qualityLevel, bool crafting) { if (item != null && Player.m_localPlayer != null && UtilityFunctions.HasTooltipEffect(Player.m_localPlayer.GetSEMan())) { if (item.IsWeapon()) { UpdateBlockPowerTooltip(ref __result, item); UpdateDamageTooltip(ref __result, item); UpdateBackstabBonus(ref __result, item); } if (item.m_shared.m_name.Contains("shield")) { UpdateBlockPowerTooltip(ref __result, item); UpdateHealOnBlockTooltip(ref __result, item); } } }
// Token: 0x06000693 RID: 1683 RVA: 0x00036EB1 File Offset: 0x000350B1 private bool TopFirst(ItemDrop.ItemData item) { return(item.IsWeapon() || (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Tool || item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Shield || item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Utility)); }
/// <summary> /// Hook on <see cref="global::KeyHints.UpdateHints" /> to show custom key hints instead of the vanilla ones. /// </summary> private bool KeyHints_UpdateHints(KeyHints self) { // If something went wrong, dont NRE every Update if (!HasInitBaseGameObjects || KeyHintInstance == null || KeyHintContainer == null) { return(true); } bool UseCustomKeyHint() { // Guard if (!self.m_keyHintsEnabled || !Player.m_localPlayer || Player.m_localPlayer.IsDead() || Chat.instance.IsChatDialogWindowVisible()) { return(false); } // Get the current equipped item name ItemDrop.ItemData item = Player.m_localPlayer.m_rightItem; if (!(item != null && (item.IsWeapon() || item.m_shared?.m_buildPieces != null))) { return(false); } string prefabName = item.m_dropPrefab?.name; if (string.IsNullOrEmpty(prefabName)) { return(false); } // Get the current selected piece name if any string pieceName = Player.m_localPlayer.m_buildPieces?.GetSelectedPiece()?.name; // Try to get a KeyHint for the item and piece selected or just the item without a piece KeyHintConfig hintConfig = null; if (!string.IsNullOrEmpty(pieceName)) { KeyHints.TryGetValue($"{prefabName}:{pieceName}", out hintConfig); } if (hintConfig == null) { KeyHints.TryGetValue(prefabName, out hintConfig); } if (hintConfig == null) { return(false); } // Try to get the hint object, if the keyhint is "dirty" (i.e. some config backed button changed), destroy the hint object if (KeyHintObjects.TryGetValue(hintConfig.ToString(), out var hintObject) && hintConfig.Dirty) { Object.DestroyImmediate(hintObject); } // Display the KeyHint instead the vanilla one or remove the config if it fails if (!hintObject) { try { hintObject = CreateKeyHintObject(hintConfig); } catch (Exception ex) { Logger.LogWarning($"Exception caught while creating KeyHint {hintConfig}: {ex}"); KeyHints.Remove(hintConfig.ToString()); return(false); } } if (!hintObject.activeSelf) { self.m_buildHints.SetActive(false); self.m_combatHints.SetActive(false); KeyHintObjects.Values.Where(x => x.activeSelf).Do(x => x.SetActive(false)); hintObject.SetActive(true); } return(true); } if (!UseCustomKeyHint()) { KeyHintObjects.Values.Where(x => x.activeSelf).Do(x => x.SetActive(false)); return(true); } return(false); }