Accueil du SiteAccueil du Site  AccueilAccueil  Dernières imagesDernières images  RechercherRechercher  ConnexionConnexion  S'enregistrerS'enregistrer  



Le Deal du moment : -20%
Ecran PC GIGABYTE 28″ LED M28U 4K ( IPS, 1 ms, ...
Voir le deal
399 €

Partagez
 

 [VX] CC shop menu

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
RitoJS
Ancien staffeux
Ancien staffeux
RitoJS

Masculin
Messages postés : 1925
Date d'inscription : 22/02/2012
Jauge LPC :
[VX] CC shop menu 8915271400100 / 100100 / 100[VX] CC shop menu 8915271400

[VX] CC shop menu Membre15
[VX] CC shop menu Mappeu10
[VX] CC shop menu Projet10
[VX] CC shop menu Projet16
[VX] CC shop menu Riche_10


[VX] CC shop menu Empty
MessageSujet: [VX] CC shop menu   [VX] CC shop menu EmptyMer 20 Fév 2013 - 22:20

Crédit: Claimh
Ce script vous permet d'avoir un menu magasin plus complet avec la possibilité d’accéder directement au menu équipement:
[VX] CC shop menu Mag-3120cfc

[VX] CC shop menu Mag1-3120d1a

Scripts:
Ce script peut paraître chargé car il est divisé en trois scripts^^
Code:
#==============================================================================
# ■ VX-RGSS2-14 まとめ買いショップ [Ver.1.1.0]      by Claimh
#------------------------------------------------------------------------------
#こんなショップが作れます。
#・まとめ買い&まとめ売りができる
#・装備変更ができる
#・アイテムの詳細が表示できる
#・購入・売却の価格レートの変更ができる
#------------------------------------------------------------------------------
#(注) Scene_Shop等、ショップ系は全て再構築。
#------------------------------------------------------------------------------
# <操作>
# Cボタン  : 購入(売買する品があるとき)
# ←      : 個数増(Ctrl押下中は+10)
# →      : 個数減(Ctrl押下中は-10)
# Yボタン  : 情報切り替え(下のウィンドウ)
# Xボタン  : アイテム詳細情報表示
#------------------------------------------------------------------------------
# <レート変更>
#・購入レート
#  $game_system.shop.buy.rate = 購入レート(%)
#・売却レート
#  $game_system.shop.sell.rate = 購入レート(%)
# <購入合計金額>
#  $game_system.shop.buy.gold
# <売却合計金額>
#  $game_system.shop.sell.gold
#==============================================================================

module ShopEx
  # 装備変更方式
  #  true  : 「装備変更」… メニューと同じ装備画面に遷移
  #  false : 「購入リスト」… 購入したアイテムから選んで装備する
  USE_MENU_EQUIP = false

=begin
◆「装備変更」の仕様
装備画面遷移時に売買しようとしている商品の個数は初期化されます
Scene_Equipに改変が入っている場合、併用できないかも。

◆「購入リスト」の仕様
直前に購入した武器・防具だけが装備可能です
アイテムは使用できません
購入・売却リストの商品個数を増減した時点で購入リストは初期化されます
=end
end

module ShopExItemInfo
  #----------------------------------------------------------------------------
  # アイテム詳細情報の表示方式
  #----------------------------------------------------------------------------
  # 属性表示方法(true:アイコン  false:文字)
  USE_ICON = false

  # 属性用アイコン(USE_ICON=trueの時のみ)
  ELE_ICON = {  # 属性ID => アイコンIndex
    1 => 1,  # 格闘
    2 => 2,  # 斬撃
    3 => 3,  # 刺突
    4 => 4,  # 打撃
    5 => 5,  # 弓
    6 => 6,  # 鞭
    9 => 9,  # 炎
    10 => 10,  # 冷気
    11 => 11,  # 雷
    12 => 12,  # 水
    13 => 13,  # 大地
    14 => 14,  # 風
    15 => 15,  # 神聖
    16 => 16,  # 暗黒
  }

  # 表示しない属性
  ELE_NOT_SHOW = []
  # 表示しないステート
  STT_NOT_SHOW = []
 
  # 表示最大数(属性)
  ELE_MAX = 8
  # 表示最大数(ステート)
  STT_MAX = 8
end

module ShopEx
#==============================================================================
# ■ ShopEx::ShopStatus
#==============================================================================
class ShopStatus
  # 初期購入レート(%)
  BUY_RATE  = 100.0
  # 初期売却レート(%)
  SELL_RATE = 50.0
 
  class Status
    attr_accessor :rate        # レート
    attr_accessor :gold        # 金額
    def initialize(rate)
      @rate = rate
      @gold = 0
    end
    def rate_f
      return (@rate / 100.0)
    end
  end
  attr_reader :buy  # 購入ステータス
  attr_reader :sell  # 売却ステータス
  def initialize
    @buy  = Status.new(BUY_RATE)
    @sell = Status.new(SELL_RATE)
  end
end
end

#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader :shop        # ショップ情報
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_shop_ex initialize
  def initialize
    initialize_shop_ex
    @shop = ShopEx::ShopStatus.new
  end
end

#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 仮想装備時の能力値取得
  #--------------------------------------------------------------------------
  def shop_v_equip(type, equip_id, prm)
    tmp2_id = 0
    case type # 仮想装備にする
    when 0; tmp_id = @weapon_id; @weapon_id = equip_id
      unless two_hands_legal?
        tmp2_id = @armor1_id;    @armor1_id = 0
      end
    when 1; tmp_id = @armor1_id; @armor1_id = equip_id
      unless two_hands_legal?
        tmp2_id = @weapon_id;    @weapon_id = 0
      end
    when 2; tmp_id = @armor2_id; @armor2_id = equip_id
    when 3; tmp_id = @armor3_id; @armor3_id = equip_id
    when 4; tmp_id = @armor4_id; @armor4_id = equip_id
    end
    case prm  # 仮想装備時のパラメータ
    when 0; ret_prm = self.atk
    when 1; ret_prm = self.def
    when 2; ret_prm = self.spi
    when 3; ret_prm = self.agi
    when 4; ret_prm = self.hit
    when 5; ret_prm = self.eva
    end
    case type # 仮想装備を戻す
    when 0; @weapon_id = tmp_id
      @armor1_id = tmp2_id  if tmp2_id != 0
    when 1; @armor1_id = tmp_id
      @weapon_id = tmp2_id  if tmp2_id != 0
    when 2; @armor2_id = tmp_id
    when 3; @armor3_id = tmp_id
    when 4; @armor4_id = tmp_id
    end
    return ret_prm
  end
end

Revenir en haut Aller en bas
http://lunarito.wordpress.com/ https://twitter.com/RitoJS http://ritojs.deviantart.com/
RitoJS
Ancien staffeux
Ancien staffeux
RitoJS

Masculin
Messages postés : 1925
Date d'inscription : 22/02/2012
Jauge LPC :
[VX] CC shop menu 8915271400100 / 100100 / 100[VX] CC shop menu 8915271400

[VX] CC shop menu Membre15
[VX] CC shop menu Mappeu10
[VX] CC shop menu Projet10
[VX] CC shop menu Projet16
[VX] CC shop menu Riche_10


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 20 Fév 2013 - 22:22

2ème partie:
Code:
#==============================================================================
# ■ VX-RGSS2-14 まとめ買いショップ [Ver.1.1.0]      by Claimh
#==============================================================================

#==============================================================================
# ■ ShopItem
#==============================================================================
class ShopItem
  BUY=0;SELL=1;EQUIP=2
  NUM_MAX = 99  # 最大所持数
 
  attr_reader :item    # RPG::Item / RPG::Weapon / RPG::Armor
  attr_reader :num      # 所持数
  attr_reader :status  # 取引可能状態
  attr_reader :price    # 価格
  attr_accessor :s_num  # 予約数
  # オブジェクト初期化
  def initialize(item, mode)
    @mode = mode
    @item = item
    @price = item_price
    reset
    @status = item_status(0)
  end
  # 所持数/予約数リセット
  def reset(s_num=0)
    @num  = party_num
    @s_num = s_num
  end
  # 所持数
  def party_num
    return $game_party.item_number(@item)
  end
  # 取引状態の更新
  def item_status(total)
    case @mode
    when BUY
      return false if (total + @price) > $game_party.gold
      return false if (@s_num + @num) >= NUM_MAX
    when SELL
      return false if @num == @s_num
      return false if @item.price == 0
    when EQUIP
      return false if @item.is_a?(RPG::Item)
    end
    return true
  end
  # 取引状態のチェック(更新)
  def update_status(total)
    n = party_num
    ret = (@num != n)
    @num = n
    st = item_status(total)
    ret |= (@status != st)
    @status = st
    return ret
  end
  # 取引可能個数のシミュレーション
  def item_simlate(total, n=1)
    case @mode
    when BUY
      return 0 if (@s_num + @num) >= NUM_MAX
      b_n = (($game_party.gold - total) / @price).truncate
      return [n, b_n, (NUM_MAX - @num - @s_num)].min
    when SELL
      return 0 if @item.price == 0
      return [n, (@num - @s_num)].min
    end
    return 0
  end
  # 売買価格(レート考慮)
  def item_price
    case @mode
    when BUY;  return (@item.price * $game_system.shop.buy.rate_f).truncate
    when SELL;  return (@item.price * $game_system.shop.sell.rate_f).truncate
    end
    return 0
  end
  # 売買処理
  def sale
    d = (@mode==BUY ? 1 : -1)
    $game_party.gain_item(@item, @s_num * d)
  end
end

#==============================================================================
# ■ ShopItemList
#==============================================================================
class ShopItemList
  BUY=0;SELL=1;EQUIP=2
  attr_reader :list    # 購入/売却リスト
  attr_accessor :total  # 支払い予定金額
  # オブジェクト初期化
  def initialize(mode)
    @mode = mode
    @total = 0
    case @mode
    when BUY;  @list = buy_list
    when SELL;  @list = sell_list
    when EQUIP; @list = []
    end
  end
  # リスト初期化
  def list_reset
    @total = 0
    @list = sell_list if @mode == SELL
  end
  # 購入リスト
  def buy_list
    list = []
    for goods_item in $game_temp.shop_goods
      case goods_item[0]
      when 0; list.push(ShopItem.new($data_items[goods_item[1]], @mode))
      when 1; list.push(ShopItem.new($data_weapons[goods_item[1]], @mode))
      when 2; list.push(ShopItem.new($data_armors[goods_item[1]], @mode))
      end
    end
    return list
  end
  # 売却リスト
  def sell_list
    list = []
    for item in $game_party.items
      list.push(ShopItem.new(item, @mode))
    end
    return list
  end
  # 装備リスト
  def equip_list(list=[])
    @list = []
    for item in list
      next if item.s_num <= 0
      e_item = ShopItem.new(item.item, EQUIP)
      e_item.s_num = item.s_num  # 買った個数を引き継ぐ
      @list.push(e_item)
    end
  end
  # 売却リストのチェック
  def check_sell_list
    new_list = sell_list
    # サイズが同じ場合はデータの整合性チェック
    if new_list.size == @list.size
      remake = false
      refresh = []
      for i in 0...@list.size
        # 並びが違うのでremake
        if @list[i].item != new_list[i].item
          remake = true
          break
        # 売買時に予約数がある or 所持数が変わった : 部分refresh
        elsif @list[i].s_num > 0 or @list[i].num != new_list[i].num
          @list[i].reset
          refresh.push(i)
        end
      end
      unless remake
        return [true, refresh]
      end
    end
    @list = new_list
    return [false, []]
  end
  # アイテムの所持数・予約数初期化
  def reset
    for item in @list
      item.reset
    end
  end
  # リストデータ参照
  def [](index)
    return @list[index]
  end
  # リストサイズ
  def size
    return @list.size
  end
  # リスト空?
  def empty?
    return @list.empty?
  end
end

#==============================================================================
# ■ Window_ShopList
#------------------------------------------------------------------------------
#<設計メモ>
# - アイテム数が多い状態でも軽く動作できるようにdraw_textの頻度を下げる
# - 購入・売却・装備の各リストのbitmapをキャッシュしておく
# - 購入・売却・装備の切り替え時にはbitmapだけを交換する
# - リスト情報の変化がある場合は全てrefreshせずになるべく差分更新で済ませる
#==============================================================================
class Window_ShopList < Window_Selectable
  BUY=0;SELL=1;EQUIP=2;EXIT=3
  attr_accessor :total_window
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(140, WLH + 32, 404, WLH*9 + 32)
    @data = [[],[],[],[]]
    bit = Bitmap.new(WLH, WLH)
    @bitmap = [nil, nil, bit, bit]
    @index_s = [-1,-1,-1,-1]
    @mode = BUY
    all_data_refresh
    @sprite_price = Sprite_ShopTAG.new(self.x+280, self.y+2, "Prix")
    @sprite_num = Sprite_ShopTAG.new(self.x+340, self.y+2, "Possesion")
  end
  #--------------------------------------------------------------------------
  # ● オブジェクト開放
  #--------------------------------------------------------------------------
  def dispose
    super
    for bitmap in @bitmap
      unless bitmap.nil?
        bitmap.dispose
        bitmap = nil
      end
    end
    @sprite_price.dispose
    @sprite_num.dispose
  end
  #--------------------------------------------------------------------------
  # ● モード変更
  #--------------------------------------------------------------------------
  def mode=(mode)
    return if mode == @mode
    @index_s[@mode] = @index
    @mode = mode
    self.contents = @bitmap[@mode]
    @item_max = @data[@mode].size
    self.oy = 0
    self.index = @index_s[@mode]
    case @mode
    when BUY, SELL; @sprite_price.visible = @sprite_num.visible = true
    when EQUIP;    @sprite_price.visible = false
                    @sprite_num.visible  = !ShopEx::USE_MENU_EQUIP
    else;          @sprite_price.visible = @sprite_num.visible = false
    end
  end
  def init_index
    self.index = 0 if @index < 0
  end
  #--------------------------------------------------------------------------
  # ● リスト遷移可能か?
  #--------------------------------------------------------------------------
  def can_select?
    return (@item_max != 0)
  end
  #--------------------------------------------------------------------------
  # ● アイテム取得
  #--------------------------------------------------------------------------
  def item_list
    return @data
  end
  def data_i(index)
    return @data[@mode][index]
  end
  def item_i(index)
    return @data[@mode][index].item
  end
  def item
    return nil if @index < 0 or @index >= @data[@mode].size
    return @data[@mode][@index].item
  end
  #--------------------------------------------------------------------------
  # ● アイテムの価格取得
  #--------------------------------------------------------------------------
  def item_price_i(index)
    return item_i(index).item_price(@mode)
  end
  #--------------------------------------------------------------------------
  # ● 購入・売却アイテムの合計価格取得
  #--------------------------------------------------------------------------
  def total_price
    return (@data[BUY].total - @data[SELL].total)
  end
  #--------------------------------------------------------------------------
  # ● 有効Indexか?
  #--------------------------------------------------------------------------
  def index_active?
    return data_i(@index).status
  end
  #--------------------------------------------------------------------------
  # ● データリフレッシュ(ALL)
  #--------------------------------------------------------------------------
  def all_data_refresh
    data_refresh(BUY)
    data_refresh(SELL)
  end
  #--------------------------------------------------------------------------
  # ● データリフレッシュ
  #--------------------------------------------------------------------------
  def data_refresh(mode)
    old_size = @data[mode].size
    if @data[mode].is_a?(Array)
      @data[mode] = ShopItemList.new(mode)
    else
      @data[mode].list_reset
    end
    reameke_bitmap(old_size, mode)
  end
  #--------------------------------------------------------------------------
  # ● ビットマップの再生成
  #--------------------------------------------------------------------------
  def reameke_bitmap(old_size, mode)
    size = @data[mode].size
    if size != old_size # サイズ違い→bitmap再生成
      @bitmap[mode].dispose if @bitmap[mode] != nil
      @bitmap[mode] = (size == 0 ? Bitmap.new(WLH, WLH) : Bitmap.new(width - 32, size * WLH))
    elsif @bitmap[mode].nil? # bitmapない→仮bitmap作成
      @bitmap[mode] = Bitmap.new(WLH, WLH)
    elsif size != 0 # bitmapサイズは変わらない→中身をクリア
      @bitmap[mode].clear
    end
    return if size == 0 # リストが空なら何もしない
    # bitmap再描画
    tmp = @mode
    @mode = mode
    self.contents = @bitmap[mode]
    refresh
    @mode = tmp
    self.contents = @bitmap[@mode]
    @item_max = @data[@mode].size
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh(clear=false)
    self.contents.clear if clear
    @item_max = @data[@mode].size
    return if @item_max <= 0
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● 差分リフレッシュ
  #--------------------------------------------------------------------------
  def diff_refresh(mode, index=-1)
    return if @data[mode].size <= 0
    tmp = @mode
    @mode = mode
    self.contents = @bitmap[mode]
    @item_max = @data[mode].size
    for i in 0...@item_max
      # 差分有り or カレント は再描画
      if @data[mode][i].update_status(total_price) or i == index
        draw_item(i, true)
      end
    end
    @mode = tmp
    self.contents = @bitmap[@mode]
    @item_max = @data[@mode].size
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index, clear=false)
    x = 4
    y = index * WLH
    if clear # 表示クリアする場合のみ
      rect = Rect.new(x, y, self.width - 32, WLH)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    end
    item = data_i(index)
    self.contents.font.color.alpha = item.status ? 255 : 128
    draw_item_name(item.item, x, y, (item.status ? 255 : 128))
    if @mode == EQUIP
      self.contents.draw_text(x + 270, y, 88, WLH, item.s_num.to_s, 2)
    else
      if item.s_num > 0
        self.contents.draw_text(x + 196, y, 32, WLH, "×")
        self.contents.draw_text(x + 196, y, 36, WLH, item.s_num.to_s, 2)
      end
      self.contents.draw_text(x + 210, y, 88, WLH, item.price.to_s, 2)
      self.contents.draw_text(x + 270, y, 88, WLH, item.num.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● アイテム名の描画
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, opacity)
    return if item == nil
    bitmap = Cache.system("Iconset")
    rect = Rect.new(item.icon_index % 16 * 24, item.icon_index / 16 * 24, 24, 24)
    self.contents.blt(x, y, bitmap, rect, opacity)
    self.contents.draw_text(x + 28, y, 212, WLH, item.name)
  end
  #--------------------------------------------------------------------------
  # ● 個数増
  #--------------------------------------------------------------------------
  def up(n=1)
    data = data_i(@index)
    n = data.item_simlate(total_price, n)
    return false if n == 0
    data.s_num += n
    @data[@mode].total += data.price * n
    updw_common
    return true
  end
  #--------------------------------------------------------------------------
  # ● 個数減
  #--------------------------------------------------------------------------
  def dw(n=1)
    data = data_i(@index)
    return false if data.s_num == 0
    n = [n, data.s_num].min
    data.s_num -= n
    @data[@mode].total -= data.price * n
    updw_common
    return true
  end
  #--------------------------------------------------------------------------
  # ● 個数増減:共通処理
  #--------------------------------------------------------------------------
  def updw_common
    case @mode
    when BUY  # BUY側はお金足りない部分が出るから差分を探して再描画
      diff_refresh(@mode, @index)
    when SELL
      @data[SELL][@index].update_status(total_price)
      draw_item(@index, true) # SELL側は1項目だけ再描画
      diff_refresh(BUY) # BUY側は差分を探して再描画
    end
    @total_window.refresh(total_price)
    if @data[EQUIP].size > 0
      @data[EQUIP] = []
      @bitmap[EQUIP].dispose if @bitmap[EQUIP] != nil
      @bitmap[EQUIP] = Bitmap.new(WLH,WLH)
      @index_s[EQUIP] = -1
    end
  end
  #--------------------------------------------------------------------------
  # ● 売買処理
  #--------------------------------------------------------------------------
  def sale
    @index_s[@mode] = @index
    $game_system.shop.buy.gold += @data[BUY].total
    $game_system.shop.sell.gold += @data[SELL].total unless $game_temp.shop_purchase_only
    $game_party.lose_gold(total_price)
    sale_item(BUY)
    sale_item(SELL) unless $game_temp.shop_purchase_only
    make_buy_list  unless ShopEx::USE_MENU_EQUIP
    check_buy_list
    check_sell_list
    @data[SELL].total = 0 unless $game_temp.shop_purchase_only
    @data[SELL].reset unless $game_temp.shop_purchase_only
    @total_window.refresh(total_price)
    self.index = @index_s[@mode]
    @item_max = @data[@mode].size
  end
  def sale_item(mode)
    return if @data[mode].total == 0
    for item in @data[mode].list
      item.sale if item.s_num > 0
    end
  end
  def make_buy_list
    return if @data[BUY].total == 0
    @data[EQUIP] = ShopItemList.new(EQUIP)
    @data[EQUIP].equip_list(@data[BUY].list)
    reameke_bitmap(0, EQUIP)  # bitmap生成&描画
  end
  #--------------------------------------------------------------------------
  # ● データチェック(BUY)
  #--------------------------------------------------------------------------
  def check_buy_list
    tmp = @mode
    @mode = BUY
    self.contents = @bitmap[BUY]
    data = @data[BUY]
    for i in 0...data.size
      item = data[i]
      next if item.s_num == 0 and item.num == item.party_num
      item.reset
      item.update_status(0)
      draw_item(i, true)
    end
    data.total = 0
    @mode = tmp
    self.contents = @bitmap[@mode]
    @index_s[BUY] = @data[BUY].size - 1 if @index_s[BUY] >= @data[BUY].size
  end
  #--------------------------------------------------------------------------
  # ● データチェック(SELL)
  #--------------------------------------------------------------------------
  def check_sell_list
    return if $game_temp.shop_purchase_only
    old_size = @data[SELL].size
    ret = @data[SELL].check_sell_list
    if !ret[0]
      reameke_bitmap(old_size, SELL)
      @index_s[SELL] = @data[SELL].size - 1 if @index_s[SELL] >= @data[SELL].size
    elsif !ret[1].empty?
      tmp = @mode
      @mode = SELL
      self.contents = @bitmap[SELL]
      @item_max = @data[SELL].size
      for i in ret[1]
        draw_item(i, true)
      end
      @mode = tmp
      self.contents = @bitmap[@mode]
    end
  end
  #--------------------------------------------------------------------------
  # ● 装備処理
  #--------------------------------------------------------------------------
  def equip_item(actor_index)
    data = data_i(@index)
    case data.item
    when RPG::Weapon; type = 0
    when RPG::Armor;  type = data.item.kind + 1
    else; return
    end
    $game_party.members[actor_index].change_equip(type, data.item)
    data.s_num -= 1
    #
    ret = false
    # Equipを再構成
    if data.s_num <= 0
      ret = true  # 残数ゼロ
      @data[EQUIP].equip_list(@data[EQUIP].list.dup)
      reameke_bitmap(-1, EQUIP)
      self.index = @data[EQUIP].size - 1 if @index >= @data[EQUIP].size
    else
      draw_item(@index, true)
    end
    diff_refresh(BUY) # BUY側を再描画
    check_sell_list  # Sell側を再描画
    return ret
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item == nil ? "" : item.description)
  end
