Tuesday, May 7, 2013

Clone Recommended Item Builds Update

I updated this for Howling Abyss and figured I'd repost.  Enjoy!

Link to OP. 

# 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; "ha" for Howling Abyss;
# 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.

ADC = ["Ashe", "Caitlyn", "Corki", "Draven", "Ezreal", "Graves", "Kayle",
       "Kogmaw", "MissFortune", "Quinn", "Sivir", "Tristana", "Twitch", "Urgot",
       "Varus", "Vayne"]
SUPPORT = ["Alistar", "Blitzcrank", "Fiddlesticks", "Janna", "Leona", "Lulu",
            "Lux", "Nami", "Nidalee", "Nunu", "Sona", "Soraka", "Taric",
            "Thresh", "Zilean", "Zyra"]
APMANA = ["Ahri", "Anivia", "Annie", "Brand", "Cassiopeia", "ChoGath", "Diana",
          "Elise", "Evelynn", "Fizz", "Galio", "Gragas", "Heimerdinger",
          "Karma", "Karthus", "Kassadin", "LeBlanc", "Lissandra", "Malzahar",
          "Morgana", "Orianna", "Ryze", "Sion", "Swain", "Syndra", "Teemo",
          "TwistedFate", "Veigar", "Viktor", "Xerath", "Ziggs"]
APMANALESS = ["Akali", "Katarina", "Kennen", "Mordekaiser", "Rumble",
              "Vladimir"]
ADBRUISER = ["Darius", "DrMundo", "Fiora", "Gangplank", "Garen", "Hecarim",
             "Irelia", "JarvanIV", "Jax", "Jayce", "Khazix", "LeeSin",
             "MasterYi", "Nasus", "Nocturne", "Olaf", "Pantheon", "Poppy",
             "Rammus", "Renekton", "Rengar", "Riven", "Shaco", "Shen",
             "Shyvana", "Skarner", "Talon", "Trundle", "Tryndamere", "Udyr",
             "Vi", "MonkeyKing", "XinZhao", "Yorick", "Zac", "Zed"]
APBRUISER = ["Amumu", "Malphite", "Maokai", "Nautilus", "Sejuani", "Singed",
             "Volibear", "Warwick"]
ALL = ADC + SUPPORT + APMANA + APMANALESS + ADBRUISER + APBRUISER


import os
def cloneBuild(orig,new,mode1,mode2):
    d1 = {"dom":"8", "sr":"1", "tt":"10", "pg": "3", "ha":"12"}
    d2 = {"sr":"CLASSIC", "dom":"ODIN", "tt":"CLASSIC", "pg":"any", "ha":"any"}
    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()


2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete

Note: Only a member of this blog may post a comment.