brennoncraig
Member
Earlier I made a post stating:
"To put it simply, all I'm looking for is the vendors to maintain the item amounts that I have set for them in the designated SBshops. I don't want for it to x2 increase if there's a high demand nor /2 if there's is no demand."
At that time I had thought I had tried every way possible to provide a solution to that ongoing problem that every server has been facing since the creation of Ultima Online.
But I'm here to assure u that after all those long tedious hours of tinkering away at it, the solution has finally came to light and here it is..
Now the cap is based off whatever the SB shop says, not the GenericBuy. Hope everyone enjoys it
Also, you can modify your vendor restock timers in BaseVendor. I switched mine from 1 hour to 30 minutes.
"To put it simply, all I'm looking for is the vendors to maintain the item amounts that I have set for them in the designated SBshops. I don't want for it to x2 increase if there's a high demand nor /2 if there's is no demand."
At that time I had thought I had tried every way possible to provide a solution to that ongoing problem that every server has been facing since the creation of Ultima Online.
But I'm here to assure u that after all those long tedious hours of tinkering away at it, the solution has finally came to light and here it is..
C#:
public void OnRestock()
{
if ( m_Amount <= 0 )
{
/*
Core.ML using this vendor system is undefined behavior, so being
as it lends itself to an abusable exploit to cause ingame havok
and the stackable items are not found to be over 20 items, this is
changed until there is a better solution.
*/
object Obj_Disp = GetDisplayEntity();
if( Core.ML && Obj_Disp is Item && !( Obj_Disp as Item ).Stackable )
{
m_MaxAmount = Math.Min( 100, m_MaxAmount );
}
else
{
m_MaxAmount = Math.Min( 100001, m_MaxAmount * 1 );
}
}
else
{
/* NOTE: According to UO.com, the quantity is halved if the item does not reach 0
* Here we implement differently: the quantity is halved only if less than half
* of the maximum quantity was bought. That is, if more than half is sold, then
* there's clearly a demand and we should not cut down on the stock.
*/
int halfQuantity = m_MaxAmount;
if ( halfQuantity >= 100001 )
halfQuantity = 100000;
else if ( halfQuantity > 100 )
halfQuantity /= 1;
if ( m_Amount >= halfQuantity )
m_MaxAmount = halfQuantity;
}
m_Amount = m_MaxAmount;
}
}
}
Now the cap is based off whatever the SB shop says, not the GenericBuy. Hope everyone enjoys it
Post automatically merged:
Also, you can modify your vendor restock timers in BaseVendor. I switched mine from 1 hour to 30 minutes.
C#:
public virtual TimeSpan RestockDelay
{
get
{
return TimeSpan.FromMinutes( 30 );
}
}
Post automatically merged:
Attachments
Last edited: