From Dark and Darker Wiki
m (remove debug_mode, still not working) |
m (hidden_or_nonhidden param) |
||
Line 3: | Line 3: | ||
function p.create_achievements_table_body(frame) | function p.create_achievements_table_body(frame) | ||
local hidden_or_nonhidden = frame.args[1] | |||
if hidden_or_nonhidden == nil then | |||
hidden_or_nonhidden = "nonhidden" | |||
else | |||
hidden_or_nonhidden = "hidden" | |||
end | |||
local html = "" | local html = "" | ||
local record | local record | ||
for index, achievement in ipairs(achievements) do | for index, achievement in ipairs(achievements) do | ||
-- Ensure only the hidden or nonhidden are shown depending on parameter | |||
is_hidden = achievement.hidden or false | |||
if (is_hidden and hidden_or_nonhidden == "nonhidden") or | |||
(not is_hidden and hidden_or_nonhidden == "hidden") then | |||
break | |||
end | |||
record = "<tr>\n" | record = "<tr>\n" | ||
record = record .. "<td>" .. (achievement.localized_name) .. "</td>\n" | record = record .. "<td>" .. (achievement.localized_name) .. "</td>\n" |
Revision as of 04:11, 22 December 2024
Overview
Functions for Data:Achievements.json
Functions
create_achievements_table_body
Creates the body of a html function with 6 pre-set columns
Parameters
- hidden_or_nonhidden - defaults to nonhidden - must be hidden or nonhidden - Displays only hidden or nonhidden achievements
Examples
Ensure to surround it by html table and its headers:
<table class="wikitable sortable"> <tr> <th>Name</th> <th>Icon</th> <th>Category</th> <th>Sub-Category</th> <th>Pre-requisite</th> <th>Description</th> </tr> {{#invoke:Achievements|create_achievements_table_body}} </table>
Name | Icon | Category | Sub-Category | Pre-requisite | Description |
---|---|---|---|---|---|
Crawl Into Darkness | Classes | Reach level 5 on any character. | |||
Dungeon Delver | Classes | Crawl Into Darkness | Reach level 10 on any character. | ||
Journeyman Explorer | Classes | Dungeon Delver | Reach level 20 on any character. | ||
Veteran Adventurer | Classes | Journeyman Explorer | Reach level 50 on any character. | ||
Herald of the Depths | Classes | Veteran Adventurer | Reach level 100 on any character. | ||
Warden of the Damned | Classes | Herald of the Depths | Reach level 200 on any character. | ||
Crown of Despair | Classes | Warden of the Damned | Reach level 300 on any character. | ||
Fully Equipped | Classes | Fill every perk slot. | |||
Fighter Initiate | Classes | Fighter | Reach level 20 as a Fighter. | ||
Sword for Hire | Classes | Fighter | Fighter Initiate | Reach level 100 as a Fighter. | |
Weapon Master | Classes | Fighter | Sword for Hire | Reach level 200 as a Fighter. | |
Champion of Arms | Classes | Fighter | Weapon Master | Reach level 300 as a Fighter. | |
Barbarian Whelp | Classes | Barbarian | Reach level 20 as a Barbarian. | ||
Barbarian Brute | Classes | Barbarian | Barbarian Whelp | Reach level 100 as a Barbarian. | |
Savage Barbarian | Classes | Barbarian | Barbarian Brute | Reach level 200 as a Barbarian. | |
Barbarian Chieftain | Classes | Barbarian | Savage Barbarian | Reach level 300 as a Barbarian. | |
Novice Rogue | Classes | Rogue | Reach level 20 as a Rogue. | ||
Seasoned Rogue | Classes | Rogue | Novice Rogue | Reach level 100 as a Rogue. | |
Veteran of Deception | Classes | Rogue | Seasoned Rogue | Reach level 200 as a Rogue. | |
Master Thief | Classes | Rogue | Veteran of Deception | Reach level 300 as a Rogue. | |
Apprentice Ranger | Classes | Ranger | Reach level 20 as a Ranger. | ||
Bow Bearer | Classes | Ranger | Apprentice Ranger | Reach level 100 as a Ranger. | |
Veteran Hunter | Classes | Ranger | Bow Bearer | Reach level 200 as a Ranger. | |
Eagle Eye | Classes | Ranger | Veteran Hunter | Reach level 300 as a Ranger. | |
Novice Spellcaster | Classes | Wizard | Reach level 20 as a Wizard. | ||
Adept Mystic | Classes | Wizard | Novice Spellcaster | Reach level 100 as a Wizard. | |
Archmage | Classes | Wizard | Adept Mystic | Reach level 200 as a Wizard. | |
Master Magus | Classes | Wizard | Archmage | Reach level 300 as a Wizard. | |
Acolyte of Light | Classes | Cleric | Reach level 20 as a Cleric. | ||
Adept Clinician | Classes | Cleric | Acolyte of Light | Reach level 100 as a Cleric. | |
Archpriest | Classes | Cleric | Adept Clinician | Reach level 200 as a Cleric. | |
Divine Crusader | Classes | Cleric | Archpriest | Reach level 300 as a Cleric. | |
Minstrel of Melody | Classes | Bard | Reach level 20 as a Bard. | ||
Adept Troubadour | Classes | Bard | Minstrel of Melody | Reach level 100 as a Bard. | |
Songweaver | Classes | Bard | Adept Troubadour | Reach level 200 as a Bard. | |
Balladeer Maestro | Classes | Bard | Songweaver | Reach level 300 as a Bard. | |
Coven Initiate | Classes | Warlock | Reach level 20 as a Warlock. | ||
Conduit of Blood | Classes | Warlock | Coven Initiate | Reach level 100 as a Warlock. | |
Dark Disciple | Classes | Warlock | Conduit of Blood | Reach level 200 as a Warlock. | |
Elder of the Pact | Classes | Warlock | Dark Disciple | Reach level 300 as a Warlock. | |
Keeper of Sprouts | Classes | Druid | Reach level 20 as a Druid. | ||
Adept Shapeshifter | Classes | Druid | Keeper of Sprouts | Reach level 100 as a Druid. | |
Nature's Emissary | Classes | Druid | Adept Shapeshifter | Reach level 200 as a Druid. | |
Avatar of the Grove | Classes | Druid | Nature's Emissary | Reach level 300 as a Druid. | |
Sorcerer's Apprentice | Classes | Sorcerer | Reach level 20 as a Sorcerer. | ||
Master Caster | Classes | Sorcerer | Sorcerer's Apprentice | Reach level 100 as a Sorcerer. | |
Power Overwhelming | Classes | Sorcerer | Master Caster | Reach level 200 as a Sorcerer. | |
Sorcerer Supreme | Classes | Sorcerer | Power Overwhelming | Reach level 300 as a Sorcerer. | |
Light at the End | Dungeon | Escape | Successfully escape for the first time. | ||
Run It Back | Dungeon | Escape | Light at the End | Successfully escape twice. | |
The Quick and the Dead | Dungeon | Escape | Run It Back | Successfully escape 10 times. | |
Edge of Escape | Dungeon | Escape | The Quick and the Dead | Successfully escape 100 times. | |
Painted in Red | Dungeon | Monster | Kill any Elite monster. | ||
The Nightmare Ends | Dungeon | Monster | Kill any Nightmare monster. | ||
Crowned with Ash | Dungeon | Monster | Kill any Boss monster. | ||
Court Wizard's Demise | Dungeon | Monster | Kill the Lich. | ||
Banished Beyond | Dungeon | Monster | Kill the Ghost King. | ||
Breaker of Bone Thrones | Dungeon | Monster | Kill the Skeleton Warlord. | ||
The Bigger They Are, The Harder They Fall | Dungeon | Monster | Kill the Cave Troll. | ||
Eye for an Eye | Dungeon | Monster | Kill the Cyclops. | ||
Cold Case Closed | Dungeon | Monster | Kill the Frost Wyvern. | ||
Silence the Specter | Dungeon | Monster | Kill the Spectral Knight. | ||
She Screams No More | Dungeon | Monster | Kill the Banshee. | ||
Undead Slayer | Dungeon | Monster | Kill 1000 undead enemies. | ||
Demon Slayer | Dungeon | Monster | Kill 1000 demonic enemies. | ||
Beast Slayer | Dungeon | Monster | Kill 1000 beast-type enemies. | ||
Insect Slayer | Dungeon | Monster | Kill 1000 insectoid enemies. | ||
Goblin Slayer | Dungeon | Monster | Kill 1000 goblins. | ||
Kobold Slayer | Dungeon | Monster | Kill 1000 kobolds. | ||
Giant Slayer | Dungeon | Monster | Kill 1000 giants. | ||
A Quick Fix | Dungeon | Consumable | Use 10 Bandages. | ||
Field Medic | Dungeon | Consumable | A Quick Fix | Use 50 Bandages. | |
Master of Mending | Dungeon | Consumable | Field Medic | Use 100 Bandages. | |
First Sip | Dungeon | Consumable | Use 10 Potions of Healing. | ||
Potion Lover | Dungeon | Consumable | First Sip | Use 50 Potions of Healing. | |
Elixir Addict | Dungeon | Consumable | Potion Lover | Use 100 Potions of Healing. | |
Steady Hand | Dungeon | Consumable | Use 10 Surgical Kits. | ||
Trauma Technician | Dungeon | Consumable | Steady Hand | Use 100 Surgical Kits. | |
Sparks of Survival | Dungeon | Consumable | Use 10 Campfire Kits. | ||
Fire Starter | Dungeon | Consumable | Sparks of Survival | Use 100 Campfire Kits. | |
The First Cut | Dungeon | Challenge | Kill an enemy player for the first time. | ||
Keeper of the Eternal's Fall | High-Roller | Monster | Kill the Lich in High-Roller. | ||
Kingbreaker | High-Roller | Monster | Kill the Ghost King in High-Roller. | ||
Deliverer of Judgment | High-Roller | Monster | Kill the Skeleton Warlord in High-Roller. | ||
Crusher of the Colossus | High-Roller | Monster | Kill the Cave Troll in High-Roller. | ||
Bringer of Blindness | High-Roller | Monster | Kill the Cyclops in High-Roller. | ||
Cold-Blooded Killer | High-Roller | Monster | Kill the Frost Wyvern in High-Roller. | ||
Chivalry Shattered | High-Roller | Monster | Kill the Spectral Knight in High-Roller. | ||
The Last Wail | High-Roller | Monster | Kill the Banshee in High-Roller. | ||
Gravebound No More | High-Roller | High-Roller Rank | Reach the Neophyte rank in High-Roller. | ||
Apprentice of the Abyss | High-Roller | High-Roller Rank | Reach the Apprentice rank in High-Roller. | ||
A Curious Wanderer | High-Roller | High-Roller Rank | Reach the Wanderer rank in High-Roller. | ||
Trailblazer | High-Roller | High-Roller Rank | Reach the Pathfinder rank in High-Roller. | ||
Herald of Paths | High-Roller | High-Roller Rank | Reach the Voyager rank in High-Roller. | ||
Paragon of Excellence | High-Roller | High-Roller Rank | Reach the Exemplar rank in High-Roller. | ||
Mortal No More | High-Roller | High-Roller Rank | Reach the Demigod rank in High-Roller. | ||
First Blood | Arena | Win an Arena match for the first time. | |||
Rising Challenger | Arena | First Blood | Win an Arena match 10 times. | ||
Bloodstained Champion | Arena | Rising Challenger | Win an Arena match 50 times. | ||
Legend of the Arena | Arena | Bloodstained Champion | Win an Arena match 100 times. | ||
Lucky Streak | Arena | Win in the Arena 2 times consecutively. | |||
You're on Fire | Arena | Lucky Streak | Win in the Arena 5 times consecutively. | ||
Unstoppable | Arena | You're on Fire | Win in the Arena 10 times consecutively. | ||
Relentless Executioner | Arena | Unstoppable | Win in the Arena 20 times consecutively. | ||
Fresh Meat | Arena | Arena Rank | Reach the Tiro rank in Arena. | ||
Pit Scrapper | Arena | Arena Rank | Reach the Scrapper rank in Arena. | ||
Gladiator | Arena | Arena Rank | Reach the Gladiator rank in Arena. | ||
Veteran of the Pit | Arena | Arena Rank | Reach the Veteran rank in Arena. | ||
Contending Challenger | Arena | Arena Rank | Reach the Contender rank in Arena. | ||
The Crimson Vanquisher | Arena | Arena Rank | Reach the Vanquisher rank in Arena. | ||
Rise of the Warlord | Arena | Arena Rank | Reach the Warlords rank in Arena. | ||
It's a Start... | Item | Gear | Equip Uncommon grade items or higher in your main slots. | ||
Fit Check | Item | Gear | Equip Rare grade items or higher in your main slots. | ||
Nice Threads | Item | Gear | Equip Epic grade items or higher in your main slots. | ||
Flawless Drip | Item | Gear | Equip Legendary grade items or higher in your main slots. | ||
Dagger Wielder | Item | Gear | Kill 100 enemies with a Dagger type weapon. | ||
Dagger Expert | Item | Gear | Dagger Wielder | Kill 500 enemies with a Dagger type weapon. | |
Bloodletter | Item | Gear | Dagger Expert | Kill 1000 enemies with a Dagger type weapon. | |
Sword Wielder | Item | Gear | Kill 100 enemies with a Sword type weapon. | ||
Sword Expert | Item | Gear | Sword Wielder | Kill 500 enemies with a Sword type weapon. | |
Blade of Woe | Item | Gear | Sword Expert | Kill 1000 enemies with a Sword type weapon. | |
Axe Wielder | Item | Gear | Kill 100 enemies with a Axe type weapon. | ||
Axe Expert | Item | Gear | Axe Wielder | Kill 500 enemies with a Axe type weapon. | |
Bone Cutter | Item | Gear | Axe Expert | Kill 1000 enemies with a Axe type weapon. | |
Mace Wielder | Item | Gear | Kill 100 enemies with a Mace type weapon. | ||
Mace Expert | Item | Gear | Mace Wielder | Kill 500 enemies with a Mace type weapon. | |
Deliverer of Justice | Item | Gear | Mace Expert | Kill 1000 enemies with a Mace type weapon. | |
Polearm Wielder | Item | Gear | Kill 100 enemies with a Polearm type weapon. | ||
Polearm Expert | Item | Gear | Polearm Wielder | Kill 500 enemies with a Polearm type weapon. | |
Spear of Judgment | Item | Gear | Polearm Expert | Kill 1000 enemies with a Polearm type weapon. | |
Staff Wielder | Item | Gear | Kill 100 enemies with a Staff type weapon. | ||
Staff Expert | Item | Gear | Staff Wielder | Kill 500 enemies with a Staff type weapon. | |
Arcane Arbiter | Item | Gear | Staff Expert | Kill 1000 enemies with a Staff type weapon. | |
Bow Wielder | Item | Gear | Kill 100 enemies with a Bow type weapon. | ||
Bow Expert | Item | Gear | Bow Wielder | Kill 500 enemies with a Bow type weapon. | |
Deadeye | Item | Gear | Bow Expert | Kill 1000 enemies with a Bow type weapon. | |
Crossbow Wielder | Item | Gear | Kill 100 enemies with a Crossbow type weapon. | ||
Crossbow Expert | Item | Gear | Crossbow Wielder | Kill 500 enemies with a Crossbow type weapon. | |
Trigger Finger | Item | Gear | Crossbow Expert | Kill 1000 enemies with a Crossbow type weapon. | |
Coin Snatcher | Item | Loot | Collect 100 Gold Coins in the Dungeon. | ||
Gold Hoarder | Item | Loot | Coin Snatcher | Collect 1000 Gold Coins in the Dungeon. | |
Wealth Enthusiast | Item | Loot | Gold Hoarder | Collect 10000 Gold Coins in the Dungeon. | |
Plunderer | Item | Loot | Interact with a treasure hoard. | ||
Prospect Miner | Item | Loot | Succeed in mining 10 times. | ||
King of the Quarry | Item | Loot | Prospect Miner | Succeed in mining 100 times. | |
Gold Digger | Item | Loot | Succeed mining for Gold Ore. | ||
Lobster Bait | Item | Loot | Succeed mining for Rubysilver Ore. | ||
Iced Out | Item | Loot | Succeed mining for Froststone Ore. | ||
Epic Spoils | Item | Loot | Collect Epic grade items of Looted state. | ||
Legendary Bounty | Item | Loot | Collect Legendary grade items of Looted state. | ||
Uniquely Yours | Item | Loot | Collect Unique grade items of Looted state. | ||
A Barrel of Stories | Quest | Complete all of the Tavern Master's quests offered during the Season. | |||
The Fortune's End | Quest | Complete all of the Treasurer's quests offered during the Season. | |||
Connoisseur of Curiosities | Quest | Complete all of the Collector's quests offered during the Season. | |||
Gobbo's Favorite Fleshy | Quest | Complete all of the Goblin Merchant's quests offered during the Season. | |||
The Old Man's Determination | Quest | Complete all of the Leathersmith's quests offered during the Season. | |||
Lifelong Regrets | Quest | Complete all of the Armourer's quests offered during the Season. | |||
Fabric of Trust | Quest | Complete all of the Tailor's quests offered during the Season. | |||
A Friend of the Forge | Quest | Complete all of the Weaponsmith's quests offered during the Season. | |||
Bonding Roots | Quest | Complete all of the Woodsman's quests offered during the Season. | |||
A Younger Brother's Tale | Quest | Complete all of the Surgeon's quests offered during the Season. | |||
An Older Brother's Tale | Quest | Complete all of the Alchemist's quests offered during the Season. | |||
Seeker of Secrets | Quest | Complete all of the Fortune Teller's quests offered during the Season. | |||
Friends in High Places | Merchant | Raise the affinity of any merchant to "Friendly" grade or higher. | |||
Crafting Initiate | Merchant | Successfully craft your first item. | |||
Crafting Virtuoso | Merchant | Crafting Initiate | Successfully craft 10 times. | ||
Stackin' Up | Merchant | Craft a Gold Coin Pouch. | |||
Bag It Up | Merchant | Craft a Gold Coin Bag. | |||
Not Today | Community | Use the Altar of Sacrifice for the first time. | |||
Devote your hearts! | Community | Not Today | Use the Altar of Sacrifice 10 times. | ||
The Eternal Reviver | Community | Devote your hearts! | Use the Altar of Sacrifice 100 times. | ||
Cane Collector | Event | Winter Holiday | Collect 10 Candy Canes of Looted state. | ||
King of Canes | Event | Winter Holiday | Cane Collector | Collect 100 Candy Canes of Looted state. |
Example of hidden achievements only
<table class="wikitable mw-collapsible mw-collapsed"> <tr> <th>Name</th> <th>Icon</th> <th>Category</th> <th>Sub-Category</th> <th>Pre-requisite</th> <th>Description</th> </tr> {{#invoke:Achievements|create_achievements_table_body|hidden}} </table>
Name | Icon | Category | Sub-Category | Pre-requisite | Description |
---|
local p = {}
local achievements = mw.loadJsonData("Data:Achievements.json")
function p.create_achievements_table_body(frame)
local hidden_or_nonhidden = frame.args[1]
if hidden_or_nonhidden == nil then
hidden_or_nonhidden = "nonhidden"
else
hidden_or_nonhidden = "hidden"
end
local html = ""
local record
for index, achievement in ipairs(achievements) do
-- Ensure only the hidden or nonhidden are shown depending on parameter
is_hidden = achievement.hidden or false
if (is_hidden and hidden_or_nonhidden == "nonhidden") or
(not is_hidden and hidden_or_nonhidden == "hidden") then
break
end
record = "<tr>\n"
record = record .. "<td>" .. (achievement.localized_name) .. "</td>\n"
record = record .. "<td>" .. (achievement.main_category or '') .. "</td>\n"
record = record .. "<td>" .. (achievement.sub_category or '') .. "</td>\n"
record = record .. "<td>" .. (achievement.prerequisite or '') .. "</td>\n"
record = record .. "<td>" .. (achievement.description) .. "</td>\n"
record = record .. "</tr>\n"
html = html .. record .. "\n"
end
return mw.getCurrentFrame():preprocess(html)
end
return p