Advertisement
LeonMMS

Untitled

Apr 14th, 2021
1,175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.55 KB | None | 0 0
  1.     def change_equip(slot_id, item_id)
  2.         return unless trade_item_with_party(equip_object(slot_id, item_id), equip_object(slot_id, @equips[slot_id]), slot_id)
  3.         @equips[slot_id] = item_id
  4.         $network.send_player_equip(self, slot_id)
  5.     if slot_id == 0
  6.       weapon = $data_weapons[item_id]
  7.       if weapon
  8.         weapon.features.each{ |feat|
  9.           next unless feat.code == 43
  10.           @hotbar.each_with_index{|value, index|
  11.             next unless value.type == Enums::Hotbar::NONE
  12.             change_hotbar(index, Enums::Hotbar::SKILL, feat.data_id)
  13.             break
  14.           }
  15.         }
  16.       else
  17.         @hotbar.each_with_index{ |value, index|
  18.           next if value.type != Enums::Hotbar::SKILL || (value.type == Enums::Hotbar::SKILL && skill_learn?(value.item_id))
  19.           change_hotbar(index, Enums::Hotbar::NONE, 0)
  20.         }
  21.       end
  22.     else
  23.       armor = $data_armors[item_id]
  24.       if armor
  25.         armor.features.each{ |feat|
  26.           next unless feat.code == 43
  27.           @hotbar.each_with_index{|value, index|
  28.             next unless value.type == Enums::Hotbar::NONE
  29.             change_hotbar(index, Enums::Hotbar::SKILL, feat.data_id)
  30.             break
  31.           }
  32.         }
  33.       else
  34.         @hotbar.each_with_index{ |value, index|
  35.           next if value.type != Enums::Hotbar::SKILL || (value.type == Enums::Hotbar::SKILL && skill_learn?(value.item_id))
  36.           change_hotbar(index, Enums::Hotbar::NONE, 0)
  37.         }
  38.       end
  39.     end
  40.         # Se o equipamento que aumentava HP e/ou MP máximo foi removido
  41.         refresh
  42.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement