-
Notifications
You must be signed in to change notification settings - Fork 1
/
blueprintList.py
245 lines (204 loc) · 7.08 KB
/
blueprintList.py
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
import sys
import os
from library import *
def main():
# Read dlc dict
dlcs, dlcDict = itemsDLC()
print(dlcs)
newDlcsDict = dlcDict[-2]+dlcDict[-1]
itemDir = "./ExpandedCDB-BP/item/"
# 1. Melee items
melee = []
for item in os.listdir(itemDir+"/Melee"):
if "StartSword" not in item and "AdminWeapon" not in item:
melee.append(item[6:item.index(".")])
# 2. Ranged items
ranged = []
for item in os.listdir(itemDir+"/Ranged"):
if "StartBow" not in item:
ranged.append(item[6:item.index(".")])
# 3. Shield items
shield = []
for item in os.listdir(itemDir+"/Shield"):
if "StartShield" not in item:
shield.append(item[6:item.index(".")])
# 4. Trap items
trap = []
for item in os.listdir(itemDir+"/DeployedTrap"):
trap.append(item[6:item.index(".")])
# 5. Grenade items
grenade = []
for item in os.listdir(itemDir+"/Grenade"):
grenade.append(item[6:item.index(".")])
# 6. Power items
power = []
for item in os.listdir(itemDir+"/Power"):
power.append(item[6:item.index(".")])
# 7. Skins
skins = []
for item in os.listdir(itemDir+"/Skin"):
skins.append(item[6:item.index(".")])
# 8. Meta stuff
metas = []
lastItem = ""
for item in os.listdir(itemDir+"/Meta"):
item = item[6:item.index(".")]
if not isInBlacklist(item):
metas.append(item)
# if item[0:-1] == lastItem[0:-1]:
# metas[-1] = item
# else:
# metas.append(item)
# lastItem=item
# 9. Mutations/Perks
mutations = []
for item in os.listdir(itemDir+"/Perk"):
item = item[6:item.index(".")]
mutations.append(item)
# Read base room file
f = open('src/PrisonFlaskRoom.tmx','r')
lines = f.readlines()
f.close()
# Create new room file
f = open("PrisonFlaskRoom-BP-Mod.tmx",'w')
f.writelines(lines[:-2])
# Get start id
for line in lines:
if "object id" in line:
id = int(line.split('"')[1])+1
print("Start id:", id)
# Generate Armory list
# Remove duplicates
weapons = []
for item in melee+ranged+shield:
if not isInBlacklist(item):
if item not in weapons and item not in newDlcsDict:
# Item in the latest DLC is not included here
weapons.append(item)
sizeOfWeapons = len(weapons)
skills = []
for item in trap+grenade+power:
if not isInBlacklist(item):
if item not in newDlcsDict:
# Item in the latest DLC is not included here
skills.append(item)
sizeOfSkills = len(skills)
temp = skins
skins = []
for item in temp:
if item not in newDlcsDict:
# Item in the latest DLC is not included here
skins.append(item)
sizeOfSkins = len(skins)
sizeOfMetas = len(metas)
print("Found Weapons: {0}".format(sizeOfWeapons))
print(" Skills : {0}".format(sizeOfSkills))
print(" Skins : {0}".format(sizeOfSkins))
print(" Metas : {0}".format(sizeOfMetas))
print (len(dlcDict[0]),len(dlcDict[1]),len(dlcDict[2]),len(dlcDict[3]))
# Change this when the map is resized in the height direction (Add rows to the top)
nAdd = 3
# Armory showcase at y direction
yList = [41,44,47,50,53,56,59]
yList = [y+nAdd for y in yList]
# Weapons showcase
xRange = [2,34]
nInLine = int((xRange[-1]-xRange[0])/2)
for j in range(len(yList)):
for i in range(nInLine):
weaponIndex = j*nInLine+i
if weaponIndex < sizeOfWeapons:
x = xRange[0]+i*2+1
y = yList[j]
#f.writelines(jsonWrapper(x,y,weapons[weaponIndex]))
f.writelines(xmlWrapperBP(id,x,y,weapons[weaponIndex]))
id += 1
# Skills showcase 1
yList = [41,44,47,50,53,56,59]
yList = [y+nAdd for y in yList]
xRange = [36,64]
nInLine = int((xRange[-1]-xRange[0])/2)
for j in range(len(yList)):
for i in range(nInLine):
skillIndex = j*nInLine+i
if skillIndex < sizeOfSkills:
x = xRange[0]+i*2+1
y = yList[j]
#f.writelines(jsonWrapper(x,y,skills[skillIndex]))
f.writelines(xmlWrapperBP(id,x,y,skills[skillIndex]))
id += 1
# Skins showcase
yList = [2,5,8,11]
xRange = [2,64]
nInLine = int((xRange[-1]-xRange[0])/2)
for j in range(len(yList)):
for i in range(nInLine):
skinIndex = j*nInLine+i
if skinIndex < len(skins):
x = xRange[0]+i*2+1
y = yList[j]
#f.writelines(jsonWrapper(x,y,skins[skinIndex]))
f.writelines(xmlWrapperBP(id,x,y,skins[skinIndex]))
id += 1
# Metas and Mutation showcase
comb = metas+mutations
yList = [62,65,68,71]
yList = [y+nAdd for y in yList]
xRange = [2,64]
nInLine = int((xRange[-1]-xRange[0])/2)
for j in range(len(yList)):
for i in range(nInLine):
combIndex = j*nInLine+i
if combIndex < len(comb):
x = xRange[0]+i*2+1
y = yList[j]
if comb[combIndex] in metas:
# Runes
#f.writelines(jsonWrapperLoot(x,y,comb[combIndex]))
f.writelines(xmlWrapperLoot(id,x,y,comb[combIndex]))
id += 1
else:
# Mutations
#f.writelines(jsonWrapper(x,y,comb[combIndex]))
f.writelines(xmlWrapperBP(id,x,y,comb[combIndex]))
id += 1
# New dlc items showcase
## QoS
yList = [75,78]
yList = [y+nAdd for y in yList]
xRange = [3,46]
nInLine = int((xRange[-1]-xRange[0])/2)
for j in range(len(yList)):
for i in range(nInLine):
itemIndex = j*nInLine+i
# Insert exception handler
if itemIndex < len(dlcDict[-2]):
item = dlcDict[-2][itemIndex]
if not isInBlacklist(item):
x = xRange[0]+i*2+1
y = yList[j]
f.writelines(xmlWrapperBP(id, x, y, item))
id += 1
## Purple
yList = [81,84]
yList = [y+nAdd for y in yList]
xRange = [3,46]
nInLine = int((xRange[-1]-xRange[0])/2)
for j in range(len(yList)):
for i in range(nInLine):
itemIndex = j*nInLine+i
if itemIndex < len(dlcDict[-1]):
item = dlcDict[-1][itemIndex]
if not isInBlacklist(item):
x = xRange[0]+i*2+1
y = yList[j]
f.writelines(xmlWrapperBP(id, x, y, item))
id += 1
tail = lines[-2:]
f.writelines(tail)
f.close()
# Copy file to ExtendedCDB
os.system("cp PrisonFlaskRoom-BP-Mod.tmx ./bp-tmx/tmx/Prison/PrisonFlaskRoom.tmx")
print("Done!")
if __name__ == "__main__":
main()