Advertisement
Guest User

Untitled

a guest
Jan 13th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.73 KB | None | 0 0
  1. <?xml version="1.0" encoding="iso-8859-1" ?>
  2. <!DOCTYPE muclient>
  3. <muclient>
  4. <plugin name="Fern" author="Iorden" id="eee9954f248f3ed1f71daf33" language="Lua" purpose="Alchemy functions for Lusternia" save_state="y" date_written="2009-04-30 21:11:27" requires="4.37" version="1.0">
  5. <description trim="y">
  6. <![CDATA[ ALCHEMY SYSTEM ON
  7. turns on the system
  8. ALCHEMY SYSTEM OFF
  9. turns off the system
  10.  
  11. BREW [<amount>] <potion> [TO <target container>]
  12. Brews the desired amount of potion and stores it on the selected container (keg by default).
  13. The ingredients must be carried on the inventory.
  14.  
  15. for example:
  16. BREW 10 HEALTH TO KEG123456
  17. BREW 15 BODORU TO RIFT
  18. BREW 1 BROMIDE TO AMETHYST
  19.  
  20. ]]>
  21. </description>
  22. </plugin>
  23. <!-- Get our standard constants
  24. -->
  25. <include name="constants.lua" />
  26. <!-- Triggers
  27. -->
  28. <triggers>
  29. <trigger enabled="y" group="Alchemy" match="^A (.*) alembic releases a sweet smelling cloud of white dust\, as the ingredients crystallize into sugar\.$" regexp="y" send_to="12" sequence="100">
  30. <send>AddTriggerEx ("", "You have recovered balance on all limbs.", "Alchemy:sugar()", 1+16384+32768, custom_colour.Custom15, 0, "", "", 12, 1) AnsiNote(ANSI(1,37).."GOT SUGAR"..ANSI(0))</send>
  31. </trigger>
  32. <trigger enabled="y" group="Alchemy" match="^The keg is full and cannot hold more\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
  33. <send>Alchemy:fail("4")</send>
  34. </trigger>
  35. <trigger enabled="y" group="Alchemy" match="^You do not possess a empty..$" omit_from_output="y" regexp="y" sequence="100" />
  36. <trigger enabled="y" group="Alchemy" match="^A (.*) alembic has no fluid in it.$" omit_from_output="y" regexp="y" sequence="100" />
  37. <trigger enabled="y" group="Alchemy" match="^I cannot tell what it is you wish to combine.$" omit_from_output="y" regexp="y" sequence="100" />
  38. <trigger enabled="y" group="Alchemy" match="^A (.*) alembic doesn\'t contain that\.$" omit_from_output="y" regexp="y" sequence="100" />
  39. <trigger enabled="y" group="Alchemy" match="^Sparkling motes of light dance within a (\w+) alembic\, which rattles and chirps with oddly bird\-like noises\. The ingredients within quickly vaporize\, their essence infusing into (.*)\.$" regexp="y" send_to="12" sequence="100">
  40. <send>Alchemy:container(0)</send>
  41. </trigger>
  42. <trigger enabled="y" group="Alchemy" match="^You must specify a valid alchemical ingredient\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
  43. <send>Alchemy:fail("1")</send>
  44. </trigger>
  45. <trigger enabled="y" group="Alchemy" match="^You do not have enough of that to put into the Alembic\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
  46. <send>Alchemy:fail("1")</send>
  47. </trigger>
  48. <trigger enabled="y" group="Alchemy" match="^You must be in an alchemical laboratory to do this\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
  49. <send>Alchemy:fail("3")</send>
  50. </trigger>
  51. <trigger enabled="y" group="Alchemy" match="^You are baffled by the complexity of that\, and wouldn\'t even know where to begin\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
  52. <send>Alchemy:fail("2")</send>
  53. </trigger>
  54. <trigger enabled="y" group="Alchemy" match="^An (\w+) vial is not empty\. You must empty it before you can fill it again\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
  55. <send>AnsiNote( ANSI(1,37,41).."Out of empty vials... DON'T FLUSH THE ALEMBIC"..ANSI(0))</send>
  56. </trigger>
  57. <trigger enabled="y" group="Alchemy" match="^Your energy reserves are too depleted to create this potion\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
  58. <send>Alchemy:fail("6")</send>
  59. </trigger>
  60. <trigger enabled="y" group="Alchemy" match="^You put a (.*) in a brass alembic in preparation for amalgamation\.$" name="remove_checks" regexp="y" send_to="12" sequence="100">
  61. <send>Alchemy:remove_check("%1")</send>
  62. </trigger>
  63. </triggers>
  64. <!-- Aliases
  65. -->
  66. <aliases>
  67. <alias match="^AlchemyConfig time (\d*)$" enabled="y" group="Alchemy" regexp="y" send_to="12" ignore_case="y" sequence="100">
  68. <send>AnsiNote(ANSI(1,37).."Delay for error checking: %1"..ANSI(0)) Alchemy["failsafe_time"]=%1</send>
  69. </alias>
  70. <alias match="^Alchemy System (on|off)$" enabled="y" regexp="y" send_to="12" ignore_case="y" sequence="100">
  71. <send>Alchemy:activate("%1")</send>
  72. </alias>
  73. <alias match="^brew\s+((\d*)(\s+))?((vial|keg|unit)(\s+))?(\w+)(\s+to\s+(\w+))?\s*$" enabled="y" group="Alchemy" regexp="y" send_to="12" ignore_case="y" sequence="100">
  74. <send>Alchemy:brew("%2","%5","%7","%9")</send>
  75. </alias>
  76. </aliases>
  77. <!-- Script
  78. -->
  79. <script>
  80. <![CDATA[ --[[
  81. Lua script for the Alchemy System, needs more comments but I'm too lazy and this was made in a hurry so...
  82. --]]
  83.  
  84. require "wait"
  85.  
  86. if not Alchemy then -- Avoid re-initialization issues
  87.  
  88. --loads of boring tables of data D:
  89. Skills = {
  90. ["basic"]="alchemy",
  91. ["brewmeister"]="brewmeister",
  92. ["lorecraft"]="lorecraft",
  93. ["solid"]="solid",
  94. ["rift"]="rift"
  95. }
  96.  
  97. container_type_Table = {
  98. ["unit"]=1,
  99. ["vial"]=1,
  100. ["fill"]=1,
  101. ["keg"]=100,
  102. }
  103.  
  104. Alchemy = {
  105. errors={},
  106. ["target_container"]="keg",
  107. ["potion"]="",
  108. ["failsafe_time"]=2,
  109. error_code = {
  110. ["0"]="Unknown error",
  111. ["1"]="You seem to be carrying insufficient supplies.",
  112. ["2"]="Seems that you are not skilled enough for brewing this potion.",
  113. ["3"]="You must be in an alchemical laboratory to do this.",
  114. ["4"]="-------Full container, DON'T FLUSH THE ALEMBIC--------",
  115. ["5"]="-------Operation interrupted--------",
  116. ["6"]="-------Out of power, get a powerstone or charge reserves at nexus--------"
  117. },
  118. alembic_check = {},
  119. -- basic alchemy
  120. salt={
  121. power = 0,
  122. Potion_Type = Skills.basic,
  123. ingredients={
  124. ["salt"] = 1
  125. },
  126. unriftables={}
  127. },
  128. sulfur={
  129. power= 0,
  130. Potion_Type = Skills.basic,
  131. ingredients={
  132. ["sulfur"]=1
  133. },
  134. unriftables={}
  135. },
  136. liniment={
  137. Potion_Type = Skills.basic,
  138. power=1,
  139. ingredients={
  140. ["arnica"]=4,
  141. ["chervil"]=2,
  142. ["yarrow"]=2,
  143. ["horehound"]=1,
  144. ["flax"]=2
  145. },
  146. unriftables={}
  147. },
  148. health={
  149. Potion_Type = Skills.basic,
  150. power=2,
  151. ingredients={
  152. ["galingale"]=8,
  153. ["sargassum"]=2,
  154. ["juniper"]=1,
  155. ["yarrow"]=1
  156. },
  157. unriftables={}
  158. },
  159. bromide={
  160. Potion_Type = Skills.basic,
  161. power=2,
  162. ingredients={
  163. ["rosehip"]=3,
  164. ["marjoram"]=3,
  165. ["weed"]=3,
  166. ["calamus"]=2,
  167. ["reishi"]=2
  168. },
  169. unriftables={}
  170. },
  171. quicksilver={
  172. Potion_Type = Skills.basic,
  173. power=0.5,
  174. ingredients={
  175. ["kafe"]=4,
  176. ["pennyroyal"]=2,
  177. ["sage"]=4,
  178. ["mercury"]=1
  179. },
  180. unriftables={}
  181. },
  182. mana={
  183. Potion_Type = Skills.basic,
  184. power=2,
  185. ingredients={
  186. ["marjoram"]=6,
  187. ["flax"]=4,
  188. ["reishi"]=1,
  189. ["kafe"]=1
  190. },
  191. unriftables={}
  192. },
  193. antidote={
  194. Potion_Type = Skills.basic,
  195. power=3,
  196. ingredients={
  197. ["reishi"]=6,
  198. ["wormwood"]=6,
  199. ["myrtle"]=2
  200. },
  201. unriftables={}
  202. },
  203. mindoru={
  204. Potion_Type = Skills.rift,
  205. power=1,
  206. ingredients={
  207. ["chervil"]=10,
  208. ["mistletoe"]=1,
  209. ["juniper"]=10
  210. },
  211. unriftables={}
  212. },
  213. suporu={
  214. Potion_Type = Skills.rift,
  215. power=1,
  216. ingredients={
  217. ["chervil"]=10,
  218. ["mistletoe"]=1,
  219. ["weed"]=10
  220. },
  221. unriftables={}
  222. },
  223. bodoru={
  224. Potion_Type = Skills.rift,
  225. power=1,
  226. ingredients={
  227. ["chervil"]=10,
  228. ["mistletoe"]=1,
  229. ["colewort"]=10
  230. },
  231. unriftables={}
  232. },
  233. mending={
  234. Potion_Type = Skills.basic,
  235. power=3,
  236. ingredients={
  237. ["arnica"]=5,
  238. ["coltsfoot"]=5,
  239. ["juniper"]=5,
  240. ["rosehip"]=3
  241. },
  242. unriftables={}
  243. },
  244. love={
  245. Potion_Type = Skills.basic,
  246. power=4,
  247. ingredients={
  248. ["rosehip"]=5,
  249. ["weed"]=5,
  250. ["marjoram"]=3,
  251. ["coltsfoot"]=3,
  252. ["faeleaf"]=1
  253. },
  254. unriftables={}
  255. },
  256. regeneration={
  257. Potion_Type = Skills.basic,
  258. power=3,
  259. ingredients={
  260. ["arnica"]=5,
  261. ["flax"]=5,
  262. ["mistletoe"]=3,
  263. ["sparkleberry"]=2,
  264. ["chervil"]=2,
  265. ["kombu"]=1
  266. },
  267. unriftables={}
  268. },
  269. allheale={
  270. Potion_Type = Skills.basic,
  271. power=5,
  272. ingredients={
  273. ["reishi"]=7,
  274. ["kombu"]=6,
  275. ["sargassum"]=5,
  276. ["arnica"]=3,
  277. ["yarrow"]=2,
  278. ["pennyroyal"]=2,
  279. ["sparkleberry"]=2,
  280. ["merbloom"]=2
  281. },
  282. unriftables={}
  283. },
  284. moonwater = {
  285. power = 5,
  286. Potion_Type = Skills.basic,
  287. ingredients={
  288. },
  289. unriftables={
  290. ["essence"] = 4
  291. }
  292. },
  293. nightsweats = {
  294. power = 5,
  295. Potion_Type = Skills.basic,
  296. ingredients={
  297. },
  298. unriftables={
  299. ["essence"] = 4
  300. }
  301. },
  302. unholywater = {
  303. power = 5,
  304. Potion_Type = Skills.basic,
  305. ingredients={
  306. },
  307. unriftables={
  308. ["essence"] = 4
  309. }
  310. },
  311. holywater = {
  312. power = 5,
  313. Potion_Type = Skills.basic,
  314. ingredients={
  315. },
  316. unriftables={
  317. ["essence"] = 4
  318. }
  319. },
  320. -- lorecraft
  321. fire = {
  322. power = 2,
  323. Potion_Type = Skills.lorecraft,
  324. ingredients={
  325. ["myrtle"] = 2,
  326. ["kafe"] = 2,
  327. ["horehound"] = 3,
  328. ["coltsfoot"] = 1,
  329. ["sage"] = 2
  330. },
  331. unriftables={}
  332. },
  333. jasmine = {
  334. power = 1,
  335. Potion_Type = Skills.lorecraft,
  336. ingredients={
  337. ["spices"] = 15
  338. },
  339. unriftables={}
  340. },
  341. frost = {
  342. power = 2,
  343. Potion_Type = Skills.lorecraft,
  344. ingredients={
  345. ["merbloom"] = 4,
  346. ["juniper"] = 2,
  347. ["kombu"] = 1,
  348. ["mistletoe"] = 1,
  349. ["sargassum"] = 1
  350. },
  351. unriftables={}
  352. },
  353. invisibility = {
  354. power = 2,
  355. Potion_Type = Skills.lorecraft,
  356. ingredients={
  357. ["kafe"] = 5,
  358. ["rosehip"] = 5,
  359. ["coltsfoot"] = 5
  360. },
  361. unriftables={}
  362. },
  363. vanilla = {
  364. power = 1,
  365. Potion_Type = Skills.lorecraft,
  366. ingredients={
  367. ["spices"] = 15
  368. },
  369. unriftables={}
  370. },
  371. galvanism = {
  372. power = 2,
  373. Potion_Type = Skills.lorecraft,
  374. ingredients={
  375. ["coltsfoot"] = 10,
  376. ["colewort"] = 5,
  377. ["arnica"] = 5
  378. },
  379. unriftables={}
  380. },
  381. sanguine = {
  382. power = 3,
  383. Potion_Type = Skills.lorecraft,
  384. ingredients={
  385. ["chervil"] = 5,
  386. ["yarrow"] = 5
  387. },
  388. unriftables={}
  389. },
  390. dragonsblood = {
  391. power = 1,
  392. Potion_Type = Skills.lorecraft,
  393. ingredients={
  394. ["spices"] = 15
  395. },
  396. unriftables={}
  397. },
  398. preservation = {
  399. power = 1,
  400. Potion_Type = Skills.lorecraft,
  401. ingredients={
  402. ["coltsfoot"] = 3,
  403. ["colewort"] = 10,
  404. ["flax"] = 2
  405. },
  406. unriftables={}
  407. },
  408. choleric = {
  409. power = 3,
  410. Potion_Type = Skills.lorecraft,
  411. ingredients={
  412. ["pennyroyal"] = 5,
  413. ["sage"] = 5
  414. },
  415. unriftables={}
  416. },
  417. sandalwood = {
  418. power = 1,
  419. Potion_Type = Skills.lorecraft,
  420. ingredients={
  421. ["spices"] = 15
  422. },
  423. unriftables={}
  424. },
  425. phlegmatic = {
  426. power = 3,
  427. Potion_Type = Skills.lorecraft,
  428. ingredients={
  429. ["horehound"] = 5,
  430. ["kombu"] = 5
  431. },
  432. unriftables={}
  433. },
  434. melancholic = {
  435. power = 3,
  436. Potion_Type = Skills.lorecraft,
  437. ingredients={
  438. ["myrtle"] = 5,
  439. ["galingale"] = 5
  440. },
  441. unriftables={}
  442. },
  443. musk = {
  444. power = 1,
  445. Potion_Type = Skills.lorecraft,
  446. ingredients={
  447. ["spices"] = 15
  448. },
  449. unriftables={}
  450. },
  451. sharpness = {
  452. power = 2,
  453. Potion_Type = Skills.lorecraft,
  454. ingredients={
  455. ["arnica"] = 5,
  456. ["kafe"] = 5,
  457. ["flax"] = 3,
  458. ["coltsfoot"] = 2
  459. },
  460. unriftables={}
  461. },
  462. heart = {
  463. power = 100,
  464. Potion_Type = Skills.solid,
  465. ingredients={
  466. ["gold"] = 100
  467. },
  468. unriftables={}
  469. },
  470. vitae = {
  471. power = 8,
  472. Potion_Type = Skills.lorecraft,
  473. ingredients={
  474. ["sparkleberry"] = 10,
  475. ["faeleaf"] = 10,
  476. ["mistletoe"] = 10,
  477. ["calamus"] = 5,
  478. ["merbloom"] = 5,
  479. ["galingale"] = 3
  480. },
  481. unriftables={}
  482. },
  483. philosopherstone = {
  484. power = 25,
  485. Potion_Type = Skills.solid,
  486. ingredients={
  487. ["gold"] = 10,
  488. ["silver"] = 10,
  489. ["platinum"] = 10,
  490. ["mercury"] = 10
  491. },
  492. unriftables={}
  493. },
  494. -- brewmeister
  495. palemalt = {
  496. power = 0.5,
  497. Potion_Type = Skills.rift,
  498. ingredients={
  499. ["grain"] = 3,
  500. ["sugar"] = 3
  501. },
  502. unriftables={}
  503. },
  504. absinthe = {
  505. power = 4,
  506. Potion_Type = Skills.lorecraft,
  507. ingredients={
  508. ["wormwood"] = 5,
  509. ["faeleaf"] = 3,
  510. ["mistletoe"] = 3,
  511. ["reishi"] = 2,
  512. },
  513. unriftables={
  514. ["dreamleech"] = 1
  515. }
  516. },
  517. ambermalt = {
  518. power = 2,
  519. Potion_Type = Skills.rift,
  520. ingredients={
  521. ["grain"] = 8,
  522. ["sugar"] = 3
  523. },
  524. unriftables={}
  525. },
  526. magicink = {
  527. power = 5,
  528. Potion_Type = Skills.brewmeister,
  529. ingredients={
  530. ["goldtint"] = 10,
  531. ["sparkleberry"] = 10
  532. },
  533. unriftables={}
  534. },
  535. whitetea = {
  536. power = 2,
  537. Potion_Type = Skills.rift,
  538. ingredients={
  539. ["rawtea"] = 10
  540. },
  541. unriftables={}
  542. },
  543. oolongtea = {
  544. power = 2,
  545. Potion_Type = Skills.rift,
  546. ingredients={
  547. ["rawtea"] = 10
  548. },
  549. unriftables={}
  550. },
  551. darkmalt = {
  552. power = 2,
  553. Potion_Type = Skills.rift,
  554. ingredients={
  555. ["grain"] = 15
  556. },
  557. unriftables={}
  558. },
  559. greentea = {
  560. power = 2,
  561. Potion_Type = Skills.rift,
  562. ingredients={
  563. ["rawtea"] = 10
  564. },
  565. unriftables={}
  566. },
  567. blacktea = {
  568. power = 2,
  569. Potion_Type = Skills.rift,
  570. ingredients={
  571. ["rawtea"] = 10
  572. },
  573. unriftables={}
  574. }
  575. }
  576. end
  577.  
  578. function Alchemy:brew (amount, container_type, brew, target_container)
  579. --parse variables and set default values
  580. local size = 0
  581. Alchemy.errors={}
  582.  
  583.  
  584. --brewmeister beers
  585. if not (tonumber(brew) == nil) then
  586. Send("flush Alembic")
  587. Send("brew "..brew)
  588. return
  589. end
  590.  
  591. if (brew=="stop") then
  592. Alchemy:fail("5")
  593. end
  594. --set defaults
  595. if (string.len(amount)==0) then
  596. amount = 10
  597. end
  598. if (string.len(container_type)==0) then
  599. container_type = "fill"
  600. end
  601. if (string.len(target_container)==0) then
  602. target_container = "keg"
  603. end
  604.  
  605. Alchemy["target_container"]=target_container
  606.  
  607. local note = "preparing to brew "..amount.." "..container_type
  608. if tonumber(amount)>1 then note = note.."s"
  609. end
  610.  
  611. --clear checks
  612. for k,v in pairs(Alchemy.alembic_check) do
  613. Alchemy.alembic_check[k]=nil
  614. end
  615.  
  616. -- main script
  617. brew = string.lower(brew)
  618. for Alchemy_item, _ in pairs(Alchemy) do
  619. if brew == Alchemy_item then
  620. brew = tostring(brew)
  621. Alchemy["potion"]=brew
  622. note = note.." of ".. brew .."..."
  623. AnsiNote(ANSI(1,37) .. note .. ANSI(0))
  624. Alchemy:main(brew,container_type_Table[container_type]*amount)
  625. return
  626. end
  627. end
  628. AnsiNote(ANSI(1,37) .. "hmm... are you sure this " .. brew .. " is a potion?" .. ANSI(0))
  629.  
  630. end
  631.  
  632. function Alchemy:check_supplies (brew,tobrew)
  633. local subtotal=tobrew
  634. local success=true
  635. for ingredient,quantity in pairs(Alchemy[brew].ingredients) do
  636. if gear:inv(ingredient)<tobrew then
  637. AnsiNote( ANSI(1,37,41).."Missing "..tobrew-gear:inv(ingredient).." "..ingredient.. ANSI(0))
  638. success=false
  639. end
  640. end
  641. return success
  642. end
  643.  
  644. function Alchemy:alembic (brew,amount,action)
  645. if (action=="add") then
  646. Send("flush alembic")
  647. for ingredient,quantity in pairs(Alchemy[brew].ingredients) do
  648. --Send("outr "..quantity*amount.." "..ingredient)
  649. Send("combine "..ingredient.." fully")
  650. Send("add "..quantity*amount.." "..ingredient)
  651. Alchemy.alembic_check[ingredient]=1
  652. --Note(ingredient.." "..Alchemy.alembic_check[ingredient])
  653. end
  654. for ingredient,quantity in pairs(Alchemy[brew].unriftables) do
  655. for times=1,quantity*amount do
  656. Send("add "..ingredient)
  657. if(Alchemy.alembic_check[ingredient]== nil)then
  658. Alchemy.alembic_check[ingredient]=1
  659. else
  660. Alchemy.alembic_check[ingredient]=Alchemy.alembic_check[ingredient]+1
  661. end
  662. --Note(ingredient.." "..Alchemy.alembic_check[ingredient])
  663. end
  664. end
  665. end
  666. if (action=="take") then
  667. for ingredient,quantity in pairs(Alchemy[brew].ingredients) do
  668. Send("take all "..ingredient.." from alembic")
  669. end
  670. for ingredient,quantity in pairs(Alchemy[brew].unriftables) do
  671. for times=1,quantity*amount do
  672. Send("take "..ingredient.." from alembic")
  673. end
  674. end
  675. end
  676. end
  677.  
  678. function Alchemy:amalgamate (brew)
  679. if not (next(Alchemy.errors)==nil) then
  680. return false
  681. else
  682. Send("amalgamate "..brew)
  683. return true
  684. end
  685. end
  686.  
  687. function Alchemy:fail(code)
  688. if Alchemy.errors[code]==nil then
  689. Alchemy.errors[code]=code
  690. end
  691. end
  692.  
  693. function Alchemy:remove_check(wildcards)
  694. for ingredient,checks in pairs(Alchemy.alembic_check) do
  695. if(string.find(wildcards,ingredient)==nil) then
  696. Alchemy.alembic_check[ingredient]=Alchemy.alembic_check[ingredient]-1
  697. end
  698. end
  699. end
  700.  
  701. function Alchemy:main(brew,tobrew)
  702. --if using treant, make use of those nifty variables to check if enough supplies in rift
  703. -- Actually scrap that, too much of a hassle an I can always get to it later
  704. --if(Alchemy:check_supplies(brew,tobrew)==true) or (IsTrigger("riftcheck__")==1 or 1==1) then
  705. if(true) then
  706. local batch=0
  707. --check powerstone charges goes here
  708. if(tobrew>10) then
  709. batch=10
  710. Alchemy:alembic(brew,batch,"add")
  711. wait.make (function ()
  712. wait.time(Alchemy["failsafe_time"])
  713. AnsiNote(ANSI(1,37).."readying alembic..." ..ANSI(0))
  714. if(not Alchemy:amalgamate(brew)) then
  715. Alchemy:alembic(brew,batch,"take")
  716. Alchemy:failmessage(brew,tobrew)
  717. --AnsiNote( ANSI(1,37,41).."Some error caused the operation to be interrupted with "..tobrew.." units of "..brew.." left to brew"..ANSI(0))
  718. Alchemy.errors={}
  719. else
  720. tobrew=tobrew-10
  721. wait.time(10)
  722. --insert fill container here
  723. Alchemy:main(brew,tobrew)
  724. end
  725. end)--function
  726. else
  727. batch=tobrew
  728. Alchemy:alembic(brew,batch,"add")
  729. wait.make (function ()
  730. wait.time(Alchemy["failsafe_time"])
  731. AnsiNote(ANSI(1,37).."readying alembic..."..ANSI(0))
  732. if(not Alchemy:amalgamate(brew)) then
  733. Alchemy:alembic(brew,amount,"take")
  734. Alchemy:failmessage(brew,tobrew)
  735. --AnsiNote( ANSI(1,37,41).."Some error caused the operation to be interrupted with "..tobrew.." units of "..brew.." left to brew"..ANSI(0))
  736. Alchemy.errors={}
  737. else
  738. wait.time(10)
  739. --insert fill container here
  740. AnsiNote( ANSI(1,37).."Finished successfully!!"..ANSI(0))
  741. end
  742. end)
  743. end
  744. end --if
  745. end
  746.  
  747. function Alchemy:failmessage(brew,tobrew)
  748. for _,error_id in pairs(Alchemy.errors) do
  749. AnsiNote( ANSI(1,37,41)..Alchemy.error_code[error_id]..ANSI(0))
  750. if error_id=="1" then
  751. AnsiNote( ANSI(1,37,41).."The desired operation requires you to have the following ingredients in your inventory:"..ANSI(0))
  752. for ingredient,quantity in pairs(Alchemy[brew].ingredients) do
  753. AnsiNote( ANSI(1,37,41)..tobrew*quantity.." "..ingredient.. ANSI(0))
  754. end
  755. for ingredient,quantity in pairs(Alchemy[brew].unriftables) do
  756. AnsiNote( ANSI(1,37,41)..tobrew*quantity.." "..ingredient.. ANSI(0))
  757. end
  758. end
  759. end
  760. end
  761.  
  762. function Alchemy:container(rift)
  763. if rift==1 then
  764. Send("take 10 "..Alchemy["potion"].." from alembic")
  765. Send("inr all "..Alchemy["potion"])
  766. return
  767. end
  768. if (Alchemy["target_container"]=="rift" or Alchemy[Alchemy["potion"]].Potion_Type==Skills.rift) then
  769. AddTriggerEx ("", "You have recovered balance on all limbs.", "Alchemy:container(1)", 1+16384+32768, custom_colour.Custom15, 0, "", "", 12, 1)
  770. return
  771. end
  772. if Alchemy[Alchemy["potion"]].Potion_Type==Skills.solid then
  773. Send("take all "..Alchemy["potion"].." from alembic")
  774. return
  775. end
  776. if Alchemy["target_container"]=="vial" then
  777. Alchemy["target_container"]="empty"
  778. end
  779. if Alchemy["target_container"]=="keg" then
  780. Send("fill "..Alchemy["target_container"])
  781. return
  782. end
  783. for times=1,10 do
  784. Send("fill "..Alchemy["target_container"])
  785. end
  786. end
  787.  
  788. function Alchemy:sugar()
  789. Send("take 10 sugar from alembic")
  790. Send("inr all sugar")
  791. end
  792.  
  793. function Alchemy:activate(enable)
  794. if enable == "on" then
  795. EnableTriggerGroup ("Alchemy", true)
  796. EnableAliasGroup ("Alchemy", true)
  797. AnsiNote(ANSI(1,37) .. "Alchemy system enabled" .. ANSI(0))
  798. else
  799. EnableTriggerGroup ("Alchemy", false)
  800. EnableAliasGroup ("Alchemy", false)
  801. AnsiNote(ANSI(1,37) .. "Alchemy system disabled" .. ANSI(0))
  802. end
  803. end
  804.  
  805.  
  806. ]]>
  807. </script>
  808. </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement