Scriptname __FeriaKidnapQuestScript extends Quest  conditional

Faction Property KidsTownFaction Auto
Actor Property Braith Auto
Actor Property Mila Auto
Actor Property Lucia Auto
Actor Property Lars Auto
Quest Property ThisQuest Auto
Int Property SofieFriendship Auto conditional hidden
SexLabFramework Property SexLab Auto
Actor Property PlayerRef Auto
Actor Property Bjorlam Auto
ObjectReference Property WindhelmObject Auto
ObjectReference Property PlayerWarehouseTeleport Auto
Faction Property BanditSceneFaction Auto
ObjectReference Property WarehouseEnterPort Auto
ObjectReference Property WarehouseEnterPort2 Auto
DialogueFollowerScript Property FollowerQuest Auto
Int Property BjorlamSeduced Auto Hidden Conditional
MiscObject Property Gold001 Auto
GlobalVariable Property BjorlamSexed Auto
Cell Property WarehouseCell Auto
ObjectReference Property FeriaWarpMarker Auto
Spell Property SeductionPerk Auto
Spell Property ViolencePerk Auto
__LALLActorQuestScript Property SexThread Auto


;Feria stuff
Actor Property Feria Auto
Outfit Property FeriaPrisonerOutfit Auto
GlobalVariable Property FeriaSpecialScenario Auto
ObjectReference Property FeriaMoveTo Auto
Outfit Property FeriaDefaultOutfit Auto

;Zaz
zbfBondageShell Property Zaz Auto
ObjectReference Property FeriaFurniture Auto
zbfSlot Property zSlot Auto Hidden

;Follower Factions
Faction Property CurrentFollowerFaction Auto
Faction Property PotentialFollowerFaction Auto

;Warehouse bandits
Actor Property Bandit1 Auto Hidden
Actor Property Bandit2 Auto Hidden
Actor Property Bandit3 Auto
Actor Property Bandit4 Auto
Int Property BanditsKilled Auto Conditional

Function SetFeriaDefaultOutfit()
Feria.SetOutfit(FeriaDefaultOutfit)
EndFunction

Message[] Property M Auto

Function GivePerkReward()
if BanditsKilled >= 1
PlayerRef.AddSpell(ViolencePerk)
M[0].Show()
;debug.messagebox("Your excitability has tempered your body and has granted you 5% increased weapon damage.")
else
PlayerRef.AddSpell(SeductionPerk)
M[1].Show()
;debug.messagebox("Your childish charm has granted you better ways to negotiate with people - prices will be 5% better at vendors.")
endif
EndFunction

;In case shes somewhere else
bool Function CheckFeriaLocation()
cell CurrentCell = Feria.GetParentCell()
if (CurrentCell == none) || (Currentcell != WarehouseCell)
Feria.MoveTo(FeriaWarpMarker)
return true
else
return false
endif
EndFunction


Function SetFeriaBondage(bool tf)
if tf == true
bool DoIWait = CheckFeriaLocation()
if DoIWait == true
Utility.Wait(3.0)
endif
Zaz.SlotActor(Feria)
zSlot = zaz.FindSlot(Feria)
zSlot.SetFurniture(FeriaFurniture)
zSlot.PinActor()
elseif tf == false
zSlot = zaz.FindSlot(Feria)
zSlot.SetFurniture(none)
zSlot.UnpinActor()
endif
EndFunction


;Bandit scene stuff
ObjectReference Property BanditSpawn1 Auto
ObjectReference Property BanditSpawn2 Auto
GlobalVariable Property YuriYaoiGLB Auto
ActorBase Property MaleBandit Auto
ActorBase Property FemBandit Auto
ReferenceAlias Property BanditActor1 Auto
ReferenceAlias Property BanditActor2 Auto
ReferenceAlias Property BanditThisQ1 Auto
ReferenceAlias Property BanditThisQ2 Auto



Function KillBandit()
BanditsKilled += 1
if BanditsKilled >= 4
ThisQuest.SetStage(45)
BanditsKilled = 1
endif
EndFunction

Function GetBandits()
Bandit1 = BanditThisQ1.GetActorRef()
Bandit2 = BanditThisQ2.GetActorRef()
EndFunction

Function CreateBandits()
float mode = YuriYaoiGLB.GetValue()
if mode == 0
BanditThisQ1.ForceRefTo(BanditSpawn1.PlaceAtMe(MaleBandit))
BanditThisQ2.ForceRefTo(BanditSpawn2.PlaceAtMe(FemBandit))
elseif mode == 1
BanditThisQ1.ForceRefTo(BanditSpawn1.PlaceAtMe(FemBandit))
BanditThisQ2.ForceRefTo(BanditSpawn2.PlaceAtMe(FemBandit))
elseif mode == 2
BanditThisQ1.ForceRefTo(BanditSpawn1.PlaceAtMe(MaleBandit))
BanditThisQ2.ForceRefTo(BanditSpawn2.PlaceAtMe(MaleBandit))
else
BanditThisQ1.ForceRefTo(BanditSpawn1.PlaceAtMe(MaleBandit))
BanditThisQ2.ForceRefTo(BanditSpawn2.PlaceAtMe(FemBandit))
endif
EndFunction



