Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_UseX64=n
- #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
- #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
- ;;================================================================================
- ;;================================================================================
- ;; Diablo 3 Au3 ToolKit
- ;; Based on Unkn0wned, voxatu & the RE community works
- ;;
- ;~ ;; By Opkllhibus, Leo11173
- ;;================================================================================
- ;;================================================================================
- ;;================================================================================
- ;; PRE FUNCTIONS
- ;;================================================================================
- ;;--------------------------------------------------------------------------------
- ;; Make sure you are running as admin
- ;;--------------------------------------------------------------------------------
- $_debug = 1
- #RequireAdmin
- $Admin = IsAdmin()
- If $Admin <> 1 Then
- MsgBox(0x30, "ERROR", "This program require administrative rights you fool!")
- Exit
- EndIf
- ;;--------------------------------------------------------------------------------
- ;; Includes
- ;;--------------------------------------------------------------------------------
- #include <NomadMemory.au3> ;THIS IS EXTERNAL, GET IT AT THE AUTOIT WEBSITE
- #include <math.au3>
- #include <String.au3>
- #include <Array.au3>
- #include "constants.au3"
- ;;--------------------------------------------------------------------------------
- ;; Initialize MouseCoords
- ;;--------------------------------------------------------------------------------
- Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client
- ;;--------------------------------------------------------------------------------
- ;; Open the process
- ;;--------------------------------------------------------------------------------
- Opt("WinTitleMatchMode", -1)
- SetPrivilege("SeDebugPrivilege", 1)
- Global $ProcessID = WinGetProcess("Diablo III", "")
- Local $d3 = _MemoryOpen($ProcessID)
- If @error Then
- MsgBox(4096, "ERROR", "Failed to open memory for process;" & $ProcessID)
- Exit
- EndIf
- ;OffsetList()
- ;;================================================================================
- ;; FUNCTIONS
- ;;================================================================================
- Func _logind3()
- WinActivate("Diablo III")
- _log("Login")
- Sleep(20)
- Send($d3pass)
- Sleep(2000)
- Send("{ENTER}")
- Sleep(Random(5000, 6000, 1))
- EndFunc ;==>_logind3
- ;;--------------------------------------------------------------------------------
- ; Function: FindActor()
- ; Description: Check if an actor is present or not
- ;
- ; Note(s): Return 1 if found in range or 0 if absent
- ;;--------------------------------------------------------------------------------
- Func FindActor($name, $maxRange = 400)
- Local $index, $offset, $count, $item[10], $find = 0
- startIterateObjectsList($index, $offset, $count)
- While iterateObjectsList($index, $offset, $count, $item)
- If StringInStr($item[1], $name) And $item[9] < $maxRange Then
- $find = 1
- Return 1
- ExitLoop
- Sleep(100)
- EndIf
- WEnd
- If $find = 0 then SetError(1)
- Return 0
- EndFunc ;==>FindActor
- ;;--------------------------------------------------------------------------------
- ; Function: checkuiitemvisible()
- ; Description: search a value in the object manager
- ;;--------------------------------------------------------------------------------
- Func checkuiitemvisible($valuetocheckfor, $visibility)
- $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
- $ptr2 = _memoryread($ptr1 + 2340, $d3, "ptr")
- $ptr3 = _memoryread($ptr2 + 0, $d3, "ptr")
- $ofs_uielements = _memoryread($ptr3 + 8, $d3, "ptr")
- $uielementcount = _memoryread($ptr3 + 64, $d3, "int")
- $counter = 0
- While ($counter < $uielementcount)
- $counter += 1
- $uielemepointer = _memoryread($ofs_uielements + $counter * 4, $d3, "ptr")
- While ($uielemepointer <> 0)
- $npnt = _memoryread($uielemepointer + 528, $d3, "ptr")
- $name = BinaryToString(_memoryread($npnt + 56, $d3, "byte[256]"), 4)
- ;String($name))
- $visible = _memoryread($npnt + 40, $d3, "int")
- If ($visible = $visibility) Then
- $foundvalue = StringInStr($name, $valuetocheckfor)
- If ($foundvalue >= 1) Then
- Return True
- EndIf
- EndIf
- $uielemepointer = _memoryread($uielemepointer, $d3, "ptr")
- WEnd
- WEnd
- Return False
- EndFunc ;==>checkuiitemvisible
- Func fastcheckuiitemvisible($valuetocheckfor, $visibility, $bucket)
- $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
- $ptr2 = _memoryread($ptr1 + 2340, $d3, "ptr")
- $ptr3 = _memoryread($ptr2 + 0, $d3, "ptr")
- $ofs_uielements = _memoryread($ptr3 + 8, $d3, "ptr")
- $uielementpointer = _memoryread($ofs_uielements + 4 * $bucket, $d3, "ptr")
- While $uielementpointer <> 0
- $npnt = _memoryread($uielementpointer + 528, $d3, "ptr")
- $name = BinaryToString(_memoryread($npnt + 56, $d3, "byte[256]"), 4)
- If StringInStr($name, $valuetocheckfor) Then
- If _memoryread($npnt + 40, $d3, "int") = $visibility Then
- Return True
- Else
- Return False
- EndIf
- EndIf
- $uielementpointer = _memoryread($uielementpointer, $d3, "ptr")
- WEnd
- Return False
- EndFunc ;==>fastcheckuiitemvisible
- Func _playerdead()
- $playerdeadlookfor = "NormalLayer.deathmenu_dialog"
- Return fastcheckuiitemvisible($playerdeadlookfor, 1, 969)
- EndFunc ;==>_playerdead
- Func _inmenu()
- $lobbylookfor = "Menu.PlayGameButton"
- Return checkuiitemvisible($lobbylookfor, 1)
- EndFunc ;==>_inmenu
- Func _checkdisconnect()
- $disclookfor = "Root.TopLayer.BattleNetModalNotifications_main.ModalNotification.Buttons.ButtonList.OkButton"
- Return checkuiitemvisible($disclookfor, 1)
- EndFunc ;==>_checkdisconnect
- Func _checkRepair()
- $disclookfor = "Root.NormalLayer.DurabilityIndicator"
- Return fastcheckuiitemvisible($disclookfor, 1, 239)
- EndFunc ;==>_checkRepair
- Func _onloginscreen()
- $loginlookfor = "Root.NormalLayer.BattleNetLogin_main.LayoutRoot"
- Return fastcheckuiitemvisible($loginlookfor, 1, 54)
- EndFunc ;==>_onloginscreen
- Func _escmenu()
- $escmenuelookfor = "Root.TopLayer.gamemenu_dialog.gamemenu_bkgrnd.ButtonStackContainer.button_leaveGame"
- Return fastcheckuiitemvisible($escmenuelookfor, 1, 1447)
- EndFunc ;==>_escmenu
- Func _ingame()
- $gamelookfor = "game_progressBar_healthBall"
- Return fastcheckuiitemvisible($gamelookfor, 1, 237)
- EndFunc ;==>_ingame
- Func _checkWPopen()
- $checkWPopenlookfor = "Root.NormalLayer.waypoints_dialog_mainPage"
- Return checkuiitemvisible($checkWPopenlookfor, 1)
- EndFunc ;==>_checkWPopen
- Func _checkVendoropen()
- $checkVendorOpenlookfor = "Root.NormalLayer.shop_dialog_mainPage"
- Return checkuiitemvisible($checkVendorOpenlookfor, 1)
- EndFunc ;==>_checkWPopen
- Func _checkStashopen()
- $_checkStashopenlookfor = "Root.NormalLayer.stash_dialog_mainPage"
- Return checkuiitemvisible($_checkStashopenlookfor, 1)
- EndFunc ;==>_checkWPopen
- Func _checkInventoryopen()
- $_checkInventoryopenlookfor = "Root.NormalLayer.inventory_dialog_mainPage"
- Return checkuiitemvisible($_checkInventoryopenlookfor, 1)
- EndFunc ;==>_checkWPopen
- Func _townportal()
- _log("Town Portal")
- Sleep(200)
- Send("t")
- Sleep(Random(7500, 8000, 1))
- EndFunc ;==>_townportal
- ;;--------------------------------------------------------------------------------
- ; Function: IsInArea($area)
- ; Description: Check where we are
- ;
- ;;--------------------------------------------------------------------------------
- Func IsInArea($area)
- $area = GetLevelAreaId()
- ConsoleWrite("Area " & $area & @CRLF)
- return $area = GetLevelAreaId()
- EndFunc ;==>IsInArea
- Func GetLevelAreaId()
- return _MemoryRead(_MemoryRead(0x1717244,$d3,"int")+ 0x810,$d3,"int")
- EndFunc ;==>GetLevelAreaId
- Func LevelAreaConstants()
- Global $A1_C6_SpiderCave_01_Entrance = 0xE3A6
- Global $A1_C6_SpiderCave_01_Main = 0x132EC
- Global $A1_C6_SpiderCave_01_Queen = 0xF506
- Global $A1_Dun_Crypt_Dev_Hell = 0x36581
- Global $A1_Fields_Cave_SwordOfJustice_Level01 = 0x1D455
- Global $A1_Fields_Den = 0x21045
- Global $A1_Fields_Den_Level02 = 0x2F6b8
- Global $A1_Fields_RandomDRLG_CaveA_Level01 = 0x141C4
- Global $A1_Fields_RandomDRLG_CaveA_Level02 = 0x141C5
- Global $A1_Fields_RandomDRLG_ScavengerDenA_Level01 = 0x13D0D
- Global $A1_Fields_RandomDRLG_ScavengerDenA_Level02 = 0x13D17
- Global $A1_Fields_Vendor_Tinker_Exterior = 0x2bC0C
- Global $A1_Highlands_RandomDRLG_GoatmanCaveA_Level01 = 0x14286
- Global $A1_Highlands_RandomDRLG_GoatmanCaveA_Level02 = 0x14287
- Global $A1_Highlands_RandomDRLG_WestTower_Level01 = 0x14196
- Global $A1_Highlands_RandomDRLG_WestTower_Level02 = 0x14197
- Global $A1_Random_Level01 = 0x33A17
- Global $A1_trDun_Blacksmith_Cellar = 0x144A6
- Global $A1_trDun_ButchersLair_02 = 0x16301
- Global $A1_trDun_Cain_Intro = 0xED2A
- Global $A1_trDun_Cave_Highlands_Random01_VendorRescue = 0x21310
- Global $A1_trdun_Cave_Nephalem_01 = 0xEBEC
- Global $A1_trdun_Cave_Nephalem_02 = 0xEBED
- Global $A1_trdun_Cave_Nephalem_03 = 0xEBEE
- Global $A1_trDun_Cave_Old_Ruins_Random01 = 0x278AC
- Global $A1_trDun_CrownRoom = 0x18FDA
- Global $A1_trDun_Crypt_Event_Tower_Of_Power = 0x138F4
- Global $A1_trDun_Crypt_Flooded_Memories_Level01 = 0x18F9c
- Global $A1_trDun_Crypt_Flooded_Memories_Level02 = 0x287A6
- Global $A1_trdun_Crypt_Special_00 = 0x25BDC
- Global $A1_trdun_Crypt_Special_01 = 0xECB9
- Global $A1_trDun_Event_JarOfSouls = 0x2371E
- Global $A1_trDun_FalseSecretPassage_01 = 0x14540
- Global $A1_trDun_FalseSecretPassage_02 = 0x14541
- Global $A1_trDun_FalseSecretPassage_03 = 0x14542
- Global $A1_trDun_Jail_Level01 = 0x171d0
- Global $A1_trDun_Jail_Level01_Cells = 0x1783D
- Global $A1_trDun_Leoric01 = 0x4D3E
- Global $A1_trDun_Leoric02 = 0x4D3F
- Global $A1_trDun_Leoric03 = 0x4D40
- Global $A1_trDun_Level01 = 0x4D44
- Global $A1_trDun_Level04 = 0x4D47
- Global $A1_trDun_Level05_Templar = 0x15763
- Global $A1_trDun_Level06 = 0x4D49
- Global $A1_trDun_Level07B = 0x4D4B
- Global $A1_trDun_Level07D = 0x4D4D
- Global $A1_trDun_Tyrael_Level09 = 0x1CAA3
- Global $A1_trDun_TyraelJail = 0x24447
- Global $A1_trOut_AdriasCellar = 0xF5F8
- Global $A1_trOUT_AdriasHut = 0x4DD9
- Global $A1_trOut_BatesFarmCellar = 0x248A5
- Global $A1_trOUT_Church = 0x4DDD
- Global $A1_trOut_Fields_Vendor_Curios = 0x1A3B7
- Global $A1_trOut_Fields_Vendor_Curios_Exterior = 0x2BE7B
- Global $A1_trOUT_FishingVillage = 0x4DDF
- Global $A1_trOUT_FishingVillageHeights = 0x1FB03
- Global $A1_trOut_ForlornFarm = 0x20B72
- Global $A1_trOUT_Graveyard = 0x4DE2
- Global $A1_trOUT_Highlands = 0x4DE4
- Global $A1_trOUT_Highlands_Bridge = 0x16DC0
- Global $A1_trOut_Highlands_DunExterior_A = 0x15718
- Global $A1_trOUT_Highlands_ServantHouse_Cellar_Vendor = 0x29CD1
- Global $A1_trOUT_Highlands_Sub240_GoatmanGraveyard = 0x1F95F
- Global $A1_trOUT_Highlands2 = 0x4DE5
- Global $A1_trOUT_Highlands3 = 0x4AF
- Global $A1_trOut_Leoric_Manor_Int = 0x189F6
- Global $A1_trOUT_LeoricsManor = 0x4DE7
- Global $A1_trOut_MysticWagon = 0x20F08
- Global $A1_trOUT_NewTristram = 0x4DEB
- Global $A1_trOUT_NewTristram_AttackArea = 0x316CE
- Global $A1_trOUT_NewTristramOverlook = 0x26186
- Global $A1_trOut_Old_Tristram = 0x163FD
- Global $A1_trOut_Old_Tristram_Road = 0x164BC
- Global $A1_trOut_Old_Tristram_Road_Cath = 0x18BE7
- Global $A1_trOut_OldTristram_Cellar = 0x1A22B
- Global $A1_trOut_OldTristram_Cellar_1 = 0x1A104
- Global $A1_trOut_OldTristram_Cellar_2 = 0x1A105
- Global $A1_trOut_OldTristram_Cellar_3 = 0x19322
- Global $A1_trOut_oldTristram_TreeCave = 0x19C87
- Global $a1_trOut_Scoundrel_Event_Old_Mill_2 = 0x35556
- Global $A1_trOut_TownAttack_ChapelCellar = 0x1D43E
- Global $A1_trOut_Tristram_CainsHouse = 0x1FC73
- Global $A1_trOut_Tristram_Inn = 0x1AB91
- Global $A1_trOut_Tristram_LeahsRoom = 0x15349
- Global $A1_trOut_TristramFields_A = 0x4DF0
- Global $A1_trOut_TristramFields_B = 0x4DF1
- Global $A1_trOut_TristramFields_ExitA = 0xF085
- Global $A1_trOut_TristramFields_Forsaken_Grounds = 0x2BD6F
- Global $A1_trOut_TristramFields_Secluded_Grove = 0x2BD6E
- Global $A1_trOut_TristramWilderness = 0x4DF2
- Global $A1_trOut_TristramWilderness_SubScenes = 0x236AA
- Global $A1_trOut_Vendor_Tinker_Room = 0x19821
- Global $A1_trOut_Wilderness_BurialGrounds = 0x11C08
- Global $A1_trOut_Wilderness_CorpseHouse = 0x30ADF
- Global $A1_trOut_Wilderness_Sub80_FamilyTree = 0x236A1
- Global $A2_Belial_Room_01 = 0xED55
- Global $A2_Belial_Room_Intro = 0x13D1A
- Global $A2_c1Dun_Swr_Caldeum_01 = 0x4D4F
- Global $A2_c2dun_Zolt_TreasureHunter = 0x4D53
- Global $A2_c3Dun_Aqd_Oasis_Level01 = 0xE069
- Global $A2_cadun_Zolt_Timed01_Level01 = 0x4D52
- Global $A2_cadun_Zolt_Timed01_Level02 = 0x29108
- Global $A2_Caldeum = 0x19234
- Global $A2_Caldeum_Uprising = 0x33613
- Global $A2_caOut_Alcarnus_RandomCellar_1 = 0x245A7
- Global $A2_caOut_Alcarnus_RandomCellar_2 = 0x245A8
- Global $A2_caOut_Alcarnus_RandomCellar_3 = 0x245A9
- Global $A2_caOUT_Boneyard_01 = 0xD24A
- Global $A2_caOUT_Borderlands_Khamsin_Mine = 0xEE8A
- Global $A2_caOUT_BorderlandsKhamsin = 0xF8B2
- Global $A2_caOut_Cellar_Alcarnus_Main = 0x2FAC4
- Global $A2_caOut_CT_RefugeeCamp = 0xD811
- Global $A2_caOut_CT_RefugeeCamp_Gates = 0x318FD
- Global $A2_caOut_CT_RefugeeCamp_Hub = 0x2917A
- Global $A2_caOut_Hub_Inn = 0x2AA00
- Global $A2_caOut_Interior_C_DogBite = 0x2D7BB
- Global $A2_caOut_Interior_H_RockWorm = 0x232F5
- Global $A2_caOut_Mine_Abandoned_Cellar = 0x4D81
- Global $A2_caOut_Oasis = 0xE051
- Global $A2_caOut_Oasis_Exit = 0x2ACE2
- Global $A2_caOut_Oasis_Exit_A = 0x2AD07
- Global $A2_caOut_Oasis_Rakanishu = 0x33BDD
- Global $A2_caOut_Oasis_RandomCellar_1 = 0x27099
- Global $A2_caOut_Oasis_RandomCellar_2 = 0x2709A
- Global $A2_caOut_Oasis_RandomCellar_3 = 0x2709B
- Global $A2_caOut_Oasis_RandomCellar_4 = 0x27bE7
- Global $A2_caOut_Oasis1_Water = 0xE664
- Global $A2_caOut_Oasis2 = 0xE058
- Global $A2_caOut_OasisCellars = 0x1B100
- Global $A2_caOUT_StingingWinds = 0x4D7F
- Global $A2_caOUT_StingingWinds_Alcarnus_Tier1 = 0x4D71
- Global $A2_caOUT_StingingWinds_Alcarnus_Tier2 = 0x4D72
- Global $A2_caOUT_StingingWinds_Bridge = 0x29886
- Global $A2_caOUT_StingingWinds_Canyon = 0x4D7C
- Global $A2_caOUT_StingingWinds_FallenCamp01 = 0x288EF
- Global $A2_caOUT_StingingWinds_PostBridge = 0x4D7E
- Global $A2_caOUT_StingingWinds_PreAlcarnus = 0x4D7B
- Global $A2_caOUT_StingingWinds_PreBridge = 0x4D7D
- Global $A2_caOut_Stranded2 = 0x1DA4A
- Global $A2_caOut_ZakarwaMerchantCellar = 0x1BEBB
- Global $A2_Cave_Random01 = 0x26F64
- Global $A2_Cave_Random01_Level02 = 0x35E85
- Global $A2_CultistCellarEast = 0x19218
- Global $A2_CultistCellarWest = 0x19214
- Global $A2_dun_Aqd_Control_A = 0xF9F3
- Global $A2_dun_Aqd_Control_B = 0xF9F4
- Global $A2_dun_Aqd_Oasis_RandomFacePuzzle_Large = 0x26B82
- Global $A2_dun_Aqd_Oasis_RandomFacePuzzle_Small = 0x26AB0
- Global $A2_dun_Aqd_Special_01 = 0xF520
- Global $A2_dun_Aqd_Special_A = 0xF53A
- Global $A2_dun_Aqd_Special_B = 0xF53C
- Global $A2_Dun_Aqd_Swr_to_Oasis_Level01 = 0x23D96
- Global $A2_dun_Cave_BloodVial_01 = 0x31F55
- Global $A2_dun_Cave_BloodVial_02 = 0x31F83
- Global $A2_dun_Oasis_Cave_MapDungeon = 0x29616
- Global $A2_dun_Oasis_Cave_MapDungeon_Level02 = 0x2F6bF
- Global $A2_dun_PortalRoulette_A = 0x1B37F
- Global $A2_Dun_Swr_Adria_Level01 = 0xE47E
- Global $A2_Dun_Swr_Caldeum_Sewers_01 = 0x1B205
- Global $A2_dun_Zolt_Blood02_Level01_Part1 = 0x1E12E
- Global $A2_dun_Zolt_Blood02_Level01_Part2 = 0x25872
- Global $A2_Dun_Zolt_BossFight_Level04 = 0xEB22
- Global $A2_dun_Zolt_Head_Random01 = 0xF0C0
- Global $A2_Dun_Zolt_Level01 = 0x4D55
- Global $A2_Dun_Zolt_Level02 = 0x4D56
- Global $A2_Dun_Zolt_Level03 = 0x4D57
- Global $A2_Dun_Zolt_Lobby = 0x4D58
- Global $A2_Dun_Zolt_LobbyCenter = 0x2AFBA
- Global $A2_Dun_Zolt_Random_Level01 = 0x4D59
- Global $A2_Dun_Zolt_Random_Level02 = 0x36571
- Global $A2_dun_Zolt_Random_PortalRoulette_02 = 0x2FDCF
- Global $A2_Dun_Zolt_ShadowRealm_Level01 = 0x13AD0
- Global $A2_Event_DyingManMine = 0x2270B
- Global $A2_Event_PriceOfMercy_Cellar = 0x2FD9E
- Global $A2_Rockworm_Cellar_Cave = 0x2FE81
- Global $A2_trDun_Boneyard_Spider_Cave_01 = 0x1B437
- Global $A2_trDun_Boneyard_Spider_Cave_02 = 0x35758
- Global $A2_trDun_Boneyard_Worm_Cave_01 = 0x1B433
- Global $A2_trDun_Boneyard_Worm_Cave_02 = 0x35759
- Global $A2_trDun_Cave_Oasis_Random01 = 0xF46F
- Global $A2_trDun_Cave_Oasis_Random01_Level02 = 0x2F6C2
- Global $A2_trDun_Cave_Oasis_Random02 = 0xF46E
- Global $A2_trDun_Cave_Oasis_Random02_Level02 = 0x27551
- Global $a2dun_Aqd_Oasis_Level00 = 0x2F0B6
- Global $a2dun_Aqd_Oasis_Level01 = 0x2F0B1
- Global $A3_AzmodanFight = 0x1B39C
- Global $A3_Battlefield_A = 0x1B7A4
- Global $A3_Battlefield_B = 0x1B7B5
- Global $A3_Battlefield_C = 0x1B7C4
- Global $A3_Bridge_01 = 0x10F80
- Global $A3_Bridge_Choke_A = 0x25DA8
- Global $A3_Dun_Battlefield_Gate = 0x25C14
- Global $A3_dun_Bridge_Interior_Random01 = 0x224ad
- Global $A3_dun_Bridge_Interior_Random02 = 0x32270
- Global $A3_Dun_Crater_Level_01 = 0x15040
- Global $A3_Dun_Crater_Level_02 = 0x1d209
- Global $A3_Dun_Crater_Level_03 = 0x1d20a
- Global $A3_dun_Crater_ST_Level01 = 0x13b97
- Global $A3_dun_Crater_ST_Level01B = 0x1d365
- Global $A3_dun_Crater_ST_Level02 = 0x13b98
- Global $A3_dun_Crater_ST_Level02B = 0x2200a
- Global $A3_dun_Crater_ST_Level04 = 0x14cd2
- Global $A3_dun_Crater_ST_Level04B = 0x1d368
- Global $A3_dun_IceCaves_Random_01 = 0x2e3a1
- Global $A3_dun_IceCaves_Random_01_Level_02 = 0x36206
- Global $A3_dun_IceCaves_Timed_01 = 0x2ea66
- Global $A3_dun_IceCaves_Timed_01_Level_02 = 0x36207
- Global $A3_Dun_Keep_Hub = 0x16b11
- Global $A3_Dun_Keep_Hub_Inn = 0x2d38c
- Global $A3_Dun_Keep_Level03 = 0x126ac
- Global $A3_Dun_Keep_Level04 = 0x16baf
- Global $A3_Dun_Keep_Level05 = 0x21500
- Global $A3_Dun_Keep_Random_01 = 0x2aa4a
- Global $A3_Dun_Keep_Random_01_Level_02 = 0x36238
- Global $A3_Dun_Keep_Random_02 = 0x2c7f2
- Global $A3_Dun_Keep_Random_02_Level_02 = 0x36239
- Global $A3_Dun_Keep_Random_03 = 0x2c802
- Global $A3_Dun_Keep_Random_03_Level_02 = 0x3623a
- Global $A3_Dun_Keep_Random_04 = 0x2c8e6
- Global $A3_Dun_Keep_Random_04_Level_02 = 0x36241
- Global $A3_Dun_Keep_Random_Cellar_01 = 0x35ee9
- Global $A3_Dun_Keep_Random_Cellar_02 = 0x35ee8
- Global $A3_Dun_Keep_Random_Cellar_03 = 0x303f7
- Global $A3_Dun_Keep_TheBreach_Level04 = 0x3558f
- Global $A3_dun_rmpt_Level01 = 0x16b20
- Global $A3_dun_rmpt_Level02 = 0x16bf5
- Global $A3_Gluttony_Boss = 0x1b280
- Global $a3dun_Hub_Adria_Tower = 0x31222
- Global $a3dun_hub_AdriaTower_Intro_01 = 0x3253e
- Global $A4_dun_Diablo_Arena = 0x1abfb
- Global $A4_dun_Diablo_Arena_Phase3 = 0x348c3
- Global $A4_dun_Garden_of_Hope_01 = 0x1abca
- Global $A4_dun_Garden_of_Hope_02 = 0x1abcc
- Global $A4_dun_Garden3_SpireEntrance = 0x1d44a
- Global $A4_dun_Heaven_1000_Monsters_Fight = 0x1aa5d
- Global $A4_dun_Heaven_1000_Monsters_Fight_Entrance = 0x2f169
- Global $A4_dun_Hell_Portal_01 = 0x1abd6
- Global $A4_dun_Hell_Portal_02 = 0x1abdb
- Global $A4_Dun_Keep_Hub = 0x301ed
- Global $A4_dun_LibraryOfFate = 0x23120
- Global $A4_dun_Spire_00 = 0x307a4
- Global $A4_dun_Spire_01 = 0x1abe2
- Global $A4_dun_Spire_02 = 0x1abe4
- Global $A4_dun_Spire_03 = 0x1abe6
- Global $A4_dun_Spire_04 = 0x33728
- Global $A4_dun_Spire_SigilRoom_A = 0x313c4
- Global $A4_dun_Spire_SigilRoom_B = 0x2ae7a
- Global $A4_dun_Spire_SigilRoom_C = 0x313c6
- Global $A4_dun_Spire_SigilRoom_D = 0x313c7
- Global $a4dun_Diablo_ShadowRealm_01 = 0x25845
- Global $a4dun_spire_DiabloEntrance = 0x3227a
- Global $a4dun_spire_exterior = 0x34964
- Global $Axe_Bad_Data = 0x4d60
- Global $PvP_Maze_01 = 0x4da2
- Global $PvP_Octogon_01 = 0x4da3
- Global $PvP_Pillar_01 = 0x4da4
- Global $PvP_Stairs_01 = 0x4da5
- Global $PvP_Test_BlueTeam = 0x4da6
- Global $PvP_Test_Neutral = 0x4da7
- Global $PvP_Test_RedTeam = 0x4da8
- Global $PvPArena = 0x4d9c
- EndFunc
- ;;--------------------------------------------------------------------------------
- ; Function: TownStateCheck()
- ; Description: Check if we are in town or not by comparing distance from stash
- ;
- ;;--------------------------------------------------------------------------------
- Func _intown()
- If $_debug Then _log("-----Checking if In Town------")
- $town = findActor('Player_Shared_Stash', 448)
- If Not @error Then
- ConsoleWrite("We are in town " & $town & @CRLF)
- Return True
- Else
- ConsoleWrite("We are NOT in town " & $town & @CRLF)
- Return False
- EndIf
- EndFunc ;==>_intown
- ;==>TownStateCheck
- ;;--------------------------------------------------------------------------------
- ; Function: IsDeadCheck()
- ; Description: Check if we are Dead or not
- ;
- ;;--------------------------------------------------------------------------------
- Func IsDeadCheck()
- ;If $_debug Then ConsoleWrite("-----Checking if Dead-----" & @CRLF)
- $dead = findActor('PlayerHeadstone', 50)
- If Not @error Then
- ; ConsoleWrite("We are Dead " & $dead & @CRLF)
- Return 0
- Else
- ; ConsoleWrite("We are Alive " & $dead & @CRLF)
- Return 1
- EndIf
- EndFunc ;==>IsDeadCheck
- ;;--------------------------------------------------------------------------------
- ;; Getting Backpack Item Info
- ;;--------------------------------------------------------------------------------
- Func IterateBackpack($bag = 0, $rlvl = 0)
- ;$bag = 0 for backpack and 15 for stash
- ;$rlvl = 1 for actual level requirement of item and 0 for base required level
- $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
- $ptr2 = _memoryread($ptr1 + 0x850, $d3, "ptr")
- $ptr3 = _memoryread($ptr2 + 0x0, $d3, "ptr")
- $_Count = _memoryread($ptr3 + 0x108, $d3, "int")
- $CurrentOffset = _memoryread(_memoryread($ptr3 + 0x148, $d3, "ptr") + 0x0, $d3, "ptr");$_LocalActor_3
- Local $__ACDACTOR[$_Count + 1][9]
- For $i = 0 To $_Count
- $__ACDACTOR[$i][0] = _MemoryRead($CurrentOffset, $d3, 'ptr')
- $__ACDACTOR[$i][1] = _MemoryRead($CurrentOffset + 0x4, $d3, 'char[64]')
- $__ACDACTOR[$i][2] = _MemoryRead($CurrentOffset + 0x114, $d3, 'int')
- $__ACDACTOR[$i][3] = _MemoryRead($CurrentOffset + 0x118, $d3, 'int')
- $__ACDACTOR[$i][4] = _MemoryRead($CurrentOffset + 0x11C, $d3, 'int')
- $__ACDACTOR[$i][5] = 0
- $__ACDACTOR[$i][6] = _MemoryRead($CurrentOffset + $ofs_LocalActor_atribGUID, $d3, 'ptr')
- $__ACDACTOR[$i][7] = $CurrentOffset
- $__ACDACTOR[$i][8] = _MemoryRead($CurrentOffset + 0xB4, $d3, 'int')
- $CurrentOffset = $CurrentOffset + $ofs_LocalActor_StrucSize
- Next
- For $i = $_Count To 0 Step -1
- If $__ACDACTOR[$i][2] <> $bag Then
- _ArrayDelete($__ACDACTOR, $i)
- Else
- $__ACDACTOR[$i][5] = GetPackItemLevel($__ACDACTOR[$i][6], $Atrib_Requirement)
- If $rlvl Then
- $lvlReduce = GetPackItemLevel($__ACDACTOR[$i][6], $Atrib_Item_Level_Requirement_Reduction)
- If $lvlReduce Then $__ACDACTOR[$i][5] = $__ACDACTOR[$i][5] - $lvlReduce
- EndIf
- EndIf
- Next
- Return $__ACDACTOR
- EndFunc ;==>IterateBackpack
- ;;--------------------------------------------------------------------------------
- ; Function: GetPackItemLevel($ACD, $_REQ)
- ;;--------------------------------------------------------------------------------
- Func GetPackItemLevel($ACD, $_REQ)
- ;IterateLocalActor()
- ;$ACDIndex = _ArraySearch($__ACTOR, "0x" & Hex($_guid), 0, 0, 0, 1, 1, 1) ;this bitch is slow as hell
- If $ACD = -1 Then Return False
- $_Count = _MemoryRead($_ActorAtrib_Count, $d3, 'int')
- $CurrentOffset = $_ActorAtrib_4
- Dim $ACTORatrib
- For $i = 0 To $_Count
- $ACTORatrib = _MemoryRead($CurrentOffset, $d3, 'ptr')
- If $ACTORatrib = $ACD Then
- $test = _MemoryRead($CurrentOffset + 0x10, $d3, 'ptr')
- $CurretOffset = $test
- For $i = 0 To 825
- $data = _MemoryRead($CurretOffset, $d3, 'ptr')
- $CurretOffset = $CurretOffset + 0x4
- If $data <> 0x0 Then
- $AtribData = _MemoryRead($data + 0x4, $d3, 'ptr')
- If StringLeft($AtribData, 7) = "0x0003B" Then
- ;ConsoleWrite("Debug :" &$data+0x4 & " : " & _MemoryRead($data+0x4, $d3, 'int') &@crlf) ;FOR DEBUGGING
- If "0x" & StringRight($AtribData, 3) = $_REQ[0] Then
- Return _MemoryRead($data + 0x8, $d3, $_REQ[1])
- EndIf
- EndIf
- If StringLeft($AtribData, 7) = "0xFFFFF" Then
- ;ConsoleWrite("Debug :" &$data+0x4 & " : " & _MemoryRead($data+0x4, $d3, 'int') &@crlf) ;FOR DEBUGGING
- If "0x" & StringRight($AtribData, 3) = $_REQ[0] Then
- Return _MemoryRead($data + 0x8, $d3, $_REQ[1])
- EndIf
- EndIf
- EndIf
- Next
- Return False
- EndIf
- $CurrentOffset = $CurrentOffset + $ofs_ActorAtrib_StrucSize
- Next
- Return False
- EndFunc ;==>GetPackItemLevel
- ;;--------------------------------------------------------------------------------
- ;; Getting Backpack Item Info, extended to show some more info
- ;; $bag = 0 for backpack and 15 for stash
- ;;--------------------------------------------------------------------------------
- Func IterateBackpackExtendedWithLvl($bag = 0)
- $list = IndexSNO($gameBalance)
- $armorOffs = 0
- $weaponOffs = 0
- $otherOffs = 0
- For $j = 0 To UBound($list) - 1
- ;19750 = armor, 19754 = weapon, 1953 = other
- If ($list[$j][1] = 19750) Then
- $armorOffs = $list[$j][0]
- EndIf
- If ($list[$j][1] = 19754) Then
- $weaponOffs = $list[$j][0]
- EndIf
- If ($list[$j][1] = 19753) Then
- $otherOffs = $list[$j][0]
- EndIf
- Next
- Local $armorItems = GetLevels($armorOffs)
- Local $weaponItems = GetLevels($weaponOffs)
- Local $otherItems = GetLevels($otherOffs)
- Local $data = IterateBackpack($bag)
- Local $armorItemsWithLvl = MapItemWithLvl($data, $armorItems, 8)
- Local $weaponItemsWithLvl = MapItemWithLvl($data, $weaponItems, 8)
- Local $otherItemsWithLvl = MapItemWithLvl($data, $otherItems, 8)
- Local $allItems[UBound($armorItemsWithLvl, 1)][UBound($armorItemsWithLvl, 2)]
- For $i = 0 To UBound($allItems) - 1 Step 1
- If $armorItemsWithLvl[$i][9] <> "" Then
- ;copy from $armorItemsWithLvl to all items
- For $j = 0 To UBound($armorItemsWithLvl, 2) - 1 Step 1
- $allItems[$i][$j] = $armorItemsWithLvl[$i][$j]
- Next
- ElseIf $weaponItemsWithLvl[$i][9] <> "" Then
- ;copy from $weaponItemsWithLvl to all items
- For $j = 0 To UBound($weaponItemsWithLvl, 2) - 1 Step 1
- $allItems[$i][$j] = $weaponItemsWithLvl[$i][$j]
- Next
- ElseIf $otherItemsWithLvl[$i][9] <> "" Then
- ;copy from $otherItemsWithLvl to all items
- For $j = 0 To UBound($otherItemsWithLvl, 2) - 1 Step 1
- $allItems[$i][$j] = $otherItemsWithLvl[$i][$j]
- Next
- EndIf
- Next
- Return $allItems
- EndFunc ;==>IterateBackpackExtendedWithLvl
- ;;--------------------------------------------------------------------------------
- ;; Maps snos containg a lvl to the item with that snoid
- ;;--------------------------------------------------------------------------------
- Func MapItemWithLvl($items, $snowithlvl, $indexForBGID)
- Local $newItems = $items
- ReDim $newItems[UBound($items, 1)][UBound($items, 2) + UBound($snowithlvl, 2) + 9] ;add size for some new variables
- For $i = 0 To UBound($items) - 1 Step 1
- For $j = 0 To UBound($snowithlvl) - 1 Step 1
- If $snowithlvl[$j][0] = $items[$i][$indexForBGID] Then
- $newItems[$i][$indexForBGID + 1] = $snowithlvl[$j][1] ;ilvl
- $newItems[$i][$indexForBGID + 2] = $snowithlvl[$j][2] ;min dmg
- $newItems[$i][$indexForBGID + 3] = $snowithlvl[$j][3] ;;max dmg
- $newItems[$i][$indexForBGID + 4] = $snowithlvl[$j][4] ;;min armor
- $newItems[$i][$indexForBGID + 5] = $snowithlvl[$j][5] ;max armor
- $newItems[$i][$indexForBGID + 6] = $snowithlvl[$j][6] ;min dmg modifier
- $newItems[$i][$indexForBGID + 7] = $snowithlvl[$j][7] ;max dmg modifier
- $newItems[$i][$indexForBGID + 8] = $snowithlvl[$j][8] ;gold
- $newItems[$i][$indexForBGID + 9] = $snowithlvl[$j][9] ;weapon speed
- ;;some extra attributes
- $newItems[$i][$indexForBGID + 10] = IterateActorAtribs($newItems[$i][0], $Atrib_Item_Quality_Level) ;quality lvl
- $newItems[$i][$indexForBGID + 11] = IterateActorAtribs($newItems[$i][0], $Atrib_Strength_Item) ;str
- $newItems[$i][$indexForBGID + 12] = IterateActorAtribs($newItems[$i][0], $Atrib_Vitality_Item) ;vit
- $newItems[$i][$indexForBGID + 12] = IterateActorAtribs($newItems[$i][0], $Atrib_Intelligence_Item) ;int
- $newItems[$i][$indexForBGID + 13] = IterateActorAtribs($newItems[$i][0], $Atrib_Dexterity_Item) ;dex
- $newItems[$i][$indexForBGID + 15] = IterateActorAtribs($newItems[$i][0], $Atrib_Resistance_All) ;all res
- $newItems[$i][$indexForBGID + 16] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Gold_Find) * 100) ;gf in %
- $newItems[$i][$indexForBGID + 17] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Magic_Find) * 100) ;mf in %
- $newItems[$i][$indexForBGID + 18] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Hitpoints_Max_Percent_Bonus_Item) * 100) ;life %
- $newItems[$i][$indexForBGID + 19] = _MemoryRead($newItems[$i][7] + 0x164, $d3, 'int') > 0 ;0ffset + 164 ;true=unid, false=identified
- ExitLoop
- EndIf
- Next
- Next
- Return $newItems
- EndFunc ;==>MapItemWithLvl
- ;;--------------------------------------------------------------------------------
- ;; Gets levels from Gamebalance file, returns a list with snoid and lvl
- ;;--------------------------------------------------------------------------------
- Func GetLevels($offset)
- If $offset <> 0 Then
- $ofs = $offset + 0x218;
- $read = _MemoryRead($ofs, $d3, 'int')
- While $read = 0
- $ofs += 0x4
- $read = _MemoryRead($ofs, $d3, 'int')
- WEnd
- $size = _MemoryRead($ofs + 0x4, $d3, 'int')
- $size -= 0x5F0
- $ofs = $offset + _MemoryRead($ofs, $d3, 'int')
- $nr = $size / 0x5F0
- Local $snoItems[$nr + 1][10]
- $j = 0
- For $i = 0 To $size Step 0x5F0
- $ofs_address = $ofs + $i
- $snoItems[$j][0] = _MemoryRead($ofs_address, $d3, 'ptr')
- $snoItems[$j][1] = _MemoryRead($ofs_address + 0x114, $d3, 'int') ;lvl
- $snoItems[$j][2] = _MemoryRead($ofs_address + 0x1C8, $d3, 'float') ;min dmg
- $snoItems[$j][3] = $snoItems[$j][2] + _MemoryRead($ofs_address + 0x1CC, $d3, 'float') ;max dmg
- $snoItems[$j][4] = _MemoryRead($ofs_address + 0x224, $d3, 'float') ;min armor
- $snoItems[$j][5] = $snoItems[$j][4] + _MemoryRead($ofs_address + 0x228, $d3, 'float') ;max armor
- $snoItems[$j][6] = _MemoryRead($ofs_address + 0x32C, $d3, 'float') ;min dmg modifier
- $snoItems[$j][7] = $snoItems[$j][4] + _MemoryRead($ofs_address + 0x330, $d3, 'float') ;max dmg modifier
- $snoItems[$j][8] = _MemoryRead($ofs_address + 0x12C, $d3, 'int') ;gold price
- $snoItems[$j][9] = _MemoryRead($ofs_address + 0x2D4, $d3, 'float') ;wpn speed
- $j += 1
- Next
- EndIf
- Return $snoItems
- EndFunc ;==>GetLevels
- ;;================================================================================
- ; Function: ReturnAllActorAtribs($_GUID)
- ; Description: Read the requested attribute data from a actor defined by GUID
- ; Parameter(s): $_GUID - The GUID of the object you want the data from
- ;==================================================================================
- Func ReturnAllActorAtribs($_GUID)
- Local $index, $offset, $count, $item[4]
- startIterateLocalActor($index, $offset, $count)
- While iterateLocalActorList($index, $offset, $count, $item)
- ; $item[0] ; $_ACTOR_ATRIB_GUID
- ; $item[1] ; $_ACTOR_ATRIB_DATA
- ; $item[2] ; $_ACTOR_ATRIB
- ; $item[3] ; Item Offset
- If ($item[0] = ("0x" & Hex($_GUID))) Then ; we are the correct GUID
- $_Count = _MemoryRead($_ActorAtrib_Count, $d3, 'int')
- $CurrentOffset = $_ActorAtrib_4
- Local $ACTORatrib
- Local $ACTOR[20][2] ;20 should be enought
- Local $j = 0
- For $i = 0 To $_Count
- $ACTORatrib = _MemoryRead($CurrentOffset, $d3, 'ptr')
- If $ACTORatrib = $item[2] Then
- $CurretOffset = _MemoryRead($CurrentOffset + 0x10, $d3, 'ptr')
- For $i = 0 To 825
- $data = _MemoryRead($CurretOffset, $d3, 'ptr')
- $CurretOffset = $CurretOffset + 0x4
- If $data <> 0x0 Then
- $AtribData = _MemoryRead($data + 0x4, $d3, 'ptr')
- If StringLeft($AtribData, 7) = "0xFFFFF" Then
- ;ConsoleWrite("Debug :" & $data + 0x4 & " : " & _MemoryRead($data + 0x4, $d3, 'ptr') & @CRLF) ;FOR DEBUGGING
- $ACTOR[$j][0] = "0x" & StringRight($AtribData, 3)
- $ACTOR[$j][1] = $data
- $j += 1
- If $j = UBound($ACTOR) Then
- ReDim $ACTOR[$j * 2][2]
- EndIf
- EndIf
- EndIf
- Next
- Return $ACTOR
- EndIf
- $CurrentOffset = $CurrentOffset + $ofs_ActorAtrib_StrucSize
- Next
- EndIf
- ;ExitLoop
- WEnd
- Return False
- EndFunc ;==>ReturnAllActorAtribs
- ;;================================================================================
- ; Function: SearchAttrib
- ;==================================================================================
- Func SearchAttrib($ACTOR, $_REQ)
- $iMax = UBound($ACTOR)
- For $i = 0 To $iMax - 1
- If $ACTOR[$i][0] <> "" And $ACTOR[$i][0] = $_REQ[0] Then
- Return _MemoryRead($ACTOR[$i][1] + 0x8, $d3, $_REQ[1])
- EndIf
- Next
- Return False
- EndFunc ;==>SearchAttrib
- Func FilterBackpack()
- Local $__ACDACTOR = IterateBackpack(0)
- Local $iMax = UBound($__ACDACTOR)
- If $iMax > 0 Then
- Local $return[$iMax][3]
- For $i = 0 To $iMax - 1
- ; Loop each item in the backpack
- If _MemoryRead($__ACDACTOR[$i][7] + 0x164, $d3, 'int') > 0 Then
- ; this item is unid, let's identify it
- Send("{SPACE}") ; make sure we close everything
- Send("i") ; open the inventory
- InventoryMove($__ACDACTOR[$i][3], $__ACDACTOR[$i][4])
- Sleep(Random(500, 1000))
- MouseClick("Right")
- Sleep(Random(3000, 3500))
- Send("{SPACE}") ; make sure we close everything
- EndIf
- $itemDestination = CheckItem($__ACDACTOR[$i][0], $__ACDACTOR[$i][1])
- $return[$i][0] = $__ACDACTOR[$i][3] ;col
- $return[$i][1] = $__ACDACTOR[$i][4] ;row
- $return[$i][2] = $itemDestination ;row
- Next
- Return $return
- EndIf
- Return False
- ; After using this function, you can loop the return array and make inventorymove
- ; InventoryMove($return[$i][0], $return[$i][1])
- EndFunc ;==>FilterBackpack
- ;;================================================================================
- ; Function: CheckItem
- ; Description: This will check a single item and tell if we keep it or not
- ; This function will be the core of the item filtering
- ;
- ; Return: Trash
- ; Stash
- ; Salvage
- ; Inventory
- ;==================================================================================
- Func CheckItem($_GUID, $_NAME)
- If checkFromGrabList($Potions, $_NAME) Then
- _log($_NAME & " ==> It's a pot")
- Return "Inventory"
- ElseIf checkFromGrabList($grabList, $_NAME) Then
- _log($_NAME & " ==> It's in the grablist")
- Return "Stash"
- ElseIf (IterateActorAtribs($_GUID, $Atrib_Item_Quality_Level) >= $QualityLevel) Then ; filter the magic and higher
- _log($_NAME & " ==> It's the quality level wich is set to " & $QualityLevel )
- Return "Stash"
- ElseIf (IterateActorAtribs($_GUID, $Atrib_Item_Quality_Level) >= 6) and checkFromRareList($rareList, $_NAME) Then ; filter the magic and higher
- _log($_NAME & " ==> It's a rare in our list" & $QualityLevel )
- Return "Stash"
- EndIf
- Return "Trash"
- EndFunc ;==>CheckItem
- Func InventoryMove($col = 0, $row = 0)
- $Coords = UiRatio(530 + ($col * 27), 338 + ($row * 27))
- MouseMove($Coords[0], $Coords[1], 5)
- EndFunc ;==>InventoryMove
- ;;--------------------------------------------------------------------------------
- ;; Stop()
- ;;--------------------------------------------------------------------------------
- Func Stop()
- Exit
- EndFunc ;==>Stop
- ;;================================================================================
- ; Function: LocateMyToon
- ; Note(s): This function is used by the OffsetList to
- ; get the current player data.
- ;==================================================================================
- Func LocateMyToon()
- _ingame()
- If $_debug Then ConsoleWrite("-----Looking for local player------" & @CRLF)
- $_CurOffset = $_itrObjectManagerD
- $_Count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
- For $i = 0 To $_Count Step +1
- $_GUID = _MemoryRead($_CurOffset + 0x4, $d3, 'ptr')
- $_NAME = _MemoryRead($_CurOffset + 0x8, $d3, 'char[64]')
- ;ConsoleWrite("Value : " & $_NAME & @CRLF)
- ;_log($_NAME)
- If $_GUID = 0x77BC0000 Then
- Global $_Myoffset = $_CurOffset
- If $_debug Then ConsoleWrite("My toon located at: " & $_Myoffset & ", GUID: " & $_GUID & ", NAME: " & $_NAME & @CRLF)
- Return True
- ExitLoop
- EndIf
- $_CurOffset = $_CurOffset + $_ObjmanagerStrucSize
- Next
- Return False
- EndFunc ;==>LocateMyToon
- ;;================================================================================
- ; Function: IterateLocalActor
- ; Note(s): Iterates through all the local actors.
- ; Used by IterateActorAtribs
- ; This is bad use of variables, should be fixed!
- ;==================================================================================
- Func IterateLocalActor()
- ;$_Count = _MemoryRead($_LocalActor_Count, $d3, 'int')
- $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
- $ptr2 = _memoryread($ptr1 + 0x850, $d3, "ptr")
- $ptr3 = _memoryread($ptr2 + 0x0, $d3, "ptr")
- $_Count = _memoryread($ptr3 + 0x108, $d3, "int")
- $CurrentOffset = _memoryread(_memoryread($ptr3 + 0x148, $d3, "ptr") + 0x0, $d3, "ptr");$_LocalActor_3
- Global $__ACTOR[$_Count + 1][4]
- For $i = 0 To $_Count
- $__ACTOR[$i][1] = _MemoryRead($CurrentOffset, $d3, 'ptr')
- $__ACTOR[$i][2] = _MemoryRead($CurrentOffset + 0x4, $d3, 'char[64]')
- $__ACTOR[$i][3] = _MemoryRead($CurrentOffset + $ofs_LocalActor_atribGUID, $d3, 'ptr')
- ;_log($__ACTOR[$i][1] & " : " & $__ACTOR[$i][2] & " : " & $__ACTOR[$i][3])
- $CurrentOffset = $CurrentOffset + $ofs_LocalActor_StrucSize
- Next
- EndFunc ;==>IterateLocalActor
- Func startIterateLocalActor(ByRef $index, ByRef $offset, ByRef $count)
- $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
- $ptr2 = _memoryread($ptr1 + $ofs__ObjmanagerActorOffsetA, $d3, "ptr")
- $count = _memoryread($ptr2 + $ofs_LocalActor_Count, $d3, "int")
- $index = 0
- $offset = _memoryread(_memoryread($ptr2 + 0x148, $d3, "ptr") + 0x0, $d3, "ptr");$_LocalActor_3
- EndFunc ;==>startIterateLocalActor
- Func iterateLocalActorList(ByRef $index, ByRef $offset, ByRef $count, ByRef $item)
- While 1
- If $index > $count Then Return False
- $index += 1
- $item[0] = _MemoryRead($offset, $d3, 'ptr') ; $_ACTOR_ATRIB_GUID
- $item[1] = _MemoryRead($offset + 0x4, $d3, 'char[64]') ; $_ACTOR_ATRIB_DATA
- $item[2] = _MemoryRead($offset + $ofs_LocalActor_atribGUID, $d3, 'ptr') ; $_ACTOR_ATRIB
- $item[3] = $offset ; Item Offset
- $offset = $offset + $ofs_LocalActor_StrucSize
- Return True
- WEnd
- EndFunc ;==>iterateLocalActorList
- ;;================================================================================
- ; Function: IterateActorAtribs($_GUID,$_REQ)
- ; Description: Read the requested attribute data from a actor defined by GUID
- ; Parameter(s): $_GUID - The GUID of the object you want the data from
- ; $_REQ - The data you want to request (the variable)
- ;
- ; Note(s): You can find a list of all the $_REQ variables in the Constants() function
- ; It should be noted that i have not checked them all through
- ; so the type ("float" or "int") might be wrong.
- ; This function will always return "false" if the requested atribute does not exsist
- ;==================================================================================
- Func IterateActorAtribs($_GUID, $_REQ)
- IterateLocalActor()
- $ACDIndex = _ArraySearch($__ACTOR, "0x" & Hex($_GUID), 0, 0, 0, 1, 1, 1) ;this bitch is slow as hell
- If $ACDIndex = -1 Then Return False ;FIX
- If $_REQ[1] = 'float' Then
- Return $AttribInterop.GetAttributeFloat($__ACTOR[$ACDIndex][3], $_REQ[0])
- Else
- Return $AttribInterop.GetAttributeInt($__ACTOR[$ACDIndex][3], $_REQ[0])
- EndIf
- Return False
- EndFunc ;==>IterateActorAtribs
- ;;================================================================================
- ; Function: LinkActors
- ; Description: Read and index data from the specified offset
- ; Parameter(s): $_offset - The offset linking to the file def
- ; be in hex format (0x00000000).
- ; $_displayInfo - Setting this to 1 will make the function spit
- ; out the results while running
- ; Note(s): This function is used to index data from the MPQ files that
- ; that have been loaded into memory.
- ; Im not sure why the count doesnt go beyond 256.
- ; So for the time being if the count goes beyond 256 the size
- ; is set to a specified count and then the array will be scaled
- ; after when data will stop being available.
- ;==================================================================================
- Func LinkActors($OBject, $_displayInfo = 0)
- Global $OBject_Mem_Actor = $OBject
- Global $Object_File_Actor = IndexSNO($ofs_ActorDef, 0)
- Global $Object_File_Monster = IndexSNO($ofs_MonsterDef, 0)
- Dim $__outputdata[UBound($OBject_Mem_Actor, 1) - 1][2]
- For $i = 0 To UBound($OBject_Mem_Actor, 1) - 1
- If $OBject_Mem_Actor[$i][9] <> -1 Then
- $ItemIndex = _ArraySearch($Object_File_Actor, $OBject_Mem_Actor[$i][9], 0, 0, 0, 1, 1, 1)
- If $ItemIndex > 0 Then
- $MonsterID = _MemoryRead($Object_File_Actor[$ItemIndex][0] + 0x6c, $d3, 'ptr')
- $ItemIndex = _ArraySearch($Object_File_Monster, $MonsterID, 0, 0, 0, 1, 1, 1)
- If $ItemIndex > 0 Then
- $Type = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_MonsterType, $d3, 'int')
- $MonsterType = $_Const_MonsterType[$Type + 1]
- $Race = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_MonsterRace, $d3, 'int')
- $MonsterRace = $_Const_MonsterRace[$Race + 1]
- $LevelNormal = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_LevelNormal, $d3, 'int') ;//Here are some data you can use if you want,
- $LevelNightmare = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_LevelNightmare, $d3, 'int') ;//...it gives info about levels based on dificulty
- $LevelHell = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_LevelHell, $d3, 'int')
- $LevelInferno = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_LevelInferno, $d3, 'int')
- $OBject_Mem_Actor[$i][11] = $Type
- $OBject_Mem_Actor[$i][12] = $Race
- ;if $_displayInfo = 1 Then ConsoleWrite($i & " " & $Object_File_Actor[$ItemIndex][0] & @tab & " " &$MonsterType &@tab & " " & $MonsterRace &@tab & " Level Normal:" & $LevelNormal &@tab & " " & $StringListDB[$Name][1] &" " & @TAB &$OBject_Mem_Actor[$i][2] &@crlf)
- EndIf
- EndIf
- EndIf
- Next
- Return $OBject_Mem_Actor
- EndFunc ;==>LinkActors
- ;;================================================================================
- ; Function: IndexSNO($_offset[,$_displayInfo = 0])
- ; Description: Read and index data from the specified offset
- ; Parameter(s): $_offset - The offset linking to the file def
- ; be in hex format (0x00000000).
- ; $_displayInfo - Setting this to 1 will make the function spit
- ; out the results while running
- ; Note(s): This function is used to index data from the MPQ files that
- ; that have been loaded into memory.
- ; Im not sure why the count doesnt go beyond 256.
- ; So for the time being if the count goes beyond 256 the size
- ; is set to a specified count and then the array will be scaled
- ; after when data will stop being available.
- ;==================================================================================
- Func IndexSNO($_offset, $_displayInfo = 0)
- Local $CurrentSnoOffset = 0x0
- $_MainOffset = _MemoryRead($_offset, $d3, 'ptr')
- $_Pointer = _MemoryRead($_MainOffset + $_defptr, $d3, 'ptr')
- $_SnoCount = _MemoryRead($_Pointer + $_defcount, $d3, 'ptr') ;//Doesnt seem to go beyond 256 for some wierd reason
- If $_SnoCount >= 256 Then ;//So incase it goes beyond...
- $ignoreSNOcount = 1 ;//This enables a redim after the for loop
- $_SnoCount = 4056 ;//We put a limit to avoid overflow here
- Else
- $ignoreSNOcount = 0
- EndIf
- $_SnoIndex = _MemoryRead($_Pointer + $_deflink, $d3, 'ptr') ;//Moving from the static into the index
- $_SNOName = _MemoryRead($_Pointer, $d3, 'char[64]') ;//Usually something like "Something" + Def
- $TempWindex = $_SnoIndex + 0xC ;//The header is 0xC in size
- If $_displayInfo = 1 Then ConsoleWrite("-----* Indexing " & $_SNOName & " *-----" & @CRLF)
- Dim $_OutPut[$_SnoCount + 1][2] ;//Setting the size of the output array
- For $i = 1 To $_SnoCount Step +1 ;//Iterating through all the elements
- $_CurSnoOffset = _MemoryRead($TempWindex, $d3, 'ptr') ;//Getting the offset for the item
- $_CurSnoID = _MemoryRead($_CurSnoOffset, $d3, 'ptr') ;//Going into the item and grapping the GUID which is located at 0x0
- If $ignoreSNOcount = 1 And $_CurSnoOffset = 0x00000000 And $_CurSnoID = 0x00000000 Then ExitLoop ;//Untill i find a way to get the real count we do this instead.
- If $ignoreSNOcount = 1 Then $CurIndex = $i
- $_OutPut[$i][0] = $_CurSnoOffset ;//Poping the data into the output array
- $_OutPut[$i][1] = $_CurSnoID
- If $_displayInfo = 1 Then ConsoleWrite($i & " Offset: " & $_CurSnoOffset & " SNOid: " & $_CurSnoID & @CRLF)
- $TempWindex = $TempWindex + 0x10 ;//Next item is located 0x10 later
- Next
- If $ignoreSNOcount = 1 Then ReDim $_OutPut[$CurIndex][2] ;//Here we do the resizing of the array, to minimize memory footprint!?.
- Return $_OutPut
- EndFunc ;==>IndexSNO
- ;;================================================================================
- ; Function: IndexStringList($_offset)
- ; Description: Read and index data from the specified offset
- ; Parameter(s): $_offset - The offset linking to the file def
- ; be in hex format (0x00000000).
- ; $_displayInfo - Setting this to 1 will make the function spit
- ; out the results while running
- ;
- ; Note(s): This function is made specificly to index string lists.
- ; This is usefull for getting real localized names from the
- ; proxy names you get from the objectmanager strucs.
- ; i have only test this on monster names but it should work for all.
- ;==================================================================================
- Func IndexStringList($_offset, $_displayInfo = 0)
- $_offset_FileMonster_StrucSize = 0x50
- $_StringCount = _MemoryRead($_offset + 0xc, $d3, 'int')
- $_CurrentOffset = $_offset + 0x28
- Dim $_OutPut[$_StringCount][2]
- For $i = 0 To $_StringCount - 1
- $_OutPut[$i][0] = _MemoryRead(_MemoryRead($_CurrentOffset, $d3, 'int'), $d3, 'char[32]') ;Proxy Name, like "Priest_Male_B_NoLook"
- $_OutPut[$i][1] = _MemoryRead(_MemoryRead($_CurrentOffset + 0x10, $d3, 'int'), $d3, 'char[34]') ;Localized name, like "Brother Malachi the Healer"
- Assign("__" & $_OutPut[$i][0], $_OutPut[$i][1], 2)
- $_CurrentOffset = $_CurrentOffset + $_offset_FileMonster_StrucSize
- If $_displayInfo = 1 Then ConsoleWrite($_CurrentOffset & " ProxyName: " & $_OutPut[$i][0] & @TAB & " LocalizedName: " & $_OutPut[$i][1] & @CRLF)
- Next
- Return $_OutPut
- EndFunc ;==>IndexStringList
- ;;--------------------------------------------------------------------------------
- ;; OffsetList()
- ;;--------------------------------------------------------------------------------
- Func offsetlist()
- ;//FILE DEFS
- Global $ofs_MonsterDef = 0x15DBE00 ;0x015DCE00 ;0x15DBE00
- Global $ofs_StringListDef = 0x0158C240 ;0x015E8808 ;0x015E9808
- Global $ofs_ActorDef = 0x15EC108 ;0x015ED108 ;0x15EC108
- Global $_defptr = 0x3c
- Global $_defcount = 0x10C
- Global $_deflink = 0x148
- Global $_ofs_FileMonster_StrucSize = 0x50
- Global $_ofs_FileActor_LinkToMonster = 0x6C
- Global $_ofs_FileMonster_MonsterType = 0x18
- Global $_ofs_FileMonster_MonsterRace = 0x1C
- Global $_ofs_FileMonster_LevelNormal = 0x44
- Global $_ofs_FileMonster_LevelNightmare = 0x48
- Global $_ofs_FileMonster_LevelHell = 0x4c
- Global $_ofs_FileMonster_LevelInferno = 0x50
- ;//GET ACTORATRIB
- Global $ofs_ActorAtrib_Base = 0x1544E54 ;0x15A1EA4 ;0x015A2EA4;0x015A1EA4
- Global $ofs_ActorAtrib_ofs1 = 0x390
- Global $ofs_ActorAtrib_ofs2 = 0x2E8
- Global $ofs_ActorAtrib_ofs3 = 0x148
- Global $ofs_ActorAtrib_Count = 0x108 ; 0x0 0x0
- Global $ofs_ActorAtrib_Indexing_ofs1 = 0x10
- Global $ofs_ActorAtrib_Indexing_ofs2 = 0x8
- Global $ofs_ActorAtrib_Indexing_ofs3 = 0x250
- Global $ofs_ActorAtrib_StrucSize = 0x180
- Global $ofs_LocalPlayer_HPBARB = 0x34
- Global $ofs_LocalPlayer_HPWIZ = 0x38
- ;//GET LOCAL ACTOR STRUC
- Global $ofs_LocalActor_ofs1 = 0x378 ;instead of $ofs_ActorAtrib_ofs2
- Global $ofs_LocalActor_ofs2 = 0x148
- Global $ofs_LocalActor_Count = 0x108
- Global $ofs_LocalActor_atribGUID = 0x120
- Global $ofs_LocalActor_StrucSize = 0x2D0 ; 0x0 0x0
- ;//OBJECT MANAGER
- Global $ofs_objectmanager = 0x1543B9C ;0x15A0BEC ;0x015A1BEC;0x15A0BEC
- Global $ofs__ObjmanagerActorOffsetA = 0x8b0
- Global $ofs__ObjmanagerActorCount = 0x108
- Global $ofs__ObjmanagerActorOffsetB = 0x148
- Global $ofs__ObjmanagerActorLinkToCTM = 0x380
- Global $_ObjmanagerStrucSize = 0x428
- ;//CameraDef
- Global $VIewStatic = 0x015A0BEC
- Global $DebugFlags = $VIewStatic + 0x20
- Global $vftableSubA = _MemoryRead($VIewStatic, $d3, 'ptr')
- Global $vftableSubA = _MemoryRead($vftableSubA + 0x928, $d3, 'ptr')
- Global $ViewOffset = $vftableSubA
- Global $Ofs_CameraRotationA = $ViewOffset + 0x4
- Global $Ofs_CameraRotationB = $ViewOffset + 0x8
- Global $Ofs_CameraRotationC = $ViewOffset + 0xC
- Global $Ofs_CameraRotationD = $ViewOffset + 0x10
- Global $Ofs_CameraPosX = $ViewOffset + 0x14
- Global $Ofs_CameraPosY = $ViewOffset + 0x18
- Global $Ofs_CameraPosZ = $ViewOffset + 0x1C
- Global $Ofs_CameraFOV = $ViewOffset + 0x30
- Global $Ofs_CameraFOVB = $ViewOffset + 0x30
- Global $ofs_InteractBase = 0x1543B84 ;0x15A0BD4 ;0x015A1BD4;0x15A0BD4
- Global $ofs__InteractOffsetA = 0xA8
- Global $ofs__InteractOffsetB = 0x58
- Global $ofs__InteractOffsetUNK1 = 0x7F20 ;Set to 777c
- Global $ofs__InteractOffsetUNK2 = 0x7F44 ;Set to 1 for NPC interaction
- Global $ofs__InteractOffsetUNK3 = 0x7F7C ;Set to 7546 for NPC interaction, 7545 for loot interaction
- Global $ofs__InteractOffsetUNK4 = 0x7F80 ;Set to 7546 for NPC interaction, 7545 for loot interaction
- Global $ofs__InteractOffsetMousestate = 0x7F84 ;Mouse state 1 = clicked, 2 = mouse down
- Global $ofs__InteractOffsetGUID = 0x7F88 ;Set to the GUID of the actor you want to interact with
- $FixSpeed = 0x20 ;69736
- $ToggleMove = 0x34
- $MoveToXoffset = 0x40
- $MoveToYoffset = 0x44
- $MoveToZoffset = 0x48
- $CurrentX = 0xA8
- $CurrentY = 0xAc
- $CurrentZ = 0xb0
- $RotationOffset = 0x174
- Global $_ActorAtrib_Base = _MemoryRead($ofs_ActorAtrib_Base, $d3, 'ptr')
- Global $_ActorAtrib_1 = _MemoryRead($_ActorAtrib_Base + $ofs_ActorAtrib_ofs1, $d3, 'ptr')
- Global $_ActorAtrib_2 = _MemoryRead($_ActorAtrib_1 + $ofs_ActorAtrib_ofs2, $d3, 'ptr')
- Global $_ActorAtrib_3 = _MemoryRead($_ActorAtrib_2 + $ofs_ActorAtrib_ofs3, $d3, 'ptr')
- Global $_ActorAtrib_4 = _MemoryRead($_ActorAtrib_3, $d3, 'ptr')
- Global $_ActorAtrib_Count = $_ActorAtrib_2 + $ofs_ActorAtrib_Count
- Global $_LocalActor_1 = _MemoryRead($_ActorAtrib_1 + $ofs_LocalActor_ofs1, $d3, 'ptr')
- Global $_LocalActor_2 = _MemoryRead($_LocalActor_1 + $ofs_LocalActor_ofs2, $d3, 'ptr')
- Global $_LocalActor_3 = _MemoryRead($_LocalActor_2, $d3, 'ptr')
- Global $_LocalActor_Count = $_LocalActor_1 + $ofs_LocalActor_Count
- Global $_itrObjectManagerA = _MemoryRead($ofs_objectmanager, $d3, 'ptr')
- Global $_itrObjectManagerB = _MemoryRead($_itrObjectManagerA + $ofs__ObjmanagerActorOffsetA, $d3, 'ptr')
- Global $_itrObjectManagerCount = $_itrObjectManagerB + $ofs__ObjmanagerActorCount
- Global $_itrObjectManagerC = _MemoryRead($_itrObjectManagerB + $ofs__ObjmanagerActorOffsetB, $d3, 'ptr')
- Global $_itrObjectManagerD = _MemoryRead($_itrObjectManagerC, $d3, 'ptr')
- Global $_itrObjectManagerE = _MemoryRead($_itrObjectManagerD, $d3, 'ptr')
- Global $_itrInteractA = _MemoryRead($ofs_InteractBase, $d3, 'ptr')
- Global $_itrInteractB = _MemoryRead($_itrInteractA, $d3, 'ptr')
- Global $_itrInteractC = _MemoryRead($_itrInteractB, $d3, 'ptr')
- Global $_itrInteractD = _MemoryRead($_itrInteractC + $ofs__InteractOffsetA, $d3, 'ptr')
- Global $_itrInteractE = $_itrInteractD + $ofs__InteractOffsetB
- ;IterateObjectList(0)
- Global $Object_File_StringList = IndexSNO($ofs_StringListDef, 0) ;//THIS LIST IS HUGE, NO NEED TO DO IT MORE OFTEN THAN ONCE =)
- $index = _ArraySearch($Object_File_StringList, Hex($_MonsterNameStringListID), 0, 0, 0, 1, 1, 1)
- If $index = -1 Then
- Return False
- EndIf
- Global $StringListDB = IndexStringList($Object_File_StringList[$index][0]) ;$StringListDB is debricated in this code
- $index = _ArraySearch($Object_File_StringList, Hex($_GizmoNameStringListID), 0, 0, 0, 1, 1, 1)
- If $index > -1 Then
- IndexStringList($Object_File_StringList[$index][0])
- EndIf
- If LocateMyToon() Then
- Global $ClickToMoveMain = _MemoryRead($_Myoffset + $ofs__ObjmanagerActorLinkToCTM, $d3, 'ptr')
- Global $ClickToMoveRotation = $ClickToMoveMain + $RotationOffset
- Global $ClickToMoveCurX = $ClickToMoveMain + $CurrentX
- Global $ClickToMoveCurY = $ClickToMoveMain + $CurrentY
- Global $ClickToMoveCurZ = $ClickToMoveMain + $CurrentZ
- Global $ClickToMoveToX = $ClickToMoveMain + $MoveToXoffset
- Global $ClickToMoveToY = $ClickToMoveMain + $MoveToYoffset
- Global $ClickToMoveToZ = $ClickToMoveMain + $MoveToZoffset
- Global $ClickToMoveToggle = $ClickToMoveMain + $ToggleMove
- Global $ClickToMoveFix = $ClickToMoveMain + $FixSpeed
- Return True
- Else
- Return False
- EndIf
- EndFunc ;==>offsetlist
- ;;--------------------------------------------------------------------------------
- ;; IterateAllObjectList()
- ;; Description: Iterate object even if they dont have guid, also provide true names
- ;;--------------------------------------------------------------------------------
- Func IterateAllObjectList($_displayInfo)
- If $_displayInfo = 1 Then ConsoleWrite("-----Iterating through Actors------" & @CRLF)
- If $_displayInfo = 1 Then ConsoleWrite("First Actor located at: " & $_itrObjectManagerD & @CRLF)
- $_CurOffset = $_itrObjectManagerD
- $_Count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
- Dim $OBJ[$_Count + 1][10]
- If $_displayInfo = 1 Then ConsoleWrite("Number of Actors : " & $_Count & @CRLF)
- For $i = 0 To $_Count Step +1
- $_GUID = _MemoryRead($_CurOffset + 0x4, $d3, 'ptr')
- $_NAME = _MemoryRead($_CurOffset + 0x8, $d3, 'char[64]')
- $_POS_X = _MemoryRead($_CurOffset + 0xB0, $d3, 'float')
- $_POS_Y = _MemoryRead($_CurOffset + 0xB4, $d3, 'float')
- $_POS_Z = _MemoryRead($_CurOffset + 0xB8, $d3, 'float')
- $_DATA = _MemoryRead($_CurOffset + 0x1FC, $d3, 'int')
- $_DATA2 = _MemoryRead($_CurOffset + 0x1Cc, $d3, 'int')
- $_DATA3 = _MemoryRead($_CurOffset + 0x1C0, $d3, 'int')
- $CurrentLoc = GetCurrentPos()
- $xd = $_POS_X - $CurrentLoc[0]
- $yd = $_POS_Y - $CurrentLoc[1]
- $zd = $_POS_Z - $CurrentLoc[2]
- $Distance = Sqrt($xd * $xd + $yd * $yd + $zd * $zd)
- $OBJ[$i][0] = $i
- $OBJ[$i][1] = $_GUID
- $OBJ[$i][2] = $_NAME
- $OBJ[$i][3] = $_POS_X
- $OBJ[$i][4] = $_POS_Y
- $OBJ[$i][5] = $_POS_Z
- $OBJ[$i][6] = $_DATA
- $OBJ[$i][7] = $_DATA2
- $OBJ[$i][8] = $Distance
- $OBJ[$i][9] = $_CurOffset
- If $_displayInfo = 1 Then ConsoleWrite($i & @TAB & " : " & $_CurOffset & " " & $_GUID & " : " & $_DATA & " " & $_DATA2 & " " & @TAB & $_POS_X & " " & $_POS_Y & " " & $_POS_Z & " Dist: " & $Distance & @TAB & $_NAME & " data3: " & $_DATA3 & @CRLF)
- ;if $_displayINFO = 1 then ConsoleWrite($i & @TAB&" : " & $_POS_X & @TAB& $_POS_Y & @TAB & $_POS_Z & @TAB& $_NAME & @crlf)
- $_CurOffset = $_CurOffset + $_ObjmanagerStrucSize
- Next
- Return $OBJ
- EndFunc ;==>IterateAllObjectList
- ;;--------------------------------------------------------------------------------
- ;; IterateObjectList()
- ;;--------------------------------------------------------------------------------
- Func IterateObjectList($_displayInfo = 0)
- ; Local $mesureobj = TimerInit() ;;;;;;;;;;;;;;
- If $_displayInfo = 1 Then ConsoleWrite("-----Iterating through Actors------" & @CRLF)
- If $_displayInfo = 1 Then ConsoleWrite("First Actor located at: " & $_itrObjectManagerD & @CRLF)
- $_CurOffset = $_itrObjectManagerD
- $_Count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
- Dim $OBJ[$_Count + 1][13]
- If $_displayInfo = 1 Then ConsoleWrite("Number of Actors : " & $_Count & @CRLF)
- ;$init = TimerInit()
- For $i = 0 To $_Count Step +1
- $_GUID = _MemoryRead($_CurOffset + 0x4, $d3, 'ptr')
- If $_GUID = 0xffffffff Then ;no need to go through objects without a GUID!
- $_PROXY_NAME = -1
- $_REAL_NAME = -1
- $_ACTORLINK = -1
- $_POS_X = -1
- $_POS_Y = -1
- $_POS_Z = -1
- $_DATA = -1
- $_DATA2 = -1
- Else
- $_PROXY_NAME = _MemoryRead($_CurOffset + 0x8, $d3, 'char[64]')
- $TmpString = StringSplit($_PROXY_NAME, "-")
- If IsDeclared("__" & $TmpString[1]) Then
- $_REAL_NAME = Eval("__" & $TmpString[1])
- Else
- $_REAL_NAME = $_PROXY_NAME
- EndIf
- $_ACTORLINK = _MemoryRead($_CurOffset + 0x88, $d3, 'ptr')
- $_POS_X = _MemoryRead($_CurOffset + 0xB0, $d3, 'float')
- $_POS_Y = _MemoryRead($_CurOffset + 0xB4, $d3, 'float')
- $_POS_Z = _MemoryRead($_CurOffset + 0xB8, $d3, 'float')
- $_DATA = _MemoryRead($_CurOffset + 0x1FC, $d3, 'int')
- $_DATA2 = _MemoryRead($_CurOffset + 0x1Cc, $d3, 'int')
- If $_displayInfo = 1 Then ConsoleWrite($i & @TAB & " : " & $_CurOffset & " " & $_GUID & " " & $_ACTORLINK & " : " & $_DATA & " " & $_DATA2 & " " & @TAB & $_POS_X & " " & $_POS_Y & " " & $_POS_Z & @TAB & $_REAL_NAME & @CRLF)
- EndIf
- ;Im too lazy to do this but the following code needs cleanup and restructure more than anything.
- ;You want to include all the data into this one structure rather than having it at multiple locations
- ;and the useless things should be removed.
- $CurrentLoc = GetCurrentPos()
- $xd = $_POS_X - $CurrentLoc[0]
- $yd = $_POS_Y - $CurrentLoc[1]
- $zd = $_POS_Z - $CurrentLoc[2]
- $Distance = Sqrt($xd * $xd + $yd * $yd + $zd * $zd)
- $OBJ[$i][0] = $_CurOffset
- $OBJ[$i][1] = $_GUID
- $OBJ[$i][2] = $_PROXY_NAME
- $OBJ[$i][3] = $_POS_X
- $OBJ[$i][4] = $_POS_Y
- $OBJ[$i][5] = $_POS_Z
- $OBJ[$i][6] = $_DATA
- $OBJ[$i][7] = $_DATA2
- $OBJ[$i][8] = $Distance
- $OBJ[$i][9] = $_ACTORLINK
- $OBJ[$i][10] = $_REAL_NAME
- $OBJ[$i][11] = -1
- $OBJ[$i][12] = -1
- $_CurOffset = $_CurOffset + $_ObjmanagerStrucSize
- Next
- $OBJv2 = LinkActors($OBJ) ;//Would be a waste to do this in the main operation so we add more data to the object here after the main operation.
- IterateLocalActor()
- ; Local $difmesureobj = TimerDiff($mesureobj) ;;;;;;;;;;;;;
- ;ConsoleWrite("Mesure iterOBJ :" & $difmesureobj &@crlf) ;FOR DEBUGGING;;;;;;;;;;;;
- Return $OBJv2
- EndFunc ;==>IterateObjectList
- ;;--------------------------------------------------------------------------------
- ;; Function to iterate all objects()
- ;;--------------------------------------------------------------------------------
- Func startIterateObjectsList(ByRef $index, ByRef $offset, ByRef $count)
- $count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
- $index = 0
- $offset = $_itrObjectManagerD
- EndFunc ;==>startIterateObjectsList
- Func iterateObjectsList(ByRef $index, ByRef $offset, ByRef $count, ByRef $item)
- While 1
- If $index > $count Then Return False
- $index += 1
- $item[0] = _MemoryRead($offset + 0x4, $d3, 'ptr') ; GUID
- $item[1] = _MemoryRead($offset + 0x8, $d3, 'char[64]') ; Name
- $item[2] = _MemoryRead($offset + 0xB0, $d3, 'float') ; PosX
- $item[3] = _MemoryRead($offset + 0xB4, $d3, 'float') ; PosY
- $item[4] = _MemoryRead($offset + 0xB8, $d3, 'float') ; PosZ
- $item[5] = _MemoryRead($offset + 0x1FC, $d3, 'int') ; Data1
- $item[6] = _MemoryRead($offset + 0x1CC, $d3, 'int') ; Data2
- $item[7] = _MemoryRead($offset + 0x1C0, $d3, 'int') ; Data3
- $item[8] = $offset ; Current Offset
- $item[9] = getDistance($item[2], $item[3], $item[4]) ; Distance
- $offset = $offset + $_ObjmanagerStrucSize
- Return True
- WEnd
- EndFunc ;==>iterateObjectsList
- ;;--------------------------------------------------------------------------------
- ;; FromD3toScreenCoords()
- ;;--------------------------------------------------------------------------------
- Func FromD3toScreenCoords($_x, $_y, $_z)
- Dim $return[2]
- $size = WinGetClientSize("Diablo III")
- $resolutionX = $size[0]
- $resolutionY = $size[1]
- $aspectChange = ($resolutionX / $resolutionY) / (800 / 600)
- $CurrentLoc = GetCurrentPos()
- $xd = $_x - $CurrentLoc[0]
- $yd = $_y - $CurrentLoc[1]
- $zd = $_z - $CurrentLoc[2]
- $w = -0.515 * $xd + - 0.514 * $yd + - 0.686 * $zd + 97.985
- $X = (-1.682 * $xd + 1.683 * $yd + 0 * $zd + 7.045E-3) / $w
- $Y = (-1.54 * $xd + - 1.539 * $yd + 2.307 * $zd + 6.161) / $w
- $Z = (-0.515 * $xd + - 0.514 * $yd + - 0.686 * $zd + 97.002) / $w
- $X /= $aspectChange
- While Abs($X) >= 1 Or Abs($Y) >= 0.7 Or $Z <= 0
- ; specified point is not on screen
- $xd = $xd / 2
- $yd = $yd / 2
- $zd = $zd / 2
- $w = -0.515 * $xd + - 0.514 * $yd + - 0.686 * $zd + 97.985
- $X = (-1.682 * $xd + 1.683 * $yd + 0 * $zd + 7.045E-3) / $w
- $Y = (-1.54 * $xd + - 1.539 * $yd + 2.307 * $zd + 6.161) / $w
- $Z = (-0.515 * $xd + - 0.514 * $yd + - 0.686 * $zd + 97.002) / $w
- $X /= $aspectChange
- WEnd
- $return[0] = ($X + 1) / 2 * $resolutionX
- $return[1] = (1 - $Y) / 2 * $resolutionY
- Return $return
- EndFunc ;==>FromD3toScreenCoords
- ;;--------------------------------------------------------------------------------
- ;; UiRatio()
- ;;--------------------------------------------------------------------------------
- Func UiRatio($_x, $_y)
- Dim $return[2]
- $size = WinGetClientSize("Diablo III")
- $return[0] = $size[1] * ($_x / 600)
- $return[1] = $size[1] * ($_y / 600)
- Return $return
- EndFunc ;==>UiRatio
- ;;--------------------------------------------------------------------------------
- ;; GetCurrentPos()
- ;;--------------------------------------------------------------------------------
- Func GetCurrentPos()
- ; Local $mesurepos = TimerInit() ;;;;;;;;;;;;;;
- Dim $return[3]
- $return[0] = _MemoryRead($_Myoffset + 0x0A0, $d3, 'float')
- $return[1] = _MemoryRead($_Myoffset + 0x0A4, $d3, 'float')
- $return[2] = _MemoryRead($_Myoffset + 0x0A8, $d3, 'float')
- ; Local $difmesurepos = TimerDiff($mesurepos) ;;;;;;;;;;;;;
- ;ConsoleWrite("Mesure getcurrentpos :" & $difmesurepos &@crlf) ;FOR DEBUGGING;;;;;;;;;;;;
- Return $return
- EndFunc ;==>GetCurrentPos
- ;;--------------------------------------------------------------------------------
- ;; WP handling
- ;;--------------------------------------------------------------------------------
- Func HandlePath($_x, $_y, $_z, $_a, $m_range)
- Local $ToggleCount = 0
- Local $Blocked = 0
- Local $CurrentDistance = 0
- Local $TimeOut = TimerInit()
- While 1
- GameOverTime()
- If $GameOverTime = True Then
- ExitLoop
- EndIf
- $CurrentLoc = GetCurrentPos()
- $xd = $_x - $CurrentLoc[0]
- $yd = $_y - $CurrentLoc[1]
- $zd = $_z - $CurrentLoc[2]
- $Distance = Sqrt($xd * $xd + $yd * $yd + $zd * $zd)
- ; _log( "$Distance < $m_range = " & $Distance < $m_range )
- If $Distance < $m_range Then ExitLoop
- ;_log( "_MemoryRead($ClickToMoveToggle, $d3, 'float') = " & _MemoryRead($ClickToMoveToggle, $d3, 'float') )
- ;;--------------------------------------------------------------------------------;;--------------------------------------------------------------------------------
- ; If _MemoryRead($ClickToMoveToggle, $d3, 'float') = 0 Then
- ; $ToggleCount = $ToggleCount + 1
- ; _log( "_MemoryRead($ClickToMoveToggle, $d3, 'float') = " & _MemoryRead($ClickToMoveToggle, $d3, 'float') )
- ; if $ToggleCount > 1 Then ExitLoop
- ; Endif
- Local $angle = 1
- Local $Radius = 25
- While _MemoryRead($ClickToMoveToggle, $d3, 'float') = 0
- _log( "_MemoryRead($ClickToMoveToggle, $d3, 'float') = " & _MemoryRead($ClickToMoveToggle, $d3, 'float') & " radius:" &$Radius )
- $Coords = FromD3toScreenCoords($_x, $_y, $_z)
- $angle += $Step
- $Radius += 25
- MouseMove($Coords[0] - (Cos($angle) * $Radius), $Coords[1] - (Sin($angle) * $Radius), 3)
- _log( "Tryin move :" & " x:"&$_x &" y:"& $_y& "coords: "& $Coords[0]&"-"&$Coords[1])
- If $angle >= 2 * $PI Then
- ExitLoop 2 ; le 2 signifie que l'on quitte 2 loop
- EndIf
- sleep(15)
- WEnd
- ;;--------------------------------------------------------------------------------;;--------------------------------------------------------------------------------
- ; Gestion du path un peu avancée ;)
- Local $delta = Abs($CurrentDistance - $Distance)
- ;_log( "$delta = " & $delta )
- If TimerDiff($TimeOut) > 4000 And ($delta < 5) Then
- ;GameOverTime = True ; pour quitter completement
- _log("Blocked " & $Blocked)
- $Blocked = $Blocked + 1
- _log("Blocked " & $Blocked)
- if $Blocked > 1 then
- $GameOverTime = True
- Endif
- HandlePath($lastwp[0], $lastwp[1], $lastwp[2], $lastwp[3], $lastwp[4])
- $TimeOut = TimerInit()
- EndIf
- $CurrentDistance = $Distance
- Sleep(10)
- $Coords = FromD3toScreenCoords($_x, $_y, $_z)
- $LastCP = GetCurrentPos()
- If $_a = 1 And GetDistance($LastCP[0], $LastCP[1], $LastCP[2]) >= $a_range / 2 Then
- MouseUp("middle")
- If $_a = 1 Then Attack($a_range, $monsterList)
- MouseMove($Coords[0], $Coords[1], 3)
- MouseDown("middle")
- $TimeOut = TimerInit()
- EndIf
- MouseMove($Coords[0], $Coords[1], 3)
- WEnd
- EndFunc ;==>HandlePath
- ;;--------------------------------------------------------------------------------
- ;; MoveToPos()
- ;;--------------------------------------------------------------------------------
- Global $nextwp[5], $lastwp[5]
- Func MoveToPos($_x, $_y, $_z, $_a, $m_range)
- If IsDeadCheck() == 0 Or $GameOverTime = True Then
- Return
- EndIf
- Global $nextwp[5] = [$_x, $_y, $_z, $_a, $m_range]
- If $_a = 1 Then Attack($a_range, $monsterList)
- $Coords = FromD3toScreenCoords($_x, $_y, $_z)
- MouseMove($Coords[0], $Coords[1], 3)
- MouseDown("middle")
- Sleep(10)
- HandlePath($_x, $_y, $_z, $_a, $m_range)
- Global $lastwp[5] = [$_x, $_y, $_z, $_a, $m_range]
- MouseUp("middle")
- EndFunc ;==>MoveToPos
- ;;--------------------------------------------------------------------------------
- ;; Interact()
- ;;--------------------------------------------------------------------------------
- Func Interact($_x, $_y, $_z)
- ; MoveToPos($_x, $_y, $_z, 0, 25)
- $Coords = FromD3toScreenCoords($_x, $_y, $_z)
- MouseClick("left", $Coords[0], $Coords[1], 1, 10)
- $tempvalue = _MemoryRead($_itrInteractE + $ofs__InteractOffsetUNK2, $d3, 'int')
- While $tempvalue = 1
- $tempvalue = _MemoryRead($_itrInteractE + $ofs__InteractOffsetUNK2, $d3, 'int')
- Sleep(100)
- WEnd
- EndFunc ;==>Interact
- ;;--------------------------------------------------------------------------------
- ;; Approach() Approach a NPC without left clicking
- ;;--------------------------------------------------------------------------------
- Func Approach($_x, $_y, $_z)
- ; MoveToPos($_x, $_y, $_z, 0, 25)
- $Coords = FromD3toScreenCoords($_x, $_y, $_z)
- MouseClick("middle", $Coords[0], $Coords[1], 1, 10)
- $tempvalue = _MemoryRead($_itrInteractE + $ofs__InteractOffsetUNK2, $d3, 'int')
- While $tempvalue = 1
- $tempvalue = _MemoryRead($_itrInteractE + $ofs__InteractOffsetUNK2, $d3, 'int')
- Sleep(100)
- WEnd
- EndFunc ;==>Approach
- ;;--------------------------------------------------------------------------------
- ;; InteractByActorName()
- ;;--------------------------------------------------------------------------------
- Func InteractByActorName($a_name, $dist = 300)
- Local $index, $offset, $count, $item[10], $foundobject = 0
- startIterateObjectsList($index, $offset, $count)
- While iterateObjectsList($index, $offset, $count, $item)
- If StringInStr($item[1], $a_name) And $item[9] < $dist Then
- _log($item[1] & " distance : " &$item[9])
- If $item[9] > 40 Then ;pour eviter de cliquer un autre acteur en trajet
- Approach($item[2], $item[3], $item[4])
- _log(" Approaching : " &$item[1])
- Else
- Interact($item[2], $item[3], $item[4])
- Endif
- $foundobject = 1
- Sleep(100)
- ExitLoop
- EndIf
- WEnd
- Return $foundobject
- EndFunc ;==>InteractByActorName
- ;;--------------------------------------------------------------------------------
- ;; GetLifep()
- ;;--------------------------------------------------------------------------------
- Func GetLifep()
- Local $index, $offset, $count, $item[10], $foundobject = 0
- startIterateObjectsList($index, $offset, $count)
- While iterateObjectsList($index, $offset, $count, $item)
- If StringInStr($item[1], "HealthBall_liquid") Then
- return _MemoryRead($item[8] + 0x408, $d3, 'float')
- EndIf
- WEnd
- EndFunc ;==>GetLifep
- ;;--------------------------------------------------------------------------------
- ;; checkFromList()
- ;;--------------------------------------------------------------------------------
- Func checkFromList($list, $compare, $delimiter = '|')
- $arrayList = StringSplit($list, $delimiter)
- For $i = 1 To $arrayList[0]
- If StringInStr($compare, $arrayList[$i]) Then
- Return 1
- EndIf
- Next
- Return 0
- EndFunc ;==>checkFromList
- ;;--------------------------------------------------------------------------------
- ;; Attack()
- ;;--------------------------------------------------------------------------------
- Func Attack($range, $monsterList)
- If IsDeadCheck() = 0 Then
- Return
- EndIf
- Local $IgnoreList = ""
- While 1
- $foundobject = 0
- Local $index, $offset, $count, $item[10]
- startIterateObjectsList($index, $offset, $count)
- While iterateObjectsList($index, $offset, $count, $item)
- ;;;;;;;;;;; code crados a revoir ;;;;;
- If _playerdead() Then
- UnBuff()
- _leavegame()
- $Death = $Death+1
- Sleep(Random(12000, 14000))
- _log('On est mort on reprend ')
- _botting()
- EndIf
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- If $item[0] <> "" And $item[0] <> 0xFFFFFFFF And $item[9] < $range And StringInStr($IgnoreList, $item[8]) = 0 Then
- If checkFromList($monsterList, $item[1]) And $item[6] <> -1 Then
- ; we have a monster
- If IterateActorAtribs($item[0], $Atrib_Hitpoints_Cur) > 0 And IterateActorAtribs($item[0], $Atrib_Invulnerable) = 0 Then
- $foundobject = 1
- If KillMob($item[1], $item[8], $item[0]) = False Then
- _log('ignoring ' & $item[1])
- $IgnoreList = $IgnoreList & $item[8]
- EndIf
- Else
- _log('ignoring ' & $item[1])
- $IgnoreList = $IgnoreList & $item[8]
- EndIf
- ElseIf $item[5] = 2 And $item[6] = -1 Then
- ; we have a loot
- $grabit = False
- If _MemoryRead($item[8] + 0x4, $d3, 'ptr') <> 0xFFFFFFFF Then
- ConsoleWrite("Checking " & $item[1]& @CRLF)
- $itemDestination = CheckItem($item[0], $item[1])
- If $itemDestination == "Stash" Or $itemDestination == "Salvage" Or $itemDestination == "Inventory" Then
- ; this loot is interesting
- $foundobject = 1
- If Grabit($item[1], $item[8]) = False Then
- _log('ignoring ' & $item[1])
- $IgnoreList = $IgnoreList & $item[8]
- EndIf
- EndIf
- EndIf
- EndIf
- EndIf
- WEnd
- If $foundobject = 0 Then
- ExitLoop
- EndIf
- WEnd
- EndFunc ;==>Attack
- ;;--------------------------------------------------------------------------------
- ;; KillMob()
- ;;--------------------------------------------------------------------------------
- Func KillMob($name, $offset, $guid)
- $return = True
- $begin = TimerInit()
- Local $IgnorePoint = 6500; <-- If something is not grabbed/killed in this time we give it up
- $Coords = FromD3toScreenCoords(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
- MouseMove($Coords[0], $Coords[1], 3)
- ;Send("{SHIFTDOWN}")
- MouseDown("left")
- ;loop the attack until the mob is dead
- _log("Attack : " & $name) ;FOR
- While IterateActorAtribs($guid, $Atrib_Hitpoints_Cur) > 0
- $Coords = FromD3toScreenCoords(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
- MouseMove($Coords[0], $Coords[1], 3)
- MouseDown("left")
- checkForPotion()
- Sleep(10)
- If TimerDiff($begin) > $IgnorePoint Then
- ; after this time, the mob should be dead, otherwise he is probly unkillable
- $return = False
- ExitLoop
- EndIf
- WEnd
- MouseUp("left")
- ;Send("{SHIFTUP}")
- Return $return
- EndFunc ;==>KillMob
- ;;--------------------------------------------------------------------------------
- ;; Grabit()
- ;;--------------------------------------------------------------------------------
- Func Grabit($name, $offset)
- $return = True
- $begin = TimerInit()
- Local $IgnorePoint = 5000; <-- If something is not grabbed/killed in this time we give it up
- ConsoleWrite("Grabbing :" & ($name) & @CRLF) ;FOR DEBUGGING
- If (StringInStr($name, "gold")) Then
- $Coords = FromD3toScreenCoords(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
- MouseClick("middle", $Coords[0], $Coords[1], 1, 5)
- Else
- Interact(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
- EndIf
- While _MemoryRead($offset + 0x4, $d3, 'ptr') <> 0xFFFFFFFF
- If TimerDiff($begin) > $IgnorePoint Then
- ; After this time we should already had the item
- $return = False
- ExitLoop
- EndIf
- If (StringInStr($name, "gold")) Then
- $Coords = FromD3toScreenCoords(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
- MouseClick("middle", $Coords[0], $Coords[1], 1, 5)
- Else
- Interact(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
- EndIf
- Sleep(50)
- WEnd
- Return $return
- EndFunc ;==>Grabit
- ;;--------------------------------------------------------------------------------
- ;; checkForPotion()
- ;;--------------------------------------------------------------------------------
- Func checkForPotion()
- ;Local $mesurepot = TimerInit() ;;;;;;;;;;;;;;
- $life = GetLifep()
- If IsNumber($life) Then
- $diff = TimerDiff($timeforpotion)
- If $life < $LifeForPotion/100 and $diff > 30000 Then
- $timeforpotion = TimerInit()
- send("q")
- EndIf
- $diffClick = TimerDiff($timeforclick)
- If $EmergencyClick = "True" and $life < $LifeForEmergencyClick/100 and $diffClick > $EmergencyClickDelay Then
- sleep(10)
- $timeforclick = TimerInit()
- MouseClick("right")
- EndIf
- $diffSkill = TimerDiff($timeforSkill)
- ;_log($EmergencySkill & " EmergencySkillTouche : " & $EmergencySkillTouche & "Life: " & $life&"/"&$LifeForEmergencySkill/100 & "DiffSkill : " & $diffSkill & ">" & $EmergencySkillDelay )
- If $EmergencySkill = "True" and $life < $LifeForEmergencySkill/100 and $diffSkill > $EmergencySkillDelay Then
- sleep(10)
- $timeforSkill = TimerInit()
- send($EmergencySkillTouche)
- ; _log("Sending : " & $EmergencySkillTouche)
- EndIf
- EndIf
- ;Local $difmesurepot = TimerDiff($mesurepot) ;;;;;;;;;;;;;
- ;ConsoleWrite("Mesure POT :" & $difmesurepot &@crlf) ;FOR DEBUGGING;;;;;;;;;;;;
- EndFunc ;==>checkForPotion
- ;;--------------------------------------------------------------------------------
- ;; checkFromGrabList()
- ;;--------------------------------------------------------------------------------
- Func checkFromGrabList($grabList, $grabcompare, $grabdelimiter = '|')
- $grabarrayList = StringSplit($grabList, $grabdelimiter)
- For $i = 1 To $grabarrayList[0]
- If StringInStr($grabcompare, $grabarrayList[$i]) Then
- Return 1
- EndIf
- Next
- Return 0
- EndFunc ;==>checkFromGrabList
- ;;--------------------------------------------------------------------------------
- ;; checkFromRareList()
- ;;--------------------------------------------------------------------------------
- Func checkFromRareList($rareList, $rarecompare, $raredelimiter = '|')
- $rarearrayList = StringSplit($rareList, $raredelimiter)
- For $i = 1 To $rarearrayList[0]
- If StringInStr($rarecompare, $rarearrayList[$i]) Then
- Return 1
- EndIf
- Next
- Return 0
- EndFunc ;==>checkFromRareList
- ;;--------------------------------------------------------------------------------
- ;; SkipDialog()
- ;;--------------------------------------------------------------------------------
- Func SkipDialog($_Count)
- For $i = 1 To $_Count
- Send("{SPACE}")
- Sleep(100)
- Next
- EndFunc ;==>SkipDialog
- ;;--------------------------------------------------------------------------------
- ;; TakeWP()
- ;;--------------------------------------------------------------------------------
- Func TakeWP($tarChapter, $tarNum, $curChapter, $curNum)
- While Not offsetlist()
- Sleep(10)
- WEnd
- InteractByActorName("Waypoint")
- Sleep(700)
- Local $wptry = 0
- While _checkWPopen() = False
- if $wptry <= 4 then
- _log('Fail to open wp')
- $wptry = $wptry + 1
- InteractByActorName("Waypoint")
- EndIf
- if $wptry > 4 then
- _log('Failed to open wp after 3 try')
- ExitLoop
- EndIf
- WEnd
- If $tarChapter <> $curChapter Or ($tarChapter = $curChapter And $tarChapter < $curChapter) Then
- For $i = 0 To $tarChapter - 1
- $coord = UiRatio(35, 100 + ($i * 12.5))
- MouseClick("left", $coord[0], $coord[1], 1, 3) ; Close chapters
- Next
- $coord = UiRatio(145, 100 + ($tarChapter * 12.5) + 23 + ($tarNum * 32))
- MouseClick("left", $coord[0], $coord[1], 1, 3) ; Click wp
- EndIf
- If $tarChapter = $curChapter And $tarChapter > $curChapter Then
- For $i = 0 To $tarChapter - 1
- $coord = UiRatio(35, 100 + ($i * 12.5))
- MouseClick("left", $coord[0], $coord[1], 1, 3) ; Close chapters
- Next
- $coord = UiRatio(145, 100 + ($tarChapter * 12.5) + 23 + 12 + ($tarNum * 32))
- MouseClick("left", $coord[0], $coord[1], 1, 3) ; Click wp
- EndIf
- Sleep(1000)
- While Not offsetlist()
- Sleep(10)
- WEnd
- EndFunc ;==>TakeWP
- ;;--------------------------------------------------------------------------------
- ;; _resumegame()
- ;;--------------------------------------------------------------------------------
- Func _resumegame()
- _log("Resume Game")
- Sleep(Random(500, 1000, 1))
- _randomclick(106, 233)
- Sleep(4000)
- EndFunc ;==>_resumegame
- ;;--------------------------------------------------------------------------------
- ;; _leavegame()
- ;;--------------------------------------------------------------------------------
- Func _leavegame()
- If _ingame() Then
- _log("Leave Game")
- Send("{ESCAPE}")
- Sleep(Random(200, 300, 1))
- While _escmenu() = False
- Send("{ESCAPE}")
- Sleep(Random(200, 300, 1))
- WEnd
- _randomclick(420, 323)
- Sleep(Random(500, 1000, 1))
- EndIf
- EndFunc ;==>_leavegame
- ;;--------------------------------------------------------------------------------
- ;; Repair()
- ;;--------------------------------------------------------------------------------
- Func Repair($RepairVendor, $RepairTab)
- InteractByActorName($RepairVendor)
- Sleep(700)
- Local $vendortry = 0
- While _checkVendoropen() = False
- if $vendortry <= 5 then
- _log('Fail to open vendor')
- $vendortry = $vendortry + 1
- InteractByActorName($RepairVendor)
- ElseIf $vendortry > 5 then
- _log('Failed to open Vendor after 5 try')
- MsgBox(0, "Impossible d'ouvrir le vendeur :", "SVP, veuillez reporter ce problème sur le forum. Erreur : v001 ")
- Terminate()
- ExitLoop
- EndIf
- WEnd
- Sleep(100)
- $coord = UiRatio(290, 130 + ($RepairTab * 70))
- MouseClick("left", $coord[0], $coord[1], 1, 3) ; Repair tab
- Sleep(100)
- $coord = UiRatio(150, 330)
- MouseClick("left", $coord[0], $coord[1], 1, 3) ; Repair Button
- Sleep(100)
- Send("{SPACE}")
- EndFunc ;==>Repair
- ;;================================================================================
- ; Function: GetDistance($_x,$_y,$_z)
- ; Description: Check distance between you and a desired position.
- ; Parameter(s): $_x,$_y and $_z - the target position
- ;
- ; Note(s): Returns a distance in float
- ;==================================================================================
- Func GetDistance($_x, $_y, $_z)
- $CurrentLoc = GetCurrentPos()
- $xd = $_x - $CurrentLoc[0]
- $yd = $_y - $CurrentLoc[1]
- $zd = $_z - $CurrentLoc[2]
- $Distance = Sqrt($xd * $xd + $yd * $yd + $zd * $zd)
- Return $Distance
- EndFunc ;==>GetDistance
- ;;================================================================================
- ; Function: GetDistance($_x,$_y,$_z)
- ; Description: Check distance between you and a desired position.
- ; Parameter(s): $_x,$_y and $_z - the target position
- ;
- ; Note(s): Returns a distance in float
- ;==================================================================================
- Func GetMyStats()
- While 1
- IterateLocalActor()
- $foundobject = 0
- For $i = 0 To UBound($__ACTOR, 1) - 1
- If StringInStr($__ACTOR[$i][2], "GoldCoin-") Then
- ConsoleWrite("Current GOLD: " & IterateActorAtribs($__ACTOR[$i][1], $Atrib_ItemStackQuantityLo) & @CRLF)
- ExitLoop
- EndIf
- Next
- If $foundobject = 0 Then ExitLoop
- WEnd
- ConsoleWrite("Current Level: " & IterateActorAtribs(0x77BC0000, $Atrib_Level) & @CRLF)
- ConsoleWrite("Strength: " & IterateActorAtribs(0x77BC0000, $Atrib_Strength_Total))
- ConsoleWrite(" Dexterity: " & IterateActorAtribs(0x77BC0000, $Atrib_Dexterity_Total))
- ConsoleWrite(" Inteligence: " & IterateActorAtribs(0x77BC0000, $Atrib_Intelligence_Total))
- ConsoleWrite(" Vitality: " & IterateActorAtribs(0x77BC0000, $Atrib_Vitality_Total) & @CRLF)
- ConsoleWrite("Gold find: " & IterateActorAtribs(0x77BC0000, $Atrib_Gold_Find) & @CRLF)
- ConsoleWrite("Magic find: " & IterateActorAtribs(0x77BC0000, $Atrib_Magic_Find) & @CRLF)
- ConsoleWrite("Pickup Radius : " & IterateActorAtribs(0x77BC0000, $Atrib_Gold_PickUp_Radius) & @CRLF)
- ConsoleWrite("Movement speed : " & IterateActorAtribs(0x77BC0000, $Atrib_Movement_Scalar_Capped_Total) & @CRLF)
- EndFunc ;==>GetMyStats
- Func GameOverTime()
- Global $timedifmaxgamelength = TimerDiff($timermaxgamelength)
- If $timedifmaxgamelength > $maxgamelength Then
- _log('game over time !')
- Global $GameOverTime = True
- EndIf
- EndFunc ;==>GameOverTime
- Func Terminate()
- $file = FileOpen(@ScriptDir & "\" & $fichierstat, 1)
- FileWriteLine($file, $DebugMessage)
- MouseUp("middle")
- MouseUp("left")
- Send("{SHIFTUP}")
- Exit 0
- EndFunc ;==>Terminate
- Func TogglePause()
- $Paused = Not $Paused
- While $Paused
- Sleep(100)
- TrayTip("", 'Script is "Paused"', 5)
- WEnd
- ToolTip("")
- EndFunc ;==>TogglePause
- Func _log($text)
- ConsoleWrite(@MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & " | " & $text & @CRLF)
- EndFunc ;==>_log
- Func RandSleep($min = 5, $max = 45, $chance = 3)
- $randNum = Round(Random(1, 100))
- If $randNum <= $chance Then
- $sleepTime = Random($min * 1000, $max * 1000)
- _log("Sleeping " & $sleepTime & "ms")
- For $c = 0 To 10
- Sleep($sleepTime / 10)
- Next
- EndIf
- EndFunc ;==>RandSleep
- Func _randomclick($X, $Y, $button = "left")
- $coord = UiRatio($X, $Y)
- MouseClick($button, Random($coord[0] - 3, $coord[0] + 3), Random($coord[1] - 3, $coord[1] + 3))
- EndFunc ;==>_randomclick
- ;;=================================================================================================================================================================================================
- ;Best Regards,
- ;8 8888 88 b. 8 8 8888 ,88' b. 8 ,o888888o. `8.`888b ,8' b. 8 8 8888888888 8 888888888o. .-----. .----. .---. .-----.
- ;8 8888 88 888o. 8 8 8888 ,88' 888o. 8 . 8888 `88. `8.`888b ,8' 888o. 8 8 8888 8 8888 `^888. / ,-. \ / .. \/_ |/ ,-. \
- ;8 8888 88 Y88888o. 8 8 8888 ,88' Y88888o. 8 ,8 8888 `8b `8.`888b ,8' Y88888o. 8 8 8888 8 8888 `88. '-' | |. / \ .| |'-' | |
- ;8 8888 88 .`Y888888o. 8 8 8888 ,88' .`Y888888o. 8 88 8888 `8b `8.`888b .b ,8' .`Y888888o. 8 8 8888 8 8888 `88 .' / | | ' || | .' /
- ;8 8888 88 8o. `Y888888o. 8 8 8888 ,88' 8o. `Y888888o. 8 88 8888 88 `8.`888b 88b ,8' 8o. `Y888888o. 8 8 888888888888 8 8888 88 .' /__ ' \ / '| | .' /__
- ;8 8888 88 8`Y8o. `Y88888o8 8 8888 88' 8`Y8o. `Y88888o8 88 8888 88 `8.`888b .`888b,8' 8`Y8o. `Y88888o8 8 8888 8 8888 88 | | \ `' / | || |
- ;8 8888 88 8 `Y8o. `Y8888 8 888888< 8 `Y8o. `Y8888 88 8888 ,8P `8.`888b8.`8888' 8 `Y8o. `Y8888 8 8888 8 8888 ,88 `-------' `---'' `---'`-------'
- ;` 8888 ,8P 8 `Y8o. `Y8 8 8888 `Y8. 8 `Y8o. `Y8 `8 8888 ,8P `8.`888`8.`88' 8 `Y8o. `Y8 8 8888 8 8888 ,88'
- ; 8888 ,d8P 8 `Y8o.` 8 8888 `Y8. 8 `Y8o.` ` 8888 ,88' `8.`8' `8,`' 8 `Y8o.` 8 8888 8 8888 ,o88P'
- ; `Y88888P' 8 `Yo 8 8888 `Y8. 8 `Yo `8888888P' `8.` `8' 8 `Yo 8 888888888888 8 888888888P'
- ;;=================================================================================================================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment