From f92e1344fa1b88025f50678038aaff0614e96cf2 Mon Sep 17 00:00:00 2001 From: Tabby <41929769+tabby-cat-nya@users.noreply.github.com> Date: Fri, 23 Jan 2026 16:12:01 +1100 Subject: [PATCH] rarity tags --- inv_system/item_data.gd | 1 + items/battery.tres | 1 + items/broken_laptop.tres | 1 + items/computer.tres | 1 + items/cpu.tres | 1 + items/disc_item.tres | 1 + items/dvd_drive.tres | 1 + items/gaming_computer.tres | 1 + items/gpu.tres | 1 + items/hdd_item.tres | 1 + items/laptop.tres | 1 + items/large_psu_item.tres | 1 + items/nas_item.tres | 1 + items/plastic.tres | 1 + items/plastic_block.tres | 1 + items/power_cell.tres | 1 + items/ram_item.tres | 1 + items/server.tres | 1 + items/small_psu_item.tres | 1 + items/ssd_item.tres | 1 + items/ups_item.tres | 1 + tooltip.gd | 9 +++++++++ tooltip.tscn | 28 ++++++++++++++++++++++++++-- 23 files changed, 56 insertions(+), 2 deletions(-) diff --git a/inv_system/item_data.gd b/inv_system/item_data.gd index cdc9601..08f7243 100644 --- a/inv_system/item_data.gd +++ b/inv_system/item_data.gd @@ -10,3 +10,4 @@ class_name ItemData @export var botnet_power : int = 0 @export var can_buy : bool = false @export var description : String = "" +@export var rarity : String = "" diff --git a/items/battery.tres b/items/battery.tres index d3d50b0..beb135a 100644 --- a/items/battery.tres +++ b/items/battery.tres @@ -10,4 +10,5 @@ icon = ExtResource("1_i7fpe") bin_chance = 2 buy_value = 50 can_buy = true +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/broken_laptop.tres b/items/broken_laptop.tres index 77efce9..7f90690 100644 --- a/items/broken_laptop.tres +++ b/items/broken_laptop.tres @@ -11,4 +11,5 @@ icon = ExtResource("1_k071h") custom_panel_style = ExtResource("1_8brb6") bin_chance = 7 buy_value = 2 +rarity = "Broken" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/computer.tres b/items/computer.tres index f6accf6..eb1cb07 100644 --- a/items/computer.tres +++ b/items/computer.tres @@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_x7wm3") bin_chance = 0 buy_value = 500 botnet_power = 2 +rarity = "Rare" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/cpu.tres b/items/cpu.tres index b37a77d..641a89e 100644 --- a/items/cpu.tres +++ b/items/cpu.tres @@ -9,4 +9,5 @@ item_name = "CPU" icon = ExtResource("1_mh86d") buy_value = 80 can_buy = true +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/disc_item.tres b/items/disc_item.tres index c9feb9d..6e1ebc9 100644 --- a/items/disc_item.tres +++ b/items/disc_item.tres @@ -11,4 +11,5 @@ icon = ExtResource("2_v2wmo") custom_panel_style = ExtResource("1_lhfs3") bin_chance = 0 buy_value = 600 +rarity = "Epic" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/dvd_drive.tres b/items/dvd_drive.tres index bb27293..ae97e4e 100644 --- a/items/dvd_drive.tres +++ b/items/dvd_drive.tres @@ -9,4 +9,5 @@ item_name = "Optical Drive" icon = ExtResource("1_kdwp1") buy_value = 35 can_buy = true +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/gaming_computer.tres b/items/gaming_computer.tres index df48ab7..4427f4a 100644 --- a/items/gaming_computer.tres +++ b/items/gaming_computer.tres @@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_j1gmi") bin_chance = 0 buy_value = 1500 botnet_power = 4 +rarity = "Epic" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/gpu.tres b/items/gpu.tres index a375ef3..6b4aef7 100644 --- a/items/gpu.tres +++ b/items/gpu.tres @@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_jiyv5") bin_chance = 3 buy_value = 500 can_buy = true +rarity = "Epic" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/hdd_item.tres b/items/hdd_item.tres index df3bb1f..d013b7b 100644 --- a/items/hdd_item.tres +++ b/items/hdd_item.tres @@ -9,4 +9,5 @@ item_name = "Hard Disk Drive" icon = ExtResource("1_8xwf0") buy_value = 60 can_buy = true +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/laptop.tres b/items/laptop.tres index 46aabbb..70c7294 100644 --- a/items/laptop.tres +++ b/items/laptop.tres @@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_xyf87") bin_chance = 0 buy_value = 850 botnet_power = 3 +rarity = "Rare" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/large_psu_item.tres b/items/large_psu_item.tres index ecba18e..1a38176 100644 --- a/items/large_psu_item.tres +++ b/items/large_psu_item.tres @@ -9,4 +9,5 @@ item_name = "Large Power Supply Unit" icon = ExtResource("1_rjw1c") buy_value = 80 can_buy = true +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/nas_item.tres b/items/nas_item.tres index 8cf1926..49262ef 100644 --- a/items/nas_item.tres +++ b/items/nas_item.tres @@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_wtpx3") bin_chance = 0 buy_value = 600 botnet_power = 2 +rarity = "Rare" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/plastic.tres b/items/plastic.tres index dea3a82..3eefc21 100644 --- a/items/plastic.tres +++ b/items/plastic.tres @@ -8,4 +8,5 @@ script = ExtResource("2_31pxd") item_name = "Plastic Scrap" icon = ExtResource("1_2haha") can_buy = true +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/plastic_block.tres b/items/plastic_block.tres index 705419a..d031029 100644 --- a/items/plastic_block.tres +++ b/items/plastic_block.tres @@ -11,4 +11,5 @@ icon = ExtResource("1_ad3tn") custom_panel_style = ExtResource("1_ecsjn") bin_chance = 0 buy_value = 60 +rarity = "Uncommon" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/power_cell.tres b/items/power_cell.tres index 6d7d031..2baa1bf 100644 --- a/items/power_cell.tres +++ b/items/power_cell.tres @@ -7,4 +7,5 @@ script = ExtResource("2_4u113") item_name = "Power Cell" icon = ExtResource("1_lh7dq") +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/ram_item.tres b/items/ram_item.tres index 3e28325..c293056 100644 --- a/items/ram_item.tres +++ b/items/ram_item.tres @@ -9,4 +9,5 @@ item_name = "Ram Stick" icon = ExtResource("1_bfuag") buy_value = 80 can_buy = true +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/server.tres b/items/server.tres index d26fb20..705ffd3 100644 --- a/items/server.tres +++ b/items/server.tres @@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_70din") bin_chance = 0 buy_value = 3000 botnet_power = 11 +rarity = "Legendary" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/small_psu_item.tres b/items/small_psu_item.tres index 5a31bd5..a339387 100644 --- a/items/small_psu_item.tres +++ b/items/small_psu_item.tres @@ -9,4 +9,5 @@ item_name = "Small Power Supply Unit" icon = ExtResource("1_62foo") buy_value = 20 can_buy = true +rarity = "Common" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/ssd_item.tres b/items/ssd_item.tres index fc3d4ff..eb4eb28 100644 --- a/items/ssd_item.tres +++ b/items/ssd_item.tres @@ -12,4 +12,5 @@ custom_panel_style = ExtResource("1_kwg8r") bin_chance = 3 buy_value = 140 can_buy = true +rarity = "Rare" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/items/ups_item.tres b/items/ups_item.tres index 1fc251b..b948b93 100644 --- a/items/ups_item.tres +++ b/items/ups_item.tres @@ -11,4 +11,5 @@ icon = ExtResource("2_pugmu") custom_panel_style = ExtResource("1_pugmu") bin_chance = 0 buy_value = 400 +rarity = "Rare" metadata/_custom_type_script = "uid://dccraom7a7e8d" diff --git a/tooltip.gd b/tooltip.gd index f02b16d..3907e47 100644 --- a/tooltip.gd +++ b/tooltip.gd @@ -3,6 +3,8 @@ extends PanelContainer @export var tooltip_label : RichTextLabel @export var exdata_box : VBoxContainer @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. 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))) if item.botnet_power > 0: 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 != "": exdata_box.show() exdata_label.text = extra diff --git a/tooltip.tscn b/tooltip.tscn index 81c277e..b8244fd 100644 --- a/tooltip.tscn +++ b/tooltip.tscn @@ -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"] @@ -17,7 +17,16 @@ corner_radius_top_right = 3 corner_radius_bottom_right = 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 offset_right = 95.0 offset_bottom = 31.0 @@ -29,6 +38,14 @@ script = ExtResource("1_gwequ") tooltip_label = NodePath("VBoxContainer/Label") exdata_box = NodePath("VBoxContainer/Extradata") 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="."] layout_mode = 2 @@ -52,3 +69,10 @@ layout_mode = 2 [node name="Label" type="Label" parent="VBoxContainer/Extradata"] layout_mode = 2 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