Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <!DOCTYPE muclient>
- <muclient>
- <plugin
- name="Aardwolf_Auto_Nuke"
- author="mfukar"
- id="7634ed8c5ced45eb50be393e"
- language="Lua"
- purpose="Automatically clear rooms based on `consider all`"
- save_state="y"
- date_written="2014-08-01 00:00:00"
- requires="4.43"
- version="1.1">
- <description trim="y">
- <![CDATA[
- Nuke all mobs in a room.
- ]]>
- </description>
- </plugin>
- <include name="constants.lua"/>
- <triggers>
- <trigger
- enabled="n"
- group="consider"
- match="* looks a little worried about the idea."
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="* says 'BEGONE FROM MY SIGHT unworthy!'"
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="* should be a fair fight!"
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="* snickers nervously."
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="* would be easy, but is it even worth the work out?"
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="* would crush you like a bug!"
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="* would dance on your grave!"
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="*Best run away from * while you can!"
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="*Challenging * would be either very brave or very stupid."
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="No Problem! * is weak compared to you."
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="You would be completely annihilated by *!"
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="You would stomp * into the ground."
- omit_from_output="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="^(.*?) chuckles at the thought of you fighting (him|her|it)\.$"
- omit_from_output="y"
- regexp="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="^You see no one here but yourself\!$"
- keep_evaluating="y"
- omit_from_output="y"
- regexp="y"
- script="adapt_consider"
- sequence="100"
- >
- </trigger>
- <trigger
- enabled="n"
- group="consider"
- match="^nhm$"
- omit_from_output="y"
- keep_evaluating="n"
- regexp="y"
- script="Nuke"
- send_to="12"
- sequence="1"
- >
- </trigger>
- <trigger
- enabled="n"
- group="auto_consider"
- match="^You receive .+ experience points\.$"
- omit_from_output="n"
- keep_evaluating="y"
- regexp="y"
- script="send_consider"
- send_to="12"
- sequence="1"
- >
- </trigger>
- <trigger
- enabled="n"
- group="auto_consider"
- match="\[ Exits\:.+$"
- omit_from_output="n"
- keep_evaluating="y"
- regexp="y"
- script="send_consider"
- send_to="12"
- sequence="1"
- >
- </trigger>
- <trigger
- enabled="n"
- group="auto_consider"
- match="^A (.+) has fled\!$"
- omit_from_output="n"
- keep_evaluating="y"
- regexp="y"
- script="send_consider"
- send_to="12"
- sequence="1"
- >
- </trigger>
- </triggers>
- <aliases>
- <alias
- script="conw"
- match="^conw\s(.*)$"
- keep_evaluating="y"
- enabled="y"
- regexp="y"
- send_to="12"
- sequence="100"
- >
- </alias>
- <alias
- script="send_consider"
- match="^conw$"
- keep_evaluating="y"
- enabled="y"
- regexp="y"
- send_to="12"
- sequence="99"
- >
- </alias>
- </aliases>
- <!-- Script -->
- <script>
- <![CDATA[
- consider_messages_full = {
- ["You would stomp (.+) into the ground%."] =
- { range = "-19 and below", colour = "gray", },
- ["(.+) would be easy, but is it even worth the work out%?"] =
- { range = "-10 to -19", colour = "darkgreen", },
- ["No Problem%! (.+) is weak compared to you%."] =
- { range = "-6 to -9", colour = "forestgreen", },
- ["(.+) looks a little worried about the idea%."] =
- { range = "-2 to -6", colour = "chartreuse", },
- ["(.+) should be a fair fight%!"] =
- { range = "-2 to +2", colour = "springgreen", },
- ["(.+) snickers nervously%."] =
- { range = "+2 to +3", colour = "darkgoldenrod", },
- ["(.+) chuckles at the thought of you fighting .+%."] =
- { range = "+3 to +8", colour = "gold", },
- [".*Best run away from (.+) while you can%!"] =
- { range = "+8 to +16", colour = "tomato", },
- [".*Challenging (.+) would be either very brave or very stupid%."] =
- { range = "+16 to +21", colour = "crimson", },
- ["(.+) would crush you like a bug%!"] =
- { range = "+21 to +32", colour = "lightpink", },
- ["(.+) would dance on your grave%!"] =
- { range = "+32 to +41", colour = "darkmagenta", },
- ["(.+) says 'BEGONE FROM MY SIGHT unworthy%!'"] =
- { range = "+41 to +50", colour = "darkviolet", },
- ["You would be completely annihilated by (.+)%!"] =
- { range = "+50 and above", colour = "magenta", },
- } -- end of consider_messages
- consider_messages = {
- ["(.+) looks a little worried about the idea%."] =
- { range = "-2 to -6", colour = "chartreuse", },
- ["(.+) should be a fair fight%!"] =
- { range = "-2 to +2", colour = "springgreen", },
- ["(.+) snickers nervously%."] =
- { range = "+2 to +3", colour = "darkgoldenrod", },
- ["(.+) chuckles at the thought of you fighting .+%."] =
- { range = "+3 to +8", colour = "gold", },
- [".*Best run away from (.+) while you can%!"] =
- { range = "+8 to +16", colour = "tomato", },
- } -- end of consider_messages
- replaceT = { -- words to remove from mob names to get the keyword
- ["a"] = "",
- ["A"] = "",
- ["an"] = "",
- ["An"] = "",
- ["the"] = "",
- ["The"] = "",
- ["of"] = "",
- ["Of"] = "",
- ["captured"] = "",
- ["damned"] = "",
- ["yummy"] = "",
- ["looking"] = "",
- ["wanders"] = "",
- ["beef"] = "",
- ["pot"] = "",
- ["scrumptious"] = "",
- ["tortured"] = "",
- ["Hell"] = "",
- ["largest"] = "",
- ["older"] = "",
- ["slithering"] = "",
- ["tiny"] = "",
- ["huge"] = ""
- }
- targets = {}
- function keyword_change (name, line, wildcards)
- if keyword_position == "end" then
- SetVariable ("keyword_position", "beginning")
- else
- SetVariable ("keyword_position", "end")
- end
- keyword_position = GetVariable ("keyword_position")
- ColourTell ("white", "blue", "Keywords will now be taken from the " .. keyword_position .. " of Mobile names. ")
- ColourNote ("", "black", " ")
- end -- keyword_position
- function conw (name, line, wildcards)
- -- Usage
- if wildcards[1] == "?" then
- a = {
- "conw - Update window with consider all command",
- "conw <word> - Set default command",
- "conw swap - Swap keyword detection from beginning of desc to end, or vice-versa",
- "conw auto - Toggle auto nuke, on room entry and after combat",
- "conw ? - Show this message",
- "conw secondary - Toggle whether to use secondary ability after default command",
- "conw secondary <word> - Sets the secondary command to use"
- }
- for i,v in ipairs(a) do
- ColourTell ("yellow", GetInfo(271), v:sub(1, v:find("-") - 1))
- ColourNote ("white", GetInfo(271), v:sub(v:find("-"), v:len()))
- end
- return
- end
- if wildcards[1] == "auto" then
- if tonumber (GetVariable ("auto_conw")) == 1 then
- SetVariable ("auto_conw", 0)
- EnableTriggerGroup ("auto_consider", 0)
- ColourTell ("white", "blue", "Auto consider off.")
- ColourNote ("", "black", " ")
- else
- SetVariable ("auto_conw", 1)
- EnableTriggerGroup ("auto_consider", 1)
- ColourTell ("white", "blue", "Auto consider on.")
- ColourNote ("", "black", " ")
- end
- return
- end
- if string.find(wildcards[1], "secondary") then
- if wildcards[1] ~= "secondary" then
- --Setting alternate attack skill
- secondary_check = wildcards[1]:gsub("secondary ","")
- if tonumber(secondary_check) then
- secondary_loop_count = secondary_check
- SetVariable("conw_secondary_loop", secondary_loop_count)
- print("Setting number of secondary attacks to: " .. secondary_check)
- elseif secondary_check == 'balor' then
- useBalor = tonumber(GetVariable("conw_use_balor"))
- if not useBalor then
- useBalor = 0
- end
- if useBalor == 1 then
- print("Turning balor off")
- SetVariable("conw_use_balor", 0)
- else
- print("Turning balor on")
- SetVariable("conw_use_balor", 1)
- end
- else
- SetVariable("conw_secondary_ability", secondary_check)
- print("Setting secondary command to: " .. secondary_check)
- end
- else
- useSecondary = tonumber(GetVariable ("conw_use_secondary"))
- if useSecondary == 0 then
- print("Toggling use secondary ability on")
- SetVariable("conw_use_secondary", 1)
- else
- print("Toggling use secondary ability off")
- SetVariable("conw_use_secondary", 0)
- end
- end
- end
- if wildcards[1] == "swap" then
- keyword_change ()
- return
- end
- if wildcards[1] and wildcards[1]:match ("^[%w%s]+$") and not string.find(wildcards[1], "secondary") then
- SetVariable ("default_command", wildcards[1])
- default_command = GetVariable ("default_command")
- ColourTell ("white", "blue", "Default command: " .. wildcards[1])
- ColourNote ("", "black", " ")
- end
- end -- send_consider
- function send_consider ()
- if GetVariable ("doing_consider") == "true" then
- return
- end
- SetVariable ("doing_consider", "true")
- EnableTriggerGroup ("consider", true)
- SendNoEcho ("consider all")
- Send ("echo nhm")
- targets = {}
- end -- send_consider
- function KKND (id)
- if not id then
- return
- end
- Execute (default_command .. " " .. id)
- targets [id] = nil
- end -- KKND
- function adapt_consider (name, line, wildcards)
- for k, v in pairs (consider_messages) do
- mob = string.match (line, k) or nil
- if keyword_position == "end" then
- sPat = "[%w\\-]+$"
- else
- sPat = "^[%w\\-]+"
- end
- if mob then
- t = {
- keyword = mob:gsub ("%w+", function (str) return replaceT [str] end ):gsub("^%s+", ""):gsub("%s+$", ""):match(sPat),
- name = mob,
- line = line,
- -- colour = v.colour,
- -- range = "(" .. v.range .. ")",
- message = line
- }
- table.insert (targets, t)
- break
- end -- if
- end -- for
- end -- adapt_consider
- function Nuke ()
- for i,v in ipairs (targets) do
- if i == 1 then
- KKND(v.keyword)
- end
- end
- useBalor = tonumber(GetVariable("conw_use_balor"))
- if #targets > 0 and useBalor == 1 then
- Send("balor")
- end
- useSecondary = tonumber(GetVariable ("conw_use_secondary"))
- secondary_command = GetVariable("conw_secondary_ability")
- secondaryLoopCount = GetVariable("conw_secondary_loop")
- if #targets > 0 and useSecondary == 1 then
- for i = 1,secondaryLoopCount,1 do
- Send(secondary_command)
- end
- end
- SetVariable ("doing_consider", "false")
- EnableTriggerGroup ("consider", false)
- end -- Nuke
- function OnPluginInstall ()
- default_command = GetVariable ("default_command") or "kill"
- keyword_position = GetVariable ("keyword_position") or "end"
- SetVariable ("doing_consider", "false")
- auto_conw = GetVariable ("auto_conw") or 1
- EnableTriggerGroup ("auto_consider", auto_conw)
- if GetVariable ("enabled") == "false" then
- ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
- check (EnablePlugin(GetPluginID (), false))
- return
- end
- OnPluginEnable ()
- end -- OnPluginInstall
- function OnPluginEnable ()
- -- NOP
- end
- function OnPluginDisable ()
- -- NOP
- end
- function OnPluginSaveState ()
- SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
- SetVariable ("doing_consider", "false")
- end -- OnPluginSaveState
- ]]>
- </script>
- </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement