diff --git a/README.md b/README.md index 12f8c36..c346254 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ ITEM|RATE `grenade`|`1/5` `blaster`|`1/5` `tnt`|`1/25` -`silver bullet`|`1/1000` +`silver bullet`|`1/250` Each of these rates get pulled 3 times, then the result is added to your inventory. It's theoretically possible to get 3 of each item. @@ -120,7 +120,7 @@ COMMAND|FUNCTION|USER|ALIASES|DISABLEABLE COMMAND|FUNCTION|USER|ALIASES|DISABLEABLE -|-|-|-|- -`getloot`|Get a random assortment of items and qbucks every 10 minutes. [(drop rates)](#lootbox)|anyone|`getloot` `loot` `dig`|:white_check_mark: +`getloot`|Get a random assortment of items and qbucks every 10 minutes. [(drop rates)](#lootbox)|anyone|`getloot` `loot` `dig` `mine`|:white_check_mark: `iteminfo {item}`|Get item function and aliases|anyone|`iteminfo` `itemhelp` `info`|:white_check_mark: `inventory [target]`|Get inventory contents of target or self|anyone|`inventory` `inv` `pocket`|:white_check_mark: `getprices`|Get the current price of items in the shop|anyone|`getprices` `prices` `shop`|:white_check_mark: diff --git a/src/commands/getloot.ts b/src/commands/getloot.ts index 7eae391..3084dd6 100644 --- a/src/commands/getloot.ts +++ b/src/commands/getloot.ts @@ -12,16 +12,18 @@ const COOLDOWN = 10 * 60 * 1000; // 10 mins (ms) export default new Command({ name: 'getloot', - aliases: ['getloot', 'dig', 'loot'], + aliases: ['getloot', 'dig', 'loot', 'mine'], usertype: 'chatter', execution: async (msg, user) => { if (!await redis.exists('streamIsLive')) { await sendMessage(`No loot while stream is offline`, msg.messageId); return; }; if (await isInvuln(msg.chatterId) && !streamerUsers.includes(msg.chatterId)) { await sendMessage(`You're no longer an invuln because used a lootbox.`, msg.messageId); await removeInvuln(msg.chatterId); }; if (await user.itemLock()) { await sendMessage(`Cannot get loot (itemlock)`, msg.messageId); return; }; + await user.setLock(); const userData = await getUserRecord(user); const lastlootbox = userData.lastlootbox.getTime(); const now = Date.now(); if ((lastlootbox + COOLDOWN) > now) { + await user.clearLock(); if (await user.greedy()) { await Promise.all([ sendMessage(`${user.displayName} STOP BEING GREEDY!!! UltraMad UltraMad UltraMad`), @@ -38,7 +40,6 @@ export default new Command({ }; await user.clearGreed(); - await user.setLock(); userData.lastlootbox = new Date(now); @@ -49,13 +50,14 @@ export default new Command({ grenade: 0, blaster: 0, tnt: 0, + silverbullet: 0 }; for (let i = 0; i < 3; i++) { - if (Math.floor(Math.random() * 5) === 0) itemDiff.grenade! += 1; - if (Math.floor(Math.random() * 5) === 0) itemDiff.blaster! += 1; - if (Math.floor(Math.random() * 25) === 0) itemDiff.tnt! += 1; - if (Math.floor(Math.random() * 1000) === 0) itemDiff.silverbullet! += 1; + if (Math.floor(Math.random() * 5) === 0) itemDiff.grenade! += 1; // 1 in 5 + if (Math.floor(Math.random() * 5) === 0) itemDiff.blaster! += 1; // 1 in 5 + if (Math.floor(Math.random() * 25) === 0) itemDiff.tnt! += 1; // 1 in 25 + if (Math.floor(Math.random() * 250) === 0) itemDiff.silverbullet! += 1; // 1 in 250 }; for (const [item, amount] of Object.entries(itemDiff) as [items, number][]) {