From Dark and Darker Wiki

Sur (talk | contribs)
m testing again
Sur (talk | contribs)
m testing is_hidden more
Line 16: Line 16:
-- Ensure only the hidden or nonhidden are shown depending on parameter
-- Ensure only the hidden or nonhidden are shown depending on parameter
local is_hidden
local is_hidden
if achievement.hidden == 'true' then
if achievement.hidden == 'true' or achievement.hidden == true then
is_hidden = true
is_hidden = true
else
else

Revision as of 04:31, 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.false
Dungeon Delver Classes Crawl Into Darkness Reach level 10 on any character.false
Journeyman Explorer Classes Dungeon Delver Reach level 20 on any character.false
Veteran Adventurer Classes Journeyman Explorer Reach level 50 on any character.false
Herald of the Depths Classes Veteran Adventurer Reach level 100 on any character.false
Warden of the Damned Classes Herald of the Depths Reach level 200 on any character.false
Crown of Despair Classes Warden of the Damned Reach level 300 on any character.false
Fully Equipped Classes Fill every perk slot.false
Fighter Initiate Classes Fighter Reach level 20 as a Fighter.false
Sword for Hire Classes Fighter Fighter Initiate Reach level 100 as a Fighter.false
Weapon Master Classes Fighter Sword for Hire Reach level 200 as a Fighter.false
Champion of Arms Classes Fighter Weapon Master Reach level 300 as a Fighter.false
Barbarian Whelp Classes Barbarian Reach level 20 as a Barbarian.false
Barbarian Brute Classes Barbarian Barbarian Whelp Reach level 100 as a Barbarian.false
Savage Barbarian Classes Barbarian Barbarian Brute Reach level 200 as a Barbarian.false
Barbarian Chieftain Classes Barbarian Savage Barbarian Reach level 300 as a Barbarian.false
Novice Rogue Classes Rogue Reach level 20 as a Rogue.false
Seasoned Rogue Classes Rogue Novice Rogue Reach level 100 as a Rogue.false
Veteran of Deception Classes Rogue Seasoned Rogue Reach level 200 as a Rogue.false
Master Thief Classes Rogue Veteran of Deception Reach level 300 as a Rogue.false
Apprentice Ranger Classes Ranger Reach level 20 as a Ranger.false
Bow Bearer Classes Ranger Apprentice Ranger Reach level 100 as a Ranger.false
Veteran Hunter Classes Ranger Bow Bearer Reach level 200 as a Ranger.false
Eagle Eye Classes Ranger Veteran Hunter Reach level 300 as a Ranger.false
Novice Spellcaster Classes Wizard Reach level 20 as a Wizard.false
Adept Mystic Classes Wizard Novice Spellcaster Reach level 100 as a Wizard.false
Archmage Classes Wizard Adept Mystic Reach level 200 as a Wizard.false
Master Magus Classes Wizard Archmage Reach level 300 as a Wizard.false
Acolyte of Light Classes Cleric Reach level 20 as a Cleric.false
Adept Clinician Classes Cleric Acolyte of Light Reach level 100 as a Cleric.false
Archpriest Classes Cleric Adept Clinician Reach level 200 as a Cleric.false
Divine Crusader Classes Cleric Archpriest Reach level 300 as a Cleric.false
Minstrel of Melody Classes Bard Reach level 20 as a Bard.false
Adept Troubadour Classes Bard Minstrel of Melody Reach level 100 as a Bard.false
Songweaver Classes Bard Adept Troubadour Reach level 200 as a Bard.false
Balladeer Maestro Classes Bard Songweaver Reach level 300 as a Bard.false
Coven Initiate Classes Warlock Reach level 20 as a Warlock.false
Conduit of Blood Classes Warlock Coven Initiate Reach level 100 as a Warlock.false
Dark Disciple Classes Warlock Conduit of Blood Reach level 200 as a Warlock.false
Elder of the Pact Classes Warlock Dark Disciple Reach level 300 as a Warlock.false
Keeper of Sprouts Classes Druid Reach level 20 as a Druid.false
Adept Shapeshifter Classes Druid Keeper of Sprouts Reach level 100 as a Druid.false
Nature's Emissary Classes Druid Adept Shapeshifter Reach level 200 as a Druid.false
Avatar of the Grove Classes Druid Nature's Emissary Reach level 300 as a Druid.false
Sorcerer's Apprentice Classes Sorcerer Reach level 20 as a Sorcerer.false
Master Caster Classes Sorcerer Sorcerer's Apprentice Reach level 100 as a Sorcerer.false
Power Overwhelming Classes Sorcerer Master Caster Reach level 200 as a Sorcerer.false
Sorcerer Supreme Classes Sorcerer Power Overwhelming Reach level 300 as a Sorcerer.false
Light at the End Dungeon Escape Successfully escape for the first time.false
Run It Back Dungeon Escape Light at the End Successfully escape twice.false
The Quick and the Dead Dungeon Escape Run It Back Successfully escape 10 times.false
Edge of Escape Dungeon Escape The Quick and the Dead Successfully escape 100 times.false
Piece of Cake Dungeon Escape Edge of Escape Successfully escape 1000 times.false
Delighter in Darkness Dungeon Escape Piece of Cake Successfully escape 10000 times.false
Painted in Red Dungeon Monster Kill any Elite monster.false
Familiar Red Dungeon Monster Painted in Red Kill 10 Elite monsters.false
Who's Red Now? Dungeon Monster Familiar Red Kill 100 Elite monsters.false
The Nightmare Ends Dungeon Monster Kill any Nightmare monster.false
Endless Night Dungeon Monster The Nightmare Ends Kill 10 Nightmare monsters.false
Eternal Nightmare Dungeon Monster Endless Night Kill 100 Nightmare monsters.false
Crowned with Ash Dungeon Monster Kill any Boss monster.false
Court Wizard's Demise Dungeon Monster Kill the Lich.false
Banished Beyond Dungeon Monster Kill the Ghost King.false
Breaker of Bone Thrones Dungeon Monster Kill the Skeleton Warlord.false
The Bigger They Are, The Harder They Fall Dungeon Monster Kill the Cave Troll.false
Eye for an Eye Dungeon Monster Kill the Cyclops.false
Cold Case Closed Dungeon Monster Kill the Frost Wyvern.false
Silence the Specter Dungeon Monster Kill the Spectral Knight.false
She Screams No More Dungeon Monster Kill the Banshee.false
Ancient No More Dungeon Monster Kill the Ancient Stingray.false
Fall of the Pirate King Dungeon Monster Kill the Bladehand.false
Undead Slayer Dungeon Monster Kill 1000 undead enemies.false
Bane of the Undead Dungeon Monster Undead Slayer Kill 5000 undead enemies.false
Scourge of the Undead Dungeon Monster Bane of the Undead Kill 10000 undead enemies.false
Demon Slayer Dungeon Monster Kill 1000 demonic enemies.false
Bane of the Demons Dungeon Monster Demon Slayer Kill 5000 demonic enemies.false
Scourge of the Demons Dungeon Monster Bane of the Demons Kill 10000 demonic enemies.false
Beast Slayer Dungeon Monster Kill 1000 beast-type enemies.false
Bane of the Beasts Dungeon Monster Beast Slayer Kill 5000 beast-type enemies.false
Scourge of the Beasts Dungeon Monster Bane of the Beasts Kill 10000 beast-type enemies.false
Insect Slayer Dungeon Monster Kill 1000 insectoid enemies.false
Bane of the Insects Dungeon Monster Insect Slayer Kill 5000 insectoid enemies.false
Scourge of the Insects Dungeon Monster Bane of the Insects Kill 10000 insectoid enemies.false
Goblin Slayer Dungeon Monster Kill 1000 goblins.false
Bane of the Goblins Dungeon Monster Goblin Slayer Kill 5000 goblins.false
Scourge of the Goblins Dungeon Monster Bane of the Goblins Kill 10000 goblins.false
Kobold Slayer Dungeon Monster Kill 1000 kobolds.false
Bane of the Kobolds Dungeon Monster Kobold Slayer Kill 5000 kobolds.false
Scourge of the Kobolds Dungeon Monster Bane of the Kobolds Kill 10000 kobolds.false
Giant Slayer Dungeon Monster Kill 1000 giants.false
Bane of the Giants Dungeon Monster Giant Slayer Kill 5000 giants.false
Scourge of the Giants Dungeon Monster Bane of the Giants Kill 10000 giants.false
Tidewalker Slayer Dungeon Monster Kill 1000 Tidewalkers.false
Bane of the Tidewalkers Dungeon Monster Tidewalker Slayer Kill 5000 Tidewalkers.false
Scourge of the Tidewalkers Dungeon Monster Bane of the Tidewalkers Kill 10000 Tidewalkers.false
Pirate Slayer Dungeon Monster Kill 1000 Humans.false
Bane of the Pirates Dungeon Monster Pirate Slayer Kill 5000 Humans.false
Scourge of the Pirates Dungeon Monster Bane of the Pirates Kill 10000 Humans.false
A Quick Fix Dungeon Consumable Use 10 Bandages.false
Field Medic Dungeon Consumable A Quick Fix Use 50 Bandages.false
Master of Mending Dungeon Consumable Field Medic Use 100 Bandages.false
First Sip Dungeon Consumable Use 10 Potions of Healing.false
Potion Lover Dungeon Consumable First Sip Use 50 Potions of Healing.false
Elixir Addict Dungeon Consumable Potion Lover Use 100 Potions of Healing.false
Steady Hand Dungeon Consumable Use 10 Surgical Kits.false
Trauma Technician Dungeon Consumable Steady Hand Use 100 Surgical Kits.false
Sparks of Survival Dungeon Consumable Use 10 Campfire Kits.false
Fire Starter Dungeon Consumable Sparks of Survival Use 100 Campfire Kits.false
The First Cut Dungeon Challenge Kill an enemy player for the first time.false
Nameless Assassin of the Cave Dungeon Challenge Kill 10 enemy players in The Goblin Cave.false
Blood-Stained Cave Dungeon Challenge Nameless Assassin of the Cave Kill 50 enemy players in The Goblin Cave.false
Goblin Cave's Most Wanted Dungeon Challenge Blood-Stained Cave Kill 100 enemy players in The Goblin Cave.false
Frozen Peak Manhunter Dungeon Challenge Kill 10 enemy players in Frost Mountain.false
Buried in the Snow Dungeon Challenge Frozen Peak Manhunter Kill 50 enemy players in Frost Mountain.false
Butcher of the Frost Mountain Dungeon Challenge Buried in the Snow Kill 100 enemy players in Frost Mountain.false
Another Ghost For The Castle Dungeon Challenge Kill 10 enemy players in The Forgotten Castle.false
Hall of Silence Dungeon Challenge Another Ghost For The Castle Kill 50 enemy players in The Forgotten Castle.false
Reaper of the Forgotten Castle Dungeon Challenge Hall of Silence Kill 100 enemy players in The Forgotten Castle.false
New Marauder of the Maelstrom Dungeon Challenge Kill 10 enemy players in The Blue Maelstrom.false
Blood-Tinted Waves Dungeon Challenge New Marauder of the Maelstrom Kill 50 enemy players in The Blue Maelstrom.false
Executioner of the Blue Maelstrom Dungeon Challenge Blood-Tinted Waves Kill 100 enemy players in The Blue Maelstrom.false
Keeper of the Eternal's Fall High-Roller Monster Kill the Lich in High-Roller.false
Kingbreaker High-Roller Monster Kill the Ghost King in High-Roller.false
Deliverer of Judgment High-Roller Monster Kill the Skeleton Warlord in High-Roller.false
Crusher of the Colossus High-Roller Monster Kill the Cave Troll in High-Roller.false
Bringer of Blindness High-Roller Monster Kill the Cyclops in High-Roller.false
Cold-Blooded Killer High-Roller Monster Kill the Frost Wyvern in High-Roller.false
Chivalry Shattered High-Roller Monster Kill the Spectral Knight in High-Roller.false
The Last Wail High-Roller Monster Kill the Banshee in High-Roller.false
Devourer of Devourers High-Roller Monster Kill the Ancient Stingray in High-Roller.false
The Pirate Captain's Graveyard High-Roller Monster Kill the Bladehand in High-Roller.false
Gravebound No More High-Roller High-Roller Rank Reach the Neophyte rank in High-Roller.false
Apprentice of the Abyss High-Roller High-Roller Rank Reach the Apprentice rank in High-Roller.false
A Curious Wanderer High-Roller High-Roller Rank Reach the Wanderer rank in High-Roller.false
Trailblazer High-Roller High-Roller Rank Reach the Pathfinder rank in High-Roller.false
Herald of Paths High-Roller High-Roller Rank Reach the Voyager rank in High-Roller.false
Paragon of Excellence High-Roller High-Roller Rank Reach the Exemplar rank in High-Roller.false
Mortal No More High-Roller High-Roller Rank Reach the Demigod rank in High-Roller.false
First Blood Arena Win an Arena match for the first time.false
Rising Challenger Arena First Blood Win an Arena match 10 times.false
Bloodstained Champion Arena Rising Challenger Win an Arena match 50 times.false
Legend of the Arena Arena Bloodstained Champion Win an Arena match 100 times.false
Lucky Streak Arena Win in the Arena 2 times consecutively.false
You're on Fire Arena Lucky Streak Win in the Arena 5 times consecutively.false
Unstoppable Arena You're on Fire Win in the Arena 10 times consecutively.false
Relentless Executioner Arena Unstoppable Win in the Arena 20 times consecutively.false
Fresh Meat Arena Arena Rank Reach the Tiro rank in Arena.false
Pit Scrapper Arena Arena Rank Reach the Scrapper rank in Arena.false
Gladiator Arena Arena Rank Reach the Gladiator rank in Arena.false
Veteran of the Pit Arena Arena Rank Reach the Veteran rank in Arena.false
Contending Challenger Arena Arena Rank Reach the Contender rank in Arena.false
The Crimson Vanquisher Arena Arena Rank Reach the Vanquisher rank in Arena.false
Rise of the Warlord Arena Arena Rank Reach the Warlords rank in Arena.false
The First of Many Arena Kill Player Kill 10 enemy players in Arena.false
Bloodied Challenger Arena Kill Player The First of Many Kill 20 enemy players in Arena.false
Arena Executioner Arena Kill Player Bloodied Challenger Kill 50 enemy players in Arena.false
The Arena Bleeds Arena Kill Player Arena Executioner Kill 100 enemy players in Arena.false
Bloodthirsty Arena Kill Player The Arena Bleeds Kill 500 enemy players in Arena.false
River of Red Arena Kill Player Bloodthirsty Kill 1000 enemy players in Arena.false
It's a Start... Item Gear Equip Uncommon grade items or higher in your main slots.false
Fit Check Item Gear Equip Rare grade items or higher in your main slots.false
Nice Threads Item Gear Equip Epic grade items or higher in your main slots.false
Flawless Drip Item Gear Equip Legendary grade items or higher in your main slots.false
Dagger Wielder Item Gear Kill 100 enemies with a Dagger type weapon.false
Dagger Expert Item Gear Dagger Wielder Kill 500 enemies with a Dagger type weapon.false
Bloodletter Item Gear Dagger Expert Kill 1000 enemies with a Dagger type weapon.false
Phantom Dagger Item Gear Bloodletter Kill 10000 enemies with a Dagger type weapon.false
Sword Wielder Item Gear Kill 100 enemies with a Sword type weapon.false
Sword Expert Item Gear Sword Wielder Kill 500 enemies with a Sword type weapon.false
Blade of Woe Item Gear Sword Expert Kill 1000 enemies with a Sword type weapon.false
Blade of Euphoria Item Gear Blade of Woe Kill 10000 enemies with a Sword type weapon.false
Axe Wielder Item Gear Kill 100 enemies with a Axe type weapon.false
Axe Expert Item Gear Axe Wielder Kill 500 enemies with a Axe type weapon.false
Bone Cutter Item Gear Axe Expert Kill 1000 enemies with a Axe type weapon.false
Bone Crusher Item Gear Bone Cutter Kill 10000 enemies with a Axe type weapon.false
Mace Wielder Item Gear Kill 100 enemies with a Mace type weapon.false
Mace Expert Item Gear Mace Wielder Kill 500 enemies with a Mace type weapon.false
Deliverer of Justice Item Gear Mace Expert Kill 1000 enemies with a Mace type weapon.false
Resolute Leader Item Gear Deliverer of Justice Kill 10000 enemies with a Mace type weapon.false
Polearm Wielder Item Gear Kill 100 enemies with a Polearm type weapon.false
Polearm Expert Item Gear Polearm Wielder Kill 500 enemies with a Polearm type weapon.false
Spear of Judgment Item Gear Polearm Expert Kill 1000 enemies with a Polearm type weapon.false
Spear of Destruction Item Gear Spear of Judgment Kill 10000 enemies with a Polearm type weapon.false
Staff Wielder Item Gear Kill 100 enemies with a Staff type weapon.false
Staff Expert Item Gear Staff Wielder Kill 500 enemies with a Staff type weapon.false
Arcane Arbiter Item Gear Staff Expert Kill 1000 enemies with a Staff type weapon.false
Arcane Overlord Item Gear Arcane Arbiter Kill 10000 enemies with a Staff type weapon.false
Bow Wielder Item Gear Kill 100 enemies with a Bow type weapon.false
Bow Expert Item Gear Bow Wielder Kill 500 enemies with a Bow type weapon.false
Deadeye Item Gear Bow Expert Kill 1000 enemies with a Bow type weapon.false
In the Blink of an Eye Item Gear Deadeye Kill 10000 enemies with a Bow type weapon.false
Crossbow Wielder Item Gear Kill 100 enemies with a Crossbow type weapon.false
Crossbow Expert Item Gear Crossbow Wielder Kill 500 enemies with a Crossbow type weapon.false
Trigger Finger Item Gear Crossbow Expert Kill 1000 enemies with a Crossbow type weapon.false
Unstoppable Strike Item Gear Trigger Finger Kill 10000 enemies with a Crossbow type weapon.false
Coin Snatcher Item Loot Collect 100 Gold Coins in the Dungeon.false
Gold Hoarder Item Loot Coin Snatcher Collect 1000 Gold Coins in the Dungeon.false
Wealth Enthusiast Item Loot Gold Hoarder Collect 10000 Gold Coins in the Dungeon.false
Plunderer Item Loot Interact with a treasure hoard.false
Prospect Miner Item Loot Succeed in mining 10 times.false
King of the Quarry Item Loot Prospect Miner Succeed in mining 100 times.false
Gold Digger Item Loot Succeed mining for Gold Ore.false
Lobster Bait Item Loot Succeed mining for Rubysilver Ore.false
Iced Out Item Loot Succeed mining for Froststone Ore.false
Epic Spoils Item Loot Collect Epic grade items of Looted state.false
Legendary Bounty Item Loot Collect Legendary grade items of Looted state.false
Uniquely Yours Item Loot Collect Unique grade items of Looted state.false
A Barrel of Stories Quest Complete all of the Tavern Master's quests offered during the Season.false
The Fortune's End Quest Complete all of the Treasurer's quests offered during the Season.false
Connoisseur of Curiosities Quest Complete all of the Collector's quests offered during the Season.false
Gobbo's Favorite Fleshy Quest Complete all of the Goblin Merchant's quests offered during the Season.false
The Old Man's Determination Quest Complete all of the Leathersmith's quests offered during the Season.false
Lifelong Regrets Quest Complete all of the Armourer's quests offered during the Season.false
Fabric of Trust Quest Complete all of the Tailor's quests offered during the Season.false
A Friend of the Forge Quest Complete all of the Weaponsmith's quests offered during the Season.false
Bonding Roots Quest Complete all of the Woodsman's quests offered during the Season.false
A Younger Brother's Tale Quest Complete all of the Surgeon's quests offered during the Season.false
An Older Brother's Tale Quest Complete all of the Alchemist's quests offered during the Season.false
Seeker of Secrets Quest Complete all of the Fortune Teller's quests offered during the Season.false
Savior of the Squire Quest Complete all of the Squire's quests offered during the Season.false
Artisan's Touch Quest Complete all of the Goldsmith's quests offered during the Season.false
Cockatrice Servant Quest Complete all of the Cockatrice's quests offered during the Season.false
Friends in High Places Merchant Raise the affinity of any merchant to "Friendly" grade or higher.false
Crafting Initiate Merchant Successfully craft your first item.false
Crafting Virtuoso Merchant Crafting Initiate Successfully craft 10 times.false
Apprentice Keysmith Merchant Craft a Lockpick.false
Adept Keysmith Merchant Apprentice Keysmith Craft a Lockpick 10 times.false
Unlocker of All Merchant Adept Keysmith Craft a Lockpick 100 times.false
Stackin' Up Merchant Craft a Gold Coin Pouch.false
Bag It Up Merchant Craft a Gold Coin Bag.false
Not Today Community Use the Altar of Sacrifice for the first time.false
Devote your hearts! Community Not Today Use the Altar of Sacrifice 10 times.false
The Eternal Reviver Community Devote your hearts! Use the Altar of Sacrifice 100 times.false
Cane Collector Event Winter Holiday Collect 10 Candy Canes of Looted state.false
King of Canes Event Winter Holiday Cane Collector Collect 100 Candy Canes of Looted state.false
First Steps in Bloom Event Valentine Event Collect 10 Black Roses.false
Roses Have Thorns Event Valentine Event First Steps in Bloom Collect 100 Black Roses.false
With True Love, the World Shall Be Saved Event Valentine Event Complete all of the Valentine's quests offered during the Season.false




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' or 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>" .. "[[File:" .. achievement.icon .. ".png|45px]]"  .. "</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) .. tostring(is_hidden) .. "</td>\n"
		record = record .. "</tr>\n"
		
		html = html .. record .. "\n"
	end
	
	return mw.getCurrentFrame():preprocess(html)
end

return p