class_name ItemDatabase
extends RefCounted

# Item Database - Contains all item definitions and generation functions
# Coordinates are (x, y) where x is column, y is row in items_n_shit.png (20x14 grid)
# Frame calculation: frame = y * 20 + x

# Item rarity tiers for random generation
enum ItemRarity {
	COMMON, # Basic items (food, low-tier equipment)
	UNCOMMON, # Mid-tier equipment
	RARE, # High-tier equipment
	EPIC, # Legendary equipment
	CONSUMABLE # Potions and consumables
}

# Dictionary to store all item definitions by ID
# Format: { "item_id": { item_data } }
static var item_definitions: Dictionary = {}

# Initialize item database
static func _initialize():
	if item_definitions.is_empty():
		_load_all_items()

# Load all item definitions
static func _load_all_items():
	# ARMOUR items (row 0)
	_register_item("silk_robe", {
		"item_name": "Silk Robe",
		"description": "A luxurious silk robe",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ARMOUR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 10, # 10,0
		"modifiers": {"def": 1, "end": 1},
		"buy_cost": 50,
		"sell_worth": 15,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("padded_robe", {
		"item_name": "Padded Robe",
		"description": "A padded robe for protection",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ARMOUR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 11, # 11,0
		"modifiers": {"def": 2},
		"buy_cost": 60,
		"sell_worth": 18,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("rags", {
		"item_name": "Rags",
		"description": "Tattered rags",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ARMOUR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 12, # 12,0
		"modifiers": {"def": 0},
		"buy_cost": 10,
		"sell_worth": 3,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("leather_armour", {
		"item_name": "Leather Armour",
		"description": "A nice leather armour",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ARMOUR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 13, # 13,0
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 2 - Clothes/Tunic Body/LeatherTunic.png",
		"modifiers": {"def": 3},
		"buy_cost": 80,
		"sell_worth": 24,
		"rarity": ItemRarity.COMMON,
		"weight": 4.0 # Light armour
	})
	
	_register_item("plate", {
		"item_name": "Plate",
		"description": "Heavy plate armour",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ARMOUR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 14, # 14,0
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 2 - Clothes/Armour Body/SteelArmour.png",
		"modifiers": {"def": 5, "end": 1},
		"buy_cost": 150,
		"sell_worth": 45,
		"rarity": ItemRarity.UNCOMMON,
		"weight": 10.0 # Heavy armour!
	})
	
	_register_item("full_mail", {
		"item_name": "Full Mail",
		"description": "Complete chainmail armour",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ARMOUR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 15, # 15,0
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 2 - Clothes/Armour Body/IronArmour.png",
		"modifiers": {"def": 4},
		"buy_cost": 120,
		"sell_worth": 36,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("golden_mail", {
		"item_name": "Golden Mail",
		"description": "Exquisite golden chainmail",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ARMOUR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 16, # 16,0
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 2 - Clothes/Armour Body/GoldArmour.png",
		"modifiers": {"def": 6, "end": 2},
		"buy_cost": 300,
		"sell_worth": 90,
		"rarity": ItemRarity.RARE
	})
	
	# OFFHAND items (shields, row 0)
	_register_item("wooden_shield", {
		"item_name": "Wooden Shield",
		"description": "A basic wooden shield",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 17, # 17,0
		"modifiers": {"def": 2},
		"buy_cost": 40,
		"sell_worth": 12,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("sturdy_shield", {
		"item_name": "Sturdy Shield",
		"description": "A reinforced shield",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 18, # 18,0
		"modifiers": {"def": 3},
		"buy_cost": 70,
		"sell_worth": 21,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("metal_shield", {
		"item_name": "Metal Shield",
		"description": "A strong metal shield",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 0 * 20 + 19, # 19,0
		"modifiers": {"def": 4},
		"buy_cost": 100,
		"sell_worth": 30,
		"rarity": ItemRarity.UNCOMMON
	})
	
	# HEADGEAR items
	# MageHatRed (frame 9) variants
	var _mhr_o = [Color(255 / 255.0, 39 / 255.0, 44 / 255.0), Color(182 / 255.0, 0, 0), Color(118 / 255.0, 1 / 255.0, 0), Color(72 / 255.0, 0, 12 / 255.0)]
	var _mhr_brown = [Color(139 / 255.0, 90 / 255.0, 43 / 255.0), Color(101 / 255.0, 67 / 255.0, 33 / 255.0), Color(80 / 255.0, 50 / 255.0, 20 / 255.0), Color(50 / 255.0, 30 / 255.0, 10 / 255.0)]
	var _mhr_blue = [Color(30 / 255.0, 80 / 255.0, 180 / 255.0), Color(20 / 255.0, 50 / 255.0, 120 / 255.0), Color(10 / 255.0, 30 / 255.0, 80 / 255.0), Color(5 / 255.0, 15 / 255.0, 50 / 255.0)]
	var _mhr_lightblue = [Color(170 / 255.0, 220 / 255.0, 1.0), Color(130 / 255.0, 190 / 255.0, 1.0), Color(90 / 255.0, 150 / 255.0, 220 / 255.0), Color(50 / 255.0, 100 / 255.0, 180 / 255.0)]
	var _mhr_white = [Color(250 / 255.0, 250 / 255.0, 250 / 255.0), Color(220 / 255.0, 220 / 255.0, 220 / 255.0), Color(190 / 255.0, 190 / 255.0, 190 / 255.0), Color(150 / 255.0, 150 / 255.0, 150 / 255.0)]
	var _shc_o = [Color(0, 180 / 255.0, 157 / 255.0), Color(0, 121 / 255.0, 102 / 255.0), Color(0, 79 / 255.0, 67 / 255.0), Color(0, 46 / 255.0, 93 / 255.0)]
	var _shc_red = [Color(180 / 255.0, 40 / 255.0, 40 / 255.0), Color(130 / 255.0, 0, 0), Color(90 / 255.0, 0, 0), Color(60 / 255.0, 0, 0)]
	var _shc_green = [Color(40 / 255.0, 160 / 255.0, 40 / 255.0), Color(0, 120 / 255.0, 0), Color(0, 80 / 255.0, 0), Color(0, 50 / 255.0, 0)]
	var _sb_o = [Color(248 / 255.0, 219 / 255.0, 108 / 255.0), Color(225 / 255.0, 159 / 255.0, 57 / 255.0), Color(199 / 255.0, 115 / 255.0, 29 / 255.0), Color(151 / 255.0, 73 / 255.0, 9 / 255.0), Color(108 / 255.0, 43 / 255.0, 0), Color(58 / 255.0, 23 / 255.0, 11 / 255.0), Color(0, 76 / 255.0, 218 / 255.0), Color(9 / 255.0, 35 / 255.0, 105 / 255.0), Color(0, 14 / 255.0, 62 / 255.0)]
	var _sb_iron = [Color(190 / 255.0, 187 / 255.0, 181 / 255.0), Color(162 / 255.0, 158 / 255.0, 150 / 255.0), Color(125 / 255.0, 123 / 255.0, 118 / 255.0), Color(77 / 255.0, 76 / 255.0, 75 / 255.0), Color(54 / 255.0, 54 / 255.0, 54 / 255.0), Color(30 / 255.0, 30 / 255.0, 30 / 255.0), Color(0, 76 / 255.0, 218 / 255.0), Color(9 / 255.0, 35 / 255.0, 105 / 255.0), Color(0, 14 / 255.0, 62 / 255.0)]
	var _sb_steel = [Color(227 / 255.0, 227 / 255.0, 227 / 255.0), Color(183 / 255.0, 183 / 255.0, 183 / 255.0), Color(116 / 255.0, 116 / 255.0, 116 / 255.0), Color(77 / 255.0, 76 / 255.0, 75 / 255.0), Color(54 / 255.0, 54 / 255.0, 54 / 255.0), Color(30 / 255.0, 30 / 255.0, 30 / 255.0), Color(0, 76 / 255.0, 218 / 255.0), Color(9 / 255.0, 35 / 255.0, 105 / 255.0), Color(0, 14 / 255.0, 62 / 255.0)]

	_register_item("hat", {
		"item_name": "Hat",
		"description": "A simple cloth hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 9,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/MageHatRed.png",
		"modifiers": {"def": 1},
		"buy_cost": 20,
		"sell_worth": 6,
		"rarity": ItemRarity.COMMON,
		"colorReplacements": [ {"original": _mhr_o[0], "replace": _mhr_brown[0]}, {"original": _mhr_o[1], "replace": _mhr_brown[1]}, {"original": _mhr_o[2], "replace": _mhr_brown[2]}, {"original": _mhr_o[3], "replace": _mhr_brown[3]}]
	})
	_register_item("red_hat", {
		"item_name": "Red hat",
		"description": "A red mage hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 9,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/MageHatRed.png",
		"modifiers": {"def": 1},
		"buy_cost": 25,
		"sell_worth": 8,
		"rarity": ItemRarity.COMMON
	})
	_register_item("blue_mages_hat", {
		"item_name": "Blue mage's hat",
		"description": "A blue mage hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 9,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/MageHatRed.png",
		"modifiers": {"def": 1},
		"buy_cost": 28,
		"sell_worth": 9,
		"rarity": ItemRarity.COMMON,
		"colorReplacements": [ {"original": _mhr_o[0], "replace": _mhr_blue[0]}, {"original": _mhr_o[1], "replace": _mhr_blue[1]}, {"original": _mhr_o[2], "replace": _mhr_blue[2]}, {"original": _mhr_o[3], "replace": _mhr_blue[3]}]
	})
	_register_item("wizards_hat", {
		"item_name": "Wizard's hat",
		"description": "A light blue wizard hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 9,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/MageHatRed.png",
		"modifiers": {"def": 1, "wis": 1},
		"buy_cost": 55,
		"sell_worth": 18,
		"rarity": ItemRarity.UNCOMMON,
		"colorReplacements": [ {"original": _mhr_o[0], "replace": _mhr_lightblue[0]}, {"original": _mhr_o[1], "replace": _mhr_lightblue[1]}, {"original": _mhr_o[2], "replace": _mhr_lightblue[2]}, {"original": _mhr_o[3], "replace": _mhr_lightblue[3]}]
	})
	_register_item("gandolfs_hat", {
		"item_name": "Gandolf's Hat",
		"description": "A white wizard hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 9,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/MageHatRed.png",
		"modifiers": {"def": 1, "wis": 1},
		"buy_cost": 60,
		"sell_worth": 20,
		"rarity": ItemRarity.UNCOMMON,
		"colorReplacements": [ {"original": _mhr_o[0], "replace": _mhr_white[0]}, {"original": _mhr_o[1], "replace": _mhr_white[1]}, {"original": _mhr_o[2], "replace": _mhr_white[2]}, {"original": _mhr_o[3], "replace": _mhr_white[3]}]
	})

	_register_item("sorcerors_hood", {
		"item_name": "Sorceror's Hood",
		"description": "A cyan sorceror hood",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 27,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/SorcererHoodCyan.png",
		"modifiers": {"def": 2, "wis": 1},
		"buy_cost": 50,
		"sell_worth": 16,
		"rarity": ItemRarity.COMMON
	})
	_register_item("red_hood", {
		"item_name": "Red Hood",
		"description": "A red hood",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 27,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/SorcererHoodCyan.png",
		"modifiers": {"def": 2},
		"buy_cost": 45,
		"sell_worth": 14,
		"rarity": ItemRarity.COMMON,
		"colorReplacements": [ {"original": _shc_o[0], "replace": _shc_red[0]}, {"original": _shc_o[1], "replace": _shc_red[1]}, {"original": _shc_o[2], "replace": _shc_red[2]}, {"original": _shc_o[3], "replace": _shc_red[3]}]
	})
	_register_item("green_hood", {
		"item_name": "Green Hood",
		"description": "A green hood",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 27,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/SorcererHoodCyan.png",
		"modifiers": {"def": 2, "dex": 1},
		"buy_cost": 52,
		"sell_worth": 17,
		"rarity": ItemRarity.COMMON,
		"colorReplacements": [ {"original": _shc_o[0], "replace": _shc_green[0]}, {"original": _shc_o[1], "replace": _shc_green[1]}, {"original": _shc_o[2], "replace": _shc_green[2]}, {"original": _shc_o[3], "replace": _shc_green[3]}]
	})

	_register_item("high_mage_hat", {
		"item_name": "High Mage Hat",
		"description": "A high mage hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 5,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/HighMageHatCyan.png",
		"modifiers": {"def": 2, "wis": 1},
		"buy_cost": 70,
		"sell_worth": 22,
		"rarity": ItemRarity.UNCOMMON
	})
	_register_item("esper_hat", {
		"item_name": "Esper Hat",
		"description": "An esper hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 4,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Mage/EsperHatBlue.png",
		"modifiers": {"def": 2, "wis": 1},
		"buy_cost": 65,
		"sell_worth": 20,
		"rarity": ItemRarity.UNCOMMON
	})

	_register_item("jarl_helm", {
		"item_name": "Jarl Helm",
		"description": "A jarl's helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 26,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Viking/JarlHelm.png",
		"modifiers": {"def": 4, "str": 1},
		"buy_cost": 150,
		"sell_worth": 48,
		"rarity": ItemRarity.RARE
	})
	_register_item("karl_helm", {
		"item_name": "Karl Helm",
		"description": "A karl's helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 25,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Viking/KarlHelm.png",
		"modifiers": {"def": 3},
		"buy_cost": 90,
		"sell_worth": 28,
		"rarity": ItemRarity.UNCOMMON
	})
	_register_item("valkyrie_helm", {
		"item_name": "Valkyrie Helm",
		"description": "A valkyrie helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 24,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Viking/ValkyrieHelm.png",
		"modifiers": {"def": 4},
		"buy_cost": 130,
		"sell_worth": 40,
		"rarity": ItemRarity.RARE
	})
	_register_item("warrior_helm", {
		"item_name": "Warrior Helm",
		"description": "A warrior helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 23,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Viking/WarriorHelmRed.png",
		"modifiers": {"def": 3, "str": 1},
		"buy_cost": 100,
		"sell_worth": 32,
		"rarity": ItemRarity.UNCOMMON
	})
	_register_item("enforced_warrior_helm", {
		"item_name": "Enforced Warrior Helm",
		"description": "A reinforced warrior helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 22,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Viking/WarriorHelmYellow.png",
		"modifiers": {"def": 4, "str": 1},
		"buy_cost": 140,
		"sell_worth": 44,
		"rarity": ItemRarity.RARE
	})

	_register_item("cherbi_helm", {
		"item_name": "Cherbi Helm",
		"description": "A cherbi helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 49,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Mongol/CherbiHelm.png",
		"modifiers": {"def": 3},
		"buy_cost": 85,
		"sell_worth": 26,
		"rarity": ItemRarity.UNCOMMON
	})
	_register_item("khaan_helm", {
		"item_name": "Khaan Helm",
		"description": "A khaan's helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 48,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Mongol/KhaanHelm.png",
		"modifiers": {"def": 5, "str": 1},
		"buy_cost": 180,
		"sell_worth": 56,
		"rarity": ItemRarity.RARE
	})
	_register_item("kheshig_helm", {
		"item_name": "Kheshig Helm",
		"description": "A kheshig helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 47,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Mongol/KheshigHelm.png",
		"modifiers": {"def": 4},
		"buy_cost": 120,
		"sell_worth": 38,
		"rarity": ItemRarity.RARE
	})
	_register_item("noyon_helm", {
		"item_name": "Noyon Helm",
		"description": "A noyon helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 46,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Mongol/NoyonHelm.png",
		"modifiers": {"def": 4},
		"buy_cost": 115,
		"sell_worth": 36,
		"rarity": ItemRarity.UNCOMMON
	})

	_register_item("daimyo_helm", {
		"item_name": "Daimyo Helm",
		"description": "A daimyo's helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 69,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/DaimyoHelm.png",
		"modifiers": {"def": 5, "str": 1},
		"buy_cost": 190,
		"sell_worth": 60,
		"rarity": ItemRarity.RARE
	})
	_register_item("blue_ninja_bandana", {
		"item_name": "Blue Ninja Bandana",
		"description": "A blue ninja bandana",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 68,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/NinjaBandanaBlue.png",
		"modifiers": {"def": 1, "dex": 1},
		"buy_cost": 40,
		"sell_worth": 13,
		"rarity": ItemRarity.COMMON
	})
	_register_item("ronin_strawhat", {
		"item_name": "Ronin Straw-hat",
		"description": "A ronin's straw hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 67,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/RoninStrawhatBlue.png",
		"modifiers": {"def": 1},
		"buy_cost": 22,
		"sell_worth": 7,
		"rarity": ItemRarity.COMMON
	})
	_register_item("samurai_helm", {
		"item_name": "Samurai Helm",
		"description": "A samurai helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 66,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/SamuraiHelm.png",
		"modifiers": {"def": 4, "str": 1},
		"buy_cost": 145,
		"sell_worth": 46,
		"rarity": ItemRarity.RARE
	})
	_register_item("shogun_helm", {
		"item_name": "Shogun Helm",
		"description": "A shogun's helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 65,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/ShogunHelmPurple.png",
		"modifiers": {"def": 5, "str": 1},
		"buy_cost": 200,
		"sell_worth": 64,
		"rarity": ItemRarity.RARE
	})
	_register_item("straw_hat", {
		"item_name": "Straw-hat",
		"description": "A simple straw hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 64,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/TravellerStrawhat.png",
		"modifiers": {"def": 1},
		"buy_cost": 18,
		"sell_worth": 6,
		"rarity": ItemRarity.COMMON
	})
	_register_item("travelers_strawhat", {
		"item_name": "Traveler's Straw-hat",
		"description": "A traveler's straw hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 63,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/TravellerStrawhatCyan.png",
		"modifiers": {"def": 1},
		"buy_cost": 20,
		"sell_worth": 6,
		"rarity": ItemRarity.COMMON
	})
	_register_item("villagers_strawhat", {
		"item_name": "Villager's Straw-hat",
		"description": "A villager's straw hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 62,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/VillagerStrawhat.png",
		"modifiers": {"def": 1},
		"buy_cost": 16,
		"sell_worth": 5,
		"rarity": ItemRarity.COMMON
	})
	_register_item("yabusame_strawhat", {
		"item_name": "Yabusame Straw-hat",
		"description": "A yabusame straw hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 61,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Japanese/YabusameStrawhatBlue.png",
		"modifiers": {"def": 1},
		"buy_cost": 24,
		"sell_worth": 8,
		"rarity": ItemRarity.COMMON
	})

	_register_item("musketeers_hat", {
		"item_name": "Musketeer's Hat",
		"description": "A musketeer's hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 60,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/French/MusketeerHatPurple.png",
		"modifiers": {"def": 2},
		"buy_cost": 55,
		"sell_worth": 18,
		"rarity": ItemRarity.UNCOMMON
	})

	_register_item("archers_hat", {
		"item_name": "Archer's Hat",
		"description": "An archer's hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 89,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Range/ArcherHatCyan.png",
		"modifiers": {"def": 2, "dex": 1},
		"buy_cost": 58,
		"sell_worth": 18,
		"rarity": ItemRarity.COMMON
	})
	_register_item("hunters_hat", {
		"item_name": "Hunter's Hat",
		"description": "A hunter's hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 88,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Range/HunterHatRed.png",
		"modifiers": {"def": 2, "dex": 1},
		"buy_cost": 60,
		"sell_worth": 19,
		"rarity": ItemRarity.COMMON
	})
	_register_item("rogues_hat", {
		"item_name": "Rogue's Hat",
		"description": "A rogue's hat",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 87,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Range/RogueHatGreen.png",
		"modifiers": {"def": 2, "dex": 1},
		"buy_cost": 62,
		"sell_worth": 20,
		"rarity": ItemRarity.COMMON
	})

	_register_item("dark_knight_helm", {
		"item_name": "Dark Knight Helm",
		"description": "A dark knight helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 29,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/DarkKnightHelm.png",
		"modifiers": {"def": 5, "str": 1},
		"buy_cost": 175,
		"sell_worth": 55,
		"rarity": ItemRarity.RARE
	})
	_register_item("dragon_knight_helm", {
		"item_name": "Dragon Knight Helm",
		"description": "A dragon knight helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 21,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/DragonKnightHelm.png",
		"modifiers": {"def": 5, "str": 1},
		"buy_cost": 185,
		"sell_worth": 58,
		"rarity": ItemRarity.RARE
	})
	_register_item("grunt_helm", {
		"item_name": "Grunt Helm",
		"description": "A grunt helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 28,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/GruntHelm.png",
		"modifiers": {"def": 3},
		"buy_cost": 75,
		"sell_worth": 24,
		"rarity": ItemRarity.COMMON
	})
	_register_item("knight_helm", {
		"item_name": "Knight Helm",
		"description": "A knight helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 20,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/KnightHelm.png",
		"modifiers": {"def": 4},
		"buy_cost": 110,
		"sell_worth": 34,
		"rarity": ItemRarity.UNCOMMON
	})
	_register_item("novice_helm", {
		"item_name": "Novice Helm",
		"description": "A novice helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 45,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/NoviceHelm.png",
		"modifiers": {"def": 2},
		"buy_cost": 45,
		"sell_worth": 14,
		"rarity": ItemRarity.COMMON
	})
	_register_item("paladins_helm", {
		"item_name": "Paladin's Helm",
		"description": "A blessed paladin helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 44,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/PaladinHelmCyan.png",
		"modifiers": {"def": 5, "wis": 1},
		"buy_cost": 200,
		"sell_worth": 60,
		"rarity": ItemRarity.RARE
	})
	_register_item("scout_helm", {
		"item_name": "Scout Helm",
		"description": "A scout helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 43,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/ScoutHelmGreen.png",
		"modifiers": {"def": 3, "dex": 1},
		"buy_cost": 95,
		"sell_worth": 30,
		"rarity": ItemRarity.UNCOMMON
	})
	_register_item("soldier_bronze_helm", {
		"item_name": "Soldier Bronze Helm",
		"description": "A bronze soldier helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 42,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/SoldierBronzeHelmBlue.png",
		"modifiers": {"def": 4},
		"buy_cost": 105,
		"sell_worth": 32,
		"rarity": ItemRarity.UNCOMMON
	})
	_register_item("soldier_iron_helm", {
		"item_name": "Soldier Iron Helm",
		"description": "An iron soldier helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 42,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/SoldierBronzeHelmBlue.png",
		"modifiers": {"def": 4},
		"buy_cost": 110,
		"sell_worth": 34,
		"rarity": ItemRarity.UNCOMMON,
		"colorReplacements": [ {"original": _sb_o[0], "replace": _sb_iron[0]}, {"original": _sb_o[1], "replace": _sb_iron[1]}, {"original": _sb_o[2], "replace": _sb_iron[2]}, {"original": _sb_o[3], "replace": _sb_iron[3]}, {"original": _sb_o[4], "replace": _sb_iron[4]}, {"original": _sb_o[5], "replace": _sb_iron[5]}, {"original": _sb_o[6], "replace": _sb_iron[6]}, {"original": _sb_o[7], "replace": _sb_iron[7]}, {"original": _sb_o[8], "replace": _sb_iron[8]}]
	})
	_register_item("soldier_steel_helm", {
		"item_name": "Soldier Steel Helm",
		"description": "A steel soldier helm",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 42,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/SoldierBronzeHelmBlue.png",
		"modifiers": {"def": 4},
		"buy_cost": 125,
		"sell_worth": 38,
		"rarity": ItemRarity.UNCOMMON,
		"colorReplacements": [ {"original": _sb_o[0], "replace": _sb_steel[0]}, {"original": _sb_o[1], "replace": _sb_steel[1]}, {"original": _sb_o[2], "replace": _sb_steel[2]}, {"original": _sb_o[3], "replace": _sb_steel[3]}, {"original": _sb_o[4], "replace": _sb_steel[4]}, {"original": _sb_o[5], "replace": _sb_steel[5]}, {"original": _sb_o[6], "replace": _sb_steel[6]}, {"original": _sb_o[7], "replace": _sb_steel[7]}, {"original": _sb_o[8], "replace": _sb_steel[8]}]
	})

	_register_item("assassin_bandana", {
		"item_name": "Assassin Bandana",
		"description": "An assassin bandana",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 6,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Assassin/AssassinBandanaBlack.png",
		"modifiers": {"def": 1, "dex": 1},
		"buy_cost": 48,
		"sell_worth": 15,
		"rarity": ItemRarity.COMMON
	})
	_register_item("stalker_hood", {
		"item_name": "Stalker Hood",
		"description": "A stalker hood",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Assassin/StalkerHoodBlack.png",
		"modifiers": {"def": 2, "dex": 1},
		"buy_cost": 72,
		"sell_worth": 22,
		"rarity": ItemRarity.UNCOMMON
	})
	_register_item("thief_bandana", {
		"item_name": "Thief Bandana",
		"description": "A thief bandana",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.HEADGEAR,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8,
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Assassin/ThiefBandanaGreen.png",
		"modifiers": {"def": 1, "dex": 1},
		"buy_cost": 42,
		"sell_worth": 13,
		"rarity": ItemRarity.COMMON
	})

	# ACCESSORY items (row 1)
	_register_item("amulet_of_strength", {
		"item_name": "Amulet of Strength",
		"description": "Grants +3 STR",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ACCESSORY,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 1 * 20 + 17, # 17,1
		"modifiers": {"str": 3},
		"buy_cost": 250,
		"sell_worth": 75,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("elven_shield", {
		"item_name": "Elven Shield",
		"description": "An elegant elven shield",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 1 * 20 + 18, # 18,1
		"modifiers": {"def": 5, "dex": 1},
		"buy_cost": 180,
		"sell_worth": 54,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("tower_shield", {
		"item_name": "Tower Shield",
		"description": "A massive tower shield",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 1 * 20 + 19, # 19,1
		"modifiers": {"def": 6, "end": 1},
		"buy_cost": 220,
		"sell_worth": 66,
		"rarity": ItemRarity.RARE
	})
	
	# BOOTS items (row 2)
	_register_item("sandals", {
		"item_name": "Sandals",
		"description": "A pair of shitty sandals",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.BOOTS,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 10, # 10,2
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/ShoesBrown.png",
		"modifiers": {"def": 1},
		"buy_cost": 15,
		"sell_worth": 4,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("leather_boots", {
		"item_name": "Leather Boots",
		"description": "Comfortable leather boots",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.BOOTS,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 11, # 11,2
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/ShoesBrown.png",
		"modifiers": {"def": 2},
		"buy_cost": 40,
		"sell_worth": 12,
		"rarity": ItemRarity.COMMON,
		"weight": 1.5 # Boots are light
	})
	
	_register_item("sturdy_boots", {
		"item_name": "Sturdy Boots",
		"description": "Reinforced boots",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.BOOTS,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 12, # 12,2
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/ShoesMaple.png",
		"modifiers": {"def": 3},
		"buy_cost": 60,
		"sell_worth": 18,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("smiths_boots", {
		"item_name": "Smith's Boots",
		"description": "Heavy boots for smiths",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.BOOTS,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 13, # 13,2
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/ShoesMaple.png",
		"modifiers": {"def": 3, "end": 1},
		"buy_cost": 80,
		"sell_worth": 24,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("chain_boots", {
		"item_name": "Chain Boots",
		"description": "Chainmail boots",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.BOOTS,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 14, # 14,2
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/IronBoots.png",
		"modifiers": {"def": 4},
		"buy_cost": 100,
		"sell_worth": 30,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("plate_boots", {
		"item_name": "Plate Boots",
		"description": "Heavy plate boots",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.BOOTS,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 15, # 15,2
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/IronBoots.png",
		"modifiers": {"def": 5},
		"buy_cost": 140,
		"sell_worth": 42,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("gold_boots", {
		"item_name": "Gold Boots",
		"description": "Exquisite golden boots",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.BOOTS,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 16, # 16,2
		"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/IronBoots.png",
		"modifiers": {"def": 6, "lck": 1},
		"buy_cost": 250,
		"sell_worth": 75,
		"rarity": ItemRarity.RARE
	})
	
	# ACCESSORY items (row 2)
	_register_item("ring_of_healing", {
		"item_name": "Ring of Healing",
		"description": "Regenerates health over time",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ACCESSORY,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 17, # 17,2
		"modifiers": {"end": 2, "hp": 20},
		"buy_cost": 200,
		"sell_worth": 60,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("ring_of_magic", {
		"item_name": "Ring of Magic",
		"description": "Increases mana and spell power",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ACCESSORY,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 18, # 18,2
		"modifiers": {"int": 2, "mp": 30},
		"buy_cost": 200,
		"sell_worth": 60,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("ring_of_light", {
		"item_name": "Ring of Light",
		"description": "Increases light radius",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.ACCESSORY,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 2 * 20 + 19, # 19,2
		"modifiers": {"light_radius": 2},
		"buy_cost": 150,
		"sell_worth": 45,
		"rarity": ItemRarity.UNCOMMON
	})
	
	# WEAPONS - SWORDS (row 3)
	_register_item("long_sword", {
		"item_name": "Long Sword",
		"description": "A standard longsword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 10, # 10,3
		"modifiers": {"dmg": 5},
		"buy_cost": 100,
		"sell_worth": 30,
		"rarity": ItemRarity.COMMON,
		"weight": 3.5
	})
	
	_register_item("sword_of_blaze", {
		"item_name": "Sword of Blaze",
		"description": "A fiery sword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 11, # 11,3
		"modifiers": {"dmg": 8, "int": 2},
		"buy_cost": 250,
		"sell_worth": 75,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("excalibur", {
		"item_name": "Excalibur",
		"description": "The legendary sword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 12, # 12,3
		"modifiers": {"dmg": 15, "str": 3, "wis": 2},
		"buy_cost": 1000,
		"sell_worth": 300,
		"rarity": ItemRarity.EPIC
	})
	
	_register_item("sword_of_the_wind", {
		"item_name": "Sword of the Wind",
		"description": "A swift sword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 13, # 13,3
		"modifiers": {"dmg": 7, "dex": 3},
		"buy_cost": 300,
		"sell_worth": 90,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("halbrand", {
		"item_name": "Halbrand",
		"description": "A powerful sword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 14, # 14,3
		"modifiers": {"dmg": 12, "str": 2},
		"buy_cost": 400,
		"sell_worth": 120,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("thunders_wrath", {
		"item_name": "Thunder's Wrath",
		"description": "A sword crackling with lightning",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 15, # 15,3
		"modifiers": {"dmg": 10, "int": 3},
		"buy_cost": 350,
		"sell_worth": 105,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("bastard_sword", {
		"item_name": "Bastard Sword",
		"description": "A versatile sword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 16, # 16,3
		"modifiers": {"dmg": 6},
		"buy_cost": 120,
		"sell_worth": 36,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("blade_of_darkness", {
		"item_name": "Blade of Darkness",
		"description": "A dark and deadly blade",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 17, # 17,3
		"modifiers": {"dmg": 11, "lck": 2},
		"buy_cost": 380,
		"sell_worth": 114,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("golden_blade", {
		"item_name": "Golden Blade",
		"description": "An ornate golden sword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 18, # 18,3
		"modifiers": {"dmg": 9, "lck": 3},
		"buy_cost": 320,
		"sell_worth": 96,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("reapers_edge", {
		"item_name": "Reaper's Edge",
		"description": "A blade of death",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 3 * 20 + 19, # 19,3
		"modifiers": {"dmg": 13, "lck": 2, "str": 1},
		"buy_cost": 450,
		"sell_worth": 135,
		"rarity": ItemRarity.EPIC
	})
	
	# More SWORDS (row 4)
	_register_item("singers_edge", {
		"item_name": "Singer's Edge",
		"description": "An elegant rapier",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 4 * 20 + 10, # 10,4
		"modifiers": {"dmg": 6, "dex": 2},
		"buy_cost": 150,
		"sell_worth": 45,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("rapier", {
		"item_name": "Rapier",
		"description": "A precise rapier",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 4 * 20 + 11, # 11,4
		"modifiers": {"dmg": 5, "dex": 3},
		"buy_cost": 130,
		"sell_worth": 39,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("buster_sword", {
		"item_name": "Buster Sword",
		"description": "A massive sword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"two_handed": true,
		"spriteFrame": 4 * 20 + 12, # 12,4
		"modifiers": {"dmg": 14, "str": 2},
		"buy_cost": 500,
		"sell_worth": 150,
		"rarity": ItemRarity.EPIC
	})
	
	_register_item("doom_guard", {
		"item_name": "Doom Guard",
		"description": "A sword of doom",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 4 * 20 + 13, # 13,4
		"modifiers": {"dmg": 12, "str": 3},
		"buy_cost": 420,
		"sell_worth": 126,
		"rarity": ItemRarity.EPIC
	})
	
	_register_item("ice_age", {
		"item_name": "Ice Age",
		"description": "A frozen blade",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 4 * 20 + 14, # 14,4
		"modifiers": {"dmg": 10, "int": 2, "wis": 1},
		"buy_cost": 350,
		"sell_worth": 105,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("god_blade", {
		"item_name": "God Blade",
		"description": "A divine blade",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 4 * 20 + 15, # 15,4
		"modifiers": {"dmg": 16, "str": 2, "wis": 3},
		"buy_cost": 800,
		"sell_worth": 240,
		"rarity": ItemRarity.EPIC
	})
	
	# DAGGERS (row 4)
	_register_item("knife", {
		"item_name": "Knife",
		"description": "A sharp dagger",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.DAGGER,
		"spriteFrame": 4 * 20 + 16, # 16,4
		"modifiers": {"dmg": 3, "dex": 1},
		"buy_cost": 40,
		"sell_worth": 12,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("black_shiv", {
		"item_name": "Black Shiv",
		"description": "A dark dagger",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.DAGGER,
		"spriteFrame": 4 * 20 + 17, # 17,4
		"modifiers": {"dmg": 4, "dex": 2, "lck": 1},
		"buy_cost": 80,
		"sell_worth": 24,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("golden_knife", {
		"item_name": "Golden Knife",
		"description": "An ornate dagger",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.DAGGER,
		"spriteFrame": 4 * 20 + 18, # 18,4
		"modifiers": {"dmg": 5, "lck": 2},
		"buy_cost": 120,
		"sell_worth": 36,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("bloodletter", {
		"item_name": "Bloodletter",
		"description": "A deadly dagger",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.DAGGER,
		"spriteFrame": 4 * 20 + 19, # 19,4
		"modifiers": {"dmg": 6, "dex": 3, "lck": 1},
		"buy_cost": 180,
		"sell_worth": 54,
		"rarity": ItemRarity.RARE
	})
	
	# SWORDS and AXES (row 5)
	_register_item("short_sword", {
		"item_name": "Short Sword",
		"description": "A basic shortsword",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SWORD,
		"spriteFrame": 5 * 20 + 10, # 10,5
		"modifiers": {"dmg": 4},
		"buy_cost": 60,
		"sell_worth": 18,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("hatchet", {
		"item_name": "Hatchet",
		"description": "A small axe",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.AXE,
		"spriteFrame": 5 * 20 + 11, # 11,5
		"modifiers": {"dmg": 5, "str": 1},
		"buy_cost": 70,
		"sell_worth": 21,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("axe", {
		"item_name": "Axe",
		"description": "A standard axe",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.AXE,
		"spriteFrame": 5 * 20 + 12, # 12,5
		"modifiers": {"dmg": 7, "str": 1},
		"buy_cost": 100,
		"sell_worth": 30,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("golden_axe", {
		"item_name": "Golden Axe",
		"description": "An ornate golden axe",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.AXE,
		"spriteFrame": 5 * 20 + 13, # 13,5
		"modifiers": {"dmg": 9, "str": 2, "lck": 1},
		"buy_cost": 250,
		"sell_worth": 75,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("blood_axe", {
		"item_name": "Blood Axe",
		"description": "A savage axe",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.AXE,
		"spriteFrame": 5 * 20 + 14, # 14,5
		"modifiers": {"dmg": 10, "str": 3},
		"buy_cost": 300,
		"sell_worth": 90,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("battle_axe", {
		"item_name": "Battle Axe",
		"description": "A massive two-handed axe",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.AXE,
		"two_handed": true,
		"spriteFrame": 5 * 20 + 15, # 15,5
		"modifiers": {"dmg": 13, "str": 3},
		"buy_cost": 450,
		"sell_worth": 135,
		"rarity": ItemRarity.RARE
	})
	
	# STAVES (row 5)
	_register_item("staff", {
		"item_name": "Staff",
		"description": "A basic staff",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.STAFF,
		"two_handed": true,
		"spriteFrame": 5 * 20 + 16, # 16,5
		"modifiers": {"dmg": 3, "int": 2, "mp": 20},
		"buy_cost": 80,
		"sell_worth": 24,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("staff_of_darkness", {
		"item_name": "Staff of Darkness",
		"description": "A dark staff",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.STAFF,
		"two_handed": true,
		"spriteFrame": 5 * 20 + 17, # 17,5
		"modifiers": {"dmg": 6, "int": 4, "mp": 40},
		"buy_cost": 350,
		"sell_worth": 105,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("staff_of_light", {
		"item_name": "Staff of Light",
		"description": "A blessed staff",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.STAFF,
		"two_handed": true,
		"spriteFrame": 5 * 20 + 18, # 18,5
		"modifiers": {"dmg": 6, "wis": 4, "mp": 40},
		"buy_cost": 350,
		"sell_worth": 105,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("staff_of_fire", {
		"item_name": "Staff of Fire",
		"description": "A fiery staff",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.STAFF,
		"two_handed": true,
		"spriteFrame": 5 * 20 + 19, # 19,5
		"modifiers": {"dmg": 7, "int": 3, "mp": 35},
		"buy_cost": 380,
		"sell_worth": 114,
		"rarity": ItemRarity.RARE
	})
	
	# More STAVES and SPEARS (row 6)
	_register_item("staff_of_galactic_magic", {
		"item_name": "Staff of Galactic Magic",
		"description": "A legendary staff",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.STAFF,
		"two_handed": true,
		"spriteFrame": 6 * 20 + 10, # 10,6
		"modifiers": {"dmg": 10, "int": 5, "wis": 3, "mp": 60},
		"buy_cost": 700,
		"sell_worth": 210,
		"rarity": ItemRarity.EPIC
	})
	
	_register_item("spear", {
		"item_name": "Spear",
		"description": "A standard spear",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SPEAR,
		"two_handed": true,
		"spriteFrame": 6 * 20 + 11, # 11,6
		"modifiers": {"dmg": 6, "dex": 1},
		"buy_cost": 90,
		"sell_worth": 27,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("dark_spear", {
		"item_name": "Dark Spear",
		"description": "A dark spear",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SPEAR,
		"two_handed": true,
		"spriteFrame": 6 * 20 + 12, # 12,6
		"modifiers": {"dmg": 8, "dex": 2, "lck": 1},
		"buy_cost": 200,
		"sell_worth": 60,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("golden_spear", {
		"item_name": "Golden Spear",
		"description": "An ornate spear",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SPEAR,
		"two_handed": true,
		"spriteFrame": 6 * 20 + 13, # 13,6
		"modifiers": {"dmg": 9, "dex": 2, "lck": 2},
		"buy_cost": 280,
		"sell_worth": 84,
		"rarity": ItemRarity.RARE
	})
	
	_register_item("blood_spear", {
		"item_name": "Blood Spear",
		"description": "A deadly spear",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.SPEAR,
		"two_handed": true,
		"spriteFrame": 6 * 20 + 14, # 14,6
		"modifiers": {"dmg": 10, "dex": 3},
		"buy_cost": 320,
		"sell_worth": 96,
		"rarity": ItemRarity.RARE
	})
	
	# MACE and BOWS (row 6)
	_register_item("mace", {
		"item_name": "Mace",
		"description": "A heavy mace",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.MACE,
		"spriteFrame": 6 * 20 + 15, # 15,6
		"modifiers": {"dmg": 8, "str": 2},
		"buy_cost": 120,
		"sell_worth": 36,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("short_bow", {
		"item_name": "Short Bow",
		"description": "A wooden bow made of elfish lembas bread",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.BOW,
		"spriteFrame": 6 * 20 + 16, # 16,6
		"modifiers": {"dmg": 4, "dex": 2},
		"buy_cost": 100,
		"sell_worth": 30,
		"rarity": ItemRarity.COMMON,
		"weight": 2.5 # Bows are moderate weight
	})
	
	_register_item("dark_bow", {
		"item_name": "Dark Bow",
		"description": "A dark bow",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.BOW,
		"spriteFrame": 6 * 20 + 17, # 17,6
		"modifiers": {"dmg": 6, "dex": 3, "lck": 1},
		"buy_cost": 220,
		"sell_worth": 66,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("long_bow", {
		"item_name": "Long Bow",
		"description": "A powerful longbow",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.BOW,
		"spriteFrame": 6 * 20 + 18, # 18,6
		"modifiers": {"dmg": 7, "dex": 2},
		"buy_cost": 180,
		"sell_worth": 54,
		"rarity": ItemRarity.UNCOMMON
	})
	
	_register_item("blood_bow", {
		"item_name": "Blood Bow",
		"description": "A deadly bow",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.BOW,
		"spriteFrame": 6 * 20 + 19, # 19,6
		"modifiers": {"dmg": 8, "dex": 3},
		"buy_cost": 280,
		"sell_worth": 84,
		"rarity": ItemRarity.RARE
	})
	
	# More BOWS and AMMUNITION (row 7)
	_register_item("strike_force", {
		"item_name": "Strike Force",
		"description": "A legendary bow",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.MAINHAND,
		"weapon_type": Item.WeaponType.BOW,
		"spriteFrame": 7 * 20 + 10, # 10,7
		"modifiers": {"dmg": 10, "dex": 4, "lck": 2},
		"buy_cost": 500,
		"sell_worth": 150,
		"rarity": ItemRarity.EPIC
	})
	
	_register_item("arrow", {
		"item_name": "Arrow",
		"description": "A sharp arrow made of iron and feathers from pelican birds",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.AMMUNITION,
		"spriteFrame": 7 * 20 + 11, # 11,7
		"quantity": 15, # Increased from 13 to 15
		"can_have_multiple_of": true,
		"modifiers": {"dmg": 2},
		"buy_cost": 20,
		"sell_worth": 6,
		"rarity": ItemRarity.COMMON,
		"weight": 0.1, # Very light in inventory (arrows are light!)
		"drop_chance": 15.0 # Much higher drop chance = drops MUCH more often!
	})
	
	# CONSUMABLE FOOD ITEMS (row 7)
	_register_item("cheese", {
		"item_name": "Cheese",
		"description": "Restores 10 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7 * 20 + 12, # 12,7
		"weight": 0.2, # Very light consumable
		"modifiers": {"hp": 10},
		"buy_cost": 15,
		"sell_worth": 4,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("meat", {
		"item_name": "Meat",
		"description": "Restores 20 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7 * 20 + 13, # 13,7
		"modifiers": {"hp": 20},
		"buy_cost": 25,
		"sell_worth": 7,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("egg", {
		"item_name": "Egg",
		"description": "Restores 3 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7 * 20 + 14, # 14,7
		"modifiers": {"hp": 3},
		"buy_cost": 5,
		"sell_worth": 1,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("fish", {
		"item_name": "Fish",
		"description": "Restores 5 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7 * 20 + 15, # 15,7
		"modifiers": {"hp": 5},
		"buy_cost": 8,
		"sell_worth": 2,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("chicken_leg", {
		"item_name": "Chicken Leg",
		"description": "Restores 8 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7 * 20 + 16, # 16,7
		"modifiers": {"hp": 8},
		"buy_cost": 12,
		"sell_worth": 3,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("sandwich", {
		"item_name": "Sandwich",
		"description": "Restores 10 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7 * 20 + 17, # 17,7
		"modifiers": {"hp": 10},
		"buy_cost": 15,
		"sell_worth": 4,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("potato", {
		"item_name": "Potato",
		"description": "Restores 2 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7 * 20 + 18, # 18,7
		"modifiers": {"hp": 2},
		"buy_cost": 3,
		"sell_worth": 1,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("steak", {
		"item_name": "Steak",
		"description": "Restores 14 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 7 * 20 + 19, # 19,7
		"modifiers": {"hp": 14},
		"buy_cost": 20,
		"sell_worth": 6,
		"rarity": ItemRarity.COMMON
	})
	
	# More CONSUMABLE ITEMS (row 8)
	_register_item("cookie", {
		"item_name": "Cookie",
		"description": "Restores 4 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 13, # 13,8
		"modifiers": {"hp": 4},
		"buy_cost": 6,
		"sell_worth": 2,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("candy", {
		"item_name": "Candy",
		"description": "Restores 7 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 14, # 14,8
		"modifiers": {"hp": 7},
		"buy_cost": 10,
		"sell_worth": 3,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("apple", {
		"item_name": "Apple",
		"description": "Restores 20 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 10, # 10,8
		"modifiers": {"hp": 20},
		"buy_cost": 15,
		"sell_worth": 5,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("banana", {
		"item_name": "Banana",
		"description": "Restores 20 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 11, # 11,8
		"modifiers": {"hp": 20},
		"buy_cost": 15,
		"sell_worth": 5,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("cherry", {
		"item_name": "Cherry",
		"description": "Restores 20 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 12, # 12,8
		"modifiers": {"hp": 20},
		"buy_cost": 15,
		"sell_worth": 5,
		"rarity": ItemRarity.COMMON
	})
	
	_register_item("healing_potion", {
		"item_name": "Healing Potion",
		"description": "Restores 50 HP",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 15, # 15,8
		"weight": 0.3, # Light potion
		"modifiers": {"hp": 50},
		"buy_cost": 50,
		"sell_worth": 15,
		"rarity": ItemRarity.CONSUMABLE
	})
	
	_register_item("rejuvenation_potion", {
		"item_name": "Rejuvenation Potion",
		"description": "Restores 75 HP and 75 MANA",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 16, # 16,8
		"weight": 0.3, # Light potion
		"modifiers": {"hp": 75, "mp": 75},
		"buy_cost": 100,
		"sell_worth": 30,
		"rarity": ItemRarity.CONSUMABLE
	})
	
	_register_item("dodge_potion", {
		"item_name": "Dodge Potion",
		"description": "Grants higher dodge chance",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 17, # 17,8
		"weight": 0.3, # Light potion
		"modifiers": {"dodge_chance": 0.15}, # +15% dodge chance (temporary)
		"duration": 60.0, # 60 seconds
		"buy_cost": 80,
		"sell_worth": 24,
		"rarity": ItemRarity.CONSUMABLE
	})
	
	_register_item("mana_potion", {
		"item_name": "Mana Potion",
		"description": "Restores 50 MANA",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 18, # 18,8
		"weight": 0.3, # Light potion
		"modifiers": {"mp": 50},
		"buy_cost": 40,
		"sell_worth": 12,
		"rarity": ItemRarity.CONSUMABLE
	})
	
	_register_item("resistance_potion", {
		"item_name": "Resistance Potion",
		"description": "+25% all resistances",
		"item_type": Item.ItemType.Restoration,
		"equipment_type": Item.EquipmentType.NONE,
		"weapon_type": Item.WeaponType.NONE,
		"spriteFrame": 8 * 20 + 19, # 19,8
		"weight": 0.3, # Light potion
		"modifiers": {"res_all": 25}, # +25% to all resistances
		"duration": 120.0, # 120 seconds
		"buy_cost": 120,
		"sell_worth": 36,
		"rarity": ItemRarity.CONSUMABLE
	})
	
	# SPELLBOOKS (row 11, columns 13-14)
	# Sprite 233 = 11 * 20 + 13 — same base as Tome of Healing, blue colorReplacements
	var _tf_o = [
		Color(225.0 / 255.0, 130.0 / 255.0, 137.0 / 255.0),
		Color(174.0 / 255.0, 108.0 / 255.0, 55.0 / 255.0),
		Color(245.0 / 255.0, 183.0 / 255.0, 132.0 / 255.0),
		Color(130.0 / 255.0, 60.0 / 255.0, 61.0 / 255.0),
		Color(197.0 / 255.0, 151.0 / 255.0, 130.0 / 255.0)
	]
	var _tf_blue = [
		Color(0.35, 0.6, 0.95),
		Color(0.2, 0.4, 0.75),
		Color(0.5, 0.75, 1.0),
		Color(0.15, 0.35, 0.6),
		Color(0.4, 0.6, 0.85)
	]
	_register_item("tome_of_frostspike", {
		"item_name": "Tome of Frostspike",
		"description": "A spellbook containing frost magic",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.SPELLBOOK,
		"spriteFrame": 11 * 20 + 13, # 233
		"modifiers": {},
		"buy_cost": 100,
		"sell_worth": 30,
		"weight": 1.5,
		"rarity": ItemRarity.UNCOMMON,
		"colorReplacements": [
			{"original": _tf_o[0], "replace": _tf_blue[0]},
			{"original": _tf_o[1], "replace": _tf_blue[1]},
			{"original": _tf_o[2], "replace": _tf_blue[2]},
			{"original": _tf_o[3], "replace": _tf_blue[3]},
			{"original": _tf_o[4], "replace": _tf_blue[4]}
		]
	})
	
	# Sprite 234 = 11 * 20 + 14
	_register_item("tome_of_flames", {
		"item_name": "Tome of Flames",
		"description": "A spellbook containing fire magic",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.SPELLBOOK,
		"spriteFrame": 11 * 20 + 14, # 234
		"modifiers": {},
		"buy_cost": 100,
		"sell_worth": 30,
		"weight": 1.5,
		"rarity": ItemRarity.UNCOMMON,
		"colorReplacements": [
			{"old_color": Color(1.0, 1.0, 1.0), "new_color": Color(1.0, 0.8, 0.6)} # Warm orange tint for fire
		]
	})

	# Tome of Healing - frame 233 (11*20+13), green colorReplacements
	var _th_o = [
		Color(225.0 / 255.0, 130.0 / 255.0, 137.0 / 255.0),
		Color(174.0 / 255.0, 108.0 / 255.0, 55.0 / 255.0),
		Color(245.0 / 255.0, 183.0 / 255.0, 132.0 / 255.0),
		Color(130.0 / 255.0, 60.0 / 255.0, 61.0 / 255.0),
		Color(197.0 / 255.0, 151.0 / 255.0, 130.0 / 255.0)
	]
	var _th_green = [
		Color(0.35, 0.85, 0.4),
		Color(0.2, 0.6, 0.25),
		Color(0.5, 0.95, 0.55),
		Color(0.15, 0.5, 0.2),
		Color(0.4, 0.75, 0.45)
	]
	_register_item("tome_of_healing", {
		"item_name": "Tome of Healing",
		"description": "A spellbook containing healing magic",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.SPELLBOOK,
		"spriteFrame": 233,
		"modifiers": {},
		"buy_cost": 100,
		"sell_worth": 30,
		"weight": 1.5,
		"rarity": ItemRarity.UNCOMMON,
		"colorReplacements": [
			{"original": _th_o[0], "replace": _th_green[0]},
			{"original": _th_o[1], "replace": _th_green[1]},
			{"original": _th_o[2], "replace": _th_green[2]},
			{"original": _th_o[3], "replace": _th_green[3]},
			{"original": _th_o[4], "replace": _th_green[4]}
		]
	})
	
	# BOMB item (sprite index 199 = row 9, col 19)
	_register_item("bomb", {
		"item_name": "Bomb",
		"description": "A dangerous explosive device",
		"item_type": Item.ItemType.Equippable,
		"equipment_type": Item.EquipmentType.OFFHAND,
		"weapon_type": Item.WeaponType.BOMB,
		"spriteFrame": 199, # 9 * 20 + 19
		"quantity": 1,
		"can_have_multiple_of": true,
		"modifiers": {},
		"buy_cost": 50,
		"sell_worth": 15,
		"weight": 0.5,
		"rarity": ItemRarity.COMMON,
		"drop_chance": 5.0
	})

# Register an item in the database
static func _register_item(item_id: String, item_data: Dictionary):
	item_data["item_id"] = item_id
	item_definitions[item_id] = item_data

# Create an Item instance from an item ID
static func create_item(item_id: String) -> Item:
	_initialize()
	
	if not item_definitions.has(item_id):
		push_error("ItemDatabase: Item ID '%s' not found!" % item_id)
		return null
	
	var item_data = item_definitions[item_id].duplicate(true)
	var item = Item.new()
	
	# Set all properties from item_data
	item.item_name = item_data.get("item_name", "Unknown Item")
	item.description = item_data.get("description", "")
	item.item_type = item_data.get("item_type", Item.ItemType.Restoration)
	item.equipment_type = item_data.get("equipment_type", Item.EquipmentType.NONE)
	item.weapon_type = item_data.get("weapon_type", Item.WeaponType.NONE)
	item.spriteFrame = item_data.get("spriteFrame", 0)
	item.modifiers = item_data.get("modifiers", {}).duplicate(true)
	item.buy_cost = item_data.get("buy_cost", 10)
	item.sell_worth = item_data.get("sell_worth", 3)
	item.two_handed = item_data.get("two_handed", false)
	item.quantity = item_data.get("quantity", 1)
	item.can_have_multiple_of = item_data.get("can_have_multiple_of", false)
	item.duration = item_data.get("duration", 0.0)
	item.weight = item_data.get("weight", 1.0) # Default weight 1.0
	
	# spritePath defaults to items_n_shit.png in Item class, which is correct
	# spriteFrames defaults to Vector2i(20,14) in Item class, which is correct
	
	if item_data.has("equipmentPath"):
		item.equipmentPath = item_data["equipmentPath"]
	
	if item_data.has("colorReplacements"):
		item.colorReplacements = item_data["colorReplacements"].duplicate(true)
	
	# Remove item_id from data (internal use only)
	item_data.erase("item_id")
	item_data.erase("rarity") # Remove rarity (internal use only)
	
	return item

# Get a random item by rarity (weighted by item drop_chance field)
static func get_random_item_by_rarity(rarity: ItemRarity) -> Item:
	_initialize()
	
	var candidates = []
	var weights = []
	var total_weight = 0.0
	
	for item_id in item_definitions.keys():
		var item_data = item_definitions[item_id]
		if item_data.has("rarity") and item_data["rarity"] == rarity:
			candidates.append(item_id)
			# Use drop_chance field if present, otherwise default to 1.0
			var drop_chance = item_data.get("drop_chance", 1.0)
			weights.append(drop_chance)
			total_weight += drop_chance
	
	if candidates.is_empty():
		# Fallback to common items
		return get_random_item_by_rarity(ItemRarity.COMMON)
	
	# Weighted random selection based on drop_chance
	var roll = randf() * total_weight
	var cumulative = 0.0
	for i in range(candidates.size()):
		cumulative += weights[i]
		if roll <= cumulative:
			return create_item(candidates[i])
	
	# Fallback (shouldn't reach here)
	return create_item(candidates[candidates.size() - 1])

# Get a random item (weighted by rarity)
static func get_random_item() -> Item:
	_initialize()
	
	# Weighted random: 50% common, 25% uncommon, 15% rare, 5% epic, 5% consumable
	var roll = randf()
	var rarity: ItemRarity
	
	if roll < 0.5:
		rarity = ItemRarity.COMMON
	elif roll < 0.75:
		rarity = ItemRarity.UNCOMMON
	elif roll < 0.90:
		rarity = ItemRarity.RARE
	elif roll < 0.95:
		rarity = ItemRarity.EPIC
	else:
		rarity = ItemRarity.CONSUMABLE
	
	return get_random_item_by_rarity(rarity)

# Get random consumable items (arrows, bombs, restoration items) for enemy drops
static func get_random_consumable_drop() -> Item:
	_initialize()
	
	# Prioritize consumables: 70% CONSUMABLE rarity, 30% Restoration items
	var roll = randf()
	
	if roll < 0.7:
		# CONSUMABLE rarity items (arrows, bombs, etc.)
		return get_random_item_by_rarity(ItemRarity.CONSUMABLE)
	else:
		# Restoration items (food) - get from COMMON rarity with Restoration type
		var candidates = []
		var weights = []
		var total_weight = 0.0
		
		for item_id in item_definitions.keys():
			var item_data = item_definitions[item_id]
			if item_data.has("rarity") and item_data["rarity"] == ItemRarity.COMMON:
				if item_data.has("item_type") and item_data["item_type"] == Item.ItemType.Restoration:
					candidates.append(item_id)
					var drop_chance = item_data.get("drop_chance", 1.0)
					weights.append(drop_chance)
					total_weight += drop_chance
		
		if candidates.is_empty():
			# Fallback to CONSUMABLE rarity
			return get_random_item_by_rarity(ItemRarity.CONSUMABLE)
		
		# Weighted random selection
		var weight_roll = randf() * total_weight
		var cumulative = 0.0
		for i in range(candidates.size()):
			cumulative += weights[i]
			if weight_roll <= cumulative:
				return create_item(candidates[i])
		
		# Fallback
		return create_item(candidates[candidates.size() - 1])

# Get random equipment items (much rarer than consumables)
static func get_random_equipment_drop() -> Item:
	_initialize()
	
	# Equipment: 70% common, 25% uncommon, 4% rare, 1% epic
	var roll = randf()
	var rarity: ItemRarity
	
	if roll < 0.7:
		rarity = ItemRarity.COMMON
	elif roll < 0.95:
		rarity = ItemRarity.UNCOMMON
	elif roll < 0.99:
		rarity = ItemRarity.RARE
	else:
		rarity = ItemRarity.EPIC
	
	# Filter to only Equippable items of the selected rarity
	var candidates = []
	var weights = []
	var total_weight = 0.0
	
	for item_id in item_definitions.keys():
		var item_data = item_definitions[item_id]
		if item_data.has("rarity") and item_data["rarity"] == rarity:
			# Only include Equippable items (not consumables or restoration)
			if item_data.has("item_type") and item_data["item_type"] == Item.ItemType.Equippable:
				candidates.append(item_id)
				var drop_chance = item_data.get("drop_chance", 1.0)
				weights.append(drop_chance)
				total_weight += drop_chance
	
	if candidates.is_empty():
		# Fallback: try lower rarity equipment
		if rarity != ItemRarity.COMMON:
			# Try common equipment as fallback
			for item_id in item_definitions.keys():
				var item_data = item_definitions[item_id]
				if item_data.has("rarity") and item_data["rarity"] == ItemRarity.COMMON:
					if item_data.has("item_type") and item_data["item_type"] == Item.ItemType.Equippable:
						candidates.append(item_id)
						var drop_chance = item_data.get("drop_chance", 1.0)
						weights.append(drop_chance)
						total_weight += drop_chance
		
		if candidates.is_empty():
			# Last resort: return any common item
			return get_random_item_by_rarity(ItemRarity.COMMON)
	
	# Weighted random selection
	var weight_roll = randf() * total_weight
	var cumulative = 0.0
	for i in range(candidates.size()):
		cumulative += weights[i]
		if weight_roll <= cumulative:
			return create_item(candidates[i])
	
	# Fallback
	return create_item(candidates[candidates.size() - 1])

# Get random items for enemies (weighted towards common/uncommon)
static func get_random_enemy_drop() -> Item:
	_initialize()
	
	# Enemies: 60% common, 30% uncommon, 8% rare, 2% epic/consumable
	var roll = randf()
	var rarity: ItemRarity
	
	if roll < 0.6:
		rarity = ItemRarity.COMMON
	elif roll < 0.9:
		rarity = ItemRarity.UNCOMMON
	elif roll < 0.98:
		rarity = ItemRarity.RARE
	else:
		# 50/50 between epic and consumable
		rarity = ItemRarity.EPIC if randf() < 0.5 else ItemRarity.CONSUMABLE
	
	return get_random_item_by_rarity(rarity)

# Get random items for chests (better loot)
static func get_random_chest_item() -> Item:
	_initialize()
	
	# Chests: 40% common, 35% uncommon, 20% rare, 5% epic/consumable
	var roll = randf()
	var rarity: ItemRarity
	
	if roll < 0.4:
		rarity = ItemRarity.COMMON
	elif roll < 0.75:
		rarity = ItemRarity.UNCOMMON
	elif roll < 0.95:
		rarity = ItemRarity.RARE
	else:
		rarity = ItemRarity.EPIC if randf() < 0.5 else ItemRarity.CONSUMABLE
	
	return get_random_item_by_rarity(rarity)

# Get random items for destroyed containers (mostly consumables, some equipment)
static func get_random_container_item() -> Item:
	_initialize()
	
	# Containers: 50% food (common restoration), 30% common equipment, 15% uncommon, 5% rare
	var roll = randf()
	
	if roll < 0.5:
		# Food items (restoration items with rarity COMMON)
		var food_items = []
		for item_id in item_definitions.keys():
			var item_data = item_definitions[item_id]
			if item_data.has("rarity") and item_data["rarity"] == ItemRarity.COMMON:
				if item_data.has("item_type") and item_data["item_type"] == Item.ItemType.Restoration:
					food_items.append(item_id)
		
		if not food_items.is_empty():
			var random_food_id = food_items[randi() % food_items.size()]
			return create_item(random_food_id)
	
	# Fall back to normal random item with adjusted weights
	roll = randf()
	var rarity: ItemRarity
	if roll < 0.6:
		rarity = ItemRarity.COMMON
	elif roll < 0.85:
		rarity = ItemRarity.UNCOMMON
	else:
		rarity = ItemRarity.RARE
	
	return get_random_item_by_rarity(rarity)

# Ensure sprite uses cloth shader and apply item colorReplacements/tint (same as loot + character sprites).
# Use for inventory UI, loot, or any item icon sprite.
static func apply_item_colors_to_sprite(sprite: Sprite2D, item: Item) -> void:
	if not sprite:
		return
	var shader_res = load("res://shaders/cloth.gdshader") as Shader
	if not shader_res:
		return
	var mat: ShaderMaterial
	if sprite.material is ShaderMaterial:
		mat = sprite.material as ShaderMaterial
		if mat.shader != shader_res:
			mat = ShaderMaterial.new()
			mat.shader = shader_res
			sprite.material = mat
	else:
		mat = ShaderMaterial.new()
		mat.shader = shader_res
		sprite.material = mat
	for i in range(7):
		mat.set_shader_parameter("original_" + str(i), Color(0, 0, 0, 0))
		mat.set_shader_parameter("replace_" + str(i), Color(0, 0, 0, 0))
	mat.set_shader_parameter("tint", Color(1, 1, 1, 1))
	if item and item.colorReplacements and item.colorReplacements.size() > 0:
		for idx in range(item.colorReplacements.size()):
			if idx >= 7:
				break
			var cr: Dictionary = item.colorReplacements[idx]
			if cr.get("original") != null and cr.get("replace") != null:
				mat.set_shader_parameter("original_" + str(idx), cr["original"] as Color)
				mat.set_shader_parameter("replace_" + str(idx), cr["replace"] as Color)
