Advertisement
amandajean1

Hour Double Tracker

Apr 20th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.03 KB | None | 0 0
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE muclient>
  3. <!-- Saved on sobota, listopad 09, 2013, 9:39 -->
  4. <!-- MuClient version 4.89 -->
  5.  
  6. <!-- Plugin "HourDouble" generated by Plugin Wizard -->
  7.  
  8. <muclient>
  9. <plugin
  10. name="HourDouble"
  11. author="Divlia"
  12. id="f6db3901f93ddacfa45549f1"
  13. language="Lua"
  14. purpose="Predicts an hour double"
  15. date_written="2013-11-09 09:37:31"
  16. requires="4.73"
  17. version="1.0"
  18. save_state="y"
  19. >
  20.  
  21. </plugin>
  22.  
  23.  
  24. <!-- Get our standard constants -->
  25.  
  26. <include name="constants.lua"/>
  27.  
  28. <!-- Triggers -->
  29.  
  30. <triggers>
  31.  
  32. <trigger
  33. enabled="n"
  34. group="gamestat"
  35. send_to="12"
  36. sequence="100"
  37. match="eog"
  38. omit_from_output="y"
  39. >
  40. <send>
  41. EnableTriggerGroup ("gamestat", 0)
  42. </send>
  43. </trigger>
  44.  
  45. <trigger
  46. enabled="n"
  47. group="gamestat"
  48. match="------------- AARDWOLF MUD ACTIVITY MONITOR ---------"
  49. omit_from_output="y"
  50. sequence="100"
  51. >
  52. </trigger>
  53.  
  54. <trigger
  55. enabled="n"
  56. group="gamestat"
  57. match="-------------------------------------------------------"
  58. omit_from_output="y"
  59. sequence="100"
  60. >
  61. </trigger>
  62.  
  63. <trigger
  64. enabled="n"
  65. group="gamestat"
  66. match=" ------------ -----------"
  67. omit_from_output="y"
  68. sequence="100"
  69. >
  70. </trigger>
  71.  
  72. <trigger
  73. enabled="n"
  74. group="gamestat"
  75. match=" Since Reboot Since Added"
  76. omit_from_output="y"
  77. sequence="100"
  78. >
  79. </trigger>
  80.  
  81. <trigger
  82. enabled="n"
  83. group="gamestat"
  84. match="'Since added' shows totals since 29th August 1997."
  85. omit_from_output="y"
  86. sequence="100"
  87. >
  88. </trigger>
  89.  
  90. <trigger
  91. enabled="n"
  92. group="gamestat"
  93. match="New Players : *"
  94. omit_from_output="y"
  95. sequence="100"
  96. >
  97. </trigger>
  98.  
  99. <trigger
  100. enabled="n"
  101. group="gamestat"
  102. match="Deletions : *"
  103. omit_from_output="y"
  104. sequence="100"
  105. >
  106. </trigger>
  107.  
  108. <trigger
  109. enabled="n"
  110. group="gamestat"
  111. match="Levels Gained : *"
  112. omit_from_output="y"
  113. sequence="100"
  114. >
  115. </trigger>
  116.  
  117. <trigger
  118. enabled="n"
  119. group="gamestat"
  120. match="Player Deaths : *"
  121. omit_from_output="y"
  122. sequence="100"
  123. >
  124. </trigger>
  125.  
  126. <trigger
  127. enabled="n"
  128. group="gamestat"
  129. match="Number of Wars : *"
  130. omit_from_output="y"
  131. sequence="100"
  132. >
  133. </trigger>
  134.  
  135. <trigger
  136. enabled="n"
  137. group="gamestat"
  138. match="Warfare Deaths : *"
  139. omit_from_output="y"
  140. sequence="100"
  141. >
  142. </trigger>
  143.  
  144. <trigger
  145. enabled="n"
  146. group="gamestat"
  147. match="Combat Maze Kills: *"
  148. omit_from_output="y"
  149. sequence="100"
  150. >
  151. </trigger>
  152.  
  153. <trigger
  154. enabled="n"
  155. group="gamestat"
  156. match="Number of Logins : *"
  157. omit_from_output="y"
  158. sequence="100"
  159. >
  160. </trigger>
  161.  
  162. <trigger
  163. enabled="n"
  164. group="gamestat"
  165. match="Most Online : *"
  166. omit_from_output="y"
  167. sequence="100"
  168. >
  169. </trigger>
  170.  
  171. <trigger
  172. enabled="n"
  173. group="gamestat"
  174. match="Notes Posted : *"
  175. omit_from_output="y"
  176. sequence="100"
  177. >
  178. </trigger>
  179.  
  180. <trigger
  181. enabled="n"
  182. group="gamestat"
  183. match="Quests Taken : *"
  184. omit_from_output="y"
  185. sequence="100"
  186. >
  187. </trigger>
  188.  
  189. <trigger
  190. enabled="n"
  191. group="gamestat"
  192. match="Quests Completed : *"
  193. omit_from_output="y"
  194. sequence="100"
  195. >
  196. </trigger>
  197.  
  198. <trigger
  199. enabled="n"
  200. group="gamestat"
  201. match="Quests Failed : *"
  202. omit_from_output="y"
  203. sequence="100"
  204. >
  205. </trigger>
  206.  
  207. <trigger
  208. enabled="n"
  209. group="gamestat"
  210. match="Total QP Given : *"
  211. omit_from_output="y"
  212. sequence="100"
  213. >
  214. </trigger>
  215.  
  216. <trigger
  217. enabled="n"
  218. group="gamestat"
  219. match="Campaigns Done : *"
  220. omit_from_output="y"
  221. sequence="100"
  222. >
  223. </trigger>
  224.  
  225. <trigger
  226. enabled="n"
  227. group="gamestat"
  228. match="Campaigns Failed : *"
  229. omit_from_output="y"
  230. sequence="100"
  231. >
  232. </trigger>
  233. <trigger
  234. enabled="n"
  235. group="gamestat"
  236. match="^Mob\sDeaths\s+\:\s+([0-9,]+)\s+([0-9,]+)$"
  237. name="MobDeaths"
  238. omit_from_log="y"
  239. script="predict"
  240. regexp="y"
  241. sequence="100"
  242. >
  243. </trigger>
  244.  
  245.  
  246. <trigger
  247. enabled="n"
  248. group="gamestat"
  249. match="Triv Mobs Killed : *"
  250. omit_from_output="y"
  251. sequence="100"
  252. >
  253. </trigger>
  254.  
  255. <trigger
  256. enabled="n"
  257. group="gamestat"
  258. match="Total Auctions : *"
  259. omit_from_output="y"
  260. sequence="100"
  261. >
  262. </trigger>
  263.  
  264. <trigger
  265. enabled="n"
  266. group="gamestat"
  267. match="Auctions Sold : *"
  268. omit_from_output="y"
  269. sequence="100"
  270. >
  271. </trigger>
  272.  
  273. <trigger
  274. enabled="n"
  275. group="gamestat"
  276. match="Auctions Unsold : *"
  277. omit_from_output="y"
  278. sequence="100"
  279. >
  280. </trigger>
  281.  
  282. <trigger
  283. enabled="n"
  284. group="gamestat"
  285. match="Marriages : *"
  286. omit_from_output="y"
  287. sequence="100"
  288. >
  289. </trigger>
  290.  
  291. <trigger
  292. enabled="n"
  293. group="gamestat"
  294. match="New Nobles : *"
  295. omit_from_output="y"
  296. sequence="100"
  297. >
  298. </trigger>
  299.  
  300. <trigger
  301. enabled="n"
  302. group="gamestat"
  303. match="New Superheroes : *"
  304. omit_from_output="y"
  305. sequence="100"
  306. >
  307. </trigger>
  308.  
  309. <trigger
  310. enabled="n"
  311. group="gamestat"
  312. match="New Remorts : *"
  313. omit_from_output="y"
  314. sequence="100"
  315. >
  316. </trigger>
  317. </triggers>
  318.  
  319. <!-- Aliases -->
  320.  
  321. <aliases>
  322. <alias
  323. match="hourdbl"
  324. enabled="y"
  325. send_to="12"
  326. sequence="100"
  327. >
  328. <send>
  329. EnableTriggerGroup ("gamestat", 1)
  330. SendNoEcho("gamestat 5")
  331. Send ("echo eog")
  332. </send>
  333. </alias>
  334.  
  335. <alias
  336. match="hourdbl set"
  337. enabled="y"
  338. send_to="12"
  339. sequence="100"
  340. script="set"
  341. >
  342. </alias>
  343.  
  344. <alias
  345. match="hourdbl gt"
  346. enabled="y"
  347. send_to="12"
  348. sequence="100"
  349. script="gt"
  350. >
  351. </alias>
  352.  
  353. <alias
  354. match="hourdbl short"
  355. enabled="y"
  356. send_to="12"
  357. sequence="100"
  358. script="short"
  359. >
  360. </alias>
  361.  
  362. <alias
  363. match="hourdbl spamm *"
  364. enabled="y"
  365. send_to="12"
  366. sequence="100"
  367. script="spamm"
  368. >
  369. </alias>
  370.  
  371. </aliases>
  372.  
  373. <!-- Timers -->
  374.  
  375. <timers>
  376.  
  377. <timer
  378. name="tim_init_plugin"
  379. script="init_plugin"
  380. enabled="y"
  381. second="1">
  382. </timer>
  383.  
  384. </timers>
  385.  
  386. <!-- Script -->
  387.  
  388. <script>
  389. <![CDATA[
  390.  
  391. local smobs = "0"
  392. local stime = 0
  393. local init_called = 0
  394.  
  395. function spamm (name, line, wildcards)
  396. SetVariable ("mins", wildcards[1])
  397. if GetVariable ("mins") == "" then
  398. SetVariable ("mins", "0")
  399. end
  400. if (tonumber(GetVariable ("mins")) < 0) or (tonumber(GetVariable ("mins")) > 59) then
  401. SetVariable ("mins", "0")
  402. ColourNote("darkorange", "", "Mins are 0-59.")
  403. end
  404. ColourNote("darkorange", "", "Spamming every x mins (type 'hourdbl spamm <mins>' to set) "..GetVariable ("mins"))
  405. CreateTimer()
  406. end
  407.  
  408. function gt()
  409. if GetVariable ("gt") == "0" then
  410. SetVariable ("gt", "1")
  411. ColourNote("darkorange", "", "Reporting on gt? (type 'hourdbl gt' to toggle) YES")
  412. else
  413. SetVariable ("gt", "0")
  414. ColourNote("darkorange", "", "Reporting on gt? (type 'hourdbl gt' to toggle) NO")
  415. end
  416. end
  417.  
  418. function short()
  419. if GetVariable ("short") == "0" then
  420. SetVariable ("short", "1")
  421. ColourNote("darkorange", "", "Short version? (type 'hourdbl short' to toggle) YES")
  422. else
  423. SetVariable ("short", "0")
  424. ColourNote("darkorange", "", "Short version? (type 'hourdbl short' to toggle) NO")
  425. end
  426. end
  427.  
  428. function set()
  429. if GetVariable ("gt") == "1" then
  430. ColourNote("darkorange", "", "Reporting on gt? (type 'hourdbl gt' to toggle) YES")
  431. else
  432. ColourNote("darkorange", "", "Reporting on gt? (type 'hourdbl gt' to toggle) NO")
  433. end
  434. if GetVariable ("short") == "1" then
  435. ColourNote("darkorange", "", "Short version? (type 'hourdbl short' to toggle) YES")
  436. else
  437. ColourNote("darkorange", "", "Short version? (type 'hourdbl short' to toggle) NO")
  438. end
  439. ColourNote("darkorange", "", "Spamming every x mins (type 'hourdbl spamm <mins>' to set) "..GetVariable ("mins"))
  440. end
  441.  
  442. function init_plugin()
  443. if init_called == 0 then
  444. Execute("sendgmcp request char")
  445. local localchar = char_status
  446. if (localchar ~= nil and tonumber(localchar.state) == 3) then
  447. init_called = 1
  448. EnableTimer("tim_init_plugin", false)
  449. Execute("hourdbl")
  450. end
  451. end
  452. end
  453.  
  454. function OnPluginBroadcast (msg, id, name, text)
  455. if text == "char.status" then
  456. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char.status")
  457. luastmt = "gmcpdatacharstatus = " .. gmcparg
  458. assert (loadstring (luastmt or "")) ()
  459. char_status = gmcpdatacharstatus
  460. end
  461. end
  462.  
  463. function predict (name, line, wildcards)
  464. wildcards[1] = wildcards[2]:gsub(",", "")
  465. for w in string.gfind (wildcards[1], "%w+") do
  466. cmobs = w
  467. break
  468. end
  469. if smobs == "0" then
  470. smobs = cmobs
  471. stime = os.time ()
  472. if GetVariable ("mins") ~= "0" then
  473. CreateTimer()
  474. end
  475. else
  476. time_duration = math.abs(os.difftime (stime, os.time ()))
  477. time_dd = (math.floor(math.abs(time_duration/86400)))
  478. time_hh = (math.floor(math.abs((time_duration/3600)-(time_dd*24))))
  479. time_mm = (math.floor(math.abs((time_duration/60)-(time_dd*1440)-(time_hh*60))))
  480. time_mmfull = (math.floor(math.abs((time_duration/60))))
  481. time_ss = time_duration-(time_mmfull*60)
  482. rate = (tonumber(cmobs)-tonumber(smobs)) / time_duration
  483. mobsleft = math.ceil(cmobs / 1000000)*1000000 - cmobs
  484. timeleft = math.ceil(mobsleft / rate)
  485. timel_dd = (math.floor(math.abs(timeleft/86400)))
  486. timel_hh = (math.floor(math.abs((timeleft/3600)-(timel_dd*24))))
  487. timel_mm = (math.floor(math.abs((timeleft/60)-(timel_dd*1440)-(timel_hh*60))))
  488. timel_mmfull = (math.floor(math.abs((timeleft/60))))
  489. timel_ss = timeleft-(timel_mmfull*60)
  490. stimeleft = ""
  491. if timel_dd ~= 0 then
  492. stimeleft = stimeleft.." "..timel_dd.." days"
  493. end
  494. if timel_hh ~= 0 then
  495. stimeleft = stimeleft.." "..timel_hh.." hours"
  496. end
  497. if timel_mm ~= 0 then
  498. stimeleft = stimeleft.." "..timel_mm.." minutes"
  499. end
  500. if timel_ss ~= 0 then
  501. stimeleft = stimeleft.." "..timel_ss.." seconds"
  502. end
  503. if GetVariable ("short") == "0" then
  504. timepassed = ""
  505. if time_dd ~= 0 then
  506. timepassed = timepassed..time_dd.." days "
  507. end
  508. if time_hh ~= 0 then
  509. timepassed = timepassed..time_hh.." hours "
  510. end
  511. if time_mm ~= 0 then
  512. timepassed = timepassed..time_mm.." minutes "
  513. end
  514. if time_ss ~= 0 then
  515. timepassed = timepassed..time_ss.." seconds "
  516. end
  517.  
  518. msg = "In "..timepassed.."we killed "..tonumber(cmobs)-tonumber(smobs).." monsters with a rate of "..string.format("%.2f", rate).." per second. To reach an hour double we still need to kill "..
  519. string.format("%i", mobsleft).." monsters and it will take us"..stimeleft.."."
  520. else
  521. msg = "An hour double will occur in"..stimeleft.."."
  522. end
  523. if GetVariable ("gt") == "0" then
  524. ColourNote("darkorange", "", msg)
  525. else
  526. SendNoEcho("gt @G"..msg)
  527. end
  528. end
  529. end
  530.  
  531. function OnPluginInstall ()
  532. ColourNote("darkorange", "", "HourDouble installed. Type 'hourdbl' to predict or 'hourdbl set' for options.")
  533. if GetVariable ("short") == nil then
  534. SetVariable ("short", "1")
  535. end
  536. if GetVariable ("gt") == nil then
  537. SetVariable ("gt", "0")
  538. end
  539. if GetVariable ("mins") == nil then
  540. SetVariable ("mins", "0")
  541. end
  542. end
  543.  
  544. function timerfunc()
  545. Execute("hourdbl")
  546. end
  547.  
  548. function CreateTimer()
  549. DeleteTimer("hourdbltimer")
  550. if (tonumber(GetVariable ("mins")) > 0) or (tonumber(GetVariable ("mins")) <= 59) then
  551. AddTimer("hourdbltimer", 0, tonumber(GetVariable ("mins")), 0, "", timer_flag.Enabled, "timerfunc")
  552. end
  553. end
  554.  
  555. ]]>
  556. </script>
  557.  
  558. </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement