From d953786c739daa9801ae0405f2f9794d1919f761 Mon Sep 17 00:00:00 2001 From: Chris Jensen Date: Thu, 26 Dec 2024 21:29:37 -0500 Subject: [PATCH 1/6] Add 'raid' command Adds a first iteration of the 'raid' command which will display the raid costs of an associated item --- docs/commands.md | 12 ++ docs/images/slash_commands/raid.png | Bin 0 -> 16924 bytes src/commands/durability.js | 180 ++++++++++++++++++++++++++++ src/discordTools/discordEmbeds.js | 30 +++++ src/discordTools/discordMessages.js | 9 ++ src/external/process_rustlabs.js | 5 +- src/languages/en.json | 3 + src/structures/RustLabs.js | 2 +- 8 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 docs/images/slash_commands/raid.png create mode 100644 src/commands/durability.js diff --git a/docs/commands.md b/docs/commands.md index 9dfd6ab22..a24806097 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -22,6 +22,7 @@ Slash Command | Description [**/map**](commands.md#map) | Get the currently connected server map image. [**/market**](commands.md#market) | Operations for In-Game Vending Machines. [**/players**](commands.md#players) | Get player/players information based on battlemetrics. +[**/raid**](commands.md#raid) | Display the raid costs for an item. [**/recycle**](commands.md#recycle) | Display the output of recycling an item. [**/research**](commands.md#research) | Display the cost to research an item. [**/reset**](commands.md#reset) | Reset Discord channels. @@ -224,6 +225,17 @@ Subcommand | Options | Description | Required ![Discord Slash Command players specific user Image](images/slash_commands/players_specific_user.png) +## **/raid** + +> **Display the raid costs for an item.** + +Subcommand | Options | Description | Required +---------- | ------- | ----------- | -------- +  | `name` | The name of the item to raid. | `False` +  | `id` | The id of the item to raid. | `False` + +![Discord Slash Command raid Image](images/slash_commands/raid.png) + ## **/recycle** > **Display the output of recycling an item.** diff --git a/docs/images/slash_commands/raid.png b/docs/images/slash_commands/raid.png new file mode 100644 index 0000000000000000000000000000000000000000..6295ea1bc59319c3df41147841bf821e79a352c3 GIT binary patch literal 16924 zcmdVCcT|&G6EEyJDk_Q`6;%3B4@eP^-a$ZmZ;6B^AORAJ(mPgAs!9({KnM_$&_WNW zN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zM*1coJw5Y1OBSMto9Ik(rCilFtHz3dT$-0`Hi`%q2I@9qInIl7OZf7JxDu-@_i^Ro z(eGfKuyfoKA|t8H_9?Z*E-Mfb>gM*I<$)S+&+Rj(k~(ku+*xWggeNXp`=f&@i}L>7 zG+O1)?`l?`QDk#;Q8+mZyatoXRj zl}}0NnRmJ>GL;|@_1a7DgIeJi1cM-?m2sttwjrap7MqoiYn4wnr^kKncOGR*nCP%} z26oo_Y0+lyk9OHWU?dx&iMN!aZDMC7wu_xG9|6(@iK%Qi zj5yKw-0)6T&S`~;=jQW!ykl*n=&s zhObifVqcTY__14d@AI)ou2g+@Jq#@?wW(bW6`AY8SEz^&f_mqb)GkWQc8d)<1s01mA{Qc+es+tzW1GQfD#jHJL-hLFT zYU@nTpYI3O1yu3U(dxs5lO>i3M+cBR;;}#c&B64}4Y;d43|;W?>Y<367QHf<67zn1 zIPt_mCWy0d>gys`e>qRB#j(U!(ey&tp%VJLE$PCjB#$J^Zty;F4>$3uR~|5@ zewDGf7&yuByX@$iqQrQmT5n~gB;t6S6BBRJ-05WcbH_B_0D~2g8AZBMKmU=!&#NYS zcvw2YQbj0MlKO_Vbj>olrIyi*<_VD@t18~WA%>V!Z literal 0 HcmV?d00001 diff --git a/src/commands/durability.js b/src/commands/durability.js new file mode 100644 index 000000000..a35310328 --- /dev/null +++ b/src/commands/durability.js @@ -0,0 +1,180 @@ +/* + Copyright (C) 2023 Alexander Emanuelsson (alexemanuelol) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + https://github.com/alexemanuelol/rustplusplus + +*/ + +const Builder = require('@discordjs/builders'); + +const DiscordEmbeds = require('../discordTools/discordEmbeds.js'); +const DiscordMessages = require('../discordTools/discordMessages.js'); + +module.exports = { + name: 'raid', + + getData(client, guildId) { + return new Builder.SlashCommandBuilder() + .setName('raid') + .setDescription(client.intlGet(guildId, 'commandsRaidDesc')) + .addStringOption(option => option + .setName('name') + .setDescription(client.intlGet(guildId, 'theNameOfTheItem')) + .setRequired(false)) + .addStringOption(option => option + .setName('id') + .setDescription(client.intlGet(guildId, 'theIdOfTheItem')) + .setRequired(false)); + }, + + + + /** + * Group durability data by group and toolId. + * @param {array} data The array of durability data objects. + * @return {object} The grouped durability data. + */ + groupDurabilityData(client, data) { + const groupedData = {}; + + for (const item of data) { + if (item.which === 'soft') continue; + + if (!groupedData[item.group]) { + groupedData[item.group] = {}; + } + + if (!groupedData[item.group][item.toolId]) { + groupedData[item.group][item.toolId] = []; + } + + groupedData[item.group][item.toolId].push({ + ...item, + 'itemName': client.items.getName(item.toolId) + }); + } + + return groupedData; + }, + + async execute(client, interaction) { + const guildId = interaction.guildId; + + const verifyId = Math.floor(100000 + Math.random() * 900000); + client.logInteraction(interaction, verifyId, 'slashCommand'); + + if (!await client.validatePermissions(interaction)) return; + await interaction.deferReply({ ephemeral: true }); + + const raidItemName = interaction.options.getString('name'); + const raidItemId = interaction.options.getString('id'); + const raidWithName = interaction.options.getString('raidwithname'); + + if (raidWithName !== null) { + let raidWithItem = null + if (!raidWithItem) { + raidWithItem = client.rustlabs.getClosestOtherNameByName(raidItemName); + } + + if (!raidWithItem) { + raidWithItem = client.rustlabs.getClosestBuildingBlockNameByName(raidItemName); + } + + if (!raidWithItem) { + raidWithItem = client.items.getClosestItemIdByName(raidItemName); + } + + if (raidWithItem === null) { + const str = client.intlGet(guildId, 'noItemWithNameFound', { + name: raidItemName + }); + await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); + client.log(client.intlGet(guildId, 'warningCap'), str); + return; + } + } + + let itemId = null; + if (raidItemName !== null) { + let item = null + if (!item) { + item = client.rustlabs.getClosestOtherNameByName(raidItemName); + } + + if (!item) { + item = client.rustlabs.getClosestBuildingBlockNameByName(raidItemName); + } + + if (!item) { + item = client.items.getClosestItemIdByName(raidItemName); + if(item !== null) { + item = client.items.getName(item); + } + } + + if (item === null) { + const str = client.intlGet(guildId, 'noItemWithNameFound', { + name: raidItemName + }); + await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); + client.log(client.intlGet(guildId, 'warningCap'), str); + return; + } + else { + itemId = item; + } + } + else if (raidItemId !== null) { + if (client.items.itemExist(raidItemId)) { + itemId = raidItemId; + } + else { + const str = client.intlGet(guildId, 'noItemWithIdFound', { + id: raidItemId + }); + await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); + client.log(client.intlGet(guildId, 'warningCap'), str); + return; + } + } + else if (raidItemName === null && raidItemId === null) { + const str = client.intlGet(guildId, 'noNameIdGiven'); + await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); + client.log(client.intlGet(guildId, 'warningCap'), str); + return; + } + const itemName = client.items.getName(itemId); + + const raidDetails = client.rustlabs.getDurabilityDetailsByName(raidItemName); + if (raidDetails === null) { + const str = client.intlGet(guildId, 'couldNotFindRaidDetails', { + name: itemName + }); + await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); + client.log(client.intlGet(guildId, 'warningCap'), str); + return; + } + + client.log(client.intlGet(null, 'infoCap'), client.intlGet(null, 'slashCommandValueChange', { + id: `${verifyId}`, + value: `${raidItemName} ${raidItemId}` + })); + + raidDetails[3] = this.groupDurabilityData(client, raidDetails[3]); + await DiscordMessages.sendRaidMessage(interaction, raidDetails); + client.log(client.intlGet(null, 'infoCap'), client.intlGet(guildId, 'commandsRaidDesc')); + }, +}; diff --git a/src/discordTools/discordEmbeds.js b/src/discordTools/discordEmbeds.js index c47e46359..cf989e60c 100644 --- a/src/discordTools/discordEmbeds.js +++ b/src/discordTools/discordEmbeds.js @@ -1121,6 +1121,36 @@ module.exports = { }); }, + getRaidEmbed: function (guildId, raidDetails) { + const raidCosts = { + name: '', + time: '', + sulfur: '' + }; + + const sortedItems = Object.values(raidDetails[3].explosive).sort((a, b) => { + const sulfurA = a[0].sulfur === null ? Infinity : Number(a[0].sulfur); + const sulfurB = b[0].sulfur === null ? Infinity : Number(b[0].sulfur); + return sulfurA - sulfurB; + }); + for (const item of sortedItems) { + raidCosts.name += `${item[0].itemName}\n`; + raidCosts.time += `${item[0].timeString} (${item[0].quantity})\n`; + raidCosts.sulfur += `${item[0].sulfur}\n`; + } + + return module.exports.getEmbed({ + title: `${raidDetails[1]}`, + color: Constants.COLOR_DEFAULT, + timestamp: true, + fields: [ + { name: Client.client.intlGet(guildId, 'name'), value: raidCosts.name.trim(), inline: true }, + { name: Client.client.intlGet(guildId, 'time'), value: raidCosts.time.trim(), inline: true }, + { name: Client.client.intlGet(guildId, 'sulfur'), value: raidCosts.sulfur.trim(), inline: true } + ] + }); + }, + getResearchEmbed: function (guildId, researchDetails) { let typeString = '', scrapString = ''; if (researchDetails[2].researchTable !== null) { diff --git a/src/discordTools/discordMessages.js b/src/discordTools/discordMessages.js index dcc2e0ee5..dbace5ab1 100644 --- a/src/discordTools/discordMessages.js +++ b/src/discordTools/discordMessages.js @@ -560,6 +560,15 @@ module.exports = { await Client.client.interactionEditReply(interaction, content); }, + sendRaidMessage: async function (interaction, raidDetails) { + const content = { + embeds: [DiscordEmbeds.getRaidEmbed(interaction.guildId, raidDetails)], + ephemeral: true + } + + await Client.client.interactionEditReply(interaction, content); + }, + sendResearchMessage: async function (interaction, researchDetails) { const content = { embeds: [DiscordEmbeds.getResearchEmbed(interaction.guildId, researchDetails)], diff --git a/src/external/process_rustlabs.js b/src/external/process_rustlabs.js index c12a68b40..e7b5f7a86 100644 --- a/src/external/process_rustlabs.js +++ b/src/external/process_rustlabs.js @@ -594,7 +594,10 @@ function processItemDurability(rustlabsName, shortname, name, data, type = 'item } if (toolShortname === null || toolName === null) exit(); toolId = Object.keys(ITEMS).find(e => ITEMS[e].shortname === toolShortname && ITEMS[e].name === toolName); - if (!toolId) exit(); + if (!toolId) { + console.error(`Tool ID not found for ${toolShortname} - ${toolName}`); + continue; // Skip this iteration and continue with the next match + } /* Caption in tool name */ let captionInTool = null; diff --git a/src/languages/en.json b/src/languages/en.json index bb5fb961d..79e7b9229 100644 --- a/src/languages/en.json +++ b/src/languages/en.json @@ -225,6 +225,7 @@ "commandsRecycleQuantityDesc": "The quantity of items to recycle.", "commandsRecycleRecyclerTypeDesc": "The recycler type (recycler, shredder, safe-zone-recycler).", "commandsResearchDesc": "Display the cost to research an item.", + "commandsRaidDesc": "Display the cost to destroy an item.", "commandsResetAlarmsDesc": "Reset alarms channel.", "commandsResetDesc": "Reset Discord channels.", "commandsResetInformationDesc": "Reset information channel.", @@ -297,6 +298,7 @@ "couldNotFindPlayerId": "Could not find player with id {id}.", "couldNotFindRecycleDetails": "Could not find recycle details for {name}.", "couldNotFindResearchDetails": "Could not find research details for {name}.", + "couldNotFindRaidDetails": "Could not find raid details for {name}.", "couldNotFindRole": "Could not find role: {roleId}", "couldNotFindStackDetails": "Could not find stack details for {name}.", "couldNotFindTeammate": "Could not find teammate: {name}.", @@ -682,6 +684,7 @@ "subscribeToChangesBattlemetrics": "Subscribe to different changes on Battlemetrics.", "subscriptionList": "Subscription list", "subscriptionListEmpty": "Item subscription list is empty.", + "sulfur": "Sulfur", "sulfurQuarry": "Sulfur Quarry", "switches": "Switches", "teamMember": "Team Member", diff --git a/src/structures/RustLabs.js b/src/structures/RustLabs.js index cf2a2bb6d..69f4fc434 100644 --- a/src/structures/RustLabs.js +++ b/src/structures/RustLabs.js @@ -529,7 +529,7 @@ class RustLabs { content = this.getArrayOrderedByChoice(content, orderedBy); - return ['items', id, this.items.items[id], content]; + return ['items', this.items.items[id].name, this.items.items[id], content]; } From 7b05e81f552de90c07680149c2f626e8b69c0764 Mon Sep 17 00:00:00 2001 From: Chris Jensen Date: Thu, 26 Dec 2024 23:38:07 -0500 Subject: [PATCH 2/6] Add rudimentary in-game raid command --- src/commands/durability.js | 97 ++++++++++----------------- src/handlers/discordCommandHandler.js | 4 ++ src/handlers/inGameCommandHandler.js | 4 ++ src/languages/en.json | 1 + src/structures/RustPlus.js | 27 ++++++++ 5 files changed, 72 insertions(+), 61 deletions(-) diff --git a/src/commands/durability.js b/src/commands/durability.js index a35310328..4552eb178 100644 --- a/src/commands/durability.js +++ b/src/commands/durability.js @@ -70,43 +70,7 @@ module.exports = { return groupedData; }, - async execute(client, interaction) { - const guildId = interaction.guildId; - - const verifyId = Math.floor(100000 + Math.random() * 900000); - client.logInteraction(interaction, verifyId, 'slashCommand'); - - if (!await client.validatePermissions(interaction)) return; - await interaction.deferReply({ ephemeral: true }); - - const raidItemName = interaction.options.getString('name'); - const raidItemId = interaction.options.getString('id'); - const raidWithName = interaction.options.getString('raidwithname'); - - if (raidWithName !== null) { - let raidWithItem = null - if (!raidWithItem) { - raidWithItem = client.rustlabs.getClosestOtherNameByName(raidItemName); - } - - if (!raidWithItem) { - raidWithItem = client.rustlabs.getClosestBuildingBlockNameByName(raidItemName); - } - - if (!raidWithItem) { - raidWithItem = client.items.getClosestItemIdByName(raidItemName); - } - - if (raidWithItem === null) { - const str = client.intlGet(guildId, 'noItemWithNameFound', { - name: raidItemName - }); - await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); - client.log(client.intlGet(guildId, 'warningCap'), str); - return; - } - } - + getDurabilityData(raidItemName, raidItemId, client, guildId) { let itemId = null; if (raidItemName !== null) { let item = null @@ -126,12 +90,7 @@ module.exports = { } if (item === null) { - const str = client.intlGet(guildId, 'noItemWithNameFound', { - name: raidItemName - }); - await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); - client.log(client.intlGet(guildId, 'warningCap'), str); - return; + return null; } else { itemId = item; @@ -142,38 +101,54 @@ module.exports = { itemId = raidItemId; } else { - const str = client.intlGet(guildId, 'noItemWithIdFound', { - id: raidItemId - }); - await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); - client.log(client.intlGet(guildId, 'warningCap'), str); - return; + return null; } } - else if (raidItemName === null && raidItemId === null) { + const itemName = client.items.getName(itemId); + + const raidDetails = client.rustlabs.getDurabilityDetailsByName(raidItemName); + if (raidDetails === null) { + return null; + } + + raidDetails[3] = this.groupDurabilityData(client, raidDetails[3]); + return raidDetails; + }, + + async execute(client, interaction) { + const guildId = interaction.guildId; + + const verifyId = Math.floor(100000 + Math.random() * 900000); + client.logInteraction(interaction, verifyId, 'slashCommand'); + + if (!await client.validatePermissions(interaction)) return; + await interaction.deferReply({ ephemeral: true }); + + const raidItemName = interaction.options.getString('name'); + const raidItemId = interaction.options.getString('id'); + if (raidItemName === null && raidItemId === null) { const str = client.intlGet(guildId, 'noNameIdGiven'); await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); client.log(client.intlGet(guildId, 'warningCap'), str); - return; + return null; } - const itemName = client.items.getName(itemId); + + client.log(client.intlGet(null, 'infoCap'), client.intlGet(null, 'slashCommandValueChange', { + id: `${verifyId}`, + value: `${raidItemName} ${raidItemId}` + })); + + const raidDetails = this.getDurabilityData(raidItemName, raidItemId, client, interaction); - const raidDetails = client.rustlabs.getDurabilityDetailsByName(raidItemName); if (raidDetails === null) { - const str = client.intlGet(guildId, 'couldNotFindRaidDetails', { - name: itemName + const str = client.intlGet(guildId, 'noItemWithNameFound', { + name: raidItemName }); await client.interactionEditReply(interaction, DiscordEmbeds.getActionInfoEmbed(1, str)); client.log(client.intlGet(guildId, 'warningCap'), str); return; } - client.log(client.intlGet(null, 'infoCap'), client.intlGet(null, 'slashCommandValueChange', { - id: `${verifyId}`, - value: `${raidItemName} ${raidItemId}` - })); - - raidDetails[3] = this.groupDurabilityData(client, raidDetails[3]); await DiscordMessages.sendRaidMessage(interaction, raidDetails); client.log(client.intlGet(null, 'infoCap'), client.intlGet(guildId, 'commandsRaidDesc')); }, diff --git a/src/handlers/discordCommandHandler.js b/src/handlers/discordCommandHandler.js index baf9f6bc4..89f4053cb 100644 --- a/src/handlers/discordCommandHandler.js +++ b/src/handlers/discordCommandHandler.js @@ -204,6 +204,10 @@ module.exports = { commandLowerCase === `${prefix}${client.intlGet(guildId, 'commandSyntaxTravelingVendor')}`) { response = rustplus.getCommandTravelingVendor(); } + else if (commandLowerCase === `${prefix}${client.intlGet('en', 'commandSyntaxRaid')}` || + commandLowerCase === `${prefix}${client.intlGet(guildId, 'commandSyntaxRaid')}`) { + response = rustplus.getCommandRaidCost(command); + } else { /* Smart Switches/ Group Switches are not currently supported through discord. */ return false; diff --git a/src/handlers/inGameCommandHandler.js b/src/handlers/inGameCommandHandler.js index 8d606ef74..6ea2d1699 100644 --- a/src/handlers/inGameCommandHandler.js +++ b/src/handlers/inGameCommandHandler.js @@ -211,6 +211,10 @@ module.exports = { commandLowerCase === `${prefix}${client.intlGet(guildId, 'commandSyntaxTravelingVendor')}`) { rustplus.sendInGameMessage(rustplus.getCommandTravelingVendor()); } + else if (commandLowerCase.startsWith(`${prefix}${client.intlGet('en', 'commandSyntaxRaid')}`) || + commandLowerCase.startsWith(`${prefix}${client.intlGet(guildId, 'commandSyntaxRaid')}`)) { + rustplus.sendInGameMessage(rustplus.getCommandRaidCost(command)); + } else { /* Maybe a custom command? */ diff --git a/src/languages/en.json b/src/languages/en.json index 79e7b9229..bc51149bb 100644 --- a/src/languages/en.json +++ b/src/languages/en.json @@ -142,6 +142,7 @@ "commandSyntaxPlayers": "players", "commandSyntaxPop": "pop", "commandSyntaxProx": "prox", + "commandSyntaxRaid": "raid", "commandSyntaxRecycle": "recycle", "commandSyntaxRemove": "remove", "commandSyntaxResearch": "research", diff --git a/src/structures/RustPlus.js b/src/structures/RustPlus.js index 39820fa6a..1d2074c54 100644 --- a/src/structures/RustPlus.js +++ b/src/structures/RustPlus.js @@ -38,6 +38,7 @@ const Map = require('../util/map.js'); const RustPlusLite = require('../structures/RustPlusLite'); const TeamHandler = require('../handlers/teamHandler.js'); const Timer = require('../util/timer.js'); +const Durability = require('../commands/durability.js'); const TOKENS_LIMIT = 24; /* Per player */ const TOKENS_REPLENISH = 3; /* Per second */ @@ -2746,6 +2747,32 @@ class RustPlus extends RustPlusLib { return strings; } + + getCommandRaidCost(command) { + const prefix = this.generalSettings.prefix; + const commandRaid = `${prefix}${Client.client.intlGet(this.guildId, 'commandSyntaxRaid')}`; + const commandRaidEn = `${prefix}${Client.client.intlGet('en', 'commandSyntaxRaid')}`; + if (command.toLowerCase().startsWith(`${commandRaid} `)) { + command = command.slice(`${commandRaid} `.length).trim(); + } + else { + command = command.slice(`${commandRaidEn} `.length).trim(); + } + + const durability = Durability.getDurabilityData(command, null, Client.client, this.guildId); + let raidCosts = ""; + + const sortedItems = Object.values(durability[3].explosive).sort((a, b) => { + const sulfurA = a[0].sulfur === null ? Infinity : Number(a[0].sulfur); + const sulfurB = b[0].sulfur === null ? Infinity : Number(b[0].sulfur); + return sulfurA - sulfurB; + }).slice(0,3); + for (const item of sortedItems) { + raidCosts += `${item[0].itemName} ${item[0].timeString} (${item[0].quantity}) ${item[0].sulfur}, `; + } + + return raidCosts; + } } module.exports = RustPlus; From b0e9b15a25f18ebb2b37d69579276a28c41e8943 Mon Sep 17 00:00:00 2001 From: Chris Jensen Date: Fri, 27 Dec 2024 09:33:09 -0500 Subject: [PATCH 3/6] Provide error message when an item or building block is not found --- src/structures/RustPlus.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/structures/RustPlus.js b/src/structures/RustPlus.js index 1d2074c54..e86c85033 100644 --- a/src/structures/RustPlus.js +++ b/src/structures/RustPlus.js @@ -2761,6 +2761,12 @@ class RustPlus extends RustPlusLib { const durability = Durability.getDurabilityData(command, null, Client.client, this.guildId); let raidCosts = ""; + + if(!durability) { + return Client.client.intlGet(this.guildId, 'noItemWithNameFound', { + name: command + }); + } const sortedItems = Object.values(durability[3].explosive).sort((a, b) => { const sulfurA = a[0].sulfur === null ? Infinity : Number(a[0].sulfur); From e28048986a72fc8c9adb12bb4fac8431caef73a5 Mon Sep 17 00:00:00 2001 From: Chris Jensen Date: Fri, 27 Dec 2024 09:56:58 -0500 Subject: [PATCH 4/6] Fix for team chat duplicate message and add building block to the command response Fix issue where the command response was being sent to team chat in discord due to trailing whitespace, add building block name to the command response --- src/structures/RustPlus.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/RustPlus.js b/src/structures/RustPlus.js index e86c85033..0461d9fe4 100644 --- a/src/structures/RustPlus.js +++ b/src/structures/RustPlus.js @@ -2760,7 +2760,7 @@ class RustPlus extends RustPlusLib { } const durability = Durability.getDurabilityData(command, null, Client.client, this.guildId); - let raidCosts = ""; + let raidCosts = `${durability[1]}: `; if(!durability) { return Client.client.intlGet(this.guildId, 'noItemWithNameFound', { @@ -2777,7 +2777,7 @@ class RustPlus extends RustPlusLib { raidCosts += `${item[0].itemName} ${item[0].timeString} (${item[0].quantity}) ${item[0].sulfur}, `; } - return raidCosts; + return raidCosts.trim().trim(","); } } From 787a6f5ca416a3babd34b63bb813a59e96b6dfdd Mon Sep 17 00:00:00 2001 From: Chris Jensen Date: Fri, 27 Dec 2024 12:24:51 -0500 Subject: [PATCH 5/6] Search items before building blocks When returning the durability information, search building blocks last so we do not return "Armored Floor" when searching for "Armored Door" --- src/commands/durability.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/durability.js b/src/commands/durability.js index 4552eb178..d6510bdde 100644 --- a/src/commands/durability.js +++ b/src/commands/durability.js @@ -77,17 +77,17 @@ module.exports = { if (!item) { item = client.rustlabs.getClosestOtherNameByName(raidItemName); } - - if (!item) { - item = client.rustlabs.getClosestBuildingBlockNameByName(raidItemName); - } - + if (!item) { item = client.items.getClosestItemIdByName(raidItemName); if(item !== null) { item = client.items.getName(item); } } + + if (!item) { + item = client.rustlabs.getClosestBuildingBlockNameByName(raidItemName); + } if (item === null) { return null; From 69784cb5c19d1ec1b4ae8c994217c243cdb38a3f Mon Sep 17 00:00:00 2001 From: Chris Jensen Date: Fri, 27 Dec 2024 13:36:45 -0500 Subject: [PATCH 6/6] Search items before building blocks Resolve bug where Armored Floor was being returned instead of Armored Door --- src/structures/RustLabs.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/structures/RustLabs.js b/src/structures/RustLabs.js index 69f4fc434..7db9ce46f 100644 --- a/src/structures/RustLabs.js +++ b/src/structures/RustLabs.js @@ -469,10 +469,10 @@ class RustLabs { } if (!foundName) { - foundName = this.getClosestBuildingBlockNameByName(name); + foundName = this.items.getClosestItemIdByName(name); if (foundName) { - if (this.durabilityData['buildingBlocks'].hasOwnProperty(foundName)) { - type = 'buildingBlocks'; + if (this.durabilityData['items'].hasOwnProperty(foundName)) { + return this.getDurabilityDetailsById(foundName, group, which, orderedBy); } else { foundName = null; @@ -481,10 +481,10 @@ class RustLabs { } if (!foundName) { - foundName = this.items.getClosestItemIdByName(name); + foundName = this.getClosestBuildingBlockNameByName(name); if (foundName) { - if (this.durabilityData['items'].hasOwnProperty(foundName)) { - return this.getDurabilityDetailsById(foundName, group, which, orderedBy); + if (this.durabilityData['buildingBlocks'].hasOwnProperty(foundName)) { + type = 'buildingBlocks'; } else { foundName = null;