|
@@ -1,8 +1,63 @@
|
|
|
-:: shop_events[events]
|
|
|
- <<if $time.hour < 8 or $time.hour > 20>>
|
|
|
- <h2>Supermarket</h2>
|
|
|
- The supermarket is currently closed.
|
|
|
- <<include 'shop_navigation'>>
|
|
|
+:: shop_scripts[script]
|
|
|
+setup.openTime ??= {};
|
|
|
+setup.openTime.shop={
|
|
|
+ days:'work',
|
|
|
+ open:[6,0],
|
|
|
+ close:[22,0]
|
|
|
+}
|
|
|
+
|
|
|
+setup.isOpen ??= function(openTime){
|
|
|
+ if(typeof openTime == "string")
|
|
|
+ openTime = setup.openTime[openTime];
|
|
|
+ let days = openTime.days;
|
|
|
+ switch(days){
|
|
|
+ case 'work':
|
|
|
+ days = [1,2,3,4,5,6];
|
|
|
+ }
|
|
|
+ let time = State.variables.time;
|
|
|
+ if(!days.includes(time.weekday))
|
|
|
+ return false;
|
|
|
+
|
|
|
+ let openMinutes = openTime.open[0] * 60 + openTime.open[1];
|
|
|
+ let closeMinutes= openTime.close[0]* 60 + openTime.close[1];
|
|
|
+
|
|
|
+ let minutesSinceMidnight = time.minutesSinceMidnight;
|
|
|
+
|
|
|
+ //Default case: the place isn't open over midnight
|
|
|
+ if(openMinutes <= closeMinutes)
|
|
|
+ return (minutesSinceMidnight >= openMinutes && minutesSinceMidnight < closeMinutes);
|
|
|
+
|
|
|
+ // The place is open over midnight
|
|
|
+ if(minutesSinceMidnight >= openMinutes)
|
|
|
+ return days.includes((time.weekday + 1) % 7 || 7); // The place is only open if it listed to be open tomorrow at well.
|
|
|
+ if(minutesSinceMidnight < closeMinutes)
|
|
|
+ return days.includes((time.weekday + 6) % 7 || 7); // The place is only open if it listed to be open yesterday at well.
|
|
|
+ return false;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+setup.openTimeToString = function(openTime){
|
|
|
+ let result = '';
|
|
|
+ if(typeof openTime == "string")
|
|
|
+ openTime = setup.openTime[openTime];
|
|
|
+ if(typeof openTime.days == "string"){
|
|
|
+ switch(openTime.days){
|
|
|
+ case 'work': result += 'from Monday to Saturday ';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result += 'from '+openTime.open[0].toString().padStart(2,"0") +':'+openTime.open[1].toString().padStart(2,"0");
|
|
|
+ result += ' to ' +openTime.close[0].toString().padStart(2,"0")+':'+openTime.close[1].toString().padStart(2,"0");
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+:: shop_events[events shop_events]
|
|
|
+ <<if !setup.isOpen('shop')>>
|
|
|
+ <<event 100000>>
|
|
|
+ <h2>Supermarket</h2>
|
|
|
+ The supermarket is currently closed.
|
|
|
+ <<include 'shop_navigation'>>
|
|
|
+ <<eventFired>>
|
|
|
+ <</event>>
|
|
|
<</if>>
|
|
|
|
|
|
:: shop_navigation[include]
|
|
@@ -22,7 +77,7 @@
|
|
|
<</ConnectedLocationCode>>
|
|
|
<</switch>>
|
|
|
|
|
|
- <<if $time.hour >= 8 and $time.hour <= 20>>
|
|
|
+ <<if setup.isOpen('shop')>>
|
|
|
<<if _thisMainPassage == 'shop'>>
|
|
|
/*<<ConnectedLocation 'ATM' 'shop_atm' '' "locations/shared/store/atm.jpg" 1>>*/
|
|
|
<<else>>
|
|
@@ -39,7 +94,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
-:: shop[public indoors hasEvents]
|
|
|
+:: shop[public indoors]
|
|
|
<<include 'shop_navigation'>>
|
|
|
|
|
|
/*<<act "MegaFon">><<set $time.minutes += 1>><<gt 'shop_megafon'>><</act>>
|
|
@@ -187,7 +242,7 @@
|
|
|
<<include 'shop_navigation'>>
|
|
|
<h2>Grocery</h2>
|
|
|
<<image "locations/shared/store/shop1.jpg">>
|
|
|
- <<if $time.hour < 8 or $time.hour > 20>>
|
|
|
+ <<if !setup.isOpen('shop')>>
|
|
|
The grocery department is currently closed.
|
|
|
<<else>>
|
|
|
<<shopItemList>>
|
|
@@ -308,7 +363,7 @@
|
|
|
<<include 'shop_navigation'>>
|
|
|
<h2>Cosmetics Department</h2>
|
|
|
<<image "locations/shared/store/shop2.jpg">>
|
|
|
- <<if $time.hour < 8 or $time.hour > 20>>
|
|
|
+ <<if !setup.isOpen('shop')>>
|
|
|
The cosmetics department is currently closed.
|
|
|
<<else>>
|
|
|
<<set _shopLocation to 'shop_cosmetics'>>
|
|
@@ -349,7 +404,7 @@
|
|
|
<<include 'shop_navigation'>>
|
|
|
<h2>Division of household goods</h2>
|
|
|
<<image "locations/shared/store/shop3.jpg">>
|
|
|
- <<if $time.hour < 8 or $time.hour > 20>>
|
|
|
+ <<if !setup.isOpen('shop')>>
|
|
|
The hardware department is currently closed.
|
|
|
<<else>>
|
|
|
<<shopItemList>>
|
|
@@ -384,7 +439,7 @@
|
|
|
<h2>Department of Women's Clothing</h2>
|
|
|
<<image "locations/shared/store/shop4.jpg">>
|
|
|
This department only sells cheap underwear and ice skates.
|
|
|
- <<if $time.hour < 8 or $time.hour > 20>>
|
|
|
+ <<if !setup.isOpen('shop')>>
|
|
|
The women''s clothing department is currently closed.
|
|
|
<<else>>
|
|
|
<p>Women's panties and bras 300<b>₽</b> each</p>
|
|
@@ -430,7 +485,7 @@
|
|
|
<<include 'shop_navigation'>>
|
|
|
<h2>Department of household appliances</h2>
|
|
|
<<image "locations/shared/store/shop5.jpg">>
|
|
|
- <<if $time.hour < 8 or $time.hour > 20>>
|
|
|
+ <<if !setup.isOpen('shop')>>
|
|
|
The household appliance department is currently closed.
|
|
|
<<else>>
|
|
|
<<shopItemList>>
|