Core/Spells: defined and implemented SPELL_AURA_MOD_CURRENCY_CATEGORY_GAIN_PCT

This commit is contained in:
Ovahlord committed 2021-04-30 13:42:04 +02:00
1 parent c764cce4a3
commit b328cc10b8
3 files changed
+11 -4

No files matched your search

+9 -2
View File
@@ -120,6 +120,8 @@ void Loot::AddItem(LootStoreItem const& item)
std::vector<LootItem>& lootItems = item.needs_quest ? quest_items : items;
uint32 limit = item.needs_quest ? MAX_NR_QUEST_ITEMS : MAX_NR_LOOT_ITEMS;
Player* player = ObjectAccessor::FindPlayer(lootOwnerGUID);
if (item.is_currency)
{
CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(item.itemid);
@@ -128,6 +130,11 @@ void Loot::AddItem(LootStoreItem const& item)
uint32 totalCap = currency->MaxQty > 0 ? currency->MaxQty : 1;
uint32 count = urand(item.mincount, item.maxcount);
// SPELL_AURA_MOD_CURRENCY_CATEGORY_GAIN_PCT bonus
if (player)
count *= player->GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_CURRENCY_CATEGORY_GAIN_PCT, currency->CategoryID);
uint32 stacks = count / totalCap + ((count % totalCap) ? 1 : 0);
for (uint32 i = 0; i < stacks && lootItems.size() < limit; ++i)
@@ -139,7 +146,7 @@ void Loot::AddItem(LootStoreItem const& item)
// In some cases, a dropped item should be visible/lootable only for some players in group
bool canSeeItemInLootWindow = false;
if (Player* player = ObjectAccessor::FindPlayer(lootOwnerGUID))
if (player)
{
if (Group* group = player->GetGroup())
{
@@ -178,7 +185,7 @@ void Loot::AddItem(LootStoreItem const& item)
// In some cases, a dropped item should be visible/lootable only for some players in group
bool canSeeItemInLootWindow = false;
if (Player* player = ObjectAccessor::FindPlayer(lootOwnerGUID))
if (player)
{
if (Group* group = player->GetGroup())
{
@@ -426,7 +426,7 @@ enum AuraType : uint32
SPELL_AURA_DEPOSIT_BONUS_MONEY_IN_GUILD_BANK_ON_LOOT = 348,
SPELL_AURA_MOD_CURRENCY_GAIN = 349,
SPELL_AURA_MOD_GATHERING_ITEMS_GAINED_PERCENT = 350, // NYI
SPELL_AURA_351 = 351,
SPELL_AURA_MOD_CURRENCY_CATEGORY_GAIN_PCT = 351,
SPELL_AURA_352 = 352,
SPELL_AURA_MOD_CAMOUFLAGE = 353, // NYI
SPELL_AURA_MOD_HEALING_DONE_PCT_VERSUS_TARGET_HEALTH = 354, // Restoration Shaman mastery - mod healing based on target's health (less = more healing)
@@ -416,7 +416,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //348 SPELL_AURA_DEPOSIT_BONUS_MONEY_IN_GUILD_BANK_ON_LOOT implemented in WorldSession::HandleLootMoneyOpcode
&AuraEffect::HandleNoImmediateEffect, //349 SPELL_AURA_MOD_CURRENCY_GAIN implemented in Player::ModifyCurrency
&AuraEffect::HandleNULL, //350 SPELL_AURA_MOD_GATHERING_ITEMS_GAINED_PERCENT
&AuraEffect::HandleNULL, //351 SPELL_AURA_351
&AuraEffect::HandleNoImmediateEffect, //351 SPELL_AURA_MOD_CURRENCY_CATEGORY_GAIN_PCT implemented Loot::AddItem
&AuraEffect::HandleNULL, //352 SPELL_AURA_352
&AuraEffect::HandleNULL, //353 SPELL_AURA_MOD_CAMOUFLAGE
&AuraEffect::HandleNoImmediateEffect, //354 SPELL_AURA_MOD_HEALING_FROM_TARGET_HEALTH implemented in Unit::SpellHealingPctDone