mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 20:43: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
|
```json
|
||||||
true
|
true
|
||||||
```
|
```
|
||||||
|
#### factionsBlacklist
|
||||||
|
###### Description
|
||||||
|
factions to exclude in map vote. ( ex: ['CAF'] )
|
||||||
|
###### Default
|
||||||
|
```json
|
||||||
|
[]
|
||||||
|
```
|
||||||
#### minRaasEntries
|
#### minRaasEntries
|
||||||
###### Description
|
###### Description
|
||||||
Minimum amount of RAAS layers in the vote list.
|
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" ],
|
"layerLevelBlacklist": [ "BlackCoast_Seed" ],
|
||||||
"layerLevelWhitelist": [ "Yeho", "Gorodok", "Mutaha", "Narva", "Tallil" ],
|
"layerLevelWhitelist": [ "Yeho", "Gorodok", "Mutaha", "Narva", "Tallil" ],
|
||||||
"applyBlacklistToWhitelist": true,
|
"applyBlacklistToWhitelist": true,
|
||||||
|
"factionsBlacklist": [ "CAF", "INS" ],
|
||||||
"minRaasEntries": 2,
|
"minRaasEntries": 2,
|
||||||
"hideVotesCount": false,
|
"hideVotesCount": false,
|
||||||
"showRerollOption": 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',
|
description: 'if set to true the blacklisted layers won\'t be included also in whitelist mode',
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
factionsBlacklist: {
|
||||||
|
required: false,
|
||||||
|
description: "factions to exclude in map vote. ( ex: ['CAF'] )",
|
||||||
|
default: []
|
||||||
|
},
|
||||||
minRaasEntries: {
|
minRaasEntries: {
|
||||||
required: false,
|
required: false,
|
||||||
description: 'Minimum amount of RAAS layers in the vote list.',
|
description: 'Minimum amount of RAAS layers in the vote list.',
|
||||||
@ -485,10 +490,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.tallies = [];
|
this.tallies = [];
|
||||||
this.factionStrings = [];
|
this.factionStrings = [];
|
||||||
let rnd_layers = [];
|
let rnd_layers = [];
|
||||||
// let rnd_layers = [];
|
|
||||||
|
|
||||||
|
|
||||||
const removeCafLayers = true;
|
|
||||||
const sanitizedLayers = Layers.layers.filter((l) => l.layerid && l.map);
|
const sanitizedLayers = Layers.layers.filter((l) => l.layerid && l.map);
|
||||||
const maxOptions = this.options.showRerollOption ? 5 : 6;
|
const maxOptions = this.options.showRerollOption ? 5 : 6;
|
||||||
if (!cmdLayers || cmdLayers.length == 0) {
|
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)))
|
&& !(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++) {
|
for (let i = 1; i <= maxOptions; i++) {
|
||||||
const needMoreRAAS = !bypassRaasFilter && rnd_layers.filter((l) => l.gamemode === 'RAAS').length < this.options.minRaasEntries;
|
const needMoreRAAS = !bypassRaasFilter && rnd_layers.filter((l) => l.gamemode === 'RAAS').length < this.options.minRaasEntries;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user