Advertisement
Sim_Piko

[cc]xpTankViewer

Jul 8th, 2022
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. local m=peripheral.wrap('top')
  2. local col=m.setTextColor
  3. local colB=m.setBackgroundColor
  4. local c=colors
  5. m.pos=m.setCursorPos
  6.  
  7. local lvl=0
  8. local done=0
  9. local guess=0
  10. local maxexp=0
  11. local exp=0
  12. function mwri(co, stri)
  13. col(co)
  14. m.write(tostring(stri))
  15. end
  16.  
  17. while true do
  18. m.clear()
  19. m.setTextScale(1)
  20. m.pos(1,1)
  21. term.clear()
  22. term.setCursorPos(1,1)
  23.  
  24. lxp=peripheral.call('bottom','getTankInfo')[1].contents.amount
  25. exp=lxp/20
  26.  
  27. print(lxp,' mB of Liquid XP')
  28. print()
  29. print('Total: ',exp,' EXP')
  30. mwri(c.cyan,lxp)
  31. mwri(c.lime,' mB ')
  32. m.pos(1,2)
  33. mwri(c.cyan,exp)
  34. mwri(c.lime,' XP ')
  35.  
  36. lvl=0
  37. done=0
  38. repeat
  39. if lvl>=30 then
  40. guess =3.5*(lvl^2)-151.5*lvl+2220
  41. maxexp= 7*lvl-148
  42. elseif lvl>=15 then
  43. guess =1.5*(lvl^2)-29.5*lvl+360
  44. maxexp= 3*lvl-28
  45. else --lvl<15
  46. guess =17*lvl
  47. maxexp=17
  48. end
  49.  
  50. if guess-exp>0 then
  51. done=1
  52. else
  53. lvl=lvl+1
  54. end
  55. until done==1
  56. local lowexp=maxexp-(guess-exp)
  57. local hundo=0
  58. if lowexp>0 then
  59. hundo=math.floor(lowexp/maxexp*100)
  60. end
  61. print('Level: ',lvl-1)
  62. print('EXP: ',lowexp,'/',maxexp,' (',hundo,'%)')
  63. m.pos(1,3)
  64. mwri(c.cyan,'Lvl: ')
  65. mwri(c.lime,lvl-1)
  66. m.pos(1,4)
  67. mwri(c.cyan,'EXP: ')
  68. mwri(c.lime,lowexp)
  69. mwri(c.cyan,'/')
  70. mwri(c.lime,maxexp)
  71. mwri(c.cyan,' (')
  72. mwri(c.lime,hundo)
  73. mwri(c.cyan,'%)')
  74.  
  75. sizeX=m.getSize()
  76. for i=1,sizeX do
  77. m.pos(i,5)
  78. procent = math.floor(i/sizeX*100)
  79. if procent < hundo then
  80. colB(c.lime)
  81. else
  82. colB(c.cyan)
  83. end
  84. mwri(c.white,' ')
  85. end
  86. colB(c.black)
  87.  
  88. sleep(2)
  89. end
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement