Core/Items: Fix item sell price not scaling with item level
Port From (https://github.com/TrinityCore/TrinityCore/commit/500301b96256792357b13ef78d7e1836028cff26)
This commit is contained in:
@@ -1754,7 +1754,7 @@ namespace Game.Entities
|
||||
typeFactor = weaponPrice.Data;
|
||||
}
|
||||
|
||||
standardPrice = false;
|
||||
standardPrice = true;
|
||||
return (uint)(proto.GetPriceVariance() * typeFactor * baseFactor * qualityFactor * proto.GetPriceRandomValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -3039,11 +3039,7 @@ namespace Game.Entities
|
||||
uint eslot = slot - InventorySlots.BuyBackStart;
|
||||
|
||||
SetInvSlot(slot, pItem.GetGUID());
|
||||
ItemTemplate proto = pItem.GetTemplate();
|
||||
if (proto != null)
|
||||
SetBuybackPrice(eslot, proto.GetSellPrice() * pItem.GetCount());
|
||||
else
|
||||
SetBuybackPrice(eslot, 0);
|
||||
SetBuybackPrice(eslot, pItem.GetSellPrice(this) * pItem.GetCount());
|
||||
|
||||
SetBuybackTimestamp(eslot, etime);
|
||||
|
||||
|
||||
@@ -429,12 +429,16 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
ItemTemplate pProto = pItem.GetTemplate();
|
||||
if (pProto != null)
|
||||
uint sellPrice = pItem.GetSellPrice(_player);
|
||||
if (sellPrice > 0)
|
||||
{
|
||||
if (pProto.GetSellPrice() > 0)
|
||||
ulong money = sellPrice * packet.Amount;
|
||||
|
||||
if (money > uint.MaxValue) // ensure sell price * amount doesn't overflow buyback price
|
||||
{
|
||||
ulong money = pProto.GetSellPrice() * packet.Amount;
|
||||
_player.SendSellError(SellResult.CantSellItem, creature, packet.ItemGUID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player.ModifyMoney((long)money)) // ensure player doesn't exceed gold limit
|
||||
{
|
||||
@@ -477,8 +481,7 @@ namespace Game
|
||||
pl.SendSellError(SellResult.CantSellItem, creature, packet.ItemGUID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
pl.SendSellError(SellResult.CantSellItem, creature, packet.ItemGUID);
|
||||
pl.SendSellError(SellResult.CantFindItem, creature, packet.ItemGUID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user