const Reward = require("../Game/Reward"); const rewardCallback = require("../Callbacks/reward"); const MojoRemovedPacket = require("../Packets/MojoRemoved"); const MAXIMUM_BATCH_COUNT_MOJO = 1000; const cauldronReward = new Reward({ distributionType: 2, baseReward: { 3: { 5: { amountMinimum: 1500, chance: 16.5 }, 6: { amountMinimum: 1500, chance: 16.5 }, 7: { amountMinimum: 1500, chance: 16.5 }, 8: { amountMinimum: 1500, chance: 16.5 }, 9: { amountMinimum: 1500, chance: 16.5 } }, 7: { 10: { amountMinimum: 1, amountMaximum: 5, chance: 16.5 } }, 5: { 17: { amountMinimum: 1, chance: 20 } } } }); module.exports = function (ws, message, player) { let amount = message.getUint16(1); if (!amount) return if (amount > MAXIMUM_BATCH_COUNT_MOJO) amount = MAXIMUM_BATCH_COUNT_MOJO; const usedAmount = player.inventory.alterAmount(1, 3, amount); if (!usedAmount) return const playerInventory = player.inventory.getPosessions(); cauldronReward.single(usedAmount, playerInventory, rewards => rewardCallback({ isRegular: false, authorID: player.id, rewards, source: {} })); const packet = MojoRemovedPacket(usedAmount); player.map.registerIndividualNetworkPacket(player.id, packet); // global.test.accumulateItem(`${player.id}-1-3`, -amount); };