public ScriptControl(MainWindow parent)
        {
            try
            {
                this.parent = parent;
                eventTable["update"] = new List<string>();
                eventTable["interfaceInit"] = new List<string>();
                eventTable["processingFinished"] = new List<string>();
                eventTable["levelUp"] = new List<string>();
                LuaVM = new Lua();
                registerLuaFunctions(this);

                //LuaVM.RegisterFunction("RegisterEvent", this, parent.leagueInfo.GetType().GetMethod("registerEvent"));
                log("-----------------------------------------------------------");
                log("Overlay Init:" + DateTime.Now);
            }
            catch (Exception e)
            {
                log("[ERROR] (" + e.Source + "): " + e.Message + "\n" + e.StackTrace);
                throw;
            }
        }
Ejemplo n.º 2
0
 public static void setMainWindow(MainWindow mw)
 {
     parent = mw;
 }
 public KeyboardManager(MainWindow mw)
 {
     parent = mw;
 }
Ejemplo n.º 4
0
        /*
         * Loads all the summoner spell names/images and champion names/images
         * for reference in order to process the load screen
         */
        public LeagueInfo(MainWindow f)
        {
            try
            {
                // Load the backup champion name map
                string[] fileLines = File.ReadAllLines(LeagueUtils.FileFinder.fontConfigFinder());
                foreach (string line in fileLines)
                {
                    //An example of the line we're looking for: tr "game_character_displayname_Akali" = "Akali"
                    if (line.Contains("game_character_displayname"))
                    {
                        string baseName = line.Replace("tr \"game_character_displayname_", "");
                        int i = baseName.LastIndexOf("=") + 3;
                        string mappedname = baseName.Substring(i, baseName.Length - i - 1);
                        baseName = baseName.Substring(0, baseName.IndexOf("\"")).ToLower();
                        championNameMap.Add(baseName, mappedname);
                    }
                }
                form = f;

                //init summoner spell info table
                SummonerSpellInfo ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerBoost";
                ssi.name = "Cleanse";
                ssi.cooldown = 130;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerClairvoyance";
                ssi.name = "Clairvoyance";
                ssi.cooldown = 55;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerDot";
                ssi.name = "Ignite";
                ssi.cooldown = 120;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerExhaust";
                ssi.cooldown = 210;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerFlash";
                ssi.name = "Flash";
                ssi.cooldown = 225;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerFortify";
                ssi.name = "Fortify";
                ssi.cooldown = 300;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerHaste";
                ssi.name = "Ghost";
                ssi.cooldown = 210;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerHeal";
                ssi.name = "Heal";
                ssi.cooldown = 270;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerMana";
                ssi.name = "Clarity";
                ssi.cooldown = 180;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerPromote";
                ssi.name = "Promote";
                ssi.cooldown = 300;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerRally";
                ssi.name = "Rally";
                ssi.cooldown = 360;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerRevive";
                ssi.name = "Revive";
                ssi.cooldown = 520;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerSmite";
                ssi.name = "Smite";
                ssi.cooldown = 75;
                summonerSpellInfo[ssi.codeName] = ssi;

                ssi = new SummonerSpellInfo();
                ssi.codeName = "Spell_SummonerTeleport";
                ssi.name = "Teleport";
                ssi.cooldown = 240;
                summonerSpellInfo[ssi.codeName] = ssi;

                // Load the summoner spell images
                foreach (string key in summonerSpellInfo.Keys)
                {
                    summonerSpellInfo[key].image = (Bitmap)Image.FromFile(LeagueUtils.FileFinder.findSummonerSpells() + "\\" + key + ".png");
                }

                // Match strings similar to ""<word(s)>_<word(s)>""=""
                Regex r = new Regex(@"""(\w+)_(\w+)"" = ""([^""]+)");
                foreach (string s in File.ReadAllLines(LeagueUtils.FileFinder.fontConfigFinder()))
                {
                    Match m = r.Match(s);
                    if (m.Success)
                    {
                        string infoType = m.Groups[1].Value;
                        string infoID = m.Groups[2].Value;
                        string infoValue = m.Groups[3].Value;
                        if (infoType == "game_character_displayname" &&
                            File.Exists(LeagueUtils.FileFinder.findChampImageFolder() + "\\" + infoID + "_Square_0.png"))
                            cnames.Add(infoID, infoValue);
                    }
                }

                //get champion images for load screen processing
                foreach (FileInfo fi in new DirectoryInfo(LeagueUtils.FileFinder.findChampImageFolder()).GetFiles("*.jpg"))
                {
                    if (fi.Name.ToLower().Contains("_square_") || fi.Name.ToLower().Contains("_splash_") || fi.Name.Count(c => c == '_') != 1) continue;
                    ChampNameAndImage champ = new ChampNameAndImage();
                    champ.codeName = fi.Name.Split('_')[0];
                    champ.image = (Bitmap)Bitmap.FromFile(fi.FullName);
                    champData.Add(champ);
                }
                fileLines = null;
            }
            catch (Exception e)
            {
                sc.log("[ERROR] (" + e.Source + "): " + e.Message + "\n" + e.StackTrace);
                throw;
            }

        }
Ejemplo n.º 5
0
 public UIComponents(MainWindow parent)
 {
     activeComponents = new Dictionary<int, UIElement>();
     this.parent = parent;
 }