Add file
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
module Dodge.Inventory.Path (getInventoryPath) where
|
||||||
|
|
||||||
|
import Dodge.Data.Creature
|
||||||
|
import qualified Data.IntMap.Strict as IM
|
||||||
|
import Control.Lens
|
||||||
|
import Control.Monad
|
||||||
|
|
||||||
|
getInventoryPath :: Int -> InventoryPathing -> Int -> Creature -> Maybe Int
|
||||||
|
getInventoryPath x ip itid cr = case ip of
|
||||||
|
ABSOLUTE | x `IM.member` (cr ^. crInv) -> Just x
|
||||||
|
RELCURS -> do
|
||||||
|
selid <- cr ^? crManipulation . manObject . imSelectedItem
|
||||||
|
guard $ (x + selid) `IM.member` (cr ^. crInv)
|
||||||
|
return $ (x + selid)
|
||||||
|
RELITEM
|
||||||
|
| (itid + x) `IM.member` (cr ^. crInv) ->
|
||||||
|
return $ itid + x
|
||||||
|
_ -> Nothing
|
||||||
Reference in New Issue
Block a user