fix(core): Converts vendor buy packets (#339)
This commit is contained in:
parent
d71856ddbe
commit
5e991f6fb5
10 changed files with 255 additions and 513 deletions
|
|
@ -127,7 +127,6 @@ namespace Server.Mobiles
|
|||
|
||||
UpdateBuyInfo();
|
||||
|
||||
// IBuyItemInfo[] buyInfo = this.GetBuyInfo();
|
||||
var info = GetSellInfo();
|
||||
var totalCost = 0;
|
||||
var validBuy = new List<BuyItemResponse>(list.Count);
|
||||
|
|
@ -910,13 +909,9 @@ namespace Server.Mobiles
|
|||
)
|
||||
);
|
||||
|
||||
if (disp is Item item)
|
||||
if (disp is IPropertyListObject obj)
|
||||
{
|
||||
opls.Add(item.PropertyList);
|
||||
}
|
||||
else if (disp is Mobile mobile)
|
||||
{
|
||||
opls.Add(mobile.PropertyList);
|
||||
opls.Add(obj.PropertyList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -981,25 +976,9 @@ namespace Server.Mobiles
|
|||
return;
|
||||
}
|
||||
|
||||
if (ns.ContainerGridLines)
|
||||
{
|
||||
from.Send(new VendorBuyContent6017(list));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.Send(new VendorBuyContent(list));
|
||||
}
|
||||
|
||||
from.Send(new VendorBuyList(this, list));
|
||||
|
||||
if (ns.HighSeas)
|
||||
{
|
||||
from.Send(new DisplayBuyListHS(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.Send(new DisplayBuyList(this));
|
||||
}
|
||||
from.NetState.SendVendorBuyContent(list);
|
||||
from.NetState.SendVendorBuyList(this, list);
|
||||
from.NetState.SendDisplayBuyList(Serial);
|
||||
|
||||
from.Send(new MobileStatusExtended(from)); // make sure their gold amount is sent
|
||||
|
||||
|
|
|
|||
|
|
@ -102,41 +102,11 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
public string GetNameFor(Item item)
|
||||
{
|
||||
if (item.Name != null)
|
||||
{
|
||||
return item.Name;
|
||||
}
|
||||
public string GetNameFor(Item item) => item.Name ?? item.LabelNumber.ToString();
|
||||
|
||||
return item.LabelNumber.ToString();
|
||||
}
|
||||
public bool IsSellable(Item item) => !item.Nontransferable && IsInList(item.GetType());
|
||||
|
||||
public bool IsSellable(Item item)
|
||||
{
|
||||
if (item.Nontransferable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (item.Hue != 0)
|
||||
// return false;
|
||||
|
||||
return IsInList(item.GetType());
|
||||
}
|
||||
|
||||
public bool IsResellable(Item item)
|
||||
{
|
||||
if (item.Nontransferable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (item.Hue != 0)
|
||||
// return false;
|
||||
|
||||
return IsInList(item.GetType());
|
||||
}
|
||||
public bool IsResellable(Item item) => !item.Nontransferable && IsInList(item.GetType());
|
||||
|
||||
public void Add(Type type, int price)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,18 +36,8 @@ namespace Server.Mobiles
|
|||
|
||||
public int Price { get; }
|
||||
|
||||
public string FormattedPrice
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Core.ML)
|
||||
{
|
||||
return Price.ToString("N0", CultureInfo.GetCultureInfo("en-US"));
|
||||
}
|
||||
|
||||
return Price.ToString();
|
||||
}
|
||||
}
|
||||
public string FormattedPrice =>
|
||||
Core.ML ? Price.ToString("N0", CultureInfo.GetCultureInfo("en-US")) : Price.ToString();
|
||||
|
||||
public string Description
|
||||
{
|
||||
|
|
@ -1473,27 +1463,13 @@ namespace Server.Mobiles
|
|||
string firstWord;
|
||||
|
||||
var sep = text.IndexOfAny(new[] { ' ', ',' });
|
||||
if (sep >= 0)
|
||||
{
|
||||
firstWord = text.Substring(0, sep);
|
||||
}
|
||||
else
|
||||
{
|
||||
firstWord = text;
|
||||
}
|
||||
firstWord = sep >= 0 ? text.Substring(0, sep) : text;
|
||||
|
||||
string description;
|
||||
|
||||
if (int.TryParse(firstWord, out var price))
|
||||
{
|
||||
if (sep >= 0)
|
||||
{
|
||||
description = text.Substring(sep + 1).Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
description = "";
|
||||
}
|
||||
description = sep >= 0 ? text.Substring(sep + 1).Trim() : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue