mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 18:23:52 -06:00
feat: configurable faction filter
This commit is contained in:
parent
9fb426b263
commit
f54cdf3aa4
@ -120,6 +120,13 @@ If set to true the blacklisted layers will be filtered out also in whitelist mod
|
||||
```json
|
||||
true
|
||||
```
|
||||
#### factionsBlacklist
|
||||
###### Description
|
||||
factions to exclude in map vote. ( ex: ['CAF'] )
|
||||
###### Default
|
||||
```json
|
||||
[]
|
||||
```
|
||||
#### minRaasEntries
|
||||
###### Description
|
||||
Minimum amount of RAAS layers in the vote list.
|
||||
@ -219,6 +226,7 @@ Array of timeframes that allows to override options based on local time. See exa
|
||||
"layerLevelBlacklist": [ "BlackCoast_Seed" ],
|
||||
"layerLevelWhitelist": [ "Yeho", "Gorodok", "Mutaha", "Narva", "Tallil" ],
|
||||
"applyBlacklistToWhitelist": true,
|
||||
"factionsBlacklist": [ "CAF", "INS" ],
|
||||
"minRaasEntries": 2,
|
||||
"hideVotesCount": false,
|
||||
"showRerollOption": false,
|
||||
|
12
mapvote.js
12
mapvote.js
@ -88,6 +88,11 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
description: 'if set to true the blacklisted layers won\'t be included also in whitelist mode',
|
||||
default: true
|
||||
},
|
||||
factionsBlacklist: {
|
||||
required: false,
|
||||
description: "factions to exclude in map vote. ( ex: ['CAF'] )",
|
||||
default: []
|
||||
},
|
||||
minRaasEntries: {
|
||||
required: false,
|
||||
description: 'Minimum amount of RAAS layers in the vote list.',
|
||||
@ -485,10 +490,7 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
this.tallies = [];
|
||||
this.factionStrings = [];
|
||||
let rnd_layers = [];
|
||||
// let rnd_layers = [];
|
||||
|
||||
|
||||
const removeCafLayers = true;
|
||||
|
||||
const sanitizedLayers = Layers.layers.filter((l) => l.layerid && l.map);
|
||||
const maxOptions = this.options.showRerollOption ? 5 : 6;
|
||||
if (!cmdLayers || cmdLayers.length == 0) {
|
||||
@ -506,7 +508,7 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
&& !(this.options.applyBlacklistToWhitelist && this.options.layerLevelBlacklist.find((fl) => this.getLayersFromStringId(fl).map((e) => e.layerid).includes(l.layerid)))
|
||||
)
|
||||
)
|
||||
&& !(removeCafLayers && [ getTranslation(l.teams[ 0 ].faction), getTranslation(l.teams[ 1 ].faction) ].includes("CAF"))
|
||||
&& !(removeCafLayers && this.options.factionsBlacklist.find((f)=>[ getTranslation(l.teams[ 0 ].faction), getTranslation(l.teams[ 1 ].faction) ].includes(f)))
|
||||
);
|
||||
for (let i = 1; i <= maxOptions; i++) {
|
||||
const needMoreRAAS = !bypassRaasFilter && rnd_layers.filter((l) => l.gamemode === 'RAAS').length < this.options.minRaasEntries;
|
||||
|
Loading…
x
Reference in New Issue
Block a user