From cb5fe9cf9b86fe458d7d9159199e0d14f18d0473 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 26 Dec 2020 22:57:52 -0500
Subject: [PATCH] combine vibe and smart check

---
 js/003-data/slaveWearData.js                    |  8 +++-----
 src/endWeek/saSmartPiercingEffects.js           |  2 +-
 src/interaction/siRules.js                      |  2 +-
 src/js/itemAvailability.js                      |  2 +-
 src/js/utilsAssessSlave.js                      | 15 +++------------
 src/npc/descriptions/crotch/vaginalAccessory.js | 13 +++++++------
 6 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/js/003-data/slaveWearData.js b/js/003-data/slaveWearData.js
index 526692b09d2..5ef2544a4d2 100644
--- a/js/003-data/slaveWearData.js
+++ b/js/003-data/slaveWearData.js
@@ -1223,8 +1223,7 @@ App.Data.buttplugs = new Map([
  * @property {boolean} [requirements]
  * @property {0|1|2|3} width
  * @property {0|1|2} length
- * @property {boolean} [smart]
- * @property {boolean} [vibrates]
+ * @property {0|1|2} [vibrates] 0: none, 1: standard, 2: "smart" vibe
  */
 
 /**
@@ -1243,7 +1242,7 @@ App.Data.vaginalAccessories = new Map([
 			name: "Bullet vibrator",
 			width: 0,
 			length: 1,
-			vibrates: true
+			vibrates: 1
 		}
 	],
 	["smart bullet vibrator",
@@ -1254,8 +1253,7 @@ App.Data.vaginalAccessories = new Map([
 			},
 			width: 0,
 			length: 1,
-			smart: true,
-			vibrates: true
+			vibrates: 2
 		}
 	],
 	["dildo",
diff --git a/src/endWeek/saSmartPiercingEffects.js b/src/endWeek/saSmartPiercingEffects.js
index b0c5d0fd4b7..56bdc815258 100644
--- a/src/endWeek/saSmartPiercingEffects.js
+++ b/src/endWeek/saSmartPiercingEffects.js
@@ -409,7 +409,7 @@ App.SlaveAssignment.SmartPiercing.sadist = class extends App.SlaveAssignment.Sma
 App.SlaveAssignment.saSmartPiercingEffects = function(slave) {
 	const {he, his, His, him} = getPronouns(slave);
 	const hasBV = slave.vaginalAccessory === "bullet vibrator" || slave.dickAccessory === "bullet vibrator";
-	const hasSmartBV = dildoSmart(slave) || slave.dickAccessory === "smart bullet vibrator";
+	const hasSmartBV = dildoVibeLevel(slave) > 1 || slave.dickAccessory === "smart bullet vibrator";
 	const hasDildoVibe = slave.vaginalAttachment === "vibrator";
 	const hasSmartDildoVibe = slave.vaginalAttachment === "smart vibrator";
 	const hasSP = slave.clitPiercing === 3;
diff --git a/src/interaction/siRules.js b/src/interaction/siRules.js
index 3fc93bf4752..2d96e64db46 100644
--- a/src/interaction/siRules.js
+++ b/src/interaction/siRules.js
@@ -374,7 +374,7 @@ App.UI.SlaveInteract.rules = function(slave) {
 
 	function smartSettings(slave) {
 		let el = document.createElement('div');
-		const smartBulletVibe = dildoSmart(slave) || slave.dickAccessory === "smart bullet vibrator";
+		const smartBulletVibe = dildoVibeLevel(slave) > 1 || slave.dickAccessory === "smart bullet vibrator";
 		const smartDildoVibe = slave.vaginalAttachment === "smart vibrator";
 
 		if (slave.clitPiercing === 3 || smartBulletVibe || smartDildoVibe) {
diff --git a/src/js/itemAvailability.js b/src/js/itemAvailability.js
index 045fa9ed0ca..67115860977 100644
--- a/src/js/itemAvailability.js
+++ b/src/js/itemAvailability.js
@@ -226,7 +226,7 @@ globalThis.isItemAccessible = (function() {
 							return "No vaginal accessory to attach it to";
 						} else if (dildoWidth(slave) === 0) {
 							return "Vaginal accessory is too small";
-						} else if (dildoVibrates(slave)) {
+						} else if (dildoVibeLevel(slave)) {
 							return "Vaginal accessory already vibrates";
 						} else {
 							return true;
diff --git a/src/js/utilsAssessSlave.js b/src/js/utilsAssessSlave.js
index 9fcd3b5b0bb..acd47c0bf2b 100644
--- a/src/js/utilsAssessSlave.js
+++ b/src/js/utilsAssessSlave.js
@@ -305,18 +305,9 @@ globalThis.dildoLength = function(slave) {
 
 /**
  * @param {App.Entity.SlaveState} slave
- * @returns {boolean}
- */
-globalThis.dildoSmart = function(slave) {
-	const dildo = App.Data.vaginalAccessories.get(slave.vaginalAccessory) || V.customItem.vaginalAccessories.get(slave.vaginalAccessory);
-	return dildo.smart || false;
-};
-
-/**
- * @param {App.Entity.SlaveState} slave
- * @returns {boolean}
+ * @returns {number}
  */
-globalThis.dildoVibrates = function(slave) {
+globalThis.dildoVibeLevel = function(slave) {
 	const dildo = App.Data.vaginalAccessories.get(slave.vaginalAccessory) || V.customItem.vaginalAccessories.get(slave.vaginalAccessory);
-	return dildo.vibrates || false;
+	return dildo.vibrates || 0;
 };
diff --git a/src/npc/descriptions/crotch/vaginalAccessory.js b/src/npc/descriptions/crotch/vaginalAccessory.js
index 735036f02d0..8d98cadd1b8 100644
--- a/src/npc/descriptions/crotch/vaginalAccessory.js
+++ b/src/npc/descriptions/crotch/vaginalAccessory.js
@@ -99,24 +99,25 @@ App.Desc.vaginalAttachment = function(slave) {
 	const {
 		his, He, His
 	} = getPronouns(slave);
-	if (dildoVibrates(slave)) {
-		if (dildoSmart(slave)) {
+	switch (dildoVibeLevel(slave)) {
+		case 2:
 			// TODO: not sure about this description
 			r.push(`${His} dildo buzzes every so often, when prompted by the arcology's systems to train ${his} sexuality.`);
 			if (slave.chastityVagina) {
 				r.push(`The chastity belt locking it in place means there is no escape.`);
 			}
 			// TODO: add descriptions for slaves with gaping+ vaginas
-		} else {
+			break;
+		case 1:
 			// TODO: not sure about this description
 			r.push(`${He} looks distinctly uncomfortable as ${his} dildo buzzes every so often.`);
 			if (slave.chastityVagina) {
 				r.push(`The chastity belt locking it in place means there is no escape.`);
 			}
 			// TODO: add descriptions for slaves with gaping+ vaginas
-		}
-	} else {
-		r.push(`${His} current accessory is silent.`);
+			break;
+		case 0:
+			r.push(`${His} current accessory is silent.`);
 	}
 	return r.join(" ");
 };
-- 
GitLab