팁과 노하우

전체보기

모바일 상단 메뉴

본문 페이지

[전문기술] 로그인 브금을 원큐에 바꿔보자

아이폰14
댓글: 14 개
조회: 12106
추천: 3
2025-05-27 01:41:33
다운로드 링크
https://drive.google.com/file/d/13Polm3FGImG0N99SVfEAKETOQ3_eN-C1/view?usp=sharing

안녕하세요?

로그인화면, 메인화면, 캐릭터선택 화면이 감지되면 구 로그인 브금을 출력하는 프로그램을 만들었습니다.

(캐릭터 생성 화면은 지원하지 않습니다.)

다운로드 링크
https://drive.google.com/file/d/13Polm3FGImG0N99SVfEAKETOQ3_eN-C1/view?usp=sharing

[사용 방법]

다운받은 압축파일을 풀어주세요.


풀면 위와같은 프로그램이 생성됩니다.


프로그램을 실행하면 위와 같은 cmd 콘솔창이 뜹니다.


글자가 출력되며 프로그램이 정상적으로 구동됩니다.
첫 실행 시 음악 소리가 크므로, 볼륨 믹서 등의 설정으로 가서 
maple_music 프로그램의 볼륨을 10~20사이로 설정해주세요.

이후 조건에 맞는 (로그인 창, 메인선택 창, 캐릭터 선택 창) 에서 구 로그인 브금이 출력됩니다.

브금 재생을 종료하고 싶다면 cmd 콘솔창을 끄시면 됩니다.

exe 파일 코드

import cv2
import numpy as np
import pyautogui
import pygame
import time
import os
import sys

def resource_path(relative_path):
    try:
        base_path = sys._MEIPASS
    except Exception:
        base_path = os.path.dirname(os.path.abspath(__file__))
    return os.path.join(base_path, relative_path)

def cv_imread(path, flags=cv2.IMREAD_COLOR):
    with open(path, 'rb') as f:
        data = f.read()
    data = np.frombuffer(data, np.uint8)
    return cv2.imdecode(data, flags)

login_screen_path = resource_path('login_screen.png')
main_screen_path = resource_path('main_screen.png')
character_screen_path = resource_path('character_screen.png')
music_file_path = resource_path('background_music.mp3')

print("login_screen.png 존재 여부:", os.path.isfile(login_screen_path))
print("main_screen.png 존재 여부:", os.path.isfile(main_screen_path))
print("character_screen.png 존재 여부:", os.path.isfile(character_screen_path))
print("background_music.mp3 존재 여부:", os.path.isfile(music_file_path))

login_img = cv_imread(login_screen_path, cv2.IMREAD_GRAYSCALE)
main_img = cv_imread(main_screen_path, cv2.IMREAD_GRAYSCALE)
character_img = cv_imread(character_screen_path, cv2.IMREAD_GRAYSCALE)

print("login_img:", login_img is not None)
print("main_img:", main_img is not None)
print("character_img:", character_img is not None)

def screen_match(target_img, threshold=0.3):
    screenshot = pyautogui.screenshot()
    frame = np.array(screenshot)
    gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    if gray_frame.shape[0] < target_img.shape[0] or gray_frame.shape[1] < target_img.shape[1]:
        print("❌ 템플릿 이미지가 스크린샷보다 커서 매칭 불가!")
        return False

    res = cv2.matchTemplate(gray_frame, target_img, cv2.TM_CCOEFF_NORMED)
    loc = np.where(res >= threshold)
    return len(loc[0]) > 0

pygame.mixer.init()
music_playing = False

def is_condition_screen():
    if screen_match(login_img):
        return True
    if screen_match(main_img):
        return True
    if screen_match(character_img):
        return True
    return False

def play_music():
    global music_playing
    if not music_playing:
        pygame.mixer.music.load(music_file_path)
        pygame.mixer.music.play(-1)
        music_playing = True
        print("🎵 음악 재생 시작!")

def stop_music():
    global music_playing
    if music_playing:
        pygame.mixer.music.stop()
        music_playing = False
        print("🛑 음악 중지!")

try:
    while True:
        if is_condition_screen():
            play_music()
        else:
            stop_music()
        time.sleep(1)
except KeyboardInterrupt:
    print("프로그램 종료.")
    stop_music()

초월자

Lv22 아이폰14

모바일 게시판 하단버튼

댓글

새로고침
새로고침

모바일 게시판 하단버튼

지금 뜨는 인벤

더보기+

모바일 게시판 리스트

모바일 게시판 하단버튼

글쓰기

모바일 게시판 페이징

최근 HOT한 콘텐츠

  • 메이플
  • 게임
  • IT
  • 유머
  • 연예
AD