Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module MULTISLOT
- #####################################################################
- #For each item, put the ones it will morph into when put in the corresponding slots.
- #For instance, 1 => [1,1,2,3,4] means the armor number 1 will turn into the
- #weapon 1 in the weapon slot, armor 1 in the shield slot, armor 2 in the helmet
- #slot, armor 3 in the body slot, and armor 4 in the accessory slot.
- Item_Morph = { #do not delete
- 1=>[1,5,9,13,17],
- 2=>[2,6,10,14,18],
- 3=>[3,7,11,15,19],
- 4=>[4,8,12,16,20],
- } #do not delete
- end
- class Game_Actor < Game_Battler
- def morph_item(item,slot_id)
- return nil unless item
- if slot_id == 0
- return $data_weapons[MULTISLOT::Item_Morph[item.id][slot_id]]
- elsif slot_id != nil
- return $data_armors[MULTISLOT::Item_Morph[item.id][slot_id]]
- end
- return item
- end
- def unmorph_item(item)
- return nil unless item
- MULTISLOT::Item_Morph.each do |x|
- if item.is_a?(RPG::Weapon)
- return $data_armors[x[0]] if x[1][0] == item.id
- else
- y = x[1][1,x[1].size - 1]
- return $data_armors[x[0]] if y.include?(item.id)
- end
- end
- return item
- end
- def trade_item_with_party(new_item, old_item)
- return false if new_item && !$game_party.has_item?(new_item)
- $game_party.gain_item(unmorph_item(old_item), 1)
- $game_party.lose_item(unmorph_item(new_item), 1)
- return true
- end
- def change_equip(slot_id, item)
- return unless trade_item_with_party(item, equips[slot_id])
- #return if item && equip_slots[slot_id] != item.etype_id
- @equips[slot_id].object = morph_item(item, equip_slots[slot_id])
- refresh
- end
- end
- class Window_EquipItem < Window_ItemList
- def include?(item)
- return true if item == nil
- return false unless item.is_a?(RPG::EquipItem)
- return false if @slot_id < 0
- return false unless MULTISLOT::Item_Morph[item.id] or item.etype_id == @actor.equip_slots[@slot_id]
- return @actor.equippable?(item)
- end
- def update_help
- super
- if @actor && @status_window
- temp_actor = Marshal.load(Marshal.dump(@actor))
- nu_item = morph_item(item,temp_actor.equip_slots[@slot_id])
- p nu_item
- temp_actor.force_change_equip(@slot_id, nu_item)
- @status_window.set_temp_actor(temp_actor)
- end
- end
- def morph_item(item,slot_id)
- return nil unless item
- if slot_id == 0
- return $data_weapons[MULTISLOT::Item_Morph[item.id][slot_id]]
- elsif slot_id != nil
- return $data_armors[MULTISLOT::Item_Morph[item.id][slot_id]]
- end
- return item
- end
- end
Add Comment
Please, Sign In to add comment