mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Speedup check in Player::HasQuestForItem and Player::HasQuestForGO, related cleanups.
This commit is contained in:
parent
58f2c540bf
commit
e7fc5e390b
2 changed files with 33 additions and 16 deletions
|
|
@ -5847,7 +5847,7 @@ bool Player::ModifyOneFactionReputation(FactionEntry const* factionEntry, int32
|
|||
|
||||
SetFactionVisible(&itr->second);
|
||||
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
{
|
||||
if(uint32 questid = GetQuestSlotQuestId(i))
|
||||
{
|
||||
|
|
@ -13381,7 +13381,7 @@ void Player::AdjustQuestReqItemCount( Quest const* pQuest, QuestStatusData& ques
|
|||
|
||||
uint16 Player::FindQuestSlot( uint32 quest_id ) const
|
||||
{
|
||||
for ( uint16 i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
|
||||
for ( uint16 i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
if ( GetQuestSlotQuestId(i) == quest_id )
|
||||
return i;
|
||||
|
||||
|
|
@ -13429,7 +13429,7 @@ void Player::GroupEventHappens( uint32 questId, WorldObject const* pEventObject
|
|||
|
||||
void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
|
||||
{
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
{
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
if ( questid == 0 )
|
||||
|
|
@ -13471,7 +13471,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
|
|||
|
||||
void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
|
||||
{
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
{
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
if(!questid)
|
||||
|
|
@ -13514,7 +13514,7 @@ void Player::KilledMonster( uint32 entry, uint64 guid )
|
|||
{
|
||||
uint32 addkillcount = 1;
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, entry, addkillcount);
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
{
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
if(!questid)
|
||||
|
|
@ -13569,7 +13569,7 @@ void Player::CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id )
|
|||
bool isCreature = IS_CREATURE_GUID(guid);
|
||||
|
||||
uint32 addCastCount = 1;
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
|
||||
{
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
if(!questid)
|
||||
|
|
@ -13636,7 +13636,7 @@ void Player::CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id )
|
|||
void Player::TalkedToCreature( uint32 entry, uint64 guid )
|
||||
{
|
||||
uint32 addTalkCount = 1;
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
{
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
if(!questid)
|
||||
|
|
@ -13691,7 +13691,7 @@ void Player::TalkedToCreature( uint32 entry, uint64 guid )
|
|||
|
||||
void Player::MoneyChanged( uint32 count )
|
||||
{
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
{
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
if (!questid)
|
||||
|
|
@ -13721,13 +13721,21 @@ void Player::MoneyChanged( uint32 count )
|
|||
|
||||
bool Player::HasQuestForItem( uint32 itemid ) const
|
||||
{
|
||||
for( QuestStatusMap::const_iterator i = mQuestStatus.begin( ); i != mQuestStatus.end( ); ++i )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
{
|
||||
QuestStatusData const& q_status = i->second;
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
if ( questid == 0 )
|
||||
continue;
|
||||
|
||||
QuestStatusMap::const_iterator qs_itr = mQuestStatus.find(questid);
|
||||
if(qs_itr == mQuestStatus.end())
|
||||
continue;
|
||||
|
||||
QuestStatusData const& q_status = qs_itr->second;
|
||||
|
||||
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
Quest const* qinfo = objmgr.GetQuestTemplate(i->first);
|
||||
Quest const* qinfo = objmgr.GetQuestTemplate(questid);
|
||||
if(!qinfo)
|
||||
continue;
|
||||
|
||||
|
|
@ -18535,14 +18543,23 @@ bool Player::IsSpellFitByClassAndRace( uint32 spell_id ) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Player::HasQuestForGO(int32 GOId)
|
||||
bool Player::HasQuestForGO(int32 GOId) const
|
||||
{
|
||||
for( QuestStatusMap::iterator i = mQuestStatus.begin( ); i != mQuestStatus.end( ); ++i )
|
||||
for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
|
||||
{
|
||||
QuestStatusData qs=i->second;
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
if ( questid == 0 )
|
||||
continue;
|
||||
|
||||
QuestStatusMap::const_iterator qs_itr = mQuestStatus.find(questid);
|
||||
if(qs_itr == mQuestStatus.end())
|
||||
continue;
|
||||
|
||||
QuestStatusData const& qs = qs_itr->second;
|
||||
|
||||
if (qs.m_status == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
Quest const* qinfo = objmgr.GetQuestTemplate(i->first);
|
||||
Quest const* qinfo = objmgr.GetQuestTemplate(questid);
|
||||
if(!qinfo)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue