Hey I wanted to easily increase the difficulty of my game so I wrote a couple simple scripts to modify the tables found in most .txt files in the D2 MPQs. I only provide two here, but it should be easy to modify them for other .txt files. They should work on any OS, they require Python (2.x recommended, 3.x just needs %s/xrange/range first).
If there are any questions as to usage just post here and I'll try to respond. Cheers!
Example terminal output
Code: Select all
Working on field: TH
Working on field: TH(N)
Working on field: TH(H)
Working on field: L-TH
Working on field: L-TH(N)
Working on field: L-TH(H)
Working on field: DM
Working on field: DM(N)
Working on field: DM(H)
Working on field: L-DM
Working on field: L-DM(N)
Working on field: L-DM(H)
Working on field: HP
Working on field: HP(N)
Working on field: HP(H)
Working on field: L-HP
Working on field: L-HP(N)
Working on field: L-HP(H)
Working on field: XP
Working on field: XP(N)
Working on field: XP(H)
Working on field: L-XP
Working on field: L-XP(N)
Working on field: L-XP(H)
Code: Select all
#!/usr/bin/python
#
#D2TablesMultiplier
#Version 1 by gijensen
#
FILENAME = 'TreasureClassEx.txt'
VERBOSE = False
#INDEX = (INDEX, MULTIPLIER, COUNT)
# -25%
ND_INDEX = (8, 0.75, 1)
INDEXES = [ND_INDEX]
data = open('bk/'+FILENAME).readlines()
fnames = []
for i in xrange(len(data)):
data[i] = data[i][:-2]
line = data[i].split('\t')
for ii in xrange(len(INDEXES)):
pair = INDEXES[ii]
for INDEX in xrange(pair[0], pair[0]+pair[2]):
try:
line[INDEX] = int(line[INDEX])
except:
if line[INDEX] != '':
print("Working on field: "+line[INDEX])
fnames.append(line[INDEX])
continue
line[INDEX] = str(int(round(line[INDEX]*pair[1])))
if VERBOSE:
if len(fnames) > INDEX-pair[0]+pair[2]*ii:
print("%s %s: %s new: %d" % (line[0], fnames[INDEX-pair[0]+pair[2]*ii],
line[INDEX], int(line[INDEX])*pair[1]))
else:
print("%s UNKNOWN: %s new: %d" % (line[0],
line[INDEX], int(line[INDEX])*pair[1]))
data[i] = '\t'.join(line)
open('mod_'+FILENAME, 'w').write('\r\n'.join(data))
Code: Select all
#!/usr/bin/python
#
#D2TablesMultiplier
#Version 1 by gijensen
#
FILENAME = 'MonLvl.txt'
VERBOSE = False
#INDEX = (INDEX, MULTIPLIER, COUNT)
# +5%
TH_INDEX = (7, 1.05, 6)
DM_INDEX = (19, 1.05, 6)
# +50%
HP_INDEX = (13, 1.5, 6)
XP_INDEX = (25, 1.5, 6)
INDEXES = [TH_INDEX, DM_INDEX, HP_INDEX, XP_INDEX]
data = open('bk/'+FILENAME).readlines()
fnames = []
for i in xrange(len(data)):
data[i] = data[i][:-2]
line = data[i].split('\t')
for ii in xrange(len(INDEXES)):
pair = INDEXES[ii]
for INDEX in xrange(pair[0], pair[0]+pair[2]):
try:
line[INDEX] = int(line[INDEX])
except:
if line[INDEX] != '':
print("Working on field: "+line[INDEX])
fnames.append(line[INDEX])
continue
line[INDEX] = str(int(round(line[INDEX]*pair[1])))
if VERBOSE:
if len(fnames) > INDEX-pair[0]+pair[2]*ii:
print("%s %s: %s new: %d" % (line[0], fnames[INDEX-pair[0]+pair[2]*ii],
line[INDEX], int(line[INDEX])*pair[1]))
else:
print("%s UNKNOWN: %s new: %d" % (line[0],
line[INDEX], int(line[INDEX])*pair[1]))
data[i] = '\t'.join(line)
open('mod_'+FILENAME, 'w').write('\r\n'.join(data))