Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xpos = 0
- local ypos = 233-28
- local timerOffset = 64
- local baseColor = 0x808080FF
- local activeColor = 0x00FF00FF
- local hidden = false
- local function my_display()
- if hidden then
- return
- end
- gui.box(xpos,ypos-9,xpos+26,ypos-1,0x000000ff)
- gui.text(xpos+2,ypos-8,"Damage")
- gui.box(xpos,ypos,xpos+255,ypos+18,0x000000c0)
- gui.line(xpos+1+timerOffset,ypos+1,xpos+1+timerOffset,ypos+17,0xFF0000FF)
- local timer = AND(memory.readword(0x7e0042)-timerOffset,0x1ff)
- local graphy = ypos+9
- for i = 0,253 do
- local modSign
- if(AND(timer+i,0x100)==0) then
- modSign = 1
- else
- modSign = -1
- end
- local colorRatio = math.min(i/timerOffset,1)
- local mixedColor
- if(i>timerOffset) then
- mixedColor = baseColor
- else
- local mixedColorComponent = 0
- mixedColor = 0
- for n=0,3 do
- mixedColorComponent = (1-colorRatio)*AND(baseColor/math.pow(0x100,n),0xff) +
- (colorRatio)*AND(activeColor/math.pow(0x100,n),0xff)
- mixedColor = mixedColor + AND(math.min(mixedColorComponent,0xff),0xff)*math.pow(0x100,n)
- end
- end
- local graphx = xpos+i+1
- local amp = 4+AND(timer+i,0x4)
- if(AND(timer+i,0x8)==0) then
- gui.pixel(graphx,graphy,mixedColor)
- elseif(AND(timer+i,0xf)==0x8 or AND(timer+i,0xf)==0xf) then
- gui.line(graphx,graphy,graphx,graphy-modSign*amp,mixedColor)
- elseif(AND(timer+i,0xf)==0xc) then
- gui.line(graphx,graphy-modSign*4,graphx,graphy-modSign*8,mixedColor)
- else
- gui.pixel(graphx,graphy-modSign*amp,mixedColor)
- end
- end
- end
- -- Hook the display function to the GUI update
- local on_gui_update_old = gui.register()
- local function on_gui_update_new()
- if on_gui_update_old then
- on_gui_update_old()
- end
- my_display()
- end
- gui.register(on_gui_update_new)
- -- Public functions
- dmg_graph = {}
- function dmg_graph.show()
- hidden = false
- end
- function dmg_graph.hide()
- hidden = true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement