MediaWiki:Common.js: Difference between revisions

Automated page publish
Automated page publish
Line 119: Line 119:
     return null;
     return null;
   }
   }
  // Seconds per craft at the Anvil/Furnace, one entry per RECIPES key. Bar/Helmet/Platebody/
  // Platelegs/Sword durations for Bronze-Mithril come straight off the Smithing Guide tables;
  // everything else comes from the game's own recipe data.
  var CRAFT_DURATION = {
    'Bronze Bar':3, 'Bronze Helmet':6, 'Bronze Platebody':18, 'Bronze Platelegs':16, 'Bronze Sword':8,
    'Iron Bar':4, 'Iron Rod':15, 'Iron Plate':4, 'Iron Helmet':10, 'Iron Platebody':28, 'Iron Platelegs':24, 'Iron Sword':12,
    'Steel Bar':5, 'Steel Rod':3, 'Large Steel Rod':3, 'Steel Plate':5, 'Large Steel Plate':5, 'Steel Helmet':14, 'Steel Platebody':38, 'Steel Platelegs':32, 'Steel Sword':16,
    'Mithril Bar':6, 'Large Mithril Rod':13, 'Mithril Rod':13, 'Large Mithril Plate':22, 'Mithril Plate':22, 'Mithril Helmet':18, 'Mithril Platebody':48, 'Mithril Platelegs':40, 'Mithril Sword':20,
    'Silver Bar':10, 'Silver Plate':15, 'Silver Foil':15,
    'Gold Bar':15, 'Gold Plate':15, 'Golden Shield Frame':60,
    'Small Ebony Rod':40, 'Large Ebony Rod':40, 'Ebony Rod':40, 'Small Ebony Plate':60, 'Ebony Plate':60, 'Large Ebony Plate':60, 'Ebony Bar':20,
    'Duskknight Boot Left Sabaton':120, 'Duskknight Boot Right Sabaton':120, 'Duskknight Leg Tuille':120, 'Duskknight Leg Poleyn':120, 'Duskknight Body Pauldron':120, 'Duskknight Body Couter':120, 'Duskknight Body Rerebrace':120, 'Duskknight Body Vambrace':120, 'Duskknight Leg Tasset':120, 'Duskknight Boot Greave':120, 'Duskknight Leg Cuisses':120, 'Duskknight Helmet Face Plate':120, 'Duskknight Helmet Head Plate':120, 'Duskknight Helmet Spike':120, 'Duskknight Body Breastplate':120
  };


   // Walks RECIPES tier-by-tier from `qty` of `name`, merging same-name items within a tier.
   // Walks RECIPES tier-by-tier from `qty` of `name`, merging same-name items within a tier.
Line 379: Line 393:
       if (rawNames.length){
       if (rawNames.length){
         text += '\n\nTotal raw materials: ' + rawNames.map(function(n){ return fmt(breakdown.totals[n]) + ' ' + n; }).join(', ');
         text += '\n\nTotal raw materials: ' + rawNames.map(function(n){ return fmt(breakdown.totals[n]) + ' ' + n; }).join(', ');
      }
      var totalSeconds = breakdown.entries.reduce(function(sum, e){
        var dur = CRAFT_DURATION[e.name];
        return dur ? sum + e.qty * dur : sum;
      }, 0);
      if (totalSeconds > 0){
        text += '\nTotal craft time (Anvil/Furnace only, not counting ore gathering): ' + formatTime(totalSeconds);
       }
       }
       breakdownText.textContent = text;
       breakdownText.textContent = text;