Advertisement
drama2747

Stats/Vitals

Aug 22nd, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.00 KB | None | 0 0
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE muclient>
  3. <!-- Saved on Thursday, January 19, 2012, 12:08 AM -->
  4. <!-- MuClient version 4.80 -->
  5.  
  6. <!-- Plugin "StatReporter" generated by Plugin Wizard -->
  7.  
  8. <muclient>
  9. <plugin
  10. name="StatReporter"
  11. author="Holliday"
  12. id="75d65a6a2747fe57f2ac2c46"
  13. language="Lua"
  14. purpose="Report stats from max."
  15. save_state="y"
  16. date_written="2012-01-19 00:06:14"
  17. requires="4.80"
  18. version="1.0"
  19. >
  20. <description trim="y">
  21. <![CDATA[
  22. repstat [channel]
  23. ]]>
  24. </description>
  25.  
  26. </plugin>
  27.  
  28.  
  29. <!-- Get our standard constants -->
  30.  
  31. <include name="constants.lua"/>
  32.  
  33. <!-- Aliases -->
  34.  
  35. <aliases>
  36. <alias
  37. match="repstat *"
  38. enabled="y"
  39. send_to="12"
  40. sequence="100"
  41. >
  42. <send>
  43. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char") --- We just want the gmcp.char section.
  44. luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
  45. assert (loadstring (luastmt or "")) ()
  46.  
  47. require "gmcphelper"
  48. local str = gmcpval("stats.str")
  49. local maxstr = gmcpval("maxstats.maxstr")
  50. local dex = gmcpval("stats.dex")
  51. local maxdex = gmcpval("maxstats.maxdex")
  52. local wis = gmcpval("stats.wis")
  53. local maxwis = gmcpval("maxstats.maxwis")
  54. local con = gmcpval("stats.con")
  55. local maxcon = gmcpval("maxstats.maxcon")
  56. local luck = gmcpval("stats.luck")
  57. local maxluck = gmcpval("maxstats.maxluck")
  58. local int = gmcpval("stats.int")
  59. local maxint = gmcpval("maxstats.maxint")
  60. local maxhp = gmcpval("maxstats.maxhp")
  61. local maxmana = gmcpval("maxstats.maxmana")
  62. local hr = gmcpval("stats.hr")
  63. local dr = gmcpval("stats.dr")
  64. local a = "@B"
  65. local b = "@Y"
  66. local c = "@w"
  67.  
  68. SendNoEcho ("%1 " ..
  69. a .. "[" .. b .. "Str" .. a .. ": " .. b .. str .. a .."/" .. b .. maxstr .. a .. "] " ..
  70. a .. "[" .. b .. "Dex" .. a .. ": " .. b .. dex .. a .."/" .. b .. maxdex .. a .. "] " ..
  71. a .. "[" .. b .. "Con" .. a .. ": " .. b .. con .. a .."/" .. b .. maxcon .. a .. "] " ..
  72. a .. "[" .. b .. "Int" .. a .. ": " .. b .. int .. a .."/" .. b .. maxint .. a .. "] " ..
  73. a .. "[" .. b .. "Wis" .. a .. ": " .. b .. wis .. a .."/" .. b .. maxwis .. a .. "] " ..
  74. a .. "[" .. b .. "Luck" .. a .. ": " .. b .. luck .. a .."/" .. b .. maxluck .. a .. "] " ..
  75. a .. "HR: " .. b .. hr .. " " ..
  76. a .. "DR: " .. b .. dr .. " " ..
  77. a .. "HP: " .. b .. maxhp .. " " ..
  78. a .. "Mana: " .. b .. maxmana .. " " ..
  79. a .. "[" .. b .. "Totals" .. a .. ": " .. b .. (dex + str + wis + con + int + luck) .. a .."/" .. b .. (maxdex + maxstr + maxwis + maxcon + maxint + maxluck) .. a .. "] " ..
  80. "")
  81. </send>
  82. </alias>
  83. <alias
  84. match="frommax *"
  85. enabled="y"
  86. send_to="12"
  87. sequence="100"
  88. >
  89. <send>
  90. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char") --- We just want the gmcp.char section.
  91. luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
  92. assert (loadstring (luastmt or "")) ()
  93.  
  94. require "gmcphelper"
  95. local lvl = gmcpval("status.level")
  96. local tier = gmcpval("base.tier")
  97. local str = gmcpval("stats.str")
  98. local maxstr = gmcpval("maxstats.maxstr")
  99. local dex = gmcpval("stats.dex")
  100. local maxdex = gmcpval("maxstats.maxdex")
  101. local wis = gmcpval("stats.wis")
  102. local maxwis = gmcpval("maxstats.maxwis")
  103. local con = gmcpval("stats.con")
  104. local maxcon = gmcpval("maxstats.maxcon")
  105. local luck = gmcpval("stats.luck")
  106. local maxluck = gmcpval("maxstats.maxluck")
  107. local int = gmcpval("stats.int")
  108. local maxint = gmcpval("maxstats.maxint")
  109. local hr = gmcpval("stats.hr")
  110. local dr = gmcpval("stats.dr")
  111. local a = "@B"
  112. local b = "@Y"
  113. local c = "@w"
  114. local maxstats = calcMaxStats(lvl, tier)
  115.  
  116. local difstr = maxstats - maxstr
  117. local difdex = maxstats - maxdex
  118. local difwis = maxstats - maxwis
  119. local difcon = maxstats - maxcon
  120. local difluck = maxstats - maxluck
  121. local difint = maxstats - maxint
  122.  
  123.  
  124.  
  125. SendNoEcho ("%1 " ..
  126. a .. "[" .. b .. "Stats from Max " .. maxstats .. a .. "] " ..
  127. a .. "[" .. b .. "Str" .. a .. ": " .. b .. difstr .. a .. "] " ..
  128. a .. "[" .. b .. "Dex" .. a .. ": " .. b .. difdex .. a .. "] " ..
  129. a .. "[" .. b .. "Con" .. a .. ": " .. b .. difcon .. a .. "] " ..
  130. a .. "[" .. b .. "Int" .. a .. ": " .. b .. difint .. a .. "] " ..
  131. a .. "[" .. b .. "Wis" .. a .. ": " .. b .. difwis .. a .. "] " ..
  132. a .. "[" .. b .. "Luck" .. a .. ": " .. b .. difluck .. a .. "] " ..
  133. "")
  134. </send>
  135. </alias>
  136. <alias
  137. match="maxcost *"
  138. enabled="y"
  139. send_to="12"
  140. sequence="100"
  141. >
  142. <send>
  143. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char") --- We just want the gmcp.char section.
  144. luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
  145. assert (loadstring (luastmt or "")) ()
  146.  
  147. require "gmcphelper"
  148. local currentlevel = gmcpval("status.level")
  149. local currenttier = gmcpval("base.tier")
  150. local statsTotal = calcMaxStats(currentlevel, currenttier)
  151. local maxstr = gmcpval("maxstats.maxstr")
  152. local maxdex = gmcpval("maxstats.maxdex")
  153. local maxwis = gmcpval("maxstats.maxwis")
  154. local maxcon = gmcpval("maxstats.maxcon")
  155. local maxluck = gmcpval("maxstats.maxluck")
  156. local maxint = gmcpval("maxstats.maxint")
  157. local a = "@B"
  158. local b = "@Y"
  159. local c = "@w"
  160. local strCost = 0
  161. local dexCost = 0
  162. local wisCost = 0
  163. local intCost = 0
  164. local conCost = 0
  165. local luckCost = 0
  166. strCost = calcMaxCost(statsTotal, maxstr)
  167. dexCost = calcMaxCost(statsTotal, maxdex)
  168. wisCost = calcMaxCost(statsTotal, maxwis)
  169. intCost = calcMaxCost(statsTotal, maxint)
  170. conCost = calcMaxCost(statsTotal, maxcon)
  171. luckCost = calcMaxCost(statsTotal, maxluck)
  172.  
  173. SendNoEcho ("%1 " ..
  174. a .. "[" .. b .. "Training cost for max " .. statsTotal .. a .. "] " ..
  175. a .. "[" .. b .. "Str" .. a .. ": " .. b .. strCost .. a .. "] " ..
  176. a .. "[" .. b .. "Dex" .. a .. ": " .. b .. dexCost .. a .. "] " ..
  177. a .. "[" .. b .. "Con" .. a .. ": " .. b .. conCost .. a .. "] " ..
  178. a .. "[" .. b .. "Int" .. a .. ": " .. b .. intCost .. a .. "] " ..
  179. a .. "[" .. b .. "Wis" .. a .. ": " .. b .. wisCost .. a .. "] " ..
  180. a .. "[" .. b .. "Luck" .. a .. ": " .. b .. luckCost .. a .. "] " ..
  181. "")
  182. </send>
  183. </alias>
  184. <alias
  185. match="vitalcost * *"
  186. enabled="y"
  187. send_to="12"
  188. sequence="100"
  189. >
  190. <send>
  191. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char") --- We just want the gmcp.char section.
  192. luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
  193. assert (loadstring (luastmt or "")) ()
  194.  
  195. require "gmcphelper"
  196. local curHP = gmcpval("maxstats.maxhp")
  197. local curMana = gmcpval("maxstats.maxmana")
  198. local curMoves = gmcpval("maxstats.maxmoves")
  199. local maxHMM = %2
  200. local a = "@B"
  201. local b = "@Y"
  202. local c = "@w"
  203. if (maxHMM > 81625) then
  204. maxHMM = 81625
  205. end
  206.  
  207. HPCost = maxVital(maxHMM, curHP)
  208. MovesCost = maxVital(maxHMM, curMoves)
  209. ManaCost = maxVital(maxHMM, curMana)
  210.  
  211. SendNoEcho ("%1 " ..
  212. a .. "[" .. b .. "Training cost for ".. c .. maxHMM .. b .. " vitals " .. a .. "] " ..
  213. a .. "[" .. b .. "HP" .. a .. ": " .. b .. HPCost .. a .. "] " ..
  214. a .. "[" .. b .. "Mana" .. a .. ": " .. b .. MovesCost .. a .. "] " ..
  215. a .. "[" .. b .. "Moves" .. a .. ": " .. b .. ManaCost .. a .. "] " ..
  216. "")
  217. </send>
  218. </alias>
  219. </aliases>
  220.  
  221. <!-- Script -->
  222.  
  223. <script>
  224.  
  225. function OnPluginBroadcast (msg, id, name, text)
  226. if (id == '3e7dedbe37e44942dd46d264') then
  227. if (text == "char.stats" or text == "char.maxstats" or text == "char.vitals" or text == "char.worth" or text == "char.status") then
  228. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char") --- We just want the gmcp.char section.
  229. luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
  230.  
  231. assert (loadstring (luastmt or "")) ()
  232. end
  233. end
  234. end -- onpluginbroadcast
  235.  
  236. function calcMaxStats (level, tier)
  237. local level = tonumber(level)
  238. local tier = tonumber(tier)
  239. local maxpossible = nil
  240. if (level &lt;= 70 ) then
  241. maxpossible = (level + 25) + (tier * 2)
  242. elseif ((level &gt; 70) and (level &lt;= 155)) then
  243. maxpossible = 95 + ((level - 70) * 2) + (tier * 2)
  244. elseif ((level &gt; 155) and (level &lt;= 200)) then
  245. maxpossible = 265 + ((level - 155) * 3) + (tier * 2)
  246. elseif (level == 201) then
  247. maxpossible = 395
  248. end
  249. return maxpossible
  250. end -- calcMaxStats
  251.  
  252. function calcMaxCost (maxpossible, current)
  253. local maxcost = 0
  254. local currentcount = tonumber(current)
  255. local possible = tonumber(maxpossible)
  256. local cost = 0
  257. if (possible == currentcount) then
  258. return maxcost
  259. end
  260. while (currentcount &lt; possible) do
  261. if ((currentcount &lt;= 70 ) and (currentcount &lt;= possible)) then
  262. currentcount = currentcount + 1
  263. maxcost = maxcost + 1
  264. end
  265. if ((currentcount &gt;= 71) and (currentcount &lt;= 90)) then
  266. currentcount = currentcount + 1
  267. maxcost = maxcost + 2
  268. end
  269. if ((currentcount &gt;= 91) and (currentcount &lt;= 130) and (currentcount &lt;= possible)) then
  270. currentcount = currentcount + 1
  271. maxcost = maxcost + 3
  272. end
  273. if ((currentcount &gt;= 131) and (currentcount &lt;= 170) and (currentcount &lt;= possible)) then
  274. currentcount = currentcount + 1
  275. maxcost = maxcost + 4
  276. end
  277. if ((currentcount &gt;= 171) and (currentcount &lt;= 200) and (currentcount &lt;= possible)) then
  278. currentcount = currentcount + 1
  279. maxcost = maxcost + 6
  280. end
  281. if ((currentcount &gt;= 201) and (currentcount &lt;= 224) and (currentcount &lt;= possible)) then
  282. currentcount = currentcount + 1
  283. maxcost = maxcost + 9
  284. end
  285. if ((currentcount &gt;= 225) and (currentcount &lt;= 250) and (currentcount &lt;= possible)) then
  286. currentcount = currentcount + 1
  287. maxcost = maxcost + 11
  288. end
  289. if ((currentcount &gt;= 251) and (currentcount &lt;= 275) and (currentcount &lt;= possible)) then
  290. currentcount = currentcount + 1
  291. maxcost = maxcost + 15
  292. end
  293. if ((currentcount &gt;= 276) and (currentcount &lt;= 290) and (currentcount &lt;= possible)) then
  294. currentcount = currentcount + 1
  295. maxcost = maxcost + 17
  296. end
  297. if ((currentcount &gt;= 291) and (currentcount &lt;= 300) and (currentcount &lt;= possible)) then
  298. currentcount = currentcount + 1
  299. maxcost = maxcost + 20
  300. end
  301. if ((currentcount &gt;= 301) and (currentcount &lt;= 325) and (currentcount &lt;= possible)) then
  302. currentcount = currentcount + 1
  303. maxcost = maxcost + 25
  304. end
  305. if ((currentcount &gt;= 326) and (currentcount &lt;= 350) and (currentcount &lt;= possible)) then
  306. currentcount = currentcount + 1
  307. maxcost = maxcost + 35
  308. end
  309. if ((currentcount &gt;= 351) and (currentcount &lt;= 375) and (currentcount &lt;= possible)) then
  310. currentcount = currentcount + 1
  311. maxcost = maxcost + 50
  312. end
  313. if ((currentcount &gt;= 376) and (currentcount &lt;= 400) and (currentcount &lt;= possible)) then
  314. currentcount = currentcount + 1
  315. maxcost = maxcost + 60
  316. end
  317. end
  318. return maxcost
  319. end -- calcMaxCost
  320.  
  321.  
  322. function maxVital (maxpossible, current)
  323. local maxcost = 0
  324. local currentcount = tonumber(current)
  325. local possible = tonumber(maxpossible)
  326. local cost = 0
  327. if (possible == currentcount) then
  328. return maxcost
  329. end
  330. while (currentcount &lt; possible) do
  331. if ((currentcount &lt;= 10000 ) and (currentcount &lt;= possible)) then
  332. currentcount = currentcount + 10
  333. maxcost = maxcost + 2
  334. end
  335. if ((currentcount &gt;= 10001) and (currentcount &lt;= 14000)) then
  336. currentcount = currentcount + 10
  337. maxcost = maxcost + 3
  338. end
  339. if ((currentcount &gt;= 14001) and (currentcount &lt;= 18000) and (currentcount &lt;= possible)) then
  340. currentcount = currentcount + 10
  341. maxcost = maxcost + 4
  342. end
  343. if ((currentcount &gt;= 18001) and (currentcount &lt;= 22000) and (currentcount &lt;= possible)) then
  344. currentcount = currentcount + 10
  345. maxcost = maxcost + 5
  346. end
  347. if ((currentcount &gt;= 22001) and (currentcount &lt;= 26000) and (currentcount &lt;= possible)) then
  348. currentcount = currentcount + 10
  349. maxcost = maxcost + 6
  350. end
  351. if ((currentcount &gt;= 26001) and (currentcount &lt;= 30000) and (currentcount &lt;= possible)) then
  352. currentcount = currentcount + 10
  353. maxcost = maxcost + 7
  354. end
  355. if ((currentcount &gt;= 30001) and (currentcount &lt;= 40000) and (currentcount &lt;= possible)) then
  356. currentcount = currentcount + 10
  357. maxcost = maxcost + 10
  358. end
  359. if ((currentcount &gt;= 40001) and (currentcount &lt;= 50000) and (currentcount &lt;= possible)) then
  360. currentcount = currentcount + 10
  361. maxcost = maxcost + 15
  362. end
  363. if ((currentcount &gt;= 50001) and (currentcount &lt;= 75000) and (currentcount &lt;= possible)) then
  364. currentcount = currentcount + 10
  365. maxcost = maxcost + 20
  366. end
  367. if ((currentcount &gt;= 75001) and (currentcount &lt;= 80000) and (currentcount &lt;= possible)) then
  368. currentcount = currentcount + 10
  369. maxcost = maxcost + 25
  370. end
  371. if ((currentcount &gt;= 80001) and (currentcount &lt;= 99999) and (currentcount &lt;= possible)) then
  372. currentcount = currentcount + 10
  373. maxcost = maxcost + 30
  374. end
  375. end
  376. return maxcost
  377. end -- maxVital
  378. </script>
  379. </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement