npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@albion-data/client

v1.2.1

Published

Albion Online Data Client

Downloads

13

Readme

About

This is helpful package for working with the Albion Data Project API, this is the initial release and feature set / docs are a bit limited right now.

There is a basic demo app that shows off how to use the methods to make a bags price lookup app in ReactJS. The code can be viewed on the GitHub repo and the app can be viewed on the GitHub Pages.

Supports:

  • Getting Chart data
  • Getting Gold data
  • Getting Price data
  • Getting Item icons urls
  • Getting Spell icon urls
  • Getting Destiny board icon urls
  • Getting icon locale name and description

Getting started

yarn add @albion-data/client
import { getChartData } from "@albion-data/client";

getChartData({
  itemList: "T5_BAG",
})
  .then((data) => console.log(data))
  .catch((err) => console.error(err));

Methods

All methods currently end in either Raw or Data, the Raw methods directly return the entire axios promise while the Data ones process the returned data to append UTC timezone flag to date strings and only returns the JSON data.

Fetch the chart data from the Charts/ API

// getChartRaw - Axios Promis
// getChartData - Promise<TChart>

getChartData({
  itemList: "T5_BAG", // Array of strings or string - required
  startDate: new Date(), // Date or date string
  endDate: new Date(), // Date or date string
  locations: "Fort Sterling", // Array of string or string
  qualities: [1,2] // Array of numbers or number
  timeScale: 1 // number 1 - 6
})

Fetch the gold data from the Gold/ API

// getGoldRaw - Axios Promis
// getGoldData - Promise<TGold>

// No Required fields, but count to limit total results is suggested
getGoldData({
  startDate: new Date(), // Date or date string
  endDate: new Date(), // Date or date string
  count: 10, // number
});

Fetch the price data from the Price/ API

// getPriceRaw - Axios Promis
// getPriceData - Promise<TPrice>

getPriceData({
  itemList: ["T5_BAG", "T6_BAG"], // Array of strings or string - required
  locations: ["Fort Sterling", "Thetford"], // Array of string or string
  qualities: 2, // Array of numbers or number
});

Generate icon URLs for the Albion Render API, user must provide item identifier or the localized name and locale.

getItemIconUrl({
  identifier: "T4_OFF_SHIELD", // String indentifier of item, like
  quality: 2, // Number repersenting the quality of the item (see QUALITIES_ENUM)
  size: 50, // Sets width and height in px
});

// Return: https://render.albiononline.com/v1/item/T4_OFF_SHIELD.png

getSpellIconUrl({
  identifier: "HASTE",
});
getDestinyBoardIconUrl({
  identifier: "ADVENTURER_ADEPT",
});

Get the localized name and descirption for an item using the item id.

getItemLocale({
  identifier: "T4_OFF_SHIELD", // String indentifier of item, like
  locale: "en-US", // Optional, defaults to en-US
});

// Example response
{
  "id":"T4_OFF_SHIELD",
  "name":"Adept's Shield",
  "description":"Equipment Item"
}

Useful Data / Types

This repo exports everything export from @albion-data/types, here are some extra helpful types to know about.

// QUALITIES_ENUM - Maps all enum quality numbers to string values
QUALITIES_ENUM[1]; // Normal
QUALITIES_ENUM[2]; // Good

// or generate the number used for the API call
QUALITIES_ENUM.Outstanding; // 3

// ENCHANTMENTS_ENUM - Maps enchantments to numbers, useful for parsing the API resaponse
ENCHANTMENTS_ENUM[0]; // Normal
ENCHANTMENTS_ENUM.Exceptional; // 3

// cityList - An array of all cities in the game
// marketList - An array of all markets in the game (cities + Black Market right now)

// TItemID - ALL item IDs in the game mapped to 1 TypeScript type.

// Example:

improt { TItemID } from "@albion-data/client"

TODO:

  • [ ] Create doc generation process
  • [ ] Setup CI to auto publish
  • [ ] Write unit tests
  • [ ] Document feature ideas, for example auto mapping of enchantment numbers to strings.