<script>
import { ItemType, itemsInfo, ItemId } from 'json/itemsInfo.js'
import { getPng } from './getPng.js'
export let item;
export let defaultIcon;
export let defaultName;
export let defaultStyle;
// твоя "аптечка" иконка (путь как тебе удобно)
const kfc = '/assets/items/image/1488.png';
let iconInfo = itemsInfo[item.ItemId];
$: if (item) iconInfo = itemsInfo[item.ItemId];
const Bool = (text) => String(text).toLowerCase() === "true";
const GetClothesClass = (_iconInfo, _item) => {
if (_iconInfo.functionType === ItemType.Clothes && _item.ItemId != -5 && _item.ItemId != -9 && _item.ItemId != -1 && _item.Data.split("_").length >= 2) {
return Bool(item.Data.split("_")[2]) ? "clothesM" : "clothesF"
}
return "";
}
// ✅ решаем, какую картинку ставить
const getItemBg = (item, iconInfo) => {
if (!item) return '';
if (item.ItemId === 1488) return `url(${kfc})`; // <-- твоя
return `url(${getPng(item, iconInfo)})`; // <-- дефолт
};
</script>
{#if item && item.ItemId != 0}
<div class="box-item {defaultStyle} {GetClothesClass(iconInfo, item)}"
class:active={item.active}
class:anim={item.anim}
class:noAnim={!item.anim}
class:noUse={!item.use}
on:mousedown on:mouseup on:mouseenter on:mouseleave>
<span class="item-png" style="background-image: {getItemBg(item, iconInfo)}" />
... остальной код ..
</div>
{:else}
...
{/if}