Scriptname nAddonQuestScript extends SKI_ConfigBase  

; OIDs
bool miscVal = true
int misc_B

int chpOID_S 
int cmpOID_S 
int cspOID_S 
int carOID_S 
int cwpnOID_S 
int cmagOID_S 
int cresOID_S 

int hhpOID_S 
int hmpOID_S 
int hspOID_S 
int harOID_S 
int hwpnOID_S 
int hmagOID_S 
int hresOID_S

int uhpOID_S 
int umpOID_S 
int uspOID_S 
int uarOID_S 
int uwpnOID_S 
int umagOID_S 
int uresOID_S

int whpOID_S 
int wmpOID_S 
int wspOID_S 
int warOID_S 
int wwpnOID_S 
int wmagOID_S 
int wresOID_S

float def_chp=0.0
float def_cmp=0.0
float def_csp=0.0
float def_car=0.0
float def_cwpn=0.0
float def_cmag=0.0
float def_cres=0.0

float def_hhp=0.0
float def_hmp=0.0
float def_hsp=0.0
float def_har=0.0
float def_hwpn=0.0
float def_hmag=0.0
float def_hres=0.0

float def_uhp=0.0
float def_ump=0.0
float def_usp=0.0
float def_uar=0.0
float def_uwpn=0.0
float def_umag=0.0
float def_ures=0.0

float def_whp=0.0
float def_wmp=0.0
float def_wsp=0.0
float def_war=0.0
float def_wwpn=0.0
float def_wmag=0.0
float def_wres=0.0

int function GetVersion()
	return 3
endFunction

event OnConfigInit()

	Pages = new string[5]
	Pages[0] = "$Creatures"
	Pages[1] = "$Humanoids"
	Pages[2] = "$Undead"
	Pages[3] = "$Wildlife"
	Pages[4] = "$Misc"

endEvent

event OnVersionUpdate(int a_version)
	{Called when a version update of this script has been detected}

	; Version 2 specific updating code
if (a_version >= 2 && CurrentVersion < 2)
	Debug.Trace(self + ": Updating script to version 2")

	Pages[0] = "$Creatures"
	Pages[1] = "$Humanoids"
	Pages[2] = "$Undead"
	Pages[3] = "$Wildlife"
	Pages[4] = "$Misc"
endif

if (a_version >= 3 && CurrentVersion < 3)
	Debug.Trace(self + ": Updating script to version 3")

	Pages[0] = "$Creatures"
	Pages[1] = "$Humanoids"
	Pages[2] = "$Undead"
	Pages[3] = "$Wildlife"
	Pages[4] = "$Misc"
endif

endEvent

