コード例 #1
0
 def convert_logs(self):
     if self.can_convert_logs():
         if len(self._backpack_logs) != 0:
             for log in self._backpack_logs:
                 time_before = dt.datetime.now()
                 UseObject(self._equipped_axe)
                 while InJournalBetweenTimes('What do you want to use this item on?', time_before, dt.datetime.now()) <= 0:
                     Wait(1)
                 
                 WaitTargetObject(log)
                 Wait(LAG_THRESHOLD)
         return
コード例 #2
0
 def run(self):
     while self._running is True:
         UseObject(0000000000)  # ID da maça ou findtype, não sei
         self._start_time = dt.datetime.now()
         self._stop_time = self._start_time + dt.timedelta(seconds=11)
         while self._stop_time > self._stop_time:
             Wait(1)
コード例 #3
0
    def harvest(self, tile, x, y, z):
        CancelWaitTarget()
        CancelTarget()
        
        timestamp_before = dt.datetime.now()
        UseObject(self._equipped_axe)
        while InJournalBetweenTimes('What do you want to use this item on?', timestamp_before, dt.datetime.now()) <= 0:
            Wait(1)
        
        WaitTargetTile(tile, x, y, z)
        Wait(LAG_THRESHOLD)

        if WaitJournalLine(timestamp_before, self.NO_LOGS_MSG, 3000):
            print('No more logs available on this tree.')
            return False
        return True
コード例 #4
0
 def __choose_book(self):
     ClientRequestObjectTarget()
     while ClientTargetResponsePresent() is False:
         Wait(1)
     runebook = ClientTargetResponse()
     if runebook['ID'] != 0:
         return runebook['ID']
     else:
         return None
コード例 #5
0
 def __get_rune_names(self):
     rune_names = []
     text_lines = []
     while not text_lines:
         text_lines = GetGumpTextLines(self.gump.get_last_gump_index())
         Wait(1000)
     rune_names = [
         text_lines[x['TextID']] for x in self.gump_dict['CroppedText']
         if x['Page'] == 1 and text_lines[x['TextID']] != 'Empty'
     ]
     return rune_names
コード例 #6
0
 def _count_resources(self):
     board_type = self._get_material_type('boards')
     UseObject(self._deposit_box)
     Wait(LAG_THRESHOLD)
     print('Deposit Box Inventory')
     print('---------------------')
     for color in self._get_material_colors(board_type):
         FindTypeEx(board_type, color, self._deposit_box, False)
         color_name = self._get_color_name(board_type, color)
         color_qty = FindFullQuantity()
         self._session_data[color_name] = color_qty
     for item, val in self._session_data.items():
         print(f'{item.capitalize()}: {val:,}'.replace(',', '.'))
     return
コード例 #7
0
 def __equip_axe(self):
     if FindTypesArrayEx(self._axe_types, [0], [Backpack()], False) > 0:
         if FindCount() < 2:
             self._equipped_axe = FindItem()
             Equip(LhandLayer(), self._equipped_axe)
         else:
             ClientPrint('Two or more axes found in bag, choose one:')
             CancelWaitTarget()
             CancelTarget()
             ClientRequestObjectTarget()
             while ClientTargetResponsePresent() is False:
                 Wait(1)
             target_response = ClientTargetResponse()
             self._equipped_axe = target_response['ID']
             Equip(LhandLayer(), self._equipped_axe)
     else:
         raise Exception('No axes in the backpack')
コード例 #8
0
 def __find_axe(self):
     left_hand = ObjAtLayer(LhandLayer())
     right_hand = ObjAtLayer(RhandLayer())
     
     if left_hand == 0 and right_hand == 0:
         self.__equip_axe()
         return True
     elif left_hand != 0 and GetType(left_hand) in self._axe_types:
         self._equipped_axe = left_hand
         return True
     elif right_hand != 0 and GetType(right_hand) not in self._axe_types:
         UnEquip(RhandLayer())
         Wait(LAG_THRESHOLD)
         self.__equip_axe()
         return True
     else:
         raise Exception('No axe found in the backpack or hands')
コード例 #9
0
 def _deposit_items(self):
     for item in self._resources_found_list:
         MoveItem(item, 0, self._deposit_box, 0, 0, 0)
         Wait(WAITING)
     return
コード例 #10
0
ファイル: helpers.py プロジェクト: cesarsl/uo-stealth-scripts
def get_object_id():
    ClientRequestObjectTarget()
    while ClientTargetResponsePresent() is False:
        Wait(1)
    return ClientTargetResponse().get('ID')
コード例 #11
0
def CheckSave():
    Time = dt.now() - timedelta(0, 30)
    if InJournalBetweenTimes('Saving World State', Time, datetime.now()) >= 0:
        Wait(30000)
コード例 #12
0
def WaitConnection(WaitTime):
    if Connected():
        return
    while not Connected():
        Wait(1000)
    Wait(WaitTime)
コード例 #13
0
    def travel(self,
               rune_position,
               method='r',
               retry=['fizzles', 'recover', 'reagents', 'tithing', 'mana']):

        BAD_MSGS = [
            'fizzles',
            'location is blocked',
            'not yet recovered',
            'no charges left',
            'more reagents',
            'tithing points',
            'insufficient mana',
            'not marked',
            'cannot teleport from here',
        ]

        if rune_position not in list(range(1, 17)):
            raise Exception(
                f'Rune number must be between 1 and 16, got {rune_position}')

        if rune_position > self.rune_count:
            raise Exception(
                f'This book only contains {self.rune_count} runes, got position {rune_position}'
            )

        if method not in ['r', 'g', 's', 'c']:
            raise Exception(f'Unknown travel method: {method}')

        if not isinstance(retry, list):
            raise TypeError(f'Retry phrases require a list, got {type(retry)}')

        while True:
            char_pos = (GetX(Self()), GetY(Self()))

            while not self.gump.get_gump_from_object(self.id,
                                                     self.RUNEBOOK_GUMP_ID):
                Wait(1)

            if method == 'r':
                gump_button = 5 + ((rune_position - 1) * 6)
            elif method == 'g':
                gump_button = 6 + ((rune_position - 1) * 6)
            elif method == 'c':
                gump_button = 7 + ((rune_position - 1) * 6)
            elif method == 's':
                raise Exception('Scroll traveling not implemented yet')

            before = dt.datetime.now()
            timeout = before + dt.timedelta(seconds=7)
            WaitGump(gump_button)

            if WaitJournalLine(before, ('|').join(BAD_MSGS), 4000):
                if BAD_MSGS[FoundedParamID()] not in retry:
                    return BAD_MSGS[FoundedParamID()]
            else:
                if method == 'g':
                    pass
                while dt.datetime.now() < timeout:
                    if (GetX(Self()), GetY(Self())) != char_pos:
                        return 'success'
                    else:
                        Wait(1)

        return 'unknown'
コード例 #14
0
 def __get_gump_dict(self):
     while self.gump.get_gump_from_object(self.id,
                                          self.RUNEBOOK_GUMP_ID) is False:
         Wait(1)
     gump_dict = self.gump.get_gump_dict(self.gump.get_last_gump_index())
     return gump_dict