-
Notifications
You must be signed in to change notification settings - Fork 0
/
heal_lowest-hp_pet.py
66 lines (52 loc) · 2.03 KB
/
heal_lowest-hp_pet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from Scripts.utilities.items import FindItem
from Scripts.glossary.colors import colors
import System.Collections.Generic
from System.Collections.Generic import List
from Scripts.glossary.enemies import GetEnemyNotorieties
from System import Byte, Int32
filMobs = Mobiles.Filter()
filMobs.Enabled = True
filMobs.Friend = True
filMobs.IsHuman = False
filMobs.RangeMax = 15
myPets = Mobiles.ApplyFilter(filMobs)
# PET HEALING #
###############
def HealLowestHpPet():
global petsToCheck
bandages = FindItem( 0x0E21, Player.Backpack )
if bandages == None:
Misc.SendMessage( 'Out of bandages!', colors[ 'red' ] )
return
#Misc.SendMessage( 'healing pets' )
lowesthppercentage = 100
pettoheal = None
#for petSerial in petsToCheck:
for pet in myPets:
#pet = Mobiles.FindBySerial( petSerial )
if pet == None:
continue
if pet.Hits > 0:
hppercentage = ( float( pet.Hits ) / float( pet.HitsMax ) * 100 )
# Player.HeadMessage( colors[ 'cyan' ], '%s (currently %i%% health)' % ( pet.Name, ( float( pet.Hits ) / float( pet.HitsMax ) * 100 ) ) )
if hppercentage < lowesthppercentage:
pettoheal = pet
lowesthppercentage = hppercentage
if pettoheal:
if Target.HasTarget():
Target.Cancel()
Target.ClearQueue()
Player.HeadMessage(colors[ 'green' ],pettoheal.Name)
Items.UseItem( bandages )
Target.WaitForTarget(1000)
if Target.HasTarget():
Player.HeadMessage( colors[ 'cyan' ], '(currently %i%% health)' % ( ( float( pettoheal.Hits ) / float( pettoheal.HitsMax ) * 100 ) ) )
Target.TargetExecute( pettoheal )
Misc.Pause(150)
else:
Misc.SendMessage('No bandaid target')
#Misc.SendMessage( 'Start Healing Lowest HP Pet', colors[ 'green' ])
#while not Player.IsGhost:
# HealPets()
# Misc.Pause(150)
HealLowestHpPet()