Skip to content

Commit

Permalink
[9386] Store some config values in Rate emun.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDereka committed Feb 14, 2010
1 parent cd613b0 commit 7fff320
Show file tree
Hide file tree
Showing 33 changed files with 163 additions and 164 deletions.
14 changes: 7 additions & 7 deletions src/game/AchievementMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,17 +625,17 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)

MaNGOS::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID);
MaNGOS::LocalizedPacketDo<MaNGOS::AchievementChatBuilder> say_do(say_builder);
MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::AchievementChatBuilder> > say_worker(GetPlayer(),sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do);
MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::AchievementChatBuilder> > say_worker(GetPlayer(),sWorld.getRate(RATE_LISTEN_RANGE_SAY),say_do);
TypeContainerVisitor<MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::AchievementChatBuilder> >, WorldTypeMapContainer > message(say_worker);
cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY));
cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getRate(RATE_LISTEN_RANGE_SAY));
}

WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
data.append(GetPlayer()->GetPackGUID());
data << uint32(achievement->ID);
data << uint32(secsToTimeBitFields(time(NULL)));
data << uint32(0);
GetPlayer()->SendMessageToSetInRange(&data, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY), true);
GetPlayer()->SendMessageToSetInRange(&data, sWorld.getRate(RATE_LISTEN_RANGE_SAY), true);
}

void AchievementMgr::SendCriteriaUpdate(uint32 id, CriteriaProgress const* progress)
Expand Down Expand Up @@ -1900,7 +1900,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements()

uint32 count = 0;
uint32 disabled_count = 0;
barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());
do
{
bar.step();
Expand Down Expand Up @@ -2023,7 +2023,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
return;
}

barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());
do
{
bar.step();
Expand Down Expand Up @@ -2066,7 +2066,7 @@ void AchievementGlobalMgr::LoadRewards()
}

uint32 count = 0;
barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());

do
{
Expand Down Expand Up @@ -2176,7 +2176,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
return;
}

barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());

do
{
Expand Down
2 changes: 1 addition & 1 deletion src/game/AggressorAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ AggressorAI::UpdateAI(const uint32 /*diff*/)
bool
AggressorAI::IsVisible(Unit *pl) const
{
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_MONSTER))
return m_creature->IsWithinDist(pl,sWorld.getRate(RATE_SIGHT_MONSTER))
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/AuctionHouseMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void AuctionHouseMgr::LoadAuctionItems()
return;
}

barGoLink bar( result->GetRowCount() );
barGoLink bar( (int)result->GetRowCount() );

uint32 count = 0;

Expand Down
6 changes: 3 additions & 3 deletions src/game/BattleGroundMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
return;
}

barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());

do
{
Expand Down Expand Up @@ -2050,7 +2050,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
return;
}

barGoLink bar( result->GetRowCount() );
barGoLink bar( (int)result->GetRowCount() );

do
{
Expand Down Expand Up @@ -2148,7 +2148,7 @@ void BattleGroundMgr::LoadBattleEventIndexes()
return;
}

barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());

do
{
Expand Down
4 changes: 2 additions & 2 deletions src/game/ChatHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,9 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )

MaNGOS::EmoteChatBuilder emote_builder(*GetPlayer(), text_emote, emoteNum, unit);
MaNGOS::LocalizedPacketDo<MaNGOS::EmoteChatBuilder > emote_do(emote_builder);
MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::EmoteChatBuilder > > emote_worker(GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), emote_do);
MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::EmoteChatBuilder > > emote_worker(GetPlayer(), sWorld.getRate(RATE_LISTEN_RANGE_TEXTEMOTE), emote_do);
TypeContainerVisitor<MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::EmoteChatBuilder > >, WorldTypeMapContainer> message(emote_worker);
cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getRate(RATE_LISTEN_RANGE_TEXTEMOTE));

GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, text_emote, 0, unit);

Expand Down
4 changes: 2 additions & 2 deletions src/game/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ void Creature::DoFleeToGetAssistance()
if (!getVictim())
return;

float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
float radius = sWorld.getRate(RATE_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
if (radius >0)
{
Creature* pCreature = NULL;
Expand Down Expand Up @@ -1509,7 +1509,7 @@ void Creature::CallAssistance()
{
SetNoCallAssistance(true);

float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
float radius = sWorld.getRate(RATE_CREATURE_FAMILY_ASSISTANCE_RADIUS);
if(radius > 0)
{
std::list<Creature*> assistList;
Expand Down
2 changes: 1 addition & 1 deletion src/game/CreatureEventAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)

bool CreatureEventAI::IsVisible(Unit *pl) const
{
return m_creature->IsWithinDist(pl,(float)sWorld.getConfig(CONFIG_SIGHT_MONSTER))
return m_creature->IsWithinDist(pl,sWorld.getRate(RATE_SIGHT_MONSTER))
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
}

Expand Down
6 changes: 3 additions & 3 deletions src/game/CreatureEventAIMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use)
sLog.outString("Loading EventAI Texts additional data...");
if (result)
{
barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());
uint32 count = 0;

do
Expand Down Expand Up @@ -159,7 +159,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use)
QueryResult *result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
if (result)
{
barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());
uint32 Count = 0;

do
Expand Down Expand Up @@ -253,7 +253,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
"FROM creature_ai_scripts");
if (result)
{
barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());
uint32 Count = 0;

do
Expand Down
2 changes: 1 addition & 1 deletion src/game/GMTicketMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void GMTicketMgr::LoadGMTickets()
return;
}

barGoLink bar( result->GetRowCount() );
barGoLink bar( (int)result->GetRowCount() );

uint32 count = 0;

Expand Down
12 changes: 6 additions & 6 deletions src/game/GameEventMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void GameEventMgr::LoadFromDB()
uint32 count = 0;

{
barGoLink bar( result->GetRowCount() );
barGoLink bar( (int)result->GetRowCount() );
do
{
++count;
Expand Down Expand Up @@ -187,7 +187,7 @@ void GameEventMgr::LoadFromDB()
else
{

barGoLink bar( result->GetRowCount() );
barGoLink bar( (int)result->GetRowCount() );
do
{
Field *fields = result->Fetch();
Expand Down Expand Up @@ -233,7 +233,7 @@ void GameEventMgr::LoadFromDB()
else
{

barGoLink bar( result->GetRowCount() );
barGoLink bar( (int)result->GetRowCount() );
do
{
Field *fields = result->Fetch();
Expand Down Expand Up @@ -281,7 +281,7 @@ void GameEventMgr::LoadFromDB()
else
{

barGoLink bar( result->GetRowCount() );
barGoLink bar( (int)result->GetRowCount() );
do
{
Field *fields = result->Fetch();
Expand Down Expand Up @@ -338,7 +338,7 @@ void GameEventMgr::LoadFromDB()
else
{

barGoLink bar( result->GetRowCount() );
barGoLink bar( (int)result->GetRowCount() );
do
{
Field *fields = result->Fetch();
Expand Down Expand Up @@ -382,7 +382,7 @@ void GameEventMgr::LoadFromDB()
else
{

barGoLink bar2( result->GetRowCount() );
barGoLink bar2( (int)result->GetRowCount() );
do
{
Field *fields = result->Fetch();
Expand Down
14 changes: 7 additions & 7 deletions src/game/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
continue;
if ( i->AllowedForPlayer(member) )
{
if (member->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
if (member->IsWithinDist(creature, sWorld.getRate(RATE_GROUP_XP_DISTANCE), false))
{
r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
++r->totalPlayersRolling;
Expand Down Expand Up @@ -615,7 +615,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea

if (playerToRoll->CanUseItem(item) && i->AllowedForPlayer(playerToRoll) )
{
if (playerToRoll->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
if (playerToRoll->IsWithinDist(creature, sWorld.getRate(RATE_GROUP_XP_DISTANCE), false))
{
r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
++r->totalPlayersRolling;
Expand Down Expand Up @@ -663,7 +663,7 @@ void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creat
if (!looter->IsInWorld())
continue;

if (looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
if (looter->IsWithinDist(creature, sWorld.getRate(RATE_GROUP_XP_DISTANCE), false))
{
data << looter->GetGUID();
++real_count;
Expand All @@ -675,7 +675,7 @@ void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creat
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *looter = itr->getSource();
if (looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
if (looter->IsWithinDist(creature, sWorld.getRate(RATE_GROUP_XP_DISTANCE), false))
looter->GetSession()->SendPacket(&data);
}
}
Expand Down Expand Up @@ -1374,7 +1374,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
{
// not update if only update if need and ok
Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
if(looter && looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
if(looter && looter->IsWithinDist(creature, sWorld.getRate(RATE_GROUP_XP_DISTANCE), false))
return;
}
++guid_itr;
Expand All @@ -1387,7 +1387,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
{
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
{
if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
if (pl->IsWithinDist(creature, sWorld.getRate(RATE_GROUP_XP_DISTANCE), false))
{
bool refresh = pl->GetLootGUID() == creature->GetGUID();

Expand All @@ -1408,7 +1408,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
{
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
{
if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
if (pl->IsWithinDist(creature, sWorld.getRate(RATE_GROUP_XP_DISTANCE), false))
{
bool refresh = pl->GetLootGUID()==creature->GetGUID();

Expand Down
2 changes: 1 addition & 1 deletion src/game/GuardAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void GuardAI::UpdateAI(const uint32 /*diff*/)

bool GuardAI::IsVisible(Unit *pl) const
{
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_GUARDER))
return m_creature->IsWithinDist(pl,sWorld.getRate(RATE_SIGHT_GUARDER))
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/InstanceSaveMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void InstanceSaveManager::LoadResetTimes()
continue;

// the reset_delay must be at least one day
uint32 period = (mapDiff->resetTime / DAY * sWorld.getRate(RATE_INSTANCE_RESET_TIME)) * DAY;
uint32 period = uint32(mapDiff->resetTime / DAY * sWorld.getRate(RATE_INSTANCE_RESET_TIME)) * DAY;

time_t t = GetResetTimeFor(mapid,difficulty);
if(!t)
Expand Down
2 changes: 1 addition & 1 deletion src/game/ItemEnchantmentMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void LoadRandomEnchantmentsTable()

if (result)
{
barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());

do
{
Expand Down
2 changes: 1 addition & 1 deletion src/game/LootHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
Player* playerGroup = itr->getSource();
if(!playerGroup)
continue;
if (player->IsWithinDistInMap(playerGroup,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
if (player->IsWithinDistInMap(playerGroup,sWorld.getRate(RATE_GROUP_XP_DISTANCE),false))
playersNear.push_back(playerGroup);
}

Expand Down
4 changes: 2 additions & 2 deletions src/game/LootMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void LootStore::LoadLootTable()

if (result)
{
barGoLink bar(result->GetRowCount());
barGoLink bar((int)result->GetRowCount());

do
{
Expand Down Expand Up @@ -816,7 +816,7 @@ LootStoreItem const * LootTemplate::LootGroup::Roll() const
{
if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked
{
float Roll = rand_chance();
float Roll = rand_chance_f();

for (uint32 i=0; i<ExplicitlyChanced.size(); ++i) //check each explicitly chanced entry in the template and modify its chance based on quality.
{
Expand Down

0 comments on commit 7fff320

Please sign in to comment.