The vendors that buy weapons and armor are really cheapos on OSI. I want to make it so people can actually make some coin depending on the attributes of the weapon they are selling but not be able to buy an item off the vendor and then sell it for a hack way to make cash.

I have searched every base vendor you can think of and I can't seem to figure out how you would make it so only the prices of items with attributes and not items bought from the vendor can be sold to the vendor for a higher price than the measly offerings they give currently.
 
in 'Scripts/Mobiles/Vendors/GenericSell.cs' , you can find GetSellPriceFor(Item item) function.

This function actually can modifying what you want.

if you code like this

price = (int)(price * 0.60);

price will be modify as 60%.

So, define your item as BaseArmor and so on, check item's property and modify actual prices what you want :)
 
in 'Scripts/Mobiles/Vendors/GenericSell.cs' , you can find GetSellPriceFor(Item item) function.

This function actually can modifying what you want.

if you code like this

price = (int)(price * 0.60);

price will be modify as 60%.

So, define your item as BaseArmor and so on, check item's property and modify actual prices what you want :)

I tried to raise that number all the way to 5.00 and nothing changes when I go to sell items.
[doublepost=1476387929][/doublepost]
Code:
         if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                if (armor.Quality == ArmorQuality.Low)
                    price = (int)(price * 0.60);
                else if (armor.Quality == ArmorQuality.Exceptional)
                    price = (int)(price * 1.25);

                price += 100 * (int)armor.Durability;

                price += 100 * (int)armor.ProtectionLevel;

                if (price < 1)
                    price = 1;
            }
            else if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                if (weapon.Quality == WeaponQuality.Low)
                    price = (int)(price * 0.60);
                else if (weapon.Quality == WeaponQuality.Exceptional)
                    price = (int)(price * 1.25);

                price += 100 * (int)weapon.DurabilityLevel;

                price += 100 * (int)weapon.DamageLevel;

                if (price < 1)

So this is from genericsell.cs

Mind you I am using AoS so I feel like I am missing something here to look for that kind of armor attributes.
 
https://github.com/ServUO/ServUO/blob/master/Scripts/VendorInfo/GenericSell.cs

So, this is GenericSell.cs in ServUO Repo, and now we'll see how vendor selling system works.

In Line 34, we can find GetSellPriceFor(Item item) function.
The price which vendor check is the value of this function.
There's no codes to checking expansions.
So what you need to do is just put your codes in each 'if' sections.

Line 39-54, you can change the price of ArmorType items.
So put like this code in this section
price += Armor.Attributes.DefendChance * 10;
it'll check the value of DefendChance property, multiply the value 10 times, and add on price.

If you want to change the price of WeaponType items, you need to add the codes in Line 55-70.

If you want to multiply 5 times of all the price, change Line 99 like this.
return (int)(price * 5.0);
 
Just a thought, but is there a way to make it so vendors don't sell the things that they buy from players?
Only way I can think of doing it, without having time to actually look into it, is set up a vendor with just a SBSell info
[ or is it buy? always get confused on this one - is it sell/buy from the vendor's perspective or from the player's? ]
 
Just a thought, but is there a way to make it so vendors don't sell the things that they buy from players?
Only way I can think of doing it, without having time to actually look into it, is set up a vendor with just a SBSell info
[ or is it buy? always get confused on this one - is it sell/buy from the vendor's perspective or from the player's? ]
Do you wish to remove all things which vendor bought from players?
[doublepost=1476405446][/doublepost]There's function named IsResellable.
if it returns 'false', vendor will not resell items which bought from players.
 
https://github.com/ServUO/ServUO/blob/master/Scripts/VendorInfo/GenericSell.cs

So, this is GenericSell.cs in ServUO Repo, and now we'll see how vendor selling system works.

In Line 34, we can find GetSellPriceFor(Item item) function.
The price which vendor check is the value of this function.
There's no codes to checking expansions.
So what you need to do is just put your codes in each 'if' sections.

Line 39-54, you can change the price of ArmorType items.
So put like this code in this section
price += Armor.Attributes.DefendChance * 10;
it'll check the value of DefendChance property, multiply the value 10 times, and add on price.

If you want to change the price of WeaponType items, you need to add the codes in Line 55-70.

