Merge branch 'crafting-refactoring' into development

This commit is contained in:
Eddoursul 2022-07-26 20:50:03 +02:00
commit 8210468f79
43 changed files with 416 additions and 265 deletions

Binary file not shown.

View File

@ -2,10 +2,10 @@
<plugin version="0.7.4"> <plugin version="0.7.4">
<TES4 flags="0x00000081" id="00000000" day="0" month="0" lastUserID="0" currentUserID="0" version="44" unknown="0x0000"> <TES4 flags="0x00000081" id="00000000" day="0" month="0" lastUserID="0" currentUserID="0" version="44" unknown="0x0000">
<HEDR> <HEDR>
<struct version="1.70000005" numRecords="42830" nextObjectID="00014cf3" /> <struct version="1.70000005" numRecords="42831" nextObjectID="00014cf3" />
</HEDR> </HEDR>
<CNAM>Niseam</CNAM> <CNAM>Niseam</CNAM>
<SNAM>Enderal: Forgotten Stories (Special Edition) 2.0.11</SNAM> <SNAM>Enderal: Forgotten Stories (Special Edition) 2.0.12</SNAM>
<MAST>Skyrim.esm</MAST> <MAST>Skyrim.esm</MAST>
<DATA>0</DATA> <DATA>0</DATA>
<MAST>Update.esm</MAST> <MAST>Update.esm</MAST>
@ -140639,6 +140639,9 @@
<property name="Levelsystem" type="1" status="1"> <property name="Levelsystem" type="1" status="1">
<object formID="00010aa2" alias="65535" unused="0x0000" /> <object formID="00010aa2" alias="65535" unused="0x0000" />
</property> </property>
<property name="" type="1" status="1">
<object formID="000493b8" alias="65535" unused="0x0000" />
</property>
</script> </script>
<script name="_00E_StanceLoadFailsafeSC" status="0"> <script name="_00E_StanceLoadFailsafeSC" status="0">
<property name="_00E_Class_Vandal_P04_Talent_SkaraggianStance_02" type="1" status="1"> <property name="_00E_Class_Vandal_P04_Talent_SkaraggianStance_02" type="1" status="1">
@ -854073,6 +854076,20 @@
<LNAM>0202e68e</LNAM> <LNAM>0202e68e</LNAM>
<LNAM>0201e8fc</LNAM> <LNAM>0201e8fc</LNAM>
</FLST> </FLST>
<FLST flags="0x00000000" id="000493b8" day="0" month="0" lastUserID="0" currentUserID="0" version="44" unknown="0x0000">
<EDID>PlayerPerks</EDID>
<LNAM>000cb40d</LNAM>
<LNAM>000cb40e</LNAM>
<LNAM>000cb40f</LNAM>
<LNAM>000cb410</LNAM>
<LNAM>000cb411</LNAM>
<LNAM>000cb412</LNAM>
<LNAM>000cb413</LNAM>
<LNAM>000cb414</LNAM>
<LNAM>00052190</LNAM>
<LNAM>0202f218</LNAM>
<LNAM>0202f219</LNAM>
</FLST>
<FLST flags="0x00000000" id="00082f6e" day="0" month="0" lastUserID="0" currentUserID="0" version="44" unknown="0x0000"> <FLST flags="0x00000000" id="00082f6e" day="0" month="0" lastUserID="0" currentUserID="0" version="44" unknown="0x0000">
<EDID>TrapGasMagicDrawn</EDID> <EDID>TrapGasMagicDrawn</EDID>
<LNAM>00035d7f</LNAM> <LNAM>00035d7f</LNAM>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,19 @@
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 12
Scriptname PRKF__00E_CraftQuestPotionPe_0300146D Extends Perk Hidden
;BEGIN FRAGMENT Fragment_7
Function Fragment_7(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
if FS_NQ05.GetStage() >= 40
Game.GetPlayer().RemovePerk(Self)
return
endif
(FS_NQ05 as _00E_FS_NQ05_Functions).AskCreatePotion()
;END CODE
EndFunction
;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
Quest Property FS_NQ05 Auto

View File

@ -0,0 +1,19 @@
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 10
Scriptname PRKF__00E_FS_NQ07_CraftPotio_0300146E Extends Perk Hidden
;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
if FS_NQ07.GetStage() >= 120
Game.GetPlayer().RemovePerk(Self)
return
endif
(FS_NQ07 as _00E_FS_NQ07_Functions).AskCreatePotion()
;END CODE
EndFunction
;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
Quest Property FS_NQ07 Auto

View File

@ -0,0 +1,16 @@
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 3
Scriptname PRKF__00E_SE_2_0_12_UpgradeP_030090B3 Extends Perk Hidden
;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
if akTargetRef.IsActivationBlocked()
akTargetRef.Activate(akActor, true)
akTargetRef.BlockActivation(False)
endif
;END CODE
EndFunction
;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment

View File

@ -0,0 +1,26 @@
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 8
Scriptname PRKF__00E_SE_DismantlePerk_03009D21 Extends Perk Hidden
;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
int iButton = _00E_Smelting_DismantlingMSG.Show()
If iButton == 0 ; if the player wants to process ore into ingots
akTargetRef.Activate(akActor, true)
ElseIf iButton == 1 ; if the player wants to dismantle items back into crafting components, disable player controls
Game.DisablePlayerControls(true, true, true, true, true, true, true, true)
_00E_Dismantling_SmelterREF.Activate(akActor)
Else
return
EndIf
;END CODE
EndFunction
;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
Message Property _00E_Smelting_DismantlingMSG Auto
ObjectReference Property _00E_Dismantling_SmelterREF Auto

View File

@ -197,6 +197,22 @@ Function PrepareEnde4()
EndFunction EndFunction
Function AskCreatePotion()
Int qStage = Self.GetStage()
If qStage >= 30 && qStage < 40
If FS_NQ05_AlchemyMessagebox.Show() == 0
Self.SetStage(40)
PlayerREF.RemoveItem(Vynroot, 1)
PlayerREF.RemoveItem(SkeeverTail, 1)
PlayerREF.RemoveItem(MothWingMonarch, 1)
PlayerREF.RemoveItem(Garlic, 1)
PlayerREF.RemoveItem(_00E_FS_NQ05_Rezept, 1)
EndIf
EndIf
EndFunction
;===================================================================================== ;=====================================================================================
; EVENTS ; EVENTS
;===================================================================================== ;=====================================================================================
@ -267,3 +283,4 @@ Scene Property FS_NQ05_SceneTochter Auto
Scene Property FS_NQ05_SceneGoAway Auto Scene Property FS_NQ05_SceneGoAway Auto
Sound Property _00E_FS_NQ05_FemaleMumblingM Auto Sound Property _00E_FS_NQ05_FemaleMumblingM Auto
Message Property FS_NQ05_AlchemyMessagebox Auto

View File

@ -554,6 +554,20 @@ Function UpdateAarosCarryTraySpell() ; Version 2.0.8 Update
EndIf EndIf
EndFunction EndFunction
Function AskCreatePotion()
If Self.GetStage() == 115
If _00E_FS_NQ07_AlchemyMessagebox.Show() == 0
Self.SetStage(120)
PlayerREF.RemoveItem(FoodMead, 1)
PlayerREF.RemoveItem(FrostMirriam, 2)
PlayerREF.RemoveItem(FoodBananenschnaps, 1)
PlayerREF.RemoveItem(_00E_FS_NQ07_Rezept, 1)
EndIf
EndIf
EndFunction
;===================================================================================== ;=====================================================================================
; PROPERTIES ; PROPERTIES
@ -593,6 +607,7 @@ GlobalVariable Property _00E_AchievementsEnabled Auto
GlobalVariable Property _00E_TeleportGlobal Auto GlobalVariable Property _00E_TeleportGlobal Auto
Message Property _00E_FS_NQ07_Thoughts Auto Message Property _00E_FS_NQ07_Thoughts Auto
Message Property _00E_FS_NQ07_AlchemyMessagebox Auto
MiscObject Property Gold001 Auto MiscObject Property Gold001 Auto
MiscObject Property _00E_FS_NQ07_Borstenbeutel Auto MiscObject Property _00E_FS_NQ07_Borstenbeutel Auto
@ -651,10 +666,13 @@ ObjectReference Property _00E_FS_NQ07_AuroraTeleportMarkerREF Auto
ImageSpaceModifier Property MAGShockExpMassImod Auto ImageSpaceModifier Property MAGShockExpMassImod Auto
Potion Property FoodMead Auto Potion Property FoodMead Auto
Potion Property FoodBananenschnaps Auto
Potion Property _00E_DalSarkerHoneywine Auto Potion Property _00E_DalSarkerHoneywine Auto
Potion Property FoodChickenCooked Auto Potion Property FoodChickenCooked Auto
Potion Property FoodCabbagePotatoSoup Auto Potion Property FoodCabbagePotatoSoup Auto
Ingredient Property FrostMirriam Auto
Spell Property _00E_AbCarryDrinkTray_Old Auto Spell Property _00E_AbCarryDrinkTray_Old Auto
Spell Property _00E_AbCarryDrinkTray_New Auto Spell Property _00E_AbCarryDrinkTray_New Auto
Spell Property _00E_FS_NQ07_LightSpell Auto Spell Property _00E_FS_NQ07_LightSpell Auto

View File

@ -7,28 +7,5 @@ Message Property _00E_Smelting_DismantlingMSG Auto
Race Property _00E_Theriantrophist_PlayerWerewolfRace Auto Race Property _00E_Theriantrophist_PlayerWerewolfRace Auto
ObjectReference Property _00E_Dismantling_SmelterREF Auto ObjectReference Property _00E_Dismantling_SmelterREF Auto
Event OnInit() ; The script is obsolete as of 2.0.12 and has been replaced with a perk.
BlockActivation() ; Do not add it to new references.
Endevent
Event OnActivate(ObjectReference akActionRef)
; block the player from activating the smelter when being transformed in werewolf due to animation bugs
If akActionRef == PlayerREF && PlayerREF.GetRace() == _00E_Theriantrophist_PlayerWerewolfRace
_00E_Theriantrophist_CantCraftMSG.Show()
ElseIf akActionRef == PlayerREF && !(PlayerREF.GetRace() == _00E_Theriantrophist_PlayerWerewolfRace)
int iButton = _00E_Smelting_DismantlingMSG.Show()
If iButton == 0 ; if the player wants to process ore into ingots
Self.Activate(akActionRef, true)
ElseIf iButton == 1 ; if the player wants to dismantle items back into crafting components, disable player controls
Game.DisablePlayerControls(true, true, true, true, true, true, true, true)
_00E_Dismantling_SmelterREF.Activate(PlayerREF)
Else
return
EndIf
Else
Self.Activate(akActionRef, true) ; if it's not the player but an NPC
EndIf
Endevent

View File

@ -1,4 +1,4 @@
scriptname _00E_PlayerhousingMaster extends Quest scriptname _00E_PlayerhousingMaster extends Quest Conditional
Actor Property player Auto Actor Property player Auto
ReferenceAlias Property currentHousingObjectInTranslation Auto ReferenceAlias Property currentHousingObjectInTranslation Auto
@ -20,8 +20,8 @@ GlobalVariable Property _00E_DisableCraftingTutorials Auto
_00E_Playerhousing_Furniture currentHousingObject _00E_Playerhousing_Furniture currentHousingObject
Bool bIsInPlacementMode = False Bool Property bIsInPlacementMode = False Auto Conditional
Bool bDisableNormalActivation = False Bool Property bDisableNormalActivation = False Auto Conditional
Bool bGamepadMode = False Bool bGamepadMode = False
Bool bDroppedFromInventory = False Bool bDroppedFromInventory = False
Int iPickupKey Int iPickupKey

View File

@ -1,7 +1,7 @@
Scriptname _00E_PlayerSetUpScript extends ObjectReference Scriptname _00E_PlayerSetUpScript extends ObjectReference
{Initializes all the necessary Quests, maintains the player, contains various OnPlayerLoadGame() failsafes. This script is important for proper updating, do not overwrite it.} {Initializes all the necessary Quests, maintains the player, contains various OnPlayerLoadGame() failsafes. This script is important for proper updating, do not overwrite it.}
Float Property CURRENT_PATCH_VERSION = 2.11 AutoReadOnly Float Property CURRENT_PATCH_VERSION = 2.12 AutoReadOnly
;===================================================================================== ;=====================================================================================
@ -35,12 +35,16 @@ Event OnInit()
; starts all quests that are in the formlist ; starts all quests that are in the formlist
Int iIndex = QuestsToStart.GetSize() Int iIndex = QuestsToStart.GetSize()
While iIndex While iIndex > 0
iIndex -= 1 iIndex -= 1
Quest kQuest = QuestsToStart.GetAt(iIndex) as Quest Quest kQuest = QuestsToStart.GetAt(iIndex) as Quest
kQuest.Start() kQuest.Start()
endwhile endwhile
; Added in 2.0.12
AddPlayerPerks()
EndEvent EndEvent
Event OnPlayerLoadGame() Event OnPlayerLoadGame()
@ -148,6 +152,33 @@ Function Update_210()
EndFunction EndFunction
;=====================================================================================
; 2.0.12
;=====================================================================================
Function Update_212()
;
EndFunction
Function AddPlayerPerks()
if PlayerPerks == None
PlayerPerks = Game.GetForm(0x000493B8) as FormList
endif
Perk kPerk
int iIndex = PlayerPerks.GetSize()
While iIndex > 0
iIndex -= 1
kPerk = PlayerPerks.GetAt(iIndex) as Perk
if ! PlayerREF.HasPerk(kPerk)
PlayerREF.AddPerk(kPerk)
endif
endwhile
EndFunction
;===================================================================================== ;=====================================================================================
; ALL UPDATES ; ALL UPDATES
;===================================================================================== ;=====================================================================================
@ -177,7 +208,7 @@ Function FailsafeMQ05PrologueAliases()
; failsafe for issue 1536, fills empty aliases ; failsafe for issue 1536, fills empty aliases
If MQ05PrologueFunctions == None If MQ05PrologueFunctions == None
MQ05PrologueFunctions = Game.GetFormFromFile(0x00033A5B, "Skyrim.esm") as _00E_MQ05Prologue_Functions MQ05PrologueFunctions = Game.GetForm(0x00033A5B) as _00E_MQ05Prologue_Functions
EndIf EndIf
MQ05PrologueFunctions.FillEmptyAliasesFailsafe() MQ05PrologueFunctions.FillEmptyAliasesFailsafe()
@ -331,6 +362,9 @@ Function Maintenance()
If fPatchVersion < 2.10 If fPatchVersion < 2.10
Update_210() Update_210()
EndIf EndIf
If fPatchVersion < 2.12
Update_212()
EndIf
fPatchVersion = CURRENT_PATCH_VERSION fPatchVersion = CURRENT_PATCH_VERSION
endif endif
@ -339,21 +373,23 @@ Function Maintenance()
; this is called before active magic effects of potions or spells are applied to the player which could also alter the value ; this is called before active magic effects of potions or spells are applied to the player which could also alter the value
PlayerREF.SetActorValue("Healrate", 0) PlayerREF.SetActorValue("Healrate", 0)
; Workaround for broken physics on loading saves, made on a mount
If PlayerREF.IsOnMount()
PlayerREF.Dismount()
EndIf
EnableDisableKillmove() EnableDisableKillmove()
ResetArmorWeightPerks() ResetArmorWeightPerks()
AddPlayerPerks()
SetAutoSaveInterval() SetAutoSaveInterval()
FailsafeMQ05PrologueAliases() FailsafeMQ05PrologueAliases()
RefreshMountNamesOnLoad() RefreshMountNamesOnLoad()
; Workaround for broken physics on loading saves, made on a mount
If PlayerREF.IsOnMount()
PlayerREF.Dismount()
EndIf
; fixes properties that were accidentally set to NONE by the "More Affinities" mod ; fixes properties that were accidentally set to NONE by the "More Affinities" mod
If Game.GetModByName("Enderal_FS_More_Affinities.esp") != 255 If Game.GetModByName("Enderal_FS_More_Affinities.esp") != 255
FixMoreAffinitiesMod() FixMoreAffinitiesMod()
@ -372,6 +408,7 @@ _00E_MQ05Prologue_Functions Property MQ05PrologueFunctions Auto
Actor Property PlayerREF Auto Actor Property PlayerREF Auto
FormList Property QuestsToStart Auto FormList Property QuestsToStart Auto
FormList Property PlayerPerks Auto
GlobalVariable Property KillMove Auto GlobalVariable Property KillMove Auto

View File

@ -64,6 +64,8 @@ MagicEffect Property AlchFortifyTwoHanded Auto
MagicEffect Property AlchRestoreMagicka Auto MagicEffect Property AlchRestoreMagicka Auto
MagicEffect Property AlchRestoreStamina Auto MagicEffect Property AlchRestoreStamina Auto
FormList Property _00E_EmptyFormlist Auto
Int Property GreyAlchemist2PotionDurationLimitInSeconds = 180 Autoreadonly Hidden 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} {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 Int Property GreyAlchemist1PotionDurationLimitInSeconds = 120 Autoreadonly Hidden
@ -98,10 +100,10 @@ EndProperty
bool bDoneDarkBlood = false bool bDoneDarkBlood = false
bool bDoneChymikum = false bool bDoneChymikum = false
int PotionsMixedOnLastTest = 0 ; OBSOLETE AFTER 1.5.3.0. Needed for version update Int curScriptVersion = 0
int criticalSectionProcesses = 0 ; OBSOLETE AFTER 1.5.3.0. Needed for version update Int Property LATEST_SCRIPT_VERSION = 4 AutoReadOnly
FormList Property _00E_EmptyFormlist Auto bool bHasJContainers = false
;===================================================================================== ;=====================================================================================
@ -116,7 +118,10 @@ Function _UpdatePotion(Potion item, Int count)
Bool bIsTheriantrophistPotion = item.HasKeyword(_00E_Theriantrophist_Effect) Bool bIsTheriantrophistPotion = item.HasKeyword(_00E_Theriantrophist_Effect)
MagicEffect firstTheriantrophistEffect = None MagicEffect firstTheriantrophistEffect = None
If bIsTheriantrophistPotion ; FRESHLY BREWN THERIANTROPHIST POTION If bIsTheriantrophistPotion && EnderalLib.IsDLLLoaded() ; FRESHLY BREWN THERIANTROPHIST POTION
Debug.Notification("Replacing theriantrophist potion")
PlayerREF.removeItem(item, count, abSilent = true) PlayerREF.removeItem(item, count, abSilent = true)
Bool bRemoveTheriantrophistEffects = False Bool bRemoveTheriantrophistEffects = False
@ -190,26 +195,37 @@ Function _UpdatePotion(Potion item, Int count)
EndIf EndIf
Potion newPotion = EnderalLib.CreatePotion(newEffects, newMagnitudes, newAreas, newDurations, nNewEffects) Potion newPotion = EnderalLib.CreatePotion(newEffects, newMagnitudes, newAreas, newDurations, nNewEffects)
If JFormMap.hasKey(RenamedPotions, newPotion) == False
If bHasJContainers && JFormMap.hasKey(RenamedPotions, newPotion) == False
_RenamePotion(newPotion, newEffects, nNewEffects, bRemoveTheriantrophistEffects) _RenamePotion(newPotion, newEffects, nNewEffects, bRemoveTheriantrophistEffects)
_SetPotionModel(newPotion, firstTheriantrophistEffect, newEffects[0]) _SetPotionModel(newPotion, firstTheriantrophistEffect, newEffects[0])
EndIf EndIf
GoToState("") ; skip OnItemAdded
PlayerREF.addItem(newPotion, count, abSilent = true) PlayerREF.addItem(newPotion, count, abSilent = true)
GoToState("InCrafting")
If bRemoveTheriantrophistEffects == False If bRemoveTheriantrophistEffects == False
_UpdateNQ11(newPotion) _UpdateNQ11(newPotion)
EndIf EndIf
Else ; COMMON POTION return
_RenamePotion(item, potionEffects, nPotionEffects, True)
_SetPotionModel(item, None, potionEffects[0])
EndIf EndIf
if bHasJContainers && JFormMap.hasKey(RenamedPotions, item) == False ; COMMON POTION
_RenamePotion(item, potionEffects, nPotionEffects, True)
_SetPotionModel(item, None, potionEffects[0])
EndIf
if bIsTheriantrophistPotion
_UpdateNQ11(item)
endif
EndFunction EndFunction
Function _RenamePotion(Potion p, MagicEffect[] potionEffects, Int nPotionEffects, Bool bCommonPotion) Function _RenamePotion(Potion p, MagicEffect[] potionEffects, Int nPotionEffects, Bool bCommonPotion)
Debug.Notification("Renaming potion")
String name = "" String name = ""
If bCommonPotion If bCommonPotion
@ -349,117 +365,22 @@ EndFunction
Function _UpdateInventoryFilters() Function _UpdateInventoryFilters()
RemoveAllInventoryEventFilters()
AddInventoryEventFilter(_00E_EmptyFormlist) AddInventoryEventFilter(_00E_EmptyFormlist)
Form[] aPotions = JFormMap.allKeysPArray(RenamedPotions) Int potionNames = RenamedPotions
int i = aPotions.length Form k = JFormMap.nextKey(potionNames, previousKey = None, endKey = None)
while i > 0 while k != None
i -= 1 AddInventoryEventFilter(k)
AddInventoryEventFilter(aPotions[i]) k = JFormMap.nextKey(potionNames, k, endKey = None)
endwhile
aPotions = JFormMap.allKeysPArray(ModelChangedPotions)
i = aPotions.length
while i > 0
i -= 1
AddInventoryEventFilter(aPotions[i])
endwhile endwhile
EndFunction EndFunction
;===================================================================================== Function _RestorePotionAttributes()
; EVENTS Debug.Notification("Restoring potion names")
;=====================================================================================
Event OnMenuOpen(String MenuName)
If menuName == "Crafting Menu"
GoToState("InCrafting")
return
endif
GoToState("InInventory")
EndEvent
Event OnMenuClose(String MenuName)
GoToState("")
EndEvent
State InCrafting
Event OnBeginState()
RemoveAllInventoryEventFilters()
EndEvent
Event OnItemAdded(Form baseItem, int count, ObjectReference itemRef, ObjectReference source)
Potion item = baseItem as Potion
If item
; Ignore not-custom potions (with FormID not starting with 0xFF) or already registered potions
If (Math.LogicalAnd(item.GetFormID(), 0xFF000000) == 0xFF000000) && JFormMap.hasKey(RenamedPotions, item) == False
_UpdatePotion(item, count)
EndIf
EndIf
EndEvent
Event OnEndState()
_UpdateInventoryFilters()
EndEvent
EndState
State InInventory
Event OnItemRemoved(Form baseItem, int count, ObjectReference itemRef, ObjectReference dest)
if dest != None
return
endif
; 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
Int curScriptVersion = 0
Int Property LATEST_SCRIPT_VERSION = 4 AutoReadOnly
Event OnInit()
curScriptVersion = LATEST_SCRIPT_VERSION
RegisterForMenu("ContainerMenu")
RegisterForMenu("InventoryMenu")
RegisterForMenu("FavoritesMenu")
RegisterForMenu("Crafting Menu")
EndEvent
Event OnPlayerLoadGame()
GoToState("")
; Version update
If curScriptVersion < LATEST_SCRIPT_VERSION
Int oldScriptVersion = curScriptVersion
curScriptVersion = LATEST_SCRIPT_VERSION
If oldScriptVersion < 4
UnregisterForUpdate()
RegisterForMenu("ContainerMenu")
RegisterForMenu("InventoryMenu")
RegisterForMenu("FavoritesMenu")
RegisterForMenu("Crafting Menu")
_UpdateInventoryFilters()
EndIf
EndIf
; Restore names and models
Potion k Potion k
Int potionNames = RenamedPotions Int potionNames = RenamedPotions
@ -475,4 +396,148 @@ Event OnPlayerLoadGame()
k.SetWorldModelPath(JFormMap.getStr(potionModels, k)) k.SetWorldModelPath(JFormMap.getStr(potionModels, k))
k = JFormMap.nextKey(potionModels, k, endKey = None) as Potion k = JFormMap.nextKey(potionModels, k, endKey = None) as Potion
endwhile 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) )
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
; Version update
If curScriptVersion < LATEST_SCRIPT_VERSION
Int oldScriptVersion = curScriptVersion
curScriptVersion = LATEST_SCRIPT_VERSION
If oldScriptVersion < 4
;Debug.Notification("Updating AlchemyControl")
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")
Debug.Trace("JContainers is not loaded, renaming and changing potion models is disabled")
endif
RegisterForMenu("Crafting Menu")
EndFunction
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnMenuOpen(String MenuName)
If menuName == "Crafting Menu"
GoToState("InCrafting")
return
endif
if bHasJContainers
Debug.Notification("InInventory")
GoToState("InInventory")
endif
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
If (Math.LogicalAnd(item.GetFormID(), 0xFF000000) == 0xFF000000) && (!bHasJContainers || JFormMap.hasKey(RenamedPotions, item) == False)
_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
Event OnInit()
curScriptVersion = LATEST_SCRIPT_VERSION
_InitAchemyControl()
EndEvent
Event OnPlayerLoadGame()
_InitAchemyControl()
if bHasJContainers
_RestorePotionAttributes()
_UpdateInventoryFilters()
endif
EndEvent EndEvent

View File

@ -6,25 +6,15 @@ Race Property _00E_Theriantrophist_PlayerWerewolfRace Auto
Bool bActivationBlocked = False Bool bActivationBlocked = False
; This script is obsolete since 2.0.12 and has been replaced with a perk.
Event OnInit() ; Do not add it to new references.
BlockActivation(True)
EndEvent
Event OnActivate(ObjectReference akActionRef) Event OnActivate(ObjectReference akActionRef)
If akActionRef == PlayerREF ; Unlock activators, blocked by previous version of the script
If _00E_PlayerhousingMaster.ReferenceCanBeActivated(Self) && bActivationBlocked == False if IsActivationBlocked()
bActivationBlocked = True BlockActivation(False)
if Game.GetPlayer().GetRace() != _00E_Theriantrophist_PlayerWerewolfRace
If PlayerREF.GetRace() == _00E_Theriantrophist_PlayerWerewolfRace
_00E_Theriantrophist_CantCraftMSG.Show()
Else
Activate(akActionRef, true) Activate(akActionRef, true)
EndIf endif
endif
bActivationBlocked = False
EndIf
Else
Activate(akActionRef, true)
EndIf
EndEvent EndEvent

View File

@ -1,67 +1,22 @@
Scriptname _00E_Theriantrophist_SummonLabSC extends activemagiceffect Scriptname _00E_Theriantrophist_SummonLabSC extends activemagiceffect
ObjectReference Property _00E_Theriantrophist_SummonPortableLaboratory_Target Auto
Event OnEffectStart(Actor akTarget, Actor akCaster) Event OnEffectStart(Actor akTarget, Actor akCaster)
if PlayerREF.GetRace() == _00E_Theriantrophist_PlayerWerewolfRace if PlayerREF.GetRace() == _00E_Theriantrophist_PlayerWerewolfRace
_00E_Theriantrophist_CantCraftMSG.Show() _00E_Theriantrophist_CantCraftMSG.Show()
else else
CheckforQuestPotions() (FS_NQ05 as _00E_FS_NQ05_Functions).AskCreatePotion()
(FS_NQ07 as _00E_FS_NQ07_Functions).AskCreatePotion()
Utility.Wait(1.0) Utility.Wait(1.0)
_00E_Theriantrophist_SummonPortableLaboratory_Target.activate(PlayerREF, true) _00E_Theriantrophist_SummonPortableLaboratory_Target.activate(PlayerREF, true)
endif endif
EndEvent EndEvent
Function CheckforQuestPotions() ObjectReference Property _00E_Theriantrophist_SummonPortableLaboratory_Target Auto
If (FS_NQ05.GetStage() < 40 && FS_NQ05.GetStage() >= 30)
int iButton1 = FS_NQ05_AlchemyMessagebox.Show()
if iButton1 == 0
PlayerREF.RemoveItem(Vynroot, 1)
PlayerREF.RemoveItem(SkeeverTail, 1)
PlayerREF.RemoveItem(MothWingMonarch, 1)
PlayerREF.RemoveItem(Garlic, 1)
PlayerREF.RemoveItem(_00E_FS_NQ05_Rezept, 1)
FS_NQ05.SetStage(40)
ElseIf iButton1 == 1
;
EndIf
Endif
If (FS_NQ07.GetStage() == 115)
int iButton2 = _00E_FS_NQ07_AlchemyMessagebox.Show()
if iButton2 == 0
PlayerREF.RemoveItem(FoodMead, 1)
PlayerREF.RemoveItem(FrostMirriam, 2)
PlayerREF.RemoveItem(FoodBananenschnaps, 1)
PlayerREF.RemoveItem(_00E_FS_NQ07_Rezept, 1)
FS_NQ07.SetStage(120)
ElseIf iButton2 == 1
;
EndIf
EndIf
EndFunction
Actor Property PlayerREF Auto Actor Property PlayerREF Auto
Message Property _00E_Theriantrophist_CantCraftMSG Auto Message Property _00E_Theriantrophist_CantCraftMSG Auto
Race Property _00E_Theriantrophist_PlayerWerewolfRace Auto Race Property _00E_Theriantrophist_PlayerWerewolfRace Auto
Quest Property FS_NQ05 Auto Quest Property FS_NQ05 Auto
Book Property _00E_FS_NQ05_Rezept Auto
Ingredient Property Vynroot Auto
Ingredient Property SkeeverTail Auto
Ingredient Property MothWingMonarch Auto
Ingredient Property Garlic Auto
Message Property FS_NQ05_AlchemyMessagebox Auto
Quest Property FS_NQ07 Auto Quest Property FS_NQ07 Auto
Book Property _00E_FS_NQ07_Rezept Auto
Potion Property FoodMead Auto
Ingredient Property FrostMirriam Auto
Potion Property FoodBananenschnaps Auto
Message Property _00E_FS_NQ07_AlchemyMessagebox Auto

View File

@ -26,12 +26,16 @@ Event OnEffectStart(Actor akTarget, Actor akCaster)
Endif Endif
_00E_Theriantrophist_PlayerAsWerewolf playerWhileTransformedAlias = controlQuest.playerWhileTransformed _00E_Theriantrophist_PlayerAsWerewolf playerWhileTransformedAlias = controlQuest.playerWhileTransformed
if _00E_FS_Theriantrophist_AllowTemporaryTransform.GetValueInt() == 0 if _00E_FS_Theriantrophist_AllowTemporaryTransform.GetValueInt() == 0
if !playerWhileTransformedAlias.CanBeTransformed(akTarget.getCurrentLocation()) if !playerWhileTransformedAlias.CanBeTransformed(akTarget.getCurrentLocation())
if EnderalLib.IsDLLLoaded()
Debug.Notification(_00E_Theriantrophist_ForceTransformBackMessage.getName()) Debug.Notification(_00E_Theriantrophist_ForceTransformBackMessage.getName())
_RestorePotion() _RestorePotion()
else
; TODO: Replace the string with a localizable message.
Debug.Notification("You cannot transform here.")
endif
self.dispel() self.dispel()
return return
Endif Endif

View File

@ -2,4 +2,8 @@ Scriptname EnderalLib Hidden
float function calculateContentStrength(ObjectReference container) native global float function calculateContentStrength(ObjectReference container) native global
Potion Function CreatePotion(MagicEffect[] effects, float[] magnitudes, int[] areas, int[] durations, int arraySize) native global Potion function CreatePotion(MagicEffect[] effects, float[] magnitudes, int[] areas, int[] durations, int arraySize) native global
bool function IsDLLLoaded() global
return (SKSE.GetPluginVersion("fs_skse_functions") != -1)
endfunction

View File

@ -12,22 +12,4 @@ Message Property FS_NQ05_AlchemyMessagebox Auto
Bool bActivationBlocked = False Bool bActivationBlocked = False
Event OnActivate(ObjectReference akActionRef) ; This script is obsolete as of 2.0.12, replaced with a perk
If akActionRef == PlayerREF && _00E_PlayerhousingMaster.ReferenceCanBeActivated(Self) && bActivationBlocked == False
bActivationBlocked = True
Int qStage = FS_NQ05.GetStage()
If qStage >= 30 && qStage < 40
If FS_NQ05_AlchemyMessagebox.Show() == 0
FS_NQ05.SetStage(40)
PlayerREF.RemoveItem(Nirnroot, 1)
PlayerREF.RemoveItem(SkeeverTail, 1)
PlayerREF.RemoveItem(MothWingMonarch, 1)
PlayerREF.RemoveItem(Garlic, 1)
PlayerREF.RemoveItem(FS_NQ05_Rezept, 1)
EndIf
EndIf
bActivationBlocked = False
EndIf
EndEvent

View File

@ -11,21 +11,4 @@ Message Property _00E_FS_NQ07_AlchemyMessagebox Auto
Bool bActivationBlocked = False Bool bActivationBlocked = False
; This script is obsolete as of 2.0.12, replaced with a perk
Event OnActivate(ObjectReference akActionRef)
If akActionRef == PlayerREF && _00E_PlayerhousingMaster.ReferenceCanBeActivated(Self) && bActivationBlocked == False
bActivationBlocked = True
If FS_NQ07.GetStage() == 115
If _00E_FS_NQ07_AlchemyMessagebox.Show() == 0
PlayerREF.RemoveItem(FoodMead, 1)
PlayerREF.RemoveItem(FrostMirriam, 2)
PlayerREF.RemoveItem(FoodBananenschnaps, 1)
PlayerREF.RemoveItem(_00E_FS_NQ07_Rezept, 1)
FS_NQ07.SetStage(120)
EndIf
EndIf
bActivationBlocked = False
EndIf
EndEvent

