This repository has been archived by the owner on Sep 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPrepareMapTemplate.gsl
133 lines (116 loc) · 2.62 KB
/
PrepareMapTemplate.gsl
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Simple GMSI script to groom stock units and abilities
echoln("Starting YARP initialization script.\n
This script is meant to install YARP required technical units into the map,
as well as create buildings and builder units, and set up other things.");
include("dialog.gsl");
include("objects.gsl");
include("io.gsl");
include("common.gsl");
include("string.gsl");
string fn = fileDialog("Choose a map", @inputPath, ".w3x");
Map map = loadMap(fn, true, true);
void PrepareStock(Map map) {
for (string i: map.objects) {
// remove all custom objects
if (isIdCustom(i)) {
unset(map.objects[i]);
continue;
}
Wc3obj o = map.objects[i];
// remove any modifications from the object
for (string j: o) {
unset(o[j]);
}
if (o.typetostr == "Unit") {
if (o.isbldg == 1) {
bool ancient = false;
for (string j: o["type"]) {
if (j == "ancient") {
ancient = true;
break;
}
}
// remove some stupid abilities
bool removedAbilities = false;
bool first = true;
string newList = "";
for (string j: o.abilList) {
if (j == "Abdl" || j == "Abds" || j == "Abgl" || j == "Abgs") {
removedAbilities = true;
} else {
if (first) {
newList = j;
first = false;
} else {
newList = newList + "," + j;
}
}
}
if (removedAbilities) {
o.abilList = newList;
}
if (!ancient) {
o["type"] = "mechanical,summoned";
}
o.preventPlace = "";
o.requirePlace = "";
o.uberSplat = "";
o.turnRate = 1.0;
o.spd = 1;
o.elevPts = 4;
o.elevRad = 50;
o.maxPitch = 0;
o.maxRoll = 0;
} else {
bool isWorker = false;
for (string j: o["type"]) {
if (j == "Peon") {
isWorker = true;
break;
}
}
if (isWorker) {
o.race = "human";
}
o.elevPts = 0;
}
o.lumbercost = 0;
o.goldcost = 0;
o.Requires = "";
// o.elevPts = 0;
// o.elevRad = 0;
o.bountyplus = 0;
o.bountydice = 0;
o.bountysides = 0;
o.upgrades = "";
o.bldtm = 1;
o.fused = 0;
o.fmade = 0;
o.stockMax = 1;
o.stockRegen = 0;
o.stockStart = 1;
o.cargoSize = 1;
o.unitShadow = "";
o.buildingShadow = "_";
o.Tip = o.Name;
if (o.nameCount == 1) {
o.Tip = o.Propernames;
}
o.Ubertip = "";
o.Awakentip = o.Tip;
o.Revivetip = o.Tip;
o.Requires1 = "";
o.Requires2 = "";
o.Requires3 = "";
o.Requires4 = "";
o.Requires5 = "";
o.Requires6 = "";
o.Requires7 = "";
o.Requires8 = "";
} else if (o.typetostr == "Ability") {
o.checkDep = 0;
}
}
}
PrepareStock(map);
saveMap(map, @outputPath + "/" + map.fileName);