Core/Players: moved area exploration to a own helper

This commit is contained in:
Ovahlord committed 2022-12-31 16:19:40 +01:00
1 parent 29c070b0fe
commit e6103dae3e
2 files changed
+11 -5

No files matched your search

+10 -5
View File
@@ -6022,6 +6022,11 @@ void Player::CheckAreaExploreAndOutdoor()
RemoveAurasWithAttribute(SPELL_ATTR0_ONLY_OUTDOORS);
uint32 const areaId = GetAreaId();
SetAreaExplored(areaId);
}
void Player::SetAreaExplored(uint32 areaId)
{
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
if (!areaEntry)
@@ -6059,7 +6064,7 @@ void Player::CheckAreaExploreAndOutdoor()
uint32 XP;
if (diff < -5)
{
XP = uint32(sObjectMgr->GetBaseXP(getLevel()+5)*sWorld->getRate(RATE_XP_EXPLORE));
XP = uint32(sObjectMgr->GetBaseXP(getLevel() + 5) * sWorld->getRate(RATE_XP_EXPLORE));
}
else if (diff > 5)
{
@@ -6067,23 +6072,23 @@ void Player::CheckAreaExploreAndOutdoor()
if (exploration_percent < 0)
exploration_percent = 0;
XP = uint32(sObjectMgr->GetBaseXP(areaEntry->ExplorationLevel)*exploration_percent/100*sWorld->getRate(RATE_XP_EXPLORE));
XP = uint32(sObjectMgr->GetBaseXP(areaEntry->ExplorationLevel) * exploration_percent / 100 * sWorld->getRate(RATE_XP_EXPLORE));
}
else
{
XP = uint32(sObjectMgr->GetBaseXP(areaEntry->ExplorationLevel)*sWorld->getRate(RATE_XP_EXPLORE));
XP = uint32(sObjectMgr->GetBaseXP(areaEntry->ExplorationLevel) * sWorld->getRate(RATE_XP_EXPLORE));
}
if (sWorld->getIntConfig(CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO))
{
uint32 minScaledXP = uint32(sObjectMgr->GetBaseXP(areaEntry->ExplorationLevel)*sWorld->getRate(RATE_XP_EXPLORE)) * sWorld->getIntConfig(CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO) / 100;
uint32 minScaledXP = uint32(sObjectMgr->GetBaseXP(areaEntry->ExplorationLevel) * sWorld->getRate(RATE_XP_EXPLORE)) * sWorld->getIntConfig(CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO) / 100;
XP = std::max(minScaledXP, XP);
}
GiveXP(XP, nullptr);
SendExplorationExperience(areaId, XP);
}
TC_LOG_DEBUG("entities.player", "Player '%s' (%s) discovered a new area: %u", GetName().c_str(),GetGUID().ToString().c_str(), areaId);
TC_LOG_DEBUG("entities.player", "Player '%s' (%s) discovered a new area: %u", GetName().c_str(), GetGUID().ToString().c_str(), areaId);
}
}
}