From 54b85f0f1fc24e70116eca66e2a413bb88cb8f92 Mon Sep 17 00:00:00 2001 From: MaksSlyzar Date: Sat, 18 Apr 2026 12:07:56 +0300 Subject: [PATCH] Updated DebugTab, loot --- client/src/services/GameDataManager.js | 2 +- .../views/GameInterface/tabs/DatapackTab.jsx | 30 +++++++++- .../tabs/components/DatapackDetailsModal.css | 58 +++++++++++++++++++ .../tabs/components/DatapackDetailsModal.jsx | 45 ++++++++++++++ .../hostiles/tutorial/tutorial_hostile.json | 15 ++++- 5 files changed, 146 insertions(+), 4 deletions(-) diff --git a/client/src/services/GameDataManager.js b/client/src/services/GameDataManager.js index 9f3a987..f38d400 100644 --- a/client/src/services/GameDataManager.js +++ b/client/src/services/GameDataManager.js @@ -31,7 +31,7 @@ class GameDataManager { if (Array.isArray(data.rooms)) { data.rooms.forEach((r) => this.rooms.set(r.id, r)); } - + console.log(this.hostiles); if (data.languages) { this.translations = data.languages; } diff --git a/client/src/views/GameInterface/tabs/DatapackTab.jsx b/client/src/views/GameInterface/tabs/DatapackTab.jsx index 7803eb9..6dda336 100644 --- a/client/src/views/GameInterface/tabs/DatapackTab.jsx +++ b/client/src/views/GameInterface/tabs/DatapackTab.jsx @@ -88,7 +88,7 @@ const DatapackTab = () => { {displayList.map((item) => (
setSelectedItem({ ...item, sectionType: activeSection }) } @@ -105,9 +105,37 @@ const DatapackTab = () => {
)} +
{item.displayName} {item.id} + + {/* Секція луту без картинок, лише текст або іконка коробки */} + {activeSection === "hostiles" && + item.loot && + item.loot.length > 0 && ( +
+ {item.loot.map((lootEntry, idx) => { + const lootData = GameDataManager.getItem(lootEntry.id); + return ( +
+ + + {lootData?.displayName || + lootEntry.id.split(":").pop()} + +
+ ); + })} +
+ )}
))} diff --git a/client/src/views/GameInterface/tabs/components/DatapackDetailsModal.css b/client/src/views/GameInterface/tabs/components/DatapackDetailsModal.css index e2b364a..4d37798 100644 --- a/client/src/views/GameInterface/tabs/components/DatapackDetailsModal.css +++ b/client/src/views/GameInterface/tabs/components/DatapackDetailsModal.css @@ -91,3 +91,61 @@ opacity: 1; } } + +.loot-list-full { + display: flex; + flex-direction: column; + gap: 10px; + background: rgba(0, 0, 0, 0.2); + padding: 12px; + border-radius: 8px; +} + +.loot-detail-item { + display: flex; + align-items: center; + gap: 12px; + padding: 8px; + border-bottom: 1px solid rgba(255, 255, 255, 0.05); +} + +.loot-detail-item:last-child { + border-bottom: none; +} + +.loot-item-icon { + width: 40px; + height: 40px; + background: rgba(255, 255, 255, 0.05); + border-radius: 6px; + display: flex; + align-items: center; + justify-content: center; +} + +.loot-item-icon img { + width: 32px; + height: 32px; + object-fit: contain; +} + +.loot-item-info { + display: flex; + flex-direction: column; +} + +.loot-item-name { + font-weight: 600; + color: #fff; + font-size: 14px; +} + +.loot-item-meta { + font-size: 12px; + color: #aaa; +} + +.fallback-mini { + color: #444; + font-weight: bold; +} diff --git a/client/src/views/GameInterface/tabs/components/DatapackDetailsModal.jsx b/client/src/views/GameInterface/tabs/components/DatapackDetailsModal.jsx index 879dd5a..0689543 100644 --- a/client/src/views/GameInterface/tabs/components/DatapackDetailsModal.jsx +++ b/client/src/views/GameInterface/tabs/components/DatapackDetailsModal.jsx @@ -22,6 +22,49 @@ const DatapackDetailsModal = ({ data, onClose }) => { ); }; + const renderLoot = () => { + if (!data.loot || data.loot.length === 0) return null; + + return ( +
+

Loot Table

+
+ {data.loot.map((entry, idx) => { + const itemInfo = GameDataManager.getItem(entry.id); + const countDisplay = + typeof entry.count === "object" + ? `${entry.count.min}-${entry.count.max}` + : entry.count; + + return ( +
+
+ {itemInfo?.texture ? ( + {itemInfo.displayName} + ) : ( +
?
+ )} +
+
+ + {itemInfo?.displayName || entry.id} + + + {Math.round(entry.chance * 100)}% chance • Amount:{" "} + {countDisplay} + +
+
+ ); + })} +
+
+ ); + }; + return (
{ )}
+ {data.sectionType === "hostiles" && renderLoot()} + {data.ingredients && (

Recipe Requirements

diff --git a/game-server/datapacks/original/data/enemies/hostiles/tutorial/tutorial_hostile.json b/game-server/datapacks/original/data/enemies/hostiles/tutorial/tutorial_hostile.json index 6679335..6be80d6 100644 --- a/game-server/datapacks/original/data/enemies/hostiles/tutorial/tutorial_hostile.json +++ b/game-server/datapacks/original/data/enemies/hostiles/tutorial/tutorial_hostile.json @@ -6,8 +6,19 @@ "health": 30, "defense": 0.0, "damage": 2, - "critical,chance": 0.0, + "critical.chance": 0.0, "attack.rate": 1 - } + }, + "loot": [ + { + "id": "original:alloy_steel", + "chance": 0.4, + "count": { + "min": 1, + "max": 2 + } + } + ], + "meta": {} } }