From Dark and Darker Wiki

m (attempt to fix reading of is_hidden)
m (add icon next to sub_category)
Line 29: Line 29:
record = record .. "<td>" .. (achievement.localized_name) .. "</td>\n"
record = record .. "<td>" .. (achievement.localized_name) .. "</td>\n"
record = record .. "<td>" .. (achievement.main_category or '') .. "</td>\n"
record = record .. "<td>" .. (achievement.main_category or '') .. "</td>\n"
record = record .. "<td>" .. (achievement.sub_category or '') .. "</td>\n"
record = record .. "<td>" .. (achievement.sub_category or '') .. "[[File:" .. achievement.icon .. ".png|15px]]" .. "</td>\n"
record = record .. "<td>" .. (achievement.prerequisite or '') .. "</td>\n"
record = record .. "<td>" .. (achievement.prerequisite or '') .. "</td>\n"
record = record .. "<td>" .. (achievement.description) .. "</td>\n"
record = record .. "<td>" .. (achievement.description) .. "</td>\n"

Revision as of 04:21, 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 Icon Achievement Level.png Reach level 5 on any character.
Dungeon Delver Classes Icon Achievement Level.png Crawl Into Darkness Reach level 10 on any character.
Journeyman Explorer Classes Icon Achievement Level.png Dungeon Delver Reach level 20 on any character.
Veteran Adventurer Classes Icon Achievement Level.png Journeyman Explorer Reach level 50 on any character.
Herald of the Depths Classes Icon Achievement Level.png Veteran Adventurer Reach level 100 on any character.
Warden of the Damned Classes Icon Achievement Level.png Herald of the Depths Reach level 200 on any character.
Crown of Despair Classes Icon Achievement Level.png Warden of the Damned Reach level 300 on any character.
Fully Equipped Classes Icon Achievement SetPerks.png Fill every perk slot.
Fighter Initiate Classes FighterIcon Achievement Fighter.png Reach level 20 as a Fighter.
Sword for Hire Classes FighterIcon Achievement Fighter.png Fighter Initiate Reach level 100 as a Fighter.
Weapon Master Classes FighterIcon Achievement Fighter.png Sword for Hire Reach level 200 as a Fighter.
Champion of Arms Classes FighterIcon Achievement Fighter.png Weapon Master Reach level 300 as a Fighter.
Barbarian Whelp Classes BarbarianIcon Achievement Barbarian.png Reach level 20 as a Barbarian.
Barbarian Brute Classes BarbarianIcon Achievement Barbarian.png Barbarian Whelp Reach level 100 as a Barbarian.
Savage Barbarian Classes BarbarianIcon Achievement Barbarian.png Barbarian Brute Reach level 200 as a Barbarian.
Barbarian Chieftain Classes BarbarianIcon Achievement Barbarian.png Savage Barbarian Reach level 300 as a Barbarian.
Novice Rogue Classes RogueIcon Achievement Rogue.png Reach level 20 as a Rogue.
Seasoned Rogue Classes RogueIcon Achievement Rogue.png Novice Rogue Reach level 100 as a Rogue.
Veteran of Deception Classes RogueIcon Achievement Rogue.png Seasoned Rogue Reach level 200 as a Rogue.
Master Thief Classes RogueIcon Achievement Rogue.png Veteran of Deception Reach level 300 as a Rogue.
Apprentice Ranger Classes RangerIcon Achievement Ranger.png Reach level 20 as a Ranger.
Bow Bearer Classes RangerIcon Achievement Ranger.png Apprentice Ranger Reach level 100 as a Ranger.
Veteran Hunter Classes RangerIcon Achievement Ranger.png Bow Bearer Reach level 200 as a Ranger.
Eagle Eye Classes RangerIcon Achievement Ranger.png Veteran Hunter Reach level 300 as a Ranger.
Novice Spellcaster Classes WizardIcon Achievement Wizard.png Reach level 20 as a Wizard.
Adept Mystic Classes WizardIcon Achievement Wizard.png Novice Spellcaster Reach level 100 as a Wizard.
Archmage Classes WizardIcon Achievement Wizard.png Adept Mystic Reach level 200 as a Wizard.
Master Magus Classes WizardIcon Achievement Wizard.png Archmage Reach level 300 as a Wizard.
Acolyte of Light Classes ClericIcon Achievement Cleric.png Reach level 20 as a Cleric.
Adept Clinician Classes ClericIcon Achievement Cleric.png Acolyte of Light Reach level 100 as a Cleric.
Archpriest Classes ClericIcon Achievement Cleric.png Adept Clinician Reach level 200 as a Cleric.
Divine Crusader Classes ClericIcon Achievement Cleric.png Archpriest Reach level 300 as a Cleric.
Minstrel of Melody Classes BardIcon Achievement Bard.png Reach level 20 as a Bard.
Adept Troubadour Classes BardIcon Achievement Bard.png Minstrel of Melody Reach level 100 as a Bard.
Songweaver Classes BardIcon Achievement Bard.png Adept Troubadour Reach level 200 as a Bard.
Balladeer Maestro Classes BardIcon Achievement Bard.png Songweaver Reach level 300 as a Bard.
Coven Initiate Classes WarlockIcon Achievement Warlock.png Reach level 20 as a Warlock.
Conduit of Blood Classes WarlockIcon Achievement Warlock.png Coven Initiate Reach level 100 as a Warlock.
Dark Disciple Classes WarlockIcon Achievement Warlock.png Conduit of Blood Reach level 200 as a Warlock.
Elder of the Pact Classes WarlockIcon Achievement Warlock.png Dark Disciple Reach level 300 as a Warlock.
Keeper of Sprouts Classes DruidIcon Achievement Druid.png Reach level 20 as a Druid.
Adept Shapeshifter Classes DruidIcon Achievement Druid.png Keeper of Sprouts Reach level 100 as a Druid.
Nature's Emissary Classes DruidIcon Achievement Druid.png Adept Shapeshifter Reach level 200 as a Druid.
Avatar of the Grove Classes DruidIcon Achievement Druid.png Nature's Emissary Reach level 300 as a Druid.
Sorcerer's Apprentice Classes SorcererIcon Achievement Sorcerer.png Reach level 20 as a Sorcerer.
Master Caster Classes SorcererIcon Achievement Sorcerer.png Sorcerer's Apprentice Reach level 100 as a Sorcerer.
Power Overwhelming Classes SorcererIcon Achievement Sorcerer.png Master Caster Reach level 200 as a Sorcerer.
Sorcerer Supreme Classes SorcererIcon Achievement Sorcerer.png Power Overwhelming Reach level 300 as a Sorcerer.
Light at the End Dungeon EscapeIcon Achievement Escape.png Successfully escape for the first time.
Run It Back Dungeon EscapeIcon Achievement Escape.png Light at the End Successfully escape twice.
The Quick and the Dead Dungeon EscapeIcon Achievement Escape.png Run It Back Successfully escape 10 times.
Edge of Escape Dungeon EscapeIcon Achievement Escape.png The Quick and the Dead Successfully escape 100 times.
Painted in Red Dungeon MonsterIcon Achievement EliteMonster.png Kill any Elite monster.
The Nightmare Ends Dungeon MonsterIcon Achievement NightmareMonster.png Kill any Nightmare monster.
Crowned with Ash Dungeon MonsterIcon Achievement BossMonster.png Kill any Boss monster.
Court Wizard's Demise Dungeon MonsterIcon Achievement Lich.png Kill the Lich.
Banished Beyond Dungeon MonsterIcon Achievement GhostKing.png Kill the Ghost King.
Breaker of Bone Thrones Dungeon MonsterIcon Achievement SkeletonWarload.png Kill the Skeleton Warlord.
The Bigger They Are, The Harder They Fall Dungeon MonsterIcon Achievement Troll.png Kill the Cave Troll.
Eye for an Eye Dungeon MonsterIcon Achievement Cyclops.png Kill the Cyclops.
Cold Case Closed Dungeon MonsterIcon Achievement Wyvern.png Kill the Frost Wyvern.
Silence the Specter Dungeon MonsterIcon Achievement SpectralKnight.png Kill the Spectral Knight.
She Screams No More Dungeon MonsterIcon Achievement Banshee.png Kill the Banshee.
Undead Slayer Dungeon MonsterIcon Achievement UndeadSlayer.png Kill 1000 undead enemies.
Demon Slayer Dungeon MonsterIcon Achievement DemonSlayer.png Kill 1000 demonic enemies.
Beast Slayer Dungeon MonsterIcon Achievement BeastSlayer.png Kill 1000 beast-type enemies.
Insect Slayer Dungeon MonsterIcon Achievement InsectSlayer.png Kill 1000 insectoid enemies.
Goblin Slayer Dungeon MonsterIcon Achievement GoblinSlayer.png Kill 1000 goblins.
Kobold Slayer Dungeon MonsterIcon Achievement KoboldSlayer.png Kill 1000 kobolds.
Giant Slayer Dungeon MonsterIcon Achievement GiantSlayer.png Kill 1000 giants.
A Quick Fix Dungeon ConsumableIcon Achievement Bandage.png Use 10 Bandages.
Field Medic Dungeon ConsumableIcon Achievement Bandage.png A Quick Fix Use 50 Bandages.
Master of Mending Dungeon ConsumableIcon Achievement Bandage.png Field Medic Use 100 Bandages.
First Sip Dungeon ConsumableIcon Achievement Potion.png Use 10 Potions of Healing.
Potion Lover Dungeon ConsumableIcon Achievement Potion.png First Sip Use 50 Potions of Healing.
Elixir Addict Dungeon ConsumableIcon Achievement Potion.png Potion Lover Use 100 Potions of Healing.
Steady Hand Dungeon ConsumableIcon Achievement SurgicalKit.png Use 10 Surgical Kits.
Trauma Technician Dungeon ConsumableIcon Achievement SurgicalKit.png Steady Hand Use 100 Surgical Kits.
Sparks of Survival Dungeon ConsumableIcon Achievement Campfire.png Use 10 Campfire Kits.
Fire Starter Dungeon ConsumableIcon Achievement Campfire.png Sparks of Survival Use 100 Campfire Kits.
The First Cut Dungeon ChallengeIcon Achievement KillPlayer.png Kill an enemy player for the first time.
Keeper of the Eternal's Fall High-Roller MonsterIcon Achievement LichHR.png Kill the Lich in High-Roller.
Kingbreaker High-Roller MonsterIcon Achievement GhostKingHR.png Kill the Ghost King in High-Roller.
Deliverer of Judgment High-Roller MonsterIcon Achievement SkeletonWarloadHR.png Kill the Skeleton Warlord in High-Roller.
Crusher of the Colossus High-Roller MonsterIcon Achievement TrollHR.png Kill the Cave Troll in High-Roller.
Bringer of Blindness High-Roller MonsterIcon Achievement CyclopsHR.png Kill the Cyclops in High-Roller.
Cold-Blooded Killer High-Roller MonsterIcon Achievement WyvernHR.png Kill the Frost Wyvern in High-Roller.
Chivalry Shattered High-Roller MonsterIcon Achievement SpectralKnightHR.png Kill the Spectral Knight in High-Roller.
The Last Wail High-Roller MonsterIcon Achievement BansheeHR.png Kill the Banshee in High-Roller.
Gravebound No More High-Roller High-Roller RankIcon Achievement RankNeophyte.png Reach the Neophyte rank in High-Roller.
Apprentice of the Abyss High-Roller High-Roller RankIcon Achievement RankApprentice.png Reach the Apprentice rank in High-Roller.
A Curious Wanderer High-Roller High-Roller RankIcon Achievement RankWanderer.png Reach the Wanderer rank in High-Roller.
Trailblazer High-Roller High-Roller RankIcon Achievement RankPathfinder.png Reach the Pathfinder rank in High-Roller.
Herald of Paths High-Roller High-Roller RankIcon Achievement RankVoyager.png Reach the Voyager rank in High-Roller.
Paragon of Excellence High-Roller High-Roller RankIcon Achievement RankExemplar.png Reach the Exemplar rank in High-Roller.
Mortal No More High-Roller High-Roller RankIcon Achievement RankDemigod.png Reach the Demigod rank in High-Roller.
First Blood Arena Icon Achievement WinningArena.png Win an Arena match for the first time.
Rising Challenger Arena Icon Achievement WinningArena.png First Blood Win an Arena match 10 times.
Bloodstained Champion Arena Icon Achievement WinningArena.png Rising Challenger Win an Arena match 50 times.
Legend of the Arena Arena Icon Achievement WinningArena.png Bloodstained Champion Win an Arena match 100 times.
Lucky Streak Arena Icon Achievement ConsecutiveArena.png Win in the Arena 2 times consecutively.
You're on Fire Arena Icon Achievement ConsecutiveArena.png Lucky Streak Win in the Arena 5 times consecutively.
Unstoppable Arena Icon Achievement ConsecutiveArena.png You're on Fire Win in the Arena 10 times consecutively.
Relentless Executioner Arena Icon Achievement ConsecutiveArena.png Unstoppable Win in the Arena 20 times consecutively.
Fresh Meat Arena Arena RankIcon Achievement ArenaRankTiro.png Reach the Tiro rank in Arena.
Pit Scrapper Arena Arena RankIcon Achievement ArenaRankScrapper.png Reach the Scrapper rank in Arena.
Gladiator Arena Arena RankIcon Achievement ArenaRankGladiator.png Reach the Gladiator rank in Arena.
Veteran of the Pit Arena Arena RankIcon Achievement ArenaRankVeteran.png Reach the Veteran rank in Arena.
Contending Challenger Arena Arena RankIcon Achievement ArenaRankContender.png Reach the Contender rank in Arena.
The Crimson Vanquisher Arena Arena RankIcon Achievement ArenaRankVanquisher.png Reach the Vanquisher rank in Arena.
Rise of the Warlord Arena Arena RankIcon Achievement ArenaRankWarload.png Reach the Warlords rank in Arena.
It's a Start... Item GearIcon Achievement EquipItemGrade.png Equip Uncommon grade items or higher in your main slots.
Fit Check Item GearIcon Achievement EquipItemGrade.png Equip Rare grade items or higher in your main slots.
Nice Threads Item GearIcon Achievement EquipItemGrade.png Equip Epic grade items or higher in your main slots.
Flawless Drip Item GearIcon Achievement EquipItemGrade.png Equip Legendary grade items or higher in your main slots.
Dagger Wielder Item GearIcon Achievement KillDagger.png Kill 100 enemies with a Dagger type weapon.
Dagger Expert Item GearIcon Achievement KillDagger.png Dagger Wielder Kill 500 enemies with a Dagger type weapon.
Bloodletter Item GearIcon Achievement KillDagger.png Dagger Expert Kill 1000 enemies with a Dagger type weapon.
Sword Wielder Item GearIcon Achievement KillSword.png Kill 100 enemies with a Sword type weapon.
Sword Expert Item GearIcon Achievement KillSword.png Sword Wielder Kill 500 enemies with a Sword type weapon.
Blade of Woe Item GearIcon Achievement KillSword.png Sword Expert Kill 1000 enemies with a Sword type weapon.
Axe Wielder Item GearIcon Achievement KillAxe.png Kill 100 enemies with a Axe type weapon.
Axe Expert Item GearIcon Achievement KillAxe.png Axe Wielder Kill 500 enemies with a Axe type weapon.
Bone Cutter Item GearIcon Achievement KillAxe.png Axe Expert Kill 1000 enemies with a Axe type weapon.
Mace Wielder Item GearIcon Achievement KillMace.png Kill 100 enemies with a Mace type weapon.
Mace Expert Item GearIcon Achievement KillMace.png Mace Wielder Kill 500 enemies with a Mace type weapon.
Deliverer of Justice Item GearIcon Achievement KillMace.png Mace Expert Kill 1000 enemies with a Mace type weapon.
Polearm Wielder Item GearIcon Achievement KillPolearm.png Kill 100 enemies with a Polearm type weapon.
Polearm Expert Item GearIcon Achievement KillPolearm.png Polearm Wielder Kill 500 enemies with a Polearm type weapon.
Spear of Judgment Item GearIcon Achievement KillPolearm.png Polearm Expert Kill 1000 enemies with a Polearm type weapon.
Staff Wielder Item GearIcon Achievement KillStaff.png Kill 100 enemies with a Staff type weapon.
Staff Expert Item GearIcon Achievement KillStaff.png Staff Wielder Kill 500 enemies with a Staff type weapon.
Arcane Arbiter Item GearIcon Achievement KillStaff.png Staff Expert Kill 1000 enemies with a Staff type weapon.
Bow Wielder Item GearIcon Achievement KillBow.png Kill 100 enemies with a Bow type weapon.
Bow Expert Item GearIcon Achievement KillBow.png Bow Wielder Kill 500 enemies with a Bow type weapon.
Deadeye Item GearIcon Achievement KillBow.png Bow Expert Kill 1000 enemies with a Bow type weapon.
Crossbow Wielder Item GearIcon Achievement KillCrossbow.png Kill 100 enemies with a Crossbow type weapon.
Crossbow Expert Item GearIcon Achievement KillCrossbow.png Crossbow Wielder Kill 500 enemies with a Crossbow type weapon.
Trigger Finger Item GearIcon Achievement KillCrossbow.png Crossbow Expert Kill 1000 enemies with a Crossbow type weapon.
Coin Snatcher Item LootIcon Achievement LootedCoins.png Collect 100 Gold Coins in the Dungeon.
Gold Hoarder Item LootIcon Achievement LootedCoins.png Coin Snatcher Collect 1000 Gold Coins in the Dungeon.
Wealth Enthusiast Item LootIcon Achievement LootedCoins.png Gold Hoarder Collect 10000 Gold Coins in the Dungeon.
Plunderer Item LootIcon Achievement InteractHoard.png Interact with a treasure hoard.
Prospect Miner Item LootIcon Achievement Mining.png Succeed in mining 10 times.
King of the Quarry Item LootIcon Achievement Mining.png Prospect Miner Succeed in mining 100 times.
Gold Digger Item LootIcon Achievement GoldOre.png Succeed mining for Gold Ore.
Lobster Bait Item LootIcon Achievement RubysilverOre.png Succeed mining for Rubysilver Ore.
Iced Out Item LootIcon Achievement FroststoneOre.png Succeed mining for Froststone Ore.
Epic Spoils Item LootIcon Achievement LootedItemGrade.png Collect Epic grade items of Looted state.
Legendary Bounty Item LootIcon Achievement LootedItemGrade.png Collect Legendary grade items of Looted state.
Uniquely Yours Item LootIcon Achievement LootedItemGrade.png Collect Unique grade items of Looted state.
A Barrel of Stories Quest Icon Achievement QuestComplete.png Complete all of the Tavern Master's quests offered during the Season.
The Fortune's End Quest Icon Achievement QuestComplete.png Complete all of the Treasurer's quests offered during the Season.
Connoisseur of Curiosities Quest Icon Achievement QuestComplete.png Complete all of the Collector's quests offered during the Season.
Gobbo's Favorite Fleshy Quest Icon Achievement QuestCompleteGoblin.png Complete all of the Goblin Merchant's quests offered during the Season.
The Old Man's Determination Quest Icon Achievement QuestComplete.png Complete all of the Leathersmith's quests offered during the Season.
Lifelong Regrets Quest Icon Achievement QuestComplete.png Complete all of the Armourer's quests offered during the Season.
Fabric of Trust Quest Icon Achievement QuestComplete.png Complete all of the Tailor's quests offered during the Season.
A Friend of the Forge Quest Icon Achievement QuestComplete.png Complete all of the Weaponsmith's quests offered during the Season.
Bonding Roots Quest Icon Achievement QuestComplete.png Complete all of the Woodsman's quests offered during the Season.
A Younger Brother's Tale Quest Icon Achievement QuestComplete.png Complete all of the Surgeon's quests offered during the Season.
An Older Brother's Tale Quest Icon Achievement QuestComplete.png Complete all of the Alchemist's quests offered during the Season.
Seeker of Secrets Quest Icon Achievement QuestComplete.png Complete all of the Fortune Teller's quests offered during the Season.
Friends in High Places Merchant Icon Achievement FriendlyAffinity.png Raise the affinity of any merchant to "Friendly" grade or higher.
Crafting Initiate Merchant Icon Achievement Crafting.png Successfully craft your first item.
Crafting Virtuoso Merchant Icon Achievement Crafting.png Crafting Initiate Successfully craft 10 times.
Stackin' Up Merchant Icon Achievement GoldCoinPouch.png Craft a Gold Coin Pouch.
Bag It Up Merchant Icon Achievement GoldCoinBag.png Craft a Gold Coin Bag.
Not Today Community Icon Achievement AltarOfSacrifice.png Use the Altar of Sacrifice for the first time.
Devote your hearts! Community Icon Achievement AltarOfSacrifice.png Not Today Use the Altar of Sacrifice 10 times.
The Eternal Reviver Community Icon Achievement AltarOfSacrifice.png Devote your hearts! Use the Altar of Sacrifice 100 times.
Cane Collector Event Winter HolidayIcon Achievement CollectCandyCane.png Collect 10 Candy Canes of Looted state.
King of Canes Event Winter HolidayIcon Achievement CollectCandyCane.png Cane Collector Collect 100 Candy Canes of Looted state.
The Forbidden Pear Feat Icon Achievement HoneyblissPear.png Collect a Honeybliss Pear of Looted state.
Baked for the Taking Feat Icon Achievement ChocolateChipMuffin.png Collect a Chocolate Chip Muffin of Looted state.
Beginning of the End Feat Icon Achievement MidnightStag.png Kill the Midnight Stag.




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"
	elseif hidden_or_nonhidden ~= "nonhidden" then
		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
		local is_hidden
		if achievement.hidden == 'true' then
			is_hidden = true
		else
			is_hidden = false
		end
		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 '') .. "[[File:" .. achievement.icon .. ".png|15px]]" .. "</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