If you want to multiply 5 times of all the price, change Line 99 like this.
return (int)(price * 5.0);


So that last line is kinda in line with what I am going for only issue is, if you say buy a black staff priced at 22gp off the vendor the sale price if set to 5X is now 33gp so it can be exploited. Can we stop the vendor from buying items that were purchased?
 
So that last line is kinda in line with what I am going for only issue is, if you say buy a black staff priced at 22gp off the vendor the sale price if set to 5X is now 33gp so it can be exploited. Can we stop the vendor from buying items that were purchased?
you mean you need to stop Re-selling which vendor bought from player?
 
you mean you need to stop Re-selling which vendor bought from player?

So here is the best example:

Weapon vendor sells base weapons and such like axes staves etc.
If you set that property to up the sell price,

If you want to multiply 5 times of all the price, change Line 99 like this.
return (int)(price * 5.0);

any base weapon or item a vendor sells can then be sold for more than it was bought. So you can exploit it. So if there is a way to up the base sell to the vendor property like we figured out above, but make it so the vendor can't buy it back it would be awesome!
 
Now I notice that what you concerned!
On my game server, when Players sell their items to vendor, Item permantely removed.
So the problem which it makes will not be happened.
but in this case ,the problem which it causes, must be changed I know.

There's 2 things that you can do.

FIrst, If you want to remove all the items like my server, Change IsResellable function as always return false.

Second, If you want to change the price of items, you need to add functions in GenericBuy.cs
in this script, this functions will required for calculate the property.
- Getting Item for calculate.
- Calculating Properties.
I'll not post the codes in this page, cuz I don't want to code more things! :(
[doublepost=1476414829][/doublepost]+ the place which you can get item's imformation is BaseVendor.cs
So, if you want to choose second option, you also need to add some codes in BaseVendor.cs
 
Now I notice that what you concerned!
On my game server, when Players sell their items to vendor, Item permantely removed.
So the problem which it makes will not be happened.
but in this case ,the problem which it causes, must be changed I know.

There's 2 things that you can do.

FIrst, If you want to remove all the items like my server, Change IsResellable function as always return false.

Second, If you want to change the price of items, you need to add functions in GenericBuy.cs
in this script, this functions will required for calculate the property.
- Getting Item for calculate.
- Calculating Properties.
I'll not post the codes in this page, cuz I don't want to code more things! :(
[doublepost=1476414829][/doublepost]+ the place which you can get item's imformation is BaseVendor.cs
So, if you want to choose second option, you also need to add some codes in BaseVendor.cs

This is incredibly out of my league :(
 
This is incredibly out of my league :(
Just study more.
It seems really hard, but it doesn't.
what you need is time.
Do something, other things, and so on.
Try more, study hard.
[doublepost=1476420411][/doublepost]Someday, you'll find out you can handle numerous things.
 
Just study more.
It seems really hard, but it doesn't.
what you need is time.
Do something, other things, and so on.
Try more, study hard.
[doublepost=1476420411][/doublepost]Someday, you'll find out you can handle numerous things.

Or I can pay you to fix this? :) I can;t offer much but something i better than nothing! :)
 
Or I can pay you to fix this? :) I can;t offer much but something i better than nothing! :)
I'm really sorry to say that I will not do this.
I have my private server as 100% custom, and it isn't complete server which comsume lots of time.
If I have a time to do something, I can do, but now, I can't.

Instead of code for you, I'll give you a hint.
Extend the codes in GenericBuy.cs and modify the function in BaseVendor.cs
Put Item's informations in function and handle it.
 
Why not use to same code for calculating how much the vendor will pay to buy something, for how much they'll sell it?
 
Why not use to same code for calculating how much the vendor will pay to buy something, for how much they'll sell it?
because GenericBuy and GenericSell get different value arrays.
If SO want to make it as same calculator, muse be rebuild the method as you know.
 
@SadPanda I tried messing around with it some this morning to get it to work but haven't been successful yet.
i'll let you know If I get it working over the weekend
 
I've only been able to effect the price something is sold for universally. meaning i can change it so everything costs the same.
it's a shame because there was a post on runuo about randomized vendor prices but sadly the WayBack Machine doesn't seem to have it archived
 
Back