discord-dungeon
v1.2.7
Published
Add inventories, enemies, and items to your Discord bot.
Downloads
38
Maintainers
Readme
Discord-Dungeon
Initialization
Connect-MongoDB
const {Dungeon} = require('discord-dungeon')
const client = new Dungeon.Client('<MONGODB-URL>')
Create-item
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
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>)