Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # 1st problem.
- #===============================================================================
- class Game_Interpreter
- def space_on_grid?(type, id)
- item = b_get_item(type, id); a = b_grid_available?(type, id)
- $game_party.lune_grid_gain_item(item, 1, include_equip = false) if a
- end
- def b_get_item(type,id)
- case type
- when 1; return $data_items[id]
- when 2; return $data_weapons[id]
- when 3; return $data_armors[id]
- end
- end
- def b_grid_available?(type, id)
- case type
- when 1; return $game_party.check_grid_available($data_items[id])
- when 2; return $game_party.check_grid_available($data_weapons[id])
- when 3; return $game_party.check_grid_available($data_armors[id])
- end
- end
- end
- #===============================================================================
- #===============================================================================
- # 2nd problem.
- #===============================================================================
- module Lune_Item_Grid
- STAT_WIN_POS = [0,0]
- end
- class Scene_ItemBase < Scene_MenuBase
- def show_sub_window(window)
- window.x = Lune_Item_Grid::STAT_WIN_POS[0]
- window.y = Lune_Item_Grid::STAT_WIN_POS[1]
- window.show.activate
- end
- end
- #===============================================================================
- #===============================================================================
- # 3rd problem. Partial 8th Problem Fix.
- #===============================================================================
- class Game_Party < Game_Unit
- def falcaopearl_itempop_gain(item, amount, include_equip = false, add_grid = true)
- while amount > 0
- lune_grid_gain_item(item, 1, include_equip = false) if check_grid_available(item, add_grid)
- amount -= 1
- end
- if amount < 0
- lune_grid_gain_item(item, amount, include_equip = false)
- amount.abs.times {remove_item(item)}
- end
- end
- end
- class Game_Party < Game_Unit
- def gain_item(item, amount, include_equip = false, add_grid = true)
- if !item_container(item.class).nil? && SceneManager.scene_is?(Scene_Map)
- if amount > 0
- $game_system.item_object = [item, amount]
- RPG::SE.new(PearlItemPop::ItemSe, 80).play rescue nil
- end
- end
- falcaopearl_itempop_gain(item, amount, include_equip, add_grid)
- end
- end
- class Game_Actor < Game_Battler
- def trade_item_with_party(new_item, old_item)
- # 8th Problem Fix
- return true if $game_temp.eqip_chnge && SceneManager.scene_is?(Scene_RepairEquip)
- return true if $game_temp.eqip_chnge && SceneManager.scene_is?(Scene_QuickTool)
- return false if new_item && !$game_party.has_item?(new_item)
- if !old_item || $game_party.check_grid_available(old_item, false)
- $game_party.gain_item(old_item, 1, false, false)
- $game_party.lose_item(new_item, 1)
- else
- return false
- end
- return true
- end
- end
- #===============================================================================
- #===============================================================================
- # 4th & 9th problem.
- #===============================================================================
- class Game_Temp; attr_accessor :b_w; end
- class RPG::Weapon
- def break_by_durability(actor)
- actor.equips.each_index do |i|
- if actor.equips[i] == self
- actor.change_equip(i, nil)
- if TH_Instance::Weapon::Destroy_Broken_Weapon
- $game_party.gain_item(self, -1)
- else
- if broken_weapon_change
- $game_party.gain_item($data_weapons[self.template_id], -1)
- $game_party.gain_item($data_weapons[broken_weapon_change], 1)
- end
- end
- break
- end
- end
- end
- end
- #===============================================================================
- #===============================================================================
- # 5th problem.
- #===============================================================================
- class Scene_Item < Scene_ItemBase
- def command_release
- return unless @item_window.selected_item
- old_index = @item_window.index
- @item_old = @item_window.selected_item
- if @item_old.note.include?("<key_item>")
- Sound.play_buzzer
- @use_item.close
- @item_window.activate
- return
- end
- cur_eq = $game_player.actor.equips[0]
- $game_player.actor.change_equip_by_id(0,0)
- $game_party.item_grid_x = @item_window.current_col
- $game_party.item_grid_y = @item_window.current_row
- $game_party.gain_item(@item_old, -1, true)
- $game_party.item_grid_x = $game_party.item_grid_y = -1
- @item_window.dispose
- create_item_window
- @use_item.close
- @item_window.activate
- @item_window.index = old_index
- $game_player.actor.change_equip(0, cur_eq) if $game_party.weapons.include?(cur_eq)
- end
- end
- #===============================================================================
- #===============================================================================
- # 6th problem.
- #===============================================================================
- class Window_EquipRepair < Window_ItemList
- def make_item_list
- actor = $game_player.actor
- @data = $game_party.all_items.select {|item| include?(item) }
- @data.push(actor.equips[0]) if actor.equips[0] != nil
- @data.push(nil) if include?(nil)
- end
- end
- #===============================================================================
- #===============================================================================
- # 7th problem. Skillbar is affected by Victor Lighting Engine.
- #===============================================================================
- #module VICTOR_LIGHTING
- # SHADE_Z = 0
- #end
- #class Sprite_Light < Sprite_Base
- # def initialize(shade, viewport)
- # super(viewport); @shade = shade
- # self.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- # self.blend_type = @shade.blend; self.opacity = @shade.opacity
- # self.z = VICTOR_LIGHTING::SHADE_Z; @lights = {}
- # end
- #end
- #===============================================================================
- #===============================================================================
- # 8th problem. Can't swap equip when Inventory is full.
- #===============================================================================
- class Game_Temp
- attr_accessor :eqip_chnge; alias b_init_1 initialize
- def initialize; b_init_1; @eqip_chnge = false; end
- end
- class Game_Actor < Game_Battler
- def th_instance_items_change_equip(slot_id, item)
- $game_temp.eqip_chnge = true
- if !trade_item_with_party(item, equips[slot_id])
- $game_temp.eqip_chnge = false
- return
- end
- $game_temp.eqip_chnge = false
- return if item && equip_slots[slot_id] != item.etype_id
- @equips[slot_id].object = item
- refresh
- end
- end
- #===============================================================================
- #===============================================================================
- # Repair Broken Item.
- #===============================================================================
- # Tag the broken version of the weapon that you want to appear on the repair
- # scene with:
- #
- # <broken_item n>
- #
- # where n is the weapon ID of it's repaired version.
- #===============================================================================
- class RPG::Weapon
- def broken?; self.note =~ /<broken_item (\d+)>/ ? [true, $1.to_i] : [false,-1]; end
- alias b_c_rep? can_repair?
- def can_repair?; broken?[0] ? true : b_c_rep?; end
- alias b_rep_prc repair_price
- def repair_price; broken?[0] ? 0 : b_rep_prc; end
- def repair_broken_item
- $game_party.gain_item($data_weapons[template_id], -1)
- $game_party.gain_item($data_weapons[broken?[1]], 1)
- end
- end
- class Window_EquipRepair < Window_ItemList
- def include?(item)
- !item.is_a?(RPG::Item) && !item.nil? && (item.use_durability || item.broken?[0])
- end
- end
- class Scene_RepairEquip < Scene_ItemBase
- # Overwrite on_item_ok method.
- def on_item_ok
- $game_party.lose_gold(item.repair_price)
- item.broken?[0] ? item.repair_broken_item : item.repair
- @gold_window.refresh; on_item_sound; activate_item_window
- end
- end
- #===============================================================================
- #===============================================================================
- # Unequip weapon by selecting the empty slot.
- #===============================================================================
- class Window_ActorQuickTool < Window_Selectable
- def refresh(actor, kind)
- self.contents.clear if self.contents != nil
- @data = []
- if kind == :weapon
- operand = $game_party.weapons
- operand.push(actor.equips[0]) if actor.equips[0] != nil
- end
- if kind == :armor
- operand = $game_party.armors
- operand.push(actor.equips[1]) if actor.equips[1] != nil
- end
- operand = $game_party.items if kind == :item
- operand = actor.skills if kind == :skill
- for item in operand
- if kind == :weapon || kind == :armor
- next unless actor.equippable?(item)
- next if item.etype_id > 1
- end
- unless @data.include?(item)
- next if item.tool_data("Exclude From Tool Menu = ", false) == "true"
- @data.push(item)
- end
- end
- @data.push(nil) if @data.size > 0
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 24)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- item = @data[index]
- return if !item
- x, y = index % col_max * (190 + 32), index / col_max * 24
- self.contents.font.size = 20
- draw_icon(item.icon_index, x, y)
- contents.draw_text(x + 24, y, 212, 32, item.name)
- end
- end
- class Scene_QuickTool < Scene_MenuBase
- def perform_item_ok
- if @items_w.item.nil?
- actor.change_equip(0, @items_w.item)
- else
- case @type_select.current_symbol
- when :weapon; (actor.change_equip_by_id(0, @items_w.item.id); equip_play)
- when :armor; (actor.change_equip_by_id(1, @items_w.item.id); equip_play)
- when :item; activate_slots
- when :skill; activate_slots
- end
- DisplayTools.sprite.refresh_texts
- end
- end
- end
- #===============================================================================
- #===============================================================================
- # Show durability on Skillbar.
- #===============================================================================
- class Sprite_PearlTool < Sprite
- alias b_update update
- def update; dur_update; b_update; end
- def dur_update
- self.bitmap.clear
- return if !@actor.equips[0]
- a = @actor.equips[0].durability.to_s + "/" + @actor.equips[0].max_durability.to_s
- self.bitmap.draw_text(18, 36, 32,32, a, 1)
- end
- end
- #===============================================================================
- #===============================================================================
- # Reduce Duct Tape after repairing.
- #===============================================================================
- module TH_Instance
- module Scene_Repair
- ITEM_COST_ID = 5
- end
- end
- class Scene_RepairEquip < Scene_ItemBase
- alias b_o_i_o on_item_ok
- def on_item_ok
- cost_item = $data_items[TH_Instance::Scene_Repair::ITEM_COST_ID]
- $game_party.gain_item(cost_item, -1); b_o_i_o
- end
- end
- class Window_EquipRepair < Window_ItemList
- def enable?(item)
- return false if !has_item_cost?
- return true if item.is_a?(RPG::EquipItem) && item.can_repair? && $game_party.gold >= item.repair_price
- return false
- end
- def has_item_cost?
- cost_item = $data_items[TH_Instance::Scene_Repair::ITEM_COST_ID]
- return true if TH_Instance::Scene_Repair::ITEM_COST_ID != 0 && $game_party.has_item?(cost_item)
- return false
- end
- end
- #===============================================================================
- #===============================================================================
- # Make fast collapse effect on nil.
- #===============================================================================
- class Game_CharacterBase
- alias b_u_b_c update_battler_collapse
- def update_battler_collapse
- if battler.collapse_type.nil? && @colapse_time > 0
- @colapse_time = 1
- $game_self_switches[[$game_map.map_id, @id, PearlKernel::DeadposeSelfW]] = false
- end
- b_u_b_c
- end
- end
- #===============================================================================
- #===============================================================================
- # After toss, highlight use.
- #===============================================================================
- class Scene_Item < Scene_ItemBase
- alias b_c_r command_release
- def command_release; b_c_r; @use_item.index = 0; end
- def update
- super
- if Input.trigger?(:B) and !@use_item.close?
- Sound.play_cancel; @use_item.close; @item_window.activate
- @use_item.index = 0
- end
- end
- end
- #===============================================================================
- #===============================================================================
- # The https://i.imgur.com/3VOsjLy.png Fix. Probably.
- #===============================================================================
- class Sprite_DamagePop < Sprite
- alias b_c_t_f_d create_text_for_display
- def create_text_for_display
- return if @target.target.battler.nil?; b_c_t_f_d
- end
- end
- #===============================================================================
- #===============================================================================
- # The repair window have equip duplicate. Not sure why but somehow this fixes it.
- #===============================================================================
- class Window_EquipRepair < Window_ItemList
- def make_item_list
- @data = $game_party.all_items.select {|item| include?(item) }
- @data.push(nil) if include?(nil); @data
- end
- end
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement