import os
import re
import shutil

# AlterEgo database.lua 위치
FILE_PATH = r"C:\Program Files (x86)\World of Warcraft\_retail_\Interface\AddOns\AlterEgo\database.lua"

# 변경할 약자
REPLACEMENTS = {
    "POS": "사론",
    "SR": "하늘탑",
    "SEAT": "삼두정",
    "AA": "대학",
    "WS": "첨탑",
    "MT": "마정",
    "MC": "마이사라",
    "NPX": "공결탑",
}

if not os.path.exists(FILE_PATH):
    print("database.lua를 찾을 수 없습니다.")
    input()
    exit()

# 백업 생성
backup = FILE_PATH + ".bak"
if not os.path.exists(backup):
    shutil.copy2(FILE_PATH, backup)
    print("백업 생성:", backup)

with open(FILE_PATH, "r", encoding="utf-8") as f:
    text = f.read()

count = 0

for old, new in REPLACEMENTS.items():
    pattern = rf'abbr = "{re.escape(old)}"'
    text, n = re.subn(pattern, f'abbr = "{new}"', text)
    count += n

with open(FILE_PATH, "w", encoding="utf-8", newline="") as f:
    f.write(text)

print(f"{count}개의 약자를 변경했습니다.")
input("엔터를 누르면 종료됩니다.")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: