mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
🆙 add check for pets when sellable is enabled
This commit is contained in:
@@ -7,4 +7,5 @@ export interface IAvatarEditorCategoryPartItem
|
|||||||
usesColor?: boolean;
|
usesColor?: boolean;
|
||||||
maxPaletteCount?: number;
|
maxPaletteCount?: number;
|
||||||
isClear?: boolean;
|
isClear?: boolean;
|
||||||
|
isSellableNotOwned?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export const AvatarEditorFigureSetItemView: FC<{
|
|||||||
const clubLevel = partItem.partSet?.clubLevel ?? 0;
|
const clubLevel = partItem.partSet?.clubLevel ?? 0;
|
||||||
const isHC = !GetConfigurationValue<boolean>('hc.disabled', false) && (clubLevel > 0);
|
const isHC = !GetConfigurationValue<boolean>('hc.disabled', false) && (clubLevel > 0);
|
||||||
const isLocked = isHC && (GetClubMemberLevel() < clubLevel);
|
const isLocked = isHC && (GetClubMemberLevel() < clubLevel);
|
||||||
|
const isSellableNotOwned = partItem.isSellableNotOwned ?? false;
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
@@ -39,22 +40,26 @@ export const AvatarEditorFigureSetItemView: FC<{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
url = await AvatarEditorThumbnailsHelper.build(setType, partItem, partItem.usesColor, selectedColorParts[setType] ?? null, partIsLocked);
|
url = await AvatarEditorThumbnailsHelper.build(setType, partItem, partItem.usesColor, selectedColorParts[setType] ?? null, partIsLocked || isSellableNotOwned);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(url && url.length) setAssetUrl(url);
|
if(url && url.length) setAssetUrl(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
loadImage();
|
loadImage();
|
||||||
}, [ setType, partItem, selectedColorParts, getFigureStringWithFace ]);
|
}, [ setType, partItem, selectedColorParts, getFigureStringWithFace, isSellableNotOwned ]);
|
||||||
|
|
||||||
if(!partItem) return null;
|
if(!partItem) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<InfiniteGrid.Item itemActive={ isSelected } itemImage={ (partItem.isClear ? undefined : assetUrl) } className={ `avatar-parts mx-auto${ isSelected ? ' part-selected' : '' }` } style={ { backgroundPosition: (setType === AvatarFigurePartType.HEAD) ? 'center -35px' : 'center' } } { ...rest }>
|
<InfiniteGrid.Item itemActive={ isSelected } itemImage={ (partItem.isClear ? undefined : assetUrl) } className={ `avatar-parts mx-auto${ isSelected ? ' part-selected' : '' }${ isSellableNotOwned ? ' pet-sellable-locked' : '' }` } style={ { backgroundPosition: (setType === AvatarFigurePartType.HEAD) ? 'center -35px' : 'center' } } { ...rest }>
|
||||||
{ !partItem.isClear && isHC && <LayoutCurrencyIcon className="absolute inset-e-1 bottom-1" type="hc" /> }
|
{ !partItem.isClear && isHC && <LayoutCurrencyIcon className="absolute inset-e-1 bottom-1" type="hc" /> }
|
||||||
{ partItem.isClear && <AvatarEditorIcon icon="clear" /> }
|
{ partItem.isClear && <AvatarEditorIcon icon="clear" /> }
|
||||||
{ !partItem.isClear && partItem.partSet.isSellable && <AvatarEditorIcon className="inset-e-1 bottom-1 absolute" icon="sellable" /> }
|
{ !partItem.isClear && partItem.partSet.isSellable && !isSellableNotOwned && <AvatarEditorIcon className="inset-e-1 bottom-1 absolute" icon="sellable" /> }
|
||||||
|
{ isSellableNotOwned &&
|
||||||
|
<div className="pet-sellable-badge">
|
||||||
|
<LayoutCurrencyIcon type={ -1 } />
|
||||||
|
</div> }
|
||||||
</InfiniteGrid.Item>
|
</InfiniteGrid.Item>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1232,6 +1232,27 @@ body {
|
|||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pet-sellable-locked {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed !important;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pet-sellable-badge {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 2px;
|
||||||
|
right: 2px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1px;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 1px 3px;
|
||||||
|
font-size: 9px;
|
||||||
|
color: #ffd700;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.pet-remove-btn {
|
.pet-remove-btn {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ const useAvatarEditorState = () =>
|
|||||||
|
|
||||||
if(GetClubMemberLevel() < partItem.partSet.clubLevel) return;
|
if(GetClubMemberLevel() < partItem.partSet.clubLevel) return;
|
||||||
|
|
||||||
|
if(partItem.isSellableNotOwned) return;
|
||||||
|
|
||||||
setMaxPaletteCount(partItem.maxPaletteCount || 1);
|
setMaxPaletteCount(partItem.maxPaletteCount || 1);
|
||||||
|
|
||||||
selectPart(setType, partId);
|
selectPart(setType, partId);
|
||||||
@@ -271,13 +273,15 @@ const useAvatarEditorState = () =>
|
|||||||
|
|
||||||
if(!partSet || !partSet.isSelectable || ((partSet.gender !== gender) && (partSet.gender !== AvatarFigurePartType.UNISEX))) continue;
|
if(!partSet || !partSet.isSelectable || ((partSet.gender !== gender) && (partSet.gender !== AvatarFigurePartType.UNISEX))) continue;
|
||||||
|
|
||||||
if(partSet.isSellable && figureSetIds.indexOf(partSet.id) === -1) continue;
|
const isSellableNotOwned = partSet.isSellable && figureSetIds.indexOf(partSet.id) === -1;
|
||||||
|
|
||||||
|
if(isSellableNotOwned && setType !== AvatarFigurePartType.PET) continue;
|
||||||
|
|
||||||
let maxPaletteCount = 0;
|
let maxPaletteCount = 0;
|
||||||
|
|
||||||
for(const part of partSet.parts) maxPaletteCount = Math.max(maxPaletteCount, part.colorLayerIndex);
|
for(const part of partSet.parts) maxPaletteCount = Math.max(maxPaletteCount, part.colorLayerIndex);
|
||||||
|
|
||||||
partItems.push({ id: partSet.id, partSet, usesColor, maxPaletteCount });
|
partItems.push({ id: partSet.id, partSet, usesColor, maxPaletteCount, isSellableNotOwned });
|
||||||
}
|
}
|
||||||
|
|
||||||
partItems.sort(AvatarEditorPartSorter(false));
|
partItems.sort(AvatarEditorPartSorter(false));
|
||||||
|
|||||||
Reference in New Issue
Block a user