Scriptname SuH_Main_Player extends ReferenceAlias  

SuH_Main property _m auto
SuH_MCM property _c auto
SuH_Fun property _f auto
SuH_Status property _s auto

Event OnInit()
	_s = Game.GetFormFromFile(0x16E496, "Succubus Heart.esp") as SuH_Status
	_f = Game.GetFormFromFile(0x814, "Succubus Heart.esp") as SuH_Fun
	_m = Game.GetFormFromFile(0x801, "Succubus Heart.esp") as SuH_Main
	_c = Game.GetFormFromFile(0x802, "Succubus Heart.esp") as SuH_MCM
endEvent

Event OnPlayerLoadGame()
	_s = Game.GetFormFromFile(0x16E496, "Succubus Heart.esp") as SuH_Status
	_f = Game.GetFormFromFile(0x814, "Succubus Heart.esp") as SuH_Fun
	_m = Game.GetFormFromFile(0x801, "Succubus Heart.esp") as SuH_Main
	_c = Game.GetFormFromFile(0x802, "Succubus Heart.esp") as SuH_MCM
	_m.MODupdate()
	_c.MCMupdate()
endEvent

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	if akBaseObject.HasKeyword(_s.SuH_keyword)
		if akBaseObject.HasKeyword(_s.SuH_key_stat)
			if akBaseObject.HasKeyword(_s.SuH_key_incxpgain)
				_s.SuH_PCSxpgain += 1
				_s.SuH_PCSxpgainitem += 1
				_f.BDSMcalc("d", 5)
				Debug.Notification("Empowerment Stone - XP gain increased by 1%")
			elseif akBaseObject.HasKeyword(_s.SuH_key_milk)
				_f.MilkCalc()
			elseif akBaseObject.HasKeyword(_s.SuH_key_incdesire)
				_s.SuH_PCSdesire += 800
				debug.Notification("Soul of Desire - Granted 800 Desire")
			elseif akBaseObject.HasKeyword(_s.SuH_key_incxp)
				_f.XPcalc(XPearn=250, lvlS=2.0)
				debug.Notification("Soul of Experience - Bonus XP Granted")
			elseif akBaseObject.HasKeyword(_s.SuH_key_incforce)
				_s.SuH_PCSforce += 100
				debug.Notification("Soul of Force - Granted 100 Force")
			elseif akBaseObject.HasKeyword(_s.SuH_key_inccaphealth)
				_s.SuH_PCScaphealth += 2
				_s.SuH_PCScaphealthitem += 2
				_f.BDSMcalc("b", 2)
				debug.Notification("Soul of Life - Granted 2 Health Cap")
			elseif akBaseObject.HasKeyword(_s.SuH_key_inccapmagicka)
				_s.SuH_PCScapmagicka += 2
				_s.SuH_PCScapmagickaitem += 2
				_f.BDSMcalc("m", 2)
				debug.Notification("Soul of Magic - Granted 2 Magicka Cap")
			elseif akBaseObject.HasKeyword(_s.SuH_key_inccapstamina)
				_s.SuH_PCScapstamina += 2
				_s.SuH_PCScapstaminaitem += 2
				_f.BDSMcalc("s", 2)
				debug.Notification("Soul of Power - Granted 2 Stamina Cap")
			elseif akBaseObject.HasKeyword(_s.SuH_key_incsp)
				_s.SuH_PCSsp += 3
				Debug.Notification("Specialty Stone - Granted 3 Free SP")
			elseif akBaseObject.HasKeyword(_s.SuH_key_resetpassives)
				_f.PassiveReset(1)
				Debug.MessageBox("Refresh Stone - Passives Have Been Reset!")
			elseif akBaseObject.HasKeyword(_s.SuH_key_sperm)
				_f.SpermCalc()
				_s.SexLab.AddCum(_s.playerRef, false, true, false)
			elseif akBaseObject.HasKeyword(_s.SuH_key_inccapall)
				_s.SuH_PCScaphealth += 5
				_s.SuH_PCScapmagicka += 5
				_s.SuH_PCScapstamina += 5
				_s.SuH_PCScaphealthitem += 5
				_s.SuH_PCScapmagickaitem += 5
				_s.SuH_PCScapstaminaitem += 5
				_f.BDSMcalc("b", 5)
				_f.BDSMcalc("s", 5)
				_f.BDSMcalc("m", 5)
				Debug.Notification("Vitality Stone - All status caps increased by 5")
			endIf
		endIf
		if akBaseObject.HasKeyword(_s.SuH_key_pet)
			if akBaseObject == _s.SuH_ing_petdog
				actorbase soulactorbase = Game.GetFormFromFile(0x23A92, "Skyrim.esm") as ActorBase
				_f.SoulPetAdd(soulactorbase, false, _s.SuH_ing_petdog)
			elseif akBaseObject == _s.SuH_ing_petskeever
				actorbase soulactorbase = Game.GetFormFromFile(0x23AB7, "Skyrim.esm") as ActorBase
				_f.SoulPetAdd(soulactorbase, false, _s.SuH_ing_petskeever)
			elseif akBaseObject == _s.SuH_ing_petdraugr
				actorbase soulactorbase = Game.GetFormFromFile(0x5593B, "Skyrim.esm") as ActorBase
				_f.SoulPetAdd(soulactorbase, false, _s.SuH_ing_petdraugr)
			elseif akBaseObject == _s.SuH_ing_pethusky
				actorbase soulactorbase = Game.GetFormFromFile(0x18B34, "Dawnguard.esm") as ActorBase
				_f.SoulPetAdd(soulactorbase, false, _s.SuH_ing_pethusky)
			elseif akBaseObject == _s.SuH_ing_petriekling
				actorbase soulactorbase = Game.GetFormFromFile(0x17F47, "Dragonborn.esm") as ActorBase
				_f.SoulPetAdd(soulactorbase, false, _s.SuH_ing_petriekling)
			endIf
		endIf
	endIf
endEvent