Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local list = {};
- table.insert(list,"GreenDudeHC");
- table.insert(list,"AngryAA");
- table.insert(list,"HegemonyTV");
- table.insert(list,"ZiggyDLive");
- table.insert(list,"ZenocideGenius");
- table.insert(list,"Pohx");
- table.insert(list,"nugiyen");
- table.insert(list,"BakerLive");
- table.insert(list,"LiftingNerdBro");
- table.insert(list,"Terrex7");
- table.insert(list,"Jmyers123");
- table.insert(list,"theuberelite");
- table.insert(list,"Havoc616");
- table.insert(list,"Helmannn");
- table.insert(list,"Mathil1");
- table.insert(list,"RaizQT");
- table.insert(list,"Etup");
- table.insert(list,"RichJMoney");
- table.insert(list,"Terrornoid");
- table.insert(list,"herpsderpsanon");
- table.insert(list,"rbFrosty");
- table.insert(list,"Willywonka_HC");
- table.insert(list,"Ghazzy");
- table.insert(list,"staceily");
- table.insert(list,"manocean");
- table.insert(list,"PhageTV");
- table.insert(list,"Voegelin");
- table.insert(list,"hanarashi");
- table.insert(list,"namtro");
- table.insert(list,"kaamoos");
- table.insert(list,"datmodz");
- table.insert(list,"cha_siu_bao");
- table.insert(list,"mingthemerciless93");
- table.insert(list,"nohandsken");
- table.insert(list,"christusrex");
- table.insert(list,"morikiopa");
- table.insert(list,"k0reangamer");
- table.insert(list,"nicosuper");
- table.insert(list,"sirvenomik");
- table.insert(list,"kluffu");
- table.insert(list,"unhost");
- table.insert(list,"ghudda");
- table.insert(list,"mgriff2k4");
- table.insert(list,"marthaAPB");
- table.insert(list,"MorsRageNG");
- MOD.nexthost = MOD.nexthost or 1;
- MOD.ShuffleNext= MOD.ShuffleNext or 0;
- MOD.KillShuffle = MOD.KillShuffle or false;
- MOD.ShuffleInterval = MOD.ShuffleInterval or 900;
- local function IsPlayingPoE(channel)
- if type(channel) ~= "string" then
- return false;
- end
- local stream = MOD.GetStream(channel);
- if type(stream)=="table" and type(stream.game)=="string" and stream.game:lower() == "path of exile" then
- return true;
- end
- return false;
- end
- local loops = 0;
- local function GetChannelToHost()
- local failsafe = 0;
- while loops < 2 do
- local selected = list[MOD.nexthost];
- if selected == nil then
- MOD.nexthost = 1;
- selected = list[MOD.nexthost];
- loops = loops + 1;
- else
- MOD.nexthost = MOD.nexthost + 1;
- end
- failsafe = failsafe + 1;
- if IsPlayingPoE(selected) then
- loops=0;
- return selected;
- elseif failsafe >= 3 then
- return "";
- end
- end
- loops=1;
- return nil;
- end
- MOD.TempHost = function(newchannel,time)
- time = time or MOD.ShuffleInterval;
- MOD.ShuffleNext = os.time()+time;
- if MOD.CurrentHost ~= newchannel then
- MOD.Host(newchannel);
- MOD.CurrentHost = newchannel;
- print( "Swapped host to " .. newchannel );
- else
- print( "Refreshed host on " .. newchannel );
- end
- MOD.Save();
- end
- local fails = 0;
- MOD.HostShuffle = function()
- if MOD.KillShuffle then
- MOD.CurrentHost=nil;
- return;
- end
- local tm = os.time();
- MOD.Timer("shuffle",60,MOD.HostShuffle);
- if type(MOD.CurrentHost)=="string" then
- local stream = MOD.GetStream(MOD.CurrentHost);
- if type(stream)~="table" or type(stream.game)~="string" then
- fails = fails + 1;
- elseif fails == 1 or stream.game:lower() ~= "path of exile" then
- MOD.ShuffleNext = 0;
- print(MOD.CurrentHost .. " is no longer playing Path of Exile!");
- fails = 0;
- else
- fails = 0;
- end
- end
- if tm > MOD.ShuffleNext then
- local newchannel = GetChannelToHost();
- if newchannel == nil then
- if IsPlayingPoE(MOD.CurrentHost) then
- MOD.ShuffleNext = os.time()+MOD.ShuffleInterval;
- print( "No community streamer found online, continuing temporary host " .. MOD.CurrentHost);
- else
- MOD.Unhost();
- MOD.CurrentHost = nil;
- print( "no channel to host found" );
- MOD.nexthost = 1;
- loops = 1;
- MOD.Timer("shuffle",300,MOD.HostShuffle);
- end
- else
- if newchannel == "" then
- MOD.CurrentHost=nil;
- MOD.Timer("shuffle",0,MOD.HostShuffle);
- return;
- end
- MOD.ShuffleNext = os.time()+MOD.ShuffleInterval;
- if MOD.CurrentHost ~= newchannel then
- MOD.Host(newchannel);
- MOD.CurrentHost = newchannel;
- print( "Swapped host to " .. newchannel );
- else
- print( "Continuing to host " .. newchannel );
- end
- end
- MOD.Save();
- else
- --print( tostring(tm) .. " > " ..tostring(MOD.ShuffleNext) );
- end
- end
- --Turn seconds into a span IE "hh:mm:ss"
- local SecondToSpan = MOD.SecondToSpan;
- MOD.HostShuffle();
- return function(msg,usr,chan)
- if (UserStatus(usr) == 2 or chan:sub(2):lower() == usr:lower() or usr:lower() == "terrahkitsune" or usr:lower() == "pathofexile" or usr:lower() == "kluffu")then
- if not msg then msg="";end
- print("MOD");
- MOD.ResetCD(usr);
- msg = msg:lower();
- if msg == "off" then
- MOD.KillShuffle = true;
- MOD.Timer("shuffle");
- MOD.Unhost();
- MOD.CurrentHost=nil;
- MOD.ShuffleNext = 0;
- MOD.Save();
- print("Host shuffling turned off!");
- return;
- elseif msg == "on" then
- MOD.KillShuffle = false;
- MOD.ShuffleNext = 0;
- MOD.HostShuffle();
- MOD.Save();
- print("Host shuffling turned on!");
- return;
- end
- end
- if MOD.CurrentHost == nil then
- print("Currently hosting nobody");
- return;
- end
- print("Currently hosting http://www.twitch.tv/" .. MOD.CurrentHost .. " next host in " .. SecondToSpan(MOD.ShuffleNext-os.time()));
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement