没有成功的原因是没有更改各种职业穿戴武器的信息,而这个是不在Weapons.rxdata的。
用法,直接调用:- copy_weapon(原始武器ID, 目标武器ID)
复制代码 这样会把原始武器的所有信息复制到目标武器上。
def copy_weapon(from, to) d = load_data("Data/Weapons.rxdata") c = load_data("Data/Classes.rxdata") d[to]=d[from].clone d[to].id = to c.each do |cl| next if cl.nil? cl.weapon_set.push(to) if cl.weapon_set.include?(from) end filename = "Data/Weapons.rxdata" filename1 = "Data/Classes.rxdata" file = File.open(filename, "wb") file1 = File.open(filename1, "wb") Marshal.dump(d,file) Marshal.dump(c,file1) file.close file1.close $data_weapons = load_data(filename) $data_classes = load_data(filename1) end
def copy_weapon(from, to)
d = load_data("Data/Weapons.rxdata")
c = load_data("Data/Classes.rxdata")
d[to]=d[from].clone
d[to].id = to
c.each do |cl|
next if cl.nil?
cl.weapon_set.push(to) if cl.weapon_set.include?(from)
end
filename = "Data/Weapons.rxdata"
filename1 = "Data/Classes.rxdata"
file = File.open(filename, "wb")
file1 = File.open(filename1, "wb")
Marshal.dump(d,file)
Marshal.dump(c,file1)
file.close
file1.close
$data_weapons = load_data(filename)
$data_classes = load_data(filename1)
end
|