enderalse/source/scripts/_00e_enderalmcm.psc

203 lines
8.4 KiB
Plaintext
Raw Normal View History

Scriptname _00E_EnderalMCM extends SKI_ConfigBase
{This script handles all kinds of MCM menu options for Enderal}
;=====================================================================================
; EVENTS
;=====================================================================================
int function _GetScriptVersion() Global
return 1
endFunction
event OnGameReload()
if SKSE.GetVersion() == 0
Debug.Trace("NO SKSE: the Mod Configuration Menu is disabled")
return
endif
parent.OnGameReload()
endevent
Event OnPageReset(string page)
; adding options to rebind new key options: 1) Hero menu 2) meditation 3) Phasmalist summon apparition 4) Horseflute
SetCursorFillMode(TOP_TO_BOTTOM)
AddHeaderOption(_00E_ConfigMenu_Keybindings.GetName())
iKeyMeditateID = self.AddKeyMapOption(_00E_ConfigMenu_Meditate.GetName(), PlayerMeditation.iMeditateKeycode, 0)
iKeyID02 = self.AddKeyMapOption(_00E_FS_ConfigMenu_Phasmalist_Teleport.GetName(), iFSPhasmalistTeleportKeymap, 0)
iKeyMountID = self.AddKeyMapOption(_00E_FS_ConfigMenu_Mount_Teleport.GetName(), iFSMountTeleportKeymap, 0)
; adding gameplay options to enable / disable: 1) read aloud books 2) videos skip
AddHeaderOption(_00E_ConfigMenu_GameplayOptions.GetName())
toggleOID_ReadAloudBooks = AddToggleOption(_00E_ConfigMenu_DisableReadAloudBooks.GetName(), _00E_DisableReadAloudBooks.GetValue() != 0)
toggleOID_VideoSkip = AddToggleOption(_00E_ConfigMenu_VideoSkip.GetName(), _00E_VideoSkip.GetValue() != 0)
toggleOID_ActorHealthBars = AddToggleOption(_00E_ConfigMenu_ActorHealthBars.GetName(), _00E_ActorHealthBarsEnabled.GetValue() != 0)
toggleOID_KillMoves = AddToggleOption(_00E_ConfigMenu_KillMove.GetName(), KillMove.GetValue() != 0)
SetCursorPosition(1)
; adding other options to disable / enable: 1) menu tutorials 2) crafting tutorials 3) skill tutorials 4) quest tutorials 5) other tutorials
AddHeaderOption(_00E_ConfigMenu_OtherOptions.GetName())
toggleOID_MenuTutorials = AddToggleOption(_00E_ConfigMenu_DisableMenuTutorials.GetName(), _00E_DisableMenuTutorials.GetValue() != 0)
toggleOID_CraftingTutorials = AddToggleOption(_00E_ConfigMenu_DisableCraftingTutorials.GetName(), _00E_DisableCraftingTutorials.GetValue() != 0)
toggleOID_SkillTutorials = AddToggleOption(_00E_ConfigMenu_DisableSkillTutorials.GetName(), _00E_DisableSkillTutorials.GetValue() != 0)
toggleOID_QuestTutorials = AddToggleOption(_00E_ConfigMenu_DisableQuestTutorials.GetName(), _00E_DisableQuestTutorials.GetValue() != 0)
toggleOID_OtherTutorials = AddToggleOption(_00E_ConfigMenu_DisableOtherTutorials.GetName(), _00E_DisableOtherTutorials.GetValue() != 0)
EndEvent
; this event is responsible for assigning new keys, and passes the information to the respecitive scripts that registers for the key
Event OnOptionKeyMapChange(int option, int keyCode, string conflictControl, string conflictName)
If option == iKeyMeditateID
self.SetKeyMapOptionValue(iKeyMeditateID, keyCode, false)
PlayerMeditation.SetMeditateKey(keyCode)
ElseIf option == iKeyID02
iFSPhasmalistTeleportKeymap = keyCode
self.SetKeyMapOptionValue(iKeyID02, iFSPhasmalistTeleportKeymap, false)
controlQuest.ChangeTeleportKey(iFSPhasmalistTeleportKeymap)
ElseIf option == iKeyMountID
iFSMountTeleportKeymap = keyCode
self.SetKeyMapOptionValue(iKeyMountID, iFSMountTeleportKeymap, false)
_00E_HorseFlute_New.SetMountTeleportKey(iFSMountTeleportKeymap)
EndIf
EndEvent
Event OnOptionSelect(int option)
If option == toggleOID_MenuTutorials
ChangeCheckbox(toggleOID_MenuTutorials, _00E_DisableMenuTutorials)
ElseIf option == toggleOID_CraftingTutorials
ChangeCheckbox(toggleOID_CraftingTutorials, _00E_DisableCraftingTutorials)
ElseIf option == toggleOID_SkillTutorials
ChangeCheckbox(toggleOID_SkillTutorials, _00E_DisableSkillTutorials)
ElseIf option == toggleOID_QuestTutorials
ChangeCheckbox(toggleOID_QuestTutorials, _00E_DisableQuestTutorials)
ElseIf option == toggleOID_OtherTutorials
ChangeCheckbox(toggleOID_OtherTutorials, _00E_DisableOtherTutorials)
ElseIf option == toggleOID_ReadAloudBooks
ChangeCheckbox(toggleOID_ReadAloudBooks, _00E_DisableReadAloudBooks)
ElseIf option == toggleOID_VideoSkip
ChangeCheckbox(toggleOID_VideoSkip, _00E_VideoSkip)
elseif option == toggleOID_ActorHealthBars
ChangeCheckbox(toggleOID_ActorHealthBars, _00E_ActorHealthBarsEnabled)
if _00E_ActorHealthBarsEnabled.GetValue()
ActorHealthBarWidget.RegisterEvents()
else
ActorHealthBarWidget.UnregisterEvents()
endif
elseif option == toggleOID_KillMoves
ChangeCheckbox(toggleOID_KillMoves, KillMove)
if KillMove.GetValue()
Utility.SetINIBool("bVATSDisable:VATS", false)
else
Utility.SetINIBool("bVATSDisable:VATS", true)
endif
EndIf
EndEvent
; this event displays additional information when the mouse hovers over the different options
; the information is located in the Language_Translate.txt
Event OnOptionHighlight(int option)
If option == iKeyMeditateID
SetInfoText("$ConfigMenuKeyInfo")
ElseIf option == iKeyID02
SetInfoText("$ConfigMenuKeyInfo")
ElseIf option == iKeyMountID
SetInfoText("$ConfigMenuKeyInfo")
ElseIf option == toggleOID_MenuTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_CraftingTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_SkillTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_QuestTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_OtherTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_ReadAloudBooks
SetInfoText("$ConfigMenuReadAloudBooksInfo")
ElseIf option == toggleOID_VideoSkip
SetInfoText("$ConfigMenuVideoSkipInfo")
ElseIf option == toggleOID_ActorHealthBars
SetInfoText("$ConfigMenuActorHealthBars")
ElseIf option == toggleOID_KillMoves
SetInfoText("$ConfigMenuKillMoves")
EndIf
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
; function to control all checkbox changes
Function ChangeCheckbox(Int optionId, GlobalVariable optionValue)
Int newValue = ((optionValue.GetValueInt() == 0) as int)
SetToggleOptionValue(optionId, newValue)
optionValue.SetValueInt(newValue)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
Int iKeyMeditateID
int iKeyID02
int iKeyMountID
int iFSPhasmalistTeleportKeymap = 34
int iFSMountTeleportKeymap = 38
int toggleOID_MenuTutorials
int toggleOID_CraftingTutorials
int toggleOID_SkillTutorials
int toggleOID_QuestTutorials
int toggleOID_OtherTutorials
int toggleOID_ReadAloudBooks
int toggleOID_VideoSkip
int toggleOID_ActorHealthBars
int toggleOID_KillMoves
Message Property _00E_ConfigMenu_Keybindings Auto
Message Property _00E_ConfigMenu_OtherOptions Auto
Message Property _00E_ConfigMenu_GameplayOptions Auto
Message Property _00E_ConfigMenu_Meditate Auto
Message Property _00E_FS_ConfigMenu_Phasmalist_Teleport Auto
Message Property _00E_FS_ConfigMenu_Mount_Teleport Auto
Message Property _00E_ConfigMenu_DisableMenuTutorials Auto
Message Property _00E_ConfigMenu_DisableCraftingTutorials Auto
Message Property _00E_ConfigMenu_DisableSkillTutorials Auto
Message Property _00E_ConfigMenu_DisableQuestTutorials Auto
Message Property _00E_ConfigMenu_DisableOtherTutorials Auto
Message Property _00E_ConfigMenu_DisableReadAloudBooks Auto
Message Property _00E_ConfigMenu_VideoSkip Auto
Message Property _00E_ConfigMenu_ActorHealthBars Auto
Message Property _00E_ConfigMenu_KillMove Auto
_FS_Phasmalist_ControlQuest Property controlQuest Auto
_00E_Horseflute_SC Property _00E_HorseFlute_New Auto
GlobalVariable Property _00E_DisableMenuTutorials Auto
GlobalVariable Property _00E_DisableCraftingTutorials Auto
GlobalVariable Property _00E_DisableSkillTutorials Auto
GlobalVariable Property _00E_DisableQuestTutorials Auto
GlobalVariable Property _00E_DisableOtherTutorials Auto
GlobalVariable Property _00E_DisableReadAloudBooks Auto
GlobalVariable Property _00E_VideoSkip Auto
GlobalVariable Property _00E_ActorHealthBarsEnabled Auto
GlobalVariable Property KillMove Auto
_00E_MeditationHotkeyAlias Property PlayerMeditation Auto
_00E_GUI_ActorHealthBar Property ActorHealthBarWidget Auto