Heartbreak61

「Simple Stupid」Alternative Shop

May 26th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.44 KB | None | 0 0
  1. =begin
  2. ================================================================================
  3. ■「SIMPLE STUPID」 Alternative Shop
  4. ================================================================================
  5.  CHANGELOG
  6.  - ver0.60  2013.05.26   Finished the script
  7. ================================================================================
  8.  INTRODUCTION
  9.  - This script enables the user to use specified variable as money.
  10. ================================================================================
  11.  INSTRUCTION
  12. - Put this script below ▼ Materials/素材 but above ▼ Main.
  13. - Write "<e-shop>" (without quotes) on items/weapons/armors that considered as
  14.   alternative items to prevent those items from being sold on normal shop.
  15. - You can change the configurations below "on the fly" by typing corresponding
  16.   variables via Event Script
  17.   For example, if you want to change alternative shop variable in the middle of
  18.   the game, just type:
  19.     $eshop_var = x
  20.   inside Event Script box
  21. - By default, alternative shop items can't be sold in normal shop mode vice versa.
  22. ================================================================================
  23. =end
  24.  
  25. #CONFIG=========================================================================
  26. # alternative shop currency
  27. $eshop_currency = " E-Coin"
  28.  
  29. # alternative shop variable
  30. $eshop_var = 1
  31.  
  32. # the number of switch to turn alternative shop on. make sure to turn off that switch
  33. # off after you finished alternative shop scene.
  34. $eshop_switch = 1
  35.  
  36. # determine wether alternative shop is purchase only.
  37. # this will remove sell command on alternative shop scene.
  38. $eshop_purchase_only = true #default = true
  39.  
  40. # alternative shop items sell price rate on alternative shop scene.
  41. # only have effect if $eshop_purchase_only set to false
  42. $eshop_sell_rate = 0.5
  43.  
  44. # determine if alternative shop items can be sold on normal shop
  45. $eshop_sell_in_normal_shop = false #default = false
  46.  
  47. # alternative shop items sell price rate on normal shop scene.
  48. # normal item sell price rate will be 1/$eshop_normal_shop_rate
  49. # only have effect if $eshop_sell_in_normal_shop set to true
  50. $eshop_normal_shop_rate = 0.1
  51.  
  52. #===============================================================================
  53. class Scene_Shop
  54.   alias hbk_sses_do_buy do_buy
  55.   def do_buy(number)
  56.     if $game_switches[$eshop_switch]
  57.       $game_variables[$eshop_var] -= (number * buying_price)
  58.       $game_party.gain_item(@item, number)
  59.       return
  60.     end
  61.     hbk_sses_do_buy(number)
  62.   end
  63.  
  64.   alias hbk_sses_do_sell do_sell
  65.   def do_sell(number)
  66.     if $game_switches[$eshop_switch]
  67.       $game_variables[$eshop_var] += (number * selling_price)
  68.       $game_party.lose_item(@item, number)
  69.       return
  70.     end
  71.     hbk_sses_do_sell(number)
  72.   end
  73.  
  74.   alias hbk_sses_selling_price selling_price
  75.   def selling_price
  76.     if $game_switches[$eshop_switch]
  77.       if @item.note.include?("<e-shop>")
  78.         return (@item.price * $eshop_sell_rate.to_f).to_i
  79.       elsif !@item.note.include?("<e-shop>")
  80.         return (@item.price / $eshop_normal_shop_rate.to_f).to_i
  81.       end
  82.     else
  83.       if @item.note.include?("<e-shop>")
  84.         return (@item.price * $eshop_normal_shop_rate.to_f).to_i
  85.       else
  86.         return hbk_sses_selling_price
  87.       end
  88.     end
  89.   end
  90. end #Scene_Shop
  91.  
  92. class Window_ShopCommand
  93.   alias hbk_sses_make_command_list make_command_list
  94.   def make_command_list
  95.     if $game_switches[$eshop_switch] && $eshop_purchase_only
  96.       add_command(Vocab::ShopBuy,    :buy)
  97.       add_command(Vocab::ShopCancel, :cancel)
  98.       return
  99.     end
  100.     hbk_sses_make_command_list
  101.   end
  102. end #Window_ShopCommand
  103.  
  104. class Window_Gold
  105.   alias hbk_sses_value value
  106.   def value
  107.     return $game_variables[$eshop_var] if $game_switches[$eshop_switch]
  108.     return hbk_sses_value
  109.   end
  110.  
  111.   alias hbk_sses_currency_unit currency_unit
  112.   def currency_unit
  113.     return $eshop_currency if $game_switches[$eshop_switch]
  114.     return hbk_sses_currency_unit
  115.   end
  116. end #Window_Gold
  117.  
  118. class Window_ShopSell
  119.   alias hbk_sses_enable? enable?
  120.   def enable?(item)
  121.     if $game_switches[$eshop_switch]
  122.       if $eshop_sell_in_normal_shop;return hbk_sses_enable?(item)
  123.       else;return hbk_sses_enable?(item) && item.note.include?("<e-shop>")
  124.       end
  125.     else
  126.       if $eshop_sell_in_normal_shop;return hbk_sses_enable?(item)
  127.       else;return hbk_sses_enable?(item) && !item.note.include?("<e-shop>")
  128.       end
  129.     end
  130.   end
  131. end #Window_ShopSell
Advertisement
Add Comment
Please, Sign In to add comment