|
- local info = {}
- info.job = "tn" -- or tn
- info.job0 = nil --保存工作状态
- info.double = false --是否双倍内力
- info.eforce = 10 --有效内功的十分之一
- info.qx = 0 --气血
- info.qxmax = 0
- info.js = 0
- info.jsmax = 0
- info.jl = 0
- info.jlmax = 0
- info.nl = 0
- info.nlmax = 0
- info.food = "ganliang"
- info.water = "jiudai"
- info.sleep_to = ""
- info.sleep_back = ""
- function test(name, line, wildcards)
- print("name:" .. name);
- print("line:" .. line);
- for i, v in ipairs(wildcards) do
- print("wcs[" .. i .. "]:" .. v);
- end
- end
- function gethp(name, line, wildcards)
- SetVariable ( "exp" , wildcards[1] );
- SetVariable ( "pot" , wildcards[2] );
- SetVariable ( "nlmax" , wildcards[3] );
- SetVariable ( "nl" , wildcards[4] );
- SetVariable ( "jlmax" , wildcards[5] );
- SetVariable ( "jl" , wildcards[6] );
- SetVariable ( "qxmax" , wildcards[8] );
- SetVariable ( "qx" , wildcards[9] );
- SetVariable ( "jsmax" , wildcards[11] );
- SetVariable ( "js" , wildcards[12] );
- end
- function info_init()
- info.qx = tonumber (GetVariable ("qx"))
- info.qxmax = tonumber (GetVariable ("qxmax"))
- info.js = tonumber (GetVariable ("js"))
- info.jsmax = tonumber (GetVariable ("jsmax"))
- info.jl = tonumber (GetVariable ("jl"))
- info.jlmax = tonumber (GetVariable ("jlmax"))
- info.nl = tonumber (GetVariable ("nl"))
- info.nlmax = tonumber (GetVariable ("nlmax"))
- info.enforce = tonumber (GetVariable ("enforce"))
- info.job = GetVariable ("job")
- if info.job == nil then
- SetVariable ("job", "dz")
- info.job = "dz"
- end
- end
- function check(name, line, wildcards)
- if wildcards[1] == "正" then
- --DoAfterSpecial (1, 'SendNoEcho("checkbusy")', 12)
- AddTimer ("my_timer", 0, 0, 1, "", 1 + 4 + 1024 + 16384, "busy")
- end
- if wildcards[1] == "不" then
- Send("hpbrief")
- Send("set job on")
- end
- end
- function dojob(name, line, wildcards)
- AddTimer ("my_timer_fadai", 0, 8, 30, "", 1 + 4 + 1024 + 16384, "busy")
- Send("eat " .. info.food)
- Send("drink " .. info.water)
- if info.job == 'dz' then
- dz()
- end
- if info.job == 'tn' then
- tn()
- end
- end
- function dz()
- info_init()
- if info.nl < 100 then
- print("内力不够啊,等待30秒恢复")
- --DoAfterSpecial (30, 'SendNoEcho("checkbusy")', 12)
- AddTimer ("my_timer", 0, 0, 30, "", 1 + 4 + 1024 + 16384, "busy")
- return
- end
- local diff = 2 * info.nlmax - info.nl + 1
- diff = (info.nlmax < 1000) and math.ceil(diff/2) or diff
- if info.double then
- if diff <= info.qx then
- local _diff = (info.nlmax < 1000) and diff*2 or diff
- print("_diff:" .. _diff)
- if _diff + info.nl > info.nlmax * 2 then
- info.job = info.job0
- info.job0 = nil
- info.double = nil
- print("双倍内力恢复完成,继续未完成的工作:" .. info.job)
- SendNoEcho("checkbusy")
- return
- end
- end
- end
- if info.js < info.jsmax * 0.6 then
- print("精神不佳啊,恢复(exert regenerate)")
- --Send("exert regenerate")
- --DoAfterSpecial (15, 'SendNoEcho("checkbusy")', 12)
- AddTimer ("my_timer", 0, 0, 15, "", 1 + 4 + 1024 + 16384, "busy")
- return
- end
- if info.qx < info.qxmax * 0.3 then
- print("气血不佳啊,恢复(exert recover)")
- --Send("exert recover")
- --DoAfterSpecial (15, 'SendNoEcho("checkbusy")', 12)
- AddTimer ("my_timer", 0, 0, 15, "", 1 + 4 + 1024 + 16384, "busy")
- return
- end
- diff = (diff > info.qx * 0.8) and (math.floor((info.qx / info.enforce) / 2) * info.enforce) or diff
- diff = (diff < 10) and 10 or diff
- Send("dazuo " .. diff)
- SendNoEcho("checkbusy")
- end
- function tn()
- info_init()
- if info.nl < 100 then
- print("内力不够啊,等待30秒恢复")
- info.job0 = info.job
- info.job = "dz"
- info.double = true
- --DoAfterSpecial (30, 'SendNoEcho("checkbusy")', 12)
- AddTimer ("my_timer", 0, 0, 30, "", 1 + 4 + 1024 + 16384, "busy")
- return
- end
- local diff = 2 * info.jlmax - info.jl + 1
- diff = (info.jlmax < 1000) and math.ceil(diff/2) or diff
- if info.qx < info.qxmax * 0.6 then
- print("气血不佳啊,恢复(exert recover)")
- --Send("exert recover")
- --DoAfterSpecial (15, 'SendNoEcho("checkbusy")', 12)
- AddTimer ("my_timer", 0, 0, 15, "", 1 + 4 + 1024 + 16384, "busy")
- return
- end
- if info.js < info.jsmax * 0.3 then
- print("精神不佳啊,恢复(exert regenerate)")
- Send("exert regenerate")
- --DoAfterSpecial (1, 'SendNoEcho("checkbusy")', 12)
- AddTimer ("my_timer", 0, 0, 1, "", 1 + 4 + 1024 + 16384, "busy")
- return
- end
- diff = (diff > info.js * 0.8) and (math.floor((info.js / info.enforce) / 2) * info.enforce) or diff
- diff = (diff < 10) and 10 or diff
- Send("tuna " .. diff)
- SendNoEcho("checkbusy")
- end
- function busy()
- SendNoEcho("checkbusy")
- end
- function start()
- EnableTriggerGroup ("dztn", true)
- Send("checkbusy")
- end
- function stop()
- DeleteTimer("my_timer")
- DeleteTimer("my_timer_fadai")
- EnableTriggerGroup ("dztn", false)
- end
复制代码
北大侠客行MUD,中国最好的MUD |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|