Scenario for crafting logs

Forum Forums Discussion Scenario for crafting logs

This topic contains 3 replies, has 2 voices, and was last updated by  orlandodude 4 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15080

    orlandodude
    Participant
    0

    Can someone please explain like I’m a 5 year old how to use that garland website, or whatever is easier, on how to create a scenario (or if one is already posted here somewhere) to automate doing the crafting logs (like 1-10, 11-15, etc) after I buy all the mats?

    I’d even be willing to pay for the help if someone has to take the time to make one for me? Sorry, I’m just really confused once it gets to looking at any code. 🙁

    • This topic was modified 4 years, 9 months ago by  orlandodude.
    #15085
    Carl Arbogast
    Carl Arbogast
    Participant
    1+
    • 1. Be sure you have all your crafting abilities on your hotbars.
    • 2. Be sure you have all your crafting jobs icons on your hotbars (to switch jobs).
    • 3. Be sure you assigned a keybind to any of the aforementioned hotbars slots.
    • 4. Open your crafting log, right click on the recipe you want to do, and chose to copy its name.
    • 5. Go to https://ffxivcrafting.com/ and be sure to pick your in-game language in the top right corner.
    • 6. Click on Recipe Book.
    • 7. In the search field, paste the name of the recipe you previously copied.
    • 8. Repeat step 4 + 7 for as many recipes you want to craft.
    • 9. Once you’re done, click on Crafting List (top right corner of that web site).
    • 10. In Amount, enter the quantity you want to get in the end for each item.
    • 11. Once you’re done, click on the green button Craft These Items.
    • 12. Only for the Gathered and Other parts of the table, buy or gather the quantity of the mats (and shards/cristals/clusters) that the website is telling you that you need. You can click on the (v) check mark to help you to track things. Make sure you have all those mats in your inventory, as well as lots of free space for all intermediate and final craft that are going to get done by Miqobot.
    • 13. Copy the following code, made by Lyfox:
    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());
    • 14. In your web browser, I advise you Firefox, right click in a blank spot of the FFXIV Crafting website, and pick Examine Elements (or whatever it is in your language), it will open the console of your web browser, in which you’re gonna paste Lyfox code.
    • 15. Press ENTER to execute the code.
    • 16. It will generate a Scenario for Miqobot, copy the scenario from “//Pre-Requisite Crafting
      to “repair()”.
    • 17. In Miqobot Scenario Tab, click on New.
    • 18. There’s no 18.
    • 19. In Miqobot, in the left part, paste the Scenario you just copied.
    • 20. Press Start.
    • 21. Don’t let the bot unattended.

    You can ask for support in the topic created by Lyfox. The code he made and that I pasted here, comes from Page 5.

    There’s options you can adjust at the end of the code, what solver setting you want, as in, do you want NQ pre-craft and HQ final craft, etc.

    If you’re using any other language than English one, you’ll have to create some specific lines for some recipes that contains a duplicate name part of another recipe, it’s easy, ask for support in the mentioned topic.

    • This reply was modified 4 years, 9 months ago by Carl Arbogast Carl Arbogast.
    • This reply was modified 4 years, 9 months ago by Carl Arbogast Carl Arbogast.
    • This reply was modified 4 years, 9 months ago by Carl Arbogast Carl Arbogast.
    • This reply was modified 4 years, 9 months ago by Carl Arbogast Carl Arbogast.
    • This reply was modified 4 years, 9 months ago by Carl Arbogast Carl Arbogast.
    • This reply was modified 4 years, 9 months ago by Carl Arbogast Carl Arbogast.
    • This reply was modified 4 years, 9 months ago by Carl Arbogast Carl Arbogast.
    #15094
    Carl Arbogast
    Carl Arbogast
    Participant
    0

    Here’s more details about Step 7:

    • 7. In the search field, paste the name of the recipe you previously copied, hit ENTER, then in the list displayed find your recipe, and click on its + Cart icon to add that item to your list.
    #15228

    orlandodude
    Participant
    0

    Thanks. I’ll give this a try tonight!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.