diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 9830d5d689..9f596ebdba 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -16,6 +16,7 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -29,7 +30,26 @@ namespace CalamityMod.Items #region Main ModifyTooltips Function public override void ModifyTooltips(Item item, List tooltips) { - // Apply rarity coloration to the item's name. + // Get the first index, last index and total count of standard vanilla tooltip lines. + // The first index and count are used to delete all vanilla tooltips when holding SHIFT, if requested. + // The last index is used to insert various extra tooltip lines in the right position. + // + // This code used to be in the HoldShiftTooltip utility, but is needed to correctly place other tooltips. + int firstTooltipIndex = -1; + int lastTooltipIndex = -1; + int standardTooltipCount = 0; + for (int i = 0; i < tooltips.Count; i++) + { + if (tooltips[i].Name.StartsWith("Tooltip")) + { + if (firstTooltipIndex == -1) + firstTooltipIndex = i; + lastTooltipIndex = i; + standardTooltipCount++; + } + } + + // Apply custom rarity coloration to the item's name if applicable. TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.Mod == "Terraria"); if (nameLine != null) ApplyRarityColor(item, nameLine); @@ -40,20 +60,21 @@ namespace CalamityMod.Items // Adds "Does extra damage to enemies shot at point-blank range" to weapons capable of it. if (canFirePointBlankShots) { - TooltipLine line = new TooltipLine(Mod, "PointBlankShot", "Does extra damage to enemies shot at point-blank range"); - tooltips.Add(line); + var lineText = CalamityUtils.GetText("Misc.PointBlank"); + TooltipLine line = new TooltipLine(Mod, "CalamityMod:PointBlankTooltip", lineText.Value); + tooltips.Insert(++lastTooltipIndex, line); } - // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the - // tooltip list. + // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the tooltip list. EnchantmentTooltips(item, tooltips); - // Replace rogue with rouge in gfb + // In GFB, replace all instances of "rogue" with "rouge". if (Main.zenithWorld) { tooltips.FindAndReplace("Rogue", "Rouge"); tooltips.FindAndReplace("rogue", "rouge"); } + // Everything below this line can only apply to modded items. If the item is vanilla, stop here for efficiency. if (item.type < ItemID.Count) return; @@ -65,27 +86,68 @@ namespace CalamityMod.Items // Convert current charge ratio into a percentage. float displayedPercent = ChargeRatio * 100f; TooltipLine line = new TooltipLine(Mod, "CalamityCharge", $"Current Charge: {displayedPercent:N1}%"); - tooltips.Add(line); + tooltips.Insert(++lastTooltipIndex, line); + } + + // Generic support for any and all Hold SHIFT tooltips. + // For more information, see IHoldShiftTooltipItem. + if (item.ModItem is IHoldShiftTooltipItem holdShiftItem) + { + string dynamicKey = $"{Mod.Name}:{item.ModItem.Name}_HoldShift"; + string lineText = item.ModItem.GetLocalizedValue(holdShiftItem.TooltipExtensionKey); + var line = new TooltipLine(Mod, dynamicKey, lineText); + if (holdShiftItem.TooltipExtensionColor is not null) + line.OverrideColor = holdShiftItem.TooltipExtensionColor; + TooltipLine[] lines = { line }; + + // + // Original code lifted from Iban's extended armor tooltips. + // + bool holdingShift = Main.keyState.IsKeyDown(Keys.LeftShift); + + // If holding SHIFT, actually display the extended tooltip. + if (holdingShift && firstTooltipIndex != -1) + { + // If asked to, remove all standard tooltip lines. This moves the last tooltip index. + if (holdShiftItem.HidesNormalTooltip) + { + tooltips.RemoveRange(firstTooltipIndex, standardTooltipCount); + lastTooltipIndex -= standardTooltipCount; + } + + // Append every "Hold SHIFT" tooltip at the end of standard tooltips. + tooltips.InsertRange(++lastTooltipIndex, lines); + } + + // If not holding SHIFT, display the extension indicator if appropriate. + if (!holdingShift && holdShiftItem.ShowExtensionIndicator) + { + LocalizedText indicatorText = CalamityUtils.GetText(holdShiftItem.ExtensionIndicatorKey); + var indicator = new TooltipLine(Mod, IHoldShiftTooltipItem.ExtensionIndicatorTooltipID, indicatorText.Value); + if (holdShiftItem.ExtensionIndicatorColor is not null) + indicator.OverrideColor = holdShiftItem.ExtensionIndicatorColor; + tooltips.Insert(++lastTooltipIndex, indicator); + } } // Adds "Donor Item" and "Developer Item" to donor items and developer items respectively. - if (donorItem) - { - TooltipLine line = new TooltipLine(Mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", CalamityUtils.DonatorItemColor)); - tooltips.Add(line); - } + // This is intentionally at the bottom, below everything else. if (devItem) { TooltipLine line = new TooltipLine(Mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.DevItemColor)); tooltips.Add(line); } + else if (donorItem) + { + TooltipLine line = new TooltipLine(Mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", CalamityUtils.DonatorItemColor)); + tooltips.Add(line); + } } #endregion #region Rarity Coloration - private void ApplyRarityColor(Item item, TooltipLine nameLine) + private static void ApplyRarityColor(Item item, TooltipLine nameLine) { - #region Uniquely Colored Items if (item.type == ModContent.ItemType()) nameLine.OverrideColor = Color.Lerp(Color.Red, Color.White, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f); if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) @@ -192,7 +254,6 @@ namespace CalamityMod.Items nameLine.OverrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); } } - #endregion } #endregion diff --git a/Items/IHoldShiftTooltipItem.cs b/Items/IHoldShiftTooltipItem.cs new file mode 100644 index 0000000000..afd8537be5 --- /dev/null +++ b/Items/IHoldShiftTooltipItem.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items +{ + // This interface is used on items where you can hold Left SHIFT for an expanded tooltip. + // All actual implementation of this behavior is done in CalamityGlobalItemTooltip. + public interface IHoldShiftTooltipItem + { + /// + /// Internal ID for the TooltipLine which contains Calamity items' "Hold SHIFT" extension indicators. + /// + internal const string ExtensionIndicatorTooltipID = "CalamityMod:HoldShiftExtensionIndicator"; + + /// + /// The lang/localization key of the default tooltip extension indicator message. + /// + public const string DefaultExtensionIndicatorKey = "UI.HoldShiftTooltipExtensionIndicator"; + + /// + /// The default color of the default tooltip extension indicator message. + /// + public static readonly Color DefaultExtensionIndicatorColor = new Color(184, 184, 184); // #B8B8B8 + + /// + /// The default lang/localization key which is queried to show an item's tooltip extension. + /// + public const string DefaultTooltipExtensionKey = "HoldShiftTooltip"; + + /// + /// Whether holding Left SHIFT for the tooltip extension hides the normal tooltip. Typically this is false. + /// + public virtual bool HidesNormalTooltip => false; + + /// + /// Whether the "Hold SHIFT for more" extension indicator appears by default. Should essentially always be true.
+ /// You can set this to false for "secret" flavor or easter egg tooltips, like the one on Midas Prime. + ///
+ public virtual bool ShowExtensionIndicator => true; + + /// + /// The lang/localization key of this item's tooltip extension indicator message. + /// + public virtual string ExtensionIndicatorKey => DefaultExtensionIndicatorKey; + + /// + /// The color of this item's tooltip extension indicator message. If set to null, the indicator will not be colored. + /// + public virtual Color? ExtensionIndicatorColor => DefaultExtensionIndicatorColor; + + /// + /// The lang/localization key which this item uses for its tooltip extension. + /// + public virtual string TooltipExtensionKey => DefaultTooltipExtensionKey; + + /// + /// The color of this item's tooltip extension. If set to null, the tooltip extension will not be colored. + /// + public virtual Color? TooltipExtensionColor => null; + + } +} diff --git a/Items/LoreItems/LoreItem.cs b/Items/LoreItems/LoreItem.cs index ef983c0434..193dde3a8f 100644 --- a/Items/LoreItems/LoreItem.cs +++ b/Items/LoreItems/LoreItem.cs @@ -1,21 +1,25 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { - public abstract class LoreItem : ModItem, ILocalizedModType + public abstract class LoreItem : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Lore"; - // All lore items initially have a short tooltip which indicates there is more to be read. - public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.ShortTooltip"); + // When holding SHIFT on a lore item, the default tooltip is removed entirely. + public bool HidesNormalTooltip => true; - // By default, lore text appears in white, but this can be changed. - public virtual Color? LoreColor => null; + // Lore items have a flavorful extension indicator tooltip. + public string ExtensionIndicatorKey => $"{LocalizationCategory}.ShortTooltip"; + + // Each line of the extension indicator tooltip is manually colored, so don't provide an override color. + public Color? ExtensionIndicatorColor => null; + + // The localization key for all lore items' full lore content is just "Lore". + public string TooltipExtensionKey => "Lore"; public override void SetStaticDefaults() { @@ -30,14 +34,5 @@ namespace CalamityMod.Items.LoreItems { itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.LoreItems; } - - // All lore items use the same code for holding SHIFT to extend tooltips. - public override void ModifyTooltips(List tooltips) - { - TooltipLine fullLore = new(Mod, "CalamityMod:Lore", this.GetLocalizedValue("Lore")); - if (LoreColor.HasValue) - fullLore.OverrideColor = LoreColor.Value; - CalamityUtils.HoldShiftTooltip(tooltips, new TooltipLine[] { fullLore }, true); - } } } diff --git a/Items/Weapons/Ranged/MidasPrime.cs b/Items/Weapons/Ranged/MidasPrime.cs index 0a15438517..80ec7fb0ed 100644 --- a/Items/Weapons/Ranged/MidasPrime.cs +++ b/Items/Weapons/Ranged/MidasPrime.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -10,9 +9,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class MidasPrime : ModItem, ILocalizedModType + public class MidasPrime : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + // The Hold SHIFT tooltip is an easter egg and is not indicated to the player in any way. + public bool ShowExtensionIndicator => false; + + // Easter egg has a special tooltip key and color. + public string TooltipExtensionKey => "UltrakillEasterEgg"; + public Color? TooltipExtensionColor => Color.Red; + internal static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/CrackshotColtShot") { Volume = 0.5f, PitchVariance = 0.1f }; // Internal storage used to keep track between UseItem and Shoot hooks whether a gold coin was queued up @@ -138,14 +145,6 @@ namespace CalamityMod.Items.Weapons.Ranged return base.Shoot(player, source, position, velocity, type, damage, knockback); } - #region Hidden ULTRAKILL Reference Tooltip - public override void ModifyTooltips(List tooltips) - { - TooltipLine ultrakillIntro = new TooltipLine(Mod, "CalamityMod:UltrakillIntroReference", this.GetLocalizedValue("UltrakillEasterEgg")) { OverrideColor = Color.Red }; - CalamityUtils.HoldShiftTooltip(tooltips, new TooltipLine[] { ultrakillIntro }); - } - #endregion - // Make the gun have visible recoil when fired for extra cool factor. #region Firing Animation public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Weapons/Rogue/NanoblackReaper.cs b/Items/Weapons/Rogue/NanoblackReaper.cs index cc1a2987ba..a6a56bbc4a 100644 --- a/Items/Weapons/Rogue/NanoblackReaper.cs +++ b/Items/Weapons/Rogue/NanoblackReaper.cs @@ -12,8 +12,11 @@ namespace CalamityMod.Items.Weapons.Rogue { // Deny me no longer! [LegacyName("NanoblackReaperMelee", "NanoblackReaperRogue")] - public class NanoblackReaper : RogueWeapon + public class NanoblackReaper : RogueWeapon, IHoldShiftTooltipItem { + public bool ShowExtensionIndicator => false; + public Color? TooltipExtensionColor => new Color(31, 223, 128); // #1FDF80 + public static float Knockback = 9f; public static float Speed = 16f; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson index 90e1bb38a2..fad6ef1784 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson @@ -17,6 +17,7 @@ LoreAbyss: { Her great roots continue to thrash and tear at the impossibly dense stone, growing uncontrollably. She will soon remake it in her image. I can think of no worse fate for this accursed, hadal domain. ''' + Tooltip: "" } LoreAquaticScourge: { @@ -29,6 +30,7 @@ LoreAquaticScourge: { What a stark contrast to the rest of the ecosystem. Nearly every other creature in the Sulphur Sea is hostile. A shame that its last bastion of tranquility has fallen. ''' + Tooltip: "" } LoreArchmage: { @@ -42,6 +44,7 @@ LoreArchmage: { As my crusade evolved and my ambitions grew, he expressed vehement disapproval. Where justice was once seen, tyranny had blinded it. He departed along with the Witch not long after. ''' + Tooltip: "" } LoreAstralInfection: { @@ -57,6 +60,7 @@ LoreAstralInfection: { Those whose minds can grasp the true form of the universe are largely immune. They cannot be starstruck by a supposed higher truth, let alone one preached by a pustule. ''' + Tooltip: "" } LoreAstrumAureus: { @@ -70,6 +74,7 @@ LoreAstrumAureus: { However… even the finest silicon is not beyond its reach. Draedon prefers his creations to serve after all. With this experiment concluded, he will certainly be examining you next. Watch yourself. ''' + Tooltip: "" } LoreAstrumDeus: { @@ -83,6 +88,7 @@ LoreAstrumDeus: { Thankfully, such a grandiose being that walks amongst the stars is likely not truly dead. While the land has paid a terrible price, the price of a wrongful conviction is higher still. ''' + Tooltip: "" } LoreAwakening: { @@ -95,6 +101,7 @@ LoreAwakening: { Look upon my works, as they are… Ruined. None would dare seek me out; tread my path. Naught awaits them in this cruel world. ''' + Tooltip: "" } LoreAzafure: { @@ -107,6 +114,7 @@ LoreAzafure: { It pains me to say this even in hindsight, but their own artisanry paved the downfall of the entire city. For the Witch and I… the air here will forever be laden with regret. There is nothing to be done. ''' + Tooltip: "" } LoreBloodMoon: { @@ -119,6 +127,7 @@ LoreBloodMoon: { Those with fire in their veins may strike out on their own, to revel in the slaughter. That is how I remember the sleepless nights from my younger days… Knee deep in corpses. ''' + Tooltip: "" } LoreBrainofCthulhu: { @@ -130,6 +139,7 @@ LoreBrainofCthulhu: { My decimation of the falsely divine left many old horrors unconstrained, with new ones birthed every year. Now, they are your stepping stones. ''' + Tooltip: "" } LoreBrimstoneElemental: { @@ -145,6 +155,7 @@ LoreBrimstoneElemental: { They fought to a standstill, fire against fire. Neither were victorious, with the city razed by flames despite her intentions. ''' + Tooltip: "" } LoreCalamitas: { @@ -163,6 +174,7 @@ LoreCalamitas: { The weight of her deeds haunts her to this day. She despises me, and I cannot blame her. Please, if you would... show her respect where I did not. ''' + Tooltip: "" } LoreCalamitasClone: { @@ -175,6 +187,7 @@ LoreCalamitasClone: { Surely Calamitas would want nothing to do with such a project. I know not how it wields her brimstone magic. Perhaps some day one of us may find answers. ''' + Tooltip: "" } LoreCeaselessVoid: { @@ -190,6 +203,7 @@ LoreCeaselessVoid: { Its eerie persistence gnawed at my mind. It did not just threaten me. It threatened everyone. Everything. Even when faced with blatant lies and harrowing danger, I simply walked away and did not return…. ''' + Tooltip: "" } LoreCorruption: { @@ -200,6 +214,7 @@ LoreCorruption: { Having slain my first Gods, I turned a blind eye as corrupt essence gushed from their rent forms and burrowed into the bowels of Terraria. The mere existence of this putrid place proves that the Gods of old were beyond redemption. ''' + Tooltip: "" } LoreCrabulon: { @@ -210,6 +225,7 @@ LoreCrabulon: { These mushrooms possess a disturbing amount of tenacity. Nothing that lays down to die in their domain is left to rest. It is this sort of ghastly, forceful exertion of control over the unwilling that led me down my path. ''' + Tooltip: "" } LoreCrimson: { @@ -220,6 +236,7 @@ LoreCrimson: { The essence of a God does not simply vanish when the body dies. It must be properly disposed of or destroyed entirely. Essence of a pious God could never fester into a mire as dreadful as this. ''' + Tooltip: "" } LoreCynosure: { @@ -236,6 +253,7 @@ LoreCynosure: { When you are prepared: seek the grave of the Light, at the summit of the Dragon Aerie. I await your challenge. ''' + Tooltip: "" } LoreDesertScourge: { @@ -246,6 +264,7 @@ LoreDesertScourge: { After Ilmeris was incinerated, it became familiar with the hunt. To survive, it quickly learned to seek greater prey. Unfortunately for the scourge, it seems that it too was prey in the end. After all, there is always a bigger fish in the sea. ''' + Tooltip: "" } LoreDestroyer: { @@ -259,6 +278,7 @@ LoreDestroyer: { Draedon understood well and granted them these massive forms. Bristling with weaponry and interlocked armor forged of blessed metal. While in truth it was repurposed mining equipment, their sheer presence on the battlefield was immense. ''' + Tooltip: "" } LoreDevourerofGods: { @@ -275,6 +295,7 @@ LoreDevourerofGods: { The Devourer's alien capabilities and domineering tactics hint that his allegiance lay elsewhere. Is he but one soldier, a mere pawn of a malevolence far beyond…? ''' + Tooltip: "" } LoreDragonfolly: { @@ -289,6 +310,7 @@ LoreDragonfolly: { It is known that Fishrons, Follies, and the Abyssal Wyrms survived the purging hunts of the Deific Era. Notably, they now are all reclusive or exceedingly violent. It is tragic how they evolved to be that way. ''' + Tooltip: "" } LoreDukeFishron: { @@ -301,6 +323,7 @@ LoreDukeFishron: { While there are many such tales of creatures hailing from draconic descent, this case is factual. Genetic heritage or not: the Fishrons lack Dragonblood and Auric souls. I would well know. ''' + Tooltip: "" } LoreEaterofWorlds: { @@ -312,6 +335,7 @@ LoreEaterofWorlds: { One will not need to search long for examples. We are all surrounded by rampant superstition and assumption. I myself have been subjected to a litany of baseless boasts and accusations in my time. ''' + Tooltip: "" } LoreEmpressofLight: { @@ -325,6 +349,7 @@ LoreEmpressofLight: { It made her sickeningly obedient. Dependent, but willingly so as they enabled her to slake her base thirst. I had deigned to slay her myself for her treachery, but she was a notoriously evasive mark. ''' + Tooltip: "" } LoreExoMechs: { @@ -341,6 +366,7 @@ LoreExoMechs: { Were he to lose his temper: if he even has one, all of life's hopes would be smothered in an instant, silenced by a torrent of silicon. Though, perhaps you may leverage his unimaginable craft to your advantage, and seek insight from him. ''' + Tooltip: "" } LoreEyeofCthulhu: { @@ -351,6 +377,7 @@ LoreEyeofCthulhu: { Now they run rampant, spawning from vile influences left unchecked. They blend well with the horrific injustice of their forebears. Slaying one merely paves the way for a dozen more. Surely this does not concern you, either. ''' + Tooltip: "" } LoreGolem: { @@ -364,6 +391,7 @@ LoreGolem: { While I believe this insignificant construct deserves no mention, the Lihzahrds revere it unflinchingly. I see no need to intervene in affairs beneath me and my people. ''' + Tooltip: "" } LoreHiveMind: { @@ -375,6 +403,7 @@ LoreHiveMind: { Fortunately for us, the futility of this effort is unmatched. The biomass obeys; even though nothing is accomplished. Divine power is known to be rooted in faith. Gods are forged of their own strength, and the mindless spread of corruption is its own foul reverence. ''' + Tooltip: "" } LoreKingSlime: { @@ -385,6 +414,7 @@ LoreKingSlime: { There is little need to worry about this. Naturally, slimes are nearly mindless and amass only by chance. Though it appears they are capable of absorbing knowledge, if only in rudimentary form. ''' + Tooltip: "" } LoreLeviathanAnahita: { @@ -398,6 +428,7 @@ LoreLeviathanAnahita: { Regardless of what you believe, they are inseparable even in death. Such stalwart loyalty! It reminds me of Yharon. ''' + Tooltip: "" } LoreMechs: { @@ -411,6 +442,7 @@ LoreMechs: { I dismissed them from duty, yet they linger here still. Scouring the land for evidence of the divine. Unfortunately for you that puts you in their crosshairs. Give them a battle worth dying in. ''' + Tooltip: "" } LoreOldDuke: { @@ -424,6 +456,7 @@ LoreOldDuke: { This particular Duke's guile is self-evident: It evaded centuries of hunting, and until now had survived a most thorough poisoning. Above almost all others, this creature was a living fable. One must wonder what goes through the mind of a fading legend…. ''' + Tooltip: "" } LorePerforators: { @@ -435,6 +468,7 @@ LorePerforators: { The mire reeks of centuries of vile manipulation and callous domination of the hapless. Judgment has long passed and only extinction is left waiting. ''' + Tooltip: "" } LorePlaguebringerGoliath: { @@ -449,6 +483,7 @@ LorePlaguebringerGoliath: { In my later days I was far from virtuous. But I would never shackle a creature to fight in my name. That would make me no better than the divine scoundrels I pursued. ''' + Tooltip: "" } LorePlantera: { @@ -463,6 +498,7 @@ LorePlantera: { Now that you have slain it, more disorderly spiritual energies are flooding the lands. The village's ignorance was shameful in its own right, but this is worse still. ''' + Tooltip: "" } LorePolterghast: { @@ -478,6 +514,7 @@ LorePolterghast: { The dragon cult was furious, their leader demanding I put the haunt down myself. I did not answer. I had long since become deaf to the world outside my crusade. Do not fall as I have. ''' + Tooltip: "" } LorePrelude: { @@ -493,6 +530,7 @@ LorePrelude: { Zeratros himself was gravely injured. It seemed his power, along with his life, would be lost forever. One mortal, sworn to the service of the Dragons, rose in determination to save their virtuous King. ''' + Tooltip: "" } LoreProfanedGuardians: { @@ -505,6 +543,7 @@ LoreProfanedGuardians: { After all, it was you that finished off the star-spawned horror that catalyzed the downfall of the Dragons. Draw her out from hiding. Have no mercy, for the Profaned Goddess shows none herself. ''' + Tooltip: "" } LoreProvidence: { @@ -519,6 +558,7 @@ LoreProvidence: { Those devoted to her were weak-willed, yet she reigned as one of the mightiest Gods. Perhaps it was their easily-swayed nature that let her draw so much power from them…. ''' + Tooltip: "" } LoreQueenBee: { @@ -530,6 +570,7 @@ LoreQueenBee: { Though its death is understandable given the circumstances, I do feel pity for these majestic beings. Fate was cruel to many of their kind. ''' + Tooltip: "" } LoreQueenSlime: { @@ -541,6 +582,7 @@ LoreQueenSlime: { Or perhaps it was overcome by desperation for survival. A glorious hunt, a fine foe. Now you know that you must chase them to the ends of Terraria. ''' + Tooltip: "" } LoreRavager: { @@ -555,6 +597,7 @@ LoreRavager: { Now caked in fresh blood, it hungered for more, setting off on an aimless rampage. I suppose its brutality serves as a reminder to be careful what you believe. ''' + Tooltip: "" } LoreRequiem: { @@ -571,6 +614,7 @@ LoreRequiem: { Wherever your journey may lead, whether you are with me or against…. May fortune favor you. For nothing else will. ''' + Tooltip: "" } LoreSignus: { @@ -585,6 +629,7 @@ LoreSignus: { The serpent ensnared both my assailants in a dimensional vortex. Assuring me they were as good as dead. Yet, Statis must have struck a bargain with Signus. He escaped his banishment unscathed. ''' + Tooltip: "" } LoreSkeletron: { @@ -596,6 +641,7 @@ LoreSkeletron: { The very walls of that place are cursed further still. The magic has long since faded as the soldiers rotted within. Do not expect to learn much from those tarnished tomes. They were penned with misguided zeal. ''' + Tooltip: "" } LoreSkeletronPrime: { @@ -608,6 +654,7 @@ LoreSkeletronPrime: { Leveling places of worship and torching those falsely devout, their expertise lay in unmaking faith with flame. Draedon understood this well. For them he crafted a visage so grim, it evoked oblivion itself. ''' + Tooltip: "" } LoreSlimeGod: { @@ -620,6 +667,7 @@ LoreSlimeGod: { Alas, the Slime god is wise enough to be cowardly. Fleeing battles it cannot win when its servants are vanquished. Perhaps fortune will aid you if you catch it unaware. ''' + Tooltip: "" } LoreStormWeaver: { @@ -634,6 +682,7 @@ LoreStormWeaver: { In his mind, the lesser serpent's similar powers could lead it to be too threatening for him to let live. Little does he know, he has forever stood in a similar position. He thinks himself invincible after all. ''' + Tooltip: "" } LoreSulphurSea: { @@ -646,6 +695,7 @@ LoreSulphurSea: { Long considered uninhabitable, its further deterioration led Draedon to designate it as a dumping ground. Years of careless waste disposal has now left the coast's transformation irreversible. ''' + Tooltip: "" } LoreTwins: { @@ -659,6 +709,7 @@ LoreTwins: { His assistance was infallible, his calculus cold and cruel. Not even the most evasive target stood a chance. ''' + Tooltip: "" } LoreUnderworld: { @@ -671,6 +722,7 @@ LoreUnderworld: { Yet despite being surrounded by magma, Azafure simply burned when their wishes were not met. Such is the unfortunate price of war, though I have no regrets fighting for my people. ''' + Tooltip: "" } LoreWallofFlesh: { @@ -684,6 +736,7 @@ LoreWallofFlesh: { My methods have since evolved. I need not contain such essences, when they can be devoured. May you channel my valor in combating the resulting outpour of energies. ''' + Tooltip: "" } LoreYharon: { @@ -705,4 +758,5 @@ LoreYharon: { Now, that hope is long withered. I am but a husk of the hero I once was, and this is the ultimate proof. Yharon may yet return, as he does, but he… he has bade me farewell. ''' + Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 69ed27ce98..f3b984bfb6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -777,6 +777,7 @@ NanoblackReaper: { Stealth strikes cause the scythe to create a large amount of homing afterimages instead of energy blades 'She smothered them in Her hatred' ''' + HoldShiftTooltip: "'He who picks up the pen writes the script. She plans to never let go.'" } NastyCholla: { diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 4a836bc149..0066b7de9b 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -56,3 +56,5 @@ EtherealCoreText: You have already used an Ethereal Core. Your brain would escap PhantomHeartText: You have already used a Phantom Heart. The voices are telling you it's a bad idea to use it again. SulphurSwitchLeft: The Sulphurous Sea is now on the left side of the world. SulphurSwitchRight: The Sulphurous Sea is now on the right side of the world. +// Point Blank +PointBlank: Does extra damage to enemies shot at point-blank range diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 4037840c25..95bb12a359 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -614,3 +614,5 @@ DraedonFacility: Other minor research projects Abyss: Disposing of Silva's remains SulphurSea2: Irradiating one of the oceans Roxcalibur: I wanna rock +// Hold Shift tooltip default +HoldShiftTooltipExtensionIndicator: Hold "Left Shift" for more diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 1d227c7f80..acb0ed8438 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -333,51 +333,6 @@ namespace CalamityMod tooltips.FindAndReplace("[KEY]", finalKey); } - // Original code lifted from Iban's extended armor tooltips. - /// - /// Performs standard edits to a list of tooltip lines to add more if the Left SHIFT key is held down.
- /// Optionally, hides the normal tooltip to replace it entirely. - ///
- /// The tooltip list provided to a ModifyTooltips TML hook. - /// An array of tooltip lines to add. Instantiate these yourself with C# elaborate new syntax. - /// Set to true to replace the normal tooltip when holding SHIFT. Otherwise both tooltips will show at once. - public static void HoldShiftTooltip(List tooltips, TooltipLine[] holdShiftTooltips, bool hideNormalTooltip = false) - { - // Only perform any changes while holding SHIFT. - if (!Main.keyState.IsKeyDown(Keys.LeftShift)) - return; - - // Get the first index, last index and total count of standard vanilla tooltip lines. - // The first index and count are used to delete all vanilla tooltips when holding SHIFT, if requested. - // The last index is used to insert the "Hold SHIFT" tooltips in the right position. - int firstTooltipIndex = -1; - int lastTooltipIndex = -1; - int standardTooltipCount = 0; - for (int i = 0; i < tooltips.Count; i++) - { - if (tooltips[i].Name.StartsWith("Tooltip")) - { - if (firstTooltipIndex == -1) - firstTooltipIndex = i; - lastTooltipIndex = i; - standardTooltipCount++; - } - } - - if (firstTooltipIndex != -1) - { - // If asked to, remove all standard tooltip lines. This moves the last tooltip index. - if (hideNormalTooltip) - { - tooltips.RemoveRange(firstTooltipIndex, standardTooltipCount); - lastTooltipIndex -= standardTooltipCount; - } - - // Append every "Hold SHIFT" tooltip at the end of standard tooltips. - tooltips.InsertRange(lastTooltipIndex + 1, holdShiftTooltips); - } - } - private const float WorldInsertionOffset = 15f; /// /// If the given item is outside the world, force it to be within the world boundaries.