|
|
|
@ -66,6 +66,8 @@ MagicEffect Property AlchRestoreStamina Auto |
|
|
|
|
|
|
|
|
|
FormList Property _00E_EmptyFormlist Auto |
|
|
|
|
|
|
|
|
|
ObjectReference Property _00E_SecureChest_HostChestREF Auto |
|
|
|
|
|
|
|
|
|
Int Property GreyAlchemist2PotionDurationLimitInSeconds = 180 Autoreadonly Hidden |
|
|
|
|
{The potion duration of all werewolf potions is limited to this amount if the player has the first and second perk grey alchemist} |
|
|
|
|
Int Property GreyAlchemist1PotionDurationLimitInSeconds = 120 Autoreadonly Hidden |
|
|
|
@ -101,7 +103,7 @@ bool bDoneDarkBlood = false |
|
|
|
|
bool bDoneChymikum = false |
|
|
|
|
|
|
|
|
|
Int curScriptVersion = 0 |
|
|
|
|
Int Property LATEST_SCRIPT_VERSION = 4 AutoReadOnly |
|
|
|
|
Int Property LATEST_SCRIPT_VERSION = 5 AutoReadOnly |
|
|
|
|
|
|
|
|
|
bool bHasJContainers = false |
|
|
|
|
|
|
|
|
@ -120,8 +122,6 @@ Function _UpdatePotion(Potion item, Int count) |
|
|
|
|
|
|
|
|
|
If bIsTheriantrophistPotion && EnderalLib.IsDLLLoaded() ; FRESHLY BREWN THERIANTROPHIST POTION |
|
|
|
|
|
|
|
|
|
Debug.Notification("Replacing theriantrophist potion") |
|
|
|
|
|
|
|
|
|
PlayerREF.removeItem(item, count, abSilent = true) |
|
|
|
|
|
|
|
|
|
Bool bRemoveTheriantrophistEffects = False |
|
|
|
@ -156,7 +156,7 @@ Function _UpdatePotion(Potion item, Int count) |
|
|
|
|
EndIf |
|
|
|
|
Else |
|
|
|
|
Int maxDuration = NoAlchemistPotionDurationLimitInSeconds |
|
|
|
|
Int durationBonus = PlayerREF.GetAV("Variable02") as Int |
|
|
|
|
Int durationBonus = PlayerREF.GetActorValue("Variable02") as Int |
|
|
|
|
|
|
|
|
|
If PlayerREF.hasPerk(_00E_Class_Theriantrophist_P03_GreyAlchemist_03) |
|
|
|
|
maxDuration = -1 ; no duration mali are required |
|
|
|
@ -225,7 +225,6 @@ Function _UpdatePotion(Potion item, Int count) |
|
|
|
|
EndFunction |
|
|
|
|
|
|
|
|
|
Function _RenamePotion(Potion p, MagicEffect[] potionEffects, Int nPotionEffects, Bool bCommonPotion) |
|
|
|
|
Debug.Notification("Renaming potion") |
|
|
|
|
String name = "" |
|
|
|
|
|
|
|
|
|
If bCommonPotion |
|
|
|
@ -335,16 +334,16 @@ Function _UpdateNQ11(Potion newPotion) |
|
|
|
|
|
|
|
|
|
Bool bUpdateNQ11 = False |
|
|
|
|
|
|
|
|
|
If newPotion.HasKeyword(_00E_Theriantrophist_ChymikumLife) && FS_NQ11.GetStage() >= 10 && !bDoneChymikum |
|
|
|
|
If newPotion.HasKeyword(_00E_Theriantrophist_ChymikumLife) && FS_NQ11.GetCurrentStageID() >= 10 && !bDoneChymikum |
|
|
|
|
bDoneChymikum = True |
|
|
|
|
bUpdateNQ11 = True |
|
|
|
|
EndIf |
|
|
|
|
If newPotion.HasKeyword(_00E_Theriantrophist_DarkBloodEffect) && FS_NQ11.GetStage() >= 10 && !bDoneDarkBlood |
|
|
|
|
If newPotion.HasKeyword(_00E_Theriantrophist_DarkBloodEffect) && FS_NQ11.GetCurrentStageID() >= 10 && !bDoneDarkBlood |
|
|
|
|
bDoneDarkBlood = True |
|
|
|
|
bUpdateNQ11 = True |
|
|
|
|
EndIf |
|
|
|
|
|
|
|
|
|
If bUpdateNQ11 && FS_NQ11.GetStage() < 17 |
|
|
|
|
If bUpdateNQ11 && FS_NQ11.GetCurrentStageID() < 17 |
|
|
|
|
FS_NQ11.ShowTutorial(2) |
|
|
|
|
|
|
|
|
|
If bDoneChymikum && bDoneDarkBlood |
|
|
|
@ -358,71 +357,29 @@ Function _UpdateNQ11(Potion newPotion) |
|
|
|
|
EndFunction |
|
|
|
|
|
|
|
|
|
Function _SetNewStageNQ11(Int newStage) |
|
|
|
|
If newStage > FS_NQ11.GetStage() |
|
|
|
|
FS_NQ11.SetStage(newStage) |
|
|
|
|
If newStage > FS_NQ11.GetCurrentStageID() |
|
|
|
|
FS_NQ11.SetCurrentStageID(newStage) |
|
|
|
|
EndIf |
|
|
|
|
EndFunction |
|
|
|
|
|
|
|
|
|
Function _UpdateInventoryFilters() |
|
|
|
|
|
|
|
|
|
RemoveAllInventoryEventFilters() |
|
|
|
|
|
|
|
|
|
AddInventoryEventFilter(_00E_EmptyFormlist) |
|
|
|
|
|
|
|
|
|
Int potionNames = RenamedPotions |
|
|
|
|
Form k = JFormMap.nextKey(potionNames, previousKey = None, endKey = None) |
|
|
|
|
while k != None |
|
|
|
|
AddInventoryEventFilter(k) |
|
|
|
|
k = JFormMap.nextKey(potionNames, k, endKey = None) |
|
|
|
|
endwhile |
|
|
|
|
|
|
|
|
|
EndFunction |
|
|
|
|
|
|
|
|
|
Function _RestorePotionAttributes() |
|
|
|
|
Debug.Notification("Restoring potion names") |
|
|
|
|
|
|
|
|
|
Potion k |
|
|
|
|
|
|
|
|
|
Int potionNames = RenamedPotions |
|
|
|
|
k = JFormMap.nextKey(potionNames, previousKey = None, endKey = None) as Potion |
|
|
|
|
while k != None |
|
|
|
|
k.setName(JFormMap.getStr(potionNames, k)) |
|
|
|
|
k = JFormMap.nextKey(potionNames, k, endKey = None) as Potion |
|
|
|
|
endwhile |
|
|
|
|
|
|
|
|
|
Int potionModels = ModelChangedPotions |
|
|
|
|
k = JFormMap.nextKey(potionModels, previousKey = None, endKey = None) as Potion |
|
|
|
|
while k != None |
|
|
|
|
k.SetWorldModelPath(JFormMap.getStr(potionModels, k)) |
|
|
|
|
k = JFormMap.nextKey(potionModels, k, endKey = None) as Potion |
|
|
|
|
endwhile |
|
|
|
|
|
|
|
|
|
EndFunction |
|
|
|
|
|
|
|
|
|
Function _InitAchemyControl() |
|
|
|
|
|
|
|
|
|
;Debug.Notification("AchemyControl init") |
|
|
|
|
|
|
|
|
|
GoToState("") |
|
|
|
|
|
|
|
|
|
int iSKSEVer = SKSE.GetVersion() |
|
|
|
|
|
|
|
|
|
if iSKSEVer < 2 |
|
|
|
|
RemoveAllInventoryEventFilters() |
|
|
|
|
bHasJContainers = false |
|
|
|
|
;Debug.Notification("SKSE is not loaded") |
|
|
|
|
Debug.Trace("SKSE is not loaded, _00E_Theriantrophist_AlchemyControl is disabled") |
|
|
|
|
return |
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
bHasJContainers = ( (SKSE.GetPluginVersion("JContainers64") != -1) || (SKSE.GetPluginVersion("JContainersVR") != -1) ) |
|
|
|
|
bHasJContainers = ( (SKSE.GetPluginVersion("JContainers64") != -1) || (SKSE.GetPluginVersion("JContainersVR") != -1) ) && JContainers.isInstalled() |
|
|
|
|
|
|
|
|
|
if ! bHasJContainers && ! EnderalLib.IsDLLLoaded() |
|
|
|
|
; Both required components are missing, do not update version and disable everything |
|
|
|
|
RemoveAllInventoryEventFilters() |
|
|
|
|
UnregisterForAllMenus() |
|
|
|
|
Debug.Trace("JContainers and fs.dll are not loaded, _00E_Theriantrophist_AlchemyControl is disabled.") |
|
|
|
|
;Debug.Notification("JContainers and fs.dll are not loaded") |
|
|
|
|
return |
|
|
|
|
endif |
|
|
|
|
|
|
|
|
@ -431,64 +388,66 @@ Function _InitAchemyControl() |
|
|
|
|
Int oldScriptVersion = curScriptVersion |
|
|
|
|
curScriptVersion = LATEST_SCRIPT_VERSION |
|
|
|
|
|
|
|
|
|
If oldScriptVersion < 4 |
|
|
|
|
;Debug.Notification("Updating AlchemyControl") |
|
|
|
|
If oldScriptVersion < 5 |
|
|
|
|
RemoveAllInventoryEventFilters() |
|
|
|
|
UnregisterForAllMenus() |
|
|
|
|
UnregisterForUpdate() |
|
|
|
|
EndIf |
|
|
|
|
EndIf |
|
|
|
|
|
|
|
|
|
; Re-initialize everything to stay resilient to co-save deletion or corruption |
|
|
|
|
|
|
|
|
|
if bHasJContainers |
|
|
|
|
RegisterForMenu("ContainerMenu") |
|
|
|
|
RegisterForMenu("InventoryMenu") |
|
|
|
|
RegisterForMenu("FavoritesMenu") |
|
|
|
|
;Debug.Trace("JContainers is loaded, hooking to menus") |
|
|
|
|
else |
|
|
|
|
RemoveAllInventoryEventFilters() |
|
|
|
|
UnregisterForAllMenus() |
|
|
|
|
Debug.Notification("JContainers is not loaded") |
|
|
|
|
if ! bHasJContainers |
|
|
|
|
Debug.Trace("JContainers is not loaded, renaming and changing potion models is disabled") |
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
; Re-register menu listener to stay resilient to co-save deletion or corruption |
|
|
|
|
RegisterForMenu("Crafting Menu") |
|
|
|
|
|
|
|
|
|
EndFunction |
|
|
|
|
|
|
|
|
|
Function _OnGameLoadJContainers() |
|
|
|
|
|
|
|
|
|
Potion k |
|
|
|
|
Potion previousKey |
|
|
|
|
|
|
|
|
|
Int potionNames = RenamedPotions |
|
|
|
|
k = JFormMap.nextKey(potionNames, previousKey = None, endKey = None) as Potion |
|
|
|
|
while k != None |
|
|
|
|
; Forget items that are no longer in the inventory |
|
|
|
|
if PlayerREF.GetItemCount(k) == 0 && _00E_SecureChest_HostChestREF.GetItemCount(k) == 0 |
|
|
|
|
JFormMap.removeKey(RenamedPotions, k) |
|
|
|
|
JFormMap.removeKey(ModelChangedPotions, k) |
|
|
|
|
k = JFormMap.nextKey(potionNames, previousKey, endKey = None) as Potion |
|
|
|
|
else |
|
|
|
|
previousKey = k |
|
|
|
|
k.setName(JFormMap.getStr(potionNames, k)) |
|
|
|
|
k = JFormMap.nextKey(potionNames, k, endKey = None) as Potion |
|
|
|
|
endif |
|
|
|
|
endwhile |
|
|
|
|
|
|
|
|
|
Int potionModels = ModelChangedPotions |
|
|
|
|
k = JFormMap.nextKey(potionModels, previousKey = None, endKey = None) as Potion |
|
|
|
|
while k != None |
|
|
|
|
k.SetWorldModelPath(JFormMap.getStr(potionModels, k)) |
|
|
|
|
k = JFormMap.nextKey(potionModels, k, endKey = None) as Potion |
|
|
|
|
endwhile |
|
|
|
|
|
|
|
|
|
EndFunction |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;===================================================================================== |
|
|
|
|
; EVENTS |
|
|
|
|
;===================================================================================== |
|
|
|
|
|
|
|
|
|
Event OnMenuOpen(String MenuName) |
|
|
|
|
|
|
|
|
|
If menuName == "Crafting Menu" |
|
|
|
|
GoToState("InCrafting") |
|
|
|
|
return |
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
if bHasJContainers |
|
|
|
|
Debug.Notification("InInventory") |
|
|
|
|
GoToState("InInventory") |
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
GoToState("InCrafting") |
|
|
|
|
EndEvent |
|
|
|
|
|
|
|
|
|
Event OnMenuClose(String MenuName) |
|
|
|
|
|
|
|
|
|
GoToState("") |
|
|
|
|
|
|
|
|
|
EndEvent |
|
|
|
|
|
|
|
|
|
State InCrafting |
|
|
|
|
Event OnBeginState() |
|
|
|
|
;Debug.Notification("RemoveAllInventoryEventFilters") |
|
|
|
|
RemoveAllInventoryEventFilters() |
|
|
|
|
EndEvent |
|
|
|
|
|
|
|
|
|
Event OnItemAdded(Form baseItem, int count, ObjectReference itemRef, ObjectReference source) |
|
|
|
|
|
|
|
|
|
Debug.Notification("Added " + baseItem.GetName()) |
|
|
|
|
|
|
|
|
|
Potion item = baseItem as Potion |
|
|
|
|
If item |
|
|
|
|
; Ignore not-custom potions (with FormID not starting with 0xFF) or already registered potions |
|
|
|
@ -496,35 +455,6 @@ State InCrafting |
|
|
|
|
_UpdatePotion(item, count) |
|
|
|
|
EndIf |
|
|
|
|
EndIf |
|
|
|
|
|
|
|
|
|
EndEvent |
|
|
|
|
|
|
|
|
|
Event OnEndState() |
|
|
|
|
if bHasJContainers && UI.IsMenuOpen("Crafting Menu") == false |
|
|
|
|
Debug.Notification("_UpdateInventoryFilters") |
|
|
|
|
_UpdateInventoryFilters() |
|
|
|
|
endif |
|
|
|
|
EndEvent |
|
|
|
|
EndState |
|
|
|
|
|
|
|
|
|
State InInventory |
|
|
|
|
Event OnItemRemoved(Form baseItem, int count, ObjectReference itemRef, ObjectReference dest) |
|
|
|
|
if dest != None |
|
|
|
|
return |
|
|
|
|
endif |
|
|
|
|
Debug.Notification("Removed " + baseItem.GetName()) |
|
|
|
|
; Probably a potion is consumed |
|
|
|
|
Potion item = baseItem as Potion |
|
|
|
|
if item |
|
|
|
|
; we want to prevent that all potions that have been brewed are collected in this list |
|
|
|
|
; and cause performance issues. So we risk that we loose track of them by removing them |
|
|
|
|
; from this list. In this case, the name will be the old vanilla skyrim one |
|
|
|
|
if (PlayerREF.getItemCount(item) == 0) |
|
|
|
|
JFormMap.removeKey(RenamedPotions, item) |
|
|
|
|
JFormMap.removeKey(ModelChangedPotions, item) |
|
|
|
|
RemoveInventoryEventFilter(baseItem) |
|
|
|
|
Endif |
|
|
|
|
Endif |
|
|
|
|
EndEvent |
|
|
|
|
EndState |
|
|
|
|
|
|
|
|
@ -535,9 +465,7 @@ EndEvent |
|
|
|
|
|
|
|
|
|
Event OnPlayerLoadGame() |
|
|
|
|
_InitAchemyControl() |
|
|
|
|
|
|
|
|
|
if bHasJContainers |
|
|
|
|
_RestorePotionAttributes() |
|
|
|
|
_UpdateInventoryFilters() |
|
|
|
|
_OnGameLoadJContainers() |
|
|
|
|
endif |
|
|
|
|
EndEvent |
|
|
|
|