じ☆ve冰风 发表于 2026-8-3 09:43:54

Tinys More Currencies (TMC)

Tinys More Currencies TMC

 

Update : 1.2

- IMPORTAN BUGFIX in 1.2! 1.1 had an error when exchanging currencies

 

Expand your game by more then 1 currency!

 

Script 1.2

Spoiler#╔═───────────────────────────────────────────────────────────────────────────═#
#║ Tinys More Currencies (Mainscript)
#║ By TinyMine // english version
#║
#║  First Published/Erstveröffentlicht 12.04.2014
#║
#║  Visit : http://rpgmaker-vx-ace.de/ for further Information
#║
#║  Suggestions? Support? Bugs? Contact me in http://rpgmaker-vx-ace.de/
#║
#║  Credits required : TinyMine
#║  Commercial Use?  : Contact me in http://rpgmaker-vx-ace.de/
#║  Editable?        : Only by original editor TinyMine
#║  
#║  
#║ Version : 1.2 // 04.09.2014
#╚═───────────────────────────────────────────────────────────────────────────═#


$imported ||= {}
$imported[:TINY_TMC] = 1.2


#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Content
#║   
#║    - Expand your game by more currencies.
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Updates
#║   
#║    ■ 1.2
#║    - BUGFIX: Gamebreaker during exchanging currencies
#║   
#║    ■ 1.1
#║    - Penalty support for exchange operations
#║    - New command to check deactive currency stock.
#║   
#║    ■ 1.01
#║    - Better float support
#║   
#║    ■ 1.0
#║    - Release
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Addons
#║   
#║    ■ TMC Menu 1.01
#║    - Show up all currencies in standard main menu in its gold winow.
#║   
#║    ■ TMC Exchanger 1.1
#║    - Use a exchange office to exchange your currencies in a new scene.
#║   
#║    ■ TMC Enhance 1.01
#║    - Extends graphical contents in TMC and its addons.
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Usage In Game
#║ 
#║    following Scriptcommands used:
#║ 
#║    ■ Giving the player money from non-active currency:
#║ 
#║        change_gold(Amount, ID)
#║ 
#║      The usual gold event command works with the currency which is active by
#║      using the following command...
#║ 
#║    ■ To change the currency which is active for event commands:
#║ 
#║        change_currency(ID)
#║ 
#║      All known event commands work with the currency, that is active by this
#║      command.
#║ 
#║    ■ To exchange one currency to another use:
#║ 
#║        exchange_gold(from ID, to ID, Amount, Penalty)
#║ 
#║      Exchange from ID to to ID and set the amount with Amount.
#║      The Penalty is optional and is given by %. It is 100% by default.
#║        
#║    ■ To check if a currency is known:
#║ 
#║        currency_known?(ID)
#║ 
#║      A currency will be automatically known if one of the following commands
#║      were used with a currency:
#║      By "change_currency(...)" or "change_gold(...)" or "exchange_gold(...)"
#║        
#║    ■ To check a currency stock that is not active use:
#║ 
#║        gold?(ID)
#║ 
#║      Is the currency not known yet it will return 0.
#║ 
#╚═───────────────────────────────────────────────────────────────────────────═#
module TINY
  module TMC
    CURRENCIES = {
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Editable Region **              Settings               ** Editable Region █
#╚═───────────────────────────────────────────────────────────────────────────═#     
     
    # Here you create your own currencies:
    
    # Each currency can have its own value. A value of 1 represents the values
    # you use in your database prices. A Item with the Price 50 will cost 50
    # if the value of the used currency is 1. If the value would be 2 the item 
    # would cost only 25. If the value would be 0.5 the item would cost 100.
    
    # Sample for currency creation :
    # ID     =>    ["Name", "Shortcut", Value]
     
    :gold    =>    ["Gold", "G", 2],
    :silver  =>    ["Silver", "Sv", 1],
    :med     =>    ["Medicine", "Md", 5],
    :rocks   =>    ["Rocks", "R", 0.5]
     
     
#═────────────────────────────────────────────────────────────────────────────═#     
    } # Do not touch
#═────────────────────────────────────────────────────────────────────────────═#     
      




    # Define the currency that the Player knows from beginning of the game:
    START_CURRENCY = :silver
    


    
#╔═───────────────────────────────────────────────────────────────────────────═#         
#║ █ **                         END OF SETTINGS                             ** █
#║ █ **               DO NOT TOUCH THE FOLLOWING CONTENTS                   ** █
#╚═───────────────────────────────────────────────────────────────────────────═#
  end # TMC 
#═=═=═════════════════════════════════════════════════════════════════════════=#
end # TINY
#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Module Vocab
#╚═=═=════════════════════════════════════════════════════════════════════════=═
module Vocab
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Return Shortcut By Currency
  #╚────────────────────────────────────────────────────────────────────────────
  def self.currency_unit(currency = $game_party.currency)
    $game_party.currency_shortcut(currency)
  end
  
end # Vocab


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Game_Interpreter
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Game_Interpreter
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Gold Amount Of Type
  #╚────────────────────────────────────────────────────────────────────────────
  def gold?(type = $game_party.currency)
    return 0 unless currency_known?(type)
    $game_party.gold(type)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Adds/Removes Gold
  #╚────────────────────────────────────────────────────────────────────────────
  def change_gold(amount, type = $game_party.currency)
    $game_party.gain_gold(amount, type)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Changes Currency
  #╚────────────────────────────────────────────────────────────────────────────
  def change_currency(type)
    $game_party.currency = type
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Exchange Currency
  #╚────────────────────────────────────────────────────────────────────────────
  def exchange_gold(from, to, from_amount, penalty = 100)
    $game_party.exchange(from, to, from_amount, penalty)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Is Currency Known?
  #╚────────────────────────────────────────────────────────────────────────────
  def currency_known?(type)
    $game_party.gold_hash.keys.include?(type)
  end
  
end # Game_Interpreter


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Game_Party
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Game_Party
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets New Instances : @gold, @currency
  #╚────────────────────────────────────────────────────────────────────────────
  alias_method :initialize_tmc_23829                                ,:initialize
  def initialize
    initialize_tmc_23829
    @gold = {}
    @currency = TINY::TMC::START_CURRENCY
    set_currency
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets Currency In @gold Hash
  #╚────────────────────────────────────────────────────────────────────────────
  def set_currency(type = @currency, reset = false)
    return unless @gold.nil? || reset
    @gold = 0
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Empties A Value Of @gold Hash
  #╚────────────────────────────────────────────────────────────────────────────
  def clear_currency(type = @currency)
    @gold = 0
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Deletes A Key Of @gold Hash
  #╚────────────────────────────────────────────────────────────────────────────
  def delete_currency(type = @currency)
    @gold.delete(type)
  end
    
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  New Argument For Old Method : type
  #╚────────────────────────────────────────────────────────────────────────────
  def gain_gold(amount, type = @currency)
    @gold.nil? ? base = 0 : base = @gold
    @gold = [.max, max_gold].min
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  New Argument For Old Method : type
  #╚────────────────────────────────────────────────────────────────────────────
  def lose_gold(amount, type = @currency)
    gain_gold(-amount, type)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  New Argument For Old Method : type
  #╚────────────────────────────────────────────────────────────────────────────
  def gold(type = @currency)
    return @gold
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets @gold Hash instead of single value
  #╚────────────────────────────────────────────────────────────────────────────
  def gold_hash
    return @gold
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets @currency By Type; Return Default If Type Is Not Existent
  #╚────────────────────────────────────────────────────────────────────────────
  def currency=(type)
    @currency = type 
    set_currency
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets @currency
  #╚────────────────────────────────────────────────────────────────────────────
  def currency
    return @currency
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Ask If Player Has Enough Money
  #╚────────────────────────────────────────────────────────────────────────────  
  def exchangeable?(type, amount)
    @gold >= amount
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Currency Name
  #╚──────────────────────────────────────────────────────────────────────────── 
  def currency_name(currency)
    TINY::TMC::CURRENCIES
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Currency Shortcut
  #╚──────────────────────────────────────────────────────────────────────────── 
  def currency_shortcut(currency)
    TINY::TMC::CURRENCIES
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Currency Value
  #╚──────────────────────────────────────────────────────────────────────────── 
  def currency_value(currency)
    TINY::TMC::CURRENCIES
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Exchange Result
  #╚──────────────────────────────────────────────────────────────────────────── 
  def exchange_result(player, other, amount, penalty = 100)
    return currency_value(player) * amount if player == other
    result = ((currency_value(player) * amount) / currency_value(other) * (penalty/100.0)).to_i
    result
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Exchanging A Currency To Another
  #╚────────────────────────────────────────────────────────────────────────────
  def exchange(player, other, amount, penalty = 100)
    return unless exchangeable?(player, amount)
    set_currency(player)
    set_currency(other)
    @gold -= amount
    @gold += exchange_result(player, other, amount, penalty)
  end
    
end # Game_Party


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class RPG::Enemy
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class RPG::Enemy
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Multiply Bounty By Current Currency
  #╚────────────────────────────────────────────────────────────────────────────  
  def gold
    (@gold / $game_party.currency_value($game_party.currency)).to_i
  end
  
end # RPG::Enemy


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class RPG::Item
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class RPG::Item
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Multiply Price By Current Currency
  #╚────────────────────────────────────────────────────────────────────────────   
  def price
    (@price / $game_party.currency_value($game_party.currency)).to_i
  end
  
end # RPG::Item


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class RPG::EquipItem 
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class RPG::EquipItem 
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Multiply Price By Current Currency
  #╚────────────────────────────────────────────────────────────────────────────   
  def price
    (@price / $game_party.currency_value($game_party.currency)).to_i
  end
  
end # RPG::EquipItem


#╔═───────────────────────────────────────────────────────────────────────────═╗
#╠══════════════════════════════▲ END OF SCRIPT ▲══════════════════════════════╣
#╚═───────────────────────────────────────────────────────────────────────────═╝

 



 

Update :

 

■ 1.2


-BUGFIX: Gamebreaker during exchanging currencies

 

■ 1.1

  - Penalty support for exchange operations

  - New command to check deactive currency stock.


 


 ■ 1.01

  - Better float support


 

Known Issues :

 



 

Planned Features : Let me Know

 



 

ADDONs

 

TMC Exchanger 1.2


 


█ Content

   

- Expand the TMC Mainscript, to use a exchange office scene.


 

Spoiler                Code:       
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ TMC Exchanger
#║ By TinyMine // english version
#║
#║  First Published/Erstveröffentlicht 12.04.2014
#║
#║  Visit : http://rpgmaker-vx-ace.de/ for further Information
#║
#║  Suggestions? Support? Bugs? Contact me in http://rpgmaker-vx-ace.de/
#║
#║  Credits required : TinyMine
#║  Commercial Use?  : Contact me in http://rpgmaker-vx-ace.de/
#║  Editable?        : Only by original editor TinyMine
#║  
#║  
#║ Version : 1.2 // 04.09.2014
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Content
#║   
#║    - Expand the TMC Mainscript, to use a exchange office scene.
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Updates
#║   
#║    ■ 1.2
#║    - Currencies, the player do not know - will not occur in Exchange scene;
#║      even the exchanger could trade with it by command
#║   
#║    ■ 1.1
#║    - A Penalty can be given to a exchange office
#║    - The exchange rate will be shown up before exchange confirmation
#║   
#║    ■ 1.01
#║    - Versionssupport extended
#║   
#║    ■ 1.0
#║    - Release
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Usage In Game
#║ 
#║    following Scriptcommands used:
#║ 
#║    ■ Opening up the exchange office scene:
#║ 
#║        open_exchange(IDs, Penalty)
#║ 
#║      The exchange office only exchanges currencies, that are given by command.
#║      The Penalty is optional and 100% by default.
#║      f.e.: open_exchange(:gold, :silver, 50)
#║      Would call a exchange office that trades gold and silver for a penalty
#║      of 50%. What a robbery...
#║ 
#╚═───────────────────────────────────────────────────────────────────────────═#
if $imported[:TINY_TMC] >= 1.2
   $imported[:TINY_TMC_Exch] = 1.2
