{- |
Display of weapon strings in the inventory.
 -}
module Dodge.Item.Weapon.InventoryDisplay
    ( basicWeaponDisplay
    ) where
import Dodge.Data
import Padding

import Data.Sequence
import Control.Lens
{- | Displays the item name, ammo if loaded, and any selected '_itCharMode'.  -}
basicWeaponDisplay :: Item -> String
basicWeaponDisplay it = case it ^? itAttachment of
    Just ItCharMode {_itCharMode = (c :<| _)} -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded) ++ [' ',c]
    Just ItMode {_itMode = i} -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded) ++ show i
    _   -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded)
  where 
    aIfLoaded = case it ^? wpReloadState of 
        Just 0 -> show $ _wpLoadedAmmo it
        Just x -> "R" ++ show x
        _ -> ""
