设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 6103|回复: 7
打印 上一主题 下一主题

[转载] VA合成+通用魔法商店

[复制链接]

Lv3.寻梦者

死亡颂唱者

梦石
0
星屑
1159
在线时间
1795 小时
注册时间
2011-10-21
帖子
2245

开拓者

跳转到指定楼层
受到警告 1
发表于 2012-5-16 19:03:10 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 acn00269 于 2012-5-18 17:01 编辑
  1. #==============================================================================
  2. # ■ RGSS3 合成 ver 1.01
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 http://izumiwhite.web.fc2.com/
  6. #
  7. #  利用規約:
  8. #     RPGツクールVXの正規の登録者のみご利用になれます。
  9. #     利用報告・著作権表示とかは必要ありません。
  10. #     改造もご自由にどうぞ。
  11. #     何か問題が発生しても責任は持ちません。
  12. #==============================================================================


  13. #--------------------------------------------------------------------------
  14. # ★ 初期設定。
  15. #    合成レシピ等の設定
  16. #--------------------------------------------------------------------------
  17. module WD_itemsynthesis_ini
  18.   
  19.   Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
  20.   
  21.   Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
  22.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  23.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  24.   Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示
  25.   
  26.   I_recipe = [] #この行は削除しないこと
  27.   W_recipe = [] #この行は削除しないこと
  28.   A_recipe = [] #この行は削除しないこと
  29.   
  30.   #以下、合成レシピ。
  31.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  32.   #と記載した場合、ID3のアイテムの合成必要は、100G。
  33.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  34.   #となる。
  35.   
  36.   #アイテムの合成レシピ
  37.   I_recipe[2]  = [10,  ["I",1,2]]
  38.   I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  39.   I_recipe[17] = [500, ["I",1,10]]

  40.   #武器の合成レシピ
  41.   W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  42.   W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  43.   
  44.   #防具の合成レシピ  
  45.   A_recipe[2]  = [40,   ["A",1,2]]
  46.   A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  47.   

  48.   
  49. end


  50. #==============================================================================
  51. # ■ WD_itemsynthesis
  52. #------------------------------------------------------------------------------
  53. #  アイテム合成用の共通メソッドです。
  54. #==============================================================================

  55. module WD_itemsynthesis
  56.   def i_recipe_switch_on(id)
  57.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  58.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  59.     $game_system.i_rcp_sw[id] = true
  60.   end
  61.   def i_recipe_switch_off(id)
  62.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  63.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  64.     $game_system.i_rcp_sw[id] = false
  65.   end
  66.   def i_recipe_switch_on?(id)
  67.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  68.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  69.     return $game_system.i_rcp_sw[id]
  70.   end
  71.   def i_recipe_all_switch_on
  72.     for i in 1..$data_items.size
  73.       i_recipe_switch_on(i)
  74.     end
  75.   end
  76.   def i_recipe_all_switch_off
  77.     for i in 1..$data_items.size
  78.       i_recipe_switch_off(i)
  79.     end
  80.   end
  81.   def w_recipe_switch_on(id)
  82.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  83.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  84.     $game_system.w_rcp_sw[id] = true
  85.   end
  86.   def w_recipe_switch_off(id)
  87.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  88.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  89.     $game_system.w_rcp_sw[id] = false
  90.   end
  91.   def w_recipe_switch_on?(id)
  92.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  93.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  94.     return $game_system.w_rcp_sw[id]
  95.   end
  96.   def w_recipe_all_switch_on
  97.     for i in 1..$data_weapons.size
  98.       w_recipe_switch_on(i)
  99.     end
  100.   end
  101.   def w_recipe_all_switch_off
  102.     for i in 1..$data_weapons.size
  103.       w_recipe_switch_off(i)
  104.     end
  105.   end
  106.   def a_recipe_switch_on(id)
  107.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  108.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  109.     $game_system.a_rcp_sw[id] = true
  110.   end
  111.   def a_recipe_switch_off(id)
  112.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  113.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  114.     $game_system.a_rcp_sw[id] = false
  115.   end
  116.   def a_recipe_switch_on?(id)
  117.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  118.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  119.     return $game_system.a_rcp_sw[id]
  120.   end
  121.   def a_recipe_all_switch_on
  122.     for i in 1..$data_armors.size
  123.       a_recipe_switch_on(i)
  124.     end
  125.   end
  126.   def a_recipe_all_switch_off
  127.     for i in 1..$data_armors.size
  128.       a_recipe_switch_off(i)
  129.     end
  130.   end
  131.   def recipe_all_switch_on
  132.     i_recipe_all_switch_on
  133.     w_recipe_all_switch_on
  134.     a_recipe_all_switch_on
  135.   end
  136.   def recipe_all_switch_off
  137.     i_recipe_all_switch_off
  138.     w_recipe_all_switch_off
  139.     a_recipe_all_switch_off
  140.   end

  141. end

  142. class Game_Interpreter
  143.   include WD_itemsynthesis
  144. end

  145. class Game_System
  146.   #--------------------------------------------------------------------------
  147.   # ● 公開インスタンス変数
  148.   #--------------------------------------------------------------------------
  149.   attr_accessor :i_rcp_sw
  150.   attr_accessor :w_rcp_sw
  151.   attr_accessor :a_rcp_sw
  152.   #--------------------------------------------------------------------------
  153.   # ● オブジェクト初期化
  154.   #--------------------------------------------------------------------------
  155.   alias wd_orig_initialize004 initialize
  156.   def initialize
  157.     wd_orig_initialize004
  158.     @i_rcp_sw = []
  159.     @w_rcp_sw = []
  160.     @a_rcp_sw = []
  161.   end
  162. end


  163. #==============================================================================
  164. # ■ Scene_ItemSynthesis
  165. #------------------------------------------------------------------------------
  166. #  合成画面の処理を行うクラスです。
  167. #==============================================================================

  168. class Scene_ItemSynthesis < Scene_MenuBase
  169.   #--------------------------------------------------------------------------
  170.   # ● 開始処理
  171.   #--------------------------------------------------------------------------
  172.   def start
  173.     super
  174.    
  175.     create_help_window
  176.     create_dummy_window
  177.     create_number_window
  178.     create_status_window
  179.     create_material_window
  180.     create_list_window
  181.     create_category_window
  182.     create_gold_window
  183.     create_change_window
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● ゴールドウィンドウの作成
  187.   #--------------------------------------------------------------------------
  188.   def create_gold_window
  189.     @gold_window = Window_Gold.new
  190.     @gold_window.viewport = @viewport
  191.     @gold_window.x = Graphics.width - @gold_window.width
  192.     @gold_window.y = @help_window.height
  193.     @gold_window.hide
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● 切り替え表示ウィンドウの作成
  197.   #--------------------------------------------------------------------------
  198.   def create_change_window
  199.     wx = 0
  200.     wy = @gold_window.y
  201.     ww = Graphics.width - @gold_window.width
  202.     wh = @gold_window.height
  203.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  204.     @change_window.viewport = @viewport
  205.     @change_window.hide
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● ダミーウィンドウの作成
  209.   #--------------------------------------------------------------------------
  210.   def create_dummy_window
  211.     wy = @help_window.y + @help_window.height + 48
  212.     wh = Graphics.height - wy
  213.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  214.     @dummy_window.viewport = @viewport
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● 個数入力ウィンドウの作成
  218.   #--------------------------------------------------------------------------
  219.   def create_number_window
  220.     wy = @dummy_window.y
  221.     wh = @dummy_window.height
  222.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  223.     @number_window.viewport = @viewport
  224.     @number_window.hide
  225.     @number_window.set_handler(:ok,     method(:on_number_ok))
  226.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # ● ステータスウィンドウの作成
  230.   #--------------------------------------------------------------------------
  231.   def create_status_window
  232.     wx = @number_window.width
  233.     wy = @dummy_window.y
  234.     ww = Graphics.width - wx
  235.     wh = @dummy_window.height
  236.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  237.     @status_window.viewport = @viewport
  238.     @status_window.hide
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 素材ウィンドウの作成
  242.   #--------------------------------------------------------------------------
  243.   def create_material_window
  244.     wx = @number_window.width
  245.     wy = @dummy_window.y
  246.     ww = Graphics.width - wx
  247.     wh = @dummy_window.height
  248.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  249.     @material_window.viewport = @viewport
  250.     @material_window.hide
  251.     @number_window.material_window = @material_window
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● 合成アイテムリストウィンドウの作成
  255.   #--------------------------------------------------------------------------
  256.   def create_list_window
  257.     wy = @dummy_window.y
  258.     wh = @dummy_window.height
  259.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  260.     @list_window.viewport = @viewport
  261.     @list_window.help_window = @help_window
  262.     @list_window.status_window = @status_window
  263.     @list_window.material_window = @material_window
  264.     @list_window.hide
  265.     @list_window.set_handler(:ok,     method(:on_list_ok))
  266.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  267.     @list_window.set_handler(:change_window, method(:on_change_window))   
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● カテゴリウィンドウの作成
  271.   #--------------------------------------------------------------------------
  272.   def create_category_window
  273.     @category_window = Window_ItemSynthesisCategory.new
  274.     @category_window.viewport = @viewport
  275.     @category_window.help_window = @help_window
  276.     @category_window.y = @help_window.height
  277.     @category_window.activate
  278.     @category_window.item_window = @list_window
  279.     @category_window.set_handler(:ok,     method(:on_category_ok))
  280.     @category_window.set_handler(:cancel, method(:return_scene))
  281.   end
  282.   
  283.   def return_scene
  284.     $game_map.autoplay
  285.     SceneManager.return
  286.   end
  287.   
  288.   #--------------------------------------------------------------------------
  289.   # ● 合成アイテムリストウィンドウのアクティブ化
  290.   #--------------------------------------------------------------------------
  291.   def activate_list_window
  292.     @list_window.money = money
  293.     @list_window.show.activate
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ● 合成[決定]
  297.   #--------------------------------------------------------------------------
  298.   def on_list_ok
  299.     @item = @list_window.item
  300.     @list_window.hide
  301.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  302.     @number_window.show.activate
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 合成[キャンセル]
  306.   #--------------------------------------------------------------------------
  307.   def on_list_cancel
  308.     @category_window.activate
  309.     @category_window.show
  310.     @dummy_window.show
  311.     @list_window.hide
  312.     @status_window.hide
  313.     @status_window.item = nil
  314.     @material_window.hide
  315.     @material_window.set(nil, nil)
  316.     @gold_window.hide
  317.     @change_window.hide
  318.     @help_window.clear
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● 表示切替
  322.   #--------------------------------------------------------------------------
  323.   def on_change_window
  324.     if @status_window.visible
  325.       @status_window.hide
  326.       @material_window.show
  327.     else
  328.       @status_window.show
  329.       @material_window.hide
  330.     end
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● カテゴリ[決定]
  334.   #--------------------------------------------------------------------------
  335.   def on_category_ok
  336.     activate_list_window
  337.     @gold_window.show
  338.     @change_window.show
  339.     @material_window.show
  340.     @category_window.hide
  341.     @list_window.select(0)
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● 個数入力[決定]
  345.   #--------------------------------------------------------------------------
  346.   def on_number_ok
  347.     Sound.play_shop
  348.     do_syntetic(@number_window.number)
  349.     end_number_input
  350.     @gold_window.refresh
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ● 個数入力[キャンセル]
  354.   #--------------------------------------------------------------------------
  355.   def on_number_cancel
  356.     Sound.play_cancel
  357.     end_number_input
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 合成の実行
  361.   #--------------------------------------------------------------------------
  362.   def do_syntetic(number)
  363.     $game_party.lose_gold(number * buying_price)
  364.     $game_party.gain_item(@item, number)
  365.    
  366.       @recipe = @list_window.recipe(@item)
  367.       for i in [email protected]
  368.         kind = @recipe[i][0]
  369.         id   = @recipe[i][1]
  370.         num  = @recipe[i][2]
  371.         if kind == "I"
  372.           item = $data_items[id]
  373.         elsif kind == "W"
  374.           item = $data_weapons[id]
  375.         elsif kind == "A"
  376.           item = $data_armors[id]
  377.         end
  378.         $game_party.lose_item(item, num*number)
  379.       end
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # ● 個数入力の終了
  383.   #--------------------------------------------------------------------------
  384.   def end_number_input
  385.     @number_window.hide
  386.     activate_list_window
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● 最大購入可能個数の取得
  390.   #--------------------------------------------------------------------------
  391.   def max_buy
  392.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  393.    
  394.     @recipe = @list_window.recipe(@item)
  395.       for i in [email protected]
  396.         kind = @recipe[i][0]
  397.         id   = @recipe[i][1]
  398.         num  = @recipe[i][2]
  399.         if kind == "I"
  400.           item = $data_items[id]
  401.         elsif kind == "W"
  402.           item = $data_weapons[id]
  403.         elsif kind == "A"
  404.           item = $data_armors[id]
  405.         end
  406.         if num > 0
  407.           max_buf = $game_party.item_number(item)/num
  408.         else
  409.           max_buf = 999
  410.         end
  411.         max = [max, max_buf].min
  412.       end
  413.       
  414.     buying_price == 0 ? max : [max, money / buying_price].min

  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ● 所持金の取得
  418.   #--------------------------------------------------------------------------
  419.   def money
  420.     @gold_window.value
  421.   end
  422.   #--------------------------------------------------------------------------
  423.   # ● 通貨単位の取得
  424.   #--------------------------------------------------------------------------
  425.   def currency_unit
  426.     @gold_window.currency_unit
  427.   end
  428.   #--------------------------------------------------------------------------
  429.   # ● 合成費用の取得
  430.   #--------------------------------------------------------------------------
  431.   def buying_price
  432.     @list_window.price(@item)
  433.   end
  434. end


  435. #==============================================================================
  436. # ■ Window_ItemSynthesisList
  437. #------------------------------------------------------------------------------
  438. #  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
  439. #==============================================================================

  440. class Window_ItemSynthesisList < Window_Selectable
  441.   include WD_itemsynthesis
  442.   #--------------------------------------------------------------------------
  443.   # ● 公開インスタンス変数
  444.   #--------------------------------------------------------------------------
  445.   attr_reader   :status_window            # ステータスウィンドウ
  446.   #--------------------------------------------------------------------------
  447.   # ● オブジェクト初期化
  448.   #--------------------------------------------------------------------------
  449.   def initialize(x, y, height)
  450.     super(x, y, window_width, height)
  451.    
  452.     @shop_goods = []
  453.     @shop_recipes = []
  454.    
  455.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  456.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  457.       if recipe
  458.         good = [0, i, recipe[0]]
  459.         if i_recipe_switch_on?(i)
  460.           @shop_goods.push(good)
  461.           @shop_recipes.push(recipe)
  462.         end
  463.       end
  464.     end
  465.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  466.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  467.       if recipe
  468.         good = [1, i, recipe[0]]
  469.         if w_recipe_switch_on?(i)
  470.           @shop_goods.push(good)
  471.           @shop_recipes.push(recipe)
  472.         end
  473.       end
  474.     end
  475.     for i in 1..WD_itemsynthesis_ini::A_recipe.size
  476.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  477.       if recipe
  478.         good = [2, i, recipe[0]]
  479.         if a_recipe_switch_on?(i)
  480.           @shop_goods.push(good)
  481.           @shop_recipes.push(recipe)
  482.         end
  483.       end
  484.     end
  485.    
  486.     @money = 0
  487.     refresh
  488.     select(0)
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # ● ウィンドウ幅の取得
  492.   #--------------------------------------------------------------------------
  493.   def window_width
  494.     return 304
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ● 項目数の取得
  498.   #--------------------------------------------------------------------------
  499.   def item_max
  500.     @data ? @data.size : 1
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # ● アイテムの取得
  504.   #--------------------------------------------------------------------------
  505.   def item
  506.     @data[index]
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # ● 所持金の設定
  510.   #--------------------------------------------------------------------------
  511.   def money=(money)
  512.     @money = money
  513.     refresh
  514.   end
  515.   #--------------------------------------------------------------------------
  516.   # ● 選択項目の有効状態を取得
  517.   #--------------------------------------------------------------------------
  518.   def current_item_enabled?
  519.     enable?(@data[index])
  520.   end
  521.   #--------------------------------------------------------------------------
  522.   # ● 合成費用を取得
  523.   #--------------------------------------------------------------------------
  524.   def price(item)
  525.     @price[item]
  526.   end
  527.   #--------------------------------------------------------------------------
  528.   # ● 合成可否を取得
  529.   #--------------------------------------------------------------------------
  530.   def enable?(item)
  531.     @makable[item]
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # ● レシピを取得
  535.   #--------------------------------------------------------------------------
  536.   def recipe(item)
  537.     @recipe[item]
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # ● アイテムを許可状態で表示するかどうか
  541.   #--------------------------------------------------------------------------
  542.   def have_mat?(recipe)
  543.     flag = true
  544.     if @money >= recipe[0]
  545.       for i in 1...recipe.size
  546.         kind = recipe[i][0]
  547.         id   = recipe[i][1]
  548.         num  = recipe[i][2]
  549.         if kind == "I"
  550.           item = $data_items[id]
  551.         elsif kind == "W"
  552.           item = $data_weapons[id]
  553.         elsif kind == "A"
  554.           item = $data_armors[id]
  555.         end
  556.         if $game_party.item_number(item) < [num, 1].max
  557.           flag = false
  558.         end
  559.       end
  560.     else
  561.       flag = false
  562.     end
  563.     return flag
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # ● カテゴリの設定
  567.   #--------------------------------------------------------------------------
  568.   def category=(category)
  569.     return if @category == category
  570.     @category = category
  571.     refresh
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ● リフレッシュ
  575.   #--------------------------------------------------------------------------
  576.   def refresh
  577.     make_item_list
  578.     create_contents
  579.     draw_all_items
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ● アイテムをリストに含めるかどうか
  583.   #--------------------------------------------------------------------------
  584.   def include?(item)
  585.     case @category
  586.     when :item
  587.       item.is_a?(RPG::Item) && !item.key_item?
  588.     when :weapon
  589.       item.is_a?(RPG::Weapon)
  590.     when :armor
  591.       item.is_a?(RPG::Armor)
  592.     when :key_item
  593.       item.is_a?(RPG::Item) && item.key_item?
  594.     else
  595.       false
  596.     end
  597.   end
  598.   #--------------------------------------------------------------------------
  599.   # ● アイテムリストの作成
  600.   #--------------------------------------------------------------------------
  601.   def make_item_list
  602.     @data = []
  603.     @price = {}
  604.     @makable = {}
  605.     @recipe = {}
  606.     for i in 0...@shop_goods.size
  607.       goods = @shop_goods[i]
  608.       recipe = @shop_recipes[i]
  609.       case goods[0]
  610.       when 0;  item = $data_items[goods[1]]
  611.       when 1;  item = $data_weapons[goods[1]]
  612.       when 2;  item = $data_armors[goods[1]]
  613.       end
  614.       if item
  615.         if include?(item)
  616.           @data.push(item)
  617.           @price[item] = goods[2]
  618.           @makable[item] = have_mat?(recipe)
  619.           @recipe[item] = recipe
  620.         end
  621.       end
  622.     end
  623.   end
  624.   #--------------------------------------------------------------------------
  625.   # ● 項目の描画
  626.   #--------------------------------------------------------------------------
  627.   def draw_item(index)
  628.     item = @data[index]
  629.     rect = item_rect(index)
  630.     draw_item_name(item, rect.x, rect.y, enable?(item))
  631.     rect.width -= 4
  632.     draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # ● ステータスウィンドウの設定
  636.   #--------------------------------------------------------------------------
  637.   def status_window=(status_window)
  638.     @status_window = status_window
  639.     call_update_help
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ● 素材ウィンドウの設定
  643.   #--------------------------------------------------------------------------
  644.   def material_window=(material_window)
  645.     @material_window = material_window
  646.     call_update_help
  647.   end
  648.   #--------------------------------------------------------------------------
  649.   # ● ヘルプテキスト更新
  650.   #--------------------------------------------------------------------------
  651.   def update_help
  652.     @help_window.set_item(item) if @help_window
  653.     @status_window.item = item if @status_window
  654.     @material_window.set(item, recipe(item)) if @material_window
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● ←→ ボタン(表示切替)が押されたときの処理
  658.   #--------------------------------------------------------------------------
  659.   def process_change_window
  660.     Sound.play_cursor
  661.     Input.update
  662.     call_handler(:change_window)
  663.   end
  664.   #--------------------------------------------------------------------------
  665.   # ● 決定やキャンセルなどのハンドリング処理
  666.   #--------------------------------------------------------------------------
  667.   def process_handling
  668.     super
  669.     if active
  670.       return process_change_window if handle?(:change_window) && Input.trigger?(:RIGHT)
  671.       return process_change_window if handle?(:change_window) && Input.trigger?(:LEFT)
  672.     end
  673.   end
  674. end


  675. #==============================================================================
  676. # ■ Window_ItemSynthesisMaterial
  677. #------------------------------------------------------------------------------
  678. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  679. #==============================================================================

  680. class Window_ItemSynthesisMaterial < Window_Base
  681.   #--------------------------------------------------------------------------
  682.   # ● オブジェクト初期化
  683.   #--------------------------------------------------------------------------
  684.   def initialize(x, y, width, height)
  685.     super(x, y, width, height)
  686.     @item = nil
  687.     refresh
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # ● リフレッシュ
  691.   #--------------------------------------------------------------------------
  692.   def refresh
  693.     contents.clear
  694.     draw_possession(4, 0)
  695.     draw_material_info(0, line_height * 2)
  696.   end
  697.   #--------------------------------------------------------------------------
  698.   # ● アイテムの設定
  699.   #--------------------------------------------------------------------------
  700.   def set(item, recipe)
  701.     @item = item
  702.     @recipe = recipe
  703.     @make_number = 1
  704.     refresh
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # ● 作成個数の設定
  708.   #--------------------------------------------------------------------------
  709.   def set_num(make_number)
  710.     @make_number = make_number
  711.     refresh
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 所持数の描画
  715.   #--------------------------------------------------------------------------
  716.   def draw_possession(x, y)
  717.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  718.     change_color(system_color)
  719.     draw_text(rect, Vocab::Possession)
  720.     change_color(normal_color)
  721.     draw_text(rect, $game_party.item_number(@item), 2)
  722.   end
  723.   #--------------------------------------------------------------------------
  724.   # ● 素材情報の描画
  725.   #--------------------------------------------------------------------------
  726.   def draw_material_info(x, y)
  727.     rect = Rect.new(x, y, contents.width, line_height)
  728.     change_color(system_color)
  729.     contents.font.size = 18
  730.     draw_text(rect, "必要素材", 0)
  731.     if @recipe
  732.       for i in [email protected]
  733.         kind = @recipe[i][0]
  734.         id   = @recipe[i][1]
  735.         num  = @recipe[i][2]
  736.         if kind == "I"
  737.           item = $data_items[id]
  738.         elsif kind == "W"
  739.           item = $data_weapons[id]
  740.         elsif kind == "A"
  741.           item = $data_armors[id]
  742.         end
  743.         rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  744.         enabled = true
  745.         enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
  746.         draw_item_name(item, rect.x, rect.y, enabled)
  747.         change_color(normal_color, enabled)
  748.         if num > 0
  749.           draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  750.         end
  751.       end
  752.     end
  753.     change_color(normal_color)
  754.     contents.font.size = 24
  755.   end
  756. end


  757. #==============================================================================
  758. # ■ Window_ItemSynthesisNumber
  759. #------------------------------------------------------------------------------
  760. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  761. #==============================================================================

  762. class Window_ItemSynthesisNumber < Window_ShopNumber
  763.   #--------------------------------------------------------------------------
  764.   # ● リフレッシュ
  765.   #--------------------------------------------------------------------------
  766.   def refresh
  767.     contents.clear
  768.     draw_item_name(@item, 0, item_y)
  769.     draw_number
  770.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # ● オブジェクト初期化
  774.   #--------------------------------------------------------------------------
  775.   def material_window=(material_window)
  776.     @material_window = material_window
  777.     call_update_help
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # ● 作成個数の変更
  781.   #--------------------------------------------------------------------------
  782.   def change_number(amount)
  783.     @number = [[@number + amount, @max].min, 1].max
  784.     call_update_help #追加
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # ● ヘルプテキスト更新
  788.   #--------------------------------------------------------------------------
  789.   def call_update_help
  790.     @material_window.set_num(@number) if @material_window
  791.   end
  792. end


  793. #==============================================================================
  794. # ■ Window_ItemSynthesisCategory
  795. #------------------------------------------------------------------------------
  796. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  797. #==============================================================================

  798. class Window_ItemSynthesisCategory < Window_ItemCategory
  799.   #--------------------------------------------------------------------------
  800.   # ● 桁数の取得
  801.   #--------------------------------------------------------------------------
  802.   def col_max
  803.     i = 0
  804.     i += 1 if WD_itemsynthesis_ini::Category_i
  805.     i += 1 if WD_itemsynthesis_ini::Category_w
  806.     i += 1 if WD_itemsynthesis_ini::Category_a
  807.     i += 1 if WD_itemsynthesis_ini::Category_k
  808.     return i
  809.   end
  810.   #--------------------------------------------------------------------------
  811.   # ● コマンドリストの作成
  812.   #--------------------------------------------------------------------------
  813.   def make_command_list
  814.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  815.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  816.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  817.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  818.   end
  819. end


  820. #==============================================================================
  821. # ■ Window_ItemSynthesisNumber
  822. #------------------------------------------------------------------------------
  823. #  合成画面で、切替を表示するウィンドウです。
  824. #==============================================================================

  825. class Window_ItemSynthesisChange < Window_Base
  826.   #--------------------------------------------------------------------------
  827.   # ● オブジェクト初期化
  828.   #--------------------------------------------------------------------------
  829.   def initialize(x, y, width, height)
  830.     super(x, y, width, height)
  831.     refresh
  832.   end
  833.   #--------------------------------------------------------------------------
  834.   # ● リフレッシュ
  835.   #--------------------------------------------------------------------------
  836.   def refresh
  837.     contents.clear
  838.     text = "← → :表示切替"
  839.     draw_text(0, 0, contents_width, line_height, text, 1)
  840.   end
  841. end
