Skip to content
Snippets Groups Projects
Commit 00b347f3 authored by lifeAnime's avatar lifeAnime Committed by Vrelnir
Browse files

Adapt strap-ons with new Sex shop menu / Sextoys inventory

parent 1f81f61a
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
grid-template-columns: repeat(auto-fit, minmax(13em, 1fr));
grid-template-columns: repeat(auto-fit, minmax(15em, 1fr));
display: grid;
margin: 0 20% 0 20%;
}
......@@ -97,6 +97,7 @@
letter-spacing: 0.06em;
cursor: pointer;
text-shadow: 1px 1px 2px #304355;
left: 0;
}
.ssm_already_owned {
......@@ -185,7 +186,7 @@
.ssm_not_enough_money {
display: inline-block;
margin-left: 32%;
margin-left: -8%;
color:grey
}
......
......@@ -15,6 +15,7 @@
padding:15px;
padding-top: 40px;
padding-inline: 30px;
padding-bottom: 40px;
}
.sti_grid_title {
......@@ -79,6 +80,17 @@
text-align: center;
}
.sti_grid_carried_count {
position: absolute;
color: #d4d4ca;
font-weight: bold;
padding-top: 5px;
font-family: system-ui;
font-size: 0.8em;
white-space: nowrap;
margin-inline: 130%;
}
.sti_selected {
background-color: #584951;
border: 1px solid #be406a!important;
......@@ -166,6 +178,7 @@
margin-top: 1%;
padding-right: 6px;
margin-right: 6px;
min-width: 350px;
}
.sti_closeContainer {
......@@ -191,4 +204,10 @@
#sti_desc_action {
text-align: center;
margin-left: -10%;
}
.sti_carry_limit_reached {
color: grey!important;
text-decoration: unset!important;
cursor: not-allowed!important;
}
\ No newline at end of file
......@@ -25,7 +25,8 @@ setup.sextoys = [
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.worn==!0) return item} return 0}},
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}},
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"]
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"],
display_condition: function(){return 1}
},
{
index:1,
......@@ -45,7 +46,8 @@ setup.sextoys = [
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.worn==!0) return item} return 0}},
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].worn==!0) V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].carry==!0){ V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}}},
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"]
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"],
display_condition: function(){return 1}
},
{
index:2,
......@@ -66,6 +68,7 @@ setup.sextoys = [
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].worn==!0) V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].carry==!0){ V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}}},
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"],
display_condition: function(){return 1}
},
{
index:3,
......@@ -86,7 +89,8 @@ setup.sextoys = [
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].worn==!0) V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].carry==!0){ V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}}},
colour_options: [],
default_colour: "pink"
default_colour: "pink",
display_condition: function(){return 1}
},
{
index:4,
......@@ -106,76 +110,74 @@ setup.sextoys = [
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.worn==!0) return item} return 0}},
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].worn==!0) V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].carry==!0){ V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}}},
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"]
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"],
display_condition: function(){return 1}
},
{
index:5,
name:"strap-on",
namecap:"Strap-on",
name_underscore:"strapon",
name_underscore:"strap-on",
clothes_index:33,
description:"Worn on your hips. Used for penetrative sex. Average size",
description:"Worn on your hips. Used for penetrative sex.",
cost:8000,
wearable:1,
size:2,
integrity: 2000,
integrity_max: 2000,
category:"strap-on",
type:["strap-on","fetish"],
icon:"img/misc/icon/clothes/strap-on.png",
colour: 1,
owned: function(){if (V.inventory.sextoys[this.name] != undefined){return V.inventory.sextoys[this.name].length}else return 0},
isCarried: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.carried==!0) return item} return 0}},
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.worn==!0) return item} return 0}},
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(V.worn.under_lower.type.includes("strap-on")) return item} return 0}},
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].worn==!0) V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].carry==!0){ V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}}},
colour_options: ["black", "blue", "green", "pink", "purple", "red", "white", "yellow", "tan", "brown"]
colour_options: ["black", "blue", "green", "pink", "purple", "red", "white", "yellow", "tan", "brown"],
display_condition: function(){return 1}
},
{
index:6,
name:"strap-on horse cock",
namecap:"Strap-on horse cock",
name_underscore:"strapon_horse_cock",
name_underscore:"strap-on_horse_cock",
clothes_index:34,
description:"Novelty equine phallus. Worn on your hips. Used for penetrative sex. Massive size",
cost:10000,
description:"Novelty equine phallus. Worn on your hips. Used for penetrative sex.",
cost:8000,
wearable:1,
size:4,
integrity: 2000,
integrity_max: 2000,
category:"strap-on",
type:["strap-on","fetish"],
icon:"img/misc/icon/clothes/horsestraponicon.png",
colour: 1,
owned: function(){if (V.inventory.sextoys[this.name] != undefined){return V.inventory.sextoys[this.name].length}else return 0},
isCarried: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.carried==!0) return item} return 0}},
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.worn==!0) return item} return 0}},
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(V.worn.under_lower.type.includes("strap-on")) return item} return 0}},
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].worn==!0) V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].carry==!0){ V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}}},
colour_options: ["black", "blue", "green", "pink", "purple", "red", "white", "yellow", "tan", "brown"]
colour_options: ["black", "blue", "green", "pink", "purple", "red", "white", "yellow", "tan", "brown"],
display_condition: function(){return 1}
},
{
index:7,
name:"strap-on knotted cock",
namecap:"Strap-on knotted cock",
name_underscore:"strapon_knotted_cock",
clothes_index:34,
description:"Novelty canine phallus. Worn on your hips. Used for penetrative sex. Large size.",
cost:10000,
name_underscore:"strap-on_knotted_cock",
clothes_index:35,
description:"Novelty canine phallus. Worn on your hips. Used for penetrative sex.",
cost:8000,
wearable:1,
size:3,
integrity: 2000,
integrity_max: 2000,
category:"strap-on",
type:["strap-on","fetish"],
icon:"img/misc/icon/clothes/knottedstrapon.png",
colour: 1,
owned: function(){if (V.inventory.sextoys[this.name] != undefined){return V.inventory.sextoys[this.name].length}else return 0},
isCarried: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.carried==!0) return item} return 0}},
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.worn==!0) return item} return 0}},
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(V.worn.under_lower.type.includes("strap-on")) return item} return 0}},
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].worn==!0) V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].carry==!0){ V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}}},
colour_options: ["black", "blue", "green", "pink", "purple", "red", "white", "yellow", "tan", "brown"]
colour_options: ["black", "blue", "green", "pink", "purple", "red", "white", "yellow", "tan", "brown"],
display_condition: function(){return 1}
}/*,
{
index:8,
......@@ -195,7 +197,8 @@ setup.sextoys = [
isWorn: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item of V.inventory.sextoys[this.name]){if(item.worn==!0) return item} return 0}},
unWear: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].worn==!0) V.inventory.sextoys[this.name][item].worn = 0}}},
unCarry: function(){if(V.inventory.sextoys[this.name] != undefined){for(let item in V.inventory.sextoys[this.name]){if(V.inventory.sextoys[this.name][item].carry==!0){ V.inventory.sextoys[this.name][item].worn = 0; V.inventory.sextoys[this.name][item].carried = 0}}}},
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"]
colour_options: ["black","blue","teal","lime-green","light-pink","purple","tan","brown","red"],
display_condition: function(){return 1}
}*/
];
......@@ -206,7 +209,8 @@ Array.prototype.random = function () {
window.sexShopGridInit = function(){
$(function(){
for (let item of setup.sextoys){
window.sexShopGridAddItemBox(item)
if (item.display_condition()) // This check if an item meets the required conditions to be shown in the shop.
window.sexShopGridAddItemBox(item)
}
})
}
......@@ -334,10 +338,13 @@ window.sexShopOnGiftClick = function (index) {
let icon_class_name = document.getElementById("ssm_desc_img").className
let recipient = document.getElementById("recipientList").value.toLowerCase();
recipient = window.findIndexInNPCNameVar(recipient)
window.sexShopOnGiftClick.counter = window.sexShopOnGiftClick.counter || "off"
/* add item to NPC's inventory */
if (V.inventory[recipient].sextoys[item.name] == undefined)
V.inventory[recipient].sextoys[item.name] = []
if (V.NPCName[recipient].sextoys == undefined)
V.NPCName[recipient].sextoys = {}
if (V.NPCName[recipient].sextoys[item.name] == undefined)
V.NPCName[recipient].sextoys[item.name] = []
let obj = {
"index":item.index,
"name":item.name,
......@@ -345,11 +352,15 @@ window.sexShopOnGiftClick = function (index) {
"colour":(icon_class_name == '' ? item.default_colour : icon_class_name.substring(icon_class_name.indexOf("-") + 1)),
"worn": false,
"size": item.size,
// "sizeDesc": {0:"", 1:"", 2: "", 3: "large", 4: "massive"}[item.size],
// "desc":(this.sizeDesc + " " + this.colour + " " + this.name),
"carried": false,
"combat_state":"worn",
"gift_state": "held"
}
V.inventory[recipient].sextoys[item.name].push(obj);
if (item.category == "strap-on")
obj.clothes_index = item.clothes_index
V.NPCName[recipient].sextoys[item.name].push(obj);
/* withdraw money from player */
V.money -= (item.cost + (15 * 100))
/* update sidebar money */
......@@ -381,9 +392,18 @@ window.sexShopOnBuyClick = function (index) {
"worn": false,
"type": item.type,
"size": item.size,
// "sizeDesc": {0:"", 1:"", 2: "", 3: "large", 4: "massive"}[item.size],
// "desc":(this.sizeDesc + " " + this.colour + " " + this.name),
"carried": false,
"combat_state":"removed"
}
if (item.category == "strap-on"){
let obj2 = setup.clothes.under_lower[item.clothes_index]
obj.clothes_index = item.clothes_index
obj2.colour = obj.colour
V.wardrobe["under_lower"].push(obj2)
}
V.inventory.sextoys[item.name].push(obj)
/* withdraw money from player */
V.money -= item.cost
......@@ -405,13 +425,16 @@ window.sexShopOnBuyClick = function (index) {
}
window.createInventoryObject = function(){ // create Inventory object if it doesn't exist
var recipient;
if (V.inventory == undefined)
V.inventory = {}
if (V.inventory.sextoys == undefined)
V.inventory.sextoys = {}
for (let li of ["alex", "eden", "kylar", "robin", "sydney"]){
if (V.inventory[li] == undefined)
V.inventory[li] = {"sextoys":{}}
recipient = window.findIndexInNPCNameVar(li)
if (V.NPCName[recipient].sextoys == undefined)
V.NPCName[recipient].sextoys = {}
}
}
......
var max_carried = 5; // maximum player can carry
window.sexToysInventoryInit = function() {
$(function(){
var min_cells = 12; // we generate a minimum of 12 cells to display.
......@@ -21,6 +23,10 @@ window.sexToysInventoryInit = function() {
}
while ((main_grid.childElementCount - 1) < min_cells || (main_grid.childElementCount - 1) % 4 != 0) // minimum of 12 cells. minimum 4 cells per row
main_grid.innerHTML += `<div class="sti_cell sti_empty"></div>`
main_grid.innerHTML += `<div style="position: relative;">
<div id="carryCount" class="sti_grid_carried_count"></div>
</div>`
window.updateCarryCountUI()
});
}
......@@ -65,23 +71,47 @@ window.sexToysInventoryOnItemClick = function (index, category) {
</div>
`
document.getElementById("stiDescPillContainer").style.display = ""
window.greyButtonsIfCarryLimitReached(index, category)
}
window.sexToysInventoryOnCarryClick = function (index, category) {
let shortcut_category = setup.sextoys[V.inventory.sextoys[category][index].index].category
if (V.inventory.sextoys[category][index].carried == false && window.countCarriedSextoys() >= max_carried) // if player has reached maximum item carried, stop the function
return
V.inventory.sextoys[category][index].carried = !V.inventory.sextoys[category][index].carried
if (V.inventory.sextoys[category][index].worn == true)
V.worn[setup.sextoys[V.inventory.sextoys[category][index].index].category] = undefined
if (V.inventory.sextoys[category][index].worn == true && shortcut_category != "strap-on")
V.worn[shortcut_category] = undefined
if (V.inventory.sextoys[category][index].carried == false) // if player chose "Put back in the cupboard"
V.inventory.sextoys[category][index].worn = false // also unwear the item
document.getElementById("stiWearButton").textContent = (V.inventory.sextoys[category][index].worn) ? "Take off" : "Wear it" // update button text value
document.getElementById("stiCarryButton").textContent = (V.inventory.sextoys[category][index].carried != true ? "Carry it" : "Put back in the cupboard") // update button text value
// update worn/carried tag on cell
document.getElementById("sti_already_owned_" + category.replace(/\s/g, '_') + "_" + index).textContent = (V.inventory.sextoys[category][index].worn == true ? "worn" : V.inventory.sextoys[category][index].carried == true ? "carried" : "")
if (shortcut_category == "strap-on"){ // this is an exception for strap-ons. Upon "wearing", also set them in under_lower as they don't have their own category yet.
if (V.inventory.sextoys[category][index].worn == true){
let tmp = V.wardrobe.under_lower.find(c_item => (c_item.index == V.inventory.sextoys[category][index].clothes_index && c_item.colour == V.inventory.sextoys[category][index].colour))
Wikifier.wikifyEval(' <<underlowerwear ' + tmp.index + ' ' + tmp.colour + '>>');
}
else
Wikifier.wikifyEval(' <<underlowerundress "wardrobe">>');
Wikifier.wikifyEval(' <<updatesidebarimg>>');
}
window.updateCarryCountUI()
window.greyButtonsIfCarryLimitReached(index, category)
}
window.sexToysInventoryOnWearClick = function (index, category) { // "Wear it" / "Take off"
if (V.inventory.sextoys[category][index].worn == true)
V.worn[setup.sextoys[V.inventory.sextoys[category][index].index].category] = undefined
let shortcut_category = setup.sextoys[V.inventory.sextoys[category][index].index].category
if (shortcut_category == "strap-on" && V.worn.under_lower.cursed == 1){ // if player tries to wear a strapon but that under_lower is cursed
document.getElementById("stiCursedText").outerHTML = `<div id="stiCursedText" class="ssm_fade_in">You try to remove the ` + V.worn.under_lower.name + ` but fail</div>`
return
}
if (V.inventory.sextoys[category][index].carried == false && window.countCarriedSextoys() >= max_carried) // if player has reached maximum item carried, stop the function
return
if (V.inventory.sextoys[category][index].worn == true && shortcut_category != "strap-on")
V.worn[shortcut_category] = undefined
if (V.inventory.sextoys[category][index].worn == false){ // If player chose "Wear it"
for (let s_item of setup.sextoys){ // retrieve main category of our item in setup.sextoys
if (s_item.name == category)
......@@ -95,8 +125,10 @@ window.sexToysInventoryOnWearClick = function (index, category) { // "Wear it" /
}
}
V.inventory.sextoys[category][index].worn = !V.inventory.sextoys[category][index].worn // then wear chose item.
V.worn[setup.sextoys[V.inventory.sextoys[category][index].index].category] = V.inventory.sextoys[category][index]
V.worn[setup.sextoys[V.inventory.sextoys[category][index].index].category].combat_state = "worn"
if (shortcut_category != "strap-on"){
V.worn[shortcut_category] = V.inventory.sextoys[category][index]
V.worn[shortcut_category].combat_state = "worn"
}
V.inventory.sextoys[category][index].carried = true // also carry the item if not done alreadys
document.getElementById("stiWearButton").textContent = (V.inventory.sextoys[category][index].worn) ? "Take off" : "Wear it" // update button text value
document.getElementById("stiCarryButton").textContent = (V.inventory.sextoys[category][index].carried != true ? "Carry it" : "Put back in the cupboard") // update button text value
......@@ -106,22 +138,40 @@ window.sexToysInventoryOnWearClick = function (index, category) { // "Wear it" /
let ind = element.getAttribute("data-index")
element.textContent = (V.inventory.sextoys[c][ind].worn ? "worn" : V.inventory.sextoys[c][ind].carried ? "carried" : "" )
})
if (shortcut_category == "strap-on"){ // this is an exception for strap-ons. Upon "wearing", also set them in under_lower as they don't have their own category yet.
if (V.inventory.sextoys[category][index].worn == true){
let tmp = V.wardrobe.under_lower.find(c_item => (c_item.index == V.inventory.sextoys[category][index].clothes_index && c_item.colour == V.inventory.sextoys[category][index].colour))
Wikifier.wikifyEval(' <<underlowerwear ' + tmp.index + ' ' + tmp.colour + '>>');
}
else
Wikifier.wikifyEval(' <<underlowerundress "wardrobe">>');
Wikifier.wikifyEval(' <<updatesidebarimg>>');
}
window.updateCarryCountUI()
window.greyButtonsIfCarryLimitReached(index, category)
}
window.sexToysInventoryOnThrowClick = function(index, category){
let shortcut_category = setup.sextoys[V.inventory.sextoys[category][index].index].category
/* remove div */
document.getElementById("sti_item_" + category.replace(/\s/g, '_') + "_" + index).remove()
/* add new empty div */
document.getElementById("sti_grid").innerHTML += `<div class="sti_cell sti_empty"></div>`
/* close description */
window.sextoysOnCloseDesc("stiDescPillContainer")
if (V.inventory.sextoys[category][index].worn == true && shortcut_category != "strap-on")
V.worn[shortcut_category] = undefined
/* handle strapons */
if (shortcut_category == "strap-on") {
V.wardrobe.under_lower.splice(V.wardrobe.under_lower.indexOf(V.wardrobe.under_lower.find(c_item => (c_item.index == V.inventory.sextoys[category][index].clothes_index && c_item.colour == V.inventory.sextoys[category][index].colour))), 1)
Wikifier.wikifyEval(' <<underlowerundress "wardrobe">>');
Wikifier.wikifyEval(' <<updatesidebarimg>>');
}
/* remove item from inventory object */
if (V.inventory.sextoys[category][index].worn == true)
V.worn[setup.sextoys[V.inventory.sextoys[category][index].index].category] = undefined
console.log(category)
V.inventory.sextoys[category].splice(index, 1)
$("[id*='sti_item']").each(function(i, element){updateNumberInString(element, element.id, index, category.replace(/\s/g, '_'))})
$("[id*='sti_already_owned']").each(function(i, element){updateNumberInString(element, element.id, index, category.replace(/\s/g, '_'))})
window.updateCarryCountUI()
}
window.sextoysOnCloseDesc = function (elem_id) {
......@@ -156,11 +206,11 @@ function updateNumberInString(element, string, index_min, category){
window.checkSextoysGift = function (npc_name) {
npc_name = npc_name.toLowerCase()
for (let inv in V.inventory){
if (inv == npc_name){
for (let cat in V.inventory[npc_name].sextoys){
for (let item in V.inventory[npc_name].sextoys[cat]){
if (V.inventory[npc_name].sextoys[cat][item].gift_state == "held")
for (let inv in V.NPCName){
if (V.NPCName[inv].nam.toLowerCase() == npc_name){
for (let cat in V.NPCName[inv].sextoys){
for (let item in V.NPCName[inv].sextoys[cat]){
if (V.NPCName[inv].sextoys[cat][item].gift_state == "held")
return 1
}
}
......@@ -178,4 +228,90 @@ window.listUniqueCarriedSextoys = function () {
}
}
return (list.length > 0 ? list : 0)
}
window.straponExceptionWearOff = function(){
for (let s_list in V.inventory.sextoys){
for (let strapon in V.inventory.sextoys[s_list]){
if (V.inventory.sextoys[s_list][strapon].name == V.worn.under_lower.name)
V.inventory.sextoys[s_list][strapon].worn = false
}
}
}
window.patchStraponsWearStatus = function () {
for (let s_list in V.inventory.sextoys){
for (let strapon in V.inventory.sextoys[s_list]){
if (V.inventory.sextoys[s_list][strapon].name != V.worn.under_lower.name && V.inventory.sextoys[s_list][strapon].type.includes("strap-on"))
V.inventory.sextoys[s_list][strapon].worn = false
}
}
}
window.checkIfNPCHasCategorySextoy = function (npc_name, category){
let found_list = []
let item_list = []
let recipient;
npc_name = npc_name.toLowerCase()
for (let s_item of setup.sextoys){
if (s_item.category == category)
item_list.push(s_item.name)
}
recipient = window.findIndexInNPCNameVar(npc_name);
for (let i_list in V.NPCName[recipient].sextoys){
if (item_list.includes(i_list)){
for (let item of V.NPCName[recipient].sextoys[i_list]){
if (item.gift_state != "held")
found_list.push(item)
}
}
}
return (found_list.length > 0 ? found_list : 0)
}
window.handSextoysGiftToNPC = function (npc_name){
let recipient = window.findIndexInNPCNameVar(npc_name);
npc_name = npc_name.toLowerCase()
for (let cat in V.NPCName[recipient].sextoys){
for (let item in V.NPCName[recipient].sextoys[cat]){
if (V.NPCName[recipient].sextoys[cat][item].gift_state == "held")
V.NPCName[recipient].sextoys[cat][item].gift_state = "received"
}
}
}
window.findIndexInNPCNameVar = function(npc_name) {
for (let npc in V.NPCName){
if (V.NPCName[npc].nam.toLowerCase() == npc_name.toLowerCase())
return npc
}
}
window.countCarriedSextoys = function() {
let count = 0;
for (let cat in V.inventory.sextoys){
for (let item of V.inventory.sextoys[cat]){
if (item.carried)
count++
}
}
return count;
}
window.updateCarryCountUI = function() {
document.getElementById("carryCount").outerHTML = `<div id="carryCount" class="sti_grid_carried_count">Items carried: <span class="`+ (window.countCarriedSextoys() >= max_carried ? "red" : "") + ` "> ` + window.countCarriedSextoys() + `/` + max_carried + `</span></div>`
}
window.greyButtonsIfCarryLimitReached = function(index, category) {
if (window.countCarriedSextoys() >= max_carried){
if (V.inventory.sextoys[category][index].worn == false && V.inventory.sextoys[category][index].carried == false)
document.getElementById("stiWearButton").classList.add("sti_carry_limit_reached")
if (V.inventory.sextoys[category][index].carried == false)
document.getElementById("stiCarryButton").classList.add("sti_carry_limit_reached")
}
}
\ No newline at end of file
......@@ -22,6 +22,8 @@ You are inside the adult shop
:: Sextoys Inventory
<div id="stiCursedText" class="ssm_fade_in"></div>
<br>
<div class="sti_grid" id="sti_grid">
<div class="sti_grid_title">Sex toys inventory</div>
</div>
......@@ -30,6 +32,7 @@ You are inside the adult shop
<div class="sti_descContainer" id="sti_descContainer"></div>
</div>
<br><br>
<<run window.patchStraponsWearStatus()>>
<<run window.sexToysInventoryInit()>>
<<link [[Reload|Sextoys Inventory]]>><</link>>
<br>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment