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, 2 months ago.

Viewing 15 posts - 61 through 75 (of 217 total)
  • Author
    Posts
  • #6969
    Lyfox
    Lyfox
    Participant
    3+

    All right here it is.
    Garlandtools makes a reliable crafting order indeed. Still had to sort recipes by level but thats easy. Step by step instructions:

    1. Go to website: http://garlandtools.org/db/ . Use search on the left to make a list of items.
    2. In each item open Crafting tab, click Add to crafting list. This will summon a new Crafting List box.
    3. Go through sections #1 and #2 in the Crafting List box, upload mats into your inventory.
    4. Open web console (Ctrl-Shift-J in most browsers).
    5. Run this script:

    var rJob = function(val){
       var imgJob = $(val).find("span.right img.job-icon");
       return (imgJob.length ? imgJob.attr("src").replace("../files/icons/job/", "").replace("images/", "").replace(".png", "") : "");
    };
    var rLevel = function(val){
       return $(val).find("span.right span.text").text().replace("Lv. ", "");
    };
    var rRecipe = function(val){
       return $(val).find("div[data-id] span.text span.highlight, span[data-id] span.text span.highlight").text();
    };
    var rNeeded = function(val){
       var match1 = $(val).find("div[data-id] span.text").text().match(/^[0-9]+/g);
       var match2 = $(val).find("span.amounts span.text:contains(/ +)").text().match(/[0-9]+/g);
       return (match1 ? match1[0] : match2 ? match2[0] : 0);
    };
    var rYields = function(val){
       var match = $(val).find("div[data-id] span.text, span[data-id] span.text").text().match(/\([0-9]+\)/g);
       return (match ? match[0].replace(/[()]/g, "") : 1);
    };
    var rCount = function(val){
       return Math.ceil(rNeeded(val)/rYields(val));
    };
    var chapter = function(tableId){
       var reagents = $("div[data-id='Crafting List'] div[data-headername='"+tableId+"']").children("div[data-stepid]").not(".finished");
       reagents.each(function(idx){ $(this).data("order", idx); });
       reagents.sort(function(a, b){
          var lvlA = rLevel(a);
          var lvlB = rLevel(b);
          var idxA = $(a).data("order");
          var idxB = $(b).data("order");
          return (parseInt(lvlA) < parseInt(lvlB)) ? -1 : (parseInt(lvlA) > parseInt(lvlB)) ? 1 :
                 (lvlA < lvlB) ? -1 : (lvlA > lvlB) ? 1 :
                 (idxA - idxB);
       });
       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-stepid");
             var item = gt.item.ingredients[itemId] || gt.item.index[itemId];
             var requires = item ? item.craft[0].ingredients.map(function(val){ return ""+val.id; }) : [];
             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(){
          if(!rJob(this)){
             miqo += "//no job: "+rRecipe(this)+"\r\n";
             return;
          }
          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 += "//Craft\r\n";
       miqo += "solverPreset(recommended)\r\n";
       miqo += "nqhq(balanced)\r\n";
       miqo += "reclaimOff()\r\n\r\n";
       miqo += chapter("Craft")+"\r\n";
       
       miqo += "//Goal\r\n";
       miqo += "solverPreset(recommended)\r\n";
       miqo += "nqhq(balanced)\r\n";
       miqo += "reclaimHQ(50)\r\n\r\n";
       miqo += chapter("goal")+"\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. Copy and paste the scenario into Miqobot.
    7. Start.

    Let me know if there are any bugs. Ill ask Miqo to merge it with the first post later.

    • This reply was modified 5 years, 10 months ago by Lyfox Lyfox.
    #6971
    Lyfox
    Lyfox
    Participant
    2+

    A visual example of how it works. Onishi 70*** left side.

    1. Link to quickly fill the crafting list:
    garlandtools.org – Onishi 70***
    2. Ctrl-Shift-J, copypaste the script above. See attached picture.

    dp9b3

    Attachments:
    You must be logged in to view attached files.
    #6973
    Lyfox
    Lyfox
    Participant
    0

    Forgot to mention that crafting list on Garlandtools has several display modes which you can switch between for your convenience. My script should work for both flat and expanded modes.

    #6977

    sd2956
    Participant
    0

    Ah excellent, good work as always! Unfortunately, I’ve done all of my crafting this evening, but I’ll give it a shot tomorrow with my next batch of stormsaps.

    #7086

    sd2956
    Participant
    0

    Found an issue with it – the scenario generator tried to make Kudzu Cloth before Kudzu Thread.

    #7087
    Lyfox
    Lyfox
    Participant
    0

    Well thats bad. It means Garland Tools doesnt have any sense of prerequisite either. And theres nothing in HTML that could help me fix their mistake. Any ideas?

    #7090
    Lyfox
    Lyfox
    Participant
    1+

    Heh found it. Theres an object in global namespace called ‘gt’ which apparently contains all the data including ingredients list. Respect to devs who make transparent source code. This will take a while but totally fixable now.

    #7127
    Lyfox
    Lyfox
    Participant
    0

    Ok its fixed. Now Garlandtools generator functions exactly the same way as the original one. Merged the fix into the post above so just grab the new script and use it.
    Example image attached.

    Attachments:
    You must be logged in to view attached files.
    #7266

    Garethmagis
    Participant
    0

    Using the ffxiv crafting site and while leveling armorsmith it can’t figure out what to do for things like bronze ingots that can be made by multiple classes, instead it switches to arm then keeps trying to synth the blacksmith version. Am i doing something wrong or is this just a limitation of the system.

    #7267
    Lyfox
    Lyfox
    Participant
    0

    Yea for bronze ingots on armorer you have to change it like this:

    recipe(Bronze Ingot, 2)

    I didnt implement any settings for multiple jobs so it always takes the first job available. But Miqo can select the second you just have to explain it to her.

    #7538
    Runestone
    Runestone
    Participant
    0

    Just a heads up, ffxiv crafting has FINALLY been updated, at least to 4.3.

    #7565
    LutBot
    LutBot
    Participant
    0

    Is there a way to tell Miqobot to use food every x amount of minutes? Or to make sure its food’d up before attempting a craft?

    BTW thanks for the script, works great!

    • This reply was modified 5 years, 9 months ago by LutBot LutBot.
    #7568
    Lyfox
    Lyfox
    Participant
    1+

    Yea just use sendIcon() function. Heres an example: https://miqobot.com/forum/forums/topic/food-buff/

    #7569
    LutBot
    LutBot
    Participant
    0

    Thanks!! I’ll play with it a bit and see if I can figure it out.

    #7597

    xivgAnon
    Participant
    0

    hey @lyfox did you ever update the first script?

    I’ll do a greasemonkey script for the garland tools one too 🙂 just came back to the game

Viewing 15 posts - 61 through 75 (of 217 total)

You must be logged in to reply to this topic.