Removed redundant checks and updates from _00E_Game_SkillmenuSC intended to fix hotkey registrations, prone to breaking due to missing RegisterForMenu() in OnPlayerLoadGame
This commit is contained in:
parent
9a50707a1e
commit
2b3f294bb4
Binary file not shown.
@ -12,7 +12,7 @@ Import ActorValueInfo
|
||||
Import _00E_QuestFunctions
|
||||
|
||||
int function _GetScriptVersion() Global
|
||||
return 1
|
||||
return 1
|
||||
endFunction
|
||||
|
||||
; This script handles the custom character menu
|
||||
@ -23,19 +23,20 @@ endFunction
|
||||
|
||||
Event OnInit()
|
||||
|
||||
FixedBugs1_2 = True
|
||||
iCurrentAffinityIndex = -1
|
||||
InitAffinitySystem()
|
||||
|
||||
InitializeActorValueInfos()
|
||||
UpdateKeyRegistration()
|
||||
RegisterForMenu("Journal Menu")
|
||||
RegisterForMenu("Journal Menu")
|
||||
|
||||
EndEvent
|
||||
|
||||
Event OnUpdate()
|
||||
Event OnPlayerLoadGame()
|
||||
|
||||
InitAffinitySystem()
|
||||
UpdateKeyRegistration()
|
||||
RegisterForMenu("Journal Menu")
|
||||
|
||||
EndEvent
|
||||
|
||||
@ -60,22 +61,14 @@ Event OnKeyDown(Int KeyCode)
|
||||
If PlayerREF.HasSpell(_00E_Class_Meditate) && Utility.IsInMenuMode() == False && UI.IsTextInputEnabled() == False && PlayerRef.IsOnMount() == False && Game.IsLookingControlsEnabled() == true && UI.IsMenuOpen("Dialogue Menu") == False && PlayerREF.GetCurrentLocation() != _00E_Dreamworld_Location
|
||||
meditateSpell.Cast(PlayerREF, PlayerREF)
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
EndEvent
|
||||
|
||||
Event OnMenuClose(String MenuName)
|
||||
|
||||
If MenuName == ("Journal Menu")
|
||||
UpdateKeyRegistration()
|
||||
EndIf
|
||||
|
||||
EndEvent
|
||||
|
||||
Event OnLocationChange(Location akOldLoc, Location akNewLoc)
|
||||
; Gavrant:
|
||||
; I don't know the purpose of re-registering keys on location change, but someone added this to _00E_Game_TalentControlSC in the first place.
|
||||
UpdateKeyRegistration()
|
||||
|
||||
EndEvent
|
||||
|
||||
|
||||
@ -104,8 +97,8 @@ Function UpdateKeyRegistration()
|
||||
EndFunction
|
||||
|
||||
Function SetHeroMenuKey(int iNewKeyCode)
|
||||
UnregisterForKey(iHeroMenuKeycode)
|
||||
iHeroMenuKeycode = iNewKeyCode
|
||||
UnregisterForKey(iHeroMenuKeycode)
|
||||
iHeroMenuKeycode = iNewKeyCode
|
||||
UpdateKeyRegistration()
|
||||
EndFunction
|
||||
|
||||
@ -148,20 +141,11 @@ Function OpenSkillmenu()
|
||||
If PlayerREF.GetCurrentLocation() != _00E_Dreamworld_Location
|
||||
MenuOpen = True
|
||||
|
||||
UpdateKeyRegistration()
|
||||
|
||||
; if !Game.IsMovementControlsEnabled()
|
||||
; bControlsHaveBeenDisabled = True
|
||||
; EndIf
|
||||
|
||||
_00E_Game_MenuIMOD.Apply()
|
||||
UI.OpenCustomMenu("00E_heromenu")
|
||||
UI.InvokeStringA("CustomMenu", "_root.heromenu_mc.SetStringValues", GetStrings())
|
||||
UI.InvokeFloatA("CustomMenu", "_root.heromenu_mc.SetIntValues", GetFloats())
|
||||
UI.InvokeFloatA("CustomMenu", "_root.heromenu_mc.SetModifier", GetMods())
|
||||
|
||||
RegisterForSingleUpdate(8)
|
||||
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
@ -169,17 +153,8 @@ EndFunction
|
||||
Function CloseSkillmenu()
|
||||
|
||||
UI.CloseCustomMenu()
|
||||
|
||||
; If !bControlsHaveBeenDisabled
|
||||
; Game.EnablePlayerControls()
|
||||
; EndIf
|
||||
|
||||
; bControlsHaveBeenDisabled = False
|
||||
|
||||
_00E_Game_MenuIMOD.Remove()
|
||||
MenuOpen = False
|
||||
UpdateKeyRegistration()
|
||||
RegisterForSingleUpdate(15)
|
||||
|
||||
EndFunction
|
||||
|
||||
@ -329,10 +304,10 @@ Function InitAffinitySystem()
|
||||
|
||||
If isFS
|
||||
PerkTree_PhasmalistIndex = RegisterPerkTree(10, FS_PhasmalistPerks, _00E_FS_Game_PhasmalistName, _00E_FS_Game_PhasmalistName_Female)
|
||||
PerkTree_TheriantrophistIndex = RegisterPerkTree(11, FS_TheriantrophistPerks, _00E_FS_Game_TheriantrophistName, _00E_FS_Game_TheriantrophistName_Female)
|
||||
PerkTree_TheriantrophistIndex = RegisterPerkTree(11, FS_TheriantrophistPerks, _00E_FS_Game_TheriantrophistName, _00E_FS_Game_TheriantrophistName_Female)
|
||||
Else
|
||||
PerkTree_PhasmalistIndex = 10
|
||||
PerkTree_TheriantrophistIndex = 11
|
||||
PerkTree_PhasmalistIndex = 10
|
||||
PerkTree_TheriantrophistIndex = 11
|
||||
EndIf
|
||||
|
||||
; Affinities
|
||||
@ -340,7 +315,7 @@ Function InitAffinitySystem()
|
||||
Affinity_Names_Male = New Message[21]
|
||||
Affinity_Names_Female = New Message[21]
|
||||
|
||||
Affinity_BattlemageIndex = RegisterAffinity( 0, _00E_Affinity_AbBattlemage, _00E_Game_Affinity_BattlemageName, _00E_Game_Affinity_BattlemageName_Female)
|
||||
Affinity_BattlemageIndex = RegisterAffinity( 0, _00E_Affinity_AbBattlemage, _00E_Game_Affinity_BattlemageName, _00E_Game_Affinity_BattlemageName_Female)
|
||||
Affinity_ClericIndex = RegisterAffinity( 1, _00E_Affinity_AbCleric, _00E_Game_Affinity_ClericName, _00E_Game_Affinity_ClericName_Female)
|
||||
Affinity_AssasinIndex = RegisterAffinity( 2, _00E_Affinity_AbAssassin, _00E_Game_Affinity_AssassinName, _00E_Game_Affinity_AssassinName_Female)
|
||||
Affinity_WayfarerIndex = RegisterAffinity( 3, _00E_Affinity_AbWayfarer, _00E_Game_Affinity_WayfarerName, _00E_Game_Affinity_WayfarerName_Female)
|
||||
@ -356,27 +331,27 @@ Function InitAffinitySystem()
|
||||
; Affinity_WanderingMageIndex = RegisterAffinity(10, __Config_AffinityAbs[10], , )
|
||||
|
||||
If isFS
|
||||
Affinity_SpectralistIndex = RegisterAffinity(11, _00E_FS_Affinity_AbRitualist, _00E_FS_Game_Affinity_Spectralist, _00E_FS_Game_Affinity_Spectralist_Female)
|
||||
Affinity_GhostBladeIndex = RegisterAffinity(12, _00E_FS_Affinity_AbGhostblade, _00E_FS_Game_Affinity_GhostBlade, _00E_FS_Game_Affinity_GhostBlade_Female)
|
||||
Affinity_SpectralWarriorIndex = RegisterAffinity(13, _00E_FS_Affinity_AbSpectralWarrior, _00E_FS_Game_Affinity_SpectralWarrior, _00E_FS_Game_Affinity_SpectralWarrior_Female)
|
||||
Affinity_BruteIndex = RegisterAffinity(14, _00E_FS_Affinity_AbBrute, _00E_FS_Game_Affinity_Brute, _00E_FS_Game_Affinity_Brute_Female)
|
||||
Affinity_DrifterIndex = RegisterAffinity(15, _00E_FS_Affinity_AbDrifter, _00E_FS_Game_Affinity_Drifter, _00E_FS_Game_Affinity_Drifter_Female)
|
||||
Affinity_DruidIndex = RegisterAffinity(16, _00E_FS_Affinity_AbDruid, _00E_FS_Game_Affinity_Druid, _00E_FS_Game_Affinity_Druid_Female)
|
||||
Affinity_NightwolfIndex = RegisterAffinity(17, _00E_FS_Affinity_AbNightwolf, _00E_FS_Game_Affinity_Nightwolf, _00E_FS_Game_Affinity_Nightwolf_Female)
|
||||
Affinity_RavagerIndex = RegisterAffinity(18, _00E_FS_Affinity_AbRavager, _00E_FS_Game_Affinity_Ravager, _00E_FS_Game_Affinity_Ravager_Female)
|
||||
Affinity_ScourgeOfTheWildsIndex = RegisterAffinity(19, _00E_FS_Affinity_AbScourge, _00E_FS_Game_Affinity_ScourgeOfTheWilds, _00E_FS_Game_Affinity_ScourgeOfTheWilds_Female)
|
||||
Affinity_SoulcallerIndex = RegisterAffinity(20, _00E_FS_Affinity_AbSoulcaller, _00E_FS_Game_Affinity_Soulcaller, _00E_FS_Game_Affinity_Soulcaller_Female)
|
||||
Affinity_SpectralistIndex = RegisterAffinity(11, _00E_FS_Affinity_AbRitualist, _00E_FS_Game_Affinity_Spectralist, _00E_FS_Game_Affinity_Spectralist_Female)
|
||||
Affinity_GhostBladeIndex = RegisterAffinity(12, _00E_FS_Affinity_AbGhostblade, _00E_FS_Game_Affinity_GhostBlade, _00E_FS_Game_Affinity_GhostBlade_Female)
|
||||
Affinity_SpectralWarriorIndex = RegisterAffinity(13, _00E_FS_Affinity_AbSpectralWarrior, _00E_FS_Game_Affinity_SpectralWarrior, _00E_FS_Game_Affinity_SpectralWarrior_Female)
|
||||
Affinity_BruteIndex = RegisterAffinity(14, _00E_FS_Affinity_AbBrute, _00E_FS_Game_Affinity_Brute, _00E_FS_Game_Affinity_Brute_Female)
|
||||
Affinity_DrifterIndex = RegisterAffinity(15, _00E_FS_Affinity_AbDrifter, _00E_FS_Game_Affinity_Drifter, _00E_FS_Game_Affinity_Drifter_Female)
|
||||
Affinity_DruidIndex = RegisterAffinity(16, _00E_FS_Affinity_AbDruid, _00E_FS_Game_Affinity_Druid, _00E_FS_Game_Affinity_Druid_Female)
|
||||
Affinity_NightwolfIndex = RegisterAffinity(17, _00E_FS_Affinity_AbNightwolf, _00E_FS_Game_Affinity_Nightwolf, _00E_FS_Game_Affinity_Nightwolf_Female)
|
||||
Affinity_RavagerIndex = RegisterAffinity(18, _00E_FS_Affinity_AbRavager, _00E_FS_Game_Affinity_Ravager, _00E_FS_Game_Affinity_Ravager_Female)
|
||||
Affinity_ScourgeOfTheWildsIndex = RegisterAffinity(19, _00E_FS_Affinity_AbScourge, _00E_FS_Game_Affinity_ScourgeOfTheWilds, _00E_FS_Game_Affinity_ScourgeOfTheWilds_Female)
|
||||
Affinity_SoulcallerIndex = RegisterAffinity(20, _00E_FS_Affinity_AbSoulcaller, _00E_FS_Game_Affinity_Soulcaller, _00E_FS_Game_Affinity_Soulcaller_Female)
|
||||
Else
|
||||
Affinity_SpectralistIndex = 11
|
||||
Affinity_GhostBladeIndex = 12
|
||||
Affinity_SpectralWarriorIndex = 13
|
||||
Affinity_BruteIndex = 14
|
||||
Affinity_DrifterIndex = 15
|
||||
Affinity_DruidIndex = 16
|
||||
Affinity_NightwolfIndex = 17
|
||||
Affinity_RavagerIndex = 18
|
||||
Affinity_ScourgeOfTheWildsIndex = 19
|
||||
Affinity_SoulcallerIndex = 20
|
||||
Affinity_SpectralistIndex = 11
|
||||
Affinity_GhostBladeIndex = 12
|
||||
Affinity_SpectralWarriorIndex = 13
|
||||
Affinity_BruteIndex = 14
|
||||
Affinity_DrifterIndex = 15
|
||||
Affinity_DruidIndex = 16
|
||||
Affinity_NightwolfIndex = 17
|
||||
Affinity_RavagerIndex = 18
|
||||
Affinity_ScourgeOfTheWildsIndex = 19
|
||||
Affinity_SoulcallerIndex = 20
|
||||
EndIf
|
||||
|
||||
|
||||
@ -392,31 +367,9 @@ Function InitAffinitySystem()
|
||||
EndWhile
|
||||
EndIf
|
||||
|
||||
; Fix 1.2.x.x bugs if needed
|
||||
If FixedBugs1_2 == False
|
||||
If bHasAffinityBonus == False
|
||||
iCurrentAffinityIndex = -1
|
||||
EndIf
|
||||
|
||||
If iCurrentAffinityIndex >= 0
|
||||
Spell affSpell = Affinity_Spells[iCurrentAffinityIndex]
|
||||
If PlayerREF.HasSpell(affSpell) == False
|
||||
PlayerREF.AddSpell(affSpell)
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
Int[] PerkDistribution = GetPerkDistribution()
|
||||
UpdateClassIndices(PerkDistribution)
|
||||
|
||||
FixedBugs1_2 = True
|
||||
|
||||
Else
|
||||
|
||||
; Init MajorSchool
|
||||
If MajorSchool == 0
|
||||
UpdateMajorSchool()
|
||||
EndIf
|
||||
|
||||
; Init MajorSchool
|
||||
If MajorSchool == 0
|
||||
UpdateMajorSchool()
|
||||
EndIf
|
||||
|
||||
BlockClassUpdates = False
|
||||
@ -583,55 +536,55 @@ Function UpdateUnlockedAffinities(Int[] PerkDistribution)
|
||||
|
||||
; Spectral Warrior: Phasmalist und Vandale/Hüter/Klingentänzer
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_SpectralWarriorIndex, PerkTree_PhasmalistIndex, PerkTree_RageIndex, PerkTree_BastionIndex, PerkTree_DerwishIndex)
|
||||
|
||||
; Ghostblade: Phasmalist und Infiltrator/Gauner
|
||||
|
||||
; Ghostblade: Phasmalist und Infiltrator/Gauner
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_GhostBladeIndex, PerkTree_PhasmalistIndex, PerkTree_EspionageIndex, PerkTree_TrickeryIndex)
|
||||
|
||||
; Brute: Vandal/Bladedancer und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_BruteIndex, PerkTree_TheriantrophistIndex, PerkTree_DerwishIndex, PerkTree_RageIndex)
|
||||
|
||||
; Brute: Vandal/Bladedancer und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_BruteIndex, PerkTree_TheriantrophistIndex, PerkTree_DerwishIndex, PerkTree_RageIndex)
|
||||
|
||||
; Drifter: Vagrant und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_DrifterIndex, PerkTree_TheriantrophistIndex, PerkTree_VagabondIndex)
|
||||
; Drifter: Vagrant und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_DrifterIndex, PerkTree_TheriantrophistIndex, PerkTree_VagabondIndex)
|
||||
|
||||
; Druid: Lycantrophe und Elementarist
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_DruidIndex, PerkTree_TheriantrophistIndex, PerkTree_ElementalismIndex)
|
||||
; Druid: Lycantrophe und Elementarist
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_DruidIndex, PerkTree_TheriantrophistIndex, PerkTree_ElementalismIndex)
|
||||
|
||||
; Nightwolf: Infiltrator und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_NightwolfIndex, PerkTree_TheriantrophistIndex, PerkTree_EspionageIndex)
|
||||
; Nightwolf: Infiltrator und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_NightwolfIndex, PerkTree_TheriantrophistIndex, PerkTree_EspionageIndex)
|
||||
|
||||
; Ravager: Sinistrope und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_RavagerIndex, PerkTree_TheriantrophistIndex, PerkTree_LifeAndDeathIndex)
|
||||
; Ravager: Sinistrope und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_RavagerIndex, PerkTree_TheriantrophistIndex, PerkTree_LifeAndDeathIndex)
|
||||
|
||||
; Scourge of the Wilds: Keeper/Thaumaturgy und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_ScourgeOfTheWildsIndex, PerkTree_TheriantrophistIndex, PerkTree_ManipulationIndex)
|
||||
; Scourge of the Wilds: Keeper/Thaumaturgy und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_ScourgeOfTheWildsIndex, PerkTree_TheriantrophistIndex, PerkTree_ManipulationIndex)
|
||||
|
||||
; Soulcaller: Phasmalist und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_SoulcallerIndex, PerkTree_TheriantrophistIndex, PerkTree_PhasmalistIndex)
|
||||
; Soulcaller: Phasmalist und Lycantrophe
|
||||
TryUnlockAffinity(PerkDistribution, Affinity_SoulcallerIndex, PerkTree_TheriantrophistIndex, PerkTree_PhasmalistIndex)
|
||||
|
||||
Endfunction
|
||||
|
||||
Function AddAchievementForAffinityUnlock(int nTotalUnlockedAffinityCount)
|
||||
|
||||
If _00E_AchievementsEnabled.GetValueInt() == 1
|
||||
If nTotalUnlockedAffinityCount >= 1
|
||||
Steam.UnlockAchievement("END_AFFINITY_01")
|
||||
EndIf
|
||||
If nTotalUnlockedAffinityCount >= 2
|
||||
Steam.UnlockAchievement("END_AFFINITY_02")
|
||||
EndIf
|
||||
EndIf
|
||||
If _00E_AchievementsEnabled.GetValueInt() == 1
|
||||
If nTotalUnlockedAffinityCount >= 1
|
||||
Steam.UnlockAchievement("END_AFFINITY_01")
|
||||
EndIf
|
||||
If nTotalUnlockedAffinityCount >= 2
|
||||
Steam.UnlockAchievement("END_AFFINITY_02")
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
EndFunction
|
||||
|
||||
Function AddAchievementForFullMemoryTree(Int[] PerkDistribution, Int[] MaxPerkDistribution)
|
||||
|
||||
Int Index = 1
|
||||
Int Index = 1
|
||||
While Index < PerkDistribution.Length
|
||||
If PerkDistribution[Index] == MaxPerkDistribution[Index] && !bMemoryTreeAchievementUnlocked
|
||||
Steam.UnlockAchievement("END_MEMORY_TREE_01")
|
||||
bMemoryTreeAchievementUnlocked = true
|
||||
EndIf
|
||||
Index += 1
|
||||
If PerkDistribution[Index] == MaxPerkDistribution[Index] && !bMemoryTreeAchievementUnlocked
|
||||
Steam.UnlockAchievement("END_MEMORY_TREE_01")
|
||||
bMemoryTreeAchievementUnlocked = true
|
||||
EndIf
|
||||
Index += 1
|
||||
EndWhile
|
||||
|
||||
EndFunction
|
||||
@ -646,11 +599,11 @@ Function GetPlayerClass()
|
||||
Int[] PerkDistribution = GetPerkDistribution()
|
||||
|
||||
UpdateClassIndices(PerkDistribution)
|
||||
|
||||
If _00E_AchievementsEnabled.GetValueInt() == 1 && !bMemoryTreeAchievementUnlocked
|
||||
Int[] MaxPerkDistribution = GetMaxPerkDistribution()
|
||||
AddAchievementForFullMemoryTree(PerkDistribution, MaxPerkDistribution)
|
||||
EndIf
|
||||
|
||||
If _00E_AchievementsEnabled.GetValueInt() == 1 && !bMemoryTreeAchievementUnlocked
|
||||
Int[] MaxPerkDistribution = GetMaxPerkDistribution()
|
||||
AddAchievementForFullMemoryTree(PerkDistribution, MaxPerkDistribution)
|
||||
EndIf
|
||||
|
||||
; What affinities are unlocked?
|
||||
Int iNewAffinityIndex = -1
|
||||
@ -659,7 +612,7 @@ Function GetPlayerClass()
|
||||
UpdateUnlockedAffinities(PerkDistribution)
|
||||
|
||||
Int nTotalUnlockedAffinityCount = 0
|
||||
Int nSinceLastTimeUnlockedAffinityCount = 0
|
||||
Int nSinceLastTimeUnlockedAffinityCount = 0
|
||||
Int[] unlockedAffinityIndices = Utility.CreateIntArray(affinitiesUnlocked.Length, 0)
|
||||
|
||||
Int Index = 0
|
||||
@ -673,8 +626,8 @@ Function GetPlayerClass()
|
||||
EndIf
|
||||
Index += 1
|
||||
EndWhile
|
||||
|
||||
AddAchievementForAffinityUnlock(nTotalUnlockedAffinityCount)
|
||||
|
||||
AddAchievementForAffinityUnlock(nTotalUnlockedAffinityCount)
|
||||
|
||||
If nTotalUnlockedAffinityCount == 1
|
||||
iNewAffinityIndex = unlockedAffinityIndices[0]
|
||||
@ -832,16 +785,6 @@ String Function GetPlayerClassName()
|
||||
EndIf
|
||||
EndFunction
|
||||
|
||||
Event OnPlayerLoadGame()
|
||||
InitAffinitySystem()
|
||||
|
||||
; Post-1.2.5.0 update
|
||||
If bMeditateKeyRegistered == False
|
||||
UpdateKeyRegistration()
|
||||
EndIf
|
||||
|
||||
EndEvent
|
||||
|
||||
|
||||
;=====================================================================================
|
||||
; PROPERTIES
|
||||
@ -1078,7 +1021,6 @@ Int Affinity_RavagerIndex
|
||||
Int Affinity_ScourgeOfTheWildsIndex
|
||||
Int Affinity_SoulcallerIndex
|
||||
|
||||
Bool FixedBugs1_2
|
||||
Bool BlockClassUpdates
|
||||
|
||||
Bool bMeditateKeyRegistered = False
|
||||
|
Loading…
Reference in New Issue
Block a user