mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9957] Alow sell item for money and extanded coset without momey in same time.
npc_vendor.ExtandedCost can be negative now that meaning: price excluded default item BuyPrice and use only abs(ExtandedCost) items). For example expected used for item 36908.
This commit is contained in:
parent
94f7a7709d
commit
67b8ca03b5
13 changed files with 51 additions and 31 deletions
|
|
@ -18426,12 +18426,12 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
|||
return false;
|
||||
}
|
||||
|
||||
if (crItem->ExtendedCost)
|
||||
if (uint32 extendedCostId = crItem->GetExtendedCostId())
|
||||
{
|
||||
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
|
||||
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId);
|
||||
if (!iece)
|
||||
{
|
||||
sLog.outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost);
|
||||
sLog.outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, extendedCostId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -18468,10 +18468,11 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
|||
}
|
||||
}
|
||||
|
||||
uint32 price = pProto->BuyPrice * count;
|
||||
uint32 price = crItem->IsExcludeMoneyPrice() ? 0 : pProto->BuyPrice * count;
|
||||
|
||||
// reputation discount
|
||||
price = uint32(floor(price * GetReputationPriceDiscount(pCreature)));
|
||||
if (price)
|
||||
price = uint32(floor(price * GetReputationPriceDiscount(pCreature)));
|
||||
|
||||
if (GetMoney() < price)
|
||||
{
|
||||
|
|
@ -18490,9 +18491,9 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
|||
}
|
||||
|
||||
ModifyMoney( -(int32)price );
|
||||
if (crItem->ExtendedCost) // case for new honor system
|
||||
if (uint32 extendedCostId = crItem->GetExtendedCostId())
|
||||
{
|
||||
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
|
||||
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId);
|
||||
if (iece->reqhonorpoints)
|
||||
ModifyHonorPoints( - int32(iece->reqhonorpoints * count));
|
||||
if (iece->reqarenapoints)
|
||||
|
|
@ -18535,9 +18536,9 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
|||
}
|
||||
|
||||
ModifyMoney( -(int32)price );
|
||||
if (crItem->ExtendedCost) // case for new honor system
|
||||
if (uint32 extendedCostId = crItem->GetExtendedCostId())
|
||||
{
|
||||
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
|
||||
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId);
|
||||
if (iece->reqhonorpoints)
|
||||
ModifyHonorPoints( - int32(iece->reqhonorpoints));
|
||||
if (iece->reqarenapoints)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue