Fixed helmet bug. Made utility function for hotkey tooltips.
This commit is contained in:
1 parent
56f526db48
commit
4048416175
16 files changed
+53
-29
No files matched your search
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories
|
||||
"+40 max life\n" +
|
||||
"Grants a supreme holy flame dash\n" +
|
||||
"Can be used to ram enemies\n" +
|
||||
"This line is modified below\n" +
|
||||
"TOOLTIP LINE HERE\n" +
|
||||
"Activating this buff will reduce your movement speed and increase enemy aggro\n" +
|
||||
"10% damage reduction while submerged in liquid\n" +
|
||||
"Toggle visibility of this accessory to enable/disable the dash");
|
||||
@@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
string hotkey = CalamityMod.AegisHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.AegisHotKey.GetAssignedKeys()[0] : "N";
|
||||
string hotkey = CalamityMod.AegisHotKey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line2 in list)
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip5")
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories
|
||||
"If this effect triggers you get healed for the projectile's damage\n" +
|
||||
"Boosts life regen even while under the effects of a damaging debuff\n" +
|
||||
"While under the effects of a damaging debuff you will gain 20 defense\n" +
|
||||
"This line is modified below");
|
||||
"TOOLTIP LINE HERE");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
string hotkey = CalamityMod.AstralArcanumUIHotkey.GetAssignedKeys().Count > 0 ? CalamityMod.AstralArcanumUIHotkey.GetAssignedKeys()[0] : "O";
|
||||
string hotkey = CalamityMod.AstralArcanumUIHotkey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line2 in list)
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip6")
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories
|
||||
DisplayName.SetDefault("Celestial Jewel");
|
||||
Tooltip.SetDefault("Boosts life regen even while under the effects of a damaging debuff\n" +
|
||||
"While under the effects of a damaging debuff you will gain 20 defense\n" +
|
||||
"This line is modified below");
|
||||
"TOOLTIP LINE HERE");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
string hotkey = CalamityMod.AstralTeleportHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.AstralTeleportHotKey.GetAssignedKeys()[0] : "P";
|
||||
string hotkey = CalamityMod.AstralTeleportHotKey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line2 in list)
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip2")
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories
|
||||
"+40 max life and increased life regen\n" +
|
||||
"Grants a supreme holy flame dash\n" +
|
||||
"Can be used to ram enemies\n" +
|
||||
"This line is modified below\n" +
|
||||
"TOOLTIP LINE HERE\n" +
|
||||
"Activating this buff will reduce your movement speed and increase enemy aggro\n" +
|
||||
"Toggle visibility of this accessory to enable/disable the dash");
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
string hotkey = CalamityMod.AegisHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.AegisHotKey.GetAssignedKeys()[0] : "N";
|
||||
string hotkey = CalamityMod.AegisHotKey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line2 in list)
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip5")
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Momentum Capacitor");
|
||||
Tooltip.SetDefault("This line is modified below\n" +
|
||||
Tooltip.SetDefault("TOOLTIP LINE HERE\n" +
|
||||
"Rogue projectiles that enter the field get a constant acceleration and 15% damage boost\n" +
|
||||
"These boosts can only happen to a projectile once\n" +
|
||||
"There can only be one field");
|
||||
@@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
string hotkey = CalamityMod.MomentumCapacitatorHotkey.GetAssignedKeys().Count > 0 ? CalamityMod.MomentumCapacitatorHotkey.GetAssignedKeys()[0] : "U";
|
||||
string hotkey = CalamityMod.MomentumCapacitatorHotkey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line2 in list)
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip0")
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories
|
||||
DisplayName.SetDefault("Plagued Fuel Pack");
|
||||
Tooltip.SetDefault("5% increased rogue damage\n" +
|
||||
"15% increased rogue projectile velocity\n" +
|
||||
"Press Q to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of plagued clouds\n" +
|
||||
"TOOLTIP LINE HERE" +
|
||||
"This effect has a 3 second cooldown before it can be used again");
|
||||
}
|
||||
|
||||
@@ -33,16 +33,14 @@ namespace CalamityMod.Items.Accessories
|
||||
player.Calamity().plaguedFuelPack = true;
|
||||
}
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> tooltips)
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
if (CalamityMod.PlaguePackHotKey.GetAssignedKeys().Count > 0)
|
||||
string hotkey = CalamityMod.PlaguePackHotKey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line in list)
|
||||
{
|
||||
foreach (TooltipLine line in tooltips)
|
||||
if (line.mod == "Terraria" && line.Name == "Tooltip2")
|
||||
{
|
||||
if (line.mod == "Terraria" && line.Name == "Tooltip2")
|
||||
{
|
||||
line.text = "Press " + CalamityMod.PlaguePackHotKey.GetAssignedKeys()[0] + " to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of plagued clouds";
|
||||
}
|
||||
line.text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of plagued clouds";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
DisplayName.SetDefault("Sand Cloak");
|
||||
Tooltip.SetDefault("+1 defense and 5% increased movement speed\n" +
|
||||
"This line is modified below\n" +
|
||||
"TOOLTIP LINE HERE\n" +
|
||||
"This effect has a 30 second cooldown before it can be used again");
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
string hotkey = CalamityMod.SandCloakHotkey.GetAssignedKeys().Count > 0 ? CalamityMod.SandCloakHotkey.GetAssignedKeys()[0] : "C";
|
||||
string hotkey = CalamityMod.SandCloakHotkey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line2 in list)
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip1")
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
DisplayName.SetDefault("Spectral Veil");
|
||||
Tooltip.SetDefault("The inside of the cloak is full of teeth...\n" +
|
||||
"This line is modified below\n" +
|
||||
"TOOLTIP LINE HERE\n" +
|
||||
"Teleportation is disabled while Chaos State is active\n" +
|
||||
"If you dodge something while invulnerable, you instantly gain full stealth");
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
string hotkey = CalamityMod.SpectralVeilHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.SpectralVeilHotKey.GetAssignedKeys()[0] : "Z";
|
||||
string hotkey = CalamityMod.SpectralVeilHotKey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line2 in list)
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip1")
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.bloodflareSet = true;
|
||||
modPlayer.bloodflareRanged = true;
|
||||
string hotkey = CalamityMod.TarraHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.TarraHotKey.GetAssignedKeys()[0] : "Y";
|
||||
string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString();
|
||||
player.setBonus = "Greatly increases life regen\n" +
|
||||
"Enemies below 50% life have a chance to drop hearts when struck\n" +
|
||||
"Enemies above 50% life have a chance to drop mana stars when struck\n" +
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace CalamityMod.Items.Armor
|
||||
modPlayer.brimflameSet = true;
|
||||
player.magicDamage += 0.15f;
|
||||
player.magicCrit += 15;
|
||||
string hotkey = CalamityMod.TarraHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.TarraHotKey.GetAssignedKeys()[0] : "Y";
|
||||
string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString();
|
||||
player.setBonus = "Grants an additional 15% increased damage and magic crit\n" +
|
||||
"Press " + hotkey + " to trigger a brimflame frenzy effect\n" +
|
||||
"While under this effect, your damage is significantly boosted\n" +
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor
|
||||
|
||||
public override void UpdateArmorSet(Player player)
|
||||
{
|
||||
string hotkey = CalamityMod.TarraHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.TarraHotKey.GetAssignedKeys()[0] : "Y";
|
||||
string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString();
|
||||
player.setBonus = "100% increased minion damage\n" +
|
||||
"All attacks inflict the demon flame debuff\n" +
|
||||
"Shadowbeams and demon scythes will fire down when you are hit\n" +
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace CalamityMod.Items.Armor
|
||||
|
||||
public override void UpdateArmorSet(Player player)
|
||||
{
|
||||
string hotkey = CalamityMod.TarraHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.TarraHotKey.GetAssignedKeys()[0] : "Y";
|
||||
string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString();
|
||||
player.setBonus = "Increases armor penetration by 50\n" +
|
||||
"10% increased damage and critical strike chance\n" +
|
||||
"Short-ranged tentacles heal you by sucking enemy life\n" +
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace CalamityMod.Items.Armor
|
||||
|
||||
public override void UpdateArmorSet(Player player)
|
||||
{
|
||||
string hotkey = CalamityMod.TarraHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.TarraHotKey.GetAssignedKeys()[0] : "Y";
|
||||
string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString();
|
||||
player.setBonus = "25% reduced ammo usage and 5% increased flight time\n" +
|
||||
"Enemies receive 10% more damage from ranged projectiles when afflicted by the Plague\n" +
|
||||
"Getting hit causes the plague cinders to rain from above\n" +
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace CalamityMod.Items.Armor
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.tarraSet = true;
|
||||
modPlayer.tarraMelee = true;
|
||||
string hotkey = CalamityMod.TarraHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.TarraHotKey.GetAssignedKeys()[0] : "Y";
|
||||
string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString();
|
||||
player.setBonus = "Increased heart pickup range\n" +
|
||||
"Enemies have a chance to drop extra hearts on death\n" +
|
||||
"You have a 25% chance to gain a life regen buff when you take damage\n" +
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CalamityMod.Items
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
string hotkey = CalamityMod.NormalityRelocatorHotKey.GetAssignedKeys().Count > 0 ? CalamityMod.NormalityRelocatorHotKey.GetAssignedKeys()[0] : "Z";
|
||||
string hotkey = CalamityMod.NormalityRelocatorHotKey.TooltipHotkeyString();
|
||||
foreach (TooltipLine line2 in list)
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip1")
|
||||
|
||||
@@ -231,6 +231,32 @@ namespace CalamityMod
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the given ModHotKey into a string for insertion into item tooltips.<br></br>
|
||||
/// This allows the user's actual keybind choices to be shown to them in tooltips.
|
||||
/// </summary>
|
||||
/// <param name="mhk">The ModHotKey to convert to a string.</param>
|
||||
/// <returns></returns>
|
||||
public static string TooltipHotkeyString(this ModHotKey mhk)
|
||||
{
|
||||
if (Main.dedServ || mhk is null)
|
||||
return "";
|
||||
|
||||
List<string> keys = mhk.GetAssignedKeys();
|
||||
if (keys.Count == 0)
|
||||
return "[NONE]";
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(16);
|
||||
sb.Append(keys[0]);
|
||||
|
||||
// In almost all cases, this code won't run, because there won't be multiple bindings for the hotkey. But just in case...
|
||||
for (int i = 1; i < keys.Count; ++i)
|
||||
sb.Append(" / ").Append(keys[i]);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private const float WorldInsertionOffset = 15f;
|
||||
/// <summary>
|
||||
/// If the given item is outside the world, force it to be within the world boundaries.
|
||||
|
||||
Reference in new issue
Block a user