PDA

View Full Version : OGL Lobby Interface



Justin69
12-18-2015, 02:01 AM
Here is the lobby interface used for selecting specific worlds. If needed I can update the world sorting functions we used to use.



//check if we're in lobby
function tlobby.hasLobby():boolean;
begin
result:=(not ogl.getTextures(35240).isEmpty());
end;

//check what lobby tab we're in
function tlobby.getTab(): integer;
var
tabs: glTextureArray;
activeTab: glTexture;
index: integer;
begin
if (self.hasLobby()) then
begin
tabs:=ogl.getTextures(235527);
activeTab:=ogl.getTextures(569850)[0];
for index:=0 to high(tabs) do
begin
if (tabs[index].toPoint().x > activeTab.toPoint().x) then
begin
result:= index-1;
exit(result);
end
else
result:=index;
end;
end;
exit(result);
end;

//set tab to Worlds (or others)
function tlobby.setTab(tab: integer): boolean;
begin
if (self.hasLobby()) then
begin
mouse.click(ogl.getTextures(235527)[tab].toPoint().adjustPosition(random(-4, 25), random(-5, 5)));
result:=true;
end;
wait(random(500, 1500));
exit(result);
end;

//Click play now button to log in
function tlobby.clickPlay(): boolean;
begin
if (self.hasLobby()) then
begin
mouse.click(ogl.getTextures(1331318)[0].toPoint().adjustPosition(random(-30, 30), random(-10, 10)));
result:=true;
end;
exit(result);
end;

//get the currently selected world
function tlobby.getWorld(): integer;
var
texture: glTexture;
textureBox: TBox;
begin
if (self.hasLobby()) and (self.getTab() = 1) then
begin
texture:=ogl.getTextures(193824)[0];
textureBox:=intToBox(texture.bounds.x1+135, texture.bounds.y1+10, texture.bounds.x2+180, texture.bounds.y2-30);
result:=ogl.getChars(textureBox).toString().parseI nt();
end;
end;

//Select the passed world
function tlobby.clickWorld(worldToClick: integer): boolean;
var
index, world, scrollCount : integer;
stars: glTextureArray;
worldBox:TBox;
begin
if (self.hasLobby()) then
begin
if (not self.getTab() = 1) then
begin
self.setTab(1);
wait(100);
end;
movemouse(randomrange(200, 800), randomrange(350, 500));
scrollCount := 0;
repeat
stars:= ogl.getTextures(13504);
for index:=0 to high(stars)-1 do
begin
worldBox:=intToBox(stars[index].bounds.x1, stars[index].bounds.y1, stars[index].bounds.x2+70, stars[index].bounds.y2);
world:=ogl.getChars(worldBox).toString().parseInt( );
if (world = worldToClick) then
begin
mouse.click(middleBox(worldBox).adjustPosition(ran dom(-10, 20), random(-2, 2)));
exit(true);
end;
end;
self.scrollDown();
until (scrollCount > 12);
end;
exit(false);
end;

//Select a random world
function tlobby.clickRandomWorld() : Boolean;
var
stars : GlTextureArray;
worldIndex : Integer;
worldBox : TBox;
begin
if self.hasLobby() then
begin
if (self.getTab() <> 1) then
repeat
self.setTab(1);
wait(500);
until (self.getTab() = 1);
stars := ogl.getTextures(13504);
if (not stars.isEmpty()) then
begin
worldIndex := randomrange(0, high(stars));
worldBox := intToBox(stars[worldIndex].bounds.x1, stars[worldIndex].bounds.y1,
stars[worldIndex].bounds.x2+70, stars[worldIndex].bounds.y2);
//writeLn('Logging into world: ', ogl.getChars(worldBox).toString());
mouse.click(middleBox(worldBox).adjustPosition(ran dom(-10, 20), random(-2, 2)));
result := true;
end;
end;
exit(result);
end;

//scroll down..
procedure tlobby.scrollDown();
var
scrolls : Integer = 3;
begin
movemouse(randomrange(200, 800), randomrange(350, 500));
repeat
scrollMouse(randomrange(200, 800), randomrange(350, 500), 1);
wait(16 + random(200));
inc(scrolls);
until(scrolls > 3);
end;


If you need help adding this to your OGL include let me know

Note: Mostly written by Swag_Bag