From 6013326430a75fd4ca1f9df309f5db94f45be225 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Sun, 14 Jun 2020 01:08:13 -0400 Subject: [PATCH] more generic function for pronouns in slave property --- src/js/assayJS.js | 5 +++-- src/npc/descriptions/longSlave.js | 2 +- src/npc/descriptions/prestige.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/js/assayJS.js b/src/js/assayJS.js index 7a2ca939872..2e97d25564d 100644 --- a/src/js/assayJS.js +++ b/src/js/assayJS.js @@ -412,11 +412,12 @@ globalThis.getNonlocalPronouns = function(dickRatio) { /** Get the origin for a given slave, with the correct pronouns. * @param {App.Entity.SlaveState} slave + * @param {string} prop * @returns {string} */ -globalThis.getSlaveOrigins = function(slave) { +globalThis.pronounsForSlaveProp = function(slave, prop) { const pronouns = getPronouns(slave); - return slave.origin.replace(/\$([A-Z]?[a-z]+)/g, (match, cap1) => pronouns[cap1] || match); + return prop.replace(/\$([A-Z]?[a-z]+)/g, (match, cap1) => pronouns[cap1] || match); }; /** Get the written title for a given slave, without messing with global state. diff --git a/src/npc/descriptions/longSlave.js b/src/npc/descriptions/longSlave.js index bd2be161078..5d1e11dc13c 100644 --- a/src/npc/descriptions/longSlave.js +++ b/src/npc/descriptions/longSlave.js @@ -169,7 +169,7 @@ App.Desc.longSlave = function({slave = V.activeSlave, saleDescription = V.saleDe if (saleDescription === 0) { if (slave.origin !== 0) { - r.push(getSlaveOrigins(slave)); + r.push(pronounsForSlaveProp(slave, slave.origin)); } } diff --git a/src/npc/descriptions/prestige.js b/src/npc/descriptions/prestige.js index 177c17dde97..a64107b3ea3 100644 --- a/src/npc/descriptions/prestige.js +++ b/src/npc/descriptions/prestige.js @@ -10,7 +10,7 @@ App.Desc.prestige = function(slave) { if (slave.prestige > 0) { if (slave.prestigeDesc) { - r.push(`${slave.prestigeDesc}`); + r.push(pronounsForSlaveProp(slave, slave.prestigeDesc)); } if (slave.prestige > 2) { r.push(`<span class="green">It is extremely prestigious to own ${him}.</span>`); @@ -23,7 +23,7 @@ App.Desc.prestige = function(slave) { if (slave.porn.prestige > 0) { if (slave.porn.prestigeDesc) { - r.push(`${slave.porn.prestigeDesc}`); + r.push(pronounsForSlaveProp(slave, slave.porn.prestigeDesc)); } if (slave.porn.prestige > 2) { r.push(`As such, ${he} tends to gain a following wherever ${he} goes.`); -- GitLab