softcabbages / XIVDB - Order Bot Generator

// ==UserScript==
// @name         XIVDB - Order Bot Generator
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Generates Order Bot Profiles.
// @author       softcabbages
// @match        http://xivdb.com/item/*
// @grant        none
// @require      https://code.jquery.com/jquery-3.2.1.min.js
// @updateURL https://openuserjs.org/meta/softcabbages/XIVDB_-_Order_Bot_Generator.meta.js
// ==/UserScript==
//
// ----------------------------------------------------------------------
// README
//
// The profile's that this script generates by default requires:
// Craftsmanship: 1322 WITHOUT FOOD. Unsure if you can wing it here with less and use a food to meet the minimum.
// Control: 1270 <-- this is what I got as a Control stat. 98% HQ Rate from NQ mats.
// CP: 470 WITHOUT FOOD
// Food Used: Baked Onion Soup (You can change this if you want, I'm a cheap ass)
// The rotation it uses for crafting is exclusively for Specialists and is geared towards level 70 two star. But I don't see why it couldn't do level 60 crafts if you wanted it do so.
//
// ----> This profile requires EntraxBuudy AND ExBuddy. <----
// https://github.com/Entrax643/EntraxBuddy.git/trunk
// https://github.com/Entrax643/ExBuddy.git/trunk/ExBuddy
// Save the profile that this script generates in to your EntraxBuddy folder.
// IE: D:\RB64\Profiles\EntraxBuddy\Profiles\Craft\Culinarian
//
// For this version, the rotations for Specialist and non-Specialsit are identical. So please do use with caution.
// -----------------------------------------------------------------------
		
(function() {
	var itemname = $( "h1.rarity-common" ).text();
	var itemID = window.location.pathname.split('/');
	// Just a meh setting. I mostly throwed this in because I usually craft as much ALC/CUL stuff as possible.
	var DeducedQuantity = "1";
	var recipeID = $("span.item-craftable-data a").attr("href").split('/');
	var classSearch = $("div.item-craftable-top span:first").text();
	classSearch = $.trim(classSearch.replace(/\d+/g, ''));
	var specialist = 0;
	
	// If one of the below classes is a specialist of yours, set the specialist variable to 1. Otherwise, just remove it.
	if (classSearch ==='Culinarian' ) {
		var DeducedQuantity = "999";
		var GearSet = "26";
		specialist = 1;
	}
	if (classSearch ==='Alchemist' ) {
		var DeducedQuantity = "999";
		var GearSet = "22";
		specialist = 1;
	}	
	if (classSearch ==='Carpenter' ) {
		var DeducedQuantity = "1";
		var GearSet = "27";
	}	
	if (classSearch ==='Blacksmith' ) {
		var DeducedQuantity = "1";
		var GearSet = "21";
	}	
	if (classSearch ==='Goldsmith' ) {
		var DeducedQuantity = "1";
		var GearSet = "19";
		specialist = 1;
	}	
	if (classSearch ==='Weaver' ) {
		var DeducedQuantity = "1";
		var GearSet = "17";
	}	
	if (classSearch ==='Leatherworker' ) {
		var DeducedQuantity = "1";
		var GearSet = "8";
	}	
	if (classSearch ==='Armorer' ) {
		var DeducedQuantity = "1";
		var GearSet = "25";
	}
	
	if (specialist == 1) {
		Rotation = "&lt;CraftActionByName Name=\"Initial Preparations\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Comfort Zone\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Inner Quiet\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Specialty: Reflect\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Steady Hand II\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Piece by Piece\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Piece by Piece\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Manipulation II\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Steady Hand II\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Comfort Zone\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Standard Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Steady Hand\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Great Strides\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Innovation\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Ingenuity II\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Byregot's Blessing\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Careful Synthesis III\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Careful Synthesis III\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Careful Synthesis III\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Careful Synthesis III\" \/&gt;";
		} else {
			// This is Non-specialist Rotation. Will edit later.
			Rotation = "&lt;CraftActionByName Name=\"Initial Preparations\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Comfort Zone\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Inner Quiet\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Specialty: Reflect\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Steady Hand II\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Piece by Piece\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Piece by Piece\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Manipulation II\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Steady Hand II\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Comfort Zone\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Prudent Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Standard Touch\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Steady Hand\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Great Strides\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Innovation\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Ingenuity II\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Byregot's Blessing\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Careful Synthesis III\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Careful Synthesis III\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Careful Synthesis III\" \/&gt;\r\n\t\t\t\t&lt;CraftActionByName Name=\"Careful Synthesis III\" \/&gt;";

		}
	
	var BodyCode = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;!DOCTYPE Profile [&lt;!-- Profile Settings --&gt;\r\n&lt;!-- Where do you want to port while witing \/ crafting--&gt;\r\n&lt;!ENTITY Waiting_AetheryteId \"59\"&gt;\r\n&lt;!ENTITY Craft_Qty \"" + DeducedQuantity + "\"&gt;\r\n&lt;!-- Use Craft at your OWN RISK --&gt;\r\n&lt;!ENTITY Craft \"1\"&gt;\r\n&lt;!ENTITY ID_FOOD \"12861\"&gt;\r\n&lt;!-- Set to 1 if you want(and can) use the skill --&gt;\r\n&lt;!--   --&gt;\r\n&lt;!-- DO NOT TOUCH THIS --&gt;\r\n&lt;!ENTITY Version \"Mew\"&gt;\r\n&lt;!ENTITY Color \"#FFFF00\"&gt;\r\n]&gt;&lt;Profile&gt;\r\n\t&lt;Name&gt;"+ itemname +"&lt;\/Name&gt;\r\n\t&lt;BehaviorDirectory&gt;..\\..\\..\\Quest Behaviors&lt;\/BehaviorDirectory&gt;\r\n\t&lt;Order&gt;\r\n\t\t&lt;StopCrafting\/&gt;\r\n\t\t&lt;!-- Crafting --&gt;\r\n\t\t&lt;If Condition=\"&amp;Craft; !=0\"&gt;\r\n\t\t\t&lt;ExLog Color=\"&amp;Color;\" Name=\""+ itemname +" &amp;Version;\" Message=\"It's time to craft !\"\/&gt;\r\n\t\t\t&lt;RunCode Name=\"CLASS\" \/&gt;\r\n\t\t\t\r\n\t\t\t&lt;WaitTimer WaitTime=\"3\"\/&gt;\r\n\t\t\t&lt;While Condition=\"ItemCount("+ itemID[2] +") &amp;lt; 999\"&gt;\r\n\t\t\t\t&lt;EatFood ItemId=\"&amp;ID_FOOD;\" HqOnly=\"True\" \/&gt;\r\n\t\t\t\t&lt;!-- Required Skills : Ingenuity II (283), Flawless Synthesis, Manipulation, Careful synthesis 2 (100069), Piece by Piece, Innovation, Byregot's Blessing, Comfort Zone, Waste Not II --&gt;\r\n\t\t\t\t&lt;!-- Optionnals : Innovation, Tricks of the Trade, Reclaim --&gt;\r\n\t\t\t\t&lt;Synthesize RecipeId=\""+ recipeID[2] +"\" MinimumCp=\"470\" HqMats=\"-1,-1,-1,-1,-1,-1\" RequiredSkills=\"283, 100083, 278, 100069, 100039, 284, 100009, 286, 285\" \/&gt;\r\n\t\t\t\t"+ Rotation +"\r\n\t\t\t&lt;\/While&gt;\r\n\t\t\t&lt;StopCrafting\/&gt;\r\n\t\t&lt;\/If&gt;\r\n\t\t&lt;ExLog Color=\"&amp;Color;\" Name=\""+ itemname +" &amp;Version;\" Message=\""+ itemname +" Profile Completed ! \u0F3C \u3064 \u0361\u25D5 \u047E \u0361\u25D5 \u0F3D\u3064 Entrax \"\/&gt;\r\n\t&lt;\/Order&gt;\r\n\t&lt;CodeChunks&gt;\r\n\t\t&lt;CodeChunk Name=\"CLASS\"&gt;\r\n\t\t\t&lt;![CDATA[ \tff14bot.Managers.ChatManager.SendChat(\"\/gs change "+ GearSet +"\");\t]]&gt;\r\n\t\t&lt;\/CodeChunk&gt;\r\n\t&lt;\/CodeChunks&gt;\r\n&lt;\/Profile&gt;";
	
	// Add Menu
	$( "nav.menu" ).append("<span><div>Script Options</div></div></span>");
	
	$( ".additional-content-container" ).prepend( "[OrderBot]["+classSearch+"]"+ itemname +"<br><textarea name='OrderBot' cols='100' rows='10' style='background-color: #3a3a3a; color: white; border-color: black' onclick='this.focus();this.select()' readonly='true'>"+ BodyCode +"</textarea>" );
	
})();