/**
* 로스트아크 프로모션 캐릭터명 일괄 조회 스크립트
* 사용법:
* 1. https://lostark.game.onstove.com/Promotion/Draw/261202 접속 (필요시 로그인)
* 2. F12 (개발자 도구) -> Console(콘솔) 탭 이동
* 3. 아래 nicknames 배열에 검색할 닉네임 목록을 입력 후 전체 복사 & 붙여넣기하여 Enter 실행
*/
(async function checkLostArkNicknames() {
// =========================================================================
// [설정 영역] 여기에 검색하고 싶은 닉네임들을 따옴표("") 안에 쉼표(,)로 구분해 적어주세요.
// =========================================================================
const nicknames = [
"명왕",
"카리나",
"체술",
"체리",
"한지우"
];
// 검색 간격 (밀리초 단위, 1500 = 1.5초). 너무 빠르면 서버에서 차단될 수 있습니다.
const DELAY_MS = 1500;
// =========================================================================
// 대기 함수
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
// DOM 요소 탐색
const inputEl = document.querySelector('#character_name');
if (!inputEl) {
console.error("❌ 검색창(#character_name)을 찾을 수 없습니다. 올바른 이벤트 페이지인지 확인해주세요.");
return;
}
// 검색 버튼 찾기 (보통 input의 부모나 형제 요소에 button이 위치함)
const searchContainer = inputEl.closest('.area-search') || inputEl.parentElement;
const searchBtn = searchContainer ? searchContainer.querySelector('button') : null;
const results = [];
console.clear();
console.log(`🚀 총 ${nicknames.length}개의 닉네임 검색을 시작합니다... (예상 소요시간: 약 ${(nicknames.length * DELAY_MS / 1000).toFixed(1)}초)`);
console.log("--------------------------------------------------");
for (let i = 0; i < nicknames.length; i++) {
const name = nicknames[i].trim();
if (!name) continue;
try {
// 1. 기존 결과 텍스트 초기화 (이전 검색 결과가 남아서 오인식되는 것 방지)
const prevPossibility = document.querySelector('.possibility');
const prevState = document.querySelector('.state');
if (prevPossibility) prevPossibility.textContent = '';
if (prevState) prevState.textContent = '';
// 2. 검색창에 닉네임 입력 및 이벤트 발생 (React/Vue 등 프레임워크 대응)
inputEl.value = name;
inputEl.dispatchEvent(new Event('input', { bubbles: true }));
inputEl.dispatchEvent(new Event('change', { bubbles: true }));
// 3. 검색 버튼 클릭 또는 엔터키 이벤트 트리거
if (searchBtn) {
searchBtn.click();
} else {
// 버튼이 없는 경우 Enter 키 이벤트 발송
const enterEvent = new KeyboardEvent('keydown', {
key: 'Enter',
code: 'Enter',
keyCode: 13,
which: 13,
bubbles: true
});
inputEl.dispatchEvent(enterEvent);
// 폼(form) 태그로 감싸져 있을 경우 submit 시도
const form = inputEl.closest('form');
if (form) form.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
}
// 4. 서버 응답 및 화면 렌더링 대기
await sleep(DELAY_MS);
// 5. 결과 파싱
const possibilityEl = document.querySelector('.possibility');
const stateEl = document.querySelector('.state');
const statusMsg = possibilityEl ? possibilityEl.textContent.trim() : "결과 메시지 없음";
const isAvailable = statusMsg.includes("응모 가능한 캐릭터명입니다");
// 응모 인원 숫자 추출
let applicantCount = "-";
if (stateEl) {
const emEl = stateEl.querySelector('em');
applicantCount = emEl ? emEl.textContent.trim() : stateEl.textContent.trim();
}
// 결과 저장
const record = {
"순번": i + 1,
"닉네임": name,
"가능여부": isAvailable ? "✅ 가능" : "❌ 불가",
"응모인원": isAvailable ? `${applicantCount}명` : "-",
"상세메시지": statusMsg
};
results.push(record);
// 실시간 진행 상황 출력
console.log(`[${i + 1}/${nicknames.length}] ${name} -> ${record["가능여부"]} (인원: ${record["응모인원"]}) | ${statusMsg}`);
} catch (error) {
console.error(`[${i + 1}/${nicknames.length}] ${name} 검색 중 오류 발생:`, error);
results.push({
"순번": i + 1,
"닉네임": name,
"가능여부": "⚠️ 오류",
"응모인원": "-",
"상세메시지": error.message
});
}
}
console.log("--------------------------------------------------");
console.log("🎉 모든 검색이 완료되었습니다! 아래 표에서 결과를 확인하세요.");
// 전체 결과를 깔끔한 표 형태로 출력
console.table(results);
// 응모 가능한 닉네임만 따로 필터링해서 복사하기 쉽게 출력
const availableList = results
.filter(r => r["가능여부"] === "✅ 가능")
.map(r => `${r["닉네임"]} (${r["응모인원"]})`);
console.log("n✨ [응모 가능한 닉네임 요약] ✨");
if (availableList.length > 0) {
console.log(availableList.join("n"));
} else {
console.log("응모 가능한 닉네임이 없습니다.");
}
})();