View File

@ -0,0 +1,15 @@
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 6
Scriptname PRKF__00E_FS_WerewolfPrevent_0300146D Extends Perk Hidden
;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
_00E_Theriantrophist_CantCraftMSG.Show()
;END CODE
EndFunction
;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
Message Property _00E_Theriantrophist_CantCraftMSG Auto

View File

@ -69,6 +69,7 @@ SetObjectiveCompleted(37)
SetObjectiveCompleted(38) SetObjectiveCompleted(38)
SetObjectiveCompleted(39) SetObjectiveCompleted(39)
SetObjectiveDisplayed(40) SetObjectiveDisplayed(40)
Game.GetPlayer().RemovePerk(_00E_FS_NQ05_CraftPotionPerk)
kmyQuest.MoveMirellStandby() kmyQuest.MoveMirellStandby()
;END CODE ;END CODE
EndFunction EndFunction
@ -331,6 +332,7 @@ Function Fragment_12()
;BEGIN CODE ;BEGIN CODE
SetObjectivecompleted(20) SetObjectivecompleted(20)
SetObjectiveDisplayed(30) SetObjectiveDisplayed(30)
Game.GetPlayer().AddPerk(_00E_FS_NQ05_CraftPotionPerk)
;END CODE ;END CODE
EndFunction EndFunction
;END FRAGMENT ;END FRAGMENT
@ -369,3 +371,4 @@ EndFunction
;END FRAGMENT CODE - Do not edit anything between this and the begin comment ;END FRAGMENT CODE - Do not edit anything between this and the begin comment
GlobalVariable Property _00E_AchievementsEnabled Auto GlobalVariable Property _00E_AchievementsEnabled Auto
Perk Property _00E_FS_NQ05_CraftPotionPerk Auto

View File

@ -97,6 +97,7 @@ _00E_FS_NQ07_Functions kmyQuest = __temp as _00E_FS_NQ07_Functions
SetObjectiveDisplayed(35) SetObjectiveDisplayed(35)
SetObjectiveCompleted(20) SetObjectiveCompleted(20)
kmyQuest.GivePlayerCraftingPlan() kmyQuest.GivePlayerCraftingPlan()
Game.GetPlayer().AddPerk(_00E_FS_NQ07_CraftPotionPerk)
;END CODE ;END CODE
EndFunction EndFunction
;END FRAGMENT ;END FRAGMENT
@ -470,6 +471,7 @@ Quest __temp = self as Quest
_00E_FS_NQ07_Functions kmyQuest = __temp as _00E_FS_NQ07_Functions _00E_FS_NQ07_Functions kmyQuest = __temp as _00E_FS_NQ07_Functions
;END AUTOCAST ;END AUTOCAST
;BEGIN CODE ;BEGIN CODE
Game.GetPlayer().RemovePerk(_00E_FS_NQ07_CraftPotionPerk)
kmyQuest.CleanAuroraHome() kmyQuest.CleanAuroraHome()
SetObjectiveCompleted(30) SetObjectiveCompleted(30)
SetObjectiveDisplayed(40) SetObjectiveDisplayed(40)
@ -605,3 +607,5 @@ EndFunction
;END FRAGMENT ;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment ;END FRAGMENT CODE - Do not edit anything between this and the begin comment
Perk Property _00E_FS_NQ07_CraftPotionPerk Auto