![]() |
![]() The Voracious Resurgence |
![]() ![]() | |
Prime Weapons • Ultimate Weapons • Ultimate Augments • Abjurations iL119 • JSE Necks • Divergence Augments • Escutcheons | |
Reforged Armor Artifact: +1 • iL109 • iL119/+2/+3 Relic: +1/+2 • iL109 • iL119/+2/+3 Empyrean: +1/+2 • iL109 • iL119/+2/+3 |
Guides • Crafting • Trusts • Apex Monsters |
User:Alexeina/Guide Loot Code Generator
Auto-Generate wiki code for drops/loot using NimbleText
Step 1 - Open NimbleText
I have preconfigured NimbleText Live; open this link in your browser
https://nimbletext.com/Live/-466472721/ - VERSION 4 now supports inputs without wiki markup
https://nimbletext.com/Live/-1259166854/ - VERSION 5 !!EXPERIMENTAL!! now supports postfix overloading and all drop rate icons by checking for TH0 percentage values in the input; please let me know about any bugs found
Step 2 - Enter the Input Data
In the top area labeled as data, type or paste one or more rows of items, equipment, or KI.
Only enter one item per row.
The below example shows data input with wiki markup.
[[Bronze Dagger]] * [[Steel Sword]] :* [[Trishula|Supper Stabbity Polearm]]
The below example shows data input with no wiki markup. Notice that piping is still supported.
Bronze Dagger Trishula|Super Stabbity Polearm
Step 3 - OPTIONAL - settings to Prepend and Append WikiMarkup before and after each item
OverloadedPrefix - Prepends whatever text, such as WikiMarkup, you want to the beginning of each output row
Anything in-between the apostrophes will be placed at the very beginning of every row in the output.
If your input data is using wiki markup, then you most likely want to set
OverloadedPrefix = '';
If your input data is not using wiki markup, then you probably want to add some markup here such as a bullet.
OverloadedPrefix = '*';
OverloadedPostfix - Appends whatever text, such as WikiMarkup, you want to the end of each output row
Anything in-between the apostrophes will be appended to the end of every row in the output.
Generally speaking you'll not want to edit this value, leave it as
OverloadedPostfix = '';
Only a power user would use this feature so I'm not going to suggest what you might want to put as a value. I had table creation in mind when I implemented this feature. I'd be interested in hearing from you if you've found a great use for the OverloadedPostfix for other purposes than tables.
Step 4 - Set Correct Value for the UsingWikiMarkup Control Flag
Only boolean values are valid for UsingWikiMarkup. true or false
If the input data has wiki markup, make sure to set this flag as
UsingWikiMarkup = true;
If the input data does not have wiki markup, make sure to set this flag as
UsingWikiMarkup = false;
Step 5 - Create Results with Calculate
Press the Calculate button, or use the Auto-Calculate feature by checking the Auto-Calculate box.
Step 6 - Code Generation Completed
Copy auto-generated text from the bottom area labled results.
NOTICE - Icon and Description Images Can Be Wrong
Items with long names often have image files with shortened names such as Blk. instead of Black.
Check the image file names on the item's page if the Code Generator outputs image links that do not work.
Command Symbols and the Auto-Detect Feature
The Auto-Detect feature will usually process each row correctly, but in cases where the Auto-Detect is wrong you can instruct the Code Generator on how to process each row using Command Symbols.
Bypass Symbol - Period
Use a Period at the beginning of a row to Force the row to skip all processing and output exactly the same, no changes made. The Auto-Detect looks for a pair of opening brackets [[ to represent the row contains an item. Use the Period Command Symbol if [[ is on the row but you do not want to process the row as an item. The Bypass feature is useful for Notes or any other text that does not contain any items.
Key Item Symbol - Comma
Use a Comma at the beginning of a row to Force the row to be processed as a Key Item. Auto-Detect looks for KI or Key Item(both are case-insensitive) on the row. If either term is not present the Auto-Detect will not know the row contains a Key Item. So you have to tell it yourself.
Magic Scroll Symbol - Semicolon
Use a Semicolon at the beginning of a row to Force the row to be processed as a Magic Scroll. Auto-Detect looks for the word scroll(case-insensitive) on the row. If the term is not present the Auto-Detect will not know the row contains a Scroll. So you have to tell it yourself.
Version 4 JavaScript
No need to look at this section unless you're curious.
This is the JavaScript powering the Code Generator.
<% // Use a COMMA at the beginning of a row to FORCE processing as a Key Item. The pattern already attempts to Auto-Detect if the row is a Key Item. // Use a SEMICOLON at the beginning of a row to FORCE processing as a Scroll. The pattern already attempts to Auto-Detect if the row is a Scroll. // Use a PERIOD at the beginning of a row to bypass processing. The row will output exactly the same way it appears in the data window. // // FEEL FREE TO EDIT OverloadedPrefix TO ADD WIKI MARKUP IN FRONT OF ITEMS IN THE OUTPUT let OverloadedPrefix = '*'; // MAKE SURE TO SET UsingWikiMarkup TO true IF INPUT DATA HAS WIKI MARKUP; OTHERWISE SET UsingWikiMarkup TO false let UsingWikiMarkup = false; let ItemName = "itemname not set"; let Postfix = "postfix not set"; let Prefix = "prefix not set"; let PageLink = "pagelink not set"; let FoundImgpop = false; let DebugFlag = false; let DebugMessage = ""; // Check for a Period to bypass all processing and output the row exactly as it appears in the Data window if($0.charAt(0) === '.') { $0.substring(1); } // Check for no [[ which means there is no item on this row, so we shouldn't process the row, just pass it through else if(($0.search(/\[\[/gi) === -1) && UsingWikiMarkup) { $0; } else { // Set Variable values if somebody had already put in an imgpop and set all the fields correctly if($0.search(/imgpop/gi) > -1) { if(DebugFlag){ DebugMessage = 'hello I\'m in imgpop'; } FoundImgpop = true; PageLink = $0.split('imgpop|[[')[1].split(']]|')[0]; ItemName = $0.split(']]|')[1].split(' description')[0]; Prefix = $0.split('{{imgpop')[0]; // Check for any values in Postfix; can't assign null to Postfix afterall if($0.trim().split('=}}')[1]) { Postfix = ' ' + $0.split('=}}')[1].trim(); } else { Postfix = ''; } } // Check UsingWikiMarkup flag; if not UsingWikiMarkup must process inputs differently else if(UsingWikiMarkup === false) { if(DebugFlag){ DebugMessage = 'hello I\'m in else if usingwikimarkup'; } Prefix = OverloadedPrefix; ItemName = $0.split('|')[0]; // ItemNames must have ":" converted to "-" ItemName = ItemName.replace(":","-"); PageLink = $0.trim(); Postfix = ''; } else { if(DebugFlag){ DebugMesage = 'hello I\'m in else'; } Prefix = $0.split('[[')[0]; ItemName = $0.split('[[')[1].split(']]')[0].split('|')[0]; // ItemNames must have ":" converted to "-" ItemName = ItemName.replace(":","-"); PageLink = $0.split('[[')[1].split(']]')[0]; // Check for any values in Postfix; can't assign null to Postfix afterall if($0.trim().split(']]')[1]) { Postfix = ' ' + $0.split(']]')[1].trim(); } else { Postfix = ''; } // gdrop handling Postfix = Postfix.replace('(100%)','{{gdrop}}'); Postfix = Postfix.replace('100%','{{gdrop}}'); //Check to see if Prefix is supposed to be Overloaded/Replaced if(OverloadedPrefix !== '') { Prefix = OverloadedPrefix; if(DebugFlag){ DebugMessage = 'Prefix overloaded by OverloadedPrefix !== emptyString'; } } } // Detect if item is a KI if(($0.search(/Key Item|\{\{KI\}\}|\(KI\)/gi) > -1) || ($0.charAt(0) === ',')) { //Remove comma if it's present Prefix = Prefix.replace(',', ''); ItemName = ItemName.replace(',', ''); PageLink = PageLink.replace(',', ''); // Strip out Key Item from Prefix Prefix = Prefix.replace(/\(\{\{Key Item\}\}\)|\(key item\)|\(\{\{KI\}\}\)|\(KI\)/gi,''); // Catches matches with Parentheses Prefix = Prefix.replace(/\{\{Key Item\}\}|\{\{KI\}\}/gi,''); // Catches matches with only Curly Braces Prefix = Prefix.replace(/key item|KI/gi,''); // Catches matches without Parentheses or Curly Braces // Strip out Key Item from Postfix Postfix = Postfix.replace(/\(\{\{Key Item\}\}\)|\(key item\)|\(\{\{KI\}\}\)|\(KI\)/gi,''); // Catches matches with Parentheses Postfix = Postfix.replace(/\{\{Key Item\}\}|\{\{KI\}\}/gi,''); // Catches matches with only Curly Braces Postfix = Postfix.replace(/key item|KI/gi,''); // Catches matches without Parentheses or Curly Braces // Cleanup any lingering () Prefix = Prefix.replace('()',''); Postfix = Postfix.replace('()',''); // Cleanup any lingering {{}} Prefix = Prefix.replace('{{}}',''); Postfix = Postfix.replace('{{}}',''); // Key Item output Prefix.trim() + ' {{KI}} {{tooltip|text=[[' + PageLink + ']]|tooltip=[[File:' + ItemName + '.jpg]]}}' + Postfix + DebugMessage; } // Detect if item is a scroll else if(($0.search(/scroll|indi\-|Plate of|Spirit Pact|absorb\-|\: Ichi|\: Ni|\: San|gain\-|boost\-/gi) > -1) || ($0.charAt(0) === ";")) { // Remove semicolon if it's present Prefix = Prefix.replace(';', ''); ItemName = ItemName.replace(';', ''); PageLink = PageLink.replace(';', ''); // Strip unwanted text from ItemName and PageLink ItemName = ItemName.replace(/\(Scroll\)\s|scroll of\s|\spact|plate of\s/gi,""); ItemName = ItemName.replace(/\sscroll|scroll\s|\splate|plate\s/gi,""); PageLink = PageLink.replace(/\(Scroll\)\s|scroll of\s|plate of\s/gi,""); // It's okay for the pagelink of Spirit Pacts to keep the word Pact PageLink = PageLink.replace(/scroll\s|plate\s|\sscroll|\splate/gi,""); // Check for presence of (Scroll) at the end of ItemName, if not present then add (Scroll) to end of ItemName if(ItemName.search(/\(Scroll\)/gi) > -1) { // (Scroll) is already present nothing to do here) } else { ItemName = ItemName + ' (Scroll)'; } // Cleanup any lingering () Prefix = Prefix.replace('()',''); Postfix = Postfix.replace('()',''); // Cleanup of scroll found in Pagelink PageLink = PageLink.replace(/\s\(scroll\)/gi,""); PageLink = PageLink.replace(/\sscroll/gi,""); // If same text found before and after piping in the PageLink, remove piping and use terms left of pipe if(PageLink.split('|')[0] === PageLink.split('|')[1]) { PageLink = PageLink.split('|')[0]; } // Scroll Output Prefix + '{{ItemIcon|' + ItemName + '|22}} {{tooltip|text=[[' + PageLink + ']]|tooltip=[[File:' + ItemName + ' description.png]]}}' + Postfix + DebugMessage; } // All other items, not KI and not scrolls else { // Cleanup any lingering () //Postfix = Postfix.replace('()',''); //Postfix = Postfix.replace('\'\'\'',''); // All Other Item Output Prefix + '{{ItemIcon|' + ItemName + '|22}} {{tooltip|text=[['+ PageLink + ']]|tooltip=[[File:' + ItemName + ' description.png]]}}' + Postfix + DebugMessage; } } %>
Version 5 JavaScript
No need to look at this section unless you're curious.
This is the JavaScript powering the Code Generator.
<% // Use a COMMA at the beginning of a row to FORCE processing as a Key Item. The pattern already attempts to Auto-Detect if the row is a Key Item. // Use a SEMICOLON at the beginning of a row to FORCE processing as a Scroll. The pattern already attempts to Auto-Detect if the row is a Scroll. // Use a PERIOD at the beginning of a row to bypass processing. The row will output exactly the same way it appears in the data window. // // FEEL FREE TO EDIT OverloadedPrefix TO ADD WIKI MARKUP TO THE FRONT OF A ROW IN THE OUTPUT let OverloadedPrefix = ''; // FEEL FREE TO EDIT OverloadedPostfix TO ADD WIKI MARKUP TO THE END OF A ROW IN THE OUTPUT let OverloadedPostfix = ''; // MAKE SURE TO SET UsingWikiMarkup TO true IF INPUT DATA HAS WIKI MARKUP; OTHERWISE SET UsingWikiMarkup TO false let UsingWikiMarkup = true; let ItemName = "itemname not set"; let Postfix = "postfix not set"; let Prefix = "prefix not set"; let PageLink = "pagelink not set"; let FoundImgpop = false; let DebugFlag = false; let DebugMessage = ""; // Check for a Period to bypass all processing and output the row exactly as it appears in the Data window if($0.charAt(0) === '.') { $0.substring(1); } // Check for no [[ which means there is no item on this row, so we shouldn't process the row, just pass it through else if(($0.search(/\[\[/gi) === -1) && UsingWikiMarkup) { $0; } else { // Set Variable values if somebody had already put in an imgpop and set all the fields correctly if($0.search(/imgpop/gi) > -1) { if(DebugFlag){ DebugMessage = 'hello I\'m in imgpop'; } FoundImgpop = true; PageLink = $0.split('imgpop|[[')[1].split(']]|')[0]; ItemName = $0.split(']]|')[1].split(' description')[0]; Prefix = OverloadedPrefix + $0.split('{{imgpop')[0]; // Check for any values in Postfix; can't assign null to Postfix afterall if($0.trim().split('=}}')[1]) { Postfix = ' ' + $0.split('=}}')[1].trim() + OverloadedPostfix; } else { Postfix = OverloadedPostfix; } } // Check UsingWikiMarkup flag; if not UsingWikiMarkup must process inputs differently else if(UsingWikiMarkup === false) { if(DebugFlag){ DebugMessage = 'hello I\'m in else if usingwikimarkup'; } Prefix = OverloadedPrefix; ItemName = $0.split('|')[0].trim(); // ItemNames must have ":" converted to "-" ItemName = ItemName.replace(":","-"); PageLink = $0.trim(); Postfix = OverloadedPostfix; } else { if(DebugFlag){ DebugMesage = 'hello I\'m in else'; } Prefix = OverloadedPrefix + $0.split('[[')[0]; ItemName = $0.split('[[')[1].split(']]')[0].split('|')[0]; // ItemNames must have ":" converted to "-" ItemName = ItemName.replace(":","-"); PageLink = $0.split('[[')[1].split(']]')[0]; // Check for any values in Postfix; can't assign null to Postfix afterall if($0.trim().split(']]')[1]) { Postfix = ' ' + $0.split(']]')[1].trim() + OverloadedPostfix; } else { Postfix = OverloadedPostfix; } } // drop rate icons - replace percentage values based on TH0 Postfix = Postfix.replace('(0.5%)','{{srdrop}}'); // must execute before rdrop at 5% Postfix = Postfix.replace('0.5%','{{srdrop}}'); // must execute before rdrop at 5% Postfix = Postfix.replace('(0.1%)','{{urdrop}}'); // must execute before vrdrop at 1% Postfix = Postfix.replace('0.1%','{{urdrop}}'); // must execute before vrdrop at 1% Postfix = Postfix.replace('(100%)','{{gdrop}}'); Postfix = Postfix.replace('100%','{{gdrop}}'); Postfix = Postfix.replace('(24%)','{{vcdrop}}'); Postfix = Postfix.replace('24%','{{vcdrop}}'); Postfix = Postfix.replace('(15%)','{{cdrop}}'); Postfix = Postfix.replace('15%','{{cdrop}}'); Postfix = Postfix.replace('(10%)','{{udrop}}'); Postfix = Postfix.replace('10%','{{udrop}}'); Postfix = Postfix.replace('(5%)','{{rdrop}}'); Postfix = Postfix.replace('5%','{{rdrop}}'); Postfix = Postfix.replace('(1%)','{{vrdrop}}'); Postfix = Postfix.replace('1%','{{vrdrop}}'); // Detect if item is a KI if(($0.search(/Key Item|\{\{KI\}\}|\(KI\)/gi) > -1) || ($0.charAt(0) === ',')) { //Remove comma if it's present Prefix = Prefix.replace(',', ''); ItemName = ItemName.replace(',', ''); PageLink = PageLink.replace(',', ''); // Strip out Key Item from Prefix Prefix = Prefix.replace(/\(\{\{Key Item\}\}\)|\(key item\)|\(\{\{KI\}\}\)|\(KI\)/gi,''); // Catches matches with Parentheses Prefix = Prefix.replace(/\{\{Key Item\}\}|\{\{KI\}\}/gi,''); // Catches matches with only Curly Braces Prefix = Prefix.replace(/key item|KI/gi,''); // Catches matches without Parentheses or Curly Braces // Strip out Key Item from Postfix Postfix = Postfix.replace(/\(\{\{Key Item\}\}\)|\(key item\)|\(\{\{KI\}\}\)|\(KI\)/gi,''); // Catches matches with Parentheses Postfix = Postfix.replace(/\{\{Key Item\}\}|\{\{KI\}\}/gi,''); // Catches matches with only Curly Braces Postfix = Postfix.replace(/key item|KI/gi,''); // Catches matches without Parentheses or Curly Braces // Cleanup any lingering () Prefix = Prefix.replace('()',''); Postfix = Postfix.replace('()',''); // Cleanup any lingering {{}} Prefix = Prefix.replace('{{}}',''); Postfix = Postfix.replace('{{}}',''); // Key Item output Prefix + '{{KI}} {{tooltip|text=[[' + PageLink.trim() + ']]|tooltip=[[File:' + ItemName.trim() + '.jpg]]}}' + Postfix + DebugMessage; } // Detect if item is a scroll else if(($0.search(/scroll|indi\-|Plate of|Spirit Pact|absorb\-|\: Ichi|\: Ni|\: San|gain\-|boost\-/gi) > -1) || ($0.charAt(0) === ";")) { // Remove semicolon if it's present Prefix = Prefix.replace(';', ''); ItemName = ItemName.replace(';', ''); PageLink = PageLink.replace(';', ''); // Strip unwanted text from ItemName and PageLink ItemName = ItemName.replace(/\(Scroll\)\s|scroll of\s|\spact|plate of\s/gi,""); ItemName = ItemName.replace(/\sscroll|scroll\s|\splate|plate\s/gi,""); PageLink = PageLink.replace(/\(Scroll\)\s|scroll of\s|plate of\s/gi,""); // It's okay for the pagelink of Spirit Pacts to keep the word Pact PageLink = PageLink.replace(/scroll\s|plate\s|\sscroll|\splate/gi,""); // Check for presence of (Scroll) at the end of ItemName, if not present then add (Scroll) to end of ItemName if(ItemName.search(/\(Scroll\)/gi) > -1) { // (Scroll) is already present nothing to do here) } else { ItemName = ItemName + ' (Scroll)'; } // Cleanup any lingering () Prefix = Prefix.replace('()',''); Postfix = Postfix.replace('()',''); // Cleanup of scroll found in Pagelink PageLink = PageLink.replace(/\s\(scroll\)/gi,""); PageLink = PageLink.replace(/\sscroll/gi,""); // If same text found before and after piping in the PageLink, remove piping and use terms left of pipe if(PageLink.split('|')[0] === PageLink.split('|')[1]) { PageLink = PageLink.split('|')[0]; } // Scroll Output Prefix + '{{ItemIcon|' + ItemName.trim() + '|22}} {{tooltip|text=[[' + PageLink.trim() + ']]|tooltip=[[File:' + ItemName.trim() + ' description.png]]}}' + Postfix + DebugMessage; } // All other items, not KI and not scrolls else { // All Other Item Output Prefix + '{{ItemIcon|' + ItemName.trim() + '|22}} {{tooltip|text=[['+ PageLink.trim() + ']]|tooltip=[[File:' + ItemName.trim() + ' description.png]]}}' + Postfix + DebugMessage; } } %>