-
Notifications
You must be signed in to change notification settings - Fork 7
/
helper.sh
80 lines (67 loc) · 2.5 KB
/
helper.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
# SELECTION
#####################################
echo ""
echo "[${green}1${reset}] Change towers to 'regular'"
echo "[${green}2${reset}] Change towers to 'fwaystones'"
echo "[${green}3${reset}] Change towers to 'waystones'"
echo ""
read -p "Select your option [${green}1${reset}/${green}2${reset}/${green}3${reset}]: " input
# VARIABLES
#####################################
templatePool="data/totw_reworked/worldgen/template_pool"
derelict="derelict"
derelictGrass="derelict_grass"
ice="ice"
jungle="jungle"
ocean="ocean"
oceanWarm="ocean_warm"
regular="regular"
topFileName="top.json"
intendation=" "
regularPrefix=""
fabricWaystonesPrefix="fwaystones_"
waystonesPrefix="waystone_"
function replaceLocation() {
fileName="data/totw_reworked/worldgen/template_pool/$2/$topFileName"
oldLocation="\"location\": "
newLocation="$intendation\"location\": \"totw_reworked:$2/$1$2_tower_top\","
#sed -i '/"location"/c\\t\t\t\t"location": "totw_reworked:derelict\/fwaystones_derelict_tower_top",' data/totw_reworked/worldgen/template_pool/derelict/top.json
sed -i "/$oldLocation/c\\$newLocation" $fileName
}
# REGULAR TOWERS
#####################################
if [ $input -eq 1 ]; then
replaceLocation "$regularPrefix" "$derelict"
replaceLocation "$regularPrefix" "$derelictGrass"
replaceLocation "$regularPrefix" "$ice"
replaceLocation "$regularPrefix" "$jungle"
replaceLocation "$regularPrefix" "$ocean"
replaceLocation "$regularPrefix" "$oceanWarm"
replaceLocation "$regularPrefix" "$regular"
fi
# FABRIC WAYSTONES TOWERS
#####################################
if [ $input -eq 2 ]; then
replaceLocation "$fabricWaystonesPrefix" "$derelict"
replaceLocation "$fabricWaystonesPrefix" "$derelictGrass"
replaceLocation "$fabricWaystonesPrefix" "$ice"
replaceLocation "$fabricWaystonesPrefix" "$jungle"
replaceLocation "$fabricWaystonesPrefix" "$ocean"
replaceLocation "$fabricWaystonesPrefix" "$oceanWarm"
replaceLocation "$fabricWaystonesPrefix" "$regular"
fi
# WAYSTONES TOWERS
#####################################
if [ $input -eq 3 ]; then
replaceLocation "$waystonesPrefix" "$derelict"
replaceLocation "$waystonesPrefix" "$derelictGrass"
replaceLocation "$waystonesPrefix" "$ice"
replaceLocation "$waystonesPrefix" "$jungle"
replaceLocation "$waystonesPrefix" "$ocean"
replaceLocation "$waystonesPrefix" "$oceanWarm"
replaceLocation "$waystonesPrefix" "$regular"
fi