Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import glob
- import os
- path = 'D:/Steam/SteamApps/common/RunningWithRifles/media/packages/vanilla/weapons'
- prospeedfound = False
- namefound = False
- killprobfound = False
- decaystartfound = False
- decayendfound = False
- for i in glob.glob(os.path.join(path, '*.weapon')):
- f = open(i)
- print('>>>>>>>>>')
- ## print(i)
- try:
- for line in f:
- if "name=" in line and namefound == False and "tag name=" not in line:
- ## finde2 = line.find('projectile_speed=')+5 ## index of =
- name = line
- namefound = True
- if "projectile_speed=" in line and prospeedfound == False:
- ## print(line)
- ## print(line.find('projectile_speed='))
- ## print(line[line.find('projectile_speed=')+18])
- finde = line.find('projectile_speed=')+17 ## index of =
- finddot = line.find('.', finde, finde+5) ## index of .
- sizeint = finddot-finde-1 ## size of target int
- prospeed = ''
- for t in range(0, sizeint):
- prospeed = prospeed + line[finde+(t+1)]
- ## print('projectile speed: '+prospeed)
- prospeedfound = True
- ## int(var) or float(var)
- if "kill_probability=" in line and killprobfound == False:
- ## print(line)
- finde = line.find('kill_probability=')+17 ## index of =
- finddot = line.find('.', finde, finde+3) ## index of .
- sizeint = finddot-finde+2 ## size of target int
- stringkp = ''
- for t in range(0, sizeint):
- stringkp = stringkp + line[finde+(t+1)]
- killprob = ''.join(x for x in stringkp if x.isdigit() or x == '.')
- ## print('kill probability: '+killprob)
- killprobfound = True
- ##
- if "kill_decay_start_time=" in line and decaystartfound == False:
- ## print(line)
- finde = line.find('kill_decay_start_time=')+22 ## index of =
- finddot = line.find('.', finde, finde+3) ## index of .
- sizeint = finddot-finde+2 ## size of target int
- stringkp = ''
- for t in range(0, sizeint):
- stringkp = stringkp + line[finde+(t+1)]
- decaystart = ''.join(x for x in stringkp if x.isdigit() or x == '.')
- ## print('decay start time: '+decaystart)
- decaystartfound = True
- ##
- if "kill_decay_end_time=" in line and decayendfound == False:
- ## print(line)
- finde = line.find('kill_decay_end_time=')+20 ## index of =
- finddot = line.find('.', finde, finde+3) ## index of .
- sizeint = finddot-finde+2 ## size of target int
- stringkp = ''
- for t in range(0, sizeint):
- stringkp = stringkp + line[finde+(t+1)]
- decayend = ''.join(x for x in stringkp if x.isdigit() or x == '.')
- ## print('decay end time: '+decayend)
- decayendfound = True
- ##
- except UnicodeError:
- print("UnicodeDecodeError")
- if namefound == True and prospeedfound == True and killprobfound == True and decaystartfound == True and decayendfound == True:
- if len(name) < 100:
- print(name)
- effectiverange = 0.0
- effectiverange = float(prospeed) * float(decaystart)
- print('effective range:', effectiverange)
- maxrange = 0.0
- maxrange = float(prospeed) * float(decayend)
- print('maximum range:', maxrange)
- f.close()
- ## print('<<<<<<<<<')
- namefound = False
- prospeedfound = False
- killprobfound = False
- decaystartfound = False
- decayendfound = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement