I'd say this question is really open to opinion, but that would only be the case if we give you an actual formula.
But there are some generic rules and considerations that might lead you to a formula you are satisfied with:
Attributes metrics: You should first find a way to generate metrics on your weapon's stats. Not something opinion based, but hard math stuff, combining several stats to generate a single value. For example:
DPS = attackDamage*attackSpeed
DamageSpecialization(*) = StandarDeviation(base, impact, punct, slash)
DamageAmp = (CriticalChange/100)*CritMultiplier
(*) DamageSpecialization would be 0 if all damage types are the same, and a greater
number if one of the values deviate a lot from the mean.
Calculate the weapon rating: Using the values generated in the step before, you should create another formula to generate a rating for your weapong. Just by comparing the rating of two different weapons, you should clearly see how better one is compared to another. Example:
WeaponRating = DPS*DamageAmp
Price curve: Now you have a rating for your weapon. But imagine you have a weapon that has double weapon rating compared to another weapon. You could just make it as twice as expensive. That would be a linear growth of the price, but you could apply a geometric growth, or any other formula. You could even calculate the highest possible weapon rating for the very best buyable weapon in the game, and divide every weapon rating by that value, so you have a normalized weapon rating. That way it would be easier to apply a more complicated formula to calculate the price, like price = (1+(rating/maxRating))^10
.
Spreasheets are your friends here.
Of course is up to you decide what is more valuable in a weapon and the weight it has to it's rating. Maybe weapons that only deals one kind of damage are most valuable, because they deal better with one kind of enemy (but are trash against others), or maybe an all-around weapon with balanced damage is the best since you don't have to switch weapons.
Important bottom line: The price of the weapon has to fit in the general economy of the game. Even if you specify the price of the weapon, if the player can never buy it because he'll have to grind for years, that's not good. And if he can buy it very early in the game, that will throw the balance of the game off.
calculatePrice(item) { return 500; }
there you go. It's fast to calculate and easy to implement. Not sure which language you're working in but it will be pretty universal, which makes the algorithm very portable. \$\endgroup\$