If anyone has tried to record replay files with something like Fraps or Bandicam, you know that you have to do a lot of work to get the emblems to show up properly.
The steps you have to go through for EACH emblem:
1. Find a guild without an Emblem in your replay 2. Find out the guild's ID number through ROPD 3. Find the file named "Chaos_GUILDNO_EMBLEMNO.ebm" and rename it to "_GUILDNO_EMBLEMNO.ebm" 4. Repeat for each guild that has no emblem
If a guild changes their emblem frequently, the EMBLEMNO will also change, making your newly renamed emblem file now useless for all future replays.
import shutil
import shutil
import re
import os
def prune(regex,top='.'):
filenames = []
sep=os.path.sep
matcher = re.compile(regex)
pieces=regex.split(sep)
partial_matchers = map(
re.compile,
(sep.join(pieces[:i+1]) for i in range(len(pieces))))
for root, dirs, files in os.walk(top,topdown=True):
for i in reversed(range(len(dirs))):
dirname=os.path.relpath(os.path.join(root,dirs[i]), top)
dirlevel=dirname.count(sep)
# print(dirname,dirlevel,sep.join(pieces[:dirlevel+1]))
if not partial_matchers[dirlevel].match(dirname):
print('pruning {0}'.format(
os.path.relpath(os.path.join(root,dirs[i]), top)))
del dirs[i]
for filename in files:
filename=os.path.relpath(os.path.join(root,filename))
# print('checking {0}'.format(filename))
if matcher.match(filename):
#print(filename)
filenames.append(filename)
return filenames
f = prune(r'Chaos_[0-9]+_[0-9]+.ebm')
f_prime = prune(r'_[0-9]+_[0-9]+.ebm')
print(str(len(f)) + ' emblems.')
for fileno in range(len(f)):
m = re.search('_[0-9]+_[0-9]+.ebm',f[fileno])
if m:
fname = m.group(0)
if fname not in f_prime:
shutil.copy(f[fileno],fname)
print(str(fileno) + ': ' + fname)
input("Press ENTER to exit...")
Simply place this python script into your _tmpEmblem folder, and run it. It will do everything in the list I wrote above, but on ALL emblems that start with "Chaos" in your entire folder. It made a copy of each of the 4472 emblems in my folder.
If you need to update the replay emblems, because someone changed their emblem, simply run the script again. It will not create duplicates of any replay-ready files already there.
You need python 3+ in order to run this.
EDIT: Made another script.
Spoiler
import shutil
import shutil
import re
import os
guildno = input("Enter Guild ID: ")
def prune(regex,top='.'):
filenames = []
sep=os.path.sep
matcher = re.compile(regex)
pieces=regex.split(sep)
partial_matchers = map(
re.compile,
(sep.join(pieces[:i+1]) for i in range(len(pieces))))
for root, dirs, files in os.walk(top,topdown=True):
for i in reversed(range(len(dirs))):
dirname=os.path.relpath(os.path.join(root,dirs[i]), top)
dirlevel=dirname.count(sep)
# print(dirname,dirlevel,sep.join(pieces[:dirlevel+1]))
if not partial_matchers[dirlevel].match(dirname):
print('pruning {0}'.format(
os.path.relpath(os.path.join(root,dirs[i]), top)))
del dirs[i]
for filename in files:
filename=os.path.relpath(os.path.join(root,filename))
# print('checking {0}'.format(filename))
if matcher.match(filename):
#print(filename)
filenames.append(filename)
return filenames
f = prune(r'_[0-9]+_[0-9]+.ebm')
files = prune(r'_' + str(guildno) + '_([0-9]+)')
if len(files) > 0:
print("Emblems found:")
for i in range(len(files)):
print(str(i + 1) + ": " + files[i])
copyno = input("Choose emblem to copy: ")
copyno = int(copyno) - 1
start = input("Enter start range: ")
end = input("Enter end range: ")
print("Duplicating from " + start + " to " + end + ".")
start = int(start)
end = int(end)
for i in range(start,end + 1):
fname = '_' + guildno + '_' + str(i) + '.ebm'
if fname not in f:
print(fname)
shutil.copyfile(files[copyno],fname)
else:
print("No emblems found.")
input("Press ENTER to exit...")
If you run the first script, and find that it STILL isn't finding the guild's emblem, it's probably because the guild changed their emblem before you ran the first script, and the "old" emblem is now lost.
But don't fret! This second script will allow you to duplicate already existing emblems, in case you missed one at some point.
This one actually takes some input. Here's what an example run would look like:
Spoiler
Enter Guild ID: 20574 Emblems found: 1: _20574_1.ebm 2: _20574_2.ebm 3: _20574_3.ebm Choose emblem to copy: 2 Enter start range: 1 Enter end range: 10 Duplicating from 1 to 10. _20574_4.ebm _20574_5.ebm _20574_6.ebm _20574_7.ebm _20574_8.ebm _20574_9.ebm _20574_10.ebm
It shouldn't be too difficult to use, but feel free to ask questions if it doesn't work.
Disclaimer: I hope this is alright to post here. It doesn't do anything magical, nor does it try to do anything malicious. The code is all visible in the spoilers, for anyone to verify the functionality for themselves.