![]() |
|
|
#7 |
|
中级会员
![]() ![]() ![]() ![]() ![]() ![]()
注册: 08年07月03日
帖子: 139
声望力: 19
声望:
14
![]() 现金:104两梁山币
资产:304两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0 |
回复: MUSH417 xlqy各门派综合机器人
关键的xlqy.lua文件 配置所有任务的触发动作 包括li mp hb pj nt tf 任务 由于内容较多 估计要分N分了 require "global" require "event_v2" -- path g_work_dir = "e:\\mushclient\\lua\\" require "xlqy_map" function on_linda_info(name, output, wildcards) local answer = "江流儿" cmdSender:Add("answer "..answer..";@10;i;kquest;@5;d;d;w;n;set no_teach dowhat") end function UpdateStatus() local ntdo = "" if g_renwu_nt then ntdo = "yes" else ntdo = "no" end local ntfail = g_nt_errkill + g_nt_bekilled + g_nt_cancel SetStatus(myid.." Hb:"..g_hb_success.."/"..g_hb_failure..",Li:"..g_li_success.."/"..g_li_failure..",Nt:"..g_nt_success.."/"..ntfail.."("..g_nt_cancel.."/"..g_nt_errkill.."/"..g_nt_bekilled..") NT:"..ntdo.." PJ:"..g_pj_killed.."/"..g_pj_cancel.." "..g_exp_gain.."/"..g_exp_permin..":"..g_exp.."/"..guai_place..":"..guai_name) end -- require "hb" -- hb filename = g_work_dir.."hb.txt" zonepattern = ".*\/" gfile = assert(io.open(filename,"r")); function querydb(whowho) who = GetTriggerInfo(whowho,101) findpattern = GetTriggerInfo(whowho,102) local find = false Note(findpattern) newpattern = string.gsub(findpattern,"■",".?.?") Note(newpattern) len = newpattern:len() if len > 20 then tmp = newpattern:sub(1,20) newpattern = tmp --Note("!!!too long!!!") end if gfile ~= nil then Note("gfile\n") gfile:seek("set") repeat t = gfile:read("*l") if t ~= nil then ft,ft2 = string.find(t,newpattern) if ft ~= nil then find = true ft,ft2 = string.find(t,zonepattern) if t:len() < 20 then cmdSender:Add("tell "..who.." match="..t) else cmdSender:Add("tell "..who.." match="..t:sub(ft2+13,ft2+24)) end if ft ~= nil then cmdSender:Add("tell "..who.." where="..t:sub(ft,ft2)) else cmdSender:Add("tell "..who.." where=unknow") end else --Note(t) end else end until t == nil or find == true end end -- look paper 看镖单的信息格式1 function OnHbInfo1(name, output, wildcards) if wildcards[1] ~= "" then HbProcess(wildcards[1]) end end function OnHbInfo11(name, output, wildcards) local findpattern = wildcards[1] if findpattern == "" then return end Note(findpattern) local find = false local newpattern = string.gsub(findpattern,"■",".?.?") local len = newpattern:len() local t if len > 20 then local tmp = newpattern:sub(1,20) newpattern = tmp end if gfile ~= nil then gfile:seek("set") repeat t = gfile:read("*l") if t ~= nil then local ft,ft2 = string.find(t,newpattern) if ft ~= nil then find = true end else end until t == nil or find == true if find == true then cmdSender:Add("say hb "..t) else cmdSender:Add("@20;drop paper;set no_teach godz") end end end function OnHbInfo2(name, output, wildcards) if wildcards[1] ~= "" then HbProcess(wildcards[1]) end end -- look paper 看镖单的信息格式2 function OnHbInfo22(name, output, wildcards) local findpattern = wildcards[1] if findpattern == "" then return end Note(findpattern) local find = false local newpattern = string.gsub(findpattern,"■",".?.?") local len = newpattern:len() local t if len > 20 then local tmp = newpattern:sub(1,20) newpattern = tmp end if gfile ~= nil then gfile:seek("set") repeat t = gfile:read("*l") if t ~= nil then local ft,ft2 = string.find(t,newpattern) if ft ~= nil then find = true end else end until t == nil or find == true if find == true then cmdSender:Add("say hb "..t) else cmdSender:Add("@20;drop paper;set no_teach godz") end end end function HbProcess(hbinfo) g_hbpaper = hbinfo local info1 = hbinfo local info2 = string.gsub(info1, "■■", "■") while info1 ~= info2 do info1 = info2 info2 = string.gsub(info1, "■■", "■") end info2 = string.gsub(info2, "■", ";") local hbinfolist = utils.split(info2, ";") local hbinfo_counts = table.getn(hbinfolist) local line local finded = false local tobreak = false local i = hbinfo_counts local patterns = hbinfo_counts for i =1, hbinfo_counts do Note(hbinfolist[i]) end for i = 1, hbinfo_counts do gfile:seek("set") finded = false repeat local fail = false line = gfile:read("*l") if line then for j = 1, patterns do if string.find(line, hbinfolist[j]) then --Note("find"..hbinfolist[j]) else fail = true break end end if fail == false then finded = true end end until line == nil or finded if finded == true then break end patterns = patterns - 1 end if finded == true then g_hbline = line Note("start find biao...") Note(line) local t1, t2 = string.find(line, "\/") if t1 ~= nil then Note("->"..string.sub(line, 1, t1 - 1)) g_hbmatch_times = 0 for i = 1, 10 do DeleteTrigger("hbmatch"..i) end Note(line) if patterns >= 10 then patterns = 10 for i=1, patterns do AddTriggerEx( "hbmatch"..i, ".*"..string.sub(hbinfolist[i], 1, 2)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end else local n = 0 for i=1, patterns do n = n + 1 AddTriggerEx( "hbmatch"..n, ".*"..string.sub(hbinfolist[i], 1, 2)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end for i=1, patterns do if n >= 10 then break end if hbinfolist[i]:len() >= 4 then n = n + 1 AddTriggerEx( "hbmatch"..n, ".*"..string.sub(hbinfolist[i], 3, 4)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end end for i=1, patterns do if n >= 10 then break end if hbinfolist[i]:len() >= 6 then n = n + 1 AddTriggerEx( "hbmatch"..n, ".*"..string.sub(hbinfolist[i], 5, 6)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end end for i=1, patterns do if n >= 10 then break end if hbinfolist[i]:len() >= 8 then n = n + 1 AddTriggerEx( "hbmatch"..n, ".*"..string.sub(hbinfolist[i], 6, 7)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end end for i=1, patterns do if n >= 10 then break end if hbinfolist[i]:len() >= 10 then n = n + 1 AddTriggerEx( "hbmatch"..n, ".*"..string.sub(hbinfolist[i], 9, 10)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end end for i=1, patterns do if n >= 10 then break end if hbinfolist[i]:len() >= 12 then n = n + 1 AddTriggerEx( "hbmatch"..n, ".*"..string.sub(hbinfolist[i], 11, 12)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end end for i=1, patterns do if n >= 10 then break end if hbinfolist[i]:len() >= 14 then n = n + 1 AddTriggerEx( "hbmatch"..n, ".*"..string.sub(hbinfolist[i], 13, 14)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end end for i=1, patterns do if n >= 10 then break end if hbinfolist[i]:len() >= 16 then n = n + 1 AddTriggerEx( "hbmatch"..n, ".*"..string.sub(hbinfolist[i], 15, 16)..".*", "", trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating , 0, 0, "", "OnHbMatched", 0, 90) end end patterns = n end renwu = "护镖" Note(g_hb_matchs) g_hb_matchs = patterns guai_place = string.sub(line, 1, t1 - 1) --set_hbmatch(wildcards[2]) place_id() go_place() else g_hb_matchs = 0 g_hbmatch_times = 0 Note(line) cmdSender:Add("@20;drop paper;set no_teach godz") end else g_hb_matchs = 0 Note(line) cmdSender:Add("@20;drop paper;set no_teach godz") end end |
|
|
|