event OnPageReset(string a_page)
	{Called when a new page is selected, including the initial empty page}

	; Load custom logo in DDS format
	if (a_page == "")
		; Image size 256x256
		; X offset = 376 - (height / 2) = 258
		; Y offset = 223 - (width / 2) = 95
		LoadCustomContent("deadlydragons/ddlogo.dds", 165, -20)
		return
	else
		UnloadCustomContent()
	endIf

	if (a_page == "$Creatures")

		SetCursorFillMode(TOP_TO_BOTTOM)
		SetTitleText("$Creatures")
		;AddHeaderOption("$Toggle Options")
		chpOID_S = AddSliderOption("$Health", def_chp, "+{0}%")
		cmpOID_S = AddSliderOption("$Magicka", def_cmp, "+{0}%")
		cspOID_S = AddSliderOption("$Stamina", def_csp, "+{0}%")
		carOID_S = AddSliderOption("$Armor rating", def_car, "+{0}")
		cwpnOID_S = AddSliderOption("$Melee damage", def_cwpn, "+{0}%")
		cmagOID_S = AddSliderOption("$Magic damage", def_cmag, "+{0}%")
		cresOID_S = AddSliderOption("$Resistance", def_cres, "+{0}%")

	elseIf (a_page == "$Humanoids")

		SetCursorFillMode(TOP_TO_BOTTOM)
		SetTitleText("$Humanoids")
		;AddHeaderOption("$Toggle Options")
		hhpOID_S = AddSliderOption("$Health", def_hhp, "+{0}%")
		hmpOID_S = AddSliderOption("$Magicka", def_hmp, "+{0}%")
		hspOID_S = AddSliderOption("$Stamina", def_hsp, "+{0}%")
		harOID_S = AddSliderOption("$Armor rating", def_har, "+{0}")
		hwpnOID_S = AddSliderOption("$Melee damage", def_hwpn, "+{0}%")
		hmagOID_S = AddSliderOption("$Magic damage", def_hmag, "+{0}%")
		hresOID_S = AddSliderOption("$Resistance", def_hres, "+{0}%")

	elseIf (a_page == "$Undead")
	
		SetCursorFillMode(TOP_TO_BOTTOM)
		SetTitleText("$Undead")
		;AddHeaderOption("$Toggle Options")
		uhpOID_S = AddSliderOption("$Health", def_uhp, "+{0}%")
		umpOID_S = AddSliderOption("$Magicka", def_ump, "+{0}%")
		uspOID_S = AddSliderOption("$Stamina", def_usp, "+{0}%")
		uarOID_S = AddSliderOption("$Armor rating", def_uar, "+{0}")
		uwpnOID_S = AddSliderOption("$Melee damage", def_uwpn, "+{0}%")
		umagOID_S = AddSliderOption("$Magic damage", def_umag, "+{0}%")
		uresOID_S = AddSliderOption("$Resistance", def_ures, "+{0}%")

	elseIf (a_page == "$Wildlife")

		SetCursorFillMode(TOP_TO_BOTTOM)
		SetTitleText("$Wildlife")
		;AddHeaderOption("$Toggle Options")
		whpOID_S = AddSliderOption("$Health", def_whp, "+{0}%")
		wmpOID_S = AddSliderOption("$Magicka", def_wmp, "+{0}%")
		wspOID_S = AddSliderOption("$Stamina", def_wsp, "+{0}%")
		warOID_S = AddSliderOption("$Armor rating", def_war, "+{0}")
		wwpnOID_S = AddSliderOption("$Melee damage", def_wwpn, "+{0}%")
		wmagOID_S = AddSliderOption("$Magic damage", def_wmag, "+{0}%")
		wresOID_S = AddSliderOption("$Resistance", def_wres, "+{0}%")

	elseIf (a_page == "$Misc")

		SetCursorFillMode(TOP_TO_BOTTOM)
		SetTitleText("$Misc")
		misc_B = AddToggleOption("$Enable mod", miscVal)
	endIf
endEvent

event OnOptionSelect(int option)
	if (option == misc_B)
		miscVal = !miscVal
		SetToggleOptionValue(misc_B, miscVal)
		If miscVal
			Game.GetPlayer().addspell(PlayerAb, false)
		Else
			If nUpdateQuest.IsRunning()
				nUpdateQuest.stop()
			Endif
			Game.GetPlayer().removespell(PlayerAb)
		Endif
	endif
Endevent

