Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Original paste: https://pastebin.com/W0GVicBX
- Original paste credits: Kirie @ The Balance
- Modified to produce list of the Scrip cost for every estimated materia you need in addition to the raw gil.
- */
- var labels = {
- "CMS:0": {label: "Craftsmanship +3", price: 800, priceLabel: "Gil"},
- "CMS:1": {label: "Craftsmanship +4", price: 800, priceLabel: "Gil"},
- "CMS:2": {label: "Craftsmanship +5", price: 800, priceLabel: "Gil"},
- "CMS:3": {label: "Craftsmanship +6", price: 25, priceLabel: "Yellow Crafter's Scrip"},
- "CMS:4": {label: "Craftsmanship +11", price: 200, priceLabel: "Yellow Crafter's Scrip"},
- "CMS:5": {label: "Craftsmanship +16", price: 250, priceLabel: "Yellow Crafter's Scrip"},
- "CMS:6": {label: "Craftsmanship +14", price: 250, priceLabel: "Yellow Crafter's Scrip"},
- "CMS:7": {label: "Craftsmanship +21", price: 500, priceLabel: "White Crafter's Scrip"},
- "CRL:0": {label: "Control +1", price: 400, priceLabel: "Gil"},
- "CRL:1": {label: "Control +2", price: 600, priceLabel: "Gil"},
- "CRL:2": {label: "Control +3", price: 500, priceLabel: "Gil"},
- "CRL:3": {label: "Control +4", price: 25, priceLabel: "Yellow Crafter's Scrip"},
- "CRL:4": {label: "Control +7", price: 200, priceLabel: "Yellow Crafter's Scrip"},
- "CRL:5": {label: "Control +10", price: 250, priceLabel: "Yellow Crafter's Scrip"},
- "CRL:6": {label: "Control +9", price: 250, priceLabel: "Yellow Crafter's Scrip"},
- "CRL:7": {label: "Control +13", price: 500, priceLabel: "White Crafter's Scrip"},
- "CP:0": {label: "CP +1", price: 1500, priceLabel: "Gil"},
- "CP:1": {label: "CP +2", price: 18000, priceLabel: "Gil"},
- "CP:2": {label: "CP +3", price: 2500, priceLabel: "Gil"},
- "CP:3": {label: "CP +4", price: 25, priceLabel: "Yellow Crafter's Scrip"},
- "CP:4": {label: "CP +6", price: 200, priceLabel: "Yellow Crafter's Scrip"},
- "CP:5": {label: "CP +8", price: 250, priceLabel: "Yellow Crafter's Scrip"},
- "CP:6": {label: "CP +7", price: 250, priceLabel: "Yellow Crafter's Scrip"},
- "CP:7": {label: "CP +9", price: 500, priceLabel: "White Crafter's Scrip"},
- "PCP:0": {label: "Perception +3", price: 2000, priceLabel: "Gil"},
- "PCP:1": {label: "Perception +4", price: 1000, priceLabel: "Gil"},
- "PCP:2": {label: "Perception +5", price: 2000, priceLabel: "Gil"},
- "PCP:3": {label: "Perception +6", price: 25, priceLabel: "Yellow Gatherer's Scrip"},
- "PCP:4": {label: "Perception +10", price: 200, priceLabel: "Yellow Gatherer's Scrip"},
- "PCP:5": {label: "Perception +15", price: 250, priceLabel: "Yellow Gatherer's Scrip"},
- "PCP:6": {label: "Perception +12", price: 250, priceLabel: "Yellow Gatherer's Scrip"},
- "PCP:7": {label: "Perception +20", price: 500, priceLabel: "White Gatherer's Scrip"},
- "GTH:0": {label: "Gathering +3", price: 25000, priceLabel: "Gil"},
- "GTH:1": {label: "Gathering +4", price: 2000, priceLabel: "Gil"},
- "GTH:2": {label: "Gathering +5", price: 3000, priceLabel: "Gil"},
- "GTH:3": {label: "Gathering +6", price: 25, priceLabel: "Yellow Gatherer's Scrip"},
- "GTH:4": {label: "Gathering +10", price: 200, priceLabel: "Yellow Gatherer's Scrip"},
- "GTH:5": {label: "Gathering +15", price: 250, priceLabel: "Yellow Gatherer's Scrip"},
- "GTH:6": {label: "Gathering +12", price: 250, priceLabel: "Yellow Gatherer's Scrip"},
- "GTH:7": {label: "Gathering +20", price: 500, priceLabel: "White Gatherer's Scrip"},
- "GP:0": {label: "GP +1", price: 2500, priceLabel: "Gil"},
- "GP:1": {label: "GP +2", price: 1000, priceLabel: "Gil"},
- "GP:2": {label: "GP +3", price: 2600, priceLabel: "Gil"},
- "GP:3": {label: "GP +4", price: 25, priceLabel: "Yellow Gatherer's Scrip"},
- "GP:4": {label: "GP +6", price: 200, priceLabel: "Yellow Gatherer's Scrip"},
- "GP:5": {label: "GP +8", price: 250, priceLabel: "Yellow Gatherer's Scrip"},
- "GP:6": {label: "GP +7", price: 250, priceLabel: "Yellow Gatherer's Scrip"},
- "GP:7": {label: "GP +9", price: 500, priceLabel: "White Gatherer's Scrip"}
- }
- function cash() {
- var prices = {
- "CP:7":300000*0, "CMS:7":400000*0, "CRL:7":800000*0,
- "CP:6":18000, "CMS:6":60000, "CRL:6":50000,
- "CP:5":14000, "CMS:5":30000, "CRL:5":50000,
- "CP:4":45000, "CMS:4":12000, "CRL:4":25000,
- "CP:3":3000, "CMS:3":1050, "CRL:3":4000,
- "CP:2":2500, "CMS:2":800, "CRL:2":500,
- "CP:1":18000, "CMS:1":800, "CRL:1":600,
- "CP:0":1500, "CMS:0":800, "CRL:0":400,
- "GP:7":50000, "PCP:7":220000, "GTH:7":220000,
- "GP:6":50000, "PCP:6":155000, "GTH:6":90000,
- "GP:5":7000, "PCP:5":60000, "GTH:5":60000,
- "GP:4":15000, "PCP:4":15000, "GTH:4":10500,
- "GP:3":5000, "PCP:3":5050, "GTH:3":5000,
- "GP:2":2600, "PCP:2":2000, "GTH:2":3000,
- "GP:1":1000, "PCP:1":1000, "GTH:1":2000,
- "GP:0":2500, "PCP:0":2000, "GTH:0":25000,
- };
- var counts = new Proxy({}, {
- get: (target, name) => name in target ? target[name] : 0
- })
- var md = characterData.currentSet.materiaData;
- var grandtotal = 0;
- function binom(p, r) {
- for(var i = 0; i < 10000; i++) {
- var prob = 1 - Math.pow(1 - p, i);
- if(prob > r) {
- return i;
- }
- }
- }
- for (let itemid in md) {
- var itemtotal = 0;
- var slotname = itemid.split('-')[0];
- console.log(md[itemid]);
- var itemdata = characterData.currentSet.items[slotname];
- var item = md[itemid];
- for(var i = 0; i < item.length; i++) {
- var materia = item[i];
- var grade = materia.split(':')[1];
- var overmeld_count = i - itemdata.materiaSlots;
- if(overmeld_count >= 0) {
- var rate = ToolkitData.MateriaSuccessRates[overmeld_count][grade] / 100.0;
- var price = prices[materia];
- var ev = binom(rate, .95);
- var meldtotal = price * ev;
- itemtotal += meldtotal;
- counts[materia] = counts[materia] + ev;
- console.log(slotname + ' ' + i + ' ' + rate + ' ' + ev + ' ' + meldtotal.toLocaleString() + ' gil');
- } else {
- var price = prices[materia];
- var rate = 100;
- var ev = 1;
- var meldtotal = price;
- itemtotal += meldtotal;
- counts[materia] = counts[materia] + ev;
- console.log(slotname + ' ' + i + ' ' + rate + ' ' + ev + ' ' + meldtotal.toLocaleString() + ' gil');
- }
- }
- console.log(slotname + ' ' + itemtotal.toLocaleString());
- grandtotal += itemtotal;
- }
- console.log("grand total: " + grandtotal.toLocaleString() + ' gil');
- return counts;
- }
- var res = cash();
- console.log("\nScrip:");
- Object.keys(labels).forEach(function (item) {
- var count = res[item];
- if (count > 0)
- {
- var materia = labels[item];
- console.log((materia.price * count) + ' ' + materia.priceLabel + ' (' + count + 'x ' + materia.label + ')');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement