(* Chat ==== The chat file contains various methods for interacting with the chat interface. The source for this file can be found `here `_. *) (* tChat.getAlwaysOnMode() ~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tChat.getAlwaysOnMode():boolean; Description: Retrieves the current state of alwaysOnMode. Information: * Returns false or true, relative to the current state of alwaysOnMode. .. note:: - by Obscurity - Last Updated: 2015-07-30 Example: .. code-block:: pascal if chat.getAlwaysOnMode() then sendKeys('Clarity prefers men.'+#10,10+normalRandom(0,20)*5,10+normalRandom(0,20)*5); *) function tChat.getAlwaysOnMode():boolean; var funcPointer:^glTexture; funcPointerSize:uInt32=0; begin funcPointer:=glTextures(funcPointerSize); for 0 to funcPointerSize-1 do begin if funcPointer^.id=4610 then begin result:=true; break; end; funcPointer+=oglTextureSize; end; exit(result); end; (* tChat.getBounds() ~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tChat.getBounds():tBox; Description: Retrieves the bounds of the first found chat interface. Information: * Returns a tBox, relative to the position of the first chat interface. .. note:: - by Obscurity - Last Updated: 2015-07-30 Example: .. code-block:: pascal if not chat.getBounds().equals([0,0,0,0]) then ogl.debug('The chat box was found!'); *) function tChat.getBounds():tBox; var funcBounds:tBox; funcPointer:^glTexture; funcPointerSize:uInt32; begin funcPointer:=glTextures(funcPointerSize)+oglTextureSize; for 1 to funcPointerSize-1 do begin case funcPointer^.id of 3786240: begin if (funcPointer-oglTextureSize)^.id<>3786240 then funcBounds:=funcPointer^.bounds else funcBounds:=[funcBounds.x1,funcBounds.y1,funcPointer^.bounds.x2,funcPointer^.bounds.y2]; end; 24990: begin result:=funcBounds; break; end; end; funcPointer+=oglTextureSize; end; exit(result); end; (* tChat.getChat() ~~~~~~~~~~~~~~~ .. code-block:: pascal function tChat.getChat(funcFilterTimeStamp:boolean=false):tStringArray; Description: Retrieves the contents of the chat window. Text wrapping is automatically detected. Information: * Returns a tStringArray, relative to the position of the first chat interface. .. note:: - by Obscurity - Last Updated: 2015-07-30 Example: .. code-block:: pascal if not chat.getChat().isEmpty() then ogl.debug('A chat message was found!'); *) function tChat.getChat(funcFilterTimeStamp:boolean=false):tStringArray; var funcBounds:tBox; funcPointer:^glChar; funcPointerSize:uInt32; funcResultIndex:int32; begin funcBounds:=self.getBounds(); if not funcBounds.equals([0,0,0,0]) then begin funcBounds:=funcBounds.adjustPosition(0,28,0,-20); funcPointer:=glFonts(funcPointerSize)+(oglCharSize*(funcPointerSize-1)); for 1 to funcPointerSize div 2 do begin if pointInBox([funcPointer^.x,funcPointer^.y],funcBounds) or ((length(result)<>0) and (funcPointer^.y-(funcPointer+2*oglCharSize)^.y<=10)) then begin if (funcPointer^.y-(funcPointer+2*oglCharSize)^.y>10) or (length(result)=0) then setLength(result,funcResultIndex+=1) else if (funcPointer+2*oglCharSize)^.translate[0]-(funcPointer^.translate[0]+funcPointer^.bounds.x2)<>0 then result[funcResultIndex-1]:=' '+result[funcResultIndex-1]; result[funcResultIndex-1]:=funcPointer^.letter+result[funcResultIndex-1]; end else if funcResultIndex then break; funcPointer-=2*oglCharSize; end; result:=result.reverse(); end; exit(result); end; (* tChat.hasChat() ~~~~~~~~~~~~~~~ .. code-block:: pascal function tChat.hasChat():boolean; Description: Retrieves if a chat interface exists. Information: * Returns false or true, relative to existance of a chat interface. .. note:: - by Obscurity - Last Updated: 2015-07-30 Example: .. code-block:: pascal if chat.hasChat() and chat.getAlwaysOnMode() then sendKeys('Clarity prefers men.'+#10,10+normalRandom(0,20)*5,10+normalRandom(0,20)*5); *) function tChat.hasChat():boolean; var funcPointer:^glTexture; funcPointerSize:uInt32; begin funcPointer:=glTextures(funcPointerSize)+(oglTextureSize*(funcPointerSize-1)); for 0 to funcPointerSize-1 do begin if funcPointer^.id=24990 then begin result:=true; break; end; funcPointer:=funcPointer-oglTextureSize; end; exit(result); end; (* tChat.setAlwaysOnMode() ~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tChat.setAlwaysOnMode(funcEnable:boolean):boolean; Description: Sets the state of the alwaysOnMode. If alwaysOnMode is already set to the desired state, the method is ignored. Information: * Returns true if successful. * Uses the mouse. .. note:: - by Obscurity - Last Updated: 2015-07-30 Example: .. code-block:: pascal if chat.getAlwaysOnMode() then chat.setAlwaysOnMode(false); *) function tChat.setAlwaysOnMode(funcEnable:boolean):boolean; var funcPointer:^glTexture; funcPointerSize:uInt32; funcPoint: TPoint; begin funcPointer:=glTextures(funcPointerSize); for 0 to funcPointerSize-1 do begin case funcPointer^.id of 4610,4481: begin if (funcPointer^.id=4610)<>funcEnable then begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; end; break; end; end; funcPointer:=funcPointer+oglTextureSize; end; exit(result); end;