def _GumpSelect(): CheckSave() CheckDead() WaitGump('5') # First menu (select Swords) WaitGump('102') # Second menu (select Scimitar) WaitGump('1') # Third menu (select Make item) CheckLag(LAG_WAIT) if WaitJournalLine(datetime.now(), 'You put the', 15000): CheckSave() CheckDead() CheckLag(LAG_WAIT) return True
def _Craft(ingots): CheckSave() CheckDead() hammer = False ingots_count = _CountIngots(ingots) while ingots_count >= REQUIRED_INGOTS: time.sleep(0.5) CheckLag(LAG_WAIT) if ObjAtLayer(0x01): Disarm() if FindType(HAMMER_TYPE, Backpack()): hammer = FindItem() UseObject(hammer) WaitTargetObject(ingots) Wait(WAIT_TIME) CheckLag(LAG_WAIT) CancelTarget() _GumpSelect() ingots_count = _CountIngots(ingots) Wait(WAIT_TIME) CheckLag(LAG_WAIT) print 'Ingots left in backpack: %s' % ingots_count if not hammer: print 'You have no hammer in your inventory' return True
def _DropIngots(): print 'Dropping any ingots from backpack' CheckSave() CheckDead() MoveItems(Backpack(), INGOT_TYPE, 0xFFFF, STORAGES['all'], 0, 0, 0, 500) CheckLag(LAG_WAIT) return True
def _DropCrafted(): print 'Dropping crafted items' CheckSave() CheckDead() quantity = FindFullQuantity(FindType(SCIMITAR_TYPE, Backpack())) MoveItems(Backpack(), SCIMITAR_TYPE, 0xFFFF, STORAGES['crafted'], 0, 0, 0, 500) CheckLag(LAG_WAIT) print 'Dropped %s scimitars' % quantity return True
def _SmeltCrafted(): print 'Smelting crafted items' CheckSave() CheckDead() if FindType(SCIMITAR_TYPE, Backpack()): for scimitar in GetFindedList(): UseObject(Forge) WaitTargetObject(scimitar) Wait(WAIT_TIME) CheckLag(LAG_WAIT) print 'Smelting finished'
def DropIngots(): CheckSave() CheckDead() for ingot_type in INGOT_TYPES: if FindType(ingot_type, Backpack()): item = FindItem() storage = get_storage(item) MoveItem(item, GetQuantity(item), storage, 0, 0, 0); Wait(WAIT_TIME) CheckLag(LAG_WAIT) return 1
def Smelting(): CheckSave() CheckDead() for ore_type in ORE_TYPES: if FindType(ore_type,STORAGES['all']): item = FindItem() MoveItem(item, ORE_TO_SMELT, Backpack(), 0, 0, 0) UseObject(item) Wait(WAIT_TIME) CheckLag(LAG_WAIT) return 1 DropIngots()
def _GetIngots(): CheckSave() CheckDead() CheckLag(LAG_WAIT) FindType(INGOT_TYPE, Backpack()) ingots = FindItem() quantity = GetQuantity(ingots) print 'Checking if we have minimum ingots, required to craft' if quantity < REQUIRED_INGOTS: CheckLag(LAG_WAIT) time.sleep(0.5) print 'We have %s ingots in backpack left. Getting more' % quantity if FindType(INGOT_TYPE, STORAGES['low']): ingots = FindItem() MoveItem(ingots, INGOTS_COUNT - quantity, Backpack(), 0, 0, 0) Wait(WAIT_TIME) CheckLag(LAG_WAIT) if ingots: return ingots else: print 'Something is wrong, no ingots found anywhere' return False
def _CountIngots(ingots): CheckSave() CheckDead() if FindType(INGOT_TYPE, Backpack()): return GetQuantity(FindItem()) return False
def _check(): CheckSave() CheckDead() CheckLag(LAG_WAIT)