diff --git a/repo/js/Login/main.js b/repo/js/Login/main.js new file mode 100644 index 00000000..08d2856b --- /dev/null +++ b/repo/js/Login/main.js @@ -0,0 +1,109 @@ +(async function () { + //特殊字符键盘映射集 + const map = { + '(': '9', + ')': '0', + '`': 'VK_OEM_3', + '!': '1', + '@': '2', + '#': '3', + '$': '4', + '%': '5', + '^': '6', + '&': '7', + '*': '8', + '_': 'VK_SUBTRACT', + '-': 'VK_SUBTRACT', + '+': 'VK_ADD', + '=': 'VK_ADD', + '|': 'VK_SEPARATOR', + '{': 'VK_OEM_4', + '}': 'VK_OEM_6', + '[': 'VK_OEM_4', + ']': 'VK_OEM_6', + ':': 'VK_OEM_1', + ';': 'VK_OEM_1', + '\'': 'VK_OEM_7', + '"': 'VK_OEM_7', + '<': 'VK_OEM_COMMA', + '>': 'VK_OEM_PERIOD', + ',': 'VK_OEM_COMMA', + '.': 'VK_OEM_PERIOD', + '?': 'VK_OEM_2', + }; + function replaceUsingMap(input) { + return map[input] || input; // 如果找到映射,返回对应的值;否则返回原值 + } + setGameMetrics(1920, 1080, 2); + await sleep(3000); + //同意用户协议 + click(698, 610); + await sleep(1000); + //点击用户名输入框 + click(800, 400); + await sleep(1000); + //输入用户名 + log.info("输入用户名"); + let username = settings.username; + let usernameList = username.split(''); + usernameList.forEach(element => { + charCode = element.charCodeAt(0); + let arr = [40,41,33,64,35,36,37,94,38,42,95,43,124,123,125,58,34,60,62,63]; + if(charCode > 64 && charCode < 91 || arr.includes(charCode)==1){ + element=replaceUsingMap(element); + keyDown("SHIFT"); + keyPress(element); + keyUp("SHIFT"); + }else{ + element=replaceUsingMap(element); + keyPress(element); + } + }); + log.info("用户名={xx}",username) + await sleep(3000); + //点击用户名输入框 + click(800, 500); + await sleep(1000); + //输入密码 + log.info("输入密码") + let password = settings.password; + let passwordList = password.split(''); + passwordList.forEach(element => { + charCode = element.charCodeAt(0); + let arr = [40,41,33,64,35,36,37,94,38,42,95,43,124,123,125,58,34,60,62,63]; + if(charCode > 64 && charCode < 91 || arr.includes(charCode)==1){ + element=replaceUsingMap(element); + keyDown("SHIFT"); + keyPress(element); + keyUp("SHIFT"); + }else{ + element=replaceUsingMap(element); + keyPress(element); + } + }); + log.info("密码={xx}",password); + await sleep(1000); + //登录 + keyPress("RETURN"); + await sleep(10000); + //进入世界 + click(950, 1000); + log.info("进入世界"); + await sleep(10000); + //进入世界2 + click(950, 1000); + log.info("进入世界2"); + await sleep(10000); + //点击领月卡 + click(950, 1000); + log.info("点击领月卡"); + await sleep(1000); + //点击领月卡2 + click(950, 1000); + log.info("点击领月卡2"); + await sleep(1000); + //点击领月卡2 + click(950, 1000); + log.info("点击领月卡3"); + await sleep(1000); +})(); \ No newline at end of file diff --git a/repo/js/Login/manifest.json b/repo/js/Login/manifest.json new file mode 100644 index 00000000..13665b8e --- /dev/null +++ b/repo/js/Login/manifest.json @@ -0,0 +1,13 @@ +{ + "manifest_version": 1, + "name": "登录游戏", + "version": "1.0", + "description": "输入账号和密码并进入游戏", + "authors": [ + { + "name": "愚溪", + } + ], + "settings_ui": "settings.json", + "main": "main.js" +} \ No newline at end of file diff --git a/repo/js/Login/settings.json b/repo/js/Login/settings.json new file mode 100644 index 00000000..18f0822e --- /dev/null +++ b/repo/js/Login/settings.json @@ -0,0 +1,12 @@ +[ + { + "name": "username", + "type": "input-text", + "label": "账号" + }, + { + "name": "password", + "type": "input-text", + "label": "密码" + } +] diff --git a/repo/js/Logout/main.js b/repo/js/Logout/main.js new file mode 100644 index 00000000..39e41483 --- /dev/null +++ b/repo/js/Logout/main.js @@ -0,0 +1,18 @@ +(async function () { + setGameMetrics(1920, 1080, 2); + await sleep(1000); + keyPress("ESCAPE") + await sleep(1000); + click(50, 1030); + log.info("退出"); + await sleep(1000); + click(1000, 750); + log.info("确认"); + await sleep(20000); + click(1800, 1000); + log.info("切换账号"); + await sleep(1000); + click(1000, 550); + log.info("确认"); + await sleep(4000); +})(); \ No newline at end of file diff --git a/repo/js/Logout/manifest.json b/repo/js/Logout/manifest.json new file mode 100644 index 00000000..3ca1e23e --- /dev/null +++ b/repo/js/Logout/manifest.json @@ -0,0 +1,12 @@ +{ + "manifest_version": 1, + "name": "退出并重登", + "version": "1.0", + "description": "退出游戏并退出账号", + "authors": [ + { + "name": "愚溪", + } + ], + "main": "main.js" +} \ No newline at end of file