{"type":"group","name":"tattoo tracking","enabled":true,"id":1,"items":[{"type":"function","name":"onLoad","enabled":true,"id":369,"code":"// Place any code here you'd like to autorun when the system is loaded\n\nrun_function('Tattoo Checking', {}, 'Tattoo tracking');"},{"type":"function","name":"Tattoo Checking","enabled":true,"id":344,"code":"tattoos = {\n boundary: 0,\n lower_threshold: get_variable('tattoos_lower_threshold') || 10,\n \n boundary_check: reflex_find_by_name('trigger', 'Beginning/Ending', false, false, 'Tattoo tracking'),\n tattoo_check: reflex_find_by_name('trigger', 'Tattoo Check', false, false, 'Tattoo tracking'),\n \n tats: get_variable('tattoos_tats') || [\n 'shield',\n 'brazier',\n 'crystal',\n 'boar',\n 'web',\n 'starburst',\n 'moss',\n 'moon',\n 'hourglass',\n 'cloak',\n 'tree',\n 'mindseye',\n 'prism',\n ],\n \n current: [],\n \n missing() {\n // Logic inside a setTimeout so it displays AFTER your tattoos list instead of before it.\n setTimeout(\n () => {\n let missing = this.tats.filter(tattoo => !this.current.includes(tattoo));\n let length = missing.length;\n\n if (length == 0) {\n this.echo('All tattoos present! Continue with your day.', 'white');\n }\n else if (length == 1) {\n this.echo('You are missing the ', 'white',\n missing[0], 'orange',\n ' tattoo. Re-ink it!', 'white'\n );\n }\n else if (length == 2) {\n this.echo('You are missing the ', 'white',\n missing[0], 'orange',\n ' and ', 'white',\n missing[1], 'orange',\n ' tattoos. Re-ink them!', 'white'\n );\n }\n else {\n let block = [];\n for (let idx = 0; idx < length-1; ++idx) {\n block.push(missing[idx], 'orange', ', ', 'white');\n }\n block.push('and ', 'white', `${missing[length-1]} `, 'orange');\n \n block = ['You are missing the ', 'white', ...block, 'tattoos. Re-ink them!', 'white'];\n \n this.echo.apply(tattoos, block);\n }\n\n this.boundary = 0;\n }, 0\n );\n },\n \n change_threshold(threshold) {\n this.lower_threshold = parseInt(threshold);\n set_variable('tattoos_lower_threshold', this.lower_threshold);\n this.echo('Low charge highlight threshold set to ', 'white', threshold, 'orange');\n },\n \n display_tats() {\n this.echo('Maintained tattoos:\\n\\t', 'white', this.tats.join('\\n\\t'), 'grey');\n },\n \n modify_tats(operation, tattoo) {\n if (operation == 'remove') {\n if (this.tats.includes(tattoo)) {\n this.tats = this.tats.filter(tat => tat != tattoo);\n this.echo(\n 'Removed ', 'PaleVioletRed',\n 'the ', 'white',\n tattoo, 'orange',\n ' from your mainained tattoos.', 'white'\n );\n }\n else {\n this.echo(\n tattoo, 'orange',\n ' is not a maintained tattoo. Cannot remove what is not there.', 'white'\n );\n }\n }\n \n if (operation == 'add') {\n if (!this.tats.includes(tattoo)) {\n this.tats.push(tattoo);\n this.echo(\n 'Added ', 'MediumSeaGreen',\n 'the ', 'white',\n tattoo, 'orange',\n ' tattoo to your maintaned tattoos.', 'white'\n );\n }\n else {\n this.echo(\n \ttattoo, 'orange',\n ' is already a maintained tattoo.', 'white'\n );\n }\n }\n \n set_variable('tattoos_tats', this.tats);\n },\n \n display_commands() {\n this.echo(\n 'Tattoo Package Commands:\\n', 'white',\n ' LOAD TATTOOS'.padEnd(33,' ')+'- Reloads Tattoo Tracking package\\n', 'grey',\n \t' TAT LIST'.padEnd(33,' ')+'- Displays maintained tattoos\\n', 'grey',\n ' TAT THRESHOLD #'.padEnd(33,' ')+'- Sets # charges for low indicator\\n', 'grey',\n ' TAT LIST ADD '.padEnd(33,' ')+'- Adds tattoo to maintained tattoos\\n', 'grey',\n ' TAT LIST REMOVE '.padEnd(33,' ')+'- Removes tattoo from maintained tattoos\\n', 'grey',\n ' TATS'.padEnd(33,' ')+'- Shows missing and low charge tattoos\\n', 'grey'\n );\n },\n \n echo(...args) {\n let txt_length = args.length;\n let msg = $('', {class:\"mono\"});\n $('',{class:'timestamp mono no_out'}).text(`${client.getTimeMS()} `).appendTo(msg);\n $('',{style:'color:DodgerBlue'}).text('[').appendTo(msg);\n $('',{style:'color:OrangeRed'}).text('Tattoos').appendTo(msg);\n $('',{style:'color:DodgerBlue'}).text(']: ').appendTo(msg);\n\n if (txt_length == 1) {\n $('',{style:'color:White'}).text(args[0]).appendTo(msg);\n }\n else if (txt_length % 2 == 0) {\n for (let idx = 0; idx < txt_length; idx += 2) {\n $('',{style:`color:${args[idx+1]}`}).text(args[idx]).appendTo(msg);\n }\n }\n else {\n $('',{style:'color:Red'}).text('Error: # tattoos.echo params must be divisible by 2.').appendTo(msg);\n }\n\n print(msg[0].outerHTML);\n\t},\n};","items":[]},{"type":"alias","name":"Load Tattoos","enabled":true,"id":368,"matching":"exact","whole_words":true,"case_sensitive":true,"prefix_suffix":true,"actions":[{"action":"function","fn":"onLoad"},{"action":"script","script":"tattoos.echo('Tattoo Tracking package loaded!', 'white');"}],"text":"load tattoos"},{"type":"alias","name":"Display Commands","enabled":true,"id":367,"matching":"exact","whole_words":true,"case_sensitive":true,"prefix_suffix":true,"actions":[{"action":"script","script":"tattoos.display_commands();"}],"text":"tattoo","items":[]},{"type":"alias","name":"Show Tattoo List","enabled":true,"id":366,"matching":"exact","whole_words":true,"case_sensitive":true,"prefix_suffix":true,"actions":[{"action":"script","script":"tattoos.display_tats();"}],"text":"tat list","items":[]},{"type":"alias","name":"Change Threshold","enabled":true,"id":364,"matching":"regexp","whole_words":true,"case_sensitive":true,"prefix_suffix":true,"actions":[{"action":"script","script":"tattoos.change_threshold(args[1]);"}],"text":"^tat threshold (\\d+)$","items":[]},{"type":"alias","name":"Modify Tattoo List","enabled":true,"id":365,"matching":"regexp","whole_words":true,"case_sensitive":true,"prefix_suffix":true,"actions":[{"action":"script","script":"tattoos.modify_tats(args[1], args[2]);"}],"text":"^tat list (add|remove) (firefly|moss|feather|shield|mindseye|hammer|cloak|bell|crystal|moon|starburst|boar|web|tentacle|hourglass|brazier|prism|tree|megalith|ox|chameleon|talon)$","items":[]},{"type":"alias","name":"Parse Tattoos","enabled":true,"id":345,"matching":"exact","whole_words":true,"case_sensitive":true,"prefix_suffix":true,"actions":[{"action":"script","script":"tattoos.current = [];\nsend_command('tattoos');\n\nreflex_enable(tattoos.boundary_check);\nreflex_enable(tattoos.tattoo_check);"}],"text":"tats","items":[]},{"type":"trigger","name":"Tattoo Check","enabled":false,"id":343,"matching":"regexp","whole_words":true,"case_sensitive":true,"text":"^(?:Head|Torso|Left arm|Right arm|Left leg|Right leg|Back)\\s+(?:a|an) (\\S+) tattoo\\s+(\\d+|art|---|n/a)","actions":[{"action":"script","script":"tattoos.current.push(args[1]);\n\nif (args[1] != 'starburst' && parseInt(args[2]) <= tattoos.lower_threshold) {\n colorize_current_line(args[0].indexOf(args[2]), args[2].length, 'red', '');\n colorize_current_line(args[0].indexOf(args[1]), args[1].length, 'red', '');\n}"}],"items":[]},{"type":"trigger","name":"Beginning/Ending","enabled":false,"id":362,"matching":"exact","whole_words":true,"case_sensitive":true,"text":"-------------------------------------------------------------------------------","actions":[{"action":"script","script":"tattoos.boundary += 1;\nif (tattoos.boundary == 2) {\n tattoos.missing();\n reflex_disable(tattoos.boundary_check);\n reflex_disable(tattoos.tattoo_check);\n}"}],"items":[]},{"type":"trigger","name":"Tattoo Faded","enabled":true,"id":363,"matching":"regexp","whole_words":true,"case_sensitive":true,"text":"^A (\\w+) tattoo fades from view and disappears\\.$","actions":[{"action":"script","script":"tattoos.echo(\n 'Your ', 'white',\n args[1], 'orange',\n ' tattoo faded. Re-ink it!', 'white'\n)\n\n// Effectively gag but the line but keep the associated prompt so it looks nice.\nreplace_current_line(0, args[0].length, '', '', '');"}],"items":[]}],"description":"Makes noticing missing and low charge tattoos easier"}