Core/Creatures: Implemented new extended cost requirements and fixed some items requiring too much honor/conquest points
This commit is contained in:
1 parent
3579942438
commit
21c42bf5a7
6 files changed
+126
-23
No files matched your search
@@ -21656,6 +21656,9 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
|
||||
|
||||
for (int i = 0; i < MAX_ITEM_EXT_COST_CURRENCIES; ++i)
|
||||
{
|
||||
if (iece->RequirementFlags & (ITEM_EXT_COST_CURRENCY_REQ_IS_SEASON_EARNED_1 << i))
|
||||
continue;
|
||||
|
||||
if (iece->RequiredCurrency[i])
|
||||
ModifyCurrency(iece->RequiredCurrency[i], -int32(iece->RequiredCurrencyCount[i] * stacks), true, true);
|
||||
}
|
||||
@@ -21774,7 +21777,13 @@ bool Player::BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uin
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HasCurrency(iece->RequiredCurrency[i], (iece->RequiredCurrencyCount[i] * stacks)))
|
||||
if (iece->RequirementFlags & (ITEM_EXT_COST_CURRENCY_REQ_IS_SEASON_EARNED_1 << i))
|
||||
{
|
||||
// Not implemented
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
}
|
||||
else if (!HasCurrency(iece->RequiredCurrency[i], (iece->RequiredCurrencyCount[i] * stacks)))
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
@@ -21788,6 +21797,30 @@ bool Player::BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uin
|
||||
SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, NULL, NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iece->RequiredFactionId && GetReputationRank(iece->RequiredFactionId) < iece->RequiredFactionStanding)
|
||||
{
|
||||
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, currency, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iece->RequirementFlags & ITEM_EXT_COST_FLAG_REQUIRE_GUILD && !GetGuildId())
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iece->RequiredGuildLevel && iece->RequiredGuildLevel < GetGuildLevel())
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iece->RequiredAchievement && !HasAchieved(iece->RequiredAchievement))
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else // currencies have no price defined, can only be bought with ExtendedCost
|
||||
{
|
||||
@@ -21811,6 +21844,9 @@ bool Player::BuyCurrencyFromVendorSlot(uint64 vendorGuid, uint32 vendorSlot, uin
|
||||
if (!iece->RequiredCurrency[i])
|
||||
continue;
|
||||
|
||||
if (iece->RequirementFlags & (ITEM_EXT_COST_CURRENCY_REQ_IS_SEASON_EARNED_1 << i))
|
||||
continue;
|
||||
|
||||
ModifyCurrency(iece->RequiredCurrency[i], -int32(iece->RequiredCurrencyCount[i]) * stacks, false, true);
|
||||
}
|
||||
}
|
||||
@@ -21921,7 +21957,12 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HasCurrency(iece->RequiredCurrency[i], iece->RequiredCurrencyCount[i] * stacks))
|
||||
if (iece->RequirementFlags & (ITEM_EXT_COST_CURRENCY_REQ_IS_SEASON_EARNED_1 << i))
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
}
|
||||
else if (!HasCurrency(iece->RequiredCurrency[i], iece->RequiredCurrencyCount[i] * stacks))
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL);
|
||||
return false;
|
||||
@@ -21935,6 +21976,30 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||
SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, NULL, NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iece->RequiredFactionId && GetReputationRank(iece->RequiredFactionId) < iece->RequiredFactionStanding)
|
||||
{
|
||||
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iece->RequirementFlags & ITEM_EXT_COST_FLAG_REQUIRE_GUILD && !GetGuildId())
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iece->RequiredGuildLevel && iece->RequiredGuildLevel < GetGuildLevel())
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iece->RequiredAchievement && !HasAchieved(iece->RequiredAchievement))
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); // Find correct error
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 price = 0;
|
||||
@@ -26610,6 +26675,13 @@ void Player::SendRefundInfo(Item* item)
|
||||
data.WriteByteSeq(guid[2]);
|
||||
for (uint8 i = 0; i < MAX_ITEM_EXT_COST_CURRENCIES; ++i) // currency cost data
|
||||
{
|
||||
if (iece->RequirementFlags & (ITEM_EXT_COST_CURRENCY_REQ_IS_SEASON_EARNED_1 << i))
|
||||
{
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
CurrencyTypesEntry const* currencyType = sCurrencyTypesStore.LookupEntry(iece->RequiredCurrency[i]);
|
||||
uint32 precision = (currencyType && currencyType->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1;
|
||||
|
||||
@@ -26667,6 +26739,13 @@ void Player::SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece,
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ITEM_EXT_COST_CURRENCIES; ++i)
|
||||
{
|
||||
if (iece->RequirementFlags & (ITEM_EXT_COST_CURRENCY_REQ_IS_SEASON_EARNED_1 << i))
|
||||
{
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
CurrencyTypesEntry const* currencyType = sCurrencyTypesStore.LookupEntry(iece->RequiredCurrency[i]);
|
||||
uint32 precision = (currencyType && currencyType->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1;
|
||||
|
||||
@@ -26780,6 +26859,9 @@ void Player::RefundItem(Item* item)
|
||||
// Grant back currencies
|
||||
for (uint8 i = 0; i < MAX_ITEM_EXT_COST_CURRENCIES; ++i)
|
||||
{
|
||||
if (iece->RequirementFlags & (ITEM_EXT_COST_CURRENCY_REQ_IS_SEASON_EARNED_1 << i))
|
||||
continue;
|
||||
|
||||
uint32 count = iece->RequiredCurrencyCount[i];
|
||||
uint32 currencyid = iece->RequiredCurrency[i];
|
||||
if (count && currencyid)
|
||||
|
||||
Reference in new issue
Block a user