Stephan Fuchs пре 10 месеци
родитељ
комит
f0318170ab

+ 8 - 25
sugarcube/src/autogenerated/unsorted/_stock_item.tw

@@ -8,9 +8,16 @@
 
 	<<set _limit = setup.items[_stockItem.id]?.limit || 0>>
 	<<set _currentItemAmount = $inventory.get(_stockItem.id)>>
+
+	<<set _stockItem = Object.assign({},_stockItem,$inventory.metadataConst(_stockItem.id))>>
+
 	<<if !_limit or (_currentItemAmount + _stockItem.amount) <= _limit>>
 		<div class="stockItem">
-			<span class="label">_stockItem.label</span>
+			<<if _stockItem.desc or _stockItem.image>>
+				<span class="label"><<textWithTooltip _stockItem.label>><<if _stockItem.image>><<image _stockItem.image>><br/><</if>><<if _stockItem.desc>>_stockItem.desc<</if>><</textWithTooltip>></span>			
+			<<else>>
+				<span class="label">_stockItem.label</span>			
+			<</if>>
 			<span class="amount">_stockItem.amount</span>
 			<span class="price"><<money _stockItem.price>></span>
 			<<capture _stockItem>>
@@ -24,30 +31,6 @@
 		<span class="pcOwned"><<=_currentItemAmount>></span>
 	<</if>>
 
-	/*<<set _stockItem to {}>>
-
-	<<set _limit = 0>>
-	<<if _options and _options.limit>>
-		<<set _limit = _options.limit>>
-	<</if>>
-
-	<<if _limit == 0 or (getvar(_stockItem.varName) + _stockItem.amount) <= _limit >>
-		<div class="stockItem">
-			<span class="label">_stockItem.label</span>
-			<span class="amount">_stockItem.amount</span>
-			<span class="price"><<money _stockItem.price>></span>
-			<<capture _stockItem>>
-				<<buyButton _stockItem.price 3>>
-					<<set _currentCount = getvar(_stockItem.varName)>>
-					<<set _newcount = _currentCount + _stockItem.amount>>
-					<<run setvar(_stockItem.varName,_newcount)>>
-					<<gt _returnPassage _returnPassageArgs>>
-				<</buyButton>>
-			<</capture>>
-			<span class="pcOwned"><<=getvar(_stockItem.varName)>></span>
-		</div>
-	<</if>>*/
-
 <</widget>>
 
 <<widget "buyButton" container>>

+ 72 - 7
sugarcube/src/items/Inventory.js

@@ -1,5 +1,64 @@
 setup.items = setup.items || {};
-setup.items['umbrella'] = {limit: 1};
+setup.items['computer'] = {
+	label: 'Computer',
+	limit: 1
+}
+setup.items['condom'] = {
+	label: 'Condom',
+	image:'locations/pavlovsk/market/condoms.jpg',
+	desc: 'Protects you against STDs and unwanted pregnancies. The later has a risk of failing, which is higher if the person who puts the condom on is inexperienced. Also, condoms from some sources are of low quality and have an increased risk of failing.'
+}
+setup.items['cosmetics'] = {
+	label: 'Make-up',
+	image: 'pc/items/makeup.jpg',
+	desc:"This collection of makeup consists of a diverse assortment of cosmetic products designed to enhance one's appearance. It encompasses a wide range of items such as foundations, concealers, eyeshadows, lipsticks, blushes, mascaras, and more.<br/>Applying light make-up consumes one use, medium make-up consumes two uses and more than that requires you to use three uses.<br/>You can buy more make-up at the super market."
+}
+setup.items['food'] = {
+	label: 'Regular food',
+	image: 'pc/items/food.jpg',
+	desc: "Various different ingredients for the preparation of a meal, such as vegetables, meat and spices. While healthy, you won't be able to use them to cook something that is both filling and makes you lose weight."
+}
+setup.items['foodDiet'] = {
+	label: 'Diet food',
+	image: 'pc/items/foodDiet.jpg',
+	desc: "Mostly consisting of exotic fruits and vegetables, these ingredients allow you to create meals which are healthy and filling, while allowing you to lose weight."
+}
+setup.items['hairPin'] = {
+	label: 'Hair Pin',
+	image: 'pc/items/hairPins.webp'
+}
+setup.items['hairScrunchie'] = {
+	label: 'Hair Scrunchie',
+	image: 'pc/items/srunchies.jpg'
+}
+setup.items['lipbalm'] = {
+	label: 'Lipbalm',
+	image: 'pc/items/lipbalm.jpg'
+}
+setup.items['razor'] = {
+	label: 'Razor',
+	image: 'pc/items/razor.png',
+	desc:"A shaving tool specifically designed for hair removal. It features a single, sharp blade enclosed within a protective housing. It offers a simple and convenient temporary solution for achieving smooth skin.<br/>To shave your legs and your pubic hair, you need one razor each.<br/>You can buy new razors in the cosmetics department of a super market."
+}
+setup.items['sunblock'] = {
+	label: 'Sunblock',
+	image: 'pc/items/sunblock.jpg',
+	desc:"Used for protecting the skin against sunburns and premature aging during sunbathing.<br/>One potion of sunblock lasts for 30 minutes. You will automatically apply it before sunbathing if you have it with you.<br/>You can buy additional sunblock in the cosmetics department of a super market."
+}
+setup.items['tampon'] = {
+	label: 'Tampon',
+	image: 'pc/items/tampon.jpg',
+	desc:"Tampons are feminine hygiene products designed to be inserted into the vagina during menstruation. They offer discreet and convenient menstrual protection, absorbing menstrual fluid to help keep individuals feeling clean and comfortable. They are equipped with a string or cord for easy removal.<br/>During your menstruation, you need to change your tampon at least once a day.<br/>You can buy new tampons at the pharmacy. You could also ask other females for one in case of an emergency."
+}
+setup.items['umbrella'] = {
+	label: 'Umbrella',
+	limit: 1,
+	desc: 'Protects your hair and make-up against rain.'
+};
+setup.items['vitamin'] = {
+	label: 'Vitamin Pills',
+	image: 'pc/items/vitamin.jpg'
+}
 
 class Inventory{
 
@@ -34,18 +93,24 @@ class Inventory{
 			this.metadataSet(item,container,metadata);
     }
 
-	itemsInContainer(container='default'){
-		return this._containers?.[container] || {};
+	itemsInContainer(container='default',includeZeroCount=true){
+		if(includeZeroCount)
+			this._containers?.[container] || {};
+		let containerData = this._containers?.[container] || {};
+		let result = {};
+		for (const [itemId, itemData] of Object.entries(containerData)) {
+			if(this.get(itemId,container) > 0)
+				result[itemId] = itemData;
+		}
+		return result;
 	}
 
 	// ----- Metadata -----
 	itemsInContainerByMetadata(filters,container='default',includeZeroCount=true){
 		let result = {};
-		let itemsInContainer = this.itemsInContainer(container);
+		let itemsInContainer = this.itemsInContainer(container,includeZeroCount);
 		itemLoop: for (const [itemId, itemData] of Object.entries(itemsInContainer)) {
 			let count = this.get(itemId,container);
-			if(!includeZeroCount && !count)
-				continue;
 			let metadata = this.metadata(itemId);
 			for (const [filterKey, filterValue] of Object.entries(filters)) {
 				if(filterValue != metadata[filterKey])
@@ -57,7 +122,7 @@ class Inventory{
 	}
 
 	metadata(item,container='default'){
-		return Object.assign({},this.metadataConst(item),this.metadataDynamic(item,container));
+		return Object.assign({label:item},this.metadataConst(item),this.metadataDynamic(item,container));
 	}
 
 	/**

+ 14 - 3
sugarcube/src/items/Purse.tw

@@ -6,9 +6,20 @@
 	<<else>>
 		<p>You are carrying your items in your pockets.</p>
 	<</if>>
-	<<for _key, _data range $inventory.itemsInContainer()>>
-		<p>_key: _data.count</p>
-	<</for>>
+
+	<div class="itemsOverview">
+		<<for _itemId, _data range $inventory.itemsInContainer('default',false)>>
+			<<set _styleClass = 'item linkedImage '>>
+			<<set _itemData = $inventory.metadata(_itemId)>>
+			<div @class='_styleClass'>
+				<<if _itemData.image>>
+					<<image _itemData.image>>
+				<</if>>
+				<span class="count">_data.count</span>
+				<<textWithTooltip ''>>_itemData.label<br/><<if _itemData.desc>>_itemData.desc<</if>><</textWithTooltip>>
+			</div>
+		<</for>>
+	</div>
 
 	<<set _ownedCars =  $inventory.itemsInContainerByMetadata({type:'car'},'vehicles',false)>>
 	<<if !jQuery.isEmptyObject(_ownedCars)>>

+ 21 - 0
sugarcube/src/items/purse.css

@@ -0,0 +1,21 @@
+.item .count{
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	text-shadow: 0px 0px 5px black;
+	font-size: 5em;
+}
+
+.item .withTooltip{
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+	z-index: 20;
+}

+ 2 - 2
sugarcube/src/locations/pavlov/pav_pharmacy.tw

@@ -78,9 +78,9 @@
 
 	<<shopItemList>>
 		<<stockItem `{id:'vitamin',amount:30,price:130,label:'Vitamin Pills'}`>>
-		<<stockItem `{id:'painkiller',amount:50,price:435,label:'Painkillers'}`>>
+		/*<<stockItem `{id:'painkiller',amount:50,price:435,label:'Painkillers'}`>>*/
 		<<stockItem `{id:'tampon',amount:20,price:200,label:'Tampons'}`>>
-		<<stockItem `{id:'sanpad',amount:20,price:100,label:'Sanitary napkins'}`>>
+		/*<<stockItem `{id:'sanpad',amount:20,price:100,label:'Sanitary napkins'}`>>*/
 		<<stockItem `{id:'lipbalm',amount:30,price:127,label:'Lip balm'}`>>
 	<</shopItemList>>
 :: pav_pharmacy_old_shoplist

Разлика између датотеке није приказан због своје велике величине
+ 543 - 622
sugarcube/src/locations/pavlov/pav_train_market.tw


+ 14 - 17
sugarcube/src/locations/stores/shop.tw

@@ -24,7 +24,7 @@
 
 	<<if $time.hour >= 8 and $time.hour <= 20>>
 		<<if _thisMainPassage == 'shop'>>
-			<<ConnectedLocation 'ATM' 'shop_atm' '' "locations/shared/store/atm.jpg" 1>>
+			/*<<ConnectedLocation 'ATM' 'shop_atm' '' "locations/shared/store/atm.jpg" 1>>*/
 		<<else>>
 			<<if _thisMainPassage != 'shop'>><<ConnectedLocation 'Checkout' 'shop' '' "locations/shared/store/shop.jpg" 1>><</if>>
 		<</if>>
@@ -102,7 +102,7 @@
 		<</if>>
 	<</if>>*/
 
-:: shop_atm
+/*:: shop_atm
 	<h2>ATM</h2>
 	<<image "locations/shared/store/atm.jpg">>
 	<<if $finances.hasBankAccount == 1>>
@@ -181,7 +181,7 @@
 	<</if>>
 	<<actCLA 'Move away'>>
 		<<gt 'shop'>>
-	<</actCLA>>
+	<</actCLA>>*/
 
 :: shop_grocery[public indoors]
 	<<include 'shop_navigation'>>
@@ -195,7 +195,7 @@
 			<<stockItem `{id:'food',amount:10,price:800,label:'Regular food'}`>>
 			<<stockItem `{id:'foodDiet',amount:1,price:300,label:'Diet food'}`>>
 			<<stockItem `{id:'foodDiet',amount:10,price:3000,label:'Diet food'}`>>
-			<<stockItem `{id:'biscuit',amount:10,price:400,label:'Tea biscuits'}`>>
+			/*<<stockItem `{id:'biscuit',amount:10,price:400,label:'Tea biscuits'}`>>
 
 			<<if $wardrobe.purseEquipped > 0>>
 				<<stockItem `{id:'water',amount:1,price:100,label:'Bottle of water'}`>>
@@ -205,17 +205,14 @@
 				<span class="information">
 					If you had a handbag, you could buy bottles of water and wine and a sandwich.
 				</span>
-			<</if>>
+			<</if>>*/
 		<</shopItemList>>
 
 		/*<<actCLA 'Go to the pet aisle'>>
 			<<gt 'shop_dog'>>
 		<</actCLA>>*/
 	<</if>>
-:: shop_dog
-
-	<<set $menu_off = 1>>
-	<<set $location_type = 'public_indoors'>>
+:: shop_dog[public indoors]
 	<<image "characters/shared/rex/pet_isle.jpg">>
 	You're currently in the pet aisle, where you can buy food, treats and other things for your dog.
 	<<actCLA 'Leave'>>
@@ -317,20 +314,20 @@
 		<<set _shopLocation to 'shop_cosmetics'>>
 		<<shopItemList>>
 			<<stockItem `{id:'cosmetics',amount:50,price:1300,label:'Cosmetics'}`>>
-			<<stockItem `{id:'moisturizer',amount:30,price:2100,label:'Moisturizer'}`>>
+			/*<<stockItem `{id:'moisturizer',amount:30,price:2100,label:'Moisturizer'}`>>*/
 			<<stockItem `{id:'lipbalm',amount:30,price:127,label:'Lip balm'}`>>
 			<<stockItem `{id:'razor',amount:25,price:350,label:'Razors'}`>>
-			<<stockItem `{id:'deo',amount:40,price:200,label:'Deodorant'}`>>
+			/*<<stockItem `{id:'deo',amount:40,price:200,label:'Deodorant'}`>>*/
 			<<stockItem `{id:'tampon',amount:20,price:200,label:'Tampons'}`>>
-			<<stockItem `{id:'sanpad',amount:30,price:100,label:'Sanitary napkins'}`>>
-			<<stockItem `{id:'shampoo',amount:30,price:250,label:'Shampoo'}`>>
+			/*<<stockItem `{id:'sanpad',amount:30,price:100,label:'Sanitary napkins'}`>>
+			<<stockItem `{id:'shampoo',amount:30,price:250,label:'Shampoo'}`>>*/
 			<<stockItem `{id:'hairScrunchie',amount:80,price:1300,label:'Hair scrunchies'}`>>
 			<<stockItem `{id:'hairPin',amount:12,price:100,label:'Hair pins'}`>>
-			<<stockItem `{id:'falselashesplain',amount:10,price:100,label:'Plain false lashes'}`>>
-			<<stockItem `{id:'falselashesmink',amount:3,price:100,label:'Mink false lashes'}`>>
+			/*<<stockItem `{id:'falselashesplain',amount:10,price:100,label:'Plain false lashes'}`>>
+			<<stockItem `{id:'falselashesmink',amount:3,price:100,label:'Mink false lashes'}`>>*/
 			<<stockItem `{id:'sunblock',amount:20,price:100,label:'Sunblock'}`>>
 
-			<<if $wardrobe.purseEquipped > 0>>
+			/*<<if $wardrobe.purseEquipped > 0>>
 				<<stockItem `{id:'wipe',amount:10,price:50,label:'Wipes'}`>>
 				<<stockItem `{id:'mouthwash',amount:20,price:150,label:'Mouthwash'}`>>
 				<<stockItem `{id:'comb',amount:1,price:150,label:'Comb'}`>>
@@ -339,7 +336,7 @@
 				<span class="information">
 					If you had a handbag, you could buy wipes, portable makeup, mouthwash, combs and compact mirrors.
 				</span>
-			<</if>>
+			<</if>>*/
 
 
 		<</shopItemList>>

+ 1 - 0
sugarcube/src/macros/0macros.twee-config.json

@@ -34,6 +34,7 @@
 					"passage |+ var|text|number |+ var|text|number |+ var|text|number |+ var|text|number |+ var|text|number |+ var|text|number |+ var|text|number |+ var|text|number |+ var|text|number |+ var|text|number"
 				]
 			},
+			"refresh":{"description":"Reloads the current passage. Should be used with care, since the passage will reexecute all its code."},
 			"regt":{},"ret":{"description":"Creates an action that, if clicked, takes the player back to the last location. Shorthand for <<act 'Return'>><<gt $location>><</act>>. Arg[0] can be specified for a custom label of the button (e.g. <<ret 'Close'>>)."},
 			"xgt":{
 				"description":"Variant version of gt. Currently there is no reason not to use gt instead, so that's what's advised.",

Неке датотеке нису приказане због велике количине промена