Example #1
0
 def can_trigger(cls, owner):
     if not screens.in_category(owner.screen_id, screens.PORT):
         return
     if owner.manager.is_manipulator_scheduled('BoostShipBuilding'):
         return
     if AutoReceiveShips.get_receivable_slots(owner.objects):
         return {}
Example #2
0
File: repair.py Project: kcaa/kcaa
 def can_trigger(cls, owner):
     if not screens.in_category(owner.screen_id, screens.PORT):
         return
     repair_dock = owner.objects['RepairDock']
     now = long(1000 * time.time())
     for slot in repair_dock.slots:
         if slot.in_use and now + cls.boost_threshold < slot.eta:
             return {'slot_id': slot.id}
Example #3
0
File: repair.py Project: kcaa/kcaa
 def can_trigger(cls, owner):
     if not screens.in_category(owner.screen_id, screens.PORT):
         return
     # Once this avoided to trigger when in PORT_REPAIR screen. Probably
     # there was a reason for that. But... what? To avoid collision with
     # repair boost?
     if AutoRepairShips.get_ships_to_repair(owner.objects):
         return {}
Example #4
0
File: mission.py Project: kcaa/kcaa
 def can_trigger(cls, owner):
     if not screens.in_category(owner.screen_id, screens.PORT):
         return
     if owner.manager.is_manipulator_scheduled('GoOnMission'):
         return
     if AutoGoOnMission.get_go_on_config(owner.objects,
                                         owner.manager.preferences,
                                         owner.manager.states):
         return {}
Example #5
0
 def can_trigger(cls, owner):
     if not screens.in_category(owner.screen_id, screens.PORT):
         return
     if (owner.manager.is_manipulator_scheduled('DissolveShip') or
             owner.manager.is_manipulator_scheduled('EnhanceBestShip') or
             owner.manager.is_manipulator_scheduled('AutoEnhanceBestShip')):
         return
     if DissolveLeastValuableShips.get_target_ships(
             owner.objects['ShipList'], owner.objects['PlayerInfo']):
         return {}
Example #6
0
 def can_trigger(cls, owner):
     if not screens.in_category(owner.screen_id, screens.PORT):
         return
     fleet_list = owner.objects.get('FleetList')
     ship_list = owner.objects.get('ShipList')
     fleet_ids_to_charge = []
     for fleet in fleet_list.fleets:
         if fleet.mission_id:
             continue
         for ship_id in fleet.ship_ids:
             ship = ship_list.ships[str(ship_id)]
             loaded = ship.loaded_resource
             capacity = ship.resource_capacity
             if loaded is None or capacity is None:
                 logger.debug(u'Ship {} ({}) looks incomplete.'.format(
                     ship.name, ship.id))
                 logger.debug(str(ship))
             if loaded.fuel < capacity.fuel or loaded.ammo < capacity.ammo:
                 fleet_ids_to_charge.append(fleet.id)
                 break
     if fleet_ids_to_charge:
         return {'fleet_ids': fleet_ids_to_charge}
Example #7
0
File: quest.py Project: kcaa/kcaa
 def precondition(cls, owner):
     return screens.in_category(owner.screen_id, screens.PORT)
Example #8
0
 def can_trigger(cls, owner):
     if screens.in_category(owner.screen_id, screens.PORT_MAIN):
         return
     ship_list = owner.objects['ShipList']
     if any([s.reserved_for_use for s in ship_list.ships.itervalues()]):
         return {}