Ejemplo n.º 1
0
 def _send_tracker_to_client(self, init=False):
     msg_empty = True
     msg = Area_pb2.AchievementTrackerUpdate()
     for achievement in self._completed_milestones:
         if not self.milestone_sent(achievement):
             self._sent_milestones.add(achievement)
             msg.achievements_completed.append(achievement.guid64)
             if msg_empty:
                 msg_empty = False
     for objective in self._completed_objectives:
         if not self.objective_sent(objective):
             self._sent_objectives.add(objective)
             msg.objectives_completed.append(objective.guid64)
             if msg_empty:
                 msg_empty = False
     if not msg_empty:
         msg.account_id = self._account_id
         msg.init_message = init
         cheat_service = services.get_cheat_service()
         msg.cheats_used = cheat_service.cheats_ever_enabled
         distributor = Distributor.instance()
         owner = self.owner_sim_info
         if owner is None:
             distributor.add_op_with_no_owner(GenericProtocolBufferOp(Operation.ACCT_ACHIEVEMENT_TRACKER_UPDATE, msg))
         else:
             distributor.add_op(owner, GenericProtocolBufferOp(Operation.ACCT_ACHIEVEMENT_TRACKER_UPDATE, msg))
Ejemplo n.º 2
0
 def check_command_permission(self, client_id, command_type):
     tgt_client = services.client_manager().get(client_id)
     if tgt_client is None:
         return False
     if command_type == CommandType.Cheat:
         cheat_service = services.get_cheat_service()
         return cheat_service.cheats_enabled
     return tgt_client.account.check_command_permission(command_type)
Ejemplo n.º 3
0
def is_command_available(command_type: CommandType):
    if command_type >= CommandType.Live:
        return True
    cheat_service = services.get_cheat_service()
    cheats_enabled = cheat_service.cheats_enabled
    if command_type >= CommandType.Cheat and cheats_enabled:
        return True
    elif command_type >= CommandType.Automation and paths.AUTOMATION_MODE:
        return True
    return False
Ejemplo n.º 4
0
def _testing_cheats_common(enable: bool = False, _connection=None):
    output = sims4.commands.CheatOutput(_connection)
    cheat_service = services.get_cheat_service()
    if enable:
        cheat_service.enable_cheats()
        output('Cheats are enabled.')
    else:
        cheat_service.disable_cheats()
        output('Cheats are disabled.')
    _send_to_client(_connection)
    return True
Ejemplo n.º 5
0
def display_cheat_status(enable: bool = False, _connection=None):
    cheat_service = services.get_cheat_service()
    output = sims4.commands.CheatOutput(_connection)
    if cheat_service.cheats_enabled:
        if cheat_service.cheats_ever_enabled:
            output('Cheats are enabled.')
        else:
            output('Cheats are enabled (but were never enabled!)')
    elif cheat_service.cheats_ever_enabled:
        output('Cheats disabled, but were enabled.')
    else:
        output('Cheats never enabled.')
    return True
Ejemplo n.º 6
0
 def _send_objectives_update_to_client(self):
     owner = self.owner_sim_info
     if owner is None or owner.is_npc or owner.manager is None:
         return
     msg = Sims_pb2.GoalsStatusUpdate()
     if self._update_objectives_msg_for_client(msg):
         msg.sim_id = owner.id
         cheat_service = services.get_cheat_service()
         msg.cheats_used = cheat_service.cheats_ever_enabled
         distributor = Distributor.instance()
         distributor.add_op(
             owner,
             GenericProtocolBufferOp(Operation.SIM_GOALS_STATUS_UPDATE,
                                     msg,
                                     block_on_task_owner=False))
Ejemplo n.º 7
0
def testing_cheats(enable: bool = False, _connection=None):
    if paths.IS_DESKTOP:
        _testing_cheats_common(enable=enable, _connection=_connection)
    else:
        cheat_service = services.get_cheat_service()
        if cheat_service.cheats_ever_enabled or not enable:
            _testing_cheats_common(enable=enable, _connection=_connection)
        else:

            def _on_confirm_cheat_decision(_dialog):
                if _dialog.accepted:
                    _testing_cheats_common(enable=enable,
                                           _connection=_connection)

            dialog = CheatDialogTuning.CONFIRM_CHEAT_DIALOG(None)
            dialog.show_dialog(on_response=_on_confirm_cheat_decision)
Ejemplo n.º 8
0
def _send_to_client(_connection):
    client = services.client_manager().get(_connection)
    cheat_service = services.get_cheat_service()
    cheat_service.send_to_client(client)
Ejemplo n.º 9
0
def override_ever_enabled(enable: bool = False, _connection=None):
    cheat_service = services.get_cheat_service()
    cheat_service.cheats_ever_enabled = enable
    _send_to_client(_connection)
    return True