Guest User

toolkit

a guest
Sep 28th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 85.31 KB | None | 0 0
  1. #region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_UseX64=n
  3. #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
  4. #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
  5. ;;================================================================================
  6. ;;================================================================================
  7. ;;      Diablo 3 Au3 ToolKit
  8. ;;  Based on Unkn0wned, voxatu & the RE community works
  9. ;;
  10. ;~ ;;  By Opkllhibus, Leo11173
  11. ;;================================================================================
  12. ;;================================================================================
  13. ;;================================================================================
  14. ;; PRE FUNCTIONS
  15. ;;================================================================================
  16. ;;--------------------------------------------------------------------------------
  17. ;;      Make sure you are running as admin
  18. ;;--------------------------------------------------------------------------------
  19. $_debug = 1
  20. #RequireAdmin
  21. $Admin = IsAdmin()
  22. If $Admin <> 1 Then
  23.     MsgBox(0x30, "ERROR", "This program require administrative rights you fool!")
  24.     Exit
  25. EndIf
  26.  
  27. ;;--------------------------------------------------------------------------------
  28. ;;      Includes
  29. ;;--------------------------------------------------------------------------------
  30. #include <NomadMemory.au3> ;THIS IS EXTERNAL, GET IT AT THE AUTOIT WEBSITE
  31. #include <math.au3>
  32. #include <String.au3>
  33. #include <Array.au3>
  34. #include "constants.au3"
  35.  
  36. ;;--------------------------------------------------------------------------------
  37. ;;      Initialize MouseCoords
  38. ;;--------------------------------------------------------------------------------
  39. Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client
  40.  
  41.  
  42. ;;--------------------------------------------------------------------------------
  43. ;;      Open the process
  44. ;;--------------------------------------------------------------------------------
  45. Opt("WinTitleMatchMode", -1)
  46. SetPrivilege("SeDebugPrivilege", 1)
  47. Global $ProcessID = WinGetProcess("Diablo III", "")
  48. Local $d3 = _MemoryOpen($ProcessID)
  49. If @error Then
  50.     MsgBox(4096, "ERROR", "Failed to open memory for process;" & $ProcessID)
  51.     Exit
  52. EndIf
  53.  
  54. ;OffsetList()
  55.  
  56. ;;================================================================================
  57. ;; FUNCTIONS
  58. ;;================================================================================
  59. Func _logind3()
  60.     WinActivate("Diablo III")
  61.     _log("Login")
  62.     Sleep(20)
  63.     Send($d3pass)
  64.     Sleep(2000)
  65.     Send("{ENTER}")
  66.     Sleep(Random(5000, 6000, 1))
  67. EndFunc   ;==>_logind3
  68.  
  69. ;;--------------------------------------------------------------------------------
  70. ; Function:                     FindActor()
  71. ; Description:          Check if an actor is present or not
  72. ;
  73. ; Note(s):              Return 1 if found in range or 0 if absent
  74. ;;--------------------------------------------------------------------------------
  75. Func FindActor($name, $maxRange = 400)
  76.  
  77.     Local $index, $offset, $count, $item[10], $find = 0
  78.   startIterateObjectsList($index, $offset, $count)
  79.   While iterateObjectsList($index, $offset, $count, $item)
  80.     If StringInStr($item[1], $name) And $item[9] < $maxRange Then
  81.       $find = 1
  82.         Return 1
  83.         ExitLoop
  84.       Sleep(100)
  85.  
  86.     EndIf
  87.   WEnd
  88. If $find = 0 then SetError(1)
  89. Return 0
  90. EndFunc   ;==>FindActor
  91.  
  92. ;;--------------------------------------------------------------------------------
  93. ; Function:             checkuiitemvisible()
  94. ; Description:          search a value in the object manager
  95. ;;--------------------------------------------------------------------------------
  96. Func checkuiitemvisible($valuetocheckfor, $visibility)
  97.     $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
  98.     $ptr2 = _memoryread($ptr1 + 2340, $d3, "ptr")
  99.     $ptr3 = _memoryread($ptr2 + 0, $d3, "ptr")
  100.     $ofs_uielements = _memoryread($ptr3 + 8, $d3, "ptr")
  101.     $uielementcount = _memoryread($ptr3 + 64, $d3, "int")
  102.     $counter = 0
  103.     While ($counter < $uielementcount)
  104.         $counter += 1
  105.         $uielemepointer = _memoryread($ofs_uielements + $counter * 4, $d3, "ptr")
  106.         While ($uielemepointer <> 0)
  107.             $npnt = _memoryread($uielemepointer + 528, $d3, "ptr")
  108.             $name = BinaryToString(_memoryread($npnt + 56, $d3, "byte[256]"), 4)
  109.             ;String($name))
  110.             $visible = _memoryread($npnt + 40, $d3, "int")
  111.             If ($visible = $visibility) Then
  112.                 $foundvalue = StringInStr($name, $valuetocheckfor)
  113.                 If ($foundvalue >= 1) Then
  114.                     Return True
  115.                 EndIf
  116.             EndIf
  117.             $uielemepointer = _memoryread($uielemepointer, $d3, "ptr")
  118.         WEnd
  119.     WEnd
  120.     Return False
  121. EndFunc   ;==>checkuiitemvisible
  122.  
  123. Func fastcheckuiitemvisible($valuetocheckfor, $visibility, $bucket)
  124.     $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
  125.     $ptr2 = _memoryread($ptr1 + 2340, $d3, "ptr")
  126.     $ptr3 = _memoryread($ptr2 + 0, $d3, "ptr")
  127.     $ofs_uielements = _memoryread($ptr3 + 8, $d3, "ptr")
  128.     $uielementpointer = _memoryread($ofs_uielements + 4 * $bucket, $d3, "ptr")
  129.     While $uielementpointer <> 0
  130.         $npnt = _memoryread($uielementpointer + 528, $d3, "ptr")
  131.         $name = BinaryToString(_memoryread($npnt + 56, $d3, "byte[256]"), 4)
  132.         If StringInStr($name, $valuetocheckfor) Then
  133.             If _memoryread($npnt + 40, $d3, "int") = $visibility Then
  134.                 Return True
  135.             Else
  136.                 Return False
  137.             EndIf
  138.         EndIf
  139.         $uielementpointer = _memoryread($uielementpointer, $d3, "ptr")
  140.     WEnd
  141.     Return False
  142. EndFunc   ;==>fastcheckuiitemvisible
  143.  
  144. Func _playerdead()
  145.     $playerdeadlookfor = "NormalLayer.deathmenu_dialog"
  146.     Return fastcheckuiitemvisible($playerdeadlookfor, 1, 969)
  147. EndFunc   ;==>_playerdead
  148.  
  149. Func _inmenu()
  150.     $lobbylookfor = "Menu.PlayGameButton"
  151.     Return checkuiitemvisible($lobbylookfor, 1)
  152. EndFunc   ;==>_inmenu
  153.  
  154. Func _checkdisconnect()
  155.     $disclookfor = "Root.TopLayer.BattleNetModalNotifications_main.ModalNotification.Buttons.ButtonList.OkButton"
  156.     Return checkuiitemvisible($disclookfor, 1)
  157. EndFunc   ;==>_checkdisconnect
  158.  
  159. Func _checkRepair()
  160.     $disclookfor = "Root.NormalLayer.DurabilityIndicator"
  161.     Return fastcheckuiitemvisible($disclookfor, 1, 239)
  162. EndFunc   ;==>_checkRepair
  163.  
  164. Func _onloginscreen()
  165.     $loginlookfor = "Root.NormalLayer.BattleNetLogin_main.LayoutRoot"
  166.     Return fastcheckuiitemvisible($loginlookfor, 1, 54)
  167. EndFunc   ;==>_onloginscreen
  168.  
  169. Func _escmenu()
  170.     $escmenuelookfor = "Root.TopLayer.gamemenu_dialog.gamemenu_bkgrnd.ButtonStackContainer.button_leaveGame"
  171.     Return fastcheckuiitemvisible($escmenuelookfor, 1, 1447)
  172. EndFunc   ;==>_escmenu
  173.  
  174. Func _ingame()
  175.     $gamelookfor = "game_progressBar_healthBall"
  176.     Return fastcheckuiitemvisible($gamelookfor, 1, 237)
  177. EndFunc   ;==>_ingame
  178.  
  179. Func _checkWPopen()
  180.     $checkWPopenlookfor = "Root.NormalLayer.waypoints_dialog_mainPage"
  181.     Return checkuiitemvisible($checkWPopenlookfor, 1)
  182. EndFunc   ;==>_checkWPopen
  183.  
  184. Func _checkVendoropen()
  185.     $checkVendorOpenlookfor = "Root.NormalLayer.shop_dialog_mainPage"
  186.     Return checkuiitemvisible($checkVendorOpenlookfor, 1)
  187. EndFunc   ;==>_checkWPopen
  188.  
  189. Func _checkStashopen()
  190.     $_checkStashopenlookfor = "Root.NormalLayer.stash_dialog_mainPage"
  191.     Return checkuiitemvisible($_checkStashopenlookfor, 1)
  192. EndFunc   ;==>_checkWPopen
  193.  
  194. Func _checkInventoryopen()
  195.     $_checkInventoryopenlookfor = "Root.NormalLayer.inventory_dialog_mainPage"
  196.     Return checkuiitemvisible($_checkInventoryopenlookfor, 1)
  197. EndFunc   ;==>_checkWPopen
  198.  
  199. Func _townportal()
  200.     _log("Town Portal")
  201.     Sleep(200)
  202.     Send("t")
  203.     Sleep(Random(7500, 8000, 1))
  204. EndFunc   ;==>_townportal
  205.  
  206.  
  207. ;;--------------------------------------------------------------------------------
  208. ; Function:         IsInArea($area)
  209. ; Description:      Check  where we are
  210. ;
  211. ;;--------------------------------------------------------------------------------
  212. Func IsInArea($area)
  213.    $area = GetLevelAreaId()
  214.    ConsoleWrite("Area " & $area & @CRLF)
  215.    return $area = GetLevelAreaId()
  216. EndFunc ;==>IsInArea
  217.  
  218. Func GetLevelAreaId()
  219.    return _MemoryRead(_MemoryRead(0x1717244,$d3,"int")+ 0x810,$d3,"int")
  220. EndFunc ;==>GetLevelAreaId
  221.  
  222. Func LevelAreaConstants()
  223.    Global $A1_C6_SpiderCave_01_Entrance = 0xE3A6
  224.    Global $A1_C6_SpiderCave_01_Main = 0x132EC
  225.    Global $A1_C6_SpiderCave_01_Queen = 0xF506
  226.    Global $A1_Dun_Crypt_Dev_Hell = 0x36581
  227.    Global $A1_Fields_Cave_SwordOfJustice_Level01 = 0x1D455
  228.    Global $A1_Fields_Den = 0x21045
  229.    Global $A1_Fields_Den_Level02 = 0x2F6b8
  230.    Global $A1_Fields_RandomDRLG_CaveA_Level01 = 0x141C4
  231.    Global $A1_Fields_RandomDRLG_CaveA_Level02 = 0x141C5
  232.    Global $A1_Fields_RandomDRLG_ScavengerDenA_Level01 = 0x13D0D
  233.    Global $A1_Fields_RandomDRLG_ScavengerDenA_Level02 = 0x13D17
  234.    Global $A1_Fields_Vendor_Tinker_Exterior = 0x2bC0C
  235.    Global $A1_Highlands_RandomDRLG_GoatmanCaveA_Level01 = 0x14286
  236.    Global $A1_Highlands_RandomDRLG_GoatmanCaveA_Level02 = 0x14287
  237.    Global $A1_Highlands_RandomDRLG_WestTower_Level01 = 0x14196
  238.    Global $A1_Highlands_RandomDRLG_WestTower_Level02 = 0x14197
  239.    Global $A1_Random_Level01 = 0x33A17
  240.    Global $A1_trDun_Blacksmith_Cellar = 0x144A6
  241.    Global $A1_trDun_ButchersLair_02 = 0x16301
  242.    Global $A1_trDun_Cain_Intro = 0xED2A
  243.    Global $A1_trDun_Cave_Highlands_Random01_VendorRescue = 0x21310
  244.    Global $A1_trdun_Cave_Nephalem_01 = 0xEBEC
  245.    Global $A1_trdun_Cave_Nephalem_02 = 0xEBED
  246.    Global $A1_trdun_Cave_Nephalem_03 = 0xEBEE
  247.    Global $A1_trDun_Cave_Old_Ruins_Random01 = 0x278AC
  248.    Global $A1_trDun_CrownRoom = 0x18FDA
  249.    Global $A1_trDun_Crypt_Event_Tower_Of_Power = 0x138F4
  250.    Global $A1_trDun_Crypt_Flooded_Memories_Level01 = 0x18F9c
  251.    Global $A1_trDun_Crypt_Flooded_Memories_Level02 = 0x287A6
  252.    Global $A1_trdun_Crypt_Special_00 = 0x25BDC
  253.    Global $A1_trdun_Crypt_Special_01 = 0xECB9
  254.    Global $A1_trDun_Event_JarOfSouls = 0x2371E
  255.    Global $A1_trDun_FalseSecretPassage_01 = 0x14540
  256.    Global $A1_trDun_FalseSecretPassage_02 = 0x14541
  257.    Global $A1_trDun_FalseSecretPassage_03 = 0x14542
  258.    Global $A1_trDun_Jail_Level01 = 0x171d0
  259.    Global $A1_trDun_Jail_Level01_Cells = 0x1783D
  260.    Global $A1_trDun_Leoric01 = 0x4D3E
  261.    Global $A1_trDun_Leoric02 = 0x4D3F
  262.    Global $A1_trDun_Leoric03 = 0x4D40
  263.    Global $A1_trDun_Level01 = 0x4D44
  264.    Global $A1_trDun_Level04 = 0x4D47
  265.    Global $A1_trDun_Level05_Templar = 0x15763
  266.    Global $A1_trDun_Level06 = 0x4D49
  267.    Global $A1_trDun_Level07B = 0x4D4B
  268.    Global $A1_trDun_Level07D = 0x4D4D
  269.    Global $A1_trDun_Tyrael_Level09 = 0x1CAA3
  270.    Global $A1_trDun_TyraelJail = 0x24447
  271.    Global $A1_trOut_AdriasCellar = 0xF5F8
  272.    Global $A1_trOUT_AdriasHut = 0x4DD9
  273.    Global $A1_trOut_BatesFarmCellar = 0x248A5
  274.    Global $A1_trOUT_Church = 0x4DDD
  275.    Global $A1_trOut_Fields_Vendor_Curios = 0x1A3B7
  276.    Global $A1_trOut_Fields_Vendor_Curios_Exterior = 0x2BE7B
  277.    Global $A1_trOUT_FishingVillage = 0x4DDF
  278.    Global $A1_trOUT_FishingVillageHeights = 0x1FB03
  279.    Global $A1_trOut_ForlornFarm = 0x20B72
  280.    Global $A1_trOUT_Graveyard = 0x4DE2
  281.    Global $A1_trOUT_Highlands = 0x4DE4
  282.    Global $A1_trOUT_Highlands_Bridge = 0x16DC0
  283.    Global $A1_trOut_Highlands_DunExterior_A = 0x15718
  284.    Global $A1_trOUT_Highlands_ServantHouse_Cellar_Vendor = 0x29CD1
  285.    Global $A1_trOUT_Highlands_Sub240_GoatmanGraveyard = 0x1F95F
  286.    Global $A1_trOUT_Highlands2 = 0x4DE5
  287.    Global $A1_trOUT_Highlands3 = 0x4AF
  288.    Global $A1_trOut_Leoric_Manor_Int = 0x189F6
  289.    Global $A1_trOUT_LeoricsManor = 0x4DE7
  290.    Global $A1_trOut_MysticWagon = 0x20F08
  291.    Global $A1_trOUT_NewTristram = 0x4DEB
  292.    Global $A1_trOUT_NewTristram_AttackArea = 0x316CE
  293.    Global $A1_trOUT_NewTristramOverlook = 0x26186
  294.    Global $A1_trOut_Old_Tristram = 0x163FD
  295.    Global $A1_trOut_Old_Tristram_Road = 0x164BC
  296.    Global $A1_trOut_Old_Tristram_Road_Cath = 0x18BE7
  297.    Global $A1_trOut_OldTristram_Cellar = 0x1A22B
  298.    Global $A1_trOut_OldTristram_Cellar_1 = 0x1A104
  299.    Global $A1_trOut_OldTristram_Cellar_2 = 0x1A105
  300.    Global $A1_trOut_OldTristram_Cellar_3 = 0x19322
  301.    Global $A1_trOut_oldTristram_TreeCave = 0x19C87
  302.    Global $a1_trOut_Scoundrel_Event_Old_Mill_2 = 0x35556
  303.    Global $A1_trOut_TownAttack_ChapelCellar = 0x1D43E
  304.    Global $A1_trOut_Tristram_CainsHouse = 0x1FC73
  305.    Global $A1_trOut_Tristram_Inn = 0x1AB91
  306.    Global $A1_trOut_Tristram_LeahsRoom = 0x15349
  307.    Global $A1_trOut_TristramFields_A = 0x4DF0
  308.    Global $A1_trOut_TristramFields_B = 0x4DF1
  309.    Global $A1_trOut_TristramFields_ExitA = 0xF085
  310.    Global $A1_trOut_TristramFields_Forsaken_Grounds = 0x2BD6F
  311.    Global $A1_trOut_TristramFields_Secluded_Grove = 0x2BD6E
  312.    Global $A1_trOut_TristramWilderness = 0x4DF2
  313.    Global $A1_trOut_TristramWilderness_SubScenes = 0x236AA
  314.    Global $A1_trOut_Vendor_Tinker_Room = 0x19821
  315.    Global $A1_trOut_Wilderness_BurialGrounds = 0x11C08
  316.    Global $A1_trOut_Wilderness_CorpseHouse = 0x30ADF
  317.    Global $A1_trOut_Wilderness_Sub80_FamilyTree = 0x236A1
  318.    Global $A2_Belial_Room_01 = 0xED55
  319.    Global $A2_Belial_Room_Intro = 0x13D1A
  320.    Global $A2_c1Dun_Swr_Caldeum_01 = 0x4D4F
  321.    Global $A2_c2dun_Zolt_TreasureHunter = 0x4D53
  322.    Global $A2_c3Dun_Aqd_Oasis_Level01 = 0xE069
  323.    Global $A2_cadun_Zolt_Timed01_Level01 = 0x4D52
  324.    Global $A2_cadun_Zolt_Timed01_Level02 = 0x29108
  325.    Global $A2_Caldeum = 0x19234
  326.    Global $A2_Caldeum_Uprising = 0x33613
  327.    Global $A2_caOut_Alcarnus_RandomCellar_1 = 0x245A7
  328.    Global $A2_caOut_Alcarnus_RandomCellar_2 = 0x245A8
  329.    Global $A2_caOut_Alcarnus_RandomCellar_3 = 0x245A9
  330.    Global $A2_caOUT_Boneyard_01 = 0xD24A
  331.    Global $A2_caOUT_Borderlands_Khamsin_Mine = 0xEE8A
  332.    Global $A2_caOUT_BorderlandsKhamsin = 0xF8B2
  333.    Global $A2_caOut_Cellar_Alcarnus_Main = 0x2FAC4
  334.    Global $A2_caOut_CT_RefugeeCamp = 0xD811
  335.    Global $A2_caOut_CT_RefugeeCamp_Gates = 0x318FD
  336.    Global $A2_caOut_CT_RefugeeCamp_Hub = 0x2917A
  337.    Global $A2_caOut_Hub_Inn = 0x2AA00
  338.    Global $A2_caOut_Interior_C_DogBite = 0x2D7BB
  339.    Global $A2_caOut_Interior_H_RockWorm = 0x232F5
  340.    Global $A2_caOut_Mine_Abandoned_Cellar = 0x4D81
  341.    Global $A2_caOut_Oasis = 0xE051
  342.    Global $A2_caOut_Oasis_Exit = 0x2ACE2
  343.    Global $A2_caOut_Oasis_Exit_A = 0x2AD07
  344.    Global $A2_caOut_Oasis_Rakanishu = 0x33BDD
  345.    Global $A2_caOut_Oasis_RandomCellar_1 = 0x27099
  346.    Global $A2_caOut_Oasis_RandomCellar_2 = 0x2709A
  347.    Global $A2_caOut_Oasis_RandomCellar_3 = 0x2709B
  348.    Global $A2_caOut_Oasis_RandomCellar_4 = 0x27bE7
  349.    Global $A2_caOut_Oasis1_Water = 0xE664
  350.    Global $A2_caOut_Oasis2 = 0xE058
  351.    Global $A2_caOut_OasisCellars = 0x1B100
  352.    Global $A2_caOUT_StingingWinds = 0x4D7F
  353.    Global $A2_caOUT_StingingWinds_Alcarnus_Tier1 = 0x4D71
  354.    Global $A2_caOUT_StingingWinds_Alcarnus_Tier2 = 0x4D72
  355.    Global $A2_caOUT_StingingWinds_Bridge = 0x29886
  356.    Global $A2_caOUT_StingingWinds_Canyon = 0x4D7C
  357.    Global $A2_caOUT_StingingWinds_FallenCamp01 = 0x288EF
  358.    Global $A2_caOUT_StingingWinds_PostBridge = 0x4D7E
  359.    Global $A2_caOUT_StingingWinds_PreAlcarnus = 0x4D7B
  360.    Global $A2_caOUT_StingingWinds_PreBridge = 0x4D7D
  361.    Global $A2_caOut_Stranded2 = 0x1DA4A
  362.    Global $A2_caOut_ZakarwaMerchantCellar = 0x1BEBB
  363.    Global $A2_Cave_Random01 = 0x26F64
  364.    Global $A2_Cave_Random01_Level02 = 0x35E85
  365.    Global $A2_CultistCellarEast = 0x19218
  366.    Global $A2_CultistCellarWest = 0x19214
  367.    Global $A2_dun_Aqd_Control_A = 0xF9F3
  368.    Global $A2_dun_Aqd_Control_B = 0xF9F4
  369.    Global $A2_dun_Aqd_Oasis_RandomFacePuzzle_Large = 0x26B82
  370.    Global $A2_dun_Aqd_Oasis_RandomFacePuzzle_Small = 0x26AB0
  371.    Global $A2_dun_Aqd_Special_01 = 0xF520
  372.    Global $A2_dun_Aqd_Special_A = 0xF53A
  373.    Global $A2_dun_Aqd_Special_B = 0xF53C
  374.    Global $A2_Dun_Aqd_Swr_to_Oasis_Level01 = 0x23D96
  375.    Global $A2_dun_Cave_BloodVial_01 = 0x31F55
  376.    Global $A2_dun_Cave_BloodVial_02 = 0x31F83
  377.    Global $A2_dun_Oasis_Cave_MapDungeon = 0x29616
  378.    Global $A2_dun_Oasis_Cave_MapDungeon_Level02 = 0x2F6bF
  379.    Global $A2_dun_PortalRoulette_A = 0x1B37F
  380.    Global $A2_Dun_Swr_Adria_Level01 = 0xE47E
  381.    Global $A2_Dun_Swr_Caldeum_Sewers_01 = 0x1B205
  382.    Global $A2_dun_Zolt_Blood02_Level01_Part1 = 0x1E12E
  383.    Global $A2_dun_Zolt_Blood02_Level01_Part2 = 0x25872
  384.    Global $A2_Dun_Zolt_BossFight_Level04 = 0xEB22
  385.    Global $A2_dun_Zolt_Head_Random01 = 0xF0C0
  386.    Global $A2_Dun_Zolt_Level01 = 0x4D55
  387.    Global $A2_Dun_Zolt_Level02 = 0x4D56
  388.    Global $A2_Dun_Zolt_Level03 = 0x4D57
  389.    Global $A2_Dun_Zolt_Lobby = 0x4D58
  390.    Global $A2_Dun_Zolt_LobbyCenter = 0x2AFBA
  391.    Global $A2_Dun_Zolt_Random_Level01 = 0x4D59
  392.    Global $A2_Dun_Zolt_Random_Level02 = 0x36571
  393.    Global $A2_dun_Zolt_Random_PortalRoulette_02 = 0x2FDCF
  394.    Global $A2_Dun_Zolt_ShadowRealm_Level01 = 0x13AD0
  395.    Global $A2_Event_DyingManMine = 0x2270B
  396.    Global $A2_Event_PriceOfMercy_Cellar = 0x2FD9E
  397.    Global $A2_Rockworm_Cellar_Cave = 0x2FE81
  398.    Global $A2_trDun_Boneyard_Spider_Cave_01 = 0x1B437
  399.    Global $A2_trDun_Boneyard_Spider_Cave_02 = 0x35758
  400.    Global $A2_trDun_Boneyard_Worm_Cave_01 = 0x1B433
  401.    Global $A2_trDun_Boneyard_Worm_Cave_02 = 0x35759
  402.    Global $A2_trDun_Cave_Oasis_Random01 = 0xF46F
  403.    Global $A2_trDun_Cave_Oasis_Random01_Level02 = 0x2F6C2
  404.    Global $A2_trDun_Cave_Oasis_Random02 = 0xF46E
  405.    Global $A2_trDun_Cave_Oasis_Random02_Level02 = 0x27551
  406.    Global $a2dun_Aqd_Oasis_Level00 = 0x2F0B6
  407.    Global $a2dun_Aqd_Oasis_Level01 = 0x2F0B1
  408.    Global $A3_AzmodanFight = 0x1B39C
  409.    Global $A3_Battlefield_A = 0x1B7A4
  410.    Global $A3_Battlefield_B = 0x1B7B5
  411.    Global $A3_Battlefield_C = 0x1B7C4
  412.    Global $A3_Bridge_01 = 0x10F80
  413.    Global $A3_Bridge_Choke_A = 0x25DA8
  414.    Global $A3_Dun_Battlefield_Gate = 0x25C14
  415.    Global $A3_dun_Bridge_Interior_Random01 = 0x224ad
  416.    Global $A3_dun_Bridge_Interior_Random02 = 0x32270
  417.    Global $A3_Dun_Crater_Level_01 = 0x15040
  418.    Global $A3_Dun_Crater_Level_02 = 0x1d209
  419.    Global $A3_Dun_Crater_Level_03 = 0x1d20a
  420.    Global $A3_dun_Crater_ST_Level01 = 0x13b97
  421.    Global $A3_dun_Crater_ST_Level01B = 0x1d365
  422.    Global $A3_dun_Crater_ST_Level02 = 0x13b98
  423.    Global $A3_dun_Crater_ST_Level02B = 0x2200a
  424.    Global $A3_dun_Crater_ST_Level04 = 0x14cd2
  425.    Global $A3_dun_Crater_ST_Level04B = 0x1d368
  426.    Global $A3_dun_IceCaves_Random_01 = 0x2e3a1
  427.    Global $A3_dun_IceCaves_Random_01_Level_02 = 0x36206
  428.    Global $A3_dun_IceCaves_Timed_01 = 0x2ea66
  429.    Global $A3_dun_IceCaves_Timed_01_Level_02 = 0x36207
  430.    Global $A3_Dun_Keep_Hub = 0x16b11
  431.    Global $A3_Dun_Keep_Hub_Inn = 0x2d38c
  432.    Global $A3_Dun_Keep_Level03 = 0x126ac
  433.    Global $A3_Dun_Keep_Level04 = 0x16baf
  434.    Global $A3_Dun_Keep_Level05 = 0x21500
  435.    Global $A3_Dun_Keep_Random_01 = 0x2aa4a
  436.    Global $A3_Dun_Keep_Random_01_Level_02 = 0x36238
  437.    Global $A3_Dun_Keep_Random_02 = 0x2c7f2
  438.    Global $A3_Dun_Keep_Random_02_Level_02 = 0x36239
  439.    Global $A3_Dun_Keep_Random_03 = 0x2c802
  440.    Global $A3_Dun_Keep_Random_03_Level_02 = 0x3623a
  441.    Global $A3_Dun_Keep_Random_04 = 0x2c8e6
  442.    Global $A3_Dun_Keep_Random_04_Level_02 = 0x36241
  443.    Global $A3_Dun_Keep_Random_Cellar_01 = 0x35ee9
  444.    Global $A3_Dun_Keep_Random_Cellar_02 = 0x35ee8
  445.    Global $A3_Dun_Keep_Random_Cellar_03 = 0x303f7
  446.    Global $A3_Dun_Keep_TheBreach_Level04 = 0x3558f
  447.    Global $A3_dun_rmpt_Level01 = 0x16b20
  448.    Global $A3_dun_rmpt_Level02 = 0x16bf5
  449.    Global $A3_Gluttony_Boss = 0x1b280
  450.    Global $a3dun_Hub_Adria_Tower = 0x31222
  451.    Global $a3dun_hub_AdriaTower_Intro_01 = 0x3253e
  452.    Global $A4_dun_Diablo_Arena = 0x1abfb
  453.    Global $A4_dun_Diablo_Arena_Phase3 = 0x348c3
  454.    Global $A4_dun_Garden_of_Hope_01 = 0x1abca
  455.    Global $A4_dun_Garden_of_Hope_02 = 0x1abcc
  456.    Global $A4_dun_Garden3_SpireEntrance = 0x1d44a
  457.    Global $A4_dun_Heaven_1000_Monsters_Fight = 0x1aa5d
  458.    Global $A4_dun_Heaven_1000_Monsters_Fight_Entrance = 0x2f169
  459.    Global $A4_dun_Hell_Portal_01 = 0x1abd6
  460.    Global $A4_dun_Hell_Portal_02 = 0x1abdb
  461.    Global $A4_Dun_Keep_Hub = 0x301ed
  462.    Global $A4_dun_LibraryOfFate = 0x23120
  463.    Global $A4_dun_Spire_00 = 0x307a4
  464.    Global $A4_dun_Spire_01 = 0x1abe2
  465.    Global $A4_dun_Spire_02 = 0x1abe4
  466.    Global $A4_dun_Spire_03 = 0x1abe6
  467.    Global $A4_dun_Spire_04 = 0x33728
  468.    Global $A4_dun_Spire_SigilRoom_A = 0x313c4
  469.    Global $A4_dun_Spire_SigilRoom_B = 0x2ae7a
  470.    Global $A4_dun_Spire_SigilRoom_C = 0x313c6
  471.    Global $A4_dun_Spire_SigilRoom_D = 0x313c7
  472.    Global $a4dun_Diablo_ShadowRealm_01 = 0x25845
  473.    Global $a4dun_spire_DiabloEntrance = 0x3227a
  474.    Global $a4dun_spire_exterior = 0x34964
  475.    Global $Axe_Bad_Data = 0x4d60
  476.    Global $PvP_Maze_01 = 0x4da2
  477.    Global $PvP_Octogon_01 = 0x4da3
  478.    Global $PvP_Pillar_01 = 0x4da4
  479.    Global $PvP_Stairs_01 = 0x4da5
  480.    Global $PvP_Test_BlueTeam = 0x4da6
  481.    Global $PvP_Test_Neutral = 0x4da7
  482.    Global $PvP_Test_RedTeam = 0x4da8
  483.    Global $PvPArena = 0x4d9c
  484. EndFunc
  485.  
  486. ;;--------------------------------------------------------------------------------
  487. ; Function:         TownStateCheck()
  488. ; Description:      Check if we are in town or not by comparing distance from stash
  489. ;
  490. ;;--------------------------------------------------------------------------------
  491. Func _intown()
  492.     If $_debug Then _log("-----Checking if In Town------")
  493.     $town = findActor('Player_Shared_Stash', 448)
  494.     If Not @error Then
  495.         ConsoleWrite("We are in town " & $town & @CRLF)
  496.         Return True
  497.     Else
  498.         ConsoleWrite("We are NOT in town " & $town & @CRLF)
  499.         Return False
  500.     EndIf
  501. EndFunc   ;==>_intown
  502. ;==>TownStateCheck
  503.  
  504. ;;--------------------------------------------------------------------------------
  505. ; Function:                     IsDeadCheck()
  506. ; Description:          Check if we are Dead or not
  507. ;
  508. ;;--------------------------------------------------------------------------------
  509. Func IsDeadCheck()
  510.     ;If $_debug Then ConsoleWrite("-----Checking if Dead-----" & @CRLF)
  511.     $dead = findActor('PlayerHeadstone', 50)
  512.     If Not @error Then
  513.     ;   ConsoleWrite("We are Dead " & $dead & @CRLF)
  514.         Return 0
  515.     Else
  516.     ;   ConsoleWrite("We are Alive " & $dead & @CRLF)
  517.         Return 1
  518.     EndIf
  519. EndFunc   ;==>IsDeadCheck
  520.  
  521. ;;--------------------------------------------------------------------------------
  522. ;;  Getting Backpack Item Info
  523. ;;--------------------------------------------------------------------------------
  524. Func IterateBackpack($bag = 0, $rlvl = 0)
  525.     ;$bag = 0 for backpack and 15 for stash
  526.     ;$rlvl = 1 for actual level requirement of item and 0 for base required level
  527.     $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
  528.     $ptr2 = _memoryread($ptr1 + 0x850, $d3, "ptr")
  529.     $ptr3 = _memoryread($ptr2 + 0x0, $d3, "ptr")
  530.     $_Count = _memoryread($ptr3 + 0x108, $d3, "int")
  531.  
  532.     $CurrentOffset = _memoryread(_memoryread($ptr3 + 0x148, $d3, "ptr") + 0x0, $d3, "ptr");$_LocalActor_3
  533.  
  534.     Local $__ACDACTOR[$_Count + 1][9]
  535.     For $i = 0 To $_Count
  536.         $__ACDACTOR[$i][0] = _MemoryRead($CurrentOffset, $d3, 'ptr')
  537.         $__ACDACTOR[$i][1] = _MemoryRead($CurrentOffset + 0x4, $d3, 'char[64]')
  538.         $__ACDACTOR[$i][2] = _MemoryRead($CurrentOffset + 0x114, $d3, 'int')
  539.         $__ACDACTOR[$i][3] = _MemoryRead($CurrentOffset + 0x118, $d3, 'int')
  540.         $__ACDACTOR[$i][4] = _MemoryRead($CurrentOffset + 0x11C, $d3, 'int')
  541.         $__ACDACTOR[$i][5] = 0
  542.         $__ACDACTOR[$i][6] = _MemoryRead($CurrentOffset + $ofs_LocalActor_atribGUID, $d3, 'ptr')
  543.         $__ACDACTOR[$i][7] = $CurrentOffset
  544.         $__ACDACTOR[$i][8] = _MemoryRead($CurrentOffset + 0xB4, $d3, 'int')
  545.         $CurrentOffset = $CurrentOffset + $ofs_LocalActor_StrucSize
  546.     Next
  547.     For $i = $_Count To 0 Step -1
  548.         If $__ACDACTOR[$i][2] <> $bag Then
  549.             _ArrayDelete($__ACDACTOR, $i)
  550.         Else
  551.             $__ACDACTOR[$i][5] = GetPackItemLevel($__ACDACTOR[$i][6], $Atrib_Requirement)
  552.             If $rlvl Then
  553.                 $lvlReduce = GetPackItemLevel($__ACDACTOR[$i][6], $Atrib_Item_Level_Requirement_Reduction)
  554.                 If $lvlReduce Then $__ACDACTOR[$i][5] = $__ACDACTOR[$i][5] - $lvlReduce
  555.             EndIf
  556.         EndIf
  557.     Next
  558.  
  559.     Return $__ACDACTOR
  560. EndFunc   ;==>IterateBackpack
  561.  
  562. ;;--------------------------------------------------------------------------------
  563. ; Function:         GetPackItemLevel($ACD, $_REQ)
  564. ;;--------------------------------------------------------------------------------
  565. Func GetPackItemLevel($ACD, $_REQ)
  566.     ;IterateLocalActor()
  567.     ;$ACDIndex = _ArraySearch($__ACTOR, "0x" & Hex($_guid), 0, 0, 0, 1, 1, 1) ;this bitch is slow as hell
  568.     If $ACD = -1 Then Return False
  569.     $_Count = _MemoryRead($_ActorAtrib_Count, $d3, 'int')
  570.     $CurrentOffset = $_ActorAtrib_4
  571.     Dim $ACTORatrib
  572.     For $i = 0 To $_Count
  573.         $ACTORatrib = _MemoryRead($CurrentOffset, $d3, 'ptr')
  574.         If $ACTORatrib = $ACD Then
  575.             $test = _MemoryRead($CurrentOffset + 0x10, $d3, 'ptr')
  576.             $CurretOffset = $test
  577.             For $i = 0 To 825
  578.                 $data = _MemoryRead($CurretOffset, $d3, 'ptr')
  579.                 $CurretOffset = $CurretOffset + 0x4
  580.                 If $data <> 0x0 Then
  581.                     $AtribData = _MemoryRead($data + 0x4, $d3, 'ptr')
  582.                     If StringLeft($AtribData, 7) = "0x0003B" Then
  583.                         ;ConsoleWrite("Debug :" &$data+0x4 & " : " & _MemoryRead($data+0x4, $d3, 'int') &@crlf) ;FOR DEBUGGING
  584.                         If "0x" & StringRight($AtribData, 3) = $_REQ[0] Then
  585.                             Return _MemoryRead($data + 0x8, $d3, $_REQ[1])
  586.                         EndIf
  587.                     EndIf
  588.                     If StringLeft($AtribData, 7) = "0xFFFFF" Then
  589.                         ;ConsoleWrite("Debug :" &$data+0x4 & " : " & _MemoryRead($data+0x4, $d3, 'int') &@crlf) ;FOR DEBUGGING
  590.                         If "0x" & StringRight($AtribData, 3) = $_REQ[0] Then
  591.                             Return _MemoryRead($data + 0x8, $d3, $_REQ[1])
  592.                         EndIf
  593.                     EndIf
  594.                 EndIf
  595.             Next
  596.             Return False
  597.         EndIf
  598.         $CurrentOffset = $CurrentOffset + $ofs_ActorAtrib_StrucSize
  599.     Next
  600.     Return False
  601. EndFunc   ;==>GetPackItemLevel
  602. ;;--------------------------------------------------------------------------------
  603. ;;  Getting Backpack Item Info, extended to show some more info
  604. ;;  $bag = 0 for backpack and 15 for stash
  605. ;;--------------------------------------------------------------------------------
  606. Func IterateBackpackExtendedWithLvl($bag = 0)
  607.     $list = IndexSNO($gameBalance)
  608.     $armorOffs = 0
  609.     $weaponOffs = 0
  610.     $otherOffs = 0
  611.     For $j = 0 To UBound($list) - 1
  612.         ;19750 = armor, 19754 = weapon, 1953 = other
  613.         If ($list[$j][1] = 19750) Then
  614.             $armorOffs = $list[$j][0]
  615.         EndIf
  616.         If ($list[$j][1] = 19754) Then
  617.             $weaponOffs = $list[$j][0]
  618.         EndIf
  619.         If ($list[$j][1] = 19753) Then
  620.             $otherOffs = $list[$j][0]
  621.         EndIf
  622.     Next
  623.     Local $armorItems = GetLevels($armorOffs)
  624.     Local $weaponItems = GetLevels($weaponOffs)
  625.     Local $otherItems = GetLevels($otherOffs)
  626.     Local $data = IterateBackpack($bag)
  627.     Local $armorItemsWithLvl = MapItemWithLvl($data, $armorItems, 8)
  628.     Local $weaponItemsWithLvl = MapItemWithLvl($data, $weaponItems, 8)
  629.     Local $otherItemsWithLvl = MapItemWithLvl($data, $otherItems, 8)
  630.     Local $allItems[UBound($armorItemsWithLvl, 1)][UBound($armorItemsWithLvl, 2)]
  631.     For $i = 0 To UBound($allItems) - 1 Step 1
  632.         If $armorItemsWithLvl[$i][9] <> "" Then
  633.             ;copy from $armorItemsWithLvl to all items
  634.             For $j = 0 To UBound($armorItemsWithLvl, 2) - 1 Step 1
  635.                 $allItems[$i][$j] = $armorItemsWithLvl[$i][$j]
  636.             Next
  637.         ElseIf $weaponItemsWithLvl[$i][9] <> "" Then
  638.             ;copy from $weaponItemsWithLvl to all items
  639.             For $j = 0 To UBound($weaponItemsWithLvl, 2) - 1 Step 1
  640.                 $allItems[$i][$j] = $weaponItemsWithLvl[$i][$j]
  641.             Next
  642.         ElseIf $otherItemsWithLvl[$i][9] <> "" Then
  643.             ;copy from $otherItemsWithLvl to all items
  644.             For $j = 0 To UBound($otherItemsWithLvl, 2) - 1 Step 1
  645.                 $allItems[$i][$j] = $otherItemsWithLvl[$i][$j]
  646.             Next
  647.         EndIf
  648.     Next
  649.  
  650.     Return $allItems
  651.  
  652. EndFunc   ;==>IterateBackpackExtendedWithLvl
  653.  
  654. ;;--------------------------------------------------------------------------------
  655. ;;  Maps snos containg a lvl to the item with that snoid
  656. ;;--------------------------------------------------------------------------------
  657. Func MapItemWithLvl($items, $snowithlvl, $indexForBGID)
  658.     Local $newItems = $items
  659.     ReDim $newItems[UBound($items, 1)][UBound($items, 2) + UBound($snowithlvl, 2) + 9] ;add size for some new variables
  660.     For $i = 0 To UBound($items) - 1 Step 1
  661.         For $j = 0 To UBound($snowithlvl) - 1 Step 1
  662.             If $snowithlvl[$j][0] = $items[$i][$indexForBGID] Then
  663.                 $newItems[$i][$indexForBGID + 1] = $snowithlvl[$j][1] ;ilvl
  664.                 $newItems[$i][$indexForBGID + 2] = $snowithlvl[$j][2] ;min dmg
  665.                 $newItems[$i][$indexForBGID + 3] = $snowithlvl[$j][3] ;;max dmg
  666.                 $newItems[$i][$indexForBGID + 4] = $snowithlvl[$j][4] ;;min armor
  667.                 $newItems[$i][$indexForBGID + 5] = $snowithlvl[$j][5] ;max armor
  668.                 $newItems[$i][$indexForBGID + 6] = $snowithlvl[$j][6] ;min dmg modifier
  669.                 $newItems[$i][$indexForBGID + 7] = $snowithlvl[$j][7] ;max dmg modifier
  670.                 $newItems[$i][$indexForBGID + 8] = $snowithlvl[$j][8] ;gold
  671.                 $newItems[$i][$indexForBGID + 9] = $snowithlvl[$j][9] ;weapon speed
  672.                 ;;some extra attributes
  673.                 $newItems[$i][$indexForBGID + 10] = IterateActorAtribs($newItems[$i][0], $Atrib_Item_Quality_Level) ;quality lvl
  674.                 $newItems[$i][$indexForBGID + 11] = IterateActorAtribs($newItems[$i][0], $Atrib_Strength_Item) ;str
  675.                 $newItems[$i][$indexForBGID + 12] = IterateActorAtribs($newItems[$i][0], $Atrib_Vitality_Item) ;vit
  676.                 $newItems[$i][$indexForBGID + 12] = IterateActorAtribs($newItems[$i][0], $Atrib_Intelligence_Item) ;int
  677.                 $newItems[$i][$indexForBGID + 13] = IterateActorAtribs($newItems[$i][0], $Atrib_Dexterity_Item) ;dex
  678.                 $newItems[$i][$indexForBGID + 15] = IterateActorAtribs($newItems[$i][0], $Atrib_Resistance_All) ;all res
  679.                 $newItems[$i][$indexForBGID + 16] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Gold_Find) * 100) ;gf in %
  680.                 $newItems[$i][$indexForBGID + 17] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Magic_Find) * 100) ;mf in %
  681.                 $newItems[$i][$indexForBGID + 18] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Hitpoints_Max_Percent_Bonus_Item) * 100) ;life %
  682.                 $newItems[$i][$indexForBGID + 19] = _MemoryRead($newItems[$i][7] + 0x164, $d3, 'int') > 0 ;0ffset + 164 ;true=unid, false=identified
  683.  
  684.                 ExitLoop
  685.             EndIf
  686.         Next
  687.     Next
  688.     Return $newItems
  689. EndFunc   ;==>MapItemWithLvl
  690.  
  691. ;;--------------------------------------------------------------------------------
  692. ;;  Gets levels from Gamebalance file, returns a list with snoid and lvl
  693. ;;--------------------------------------------------------------------------------
  694. Func GetLevels($offset)
  695.     If $offset <> 0 Then
  696.         $ofs = $offset + 0x218;
  697.         $read = _MemoryRead($ofs, $d3, 'int')
  698.         While $read = 0
  699.             $ofs += 0x4
  700.             $read = _MemoryRead($ofs, $d3, 'int')
  701.         WEnd
  702.         $size = _MemoryRead($ofs + 0x4, $d3, 'int')
  703.         $size -= 0x5F0
  704.         $ofs = $offset + _MemoryRead($ofs, $d3, 'int')
  705.         $nr = $size / 0x5F0
  706.         Local $snoItems[$nr + 1][10]
  707.         $j = 0
  708.         For $i = 0 To $size Step 0x5F0
  709.             $ofs_address = $ofs + $i
  710.             $snoItems[$j][0] = _MemoryRead($ofs_address, $d3, 'ptr')
  711.             $snoItems[$j][1] = _MemoryRead($ofs_address + 0x114, $d3, 'int') ;lvl
  712.             $snoItems[$j][2] = _MemoryRead($ofs_address + 0x1C8, $d3, 'float') ;min dmg
  713.             $snoItems[$j][3] = $snoItems[$j][2] + _MemoryRead($ofs_address + 0x1CC, $d3, 'float') ;max dmg
  714.             $snoItems[$j][4] = _MemoryRead($ofs_address + 0x224, $d3, 'float') ;min armor
  715.             $snoItems[$j][5] = $snoItems[$j][4] + _MemoryRead($ofs_address + 0x228, $d3, 'float') ;max armor
  716.             $snoItems[$j][6] = _MemoryRead($ofs_address + 0x32C, $d3, 'float') ;min dmg modifier
  717.             $snoItems[$j][7] = $snoItems[$j][4] + _MemoryRead($ofs_address + 0x330, $d3, 'float') ;max dmg modifier
  718.             $snoItems[$j][8] = _MemoryRead($ofs_address + 0x12C, $d3, 'int') ;gold price
  719.             $snoItems[$j][9] = _MemoryRead($ofs_address + 0x2D4, $d3, 'float') ;wpn speed
  720.             $j += 1
  721.         Next
  722.     EndIf
  723.  
  724.     Return $snoItems
  725. EndFunc   ;==>GetLevels
  726.  
  727.  
  728. ;;================================================================================
  729. ; Function:         ReturnAllActorAtribs($_GUID)
  730. ; Description:      Read the requested attribute data from a actor defined by GUID
  731. ; Parameter(s):     $_GUID - The GUID of the object you want the data from
  732. ;==================================================================================
  733.  
  734. Func ReturnAllActorAtribs($_GUID)
  735.  
  736.     Local $index, $offset, $count, $item[4]
  737.     startIterateLocalActor($index, $offset, $count)
  738.     While iterateLocalActorList($index, $offset, $count, $item)
  739.  
  740.         ; $item[0] ; $_ACTOR_ATRIB_GUID
  741.         ; $item[1] ; $_ACTOR_ATRIB_DATA
  742.         ; $item[2] ; $_ACTOR_ATRIB
  743.         ; $item[3] ; Item Offset
  744.  
  745.         If ($item[0] = ("0x" & Hex($_GUID))) Then ; we are the correct GUID
  746.  
  747.  
  748.  
  749.  
  750.             $_Count = _MemoryRead($_ActorAtrib_Count, $d3, 'int')
  751.             $CurrentOffset = $_ActorAtrib_4
  752.             Local $ACTORatrib
  753.             Local $ACTOR[20][2] ;20 should be enought
  754.             Local $j = 0
  755.  
  756.             For $i = 0 To $_Count
  757.                 $ACTORatrib = _MemoryRead($CurrentOffset, $d3, 'ptr')
  758.  
  759.                 If $ACTORatrib = $item[2] Then
  760.                     $CurretOffset = _MemoryRead($CurrentOffset + 0x10, $d3, 'ptr')
  761.                     For $i = 0 To 825
  762.                         $data = _MemoryRead($CurretOffset, $d3, 'ptr')
  763.                         $CurretOffset = $CurretOffset + 0x4
  764.                         If $data <> 0x0 Then
  765.                             $AtribData = _MemoryRead($data + 0x4, $d3, 'ptr')
  766.                             If StringLeft($AtribData, 7) = "0xFFFFF" Then
  767.                                 ;ConsoleWrite("Debug :" & $data + 0x4 & " : " & _MemoryRead($data + 0x4, $d3, 'ptr') & @CRLF) ;FOR DEBUGGING
  768.                                 $ACTOR[$j][0] = "0x" & StringRight($AtribData, 3)
  769.                                 $ACTOR[$j][1] = $data
  770.                                 $j += 1
  771.                                 If $j = UBound($ACTOR) Then
  772.                                     ReDim $ACTOR[$j * 2][2]
  773.                                 EndIf
  774.                             EndIf
  775.                         EndIf
  776.                     Next
  777.                     Return $ACTOR
  778.                 EndIf
  779.                 $CurrentOffset = $CurrentOffset + $ofs_ActorAtrib_StrucSize
  780.             Next
  781.         EndIf
  782.         ;ExitLoop
  783.     WEnd
  784.     Return False
  785. EndFunc   ;==>ReturnAllActorAtribs
  786.  
  787. ;;================================================================================
  788. ; Function:         SearchAttrib
  789. ;==================================================================================
  790. Func SearchAttrib($ACTOR, $_REQ)
  791.     $iMax = UBound($ACTOR)
  792.     For $i = 0 To $iMax - 1
  793.         If $ACTOR[$i][0] <> "" And $ACTOR[$i][0] = $_REQ[0] Then
  794.             Return _MemoryRead($ACTOR[$i][1] + 0x8, $d3, $_REQ[1])
  795.         EndIf
  796.     Next
  797.     Return False
  798. EndFunc   ;==>SearchAttrib
  799.  
  800.  
  801. Func FilterBackpack()
  802.  
  803.     Local $__ACDACTOR = IterateBackpack(0)
  804.  
  805.     Local $iMax = UBound($__ACDACTOR)
  806.     If $iMax > 0 Then
  807.         Local $return[$iMax][3]
  808.  
  809.         For $i = 0 To $iMax - 1
  810.             ; Loop each item in the backpack
  811.             If _MemoryRead($__ACDACTOR[$i][7] + 0x164, $d3, 'int') > 0 Then
  812.                 ; this item is unid, let's identify it
  813.                 Send("{SPACE}") ; make sure we close everything
  814.                 Send("i") ; open the inventory
  815.                 InventoryMove($__ACDACTOR[$i][3], $__ACDACTOR[$i][4])
  816.                 Sleep(Random(500, 1000))
  817.                 MouseClick("Right")
  818.                 Sleep(Random(3000, 3500))
  819.                 Send("{SPACE}") ; make sure we close everything
  820.             EndIf
  821.  
  822.             $itemDestination = CheckItem($__ACDACTOR[$i][0], $__ACDACTOR[$i][1])
  823.             $return[$i][0] = $__ACDACTOR[$i][3] ;col
  824.             $return[$i][1] = $__ACDACTOR[$i][4] ;row
  825.             $return[$i][2] = $itemDestination ;row
  826.         Next
  827.  
  828.         Return $return
  829.     EndIf
  830.     Return False
  831.  
  832.     ; After using this function, you can loop the return array and make inventorymove
  833.     ; InventoryMove($return[$i][0], $return[$i][1])
  834.  
  835.  
  836. EndFunc   ;==>FilterBackpack
  837.  
  838. ;;================================================================================
  839. ; Function:         CheckItem
  840. ; Description:      This will check a single item and tell if we keep it or not
  841. ;                   This function will be the core of the item filtering
  842. ;
  843. ; Return:           Trash
  844. ;                   Stash
  845. ;                   Salvage
  846. ;                   Inventory
  847. ;==================================================================================
  848. Func CheckItem($_GUID, $_NAME)
  849.         If checkFromGrabList($Potions, $_NAME) Then
  850.                 _log($_NAME & " ==> It's a pot")
  851.                 Return "Inventory"
  852.         ElseIf checkFromGrabList($grabList, $_NAME) Then
  853.                 _log($_NAME & " ==> It's in the grablist")
  854.                 Return "Stash"
  855.         ElseIf (IterateActorAtribs($_GUID, $Atrib_Item_Quality_Level) >= $QualityLevel) Then ; filter the magic and higher
  856.                 _log($_NAME & " ==> It's the quality level wich is set to " & $QualityLevel )
  857.                 Return "Stash"
  858.        ElseIf (IterateActorAtribs($_GUID, $Atrib_Item_Quality_Level) >= 6) and checkFromRareList($rareList, $_NAME) Then ; filter the magic and higher
  859.                 _log($_NAME & " ==> It's a rare in our list" & $QualityLevel )
  860.                 Return "Stash"
  861.             EndIf
  862.         Return "Trash"
  863. EndFunc   ;==>CheckItem
  864.  
  865.  
  866. Func InventoryMove($col = 0, $row = 0)
  867.     $Coords = UiRatio(530 + ($col * 27), 338 + ($row * 27))
  868.     MouseMove($Coords[0], $Coords[1], 5)
  869. EndFunc   ;==>InventoryMove
  870.  
  871. ;;--------------------------------------------------------------------------------
  872. ;;      Stop()
  873. ;;--------------------------------------------------------------------------------
  874. Func Stop()
  875.     Exit
  876. EndFunc   ;==>Stop
  877.  
  878. ;;================================================================================
  879. ; Function:         LocateMyToon
  880. ; Note(s):          This function is used by the OffsetList to
  881. ;                       get the current player data.
  882. ;==================================================================================
  883. Func LocateMyToon()
  884.     _ingame()
  885.     If $_debug Then ConsoleWrite("-----Looking for local player------" & @CRLF)
  886.     $_CurOffset = $_itrObjectManagerD
  887.     $_Count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
  888.     For $i = 0 To $_Count Step +1
  889.         $_GUID = _MemoryRead($_CurOffset + 0x4, $d3, 'ptr')
  890.         $_NAME = _MemoryRead($_CurOffset + 0x8, $d3, 'char[64]')
  891.         ;ConsoleWrite("Value : " & $_NAME & @CRLF)
  892.         ;_log($_NAME)
  893.         If $_GUID = 0x77BC0000 Then
  894.             Global $_Myoffset = $_CurOffset
  895.             If $_debug Then ConsoleWrite("My toon located at: " & $_Myoffset & ", GUID: " & $_GUID & ", NAME: " & $_NAME & @CRLF)
  896.             Return True
  897.             ExitLoop
  898.         EndIf
  899.         $_CurOffset = $_CurOffset + $_ObjmanagerStrucSize
  900.     Next
  901.     Return False
  902. EndFunc   ;==>LocateMyToon
  903.  
  904. ;;================================================================================
  905. ; Function:         IterateLocalActor
  906. ; Note(s):          Iterates through all the local actors.
  907. ;                       Used by IterateActorAtribs
  908. ;                   This is bad use of variables, should be fixed!
  909. ;==================================================================================
  910. Func IterateLocalActor()
  911.     ;$_Count = _MemoryRead($_LocalActor_Count, $d3, 'int')
  912.  
  913.     $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
  914.     $ptr2 = _memoryread($ptr1 + 0x850, $d3, "ptr")
  915.     $ptr3 = _memoryread($ptr2 + 0x0, $d3, "ptr")
  916.     $_Count = _memoryread($ptr3 + 0x108, $d3, "int")
  917.  
  918.     $CurrentOffset = _memoryread(_memoryread($ptr3 + 0x148, $d3, "ptr") + 0x0, $d3, "ptr");$_LocalActor_3
  919.  
  920.     Global $__ACTOR[$_Count + 1][4]
  921.  
  922.     For $i = 0 To $_Count
  923.         $__ACTOR[$i][1] = _MemoryRead($CurrentOffset, $d3, 'ptr')
  924.         $__ACTOR[$i][2] = _MemoryRead($CurrentOffset + 0x4, $d3, 'char[64]')
  925.         $__ACTOR[$i][3] = _MemoryRead($CurrentOffset + $ofs_LocalActor_atribGUID, $d3, 'ptr')
  926.         ;_log($__ACTOR[$i][1] & " : " & $__ACTOR[$i][2] & " : " & $__ACTOR[$i][3])
  927.         $CurrentOffset = $CurrentOffset + $ofs_LocalActor_StrucSize
  928.  
  929.     Next
  930. EndFunc   ;==>IterateLocalActor
  931.  
  932.  
  933. Func startIterateLocalActor(ByRef $index, ByRef $offset, ByRef $count)
  934.     $ptr1 = _memoryread($ofs_objectmanager, $d3, "ptr")
  935.     $ptr2 = _memoryread($ptr1 + $ofs__ObjmanagerActorOffsetA, $d3, "ptr")
  936.     $count = _memoryread($ptr2 + $ofs_LocalActor_Count, $d3, "int")
  937.     $index = 0
  938.     $offset = _memoryread(_memoryread($ptr2 + 0x148, $d3, "ptr") + 0x0, $d3, "ptr");$_LocalActor_3
  939. EndFunc   ;==>startIterateLocalActor
  940.  
  941. Func iterateLocalActorList(ByRef $index, ByRef $offset, ByRef $count, ByRef $item)
  942.     While 1
  943.         If $index > $count Then Return False
  944.         $index += 1
  945.         $item[0] = _MemoryRead($offset, $d3, 'ptr') ; $_ACTOR_ATRIB_GUID
  946.         $item[1] = _MemoryRead($offset + 0x4, $d3, 'char[64]') ; $_ACTOR_ATRIB_DATA
  947.         $item[2] = _MemoryRead($offset + $ofs_LocalActor_atribGUID, $d3, 'ptr') ; $_ACTOR_ATRIB
  948.         $item[3] = $offset ; Item Offset
  949.         $offset = $offset + $ofs_LocalActor_StrucSize
  950.         Return True
  951.     WEnd
  952. EndFunc   ;==>iterateLocalActorList
  953.  
  954. ;;================================================================================
  955. ; Function:         IterateActorAtribs($_GUID,$_REQ)
  956. ; Description:      Read the requested attribute data from a actor defined by GUID
  957. ; Parameter(s):     $_GUID - The GUID of the object you want the data from
  958. ;                   $_REQ - The data you want to request (the variable)
  959. ;
  960. ; Note(s):          You can find a list of all the $_REQ variables in the Constants() function
  961. ;                   It should be noted that i have not checked them all through
  962. ;                       so the type ("float" or "int") might be wrong.
  963. ;                   This function will always return "false" if the requested atribute does not exsist
  964. ;==================================================================================
  965. Func IterateActorAtribs($_GUID, $_REQ)
  966.  
  967.  
  968.     IterateLocalActor()
  969.  
  970.     $ACDIndex = _ArraySearch($__ACTOR, "0x" & Hex($_GUID), 0, 0, 0, 1, 1, 1) ;this bitch is slow as hell
  971.     If $ACDIndex = -1 Then Return False ;FIX
  972.  
  973.     If $_REQ[1] = 'float' Then
  974.         Return $AttribInterop.GetAttributeFloat($__ACTOR[$ACDIndex][3], $_REQ[0])
  975.     Else
  976.         Return $AttribInterop.GetAttributeInt($__ACTOR[$ACDIndex][3], $_REQ[0])
  977.     EndIf
  978.  
  979.     Return False
  980.  
  981. EndFunc   ;==>IterateActorAtribs
  982.  
  983. ;;================================================================================
  984. ; Function:         LinkActors
  985. ; Description:      Read and index data from the specified offset
  986. ; Parameter(s):     $_offset - The offset linking to the file def
  987. ;                               be in hex format (0x00000000).
  988. ;                   $_displayInfo - Setting this to 1 will make the function spit
  989. ;                               out the results while running
  990. ; Note(s):          This function is used to index data from the MPQ files that
  991. ;                   that have been loaded into memory.
  992. ;                   Im not sure why the count doesnt go beyond 256.
  993. ;                   So for the time being if the count goes beyond 256 the size
  994. ;                   is set to a specified count and then the array will be scaled
  995. ;                   after when data will stop being available.
  996. ;==================================================================================
  997. Func LinkActors($OBject, $_displayInfo = 0)
  998.     Global $OBject_Mem_Actor = $OBject
  999.     Global $Object_File_Actor = IndexSNO($ofs_ActorDef, 0)
  1000.     Global $Object_File_Monster = IndexSNO($ofs_MonsterDef, 0)
  1001.     Dim $__outputdata[UBound($OBject_Mem_Actor, 1) - 1][2]
  1002.     For $i = 0 To UBound($OBject_Mem_Actor, 1) - 1
  1003.         If $OBject_Mem_Actor[$i][9] <> -1 Then
  1004.             $ItemIndex = _ArraySearch($Object_File_Actor, $OBject_Mem_Actor[$i][9], 0, 0, 0, 1, 1, 1)
  1005.             If $ItemIndex > 0 Then
  1006.                 $MonsterID = _MemoryRead($Object_File_Actor[$ItemIndex][0] + 0x6c, $d3, 'ptr')
  1007.                 $ItemIndex = _ArraySearch($Object_File_Monster, $MonsterID, 0, 0, 0, 1, 1, 1)
  1008.                 If $ItemIndex > 0 Then
  1009.                     $Type = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_MonsterType, $d3, 'int')
  1010.                     $MonsterType = $_Const_MonsterType[$Type + 1]
  1011.                     $Race = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_MonsterRace, $d3, 'int')
  1012.                     $MonsterRace = $_Const_MonsterRace[$Race + 1]
  1013.  
  1014.                     $LevelNormal = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_LevelNormal, $d3, 'int') ;//Here are some data you can use if you want,
  1015.                     $LevelNightmare = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_LevelNightmare, $d3, 'int') ;//...it gives info about levels based on dificulty
  1016.                     $LevelHell = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_LevelHell, $d3, 'int')
  1017.                     $LevelInferno = _MemoryRead($Object_File_Monster[$ItemIndex][0] + $_ofs_FileMonster_LevelInferno, $d3, 'int')
  1018.  
  1019.                     $OBject_Mem_Actor[$i][11] = $Type
  1020.                     $OBject_Mem_Actor[$i][12] = $Race
  1021.                     ;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)
  1022.                 EndIf
  1023.             EndIf
  1024.         EndIf
  1025.     Next
  1026.     Return $OBject_Mem_Actor
  1027. EndFunc   ;==>LinkActors
  1028.  
  1029. ;;================================================================================
  1030. ; Function:         IndexSNO($_offset[,$_displayInfo = 0])
  1031. ; Description:      Read and index data from the specified offset
  1032. ; Parameter(s):     $_offset - The offset linking to the file def
  1033. ;                               be in hex format (0x00000000).
  1034. ;                   $_displayInfo - Setting this to 1 will make the function spit
  1035. ;                               out the results while running
  1036. ; Note(s):          This function is used to index data from the MPQ files that
  1037. ;                   that have been loaded into memory.
  1038. ;                   Im not sure why the count doesnt go beyond 256.
  1039. ;                   So for the time being if the count goes beyond 256 the size
  1040. ;                   is set to a specified count and then the array will be scaled
  1041. ;                   after when data will stop being available.
  1042. ;==================================================================================
  1043. Func IndexSNO($_offset, $_displayInfo = 0)
  1044.     Local $CurrentSnoOffset = 0x0
  1045.     $_MainOffset = _MemoryRead($_offset, $d3, 'ptr')
  1046.     $_Pointer = _MemoryRead($_MainOffset + $_defptr, $d3, 'ptr')
  1047.     $_SnoCount = _MemoryRead($_Pointer + $_defcount, $d3, 'ptr') ;//Doesnt seem to go beyond 256 for some wierd reason
  1048.     If $_SnoCount >= 256 Then ;//So incase it goes beyond...
  1049.         $ignoreSNOcount = 1 ;//This enables a redim after the for loop
  1050.         $_SnoCount = 4056 ;//We put a limit to avoid overflow here
  1051.     Else
  1052.         $ignoreSNOcount = 0
  1053.     EndIf
  1054.     $_SnoIndex = _MemoryRead($_Pointer + $_deflink, $d3, 'ptr') ;//Moving from the static into the index
  1055.     $_SNOName = _MemoryRead($_Pointer, $d3, 'char[64]') ;//Usually something like "Something" + Def
  1056.     $TempWindex = $_SnoIndex + 0xC ;//The header is 0xC in size
  1057.     If $_displayInfo = 1 Then ConsoleWrite("-----* Indexing " & $_SNOName & " *-----" & @CRLF)
  1058.     Dim $_OutPut[$_SnoCount + 1][2] ;//Setting the size of the output array
  1059.     For $i = 1 To $_SnoCount Step +1 ;//Iterating through all the elements
  1060.         $_CurSnoOffset = _MemoryRead($TempWindex, $d3, 'ptr') ;//Getting the offset for the item
  1061.         $_CurSnoID = _MemoryRead($_CurSnoOffset, $d3, 'ptr') ;//Going into the item and grapping the GUID which is located at 0x0
  1062.         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.
  1063.         If $ignoreSNOcount = 1 Then $CurIndex = $i
  1064.         $_OutPut[$i][0] = $_CurSnoOffset ;//Poping the data into the output array
  1065.         $_OutPut[$i][1] = $_CurSnoID
  1066.         If $_displayInfo = 1 Then ConsoleWrite($i & " Offset: " & $_CurSnoOffset & " SNOid: " & $_CurSnoID & @CRLF)
  1067.         $TempWindex = $TempWindex + 0x10 ;//Next item is located 0x10 later
  1068.     Next
  1069.     If $ignoreSNOcount = 1 Then ReDim $_OutPut[$CurIndex][2] ;//Here we do the resizing of the array, to minimize memory footprint!?.
  1070.     Return $_OutPut
  1071. EndFunc   ;==>IndexSNO
  1072.  
  1073. ;;================================================================================
  1074. ; Function:         IndexStringList($_offset)
  1075. ; Description:      Read and index data from the specified offset
  1076. ; Parameter(s):     $_offset - The offset linking to the file def
  1077. ;                                 be in hex format (0x00000000).
  1078. ;                   $_displayInfo - Setting this to 1 will make the function spit
  1079. ;                               out the results while running
  1080. ;
  1081. ; Note(s):          This function is made specificly to index string lists.
  1082. ;                   This is usefull for getting real localized names from the
  1083. ;                   proxy names you get from the objectmanager strucs.
  1084. ;                   i have only test this on monster names but it should work for all.
  1085. ;==================================================================================
  1086. Func IndexStringList($_offset, $_displayInfo = 0)
  1087.     $_offset_FileMonster_StrucSize = 0x50
  1088.     $_StringCount = _MemoryRead($_offset + 0xc, $d3, 'int')
  1089.     $_CurrentOffset = $_offset + 0x28
  1090.     Dim $_OutPut[$_StringCount][2]
  1091.     For $i = 0 To $_StringCount - 1
  1092.         $_OutPut[$i][0] = _MemoryRead(_MemoryRead($_CurrentOffset, $d3, 'int'), $d3, 'char[32]') ;Proxy Name, like "Priest_Male_B_NoLook"
  1093.         $_OutPut[$i][1] = _MemoryRead(_MemoryRead($_CurrentOffset + 0x10, $d3, 'int'), $d3, 'char[34]') ;Localized name, like "Brother Malachi the Healer"
  1094.         Assign("__" & $_OutPut[$i][0], $_OutPut[$i][1], 2)
  1095.         $_CurrentOffset = $_CurrentOffset + $_offset_FileMonster_StrucSize
  1096.         If $_displayInfo = 1 Then ConsoleWrite($_CurrentOffset & " ProxyName: " & $_OutPut[$i][0] & @TAB & " LocalizedName: " & $_OutPut[$i][1] & @CRLF)
  1097.     Next
  1098.     Return $_OutPut
  1099. EndFunc   ;==>IndexStringList
  1100.  
  1101.  
  1102.  
  1103. ;;--------------------------------------------------------------------------------
  1104. ;;  OffsetList()
  1105. ;;--------------------------------------------------------------------------------
  1106. Func offsetlist()
  1107.  
  1108.     ;//FILE DEFS
  1109.     Global $ofs_MonsterDef = 0x15DBE00 ;0x015DCE00 ;0x15DBE00
  1110.     Global $ofs_StringListDef = 0x0158C240 ;0x015E8808 ;0x015E9808
  1111.     Global $ofs_ActorDef = 0x15EC108 ;0x015ED108 ;0x15EC108
  1112.  
  1113.     Global $_defptr = 0x3c
  1114.     Global $_defcount = 0x10C
  1115.     Global $_deflink = 0x148
  1116.  
  1117.     Global $_ofs_FileMonster_StrucSize = 0x50
  1118.  
  1119.     Global $_ofs_FileActor_LinkToMonster = 0x6C
  1120.  
  1121.     Global $_ofs_FileMonster_MonsterType = 0x18
  1122.     Global $_ofs_FileMonster_MonsterRace = 0x1C
  1123.     Global $_ofs_FileMonster_LevelNormal = 0x44
  1124.     Global $_ofs_FileMonster_LevelNightmare = 0x48
  1125.     Global $_ofs_FileMonster_LevelHell = 0x4c
  1126.     Global $_ofs_FileMonster_LevelInferno = 0x50
  1127.  
  1128.     ;//GET ACTORATRIB
  1129.     Global $ofs_ActorAtrib_Base = 0x1544E54 ;0x15A1EA4 ;0x015A2EA4;0x015A1EA4
  1130.     Global $ofs_ActorAtrib_ofs1 = 0x390
  1131.     Global $ofs_ActorAtrib_ofs2 = 0x2E8
  1132.     Global $ofs_ActorAtrib_ofs3 = 0x148
  1133.     Global $ofs_ActorAtrib_Count = 0x108 ; 0x0 0x0
  1134.  
  1135.     Global $ofs_ActorAtrib_Indexing_ofs1 = 0x10
  1136.     Global $ofs_ActorAtrib_Indexing_ofs2 = 0x8
  1137.     Global $ofs_ActorAtrib_Indexing_ofs3 = 0x250
  1138.     Global $ofs_ActorAtrib_StrucSize = 0x180
  1139.  
  1140.     Global $ofs_LocalPlayer_HPBARB = 0x34
  1141.     Global $ofs_LocalPlayer_HPWIZ = 0x38
  1142.  
  1143.  
  1144.     ;//GET LOCAL ACTOR STRUC
  1145.     Global $ofs_LocalActor_ofs1 = 0x378 ;instead of $ofs_ActorAtrib_ofs2
  1146.     Global $ofs_LocalActor_ofs2 = 0x148
  1147.     Global $ofs_LocalActor_Count = 0x108
  1148.     Global $ofs_LocalActor_atribGUID = 0x120
  1149.     Global $ofs_LocalActor_StrucSize = 0x2D0 ; 0x0 0x0
  1150.  
  1151.  
  1152.     ;//OBJECT MANAGER
  1153.     Global $ofs_objectmanager = 0x1543B9C ;0x15A0BEC ;0x015A1BEC;0x15A0BEC
  1154.     Global $ofs__ObjmanagerActorOffsetA = 0x8b0
  1155.     Global $ofs__ObjmanagerActorCount = 0x108
  1156.     Global $ofs__ObjmanagerActorOffsetB = 0x148
  1157.     Global $ofs__ObjmanagerActorLinkToCTM = 0x380
  1158.     Global $_ObjmanagerStrucSize = 0x428
  1159.  
  1160.  
  1161.  
  1162.     ;//CameraDef
  1163.     Global $VIewStatic = 0x015A0BEC
  1164.     Global $DebugFlags = $VIewStatic + 0x20
  1165.     Global $vftableSubA = _MemoryRead($VIewStatic, $d3, 'ptr')
  1166.     Global $vftableSubA = _MemoryRead($vftableSubA + 0x928, $d3, 'ptr')
  1167.     Global $ViewOffset = $vftableSubA
  1168.  
  1169.     Global $Ofs_CameraRotationA = $ViewOffset + 0x4
  1170.     Global $Ofs_CameraRotationB = $ViewOffset + 0x8
  1171.     Global $Ofs_CameraRotationC = $ViewOffset + 0xC
  1172.     Global $Ofs_CameraRotationD = $ViewOffset + 0x10
  1173.     Global $Ofs_CameraPosX = $ViewOffset + 0x14
  1174.     Global $Ofs_CameraPosY = $ViewOffset + 0x18
  1175.     Global $Ofs_CameraPosZ = $ViewOffset + 0x1C
  1176.     Global $Ofs_CameraFOV = $ViewOffset + 0x30
  1177.     Global $Ofs_CameraFOVB = $ViewOffset + 0x30
  1178.  
  1179.  
  1180.     Global $ofs_InteractBase = 0x1543B84 ;0x15A0BD4 ;0x015A1BD4;0x15A0BD4
  1181.     Global $ofs__InteractOffsetA = 0xA8
  1182.     Global $ofs__InteractOffsetB = 0x58
  1183.     Global $ofs__InteractOffsetUNK1 = 0x7F20 ;Set to 777c
  1184.     Global $ofs__InteractOffsetUNK2 = 0x7F44 ;Set to 1 for NPC interaction
  1185.     Global $ofs__InteractOffsetUNK3 = 0x7F7C ;Set to 7546 for NPC interaction, 7545 for loot interaction
  1186.     Global $ofs__InteractOffsetUNK4 = 0x7F80 ;Set to 7546 for NPC interaction, 7545 for loot interaction
  1187.     Global $ofs__InteractOffsetMousestate = 0x7F84 ;Mouse state 1 = clicked, 2 = mouse down
  1188.     Global $ofs__InteractOffsetGUID = 0x7F88 ;Set to the GUID of the actor you want to interact with
  1189.  
  1190.     $FixSpeed = 0x20 ;69736
  1191.     $ToggleMove = 0x34
  1192.     $MoveToXoffset = 0x40
  1193.     $MoveToYoffset = 0x44
  1194.     $MoveToZoffset = 0x48
  1195.     $CurrentX = 0xA8
  1196.     $CurrentY = 0xAc
  1197.     $CurrentZ = 0xb0
  1198.     $RotationOffset = 0x174
  1199.  
  1200.     Global $_ActorAtrib_Base = _MemoryRead($ofs_ActorAtrib_Base, $d3, 'ptr')
  1201.     Global $_ActorAtrib_1 = _MemoryRead($_ActorAtrib_Base + $ofs_ActorAtrib_ofs1, $d3, 'ptr')
  1202.     Global $_ActorAtrib_2 = _MemoryRead($_ActorAtrib_1 + $ofs_ActorAtrib_ofs2, $d3, 'ptr')
  1203.     Global $_ActorAtrib_3 = _MemoryRead($_ActorAtrib_2 + $ofs_ActorAtrib_ofs3, $d3, 'ptr')
  1204.     Global $_ActorAtrib_4 = _MemoryRead($_ActorAtrib_3, $d3, 'ptr')
  1205.     Global $_ActorAtrib_Count = $_ActorAtrib_2 + $ofs_ActorAtrib_Count
  1206.  
  1207.     Global $_LocalActor_1 = _MemoryRead($_ActorAtrib_1 + $ofs_LocalActor_ofs1, $d3, 'ptr')
  1208.     Global $_LocalActor_2 = _MemoryRead($_LocalActor_1 + $ofs_LocalActor_ofs2, $d3, 'ptr')
  1209.  
  1210.  
  1211.     Global $_LocalActor_3 = _MemoryRead($_LocalActor_2, $d3, 'ptr')
  1212.     Global $_LocalActor_Count = $_LocalActor_1 + $ofs_LocalActor_Count
  1213.  
  1214.  
  1215.     Global $_itrObjectManagerA = _MemoryRead($ofs_objectmanager, $d3, 'ptr')
  1216.     Global $_itrObjectManagerB = _MemoryRead($_itrObjectManagerA + $ofs__ObjmanagerActorOffsetA, $d3, 'ptr')
  1217.     Global $_itrObjectManagerCount = $_itrObjectManagerB + $ofs__ObjmanagerActorCount
  1218.     Global $_itrObjectManagerC = _MemoryRead($_itrObjectManagerB + $ofs__ObjmanagerActorOffsetB, $d3, 'ptr')
  1219.     Global $_itrObjectManagerD = _MemoryRead($_itrObjectManagerC, $d3, 'ptr')
  1220.     Global $_itrObjectManagerE = _MemoryRead($_itrObjectManagerD, $d3, 'ptr')
  1221.  
  1222.     Global $_itrInteractA = _MemoryRead($ofs_InteractBase, $d3, 'ptr')
  1223.     Global $_itrInteractB = _MemoryRead($_itrInteractA, $d3, 'ptr')
  1224.     Global $_itrInteractC = _MemoryRead($_itrInteractB, $d3, 'ptr')
  1225.     Global $_itrInteractD = _MemoryRead($_itrInteractC + $ofs__InteractOffsetA, $d3, 'ptr')
  1226.     Global $_itrInteractE = $_itrInteractD + $ofs__InteractOffsetB
  1227.  
  1228.  
  1229.     ;IterateObjectList(0)
  1230.  
  1231.     Global $Object_File_StringList = IndexSNO($ofs_StringListDef, 0) ;//THIS LIST IS HUGE, NO NEED TO DO IT MORE OFTEN THAN ONCE =)
  1232.  
  1233.     $index = _ArraySearch($Object_File_StringList, Hex($_MonsterNameStringListID), 0, 0, 0, 1, 1, 1)
  1234.     If $index = -1 Then
  1235.         Return False
  1236.  
  1237.     EndIf
  1238.  
  1239.     Global $StringListDB = IndexStringList($Object_File_StringList[$index][0]) ;$StringListDB is debricated in this code
  1240.  
  1241.     $index = _ArraySearch($Object_File_StringList, Hex($_GizmoNameStringListID), 0, 0, 0, 1, 1, 1)
  1242.  
  1243.     If $index > -1 Then
  1244.         IndexStringList($Object_File_StringList[$index][0])
  1245.     EndIf
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.     If LocateMyToon() Then
  1253.  
  1254.         Global $ClickToMoveMain = _MemoryRead($_Myoffset + $ofs__ObjmanagerActorLinkToCTM, $d3, 'ptr')
  1255.         Global $ClickToMoveRotation = $ClickToMoveMain + $RotationOffset
  1256.         Global $ClickToMoveCurX = $ClickToMoveMain + $CurrentX
  1257.         Global $ClickToMoveCurY = $ClickToMoveMain + $CurrentY
  1258.         Global $ClickToMoveCurZ = $ClickToMoveMain + $CurrentZ
  1259.         Global $ClickToMoveToX = $ClickToMoveMain + $MoveToXoffset
  1260.         Global $ClickToMoveToY = $ClickToMoveMain + $MoveToYoffset
  1261.         Global $ClickToMoveToZ = $ClickToMoveMain + $MoveToZoffset
  1262.         Global $ClickToMoveToggle = $ClickToMoveMain + $ToggleMove
  1263.         Global $ClickToMoveFix = $ClickToMoveMain + $FixSpeed
  1264.         Return True
  1265.     Else
  1266.         Return False
  1267.     EndIf
  1268.  
  1269. EndFunc   ;==>offsetlist
  1270.  
  1271. ;;--------------------------------------------------------------------------------
  1272. ;;      IterateAllObjectList()
  1273. ;;      Description:        Iterate object even if they dont have guid, also provide true names
  1274. ;;--------------------------------------------------------------------------------
  1275. Func IterateAllObjectList($_displayInfo)
  1276.     If $_displayInfo = 1 Then ConsoleWrite("-----Iterating through Actors------" & @CRLF)
  1277.     If $_displayInfo = 1 Then ConsoleWrite("First Actor located at: " & $_itrObjectManagerD & @CRLF)
  1278.     $_CurOffset = $_itrObjectManagerD
  1279.     $_Count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
  1280.     Dim $OBJ[$_Count + 1][10]
  1281.     If $_displayInfo = 1 Then ConsoleWrite("Number of Actors : " & $_Count & @CRLF)
  1282.     For $i = 0 To $_Count Step +1
  1283.         $_GUID = _MemoryRead($_CurOffset + 0x4, $d3, 'ptr')
  1284.         $_NAME = _MemoryRead($_CurOffset + 0x8, $d3, 'char[64]')
  1285.         $_POS_X = _MemoryRead($_CurOffset + 0xB0, $d3, 'float')
  1286.         $_POS_Y = _MemoryRead($_CurOffset + 0xB4, $d3, 'float')
  1287.         $_POS_Z = _MemoryRead($_CurOffset + 0xB8, $d3, 'float')
  1288.         $_DATA = _MemoryRead($_CurOffset + 0x1FC, $d3, 'int')
  1289.         $_DATA2 = _MemoryRead($_CurOffset + 0x1Cc, $d3, 'int')
  1290.         $_DATA3 = _MemoryRead($_CurOffset + 0x1C0, $d3, 'int')
  1291.  
  1292.  
  1293.  
  1294.         $CurrentLoc = GetCurrentPos()
  1295.         $xd = $_POS_X - $CurrentLoc[0]
  1296.         $yd = $_POS_Y - $CurrentLoc[1]
  1297.         $zd = $_POS_Z - $CurrentLoc[2]
  1298.         $Distance = Sqrt($xd * $xd + $yd * $yd + $zd * $zd)
  1299.         $OBJ[$i][0] = $i
  1300.         $OBJ[$i][1] = $_GUID
  1301.         $OBJ[$i][2] = $_NAME
  1302.         $OBJ[$i][3] = $_POS_X
  1303.         $OBJ[$i][4] = $_POS_Y
  1304.         $OBJ[$i][5] = $_POS_Z
  1305.         $OBJ[$i][6] = $_DATA
  1306.         $OBJ[$i][7] = $_DATA2
  1307.         $OBJ[$i][8] = $Distance
  1308.         $OBJ[$i][9] = $_CurOffset
  1309.  
  1310.  
  1311.         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)
  1312.         ;if $_displayINFO = 1 then ConsoleWrite($i & @TAB&" : " & $_POS_X & @TAB& $_POS_Y & @TAB & $_POS_Z & @TAB& $_NAME & @crlf)
  1313.         $_CurOffset = $_CurOffset + $_ObjmanagerStrucSize
  1314.  
  1315.  
  1316.     Next
  1317.     Return $OBJ
  1318.  
  1319. EndFunc   ;==>IterateAllObjectList
  1320.  
  1321.  
  1322. ;;--------------------------------------------------------------------------------
  1323. ;;  IterateObjectList()
  1324. ;;--------------------------------------------------------------------------------
  1325. Func IterateObjectList($_displayInfo = 0)
  1326.     ;   Local $mesureobj = TimerInit() ;;;;;;;;;;;;;;
  1327.     If $_displayInfo = 1 Then ConsoleWrite("-----Iterating through Actors------" & @CRLF)
  1328.     If $_displayInfo = 1 Then ConsoleWrite("First Actor located at: " & $_itrObjectManagerD & @CRLF)
  1329.     $_CurOffset = $_itrObjectManagerD
  1330.     $_Count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
  1331.     Dim $OBJ[$_Count + 1][13]
  1332.     If $_displayInfo = 1 Then ConsoleWrite("Number of Actors : " & $_Count & @CRLF)
  1333.     ;$init = TimerInit()
  1334.     For $i = 0 To $_Count Step +1
  1335.         $_GUID = _MemoryRead($_CurOffset + 0x4, $d3, 'ptr')
  1336.         If $_GUID = 0xffffffff Then ;no need to go through objects without a GUID!
  1337.             $_PROXY_NAME = -1
  1338.             $_REAL_NAME = -1
  1339.             $_ACTORLINK = -1
  1340.             $_POS_X = -1
  1341.             $_POS_Y = -1
  1342.             $_POS_Z = -1
  1343.             $_DATA = -1
  1344.             $_DATA2 = -1
  1345.         Else
  1346.             $_PROXY_NAME = _MemoryRead($_CurOffset + 0x8, $d3, 'char[64]')
  1347.             $TmpString = StringSplit($_PROXY_NAME, "-")
  1348.             If IsDeclared("__" & $TmpString[1]) Then
  1349.                 $_REAL_NAME = Eval("__" & $TmpString[1])
  1350.             Else
  1351.                 $_REAL_NAME = $_PROXY_NAME
  1352.             EndIf
  1353.             $_ACTORLINK = _MemoryRead($_CurOffset + 0x88, $d3, 'ptr')
  1354.             $_POS_X = _MemoryRead($_CurOffset + 0xB0, $d3, 'float')
  1355.             $_POS_Y = _MemoryRead($_CurOffset + 0xB4, $d3, 'float')
  1356.             $_POS_Z = _MemoryRead($_CurOffset + 0xB8, $d3, 'float')
  1357.             $_DATA = _MemoryRead($_CurOffset + 0x1FC, $d3, 'int')
  1358.             $_DATA2 = _MemoryRead($_CurOffset + 0x1Cc, $d3, 'int')
  1359.             If $_displayInfo = 1 Then ConsoleWrite($i & @TAB & " : " & $_CurOffset & " " & $_GUID & " " & $_ACTORLINK & " : " & $_DATA & " " & $_DATA2 & " " & @TAB & $_POS_X & " " & $_POS_Y & " " & $_POS_Z & @TAB & $_REAL_NAME & @CRLF)
  1360.         EndIf
  1361.  
  1362.         ;Im too lazy to do this but the following code needs cleanup and restructure more than anything.
  1363.         ;You want to include all the data into this one structure rather than having it at multiple locations
  1364.         ;and the useless things should be removed.
  1365.         $CurrentLoc = GetCurrentPos()
  1366.         $xd = $_POS_X - $CurrentLoc[0]
  1367.         $yd = $_POS_Y - $CurrentLoc[1]
  1368.         $zd = $_POS_Z - $CurrentLoc[2]
  1369.  
  1370.         $Distance = Sqrt($xd * $xd + $yd * $yd + $zd * $zd)
  1371.         $OBJ[$i][0] = $_CurOffset
  1372.         $OBJ[$i][1] = $_GUID
  1373.         $OBJ[$i][2] = $_PROXY_NAME
  1374.         $OBJ[$i][3] = $_POS_X
  1375.         $OBJ[$i][4] = $_POS_Y
  1376.         $OBJ[$i][5] = $_POS_Z
  1377.         $OBJ[$i][6] = $_DATA
  1378.         $OBJ[$i][7] = $_DATA2
  1379.         $OBJ[$i][8] = $Distance
  1380.         $OBJ[$i][9] = $_ACTORLINK
  1381.         $OBJ[$i][10] = $_REAL_NAME
  1382.         $OBJ[$i][11] = -1
  1383.         $OBJ[$i][12] = -1
  1384.         $_CurOffset = $_CurOffset + $_ObjmanagerStrucSize
  1385.  
  1386.     Next
  1387.     $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.
  1388.     IterateLocalActor()
  1389.     ;   Local $difmesureobj = TimerDiff($mesureobj) ;;;;;;;;;;;;;
  1390.     ;ConsoleWrite("Mesure iterOBJ :" & $difmesureobj &@crlf) ;FOR DEBUGGING;;;;;;;;;;;;
  1391.     Return $OBJv2
  1392.  
  1393. EndFunc   ;==>IterateObjectList
  1394.  
  1395.  
  1396. ;;--------------------------------------------------------------------------------
  1397. ;;      Function to iterate all objects()
  1398. ;;--------------------------------------------------------------------------------
  1399.  
  1400. Func startIterateObjectsList(ByRef $index, ByRef $offset, ByRef $count)
  1401.     $count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
  1402.     $index = 0
  1403.     $offset = $_itrObjectManagerD
  1404. EndFunc   ;==>startIterateObjectsList
  1405.  
  1406. Func iterateObjectsList(ByRef $index, ByRef $offset, ByRef $count, ByRef $item)
  1407.     While 1
  1408.         If $index > $count Then Return False
  1409.         $index += 1
  1410.         $item[0] = _MemoryRead($offset + 0x4, $d3, 'ptr') ; GUID
  1411.         $item[1] = _MemoryRead($offset + 0x8, $d3, 'char[64]') ; Name
  1412.         $item[2] = _MemoryRead($offset + 0xB0, $d3, 'float') ; PosX
  1413.         $item[3] = _MemoryRead($offset + 0xB4, $d3, 'float') ; PosY
  1414.         $item[4] = _MemoryRead($offset + 0xB8, $d3, 'float') ; PosZ
  1415.         $item[5] = _MemoryRead($offset + 0x1FC, $d3, 'int') ; Data1
  1416.         $item[6] = _MemoryRead($offset + 0x1CC, $d3, 'int') ; Data2
  1417.         $item[7] = _MemoryRead($offset + 0x1C0, $d3, 'int') ; Data3
  1418.         $item[8] = $offset ; Current Offset
  1419.         $item[9] = getDistance($item[2], $item[3], $item[4]) ; Distance
  1420.         $offset = $offset + $_ObjmanagerStrucSize
  1421.         Return True
  1422.     WEnd
  1423. EndFunc   ;==>iterateObjectsList
  1424.  
  1425. ;;--------------------------------------------------------------------------------
  1426. ;;      FromD3toScreenCoords()
  1427. ;;--------------------------------------------------------------------------------
  1428. Func FromD3toScreenCoords($_x, $_y, $_z)
  1429.     Dim $return[2]
  1430.     $size = WinGetClientSize("Diablo III")
  1431.     $resolutionX = $size[0]
  1432.     $resolutionY = $size[1]
  1433.     $aspectChange = ($resolutionX / $resolutionY) / (800 / 600)
  1434.  
  1435.     $CurrentLoc = GetCurrentPos()
  1436.     $xd = $_x - $CurrentLoc[0]
  1437.     $yd = $_y - $CurrentLoc[1]
  1438.     $zd = $_z - $CurrentLoc[2]
  1439.  
  1440.     $w = -0.515 * $xd + - 0.514 * $yd + - 0.686 * $zd + 97.985
  1441.  
  1442.     $X = (-1.682 * $xd + 1.683 * $yd + 0 * $zd + 7.045E-3) / $w
  1443.     $Y = (-1.54 * $xd + - 1.539 * $yd + 2.307 * $zd + 6.161) / $w
  1444.     $Z = (-0.515 * $xd + - 0.514 * $yd + - 0.686 * $zd + 97.002) / $w
  1445.  
  1446.     $X /= $aspectChange
  1447.  
  1448.     While Abs($X) >= 1 Or Abs($Y) >= 0.7 Or $Z <= 0
  1449.         ; specified point is not on screen
  1450.         $xd = $xd / 2
  1451.         $yd = $yd / 2
  1452.         $zd = $zd / 2
  1453.         $w = -0.515 * $xd + - 0.514 * $yd + - 0.686 * $zd + 97.985
  1454.         $X = (-1.682 * $xd + 1.683 * $yd + 0 * $zd + 7.045E-3) / $w
  1455.         $Y = (-1.54 * $xd + - 1.539 * $yd + 2.307 * $zd + 6.161) / $w
  1456.         $Z = (-0.515 * $xd + - 0.514 * $yd + - 0.686 * $zd + 97.002) / $w
  1457.         $X /= $aspectChange
  1458.     WEnd
  1459.     $return[0] = ($X + 1) / 2 * $resolutionX
  1460.     $return[1] = (1 - $Y) / 2 * $resolutionY
  1461.     Return $return
  1462. EndFunc   ;==>FromD3toScreenCoords
  1463.  
  1464.  
  1465. ;;--------------------------------------------------------------------------------
  1466. ;;      UiRatio()
  1467. ;;--------------------------------------------------------------------------------
  1468. Func UiRatio($_x, $_y)
  1469.     Dim $return[2]
  1470.     $size = WinGetClientSize("Diablo III")
  1471.     $return[0] = $size[1] * ($_x / 600)
  1472.     $return[1] = $size[1] * ($_y / 600)
  1473.     Return $return
  1474. EndFunc   ;==>UiRatio
  1475.  
  1476.  
  1477. ;;--------------------------------------------------------------------------------
  1478. ;;      GetCurrentPos()
  1479. ;;--------------------------------------------------------------------------------
  1480. Func GetCurrentPos()
  1481.     ;   Local $mesurepos = TimerInit() ;;;;;;;;;;;;;;
  1482.     Dim $return[3]
  1483.     $return[0] = _MemoryRead($_Myoffset + 0x0A0, $d3, 'float')
  1484.     $return[1] = _MemoryRead($_Myoffset + 0x0A4, $d3, 'float')
  1485.     $return[2] = _MemoryRead($_Myoffset + 0x0A8, $d3, 'float')
  1486.     ;       Local $difmesurepos = TimerDiff($mesurepos) ;;;;;;;;;;;;;
  1487.     ;ConsoleWrite("Mesure getcurrentpos :" & $difmesurepos &@crlf) ;FOR DEBUGGING;;;;;;;;;;;;
  1488.     Return $return
  1489. EndFunc   ;==>GetCurrentPos
  1490.  
  1491.  
  1492. ;;--------------------------------------------------------------------------------
  1493. ;;      WP handling
  1494. ;;--------------------------------------------------------------------------------
  1495.  
  1496. Func HandlePath($_x, $_y, $_z, $_a, $m_range)
  1497.   Local $ToggleCount = 0
  1498.   Local $Blocked = 0
  1499.   Local $CurrentDistance = 0
  1500.   Local $TimeOut = TimerInit()
  1501.  
  1502.   While 1
  1503.  
  1504.     GameOverTime()
  1505.     If $GameOverTime = True Then
  1506.       ExitLoop
  1507.     EndIf
  1508.  
  1509.     $CurrentLoc = GetCurrentPos()
  1510.     $xd = $_x - $CurrentLoc[0]
  1511.     $yd = $_y - $CurrentLoc[1]
  1512.     $zd = $_z - $CurrentLoc[2]
  1513.     $Distance = Sqrt($xd * $xd + $yd * $yd + $zd * $zd)
  1514.  
  1515.    ; _log( "$Distance < $m_range = " & $Distance < $m_range )
  1516.     If $Distance < $m_range Then ExitLoop
  1517.     ;_log( "_MemoryRead($ClickToMoveToggle, $d3, 'float') = " & _MemoryRead($ClickToMoveToggle, $d3, 'float') )
  1518.  
  1519.  
  1520.    ;;--------------------------------------------------------------------------------;;--------------------------------------------------------------------------------
  1521. ; If _MemoryRead($ClickToMoveToggle, $d3, 'float') = 0 Then
  1522. ;   $ToggleCount = $ToggleCount + 1
  1523. ;  _log( "_MemoryRead($ClickToMoveToggle, $d3, 'float') = " & _MemoryRead($ClickToMoveToggle, $d3, 'float') )
  1524. ;   if $ToggleCount > 1 Then ExitLoop
  1525. ;  Endif
  1526.  
  1527.  
  1528.  
  1529. Local $angle = 1
  1530. Local $Radius = 25
  1531.     While _MemoryRead($ClickToMoveToggle, $d3, 'float') = 0
  1532. _log( "_MemoryRead($ClickToMoveToggle, $d3, 'float') = " & _MemoryRead($ClickToMoveToggle, $d3, 'float') & " radius:" &$Radius  )
  1533.       $Coords = FromD3toScreenCoords($_x, $_y, $_z)
  1534. $angle += $Step
  1535. $Radius += 25
  1536.  
  1537.                 MouseMove($Coords[0] - (Cos($angle) * $Radius), $Coords[1] - (Sin($angle) * $Radius), 3)
  1538.  
  1539. _log( "Tryin move :" & " x:"&$_x &" y:"& $_y& "coords: "& $Coords[0]&"-"&$Coords[1])
  1540.  
  1541.      If $angle >= 2 * $PI  Then
  1542.         ExitLoop 2 ; le 2 signifie que l'on quitte 2 loop
  1543.     EndIf
  1544.     sleep(15)
  1545.     WEnd
  1546.  ;;--------------------------------------------------------------------------------;;--------------------------------------------------------------------------------
  1547.  
  1548.  
  1549.     ; Gestion du path un peu avancée ;)
  1550.     Local $delta = Abs($CurrentDistance - $Distance)
  1551.     ;_log( "$delta = " & $delta )
  1552.     If TimerDiff($TimeOut) > 4000 And ($delta < 5) Then
  1553.       ;GameOverTime = True ; pour quitter completement
  1554.       _log("Blocked " & $Blocked)
  1555.       $Blocked = $Blocked + 1
  1556.       _log("Blocked " & $Blocked)
  1557.       if $Blocked > 1 then
  1558.       $GameOverTime = True
  1559.       Endif
  1560.  
  1561.       HandlePath($lastwp[0], $lastwp[1], $lastwp[2], $lastwp[3], $lastwp[4])
  1562.       $TimeOut = TimerInit()
  1563.     EndIf
  1564.     $CurrentDistance = $Distance
  1565.  
  1566.     Sleep(10)
  1567.     $Coords = FromD3toScreenCoords($_x, $_y, $_z)
  1568.     $LastCP = GetCurrentPos()
  1569.     If $_a = 1 And GetDistance($LastCP[0], $LastCP[1], $LastCP[2]) >= $a_range / 2 Then
  1570.       MouseUp("middle")
  1571.       If $_a = 1 Then Attack($a_range, $monsterList)
  1572.       MouseMove($Coords[0], $Coords[1], 3)
  1573.       MouseDown("middle")
  1574.       $TimeOut = TimerInit()
  1575.     EndIf
  1576.  
  1577.     MouseMove($Coords[0], $Coords[1], 3)
  1578.  
  1579.   WEnd
  1580.  
  1581. EndFunc   ;==>HandlePath
  1582.  
  1583. ;;--------------------------------------------------------------------------------
  1584. ;;      MoveToPos()
  1585. ;;--------------------------------------------------------------------------------
  1586. Global $nextwp[5], $lastwp[5]
  1587.  
  1588. Func MoveToPos($_x, $_y, $_z, $_a, $m_range)
  1589.  
  1590.     If IsDeadCheck() == 0 Or $GameOverTime = True Then
  1591.         Return
  1592.     EndIf
  1593.  
  1594.     Global $nextwp[5] = [$_x, $_y, $_z, $_a, $m_range]
  1595.  
  1596.     If $_a = 1 Then Attack($a_range, $monsterList)
  1597.     $Coords = FromD3toScreenCoords($_x, $_y, $_z)
  1598.  
  1599.     MouseMove($Coords[0], $Coords[1], 3)
  1600.  
  1601.     MouseDown("middle")
  1602.     Sleep(10)
  1603.  
  1604.     HandlePath($_x, $_y, $_z, $_a, $m_range)
  1605.  
  1606.     Global $lastwp[5] = [$_x, $_y, $_z, $_a, $m_range]
  1607.  
  1608.     MouseUp("middle")
  1609. EndFunc   ;==>MoveToPos
  1610.  
  1611. ;;--------------------------------------------------------------------------------
  1612. ;;      Interact()
  1613. ;;--------------------------------------------------------------------------------
  1614. Func Interact($_x, $_y, $_z)
  1615.     ; MoveToPos($_x, $_y, $_z, 0, 25)
  1616.     $Coords = FromD3toScreenCoords($_x, $_y, $_z)
  1617.     MouseClick("left", $Coords[0], $Coords[1], 1, 10)
  1618.     $tempvalue = _MemoryRead($_itrInteractE + $ofs__InteractOffsetUNK2, $d3, 'int')
  1619.     While $tempvalue = 1
  1620.         $tempvalue = _MemoryRead($_itrInteractE + $ofs__InteractOffsetUNK2, $d3, 'int')
  1621.         Sleep(100)
  1622.     WEnd
  1623. EndFunc   ;==>Interact
  1624.  
  1625. ;;--------------------------------------------------------------------------------
  1626. ;;      Approach() Approach a NPC without left clicking
  1627. ;;--------------------------------------------------------------------------------
  1628. Func Approach($_x, $_y, $_z)
  1629.     ; MoveToPos($_x, $_y, $_z, 0, 25)
  1630.     $Coords = FromD3toScreenCoords($_x, $_y, $_z)
  1631.     MouseClick("middle", $Coords[0], $Coords[1], 1, 10)
  1632.     $tempvalue = _MemoryRead($_itrInteractE + $ofs__InteractOffsetUNK2, $d3, 'int')
  1633.     While $tempvalue = 1
  1634.         $tempvalue = _MemoryRead($_itrInteractE + $ofs__InteractOffsetUNK2, $d3, 'int')
  1635.         Sleep(100)
  1636.     WEnd
  1637. EndFunc   ;==>Approach
  1638.  
  1639. ;;--------------------------------------------------------------------------------
  1640. ;;   InteractByActorName()
  1641. ;;--------------------------------------------------------------------------------
  1642. Func InteractByActorName($a_name, $dist = 300)
  1643.     Local $index, $offset, $count, $item[10], $foundobject = 0
  1644.     startIterateObjectsList($index, $offset, $count)
  1645.     While iterateObjectsList($index, $offset, $count, $item)
  1646.         If StringInStr($item[1], $a_name) And $item[9] < $dist Then
  1647.             _log($item[1] & " distance : " &$item[9])
  1648.         If $item[9] > 40 Then ;pour eviter de cliquer un autre acteur en trajet
  1649.             Approach($item[2], $item[3], $item[4])
  1650.             _log(" Approaching : " &$item[1])
  1651.         Else
  1652.             Interact($item[2], $item[3], $item[4])
  1653.         Endif
  1654.             $foundobject = 1
  1655.             Sleep(100)
  1656.             ExitLoop
  1657.         EndIf
  1658.     WEnd
  1659.     Return $foundobject
  1660. EndFunc   ;==>InteractByActorName
  1661.  
  1662.  
  1663. ;;--------------------------------------------------------------------------------
  1664. ;;      GetLifep()
  1665. ;;--------------------------------------------------------------------------------
  1666. Func GetLifep()
  1667.   Local $index, $offset, $count, $item[10], $foundobject = 0
  1668.   startIterateObjectsList($index, $offset, $count)
  1669.   While iterateObjectsList($index, $offset, $count, $item)
  1670.     If StringInStr($item[1], "HealthBall_liquid") Then
  1671.       return _MemoryRead($item[8] + 0x408, $d3, 'float')
  1672.     EndIf
  1673.   WEnd
  1674. EndFunc   ;==>GetLifep
  1675.  
  1676.  
  1677.  
  1678. ;;--------------------------------------------------------------------------------
  1679. ;;      checkFromList()
  1680. ;;--------------------------------------------------------------------------------
  1681. Func checkFromList($list, $compare, $delimiter = '|')
  1682.     $arrayList = StringSplit($list, $delimiter)
  1683.     For $i = 1 To $arrayList[0]
  1684.         If StringInStr($compare, $arrayList[$i]) Then
  1685.             Return 1
  1686.         EndIf
  1687.     Next
  1688.     Return 0
  1689. EndFunc   ;==>checkFromList
  1690.  
  1691. ;;--------------------------------------------------------------------------------
  1692. ;;      Attack()
  1693. ;;--------------------------------------------------------------------------------
  1694. Func Attack($range, $monsterList)
  1695.  
  1696.     If IsDeadCheck() = 0 Then
  1697.         Return
  1698.     EndIf
  1699.  
  1700.     Local $IgnoreList = ""
  1701.     While 1
  1702.         $foundobject = 0
  1703.         Local $index, $offset, $count, $item[10]
  1704.         startIterateObjectsList($index, $offset, $count)
  1705.         While iterateObjectsList($index, $offset, $count, $item)
  1706.  
  1707. ;;;;;;;;;;; code crados a revoir ;;;;;
  1708.         If _playerdead() Then
  1709.         UnBuff()
  1710.         _leavegame()
  1711.         $Death = $Death+1
  1712.         Sleep(Random(12000, 14000))
  1713.         _log('On est mort on reprend ')
  1714.         _botting()
  1715.         EndIf
  1716. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1717.  
  1718.             If $item[0] <> "" And $item[0] <> 0xFFFFFFFF And $item[9] < $range And StringInStr($IgnoreList, $item[8]) = 0 Then
  1719.                 If checkFromList($monsterList, $item[1]) And $item[6] <> -1 Then
  1720.                     ; we have a monster
  1721.                     If IterateActorAtribs($item[0], $Atrib_Hitpoints_Cur) > 0 And IterateActorAtribs($item[0], $Atrib_Invulnerable) = 0 Then
  1722.                         $foundobject = 1
  1723.                         If KillMob($item[1], $item[8], $item[0]) = False Then
  1724.                             _log('ignoring ' & $item[1])
  1725.                             $IgnoreList = $IgnoreList & $item[8]
  1726.                         EndIf
  1727.                     Else
  1728.                         _log('ignoring ' & $item[1])
  1729.                         $IgnoreList = $IgnoreList & $item[8]
  1730.                     EndIf
  1731.                 ElseIf $item[5] = 2 And $item[6] = -1 Then
  1732.                     ; we have a loot
  1733.                     $grabit = False
  1734.                     If _MemoryRead($item[8] + 0x4, $d3, 'ptr') <> 0xFFFFFFFF Then
  1735.                         ConsoleWrite("Checking " & $item[1]& @CRLF)
  1736.                         $itemDestination = CheckItem($item[0], $item[1])
  1737.                         If $itemDestination == "Stash" Or $itemDestination == "Salvage" Or $itemDestination == "Inventory" Then
  1738.                             ; this loot is interesting
  1739.                             $foundobject = 1
  1740.                             If Grabit($item[1], $item[8]) = False Then
  1741.                                 _log('ignoring ' & $item[1])
  1742.                                 $IgnoreList = $IgnoreList & $item[8]
  1743.                             EndIf
  1744.                         EndIf
  1745.                     EndIf
  1746.                 EndIf
  1747.             EndIf
  1748.         WEnd
  1749.  
  1750.         If $foundobject = 0 Then
  1751.             ExitLoop
  1752.         EndIf
  1753.     WEnd
  1754.  
  1755. EndFunc   ;==>Attack
  1756.  
  1757.  
  1758. ;;--------------------------------------------------------------------------------
  1759. ;;      KillMob()
  1760. ;;--------------------------------------------------------------------------------
  1761. Func KillMob($name, $offset, $guid)
  1762.     $return = True
  1763.     $begin = TimerInit()
  1764.     Local $IgnorePoint = 6500; <-- If something is not grabbed/killed in this time we give it up
  1765.     $Coords = FromD3toScreenCoords(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
  1766.     MouseMove($Coords[0], $Coords[1], 3)
  1767.  
  1768.     ;Send("{SHIFTDOWN}")
  1769.     MouseDown("left")
  1770.  
  1771.     ;loop the attack until the mob is dead
  1772.     _log("Attack : " & $name) ;FOR
  1773.     While IterateActorAtribs($guid, $Atrib_Hitpoints_Cur) > 0
  1774.         $Coords = FromD3toScreenCoords(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
  1775.         MouseMove($Coords[0], $Coords[1], 3)
  1776.         MouseDown("left")
  1777.         checkForPotion()
  1778.         Sleep(10)
  1779.         If TimerDiff($begin) > $IgnorePoint Then
  1780.             ; after this time, the mob should be dead, otherwise he is probly unkillable
  1781.             $return = False
  1782.             ExitLoop
  1783.         EndIf
  1784.     WEnd
  1785.     MouseUp("left")
  1786.     ;Send("{SHIFTUP}")
  1787.     Return $return
  1788. EndFunc   ;==>KillMob
  1789.  
  1790. ;;--------------------------------------------------------------------------------
  1791. ;;      Grabit()
  1792. ;;--------------------------------------------------------------------------------
  1793. Func Grabit($name, $offset)
  1794.  
  1795.     $return = True
  1796.     $begin = TimerInit()
  1797.     Local $IgnorePoint = 5000; <-- If something is not grabbed/killed in this time we give it up
  1798.     ConsoleWrite("Grabbing :" & ($name) & @CRLF) ;FOR DEBUGGING
  1799.  
  1800.     If (StringInStr($name, "gold")) Then
  1801.         $Coords = FromD3toScreenCoords(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
  1802.         MouseClick("middle", $Coords[0], $Coords[1], 1, 5)
  1803.     Else
  1804.         Interact(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
  1805.     EndIf
  1806.  
  1807.     While _MemoryRead($offset + 0x4, $d3, 'ptr') <> 0xFFFFFFFF
  1808.  
  1809.         If TimerDiff($begin) > $IgnorePoint Then
  1810.             ; After this time we should already had the item
  1811.             $return = False
  1812.             ExitLoop
  1813.         EndIf
  1814.  
  1815.         If (StringInStr($name, "gold")) Then
  1816.             $Coords = FromD3toScreenCoords(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
  1817.             MouseClick("middle", $Coords[0], $Coords[1], 1, 5)
  1818.         Else
  1819.             Interact(_MemoryRead($offset + 0xB0, $d3, 'float'), _MemoryRead($offset + 0xB4, $d3, 'float'), _MemoryRead($offset + 0xB8, $d3, 'float'))
  1820.         EndIf
  1821.  
  1822.         Sleep(50)
  1823.     WEnd
  1824.  
  1825.     Return $return
  1826.  
  1827. EndFunc   ;==>Grabit
  1828.  
  1829. ;;--------------------------------------------------------------------------------
  1830. ;;      checkForPotion()
  1831. ;;--------------------------------------------------------------------------------
  1832. Func checkForPotion()
  1833. ;Local $mesurepot = TimerInit() ;;;;;;;;;;;;;;
  1834.  
  1835.    $life = GetLifep()
  1836.     If IsNumber($life) Then
  1837.             $diff = TimerDiff($timeforpotion)
  1838.             If $life < $LifeForPotion/100 and $diff > 30000 Then
  1839.                 $timeforpotion = TimerInit()
  1840.                 send("q")
  1841.             EndIf
  1842.  
  1843.             $diffClick = TimerDiff($timeforclick)
  1844.             If $EmergencyClick = "True" and $life < $LifeForEmergencyClick/100 and $diffClick > $EmergencyClickDelay Then
  1845.                 sleep(10)
  1846.                 $timeforclick = TimerInit()
  1847.                 MouseClick("right")
  1848.             EndIf
  1849.  
  1850.             $diffSkill = TimerDiff($timeforSkill)
  1851.             ;_log($EmergencySkill & " EmergencySkillTouche : " & $EmergencySkillTouche & "Life: " & $life&"/"&$LifeForEmergencySkill/100 & "DiffSkill : " & $diffSkill & ">" & $EmergencySkillDelay )
  1852.             If $EmergencySkill = "True" and $life < $LifeForEmergencySkill/100 and $diffSkill > $EmergencySkillDelay Then
  1853.                 sleep(10)
  1854.                 $timeforSkill = TimerInit()
  1855.                 send($EmergencySkillTouche)
  1856.             ;   _log("Sending : " & $EmergencySkillTouche)
  1857.             EndIf
  1858.     EndIf
  1859. ;Local $difmesurepot = TimerDiff($mesurepot) ;;;;;;;;;;;;;
  1860. ;ConsoleWrite("Mesure POT :" & $difmesurepot &@crlf) ;FOR DEBUGGING;;;;;;;;;;;;
  1861. EndFunc ;==>checkForPotion
  1862.  
  1863. ;;--------------------------------------------------------------------------------
  1864. ;;      checkFromGrabList()
  1865. ;;--------------------------------------------------------------------------------
  1866. Func checkFromGrabList($grabList, $grabcompare, $grabdelimiter = '|')
  1867.     $grabarrayList = StringSplit($grabList, $grabdelimiter)
  1868.     For $i = 1 To $grabarrayList[0]
  1869.         If StringInStr($grabcompare, $grabarrayList[$i]) Then
  1870.             Return 1
  1871.         EndIf
  1872.     Next
  1873.     Return 0
  1874. EndFunc   ;==>checkFromGrabList
  1875.  
  1876. ;;--------------------------------------------------------------------------------
  1877. ;;      checkFromRareList()
  1878. ;;--------------------------------------------------------------------------------
  1879. Func checkFromRareList($rareList, $rarecompare, $raredelimiter = '|')
  1880.     $rarearrayList = StringSplit($rareList, $raredelimiter)
  1881.     For $i = 1 To $rarearrayList[0]
  1882.         If StringInStr($rarecompare, $rarearrayList[$i]) Then
  1883.             Return 1
  1884.         EndIf
  1885.     Next
  1886.     Return 0
  1887. EndFunc   ;==>checkFromRareList
  1888.  
  1889.  
  1890. ;;--------------------------------------------------------------------------------
  1891. ;;      SkipDialog()
  1892. ;;--------------------------------------------------------------------------------
  1893. Func SkipDialog($_Count)
  1894.     For $i = 1 To $_Count
  1895.         Send("{SPACE}")
  1896.         Sleep(100)
  1897.     Next
  1898. EndFunc   ;==>SkipDialog
  1899.  
  1900.  
  1901. ;;--------------------------------------------------------------------------------
  1902. ;;   TakeWP()
  1903. ;;--------------------------------------------------------------------------------
  1904. Func TakeWP($tarChapter, $tarNum, $curChapter, $curNum)
  1905.     While Not offsetlist()
  1906.         Sleep(10)
  1907.     WEnd
  1908.  
  1909.     InteractByActorName("Waypoint")
  1910.     Sleep(700)
  1911.         Local $wptry = 0
  1912.     While _checkWPopen() = False
  1913.          if $wptry <= 4 then
  1914.         _log('Fail to open wp')
  1915.         $wptry = $wptry + 1
  1916.         InteractByActorName("Waypoint")
  1917.         EndIf
  1918.              if $wptry > 4 then
  1919.             _log('Failed to open wp after 3 try')
  1920.             ExitLoop
  1921.  
  1922.         EndIf
  1923.     WEnd
  1924.  
  1925.  
  1926.     If $tarChapter <> $curChapter Or ($tarChapter = $curChapter And $tarChapter < $curChapter) Then
  1927.         For $i = 0 To $tarChapter - 1
  1928.             $coord = UiRatio(35, 100 + ($i * 12.5))
  1929.             MouseClick("left", $coord[0], $coord[1], 1, 3) ; Close chapters
  1930.         Next
  1931.         $coord = UiRatio(145, 100 + ($tarChapter * 12.5) + 23 + ($tarNum * 32))
  1932.         MouseClick("left", $coord[0], $coord[1], 1, 3) ; Click wp
  1933.     EndIf
  1934.     If $tarChapter = $curChapter And $tarChapter > $curChapter Then
  1935.         For $i = 0 To $tarChapter - 1
  1936.             $coord = UiRatio(35, 100 + ($i * 12.5))
  1937.             MouseClick("left", $coord[0], $coord[1], 1, 3) ; Close chapters
  1938.         Next
  1939.         $coord = UiRatio(145, 100 + ($tarChapter * 12.5) + 23 + 12 + ($tarNum * 32))
  1940.         MouseClick("left", $coord[0], $coord[1], 1, 3) ; Click wp
  1941.     EndIf
  1942.     Sleep(1000)
  1943.     While Not offsetlist()
  1944.         Sleep(10)
  1945.     WEnd
  1946. EndFunc   ;==>TakeWP
  1947.  
  1948.  
  1949. ;;--------------------------------------------------------------------------------
  1950. ;;      _resumegame()
  1951. ;;--------------------------------------------------------------------------------
  1952. Func _resumegame()
  1953.     _log("Resume Game")
  1954.     Sleep(Random(500, 1000, 1))
  1955.     _randomclick(106, 233)
  1956.     Sleep(4000)
  1957. EndFunc   ;==>_resumegame
  1958.  
  1959.  
  1960. ;;--------------------------------------------------------------------------------
  1961. ;;      _leavegame()
  1962. ;;--------------------------------------------------------------------------------
  1963. Func _leavegame()
  1964.     If _ingame() Then
  1965.         _log("Leave Game")
  1966.         Send("{ESCAPE}")
  1967.         Sleep(Random(200, 300, 1))
  1968.         While _escmenu() = False
  1969.             Send("{ESCAPE}")
  1970.             Sleep(Random(200, 300, 1))
  1971.         WEnd
  1972.         _randomclick(420, 323)
  1973.         Sleep(Random(500, 1000, 1))
  1974.     EndIf
  1975. EndFunc   ;==>_leavegame
  1976.  
  1977. ;;--------------------------------------------------------------------------------
  1978. ;;      Repair()
  1979. ;;--------------------------------------------------------------------------------
  1980. Func Repair($RepairVendor, $RepairTab)
  1981.     InteractByActorName($RepairVendor)
  1982.     Sleep(700)
  1983.         Local $vendortry = 0
  1984.     While _checkVendoropen() = False
  1985.          if $vendortry <= 5 then
  1986.         _log('Fail to open vendor')
  1987.         $vendortry = $vendortry + 1
  1988.         InteractByActorName($RepairVendor)
  1989.  
  1990.         ElseIf $vendortry > 5 then
  1991.         _log('Failed to open Vendor after 5 try')
  1992.         MsgBox(0, "Impossible d'ouvrir le vendeur :", "SVP, veuillez reporter ce problème sur le forum. Erreur : v001 ")
  1993.         Terminate()
  1994.         ExitLoop
  1995.  
  1996.         EndIf
  1997.     WEnd
  1998.     Sleep(100)
  1999.     $coord = UiRatio(290, 130 + ($RepairTab * 70))
  2000.     MouseClick("left", $coord[0], $coord[1], 1, 3) ; Repair tab
  2001.     Sleep(100)
  2002.     $coord = UiRatio(150, 330)
  2003.     MouseClick("left", $coord[0], $coord[1], 1, 3) ; Repair Button
  2004.     Sleep(100)
  2005.     Send("{SPACE}")
  2006. EndFunc   ;==>Repair
  2007.  
  2008. ;;================================================================================
  2009. ; Function:         GetDistance($_x,$_y,$_z)
  2010. ; Description:      Check distance between you and a desired position.
  2011. ; Parameter(s):     $_x,$_y and $_z - the target position
  2012. ;
  2013. ; Note(s):          Returns a distance in float
  2014. ;==================================================================================
  2015. Func GetDistance($_x, $_y, $_z)
  2016.     $CurrentLoc = GetCurrentPos()
  2017.     $xd = $_x - $CurrentLoc[0]
  2018.     $yd = $_y - $CurrentLoc[1]
  2019.     $zd = $_z - $CurrentLoc[2]
  2020.     $Distance = Sqrt($xd * $xd + $yd * $yd + $zd * $zd)
  2021.     Return $Distance
  2022. EndFunc   ;==>GetDistance
  2023.  
  2024. ;;================================================================================
  2025. ; Function:         GetDistance($_x,$_y,$_z)
  2026. ; Description:      Check distance between you and a desired position.
  2027. ; Parameter(s):     $_x,$_y and $_z - the target position
  2028. ;
  2029. ; Note(s):          Returns a distance in float
  2030. ;==================================================================================
  2031. Func GetMyStats()
  2032.     While 1
  2033.         IterateLocalActor()
  2034.         $foundobject = 0
  2035.         For $i = 0 To UBound($__ACTOR, 1) - 1
  2036.             If StringInStr($__ACTOR[$i][2], "GoldCoin-") Then
  2037.                 ConsoleWrite("Current GOLD: " & IterateActorAtribs($__ACTOR[$i][1], $Atrib_ItemStackQuantityLo) & @CRLF)
  2038.                 ExitLoop
  2039.             EndIf
  2040.         Next
  2041.         If $foundobject = 0 Then ExitLoop
  2042.     WEnd
  2043.  
  2044.     ConsoleWrite("Current Level: " & IterateActorAtribs(0x77BC0000, $Atrib_Level) & @CRLF)
  2045.     ConsoleWrite("Strength: " & IterateActorAtribs(0x77BC0000, $Atrib_Strength_Total))
  2046.     ConsoleWrite(" Dexterity: " & IterateActorAtribs(0x77BC0000, $Atrib_Dexterity_Total))
  2047.     ConsoleWrite(" Inteligence: " & IterateActorAtribs(0x77BC0000, $Atrib_Intelligence_Total))
  2048.     ConsoleWrite(" Vitality: " & IterateActorAtribs(0x77BC0000, $Atrib_Vitality_Total) & @CRLF)
  2049.     ConsoleWrite("Gold find: " & IterateActorAtribs(0x77BC0000, $Atrib_Gold_Find) & @CRLF)
  2050.     ConsoleWrite("Magic find: " & IterateActorAtribs(0x77BC0000, $Atrib_Magic_Find) & @CRLF)
  2051.     ConsoleWrite("Pickup Radius : " & IterateActorAtribs(0x77BC0000, $Atrib_Gold_PickUp_Radius) & @CRLF)
  2052.     ConsoleWrite("Movement speed : " & IterateActorAtribs(0x77BC0000, $Atrib_Movement_Scalar_Capped_Total) & @CRLF)
  2053. EndFunc   ;==>GetMyStats
  2054.  
  2055. Func GameOverTime()
  2056.     Global $timedifmaxgamelength = TimerDiff($timermaxgamelength)
  2057.     If $timedifmaxgamelength > $maxgamelength Then
  2058.         _log('game over time !')
  2059.         Global $GameOverTime = True
  2060.     EndIf
  2061. EndFunc   ;==>GameOverTime
  2062.  
  2063. Func Terminate()
  2064.     $file = FileOpen(@ScriptDir & "\" & $fichierstat, 1)
  2065.     FileWriteLine($file, $DebugMessage)
  2066.     MouseUp("middle")
  2067.     MouseUp("left")
  2068.     Send("{SHIFTUP}")
  2069.     Exit 0
  2070. EndFunc   ;==>Terminate
  2071.  
  2072. Func TogglePause()
  2073.     $Paused = Not $Paused
  2074.     While $Paused
  2075.         Sleep(100)
  2076.         TrayTip("", 'Script is "Paused"', 5)
  2077.     WEnd
  2078.     ToolTip("")
  2079. EndFunc   ;==>TogglePause
  2080.  
  2081. Func _log($text)
  2082.     ConsoleWrite(@MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & " | " & $text & @CRLF)
  2083. EndFunc   ;==>_log
  2084.  
  2085. Func RandSleep($min = 5, $max = 45, $chance = 3)
  2086.     $randNum = Round(Random(1, 100))
  2087.     If $randNum <= $chance Then
  2088.         $sleepTime = Random($min * 1000, $max * 1000)
  2089.         _log("Sleeping " & $sleepTime & "ms")
  2090.         For $c = 0 To 10
  2091.             Sleep($sleepTime / 10)
  2092.         Next
  2093.     EndIf
  2094. EndFunc   ;==>RandSleep
  2095.  
  2096. Func _randomclick($X, $Y, $button = "left")
  2097.     $coord = UiRatio($X, $Y)
  2098.     MouseClick($button, Random($coord[0] - 3, $coord[0] + 3), Random($coord[1] - 3, $coord[1] + 3))
  2099. EndFunc   ;==>_randomclick
  2100.  
  2101. ;;=================================================================================================================================================================================================
  2102. ;Best Regards,
  2103. ;8 8888      88 b.             8 8 8888     ,88' b.             8     ,o888888o.  `8.`888b                 ,8' b.             8 8 8888888888   8 888888888o.       .-----.   .----.  .---. .-----.
  2104. ;8 8888      88 888o.          8 8 8888    ,88'  888o.          8  . 8888     `88. `8.`888b               ,8'  888o.          8 8 8888         8 8888    `^888.   / ,-.   \ /  ..  \/_   |/ ,-.   \
  2105. ;8 8888      88 Y88888o.       8 8 8888   ,88'   Y88888o.       8 ,8 8888       `8b `8.`888b             ,8'   Y88888o.       8 8 8888         8 8888        `88. '-'  |  |.  /  \  .|   |'-'  |  |
  2106. ;8 8888      88 .`Y888888o.    8 8 8888  ,88'    .`Y888888o.    8 88 8888        `8b `8.`888b     .b    ,8'    .`Y888888o.    8 8 8888         8 8888         `88    .'  / |  |  '  ||   |   .'  /
  2107. ;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  .'  /__ '  \  /  '|   | .'  /__
  2108. ;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 |       | \  `'  / |   ||       |
  2109. ;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 `-------'  `---''  `---'`-------'
  2110. ;` 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'
  2111. ;  8888   ,d8P  8         `Y8o.` 8 8888   `Y8.   8         `Y8o.`  ` 8888     ,88'        `8.`8' `8,`'         8         `Y8o.` 8 8888         8 8888    ,o88P'
  2112. ;   `Y88888P'   8            `Yo 8 8888     `Y8. 8            `Yo     `8888888P'           `8.`   `8'          8            `Yo 8 888888888888 8 888888888P'
  2113. ;;=================================================================================================================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment