Fireball
Member
Hi guys,
I wonder if you could please help me with applying NPC guild discounts to vendor items?
I've got this working, but only on the second "vendor buy" command. My WriteLine debugging shows that on the first pass "pm" is null, meaning there is no focus mob yet, and no discount is shown. But on the second pass the discount is given and the priceScalar of 80 is displayed.
What am I doing wrong?
Thanks!
David
Here's the priceScalar method from my BaseVendor.cs
I wonder if you could please help me with applying NPC guild discounts to vendor items?
I've got this working, but only on the second "vendor buy" command. My WriteLine debugging shows that on the first pass "pm" is null, meaning there is no focus mob yet, and no discount is shown. But on the second pass the discount is given and the priceScalar of 80 is displayed.
What am I doing wrong?
Thanks!
David
Here's the priceScalar method from my BaseVendor.cs
Code:
public void UpdateBuyInfo()
{
int priceScalar = GetPriceScalar();
PlayerMobile pm = FocusMob as PlayerMobile;
if (pm == null)
{
Console.WriteLine("pm is null");
return;
}
if ( (pm.NpcGuild !=null) && (this.NpcGuild !=null) && (pm.NpcGuild == this.NpcGuild ) )
{
SayTo( pm, 501528 ); // As thou'rt of my same guild, I shall discount my wares to thee.
priceScalar = (int)(priceScalar * 0.8);
Console.WriteLine(priceScalar);
}
IBuyItemInfo[] buyinfo = (IBuyItemInfo[])m_ArmorBuyInfo.ToArray( typeof( IBuyItemInfo ) );
if ( buyinfo != null )
{
foreach ( IBuyItemInfo info in buyinfo )
info.PriceScalar = priceScalar;
}
}