Skip to content

Instantly share code, notes, and snippets.

@tnraro
Last active April 6, 2022 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnraro/1ea2611864086a598512b30c3aeb8c79 to your computer and use it in GitHub Desktop.
Save tnraro/1ea2611864086a598512b30c3aeb8c79 to your computer and use it in GitHub Desktop.

firevoid 자동화 스크립트

.click()이 막힌 관계로 다음과 같은 번거로운 코드를 주입해야해요.

먼저, 선호하는 브라우저에서 firevoid를 켜주세요.

F12를 눌러 개발자 도구를 켜주세요.

app.js를 찾아 들어가세요. 크롬은 sources 탭에, 파이어폭스는 debugger 탭에 있어요.

가장 바깥쪽 아무 라인이나 잡고, 아래와 같이 조건부 중단점을 추가해주세요.

window.api={handleKeydown},false

예를 들어 파이어폭스의 경우 58번 줄에서 줄 번호를 우클릭하고, Add condition을 눌러요.

모든 준비가 끝났어요. 이제 콘솔에 firevoid-hack.js의 내용을 붙여넣고 실행해요.

function init() {
const getIndex = n => Array.prototype.indexOf.call(n.parentNode.children, n);
const lineIndices = new WeakMap(Array.from(document.querySelectorAll("tr"), (l, i) => [l, i]));
const persons = Array.from(document.querySelectorAll(".person"), p => ({ n: p, y: lineIndices.get(p.parentNode), x: getIndex(p) }));
const keys = "fvjn";
const observer = new MutationObserver((ms) => {
for (const m of ms) {
if (m.type !== "attributes") continue;
if (m.attributeName !== "class") continue;
if (!m.target.className.startsWith("fire")) continue;
const fire = m.target;
const line = fire.parentNode;
const isLeft = fire.className.endsWith("left");
const lookahead = isLeft ? 1 : -1;
const fireX = getIndex(fire);
const fireY = lineIndices.get(line);
persons.forEach((p, i) => {
if (p.y !== fireY) return;
if (p.x !== fireX + lookahead) return;
console.log(p);
let direction = 1 - p.y;
if (direction === 0) {
direction = Math.random() > 0.5 ? 1 : -1;
}
const key = keys[i * 2 + (direction + 0.1 | 0)];
window.api.handleKeydown({ key });
p.y += direction;
});
}
});
observer.observe(document.querySelector("#gameboard"), { subtree: true, attributes: true });
}
if (window.api?.handleKeydown == null) {
throw new Error("https://gist.github.com/tnraro/1ea2611864086a598512b30c3aeb8c79 확인 ㄱ");
}
init();
@tnraro
Copy link
Author

tnraro commented Apr 6, 2022

⬜⬜⬜⬜⬜
⬜🟥⬜⬜⬜
⬜⬜🟨🟪⬜

이런 상황에 대응을 못할 가능성이 있습니다.

@tnraro
Copy link
Author

tnraro commented Apr 6, 2022

firevoid

안 끝나서 여기까지...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment