summaryrefslogtreecommitdiff
path: root/scripts/toy.groovy
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-12-23 17:54:27 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2018-12-23 17:54:27 +0000
commitfd8c03468300e255876c153fca812ca722698d2a (patch)
tree8e767e0757fca2661b1e711e7464f82da90b0dc3 /scripts/toy.groovy
parentAdd missing wait before chastity lockup (diff)
downloadtoy-fd8c03468300e255876c153fca812ca722698d2a.zip
Maintain the availability records
Diffstat (limited to 'scripts/toy.groovy')
-rw-r--r--scripts/toy.groovy13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 6e93dd2..3d8b064 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -1502,6 +1502,18 @@ def addAvail = { amount ->
def dayNum = getDayNum();
save("toy.availability.$dayNum", getAvail(dayNum) + amount);
};
+def tidyAvail = {
+ def p = load("toy.availability");
+ if (!p) return;
+ def p2 = [:];
+ final firstDay = getDayNum() - 20;
+ p.eachWithIndex{ avail, day ->
+ if (day >= firstDay && avail > 0) {
+ p2["$day"] = avail;
+ }
+ }
+ save("toy.availability", p2);
+};
if (localTime() > 25.75 || localTime() < 7.5) { // 1:45am - 7:30am
show("Mistress is sleeping...");
wait(10);
@@ -1537,6 +1549,7 @@ else {
leaveNote(null, null);
}
setupInitial();
+tidyAvail();
final cycleTime = 6;
showLounge();