skip to main | skip to sidebar
MelekTaus

Montag, 1. Februar 2010

MatrixInventory

Dies ist ein reines Style-Script, das dem Item-Menü ein neues Feeling gibt.
Die Items sind dann nämlich nicht mehr zeilenweise angeordnet sondern rastermäßig. Es wird lediglich das Symbol mit einer kleinen Zahl, die die Item-Anzahl vermittelt, angezeigt.
Zusätzlich wird eine ToolTip geöffnet mit der Information des Items, über das sich der Cursor befindet.
#==============================================================================
# MelekTaus' MatrixInventory
#------------------------------------------------------------------------------
# Version: 1.1
#------------------------------------------------------------------------------
# Info:  Use "|" for a new line in an item-description.
#==============================================================================
module MelekTaus
module MatrixInventory
  #--------------------------------------------------------------------------
  ACTIVE = true
  #--------------------------------------------------------------------------
  MATRIX_COLUMNS = 8
  #--------------------------------------------------------------------------
  TOOLTIP_BASE_WIDTH = 160
  TOOLTIP_BASE_BACKGROUND_COLOR = [0, 0, 0, 155]
  #--------------------------------------------------------------------------
  TOOLTIP_ITEM_NAME_FONT_NAME = Font.default_name
  TOOLTIP_ITEM_NAME_FONT_SIZE = Font.default_size
  TOOLTIP_ITEM_NAME_BOLD = true
  TOOLTIP_ITEM_NAME_COLOR = [255, 255, 255]
  #--------------------------------------------------------------------------
  TOOLTIP_ITEM_TYPE_FONT_NAME = Font.default_name
  TOOLTIP_ITEM_TYPE_FONT_SIZE = Font.default_size - 4
  TOOLTIP_ITEM_TYPE_BOLD = false
  TOOLTIP_ITEM_TYPE_COLOR = [255, 255, 255, 155]
  #--------------------------------------------------------------------------
  TOOLTIP_ITEM_PRICE_FONT_NAME = Font.default_name
  TOOLTIP_ITEM_PRICE_FONT_SIZE = Font.default_size - 6
  TOOLTIP_ITEM_PRICE_BOLD = false
  TOOLTIP_ITEM_PRICE_COLOR = [255, 255, 0]
  #--------------------------------------------------------------------------
  TOOLTIP_ITEM_DESCRIPTION_FONT_NAME = Font.default_name
  TOOLTIP_ITEM_DESCRIPTION_FONT_SIZE = Font.default_size - 4
  TOOLTIP_ITEM_DESCRIPTION_BOLD = false
  TOOLTIP_ITEM_DESCRIPTION_COLOR = [255, 255, 255]
  #--------------------------------------------------------------------------
  TOOLTIP_ITEM_ATTRIBUTE_FONT_NAME = Font.default_name
  TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE = Font.default_size - 4
  TOOLTIP_ITEM_ATTRIBUTE_BOLD = false
  TOOLTIP_HP_COLOR = [255, 155, 155]
  TOOLTIP_MP_COLOR = [155, 155, 255]
  TOOLTIP_ATK_COLOR = [255, 255, 255]
  TOOLTIP_DEF_COLOR = [255, 255, 255]
  TOOLTIP_SPI_COLOR = [255, 255, 255]
  TOOLTIP_AGI_COLOR = [255, 255, 255]
  #--------------------------------------------------------------------------
  ITEM_NUMBER_FONT_NAME = Font.default_name
  ITEM_NUMBER_FONT_SIZE = Font.default_size - 6
  ITEM_NUMBER_BOLD = false
  ITEM_NUMBER_COLOR = [255, 255, 255]
  #--------------------------------------------------------------------------
  VOCAB_TYPE_WEAPON = "Waffe"  # Weapon
  VOCAB_TYPE_ARMOR1 = "Schild"  # Shield
  VOCAB_TYPE_ARMOR2 = "Kopf"  # Head
  VOCAB_TYPE_ARMOR3 = "Körper"  # Body
  VOCAB_TYPE_ARMOR4 = "Zubehör"  # Accessory
  VOCAB_TYPE_ITEM = "Gegenstand"  # Item
  VOCAB_PRICE = "Wert"  # Price
  VOCAB_HP = "HP"
  VOCAB_MP = "MP"
  VOCAB_ATK = "ATK"
  VOCAB_DEF = "DEF"
  VOCAB_SPI = "SPI"
  VOCAB_AGI = "AGI"
  #--------------------------------------------------------------------------
  SHOW_SELLING_PRICE_IN_INVENTORY = true
  SHOW_ITEMS_ONLY = true
  USE_QUICK_SHOP = true  # true => No "Item-Count-Request" in Shop
  TEXT_FOR_ZERO_PRICE = ""
  #--------------------------------------------------------------------------
end
end
#==============================================================================
if MelekTaus::MatrixInventory::ACTIVE
#==============================================================================
class Window_Base
  #--------------------------------------------------------------------------
  WLH_ITEM = 50
  #--------------------------------------------------------------------------
end
#==============================================================================
class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  include MelekTaus::MatrixInventory
  #--------------------------------------------------------------------------
  def initialize(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    return if parameters.nil?
    return if parameters.size < 4
    super(parameters[0], parameters[1], parameters[2], parameters[3])
    @column_max = MATRIX_COLUMNS
    @spacing = 10
    @tooltip_right_space = 0
    @tooltip_bottom_space = 0
    self.index = 0
    create_tooltip
    refresh
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def create_tooltip(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @tooltip = Sprite.new
    @tooltip.z = 1000
    @tooltip.opacity = 0
    @tooltip_switch = false
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def create_contents(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH_ITEM].max)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def refresh
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @data = []
    for item in $game_party.items
      next unless include?(item)
      push_item = true
      if SHOW_ITEMS_ONLY
        push_item = false if !item.is_a?(RPG::Item) if $scene.is_a?(Scene_Item)
      end
      @data.push(item) if push_item
      if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def top_row(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    return self.oy / WLH_ITEM
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def top_row=(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    return if parameters.nil?
    return if parameters.size < 1
    parameters[0] = 0 if parameters[0] < 0
    parameters[0] = row_max - 1 if parameters[0] > row_max - 1
    self.oy = parameters[0] * WLH_ITEM
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def page_row_max(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    return (self.height - 32) / WLH_ITEM
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def cursor_down(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    parameters = [] if parameters.nil?
    parameters[0] = false if parameters[0].nil?
    wrap = parameters[0]
    if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
      @index = (@index + @column_max) % @item_max
      @tooltip_switch = true
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def cursor_up(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    parameters = [] if parameters.nil?
    parameters[0] = false if parameters[0].nil?
    wrap = parameters[0]
    if (@index >= @column_max) or (wrap and @column_max == 1)
      @index = (@index - @column_max + @item_max) % @item_max
      @tooltip_switch = true
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def cursor_right(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    parameters = [] if parameters.nil?
    parameters[0] = false if parameters[0].nil?
    wrap = parameters[0]
    if (@column_max >= 2) and
       (@index < @item_max - 1 or (wrap and page_row_max == 1))
      @index = (@index + 1) % @item_max
      @tooltip_switch = true
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def cursor_left(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    parameters = [] if parameters.nil?
    parameters[0] = false if parameters[0].nil?
    wrap = parameters[0]
    if (@column_max >= 2) and
       (@index > 0 or (wrap and page_row_max == 1))
      @index = (@index - 1 + @item_max) % @item_max
      @tooltip_switch = true
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def cursor_pagedown(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if top_row + page_row_max < row_max
      @index = [@index + page_item_max, @item_max - 1].min
      self.top_row += page_row_max
      @tooltip_switch = true
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def cursor_pageup(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if top_row > 0
      @index = [@index - page_item_max, 0].max
      self.top_row -= page_row_max
      @tooltip_switch = true
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def update_cursor(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if @index < 0
      self.cursor_rect.empty
    else
      row = @index / @column_max
      if row < top_row
        self.top_row = row
      end
      if row > bottom_row
        self.bottom_row = row
      end
      rect = item_rect(@index)
      rect.y /= WLH
      rect.y *= WLH_ITEM
      rect.y -= self.oy
      rect.height = 40
      self.cursor_rect = rect
    end
    draw_item_tooltip
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def draw_item(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    return if parameters.nil?
    return if parameters.size < 1
    parameters[1] = true if parameters[1].nil?
    rect = item_rect(parameters[0])
    rect.y /= WLH
    rect.y *= WLH_ITEM
    rect.y += 8
    rect.width -= 4
    rect.height = 40
    self.contents.clear_rect(rect)
    item = @data[parameters[0]]
    unless item.nil?
      number = 0
      number = $game_party.item_number(item) if parameters[1]
      enabled = enable?(item)
      enabled = true if $scene.is_a?(Scene_Shop)
      draw_icon(item.icon_index, rect.x + 7, rect.y, enabled)
      self.contents.font.name = ITEM_NUMBER_FONT_NAME
      self.contents.font.size = ITEM_NUMBER_FONT_SIZE
      self.contents.font.bold = ITEM_NUMBER_BOLD
      self.contents.font.color.set(*ITEM_NUMBER_COLOR)
      self.contents.font.color.alpha = enabled ? 255 : 128 unless $scene.is_a?(Scene_Shop)
      self.contents.draw_text(rect, sprintf("%2d ", number), 2) if number > 1
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def draw_item_tooltip(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if not self.active or @tooltip_switch
      @tooltip.opacity -= 15 if @tooltip.opacity > 0
      @tooltip.opacity = 0 if @tooltip.opacity < 0
      @tooltip_switch = false if @tooltip.opacity == 0
    elsif @data != nil and item != nil
      info = item.description
      @tooltip.opacity += 15 if @tooltip.opacity < 255
      @tooltip.opacity = 255 if @tooltip.opacity > 255
      x = 6
      width = TOOLTIP_BASE_WIDTH
      text = []     
      text.push([2, [item.name, TOOLTIP_ITEM_NAME_FONT_SIZE, 0], [item_type, TOOLTIP_ITEM_TYPE_FONT_SIZE, 0], 4])
      text.push([4, [item.description, TOOLTIP_ITEM_DESCRIPTION_FONT_SIZE, 0], 4])
      if item_type == VOCAB_TYPE_ITEM
        t = [item.hp_recovery_rate, item.hp_recovery, item.mp_recovery_rate]
        t.push(item.mp_recovery)
      else
        t = [item.atk, item.def, item.spi, item.agi]
      end
      text.push([4, t, 4])
      height = 0
      if text[0][1][0] != "" or text[0][2][0] != ""
        height += text[0][0]
        if text[0][1][0] != ""
          height += text[0][1][1]
          height += text[0][1][2]
        end
        if text[0][2][0] != ""
          height += text[0][2][1]
          height += text[0][2][2]
        end
        height += text[0][3]
      end
      if text[1][1][0] != ""
        height += text[1][0]
        if text[1][1][0] != ""
          for i in 0...text[1][1][0].split("|").size
            height += text[1][1][1]
          end
          height += text[1][1][2]
        end
        height += text[1][2]
      end
      if text[2][1][0] != 0 or text[2][1][1] != 0 or text[2][1][2] != 0 or text[2][1][3] != 0
        height += text[2][0]
        height += TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE if text[2][1][0] != 0
        height += TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE if text[2][1][1] != 0
        height += TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE if text[2][1][2] != 0
        height += TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE if text[2][1][3] != 0
        height += text[2][2]
      end
      @tooltip.bitmap = Bitmap.new(width + 2 * x, height)
      @tooltip.bitmap.font.name = TOOLTIP_ITEM_NAME_FONT_NAME
      @tooltip.bitmap.font.size = TOOLTIP_ITEM_NAME_FONT_SIZE
      @tooltip.bitmap.fill_rect(@tooltip.bitmap.rect, Color.new(*TOOLTIP_BASE_BACKGROUND_COLOR))
      new_x = cursor_rect.x + 24
      if new_x > 520 - @tooltip.bitmap.width - @tooltip_right_space
        new_x = cursor_rect.x + WLH_ITEM - @tooltip.bitmap.width
      end
      @tooltip.x = new_x
      new_y = cursor_rect.y + self.y + WLH_ITEM
      if new_y > 366 - @tooltip.bitmap.height - @tooltip_bottom_space
        new_y = cursor_rect.y + self.y - @tooltip.bitmap.height + 22
      end
      @tooltip.y = new_y
      height = 0
      if text[0][1][0] != "" or text[0][2][0] != ""
        height += text[0][0]
        if text[0][1][0] != ""
          @tooltip.bitmap.font.name = TOOLTIP_ITEM_NAME_FONT_NAME
          @tooltip.bitmap.font.size = text[0][1][1]
          @tooltip.bitmap.font.bold = TOOLTIP_ITEM_NAME_BOLD
          @tooltip.bitmap.font.color.set(*TOOLTIP_ITEM_NAME_COLOR)
          @tooltip.bitmap.draw_text(x, height, width, text[0][1][1], text[0][1][0])
          height += text[0][1][1]
          height += text[0][1][2]
        end
        if text[0][2][0] != ""
          @tooltip.bitmap.font.name = TOOLTIP_ITEM_TYPE_FONT_NAME
          @tooltip.bitmap.font.size = text[0][2][1]
          @tooltip.bitmap.font.bold = TOOLTIP_ITEM_TYPE_BOLD
          @tooltip.bitmap.font.color.set(*TOOLTIP_ITEM_TYPE_COLOR)
          @tooltip.bitmap.draw_text(x, height, width, text[0][2][1], text[0][2][0])
          w = item.price
          w /= 2 if SHOW_SELLING_PRICE_IN_INVENTORY unless $scene.is_a?(Scene_Shop)
          @tooltip.bitmap.font.name = TOOLTIP_ITEM_PRICE_FONT_NAME
          @tooltip.bitmap.font.size = TOOLTIP_ITEM_PRICE_FONT_SIZE
          @tooltip.bitmap.font.bold = TOOLTIP_ITEM_PRICE_BOLD
          @tooltip.bitmap.font.color.set(*TOOLTIP_ITEM_PRICE_COLOR)
          if w == 0
            @tooltip.bitmap.draw_text(x, height, width, TOOLTIP_ITEM_TYPE_FONT_SIZE, "#{TEXT_FOR_ZERO_PRICE}", 2) 
          else
            @tooltip.bitmap.draw_text(x, height, width, TOOLTIP_ITEM_TYPE_FONT_SIZE, "#{VOCAB_PRICE}: #{w}", 2) 
          end
          height += text[0][2][1]
          height += text[0][2][2]
        end
        height += text[0][3]
      end
      if text[1][1][0] != ""
        height += text[1][0]
        if text[1][1][0] != ""
          for i in 0...text[1][1][0].split("|").size
            @tooltip.bitmap.font.name = TOOLTIP_ITEM_DESCRIPTION_FONT_NAME
            @tooltip.bitmap.font.size = text[1][1][1]
            @tooltip.bitmap.font.bold = TOOLTIP_ITEM_DESCRIPTION_BOLD
            @tooltip.bitmap.font.color.set(*TOOLTIP_ITEM_DESCRIPTION_COLOR)
            @tooltip.bitmap.draw_text(x, height, width, text[1][1][1], text[1][1][0].split("|")[i])
            height += text[1][1][1]
          end
          height += text[1][1][2]
        end
        height += text[1][2]
      end
      if text[2][1][0] != 0 or text[2][1][1] != 0 or text[2][1][2] != 0 or text[2][1][3] != 0
        height += text[2][0]
        if text[2][1][0] != 0
          @tooltip.bitmap.font.name = TOOLTIP_ITEM_ATTRIBUTE_FONT_NAME
          @tooltip.bitmap.font.size = TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE
          @tooltip.bitmap.font.bold = TOOLTIP_ITEM_ATTRIBUTE_BOLD
          if item_type == VOCAB_TYPE_ITEM
            @tooltip.bitmap.font.color.set(*TOOLTIP_HP_COLOR)
            if text[2][1][0] > 0
              new_text = "+ #{text[2][1][0]}% #{VOCAB_HP}"
            else
              new_text = "- #{text[2][1][0]}% #{VOCAB_HP}"
            end
          else
            @tooltip.bitmap.font.color.set(*TOOLTIP_ATK_COLOR)
            if text[2][1][0] > 0
              new_text = "+ #{text[2][1][0]} #{VOCAB_ATK}"
            else
              new_text = "- #{text[2][1][0]} #{VOCAB_ATK}"
            end
          end
          @tooltip.bitmap.draw_text(x, height, width, 16, new_text)
          height += 16
        end
        if text[2][1][1] != 0
          @tooltip.bitmap.font.name = TOOLTIP_ITEM_ATTRIBUTE_FONT_NAME
          @tooltip.bitmap.font.size = TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE
          @tooltip.bitmap.font.bold = TOOLTIP_ITEM_ATTRIBUTE_BOLD
          if item_type == VOCAB_TYPE_ITEM
            @tooltip.bitmap.font.color.set(*TOOLTIP_HP_COLOR)
            if text[2][1][1] > 0
              new_text = "+ #{text[2][1][1]} #{VOCAB_HP}"
            else
              new_text = "- #{text[2][1][1]} #{VOCAB_HP}"
            end
          else
            @tooltip.bitmap.font.color.set(*TOOLTIP_DEF_COLOR)
            if text[2][1][1] > 0
              new_text = "+ #{text[2][1][1]} #{VOCAB_DEF}"
            else
              new_text = "- #{text[2][1][1]} #{VOCAB_DEF}"
            end
          end
          @tooltip.bitmap.draw_text(x, height, width, 16, new_text)
          height += 16
        end
        if text[2][1][2] != 0
          @tooltip.bitmap.font.name = TOOLTIP_ITEM_ATTRIBUTE_FONT_NAME
          @tooltip.bitmap.font.size = TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE
          @tooltip.bitmap.font.bold = TOOLTIP_ITEM_ATTRIBUTE_BOLD
          if item_type == VOCAB_TYPE_ITEM
            @tooltip.bitmap.font.color.set(*TOOLTIP_MP_COLOR)
            if text[2][1][2] > 0
              new_text = "+ #{text[2][1][2]}% #{VOCAB_MP}"
            else
              new_text = "- #{text[2][1][2]}% #{VOCAB_MP}"
            end
          else
            @tooltip.bitmap.font.color.set(*TOOLTIP_SPI_COLOR)
            if text[2][1][2] > 0
              new_text = "+ #{text[2][1][2]} #{VOCAB_SPI}"
            else
              new_text = "- #{text[2][1][2]} #{VOCAB_SPI}"
            end
          end
          @tooltip.bitmap.draw_text(x, height, width, 16, new_text)
          height += 16
        end
        if text[2][1][3] != 0
          @tooltip.bitmap.font.name = TOOLTIP_ITEM_ATTRIBUTE_FONT_NAME
          @tooltip.bitmap.font.size = TOOLTIP_ITEM_ATTRIBUTE_FONT_SIZE
          @tooltip.bitmap.font.bold = TOOLTIP_ITEM_ATTRIBUTE_BOLD
          if item_type == VOCAB_TYPE_ITEM
            @tooltip.bitmap.font.color.set(*TOOLTIP_MP_COLOR)
            if text[2][1][3] > 0
              new_text = "+ #{text[2][1][3]} #{VOCAB_MP}"
            else
              new_text = "- #{text[2][1][3]} #{VOCAB_MP}"
            end
          else
            @tooltip.bitmap.font.color.set(*TOOLTIP_AGI_COLOR)
            if text[2][1][3] > 0
              new_text = "+ #{text[2][1][3]} #{VOCAB_AGI}"
            else
              new_text = "- #{text[2][1][3]} #{VOCAB_AGI}"
            end
          end
          @tooltip.bitmap.draw_text(x, height, width, 16, new_text)
          height += 16
        end
        height += text[2][2]
      end
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def item_type(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    case true
      when item.is_a?(RPG::Item);    return VOCAB_TYPE_ITEM
      when item.is_a?(RPG::Weapon);  return VOCAB_TYPE_WEAPON
      when item.is_a?(RPG::Armor)
        return VOCAB_TYPE_ARMOR1 if item.kind == 0
        return VOCAB_TYPE_ARMOR2 if item.kind == 1
        return VOCAB_TYPE_ARMOR3 if item.kind == 2
        return VOCAB_TYPE_ARMOR4 if item.kind == 3
      else; return "???"
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def dispose(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    super(*parameters)
    @tooltip.dispose
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def update_help(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # do nothing
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------  
end
#==============================================================================
class Window_ShopBuy < Window_Item
  #--------------------------------------------------------------------------
  def initialize(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    return if parameters.nil?
    return if parameters.size < 2
    @shop_goods = $game_temp.shop_goods
    super(parameters[0], parameters[1], 304, 304)
    @column_max = 6
    @spacing = 4
    @tooltip_right_space = 208
    @tooltip_bottom_space = WLH
    self.index = 0
    create_tooltip
    refresh
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def refresh(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @data = []
    for goods_item in @shop_goods
      case goods_item[0]
      when 0
        item = $data_items[goods_item[1]]
      when 1
        item = $data_weapons[goods_item[1]]
      when 2
        item = $data_armors[goods_item[1]]
      end
      if item != nil
        @data.push(item)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i, false)
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
end
#==============================================================================
class Scene_Shop
  #--------------------------------------------------------------------------
  def update_buy_selection(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.repeat?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or number == 99
        Sound.play_buzzer
      else
        if Window_Item::USE_QUICK_SHOP
          Sound.play_shop
          $game_party.lose_gold(@item.price)
          $game_party.gain_item(@item, 1)
          @gold_window.refresh
          @buy_window.refresh
          @status_window.refresh
        else
          Sound.play_decision
          max = @item.price == 0 ? 99 : $game_party.gold / @item.price
          max = [max, 99 - number].min
          @buy_window.active = false
          @buy_window.visible = false
          @number_window.set(@item, max, @item.price)
          @number_window.active = true
          @number_window.visible = true
        end
      end
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
  def update_sell_selection(*parameters)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @sell_window.active = false
      @sell_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
    elsif Input.repeat?(Input::C)
      @item = @sell_window.item
      @status_window.item = @item
      if @item == nil or @item.price == 0
        Sound.play_buzzer
      else
        if Window_Item::USE_QUICK_SHOP
          Sound.play_shop
          $game_party.gain_gold(@item.price / 2)
          $game_party.lose_item(@item, 1)
          @gold_window.refresh
          @sell_window.refresh
          @status_window.refresh
        else
          Sound.play_decision
          max = $game_party.item_number(@item)
          @sell_window.active = false
          @sell_window.visible = false
          @number_window.set(@item, max, @item.price / 2)
          @number_window.active = true
          @number_window.visible = true
          @status_window.visible = true
        end
      end
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  end
  #--------------------------------------------------------------------------
end
#==============================================================================
end
#==============================================================================
Erstellt von MelekTaus in der Kategorie RPGVX-Scripts

Keine Kommentare:

Kommentar veröffentlichen

Neuerer Post Älterer Post Startseite

Seiten

  • Willkommen
  • Neueste Posts
  • Alle Filme und Serien

Veröffentlichung

Kategorien

  • Allgemeines (9)
  • Filme (71)
  • Gedichte (5)
  • Liebling und Ich (10)
  • Met (7)
  • Musik (10)
  • Origami (5)
  • Projekte (4)
  • RPGVX-Scripts (2)
  • Software (4)
  • Spiele (6)
  • Tabs (3)
  • Träume (6)
  • VB.NET-Codes (1)
  • Werbung (1)
  • YouTube-Videos (8)
  • Zeichnungen (3)

WM 2010

Wird geladen...

Freunde

Kommentare

Shoutbox