Advertisement
estriole

COMP - SES Instance + MA Receipt Window

Jan 20th, 2013
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.72 KB | None | 0 0
  1. =begin
  2. SES Instance Item compatibility patch with Modern Algebra Receipt Window
  3. author : Estriole
  4. License: Free to use in all project (except the one containing pornography)
  5. as long as i credited (ESTRIOLE).
  6. =end
  7.  
  8. class Game_Party < Game_Unit
  9.   alias receipt_window_affix_patch_gain_gold gain_gold
  10.   def gain_gold(amount)
  11.     receipt_window_affix_patch_gain_gold(amount)
  12.     add_to_receipt([:G, amount]) if $game_temp.affix_gain_item_event_flag == true
  13.   end
  14.  
  15.   def gain_item(*args)
  16.     oitem = args[0] if !args[0].nil?
  17.     item = oitem
  18.     args[1].times do
  19.       if item && item.unique
  20.         args[0] = if item.is_a?(RPG::Weapon) then new_item(item, :weapon)
  21.         elsif item.is_a?(RPG::Armor) then args[0] = new_item(item, :armor)
  22.         elsif item.is_a?(RPG::Item) then args[0] = new_item(item, :item) end
  23.       end
  24.       old_value = $game_party.marw_item_number_plus_equips(args[0])
  25.       trade_item(args[0], 1)
  26.       new_value = $game_party.marw_item_number_plus_equips(args[0])      
  27.       if $game_temp.affix_gain_item_event_flag == true
  28.       update_item_receipt(:W,args[0].id,new_value,old_value) if item.is_a?(RPG::Weapon) && item.unique
  29.       update_item_receipt(:A,args[0].id,new_value,old_value) if item.is_a?(RPG::Armor) && item.unique
  30.       update_item_receipt(:I,args[0].id,new_value,old_value) if item.is_a?(RPG::Item) && item.unique
  31.       end
  32.     end
  33.     if item && !item.unique && $game_temp.affix_gain_item_event_flag == true
  34.     update_item_receipt(:W,args[0].id,args[1],0) if item.is_a?(RPG::Weapon)
  35.     update_item_receipt(:A,args[0].id,args[1],0) if item.is_a?(RPG::Armor)
  36.     update_item_receipt(:I,args[0].id,args[1],0) if item.is_a?(RPG::Item)
  37.     end
  38.   end
  39.  
  40.   def update_item_receipt(code, id, new_value, old_value)
  41.     if new_value != old_value && !$game_switches[MARW_CONFIGURATION[:manual_switch]]
  42.       add_to_receipt([code, id, new_value - old_value])
  43.     end
  44.   end  
  45.  
  46.   def add_to_receipt(*items)
  47.     items.each {|item| $game_map.add_to_receipt(marw_format_item_array(item)) }
  48.   end
  49.  
  50.   def marw_format_item_array(item_array)
  51.     if item_array.is_a?(RPG::BaseItem)
  52.       return [item_array.icon_index, item_array.name]
  53.     elsif item_array.is_a?(Array)
  54.       amount = (item_array[2].is_a?(Integer) ? sprintf(MARW_CONFIGURATION[:vocab_amount], item_array[2]) : "")
  55.       return case item_array[0]
  56.       when :I, :i, :item,    :Item,    0
  57.         item = $data_items[item_array[1]]
  58.         [item.icon_index, item.name, amount]
  59.       when :W, :w, :weapon,  :Weapon,  1
  60.         item = $data_weapons[item_array[1]]
  61.         [item.icon_index, item.name, amount]
  62.       when :A, :a, :armor,   :Armor,   2
  63.         item = $data_armors[item_array[1]]
  64.         [item.icon_index, item.name, amount]
  65.       when :G, :g, :gold,    :Gold,    3
  66.         [MARW_CONFIGURATION[:gold_icon], "", sprintf(MARW_CONFIGURATION[:vocab_amount], item_array[1])]
  67.       when :S, :s, :special, :Special, 4
  68.         item_array[3] = sprintf(MARW_CONFIGURATION[:vocab_amount], item_array[3]) if item_array[3].is_a?(Integer)
  69.         item_array.drop(1)
  70.       else item_array
  71.       end
  72.     else
  73.       item_array
  74.     end
  75.   end
  76.  
  77. end
  78.  
  79. class Game_Temp
  80.   attr_accessor :affix_gain_item_event_flag
  81. end
  82.  
  83. class Game_Interpreter
  84.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  85.   # * Gain Gold
  86.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  87.   def command_125(*args, &block)
  88.     $game_temp.affix_gain_item_event_flag = true
  89.     marw_command125_8qu7(*args, &block) # Call Original Method
  90.     $game_temp.affix_gain_item_event_flag = false
  91.   end
  92.  
  93.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  94.   # * Gain Item
  95.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  96.   def command_126(*args, &block)
  97.     $game_temp.affix_gain_item_event_flag = true
  98.     marw_command126_8qu7(*args, &block) # Call Original Method
  99.     $game_temp.affix_gain_item_event_flag = false
  100.   end
  101.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  102.   # * Gain Weapon
  103.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104.   def command_127(*args, &block)
  105.     $game_temp.affix_gain_item_event_flag = true
  106.     marw_command127_8qu7(*args, &block) # Call Original Method
  107.     $game_temp.affix_gain_item_event_flag = false
  108.   end
  109.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110.   # * Gain Armor
  111.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112.   def command_128(*args, &block)
  113.     $game_temp.affix_gain_item_event_flag = true
  114.     marw_command128_8qu7(*args, &block) # Call Original Method
  115.     $game_temp.affix_gain_item_event_flag = false
  116.   end
  117. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement