Skip to content
Permalink
Browse files

WIP advanced loot stuff

  • Loading branch information...
gc committed Oct 6, 2019
1 parent 8485e90 commit d46cdd286ff42421c0141ddcf63bf4392205e4e4
Showing with 1,008 additions and 483 deletions.
  1. +4 −467 bot/commands/OSRS_Fun/kill.js
  2. +3 −8 bot/commands/Owner/docs.js
  3. +12 −6 bot/tasks/prices.js
  4. +21 −0 bot/tasks/spawnWorkerThread.js
  5. +145 −0 commands.md
  6. +71 −0 data/new_monsters/LootTable.js
  7. +37 −0 data/new_monsters/commonLoot.js
  8. +135 −0 data/new_monsters/generateBankImage.js
  9. +442 −0 data/new_monsters/killWorkerFunction.js
  10. +88 −0 data/new_monsters/zulrah.js
  11. +1 −0 package.json
  12. BIN resources/images/bank.png
  13. BIN resources/item-images/1149.png
  14. BIN resources/item-images/12921.png
  15. BIN resources/item-images/12922.png
  16. BIN resources/item-images/12927.png
  17. BIN resources/item-images/12932.png
  18. BIN resources/item-images/12934.png
  19. BIN resources/item-images/12936.png
  20. BIN resources/item-images/12938.png
  21. BIN resources/item-images/13200.png
  22. BIN resources/item-images/13201.png
  23. BIN resources/item-images/1391.png
  24. BIN resources/item-images/1515.png
  25. BIN resources/item-images/1779.png
  26. BIN resources/item-images/1939.png
  27. BIN resources/item-images/1987.png
  28. BIN resources/item-images/2361.png
  29. BIN resources/item-images/267.png
  30. BIN resources/item-images/269.png
  31. BIN resources/item-images/2998.png
  32. BIN resources/item-images/3000.png
  33. BIN resources/item-images/3204.png
  34. BIN resources/item-images/391.png
  35. BIN resources/item-images/451.png
  36. BIN resources/item-images/453.png
  37. BIN resources/item-images/5288.png
  38. BIN resources/item-images/5289.png
  39. BIN resources/item-images/5290.png
  40. BIN resources/item-images/5296.png
  41. BIN resources/item-images/5300.png
  42. BIN resources/item-images/5303.png
  43. BIN resources/item-images/5304.png
  44. BIN resources/item-images/5316.png
  45. BIN resources/item-images/5317.png
  46. BIN resources/item-images/536.png
  47. BIN resources/item-images/560.png
  48. BIN resources/item-images/562.png
  49. BIN resources/item-images/563.png
  50. BIN resources/item-images/5952.png
  51. BIN resources/item-images/5974.png
  52. BIN resources/item-images/6289.png
  53. BIN resources/item-images/6332.png
  54. BIN resources/item-images/6571.png
  55. BIN resources/item-images/7936.png
  56. BIN resources/item-images/9193.png
  57. BIN resources/osrs-font-compact.otf
  58. +49 −2 yarn.lock

Large diffs are not rendered by default.

