Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function PreformWaypoint(ByVal w As Waypoint) As Boolean
- If IsLoggedIn = False Then
- Exit Function
- End If
- Dim WaypointReached As Boolean = False
- If Kernel.Attacker.TargetsAround > 0 Then
- Return False
- End If
- If Player.RedSquare > 0 Then
- Return False
- End If
- If Player.IsWalking Then
- Return False
- End If
- If w.Location.Z <> Client.PlayerLocation.Z Then
- NextWaypoint()
- Thread.Sleep(800)
- Return False
- End If
- If Client.Statusbar = "There is no way." Then
- Client.Statusbar = ""
- NextWaypoint()
- Return False
- End If
- If Kernel.Looter.LootWhenALlDead = True AndAlso Kernel.Looter.CorpseList.Count > 0 Then
- Return OpenCorpses()
- End If
- If [Global].Waypoints.Count = 0 Then
- Return False
- End If
- Select Case w.Type
- Case Settnings.WaypointType.Walk
- If Client.PlayerLocation = w.Location OrElse Client.Player.Z <> w.Location.Z Then
- WaypointReached = True
- Exit Select
- Else
- Player.GoTo = w.Location
- 'Client.MiniMap.GotoLocation(w.Location, targetList)
- WaypointReached = False
- Exit Select
- End If
- Case Settnings.WaypointType.UpUse
- If Client.PlayerLocation.Z < w.Location.Z Then
- WaypointReached = True
- Exit Select
- Else
- If Client.PlayerLocation = w.Location Then
- Dim t As Tile = Client.Map.GetTile(w.Location)
- For Each i As Item In t.Items
- If Constants.TileLists.UpUse.Contains(i.Id) Then
- i.Use()
- Thread.Sleep(1000)
- WaypointReached = False
- Exit Select
- End If
- Next
- Else
- Player.GoTo = w.Location
- 'Client.MiniMap.GotoLocation(w.Location, targetList)
- WaypointReached = False
- Exit Select
- End If
- End If
- Case Settnings.WaypointType.DownUse
- If Client.PlayerLocation.Z > w.Location.Z Then
- WaypointReached = True
- Exit Select
- Else
- If Client.PlayerLocation = w.Location Then
- Dim t As Tile = Client.Map.GetTile(w.Location)
- For Each i As Item In t.Items
- If Constants.TileLists.DownUse.Contains(i.Id) Then
- i.Use()
- Thread.Sleep(1000)
- WaypointReached = False
- Exit Select
- End If
- Next
- Else
- Player.GoTo = w.Location
- 'Client.MiniMap.GotoLocation(w.Location, targetList)
- WaypointReached = False
- Exit Select
- End If
- End If
- Case Settnings.WaypointType.Rope
- If Client.PlayerLocation.Z < w.Location.Z Then
- WaypointReached = True
- Exit Select
- Else
- If Client.PlayerLocation <> w.Location AndAlso w.Location.IsAdjacentTo(Client.PlayerLocation) = False Then
- Player.GoTo = w.Location
- 'Client.MiniMap.GotoLocation(w.Location, targetList)
- WaypointReached = False
- Exit Select
- Else
- If Client.PlayerLocation = w.Location Then
- 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
- tlist = tlist.OrderBy(Function(t) t.Location.DistanceTo(Client.PlayerLocation)).ToList
- Player.GoTo = tlist(0).Location
- 'Client.MiniMap.GotoLocation(tlist(0).Location, targetList)
- WaypointReached = False
- Exit Select
- Else
- If Client.PlayerLocation.IsAdjacentTo(w.Location) Then
- Dim t As Tile = Client.Map.GetTile(w.Location)
- For Each i As Item In t.Items
- If i.GetFlag(Addresses.DatItem.Flag.IsImmovable) = False AndAlso i.GetFlag(Addresses.DatItem.Flag.IsSplash) = False Then
- i.Move(ItemLocation.FromLocation(Client.PlayerLocation))
- Thread.Sleep(500)
- End If
- Next
- Dim Rope As Item = Client.Inventory.GetItems.FirstOrDefault(Function(i) i.Id = Constants.Items.Tool.Rope.Id)
- If Rope IsNot Nothing AndAlso t IsNot Nothing Then
- Rope.Use(t)
- Threading.Thread.Sleep(500)
- WaypointReached = False
- Exit Select
- End If
- End If
- End If
- End If
- End If
- Case Settnings.WaypointType.Shovel
- If Client.PlayerLocation.Z > w.Location.Z Then
- WaypointReached = True
- Exit Select
- Else
- If Client.PlayerLocation <> w.Location AndAlso w.Location.IsAdjacentTo(Client.PlayerLocation) = False Then
- Player.GoTo = w.Location
- 'Client.MiniMap.GotoLocation(w.Location, targetList)
- WaypointReached = False
- Exit Select
- Else
- If Client.PlayerLocation = w.Location Then
- 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
- Player.GoTo = tlist(0).Location
- ' Client.MiniMap.GotoLocation(tlist(0).Location, targetList)
- WaypointReached = False
- Exit Select
- Else
- If Client.PlayerLocation.IsAdjacentTo(w.Location) Then
- Dim t As Tile = Client.Map.GetTile(w.Location)
- Dim Shovel As Item = Client.Inventory.GetItems.FirstOrDefault(Function(i) i.Id = Constants.Items.Tool.Shovel.Id)
- If Shovel IsNot Nothing AndAlso t IsNot Nothing Then
- Shovel.Use(t)
- Threading.Thread.Sleep(500)
- Player.GoTo = w.Location
- ' Client.MiniMap.GotoLocation(w.Location, targetList)
- WaypointReached = False
- Exit Select
- End If
- End If
- End If
- End If
- End If
- Case Settnings.WaypointType.Corpse
- If Client.PlayerLocation = w.Location Then
- Dim t As Tile = Client.Map.GetPlayerTile
- If t.Items.Count > 0 Then
- Dim i As Item = t.Items.Last
- If i IsNot Nothing Then
- If i.GetFlag(Addresses.DatItem.Flag.IsContainer) Then
- i.OpenAsContainer(CByte(Client.Inventory.GetContainers.Count))
- WaitForLoot = Date.Now.AddSeconds(4)
- End If
- End If
- End If
- WaypointReached = True
- Exit Select
- Else
- Player.GoTo = w.Location
- WaypointReached = False
- Exit Select
- End If
- Case Settnings.WaypointType.Door
- If Client.PlayerLocation = w.Location Then
- WaypointReached = True
- ElseIf Client.PlayerLocation.IsAdjacentTo(w.Location) = False Then
- Dim tiles As List(Of Tile) = Client.Map.GetTilesSameFloor.Where(Function(t) t.Location.IsAdjacentTo(w.Location)).ToList
- Dim tList As List(Of Tile) = tiles.Where(Function(t) t.IsReachable(New List(Of Location))).ToList
- If tList.Count > 0 Then
- Player.GoTo = tList(0).Location
- 'Client.MiniMap.GotoLocation(tList(0).Location, targetList)
- WaypointReached = False
- Else
- Player.GoTo = w.Location
- WaypointReached = False
- End If
- ElseIf Client.PlayerLocation.IsAdjacentTo(w.Location) Then
- Dim t As Tile = Client.Map.GetTile(w.Location)
- For Each i As Item In t.Items
- If i.AutomapColor = Addresses.DatItem.Help.IsDoor Then
- If t.isWalkable = False Then
- i.Use()
- Exit For
- Else
- Player.GoTo = t.Location
- Exit For
- ' Client.MiniMap.GotoLocation(t.Location, targetList)
- End If
- WaypointReached = False
- End If
- Next
- End If
- Case Settnings.WaypointType.Machete
- If Client.PlayerLocation = w.Location OrElse Client.Player.Z <> w.Location.Z Then
- WaypointReached = True
- Exit Select
- Else
- Player.GoTo = w.Location
- WaypointReached = False
- Exit Select
- End If
- End Select
- Return WaypointReached
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement