What you say about my substitution is true enough I suppose but there is an exit algorithm for the repair skill if it is insufficient. Perhaps you could point out where the players actual skill is considered in all that mess. There is nothing in the first two scripts that uses that particular value and neither is there anything in the snippet of source code. I suppose if I am really interested I could download the source myself, I am not too good at following other peoples code and get confused by object oriented modality.
As for the price of weapons I think the base and crafted weapons have an arbitrary value and the looted weapons with modifiers have the value calculated at their time of generation; that is, in whatever algorithm that is used to randomly generate them. I think weapons should have a valuation based on a standard archetype whereby a 50/50 quality merchant/crafted weapon has an arbitrary value for its particular type, axe, battle axe, dagger, long sword and etc. and as you get away from 50/50 or start adding modifiers to the weapon its value changes. I suspect this is the ultimate plan. Under such a system you could have a factor of, say, 10% of the current quality and 100% of the maximum quality with additional factors for specific modifiers. I suggest the difference between the current and maximum qualities because a 10/250 sword is still better than a 50/50 in that it can be repaired to a greater quality which makes maximum quality a more significant factor. As far as the modified loot weapons go they all currently max out at 50/50 but the modifiers make them better or worse than mundane ones, so that this will need to be considered. Of course they already have their own valuation algorithm but they could have the quality factors adjusting their "as new" prices when they get used.