event OnOptionSliderOpen(int option)
	if (option == chpOID_S)
		SetSliderDialogStartValue(def_chp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == cmpOID_S)
		SetSliderDialogStartValue(def_cmp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == cspOID_S)
		SetSliderDialogStartValue(def_csp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == carOID_S)
		SetSliderDialogStartValue(def_car)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1850.0)
		SetSliderDialogInterval(1.0)
	elseif (option == cwpnOID_S)
		SetSliderDialogStartValue(def_cwpn)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == cmagOID_S)
		SetSliderDialogStartValue(def_cmag)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == cresOID_S)
		SetSliderDialogStartValue(def_cres)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 95.0)
		SetSliderDialogInterval(1.0)
	elseif (option == hhpOID_S)
		SetSliderDialogStartValue(def_hhp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == hmpOID_S)
		SetSliderDialogStartValue(def_hmp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == hspOID_S)
		SetSliderDialogStartValue(def_hsp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == harOID_S)
		SetSliderDialogStartValue(def_har)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1850.0)
		SetSliderDialogInterval(1.0)
	elseif (option == hwpnOID_S)
		SetSliderDialogStartValue(def_hwpn)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == hmagOID_S)
		SetSliderDialogStartValue(def_hmag)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == hresOID_S)
		SetSliderDialogStartValue(def_hres)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 95.0)
		SetSliderDialogInterval(1.0)
	elseif (option == UhpOID_S)
		SetSliderDialogStartValue(def_Uhp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == UmpOID_S)
		SetSliderDialogStartValue(def_Ump)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == uspOID_S)
		SetSliderDialogStartValue(def_usp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == uarOID_S)
		SetSliderDialogStartValue(def_uar)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1850.0)
		SetSliderDialogInterval(1.0)
	elseif (option == uwpnOID_S)
		SetSliderDialogStartValue(def_uwpn)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == umagOID_S)
		SetSliderDialogStartValue(def_umag)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == uresOID_S)
		SetSliderDialogStartValue(def_ures)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 95.0)
		SetSliderDialogInterval(1.0)
	elseif (option == whpOID_S)
		SetSliderDialogStartValue(def_whp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == wmpOID_S)
		SetSliderDialogStartValue(def_wmp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == wspOID_S)
		SetSliderDialogStartValue(def_wsp)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == warOID_S)
		SetSliderDialogStartValue(def_war)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1850.0)
		SetSliderDialogInterval(1.0)
	elseif (option == wwpnOID_S)
		SetSliderDialogStartValue(def_wwpn)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == wmagOID_S)
		SetSliderDialogStartValue(def_wmag)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 1500.0)
		SetSliderDialogInterval(1.0)
	elseif (option == wresOID_S)
		SetSliderDialogStartValue(def_wres)
		SetSliderDialogDefaultValue(0.0)
		SetSliderDialogRange(0.0, 95.0)
		SetSliderDialogInterval(1.0)
	endIf
endEvent

