def __load_msgdhr__(self, f): with open(f, "r") as fd: for line in fd: if self.token_snapshot in line or self.token_packet in line: line = line.replace("#define", "") line = line.replace("# define", "") line = line.replace(" ", "\t") line = line.split('\t') newelement = "" for elem in line: if len(elem) > 0 and elem != "": newelement = elem break if self.token_packet in newelement: self.packets.append(newelement) elif self.token_snapshot in newelement: self.snapshots.append(newelement) else: gLogger.error("Unknow:", newelement) gLogger.write( gProject.path_filter + "infos_packettype.txt", self.packets, "{infos} {f}".format(infos="writing list PACKETTYPE in:", f=gProject.path_filter + "infos_snapshottype.txt")) gLogger.write( gProject.path_filter + "infos_snapshottype.txt", self.snapshots, "{infos} {f}".format(infos="writing list SNASHOPTYPE in:", f=gProject.path_filter + "infos_snapshottype.txt"))
def filter(self, path_model): gLogger.set_section("mdlobj") mdlobj_undeclared = list() mdlobj_model_missing = list() for it in self.datas: obj = self.datas[it] if obj["dwModelType"] not in self.define.datas and obj[ "dwModelType"] not in mdlobj_undeclared: mdlobj_undeclared.append(obj["dwModelType"]) model = "Obj_" + obj["szName"] + ".o3d" out = subprocess.run(['find', path_model, '-iname', model], stdout=subprocess.PIPE) if len(out.stdout) == 0 and it not in mdlobj_model_missing: mdlobj_model_missing.append(model) gLogger.write( gProject.path_filter + "mdlobj_undeclared.txt", mdlobj_undeclared, "{infos}: {undeclared}/{total}".format( infos="Obj undeclared:", undeclared=len(mdlobj_undeclared), total=len(self.datas))) gLogger.write( gProject.path_filter + "mdlobj_model_missing.txt", mdlobj_model_missing, "{infos}: {undeclared}/{total}".format( infos="Model not found:", undeclared=len(mdlobj_model_missing), total=len(self.datas))) gLogger.reset_section()
def filter(self, mdlobj): gLogger.set_section("world") obj_in_world = list() sfx_in_world = list() for it in self.worlds: world = self.worlds[it] gLogger.info("filtering {id}".format(id=str(world.id))) gLogger.info( "directory: {directory} height: {height} width: {width} indoor: {indoor}" .format(directory=world.directory, height=world.size.y, width=world.size.x, indoor=world.indoor)) for y in range(0, world.size.y): for x in range(0, world.size.x): for obj in world.lands[y][x].objs: if obj.dwModelID not in obj_in_world: obj_in_world.append(obj.dwModelID) for sfx in world.lands[y][x].sfxs: if sfx.dwModelID not in sfx_in_world: sfx_in_world.append(sfx.dwModelID) gLogger.write( gProject.path_filter + "world_" + str(world.id) + "_obj_find.txt", obj_in_world, "Unique Obj: {total}".format(total=len(obj_in_world))) gLogger.write( gProject.path_filter + "world_sfx_find.txt", sfx_in_world, "Unique Sfx: {total}".format(total=len(sfx_in_world))) gLogger.reset_section()
def filter(self): gLogger.info("Filtering propmover") gLogger.set_section("propmover") mover_undeclared = [] mover_unused = [] weapon_undeclared = [] mover_name_undeclared = [] mover_comment_undeclared = [] # pass for key in self.movers: mover = self.movers[key] # if key not in self.define.datas: # mover_undeclared.append(key) # if mover["szComment"] not in self.text.datas: # mover_comment_undeclared.append(key) # if mover["szName"] not in self.text.datas: # mover_name_undeclared.append(key) if self.items is not None: if mover["dwAtk1"] not in self.items: weapon_undeclared.append(mover["dwAtk1"]) if mover["dwAtk2"] not in self.items: weapon_undeclared.append(mover["dwAtk2"]) if mover["dwAtk3"] not in self.items: weapon_undeclared.append(mover["dwAtk3"]) gLogger.write(g_project.path_filter + "mover_undeclared.txt", mover_undeclared, "{infos}: {undeclared}/{total}".format( infos="Movers undeclared:", undeclared=len(mover_undeclared), total=len(self.movers))) gLogger.write(g_project.path_filter + "mover_unused.txt", mover_unused, "{infos}: {undeclared}/{total}".format( infos="Movers mover_unused:", undeclared=len(mover_unused), total=len(self.movers))) gLogger.write(g_project.path_filter + "mover_name_undeclared.txt", mover_name_undeclared, "{infos}: {undeclared}/{total}".format( infos="Movers mover_name_undeclared:", undeclared=len(mover_name_undeclared), total=len(self.movers))) gLogger.write(g_project.path_filter + "mover_comment_undeclared.txt", mover_comment_undeclared, "{infos}: {undeclared}/{total}".format( infos="Movers mover_comment_undeclared:", undeclared=len(mover_comment_undeclared), total=len(self.movers))) gLogger.reset_section() return mover_undeclared, mover_unused, weapon_undeclared, mover_name_undeclared, mover_comment_undeclared
def filter(self, textKarma): gLogger.set_section("propkarma") karma_name_undeclared = list() karma_comment_undeclared = list() karma_color_invalid = list() gLogger.info("name and comment") for it in self.karmas: karma = self.karmas[it] if karma.szName not in textKarma and karma.szName not in karma_name_undeclared: karma_name_undeclared.append(karma.szName) if karma.szComment not in textKarma and karma.szComment not in karma_name_undeclared: karma_comment_undeclared.append(karma.szComment) gLogger.info("color") for it in self.karmas: karma = self.karmas[it] try: nb = int(str(karma.dwColor), 16) except: if karma.dwColor not in karma_color_invalid: karma_color_invalid.append(karma.dwColor) gLogger.write( g_project.path_filter + "karma_name_undeclared.txt", karma_name_undeclared, "{infos}: {undeclared}/{total}".format( infos="names undeclared:", undeclared=len(karma_name_undeclared), total=len(self.karmas))) gLogger.write( g_project.path_filter + "karma_comment_undeclared.txt", karma_comment_undeclared, "{infos}: {undeclared}/{total}".format( infos="comment undeclared:", undeclared=len(karma_comment_undeclared), total=len(self.karmas))) gLogger.write( g_project.path_filter + "karma_color_invalid.txt", karma_color_invalid, "{infos}: {undeclared}/{total}".format( infos="color invalid:", undeclared=len(karma_color_invalid), total=len(self.karmas))) gLogger.reset_section() return karma_name_undeclared, karma_comment_undeclared
def filter(self, defineSkill, define, defineObj, defineJob, defineAttribute, defineNeuz, defineSound, path_icon, text_skill): gLogger.set_section("propskill") skill_undeclared = list() skill_parameter_undeclared = list() skill_icon_unfound = list() gLogger.info("filtering parameter") for it in self.skills: skill = self.skills[it] if skill.dwID not in defineSkill and skill.dwID not in skill_undeclared: skill_undeclared.append(skill.dwID) if skill.szName != "=" and skill.szName not in text_skill and skill.szName not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.szName) if skill.szComment != "=" and skill.szComment not in text_skill and skill.szComment not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.szComment) if skill.dwItemKind1 != "=" and skill.dwItemKind1 not in defineJob and skill.dwItemKind1 not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwItemKind1) if skill.dwItemKind2 != "=" and skill.dwItemKind2 not in defineJob and skill.dwItemKind2 not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwItemKind2) if skill.dwItemKind3 != "=" and skill.dwItemKind3 not in defineJob and skill.dwItemKind3 not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwItemKind3) if skill.dwItemJob != "=" and skill.dwItemJob not in defineJob and skill.dwItemJob not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwItemJob) if skill.dwHanded != "=" and skill.dwHanded not in defineJob and skill.dwHanded not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwHanded) if skill.dwAttackRange != "=" and skill.dwAttackRange not in defineAttribute and skill.dwAttackRange not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwAttackRange) if skill.dwExeTarget != "=" and skill.dwExeTarget not in define and skill.dwExeTarget not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwExeTarget) if skill.dwReferTarget1 != "=" and skill.dwReferTarget1 not in defineAttribute and skill.dwReferTarget1 not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwReferTarget1) if skill.dwSfxObj3 != "=" and skill.dwSfxObj3 not in defineObj and skill.dwSfxObj3 not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwSfxObj3) if skill.dwComboStyle != "=" and skill.dwComboStyle not in defineAttribute and skill.dwComboStyle not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwComboStyle) if skill.dwUseChance != "=" and skill.dwUseChance not in define and skill.dwUseChance not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwUseChance) if skill.dwSkillType != "=" and skill.dwSkillType not in defineAttribute and skill.dwSkillType not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwSkillType) if skill.dwUseMotion != "=" and skill.dwUseMotion not in defineNeuz and skill.dwUseMotion not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwUseMotion) if skill.dwSndAttack1 != "=" and skill.dwSndAttack1 not in defineSound and skill.dwSndAttack1 not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwSndAttack1) if skill.dwWeaponType != "=" and skill.dwWeaponType not in defineAttribute and skill.dwWeaponType not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwWeaponType) if skill.dwSpellRegion != "=" and skill.dwSpellRegion not in defineAttribute and skill.dwSpellRegion not in skill_parameter_undeclared: skill_parameter_undeclared.append(skill.dwSpellRegion) gLogger.info("filtering icons") for it in self.skills: skill = self.skills[it] icon = skill.szIcon icon = icon.replace('"', "") icon = icon.replace(" ", "") icon = icon.replace("\t", "") if len(icon) <= 0 or icon == "" or icon == "=": continue out = subprocess.check_output(['find', path_icon, '-iname', icon]) if (out == "" or len(out) <= 0) and icon not in skill_icon_unfound: skill_icon_unfound.append(icon) gLogger.write(g_project.path_filter + "skill_undeclared.txt", skill_undeclared, "{infos}: {undeclared}/{total}".format( infos="Skill undeclared:", undeclared=len(skill_undeclared), total=len(self.skills))) gLogger.write(g_project.path_filter + "skill_parameter_undeclared.txt", skill_parameter_undeclared, "{infos}: {undeclared}/{total}".format( infos="Parameter undeclared:", undeclared=len(skill_parameter_undeclared), total=len(self.skills))) gLogger.write(g_project.path_filter + "skill_icon_unfound.txt", skill_icon_unfound, "{infos}: {undeclared}/{total}".format( infos="Icon not found:", undeclared=len(skill_icon_unfound), total=len(self.skills))) gLogger.reset_section()
def filter(self, defineObj, defineItemKind, textCtrl): gLogger.set_section("propCtrl") ctrl_undeclared = [] ctrl_name_undeclared = [] ctrl_comment_undeclared = [] ctrl_item_kind_undeclared = [] ctrl_sfx_undeclared = [] gLogger.info("ID") for it in self.ctrls: ctrl = self.ctrls[it] if ctrl.dwID not in defineObj: if ctrl.dwID not in ctrl_undeclared: ctrl_undeclared.append(ctrl.dwID) gLogger.info("Name and Comment") for it in self.ctrls: ctrl = self.ctrls[it] if ctrl.szName not in textCtrl: if ctrl.szName not in ctrl_name_undeclared: ctrl_name_undeclared.append(ctrl.szName) if ctrl.szComment not in textCtrl: if ctrl.szComment not in ctrl_comment_undeclared: ctrl_comment_undeclared.append(ctrl.szComment) gLogger.info("Item Kind") for it in self.ctrls: ctrl = ctrls[it] if ctrl.dwCtrlKind1 not in defineItemKind: if ctrl.dwCtrlKind1 not in ctrl_item_kind_undeclared: ctrl_item_kind_undeclared.append(ctrl.dwCtrlKind1) if ctrl.dwCtrlKind2 not in defineItemKind: if ctrl.dwCtrlKind2 not in ctrl_item_kind_undeclared: ctrl_item_kind_undeclared.append(ctrl.dwCtrlKind2) if ctrl.dwCtrlKind3 not in defineItemKind: if ctrl.dwCtrlKind3 not in ctrl_item_kind_undeclared: ctrl_item_kind_undeclared.append(ctrl.dwCtrlKind3) gLogger.info("Sfx") for it in self.ctrls: ctrl = ctrls[it] if ctrl.dwSfxCtrl == "=": continue if ctrl.dwSfxCtrl not in defineObj and ctrl.dwSfxCtrl not in ctrl_sfx_undeclared: ctrl_sfx_undeclared.append(ctrl.dwSfxCtrl) gLogger.write( g_project.path_filter + "ctrl_undeclared.txt", ctrl_undeclared, "{infos}: {undeclared}/{total}".format( infos="Ctrl undeclared", undeclared=len(ctrl_undeclared), total=len(ctrls))) gLogger.write( g_project.path_filter + "ctrl_name_undeclared.txt", ctrl_name_undeclared, "{infos}: {undeclared}/{total}".format( infos="Ctrl Name undeclared:", undeclared=len(ctrl_name_undeclared), total=len(ctrls))) gLogger.write( g_project.path_filter + "ctrl_comment_undeclared.txt", ctrl_comment_undeclared, "{infos}: {undeclared}/{total}".format( infos="Ctrl Comment undeclared:", undeclared=len(ctrl_comment_undeclared), total=len(ctrls))) gLogger.write( g_project.path_filter + "ctrl_item_kind_undeclared.txt", ctrl_comment_undeclared, "{infos}: {undeclared}/{total}".format( infos="Ctrl ItemKind undeclared:", undeclared=len(ctrl_item_kind_undeclared), total=len(ctrls))) gLogger.write( g_project.path_filter + "ctrl_sfx_undeclared.txt", ctrl_sfx_undeclared, "{infos}: {undeclared}/{total}".format( infos="Ctrl SFX undeclared:", undeclared=len(ctrl_sfx_undeclared), total=len(ctrls))) gLogger.reset_section()
def filter(self, path_icon, textTroupeSkill, defineSkill, defineJob, define, defineObj, defineAttribute): gLogger.set_section("proptroupeskill") troupeskill_undeclared = list() troupeskill_parameter_undeclared = list() troupeskill_icon_unfound = list() gLogger.info("filtering parameters") for it in self.troupeSkills: troupeSkill = self.troupeSkills[it] if troupeSkill.dwID not in defineSkill and troupeSkill["dwID"] not in troupeskill_undeclared: troupeskill_undeclared.append(troupeSkill["dwID"]) if troupeSkill.szName != "=" and troupeSkill.szName not in textTroupeSkill and troupeSkill["dwID"] not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.szName) if troupeSkill.szComment != "=" and troupeSkill.szComment not in textTroupeSkill and troupeSkill.szComment not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.szComment) if troupeSkill.dwItemKind1 != "=" and troupeSkill.dwItemKind1 not in defineJob and troupeSkill.dwItemKind1 not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwItemKind1) if troupeSkill.dwItemKind2 != "=" and troupeSkill.dwItemKind2 not in defineJob and troupeSkill.dwItemKind2 not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwItemKind2) if troupeSkill.dwItemKind3 != "=" and troupeSkill.dwItemKind3 not in defineJob and troupeSkill.dwItemKind3 not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwItemKind3) if troupeSkill.dwItemJob != "=" and troupeSkill.dwItemJob not in defineJob and troupeSkill.dwItemJob not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwItemJob) if troupeSkill.dwExeTarget != "=" and troupeSkill.dwExeTarget not in define and troupeSkill.dwExeTarget not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwExeTarget) if troupeSkill.dwSfxObj2 != "=" and troupeSkill.dwSfxObj2 not in defineObj and troupeSkill.dwSfxObj2 not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwSfxObj2) if troupeSkill.dwSfxObj != "=" and troupeSkill.dwSfxObj not in defineObj and troupeSkill.dwSfxObj not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwSfxObj) if troupeSkill.dwSkillType != "=" and troupeSkill.dwSkillType not in defineAttribute and troupeSkill.dwSkillType not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwSkillType) if troupeSkill.dwUseChance != "=" and troupeSkill.dwUseChance not in define and troupeSkill.dwUseChance not in troupeskill_parameter_undeclared: troupeskill_parameter_undeclared.append(troupeSkill.dwUseChance) gLogger.info("filtering icons") for it in self.troupeSkills: troupeSkill = self.troupeSkills[it] icon = troupeSkill.szIcon icon = icon.replace('"', "") icon = icon.replace(" ", "") icon = icon.replace("\t", "") if len(icon) <= 0 or icon == "" or icon == "=": continue out = subprocess.check_output(['find', path_icon, '-iname', icon]) if (out == "" or len(out) <= 0) and icon not in troupeskill_icon_unfound: troupeskill_icon_unfound.append(icon) gLogger.write(g_project.path_filter + "troupeskill_undeclared.txt", troupeskill_undeclared, "{infos}: {undeclared}/{total}".format( infos="troupeSkill undeclared:", undeclared=len(troupeskill_undeclared), total=len(self.troupeSkills))) gLogger.write(g_project.path_filter + "troupeskill_parameter_undeclared.txt", troupeskill_parameter_undeclared, "{infos}: {undeclared}/{total}".format( infos="Parameter troupeskill undeclared:", undeclared=len(troupeskill_parameter_undeclared), total=len(self.troupeSkills))) gLogger.write(g_project.path_filter + "troupeskill_icon_unfound.txt", troupeskill_icon_unfound, "{infos}: {undeclared}/{total}".format( infos="Icon troupeskill not found:", undeclared=len(troupeskill_icon_unfound), total=len(self.troupeSkills))) gLogger.reset_section()