enderalse/source/scripts/_00E_BlueprintCollectionItem.psc

86 lines
2.6 KiB
Plaintext
Raw Normal View History

Scriptname _00E_BlueprintCollectionItem extends ObjectReference Hidden
Event OnEquipped(Actor akActor)
If akActor != PlayerREF || ! (GetBaseObject() as MiscObject)
return
endif
bInventoryMenu = SKSE.GetVersion() > 0 && UI.IsMenuOpen("InventoryMenu")
_00E_FS_BlueprintContainerActorREF.SetPlayerTeammate(True, True)
Int iButton = _00E_FS_Blueprint_Message_SE.Show()
If iButton == 0
AddBlueprints()
ElseIf iButton == 1
StoreSingleCopy()
ElseIf iButton == 2
TakeBlueprints()
EndIf
EndEvent
Function AddBlueprints()
if bInventoryMenu
; The DisablePlayerControls method does not remember last inventory tab to return where we were
Input.TapKey(Input.GetMappedKey("Tween Menu"))
endif
Game.DisablePlayerControls(abMenu = true)
Game.EnablePlayerControls(abMenu = true)
Utility.Wait(0.05)
_00E_FS_BlueprintContainerActorREF.ShowGiftMenu(True, _00E_FS_BlueprintList, True, False)
if bInventoryMenu
Utility.wait(0.2)
Input.TapKey(Input.GetMappedKey("Quick Inventory"))
endif
EndFunction
function StoreSingleCopy()
;/ Too slow
int iItemsToStore = PlayerREF.GetItemCount(Blueprint) - _00E_FS_BlueprintContainerActorREF.GetItemCount(Blueprint)
bool bStoreSilently = iItemsToStore > 3
Int iFormIndex = PlayerREF.GetNumItems()
While iFormIndex > 0
iFormIndex -= 1
Form kForm = PlayerREF.GetNthForm(iFormIndex)
If kForm as MiscObject && kForm.HasKeyword(Blueprint) && _00E_FS_BlueprintContainerActorREF.GetItemCount(kForm) == 0
PlayerREF.RemoveItem(kForm, 1, bStoreSilently, _00E_FS_BlueprintContainerActorREF)
EndIf
EndWhile
if bStoreSilently
_00E_FS_BlueprintItemsStored.Show(iItemsToStore)
endif
/;
ITMBookClose.Play(PlayerREF)
_00E_FS_BlueprintItemsStored.Show(EnderalFunctions.MoveItemsToCountByKeyword(PlayerREF, _00E_FS_BlueprintContainerActorREF, Blueprint, 1))
endfunction
Function TakeBlueprints()
if bInventoryMenu
; The DisablePlayerControls method does not remember last inventory tab to return where we were
Input.TapKey(Input.GetMappedKey("Tween Menu"))
endif
Game.DisablePlayerControls(abMenu = true)
Game.EnablePlayerControls(abMenu = true)
Utility.Wait(0.05)
_00E_FS_BlueprintContainerActorREF.ShowGiftMenu(False, _00E_FS_BlueprintList, True, False)
if bInventoryMenu
Utility.wait(0.2)
Input.TapKey(Input.GetMappedKey("Quick Inventory"))
endif
EndFunction
bool bInventoryMenu
Actor Property PlayerRef Auto
Actor Property _00E_FS_BlueprintContainerActorREF Auto
Message Property _00E_FS_Blueprint_Message_SE Auto
Message Property _00E_FS_BlueprintItemsStored Auto
FormList Property _00E_FS_BlueprintList Auto
Keyword Property Blueprint Auto
Sound Property ITMBookClose Auto