event OnOptionSliderAccept(int option, float value)
	if (option == chpOID_S)
		def_chp = value
		SetSliderOptionValue(chpOID_S, def_chp, "+{0}%")
		dmCHP.Value = value
	elseif (option == cmpOID_S)
		def_cmp = value
		SetSliderOptionValue(cmpOID_S, def_cmp, "+{0}%")
		dmCMP.Value = value
	elseif (option == cspOID_S)
		def_csp = value
		SetSliderOptionValue(cspOID_S, def_csp, "+{0}%")
		dmCSP.Value = value
	elseif (option == carOID_S)
		def_car = value
		SetSliderOptionValue(carOID_S, def_car, "+{0}")
		dmCAR.Value = value
	elseif (option == cwpnOID_S)
		def_cwpn = value
		SetSliderOptionValue(cwpnOID_S, def_cwpn, "+{0}%")
		dmCWPN.Value = value
	elseif (option == cmagOID_S)
		def_cmag = value
		SetSliderOptionValue(cmagOID_S, def_cmag, "+{0}%")
		dmCMAG.Value = value
	elseif (option == cresOID_S)
		def_cres = value
		SetSliderOptionValue(cresOID_S, def_cres, "+{0}")
		dmCRES.Value = value
	elseif (option == hhpOID_S)
		def_hhp = value
		SetSliderOptionValue(hhpOID_S, def_hhp, "+{0}%")
		dmHHP.Value = value
	elseif (option == hmpOID_S)
		def_hmp = value
		SetSliderOptionValue(hmpOID_S, def_hmp, "+{0}%")
		dmHMP.Value = value
	elseif (option == hspOID_S)
		def_hsp = value
		SetSliderOptionValue(hspOID_S, def_hsp, "+{0}%")
		dmHSP.Value = value
	elseif (option == harOID_S)
		def_har = value
		SetSliderOptionValue(harOID_S, def_har, "+{0}")
		dmHAR.Value = value
	elseif (option == hwpnOID_S)
		def_hwpn = value
		SetSliderOptionValue(hwpnOID_S, def_hwpn, "+{0}%")
		dmHWPN.Value = value
	elseif (option == hmagOID_S)
		def_hmag = value
		SetSliderOptionValue(hmagOID_S, def_hmag, "+{0}%")
		dmHMAG.Value = value
	elseif (option == hresOID_S)
		def_hres = value
		SetSliderOptionValue(hresOID_S, def_hres, "+{0}")
		dmHRES.Value = value
	elseif (option == uhpOID_S)
		def_uhp = value
		SetSliderOptionValue(uhpOID_S, def_uhp, "+{0}%")
		dmuHP.Value = value
	elseif (option == umpOID_S)
		def_ump = value
		SetSliderOptionValue(umpOID_S, def_ump, "+{0}%")
		dmuMP.Value = value
	elseif (option == uspOID_S)
		def_usp = value
		SetSliderOptionValue(uspOID_S, def_usp, "+{0}%")
		dmuSP.Value = value
	elseif (option == uarOID_S)
		def_uar = value
		SetSliderOptionValue(uarOID_S, def_uar, "+{0}")
		dmuAR.Value = value
	elseif (option == uwpnOID_S)
		def_uwpn = value
		SetSliderOptionValue(uwpnOID_S, def_uwpn, "+{0}%")
		dmuWPN.Value = value
	elseif (option == umagOID_S)
		def_umag = value
		SetSliderOptionValue(umagOID_S, def_umag, "+{0}%")
		dmuMAG.Value = value
	elseif (option == uresOID_S)
		def_ures = value
		SetSliderOptionValue(uresOID_S, def_ures, "+{0}")
		dmuRES.Value = value
	elseif (option == whpOID_S)
		def_whp = value
		SetSliderOptionValue(whpOID_S, def_whp, "+{0}%")
		dmwHP.Value = value
	elseif (option == wmpOID_S)
		def_wmp = value
		SetSliderOptionValue(wmpOID_S, def_wmp, "+{0}%")
		dmwMP.Value = value
	elseif (option == wspOID_S)
		def_wsp = value
		SetSliderOptionValue(wspOID_S, def_wsp, "+{0}%")
		dmwSP.Value = value
	elseif (option == warOID_S)
		def_war = value
		SetSliderOptionValue(warOID_S, def_war, "+{0}")
		dmwAR.Value = value
	elseif (option == wwpnOID_S)
		def_wwpn = value
		SetSliderOptionValue(wwpnOID_S, def_wwpn, "+{0}%")
		dmwWPN.Value = value
	elseif (option == wmagOID_S)
		def_wmag = value
		SetSliderOptionValue(wmagOID_S, def_wmag, "+{0}%")
		dmwMAG.Value = value
	elseif (option == wresOID_S)
		def_wres = value
		SetSliderOptionValue(wresOID_S, def_wres, "+{0}")
		dmwRES.Value = value
	endIf
endEvent

GlobalVariable Property dmCHP  Auto  
GlobalVariable Property dmCMP  Auto
GlobalVariable Property dmCSP  Auto
GlobalVariable Property dmCAR  Auto
GlobalVariable Property dmCWPN  Auto
GlobalVariable Property dmCMAG  Auto
GlobalVariable Property dmCRES  Auto

GlobalVariable Property dmHHP  Auto  
GlobalVariable Property dmHMP  Auto
GlobalVariable Property dmHSP  Auto
GlobalVariable Property dmHAR  Auto
GlobalVariable Property dmHWPN  Auto
GlobalVariable Property dmHMAG  Auto
GlobalVariable Property dmHRES  Auto

GlobalVariable Property dmUHP  Auto  
GlobalVariable Property dmUMP  Auto
GlobalVariable Property dmUSP  Auto
GlobalVariable Property dmUAR  Auto
GlobalVariable Property dmUWPN  Auto
GlobalVariable Property dmUMAG  Auto
GlobalVariable Property dmURES  Auto

GlobalVariable Property dmWHP  Auto  
GlobalVariable Property dmWMP  Auto
GlobalVariable Property dmWSP  Auto
GlobalVariable Property dmWAR  Auto
GlobalVariable Property dmWWPN  Auto
GlobalVariable Property dmWMAG  Auto
GlobalVariable Property dmWRES  Auto

SPELL Property PlayerAb  Auto  

Quest Property nUpdateQuest  Auto  
