Scriptname __LALLMiscBunkhouseProstScript extends Quest conditional

Actor Property PlayerRef Auto
ReferenceAlias Property CustomerAlias Auto
SexLabFramework Property sexLab Auto
String Property LastTag Auto Hidden

MiscObject Property Gold001 Auto

Int Property GoldPaid Auto Hidden Conditional
Int Property IsEnabled Auto Hidden Conditional

Function SetCustomer()
ObjectReference ThisCustomer = Game.GetCurrentCrosshairRef()
CustomerAlias.ForceRefTo(ThisCustomer)
EndFunction

Function HaveSex()
Actor Tgt = CustomerAlias.GetActorReference()
sexLab.QuickStart(PlayerRef,Tgt,none,none,none,none,"MyHook",getRandomTag())
RegisterForModEvent("AnimationEnding_MyHook","SexAnimEnded")
EndFunction

string function getRandomTag()
int random = utility.randomint(0,2)
if random == 0
return "vaginal"
LastTag = "vaginal"
elseif random == 1
return "oral"
LastTag = "Oral"
elseif random == 2
return "anal"
LastTag = "Anal"
endif
EndFunction

int Function FriendBonus()
if CustomerAlias.GetActorReference().GetRelationshipRank(PlayerRef) >= 1
return 40
else
return 0
endif
EndFunction

Function SetEnabled(int to)
IsEnabled = to
EndFunction

Function PayMe()
PlayerRef.AddItem(Gold001,GoldPaid/2)
debug.messagebox("Haelga paid you " + GoldPaid/2 + " gold for your work.")
GoldPaid = 0
IsEnabled = 0
EndFunction

Event SexAnimEnded(string eventname, string argstring, float argNum, form sender)
;Player just had sex with an npc in riften
Int Skill = sexlab.GetSkill(PlayerRef,LastTag)
Int Total = 70 + ((skill*3)/2) + FriendBonus()
GoldPaid = GoldPaid + Total
debug.notification("The client paid Haelga " + total + " gold for your services.")
CustomerAlias.TryToClear()
EndEvent