Skip to content

Instantly share code, notes, and snippets.

@eglopez07
Forked from shiburizu/wakuwiki.py
Last active September 13, 2022 17:48
Show Gist options
  • Save eglopez07/d8a91ee4f4d5648f96b8f359718326be to your computer and use it in GitHub Desktop.
Save eglopez07/d8a91ee4f4d5648f96b8f359718326be to your computer and use it in GitHub Desktop.
UNICLR wikitext generator
#UNICLR CSV to wikitext
#Credit to Shiburizu for the original script: https://gist.github.com/shiburizu/b8ac5d3656d6b2724163d798e3389ca6
#For use with MoveData and AttackData at SRK/Mizuumi, or any other wiki with similar syntax
#First row of your CSV should have headers that are part of 'n' list, and the last row of your data should be indicated with 'END DATA' in the first column.
#Add section headers to the first column and denote them in c to have headers inserted at your desired points on the CSV.
#usage: uniwiki.py [csv] [name] [2-letter ID]
#example usage: python uniwiki.py yourfile.csv Hyde hy
import csv,sys
def wikitext(f,l,s):
if s != '':
f.write("%s%s\n" % (l,s.replace('&',',')))
else:
f.write("%s\n" % l)
n = ['Input','MoveID','Guard','Damage','MinDamage','Property','Cancel','Cost','Attribute','Startup','Active','Recovery','Landing','Overall','Advantage','Invul'] #header rows
e = 'END DATA' #end data keyword
c = ['Normal Moves','Universal Moves','Special Moves','Super Moves']
c2 = ['Standing Normal Moves','Crouching Normal Moves','Jumping Normal Moves','Command Normal Moves','Dash Moves']
c3 = ['Guard Thrust','Veil Off', 'IWEX']
f = open("uniclr.txt","w+")
curChar = sys.argv[2]
curCharId = sys.argv[3]
f.write('{{TOClimit|4}}\n')
f.write('== Move List ==\n\n')
with open(sys.argv[1],'r') as file:
for i in csv.DictReader(file):
d = dict(i)
altMove = ""
ccMove = ""
if d['Input'] == e: #end keyword
break
elif d['Input'] in c: #Check for Headers
f.write('===%s===\n\n' % d['Input'])
elif d['Input'] in c2: #Same as above
f.write('====%s====\n\n' % d['Input'])
elif d['Input'] in c3: #^^
if d['MoveID'].find("vorpal") != -1: altMove = ' (Vorpal)'
elif d['MoveID'].find("ic") != -1: altMove = ' (Increase)'
elif d['MoveID'].find("combo") != -1: ccMove = 'Cross Cast '
f.write('=====%s%s%s=====\n' % (ccMove,d['Input'],altMove))
f.write('{{FrameData-UNI/%s | character = %s ' % (d['Input'],curChar))
f.write('| moveId = %s_%s\n' % (curCharId,d['MoveID']))
if altMove == ' (Vorpal)':
f.write('|vorpal=yes\n')
elif altMove == ' (Increase)':
f.write('|increase=yes\n')
elif ccMove != "":
f.write('|crosscast=yes\n')
f.write('|name=\n')
f.write('|subtitle=\n')
f.write('|images=\n')
f.write('|hitboxes=\n')
wikitext(f,'|damage=', d['Damage'])
wikitext(f,'|mindamage=', d['MinDamage'])
f.write('}}\n\n')
else:
f.write('=====%s%s=====\n' % (d['Input'],altMove))
f.write('{{FrameData-UNI | character = %s ' % curChar)
f.write('| moveId = %s_%s\n' % (curCharId,d['MoveID']))
f.write('|input=%s\n' % d['Input'].replace('.',''))
f.write('|name=\n')
f.write('|subtitle=\n')
f.write('|images=UNI_%s_%s.png\n' % (curChar,d['Input']))
f.write('|hitboxes=\n')
wikitext(f,'|damage=', d['Damage'])
wikitext(f,'|mindamage=', d['MinDamage'])
wikitext(f,'|guard=', d['Guard'])
wikitext(f,'|cancel=', d['Cancel'])
wikitext(f,'|property=', d['Property'])
wikitext(f,'|cost=', d['Cost'])
wikitext(f,'|attribute=', d['Attribute'])
f.write('<!------------>\n')
wikitext(f,'|startup=', d['Startup'])
wikitext(f,'|active=', d['Active'])
wikitext(f,'|recovery=', d['Recovery'])
wikitext(f,'|landing=', d['Landing'])
wikitext(f,'|overall=', d['Overall'])
wikitext(f,'|frameAdv=', d['Advantage'])
wikitext(f,'|invul=', d['Invul'])
f.write('}}\n\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment