├── test.lua ├── 菲佣源码 ├── 通信 │ ├── client.bat │ ├── server.bat │ ├── lua5.1.dll │ ├── lua5.1.exe │ ├── readme.txt │ ├── mime │ │ └── core.dll │ ├── socket │ │ └── core.dll │ ├── client for phone.lua │ ├── client.lua │ ├── server.lua │ └── lua │ │ ├── mime.lua │ │ ├── socket │ │ └── tp.lua │ │ └── socket.lua ├── README.md ├── 文字识别插件 │ ├── TSProject.lua │ ├── readme.txt │ ├── 官方orc测试.lua │ ├── main.lua │ ├── 测试.lua │ ├── 字库制作工具.lua │ ├── FYorc.lua │ └── txwl.txt ├── 中控进阶模板 │ ├── Socket Server │ │ ├── Startserver.bat │ │ ├── lua5.1.dll │ │ ├── lua5.1.exe │ │ ├── mime │ │ │ └── core.dll │ │ ├── socket │ │ │ └── core.dll │ │ ├── excel │ │ │ ├── excel.lua │ │ │ ├── echo.lua │ │ │ ├── serialize.lua │ │ │ ├── parser.lua │ │ │ ├── filter.lua │ │ │ ├── slaxdom.lua │ │ │ └── string.lua │ │ ├── ConvertXML.lua │ │ └── lua │ │ │ ├── mime.lua │ │ │ ├── socket │ │ │ └── tp.lua │ │ │ └── socket.lua │ ├── Socket clientPC │ │ ├── Start Client.bat │ │ ├── lua5.1.dll │ │ ├── lua5.1.exe │ │ ├── mime │ │ │ └── core.dll │ │ ├── socket │ │ │ └── core.dll │ │ ├── lua │ │ │ ├── mime.lua │ │ │ ├── socket │ │ │ │ └── tp.lua │ │ │ └── socket.lua │ │ └── client.lua │ ├── readme.txt │ └── client for phone.lua ├── SAVE存档模块 │ ├── FYtemplet.lua │ ├── account.lua │ ├── test.lua │ └── save.lua ├── Switch替代语法示例.lua ├── 2-表的应用.lua ├── 2-表的基础.lua ├── 按小时运行指定功能的小案例.lua ├── 触动API(Python,lua,php)各种脚本语言的版本 │ ├── TSAPI_PHP版本(仅获取auth部分).php │ ├── TSAPI_lua苏泽库版.lua │ ├── TSAPI_lua版本.lua │ └── TSAPI_python版.py ├── 6-pushover.lua ├── 创建星期闹钟案例.lua └── 8-Mapping.lua ├── 日期与时间 ├── 获取今天是星期几.lua └── 获取当前日期及时间.lua ├── README.md ├── EVE 吉他市场自动刷新 ├── README.md └── main.lua ├── iOS 快捷跳转 ├── 如何查看 iOS scheme.lua └── 设置.lua ├── 一键卸载应用.lua ├── 手动卸载越狱插件.lua ├── 渐开线 ├── 方形渐开线.lua └── 圆形渐开线.lua ├── 随机字符串 ├── 自定义字符串随机.lua ├── 随机大小写字母.lua └── 产生随机种子.lua ├── 桃子的示例代码 ├── isColor - 苏大抓色对接 by 桃子.lua ├── 拖动.lua ├── 逐行读取文件内容.lua ├── 网络信息反馈源码.lua ├── 清空应用的Documents 和 Library 文件夹.lua └── 一些封装函数.lua ├── 天天三国志-扫荡 ├── game.txt └── TsLib.lua ├── 企业版 ├── 封装中控器读写函数.lua └── 注入中控器简单的发账号示例.lua ├── 滑块验证 ├── README.md └── FindSquare.lua ├── 卸载越狱插件.lua ├── 多点模糊比色.lua ├── 跳一跳 ├── README.md └── main.lua ├── 海盗来了 ├── main.lua ├── 1080p.lua └── 5c.lua ├── 创建星期闹钟案例.lua ├── 精准滑动.lua ├── 万能点击.lua ├── 自定义位置连点器免费版 └── main.lua ├── 万能喊话.lua ├── 天天三国志-刷开局 └── 6s.lua ├── 自定义位置连点器付费版 └── main.lua ├── 触摸UI转化触动.lua ├── 深海水族馆 ├── main.lua └── 720p.lua ├── 通用无限点击脚本.lua └── Android带分页table格式showui测试脚本.lua /test.lua: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /菲佣源码/通信/client.bat: -------------------------------------------------------------------------------- 1 | lua5.1.exe client.lua -------------------------------------------------------------------------------- /菲佣源码/通信/server.bat: -------------------------------------------------------------------------------- 1 | lua5.1.exe server.lua -------------------------------------------------------------------------------- /菲佣源码/README.md: -------------------------------------------------------------------------------- 1 | 配套视频见触动精灵官网教学视频页面,链接:https://www.touchsprite.com/video?type=higher&id=18 2 | -------------------------------------------------------------------------------- /日期与时间/获取今天是星期几.lua: -------------------------------------------------------------------------------- 1 | if today == 0 or today == 6 then --如果是周日或者周六 2 | dialog(today, 0) 3 | end 4 | -------------------------------------------------------------------------------- /菲佣源码/通信/lua5.1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/通信/lua5.1.dll -------------------------------------------------------------------------------- /菲佣源码/通信/lua5.1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/通信/lua5.1.exe -------------------------------------------------------------------------------- /菲佣源码/通信/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/通信/readme.txt -------------------------------------------------------------------------------- /菲佣源码/文字识别插件/TSProject.lua: -------------------------------------------------------------------------------- 1 | [res] 2 | txwl.txt 3 | [lib] 4 | [file] 5 | FYorc.lua 6 | main.lua 7 | -------------------------------------------------------------------------------- /菲佣源码/通信/mime/core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/通信/mime/core.dll -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/Startserver.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | chcp 65001 3 | lua5.1.exe server.lua 4 | pause -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/Start Client.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | chcp 65001 3 | lua5.1.exe client.lua 4 | pause -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/readme.txt -------------------------------------------------------------------------------- /菲佣源码/文字识别插件/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/文字识别插件/readme.txt -------------------------------------------------------------------------------- /菲佣源码/通信/socket/core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/通信/socket/core.dll -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/lua5.1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/Socket Server/lua5.1.dll -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/lua5.1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/Socket Server/lua5.1.exe -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/lua5.1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/Socket clientPC/lua5.1.dll -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/lua5.1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/Socket clientPC/lua5.1.exe -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/mime/core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/Socket Server/mime/core.dll -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/socket/core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/Socket Server/socket/core.dll -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/mime/core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/Socket clientPC/mime/core.dll -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/socket/core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chudongjingling/open_code/HEAD/菲佣源码/中控进阶模板/Socket clientPC/socket/core.dll -------------------------------------------------------------------------------- /菲佣源码/文字识别插件/官方orc测试.lua: -------------------------------------------------------------------------------- 1 | local t = os.clock() 2 | local recognize = ocrText(238, 149, 283, 176, 1); 3 | t = os.clock() - t 4 | dialog("识别出的字符:"..recognize.."\n耗时: "..t.." 秒", 0); -------------------------------------------------------------------------------- /菲佣源码/SAVE存档模块/FYtemplet.lua: -------------------------------------------------------------------------------- 1 | account = require("account") 2 | save = require("save") 3 | --base = require("base") 4 | --line = require("line") 5 | --timerun = require("timerun") 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # open_code 2 | 开源脚本,持续更新~触动 Lua 开发交流 QQ 群:187139891 3 | 脚本多来自于开发群作者分享,强烈推荐桃子和菲佣的源码,小白可能需要一些 Lua 语言基础才能看懂。 4 | 配套免费教学视频见触动精灵官网:https://www.touchsprite.com/video?type=intermediate 5 | -------------------------------------------------------------------------------- /EVE 吉他市场自动刷新/README.md: -------------------------------------------------------------------------------- 1 | eve-beiguoxia 2 | 3 | EVE 吉他市场自动刷新 - 背锅侠 4 | 5 | 这个脚本可以说是浮动窗口的科学使用方法之一 6 | 7 | ![效果图](https://github.com/chudongjingling/eve-beiguoxia/blob/master/TIM%E5%9B%BE%E7%89%8720200424125659.png) 8 | -------------------------------------------------------------------------------- /iOS 快捷跳转/如何查看 iOS scheme.lua: -------------------------------------------------------------------------------- 1 | 1. 找到 ipa 文件,重命名扩展名为 zip 2 | 2. 解压缩 3 | 3. 打开解压文件,在搜索框内输入Info.plist,找到Info.plist,如果搜索出来有多个Info.plist请选择文件较大的 4 | 4. 用编辑器打开Info.plist,按ctr+f,在查找框内输入CFBundleURLSchemes,红色框出来的就是我们要找的url参数,如果有多个,也一并记录即可 5 | -------------------------------------------------------------------------------- /一键卸载应用.lua: -------------------------------------------------------------------------------- 1 | require("TSLib") 2 | local list = getUserApp() 3 | for i=1,#list do 4 | toast("卸载第"..i.."个","共"..#list.."个",10) 5 | if not string.find("com.netease.onmyoji,com.idleif.abyssrium",list[i]) then 6 | ipaUninstall(list[i]) 7 | mSleep(50) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/excel/excel.lua: -------------------------------------------------------------------------------- 1 | require('excel.string') 2 | 3 | local excel = 4 | { 5 | read = require('excel.parser'), 6 | echo = require('excel.echo'), 7 | process = require('excel.filter'), 8 | save = require('excel.serialize'), 9 | } 10 | return excel 11 | -------------------------------------------------------------------------------- /手动卸载越狱插件.lua: -------------------------------------------------------------------------------- 1 | ::getInfo:: 2 | bid = dialogInput("从 Cydia 已安装中复制应用 ID 到下方", "com.weiphone.xx", "立即卸载") 3 | if bid ~= "" then 4 | mSleep(1000) 5 | toast("开始卸载……") 6 | os.execute("dpkg -P "..bid) 7 | mSleep(3000) 8 | toast("卸载完成~重启设备~…") 9 | mSleep(5000) 10 | os.execute("reboot") 11 | else 12 | dialog("请填写应用 ID!", 5); 13 | goto getInfo 14 | end 15 | -------------------------------------------------------------------------------- /菲佣源码/SAVE存档模块/account.lua: -------------------------------------------------------------------------------- 1 | local account = {} 2 | function account:update() 3 | self.count = self.count or 1 4 | if self.count > #self.data then self.count = 1 end 5 | self.cur_account = self.data[self.count] 6 | local r = { 7 | user = self.cur_account.user, 8 | server = self.cur_account.server 9 | } 10 | return r 11 | end 12 | return account 13 | -------------------------------------------------------------------------------- /渐开线/方形渐开线.lua: -------------------------------------------------------------------------------- 1 | init(1) 2 | mSleep(1000) 3 | 4 | local x = 1010 --起始坐标x 5 | local y = 698 --起始坐标y 6 | local v = 30 --两点间距离 7 | touchDown(x, y) 8 | mSleep(100) 9 | for var = 1,20 do 10 | j = 0 11 | k = v 12 | for _i = 1,2 do 13 | for i = 1,10 do 14 | x = x + j 15 | y = y + k 16 | touchMove(x, y) 17 | mSleep(20) 18 | end 19 | j = v 20 | k = 0 21 | end 22 | v = v * (-1.05) 23 | end 24 | touchUp(x, y) 25 | -------------------------------------------------------------------------------- /日期与时间/获取当前日期及时间.lua: -------------------------------------------------------------------------------- 1 | local nowTime = os.date("*t",os.time()) --返回一个 table 2 | dialog(nowTime.year, 0) --年 3 | dialog(nowTime.month, 0) --月 4 | dialog(nowTime.day, 0) --日 5 | dialog(nowTime.hour, 0) --小时 6 | dialog(nowTime.min, 0) --分钟 7 | dialog(nowTime.sec, 0) --秒钟 8 | dialog(nowTime.yday, 0) --显示当前为一年中的第几天 9 | 10 | --时间戳格式化当前时间 11 | local nowTime = os.date("%Y-%m-%d %H:%M:%S", os.time()) 12 | dialog(nowTime,0) 13 | -------------------------------------------------------------------------------- /随机字符串/自定义字符串随机.lua: -------------------------------------------------------------------------------- 1 | function randomStr(str, num) 2 | local ret ='' 3 | for i = 1, num do 4 | local rchr = math.random(1, string.len(str)) 5 | ret = ret .. string.sub(str, rchr, rchr) 6 | end 7 | return ret 8 | end 9 | 10 | --用法 11 | math.randomseed(tonumber(tostring(os.time()):reverse():sub(1,6))) --设置随机种子 12 | for var = 1,5 do 13 | s = randomStr("abcdefghijklmnopqrstuvwxyz", 6) --生成 6 位随机字母 14 | nLog(s) 15 | end 16 | -------------------------------------------------------------------------------- /菲佣源码/Switch替代语法示例.lua: -------------------------------------------------------------------------------- 1 | SelectModel = { 2 | ["iphone5"] = function () return 640,1136 end, 3 | ["iphone6"] = function () return 750,1334 end, 4 | ["iPadmini"] = function () return 768,1024 end, 5 | ["other"] = function (x,y) return x,y end, 6 | ["print"] = function (x,y) print(x,y) end, 7 | } 8 | function Switch(case,key,...) 9 | return case[key](...) 10 | end 11 | 12 | Switch(SelectModel,"print",1024,768) 13 | print(Switch(SelectModel,"iphone5")) 14 | -------------------------------------------------------------------------------- /随机字符串/随机大小写字母.lua: -------------------------------------------------------------------------------- 1 | function rndLetter(num) 2 | local ret = "" 3 | pcall(function() 4 | for var = 1,num do 5 | if math.random()>0.5 then 6 | ret = ret..string.char(math.random(65,90)) 7 | else 8 | ret = ret..string.char(math.random(97,122)) 9 | end 10 | end 11 | end) 12 | return ret 13 | end 14 | 15 | --用法 16 | math.randomseed(tonumber(tostring(os.time()):reverse():sub(1,6))) --设置随机种子 17 | for var = 1,5 do 18 | nLog(rndLetter(10)) --生成一个 10 位随机大小写字母的字符串 19 | end 20 | -------------------------------------------------------------------------------- /渐开线/圆形渐开线.lua: -------------------------------------------------------------------------------- 1 | init(1) 2 | mSleep(1000) 3 | 4 | local x0 = 1010 --起始坐标x 5 | local y0 = 698 --起始坐标y 6 | local rr = 20 --设置递增半径 7 | local l = 10 --设置点间距 8 | local p = 0 --初始化角度 9 | local r = 30 --设置首圈半径 10 | local rn = 10 --设置圈数 11 | touchDown(x0, y0) 12 | mSleep(100) 13 | for var = 1,rn do 14 | while p < math.pi * 2 do 15 | x = x0 + r * math.cos(p) 16 | y = y0 - r * math.sin(p) 17 | touchMove(x, y) 18 | mSleep(10) 19 | p = p + l/r 20 | end 21 | p = 0 22 | r = r + rr 23 | end 24 | touchUp(x0, y0) 25 | -------------------------------------------------------------------------------- /随机字符串/产生随机种子.lua: -------------------------------------------------------------------------------- 1 | --由于 lua 中的随机函数产生的随机数是伪随机,我们需要设置一个随机种子来解决此问题 2 | --改进方法 3 | math.randomseed(tostring(os.time()):reverse():sub(1, 6)) -- 随机种子 4 | dialog(math.random()) 5 | --进阶方法,需加载扩展库中的 socket 模块 6 | local ts = require("ts") 7 | local socket = require("szocket") -- 需要用到 luasocket 库 8 | local function get_seed() 9 | local t = string.format("%f", socket.gettime()) 10 | local st = string.sub(t, string.find(t, "%.") + 1, -1) 11 | return tonumber(string.reverse(st)) 12 | end 13 | math.randomseed(get_seed()) 14 | for var = 1,5 do 15 | nLog(math.random()) 16 | end 17 | -------------------------------------------------------------------------------- /桃子的示例代码/isColor - 苏大抓色对接 by 桃子.lua: -------------------------------------------------------------------------------- 1 | function isColor(x,y,a,b,c,d) 2 | local r,g,b = getColorRGB(x, y) 3 | local r1,g1,b1,wc = 0,0,0,0 --初始化定义 4 | if c = nil then 5 | r1,g1,b1 = math.modf(a/65536),math.modf(a/256)%256,a%256 6 | wc = b 7 | else 8 | r1,g1,b1 = a,b,c 9 | wc = d 10 | end 11 | if wc == nil then if r == r1 and g == g1 and b == b1 then return true else return false end end 12 | if (math.abs(r-r1)/255)*100 > wc and 13 | (math.abs(g-g1)/255)*100 > wc and 14 | (math.abs(b-b1)/255)*100 > wc then 15 | return true 16 | else 17 | return false 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /桃子的示例代码/拖动.lua: -------------------------------------------------------------------------------- 1 | touch = { 2 | --点击 3 | click = (function(x,y,startwait,stopwait) mSleep(startwait);touchDown(1,x,y);mSleep(20);touchUp(1,x,y);mSleep(stopwait) end), 4 | --拖动 5 | drag = (function(x1,y1,x2,y2,step,wait,stepwait) local step = step or 30;touchDown(1,x1,y1);repeat x1,y1 = ((math.abs(x2-x1) 0 then 14 | assert(sock:send(input .. "\n")) 15 | end 16 | 17 | recvt, sendt, status = socket.select({sock}, nil, 1) 18 | while #recvt > 0 do 19 | local response, receive_status = sock:receive() 20 | if receive_status ~= "closed" then 21 | if response then 22 | recvt, sendt, status = socket.select({sock}, nil, 1) 23 | end 24 | else 25 | break 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /卸载越狱插件.lua: -------------------------------------------------------------------------------- 1 | list = { 2 | "app.weiphone.net.85819.ios.otrlocation", 3 | "com.ts.rebirth", 4 | "app.weiphone.3k.debbgkiller",--3 K 助手 5 | "com.saurik.patcyh", 6 | "com.pk191", 7 | "com.pk192", 8 | "com.pk193", 9 | "com.tongbu.tuideb",--同步推 10 | "app.weiphone.watchdogpro", 11 | "app.weiphone.007gaiji.007gaiji",--007 改机 12 | "app.weiphone.tencent.xin",--威锋微信 13 | "libactivator", 14 | "watchdogpro.178", 15 | "com.ts.touchsprite",--触动旧版 16 | "com.tszuoniqiu.ios",--触动破解版 17 | "app.weiphone.hackyouriphone.backgroundmanager", 18 | "app.weiphone.killbackground7", 19 | "app.weiphone.als",--ALS 20 | "app.weiphone.als.air",--天空数据 21 | "app.weiphone.wukong.wxshaketweak",--悟空助手 22 | "app.weiphone.myrepospace.tzjl.txyapp",--天下游 23 | --"com.touchsprite.ios"--触动精灵 24 | } 25 | for i = 1,#list do 26 | os.execute("dpkg -P "..list[i]) 27 | mSleep(100) 28 | end 29 | os.execute("reboot") 30 | -------------------------------------------------------------------------------- /企业版/注入中控器简单的发账号示例.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 简单的发账号示例 3 | script/account.txt 内保存账号密码 4 | --]] 5 | 6 | local ok,account = telib:controller_injection( 7 | [[ 8 | local f = io.open("script/account.txt", "r") 9 | if f then 10 | local account_tab = {} 11 | local account = f:read() 12 | while account do 13 | table.insert(account_tab,account) 14 | account = f:read() 15 | end 16 | f:close() 17 | 18 | if #account_tab > 0 then 19 | local f = io.open("script/account.txt", "w") 20 | if f then 21 | for i = 2,#account_tab do 22 | f:write(account_tab[i].."\n") 23 | end 24 | f:close() 25 | end 26 | return account_tab[1] 27 | else 28 | return false 29 | end 30 | end 31 | return false 32 | ]] 33 | ) 34 | 35 | assert(ok,account) 36 | if account then 37 | nLog("获取账号:"..account) 38 | toast("获取账号:"..account) 39 | else 40 | nLog("获取账号失败") 41 | toast("获取账号失败") 42 | end 43 | mSleep(1000) 44 | ---------- 45 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/excel/echo.lua: -------------------------------------------------------------------------------- 1 | local function echo(t,n,saved) 2 | if type(t)~="table" then return end -- 3 | saved = saved or {} 4 | n = n or 0 5 | 6 | for k in pairs(t) do 7 | local str = '' 8 | if n~=0 then 9 | local fmt = '%' .. 4*n .. 's' 10 | str = string.format(fmt, '') 11 | end 12 | io.write(str,tostring(k), ' = ') 13 | if type(t[k])=='table' then 14 | local m = n 15 | m = m+1 16 | if saved[t[k]] then 17 | io.write(saved[t[k]], '\n') 18 | else 19 | saved[t[k]] = k 20 | io.write('{\n') 21 | echo(t[k], m, saved) 22 | io.write(str,'}\n') 23 | end 24 | else 25 | if type(t[k])=='string' then 26 | io.write('"',tostring(t[k]),'",\n') 27 | else 28 | io.write(tostring(t[k]),',\n') 29 | end 30 | end 31 | end 32 | end 33 | 34 | return function(str) echo(str) end 35 | -------------------------------------------------------------------------------- /菲佣源码/2-表的基础.lua: -------------------------------------------------------------------------------- 1 | test = {1,2,name = "zhangsan",3} 2 | test.age = 11 3 | test["action"]="say" 4 | age = "name" 5 | test1 = test 6 | --print (test[1],test[2],test[3],test[4]) 7 | -- print (test.name,test.age,test.action) 8 | -- print (test["name"],test["age"],test["action"]) 9 | --print (test[age],test["age"]) 10 | --print (test) 11 | -- print (test1.name) 12 | 13 | test["table1"] = {1,2,3} 14 | 15 | --print (test["table1"]) 16 | 17 | -- for i,v in ipairs(test) do 18 | -- print(i,v) 19 | -- end 20 | 21 | -- for k,v in pairs(test) do 22 | -- print(k,v) 23 | -- end 24 | 25 | -- for i=1,#test do 26 | -- print(i) 27 | -- end 28 | 29 | function name( ... ) 30 | local t 31 | t = test 32 | t[1] = 10 33 | end 34 | 35 | name() 36 | print(test[1]) 37 | print(t) 38 | 39 | function cl( test ) 40 | t = {} 41 | for k,v in pairs(test) do 42 | t[k] = test[k] 43 | return t 44 | end 45 | 46 | print(t[2]) 47 | -------------------------------------------------------------------------------- /菲佣源码/通信/client.lua: -------------------------------------------------------------------------------- 1 | -- client.lua 2 | local socket = require("socket") 3 | 4 | local host = "192.168.10.23" 5 | local port = 12345 6 | local sock = assert(socket.connect(host, port)) 7 | sock:settimeout(0) 8 | 9 | print("Press enter after input something:") 10 | 11 | local input, recvt, sendt, status 12 | while true do 13 | input = io.read() 14 | if #input > 0 then 15 | assert(sock:send(input .. "\n")) 16 | end 17 | 18 | recvt, sendt, status = socket.select({sock}, nil, 1) 19 | while #recvt > 0 do 20 | local response, receive_status = sock:receive() 21 | if receive_status ~= "closed" then 22 | if response then 23 | print(response) 24 | recvt, sendt, status = socket.select({sock}, nil, 1) 25 | end 26 | else 27 | break 28 | end 29 | end 30 | end -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/excel/serialize.lua: -------------------------------------------------------------------------------- 1 | function serialize(t) 2 | if type(t)~="table" then return tostring(t) end -- 3 | local function ser_table(tbl,level) 4 | level = level or 1 5 | local align = "\n" .. string.rep("\t", level-1) 6 | local indent = string.rep("\t", level) 7 | 8 | local tmp = {} 9 | for k,v in pairs(tbl) do 10 | local key = type(k)=="number" and "["..k.."]" or k 11 | if type(v)=="table" then 12 | table.insert(tmp, indent..key.." = "..ser_table(v, level + 1)) 13 | elseif type(v) ~= "boolean" then 14 | table.insert(tmp, indent..key.." = "..v) 15 | else 16 | table.insert(tmp, indent.."[\""..key.."\"]".." = "..tostring(v)) 17 | end 18 | end 19 | return align .. "{\n" .. table.concat(tmp,",\n") .. align .. "}" 20 | end 21 | 22 | return print("do\nlocal cfgs = " .. ser_table(t) .. "\nreturn cfgs\nend") 23 | end 24 | 25 | return serialize 26 | -------------------------------------------------------------------------------- /菲佣源码/按小时运行指定功能的小案例.lua: -------------------------------------------------------------------------------- 1 | --按小时定时运行任务的简单案例 2 | local dayrun = {} 3 | local day 4 | local timerun = {} 5 | --把时间段的工作都分装进时间运行的入口 6 | timerun[18] = function () 7 | print("以下为18点后做的事情") 8 | end 9 | timerun[21] = function () 10 | print("以下为19点后做的事情") 11 | end 12 | function timerun.other() 13 | --如果其他时间不做事情,可以一直mSleep 14 | --计算当前时间的分钟数,计算出到下个小时的时间 15 | local t = 60 - tonumber(os.date("%M",os.time())) 16 | mSleep(t * 60 * 1000 or 60000) 17 | end 18 | --进入循环判断 19 | while true do 20 | --以天为单位,初始化一下 21 | if day ~= os.date("%d",os.time()) then 22 | for i = 1,24 do 23 | if timerun[i] then 24 | dayrun[i] = timerun[i] 25 | else 26 | dayrun[i] = false 27 | end 28 | end 29 | day = os.date("%d",os.time()) 30 | end 31 | local timeH = tonumber(os.date("%H",os.time())) 32 | for i,v in ipairs(dayrun) do 33 | if v and timeH >= i then 34 | v() 35 | v = false 36 | end 37 | if i == 24 then timerun.other() end 38 | end 39 | end 40 | 41 | -------------------------------------------------------------------------------- /多点模糊比色.lua: -------------------------------------------------------------------------------- 1 | --在实际游戏脚本制作中,很多界面单靠 1 个点不容易进行准确的判断,这里封装一个配合 table 使用的多点模糊比色函数来实现精确判断: 2 | --参数 s 为模糊度,范围 0 - 100,一般使用 90 即可。 3 | --实例中的 table 格式可使用触动精灵抓色器生成。 4 | function multiColor(array,s) 5 | s = math.floor(0xff*(100-s)*0.01) 6 | keepScreen(true) 7 | for var = 1, #array do 8 | local lr,lg,lb = getColorRGB(array[var][1],array[var][2]) 9 | local r = math.floor(array[var][3]/0x10000) 10 | local g = math.floor(array[var][3]%0x10000/0x100) 11 | local b = math.floor(array[var][3]%0x100) 12 | if math.abs(lr-r) > s or math.abs(lg-g) > s or math.abs(lb-b) > s then 13 | keepScreen(false) 14 | return false 15 | end 16 | end 17 | keepScreen(false) 18 | return true 19 | end 20 | 21 | --用法 22 | g_t_Table = { 23 | { 1962, 52, 0xefdccf}, 24 | { 2150, 50, 0xefd8d0}, 25 | { 1964, 76, 0xe9d1c5}, 26 | { 2152, 74, 0xefdcd1}, 27 | { 2122, 62, 0xf1ddd1}, 28 | { 2146, 1080, 0x893824}, 29 | { 1840, 1082, 0x593724}, 30 | } 31 | if multiColor(g_t_Table,90) then 32 | touchDown(100,100) 33 | mSleep(50) 34 | touchUp(100,100) 35 | end 36 | -------------------------------------------------------------------------------- /菲佣源码/触动API(Python,lua,php)各种脚本语言的版本/TSAPI_PHP版本(仅获取auth部分).php: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /桃子的示例代码/网络信息反馈源码.lua: -------------------------------------------------------------------------------- 1 | State={ 2 | ["记录"] = true, 3 | ["IP"] = "192.168.1.88" 4 | } 5 | if State["记录"] then initLog(State["IP"],3); end 6 | function _AddLog(text) if State["记录"] then wLog(State["IP"], "{\"deviceid\":\"" .. getDeviceID() .. "\",\"data\":{".. tostring(text).."}}") end end 7 | function AddTextLog(...) local TmpJson = "" for _,arr in ipairs({...}) do TmpJson = TmpJson .. "\"" .. tostring(_) .. "\":\"" .. tostring(arr) .. "\"," end _AddLog(string.sub(TmpJson,1,-2)) end 8 | function AddTableLog(Arr) local TmpJson = "" for _,arr in pairs(Arr) do TmpJson = TmpJson .. "\"" .. tostring(_) .. "\":\"" .. tostring(arr) .. "\"," end _AddLog(string.sub(TmpJson,1,-2)) end 9 | 10 | --[[上方代码加入标头 就可以正常使用了 下方为测试代码 11 | _AddLog("\"1\":\"1\",\"属性\":\"无敌\",\"状态\":\"卍解\"") 12 | dialog("直接对接",0) 13 | 14 | AddTextLog("2",561,true,{""},function() end) 15 | dialog("批量文本",0) 16 | 17 | AddTableLog({["1"]="3",["名字"]=561,["ID"]=true,["PassWord"]={""},["备注"]=function() end}) 18 | dialog("table传输",0) 19 | --]] 20 | -------------------------------------------------------------------------------- /跳一跳/README.md: -------------------------------------------------------------------------------- 1 | # 微信跳一跳游戏辅助 2 | 3 | 本源码主要来自知乎 xtutu 的分享,在此感谢。 4 | 5 | 在之前源码的基础上,做了以下优化: 6 | 7 | 增加了配置界面,更方便普通玩家使用。 8 | 9 | 增加了对更多分辨率的支持,目前支持 720x1280,1080x1920,5/5C/5S,6/6s,6P/6sP 10 | 11 | 开发环境 12 | 13 | 电脑:Windows 或 Mac 14 | 15 | 软件:Lua 编辑器、抓色器(可以在官网 http://www.touchsprite.com/tools 下载) 16 | 17 | 手机:触动精灵(iOS 或者安卓都可以) 18 | 19 | 工作原理 20 | 21 | 抓色器远程连接手机截图,找到坐标点和颜色值,作业部落上有使用教程 https://www.touchsprite.com/docs/4955 。 22 | 23 | 通过 Lua 实现模拟点击 24 | 25 | 26 | 步骤: 27 | 28 | 安装抓色器(用来截图取点) 29 | 30 | 越狱手机添加源:apt.touchsprite.com,安装触动精灵 31 | 32 | 安卓手机 root 后访问官网 http://www.touchsprite.com 下载安卓版触动精灵 33 | 34 | 在手机上截取跳一跳界面,也可以用抓色器远程截图:打开触动更多界面的局域网广播开关,手机和电脑在同一局域网就可以 35 | 36 | 在抓色器上打开截图,鼠标放到小人的底部中心点,同时按下 CTRL 和鼠标,在周围也取两个点 37 | 38 | 生成代码,插入到 main.lua 的找色代码部分(可以用触动精灵的编辑器,远程调试比较方便) 39 | 40 | 编辑器设备标签页搜索连接设备(也要在同一个局域网),打开脚本点击远程运行(需要提前进入游戏界面) 41 | 42 | 源码讲解 43 | 44 | distanceTimeRate:数字越大表示蓄力时间越长 45 | 46 | targetPositionOffset:表示方块最上方的点,距离中心点的偏移 47 | 48 | 思路 49 | 50 | 确定自己的当前位置,直接查找像素就可以了(通过抓色器抓小人底部最宽位置的中心点和左右两边的点) 51 | 52 | 确定目标点位置:可以通过自己当前的位置判断一个大致的范围。 53 | 54 | 然后通过从左上,到右下角,依次遍历像素。找到方块最上方的像素点。 55 | 56 | 然后把y + 上一个大概的值来确定。 57 | 58 | 距离与时间转换:游戏的公式是线性的,直接乘以系数就可以了 59 | -------------------------------------------------------------------------------- /菲佣源码/6-pushover.lua: -------------------------------------------------------------------------------- 1 | function pushover( request ) 2 | local sz = require("sz") 3 | local json = sz.json 4 | local http = require("szocket.http") 5 | local pushover_url = "https://api.pushover.net/1/messages.json" 6 | 7 | local data_str = {} 8 | for k,v in pairs(request) do 9 | table.insert(data_str, tostring(k) .. "=" .. tostring(v)) 10 | end 11 | data_str = table.concat(data_str, "&") 12 | 13 | local res, code = http.request(pushover_url, data_str) 14 | local back = json.decode(res) 15 | if (code ~= 200) then 16 | local errstr = "发送请求错误。错误代码: " .. tostring(code) .. ", 错误信息: " .. tostring(res) 17 | return false, errstr 18 | elseif (back.status ~= 1) then 19 | local errstr = "信息推送错误: " .. tostring(res) 20 | return false, errstr 21 | end 22 | 23 | return true 24 | 25 | end 26 | 27 | local request = { token = "abNRhRebF4UM4kqvMwohoE3QEJRqRK", 28 | user = "uK1dVzvMEVxy59YkvcxdgtvUfyf6WC", 29 | device = "iphone6", 30 | title = "脚本运行错误", 31 | message = "请从新启动脚本" 32 | } 33 | 34 | local success, err = pushover( request ) 35 | 36 | if (success) then 37 | print("推送成功") 38 | else 39 | print("推送失败:\n" .. err) 40 | end 41 | -------------------------------------------------------------------------------- /桃子的示例代码/清空应用的Documents 和 Library 文件夹.lua: -------------------------------------------------------------------------------- 1 | function ClearBid(Bid) 2 | closeApp(Bid) 3 | clearKeyChain(Bid) 4 | function LastFolder(Path) return string.match(Path, "(.+)/") end 5 | mSleep(1000) 6 | if type(appDataPath) == "function" and appDataPath(Bid) ~= "" then 7 | if string.sub(getOSVer(), 1, 1) == "7" then 8 | mSleep(500) 9 | os.execute("rm -rf "..LastFolder(appDataPath(Bid)).."/Library/Caches/*") --Library 10 | os.execute("rm -rf "..LastFolder(appDataPath(Bid)).."/Documents/*") 11 | os.execute("rm -rf "..LastFolder(appDataPath(Bid)).."/Documents/.*") 12 | os.execute("rm -rf "..LastFolder(appDataPath(Bid)).."/Library/Preferences/" .. Bid .. ".plist") 13 | os.execute("rm -rf "..LastFolder(appDataPath(Bid)).."/Library/Cookies/*") 14 | mSleep(1000) 15 | return true 16 | elseif string.sub(getOSVer(), 1, 1) == "8" then 17 | mSleep(500) 18 | os.execute("rm -rf "..(appDataPath(Bid)).."/Library/Caches/*") --Library 19 | os.execute("rm -rf "..(appDataPath(Bid)).."/Documents/*") 20 | os.execute("rm -rf "..(appDataPath(Bid)).."/Documents/.*") 21 | os.execute("rm -rf "..(appDataPath(Bid)).."/Library/Preferences/" .. Bid .. ".plist") 22 | os.execute("rm -rf "..(appDataPath(Bid)).."/Library/dungeon/*") 23 | --.com.apple.mobile_container_manager.metadata.plist 24 | mSleep(1000) 25 | return true 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /菲佣源码/通信/server.lua: -------------------------------------------------------------------------------- 1 | -- server.lua 2 | local socket = require("socket") 3 | 4 | local host = "192.168.10.23" 5 | local port = "12345" 6 | local server = assert(socket.bind(host, port, 1024)) 7 | print (server) 8 | server:settimeout(0) 9 | local client_tab = {} 10 | local conn_count = 0 11 | 12 | print("Server Start " .. host .. ":" .. port) 13 | 14 | while 1 do 15 | local conn = server:accept() 16 | if conn then 17 | conn_count = conn_count + 1 18 | client_tab[conn_count] = conn 19 | print("A client successfully connect!") 20 | end 21 | 22 | for conn_count, client in pairs(client_tab) do 23 | local recvt, sendt, status = socket.select({client}, nil, 1) 24 | if #recvt > 0 then 25 | local receive, receive_status = client:receive() 26 | if receive_status ~= "closed" then 27 | if receive then 28 | assert(client:send("Client " .. conn_count .. " Send : ")) 29 | assert(client:send(receive .. "\n")) 30 | print("Receive Client " .. conn_count .. " : ", receive) 31 | end 32 | else 33 | table.remove(client_tab, conn_count) 34 | client:close() 35 | print("Client " .. conn_count .. " disconnect!") 36 | end 37 | end 38 | 39 | end 40 | end -------------------------------------------------------------------------------- /菲佣源码/SAVE存档模块/test.lua: -------------------------------------------------------------------------------- 1 | --存档模块应用案例,案例中生成的存档可在文本编辑器直接打开,为json格式 2 | --调用模板 3 | require("FYtemplet") 4 | --帐号数据格式,如果用其他方式获取帐号数据,请修改模板中account文件中account:update()方法,变成自己的获取方式 5 | --帐号数据和存档模块中,必要的数据是:user(即用户名),server(为可选数据,如果没有,一个帐号只有一组存档)这两个数据配合生成 6 | account.data = { 7 | {user = "roiffcycc",server = "3"}, 8 | {user = "cyccroiff",server = "2"} 9 | } 10 | --存档选项,存档文件以周为单位,每天12点后,数据自动更新到当天新的数据,存档文件后缀带有周信息,比如周一,存档文件为txwlsave1 11 | --save:option为可选,默认路径为"/User/Media/TouchSprite/lua/" ,默认文件名为defaultsave, 12 | --测试时,可在电脑上直接运行,如在当前文件夹生成,可以用""表示路径,在手机运行时,请写上完整路径 13 | save:option{ 14 | path = "" , --"/User/Media/TouchSprite/lua/" 15 | file = "txwlsave", 16 | } 17 | --存档初始化函数,请在脚本运行前执行一次,会自动创建新的存档,或者读取当天存档,重复运行是,可继续用之前的存档数据 18 | save:init() 19 | --帐号更新模块,需要获取一个帐号信息,以便生成存档 20 | account:update() 21 | 22 | ------------------以上是数据初始化------------- 23 | ------------------以下为使用案例--------------- 24 | 25 | --当游戏或者脚本中,遇到需要存储的数据时,先使用save:link()函数,链接存档,参数为数据名 26 | --以下模拟一个部分存档数据 27 | function test() 28 | local a = save:link("存档数据1") 29 | --可直接修改数据 30 | a["战斗次数"] = 1 31 | a["装备等级"] = "s" 32 | --也可用函数修改 33 | a:update("测试数据","测试") --此语句等同于 a["测试数据"] = "测试" 34 | --使用此update时,可以同时存档 35 | a:update("测试数据","测试",nil,"save") --更新数据后即立刻写入文件 36 | save:save() --存入文件 37 | end 38 | 39 | function test2() 40 | local a = save:link("存档数据1") 41 | local b = save:link("存档数据2") 42 | print (a["战斗次数"]) 43 | if a["战斗次数"] == 1 then 44 | b.xx = 2 45 | end 46 | end 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /海盗来了/main.lua: -------------------------------------------------------------------------------- 1 | init(0)--竖屏 2 | require("TSLib") 3 | w,h = getScreenSize() 4 | if w == 640 and h == 1136 then 5 | require "5c" 6 | elseif w == 768 and h == 1024 then 7 | --require "ipad" 8 | toast("暂不支持您的手机分辨率",1) 9 | elseif w == 1536 and h == 2048 then 10 | --require "ipadhd" 11 | toast("暂不支持您的手机分辨率",1) 12 | elseif w == 750 and h == 1334 then 13 | --require "6s" 14 | toast("暂不支持您的手机分辨率",1) 15 | elseif w == 1242 and h == 2208 then 16 | --require "6P" 17 | toast("暂不支持您的手机分辨率",1) 18 | elseif w == 720 and h == 1280 then 19 | --require "720p" 20 | toast("暂不支持您的手机分辨率",1) 21 | elseif w == 1080 and h == 1920 then 22 | require "1080p" 23 | else 24 | setScreenScale(true, 720, 1280) 25 | --require "720p" 26 | toast("暂不支持",1) 27 | setScreenScale(false) 28 | end 29 | 30 | UINew("丸子海盗来了自动挂机辅助","运行脚本","立即退出","piratego.dat",0,10) 31 | UILabel("辅助功能",20,"center","230,50,92") 32 | UICheck("check1,check2,check3","自动转盘,每日登陆,自动升级建筑","0@1") 33 | UILabel("转盘能量设置",20,"center","230,50,92") 34 | UICombo("gem","剩余2/3,剩一半,全用完","0") 35 | UILabel("猜土豪设置",20,"left","230,50,92") 36 | UICombo("gold","选1号,选2号,选3号","0") 37 | UILabel("有问题请加群: 123456",18,"left","230,50,92") 38 | UIShow() 39 | 40 | while (true) do 41 | flag = deviceIsLock()--防锁屏 42 | if flag ~= 0 then 43 | unlockDevice() 44 | end 45 | daily() 46 | if check1 == "自动转盘" then 47 | go() 48 | end 49 | if check2 == "每日登陆" then 50 | reward() 51 | end 52 | if check3 == "自动升级建筑" then 53 | building() 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /创建星期闹钟案例.lua: -------------------------------------------------------------------------------- 1 | Week={ 2 | {date="monday",chinese="星期一"}, 3 | {date="tuesday",chinese="星期二"}, 4 | {date="wednesday",chinese="星期三"}, 5 | {date="thursday",chinese="星期四"}, 6 | {date="firday",chinese="星期五"}, 7 | {date="saturday",chinese="星期六"}, 8 | {date="sunday",chinese="星期天"}, 9 | } 10 | --克隆表格 11 | function Clone(tab) 12 | if type(tab) == table then 13 | local r = {} 14 | for k,v in pairs(tab) do 15 | if type(v) == table then 16 | Clone(v) 17 | else 18 | r[k] = v 19 | end 20 | end 21 | return r 22 | else 23 | return tab 24 | end 25 | end 26 | --创建星期数据 27 | function Week.Creat(self,...) 28 | local x = {...} 29 | local r = {} 30 | for k,v in pairs(self) do 31 | if type(v) == "function" then 32 | r[k] = v 33 | end 34 | end 35 | if not ... then return end 36 | for i,v in pairs(x) do 37 | r[v] = Clone(self[v]) 38 | end 39 | return r 40 | end 41 | --选择星期几数据,然后输出 42 | function Week.Check(self,weeknum) 43 | return self[weeknum] 44 | end 45 | --删除星期几,可多个 46 | function Week.Remove(self,...) 47 | if not ... then return end 48 | weeknum = {...} 49 | for i,v in ipairs(weeknum) do 50 | self[v] = nil 51 | end 52 | end 53 | --增加,可多个 54 | function Week.Add(self,...) 55 | if not ... then return end 56 | weeknum = {...} 57 | for i,v in ipairs(weeknum) do 58 | self[v] = Clone(Week[v]) 59 | end 60 | end 61 | function Week.print(self) 62 | for k,v in pairs(self) do 63 | if type(k) == "number" then 64 | print(v.date.." 中文:"..v.chinese) 65 | end 66 | end 67 | print("\n") 68 | end 69 | new = Week:Creat(1,5,6) 70 | new:print() 71 | new:Add(4,5) 72 | new:print() 73 | new:Remove(1) 74 | new:print() 75 | -------------------------------------------------------------------------------- /菲佣源码/创建星期闹钟案例.lua: -------------------------------------------------------------------------------- 1 | Week={ 2 | {date="monday",chinese="星期一"}, 3 | {date="tuesday",chinese="星期二"}, 4 | {date="wednesday",chinese="星期三"}, 5 | {date="thursday",chinese="星期四"}, 6 | {date="firday",chinese="星期五"}, 7 | {date="saturday",chinese="星期六"}, 8 | {date="sunday",chinese="星期天"}, 9 | } 10 | --克隆表格 11 | function Clone(tab) 12 | if type(tab) == table then 13 | local r = {} 14 | for k,v in pairs(tab) do 15 | if type(v) == table then 16 | Clone(v) 17 | else 18 | r[k] = v 19 | end 20 | end 21 | return r 22 | else 23 | return tab 24 | end 25 | end 26 | --创建星期数据 27 | function Week.Creat(self,...) 28 | local x = {...} 29 | local r = {} 30 | for k,v in pairs(self) do 31 | if type(v) == "function" then 32 | r[k] = v 33 | end 34 | end 35 | if not ... then return end 36 | for i,v in pairs(x) do 37 | r[v] = Clone(self[v]) 38 | end 39 | return r 40 | end 41 | --选择星期几数据,然后输出 42 | function Week.Check(self,weeknum) 43 | return self[weeknum] 44 | end 45 | --删除星期几,可多个 46 | function Week.Remove(self,...) 47 | if not ... then return end 48 | weeknum = {...} 49 | for i,v in ipairs(weeknum) do 50 | self[v] = nil 51 | end 52 | end 53 | --增加,可多个 54 | function Week.Add(self,...) 55 | if not ... then return end 56 | weeknum = {...} 57 | for i,v in ipairs(weeknum) do 58 | self[v] = Clone(Week[v]) 59 | end 60 | end 61 | function Week.print(self) 62 | for k,v in pairs(self) do 63 | if type(k) == "number" then 64 | print(v.date.." 中文:"..v.chinese) 65 | end 66 | end 67 | print("\n") 68 | end 69 | new = Week:Creat(1,5,6) 70 | new:print() 71 | new:Add(4,5) 72 | new:print() 73 | new:Remove(1) 74 | new:print() 75 | 76 | 77 | -------------------------------------------------------------------------------- /精准滑动.lua: -------------------------------------------------------------------------------- 1 | --该函数来自于 QQ 群 592860666,由开发者“一个人自嘲”分享 2 | Direction = {left=0,right=1,up=2,down=3} 3 | 4 | function slide(x1,y1,dist,dir,ms,step) 5 | ms = ms or 100 6 | step = step or 30 7 | local x2,y2 8 | if dir == Direction.up then 9 | moveTo(x1,y1, x1, y1-dist,{["step"] = step,["ms"] = 50,["index"] = 1,["stop"] = false}) 10 | mSleep(ms) 11 | moveTo(x1, y1-dist, x1, y1-dist+1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false}) 12 | mSleep(ms) 13 | moveTo(x1, y1-dist+1, x1, y1-dist+2,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false}) 14 | elseif dir == Direction.down then 15 | moveTo(x1,y1, x1, y1+dist,{["step"] = step,["ms"] = 50,["index"] = 1,["stop"] = false}) 16 | mSleep(ms) 17 | moveTo(x1, y1+dist, x1, y1+dist-1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false}) 18 | mSleep(ms) 19 | moveTo(x1, y1+dist-1, x1, y1+dist-2,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false}) 20 | elseif dir == Direction.left then 21 | moveTo(x1,y1, x1-dist, y1,{["step"] = step,["ms"] = 50,["index"] = 1,["stop"] = false}) 22 | mSleep(ms) 23 | moveTo(x1, y1, x1-dist+1, y1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false}) 24 | mSleep(ms) 25 | moveTo( x1-dist+1, y1, x1-dist+2, y1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false}) 26 | elseif dir == Direction.right then 27 | moveTo(x1,y1, x1+dist, y1,{["step"] = step,["ms"] = 50,["index"] = 1,["stop"] = false}) 28 | mSleep(ms) 29 | moveTo(x1, y1, x1+dist-1, y1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false}) 30 | mSleep(ms) 31 | moveTo( x1+dist-1, y1, x1+dist-2, y1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false}) 32 | else 33 | nLog('滑动方向错误,必须为上下左右中的一个') 34 | end 35 | mSleep(500) 36 | end 37 | -------------------------------------------------------------------------------- /万能点击.lua: -------------------------------------------------------------------------------- 1 | local sz = require("sz") 2 | 3 | function click(...) 4 | touchDown(...) 5 | mSleep(30) 6 | touchUp(...) 7 | end 8 | 9 | function setDirection() 10 | local s = dialogRet("请选择您的屏幕方向", "Home键在左手边", "Home键在左手边", "Home在下方", 0); 11 | if s == 0 then 12 | init(0) 13 | elseif s == 1 then 14 | init(2) 15 | else 16 | init(1) 17 | end 18 | end 19 | 20 | function setPointNum() 21 | while true do 22 | local text_a,text_b = dialogInput("输入您要录制的点的个数与脚本运行时间(分钟)", "输入点的数量(最小为1)#脚本运行时间", "确认"); 23 | if text_a ~= nil and text_b ~= nil then 24 | if type(tonumber(text_a) == "number") and type(tonumber(text_b) == "number") then 25 | -- myColor = {} 26 | -- for var = 1,text_a do 27 | -- myColor[var] = {} 28 | -- end 29 | return text_a,text_b 30 | else 31 | dialog("脚本设置错误,请重新输入") 32 | end 33 | else 34 | dialog("脚本设置错误,请重新输入") 35 | end 36 | end 37 | end 38 | 39 | function main() 40 | local loop = 0 41 | local lastTime = os.time() 42 | local point,totalTime = setPointNum() 43 | while true do 44 | if loop == 0 then 45 | dialog("点击确定后请点击您要点击的坐标点") 46 | ret = catchTouchPoint(point); 47 | toast("成功获取坐标点~") 48 | loop = 1 49 | elseif loop == 1 then 50 | delay = dialogInput("请输入延迟时间(毫秒,数值越小越快)", "请输入大于30的数字", "确认"); 51 | if delay ~= nil and type(tonumber(delay) == "number") then 52 | toast("设置结束,2秒之后开始运行脚本") 53 | loop = 2 54 | else 55 | dialog("您输入的信息不正确,请重新输入") 56 | end 57 | elseif loop == 2 then 58 | if os.difftime(os.time(),lastTime) < tonumber(totalTime * 60) then 59 | for var = 1,#ret do 60 | click(ret[var].x,ret[var].y) 61 | mSleep(delay) 62 | end 63 | else 64 | toast("脚本运行结束,谢谢使用哟") 65 | lua_exit() 66 | end 67 | end 68 | end 69 | end 70 | 71 | setDirection() 72 | main() 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /桃子的示例代码/一些封装函数.lua: -------------------------------------------------------------------------------- 1 | file = { 2 | --判断文件是否存在 3 | exist = (function(file) local sFlie,Err = io.open(file,"r+");if Err~=nil then return false end sFlie:close();return true end), 4 | --读取文件内容 5 | read = (function(file) local sFlie,Err = io.open(file,"r");if Err~=nil then return nil end local _tmp = sFlie:read("*all");sFlie:close();return _tmp end), 6 | --读取文件内容并转化成 table 7 | totable = (function(file) local _tmp = {};local sFlie,Err = io.open(file,"r");if Err~=nil then return {} end;for _line in sFlie:lines() do table.insert(_tmp, string.match(_line,"%C+")) end;sFlie:close();return _tmp; end), 8 | --保存文件内容 9 | save = (function(file,data,append) local sFlie,Err = io.open(file,(append and "a") or "w");sFlie:write(data..((append and "\r\n") or ""));sFlie:close() end), 10 | --删除 11 | delete = (function(file) os.remove(file) end) 12 | } 13 | touch = { 14 | --点击 15 | click = (function(x,y,startwait,stopwait) mSleep(startwait);touchDown(1,x,y);mSleep(20);touchUp(1,x,y);mSleep(stopwait) end), 16 | --拖动 17 | drag = (function(x1,y1,x2,y2,step,wait,stepwait) local step = step or 30;touchDown(1,x1,y1);repeat x1,y1 = ((math.abs(x2-x1)=header) 23 | 24 | --构建index和table索引 25 | local indexs = {} 26 | local tables = {} 27 | for col,v in ipairs(Sheet.Data[header]) do 28 | tables[col] = rule.table[v] 29 | end 30 | for _,name in ipairs(rule.index) do 31 | for col,v in ipairs(Sheet.Data[header]) do 32 | if v==name then 33 | table.insert(indexs, col) 34 | break 35 | end 36 | end 37 | end 38 | 39 | assert(#indexs>0) 40 | 41 | local function AppendToResult(row_data, key, value) 42 | local temp = result 43 | for _,index in ipairs(indexs) do 44 | local sid = row_data[index] 45 | if not temp[sid] then temp[sid] = {} end 46 | temp = temp[sid] 47 | end 48 | 49 | temp[key] = value 50 | end 51 | 52 | for row=header+1,#Sheet.Data do 53 | for col,value in ipairs(Sheet.Data[row]) do 54 | if tables[col] then 55 | local ret = nil 56 | local key = tables[col] 57 | if rule.filter then 58 | ret = rule.filter(key, value) 59 | if ret then 60 | AppendToResult(Sheet.Data[row], key, ret) 61 | end 62 | end 63 | 64 | if not ret then 65 | if tonumber(value) then 66 | AppendToResult(Sheet.Data[row], key, value) 67 | elseif value:find(",") then 68 | AppendToResult(Sheet.Data[row], key, '{'..value..'}') 69 | else 70 | AppendToResult(Sheet.Data[row], key, '"'..value..'"') 71 | end 72 | end 73 | end 74 | end 75 | end 76 | end 77 | 78 | return result 79 | end 80 | 81 | return DocConvert 82 | -------------------------------------------------------------------------------- /菲佣源码/SAVE存档模块/save.lua: -------------------------------------------------------------------------------- 1 | local sz = require("sz") 2 | local json = sz.json 3 | local save = {} 4 | function save:save() 5 | local savetab = json.encode(self.data) 6 | local file = io.open(self.path..self.file..os.date("%w",os.time()),"w") 7 | if file then 8 | file:write(savetab.."\n") 9 | file:close(); 10 | return true 11 | end 12 | return false 13 | end 14 | function save:load() 15 | local file = io.open(self.path..self.file..os.date("%w",os.time()),"r") 16 | if file then 17 | local r = file:read("*a") 18 | file:close(); 19 | return json.decode(r) 20 | end 21 | return false 22 | end 23 | function save:init() 24 | self.path = self.path or "/User/Media/TouchSprite/lua/" 25 | self.file = self.file or "defaultsave" 26 | self.data = self:load() or {} 27 | if self.data.day ~= os.date("%m%d",os.time()) then 28 | self.data = {} 29 | self.data.day = os.date("%m%d",os.time()) 30 | end 31 | end 32 | function save:link(name) 33 | local user = account.cur_account.user 34 | local server = account.cur_account.server or "1" 35 | if not self.data[user] then self.data[user] = {} end 36 | if not self.data[user][server] then self.data[user][server] = {} end 37 | if not self.data[user][server][name] then self.data[user][server][name] = {} end 38 | local r = self.data[user][server][name] 39 | setmetatable(r,{__index = self.fun}) 40 | return r 41 | end 42 | function save:option (t) 43 | if t.path then self.path = t.path end 44 | if t.file then self.file = t.file end 45 | end 46 | save.fun = {} 47 | function save.fun:update(k,v,mode,write) 48 | if save.data.day ~= os.date("%m%d",os.time()) then 49 | save.data = {} 50 | save.data.day = os.date("%m%d",os.time()) 51 | local user = account.cur_account.user 52 | local server = account.cur_account.server 53 | save.data[user] = {} 54 | save.data[user][server] = {} 55 | for k,v in pairs(self) do 56 | v = 0 57 | end 58 | save.data[user][server][name] = self 59 | end 60 | if mode == "add" then 61 | self[k] = (self[k] or 0) + v 62 | else 63 | self[k] = v 64 | end 65 | if write then 66 | save:save() 67 | end 68 | return true 69 | end 70 | return save 71 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/excel/slaxdom.lua: -------------------------------------------------------------------------------- 1 | -- Optional parser that creates a flat DOM from parsing 2 | local SLAXML = require('excel.slaxml') 3 | function SLAXML:dom(xml,opts) 4 | if not opts then opts={} end 5 | local rich = not opts.simple 6 | local push, pop = table.insert, table.remove 7 | local stack = {} 8 | local doc = { type="document", name="#doc", kids={} } 9 | local current = doc 10 | local builder = SLAXML:parser{ 11 | startElement = function(name,nsURI) 12 | local el = { type="element", name=name, kids={}, el=rich and {} or nil, attr={}, nsURI=nsURI, parent=rich and current or nil } 13 | if current==doc then 14 | if doc.root then error(("Encountered element '%s' when the document already has a root '%s' element"):format(name,doc.root.name)) end 15 | doc.root = el 16 | end 17 | push(current.kids,el) 18 | if current.el then push(current.el,el) end 19 | current = el 20 | push(stack,el) 21 | end, 22 | attribute = function(name,value,nsURI) 23 | if not current or current.type~="element" then error(("Encountered an attribute %s=%s but I wasn't inside an element"):format(name,value)) end 24 | local attr = {type='attribute',name=name,nsURI=nsURI,value=value,parent=rich and current or nil} 25 | if rich then current.attr[name] = value end 26 | push(current.attr,attr) 27 | end, 28 | closeElement = function(name) 29 | if current.name~=name or current.type~="element" then error(("Received a close element notification for '%s' but was inside a '%s' %s"):format(name,current.name,current.type)) end 30 | pop(stack) 31 | current = stack[#stack] 32 | end, 33 | text = function(value) 34 | if current.type~='document' then 35 | if current.type~="element" then error(("Received a text notification '%s' but was inside a %s"):format(value,current.type)) end 36 | push(current.kids,{type='text',name='#text',value=value,parent=rich and current or nil}) 37 | end 38 | end, 39 | comment = function(value) 40 | push(current.kids,{type='comment',name='#comment',value=value,parent=rich and current or nil}) 41 | end, 42 | pi = function(name,value) 43 | push(current.kids,{type='pi',name=name,value=value,parent=rich and current or nil}) 44 | end 45 | } 46 | builder:parse(xml,opts) 47 | return doc 48 | end 49 | return SLAXML -------------------------------------------------------------------------------- /菲佣源码/文字识别插件/字库制作工具.lua: -------------------------------------------------------------------------------- 1 | 2 | local sz = require ("sz") 3 | local json = sz.json 4 | local rule = { 5 | area = {243, 485, 265, 505}, 6 | colourcast = "1C130D-170F0C", 7 | --area = { 262, 682, 305, 704}, 8 | --colourcast = "36393F-A9A39B", 9 | fuzzy = 95, 10 | char = "十", 11 | savefile = "txwl.txt" 12 | } 13 | function rule:init() 14 | self.colourcast = self.colourcast:split("-") 15 | self.colourcast[1] = tonumber("0x"..self.colourcast[1]) 16 | self.colourcast[2] = tonumber("0x"..self.colourcast[2]) 17 | if self.colourcast[1] < self.colourcast[2] then 18 | self.colourcast[1],self.colourcast[2] = self.colourcast[2],self.colourcast[1] 19 | end 20 | end 21 | function rule:test() 22 | local c1,c2,s = self.colourcast[1],self.colourcast[2],self.fuzzy 23 | local r = {} 24 | r[1] = {self.char,self.colourcast,self.fuzzy} 25 | local n = 2 26 | local p = {} 27 | local f = false 28 | local save 29 | local function isColor(x,y,c1,c2,s) 30 | local fl,abs = math.floor,math.abs 31 | s = fl(0xff*(100-s)*0.01) 32 | local r1,g1,b1 = fl(c1/0x10000),fl(c1%0x10000/0x100),fl(c1%0x100) 33 | local r2,g2,b2 = fl(c2/0x10000),fl(c2%0x10000/0x100),fl(c2%0x100) 34 | local rr,gg,bb = getColorRGB(x,y) 35 | if abs(r1-rr)<(s+r2) and abs(g1-gg)<(s+g2) and abs(b1-bb)<(s+b2) then 36 | return true 37 | end 38 | end 39 | keepScreen(true) 40 | for x = self.area[1],self.area[3] do 41 | local yl = 1 42 | for y = self.area[2],self.area[4] do 43 | if isColor(x,y,c1,c2,s) then 44 | if not f then 45 | f = {x,y} 46 | else 47 | r[n] = {x-f[1],y-f[2]} 48 | n = n + 1 49 | end 50 | p[yl] = (p[yl] or "").."██" 51 | else 52 | p[yl] = (p[yl] or "").." " 53 | end 54 | yl = yl + 1 55 | end 56 | end 57 | for i = 1,#p-1 do 58 | nLog(table.concat(p,"\n",i,i+1)) 59 | end 60 | nLog("\n") 61 | keepScreen(false) 62 | 63 | local choice = dialogRet("是否录入文字:\""..r[1][1].."\" 到字库?", "是", "否","自定义", 0) 64 | if choice == 2 then 65 | local text = dialogInput("请输入识别的字符", r[1][1] , "确认") 66 | r[1][1] = text 67 | choice =0 68 | end 69 | if choice == 0 then 70 | local s = json.encode(r) 71 | local file = io.open("/User/Media/TouchSprite/lua/"..self.savefile,"a") 72 | if file then 73 | file:write(s.."\n") 74 | file:close() 75 | nLog("已录入文字:\""..r[1][1].."\" 到字库文件:"..self.savefile) 76 | dialog("已录入文字:\""..r[1][1].."\" 到字库文件:"..self.savefile,0) 77 | end 78 | end 79 | end 80 | rule:init() 81 | rule:test() 82 | -------------------------------------------------------------------------------- /菲佣源码/通信/lua/mime.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- MIME support for the Lua language. 3 | -- Author: Diego Nehab 4 | -- Conforming to RFCs 2045-2049 5 | -- RCS ID: $Id: mime.lua,v 1.29 2007/06/11 23:44:54 diego Exp $ 6 | ----------------------------------------------------------------------------- 7 | 8 | ----------------------------------------------------------------------------- 9 | -- Declare module and import dependencies 10 | ----------------------------------------------------------------------------- 11 | local base = _G 12 | local ltn12 = require("ltn12") 13 | local mime = require("mime.core") 14 | local io = require("io") 15 | local string = require("string") 16 | module("mime") 17 | 18 | -- encode, decode and wrap algorithm tables 19 | encodet = {} 20 | decodet = {} 21 | wrapt = {} 22 | 23 | -- creates a function that chooses a filter by name from a given table 24 | local function choose(table) 25 | return function(name, opt1, opt2) 26 | if base.type(name) ~= "string" then 27 | name, opt1, opt2 = "default", name, opt1 28 | end 29 | local f = table[name or "nil"] 30 | if not f then 31 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) 32 | else return f(opt1, opt2) end 33 | end 34 | end 35 | 36 | -- define the encoding filters 37 | encodet['base64'] = function() 38 | return ltn12.filter.cycle(b64, "") 39 | end 40 | 41 | encodet['quoted-printable'] = function(mode) 42 | return ltn12.filter.cycle(qp, "", 43 | (mode == "binary") and "=0D=0A" or "\r\n") 44 | end 45 | 46 | -- define the decoding filters 47 | decodet['base64'] = function() 48 | return ltn12.filter.cycle(unb64, "") 49 | end 50 | 51 | decodet['quoted-printable'] = function() 52 | return ltn12.filter.cycle(unqp, "") 53 | end 54 | 55 | local function format(chunk) 56 | if chunk then 57 | if chunk == "" then return "''" 58 | else return string.len(chunk) end 59 | else return "nil" end 60 | end 61 | 62 | -- define the line-wrap filters 63 | wrapt['text'] = function(length) 64 | length = length or 76 65 | return ltn12.filter.cycle(wrp, length, length) 66 | end 67 | wrapt['base64'] = wrapt['text'] 68 | wrapt['default'] = wrapt['text'] 69 | 70 | wrapt['quoted-printable'] = function() 71 | return ltn12.filter.cycle(qpwrp, 76, 76) 72 | end 73 | 74 | -- function that choose the encoding, decoding or wrap algorithm 75 | encode = choose(encodet) 76 | decode = choose(decodet) 77 | wrap = choose(wrapt) 78 | 79 | -- define the end-of-line normalization filter 80 | function normalize(marker) 81 | return ltn12.filter.cycle(eol, 0, marker) 82 | end 83 | 84 | -- high level stuffing filter 85 | function stuff() 86 | return ltn12.filter.cycle(dot, 2) 87 | end 88 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/lua/mime.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- MIME support for the Lua language. 3 | -- Author: Diego Nehab 4 | -- Conforming to RFCs 2045-2049 5 | -- RCS ID: $Id: mime.lua,v 1.29 2007/06/11 23:44:54 diego Exp $ 6 | ----------------------------------------------------------------------------- 7 | 8 | ----------------------------------------------------------------------------- 9 | -- Declare module and import dependencies 10 | ----------------------------------------------------------------------------- 11 | local base = _G 12 | local ltn12 = require("ltn12") 13 | local mime = require("mime.core") 14 | local io = require("io") 15 | local string = require("string") 16 | module("mime") 17 | 18 | -- encode, decode and wrap algorithm tables 19 | encodet = {} 20 | decodet = {} 21 | wrapt = {} 22 | 23 | -- creates a function that chooses a filter by name from a given table 24 | local function choose(table) 25 | return function(name, opt1, opt2) 26 | if base.type(name) ~= "string" then 27 | name, opt1, opt2 = "default", name, opt1 28 | end 29 | local f = table[name or "nil"] 30 | if not f then 31 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) 32 | else return f(opt1, opt2) end 33 | end 34 | end 35 | 36 | -- define the encoding filters 37 | encodet['base64'] = function() 38 | return ltn12.filter.cycle(b64, "") 39 | end 40 | 41 | encodet['quoted-printable'] = function(mode) 42 | return ltn12.filter.cycle(qp, "", 43 | (mode == "binary") and "=0D=0A" or "\r\n") 44 | end 45 | 46 | -- define the decoding filters 47 | decodet['base64'] = function() 48 | return ltn12.filter.cycle(unb64, "") 49 | end 50 | 51 | decodet['quoted-printable'] = function() 52 | return ltn12.filter.cycle(unqp, "") 53 | end 54 | 55 | local function format(chunk) 56 | if chunk then 57 | if chunk == "" then return "''" 58 | else return string.len(chunk) end 59 | else return "nil" end 60 | end 61 | 62 | -- define the line-wrap filters 63 | wrapt['text'] = function(length) 64 | length = length or 76 65 | return ltn12.filter.cycle(wrp, length, length) 66 | end 67 | wrapt['base64'] = wrapt['text'] 68 | wrapt['default'] = wrapt['text'] 69 | 70 | wrapt['quoted-printable'] = function() 71 | return ltn12.filter.cycle(qpwrp, 76, 76) 72 | end 73 | 74 | -- function that choose the encoding, decoding or wrap algorithm 75 | encode = choose(encodet) 76 | decode = choose(decodet) 77 | wrap = choose(wrapt) 78 | 79 | -- define the end-of-line normalization filter 80 | function normalize(marker) 81 | return ltn12.filter.cycle(eol, 0, marker) 82 | end 83 | 84 | -- high level stuffing filter 85 | function stuff() 86 | return ltn12.filter.cycle(dot, 2) 87 | end 88 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/lua/mime.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- MIME support for the Lua language. 3 | -- Author: Diego Nehab 4 | -- Conforming to RFCs 2045-2049 5 | -- RCS ID: $Id: mime.lua,v 1.29 2007/06/11 23:44:54 diego Exp $ 6 | ----------------------------------------------------------------------------- 7 | 8 | ----------------------------------------------------------------------------- 9 | -- Declare module and import dependencies 10 | ----------------------------------------------------------------------------- 11 | local base = _G 12 | local ltn12 = require("ltn12") 13 | local mime = require("mime.core") 14 | local io = require("io") 15 | local string = require("string") 16 | module("mime") 17 | 18 | -- encode, decode and wrap algorithm tables 19 | encodet = {} 20 | decodet = {} 21 | wrapt = {} 22 | 23 | -- creates a function that chooses a filter by name from a given table 24 | local function choose(table) 25 | return function(name, opt1, opt2) 26 | if base.type(name) ~= "string" then 27 | name, opt1, opt2 = "default", name, opt1 28 | end 29 | local f = table[name or "nil"] 30 | if not f then 31 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) 32 | else return f(opt1, opt2) end 33 | end 34 | end 35 | 36 | -- define the encoding filters 37 | encodet['base64'] = function() 38 | return ltn12.filter.cycle(b64, "") 39 | end 40 | 41 | encodet['quoted-printable'] = function(mode) 42 | return ltn12.filter.cycle(qp, "", 43 | (mode == "binary") and "=0D=0A" or "\r\n") 44 | end 45 | 46 | -- define the decoding filters 47 | decodet['base64'] = function() 48 | return ltn12.filter.cycle(unb64, "") 49 | end 50 | 51 | decodet['quoted-printable'] = function() 52 | return ltn12.filter.cycle(unqp, "") 53 | end 54 | 55 | local function format(chunk) 56 | if chunk then 57 | if chunk == "" then return "''" 58 | else return string.len(chunk) end 59 | else return "nil" end 60 | end 61 | 62 | -- define the line-wrap filters 63 | wrapt['text'] = function(length) 64 | length = length or 76 65 | return ltn12.filter.cycle(wrp, length, length) 66 | end 67 | wrapt['base64'] = wrapt['text'] 68 | wrapt['default'] = wrapt['text'] 69 | 70 | wrapt['quoted-printable'] = function() 71 | return ltn12.filter.cycle(qpwrp, 76, 76) 72 | end 73 | 74 | -- function that choose the encoding, decoding or wrap algorithm 75 | encode = choose(encodet) 76 | decode = choose(decodet) 77 | wrap = choose(wrapt) 78 | 79 | -- define the end-of-line normalization filter 80 | function normalize(marker) 81 | return ltn12.filter.cycle(eol, 0, marker) 82 | end 83 | 84 | -- high level stuffing filter 85 | function stuff() 86 | return ltn12.filter.cycle(dot, 2) 87 | end 88 | -------------------------------------------------------------------------------- /菲佣源码/文字识别插件/FYorc.lua: -------------------------------------------------------------------------------- 1 | --菲佣orc插件,请勿用于商业用途 2 | local sz = require ("sz") 3 | local json = sz.json 4 | local FYorc = {} 5 | function FYorc.orctext(fontfile,area1,area2,area3,area4,cast1,cast2,fuzzy,errorrate) 6 | fuzzy = fuzzy or 90 7 | errorrate = errorrate or 95 8 | local function isColor(x,y,c1,c2,s) 9 | local fl,abs = math.floor,math.abs 10 | s = fl(0xff*(100-s)*0.01) 11 | local r1,g1,b1 = fl(c1/0x10000),fl(c1%0x10000/0x100),fl(c1%0x100) 12 | local r2,g2,b2 = fl(c2/0x10000),fl(c2%0x10000/0x100),fl(c2%0x100) 13 | local rr,gg,bb = getColorRGB(x,y) 14 | if abs(r1-rr)<(s+r2) and abs(g1-gg)<(s+g2) and abs(b1-bb)<(s+b2) then 15 | return true 16 | end 17 | end 18 | local font = {} 19 | --确保主色值在前面,偏色在后面 20 | if cast1 < cast2 then cast1,cast2 = cast2,cast1 end 21 | --读取字库文件 22 | local file = io.open(fontfile,"r") 23 | assert(file,"fontfile non-existent") 24 | if file then 25 | local n = 1 26 | for l in file:lines() do 27 | if #l > 0 then 28 | font[n] = json.decode(l) 29 | n = n + 1 30 | end 31 | end 32 | file:close() 33 | --排序,复杂的文字先检测,避免出现,三被识别成一的尴尬情况 34 | table.sort ( font , function(a, b) return #a > #b end ) 35 | end 36 | --用两张表来记录二值化 37 | local screent = {} 38 | local screenb = {} 39 | local n = 1 40 | local rate= 1-errorrate/100 41 | local save 42 | --保持屏幕取屏幕二值化信息 43 | keepScreen(true) 44 | for x = area1,area3 do 45 | for y = area2,area4 do 46 | if isColor(x,y,cast1,cast2,fuzzy) then 47 | screent[n] = {x,y} 48 | if screenb[x] then 49 | screenb[x][y] = n 50 | else 51 | screenb[x] = {} 52 | screenb[x][y] = n 53 | end 54 | n = n + 1 55 | end 56 | end 57 | end 58 | keepScreen(false) 59 | local orctext = "" 60 | local temp = 0 61 | local fl = math.floor 62 | for id,vd in ipairs(screent) do 63 | --已被识别出文字的区域将不会进入循环,直接跳过 64 | if id < temp then goto lable2 end 65 | for ik,vk in ipairs(font) do 66 | local l = #vk 67 | local errn = fl(l * rate) --允许出错的点的个数 68 | if id + l >= #screent - errn or 69 | (screent[id + l][1] - vd[1] > vk[l-errn][1]) then 70 | goto lable1 71 | end 72 | local err = 0 73 | for iz = 2,l do 74 | local x,y = vd[1]+vk[iz][1],vd[2]+vk[iz][2] 75 | if not screenb[x] then 76 | err = err + 1 77 | if err > errn then break end 78 | elseif not screenb[x][y] then 79 | err = err + 1 80 | if err > errn then break end 81 | end 82 | if iz == l then 83 | local e = 1 84 | while not (screenb[x] and screenb[x][y]) do 85 | x,y = vd[1]+vk[iz-e][1],vd[2]+vk[iz-e][2] 86 | e = e + 1 87 | end 88 | if screenb[x][y] - temp > l * 5 then break end 89 | orctext = orctext..vk[1][1] 90 | temp = screenb[x][y] 91 | goto lable2 92 | end 93 | end 94 | ::lable1:: 95 | end 96 | ::lable2:: 97 | end 98 | return orctext 99 | end 100 | 101 | return FYorc 102 | -------------------------------------------------------------------------------- /自定义位置连点器免费版/main.lua: -------------------------------------------------------------------------------- 1 | --自定义位置连点器免费版 2 | local t0 = os.time() 3 | function sClick(...) --封装自定义间隔时间的点击函数 4 | touchDown(...) 5 | mSleep(ms) 6 | touchUp(...) 7 | end 8 | init(0) 9 | w,h = getScreenSize(); 10 | if w <= 0 then 11 | w = 720 12 | h = 1080 13 | end 14 | 15 | function auto()--自动模式 16 | while true do 17 | sClick(w/2,h/2) 18 | flag = deviceIsLock(); --判断屏幕是否锁定 19 | if flag ~= 0 then 20 | unlockDevice(); --解锁屏幕 21 | end 22 | local t1 = os.time() 23 | if t1 - t0 >= 120 then 24 | dialog("免费版每次只能试用 8 小时,请购买付费版") 25 | lua_exit() 26 | mSleep(0) 27 | mSleep(0) 28 | end 29 | end 30 | end 31 | 32 | function set()--自定义模式 33 | dialog("现在请戳需要重复点击的地方", 0);--提示 34 | mSleep(1000); 35 | x,y = catchTouchPoint(); --获取点击坐标 36 | if x ~= -1 and y ~= -1 then 37 | toast("坐标获取成功~开始连续点击咯~") 38 | while true do 39 | sClick(x,y) 40 | flag = deviceIsLock(); --判断屏幕是否锁定 41 | if flag ~= 0 then 42 | unlockDevice(); --解锁屏幕 43 | end 44 | local t2 = os.time() 45 | if t2 - t0 >= 120 then 46 | dialog("免费版每次只能试用 8 小时,请购买付费版") 47 | lua_exit() 48 | mSleep(0) 49 | mSleep(0) 50 | end 51 | end 52 | else 53 | dialog("坐标获取失败,脚本即将退出", 2) 54 | mSleep(2000) 55 | lua_restart() 56 | end 57 | end 58 | 59 | 60 | local sz = require("sz") 61 | local json = sz.json 62 | w,h = getScreenSize(); 63 | MyTable = { 64 | ["style"] = "default", 65 | ["width"] = w*0.9, 66 | ["height"] = h*0.9, 67 | ["config"] = "wzclickfree.dat", 68 | ["timer"] = 15, 69 | views = { 70 | { 71 | ["type"] = "Label", 72 | ["text"] = "丸子放置游戏连点器免费版", 73 | ["size"] = 25, 74 | ["align"] = "center", 75 | ["color"] = "25,176,118", 76 | }, 77 | { 78 | ["type"] = "Label", 79 | ["text"] = "此脚本为限时免费版,无限制请购买付费版", 80 | ["size"] = 18, 81 | ["align"] = "center", 82 | ["color"] = "78,136,88", 83 | }, 84 | { 85 | ["type"] = "Label", 86 | ["text"] = "请选择点击位置", 87 | ["size"] = 25, 88 | ["align"] = "center", 89 | ["color"] = "118,198,38", 90 | }, 91 | { 92 | ["type"] = "RadioGroup",--input1 93 | ["list"] = "屏幕中心点,自定义位置", 94 | ["select"] = "0", 95 | }, 96 | { 97 | ["type"] = "Label", 98 | ["text"] = "请选择点击速度", 99 | ["size"] = 25, 100 | ["align"] = "center", 101 | ["color"] = "255,207,92", 102 | }, 103 | { 104 | ["type"] = "RadioGroup",--input2 105 | ["list"] = "50次,40次,30次,10次,5次", 106 | ["select"] = "1", 107 | }, 108 | { 109 | ["type"] = "Label", 110 | ["text"] = "此脚本为限时免费版,无限制请购买付费版", 111 | ["size"] = 18, 112 | ["align"] = "left", 113 | ["color"] = "233,60,7", 114 | } 115 | } 116 | } 117 | local MyJsonString = json.encode(MyTable); 118 | ret, input1, input2 = showUI(MyJsonString); 119 | if ret == 0 then lua_exit() 120 | mSleep(0) 121 | mSleep(0) 122 | end 123 | init(0) 124 | 125 | if input2 == "0" then 126 | ms = 20 127 | elseif input2 == "1" then 128 | ms = 25 129 | elseif input2 == "2" then 130 | ms = 30 131 | elseif input2 == "3" then 132 | ms = 100 133 | elseif input2 == "4" then 134 | ms = 200 135 | else 136 | ms = 40 137 | end 138 | function main(...) 139 | if input1 == "0" then 140 | toast("开始疯狂点击咯~") 141 | auto() 142 | elseif input1 == "1" then 143 | toast("请跟随引导进行设置~") 144 | set() 145 | end 146 | end 147 | 148 | main() 149 | -------------------------------------------------------------------------------- /万能喊话.lua: -------------------------------------------------------------------------------- 1 | function doUItable() 2 | local sz=require "sz" 3 | local json=sz.json 4 | local w,h=getScreenSize() 5 | MyTable={ 6 | ["style"]="default", -- 'default':默认自动排列模式 'custom':自定义排列模式 7 | ["config"]='我还要在喊100年.dat', -- 储存在'/User/Media/TouchSprite/config/'目录下 8 | ["width"]=w, -- UI宽度 9 | ["height"]=h, -- UI高度 10 | ["cancelname"]="不喊了", -- 取消按钮显示内容 11 | ["okname"]="开喊", 12 | ["timer"]=300, 13 | views={ 14 | { ["type"] = "Label", 15 | ["text"] = "并不万能的万能喊话王", 16 | ["size"] = 25, 17 | ["align"] = "center", 18 | ["color"] = "0,0,255",}, 19 | {["type"]="Label", 20 | ["text"]="Edit 示例:请赞助sz", 21 | ["size"]=15, ["align"]="left", 22 | ["color"]="0,0,0"}, 23 | {["type"]="Edit", 24 | ["prompt"]="内容1", 25 | ["text"]="喊话内容1"}, 26 | {["type"]="Edit", 27 | ["prompt"]="内容2", 28 | ["text"]="喊话内容2"}, 29 | {["type"]="Edit", 30 | ["prompt"]="内容3", 31 | ["text"]="喊话内容3"}, 32 | {["type"]="Edit", 33 | ["prompt"]="内容4", 34 | ["text"]="喊话内容4"}, 35 | {["type"]="Edit", 36 | ["prompt"]="内容5", 37 | ["text"]="喊话内容5"}, 38 | {["type"]="Label", 39 | ["text"]="喊话模式,以阿拉伯数字开始的一系列数字,\n单独填写一个数字则默认重复喊话,如:1", 40 | ["size"]=15, 41 | ["align"]="left", 42 | ["color"]="255,0,0"}, 43 | {["type"]="Label", 44 | ["text"]="如果需要组合喊话比如喊完1喊2则填写12。", 45 | ["size"]=15, 46 | ["align"]="left", 47 | ["color"]="255,0,0"}, 48 | {["type"]="Edit", 49 | ["prompt"]="喊话模式", 50 | ["text"]="1"} 51 | } 52 | 53 | } 54 | 55 | local MyJsonString = json.encode(MyTable) 56 | return MyJsonString 57 | end 58 | function syninputinit() 59 | dialog("请在确定后点击输入框,以便系统锁定输入框位置", 0) 60 | while true do 61 | local x,y=catchTouchPoint() 62 | mSleep(1000) 63 | userchoice=dialogRet("您已完成输入框初始化,是否需要再次确定", "", "需要","不需要",0) 64 | if userchoice==1 65 | then else return x,y 66 | end 67 | end 68 | 69 | end 70 | function synenterinit() 71 | dialog("请在确定后点击回发出,因为某些ios系统并不允许调用默认发出,以便系统锁定发出位置", 0) 72 | while 1 do 73 | local x,y=catchTouchPoint() 74 | userchoice=dialogRet("您已完成发送键输入框初始化,是否需要再次确定", "","需要" , "不需要", 0) 75 | if userchoice==1 then 76 | else 77 | return x,y 78 | end 79 | end 80 | end 81 | function click(x,y,time) 82 | local time=time or 50 83 | touchDown(1, x, y) 84 | mSleep(time) 85 | touchUp(1, x, y) 86 | end 87 | function worksort(mode) 88 | local sort={} 89 | local len=#mode 90 | for i=1,len do 91 | sort[i]=tonumber(string.sub(mode,i,i)) 92 | if type(sort[i])=="number" then else lua_exit() dialog("错误的模式输入,在模式里面的第"..i.."个模式", 0) end 93 | if sort[i]>5 then lua_exit() dialog("错误的模式输入,在模式里面的第"..i.."个模式", 0) end 94 | end 95 | return sort 96 | end 97 | function workmode_1(sort) 98 | while true do 99 | for i=1 , #sort do 100 | click(syn[3],syn[4]) 101 | mSleep(1000) 102 | inputText(text[sort[i]]) 103 | click(syn[1],syn[2]) 104 | mSleep(1000) 105 | end 106 | end 107 | end 108 | --begin 109 | UI={} 110 | UI={showUI(doUItable())} 111 | mSleep(2000) 112 | mode=UI[#UI] 113 | if UI[1]==0 then lua_exit() end 114 | sort={} 115 | syn={} 116 | text={} 117 | for i=2,#UI-2 do 118 | text[i-1]=UI[i] 119 | end 120 | syn[3],syn[4]=syninputinit() 121 | mSleep(2000) 122 | syn[1],syn[2]=synenterinit() 123 | sort=worksort(mode) 124 | workmode_1(sort) 125 | -------------------------------------------------------------------------------- /iOS 快捷跳转/设置.lua: -------------------------------------------------------------------------------- 1 | 设置部分 从窗口小部件(Prefs:)启动 从应用启动(App-prefs:) 2 | 设置最顶层 Prefs: App-prefs: 3 | 关于 Prefs:root=General&path=About App-prefs:root=General&path=About 4 | 辅助功能 Prefs:root=General&path=ACCESSIBILITY App-prefs:root=General&path=ACCESSIBILITY 5 | 帐号设定 Prefs:root=ACCOUNT_SETTINGS App-prefs:root=ACCOUNT_SETTINGS 6 | 飞行模式 Prefs:root=AIRPLANE_MODE App-prefs:root=AIRPLANE_MODE 7 | 自动锁定iOS <10 Prefs:root=General&path=AUTOLOCK App-prefs:root=General&path=AUTOLOCK 8 | 自动锁定iOS> 10 Prefs:root=DISPLAY&path=AUTOLOCK App-prefs:root=DISPLAY&path=AUTOLOCK 9 | 电池 Prefs:root=BATTERY_USAGE App-prefs:root=BATTERY_USAGE 10 | 蓝牙iOS <9 Prefs:root=General&path=Bluetooth App-prefs:root=General&path=Bluetooth 11 | 蓝牙iOS> 9 Prefs:root=Bluetooth App-prefs:root=Bluetooth 12 | 蜂窝电话 Prefs:root=MOBILE_DATA_SETTINGS_ID App-prefs:root=MOBILE_DATA_SETTINGS_ID 13 | 约会时间 Prefs:root=General&path=DATE_AND_TIME App-prefs:root=General&path=DATE_AND_TIME 14 | 字典 Prefs:root=General&path=DICTIONARY App-prefs:root=General&path=DICTIONARY 15 | 显示与亮度 Prefs:root=Brightness App-prefs:root=DISPLAY 16 | 请勿打扰 Prefs:root=General&path=DO_NOT_DISTURB App-prefs:root=General&path=DO_NOT_DISTURB 17 | 视频对话 Prefs:root=FACETIME App-prefs:root=FACETIME 18 | 一般 Prefs:root=General App-prefs:root=General 19 | iCloud的 Prefs:root=CASTLE App-prefs:root=CASTLE 20 | 的iTunes Prefs:root=MUSIC App-prefs:root=MUSIC 21 | iTunes均衡器 Prefs:root=MUSIC&path=EQ App-prefs:root=MUSIC&path=EQ 22 | iTunes音量 Prefs:root=MUSIC&path=VolumeLimit App-prefs:root=MUSIC&path=VolumeLimit 23 | 键盘 Prefs:root=General&path=Keyboard App-prefs:root=General&path=Keyboard 24 | 琴键 Prefs:root=General&path=Keyboard/KEYBOARDS App-prefs:root=General&path=Keyboard/KEYBOARDS 25 | 语言和地区 Prefs:root=General&path=INTERNATIONAL App-prefs:root=General&path=INTERNATIONAL 26 | 位置服务 Prefs:root=LOCATION_SERVICES App-prefs:root=LOCATION_SERVICES 27 | 音乐 Prefs:root=MUSIC App-prefs:root=MUSIC 28 | 网络iOS <10? Prefs:root=General&path=Network App-prefs:root=General&path=Network 29 | 耐克iPod Prefs:root=NIKE_PLUS_IPOD App-prefs:root=NIKE_PLUS_IPOD 30 | 笔记 Prefs:root=NOTES App-prefs:root=NOTES 31 | 通知事项 Prefs:root=NOTIFICATIONS_ID App-prefs:root=NOTIFICATIONS_ID 32 | 存折 Prefs:root=PASSBOOK App-prefs:root=PASSBOOK 33 | 密码 Prefs:root=SAFARI&path=Passwords App-prefs:root=SAFARI&path=Passwords 34 | 个人热点 Prefs:root=INTERNET_TETHERING App-prefs:root=INTERNET_TETHERING 35 | 电话 Prefs:root=Phone App-prefs:root=Phone 36 | 照片和相机 Prefs:root=Photos App-prefs:root=Photos 37 | 隐私 Prefs:root=Privacy App-prefs:root=Privacy 38 | 配置文件和设备管理 Prefs:root=General&path=ManagedConfigurationList App-prefs:root=General&path=ManagedConfigurationList 39 | 重启 Prefs:root=General&path=Reset App-prefs:root=General&path=Reset 40 | 铃声 Prefs:root=Sounds&path=Ringtone App-prefs:root=Sounds&path=Ringtone 41 | 苹果浏览器 Prefs:root=SAFARI App-prefs:root=SAFARI 42 | Siri iOS <10吗? Prefs:root=General&path=Assistant App-prefs:root=General&path=Assistant 43 | Siri iOS> 10? Prefs:root=SIRI App-prefs:root=SIRI 44 | 声音与触觉 Prefs:root=Sounds App-prefs:root=Sounds 45 | 软件更新 Prefs:root=General&path=SOFTWARE_UPDATE_LINK App-prefs:root=General&path=SOFTWARE_UPDATE_LINK 46 | 储存与备份 Prefs:root=CASTLE&path=STORAGE_AND_BACKUP App-prefs:root=CASTLE&path=STORAGE_AND_BACKUP 47 | 商店 Prefs:root=STORE App-prefs:root=STORE 48 | 推特 Prefs:root=TWITTER App-prefs:root=TWITTER 49 | 用法 Prefs:root=General&path=USAGE App-prefs:root=General&path=USAGE 50 | 视频 Prefs:root=VIDEO App-prefs:root=VIDEO 51 | VPN iOS <10吗? Prefs:root=General&path=Network/VPN App-prefs:root=General&path=Network/VPN 52 | VPN iOS> 10吗? Prefs:root=VPN App-prefs:root=VPN 53 | 钱包和Apple Pay shoebox://url-scheme shoebox://url-scheme 54 | 墙纸 Prefs:root=Wallpaper App-prefs:root=Wallpaper 55 | 无线上网 Prefs:root=WIFI App-prefs:root=WIFI 56 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/excel/string.lua: -------------------------------------------------------------------------------- 1 | --[[function string:split(delimiter) 2 | if #delimiter==0 then return {self} end 3 | local result = {} 4 | local from = 1 5 | local delim_from, delim_to = string.find(self, delimiter, from) 6 | while delim_from do 7 | table.insert(result, string.sub(self, from, delim_from - 1)) 8 | from = delim_to + 1 9 | delim_from, delim_to = string.find(self, delimiter, from) 10 | end 11 | table.insert(result, string.sub(self, from)) 12 | return result 13 | end]] 14 | function string:split(delimiter) 15 | if #delimiter==0 then return {self} end 16 | 17 | local result = {} 18 | local position = 1 19 | 20 | repeat 21 | local delim_start, delim_end = self:find(delimiter, position) 22 | 23 | local temp = "" 24 | if delim_start then 25 | temp = self:sub(position, delim_start - 1) 26 | position = delim_end + 1 27 | else 28 | temp = self:sub(position) 29 | end 30 | 31 | if temp~="" then 32 | if tonumber(temp) then 33 | table.insert(result, tonumber(temp)) 34 | else 35 | table.insert(result, temp) 36 | end 37 | end 38 | 39 | until not delim_start 40 | return result 41 | end 42 | 43 | function string:super_split(...) 44 | local arg = {...} 45 | local result = self:split(table.remove(arg, 1)) 46 | if #arg~=0 then 47 | for k,v in pairs(result) do 48 | result[k] = tostring(v):super_split(unpack(arg)) 49 | end 50 | end 51 | 52 | return result 53 | end 54 | 55 | function string:split_build(delimiters, ...) 56 | local doc = self:super_split(unpack(delimiters)) 57 | local argv = {...} 58 | 59 | local function deep_build(t, level) 60 | if level==0 then 61 | local temp = "" 62 | for i,v in ipairs(argv) do 63 | if t[i] then 64 | if type(t[i])=="number" then 65 | temp = temp .. v .. " = " .. t[i] .. ", " 66 | elseif type(t[i])=="string" then 67 | temp = temp .. v .. ' = "' .. t[i] .. '", ' 68 | end 69 | end 70 | end 71 | return temp:sub(0,-3) 72 | else 73 | local temp = "" 74 | for _,v in pairs(t) do 75 | temp = temp.."{"..deep_build(v, level-1).."}, " 76 | end 77 | return temp:sub(0,-3) 78 | end 79 | end 80 | 81 | return "{" .. deep_build(doc,#delimiters-1) .. "}" 82 | end 83 | 84 | function string:split_time(delimiter) 85 | if #delimiter==0 then return {self} end 86 | 87 | local result = "" 88 | local position = 1 89 | if self == "never" then return 21000101 end 90 | repeat 91 | local delim_start, delim_end = self:find(delimiter, position) 92 | 93 | local temp = "" 94 | if delim_start then 95 | temp = self:sub(position, delim_start - 1) 96 | position = delim_end + 1 97 | else 98 | temp = self:sub(position) 99 | end 100 | 101 | if temp~="" then 102 | if temp:find("T00:") then 103 | result = result..temp:sub(1,2) 104 | else 105 | result = result..temp 106 | end 107 | end 108 | until not delim_start 109 | return result 110 | end 111 | function string:split_sprite(delimiter) 112 | if #delimiter==0 then return {self} end 113 | 114 | local result = {} 115 | local position = 1 116 | 117 | repeat 118 | local delim_start, delim_end = self:find(delimiter, position) 119 | 120 | local temp = "" 121 | if delim_start then 122 | temp = self:sub(position, delim_start - 1) 123 | position = delim_end + 1 124 | else 125 | temp = self:sub(position) 126 | end 127 | 128 | if temp~="" then 129 | result[temp] = true 130 | end 131 | until not delim_start 132 | return result 133 | end -------------------------------------------------------------------------------- /菲佣源码/触动API(Python,lua,php)各种脚本语言的版本/TSAPI_lua苏泽库版.lua: -------------------------------------------------------------------------------- 1 | tsopenapi = require ("tsopenapi") 2 | local TS = {} 3 | TS.request = tsopenapi.request 4 | TS.getauth = tsopenapi.getauth 5 | TS.key = "1m9KBrtFaGWY0eT2A1TGoY8KccjHTeYhxaVYbf858DZIRhSIW6LMVTqTiAoaOLV1" 6 | 7 | function TS:new(ip) 8 | local r = {} 9 | r.ip = ip 10 | r.auth = "auth: "..self.getauth(self.key, {self.request(ip, "/deviceid", "GET", nil, nil, 50005, false)["message"]})["auth"] 11 | setmetatable(r,{__index = self}) 12 | return r 13 | end 14 | 15 | function TS:refresh(mode) 16 | self.deviceid = self:getDeviceid() 17 | self.devicename = self:getDevicename() 18 | self.auth = "auth: "..self:getAuth() 19 | if mode then 20 | self.status = self:getStatus() 21 | end 22 | print("设备名: "..self.devicename) 23 | print("设备ID: "..self.deviceid) 24 | print("IP地址: "..self.ip) 25 | print("手机状态: "..(self.status or "")) 26 | print(self.auth) 27 | end 28 | function TS:getDeviceid() --设备号 29 | return self.request(self.ip, "/deviceid", "GET", nil, nil, 50005, false)["message"] 30 | end 31 | function TS:getDevicename() --设备号 32 | return self.request(self.ip, "/devicename", "GET", nil, nil, 50005, false)["message"] 33 | end 34 | function TS:getAuth() --验证 35 | return self.getauth(TS.key, {self.deviceid})["auth"] 36 | end 37 | function TS:getStatus() --手机状态 38 | return self.request(self.ip, "/status", "GET", nil, {self.auth}, 50005, false)["message"] 39 | end 40 | function TS:reboot() --重启 41 | return self.request(self.ip, "/reboot?type=1", "GET", nil, {self.auth}, 50005, false)["message"] 42 | end 43 | function TS:respring() --注销 44 | return self.request(self.ip, "/reboot?type=0", "GET", nil, {self.auth}, 50005, false)["message"] 45 | end 46 | function TS:setLuaPath(path) --设置运行文件 47 | paths = '{"path":"'..path..'"}' 48 | return self.request(self.ip, "/setLuaPath", "POST", paths, {self.auth, 49 | "Content-Type: application/json", 50 | "Connection: close", 51 | "Content-Length: "..#paths}, 50005, false)["message"] 52 | end 53 | function TS:runLua() 54 | return self.request(self.ip, "runLua", "GET", nil, {self.auth}, 50005, false)["message"] 55 | end 56 | function TS:stopLua() 57 | local header = self.header 58 | return self.request(self.ip, "stopLua", "GET", nil, {header}, 50005, false)["message"] 59 | end 60 | function TS:upload(localpath,localname,path,name,root) 61 | local path,name,root = path or "/",name or localname,root or "lua" 62 | local file = io.open(localpath..localname,"rb") 63 | local data = file:read("*all") 64 | file:close() 65 | local r = tsopenapi.request(self.ip, "/upload", "POST", data, { 66 | self.auth, 67 | "Host: "..self.ip, 68 | "root: "..root, 69 | "path: "..path, 70 | "filename: "..name, 71 | "Connection: close", 72 | "Content-Type: touchsprite/uploadfile", 73 | "Content-Length: "..#data}, 50005, false) 74 | return r.message 75 | end 76 | function TS:getFile(name,path,root) 77 | local path,name,root = path or "/",name or localname,root or "lua" 78 | local r = tsopenapi.request(self.ip, "/getFile", "GET", nil, { 79 | self.auth, 80 | "Host: "..self.ip, 81 | "root: "..root, 82 | "path: "..path, 83 | "file: "..name, 84 | "Connection: close"}, 50005, false) 85 | return r.message 86 | end 87 | function TS:runformlocal(path,name,tree) 88 | print("上传文件: "..self:upload(path,name,tree)) 89 | print("设置路径: "..self:setLuaPath("/User/Media/TouchSprite/lua"..tree.."/"..name)) 90 | print("运行程序: "..self:runLua()) 91 | if self:getStatus() == "f01" then 92 | print("成功上传并运行") 93 | end 94 | end 95 | function TS.runphone(ip,name,tree) 96 | if not findMultiColorInRegionFuzzyExt then 97 | local phone = TS:new(ip) 98 | local ml = tree or "/" 99 | phone:runformlocal("",name,ml) 100 | end 101 | end 102 | --return TS 103 | local a = TS:new("192.168.10.210") 104 | a:refresh(1) 105 | -------------------------------------------------------------------------------- /天天三国志-刷开局/6s.lua: -------------------------------------------------------------------------------- 1 | t_Login = { 2 | {498, 429, 0xfab700}, 3 | {834, 471, 0xfbb600}, 4 | {830, 514, 0x21c8ba}, 5 | {832, 603, 0x00b0f2}, 6 | {816, 349, 0x21ca63}, 7 | action_1 = function() click(665, 450) end, 8 | } 9 | 10 | t_gg = { 11 | {628, 642, 0xaf4f31}, 12 | {718, 646, 0x993e20}, 13 | {626, 676, 0xa92f12}, 14 | {716, 679, 0xaa3013}, 15 | action_1 = function() click(669, 660) end, 16 | } 17 | 18 | t_Start = { 19 | {528, 573, 0xa44020}, 20 | {802, 575, 0xa23f21}, 21 | {530, 608, 0xb43513}, 22 | {800, 613, 0xb03013}, 23 | {1231, 723, 0x9f2c0e}, 24 | action_1 = function() click(667, 594) end, 25 | } 26 | 27 | t_Master = { 28 | {838, 23, 0xf2f2ad}, 29 | {1068, 24, 0xf1f1b0}, 30 | {1299, 25, 0xf0f0b2}, 31 | {170, 129, 0xdcbf5e}, 32 | action_1 = function() click(987,162) end, 33 | } 34 | 35 | t_Boss = { 36 | {1096, 71, 0x8f2408}, 37 | {716, 532, 0x469890}, 38 | {754, 531, 0x47a38f}, 39 | {755, 616, 0x654030}, 40 | {894, 662, 0x6d1d0d}, 41 | {1074, 618, 0x5d3827}, 42 | action_1 = function() click(1008, 639) end, 43 | } 44 | 45 | t_Xl = { 46 | {263, 146, 0x6cb6b6}, 47 | {339, 146, 0x6ec5c5}, 48 | {427, 149, 0x2f8a8c}, 49 | action_1 = function() click(339, 173) end, 50 | } 51 | 52 | t_Ws = { 53 | {291, 245, 0x42adaa}, 54 | {382, 245, 0x45aeb1}, 55 | {428, 249, 0x30898a}, 56 | action_1 = function() click(338, 268) end, 57 | } 58 | 59 | t_Dead = { 60 | {582, 580, 0x7d5b41}, 61 | {582, 583, 0x7f5d45}, 62 | {582, 587, 0x815f48}, 63 | } 64 | 65 | t_Team = { 66 | {230, 172, 0x6c322f}, 67 | {331, 169, 0x8a4138}, 68 | {329, 190, 0x702920}, 69 | {886, 660, 0x5d3727}, 70 | {1026, 701, 0x6e1f0e}, 71 | {1124, 243, 0x6c261e}, 72 | action_1 = function() click(961, 682) end, 73 | } 74 | 75 | t_Fight = { 76 | {1191, 31, 0xefddcf}, 77 | {1205, 48, 0xf2dfd0}, 78 | {1224, 39, 0xf2ded2}, 79 | {1301, 30, 0xefddd3}, 80 | {1280, 49, 0xf0dbd1}, 81 | {1302, 650, 0x5b3928}, 82 | } 83 | 84 | t_Fight1 = { 85 | {1192, 32, 0xefdbd0}, 86 | {1191, 49, 0xefdbce}, 87 | {1205, 32, 0xf0ddd1}, 88 | {1226, 41, 0xf1ddd6}, 89 | {1280, 31, 0xefdcd1}, 90 | {1301, 47, 0xefddd2}, 91 | } 92 | 93 | t_Win = { 94 | {591, 630, 0x2d5354}, 95 | {740, 630, 0x2c5354}, 96 | {592, 675, 0x186b66}, 97 | {740, 673, 0x15645d}, 98 | action_1 = function() click(666, 650) end, 99 | } 100 | 101 | t_Buy = { 102 | {422, 515, 0x5d3828}, 103 | {553, 554, 0x701f0e}, 104 | {776, 513, 0x2b5254}, 105 | {907, 552, 0x166660}, 106 | {908, 515, 0x2d5356}, 107 | action_1 = function() click(844, 536) end, 108 | } 109 | 110 | t_End = { 111 | {591, 630, 0x2d5354}, 112 | {740, 630, 0x2c5354}, 113 | {592, 675, 0x186b66}, 114 | {740, 673, 0x15645d}, 115 | action_1 = function() click(666, 650) end, 116 | } 117 | 118 | t_Blood = { 119 | c = 0xd40030, 120 | x = 601, 121 | y = 577, 122 | x1 = 892, 123 | y1 = 590, 124 | } 125 | 126 | t_Time = { 127 | c = 0x411d18, 128 | x = 918, 129 | y = 544, 130 | x1 = 1074, 131 | y1 = 573, 132 | } 133 | 134 | t_mine = { 135 | {1125, 121, 0xac2906}, 136 | {356, 175, 0xf2ddbb}, 137 | {477, 193, 0xf5c796}, 138 | {879, 173, 0xf9dfbe}, 139 | {964, 193, 0xf5d5a6}, 140 | {880, 200, 0xf3a96e}, 141 | action_1 = function() click(425, 425) end, 142 | action_2 = function() click(913, 428) end, 143 | } 144 | 145 | t_zy = { 146 | {271, 152, 0xf7f2cc}, 147 | {282, 163, 0xe6daaa}, 148 | {1125, 117, 0x9b2706}, 149 | {238, 619, 0xab4221}, 150 | {1075, 616, 0xa33f21}, 151 | {920, 658, 0xb63613}, 152 | action_1 = function() click(582, 185) end, 153 | action_2 = function() click(730, 186) end, 154 | action_3 = function() click(1122,105) end, 155 | } 156 | 157 | 158 | t_lost = { 159 | {822, 344, 0x593723}, 160 | {906, 344, 0x5b3726}, 161 | {820, 373, 0x691c0e}, 162 | {908, 375, 0x701f0e}, 163 | {925, 259, 0x9a2605}, 164 | action_1 = function() click(863, 359) end, 165 | } 166 | 167 | -------------------------------------------------------------------------------- /菲佣源码/文字识别插件/txwl.txt: -------------------------------------------------------------------------------- 1 | [["一",[1707788,1313801],90],[1,0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,0],[8,0],[9,0],[10,0],[11,0],[12,0],[13,0],[14,0],[15,0]] 2 | [["二",[1707788,1313801],90],[1,-11],[1,0],[2,0],[3,0],[4,0],[5,-11],[5,0],[6,-11],[6,0],[7,-11],[7,0],[8,-11],[8,0],[9,-11],[9,0],[10,-11],[10,0],[11,0],[12,0],[13,-11],[13,0],[14,0],[15,0]] 3 | [["三",[1707788,1313801],85],[1,0],[2,-11],[2,0],[3,-11],[3,-6],[3,0],[4,-11],[4,-6],[5,-11],[5,-6],[6,0],[9,-6],[9,0],[10,-11],[10,0],[11,-11],[11,-6],[11,0],[12,-11],[12,-6],[12,0],[13,-11],[13,0],[14,0]] 4 | [["五",[1707788,1313801],95],[0,1],[1,-11],[1,0],[1,1],[2,-12],[2,-11],[2,0],[2,1],[3,-12],[3,-11],[3,-7],[3,-6],[3,0],[3,1],[4,-12],[4,-11],[4,-7],[4,-6],[4,0],[4,1],[5,-12],[5,-11],[5,-7],[5,-6],[5,-5],[5,-4],[5,-3],[5,-2],[5,-1],[5,0],[5,1],[6,-12],[6,-11],[6,-10],[6,-9],[6,-8],[6,-7],[6,-6],[6,-5],[6,-4],[6,-3],[6,0],[6,1],[7,-12],[7,-11],[7,-10],[7,-9],[7,-7],[7,-6],[7,0],[7,1],[8,-12],[8,-11],[8,-7],[8,-6],[8,0],[8,1],[9,-12],[9,-11],[9,-7],[9,-6],[9,0],[9,1],[10,-12],[10,-11],[10,-7],[10,-6],[10,0],[10,1],[11,-12],[11,-11],[11,-7],[11,-6],[11,-3],[11,-2],[11,-1],[11,0],[11,1],[12,-12],[12,-11],[12,-7],[12,-6],[12,-5],[12,-4],[12,-3],[12,-2],[12,-1],[12,0],[12,1],[13,-12],[13,-11],[13,0],[13,1],[14,0],[14,1],[15,1]] 5 | [["六",[1707788,1313801],95],[0,1],[1,0],[1,1],[1,8],[1,9],[1,10],[2,0],[2,1],[2,7],[2,8],[2,9],[3,0],[3,1],[3,6],[3,7],[3,8],[4,0],[4,1],[4,4],[4,5],[4,6],[5,0],[5,1],[5,3],[5,4],[5,5],[6,-4],[6,-3],[6,0],[6,1],[7,-4],[7,-3],[7,-2],[7,0],[7,1],[8,-3],[8,-2],[8,-1],[8,0],[8,1],[9,0],[9,1],[10,0],[10,1],[10,3],[10,4],[11,0],[11,1],[11,4],[11,5],[11,6],[12,0],[12,1],[12,5],[12,6],[12,7],[13,0],[13,1],[13,7],[13,8],[13,9],[14,0],[14,1],[14,8],[14,9],[14,10],[15,0],[15,1]] 6 | [["八",[1707788,1313801],95],[0,1],[1,-1],[1,0],[1,1],[2,-2],[2,-1],[2,0],[3,-5],[3,-4],[3,-3],[3,-2],[4,-10],[4,-9],[4,-8],[4,-7],[4,-6],[4,-5],[4,-4],[5,-12],[5,-11],[5,-10],[5,-9],[5,-8],[5,-7],[10,-12],[10,-11],[10,-10],[10,-9],[10,-8],[11,-10],[11,-9],[11,-8],[11,-7],[11,-6],[11,-5],[11,-4],[12,-5],[12,-4],[12,-3],[12,-2],[13,-2],[13,-1],[13,0],[14,-1],[14,0],[14,1],[15,0],[15,1]] 7 | [["九",[1707788,1313801],95],[0,1],[1,-10],[1,-9],[1,0],[1,1],[2,-10],[2,-9],[2,-1],[2,0],[3,-10],[3,-9],[3,-2],[3,-1],[4,-10],[4,-9],[4,-5],[4,-4],[4,-3],[4,-2],[5,-14],[5,-13],[5,-12],[5,-11],[5,-10],[5,-9],[5,-8],[5,-7],[5,-6],[5,-5],[5,-4],[6,-14],[6,-13],[6,-12],[6,-11],[6,-10],[6,-9],[7,-10],[7,-9],[8,-10],[8,-9],[9,-10],[9,-9],[10,-10],[10,-9],[10,-4],[10,-3],[10,-2],[10,-1],[10,0],[11,-10],[11,-9],[11,-8],[11,-7],[11,-6],[11,-5],[11,-4],[11,-3],[11,-2],[11,-1],[11,0],[11,1],[12,0],[12,1],[13,0],[13,1],[14,0],[14,1],[15,-1],[15,0]] 8 | [["四",[1707788,1313801],95],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,9],[0,10],[0,11],[0,12],[0,13],[0,14],[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],[1,8],[1,9],[1,10],[1,11],[1,12],[1,13],[1,14],[2,0],[2,1],[2,9],[2,10],[2,12],[2,13],[3,0],[3,1],[3,8],[3,9],[3,12],[3,13],[4,0],[4,1],[4,2],[4,3],[4,4],[4,5],[4,6],[4,7],[4,8],[4,12],[4,13],[5,0],[5,1],[5,2],[5,3],[5,4],[5,5],[5,6],[5,12],[5,13],[6,0],[6,1],[6,12],[6,13],[7,0],[7,1],[7,12],[7,13],[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,6],[8,7],[8,8],[8,9],[8,12],[8,13],[9,0],[9,1],[9,2],[9,3],[9,4],[9,5],[9,6],[9,7],[9,8],[9,9],[9,12],[9,13],[10,0],[10,1],[10,9],[10,12],[10,13],[11,0],[11,1],[11,9],[11,10],[11,12],[11,13],[12,0],[12,1],[12,2],[12,3],[12,4],[12,5],[12,6],[12,7],[12,8],[12,9],[12,10],[12,11],[12,12],[12,13],[12,14],[13,0],[13,1],[13,2],[13,3],[13,4],[13,5],[13,6],[13,7],[13,8],[13,9],[13,10],[13,11],[13,12],[13,13],[13,14]] 9 | [["十",[1707788,1313801],95],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1],[4,0],[4,1],[5,0],[5,1],[6,0],[6,1],[7,-6],[7,-5],[7,-4],[7,-3],[7,-2],[7,-1],[7,0],[7,1],[7,2],[7,3],[7,4],[7,5],[7,6],[7,7],[7,8],[7,9],[7,10],[8,-6],[8,-5],[8,-4],[8,-3],[8,-2],[8,-1],[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,6],[8,7],[8,8],[8,9],[8,10],[9,0],[9,1],[10,0],[10,1],[11,0],[11,1],[12,0],[12,1],[13,0],[13,1],[14,0],[14,1],[15,0],[15,1]] 10 | -------------------------------------------------------------------------------- /菲佣源码/通信/lua/socket/tp.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- Unified SMTP/FTP subsystem 3 | -- LuaSocket toolkit. 4 | -- Author: Diego Nehab 5 | -- RCS ID: $Id: tp.lua,v 1.22 2006/03/14 09:04:15 diego Exp $ 6 | ----------------------------------------------------------------------------- 7 | 8 | ----------------------------------------------------------------------------- 9 | -- Declare module and import dependencies 10 | ----------------------------------------------------------------------------- 11 | local base = _G 12 | local string = require("string") 13 | local socket = require("socket") 14 | local ltn12 = require("ltn12") 15 | module("socket.tp") 16 | 17 | ----------------------------------------------------------------------------- 18 | -- Program constants 19 | ----------------------------------------------------------------------------- 20 | TIMEOUT = 60 21 | 22 | ----------------------------------------------------------------------------- 23 | -- Implementation 24 | ----------------------------------------------------------------------------- 25 | -- gets server reply (works for SMTP and FTP) 26 | local function get_reply(c) 27 | local code, current, sep 28 | local line, err = c:receive() 29 | local reply = line 30 | if err then return nil, err end 31 | code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) 32 | if not code then return nil, "invalid server reply" end 33 | if sep == "-" then -- reply is multiline 34 | repeat 35 | line, err = c:receive() 36 | if err then return nil, err end 37 | current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) 38 | reply = reply .. "\n" .. line 39 | -- reply ends with same code 40 | until code == current and sep == " " 41 | end 42 | return code, reply 43 | end 44 | 45 | -- metatable for sock object 46 | local metat = { __index = {} } 47 | 48 | function metat.__index:check(ok) 49 | local code, reply = get_reply(self.c) 50 | if not code then return nil, reply end 51 | if base.type(ok) ~= "function" then 52 | if base.type(ok) == "table" then 53 | for i, v in base.ipairs(ok) do 54 | if string.find(code, v) then 55 | return base.tonumber(code), reply 56 | end 57 | end 58 | return nil, reply 59 | else 60 | if string.find(code, ok) then return base.tonumber(code), reply 61 | else return nil, reply end 62 | end 63 | else return ok(base.tonumber(code), reply) end 64 | end 65 | 66 | function metat.__index:command(cmd, arg) 67 | if arg then 68 | return self.c:send(cmd .. " " .. arg.. "\r\n") 69 | else 70 | return self.c:send(cmd .. "\r\n") 71 | end 72 | end 73 | 74 | function metat.__index:sink(snk, pat) 75 | local chunk, err = c:receive(pat) 76 | return snk(chunk, err) 77 | end 78 | 79 | function metat.__index:send(data) 80 | return self.c:send(data) 81 | end 82 | 83 | function metat.__index:receive(pat) 84 | return self.c:receive(pat) 85 | end 86 | 87 | function metat.__index:getfd() 88 | return self.c:getfd() 89 | end 90 | 91 | function metat.__index:dirty() 92 | return self.c:dirty() 93 | end 94 | 95 | function metat.__index:getcontrol() 96 | return self.c 97 | end 98 | 99 | function metat.__index:source(source, step) 100 | local sink = socket.sink("keep-open", self.c) 101 | local ret, err = ltn12.pump.all(source, sink, step or ltn12.pump.step) 102 | return ret, err 103 | end 104 | 105 | -- closes the underlying c 106 | function metat.__index:close() 107 | self.c:close() 108 | return 1 109 | end 110 | 111 | -- connect with server and return c object 112 | function connect(host, port, timeout, create) 113 | local c, e = (create or socket.tcp)() 114 | if not c then return nil, e end 115 | c:settimeout(timeout or TIMEOUT) 116 | local r, e = c:connect(host, port) 117 | if not r then 118 | c:close() 119 | return nil, e 120 | end 121 | return base.setmetatable({c = c}, metat) 122 | end 123 | 124 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/client.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------- 2 | ------------中控纯lua版,随便做着玩玩------------ 3 | ------------有能力的同学请自行修改----------- 4 | ---------------------------------------------------- 5 | ------------版权所无,敬请复制-------------- 6 | ------------您可以随意使用代码-------------- 7 | ---------------------------------------------------- 8 | ------------脚本制作人:菲佣---------------- 9 | ------------创建时间:2016-1-19------------ 10 | ---------------------------------------------------- 11 | -- client.lua 12 | local socket = require("socket") 13 | local json = require ("dkjson") 14 | local host = "192.168.10.23" 15 | local port = 12345 16 | local sock = socket.connect(host, port) 17 | sock:settimeout(1) 18 | 19 | --克隆表格 20 | function CloneTab(tab) 21 | if type(tab) ~= "table" then return tab end 22 | local function _dump(t) 23 | local cl = {} 24 | for k, v in pairs(t) do 25 | if type (k) == "userdata" then 26 | k = tostring(k):sub(14,22) 27 | end 28 | if type(v) == "table" then 29 | cl[k] = _dump(v) 30 | elseif type(v) == "string" or type(v) == "number" then 31 | cl[k] = v 32 | end 33 | end 34 | return cl 35 | end 36 | return _dump(tab) 37 | end 38 | --Json转换,输入的是表,则返回json,输入json,则返回表 39 | local function jsoncov(j) 40 | if type(j) == "table" and next(j) ~= nil then 41 | local j = CloneTab(j) 42 | local tojson = json.encode(j) 43 | return tojson 44 | elseif type(j) == "string" and #j >0 then 45 | local totable = json.decode(j) 46 | if type(totable) ~= "table" then return {command="error"} end 47 | --解决json模块的数组和哈希共存 48 | local r = {} 49 | for k,v in pairs (totable) do 50 | if tonumber(k) then 51 | r[tonumber(k)] = v 52 | else 53 | r[k] = v 54 | end 55 | end 56 | return r 57 | else 58 | return {command=nil} 59 | end 60 | end 61 | 62 | local command = {} 63 | function command.send(t) 64 | local j = jsoncov(t) 65 | assert(sock:send(j.."\n")) 66 | end 67 | function command.back(com) 68 | print("server back:"..com.message) 69 | end 70 | 71 | local zc = { command = "validate", 72 | info = { 73 | os_type = "IOS", --返回设备的系统类型 iOS、android 74 | type = "Ihpone", --设备类型 0 == iPod Touch;1 == iPhone;2 == iPad 75 | tsid = 1, --触动设备号 76 | versionts = "2.2.6", --触动版本号 77 | versionos = "8.3", --系统版本号 78 | tsp = "lua", --脚本运行状态 79 | }, 80 | sprite = "test1", 81 | usertype = "phone", 82 | } 83 | local cx = {command = "validate"} 84 | local sendt 85 | local input 86 | print("请输入要模拟的手机编号:") 87 | while true do 88 | input = io.read() 89 | if tonumber(input) then 90 | sendt = zc 91 | sendt.info.tsid = tonumber(input) 92 | break 93 | else 94 | print("请输入数字:") 95 | end 96 | end 97 | print("请输入要模拟的运行脚本的名字:") 98 | input = io.read() 99 | if #input>0 then 100 | sendt.sprite = input 101 | end 102 | command.send(sendt) 103 | 104 | local input, recvt, sendt, status 105 | while true do 106 | recvt, sendt, status = socket.select({sock}, nil, 1) 107 | while #recvt > 0 do 108 | local response, receive_status = sock:receive() 109 | if receive_status ~= "closed" then 110 | if response then 111 | com = json.decode(response) 112 | if command[com.command] then 113 | command[com.command](com) 114 | else 115 | print("无法识别服务器的命令:\n"..response) 116 | end 117 | recvt, sendt, status = socket.select({sock}, nil, 1) 118 | end 119 | else 120 | break 121 | end 122 | end 123 | end 124 | 125 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/lua/socket/tp.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- Unified SMTP/FTP subsystem 3 | -- LuaSocket toolkit. 4 | -- Author: Diego Nehab 5 | -- RCS ID: $Id: tp.lua,v 1.22 2006/03/14 09:04:15 diego Exp $ 6 | ----------------------------------------------------------------------------- 7 | 8 | ----------------------------------------------------------------------------- 9 | -- Declare module and import dependencies 10 | ----------------------------------------------------------------------------- 11 | local base = _G 12 | local string = require("string") 13 | local socket = require("socket") 14 | local ltn12 = require("ltn12") 15 | module("socket.tp") 16 | 17 | ----------------------------------------------------------------------------- 18 | -- Program constants 19 | ----------------------------------------------------------------------------- 20 | TIMEOUT = 60 21 | 22 | ----------------------------------------------------------------------------- 23 | -- Implementation 24 | ----------------------------------------------------------------------------- 25 | -- gets server reply (works for SMTP and FTP) 26 | local function get_reply(c) 27 | local code, current, sep 28 | local line, err = c:receive() 29 | local reply = line 30 | if err then return nil, err end 31 | code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) 32 | if not code then return nil, "invalid server reply" end 33 | if sep == "-" then -- reply is multiline 34 | repeat 35 | line, err = c:receive() 36 | if err then return nil, err end 37 | current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) 38 | reply = reply .. "\n" .. line 39 | -- reply ends with same code 40 | until code == current and sep == " " 41 | end 42 | return code, reply 43 | end 44 | 45 | -- metatable for sock object 46 | local metat = { __index = {} } 47 | 48 | function metat.__index:check(ok) 49 | local code, reply = get_reply(self.c) 50 | if not code then return nil, reply end 51 | if base.type(ok) ~= "function" then 52 | if base.type(ok) == "table" then 53 | for i, v in base.ipairs(ok) do 54 | if string.find(code, v) then 55 | return base.tonumber(code), reply 56 | end 57 | end 58 | return nil, reply 59 | else 60 | if string.find(code, ok) then return base.tonumber(code), reply 61 | else return nil, reply end 62 | end 63 | else return ok(base.tonumber(code), reply) end 64 | end 65 | 66 | function metat.__index:command(cmd, arg) 67 | if arg then 68 | return self.c:send(cmd .. " " .. arg.. "\r\n") 69 | else 70 | return self.c:send(cmd .. "\r\n") 71 | end 72 | end 73 | 74 | function metat.__index:sink(snk, pat) 75 | local chunk, err = c:receive(pat) 76 | return snk(chunk, err) 77 | end 78 | 79 | function metat.__index:send(data) 80 | return self.c:send(data) 81 | end 82 | 83 | function metat.__index:receive(pat) 84 | return self.c:receive(pat) 85 | end 86 | 87 | function metat.__index:getfd() 88 | return self.c:getfd() 89 | end 90 | 91 | function metat.__index:dirty() 92 | return self.c:dirty() 93 | end 94 | 95 | function metat.__index:getcontrol() 96 | return self.c 97 | end 98 | 99 | function metat.__index:source(source, step) 100 | local sink = socket.sink("keep-open", self.c) 101 | local ret, err = ltn12.pump.all(source, sink, step or ltn12.pump.step) 102 | return ret, err 103 | end 104 | 105 | -- closes the underlying c 106 | function metat.__index:close() 107 | self.c:close() 108 | return 1 109 | end 110 | 111 | -- connect with server and return c object 112 | function connect(host, port, timeout, create) 113 | local c, e = (create or socket.tcp)() 114 | if not c then return nil, e end 115 | c:settimeout(timeout or TIMEOUT) 116 | local r, e = c:connect(host, port) 117 | if not r then 118 | c:close() 119 | return nil, e 120 | end 121 | return base.setmetatable({c = c}, metat) 122 | end 123 | 124 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/lua/socket/tp.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- Unified SMTP/FTP subsystem 3 | -- LuaSocket toolkit. 4 | -- Author: Diego Nehab 5 | -- RCS ID: $Id: tp.lua,v 1.22 2006/03/14 09:04:15 diego Exp $ 6 | ----------------------------------------------------------------------------- 7 | 8 | ----------------------------------------------------------------------------- 9 | -- Declare module and import dependencies 10 | ----------------------------------------------------------------------------- 11 | local base = _G 12 | local string = require("string") 13 | local socket = require("socket") 14 | local ltn12 = require("ltn12") 15 | module("socket.tp") 16 | 17 | ----------------------------------------------------------------------------- 18 | -- Program constants 19 | ----------------------------------------------------------------------------- 20 | TIMEOUT = 60 21 | 22 | ----------------------------------------------------------------------------- 23 | -- Implementation 24 | ----------------------------------------------------------------------------- 25 | -- gets server reply (works for SMTP and FTP) 26 | local function get_reply(c) 27 | local code, current, sep 28 | local line, err = c:receive() 29 | local reply = line 30 | if err then return nil, err end 31 | code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) 32 | if not code then return nil, "invalid server reply" end 33 | if sep == "-" then -- reply is multiline 34 | repeat 35 | line, err = c:receive() 36 | if err then return nil, err end 37 | current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) 38 | reply = reply .. "\n" .. line 39 | -- reply ends with same code 40 | until code == current and sep == " " 41 | end 42 | return code, reply 43 | end 44 | 45 | -- metatable for sock object 46 | local metat = { __index = {} } 47 | 48 | function metat.__index:check(ok) 49 | local code, reply = get_reply(self.c) 50 | if not code then return nil, reply end 51 | if base.type(ok) ~= "function" then 52 | if base.type(ok) == "table" then 53 | for i, v in base.ipairs(ok) do 54 | if string.find(code, v) then 55 | return base.tonumber(code), reply 56 | end 57 | end 58 | return nil, reply 59 | else 60 | if string.find(code, ok) then return base.tonumber(code), reply 61 | else return nil, reply end 62 | end 63 | else return ok(base.tonumber(code), reply) end 64 | end 65 | 66 | function metat.__index:command(cmd, arg) 67 | if arg then 68 | return self.c:send(cmd .. " " .. arg.. "\r\n") 69 | else 70 | return self.c:send(cmd .. "\r\n") 71 | end 72 | end 73 | 74 | function metat.__index:sink(snk, pat) 75 | local chunk, err = c:receive(pat) 76 | return snk(chunk, err) 77 | end 78 | 79 | function metat.__index:send(data) 80 | return self.c:send(data) 81 | end 82 | 83 | function metat.__index:receive(pat) 84 | return self.c:receive(pat) 85 | end 86 | 87 | function metat.__index:getfd() 88 | return self.c:getfd() 89 | end 90 | 91 | function metat.__index:dirty() 92 | return self.c:dirty() 93 | end 94 | 95 | function metat.__index:getcontrol() 96 | return self.c 97 | end 98 | 99 | function metat.__index:source(source, step) 100 | local sink = socket.sink("keep-open", self.c) 101 | local ret, err = ltn12.pump.all(source, sink, step or ltn12.pump.step) 102 | return ret, err 103 | end 104 | 105 | -- closes the underlying c 106 | function metat.__index:close() 107 | self.c:close() 108 | return 1 109 | end 110 | 111 | -- connect with server and return c object 112 | function connect(host, port, timeout, create) 113 | local c, e = (create or socket.tcp)() 114 | if not c then return nil, e end 115 | c:settimeout(timeout or TIMEOUT) 116 | local r, e = c:connect(host, port) 117 | if not r then 118 | c:close() 119 | return nil, e 120 | end 121 | return base.setmetatable({c = c}, metat) 122 | end 123 | 124 | -------------------------------------------------------------------------------- /天天三国志-扫荡/TsLib.lua: -------------------------------------------------------------------------------- 1 | --=====================--TS扩展LUA库[找色/比色]--=====================-- 2 | function click(...) 3 | touchDown(...) 4 | mSleep(30) 5 | touchUp(...) 6 | end 7 | 8 | -- 函数:单点比色 9 | function isColor(x,y,c,s) 10 | local fl,abs = math.floor,math.abs 11 | s = fl(0xff*(100-s)*0.01) 12 | local r,g,b = fl(c/0x10000),fl(c%0x10000/0x100),fl(c%0x100) 13 | local rr,gg,bb = getColorRGB(x,y) 14 | if abs(r-rr) s or math.abs(lg-g) > s or math.abs(lb-b) > s then 29 | return false 30 | end 31 | end 32 | keepScreen(false) 33 | return true 34 | end 35 | 36 | function colorFlag(c,p,x,y,x1,y1) 37 | local x0,y0 = findColorInRegionFuzzy(c,p,x,y,x1,y1); 38 | if x0 ~= -1 and y0 ~= -1 then 39 | return true 40 | else 41 | return false 42 | end 43 | end 44 | 45 | --=====================--TS扩展LUA库[文件操作]--=====================-- 46 | function saveStr(path,s) 47 | file = io.open(path, "w+"); 48 | file:write(s); 49 | file:close(); 50 | end 51 | 52 | -- 函数:获取当前脚本路径 53 | function z_getScriptPathList() 54 | local pathlist = {}; 55 | local i,s = 1,package.path; 56 | while true do 57 | n = string.find(s,";"); 58 | if n == nil then 59 | break; 60 | end 61 | s = string.sub(s,n+1,string.len(s)); 62 | pathlist[i] = string.sub(s,1,string.find(s,"?")-1); 63 | i = i + 1; 64 | end 65 | return pathlist; 66 | end 67 | 68 | function z_getScriptPath() 69 | local pl = z_getScriptPathList() 70 | return pl[#pl] 71 | end 72 | 73 | -- 函数:删除文件 74 | function delFile(path) 75 | os.execute("rm -rf "..path); 76 | end 77 | 78 | -- 函数:遍历文件 79 | function getList(path) 80 | local a = io.popen("ls "..path); 81 | local f = {}; 82 | for l in a:lines() do 83 | table.insert(f,l) 84 | end 85 | return f 86 | end 87 | 88 | -- 函数:复制文件 89 | function copyFile(path,to) 90 | os.execute("cp -rf "..path.." "..to); 91 | end 92 | 93 | -- 函数:移动文件 94 | function moveFile(path,to) 95 | os.execute("mv "..path.." "..to); 96 | end 97 | 98 | -- 函数:创建文件夹 99 | function newFolder(path) 100 | os.execute("mkdir "..path); 101 | end 102 | 103 | function fileToHexString(file) 104 | local file = io.open(file, 'rb'); 105 | local data = file:read("*all"); 106 | file:close(); 107 | local t = {}; 108 | for i = 1, string.len(data),1 do 109 | local code = tonumber(string.byte(data, i, i)); 110 | table.insert(t, string.format("%02x", code)); 111 | end 112 | return table.concat(t, ""); 113 | end 114 | 115 | function HexToRes(Path,hexstr) 116 | local bytesfile = io.open(Path, "wb") 117 | if nil == bytesfile then 118 | dialog("Can not open output file to write!\n",0) 119 | return 120 | end 121 | for i = 1, string.len(hexstr) - 1, 2 do 122 | local doublebytestr = string.sub(hexstr, i, i+1) 123 | local n = tonumber(doublebytestr, 16) 124 | if 0 == n then 125 | bytesfile:write('\00') 126 | else 127 | bytesfile:write(string.format("%c", n)) 128 | end 129 | end 130 | bytesfile:close() 131 | return Tmp 132 | end 133 | 134 | --=====================--TS扩展LUA库[字符串操作]--=====================-- 135 | -- 函数:生成随机字符串 136 | function randomStr(str, num) 137 | local ret ='' 138 | math.randomseed( tonumber(tostring(os.time()):reverse():sub(1,6)) ); 139 | for i=1 ,num do 140 | local rchr = math.random(1, string.len(str)) 141 | ret = ret .. string.sub(str, rchr, rchr) 142 | end 143 | return ret 144 | end 145 | 146 | function isToday(timestamp) 147 | local today = os.date("*t") 148 | local secondOfToday = os.time({day=today.day, month=today.month, 149 | year = today.year, hour=0, minute=0, second=0}) 150 | if timestamp >= secondOfToday and timestamp < secondOfToday + 24 * 60 * 60 then 151 | return true 152 | else 153 | return false 154 | end 155 | end 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /菲佣源码/通信/lua/socket.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- LuaSocket helper module 3 | -- Author: Diego Nehab 4 | -- RCS ID: $Id: socket.lua,v 1.22 2005/11/22 08:33:29 diego Exp $ 5 | ----------------------------------------------------------------------------- 6 | 7 | ----------------------------------------------------------------------------- 8 | -- Declare module and import dependencies 9 | ----------------------------------------------------------------------------- 10 | local base = _G 11 | local string = require("string") 12 | local math = require("math") 13 | local socket = require("socket.core") 14 | module("socket") 15 | 16 | ----------------------------------------------------------------------------- 17 | -- Exported auxiliar functions 18 | ----------------------------------------------------------------------------- 19 | function connect(address, port, laddress, lport) 20 | local sock, err = socket.tcp() 21 | if not sock then return nil, err end 22 | if laddress then 23 | local res, err = sock:bind(laddress, lport, -1) 24 | if not res then return nil, err end 25 | end 26 | local res, err = sock:connect(address, port) 27 | if not res then return nil, err end 28 | return sock 29 | end 30 | 31 | function bind(host, port, backlog) 32 | local sock, err = socket.tcp() 33 | if not sock then return nil, err end 34 | sock:setoption("reuseaddr", true) 35 | local res, err = sock:bind(host, port) 36 | if not res then return nil, err end 37 | res, err = sock:listen(backlog) 38 | if not res then return nil, err end 39 | return sock 40 | end 41 | 42 | try = newtry() 43 | 44 | function choose(table) 45 | return function(name, opt1, opt2) 46 | if base.type(name) ~= "string" then 47 | name, opt1, opt2 = "default", name, opt1 48 | end 49 | local f = table[name or "nil"] 50 | if not f then base.error("unknown key (".. base.tostring(name) ..")", 3) 51 | else return f(opt1, opt2) end 52 | end 53 | end 54 | 55 | ----------------------------------------------------------------------------- 56 | -- Socket sources and sinks, conforming to LTN12 57 | ----------------------------------------------------------------------------- 58 | -- create namespaces inside LuaSocket namespace 59 | sourcet = {} 60 | sinkt = {} 61 | 62 | BLOCKSIZE = 2048 63 | 64 | sinkt["close-when-done"] = function(sock) 65 | return base.setmetatable({ 66 | getfd = function() return sock:getfd() end, 67 | dirty = function() return sock:dirty() end 68 | }, { 69 | __call = function(self, chunk, err) 70 | if not chunk then 71 | sock:close() 72 | return 1 73 | else return sock:send(chunk) end 74 | end 75 | }) 76 | end 77 | 78 | sinkt["keep-open"] = function(sock) 79 | return base.setmetatable({ 80 | getfd = function() return sock:getfd() end, 81 | dirty = function() return sock:dirty() end 82 | }, { 83 | __call = function(self, chunk, err) 84 | if chunk then return sock:send(chunk) 85 | else return 1 end 86 | end 87 | }) 88 | end 89 | 90 | sinkt["default"] = sinkt["keep-open"] 91 | 92 | sink = choose(sinkt) 93 | 94 | sourcet["by-length"] = function(sock, length) 95 | return base.setmetatable({ 96 | getfd = function() return sock:getfd() end, 97 | dirty = function() return sock:dirty() end 98 | }, { 99 | __call = function() 100 | if length <= 0 then return nil end 101 | local size = math.min(socket.BLOCKSIZE, length) 102 | local chunk, err = sock:receive(size) 103 | if err then return nil, err end 104 | length = length - string.len(chunk) 105 | return chunk 106 | end 107 | }) 108 | end 109 | 110 | sourcet["until-closed"] = function(sock) 111 | local done 112 | return base.setmetatable({ 113 | getfd = function() return sock:getfd() end, 114 | dirty = function() return sock:dirty() end 115 | }, { 116 | __call = function() 117 | if done then return nil end 118 | local chunk, err, partial = sock:receive(socket.BLOCKSIZE) 119 | if not err then return chunk 120 | elseif err == "closed" then 121 | sock:close() 122 | done = 1 123 | return partial 124 | else return nil, err end 125 | end 126 | }) 127 | end 128 | 129 | 130 | sourcet["default"] = sourcet["until-closed"] 131 | 132 | source = choose(sourcet) 133 | 134 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket Server/lua/socket.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- LuaSocket helper module 3 | -- Author: Diego Nehab 4 | -- RCS ID: $Id: socket.lua,v 1.22 2005/11/22 08:33:29 diego Exp $ 5 | ----------------------------------------------------------------------------- 6 | 7 | ----------------------------------------------------------------------------- 8 | -- Declare module and import dependencies 9 | ----------------------------------------------------------------------------- 10 | local base = _G 11 | local string = require("string") 12 | local math = require("math") 13 | local socket = require("socket.core") 14 | module("socket") 15 | 16 | ----------------------------------------------------------------------------- 17 | -- Exported auxiliar functions 18 | ----------------------------------------------------------------------------- 19 | function connect(address, port, laddress, lport) 20 | local sock, err = socket.tcp() 21 | if not sock then return nil, err end 22 | if laddress then 23 | local res, err = sock:bind(laddress, lport, -1) 24 | if not res then return nil, err end 25 | end 26 | local res, err = sock:connect(address, port) 27 | if not res then return nil, err end 28 | return sock 29 | end 30 | 31 | function bind(host, port, backlog) 32 | local sock, err = socket.tcp() 33 | if not sock then return nil, err end 34 | sock:setoption("reuseaddr", true) 35 | local res, err = sock:bind(host, port) 36 | if not res then return nil, err end 37 | res, err = sock:listen(backlog) 38 | if not res then return nil, err end 39 | return sock 40 | end 41 | 42 | try = newtry() 43 | 44 | function choose(table) 45 | return function(name, opt1, opt2) 46 | if base.type(name) ~= "string" then 47 | name, opt1, opt2 = "default", name, opt1 48 | end 49 | local f = table[name or "nil"] 50 | if not f then base.error("unknown key (".. base.tostring(name) ..")", 3) 51 | else return f(opt1, opt2) end 52 | end 53 | end 54 | 55 | ----------------------------------------------------------------------------- 56 | -- Socket sources and sinks, conforming to LTN12 57 | ----------------------------------------------------------------------------- 58 | -- create namespaces inside LuaSocket namespace 59 | sourcet = {} 60 | sinkt = {} 61 | 62 | BLOCKSIZE = 2048 63 | 64 | sinkt["close-when-done"] = function(sock) 65 | return base.setmetatable({ 66 | getfd = function() return sock:getfd() end, 67 | dirty = function() return sock:dirty() end 68 | }, { 69 | __call = function(self, chunk, err) 70 | if not chunk then 71 | sock:close() 72 | return 1 73 | else return sock:send(chunk) end 74 | end 75 | }) 76 | end 77 | 78 | sinkt["keep-open"] = function(sock) 79 | return base.setmetatable({ 80 | getfd = function() return sock:getfd() end, 81 | dirty = function() return sock:dirty() end 82 | }, { 83 | __call = function(self, chunk, err) 84 | if chunk then return sock:send(chunk) 85 | else return 1 end 86 | end 87 | }) 88 | end 89 | 90 | sinkt["default"] = sinkt["keep-open"] 91 | 92 | sink = choose(sinkt) 93 | 94 | sourcet["by-length"] = function(sock, length) 95 | return base.setmetatable({ 96 | getfd = function() return sock:getfd() end, 97 | dirty = function() return sock:dirty() end 98 | }, { 99 | __call = function() 100 | if length <= 0 then return nil end 101 | local size = math.min(socket.BLOCKSIZE, length) 102 | local chunk, err = sock:receive(size) 103 | if err then return nil, err end 104 | length = length - string.len(chunk) 105 | return chunk 106 | end 107 | }) 108 | end 109 | 110 | sourcet["until-closed"] = function(sock) 111 | local done 112 | return base.setmetatable({ 113 | getfd = function() return sock:getfd() end, 114 | dirty = function() return sock:dirty() end 115 | }, { 116 | __call = function() 117 | if done then return nil end 118 | local chunk, err, partial = sock:receive(socket.BLOCKSIZE) 119 | if not err then return chunk 120 | elseif err == "closed" then 121 | sock:close() 122 | done = 1 123 | return partial 124 | else return nil, err end 125 | end 126 | }) 127 | end 128 | 129 | 130 | sourcet["default"] = sourcet["until-closed"] 131 | 132 | source = choose(sourcet) 133 | 134 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/Socket clientPC/lua/socket.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- LuaSocket helper module 3 | -- Author: Diego Nehab 4 | -- RCS ID: $Id: socket.lua,v 1.22 2005/11/22 08:33:29 diego Exp $ 5 | ----------------------------------------------------------------------------- 6 | 7 | ----------------------------------------------------------------------------- 8 | -- Declare module and import dependencies 9 | ----------------------------------------------------------------------------- 10 | local base = _G 11 | local string = require("string") 12 | local math = require("math") 13 | local socket = require("socket.core") 14 | module("socket") 15 | 16 | ----------------------------------------------------------------------------- 17 | -- Exported auxiliar functions 18 | ----------------------------------------------------------------------------- 19 | function connect(address, port, laddress, lport) 20 | local sock, err = socket.tcp() 21 | if not sock then return nil, err end 22 | if laddress then 23 | local res, err = sock:bind(laddress, lport, -1) 24 | if not res then return nil, err end 25 | end 26 | local res, err = sock:connect(address, port) 27 | if not res then return nil, err end 28 | return sock 29 | end 30 | 31 | function bind(host, port, backlog) 32 | local sock, err = socket.tcp() 33 | if not sock then return nil, err end 34 | sock:setoption("reuseaddr", true) 35 | local res, err = sock:bind(host, port) 36 | if not res then return nil, err end 37 | res, err = sock:listen(backlog) 38 | if not res then return nil, err end 39 | return sock 40 | end 41 | 42 | try = newtry() 43 | 44 | function choose(table) 45 | return function(name, opt1, opt2) 46 | if base.type(name) ~= "string" then 47 | name, opt1, opt2 = "default", name, opt1 48 | end 49 | local f = table[name or "nil"] 50 | if not f then base.error("unknown key (".. base.tostring(name) ..")", 3) 51 | else return f(opt1, opt2) end 52 | end 53 | end 54 | 55 | ----------------------------------------------------------------------------- 56 | -- Socket sources and sinks, conforming to LTN12 57 | ----------------------------------------------------------------------------- 58 | -- create namespaces inside LuaSocket namespace 59 | sourcet = {} 60 | sinkt = {} 61 | 62 | BLOCKSIZE = 2048 63 | 64 | sinkt["close-when-done"] = function(sock) 65 | return base.setmetatable({ 66 | getfd = function() return sock:getfd() end, 67 | dirty = function() return sock:dirty() end 68 | }, { 69 | __call = function(self, chunk, err) 70 | if not chunk then 71 | sock:close() 72 | return 1 73 | else return sock:send(chunk) end 74 | end 75 | }) 76 | end 77 | 78 | sinkt["keep-open"] = function(sock) 79 | return base.setmetatable({ 80 | getfd = function() return sock:getfd() end, 81 | dirty = function() return sock:dirty() end 82 | }, { 83 | __call = function(self, chunk, err) 84 | if chunk then return sock:send(chunk) 85 | else return 1 end 86 | end 87 | }) 88 | end 89 | 90 | sinkt["default"] = sinkt["keep-open"] 91 | 92 | sink = choose(sinkt) 93 | 94 | sourcet["by-length"] = function(sock, length) 95 | return base.setmetatable({ 96 | getfd = function() return sock:getfd() end, 97 | dirty = function() return sock:dirty() end 98 | }, { 99 | __call = function() 100 | if length <= 0 then return nil end 101 | local size = math.min(socket.BLOCKSIZE, length) 102 | local chunk, err = sock:receive(size) 103 | if err then return nil, err end 104 | length = length - string.len(chunk) 105 | return chunk 106 | end 107 | }) 108 | end 109 | 110 | sourcet["until-closed"] = function(sock) 111 | local done 112 | return base.setmetatable({ 113 | getfd = function() return sock:getfd() end, 114 | dirty = function() return sock:dirty() end 115 | }, { 116 | __call = function() 117 | if done then return nil end 118 | local chunk, err, partial = sock:receive(socket.BLOCKSIZE) 119 | if not err then return chunk 120 | elseif err == "closed" then 121 | sock:close() 122 | done = 1 123 | return partial 124 | else return nil, err end 125 | end 126 | }) 127 | end 128 | 129 | 130 | sourcet["default"] = sourcet["until-closed"] 131 | 132 | source = choose(sourcet) 133 | 134 | -------------------------------------------------------------------------------- /菲佣源码/触动API(Python,lua,php)各种脚本语言的版本/TSAPI_lua版本.lua: -------------------------------------------------------------------------------- 1 | TS_API = {} 2 | TS_API.key = CONFIG.TS_KEY 3 | TS_API.ip = CONFIG.TestPhoneIP 4 | 5 | if CONFIG.CustomIDESystem == "win" then 6 | TS_API.savepath = "CustomIDE\\auth" 7 | else 8 | TS_API.savepath = "CustomIDE/auth" 9 | end 10 | 11 | local function APIGET(api,headers) 12 | http.TIMEOUT = 3 13 | local response_body = {} 14 | local rep , code = http.request{ 15 | url = "http://"..TS_API.ip..":50005"..api, 16 | headers = headers , 17 | sink = ltn12.sink.table(response_body), 18 | } 19 | assert(rep,"找不到设备,请正确填写手机IP并保持触动服务开启!") 20 | return response_body 21 | end 22 | 23 | local function APIPOST(api,headers,data) 24 | http.TIMEOUT = 5 25 | local response_body = {} 26 | local rep , code = http.request{ 27 | url = "http://"..TS_API.ip..":50005"..api, 28 | method = "POST", 29 | headers = headers , 30 | source = ltn12.source.string(data), 31 | sink = ltn12.sink.table(response_body), 32 | } 33 | assert(rep,"找不到设备,请正确填写手机IP并保持触动服务开启!") 34 | return response_body 35 | end 36 | 37 | local function SaveAuth(id,auth) 38 | local file = io.open(TS_API.savepath,"w") 39 | if file then 40 | file:write(id.."\n"..os.time().."\n"..auth.."\n"..TS_API.key.."\n"..TS_API.ip.."\n") 41 | file:close(); 42 | end 43 | end 44 | 45 | local function LoadAuth(id) 46 | local file = io.open(TS_API.savepath,"r") 47 | if file then 48 | if file:read("*l") == id then 49 | if os.time()-(tonumber(file:read("*l")) or 0) < 3560 then 50 | TS_API.auth = file:read("*l") 51 | return true 52 | end 53 | end 54 | end 55 | end 56 | 57 | function TS_API:Load() 58 | local file = io.open(TS_API.savepath,"r") 59 | if file then 60 | local id = file:read("*l") 61 | local time = file:read("*l") 62 | self.auth = file:read("*l") 63 | self.key = file:read("*l") 64 | self.ip = file:read("*l") 65 | end 66 | end 67 | 68 | function TS_API:getAuth() 69 | local id = APIGET("/deviceid")[1] 70 | if LoadAuth(id) then return true end 71 | local request = { 72 | action = "getAuth", 73 | key = self.key, 74 | devices = {id}, 75 | valid = 3600, 76 | time = os.time() 77 | } 78 | local data = sz.json.encode(request) 79 | http.TIMEOUT = 5 80 | local response_body = {} 81 | local rep , code = http.request{ 82 | url = CONFIG.TS_APIServer, 83 | headers = {["Content-Length"] = #data}, 84 | source = ltn12.source.string(data), 85 | sink = ltn12.sink.table(response_body), 86 | } 87 | assert(code==200,"获取Auth的服务器无法链接,请检查Server地址是否正确或者联系作者!") 88 | assert(response_body[1]:find("auth"),"开发者KEY错误!") 89 | local auth = sz.json.decode(response_body[1]) 90 | self.auth = auth.auth 91 | SaveAuth(id,self.auth) 92 | end 93 | 94 | function TS_API:upload() 95 | local function up(filetable) 96 | local localfile,path,filename = filetable[1],filetable[2],filetable[3] 97 | local file = io.open(localfile,"rb") 98 | local data = file:read("*all") 99 | file:close() 100 | local headers = { 101 | ["auth"] = self.auth, 102 | ["Host"] = self.ip, 103 | ["root"] = CONFIG.TS_MainPath, 104 | ["path"] = path, 105 | ["filename"] = filename, 106 | ["Connection"] = "close", 107 | ["Content-Type"] = "touchsprite/uploadfile", 108 | ["Content-Length"] = #data, 109 | } 110 | assert (APIPOST("/upload",headers,data)[1] == "ok", "文件: "..filename.."上传失败,请重试") 111 | return true 112 | end 113 | local uploadlist = assert(require "CustomIDE.filelist","获取本地文件失败:您的系统可能不被支持") 114 | for k,v in pairs(uploadlist) do 115 | up(v) 116 | end 117 | end 118 | 119 | 120 | function TS_API:setLuaPath() 121 | local datat = {path="/User/Media/TouchSprite/"..CONFIG.TS_MainPath.."/"..CONFIG.Main_Lua} 122 | local data = sz.json.encode(datat) 123 | local headers = { 124 | ["auth"] = self.auth, 125 | ["Content-Type"] = "application/json", 126 | ["Connection"] = "close", 127 | ["Content-Length"] = #data, 128 | } 129 | assert (APIPOST("/setLuaPath",headers,data)[1] == "ok", "设置运行文件: "..CONFIG.Main_Lua.."失败,请重试") 130 | end 131 | 132 | function TS_API:runLua() 133 | local headers = {["auth"] = self.auth} 134 | if APIGET("/runLua",headers)[1] == "ok" then return true end 135 | local status = APIGET("/status",headers)[1] 136 | assert(status == "f00","远程启动脚本失败,请重试,如有错误弹窗,请手动关闭") 137 | local code = {f00 = "空闲" , f01 = "运行",f02 = "录制"} 138 | assert(nil,"手机处于\""..code[status].."\"状态,请先停止手机运行") 139 | end 140 | 141 | function TS_API:stopLua() 142 | local headers = {["auth"] = self.auth} 143 | if APIGET("/stopLua",headers)[1] == "ok" then return false end 144 | local status = APIGET("/status",headers)[1] 145 | assert(status == "f01","远程关闭脚本失败,请手动关闭") 146 | end 147 | -------------------------------------------------------------------------------- /自定义位置连点器付费版/main.lua: -------------------------------------------------------------------------------- 1 | --自定义位置连点器付费版 2 | require("TSLib") 3 | function movefile(path,to)--帮你玩平台禁用此函数 4 | os.execute("mv "..path.." "..to); 5 | end 6 | 7 | ret1,ret2 = whoAmI() 8 | if ret1 ==0 then 9 | if ret2 == 1 then--标准版 10 | tscd = "标准版" 11 | dialog("您正在使用触动精灵 iOS 标准版,可能会遇到函数库版本过低的错误") 12 | local file = userPath().."/plugin/TSLib.lua" 13 | local bool,kind = isFileExist(file) 14 | if bool then 15 | movefile(file,userPath().."/lua/TSLib.lua") 16 | mSleep(100) 17 | dialog("在插件目录下检测到 TSLib 函数库,需重启脚本进行加载") 18 | luaExit() 19 | end 20 | else 21 | tscd = "专业版" 22 | end 23 | elseif ret1 == 3 then 24 | tscd = "小精灵" 25 | end 26 | 27 | local m = TSVersions() 28 | 29 | if m <= "1.3.0" then 30 | dialog("本地 TSLib 版本过低,请到【更多-文件管理-插件】界面下载最新版") 31 | luaExit() 32 | end 33 | 34 | --移动文件 35 | 36 | function hyStrNum(str) 37 | if str==nil then return 40 end 38 | local strn = nil 39 | for i=1,string.len(str) do 40 | local num=string.sub(str,i,i) 41 | if tonumber(num) then 42 | if strn==nil then 43 | strn=num 44 | else 45 | strn=strn..num 46 | end 47 | end 48 | end 49 | return tonumber(strn) 50 | end 51 | 52 | w,h = getScreenSize(); 53 | if w <= 0 then 54 | w = 720 55 | h = 1080 56 | end 57 | 58 | if getOSType() == "ios" then 59 | auth = deviceIsAuth(); 60 | if auth ~= 0 then 61 | authtext = "已授权" 62 | else 63 | authtext = "未授权" 64 | end 65 | else 66 | authtext = "未知" 67 | end 68 | 69 | UINew("丸子放置游戏连点器","立即运行","立即退出","自定义点击.dat",0,30) 70 | UILabel("触动"..tscd.."授权状态",20,"center","230,50,92") 71 | UILabel(authtext,16,"center","230,50,92") 72 | UILabel("☆☆☆☆☆☆☆☆☆",18,"center","230,219,116") 73 | UILabel("选择点击位置",20,"center","230,50,92") 74 | UIRadio("model","屏幕中心点,自定义位置","0") 75 | UILabel("是否显示准星",20,"center","230,50,92") 76 | UIRadio("wztouch","显示,不显示","0") 77 | UILabel("点击速度设置",20,"center","230,50,92") 78 | UIRadio("speed","50次,40次,30次,10次,5次,自定义每秒点击次数,自定义点击间隔秒数","3") 79 | UILabel("自定义每秒点击次数",20,"center","230,50,92") 80 | UIEdit("speedset","每秒点击次数","30",15,"left","255,0,0","number") 81 | UILabel("自定义点击间隔秒数",20,"center","230,50,92") 82 | UIEdit("timeset","每次点击间隔秒数","1",15,"left","255,0,0","number") 83 | UILabel("使用须知",20,"left","230,50,92") 84 | UILabel("问题反馈请加群:414534539,备注:连点器",16,"left","230,50,92") 85 | UILabel("苹果手机请使用安装专业版最新版本,否则可能会出现函数库版本过低报错",16,"left","230,50,92") 86 | UIShow() 87 | 88 | init(0) 89 | 90 | if speed == "50次" then 91 | ms = 20 92 | elseif speed == "40次" then 93 | ms = 25 94 | elseif speed == "30次" then 95 | ms = 30 96 | elseif speed == "10次" then 97 | ms = 100 98 | elseif speed == "5次" then 99 | ms = 200 100 | elseif speed == "自定义每秒点击次数" then 101 | ms = hyStrNum(speedset) 102 | ms = 1000/ms-10 103 | if ms < 1 then 104 | ms = 30 105 | end 106 | elseif speed == "自定义点击间隔秒数" then 107 | ms = hyStrNum(timeset*1000) 108 | if ms < 1 then 109 | ms = 1 110 | end 111 | end 112 | 113 | function unlock()--防锁屏 114 | flag = deviceIsLock() 115 | if flag ~= 0 then 116 | sysver = getOSVer() 117 | sysint = tonumber(string.sub(sysver, 1, 1)..string.sub(sysver, 2, 2))--转化为数字版本号 118 | if sysint == 10 then 119 | toast("解锁!",1) 120 | pressHomeKey(0) 121 | pressHomeKey(1) 122 | mSleep(500) 123 | unlockDevice() 124 | mSleep(50) 125 | pressHomeKey(0) 126 | pressHomeKey(1) 127 | mSleep(500) 128 | else 129 | unlockDevice() 130 | end 131 | end 132 | end 133 | 134 | if w == 1080 and h == 1920 then 135 | lx0,ly0,rx0,ry0 = 300,220,1070,300 136 | lx,ly,rx,ry = 0,0,1050,70 137 | elseif w == 720 and h == 1280 then 138 | lx0,ly0,rx0,ry0 = 10,120,710,200 139 | lx,ly,rx,ry = 0,0,700,80 140 | elseif w == 640 and h == 1136 then 141 | lx0,ly0,rx0,ry0 = 10,130,630,180 142 | lx,ly,rx,ry = 0,0,620,40 143 | elseif w == 1242 and h == 2208 then 144 | lx0,ly0,rx0,ry0 = 10,200,1232,260 145 | lx,ly,rx,ry = 0,0,1222,60 146 | else 147 | mLog("脚本尚未完全适配您的手机分辨率,不保证运行效果") 148 | mSleep(3000) 149 | end 150 | glSettings({switch = "1001", x1 = lx0, y1 = ly0, x2 = rx0, y2 = ry0,tsp_switch = true}) 151 | if wztouch == "显示" then 152 | tapimg = "wzpoint.png" 153 | mLog("显示准星") 154 | else 155 | tapimg = "不显示准星.png" 156 | mLog("不显示准星") 157 | end 158 | 159 | function auto()--自动模式 160 | while true do 161 | tap(w/2,h/2,ms,tapimg) 162 | unlock() 163 | end 164 | end 165 | 166 | function set()--自定义模式 167 | toast("现在请戳需要重复点击的地方\n 部分手机需要双击", 3);--提示 168 | mSleep(1000); 169 | x,y = catchTouchPoint(); --获取点击坐标 170 | if x ~= -1 and y ~= -1 then 171 | --toast("坐标获取成功~X: "..x..",Y: "..y.."开始疯狂点击咯~",3) 172 | mLog("坐标获取成功~X: "..x..",Y: "..y) 173 | while true do 174 | --tap(x,y,ms) 175 | tap(x,y,ms,tapimg) 176 | unlock() 177 | end 178 | else 179 | dialog("坐标获取失败,脚本即将退出", 2) 180 | mSleep(2000) 181 | lua_restart() 182 | end 183 | end 184 | 185 | function main() 186 | if model == "屏幕中心点" then 187 | mLog("开始点击屏幕中间咯~") 188 | auto() 189 | elseif model == "自定义位置" then 190 | mLog("请跟随引导进行设置~") 191 | set() 192 | end 193 | end 194 | 195 | main() 196 | -------------------------------------------------------------------------------- /触摸UI转化触动.lua: -------------------------------------------------------------------------------- 1 | UI = { 2 | { 'TextView{-请如实填写哦-}' }, 3 | { 'InputBox{}', 'name', '姓名:' }, 4 | { 'DropList{帅哥|美女}', 'sex', '性别:' }, 5 | { 'InputBox{18}', 'age', '年龄:' }, 6 | { 'DropList{是|否}', 'married', '婚否:' }, 7 | } 8 | function TouchtoTouch(...)--触摸UI转化触动UI 9 | local sz=require "sz" 10 | local json=sz.json 11 | local Explist={} 12 | local ComboBoxlist={} 13 | local c_index=1 14 | local index=1 15 | local getindex=1 16 | local w,h=getScreenSize() 17 | local pos=1 18 | MyTable={ --定义空控件页 19 | ["style"] = "default", 20 | ["rettype"] = "table", 21 | ["width"] = w, 22 | ["height"] = h, 23 | ["config"] = "save01.dat", 24 | ["timer"] = 99, 25 | ["orient"] = 0, 26 | ["pagetype"] = "multi", 27 | ["title"] = "触动精灵脚本UI演示", 28 | ["cancelname"] = "取消", 29 | ["okname"] = "开始", 30 | pages={{}} --空控件页 31 | } 32 | function Split(str,symbol,pos) --分割字符串 33 | local pos = pos or 1 34 | local symbol=symbol or "@" 35 | local index = 1 36 | local tmp = {} 37 | while true do 38 | local newpos = string.find(str,symbol,pos) 39 | if not newpos then 40 | tmp[index] = string.sub(str,pos,string.len(str)) 41 | break 42 | end 43 | tmp[index] = string.sub(str,pos,newpos - 1) 44 | pos = newpos + string.len(symbol) 45 | index = index + 1 46 | end 47 | return tmp 48 | end 49 | local function formatTextView(table,i) --格式化触摸TextView为触动Label 50 | local tmp={ 51 | ["type"] = "Label", 52 | ["text"] ="", 53 | ["size"] = 25, 54 | ["align"] = "center", 55 | ["color"] = "0,0,0" 56 | } 57 | local x=string.find(table[1],"{") 58 | local y=string.find(table[1],"}") 59 | local text=string.sub(table[1],x+1,y-1) 60 | tmp["text"]=text 61 | return tmp 62 | end 63 | local function formatInputBox(table,i) --格式化触摸InputBox为触动Lbael+Edit 64 | local tmp1={ 65 | ["type"] = "Label", 66 | ["text"] ="", 67 | ["size"] = 16, 68 | ["align"] = "left", 69 | ["color"] = "0,0,0" 70 | } 71 | local tmp2={ 72 | ["type"] = "Edit", 73 | ["kbtype"] = "default", 74 | ["text"]="" 75 | } 76 | local x=string.find(table[1],"{") 77 | local y=string.find(table[1],"}") 78 | local text=string.sub(table[1],x+1,y-1) 79 | tmp1["text"]=table[3] 80 | tmp2["text"]=text 81 | return tmp1,tmp2 82 | 83 | end 84 | local function formatDropList(table,i) --格式化触摸DropList为触动Label+Combox 85 | local tmp1={ 86 | ["type"] = "Label", 87 | ["text"] ="", 88 | ["size"] = 16, 89 | ["align"] = "left", 90 | ["color"] = "0,0,0" 91 | } 92 | local tmp2= {["type"] = "ComboBox", 93 | ["list"] = "选项1,选项2,选项3", 94 | ["select"] = "1" 95 | } 96 | local x=string.find(table[1],"{") 97 | local y=string.find(table[1],"}") 98 | local text=string.sub(table[1],x+1,y-1) 99 | local tmp3={} 100 | tmp3=Split(text,"|") 101 | list="" 102 | for k=1,#tmp3 do 103 | if k==tmp3 then list=list..tmp3[k] else 104 | list=list..tmp3[k].."," 105 | end 106 | end 107 | ComboBoxlist[c_index]=list 108 | c_index=c_index+1 109 | tmp2["list"]=list 110 | tmp1["text"]=table[3] 111 | return tmp1 ,tmp2 112 | end 113 | for i=1,#UI do -- 第一遍for循环完成UI格式化 114 | if string.sub(UI[i][1],1,1)=="T" then MyTable.pages[1][pos]=formatTextView(UI[i]) pos=pos+1 end 115 | if string.sub(UI[i][1],1,1)=="I" then MyTable.pages[1][pos],MyTable.pages[1][pos+1]=formatInputBox(UI[i]) pos=pos+2 Explist[index]=UI[i][2] index=index+1 end 116 | if string.sub(UI[i][1],1,1)=="D" then MyTable.pages[1][pos],MyTable.pages[1][pos+1]=formatDropList(UI[i]) pos=pos+2 Explist[index]=UI[i][2] Explist[tostring(index)]=true index=index+1 end 117 | end 118 | MyUI={showUI(json.encode(MyTable))} --执行触动UI 119 | for i=2,#MyUI do --第二遍for循环完成处理UI返回值为表,表的key为触摸作者变量名,表的value为触动UI返回值,并处理UI返回值为触摸格式 120 | ui_value=Explist[i-1]--从第一个值开始取,保存当前变量名 121 | Explist[i-1]=nil--删除表中多余值 122 | if Explist[tostring(i-1)] then --有标记,这是个combox 123 | -- toast(1111111111) 124 | local newtmp={} 125 | newtmp=Split(ComboBoxlist[getindex],",") 126 | getindex=getindex+1 127 | Explist[ui_value]=newtmp[MyUI[i]+1] 128 | else Explist[ui_value]=MyUI[i] 129 | end 130 | end 131 | for i,v in pairs(Explist) do --创建全局变量,方便兼容触摸作者 132 | _G[i]=v 133 | end 134 | end 135 | TouchtoTouch() 136 | toast(name,sex,age,married) 137 | -------------------------------------------------------------------------------- /EVE 吉他市场自动刷新/main.lua: -------------------------------------------------------------------------------- 1 | 2 | mP0 = [[ 3 | 2073---微生物 4 | 2267---基础金属 5 | 2268---水基液体 6 | 2270---贵金属 7 | 2272---重金属 8 | 2286---浮游生物群 9 | 2287---复杂有机生命体 10 | 2288---碳化合物 11 | 2305---自养生物 12 | 2306---非立方晶体 13 | 2307---长英矿物岩浆 14 | 2308---悬浮等离子 15 | 2309---离子溶液 16 | 2310---稀有气体 17 | 2311---活性气体]] 18 | 19 | mP1 = [[ 20 | 2389---等离子体团 21 | 2390---电解物 22 | 2392---氧化剂 23 | 2393---细菌 24 | 2395---蛋白质 25 | 2396---生物燃料 26 | 2397---工业纤维 27 | 2398---反应金属 28 | 2399---稀有金属 29 | 2400---有毒金属 30 | 2401---手性结构 31 | 9828---硅 32 | 3683---氧 33 | 3779---生物质 34 | 3645---水]] 35 | 36 | mP2 = [[ 37 | 44---核能燃料 38 | 2312---超张力塑料 39 | 2317---氧化物 40 | 2319---培养基 41 | 2321---聚芳酰胺 42 | 2327---微纤维护盾 43 | 2328---水冷CPU 44 | 2329---生物电池 45 | 2463---纳米体 46 | 3689---机械元件 47 | 3691---合成油 48 | 3693---肥料 49 | 3695---合成纺织品 50 | 3697---硅酸盐玻璃 51 | 3725---家畜 52 | 3775---病原体 53 | 3828---建筑模块 54 | 9830---火箭燃料 55 | 9832---冷却剂 56 | 9836---消费级电器 57 | 9838---超导体 58 | 9840---传信器 59 | 9842---微型电子元件 60 | 15317---基因肉制品]] 61 | 62 | mP3 = [[ 63 | 2344---凝缩液 64 | 2345---监控无人机 65 | 2346---合成神经键 66 | 2348---凝胶基质生物胶 67 | 2349---超级计算机 68 | 2351---灵巧单元建筑模块 69 | 2352---核反应堆 70 | 2354---控制面板 71 | 2358---生物技术研究报告 72 | 2360---工业炸药 73 | 2361---密封薄膜 74 | 2366---危险物探测系统 75 | 2367---冷冻保存防腐剂 76 | 9834---制导系统 77 | 9846---大气内穿梭机 78 | 9848---机器人技术 79 | 12836---透颅微控器 80 | 17136---乌克米超导体 81 | 17392---数据芯片 82 | 17898---高科技传信器 83 | 28974---疫苗]] 84 | 85 | mP4 = [[ 86 | 2867---广播节点 87 | 2868---反破损快速反应无人机 88 | 2869---纳米-工厂 89 | 2870---有机砂浆喷注器 90 | 2871---递推计算模块 91 | 2872---自协调能源核心 92 | 2875---无菌管道 93 | 2876---湿件主机]] 94 | 95 | require("TSLib") 96 | local json = require("sz").json 97 | local w, h = getScreenSize() 98 | local hh = getStatusBarHeight() 99 | 100 | UINew("EVE辅助工具","开始","取消","eve_zdsx.txt",0,10,w,h) 101 | UILabel("--------- 功能设置 ---------",20,"center","0,0,0") 102 | UIRadio("rdo1","P0,P1,P2,P3,P4,自定义","0",-1,0,"",1,2) 103 | UILabel("--------- 自定义设置 ---------",20,"center","0,0,0") 104 | UITextArea("edt1","自定义内容","",15,"left","255,0,0") 105 | UIShow() 106 | 107 | if rdo1 == "P0" then 108 | edt1 = mP0 109 | elseif rdo1 == "P1" then 110 | edt1 = mP1 111 | elseif rdo1 == "P2" then 112 | edt1 = mP2 113 | elseif rdo1 == "P3" then 114 | edt1 = mP3 115 | elseif rdo1 == "P4" then 116 | edt1 = mP4 117 | end 118 | 119 | -- 货币格式转换 1000000 ==> 1,000,000.00 120 | function StrToMoney(num) 121 | local list = {} 122 | local mXiaoshu = ".00" 123 | if string.find(num,"%.") then 124 | mXiaoshu = "." .. string.sub(num,string.find(num,"%.")+1) 125 | num = string.sub(num,1,string.find(num,"%.")-1) 126 | end 127 | local mLen = math.ceil(string.len(num)/3) 128 | local mNum = "" 129 | for var = mLen, 1, -1 do 130 | list[var] = string.sub(num,-3) 131 | num = string.sub(num,0,-4) 132 | end 133 | for var= 1, #list do 134 | mNum = mNum .. "," .. list[var] 135 | end 136 | return string.sub(mNum,2) .. mXiaoshu 137 | end 138 | 139 | if edt1 ~= "" then 140 | local list = strSplit(edt1,"\n") 141 | fwShowWnd("wid",0,0,w-1,h-1,0) 142 | fwShowTextView("wid","bg1","","left","ffffff","eeeeee",10,0,0,0,w-1,h-1-hh,1) 143 | fwShowTextView("wid","bt","EVE吉他市场自动刷新","center","ffffff","000000",15,0,5,5,w-5,50,1) 144 | fwShowButton("wid","sx","刷新","ff0000","333333","",10,w-105,5,w-5,50) 145 | jcw = 55 146 | size = 10 147 | color = "ffffff" 148 | w1 = w*0.2 149 | w2 = w*0.6 150 | 151 | fwShowTextView("wid","text1","物品名称","center",color,"000000",size,0,5,jcw,w1,jcw+(size*3),1) 152 | fwShowTextView("wid","text2","最高收购价","center",color,"000000",size,0,w1+5,jcw,w2,jcw+(size*3),1) 153 | fwShowTextView("wid","text3","最高售卖价","center",color,"000000",size,0,w2+5,jcw,w-5,jcw+(size*3),1) 154 | heihei = 0 155 | function up(...) 156 | jcw = 55 + (size*3) +5 157 | for var= 1, #list do 158 | info = strSplit(list[var],"---") 159 | if #info == 1 then name = info[1] end 160 | if #info >= 2 then name = info[2] end 161 | if #info >= 3 then color = info[3] end 162 | if #info >= 4 then size = info[4] end 163 | 164 | data = json.decode(httpGet("https://www.ceve-market.org/api/market/region/10000002/system/30000142/type/" .. info[1] .. ".json")) 165 | fwShowTextView("wid","text2" .. var," ","right",color,"000000",size,0,w1+5,jcw,w2,jcw+(size*3),1) 166 | fwShowTextView("wid","text3" .. var," ","right",color,"000000",size,0,w2+5,jcw,w-5,jcw+(size*3),1) 167 | mSleep(heihei) 168 | fwShowTextView("wid","text1" .. var," " .. name,"left",color,"000000",size,0,5,jcw,w1,jcw+(size*3),1) 169 | fwShowTextView("wid","text2" .. var,StrToMoney(data.buy.max) .. " ","right",color,"000000",size,0,w1+5,jcw,w2,jcw+(size*3),1) 170 | fwShowTextView("wid","text3" .. var,StrToMoney(data.sell.min) .. " ","right",color,"000000",size,0,w2+5,jcw,w-5,jcw+(size*3),1) 171 | jcw = jcw + (size*3) +5 172 | end 173 | end 174 | up() 175 | time = os.time() 176 | heihei = 100 177 | while (true) do 178 | local vid = fwGetPressedButton() 179 | if vid == "sx" then 180 | if os.time() - time < 3 then 181 | fwShowTextView("wid","bt2","不要频繁刷新!!!","center","ff0000","000000",20,0,0,0,w,h,0.2) 182 | mSleep(1000) 183 | fwCloseView("wid","bt2") 184 | else 185 | up() 186 | time = os.time() 187 | end 188 | end 189 | if os.time() - time >= 10 then 190 | up() 191 | time = os.time() 192 | end 193 | end 194 | 195 | else 196 | dialog("未找到配置信息,脚本结束!") 197 | end 198 | -------------------------------------------------------------------------------- /深海水族馆/main.lua: -------------------------------------------------------------------------------- 1 | --2018-04-01 面板左上角红心白手套位置左移 2 | require "TSLib" 3 | local gamebid = "com.idleif.abyssrium" 4 | init(0) 5 | w,h = getScreenSize() 6 | 7 | if w > h then 8 | dialog("请将模拟器设置为竖屏,建议分辨率:720x1280") 9 | lua_exit() 10 | end 11 | if w == 1080 and h == 1920 then 12 | lx0,ly0,rx0,ry0 = 300,220,1070,300 13 | lx,ly,rx,ry = 0,0,1050,70 14 | elseif w == 720 and h == 1280 then 15 | lx0,ly0,rx0,ry0 = 10,120,710,200 16 | lx,ly,rx,ry = 0,0,700,80 17 | elseif w == 640 and h == 1136 then 18 | lx0,ly0,rx0,ry0 = 10,130,630,180 19 | lx,ly,rx,ry = 0,0,620,40 20 | elseif w == 1242 and h == 2208 then 21 | lx0,ly0,rx0,ry0 = 10,200,1232,260 22 | lx,ly,rx,ry = 0,0,1222,60 23 | else 24 | dialog("脚本尚未完全适配您的手机分辨率,不保证运行效果") 25 | mSleep(3000) 26 | end 27 | glSettings({switch = "1001", x1 = lx0, y1 = ly0, x2 = rx0, y2 = ry0,tsp_switch = false}) 28 | 29 | function hyStrNum(str) 30 | if str==nil then return 40 end 31 | local strn = nil 32 | for i=1,string.len(str) do 33 | local num=string.sub(str,i,i) 34 | if tonumber(num) then 35 | if strn==nil then 36 | strn=num 37 | else 38 | strn=strn..num 39 | end 40 | end 41 | end 42 | return tonumber(strn) 43 | end 44 | 45 | function upgrade(... ) --升级 46 | if multiColTap( ... ) then 47 | sign_upgrade = 1 48 | end 49 | end 50 | 51 | function unlock()--防锁屏 52 | flag = deviceIsLock() 53 | if flag ~= 0 then 54 | sysver = getOSVer() 55 | sysint = tonumber(string.sub(sysver, 1, 1)..string.sub(sysver, 2, 2))--转化为数字版本号 56 | if sysint == 10 then 57 | toast("解锁!",1) 58 | pressHomeKey(0) 59 | pressHomeKey(1) 60 | mSleep(500) 61 | unlockDevice() 62 | mSleep(50) 63 | pressHomeKey(0) 64 | pressHomeKey(1) 65 | mSleep(500) 66 | else 67 | unlockDevice() 68 | end 69 | end 70 | end 71 | 72 | function gamestart() 73 | runApp(gamebid) 74 | mSleep(3000) 75 | end 76 | 77 | UINew("深海水族馆挂机辅助","立即运行","立即退出","shszg.dat",0,30) 78 | UILabel("活动期间请勿使用和糖果颜色接近主题,以便提高收集效率!!!",24,"center","255,100,100") 79 | UILabel("收集设置",20,"center","230,50,92") 80 | UIRadio("bubble","日常红心,活动物品","0") 81 | UILabel("基础功能",20,"center","230,50,92") 82 | UICheck("basic1,basic2","自动点击,自动收集","0@1") 83 | UILabel("点击速度设置",20,"center","230,50,92") 84 | UIRadio("step","iPhone 6+,iPhone 5 或安卓旗舰,低配千元安卓机,选这个保证不卡,自定义速度","3") 85 | UILabel("自定义速度设置",20,"center","230,50,92") 86 | UIEdit("speedset","每秒点击次数","30",15,"left","255,0,0","number") 87 | UILabel("是否显示准星",20,"center","230,50,92") 88 | UIRadio("wztouch","显示,不显示","0") 89 | UILabel("珊瑚设置",20,"center","230,50,92") 90 | UIRadio("shanhu","孤独的珊瑚石,小珊瑚石","0") 91 | UILabel("显示设置",20,"center","230,50,92") 92 | UIRadio("case","全屏不显示菜单,石头界面,扩张界面","0") 93 | UILabel("功能设置",20,"center","230,50,92") 94 | UICheck("func1,func2,func3","升级石头,使用技能,收割农场","0@1") 95 | UILabel("使用须知",20,"left","230,50,92") 96 | UILabel("★ 加速为技能冷却、广告冷却、农场产出时间加速",16,"left","230,50,92") 97 | UILabel("★ 请将体积较大的鱼收起以便更容易找到红心。",16,"left","230,50,92") 98 | UILabel("★ 每秒点击次数最好不要超过40次,否则游戏会卡死",16,"left","230,50,92") 99 | UILabel("★ 活动期间建议使用全屏模式,半屏会导致有些鱼飘到上面去找不到",16,"left","230,50,92") 100 | UILabel("★ 活动期间建议使用活动范围在珊瑚石周围的鱼比如小丑鱼",16,"left","230,50,92") 101 | UILabel("★ 活动期间建议使用与活动物品色差较大的主题皮肤,否则会严重影响找色",16,"left","230,50,92") 102 | UILabel("★游戏攻略、问题反馈请加群:414534539",16,"left","230,50,92") 103 | UIShow() 104 | 105 | if shanhu == "孤独的珊瑚石" then 106 | nLog("孤独的珊瑚石") 107 | shanhushi = 0 108 | elseif shanhu == "小珊瑚石" then 109 | nLog("小珊瑚石") 110 | shanhushi = 1 111 | end 112 | 113 | 114 | if step == "iPhone 6+" then 115 | tapms = 15 116 | elseif step == "iPhone 5 或安卓旗舰" then 117 | tapms = 23 118 | elseif step == "低配千元安卓机" then 119 | tapms = 40 120 | elseif step == "选这个保证不卡" then 121 | tapms = 190 122 | elseif step == "自定义速度" then 123 | tapms = hyStrNum(speedset) 124 | tapms = 1000/tapms-10 125 | if tapms < 1 then 126 | tapms = 30 127 | end 128 | mSleep(2000) 129 | else 130 | tapms = 30 131 | end 132 | 133 | if basic2 == "自动收集" then 134 | if bubble == "日常红心" then 135 | seconds = 5 136 | elseif bubble == "活动物品" then 137 | seconds = 2 138 | end 139 | else 140 | seconds = 2 141 | end 142 | 143 | if case == "石头界面" or "扩张界面" then 144 | fh = h*0.38 145 | elseif case == "全屏不显示菜单" then 146 | fh = h*0.8 147 | end 148 | 149 | if wztouch == "显示" then 150 | tapimg = "wzpoint.png" 151 | mLog("显示准星") 152 | else 153 | tapimg = "不显示准星.png" 154 | mLog("不显示准星") 155 | end 156 | 157 | if w == 640 and h == 1136 then 158 | require "5c" 159 | elseif w == 1536 and h == 2048 then 160 | require "ipadhd" 161 | elseif w == 750 and h == 1334 then 162 | require "6s" 163 | elseif w == 1242 and h == 2208 then 164 | require "6P" 165 | elseif w == 720 and h == 1280 then 166 | require "720p" 167 | elseif w == 1080 and h == 1920 then 168 | require "1080p" 169 | else 170 | setScreenScale(true, 720, 1280) 171 | require "720p" 172 | setScreenScale(false) 173 | end 174 | 175 | while (true) do 176 | unlock() 177 | if frontAppBid() == gamebid then 178 | if basic1 == "自动点击" then 179 | local t1 = os.time() 180 | if adtime ~= 1 then 181 | while (true) do 182 | tap(w/3,h/3,tapms,tapimg) 183 | mSleep(tapms) 184 | if os.time() - t1 >= seconds then 185 | break 186 | end 187 | end 188 | end 189 | end 190 | daily()--日常弹窗检测 191 | if basic2 == "自动收集" then 192 | if bubble == "日常红心" then 193 | collect() 194 | elseif bubble == "活动物品" then 195 | festival() 196 | end 197 | end 198 | if case == "石头界面" then 199 | menu() 200 | elseif case == "扩张界面" then 201 | expand() 202 | elseif case == "全屏不显示菜单" then 203 | shutmenu() 204 | end 205 | if func1 == "升级石头" then 206 | stoneup() 207 | end 208 | if func2 == "使用技能" then 209 | stoneskill() 210 | end 211 | if func3 == "收割农场" then 212 | farm() 213 | end 214 | else 215 | gamestart() 216 | end 217 | end 218 | -------------------------------------------------------------------------------- /海盗来了/1080p.lua: -------------------------------------------------------------------------------- 1 | function daily() 2 | multiColTap({{ 768, 655, 0x65d926},{ 845, 664, 0x65d926},{ 764, 315, 0x8c4a1d},{ 901, 320, 0x8c4a1d},})--消息领取 3 | multiColTap({{ 676, 273, 0xd27400},{ 321, 328, 0xd27400},{ 538, 1803, 0xdb2421},{ 550, 1780, 0xffffff},{ 530, 1759, 0xffffff},{ 529, 1780, 0xffffff},})--关闭消息 4 | multiColTap({{ 892, 552, 0xfb5b24},{ 851, 588, 0xf73b2c},{ 890, 622, 0xdc2421},{ 908, 608, 0xffffff},{ 872, 568, 0xffffff},{ 891, 586, 0xffffff},})--超值礼包 5 | multiColTap({{ 465, 772, 0xf9ed6b},{ 579, 756, 0xf9ed6b},{ 579, 784, 0xf9ed6b},{ 478, 1588, 0x97f646},{ 492, 1628, 0x65d926},{ 548, 1637, 0x65d926},})--获得碎片确认 6 | end 7 | 8 | function go() 9 | if gem == "剩余2/3" then 10 | if multiColor({{ 606, 1450, 0x3dd7fd},{ 607, 1457, 0x1cc3fd},{ 426, 1809, 0xba2515},{ 513, 1660, 0xffffff},{ 568, 1666, 0xffffff},}) then 11 | tap(568, 1666) 12 | mSleep(5000) 13 | end 14 | elseif gem == "剩一半" then 15 | if multiColor({{ 535, 1437, 0x6bedff},{ 543, 1464, 0x07b5fb},{ 426, 1809, 0xba2515},{ 513, 1660, 0xffffff},{ 568, 1666, 0xffffff},}) then 16 | tap(568, 1666) 17 | mSleep(5000) 18 | end 19 | elseif gem == "全用完" then 20 | if multiColor({{ 355, 1449, 0x44dafd},{ 355, 1453, 0x37d3fd},{ 426, 1809, 0xba2515},{ 513, 1660, 0xffffff},{ 568, 1666, 0xffffff},}) then 21 | tap(568, 1666) 22 | mSleep(5000) 23 | end 24 | end 25 | if multiColor({{ 394, 1869, 0xddd3bc},{ 470, 1836, 0xddd3bc},{ 620, 1836, 0xddd3bc},{ 687, 1871, 0xddd3bc},})then--攻击界面 26 | x,y = findMultiColorInRegionFuzzy( 0xffffff, "-17|-6|0x89ebf6,-11|3|0xffffff,19|5|0xffffff,25|-1|0x62d1e5,-7|27|0x62d1e5,-20|18|0xffffff,-17|42|0xffffff,-6|42|0x62d1e5,1|34|0x62d1e5", 90, 120, 813, 1035, 1582)--主建筑 27 | if x ~= -1 then 28 | tap(x,y) 29 | toast("攻击主建筑!") 30 | else 31 | x,y = findMultiColorInRegionFuzzy( 0x8becf6, "19|11|0xffffff,11|24|0xffffff,3|20|0xffffff,-7|36|0xffffff,32|27|0xffffff,55|26|0x62d1e5,20|46|0x62d1e5,19|33|0xffffff", 90, 120, 813, 1035, 1582)--背景 32 | if x ~= -1 then 33 | tap(x,y) 34 | toast("攻击风景!") 35 | else 36 | x,y = findMultiColorInRegionFuzzy( 0x87eaf6, "37|-14|0x62d1e5,44|-8|0xffffff,30|44|0xffffff,41|45|0x62d1e5,21|55|0x62d1e5,9|27|0x62d1e5,1|35|0x62d1e5,18|14|0xffffff,25|27|0x64d2e5", 90, 120, 813, 1035, 1582)--雕塑 37 | if x ~= -1 then 38 | tap(x,y) 39 | toast("攻击雕塑!") 40 | else 41 | x,y = findMultiColorInRegionFuzzy( 0x8becf6, "0|16|0xffffff,16|18|0x62d1e5,33|7|0xffffff,34|17|0x62d1e5,37|42|0xffffff,23|48|0x62d1e5,23|37|0xffffff", 90, 126, 856, 1052, 1710)--宠物 42 | if x ~= -1 then 43 | tap(x,y) 44 | toast("攻击宠物!") 45 | else 46 | x,y = findMultiColorInRegionFuzzy( 0x8aebf6, "32|2|0xffffff,35|-9|0x62d1e5,42|9|0x62d1e5,27|28|0x62d1e5,22|34|0xffffff,-6|32|0xffffff,45|41|0xffffff,54|25|0xffffff", 90, 126, 856, 1052, 1710)--船舶 47 | if x ~= -1 then 48 | tap(x,y) 49 | toast("攻击船舶!") 50 | end 51 | end 52 | end 53 | end 54 | end 55 | end 56 | multiColTap({{ 824, 1714, 0xf1ecdc},{ 851, 1759, 0xa0f845},{ 854, 1803, 0x65d926},{ 920, 1818, 0x64d925},})--建筑摧毁确认 57 | if gold == "选1号" then 58 | multiColTap({{ 651, 658, 0xffe101},{ 652, 703, 0xffc800},{ 272, 1125, 0xffffff},{ 261, 1142, 0x62d1e5},{ 261, 1154, 0x62d1e5},{ 285, 1157, 0x62d1e5},{ 271, 1143, 0xffffff},})--土豪1 59 | elseif gold == "选2号" then 60 | multiColTap({{ 651, 658, 0xffe101},{ 652, 703, 0xffc800},{ 563, 1565, 0x62d1e5},{ 563, 1551, 0xffffff},{ 586, 1556, 0xffffff},{ 566, 1586, 0xffffff},{ 590, 1586, 0xffffff},})--土豪2 61 | elseif gold == "选3号" then 62 | multiColTap({{ 651, 658, 0xffe101},{ 652, 703, 0xffc800},{ 789, 1130, 0xffffff},{ 783, 1141, 0x62d1e5},{ 798, 1142, 0xffffff},{ 772, 1147, 0xffffff},})--土豪3 63 | end 64 | end 65 | 66 | function reward() 67 | if multiColor({{ 46, 355, 0xff4e31},{ 44, 399, 0xff4e31},{ 1007, 286, 0x65d926},{ 1042, 284, 0x65d926},}) then--主界面 68 | if dailyreward ~= 0 then 69 | multiColTap({{ 956, 394, 0x5280d4},{ 970, 385, 0x5280d4},{ 1003, 407, 0x5280d4},{ 1008, 361, 0xfe0302},{ 1015, 357, 0xff0302},{ 1013, 371, 0xfe0302},})--浏览器红点 70 | multiColTap({{ 971, 561, 0xf4e3b5},{ 985, 560, 0xf4e3b5},{ 993, 558, 0xf6e3b8},{ 1010, 527, 0xfd0704},{ 1016, 527, 0xfe0302},{ 1016, 533, 0xfe0302},})--每日登陆红点 71 | multiColTap({{ 438, 371, 0xffffff},{ 520, 343, 0xffffff},{ 570, 354, 0xffffff},{ 394, 354, 0xd27400},{ 490, 1669, 0x9cf746},{ 491, 1725, 0x65d926},{ 549, 1733, 0x65d926},})--领取奖励 72 | multiColTap({{ 882, 350, 0xd27400},{ 887, 307, 0xd27400},{ 935, 319, 0xffffff},{ 977, 363, 0xffffff},{ 934, 362, 0xffffff},})--关闭每日登陆界面 73 | if multiColor({{ 989, 405, 0xfaf793},{ 964, 419, 0x992e14},{ 1009, 526, 0xfe0302},{ 1016, 530, 0xfa140c},}) == false then 74 | dailyreward = 0 75 | toast("每日登陆奖励已领取!",1) 76 | end 77 | end 78 | end 79 | end 80 | 81 | function building() 82 | if multiColor({{ 1003, 281, 0x65d926},{ 1023, 265, 0xffffff},{ 135, 391, 0xff4e31},{ 924, 1485, 0xdd895a},{ 986, 1478, 0xfe0402},{ 993, 1481, 0xfd0c07},}) then --进入建筑界面 83 | island = 1 84 | tap( 993, 1481) 85 | end 86 | multiColTap({{ 83, 232, 0xff4e31},{ 593, 164, 0x65d926},{ 605, 153, 0xffffff},{ 298, 993, 0x79829d},{ 259, 1040, 0xde8765},{ 396, 1021, 0x808eb5},{ 355, 1039, 0xffffff},})--锤子按钮C 87 | if multiColor({{ 228, 216, 0xd27400},{ 420, 214, 0xd27400},{ 305, 1087, 0xfaf6eb},{ 288, 1086, 0xfaf6eb},}) then--建造岛屿界面C 88 | local x,y = findMultiColorInRegionFuzzy( 0xfaf6eb, "1|4|0xffaa01,1|10|0xfaf6eb,1|16|0xffaa00,1|20|0xfaf6eb", 75, 68, 385, 593, 1066)--建造 89 | if x ~= -1 then 90 | tap(x,y-70) 91 | mSleep(500) 92 | else 93 | toast("没有可以升级的建筑",1) 94 | island = 0 95 | tap( 565, 214) 96 | mSleep(500) 97 | multiColTap({{ 84, 868, 0xfee6c4},{ 107, 884, 0xfee6c4},{ 91, 904, 0xf4a966},{ 82, 881, 0xfaf7c9},})--回到抽奖界面 98 | end 99 | end 100 | end 101 | -------------------------------------------------------------------------------- /菲佣源码/中控进阶模板/client for phone.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------- 2 | ------------中控纯lua版,随便做着玩玩------------ 3 | ------------有能力的同学请自行修改----------- 4 | ---------------------------------------------------- 5 | ------------版权所无,敬请复制-------------- 6 | ------------您可以随意使用代码-------------- 7 | ---------------------------------------------------- 8 | ------------脚本制作人:菲佣---------------- 9 | ------------创建时间:2016-1-19------------ 10 | ---------------------------------------------------- 11 | local sz = require("sz") 12 | local json = sz.json 13 | 14 | local command = { 15 | getinfo = true, 16 | save = true , 17 | back = true , 18 | inquiry = true, 19 | control = true , 20 | } 21 | local errorcode = { 22 | [101] = "Invalid command" , 23 | [102] = "validate fail" , 24 | 25 | } 26 | --克隆表格 27 | function CloneTab(tab) 28 | if type(tab) ~= "table" then return tab end 29 | local function _dump(t) 30 | local cl = {} 31 | for k, v in pairs(t) do 32 | if type (k) == "userdata" then 33 | k = tostring(k):sub(14,22) 34 | end 35 | if type(v) == "table" then 36 | cl[k] = _dump(v) 37 | elseif type(v) == "string" or type(v) == "number" then 38 | cl[k] = v 39 | end 40 | end 41 | return cl 42 | end 43 | return _dump(tab) 44 | end 45 | --Json转换,输入的是表,则返回json,输入json,则返回表 46 | local function jsoncov(j) 47 | if type(j) == "table" and next(j) ~= nil then 48 | local j = CloneTab(j) 49 | local tojson = json.encode(j) 50 | return tojson 51 | elseif type(j) == "string" and #j >0 then 52 | local totable = json.decode(j) 53 | if type(totable) ~= "table" then return {command="error"} end 54 | --解决json模块的数组和哈希共存 55 | local r = {} 56 | for k,v in pairs (totable) do 57 | if tonumber(k) then 58 | r[tonumber(k)] = v 59 | else 60 | r[k] = v 61 | end 62 | end 63 | return r 64 | else 65 | return {command=nil} 66 | end 67 | end 68 | local _class={} 69 | function class(super) 70 | local class_type={} 71 | class_type.ctor=false 72 | class_type.super=super 73 | class_type.new=function(...) 74 | local obj={} 75 | do 76 | local create 77 | create = function(c,...) 78 | if c.super then 79 | create(c.super,...) 80 | end 81 | if c.ctor then 82 | c.ctor(obj,...) 83 | end 84 | end 85 | create(class_type,...) 86 | end 87 | setmetatable(obj,{ __index = _class[class_type] }) 88 | return obj 89 | end 90 | local vtbl={} 91 | _class[class_type]=vtbl 92 | 93 | setmetatable(class_type,{__newindex= 94 | function(t,k,v) 95 | vtbl[k]=v 96 | end 97 | }) 98 | if super then 99 | setmetatable(vtbl,{__index= 100 | function(t,k) 101 | local ret=_class[super][k] 102 | vtbl[k]=ret 103 | return ret 104 | end 105 | }) 106 | end 107 | return class_type 108 | end 109 | 110 | client = class() 111 | function client:ctor(host,port,timeout) 112 | self.host = host 113 | self.port = port or 12345 114 | self.timeout = timeout or 0 115 | end 116 | function client:conn() 117 | self.sock = assert(socket.connect(self.host, self.port)) 118 | self.sock:settimeout(self.timeout) 119 | end 120 | function client:send(t) 121 | local j = jsoncov(t) 122 | assert(self.sock:send(j.."\n")) 123 | end 124 | function client:recvt() 125 | while 1 do 126 | local response, receive_status = self.sock:receive() 127 | if receive_status ~= "closed" then 128 | if response then 129 | nLog(response) 130 | return json.decode(response) 131 | end 132 | else 133 | break 134 | end 135 | end 136 | end 137 | function client:validate() 138 | local zc = { command = "validate", 139 | info = { 140 | os_type = "IOS", --返回设备的系统类型 iOS、android 141 | type = "Ihpone", --设备类型 0 == iPod Touch;1 == iPhone;2 == iPad 142 | tsid = 6, --触动设备号 143 | versionts = "2.2.6", --触动版本号 144 | versionos = "8.3", --系统版本号 145 | tsp = "lua", --脚本运行状态 146 | }, 147 | sprite = "test1", 148 | usertype = "control", 149 | } 150 | self:send(zc) 151 | self:recvt() 152 | end 153 | function client:getinfo() 154 | local cx = {command="getinfo",select={"allconn"}} 155 | self:send(cx) 156 | return self:recvt() 157 | end 158 | FYctrl = client.new("192.168.10.23",12345,10) 159 | FYctrl:conn() 160 | FYctrl:validate() 161 | local si = FYctrl:getinfo() 162 | local sm = jsoncov(si.message) 163 | MyTable = { 164 | ["style"] = "default", 165 | ["orient"] = 1, 166 | ["width"] = ({getScreenSize()})[2], 167 | ["height"] = ({getScreenSize()})[1], 168 | ["config"] = "config.dat", 169 | ["pagetype"] = "multi", 170 | ["cancelname"] = "取消", 171 | ["okname"] = "确定", 172 | ["timer"] = 200, 173 | pages = {{}}, 174 | } 175 | local i = 1 176 | for k,v in pairs(sm) do 177 | MyTable.pages[1][i] = {} 178 | MyTable.pages[1][i].type = "CheckBoxGroup" 179 | MyTable.pages[1][i].size = "12" 180 | MyTable.pages[1][i].align = "left" 181 | MyTable.pages[1][i].color = "0,0,255" 182 | MyTable.pages[1][i].list = v.name.." "..v.conntime.." "..v.info.tsid.." "..v.user.date 183 | i = i + 1 184 | end 185 | local MyJsonString = json.encode(MyTable); 186 | retTable = {showUI(MyJsonString)}; 187 | for var = 1,#retTable do 188 | nLog(retTable[var]) --输出每一个返回值 189 | end 190 | -------------------------------------------------------------------------------- /菲佣源码/触动API(Python,lua,php)各种脚本语言的版本/TSAPI_python版.py: -------------------------------------------------------------------------------- 1 | # coding:utf8 2 | import httplib 3 | import time 4 | import json 5 | import socket 6 | 7 | 8 | def Broadcast(): 9 | host = socket.gethostbyname(socket.gethostname()) 10 | port = 1234 11 | senddata = '{\"ip\":\"' + host + '\",\"port\":' + str(port) + '}' 12 | sendaddress = (host[:host.rfind('.') + 1] + '255', 14099) 13 | conn = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 14 | conn.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 15 | conn.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) 16 | conn.bind((host, port)) 17 | conn.settimeout(0.1) 18 | devices = [] 19 | for i in range(1, 50): 20 | try: 21 | conn.sendto(senddata, sendaddress) 22 | message, address = conn.recvfrom(port) 23 | if message: 24 | insert = json.loads(message) 25 | if not (insert in devices): 26 | devices.append(insert) 27 | except: 28 | print('timeout') 29 | # print devices 30 | return devices 31 | 32 | 33 | class Device: 34 | def __init__(self, ip, deviceid=False): 35 | self.host = ip 36 | self.port = 50005 37 | self.key = "4JQktNt6SoXSa8i4segm7Nw9i3kQMF2r" + \ 38 | "LHRHtpyWAjde1RxVDvt1Z8rdpgMKDnw1" 39 | # self.osType = device['osType'] 40 | # self.tsversion = device['tsversion'] 41 | self.deviceid = deviceid 42 | self.auth = False 43 | self.valid = 0 44 | 45 | def getAuth(self): 46 | self.getdeviceid() 47 | if not self.deviceid: 48 | print 'Not Device' 49 | self.auth = False 50 | return False 51 | if self.auth and self.valid > time.time(): 52 | return True 53 | valid = 3600 54 | headers = {} 55 | data = { 56 | "action": "getAuth", 57 | "key": self.key, 58 | "devices": [self.deviceid], 59 | "valid": valid, 60 | "time": int(time.time()) 61 | } 62 | encode = json.dumps(data) 63 | host = 'storeauth.touchsprite.net' 64 | url = '/api/openapi' 65 | conn = httplib.HTTPSConnection(host, timeout=3) 66 | try: 67 | conn.request('POST', url, encode, headers) 68 | res = json.loads(conn.getresponse().read()) 69 | self.auth = res['auth'] 70 | self.valid = time.time() + valid 71 | return True 72 | except: 73 | return False 74 | 75 | def getdeviceid(self): 76 | url = '/deviceid' 77 | conn = httplib.HTTPConnection(self.host, self.port, timeout=2) 78 | headerdata = { 79 | 'Connection': 'close', 80 | 'Content - Length': 0 81 | } 82 | try: 83 | conn.request(method="GET", url=url, headers=headerdata) 84 | self.deviceid = conn.getresponse().read() 85 | except: 86 | self.deviceid = False 87 | return False 88 | 89 | def getdevicename(self): 90 | url = '/devicename' 91 | conn = httplib.HTTPConnection(self.host, self.port, timeout=2) 92 | headerdata = { 93 | 'Connection': 'close', 94 | 'Content - Length': 0 95 | } 96 | try: 97 | conn.request(method="GET", url=url, headers=headerdata) 98 | self.devicename = conn.getresponse().read() 99 | except: 100 | self.deviceid = False 101 | return False 102 | 103 | def snapshot_png(self, filename, orient = "0"): 104 | if not self.getAuth(): 105 | return False 106 | url = '/snapshot?ext=png&orient=' + orient 107 | conn = httplib.HTTPConnection(self.host, self.port, timeout=3) 108 | headerdata = { 109 | 'auth': self.auth, 110 | 'Host': self.host 111 | } 112 | try: 113 | conn.request(method="GET", url=url, headers=headerdata) 114 | fileHandle = open(filename, 'wb') 115 | fileHandle.write(conn.getresponse().read()) 116 | fileHandle.close() 117 | except: 118 | return False 119 | 120 | def status(self): 121 | if not self.getAuth(): 122 | return False 123 | url = '/status' 124 | conn = httplib.HTTPConnection(self.host, self.port, timeout=2) 125 | headerdata = { 126 | 'auth': self.auth 127 | } 128 | try: 129 | conn.request(method="GET", url=url, headers=headerdata) 130 | return conn.getresponse().read() 131 | except: 132 | return False 133 | 134 | def getFileList(self, root=["lua", "res", "log", "plugin"], path="/"): 135 | if not self.getAuth(): 136 | return False 137 | url = '/getFileList' 138 | re = [] 139 | conn = httplib.HTTPConnection(self.host, self.port, timeout=2) 140 | for i in range(0, 3): 141 | headerdata = { 142 | 'auth': self.auth, 143 | 'Root': root[i], 144 | 'Path': path 145 | } 146 | try: 147 | conn.request(method="GET", url=url, headers=headerdata) 148 | re.append(conn.getresponse().read()) 149 | except: 150 | print 'timeout' 151 | return re 152 | 153 | def getFile(self, file, root="lua", path="/"): 154 | if not self.getAuth(): 155 | return False 156 | url = '/getFile' 157 | conn = httplib.HTTPConnection(self.host, self.port, timeout=2) 158 | headerdata = { 159 | 'auth': self.auth, 160 | 'Root': root, 161 | 'Path': path, 162 | 'Host': self.host, 163 | 'file': file, 164 | 'Connection': 'close' 165 | } 166 | try: 167 | conn.request(method="GET", url=url, headers=headerdata) 168 | conn.getresponse().read() 169 | except: 170 | print 'timeout' 171 | 172 | # phone = Device("192.168.10.20") 173 | # phone.getAuth() 174 | # print phone.snapshot_png("0") 175 | -------------------------------------------------------------------------------- /菲佣源码/8-Mapping.lua: -------------------------------------------------------------------------------- 1 | --映入Page模块,作为页面自身的动作,不在重复逻辑的使用base,不好界定base到底是什么 2 | require "Page" 3 | --建立游戏逻辑的索引模块 4 | Mapping = {} 5 | --以下是索引模块的各项参数的默认值,每个新建的索引可以单独设置 6 | Mapping.timeout = 20 --出错超时时间 7 | Mapping.repeattimes = 20 --判断出错重复页面的次数 8 | Mapping.snapshot = true --出错后截图 9 | Mapping.checkout = false --出错后运行程序 10 | Mapping.errorrepeat = 1 --出错后运行程序的次数 11 | Mapping.defaultfuzzy = 90 --默认检查函数的相似度 12 | Mapping.defaultoffset = 5 --默认随机点击的偏移量为5个像素点 13 | --Mapping.errorlog = true --错误日志是否开启,等写完save模块,有了存储的功能,再写进去,现在不单独写了 14 | 15 | --建立参数的简写方法,也可全拼写入 16 | Mapping.parcase = { 17 | [1] = "pagename", --页面名字 18 | [2] = "check_par", --检查函数的参数 19 | [3] = "action_par", --动作函数的参数 20 | [4] = "ending" --动作结束后运行的函数 21 | [5] = "ending_par" --动作结束后运行的参数 22 | ["c"] = "check", --检查函数 23 | ["cp"] = "check_par" --检查函数的参数 24 | ["co"] = "chechout" --检查是否存在的的参数,默认是检查到点后执行动作,这个参数改成true后,是检查不到点才执行动作 25 | ["a"] = "action", --动作函数 26 | ["ap"] = "action_par" --动作函数的参数 27 | ["e"] = "ending" --动作结束后函数 28 | ["ep"] = "ending_par" --动作结束后函数的参数 29 | } 30 | --新建一个索引,name为可选参数,为上级索引的名字 31 | function Mapping:new(name) 32 | local index = {} 33 | index.page = {} 34 | --索引函数的默认方法 35 | index.basefn = Page 36 | --索引列表的上级 37 | index.prev = name or false 38 | setmetatable(index,{__index = self}) 39 | return index 40 | end 41 | --增加索引的页面方法如下 x指x坐标,y指y坐标,c指颜色 42 | --xxx:AddPages{ 43 | -- 检查x,y点坐标是否为c的颜色,是的话,点击x,y 44 | -- {"页面名字",{x,y,c}}, 45 | -- 检查x1,y1点坐标是否为c的颜色,是的话,点击x2,y2 46 | -- {"页面名字",{x1,y1,c},{x2,y2}} 47 | -- 检查x1,y1点坐标是否为c的颜色,是的话,点击x2,y2,并在点击后结束这个索引 48 | -- {"页面名字",{x1,y1,c},{x2,y2},"finish"} 49 | -- 同上,最后的save为save模块,让存档中某个值+1 50 | -- {"页面名字",{x1,y1,c},{x2,y2},"save",{"测试","add",1}} 51 | -- 检查x1,y1点坐标是否为不是c的颜色,然后点击x2,y2,并在点击后结束这个索引 52 | -- {"页面名字",{x1,y1,c},{x2,y3},e = "finish" , checkout = true} 53 | -- 使用Base模块中的other方法检查页面,是的话,使用Base模块中的move方法,移动页面 54 | -- {"页面名字",{x1,y1,c},{x2,y2,x3,y3},c = Base.other , a = Base.move} 55 | -- ...... 56 | -- } 57 | function Mapping:AddPages( ... ) 58 | for i , page in ipairs({ ... }) do 59 | for key,value in pairs(page) do 60 | if self.parcase[key] == "ending" then 61 | if type(value) == "string" then 62 | self.pages[i][self.parcase[key]] = self.basefn[value] 63 | else 64 | self.pages[i][self.parcase[key]] = value 65 | end 66 | else 67 | self.pages[i][self.parcase[key]] = value 68 | end 69 | end 70 | self.pages[i]["pagename"] = self.pages[i]["pagename"] or "" 71 | self.pages[i]["check"] = self.pages[i]["check"] or self.basefn.check 72 | self.pages[i]["checkout"] = false 73 | self.pages[i]["check_par"] = self.pages[i]["check_par"] or false 74 | self.pages[i]["action_par"] = self.pages[i]["action_par"] or false 75 | self.pages[i]["ending_par"] = self.pages[i]["ending_par"] or false 76 | if self.pages[i]["action_par"] then 77 | self.pages[i]["action"] = self.pages[i]["action"] or self.basefn.click 78 | end 79 | self.pages[i]["defaultfuzzy"] = self.defaultfuzzy 80 | self.pages[i]["defaultoffset"] = self.defaultoffset 81 | end 82 | end 83 | --[[检查异常页面,重复同样页面(或者找不到页面,或者两张相同页面交替重复出现)20次以上(Mapping.repeattimes控制), 84 | 并且时间超过20秒(Mapping.timeout控制),则认为异常,异常是,以页面名字+时间命名进行全屏截图(Mapping.snapshot控制), 85 | 并且定义了Mapping.checkout函数后,执行该函数(比如重启游戏),之后继续判断, 86 | Mapping.errorrepeat控制持续出错后执行checkout的时间,假如超过次数,则最后终止这个索引]] 87 | function Mapping:abnormal(u,p) 88 | p = p or false 89 | --检查页面中不超过重复次数页面 90 | if #u.pages >= self.repeattimes then 91 | table.remove(u.pages,1) 92 | end 93 | table.insert(u.pages,p) 94 | local p1 , p2 = u.pages[1] , u.pages[2] 95 | --检查页面是否全部重复或者是否为1,2,1,2这样持续重复两张(有时候一个页面无法判断,就会出现这样的问题) 96 | for i,v in ipairs(u.pages) do 97 | if i%2 == 1 and v ~= p1 then 98 | u.normal = true 99 | u.time = os.time() 100 | break 101 | end 102 | if i%2 == 0 and (v ~= p1 and v ~=p2) then 103 | u.normal = true 104 | u.time = os.time() 105 | break 106 | end 107 | end 108 | --判断是否正常 109 | if u.normal then 110 | u.normal = false 111 | return u 112 | elseif os.time() - u.time > self.timeout then 113 | if self.snapshot then 114 | local name 115 | if p1 = p2 then 116 | name = p1 117 | else 118 | name = p1.."_"..p2 119 | end 120 | local snapshotname = name.."_"..os.date("%m-%d", os.time())..".png" 121 | snapshot(snapshotname) 122 | end 123 | if self.errorrepeat >= errornum and self.checkout then 124 | self.checkout() 125 | errornum = errornum + 1 126 | end 127 | else 128 | return u 129 | end 130 | end 131 | 132 | --运行这个索引的内容 133 | function Mapping:Run() 134 | --abnormal为检测异常的表,checkout记录每次是否检查到页面 135 | local abnormal,checkout = {pages={},normal = false,u.errornum = 0} 136 | self.finished = false 137 | while not self.finished do 138 | keepScreen(true) 139 | for i,page in ipairs(self.pages) do 140 | if (not page.checkout) or page:check() then 141 | keepScreen(false) 142 | checkout = false 143 | abnormal = self:abnormal(abnormal,page.pagename) 144 | if abnormal then return false end 145 | if page.action then page:action() end 146 | if page.ending then page:ending() end 147 | break 148 | end 149 | --检查不到任何页面,则向上级索引 150 | if i == #self.pages then 151 | self.prev:Run() 152 | end 153 | end 154 | keepScreen(false) 155 | if checkout then 156 | abnormal = self:abnormal(abnormal) 157 | if abnormal then return false end 158 | end 159 | checkout = true 160 | end 161 | return true 162 | end 163 | -------------------------------------------------------------------------------- /跳一跳/main.lua: -------------------------------------------------------------------------------- 1 | init(0, 0) 2 | require("TSLib") 3 | w,h = getScreenSize() 4 | 5 | -- 不同分辨率手机的时间系数 6 | a1080 = 1.33 7 | a720 = 1.9 8 | i5 = 2.21 9 | i6 = 1.825 10 | i6p = 1.15 11 | 12 | function i5_abu(edt_coef) 13 | while true do 14 | local x,y = findMultiColorInRegionFuzzy( 0x2b2b49, "0|1|0x2b2b49,0|2|0x2b2b49,0|3|0x2b2b49", 95,1, 297, 307, 1004) 15 | if x ~= -1 then 16 | local he = x + (1135-y) 17 | tap(x,y,695 + (670-he)*3.2) 18 | end 19 | local x,y = findMultiColorInRegionFuzzy( 0x2b2b49, "0|1|0x2b2b49,0|2|0x2b2b49,0|3|0x2b2b49", 95,309, 297, 636, 956) 20 | if x ~= -1 then 21 | local he = (639-(x+44)) + (1135-y) 22 | tap(x,y,610 + (670-he)*3.2) 23 | end 24 | mSleep(edt_coef) 25 | end 26 | end 27 | 28 | os_type = getOSType(); --获取设备系统版本 29 | if ( w == 1080 and h == 1920 ) or ( h == 1080 and w == 1920 ) then -- 安卓 1080p 30 | edt_coef = a1080 31 | findColors = {0x38365e, "-16|-6|0x35335a,13|-5|0x39375f", 98, 0, 0, w, h} 32 | elseif ( w == 720 and h == 1280 ) or ( h == 720 and w == 1280 ) then -- 安卓 720P 33 | edt_coef = a720 34 | findColors = {0x37355d, "-24|0|0x2b2b49,23|0|0x383550,-2|-122|0x35363e", 98, 2, 536, 714, 1024} 35 | elseif ( w == 1242 and h == 2208 ) or ( h == 1242 and w == 2208 ) then -- iOS 6p,6sp 36 | edt_coef = i6p 37 | findColors = {0x373860, "-2|-214|0x34353d,-42|-2|0x2b2b49,40|-4|0x393550", 98, 20, 796, 1212, 1832} 38 | elseif ( w == 640 and h == 1136 ) or ( h == 640 and w == 1136 ) then -- iOS 5,5c,5s,touch5,touch6 39 | edt_coef = "固定" 40 | -- findColors = {0x373861, "19|1|0x393758,-15|1|0x2e2e51", 98, 5, 514, 628, 922} 41 | elseif ( w == 750 and h == 1334 ) or ( h == 750 and w == 1334 ) then -- iOS 6,6s 42 | edt_coef = i6 43 | findColors = {0x37355d, "-22|-1|0x2d2c4d,7|-124|0x413955", 98, 14, 564, 722, 1026} 44 | else 45 | dialog("暂不支持此分辨率") 46 | lua_exit() 47 | end 48 | 49 | UINew("跳一跳高分辅助","开始","取消","tytb.txt",0,120,w,h) 50 | UILabel("关闭所有遮挡游戏的图标\r\n例如360加速球、小白点",20,"center","255,69,0") 51 | UILabel("问题反馈QQ群:432476989",18,"center","255,69,0") 52 | UILabel("") 53 | UILabel("设置停顿时间(单位:秒):") 54 | UIRadio("rdo","2,3,4,5","1") 55 | UILabel("5秒有概率可以成功上传成绩",14,"left","255,69,0") 56 | UILabel("设备信息",20,"left","0,136,0") 57 | UILabel("设备名称 : "..getDeviceName(),16,"left","120,120,120") 58 | if os_type == "android" then --返回值为纯小写字母 59 | UILabel("设备品牌 : "..getDeviceBrand(),16,"left","120,120,120") 60 | UILabel("设备型号 : "..getDeviceModel(),16,"left","120,120,120") 61 | end 62 | UILabel("引擎版本 : "..getTSVer(),16,"left","120,120,120") 63 | UILabel("系统版本 : "..getOSVer(),16,"left","120,120,120") 64 | UILabel("分辨率 : "..w..":"..h,16,"left","120,120,120") 65 | UILabel("系数 : "..edt_coef,16,"left","120,120,120") 66 | if os_type ~= "ios" and (( w ~= 640 and h ~= 1136 ) or ( h ~= 640 and w ~= 1136 )) then --返回值为纯小写字母 67 | UILabel("") 68 | UILabel("") 69 | UILabel("") 70 | UILabel("") 71 | UILabel("") 72 | UILabel("") 73 | UILabel("") 74 | UILabel("") 75 | UILabel("") 76 | UILabel("") 77 | UILabel("") 78 | UILabel("") 79 | UILabel("") 80 | UILabel("") 81 | UILabel("") 82 | UILabel("") 83 | UILabel("") 84 | UILabel("") 85 | UILabel("") 86 | UILabel("") 87 | UILabel("默认不用修改系数.") 88 | UILabel("如果多次启动均无法准确跳跃,可以手动进行微调.") 89 | UILabel("如需微调,推荐每次加减0.01") 90 | UILabel("输入时间系数:") 91 | UIEdit("edt_coef","输入时间系数",edt_coef.."",15,"left","255,0,0") 92 | end 93 | UIShow() 94 | mSleep(1000) 95 | 96 | 97 | edt_time = tonumber(rdo)*1000 98 | 99 | if os_type == "ios" and (( w == 640 and h == 1136 ) or ( h == 640 and w == 1136 )) then 100 | i5_abu(edt_time) 101 | end 102 | 103 | local screenWidth, screenHeight= getScreenSize(); 104 | edt_coef = tonumber(edt_coef) 105 | local distanceTimeRate = edt_coef 106 | local targetPositionOffset = screenHeight * 0.012 107 | 108 | function Touch(x, y, millsSecond) 109 | touchDown(x, y) 110 | mSleep(millsSecond) 111 | touchUp(x, y) 112 | end 113 | 114 | function DoLoop() 115 | while true do 116 | keepScreen(true); 117 | if DoJump() == false then 118 | keepScreen(false); 119 | break 120 | end 121 | keepScreen(false); 122 | end 123 | end 124 | 125 | function DoJump() 126 | local x, y = GetCalcSelfPosition()--找小人底部中心点 127 | if x == -1 or x == 0 then 128 | return false 129 | end 130 | 131 | local startX = 0 -- 找色起始X值是0点 132 | local startY = screenHeight * 0.2 -- 找色起始Y值是屏幕高度*0.2,因为再往上没有需要找的色. 133 | local endX = screenWidth - 3 -- 找色结束X值是屏幕宽度-3,防止循环越界. 134 | local endY = screenHeight * 0.7 -- 找色结束Y值是屏幕高度*0.7,因为再往下没有需要找的色. 135 | 136 | if x < screenWidth / 2 then -- 如果找到黑色人偶的坐标在屏幕左半部(X < 屏幕宽度/2) 137 | startX = screenWidth / 2 -- 那么目标点肯定在屏幕右半部,找色起始X值等于屏幕宽度的一半. 138 | else -- 如果找到黑色人偶的坐标在屏幕右半部(X > 屏幕宽度/2) 139 | endX = screenWidth / 2 -- 那么目标点肯定在屏幕左半部,找色结束X值等于屏幕宽度的一半. 140 | end 141 | 142 | local targetX, targetY = GetTargetPosition(startX, startY, endX, endY) 143 | -- 通过三角函数,使用人偶底部中心坐标和目标坐标计算距离,x,y是人偶底部中心坐标,targetX,targetY 是盒子的中心坐标, 144 | local distance = math.sqrt( (x - targetX) * (x - targetX) + (y - targetY) * (y - targetY) ) 145 | local pressTime = CalcHoldTime(distance) -- 通过距离*时间系数得到按压的延时时长 146 | 147 | Touch(targetX,targetY, pressTime) 148 | math.randomseed(getRndNum()) -- 随机种子初始化真随机数 149 | num = math.random(edt_time-500, edt_time+1000) -- 随机获取一个延时-500到延时+1000之间的数字,通过随机时间间隔跳跃,增加成功上传成绩几率 150 | mSleep(num) 151 | return true 152 | end 153 | 154 | function GetCalcSelfPosition() 155 | x,y = findMultiColorInRegionFuzzy( findColors[1], findColors[2], findColors[3], findColors[4], findColors[5], findColors[6], findColors[7]) 156 | return x, y 157 | end 158 | 159 | function GetTargetPosition(startX, startY, endX, endY) 160 | local step = 3 161 | local r, g, b, rr, gg, bb 162 | for y = startY , endY, step do--上往下开始每三个像素取一下颜色值 163 | r, g, b = getColorRGB(1, y)--X 坐标点为 1,Y 坐标点在起始点与终点之间 164 | for x = startX, endX , step do 165 | rr, gg, bb = getColorRGB(x, y) 166 | if isColor(r, g, b, rr, gg, bb, 98) then--将取到的颜色值进行对比 167 | r = rr 168 | g = gg 169 | b = bb 170 | else--找到一个和刚才的点颜色不一样的点 171 | return x, y + targetPositionOffset 172 | end 173 | end 174 | end 175 | return -1, -1 176 | end 177 | 178 | function isColor(rr, gg, bb, r, g, b ,s) 179 | local fl,abs = math.floor,math.abs 180 | s = fl(0xff*(100-s)*0.01) 181 | if abs(r-rr) 0 then 31 | 32 | else 33 | ClickInterval = 30 34 | end 35 | 36 | -- 两次按下间隔 默认0 37 | if Interval == "number" and Interval > 0then 38 | 39 | else 40 | Interval = 0 41 | end 42 | 43 | -- 设置坐标方式 默认手动设置 44 | if Cycle == 0 then 45 | ret,ClickX,ClickY = My手动设置点击位置() 46 | ClickX = tonumber(ClickX) 47 | ClickY = tonumber(ClickY) 48 | if ret == 1 then 49 | if ClickX ~= nil and ClickX > 0 and ClickX < w and ClickY ~= nil and ClickY > 0 and ClickY < h then 50 | 51 | else 52 | ClickX,ClickY = 300,150 53 | end 54 | else 55 | ClickX,ClickY = 300,150 56 | end 57 | else 58 | My自动获取点击位置() 59 | end 60 | 61 | -- 循环次数 默认无限循环 62 | if setClick == nil then 63 | My无限循环(ClickX,ClickY,ClickInterval,Interval) 64 | elseif setClick > 0 then 65 | My计次循环(setClick,ClickX,ClickY,ClickInterval,Interval) 66 | end 67 | 68 | else 69 | toast("退出脚本") 70 | mSleep(500) 71 | lua_exit() 72 | end 73 | end 74 | 75 | function My自动获取点击位置() 76 | dialog("点击确定后,自动捕捉下次点击位置.", 0) 77 | x,y = catchTouchPoint(); 78 | 79 | choice = dialogRet("确定使用这个坐标值么?\rx:"..x.." y:"..y, "是", "从新获取", "", 0); 80 | if choice == 0 then --男 81 | ClickX = x 82 | ClickY = y 83 | elseif choice == 1 then --女 84 | My自动获取点击位置() 85 | end 86 | mSleep(500) 87 | end 88 | 89 | function My计次循环(setClick,ClickX,ClickY,ClickInterval,Interval) 90 | for x=1,setClick do 91 | MyClick(ClickX,ClickY,ClickInterval,Interval); 92 | end 93 | end 94 | 95 | function My无限循环(ClickX,ClickY,ClickInterval,Interval) 96 | while (true) do 97 | MyClick(ClickX,ClickY,ClickInterval,Interval); 98 | end 99 | end 100 | 101 | function My设置() 102 | 103 | MyJsonString = [[ 104 | { 105 | "style" : "default", 106 | "config" : "shaoye_wuxiandianji", 107 | "width" : ]]..w..[[, 108 | "height" : ]]..h..[[, 109 | "bg" : "#00000000", 110 | "timer" : 0, 111 | "cancelname" : "取消", 112 | "okname" : "开始", 113 | "views": [ 114 | { 115 | "type": "Label", 116 | "text": "请完成设置", 117 | "size": 25, 118 | "align": "center", 119 | "color": "95,169,0" 120 | },{ 121 | "type": "Label", 122 | "text": " ", 123 | "size": 25, 124 | "align": "center", 125 | "color": "95,169,0" 126 | },{ 127 | "type": "Label", 128 | "text": "按下抬起间隔(单位:毫秒)", 129 | "size": 22, 130 | "color": "109,109,109" 131 | },{ 132 | "type": "Edit", 133 | "prompt": "默认30毫秒", 134 | "size": 20, 135 | "text": "30", 136 | "align": "left", 137 | "color": "109,109,109" 138 | },{ 139 | "type": "Label", 140 | "text": " ", 141 | "size": 25, 142 | "align": "center", 143 | "color": "95,169,0" 144 | },{ 145 | "type": "Label", 146 | "text": "两次按下间隔(单位:毫秒)", 147 | "size": 22, 148 | "color": "109,109,109" 149 | },{ 150 | "type": "Edit", 151 | "prompt": "默认0", 152 | "size": 20, 153 | "text": "0", 154 | "align": "left", 155 | "color": "109,109,109" 156 | },{ 157 | "type": "Label", 158 | "text": " ", 159 | "size": 25, 160 | "align": "center", 161 | "color": "95,169,0" 162 | },{ 163 | "type": "Label", 164 | "text": "循环次数(无限循环什么都不填)", 165 | "size": 22, 166 | "color": "109,109,109" 167 | },{ 168 | "type": "Edit", 169 | "prompt": "默认无限循环", 170 | "size": 20, 171 | "align": "left", 172 | "color": "109,109,109" 173 | },{ 174 | "type": "Label", 175 | "text": " ", 176 | "size": 25, 177 | "align": "center", 178 | "color": "95,169,0" 179 | },{ 180 | "type": "Label", 181 | "text": "坐标设置方式", 182 | "size": 22, 183 | "color": "109,109,109" 184 | },{ 185 | "type": "RadioGroup", 186 | "list": "手动输入点击坐标,自动输入电极坐标", 187 | "select": "0" 188 | } 189 | ] 190 | } 191 | ]] 192 | 193 | return showUI(MyJsonString); 194 | end 195 | 196 | function My手动设置点击位置() 197 | 198 | MyJsonString = [[ 199 | { 200 | "style" : "default", 201 | "config" : "shaoye_wuxiandianji2", 202 | "width" : ]]..w..[[, 203 | "height" : ]]..h..[[, 204 | "bg" : "#00000000", 205 | "timer" : 0, 206 | "cancelname" : "取消", 207 | "okname" : "开始", 208 | "views": [ 209 | { 210 | "type": "Label", 211 | "text": "请完成设置", 212 | "size": 25, 213 | "align": "center", 214 | "color": "95,169,0" 215 | },{ 216 | "type": "Label", 217 | "text": " ", 218 | "size": 25, 219 | "align": "center", 220 | "color": "95,169,0" 221 | },{ 222 | "type": "Label", 223 | "text": "X轴坐标,取值范围0~]]..w..[[", 224 | "size": 22, 225 | "color": "109,109,109" 226 | },{ 227 | "type": "Edit", 228 | "prompt": "300", 229 | "size": 20, 230 | "align": "left", 231 | "color": "109,109,109" 232 | },{ 233 | "type": "Label", 234 | "text": " ", 235 | "size": 25, 236 | "align": "center", 237 | "color": "95,169,0" 238 | },{ 239 | "type": "Label", 240 | "text": "Y轴坐标,取值范围0~]]..h..[[", 241 | "size": 22, 242 | "color": "109,109,109" 243 | },{ 244 | "type": "Edit", 245 | "prompt": "150", 246 | "size": 20, 247 | "align": "left", 248 | "color": "109,109,109" 249 | } 250 | ] 251 | } 252 | ]] 253 | 254 | ret, ClickX,ClickY = showUI(MyJsonString); 255 | return ret,ClickX,ClickY; 256 | end 257 | 258 | --[[ 259 | 单击方法 260 | 参数说明: 261 | ClickX = 点击X坐标 262 | ClickY = 点击Y坐标 263 | ClickInterval = 按下抬起间隔 264 | Interval = 事件结束间隔 265 | ]]-- 266 | function MyClick(ClickX,ClickY,ClickInterval,Interval) 267 | --dialog(ClickX..":"..ClickY, 0) 268 | touchDown(ClickX,ClickY) 269 | mSleep(ClickInterval) 270 | touchUp(ClickX,ClickY) 271 | mSleep(Interval) 272 | end 273 | 274 | Main() 275 | -------------------------------------------------------------------------------- /深海水族馆/720p.lua: -------------------------------------------------------------------------------- 1 | 2 | function daily() 3 | x,y = findMultiColorInRegionFuzzy( 0x424242, "32|-4|0x424242,73|19|0x424242,32|40|0x424242,27|16|0x7ec6bf", 90, 520, 689, 617, 751)--购买商品失败 4 | if x ~= -1 then 5 | tap(x+30,y+30,tapms,tapimg) 6 | toast("购买商品失败") 7 | end 8 | x,y = findMultiColorInRegionFuzzy( 0xece7ed, "15|-2|0xece2ed,6|-11|0x82c542", 90, 406, 517, 448, 556)--离线奖励 9 | if x ~= -1 then 10 | tap(364, 792,tapms,tapimg) 11 | end 12 | multiColTap({{ 338, 1303, 0xff547b},{ 1194, 1306, 0xff547b},{ 1191, 1434, 0xff547b},{ 341, 1433, 0xff547b}})--签到 13 | multiColTap({{ 1038, 1033, 0xd1e926},{ 1048, 1041, 0xd3ea26},{ 1071, 1016, 0xcce326},{ 730, 1232, 0x7d7d85},{ 754, 1220, 0x808188}})--发现隐藏的鱼 14 | multiColTap({{ 473, 1034, 0xfead00},{ 491, 1034, 0xffae00},{ 491, 1031, 0xffae00},{ 252, 1036, 0x666869}})--关闭宝箱 15 | end 16 | 17 | function collect() 18 | x,y = findMultiColorInRegionFuzzy( 0xd95da5, "10|0|0xd95da5,5|5|0xda5da6", 80, 11, 64, 697, fh)--鱼红心泡泡 19 | if x ~= -1 then 20 | tap(x,y,tapms,tapimg) 21 | toast("找到一颗心哦~") 22 | else x,y = findMultiColorInRegionFuzzy( 0xdc5ea9, "-3|1|0xdc5ca9,1|4|0xdc5ca9,4|2|0xdc5ca9", 80, 11, 64, 697, fh) 23 | if x ~= -1 then 24 | tap(x,y,tapms,tapimg) 25 | toast("找到一颗心哦~") 26 | end 27 | end 28 | end 29 | 30 | function festival() 31 | x,y = findMultiColorInRegionFuzzy( 0xfff3c5, "-1|3|0xfff3c5,-2|4|0xfff3c5,-3|10|0xffffff",90,56, 67, 652, fh) 32 | if x ~= -1 then 33 | tap(x,y,30,tapimg) 34 | toast("物品 +1 呀~坐标:"..x.."&"..y) 35 | else 36 | x,y = findMultiColorInRegionFuzzy(0xfff8c7, "9|2|0xfff8c7,4|10|0xfe6278,4|13|0xfe6278", 90, 56, 67, 652, fh) 37 | if x ~= -1 then 38 | tap(x,y,30,tapimg) 39 | toast("物品 +1 哇~坐标"..x.."&"..y) 40 | else 41 | x,y = findMultiColorInRegionFuzzy(0xffefc5, "-3|0|0xffefc6,7|0|0xffeec5,-2|8|0xffffff,-3|5|0xffffff",90, 56, 67, 652, fh) 42 | if x ~= -1 then 43 | tap(x,y,30,tapimg) 44 | toast("物品 +1 哦~坐标"..x.."&"..y) 45 | end 46 | end 47 | end 48 | end 49 | 50 | 51 | if shanhushi == 0 then 52 | 左上角红心小手 = { 53 | { 40, 1023, 0xbe516a}, 54 | { 47, 1020, 0xbe516a}, 55 | { 48, 1075, 0xbb5566}, 56 | { 60, 1087, 0xffffff}, 57 | } 58 | end 59 | xm,ym=655, 1228 60 | x,y = findMultiColorInRegionFuzzyByTable( 左上角红心小手, 90, 23, 1009, 143, 1107) 61 | if x ~= -1 then 62 | halfmenu = true 63 | else 64 | halfmenu = false 65 | end 66 | 67 | function expand() 68 | if halfmenu == false then 69 | tap(xm,ym,tapms,tapimg) 70 | if multiColor({ 71 | { 338, 1207, 0xffffff}, 72 | { 361, 1205, 0xffffff}, 73 | { 361, 1230, 0xffffff}, 74 | { 339, 1228, 0xffffff}, 75 | }) == false then--扩张未开 76 | tap(361, 1230) 77 | end 78 | end 79 | end 80 | 81 | function stonemove() 82 | if shanhushi == 0 then 83 | if multiColor({ 84 | { 120, 1824, 0xffffff}, 85 | { 118, 1837, 0xffffff}, 86 | { 91, 1839, 0xffffff}, 87 | { 108, 1806, 0xffffff}, 88 | }) == false then--石头未开 89 | tap(79, 1223,tapms,tapimg) 90 | else 91 | x,y = findMultiColorInRegionFuzzy( 0xfefeff, "14|-2|0xfcfcfd,13|15|0xffffff,36|0|0xfefeff", 90, 499, 1190, 576, 1226)--技能 92 | if x == -1 then 93 | moveTo(w/2,h-400,w/2,h-200,10) 94 | end 95 | end 96 | end 97 | end 98 | 99 | 100 | function menu() 101 | if halfmenu == false then 102 | tap(xm,ym,tapms,tapimg) 103 | else 104 | stonemove() 105 | end 106 | end 107 | 108 | function shutmenu() 109 | if halfmenu == true then 110 | tap(973, 1831,tapms,tapimg) 111 | end 112 | end 113 | 114 | function farmmove() 115 | if shanhushi == 0 then 116 | if multiColor({{ 146, 1093, 0xffffff},{ 146, 1085, 0xffffff},{ 150, 1072, 0xffffff}}) == false then--珊瑚未开 117 | tap(146, 1085,tapms,tapimg) 118 | else 119 | x,y = findMultiColorInRegionFuzzy( 0x93db49, "-4|13|0xffffff,-25|27|0xffffff,20|38|0xffffff", 90, 17, 702, 109, 798)--海带农场 120 | if x == -1 then 121 | moveTo(w/2,h-400,w/2,h-200,10) 122 | end 123 | end 124 | end 125 | end 126 | 127 | function farm() 128 | if shanhushi == 0 then 129 | x,y = findMultiColorInRegionFuzzy( 0x512790, "-1|3|0x522593,-7|0|0x4e2988", 90, 42, 209, 79, 240)--半屏海胆 130 | if x ~= -1 then 131 | tap(x,314,tapms,tapimg) 132 | mSleep(500) 133 | toast("收割海胆~") 134 | end 135 | x,y = findMultiColorInRegionFuzzy( 0x7cca9c, "6|-5|0x7fc792,12|-11|0x83c68e,10|-1|0x67aba6", 90, 117, 172, 151, 199)--半屏海带 136 | if x ~= -1 then 137 | tap(x,247,tapms,tapimg) 138 | mSleep(500) 139 | toast("收割海带~") 140 | end 141 | x,y = findMultiColorInRegionFuzzy( 0xfef4ff, "3|-1|0xfff6ff,2|6|0xffffff,6|5|0xffffff,7|11|0xfef7ff", 90, 572, 187, 602, 216)--半屏贝壳 142 | if x ~= -1 then 143 | tap(x,264,tapms,tapimg) 144 | mSleep(500) 145 | toast("收割贝壳~") 146 | end 147 | x,y = findMultiColorInRegionFuzzy( 0x6c23ab, "-2|2|0x6825a6,2|-3|0x6925a2", 90, 60, 465, 89, 490)--全屏海胆 148 | if x ~= -1 then 149 | tap(x,558,tapms,tapimg) 150 | mSleep(500) 151 | toast("收割海胆~") 152 | end 153 | x,y = findMultiColorInRegionFuzzy( 0x97c6ab, "-5|5|0x94c9b2,6|-5|0x9dc5a6,4|3|0x81acbc", 90, 127, 430, 161, 456)--全屏海带 154 | if x ~= -1 then 155 | tap(x,514,tapms,tapimg) 156 | mSleep(500) 157 | toast("收割海带~") 158 | end 159 | x,y = findMultiColorInRegionFuzzy( 0xfff4ff, "2|0|0xfff5ff,1|6|0xffffff,5|4|0xffffff", 90, 565, 439, 591, 466)--全屏贝壳 160 | if x ~= -1 then 161 | tap(x,506,tapms,tapimg) 162 | mSleep(500) 163 | toast("收割贝壳~") 164 | end 165 | end 166 | end 167 | 168 | function stoneup() 169 | if shanhushi == 0 then 170 | x,y = findMultiColorInRegionFuzzy( 0xfbae17, "68|1|0xfbae17,-1|67|0xfbae17,72|68|0xfbae17", 90, 14, 787, 116, 1183)--获取升级奖励 171 | if x ~= -1 then 172 | tap(x,y,tapms,tapimg) 173 | end 174 | x1,y1=763,1513 175 | multiColTap({ 176 | { x1, y1, 0x1095b4}, 177 | { x1+260, y1, 0x1095b4}, 178 | { x1, y1+110, 0x1095b4}, 179 | { x1+260, y1+110, 0x1095b4}, 180 | })--升级珊瑚石(蓝色) 181 | multiColTap({ 182 | { x1, y1, 0x223042}, 183 | { x1+260, y1, 0x223042}, 184 | { x1, y1+110, 0xe8972d}, 185 | { x1+260, y1+110, 0xe8972d}, 186 | })--升级珊瑚石(黄色) 187 | end 188 | end 189 | 190 | function stoneskill() 191 | if shanhushi == 0 then 192 | multiColTap({ 193 | { 110, 880, 0xf9f9f9}, 194 | { 122, 880, 0xf9f9f9}, 195 | { 141, 881, 0xf9f9f9}, 196 | })--火山爆发 197 | multiColTap({ 198 | { 422, 893, 0x2f7496}, 199 | { 417, 929, 0x172e3f}, 200 | { 441, 928, 0xececec}, 201 | })--月之歌 202 | multiColTap({ 203 | { 275, 874, 0xe9566e}, 204 | { 279, 881, 0xe9566e}, 205 | { 295, 875, 0xdb4964}, 206 | })--海鲜大餐 207 | end 208 | end 209 | -------------------------------------------------------------------------------- /滑块验证/FindSquare.lua: -------------------------------------------------------------------------------- 1 | local function argth() 2 | local _ENV = { 3 | tonumber = tonumber, 4 | type = type, 5 | error = error, 6 | select = select, 7 | string = { 8 | format = string.format, 9 | find = string.find, 10 | }, 11 | debug = { 12 | getinfo = debug.getinfo, 13 | }, 14 | } 15 | local function bad_arg(field, arg_count, mean, expected_type, got_type, level_plus) 16 | level_plus = tonumber(level_plus) or 0 17 | local dbinfo = debug.getinfo(2 + level_plus) 18 | local ftype = (type(dbinfo.namewhat)=="string" and dbinfo.namewhat) or "" 19 | local fname = (type(dbinfo.name)=="string" and dbinfo.name) or (type(field)=="string" and field) or "?" 20 | if got_type~="" then 21 | got_type = string.format(", 得到 %s", got_type) 22 | end 23 | return error(string.format("未能成功运行,参数序号:#%d%s 函数:%s '%s' (需要 %s %s)", arg_count, mean, ftype, fname, expected_type, got_type), 3 + level_plus) 24 | end 25 | 26 | local function TsCheck(arg_count, expected_type, ...) 27 | if type(arg_count)~="number" then 28 | bad_arg("TsCheck", 1, "(arg_count)", "number", type(arg_count)) 29 | end 30 | if type(expected_type)~="string" then 31 | bad_arg("TsCheck", 2, "(expected_type)", "string", type(expected_type)) 32 | end 33 | local argc = select("#", ...) 34 | if argc