Difference between revisions of "User:Lusterless"

From Fallen Sword Wiki
Jump to: navigation, search
(Walking the World)
(Realm Maps)
 
(23 intermediate revisions by one user not shown)
Line 7: Line 7:
 
* [https://fallensword.com/index.php?cmd=guild&subcmd=view&guild_id=22663 Sharingan Warriors], 2019 - present
 
* [https://fallensword.com/index.php?cmd=guild&subcmd=view&guild_id=22663 Sharingan Warriors], 2019 - present
  
== Walking the World ==
+
== Javascript for the Wiki ==
My 2022 New Year's resolution is to visit every map and update the wiki accordingly.  
+
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.
|<strong>Map</strong>
+
 
|<strong>Date Visited</strong>
+
<nowiki>
|-
+
realmMap = GameData.realm().tiles.map((r,i) =>
|[[Mountain Path]]
+
  r.map((i) => `| {{tileSheet|tiles/${GameData.realm().set}|${GameData.realm().tile_lookup[i].i}}}`))
| 2022-01-21
+
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]}}}`)
|[[Elya Plains (North)]]
+
realmMap.map((r, i) => `| ${i}\n` + r.join("\n") + `\n| ${i}\n`).join("|-\n")
|2022-02-01
+
</nowiki>
|-
+
 
|[[Varas Dungeon]]
+
=== Shops ===
|2022-02-02
+
This script creates the code for items in the [[template:Shop|Shop Template]].
|-
+
 
|[[Fortress of Elya (Hall)]]
+
<nowiki>
|2022-02-02
+
var items = Array.from($(".shopInventoryItem")).map((e,i) => { return {
|-
+
  price: $(e).find(".price").text(),
|[[Fortress of Elya (Corridors)]]
+
  imageID: $(e).find(".inventory-item").css("background-image").match(/(\d+)\.gif/)[1],
|2022-02-02
+
  data: $(e).find(".inventory-item-slot").data("tipped"),
|-
+
}});
|[[Fortress of Elya (Tower)]]
+
|2022-02-02
+
items.reduce((promiseChain, currentTask) => {
|-
+
  return promiseChain.then(chainResults => 
|[[Fortress of Elya (Courtyard)]]
+
    $.ajax(currentTask.data).then((e) =>
|2022-02-02
+
      [ ...chainResults, $(e).find('nobr').text() ]
|-
+
    )
|[[Fortress of Elya (Barracks)]]
+
  );
|2022-02-02
+
}, 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")
|[[Fortress of Elya (Sewer)]]
+
});
|2022-02-02
+
</nowiki>
|-
+
|[[Otha Caves (Level 1)]]
+
|2022-02-03
+
|-
+
|[[Otha Caves (Level 2)]]
+
|2022-02-03
+
|-
+
|[[Otha Caves (Level 3)]]
+
|2022-02-04
+
|-
+
|[[Nomad Stronghold]]
+
|2022-02-04
+
|-
+
|[[Nomad Barracks]]
+
|2022-02-04
+
|-
+
|[[Nomad Sanctum]]
+
|2022-02-04
+
|-
+
|[[Galo Caves (Level 1)]]
+
|2022-02-04
+
|-
+
|[[Galo Caves (Level 2)]]
+
|2022-02-05
+
|-
+
|[[Galo Caves Witchway]]
+
|}
+
  
 
== Links ==  
 
== Links ==  
 
* [https://fallensword.com/index.php?cmd=profile&player_id=1674838 Player Profile]
 
* [https://fallensword.com/index.php?cmd=profile&player_id=1674838 Player Profile]
 
* [https://wiki.fallensword.com/index.php/Special:Contributions/Lusterless Wiki Contributions]
 
* [https://wiki.fallensword.com/index.php/Special:Contributions/Lusterless Wiki Contributions]
 +
[[Category:Players|{{PAGENAME}}]]

Latest revision as of 20:20, 29 January 2024

Contents

Lusterless

Documentation enthusiast and Fallen Sword Helper developer.


Guilds

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")
 });
 

Links