Filthy newline drama?
[craw.git] / script / auto_cast.py
blob892ea5fe5191e158b7177679420a1bee49794ab8
1 import packets, configuration, nil.thread, craw
3 auto_cast_skills = [
4 ('Bone Armor', 0x44),
5 ('Clay Golem', 0x4b),
6 ('Holy Shield', 0x75),
7 #('Oak Sage', 0xe2),
8 ('Cyclone Armor', 0xeb),
11 class auto_cast_handler_class:
12 def __init__(self):
13 self.entering = False
15 def process_bytes(self, bytes):
16 if packets.entering_game(bytes):
17 self.entering = True
19 if self.entering and packets.load_complete(bytes):
20 self.auto_cast()
21 self.entering = False
23 def auto_cast(self):
24 nil.thread.create_thread(self.auto_cast_thread)
26 def auto_cast_thread(self):
27 for name, skill in auto_cast_skills:
28 level = craw.get_skill_level(skill)
29 if level == None or level == 0:
30 continue
32 print 'Casting %s level %d' % (name, level)
33 packets.perform_cast(skill, configuration.auto_cast_switch_delay, configuration.auto_cast_cast_delay)