Cleanup, stop assigning hotkeys to unequipped items
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Inventory.SelectionList (
|
||||
closeObjectToSelectionItem,
|
||||
) where
|
||||
|
||||
import Dodge.Equipment.Text
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.World
|
||||
import Dodge.Item.SlotsTaken
|
||||
@@ -13,7 +14,7 @@ import Picture.Base
|
||||
invSelectionItem :: Creature -> Int -> Item -> SelectionItem ()
|
||||
invSelectionItem cr i it =
|
||||
SelectionItem
|
||||
{ _siPictures = pics
|
||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||
, _siHeight = length pics
|
||||
, _siIsSelectable = True
|
||||
, _siColor = col
|
||||
@@ -21,12 +22,29 @@ invSelectionItem cr i it =
|
||||
, _siPayload = ()
|
||||
}
|
||||
where
|
||||
anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
|
||||
anyequippos = maybe [] ((' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
|
||||
col = _itInvColor it
|
||||
pics = take (itSlotsTaken it) . (++ replicate 10 "*") $ case _itCurseStatus it of
|
||||
UndroppableIdentified -> itemDisplay it
|
||||
_ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it
|
||||
_ -> itemDisplay it
|
||||
|
||||
hotkeyToString :: Hotkey -> String
|
||||
hotkeyToString x = case x of
|
||||
HotkeyQ -> "[Q]"
|
||||
HotkeyE -> "[E]"
|
||||
Hotkey1 -> "[1]"
|
||||
Hotkey2 -> "[2]"
|
||||
Hotkey3 -> "[3]"
|
||||
Hotkey4 -> "[4]"
|
||||
Hotkey5 -> "[5]"
|
||||
Hotkey6 -> "[6]"
|
||||
Hotkey7 -> "[7]"
|
||||
Hotkey8 -> "[8]"
|
||||
Hotkey9 -> "[9]"
|
||||
Hotkey0 -> "[0]"
|
||||
|
||||
closeObjectToSelectionItem :: Either FloorItem Button -> SelectionItem ()
|
||||
closeObjectToSelectionItem e =
|
||||
SelectionItem
|
||||
|
||||
Reference in New Issue
Block a user