# A Python script to allow you to 'clone' a customized set of recommended items.
# Written by RheingoldRiver. Feel free to modify and share it but please don't
# claim you wrote it yourself if you do so.
# This code is intended to work with Enigma's Recommended Items Changer. I am
# in no way affiliated with Enigma and any errors here are entirely my own.
# If you have League installed in a different directory, edit the variables
# dirOrig and dirNew accordingly.
# The inputs are (1) a string of the champion whose build you want to clone;
# (2) a vector of strings of the champions to which you want to clone the build;
# (3) a string denoting which mode you want to take the build from; and (4)
# a string denoting which mode you want to copy the build to. Mode strings are
# "sr" for Summoner's Rift"; "dom" for Dominion; "pg" for Proving Grounds ARAM;
# and "tt" for Twisted Treeline.
# Example inputs:
# cloneBuild("Sona",["Janna","Nami","Lulu"],"sr","sr")
# will copy your Summoner's Rift Sona build to Janna, Nami, and Lulu on
# Summoner's Rift.
# cloneBuild("Irelia",["Irelia"],"sr","dom")
# will copy your Summoner's Rift Irelia build to Irelia on Dominion.
# If one of your builds contains items not available on a particular map then
# the program will still work; those items will just not appear in your
# recommended items on that map.
# This code is not exhaustively tested, so make sure you create a backup
# before using it.
import os
def cloneBuild(orig,new,mode1,mode2):
d1 = {"dom":"8", "sr":"1", "tt":"10", "pg":"3"}
d2 = {"sr":"CLASSIC", "dom":"ODIN", "tt":"CLASSIC", "pg":"ARAM"}
fileOrig = "EnigmaItem_" + d1[mode1] + "_" + d2[mode1] + "-0.json"
dirOrig = 'C:/Riot Games/League of Legends/Config/Champions/' + orig + '/Recommended/'
fOrig = dirOrig + fileOrig
f1 = open(fOrig,'r')
s = f1.readline()
f1.close()
for champ in new:
fileNew = "EnigmaItem_" + d1[mode2] + "_" + d2[mode2] + "-0.json"
dirNew = 'C:/Riot Games/League of Legends/Config/Champions/' + champ + '/Recommended/'
if not os.path.exists(dirNew):
os.makedirs(dirNew)
fNew = dirNew + fileNew
f2 = open(fNew,'w')
s = s.replace(orig,champ)
s = s.replace(d2[mode1],d2[mode2])
s = s.replace("\"map\":\""+d1[mode1]+"\"","\"map\":\""+d1[mode2]+"\"")
f2.write(s)
f2.close()
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.