Advertisement
LiTTleDRAgo

[RGSS] Multiple Treasure Info

Jan 30th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.59 KB | None | 0 0
  1. #==============================================================================#
  2. # [Xp] Multi Treasure Info  
  3. # Version: 2.50
  4. # Author : LiTTleDRAgo
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  6. #
  7. # Explanation :
  8. #   Shows all the items you got with sliding animation
  9. #
  10. # How to use :
  11. #   Just Insert above main
  12. #
  13. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  14.  
  15. module DRG_TREASURE_INFO
  16.  
  17.   MTI_HUD           = [-20,320]
  18.   MTI_TIME          = 1
  19.   WINDOW_PRIORITY_Z = 99999
  20.   FONT              = 'Monotype Corsiva'
  21.   SIZE              = 20  
  22.   ACT_SE            = 'Mana - Menu-01'
  23.  
  24. end
  25.  
  26. #==============================================================================
  27. # ■ MTI
  28. #==============================================================================
  29. class Mti < Sprite
  30.   include DRG_TREASURE_INFO  
  31. #--------------------------------------------------------------------------
  32. # ● Initialize
  33. #--------------------------------------------------------------------------
  34.   def init
  35.     setup
  36.     @inf = Sprite.new
  37.     @inf.bitmap = Bitmap.new(120,70)
  38.     @inf.z = 2 + WINDOW_PRIORITY_Z
  39.     @inf.oy = -MTI_HUD[1] + 50
  40.     @inf.bitmap.font.name  = 'Georgia'
  41.     @inf.bitmap.font.size  = 30
  42.     @inf.bitmap.font.italic  = true
  43.     @inf.bitmap.font.color = Color.new(255, 255, 128, 255)
  44.     @inf.bitmap.draw_circle_gradient(24, 24, 25, Color.gray,45,1) if false
  45.     @inf.bitmap.draw_text(5, 4, 120, 40, 'Get',0)
  46.     @inf.opacity = 0
  47.   end
  48. #--------------------------------------------------------------------------
  49. # ● Setup
  50. #--------------------------------------------------------------------------
  51.   def setup
  52.     $game_temp.mti_text_x = 0
  53.     $game_temp.mti_text_y = 0
  54.     $game_temp.mti_text_zoom_x = 1.00
  55.     $game_temp.mti_text_zoom_y = 1.00
  56.     $game_temp.mti_text_opa = 0    
  57.   end
  58. #--------------------------------------------------------------------------
  59. # ● Update
  60. #--------------------------------------------------------------------------
  61.   def update
  62.     super
  63.     update_start_move
  64.     refresh if $game_temp.mti_start
  65.   end
  66. #--------------------------------------------------------------------------
  67. # ● Dispose
  68. #--------------------------------------------------------------------------
  69.   def dispose
  70.     return super if @text.nil?
  71.     @text.each {|i| i.dispose if !i.nil?}
  72.     @inf.dispose if !@inf.nil?
  73.     super  
  74.   end
  75. #--------------------------------------------------------------------------
  76. # ● Refresh
  77. #--------------------------------------------------------------------------
  78.   def refresh
  79.     $game_temp.mti_start = false
  80.     init if @inf.nil?
  81.     (@count.nil? || @count >= 5) ? @count = 0 : @count += 1
  82.     if @text[@count].nil?
  83.       @text[@count] = Sprite.new
  84.       @text[@count].bitmap = Bitmap.new(120,40)
  85.       @text[@count].z = 2 + WINDOW_PRIORITY_Z
  86.       @text[@count].bitmap.font.name = FONT
  87.       @text[@count].bitmap.font.size = SIZE
  88.     end
  89.     @text[@count].bitmap.clear
  90.     @text[@count].opacity = 100
  91.     @text[@count].zoom_x = 1.50
  92.     @text[@count].oy = -MTI_HUD[1] + 5 + $game_temp.mti_text_y
  93.     @text[@count].ox = -MTI_HUD[0] - 50 + $game_temp.mti_text_x
  94.     @text[@count].zoom_x = $game_temp.mti_text_zoom_x
  95.     @text[@count].zoom_y = $game_temp.mti_text_zoom_y
  96.     @text[@count].bitmap.draw_text(0, 0, 120, 40, $game_temp.mti_text.to_s,0)
  97.     @text[@count].visible = true
  98.     @time[@count] = MTI_TIME * 40
  99.   end
  100. #--------------------------------------------------------------------------
  101. # ● Update Start Move
  102. #--------------------------------------------------------------------------  
  103.   def update_start_move
  104.     @text,@time = [],[] if @text.nil? or @time.nil?
  105.     v = @count.nil? ? 0 : @count
  106.     return if @text[v].nil?
  107.     if !@time[v].nil? and @time[v] > 0
  108.       if @text[v].opacity < 255
  109.         @text[v].oy = -MTI_HUD[1] + 5 + $game_temp.mti_text_y
  110.         @text.each_index {|i|
  111.           if v != i && !@text[i].nil?
  112.             @text[i].oy += 1
  113.             @text[i].opacity -= 5 if @text[v-i].opacity > 0
  114.           end}
  115.         @text[v].opacity += 10
  116.       end
  117.       @inf.opacity += 10 if @inf.opacity < 255
  118.     else
  119.       @text.each_index {|i|
  120.         if @text[i].opacity > 0
  121.           @text[i].opacity -= 5
  122.           @text[i].oy += 1
  123.         else
  124.           @text[i].visible = false
  125.         end}
  126.         @inf.opacity -= 10 if @inf.opacity > 0
  127.     end
  128.     @time[v] -= 1 if @time[v] > 0
  129.   end
  130. end
  131. #==============================================================================
  132. # ** Interpreter
  133. #------------------------------------------------------------------------------
  134. #  This interpreter runs event commands. This class is used within the
  135. #  Game_System class and the Game_Event class.
  136. #==============================================================================
  137. class Interpreter
  138.    #--------------------------------------------------------------------------
  139.    # ● multi_treasure_info_popup(text)
  140.    #--------------------------------------------------------------------------  
  141.    def multi_treasure_info_popup(text)
  142.      $game_temp.mti_text = text
  143.      $game_temp.mti_text_time = 40 * DRG_TREASURE_INFO::MTI_TIME
  144.      $game_temp.mti_start = true  
  145.      play_se_itm
  146.    end
  147.    #--------------------------------------------------------------------------
  148.    # ● Play SE
  149.    #--------------------------------------------------------------------------
  150.    def play_se_itm
  151.       Audio.se_play('Audio/SE/'+DRG_TREASURE_INFO::ACT_SE , 70, 100) rescue nil
  152.    end
  153.    #--------------------------------------------------------------------------
  154.    # ● Change Gold
  155.    #--------------------------------------------------------------------------
  156.    alias drgXp_command_125 command_125 unless $@
  157.    def command_125
  158.       drgXp_command_125
  159.       value = operate_value(@parameters[0], @parameters[1], @parameters[2])
  160.       text = value.to_s+' '+$data_system.words.gold  
  161.       multi_treasure_info_popup(text) if value > 0    
  162.    end
  163.   #--------------------------------------------------------------------------
  164.   # ● Display Item Animaton
  165.   #--------------------------------------------------------------------------
  166.   if method_defined?(:display_item_animaton)
  167.     alias drgXp_display_item display_item_animaton  unless $@
  168.     def display_item_animaton(damage_item,gold_effect,value,item_name)
  169.        drgXp_display_item(damage_item,gold_effect,value,item_name)
  170.        if damage_item == nil  
  171.           text = value.to_s +  ' x ' + item_name
  172.           multi_treasure_info_popup(text) if value > 0
  173.           play_se_itm if value > 0
  174.        elsif gold_effect != nil
  175.           text = gold_effect.to_s + ' ' + $data_system.words.gold  
  176.           multi_treasure_info_popup(text) if value > 0      
  177.           play_se_itm if value > 0
  178.        end
  179.     end
  180.   #--------------------------------------------------------------------------
  181.   # ● Command_126 (ITEM)
  182.   #--------------------------------------------------------------------------
  183.   else
  184.     alias drgXp_display_item command_126 unless $@
  185.     def command_126
  186.       drgXp_display_item
  187.       value = operate_value(@parameters[1], @parameters[2], @parameters[3])  
  188.       item_name = load_data('Data/Items.rxdata')
  189.       text = value.to_s+' x '+item_name[@parameters[0]].name
  190.       multi_treasure_info_popup(text) if value > 0          
  191.     end
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● Command_127 (WEAPON)
  195.   #--------------------------------------------------------------------------
  196.   alias drgXp_item_command_127 command_127 unless $@
  197.   def command_127
  198.      drgXp_item_command_127
  199.      value = operate_value(@parameters[1], @parameters[2], @parameters[3])  
  200.      item_name = load_data('Data/Weapons.rxdata')
  201.       text = value.to_s+' x '+item_name[@parameters[0]].name
  202.      multi_treasure_info_popup(text) if value > 0          
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● Command_128 (ARMOR)
  206.   #--------------------------------------------------------------------------
  207.   alias drgXp_command_128 command_128 unless $@
  208.   def command_128
  209.      drgXp_command_128
  210.      value = operate_value(@parameters[1], @parameters[2], @parameters[3])  
  211.      item_name = load_data('Data/Armors.rxdata')
  212.       text = value.to_s+' x '+item_name[@parameters[0]].name
  213.      multi_treasure_info_popup(text) if value > 0          
  214.   end
  215. end
  216.  
  217. #==============================================================================
  218. # ■ Scene_Map
  219. #==============================================================================
  220. class Scene_Map    
  221.  
  222. #--------------------------------------------------------------------------
  223. # ● Main
  224. #--------------------------------------------------------------------------
  225.   alias drgXp_mti_main main unless $@
  226.   def main  
  227.     drgXp_mti_main
  228.     @mti.dispose if @mti
  229.   end    
  230. #--------------------------------------------------------------------------
  231. # ● Update
  232. #--------------------------------------------------------------------------
  233.   alias drgXp_mti_update update unless $@
  234.   def update
  235.     drgXp_mti_update
  236.     !@mti ? @mti = Mti.new : @mti.update
  237.   end    
  238. end  
  239.  
  240. #==============================================================================
  241. # ■ Game_Temp
  242. #==============================================================================
  243. class Game_Temp  
  244.     attr_accessor :mti_text_x,:mti_text_y,:mti_text_zoom_x,:mti_text_zoom_y,
  245.             :mti_text_opa,:mti_text,:mti_text_time,:mti_start
  246. end
  247.  
  248. $drago_multi_treasure_info = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement