Advertisement
Guest User

Untitled

a guest
Nov 24th, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 10.99 KB | None | 0 0
  1.  Public Function PreformWaypoint(ByVal w As Waypoint) As Boolean
  2.         If IsLoggedIn = False Then
  3.             Exit Function
  4.         End If
  5.        
  6.         Dim WaypointReached As Boolean = False
  7.         If Kernel.Attacker.TargetsAround > 0 Then
  8.             Return False
  9.         End If
  10.         If Player.RedSquare > 0 Then
  11.             Return False
  12.         End If
  13.        
  14.         If Player.IsWalking Then
  15.             Return False
  16.         End If
  17.         If w.Location.Z <> Client.PlayerLocation.Z Then
  18.  
  19.             NextWaypoint()
  20.             Thread.Sleep(800)
  21.             Return False
  22.         End If
  23.         If Client.Statusbar = "There is no way." Then
  24.             Client.Statusbar = ""
  25.             NextWaypoint()
  26.             Return False
  27.         End If
  28.         If Kernel.Looter.LootWhenALlDead = True AndAlso Kernel.Looter.CorpseList.Count > 0 Then
  29.             Return OpenCorpses()
  30.         End If
  31.         If [Global].Waypoints.Count = 0 Then
  32.             Return False
  33.         End If
  34.  
  35.         Select Case w.Type
  36.             Case Settnings.WaypointType.Walk
  37.                 If Client.PlayerLocation = w.Location OrElse Client.Player.Z <> w.Location.Z Then
  38.                     WaypointReached = True
  39.                     Exit Select
  40.                 Else
  41.                     Player.GoTo = w.Location
  42.                     'Client.MiniMap.GotoLocation(w.Location, targetList)
  43.  
  44.                     WaypointReached = False
  45.                     Exit Select
  46.                 End If
  47.             Case Settnings.WaypointType.UpUse
  48.                 If Client.PlayerLocation.Z < w.Location.Z Then
  49.                     WaypointReached = True
  50.                     Exit Select
  51.                 Else
  52.                     If Client.PlayerLocation = w.Location Then
  53.                         Dim t As Tile = Client.Map.GetTile(w.Location)
  54.                         For Each i As Item In t.Items
  55.                             If Constants.TileLists.UpUse.Contains(i.Id) Then
  56.                                 i.Use()
  57.                                 Thread.Sleep(1000)
  58.                                 WaypointReached = False
  59.                                 Exit Select
  60.                             End If
  61.                         Next
  62.                     Else
  63.                         Player.GoTo = w.Location
  64.                         'Client.MiniMap.GotoLocation(w.Location, targetList)
  65.                         WaypointReached = False
  66.                         Exit Select
  67.                     End If
  68.                 End If
  69.             Case Settnings.WaypointType.DownUse
  70.                 If Client.PlayerLocation.Z > w.Location.Z Then
  71.                     WaypointReached = True
  72.                     Exit Select
  73.                 Else
  74.                     If Client.PlayerLocation = w.Location Then
  75.                         Dim t As Tile = Client.Map.GetTile(w.Location)
  76.                         For Each i As Item In t.Items
  77.                             If Constants.TileLists.DownUse.Contains(i.Id) Then
  78.                                 i.Use()
  79.                                 Thread.Sleep(1000)
  80.                                 WaypointReached = False
  81.                                 Exit Select
  82.                             End If
  83.                         Next
  84.                     Else
  85.                         Player.GoTo = w.Location
  86.                         'Client.MiniMap.GotoLocation(w.Location, targetList)
  87.                         WaypointReached = False
  88.                         Exit Select
  89.                     End If
  90.                 End If
  91.             Case Settnings.WaypointType.Rope
  92.                 If Client.PlayerLocation.Z < w.Location.Z Then
  93.                     WaypointReached = True
  94.                     Exit Select
  95.                 Else
  96.                     If Client.PlayerLocation <> w.Location AndAlso w.Location.IsAdjacentTo(Client.PlayerLocation) = False Then
  97.                         Player.GoTo = w.Location
  98.                         'Client.MiniMap.GotoLocation(w.Location, targetList)
  99.                         WaypointReached = False
  100.                         Exit Select
  101.                     Else
  102.                         If Client.PlayerLocation = w.Location Then
  103.                             Dim tlist As List(Of Tile) = Client.Map.GetTilesSameFloor.Where(Function(t) t.Location.IsAdjacentTo(Client.PlayerLocation) AndAlso t.Location <> Client.PlayerLocation AndAlso t.isWalkable).ToList
  104.                             tlist = tlist.OrderBy(Function(t) t.Location.DistanceTo(Client.PlayerLocation)).ToList
  105.  
  106.                             Player.GoTo = tlist(0).Location
  107.                             'Client.MiniMap.GotoLocation(tlist(0).Location, targetList)
  108.                             WaypointReached = False
  109.                             Exit Select
  110.                         Else
  111.                             If Client.PlayerLocation.IsAdjacentTo(w.Location) Then
  112.                                 Dim t As Tile = Client.Map.GetTile(w.Location)
  113.                                 For Each i As Item In t.Items
  114.                                     If i.GetFlag(Addresses.DatItem.Flag.IsImmovable) = False AndAlso i.GetFlag(Addresses.DatItem.Flag.IsSplash) = False Then
  115.                                         i.Move(ItemLocation.FromLocation(Client.PlayerLocation))
  116.                                         Thread.Sleep(500)
  117.                                     End If
  118.                                 Next
  119.                                 Dim Rope As Item = Client.Inventory.GetItems.FirstOrDefault(Function(i) i.Id = Constants.Items.Tool.Rope.Id)
  120.                                 If Rope IsNot Nothing AndAlso t IsNot Nothing Then
  121.                                     Rope.Use(t)
  122.                                     Threading.Thread.Sleep(500)
  123.                                     WaypointReached = False
  124.                                     Exit Select
  125.                                 End If
  126.                             End If
  127.                         End If
  128.                     End If
  129.  
  130.                 End If
  131.             Case Settnings.WaypointType.Shovel
  132.                 If Client.PlayerLocation.Z > w.Location.Z Then
  133.                     WaypointReached = True
  134.                     Exit Select
  135.                 Else
  136.                     If Client.PlayerLocation <> w.Location AndAlso w.Location.IsAdjacentTo(Client.PlayerLocation) = False Then
  137.                         Player.GoTo = w.Location
  138.                         'Client.MiniMap.GotoLocation(w.Location, targetList)
  139.  
  140.                         WaypointReached = False
  141.                         Exit Select
  142.                     Else
  143.                         If Client.PlayerLocation = w.Location Then
  144.                             Dim tlist As List(Of Tile) = Client.Map.GetTilesSameFloor.Where(Function(t) t.Location.IsAdjacentTo(Client.PlayerLocation) AndAlso t.Location <> Client.PlayerLocation AndAlso t.isWalkable).ToList
  145.  
  146.                             Player.GoTo = tlist(0).Location
  147.                             ' Client.MiniMap.GotoLocation(tlist(0).Location, targetList)
  148.                             WaypointReached = False
  149.                             Exit Select
  150.                         Else
  151.                             If Client.PlayerLocation.IsAdjacentTo(w.Location) Then
  152.                                 Dim t As Tile = Client.Map.GetTile(w.Location)
  153.                                 Dim Shovel As Item = Client.Inventory.GetItems.FirstOrDefault(Function(i) i.Id = Constants.Items.Tool.Shovel.Id)
  154.                                 If Shovel IsNot Nothing AndAlso t IsNot Nothing Then
  155.                                     Shovel.Use(t)
  156.                                     Threading.Thread.Sleep(500)
  157.                                     Player.GoTo = w.Location
  158.                                     '        Client.MiniMap.GotoLocation(w.Location, targetList)
  159.                                     WaypointReached = False
  160.                                     Exit Select
  161.                                 End If
  162.                             End If
  163.                         End If
  164.                     End If
  165.                 End If
  166.             Case Settnings.WaypointType.Corpse
  167.                 If Client.PlayerLocation = w.Location Then
  168.                     Dim t As Tile = Client.Map.GetPlayerTile
  169.                     If t.Items.Count > 0 Then
  170.                         Dim i As Item = t.Items.Last
  171.                         If i IsNot Nothing Then
  172.                             If i.GetFlag(Addresses.DatItem.Flag.IsContainer) Then
  173.                                 i.OpenAsContainer(CByte(Client.Inventory.GetContainers.Count))
  174.                                 WaitForLoot = Date.Now.AddSeconds(4)
  175.                             End If
  176.                         End If
  177.                     End If
  178.                     WaypointReached = True
  179.                     Exit Select
  180.                 Else
  181.                     Player.GoTo = w.Location
  182.                     WaypointReached = False
  183.                     Exit Select
  184.                 End If
  185.             Case Settnings.WaypointType.Door
  186.                 If Client.PlayerLocation = w.Location Then
  187.                     WaypointReached = True
  188.                 ElseIf Client.PlayerLocation.IsAdjacentTo(w.Location) = False Then
  189.                     Dim tiles As List(Of Tile) = Client.Map.GetTilesSameFloor.Where(Function(t) t.Location.IsAdjacentTo(w.Location)).ToList
  190.                     Dim tList As List(Of Tile) = tiles.Where(Function(t) t.IsReachable(New List(Of Location))).ToList
  191.                     If tList.Count > 0 Then
  192.                         Player.GoTo = tList(0).Location
  193.                         'Client.MiniMap.GotoLocation(tList(0).Location, targetList)
  194.  
  195.                         WaypointReached = False
  196.                     Else
  197.                         Player.GoTo = w.Location
  198.                         WaypointReached = False
  199.  
  200.                     End If
  201.  
  202.                 ElseIf Client.PlayerLocation.IsAdjacentTo(w.Location) Then
  203.  
  204.                     Dim t As Tile = Client.Map.GetTile(w.Location)
  205.                     For Each i As Item In t.Items
  206.                         If i.AutomapColor = Addresses.DatItem.Help.IsDoor Then
  207.                             If t.isWalkable = False Then
  208.                                 i.Use()
  209.                                 Exit For
  210.  
  211.                             Else
  212.                                 Player.GoTo = t.Location
  213.                                 Exit For
  214.                                 '       Client.MiniMap.GotoLocation(t.Location, targetList)
  215.                             End If
  216.                             WaypointReached = False
  217.  
  218.                         End If
  219.                     Next
  220.                 End If
  221.             Case Settnings.WaypointType.Machete
  222.                 If Client.PlayerLocation = w.Location OrElse Client.Player.Z <> w.Location.Z Then
  223.                     WaypointReached = True
  224.                     Exit Select
  225.                 Else
  226.                     Player.GoTo = w.Location
  227.                     WaypointReached = False
  228.                     Exit Select
  229.                 End If
  230.         End Select
  231.         Return WaypointReached
  232.     End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement