Difference between revisions of "User:Lusterless"
From Fallen Sword Wiki
Lusterless (Talk | contribs) |
Lusterless (Talk | contribs) (→Realm Maps) |
||
(One intermediate revision by one user not shown) | |||
Line 17: | Line 17: | ||
r.map((i) => `| {{tileSheet|tiles/${GameData.realm().set}|${GameData.realm().tile_lookup[i].i}}}`)) | r.map((i) => `| {{tileSheet|tiles/${GameData.realm().set}|${GameData.realm().tile_lookup[i].i}}}`)) | ||
GameData.realm().fixed.forEach((i) => | GameData.realm().fixed.forEach((i) => | ||
− | realmMap[i.y][i.x] = `| {{MapNote|image={{tileSheet|realms/${GameData.realm().id}|${i.i}}}|target=${i.name}}}`) | + | realmMap[i.y][i.x] = `| {{MapNote|image={{tileSheet|realms/${GameData.realm().id}|${i.i}}}|target=${i.name}|type=${["A", "S", "Q", "P", "R"][i.type]}}}`) |
realmMap.map((r, i) => `| ${i}\n` + r.join("\n") + `\n| ${i}\n`).join("|-\n") | realmMap.map((r, i) => `| ${i}\n` + r.join("\n") + `\n| ${i}\n`).join("|-\n") | ||
</nowiki> | </nowiki> |
Latest revision as of 20:20, 29 January 2024
Contents |
Lusterless
Documentation enthusiast and Fallen Sword Helper developer.
Guilds
- Balance Guild, 2008 - 2019
- Sharingan Warriors, 2019 - present
Javascript for the Wiki
I've written some JS code that can be run in developer mode to generate sections of wiki-pages.
Realm Maps
This script generates the cells of a map table. It must be run after a page refresh, and requires manual tagging and review.
realmMap = GameData.realm().tiles.map((r,i) => r.map((i) => `| {{tileSheet|tiles/${GameData.realm().set}|${GameData.realm().tile_lookup[i].i}}}`)) GameData.realm().fixed.forEach((i) => realmMap[i.y][i.x] = `| {{MapNote|image={{tileSheet|realms/${GameData.realm().id}|${i.i}}}|target=${i.name}|type=${["A", "S", "Q", "P", "R"][i.type]}}}`) realmMap.map((r, i) => `| ${i}\n` + r.join("\n") + `\n| ${i}\n`).join("|-\n")
Shops
This script creates the code for items in the Shop Template.
var items = Array.from($(".shopInventoryItem")).map((e,i) => { return { price: $(e).find(".price").text(), imageID: $(e).find(".inventory-item").css("background-image").match(/(\d+)\.gif/)[1], data: $(e).find(".inventory-item-slot").data("tipped"), }}); items.reduce((promiseChain, currentTask) => { return promiseChain.then(chainResults => $.ajax(currentTask.data).then((e) => [ ...chainResults, $(e).find('nobr').text() ] ) ); }, Promise.resolve([])).then(arrayOfResults => { arrayOfResults.map((e,i) => `|item-name-${i+1}=${e.name}|item-image-${i+1}={{ItemPicture|${e.imageID}}}|item-price-${i+1}=${e.price}`).join("\n") });