Helping me to convert a script to JS

so Hi guys I commissioned shaz for a script in the past. She's done a really great job, but my game got transfert to MV...and I don't want to bother her with the conversion so I tried by myself...but I just can't suceed to convert it xD...so guys I ask your help please ;A;


here the script : 

Spoiler
Code:
module DataManager
  class << self
    alias shaz_equip_restrict_load_database load_database
  end
  
  def self.load_database
    shaz_equip_restrict_load_database
    build_equipment_restrictions
  end
  
  def self.build_equipment_restrictions
    $data_weapons.compact.each { |w| w.build_equipment_restrictions }
    $data_armors.compact.each { |a| a.build_equipment_restrictions }
  end
end

class RPG::EquipItem < RPG::BaseItem
  def build_equipment_restrictions
    @restrict_users = []
    @restrict_minus = 0
 
    note.split(/[\r\n]+/).each do |line|
      case line
      when /<user /i
        @restrict_users = /<user (.*)>/i.match(line)[1].scan(/\d+/).collect { |i| i.to_i}
      when /<minus (\d+)>/i
        @restrict_minus = (100 - $1.to_i)/100.0
      end
    end
  end
  
  def user_params(actor_id, param_id)
    if @restrict_users.empty? || @restrict_users.include?(actor_id)
      value = params[param_id] 
    else
      value = (params[param_id] * @restrict_minus).to_i
    end
    value
  end
  
  attr_accessor :restrict_users
  attr_accessor :restrict_minus
end

class Game_Actor < Game_Battler
  def param_plus(param_id)
    equips.compact.inject(super) {|r, item| r += item.user_params(@actor_id, param_id) }
  end
end
I don't even remember making that, but I can guarantee I would have been pulling my hair out over those regular expressions!  Is the above exactly the script I gave you, or does it have some of your changes?



If nobody else can help with this I'll see what I can do.
I don't even remember making that, but I can guarantee I would have been pulling my hair out over those regular expressions!  Is the above exactly the script I gave you, or does it have some of your changes?



If nobody else can help with this I'll see what I can do.

hahaha I think it's like one year ago? or two? 


I know it's was in my begin of making commission hahaha.


Well I wanted to ask you in first but I don't wanted to bother you 🙁  


go ahead!


EDIT : no I didn't edit anything 🙂  this was in the year I was not enough good for making  script haha
I will bump the thread for know if someone  can do something 🙂  

Original thread: https://forums.rpgmakerweb.com/threads/helping-me-to-convert-a-script-to-js.58550/