Crafting [Scenario Generator]

Forum Forums Grids and Presets Crafting [Scenario Generator]

This topic contains 216 replies, has 69 voices, and was last updated by Lyfox Lyfox 2 years, 1 month ago.

Viewing 15 posts - 1 through 15 (of 217 total)
  • Author
    Posts
  • #3440
    Lyfox
    Lyfox
    Participant
    18+

    EDIT:
    This generator is now adapted for Garland Tools.

    Part 1. Ffxivcrafting.com (read here)
    Part 2. Garland Tools.

    ——————————————————————————
    So lately ive been using this site for crafting: http://ffxivcrafting.com/
    Its insanely convenient for stuff like GC deliveries and gear sets. You make a list of recipes and it tells you all the reagents all the way to the bottom of craft tree. Now that Miqo gave us scenarios i thought maybe i could use it for some smart scenario baking. It turned out amazingly great and now i think every respectful miqocrafter must have this tool.

    Its written in javascript but relax you dont need to know coding to use it. Everything is already coded you just have to ctrlc-ctrlv in the right places.

    1. Go to recipe book: http://ffxivcrafting.com/recipes . Use search by name and button on the right to make your crafting list.
    2. Go to your crafting list: http://ffxivcrafting.com/list . Press the green button “Craft These Items”.
    3. Go through sections #1 and #2 and upload these into your inventory. If youre a hoarder like me you should have everything in your retainers. Click on those youve obtained its a cool visual progress.
    4. Now open web console. Ctrl-Shift-J in most browsers.
    5. Copy and paste this script:

    var rJob = function(val){
       return $(val).children("td:eq(4)").children("img:eq(0)").attr("src").replace("/img/jobs","").replace("/","").replace("-inactive","").replace(".png","");
    };
    var rRecipe = function(val){
       return $(val).children("td:eq(0)").find("a:eq(1)").text().trim();
    };
    var rNeeded = function(val){
       var txt = $(val).children("td:eq(1)").children("span").text();
       var val = $(val).children("td:eq(1)").children("input").val();
       return val > 0 ? val : txt;
    };
    var rYields = function(val){
       return $(val).attr("data-yields");
    };
    var rCount = function(val){
       return Math.ceil(rNeeded(val)/rYields(val));
    };
    var chapter = function(tableId){
       var reagents = $("tbody#"+tableId).children("tr.reagent").not(".success");
       reagents.sort(function(a, b){
          var lvlA = parseInt( $(a).attr("data-ilvl") );
          var lvlB = parseInt( $(b).attr("data-ilvl") );
          return (lvlA < lvlB) ? -1 : (lvlA > lvlB) ? 1 : 0;
       });
       for(var i=0; i<reagents.length; i++){
          var craftsLater = [];
          var from = -1;
          var to = -1
          //console.log(reagents.get().map(rRecipe));
          $(reagents.get().reverse()).each(function(index){
             var itemId = $(this).attr("data-item-id");
             var requires = $(this).attr("data-requires").split("&").map(function(value){ return value.split("x")[1]; });
             var isCraftable = requires.reduce(function(isCraftable, requireId){
                if(!isCraftable)
                   return false;
                if(craftsLater.indexOf(requireId)>=0){
                   from = index;
                   to = craftsLater.indexOf(requireId);
                   return false;
                }
                return true;
             }, true);
             //console.log(rRecipe(this)+":"+(isCraftable?1:0));
             if(!isCraftable)
                return false;
             craftsLater.push(itemId);
          });
          if(from < 0 || to < 0)
             break;
          from = reagents.length-1 - from;
          to = reagents.length-1 - to;
          reagents.splice(to, 0, reagents.splice(from, 1)[0]);
       }
       var miqo = "";
       reagents.each(function(){
          miqo += "job("+rJob(this)+")\r\n";
          miqo += "recipe("+rRecipe(this)+")\r\n";
          miqo += "craft("+rCount(this)+")\r\n";
       });
       miqo += "//--Section crafts: "+reagents.get().reduce(function(allCount, val){ return allCount+rCount(val); },0)+"\r\n";
       return miqo;
    };
    var antiDuplicate = function(miqo){
       var dupList = [
          ["Kite Shield", 3],
          ["Goatskin Wristbands", 2],
          ["Hempen Breeches", 2],
          ["Copper Ring", 2],
          ["Lapis Lazuli", 2],
          ["Brass Ring", 2],
          ["Silver Ring", 2],
          ["Garnet", 2],
          ["Mythril Ring", 3],
          ["Horn Staff", 8],
          ["Electrum Ring", 2],
          ["Honey", 9],
          ["Horn Fishing Rod", 2],
          ["Ether", 8],
          ["Poisoning Potion", 2],
          ["Paralyzing Potion", 2],
          ["Blinding Potion", 2],
          ["Sleeping Potion", 2],
          ["Silencing Potion", 2],
          ["Elixir", 7],
          ["Obelisk", 2],
          ["Mailbreaker", 2],
          ["Rampager", 2],
          ["Boarskin Ring", 2],
          ["Pearl", 7],
          ["Astrolabe", 2],
          ["Rose Gold Earrings", 2],
          ["Sarnga", 2],
          ["Mortar", 22],
          ["Campfire", 2],
          ["Oasis Partition", 2],
          ["Manor Fireplace", 2],
          ["Cloche", 3],
          ["Smithing Bench", 2],
          ["Manor Harp", 2],
          ["Wall Lantern", 2],
          ["Holy Rainbow Hat", 2],
          ["Reading Glasses", 2],
          ["Archaeoskin Boots", 3],
          ["Gaganaskin Gloves", 2],
          ["Gazelleskin Ring", 4],
          ["Hedge Partition", 2],
          ["Wolfram Cuirass", 2],
          ["Wolfram Gauntlets", 2],
          ["Wolfram Sabatons", 2],
          ["Gold Ingot", 2],
          ["Serpentskin Gloves", 3],
          ["Orchestrion", 4],
          ["Camphor", 14],
          ["Cordial", 2],
          ["Survival Hat", 2],
          ["Survival Shirt", 3],
          ["Survival Halfslops", 2],
          ["Survival Boots", 2],
          ["Luminous Fiber", 2],
          ["Teahouse Bench", 2],
          ["Oden", 10],
          ["Carpeting", 2],
          ["Near Eastern Antique", 2],
          ["Coerthan Souvenir", 2],
          ["Maelstrom Materiel", 2],
          ["Heartfelt Gift", 2],
          ["Orphanage Donation", 2],
          ["Gyr Abanian Souvenir", 2],
          ["Far Eastern Antique", 2],
          ["Gold Saucer Consolation Prize", 2],
          ["Resistance Materiel", 2],
          ["Sui-no-Sato Special", 2],
          ["Cloud Pearl", 2],
          ["Signature Buuz Cookware", 2],
          ["Platinum Ingot", 2],
          ["Griffin Leather", 2],
          ["Wall Chronometer", 2],
       ];
       dupList.forEach(function(row){
          miqo = miqo.replace(new RegExp("recipe\\("+row[0]+"\\)", "g"), "recipe("+row[0]+", "+row[1]+")");
       });
       return miqo;
    };
    var scenario = function(){
       var miqo = "";
       miqo += "//Pre-Requisite Crafting\r\n";
       miqo += "solverPreset(recommended)\r\n";
       miqo += "nqhq(balanced)\r\n";
       miqo += "reclaimOff()\r\n\r\n";
       miqo += chapter("PreRequisiteCrafting-section")+"\r\n";
       
       miqo += "//Crafting List\r\n";
       miqo += "solverPreset(recommended)\r\n";
       miqo += "nqhq(balanced)\r\n";
       miqo += "reclaimHQ(50)\r\n\r\n";
       miqo += chapter("CraftingList-section")+"\r\n";
       
       miqo += "//Repair\r\n";
       miqo += "reclaimOff()\r\n";
       miqo += "repair()\r\n";
       miqo = antiDuplicate(miqo);
       //window.prompt("Copy to clipboard: Ctrl+C, Enter", miqo);
       return miqo;
    };
    console.log(scenario());

    6. Press Enter. Boom! You get the complete crafting scenario. Now copy and paste it into Miqobot.
    7. Start.

    What this script does is simply parsing the webpage on your screen, extracting jobs, recipe names, and how many to craft. My personal investment is sorting by level and by dependency. The website likes to put reagents in weird order like Holy Rainbow Cloth – Holy Water. My script detects and reverts the wrong order.
    And what is also cool is that website has all languages support. My script doesnt care about languages it parses names as they are so you get the correct scenario for Miqobot regardless.

    I think Miqo said there will be something similar in Miqobot one day. But until then – youre welcome.

    EDIT: See that commented window.prompt near the end of script? Uncomment it and you will get a popup with scenario code already selected so you wont have to select it manually in console. Saves you a few seconds.

    • This topic was modified 6 years, 10 months ago by Lyfox Lyfox.
    #3453

    ExarchCoercer
    Participant
    0

    Wow this is awesome way to go Lyfox!

    #3462
    Lyfox
    Lyfox
    Participant
    0

    Thanks! Thought id show an example as well. Heres what i do to craft Ironworks left side set.

    1. Use this link to quickly fill the crafting list: http://ffxivcrafting.com/list/saved/15516,1:15534,1:15519,1:15518,1:15515,1:15517,1
    2. Press “Craft These Items”, Ctrl-Shift-J, copypaste the script above. See attached picture.

    (Note how Camphor correctly appears before Eikon Leather.)

    urygp

    • This reply was modified 6 years, 10 months ago by Lyfox Lyfox.
    Attachments:
    You must be logged in to view attached files.
    #3466

    meta.horus
    Participant
    0

    Really good stuff, many thanks, this is indeed very useful for bulk crafting.

    #3483

    Montie
    Participant
    0

    This is pure genius!!!

    #3506
    Hedwynn
    Hedwynn
    Participant
    0

    … dude.
    Damn.

    #3525

    ExarchCoercer
    Participant
    0

    The only problem that I’ve been able to find is that the recopies assume that they are the only recipe matching in the list for instance something like Camphor will try and Craft Camphor Lumber instead of Camphor because it comes first in the list. I’ve been thinking of how to solve this but without a large list of potential duplicates I’m not sure how to solve it

    #3527
    Lyfox
    Lyfox
    Participant
    0

    Oh yea thats right sometimes you have to add numbers to names. But imo the list shouldnt be too large. The only ones i encountered so far are Camphor and Honey. Ill think of an easy way to handle this in script.

    #3528

    ExarchCoercer
    Participant
    0

    I’ve also encountered it with Luminous Fiber and Gold Ingot.

    #3728

    LelouchVse
    Participant
    1+

    A question , I’ve to manually switch jobs to craft? It has line error if I don’t switch manually

    #3729

    LelouchVse
    Participant
    0

    A question , I’ve to manually switch jobs to craft? It has line error if I don’t switch manually

    Sorry for the stupid question , Had to put it on hotbar. Was wondering if you turned self sufficient on? For a long list of GC delivery I wonder if self sufficient is turned on will it be bugged?

    #3732
    Lyfox
    Lyfox
    Participant
    0

    Switching jobs is fully automated but of course you need em on hotbar.
    Yea self sufficient is always on why not. Full GC delivery in one go. Pretty sure it can handle 100+ reagents no sweat, just make sure you have enough inventory space.

    Ive got something for that duplicates problem, should be easily solved. Will post later.

    #3734
    Perezoso
    Perezoso
    Participant
    0

    The truth I do not understand much that you tried to teach with this, that helps miqobot with the collection? It happens that when I press Ctrl-Shift-J this is left blank, I use browser opera, I attach an image thanks

    • This reply was modified 6 years, 9 months ago by Perezoso Perezoso.
    #3736
    Lyfox
    Lyfox
    Participant
    0

    Youre doing everything right. Now copy and paste the script from first post directly into Console. Then press Enter.

    #3737
    Perezoso
    Perezoso
    Participant
    0

    Great this is for crafter, I was confused I thought this collected the objects but same thanks is very practical so I avoid doing it 1 for 1, you are a genius

Viewing 15 posts - 1 through 15 (of 217 total)

You must be logged in to reply to this topic.