diff --git a/BondageClub/Screens/Inventory/ItemMisc/CombinationPadlock/CombinationPadlock.js b/BondageClub/Screens/Inventory/ItemMisc/CombinationPadlock/CombinationPadlock.js index 07a2b8795bc4c0379a352a6710635296f37be373..20f6e15210cdea8ca44ed1879c2813741a1fe878 100644 --- a/BondageClub/Screens/Inventory/ItemMisc/CombinationPadlock/CombinationPadlock.js +++ b/BondageClub/Screens/Inventory/ItemMisc/CombinationPadlock/CombinationPadlock.js @@ -3,14 +3,22 @@ let CombinationPadlockPlayerIsBlind = false; let CombinationPadlockBlindCombinationOffset = null; let CombinationPadlockCombinationLastValue = ""; let CombinationPadlockNewCombinationLastValue = ""; +let CombinationPadlockLoaded = false; // Loads the item extension properties function InventoryItemMiscCombinationPadlockLoad() { CombinationPadlockPlayerIsBlind = Player.IsBlind(); - CombinationPadlockCombinationLastValue = ""; - CombinationPadlockNewCombinationLastValue = ""; - if (CombinationPadlockPlayerIsBlind && CombinationPadlockBlindCombinationOffset == null) { - CombinationPadlockBlindCombinationOffset = Math.floor(Math.random() * 10); + // Only update on initial load, not update loads + if (!CombinationPadlockLoaded) { + CombinationPadlockCombinationLastValue = ""; + CombinationPadlockNewCombinationLastValue = ""; + } + if (CombinationPadlockPlayerIsBlind) { + if (CombinationPadlockBlindCombinationOffset == null) { + CombinationPadlockBlindCombinationOffset = Math.floor(Math.random() * 10); + } + } else { + CombinationPadlockBlindCombinationOffset = null; } var C = CharacterGetCurrent(); @@ -36,14 +44,19 @@ function InventoryItemMiscCombinationPadlockLoad() { ) { combinationInput.setAttribute("placeholder", DialogFocusSourceItem.Property.CombinationNumber); } + } else { + document.getElementById('CombinationNumber').type = CombinationPadlockPlayerIsBlind ? "password" : "text"; } if (newCombinationInput) { newCombinationInput.autocomplete = "off"; newCombinationInput.pattern = "\\d*"; newCombinationInput.type = CombinationPadlockPlayerIsBlind ? "password" : "text"; newCombinationInput.addEventListener("input", InventoryItemMiscCombinationPadlockModifyInput); + } else { + document.getElementById('NewCombinationNumber').type = CombinationPadlockPlayerIsBlind ? "password" : "text"; } } + CombinationPadlockLoaded = true; } function InventoryItemMiscCombinationPadlockModifyInput(e) { @@ -85,10 +98,7 @@ function InventoryItemMiscCombinationPadlockDraw() { const playerBlind = Player.IsBlind(); if (playerBlind !== CombinationPadlockPlayerIsBlind) { - CombinationPadlockPlayerIsBlind = playerBlind; - CombinationPadlockBlindCombinationOffset = playerBlind ? Math.floor(Math.random() * 10) : null; - document.getElementById("CombinationNumber").type = playerBlind ? "password" : "text"; - document.getElementById("NewCombinationNumber").type = playerBlind ? "password" : "text"; + InventoryItemMiscCombinationPadlockLoad(); } DrawText( @@ -210,6 +220,7 @@ function InventoryItemMiscCombinationPadlockClick() { } function InventoryItemMiscCombinationPadlockExit() { + CombinationPadlockLoaded = false; ElementRemove("CombinationNumber"); ElementRemove("NewCombinationNumber"); PreferenceMessage = "";