输入负数数值
# @taroxd metadata 1.0
# @id negative_input
# @display 输入负数数值
# @help 数值输入处理可以输入负数
module Taroxd
  NegativeInput = true
end

class Window_NumberInput < Window_Base

  def start
    @digits_max = $game_message.num_input_digits_max + 1
    num = $game_variables[$game_message.num_input_variable_id]
    max_num = 10**(@digits_max - 1) - 1
    num = [[num, max_num].min, -max_num].max
    @number = sprintf('%+0*d', @digits_max, num)
    @index = 0
    update_placement
    create_contents
    refresh
    open
    activate
  end

  def process_digit_change
    return unless active
    if Input.repeat?(:UP) || Input.repeat?(:DOWN)
      Sound.play_cursor
      if @index == 0
        @number[0] = @number.start_with?('+') ? '-' : '+'
      else
        n = @number[@index].to_i
        @number[@index] = ((n + (Input.repeat?(:UP) ? 1 : -1)) % 10).to_s
      end
      refresh
    end
  end

  def refresh
    contents.clear
    change_color(normal_color)
    @digits_max.times do |i|
      rect = item_rect(i)
      rect.x += 1
      draw_text(rect, @number[i], 1)
    end
  end

  def process_ok
    Sound.play_ok
    $game_variables[$game_message.num_input_variable_id] = @number.to_i
    deactivate
    close
  end
end
元数据
# @taroxd metadata 1.0
# @id metadata
# @display 元数据
# @help 读取 taroxd 脚本的元数据
module Taroxd
  module Metadata
    def self.read(source)
      return unless source.include?('@taroxd metadata')
      metadata = {}
      source.scan(/^# @(\w+)(?: +(.+))?/) do |key, value|
        key = key.to_sym
        value ||= ""
        original_value = metadata[key]
        value = original_value ? "#{original_value}\n#{value}" : value
        metadata[key] = value.chomp
      end
      metadata
    end
  end
end
菜单中显示 TP
# @taroxd metadata 1.0
# @id menu_tp
# @require taroxd_core
# @display 菜单中显示 TP
Taroxd::MenuTP = true

class Window_Base < Window
  def_chain :draw_actor_simple_status do |old, actor, x, y|
    if actor.preserve_tp?
      draw_actor_name(actor, x, y)
      draw_actor_level(actor, x, y + line_height)
      draw_actor_icons(actor, x, y + line_height * 2)
      draw_actor_class(actor, x + 120, y)
      draw_actor_hp(actor, x + 120, y + line_height)
      draw_actor_mp(actor, x + 120, y + line_height * 2, 60)
      draw_actor_tp(actor, x + 184, y + line_height * 2, 60)
    else
      old.(actor, x, y)
    end
  end
end

class Window_Status < Window_Selectable
  def_chain :draw_basic_info do |old, x, y|
    if @actor.preserve_tp?
      draw_actor_level(@actor, x, y)
      draw_actor_icons(@actor, x, y + line_height)
      draw_actor_hp(@actor, x, y + line_height * 2)
      draw_actor_mp(@actor, x, y + line_height * 3, 60)
      draw_actor_tp(@actor, x + 64, y + line_height * 3, 60)
    else
      old.(x, y)
    end
  end
end