From Dark and Darker Wiki
Overview
Functions for making Faustian Bargain table. Data comes from Data:Faustian.json.
Functions
draw_table
Creates a table of faustian monsters and their affinities
Parameters
None
draw_table examples
{{#invoke:Faustian|draw_table}}
| Monster | Affinity Required |
|---|---|
| CentaurDemon_Nightmare | 66 |
| CentaurDemon_Elite | 64 |
| CentaurDemon | 62 |
| DemonBerserker_Nightmare | 58 |
| DemonDog_Nightmare | 58 |
| FrostDemon_Nightmare | 58 |
| DemonBerserker_Elite | 55 |
| DemonDog_Elite | 55 |
| FrostDemon_Elite | 55 |
| DemonBerserker | 52 |
| DemonDog | 52 |
| FrostDemon | 52 |
| RuinsGolem_Nightmare | 50 |
| SkeletonChampion_Nightmare | 50 |
| Yeti_Nightmare | 50 |
| RuinsGolem_Elite | 48 |
| SkeletonChampion_Elite | 48 |
| Yeti_Elite | 48 |
| Cockatrice_Nightmare | 47 |
| FrostGiantBerserker_Nightmare | 47 |
| FrostGiantShielder_Nightmare | 47 |
| GiantCentipede_Nightmare | 47 |
| RuinsGolem | 47 |
| SkeletonChampion | 47 |
| WhiteShark_Nightmare | 47 |
| Wraith_Nightmare | 47 |
| Yeti | 47 |
| Cockatrice_Elite | 45 |
| FrostGiantBerserker_Elite | 45 |
| FrostGiantShielder_Elite | 45 |
| GiantCentipede_Elite | 45 |
| WhiteShark_Elite | 45 |
| Wraith_Elite | 45 |
| Cockatrice | 42 |
| FrostGiantBerserker | 42 |
| FrostGiantShielder | 42 |
| GiantCentipede | 42 |
| WhiteShark | 42 |
| Wraith | 42 |
| FrostSkeletonAxeman_Nightmare | 40 |
| FrostSkeletonAxeman_Elite | 37 |
| FrostSkeletonAxeman | 35 |
| FrostSkeletonMaceman_Nightmare | 33 |
| Ghoul_Nightmare | 33 |
| SkeletonAxeman_Nightmare | 33 |
| SkeletonMage_Nightmare | 33 |
| FrostSkeletonMaceman_Elite | 30 |
| Ghoul_Elite | 30 |
| SkeletonAxeman_Elite | 30 |
| SkeletonMage_Elite | 30 |
| FrostSkeletonMaceman | 28 |
| Ghoul | 28 |
| SkeletonAxeman | 28 |
| SkeletonMage | 28 |
| GoblinArcher_Nightmare | 27 |
| IceSpider_Nightmare | 27 |
| PirateAxeThrower_Nightmare | 27 |
| TidewalkerClubFighter_Nightmare | 27 |
| GoblinArcher_Elite | 25 |
| IceSpider_Elite | 25 |
| PirateAxeThrower_Elite | 25 |
| TidewalkerClubFighter_Elite | 25 |
| GoblinArcher | 24 |
| IceSpider | 24 |
| PirateAxeThrower | 24 |
| TidewalkerClubFighter | 24 |
| IceKoboldArcher_Nightmare | 21 |
| PirateBowman_Nightmare | 21 |
| IceKoboldArcher_Elite | 20 |
| PirateBowman_Elite | 20 |
| IceKoboldArcher | 18 |
| PirateBowman | 18 |
| SkeletonSpearman | 17 |
| SkeletonSpearman_Elite | 17 |
| SkeletonSpearman_Nightmare | 17 |
| FrostSkeletonHalberdier_Nightmare | 14 |
| FrostWolf_Nightmare | 14 |
| GoblinBolaslinger_Nightmare | 14 |
| HellMaggot_Nightmare | 14 |
| TidewalkerSpearer_Nightmare | 14 |
| FrostSkeletonHalberdier_Elite | 12 |
| FrostWolf_Elite | 12 |
| GoblinBolaslinger_Elite | 12 |
| HellMaggot_Elite | 12 |
| TidewalkerSpearer_Elite | 12 |
| DireWolf | 10 |
| DireWolf_Elite | 10 |
| DireWolf_Nightmare | 10 |
| FrostSkeletonHalberdier | 10 |
| FrostWolf | 10 |
| GoblinBolaslinger | 10 |
| HellMaggot | 10 |
| TidewalkerSpearer | 10 |
| GoblinAxeman_Nightmare | 9 |
| PirateSwordman_Nightmare | 9 |
| Slime_Nightmare | 9 |
| GoblinAxeman_Elite | 8 |
| PirateSwordman_Elite | 8 |
| Slime_Elite | 8 |
| GoblinAxeman | 7 |
| PirateSwordman | 7 |
| Slime | 7 |
| FrostWalker_Nightmare | 6 |
| Zombie_Nightmare | 6 |
| FrostWalker_Elite | 5 |
| Zombie_Elite | 5 |
| FrostWalker | 4 |
| Zombie | 4 |
| FrostSkeletonArcher_Nightmare | 3 |
| FrostSkeletonArcher_Elite | 2 |
| FrostSkeletonCrossbowman_Nightmare | 2 |
| IceKoboldAxeman_Nightmare | 2 |
| SkeletonArcher_Nightmare | 2 |
| SkeletonCrossbowman_Nightmare | 2 |
| SkeletonFootmanFromFakeDeath_Nightmare | 2 |
| SkeletonFootman_Nightmare | 2 |
| SkeletonGuardmanFromFakeDeath_Nightmare | 2 |
| SkeletonGuardman_Nightmare | 2 |
| SpiderMummy_Nightmare | 2 |
| FrostSkeletonArcher | 1 |
| FrostSkeletonCrossbowman_Elite | 1 |
| GoblinWarrior | 1 |
| GoblinWarrior_Elite | 1 |
| GoblinWarrior_Nightmare | 1 |
| IceKoboldAxeman_Elite | 1 |
| SkeletonArcher_Elite | 1 |
| SkeletonCrossbowman_Elite | 1 |
| SkeletonFootmanFromFakeDeath_Elite | 1 |
| SkeletonFootman_Elite | 1 |
| SkeletonGuardmanFromFakeDeath_Elite | 1 |
| SkeletonGuardman_Elite | 1 |
| SpiderMummy_Elite | 1 |
| FrostSkeletonCrossbowman | 0 |
| FrostSkeletonFootman | 0 |
| FrostSkeletonFootmanFromFakeDeath | 0 |
| FrostSkeletonFootmanFromFakeDeath_Elite | 0 |
| FrostSkeletonFootmanFromFakeDeath_Nightmare | 0 |
| FrostSkeletonFootman_Elite | 0 |
| FrostSkeletonFootman_Nightmare | 0 |
| FrostSkeletonGuardman | 0 |
| FrostSkeletonGuardmanFromFakeDeath | 0 |
| FrostSkeletonGuardmanFromFakeDeath_Elite | 0 |
| FrostSkeletonGuardmanFromFakeDeath_Nightmare | 0 |
| FrostSkeletonGuardman_Elite | 0 |
| FrostSkeletonGuardman_Nightmare | 0 |
| IceKoboldAxeman | 0 |
| PinchclawCrab | 0 |
| PinchclawCrab_Elite | 0 |
| PinchclawCrab_Nightmare | 0 |
| SkeletonArcher | 0 |
| SkeletonCrossbowman | 0 |
| SkeletonFootman | 0 |
| SkeletonFootmanFromFakeDeath | 0 |
| SkeletonGuardman | 0 |
| SkeletonGuardmanFromFakeDeath | 0 |
| SpiderMummy | 0 |
Code
local p = {}
local FD = mw.loadJsonData("Data:Faustian.json")
local concat = table.concat
local format = string.format
function p.draw_table(frame)
local wt = {}
wt[#wt+1] = "<table cellspacing='0' class='wikitable sortable jquery-tablesorter' style='text-align:center; vertical-align:middle; width:30%'>"
wt[#wt+1] = '<tr>'
wt[#wt+1] = '<th style="width:15%">Monster</th>'
wt[#wt+1] = '<th style="width:5%">Affinity Required</th>'
wt[#wt+1] = '</tr>'
for _, name in ipairs(FD["Affinities"].order) do
wt[#wt+1] = '<tr>'
wt[#wt+1] = format('<td>%s</td>', name)
wt[#wt+1] = format('<td>%s</td>', FD["Affinities"][name])
wt[#wt+1] = '</tr>'
end
wt[#wt+1] = "</table>"
return concat(wt)
end
return p
-- Tests
-- mw.log(p.draw_table())