module TINY
  module TMC
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Editable Region **              Settings               ** Editable Region █
#╚═───────────────────────────────────────────────────────────────────────────═#     
     
   # Edit Vocabulary for the scene.
   
    # ■ Player List
    VOCAB_PLAYER   = "Which currency you would like to exchange?"   
    
    # ■ Anzahl Fenster
    VOCAB_AMOUNT   = "Amount?"  
    VOCAB_NUMBER   = "How much you would like to exchange?"  
    
    # ■ Händler Liste
    VOCAB_EXCHANGE = "To which currency you want to exchange?"
    
    # ■ Abschluss Fenster
    VOCAB_QUESTION = "Exchange?"
    VOCAB_TO       = "to"
    VOCAB_TRADE    = "exchanging?"
    
    # ■ Kurs Fenster
    VOCAB_RATE     = "Rate"
    
#╔═───────────────────────────────────────────────────────────────────────────═#         
#║ █ **                         END OF SETTINGS                             ** █
#║ █ **               DO NOT TOUCH THE FOLLOWING CONTENTS                   ** █
#╚═───────────────────────────────────────────────────────────────────────────═#
  end # TMC 
end # TINY


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Module SceneManager
#╚═=═=════════════════════════════════════════════════════════════════════════=═
module SceneManager
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Call A Scene With Arguments
  #╚────────────────────────────────────────────────────────────────────────────
  def self.call_args(scene_class, *args)
    @stack.push(@scene)
    @scene = scene_class.new(*args)
  end
  
end # SceneManager


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Game_Interpreter
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Game_Interpreter
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Open Scene_Exchange
  #╚────────────────────────────────────────────────────────────────────────────  
  def open_exchange(*currencies)
    SceneManager.call_args(Scene_Exchange, *currencies)
  end
  
end # Game_Interpreter


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Window_More_Gold_Selectable
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_More_Gold_Selectable < Window_Selectable
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializing Window
  #╚────────────────────────────────────────────────────────────────────────────
  def initialize(currencies, version = :player)
    @currencies = currencies
    @version = version
    super(0, 0, window_width, fitting_height(currencies.size))
    refresh
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Width
  #╚────────────────────────────────────────────────────────────────────────────
  def window_width
    return 160
  end  
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Selectable Items
  #╚────────────────────────────────────────────────────────────────────────────  
  def item_max
    return @currencies.size
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Key Of Contents By Index
  #╚────────────────────────────────────────────────────────────────────────────  
  def content_index
    return @currencies[@index]
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Contents
  #╚────────────────────────────────────────────────────────────────────────────
  def refresh
    contents.clear
    i = 0
    @currencies.each { |cur|
      next if TINY::TMC::CURRENCIES.nil?
      info = TINY::TMC::CURRENCIES
      part = @version == :player ? $game_party.gold(cur) : info
      draw_currency_value(part, " #{info}", 4, 24 * i, contents.width - 8)
      i += 1
    }
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Open Window
  #╚────────────────────────────────────────────────────────────────────────────
  def open
    refresh
    super
  end
  
end # Window_More_Gold_Selectable


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Window_Gold_Number
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_Gold_Number < Window_Selectable
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializes Window
  #╚────────────────────────────────────────────────────────────────────────────
  def initialize(x, y)
    super(x, y, window_width, fitting_height(2))
    @number = 0
    @index = 1
  end 
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Width
  #╚────────────────────────────────────────────────────────────────────────────  
  def window_width
    return 224
  end  
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Selectable Items
  #╚────────────────────────────────────────────────────────────────────────────  
  def item_max
    return 1
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets Used Items
  #╚────────────────────────────────────────────────────────────────────────────  
  def set_item(cur)
    @item = cur
    @number = 0
    refresh
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Chosen Amount
  #╚────────────────────────────────────────────────────────────────────────────  
  def number
    return @number
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Modulator
  #╚────────────────────────────────────────────────────────────────────────────  
  def max_exchange
    $game_party.gold(@item) + 1
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Handle Movement
  #╚────────────────────────────────────────────────────────────────────────────  
  def process_cursor_move
    return unless active
    if Input.repeat?(:UP) || Input.repeat?(:DOWN) || Input.repeat?(:RIGHT) || Input.repeat?(:LEFT)
      return if @item_max == 0
      @number = (@number + 1)   % max_exchange if Input.repeat?(:UP)
      @number = (@number - 1)   % max_exchange if Input.repeat?(:DOWN)
      @number = (@number + 10)  % max_exchange if Input.repeat?(:RIGHT)
      @number = (@number - 10)  % max_exchange if Input.repeat?(:LEFT)
      refresh
    end
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Content
  #╚────────────────────────────────────────────────────────────────────────────  
  def refresh
    contents.clear
    draw_text(0, 0, contents_width, contents_height/2, TINY::TMC::VOCAB_AMOUNT, 1)
    draw_text(0, contents_height/2, contents_width, contents_height/2, "#{@number}", 1)
  end
  
end # Window_Gold_Number


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Window_Conclude
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_Conclude < Window_Selectable
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializes Window
  #╚────────────────────────────────────────────────────────────────────────────  
  def initialize(x, y, w)
    super(x, y, w, fitting_height(5))
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets Used Items
  #╚────────────────────────────────────────────────────────────────────────────   
  def set_item(from, to, amount, penalty)
    @from = from
    @to = to
    @amount = amount
    @penalty = penalty
    refresh
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refreshes Conclude Window
  #╚────────────────────────────────────────────────────────────────────────────   
  def refresh
    contents.clear
    text = TINY::TMC::VOCAB_QUESTION
    draw_text(0, 0, contents.width, 24, text, 1)
    calc = "#{@amount} #{$game_party.currency_name(@from)}"
    contents.font.color = system_color
    draw_text(0, 24, contents.width, 24, calc, 1)
    contents.font.color = normal_color
    calc = TINY::TMC::VOCAB_TO
    draw_text(0, 48, contents.width, 24, calc, 1)
    calc = "#{exchange_result} #{$game_party.currency_name(@to)}"
    contents.font.color = system_color
    draw_text(0, 72, contents.width, 24, calc, 1)
    contents.font.color = normal_color
    calc = TINY::TMC::VOCAB_TRADE
    draw_text(0, 96, contents.width, 24, calc, 1)
  end 
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Exchange Result
  #╚────────────────────────────────────────────────────────────────────────────  
  def exchange_result
    $game_party.exchange_result(@from, @to, @amount, @penalty)
  end
  