@@ -108,16 +108,11 @@ module.exports = class extends Command {

for (let subCat = 0; subCat < subCategories.length; subCat++) {
if (subCategories.length > 1) markdown.push(`\n### ${subCategories[subCat]}`);
markdown.push(`| Command Name | Aliases | Description |`);
markdown.push(`|--------------|----------|--------------------------|`);
markdown.push(`| Command Name | Description | Example |`);
markdown.push(`|--------------|--------------------------|---------|`);
markdown.push(
`${commands[categories[cat]][subCategories[subCat]]
.map(
cmd =>
`| ${this.prefix + cmd.name} | ${cmd.aliases.join(', ')} | ${
cmd.description
} |`
)
.map(cmd => `| ${this.prefix + cmd.name} | ${cmd.description} | TODO |`)
.join('\n')}`
);
}
@@ -5,17 +5,23 @@ const { Items } = require('oldschooljs');
const { cleanString } = require('../../config/util');

module.exports = class extends Task {
init() {
this.run();
async init() {
await this.syncItems();
await this.fetchOSBPrices();
await this.client.tasks.get('spawnWorkerThread').run();
}
async run() {
this.syncItems();
this.fetchOSBPrices();
if (this.client.production) {
this.syncItems();
this.fetchOSBPrices();
} else {
console.log('Not syncing items/OBS prices in development mode.');
}
}

async syncItems() {
this.client.console.debug('Fetching all OSJS items.');
Items.fetchAll();
await Items.fetchAll();
}

async fetchOSBPrices() {
@@ -38,6 +44,6 @@ module.exports = class extends Task {
};
}

this.client.settings.update('prices', prices);
await this.client.settings.update('prices', prices);
}
};
@@ -0,0 +1,21 @@
const { Task } = require('klasa');
const { spawn, Thread, Worker } = require('threads');

module.exports = class extends Task {
async run() {
if (this.client.killWorkerThread) {
Thread.terminate(this.client.killWorkerThread);
}
this.client.killWorkerThread = await spawn(
new Worker('../../data/new_monsters/killWorkerFunction')
).catch(console.error);

const terminateCb = async () => {
Thread.terminate(this.client.killWorkerThread);
process.exit(0);
};

process.on('SIGTERM', terminateCb);
process.on('SIGINT', terminateCb);
}
};
@@ -0,0 +1,145 @@
## Tips

1. Connect your OSRS username to your discord account with the `+setrsn` command, for example if your username is Woox, you'd do `+setrsn Woox`. After doing this, you will no longer need to type your username for most commands, for example, you can just type `+stats`, or `+s` for short, and it will show your stats.

## Account Commands

| Command Name | Description | Example Usage |
| ------------- | ------------------------------------------------------------------------------------------ | ------------------------------- |
| +setrsn | Set your RuneScape Username, used for other commands. | +setrsn Woox |
| +stats | Shows the stats of an account. | +s Woox |
| +hcim | Shows the stats of a Hardcore Ironman account. | +s Iron Faux |
| +ironman | Shows the stats of an Ironman account. | +s Mmorpg |
| +uim | Shows the stats of an Ultimate Ironman account. | +s Swampletics |
| +clues | Shows the Clue Highscores of an account. | +clues Kacy |
| +diary | Check which diaries your account has the required stats to complete. | +diary Woox |
| +combat | Shows your Combat level. | +combat Woox |
| +dmm | Shows the stats of a DMM account. | +dmm Faux |
| +dms | Shows the stats of a Seasonal Deadman account. | +dms Faux |
| +hans | Shows the creation date/avg playtime of your account. See: https://i.imgur.com/PPviStZ.png | https://i.imgur.com/PPviStZ.png |
| +lvl | Shows the level of a single stat, and the XP remaining. | +lvl fishing Woox |
| +pvp | Shows the BH & LMS scores of an account. | +pvp d3adscene |
| +virtualstats | Shows the virtual stats of a OSRS account | +virtualstats Woox |
| +xp | Shows your XP in all skills. | +xp Swampletics |
| +xpto99 | Shows how much XP you have left until 99 in all skills. | +xpto99 Swampletics |

## Fun Commands

| Command Name | Description | Example |
| ------------ | ---------------------------------------------------------------------- | --------------------------------------------- |
| +analytics | Shows analytics of the stats of a OSRS account | +analytics Swampletics |
| +ash | Random Mod Ash gif. | +ash |
| +b2bpet | Rolls a singular pet until you get it twice in a row. | +b2bpet vorki |
| +defender | See how long it takes you to get a Dragon Defender. | +defender |
| +dice | Simulates dice rolls from Runescape. | +dice |
| +casket | Simulate rare drops from clue scrolls | +casket master 100 |
| +duel | Simulates dueling another player. | +duel Woox |
| +fakearma | Fake yourself getting arma loot! | +fakearma Swampletics |
| +fakeely | Get yourself a Fake Ely! +fakeely username kc | +fakeely Swampletics 1 |
| +fakepm | Fake a private message from someone. | +fakepm B0aty hello |
| +fakebandos | Fake yourself getting bandos loot! | +fakebandos Swampletics |
| +fakescythe | Get yourself a Scythe of Vitur! | +fakescythe Swampletics 1 |
| +fakesara | Fake yourself getting sara loot! | +fakesara Swampletics |
| +fakezammy | Fake yourself getting zammy loot! | +fakezammy Swampletics |
| +kill | Simulates killing monsters and shows loot. | +kill 100 bandos |
| +finish | Simulates how long it takes you to 'finish' a boss (Get all its drops) | +finish bandos |
| +markov | Markov chain generated from lots of runescape text. | +markov |
| +pet | Rolls a singular pet until you get it and shows the KC/Rolls | +pet mole |
| +petroll | Rolls a chance at getting every pet at once. | +petroll 5 |
| +poll | Creates a simple reaction poll for people to vote on. | +poll Are you guys happy with the new update? |
| +raid | Roll on the raids drop table based on the number of points specified | +raid |
| +screens | Displays an image on the Q&A screens | Upload an image with +screens |
| +streamers | Shows the current top 5 RuneScape streamers on Twitch. | +streamers |
| +trivia | Sends a OSRS related trivia question. | +trivia |

## Utility Commands

| Command Name | Description | Example |
| ------------ | ----------------------------------------------------------- | ---------------------- |
| +buylimit | Check the buy limit of an item. | +buylimit mind rune |
| +hiscores | Shows the link for the official OSRS hiscores. | +hiscores |
| +clients | Shows links to the official client and runelite. | +clients |
| +forums | Shows the link for the official OSRS forum. | +forums |
| +map | Shows the link for the official OSRS map. | +map |
| +news | Shows the latest OSRS News Posts. | +news |
| +mobile | Shows the link for the official OSRS mobile app. | +mobile |
| +players | Shows how many people are playing OSRS. | +players |
| +polls | Shows the latest poll results. | +polls |
| +price | Looks up the price of an item. | +price Twisted Bow |
| +quest | Shows information on a quest. | +quest Cooks Assistant |
| +petrate | Shows the rates of getting skilling pets at certain levels. | +petrate 50 Fishing |
| +runelite | Shows information on RuneLite. | +runelite |
| +security | Shows some information on securing your runescape account. | +security |
| +wiki | Search the OSRS Wikipedia for an article. | +wiki Twisted Bow |
| +world | Returns information on a OSRS World. | +world 1 |
| +youtubers | Shows the links for some OSRS youtubers. | +youtubers |
| +servers | Shows some community servers related to OSRS. | +servers |

## Configuration Commands

| Command Name | Description | Example |
| -------------------- | ---------------------------------------------------------------------------------- | ------------------------ |
| +73 | Reacts with 😂 everytime somebody says '73'. | +73 enable |
| +ashtweets | Receive every tweet from God Ash in your discord channel! Beware: he tweets a lot. | +ashtweets enable |
| +channel | Disable the bot in a channel, so people cant use commands in it. | +channel disable |
| +hcimdeaths | Get tweets from @HCIM_Deaths when a HCIM dies. | +hcimdeaths enable |
| +cmd | Enable and disable certain bot commands in your guild. (Admin only) | +cmd disable kill |
| +jmodcomments | Sends comments/posts from JMods on reddit to your server. | +jmodcomments enable |
| +petmessages | Every message sent in your server will have a chance at getting a pet. | +petmessages enable |
| +prefix | Change the command prefix the bot uses in your server. | +prefix ! |
| +streamertweets | Sends tweets from OSRS Streamers to your server. | +streamertweets enable |
| +tweets | Sends tweets from JMods to your server. | +tweets enable |
| +twitchnotifications | Sends you a notification when chosen streamers go live. | +tn enable, +tn add faux |

## CrystalMathLabs / 11 Commands

| Command Name | Description | Example |
| ------------ | ------------------------------------------------------------------------ | ------- |
| +autoupdate | Automatically update your connected (+setrsn) account on CML every hour. | TODO |
| +current | Shows the current records. | TODO |
| +200all | Shows the Time to 200m all of an account | TODO |
| +ehp | Shows the EHP stats of an account | TODO |
| +lastcheck | Checks when a CML Account was last updated. | TODO |
| +gains | Shows the ranks of an account | TODO |
| +prevname | Checks what the previous name of a player was. | TODO |
| +ranks | Shows the ranks of an account | TODO |
| +records | CML Records for an account, in a period of day, week or month. | TODO |
| +ttm | Shows the Time to Max of an account | TODO |
| +update | Update a CML profile. | TODO |
| +track | Tracks gains on an account. | TODO |

## Fun / 6 Commands

| Command Name | Description | Example |
| ------------ | -------------------------------------------------------------------------- | --------------------------------------- |
| +love | Find out your love rating with someone! | +love Mod Luna |
| +peepolove | Generates a peepoLove image from a given image/avatar. | +peepolove @person, or upload an image. |
| +mypets | View the virtual pets you have, from the petmessages feature. | +mypets |
| +randquote | Returns a random message from someone in the channel. | +randquote |
| +roll | Roll a random number between 1-100 or to a provided number. | +roll, +roll 6 |
| +urban | Searches the Urban Dictionary library for a definition to the search term. | +urban Noob |

## Utility / 16 Commands

| Command Name | Description | Example |
| ------------ | ---------------------------------------------------------------- | ----------------------------------------- |
| +bank | Shows how much virtual GP you have | TODO |
| +emotes | Shows all the emote servers that the bot uses. | TODO |
| +followage | Shows the followage of a given user from a given twitch channel. | TODO |
| +github | Shows the Github link. | TODO |
| +help | Get a list of commands for the bot. | TODO |
| +info | Displays information about the bot. | TODO |
| +invite | Sends the invite link for the bot. | TODO |
| +pay | Send virtual GP to people (not real GP). | TODO |
| +leaderboard | Shows the people with the most virtual GP. | TODO |
| +server | Get information on the discord server. | +server |
| +tag | Allows you to create, remove or show custom commands. | +tag add something, +something, +tag list |
| +support | Shows the support link for the bot. | +support |
| +twitch | Returns information on a Twitch.tv Account | +twitch Faux |
| +user | Get information on a mentioned user, or yourself. | +user |

## Oldschool.gg Commands

| Command Name | Description | Example |
| ------------ | --------------------------- | ------- |
| +collections | Shows the collections link. | TODO |
@@ -0,0 +1,71 @@
const { rand } = require('../../config/util');

module.exports = class LootTable {
constructor(limit) {
this.table = [];
this.length = 0;
this.totalWeight = 0;
this.limit = limit;
}

addMany(arrayOfItems) {
for (const item of arrayOfItems) {
this.add(...item);
}
return this;
}

add(item, weight, quantity) {
// eslint-disable-next-line eqeqeq
if (weight == null || weight <= 0) weight = 1;
// eslint-disable-next-line eqeqeq
if (quantity == null || quantity <= 0) quantity = 1;

this.length += 1;
this.totalWeight += weight;

this.table.push({
item,
weight,
quantity
});

return this;
}

roll() {
// If this loot table has no items, return null;
if (this.length === 0) return null;

// Random number between 1 and the total weighting
const randomWeight = rand(1, this.limit || this.totalWeight);

if (randomWeight > this.totalWeight) return null;

// The index of the item that will be used.
let result;
let weight = 0;

for (let i = 0; i < this.table.length; i++) {
const item = this.table[i];

weight += item.weight;
if (randomWeight <= weight) {
result = i;
break;
}
}

const chosenItem = this.table[result];

if (chosenItem.item === undefined) return null;

return {
item: chosenItem.item,
quantity:
typeof chosenItem.quantity === 'function'
? chosenItem.quantity()
: chosenItem.quantity
};
}
};
@@ -0,0 +1,37 @@
module.exports = {
dragonMedHelm: 1149,
dragonHalberd: 3204,
pureEssence: 7936,
deathRune: 560,
chaosRune: 562,
lawRune: 563,
snapdragon: 3000,
dwarfWeed: 267,
torstol: 269,
toadflax: 2998,
coal: 453,
dragonstoneBoltTips: 9193,
flax: 1779,
mahoganyLogs: 6332,
runiteOre: 451,
snakeskin: 6289,
yewLogs: 1515,
swampTar: 1939,
antidote24: 5952,
dragonBones: 536,
adamantiteBar: 2361,
coconut: 5974,
grapes: 1987,
zulAndraTeleport: 12938,
mantaRay: 391,
battlestaff: 1391,
spiritSeed: 5317,
torstolSeed: 5304,
dwarfWeedSeed: 5303,
snapdragonSeed: 5300,
toadflaxSeed: 5296,
palmTreeSeed: 5289,
papayaTreeSeed: 5288,
calquatTreeSeed: 5290,
magicSeed: 5316
};

0 comments on commit d46cdd2

Please sign in to comment.
You can’t perform that action at this time.