Explorar o código

Shop updated to use the scriptable objects created in unity

Axel Nordh hai 8 meses
pai
achega
ddd544f2c1

+ 37 - 0
Assets/Resources/Items/Armor/IronChainmail.asset

@@ -0,0 +1,37 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: d37416b822a924a4ca8b3d4daafd98b5, type: 3}
+  m_Name: IronChainmail
+  m_EditorClassIdentifier: 
+  itemName: Iron Chainmail
+  description: Interlocking iron rings provide solid protection.
+  icon: {fileID: 0}
+  model3D: {fileID: 0}
+  itemType: 1
+  rarity: 1
+  goldCost: 30
+  silverCost: 0
+  copperCost: 0
+  searchTags:
+  - chainmail
+  - armor
+  - chest
+  - medium
+  - iron
+  - metal
+  armorClass: 2
+  strengthModifier: 0
+  dexterityModifier: -1
+  constitutionModifier: 0
+  wisdomModifier: 0
+  armorType: 1
+  armorSlot: 1

+ 36 - 0
Assets/Resources/Items/Armor/LeatherArmor.asset

@@ -0,0 +1,36 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: d37416b822a924a4ca8b3d4daafd98b5, type: 3}
+  m_Name: LeatherArmor
+  m_EditorClassIdentifier: 
+  itemName: Leather Armor
+  description: Simple leather protection that doesn't restrict movement.
+  icon: {fileID: 0}
+  model3D: {fileID: 0}
+  itemType: 1
+  rarity: 0
+  goldCost: 12
+  silverCost: 0
+  copperCost: 0
+  searchTags:
+  - leather
+  - armor
+  - chest
+  - light
+  - flexible
+  armorClass: 1
+  strengthModifier: 0
+  dexterityModifier: 0
+  constitutionModifier: 0
+  wisdomModifier: 0
+  armorType: 0
+  armorSlot: 1

+ 47 - 0
Assets/Resources/Items/Miscellaneous/HealthPotion.asset

@@ -0,0 +1,47 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 43b6eb6d169fa44439fbdc878d83e78b, type: 3}
+  m_Name: HealthPotion
+  m_EditorClassIdentifier: 
+  itemName: Health Potion
+  description: A red liquid that restores vitality when consumed.
+  icon: {fileID: 0}
+  model3D: {fileID: 0}
+  itemType: 3
+  rarity: 0
+  goldCost: 3
+  silverCost: 0
+  copperCost: 0
+  searchTags:
+  - potion
+  - health
+  - healing
+  - consumable
+  - red
+  isConsumable: 1
+  isStackable: 1
+  maxStackSize: 10
+  healthRestoreMin: 0
+  healthRestoreMax: 0
+  healthDiceCount: 1
+  healthDiceType: 6
+  healthBonus: 1
+  manaRestoreMin: 0
+  manaRestoreMax: 0
+  manaDiceCount: 0
+  manaDiceType: 4
+  manaBonus: 0
+  temporaryStrengthBonus: 0
+  temporaryDexterityBonus: 0
+  temporaryConstitutionBonus: 0
+  temporaryWisdomBonus: 0
+  effectDuration: 0

+ 47 - 0
Assets/Resources/Items/Miscellaneous/HempRope.asset

@@ -0,0 +1,47 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 43b6eb6d169fa44439fbdc878d83e78b, type: 3}
+  m_Name: HempRope
+  m_EditorClassIdentifier: 
+  itemName: Hemp Rope
+  description: 50 feet of sturdy rope. Essential for any adventurer.
+  icon: {fileID: 0}
+  model3D: {fileID: 0}
+  itemType: 4
+  rarity: 0
+  goldCost: 0
+  silverCost: 8
+  copperCost: 0
+  searchTags:
+  - rope
+  - hemp
+  - utility
+  - tool
+  - climbing
+  isConsumable: 0
+  isStackable: 0
+  maxStackSize: 99
+  healthRestoreMin: 0
+  healthRestoreMax: 0
+  healthDiceCount: 0
+  healthDiceType: 6
+  healthBonus: 0
+  manaRestoreMin: 0
+  manaRestoreMax: 0
+  manaDiceCount: 0
+  manaDiceType: 4
+  manaBonus: 0
+  temporaryStrengthBonus: 0
+  temporaryDexterityBonus: 0
+  temporaryConstitutionBonus: 0
+  temporaryWisdomBonus: 0
+  effectDuration: 0

+ 47 - 0
Assets/Resources/Items/Miscellaneous/ManaPotion.asset

@@ -0,0 +1,47 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 43b6eb6d169fa44439fbdc878d83e78b, type: 3}
+  m_Name: ManaPotion
+  m_EditorClassIdentifier: 
+  itemName: Mana Potion
+  description: A blue liquid that restores magical energy.
+  icon: {fileID: 0}
+  model3D: {fileID: 0}
+  itemType: 3
+  rarity: 0
+  goldCost: 4
+  silverCost: 0
+  copperCost: 0
+  searchTags:
+  - potion
+  - mana
+  - magic
+  - consumable
+  - blue
+  isConsumable: 1
+  isStackable: 1
+  maxStackSize: 10
+  healthRestoreMin: 0
+  healthRestoreMax: 0
+  healthDiceCount: 0
+  healthDiceType: 6
+  healthBonus: 0
+  manaRestoreMin: 0
+  manaRestoreMax: 0
+  manaDiceCount: 1
+  manaDiceType: 4
+  manaBonus: 0
+  temporaryStrengthBonus: 0
+  temporaryDexterityBonus: 0
+  temporaryConstitutionBonus: 0
+  temporaryWisdomBonus: 0
+  effectDuration: 0

+ 39 - 0
Assets/Resources/Items/Weapons/IronSword.asset

@@ -0,0 +1,39 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 3f3fc2d34ad47104ea60fdf8fa56b9e6, type: 3}
+  m_Name: IronSword
+  m_EditorClassIdentifier: 
+  itemName: Iron Sword
+  description: A well-crafted iron sword. Durable and sharp, favored by town guards.
+  icon: {fileID: 0}
+  model3D: {fileID: 0}
+  itemType: 0
+  rarity: 1
+  goldCost: 25
+  silverCost: 0
+  copperCost: 0
+  searchTags:
+  - sword
+  - melee
+  - blade
+  - iron
+  - guard
+  - military
+  minDamage: 2
+  maxDamage: 8
+  range: 5
+  weaponModifier: 1
+  attackSpeed: 1
+  weaponType: 0
+  weaponClassName: SimpleSword
+  weaponPrefab: {fileID: 0}
+  arrowPrefab: {fileID: 0}

+ 38 - 0
Assets/Resources/Items/Weapons/SimpleBow.asset

@@ -0,0 +1,38 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 3f3fc2d34ad47104ea60fdf8fa56b9e6, type: 3}
+  m_Name: SimpleBow
+  m_EditorClassIdentifier: 
+  itemName: Simple Bow
+  description: A basic wooden bow with decent range. Perfect for hunting small game.
+  icon: {fileID: 0}
+  model3D: {fileID: 0}
+  itemType: 0
+  rarity: 0
+  goldCost: 15
+  silverCost: 0
+  copperCost: 0
+  searchTags:
+  - bow
+  - ranged
+  - arrow
+  - hunting
+  - wood
+  minDamage: 1
+  maxDamage: 4
+  range: 150
+  weaponModifier: 0
+  attackSpeed: 0.8
+  weaponType: 1
+  weaponClassName: SimpleBow
+  weaponPrefab: {fileID: 0}
+  arrowPrefab: {fileID: 0}

+ 38 - 0
Assets/Resources/Items/Weapons/SimpleSword.asset

@@ -0,0 +1,38 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 3f3fc2d34ad47104ea60fdf8fa56b9e6, type: 3}
+  m_Name: SimpleSword
+  m_EditorClassIdentifier: 
+  itemName: Simple Sword
+  description: A basic sword perfect for beginners. Light and easy to handle.
+  icon: {fileID: 0}
+  model3D: {fileID: 0}
+  itemType: 0
+  rarity: 0
+  goldCost: 10
+  silverCost: 0
+  copperCost: 0
+  searchTags:
+  - sword
+  - melee
+  - blade
+  - basic
+  - one-handed
+  minDamage: 1
+  maxDamage: 6
+  range: 5
+  weaponModifier: 0
+  attackSpeed: 1
+  weaponType: 0
+  weaponClassName: SimpleSword
+  weaponPrefab: {fileID: 0}
+  arrowPrefab: {fileID: 0}

+ 1 - 0
Assets/Resources/TravelEvents/HiddenTreasure.asset

@@ -16,6 +16,7 @@ MonoBehaviour:
   eventDescription: You spot a hidden treasure with loot in it.
   eventType: 2
   rarity: 2
+  triggerType: 1
   plainsChance: 0.4
   forestChance: 0.7
   mountainChance: 0.8

+ 1 - 0
Assets/Resources/TravelEvents/SkeletonAmbush.asset

@@ -17,6 +17,7 @@ MonoBehaviour:
     party!
   eventType: 0
   rarity: 1
+  triggerType: 1
   plainsChance: 0.4
   forestChance: 0.8
   mountainChance: 0.9

+ 19 - 21
Assets/Scenes/MainTeamSelectScene.unity

@@ -387,6 +387,7 @@ GameObject:
   m_Component:
   - component: {fileID: 1336314991}
   - component: {fileID: 1336314990}
+  - component: {fileID: 1336314992}
   m_Layer: 0
   m_Name: ShopSystem
   m_TagString: Untagged
@@ -403,29 +404,12 @@ MonoBehaviour:
   m_GameObject: {fileID: 1336314989}
   m_Enabled: 1
   m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 62411056f4a14d64a9984b57c1e91667, type: 3}
+  m_Script: {fileID: 11500000, guid: 5d4d1b206cd0c144b8030ee426f7cb89, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  instructions: 'Setup Instructions:
-
-    1. Create a GameObject and attach SimpleShopManager
-    script
-
-    2. Create a UI Document with ShopUI.uxml as the Visual Tree Asset
-
-    3.
-    Attach the UI Document to the same GameObject as SimpleShopManager
-
-    4. The
-    shop will automatically populate with default items
-
-    5. Click ''Add Weapon'',
-    ''Add Armor'', or ''Add Misc'' buttons in character inventory to open shop'
-  createShopGameObject: 1
-  shopUIAsset: {fileID: 9197481963319205126, guid: 9c5235cf7904a254cb37c229e549e15d, type: 3}
-  testShopSystem: 0
-  debugShopSetup: 0
-  createPanelSettings: 0
+  autoSetupOnStart: 1
+  shopSetupComplete: 0
+  statusMessage: Not setup yet
 --- !u!4 &1336314991
 Transform:
   m_ObjectHideFlags: 0
@@ -441,6 +425,20 @@ Transform:
   m_Children: []
   m_Father: {fileID: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &1336314992
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1336314989}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 2cc56a9d96cceeb4d9716e89c6716f9b, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  shopName: General Store
+  availableItems: []
 --- !u!1 &1379964092
 GameObject:
   m_ObjectHideFlags: 0

+ 121 - 3
Assets/Scenes/MapScene2.unity

@@ -287,6 +287,75 @@ MonoBehaviour:
   combatEventPopup: {fileID: 0}
   combatEventPopupUXML: {fileID: 1319078988}
   combatPopupPrefab: {fileID: 0}
+--- !u!1 &684362517
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 684362519}
+  - component: {fileID: 684362518}
+  - component: {fileID: 684362520}
+  m_Layer: 0
+  m_Name: PerceptionSystem
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!114 &684362518
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 684362517}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 7a29e135b21df984cb52b6bc31b159e3, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  autoSetupOnStart: 1
+  enablePerceptionVisualization: 1
+  perceptionColor: {r: 0.5, g: 0, b: 1, a: 0.5019608}
+  perceptionMultiplier: 1
+  customMaterial: {fileID: 0}
+  showDebugInfo: 0
+--- !u!4 &684362519
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 684362517}
+  serializedVersion: 2
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 12.970818, y: 433.2704, z: 802.6817}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 0}
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &684362520
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 684362517}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: c970ff5bbb05f7b49bd8d929e2c0169b, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  autoSetupOnStart: 1
+  eventMarkerPrefab: {fileID: 0}
+  eventMarkerMaterial: {fileID: 0}
+  eventMarkerColor: {r: 1, g: 0, b: 0, a: 1}
+  maxActiveMarkers: 5
+  showSetupLogs: 1
 --- !u!1 &1243674619
 GameObject:
   m_ObjectHideFlags: 0
@@ -297,6 +366,7 @@ GameObject:
   m_Component:
   - component: {fileID: 1243674621}
   - component: {fileID: 1243674620}
+  - component: {fileID: 1243674622}
   m_Layer: 0
   m_Name: TeamPlacement
   m_TagString: Untagged
@@ -338,6 +408,27 @@ Transform:
   m_Children: []
   m_Father: {fileID: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &1243674622
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1243674619}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 23eda89823d1bd74cbf5bc5ab029eeac, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  perceptionCircleMaterial: {fileID: 0}
+  perceptionColor: {r: 0.5, g: 0, b: 1, a: 0.5}
+  perceptionMultiplier: 1
+  circleSegments: 64
+  heightOffset: 0.1
+  updatePerceptionInRealTime: 1
+  updateInterval: 1
+  isVisualizationEnabled: 1
+  showDebugInfo: 1
 --- !u!1 &1247461679
 GameObject:
   m_ObjectHideFlags: 0
@@ -383,7 +474,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   autoSetupOnStart: 1
-  showDebugLogs: 1
+  showDebugLogs: 0
   teamOverviewUXML: {fileID: 9197481963319205126, guid: 23b3e0762b0e7d846be71cc686b85db6, type: 3}
   teamOverviewStyleSheet: {fileID: 7433441132597879392, guid: 2607b595cd37ccb449bed7543baf7ffe, type: 3}
 --- !u!1 &1299661707
@@ -588,6 +679,7 @@ GameObject:
   - component: {fileID: 1581552014}
   - component: {fileID: 1581552016}
   - component: {fileID: 1581552017}
+  - component: {fileID: 1581552018}
   m_Layer: 0
   m_Name: TravelSystemSetup
   m_TagString: Untagged
@@ -630,7 +722,7 @@ MonoBehaviour:
   pathLineWidth: 0.2
   pathLineHeight: 1
   showDebugLogs: 0
-  showMovementCosts: 0
+  showMovementCosts: 1
   timeMultiplier: 1
   timeSpeedOptions:
   - 1
@@ -670,7 +762,7 @@ MonoBehaviour:
   availableEvents:
   - {fileID: 11400000, guid: 3756641546a12504cbd1273f2dd7bbf3, type: 2}
   - {fileID: 11400000, guid: 7f47d27e7a16f0d4ca61a2db845dd20e, type: 2}
-  showDebugLogs: 1
+  showDebugLogs: 0
   forceNextEvent: 0
 --- !u!114 &1581552017
 MonoBehaviour:
@@ -687,6 +779,31 @@ MonoBehaviour:
   combatEventPopup: {fileID: 0}
   combatEventPopupUXML: {fileID: 1319078988}
   combatPopupPrefab: {fileID: 0}
+--- !u!114 &1581552018
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1581552013}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 1254edd76b103384c955465307eb6901, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  eventMarkerPrefab: {fileID: 0}
+  eventMarkerMaterial: {fileID: 0}
+  eventMarkerColor: {r: 1, g: 0, b: 0, a: 1}
+  markerSize: 0.8
+  markerHeight: 0.6
+  maxActiveMarkers: 5
+  minDistanceFromTeam: 2
+  maxDistanceFromTeam: 8
+  markerLifetime: 30
+  enablePulsing: 1
+  pulseSpeed: 2
+  pulseIntensity: 0.3
+  showDebugInfo: 0
 --- !u!1 &1953346056
 GameObject:
   m_ObjectHideFlags: 0
@@ -858,3 +975,4 @@ SceneRoots:
   - {fileID: 591284419}
   - {fileID: 1319078986}
   - {fileID: 1247461680}
+  - {fileID: 684362519}

+ 181 - 0
Assets/Scripts/Editor/CreateSampleItems.cs

@@ -0,0 +1,181 @@
+using UnityEngine;
+using UnityEditor;
+
+public class CreateSampleItems
+{
+    [MenuItem("RPG/Create Sample Items")]
+    public static void CreateItems()
+    {
+        // Create weapon items
+        CreateSimpleSword();
+        CreateSimpleBow();
+        CreateIronSword();
+
+        // Create armor items
+        CreateLeatherArmor();
+        CreateIronChainmail();
+
+        // Create miscellaneous items
+        CreateHealthPotion();
+        CreateManaPotion();
+        CreateHempRope();
+
+        AssetDatabase.SaveAssets();
+        AssetDatabase.Refresh();
+
+        Debug.Log("Sample items created in Resources/Items folder!");
+    }
+
+    private static void CreateSimpleSword()
+    {
+        var sword = ScriptableObject.CreateInstance<WeaponItem>();
+        sword.itemName = "Simple Sword";
+        sword.description = "A basic sword perfect for beginners. Light and easy to handle.";
+        sword.itemType = ItemType.Weapon;
+        sword.rarity = ItemRarity.Common;
+        sword.goldCost = 10;
+        sword.minDamage = 1;
+        sword.maxDamage = 6;
+        sword.range = 5; // Melee range
+        sword.weaponModifier = 0;
+        sword.attackSpeed = 1.0f;
+        sword.weaponType = WeaponType.Sword;
+        sword.weaponClassName = "SimpleSword";
+        sword.searchTags = new string[] { "sword", "melee", "blade", "basic", "one-handed" };
+
+        AssetDatabase.CreateAsset(sword, "Assets/Resources/Items/Weapons/SimpleSword.asset");
+    }
+
+    private static void CreateSimpleBow()
+    {
+        var bow = ScriptableObject.CreateInstance<WeaponItem>();
+        bow.itemName = "Simple Bow";
+        bow.description = "A basic wooden bow with decent range. Perfect for hunting small game.";
+        bow.itemType = ItemType.Weapon;
+        bow.rarity = ItemRarity.Common;
+        bow.goldCost = 15;
+        bow.minDamage = 1;
+        bow.maxDamage = 4;
+        bow.range = 150;
+        bow.weaponModifier = 0;
+        bow.attackSpeed = 0.8f;
+        bow.weaponType = WeaponType.Bow;
+        bow.weaponClassName = "SimpleBow";
+        bow.searchTags = new string[] { "bow", "ranged", "arrow", "hunting", "wood" };
+
+        AssetDatabase.CreateAsset(bow, "Assets/Resources/Items/Weapons/SimpleBow.asset");
+    }
+
+    private static void CreateIronSword()
+    {
+        var sword = ScriptableObject.CreateInstance<WeaponItem>();
+        sword.itemName = "Iron Sword";
+        sword.description = "A well-crafted iron sword. Durable and sharp, favored by town guards.";
+        sword.itemType = ItemType.Weapon;
+        sword.rarity = ItemRarity.Uncommon;
+        sword.goldCost = 25;
+        sword.minDamage = 2;
+        sword.maxDamage = 8;
+        sword.range = 5;
+        sword.weaponModifier = 1;
+        sword.attackSpeed = 1.0f;
+        sword.weaponType = WeaponType.Sword;
+        sword.weaponClassName = "SimpleSword";
+        sword.searchTags = new string[] { "sword", "melee", "blade", "iron", "guard", "military" };
+
+        AssetDatabase.CreateAsset(sword, "Assets/Resources/Items/Weapons/IronSword.asset");
+    }
+
+    private static void CreateLeatherArmor()
+    {
+        var armor = ScriptableObject.CreateInstance<ArmorItem>();
+        armor.itemName = "Leather Armor";
+        armor.description = "Simple leather protection that doesn't restrict movement.";
+        armor.itemType = ItemType.Armor;
+        armor.rarity = ItemRarity.Common;
+        armor.goldCost = 12;
+        armor.armorClass = 1;
+        armor.armorType = ArmorType.Light;
+        armor.armorSlot = ArmorSlot.Chest;
+        armor.dexterityModifier = 0; // No penalty for light armor
+        armor.searchTags = new string[] { "leather", "armor", "chest", "light", "flexible" };
+
+        AssetDatabase.CreateAsset(armor, "Assets/Resources/Items/Armor/LeatherArmor.asset");
+    }
+
+    private static void CreateIronChainmail()
+    {
+        var armor = ScriptableObject.CreateInstance<ArmorItem>();
+        armor.itemName = "Iron Chainmail";
+        armor.description = "Interlocking iron rings provide solid protection.";
+        armor.itemType = ItemType.Armor;
+        armor.rarity = ItemRarity.Uncommon;
+        armor.goldCost = 30;
+        armor.armorClass = 2;
+        armor.armorType = ArmorType.Medium;
+        armor.armorSlot = ArmorSlot.Chest;
+        armor.dexterityModifier = -1; // Medium armor restricts movement slightly
+        armor.searchTags = new string[] { "chainmail", "armor", "chest", "medium", "iron", "metal" };
+
+        AssetDatabase.CreateAsset(armor, "Assets/Resources/Items/Armor/IronChainmail.asset");
+    }
+
+    private static void CreateHealthPotion()
+    {
+        var potion = ScriptableObject.CreateInstance<MiscellaneousItem>();
+        potion.itemName = "Health Potion";
+        potion.description = "A red liquid that restores vitality when consumed.";
+        potion.itemType = ItemType.Consumable;
+        potion.rarity = ItemRarity.Common;
+        potion.goldCost = 3;
+        potion.isConsumable = true;
+        potion.isStackable = true;
+        potion.maxStackSize = 10;
+
+        // Heals 1d6+1 (2-7 health)
+        potion.healthDiceCount = 1;
+        potion.healthDiceType = 6;
+        potion.healthBonus = 1;
+
+        potion.searchTags = new string[] { "potion", "health", "healing", "consumable", "red" };
+
+        AssetDatabase.CreateAsset(potion, "Assets/Resources/Items/Miscellaneous/HealthPotion.asset");
+    }
+
+    private static void CreateManaPotion()
+    {
+        var potion = ScriptableObject.CreateInstance<MiscellaneousItem>();
+        potion.itemName = "Mana Potion";
+        potion.description = "A blue liquid that restores magical energy.";
+        potion.itemType = ItemType.Consumable;
+        potion.rarity = ItemRarity.Common;
+        potion.goldCost = 4;
+        potion.isConsumable = true;
+        potion.isStackable = true;
+        potion.maxStackSize = 10;
+
+        // Restores 1d4 (1-4 mana)
+        potion.manaDiceCount = 1;
+        potion.manaDiceType = 4;
+        potion.manaBonus = 0;
+
+        potion.searchTags = new string[] { "potion", "mana", "magic", "consumable", "blue" };
+
+        AssetDatabase.CreateAsset(potion, "Assets/Resources/Items/Miscellaneous/ManaPotion.asset");
+    }
+
+    private static void CreateHempRope()
+    {
+        var rope = ScriptableObject.CreateInstance<MiscellaneousItem>();
+        rope.itemName = "Hemp Rope";
+        rope.description = "50 feet of sturdy rope. Essential for any adventurer.";
+        rope.itemType = ItemType.Tool;
+        rope.rarity = ItemRarity.Common;
+        rope.silverCost = 8;
+        rope.isConsumable = false;
+        rope.isStackable = false;
+        rope.searchTags = new string[] { "rope", "hemp", "utility", "tool", "climbing" };
+
+        AssetDatabase.CreateAsset(rope, "Assets/Resources/Items/Miscellaneous/HempRope.asset");
+    }
+}

+ 199 - 0
Assets/Scripts/Editor/ShopSystemMigrator.cs

@@ -0,0 +1,199 @@
+using UnityEngine;
+using UnityEditor;
+using UnityEditor.SceneManagement;
+using UnityEngine.SceneManagement;
+using UnityEngine.UIElements;
+
+public class ShopSystemMigrator
+{
+    [MenuItem("RPG/Migrate Shop System")]
+    public static void MigrateShopSystem()
+    {
+        // Load the MainTeamSelectScene
+        Scene scene = EditorSceneManager.OpenScene("Assets/Scenes/MainTeamSelectScene.unity");
+
+        if (!scene.IsValid())
+        {
+            Debug.LogError("Could not load MainTeamSelectScene.unity");
+            return;
+        }
+
+        bool changesMade = false;
+
+        // Find all SimpleShopManager components in the scene
+        SimpleShopManager[] oldShopManagers = Object.FindObjectsByType<SimpleShopManager>(FindObjectsSortMode.None);
+
+        foreach (SimpleShopManager oldManager in oldShopManagers)
+        {
+            GameObject shopObject = oldManager.gameObject;
+
+            // Store the old settings
+            string shopName = oldManager.shopName;
+            var uiDocument = shopObject.GetComponent<UIDocument>();
+
+            Debug.Log($"Converting SimpleShopManager on '{shopObject.name}' to ItemShopManager");
+
+            // Remove the old component
+            Object.DestroyImmediate(oldManager);
+
+            // Add the new component
+            ItemShopManager newManager = shopObject.AddComponent<ItemShopManager>();
+            newManager.shopName = shopName;
+
+            changesMade = true;
+        }
+
+        if (changesMade)
+        {
+            // Mark the scene as dirty so Unity knows it needs to be saved
+            EditorSceneManager.MarkSceneDirty(scene);
+
+            // Save the scene
+            EditorSceneManager.SaveScene(scene);
+
+            Debug.Log($"Successfully migrated {oldShopManagers.Length} SimpleShopManager(s) to ItemShopManager in MainTeamSelectScene");
+            Debug.Log("The scene has been saved with the changes.");
+        }
+        else
+        {
+            Debug.Log("No SimpleShopManager components found in MainTeamSelectScene to migrate.");
+        }
+    }
+
+    [MenuItem("RPG/Setup New Shop System")]
+    public static void SetupNewShopSystem()
+    {
+        // Load the MainTeamSelectScene
+        Scene scene = EditorSceneManager.OpenScene("Assets/Scenes/MainTeamSelectScene.unity");
+
+        if (!scene.IsValid())
+        {
+            Debug.LogError("Could not load MainTeamSelectScene.unity");
+            return;
+        }
+
+        // Check if there's already an ItemShopManager
+        ItemShopManager[] existingManagers = Object.FindObjectsByType<ItemShopManager>(FindObjectsSortMode.None);
+
+        if (existingManagers.Length > 0)
+        {
+            Debug.Log($"Found {existingManagers.Length} existing ItemShopManager(s) in the scene.");
+            return;
+        }
+
+        // Find objects that might need a shop manager (look for UIDocument with shop-related names)
+        UIDocument[] uiDocuments = Object.FindObjectsByType<UIDocument>(FindObjectsSortMode.None);
+
+        GameObject shopObject = null;
+
+        // Look for a GameObject that might be the shop
+        foreach (UIDocument uiDoc in uiDocuments)
+        {
+            if (uiDoc.gameObject.name.ToLower().Contains("shop"))
+            {
+                shopObject = uiDoc.gameObject;
+                break;
+            }
+        }
+
+        // If no shop object found, create a new one
+        if (shopObject == null)
+        {
+            shopObject = new GameObject("ShopManager");
+
+            // Add UIDocument component
+            UIDocument uiDocument = shopObject.AddComponent<UIDocument>();
+
+            // Try to find ShopUI.uxml
+            string[] guids = AssetDatabase.FindAssets("ShopUI t:VisualTreeAsset");
+            if (guids.Length > 0)
+            {
+                string path = AssetDatabase.GUIDToAssetPath(guids[0]);
+                var visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(path);
+                uiDocument.visualTreeAsset = visualTreeAsset;
+                Debug.Log($"Assigned ShopUI.uxml to UIDocument: {path}");
+            }
+            else
+            {
+                Debug.LogWarning("ShopUI.uxml not found. You'll need to assign it manually to the UIDocument component.");
+            }
+        }
+
+        // Add ItemShopManager component
+        ItemShopManager shopManager = shopObject.AddComponent<ItemShopManager>();
+        shopManager.shopName = "General Store";
+
+        // Mark the scene as dirty and save
+        EditorSceneManager.MarkSceneDirty(scene);
+        EditorSceneManager.SaveScene(scene);
+
+        Debug.Log($"Created ItemShopManager on '{shopObject.name}' in MainTeamSelectScene");
+        Debug.Log("Don't forget to:");
+        Debug.Log("1. Assign ShopUI.uxml to the UIDocument component if not already done");
+        Debug.Log("2. Run 'RPG > Create Sample Items' to create some items to sell");
+        Debug.Log("3. Create your own Item ScriptableObjects using the Create menu (RPG > Items)");
+    }
+
+    [MenuItem("RPG/Verify Shop Setup")]
+    public static void VerifyShopSetup()
+    {
+        // Load the MainTeamSelectScene
+        Scene scene = EditorSceneManager.OpenScene("Assets/Scenes/MainTeamSelectScene.unity");
+
+        if (!scene.IsValid())
+        {
+            Debug.LogError("Could not load MainTeamSelectScene.unity");
+            return;
+        }
+
+        Debug.Log("=== Shop System Verification ===");
+
+        // Check for ItemShopManager
+        ItemShopManager[] shopManagers = Object.FindObjectsByType<ItemShopManager>(FindObjectsSortMode.None);
+        Debug.Log($"ItemShopManager components found: {shopManagers.Length}");
+
+        // Check for remaining SimpleShopManager (should be 0)
+        SimpleShopManager[] oldManagers = Object.FindObjectsByType<SimpleShopManager>(FindObjectsSortMode.None);
+        if (oldManagers.Length > 0)
+        {
+            Debug.LogWarning($"Found {oldManagers.Length} SimpleShopManager components that still need migration!");
+        }
+
+        // Check for items in Resources
+        Item[] items = Resources.LoadAll<Item>("Items");
+        Debug.Log($"Item ScriptableObjects found in Resources/Items: {items.Length}");
+
+        if (items.Length == 0)
+        {
+            Debug.LogWarning("No Item ScriptableObjects found! Run 'RPG > Create Sample Items' to create some.");
+        }
+        else
+        {
+            Debug.Log("Available items:");
+            foreach (Item item in items)
+            {
+                Debug.Log($"  - {item.itemName} ({item.itemType})");
+            }
+        }
+
+        // Check UIDocument setup
+        foreach (ItemShopManager manager in shopManagers)
+        {
+            UIDocument uiDoc = manager.GetComponent<UIDocument>();
+            if (uiDoc == null)
+            {
+                Debug.LogWarning($"ItemShopManager on '{manager.gameObject.name}' is missing UIDocument component!");
+            }
+            else if (uiDoc.visualTreeAsset == null)
+            {
+                Debug.LogWarning($"UIDocument on '{manager.gameObject.name}' is missing Visual Tree Asset (ShopUI.uxml)!");
+            }
+            else
+            {
+                Debug.Log($"✓ ItemShopManager on '{manager.gameObject.name}' appears to be properly configured");
+            }
+        }
+
+        Debug.Log("=== Verification Complete ===");
+    }
+}

+ 46 - 27
Assets/Scripts/MainTeamSelect/MainTeamSelectScript.cs

@@ -41,7 +41,7 @@ public class MainTeamSelectScript : MonoBehaviour
     private VisualElement miscList;
 
     // Shop reference
-    private SimpleShopManager shopManager;
+    private ItemShopManager shopManager;
 
     // Navigation buttons
     private Button backToTitleButton;
@@ -207,10 +207,10 @@ public class MainTeamSelectScript : MonoBehaviour
         }
 
         // Find shop manager in scene
