Skip to content

Commit

Permalink
[c12512] Implement SPELL_AURA_MOD_CURRENCY_GAIN
Browse files Browse the repository at this point in the history
Signed-off-by: Dramacydal <PulLumBerMal@gmail.com>
  • Loading branch information
Dramacydal committed Feb 24, 2013
1 parent 8e710b8 commit baa6383
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
15 changes: 9 additions & 6 deletions src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19532,11 +19532,11 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot,
if (crItem->ExtendedCost)
TakeExtendedCost(crItem->ExtendedCost, count);

ModifyCurrencyCount(currencyId, crItem->maxcount, true, false);
ModifyCurrencyCount(currencyId, crItem->maxcount, true, false, true);


DEBUG_LOG("WORLD: BuyCurrencyFromVendorSlot - %s: Player %s buys currency %u amount %u count %u.",
vendorGuid.GetString().c_str(), GetGuidStr().c_str(), currencyId, crItem->maxcount, count);
vendorGuid.GetString().c_str(), GetGuidStr().c_str(), currencyId, crItem->maxcount, count);

This comment has been minimized.

Copy link
@DomGries

DomGries Feb 24, 2013

Contributor

no point changing existing coding style as those whitespaces are automatically generated by our cleanup tools and will be reverted in the next run

This comment has been minimized.

Copy link
@Dramacydal

Dramacydal Feb 24, 2013

Author Member

ok, but that whitespace was generated by me long time ago)

This comment has been minimized.

Copy link
@VladimirMangos

VladimirMangos Mar 4, 2013

Member

)


return true;
}
Expand Down Expand Up @@ -23613,11 +23613,14 @@ uint32 Player::GetCurrencyWeekCount(uint32 id) const
return itr != m_currencies.end() ? itr->second.weekCount : 0;
}

void Player::ModifyCurrencyCount(uint32 id, int32 count, bool modifyWeek, bool modifySeason)
void Player::ModifyCurrencyCount(uint32 id, int32 count, bool modifyWeek, bool modifySeason, bool ignoreMultipliers)
{
if (!count)
return;

if (!ignoreMultipliers && count > 0)
count *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_CURRENCY_GAIN, id);

CurrencyTypesEntry const * currency = NULL;

int32 oldTotalCount = 0;
Expand Down Expand Up @@ -23657,7 +23660,7 @@ void Player::ModifyCurrencyCount(uint32 id, int32 count, bool modifyWeek, bool m
newWeekCount = 0;

int32 totalCap = GetCurrencyTotalCap(currency);
if (totalCap && int32(totalCap) < newTotalCount)
if (totalCap && totalCap < newTotalCount)
{
int32 delta = newTotalCount - totalCap;
newTotalCount = totalCap;
Expand Down Expand Up @@ -23718,13 +23721,13 @@ void Player::ModifyCurrencyCount(uint32 id, int32 count, bool modifyWeek, bool m
}

if (itr->first == CURRENCY_CONQUEST_ARENA_META || itr->first == CURRENCY_CONQUEST_BG_META)
ModifyCurrencyCount(CURRENCY_CONQUEST_POINTS, diff, modifyWeek);
ModifyCurrencyCount(CURRENCY_CONQUEST_POINTS, diff, modifyWeek, ignoreMultipliers);
}
}

void Player::SetCurrencyCount(uint32 id, uint32 count)
{
ModifyCurrencyCount(id, int32(count) - GetCurrencyCount(id));
ModifyCurrencyCount(id, int32(count) - GetCurrencyCount(id), false, false, true);
}

void Player::_LoadCurrencies(QueryResult* result)
Expand Down
2 changes: 1 addition & 1 deletion src/game/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 GetCurrencySeasonCount(uint32 id) const;
uint32 GetCurrencyWeekCount(uint32 id) const;
void SendCurrencies() const;
void ModifyCurrencyCount(uint32 id, int32 count, bool modifyWeek = true, bool modifySeason = true);
void ModifyCurrencyCount(uint32 id, int32 count, bool modifyWeek = true, bool modifySeason = true, bool ignoreMultipliers = false);
bool HasCurrencyCount(uint32 id, uint32 count) const { return GetCurrencyCount(id) >= count; }
bool HasCurrencySeasonCount(uint32 id, uint32 count) const { return GetCurrencySeasonCount(id) >= count; }
void SetCurrencyCount(uint32 id, uint32 count);
Expand Down
2 changes: 1 addition & 1 deletion src/game/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS] =
&Aura::HandleNULL, //346 32 spells in 4.3.4 shows progressbar-like ui?
&Aura::HandleNULL, //347 SPELL_AURA_MOD_CD_FROM_HASTE 2 spells in 4.3.4
&Aura::HandleNULL, //348 SPELL_AURA_MOD_MONEY_TO_GUILD_BANK 2 spells in 4.3.4
&Aura::HandleNULL, //349 SPELL_AURA_MOD_CURRENCY_GAIN 16 spells in 4.3.4
&Aura::HandleNoImmediateEffect, //349 SPELL_AURA_MOD_CURRENCY_GAIN 16 spells in 4.3.4
&Aura::HandleNULL, //350 SPELL_AURA_MOD_MATERIAL_GAIN 1 spells in 4.3.4
&Aura::HandleNULL, //351 8 spells in 4.3.4 archaeology-related
&Aura::HandleNULL, //352 SPELL_AURA_ALLOW_WORGEN_TRANSFORM 1 spells in 4.3.4 enables worgen<>human form switches
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12511"
#define REVISION_NR "12512"
#endif // __REVISION_NR_H__

0 comments on commit baa6383

Please sign in to comment.