Module:Boss collection log calculator

local p = {}

function p.main(frame) local args = frame:getParent.args if args.boss == "Araxxi" then return Araxxi(args) elseif args.boss == "Corporeal beast" then return CorporealBeast(args) elseif args.boss == "Giant mole" then return GiantMole(args) elseif args.boss == "Kalphite King" then return KalphiteKing(args) elseif args.boss == "Kalphite Queen" then return KalphiteQueen(args) elseif args.boss == "King Black Dragon" then return KingBlackDragon(args) elseif args.boss == "Queen Black Dragon" then return QueenBlackDragon(args) elseif args.boss == "The Magister" then return TheMagister(args) elseif args.boss == "TzHaar" then return TzHaar(args) end end

function Araxxi(args) local araxytePheromoneDropRate = 50--Araxyte pheromone 1/50 to 1/35 from 0 to 300 enrage local spiderLegTopDropRate = 40--Spider leg top local spiderLegMiddleDropRate = 40--Spider leg middle local spiderLegBottomDropRate = 40--Spider leg bottom local araxxisFangDropRate = 120--Araxxi's fang local araxxisWebDropRate = 120--Araxxi's web local araxxisEyeDropRate = 120--Araxxi's eye local araxytePetDropRate = 1000--Araxyte pet 1/1000 to 1/500 from 0 to 500 enrage gained within the kill local araxyteEggDropRate = 500--Araxyte egg local petThreshold = 200 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local araxytePheromone = 0 local spiderLeg = 0 local araxxisFang = 0 local araxxisWeb = 0 local araxxisEye = 0 local araxytePet = 0 local araxyteEgg = 0 local enrage = 0 local enrageP4 = 100 math.randomseed(os.time) for i=1,kills do   local araxytePheromoneRNG = math.random(1, araxytePheromoneDropRate - (enrage / 20)) local spiderLegRNG = math.random(1, 40) local araxxisFangWebEyeRNG = math.random(1, 120) local araxytePetRNG = math.random(1, araxytePetDropRate - enrageP4) if araxytePheromoneRNG == 1 then araxytePheromone = araxytePheromone + 1 end if spiderLegRNG == 1 then spiderLeg = spiderLeg + 1 end if araxxisFangWebEyeRNG == 1 then local meleeFormRNG = math.random(1, 4) if meleeFormRNG >= 1 and meleeFormRNG <= 2 then araxxisFang = araxxisFang + 1 elseif meleeFormRNG == 3 then araxxisWeb = araxxisWeb + 1 elseif meleeFormRNG == 4 then araxxisEye = araxxisEye + 1 end end if araxytePetRNG == 1 then araxytePet = araxytePet + 1 end if araxytePet >= 1 then araxyteEgg = araxyteEgg + petRNG(araxyteEggDropRate, petThreshold, currentKillCount) end currentKillCount = currentKillCount + 1 if araxytePheromone >= 1 and spiderLeg >= 3 and araxxisFang >= 1 and araxxisWeb >= 1 and araxxisEye >=1 and araxytePet >= 1 and araxyteEgg >= 2 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     araxytePheromone = 0 spiderLeg = 0 araxxisFang = 0 araxxisWeb = 0 araxxisEye = 0 araxytePet = 0 araxyteEgg = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function CorporealBeast(args) local spiritShieldDropRate = 512--Spirit shield 8/512 local holyElixirDropRate = 512--Holy elixir 3/512 local spectralSigilDropRate = 512--Spectral sigil 1/512 then 2/5 local arcaneSigilDropRate = 512--Arcane sigil 1/512 then 1/5 local elysianSigilDropRate = 512--Elysian sigil 1/512 then 1/5 local divineSigilDropRate = 512--Divine sigil 1/512 then 1/5 local petDropRate = 2500--Corporeal bone local petThreshold = 500 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local spiritShield = 0 local holyElixir = 0 local spectralSigil = 0 local arcaneSigil = 0 local elysianSigil = 0 local divineSigil = 0 local corporealBone = 0 math.randomseed(os.time) for i=1,kills do   local mainTableRNG = math.random(1, 512) if mainTableRNG == 1 then local sigilTableRNG = math.random(1, 5) if sigilTableRNG == 1 then divineSigil = divineSigil + 1 elseif sigilTableRNG == 2 then elysianSigil = elysianSigil + 1 elseif sigilTableRNG == 3 then arcaneSigil = arcaneSigil + 1 elseif sigilTableRNG >= 4 and sigilTableRNG <= 5 then spectralSigil = spectralSigil + 1 end elseif mainTableRNG >= 2 and mainTableRNG <= 4 then holyElixir = holyElixir + 1 elseif mainTableRNG >= 5 and mainTableRNG <= 12 then spiritShield = spiritShield + 1 end corporealBone = corporealBone + petRNG(petDropRate, petThreshold, currentKillCount) currentKillCount = currentKillCount + 1 if spiritShield >=1 and holyElixir >= 1 and spectralSigil >= 1 and arcaneSigil >= 1 and elysianSigil >= 1 and divineSigil >= 1 and corporealBone >= 1 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     spiritShield = 0 holyElixir = 0 spectralSigil = 0 arcaneSigil = 0 elysianSigil = 0 divineSigil = 0 corporealBone = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function GiantMole(args) local dragon2hSwordDropRate = 52--Dragon 2h sword local dragon2hSwordHMDropRate = 52--Dragon 2h sword HM 2/52 local clingyMoleDropRate = 52--Clingy mole 5/52 local clingyMoleHMDropRate = 52--Clingy mole HM 10/52 local petDropRate = 2500--Rotten fang local petHMDropRate = 500--Rotten fang HM local petThreshold = 500 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local dragon2hSword = 0 local clingyMole = 0 local rottenFang = 0 math.randomseed(os.time) for i=1,kills do   local dragon2hSwordRNG = math.random(1, dragon2hSwordDropRate) local clingyMoleRNG = math.random(1, clingyMoleDropRate) local rottenFang = math.random(1, petDropRate) if dragon2hSwordRNG == 1 then dragon2hSword = dragon2hSword + 1 end if clingyMoleRNG >= 1 and clingyMoleRNG <= 5 then clingyMole = clingyMole + 1 end rottenFang = rottenFang + petRNG(petDropRate, petThreshold, currentKillCount) if dragon2hSword >= 1 and clingyMole >= 1 and rottenFang >= 1 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     dragon2hSword = 0 clingyMole = 0 rottenFang = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function KalphiteKing(args) local drygoreRapierDropRate = 128--Drygore rapier 1/128 then 1/2 local drygoreLongswordDropRate = 128--Drygore longsword 1/128 then 1/2 local drygoreMaceDropRate = 128--Drygore mace 1/128 then 1/2 local offHandDrygoreRapierDropRate = 128--Off-hand drygore rapier 1/128 then 1/2 local offHandDrygoreLongswordDropRate = 128--Off-hand drygore longsword 1/128 then 1/2 local offHandDrygoreMaceDropRate = 128--Off-hand drygore mace 1/128 then 1/2 local perfectChitinDropRate = 50--Perfect chitin local petDropRate = 2000--Kalphite claw local petThreshold = 400 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local drygoreRapier = 0 local drygoreLongsword = 0 local drygoreMace = 0 local offHandDrygoreRapier = 0 local offHandDrygoreLongsword = 0 local offHandDrygoreMace = 0 local perfectChitin = 0 local kalphiteClaw = 0 math.randomseed(os.time) for i=1,kills do   local mainTableRNG = math.random(1, 128) local perfectChitinRNG = math.random(1, perfectChitinDropRate) if mainTableRNG == 1 then if math.random(1, 2) == 1 then drygoreRapier = drygoreRapier + 1 else offHandDrygoreRapier = offHandDrygoreRapier + 1 end elseif mainTableRNG == 2 then if math.random(1, 2) == 1 then drygoreLongsword = drygoreLongsword + 1 else offHandDrygoreLongsword = offHandDrygoreLongsword + 1 end elseif mainTableRNG == 3 then if math.random(1, 2) == 1 then drygoreMace = drygoreMace + 1 else offHandDrygoreMace = offHandDrygoreMace + 1 end end if perfectChitinRNG == 1 then perfectChitin = perfectChitin + 1 end kalphiteClaw = kalphiteClaw + petRNG(petDropRate, petThreshold, currentKillCount) currentKillCount = currentKillCount + 1 if drygoreRapier >=1 and drygoreLongsword >= 1 and drygoreMace >= 1 and offHandDrygoreRapier >= 1 and offHandDrygoreLongsword >= 1 and offHandDrygoreMace >= 1 and perfectChitin >= 1 and kalphiteClaw >= 1 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     drygoreRapier = 0 drygoreLongsword = 0 drygoreMace = 0 offHandDrygoreRapier = 0 offHandDrygoreLongsword = 0 offHandDrygoreMace = 0 perfectChitin = 0 kalphiteClaw = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function KalphiteQueen(args) local dragonChainbodyDropRate = 128--Dragon chainbody local dragon2hSwordDropRate = 128--Dragon 2h sword 1/128 then 1/2 local dragon2hSwordHMDropRate = 128--Dragon 2h sword HM local kalphiteQueenHeadDropRate = 128--Kalphite queen head local petDropRate = 2500--Kalphite egg local petThreshold = 500 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local dragonChainbody = 0 local dragon2hSword = 0 local dragon2hSwordHM = 0 local kalphiteQueenHead = 0 local kalphiteEgg = 0 math.randomseed(os.time) for i=1,kills do   local mainTableRNG = math.random(1, 128) local kalphiteQueenHeadRNG = math.random(1, kalphiteQueenHeadDropRate) if mainTableRNG == 1 then dragonChainbody = dragonChainbody +1 elseif mainTableRNG == 2 then if math.random(1, 2) == 1 then dragon2hSword = dragon2hSword +1 end end if kalphiteQueenHeadRNG == 1 then kalphiteQueenHead = kalphiteQueenHead +1 end kalphiteEgg = kalphiteEgg + petRNG(petDropRate, petThreshold, currentKillCount) currentKillCount = currentKillCount + 1 if kalphiteEgg >= 1 and dragonChainbody >= 1 and dragon2hSword >= 1 and kalphiteQueenHead >= 1 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     kalphiteEgg = 0 dragonChainbody = 0 dragon2hSword = 0 dragon2hSwordHM = 0 kalphiteQueenHead = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function KingBlackDragon(args) local dragonRiderGlovesDropRate = 500--Dragon rider gloves 1/500 then 1/4 local dragonRiderBootsDropRate = 500--Dragon rider boots 1/500 then 1/4 local dragonKiteOrnamentKitOrDropRate = 500--Dragon kite ornament kit (or) 1/500 then 1/4 local dragonKiteOrnamentKitSpDropRate = 500--Dragon kite ornament kit (sp) 1/500 then 1/4 local lastRidersDropRate = 1000--Last riders -1 denominator for every kill local kingBlackDragonHeadDropRate = 1280--King black dragon head 10/1280 local draconicVisageDropRate = 5000--Draconic visage local petDropRate = 2500--King black dragon scale local petThreshold = 500 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local dragonRiderGloves = 0 local dragonRiderBoots = 0 local dragonKiteOrnamentKitOr = 0 local dragonKiteOrnamentKitSp = 0 local lastRiders = 0 local kingBlackDragonHead = 0 local draconicVisage = 0 local kingBlackDragonScale = 0 math.randomseed(os.time) for i=1,kills do   local mainTableRNG = math.random(1, 500) local kingBlackDragonHeadRNG = math.random(1, kingBlackDragonHeadDropRate) local draconicVisageRNG = math.random(1, draconicVisageDropRate) if mainTableRNG == 1 then local uniqueTableRNG = math.random(1,4) if uniqueTableRNG == 1 then dragonRiderGloves = dragonRiderGloves + 1 elseif uniqueTableRNG == 2 then dragonRiderBoots = dragonRiderBoots + 1 elseif uniqueTableRNG == 3 then dragonKiteOrnamentKitOr = dragonKiteOrnamentKitOr + 1 elseif uniqueTableRNG == 4 then dragonKiteOrnamentKitSp = dragonKiteOrnamentKitSp + 1 end end if lastRidersDropRate - currentKillCount >= 1 then local lastRidersRNG = math.random(1, lastRidersDropRate - currentKillCount) if lastRidersRNG == 1 then lastRiders = lastRiders + 1 end else lastRiders = lastRiders + 1 end if kingBlackDragonHeadRNG >= 1 and kingBlackDragonHeadRNG <= 10 then kingBlackDragonHead = kingBlackDragonHead + 1 end if draconicVisageRNG == 1 then draconicVisage = draconicVisage + 1 end kingBlackDragonScale = kingBlackDragonScale + petRNG(petDropRate, petThreshold, currentKillCount) currentKillCount = currentKillCount + 1 if dragonRiderGloves >= 1 and dragonRiderBoots >= 1 and dragonKiteOrnamentKitOr >= 1 and dragonKiteOrnamentKitSp >= 1 and lastRiders >= 1 and kingBlackDragonHead >= 1 and draconicVisage >= 1 and kingBlackDragonScale >= 1 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     currentKillCount = killCount dragonRiderGloves = 0 dragonRiderBoots = 0 dragonKiteOrnamentKitOr = 0 dragonKiteOrnamentKitSp = 0 lastRiders = 0 kingBlackDragonHead = 0 draconicVisage = 0 kingBlackDragonScale = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function QueenBlackDragon(args) local royalBoltStabiliserDropRate = 128--Royal bolt stabiliser 5/128 local royalFrameDropRate = 128--Royal frame 5/128 local royalSightDropRate = 128--Royal sight 5/128 local royalTorsionSpringDropRate = 128--Royal torsion spring 5/128 local dragonboneUpgradeKitDropRate = 128--Dragonbone upgrade kit 2/128 local dragonKiteshieldDropRate = 128--Dragon kiteshield 1/128 local draconicVisageDropRate = 109--Draconic visage 1/109 local firstDragonkinJournalDropRate = 1--First dragonkin journal 1/1 local secondDragonkinJournalDropRate = 19--Second dragonkin journal 1/19 local thirdDragonkinJournalDropRate = 19--Third dragonkin journal 1/19 local fourthDragonkinJournalDropRate = 19--Fourth dragonkin journal 1/19 local petDropRate = 2500--Queen black dragon scale local petThreshold = 500 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local royalBoltStabiliser = 0 local royalFrame = 0 local royalSight = 0 local royalTorsionSpring = 0 local dragonboneUpgradeKit = 0 local dragonKiteshield = 0 local draconicVisage = 0 local dragonkinJournal = 0 local queenBlackDragonScale = 0 math.randomseed(os.time) for i=1,kills do   local uniqueTableRNG = math.random(1, 128) local draconicVisageRNG = math.random(1, draconicVisageDropRate) local dragonkinJournalRNG = math.random(1, 19) if uniqueTableRNG == 1 then dragonKiteshield = dragonKiteshield + 1 elseif uniqueTableRNG >= 2 and uniqueTableRNG <= 3 then dragonboneUpgradeKit = dragonboneUpgradeKit + 1 elseif uniqueTableRNG >= 4 and uniqueTableRNG <= 8 then royalBoltStabiliser = royalBoltStabiliser + 1 elseif uniqueTableRNG >= 9 and uniqueTableRNG <= 13 then royalFrame = royalFrame + 1 elseif uniqueTableRNG >= 14 and uniqueTableRNG <= 18 then royalSight = royalSight + 1 elseif uniqueTableRNG >= 19 and uniqueTableRNG <= 23 then royalTorsionSpring = royalTorsionSpring + 1 end if draconicVisageRNG == 1 then draconicVisage = draconicVisage + 1 end if currentKillCount == 0 then dragonkinJournal = dragonkinJournal + 1 elseif dragonkinJournalRNG == 1 then dragonkinJournal = dragonkinJournal + 1 end queenBlackDragonScale = queenBlackDragonScale + petRNG(petDropRate, petThreshold, currentKillCount) currentKillCount = currentKillCount + 1 if royalBoltStabiliser >= 1 and royalFrame >= 1 and royalSight >= 1 and royalTorsionSpring >= 1 and dragonboneUpgradeKit >= 1 and dragonKiteshield >= 1 and draconicVisage >= 1 and dragonkinJournal >= 4 and queenBlackDragonScale >= 1 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     currentKillCount = killCount royalBoltStabiliser = 0 royalFrame = 0 royalSight = 0 royalTorsionSpring = 0 dragonboneUpgradeKit = 0 dragonKiteshield = 0 draconicVisage = 0 dragonkinJournal = 0 queenBlackDragonScale = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function TheMagister(args) local glovesOfPassageDropRate = 500--Gloves of passage local phylacteryDropRate = 18--Phylactery local theMagistersJournal1DropRate = 10--The Magister's Journal 1 local theMagistersJournal2DropRate = 10--The Magister's Journal 2 local theMagistersJournal3DropRate = 10--The Magister's Journal 3 local theMagistersJournal4DropRate = 10--The Magister's Journal 4 local theMagistersJournal5DropRate = 10--The Magister's Journal 5 local petDropRate = 1000--Soul fragment local petThreshold = 200 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local glovesOfPassage = 0 local phylactery = 0 local theMagistersJournal = 0 local soulFragment = 0 math.randomseed(os.time) for i=1,kills do   local glovesOfPassageRNG = math.random(1, glovesOfPassageDropRate) local phylacteryRNG = math.random(1, phylacteryDropRate) local theMagistersJournalRNG = math.random(1, 10) if glovesOfPassageRNG == 1 then glovesOfPassage = glovesOfPassage + 1 end if phylacteryRNG == 1 then phylactery = phylactery + 1 end if theMagistersJournalRNG == 1 then theMagistersJournal = theMagistersJournal + 1 end soulFragment = soulFragment + petRNG(petDropRate, petThreshold, currentKillCount) currentKillCount = currentKillCount + 1 if glovesOfPassage >=1 and phylactery >= 1 and theMagistersJournal >= 5 and soulFragment >= 1 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     currentKillCount = killCount glovesOfPassage = 0 phylactery = 0 theMagistersJournal = 0 soulFragment = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function TzHaar(args) local petDropRate = 200--Volcanic shard local petThreshold = 40 local kills = 1000000 local killCount = tonumber(args.killCount) or 0 local currentKillCount = killCount local startKillCount = 0 local endKillCount = 0 local leastKills = kills local mostKills = 0 local bossLogCompletionCount = 0 local tokHaarKal = 0 local volcanicShard = 0 math.randomseed(os.time) for i=1,kills do   tokHaarKal = tokHaarKal + 1 volcanicShard = volcanicShard + petRNG(petDropRate, petThreshold, currentKillCount) currentKillCount = currentKillCount + 1 if volcanicShard >= 1 and tokHaarKal >= 3 then bossLogCompletionCount = bossLogCompletionCount + 1 endKillCount = i     local totalKills = endKillCount - startKillCount if totalKills > mostKills then mostKills = totalKills end if totalKills < leastKills then leastKills = totalKills end startKillCount = i     currentKillCount = killCount volcanicShard = 0 end end local averageKills = kills / bossLogCompletionCount return results(kills, averageKills, leastKills, mostKills) end

function petRNG(petDropRate, petThreshold, currentKillCount) local pet = 0 local petRNG = math.random(1, petDropRate) if petRNG <= math.min(math.floor(currentKillCount / petThreshold) + 1, 10) then pet = pet + 1 end return pet end

function results(kills, averageKills, leastKills, mostKills) local s = "" .. string.format("%.0f", kills) .. " bosses died in a click of a button! The selected boss collection log was completed in " .. string.format("%.0f", averageKills) .. " kills on average, across a sample size of " .. string.format("%.0f", kills) .. " boss kills. The least amount of kills it took to complete the selected boss collection log was " .. string.format("%.0f", leastKills) .. " kill(s). The most amount of kills it took to complete the selected boss collection log was " .. string.format("%.0f", mostKills) .. " kills. " return s end

return p