Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub Attacker()
- If Kernel.Looter.IsLooting Then
- Exit Sub
- End If
- Dim NewMonster As Creature = GetNextTarget()
- If NewMonster IsNot Nothing Then
- Attack(NewMonster)
- End If
- End Sub
- Private Function GetNextTarget() As Creature
- Dim CreatureList As List(Of Creature) = (From j As Creature In Client.BattleList.GetCreatures Where j.DistanceTo(Client.PlayerLocation) <= 8 Order By Math.Round(j.DistanceTo(Client.PlayerLocation)) Select j).ToList
- Dim Tlist As List(Of Target) = (From t As Target In [Global].TargetList Order By t.Prio Select t).ToList
- Tlist.Reverse()
- Dim count As Integer = 0
- For Each c As Creature In CreatureList
- For Each t As Target In Tlist
- If t.Name.ToLower = c.Name.ToLower Then
- If c.IsReachable Then
- TargetsAround = 1
- Return c
- End If
- End If
- Next
- Next
- TargetsAround = 0
- Return Nothing
- End Function
- Private Sub Attack(ByVal newMonster As Creature)
- Dim target As Target = [Global].TargetList.FirstOrDefault(Function(t) t.Name.ToLower = NewMonster.Name.ToLower)
- Player.Stop()
- Thread.Sleep(500)
- newMonster.Attack()
- 'wait until the monster is beeing attacked
- While Player.RedSquare = 0
- Thread.Sleep(10)
- End While
- KeepStance(NewMonster, target)
- End Sub
- Private Sub KeepStance(ByVal creature As Creature, ByVal target As Target)
- While Player.RedSquare > 0
- Dim newMonster = GetNextTarget()
- If newMonster IsNot Nothing Then
- If newMonster.Id <> creature.Id Then
- If isNewTargetBetter(creature, newMonster) Then
- Attack(newMonster)
- Exit Sub
- End If
- End If
- End If
- Select Case target.FollowType
- Case Settnings.FollowMode.Reach
- ReachStance(creature, target)
- Case Settnings.FollowMode.Distance
- DistanceStance(creature, target)
- Case Settnings.FollowMode.ReachFace
- ReachFace(creature, target)
- Case Settnings.FollowMode.Stand
- 'NOTHING
- End Select
- End While
- 'creature died
- If Kernel.Looter.LootWhenALlDead = False Then
- WaitForLoot = Date.Now.AddSeconds(3)
- End If
- End Sub
- Private Function isNewTargetBetter(ByVal currentTarget As Creature, ByVal newtarget As Creature) As Boolean
- Try
- If (currentTarget.Target.Prio - newtarget.Target.Prio) * 2 > StickToTarget_Prio Then
- Return True
- End If
- Dim oldDist As Integer = Math.Round(currentTarget.Location.DistanceTo(Client.PlayerLocation))
- Dim newDist As Integer = Math.Round(newtarget.Location.DistanceTo(Client.PlayerLocation))
- Dim diff As Integer = Math.Round(oldDist - newDist)
- If diff * 2 > StickToTarget_Prio Then
- Return True
- End If
- Return False
- Catch ex As Exception
- Return False
- End Try
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement