Cleaned up more tooltip editing

This commit is contained in:
IbanPlay committed 2022-03-16 01:02:01 +01:00
1 parent 9e431f7b57
commit e57c293cc0
8 files changed
+118 -261

No files matched your search

+1 -1
View File
@@ -122,7 +122,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void NetRecieve(BinaryReader reader)
{
Charge = reader.ReadInt32();
Charge = reader.ReadSingle();
}
public override void AddRecipes()
+1 -1
View File
@@ -200,7 +200,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void NetRecieve(BinaryReader reader)
{
Charge = reader.ReadInt32();
Charge = reader.ReadSingle();
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
+1 -1
View File
@@ -193,7 +193,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void NetRecieve(BinaryReader reader)
{
Charge = reader.ReadInt32();
Charge = reader.ReadSingle();
}
public override void AddRecipes()
+28 -42
View File
@@ -56,8 +56,8 @@ namespace CalamityMod.Items.Weapons.Melee
Tooltip.SetDefault("FUNCTION_DESC\n" +
"Hold down RMB while standing still on flat ground to attune the weapon to the powers of the surrounding biome\n" +
"Using RMB otherwise switches between the current attunement and an extra stored one\n" +
"Main attunement : None\n" +
"Secondary attunement: None\n"); //Theres potential for flavor text as well but im not a writer
"Main Attunement : [None]\n" +
"Secondary Attunement: [None]\n"); //Theres potential for flavor text as well but im not a writer
}
public override void ModifyTooltips(List<TooltipLine> list)
@@ -68,49 +68,35 @@ namespace CalamityMod.Items.Weapons.Melee
if (player is null)
return;
foreach (TooltipLine l in list)
var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria");
var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip3" && x.mod == "Terraria");
var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.mod == "Terraria");
//Default stuff
effectDescTooltip.text = "Does nothing..yet";
effectDescTooltip.overrideColor = new Color(163, 163, 163);
mainAttunementTooltip.text = "Main Attunement : [None]";
mainAttunementTooltip.overrideColor = new Color(163, 163, 163);
secondaryAttunementTooltip.text = "Secondary Attunement : [None]";
secondaryAttunementTooltip.overrideColor = new Color(163, 163, 163);
//If theres a main attunement
if (mainAttunement != null)
{
if (l.text.StartsWith("FUNCTION_DESC"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = mainAttunement.function_description;
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Does nothing.. yet";
}
}
effectDescTooltip.text = mainAttunement.function_description;
effectDescTooltip.overrideColor = mainAttunement.tooltipColor;
if (l.text.StartsWith("Main attunement"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = "Main Attumenent : [" + mainAttunement.name + "]";
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Main Attumenent : [None]";
}
}
mainAttunementTooltip.text = "Main Attumenent : [" + mainAttunement.name + "]";
mainAttunementTooltip.overrideColor = mainAttunement.tooltipColor;
}
if (l.text.StartsWith("Secondary attunement"))
{
if (secondaryAttunement != null)
{
l.overrideColor = Color.Lerp(secondaryAttunement.tooltipColor, Color.Gray, 0.5f);
l.text = "Secondary Attumenent : [" + secondaryAttunement.name + "]";
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Secondary Attumenent : [None]";
}
}
//If theres a secondary attunement
if (secondaryAttunement != null)
{
secondaryAttunementTooltip.text = "Secondary Attumenent : [" + secondaryAttunement.name + "]";
secondaryAttunementTooltip.overrideColor = Color.Lerp(secondaryAttunement.tooltipColor, Color.Gray, 0.5f);
}
}
+23 -79
View File
@@ -79,7 +79,6 @@ namespace CalamityMod.Items.Weapons.Melee
{
DisplayName.SetDefault("Galaxia");
Tooltip.SetDefault("FUNCTION_DESC\n" +
"FUNCTION_EXTRA\n" +
"FUNCTION_PASSIVE\n" +
"Upgrading the sword let it break free from its earthly boundaries. You now have access to every single attunement at all times!\n" +
"Use RMB to cycle the sword's attunement forward or backwards depending on the position of your cursor\n" +
@@ -97,86 +96,31 @@ namespace CalamityMod.Items.Weapons.Melee
if (player is null)
return;
foreach (TooltipLine l in list)
var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria");
var passiveDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip1" && x.mod == "Terraria");
var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.mod == "Terraria");
var blessingTooltip = list.FirstOrDefault(x => x.Name == "Tooltip5" && x.mod == "Terraria");
//Default stuff gets skipped here. MainAttunement is set to true in SafeCheckAttunements() above
//.. but just in case
if (mainAttunement == null)
{
if (l.text == null)
continue;
if (l.text.StartsWith("FUNCTION_DESC"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = mainAttunement.function_description;
}
else //Fake the existence of a main attunement
{
l.overrideColor = Attunement.attunementArray[(int)AttunementID.Phoenix].tooltipColor;
l.text = Attunement.attunementArray[(int)AttunementID.Phoenix].function_description;
}
continue;
}
if (l.text.StartsWith("FUNCTION_EXTRA"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = mainAttunement.function_description_extra;
}
else
{
l.overrideColor = Attunement.attunementArray[(int)AttunementID.Phoenix].tooltipColor;
l.text = Attunement.attunementArray[(int)AttunementID.Phoenix].function_description_extra;
}
continue;
}
if (l.text.StartsWith("FUNCTION_PASSIVE"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipPassiveColor;
l.text = mainAttunement.passive_description;
}
else
{
l.overrideColor = Attunement.attunementArray[(int)AttunementID.Phoenix].tooltipPassiveColor;
l.text = Attunement.attunementArray[(int)AttunementID.Phoenix].passive_description;
}
continue;
}
if (l.text.StartsWith("Active Attunement"))
{
if (mainAttunement != null)
{
l.overrideColor = Color.Lerp(mainAttunement.tooltipColor, mainAttunement.tooltipColor2, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.5f);
l.text = "Active Attumenent : [" + mainAttunement.name + "]";
}
else
{
l.overrideColor = Attunement.attunementArray[(int)AttunementID.Phoenix].tooltipColor;
l.text = "Active Attumenent : [" + Attunement.attunementArray[(int)AttunementID.Phoenix].name + "]";
}
continue;
}
if (l.text.StartsWith("Passive Blessing"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipPassiveColor;
l.text = "Passive Blessing : [" + mainAttunement.passive_name + "]";
}
else
{
l.overrideColor = Attunement.attunementArray[(int)AttunementID.Phoenix].tooltipPassiveColor;
l.text = "Passive Blessing : ["+ Attunement.attunementArray[(int)AttunementID.Phoenix].passive_name + "]";
}
continue;
}
CalamityMod.Instance.Logger.Error("No main attunement on galaxia, couldn't edit its tooltip properly. How the hell did that happen.");
return;
}
effectDescTooltip.text = mainAttunement.function_description + "\n" + mainAttunement.function_description_extra;
effectDescTooltip.overrideColor = mainAttunement.tooltipColor;
passiveDescTooltip.text = mainAttunement.passive_description;
passiveDescTooltip.overrideColor = mainAttunement.tooltipPassiveColor;
mainAttunementTooltip.text = "Active Attumenent : [" + mainAttunement.name + "]";
mainAttunementTooltip.overrideColor = Color.Lerp(mainAttunement.tooltipColor, mainAttunement.tooltipColor2, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.5f);
blessingTooltip.text = "Passive Blessing : [" + mainAttunement.passive_name + "]";
blessingTooltip.overrideColor = mainAttunement.tooltipPassiveColor;
}
#endregion
+35 -78
View File
@@ -97,12 +97,11 @@ namespace CalamityMod.Items.Weapons.Melee
{
DisplayName.SetDefault("True Biome Blade");
Tooltip.SetDefault("FUNCTION_DESC\n" +
"FUNCTION_EXTRA\n" +
"FUNCTION_PASSIVE\n" +
"Holding down RMB for 2 seconds attunes the weapon to the powers of the surrounding biome\n" +
"Using RMB for a shorter period of time switches your active and passive attunements around\n" +
"Active attunement : None\n" +
"Passive attunement: None\n");
"Active Attunement : None\n" +
"Passive Attunement: None\n");
}
#region tooltip editing
@@ -114,85 +113,43 @@ namespace CalamityMod.Items.Weapons.Melee
if (player is null)
return;
foreach (TooltipLine l in list)
var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria");
var passiveDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip1" && x.mod == "Terraria");
var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.mod == "Terraria");
var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip5" && x.mod == "Terraria");
//Default stuff
effectDescTooltip.text = "Does nothing..yet\nIt seems that upgrading the blade expanded the scope of the previous attunements";
effectDescTooltip.overrideColor = new Color(163, 163, 163);
passiveDescTooltip.text = "Your secondary attunement can now provide passive bonuses";
passiveDescTooltip.overrideColor = new Color(163, 163, 163);
mainAttunementTooltip.text = "Active Attumenent : [None]";
mainAttunementTooltip.overrideColor = new Color(163, 163, 163);
secondaryAttunementTooltip.text = "Passive Attunement : [None]";
secondaryAttunementTooltip.overrideColor = new Color(163, 163, 163);
//If theres a main attunement
if (mainAttunement != null)
{
if (l.text == null)
continue;
effectDescTooltip.text = mainAttunement.function_description + "\n" + mainAttunement.function_description_extra;
effectDescTooltip.overrideColor = mainAttunement.tooltipColor;
if (l.text.StartsWith("FUNCTION_DESC"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = mainAttunement.function_description;
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Does nothing.. yet";
}
continue;
}
mainAttunementTooltip.text = "Active Attumenent : [" + mainAttunement.name + "]";
mainAttunementTooltip.overrideColor = Color.Lerp(mainAttunement.tooltipColor, mainAttunement.tooltipColor2, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.5f);
}
if (l.text.StartsWith("FUNCTION_EXTRA"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = mainAttunement.function_description_extra;
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "It seems that upgrading the blade expanded the scope of the previous attunements";
}
continue;
}
//If theres a secondary attunement
if (secondaryAttunement != null)
{
passiveDescTooltip.text = secondaryAttunement.passive_description;
passiveDescTooltip.overrideColor = secondaryAttunement.tooltipColor;
if (l.text.StartsWith("FUNCTION_PASSIVE"))
{
if (secondaryAttunement != null)
{
l.overrideColor = secondaryAttunement.tooltipColor;
l.text = secondaryAttunement.passive_description;
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Your secondary attunement can now provide passive bonuses";
}
continue;
}
if (l.text.StartsWith("Active attunement"))
{
if (mainAttunement != null)
{
l.overrideColor = Color.Lerp(mainAttunement.tooltipColor, mainAttunement.tooltipColor2, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.5f);
l.text = "Active Attumenent : [" + mainAttunement.name + "]";
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Active Attumenent : [None]";
}
continue;
}
if (l.text.StartsWith("Passive attunement"))
{
if (secondaryAttunement != null)
{
l.overrideColor = Color.Lerp(Color.Lerp(secondaryAttunement.tooltipColor, secondaryAttunement.tooltipColor2, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.5f), Color.Gray, 0.5f);
l.text = "Passive Attumenent : [" + secondaryAttunement.name + "]";
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Passive Attumenent : [None]";
}
continue;
}
secondaryAttunementTooltip.text = "Passive Attumenent : [" + secondaryAttunement.name + "]";
secondaryAttunementTooltip.overrideColor = Color.Lerp(Color.Lerp(secondaryAttunement.tooltipColor, secondaryAttunement.tooltipColor2, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.5f), Color.Gray, 0.5f);
}
}
+1 -1
View File
@@ -155,7 +155,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void NetRecieve(BinaryReader reader)
{
Charge = reader.ReadInt32();
Charge = reader.ReadSingle();
}
public override void AddRecipes()
+28 -58
View File
@@ -80,11 +80,10 @@ namespace CalamityMod.Items.Weapons.Melee
{
DisplayName.SetDefault("Biome Blade");
Tooltip.SetDefault("FUNCTION_DESC\n" +
"FUNCTION_EXTRA\n" +
"Hold down RMB while standing still on flat ground to attune the weapon to the powers of the surrounding biome\n" +
"Using RMB otherwise switches between the current attunement and an extra stored one\n" +
"Main attunement : None\n" +
"Secondary attunement: None\n"); //Theres potential for flavor text as well but im not a writer
"Main Attunement : [None]\n" +
"Secondary Attunement: [None]\n"); //Theres potential for flavor text as well but im not a writer
}
#region tooltip editing
@@ -97,66 +96,37 @@ namespace CalamityMod.Items.Weapons.Melee
if (player is null)
return;
foreach (TooltipLine l in list)
var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria");
var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip3" && x.mod == "Terraria");
var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.mod == "Terraria");
//Default stuff
effectDescTooltip.text = "Does nothing..yet\nRepairing the blade seems to have improved its attuning capacities";
effectDescTooltip.overrideColor = new Color(163, 163, 163);
mainAttunementTooltip.text = "Main Attunement : [None]";
mainAttunementTooltip.overrideColor = new Color(163, 163, 163);
secondaryAttunementTooltip.text = "Secondary Attunement : [None]";
secondaryAttunementTooltip.overrideColor = new Color(163, 163, 163);
//If theres a main attunement
if (mainAttunement != null)
{
if (l.text.StartsWith("FUNCTION_DESC"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = mainAttunement.function_description;
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Does nothing.. yet";
}
}
effectDescTooltip.text = mainAttunement.function_description + "\n" + mainAttunement.function_description_extra ;
effectDescTooltip.overrideColor = mainAttunement.tooltipColor;
if (l.text.StartsWith("FUNCTION_EXTRA"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = mainAttunement.function_description_extra;
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Repairing the blade seems to have improved its attuning capacities";
}
}
mainAttunementTooltip.text = "Main Attumenent : [" + mainAttunement.name + "]";
mainAttunementTooltip.overrideColor = mainAttunement.tooltipColor;
}
if (l.text.StartsWith("Main attunement"))
{
if (mainAttunement != null)
{
l.overrideColor = mainAttunement.tooltipColor;
l.text = "Main Attumenent : [" + mainAttunement.name + "]";
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Main Attumenent : [None]";
}
}
if (l.text.StartsWith("Secondary attunement"))
{
if (secondaryAttunement != null)
{
l.overrideColor = Color.Lerp(secondaryAttunement.tooltipColor, Color.Gray, 0.5f);
l.text = "Secondary Attumenent : [" + secondaryAttunement.name + "]";
}
else
{
l.overrideColor = new Color(163, 163, 163);
l.text = "Secondary Attumenent : [None]";
}
}
//If theres a secondary attunement
if (secondaryAttunement != null)
{
secondaryAttunementTooltip.text = "Secondary Attumenent : [" + secondaryAttunement.name + "]";
secondaryAttunementTooltip.overrideColor = Color.Lerp(secondaryAttunement.tooltipColor, Color.Gray, 0.5f);
}
}
#endregion
public override void SetDefaults()