Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.27 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE muclient>
  3. <muclient>
  4. <plugin
  5. name="Aardwolf_Auto_Nuke"
  6. author="mfukar"
  7. id="7634ed8c5ced45eb50be393e"
  8. language="Lua"
  9. purpose="Automatically clear rooms based on `consider all`"
  10. save_state="y"
  11. date_written="2014-08-01 00:00:00"
  12. requires="4.43"
  13. version="1.1">
  14. <description trim="y">
  15. <![CDATA[
  16. Nuke all mobs in a room.
  17. ]]>
  18. </description>
  19. </plugin>
  20.  
  21. <include name="constants.lua"/>
  22.  
  23. <triggers>
  24. <trigger
  25. enabled="n"
  26. group="consider"
  27. match="* looks a little worried about the idea."
  28. omit_from_output="y"
  29. script="adapt_consider"
  30. sequence="100"
  31. >
  32. </trigger>
  33. <trigger
  34. enabled="n"
  35. group="consider"
  36. match="* says 'BEGONE FROM MY SIGHT unworthy!'"
  37. omit_from_output="y"
  38. script="adapt_consider"
  39. sequence="100"
  40. >
  41. </trigger>
  42. <trigger
  43. enabled="n"
  44. group="consider"
  45. match="* should be a fair fight!"
  46. omit_from_output="y"
  47. script="adapt_consider"
  48. sequence="100"
  49. >
  50. </trigger>
  51. <trigger
  52. enabled="n"
  53. group="consider"
  54. match="* snickers nervously."
  55. omit_from_output="y"
  56. script="adapt_consider"
  57. sequence="100"
  58. >
  59. </trigger>
  60. <trigger
  61. enabled="n"
  62. group="consider"
  63. match="* would be easy, but is it even worth the work out?"
  64. omit_from_output="y"
  65. script="adapt_consider"
  66. sequence="100"
  67. >
  68. </trigger>
  69. <trigger
  70. enabled="n"
  71. group="consider"
  72. match="* would crush you like a bug!"
  73. omit_from_output="y"
  74. script="adapt_consider"
  75. sequence="100"
  76. >
  77. </trigger>
  78. <trigger
  79. enabled="n"
  80. group="consider"
  81. match="* would dance on your grave!"
  82. omit_from_output="y"
  83. script="adapt_consider"
  84. sequence="100"
  85. >
  86. </trigger>
  87. <trigger
  88. enabled="n"
  89. group="consider"
  90. match="*Best run away from * while you can!"
  91. omit_from_output="y"
  92. script="adapt_consider"
  93. sequence="100"
  94. >
  95. </trigger>
  96. <trigger
  97. enabled="n"
  98. group="consider"
  99. match="*Challenging * would be either very brave or very stupid."
  100. omit_from_output="y"
  101. script="adapt_consider"
  102. sequence="100"
  103. >
  104. </trigger>
  105. <trigger
  106. enabled="n"
  107. group="consider"
  108. match="No Problem! * is weak compared to you."
  109. omit_from_output="y"
  110. script="adapt_consider"
  111. sequence="100"
  112. >
  113. </trigger>
  114. <trigger
  115. enabled="n"
  116. group="consider"
  117. match="You would be completely annihilated by *!"
  118. omit_from_output="y"
  119. script="adapt_consider"
  120. sequence="100"
  121. >
  122. </trigger>
  123. <trigger
  124. enabled="n"
  125. group="consider"
  126. match="You would stomp * into the ground."
  127. omit_from_output="y"
  128. script="adapt_consider"
  129. sequence="100"
  130. >
  131. </trigger>
  132. <trigger
  133. enabled="n"
  134. group="consider"
  135. match="^(.*?) chuckles at the thought of you fighting (him|her|it)\.$"
  136. omit_from_output="y"
  137. regexp="y"
  138. script="adapt_consider"
  139. sequence="100"
  140. >
  141. </trigger>
  142. <trigger
  143. enabled="n"
  144. group="consider"
  145. match="^You see no one here but yourself\!$"
  146. keep_evaluating="y"
  147. omit_from_output="y"
  148. regexp="y"
  149. script="adapt_consider"
  150. sequence="100"
  151. >
  152. </trigger>
  153. <trigger
  154. enabled="n"
  155. group="consider"
  156. match="^nhm$"
  157. omit_from_output="y"
  158. keep_evaluating="n"
  159. regexp="y"
  160. script="Nuke"
  161. send_to="12"
  162. sequence="1"
  163. >
  164. </trigger>
  165. <trigger
  166. enabled="n"
  167. group="auto_consider"
  168. match="^You receive .+ experience points\.$"
  169. omit_from_output="n"
  170. keep_evaluating="y"
  171. regexp="y"
  172. script="send_consider"
  173. send_to="12"
  174. sequence="1"
  175. >
  176. </trigger>
  177. <trigger
  178. enabled="n"
  179. group="auto_consider"
  180. match="\[ Exits\:.+$"
  181. omit_from_output="n"
  182. keep_evaluating="y"
  183. regexp="y"
  184. script="send_consider"
  185. send_to="12"
  186. sequence="1"
  187. >
  188. </trigger>
  189. <trigger
  190. enabled="n"
  191. group="auto_consider"
  192. match="^A (.+) has fled\!$"
  193. omit_from_output="n"
  194. keep_evaluating="y"
  195. regexp="y"
  196. script="send_consider"
  197. send_to="12"
  198. sequence="1"
  199. >
  200. </trigger>
  201. </triggers>
  202.  
  203. <aliases>
  204. <alias
  205. script="conw"
  206. match="^conw\s(.*)$"
  207. keep_evaluating="y"
  208. enabled="y"
  209. regexp="y"
  210. send_to="12"
  211. sequence="100"
  212. >
  213. </alias>
  214. <alias
  215. script="send_consider"
  216. match="^conw$"
  217. keep_evaluating="y"
  218. enabled="y"
  219. regexp="y"
  220. send_to="12"
  221. sequence="99"
  222. >
  223. </alias>
  224. </aliases>
  225. <!-- Script -->
  226. <script>
  227. <![CDATA[
  228. consider_messages_full = {
  229. ["You would stomp (.+) into the ground%."] =
  230. { range = "-19 and below", colour = "gray", },
  231. ["(.+) would be easy, but is it even worth the work out%?"] =
  232. { range = "-10 to -19", colour = "darkgreen", },
  233. ["No Problem%! (.+) is weak compared to you%."] =
  234. { range = "-6 to -9", colour = "forestgreen", },
  235. ["(.+) looks a little worried about the idea%."] =
  236. { range = "-2 to -6", colour = "chartreuse", },
  237. ["(.+) should be a fair fight%!"] =
  238. { range = "-2 to +2", colour = "springgreen", },
  239. ["(.+) snickers nervously%."] =
  240. { range = "+2 to +3", colour = "darkgoldenrod", },
  241. ["(.+) chuckles at the thought of you fighting .+%."] =
  242. { range = "+3 to +8", colour = "gold", },
  243. [".*Best run away from (.+) while you can%!"] =
  244. { range = "+8 to +16", colour = "tomato", },
  245. [".*Challenging (.+) would be either very brave or very stupid%."] =
  246. { range = "+16 to +21", colour = "crimson", },
  247. ["(.+) would crush you like a bug%!"] =
  248. { range = "+21 to +32", colour = "lightpink", },
  249. ["(.+) would dance on your grave%!"] =
  250. { range = "+32 to +41", colour = "darkmagenta", },
  251. ["(.+) says 'BEGONE FROM MY SIGHT unworthy%!'"] =
  252. { range = "+41 to +50", colour = "darkviolet", },
  253. ["You would be completely annihilated by (.+)%!"] =
  254. { range = "+50 and above", colour = "magenta", },
  255. } -- end of consider_messages
  256.  
  257. consider_messages = {
  258. ["(.+) looks a little worried about the idea%."] =
  259. { range = "-2 to -6", colour = "chartreuse", },
  260. ["(.+) should be a fair fight%!"] =
  261. { range = "-2 to +2", colour = "springgreen", },
  262. ["(.+) snickers nervously%."] =
  263. { range = "+2 to +3", colour = "darkgoldenrod", },
  264. ["(.+) chuckles at the thought of you fighting .+%."] =
  265. { range = "+3 to +8", colour = "gold", },
  266. [".*Best run away from (.+) while you can%!"] =
  267. { range = "+8 to +16", colour = "tomato", },
  268.  
  269. } -- end of consider_messages
  270.  
  271. replaceT = { -- words to remove from mob names to get the keyword
  272. ["a"] = "",
  273. ["A"] = "",
  274. ["an"] = "",
  275. ["An"] = "",
  276. ["the"] = "",
  277. ["The"] = "",
  278. ["of"] = "",
  279. ["Of"] = "",
  280. ["captured"] = "",
  281. ["damned"] = "",
  282. ["yummy"] = "",
  283. ["looking"] = "",
  284. ["wanders"] = "",
  285. ["beef"] = "",
  286. ["pot"] = "",
  287. ["scrumptious"] = "",
  288. ["tortured"] = "",
  289. ["Hell"] = "",
  290. ["largest"] = "",
  291. ["older"] = "",
  292. ["slithering"] = "",
  293. ["tiny"] = "",
  294. ["huge"] = ""
  295. }
  296.  
  297. targets = {}
  298.  
  299. function keyword_change (name, line, wildcards)
  300. if keyword_position == "end" then
  301. SetVariable ("keyword_position", "beginning")
  302. else
  303. SetVariable ("keyword_position", "end")
  304. end
  305. keyword_position = GetVariable ("keyword_position")
  306.  
  307. ColourTell ("white", "blue", "Keywords will now be taken from the " .. keyword_position .. " of Mobile names. ")
  308. ColourNote ("", "black", " ")
  309. end -- keyword_position
  310.  
  311. function conw (name, line, wildcards)
  312. -- Usage
  313. if wildcards[1] == "?" then
  314. a = {
  315. "conw - Update window with consider all command",
  316. "conw <word> - Set default command",
  317. "conw swap - Swap keyword detection from beginning of desc to end, or vice-versa",
  318. "conw auto - Toggle auto nuke, on room entry and after combat",
  319. "conw ? - Show this message",
  320. "conw secondary - Toggle whether to use secondary ability after default command",
  321. "conw secondary <word> - Sets the secondary command to use"
  322. }
  323. for i,v in ipairs(a) do
  324. ColourTell ("yellow", GetInfo(271), v:sub(1, v:find("-") - 1))
  325. ColourNote ("white", GetInfo(271), v:sub(v:find("-"), v:len()))
  326. end
  327. return
  328. end
  329.  
  330. if wildcards[1] == "auto" then
  331. if tonumber (GetVariable ("auto_conw")) == 1 then
  332. SetVariable ("auto_conw", 0)
  333. EnableTriggerGroup ("auto_consider", 0)
  334. ColourTell ("white", "blue", "Auto consider off.")
  335. ColourNote ("", "black", " ")
  336. else
  337. SetVariable ("auto_conw", 1)
  338. EnableTriggerGroup ("auto_consider", 1)
  339. ColourTell ("white", "blue", "Auto consider on.")
  340. ColourNote ("", "black", " ")
  341. end
  342. return
  343. end
  344.  
  345. if string.find(wildcards[1], "secondary") then
  346. if wildcards[1] ~= "secondary" then
  347. --Setting alternate attack skill
  348. secondary_check = wildcards[1]:gsub("secondary ","")
  349. if tonumber(secondary_check) then
  350. secondary_loop_count = secondary_check
  351. SetVariable("conw_secondary_loop", secondary_loop_count)
  352. print("Setting number of secondary attacks to: " .. secondary_check)
  353. elseif secondary_check == 'balor' then
  354. useBalor = tonumber(GetVariable("conw_use_balor"))
  355. if not useBalor then
  356. useBalor = 0
  357. end
  358. if useBalor == 1 then
  359. print("Turning balor off")
  360. SetVariable("conw_use_balor", 0)
  361. else
  362. print("Turning balor on")
  363. SetVariable("conw_use_balor", 1)
  364. end
  365. else
  366. SetVariable("conw_secondary_ability", secondary_check)
  367. print("Setting secondary command to: " .. secondary_check)
  368. end
  369. else
  370. useSecondary = tonumber(GetVariable ("conw_use_secondary"))
  371. if useSecondary == 0 then
  372. print("Toggling use secondary ability on")
  373. SetVariable("conw_use_secondary", 1)
  374. else
  375. print("Toggling use secondary ability off")
  376. SetVariable("conw_use_secondary", 0)
  377. end
  378. end
  379. end
  380.  
  381. if wildcards[1] == "swap" then
  382. keyword_change ()
  383. return
  384. end
  385.  
  386. if wildcards[1] and wildcards[1]:match ("^[%w%s]+$") and not string.find(wildcards[1], "secondary") then
  387. SetVariable ("default_command", wildcards[1])
  388. default_command = GetVariable ("default_command")
  389. ColourTell ("white", "blue", "Default command: " .. wildcards[1])
  390. ColourNote ("", "black", " ")
  391. end
  392. end -- send_consider
  393.  
  394. function send_consider ()
  395. if GetVariable ("doing_consider") == "true" then
  396. return
  397. end
  398.  
  399. SetVariable ("doing_consider", "true")
  400. EnableTriggerGroup ("consider", true)
  401. SendNoEcho ("consider all")
  402. Send ("echo nhm")
  403. targets = {}
  404. end -- send_consider
  405.  
  406. function KKND (id)
  407. if not id then
  408. return
  409. end
  410.  
  411. Execute (default_command .. " " .. id)
  412. targets [id] = nil
  413. end -- KKND
  414.  
  415. function adapt_consider (name, line, wildcards)
  416. for k, v in pairs (consider_messages) do
  417. mob = string.match (line, k) or nil
  418. if keyword_position == "end" then
  419. sPat = "[%w\\-]+$"
  420. else
  421. sPat = "^[%w\\-]+"
  422. end
  423. if mob then
  424. t = {
  425. keyword = mob:gsub ("%w+", function (str) return replaceT [str] end ):gsub("^%s+", ""):gsub("%s+$", ""):match(sPat),
  426. name = mob,
  427. line = line,
  428. -- colour = v.colour,
  429. -- range = "(" .. v.range .. ")",
  430. message = line
  431. }
  432. table.insert (targets, t)
  433. break
  434. end -- if
  435. end -- for
  436. end -- adapt_consider
  437.  
  438. function Nuke ()
  439. for i,v in ipairs (targets) do
  440. if i == 1 then
  441. KKND(v.keyword)
  442. end
  443. end
  444. useBalor = tonumber(GetVariable("conw_use_balor"))
  445. if #targets > 0 and useBalor == 1 then
  446. Send("balor")
  447. end
  448. useSecondary = tonumber(GetVariable ("conw_use_secondary"))
  449. secondary_command = GetVariable("conw_secondary_ability")
  450. secondaryLoopCount = GetVariable("conw_secondary_loop")
  451. if #targets > 0 and useSecondary == 1 then
  452. for i = 1,secondaryLoopCount,1 do
  453. Send(secondary_command)
  454. end
  455. end
  456. SetVariable ("doing_consider", "false")
  457. EnableTriggerGroup ("consider", false)
  458.  
  459. end -- Nuke
  460.  
  461. function OnPluginInstall ()
  462. default_command = GetVariable ("default_command") or "kill"
  463. keyword_position = GetVariable ("keyword_position") or "end"
  464.  
  465. SetVariable ("doing_consider", "false")
  466.  
  467. auto_conw = GetVariable ("auto_conw") or 1
  468.  
  469. EnableTriggerGroup ("auto_consider", auto_conw)
  470.  
  471. if GetVariable ("enabled") == "false" then
  472. ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
  473. check (EnablePlugin(GetPluginID (), false))
  474. return
  475. end
  476.  
  477. OnPluginEnable ()
  478. end -- OnPluginInstall
  479.  
  480. function OnPluginEnable ()
  481. -- NOP
  482. end
  483.  
  484. function OnPluginDisable ()
  485. -- NOP
  486. end
  487.  
  488. function OnPluginSaveState ()
  489. SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
  490. SetVariable ("doing_consider", "false")
  491. end -- OnPluginSaveState
  492. ]]>
  493. </script>
  494. </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement