v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
30
scripts/priceobjects.py
Normal file
30
scripts/priceobjects.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import fnmatch
|
||||
import sys
|
||||
import fileinput
|
||||
import re
|
||||
import math
|
||||
|
||||
count = 0
|
||||
|
||||
for root, dir, files in os.walk("../assets/packed"):
|
||||
for items in fnmatch.filter(files, "*.object"):
|
||||
filePath = os.path.join(root, items)
|
||||
newFile = open(filePath + '.new', 'w+')
|
||||
for line in fileinput.input(filePath):
|
||||
priceMatch = re.search("\"price\"\s?: (\d+)", line)
|
||||
if priceMatch:
|
||||
count += 1
|
||||
price = int(priceMatch.groups()[0])
|
||||
newPrice = int(math.floor(price * float(sys.argv[1])))
|
||||
print str(price) + " -> " + str(newPrice) + " | in: " + filePath
|
||||
line = line.replace(str(price), str(newPrice))
|
||||
newFile.write(line)
|
||||
newFile.close()
|
||||
os.remove(filePath)
|
||||
os.rename(filePath + '.new', filePath)
|
||||
|
||||
|
||||
print '\n\n' + str(count) + " files changed"
|
Loading…
Add table
Add a link
Reference in a new issue