Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
14ed83d
add zh headers
Jun 17, 2024
ce11c16
add zh lang file without crowdin (sry alex) thanks to chatgpt
Jun 17, 2024
26788e3
Add dependabot
PandeoF1 Aug 9, 2024
ee42eba
Add issue template
PandeoF1 Aug 9, 2024
0ebae9d
fix: adapt bug_report for nodejs project
PandeoF1 Aug 12, 2024
28730bb
add travelingvendor map stuff
FaiThiX Aug 24, 2024
6bcb634
add traveling vendor commands for ingame and discord
FaiThiX Aug 25, 2024
10f299b
fixes and img change for testing
FaiThiX Sep 4, 2024
421121c
Merge branch 'alexemanuelol:master' into vendor
Sep 8, 2024
1651929
Merge branch 'alexemanuelol:master' into vendor
Sep 10, 2024
13665cf
changed the traveling vendor command from trvendor to vendor
FaiThiX Sep 10, 2024
631ed49
updated image links for the discord embed
FaiThiX Sep 10, 2024
797b9d4
update docs for traveling vendor
FaiThiX Sep 10, 2024
887de43
Merge branch 'alexemanuelol:master' into vendor
Sep 18, 2024
7872a12
changed spawned event message
FaiThiX Sep 18, 2024
56f253d
add vendor image. thanks to davinator for the image
FaiThiX Sep 18, 2024
778b1d3
Merge branch 'alexemanuelol:master' into vendor
Sep 23, 2024
591fdca
Merge pull request #9 from FaiThiX/vendor
FaiThiX Sep 26, 2024
42db13c
Merge branch 'alexemanuelol:master' into zh_lang
FaiThiX Sep 26, 2024
ec62adf
add cargoship/vendor translation
FaiThiX Sep 26, 2024
70efbd8
add voice actors
FaiThiX Sep 26, 2024
a9565da
Merge pull request #10 from FaiThiX/zh_lang
FaiThiX Sep 26, 2024
e23a34a
added halted and moving again setting
FaiThiX Sep 28, 2024
789dd16
Merge pull request #11 from FaiThiX/vendor
FaiThiX Sep 28, 2024
edac1c3
added missing translation
FaiThiX Sep 28, 2024
93ab844
Merge pull request #12 from FaiThiX/vendor
FaiThiX Sep 28, 2024
c94dadd
fixxed misspell
FaiThiX Sep 28, 2024
b1d1de5
Update FcmListener.js
FaiThiX Oct 1, 2024
7d2637e
Update FcmListenerLite.js
FaiThiX Oct 1, 2024
147599b
add information embed
FaiThiX Oct 12, 2024
2856cc0
vender -> vendor
FaiThiX Oct 12, 2024
b119c3f
Update lint.yml
FaiThiX Oct 12, 2024
9f94dc7
Merge pull request #13 from FaiThiX/vendor
FaiThiX Oct 12, 2024
25f9f94
Merge pull request #14 from FaiThiX/master
FaiThiX Oct 12, 2024
892ddfd
add missing zh translation
FaiThiX Oct 27, 2024
6bce184
Merge branch 'new_deploy' of https://github.com/FaiThiX/rustplusplus …
FaiThiX Oct 27, 2024
d5667eb
Merge pull request #15 from FaiThiX/fix_alarm
FaiThiX Oct 27, 2024
d38bf8f
changed/added missing translations (zh)
FaiThiX Oct 28, 2024
779bf9a
Merge branch 'new_deploy' of https://github.com/FaiThiX/rustplusplus …
FaiThiX Oct 28, 2024
6b39598
Merge pull request #16 from FaiThiX/new_deploy
FaiThiX Nov 4, 2024
02f7979
Merge pull request #17 from PandeoF1/ISSUE_TEMPLATE
FaiThiX Nov 4, 2024
8957fa5
Merge pull request #18 from PandeoF1/dependabot
FaiThiX Nov 4, 2024
6b8d04a
add devcontainer
FaiThiX Nov 16, 2024
60c6777
Bump actions/setup-node from 4.0.4 to 4.1.0
dependabot[bot] Nov 18, 2024
95e1458
Merge pull request #38 from FaiThiX/dependabot/github_actions/actions…
FaiThiX Nov 22, 2024
f7efc3c
Add Market Blacklist Command, Add Translations, Add Property to Insta…
FaiThiX Dec 14, 2024
582b884
add Blacklist Checking to the MapMarkers
FaiThiX Dec 15, 2024
6ce1c09
Add 'raid' command
cjensenius Dec 27, 2024
f0a9c8e
Add rudimentary in-game raid command
cjensenius Dec 27, 2024
1814c61
Provide error message when an item or building block is not found
cjensenius Dec 27, 2024
867bcb8
Fix for team chat duplicate message and add building block to the com…
cjensenius Dec 27, 2024
3d4b7a7
Search items before building blocks
cjensenius Dec 27, 2024
14eb118
Search items before building blocks
cjensenius Dec 27, 2024
1a247e1
Merge branch 'master' of https://github.com/FaiThiX/rustplusplus into…
cjensenius Jun 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "RustPlusPlus Dev Container",
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "22"
},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},

// Install npm packages and set up the development environment
"postCreateCommand": "npm install",

// Setup VS Code extensions
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-azuretools.vscode-docker"
]
}
},

"remoteEnv": {
"RPP_LANGUAGE": "en",
"RPP_POLLING_INTERVAL": "10000",
"RPP_LOG_CALL_STACK": "true",
"RPP_RECONNECT_INTERVAL": "15000",
"RPP_DISCORD_USERNAME": "RustPlusPlus",
"RPP_DISCORD_CLIENT_ID": "",
"RPP_DISCORD_TOKEN": "",
"RPP_NEED_ADMIN_PRIVILEGES": "false"
}
}
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: 'bug'

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- Hosting OS:
- Node Version (node -v):
- NPM Version (npm -v):
- Bot Version (git log -1):
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: 'enhancement'

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "docker" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 14, 16, 18 ]
node: [18, 20, 22 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v4.2.1
- uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node }}
cache: 'npm'
Expand Down
12 changes: 12 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.**
Expand Down
Binary file added docs/images/slash_commands/raid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 155 additions & 0 deletions src/commands/durability.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
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://www.gnu.org/licenses/>.

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;
},

getDurabilityData(raidItemName, raidItemId, client, guildId) {
let itemId = null;
if (raidItemName !== null) {
let item = null
if (!item) {
item = client.rustlabs.getClosestOtherNameByName(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;
}
else {
itemId = item;
}
}
else if (raidItemId !== null) {
if (client.items.itemExist(raidItemId)) {
itemId = raidItemId;
}
else {
return 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 null;
}

client.log(client.intlGet(null, 'infoCap'), client.intlGet(null, 'slashCommandValueChange', {
id: `${verifyId}`,
value: `${raidItemName} ${raidItemId}`
}));

const raidDetails = this.getDurabilityData(raidItemName, raidItemId, client, interaction);

if (raidDetails === 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;
}

await DiscordMessages.sendRaidMessage(interaction, raidDetails);
client.log(client.intlGet(null, 'infoCap'), client.intlGet(guildId, 'commandsRaidDesc'));
},
};
Loading