From 5b10ed50e7aeb0618e85a9402f01be43e87257e2 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Emmanuel Zorg <zorgjeanbe@proton.me>
Date: Wed, 26 Mar 2025 22:21:02 +0100
Subject: [PATCH] Fix the Dojo daily job deleting owner locks on release

Instead of just blanket-releasing the player, just remove the two
assets we've put on. Technically, the dialog should also restore the
player's initial appearance, since they also get CharacterNaked called
upon them, but that's more involved.
---
 .../MiniGame/DojoStruggle/DojoStruggle.js     |  1 -
 BondageClub/Screens/Room/DailyJob/DailyJob.js | 25 +++++++++++++++----
 BondageClub/Scripts/Inventory.js              |  3 ++-
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/BondageClub/Screens/MiniGame/DojoStruggle/DojoStruggle.js b/BondageClub/Screens/MiniGame/DojoStruggle/DojoStruggle.js
index c88f970ef4..fe23c4001f 100644
--- a/BondageClub/Screens/MiniGame/DojoStruggle/DojoStruggle.js
+++ b/BondageClub/Screens/MiniGame/DojoStruggle/DojoStruggle.js
@@ -39,7 +39,6 @@ function DojoStruggleRun() {
 
 		// The game ends after 71 seconds with a victory
 		if (MiniGameTimer >= 71000) {
-			CharacterRelease(Player);
 			MiniGameVictory = true;
 			MiniGameEnded = true;
 		} else {
diff --git a/BondageClub/Screens/Room/DailyJob/DailyJob.js b/BondageClub/Screens/Room/DailyJob/DailyJob.js
index 1e42cb43ba..093306257b 100644
--- a/BondageClub/Screens/Room/DailyJob/DailyJob.js
+++ b/BondageClub/Screens/Room/DailyJob/DailyJob.js
@@ -201,10 +201,10 @@ function DailyJobPuppyPlayer() {
  * @returns {void} - Nothing
  */
 function DailyJobDojoRestrainPlayer() {
-	InventoryWear(Player, "HempRope", "ItemArms", "Default", 7);
-	if (InventoryGet(Player, "ItemTorso") == null) {
-		const item = InventoryWear(Player, "HempRopeHarness", "ItemTorso", "Default", 7);
-		TypedItemSetOptionByName(Player, item, "Harness");
+	InventoryWear(Player, "HempRope", "ItemArms", "Default", undefined, undefined, undefined, false);
+	if (!InventoryGet(Player, "ItemTorso")) {
+		const item = InventoryWear(Player, "HempRopeHarness", "ItemTorso", "Default", undefined, undefined, undefined, false);
+		TypedItemSetOptionByName(Player, item, "Harness", false);
 	}
 	CharacterRefresh(Player);
 }
@@ -223,9 +223,24 @@ function DailyJobDojoGameStart() {
  */
 function DailyJobDojoGameEnd() {
 	CommonSetScreen("Room", "DailyJob");
+
 	DailyJobDojoTeacher.Stage = (MiniGameVictory) ? "100" : "200";
 	CharacterSetCurrent(DailyJobDojoTeacher);
-	if (MiniGameVictory) IntroductionJobDone();
+	if (MiniGameVictory) {
+		IntroductionJobDone();
+		let refresh = false;
+		if (InventoryGet(Player, "ItemArms")?.Asset.Name === "HempRope") {
+			InventoryRemove(Player, "ItemArms", false);
+			refresh = true;
+		}
+		if (InventoryGet(Player, "ItemTorso")?.Asset.Name === "HempRopeHarness") {
+			InventoryRemove(Player, "ItemTorso", false);
+			refresh = true;
+		}
+		if (refresh) {
+			CharacterRefresh(Player);
+		}
+	}
 	IntroductionMaid.Stage = "0";
 	DailyJobDojoTeacher.CurrentDialog = DialogFind(DailyJobDojoTeacher, (MiniGameVictory) ? "DojoStruggleVictory" : "DojoStruggleDefeat");
 }
diff --git a/BondageClub/Scripts/Inventory.js b/BondageClub/Scripts/Inventory.js
index 56bbcda1a5..78235649ba 100644
--- a/BondageClub/Scripts/Inventory.js
+++ b/BondageClub/Scripts/Inventory.js
@@ -809,7 +809,8 @@ var InventoryWearCraft = /** @type {never} */(function() { return; });
 function InventoryWear(C, AssetName, AssetGroup, ItemColor, Difficulty, MemberNumber, Craft, Refresh=true) {
 	const A = AssetGet(C.AssetFamily, AssetGroup, AssetName);
 	if (!A) return null;
-	const item = CharacterAppearanceSetItem(C, AssetGroup, A, (ItemColor == null || ItemColor == "Default") ? [...A.DefaultColor] : ItemColor, Difficulty, MemberNumber, false);
+	const color = (ItemColor == null || ItemColor == "Default") ? [...A.DefaultColor] : ItemColor;
+	const item = CharacterAppearanceSetItem(C, AssetGroup, A, color, Difficulty, MemberNumber, false);
 
 	/**
 	 * TODO: grant tighter control over setting expressions.