end

#==============================================================================
# ■ Window_ShopCommand
#==============================================================================
class Window_ShopCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, WLH + 32, 140, 4 * WLH + 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    equip = ShopEx::USE_MENU_EQUIP ? "Equiper" : "Oui"
    @commands = ["Acheter", "Vendre", equip, "Fermer"]
    @item_max =  @commands.size
    refresh
    self.index = 0
  end
  def enable?(i)
    return !(i == 1 and $game_temp.shop_purchase_only)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      self.contents.font.color.alpha = enable?(i) ? 255 : 128
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    self.contents.draw_text(4, index*WLH, 128, WLH, @commands[index])
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.mode = self.index
  end
end

#==============================================================================
# ■ Sprite_ShopTAG
#==============================================================================
class Sprite_ShopTAG < Sprite
  W = 100
  H = 14
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, tag)
    super(Viewport.new(x, y, W, H))
    self.viewport.z = 200
    self.bitmap = Bitmap.new(W, H)
    self.bitmap.font.size = 12
    self.bitmap.font.color = Color.new(192, 224, 255, 255)
    self.bitmap.draw_text(0, 0, W, H, tag)
  end
end

#==============================================================================
# ■ Window_ShopGold
#==============================================================================
class Window_ShopGold < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, (WLH + 32)+(WLH*4 + 32), 140, WLH + 32+4)
    self.contents = Bitmap.new(width - 32, height - 32)
    @sprite = Sprite_ShopTAG.new(self.x+8, self.y+4, "Lin posséde")
    refresh
  end
  def dispose
    super
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.terms.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 4, 100-cx-2, WLH, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(104-cx, 4, cx, WLH, $data_system.terms.gold, 2)
  end
