Code: Select all
function CPlayer:petHeal()
if ( settings.profile.options.PET_HEAL ) then
self:update();
while ((self.petHP/self.petMaxHP*100) < settings.profile.options.PET_HEAL_PCT) do
cprintf(cli.yellow, "Pet heal! Pet Health [%i/%i]\n", self.petHP, self.petMaxHP);
self:update();
keyboardPress( settings.hotkeys.TARGET_PET.key );
yrest(50);
keyboardRelease(settings.hotkeys.MOVE_FORWARD.key);
keyboardPress( key[settings.profile.options.PET_HEAL_KEY] );
yrest(4000);
end;
end;
end
Code: Select all
function CPlayer:checkPotions()
self:petHeal();
player.lua, everywhere you see
Code: Select all
target.TargetPtr ~= self.Address
Code: Select all
and target.TargetPtr ~= self.PetPtr
Code: Select all
target.TargetPtr ~= self.Address and target.TargetPtr ~= self.PetPtr
Code: Select all
if( target.TargetPtr == self.Address or target.TargetPtr == self.PetPtr) then -- it is the right aggressor
in moveto function -- put this directly above the other if self.battling
Code: Select all
self:update();
if (self.Battling and self.petTarget~=0 and self.TargetPtr==0) then --assist your pet
cprintf(cli.yellow, "Assisting Pet\n");
keyboardPress( settings.hotkeys.TARGET_PET.key );
yrest(100);
keyboardPress( settings.hotkeys.ASSIST_KEY.key );
yrest(100);
self:fight();
failreason = WF_COMBAT;
break;
end;
Code: Select all
if( self.Battling and self.petTarget~=0 and -- we have aggro
self.Fighting == false and -- we are not coming from the fight routines (bec. as melee we should move in fight)
waypoint.Type ~= WPT_RUN and -- only stop if not waypoint type RUN
waypoint.Type ~= WPT_TRAVEL and
os.difftime(os.time(), player.LastAggroTimout ) > 10 ) then -- dont stop 10sec after last aggro wait timeout
keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );
success = false;
failreason = WF_COMBAT;
break;
end;
Code: Select all
self.petTarget = debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnTargetPtr_offset), language[41]);
Code: Select all
self.PetPtr = debugAssert(memoryReadInt(getProc(), self.Address + addresses.pawnPetPtr_offset), language[41]);
self.petHP = debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnHP_offset), language[41]);
self.petMaxHP = debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnMaxHP_offset), language[41]);
self.petTarget = debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnTargetPtr_offset), language[41]);
pawn.lua define these variable in the cpawn class
Code: Select all
self.PetPtr = 0;
self.petHP = 0;
self.petMaxHP = 0;
Code: Select all
self.PetPtr = debugAssert(memoryReadInt(proc, self.Address + addresses.pawnPetPtr_offset), memerrmsg);
self.petTarget = debugAssert(memoryReadInt(proc, self.Address + addresses.pawnTargetPtr_offset), memerrmsg);
self.petHP = debugAssert(memoryReadInt(proc, self.PetPtr + addresses.pawnHP_offset), memerrmsg);
self.petMaxHP = debugAssert(memoryReadInt(proc, self.PetPtr + addresses.pawnMaxHP_offset), memerrmsg);
settings.lua hotkeys
Code: Select all
ASSIST_KEY = {key = _G.key.VK_F, modifier = nil},
TARGET_PET = {key = _G.key.VK_F2, modifier = nil}
Code: Select all
PET_HEAL_PCT=50,
PET_HEAL_KEY="VK_6",
PET_HEAL = false,
Profile XML for your character
Code: Select all
<option name="PET_HEAL" value="true" />
<option name="PET_HEAL_KEY" value="VK_2" />
<option name="PET_HEAL_PCT" value="95" />
I believe I got all the modifications posted in here to make you assist your pet and heal your pet.
Another mod i've made myself.