Advertisement
Guest User

RID V2.1

a guest
Mar 27th, 2020
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.37 KB | None | 0 0
  1. <muclient>
  2. <plugin
  3. name="Nok3_Report_Identify"
  4. author="Nokfah"
  5. id="a5b534a09df80b4093cabbfd"
  6. language="Lua"
  7. purpose="Report item stats to a channel"
  8. version="1.2"
  9. >
  10. <description trim="n">
  11. <![CDATA[
  12. ==================== Report Identify Help ====================
  13. rid (id|spell|lore) - sets the method used to identify
  14.  
  15. rid <item> worn(optional) <channel>(optional) - reports the identify results of an item
  16.  
  17. rid <bag id> <channel>(optional) - reports the identify results all the contents of a bag using its id
  18. ]]>
  19. </description>
  20. </plugin>
  21.  
  22. <!-- Get our standard constants -->
  23. <include name="constants.lua"/>
  24.  
  25. <aliases>
  26. <alias
  27. regexp="y" match="^rid (id|spell|lore|lbid)$"
  28. enabled="y" sequence="50"
  29. send_to="12" script="SetIDType"
  30. >
  31. </alias>
  32.  
  33. <alias
  34. regexp="y" match="^rid help$"
  35. enabled="y" sequence="50"
  36. send_to="12" script="Help"
  37. >
  38. </alias>
  39.  
  40. <alias
  41. regexp="y" match="^rid (?<num>[0-9]+\.)?'(?<item>[\w\d\s]+)'(?<channel> [\w\s]+)?$"
  42. enabled="y" sequence="100"
  43. send_to="12" script="Identify"
  44. >
  45. </alias>
  46.  
  47. <alias
  48. regexp="y" match="^rid (?<num>[0-9]+\.)?(?<item>[\w\d]+ worn)(?<channel> [\w\s]+)?$"
  49. enabled="y" sequence="200"
  50. send_to="12" script="Identify"
  51. >
  52. </alias>
  53.  
  54. <alias
  55. regexp="y" match="^rid (?<num>[0-9]+\.)?(?<item>[\w\d]+)(?<channel> [\w\s]+)?$"
  56. enabled="y" sequence="300"
  57. send_to="12" script="Identify"
  58. >
  59. </alias>
  60.  
  61. <alias
  62. regexp="y" match="^rid bag (?<bag>[0-9]+)(?<channel> [\w\s]+)?$"
  63. enabled="y" sequence="50"
  64. send_to="12" script="BagIdentify"
  65. >
  66. </alias>
  67. </aliases>
  68.  
  69. <triggers>
  70. <trigger name="invdata_start"
  71. match="^\{invdata [0-9]+\}$"
  72. regexp="y" enabled="n"
  73. keep_evaluating="y"
  74. send_to="12" script="InvdataStart"
  75. >
  76. </trigger>
  77.  
  78. <trigger name="invdata_capture"
  79. match="^([0-9]+),.*"
  80. regexp="y" enabled="n"
  81. keep_evaluating="y"
  82. send_to="12" script="InvdataCapture"
  83. >
  84. </trigger>
  85.  
  86. <trigger name="invdata_end"
  87. match="^\{/invdata\}$"
  88. regexp="y" enabled="n"
  89. keep_evaluating="y"
  90. send_to="12" script="InvdataEnd"
  91. >
  92. </trigger>
  93.  
  94. <trigger name="identify_start"
  95. match="+-----------------------------------------------------------------+"
  96. enabled="n"
  97. send_to="12" script="IdentifyStart"
  98. >
  99. </trigger>
  100.  
  101. <trigger group="info_capture"
  102. match="(?<attr>Id) : (?<val>\d*)"
  103. regexp="y" enabled="n"
  104. keep_evaluating="y"
  105. send_to="12" script="InfoCapture"
  106. >
  107. </trigger>
  108.  
  109. <trigger group="info_capture"
  110. match="(?<attr>Name) : (?<val>.*)\|"
  111. regexp="y" enabled="n"
  112. keep_evaluating="y"
  113. send_to="12" script="NameCapture"
  114. >
  115. </trigger>
  116.  
  117. <trigger group="info_capture"
  118. match="(?<attr>Level) :\s+(?<val>[0-9]+)"
  119. regexp="y" enabled="n"
  120. keep_evaluating="y"
  121. send_to="12" script="InfoCapture"
  122. >
  123. </trigger>
  124.  
  125. <trigger group="info_capture"
  126. match="(?<attr>Weight) :\s+(?<val>[0-9]+)"
  127. regexp="y" enabled="n"
  128. keep_evaluating="y"
  129. send_to="12" script="InfoCapture"
  130. >
  131. </trigger>
  132.  
  133. <trigger group="info_capture"
  134. match="(?<attr>Wearable) :\s+(?<val>\w+)"
  135. regexp="y" enabled="n"
  136. keep_evaluating="y"
  137. send_to="12" script="InfoCapture"
  138. >
  139. </trigger>
  140.  
  141. <trigger group="info_capture"
  142. match="(?<attr>Weapon Type):\s+(?<val>\w+)"
  143. regexp="y" enabled="n"
  144. keep_evaluating="y"
  145. send_to="12" script="InfoCapture"
  146. >
  147. </trigger>
  148.  
  149. <trigger group="info_capture"
  150. match="(?<attr>Average Dam) :\s+(?<val>[0-9]+)"
  151. regexp="y" enabled="n"
  152. keep_evaluating="y"
  153. send_to="12" script="InfoCapture"
  154. >
  155. </trigger>
  156.  
  157. <trigger group="info_capture"
  158. match="(?<attr>Damage Type) :\s+(?<val>\w+)"
  159. regexp="y" enabled="n"
  160. keep_evaluating="y"
  161. send_to="12" script="InfoCapture"
  162. >
  163. </trigger>
  164.  
  165. <trigger group="info_capture"
  166. match="(?<attr>Specials) :\s+(?<val>\D+)\s+\|"
  167. regexp="y" enabled="n"
  168. keep_evaluating="y"
  169. send_to="12" script="InfoCapture"
  170. >
  171. </trigger>
  172.  
  173. <trigger group="info_capture"
  174. match="(?<attr>Score) :\s+(?<sign>[+-])?(?<val>[0-9]+)"
  175. regexp="y" enabled="n"
  176. keep_evaluating="y"
  177. send_to="12" script="InfoCapture"
  178. >
  179. </trigger>
  180.  
  181. <trigger group="info_capture"
  182. match="(solidified)"
  183. regexp="y" enabled="n"
  184. keep_evaluating="y"
  185. send_to="12" script="FlagCapture"
  186. >
  187. </trigger>
  188.  
  189. <trigger group="info_capture"
  190. match="(resonated)"
  191. regexp="y" enabled="n"
  192. keep_evaluating="y"
  193. send_to="12" script="FlagCapture"
  194. >
  195. </trigger>
  196.  
  197. <trigger group="info_capture"
  198. match="(illuminated)"
  199. regexp="y" enabled="n"
  200. keep_evaluating="y"
  201. send_to="12" script="FlagCapture"
  202. >
  203. </trigger>
  204.  
  205. <trigger group="info_capture"
  206. match="(?<attr>Strength)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  207. regexp="y" enabled="n" keep_evaluating="y"
  208. send_to="12" script="InfoCapture"
  209. ></trigger>
  210. <trigger group="info_capture"
  211. match="(?<attr>Intelligence)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  212. regexp="y" enabled="n" keep_evaluating="y"
  213. send_to="12" script="InfoCapture"
  214. ></trigger>
  215. <trigger group="info_capture"
  216. match="(?<attr>Wisdom)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  217. regexp="y" enabled="n" keep_evaluating="y"
  218. send_to="12" script="InfoCapture"
  219. ></trigger>
  220. <trigger group="info_capture"
  221. match="(?<attr>Dexterity)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  222. regexp="y" enabled="n" keep_evaluating="y"
  223. send_to="12" script="InfoCapture"
  224. ></trigger>
  225. <trigger group="info_capture"
  226. match="(?<attr>Constitution)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  227. regexp="y" enabled="n" keep_evaluating="y"
  228. send_to="12" script="InfoCapture"
  229. ></trigger>
  230. <trigger group="info_capture"
  231. match="(?<attr>Luck)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  232. regexp="y" enabled="n" keep_evaluating="y"
  233. send_to="12" script="InfoCapture"
  234. ></trigger>
  235. <trigger group="info_capture"
  236. match="(?<attr>Hit roll)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  237. regexp="y" enabled="n" keep_evaluating="y"
  238. send_to="12" script="InfoCapture"
  239. ></trigger>
  240. <trigger group="info_capture"
  241. match="(?<attr>Damage roll)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  242. regexp="y" enabled="n" keep_evaluating="y"
  243. send_to="12" script="InfoCapture"
  244. ></trigger>
  245. <trigger group="info_capture"
  246. match="(?<attr>Hit points)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  247. regexp="y" enabled="n" keep_evaluating="y"
  248. send_to="12" script="InfoCapture"
  249. ></trigger>
  250. <trigger group="info_capture"
  251. match="(?<attr>Mana)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  252. regexp="y" enabled="n" keep_evaluating="y"
  253. send_to="12" script="InfoCapture"
  254. ></trigger>
  255. <trigger group="info_capture"
  256. match="(?<attr>Moves)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  257. regexp="y" enabled="n" keep_evaluating="y"
  258. send_to="12" script="InfoCapture"
  259. ></trigger>
  260.  
  261. <!-- resists -->
  262. <trigger group="info_capture"
  263. match="(?<attr>All magic)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  264. regexp="y" enabled="n" keep_evaluating="y"
  265. send_to="12" script="InfoCapture"
  266. ></trigger>
  267. <trigger group="info_capture"
  268. match="(?<attr>All physical)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  269. regexp="y" enabled="n" keep_evaluating="y"
  270. send_to="12" script="InfoCapture"
  271. ></trigger>
  272. <trigger group="info_capture"
  273. match="(?<attr>Bash)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  274. regexp="y" enabled="n" keep_evaluating="y"
  275. send_to="12" script="InfoCapture"
  276. ></trigger>
  277. <trigger group="info_capture"
  278. match="(?<attr>Pierce)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  279. regexp="y" enabled="n" keep_evaluating="y"
  280. send_to="12" script="InfoCapture"
  281. ></trigger>
  282. <trigger group="info_capture"
  283. match="(?<attr>Slash)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  284. regexp="y" enabled="n" keep_evaluating="y"
  285. send_to="12" script="InfoCapture"
  286. ></trigger>
  287. <trigger group="info_capture"
  288. match="(?<attr>Acid)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  289. regexp="y" enabled="n" keep_evaluating="y"
  290. send_to="12" script="InfoCapture"
  291. ></trigger>
  292. <trigger group="info_capture"
  293. match="(?<attr>Air)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  294. regexp="y" enabled="n" keep_evaluating="y"
  295. send_to="12" script="InfoCapture"
  296. ></trigger>
  297. <trigger group="info_capture"
  298. match="(?<attr>Cold)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  299. regexp="y" enabled="n" keep_evaluating="y"
  300. send_to="12" script="InfoCapture"
  301. ></trigger>
  302. <trigger group="info_capture"
  303. match="(?<attr>Disease)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  304. regexp="y" enabled="n" keep_evaluating="y"
  305. send_to="12" script="InfoCapture"
  306. ></trigger>
  307. <trigger group="info_capture"
  308. match="(?<attr>Earth)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  309. regexp="y" enabled="n" keep_evaluating="y"
  310. send_to="12" script="InfoCapture"
  311. ></trigger>
  312. <trigger group="info_capture"
  313. match="(?<attr>Electric)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  314. regexp="y" enabled="n" keep_evaluating="y"
  315. send_to="12" script="InfoCapture"
  316. ></trigger>
  317. <trigger group="info_capture"
  318. match="(?<attr>Energy)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  319. regexp="y" enabled="n" keep_evaluating="y"
  320. send_to="12" script="InfoCapture"
  321. ></trigger>
  322. <trigger group="info_capture"
  323. match="(?<attr>Fire)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  324. regexp="y" enabled="n" keep_evaluating="y"
  325. send_to="12" script="InfoCapture"
  326. ></trigger>
  327. <trigger group="info_capture"
  328. match="(?<attr>Holy)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  329. regexp="y" enabled="n" keep_evaluating="y"
  330. send_to="12" script="InfoCapture"
  331. ></trigger>
  332. <trigger group="info_capture"
  333. match="(?<attr>Light)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  334. regexp="y" enabled="n" keep_evaluating="y"
  335. send_to="12" script="InfoCapture"
  336. ></trigger>
  337. <trigger group="info_capture"
  338. match="(?<attr>Magic)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  339. regexp="y" enabled="n" keep_evaluating="y"
  340. send_to="12" script="InfoCapture"
  341. ></trigger>
  342. <trigger group="info_capture"
  343. match="(?<attr>Mental)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  344. regexp="y" enabled="n" keep_evaluating="y"
  345. send_to="12" script="InfoCapture"
  346. ></trigger>
  347. <trigger group="info_capture"
  348. match="(?<attr>Negative)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  349. regexp="y" enabled="n" keep_evaluating="y"
  350. send_to="12" script="InfoCapture"
  351. ></trigger>
  352. <trigger group="info_capture"
  353. match="(?<attr>Poison)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  354. regexp="y" enabled="n" keep_evaluating="y"
  355. send_to="12" script="InfoCapture"
  356. ></trigger>
  357. <trigger group="info_capture"
  358. match="(?<attr>Shadow)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  359. regexp="y" enabled="n" keep_evaluating="y"
  360. send_to="12" script="InfoCapture"
  361. ></trigger>
  362. <trigger group="info_capture"
  363. match="(?<attr>Sonic)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  364. regexp="y" enabled="n" keep_evaluating="y"
  365. send_to="12" script="InfoCapture"
  366. ></trigger>
  367. <trigger group="info_capture"
  368. match="(?<attr>Water)\s+: (?<sign>[+-])(?<val>[0-9]+)"
  369. regexp="y" enabled="n" keep_evaluating="y"
  370. send_to="12" script="InfoCapture"
  371. ></trigger>
  372. </triggers>
  373.  
  374. <script>
  375. <![CDATA[
  376. require "serialize"
  377. dofile(GetInfo (60) .. "aardwolf_colors.lua")
  378.  
  379. local channel = ""
  380. local item = {}
  381. local itemsToReport = {}
  382.  
  383. local itemIds = {}
  384. local nextId = ""
  385. local bagId = ""
  386. local idType = (GetVariable("idType") or "identify")
  387.  
  388. local statLabels = {
  389. ["Strength"] = "str",
  390. ["Intelligence"] = "int",
  391. ["Wisdom"] = "wis",
  392. ["Dexterity"] = "dex",
  393. ["Constitution"] = "con",
  394. ["Luck"] = "luk",
  395. ["Hit roll"] = "hr",
  396. ["Damage roll"] = "dr",
  397. ["Hit points"] = "hp",
  398. ["Mana"] = "mn",
  399. ["Moves"] = "mv",
  400. ["Average Dam"] = "dam",
  401. ["Damage Type"] = "dtype",
  402. ["Weight"] = "wgt"
  403. }
  404.  
  405. local resists = {
  406. "All magic",
  407. "All physical",
  408. "Bash",
  409. "Pierce",
  410. "Slash",
  411. "Acid",
  412. "Air",
  413. "Cold",
  414. "Disease",
  415. "Earth",
  416. "Electric",
  417. "Energy",
  418. "Fire",
  419. "Holy",
  420. "Light",
  421. "Magic",
  422. "Mental",
  423. "Negative",
  424. "Poison",
  425. "Shadow",
  426. "Sonic",
  427. "Water"
  428. }
  429.  
  430. local colors = {
  431. pos = { channel = "@G", nochannel = "lime" },
  432. neg = { channel = "@R", nochannel = "red" },
  433. val = { channel = "@W", nochannel = "white" },
  434. lbl = { channel = "@D", nochannel = "dimgray" },
  435. pts = { channel = "@Y", nochannel = "yellow" },
  436. flg = { channel = "@C", nochannel = "cyan" }
  437. }
  438.  
  439. function OnPluginInstall()
  440. Help()
  441. end
  442.  
  443. function Help()
  444. ColourNote("orange", "", GetPluginInfo (GetPluginID (), 3))
  445. end
  446.  
  447. function SetIDType(name, line, wildcards)
  448. if wildcards[1] == "id" then idType = "identify"
  449. elseif wildcards[1] == "spell" then idType = "c identify"
  450. elseif wildcards[1] == "lore" then idType = "lore"
  451. elseif wildcards[1] == "lbid" then idType = "lbid" end
  452.  
  453. SetVariable("idType", idType)
  454. ColourNote("orange", "", "ID method set to: ", "cyan", "", idType)
  455. end
  456.  
  457. function Identify(name, line, wildcards)
  458. EnableTrigger("identify_start", true)
  459.  
  460. channel = trim(wildcards.channel)
  461.  
  462. item = {}
  463. SendNoEcho(idType .. " " .. (wildcards.num or "") .. wildcards.item)
  464. end
  465.  
  466. function IdentifyStart()
  467. EnableTriggerGroup("info_capture", true)
  468. EnableTrigger("identify_start", false)
  469.  
  470. AddTimer("identify_end", 0, 0, .5, "", timer_flag.Enabled + timer_flag.OneShot, "IdentifyEnd")
  471. end
  472.  
  473. function NameCapture(name, line, wildcards, styles)
  474. local coloredLine = StylesToColoursOneLine(styles)
  475. local extractedName = trim(
  476. string.sub(coloredLine,
  477. string.find(coloredLine, ":")+1,
  478. string.find(coloredLine, " |")))
  479.  
  480. item["chanName"] = { sign = wildcards.sign, val = "@w"..extractedName }
  481.  
  482.  
  483. local cleanedStyles = {}
  484. for i, style in ipairs(styles) do
  485. if i > 2 then
  486. local cleanedName = style.text
  487.  
  488. if i == 3 or i == #styles then
  489. cleanedName = cleanName(style.text)
  490. end
  491.  
  492. table.insert(cleanedStyles, { textcolour = style.textcolour, text = cleanedName })
  493. end
  494. end
  495.  
  496. item["nochanName"] = { val = cleanedStyles }
  497. end
  498.  
  499. function FlagCapture(name, line, wildcards)
  500. if item.flags == nil then item.flags = {} end
  501. table.insert(item.flags, wildcards[1])
  502. end
  503.  
  504. function InfoCapture(name, line, wildcards)
  505. -- Stall the timer each move
  506. ResetTimer("identify_end")
  507.  
  508. item[wildcards.attr] = { sign = wildcards.sign, val = trim(wildcards.val) }
  509. end
  510.  
  511. function IdentifyEnd()
  512. EnableTriggerGroup("info_capture", false)
  513.  
  514. local str = {}
  515.  
  516. -- table.insert(str, { color = colors.lbl, val = "[" })
  517. -- table.insert(str, { color = colors.val, val = item["Id"].val })
  518. -- table.insert(str, { color = colors.lbl, val = "] " })
  519.  
  520. table.insert(str, { color = colors.lbl, val = "[lv" })
  521. table.insert(str, { color = colors.val, val = item["Level"].val })
  522. table.insert(str, { color = colors.lbl, val = "] [" })
  523.  
  524. if item["Wearable"] ~= nil then
  525. table.insert(str, { color = colors.val, val = item["Wearable"].val })
  526. table.insert(str, { color = colors.lbl, val = "] [" })
  527. end
  528.  
  529. if item ["Average Dam"] ~= nil then
  530. table.insert(str, { color = colors.neg, val = item["Weapon Type"].val })
  531. table.insert(str, { color = colors.lbl, val = "] [" })
  532. table.insert(str, { color = colors.neg, val = item["Average Dam"].val })
  533. table.insert(str, { color = colors.lbl, val = " dam] [" })
  534. if item ["Damage Type"] ~= nil then
  535. table.insert(str, { color = colors.neg, val = item["Damage Type"].val })
  536. table.insert(str, { color = colors.lbl, val = "] [" })
  537. end
  538. if item ["Specials"] ~= nil then
  539. table.insert(str, { color = colors.neg, val = item["Specials"].val })
  540. table.insert(str, { color = colors.lbl, val = "] [" })
  541. end
  542. end
  543.  
  544. table.insert(str, { color = colors.pts, val = item["Weight"].val })
  545. table.insert(str, { color = colors.lbl, val = "wgt] [" })
  546.  
  547. table.insert(str, { color = colors.pts, val = item["Score"].val })
  548. table.insert(str, { color = colors.lbl, val = " Score] [" })
  549.  
  550.  
  551. FormatStat(str, "Strength")
  552. FormatStat(str, "Intelligence")
  553. FormatStat(str, "Wisdom")
  554. FormatStat(str, "Dexterity")
  555. FormatStat(str, "Constitution")
  556. FormatStat(str, "Luck")
  557. table.remove(str)
  558.  
  559. table.insert(str, { color = colors.lbl, val = "] [" })
  560.  
  561. FormatStat(str, "Hit roll")
  562. FormatStat(str, "Damage roll")
  563. table.remove(str)
  564.  
  565. table.insert(str, { color = colors.lbl, val = "] [" })
  566.  
  567. FormatStat(str, "Hit points")
  568. FormatStat(str, "Mana")
  569. FormatStat(str, "Moves")
  570. table.remove(str)
  571.  
  572. table.insert(str, { color = colors.lbl, val = "]" })
  573.  
  574.  
  575. local resistCount = 0
  576. table.insert(str, { color = colors.lbl, val = " [" })
  577. for i, resist in ipairs(resists) do
  578. if item[resist] ~= nil then
  579. resistCount = resistCount + 1
  580. FormatStat(str, resist)
  581. end
  582. end
  583. table.remove(str)
  584.  
  585. if resistCount > 0 then
  586. table.insert(str, { color = colors.lbl, val = "]" })
  587. end
  588.  
  589. if item.flags ~= nil then
  590. table.insert(str, { color = colors.lbl, val = " [" })
  591.  
  592. for i, flag in ipairs(item.flags) do
  593. table.insert(str, { color = colors.flg, val = string.upper(string.sub(flag, 1, 1)) })
  594. end
  595.  
  596. table.insert(str, { color = colors.lbl, val = "]" })
  597. end
  598.  
  599. table.insert(itemsToReport, { reportItem = item, reportStr = str })
  600.  
  601. BroadcastPlugin(1, serialize.save_simple(item))
  602.  
  603. -- A bit hacky, but continue with identifies as if we were doing a whole bag
  604. BagIdentifyEnd()
  605. end
  606.  
  607. function ReportChannel(reportItem, reportStyles)
  608. str = channel .. " " .. reportItem["chanName"].val .. " "
  609.  
  610. for i, style in ipairs(reportStyles) do
  611. str = str .. style.color.channel .. style.val
  612. end
  613.  
  614. SendNoEcho(str)
  615. end
  616.  
  617. function ReportEcho(reportItem, reportStyles)
  618. for i, style in ipairs(reportItem["nochanName"].val) do
  619. if style.text ~= "" then
  620. ColourTell(RGBColourToName(style.textcolour), "", style.text)
  621. end
  622. end
  623.  
  624. ColourTell("", "", " ")
  625.  
  626. for i, style in ipairs(reportStyles) do
  627. ColourTell(style.color.nochannel, "", style.val)
  628. end
  629.  
  630. ColourNote("", "", "")
  631. end
  632.  
  633. function FormatStat(str, stat)
  634. if (item[stat] ~= nil) then
  635. local valueColor = colors.pos
  636. local sign = ""
  637.  
  638. if (item[stat].sign == "-") then
  639. sign = "-"
  640. valueColor = colors.neg
  641. end
  642.  
  643. table.insert(str, { color = valueColor, val = sign .. item[stat].val })
  644. table.insert(str, { color = colors.lbl, val = (statLabels[stat] or string.lower(stat)) })
  645. table.insert(str, { color = colors.lbl, val = " " })
  646. end
  647. end
  648.  
  649. function BagIdentify(name, line, wildcards)
  650. EnableTrigger("invdata_start", true)
  651. itemIds = {}
  652. itemsToReport = {}
  653.  
  654. bagId = wildcards.bag
  655. channel = trim(wildcards.channel)
  656.  
  657. SendNoEcho("invdata " .. bagId)
  658. end
  659.  
  660. function InvdataStart()
  661. EnableTrigger("invdata_start", false)
  662. EnableTrigger("invdata_capture", true)
  663. EnableTrigger("invdata_end", true)
  664. end
  665.  
  666. function InvdataEnd()
  667. EnableTrigger("invdata_capture", false)
  668. EnableTrigger("invdata_end", false)
  669.  
  670. BagIdentifyStart()
  671. end
  672.  
  673. function InvdataCapture(name, line, wildcards)
  674. table.insert(itemIds, wildcards[1])
  675. end
  676.  
  677. function BagIdentifyStart()
  678. if #itemIds > 0 then
  679. nextId = table.remove(itemIds)
  680.  
  681. Send("get " .. nextId .. " " .. bagId)
  682.  
  683. local executeString = "rid " .. nextId
  684. if channel ~= "" and channel ~= nil then
  685. executeString = executeString .. " " .. channel
  686. end
  687.  
  688. Execute(executeString)
  689. end
  690. end
  691.  
  692. function BagIdentifyEnd()
  693. if nextId ~= "" then
  694. SendNoEcho("put " .. nextId .. " " .. bagId)
  695. end
  696.  
  697. nextId = ""
  698.  
  699. if #itemIds > 0 then
  700. BagIdentifyStart()
  701. else
  702. for i, item in ipairs(itemsToReport) do
  703. if channel ~= nil and channel ~= "" then
  704. ReportChannel(item.reportItem, item.reportStr)
  705. else
  706. ReportEcho(item.reportItem, item.reportStr)
  707. end
  708. end
  709.  
  710. itemsToReport = {}
  711. end
  712. end
  713.  
  714. function cleanName(name)
  715. name = string.gsub(name, ": ", "")
  716. name = string.gsub(name, " |", "")
  717. return trim(name)
  718. end
  719.  
  720. function trim(s)
  721. return s:find'^%s*$' and '' or s:match'^%s*(.*%S)'
  722. end
  723. ]]>
  724. </script>
  725. </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement