Remove internal ammo
This commit is contained in:
+44
-31
@@ -81,7 +81,13 @@ itemBaseName it = case _iyBase $ _itType it of
|
||||
LEFT lit -> show lit
|
||||
EQUIP eit -> showEquipItem eit
|
||||
CONSUMABLE cit -> show cit
|
||||
ATTACH ait -> show ait
|
||||
ATTACH ait -> showAttachItem ait
|
||||
|
||||
showAttachItem :: AttachType -> String
|
||||
showAttachItem at = case at of
|
||||
SCROLLATTACH x -> show x
|
||||
AMMOATTACH x -> show x
|
||||
TARGETATTACH x -> show x
|
||||
|
||||
showEquipItem :: EquipItemType -> String
|
||||
showEquipItem eit = case eit of
|
||||
@@ -111,60 +117,67 @@ showAutoRechargeProgress lc = case lc of
|
||||
|
||||
itemNumberDisplay :: Creature -> Item -> [String]
|
||||
itemNumberDisplay cr itm = case iu of
|
||||
HeldUse{} -> [showReloadProgress cr itm]
|
||||
--HeldUse{} -> [showReloadProgress cr itm]
|
||||
HeldUse{} -> []
|
||||
LeftUse{} -> [showAutoRechargeProgress (_leftConsumption iu)]
|
||||
EquipUse{} -> showEquipmentNumber cr itm
|
||||
CraftUse x -> [show $ x ^. getItAmount]
|
||||
ConsumeUse {_useAmount = x} -> [show $ x ^. getItAmount]
|
||||
AttachUse {} -> []
|
||||
|
||||
AttachUse {} -> [showReloadProgress cr itm]
|
||||
-- this could be cleaner here...
|
||||
where
|
||||
iu = itm ^?! itUse
|
||||
|
||||
showEquipmentNumber :: Creature -> Item -> [String]
|
||||
showEquipmentNumber cr itm = case _eeUse ee of
|
||||
EFuelSource x _ -> [show x]
|
||||
EAmmoSource{} -> showAmmoSource cr itm
|
||||
EAmmoSource{_euseAmmoAmount = x} -> [show x]--showAmmoSource cr itm
|
||||
EBatterySource{_euseBatteryAmount = x} -> [show x]
|
||||
_ -> [""]
|
||||
where
|
||||
ee = itm ^?! itUse . equipEffect
|
||||
|
||||
showAmmoSource :: Creature -> Item -> [String]
|
||||
showAmmoSource cr itm = fromMaybe ["FAIL"] $ do
|
||||
eu <- itm ^? itUse . equipEffect . eeUse
|
||||
atype <- eu ^? euseAmmoSourceType
|
||||
x <- fmap showIntKMG' $ eu ^? euseAmmoAmount
|
||||
i <- itm ^? itLocation . ipInvID
|
||||
( do
|
||||
at' <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSourceType
|
||||
as <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSource
|
||||
guard (at' == atype && as == AboveSource)
|
||||
return ["vvvv", x]
|
||||
)
|
||||
<|> Just [x]
|
||||
--showAmmoSource :: Creature -> Item -> [String]
|
||||
--showAmmoSource cr itm = fromMaybe ["FAIL"] $ do
|
||||
-- eu <- itm ^? itUse . equipEffect . eeUse
|
||||
-- atype <- eu ^? euseAmmoSourceType
|
||||
-- x <- fmap showIntKMG' $ eu ^? euseAmmoAmount
|
||||
-- i <- itm ^? itLocation . ipInvID
|
||||
-- ( do
|
||||
-- at' <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSourceType
|
||||
-- as <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSource
|
||||
-- guard (at' == atype && as == AboveSource)
|
||||
-- return ["vvvv", x]
|
||||
-- )
|
||||
-- <|> Just [x]
|
||||
|
||||
showReloadProgress :: Creature -> Item -> String
|
||||
showReloadProgress cr itm = case ic ^? laSource of
|
||||
Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
|
||||
Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
|
||||
Just la -> showLoadActionType la (_laSource ic)
|
||||
Just AboveSource -> fromMaybe "^^^^" $ do
|
||||
i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||
_ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return ""
|
||||
_ -> ""
|
||||
where
|
||||
ic = itm ^?! itUse . heldConsumption
|
||||
showReloadProgress cr itm = fromMaybe [] $ do
|
||||
ia <- itm ^? itUse . attachParams . ammoAttachParams
|
||||
return $ case ia ^? iaProgress . _Just . ix 0 of
|
||||
Nothing -> maybe "" show $ ia ^? iaLoaded
|
||||
Just la -> showLoadActionType la ia
|
||||
--showReloadProgress :: Creature -> Item -> String
|
||||
--showReloadProgress cr itm = case ic ^? laSource of
|
||||
-- Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
|
||||
-- Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
|
||||
-- Just la -> showLoadActionType la (_laSource ic)
|
||||
-- Just AboveSource -> fromMaybe "^^^^" $ do
|
||||
-- i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||
-- _ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
-- return ""
|
||||
-- _ -> ""
|
||||
-- where
|
||||
-- ic = itm ^?! itUse . heldConsumption
|
||||
|
||||
showLoadActionType :: LoadAction -> AmmoSource -> String
|
||||
showLoadActionType :: LoadAction -> InternalAmmo -> String
|
||||
showLoadActionType la as = case la of
|
||||
LoadEject{} -> "E"
|
||||
LoadInsert{} -> "L"
|
||||
LoadAdd{} -> "A" ++ x
|
||||
LoadPrime{} -> "P"
|
||||
where
|
||||
x = maybe "" show $ as ^? _InternalSource . iaLoaded
|
||||
x = maybe "" show $ as ^? iaLoaded
|
||||
|
||||
maybeWarmupStatus :: Item -> Maybe String
|
||||
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
|
||||
|
||||
Reference in New Issue
Block a user