end

#==============================================================================
# ■ Window_ShopItemsGold
#==============================================================================
class Window_ShopItemsGold < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, (WLH + 32)+(WLH*4 + 32)+(WLH + 32)+4, 140, WLH + 32+4)
    self.contents = Bitmap.new(width - 32, height - 32)
    @sprite = Sprite_ShopTAG.new(self.x+8, self.y+4, "Total du montant")
    refresh(0)
  end
  def dispose
    super
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh(gold)
    self.contents.clear
    cx = contents.text_size($data_system.terms.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 4, 100-cx-2, WLH, gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(104-cx, 4, cx, WLH, $data_system.terms.gold, 2)
  end
end

#==============================================================================
# ■ Window_ShopSale
#==============================================================================
class Window_ShopSale < Window_Base
  BUY=0;SELL=1
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(140+50, WLH + 32 + 40, 404-100, WLH*9+32 - 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 200
    self.z = 300
    self.visible = false
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh(data)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4,  0, 120, WLH, "Lin dépenser")
    self.contents.draw_text(4, WLH, 120, WLH, "Lin obtenu")
    self.contents.fill_rect(Rect.new(0, WLH*2+2, self.contents.width, 2), Color.new(255, 255, 255, 255))
    self.contents.draw_text(4, WLH*2+6, 120, WLH, "Dépense")
    self.contents.draw_text(4, WLH*3+6, 120, WLH, "Reste de Lin")
    self.contents.font.color = normal_color
    # 合計価格と通貨単位を描画
    domination = $data_system.terms.gold
    cx = contents.text_size(domination).width
    self.contents.font.color = normal_color
    w = 248-cx-2
    self.contents.draw_text(4,  0, w, WLH, data[BUY].total.to_s, 2)
    self.contents.draw_text(4, WLH, w, WLH, data[SELL].total.to_s, 2)
    self.contents.draw_text(4, WLH*2+6, w, WLH, (data[BUY].total - data[SELL].total).to_s, 2)
    self.contents.draw_text(4, WLH*3+6, w, WLH, ($game_party.gold - (data[BUY].total - data[SELL].total)).to_s, 2)
    self.contents.font.color = system_color
    x = 262-cx
    self.contents.draw_text(x,  0, cx, WLH, domination, 2)
    self.contents.draw_text(x, WLH, cx, WLH, domination, 2)
    self.contents.draw_text(x, WLH*2+6, cx, WLH, domination, 2)
    self.contents.draw_text(x, WLH*3+6, cx, WLH, domination, 2)
  end
end

#==============================================================================
# ■ Window_ShopSaleCommand
#==============================================================================
class Window_ShopSaleCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(140+50, WLH + 32 + 150, 404-100, WLH+32)
    @commands = ["Confirmer ", "Annuler"]
    @item_max = @commands.size
    @column_max = 2
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.opacity = 0
    self.contents_opacity = 255
    show(false)
    self.z = 350
  end
  def show(f)
    self.active = f
    self.visible = f
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      rect = item_rect(i)
      rect.x += 4
      rect.width -= 8
      self.contents.draw_text(rect, @commands[i], 1)
    end
  end
end

#==============================================================================
# ■ Window_ShopEquipParty
#==============================================================================
class Window_ShopEquipParty < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(index=0)
    actors = []
    for actor in $game_party.members
      actors.push(actor.name)
    end
    x = ShopEx::USE_MENU_EQUIP ? 100 : 320
    # コマンドの個数からウィンドウの高さを算出
    super(x, 128, 160, actors.size * WLH + 32)
    @item_max = actors.size
    @commands = actors
    self.contents = Bitmap.new(width - 32, @item_max * WLH)
    self.z = 300
    @enable = []
    for i in 0...@item_max
      @enable.push(true)
    end
    refresh
    self.index = index
    show(false)
  end
  def show(f)
    self.active = f
    self.visible = f
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #    index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    self.contents.font.color.alpha = @enable[index] ? 255 : 128
    self.contents.draw_text(4, WLH * index, self.contents.width - 8, WLH, @commands[index])
  end
  #--------------------------------------------------------------------------
  # ● アイテム使用・装備用の再描画
  #--------------------------------------------------------------------------
  def refresh_equip(item)
    show(true)
    self.contents.clear
    for i in 0...@item_max
      update_enable(i, item)
      draw_item(i)
    end
  end
  def update_enable(i, item)
    case item
    when RPG::Item
      @enable[i] = false  # アイテムは使えない
    when RPG::Weapon, RPG::Armor
      @enable[i] = $game_party.members[i].equippable?(item)
    end
  end
  def c_enable?
    return @enable[@index]
  end
end

#==============================================================================
# ■ Window_ShopStatus
#==============================================================================
class Window_ShopStatus < Window_Base
  M_PARTY = 0 # パーティーステータス
  M_ACTOR = 1 # アクターステータス
  PATTERN = [M_PARTY, M_ACTOR]  # 切り替えの並び順
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    y = (WLH*9 + 32)+(WLH + 32)
    super(0, y, 544, 416-y)
    self.contents = Bitmap.new(width - 32, height - 32)
    @item = nil
    @mode = PATTERN[0]
    @actor_idx = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ● アイテム名の描画
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, opacity=255)
    return if item == nil
    bitmap = Cache.system("Iconset")
    rect = Rect.new(item.icon_index % 16 * 24, item.icon_index / 16 * 24, 24, 24)
    self.contents.blt(x, y, bitmap, rect, opacity)
    self.contents.draw_text(x + 28, y, 212, WLH, item.name)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    return if @item == nil
    case @mode
    when M_PARTY; refresh_party
    when M_ACTOR; refresh_actor
    end
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ  : M_PARTY
  #--------------------------------------------------------------------------
  def refresh_party
    # 装備品追加情報
    for i in 0...$game_party.members.size
      # アクターを取得
      actor = $game_party.members[i]
      x = 128*i
      case @item
      when RPG::Item
        draw_actor_name(actor, x, 0)
        draw_actor_hp(actor, x, WLH+4)
        draw_actor_mp(actor, x, WLH*2+4)
      when RPG::Weapon, RPG::Armor
        # 装備可能なら通常文字色に、不可能なら無効文字色に設定
        able = actor.equippable?(@item)
        self.contents.font.color = normal_color
        self.contents.font.color.alpha = able ? 255 : 128
        # アクターの名前を描画
        self.contents.draw_text(x, 0, 120, WLH, actor.name)
        next unless able
        if @item.is_a?(RPG::Weapon)
          diff = actor.shop_v_equip(0, @item.id, 0) - actor.atk
          draw_item_diff(x, WLH+4, $data_system.terms.atk, diff, able)
          diff = actor.shop_v_equip(0, @item.id, 4) - actor.hit
          draw_item_diff(x, WLH*2+4, "Critique", diff, able)
        elsif @item.is_a?(RPG::Armor)
          case @item.kind
          when 0; item1 = $data_armors[actor.armor1_id]
          when 1; item1 = $data_armors[actor.armor2_id]
          when 2; item1 = $data_armors[actor.armor3_id]
          when 3; item1 = $data_armors[actor.armor4_id]
          end
          diff = actor.shop_v_equip(@item.kind+1, @item.id, 1) - actor.def
          draw_item_diff(x, WLH+4, $data_system.terms.def, diff, able)
          diff = actor.shop_v_equip(@item.kind+1, @item.id, 5) - actor.eva
          draw_item_diff(x, WLH*2+4, "Evasion", diff, able)
        end
      end
    end
  end
  def draw_item_diff(x, y, word, change, able)
    self.contents.font.color = system_color
    self.contents.font.color.alpha = able ? 255 : 128
    self.contents.draw_text(x, y, 112, WLH, word)
    if !able
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = 128
    elsif change > 0
      self.contents.font.color = power_up_color
    elsif change < 0
      self.contents.font.color = power_down_color
    else
      self.contents.font.color = normal_color
    end
    self.contents.draw_text(x+22, y, 82, WLH, sprintf("%+d", change), 2)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ  : M_ACTOR
  #--------------------------------------------------------------------------
  def refresh_actor
    actor = $game_party.members[@actor_idx]
    able = @item.is_a?(RPG::Item) ? true : actor.equippable?(@item)
    type = @item.is_a?(RPG::Item) ? -1 : (@item.is_a?(RPG::Weapon) ? 0 : (@item.kind + 1) )
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = able ? 255 : 128
    self.contents.draw_text(0, 0, 120, WLH, actor.name)
    case @item
    when RPG::Item
      draw_actor_level(actor, 128, 0)
    when RPG::Weapon
      draw_item_name($data_weapons[actor.weapon_id], 128, 0, able ? 255 : 128)
    when RPG::Armor
      case @item.kind
      when 0; item1 = $data_armors[actor.armor1_id]
      when 1; item1 = $data_armors[actor.armor2_id]
      when 2; item1 = $data_armors[actor.armor3_id]
      when 3; item1 = $data_armors[actor.armor4_id]
      end
      draw_item_name(item1, 128, 0, able ? 255 : 128)
    end
    word = [$data_system.terms.atk, "Attaque",
            $data_system.terms.def, "Defense",
            $data_system.terms.spi, $data_system.terms.agi ]
    now = [actor.atk, actor.hit, actor.def, actor.eva, actor.spi, actor.agi]
    new = able ? [
      actor.shop_v_equip(type, @item.id, 0), actor.shop_v_equip(type, @item.id, 4),
      actor.shop_v_equip(type, @item.id, 1), actor.shop_v_equip(type, @item.id, 5),
      actor.shop_v_equip(type, @item.id, 2), actor.shop_v_equip(type, @item.id, 3)
    ] : now
   
    for i in 0...word.size
      draw_item_diff2(170*(i/2), WLH*(1+i%2)+4, word[i], able, now[i], new[i])
    end
  end
  def draw_item_diff2(x, y, word, able, now, new)
    self.contents.font.color = system_color
    self.contents.font.color.alpha = able ? 255 : 128
    self.contents.draw_text(x, y, 112, WLH, word)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = able ? 255 : 128
    self.contents.draw_text(x+12, y, 82, WLH, now.to_s, 2)
    return if !able or now == new

    self.contents.font.color = system_color
    self.contents.font.color.alpha = able ? 255 : 128
    self.contents.draw_text(x+100, y, WLH, WLH, "→")
    if now < new
      self.contents.font.color = power_up_color
    elsif now > new
      self.contents.font.color = power_down_color
    end
    self.contents.draw_text(x+72, y, 82, WLH, new.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # ● アイテムの設定
  #    item : 新しいアイテム
  #--------------------------------------------------------------------------
  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● モードチェンジ
  #--------------------------------------------------------------------------
  def change_mode
    if @mode == M_ACTOR
      @actor_idx += 1
      if @actor_idx == $game_party.members.size
        @actor_idx = 0
        @mode = PATTERN[0]
      end
      refresh
    else
      @mode = PATTERN[((@mode + 1) % PATTERN.size)]
      refresh
    end
    return true
  end
end

#==============================================================================
# ■ Window_ShopItemInfo
#==============================================================================
class Window_ShopItemInfo < Window_Base
  include ShopExItemInfo
  #----------------------------------------------------------------------------
  TEXT_H = WLH  # 文字高さ
  ES_W = 4    # 属性・ステート間隔
 
  SCOPE = [ "U ", "I", "V", "O", "B",
            "Qム", "敵三体 ランダム", "味方単体", "味方全体",
            "味方単体 (戦闘不能) ", "味方全体 (戦闘不能)", "使用者" ]
  #OCCASION = ["常時使用可能", "戦闘のみ", "マップ上のみ", "使用不可"]

  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(140, WLH + 32, 404, WLH*9 + 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 200
    self.visible = false
    self.z = 200
    @data = nil
  end
  def item=(data)
    return if @data == data
    @data = data
    refresh(data)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #      data : RPG::Item / RPG::Weapon / RPG::Armor / RPG::Skill
  #--------------------------------------------------------------------------
  def refresh(data)
    self.contents.clear
    return if data.nil?
    draw_item_name(data, indent(0), 0)
    #self.contents.draw_text(indent(1), TEXT_H, contents.width-indent(1), TEXT_H, data.description)
    #self.contents.fill_rect(0, TEXT_H*2, contents.width, 2, Color.new(255,255,255,128))
    case data
    when RPG::Item;  draw_item_info(data)
    when RPG::Weapon; draw_weapon_info(data)
    when RPG::Armor;  draw_armor_info(data)
    end
  end
  #--------------------------------------------------------------------------
  # ● Line計算
  #--------------------------------------------------------------------------
  def line(n)
    return TEXT_H * n + 4
  end
  #--------------------------------------------------------------------------
  # ● インデント
  #--------------------------------------------------------------------------
  def indent(n)
    case n
    when 0; return 4
    when 1; return 14
    when 2; return 14+60
    when 3; return 190
    when 4; return 190+60
    when 5; return 150
    when 6; return 90
    end
    return 0
  end
  #--------------------------------------------------------------------------
  # ● アイコン描画(Graphics/Icons内の画像を表示)
  #--------------------------------------------------------------------------
  def draw_icon2(x, y, icon_index)
    bit = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    yy = (TEXT_H - 24) / 2
    self.contents.blt(x, y+yy, bit, rect)
    return 24 + ES_W
  end
  #--------------------------------------------------------------------------
  # ● 属性描画
  #--------------------------------------------------------------------------
  def draw_elements(elements, x, y)
    cnt = 0
    xx = 0
    for id in elements
      next if ELE_NOT_SHOW.include?(id)
      break if cnt == ELE_MAX
      if USE_ICON
        xx += draw_icon2(x+xx, y, ELE_ICON[id])
      else
        rect = self.contents.text_size($data_system.elements[id])
        break if (x+xx+rect.width) > contents.width
        self.contents.draw_text(x+xx, y, rect.width, TEXT_H, $data_system.elements[id])
        xx += rect.width + ES_W
      end
      cnt += 1
    end
  end
  #--------------------------------------------------------------------------
  # ● ステート描画
  #--------------------------------------------------------------------------
  def draw_states(states, x, y)
    cnt = 0
    xx = 0
    for id in states
      next if STT_NOT_SHOW.include?(id)
      break if cnt == STT_MAX
      xx += draw_icon2(x+xx, y, $data_states[id].icon_index)
      cnt += 1
    end
  end
  #--------------------------------------------------------------------------
  # ● Item情報描画
  #      data : アイテム(RPG::Item)
  #--------------------------------------------------------------------------
  def draw_item_info(data)
    # 消耗品
    if data.consumable
      self.contents.font.color = system_color
      self.contents.draw_text(200, 0, 200, TEXT_H, "【消耗品】")
    end
    l = 1 # 行

    # 範囲と命中率
    if data.scope != 0
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(l), 200, TEXT_H, "範囲")
      self.contents.font.color = normal_color
      self.contents.draw_text(indent(2), line(l), 200, TEXT_H, SCOPE[data.scope])
      l += 1
    end

    # HP/SP増減、パラメータ変化
    hpspparam = false
    sys_l  = l
    hp = "#{$data_system.terms.hp}"
    mp = "#{$data_system.terms.mp}"
    if data.hp_recovery_rate != 0
      hpspparam = true
      pm = data.hp_recovery_rate >= 0 ? "回復" : "ダメージ"
      text = "最大#{hp}の#{data.hp_recovery_rate.abs}%#{pm}"
      self.contents.draw_text(indent(2), line(l), 300, TEXT_H, text)
      l += 1
    end
    if data.hp_recovery != 0
      hpspparam = true
      pm = data.hp_recovery >= 0 ? "回復" : "ダメージ"
      text = "#{hp} #{data.hp_recovery.abs}#{pm}"
      self.contents.draw_text(indent(2), line(l), 300, TEXT_H, text)
      l += 1
    end
    if data.mp_recovery != 0
      hpspparam = true
      pm = data.mp_recovery >= 0 ? "回復" : "ダメージ"
      text = "最大#{mp}の#{data.mp_recovery.abs}%#{pm}"
      self.contents.draw_text(indent(2), line(l), 300, TEXT_H, text)
      l += 1
    end
    if data.mp_recovery != 0
      hpspparam = true
      pm = data.mp_recovery >= 0 ? "回復" : "ダメージ"
      text = "#{mp} #{data.mp_recovery.abs}#{pm}"
      self.contents.draw_text(indent(2), line(l), 300, TEXT_H, text)
      l += 1
    end
    if data.parameter_type != 0 # パラメータ変化効果あり
      hpspparam = true
      param = ["なし", "最大#{hp}", "最大#{mp}",
              $data_system.terms.atk, $data_system.terms.def,
              $data_system.terms.spi, $data_system.terms.agi][data.parameter_type]
      pm = data.parameter_points >= 0 ? "+" : "-"
      text = "#{param} #{pm}#{data.parameter_points}"
      self.contents.draw_text(indent(2), line(l), 300, TEXT_H, text)
      l += 1
    end
    if hpspparam
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(sys_l), 100, TEXT_H, "効果")
    end

    # 属性
    unless data.element_set.empty?
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(l), 100, TEXT_H, "属性")
      self.contents.font.color = normal_color
      draw_elements(data.element_set, indent(2), line(l))
      l += 1
    end
    # 付与ステート
    unless data.plus_state_set.empty?
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(l), 140, TEXT_H, "付与ステート")
      self.contents.font.color = normal_color
      draw_states(data.plus_state_set, indent(5), line(l))
      l += 1
    end
    # 解除ステート
    unless data.minus_state_set.empty?
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(l), 140, TEXT_H, "解除ステート")
      self.contents.font.color = normal_color
      draw_states(data.minus_state_set, indent(5), line(l))
      l += 1
    end
  end
  #--------------------------------------------------------------------------
  # ● Weapon情報描画
  #      data : 武器(RPG::Weapon)
  #--------------------------------------------------------------------------
  def draw_weapon_info(data)
    self.contents.font.color = system_color
    self.contents.draw_text(200, 0, 200, TEXT_H, "【#{$data_system.terms.weapon}】")
    self.contents.draw_text(indent(1), line(1), 200, TEXT_H, $data_system.terms.atk)
    self.contents.draw_text(indent(3), line(1), 200, TEXT_H, "命中率")
    self.contents.draw_text(indent(1), line(2), 200, TEXT_H, $data_system.terms.def)
    self.contents.draw_text(indent(1), line(3), 200, TEXT_H, $data_system.terms.spi)
    self.contents.draw_text(indent(3), line(3), 200, TEXT_H, $data_system.terms.agi)

    self.contents.font.color = normal_color
    self.contents.draw_text(indent(2), line(1), 40, TEXT_H, data.atk.to_s, 2)
    self.contents.draw_text(indent(4), line(1), 40, TEXT_H, data.hit.to_s, 2)
    self.contents.draw_text(indent(2), line(2), 40, TEXT_H, data.def.to_s, 2)
    self.contents.draw_text(indent(2), line(3), 40, TEXT_H, data.spi.to_s, 2)
    self.contents.draw_text(indent(4), line(3), 40, TEXT_H, data.agi.to_s, 2)

    l = 4
    list = []
    list.push("両手持ち") if data.two_handed
    list.push("先制") if data.fast_attack
    list.push("連続攻撃") if data.dual_attack
    list.push("会心の一撃") if data.critical_bonus
    if list.size > 0
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(4), 100, TEXT_H, "特殊効果")
      self.contents.font.color = normal_color
    end
    i = 0
    for item in list
      self.contents.draw_text(90+i*100, line(l), 140, TEXT_H, item)
      l += 1 if i == 1
      i = (i + 1) % 2
    end
    l += 1 if i == 1

    # 属性
    unless data.element_set.empty?
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(l), 100, TEXT_H, "属性")
      self.contents.font.color = normal_color
      draw_elements(data.element_set, indent(2), line(l))
      l += 1
    end
    # 付与ステート
    unless data.state_set.empty?
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(l), 140, TEXT_H, "付与ステート")
      self.contents.font.color = normal_color
      draw_states(data.state_set, indent(5), line(l))
      l += 1
    end
  end
  #--------------------------------------------------------------------------
  # ● Armor情報描画
  #      data : 防具(RPG::Armor)
  #--------------------------------------------------------------------------
  def draw_armor_info(data)
    self.contents.font.color = system_color
    kind = [$data_system.terms.armor1, $data_system.terms.armor2,
            $data_system.terms.armor3, $data_system.terms.armor4][data.kind]
    self.contents.draw_text(200, 0, 200, TEXT_H, "【#{kind}】")
    self.contents.draw_text(indent(1), line(1), 200, TEXT_H, $data_system.terms.atk)
    self.contents.draw_text(indent(1), line(2), 200, TEXT_H, $data_system.terms.def)
    self.contents.draw_text(indent(3), line(2), 200, TEXT_H, "回避率")
    self.contents.draw_text(indent(1), line(3), 200, TEXT_H, $data_system.terms.spi)
    self.contents.draw_text(indent(3), line(3), 200, TEXT_H, $data_system.terms.agi)

    self.contents.font.color = normal_color
    self.contents.draw_text(indent(2), line(1), 40, TEXT_H, data.atk.to_s, 2)
    self.contents.draw_text(indent(2), line(2), 40, TEXT_H, data.def.to_s, 2)
    self.contents.draw_text(indent(4), line(2), 40, TEXT_H, data.eva.to_s, 2)
    self.contents.draw_text(indent(2), line(3), 40, TEXT_H, data.spi.to_s, 2)
    self.contents.draw_text(indent(4), line(3), 40, TEXT_H, data.agi.to_s, 2)

    l = 4
    i = 2
    special = false
    if data.prevent_critical
      special = true
      self.contents.draw_text(indent(i)+20, line(l), 100, TEXT_H, "クリティカル防止")
      i = i == 2 ? 4 : 2
      l += 1 if i == 2
    end
    if data.half_mp_cost
      special = true
      self.contents.draw_text(indent(i)+20, line(l), 100, TEXT_H, "消費MP半減")
      i = i == 2 ? 4 : 2
      l += 1 if i == 2
    end
    if data.double_exp_gain
      special = true
      self.contents.draw_text(indent(i)+20, line(l), 100, TEXT_H, "取得経験値2倍")
      i = i == 2 ? 4 : 2
      l += 1 if i == 2
    end
    if data.auto_hp_recover
      special = true
      self.contents.draw_text(indent(i)+20, line(l), 100, TEXT_H, "HP自動回復")
      i = i == 2 ? 4 : 2
      l += 1 if i == 2
    end
    l += 1 if i == 4
    if special
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(1), 100, TEXT_H, "特殊効果")
    end


    # 属性防御
    unless data.element_set.empty?
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(l), 100, TEXT_H, "属性防御")
      self.contents.font.color = normal_color
      draw_elements(data.element_set, indent(6), line(l))
      l += 1
    end
    # ステート防御
    unless data.state_set.empty?
      self.contents.font.color = system_color
      self.contents.draw_text(indent(1), line(l), 140, TEXT_H, "ステート防御")
      self.contents.font.color = normal_color
      draw_states(data.state_set, indent(5), line(l))
      l += 1
    end
  end
