I would do this by to making a compare method <=> in RPG::Item RPG::Weapon and RPG::Armor It would look something like this
array.sort! {|a,b| b - a}
Compare method add this in RPG:
Item, Weapon, Armor) (First Draft try it to see if it works May still have something wrong in it)
def <=> (other)
classes = ["RPG::Armor", "RPG::Weapon", "RPG::Item"]
if classes.index(self.class.to_s) > classes.index(other.class.to_s)
return 1
elsif classes.index(self.class.to_s) < classes.index(other.class.to_s)
return -1
else
return self.id <=> other.id
end