def loadHashes(kind): with open('scriptNames.txt', 'r') as f: HashList.append(NameHash40(kind, Hash40.CreateFromString( kind.lower()))) #Share animation for s in f: if (s != "\n"): s = (kind + s).strip() HashList.append( NameHash40(s, Hash40.CreateFromString(s.lower()))) if 'Special' in s or 'Final' in s: HashList.append( NameHash40( s.replace('Special', 'SpecialAir').replace( 'Final', 'FinalAir').strip(), Hash40.CreateFromString( s.replace('Special', 'SpecialAir').replace( 'Final', 'FinalAir').lower().strip())))
if 'Special' in s or 'Final' in s: HashList.append( NameHash40( s.replace('Special', 'SpecialAir').replace( 'Final', 'FinalAir').strip(), Hash40.CreateFromString( s.replace('Special', 'SpecialAir').replace( 'Final', 'FinalAir').lower().strip()))) articlesFile = open('articles.txt', 'r') for s in articlesFile: if (s != "\n"): s = s.replace("WEAPON_KIND_", "").strip() ArticleList.append( NameHash40(s.lower(), Hash40.CreateFromString(s.lower()))) class Article: # Character / Weapon def __init__(self, article, hashes=[]): self.article = article self.scriptsHash = hashes def addScriptHash(self, hash, address): self.scriptsHash.append(ScriptHash(hash, address)) def findHashValue(self): find = next((x for x in ArticleList if self.article.hash == x.hash40.hash and self.article.length == x.hash40.length), None) if find:
class NameHash40: def __init__(self, name, hash40): self.name = name self.hash40 = hash40 HashList = [] ArticleList = [] namesFile = open('scriptNames.txt', 'r') #Game HashList.append( NameHash40("game_".strip(), Hash40.CreateFromString("game_".lower().strip()))) HashList.append( NameHash40("sound_".strip(), Hash40.CreateFromString("sound_".lower().strip()))) HashList.append( NameHash40("effect_".strip(), Hash40.CreateFromString("effect_".lower().strip()))) HashList.append( NameHash40("expression_".strip(), Hash40.CreateFromString("expression_".lower().strip()))) for s in namesFile: if (s != "\n"): sc = s s = "game_" + s HashList.append( NameHash40(s.strip(), Hash40.CreateFromString(s.lower().strip())))