[ACE] Draw text of current states turns

I want to display the remaining turns until the states are removed on the icon for each state.

Is there any way to do this?
for example: draw_text(x,y,width,height, battler.state_turns[state.id].to_s)
I happened to open VXA and I did the same in my project. My code looked like this in Window_Base
Ruby:
def draw_actor_icons(actor, x, y, width = 96)
    states = actor.states.uniq[0, 7]
    last_size = contents.font.size
    contents.font.size = 18
    states.each_with_index do |n, i|
      xpos = x + (24 * i)
      ypos = y
      draw_icon(n.icon_index, xpos, ypos)
      if n.auto_removal_timing != 0
        turn_left = actor.state_turns[n.id]
        draw_text(xpos, ypos+6, 24, 24, turn_left,2)
      end
      stack = actor.state_total(n.id)
      if stack > 1
        draw_text(xpos+1, ypos+6, 24, 24, stack)
      end
    end
    contents.font.size = last_size
  end
Because I was using stacking states I had to remove duplicates and limit up to 8 icons.
I happened to open VXA and I did the same in my project. My code looked like this in Window_Base
Ruby:
def draw_actor_icons(actor, x, y, width = 96)
    states = actor.states.uniq[0, 7]
    last_size = contents.font.size
    contents.font.size = 18
    states.each_with_index do |n, i|
      xpos = x + (24 * i)
      ypos = y
      draw_icon(n.icon_index, xpos, ypos)
      if n.auto_removal_timing != 0
        turn_left = actor.state_turns[n.id]
        draw_text(xpos, ypos+6, 24, 24, turn_left,2)
      end
      stack = actor.state_total(n.id)
      if stack > 1
        draw_text(xpos+1, ypos+6, 24, 24, stack)
      end
    end
    contents.font.size = last_size
  end
Because I was using stacking states I had to remove duplicates and limit up to 8 icons.
Thank you so much, i modify your code and it goes really welll

Original thread: https://forums.rpgmakerweb.com/threads/ace-draw-text-of-current-states-turns.151846/