forked from matsamilla/Razor-Enhanced
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwand_Lightning.py
61 lines (49 loc) · 1.93 KB
/
wand_Lightning.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
wands = [0xdf5,0xdf3,0xdf4,0xdf2]
wandType = "lightning"
msgColor = 33
dragTime = 600
def getWands( itemID , container = Player.Backpack ):
'''
Recursively looks through backpack for any wands in the wands list
Returns a list with wand serials
'''
# Create the list
wandList = []
if isinstance( itemID, int ):
# add wand serials to list
for item in container.Contains:
if item.ItemID == itemID:
wandList.append(item.Serial)
elif isinstance( itemID, list ):
# add wand serials to list
for item in container.Contains:
if item.ItemID in itemID:
wandList.append(item.Serial)
else:
raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )
subcontainers = [ item for item in container.Contains if item.IsContainer ]
# Iterate through each item in the given list
for subcontainer in subcontainers:
wandsInSubContainer = getWands( itemID, subcontainer )
for i in wandsInSubContainer:
wandList.append(i)
return wandList
def findAndEquipWand (wandType):
wandsInPack = getWands( wands )
for i in wandsInPack:
wand = Items.FindBySerial(i)
Items.WaitForProps( wand, 500 )
propList = Items.GetPropStringList( wand )
if any( wandType in s for s in propList ):
#Misc.SendMessage(wandType + " found")
if Player.CheckLayer('LeftHand'):
Player.UnEquipItemByLayer('LeftHand')
Misc.Pause( dragTime )
elif Player.CheckLayer('RightHand'):
Player.UnEquipItemByLayer('RightHand')
Misc.Pause( dragTime )
Player.EquipItem( wand )
Misc.Pause( dragTime )
Items.UseItem( wand )
Player.HeadMessage( msgColor, "No wands found!" )
findAndEquipWand (wandType)