League Tools V6.05 - 05-07-18

Post gaming related scripts
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: League Tools V5.6 - 01-11-17

11 Jan 2017, 15:54

Changelog v5.6:

Settings GUI added
Passwords are now encrypted
Skin/champ sales updated for year end bug
csin

Re: League Tools V5.6 - 01-11-17

15 Jan 2017, 03:03

Hi I just updated to V5.6 and experiencing a problem :(

It keeps making the lol client window "resteal focus". So, I can't surf the web when I'm in queue. I can't do anything else, I have a lol client stuck in my face.

If I reload the script, the problem goes away. But will eventually bug again after a few logins.
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: League Tools V5.6 - 01-11-17

16 Jan 2017, 13:40

csin wrote:Hi I just updated to V5.6 and experiencing a problem :(

It keeps making the lol client window "resteal focus". So, I can't surf the web when I'm in queue. I can't do anything else, I have a lol client stuck in my face.

If I reload the script, the problem goes away. But will eventually bug again after a few logins.

Can you give me a little more info? Are you using the 'Restart Queue Key'? How many times does it take to show the problem? I will take a look at it and try to post an update shortly solving this problem. Thank you for the bug report!
csin

Re: League Tools V5.6 - 01-11-17

18 Jan 2017, 05:34

I don't use restart queue/hotkeys. I just alt f4 and cycle thru my 6 accs. I rightclick the tray icon -> Select Acc -> rightclick -> Login Only.

I'm not sure how to consistently reproduce the bug sorry. On the bright side, it has motivated me to look for a workaround. It's drastically reduced the bug occurring.

http://www.sevenforums.com/tutorials/90 ... nable.html

My mouse is now set to ease of access hover. Riot's stupid UI can't lock me out of my own PC anymore :D
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: League Tools V5.7 - 01-18-17

18 Jan 2017, 20:01

Changelog 5.7:

Small update to fix multiple login window hang
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: League Tools V5.6 - 01-11-17

18 Jan 2017, 20:09

csin wrote:I don't use restart queue/hotkeys. I just alt f4 and cycle thru my 6 accs. I rightclick the tray icon -> Select Acc -> rightclick -> Login Only.

I'm not sure how to consistently reproduce the bug sorry. On the bright side, it has motivated me to look for a workaround. It's drastically reduced the bug occurring.

http://www.sevenforums.com/tutorials/90 ... nable.html

My mouse is now set to ease of access hover. Riot's stupid UI can't lock me out of my own PC anymore :D
Hey good you found a workaround! I also think I found the problem and fixed it in 5.7, it was due to a counter not clearing properly between login attempts. It should work for any number of logins now. Let me know if there if any other strange behavior. Thank you again for your input!
cocaptainjack
Posts: 8
Joined: 07 Feb 2017, 21:36

Re: League Tools V5.7 - 01-18-17

07 Feb 2017, 22:11

Is there a risk of getting ban for using this?
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: League Tools V5.7 - 01-18-17

08 Feb 2017, 11:45

cocaptainjack wrote:Is there a risk of getting ban for using this?
No, there have been zero bans from using this. This program is registered through the Riot dev program and uses legitimate
keys and calls so everything is above board. Honestly the only scripts Riot cares about are the ones that automatically control
the champions and there isn't any of that kind of thing in this script. Feel free my friend. GL HF GG.
cocaptainjack
Posts: 8
Joined: 07 Feb 2017, 21:36

Re: League Tools V5.7 - 01-18-17

10 Feb 2017, 01:13

Ruevil2 wrote:
cocaptainjack wrote:Is there a risk of getting ban for using this?
No, there have been zero bans from using this. This program is registered through the Riot dev program and uses legitimate
keys and calls so everything is above board. Honestly the only scripts Riot cares about are the ones that automatically control
the champions and there isn't any of that kind of thing in this script. Feel free my friend. GL HF GG.

AWESOME. I was just thinking about making an autologin and queue accepter and thought i'd google first about it. I'm excited to look through your code and also use your script :)
cocaptainjack
Posts: 8
Joined: 07 Feb 2017, 21:36

Re: League Tools V5.7 - 01-18-17

10 Feb 2017, 02:47

Does this script have Auto Queue pop accept for ranked/flex?
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: League Tools V5.7 - 01-18-17

10 Feb 2017, 12:00

cocaptainjack wrote:Does this script have Auto Queue pop accept for ranked/flex?
I am not sure. I mostly play ARAM lately and haven't used that function in a while so it could be broken at the moment.
I will try to look into it but it looks like a busy weekend.
cocaptainjack
Posts: 8
Joined: 07 Feb 2017, 21:36

Re: League Tools V5.7 - 01-18-17

10 Feb 2017, 13:14

Ruevil2 wrote:
cocaptainjack wrote:Does this script have Auto Queue pop accept for ranked/flex?
I am not sure. I mostly play ARAM lately and haven't used that function in a while so it could be broken at the moment.
I will try to look into it but it looks like a busy weekend.
Those Queues have changed a bit. They also want you to select roles before queueing up as well. (top, bot, support, mid, jungle, and fill) (two roles). No rush!
cocaptainjack
Posts: 8
Joined: 07 Feb 2017, 21:36

Re: League Tools V5.7 - 01-18-17

15 Feb 2017, 00:05

Also, would this tool work for the new client?
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: League Tools V5.7 - 01-18-17

16 Feb 2017, 12:18

cocaptainjack wrote:Also, would this tool work for the new client?
It will soon. I am in the process of updating it for the beta client.
cocaptainjack
Posts: 8
Joined: 07 Feb 2017, 21:36

Re: League Tools V5.7 - 01-18-17

17 Feb 2017, 13:14

Ruevil2 wrote:
cocaptainjack wrote:Also, would this tool work for the new client?
It will soon. I am in the process of updating it for the beta client.
Awesome! hope you can take a look at the ranked queues as well
cocaptainjack
Posts: 8
Joined: 07 Feb 2017, 21:36

Re: League Tools V5.7 - 01-18-17

26 Mar 2017, 19:47

Would you need any help updating the software for the new client?
FreeloKiddo
Posts: 1
Joined: 16 Apr 2017, 05:56

Re: League Tools V5.7 - 01-18-17

16 Apr 2017, 18:12

I did everything that the thread told me to do and it still won't work.

It doesn't auto-login, doesn't auto-qeue or afk accept.

What am I doing wrong?

I get no errors just nothing.
User avatar
Wickster
Posts: 21
Joined: 19 Apr 2014, 23:02

Re: League Tools V5.7 - 01-18-17

16 Apr 2017, 21:31

FreeloKiddo wrote:I did everything that the thread told me to do and it still won't work.

It doesn't auto-login, doesn't auto-qeue or afk accept.

What am I doing wrong?

I get no errors just nothing.
what OS are you running ? also is the script running ? how do you know ? explain in details exactly what you did to make it run/work. also make sure you have autohotkey installed and up to date
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: League Tools V5.7 - 01-18-17

20 Apr 2017, 09:27

FreeloKiddo wrote:I did everything that the thread told me to do and it still won't work.

It doesn't auto-login, doesn't auto-qeue or afk accept.

What am I doing wrong?

I get no errors just nothing.
This script is being updated for the new client UI. Currently there are some issues with targeting the username and password boxes that I am working on. Switching back to the legacy client will cause the script to work. Look for an update for the new UI soon, it is in progress!
Osi
Posts: 7
Joined: 18 Sep 2016, 06:02
GitHub: CaptainOsi

Re: League Tools V5.7 - 01-18-17

24 Apr 2017, 06:15

Hello,

Here is the script to connect to the new client. (hope it's works)

Code: Select all


If not A_IsAdmin
{
    Run *RunAs "%A_ScriptFullPath%"
	ExitApp
}

#SingleInstance, Force
#Persistent
#InstallMouseHook
#InstallKeybdHook
CoordMode,Mouse,Window
CoordMode,Pixel,Window
OnExit, ExitSub

Confine = True
global ColorA = 0xB36C0F
global cDist = 39
global cDist1 = 20
global Stime
ChatT = 0
tsecs = 3
ver = v5.7

TwitchStreamers := "TSM_hauntzer,tsm_svenskeren,tsm_bjergsen,tsm_doublelift,imt_huni,imt_reignover,sprattel_lol,pobelter,imt_wildturtle,imt_adrian,c9balls,c9rush,jensen,c9sneaky,hail9,bunnyfufuu,zionspartan,xmithie,lolwhoishe,stixxay,aphromoo,nrgimpact,moonlol,nrggbm,altec,konkwon,seraph,crumbzz,freezecz,hakuholol,birryyu,kireiop,shiphtur,apollo_price,kiwikid,echokfo,hard_lol,froggen,keithmcbrief,lourlo,liquiddardoch,fenixl0l,piglet,matlife_na,odoamne,jankos,yoosangwook,lolvander,kikis1205,trick_lol,perrkz,emperorkr,lolhybrid,cabochardlol,shooklol,nukeducklol,kasinglol,gamsulol,fnc_spirit,fabiantje,rekkles,klajbajk,godgilius,eikap,mrrallez,trashylol,sencux,kobbelol,airwaks,betsy_lol,tabzzhd,noxiak,smittyj1,pepiinero,vizicsacsi,l0ulex,steeelback,wunderwearisfame,yellowstarr,h2khjarnan,watdefox,nightblue3,trick2g,imaqtpie,valkrin,azoh,tsm_dyrus,nervarien,saintvicious,voyboy,scarra,IWillDominate,mushisgosu,meteos,xpecial,quaslol,krepo"
AzubuStreamers := "Amazing,sOAZ,xPeke,Niels,Mithy,Wisdom,Hipo,Crush,Edge,Guger,Soul,flawless,Sasin,Nuclear,Secret,Flame,Chaser,CoCo,Fury,Pure,Untara,Bubbling,Bdd,Kramer,MadLife,Cuvee,Ambition,Crown,CoreJJ,Wraith,Duke,Blank,Faker,Bang,Wolf,ssumday,Score,Fly_Kr,Arrow,Ignar,TrAce,Winged,Kuzan,Pilot,Chei,Mash,gate,Ninja"
YouTubeStreamers := ""

Menu, Tray, NoStandard
Menu, Tray, UseErrorLevel
Menu, Tray, Tip, League Tools %ver%
ComObjError(0)
WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")

IfExist C:\Riot Games\League of Legends\LeagueClient.exe
{
	RiotPathF = C:\Riot Games\League of Legends\LeagueClient.exe
	Menu, Tray, Icon, %RiotPathF%, 1
	If !Reg || (Reg = "ERROR")
	{
		FileRead, regi, C:\Riot Games\League of Legends\RADS\system\system.cfg
		RegExMatch(regi, "i)Region=(.*)", Region)
		If Region1
			Reg := Region1
		else
			Reg =
	}
	If !Loc || (Loc = "ERROR")
	{
		FileRead, loca, C:\Riot Games\League of Legends\RADS\system\locale.cfg
		RegExMatch(loca, "i)Locale=(.*)", Locale)
		If Locale1
			Loc := Locale1
		else
			Loc =
	}
}
else
{
	x = 0
	SelectLeague:
	FileSelectFile, RiotPath, M3, C:\, Select League Launcher, *.exe
	StringReplace, RiotPathF, RiotPath, `n, \
	StringSplit, RiotPath, RiotPath, `n
	if RiotPathF = 
	{
		x++
		If x = 3
			Goto, LauncherNotFound
		Goto, SelectLeague
	}
	Menu, Tray, Icon, %RiotPathF%, 1
	If !Reg || (Reg = "ERROR")
	{
		FileRead, regi, %RiotPath%\RADS\system\system.cfg
		RegExMatch(regi, "i)Region=(.*)", Region)
		If Region1
			Reg := Region1
		else
			Reg =
	}
	If !Loc || (Loc = "ERROR")
	{
		FileRead, loca, %RiotPath%\RADS\system\locale.cfg
		RegExMatch(loca, "i)Locale=(.*)", Locale)
		If Locale1
			Loc := Locale1
		else
			Loc =
	}
}
TrayTip, League Tools %ver%, League launcher found., %tsecs%
LauncherNotFound:

SplitPath, A_ScriptName,,,, ScriptName
IfNotExist %A_ScriptDir%\%ScriptName%\INI
	FileCreateDir, %A_ScriptDir%\%ScriptName%\INI
IfNotExist %A_ScriptDir%\%ScriptName%\Skins
	FileCreateDir, %A_ScriptDir%\%ScriptName%\Skins
IfNotExist %A_ScriptDir%\%ScriptName%\ChampIcons
	FileCreateDir, %A_ScriptDir%\%ScriptName%\ChampIcons
	
IfExist %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini
{
	Loop,
	{
		IniRead, Login%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Username
		IniRead, Pass%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Password
		;IniRead, SumName%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, SumName
		;IniRead, SumID%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, SumID
		IfInString, Login%A_Index%, ERROR
		{
			Login%A_Index% := 
			break
		}
	}
	IniRead, Reg, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Region, Reg, %A_Space%
	IniRead, Loc, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Locale, Loc, %A_Space%
	IniRead, lgn, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, DefaultLogin, lgn, 1
	IniRead, QueueWaitTime, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, QueueTime, QueueWaitTime, 500
	IniRead, Toaster, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Toaster, Toaster, 0
}
else
{
	InputBox, Login1, League Tools %ver%, This appears to be the first run of the script. Please input a username.
	InputBox, Pass1, League Tools %ver%, Please input a password., HIDE
	
	e4=
(
[Login1]
Username=%Login1%
Password=%Pass1%
[Login2]
Username=
Password=
[Login3]
Username=
Password=
[Region]
Reg=%Reg%
[Locale]
Loc=%Loc%
[DefaultLogin]
lgn=1
[QueueTime]
QueueWaitTime=300
[Toaster]
Toaster=0
)
	FileAppend, %e4%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini
}

If !Toaster
{
	IfExist %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini
	{
		Loop,
		{
			IniRead, Key%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini, Keys, Key%A_Index%
			IfInString, Key%A_Index%, ERROR
			{
				Key%A_Index% := 
				break
			}
		}
		If !Key1
			Key1 := "72f7888e-0a65-4f90-aeea-c08f3ae1a6bf"
	}
	else
	{
	Key1 := "72f7888e-0a65-4f90-aeea-c08f3ae1a6bf"
	e5=
(
[Keys]
Key1=%Key1%
)
	FileAppend, %e5%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini
	}

	If Key1
	{
		ChampDataURL := "https://global.api.pvp.net/api/lol/static-data/na/v1.2/champion?api_key=" key1
		WebRequest.Open("GET", ChampDataURL)
		ChampDataURLGet:
		WebRequest.Send()
		ChampData := WebRequest.ResponseText()
		If ChampData
		{
			If InStr(ChampData, "status_code")
			{
				If InStr(ChampData, "403")
					TrayTip, League Tools %ver%, 403 - Forbidden.
				else If InStr(ChampData, "401")
					TrayTip, League Tools %ver%, 404 - Unauthorized.
				else If InStr(ChampData, "429")
					TrayTip, League Tools %ver%, 429 - Rate Limit Exceeded.
				Goto ChampDataURLGet
			}
		}
	}
	global ChampDataObj := JSON.Load(ChampData)

	FreeChampURL := "https://na.api.pvp.net/api/lol/na/v1.2/champion?freeToPlay=true&api_key=" key1
	WebRequest.Open("GET", FreeChampURL)
	FreeChampURLGet:
	WebRequest.Send()
	FreeChampData := WebRequest.ResponseText()
	If InStr(FreeChampData, "status_code")
	{
		If InStr(FreeChampData, "403")
			TrayTip, League Tools %ver%, Debug: 403 - Forbidden.
		else If InStr(FreeChampData, "401")
			TrayTip, League Tools %ver%, Debug: 404 - Unauthorized.
		else If InStr(FreeChampData, "429")
			TrayTip, League Tools %ver%, Debug: 429 - Rate Limit Exceeded.
		Goto FreeChampURLGet
	}
	else
	{
		FreeChampObj := JSON.Load(FreeChampData)
		For k, v in FreeChampObj.champions
		{
			For ke, ve in ChampDataObj.data
			{
				If v.id = ve.id
					ve.freeToPlay := true
			}
		}
	}
}

IfExist %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini
{
	IniRead, Login1Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login1, F7
	IniRead, Login2Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login2, F8
	IniRead, Login3Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login3, F9
	IniRead, ReStartQKey, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, ReStartQKey, F10
	IniRead, ReloadSubKey, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Reload, F12
}
else
{
	Login1Key := "F7"
	Login2Key := "F8"
	Login3Key := "F9"
	ReStartQKey := "F10"
	ReloadSubKey := "F12"
	e3=
(
[Hotkeys]
Login1=%Login1Key%
Login2=%Login2Key%
Login3=%Login3Key%
ReStartQKey=%ReStartQKey%
Reload=%ReloadSubKey%
)
	FileAppend, %e3%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini
}

If !Reg || (Reg = "ERROR")
	Reg = na
else
	StringLower, Reg, Reg
If !Loc || (Loc = "ERROR")
	Loc = en_US
Else
{
	If InStr(Loc, "_")
	{
		StringSplit, Loc, Loc, _
		StringLower, Loc1, Loc1
		StringUpper, Loc2, Loc2
		Loc = %Loc1%_%Loc2%
	}
	Else
		Loc = en_US
}
If !Toaster
	Toaster := 0

If !Login1Key
	Login1Key := "F7"
If !Login2Key
	Login2Key := "F8"
If !Login3Key
	Login3Key := "F9"
If !ReStartQKey
	ReStartQKey := "F10"
If !ReloadSubKey
	ReloadSubKey := "F12"

Hotkey, %Login1Key%, Login1, Off
Hotkey, %Login2Key%, Login2, Off
Hotkey, %Login3Key%, Login3, Off
Hotkey, %ReStartQKey%, ReStartQ, Off
Hotkey, %ReloadSubKey%, ReloadSub, On

If !Toaster
{
	TwitchURL := "https://api.twitch.tv/kraken/streams?channel=" TwitchStreamers "&client_id=pbta8w0375tir2u2victdhoe6ip4bbk"
	AzubuURL := "http://api.azubu.tv/public/channel/list?channels=" AzubuStreamers

	TrayTip, League Tools %ver%, Loading Pro Streams
	Gosub, StreamCheck
	SetTimer, StreamCheck, 100000
}

TrayMenu:
{
	If !Toaster
	{
		TrayTip, League Tools %ver%, Loading Champion List. This could take a moment., %tsecs%
		DDver := ChampDataObj.version
		
		;Load Champion List
		ChampCount := 0
		For k, v in ChampDataObj.data
			ChampCount := A_Index
		MenuSize = 0
		For k, v in ChampDataObj.data
		{
			TrayTip, League Tools %ver%, Loading Champion %A_Index%/%ChampCount%
			n1 := v.key
			n2 := v.name
			n3 := v.title
			Menu, %n2%, Add, %n3%, Guides
			Menu, %n2%, Disable, %n3%
			Menu, %n2%, Add
			If Loc = ru_RU
			{
				Menu, %n2%, Add, Lol-Game.ru, Guides
				Menu, %n2%, Add
			}
			Else If Reg = ko_KR
			{
				Menu, %n2%, Add, lol.inven.co.kr, Guides
				Menu, %n2%, Add
			}
			Menu, %n2%, Add, MobaFire, Guides
			Menu, %n2%, Add, LOLKing, Guides
			Menu, %n2%, Add, LOLNexus, Guides
			Menu, %n2%, Add, SoloMid, Guides
			Menu, %n2%, Add, ProBuilds, Guides
			
			If (MenuSize > 790)
			{
				Menu, GuideMenu, Add, %n2%, :%n2%, +BarBreak
				MenuSize = 0
			}
			Else
				Menu, GuideMenu, Add, %n2%, :%n2%
			
			IfNotExist, %A_ScriptDir%\%ScriptName%\ChampIcons\%n1%.png
			{
				urlchamp = http://ddragon.leagueoflegends.com/cdn/%DDver%/img/champion/%n1%.png
				UrlDownloadToFile, %urlchamp%, %A_ScriptDir%\%ScriptName%\ChampIcons\%n1%.png
				If ErrorLevel
					CIconErr := 1
			}
			
			If v.freeToPlay
			{
				Menu, GuideMenu, Icon, %n2%, %A_ScriptDir%\%ScriptName%\ChampIcons\%n1%.png,,30
				MenuSize := MenuSize + 30
			}
			else
			{
				Menu, GuideMenu, Icon, %n2%, %A_ScriptDir%\%ScriptName%\ChampIcons\%n1%.png,,20
				MenuSize := MenuSize + 20
			}
		}
		
		Menu, GuideMenu, Delete, Wukong
		Menu, GuideMenu, Insert, Xerath, Wukong, :Wukong
		Menu, GuideMenu, Icon, Wukong, %A_ScriptDir%\%ScriptName%\ChampIcons\MonkeyKing.png,,20
		
		If CIconErr
			TrayTip, League Tools %ver%, Error occurred while downloading champion icons.
		
		;Check for sales
		TrayTip, League Tools %ver%, Checking sales.
		TimeCount1 := A_TickCount
		SalesURL := "http://na.leagueoflegends.com/en/news/store/sales"
		WebRequest.Open("GET", SalesURL)
		WebRequest.Send()
		SalesStr := WebRequest.ResponseText()
		StringReplace, SalesStr, SalesStr, ", , All		;"
		Q := 0
		CheckNextSale:
		Q := RegExMatch(SalesStr, "i)a href=/en/news/store/sales/champion-and-skin-sale-(.*?) title", Sdates, Q + 1000)
		If Sdates1
		{
			StringSplit, SalesD, Sdates1, -
			Date1 := "2017" SalesD1 "00000000"
			Date2 := "2017" SalesD2 "00000000"
			DateDay1 :=
			DateDay2 :=
			DateDay1 -= Date1, Seconds
			DateDay2 -= Date2, Seconds
			
			if (DateDay1 > 0 and DateDay2 < 86400)
			{	;Sales Found
				RegExMatch(SalesStr, "i)a href=(/en/news/store/sales/champion-and-skin-sale-.*?) title", CurSales, Q)
				CurSalesURL := "http://na.leagueoflegends.com" CurSales1
				TimeTaken := (A_TickCount - TimeCount1) / 100
				TrayTip, League Tools %ver%, Sales found.
				WebRequest.Open("GET", CurSalesURL)
				WebRequest.Send()
				CurSalesStr := WebRequest.ResponseText()
				StringReplace, CurSalesStr, CurSalesStr, ", , All	;"
				
				;Load Champion Sales
				TimeTaken := (A_TickCount - TimeCount1) / 100
				TrayTip, League Tools %ver%, Loading Champion sales.
				RegExMatch(CurSalesStr, "i)(Champion Sales.*?)</div></div>", ChampSales)
				P := 1
				Loop,
				{
					P := RegExMatch(ChampSales1, "i)/loading/(.*?)_0.jpg", ChampName, P + 1)
					RegExMatch(ChampSales1, "i)777777>(.*?)</strike", ChampHiPrice, P + 1)
					RegExMatch(ChampSales1, "i)strike>(.*?)</p>", ChampLoPrice, P + 1)
					If !ChampName1
						break
					else
					{
						Menu, CPrice%A_Index%, Add, %ChampHiPrice1% --> %ChampLoPrice1%, Sales
						Menu, CSales, Add, %ChampName1%, :CPrice%A_Index%
						Menu, CSales, Icon, %ChampName1%, %A_ScriptDir%\%ScriptName%\ChampIcons\%ChampName1%.png,,20
					}
				}
				TimeTaken := (A_TickCount - TimeCount1) / 100
				TrayTip, League Tools %ver%, Champion sales loaded.
				
				;Load Skin Sales
				TimeTaken := (A_TickCount - TimeCount1) / 100
				TrayTip, League Tools %ver%, Loading Skin sales.
				RegExMatch(CurSalesStr, "i)(Skin Sales.*?)</div></div>", SkinSales)
				P := 1
				Loop,
				{
					P := RegExMatch(SkinSales1, "i)cboxElement href=(.*?)</h4>", SkinName, P + 1)
					If !SkinName1
						break
					else
					{
						RegExMatch(SkinName1, "i)(.*?Splash.jpg)", sURL)
						RegExMatch(SkinName1, "i)img src=(.*?thumb.jpg)", tURL)
						RegExMatch(SkinName1, "i)<h4>(.*)", sName)
						Menu, SSales, Add, %sName1%, Sales
						If !(FileExist(A_ScriptDir "\" ScriptName "\Skins\" sName1 "_splash.png"))
							UrlDownloadToFile, %sURL1%, %A_ScriptDir%\%ScriptName%\Skins\%sName1%_splash.png
						If !(FileExist(A_ScriptDir "\" ScriptName "\Skins\" sName1 "_thumb.png"))
							UrlDownloadToFile, %tURL1%, %A_ScriptDir%\%ScriptName%\Skins\%sName1%_thumb.png
						If ErrorLevel
							SIconErr := 1
						Menu, SSales, Icon, %sName1%, %A_ScriptDir%\%ScriptName%\Skins\%sName1%_thumb.png,,20
					}
					TrayTip, League Tools %ver%, Loading Skin sales. %A_Index%
				}
				TimeTaken := (A_TickCount - TimeCount1) / 100
				If CIconErr
					TrayTip, League Tools %ver%, Error occurred while downloading champion icons.
				else
					TrayTip, League Tools %ver%, Skin sales loaded.
			}
			else
				Goto, CheckNextSale
		}
	}
	
	;Account Selection
	TrayTip, League Tools %ver%, Loading accounts.
	If Login1
	{
		If RiotPathF
		{
			Loop, 1000
			{
				If (Login%A_Index%)
				{
					Menu, Accounts, Add, % Login%A_Index%, Tools
					If A_Index = 1
						Menu, Accounts, Check, %l%
				}
				Else
					break
			}
			If Login1
				Hotkey, %Login1Key%, On
			If Login2
				Hotkey, %Login2Key%, On
			If Login3
				Hotkey, %Login3Key%, On
			Hotkey, %RestartQKey%, On
			
			Menu, Selections, Add, 5v5 Ranked, AutoStart
			Menu, Selections, Add, 5v5 Draft, AutoStart
			Menu, Selections, Add, 5v5 Blind, AutoStart
			Menu, Selections, Add, 3v3 Blind, AutoStart
			Menu, Selections, Add, ARAM, AutoStart
		}
		Else
			TrayTip, League Tools %ver%, League launcher not found. League must be present to use login options., %tsecs%
	}
	Menu, GroupOrSolo, Add, Solo, GroupCheck
	Menu, GroupOrSolo, Check, Solo
	sGroup = 1
	Menu, GroupOrSolo, Add, Group, GroupCheck
	
	;Check base Menus and add if they contain data
	Menu, GuideMenu, NoDefault
	if !ErrorLevel
	   Menu, Tray, Add, Champion Guides, :GuideMenu
	Menu, CSales, NoDefault
	if !ErrorLevel
	   Menu, Tray, Add, Champion Sales, :CSales
	else if !Toaster
	{
		Menu, NoSales, Add, No Sales, Sales
		Menu, Tray, Add, Champion Sales, :NoSales
	}
	Menu, SSales, NoDefault
	if !ErrorLevel
	   Menu, Tray, Add, Skin Sales, :SSales
	else if !Toaster
	{
		Menu, NoSales, Add, No Sales, Sales
		Menu, Tray, Add, Skin Sales, :NoSales
	}
	
	
	;Pro Streams
	Menu, LStreams, NoDefault
	If !ErrorLevel
		Menu, Tray, Add, Pro Streams, :LStreams
	
	;Login Items
	;If Login2
		Menu, Tray, Add, Select Account, :Accounts
	If !ErrorLevel
		Menu, Tray, Add, Login Only, LoginOnly
	Menu, Selections, NoDefault
	Menu, Tray, Add, Group or Solo, :GroupOrSolo
	If !ErrorLevel
		Menu, Tray, Add, Auto Start, :Selections
	
	Menu, Tray, Add, ScreenEdge Off, Tools
	Menu, Tray, Add
	Menu, Tray, Add, Settings, SettingsSub
	Menu, Tray, Add, Reload, ReloadSub
	Menu, Tray, Add, Exit, ExitSub
}

TrayTip, League Tools %ver%, League Tools loaded., %tsecs%
SetTimer, UpdateCheck, -10000
return

;----------------------------------------------------------------------------------------------------------------------------------

StreamCheck:
{
	If Toaster
	{
		SetTimer, StreamCheck, Off
		return
	}
	
	WebRequest.Open("GET", TwitchURL)
	WebRequest.Send()
	TwitchData := WebRequest.ResponseText()
	Try
		TwitchDataObj := JSON.Load(TwitchData)
	catch e
		TrayTip, League Tools %ver%, There was a problem loading Twitch streamers.
	
	WebRequest.Open("GET", AzubuURL)
	WebRequest.Send()
	AzubuData := WebRequest.ResponseText()
	Try
		AzubuDataObj := JSON.Load(AzubuData)
	catch e
		TrayTip, League Tools %ver%, There was a problem loading Azubu streamers.
	
	Menu, TStreams, Delete
	Menu, AStreams, Delete
	
	Loop % TwitchDataObj.streams.MaxIndex()
		Menu, TStreams, Add, % TwitchDataObj.streams[A_Index].channel.name, Streams
	
	Loop % AzubuDataObj.data.MaxIndex()
	{
		If AzubuDataObj.data[A_Index].is_live
			Menu, AStreams, Add, % AzubuDataObj.data[A_Index].user.username, Streams
	}
	
	Menu, LStreams, Add, Azubu, :AStreams
	Menu, LStreams, Add, Twitch, :TStreams
}
return

UpdateCheck:
{
	UpdateURL := "https://autohotkey.com/boards/viewtopic.php?f=19&t=10818"
	WebRequest.Open("GET", UpdateURL, true)
	WebRequest.Send()
	WebRequest.WaitForResponse()
	Data := WebRequest.ResponseText()
	RegExMatch(Data, "i)<title>League Tools (.*?) ", Version)
	
	If !(Version1 = ver)
		Traytip, League Tools %ver%, There is an update available!, 2
	else
		Traytip, League Tools %ver%, Up to date., 2
}
return

GroupCheck:
{
	If A_ThisMenuItem = Solo
	{
		Menu, GroupOrSolo, Check, Solo
		Menu, GroupOrSolo, UnCheck, Group
		sGroup = 1
	}
	else If A_ThisMenuItem = Group
	{
		Menu, GroupOrSolo, Check, Group
		Menu, GroupOrSolo, UnCheck, Solo
		sGroup = 0
	}
}	
return

Login(u="", p="", installloc="")
{
	Run, %installloc%
	WinActivate, ahk_class RCLIENT
	WinWaitActive ahk_class RCLIENT
	b = 0
	Loop,
	{
			Sleep, 250
			if WinExist("ahk_class RCLIENT")
			{
				WinActivate, ahk_class RCLIENT
				WinGetPos,,, w, h, A
				;MouseMove, (w*.85), (h*.27)
				PixelGetColor, colorbtn, (w*.85), (h*.74)
				If colorbtn = 0x28231E
					break
			}
	}
	Sleep, 100
	WinActivate, ahk_class RCLIENT
	WinWaitActive ahk_class RCLIENT
	WinGetPos,,, w, h, A
	b = 0
	Sleep, 100
	If !p
		InputBox, p, Mot de passe, Entrez votre mot de passe. Il ne sera pas sauvegarder.
	If !p
		return
	Sleep, 100
	WinActivate, ahk_class RCLIENT
 
	If u
	{
		MouseClick, Left, (w*.85), (h*.27),,0
		MouseClick, Left, (w*.85), (h*.27),,0
		Sleep, 100
		SendRaw, %u%
	}
	Sleep, 100
	Send {Tab}
	Sleep, 100
	If p
	{
		SendInput {Raw}%p%
	}
	Send {enter}
	Sleep, 250
 
	return
}

Start(type1, sGroup)
{
	StartSleep := 150
	Loop
	{
		Sleep, 500
		WinActivate, ahk_class ApolloRuntimeContentWindow
		WinGetPos,,, w, h, A
		PixelGetColor, b_Play, (w / 2), (h * .025), RGB
		ColDist := Distance(colorA, b_Play)
		If ColDist < cDist1
			break
	}
	Sleep, 2000
	WinGetPos,,, w, h, A
	Sleep, 250
	MouseClick, left, (w / 2), (h * .025),,0
	Sleep, 25
	MouseClick, left, (w / 2), (h * .025),,0
	Sleep, 250
	MouseMove, 290, 115
	MouseClick, left, 290, 115,,0
	
	If type1 = 5v5 Ranked
	{
		MouseMove, (w*.42),(h*.19)
		MouseClick, left, (w*.42),(h*.19),,0
		Sleep, %StartSleep%
		MouseMove, (w*.60),(h*.19)
		MouseClick, left, (w*.60),(h*.19),,0
		Sleep, %StartSleep%
		MouseMove, (w*.68),(h*.19)
		MouseClick, left, (w*.68),(h*.19),,0
		Sleep, %StartSleep%
	}
	else if type1 = 5v5 Draft
	{
		MouseMove, (w*.42),(h*.19)
		MouseClick, left, (w*.42),(h*.19),,0
		Sleep, %StartSleep%
		MouseMove, (w*.60),(h*.19)
		MouseClick, left, (w*.60),(h*.19),,0
		Sleep, %StartSleep%
		MouseMove, (w*.68),(h*.24)
		MouseClick, left, (w*.68),(h*.24),,0
		Sleep, %StartSleep%
	}
	else if type1 = 5v5 Blind
	{
		MouseMove, (w*.42),(h*.19)
		MouseClick, left, (w*.42),(h*.19),,0
		Sleep, %StartSleep%
		MouseMove, (w*.60),(h*.19)
		MouseClick, left, (w*.60),(h*.19),,0
		Sleep, %StartSleep%
		MouseMove, (w*.68),(h*.32)
		MouseClick, left, (w*.68),(h*.32),,0
		Sleep, %StartSleep%
	}
	else if type1 = 3v3 Blind
	{
		MouseMove, (w*.42),(h*.19)
		MouseClick, left, (w*.42),(h*.19),,0
		Sleep, %StartSleep%
		MouseMove, (w*.60),(h*.24)
		MouseClick, left, (w*.60),(h*.24),,0
		Sleep, %StartSleep%
		MouseMove, (w*.68),(h*.19)
		MouseClick, left, (w*.68),(h*.19),,0
		Sleep, %StartSleep%
	}
	else if type1 = ARAM
	{
		MouseMove, (w*.42),(h*.22)
		MouseClick, left, (w*.42),(h*.22),,0
		Sleep, %StartSleep%
		MouseMove, (w*.60),(h*.19)
		MouseClick, left, (w*.60),(h*.19),,0
		Sleep, %StartSleep%
		MouseMove, (w*.68),(h*.19)
		MouseClick, left, (w*.68),(h*.19),,0
		Sleep, %StartSleep%
	}
	
	if sGroup = 1 
	{	
		MouseMove, (w*.62),(h*.88)
		MouseClick, left, (w*.62),(h*.88),,0
		Sleep, 100
	}
	else
	{
		MouseMove, (w*.73),(h*.88)
		MouseClick, left, (w*.73),(h*.88),,0
		Sleep, 100
	}
}

AutoAccept(q)
{
	If q < 120
		q := 120
	p := q - 60
	colorB := "0x1E4574"
	Sleep, 250
	NotReady3:
	Loop
	{
		IfWinActive, ahk_class ApolloRuntimeContentWindow
		{
			WinGetPos,,, mWi, mHi, A
			x := (mWi * .40)
			y := (mHi * .55)
			If ColorCross(x, y, colorB, cDist)
			{
				Sleep, 400
				MouseMove, %x%, %y%
				Click, %x%, %y%
				break
			}
		}
		IfEqual, A_Index, p, ToolTip, Queue is taking a long time. Waiting 60s more.
		IfEqual, A_Index, q, return 1
		Sleep, 1000
	}
	Sleep, 1000
}

LoginOnly:
{
	global t := A_ThisMenuItem
	If !lgn
		lgn = 1
	Login(Login%lgn%, Pass%lgn%, RiotpathF)
}
return

AutoStart:
{
	global t := A_ThisMenuItem
	
	If !lgn
		lgn = 1
	Login(Login%lgn%, Pass%lgn%, RiotpathF)
	Start(t, sGroup)
	If !(t = "5v5 Draft")
		Err := AutoAccept(QueueWaitTime)
	If (Err = 1)
	{
		Tooltip, Queue took over %QueueWaitTime% seconds. Please adjust this.
		Sleep 5000
		ToolTip
	}
}
return

Guides:
{
	CName := A_ThisMenu
	
	;LOLNexus
	StringReplace, n, CName, ', , All
	StringReplace, n, n, `., , All
	StringReplace, n, n, %A_Space%, -, All
	
	;LOLKing
	StringLower, a, CName
	StringReplace, a, a, %A_Space%, , All
	StringReplace, a, a, `., , All
	StringReplace, a, a, ', , All
	
	;ProBuilds
	StringReplace, b, CName, ', %A_Space%, All
	StringReplace, b, b, `., %A_Space%, All
	StringLower, b, b, T
	StringReplace, b, b, %A_space%, , All
	
	;SoloMid
	StringReplace, c, CName, %A_Space%, , All
	
	;MobaFire - Naming convention changed, non conformative new stylem - Test Guide page
	IfEqual, A_ThisMenuItem, MobaFire, Run, http://www.mobafire.com/league-of-legends/%n%-guide
	
	;case sensitive(Lowercase), no punctuation, no spaces
	IfEqual, A_ThisMenuItem, LOLKing, Run, http://www.lolking.net/guides/champion/%a%
	
	;Not case sensitive, spaces become -, no punctuation
	IfEqual, A_ThisMenuItem, LOLNexus, Run, http://www.lolnexus.com/champions/%n%
	
	;Not case sensitive, no spaces, periods left in, ' left in
	IfEqual, A_ThisMenuItem, SoloMid, Run, http://www.solomid.net/guides/%c%
	
	;Case sensitive(title), no spaces, no punctuation
	IfEqual, A_ThisMenuItem, ProBuilds, Run, http://www.probuilds.net/champions/details/%b%
	
	;Not case sensitive
	IfEqual, A_ThisMenuItem, Lol-Game.ru, Run, http://lol-game.ru/guides/%CName%/
	
	;TBD
	IfEqual, A_ThisMenuItem, lol.inven.co.kr, Run, http://lol.inven.co.kr/dataninfo/champion/manualTool.php	
}
return

Streams:
{
	If (A_ThisMenu = "AStreams")
		Run, https://www.azubu.tv/%A_ThisMenuItem%
	Else If (A_ThisMenu = "TStreams")
		Run, http://www.twitch.tv/%A_ThisMenuItem%
}
return

Distance(c1, c2)
{ ; function by [VxE], return value range = [0, 441.67295593006372]
   return Sqrt((((c1>>16)-(c2>>16))**2)+(((c1>>8&255)-(c2>>8&255))**2)+(((c1&255)-(c1&255))**2))
}

ColorCross(x, y, col, v)
{
	PixelGetColor, b, x, (y + 2), RGB
	PixelGetColor, c, x, (y - 2), RGB
	PixelGetColor, d, (x + 2), y, RGB
	PixelGetColor, e, (x - 2), y, RGB
	CDA := Distance(col, b)
	CDB := Distance(col, c)
	CDC := Distance(col, d)
	CDD := Distance(col, e)
	
	if (CDA < v and CDB < v and CDC < v and CDD < v)
		return True
	Else
		return False
}

Sales:
{
	If (A_ThisMenu = "SSales")
		SplashImage, %A_ScriptDir%\%ScriptName%\Skins\%A_ThisMenuItem%_splash.png, M2, %A_ThisMenuItem%, , %A_ThisMenuItem%
}
return

Tools:
{
	If A_ThisMenuItem = ScreenEdge Off
	{
		Menu, Tray, ToggleCheck, ScreenEdge Off
		Menu, Tray, Rename, ScreenEdge Off, ScreenEdge On
		SetTimer, ScreenEdge, 250
	}
	else If A_ThisMenuItem = ScreenEdge On
	{
		Menu, Tray, ToggleCheck, ScreenEdge On
		Menu, Tray, Rename, ScreenEdge On, ScreenEdge Off
		SetTimer, ScreenEdge, Off
		Sleep, 100
		ClipCursor(Confine)
	}
	else If A_ThisMenu = Accounts
	{
		lgn := A_ThisMenuItemPos
		Loop,
		{
			If !(Login%A_Index%)
				break
			Menu, Accounts, UnCheck, % Login%A_Index%
		}
		Menu, Accounts, Check, % Login%lgn%
	}
}
return

ScreenEdge:
	If WinActive("ahk_class RiotWindowClass")
		ClipCursor( Confine, 13, 13, A_screenwidth-13, A_screenheight-13)
Return

Login1:
	Login(Login1, Pass1, RiotPathF)
return

Login2:
	Login(Login2, Pass2, RiotPathF)
return

Login3:
	Login(Login3, Pass3, RiotPathF)
return

ReStartQ:
{
	If !t
		return
	Start(t, sGroup)
	AutoAccept(QueueWaitTime)
}
return

SettingsSub:
{
	IfExist %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini
	{
		Loop,
		{
			IniRead, Login%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Username
			IfInString, Login%A_Index%, ERROR
			{
				Login%A_Index% := 
				break
			}
			IniRead, Pass%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Password
			
			;IniRead, ObfPass%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Password
			;Pass%A_Index% := Obf(ObfPass%A_Index%, 0, 1234)
			
			IniRead, SumName%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, SumName
			IniRead, SumID%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, SumID
		}
		IniRead, Reg, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Region, Reg, %A_Space%
		IniRead, Loc, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Locale, Loc, %A_Space%
		IniRead, lgn, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, DefaultLogin, lgn, 1
		IniRead, QueueWaitTime, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, QueueTime, QueueWaitTime, 500
		IniRead, Toaster, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Toaster, Toaster, 0
	}

	IfExist %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini
	{
		IniRead, Login1Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login1, F7
		IniRead, Login2Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login2, F8
		IniRead, Login3Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login3, F9
		IniRead, ReStartQKey, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, ReStartQKey, F10
		IniRead, ReloadSubKey, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Reload, F12
	}

	IfExist %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini
	{
		Loop,
		{
			IniRead, Key%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini, Keys, Key%A_Index%
			IfInString, Key%A_Index%, ERROR
			{
				Key%A_Index% := 
				break
			}
		}
		If !Key1
			Key1 := "72f7888e-0a65-4f90-aeea-c08f3ae1a6bf"
	}

	Gui, Settings: New, -SysMenu, League Tools %ver% Settings

	Gui, Settings: Add, Text, x8 y8 w53 h23 +0x200, Hotkeys:
	Gui, Settings: Add, Text, x32 y32 w82 h23 +0x200, Login 1
	Gui, Settings: Add, Edit, x128 y32 w49 h21 vNewLoginKey1, %Login1Key%
	Gui, Settings: Add, Text, x32 y56 w81 h23 +0x200, Login 2
	Gui, Settings: Add, Edit, x128 y56 w49 h21 vNewLoginKey2, %Login2Key%
	Gui, Settings: Add, Text, x32 y80 w81 h23 +0x200, Login 3
	Gui, Settings: Add, Edit, x128 y80 w49 h21 vNewLoginKey3, %Login3Key%

	Gui, Settings: Add, Text, x32 y104 w81 h23 +0x200, Restart Queue
	Gui, Settings: Add, Edit, x128 y104 w49 h21 vNewRestartQueue, %ReStartQKey%
	Gui, Settings: Add, Text, x32 y128 w81 h23 +0x200, Reload Script
	Gui, Settings: Add, Edit, x128 y128 w49 h21 vNewReloadSubKey, %ReloadSubKey%

	Gui, Settings: Add, Text, x8 y192 w88 h23 +0x200, API Call Settings:
	Gui, Settings: Add, Text, x32 y216 w81 h23 +0x200, Region
	Gui, Settings: Add, Edit, x128 y216 w49 h21 vNewRegion, %Reg%
	Gui, Settings: Add, Text, x32 y240 w81 h23 +0x200, Locale
	Gui, Settings: Add, Edit, x128 y240 w49 h21 vNewLocale, %Loc%

	Gui, Settings: Add, Text, x8 y280 w81 h23 +0x200, Defaults:
	Gui, Settings: Add, Text, x32 y304 w81 h23 +0x200, Default Login
	Gui, Settings: Add, Edit, x128 y304 w49 h21 vNewDefLogin, %lgn%
	Gui, Settings: Add, Text, x32 y328 w81 h23 +0x200, Queue Wait
	Gui, Settings: Add, Edit, x128 y328 w49 h21 vNewQueueWaitTime, %QueueWaitTime%
	Gui, Settings: Add, Text, x32 y352 w81 h23 +0x200, Toaster Mode
	Gui, Settings: Add, Edit, x128 y352 w49 h21 vNewToasterMode, %Toaster%

	Gui, Settings: Add, Text, x8 y392 w49 h25 +0x200, API Key:
	Gui, Settings: Add, Edit, x72 y392 w215 h25 vNewAPIKey, %key1%

	Gui, Settings: Add, Text, x200 y8 w120 h23 +0x200, Login Information:
	Gui, Settings: Add, Listview, x224 y32 w249 h300 gLoginChange AltSubmit -Hdr, Auto Login Information:|Pass ;|SumName|SumID
	LV_ModifyCol(2, 1)

	Loop,
	{
		If !Login%A_Index%
			break
		LV_Add(, Login%A_Index%, Pass%A_Index%)
	}

	Gui, Settings: Add, Button, x225 y335 w60 h15 gLoginAdd, Add
	Gui, Settings: Add, Button, x295 y335 w60 h15 gLoginRemove, Remove

	Gui, Settings: Add, Button, x304 y392 w80 h23 gSettingsOK, &OK
	Gui, Settings: Add, Button, x392 y392 w80 h23 gSettingsCancel, &Cancel

	Gui, Settings: Show, w481 h424
}
return

LoginChange:
	If (A_GuiEvent = "DoubleClick")
	{
		LoginNum := A_EventInfo
		Gui +OwnDialogs
		InputBox, Login%LoginNum%, League Tools %ver%, Enter new username
		If ErrorLevel
			return
		InputBox, Pass%LoginNum%, League Tools %ver%, Enter new password, HIDE
		If ErrorLevel
			return
		;InputBox, NewSumName, League Tools %ver%, Enter Summoner Name. This is used for
		;InputBox, NewSumID, League Tools %ver%, Enter Summoner ID. Type '1' to attempt auto lookup.
		
		If (Login%LoginNum%) && (Pass%LoginNum%)
		{
			ObfPass := Obf(Pass%LoginNum%, 1, 1234)
			LV_Modify(LoginNum, , Login%LoginNum%, ObfPass)
		}
	}
	
	If (A_GuiEvent = "Normal")
		global SelectedRow := A_EventInfo
return

SettingsOK:
{
	Gui, Settings: Submit
	
	;Save hotkeys to .INI
	FileDelete, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini
	If !NewLoginKey1
		NewLoginKey1 := "F7"
	If !NewLoginKey2
		NewLoginKey2 := "F8"
	If !NewLoginKey3
		NewLoginKey3 := "F9"
	If !ReStartQKey
		ReStartQKey := "F10"
	If !ReloadSubKey
		ReloadSubKey := "F12"

	IniWrite, %NewLoginKey1%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, Login1
	IniWrite, %NewLoginKey2%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, Login2
	IniWrite, %NewLoginKey3%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, Login3
	IniWrite, %NewRestartQueue%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, ReStartQKey
	IniWrite, %NewReloadSubKey%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, Reload
	
	FileDelete, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini
	IniWrite, %NewRegion%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Region, Reg
	IniWrite, %NewLocale%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Locale, Loc
	IniWrite, %NewDefLogin%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, DefaultLogin, lgn
	IniWrite, %NewQueueWaitTime%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, QueueTime, QueueWaitTime
	IniWrite, %NewToasterMode%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Toaster, Toaster
	Loop,
	{
		LV_GetText(Login, A_Index, 1)
		If !Login
			break
		LV_GetText(Pass, A_Index, 2)
		IniWrite, %Login%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Username
		IniWrite, %Pass%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Password
	}
	
	;FileDelete, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini
	IniWrite, %NewAPIKey%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini, Keys, Key1
	
	;Reset Variables
	IniRead, Reg, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Region, Reg, %A_Space%
	IniRead, Loc, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Locale, Loc, %A_Space%
	IniRead, lgn, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, DefaultLogin, lgn, 1
	IniRead, QueueWaitTime, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, QueueTime, QueueWaitTime, 500
	IniRead, Toaster, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Toaster, Toaster, 0
	Loop,
	{
		IniRead, Login%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Username
		IniRead, Pass%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Password
		IniRead, SumName%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, SumName
		IniRead, SumID%A_Index%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, SumID
		IfInString, Login%A_Index%, ERROR
		{
			Login%A_Index% := 
			break
		}
	}
	
	IniRead, Login1Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login1, F7
	IniRead, Login2Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login2, F8
	IniRead, Login3Key, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Login3, F9
	IniRead, ReStartQKey, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, ReStartQKey, F10
	IniRead, ReloadSubKey, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, Hotkeys, Reload, F12
	
	Gui, Settings: Destroy
	
	Menu, Accounts, Delete
	Loop,
	{
		If Login%A_Index%
			Menu, Accounts, Add, % Login%A_Index%, Tools
		else
			break
	}
	Menu, Tray, Insert, Login Only, Select Account, :Accounts
}
return

SettingsCancel:
	Gui, Settings: Destroy
return

LoginAdd:
	Gui +OwnDialogs
	InputBox, Login, League Tools %ver%, Enter new username
	InputBox, Pass, League Tools %ver%, Enter new password, HIDE
	ObfPass := Obf(Pass, 1, 1234)
	LV_Add(, Login, ObfPass)
return

LoginRemove:
	If SelectedRow = 0
		return
	LV_Delete(SelectedRow)
	SelectedRow := 0
return

ReloadSub:
	reload
return

ClipCursor(Confine=True, x1=0 , y1=0, x2=1920, y2=1080) 
{
	VarSetCapacity(R,16,0), NumPut(x1,&R+0),NumPut(y1,&R+4),NumPut(x2,&R+8),NumPut(y2,&R+12)
	Return Confine ? DllCall( "ClipCursor", UInt,&R ) : DllCall( "ClipCursor" )
}

ExitSub:
{
	;Save hotkeys to .INI
	FileDelete, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini
	If !Login1Key
		Login1Key := "F7"
	If !Login2Key
		Login2Key := "F8"
	If !Login3Key
		Login3Key := "F9"
	If !ReStartQKey
		ReStartQKey := "F10"
	If !ReloadSubKey
		ReloadSubKey := "F12"

	IniWrite, %Login1Key%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, Login1
	IniWrite, %Login2Key%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, Login2
	IniWrite, %Login3Key%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, Login3
	IniWrite, %ReStartQKey%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, ReStartQKey
	IniWrite, %ReloadSubKey%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_hotkeys.ini, HotKeys, Reload

	FileDelete, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini
	IniWrite, %Reg%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Region, Reg
	IniWrite, %Loc%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Locale, Loc
	IniWrite, %lgn%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, DefaultLogin, lgn
	IniWrite, %QueueWaitTime%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, QueueTime, QueueWaitTime
	IniWrite, %Toaster%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Toaster, Toaster
	Loop,
	{
		Login := Login%A_Index%
		If ! Login
			break
		Pass := Pass%A_Index%
		SumName := SumName%A_Index%
		SumID := SumID%A_Index%
		
		IniWrite, %Login%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Username
		IniWrite, %Pass%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, Password
		;IniWrite, %SumName%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, SumName
		;IniWrite, %SumID%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_config.ini, Login%A_Index%, SumID
	}
	
	;FileDelete, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini
	IniWrite, %Key1%, %A_ScriptDir%\%ScriptName%\INI\%ScriptName%_keys.ini, Keys, Key1
	
	ExitApp
}

Obf(x,y,Seed=12345)
{
	String=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 -=.,?':;/\!@#$`%^&*()_+|
	Random, ,Seed
	Loop, Parse, x
	{
		Pos:=InStr(String,A_LoopField,1)
		Random, Offset , 1, 86
		Coded.=SubStr(String, y ? (Pos+Offset)>86 ? Pos+Offset-86 : Pos+Offset : (Pos-Offset)<1 ? Pos-Offset+86 : Pos-Offset,1)
	}
	Return Coded
}

class JSON
{
	class Load extends JSON.Functor
	{
		Call(self, ByRef text, reviver:="")
		{
			this.rev := IsObject(reviver) ? reviver : false
			this.keys := this.rev ? {} : false

			static quot := Chr(34), bashq := "\" . quot
			     , json_value := quot . "{[01234567890-tfn"
			     , json_value_or_array_closing := quot . "{[]01234567890-tfn"
			     , object_key_or_object_closing := quot . "}"

			key := ""
			is_key := false
			root := {}
			stack := [root]
			next := json_value
			pos := 0

			while ((ch := SubStr(text, ++pos, 1)) != "") {
				if InStr(" `t`r`n", ch)
					continue
				if !InStr(next, ch, 1)
					this.ParseError(next, text, pos)

				holder := stack[1]
				is_array := holder.IsArray

				if InStr(",:", ch) {
					next := (is_key := !is_array && ch == ",") ? quot : json_value

				} else if InStr("}]", ch) {
					ObjRemoveAt(stack, 1)
					next := stack[1]==root ? "" : stack[1].IsArray ? ",]" : ",}"

				} else {
					if InStr("{[", ch) {
						static json_array := Func("Array").IsBuiltIn || ![].IsArray ? {IsArray: true} : 0
					
						(ch == "{")
							? ( is_key := true
							  , value := {}
							  , next := object_key_or_object_closing )
						; ch == "["
							: ( value := json_array ? new json_array : []
							  , next := json_value_or_array_closing )
						
						ObjInsertAt(stack, 1, value)

						if (this.keys)
							this.keys[value] := []
					
					} else {
						if (ch == quot) {
							i := pos
							while (i := InStr(text, quot,, i+1)) {
								value := StrReplace(SubStr(text, pos+1, i-pos-1), "\\", "\u005c")

								static tail := A_AhkVersion<"2" ? 0 : -1
								if (SubStr(value, tail) != "\")
									break
							}

							if (!i)
								this.ParseError("'", text, pos)

							  value := StrReplace(value,  "\/",  "/")
							, value := StrReplace(value, bashq, quot)
							, value := StrReplace(value,  "\b", "`b")
							, value := StrReplace(value,  "\f", "`f")
							, value := StrReplace(value,  "\n", "`n")
							, value := StrReplace(value,  "\r", "`r")
							, value := StrReplace(value,  "\t", "`t")

							pos := i ; update pos
							
							i := 0
							while (i := InStr(value, "\",, i+1)) {
								if !(SubStr(value, i+1, 1) == "u")
									this.ParseError("\", text, pos - StrLen(SubStr(value, i+1)))

								uffff := Abs("0x" . SubStr(value, i+2, 4))
								if (A_IsUnicode || uffff < 0x100)
									value := SubStr(value, 1, i-1) . Chr(uffff) . SubStr(value, i+6)
							}

							if (is_key) {
								key := value, next := ":"
								continue
							}
						
						} else {
							value := SubStr(text, pos, i := RegExMatch(text, "[\]\},\s]|$",, pos)-pos)

							static number := "number", integer :="integer"
							if value is %number%
							{
								if value is %integer%
									value += 0
							}
							else if (value == "true" || value == "false")
								value := %value% + 0
							else if (value == "null")
								value := ""
							else
								this.ParseError(next, text, pos, i)

							pos += i-1
						}

						next := holder==root ? "" : is_array ? ",]" : ",}"
					} ; If InStr("{[", ch) { ... } else

					is_array? key := ObjPush(holder, value) : holder[key] := value

					if (this.keys && this.keys.HasKey(holder))
						this.keys[holder].Push(key)
				}
			
			} ; while ( ... )

			return this.rev ? this.Walk(root, "") : root[""]
		}

		ParseError(expect, ByRef text, pos, len:=1)
		{
			static quot := Chr(34), qurly := quot . "}"
			
			line := StrSplit(SubStr(text, 1, pos), "`n", "`r").Length()
			col := pos - InStr(text, "`n",, -(StrLen(text)-pos+1))
			msg := Format("{1}`n`nLine:`t{2}`nCol:`t{3}`nChar:`t{4}"
			,     (expect == "")     ? "Extra data"
			    : (expect == "'")    ? "Unterminated string starting at"
			    : (expect == "\")    ? "Invalid \escape"
			    : (expect == ":")    ? "Expecting ':' delimiter"
			    : (expect == quot)   ? "Expecting object key enclosed in double quotes"
			    : (expect == qurly)  ? "Expecting object key enclosed in double quotes or object closing '}'"
			    : (expect == ",}")   ? "Expecting ',' delimiter or object closing '}'"
			    : (expect == ",]")   ? "Expecting ',' delimiter or array closing ']'"
			    : InStr(expect, "]") ? "Expecting JSON value or array closing ']'"
			    :                      "Expecting JSON value(string, number, true, false, null, object or array)"
			, line, col, pos)

			static offset := A_AhkVersion<"2" ? -3 : -4
			throw Exception(msg, offset, SubStr(text, pos, len))
		}

		Walk(holder, key)
		{
			value := holder[key]
			if IsObject(value) {
				for i, k in this.keys[value] {
					v := this.Walk(value, k)
					if (v != JSON.Undefined)
						value[k] := v
					else
						ObjDelete(value, k)
				}
			}
			
			return this.rev.Call(holder, key, value)
		}
	}

	class Dump extends JSON.Functor
	{
		Call(self, value, replacer:="", space:="")
		{
			this.rep := IsObject(replacer) ? replacer : ""

			this.gap := ""
			if (space) {
				static integer := "integer"
				if space is %integer%
					Loop, % ((n := Abs(space))>10 ? 10 : n)
						this.gap .= " "
				else
					this.gap := SubStr(space, 1, 10)

				this.indent := "`n"
			}

			return this.Str({"": value}, "")
		}

		Str(holder, key)
		{
			value := holder[key]

			if (this.rep)
				value := this.rep.Call(holder, key, ObjHasKey(holder, key) ? value : JSON.Undefined)

			if IsObject(value) {
				static type := A_AhkVersion<"2" ? "" : Func("Type")
				if (type ? type.Call(value) == "Object" : ObjGetCapacity(value) != "") {
					if (this.gap) {
						stepback := this.indent
						this.indent .= this.gap
					}

					is_array := value.IsArray
					if (!is_array) {
						for i in value
							is_array := i == A_Index
						until !is_array
					}

					str := ""
					if (is_array) {
						Loop, % value.Length() {
							if (this.gap)
								str .= this.indent
							
							v := this.Str(value, A_Index)
							str .= (v != "") ? v . "," : "null,"
						}
					} else {
						colon := this.gap ? ": " : ":"
						for k in value {
							v := this.Str(value, k)
							if (v != "") {
								if (this.gap)
									str .= this.indent

								str .= this.Quote(k) . colon . v . ","
							}
						}
					}

					if (str != "") {
						str := RTrim(str, ",")
						if (this.gap)
							str .= stepback
					}

					if (this.gap)
						this.indent := stepback

					return is_array ? "[" . str . "]" : "{" . str . "}"
				}
			
			} else ; is_number ? value : "value"
				return ObjGetCapacity([value], 1)=="" ? value : this.Quote(value)
		}

		Quote(string)
		{
			static quot := Chr(34), bashq := "\" . quot

			if (string != "") {
				  string := StrReplace(string,  "\",  "\\")
				, string := StrReplace(string, quot, bashq)
				, string := StrReplace(string, "`b",  "\b")
				, string := StrReplace(string, "`f",  "\f")
				, string := StrReplace(string, "`n",  "\n")
				, string := StrReplace(string, "`r",  "\r")
				, string := StrReplace(string, "`t",  "\t")

				static rx_escapable := A_AhkVersion<"2" ? "O)[^\x20-\x7e]" : "[^\x20-\x7e]"
				while RegExMatch(string, rx_escapable, m)
					string := StrReplace(string, m.Value, Format("\u{1:04x}", Ord(m.Value)))
			}

			return quot . string . quot
		}
	}

	Undefined[]
	{
		get {
			static empty := {}, vt_empty := ComObject(0, &empty, 1)
			return vt_empty
		}
	}

	class Functor
	{
		__Call(method, ByRef arg, args*)
		{
			if IsObject(method)
				return (new this).Call(method, arg, args*)
			else if (method == "")
				return (new this).Call(arg, args*)
		}
	}
}


Thank u,

Osi, :wave:

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 17 guests