end






Dernière édition par RitoJS le Mer 13 Mar 2013 - 11:52, édité 1 fois
Revenir en haut Aller en bas
http://lunarito.wordpress.com/ https://twitter.com/RitoJS http://ritojs.deviantart.com/
RitoJS
Ancien staffeux
Ancien staffeux
RitoJS

Masculin
Messages postés : 1925
Date d'inscription : 22/02/2012
Jauge LPC :
[VX] CC shop menu 8915271400100 / 100100 / 100[VX] CC shop menu 8915271400

[VX] CC shop menu Membre15
[VX] CC shop menu Mappeu10
[VX] CC shop menu Projet10
[VX] CC shop menu Projet16
[VX] CC shop menu Riche_10


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 20 Fév 2013 - 22:22

3ème partie:
Code:
#==============================================================================
# ■ VX-RGSS2-14 まとめ買いショップ [Ver.1.1.0]      by Claimh
#==============================================================================

#==============================================================================
# ■ Scene_Shop
#==============================================================================
class Scene_Shop < Scene_Base
  INFO_LOCK = true  # infoウィンドウ表示中はアイテムをロックする
  INFO_FLEX = true  # infoウィンドウ表示中にもアイテム選択可能とする
  # ※LOCKとFLEXがfalseならばinfoは表示しない。
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  def initialize(index=0, actor_index=0)
    @index = index
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    create_menu_background
    @help_window = Window_Help.new
    @command_window = Window_ShopCommand.new
    @gold_window = Window_ShopGold.new
    @status_window = Window_ShopStatus.new
    @list_window = Window_ShopList.new
    @sale_window = Window_ShopSale.new
    @info_window = Window_ShopItemInfo.new
    @sale_cmd_window = Window_ShopSaleCommand.new
    @total_window = Window_ShopItemsGold.new
    @equip_window = Window_ShopEquipParty.new(@actor_index)
    #
    @list_window.help_window = @help_window
    @list_window.total_window = @total_window
    @command_window.help_window = @list_window
    #
    return unless ShopEx::USE_MENU_EQUIP
    @command_window.index = @index
    if @index == 2
      @command_window.active = false
      @equip_window.show(true)
    end
    @need_reset = false
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    dispose_menu_background
    @help_window.dispose
    @command_window.dispose
    @gold_window.dispose
    @total_window.dispose
    @list_window.dispose
    @status_window.dispose
    @sale_window.dispose
    @sale_cmd_window.dispose
    @info_window.dispose
    @equip_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● ショップ終わり
  #--------------------------------------------------------------------------
  def exit_shop
    $scene = Scene_Map.new
  end
  def return_command
    @command_window.active = true
    @list_window.active = false
    @help_window.set_text("")
    @status_window.item = nil
    @info_window.item = nil
    @info_window.visible = false
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    if @command_window.active
      update_command
    elsif @info_window.visible and INFO_LOCK
      update_info
    elsif @equip_window.active
      update_equip
    elsif @list_window.active
      update_list
    elsif @sale_cmd_window.active
      update_sale
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_command
    @command_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      exit_shop
    elsif Input.trigger?(Input::C)
      # コマンドウィンドウのカーソル位置で分岐
      case @command_window.index
      when 0,1  # 購入する, 売却する
        if !@list_window.can_select? or !@command_window.enable?(@command_window.index)
          Sound.play_buzzer
          return
        end
        Sound.play_decision
        @command_window.active = false
        @list_window.init_index
        @list_window.active = true
        @list_window.update_help
      when 2  # 装備変更
        if !ShopEx::USE_MENU_EQUIP and !@list_window.can_select?
          Sound.play_buzzer
          return
        end
        Sound.play_decision
        @command_window.active = false
        if ShopEx::USE_MENU_EQUIP
          @equip_window.show(true)
        else
          @list_window.init_index
          @list_window.active = true
          @list_window.update_help
        end
      when 3  # やめる
        Sound.play_decision
        exit_shop
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (リストウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_list
    @list_window.update
    @status_window.item = @list_window.item
    @info_window.item = @list_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_command
    elsif Input.trigger?(Input::C)
      if !ShopEx::USE_MENU_EQUIP and @command_window.index == 2
        unless @list_window.index_active?
          Sound.play_buzzer
          return
        end
        Sound.play_decision
        # アイテム使用 or 装備変更 へ
        @equip_window.refresh_equip(@list_window.item)
        @list_window.active = false
        return
      elsif @list_window.total_price == 0
#        Sound.play_buzzer
#        return
        @list_window.up(1)  # 個数を+1して続ける
        @need_reset = true
      end
      Sound.play_decision
      ## 売買処理へ
      @list_window.active = false
      @sale_window.refresh(@list_window.item_list)
      @sale_window.visible = true
      @sale_cmd_window.show(true)
    elsif Input.trigger?(Input::X)
      return if !INFO_LOCK and !INFO_FLEX
      Sound.play_decision
      @list_window.active = false unless INFO_FLEX
      @info_window.visible = !@info_window.visible
    elsif Input.trigger?(Input::Y)
      @status_window.change_mode ? Sound.play_cursor : Sound.play_buzzer
    elsif Input.repeat?(Input::LEFT)
      return if @command_window.index == 2
      n = Input.press?(Input::CTRL) ? 10 : 1
      @list_window.up(n) ? Sound.play_cursor : Sound.play_buzzer
    elsif Input.repeat?(Input::RIGHT)
      return if @command_window.index == 2
      n = Input.press?(Input::CTRL) ? 10 : 1
      @list_window.dw(n) ? Sound.play_cursor : Sound.play_buzzer
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (購入ウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_sale
    @sale_cmd_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @list_window.active = true
      @sale_window.visible = false
      @sale_cmd_window.show(false)
      if @need_reset  # total0状態に戻す
        @list_window.dw(1)
        @need_reset = false
      end
    elsif Input.trigger?(Input::C)
      case @sale_cmd_window.index
      when 0
        Sound.play_shop
        @list_window.active = true
        @list_window.sale
        @sale_window.visible = false
        @sale_cmd_window.show(false)
        @gold_window.refresh
        return_command unless @list_window.can_select?  # アイテムが無くなった
      when 1
        Sound.play_decision
        @list_window.active = true
        @sale_window.visible = false
        @sale_cmd_window.show(false)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (情報ウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_info
    @list_window.update if INFO_FLEX
    @status_window.item = @list_window.item
    @info_window.item = @list_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @list_window.active = true
      @info_window.visible = false
    elsif Input.trigger?(Input::C) or Input.trigger?(Input::X)
      Sound.play_decision
      @list_window.active = true
      @info_window.visible = false
    elsif Input.trigger?(Input::Y)
      @status_window.change_mode ? Sound.play_cursor : Sound.play_buzzer
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクター選択ウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_equip
    @equip_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      if ShopEx::USE_MENU_EQUIP
        @command_window.active = true
      else
        @list_window.active = true
      end
      @equip_window.show(false)
    elsif Input.trigger?(Input::C)
      if ShopEx::USE_MENU_EQUIP
        Sound.play_decision
        $scene = Scene_Equip.new(@equip_window.index, 0, 1)
      else
        if !@equip_window.c_enable?
          Sound.play_buzzer
          return
        end
        Sound.play_equip
        if @list_window.equip_item(@equip_window.index)
          @list_window.active = true
          @equip_window.show(false)
        end
        unless @list_window.can_select?  # アイテムが無くなった
          return_command
        else
          @status_window.item = @list_window.item
        end
      end
    end
  end
end

#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
#  装備画面の処理を行うクラスです。
#==============================================================================

if ShopEx::USE_MENU_EQUIP

class Scene_Equip < Scene_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    actor_index : アクターインデックス
  #    equip_index : 装備インデックス
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0, back=0)
    @actor_index = actor_index
    @equip_index = equip_index
    @back_scene = back
  end
  #--------------------------------------------------------------------------
  # ● 元の画面へ戻る
  #--------------------------------------------------------------------------
  def return_scene
    if @back_scene == 1
      $scene = Scene_Shop.new(2, @actor_index)
    else
      $scene = Scene_Menu.new(2)
    end
  end
  #--------------------------------------------------------------------------
  # ● 次のアクターの画面に切り替え
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Equip.new(@actor_index, @equip_window.index, @back_scene)
  end
  #--------------------------------------------------------------------------
  # ● 前のアクターの画面に切り替え
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Equip.new(@actor_index, @equip_window.index, @back_scene)
  end
end

end # ShopEx::USE_MENU_EQUIP
Revenir en haut Aller en bas
http://lunarito.wordpress.com/ https://twitter.com/RitoJS http://ritojs.deviantart.com/
Invité
Invité
Anonymous


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 20 Fév 2013 - 22:24

Merci du partage. xD
Revenir en haut Aller en bas
RitoJS
Ancien staffeux
Ancien staffeux
RitoJS

Masculin
Messages postés : 1925
Date d'inscription : 22/02/2012
Jauge LPC :
[VX] CC shop menu 8915271400100 / 100100 / 100[VX] CC shop menu 8915271400

[VX] CC shop menu Membre15
[VX] CC shop menu Mappeu10
[VX] CC shop menu Projet10
[VX] CC shop menu Projet16
[VX] CC shop menu Riche_10


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 20 Fév 2013 - 22:29

De rien. x)
Revenir en haut Aller en bas
http://lunarito.wordpress.com/ https://twitter.com/RitoJS http://ritojs.deviantart.com/
Elekami
Fondateur
Fondateur
Elekami

Masculin
Messages postés : 19071
Date d'inscription : 19/07/2008
Jauge LPC :
[VX] CC shop menu 8915271400100 / 100100 / 100[VX] CC shop menu 8915271400

[VX] CC shop menu Pater_10
[VX] CC shop menu Staffe10
[VX] CC shop menu Mythe_10
[VX] CC shop menu Membre11
[VX] CC shop menu Doyen10
[VX] CC shop menu Scanar10
[VX] CC shop menu Compos10
[VX] CC shop menu Testeu10
[VX] CC shop menu Membre15
[VX] CC shop menu Partag10
[VX] CC shop menu Projet10
[VX] CC shop menu Projet16
[VX] CC shop menu Riche_10
[VX] CC shop menu Travai10
[VX] CC shop menu Collec10
[VX] CC shop menu Collec11
[VX] CC shop menu Collec12
[VX] CC shop menu Collec13
[VX] CC shop menu Connar10


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 20 Fév 2013 - 22:29

Hé, un gros script dis donc !
Trois posts, ça mérite un point bonus ça.
Revenir en haut Aller en bas
https://www.ledijonshow.fr https://twitter.com/EleKoptes
Invité
Invité
Anonymous


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 20 Fév 2013 - 22:36

J'approuve. =)

Rito > Plus qu'un partage et tu rentres dans l'élite, si c'est pas la classe. Cool
Revenir en haut Aller en bas
nithis
Paysan (niveau 6)
Paysan (niveau 6)
nithis

Messages postés : 53
Date d'inscription : 11/04/2012
Jauge LPC :
[VX] CC shop menu 891527140021 / 10021 / 100[VX] CC shop menu 8915271400


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 13 Mar 2013 - 0:09

Bonsoir bonsoir, j'ai un problème avec le scripte, quand j'ouvre le menu, a la place de acheter vendre équiper ect ect j'ai des petit carrés xP
Revenir en haut Aller en bas
Jin
Ancien staffeux
Ancien staffeux
Jin

Masculin
Messages postés : 8557
Date d'inscription : 08/12/2010
Jauge LPC :
[VX] CC shop menu 891527140069 / 10069 / 100[VX] CC shop menu 8915271400

G 1 petit zizi Very Happy
Nn C pa vré Sad
[VX] CC shop menu Membre15
[VX] CC shop menu Partag10
[VX] CC shop menu Travai10
[VX] CC shop menu Event-10
[VX] CC shop menu Altrui10
[VX] CC shop menu Riche_10
[VX] CC shop menu Couhil10
[VX] CC shop menu Nain_p11
[VX] CC shop menu Connar10


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 13 Mar 2013 - 0:13

Surement ta police d'écriture.
Revenir en haut Aller en bas
RitoJS
Ancien staffeux
Ancien staffeux
RitoJS

Masculin
Messages postés : 1925
Date d'inscription : 22/02/2012
Jauge LPC :
[VX] CC shop menu 8915271400100 / 100100 / 100[VX] CC shop menu 8915271400

[VX] CC shop menu Membre15
[VX] CC shop menu Mappeu10
[VX] CC shop menu Projet10
[VX] CC shop menu Projet16
[VX] CC shop menu Riche_10


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 13 Mar 2013 - 11:56

Je confirme ce que dit Jin. J'ai partagé le script d'origine, t'as juste pas traduit les mots acheter vendre...
J'ai édité la deuxième partie de mon script (le deuxième post). C'est sur le deuxième script qu'il faut modifier le vocabulaire.
Revenir en haut Aller en bas
http://lunarito.wordpress.com/ https://twitter.com/RitoJS http://ritojs.deviantart.com/
nithis
Paysan (niveau 6)
Paysan (niveau 6)
nithis

Messages postés : 53
Date d'inscription : 11/04/2012
Jauge LPC :
[VX] CC shop menu 891527140021 / 10021 / 100[VX] CC shop menu 8915271400


[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu EmptyMer 13 Mar 2013 - 12:02

Super c'est fonctionnel encore merci du partage =)
Revenir en haut Aller en bas
Contenu sponsorisé




[VX] CC shop menu Empty
MessageSujet: Re: [VX] CC shop menu   [VX] CC shop menu Empty

Revenir en haut Aller en bas
 
[VX] CC shop menu
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Menu Parchemin 1.0 (Menu Principal personnalisé)
» RTP SHOP
» [XP] Shop Stock
» Character Shop
» [XP]Menu A-RPG

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Le Palais Créatif :: ~ PARTAGE ~ :: Scripts et plugins :: RPG Maker VX :: Système-
Sauter vers: