Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # This script takes the encoded blob from a vanilla wowhead talent link
- # and outputs a link to wowprovider
- import sys
- if len(sys.argv) < 2:
- sys.exit("Usage: "+sys.argv[0]+" [WowHead string]");
- whstr = sys.argv[1].strip()
- treecounts = (
- (16, 16, 15), # druid
- (16, 14, 16), # hunter
- (16, 16, 17), # mage
- (15, 15, 15), # paladin
- (15, 16, 16), # priest
- (15, 19, 17), # rogue
- (15, 16, 15), # shaman
- (17, 17, 16), # warlock
- (18, 17, 17) # warrior
- );
- classname = ("druid","hunter","mage","paladin","priest","rogue","shaman","warlock","warrior")
- classid = (11,3,8,2,5,4,7,9,1)
- encrypt_string = '0zMcmVokRsaqbdrfwihuGINALpTjnyxtgevElBCDFHJKOPQSUWXYZ123456789Z'
- classindex = int(encrypt_string.find(whstr[0]) / 3)
- # fix for rogues?
- if classindex == 9: classindex = 5
- print classname[classindex]
- outstr = ""
- curtree = 0
- curstr = ""
- for c in whstr[1:]:
- if c == 'Z':
- curstr += "".zfill(treecounts[classindex][curtree] - len(curstr))
- outstr += curstr
- curstr = ""
- curtree += 1
- else:
- in_val = int(encrypt_string.find(c))
- curstr += str(int(in_val / 6))
- if len(curstr) >= treecounts[classindex][curtree]:
- outstr += curstr
- curstr = ""
- curtree += 1
- if curtree >= 3:
- break;
- else:
- curstr += str(in_val % 6)
- if len(curstr) >= treecounts[classindex][curtree]:
- outstr += curstr
- curstr = ""
- curtree += 1
- if curstr != "":
- curstr += "".zfill(treecounts[classindex][curtree] - len(curstr))
- outstr += curstr
- print outstr
- # mangle it for wowprovider.com
- for i in range(26,1,-1):
- outstr = outstr.replace("".zfill(i),chr(ord('a')+i),1)
- print "http://www.wowprovider.com/?talent=11215875_"+str(classid[classindex])+"_8"+outstr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement