rarity tags

This commit is contained in:
Tabby 2026-01-23 16:12:01 +11:00
parent b1a57b7290
commit f92e1344fa
23 changed files with 56 additions and 2 deletions

View file

@ -10,3 +10,4 @@ class_name ItemData
@export var botnet_power : int = 0 @export var botnet_power : int = 0
@export var can_buy : bool = false @export var can_buy : bool = false
@export var description : String = "" @export var description : String = ""
@export var rarity : String = ""

View file

@ -10,4 +10,5 @@ icon = ExtResource("1_i7fpe")
bin_chance = 2 bin_chance = 2
buy_value = 50 buy_value = 50
can_buy = true can_buy = true
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -11,4 +11,5 @@ icon = ExtResource("1_k071h")
custom_panel_style = ExtResource("1_8brb6") custom_panel_style = ExtResource("1_8brb6")
bin_chance = 7 bin_chance = 7
buy_value = 2 buy_value = 2
rarity = "Broken"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_x7wm3")
bin_chance = 0 bin_chance = 0
buy_value = 500 buy_value = 500
botnet_power = 2 botnet_power = 2
rarity = "Rare"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -9,4 +9,5 @@ item_name = "CPU"
icon = ExtResource("1_mh86d") icon = ExtResource("1_mh86d")
buy_value = 80 buy_value = 80
can_buy = true can_buy = true
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -11,4 +11,5 @@ icon = ExtResource("2_v2wmo")
custom_panel_style = ExtResource("1_lhfs3") custom_panel_style = ExtResource("1_lhfs3")
bin_chance = 0 bin_chance = 0
buy_value = 600 buy_value = 600
rarity = "Epic"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -9,4 +9,5 @@ item_name = "Optical Drive"
icon = ExtResource("1_kdwp1") icon = ExtResource("1_kdwp1")
buy_value = 35 buy_value = 35
can_buy = true can_buy = true
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_j1gmi")
bin_chance = 0 bin_chance = 0
buy_value = 1500 buy_value = 1500
botnet_power = 4 botnet_power = 4
rarity = "Epic"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_jiyv5")
bin_chance = 3 bin_chance = 3
buy_value = 500 buy_value = 500
can_buy = true can_buy = true
rarity = "Epic"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -9,4 +9,5 @@ item_name = "Hard Disk Drive"
icon = ExtResource("1_8xwf0") icon = ExtResource("1_8xwf0")
buy_value = 60 buy_value = 60
can_buy = true can_buy = true
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_xyf87")
bin_chance = 0 bin_chance = 0
buy_value = 850 buy_value = 850
botnet_power = 3 botnet_power = 3
rarity = "Rare"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -9,4 +9,5 @@ item_name = "Large Power Supply Unit"
icon = ExtResource("1_rjw1c") icon = ExtResource("1_rjw1c")
buy_value = 80 buy_value = 80
can_buy = true can_buy = true
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_wtpx3")
bin_chance = 0 bin_chance = 0
buy_value = 600 buy_value = 600
botnet_power = 2 botnet_power = 2
rarity = "Rare"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -8,4 +8,5 @@ script = ExtResource("2_31pxd")
item_name = "Plastic Scrap" item_name = "Plastic Scrap"
icon = ExtResource("1_2haha") icon = ExtResource("1_2haha")
can_buy = true can_buy = true
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -11,4 +11,5 @@ icon = ExtResource("1_ad3tn")
custom_panel_style = ExtResource("1_ecsjn") custom_panel_style = ExtResource("1_ecsjn")
bin_chance = 0 bin_chance = 0
buy_value = 60 buy_value = 60
rarity = "Uncommon"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -7,4 +7,5 @@
script = ExtResource("2_4u113") script = ExtResource("2_4u113")
item_name = "Power Cell" item_name = "Power Cell"
icon = ExtResource("1_lh7dq") icon = ExtResource("1_lh7dq")
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -9,4 +9,5 @@ item_name = "Ram Stick"
icon = ExtResource("1_bfuag") icon = ExtResource("1_bfuag")
buy_value = 80 buy_value = 80
can_buy = true can_buy = true
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_70din")
bin_chance = 0 bin_chance = 0
buy_value = 3000 buy_value = 3000
botnet_power = 11 botnet_power = 11
rarity = "Legendary"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -9,4 +9,5 @@ item_name = "Small Power Supply Unit"
icon = ExtResource("1_62foo") icon = ExtResource("1_62foo")
buy_value = 20 buy_value = 20
can_buy = true can_buy = true
rarity = "Common"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_kwg8r")
bin_chance = 3 bin_chance = 3
buy_value = 140 buy_value = 140
can_buy = true can_buy = true
rarity = "Rare"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -11,4 +11,5 @@ icon = ExtResource("2_pugmu")
custom_panel_style = ExtResource("1_pugmu") custom_panel_style = ExtResource("1_pugmu")
bin_chance = 0 bin_chance = 0
buy_value = 400 buy_value = 400
rarity = "Rare"
metadata/_custom_type_script = "uid://dccraom7a7e8d" metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -3,6 +3,8 @@ extends PanelContainer
@export var tooltip_label : RichTextLabel @export var tooltip_label : RichTextLabel
@export var exdata_box : VBoxContainer @export var exdata_box : VBoxContainer
@export var exdata_label : Label @export var exdata_label : Label
@export var rarity_label : Label
@export var rarity_colors : Dictionary[String,Color]
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
@ -22,6 +24,13 @@ func show_tip(item : ItemData, extra : String = ""):
tooltip_label.text += "\nSell Value: $"+str(floori(item.buy_value/float(2))) tooltip_label.text += "\nSell Value: $"+str(floori(item.buy_value/float(2)))
if item.botnet_power > 0: if item.botnet_power > 0:
tooltip_label.text += "\n[color=orchid]Botnet Power: " + str(item.botnet_power) +"[/color]" tooltip_label.text += "\n[color=orchid]Botnet Power: " + str(item.botnet_power) +"[/color]"
if item.rarity != "":
rarity_label.show()
rarity_label.text = item.rarity
if rarity_colors.has(item.rarity):
rarity_label.self_modulate = rarity_colors.get(item.rarity)
else:
rarity_label.hide()
if extra != "": if extra != "":
exdata_box.show() exdata_box.show()
exdata_label.text = extra exdata_label.text = extra

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=3 format=3 uid="uid://sb2wq874p37j"] [gd_scene load_steps=6 format=3 uid="uid://sb2wq874p37j"]
[ext_resource type="Script" uid="uid://cbta38dhunndc" path="res://tooltip.gd" id="1_gwequ"] [ext_resource type="Script" uid="uid://cbta38dhunndc" path="res://tooltip.gd" id="1_gwequ"]
@ -17,7 +17,16 @@ corner_radius_top_right = 3
corner_radius_bottom_right = 3 corner_radius_bottom_right = 3
corner_radius_bottom_left = 3 corner_radius_bottom_left = 3
[node name="Tooltip" type="PanelContainer" node_paths=PackedStringArray("tooltip_label", "exdata_box", "exdata_label")] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_gwequ"]
content_margin_right = 5.0
[sub_resource type="FontVariation" id="FontVariation_gwequ"]
variation_transform = Transform2D(1, 0.35, 0, 1, 0, 0)
[sub_resource type="LabelSettings" id="LabelSettings_oxk8h"]
font = SubResource("FontVariation_gwequ")
[node name="Tooltip" type="PanelContainer" node_paths=PackedStringArray("tooltip_label", "exdata_box", "exdata_label", "rarity_label")]
z_index = 7 z_index = 7
offset_right = 95.0 offset_right = 95.0
offset_bottom = 31.0 offset_bottom = 31.0
@ -29,6 +38,14 @@ script = ExtResource("1_gwequ")
tooltip_label = NodePath("VBoxContainer/Label") tooltip_label = NodePath("VBoxContainer/Label")
exdata_box = NodePath("VBoxContainer/Extradata") exdata_box = NodePath("VBoxContainer/Extradata")
exdata_label = NodePath("VBoxContainer/Extradata/Label") exdata_label = NodePath("VBoxContainer/Extradata/Label")
rarity_label = NodePath("VBoxContainer/rarity")
rarity_colors = Dictionary[String, Color]({
"Common": Color(1, 1, 1, 1),
"Epic": Color(0.8087111, 0.40824994, 0.9999972, 1),
"Legendary": Color(1, 0.7529412, 0, 1),
"Rare": Color(0.38142374, 0.9132181, 0.9999998, 1),
"Uncommon": Color(0.59956974, 1, 0.59689647, 1)
})
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2 layout_mode = 2
@ -52,3 +69,10 @@ layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/Extradata"] [node name="Label" type="Label" parent="VBoxContainer/Extradata"]
layout_mode = 2 layout_mode = 2
text = "Extra data does here" text = "Extra data does here"
[node name="rarity" type="Label" parent="VBoxContainer"]
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxEmpty_gwequ")
text = "fdsfdsf"
label_settings = SubResource("LabelSettings_oxk8h")
horizontal_alignment = 2