Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

item saying how much damage they do and Text fixes #10256

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
89 changes: 88 additions & 1 deletion UnityProject/Assets/Scripts/Items/ItemAttributesV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using AddressableReferences;
using Core;
using Systems.Clothing;
using UI.Systems.Tooltips.HoverTooltips;
using Util.Independent.FluentRichText;

namespace Items
{
Expand All @@ -16,7 +18,7 @@ namespace Items
/// </summary>
[RequireComponent(typeof(Pickupable))] //Inventory interaction
[RequireComponent(typeof(RegisterItem))] //Registry with subsistence
public class ItemAttributesV2 : Attributes
public class ItemAttributesV2 : Attributes, IHoverTooltip
{
[Header("Item Info")]

Expand All @@ -33,6 +35,10 @@ public class ItemAttributesV2 : Attributes
[SerializeField]
private float hitDamage = 0;


[Tooltip(" Says roughly how much damage it does when examining ")]
public bool ShowHitDamage = true;

/// <summary>
/// Damage when we click someone with harm intent, tracked server side only.
/// </summary>
Expand Down Expand Up @@ -316,6 +322,87 @@ public void PropagatePaletteChanges()
if (clothing != null) clothing.AssignPaletteToSprites(this.ItemSprites.Palette);
}

private string GetInfo()
{
if (ShowHitDamage == false) return "";

string returnS = "";
switch (hitDamage)
{
case < 1:
returnS = "This item is seemingly harmless";
break;
case < 4:
returnS = "would do some damage";
break;
case < 7:
returnS = "an okay damage";
break;
case < 11:
returnS = "a decent damage";
break;
case < 13:
returnS = "robust damage.";
break;
case < 21:
returnS = "strong damage.";
break;
case < 31:
returnS = "powerful damage.";
break;
case < 41:
returnS = "crazy damage.";
break;
case < 51:
returnS = "insane damage.";
break;
case < 101:
if (UnityEngine.Random.Range(0, 2) == 1)
{
returnS = "One shot bs hit damage.";
}
else
{
returnS = "This item is too lethal and deadly.";
}

break;
case > 101:
returnS = "ok they are dead now you don't need any more damage!!!";
break;
default:
returnS = "You can't tell how harmful this item is as a weapon.";
break;
}

return returnS.Color("#D4D4D4").FontSize("85%");
}

public string HoverTip()
{
return GetInfo();
}

public string CustomTitle()
{
return null;
}

public Sprite CustomIcon()
{
return null;
}

public List<Sprite> IconIndicators()
{
return null;
}

public List<TextColor> InteractionsStrings()
{
return null;
}


}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class StringExtensions
public static string Color(this string text, RichTextColor namedRichTextColor) => new ColorStrategy(namedRichTextColor).ApplyStyle(text);
public static string Color(this string text, string hexColor) => new ColorStrategy(hexColor).ApplyStyle(text);

public static string Color(this string text, Color unityColour) => new ColorStrategy(ColorUtility.ToHtmlStringRGBA(unityColour)).ApplyStyle(text);
public static string Color(this string text, Color unityColour) => new ColorStrategy("#" + ColorUtility.ToHtmlStringRGBA(unityColour)).ApplyStyle(text);
public static string Font(this string text, string fontName) => new FontStrategy(fontName).ApplyStyle(text);
public static string Indent(this string text, string amount) => new IndentStrategy(amount).ApplyStyle(text);
public static string LineHeight(this string text, string amount) => new LineHeightStrategy(amount).ApplyStyle(text);
Expand All @@ -25,7 +25,7 @@ public static class StringExtensions
public static string NoParse(this string text) => new NoParseStrategy().ApplyStyle(text);
public static string NonBreakingSpaces(this string text) => new NonBreakingSpacesStrategy().ApplyStyle(text);
public static string HorizontalPosition(this string text, string position) => new HorizontalPositionStrategy(position).ApplyStyle(text);
public static string FontSize(this string text, string size) => new FontStrategy(size).ApplyStyle(text);
public static string FontSize(this string text, string size) => new FontSizeStrategy(size).ApplyStyle(text);
public static string Space(this string text, string amount) => new SpaceStrategy(amount).ApplyStyle(text);
public static string Sprite(this string text, int index) => new SpriteStrategy(index).ApplyStyle(text);
public static string Sprite(this string text, string name) => new SpriteStrategy(name).ApplyStyle(text);
Expand Down