-        shopManager = FindFirstObjectByType<SimpleShopManager>();
+        shopManager = FindFirstObjectByType<ItemShopManager>();
         if (shopManager == null)
         {
-            Debug.LogWarning("No SimpleShopManager found in scene. Shop functionality will be limited.");
+            Debug.LogWarning("No ItemShopManager found in scene. Shop functionality will be limited.");
             Debug.LogWarning("Trying to refresh shop manager reference...");
 
             // Try again after a short delay to allow for potential late initialization
@@ -620,24 +620,24 @@ public class MainTeamSelectScript : MonoBehaviour
     {
         if (shopManager == null) return "";
 
-        System.Collections.Generic.List<SimpleShopItem> itemList = null;
+        List<Item> itemList = null;
 
         switch (itemType.ToLower())
         {
             case "weapon":
-                itemList = shopManager.weapons;
+                itemList = shopManager.GetWeapons();
                 break;
             case "armor":
-                itemList = shopManager.armor;
+                itemList = shopManager.GetArmor();
                 break;
             case "misc":
-                itemList = shopManager.miscItems;
+                itemList = shopManager.GetMiscItems();
                 break;
         }
 
         if (itemList != null)
         {
-            var shopItem = itemList.Find(item => item.name == itemName);
+            var shopItem = itemList.Find(item => item.itemName == itemName);
             if (shopItem != null)
             {
                 return shopItem.GetCostString();
@@ -661,25 +661,25 @@ public class MainTeamSelectScript : MonoBehaviour
         int copperRefund = 0;
 
         // Check the appropriate list based on item type
-        System.Collections.Generic.List<SimpleShopItem> itemList = null;
+        List<Item> itemList = null;
 
         switch (itemType.ToLower())
         {
             case "weapon":
-                itemList = shopManager.weapons;
+                itemList = shopManager.GetWeapons();
                 break;
             case "armor":
-                itemList = shopManager.armor;
+                itemList = shopManager.GetArmor();
                 break;
             case "misc":
-                itemList = shopManager.miscItems;
+                itemList = shopManager.GetMiscItems();
                 break;
         }
 
         if (itemList != null)
         {
             // Find the item in the shop list
-            var shopItem = itemList.Find(item => item.name == itemName);
+            var shopItem = itemList.Find(item => item.itemName == itemName);
             if (shopItem != null)
             {
                 goldRefund = shopItem.goldCost;
@@ -1655,7 +1655,7 @@ public class MainTeamSelectScript : MonoBehaviour
         yield return new WaitForSeconds(0.1f);
 
         // Try to find the shop manager again
-        var newShopManager = FindFirstObjectByType<SimpleShopManager>();
+        var newShopManager = FindFirstObjectByType<ItemShopManager>();
         if (newShopManager != null)
         {
             shopManager = newShopManager;
@@ -1664,7 +1664,7 @@ public class MainTeamSelectScript : MonoBehaviour
         }
         else
         {
-            Debug.LogWarning("Still no SimpleShopManager found after delay. You may need to create one manually using the ShopSystemSetup component.");
+            Debug.LogWarning("Still no ItemShopManager found after delay. You may need to create one manually using the ShopSystemSetup component.");
         }
     }
 
@@ -2022,27 +2022,46 @@ public class TeamCharacter
         acModifier = 0;
 
         // Get reference to the shop manager to access item definitions
-        var shopManager = UnityEngine.Object.FindFirstObjectByType<SimpleShopManager>();
+        var shopManager = UnityEngine.Object.FindFirstObjectByType<ItemShopManager>();
         if (shopManager == null) return;
 
         // Apply bonuses from all items in inventory
-        ApplyBonusesFromItemList(shopManager.weapons, weapons);
-        ApplyBonusesFromItemList(shopManager.armor, armor);
-        ApplyBonusesFromItemList(shopManager.miscItems, miscItems);
+        ApplyBonusesFromItemList(shopManager.GetWeapons(), weapons);
+        ApplyBonusesFromItemList(shopManager.GetArmor(), armor);
+        ApplyBonusesFromItemList(shopManager.GetMiscItems(), miscItems);
     }
 
-    private void ApplyBonusesFromItemList(System.Collections.Generic.List<SimpleShopItem> shopItems, System.Collections.Generic.List<string> ownedItems)
+    private void ApplyBonusesFromItemList(System.Collections.Generic.List<Item> shopItems, System.Collections.Generic.List<string> ownedItems)
     {
         foreach (string itemName in ownedItems)
         {
-            var shopItem = shopItems.Find(item => item.name == itemName);
-            if (shopItem != null && shopItem.stats != null)
+            var shopItem = shopItems.Find(item => item.itemName == itemName);
+            if (shopItem != null)
             {
-                strengthModifier += shopItem.stats.strengthBonus;
-                dexterityModifier += shopItem.stats.dexterityBonus;
-                constitutionModifier += shopItem.stats.constitutionBonus;
-                wisdomModifier += shopItem.stats.wisdomBonus;
-                acModifier += shopItem.stats.acBonus;
+                // Apply bonuses based on item type
+                if (shopItem is WeaponItem weapon)
+                {
+                    // Weapons might provide damage bonuses, but character stats are typically different
+                    // For now, we'll focus on armor and misc items for stat bonuses
+                }
+                else if (shopItem is ArmorItem armor)
+                {
+                    strengthModifier += armor.strengthModifier;
+                    dexterityModifier += armor.dexterityModifier;
+                    constitutionModifier += armor.constitutionModifier;
+                    wisdomModifier += armor.wisdomModifier;
+                    acModifier += armor.armorClass;
+                }
+                else if (shopItem is MiscellaneousItem misc)
+                {
+                    // Miscellaneous items might provide stat bonuses if they're permanent equipment
+                    // For consumables, bonuses would typically be applied when used, not while owned
+                    if (!misc.isConsumable)
+                    {
+                        // Add any permanent stat bonuses from misc items here
+                        // This would need to be extended based on your specific misc item properties
+                    }
+                }
             }
         }
     }

+ 699 - 0
Assets/Scripts/UI/ItemShopManager.cs

@@ -0,0 +1,699 @@
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UIElements;
+using System.Linq;
+
+public class ItemShopManager : MonoBehaviour
+{
+    [Header("Shop Settings")]
+    public string shopName = "General Store";
+
+    [Header("Shop Items (ScriptableObjects)")]
+    [SerializeField] private List<Item> availableItems = new List<Item>();
+
+    private UIDocument uiDocument;
+    private TeamCharacter currentCustomer;
+
+    // Callback for when character data changes
+    public System.Action<TeamCharacter> OnCharacterDataChanged;
+
+    // UI Elements
+    private VisualElement shopContainer;
+    private TextField searchField;
+    private DropdownField categoryFilter;
+    private ScrollView itemList;
+    private Label shopTitle;
+    private Label playerMoney;
+    private Button closeButton;
+
+    // Current filter state
+    private string currentCategory = "All";
+    private string currentSearchTerm = "";
+
+    void Awake()
+    {
+        // Load all Item ScriptableObjects from Resources
+        LoadAllItems();
+    }
+
+    void Start()
+    {
+        // Initialize UI in Start() to ensure UIDocument is ready
+        uiDocument = GetComponent<UIDocument>();
+        if (uiDocument == null)
+        {
+            Debug.LogError("ItemShopManager requires a UIDocument component");
+            return;
+        }
+
+        if (uiDocument.visualTreeAsset == null)
+        {
+            Debug.LogError("ItemShopManager: UIDocument needs a Visual Tree Asset assigned! Please assign ShopUI.uxml");
+            return;
+        }
+
+        InitializeUI();
+    }
+
+    void LoadAllItems()
+    {
+        availableItems.Clear();
+
+        // Load all Item ScriptableObjects from Resources/Items folder and subfolders
+        Item[] allItems = Resources.LoadAll<Item>("Items");
+
+        if (allItems.Length == 0)
+        {
+            Debug.LogWarning("No Item ScriptableObjects found in Resources/Items folder. Creating some default items...");
+            CreateDefaultItems();
+        }
+        else
+        {
+            availableItems.AddRange(allItems);
+            Debug.Log($"Loaded {allItems.Length} items from Resources/Items folder");
+        }
+
+        // Also check for items in the direct Resources folder
+        Item[] directItems = Resources.LoadAll<Item>("");
+        foreach (Item item in directItems)
+        {
+            if (!availableItems.Contains(item))
+            {
+                availableItems.Add(item);
+            }
+        }
+
+        Debug.Log($"Total items available in shop: {availableItems.Count}");
+        foreach (Item item in availableItems)
+        {
+            Debug.Log($"- {item.itemName} ({item.itemType})");
+        }
+    }
+
+    void CreateDefaultItems()
+    {
+        // Create some default items if none are found
+        // These will be temporary runtime items, but you should create proper ScriptableObject assets
+
+        // Note: This creates runtime instances, not asset files
+        var simpleSword = ScriptableObject.CreateInstance<WeaponItem>();
+        simpleSword.itemName = "Simple Sword";
+        simpleSword.description = "A basic sword for beginners.";
+        simpleSword.itemType = ItemType.Weapon;
+        simpleSword.goldCost = 10;
+        simpleSword.minDamage = 1;
+        simpleSword.maxDamage = 6;
+        simpleSword.weaponType = WeaponType.Sword;
+        simpleSword.searchTags = new string[] { "sword", "melee", "blade", "basic" };
+        availableItems.Add(simpleSword);
+
+        var simpleBow = ScriptableObject.CreateInstance<WeaponItem>();
+        simpleBow.itemName = "Simple Bow";
+        simpleBow.description = "A basic bow for shooting arrows.";
+        simpleBow.itemType = ItemType.Weapon;
+        simpleBow.goldCost = 15;
+        simpleBow.minDamage = 1;
+        simpleBow.maxDamage = 4;
+        simpleBow.range = 150;
+        simpleBow.weaponType = WeaponType.Bow;
+        simpleBow.searchTags = new string[] { "bow", "ranged", "arrow", "basic" };
+        availableItems.Add(simpleBow);
+
+        var leatherArmor = ScriptableObject.CreateInstance<ArmorItem>();
+        leatherArmor.itemName = "Leather Armor";
+        leatherArmor.description = "Basic leather protection.";
+        leatherArmor.itemType = ItemType.Armor;
+        leatherArmor.goldCost = 12;
+        leatherArmor.armorClass = 1;
+        leatherArmor.armorType = ArmorType.Light;
+        leatherArmor.armorSlot = ArmorSlot.Chest;
+        leatherArmor.searchTags = new string[] { "leather", "armor", "chest", "light" };
+        availableItems.Add(leatherArmor);
+
+        var healthPotion = ScriptableObject.CreateInstance<MiscellaneousItem>();
+        healthPotion.itemName = "Health Potion";
+        healthPotion.description = "Restores health when consumed.";
+        healthPotion.itemType = ItemType.Consumable;
+        healthPotion.goldCost = 3;
+        healthPotion.isConsumable = true;
+        healthPotion.healthDiceCount = 1;
+        healthPotion.healthDiceType = 6;
+        healthPotion.healthBonus = 1;
+        healthPotion.searchTags = new string[] { "potion", "health", "healing", "consumable" };
+        availableItems.Add(healthPotion);
+
+        Debug.Log("Created default runtime items since no ScriptableObject assets were found.");
+    }
+
+    void InitializeUI()
+    {
+        var root = uiDocument.rootVisualElement;
+        Debug.Log("ItemShopManager: Initializing UI elements...");
+
+        shopContainer = root.Q<VisualElement>("ShopContainer");
+        searchField = root.Q<TextField>("SearchField");
+        categoryFilter = root.Q<DropdownField>("CategoryFilter");
+        itemList = root.Q<ScrollView>("ItemList");
+        shopTitle = root.Q<Label>("ShopTitle");
+        playerMoney = root.Q<Label>("PlayerMoney");
+        closeButton = root.Q<Button>("CloseButton");
+
+        // Debug which elements were found
+        Debug.Log($"ShopContainer found: {shopContainer != null}");
+        Debug.Log($"SearchField found: {searchField != null}");
+        Debug.Log($"CategoryFilter found: {categoryFilter != null}");
+        Debug.Log($"ItemList found: {itemList != null}");
+        Debug.Log($"ShopTitle found: {shopTitle != null}");
+        Debug.Log($"PlayerMoney found: {playerMoney != null}");
+        Debug.Log($"CloseButton found: {closeButton != null}");
+
+        // Setup category filter
+        if (categoryFilter != null)
+        {
+            categoryFilter.choices = new List<string> { "All", "Weapons", "Armor", "Consumables", "Tools", "Accessories", "Miscellaneous" };
+            categoryFilter.value = "All";
+            categoryFilter.RegisterValueChangedCallback(OnCategoryChanged);
+        }
+
+        // Setup search field
+        if (searchField != null)
+        {
+            searchField.RegisterValueChangedCallback(OnSearchChanged);
+        }
+
+        // Setup close button
+        if (closeButton != null)
+        {
+            closeButton.clicked += CloseShop;
+        }
+
+        // Hide shop initially
+        if (shopContainer != null)
+        {
+            shopContainer.style.display = DisplayStyle.None;
+            Debug.Log("ItemShopManager: Shop initially hidden");
+        }
+    }
+
+    public void OpenShop(TeamCharacter customer)
+    {
+        if (customer == null)
+        {
+            Debug.LogError("Cannot open shop: customer is null");
+            return;
+        }
+
+        Debug.Log($"ItemShopManager: Opening shop for {customer.name}");
+
+        // Ensure UIDocument is initialized
+        if (uiDocument == null)
+        {
+            uiDocument = GetComponent<UIDocument>();
+        }
+
+        if (uiDocument == null)
+        {
+            Debug.LogError("ItemShopManager: UIDocument component not found! Please add a UIDocument component to this GameObject.");
+            Debug.LogError($"GameObject name: {gameObject.name}");
+            return;
+        }
+
+        if (uiDocument.visualTreeAsset == null)
+        {
+            Debug.LogError("ItemShopManager: UIDocument needs a Visual Tree Asset assigned! Please assign ShopUI.uxml");
+            return;
+        }
+
+        // Ensure UI is initialized
+        if (shopContainer == null)
+        {
+            Debug.Log("ItemShopManager: UI not initialized, initializing now...");
+            InitializeUI();
+        }
+
+        if (shopContainer == null)
+        {
+            Debug.LogError("ItemShopManager: shopContainer is null! Make sure ShopUI.uxml is assigned to the UIDocument and contains a 'ShopContainer' element.");
+            return;
+        }
+
+        currentCustomer = customer;
+
+        // Update UI
+        if (shopTitle != null)
+        {
+            shopTitle.text = shopName;
+        }
+
+        UpdatePlayerMoney();
+        RefreshItemList();
+
+        // Show shop
+        if (shopContainer != null)
+        {
+            shopContainer.style.display = DisplayStyle.Flex;
+            Debug.Log("ItemShopManager: Shop container visibility set to Flex");
+
+            // Additional debugging
+            Debug.Log($"Shop container style.display: {shopContainer.style.display}");
+            Debug.Log($"Shop container resolvedStyle.display: {shopContainer.resolvedStyle.display}");
+            Debug.Log($"Shop container visible: {shopContainer.visible}");
+            Debug.Log($"Shop container position: {shopContainer.style.position}");
+            Debug.Log($"Shop container width: {shopContainer.resolvedStyle.width}");
+            Debug.Log($"Shop container height: {shopContainer.resolvedStyle.height}");
+        }
+
+        Debug.Log($"Opened {shopName} for {customer.name}");
+    }
+
+    public void CloseShop()
+    {
+        if (shopContainer != null)
+        {
+            shopContainer.style.display = DisplayStyle.None;
+        }
+
+        currentCustomer = null;
+        Debug.Log("Closed shop");
+    }
+
+    private void OnCategoryChanged(ChangeEvent<string> evt)
+    {
+        currentCategory = evt.newValue;
+        RefreshItemList();
+    }
+
+    private void OnSearchChanged(ChangeEvent<string> evt)
+    {
+        currentSearchTerm = evt.newValue;
+        RefreshItemList();
+    }
+
+    private void RefreshItemList()
+    {
+        if (itemList == null) return;
+
+        itemList.Clear();
+
+        var filteredItems = GetFilteredItems();
+
+        foreach (var item in filteredItems)
+        {
+            var itemElement = CreateItemElement(item);
+            itemList.Add(itemElement);
+        }
+    }
+
+    private List<Item> GetFilteredItems()
+    {
+        var filteredItems = new List<Item>(availableItems);
+
+        // Apply category filter
+        if (currentCategory != "All")
+        {
+            ItemType filterType;
+            switch (currentCategory)
+            {
+                case "Weapons":
+                    filterType = ItemType.Weapon;
+                    break;
+                case "Armor":
+                    filterType = ItemType.Armor;
+                    break;
+                case "Consumables":
+                    filterType = ItemType.Consumable;
+                    break;
+                case "Tools":
+                    filterType = ItemType.Tool;
+                    break;
+                case "Accessories":
+                    filterType = ItemType.Accessory;
+                    break;
+                case "Miscellaneous":
+                    filterType = ItemType.Miscellaneous;
+                    break;
+                default:
+                    filterType = ItemType.Miscellaneous;
+                    break;
+            }
+
+            filteredItems = filteredItems.Where(item => item.itemType == filterType).ToList();
+        }
+
+        // Apply search filter
+        if (!string.IsNullOrEmpty(currentSearchTerm))
+        {
+            filteredItems = filteredItems.Where(item => item.MatchesSearch(currentSearchTerm)).ToList();
+        }
+
+        return filteredItems;
+    }
+
+    private VisualElement CreateItemElement(Item item)
+    {
+        var itemContainer = new VisualElement();
+        itemContainer.AddToClassList("shop-item");
+
+        // Item header with name and cost
+        var header = new VisualElement();
+        header.AddToClassList("item-header");
+        header.style.flexDirection = FlexDirection.Row;
+        header.style.justifyContent = Justify.SpaceBetween;
+
+        var nameLabel = new Label(item.itemName);
+        nameLabel.AddToClassList("item-name");
+        header.Add(nameLabel);
+
+        var costLabel = new Label(item.GetCostString());
+        costLabel.AddToClassList("item-cost");
+        header.Add(costLabel);
+
+        itemContainer.Add(header);
+
+        // Item description
+        var descriptionLabel = new Label(item.description);
+        descriptionLabel.AddToClassList("item-description");
+        descriptionLabel.style.whiteSpace = WhiteSpace.Normal;
+        itemContainer.Add(descriptionLabel);
+
+        // Item stats (if applicable)
+        string statsString = GetItemStatsString(item);
+        if (!string.IsNullOrEmpty(statsString))
+        {
+            var statsLabel = new Label(statsString);
+            statsLabel.AddToClassList("item-stats");
+            itemContainer.Add(statsLabel);
+        }
+
+        // Purchase button
+        var purchaseButton = new Button(() => PurchaseItem(item));
+        purchaseButton.text = "Buy";
+        purchaseButton.AddToClassList("purchase-button");
+
+        // Check if player can afford the item
+        bool canAfford = currentCustomer != null && CanCustomerAfford(item);
+        purchaseButton.SetEnabled(canAfford);
+
+        if (!canAfford)
+        {
+            purchaseButton.AddToClassList("purchase-button-disabled");
+        }
+
+        itemContainer.Add(purchaseButton);
+
+        return itemContainer;
+    }
+
+    private string GetItemStatsString(Item item)
+    {
+        var statStrings = new List<string>();
+
+        if (item is WeaponItem weapon)
+        {
+            statStrings.Add($"Damage: {weapon.minDamage}-{weapon.maxDamage}");
+            if (weapon.range > 0)
+                statStrings.Add($"Range: {weapon.range}");
+            if (weapon.weaponModifier != 0)
+                statStrings.Add($"Weapon Mod: {weapon.weaponModifier:+0;-0}");
+        }
+        else if (item is ArmorItem armor)
+        {
+            if (armor.armorClass > 0)
+                statStrings.Add($"AC: +{armor.armorClass}");
+            if (armor.strengthModifier != 0)
+                statStrings.Add($"STR: {armor.strengthModifier:+0;-0}");
+            if (armor.dexterityModifier != 0)
+                statStrings.Add($"DEX: {armor.dexterityModifier:+0;-0}");
+            if (armor.constitutionModifier != 0)
+                statStrings.Add($"CON: {armor.constitutionModifier:+0;-0}");
+            if (armor.wisdomModifier != 0)
+                statStrings.Add($"WIS: {armor.wisdomModifier:+0;-0}");
+        }
+        else if (item is MiscellaneousItem misc && misc.isConsumable)
+        {
+            if (misc.healthDiceCount > 0)
+            {
+                string healthEffect = $"Heals {misc.healthDiceCount}d{misc.healthDiceType}";
+                if (misc.healthBonus != 0)
+                    healthEffect += $"{misc.healthBonus:+0;-0}";
+                statStrings.Add(healthEffect);
+            }
+            else if (misc.healthRestoreMin > 0 || misc.healthRestoreMax > 0)
+            {
+                statStrings.Add($"Heals {misc.healthRestoreMin}-{misc.healthRestoreMax}");
+            }
+
+            if (misc.manaDiceCount > 0)
+            {
+                string manaEffect = $"Restores {misc.manaDiceCount}d{misc.manaDiceType}";
+                if (misc.manaBonus != 0)
+                    manaEffect += $"{misc.manaBonus:+0;-0}";
+                statStrings.Add($"{manaEffect} mana");
+            }
+            else if (misc.manaRestoreMin > 0 || misc.manaRestoreMax > 0)
+            {
+                statStrings.Add($"Restores {misc.manaRestoreMin}-{misc.manaRestoreMax} mana");
+            }
+        }
+
+        return statStrings.Count > 0 ? string.Join(", ", statStrings) : "";
+    }
+
+    private void PurchaseItem(Item item)
+    {
+        if (currentCustomer == null)
+        {
+            Debug.LogError("No customer set!");
+            return;
+        }
+
+        // Check if customer can afford the item directly
+        if (!CanCustomerAfford(item))
+        {
+            Debug.LogWarning($"Cannot afford {item.itemName}");
+            return;
+        }
+
+        // Calculate and deduct the cost
+        DeductItemCost(item);
+
+        // Add item to customer's inventory (you'll need to implement this based on your inventory system)
+        AddItemToCustomerInventory(item);
+
+        // Refresh UI
+        UpdatePlayerMoney();
+        RefreshItemList();
+
+        // Notify listeners that character data changed
+        OnCharacterDataChanged?.Invoke(currentCustomer);
+
+        Debug.Log($"Successfully purchased {item.itemName}");
+    }
+
+    private bool CanCustomerAfford(Item item)
+    {
+        if (currentCustomer == null) return false;
+
+        int totalCopperCost = item.goldCost * 100 + item.silverCost * 10 + item.copperCost;
+        int totalCopperAvailable = currentCustomer.gold * 100 + currentCustomer.silver * 10 + currentCustomer.copper;
+        return totalCopperAvailable >= totalCopperCost;
+    }
+
+    private void DeductItemCost(Item item)
+    {
+        // Convert everything to copper for easier calculation
+        int totalCopperCost = item.goldCost * 100 + item.silverCost * 10 + item.copperCost;
+        int totalCopperAvailable = currentCustomer.gold * 100 + currentCustomer.silver * 10 + currentCustomer.copper;
+
+        int remainingCopper = totalCopperAvailable - totalCopperCost;
+
+        // Convert back to gold, silver, copper
+        currentCustomer.gold = remainingCopper / 100;
+        remainingCopper %= 100;
+        currentCustomer.silver = remainingCopper / 10;
+        currentCustomer.copper = remainingCopper % 10;
+
+        Debug.Log($"Purchased {item.itemName} for {item.goldCost}g {item.silverCost}s {item.copperCost}c");
+    }
+
+    private void AddItemToCustomerInventory(Item item)
+    {
+        // This method needs to be implemented based on your inventory system
+        // For now, let's just log what would happen
+        Debug.Log($"Would add {item.itemName} to {currentCustomer.name}'s inventory");
+
+        // If you have an inventory system, add the item here
+        // For example:
+        // currentCustomer.inventory.AddItem(item);
+    }
+
+    private void UpdatePlayerMoney()
+    {
+        if (playerMoney != null && currentCustomer != null)
+        {
+            playerMoney.text = $"{currentCustomer.gold}g {currentCustomer.silver}s {currentCustomer.copper}c";
+        }
+    }
+
+    [ContextMenu("Reload Items")]
+    public void ReloadItems()
+    {
+        LoadAllItems();
+        if (shopContainer != null && shopContainer.style.display == DisplayStyle.Flex)
+        {
+            RefreshItemList();
+        }
+    }
+
+    // Public methods to get items by category (for compatibility with old system)
+    public List<Item> GetWeapons()
+    {
+        return availableItems.Where(item => item.itemType == ItemType.Weapon).ToList();
+    }
+
+    public List<Item> GetArmor()
+    {
+        return availableItems.Where(item => item.itemType == ItemType.Armor).ToList();
+    }
+
+    public List<Item> GetMiscItems()
+    {
+        return availableItems.Where(item =>
+            item.itemType == ItemType.Miscellaneous ||
+            item.itemType == ItemType.Consumable ||
+            item.itemType == ItemType.Tool ||
+            item.itemType == ItemType.Accessory).ToList();
+    }
+
+    public List<Item> GetAllItems()
+    {
+        return new List<Item>(availableItems);
+    }
+
+    [ContextMenu("Check Shop Setup")]
+    public void CheckShopSetup()
+    {
+        Debug.Log("=== ItemShopManager Setup Check ===");
+
+        // Check UIDocument
+        var uiDoc = GetComponent<UIDocument>();
+        if (uiDoc == null)
+        {
+            Debug.LogError("❌ No UIDocument component found on this GameObject!");
+            Debug.LogError("➤ Add a UIDocument component to fix this.");
+            return;
+        }
+        else
+        {
+            Debug.Log("✓ UIDocument component found");
+        }
+
+        // Check Visual Tree Asset
+        if (uiDoc.visualTreeAsset == null)
+        {
+            Debug.LogError("❌ UIDocument has no Visual Tree Asset assigned!");
+            Debug.LogError("➤ Assign ShopUI.uxml to the UIDocument component.");
+            return;
+        }
+        else
+        {
+            Debug.Log($"✓ Visual Tree Asset assigned: {uiDoc.visualTreeAsset.name}");
+        }
+
+        // Check UI elements
+        var root = uiDoc.rootVisualElement;
+        var container = root?.Q<VisualElement>("ShopContainer");
+        if (container == null)
+        {
+            Debug.LogError("❌ ShopContainer element not found in the UXML!");
+            Debug.LogError("➤ Make sure you're using the correct ShopUI.uxml file.");
+            return;
+        }
+        else
+        {
+            Debug.Log("✓ ShopContainer element found in UXML");
+        }
+
+        // Check items
+        Debug.Log($"✓ {availableItems.Count} items loaded for shop");
+
+        Debug.Log("=== Setup Check Complete - Shop should work! ===");
+    }
+
+    [ContextMenu("Force Initialize UI")]
+    public void ForceInitializeUI()
+    {
+        uiDocument = GetComponent<UIDocument>();
+        if (uiDocument != null && uiDocument.visualTreeAsset != null)
+        {
+            InitializeUI();
+            Debug.Log("UI forcefully initialized");
+        }
+        else
+        {
+            Debug.LogError("Cannot initialize UI - missing UIDocument or Visual Tree Asset");
+        }
+    }
+
+    [ContextMenu("Debug UI State")]
+    public void DebugUIState()
+    {
+        Debug.Log("=== UI State Debug ===");
+
+        if (uiDocument == null)
+        {
+            Debug.LogError("uiDocument is null");
+            return;
+        }
+
+        Debug.Log($"UIDocument sorting order: {uiDocument.sortingOrder}");
+        if (uiDocument.panelSettings != null)
+        {
+            Debug.Log($"Panel settings sorting order: {uiDocument.panelSettings.sortingOrder}");
+        }
+        else
+        {
+            Debug.LogWarning("Panel settings is null");
+        }
+
+        var root = uiDocument.rootVisualElement;
+        Debug.Log($"Root element child count: {root.childCount}");
+
+        if (shopContainer != null)
+        {
+            Debug.Log($"Shop container display: {shopContainer.style.display}");
+            Debug.Log($"Shop container resolved display: {shopContainer.resolvedStyle.display}");
+            Debug.Log($"Shop container visible: {shopContainer.visible}");
+            Debug.Log($"Shop container opacity: {shopContainer.resolvedStyle.opacity}");
+            Debug.Log($"Shop container position: {shopContainer.style.position}");
+            Debug.Log($"Shop container worldBound: {shopContainer.worldBound}");
+        }
+        else
+        {
+            Debug.LogError("shopContainer is null");
+        }
+
+        // Check for other UIDocuments that might be covering this one
+        var allUIDocuments = FindObjectsByType<UIDocument>(FindObjectsSortMode.None);
+        Debug.Log($"Found {allUIDocuments.Length} UIDocuments in scene:");
+        foreach (var doc in allUIDocuments)
+        {
+            var panelSort = doc.panelSettings?.sortingOrder ?? -999;
+            Debug.Log($"  - '{doc.gameObject.name}' sortingOrder: {doc.sortingOrder}, panelSettings: {panelSort}");
+        }
+    }
+
+    [ContextMenu("Force Open Shop (Test)")]
+    public void ForceOpenShopTest()
+    {
+        // Create a test character for debugging
+        var testCharacter = new TeamCharacter();
+        testCharacter.name = "Test Character";
+        testCharacter.gold = 100;
+        testCharacter.silver = 50;
+        testCharacter.copper = 25;
+
+        Debug.Log("Opening shop with test character...");
+        OpenShop(testCharacter);
+    }
+}

+ 249 - 0
Assets/Scripts/UI/QuickShopSetup.cs

@@ -0,0 +1,249 @@
+using UnityEngine;
+using UnityEngine.UIElements;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+/// <summary>
+/// Quick setup component to add to any GameObject in the scene to automatically configure the shop
+/// Just add this component to any GameObject and it will set everything up for you
+/// </summary>
+public class QuickShopSetup : MonoBehaviour
+{
+    [Header("Quick Setup")]
+    [Tooltip("Click this in play mode to automatically setup the shop")]
+    public bool autoSetupOnStart = true;
+
+    [Header("Setup Results")]
+    [SerializeField] private bool shopSetupComplete = false;
+    [SerializeField] private string statusMessage = "Not setup yet";
+
+    void Start()
+    {
+        if (autoSetupOnStart)
+        {
+            SetupShop();
+        }
+    }
+
+    [ContextMenu("Setup Shop Now")]
+    public void SetupShop()
+    {
+        Debug.Log("=== Quick Shop Setup Starting ===");
+
+        // Check if ItemShopManager already exists
+        ItemShopManager existingShop = FindFirstObjectByType<ItemShopManager>();
+        if (existingShop != null)
+        {
+            // Check if the UIDocument has the UXML assigned
+            UIDocument uiDoc = existingShop.GetComponent<UIDocument>();
+            if (uiDoc != null && uiDoc.visualTreeAsset == null)
+            {
+                Debug.Log("Found ItemShopManager but UIDocument needs UXML assignment...");
+                AssignShopUIXML(uiDoc);
+                statusMessage = "Fixed UXML assignment for existing shop";
+                shopSetupComplete = true;
+                return;
+            }
+            else if (uiDoc != null && uiDoc.visualTreeAsset != null)
+            {
+                statusMessage = "Shop already exists and is configured";
+                shopSetupComplete = true;
+                Debug.Log("✓ ItemShopManager already exists and is properly configured on: " + existingShop.gameObject.name);
+                return;
+            }
+        }
+
+        // Check for old SimpleShopManager
+        SimpleShopManager oldShop = FindFirstObjectByType<SimpleShopManager>();
+        if (oldShop != null)
+        {
+            Debug.Log("Found old SimpleShopManager, converting to ItemShopManager...");
+            ConvertOldShop(oldShop);
+            statusMessage = "Converted old shop to new system";
+            shopSetupComplete = true;
+            return;
+        }
+
+        // No shop exists, create new one
+        Debug.Log("No shop found, creating new ItemShopManager...");
+        CreateNewShop();
+        statusMessage = "Created new shop system";
+        shopSetupComplete = true;
+    }
+
+    void ConvertOldShop(SimpleShopManager oldShop)
+    {
+        GameObject shopObject = oldShop.gameObject;
+        string shopName = oldShop.shopName;
+
+        // Remove old component
+        DestroyImmediate(oldShop);
+
+        // Add new component
+        ItemShopManager newShop = shopObject.AddComponent<ItemShopManager>();
+        newShop.shopName = shopName;
+
+        Debug.Log("✓ Converted SimpleShopManager to ItemShopManager on: " + shopObject.name);
+    }
+
+    void CreateNewShop()
+    {
+        // Create shop GameObject
+        GameObject shopObject = new GameObject("ShopManager");
+
+        // Add UIDocument
+        UIDocument uiDoc = shopObject.AddComponent<UIDocument>();
+
+        // Assign ShopUI.uxml
+        AssignShopUIXML(uiDoc);
+
+        // Add ItemShopManager
+        ItemShopManager shopManager = shopObject.AddComponent<ItemShopManager>();
+        shopManager.shopName = "General Store";
+
+        Debug.Log("✓ Created new shop system on: " + shopObject.name);
+    }
+
+    void AssignShopUIXML(UIDocument uiDoc)
+    {
+        // Try multiple paths to find ShopUI.uxml
+        string[] possiblePaths = {
+            "UI/TeamSelectOverview/ShopUI",
+            "TeamSelectOverview/ShopUI",
+            "UI/ShopUI",
+            "ShopUI"
+        };
+
+        VisualTreeAsset shopUI = null;
+        string foundPath = "";
+
+        foreach (string path in possiblePaths)
+        {
+            shopUI = Resources.Load<VisualTreeAsset>(path);
+            if (shopUI != null)
+            {
+                foundPath = path;
+                break;
+            }
+        }
+
+        // If not found in Resources, try to load directly from Assets
+        if (shopUI == null)
+        {
+#if UNITY_EDITOR
+            string[] guids = UnityEditor.AssetDatabase.FindAssets("ShopUI t:VisualTreeAsset");
+            if (guids.Length > 0)
+            {
+                string assetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(guids[0]);
+                shopUI = UnityEditor.AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(assetPath);
+                foundPath = assetPath;
+                Debug.Log($"Found ShopUI.uxml at: {assetPath}");
+            }
+#endif
+        }
+
+        if (shopUI != null)
+        {
+            uiDoc.visualTreeAsset = shopUI;
+            Debug.Log($"✓ Assigned ShopUI.uxml from {foundPath} to UIDocument");
+        }
+        else
+        {
+            Debug.LogError("❌ Could not find ShopUI.uxml! Please assign it manually in the UIDocument component.");
+        }
+    }
+
+    [ContextMenu("Create Sample Items")]
+    public void CreateSampleItems()
+    {
+        Debug.Log("=== Creating Sample Items ===");
+
+        // Check if sample items already exist
+        Item[] existingItems = Resources.LoadAll<Item>("Items");
+        if (existingItems.Length > 0)
+        {
+            Debug.Log($"Found {existingItems.Length} existing items - no need to create samples");
+            return;
+        }
+
+        // Create sample items programmatically
+        CreateRuntimeItems();
+        Debug.Log("✓ Created sample items");
+    }
+
+    void CreateRuntimeItems()
+    {
+        // Note: These are runtime items, not asset files
+        // For permanent items, use the editor script: RPG > Create Sample Items
+
+        var sword = ScriptableObject.CreateInstance<WeaponItem>();
+        sword.itemName = "Iron Sword";
+        sword.description = "A sturdy iron sword";
+        sword.goldCost = 15;
+        sword.minDamage = 2;
+        sword.maxDamage = 8;
+        sword.weaponType = WeaponType.Sword;
+
+        var bow = ScriptableObject.CreateInstance<WeaponItem>();
+        bow.itemName = "Hunting Bow";
+        bow.description = "A reliable hunting bow";
+        bow.goldCost = 12;
+        bow.minDamage = 1;
+        bow.maxDamage = 6;
+        bow.range = 150;
+        bow.weaponType = WeaponType.Bow;
+
+        var armor = ScriptableObject.CreateInstance<ArmorItem>();
+        armor.itemName = "Leather Armor";
+        armor.description = "Basic leather protection";
+        armor.goldCost = 10;
+        armor.armorClass = 1;
+        armor.armorType = ArmorType.Light;
+        armor.armorSlot = ArmorSlot.Chest;
+
+        var potion = ScriptableObject.CreateInstance<MiscellaneousItem>();
+        potion.itemName = "Health Potion";
+        potion.description = "Restores health";
+        potion.goldCost = 5;
+        potion.isConsumable = true;
+        potion.healthDiceCount = 1;
+        potion.healthDiceType = 6;
+        potion.healthBonus = 1;
+
+        Debug.Log("Created runtime items: Iron Sword, Hunting Bow, Leather Armor, Health Potion");
+        Debug.Log("Note: These are temporary runtime items. For permanent items, use RPG > Create Sample Items menu");
+    }
+
+    [ContextMenu("Test Shop")]
+    public void TestShop()
+    {
+        ItemShopManager shop = FindFirstObjectByType<ItemShopManager>();
+        if (shop == null)
+        {
+            Debug.LogError("No ItemShopManager found! Run Setup Shop first.");
+            return;
+        }
+
+        // Try to find a character to test with
+        var teamSelectScript = FindFirstObjectByType<MainTeamSelectScript>();
+        if (teamSelectScript != null)
+        {
+            Debug.Log("✓ Found MainTeamSelectScript - shop should work with character selection");
+        }
+        else
+        {
+            Debug.LogWarning("⚠ No MainTeamSelectScript found - shop might not have character context");
+        }
+
+        Debug.Log("Shop test complete - try clicking on character equipment slots to open shop");
+    }
+
+    void OnValidate()
+    {
+        if (Application.isPlaying && autoSetupOnStart && !shopSetupComplete)
+        {
+            SetupShop();
+        }
+    }
+}

+ 243 - 0
Assets/Scripts/UI/ShopSystemSetup.cs

@@ -0,0 +1,243 @@
+using UnityEngine;
+using UnityEngine.UIElements;
+
+/// <summary>
+/// Helper component to ensure the shop system is properly configured
+/// Add this to any GameObject in the MainTeamSelectScene to automatically setup the shop
+/// </summary>
+public class ShopSystemSetup : MonoBehaviour
+{
+    [Header("Shop Configuration")]
+    [Tooltip("The name of the shop")]
+    public string shopName = "General Store";
+
+    [Header("Auto-Setup Options")]
+    [Tooltip("Automatically create an ItemShopManager if none exists")]
+    public bool autoCreateShopManager = true;
+
+    [Tooltip("Automatically load and verify items on start")]
+    public bool autoVerifyItems = true;
+
+    [Header("Debug Options")]
+    [Tooltip("Show debug information in console")]
+    public bool enableDebugLogging = true;
+
+    void Start()
+    {
+        if (autoCreateShopManager)
+        {
+            SetupShopManager();
+        }
+
+        if (autoVerifyItems)
+        {
+            VerifyItems();
+        }
+    }
+
+    void SetupShopManager()
+    {
+        // Check if ItemShopManager already exists
+        ItemShopManager existingManager = FindFirstObjectByType<ItemShopManager>();
+
+        if (existingManager != null)
+        {
+            if (enableDebugLogging)
+                Debug.Log($"ItemShopManager already exists on '{existingManager.gameObject.name}'");
+            return;
+        }
+
+        // Check for old SimpleShopManager and warn
+        SimpleShopManager oldManager = FindFirstObjectByType<SimpleShopManager>();
+        if (oldManager != null)
+        {
+            Debug.LogWarning($"Found SimpleShopManager on '{oldManager.gameObject.name}'. Please use the migration tool: RPG > Migrate Shop System");
+            return;
+        }
+
+        // Find a suitable GameObject to add the shop to
+        GameObject shopObject = null;
+
+        // Look for existing shop-related GameObjects
+        GameObject[] allObjects = FindObjectsByType<GameObject>(FindObjectsSortMode.None);
+        foreach (GameObject obj in allObjects)
+        {
+            if (obj.name.ToLower().Contains("shop"))
+            {
+                shopObject = obj;
+                break;
+            }
+        }
+
+        // If no shop object found, use this GameObject
+        if (shopObject == null)
+        {
+            shopObject = this.gameObject;
+        }
+
+        // Add ItemShopManager if it doesn't exist
+        ItemShopManager shopManager = shopObject.GetComponent<ItemShopManager>();
+        if (shopManager == null)
+        {
+            shopManager = shopObject.AddComponent<ItemShopManager>();
+            shopManager.shopName = shopName;
+
+            if (enableDebugLogging)
+                Debug.Log($"Created ItemShopManager on '{shopObject.name}'");
+        }
+
+        // Ensure UIDocument exists
+        UIDocument uiDocument = shopObject.GetComponent<UIDocument>();
+        if (uiDocument == null)
+        {
+            uiDocument = shopObject.AddComponent<UIDocument>();
+
+            if (enableDebugLogging)
+                Debug.Log($"Added UIDocument component to '{shopObject.name}'");
+        }
+
+        // Try to find and assign ShopUI.uxml
+        if (uiDocument.visualTreeAsset == null)
+        {
+            var shopUI = Resources.Load<VisualTreeAsset>("UI/ShopUI");
+            if (shopUI == null)
+            {
+                // Try alternative paths
+                string[] possiblePaths = {
+                    "ShopUI",
+                    "UI/ShopUI",
+                    "TeamSelectOverview/ShopUI"
+                };
+
+                foreach (string path in possiblePaths)
+                {
+                    shopUI = Resources.Load<VisualTreeAsset>(path);
+                    if (shopUI != null)
+                    {
+                        if (enableDebugLogging)
+                            Debug.Log($"Found ShopUI at path: {path}");
+                        break;
+                    }
+                }
+            }
+
+            if (shopUI != null)
+            {
+                uiDocument.visualTreeAsset = shopUI;
+                if (enableDebugLogging)
+                    Debug.Log("Assigned ShopUI.uxml to UIDocument");
+            }
+            else
+            {
+                Debug.LogWarning("Could not find ShopUI.uxml. Please assign it manually to the UIDocument component.");
+            }
+        }
+    }
+
+    void VerifyItems()
+    {
+        // Load all items from Resources
+        Item[] items = Resources.LoadAll<Item>("Items");
+
+        if (items.Length == 0)
+        {
+            if (enableDebugLogging)
+            {
+                Debug.LogWarning("No Item ScriptableObjects found in Resources/Items folder.");
+                Debug.Log("To create sample items, use: RPG > Create Sample Items");
+                Debug.Log("Or create your own items using: Create > RPG > Items");
+            }
+        }
+        else
+        {
+            if (enableDebugLogging)
+            {
+                Debug.Log($"Found {items.Length} items for the shop:");
+                foreach (Item item in items)
+                {
+                    Debug.Log($"  - {item.itemName} ({item.itemType}) - {item.GetCostString()}");
+                }
+            }
+        }
+
+        // Check for items in the direct Resources folder as well
+        Item[] directItems = Resources.LoadAll<Item>("");
+        int additionalItems = 0;
+        foreach (Item item in directItems)
+        {
+            bool alreadyCounted = false;
+            foreach (Item folderItem in items)
+            {
+                if (item == folderItem)
+                {
+                    alreadyCounted = true;
+                    break;
+                }
+            }
+
+            if (!alreadyCounted)
+            {
+                additionalItems++;
+                if (enableDebugLogging)
+                    Debug.Log($"  - {item.itemName} (found in Resources root)");
+            }
+        }
+
+        if (additionalItems > 0 && enableDebugLogging)
+        {
+            Debug.Log($"Also found {additionalItems} additional items in Resources root folder");
+        }
+    }
+
+    [ContextMenu("Force Setup Shop")]
+    public void ForceSetupShop()
+    {
+        SetupShopManager();
+    }
+
+    [ContextMenu("Verify Items")]
+    public void ForceVerifyItems()
+    {
+        VerifyItems();
+    }
+
+    [ContextMenu("Full Shop Verification")]
+    public void FullVerification()
+    {
+        Debug.Log("=== Shop System Full Verification ===");
+
+        SetupShopManager();
+        VerifyItems();
+
+        // Additional checks
+        ItemShopManager shopManager = FindFirstObjectByType<ItemShopManager>();
+        if (shopManager != null)
+        {
+            UIDocument uiDoc = shopManager.GetComponent<UIDocument>();
+            if (uiDoc != null && uiDoc.visualTreeAsset != null)
+            {
+                Debug.Log("✓ Shop system appears to be fully configured");
+            }
+            else
+            {
+                Debug.LogWarning("⚠ Shop system needs UI configuration");
+            }
+        }
+        else
+        {
+            Debug.LogError("✗ No ItemShopManager found");
+        }
+
+        Debug.Log("=== Verification Complete ===");
+    }
+
+    // Cleanup method to prevent interference
+    void OnValidate()
+    {
+        // Ensure this component doesn't interfere with the actual shop
+        if (string.IsNullOrEmpty(shopName))
+        {
+            shopName = "General Store";
+        }
+    }
+}

+ 0 - 464
Assets/Scripts/Utilities/ShopSystemSetup.cs

@@ -1,464 +0,0 @@
-using UnityEngine;
-using UnityEngine.UIElements;
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-/// <summary>
-/// This script helps set up the shop/inventory system.
-/// Attach this to a GameObject in your scene to get started with the shop system.
-/// </summary>
-public class ShopSystemSetup : MonoBehaviour
-{
-    [Header("Instructions")]
-    [TextArea(5, 10)]
-    public string instructions = @"Setup Instructions:
-1. Create a GameObject and attach SimpleShopManager script
-2. Create a UI Document with ShopUI.uxml as the Visual Tree Asset
-3. Attach the UI Document to the same GameObject as SimpleShopManager
-4. The shop will automatically populate with default items
-5. Click 'Add Weapon', 'Add Armor', or 'Add Misc' buttons in character inventory to open shop";
-
-    [Header("Quick Setup")]
-    [SerializeField] private bool createShopGameObject = false;
-
-    [Header("Manual Assignment")]
-    [SerializeField] private VisualTreeAsset shopUIAsset;
-
-    [Header("Testing")]
-    [SerializeField] private bool testShopSystem = false;
-    [SerializeField] private bool debugShopSetup = false;
-    [SerializeField] private bool createPanelSettings = false;
-
-    void Update()
-    {
-        // Handle inspector button presses
-        if (testShopSystem)
-        {
-            testShopSystem = false;
-            TestShopSystem();
-        }
-
-        if (debugShopSetup)
-        {
-            debugShopSetup = false;
-            DebugShopSetup();
-        }
-
-        if (createPanelSettings)
-        {
-            createPanelSettings = false;
-            CreatePanelSettings();
-        }
-    }
-
-    [ContextMenu("Create Panel Settings")]
-    void CreatePanelSettings()
-    {
-#if UNITY_EDITOR
-        // Ensure UI directory exists
-        if (!AssetDatabase.IsValidFolder("Assets/UI"))
-        {
-            AssetDatabase.CreateFolder("Assets", "UI");
-        }
-
-        // Create Panel Settings asset
-        var panelSettings = ScriptableObject.CreateInstance<PanelSettings>();
-
-        // Set default values
-        panelSettings.themeStyleSheet = null; // You can assign a theme if you have one
-        panelSettings.targetTexture = null; // Will render to screen
-        panelSettings.scaleMode = PanelScaleMode.ConstantPixelSize;
-        panelSettings.scale = 1.0f;
-        panelSettings.referenceResolution = new Vector2Int(1920, 1080);
-        panelSettings.screenMatchMode = PanelScreenMatchMode.MatchWidthOrHeight;
-        panelSettings.match = 0.5f;
-        panelSettings.sortingOrder = 10; // Set higher than main UI (which has sortingOrder 0)
-
-        // Save the asset
-        string panelSettingsPath = "Assets/UI/PanelSettings.asset";
-        AssetDatabase.CreateAsset(panelSettings, panelSettingsPath);
-        AssetDatabase.SaveAssets();
-
-        Debug.Log($"Created Panel Settings at {panelSettingsPath}");
-
-        // Assign to existing shop manager
-        var shopManager = FindFirstObjectByType<SimpleShopManager>();
-        if (shopManager != null)
-        {
-            var uiDocument = shopManager.GetComponent<UIDocument>();
-            if (uiDocument != null)
-            {
-                uiDocument.panelSettings = panelSettings;
-                Debug.Log("Assigned Panel Settings to ShopManager UIDocument!");
-            }
-        }
-#else
-        Debug.LogError("Panel Settings can only be created in the Editor!");
-#endif
-    }
-    [ContextMenu("Test Shop UI Visibility")]
-    void TestShopUIVisibility()
-    {
-        var shopManager = FindFirstObjectByType<SimpleShopManager>();
-        if (shopManager == null)
-        {
-            Debug.LogError("No ShopManager found in scene!");
-            return;
-        }
-
-        var uiDocument = shopManager.GetComponent<UIDocument>();
-        if (uiDocument == null)
-        {
-            Debug.LogError("ShopManager has no UIDocument!");
-            return;
-        }
-
-        Debug.Log("=== Shop UI Visibility Test ===");
-        Debug.Log($"UIDocument sortingOrder: {uiDocument.sortingOrder}");
-
-        if (uiDocument.panelSettings != null)
-        {
-            Debug.Log($"Panel Settings sortingOrder: {uiDocument.panelSettings.sortingOrder}");
-        }
-        else
-        {
-            Debug.LogWarning("No Panel Settings assigned!");
-        }
-
-        // Compare with main UI
-        var allUIDocuments = FindObjectsByType<UIDocument>(FindObjectsSortMode.None);
-        Debug.Log("All UIDocuments in scene:");
-        foreach (var doc in allUIDocuments)
-        {
-            var panelSort = doc.panelSettings?.sortingOrder ?? -999;
-            Debug.Log($"  '{doc.gameObject.name}' - UIDoc sortOrder: {doc.sortingOrder}, Panel sortOrder: {panelSort}");
-        }
-
-        // Try to open the shop
-        var mainTeamScript = FindFirstObjectByType<MainTeamSelectScript>();
-        if (mainTeamScript != null)
-        {
-            // Create a dummy character for testing
-            var dummyCharacter = new TeamCharacter();
-            dummyCharacter.name = "Test Character";
-            shopManager.OpenShop(dummyCharacter);
-            Debug.Log("Shop opened for testing - check if it's visible above other UI!");
-        }
-        else
-        {
-            Debug.LogWarning("No MainTeamSelectScript found - cannot test shop opening");
-        }
-    }
-
-    [ContextMenu("Fix Panel Settings Sort Order")]
-    void FixPanelSettingsSortOrder()
-    {
-#if UNITY_EDITOR
-        // Check if Panel Settings already exists
-        string panelSettingsPath = "Assets/UI/PanelSettings.asset";
-        var existingPanelSettings = AssetDatabase.LoadAssetAtPath<PanelSettings>(panelSettingsPath);
-
-        if (existingPanelSettings != null)
-        {
-            existingPanelSettings.sortingOrder = 10; // Set higher than main UI (which has sortingOrder 0)
-            EditorUtility.SetDirty(existingPanelSettings);
-            AssetDatabase.SaveAssets();
-            Debug.Log($"Updated Panel Settings sortingOrder to 10 for UI layering!");
-        }
-        else
-        {
-            Debug.LogWarning("Panel Settings not found. Run 'Create Panel Settings' first.");
-        }
-
-        // Also update any UIDocument that might be using this Panel Settings
-        var shopManager = FindFirstObjectByType<SimpleShopManager>();
-        if (shopManager != null)
-        {
-            var uiDocument = shopManager.GetComponent<UIDocument>();
-            if (uiDocument != null && uiDocument.panelSettings != null)
-            {
-                uiDocument.panelSettings.sortingOrder = 10;
-                EditorUtility.SetDirty(uiDocument.panelSettings);
-                Debug.Log("Updated UIDocument Panel Settings sortingOrder!");
-            }
-        }
-#else
-        Debug.LogError("Panel Settings can only be modified in the Editor!");
-#endif
-    }
-    [ContextMenu("Assign Shop UI Asset")]
-    void AssignShopUIAsset()
-    {
-        var shopManager = FindFirstObjectByType<SimpleShopManager>();
-        if (shopManager == null)
-        {
-            Debug.LogError("No ShopManager found in scene. Create one first.");
-            return;
-        }
-
-        var uiDocument = shopManager.GetComponent<UIDocument>();
-        if (uiDocument == null)
-        {
-            Debug.LogError("ShopManager doesn't have a UIDocument component!");
-            return;
-        }
-
-        if (shopUIAsset != null)
-        {
-            uiDocument.visualTreeAsset = shopUIAsset;
-            Debug.Log("Successfully assigned ShopUI.uxml to UIDocument!");
-        }
-        else
-        {
-            Debug.LogError("No Shop UI Asset assigned! Please drag ShopUI.uxml to the Shop UI Asset field in the inspector.");
-        }
-    }
-
-    void Start()
-    {
-        if (createShopGameObject)
-        {
-            CreateShopGameObject();
-            createShopGameObject = false;
-        }
-
-        // Always ensure shop system is properly set up
-        EnsureShopSystemSetup();
-    }
-
-    void EnsureShopSystemSetup()
-    {
-        var shopManager = FindFirstObjectByType<SimpleShopManager>();
-        if (shopManager == null)
-        {
-            Debug.Log("No ShopManager found, creating one...");
-            CreateShopGameObject();
-            shopManager = FindFirstObjectByType<SimpleShopManager>();
-        }
-
-        if (shopManager != null)
-        {
-            var uiDocument = shopManager.GetComponent<UIDocument>();
-            if (uiDocument != null)
-            {
-                // Check if Panel Settings is assigned
-                if (uiDocument.panelSettings == null)
-                {
-                    Debug.Log("No Panel Settings assigned to ShopManager, creating one...");
-                    CreatePanelSettings();
-                }
-
-                // Check if Visual Tree Asset is assigned
-                if (uiDocument.visualTreeAsset == null)
-                {
-                    Debug.Log("No Visual Tree Asset assigned to ShopManager, assigning ShopUI.uxml...");
-                    AssignShopUIAsset();
-                }
-            }
-        }
-    }
-
-    [ContextMenu("Create Shop GameObject")]
-    void CreateShopGameObject()
-    {
-        // Check if shop manager already exists
-        var existingShop = FindFirstObjectByType<SimpleShopManager>();
-        if (existingShop != null)
-        {
-            Debug.LogWarning("ShopManager already exists in scene!");
-            return;
-        }
-
-        // Create shop GameObject
-        GameObject shopGO = new GameObject("ShopManager");
-
-        // Add UIDocument component FIRST (before SimpleShopManager)
-        var uiDocument = shopGO.AddComponent<UIDocument>();
-
-        // Add SimpleShopManager component AFTER UIDocument
-        var shopManager = shopGO.AddComponent<SimpleShopManager>();
-
-        Debug.Log("Created ShopManager GameObject. Now looking for ShopUI.uxml...");
-
-        // Try to find and assign the UXML file - try multiple potential paths
-        VisualTreeAsset uiAsset = null;
-
-#if UNITY_EDITOR
-        // Try to load from Assets folder directly (Editor only)
-        uiAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/UI/TeamSelectOverview/ShopUI.uxml");
-        if (uiAsset != null)
-        {
-            Debug.Log("Found ShopUI.uxml in Assets/UI/TeamSelectOverview/");
-            uiDocument.visualTreeAsset = uiAsset;
-
-            // Try to find and assign Panel Settings
-            var panelSettings = AssetDatabase.LoadAssetAtPath<PanelSettings>("Assets/UI/PanelSettings.asset");
-            if (panelSettings == null)
-            {
-                // Try common locations for Panel Settings
-                var panelSettingsGuids = AssetDatabase.FindAssets("t:PanelSettings");
-                if (panelSettingsGuids.Length > 0)
-                {
-                    var panelSettingsPath = AssetDatabase.GUIDToAssetPath(panelSettingsGuids[0]);
-                    panelSettings = AssetDatabase.LoadAssetAtPath<PanelSettings>(panelSettingsPath);
-                    Debug.Log($"Found Panel Settings at: {panelSettingsPath}");
-                }
-                else
-                {
-                    // No Panel Settings found, create one
-                    Debug.Log("No Panel Settings found, creating one...");
-                    CreatePanelSettings();
-                    panelSettings = AssetDatabase.LoadAssetAtPath<PanelSettings>("Assets/UI/PanelSettings.asset");
-                }
-            }
-
-            if (panelSettings != null)
-            {
-                uiDocument.panelSettings = panelSettings;
-                // Ensure the UIDocument also has a high sortingOrder for proper layering
-                uiDocument.sortingOrder = 10;
-                Debug.Log("Successfully assigned Panel Settings to UIDocument with sortingOrder 10!");
-            }
-            else
-            {
-                Debug.LogError("Failed to create or find Panel Settings!");
-            }
-
-            Debug.Log("Successfully assigned ShopUI.uxml to UIDocument!");
-        }
-        else
-        {
-            // Try Resources folder
-            uiAsset = Resources.Load<VisualTreeAsset>("UI/TeamSelectOverview/ShopUI");
-            if (uiAsset != null)
-            {
-                Debug.Log("Found ShopUI.uxml in Resources folder");
-                uiDocument.visualTreeAsset = uiAsset;
-                Debug.Log("Successfully assigned ShopUI.uxml to UIDocument!");
-            }
-            else
-            {
-                Debug.LogError("Could not find ShopUI.uxml! Please check that the file exists at Assets/UI/TeamSelectOverview/ShopUI.uxml");
-                Debug.LogError("Manual assignment required: Select the ShopManager GameObject and assign ShopUI.uxml to the UIDocument component.");
-            }
-        }
-#else
-        // In build, try Resources folder
-        uiAsset = Resources.Load<VisualTreeAsset>("UI/TeamSelectOverview/ShopUI");
-        if (uiAsset != null)
-        {
-            uiDocument.visualTreeAsset = uiAsset;
-            Debug.Log("Successfully assigned ShopUI.uxml to UIDocument!");
-        }
-        else
-        {
-            Debug.LogError("Could not find ShopUI.uxml in Resources folder!");
-        }
-#endif
-
-        Debug.Log("The shop is now ready to use with the inventory system!");
-
-        // Select the created GameObject in the hierarchy for easy inspection
-#if UNITY_EDITOR
-        UnityEditor.Selection.activeGameObject = shopGO;
-#endif
-    }
-    [ContextMenu("Test Shop System")]
-    void TestShopSystem()
-    {
-        var shopManager = FindFirstObjectByType<SimpleShopManager>();
-        if (shopManager == null)
-        {
-            Debug.LogError("No ShopManager found in scene. Please create one first using 'Create Shop GameObject'.");
-            return;
-        }
-
-        Debug.Log("Testing Shop System...");
-
-        // Check if UIDocument is assigned
-        var uiDocument = shopManager.GetComponent<UIDocument>();
-        if (uiDocument == null)
-        {
-            Debug.LogError("ShopManager doesn't have a UIDocument component!");
-            return;
-        }
-
-        // Check if UXML is assigned
-        if (uiDocument.visualTreeAsset == null)
-        {
-            Debug.LogError("UIDocument doesn't have a Visual Tree Asset assigned! Please assign ShopUI.uxml manually or use 'Assign Shop UI Asset' context menu.");
-            return;
-        }
-
-        Debug.Log($"UIDocument found with asset: {uiDocument.visualTreeAsset.name}");
-
-        // Check if UI elements can be found
-        var root = uiDocument.rootVisualElement;
-        var shopContainer = root.Q<VisualElement>("ShopContainer");
-        Debug.Log($"ShopContainer found in root: {shopContainer != null}");
-
-        if (shopContainer == null)
-        {
-            Debug.LogError("ShopContainer not found! This means the UXML structure might be wrong or not loaded properly.");
-            Debug.Log("Checking root element children...");
-            Debug.Log($"Root element has {root.childCount} children");
-            for (int i = 0; i < root.childCount; i++)
-            {
-                var child = root.ElementAt(i);
-                Debug.Log($"Child {i}: {child.name} (type: {child.GetType().Name})");
-            }
-            return;
-        }
-
-        // Test opening the shop
-        var testCharacter = new TeamCharacter("Test Hero", true);
-        testCharacter.gold = 100; // Give some starting money
-
-        Debug.Log("Opening shop for test character...");
-        shopManager.OpenShop(testCharacter);
-
-        // Check if shop is actually visible
-        Debug.Log($"Shop container display style: {shopContainer.style.display}");
-        Debug.Log($"Shop container resolved style display: {shopContainer.resolvedStyle.display}");
-        Debug.Log($"Shop container world bound: {shopContainer.worldBound}");
-        Debug.Log($"Shop container local bound: {shopContainer.localBound}");
-
-        Debug.Log("Shop test completed! If you don't see the shop window, check that:");
-        Debug.Log("1. Panel Settings is assigned to the UIDocument");
-        Debug.Log("2. No other UI is covering the shop");
-        Debug.Log("3. The shop might be outside the camera view");
-    }
-
-    [ContextMenu("Debug Shop Setup")]
-    void DebugShopSetup()
-    {
-        Debug.Log("=== SHOP SETUP DEBUG ===");
-
-        var shopManager = FindFirstObjectByType<SimpleShopManager>();
-        Debug.Log($"ShopManager found: {shopManager != null}");
-
-        if (shopManager != null)
-        {
-            var uiDocument = shopManager.GetComponent<UIDocument>();
-            Debug.Log($"UIDocument found: {uiDocument != null}");
-
-            if (uiDocument != null)
-            {
-                Debug.Log($"Visual Tree Asset assigned: {uiDocument.visualTreeAsset != null}");
-                if (uiDocument.visualTreeAsset != null)
-                {
-                    Debug.Log($"Asset name: {uiDocument.visualTreeAsset.name}");
-                }
-            }
-        }
-
-        // Check if UXML file exists
-#if UNITY_EDITOR
-        var uiAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/UI/TeamSelectOverview/ShopUI.uxml");
-        Debug.Log($"ShopUI.uxml exists at expected path: {uiAsset != null}");
-#endif
-
-        Debug.Log("=== END DEBUG ===");
-    }
-}

+ 33 - 14
Assets/UI/TeamSelectOverview/ShopUI.uss

@@ -367,41 +367,59 @@
     padding-top: 10px;
     padding-bottom: 10px;
     margin-bottom: 5px;
-    flex-direction: row;
-    justify-content: space-between;
-    align-items: center;
+    flex-direction: column;
+    min-height: 80px;
 }
 
 .shop-item:hover {
     background-color: rgb(235, 235, 235);
 }
 
+.item-header {
+    flex-direction: row;
+    justify-content: space-between;
+    align-items: flex-start;
+    margin-bottom: 5px;
+    width: 100%;
+}
+
 .item-name {
     font-size: 16px;
     color: rgb(50, 50, 50);
     -unity-font-style: bold;
+    flex-grow: 1;
+    flex-shrink: 1;
+    white-space: normal;
+    max-width: 350px;
+}
+
+.item-cost {
+    font-size: 14px;
+    color: rgb(0, 120, 0);
+    -unity-font-style: bold;
+    margin-left: 10px;
+    flex-shrink: 0;
+    white-space: nowrap;
 }
 
 .item-description {
     font-size: 12px;
     color: rgb(100, 100, 100);
     margin-top: 2px;
+    margin-bottom: 3px;
+    white-space: normal;
+    -unity-text-align: upper-left;
 }
 
 .item-stats {
     font-size: 11px;
     color: rgb(80, 80, 150);
     margin-top: 2px;
+    margin-bottom: 5px;
+    white-space: normal;
 }
 
-.item-price {
-    font-size: 14px;
-    color: rgb(0, 120, 0);
-    -unity-font-style: bold;
-    margin-right: 10px;
-}
-
-.buy-button {
+.purchase-button {
     width: 80px;
     height: 25px;
     background-color: rgb(50, 150, 50);
@@ -415,18 +433,19 @@
     border-top-width: 0;
     border-bottom-width: 0;
     font-size: 12px;
+    align-self: flex-end;
 }
 
-.buy-button:hover {
+.purchase-button:hover {
     background-color: rgb(70, 170, 70);
 }
 
-.buy-button:disabled {
+.purchase-button:disabled {
     background-color: rgb(150, 150, 150);
     color: rgb(200, 200, 200);
 }
 
-.cannot-afford {
+.purchase-button-disabled {
     background-color: rgb(150, 150, 150);
     color: rgb(200, 200, 200);
 }

+ 190 - 0
SHOP_MIGRATION_GUIDE.md

@@ -0,0 +1,190 @@
+# Shop System Migration Guide
+
+## Overview
+The shop system has been updated to use ScriptableObject-based Item assets instead of hardcoded SimpleShopItem data. This allows for better data management, persistence, and easier content creation.
+
+## What Changed
+
+### Old System (SimpleShopManager)
+- Used hardcoded `SimpleShopItem` objects created in code
+- Items were temporary and lost when the game closed
+- Limited flexibility for item properties
+
+### New System (ItemShopManager)
+- Uses `Item` ScriptableObjects that persist as asset files
+- Supports `WeaponItem`, `ArmorItem`, and `MiscellaneousItem` types
+- Items can be created and modified in the Unity Inspector
+- Items are loaded automatically from the `Resources/Items` folder
+
+## Migration Steps
+
+### 1. Run the Migration Tool
+In Unity, go to the menu: **RPG > Migrate Shop System**
+
+This will:
+- Convert any `SimpleShopManager` components to `ItemShopManager`
+- Preserve existing settings like shop name
+- Save the scene automatically
+
+### 2. Create Sample Items (Optional)
+Run: **RPG > Create Sample Items**
+
+This creates example items including:
+- Simple Sword, Simple Bow, Iron Sword (Weapons)
+- Leather Armor, Iron Chainmail (Armor)
+- Health Potion, Mana Potion, Hemp Rope (Miscellaneous)
+
+### 3. Verify Setup
+Run: **RPG > Verify Shop Setup**
+
+This checks:
+- ItemShopManager components are present
+- No old SimpleShopManager components remain
+- Items are properly loaded
+- UI components are configured
+
+## Creating New Items
+
+### Via Unity Menu
+1. Right-click in Project window
+2. Go to **Create > RPG > Items**
+3. Choose **Weapon**, **Armor**, or **Miscellaneous**
+4. Configure the item properties in the Inspector
+5. Save the asset in `Assets/Resources/Items/` (or subfolders)
+
+### Item Properties
+
+#### All Items (Base Item class)
+- **Item Name**: Display name
+- **Description**: Item description
+- **Icon**: Item icon sprite
+- **Model 3D**: 3D representation
+- **Item Type**: Weapon, Armor, Consumable, Tool, Accessory, Miscellaneous
+- **Rarity**: Common, Uncommon, Rare, Epic, Legendary
+- **Cost**: Gold, Silver, Copper prices
+- **Search Tags**: Keywords for shop search functionality
+
+#### Weapon Items
+- **Min/Max Damage**: Damage range
+- **Range**: Attack range
+- **Weapon Modifier**: Bonus to hit
+- **Attack Speed**: Animation speed
+- **Weapon Type**: Sword, Bow, Crossbow, etc.
+- **Weapon Class Name**: Code class to instantiate
+
+#### Armor Items
+- **Armor Class**: AC bonus
+- **Attribute Modifiers**: STR, DEX, CON, WIS bonuses/penalties
+- **Armor Type**: Light, Medium, Heavy, Shield
+- **Armor Slot**: Head, Chest, Legs, etc.
+
+#### Miscellaneous Items
+- **Is Consumable**: Whether item is used up
+- **Is Stackable**: Whether items can stack
+- **Max Stack Size**: Maximum stack count
+- **Health/Mana Restoration**: Dice-based or range-based healing
+
+## Shop Features
+
+### Automatic Item Loading
+The `ItemShopManager` automatically loads all `Item` ScriptableObjects from:
+- `Assets/Resources/Items/` folder and all subfolders
+- Direct `Assets/Resources/` folder (as fallback)
+
+### Filtering and Search
+- **Category Filter**: Filter by item type (Weapons, Armor, etc.)
+- **Search Field**: Search by item name, description, or tags
+- **Combined Filtering**: Category and search work together
+
+### Purchase System
+- Checks if player can afford items
+- Handles gold/silver/copper currency conversion
+- Updates player money automatically
+- Adds purchased items to character inventory (requires inventory system integration)
+
+## Integration Notes
+
+### Character Inventory
+The shop calls `AddItemToCustomerInventory(Item item)` when items are purchased. You'll need to implement this method based on your inventory system:
+
+```csharp
+private void AddItemToCustomerInventory(Item item)
+{
+    // Example integration:
+    currentCustomer.inventory.AddItem(item);
+    
+    // Or if using a different system:
+    InventoryManager.Instance.AddItemToCharacter(currentCustomer, item);
+}
+```
+
+### Bank System
+The shop uses a `Bank` helper class for currency operations. The current implementation converts between character money and the bank format automatically.
+
+### UI Integration
+The shop uses the existing `ShopUI.uxml` file. Make sure the UIDocument component has this visual tree asset assigned.
+
+## File Structure
+
+```
+Assets/
+├── Resources/
+│   └── Items/
+│       ├── Weapons/
+│       │   ├── SimpleSword.asset
+│       │   ├── SimpleBow.asset
+│       │   └── IronSword.asset
+│       ├── Armor/
+│       │   ├── LeatherArmor.asset
+│       │   └── IronChainmail.asset
+│       └── Miscellaneous/
+│           ├── HealthPotion.asset
+│           ├── ManaPotion.asset
+│           └── HempRope.asset
+├── Scripts/
+│   ├── Objects/Items/
+│   │   ├── Item.cs (base class)
+│   │   ├── WeaponItem.cs
+│   │   ├── ArmorItem.cs
+│   │   └── MiscellaneousItem.cs
+│   ├── UI/
+│   │   ├── ItemShopManager.cs (new)
+│   │   └── SimpleShopManager.cs (deprecated)
+│   └── Editor/
+│       ├── CreateSampleItems.cs
+│       └── ShopSystemMigrator.cs
+```
+
+## Troubleshooting
+
+### "No items found" in shop
+1. Check that items are saved in `Assets/Resources/Items/` or subfolders
+2. Run **RPG > Create Sample Items** to create test items
+3. Run **RPG > Verify Shop Setup** to check configuration
+
+### Shop not opening
+1. Verify `ItemShopManager` component exists in scene
+2. Check that `UIDocument` has `ShopUI.uxml` assigned
+3. Ensure `MainTeamSelectScript` is updated to use `ItemShopManager`
+
+### Compile errors
+1. Make sure all old `SimpleShopManager` references are updated to `ItemShopManager`
+2. Check that the new script files are properly imported
+3. Verify all required using statements are present
+
+## Benefits of New System
+
+1. **Persistent Data**: Items are saved as asset files
+2. **Designer Friendly**: Non-programmers can create items in Unity Inspector
+3. **Version Control**: Item assets can be tracked in source control
+4. **Modular**: Easy to add new item types and properties
+5. **Performance**: Items are loaded once at startup
+6. **Flexible**: Supports complex item properties and behaviors
+
+## Next Steps
+
+1. Create your own custom items using the Unity Inspector
+2. Integrate the shop with your character inventory system
+3. Add item icons and 3D models to enhance visual presentation
+4. Consider adding item tooltips and detailed stat displays
+5. Implement item rarity-based visual effects in the shop UI

+ 2 - 2
UserSettings/EditorUserSettings.asset

@@ -21,13 +21,13 @@ EditorUserSettings:
       value: 5655020755505a0d5e0a5577457b0a44154f1a7f2a7e70697e284b30e4b2623b
       flags: 0
     RecentlyUsedSceneGuid-4:
-      value: 510500025d560a0c095d092111730d44464f4b78757b72357a701c31b7b16368
+      value: 5a090503000558580f0d557342700844144f4d7c7b7d74692c281e63b0e2623c
       flags: 0
     RecentlyUsedSceneGuid-5:
       value: 51020c5550545a0354575e7b47270744174e4b787e2b77687b7e1b37e7e4366d
       flags: 0
     RecentlyUsedSceneGuid-6:
-      value: 5a090503000558580f0d557342700844144f4d7c7b7d74692c281e63b0e2623c
+      value: 510500025d560a0c095d092111730d44464f4b78757b72357a701c31b7b16368
       flags: 0
     vcSharedLogLevel:
       value: 0d5e400f0650