diff --git a/game/03-JavaScript/base-clothing.js b/game/03-JavaScript/base-clothing.js index a12d9195b8b42861190ae05a2ea5bbfdbaec4f83..5ed6680f05d23473ec54276bed4b5838abdaa7c4 100644 --- a/game/03-JavaScript/base-clothing.js +++ b/game/03-JavaScript/base-clothing.js @@ -169,6 +169,37 @@ function getClothingCost(item, slot) { } window.getClothingCost = getClothingCost; +// Returns the price of the clothing item passed. +// If it's part of an outfit the price is 80% of the full outfit for the primary half +// and 80% for the other halves. +function tailorClothingCost(item, slot) { + let cost = 0; + if (setup.clothes[slot][clothesIndex(slot, item)].outfitSecondary) { + let upperSlot = setup.clothes[slot][clothesIndex(slot, item)].outfitSecondary[0]; + let upperItem = setup.clothes[upperSlot].findIndex(x => x.name === setup.clothes[slot][clothesIndex(slot, item)].outfitSecondary[1]); + if (upperItem >= 0) cost = setup.clothes[upperSlot][upperItem].cost * V.clothesPrice * .2; + } else if (setup.clothes[slot][clothesIndex(slot, item)].outfitPrimary) { + cost = setup.clothes[slot][clothesIndex(slot, item)].cost * V.clothesPrice * .8; + } else { + cost = setup.clothes[slot][clothesIndex(slot, item)].cost * V.clothesPrice; + } + + if ( + setup.clothes.under_lower.findIndex(x => x.name === item.name && x.modder === item.modder) >= 0 || + setup.clothes.under_upper.findIndex(x => x.name === item.name && x.modder === item.modder) >= 0 + ) + cost *= V.clothesPriceUnderwear; + else if (item.type.includes("school")) cost *= V.clothesPriceSchool; + + // the lewder item is, the more affected by the multiplier it is + const lewdness = Math.clamp((item.reveal - 400) / 500, 0, 1); + const lewdCoef = 1 + (V.clothesPriceLewd - 1) * lewdness; + cost *= lewdCoef; + + return Math.round(cost); +} +window.tailorClothingCost = tailorClothingCost; + // makes all existing specified upper/lower clothes to be over_upper/over_lower // it assumes that over_xxx equipment slots are empty, otherwise it will overwrite anything in those slots // use this function in version update widget when over clothes will be ready @@ -464,7 +495,7 @@ function getOutfitPair() { window.getOutfitPair = getOutfitPair; /** - * @description Takes in an article of clothing that has been modified to contain the values brokenHalf and wornHalf that have the V.worn location of the outfit part that is broken or warn. + * @description Takes in an article of clothing that has been modified to contain the values brokenHalf and wornHalf that have the V.worn location of the outfit part that is broken or worn. * @param {object} brokenOutfit The clothing object. Currently it takes in a slightly modified setup.clothes values. */ function makeMissingOutfit(brokenOutfit) { diff --git a/game/03-JavaScript/clothing-shop-v2.js b/game/03-JavaScript/clothing-shop-v2.js index 5cfcfe86aa5056becffaf65945ed1528eb2cf381..9ec33670845d42cda5deeba1b4051061707feb1d 100644 --- a/game/03-JavaScript/clothing-shop-v2.js +++ b/game/03-JavaScript/clothing-shop-v2.js @@ -37,7 +37,7 @@ function getTrueWarmth(item) { // sum of warmth of every secondary piece // outfitPrimary looks like this {'lower': 'item_name', 'head': 'item_name'} warmth += Object.keys(item.outfitPrimary) // loop through secondary items list - .filter(x => item.outfitPrimary[x] !== "broken") // filter out broken pieces + .filter(x => item.outfitPrimary[x] !== "broken" && item.outfitPrimary[x] !== "split") // filter out broken pieces .map(x => setup.clothes[x].find(z => z.name === item.outfitPrimary[x] && z.modder === item.modder)) // find items in setup.clothes .reduce((sum, x) => sum + (x.warmth || 0), 0); // calculate sum of their warmth field } @@ -47,7 +47,7 @@ function getTrueWarmth(item) { // outfitSecondary looks like this ['upper', 'item_name', 'head', 'item_name'] item.outfitSecondary.forEach((x, i) => { - if (i % 2 === 0 && item.outfitSecondary[i + 1] !== "broken") { + if (i % 2 === 0 && item.outfitSecondary[i + 1] !== "broken" && item.outfitSecondary[i + 1] !== "split") { warmth += setup.clothes[x].find(z => z.name === item.outfitSecondary[i + 1] && z.modder === item.modder).warmth || 0; } }); @@ -423,7 +423,7 @@ function getWarmthWithOtherClothing(slot, clothingId) { // compile a list of all primary clothes to be removed. It implies that item may have only one primary piece const clothesToRemove = [slot, ...Object.keys(newClothing.outfitPrimary)].map(x => - worn[x].outfitSecondary && worn[x].outfitSecondary[1] !== "broken" + worn[x].outfitSecondary && worn[x].outfitSecondary[1] !== "broken" && worn[x].outfitSecondary[1] !== "split" ? setup.clothes[worn[x].outfitSecondary[0]].find(z => z.name === worn[x].outfitSecondary[1]) : worn[x] ); diff --git a/game/03-JavaScript/ingame.js b/game/03-JavaScript/ingame.js index 9fe8ebad8fb8b2dbbd01bd114f56e0f215a5c984..9f0fa083a1e658d281432ab3955d272f39eac280 100644 --- a/game/03-JavaScript/ingame.js +++ b/game/03-JavaScript/ingame.js @@ -1078,15 +1078,15 @@ function isConnectedToHood(slot) { // Return false if slot is undefined or not a valid clothing category if (!slot || !V.worn[slot]) return false; // Return true if this item IS a hood - if (V.worn[slot].hood && V.worn[slot].outfitSecondary[1] !== "broken") return true; + if (V.worn[slot].hood && V.worn[slot].outfitSecondary[1] !== "broken" && V.worn[slot].outfitSecondary[1] !== "split") return true; // Use the primary clothing slot for the next check if this item is connected to an outfit (and is not the primary item) - if (V.worn[slot].outfitSecondary && V.worn[slot].outfitSecondary[1] !== "broken") { + if (V.worn[slot].outfitSecondary && V.worn[slot].outfitSecondary[1] !== "broken" && V.worn[slot].outfitSecondary[1] !== "split") { slot = V.worn[slot].outfitSecondary[0]; } if ( V.worn[slot].hoodposition && - (V.worn[slot].hoodposition === "down" || (V.worn[slot].hoodposition === "up" && V.worn[slot].outfitPrimary.head !== "broken" && V.worn.head.hood === 1)) + (V.worn[slot].hoodposition === "down" || (V.worn[slot].hoodposition === "up" && V.worn[slot].outfitPrimary.head !== "broken" && V.worn[slot].outfitPrimary.head !== "split" && V.worn.head.hood === 1)) ) { return true; } @@ -1128,7 +1128,7 @@ function clothesIndex(slot, itemToIndex) { itemToIndex.iconFile = recovery.iconFile; if(recovery.outfitPrimary) { Object.entries(recovery.outfitPrimary).forEach(([key, value]) => { - if(itemToIndex.outfitPrimary && itemToIndex.outfitPrimary[key] === "broken"){ + if(itemToIndex.outfitPrimary && (itemToIndex.outfitPrimary[key] === "broken" || itemToIndex.outfitPrimary[key] === "split")){ // Do Nothing } else { itemToIndex.outfitPrimary[key] = value; @@ -1136,7 +1136,7 @@ function clothesIndex(slot, itemToIndex) { }) itemToIndex.outfitPrimary = recovery.outfitPrimary; } - if(recovery.outfitSecondary && itemToIndex.outfitSecondary[1] !== "broken") itemToIndex.outfitSecondary[1] = recovery.outfitSecondary[1]; + if(recovery.outfitSecondary && itemToIndex.outfitSecondary[1] !== "broken" && itemToIndex.outfitSecondary[1] !== "split") itemToIndex.outfitSecondary[1] = recovery.outfitSecondary[1]; } console.log(`attempting to recover the mismatch, new index is '${recovery.index}'`); return recovery.index; diff --git a/game/base-clothing/clothing-sets.twee b/game/base-clothing/clothing-sets.twee index d55f3fe23efba9203203a96379bf5acea21003fb..228384d24e17fc6d5ab263f08f2918836d27f991 100644 --- a/game/base-clothing/clothing-sets.twee +++ b/game/base-clothing/clothing-sets.twee @@ -307,7 +307,7 @@ <<set _outfitPrimaryWearOutfit to $_wardrobeItem.outfitPrimary>> /*Check for damaged parts*/ <<for $_outfitSlot, $_outfitPieceName range _outfitPrimaryWearOutfit>> - <<if $_outfitPieceName is "broken">> + <<if $_outfitPieceName is "broken" or $_outfitPieceName is "split">> <<set _damage += _equipDamageValue[$_outfitSlot]>> <</if>> <</for>> @@ -349,7 +349,7 @@ <<set $_primaryAccColourIsCustom to ($_foundPrimary.accessory_colour is "custom")>> <<for $_outfitSlot, $_outfitPieceName range $_foundPrimary.outfitPrimary>> - <<if $_outfitPieceName is "broken">> + <<if $_outfitPieceName is "broken" or $_outfitPieceName is "split">> <<continue>> <</if>> <<if !_storeItemSkip[$_outfitSlot]>> @@ -360,8 +360,8 @@ <<if $_outfitPieceName isnot $_possiblePiece.name>> <<continue>> <</if>> - /*Skip broken pieces*/ - <<if $_possiblePiece.outfitSecondary[1] is "broken">> + /*Skip broken and split pieces*/ + <<if $_possiblePiece.outfitSecondary[1] is "broken" or $_possiblePiece.outfitSecondary[1] is "split">> <<continue>> <</if>> /*Skip items that don't have matching colours*/ @@ -396,7 +396,7 @@ <</for>> /*If the worn item was a hoodie, make sure the hood is in the correct position*/ - <<if $_slot is "upper" and $worn.upper.hoodposition and $worn.upper.outfitPrimary.head isnot "broken">> + <<if $_slot is "upper" and $worn.upper.hoodposition and $worn.upper.outfitPrimary.head isnot "broken" and $worn.upper.outfitPrimary.head isnot "split">> <<if $worn.upper.hoodposition isnot outfitHoodPosition($outfit[$wear_outfit])>> <<toggleHood>> <<set _equipSkip["head"] to ($worn.upper.hoodposition is "up" ? true : false)>> @@ -408,7 +408,7 @@ <<set _notEquipped[$_slot] to {"name": $_incomingItemName, "reason": "not found replacement"}>> <</if>> /*If the worn item was a hoodie, make sure the hood is in the correct position*/ - <<if $_slot is "upper" and $worn.upper.hoodposition and $worn.upper.outfitPrimary.head isnot "broken" and $worn.upper.hoodposition isnot outfitHoodPosition($outfit[$wear_outfit])>> + <<if $_slot is "upper" and $worn.upper.hoodposition and $worn.upper.outfitPrimary.head isnot "broken" and $worn.upper.outfitPrimary.head isnot "split" and $worn.upper.hoodposition isnot outfitHoodPosition($outfit[$wear_outfit])>> <<toggleHood>> <</if>> <<if $wardrobe_location isnot "wardrobe">> diff --git a/game/base-clothing/updateClothes.js b/game/base-clothing/updateClothes.js index 359348f1d636c5bb6775d53ab5439a05ced28bbe..fa49b2ba345ca501e8450d126319f967700c2f5b 100644 --- a/game/base-clothing/updateClothes.js +++ b/game/base-clothing/updateClothes.js @@ -107,10 +107,10 @@ function updateClothesItem(slot, item, debug) { if (item.outfitPrimary === undefined) item.outfitPrimary = clone(itemRef.outfitPrimary); for (const k in itemRef.outfitPrimary) { // if one_piece is broken, everything is broken - if (item.one_piece === "broken") item.outfitPrimary[k] = "broken"; + if (item.one_piece === "broken" || item.one_piece === "split") item.outfitPrimary[k] = item.one_piece; else if (k === "head" && item.hoodposition === "down") delete item.outfitPrimary[k]; // if an item is still in one piece, it's safe to regenerate it's value from itemRef - else if (item.outfitPrimary[k] !== "broken") item.outfitPrimary[k] = clone(itemRef.outfitPrimary[k]); + else if (item.outfitPrimary[k] !== "broken" && item.outfitPrimary[k] !== "split") item.outfitPrimary[k] = clone(itemRef.outfitPrimary[k]); } } continue; @@ -118,7 +118,7 @@ function updateClothesItem(slot, item, debug) { if (key === "outfitSecondary") { if (itemRef[key] !== undefined) { if (item[key] === undefined) item[key] = clone(itemRef[key]); - if (item.one_piece === "broken") item[key][1] = "broken"; + if (item.one_piece === "broken" || item.one_piece === "split") item[key][1] = item.one_piece; } continue; } diff --git a/game/base-clothing/wardrobes.twee b/game/base-clothing/wardrobes.twee index f649e069d9296f1d04cfe7b643c391e94d3f2cc9..a283b8b3ee45e752fd117af87b393d7a52ab1559 100644 --- a/game/base-clothing/wardrobes.twee +++ b/game/base-clothing/wardrobes.twee @@ -84,7 +84,7 @@ <br> <<if _wornOutfitPrimary isnot undefined>> <<for $_outfitPieceSlot, $_outfitPieceName range _wornOutfitPrimary>> - <<if $_outfitPieceName isnot "broken" and $worn[$_outfitPieceSlot].name isnot "naked">> + <<if $_outfitPieceName isnot "broken" and $_outfitPieceName isnot "split" and $worn[$_outfitPieceSlot].name isnot "naked">> You remove the <<print $worn[$_outfitPieceSlot].name>>. <<generalUndress $wardrobe_location $_outfitPieceSlot>> <</if>> @@ -142,7 +142,7 @@ <<set _outfitPieceIds to {}>> <<if _item.outfitPrimary isnot undefined>> <<for $_outfitPieceSlot, $_outfitPieceName range _item.outfitPrimary>> - <<if $_outfitPieceName is "broken">> + <<if $_outfitPieceName is "broken" or $_outfitPieceName is "split">> <<continue>> <</if>> <<for $_outfitPieceId, $_wardrobeItem range _selectedWardrobe[$_outfitPieceSlot]>> @@ -191,11 +191,11 @@ <br> <<elseif $wardrobeOption is "separateOutfits" and Object.values(_outfitPieceIds).length gt 0>> <<for $_outfitSlot, $_outfitId range _outfitPieceIds>> - <<set _selectedWardrobe[$_outfitSlot][$_outfitId].outfitSecondary[1] to "broken">> - <<set _selectedWardrobe[$_outfitSlot][$_outfitId].one_piece to "broken">> - <<set _item.outfitPrimary[$_outfitSlot] to "broken">> + <<set _selectedWardrobe[$_outfitSlot][$_outfitId].outfitSecondary[1] to "split">> + <<set _selectedWardrobe[$_outfitSlot][$_outfitId].one_piece to "split">> + <<set _item.outfitPrimary[$_outfitSlot] to "split">> <</for>> - <<set _item.one_piece to "broken">> + <<set _item.one_piece to "split">> You cut up the <<print _item.name>>. <<pass 10>> <br> @@ -314,8 +314,14 @@ <<if $location is "home" or $location is "town">> <<if $tailorMonthlyService is "repair">> __Wardrobe Repair Crate__ + <br> There is a small crate ready for sending clothes to be repaired. <br> + <<link [[Add damaged items and send|Wardrobe Repair Crate]]>> + <<set $wardrobeReturnLink to $passage>> + <<set $crateContents to "damaged">> + <</link>> + <br> <<link [[Add outfits and send|Wardrobe Repair Crate]]>> <<set $wardrobeReturnLink to $passage>> <<set $crateContents to "outfits">> @@ -589,7 +595,7 @@ <<if $worn.upper.hoodposition is "up" and $worn.head.hood is 1 and $worn.upper.outfitPrimary.head is $worn.head.name>> <<run delete $worn.upper.outfitPrimary.head>> <<set $worn.upper.hoodposition to "down">> - <<if _args[0] is "shop" and $tryOn.ownedStored.head.name isnot $worn.head.name and !($tryOn.ownedStored.head.outfitSecondary and $tryOn.ownedStored.head.outfitSecondary[1] isnot "broken")>> + <<if _args[0] is "shop" and $tryOn.ownedStored.head.name isnot $worn.head.name and !($tryOn.ownedStored.head.outfitSecondary and $tryOn.ownedStored.head.outfitSecondary[1] isnot "broken" and $tryOn.ownedStored.head.outfitSecondary[1] isnot "split")>> <<set $worn.head to clone($tryOn.ownedStored.head)>> <<else>> <<set $worn.head to clone(setup.clothes.head[0])>> @@ -603,7 +609,7 @@ /* If hood is down, put it back up and remove anything on the head if necessary */ <<elseif $worn.upper.hoodposition is "down">> <<if !$worn.head.cursed>> /* No cursed head items yet, but if one is made, should probably have some popup saying this was prevented */ - <<if $worn.head.outfitSecondary and $worn.head.outfitSecondary[1] isnot "broken">> + <<if $worn.head.outfitSecondary and $worn.head.outfitSecondary[1] isnot "broken" and $worn.head.outfitSecondary[1] isnot "split">> <<if $worn.head.hood is 1 and $worn.head.outfitSecondary[1] is $worn.upper.name and $worn.head.colour is $worn.upper.colour and $worn.head.accessory_colour is $worn.upper.accessory_colour and $worn.head.colourCustom is $worn.upper.colourCustom and $worn.head.accessory_colourCustom is $worn.upper.accessory_colourCustom>> @@ -736,12 +742,18 @@ <<else>> <span class="red">(Broken)</span> <</if>> + <<if _wornItem.one_piece is "split">> + (Separated) + <</if>> <</if>> <<if _wornItem.outfitSecondary isnot undefined>> <<if _wornItem.outfitSecondary[1] is "broken">> <span class="red">(Broken)</span> <<else>> <span class="gold">(Outfit)</span> + <<if _wornItem.one_piece is "split">> + (Separated) + <</if>> <</if>> <</if>> <<wardrobeintegrity _wornItem _wardrobe_list>> @@ -796,7 +808,7 @@ <<set _item to _selectedWardrobe[_wardrobe_list][_i]>> <<set _itemData to setup.clothes[_wardrobe_list][clothesIndex(_wardrobe_list,_item)]>> <<if _item.outfitSecondary isnot undefined>> - <<if _item.outfitSecondary[1] isnot "broken">> + <<if _item.outfitSecondary[1] isnot "broken" and _item.outfitSecondary[1] isnot "split">> <<continue>> <</if>> <</if>> @@ -827,9 +839,16 @@ <<else>> <span class="red">(Broken)</span> <</if>> + <<if _item.one_piece is "split">> + (Separated) + <</if>> <</if>> <<if _item.outfitSecondary isnot undefined>> - <span class="red">(Broken)</span> + <<if _item.one_piece is "split">> + (Separated) + <<else>> + <span class="red">(Broken)</span> + <</if>> <</if>> <<wardrobeintegrity _item _wardrobe_list>> | <<reveal _item.reveal>> @@ -984,7 +1003,7 @@ <<for _i to 0; _i lt _selectedWardrobe[_wardrobe_list].length; _i++>> <<set _item to _selectedWardrobe[_wardrobe_list][_i]>> <<if _item.outfitSecondary isnot undefined>> - <<if _item.outfitSecondary[1] isnot "broken">> + <<if _item.outfitSecondary[1] isnot "broken" and _item.outfitSecondary[1] isnot "split">> <<continue>> <</if>> <</if>> @@ -1076,9 +1095,9 @@ <</for>> <<case "outfit">> <<if _descending>> - <<set _status to ["broken",0,1]>> + <<set _status to ["broken",0,1]>> /* NO SPLIT ADDED */ <<else>> - <<set _status to [1,0,"broken"]>> + <<set _status to [1,0,"broken"]>> /* NO SPLIT ADDED */ <</if>> <<for _i to 0; _i lt _status.length; _i++>> <<for _j to 0; _j lt _wardrobeItems.length; _j++>> @@ -1124,7 +1143,7 @@ <<if _selectedWardrobe[_slot][$_i].outfitSecondary is undefined>> <<continue>> <</if>> - <<if _selectedWardrobe[_slot][$_i].outfitSecondary[1] is "broken">> + <<if _selectedWardrobe[_slot][$_i].outfitSecondary[1] is "broken" or _selectedWardrobe[_slot][$_i].outfitSecondary[1] is "split">> <<continue>> <</if>> @@ -1181,11 +1200,23 @@ <<set _takenAway++>> <<continue>> <</if>> - <<generalSend "wardrobe" _equip[$_i] `$wardrobeRepair[_equip[$_i]][$_j][0]` `$wardrobeRepair[_equip[$_i]][$_j][1]` `$wardrobeRepair[_equip[$_i]][$_j][3]`>> + <<if $wardrobeRepair[_equip[$_i]][$_j][5]>> + <<generalSend "wardrobe" _equip[$_i] `$wardrobeRepair[_equip[$_i]][$_j][0]` `$wardrobeRepair[_equip[$_i]][$_j][1]` `$wardrobeRepair[_equip[$_i]][$_j][3]`>> + <<set _selectedWardrobe[_equip[$_i]].last().one_piece to "split">> + <<if _selectedWardrobe[_equip[$_i]].last().outfitPrimary>> + <<for $_label, $_value range _selectedWardrobe[_equip[$_i]].last().outfitPrimary>> + <<set _selectedWardrobe[_equip[$_i]].last().outfitPrimary[$_label] to "split">> + <</for>> + <<elseif _selectedWardrobe[_equip[$_i]].last().outfitSecondary>> + <<set _selectedWardrobe[_equip[$_i]].last().outfitSecondary[1] to "split">> + <</if>> + <<else>> + <<sendToWardrobeFromDefault "wardrobe" _equip[$_i] `$wardrobeRepair[_equip[$_i]][$_j][0]` `$wardrobeRepair[_equip[$_i]][$_j][1]` `$wardrobeRepair[_equip[$_i]][$_j][3]`>> + <</if>> <<if $wardrobeRepair[_equip[$_i]][$_j][2] isnot undefined and $wardrobeRepair[_equip[$_i]][$_j][2] isnot null>> /*colourCustom*/ <<set _selectedWardrobe[_equip[$_i]].last().colourCustom to $wardrobeRepair[_equip[$_i]][$_j][2]>> - <<if _selectedWardrobe[_equip[$_i]].last().outfitPrimary isnot undefined>> + <<if _selectedWardrobe[_equip[$_i]].last().outfitPrimary isnot undefined and _selectedWardrobe[_equip[$_i]].last().one_piece isnot "split">> <<for $_label, $_value range _selectedWardrobe[_equip[$_i]].last().outfitPrimary>> <<if _selectedWardrobe[$_label].last().name is $_value>> <<set _selectedWardrobe[$_label].last().colourCustom to $wardrobeRepair[_equip[$_i]][$_j][2]>> @@ -1196,7 +1227,7 @@ <<if $wardrobeRepair[_equip[$_i]][$_j][4] isnot undefined and $wardrobeRepair[_equip[$_i]][$_j][4] isnot null>> /*accessory_colourCustom*/ <<set _selectedWardrobe[_equip[$_i]].last().accessory_colourCustom to $wardrobeRepair[_equip[$_i]][$_j][4]>> - <<if _selectedWardrobe[_equip[$_i]].last().outfitPrimary isnot undefined>> + <<if _selectedWardrobe[_equip[$_i]].last().outfitPrimary isnot undefined and _selectedWardrobe[_equip[$_i]].last().one_piece isnot "split">> <<for $_label, $_value range _selectedWardrobe[_equip[$_i]].last().outfitPrimary>> <<if _selectedWardrobe[$_label].last().name is $_value>> <<set _selectedWardrobe[$_label].last().colourCustom to $wardrobeRepair[_equip[$_i]][$_j][2]>> @@ -1226,7 +1257,7 @@ <<for $_slot range $_equip>> <<if !_equipped.includes($_slot) and $worn[$_slot].name is "naked">> <<set $_ids to _selectedWardrobe[$_slot].map((item, index) => { - if (!item.outfitSecondary or item.outfitSecondary[1] is "broken") return index; + if (!item.outfitSecondary or item.outfitSecondary[1] is "broken" or item.outfitSecondary[1] is "split") return index; }).filter(Boolean)>> <<if $_ids.length gt 0>> <<set $_id to $_ids.random()>> @@ -1234,7 +1265,7 @@ <<run _equipped.pushUnique($_slot)>> <<if $_selectedItem.outfitPrimary isnot undefined>> <<run Object.entries($_selectedItem.outfitPrimary).forEach((slot,value) => { - if (value !== "broken") _equipped.pushUnique(slot) + if (value !== "broken" && value !== "split") _equipped.pushUnique(slot) })>> <</if>> <<set V["wear_" + $_slot] to $_id>> @@ -1491,7 +1522,7 @@ It will earn you <<printmoney `_value + 5000`>>. :: Wardrobe Sale Crate Result -<<set $tailorMonthlyService to 30>> +<<set $tailorMonthlyService to 7>> <<set _value to 0>> <<set _equip to setup.clothingLayer.all>> <<for $_i to 0; $_i lt _equip.length; $_i++>> @@ -1500,14 +1531,10 @@ It will earn you <<printmoney `_value + 5000`>>. <<if setup.clothes[_equip[$_i]][clothesIndex(_equip[$_i],$wardrobe[_equip[$_i]][$_j])].shop.length is 0>> <<continue>> <</if>> - <<if $wardrobe[_equip[$_i]][$_j].outfitSecondary isnot undefined>> - <<run _toDelete.push(clone($_j))>> - <<continue>> - <</if>> <<if $wardrobe[_equip[$_i]][$_j].outfitPrimary is undefined and $crateContents is "outfits">> <<continue>> <</if>> - <<set _value += Math.floor(getClothingCost($wardrobe[_equip[$_i]][$_j],_equip[$_i]) * ($wardrobe[_equip[$_i]][$_j].integrity / clothingData(_equip[$_i],$wardrobe[_equip[$_i]][$_j],'integrity_max')) / 3)>> + <<set _value += Math.floor(tailorClothingCost($wardrobe[_equip[$_i]][$_j],_equip[$_i]) * ($wardrobe[_equip[$_i]][$_j].integrity / clothingData(_equip[$_i],$wardrobe[_equip[$_i]][$_j],'integrity_max')) / 3)>> <<run _toDelete.push(clone($_j))>> <</for>> <<for $_j to $wardrobe[_equip[$_i]].length; $_j gte 0; $_j-->> @@ -1529,21 +1556,20 @@ The driver takes the crate away, leaving <<printmoney `_value + 5000`>> in its p Are you prepared to add all your <<if $crateContents is "all">> clothes +<<elseif $crateContents is "damaged">> + damaged clothes <<else>> outfits <</if>> to the crate and send them to be repaired? Might be best to go shopping shortly after. <br><br> -<<set _value to 0>> +<<set _value to 0>> /* recalculated with adding lower or upper halves when missing */ <<for _label, _items range $wardrobe>> <<for _i to 0; _i lt _items.length; _i++>> - <<if _items[_i].outfitSecondary isnot undefined>> + <<if _items[_i].outfitPrimary is undefined and _items[_i].outfitSecondary is undefined and $crateContents is "outfits">> <<continue>> <</if>> - <<if _items[_i].outfitPrimary is undefined and $crateContents is "outfits">> - <<continue>> - <</if>> - <<set _value += Math.floor(getClothingCost(_items[_i],_label) * (1 - (_items[_i].integrity / clothingData(_label,_items[_i],'integrity_max'))) * 1.25)>> + <<set _value += Math.floor(tailorClothingCost(_items[_i],_label) * (1 - (_items[_i].integrity / clothingData(_label,_items[_i],'integrity_max'))) * 1.25)>> <</for>> <</for>> It will cost you @@ -1566,34 +1592,54 @@ It will cost you :: Wardrobe Repair Crate Result -<<set $tailorMonthlyService to 30>> +<<set $tailorMonthlyService to 7>> <<set $wardrobeRepair to {timeLeft: 1}>> <<set _equip to setup.clothingLayer.all>> <<set _value to 0>> <<for $_i to 0; $_i lt _equip.length; $_i++>> <<set _toDelete to []>> <<for $_j to 0; $_j lt $wardrobe[_equip[$_i]].length; $_j++>> - <<if $wardrobe[_equip[$_i]][$_j].outfitSecondary isnot undefined>> - <<run _toDelete.push(clone($_j))>> + <<if $wardrobe[_equip[$_i]][$_j].integrity is clothingData(_equip[$_i],$wardrobe[_equip[$_i]][$_j],'integrity_max') and $wardrobe[_equip[$_i]][$_j].one_piece isnot "broken" and $crateContents is "damaged">> <<continue>> <</if>> - <<if $wardrobe[_equip[$_i]][$_j].outfitPrimary is undefined and $crateContents is "outfits">> + <<if $wardrobe[_equip[$_i]][$_j].outfitPrimary is undefined and $wardrobe[_equip[$_i]][$_j].outfitSecondary is undefined and $crateContents is "outfits">> <<continue>> <</if>> - <<set _value += Math.floor(getClothingCost($wardrobe[_equip[$_i]][$_j],_equip[$_i]) * (1 - ($wardrobe[_equip[$_i]][$_j].integrity / clothingData(_equip[$_i],$wardrobe[_equip[$_i]][$_j],'integrity_max'))) * 1.25)>> + <<set _value += Math.floor(tailorClothingCost($wardrobe[_equip[$_i]][$_j],_equip[$_i]) * (1 - ($wardrobe[_equip[$_i]][$_j].integrity / clothingData(_equip[$_i],$wardrobe[_equip[$_i]][$_j],'integrity_max'))) * 1.25)>> <<if $wardrobeRepair[_equip[$_i]] is undefined>> <<set $wardrobeRepair[_equip[$_i]] to []>> <</if>> - <<set _itemStats to [ - clone(clothesIndex(_equip[$_i],$wardrobe[_equip[$_i]][$_j])), - clone($wardrobe[_equip[$_i]][$_j].colour), - clone($wardrobe[_equip[$_i]][$_j].colourCustom), - clone($wardrobe[_equip[$_i]][$_j].accessory_colour), - clone($wardrobe[_equip[$_i]][$_j].accessory_colourCustom) - ]>> - <<run $wardrobeRepair[_equip[$_i]].push(clone(_itemStats))>> - <<run _toDelete.push(clone($_j))>> + <<if $wardrobe[_equip[$_i]][$_j].outfitSecondary and $wardrobe[_equip[$_i]][$_j].one_piece is "broken">> + /* If a secondary part of an outfit is broken adds the primary part so the complete outfit will be repaired */ + <<set _upperSlot to $wardrobe[_equip[$_i]][$_j].outfitSecondary[0]>> + <<set _upperItem to setup.clothes[_upperSlot].findIndex(x => x.name === setup.clothes[_equip[$_i]][clothesIndex(_equip[$_i],$wardrobe[_equip[$_i]][$_j])].outfitSecondary[1])>> + <<if $wardrobeRepair[_upperSlot] is undefined>> + <<set $wardrobeRepair[_upperSlot] to []>> + <</if>> + <<set _itemStats to [ + clone(_upperItem), + clone($wardrobe[_equip[$_i]][$_j].colour), + clone($wardrobe[_equip[$_i]][$_j].colourCustom), + clone($wardrobe[_equip[$_i]][$_j].accessory_colour), + clone($wardrobe[_equip[$_i]][$_j].accessory_colourCustom), + false + ]>> + <<run $wardrobeRepair[_upperSlot].push(clone(_itemStats))>> + <<run _toDelete.push(clone($_j))>> + <<else>> + <<set _splitted to ($wardrobe[_equip[$_i]][$_j].one_piece === "split" ? true : false)>> + <<set _itemStats to [ + clone(clothesIndex(_equip[$_i],$wardrobe[_equip[$_i]][$_j])), + clone($wardrobe[_equip[$_i]][$_j].colour), + clone($wardrobe[_equip[$_i]][$_j].colourCustom), + clone($wardrobe[_equip[$_i]][$_j].accessory_colour), + clone($wardrobe[_equip[$_i]][$_j].accessory_colourCustom), + clone(_splitted) + ]>> + <<run $wardrobeRepair[_equip[$_i]].push(clone(_itemStats))>> + <<run _toDelete.push(clone($_j))>> + <</if>> <</for>> <<for $_j to $wardrobe[_equip[$_i]].length; $_j gte 0; $_j-->> <<if _toDelete.includes($_j)>> diff --git a/game/base-clothing/widgets.twee b/game/base-clothing/widgets.twee index 30ee89871d64c0e81202a174d790349002129242..8becd3eb9da6c6ac114e3cd890c2cbf0478bef68 100644 --- a/game/base-clothing/widgets.twee +++ b/game/base-clothing/widgets.twee @@ -161,7 +161,7 @@ <<for $_label, $_value range $_outfitPrimary>> <<set _pieceId to setup.clothes[$_label].findIndex(item => item.name is $_value)>> <<if _pieceId isnot -1>> <!-- findIndex() returns -1 if no index is found --> - <<if !_hoodDown or $_label isnot "head">> /*If hood is down, don't make a hood*/ + <<if (!_hoodDown or $_label isnot "head") and _pieceId.one_piece isnot "split">> /*If hood is down, don't make a hood. If an upper part of an outfit is separated don't add a lower part*/ <<sendToWardrobeFromDefault _args[0] $_label _pieceId _colour _accessory_colour>> <</if>> <<else>> @@ -181,7 +181,7 @@ <<set $_selectedWardrobe to selectWardrobe()>> <<if $_outfitPrimaryUndress isnot undefined>> <<for _labelUndress, _valueUndress range $_outfitPrimaryUndress>> - <<if _valueUndress isnot "broken">> + <<if _valueUndress isnot "broken" and _valueUndress isnot "split">> <<if !setup.wardrobeSkip.includes($carried[_labelUndress].name) and $carried[_labelUndress].name is _valueUndress>> <<set $_selectedWardrobe[_labelUndress].push(clone($carried[_labelUndress]))>> <<run _slots.push(_labelUndress)>> @@ -511,7 +511,7 @@ <<widget "generalRuined">> <<if _args[0]>> <<set $eventskipoverrule to 1>> - <<if $worn[_args[0]].cursed is 1 and !$worn[_args[0]].type.includes("broken") or ($worn[_args[0]].name is "naked" and $carried[_args[0]].name is "naked")>> + <<if $worn[_args[0]].cursed is 1 and !$worn[_args[0]].type.includes("broken") and !$worn[_args[0]].type.includes("split") or ($worn[_args[0]].name is "naked" and $carried[_args[0]].name is "naked")>> <<else>> <<switch _args[0]>> <<case "upper">> @@ -627,9 +627,9 @@ <<set $_setupItem to setup.clothes[$_slot][clothesIndex($_slot,$_item)]>> <<set $_return to clothesReturnLocation($_item,"rebuy")>> - <<if $_setupItem.shop.length isnot 0 and $_item.one_piece isnot "broken" and $_setupItem.cursed isnot 1>> + <<if $_setupItem.shop.length isnot 0 and $_item.one_piece isnot "broken" and $_setupItem.cursed isnot 1>> /* NO SPLIT ADDED */ /*If item is half of an outfit, rebuy the primary half instead by redefining the variables defined above*/ - <<if $_item.outfitSecondary isnot undefined and $_item.outfitSecondary[1] isnot "broken">> + <<if $_item.outfitSecondary isnot undefined and $_item.outfitSecondary[1] isnot "broken">> /* NO SPLIT ADDED */ <<set $_slot to $_item.outfitSecondary[0]>> <<set $_item to _args[1][$_slot]>> <<set $_setupItem to setup.clothes[$_slot][clothesIndex($_slot,$_item)]>> @@ -640,7 +640,7 @@ <<if $_item.colourCustom isnot undefined>><<set _colourCustom to $_item.colourCustom>><</if>> <<if $_item.accessory_colourCustom isnot undefined>><<set _accessory_colourCustom to $_item.accessory_colourCustom>><</if>> - <<if $_item.outfitSecondary isnot undefined and $_item.outfitSecondary[1] is "broken">> + <<if $_item.outfitSecondary isnot undefined and $_item.outfitSecondary[1] is "broken">> /* NO SPLIT ADDED */ <<elseif $money gte $_cost>> <<generalSend $_return $_slot $_setupItem.index $_item.colour $_item.accessory_colour>> <<set $money -= $_cost>> @@ -1046,7 +1046,7 @@ <<set $_selectedWardrobe to selectWardrobe()>> <<if _outfitPrimaryUndress isnot undefined>> <<for _labelUndress, _valueUndress range _outfitPrimaryUndress>> - <<if _valueUndress isnot "broken">> + <<if _valueUndress isnot "broken" and _valueUndress isnot "split">> <<if !setup.wardrobeSkip.includes($worn[_labelUndress].name) and $worn[_labelUndress].name is _valueUndress>> <<set $_selectedWardrobe[_labelUndress].push(clone($worn[_labelUndress]))>> <<run _slots.push(_labelUndress)>> @@ -1513,7 +1513,7 @@ <<if _outfitPrimary isnot undefined>> <<set _outfitPieceIds to {}>> <<for _labelWW, _valueWW range _outfitPrimary>> - <<if _valueWW isnot "broken">> + <<if _valueWW isnot "broken" and _valueWW isnot "split">> <<for _j to 0; _j lt $_selectedWardrobe[_labelWW].length; _j++>> <<if $_selectedWardrobe[_labelWW][_j].name is _valueWW and _item.colour is $_selectedWardrobe[_labelWW][_j].colour and _item.accessory_colour is $_selectedWardrobe[_labelWW][_j].accessory_colour>> <<if $_selectedWardrobe[_labelWW][_j].outfitSecondary[1] isnot _item.name>> @@ -1591,7 +1591,7 @@ }>> <<for $_label, $_value range _otherOutfits>> <<if $worn[$_label].outfitSecondary is undefined>> - <<elseif $worn[$_label].outfitSecondary[1] is "broken">> + <<elseif $worn[$_label].outfitSecondary[1] is "broken" or $worn[$_label].outfitSecondary[1] is "split">> <<else>> <<set _otherOutfits[$_label] to true>> <</if>> diff --git a/game/overworld-plains/loc-farm/work.twee b/game/overworld-plains/loc-farm/work.twee index 6db1c48b5e140275ca672ce888dfcba67f3f3595..cbaeaba538c32162c2da124d52968ce909b30f76 100644 --- a/game/overworld-plains/loc-farm/work.twee +++ b/game/overworld-plains/loc-farm/work.twee @@ -1022,7 +1022,7 @@ The chickens follow as you retrieve a sack of grain from the shed beside the yar <<if $danger gte (9900 - $allure) and $exposed lte 0>> <<if $worn.lower.outfitSecondary is undefined>> <<set _broken to true>> - <<elseif $worn.lower.outfitSecondary[1] is "broken">> + <<elseif $worn.lower.outfitSecondary[1] is "broken" or $worn.lower.outfitSecondary[1] is "split">> <<set _broken to true>> <</if>> <<if _broken>> diff --git a/game/overworld-town/loc-shop/tailor.twee b/game/overworld-town/loc-shop/tailor.twee index cccf2084155c5de409042a03aac71098e29dc7bb..aac42dbea5ec1c824cc18ed4e661b47651fc8980 100644 --- a/game/overworld-town/loc-shop/tailor.twee +++ b/game/overworld-town/loc-shop/tailor.twee @@ -33,7 +33,7 @@ You are in the tailor shop. It has cloth of various colours hanging on racks. <</if>> <</if>> <<if $worn[_active_clothes].integrity lt clothingData(_active_clothes,$worn[_active_clothes],'integrity_max') and $worn[_active_clothes].integrity gt 0 and clothingData(_active_clothes,$worn[_active_clothes],'integrity_max') gt 0>> - <<set $tailor_cost += Math.trunc(getClothingCost($worn[_active_clothes],_active_clothes) * (1 - $worn[_active_clothes].integrity / clothingData(_active_clothes,$worn[_active_clothes],'integrity_max')))>> + <<set $tailor_cost += Math.trunc(tailorClothingCost($worn[_active_clothes],_active_clothes) * (1 - $worn[_active_clothes].integrity / clothingData(_active_clothes,$worn[_active_clothes],'integrity_max')))>> <<set _time += 5>> <</if>> @@ -310,10 +310,7 @@ Please make sure you don't buy too many new clothes once you send them to us, or <<set _value to 0>> <<for _label, _items range $wardrobe>> <<for _i to 0; _i lt _items.length; _i++>> - <<if _items[_i].outfitSecondary isnot undefined>> - <<continue>> - <</if>> - <<set _value += Math.floor(getClothingCost(_items[_i],_label) * (1 - (_items[_i].integrity / clothingData(_label,_items[_i],'integrity_max'))) * 1.25,_label)>> + <<set _value += Math.floor(tailorClothingCost(_items[_i],_label) * (1 - (_items[_i].integrity / clothingData(_label,_items[_i],'integrity_max'))) * 1.25,_label)>> <</for>> <</for>> You think it will cost you diff --git a/game/overworld-town/loc-shop/tryOn.twee b/game/overworld-town/loc-shop/tryOn.twee index 876478ac4d682fced2f91231c742db146191d1d9..c53b228b10d6859aa5ff1b24f3ae335eb23d988b 100644 --- a/game/overworld-town/loc-shop/tryOn.twee +++ b/game/overworld-town/loc-shop/tryOn.twee @@ -120,7 +120,7 @@ /*Make sure outfit parts don't get left behind*/ <<if $tryOn.ownedStored[_equip[_i]].outfitPrimary isnot undefined>> <<for $_slot, $_item range $tryOn.ownedStored[_equip[_i]].outfitPrimary>> - <<if $_item isnot "broken" and $tryOn.ownedStored[$_slot].name isnot "naked" and !_towels.includes($tryOn.ownedStored[$_slot].name)>> + <<if $_item isnot "broken" and $tryOn.ownedStored[$_slot].name isnot "naked" and !_towels.includes($tryOn.ownedStored[$_slot].name)>> /* NO SPLIT ADDED */ <<wardrobeSend $_slot $tryOn.ownedStored[$_slot]>> <</if>> <</for>> @@ -149,7 +149,7 @@ <<elseif Object.keys($tryOn.showEquip).includes(_args[0]) and $tryOn.showEquip[_args[0]] isnot null>> <<ShowUnderEquip "over">> <</if>> - <<if $worn[_args[0]].outfitSecondary isnot undefined and $worn[_args[0]].outfitSecondary[1] isnot "broken">> + <<if $worn[_args[0]].outfitSecondary isnot undefined and $worn[_args[0]].outfitSecondary[1] isnot "broken" and and $worn[_args[0]].outfitSecondary[1] isnot "split">> <<set _resetSlot to $worn[_args[0]].outfitSecondary[0]>> <<else>> <<set _resetSlot to _args[0]>> @@ -276,7 +276,7 @@ <<continue>> <</if>> <<if $worn[_labelTO].outfitSecondary isnot undefined>> - <<if $worn[_labelTO].outfitSecondary[1] isnot "broken">> + <<if $worn[_labelTO].outfitSecondary[1] isnot "broken" and $worn[_labelTO].outfitSecondary[1] isnot "split">> <<set _unequipSlot to $worn[_labelTO].outfitSecondary[0]>> <</if>> <</if>> @@ -289,7 +289,7 @@ <<set _outfitPrimaryTO to $worn[_unequipSlot].outfitPrimary>> <<if _outfitPrimaryTO isnot undefined>> <<for _labelTO2, _valueTO2 range _outfitPrimaryTO>> - <<if _valueTO2 isnot "broken">> + <<if _valueTO2 isnot "broken" and _valueTO2 isnot "split">> <<set $worn[_labelTO2] to clone(setup.clothes[_labelTO2][0])>> <<removeTryingOn _labelTO2>> <<set _returnSlots.push(_labelTO2)>> @@ -359,7 +359,7 @@ <<set _outfitPrimaryUSS to $tryOn.ownedStored[_updateSlot].outfitPrimary>> <<if _outfitPrimaryUSS isnot undefined>> <<for _labelUSS, _valueUSS range _outfitPrimaryUSS>> - <<if _valueUSS isnot "broken">> + <<if _valueUSS isnot "broken" and _valueUSS isnot "split">> <<set $tryOn.ownedStored[_labelUSS] to clone($worn[_labelUSS])>> <</if>> <</for>> diff --git a/game/overworld-town/loc-shop/widgets.twee b/game/overworld-town/loc-shop/widgets.twee index a130dcb82f70fa9675a804910d959d78a9104feb..224964d8b667d185a06a1f970b8ab4cb98febf3f 100644 --- a/game/overworld-town/loc-shop/widgets.twee +++ b/game/overworld-town/loc-shop/widgets.twee @@ -901,7 +901,7 @@ Forth argument - item index*/ <<set _undamagedCount++>> <<if _returnWardrobe[_args[0][0]][_j].outfitPrimary isnot undefined>> <<for _valueShop range _returnWardrobe[_args[0][0]][_j].outfitPrimary>> - <<if _valueShop is "broken">> + <<if _valueShop is "broken" or _valueShop is "split">> <<set _damagedCount++>> <<set _undamagedCount-->> <<break>> diff --git a/game/overworld-town/loc-spa/widgets.twee b/game/overworld-town/loc-spa/widgets.twee index c9059f6aa69ee9920c6ffeb800c09f0f8158e064..4fbd078fac80c035984490fc7f19e37bcef7404b 100644 --- a/game/overworld-town/loc-spa/widgets.twee +++ b/game/overworld-town/loc-spa/widgets.twee @@ -178,7 +178,7 @@ <span class="red">and grasps your $worn.lower.name.</span> <<if $worn.lower.outfitSecondary is undefined>> <<set _broken to true>> - <<elseif $worn.lower.outfitSecondary[1] is "broken">> + <<elseif $worn.lower.outfitSecondary[1] is "broken" or $worn.lower.outfitSecondary[1] is "split">> <<set _broken to true>> <</if>> <<if $worn.lower.open is 1 or _broken or $worn.lower.integrity lte 20>> diff --git a/game/overworld-town/loc-spa/work.twee b/game/overworld-town/loc-spa/work.twee index 2518fd64db0c4eeea9d82d066f12b7b6cb439ffe..ae46f91ed827ee77560b5ebf7322a2ad4b4cbffc 100644 --- a/game/overworld-town/loc-spa/work.twee +++ b/game/overworld-town/loc-spa/work.twee @@ -723,7 +723,7 @@ You negotiate a fee of <<printmoney $tip>>, <<if $worn.lower.outfitSecondary is undefined>> <<set _broken to true>> -<<elseif $worn.lower.outfitSecondary[1] is "broken">> +<<elseif $worn.lower.outfitSecondary[1] is "broken" or $worn.lower.outfitSecondary[1] is "split">> <<set _broken to true>> <</if>> <<He>> grasps your $worn.under_lower.name with <<his>> other hand, diff --git a/game/overworld-underground/loc-sewers/old-sewers-events.twee b/game/overworld-underground/loc-sewers/old-sewers-events.twee index 6b7461dbf36ea06bf0749a12c18a4f1134800c31..0f171d06993ef9b45e256997ef5323313b3caa9e 100644 --- a/game/overworld-underground/loc-sewers/old-sewers-events.twee +++ b/game/overworld-underground/loc-sewers/old-sewers-events.twee @@ -405,7 +405,7 @@ Your tear free from Morgan's clutches, leaving <<him>> grasping your ruined $wor <<if $worn.lower.outfitSecondary is undefined>> You struggle free from your $worn.lower.name, and leave it on the sticky floor. You shiver.<<lowerruined>> <<exposure>> You're conscious of your <<nudity>>. <br><br> -<<elseif $worn.lower.outfitSecondary[1] is "broken">> +<<elseif $worn.lower.outfitSecondary[1] is "broken" or $worn.lower.outfitSecondary[1] is "split">> You struggle free from your $worn.lower.name, and leave it on the sticky floor. You shiver.<<lowerruined>> <<exposure>> You're conscious of your <<nudity>>. <br><br> <<else>>