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

discord-dungeon

v1.2.7

Published

Add inventories, enemies, and items to your Discord bot.

Downloads

38

Readme

Discord-Dungeon


Initialization

Connect-MongoDB

const {Dungeon} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

Create-item

Items Examples

To create items you must modify the file located at './discord-dungeon/items.xlsx'. The columns should be named with the following specification:

Item ID is its row minus 1

  • name: this will be the name of the item.

  • buyprice: this is the buy price that will be used for the item in the shop. Set to 0 to make this unbuyable.

  • sellprice: this is the sell price that will be used for the item in the shop. Set to 0 to make this unsellable.

  • quality: this will be the quality of the item.

  • type: this will be the type of item. There are only 2 types: ("material" and "equipment").

  • slot: (only if the type of item is "equipment") this will be the type of item. There are only 3 slots: ("weapon", "helmet" and "chestplate").

  • add: (only if the type of item is "equipment") this will be the stats that the item adds.

Structure: {"health_max", "armor" or "damage": amount}.

Example: {"health_max": 20, "armor": 5}

  • remove: (only if the type of item is "equipment") this will be the stats that the item removes.

Structure: {"health_max", "armor" or "damage": amount}.

Example: {"health_max": 20, "armor": 5}

  • craft: this will be what the article requires to be crafted.

Structure: {"item id": amount}.

Example: {"1": 5, "3": 12}

Create-enemy

Enemies Example

To create items you must modify the file located at './discord-dungeon/enemies.xlsx'. The columns should be named with the following specification:

Enemy ID is its row minus 1

  • zone: this will be the zone where the enemy appears.

  • stage: this will be the stage where the enemy will start to appear.

  • health: this will be the enemy's health.

  • damage: this will be the enemy's damage.

  • armor: this will be the enemy's armor.

  • money: this will be the amount of money that the enemy drops.

Structure: 20 or 20,40 (20,40 will choose a random number between 20 and 40)

  • rarity: this will be the rarity to appear from the enemy.

  • | Rarity | Percentage | | ------------ | ------------ | | common | 100 | | uncommon | 60 | | special | 30 | | rare | 12 | | very_rare | 6 | | mythical | 2 |

  • drop: this will be the quantity and probability of dropping items.

Structure: {"percentage": {"item id": the amounts you can drop}, "percentage 2": {"item id 2": the amounts you can drop}}.

Example: {"100": {"1": "5,10"}, "50": {"2": "1,8", "3": "2,4"}} drops with 100 probability the item with id 1 between 5 and 10, with 50 probability the items with id 2 between 1 and 8, with id 3 between 2 and 4

Players

Add-Item

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.AddItem(<Item id or name>, <amount>)

Remove-Item

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.RemoveItem(<Item id or name>, <amount>)

Set-Item

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.SetItem(<Item id or name>, <amount>)

Find-Item-in-bag

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.FindItem(<Item id or name>).then(item => console.log(item))

Get-bag

| Sort type | | ------------ | | none | | amount | | quality |

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.GetBag(<Sort type>).then(bag => console.log(bag))

Add-money

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.AddMoney(<Amount>)

Remove-money

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.RemoveMoney(<Amount>)

Set-money

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.SetMoney(<Amount>)

Add-health

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.AddHealth(<Amount>, <true or false>) // true=add to health_max, false=add to health, Default: false

Take-damage

If the player receives mortal damage he will revive with half the items, money and health.

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.TakeDamage(<amount>)

Get-stats

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.GetStats().then(stats => console.log(stats))

Equip-item

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.EquipItem(<Item id or name>)

Craft-item

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.CraftItem(<Item id or name>, <amount>)

Sell-item

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.SellItem(<Item id or name>, <amount>)

Buy-item

const {Dungeon, Players} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const player = new Players.Player('<DISCORD-ID>')
player.BuyItem(<Item id or name>, <amount>)

Enemies

Get-enemy-with-id

const {Dungeon, Bestiary} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const enemy = Bestiary.Enemies.GetEnemyWithID(<Enemy id>)

Get-enemy-with-name

const {Dungeon, Bestiary} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const enemy = Bestiary.Enemies.GetEnemyWithName(<Enemy name>)

Get-a-random-enemy-from-a-stage-and-zone

const {Dungeon, Bestiary} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const enemy = Bestiary.Enemies.GetRandomEnemy(<Zone>, <Stage>)

Enemy

Get-random-drop

const {Dungeon, Bestiary} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const enemy = Bestiary.Enemies.GetRandomEnemy(<Zone>, <Stage>)
const drop = enemy.GetRandomDrop()

Items

Get item with id

const {Dungeon, Dictionary} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const enemy = Dictionary.Items.GetItemWithID(<Item id>)

Get-item-with-name

const {Dungeon, Dictionary} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const enemy = Dictionary.Items.GetItemWithName(<Item name>)

Get-all-items

| Sort type | | ------------ | | alphabet | | id | | quality | | price |

const {Dungeon, Dictionary} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')

const enemy = Dictionary.Items.GetAllItems(<Sort type>)