Useheroskill with arcane echo?

04/01/2023 03:40 sadusten#1
Greetings, does anybody know why my hero cannot cast the skill that replaces his arcane echo/echo/mimicry, as in my case, his DoubleDragon skill. Instead of casting the "copied DD in slot 2", he wants to cast the original DD wich is in slot 3 and recharging....
The skillid, obviously changes from AE into DD once copied, but it's as if his Getskillbar() doesn't update it?:cool:
Appreciate if anybody could help out!


Code:
Global $ArcaneEcho = 2
Global $DoubleDragon = 3

Useheroskill($Vekk, $ArcaneEcho, 0) 
sleep(2000)
Useheroskill($Vekk, $DoubleDragon, GetHeroID($Olias))
sleep(2000)
Useheroskill($Vekk, 2, -2) ; <--- "copied Double Dragon"




Func UseHeroSkill($aHero, $aSkillSlot, $aTarget = 0, $WaitForRecharge = False, $aTimeout = 8000)
	Local $lHeroAgentID = GetHeroID($aHero)
	Local $lSkillID = GetSkillbarSkillID($aSkillSlot, $aHero)
;~ ;	If CantExplore() Then Return False
	If GetEnergy($lHeroAgentID) < GetEnergyReq($lSkillID) Then Return
	If Not IsRecharged($aSkillSlot, $aHero) Then Return
	If GetIsDead($lHeroAgentID) Then Return

	SendPacket(0x14, $HEADER_HERO_USE_SKILL, $lHeroAgentID, $lSkillID, 0, ID($aTarget))
	Local $lDeadlock = TimerInit()
	If $WaitForRecharge Then
		Do
			Sleep(50)
		Until GetIsDead($aTarget) Or (Not IsRecharged($aSkillSlot, $aHero)) Or (TimerDiff($lDeadlock) > $aTimeout)
		Sleep(MemoryRead(GetSkillPtr($lSkillID)  + 64, "float") * 1000)	; Aftercast
	EndIf
	Return True
EndFunc   ;==>UseHeroSkill

Func GetSkillbarSkillID($aSkillSlot, $aHeroNumber = 0)
	Return DllStructGetData(GetSkillbar($aHeroNumber), 'ID' & $aSkillSlot)
EndFunc   ;==>GetSkillbarSkillID

Func GetSkillbar($aHeroNumber = 0)
	Local $lSkillbarStruct = DllStructCreate('long AgentId;long AdrenalineA1;long AdrenalineB1;dword Recharge1;dword Id1;dword Event1;long AdrenalineA2;long AdrenalineB2;dword Recharge2;dword Id2;dword Event2;long AdrenalineA3;long AdrenalineB3;dword Recharge3;dword Id3;dword Event3;long AdrenalineA4;long AdrenalineB4;dword Recharge4;dword Id4;dword Event4;long AdrenalineA5;long AdrenalineB5;dword Recharge5;dword Id5;dword Event5;long AdrenalineA6;long AdrenalineB6;dword Recharge6;dword Id6;dword Event6;long AdrenalineA7;long AdrenalineB7;dword Recharge7;dword Id7;dword Event7;long AdrenalineA8;long AdrenalineB8;dword Recharge8;dword Id8;dword Event8;dword disabled;byte unknown[8];dword Casting')
	Local $lOffset[5]
	$lOffset[0] = 0
	$lOffset[1] = 0x18
	$lOffset[2] = 0x2C
	$lOffset[3] = 0x6F0
	For $i = 0 To GetHeroCount()
		$lOffset[4] = $i * 0xBC
		Local $lSkillbarStructAddress = MemoryReadPtr($mBasePointer, $lOffset)
		DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $lSkillbarStructAddress[0], 'ptr', DllStructGetPtr($lSkillbarStruct), 'int', DllStructGetSize($lSkillbarStruct), 'int', '')
		If DllStructGetData($lSkillbarStruct, 'AgentId') == GetHeroID($aHeroNumber) Then Return $lSkillbarStruct
	Next
EndFunc   ;==>GetSkillbar