enderalse/source/scripts/PRKF__00E_LockpickingReqPerk_030039BA.psc

67 lines
2.2 KiB
Plaintext
Raw Normal View History

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname PRKF__00E_LockpickingReqPerk_030039BA Extends Perk Hidden
;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
if akTargetRef.IsActivationBlocked()
akTargetRef.Activate(akActor, false)
return
endif
Key refKey = akTargetRef.GetKey()
if refKey && akActor.GetItemCount(refKey) > 0
bool bLocked = akTargetRef.IsLocked()
akTargetRef.Activate(akActor, True)
if bLocked && akTargetRef.GetBaseObject() as Container
ContainerBonusControl.OnOpenContainer(akTargetRef)
endif
return
endif
Bool bPlayerCanActivate = False
Int iLockLevel = akTargetRef.GetLockLevel()
If iLockLevel <= LOCK_LEVEL_APPRENTICE
bPlayerCanActivate = True
ElseIf iLockLevel <= LOCK_LEVEL_ADEPT
2024-01-14 17:09:05 +00:00
bPlayerCanActivate = (akActor.GetActorValue("Lockpicking") >= 25 || akActor.HasPerk(_00E_Class_Trickster_P04_ThiefApprentice))
ElseIf iLockLevel <= LOCK_LEVEL_EXPERT
2024-01-14 17:09:05 +00:00
bPlayerCanActivate = (akActor.GetActorValue("Lockpicking") >= 50 || akActor.HasPerk(_00E_Class_Trickster_P06_ExpertLocksmith))
ElseIf iLockLevel <= LOCK_LEVEL_MASTER
2024-01-14 17:09:05 +00:00
bPlayerCanActivate = (akActor.GetActorValue("Lockpicking") >= 75 || akActor.HasPerk(_00E_Class_Trickster_P09_MasterThief))
Else
bPlayerCanActivate = True
EndIf
if ! bPlayerCanActivate
_00E_Game_UnlockNeedsSkill.Show()
return
endif
akTargetRef.Activate(akActor, True)
if akTargetRef.GetBaseObject() as Container
ContainerBonusControl.OnOpenContainer(akTargetRef)
endif
;END CODE
EndFunction
;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
Int Property LOCK_LEVEL_NOVICE = 1 AutoReadOnly
Int Property LOCK_LEVEL_APPRENTICE = 25 AutoReadOnly
Int Property LOCK_LEVEL_ADEPT = 50 AutoReadOnly
Int Property LOCK_LEVEL_EXPERT = 75 AutoReadOnly
Int Property LOCK_LEVEL_MASTER = 254 AutoReadOnly
Perk Property _00E_Class_Trickster_P04_ThiefApprentice Auto
Perk Property _00E_Class_Trickster_P06_ExpertLocksmith Auto
Perk Property _00E_Class_Trickster_P09_MasterThief Auto
Message Property _00E_Game_UnlockNeedsSkill Auto
_00E_ContainerBonusControl Property ContainerBonusControl Auto