(* ActionBar ========= The actionBar file contains various methods for interacting with the actionBar interface. The source for this file can be found `here `_. *) (* tActionBar.clickAbility() ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.clickAbility(funcString:ansiString):boolean; Description: Clicks the desired ability on the actionBar. If the ability is already queued, the method is ignored. Information: * Returns true if successful. * Uses the mouse. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if actionBar.getAdrenaline()>=50 then actionBar.clickAbility('wild magic'); *) function tActionBar.clickAbility(funcString:ansiString):boolean; var funcColourID:int32; begin if(funcColourID:=self.getAbilityColourID(funcString))=0 then exit(); exit(result:=self.clickAction(137700,funcColourID)); end; (* tActionBar.clickAction() ~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.clickAction(funcID:int32):boolean; function tActionBar.clickAction(funcID,funcColourID:int32):boolean;overload; Description: Clicks the desired action on the actionBar. An action is represented by its textureID and (optional) colourID. If the action is already queued, the method is ignored. Information: * Returns true if successful. * Uses the mouse. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if actionBar.getLifePoints()<50 then actionBar.clickAction(__sharkID); *) function tActionBar.clickAction(funcID:int32):boolean; var funcPointer:^glTexture; funcPointerSize:uInt32; funcPoint: TPoint; begin funcPointer:=glTextures(funcPointerSize)+5*oglTextureSize; for 5 to funcPointerSize-4 do begin if (funcPointer^.id=funcID) and ((funcPointer-5*oglTextureSize)^.id=9900) then begin case (funcPointer+3*oglTextureSize)^.id of 43320,6443:; else begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; end; end; break; end; funcPointer+=oglTextureSize; end; end; function tActionBar.clickAction(funcID,funcColourID:int32):boolean;overload; var funcPointer:^glTexture; funcPointerSize:uInt32; funcPoint: TPoint; begin funcPointer:=glTextures(funcPointerSize)+5*oglTextureSize; for 5 to funcPointerSize-4 do begin if (funcPointer^.id=funcID) and (funcPointer^.colourID=funcColourID) and ((funcPointer-5*oglTextureSize)^.id=9900) then begin case (funcPointer+3*oglTextureSize)^.id of 43320,6443:; else begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; end; end; break; end; funcPointer+=oglTextureSize; end; end; (* tActionBar.clickFamiliarAction():boolean; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.clickFamiliarAction():boolean; Description: Clicks the default familiar action button. Information: * Returns true if successful. * Uses the mouse. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if actionBar.getLifePoints()<50 then actionBar.clickFamiliarAction(); *) function tActionBar.clickFamiliarAction():boolean; var funcPointer:^glTexture; funcPointerSize:uInt32; funcPoint: TPoint; begin funcPointer:=glTextures(funcPointerSize); for 0 to funcPointerSize-1 do begin if funcPointer^.id=28704 then begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; break; end; funcPointer+=oglTextureSize; end; end; (* tActionBar.rightClickFamiliarAction():boolean; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.rightClickFamiliarAction(funcOption:string; funcWait:integer=300):boolean; Description: Right clicks the default familiar action button and selects the given option. Wait time is the delay between right click and option selection. Information: * Returns true if successful. * Uses the mouse. .. note:: - by Clarity - Last Updated: 2015-10-17 Example: .. code-block:: pascal if actionBar.getLifePoints()<50 then actionBar.rightClickFamiliarAction('Take BoB'); *) function tActionBar.rightClickFamiliarAction(funcOption:string; funcWait:integer=300):boolean; var funcPointer:^glTexture; funcPointerSize:uInt32; funcPoint: TPoint; begin funcPointer:=glTextures(funcPointerSize); for 0 to funcPointerSize-1 do begin if funcPointer^.id=28704 then begin funcPoint:=funcPointer^.bounds.normalizePoint(); result:=tMouse.rightClickOption(point(funcPoint.x, funcPoint.y), [funcOption], funcWait); break; end; funcPointer+=oglTextureSize; end; end; (* tActionBar.getAbilityColourID() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.getAbilityColourID(funcString:string):integer; Description: Retrieves the colourID of a specified ability. All abilities share the textureID 137700. Information: * Returns an int32 relative to the desired ability's colourID. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if actionBar.getAdrenaline()>50 then actionBar.clickAction(137700,actionBar.getAbilityColourID('wild magic')); *) function tActionBar.getAbilityColourID(funcString:string):integer; begin funcString:=replaceRegExpr('(\W|_)*',lowercase(funcString),'',false); case funcString of //~ Attack 'slice':result:=7364669; 'slaughter':result:=10185296; 'overpower':result:=9596437; 'havoc':result:=6769465; 'backhand':result:=9201723; 'forcefulbackhand':result:=8809002; 'smash':result:=11439683; 'barge':result:=5125654; 'flurry':result:=7103309; 'sever':result:=8806966; 'hurricane':result:=6377507; 'massacre':result:=11236419; 'bloodtendrils':result:=11095045; 'meteorstrike':result:=8743189; 'balancedstrike':result:=8484394; //~ Constitution 'specialattack':result:=3028023; 'sacrifice':result:=7687509; 'regenerate':result:=6957870; 'transfigure':result:=6573108; 'siphon':result:=6836031; 'incite':result:=6828336; 'guthixsblessing':result:=7427924; 'iceasylum':result:=6574688; //~ Defence 'devotion':result:=5596780; 'anticipation':result:=8153941; 'bash':result:=7498076; 'revenge':result:=7103061; 'provoke':result:=3687237; 'immortality':result:=6184025; 'freedom':result:=5790556; 'reflect':result:=6252139; 'resonance':result:=6777706; 'rejuvenate':result:=6836800; 'debilitate':result:=6382176; 'preparation':result:=8288624; 'barricade':result:=7237487; 'naturalinstinct':result:=6579557; //~ Magic 'asphyxiate':result:=7759718; 'wrack':result:=3692651; 'omnipower':result:=1916764; 'dragonbreath':result:=6376770; 'sonicwave':result:=674964; 'impact':result:=3626349; 'concentratedblast':result:=881846; 'deepimpact':result:=4613249; 'combust':result:=7299665; 'surge':result:=2896961; 'detonate':result:=5334644; 'chain':result:=4940147; 'wildmagic':result:=6319739; 'metamorphosis':result:=4014924; 'smoketendrils':result:=819042; 'tsunami':result:=1788774; 'sunshine':result:=4614018; //~ Ranged 'piercingshot':result:=3162661; 'snapshot':result:=4211760; 'deadshot':result:=3822624; 'snipe':result:=10913393; 'dazingshot':result:=9409044; 'bindingshot':result:=6053420; 'needlestrike':result:=4286509; 'tightbindings':result:=4931369; 'fragmentationshot':result:=8745512; 'escape':result:=3684636; 'rapidfire':result:=3094570; 'ricochet':result:=3360288; 'bombardment':result:=5466151; 'incendiaryshot':result:=6773028; 'shadowtendrils':result:=5790559; 'unload':result:=5924412; 'deathsswiftness':result:=2240030; //~ Strength 'stomp':result:=6897695; 'kick':result:=6636067; 'punish':result:=7423005; 'dismember':result:=5516033; 'fury':result:=7889227; 'destroy':result:=7423001; 'quake':result:=8152407; 'berserk':result:=6042378; 'cleave':result:=8673072; 'assault':result:=5520424; 'decimate':result:=6242081; 'pulverise':result:=6837057; 'frenzy':result:=7161369; end; exit(result); end; (* tActionBar.getAbilityKey() ~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.getAbilityKey(funcString:string):char; Description: Retrieves the key required to activate the specified ability. Information: * Returns a character relative to the desired ability. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if actionBar.getAdrenaline()>50 then sendKeys(actionBar.getAbilityKey('wild magic'),10+normalRandom(0,20)*5,10+normalRandom(0,20)*5); *) function tActionBar.getAbilityKey(funcString:string):char; var funcColourID:int32; begin if (funcColourID:=self.getAbilityColourID(funcString)) then result:=self.getActionKey(137700,funcColourID); exit(result); end; (* tActionBar.getActionActive() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.getActionActive(funcID:int32):boolean; function tActionBar.getActionActive(funcID,funcColourID:int32):boolean;overload; - Description: Retrieves the active state of an action. Actions appear as active when they are drawn with a white border. Information: * Returns false or true, relative to the current state of the action. .. note:: - by Obscurity - Last Updated: 2015-08-05 Example: .. code-block:: pascal if not actionBar.getActionActive(65161) then actionBar.clickAction(65161); *) function tActionBar.getActionActive(funcID:int32):boolean; var funcFound, funcIndex:int32; funcPointerSize:uInt32; funcPointer:^glTexture; begin funcPointer:=glTextures(funcPointerSize)+5*oglTextureSize; for 5 to funcPointerSize-1 do begin if (funcPointer^.id=funcID) and ((funcPointer-5*oglTextureSize)^.id=9900) then begin for funcIndex to 3 do if (getColor(funcPointer^.bounds.x1-1+funcIndex mod 2*30,funcPointer^.bounds.y1-1+funcIndex div 2*31)=13158600) and ((funcFound:=funcFound+1)=2) then begin result:=true; break; end; break; end; funcPointer+=oglTextureSize; end; exit(result); end; function tActionBar.getActionActive(funcID,funcColourID:int32):boolean;overload; var funcFound, funcIndex:int32; funcPointerSize:uInt32; funcPointer:^glTexture; begin funcPointer:=glTextures(funcPointerSize)+5*oglTextureSize; for 5 to funcPointerSize-1 do begin if (funcPointer^.id=funcID) and (funcPointer^.colourID=funcColourID) and ((funcPointer-5*oglTextureSize)^.id=9900) then begin for funcIndex to 3 do if (getColor(funcPointer^.bounds.x1-1+funcIndex mod 2*30,funcPointer^.bounds.y1-1+funcIndex div 2*31)=13158600) and ((funcFound:=funcFound+1)=2) then begin result:=true; break; end; break; end; funcPointer+=oglTextureSize; end; exit(result); end; (* tActionBar.getActionBar() ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.getActionBar():char; Description: Retrieves the current actionBar number. Information: * Returns '1'..'6', relative to the current abilityBar. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if actionBar.getActionBar()<>'2' then actionBar.setActionBar('2'); *) function tActionBar.getActionBar():char; var funcCA:^glChar; funcCASize, funcTASize:uInt32; funcTA:^glTexture; begin funcTA:=glTextures(funcTASize); for 0 to funcTASize-1 do begin if funcTA^.id=28793 then begin funcCA:=glFonts(funcCASize)+(funcCASize-1)*oglCharSize; for 0 to funcCASize-1 do begin if pointInBox(funcCA^.toPoint(),funcTA^.bounds) then begin result:=funcCA^.letter; break; end; funcCA-=oglCharSize; end; break; end; funcTA+=oglTextureSize; end; exit(result); end; (* tActionBar.getActionKey() ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.getActionKey(funcID:int32):boolean; function tActionBar.getActionKey(funcID,funcColourID:int32):boolean;overload; Description: Retrieves the key required to activate the specified action. An action is represented by its textureID and (optional) colourID. Information: * Returns a character relative to the desired action. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if actionBar.getLifePoints()<50 then sendKeys(actionBar.getActionKey(__sharkID),10+normalRandom(0,20)*5,10+normalRandom(0,20)*5); *) function tActionBar.getActionKey(funcID:int32):char;overload; var funcCA:^glChar; funcCASize, funcTASize:uInt32; funcTA:^glTexture; begin funcTA:=glTextures(funcTASize)+5*oglTextureSize; for 5 to funcTASize-1 do begin if (funcTA^.id=funcID) and ((funcTA-5*oglTextureSize)^.id=9900) then begin funcCA:=glFonts(funcCASize); for 0 to funcCASize-1 do begin if pointInBox([funcCA^.x,funcCA^.y],funcTA^.bounds) then begin result:=funcCA^.letter; break; end; funcCA+=oglCharSize; end; break; end; funcTA+=oglTextureSize; end; exit(result); end; function tActionBar.getActionKey(funcID,funcColourID:int32):char;overload; var funcCA:^glChar; funcCASize, funcTASize:uInt32; funcTA:^glTexture; begin funcTA:=glTextures(funcTASize)+5*oglTextureSize; for 5 to funcTASize-1 do begin if (funcTA^.id=funcID) and (funcTA^.colourID=funcColourID) and ((funcTA-5*oglTextureSize)^.id=9900) then begin funcCA:=glFonts(funcCASize)+(funcCASize-1)*oglCharSize; for 0 to funcCASize-1 do begin if pointInBox([funcCA^.x,funcCA^.y],funcTA^.bounds) then begin result:=funcCA^.letter; break; end; funcCA-=oglCharSize; end; break; end; funcTA+=oglTextureSize; end; exit(result); end; (* tActionBar.getAdrenaline() ~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.getAdrenaline():int32; Description: Retrieves the current adrenaline percentage. Information: * Returns 0..100, relative to the current adrenaline. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if actionBar.getAdrenaline()<50 then sendKeys(actionBar.getAbilityKey('metamorphosis'),10+normalRandom(0,20)*5,10+normalRandom(0,20)*5); *) function tActionBar.getAdrenaline():int32; var funcPointer:^glTexture; funcPointerSize:uInt32; begin funcPointer:=glTextures(funcPointerSize); for 0 to funcPointerSize-1 do begin if funcPointer^.id=79179 then begin case funcPointer^.bounds.x150) and (not actionBar.isABilityQueued()) then actionBar.clickAbility('wild magic'); *) function tActionBar.isAbilityQueued(funcString:ansiString):boolean; var funcColourID:int32; funcPointer:^glTexture; funcPointerSize:uInt32; begin if(funcColourID:=self.getAbilityColourID(funcString)) then begin funcPointer:=glTextures(funcPointerSize)+5*oglTextureSize; for 5 to funcPointerSize-4 do begin if (funcPointer^.id=137700) and (funcPointer^.colourID=funcColourID) and ((funcPointer-5*oglTextureSize)^.id=9900) then begin case (funcPointer+3*oglTextureSize)^.id of 43320,6443:result:=true; end; break; end; funcPointer+=oglTextureSize; end; end; end; (* tActionBar.isAbilityOnCoolDown() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.isAbilityOnCoolDown(funcString:ansiString):boolean; Description: Retrieves the cooldown state of a specified ability. Information: * Returns false or true, relative to the cooldown state of the ability. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if not actionBar.isAbilityOnCoolDown('sacrifice') then actionBar.clickAbility('sacrifice'); *) function tActionBar.isAbilityOnCoolDown(funcString:string):boolean; var funcColourID:int32; funcPointer:^glTexture; funcPointerSize:uInt32; begin if(funcColourID:=self.getAbilityColourID(funcString)) then begin funcPointer:=glTextures(funcPointerSize)+5*oglTextureSize; for 5 to funcPointerSize-3 do begin if (funcPointer^.id=137700) and (funcPointer^.colourID=funcColourID) and ((funcPointer-5*oglTextureSize)^.id=9900) then begin result:=(funcPointer+2*oglTextureSize)^.id mod 255=0; break; end; funcPointer+=oglTextureSize; end; end; end; (* tActionBar.setActionBar() ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.isAbilityOnCoolDown(funcString:ansiString):boolean; Description: Sets the current actionBar number. If the abilityBar is already set to the desired number, the method is ignored. Information: * Returns true if successful. * Uses the keyboard. .. note:: - by Obscurity - Last Updated: 2015-07-24 Example: .. code-block:: pascal if not actionBar.getActionBar()<>'1' then actionBar.setActionBar(1); *) function tActionBar.setActionBar(funcActionBar:char):boolean; var funcKeyCode:uInt32; begin case funcActionBar of '1'..'6': begin if self.getActionBar()<>funcActionBar then begin keyDown(16); sendKeys(funcActionBar,10+normalRandom(0,20)*5,10+normalRandom(0,20)*5); keyUp(16); end; end; end; exit(result); end; (* tActionBar.setAutoRetaliate() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.setAutoRetaliate():boolean; Description: Sets the state of autoRetaliate. If autoRetaliate 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-24 Example: .. code-block:: pascal if actionBar.getAutoRetaliate() then actionBar.setAutoRetaliate(false); *) function tActionBar.setAutoRetaliate(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 17914,19200: begin if funcEnable then begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; end; break; end; 27966: begin if not funcEnable then begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; end; break; end; end; funcPointer+=oglTextureSize; end; exit(result); end; (* tActionBar.setQuickPrayer() ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.setQuickPrayer():boolean; Description: Sets the state of quick prayer. If quick prayer 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-24 Example: .. code-block:: pascal if actionBar.getQuickPrayer() and (actionBar.getLifePoints()>75) then actionBar.setQuickPrayer(false); *) function tActionBar.setQuickPrayer(funcEnable:boolean):boolean; var funcPointer:^glTexture; funcPointerSize:uInt32; funcPoint: TPoint; begin funcPointer:=glTextures(funcPointerSize); for 0 to funcPointerSize-1 do begin if funcPointer^.id=61688 then begin if (funcPointer^.colourID=4272497)<>funcEnable then begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; end; break; end; funcPointer+=oglTextureSize; end; exit(result); end; (* tActionBar.setRegenerate() ~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.setRegenerate():boolean; Description: Sets the state of regenerate. If regenerate 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-24 Example: .. code-block:: pascal if (actionBar.getLifePoints()>50) and actionBar.getRegenerate() then actionBar.setRegenerate(false); *) function tActionBar.setRegenerate(funcEnable:boolean):boolean; var funcPointer:^glTexture; funcPointerSize:uInt32; funcPoint: TPoint; begin funcPointer:=glTextures(funcPointerSize)+oglTextureSize; for 1 to funcPointerSize-1 do begin if funcPointer^.id=27185 then begin if ((funcPointer-oglTextureSize)^.id=6443)<>funcEnable then begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; end; break; end; funcPointer+=oglTextureSize; end; exit(result); end; (* tActionBar.setState() ~~~~~~~~~~~~~~~~~~~~~ .. code-block:: pascal function tActionBar.setState():boolean; Description: Sets the state of the actionBar. If actionBar 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-24 Example: .. code-block:: pascal if not actionBar.getState() then actionBar.setState(true); *) function tActionBar.setState(funcMaximize:boolean):boolean; var funcPointer:^glTexture; funcPointerSize:uInt32; funcPoint: TPoint; begin funcPointer:=glTextures(funcPointerSize)+3*oglTextureSize; for 3 to funcPointerSize-1 do begin if (funcPointer^.id=11475) and (funcMaximize=((funcPointer-3*oglTextureSize)^.id<>28793)) then begin funcPoint:=funcPointer^.bounds.normalizePoint(); clickMouse(funcPoint.x, funcPoint.y, 1); result:=true; break; end; funcPointer+=oglTextureSize; end; exit(result); end;