download and inline fish icons
1
.gitignore
vendored
|
@ -4,3 +4,4 @@ fish_data.js
|
|||
beacon.db*
|
||||
.env
|
||||
.sqlx/
|
||||
node_modules/
|
||||
|
|
BIN
bun.lockb
Executable file
|
@ -5,6 +5,11 @@
|
|||
import { DATA } from "./data.js";
|
||||
import { FISH_INFO } from "./fish_data.js";
|
||||
import fs from "node:fs/promises";
|
||||
import axios from "axios";
|
||||
import PQueue from "p-queue";
|
||||
import minimist from "minimist";
|
||||
|
||||
const argv = minimist(process.argv.slice(2));
|
||||
|
||||
const result = {
|
||||
db_data: DATA,
|
||||
|
@ -18,6 +23,25 @@ Object.values(result.db_data.FISH).forEach((fish) => {
|
|||
}
|
||||
});
|
||||
|
||||
if (argv.icons) {
|
||||
let promises = Object.values(result.db_data.ITEMS).map((item) => async () => {
|
||||
if (item.icon !== "") {
|
||||
let url = `https://v2.xivapi.com/api/asset?path=ui/icon/${item.icon.toString().slice(0, 3)}000/${item.icon}.tex&format=png`;
|
||||
let { data } = await axios.get(url, { responseType: "arraybuffer" });
|
||||
let fileData = Buffer.from(data, "binary");
|
||||
return fs.writeFile(`./static/icons/${item.icon}.png`, fileData);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Downloading ${promises.length} icons...`);
|
||||
const queue = new PQueue({ concurrency: 5 });
|
||||
await queue.addAll(promises);
|
||||
console.log("Download complete!");
|
||||
}
|
||||
|
||||
const json = JSON.stringify(result);
|
||||
|
||||
await fs.writeFile("data.json", json, { encoding: "utf8" });
|
||||
console.log("Saved JSON to data.json!");
|
||||
|
|
7
package.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
"minimist": "^1.2.8",
|
||||
"p-queue": "^8.1.0"
|
||||
}
|
||||
}
|
15
src/data.rs
|
@ -72,12 +72,8 @@ pub enum Hookset {
|
|||
impl Display for Hookset {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let string = match self {
|
||||
Self::Precision => {
|
||||
"https://v2.xivapi.com/api/asset?path=ui/icon/001000/001116.tex&format=png"
|
||||
}
|
||||
Self::Powerful => {
|
||||
"https://v2.xivapi.com/api/asset?path=ui/icon/001000/001115.tex&format=png"
|
||||
}
|
||||
Self::Precision => "/static/precision.png",
|
||||
Self::Powerful => "/static/powerful.png",
|
||||
};
|
||||
write!(f, "{}", string)
|
||||
}
|
||||
|
@ -112,12 +108,7 @@ pub struct Item {
|
|||
|
||||
impl Item {
|
||||
pub fn get_icon_url(&self) -> String {
|
||||
let mut icon_cat = self.icon.clone();
|
||||
icon_cat.replace_range(3..6, "000");
|
||||
format!(
|
||||
"https://v2.xivapi.com/api/asset?path=ui/icon/{}/{}.tex&format=png",
|
||||
icon_cat, self.icon
|
||||
)
|
||||
format!("/static/icons/{}.png", self.icon)
|
||||
}
|
||||
|
||||
pub fn get_hookset(&self, data: &Data) -> Option<Hookset> {
|
||||
|
|
BIN
static/icons/022619.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
static/icons/022635.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027001.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
static/icons/027002.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
static/icons/027003.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027004.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
static/icons/027005.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
static/icons/027006.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027007.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027008.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027009.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027010.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027013.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027014.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027015.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027017.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027018.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027019.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027021.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027022.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
static/icons/027023.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
static/icons/027025.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027026.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
static/icons/027027.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027028.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027031.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
static/icons/027032.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
static/icons/027033.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027034.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
static/icons/027035.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027036.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027037.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027038.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
static/icons/027039.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
static/icons/027040.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
static/icons/027041.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
static/icons/027044.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027045.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027046.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
static/icons/027047.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027048.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
static/icons/027049.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027051.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027053.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
static/icons/027054.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027055.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027056.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027057.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027058.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027059.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
static/icons/027061.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027062.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027063.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
static/icons/027065.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027067.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
static/icons/027068.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027069.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027070.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027071.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
static/icons/027072.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027073.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027074.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027075.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027076.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027077.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027078.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
static/icons/027100.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/icons/027101.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
static/icons/027102.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
static/icons/027103.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/027104.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
static/icons/027105.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
static/icons/027106.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027107.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
static/icons/027108.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/027109.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
static/icons/027110.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
static/icons/028013.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
static/icons/028014.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
static/icons/028015.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
static/icons/028033.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
static/icons/028034.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
static/icons/028035.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
static/icons/028036.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
static/icons/028037.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/028038.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
static/icons/028039.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/028040.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
static/icons/028041.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
static/icons/028042.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
static/icons/028043.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
static/icons/028044.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
static/icons/028045.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
static/icons/028046.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icons/028047.png
Normal file
After Width: | Height: | Size: 3.3 KiB |