Advertisement
Guest User

Untitled

a guest
Apr 25th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.45 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 = "@R"
  65. local b = "@w"
  66.  
  67. SendNoEcho ("%1 " ..
  68. a .. "[" .. b .. "Str" .. a .. ": " .. b .. str .. a .."/" .. b .. maxstr .. a .. "] " ..
  69. a .. "[" .. b .. "Dex" .. a .. ": " .. b .. dex .. a .."/" .. b .. maxdex .. a .. "] " ..
  70. a .. "[" .. b .. "Con" .. a .. ": " .. b .. con .. a .."/" .. b .. maxcon .. a .. "] " ..
  71. a .. "[" .. b .. "Int" .. a .. ": " .. b .. int .. a .."/" .. b .. maxint .. a .. "] " ..
  72. a .. "[" .. b .. "Wis" .. a .. ": " .. b .. wis .. a .."/" .. b .. maxwis .. a .. "] " ..
  73. a .. "[" .. b .. "Luck" .. a .. ": " .. b .. luck .. a .."/" .. b .. maxluck .. a .. "] " ..
  74. a .. "HR: " .. b .. hr .. " " ..
  75. a .. "DR: " .. b .. dr .. " " ..
  76. a .. "HP: " .. b .. maxhp .. " " ..
  77. a .. "Mana: " .. b .. maxmana .. " " ..
  78. a .. "[" .. b .. "Totals" .. a .. ": " .. b .. (dex + str + wis + con + int + luck) .. a .."/" .. b .. (maxdex + maxstr + maxwis + maxcon + maxint + maxluck) .. a .. "] " ..
  79. "")
  80. </send>
  81. </alias>
  82. <alias
  83. match="frommax *"
  84. enabled="y"
  85. send_to="12"
  86. sequence="100"
  87. >
  88. <send>
  89. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char") --- We just want the gmcp.char section.
  90. luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
  91. assert (loadstring (luastmt or "")) ()
  92.  
  93. require "gmcphelper"
  94. local lvl = gmcpval("status.level")
  95. local tier = gmcpval("base.tier")
  96. local str = gmcpval("stats.str")
  97. local maxstr = gmcpval("maxstats.maxstr")
  98. local dex = gmcpval("stats.dex")
  99. local maxdex = gmcpval("maxstats.maxdex")
  100. local wis = gmcpval("stats.wis")
  101. local maxwis = gmcpval("maxstats.maxwis")
  102. local con = gmcpval("stats.con")
  103. local maxcon = gmcpval("maxstats.maxcon")
  104. local luck = gmcpval("stats.luck")
  105. local maxluck = gmcpval("maxstats.maxluck")
  106. local int = gmcpval("stats.int")
  107. local maxint = gmcpval("maxstats.maxint")
  108. local hr = gmcpval("stats.hr")
  109. local dr = gmcpval("stats.dr")
  110. local a = "@R"
  111. local b = "@w"
  112. local maxstats = calcMaxStats(lvl, tier)
  113.  
  114. local difstr = maxstats - maxstr
  115. local difdex = maxstats - maxdex
  116. local difwis = maxstats - maxwis
  117. local difcon = maxstats - maxcon
  118. local difluck = maxstats - maxluck
  119. local difint = maxstats - maxint
  120.  
  121.  
  122.  
  123. SendNoEcho ("%1 " ..
  124. a .. "[" .. b .. "Stats from Max " .. maxstats .. a .. "] " ..
  125. a .. "[" .. b .. "Str" .. a .. ": " .. b .. difstr .. a .. "] " ..
  126. a .. "[" .. b .. "Dex" .. a .. ": " .. b .. difdex .. a .. "] " ..
  127. a .. "[" .. b .. "Con" .. a .. ": " .. b .. difcon .. a .. "] " ..
  128. a .. "[" .. b .. "Int" .. a .. ": " .. b .. difint .. a .. "] " ..
  129. a .. "[" .. b .. "Wis" .. a .. ": " .. b .. difwis .. a .. "] " ..
  130. a .. "[" .. b .. "Luck" .. a .. ": " .. b .. difluck .. a .. "] " ..
  131. "")
  132. </send>
  133. </alias>
  134. <alias
  135. match="maxcost *"
  136. enabled="y"
  137. send_to="12"
  138. sequence="100"
  139. >
  140. <send>
  141. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char") --- We just want the gmcp.char section.
  142. luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
  143. assert (loadstring (luastmt or "")) ()
  144.  
  145. require "gmcphelper"
  146. local currentlevel = gmcpval("status.level")
  147. local currenttier = gmcpval("base.tier")
  148. local statsTotal = calcMaxStats(currentlevel, currenttier)
  149. local maxstr = gmcpval("maxstats.maxstr")
  150. local maxdex = gmcpval("maxstats.maxdex")
  151. local maxwis = gmcpval("maxstats.maxwis")
  152. local maxcon = gmcpval("maxstats.maxcon")
  153. local maxluck = gmcpval("maxstats.maxluck")
  154. local maxint = gmcpval("maxstats.maxint")
  155. local a = "@R"
  156. local b = "@w"
  157. local strCost = 0
  158. local dexCost = 0
  159. local wisCost = 0
  160. local intCost = 0
  161. local conCost = 0
  162. local luckCost = 0
  163. strCost = calcMaxCost(statsTotal, maxstr)
  164. dexCost = calcMaxCost(statsTotal, maxdex)
  165. wisCost = calcMaxCost(statsTotal, maxwis)
  166. intCost = calcMaxCost(statsTotal, maxint)
  167. conCost = calcMaxCost(statsTotal, maxcon)
  168. luckCost = calcMaxCost(statsTotal, maxluck)
  169.  
  170. SendNoEcho ("%1 " ..
  171. a .. "[" .. b .. "Training cost for max " .. statsTotal .. a .. "] " ..
  172. a .. "[" .. b .. "Str" .. a .. ": " .. b .. strCost .. a .. "] " ..
  173. a .. "[" .. b .. "Dex" .. a .. ": " .. b .. dexCost .. a .. "] " ..
  174. a .. "[" .. b .. "Con" .. a .. ": " .. b .. conCost .. a .. "] " ..
  175. a .. "[" .. b .. "Int" .. a .. ": " .. b .. intCost .. a .. "] " ..
  176. a .. "[" .. b .. "Wis" .. a .. ": " .. b .. wisCost .. a .. "] " ..
  177. a .. "[" .. b .. "Luck" .. a .. ": " .. b .. luckCost .. a .. "] " ..
  178. "")
  179. </send>
  180. </alias>
  181. </aliases>
  182.  
  183. <!-- Script -->
  184.  
  185. <script>
  186.  
  187. function OnPluginBroadcast (msg, id, name, text)
  188. if (id == '3e7dedbe37e44942dd46d264') then
  189. if (text == "char.stats" or text == "char.maxstats" or text == "char.vitals" or text == "char.worth" or text == "char.status") then
  190. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char") --- We just want the gmcp.char section.
  191. luastmt = "gmcpdata = " .. gmcparg --- Convert the serialized string back into a lua table.
  192.  
  193. assert (loadstring (luastmt or "")) ()
  194. end
  195. end
  196. end -- onpluginbroadcast
  197.  
  198. function calcMaxStats (level, tier)
  199. local level = tonumber(level)
  200. local tier = tonumber(tier)
  201. local maxpossible = nil
  202. if (level &lt;= 70 ) then
  203. maxpossible = (level + 25) + (tier * 2)
  204. elseif ((level &gt; 70) and (level &lt;= 155)) then
  205. maxpossible = 95 + ((level - 70) * 2) + (tier * 2)
  206. elseif ((level &gt; 155) and (level &lt;= 200)) then
  207. maxpossible = 265 + ((level - 155) * 3) + (tier * 2)
  208. elseif (level == 201) then
  209. maxpossible = 400
  210. end
  211. return maxpossible
  212. end -- calcMaxStats
  213.  
  214. function calcMaxCost (maxpossible, current)
  215. local maxcost = 0
  216. local currentcount = tonumber(current)
  217. local possible = tonumber(maxpossible)
  218. local cost = 0
  219. if (possible == currentcount) then
  220. return maxcost
  221. end
  222. while (currentcount &lt; possible) do
  223. if ((currentcount &lt;= 70 ) and (currentcount &lt;= possible)) then
  224. currentcount = currentcount + 1
  225. maxcost = maxcost + 1
  226. end
  227. if ((currentcount &gt;= 71) and (currentcount &lt;= 90)) then
  228. currentcount = currentcount + 1
  229. maxcost = maxcost + 2
  230. end
  231. if ((currentcount &gt;= 91) and (currentcount &lt;= 130) and (currentcount &lt;= possible)) then
  232. currentcount = currentcount + 1
  233. maxcost = maxcost + 3
  234. end
  235. if ((currentcount &gt;= 131) and (currentcount &lt;= 170) and (currentcount &lt;= possible)) then
  236. currentcount = currentcount + 1
  237. maxcost = maxcost + 4
  238. end
  239. if ((currentcount &gt;= 171) and (currentcount &lt;= 200) and (currentcount &lt;= possible)) then
  240. currentcount = currentcount + 1
  241. maxcost = maxcost + 6
  242. end
  243. if ((currentcount &gt;= 201) and (currentcount &lt;= 224) and (currentcount &lt;= possible)) then
  244. currentcount = currentcount + 1
  245. maxcost = maxcost + 9
  246. end
  247. if ((currentcount &gt;= 225) and (currentcount &lt;= 250) and (currentcount &lt;= possible)) then
  248. currentcount = currentcount + 1
  249. maxcost = maxcost + 11
  250. end
  251. if ((currentcount &gt;= 251) and (currentcount &lt;= 275) and (currentcount &lt;= possible)) then
  252. currentcount = currentcount + 1
  253. maxcost = maxcost + 15
  254. end
  255. if ((currentcount &gt;= 276) and (currentcount &lt;= 290) and (currentcount &lt;= possible)) then
  256. currentcount = currentcount + 1
  257. maxcost = maxcost + 17
  258. end
  259. if ((currentcount &gt;= 291) and (currentcount &lt;= 300) and (currentcount &lt;= possible)) then
  260. currentcount = currentcount + 1
  261. maxcost = maxcost + 20
  262. end
  263. if ((currentcount &gt;= 301) and (currentcount &lt;= 325) and (currentcount &lt;= possible)) then
  264. currentcount = currentcount + 1
  265. maxcost = maxcost + 25
  266. end
  267. if ((currentcount &gt;= 326) and (currentcount &lt;= 350) and (currentcount &lt;= possible)) then
  268. currentcount = currentcount + 1
  269. maxcost = maxcost + 35
  270. end
  271. if ((currentcount &gt;= 351) and (currentcount &lt;= 375) and (currentcount &lt;= possible)) then
  272. currentcount = currentcount + 1
  273. maxcost = maxcost + 50
  274. end
  275. if ((currentcount &gt;= 376) and (currentcount &lt;= 400) and (currentcount &lt;= possible)) then
  276. currentcount = currentcount + 1
  277. maxcost = maxcost + 60
  278. end
  279. end
  280. return maxcost
  281. end -- calcMaxCost
  282. </script>
  283. </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement