diff options
author | Tuxity <kevin.darcel@gmail.com> | 2013-01-10 14:18:14 +0100 |
---|---|---|
committer | Tuxity <kevin.darcel@gmail.com> | 2013-01-10 14:18:14 +0100 |
commit | 2f48fe7cf1b2a9ac00bff2e9694b52764f2c62c4 (patch) | |
tree | 913affc4858fe13fafa57b9f0d05d2a6f1f64926 /src | |
parent | 3c8a9576923d226386578f6e7eba07b9e7bbc2e5 (diff) |
Core/Currency:
- Fix a typo in conquest points formulas
- Correctly fix max justice and honor points
- Remove a previous fix when refunding an item, my mistake
ref #8892
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 47 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 8 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/Formulas.h | 5 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 14 | ||||
-rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 64 |
5 files changed, 83 insertions, 55 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 117b461e6b6..c688bfd95f9 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7437,6 +7437,11 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo if (weekCap && count > int32(weekCap)) count = weekCap; + // count can't be more then totalCap if used (totalCap > 0) + uint32 totalCap = _GetCurrencyTotalCap(currency); + if (totalCap && count > int32(totalCap)) + count = totalCap; + int32 newTotalCount = int32(oldTotalCount) + count; if (newTotalCount < 0) newTotalCount = 0; @@ -7445,20 +7450,18 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo if (newWeekCount < 0) newWeekCount = 0; - ASSERT(weekCap >= oldWeekCount); - // if we get more then weekCap just set to limit if (weekCap && int32(weekCap) < newWeekCount) { newWeekCount = int32(weekCap); - // weekCap - oldWeekCount alwayt >= 0 as we set limit before! + // weekCap - oldWeekCount always >= 0 as we set limit before! newTotalCount = oldTotalCount + (weekCap - oldWeekCount); } // if we get more then totalCap set to maximum; - if (currency->TotalCap && int32(currency->TotalCap) < newTotalCount) + if (totalCap && int32(totalCap) < newTotalCount) { - newTotalCount = int32(currency->TotalCap); + newTotalCount = int32(totalCap); newWeekCount = weekCap; } @@ -7571,10 +7574,29 @@ uint32 Player::_GetCurrencyWeekCap(const CurrencyTypesEntry* currency) const return _ConquestCurrencyTotalWeekCap; case CURRENCY_TYPE_CONQUEST_META_ARENA: // should add precision mod = 100 - return Trinity::Currency::ConquestRatingCalculator(_maxPersonalArenaRate) * 100; + return Trinity::Currency::ConquestRatingCalculator(_maxPersonalArenaRate) * CURRENCY_PRECISION; case CURRENCY_TYPE_CONQUEST_META_BG: // should add precision mod = 100 - return Trinity::Currency::BgConquestRatingCalculator(GetRBGPersonalRating()) * 100; + return Trinity::Currency::BgConquestRatingCalculator(GetRBGPersonalRating()) * CURRENCY_PRECISION; + } + + if (cap != currency->WeekCap && IsInWorld() && !GetSession()->PlayerLoading()) + { + WorldPacket packet(SMSG_UPDATE_CURRENCY_WEEK_LIMIT, 8); + packet << uint32(cap / ((currency->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? 100 : 1)); + packet << uint32(currency->ID); + GetSession()->SendPacket(&packet); + } + + return cap; +} + +uint32 Player::_GetCurrencyTotalCap(const CurrencyTypesEntry* currency) const +{ + uint32 cap = currency->TotalCap; + + switch (currency->ID) + { case CURRENCY_TYPE_HONOR_POINTS: { uint32 honorcap = sWorld->getIntConfig(CONFIG_CURRENCY_MAX_HONOR_POINTS); @@ -7591,16 +7613,7 @@ uint32 Player::_GetCurrencyWeekCap(const CurrencyTypesEntry* currency) const } } - if (cap != currency->WeekCap && IsInWorld() && !GetSession()->PlayerLoading()) - { - WorldPacket packet(SMSG_UPDATE_CURRENCY_WEEK_LIMIT, 8); - packet << uint32(cap / ((currency->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? 100 : 1)); - packet << uint32(currency->ID); - GetSession()->SendPacket(&packet); - } - return cap; - } void Player::SetInGuild(uint32 guildId) @@ -26152,7 +26165,7 @@ void Player::RefundItem(Item* item) uint32 count = iece->RequiredCurrencyCount[i]; uint32 currencyid = iece->RequiredCurrency[i]; if (count && currencyid) - ModifyCurrency(currencyid, count / CURRENCY_PRECISION); + ModifyCurrency(currencyid, count); } // Grant back money diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index ddff890bb6f..b6fc1599ce0 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2935,6 +2935,14 @@ class Player : public Unit, public GridObject<Player> */ uint32 _GetCurrencyWeekCap(const CurrencyTypesEntry* currency) const; + /* + * @name _GetCurrencyTotalCap + * @brief return total cap for selected currency + + * @param currency CurrencyTypesEntry witch should get week cap + */ + uint32 _GetCurrencyTotalCap(const CurrencyTypesEntry* currency) const; + VoidStorageItem* _voidStorageItems[VOID_STORAGE_MAX_SLOT]; std::vector<Item*> m_itemUpdateQueue; diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index 3675e633bad..8ae333f2651 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -235,13 +235,14 @@ namespace Trinity rate = 3000; // http://www.arenajunkies.com/topic/179536-conquest-point-cap-vs-personal-rating-chart/page__st__60#entry3085246 - return 1.4326 * ((1511.26 / (1 + 1639.28 / exp(0.00412 * rate))) + 850.15); + return uint32(1.4326 * ((1511.26 / (1 + 1639.28 / exp(0.00412 * rate))) + 850.15)); } inline uint32 BgConquestRatingCalculator(uint32 rate) { // WowWiki: Battleground ratings receive a bonus of 22.2% to the cap they generate - return ConquestRatingCalculator(rate)*1.222f; + printf("%u",uint32(round(ConquestRatingCalculator(rate) * 1.222f))); + return uint32(round(ConquestRatingCalculator(rate) * 1.222f)); } } // namespace Trinity::Currency } // namespace Trinity diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index b4d2e7933d2..215e9bb629b 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -808,12 +808,13 @@ void World::LoadConfigSettings(bool reload) sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.StartHonorPoints (%i) must be >= 0, set to default 0.", m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS]); m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS] = 0; } - m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("Currency.MaxHonorPoints", 400000); + m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("Currency.MaxHonorPoints", 4000); if (int32(m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS]) < 0) { - sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.MaxHonorPoints (%i) can't be negative. Set to default 400000 (with precision).", m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS]); - m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] = 400000; + sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.MaxHonorPoints (%i) can't be negative. Set to default 4000.", m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS]); + m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] = 4000; } + m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] *= 100; //precision mod m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS] = ConfigMgr::GetIntDefault("Currency.StartJusticePoints", 0); if (int32(m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS]) < 0) @@ -821,12 +822,13 @@ void World::LoadConfigSettings(bool reload) sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.StartJusticePoints (%i) must be >= 0, set to default 0.", m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS]); m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS] = 0; } - m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] = ConfigMgr::GetIntDefault("Currency.MaxJusticePoints", 400000); + m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] = ConfigMgr::GetIntDefault("Currency.MaxJusticePoints", 4000); if (int32(m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS]) < 0) { - sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.MaxJusticePoints (%i) can't be negative. Set to default 400000 (with precision).", m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS]); - m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] = 400000; + sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.MaxJusticePoints (%i) can't be negative. Set to default 4000.", m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS]); + m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] = 4000; } + m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] *= 100; //precision mod m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS] = ConfigMgr::GetIntDefault("Currency.StartConquestPoints", 0); if (int32(m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS]) < 0) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 22f99dbb04c..f32633958ec 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2857,8 +2857,33 @@ Guild.WeeklyReputationCap = 4375 ################################################################################################### ################################################################################################### +# # CURRENCIES SETTINGS # +# Currency.ResetInterval +# How often should currency week count reset (days) +# Default: 7 (weekly) +# + +Currency.ResetInterval = 7 + +# +# Currency.ResetWeekDay +# Week day when currency week count is reset (0..6) 0 == Sunday +# Default: 3 (Wednesday) +# + +Currency.ResetWeekDay = 3 + +# +# Currency.ResetHour +# Hour of a day when currency week count is reset (0..23) +# Default: 6 +# + +Currency.ResetHour = 6 + +# # Currency.StartHonorPoints # Amount of honor points that new players will start with # Default: 0 (with precision) @@ -2866,13 +2891,15 @@ Guild.WeeklyReputationCap = 4375 Currency.StartHonorPoints = 0 +# # Currency.MaxHonorPoints -# Max honor points of players -# Default: 400000 (with precision) +# Amount honor points a player can have +# Default: 4000 # -Currency.MaxHonorPoints = 400000 +Currency.MaxHonorPoints = 4000 +# # Currency.StartJusticePoints # Amount of justice points that new players will start with # Default: 0 (with precision) @@ -2880,12 +2907,13 @@ Currency.MaxHonorPoints = 400000 Currency.StartJusticePoints = 0 +# # Currency.MaxJusticePoints -# Max justice points of players -# Default: 400000 (with precision) +# Amount honor points a player can have +# Default: 4000 # -Currency.MaxJusticePoints = 400000 +Currency.MaxJusticePoints = 4000 # # Currency.StartConquestPoints @@ -2896,30 +2924,6 @@ Currency.MaxJusticePoints = 400000 Currency.StartConquestPoints = 0 # -# Currency.ResetInterval -# How often should currency week count reset (days) -# Default: 7 (weekly) -# - -Currency.ResetInterval = 7 - -# -# Currency.ResetWeekDay -# Week day when currency week count is reset (0..6) 0 == Sunday -# Default: 3 (Wednesday) -# - -Currency.ResetWeekDay = 3 - -# -# Currency.ResetHour -# Hour of a day when currency week count is reset (0..23) -# Default: 6 -# - -Currency.ResetHour = 6 - -# # Currency.ConquestPointsDefaultWeekCap # Amount of conquest points that player can earn per week # Default: 1350 |