复制代码
来自http://izumiwhite.web.fc2.com/
源地址http://izumiwhite.web.fc2.com/rgss3/rgss3_004_main_ver101.txt

评分

参与人数 1星屑 -600 收起 理由
Kimu -600 这里是&quot;原创&quot;发布区

查看全部评分

Lv1.梦旅人

哆啦菌

梦石
0
星屑
46
在线时间
795 小时
注册时间
2010-7-24
帖子
3800
2
发表于 2012-5-18 12:04:19 | 只看该作者
最起码也要说些啥吧...不过弄这么长的脚本确实不容易
随便看看
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
141 小时
注册时间
2012-4-5
帖子
40
3
发表于 2012-5-18 12:27:57 | 只看该作者
乃难道认为把注释去掉就没人知道这脚本了吗?
http://izumiwhite.web.fc2.com/rgss3/rgss3_004_main_ver101.txt
@Kimu来处理一下吧
回复 支持 反对

使用道具 举报

Lv2.观梦者


  • 更新完成啦

梦石
0
星屑
784
在线时间
6267 小时
注册时间
2006-6-7
帖子
8462
4
发表于 2012-5-18 12:56:36 | 只看该作者
楼主转载的话,请发布到地球村,并且声原地址,脚本不能删除作者的#注释成分。
请自行补充,否则在24小时以后删除该帖。

1.jpg (88.85 KB, 下载次数: 15)

1.jpg
回复 支持 反对

使用道具 举报

Lv1.梦旅人

派大星

梦石
0
星屑
195
在线时间
2133 小时
注册时间
2011-9-18
帖子
2652
5
发表于 2012-5-18 13:21:10 | 只看该作者
本帖最后由 无双sxa 于 2012-5-18 13:24 编辑

来自http://izumiwhite.web.fc2.com/
源地址http://izumiwhite.web.fc2.com/rgss3/rgss3_004_main_ver101.txt
我这里的注释内容显示的是乱码,不过看脚本内容源地址是白之魔是没错的。
在这里也有RMer转载了也说明了源地址:http://www.rpgmakervxace.net/top ... -function-properly/
英文版的转载
  1. #==============================================================================
  2. # Item Synthesis ver 1.01 ¦ RGSS3 synthesis
  3. #------------------------------------------------- -----------------------------
  4. # Distributor:
  5. # Http://izumiwhite.web.fc2.com/ white magic
  6. #
  7. # Terms and Conditions:
  8. # Available to subscribers only available for regular RPG Maker VX.
  9. # Copyright Toka use does not require reporting.
  10. # Feel free to be modified.
  11. # In the event of liability does not have any problems.
  12. #
  13. # 2012-Jan-12: Quick translation by Google Translate & Seiryuki.
  14. # ALL CREDIT WHATSOEVER GOES TO AUTHOR: IZUMIWHITE
  15. #==============================================================================


  16. #=============================================
  17. #=============================================
  18. # QUICK USAGE GUIDE added by Seiryuki 2012-Jan-12
  19. #=============================================
  20. # Call synthesis with script call:
  21. #         SceneManager.call(Scene_ItemSynthesis)
  22. #
  23. # Script calls before calling scene_itemsynthesis:
  24. # i_recipe_switch_on(n) add item that has ID n
  25. # i_recipe_switch_off(n)         remove item that has ID n
  26. # w_recipe_switch_on(n) add weapon that has ID n
  27. # w_recipe_switch_off(n)         remove weapon that has ID n
  28. # a_recipe_switch_on(n) add armour that has ID n
  29. # a_recipe_switch_off(n)         remove armour that has ID n
  30. # recipe_all_switch_on         add all creatable items/weapons/armour
  31. # recipe_all_switch_off remove all creatable items/weapons/armour
  32. #
  33. # SET switches m if need to check for specific items on??? Not sure.
  34. #$game_switches[m] = i_recipe_switch_on?(n)         m番のスイッチにn番のアイテムのレシピ追加済み判定を代入
  35. #$game_switches[m] = w_recipe_switch_on?(n)         m番のスイッチにn番の武器のレシピ追加済み判定を代入
  36. #$game_switches[m] = a_recipe_switch_on?(n)         m番のスイッチにn番の防具のレシピ追加済み判定を代入
  37. #
  38. # FOR PERSONALISED SHOP. EXAMPLE:
  39. # recipe_all_switch_off
  40. # i_recipe_switch_on(2)
  41. # i_recipe_switch_on(17)
  42. # etc. etc. etc.
  43. # It would allow you to create your own list.
  44. #=============================================

  45. $imported = {} if $imported.nil?
  46. $imported["Synth"] = true


  47. #--------------------------------------------------------------------------
  48. # Default settings.
  49. # Settings such as Recipes
  50. #--------------------------------------------------------------------------
  51. module WD_itemsynthesis_ini

  52. Cost_view = true # expenses (G) display (if the cost of synthetic 0G recommended for all false)


  53. #This was removed by Seiryuki for use with HideShopSellCategory script
  54. #~ # Setup what item categories to hide/show
  55. #~ Category_i = true # The category window "item" Show Items
  56. #~ Category_w = true # "weapon" Show Items
  57. #~ Category_a = true # "weapon" Show Items
  58. #~ Category_k = true # "important things" Show Items


  59. I_recipe = [] # Do not remove this line
  60. W_recipe = [] # Do not remove this line
  61. A_recipe = [] # Do not remove this line

  62. # Below, Recipes.
  63. # Example: I_recipe [3] = [100, ["I", 1,1], ["W", 2,1], ["A", 2,2], ["A", 3,1] ]
  64. # If you have stated, the synthesis of an item of ID3 is necessary, 100G.
  65. # Material required is a single item of ID1, a single weapon of ID2, two armor ID2, and ID3 one armor.

  66. # Items Recipes
  67. I_recipe[2] = [10, ["I",1,2]]
  68. I_recipe[3] = [100, ["I",1,1], ["I",2,1]]
  69. I_recipe[17] = [500, ["I",1,10]]

  70. # Weapon Recipes
  71. W_recipe[3] = [50, ["W",1,1], ["W",2,1]]
  72. W_recipe[6] = [600, ["W",3,1], ["I",17,0]]

  73. # Armor Recipes
  74. A_recipe[2] = [40, ["A",1,2]]
  75. A_recipe[5] = [400, ["A",2,1], ["W",2,2], ["I",17,0]]

  76. end



  77. #==============================================================================
  78. # ?? WD_itemsynthesis
  79. #------------------------------------------------------------------------------
  80. # The common methods for the synthesis items.
  81. #==============================================================================

  82. module WD_itemsynthesis
  83. def i_recipe_switch_on(id)
  84. $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  85. $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  86. $game_system.i_rcp_sw[id] = true
  87. end
  88. def i_recipe_switch_off(id)
  89. $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  90. $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  91. $game_system.i_rcp_sw[id] = false
  92. end
  93. def i_recipe_switch_on?(id)
  94. $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  95. $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  96. return $game_system.i_rcp_sw[id]
  97. end
  98. def i_recipe_all_switch_on
  99. for i in 1..$data_items.size
  100. i_recipe_switch_on(i)
  101. end
  102. end
  103. def i_recipe_all_switch_off
  104. for i in 1..$data_items.size
  105. i_recipe_switch_off(i)
  106. end
  107. end
  108. def w_recipe_switch_on(id)
  109. $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  110. $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  111. $game_system.w_rcp_sw[id] = true
  112. end
  113. def w_recipe_switch_off(id)
  114. $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  115. $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  116. $game_system.w_rcp_sw[id] = false
  117. end
  118. def w_recipe_switch_on?(id)
  119. $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  120. $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  121. return $game_system.w_rcp_sw[id]
  122. end
  123. def w_recipe_all_switch_on
  124. for i in 1..$data_weapons.size
  125. w_recipe_switch_on(i)
  126. end
  127. end
  128. def w_recipe_all_switch_off
  129. for i in 1..$data_weapons.size
  130. w_recipe_switch_off(i)
  131. end
  132. end
  133. def a_recipe_switch_on(id)
  134. $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  135. $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  136. $game_system.a_rcp_sw[id] = true
  137. end
  138. def a_recipe_switch_off(id)
  139. $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  140. $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  141. $game_system.a_rcp_sw[id] = false
  142. end
  143. def a_recipe_switch_on?(id)
  144. $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  145. $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  146. return $game_system.a_rcp_sw[id]
  147. end
  148. def a_recipe_all_switch_on
  149. for i in 1..$data_armors.size
  150. a_recipe_switch_on(i)
  151. end
  152. end
  153. def a_recipe_all_switch_off
  154. for i in 1..$data_armors.size
  155. a_recipe_switch_off(i)
  156. end
  157. end
  158. def recipe_all_switch_on
  159. i_recipe_all_switch_on
  160. w_recipe_all_switch_on
  161. a_recipe_all_switch_on
  162. end
  163. def recipe_all_switch_off
  164. i_recipe_all_switch_off
  165. w_recipe_all_switch_off
  166. a_recipe_all_switch_off
  167. end

  168. end

  169. class Game_Interpreter
  170. include WD_itemsynthesis
  171. end

  172. class Game_System
  173. #--------------------------------------------------------------------------
  174. # Public Instance Variables
  175. #--------------------------------------------------------------------------
  176. attr_accessor :i_rcp_sw
  177. attr_accessor :w_rcp_sw
  178. attr_accessor :a_rcp_sw
  179. #--------------------------------------------------------------------------
  180. # Object Initialization
  181. #--------------------------------------------------------------------------
  182. alias wd_orig_initialize004 initialize
  183. def initialize
  184. wd_orig_initialize004
  185. @i_rcp_sw = []
  186. @w_rcp_sw = []
  187. @a_rcp_sw = []
  188. end
  189. end


  190. #==============================================================================
  191. # ?? Scene_ItemSynthesis
  192. #------------------------------------------------------------------------------
  193. # This class does the synthetic screen.
  194. #==============================================================================

  195. class Scene_ItemSynthesis < Scene_MenuBase
  196. #--------------------------------------------------------------------------
  197. # start processing
  198. #--------------------------------------------------------------------------
  199. def start
  200. super
  201. create_help_window
  202. create_dummy_window
  203. create_number_window
  204. create_status_window
  205. create_material_window
  206. create_list_window
  207. create_category_window
  208. create_gold_window
  209. create_change_window
  210. end
  211. #--------------------------------------------------------------------------
  212. # Creating gold window
  213. #--------------------------------------------------------------------------
  214. def create_gold_window
  215. @gold_window = Window_Gold.new
  216. @gold_window.viewport = @viewport
  217. @gold_window.x = Graphics.width - @gold_window.width
  218. @gold_window.y = @help_window.height
  219. @gold_window.hide
  220. end
  221. #--------------------------------------------------------------------------
  222. # Create a window display switching
  223. #--------------------------------------------------------------------------
  224. def create_change_window
  225. wx = 0
  226. wy = @gold_window.y
  227. ww = Graphics.width - @gold_window.width
  228. wh = @gold_window.height
  229. @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  230. @change_window.viewport = @viewport
  231. @change_window.hide
  232. end
  233. #--------------------------------------------------------------------------
  234. # Create a dummy window
  235. #--------------------------------------------------------------------------
  236. def create_dummy_window
  237. wy = @help_window.y + @help_window.height + 48
  238. wh = Graphics.height - wy
  239. @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  240. @dummy_window.viewport = @viewport
  241. end
  242. #--------------------------------------------------------------------------
  243. # Create a number entry window
  244. #--------------------------------------------------------------------------
  245. def create_number_window
  246. wy = @dummy_window.y
  247. wh = @dummy_window.height
  248. @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  249. @number_window.viewport = @viewport
  250. @number_window.hide
  251. @number_window.set_handler(:ok, method(:on_number_ok))
  252. @number_window.set_handler(:cancel, method(:on_number_cancel))
  253. end
  254. #--------------------------------------------------------------------------
  255. # Creating a status window
  256. #--------------------------------------------------------------------------
  257. def create_status_window
  258. wx = @number_window.width
  259. wy = @dummy_window.y
  260. ww = Graphics.width - wx
  261. wh = @dummy_window.height
  262. @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  263. @status_window.viewport = @viewport
  264. @status_window.hide
  265. end
  266. #--------------------------------------------------------------------------
  267. # Create a window Material
  268. #--------------------------------------------------------------------------
  269. def create_material_window
  270. wx = @number_window.width
  271. wy = @dummy_window.y
  272. ww = Graphics.width - wx
  273. wh = @dummy_window.height
  274. @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  275. @material_window.viewport = @viewport
  276. @material_window.hide
  277. @number_window.material_window = @material_window
  278. end
  279. #--------------------------------------------------------------------------
  280. # Creating composite item list window
  281. #--------------------------------------------------------------------------
  282. def create_list_window
  283. wy = @dummy_window.y
  284. wh = @dummy_window.height
  285. @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  286. @list_window.viewport = @viewport
  287. @list_window.help_window = @help_window
  288. @list_window.status_window = @status_window
  289. @list_window.material_window = @material_window
  290. @list_window.hide
  291. @list_window.set_handler(:ok, method(:on_list_ok))
  292. @list_window.set_handler(:cancel, method(:on_list_cancel))
  293. @list_window.set_handler(:change_window, method(:on_change_window))
  294. end
  295. #--------------------------------------------------------------------------
  296. # Creating a category window
  297. #--------------------------------------------------------------------------
  298. def create_category_window
  299. @category_window = Window_ItemCategory.new #modified by Seiryuki
  300. @category_window.viewport = @viewport
  301. @category_window.help_window = @help_window
  302. @category_window.y = @help_window.height
  303. @category_window.activate
  304. @category_window.item_window = @list_window
  305. @category_window.set_handler(:ok,         method(:on_category_ok))
  306. @category_window.set_handler(:cancel, method(:return_scene))
  307. end
  308. #--------------------------------------------------------------------------
  309. # Activation Synthesis item list window
  310. #--------------------------------------------------------------------------
  311. def activate_list_window
  312. @list_window.money = money
  313. @list_window.show.activate
  314. end
  315. #--------------------------------------------------------------------------
  316. # Synthesis ok
  317. #--------------------------------------------------------------------------
  318. def on_list_ok
  319. @item = @list_window.item
  320. @list_window.hide
  321. @number_window.set(@item, max_buy, buying_price, currency_unit)
  322. @number_window.show.activate
  323. end
  324. #--------------------------------------------------------------------------
  325. # Synthesis cancel
  326. #--------------------------------------------------------------------------
  327. def on_list_cancel
  328. @category_window.activate
  329. @category_window.show
  330. @dummy_window.show
  331. @list_window.hide
  332. @status_window.hide
  333. @status_window.item = nil
  334. @material_window.hide
  335. @material_window.set(nil, nil)
  336. @gold_window.hide
  337. @change_window.hide
  338. @help_window.clear
  339. end
  340. #--------------------------------------------------------------------------
  341. # Display switching
  342. #--------------------------------------------------------------------------
  343. def on_change_window
  344. if @status_window.visible
  345. @status_window.hide
  346. @material_window.show
  347. else
  348. @status_window.show
  349. @material_window.hide
  350. end
  351. end
  352. #--------------------------------------------------------------------------
  353. # Category ok
  354. #--------------------------------------------------------------------------
  355. def on_category_ok
  356. activate_list_window
  357. @gold_window.show
  358. @change_window.show
  359. @material_window.show
  360. @category_window.hide
  361. @list_window.select(0)
  362. end
  363. #--------------------------------------------------------------------------
  364. # number ok
  365. #--------------------------------------------------------------------------
  366. def on_number_ok
  367. Sound.play_shop
  368. do_syntetic(@number_window.number)
  369. end_number_input
  370. @gold_window.refresh
  371. end
  372. #--------------------------------------------------------------------------
  373. # number cancel
  374. #--------------------------------------------------------------------------
  375. def on_number_cancel
  376. Sound.play_cancel
  377. end_number_input
  378. end
  379. #--------------------------------------------------------------------------
  380. # Run synthesis
  381. #--------------------------------------------------------------------------
  382. def do_syntetic(number)
  383. $game_party.lose_gold(number * buying_price)
  384. $game_party.gain_item(@item, number)

  385. @recipe = @list_window.recipe(@item)
  386. for i in [email protected]
  387. kind = @recipe[i][0]
  388. id = @recipe[i][1]
  389. num = @recipe[i][2]
  390. if kind == "I"
  391. item = $data_items[id]
  392. elsif kind == "W"
  393. item = $data_weapons[id]
  394. elsif kind == "A"
  395. item = $data_armors[id]
  396. end
  397. $game_party.lose_item(item, num*number)
  398. end
  399. end
  400. #--------------------------------------------------------------------------
  401. # Number end of input
  402. #--------------------------------------------------------------------------
  403. def end_number_input
  404. @number_window.hide
  405. activate_list_window
  406. end
  407. #--------------------------------------------------------------------------
  408. # Get the maximum number available for purchase
  409. #--------------------------------------------------------------------------
  410. def max_buy
  411. max = $game_party.max_item_number(@item) - $game_party.item_number(@item)

  412. @recipe = @list_window.recipe(@item)
  413. for i in [email protected]
  414. kind = @recipe[i][0]
  415. id = @recipe[i][1]
  416. num = @recipe[i][2]
  417. if kind == "I"
  418. item = $data_items[id]
  419. elsif kind == "W"
  420. item = $data_weapons[id]
  421. elsif kind == "A"
  422. item = $data_armors[id]
  423. end
  424. if num > 0
  425. max_buf = $game_party.item_number(item)/num
  426. else
  427. max_buf = 999
  428. end
  429. max = [max, max_buf].min
  430. end

  431. buying_price == 0 ? max : [max, money / buying_price].min

  432. end
  433. #--------------------------------------------------------------------------
  434. # Get the money value
  435. #--------------------------------------------------------------------------
  436. def money
  437. @gold_window.value
  438. end
  439. #--------------------------------------------------------------------------
  440. # Get the currency unit
  441. #--------------------------------------------------------------------------
  442. def currency_unit
  443. @gold_window.currency_unit
  444. end
  445. #--------------------------------------------------------------------------
  446. # cost of acquisition of Synthesis
  447. #--------------------------------------------------------------------------
  448. def buying_price
  449. @list_window.price(@item)
  450. end

  451. #Added by Seiryuki
  452. #~ alias synth_terminate terminate
  453. #~ def terminate
  454. #~         $game_temp.hidecat_item = false
  455. #~         $game_temp.hidecat_weapon = false
  456. #~         $game_temp.hidecat_armor = false
  457. #~         $game_temp.hidecat_key_item = false
  458. #~         $game_temp.cat_item_lbl = Vocab::item
  459. #~         $game_temp.cat_weapon_lbl = Vocab::weapon
  460. #~         $game_temp.cat_armor_lbl = Vocab::armor
  461. #~         $game_temp.cat_key_item_lbl = Vocab::key_item
  462. #~         synth_terminate
  463. #~ end
  464. end


  465. #==============================================================================
  466. # ?? Window_ItemSynthesisList
  467. #------------------------------------------------------------------------------
  468. # Composite screen is a window that displays a list of items that can be synthesized.
  469. #==============================================================================

  470. class Window_ItemSynthesisList < Window_Selectable
  471. include WD_itemsynthesis
  472. #--------------------------------------------------------------------------
  473. # Public Instance Variables
  474. #--------------------------------------------------------------------------
  475. attr_reader :status_window         # Status Window
  476. #--------------------------------------------------------------------------
  477. # Object Initialization
  478. #--------------------------------------------------------------------------
  479. def initialize(x, y, height)
  480. super(x, y, window_width, height)

  481. @shop_goods = []
  482. @shop_recipes = []

  483. for i in 1..WD_itemsynthesis_ini::I_recipe.size
  484. recipe = WD_itemsynthesis_ini::I_recipe[i]
  485. if recipe
  486. good = [0, i, recipe[0]]
  487. if i_recipe_switch_on?(i)
  488. @shop_goods.push(good)
  489. @shop_recipes.push(recipe)
  490. end
  491. end
  492. end
  493. for i in 1..WD_itemsynthesis_ini::W_recipe.size
  494. recipe = WD_itemsynthesis_ini::W_recipe[i]
  495. if recipe
  496. good = [1, i, recipe[0]]
  497. if w_recipe_switch_on?(i)
  498. @shop_goods.push(good)
  499. @shop_recipes.push(recipe)
  500. end
  501. end
  502. end
  503. for i in 1..WD_itemsynthesis_ini::A_recipe.size
  504. recipe = WD_itemsynthesis_ini::A_recipe[i]
  505. if recipe
  506. good = [2, i, recipe[0]]
  507. if a_recipe_switch_on?(i)
  508. @shop_goods.push(good)
  509. @shop_recipes.push(recipe)
  510. end
  511. end
  512. end

  513. @money = 0
  514. refresh
  515. select(0)
  516. end
  517. #--------------------------------------------------------------------------
  518. # Get the window width
  519. #--------------------------------------------------------------------------
  520. def window_width
  521. return 304
  522. end
  523. #--------------------------------------------------------------------------
  524. # Get the number of items
  525. #--------------------------------------------------------------------------
  526. def item_max
  527. @data ? @data.size : 1
  528. end
  529. #--------------------------------------------------------------------------
  530. # Retrieve Item
  531. #--------------------------------------------------------------------------
  532. def item
  533. @data[index]
  534. end
  535. #--------------------------------------------------------------------------
  536. # Set money
  537. #--------------------------------------------------------------------------
  538. def money=(money)
  539. @money = money
  540. refresh
  541. end
  542. #--------------------------------------------------------------------------
  543. # Get the selection of effective state
  544. #--------------------------------------------------------------------------
  545. def current_item_enabled?
  546. enable?(@data[index])
  547. end
  548. #--------------------------------------------------------------------------
  549. # get the cost of synthetic
  550. #--------------------------------------------------------------------------
  551. def price(item)
  552. @price[item]
  553. end
  554. #--------------------------------------------------------------------------
  555. # get a final synthesis
  556. #--------------------------------------------------------------------------
  557. def enable?(item)
  558. @makable[item]
  559. end
  560. #--------------------------------------------------------------------------
  561. # get the recipe
  562. #--------------------------------------------------------------------------
  563. def recipe(item)
  564. @recipe[item]
  565. end
  566. #--------------------------------------------------------------------------
  567. # Whether to display item Allow states
  568. #--------------------------------------------------------------------------
  569. def have_mat?(recipe)
  570. flag = true
  571. if @money >= recipe[0]
  572. for i in 1...recipe.size
  573. kind = recipe[i][0]
  574. id = recipe[i][1]
  575. num = recipe[i][2]
  576. if kind == "I"
  577. item = $data_items[id]
  578. elsif kind == "W"
  579. item = $data_weapons[id]
  580. elsif kind == "A"
  581. item = $data_armors[id]
  582. end
  583. if $game_party.item_number(item) < [num, 1].max
  584. flag = false
  585. end
  586. end
  587. else
  588. flag = false
  589. end
  590. return flag
  591. end
  592. #--------------------------------------------------------------------------
  593. # Set category
  594. #--------------------------------------------------------------------------
  595. def category=(category)
  596. return if @category == category
  597. @category = category
  598. refresh
  599. end
  600. #--------------------------------------------------------------------------
  601. # Refresh
  602. #--------------------------------------------------------------------------
  603. def refresh
  604. make_item_list
  605. create_contents
  606. draw_all_items
  607. end
  608. #--------------------------------------------------------------------------
  609. # Whether to list an item
  610. #--------------------------------------------------------------------------
  611. def include?(item)
  612. case @category
  613. when :item
  614. item.is_a?(RPG::Item) && !item.key_item?
  615. when :weapon
  616. item.is_a?(RPG::Weapon)
  617. when :armor
  618. item.is_a?(RPG::Armor)
  619. when :key_item
  620. item.is_a?(RPG::Item) && item.key_item?
  621. else
  622. false
  623. end
  624. end
  625. #--------------------------------------------------------------------------
  626. # Create a list item
  627. #--------------------------------------------------------------------------
  628. def make_item_list
  629. @data = []
  630. @price = {}
  631. @makable = {}
  632. @recipe = {}
  633. for i in 0...@shop_goods.size
  634. goods = @shop_goods[i]
  635. recipe = @shop_recipes[i]
  636. case goods[0]
  637. when 0; item = $data_items[goods[1]]
  638. when 1; item = $data_weapons[goods[1]]
  639. when 2; item = $data_armors[goods[1]]
  640. end
  641. if item
  642. if include?(item)
  643. @data.push(item)
  644. @price[item] = goods[2]
  645. @makable[item] = have_mat?(recipe)
  646. @recipe[item] = recipe
  647. end
  648. end
  649. end
  650. end
  651. #--------------------------------------------------------------------------
  652. # Draw item
  653. #--------------------------------------------------------------------------
  654. def draw_item(index)
  655. item = @data[index]
  656. rect = item_rect(index)
  657. draw_item_name(item, rect.x, rect.y, enable?(item))
  658. rect.width -= 4
  659. draw_text(rect, price(item), 2) if WD_itemsynthesis_ini::Cost_view
  660. end
  661. #--------------------------------------------------------------------------
  662. # Setting the Status Window
  663. #--------------------------------------------------------------------------
  664. def status_window=(status_window)
  665. @status_window = status_window
  666. call_update_help
  667. end
  668. #--------------------------------------------------------------------------
  669. # Set the window material
  670. #--------------------------------------------------------------------------
  671. def material_window=(material_window)
  672. @material_window = material_window
  673. call_update_help
  674. end
  675. #--------------------------------------------------------------------------
  676. # Update Help text
  677. #--------------------------------------------------------------------------
  678. def update_help
  679. @help_window.set_item(item) if @help_window
  680. @status_window.item = item if @status_window
  681. @material_window.set(item, recipe(item)) if @material_window
  682. end
  683. #--------------------------------------------------------------------------
  684. # <-- --> button (toggle display) when you press the handle
  685. #--------------------------------------------------------------------------
  686. def process_change_window
  687. Sound.play_cursor
  688. Input.update
  689. call_handler(:change_window)
  690. end
  691. #--------------------------------------------------------------------------
  692. # The handling of such determination or cancellation
  693. #--------------------------------------------------------------------------
  694. def process_handling
  695. super
  696. if active
  697. return process_change_window if handle?(:change_window) && Input.trigger?(:RIGHT)
  698. return process_change_window if handle?(:change_window) && Input.trigger?(:LEFT)
  699. end
  700. end
  701. end


  702. #==============================================================================
  703. # ?? Window_ItemSynthesisMaterial
  704. #------------------------------------------------------------------------------
  705. # Composite screen is a window that displays the material required for the synthesis
  706. #==============================================================================

  707. class Window_ItemSynthesisMaterial < Window_Base
  708. #--------------------------------------------------------------------------
  709. # Object Initialization
  710. #--------------------------------------------------------------------------
  711. def initialize(x, y, width, height)
  712. super(x, y, width, height)
  713. @item = nil
  714. refresh
  715. end
  716. #--------------------------------------------------------------------------
  717. # Refresh
  718. #--------------------------------------------------------------------------
  719. def refresh
  720. contents.clear
  721. draw_possession(4, 0)
  722. draw_material_info(0, line_height * 2)
  723. end
  724. #--------------------------------------------------------------------------
  725. # Setting Item
  726. #--------------------------------------------------------------------------
  727. def set(item, recipe)
  728. @item = item
  729. @recipe = recipe
  730. @make_number = 1
  731. refresh
  732. end
  733. #--------------------------------------------------------------------------
  734. # Create Configuring Number
  735. #--------------------------------------------------------------------------
  736. def set_num(make_number)
  737. @make_number = make_number
  738. refresh
  739. end
  740. #--------------------------------------------------------------------------
  741. # Draw the number of possession
  742. #--------------------------------------------------------------------------
  743. def draw_possession(x, y)
  744. rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  745. change_color(system_color)
  746. draw_text(rect, Vocab::Possession)
  747. change_color(normal_color)
  748. draw_text(rect, $game_party.item_number(@item), 2)
  749. end
  750. #--------------------------------------------------------------------------
  751. # Drawing on material information
  752. #--------------------------------------------------------------------------
  753. def draw_material_info(x, y)
  754. rect = Rect.new(x, y, contents.width, line_height)
  755. change_color(system_color)
  756. contents.font.size = 18
  757. draw_text(rect, "Recipe:", 0)
  758. if @recipe
  759. for i in [email protected]
  760. kind = @recipe[i][0]
  761. id = @recipe[i][1]
  762. num = @recipe[i][2]
  763. if kind == "I"
  764. item = $data_items[id]
  765. elsif kind == "W"
  766. item = $data_weapons[id]
  767. elsif kind == "A"
  768. item = $data_armors[id]
  769. end
  770. rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  771. enabled = true
  772. enabled = false if [num*@make_number, 1].max > $game_party.item_number(item)
  773. draw_item_name(item, rect.x, rect.y, enabled)
  774. change_color(normal_color, enabled)
  775. if num > 0
  776. draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  777. end
  778. end
  779. end
  780. change_color(normal_color)
  781. contents.font.size = 24
  782. end
  783. end


  784. #==============================================================================
  785. # ?? Window_ItemSynthesisNumber
  786. #------------------------------------------------------------------------------
  787. # Composite screen is a window to enter the number of items to be synthesized.
  788. #==============================================================================

  789. class Window_ItemSynthesisNumber < Window_ShopNumber
  790. #--------------------------------------------------------------------------
  791. # refresh
  792. #--------------------------------------------------------------------------
  793. def refresh
  794. contents.clear
  795. draw_item_name(@item, 0, item_y)
  796. draw_number
  797. draw_total_price if WD_itemsynthesis_ini::Cost_view
  798. end
  799. #--------------------------------------------------------------------------
  800. # material window
  801. #--------------------------------------------------------------------------
  802. def material_window=(material_window)
  803. @material_window = material_window
  804. call_update_help
  805. end
  806. #--------------------------------------------------------------------------
  807. # adjust quantity
  808. #--------------------------------------------------------------------------
  809. def change_number(amount)
  810. @number = [[@number + amount, @max].min, 1].max
  811. call_update_help #???
  812. end
  813. #--------------------------------------------------------------------------
  814. # update help window
  815. #--------------------------------------------------------------------------
  816. def call_update_help
  817. @material_window.set_num(@number) if @material_window
  818. end
  819. end

  820. #==============================================================================
  821. # ?? Window_ItemSynthesisNumber
  822. #------------------------------------------------------------------------------
  823. # simple info window saying how to VIEW how item affects actor stats
  824. #==============================================================================

  825. class Window_ItemSynthesisChange < Window_Base
  826. #--------------------------------------------------------------------------
  827. # info window
  828. #--------------------------------------------------------------------------
  829. def initialize(x, y, width, height)
  830. super(x, y, width, height)
  831. refresh
  832. end
  833. #--------------------------------------------------------------------------
  834. # refresh
  835. #--------------------------------------------------------------------------
  836. def refresh
  837. contents.clear
  838. text = "Change windows with Left/Right."
  839. draw_text(0, 0, contents_width, line_height, text, 1)
  840. end
  841. end
复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者

死亡颂唱者

梦石
0
星屑
1159
在线时间
1795 小时
注册时间
2011-10-21
帖子
2245

开拓者

6
 楼主| 发表于 2012-5-18 16:43:03 | 只看该作者
本帖最后由 acn00269 于 2012-5-18 17:00 编辑

已更正

再发一个脚本吧 是在一个收录以前66RPG脚本的吧上找到的
关于 通用魔法商店 的   可以增加货币单位
  1. #==============================================================================
  2. # ■ 本脚本源自www.66rpg.com,转载与使用请保留此信息
  3. #==============================================================================

  4. #——以下是一些自定义的内容

  5. $mShop_use_1 = "灵魄"    #——这项是购买魔法特技的货币的名称,如“灵魄”、“金钱”

  6. $mShop_use_2 = "特斯拉"  #——这项是购买魔法特技的货币单位,如“点”、“¥”

  7. $mShop_use_variable = 1  #——这项是购买魔法特技时消耗的变量编号,如果=0 则是消耗金钱

  8. $mShop_Window_Opacity = 200  #——这项是窗口透明度

  9. #==============================================================================
  10. # ■ Window_MGold
  11. #------------------------------------------------------------------------------
  12. #  显示金钱的窗口。
  13. #==============================================================================
  14. class Window_MGold < Window_Base
  15.   #--------------------------------------------------------------------------
  16.   # ● 初始化窗口
  17.   #--------------------------------------------------------------------------
  18.   def initialize
  19.     super(0, 0, 272, 64)
  20.     self.contents = Bitmap.new(width - 32, height - 32)
  21.     refresh
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 刷新
  25.   #--------------------------------------------------------------------------
  26.   def refresh
  27.     self.contents.clear
  28.     self.contents.font.color = system_color
  29.     self.contents.draw_text(0, 0 , 240,32 ,$mShop_use_1)
  30.     self.contents.font.color = normal_color
  31.     self.contents.draw_text(0, 0, 240-contents.text_size($mShop_use_2).width-6, 32, $mShop_gold.to_s, 2)
  32.     self.contents.font.color = system_color
  33.     self.contents.draw_text(0, 0, 240, 32, $mShop_use_2, 2)
  34.   end
  35. end
  36. #==============================================================================
  37. # ■ Scene_MShop
  38. #------------------------------------------------------------------------------
  39. #  处理特技商店画面的类。
  40. #==============================================================================
  41. class Scene_MShop
  42.   #--------------------------------------------------------------------------
  43.   # ● 初始化
  44.   #--------------------------------------------------------------------------
  45.   def initialize(id)
  46.     @id = id
  47.   end   
  48.   #--------------------------------------------------------------------------
  49.   # ● 主处理
  50.   #--------------------------------------------------------------------------
  51.   def main
  52.     screen = Spriteset_Map.new
  53.     if $mShop_use_variable == 0
  54.       $mShop_gold = $game_party.gold
  55.     else
  56.       $mShop_gold = $game_variables[$mShop_use_variable]
  57.     end
  58.     # 生成帮助窗口
  59.     @help_window = Window_Help.new
  60.     @help_window.opacity = $mShop_Window_Opacity
  61.     # 生成金钱窗口
  62.     @gold_window = Window_MGold.new
  63.     @gold_window.x = 368
  64.     @gold_window.y = 416
  65.     @gold_window.opacity = $mShop_Window_Opacity
  66.     # 生成购买窗口
  67.     @buy_window = Window_MShopBuy.new(@id)
  68.     @buy_window.active = true
  69.     @buy_window.visible = true
  70.     @buy_window.help_window = @help_window
  71.     @buy_window.opacity = $mShop_Window_Opacity
  72.     # 生成状态窗口
  73.     @status_window = Window_MShopStatus.new
  74.     @status_window.visible = true
  75.     @status_window.active = false
  76.     @status_window.opacity = $mShop_Window_Opacity
  77.     # 执行过渡
  78.     Graphics.transition
  79.     # 主循环
  80.     loop do
  81.       # 刷新游戏画面
  82.       Graphics.update
  83.       # 刷新输入信息
  84.       Input.update
  85.       # 刷新画面
  86.       update
  87.       # 如果画面切换的话就中断循环
  88.       if $scene != self
  89.         break
  90.       end
  91.     end
  92.     # 准备过渡
  93.     Graphics.freeze
  94.     # 释放窗口
  95.     @help_window.dispose
  96.     #@mhelp_window.dispose
  97.     @gold_window.dispose
  98.     @buy_window.dispose
  99.     @status_window.dispose
  100.     screen.dispose
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 刷新画面
  104.   #--------------------------------------------------------------------------
  105.   def update
  106.     # 刷新窗口
  107.     @help_window.update
  108.     #@mhelp_window.update
  109.     @gold_window.update
  110.     @buy_window.update
  111.     @status_window.update
  112.     # 购买窗口激活的情况下: 调用 update_buy
  113.     if @buy_window.active
  114.       update_buy
  115.       return
  116.     end
  117.     if @status_window.active
  118.       update_status
  119.       return
  120.     end
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 刷新画面 (购买窗口激活的情况下)
  124.   #--------------------------------------------------------------------------
  125.   def update_buy
  126.     @status_window.skill = @buy_window.skill
  127.     if Input.trigger?(Input::B)
  128.       $game_system.se_play($data_system.cancel_se)
  129.       $scene = Scene_Map.new
  130.       return
  131.     end
  132.     if Input.trigger?(Input::C)
  133.       @skill = @buy_window.skill
  134.       if @skill == nil or @skill.price > $mShop_gold
  135.         $game_system.se_play($data_system.buzzer_se)
  136.         return
  137.       end
  138.       $game_system.se_play($data_system.decision_se)
  139.       @buy_window.active = false
  140.       @status_window.index = 0
  141.       @status_window.active = true
  142.     end
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ● 刷新画面 (状态窗口激活的情况下)
  146.   #--------------------------------------------------------------------------
  147.   def update_status
  148.     if Input.trigger?(Input::B)
  149.       $game_system.se_play($data_system.cancel_se)
  150.       @status_window.active = false
  151.       @status_window.index = -1
  152.       @buy_window.active = true
  153.     end
  154.     if Input.trigger?(Input::C)
  155.       if $game_party.actors[@status_window.index].skill_learn?(@skill.id)
  156.         $game_system.se_play($data_system.cancel_se)
  157.         return
  158.       else
  159.         $game_system.se_play($data_system.decision_se)
  160.         if $mShop_use_variable == 0
  161.           $game_party.gain_gold([email protected])
  162.           $mShop_gold -= @skill.price
  163.         else
  164.           $game_variables[$mShop_use_variable] -= @skill.price
  165.           $mShop_gold -= @skill.price
  166.         end
  167.         $game_party.actors[@status_window.index].learn_skill(@skill.id)
  168.         @gold_window.refresh
  169.         @buy_window.refresh
  170.         @status_window.refresh
  171.         @status_window.active = false
  172.         @status_window.index = -1
  173.         @buy_window.active = true
  174.       end      
  175.     end     
  176.   end
  177. end
  178. #==============================================================================
  179. # ■ Window_MShopStatus
  180. #------------------------------------------------------------------------------
  181. #  特技商店画面、显示物品所持数与角色装备的窗口。
  182. #==============================================================================
  183. class Window_MShopStatus < Window_Selectable
  184.   #--------------------------------------------------------------------------
  185.   # ● 初始化对像
  186.   #--------------------------------------------------------------------------
  187.   def initialize
  188.     super(368, 64, 272, 352)
  189.     self.contents = Bitmap.new(width - 32, height - 32)
  190.     self.contents.font.size = 18
  191.     @skill = nil
  192.     refresh
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ● 刷新
  196.   #--------------------------------------------------------------------------
  197.   def refresh
  198.     self.contents.clear
  199.     for i in 0...$game_party.actors.size
  200.       actor = $game_party.actors[i]
  201.       draw_actor_graphic(actor,12,80*i+64)
  202.       self.contents.font.color = system_color
  203.       self.contents.draw_text(44, 80*i, 240, 32, actor.name)
  204.       self.contents.draw_text(0, 80*i , 240-20,32,"等级",2)
  205.       self.contents.font.color = normal_color
  206.       self.contents.draw_text(0, 80*i, 240, 32, actor.level.to_s , 2)
  207.       self.contents.font.color = system_color
  208.       self.contents.draw_text(44, 80*i+22, 45, 32, $data_system.words.hp)
  209.       self.contents.font.color = normal_color
  210.       self.contents.draw_text(44, 80*i+22, 90, 32, actor.maxhp.to_s,2)
  211.       self.contents.font.color = system_color
  212.       self.contents.draw_text(150, 80*i+22, 45, 32, $data_system.words.sp)
  213.       self.contents.font.color = normal_color
  214.       self.contents.draw_text(150, 80*i+22, 90, 32, actor.maxsp.to_s,2)      
  215.       if actor.skill_learn?(@skill.id)
  216.         self.contents.font.color = Color.new(255,255,255,128)
  217.         self.contents.draw_text(44, 80*i+44, 196, 32, "⊙此项特技已经学习⊙",2)         
  218.       else
  219.         self.contents.font.color = Color.new(255,255,0,255)
  220.         self.contents.draw_text(44, 80*i+44, 240, 32, "★此项特技尚未学习★")
  221.       end
  222.     end
  223.     @item_max = $game_party.actors.size
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 设置物品
  227.   #     item : 新的物品
  228.   #--------------------------------------------------------------------------
  229.   def skill=(skill)
  230.     if @skill != skill
  231.       @skill = skill
  232.       refresh
  233.     end
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● 刷新光标矩形
  237.   #--------------------------------------------------------------------------
  238.   def update_cursor_rect
  239.     if @index < 0
  240.       self.cursor_rect.empty
  241.     else
  242.       self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  243.     end
  244.   end
  245. end
  246. #==============================================================================
  247. # ■ Window_MShopBuy
  248. #------------------------------------------------------------------------------
  249. #  特技商店画面、浏览显示可以购买的商品的窗口。
  250. #==============================================================================
  251. class Window_MShopBuy < Window_Selectable
  252.   #--------------------------------------------------------------------------
  253.   # ● 初始化对像
  254.   #     shop_goods : 商品
  255.   #--------------------------------------------------------------------------
  256.   def initialize(id)
  257.     super(0, 64, 368, 416)
  258.     @id = id
  259.     refresh
  260.     self.index = 0
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 获取物品
  264.   #--------------------------------------------------------------------------
  265.   def skill
  266.     return @data[self.index]
  267.   end
  268.   #--------------------------------------------------------------------------
  269.   # ● 刷新
  270.   #--------------------------------------------------------------------------
  271.   def refresh
  272.     if self.contents != nil
  273.       self.contents.dispose
  274.       self.contents = nil
  275.     end
  276.     @data = []
  277.     for skill_id in @id
  278.       skill = $data_skills[skill_id]
  279.       if skill != nil
  280.         @data.push(skill)
  281.       end
  282.     end
  283.     @item_max = @data.size
  284.     if @item_max > 0
  285.       self.contents = Bitmap.new(width - 32, row_max * 32)
  286.       for i in 0...@item_max
  287.         draw_item(i)
  288.       end
  289.     end
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ● 描绘羡慕
  293.   #     index : 项目编号
  294.   #--------------------------------------------------------------------------
  295.   def draw_item(index)
  296.     skill = @data[index]
  297.     # 除此之外的情况设置为无效文字色
  298.     if skill.price <= $mShop_gold
  299.       self.contents.font.color = normal_color
  300.     else
  301.       self.contents.font.color = disabled_color
  302.     end
  303.     x = 4
  304.     y = index * 32
  305.     rect = Rect.new(x, y, self.width - 32, 32)
  306.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  307.     bitmap = RPG::Cache.icon(skill.icon_name)
  308.     opacity = self.contents.font.color == normal_color ? 255 : 128
  309.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  310.     self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
  311.     self.contents.draw_text(x + 240, y, 88, 32, skill.price.to_s, 2)
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● 刷新帮助文本
  315.   #--------------------------------------------------------------------------
  316.   def update_help
  317.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  318.   end
  319. end
  320. #==============================================================================
  321. # ■ RPG原装定义
  322. #==============================================================================
  323. module RPG
  324.   class Skill
  325.     def description
  326.       description = @description.split(/@/)[0]
  327.       return description != nil ? description : ''
  328.     end
  329.     def price
  330.       price = @description.split(/@/)[1]
  331.       return price != nil ? price.to_i : 0
  332.     end
  333.   end
  334. end
复制代码
源地址:http://tieba.baidu.com/p/46396274
这家伙很懒,什么也没有留下
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
575
在线时间
1752 小时
注册时间
2008-11-7
帖子
1431
7
发表于 2012-8-22 10:15:09 | 只看该作者
这个魔法商店 是怎么调用的 研究了 一半天 没看懂
RPG魔塔:http://rpg.blue/thread-254429-1-1.html
魔塔2:http://rpg.blue/thread-303601-1-1.html
魔塔3: 制作中...MV
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
99 小时
注册时间
2012-3-11
帖子
74
8
发表于 2012-8-23 00:04:29 | 只看该作者
请问合成脚本该怎么用啊……都是日文看不明白
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-1 12:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表