end # Window_Conclude


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Scene_Exchange
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Scene_Exchange < Scene_MenuBase
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializes Scene
  #╚────────────────────────────────────────────────────────────────────────────  
  def initialize(*args)
    @currencies = *args
    @penalty = 100 
    set_vendor_properties
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Sets the config as traded currencies or penalty of the vendor
  #╚──────────────────────────────────────────────────────────────────────────── 
  def set_vendor_properties
    @currencies.sort.each { |e|
      set_penalty(amount) if e.is_a?(Integer)
      @currencies.delete(e) if e.is_a?(Symbol) && !$game_party.gold_hash.keys.include?(e)
    }
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Stes penalty if given in *args to scene
  #╚────────────────────────────────────────────────────────────────────────────
  def set_penalty(amount)
    @penalty = e 
    @currencies.delete(e)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Starts Scene
  #╚────────────────────────────────────────────────────────────────────────────  
  def start
    super
    create_windows
    create_handler
    select_window
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Create All Windows
  #╚────────────────────────────────────────────────────────────────────────────  
  def create_windows
    @player_window = Window_More_Gold_Selectable.new($game_party.gold_hash.keys)
    @player_window.x = 0
    @player_window.y = 0
    #--
    @exchanger_window = Window_More_Gold_Selectable.new(@currencies, :other)
    @exchanger_window.x = Graphics.width - @exchanger_window.width
    @exchanger_window.y = 0
    #--
    @number_window = Window_Gold_Number.new(160, 0)
    @number_window.hide
    @number_window.close
    #--
    @text_window = Window_Base.new(0, Graphics.height-72, Graphics.width, 72)
    refresh_text_window(TINY::TMC::VOCAB_PLAYER)
    #--
    @rate_window = Window_Base.new(160, 72, 224, 48)
    @rate_window.hide
    @rate_window.close
    #--
    @conclude_window = Window_Conclude.new(160, 120, 224)
    @conclude_window.hide
    @conclude_window.close
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Set All Window Handler
  #╚────────────────────────────────────────────────────────────────────────────   
  def create_handler
    @player_window.set_handler(:ok,       method(:activate_number))
    @exchanger_window.set_handler(:ok,    method(:activate_conclude))
    @number_window.set_handler(:ok,       method(:activate_exchange))
    @conclude_window.set_handler(:ok,     method(:exchange))
    @player_window.set_handler(:cancel,   method(:return_scene))
    @exchanger_window.set_handler(:cancel,method(:activate_number))
    @number_window.set_handler(:cancel,   method(:activate_player))
    @conclude_window.set_handler(:cancel, method(:activate_exchange))
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refreshes Text Window
  #╚────────────────────────────────────────────────────────────────────────────   
  def refresh_text_window(text)
    @text_window.contents.clear
    @text_window.draw_text_ex(0, 0, text)
  end  
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refreshes Rate Window
  #╚────────────────────────────────────────────────────────────────────────────   
  def refresh_rate_window
    @rate_window.contents.clear
    from = @player_window.content_index
    to = @exchanger_window.content_index
    @rate_window.draw_text_ex(0, 0, get_rate_text(from, to))
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Exchange Rate In A String
  #╚────────────────────────────────────────────────────────────────────────────   
  def get_rate_text(from, to)
    from == to ? pen = 1 : pen = penalty
    "#{TINY::TMC::VOCAB_RATE}:\\C #{(exchange_value(to) * 100).to_i} #{$game_party.currency_shortcut(from)} \\C-\\C #{(exchange_value(from) * pen * 100).to_i} #{$game_party.currency_shortcut(to)}"
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Penalty For Calculation
  #╚────────────────────────────────────────────────────────────────────────────    
  def penalty
    @penalty/100.0
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Gets Currency Value
  #╚────────────────────────────────────────────────────────────────────────────  
  def exchange_value(currency)
    $game_party.currency_value(currency)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Select At Start
  #╚────────────────────────────────────────────────────────────────────────────   
  def select_window
    @player_window.activate
    @player_window.select(0)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Activate Player List
  #╚────────────────────────────────────────────────────────────────────────────   
  def activate_player
    refresh_text_window(TINY::TMC::VOCAB_PLAYER)
    @number_window.close
    @exchanger_window.unselect
    @player_window.activate
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Activate Exchange List
  #╚────────────────────────────────────────────────────────────────────────────   
  def activate_exchange
    refresh_text_window(TINY::TMC::VOCAB_EXCHANGE)
    @conclude_window.close
    @rate_window.close
    @exchanger_window.activate
    @exchanger_window.select(0)
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Activate Conclude Window
  #╚────────────────────────────────────────────────────────────────────────────  
  def activate_conclude
    @conclude_window.set_item(@player_window.content_index, @exchanger_window.content_index,
    @number_window.number, @penalty)
    refresh_rate_window
    @rate_window.show
    @rate_window.open
    @conclude_window.refresh
    @conclude_window.show
    @conclude_window.open
    @conclude_window.activate
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Activate Number Window
  #╚────────────────────────────────────────────────────────────────────────────  
  def activate_number
    refresh_text_window(TINY::TMC::VOCAB_NUMBER)
    @exchanger_window.unselect
    @number_window.set_item(@player_window.content_index)
    @number_window.show
    @number_window.open
    @number_window.activate
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Exchange Chosen Values
  #╚────────────────────────────────────────────────────────────────────────────  
  def exchange
    $game_party.exchange(@player_window.content_index, @exchanger_window.content_index, 
    @number_window.number, @penalty)
    @player_window.refresh
    @conclude_window.close
    @rate_window.close
    activate_player
  end
  
end # Scene_Exchange


else 
  msgbox_p("TMC Menu will not run without TMC Mainscript 1.2 or higher")
end
#╔═───────────────────────────────────────────────────────────────────────────═╗
#╠══════════════════════════════▲ END OF SCRIPT ▲══════════════════════════════╣
#╚═───────────────────────────────────────────────────────────────────────────═╝





Screens:

Spoiler








 

TMC Menu


 


 █ Content

 


  - Expand the TMC Mainscript, that all currencies will be shown in the

    standard main menu gold window, as soon as they are known.



 

Spoiler                Code:       
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ TMC Menu
#║ By TinyMine // english version
#║
#║  First Published/Erstveröffentlicht 12.04.2014
#║
#║  Visit : http://rpgmaker-vx-ace.de/ for further Information
#║
#║  Suggestions? Support? Bugs? Contact me in http://rpgmaker-vx-ace.de/
#║
#║  Credits required : TinyMine
#║  Commercial Use?  : Contact me in http://rpgmaker-vx-ace.de/
#║  Editable?        : Only by original editor TinyMine
#║  
#║  
#║ Version : 1.01 // 12.04.2014
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Content
#║   
#║    - Expand the TMC Mainscript, that all currencies will be shown in the
#║      standard main menu gold window, as soon as they are known.
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Updates
#║   
#║    ■ 1.01
#║    - Versionsupport extended
#║   
#║    ■ 1.0
#║    - Release
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
if $imported[:TINY_TMC] >= 1.0
   $imported[:TINY_TMC_Menu] = 1.01
#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  NEW Class Window_More_Gold
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_More_Gold < Window_Base
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Initializing Window
  #╚────────────────────────────────────────────────────────────────────────────
  def initialize
    super(0, 0, window_width, fitting_height($game_party.gold_hash.keys.size))
    refresh
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Get Width
  #╚────────────────────────────────────────────────────────────────────────────
  def window_width
    return 160
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Contents
  #╚────────────────────────────────────────────────────────────────────────────
  def refresh
    contents.clear
    i = 0
    $game_party.gold_hash.each { |key, val|
      info = TINY::TMC::CURRENCIES
      draw_currency_value(val, info, 4, 24 * i, contents.width - 8)
      i += 1
    }
  end
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Open Window
  #╚────────────────────────────────────────────────────────────────────────────
  def open
    refresh
    super
  end
  
end # Window_More_Gold


#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Scene_Menu
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Scene_Menu
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  New Gold Window
  #╚────────────────────────────────────────────────────────────────────────────
  def create_gold_window
    @gold_window = Window_More_Gold.new
    @gold_window.x = 0
    @gold_window.y = Graphics.height - @gold_window.height
  end
  
end # Scene_Menu


else 
  msgbox_p("TMC Menu will not run without TMC Mainscript 1.0 or higher")
end
#╔═───────────────────────────────────────────────────────────────────────────═╗
#╠══════════════════════════════▲ END OF SCRIPT ▲══════════════════════════════╣
#╚═───────────────────────────────────────────────────────────────────────────═╝





 

Screens:

Spoiler








 

TMC Enhance


 


 █ Content

   

 - Expand the TMC Mainscript, for new enhancements like using icons and

   more in future version.   


 

Spoiler                Code:       
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ TMC Enhance
#║ By TinyMine // english version
#║
#║  First Published/Erstveröffentlicht 12.04.2014
#║
#║  Visit : http://rpgmaker-vx-ace.de/ for further Information
#║
#║  Suggestions? Support? Bugs? Contact me in http://rpgmaker-vx-ace.de/
#║
#║  Credits required : TinyMine
#║  Commercial Use?  : Contact me in http://rpgmaker-vx-ace.de/
#║  Editable?        : Only by original editor TinyMine
#║  
#║  
#║ Version : 1.01 // 13.04.2014
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Content
#║   
#║    - Expand the TMC Mainscript, for new enhancements like using icons and
#║      more in future version.   
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Updates
#║   
#║    ■ 1.01
#║    - Versionsupport extended
#║   
#║    ■ 1.0
#║    - Release
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Installation
#║   
#║    ■ Put this script below all other TMC Scripts/Addons
#║   
#╚═───────────────────────────────────────────────────────────────────────────═#


if $imported[:TINY_TMC] >= 1.0
module TINY
  module TMC
    CUR_GRAPHICS = {
#╔═───────────────────────────────────────────────────────────────────────────═#
#║ █ Editable Region **              Settings               ** Editable Region █
#╚═───────────────────────────────────────────────────────────────────────────═#      
     
    # Sample for icon creation:
    # ID     =>    Icon Index
    
    :gold    =>    361,
    :silver  =>    359,
    :rocks   =>    350
     
     
#═────────────────────────────────────────────────────────────────────────────═#     
    } # Do not touch
#═────────────────────────────────────────────────────────────────────────────═#     
    
    # █ Icon Settings
    
    # Define default Icon for currencies without a specified icon
    DEFAULT_ICON = 262
    
    
    # In which Addons icons should be used?
    
      # ■ Menu Addon?
      ICON_MENU = true
    
      # ■ Exchanger Addon?
      ICON_EXCH = true
    
    
#╔═───────────────────────────────────────────────────────────────────────────═#         
#║ █ **                         END OF SETTINGS                             ** █
#║ █ **               DO NOT TOUCH THE FOLLOWING CONTENTS                   ** █
#╚═───────────────────────────────────────────────────────────────────────────═#
  end # TMC 
#═=═=═════════════════════════════════════════════════════════════════════════=#
end # TINY


if TINY::TMC::ICON_MENU && !$imported[:TINY_TMC_Menu].nil?
#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Window_More_Gold
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_More_Gold
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Contents
  #╚────────────────────────────────────────────────────────────────────────────
  def refresh
    contents.clear
    i = 0
    $game_party.gold_hash.each { |key, val|
      info = TINY::TMC::CURRENCIES
      icon = TINY::TMC::CUR_GRAPHICS.nil? ? TINY::TMC::DEFAULT_ICON : TINY::TMC::CUR_GRAPHICS
      draw_icon(icon, contents.width - 24, 24 * i)
      draw_currency_value(val, info, 4 - 24, 24 * i, contents.width - 8)
      i += 1
    }
  end


end # Window_More_Gold
end # if ICON_MENU
if TINY::TMC::ICON_EXCH && !$imported[:TINY_TMC_Exch].nil?
#╔═=══════════════════════════════════════════════════════════════════════════=═
#║ █  OLD Class Window_More_Gold_Selectable
#╚═=═=════════════════════════════════════════════════════════════════════════=═
class Window_More_Gold_Selectable
  
  #╔────────────────────────────────────────────────────────────────────────────
  #║ ■  Refresh Contents
  #╚────────────────────────────────────────────────────────────────────────────
  def refresh
    contents.clear
    i = 0
    @currencies.each { |cur|
      next if TINY::TMC::CURRENCIES.nil?
      info = TINY::TMC::CURRENCIES
      icon = TINY::TMC::CUR_GRAPHICS.nil? ? TINY::TMC::DEFAULT_ICON : TINY::TMC::CUR_GRAPHICS
      part = @version == :player ? $game_party.gold(cur) : info
      draw_icon(icon, contents.width - 24, 24 * i)
      draw_currency_value(part, " #{info}", 4 , 24 * i, contents.width - 8 - 24)
      i += 1
    }
  end
  
end # Window_More_Gold_Selectable
end # if ICON_EXCH


else 
  msgbox_p("TMC Menu will not run without TMC Mainscript 1.0 or higher")
end # if version


#╔═───────────────────────────────────────────────────────────────────────────═╗
#╠══════════════════════════════▲ END OF SCRIPT ▲══════════════════════════════╣
#╚═───────────────────────────────────────────────────────────────────────────═╝





 

Screens:

Spoiler










 

DEMO

tmc demo 1.2.zip


本贴来自国际rpgmaker官方论坛作者:TinyMine处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/tinys-more-currencies-tmc.26491/
页: [1]
查看完整版本: Tinys More Currencies (TMC)