Skip to content

Commit

Permalink
added halted and moving again setting
Browse files Browse the repository at this point in the history
  • Loading branch information
FaiThiX committed Sep 28, 2024
1 parent 778b1d3 commit e23a34a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,12 @@
"trademarkShownBeforeMessage": "{trademark} will be shown before messages.",
"trainYard": "Train Yard",
"travelingVendorDetectedSetting": "When the Traveling Vendor is detected, send a notification.",
"travelingVendorHaltedAt": "The Traveling Vendor stoped at {location}.",
"travelingVendorLeftSetting": "When the Traveling Vendor left the map, send a notification.",
"travelingVendorLocatedAt": "The Traveling Vendor is located at {location}.",
"travelingVendorLeftMap" : "The Traveling Vendor just left the map at {location}.",
"travelingVendorNotCurrentlyOnMap": "The Traveling Vendor is not currently on the map.",
"travelingVendorResumedAt": "The Traveling Vendor resumed moving at {location}.",
"travelingVendorSpawnedAt": "The Traveling Vendor spawned at {location}.",
"turnOffCap": "TURN OFF",
"turnOnCap": "TURN ON",
Expand Down
23 changes: 23 additions & 0 deletions src/structures/MapMarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ class MapMarkers {
let pos = Map.getPos(marker.x, marker.y, mapSize, this.rustplus);

marker.location = pos;
marker.isHalted = false;

this.rustplus.sendEvent(
this.rustplus.notificationSettings.travelingVendorDetectedSetting,
Expand Down Expand Up @@ -751,6 +752,28 @@ class MapMarkers {
let pos = Map.getPos(marker.x, marker.y, mapSize, this.rustplus);
let travelingVendor = this.getMarkerByTypeId(this.types.TravelingVendor, marker.id);

/* If TravelingVendor is halted */
if (!this.rustplus.isFirstPoll && !travelingVendor.isHalted) {
if (marker.x === travelingVendor.x && marker.y === travelingVendor.y) {
travelingVendor.isHalted = true;
this.rustplus.sendEvent(
this.rustplus.notificationSettings.travelingVendorHaltedSetting,
this.client.intlGet(this.rustplus.guildId, 'travelingVendorHaltedAt', { location: pos.string }),
'vendor',
Constants.COLOR_TRAVELING_VENDOR_HALTED);
}
}
/* If TravelingVendor is moving again */
else if (!this.rustplus.isFirstPoll && travelingVendor.isHalted) {
if (marker.x !== travelingVendor.x || marker.y !== travelingVendor.y) {
travelingVendor.isHalted = false;
this.rustplus.sendEvent(
this.rustplus.notificationSettings.travelingVendorHaltedSetting,
this.client.intlGet(this.rustplus.guildId, 'travelingVendorResumedAt', { location: pos.string }),
'vendor',
Constants.COLOR_TRAVELING_VENDOR_MOVING);
}
}
travelingVendor.x = marker.x;
travelingVendor.y = marker.y;
travelingVendor.location = pos;
Expand Down
6 changes: 6 additions & 0 deletions src/templates/notificationSettingsTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
"inGame": false,
"voice": true
},
"travelingVendorHaltedSetting": {
"image": "traveling_vendor_logo.png",
"discord": true,
"inGame": false,
"voice": true
},
"travelingVendorLeftSetting": {
"image": "traveling_vendor_logo.png",
"discord": true,
Expand Down
6 changes: 4 additions & 2 deletions src/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ module.exports = {
COLOR_PATROL_HELICOPTER_TRACER: '#00FF00',
COLOR_SETTINGS: '#861C0C',
COLOR_TEAMCHAT_DEFAULT: '#CE412B',
COLOR_TRAVELING_VENDOR_LOCATED_AT: '#FFD700',
COLOR_TRAVELING_VENDOR_LEFT_MAP: '#FF4500',
COLOR_TRAVELING_VENDOR_HALTED: '#98C4D8',
COLOR_TRAVELING_VENDOR_LOCATED_AT: '#F4A3E2',
COLOR_TRAVELING_VENDOR_LEFT_MAP: '#5A3E9A',
COLOR_TRAVELING_VENDOR_MOVING: '#7FCE41',

GET_STEAM_PROFILE_LINK: function (steamId) {
return `[${steamId}](${this.STEAM_PROFILES_URL}${steamId})`;
Expand Down

0 comments on commit e23a34a

Please sign in to comment.