Only display combinations for first items in list
This commit is contained in:
+66
-8
@@ -42,13 +42,7 @@ rmInvItem ::
|
||||
Int ->
|
||||
World ->
|
||||
World
|
||||
rmInvItem cid invid w = case w ^? getcid . crInv . ix invid . itUse . useAmount of
|
||||
Just x
|
||||
| x > 1 ->
|
||||
w & pointcid . crInv . ix invid . itUse . useAmount -~ 1
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
_ ->
|
||||
w
|
||||
rmInvItem cid invid w = w
|
||||
-- & pointcid %~ crCancelReloading
|
||||
& doanyitemeffect
|
||||
& dounequipfunction --the ordering of these is
|
||||
@@ -67,7 +61,6 @@ rmInvItem cid invid w = case w ^? getcid . crInv . ix invid . itUse . useAmount
|
||||
& updateselection
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
where
|
||||
getcid = cWorld . lWorld . creatures . ix cid
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
|
||||
updateselection
|
||||
@@ -99,6 +92,71 @@ rmInvItem cid invid w = case w ^? getcid . crInv . ix invid . itUse . useAmount
|
||||
| x > invid || Just x == maxk = max 0 $ x - 1
|
||||
| otherwise = x
|
||||
|
||||
---- | after this the item at the inventory position will no longer exist
|
||||
--rmInvItem ::
|
||||
-- -- | Creature id
|
||||
-- Int ->
|
||||
-- -- | Inventory position
|
||||
-- Int ->
|
||||
-- World ->
|
||||
-- World
|
||||
--rmInvItem cid invid w = case w ^? getcid . crInv . ix invid . itUse . useAmount of
|
||||
-- Just x
|
||||
-- | x > 1 ->
|
||||
-- w & pointcid . crInv . ix invid . itUse . useAmount -~ 1
|
||||
-- & worldEventFlags . at InventoryChange ?~ ()
|
||||
-- _ ->
|
||||
-- w
|
||||
---- & pointcid %~ crCancelReloading
|
||||
-- & doanyitemeffect
|
||||
-- & dounequipfunction --the ordering of these is
|
||||
-- & pointcid . crInv %~ f -- important
|
||||
--
|
||||
-- & removeAnySlotEquipment
|
||||
-- & pointcid . crEquipment . each %~ g
|
||||
-- & pointcid . crInvEquipped %~ IM.delete invid
|
||||
-- & pointcid . crInvEquipped %~ IM.mapKeys g
|
||||
--
|
||||
-- & removeanyactivation
|
||||
-- & pointcid . crHotkeys . each %~ g
|
||||
-- & pointcid . crInvHotkeys %~ IM.delete invid
|
||||
-- & pointcid . crInvHotkeys %~ IM.mapKeys g
|
||||
--
|
||||
-- & updateselection
|
||||
-- & worldEventFlags . at InventoryChange ?~ ()
|
||||
-- where
|
||||
-- getcid = cWorld . lWorld . creatures . ix cid
|
||||
-- pointcid = cWorld . lWorld . creatures . ix cid
|
||||
--
|
||||
-- updateselection
|
||||
-- | cid == 0 && cr ^? crManipulation . manObject . inInventory . ispItem == Just invid =
|
||||
-- scrollAugInvSel (-1) . scrollAugInvSel 1 . updateInventorySectionItems
|
||||
-- | otherwise =
|
||||
-- pointcid . crManipulation . manObject . inInventory . ispItem %~ g
|
||||
--
|
||||
-- cr = w ^?! cWorld . lWorld . creatures . ix cid
|
||||
-- itm = _crInv cr IM.! invid
|
||||
-- dounequipfunction = fromMaybe id $ do
|
||||
-- rmf <- itm ^? itUse . equipEffect . eeOnRemove
|
||||
-- return $ useE rmf itm cr
|
||||
-- doanyitemeffect = fromMaybe id $ do
|
||||
-- rmf <- itm ^? itEffect . ieOnDrop
|
||||
-- return $ doInvEffect rmf itm cr
|
||||
-- removeAnySlotEquipment = fromMaybe id $ do
|
||||
-- epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid
|
||||
-- return $ pointcid . crEquipment . at epos .~ Nothing
|
||||
-- removeanyactivation = fromMaybe id $ do
|
||||
-- epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvHotkeys . ix invid
|
||||
-- return $ pointcid . crHotkeys . at epos .~ Nothing
|
||||
-- maxk = fmap fst $ IM.lookupMax $ cr ^. crInv
|
||||
-- f inv =
|
||||
-- let (xs, ys) = IM.split invid inv
|
||||
-- in xs `IM.union` IM.mapKeysMonotonic (subtract 1) ys
|
||||
-- -- the following might not work if a non-player creature drops their last item
|
||||
-- g x
|
||||
-- | x > invid || Just x == maxk = max 0 $ x - 1
|
||||
-- | otherwise = x
|
||||
|
||||
rmSelectedInvItem :: Int -> World -> World
|
||||
rmSelectedInvItem cid w = case w ^? cWorld . lWorld . creatures . ix cid . crManipulation . manObject . inInventory . ispItem of
|
||||
Just i -> rmInvItem cid i w
|
||||
|
||||
Reference in New Issue
Block a user