mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-24 00:13:52 -06:00
renamed allowedMapDuplicates to allowedSameMapEntries
This commit is contained in:
parent
c36ce5570e
commit
4e54fec8e7
@ -119,7 +119,7 @@ Message that is sent as broadcast to announce a vote.
|
|||||||
```json
|
```json
|
||||||
"✯ MAPVOTE ✯ Vote for the next map by writing in chat the corresponding number!"
|
"✯ MAPVOTE ✯ Vote for the next map by writing in chat the corresponding number!"
|
||||||
```
|
```
|
||||||
#### allowedMapDuplicates
|
#### allowedSameMapEntries
|
||||||
###### Description
|
###### Description
|
||||||
Allowed NUMBER of duplicate map entries in vote list.
|
Allowed NUMBER of duplicate map entries in vote list.
|
||||||
###### Default
|
###### Default
|
||||||
@ -184,7 +184,7 @@ Array of timeframes that allows to override options based on local time. See exa
|
|||||||
"hideVotesCount": false,
|
"hideVotesCount": false,
|
||||||
"showRerollOption": false,
|
"showRerollOption": false,
|
||||||
"voteBroadcastMessage": "✯ MAPVOTE ✯ Vote for the next map by writing in chat the corresponding number!",
|
"voteBroadcastMessage": "✯ MAPVOTE ✯ Vote for the next map by writing in chat the corresponding number!",
|
||||||
"allowedMapDuplicates": 1,
|
"allowedSameMapEntries": 1,
|
||||||
"logToDiscord": true,
|
"logToDiscord": true,
|
||||||
"channelID": "112233445566778899",
|
"channelID": "112233445566778899",
|
||||||
"timezone": 2,
|
"timezone": 2,
|
||||||
|
@ -95,7 +95,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
description: 'Message that is sent as broadcast to announce a vote',
|
description: 'Message that is sent as broadcast to announce a vote',
|
||||||
default: "✯ MAPVOTE ✯\nVote for the next map by writing in chat the corresponding number!"
|
default: "✯ MAPVOTE ✯\nVote for the next map by writing in chat the corresponding number!"
|
||||||
},
|
},
|
||||||
allowedMapDuplicates: {
|
allowedSameMapEntries: {
|
||||||
required: false,
|
required: false,
|
||||||
description: 'Allowed NUMBER of duplicate map entries in vote list',
|
description: 'Allowed NUMBER of duplicate map entries in vote list',
|
||||||
default: 1
|
default: 1
|
||||||
@ -468,7 +468,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
);
|
);
|
||||||
for (let i = 1; i <= maxOptions; i++) {
|
for (let i = 1; i <= maxOptions; i++) {
|
||||||
let l, maxtries = 10;
|
let l, maxtries = 10;
|
||||||
do l = randomElement(all_layers); while ((rnd_layers.find(lf => lf.layerid == l.layerid) || rnd_layers.filter(lf => lf.map.name == l.map.name).length > (this.options.allowedMapDuplicates-1)) && --maxtries >= 0)
|
do l = randomElement(all_layers); while ((rnd_layers.find(lf => lf.layerid == l.layerid) || rnd_layers.filter(lf => lf.map.name == l.map.name).length > (this.options.allowedSameMapEntries-1)) && --maxtries >= 0)
|
||||||
if (maxtries > 0) {
|
if (maxtries > 0) {
|
||||||
rnd_layers.push(l);
|
rnd_layers.push(l);
|
||||||
this.nominations[ i ] = l.layerid
|
this.nominations[ i ] = l.layerid
|
||||||
@ -493,7 +493,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
const cls = cl.split('_');
|
const cls = cl.split('_');
|
||||||
const fLayers = sanitizedLayers.filter((l) => ((cls[ 0 ] == "*" || l.layerid.toLowerCase().startsWith(cls[ 0 ])) && (l.gamemode.toLowerCase().startsWith(cls[ 1 ]) || (!cls[ 1 ] && [ 'RAAS', 'AAS', 'INVASION' ].includes(l.gamemode.toUpperCase()))) && (!cls[ 2 ] || l.version.toLowerCase().startsWith("v" + cls[ 2 ].replace(/v/gi, '')))));
|
const fLayers = sanitizedLayers.filter((l) => ((cls[ 0 ] == "*" || l.layerid.toLowerCase().startsWith(cls[ 0 ])) && (l.gamemode.toLowerCase().startsWith(cls[ 1 ]) || (!cls[ 1 ] && [ 'RAAS', 'AAS', 'INVASION' ].includes(l.gamemode.toUpperCase()))) && (!cls[ 2 ] || l.version.toLowerCase().startsWith("v" + cls[ 2 ].replace(/v/gi, '')))));
|
||||||
let l, maxtries = 10;
|
let l, maxtries = 10;
|
||||||
do l = randomElement(fLayers); while ((rnd_layers.filter(lf => lf.map.name == l.map.name).length > (this.options.allowedMapDuplicates-1)) && --maxtries >= 0)
|
do l = randomElement(fLayers); while ((rnd_layers.filter(lf => lf.map.name == l.map.name).length > (this.options.allowedSameMapEntries-1)) && --maxtries >= 0)
|
||||||
if (l) {
|
if (l) {
|
||||||
rnd_layers.push(l);
|
rnd_layers.push(l);
|
||||||
this.nominations[ i ] = l.layerid
|
this.nominations[ i ] = l.layerid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user