anomaly 1.5.2修改武器参数的python脚本
整合多个武器模组的配置文件。
手动把模组的weapons文件夹内容,复制到weapons_src文件夹。

import os import glob import re #game_root_dir = os.path.abspath('..\..') #print(game_root_dir+"\n") game_root_dir = "D:\\games\\Anomaly" print("game_root_dir="+game_root_dir) weapon_cfg_dir_in = os.path.join(os.path.abspath('.'),"weapons_src") #weapon_cfg_dir_in = os.path.join(game_root_dir,"tools\\change_weapons_properties\\weapons_src") #weapon_cfg_dir_in = os.path.join(game_root_dir,"gamedata\\configs\\items\\weapons_original") #weapon_cfg_dir_out = os.path.join(game_root_dir,"gamedata\\configs\\items\\weapons") weapon_cfg_dir_out = os.path.join(game_root_dir,"repo\\addons_cjh\\weapon_propeties\\gamedata\\configs\\items\\weapons") weapon_cfg_dir_in_filter = os.path.join(weapon_cfg_dir_in,"w_*.ltx") print(weapon_cfg_dir_in+"\n") print(weapon_cfg_dir_out+"\n") tab_len = 8 log_file = open("log.txt",mode='w+') section_list = {} section_current = "" def parse_line(line_str): global section_list global section_current split_ret = line_str.split(";",1) content = "" if(len(split_ret) > 0): content = split_ret[0] if(len(content) > 0): if(content[len(content) - 1] != "\n"): content += "\n" re_ret = re.search(r'(\s*)\[(\s*)(\S*)(\s*)\](.*)\n',content) if(re_ret): section_current = re_ret.group(3) if(re.search(r'[a-zA-Z0-9]',section_current)): section_parents_list = [] split_ret = re_ret.group(5).split(":") if(len(split_ret) > 1): for sect_p in split_ret[1].split(","): sect_p = sect_p.strip() section_parents_list.append(sect_p) section_list[section_current]={} section_list[section_current]["__section_parents__"]=section_parents_list #print(section_current) #log_file.write("["+section_current + "]\n") else: re_ret = re.search(r'(\s*)(\S*)(\s*)=(.*)\n',content) if(re_ret): prop = re_ret.group(2) if(re.search(r'[a-zA-Z0-9]',prop)): values_str = re_ret.group(4) if(len(section_current)): values_list = [] if(len(values_str)): for value in values_str.split(","): values_list.append(value.strip()) section_list[section_current][prop] = values_list return def file_parse(file_in): global section_list global section_current file_in.seek(0, 0) #section_list.clear() section_current = "" while 1: line_str = file_in.readline() if(len(line_str)): parse_line(line_str) else: break #log_file.write(str(section_list) + "\n") return def format_out(file_out,prop_len_max): #print(file_name) prop_len_max = 0 for section in section_list: for prop in section_list[section]: prop_len = len(prop) if(prop_len > prop_len_max): prop_len_max = prop_len prop_len_max = (prop_len_max / tab_len) * tab_len for section in section_list: file_out.write("["+section+"]") if("__section_parents__" in section_list[section].keys()): section_parents=section_list[section]["__section_parents__"] if(section_parents): file_out.write(":"+section_parents) file_out.write("\n") for prop in section_list[section]: if(prop == "__section_parents__"): continue write_prop_line(file_out,prop,prop_len_max,"") return def write_prop_line(file_out,prop,prop_len_max,comment): file_out.write(prop) prop_len = len(prop) if 0: while prop_len < prop_len_max: file_out.write("\t") prop_len += tab_len file_out.write("\t=") else: while prop_len < prop_len_max: file_out.write(" ") prop_len += 1 file_out.write(" =") values_str = "" for value in section_list[section_current][prop]: values_str += (value + ", ") if(len(values_str) >= 2): if(values_str[len(values_str) - 2] == ","): values_str = values_str[:len(values_str) - 2] file_out.write(" " + values_str) file_out.write(comment) file_out.write("\n") return src_prop_list=[] def re_parse_line_and_writeout(line_str, file_out,prop_len_max): global section_list global section_current global src_prop_list split_ret = line_str.split(";",1) content = "" comment = "" if(len(split_ret) > 0): content = split_ret[0] if(len(split_ret) > 1): comment = ";"+split_ret[1] if(len(content) and content[len(content) - 1] != "\n"): content += "\n" re_ret = re.match(r'(\s*)\[(\s*)(\S*)(\s*)\](.*)\n',content) if(re_ret): # added prop if(len(section_current) and (section_current in section_list.keys())): for prop in section_list[section_current]: if prop != "__section_parents__" and prop not in src_prop_list: write_prop_line(file_out,prop,prop_len_max,comment) src_prop_list.append(prop) src_prop_list=[] section_current = re_ret.group(3) if(section_current in section_list.keys()): file_out.write("[%s]" % section_current) if("__section_parents__" in section_list[section_current].keys()): section_parents = section_list[section_current]["__section_parents__"] if(len(section_parents)): str_p = ":" for sect_p in section_parents: str_p += (sect_p + ", ") if(str_p[len(str_p) - 2] == ","): str_p = str_p[:len(str_p) - 2] file_out.write(str_p) file_out.write(comment) file_out.write("\n") #else: #deleted section #nope() else: if(not len(section_current)): file_out.write(line_str) return re_ret = re.match(r'(\s*)(\S*)(\s*)=(.*)\n',content) if(re_ret): prop = re_ret.group(2) if (prop in src_prop_list): return if(section_current in section_list.keys()): if(prop in section_list[section_current].keys()): src_prop_list.append(prop) write_prop_line(file_out,prop,prop_len_max,comment) #else: # deleted prop #log_file.write("\nre_parse_line_and_writeout:prop="+ prop + " is not in section_list[" + section_current +"] !!") #else: # section deleted #log_file.write("\nre_parse_line_and_writeout:section_current="+ section_current + " is not in section_list !!") else: if(len(comment)): file_out.write(comment) return def format_out__keep_blank_comment(file_in, file_out,prop_len_max): global section_list global section_current file_in.seek(0, 0) file_out.seek(0, 0) section_current = "" while 1: line_str = file_in.readline() if(len(line_str)): re_parse_line_and_writeout(line_str,file_out,prop_len_max) else: break return bullet_weight_list__rifle = { "ammo_5.45x39_fmj" : 3.44, # AK74 415 mm 900 m/s 1393.2J # AK74U 716 m/s 842.8J "ammo_5.45x39_ap" : 3.44, "ammo_5.56x45_fmj" : 4, # SS109 # M4A1 848m/s 1567J # Famas 960m/s 1776J # AUG 970m/s 1797J # SG550 528mm 995m/s 1841J # L85 518mm 930m/s "ammo_5.56x45_ap" : 4, "ammo_6.8x43_fmj" : 7.5, # 810m/s "ammo_6.8x43_sst" : 7.5, "ammo_7.62x39_fmj" : 7.9, # 16in枪管 710m/s 2010J "ammo_7.62x39_ap" : 7.9, "ammo_7.62x51_fmj" : 9.75, # 使用M240机枪(枪管长508mm)发射M80普通弹, 初速905m/s "ammo_7.62x51_ap" : 9.75, "ammo_7.62x54_7h1" : 9.85, # 830 m/s "ammo_7.62x54_fmj" : 9.85, "ammo_7.62x54_ap" : 9.85, "ammo_magnum_300" : 11.66, # 7.62x60 "ammo_7.92x33_fmj" : 10, # G43和98K用的应该是7.92X57 # 7.92x33 8g,700m/s "ammo_7.92x57_fmj" : 10, # I.S.轻尖弹 5.55g 900m/s, # S空尖弹 10.0g 870m/s 3784.5 J "ammo_7.92x57_ap" : 11.55, # S.m.E.穿甲弹 11.55g 770m/s 3423.9975 J "ammo_8.58x70_ap" : 16.2, # .338 Lapua Magnum 914 M/s "ammo_8.58x70_jsp" : 16.2, "ammo_338_federal" : 16.2, "ammo_50_beowulf_hp" : 22, # 580 m/s 12.7x42mm 大多数406mm枪管 # 19,570 m/s # 21,550 m/s # 22,540 m/s # 26,550 m/s "ammo_50_beowulf_jfp" : 22, "ammo_12.7x55_fmj" : 33, # 300 m/s "ammo_12.7x55" : 33, # 300 m/s "ammo_50_bmg" : 42, # wpn_m82 "ammo_12.7x99_fmj" : 42, # wpn_m82 #在24寸枪管下测试,按(弹头重量/种类 枪口初速 能量)排序 #42 g Speer 928 m/s 17,821 J #42 g ADI 923 m/s 18,100 J #45 g Barnes 908 m/s 18,942 J #49 g Lapua 798 m/s 15,482 J #52 g Barnes 882 m/s 20,195 J #作者:H赫尔曼-K科赫_G11 https://www.bilibili.com/read/cv4131051/ 出处:bilibili "ammo_9x39_pab9" : 16, # 285 m/s "ammo_9x39_ap" : 16, "ammo_gauss" : 4, "ammo_gauss_cardan" : 4, } bullet_weight_list__pistol = { "ammo_4.6x30_fmj" : 2, # MP7 685 m/s "ammo_4.6x30_ap" : 2, "ammo_5.7x28_ss190" : 2.3 , # P90 715 m/s "ammo_5.7x28_ss192" : 2.3, "ammo_7.62x25_fmj" : 5.57, # 400-455 m/s 470J "ammo_7.62x25_hp" : 5.57, "ammo_7.62x25_p" : 5.57, # CZ52 480 m/s "ammo_9x18_fmj" : 6, # 319 m/s 313J "ammo_9x18_pmm" : 6, "ammo_9x19_fmj" : 7, # 360 m/s 483J "ammo_9x19_pbp" : 7, "ammo_9x21_sp10" : 7.9, #390m/s #作者:亲爱的白狐啊 https://www.bilibili.com/read/cv21894628/ 出处:bilibili, "ammo_11.43x23_fmj" : 15.16, # 250 m/s 474J "ammo_11.43x23_hydro" : 15.16, "ammo_10x22_fmj" : 11.55, # 360 m/s 748 # .40sw "ammo_10x22_hp" : 11.55, "ammo_10x25_fmj" : 11.02, # 408 m/s 917J # ".40 super" "10mm Auto" "ammo_10x25_hp" : 11.02, "ammo_357_fmj" : 10.25, # 443m/s 997J "ammo_357_hp" : 10.25, "ammo_357_hp_mag" : 8, # wpn_desert_eagle 520m/s "ammo_50ae_fmj" : 19.4, # 419m/s 1708J "ammo_50ae_hp" : 19.4 } bullet_weight_list__shotgun = { "ammo_357_buck" : 4.53, "ammo_12x70_buck" : 4.53, # 313m/s *8 000号鹿弹,0.36英寸,70gr(格令)=4.53g # 00号鹿弹,0.33英寸,53.8gr "ammo_12x76_zhekan" : 4.53,#36.24, # 313m/s "ammo_12x76_bull" : 4.53,#36.24, "ammo_12g_grenade" : 4.53,#36.24 #"ammo_23x75_shrapnel" : 3.78, #00 #"ammo_23x75_barrikada" : 3.78, "ammo_23x75_shrapnel" : 4.53, #000 "ammo_23x75_barrikada" : 113.25, "ammo_20x70_buck" : 3.78, #00 } bullet_weight_list__grenade = { "ammo_m209" : 250, # 没有M209榴弹 76m/s 弹头重量不知,乱写 "ammo_vog-25" : 250, # 弹体重278克,装药重68克,长度107mm,初速76.5米/秒。 "ammo_og-7b" : 1000 # 弹药重量 约7千克 # 膛口初速 约117米/秒 # 火箭弹飞行速度 约294米/秒 } bullet_weight_list = {} for ammo in bullet_weight_list__shotgun: bullet_weight_list[ammo] = bullet_weight_list__shotgun[ammo] for ammo in bullet_weight_list__pistol: bullet_weight_list[ammo] = bullet_weight_list__pistol[ammo] for ammo in bullet_weight_list__rifle: bullet_weight_list[ammo] = bullet_weight_list__rifle[ammo] bullet_weight_list.update(bullet_weight_list__grenade) #log_file.write(str(bullet_weight_list)) def nope(): return def get_parent_wpn_prop(section,prop_name): if section not in section_list.keys(): #log_file.write("\nget_parent_wpn_prop,"+section + " not in section_list\n") return [] if(not "__section_parents__" in section_list[section].keys()): #log_file.write("\nget_parent_wpn_prop,"+section + " do not have __section_parents__\n") return [] prop_name = prop_name.strip() section_parents = section_list[section]["__section_parents__"] if(len(section_parents) == 0): #log_file.write("\nget_parent_wpn_prop,"+section + " len(section_parents) == 0\n") return [] for sect_p in section_parents: sect_p = sect_p.strip() #log_file.write("\nget_parent_wpn_prop,"+sect_p+"\n") if sect_p.find("wpn_") >= 0: if not sect_p in section_list.keys(): #log_file.write("\nget_parent_wpn_prop,"+sect_p + " do not in section_list\n") return [] if not prop_name in section_list[sect_p].keys(): #log_file.write("\nget_parent_wpn_prop,"+prop_name + " do not in section_list[\n"+sect_p+"]\n") return get_parent_wpn_prop(sect_p,prop_name) return section_list[sect_p][prop_name] return [] def get_ammo_class(): if section_current not in section_list: log_file.write("\n"+section_current +" not in section_list\n") return [] ammo_class = [] if("ammo_class" not in section_list[section_current].keys()): ammo_class = get_parent_wpn_prop(section_current,"ammo_class") else: ammo_class = section_list[section_current]["ammo_class"] return ammo_class def process_ammo_class(): try: if("ammo_class" in section_list[section_current].keys()): ammo_class_new = [] for ammo in section_list[section_current]["ammo_class"]: if(ammo.find("ammo_5.56x45_ss190") < 0 and ammo.find("bad") < 0): ammo_class_new.append(ammo) section_list[section_current]["ammo_class"] = ammo_class_new except: log_file.write("process_ammo_class except\n") nope() return def process_hit_power(): global section_list global section_current ############################################################## if section_current not in section_list.keys(): return str_log="" ############################################################## bullet_weight = 0 ammo = "" ammo_class_appeared = 0 try: ammo_class = [] if("ammo_class" not in section_list[section_current].keys()): ammo_class = get_parent_wpn_prop(section_current,"ammo_class") else: ammo_class = section_list[section_current]["ammo_class"] ammo_class_appeared=1 for ammo in ammo_class: if( ammo in bullet_weight_list__grenade): return 1 if ammo in bullet_weight_list.keys(): bullet_weight = bullet_weight_list[ammo] str_log += ("ammo="+ammo+", "+"bullet_weight="+str(bullet_weight)+"g, ") break else: log_file.write("\n error, no ammo or not in bullet_weight_list\n") return 0 except: log_file.write("\nbullet_weight except\n") nope() return 0 ############################################################## bullet_speed_appeared = 0 bullet_speed = [] try: if("9x39" in ammo): bullet_speed = ["295"] if("bullet_speed" in section_list[section_current].keys()): section_list[section_current]["bullet_speed"] = bullet_speed bullet_speed_appeared = 1 elif (section_current == "wpn_cz52"): bullet_speed = ["480"] section_list[section_current]["bullet_speed"] = bullet_speed bullet_speed_appeared = 1 elif (section_current == "wpn_desert_eagle"): bullet_speed = ["520"] section_list[section_current]["bullet_speed"] = bullet_speed bullet_speed_appeared = 1 #elif (section_current == "wpn_g43" or section_current == "wpn_k98"): #bullet_speed = ["870"] #section_list[section_current]["bullet_speed"] = bullet_speed #bullet_speed_appeared = 1 elif ("ammo_m209" in ammo or "ammo_vog-25" in ammo): bullet_speed = ["76"] section_list[section_current]["bullet_speed"] = bullet_speed bullet_speed_appeared = 1 elif ("ammo_og-7b" in ammo): bullet_speed = ["176.8"] section_list[section_current]["bullet_speed"] = bullet_speed bullet_speed_appeared = 1 elif ("12.7x55" in ammo): bullet_speed = ["300"] section_list[section_current]["bullet_speed"] = bullet_speed bullet_speed_appeared = 1 else: if("bullet_speed" not in section_list[section_current].keys()): bullet_speed = get_parent_wpn_prop(section_current,"bullet_speed") else: bullet_speed = section_list[section_current]["bullet_speed"] bullet_speed_appeared = 1 if(len(bullet_speed) == 0): log_file.write("\nbullet_speed error \n") return bullet_speed = re.match(r'([\d\.]*)',bullet_speed[0]).group(1) bullet_speed = float(bullet_speed) if "11.43x23" in ammo and bullet_speed > 300: bullet_speed = 300 section_list[section_current]["bullet_speed"]=[str(bullet_speed)] str_log += "bullet_speed="+str(bullet_speed)+" m/s," #log_file.write(str_log) except: log_file.write("\nbullet_speed except\n") nope() ########## try: #if 1: if(len(section_current) == 0): return if("hit_power" not in section_list[section_current].keys() and not bullet_speed_appeared and not ammo_class_appeared): return bullet_weight = bullet_weight / 1000 hit_power = 0.5 * bullet_weight * bullet_speed * bullet_speed hit_power = hit_power / 1000 if("ammo_12x70_buck" == ammo): hit_power *= 8 if("ammo_357_buck" == ammo): hit_power *= 6 if("ammo_357_buck" == ammo): hit_power *= 6 if("ammo_20x70_buck" == ammo): hit_power *= 5 if("ammo_23x75_shrapnel" == ammo): hit_power *= 25 hit_power = round(hit_power,3) str_log +=("hit_power="+str(hit_power)+" KJ\n") log_file.write(str_log) if("hit_power" in section_list[section_current].keys()): hit_power_old = section_list[section_current]["hit_power"][0] str_log =("hit_power_old="+hit_power_old+"\n\n") log_file.write(str_log) section_list[section_current]["hit_power"] = [str(hit_power)] if( "silencer_hit_power" in section_list[section_current].keys()): silencer_hit_power = round(hit_power*0.98,3) section_list[section_current]["silencer_hit_power"] = [str(silencer_hit_power)] except: log_file.write("\nhit_power except\n") nope() return def process_zoom_factor_anomaly_bas(): if not "scope_zoom_factor" in section_list[section_current].keys(): return #FOV=75 in game setting factor_no_zoom = 100 if section_current in ["wpn_rem700_aics","wpn_rem700_mcmillan"] : section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/12,3))] section_list[section_current]["scope_dynamic_zoom"]=["on"] return if section_current == "wpn_remington700": section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/8,3))] section_list[section_current]["scope_dynamic_zoom"]=["off"] return if section_current == "wpn_remington700_bas_lapua700": section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/24,3))] section_list[section_current]["scope_dynamic_zoom"]=["on"] return if section_current in ["wpn_remington700_bas","wpn_remington700_bas_archangel","wpn_remington700_bas_magpul_pro","wpn_remington700_bas_mod_x_gen3"]: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/10,3))] section_list[section_current]["scope_dynamic_zoom"]=["on"] return if section_current == "wpn_sig550_sniper": section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/6,3))] return if section_current == "wpn_sr25": section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/8,3))] section_list[section_current]["scope_dynamic_zoom"]=["on"] return if section_current == "wpn_sv98": section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/10,3))] return if section_current == "wpn_trg": section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/10,3))] return if section_current == "wpn_vssk": section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/10,3))] return if section_current == "wpn_wa2000": section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/10,3))] return try: if section_current.find("_ekp") >0 or section_current.find("_kobra") > 0 or section_current.find("_c-more") > 0 or section_current.find("_eot") > 0: #section_list[section_current]["scope_zoom_factor"]= [str(factor_no_zoom)] section_list[section_current]["scope_zoom_factor"]= ["0"] elif section_current.find("_kemper") > 0 or section_current.find("_ac10632") > 0 or section_current.find("_aimpoint") > 0 or section_current.find("_compm4s") > 0 or section_current.find("_e0t2") > 0 or section_current.find("_ekp8_18") > 0 or section_current.find("_mepro") > 0 or section_current.find("_point_aimpro") > 0: #section_list[section_current]["scope_zoom_factor"]= [str(factor_no_zoom)] section_list[section_current]["scope_zoom_factor"]= ["0"] elif section_current.find("_ac11090") >0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/2,3))] elif section_current.find("_pu") >0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/3.5,3))] elif section_current.find("_1p29") >0 or section_current.find("_usp1") > 0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/4,3))] elif section_current.find("_acog") >0 or section_current.find("_triji") >0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/4,3))] elif section_current.find("_specter") > 0 or section_current.find("_spec_alt") > 0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/4,3))] elif section_current.find("_1p78") > 0 or section_current.find("_kashtan_rmr") >0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/2.8,3))] elif section_current.find("_1pn93n2_1gs") > 0 or section_current.find("_1pn93") > 0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/4,3))] elif section_current.find("_pn23") > 0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/3,3))] elif section_current.find("_pso") > 0 or section_current.find("_ps01") > 0 or section_current.find("_pso1m21") > 0 or section_current.find("_pso2") > 0 or section_current.find("_pritseldob") > 0 : section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/4,3))] elif section_current.find("_leupold") > 0 or section_current.find("mark8_rmr") > 0: section_list[section_current]["scope_dynamic_zoom"]=["on"] section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/8,3))] elif section_current.find("_marchf") > 0: section_list[section_current]["scope_dynamic_zoom"]=["on"] section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/24,3))] elif section_current.find("_gauss_sight") > 0: section_list[section_current]["scope_dynamic_zoom"]=["on"] section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/8,3))] elif section_current.find("_1p59") > 0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/10,3))] section_list[section_current]["scope_dynamic_zoom"]=["on"] elif section_current.find("_pgo7gs") > 0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/4,3))] else: #if(section_current == "wpn_g36"): #section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/3,3))] if("scope_status" in section_list[section_current].keys()): scope_status = section_list[section_current]["scope_status"] if( len(scope_status)): #scope_status = scope_status[0] #scope_status = re.match(r'([\d]*)',scope_status).group() #scope_status = int(scope_status) #if scope_status in [0,2]: scope_status = scope_status[0].strip() if scope_status in ["0","2"]: #if scope_status == "0": #section_list[section_current]["scope_zoom_factor"]= [str(factor_no_zoom)] section_list[section_current]["scope_zoom_factor"]= ["0"] #else: #if(section_current == "wpn_g36"): #section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/3,2))] except: log_file.write("scope_status error") nope() return def process_zoom_factor_2(): try: factor_no_zoom = 73.3 if section_current.find("_ekp") >0 or section_current.find("_kobra") > 0 or section_current.find("_c-more") > 0 or section_current.find("_eot") > 0: section_list[section_current]["scope_zoom_factor"]= [str(factor_no_zoom)] #section_list[section_current]["scope_zoom_factor"]= ["0"] elif section_current.find("_ac11090") >0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/2,2))] elif section_current.find("_pu") >0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/3.5,2))] elif section_current.find("_1p29") >0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/4,2))] elif section_current.find("_acog") >0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/4,2))] elif section_current.find("_pso") > 0: section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/5,2))] else: if(section_current == "wpn_g36_special"): section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/8,2))] if(section_current == "wpn_g36_special"): section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/1.3,2))] if("scope_status" in section_list[section_current].keys()): scope_status = section_list[section_current]["scope_status"] if( len(scope_status)): scope_status = scope_status[0] scope_status = re.match(r'([\d]*)',scope_status).group() scope_status = int(scope_status) if scope_status in [0,2]: section_list[section_current]["scope_zoom_factor"]= [str(factor_no_zoom)] #section_list[section_current]["scope_zoom_factor"]= ["0"] else: if(section_current == "wpn_g36"): section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/3,2))] except: log_file.write("scope_status error") nope() return def process_zoom_factor_coc1_5(): try: #log_prop_old("scope_zoom_factor", if section_current.find("_ekp") >0 or section_current.find("_kobra") > 0 or section_current.find("_c-more") > 0 or section_current.find("_eot") > 0: section_list[section_current]["scope_zoom_factor"]= [str(1)] #section_list[section_current]["scope_zoom_factor"]= ["0"] elif section_current.find("_ac11090") >0: section_list[section_current]["scope_zoom_factor"]=[str(2)] elif section_current.find("_pu") >0: section_list[section_current]["scope_zoom_factor"]=[str(3.5)] elif section_current.find("_1p29") >0: section_list[section_current]["scope_zoom_factor"]=[str(4)] elif section_current.find("_acog") >0: section_list[section_current]["scope_zoom_factor"]=[str(4)] elif section_current.find("_pso") > 0: section_list[section_current]["scope_zoom_factor"]=[str(5)] elif section_current.find("_po4x34") > 0: section_list[section_current]["scope_zoom_factor"]=[str(4)] elif section_current.find("_1p59") > 0: section_list[section_current]["scope_zoom_factor"]=[str(10)] elif section_current.find("_litesite") > 0: section_list[section_current]["scope_zoom_factor"]=[str(9)] elif section_current.find("_tars101") > 0: section_list[section_current]["scope_zoom_factor"]=[str(15)] elif section_current.find("_pks") > 0: section_list[section_current]["scope_zoom_factor"]=[str(8)] elif section_current.find("_aimpoint") > 0: section_list[section_current]["scope_zoom_factor"]=[str(1)] elif section_current.find("_ac10632") > 0: section_list[section_current]["scope_zoom_factor"]=[str(1)] elif section_current.find("_coyote") > 0: section_list[section_current]["scope_zoom_factor"]=[str(1)] elif section_current.find("_delta") > 0: section_list[section_current]["scope_zoom_factor"]=[str(1)] else: #if(section_current == "wpn_g36_special"): #section_list[section_current]["scope_zoom_factor"]=[str(round(factor_no_zoom/8,2))] if("scope_status" in section_list[section_current].keys()): scope_status = section_list[section_current]["scope_status"] if( len(scope_status)): scope_status = scope_status[0] scope_status = re.match(r'([\d]*)',scope_status).group() scope_status = int(scope_status) if scope_status in [0,2]: section_list[section_current]["scope_zoom_factor"]= [str(1)] else: if(section_current == "wpn_g36"): section_list[section_current]["scope_zoom_factor"]=[str(3)] except: log_file.write("scope_status error") nope() return def get_float(section_name,prop_name): if (section_name not in section_list.keys()): if(prop_name in section_list[section_name].keys()): value_str = section_list[section_name][prop_name][0] if(len(value_str)): value_str = re.match(r'([\d\.]*)',value_str).group() if(len(value_str)): return float(value_str) return None def process_accuracy(): ammo_class = get_ammo_class() for ammo in ammo_class: if(len(ammo) == 0): #log_file.write("\nfire_dispersion_base error,ammo is empty string\n") continue if(ammo in bullet_weight_list__pistol.keys() or ammo in bullet_weight_list__rifle.keys()): float_div("fire_dispersion_base",5) return elif (ammo in bullet_weight_list__shotgun.keys()): float_div("fire_dispersion_base",2) return elif (ammo in bullet_weight_list__grenade.keys()): float_div("fire_dispersion_base",5) return return def process_fire_distance(): if("fire_distance" not in section_list[section_current].keys()): return ammo_class = get_ammo_class() fire_distance = 0 for ammo in ammo_class: if (ammo.find("8.58x70") >= 0): fire_distance = 1200 break elif (ammo.find("7.62x51") >= 0): fire_distance = 800 break elif (ammo.find("7.62x54") >= 0): fire_distance = 800 break elif (ammo.find("7.62x39") >= 0): fire_distance = 600 break elif (ammo.find("5.45x39") >= 0): fire_distance = 500 break elif (ammo.find("5.56x45") >= 0): fire_distance = 500 break if(fire_distance): log_prop_old("fire_distance",section_list[section_current]["fire_distance"][0]) section_list[section_current]["fire_distance"] = [str(fire_distance)] log_file.write("new = "+str(fire_distance)+"\n") return def log_prop_old(prop_name,prop_value_str): if(prop_name in section_list[section_current].keys()): log_file.write(prop_name) len_name = len(prop_name) while(len_name < 32): log_file.write(" ") len_name += 1 log_file.write(" old = "+prop_value_str+",\t\t") def float_div(prop_name,div): try: if(prop_name in section_list[section_current].keys()): prop_value = section_list[section_current][prop_name][0] if( len(prop_value)): prop_value = re.match(r'([\d\.]*)',prop_value).group() if(len(prop_value)): log_prop_old(prop_name, prop_value) prop_value = float(prop_value) prop_value = prop_value / div if(prop_value < 0.0001): prop_value = str(0.0001) else: prop_value = str(round(prop_value,4)) section_list[section_current][prop_name] = [prop_value] log_file.write("new = "+prop_value+"\n") except: log_file.write("\n"+prop_name +" except \n") nope() return def process_cond_dec(): float_div("condition_shot_dec",5) float_div("condition_queue_shot_dec",5) return def process_recoil(): float_div("cam_dispersion",5) float_div("cam_dispersion_inc",5) return def main_parse_all(): print("parseing all files") for file_in_path in glob.glob(weapon_cfg_dir_in_filter) + [os.path.join(weapon_cfg_dir_in,"weapon_ammo.ltx")]: #for file_in_path in glob.glob(weapon_cfg_dir_in_filter): path,file_name = os.path.split(file_in_path) print("\tparsing " + file_name) try: file_in = open(file_in_path, mode='r') file_parse(file_in) file_in.close() except IOError as e: print(os.strerror(e.errno) + ":\n"+"when open and parse "+file_in_path) #file_in.close() return return def get_prop_len_max(): prop_len_max = 0 for section in section_list: for prop in section_list[section]: prop_len = len(prop) if(prop_len > prop_len_max): prop_len_max = prop_len #print("["+section+"] len("+prop+")="+str(prop_len)) prop_len_max = (prop_len_max / tab_len) * tab_len return prop_len_max def replace_weapon(weapon_to, weapon_from): section_list[weapon_to]={} section_list[weapon_to].update(section_list[weapon_from]) section_list[weapon_to]["hud"] = [weapon_to+"_hud"] section_list[weapon_to+"_hud"]={} section_list[weapon_to+"_hud"].update(section_list[section_list[weapon_from]["hud"][0]]) return def main_process_all(): global section_current print("\nprocessing\n") section_list["wpn_m24"]["ammo_class"]=["ammo_7.62x51_fmj", "ammo_7.62x51_fmj_bad", "ammo_7.62x51_fmj_verybad", "ammo_7.62x51_ap", "ammo_7.62x51_ap_bad", "ammo_7.62x51_ap_verybad"] section_list["ammo_12x70_buck"]["k_hit"]=["1"] section_list["ammo_12x70_buck_bad"]["k_hit"]=["0.95"] section_list["ammo_12x70_buck_verybad"]["k_hit"]=["0.9"] #section_list["ammo_12x76_zhekan"]["k_hit"]=["1"] #section_list["ammo_12x76_zhekan_bad"]["k_hit"]=["1"] #section_list["ammo_12x76_zhekan_verybad"]["k_hit"]=["1"] section_list["ammo_12x70_buck_self"]["k_hit"]=["1"] section_list["wpn_mp5_hud"]["aim_hud_offset_pos_16x9"]=["-0.085685", "0.066969", "-0.210615"] section_list["wpn_mp5_hud"]["aim_hud_offset_rot_16x9"]=["0.051104", "0.035235", "0"] section_list["wpn_remington700_bas"]["bullet_speed"]=["830"] section_list["wpn_remington700_bas_archangel"]["bullet_speed"]=["840"] section_list["wpn_remington700_bas_magpul_pro"]["bullet_speed"]=["850"] section_list["wpn_remington700_bas_mod_x_gen3"]["bullet_speed"]=["855"] section_list["wpn_remington700_bas_lapua700"]["bullet_speed"]=["930"] section_list["wpn_rem700_aics"]["bullet_speed"]=["930"] section_list["wpn_rem700_mcmillan"]["bullet_speed"]=["930"] section_list["wpn_dvl10"]["bullet_speed"]=["855"] section_list["wpn_usp_match"]["bullet_speed"]=["380"] #replace_weapon("wpn_m82", "wpn_m98b") section_list["wpn_m82"]["ammo_class"]=["ammo_50_bmg"] replace_weapon("wpn_g43", "wpn_svt40") replace_weapon("wpn_k98", "wpn_mosin") replace_weapon("wpn_k98_mod", "wpn_remington700_bas_lapua700") replace_weapon("wpn_k98_mod_silen98", "wpn_rem700_mcmillan") replace_weapon("wpn_kar98_retrotac", "wpn_remington700_bas_archangel") replace_weapon("wpn_karabiner98k", "wpn_rem700_aics") #section_list["wpn_k98_mod"]["bullet_speed"]=["760"] #section_list["wpn_k98_mod_silen98"]["bullet_speed"]=["760"] #section_list["wpn_kar98_retrotac"]["bullet_speed"]=["760"] #section_list["wpn_karabiner98k"]["bullet_speed"]=["760"] #section_list["wpn_l85"]["scope_status"]=["1"] #section_list["wpn_l85"]["scope_texture"]=["wpn_crosshair_susat"] #section_list["wpn_sig550_luckygun"]["bullet_speed"]=["760"] #section_list["wpn_hk417"]["fire_dispersion_base"]=["0.085"] #section_list["wpn_hk417_nitro"]["fire_dispersion_base"]=["0.08"] #section_list["wpn_trg22"]["fire_dispersion_base"]=["0.01"] #section_list["wpn_trg42"]["fire_dispersion_base"]=["0.01"] #section_list["wpn_l96"]["fire_dispersion_base"]=["0.01"] #section_list["wpn_l115a3"]["fire_dispersion_base"]=["0.01"] #section_list["wpn_sv98"]["fire_dispersion_base"]=["0.01"] #section_list["wpn_scar-h"]["fire_dispersion_base"]=["0.15"] #section_list["wpn_scar_merc"]["fire_dispersion_base"]=["0.14"] section_list["wpn_gauss"]["bullet_speed"]=["2000"] #section_list["wpn_pkm"]["ammo_class"]=["ammo_7.62x54_7h1", "ammo_7.62x54_fmj"] #section_list["wpn_m134"]["ammo_class"]=["ammo_7.62x51_fmj","ammo_7.62x51_ap"] #section_list["wpn_ak74u"]["slot"]=["2"] section_list["wpn_pl15"]["fire_dispersion_base"]=["0.45"] section_list["wpn_sig220_n_u2p2g0r"]["bullet_speed"]=["340"] #section_list["wpn_mp5_hud"]["aim_hud_offset_pos"] = ["-0.085525","-0.068","-0.25"] #section_list["wpn_mp5_hud"]["aim_hud_offset_pos_16x9"] = ["-0.085525","-0.068","-0.25"] #section_list["wpn_mp5_hud"]["aim_hud_offset_rot"] = ["0.053","0.0349","0"] #section_list["wpn_mp5_hud"]["aim_hud_offset_rot_16x9"] = ["0.053","0.0349","0"] ######################## section_list["ammo_23x75_shrapnel"]["buck_shot"] = ["25"] section_list["ammo_23x75_shrapnel"]["k_hit"] = ["1"] section_list["wpn_ks23"]["bullet_speed"] = ["375"] section_list["wpn_ks23_23_up"]["bullet_speed"] = ["270"] section_list["wpn_ks23_kaban"]["bullet_speed"] = ["270"] section_list["ammo_23x75_barrikada"]["k_hit"] = ["1"] ######################## del section_list["wpn_ak74_pmc"]["use_alt_aim_hud"] del section_list["wpn_ak74_pmc_hud"]["aim_hud_offset_alt_pos_16x9"] del section_list["wpn_ak74_pmc_hud"]["aim_hud_offset_alt_rot_16x9"] ## section_list["wpn_ak74_pmc_specter"]["position"]=["-0.011087", "0.005254", "-0.016484"] section_list["wpn_ak74_pmc_specter"]["use_alt_aim_hud"]=["true"] section_list["wpn_ak74_pmc_specter_hud"]["hands_position_16x9"]=["0.033118", "-0.047963", "-0.174364"] section_list["wpn_ak74_pmc_specter_hud"]["hands_orientation_16x9"]=["0.855601", "0.714949", "0"] section_list["wpn_ak74_pmc_specter_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.095557", "0.021859", "-0.020275"] section_list["wpn_ak74_pmc_specter_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.011596", "0.014019", "0.002187"] ## section_list["wpn_ak74_pmc_1pn93_hud"]["hands_position_16x9"]=["0.033118", "-0.047963", "-0.174364"] section_list["wpn_ak74_pmc_1pn93_hud"]["hands_orientation_16x9"]=["0.855601", "0.714949", "0"] ## section_list["wpn_ak74_pmc_pn23_hud"]["hands_position_16x9"]=["0.019515", "-0.075922", "-0.137957"] section_list["wpn_ak74_pmc_pn23_hud"]["hands_orientation_16x9"]=["0.855601", "0.714949", "0"] ############################## del section_list["wpn_ak74m_beard"]["use_alt_aim_hud"] del section_list["wpn_ak74m_beard_hud"]["aim_hud_offset_alt_pos_16x9"] del section_list["wpn_ak74m_beard_hud"]["aim_hud_offset_alt_rot_16x9"] section_list["wpn_ak74m_beard_1pn93"]["use_alt_aim_hud"]=["true"] section_list["wpn_ak74m_beard_1pn93_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.064482", "0.05123", "0.038742"] section_list["wpn_ak74m_beard_1pn93_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.005232", "0.007774", "0"] section_list["wpn_ak74m_beard_1pn93n2_1gs"]["use_alt_aim_hud"]=["true"] section_list["wpn_ak74m_beard_1pn93n2_1gs_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.06518", "0.035248", "0.038742"] section_list["wpn_ak74m_beard_1pn93n2_1gs_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.005303", "0.008473", "0"] section_list["wpn_ak74m_beard_usp1"]["use_alt_aim_hud"]=["true"] section_list["wpn_ak74m_beard_usp1_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.059523", "0.041551", "0"] section_list["wpn_ak74m_beard_usp1_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.005942", "0.0065", "0"] section_list["wpn_ak74m_beard_pso2"]["use_alt_aim_hud"]=["true"] section_list["wpn_ak74m_beard_pso2_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.057143", "0.02379", "-0.013171"] section_list["wpn_ak74m_beard_pso2_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.006297", "0.006979", "0"] section_list["wpn_ak74m_beard_1p29"]["use_alt_aim_hud"]=["true"] section_list["wpn_ak74m_beard_1p29_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.061603", "0.054428", "0.009108"] section_list["wpn_ak74m_beard_1p29_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.005942", "0.008953", "0"] del section_list["wpn_ak74m_beard_1p78gs_hud"]["aim_hud_offset_alt_pos_16x9"] del section_list["wpn_ak74m_beard_1p78gs_hud"]["aim_hud_offset_alt_rot_16x9"] ############################ section_list["wpn_l85_m3_specter_hud"]["hands_position_16x9"]=["-0.007300", "-0.05", "0.015000"] section_list["wpn_l85_m3_specter_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.0468", "0.04", "0"] section_list["wpn_l85_m3_specter_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.008", "0.00625", "0"] section_list["wpn_l85_m3_pn23_hud"]["hands_position_16x9"]=["-0.007300", "-0.05", "0.015000"] section_list["wpn_l85_m3_hud"]["aim_hud_offset_pos_16x9"]=["-0.046240", "0.0095", "-0.035000"] del section_list["wpn_l85_m3"]["use_alt_aim_hud"] del section_list["wpn_l85_m3_hud"]["aim_hud_offset_alt_pos_16x9"] del section_list["wpn_l85_m3_hud"]["aim_hud_offset_alt_rot_16x9"] section_list["wpn_l85_m3"]["fire_point"]=["0", "0.025", "0.42"] section_list["wpn_l85_m3"]["shell_point"]=["0", "0", "-0.18"] #del section_list["wpn_l85_m3"]["bullet_speed"]=["930"] ###################### section_list["wpn_sig550"]["bullet_speed"]=["990"] section_list["wpn_sig550_siber"]["bullet_speed"]=["990"] section_list["wpn_sig550_tac_siber"]["bullet_speed"]=["995"] #section_list["wpn_sig550_tac_siber"]["grenade_launcher_x"]=["118"] section_list["wpn_sig550_tac_siber"]["grenade_launcher_y"]=["31"] section_list["wpn_sig550_tac_siber"]["shell_point"]=["-0.02", "0.167", "0.082"] section_list["wpn_sig550_tac_siber_marchf"]["scope_dynamic_zoom"]=["on"] section_list["wpn_sig550_siber_marchf"]["scope_dynamic_zoom"]=["on"] section_list["wpn_sig550_tac_siber_leupold"]["scope_dynamic_zoom"]=["on"] section_list["wpn_sig550_siber_leupold"]["scope_dynamic_zoom"]=["on"] del section_list["wpn_sig550_tac_siber"]["use_alt_aim_hud"] del section_list["wpn_sig550_tac_siber_hud"]["aim_hud_offset_alt_pos_16x9"] del section_list["wpn_sig550_tac_siber_hud"]["aim_hud_offset_alt_rot_16x9"] section_list["wpn_sig550_tac_siber_specter"]["use_alt_aim_hud"]=["true"] section_list["wpn_sig550_tac_siber_specter_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.062586", "-0.006873", "0"] section_list["wpn_sig550_tac_siber_specter_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.012937","0.010925","-0.057000"] section_list["wpn_sig550_siber_specter"]["use_alt_aim_hud"]=["true"] section_list["wpn_sig550_siber_specter_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.062586", "-0.006873", "0"] section_list["wpn_sig550_siber_specter_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.012937","0.010925","-0.057000"] ###################### section_list["wpn_ak12_mono_com_hud"]["aim_hud_offset_pos_16x9"]=["-0.068520","0.038","0"] section_list["wpn_ak12_mono_com_hud"]["aim_hud_offset_rot_16x9"]=["0.012937","0.010925","-0.057000"] section_list["wpn_ak12_hud"]["aim_hud_offset_pos_16x9"]=["-0.0903","0.0708","-0.28"] section_list["wpn_ak12_hud"]["aim_hud_offset_rot_16x9"]=["0.0415","0.0085","-0.0055"] section_list["wpn_ak12_bas_hud"]["aim_hud_offset_pos_16x9"]=["-0.071850","0.031","0"] section_list["wpn_ak12_bas_hud"]["aim_hud_offset_rot_16x9"]=["0.007437","0.009725","0.0045"] section_list["wpn_ak12_custom_hud"]["aim_hud_offset_pos_16x9"]=["-0.06172","0.0285","0"] section_list["wpn_ak12_custom_hud"]["aim_hud_offset_rot_16x9"]=["0.0165","-0.003275","-0.03"] del section_list["wpn_ak12_custom_mono_kit"]["parent_section"] section_list["wpn_ak12_custom_mono_kit_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.07", "-0.02", "0"] section_list["wpn_ak12_custom_mono_kit_hud"]["aim_hud_offset_alt_rot_16x9"]=["-0.036", "0.011", "0"] del section_list["wpn_ak12_custom_mono_kit_hud"]["aim_hud_offset_alt_pos_16x9"] del section_list["wpn_ak12_custom_mono_kit_hud"]["aim_hud_offset_alt_rot_16x9"] ################### ''' section_list["wpn_rattler_rwap"]["use_alt_aim_hud"]=["false"] del section_list["wpn_rattler_rwap_hud"]["aim_hud_offset_alt_pos_16x9"] del section_list["wpn_rattler_rwap_hud"]["aim_hud_offset_alt_rot_16x9"] section_list["wpn_rattler_rwap_hud"]["aim_hud_offset_pos_16x9"]=["-0.0903","0.0708","-0.28"] section_list["wpn_rattler_rwap_hud"]["aim_hud_offset_rot_16x9"]=["0.0415","0.0085","-0.0055"] section_list["wpn_rattler_rwap_hud"]["hands_orientation"]=["2","2","0"] section_list["wpn_rattler_rwap_hud"]["hands_orientation_16x9"]=["2","2","0"] section_list["wpn_rattler_rwap_hud"]["hands_position"]=["0.014135", "-0.056531", "0.236365"] section_list["wpn_rattler_rwap_hud"]["hands_position_16x9"]=["0.014135", "-0.056531", "0.236365"] section_list["wpn_rattler_rwap_hud"]["aim_hud_offset_pos_16x9"]=["-0.0903","0.0708","-0.28"] section_list["wpn_rattler_rwap_hud"]["aim_hud_offset_rot_16x9"]=["0.0415","0.0085","-0.0055"] ################### section_list["wpn_n4_rwap_specter_hud"]["aim_hud_offset_alt_pos_16x9"]=["-0.054202", "0.047488", "-0.088282"] section_list["wpn_n4_rwap_specter_hud"]["aim_hud_offset_alt_rot_16x9"]=["0.042846", "0.043977", "-0.1"] section_list["wpn_n4_rwap_specter_hud"]["hands_orientation_16x9"]=["2", "2", "0"] section_list["wpn_n4_rwap_specter_hud"]["hands_position_16x9"]=["-0.005383", "-0.054188", "0.224706"] ''' ################### for section_current in section_list: #if(section_current == "scope_mosin"): #section_list[section_current]["scope_x"] = ["68"] #section_list[section_current]["scope_y"] = ["-27"] #if(section_current == "scope_sks"): #section_list[section_current]["scope_x"] = ["68"] #section_list[section_current]["scope_y"] = ["-29"] #if(section_current == "scope_svt40"): #section_list[section_current]["scope_x"] = ["68"] #section_list[section_current]["scope_y"] = ["-21"] #if(section_current.find("ammo_") >= 0 and section_current.find("bad") > 0): #del_section_list.append(section_current) if(section_current.find("_hud") > 0): continue if(section_current.find("wpn_sil") >= 0): continue if(section_current.find("wpn_") < 0): continue #print("process ["+section_current+"]") str_log=("\n["+section_current+"]\n") log_file.write(str_log) #process_ammo_class() #process_zoom_factor_coc1_5() process_zoom_factor_anomaly_bas() #process_accuracy() #process_recoil() #process_cond_dec() #process_fire_distance() process_hit_power() if ("smoke_particles" in section_list[section_current].keys()): #section_list[section_current]["smoke_particles"] = ["weapons\generic_shoot_00"] del section_list[section_current]["smoke_particles"] if ("silencer_smoke_particles" in section_list[section_current].keys()): #section_list[section_current]["silencer_smoke_particles"] = ["weapons\generic_shoot_00"] del section_list[section_current]["silencer_smoke_particles"] if ("upgrades" in section_list[section_current].keys()): upgrade_list=section_list[section_current]["upgrades"] if "up_gr_fifthcd_ak12" in upgrade_list: upgrade_list_new = [] for upgrade in upgrade_list: if upgrade != "up_gr_fifthcd_ak12": upgrade_list_new.append(upgrade) section_list[section_current]["upgrades"]=upgrade_list_new #if ("slot" in section_list[section_current].keys()): #if (section_list[section_current]["slot"] == ["1"]): #section_list[section_current]["slot"] = ["4"] #section_list[section_current]["single_handed"] = ["1"] #del_section_list=[] #for section_current in section_list: #if(section_current.find("ammo_") >= 0 and section_current.find("bad") > 0): #del_section_list.append(section_current) #for section_current in del_section_list: #del section_list[section_current] #section_list["ammo_10x25_fmj"]["k_hit"] = ["1.4"] #section_list["ammo_10x25_hp"]["k_hit"] = ["1.6"] #section_list["wpn_gauss"]["bullet_speed"]=["2000"] #section_list["wpn_gauss"]["hit_power"]=["3"] #section_list["pri_a17_gauss_rifle"]["bullet_speed"]=["2100"] #section_list["pri_a17_gauss_rifle"]["hit_power"]=["3"] return def main_format_out_all(): print("\nwriting out\n") prop_len_max = get_prop_len_max() for file_in_path in glob.glob(weapon_cfg_dir_in_filter) + [(weapon_cfg_dir_in+"\\weapon_ammo.ltx")]: #for file_in_path in glob.glob(weapon_cfg_dir_in_filter) : file_name = file_in_path[len(weapon_cfg_dir_in)+1:] #print("write out " + file_name) file_in = open(file_in_path, mode='r') out_path = os.path.join(weapon_cfg_dir_out,file_name) if(os.path.exists(out_path)): os.remove(out_path) file_out = open(out_path, mode='w+') format_out__keep_blank_comment(file_in, file_out, prop_len_max) file_in.close() file_out.close() return def main(): #global section_list main_parse_all() main_process_all() main_format_out_all() ######################################### ####################################################### return main() log_file.close()