-
Notifications
You must be signed in to change notification settings - Fork 3
/
group_restrictions.js
42 lines (41 loc) · 971 Bytes
/
group_restrictions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var group_restrictions = [
{
grouping: ["Mayor", "Judge"],
restrictions: ["Exclusive"],
},
{
grouping: ["RM"],
restrictions: ["Faction", "Leader Godfather", "Leader Mafioso"],
},
{
grouping: ["RC"],
restrictions: ["Faction"],
},
{
grouping: ["VK"],
restrictions: ["Exclusive"],
},
{
grouping: ["VC"],
restrictions: ["Exclusive"],
},
{
grouping: ["RV"],
restrictions: ["Faction", "Leader VK"],
},
];
$(function() {
$("#group_restrictions").val(group_restrictions.map(function(entry) {
return entry.grouping.join(", ")+": "+entry.restrictions.join(", ");
}).join("\n"));
$("#group_restrictions").change(function() {
var lines = $("#group_restrictions").val().split(/\r\n|\r|\n/);
group_restrictions = lines.map(function(line) {
var parts = line.split(":");
return {
grouping: parts[0].split(",").map(s=>s.trim()).filter(s=>s),
restrictions: parts[1].split(",").map(s=>s.trim()).filter(s=>s),
};
});
});
});