WIP: Current state before PVP combat investigation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
import type { Location, PlayerState, CombatState, Profile, WorkbenchTab } from './types'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useAudio } from '../../contexts/AudioContext'
|
||||
import Workbench from './Workbench'
|
||||
import { getAssetPath } from '../../utils/assetPath'
|
||||
import { getTranslatedText } from '../../utils/i18nUtils'
|
||||
@@ -83,6 +84,7 @@ function LocationView({
|
||||
onUncraft
|
||||
}: LocationViewProps) {
|
||||
const { t } = useTranslation()
|
||||
const { playSfx } = useAudio()
|
||||
return (
|
||||
<div className="location-view">
|
||||
<div className="location-info">
|
||||
@@ -216,7 +218,10 @@ function LocationView({
|
||||
</div>
|
||||
<button
|
||||
className="entity-action-btn loot-btn"
|
||||
onClick={() => onLootCorpse(String(corpse.id))}
|
||||
onClick={() => {
|
||||
playSfx('/audio/sfx/interact.wav')
|
||||
onLootCorpse(String(corpse.id))
|
||||
}}
|
||||
disabled={corpse.loot_count === 0}
|
||||
>
|
||||
🔍 {t('common.examine')}
|
||||
@@ -360,7 +365,10 @@ function LocationView({
|
||||
{item.quantity === 1 ? (
|
||||
<button
|
||||
className="entity-action-btn pickup"
|
||||
onClick={() => onPickup(item.id, 1)}
|
||||
onClick={() => {
|
||||
playSfx('/audio/sfx/pickup.wav')
|
||||
onPickup(item.id, 1)
|
||||
}}
|
||||
>
|
||||
{t('common.pickUp')}
|
||||
</button>
|
||||
@@ -368,14 +376,26 @@ function LocationView({
|
||||
<div className="item-pickup-btn-container">
|
||||
<button className="entity-action-btn pickup">{t('common.pickUp')} ▼</button>
|
||||
<div className="item-pickup-menu">
|
||||
<button className="item-pickup-option" onClick={() => onPickup(item.id, 1)}>{t('common.pickUp')} 1</button>
|
||||
<button className="item-pickup-option" onClick={() => {
|
||||
playSfx('/audio/sfx/pickup.wav')
|
||||
onPickup(item.id, 1)
|
||||
}}>{t('common.pickUp')} 1</button>
|
||||
{item.quantity >= 5 && (
|
||||
<button className="item-pickup-option" onClick={() => onPickup(item.id, 5)}>{t('common.pickUp')} 5</button>
|
||||
<button className="item-pickup-option" onClick={() => {
|
||||
playSfx('/audio/sfx/pickup.wav')
|
||||
onPickup(item.id, 5)
|
||||
}}>{t('common.pickUp')} 5</button>
|
||||
)}
|
||||
{item.quantity >= 10 && (
|
||||
<button className="item-pickup-option" onClick={() => onPickup(item.id, 10)}>{t('common.pickUp')} 10</button>
|
||||
<button className="item-pickup-option" onClick={() => {
|
||||
playSfx('/audio/sfx/pickup.wav')
|
||||
onPickup(item.id, 10)
|
||||
}}>{t('common.pickUp')} 10</button>
|
||||
)}
|
||||
<button className="item-pickup-option" onClick={() => onPickup(item.id, item.quantity)}>
|
||||
<button className="item-pickup-option" onClick={() => {
|
||||
playSfx('/audio/sfx/pickup.wav')
|
||||
onPickup(item.id, item.quantity)
|
||||
}}>
|
||||
{t('common.pickUpAll')} ({item.quantity})
|
||||
</button>
|
||||
</div>
|
||||
@@ -410,14 +430,14 @@ function LocationView({
|
||||
onClick={() => onInitiatePvP(player.id)}
|
||||
title={`Attack ${player.name || player.username}`}
|
||||
>
|
||||
⚔️ Attack
|
||||
{t('game.attack')}
|
||||
</button>
|
||||
)}
|
||||
{!player.can_pvp && player.level_diff !== undefined && Math.abs(player.level_diff) > 3 && (
|
||||
<div className="pvp-disabled-reason">Level difference too high</div>
|
||||
<div className="pvp-disabled-reason">{t('game.levelDifferenceTooHigh')}</div>
|
||||
)}
|
||||
{!player.can_pvp && location.danger_level !== undefined && location.danger_level < 3 && (
|
||||
<div className="pvp-disabled-reason">Area too safe for PvP</div>
|
||||
<div className="pvp-disabled-reason">{t('game.areaTooSafeForPvP')}</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user