TC Keyboard Warrior

description

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         TC Keyboard Warrior
// @namespace    namespace
// @version      0.1
// @description  description
// @license      MIT
// @author       tos
// @match       *.torn.com/loader.php*
// @grant        none
// ==/UserScript==


/* QUERY SELECTORS
Start Attack:
div#defender button.torn-btn'

Weapons:
#weapon_main
#weapon_second
#weapon_melee
#weapon_temp
#weapon_fists
#weapon_boots
*/

document.addEventListener('keydown', (e) => {
  const key = e.key.toUpperCase()
  switch(key) {
    case "A":
      document.querySelector('div#defender button.torn-btn').click()
      break
    case "B":
      document.querySelector('#weapon_main').click()
      break
    case "C":
      document.querySelector('#weapon_second').click()
      break
    case "D":
      document.querySelector('#weapon_melee').click()
      break
    case "E":
      document.querySelector('#weapon_temp').click()
      break
    case "F":
      document.querySelector('#weapon_fists').click()
      break
    case "G":
      document.querySelector('#weapon_boots').click()
      break
    default:
      console.log(e)
  }
})