diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-12-06 23:28:09 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-12-06 23:46:29 +0000 |
commit | 5a728c573112a6722be07d0680d891c5edf39c0f (patch) | |
tree | e8ce43e424405b279906fc87c680111910a674b7 /scripts | |
parent | Don't null punishment multiplier on unavailable punishment. (diff) | |
download | toy-5a728c573112a6722be07d0680d891c5edf39c0f.zip |
Externalise image tagging data
Supports drop-in image sets etc
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/toy.groovy | 113 |
1 files changed, 35 insertions, 78 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 8ddebd6..7f28561 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -35,88 +35,41 @@ final SOFT = "soft"; // Imagery final DRESSED = "dressed", TITS = "tits", PUSSY = "pussy", LINGERIE = "lingerie", TEASE = "tease", SIT = "sit", BOOTS = "boots", KNEEL = "kneel", STOOD = "stood", MEAN = "mean", CROP = "crop", ASS = "ass", SQUAT = "squat", SSSH = "sssh"; final nDRESSED = "!$DRESSED", nTITS = "!$TITS", nTEASE = "!$TEASE"; -def IMAGEDATA = { [ - [ domme: "ancilla", sets: [ - [ set: "corset", images: [ - [ image: 1, tags: [DRESSED, STOOD] ], - [ image: 2, tags: [DRESSED, STOOD] ], - [ image: 3, tags: [DRESSED, STOOD] ], - [ image: 4, tags: [DRESSED, STOOD] ], - [ image: 5, tags: [DRESSED, STOOD] ], - [ image: 6, tags: [DRESSED, STOOD] ], - [ image: 7, tags: [DRESSED, STOOD, TEASE] ], - [ image: 8, tags: [DRESSED, STOOD, ASS] ], - [ image: 9, tags: [DRESSED, STOOD, TEASE] ], - [ image: 10, tags: [DRESSED, STOOD, TEASE] ], - [ image: 11, tags: [KNEEL, TITS] ], - [ image: 12, tags: [KNEEL, TITS, ASS] ], - [ image: 13, tags: [KNEEL, TITS, LINGERIE] ], - [ image: 14, tags: [KNEEL, TITS, LINGERIE] ], - [ image: 15, tags: [SIT, TITS, LINGERIE] ], - [ image: 16, tags: [STOOD, TITS, LINGERIE] ], - ] ], - [ set: "crop", images: [ - [ image: 1, tags: [TITS, KNEEL, SSSH] ], - [ image: 2, tags: [TITS, KNEEL, MEAN, CROP] ], - [ image: 3, tags: [TITS, KNEEL, CROP] ], - [ image: 4, tags: [TEASE, KNEEL] ], - [ image: 5, tags: [STOOD, TITS] ], - [ image: 6, tags: [KNEEL, TITS] ], - [ image: 7, tags: [KNEEL, TITS] ], - [ image: 8, tags: [DRESSED, STOOD, CROP] ], - [ image: 9, tags: [DRESSED, STOOD, CROP] ], - [ image: 10, tags: [DRESSED, STOOD, CROP, TEASE] ], - [ image: 11, tags: [DRESSED, STOOD, CROP, TEASE] ], - [ image: 12, tags: [DRESSED, STOOD, CROP] ], - [ image: 13, tags: [DRESSED, STOOD, CROP] ], - [ image: 14, tags: [DRESSED, SIT, CROP, TEASE] ], - [ image: 15, tags: [TITS, SIT] ], - [ image: 16, tags: [TITS, STOOD] ], - ] ], - [ set: "dress", images: [ - [ image: 1, tags: [TITS, STOOD] ], - [ image: 2, tags: [TITS, STOOD] ], - [ image: 3, tags: [TITS, SIT] ], - [ image: 4, tags: [TITS, SIT] ], - [ image: 5, tags: [TITS, STOOD] ], - [ image: 6, tags: [TITS, STOOD, ASS] ], - [ image: 7, tags: [DRESSED, STOOD] ], - [ image: 8, tags: [DRESSED, STOOD] ], - [ image: 9, tags: [DRESSED, STOOD, ASS] ], - [ image: 10, tags: [DRESSED, STOOD, ASS] ], - [ image: 11, tags: [DRESSED, SQUAT] ], - [ image: 12, tags: [DRESSED, STOOD, TEASE] ], - [ image: 13, tags: [DRESSED, STOOD, TEASE] ], - [ image: 14, tags: [TITS, STOOD] ], - [ image: 15, tags: [TITS, STOOD] ], - ] ], - [ set: "pink", images: [ - [ image: 1, tags: [TITS, KNEEL, LINGERIE] ], - [ image: 2, tags: [TITS, KNEEL, LINGERIE] ], - [ image: 3, tags: [TITS, KNEEL, LINGERIE] ], - [ image: 4, tags: [TITS, KNEEL, LINGERIE] ], - [ image: 5, tags: [TITS, KNEEL, LINGERIE] ], - [ image: 6, tags: [TITS, KNEEL] ], - [ image: 7, tags: [DRESSED, KNEEL] ], - [ image: 8, tags: [DRESSED, STOOD] ], - [ image: 9, tags: [DRESSED, STOOD] ], - [ image: 10, tags: [DRESSED, STOOD, TEASE] ], - [ image: 11, tags: [DRESSED, STOOD, TEASE] ], - [ image: 12, tags: [KNEEL, LINGERIE] ], - [ image: 13, tags: [TITS, KNEEL, LINGERIE] ], - [ image: 14, tags: [TITS, KNEEL, LINGERIE] ], - [ image: 15, tags: [TITS, KNEEL, LINGERIE] ], - ] ], - ] - ] -] }; +final IMAGEDATA = { + return new File(getDataFolder() + "/images/toy") + .listFiles() + .findAll { d -> d.isDirectory(); } + .collect { d -> + [ + domme: d.getName(), + sets: d.listFiles() + .findAll { s -> s.isDirectory(); } + .collect { s -> + [ + set: s.getName(), + images: new File(s.getPath() + "/tags") + .readLines() + .collect { l -> + def fields = l.split(":"); + return [ + image: fields[0], + tags: fields[1] + .split(",") + .findAll { t -> !t.isEmpty() } + ]; + } + ] + } + ] + }; +}(); def selectImage = { domme, set, spec -> def meets = { i -> return spec.every({ s -> return (s[0] == "!") ? i.tags.indexOf(s.drop(1)) == -1 : i.tags.indexOf(s) != -1; }); }; - def matches = IMAGEDATA() + def matches = IMAGEDATA .find({ d -> d.domme == domme }) .sets.find({ s -> s.set == set }) .images.findAll({ i -> meets(i) }); @@ -129,7 +82,7 @@ def showImage = { spec -> return image.tags; }; def selectImageSet = { domme, specs -> - def matches = IMAGEDATA() + def matches = IMAGEDATA .find({ d -> d.domme == domme }) .sets.findAll({ s -> specs.every({ spec -> selectImage(domme, s.set, spec)})}); return matches[getRandom(matches.size())]; @@ -138,7 +91,7 @@ def dress = { specs -> def outfit = loadString("toy.owner.outfit"); def outfitTime = loadInteger("toy.owner.outfitTime"); if (outfitTime > getTime() - 7200) { // Recent, check - def prev = IMAGEDATA() + def prev = IMAGEDATA .find({ d -> d.domme == OWNER }) .sets.find({ s -> s.set == outfit }); if (specs.every({ spec -> selectImage(OWNER, prev.set, spec)})) { @@ -1209,6 +1162,7 @@ while (true) { * images/toy/ancilla/corset/7.jpg * images/toy/ancilla/corset/8.jpg * images/toy/ancilla/corset/9.jpg + * images/toy/ancilla/corset/tags * images/toy/ancilla/crop/1.jpg * images/toy/ancilla/crop/10.jpg * images/toy/ancilla/crop/11.jpg @@ -1225,6 +1179,7 @@ while (true) { * images/toy/ancilla/crop/7.jpg * images/toy/ancilla/crop/8.jpg * images/toy/ancilla/crop/9.jpg + * images/toy/ancilla/crop/tags * images/toy/ancilla/dress/1.jpg * images/toy/ancilla/dress/10.jpg * images/toy/ancilla/dress/11.jpg @@ -1240,6 +1195,7 @@ while (true) { * images/toy/ancilla/dress/7.jpg * images/toy/ancilla/dress/8.jpg * images/toy/ancilla/dress/9.jpg + * images/toy/ancilla/dress/tags * images/toy/ancilla/pink/1.jpg * images/toy/ancilla/pink/10.jpg * images/toy/ancilla/pink/11.jpg @@ -1255,6 +1211,7 @@ while (true) { * images/toy/ancilla/pink/7.jpg * images/toy/ancilla/pink/8.jpg * images/toy/ancilla/pink/9.jpg + * images/toy/ancilla/pink/tags * sounds/toy/165bpm.mp3 * sounds/toy/180bpm.mp3 * sounds/toy/240bpm.mp3 |