Scriptname zbfUtil Hidden

; Returns the zbf script which holds all global data. See GetMain() for more info.
zbfBondageShell Function GetBS() Global
	Return zbfUtil.GetMain()
EndFunction

; Returns the zbf script which holds all global data. See GetMain() for more info.
zbfBondageShell Function GetShell() Global
	Return zbfUtil.GetMain()
EndFunction

; Returns the zbf script which holds all global data.
;
; Example:
; zbfUtil.GetMain().RetainAi()
; Makes the player ai driven. Is reference counted, so several instances can request ai control without interfering with each other.
zbfBondageShell Function GetMain() Global
	zbfBondageShell zbf
	
	zbf = Game.GetFormFromFile(0x020137E6, "ZaZAnimationPack.esm") as zbfBondageShell
	If zbf == None
		zbf = Game.GetFormFromFile(0x020137E6, "ZaZAnimationPack.esp") as zbfBondageShell
	EndIf
	
	Return zbf
EndFunction

; Puts on an armor item on the actor. The item itself is duplicated onto the character, so it's not removed from it's original container.
; 
; akActor - Actor to wear the item
; akArmor - Armor to place on the actor. Duplicates the item, original is not removed from it's container.
; abForced - Prevents removal by the character.
;
; Example:
; zbfUtil.WearItem(PlayerRef, WristBindings, abForced = True)
; Forces the player to wear WristBindings, and they can't be removed through the normal inventory screen.
Function WearItem(Actor akActor, Armor akArmor, Bool abForced = False) Global
	akActor.AddItem(akArmor, aiCount = 1, abSilent = True)
	akActor.EquipItem(akArmor, abPreventRemoval = abForced, abSilent = True)
EndFunction

; Unequips an item on the actor. Opposite of WearItem. The item, or a similar item, is destroyed in the process.
;
; akActor - Actor to unequip the armor.
; akArmor - Armor type to unequip. The item is not placed in the characters actors inventory.
; 
; Example:
; zbfUtil.UnwearItem(PlayerRef, WristBindings)
; Frees the player from wrist bindings. The bindings are not retained in the inventory.
Function UnwearItem(Actor akActor, Armor akArmor) Global
	akActor.UnequipItem(akArmor, abSilent = True)
	akActor.RemoveItem(akArmor, aiCount = 1, abSilent = True)
EndFunction

; Returns the current version of Zaz Animation Pack.
;
; Returns the mod version number multiplied by 100.
; Version V004 would return 400. Small updates to 400 would return as 410, 420, etc.
Int Function GetVersion() Global
	Return GetMain().GetVersion()
EndFunction