Function AddFeriaToFollow()
Feria.AddToFaction(CurrentFollowerFaction)
Feria.AddToFaction(PotentialFollowerFaction)
Feria.SetFactionRank(PotentialFollowerFaction,0)
Feria.SetFactionRank(CurrentFollowerFaction,0)
FollowerQuest.SetFollower(Feria)
FollowerQuest.FollowerFollow()
EndFunction


Function CarriageToWindhelm()
PlayerRef.MoveTo(WindhelmObject)
Utility.Wait(2.0)
M[2].Show()
;debug.messagebox("Bjorlam drove away with a smile on his face. He also left you with an additional 50 septims for your service.")
PlayerRef.AddItem(Gold001,50)
BjorlamSexed.SetValue(1.0)
;But I'm already in windhelm though
Utility.Wait(2.0)
ThisQuest.SetStage(20)
UnregisterForUpdate()
EndFunction

Function LeaveWarehouse()
PlayerRef.MoveTo(WarehouseEnterPort)
Feria.MoveTo(WarehouseEnterPort2)
EndFunction



Function SetSofieFriendship(Int to)
; 1 is friends, -1 is enemies, 0 is undecided
SofieFriendship = to
EndFunction

Function SexWithBandits()
GetBandits()
;SexLab.QuickStart(PlayerRef,Bandit2,Bandit1,none,none,none,"MyHook","threesome")
;RegisterForModEvent("AnimationEnding_MyHook","SexAnimEnded")
actor[] banditA = new actor[3]
BanditA[0] = PlayerRef
banditA[1] = Bandit1
banditA[2] = Bandit2
SexThread.TrackedThreadQuestArray(banditA,ThisQuest,40,"threesome")
EndFunction

Function CombatWithBandits()
GetBandits()
Bandit1.StartCombat(PlayerRef)
Bandit2.StartCombat(PlayerRef)
Bandit3.StartCombat(PlayerRef)
Bandit4.StartCombat(PlayerRef)
if ThisQuest.GetStage() < 35
ThisQuest.SetStage(35)
endif
EndFunction


Function SetUpFeria()
FeriaSpecialScenario.SetValue(1)
Feria.RemoveAllItems()
Feria.Setoutfit(FeriaPrisonerOutfit)
Feria.MoveTo(FeriaMoveTo)
Feria.AllowPCDialogue(false)
;To make sure quest works, also do this
Bandit1.AddToFaction(BanditSceneFaction)
Bandit2.AddToFaction(BanditSceneFaction)
EndFunction

Function WarehouseMove()
PlayerRef.MoveTo(PlayerWarehouseTeleport)
;Just in case alias fails to do so
Bandit1.AddToFaction(BanditSceneFaction)
Bandit2.AddToFaction(BanditSceneFaction)
EndFunction

Function RestoreControls()
Game.EnablePlayerControls(true,true,true,true,true,true,true,true)
EndFunction

Function Stage0Thoughts()
M[3].Show()
;debug.messagebox("I'm not sure where Feria would go. Maybe I can ask the kids in whiterun if they've seen her?")
ThisQuest.SetStage(10)
EndFunction

Function AddKidsToFaction()
Braith.AddToFaction(KidsTownFaction)
Lars.AddToFaction(KidsTownFaction)
EndFunction


Function FeriaSwordMessage()
M[4].Show()
M[5].Show()
M[6].Show()
;debug.messagebox("Feria's sword! She wouldn't just leave it behind here... something's wrong.")
;debug.messagebox("Hmm... I remember her sword had a hidden compartment for hiding things. Maybe she left something inside of it?")
;debug.messagebox("... Yes! There was a small letter inside! Now I should read it...")
EndFunction

Function Stage15Thoughts()
M[7].Show()
M[8].Show()
M[9].Show()
M[10].Show()
;debug.messagebox("Oh no! Bandits have her? My only lead is the clue she left in her note.")
;debug.messagebox("I don't think mom and dad will be able to do anything. Maybe I can? I've fought plenty of wolves and skeevers before!")
;debug.messagebox("I had better make the trek to windhelm. It's a bit far from here - I should prepare for the journey and then set out.")
;debug.messagebox("I can walk there or perhaps take the carriage if I have the coin.")
EndFunction

Function Stage20Thoughts()
M[11].Show()
M[12].Show()
M[13].Show()


;debug.messagebox("Whew... it was quite a journey, but I've arrived in windhelm.")
;debug.messagebox("I haven't much time to waste - I need to start asking around town if anyone's seen Feria.")
;debug.messagebox("Maybe one of the townsfolk knows, or one of the guards.")
EndFunction

Function LuciaRejectMessage()
M[14].Show()
M[15].Show()

;debug.messagebox("I don't think she'll be willing to tell me anything. Something definitely did happen here in town, though.")
;debug.messagebox("Maybe Feria left something behind that could tell me? I should look all around town for anything I can find.")
EndFunction

Function InitBjorlamSex(string asTag)
SexLab.QuickStart(PlayerRef,Bjorlam,none,none,none,PlayerRef,none,asTag)
BjorlamSeduced = 1
EndFunction


;Fires to see if you're in or near windhelm
Event OnUpdate()
if PlayerRef.GetDistance(WindhelmObject) <= 30000
ThisQuest.SetStage(20)
UnregisterForUpdate()
endif
EndEvent


;Should fire after sex scenes
;Event SexAnimEnded(string eventName, string argString, float argNum, form sender)
;ThisQuest.SetStage(40)
;UnregisterForModEvent("SexAnimEnded")
;EndEvent

