From 5a728c573112a6722be07d0680d891c5edf39c0f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 6 Dec 2018 23:28:09 +0000 Subject: Externalise image tagging data Supports drop-in image sets etc --- images/toy/ancilla/corset/tags | 16 ++++++ images/toy/ancilla/crop/tags | 16 ++++++ images/toy/ancilla/dress/tags | 15 ++++++ images/toy/ancilla/pink/tags | 15 ++++++ scripts/toy.groovy | 113 +++++++++++++---------------------------- 5 files changed, 97 insertions(+), 78 deletions(-) create mode 100644 images/toy/ancilla/corset/tags create mode 100644 images/toy/ancilla/crop/tags create mode 100644 images/toy/ancilla/dress/tags create mode 100644 images/toy/ancilla/pink/tags diff --git a/images/toy/ancilla/corset/tags b/images/toy/ancilla/corset/tags new file mode 100644 index 0000000..2805a84 --- /dev/null +++ b/images/toy/ancilla/corset/tags @@ -0,0 +1,16 @@ +1:dressed,stood +2:dressed,stood +3:dressed,stood +4:dressed,stood +5:dressed,stood +6:dressed,stood +7:dressed,stood,tease +8:dressed,stood,ass +9:dressed,stood,tease +10:dressed,stood,tease +11:kneel,tits +12:kneel,tits,ass +13:kneel,tits,lingerie +14:kneel,tits,lingerie +15:sit,tits,lingerie +16:stood,tits,lingerie diff --git a/images/toy/ancilla/crop/tags b/images/toy/ancilla/crop/tags new file mode 100644 index 0000000..fb461f0 --- /dev/null +++ b/images/toy/ancilla/crop/tags @@ -0,0 +1,16 @@ +1:tits,kneel,sssh +2:tits,kneel,mean,crop +3:tits,kneel,crop +4:tease,kneel +5:stood,tits +6:kneel,tits +7:kneel,tits +8:dressed,stood,crop +9:dressed,stood,crop +10:dressed,stood,crop,tease +11:dressed,stood,crop,tease +12:dressed,stood,crop +13:dressed,stood,crop +14:dressed,sit,crop,tease +15:tits,sit +16:tits,stood diff --git a/images/toy/ancilla/dress/tags b/images/toy/ancilla/dress/tags new file mode 100644 index 0000000..7cb90ed --- /dev/null +++ b/images/toy/ancilla/dress/tags @@ -0,0 +1,15 @@ +1:tits,stood +2:tits,stood +3:tits,sit +4:tits,sit +5:tits,stood +6:tits,stood,ass +7:dressed,stood +8:dressed,stood +9:dressed,stood,ass +10:dressed,stood,ass +11:dressed,squat +12:dressed,stood,tease +13:dressed,stood,tease +14:tits,stood +15:tits,stood diff --git a/images/toy/ancilla/pink/tags b/images/toy/ancilla/pink/tags new file mode 100644 index 0000000..1a3786d --- /dev/null +++ b/images/toy/ancilla/pink/tags @@ -0,0 +1,15 @@ +1:tits,kneel,lingerie +2:tits,kneel,lingerie +3:tits,kneel,lingerie +4:tits,kneel,lingerie +5:tits,kneel,lingerie +6:tits,kneel +7:dressed,kneel +8:dressed,stood +9:dressed,stood +10:dressed,stood,tease +11:dressed,stood,tease +12:kneel,lingerie +13:tits,kneel,lingerie +14:tits,kneel,lingerie +15:tits,kneel,lingerie 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 -- cgit v1.2.3