diff --git a/Bottle Rinse Repeat.esp b/Bottle Rinse Repeat.esp index d868622..9142abe 100644 Binary files a/Bottle Rinse Repeat.esp and b/Bottle Rinse Repeat.esp differ diff --git a/config/Bottle Rinse Repeat.ini b/config/Bottle Rinse Repeat.ini index 9006f18..a78204a 100644 --- a/config/Bottle Rinse Repeat.ini +++ b/config/Bottle Rinse Repeat.ini @@ -1,2 +1,4 @@ [Settings] -bFillBottleDelay = 1 +iFillBottleDelay = 1 +bReplenishableCanteen = 1 +iReplenishableCanteenMaxSips = 4 diff --git a/src/EBxBootstrap.gek b/src/EBxBootstrap.gek index 251e2f8..aee190b 100644 --- a/src/EBxBootstrap.gek +++ b/src/EBxBootstrap.gek @@ -26,7 +26,12 @@ begin function {} ; INI settings if FileExists "config\Bottle Rinse Repeat.ini" - set EBxFillBottleDelay to GetINIFloat "Settings:bFillBottleDelay" "Bottle Rinse Repeat.ini" + let EBxFillBottleDelay := GetINIFloat "Settings:iFillBottleDelay" "Bottle Rinse Repeat.ini" + let EBxReplenishableCanteen := GetINIFloat "Settings:bReplenishableCanteen" "Bottle Rinse Repeat.ini" + let EBxCanteenSipsMax := GetINIFloat "Settings:iReplenishableCanteenMaxSips" "Bottle Rinse Repeat.ini" + if EBxCanteenSipsMax < 1 + let EBxCanteenSipsMax := 4 + endif endif ; Add new items to form lists @@ -61,17 +66,43 @@ begin function {} ; Vault 13 Canteen - if IsModLoaded "ClassicPack.esm" + if eval EBxReplenishableCanteen && IsModLoaded "ClassicPack.esm" + let rItem := GetFormFromMod "FalloutNV.esm" "174095" ; PreordVault13CanteenQuest if IsFormValid rItem RemoveScript rItem endif + let rItem := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen if IsFormValid rItem - SetScript EBxPreordVault13CanteenScript rItem + if eval $rItem == "Vault 13 Canteen" + SetName "Empty Vault 13 Canteen" rItem + endif endif + endif + ; Vault 13 Canteen effect + + SetOnUseAidItemEventHandler (begin function { ref rEBxVault13Canteen } + if this == playerRef + if eval ref rEffect := ListGetNthForm EBxCanteenEffects EBxCanteenDrink + playerRef.CIOS rEffect + else + playerRef.CIOS WaterPurified + endif + if playerRef.GetItemCount EBxVault13Canteen == 0 + let ref rCanteen := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen + if IsFormValid rCanteen + playerRef.AddItem rCanteen 1 1 + if MenuMode + RefreshItemsList + endif + endif + endif + endif + end) 1 EBxVault13Canteen + ; Draining on middle click ; Short callback notation with SetOnKeyUp/DownEventHandler currently throws an exception with xNVSE 6.20 + JIP LN 56.31 @@ -82,18 +113,6 @@ begin function {} SetOnMenuCloseEventHandler (begin function { i } SetOnKeyUpEventHandler EBxOnMiddleClick 0 258 end) 1 1002 - - ; Vault 13 Canteen effect - - SetOnUseAidItemEventHandler (begin function { rItem } - if this == playerRef - if eval rItem := ListGetNthForm EBxCanteenEffects EBxCanteenDrink - playerRef.CIOS rItem - else - playerRef.CIOS WaterPurified - endif - endif - end) 1 EBxVault13Canteen ; SSBottleEmptyNoFloat @@ -139,7 +158,7 @@ begin function {} ; Enable brahmin milking if EBxTTW - set rBrahminScriptDC to GetFormFromMod "Fallout3.esm" "38705" ; CRBrahminScriptDC + let rBrahminScriptDC := GetFormFromMod "Fallout3.esm" "38705" ; CRBrahminScriptDC endif GetLoadedType rList 43 diff --git a/src/EBxFillFromObject.gek b/src/EBxFillFromObject.gek index a75fe64..50f0fe8 100644 --- a/src/EBxFillFromObject.gek +++ b/src/EBxFillFromObject.gek @@ -28,8 +28,6 @@ begin function { rSource } call EBxReplaceFormListWithItem rDrink rReplaceables - if EBxCanteenSipsMax > 0 - call EBxReplenishCanteen rDrink 0 - endif + call EBxReplenishCanteen rDrink 0 end diff --git a/src/EBxOnCrosshair.gek b/src/EBxOnCrosshair.gek index 187c817..92a218d 100644 --- a/src/EBxOnCrosshair.gek +++ b/src/EBxOnCrosshair.gek @@ -35,7 +35,7 @@ begin function { rSource } if iCount > 0 let sBottles := sv_construct "%g bottle%{s%}" iCount (iCount > 1) - elseif eval EBxCanteenSipsMax > 0 && call EBxReplenishCanteen rDrink 1 + elseif call EBxReplenishCanteen rDrink 1 let sBottles := "canteen" else return diff --git a/src/EBxOnGameLoad.gek b/src/EBxOnGameLoad.gek index f94a027..8d71c81 100644 --- a/src/EBxOnGameLoad.gek +++ b/src/EBxOnGameLoad.gek @@ -26,6 +26,21 @@ begin function { i } endif endif + if EBxVersion < 31 + let EBxVersion := 31 + if IsModLoaded "ClassicPack.esm" + let ref rPreordQuest := GetFormFromMod "FalloutNV.esm" "17912D" ; VDLCPackQuest + if eval IsFormValid rPreordQuest && GetVariable "bClassicItemsGiven" rPreordQuest + if playerRef.GetItemCount EBxVault13Canteen == 0 + let ref rPreordVaultCanteen := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen + if eval IsFormValid rPreordVaultCanteen && playerRef.GetItemCount rPreordVaultCanteen == 0 + playerRef.AddItem rPreordVaultCanteen 1 1 + endif + endif + endif + endif + endif + if GetGameRestarted == 0 return endif diff --git a/src/EBxReplenishCanteen.gek b/src/EBxReplenishCanteen.gek index 97dd2f7..5c5954d 100644 --- a/src/EBxReplenishCanteen.gek +++ b/src/EBxReplenishCanteen.gek @@ -3,12 +3,24 @@ scn EBxReplenishCanteen ref rNewDrink ref rCurrentDrink ref rCanteen +ref rPreordVaultCanteen int iCount int iNewDrink int bCheckOnly begin function { rNewDrink, bCheckOnly } + if EBxReplenishableCanteen == 0 + return + endif + + if playerRef.GetItemCount EBxVault13Canteen == 0 + let ref rPreordVaultCanteen := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen + if eval ! IsFormValid rPreordVaultCanteen || playerRef.GetItemCount rPreordVaultCanteen == 0 + return + endif + endif + let iNewDrink := ListGetFormIndex EBxCanteenEffects rNewDrink if iNewDrink == -1 ; unknown type, fallback to Purified Water @@ -38,6 +50,10 @@ begin function { rNewDrink, bCheckOnly } endif if iCount > 0 + let rPreordVaultCanteen := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen + if IsFormValid rPreordVaultCanteen + playerRef.RemoveItem rPreordVaultCanteen 1 1 + endif playerRef.AddItem EBxVault13Canteen iCount 1 endif