-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandomItems.sh
executable file
·33 lines (27 loc) · 1.1 KB
/
RandomItems.sh
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
#!/usr/bin/env bash
# NOTE: Using modulo doesn't typically generate precisely evenly distributed random results, but it's close enough for purposes of this mod.
# Randomly disable items, but purposefully leave in the Nation specific items.
DISABLED_PERCENTAGE=$1
# Which ids are candidates for disablement was determined just by visual inspection in the Dom4 Mod Inspector.
DisablementCandidates=($(seq 0 499)) # according to the mod manual that's the range of all standard items
National=(37 152 380 382 386)
# Remove all items we want to make sure we're keeping from the DisablementCandidates
for i in ${National[@]}
do
DisablementCandidates[i]=''
done
DisablementCandidates=(`echo ${DisablementCandidates[@]}`)
echo '#modname "RandomItems"'
echo '#description "Remove a random selection of items. All National items will always be kept."'
echo "#version 1.00"
for i in ${DisablementCandidates[@]}
do
# create a number from 0-99.
number=$RANDOM
let "number %= 100"
if [ "$number" -lt $DISABLED_PERCENTAGE ]; then
echo "#selectitem $i"
echo "#constlevel 12"
echo "#end"
fi
done