Hello all

Niert

Citizen
Nov 1, 2019
6
0
0
Hi, thx 4 welcome, im a beginner, set up my emulation and works fine so far. Checked the code but its even not so much similart to Python or others what i slightly know. Will be happy if the Team can give me some advice.
 

Milva

Admin
Moderator
Mar 3, 2013
4,525
570
113
Donate
Donate money to this user
Welcome to the ServUO community :) maybe post the questions which you have
 

Niert

Citizen
Nov 1, 2019
6
0
0
Yes maybe some things immediately:

I was searching fpr some root access to change the plain gold in the loot. I wanted to decrease it to 5% of the deafault or lower.

This is probaly not where i have to do it isnt:
ServUO-master\Scripts\Mobiles\Normal
Rat: this.AddLoot(LootPack.Poor);

Here ("\LootPack) i see some default value like 100. Is it that one?
ServUO-master\Scripts\Misc
\Loot
\LootPack

Do i have to change it for each creature single or is there some root where it could be done?

ServUO-master\Data\objects
<object type="Server.Mobiles.LowlandBoura" gfx="17033" />

What is this gfx and the Number?

What i saw at one server was that they disabled the "Sell" Function at the NPCs. I think that is a good idea. Is there a root function where it could be done for all of them at once?
 

PyrO

Moderator
Jan 27, 2015
1,315
170
63
I was searching fpr some root access to change the plain gold in the loot. I wanted to decrease it to 5% of the deafault or lower.

This is probaly not where i have to do it isnt:
ServUO-master\Scripts\Mobiles\Normal
Rat: this.AddLoot(LootPack.Poor);

Here ("\LootPack) i see some default value like 100. Is it that one?
ServUO-master\Scripts\Misc
\Loot
\LootPack

Do i have to change it for each creature single or is there some root where it could be done?
Well you can either fix the numbers in the creatures or you can do it in another way.
In LootPack.cs at Line 787 you have this.
C#:
                if (item.Stackable)
                {
                    item.Amount = m_Quantity.Roll();
                }
you can edit that to this:
C#:
                if (item.Stackable)
                {
                    item.Amount = m_Quantity.Roll();
                    if (item is Gold)
                    {
                        item.Amount = (int)(item.Amount * 0.05);
                    }
                }
This will lower the gold amount to 5% of what it was
 

Niert

Citizen
Nov 1, 2019
6
0
0
This will lower the gold amount to 5% of what it was
Looks like could work > If the item is gold-(coins) then the amount should be integer of 5% of it<. No error msg here, but also no result. The application didnt react with any change. Possibly "item" does not refer to a characteristic "stackable" even if it is stackable, or its still the wrong file?

Tried some other changes and change of position. When there were error messages the it always referred to incompatibility of data types string, integer and double.

This can be done in BaseVendor.cs
Similar here. In the end i thought let me remove the whole code in that file and see what happens. File was empty. Simply nothing happened, the application didnt recognize the missing code.

Yes, desperately i also restarted the PC.
 

Quasar

Squire
Oct 26, 2018
205
26
28
check out this loot system, it could at least give you ideas
 

PyrO

Moderator
Jan 27, 2015
1,315
170
63
Well what I gave you works, but not on already existing mobs, since they already had that roll in the first place.

So you need to respawn the basecreatures, sorry should have mentioned that
 
  • Like
Reactions: Niert

Niert

Citizen
Nov 1, 2019
6
0
0
Reduce plain gold to 5% at loot works now fine as far as is saw!

Still laborating at the price reduction of reselling items at NPC vendors. Did not find just how to disable this, that hint was quite generalized at this early time for me. But im somehow on a path to find something similar to the loot reduction:

ServUO-master\Scripts\VendorInfo


public int GetSellPriceFor(Item item, BaseVendor vendor)
{
int price = 0;
m_Table.TryGetValue(item.GetType(), out price);

if (vendor != null && BaseVendor.UseVendorEconomy)
{
IBuyItemInfo buyInfo = vendor.GetBuyInfo().OfType<GenericBuyInfo>().FirstOrDefault(info => info.EconomyItem && info.Type == item.GetType());

if (buyInfo != null)
{
int sold = buyInfo.TotalSold;
price = (int)((double)buyInfo.Price * .1); // .75

return Math.Max(1, price);
}
}

// if (item is BaseArmor)
// {
// BaseArmor armor = (BaseArmor)item;
[...]
// price = 1;
// }

/*else*/ if (item is BaseBeverage)
{
int price1 = price, price2 = price;

if (item is Pitcher)
{
price1 = 3;
price2 = 5;
}
else if (item is BeverageBottle)
{
price1 = 3;
price2 = 3;
}
else if (item is Jug)
{
price1 = 6;
price2 = 6;
}

BaseBeverage bev = (BaseBeverage)item;

if (bev.IsEmpty || bev.Content == BeverageType.Milk)
price = price1;
else
price = price2;
}

return price;
}


I checked it at the weaver/tailor and it worked. Then i ckecked it at the blacksmith and it didnt. Is the blacksmith not a "basevendor" ?. Surprisingly the Blacksmith still is able to buy at the default price even if i set the complete referring code as comment. Whats that?

Do i have to add something here?


public int GetSellPriceFor(Item item)
{
return GetSellPriceFor(item, null);
}
 

Falkor

Squire
Apr 11, 2018
415
158
43
wpshard.com
Shard Name
Whispering Pines
Each profession has a corresponding SB* file in /scripts/vendorinfo

For example, the Animal Trainer file is SBAnimalTrainer.cs. That file determines what they sell, the price, and initial quantity they will stock. It also controls what they will buy and for how much.

Near the bottom is the InternalSellInfo section. For the Animal Trainer, that area is already empty and they won't buy anything from anyone.

Code:
        public class InternalSellInfo : GenericSellInfo
        {
            public InternalSellInfo()
            {
            }
        }

Looking at the Architect (SBArchitect.cs), we see they will buy two items:
Code:
        public class InternalSellInfo : GenericSellInfo
        {
            public InternalSellInfo()
            {
                Add(typeof(InteriorDecorator), 5000);

                if (Core.AOS)
                    Add(typeof(HousePlacementTool), 301);
            }
        }
That will give you a good idea where & how to change these items or zero them out altogether.
 

Holyblablabla

Citizen
Jul 3, 2020
31
6
8
Each profession has a corresponding SB* file in /scripts/vendorinfo

For example, the Animal Trainer file is SBAnimalTrainer.cs. That file determines what they sell, the price, and initial quantity they will stock. It also controls what they will buy and for how much.

Near the bottom is the InternalSellInfo section. For the Animal Trainer, that area is already empty and they won't buy anything from anyone.

Code:
        public class InternalSellInfo : GenericSellInfo
        {
            public InternalSellInfo()
            {
            }
        }

Looking at the Architect (SBArchitect.cs), we see they will buy two items:
Code:
        public class InternalSellInfo : GenericSellInfo
        {
            public InternalSellInfo()
            {
                Add(typeof(InteriorDecorator), 5000);

                if (Core.AOS)
                    Add(typeof(HousePlacementTool), 301);
            }
        }
That will give you a good idea where & how to change these items or zero them out altogether.
Hi, Falkor. The price of ex-crafts is too expensive atm. I didn't find the ex part in SB-files. How do they price an exceptional item?
 

Falkor

Squire
Apr 11, 2018
415
158
43
wpshard.com
Shard Name
Whispering Pines
The formula used is in GenericSell.cs

For example:
Code:
            if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

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

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

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

                if (price < 1)
                    price = 1;
            }
And the other types of items are covered after that.
 
  • Like
Reactions: Holyblablabla