def _clear_state(self): super()._clear_state() self._advertising_manager.clear_state() if not self.is_active_household_and_zone(): return zone_director = get_vet_clinic_zone_director() if zone_director is not None: zone_director.clear_state()
def test_target(self, target, resolver, tooltip=None): vet_zone_director = get_vet_clinic_zone_director() if not vet_zone_director: return TestResult(False, 'No vet zone director running.') if vet_zone_director.is_waiting_for_services(target.sim_id): return TestResult.TRUE return TestResult(False, '{} not waiting for services'.format(target), tooltip=tooltip)
def get_cap_amount(self): zone_director = get_vet_clinic_zone_director() if zone_director is None: return 0 exam_table_thresholds = sorted( self.object_count_waiting_customer_cap.keys(), reverse=True) num_exam_tables = zone_director.num_exam_tables for threshold in exam_table_thresholds: if num_exam_tables >= threshold: return self.object_count_waiting_customer_cap[threshold] return 0
def test_target(self, target, resolver, tooltip=None): vet_zone_director = get_vet_clinic_zone_director() if not vet_zone_director: return TestResult(False, 'No vet zone director running.') participant = resolver.get_participant(self.participant) if not vet_zone_director.is_assigned_to_vet(target.sim_id, participant.sim_id): return TestResult(False, '{} is not assigned to {}'.format( target, participant), tooltip=tooltip) return TestResult.TRUE
def find_best_choice(self, si): if not self._choices: return actor_id = si.sim.sim_id vzd = get_vet_clinic_zone_director() if vzd is None: return waiting_sim_infos = tuple(result.sim_info for result in self._choices) for pet in vzd.waiting_sims_gen(actor_id): if pet.sim_info in waiting_sim_infos: log_vet_flow_entry(repr(si.sim), type(self).__name__, '{} chose {}'.format(repr(si), repr(pet.sim_info))) vzd.reserve_waiting_sim(pet.sim_id, actor_id) return pet.sim_id
def assign_to_vet(self, vet): if self._assigned_vet_id == vet.sim_id: return if self._assigned_vet_id is not None: self.unassign_from_vet() self.log_flow_entry('Assigned to {}'.format(repr(vet))) self._assigned_vet_id = vet.sim_id zone_director = get_vet_clinic_zone_director() if zone_director is None: self._self_destruct() return zone_director.on_vet_assigned( self.id, vet.sim_id, tuple(sim.sim_id for sim in self.all_sims_in_situation_gen()))
def bill_owner_for_treatment(opt_sim: OptionalTargetParam = None, _connection=None): sim = get_optional_target(opt_sim, _connection) if sim is None: sims4.commands.output("Sim {} doesn't exist.".format(opt_sim), _connection) return False zone_director = get_vet_clinic_zone_director() if zone_director is None: sims4.commands.Command('Not currently on a vet clinic lot.', _connection) return False zone_director.bill_owner_for_treatment(sim) return True
def test_target(self, target, resolver, tooltip=None): vet_zone_director = get_vet_clinic_zone_director() if not vet_zone_director: return TestResult(False, 'No vet zone director running.') if vet_zone_director.is_vet_attending_any_customers(target.sim_id): if self._invert: return TestResult(False, '{} is assigned to someone'.format(target), tooltip=tooltip) return TestResult.TRUE if not self._invert: return TestResult(False, '{} not assigned to anyone'.format(target), tooltip=tooltip) return TestResult.TRUE
def began_waiting(self): self._wait_start_time = services.time_service().sim_now business_manager = services.business_service( ).get_business_manager_for_zone() (pet, pet_owner) = self._get_pet_and_owner_sim_infos() if business_manager is not None: business_manager.add_customer(pet_owner) sims_in_situation = (pet, pet_owner) is_player_in_situation = any(not sim.is_npc for sim in sims_in_situation) zone_director = get_vet_clinic_zone_director() if zone_director is None: self._self_destruct() return zone_director.on_customers_waiting( self.id, tuple(sim.sim_id for sim in sims_in_situation), player_situation=is_player_in_situation) self._should_leave_review = self.get_num_playable_sims() == 0 automation_event(*('VetCustomerBeganWaiting', ), SituationId=self.id, PetSimId=pet.sim_id, PetOwnerSimId=pet_owner.sim_id)
def generate_customer_data(zone_id:int=None): customer_situations_data = [] zone_director = get_vet_clinic_zone_director() if zone_director is None: return customer_situations_data waiting_situations_ids = list(zone_director._waiting_situations.keys()) waiting_situations_ids_list_fixed = tuple(waiting_situations_ids) def add_customer_situation_data(customer_situation): is_waiting_situation = customer_situation.id in waiting_situations_ids order_in_queue = waiting_situations_ids_list_fixed.index(customer_situation.id) if is_waiting_situation else 'Not In Queue' customer_situations_data.append({'waiting_start_time': str(customer_situation.wait_start_time), 'waiting_queue_order': str(order_in_queue), 'situation_id': str(customer_situation.id), 'pet': str(customer_situation.get_pet()), 'owner': str(customer_situation.get_pet_owner()), 'current_state': customer_situation.current_state_type.__name__, 'vet': str(customer_situation.get_vet())}) if is_waiting_situation: waiting_situations_ids.remove(customer_situation.id) for customer_situation in zone_director.customer_situations_gen(): add_customer_situation_data(customer_situation) if waiting_situations_ids: for customer_situation_id in tuple(waiting_situations_ids): customer_situation = services.get_zone_situation_manager().get(customer_situation_id) if customer_situation is not None: add_customer_situation_data(customer_situation) return customer_situations_data
def on_remove(self): super().on_remove() self.unassign_from_vet() vzd = get_vet_clinic_zone_director() if vzd is not None: vzd.on_customer_situation_being_destroyed(self.id)
def unassign_from_vet(self): if self._assigned_vet_id is not None: vzd = get_vet_clinic_zone_director() if vzd is not None: vzd.remove_from_vet(self._assigned_vet_id) self._assigned_vet_id = None