Ark crumplecorn taming calculator

Module:TamingTable

This script is utilized by Template:TamingTable. It creates tables with the wanted assets to tame a sure creature.

see also: ARK Console Commands


native p = 
operate p.creature( f )
  native dlclink = require('Module:DLCLink').hyperlink
  native args = f:getParent().args
  native ranges = 
  native creature = args[1]
  -- if creature was not given, take it from PAGENAME
  if creature == nil then
    creature = f.args[1]
  finish

  native creatureData = mw.loadData( 'Module:TamingTable/creatures' )
  if creatureData[creature] ~= nil then
    for i, stage in ipairs(args) do
      if i ~= 1 then
        desk.insert(ranges,stage)
      finish
    finish

    if desk.getn(ranges) == zero then
      ranges = 
    finish
    native foodData = mw.loadData( 'Module:TamingTable/meals' )
    native tables = 

    -- initialize taming variables
    native affinityNeeded, wholeTorpor, torporDeplPS, foodPiecesNeeded, seconds, foodAffinity, foodValue, wakeAffinityMult, wakeFoodDeplMult, foodname = zero, zero, zero, zero, zero, zero, zero, 1, 1, ''

    -- take a look at if creature is tamend non-violently, then use wakeTame multiplicators
    native nonViolent = false
    if (creatureData[creature].nonViolentTame ~= nil and creatureData[creature].nonViolentTame == 1) then
      nonViolent = true
      if creatureData[creature].wakeAffinityMult ~= nil then
        wakeAffinityMult = creatureData[creature].wakeAffinityMult
      finish
      if creatureData[creature].wakeFoodDeplMult ~= nil then
        wakeFoodDeplMult = creatureData[creature].wakeFoodDeplMult
      finish
    finish
    -- creature want heavy weapon knockout? (like rock elemental, titnaosaur)
    native heavyWeaponKnockout = false
    if (creatureData[creature].heavyWeaponKnockout ~= nil and creatureData[creature].heavyWeaponKnockout == 1) then
      heavyWeaponKnockout = true
    finish

    for _,stage in ipairs(ranges) do
      native headerCols = ''

      if nonViolent then
        headerCols = '! <span fashion="cursor: help; border-bottom: 1px dotted #397d75;" title="The theoretically optimal minimum">Feeding Interval</span>\n! Time'
      else
        -- whole torpor for stage
        wholeTorpor = creatureData[creature].torpor1 + creatureData[creature].torporIncrease * (level-1)

        -- torpor depletion per second for stage
        -- right here an exponential approximation of the torpor Depletion is used, credit to http://crumplecorn.com/content/taming-calculator
        if creatureData[creature].torporDepletionPS0 ~= nil then
          torporDeplPS = creatureData[creature].torporDepletionPS0 + math.exp(zero.800403041 * math.log(stage - 1)) / (22.39671632 / creatureData[creature].torporDepletionPS0);
        else
          torporDeplPS = zero
        finish

        if torporDeplPS > zero then
          headerCols = '! [[File:Narcoberry.png|30px|Narcoberry|link=Narcoberry]]\n! [[File:Narcotic.png|30px|Narcotic|link=Narcotic]]\n! [[File:Bio Toxin.png|30px|Bio Toxin|link=Bio Toxin]]\n! Time'
        else
          headerCols = '! Time'
        finish
      finish
      native rows = {' [[File:'..creature..'.png

      if creatureData[creature].affinityNeeded0 ~= nil and creatureData[creature].affinityIncrease ~= nil and torporDeplPS ~= nil then
        affinityNeeded = creatureData[creature].affinityNeeded0 + creatureData[creature].affinityIncrease * stage;

        -- foodname for show
        foodname = ''

        -- how a lot meals/assets of the totally different sorts that this creature eats is required
        for _,meals in ipairs(creatureData[creature].eats) do
          native cols = 
          foodAffinity = zero
          foodValue = zero
          if meals == 'Kibble' then
            foodname = 'Kibble ('..creatureData[creature].favouriteKibble..' Egg)'
          else
            foodname = meals
          finish
          -- examine if creature handles this meals in a particular approach (e.g. scorpions not liking uncooked meat as a lot)
          if (creatureData[creature].specialFoodValues ~= nil and creatureData[creature].specialFoodValues[food] ~= nil) then
            if creatureData[creature].specialFoodValues[food].affinity ~= nil then
              foodAffinity = creatureData[creature].specialFoodValues[food].affinity
            finish
            if creatureData[creature].specialFoodValues[food].worth ~= nil then
              foodValue = creatureData[creature].specialFoodValues[food].worth
            finish
          finish
          if foodData[food] ~= nil then
            if foodAffinity == zero then
              foodAffinity = foodData[food].affinity
            finish
            if foodValue == zero then
              foodValue = foodData[food].foodValue
            finish
          finish
          if (foodAffinity > zero and foodValue > zero) then
            -- take into account wake taming multiplicators (non-violent taming)
            -- multiply by 2 to account for the x2 taming launched in Dec-2016
            foodAffinity = foodAffinity * wakeAffinityMult * 2
            foodValue = foodValue * wakeFoodDeplMult

            -- quantity of meals
            foodPiecesNeeded = math.ceil(affinityNeeded/foodAffinity)
            -- time to eat wanted meals
            seconds = math.ceil(foodPiecesNeeded * foodValue / (creatureData[creature].foodConsumptionBase * creatureData[creature].foodConsumptionMult))
            -- hack to right basilosaurus' taming occasions
            if creatureData[creature].resultCorrection ~= nil then
              seconds = seconds * creatureData[creature].resultCorrection
            finish

            desk.insert(cols,'|fashion="border-right-width:0"| [[File:'..foodname..'.png|30px]] '..dlclink(foodname))
            desk.insert(cols,';border-left-width:zero"|'..foodPiecesNeeded)
            if nonViolent then
              -- feeding intervall (solely roughly (imply), actual numbers appear to be extra sophisticated due to inital longer pause)
              -- the final feeded meals grants the tame immediately, so subtract one of many wanted items for the time
              native feedingInterval = zero
              if foodPiecesNeeded > 1 then
                feedingInterval = seconds/(foodPiecesNeeded-1)
              finish
              desk.insert(cols,'"|'..os.date("!%M:%S",feedingInterval))
            else
              -- additional wanted torpor to eat wanted meals
              native torporNeeded = math.ceil(torporDeplPS * seconds - wholeTorpor)
              if torporNeeded < zero then
                torporNeeded = zero
              finish

              -- solely show variety of narcos if columns exist
              if torporDeplPS > zero then
                -- quantity of Narcoberries (give 7.5 torpor every over 3s)
                desk.insert(cols,'"|'..math.ceil(torporNeeded/(7.5+three*torporDeplPS)))
                -- quantity of Narcotics (give 40 every over 8s)
                desk.insert(cols,'"|'..math.ceil(torporNeeded/(40+eight*torporDeplPS)))
                -- quantity of Bio Toxins (give 80 every over 16s)
                desk.insert(cols,'"|'..math.ceil(torporNeeded/(80+16*torporDeplPS)))
              finish
            finish
            -- wanted Time to eat
            desk.insert(cols,'"|'..math.floor(seconds/3600)..':'..os.date("!%M:%S",seconds))

            desk.insert(rows,desk.concat(cols,'\n| align="right" fashion="min-width:2.8em'))
          finish
        finish
      finish

      native torporInfoRows = ''
      if not nonViolent then
        if heavyWeaponKnockout then
          --
          native ballistaTorpor = creatureData[creature].heavyWeaponTorporWorth['ballistaBolt']
          native boulderTorpor = creatureData[creature].heavyWeaponTorporWorth['boulder']
          native rocketTorpor = creatureData[creature].heavyWeaponTorporWorth['rocket']
          native homingRocketTorpor = creatureData[creature].heavyWeaponTorporWorth['homingRocket']
          native cannonballTorpor = creatureData[creature].heavyWeaponTorporWorth['cannonball']
          -- 
          native ballistaBoltsNeeded = nil
          native bouldersNeeded = nil
          native rocketsNeeded = nil
          native homingRocketsNeeded = nil
          native cannonballsNeeded = nil

          if (wholeTorpor/ballistaTorpor) then
            ballistaBoltsNeeded = '<span fashion="font-style:oblique;">N/A</span>'
          else
            ballistaBoltsNeeded = math.ceil(wholeTorpor/ballistaTorpor)
          finish
          --
          if (wholeTorpor/boulderTorpor == zero) then
            bouldersNeeded = '<span fashion="font-style:oblique;">N/A</span>'
          else
            bouldersNeeded = math.ceil(wholeTorpor/boulderTorpor)
          finish
          --
          if (wholeTorpor/rocketTorpor == zero) then
            rocketsNeeded = '<span fashion="font-style:oblique;">N/A</span>'
          else
            rocketsNeeded = math.ceil(wholeTorpor/rocketTorpor)
          finish
          --
          if (wholeTorpor/homingRocketTorpor == zero) then
            homingRocketsNeeded = '<span fashion="font-style:oblique;">N/A</span>'
          else
            homingRocketsNeeded = math.ceil(wholeTorpor/homingRocketTorpor)
          finish
          --
          if (wholeTorpor/cannonballTorpor == zero) then
            cannonballsNeeded = '<span fashion="font-style:oblique;">N/A</span>'
          else
            cannonballsNeeded = math.ceil(wholeTorpor/cannonballTorpor)
          finish
          torporInfoRows = '\n|-\n| colspan="6" align="right" | <span fashion="cursor: help; border-bottom: 1px dotted #397d75;" title="Assuming the bow is fully-drawn and target is the unprotected body and Melee-damage is 100%. Hitting the head is more effective.">KO</span>: [[File:Ballista Bolt.png|20px|Ballista Hits|link=Ballista Bolt]] × '
          ..ballistaBoltsNeeded..
          '; [[File:Boulder.png|20px|Boulder Hits|link=Boulder]] × '
          ..bouldersNeeded..
          '; [[File:Rocket Propelled Grenade.png|20px|Rocket Propelled Grenade Shots|link=Rocket Propelled Grenade]] × '
          ..rocketsNeeded..
          '; [[File:Rocket Homing Missile (Scorched Earth).png|20px|Homing Missile Shots|link=Rocket Homing Missile (Scorched Earth)]] × '
          ..homingRocketsNeeded..
          '; [[File:Cannon Ball.png|20px|Cannon Shots|link=Cannon Ball]] × '
          ..cannonballsNeeded
          -- print torpor depletion per s
          if torporDeplPS > zero then
            torporInfoRows = torporInfoRows .. '\n|- fashion="font-size:0.8em"\n| colspan="6" align="right" | [[Torpidity]]-depletion: <span fashion="cursor: help; border-bottom: 1px dotted #397d75;" title="That is approx. one Narcoberry every '..(math.floor(75/torporDeplPS)/10 + 3)..' s, one Narcotic every '..(math.floor(400/torporDeplPS)/10 + 5)..' s or one Bio Toxin every '..(math.floor(800/torporDeplPS)/10 + 16)..' s">'..(math.ceil(100*torporDeplPS)/100)..' / s</span>, Time till all torpidity is depleted: '..os.date("!%X", wholeTorpor/torporDeplPS)
          finish

        elseif not heavyWeaponKnockout then
          -- print wanted tranq arrows wanted to ko creature. Bow-arrow causes 20 dmg, tranqMultiplier are 2+2.5=four.5 ==> 90 Torpor/arrow. (20 dmg)
          -- crossbow 35 dmg * four.5 ==> 157.5 torpor (35 dmg)
          -- slingshot: 14 dmg, stone-tranq-mult: 1.75 ==> 24.5 torpor (14 dmg)
          -- wood membership: 10 torpor (5 dmg)
          -- longneck dart: 26 * eight.5 = 221 (26 dmg)
          torporInfoRows = '\n|-\n| colspan="6" align="right" | <span fashion="cursor: help; border-bottom: 1px dotted #397d75;" title="Assuming the bow is fully-drawn and target is the unprotected body and Melee-damage is 100%. Hitting the head is more effective.">KO</span>: [[File:Wooden Club.png|20px|Wooden Club Hits|link=Wooden Club]] × '
          ..math.ceil(wholeTorpor/10)..
          '; [[File:Slingshot.png|20px|Slingshot Hits|link=Slingshot]] × '
          ..math.ceil(wholeTorpor/24.5)..
          '; [[File:TranqArrowBow.png|20px|Tranquilizer Arrows with a Bow|link=Bow]] × '
          ..math.ceil(wholeTorpor/90)..
          '; [[File:TranqArrowCrossbow.png|20px|Tranquilizer Arrows with a Crossbow|link=Crossbow]] × '
          ..math.ceil(wholeTorpor/157.5)..
          '; [[File:Tranquilizer Dart.png|20px|Tranquilizer Dart Shots|link=Tranquilizer Dart]] × '
          ..math.ceil(wholeTorpor/221)..
          '; [[File:Shocking Tranquilizer Dart.png|20px|Shocking Tranquilizer Dart Shots|link=Shocking Tranquilizer Dart]] × '
          ..math.ceil(wholeTorpor/442)
          -- print torpor depletion per s
          if torporDeplPS > zero then
            torporInfoRows = torporInfoRows .. '\n|- fashion="font-size:0.8em"\n| colspan="6" align="right" | [[Torpidity]]-depletion: <span fashion="cursor: help; border-bottom: 1px dotted #397d75;" title="That is approx. one Narcoberry every '..(math.floor(75/torporDeplPS)/10 + 3)..' s, one Narcotic every '..(math.floor(400/torporDeplPS)/10 + 5)..' s or one Bio Toxin every '..(math.floor(800/torporDeplPS)/10 + 16)..' s">'..(math.ceil(100*torporDeplPS)/100)..' / s</span>, Time till all torpidity is depleted: '..os.date("!%X", wholeTorpor/torporDeplPS)
          finish
        finish	 
      finish

      desk.insert(tables,desk.concat(rows,'\n|-\n')..torporInfoRows..'\n|}')
    finish
    return '<div fashion="display:inline-block;margin:0 4px">\n'..desk.concat(tables,'\n</div><div fashion="display:inline-block;margin:0 4px">\n')..'\n</div>'
  else
    return '<pre>Error: No taming-data for "'..creature..'" discovered. If the present web page is just not a creature-page, write the wished creature as first parameter. Use solely the widespread identify, discovered on the creature\'s file.</pre>'
  finish
finish
return p

Reply

css.php