def check_for_equals_no(path, output_file): originalpath = path nodict = {} linedict = {} filedict = {} searchstrings = ['= no'] filterstrings = ['research_cost', 'start_year'] thingstripped = '=no' triggerlist = find_scripted_triggers(originalpath) commonpath = os.path.join(originalpath, 'common') path = os.path.join(commonpath, 'national_focus') nodict, linedict, filedict = create_search_dict(nodict, linedict, filedict, path, searchstrings, filterstrings, thingstripped, searchstrings2=triggerlist) path = os.path.join(commonpath, 'decisions') nodict, linedict, filedict = create_search_dict(nodict, linedict, filedict, path, searchstrings, filterstrings, thingstripped, searchstrings2=triggerlist) for key in nodict: result = "= no is used in file " + filedict[key] + " on line " + str( linedict[key]) + ".\n" #print(result) output_file.write(result)
def check_for_unused_OOB(path, output_file): originalpath = path #this creates a dict of all the oobs that exist oobdict = {} newoobdict = {} linedict = {} filedict = {} searchstrings = ['OOB = ', 'load_oob = ', 'oob = '] filterstrings = [] thingstripped = 'oob' path = os.path.join(path, 'history', 'countries') finaldict = actually_check_for_unused_oob(originalpath, newoobdict) oobdict, linedict, filedict = create_search_dict(oobdict, linedict, filedict, path, searchstrings, filterstrings, thingstripped) path = os.path.join(originalpath, 'common', 'technologies') oobdict, linedict, filedict = create_search_dict(oobdict, linedict, filedict, path, searchstrings, filterstrings, thingstripped) oobdict, linedict, filedict = search_effects(oobdict, linedict, filedict, originalpath, searchstrings, filterstrings, thingstripped) for key in oobdict: #print(key) finaldict[key] = True for key in finaldict: if finaldict[key] == False: result = "The oob " + key + " is not used by anything.\n" #print(result) output_file.write(result)
def check_for_missing_OOB(path, output_file): originalpath = path #this creates a dict of all the oobs that are referenced oobdict = {} linedict = {} filedict = {} searchstrings = ['OOB = ', 'load_oob = ', 'oob = '] filterstrings = [] thingstripped = 'oob' path = os.path.join(path, 'history', 'countries') oobdict, linedict, filedict = create_search_dict(oobdict, linedict, filedict, path, searchstrings, filterstrings, thingstripped) oobdict, linedict, filedict = search_effects(oobdict, linedict, filedict, originalpath, searchstrings, filterstrings, thingstripped) finaldict = actually_check_for_missing_oob(originalpath, oobdict) for key in finaldict: if finaldict[key] == False: result = "The oob " + key + " referenced in file " + filedict[ key] + " on line " + str(linedict[key]) + " does not exist.\n" #print(result) output_file.write(result)
def check_for_missing_OOB(path, output_file): originalpath = path #this creates a dict of all the oobs that are referenced path+="\\history\\countries" oobdict = {} linedict = {} filedict = {} searchstrings = ['OOB = ', 'load_oob = '] oobdict, linedict, filedict = create_search_dict(oobdict, linedict, filedict, path, searchstrings, [], 'oob') path = originalpath + "\\events" oobdict, linedict, filedict = create_search_dict(oobdict, linedict, filedict, path, searchstrings, [], 'oob') path = originalpath + "\\common\\national_focus" oobdict, linedict, filedict = create_search_dict(oobdict, linedict, filedict, path, searchstrings, [], 'oob') path = originalpath + "\\common\\scripted_effects" oobdict, linedict, filedict = create_search_dict(oobdict, linedict, filedict, path, searchstrings, [], 'oob') path = originalpath + "\\common\\decisions" oobdict, linedict, filedict = create_search_dict(oobdict, linedict, filedict, path, searchstrings, [], 'oob') finaldict = actually_check_for_missing_oob(originalpath, oobdict) for key in finaldict: if finaldict[key] == False: result = "The oob " + key + " referenced in file " + filedict[key] + " on line " + str(linedict[key]) + " does not exist.\n" #print(result) output_file.write(result)
def check_for_missing_focus(path, output_file): #this creates a dict of all the focuses that are referenced path = os.path.join(path, 'common', 'national_focus') focusdict = {} linedict = {} filedict = {} focusdict, linedict, filedict = create_search_dict(focusdict, linedict, filedict, path, ['focus = '], ['event', '.'], 'focus') finaldict = actually_check_for_missing_focus(path, focusdict) for key in finaldict: if finaldict[key] == False: result = "The focus " + key + " referenced in file " + filedict[ key] + " on line " + str(linedict[key]) + " does not exist.\n" #print(result) output_file.write(result)
def check_for_missing_loc(path, output_file, searchdict): originalpath = path nodict = {} linedict = {} filedict = {} searchfocusstrings = ['id ='] filterfocusstrings = ['event'] searcheventstrings = ['title =', 'desc =', 'name ='] filtereventstrings = [ '\"', "set_province_name", "reset_state_name", "set_state_name", "add_named_threat", '{ideology', '{ ideology' ] searchtechstrings = ['enable_equipments ='] filtertechstrings = [] searchdecisionstrings = ['= {'] filterdecisionstrings = [ 'ai_will_do', 'allowed', 'modifier', 'available', 'visible', 'highlight_states', 'cancel_trigger' ] thingstripped = 'lockey' loclist = find_locs(originalpath) skipfiles = [] if not searchdict['check_air_doctrine_loc']: skipfiles.append("air_doctrine.txt") if not searchdict['check_air_tech_loc']: skipfiles.append("air_techs.txt") if not searchdict['check_armor_loc']: skipfiles.append("armor.txt") if not searchdict['check_artillery_loc']: skipfiles.append("artillery.txt") if not searchdict['check_electro_mechanical_eng_loc']: skipfiles.append("electronic_mechanical_engineering.txt") if not searchdict['check_industry_loc']: skipfiles.append("industry.txt") if not searchdict['check_infantry_loc']: skipfiles.append("infantry.txt") if not searchdict['check_land_doctrine_loc']: skipfiles.append("land_doctrine.txt") if not searchdict['check_naval_loc']: skipfiles.append("naval.txt") if not searchdict['check_naval_doctrine_loc']: skipfiles.append("naval_doctrine.txt") if not searchdict['check_support_loc']: skipfiles.append("support.txt") commonpath = os.path.join(originalpath, 'common') path = os.path.join(commonpath, 'national_focus') nodict, linedict, filedict = create_search_dict(nodict, linedict, filedict, path, searchfocusstrings, filterfocusstrings, thingstripped) path = os.path.join(originalpath, 'events') nodict, linedict, filedict = create_search_dict(nodict, linedict, filedict, path, searcheventstrings, filtereventstrings, thingstripped) path = os.path.join(commonpath, 'technologies') nodict, linedict, filedict = create_search_dict( nodict, linedict, filedict, path, searchtechstrings, filtertechstrings, thingstripped, skipfiles=skipfiles ) #skipfiles is added so that way it can skip tech files that are identical to vanilla path = os.path.join(commonpath, 'decisions') nodict, linedict, filedict = create_search_dict(nodict, linedict, filedict, path, searchdecisionstrings, filterdecisionstrings, thingstripped) for key in nodict: if (key in loclist) == False: result = "loc key " + key + " in file " + filedict[ key] + " on line " + str(linedict[key]) + " is missing\n" #if ('decision' in filedict[key]): #print(result) output_file.write(result)
def check_for_vp_loc(path, output_file, endo): debug = False vpdict = {} locdict = {} linedict = {} filedict = {} loclinedict = {} locfiledict = {} searchstrings = ['victory_points = '] if endo: locsearchstrings = ['endo_vp_'] else: locsearchstrings = ['VICTORY_POINTS_'] filterstrings = [] locfilterstrings = ['TOOLTIP'] thingstripped = 'vp' locthingstripped = 'vp_loc' statepath = os.path.join(path, 'history', 'states') locpath = os.path.join(path, 'localisation') if debug == True: print("calling create search dict") vpdict, linedict, filedict = create_search_dict(vpdict, linedict, filedict, statepath, searchstrings, filterstrings, thingstripped) if debug == True: print("calling create search dict again") locdict, loclinedict, locfiledict = create_search_dict( locdict, loclinedict, locfiledict, locpath, locsearchstrings, locfilterstrings, locthingstripped, checkfiles="victory_points") if locdict == {}: locdict, loclinedict, locfiledict = create_search_dict( locdict, loclinedict, locfiledict, locpath, locsearchstrings, locfilterstrings, locthingstripped) for key in locdict: if key in vpdict: vpdict[key] = True for key in vpdict: if vpdict[key] == False: if endo: result = "The vp " + key + " on line " + str( linedict[key]) + " of " + filedict[ key] + " does not have any endonym localization.\n" else: result = "The vp " + key + " on line " + str( linedict[key]) + " of " + filedict[ key] + " does not have any localization.\n" if debug == True: print(result) output_file.write(result) else: locdict[key] = True for key in locdict: if locdict[key] == False: result = "The vp localization " + key + " on line " + str( loclinedict[key]) + " of " + locfiledict[ key] + " does not have any corresponding victory point.\n" if debug == True: print(result) output_file.write(result)