Socket
Book a DemoInstallSign in
Socket

@projectsophon/hexgen

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@projectsophon/hexgen

This package contains functions for determining various properties of Dark Forest objects based on their ID in hex. You could think of this package like procedural generation for Ethereum addresses.

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
2
Created
Source

@projectsophon/hexgen

This package contains functions for determining various properties of Dark Forest objects based on their ID in hex. You could think of this package like procedural generation for Ethereum addresses.

Note: This package might go away when objects become classes that contain a lot of these helpers as instance methods.

Installation

You can install this package using npm or yarn by running:

npm install --save @projectsophon/hexgen
yarn add @projectsophon/hexgen

When using this in a plugin, you might want to load it with skypack

import * as hexgen from 'http://cdn.skypack.dev/@projectsophon/hexgen'

Table of contents

Functions

Functions

bonusFromHex

bonusFromHex(hex): PlanetBonus

Extracts the bonuses of a planet given its LocationID.

Parameters

NameTypeDescription
hexLocationIdLocationID of a planet.

Returns

PlanetBonus

getBytesFromHex

getBytesFromHex(hexStr, startByte, endByte): bigint

The core method for extracting planet details from a LocationID.

Parameters

NameTypeDescription
hexStrstringLocationID of a planet.
startBytenumberThe first byte to include in the result.
endBytenumberThe byte after the last byte to include in the result.

Returns

bigint

planetHasBonus

planetHasBonus(planet?): boolean

Checks if the LocationID of the planet indicates any bonuses.

Parameters

NameTypeDescription
planet?PlanetPlanet to check for bonuses.

Returns

boolean

FAQs

Package last updated on 15 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts