diff options
Diffstat (limited to 'src')
176 files changed, 4793 insertions, 4793 deletions
diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index c6fb9a18fca..090bdaa2720 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -224,7 +224,7 @@ bool AccountMgr::normalizeString(std::string& utf8str) if (!Utf8toWStr(utf8str,wstr_buf,wstr_len)) return false; - std::transform( &wstr_buf[0], wstr_buf+wstr_len, &wstr_buf[0], wcharToUpperOnlyLatin ); + std::transform(&wstr_buf[0], wstr_buf+wstr_len, &wstr_buf[0], wcharToUpperOnlyLatin); return WStrToUtf8(wstr_buf,wstr_len,utf8str); } diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index dd2ad673d54..428bb46d39c 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -77,7 +77,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) { if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE) { - sLog.outErrorDb( "Table `achievement_criteria_data` for criteria (Entry: %u) have wrong data type (%u), ignore.", criteria->ID,dataType); + sLog.outErrorDb("Table `achievement_criteria_data` for criteria (Entry: %u) have wrong data type (%u), ignore.", criteria->ID,dataType); return false; } @@ -101,7 +101,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT: break; default: - sLog.outErrorDb( "Table `achievement_criteria_data` have data for not supported criteria type (Entry: %u Type: %u), ignore.", criteria->ID, criteria->requiredType); + sLog.outErrorDb("Table `achievement_criteria_data` have data for not supported criteria type (Entry: %u Type: %u), ignore.", criteria->ID, criteria->requiredType); return false; } @@ -115,7 +115,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE: if (!creature.id || !objmgr.GetCreatureTemplate(creature.id)) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed creature id in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed creature id in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,creature.id); return false; } @@ -123,19 +123,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE: if (!classRace.class_id && !classRace.race_id) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE (%u) must have not 0 in one from value fields, ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE (%u) must have not 0 in one from value fields, ignore.", criteria->ID, criteria->requiredType,dataType); return false; } if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE)==0) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed class in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed class in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,classRace.class_id); return false; } if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE)==0) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed race in value2 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed race in value2 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,classRace.race_id); return false; } @@ -143,7 +143,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH: if (health.percent < 1 || health.percent > 100) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) have wrong percent value in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) have wrong percent value in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,health.percent); return false; } @@ -151,7 +151,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD: if (player_dead.own_team_flag > 1) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) have wrong boolean value1 (%u).", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) have wrong boolean value1 (%u).", criteria->ID, criteria->requiredType,dataType,player_dead.own_team_flag); return false; } @@ -162,19 +162,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) SpellEntry const* spellEntry = sSpellStore.LookupEntry(aura.spell_id); if (!spellEntry) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong spell id in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong spell id in value1 (%u), ignore.", criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.spell_id); return false; } if (aura.effect_idx >= 3) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong spell effect index in value2 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong spell effect index in value2 (%u), ignore.", criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.effect_idx); return false; } if (!spellEntry->EffectApplyAuraName[aura.effect_idx]) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have non-aura spell effect (ID: %u Effect: %u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have non-aura spell effect (ID: %u Effect: %u), ignore.", criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.spell_id,aura.effect_idx); return false; } @@ -183,7 +183,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA: if (!GetAreaEntryByAreaID(area.id)) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) have wrong area id in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) have wrong area id in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,area.id); return false; } @@ -191,7 +191,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL: if (level.minlevel < 0 || level.minlevel > STRONG_MAX_LEVEL) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) have wrong minlevel in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) have wrong minlevel in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,level.minlevel); return false; } @@ -199,7 +199,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER: if (gender.gender > GENDER_NONE) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) have wrong gender in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) have wrong gender in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,gender.gender); return false; } @@ -207,7 +207,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY: if (difficulty.difficulty >= MAX_DIFFICULTY) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) have wrong difficulty in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) have wrong difficulty in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,difficulty.difficulty); return false; } @@ -215,7 +215,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT: if (map_players.maxcount <= 0) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) have wrong max players count in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) have wrong max players count in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,map_players.maxcount); return false; } @@ -223,7 +223,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM: if (team.team != ALLIANCE && team.team != HORDE) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) have unknown team in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) have unknown team in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,team.team); return false; } @@ -231,7 +231,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK: if (drunk.state >= MAX_DRUNKEN) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) have unknown drunken state in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) have unknown drunken state in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,drunk.state); return false; } @@ -239,7 +239,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY: if (!sHolidaysStore.LookupEntry(holiday.id)) { - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) have unknown holiday in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) have unknown holiday in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,holiday.id); return false; } @@ -249,13 +249,13 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM: if (equipped_item.item_quality >= MAX_ITEM_QUALITY) { - sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) have unknown quality state in value1 (%u), ignore.", + sLog.outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) have unknown quality state in value1 (%u), ignore.", criteria->ID, criteria->requiredType,dataType,equipped_item.item_quality); return false; } return true; default: - sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) have data for not supported data type (%u), ignore.", criteria->ID, criteria->requiredType,dataType); + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) have data for not supported data type (%u), ignore.", criteria->ID, criteria->requiredType,dataType); return false; } return false; @@ -489,8 +489,8 @@ void AchievementMgr::SaveToDB() if (need_execute) { - CharacterDatabase.Execute( ssdel.str().c_str() ); - CharacterDatabase.Execute( ssins.str().c_str() ); + CharacterDatabase.Execute(ssdel.str().c_str()); + CharacterDatabase.Execute(ssins.str().c_str()); } } @@ -549,9 +549,9 @@ void AchievementMgr::SaveToDB() if (need_execute_del || need_execute_ins) { if (need_execute_del) - CharacterDatabase.Execute( ssdel.str().c_str() ); + CharacterDatabase.Execute(ssdel.str().c_str()); if (need_execute_ins) - CharacterDatabase.Execute( ssins.str().c_str() ); + CharacterDatabase.Execute(ssins.str().c_str()); } } } @@ -1802,7 +1802,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) // subject and text std::string subject = reward->subject; std::string text = reward->text; - if ( loc_idx >= 0 ) + if (loc_idx >= 0) { if (AchievementRewardLocale const* loc = achievementmgr.GetAchievementRewardLocale(achievement)) { @@ -1813,7 +1813,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) } } - uint32 itemTextId = objmgr.CreateItemText( text ); + uint32 itemTextId = objmgr.CreateItemText(text); MailDraft draft(subject, itemTextId); @@ -1837,10 +1837,10 @@ void AchievementMgr::SendAllAchievementData() bool send = false; WorldPacket data(SMSG_ALL_ACHIEVEMENT_DATA); - if ( size < 0x8000 ) - data.resize( size ); + if (size < 0x8000) + data.resize(size); else - data.resize( 0x7fff ); + data.resize(0x7fff); // More than this causes client trouble CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); @@ -1848,12 +1848,12 @@ void AchievementMgr::SendAllAchievementData() bool cAchievements = false; bool cProgress = false; - while ( !cAchievements || !cProgress ) + while (!cAchievements || !cProgress) { data.clear(); send = false; - if ( !cAchievements ) + if (!cAchievements) { for (; iter != m_completedAchievements.end() && !send; ++iter) { @@ -1862,7 +1862,7 @@ void AchievementMgr::SendAllAchievementData() send = data.size() > 0x7f00; } - if ( iter == m_completedAchievements.end() ) + if (iter == m_completedAchievements.end()) cAchievements = true; } @@ -1879,7 +1879,7 @@ void AchievementMgr::SendAllAchievementData() send = data.size() > 0x7f00; } - if ( iter2 == m_criteriaProgress.end() ) + if (iter2 == m_criteriaProgress.end()) cProgress = true; data << int32(-1); @@ -1945,7 +1945,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() return; } - barGoLink bar( sAchievementCriteriaStore.GetNumRows() ); + barGoLink bar(sAchievementCriteriaStore.GetNumRows()); for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId) { bar.step(); @@ -1975,7 +1975,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() } uint32 count = 0; - barGoLink bar( sAchievementStore.GetNumRows() ); + barGoLink bar(sAchievementStore.GetNumRows()); for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId) { bar.step(); @@ -2021,7 +2021,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!criteria) { - sLog.outErrorDb( "Table `achievement_criteria_data` have data for not existed criteria (Entry: %u), ignore.", criteria_id); + sLog.outErrorDb("Table `achievement_criteria_data` have data for not existed criteria (Entry: %u), ignore.", criteria_id); continue; } @@ -2111,7 +2111,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() } if (!GetCriteriaDataSet(criteria)) - sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); + sLog.outErrorDb("Table `achievement_criteria_data` not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } sLog.outString(); @@ -2184,7 +2184,7 @@ void AchievementGlobalMgr::LoadRewards() const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry); if (!pAchievement) { - sLog.outErrorDb( "Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry); + sLog.outErrorDb("Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry); continue; } @@ -2199,19 +2199,19 @@ void AchievementGlobalMgr::LoadRewards() // must be title or mail at least if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender) { - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry); continue; } if (pAchievement->factionFlag == ACHIEVEMENT_FACTION_ANY && ((reward.titleId[0] == 0) != (reward.titleId[1] == 0))) - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) only for one from teams.", entry, reward.titleId[0], reward.titleId[1]); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) only for one from teams.", entry, reward.titleId[0], reward.titleId[1]); if (reward.titleId[0]) { CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]); if (!titleEntry) { - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]); reward.titleId[0] = 0; } } @@ -2221,7 +2221,7 @@ void AchievementGlobalMgr::LoadRewards() CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]); if (!titleEntry) { - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]); reward.titleId[1] = 0; } } @@ -2231,27 +2231,27 @@ void AchievementGlobalMgr::LoadRewards() { if (!objmgr.GetCreatureTemplate(reward.sender)) { - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); reward.sender = 0; } } else { if (reward.itemId) - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) not have sender data but have item reward, item will not rewarded", entry); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) not have sender data but have item reward, item will not rewarded", entry); if (!reward.subject.empty()) - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) not have sender data but have mail subject.", entry); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) not have sender data but have mail subject.", entry); if (!reward.text.empty()) - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) not have sender data but have mail text.", entry); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) not have sender data but have mail text.", entry); } if (reward.itemId) { if (!objmgr.GetItemPrototype(reward.itemId)) { - sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will be without item.", entry, reward.itemId); + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will be without item.", entry, reward.itemId); reward.itemId = 0; } } @@ -2262,7 +2262,7 @@ void AchievementGlobalMgr::LoadRewards() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u achievement rewards", count ); + sLog.outString(">> Loaded %u achievement rewards", count); } void AchievementGlobalMgr::LoadRewardLocales() @@ -2294,7 +2294,7 @@ void AchievementGlobalMgr::LoadRewardLocales() if (m_achievementRewards.find(entry)==m_achievementRewards.end()) { - sLog.outErrorDb( "Table `locales_achievement_reward` (Entry: %u) has locale strings for not existed achievement reward .", entry); + sLog.outErrorDb("Table `locales_achievement_reward` (Entry: %u) has locale strings for not existed achievement reward .", entry); continue; } @@ -2330,5 +2330,5 @@ void AchievementGlobalMgr::LoadRewardLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu achievement reward locale strings", (unsigned long)m_achievementRewardLocales.size() ); + sLog.outString(">> Loaded %lu achievement reward locale strings", (unsigned long)m_achievementRewardLocales.size()); } diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index da46ab8ce50..065a8ed8289 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -160,13 +160,13 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) } m_members.push_back(newmember); - CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid, guid, personal_rating) VALUES ('%u', '%u', '%u')", m_TeamId, GUID_LOPART(newmember.guid), newmember.personal_rating ); + CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid, guid, personal_rating) VALUES ('%u', '%u', '%u')", m_TeamId, GUID_LOPART(newmember.guid), newmember.personal_rating); if (pl) { pl->SetInArenaTeam(m_TeamId, GetSlot(), GetType()); pl->SetArenaTeamIdInvited(0); - pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating ); + pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating); // hide promote/remove buttons if (m_CaptainGuid != PlayerGuid) @@ -488,7 +488,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket *packet) } } -uint8 ArenaTeam::GetSlotByType( uint32 type ) +uint8 ArenaTeam::GetSlotByType(uint32 type) { switch(type) { @@ -502,7 +502,7 @@ uint8 ArenaTeam::GetSlotByType( uint32 type ) return 0xFF; } -bool ArenaTeam::HaveMember( const uint64& guid ) const +bool ArenaTeam::HaveMember(const uint64& guid) const { for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) if (itr->guid == guid) diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index 3e25cf07985..ef1117e1f13 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -52,7 +52,7 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data) void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_ARENA_TEAM_QUERY" ); + sLog.outDebug("WORLD: Received CMSG_ARENA_TEAM_QUERY"); uint32 ArenaTeamId; recv_data >> ArenaTeamId; @@ -66,7 +66,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data) void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_ARENA_TEAM_ROSTER" ); + sLog.outDebug("WORLD: Received CMSG_ARENA_TEAM_ROSTER"); uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp index c56e0c71007..aa78126b198 100644 --- a/src/game/Bag.cpp +++ b/src/game/Bag.cpp @@ -26,7 +26,7 @@ #include "Log.h" #include "UpdateData.h" -Bag::Bag( ): Item() +Bag::Bag(): Item() { m_objectType |= TYPEMASK_CONTAINER; m_objectTypeId = TYPEID_CONTAINER; @@ -77,7 +77,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE) return false; - Object::_Create( guidlow, 0, HIGHGUID_CONTAINER ); + Object::_Create(guidlow, 0, HIGHGUID_CONTAINER); SetEntry(itemid); SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); @@ -146,7 +146,7 @@ uint32 Bag::GetFreeSlots() const return slots; } -void Bag::RemoveItem( uint8 slot, bool /*update*/ ) +void Bag::RemoveItem(uint8 slot, bool /*update*/) { assert(slot < MAX_BAG_SIZE); @@ -154,7 +154,7 @@ void Bag::RemoveItem( uint8 slot, bool /*update*/ ) m_bagslot[slot]->SetContainer(NULL); m_bagslot[slot] = NULL; - SetUInt64Value( CONTAINER_FIELD_SLOT_1 + (slot * 2), 0 ); + SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0); } void Bag::StoreItem(uint8 slot, Item *pItem, bool /*update*/) @@ -166,19 +166,19 @@ void Bag::StoreItem(uint8 slot, Item *pItem, bool /*update*/) m_bagslot[slot] = pItem; SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID()); pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID()); - pItem->SetUInt64Value( ITEM_FIELD_OWNER, GetOwnerGUID() ); + pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetOwnerGUID()); pItem->SetContainer(this); pItem->SetSlot(slot); } } -void Bag::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const +void Bag::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const { - Item::BuildCreateUpdateBlockForPlayer( data, target ); + Item::BuildCreateUpdateBlockForPlayer(data, target); for (uint32 i = 0; i < GetBagSize(); ++i) if (m_bagslot[i]) - m_bagslot[i]->BuildCreateUpdateBlockForPlayer( data, target ); + m_bagslot[i]->BuildCreateUpdateBlockForPlayer(data, target); } // If the bag is empty returns true @@ -191,14 +191,14 @@ bool Bag::IsEmpty() const return true; } -uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const +uint32 Bag::GetItemCount(uint32 item, Item* eItem) const { Item *pItem; uint32 count = 0; for (uint32 i=0; i < GetBagSize(); ++i) { pItem = m_bagslot[i]; - if ( pItem && pItem != eItem && pItem->GetEntry() == item ) + if (pItem && pItem != eItem && pItem->GetEntry() == item) count += pItem->GetCount(); } @@ -207,7 +207,7 @@ uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const for (uint32 i=0; i < GetBagSize(); ++i) { pItem = m_bagslot[i]; - if ( pItem && pItem != eItem && pItem->GetProto()->Socket[0].Color ) + if (pItem && pItem != eItem && pItem->GetProto()->Socket[0].Color) count += pItem->GetGemCountWithID(item); } } @@ -225,9 +225,9 @@ uint8 Bag::GetSlotByItemGUID(uint64 guid) const return NULL_SLOT; } -Item* Bag::GetItemByPos( uint8 slot ) const +Item* Bag::GetItemByPos(uint8 slot) const { - if ( slot < GetBagSize() ) + if (slot < GetBagSize()) return m_bagslot[slot]; return NULL; diff --git a/src/game/Bag.h b/src/game/Bag.h index fc363abe538..31bc0d406d1 100644 --- a/src/game/Bag.h +++ b/src/game/Bag.h @@ -21,7 +21,7 @@ #ifndef TRINITY_BAG_H #define TRINITY_BAG_H -// Maximum 36 Slots ( (CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2 +// Maximum 36 Slots ((CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2 #define MAX_BAG_SIZE 36 // 2.0.12 #include "Item.h" @@ -40,11 +40,11 @@ class Bag : public Item bool Create(uint32 guidlow, uint32 itemid, Player const* owner); void Clear(); - void StoreItem( uint8 slot, Item *pItem, bool update ); - void RemoveItem( uint8 slot, bool update ); + void StoreItem(uint8 slot, Item *pItem, bool update); + void RemoveItem(uint8 slot, bool update); - Item* GetItemByPos( uint8 slot ) const; - uint32 GetItemCount( uint32 item, Item* eItem = NULL ) const; + Item* GetItemByPos(uint8 slot) const; + uint32 GetItemCount(uint32 item, Item* eItem = NULL) const; uint8 GetSlotByItemGUID(uint64 guid) const; bool IsEmpty() const; diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index c4a37c51483..cf43ea249ba 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -55,7 +55,7 @@ namespace Trinity va_copy(ap,*i_args); char str [2048]; - vsnprintf(str,2048,text, ap ); + vsnprintf(str,2048,text, ap); va_end(ap); do_helper(data,&str[0]); @@ -96,7 +96,7 @@ namespace Trinity char const* arg2str = i_arg2 ? objmgr.GetTrinityString(i_arg2,loc_idx) : ""; char str [2048]; - snprintf(str,2048,text, arg1str, arg2str ); + snprintf(str,2048,text, arg1str, arg2str); uint64 target_guid = i_source ? i_source ->GetGUID() : 0; @@ -909,19 +909,19 @@ void BattleGround::RewardItem(Player *plr, uint32 item_id, uint32 count) ItemPosCountVec dest; uint32 no_space_count = 0; - uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item_id, count, &no_space_count ); + uint8 msg = plr->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item_id, count, &no_space_count); - if ( msg == EQUIP_ERR_ITEM_NOT_FOUND) + if (msg == EQUIP_ERR_ITEM_NOT_FOUND) { sLog.outErrorDb("Battleground reward item (Entry %u) not exist in `item_template`.",item_id); return; } - if ( msg != EQUIP_ERR_OK ) // convert to possible store amount + if (msg != EQUIP_ERR_OK) // convert to possible store amount count -= no_space_count; - if ( count != 0 && !dest.empty()) // can add some - if (Item* item = plr->StoreNewItem( dest, item_id, true, 0)) + if (count != 0 && !dest.empty()) // can add some + if (Item* item = plr->StoreNewItem(dest, item_id, true, 0)) plr->SendNewItem(item,count,true,false); if (no_space_count > 0) @@ -946,7 +946,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count) // subject: item name std::string subject = markProto->Name1; int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex(); - if (loc_idx >= 0 ) + if (loc_idx >= 0) if (ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId)) if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) subject = il->Name[loc_idx]; @@ -955,7 +955,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count) std::string textFormat = plr->GetSession()->GetTrinityString(LANG_BG_MARK_BY_MAIL); char textBuf[300]; snprintf(textBuf,300,textFormat.c_str(),GetName(),GetName()); - uint32 itemTextId = objmgr.CreateItemText( textBuf ); + uint32 itemTextId = objmgr.CreateItemText(textBuf); MailDraft(subject, itemTextId) .AddItem(markItem) @@ -1087,7 +1087,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac // remove from raid group if player is member if (Group *group = GetBgRaid(team)) { - if ( !group->RemoveMember(guid, 0) ) // group was disbanded + if (!group->RemoveMember(guid, 0)) // group was disbanded { SetBgRaid(team, NULL); delete group; @@ -1800,7 +1800,7 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid) SpawnBGObject(index, BUFF_RESPAWN_TIME); } -void BattleGround::HandleKillPlayer( Player *player, Player *killer ) +void BattleGround::HandleKillPlayer(Player *player, Player *killer) { //keep in mind that for arena this will have to be changed a bit @@ -1827,7 +1827,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer ) // to be able to remove insignia -- ONLY IN BattleGrounds if (!isArena()) - player->SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE ); + player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); } // return the player's team based on battlegroundplayer info @@ -1920,7 +1920,7 @@ void BattleGround::UpdateArenaWorldState() UpdateWorldState(0xe11, GetAlivePlayersCountByTeam(ALLIANCE)); } -void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid ) +void BattleGround::SetBgRaid(uint32 TeamID, Group *bg_raid) { Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; if (old_raid) old_raid->SetBattlegroundGroup(NULL); @@ -1928,9 +1928,9 @@ void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid ) old_raid = bg_raid; } -WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard( Player* player ) +WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard(Player* player) { - return objmgr.GetClosestGraveYard( player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam() ); + return objmgr.GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam()); } bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const @@ -1940,7 +1940,7 @@ bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxSc return score >= minScore && score <= maxScore; } -void BattleGround::SetBracket( PvPDifficultyEntry const* bracketEntry ) +void BattleGround::SetBracket(PvPDifficultyEntry const* bracketEntry) { m_BracketId = bracketEntry->GetBracketId(); SetLevelRange(bracketEntry->minLevel,bracketEntry->maxLevel); diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 3d0b5025712..146d89cb4c0 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -452,7 +452,7 @@ class BattleGround void BlockMovement(Player *plr); void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL); - void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ... ); + void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...); // specialized version with 2 string id args void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0); diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index e4aa99e4c8d..0c2057b69a3 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -421,7 +421,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ uint8 node = BG_AB_NODE_STABLES; GameObject* obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+7]); - while ( (node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10)))) + while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10)))) { ++node; obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]); @@ -553,7 +553,7 @@ bool BattleGroundAB::SetupBattleGround() || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i,BG_AB_OBJECTID_AURA_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i,BG_AB_OBJECTID_AURA_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i,BG_AB_OBJECTID_AURA_C,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) - ) +) { sLog.outErrorDb("BatteGroundAB: Failed to spawn some object BattleGround not created!"); return false; @@ -561,7 +561,7 @@ bool BattleGroundAB::SetupBattleGround() } if (!AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY) || !AddObject(BG_AB_OBJECT_GATE_H,BG_AB_OBJECTID_GATE_H,BG_AB_DoorPositions[1][0],BG_AB_DoorPositions[1][1],BG_AB_DoorPositions[1][2],BG_AB_DoorPositions[1][3],BG_AB_DoorPositions[1][4],BG_AB_DoorPositions[1][5],BG_AB_DoorPositions[1][6],BG_AB_DoorPositions[1][7],RESPAWN_IMMEDIATELY) - ) +) { sLog.outErrorDb("BatteGroundAB: Failed to spawn door object BattleGround not created!"); return false; @@ -572,7 +572,7 @@ bool BattleGroundAB::SetupBattleGround() if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) - ) +) sLog.outErrorDb("BatteGroundAB: Failed to spawn buff object!"); } @@ -646,7 +646,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player) float mindist = 999999.0f; for (uint8 i = 0; i < nodes.size(); ++i) { - WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[nodes[i]] ); + WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[nodes[i]]); if (!entry) continue; float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y); @@ -660,7 +660,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player) } // If not, place ghost on starting location if (!good_entry) - good_entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[teamIndex+5] ); + good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex+5]); return good_entry; } @@ -668,7 +668,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player) void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); - if ( itr == m_PlayerScores.end() ) // player not found... + if (itr == m_PlayerScores.end()) // player not found... return; switch(type) diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 4a4e30ab329..91a99b3bb6d 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -71,7 +71,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer) RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),HORDE); EndBattleGround(HORDE); } - else if ( entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0] ) + else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0]) { CastSpellOnTeam(23658,ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss RewardReputationToTeam(730,BG_AV_REP_BOSS,ALLIANCE); @@ -97,7 +97,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer) YellToAll(creature,GetTrinityString(LANG_BG_AV_A_CAPTAIN_DEAD),LANG_UNIVERSAL); } - else if ( entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0] ) + else if (entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0]) { if (!m_CaptainAlive[1]) { @@ -115,9 +115,9 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer) if (creature) YellToAll(creature,GetTrinityString(LANG_BG_AV_H_CAPTAIN_DEAD),LANG_UNIVERSAL); } - else if ( entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4][0]) + else if (entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4][0]) ChangeMineOwner(AV_NORTH_MINE,killer->GetTeam()); - else if ( entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_H_4][0]) + else if (entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_H_4][0]) ChangeMineOwner(AV_SOUTH_MINE,killer->GetTeam()); } @@ -224,16 +224,16 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) } } -void BattleGroundAV::UpdateScore(uint16 team, int16 points ) +void BattleGroundAV::UpdateScore(uint16 team, int16 points) { //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive - assert( team == ALLIANCE || team == HORDE); + assert(team == ALLIANCE || team == HORDE); uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde m_Team_Scores[teamindex] += points; UpdateWorldState(((teamindex==BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]); - if ( points < 0) + if (points < 0) { - if ( m_Team_Scores[teamindex] < 1) + if (m_Team_Scores[teamindex] < 1) { m_Team_Scores[teamindex]=0; EndBattleGround(((teamindex==BG_TEAM_HORDE)?ALLIANCE:HORDE)); @@ -332,7 +332,7 @@ void BattleGroundAV::Update(uint32 diff) { if (m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE) { - if ( m_Mine_Timer <= 0) + if (m_Mine_Timer <= 0) UpdateScore(m_Mine_Owner[mine],1); if (m_Mine_Reclaim_Timer[mine] > diff) @@ -342,7 +342,7 @@ void BattleGroundAV::Update(uint32 diff) } } } - if ( m_Mine_Timer <= 0) + if (m_Mine_Timer <= 0) m_Mine_Timer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines //looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team @@ -352,7 +352,7 @@ void BattleGroundAV::Update(uint32 diff) if (m_Nodes[i].Timer > diff) m_Nodes[i].Timer -= diff; else - EventPlayerDestroyedPoint( i); + EventPlayerDestroyedPoint(i); } } } @@ -532,7 +532,7 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) UpdateNodeWorldState(node); uint32 owner = m_Nodes[node].Owner; - if ( IsTower(node) ) + if (IsTower(node)) { uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH; //despawn marshal @@ -553,7 +553,7 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) } else { - if ( owner == ALLIANCE ) + if (owner == ALLIANCE) SpawnBGObject(object-11, RESPAWN_IMMEDIATELY); else SpawnBGObject(object+11, RESPAWN_IMMEDIATELY); @@ -565,16 +565,16 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) for (uint8 i = 0; i < 4; i++) { SpawnBGObject(((owner==ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i,RESPAWN_ONE_DAY); - SpawnBGObject(((owner==ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H )+i,RESPAWN_IMMEDIATELY); + SpawnBGObject(((owner==ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i,RESPAWN_IMMEDIATELY); } } } //send a nice message to all :) char buf[256]; if (IsTower(node)) - sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE) ); + sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN) , GetNodeName(node),(owner == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); else - sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE) ); + sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN) , GetNodeName(node),(owner == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if (creature) @@ -600,10 +600,10 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) sLog.outDebug("bg_av depopulating mine %i (0=north,1=south)",mine); if (mine==AV_SOUTH_MINE) for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++) - if ( m_BgCreatures[i] ) + if (m_BgCreatures[i]) DelCreature(i); //TODO just set the respawntime to 999999 for (uint16 i=((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); i++) - if ( m_BgCreatures[i] ) + if (m_BgCreatures[i]) DelCreature(i); //TODO here also } SendMineWorldStates(mine); @@ -640,7 +640,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++) AddAVCreature(cinfo,i); } - for (uint16 i=( (mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN ); i <= ((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MAX:AV_CPLACE_MINE_S_1_MAX); i++) + for (uint16 i=((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MAX:AV_CPLACE_MINE_S_1_MAX); i++) AddAVCreature(miner,i); //the next chooses randomly between 2 cretures for (uint16 i=((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MIN:AV_CPLACE_MINE_S_2_MIN); i <= ((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MAX:AV_CPLACE_MINE_S_2_MAX); i++) @@ -655,7 +655,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) { m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER; char buf[256]; - sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString(( mine == AV_NORTH_MINE ) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if (creature) YellToAll(creature,buf,LANG_UNIVERSAL); @@ -685,25 +685,25 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node) uint32 owner = m_Nodes[node].Owner; assert(owner); - uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node ); + uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node); uint32 creatureid; if (IsTower(node)) creatureid=(owner==ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE; else { uint8 team2 = GetTeamIndexByTeamId(owner); - if (m_Team_QuestStatus[team2][0] < 500 ) - creatureid = ( owner == ALLIANCE )? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0; - else if ( m_Team_QuestStatus[team2][0] < 1000 ) - creatureid = ( owner == ALLIANCE )? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1; - else if ( m_Team_QuestStatus[team2][0] < 1500 ) - creatureid = ( owner == ALLIANCE )? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2; + if (m_Team_QuestStatus[team2][0] < 500) + creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0; + else if (m_Team_QuestStatus[team2][0] < 1000) + creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1; + else if (m_Team_QuestStatus[team2][0] < 1500) + creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2; else - creatureid = ( owner == ALLIANCE )? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3; + creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3; //spiritguide - if ( m_BgCreatures[node] ) + if (m_BgCreatures[node]) DelCreature(node); - if ( !AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) + if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) sLog.outError("AV: couldn't spawn spiritguide at node %i",node); } @@ -714,31 +714,31 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node) } void BattleGroundAV::DePopulateNode(BG_AV_Nodes node) { - uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node ); + uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node); for (uint8 i=0; i<4; i++) - if ( m_BgCreatures[c_place+i] ) + if (m_BgCreatures[c_place+i]) DelCreature(c_place+i); //spiritguide - if ( !IsTower(node) && m_BgCreatures[node] ) + if (!IsTower(node) && m_BgCreatures[node]) DelCreature(node); } const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object) { sLog.outDebug("bg_AV getnodethroughobject %i",object); - if ( object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER ) + if (object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER) return BG_AV_Nodes(object); - if ( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT ) + if (object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT) return BG_AV_Nodes(object - 11); - if ( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER ) + if (object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER) return BG_AV_Nodes(object - 7); - if ( object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER ) + if (object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER) return BG_AV_Nodes(object -22); - if ( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT ) + if (object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT) return BG_AV_Nodes(object - 33); - if ( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ) + if (object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER) return BG_AV_Nodes(object - 29); - if ( object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE ) + if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) return BG_AV_NODES_SNOWFALL_GRAVE; sLog.outError("BattleGroundAV: ERROR! GetPlace got a wrong object :("); assert(false); @@ -748,33 +748,33 @@ const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object) const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node) { //this function is the counterpart to GetNodeThroughObject() sLog.outDebug("bg_AV GetObjectThroughNode %i",node); - if ( m_Nodes[node].Owner == ALLIANCE ) + if (m_Nodes[node].Owner == ALLIANCE) { - if ( m_Nodes[node].State == POINT_ASSAULTED ) + if (m_Nodes[node].State == POINT_ASSAULTED) { - if ( node <= BG_AV_NODES_FROSTWOLF_HUT ) + if (node <= BG_AV_NODES_FROSTWOLF_HUT) return node+11; - if ( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER) + if (node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER) return node+7; } - else if ( m_Nodes[node].State == POINT_CONTROLED ) - if ( node <= BG_AV_NODES_STONEHEART_BUNKER ) + else if (m_Nodes[node].State == POINT_CONTROLED) + if (node <= BG_AV_NODES_STONEHEART_BUNKER) return node; } - else if ( m_Nodes[node].Owner == HORDE ) + else if (m_Nodes[node].Owner == HORDE) { - if ( m_Nodes[node].State == POINT_ASSAULTED ) - if ( node <= BG_AV_NODES_STONEHEART_BUNKER ) + if (m_Nodes[node].State == POINT_ASSAULTED) + if (node <= BG_AV_NODES_STONEHEART_BUNKER) return node+22; - else if ( m_Nodes[node].State == POINT_CONTROLED ) + else if (m_Nodes[node].State == POINT_CONTROLED) { - if ( node <= BG_AV_NODES_FROSTWOLF_HUT ) + if (node <= BG_AV_NODES_FROSTWOLF_HUT) return node+33; - if ( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER) + if (node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER) return node+29; } } - else if ( m_Nodes[node].Owner == AV_NEUTRAL_TEAM ) + else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM) return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; sLog.outError("BattleGroundAV: Error! GetPlaceNode couldn't resolve node %i",node); assert(false); @@ -870,12 +870,12 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) } //send a nice message to all :) char buf[256]; - sprintf(buf, GetTrinityString(( IsTower(node) ) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + sprintf(buf, GetTrinityString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),(team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if (creature) YellToAll(creature,buf,LANG_UNIVERSAL); //update the statistic for the defending player - UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1); + UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1); if (IsTower(node)) PlaySoundToAll(AV_SOUND_BOTH_TOWER_DEFEND); else @@ -898,7 +898,7 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping { assert(owner == AV_NEUTRAL_TEAM && m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM); - if ( team == ALLIANCE ) + if (team == ALLIANCE) SpawnBGObject(BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY); else SpawnBGObject(BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY); @@ -916,12 +916,12 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) uint32 spawn,despawn; if (team == ALLIANCE) { - despawn = ( m_Nodes[node].State == POINT_ASSAULTED )?BG_AV_OBJECT_SNOW_EYECANDY_PH : BG_AV_OBJECT_SNOW_EYECANDY_H; + despawn = (m_Nodes[node].State == POINT_ASSAULTED)?BG_AV_OBJECT_SNOW_EYECANDY_PH : BG_AV_OBJECT_SNOW_EYECANDY_H; spawn = BG_AV_OBJECT_SNOW_EYECANDY_PA; } else { - despawn = ( m_Nodes[node].State == POINT_ASSAULTED )?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_A; + despawn = (m_Nodes[node].State == POINT_ASSAULTED)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_A; spawn = BG_AV_OBJECT_SNOW_EYECANDY_PH; } for (uint8 i = 0; i < 4; i++) @@ -932,7 +932,7 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) } //if snowfall gots capped it can be handled like all other graveyards - if ( m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM) + if (m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM) { assert(m_Nodes[node].Owner != AV_NEUTRAL_TEAM); if (team == ALLIANCE) @@ -953,14 +953,14 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node,RESPAWN_ONE_DAY); //teeamaura despawn // Those who are waiting to resurrect at this object are taken to the closest own object's graveyard std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]]; - if ( !ghost_list.empty() ) + if (!ghost_list.empty()) { Player *plr; WorldSafeLocsEntry const *ClosestGrave = NULL; for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr) { plr = objmgr.GetPlayer(*ghost_list.begin()); - if ( !plr ) + if (!plr) continue; if (!ClosestGrave) ClosestGrave = GetClosestGraveYard(plr); @@ -979,12 +979,12 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) //send a nice message to all :) char buf[256]; - sprintf(buf, ( IsTower(node) ) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE )); + sprintf(buf, (IsTower(node)) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if (creature) YellToAll(creature,buf,LANG_UNIVERSAL); //update the statistic for the assaulting player - UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1); + UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1); PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_ASSAULTS:AV_SOUND_HORDE_ASSAULTS); } @@ -1082,14 +1082,14 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine) owner = 1; UpdateWorldState(BG_AV_MineWorldStates[mine2][owner],1); - if ( prevowner != owner) + if (prevowner != owner) UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner],0); } WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player) { WorldSafeLocsEntry const* good_entry = NULL; - if ( GetStatus() == STATUS_IN_PROGRESS) + if (GetStatus() == STATUS_IN_PROGRESS) { // Is there any occupied node for this team? float mindist = 9999999.0f; @@ -1097,11 +1097,11 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player) { if (m_Nodes[i].Owner != player->GetTeam() || m_Nodes[i].State != POINT_CONTROLED) continue; - WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[i] ); - if ( !entry ) + WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]); + if (!entry) continue; float dist = (entry->x - player->GetPositionX())*(entry->x - player->GetPositionX())+(entry->y - player->GetPositionY())*(entry->y - player->GetPositionY()); - if ( mindist > dist ) + if (mindist > dist) { mindist = dist; good_entry = entry; @@ -1109,8 +1109,8 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player) } } // If not, place ghost on starting location - if ( !good_entry ) - good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7] ); + if (!good_entry) + good_entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7]); return good_entry; } @@ -1131,9 +1131,9 @@ bool BattleGroundAV::SetupBattleGround() //spawn node-objects for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i) { - if ( i <= BG_AV_NODES_FROSTWOLF_HUT ) + if (i <= BG_AV_NODES_FROSTWOLF_HUT) { - if ( !AddObject(i,BG_AV_OBJECTID_BANNER_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + if (!AddObject(i,BG_AV_OBJECTID_BANNER_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(i+11,BG_AV_OBJECTID_BANNER_CONT_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(i+33,BG_AV_OBJECTID_BANNER_H_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(i+22,BG_AV_OBJECTID_BANNER_CONT_H_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) @@ -1148,9 +1148,9 @@ bool BattleGroundAV::SetupBattleGround() } else //towers { - if ( i <= BG_AV_NODES_STONEHEART_BUNKER ) //alliance towers + if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers { - if ( !AddObject(i,BG_AV_OBJECTID_BANNER_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + if (!AddObject(i,BG_AV_OBJECTID_BANNER_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(i+22,BG_AV_OBJECTID_BANNER_CONT_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_A,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) @@ -1163,7 +1163,7 @@ bool BattleGroundAV::SetupBattleGround() } else //horde towers { - if ( !AddObject(i+7,BG_AV_OBJECTID_BANNER_CONT_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + if (!AddObject(i+7,BG_AV_OBJECTID_BANNER_CONT_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(i+29,BG_AV_OBJECTID_BANNER_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_H,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) @@ -1273,14 +1273,14 @@ bool BattleGroundAV::SetupBattleGround() //creatures sLog.outDebug("BG_AV start poputlating nodes"); - for (BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i ) + for (BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) { if (m_Nodes[i].Owner) PopulateNode(i); } //all creatures which don't get despawned through the script are static sLog.outDebug("BG_AV: start spawning static creatures"); - for (i=0; i < AV_STATICCPLACE_MAX; i++ ) + for (i=0; i < AV_STATICCPLACE_MAX; i++) AddAVCreature(0,i+AV_CPLACE_MAX); //mainspiritguides: sLog.outDebug("BG_AV: start spawning spiritguides creatures"); diff --git a/src/game/BattleGroundAV.h b/src/game/BattleGroundAV.h index cb0201fc677..40a631db78e 100644 --- a/src/game/BattleGroundAV.h +++ b/src/game/BattleGroundAV.h @@ -1285,7 +1285,7 @@ enum BG_AV_WorldStates AV_SHOW_A_SCORE = 3134, /* - //the comments behind the state shows which icon overlaps the other.. but is, until now, unused and maybe not a good solution (but give few performance (: ) + //the comments behind the state shows which icon overlaps the other.. but is, until now, unused and maybe not a good solution (but give few performance (:) // Graves diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index f45bf4c4d30..394ced214ef 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -131,7 +131,7 @@ void BattleGroundEY::AddPoints(uint32 Team, uint32 Points) BattleGroundTeamId team_index = GetTeamIndexByTeamId(Team); m_TeamScores[team_index] += Points; m_HonorScoreTics[team_index] += Points; - if (m_HonorScoreTics[team_index] >= m_HonorTics ) + if (m_HonorScoreTics[team_index] >= m_HonorTics) { RewardHonorToTeam(GetBonusHonorFromKill(1), Team); m_HonorScoreTics[team_index] -= m_HonorTics; @@ -472,7 +472,7 @@ bool BattleGroundEY::SetupBattleGround() || !AddObject(BG_EY_OBJECT_TOWER_CAP_BLOOD_ELF, BG_OBJECT_BE_TOWER_CAP_EY_ENTRY, 2050.493164f, 1372.235962f, 1194.563477f, 1.710423f, 0, 0, 0.754710f, 0.656059f, RESPAWN_ONE_DAY) || !AddObject(BG_EY_OBJECT_TOWER_CAP_DRAENEI_RUINS, BG_OBJECT_DR_TOWER_CAP_EY_ENTRY, 2301.010498f, 1386.931641f, 1197.183472f, 1.570796f, 0, 0, 0.707107f, 0.707107f, RESPAWN_ONE_DAY) || !AddObject(BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER, BG_OBJECT_HU_TOWER_CAP_EY_ENTRY, 2282.121582f, 1760.006958f, 1189.707153f, 1.919862f, 0, 0, 0.819152f, 0.573576f, RESPAWN_ONE_DAY) - ) +) { sLog.outErrorDb("BatteGroundEY: Failed to spawn some object BattleGround not created!"); return false; @@ -490,7 +490,7 @@ bool BattleGroundEY::SetupBattleGround() if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) - ) +) sLog.outError("BattleGroundEY: Cannot spawn buff"); } @@ -610,7 +610,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME; Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true); Source->CastSpell(Source, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true); - //this does not work correctly :( (it should remove flag carrier name) + //this does not work correctly :((it should remove flag carrier name) UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN); UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN); diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index f3b10bdf444..96af183b258 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -35,11 +35,11 @@ #include "Object.h" #include "Opcodes.h" -void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); + sLog.outDebug("WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) @@ -63,14 +63,14 @@ void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data ) SendBattlegGroundList(guid, bgTypeId); } -void WorldSession::SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgTypeId ) +void WorldSession::SendBattlegGroundList(uint64 guid, BattleGroundTypeId bgTypeId) { WorldPacket data; sBattleGroundMgr.BuildBattleGroundListPacket(&data, guid, _player, bgTypeId, 0); - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) { uint64 guid; uint32 bgTypeId_; @@ -92,7 +92,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + sLog.outDebug("WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); // can do this, since it's battleground, not arena BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0); @@ -192,7 +192,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); } -void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/) { // empty opcode sLog.outDebug("WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message"); @@ -201,7 +201,7 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv if (!bg) // can't be received if player not in battleground return; - switch( bg->GetTypeID() ) + switch(bg->GetTypeID()) { case BATTLEGROUND_WS: { @@ -260,9 +260,9 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv } } -void WorldSession::HandlePVPLogDataOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/) { - sLog.outDebug( "WORLD: Recvd MSG_PVP_LOG_DATA Message"); + sLog.outDebug("WORLD: Recvd MSG_PVP_LOG_DATA Message"); BattleGround *bg = _player->GetBattleGround(); if (!bg) @@ -272,12 +272,12 @@ void WorldSession::HandlePVPLogDataOpcode( WorldPacket & /*recv_data*/ ) sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg); SendPacket(&data); - sLog.outDebug( "WORLD: Sent MSG_PVP_LOG_DATA Message"); + sLog.outDebug("WORLD: Sent MSG_PVP_LOG_DATA Message"); } -void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data ) +void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recv_data) { - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message"); + sLog.outDebug("WORLD: Recvd CMSG_BATTLEFIELD_LIST Message"); uint32 bgTypeId; recv_data >> bgTypeId; // id from DBC @@ -297,12 +297,12 @@ void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data ) WorldPacket data; sBattleGroundMgr.BuildBattleGroundListPacket(&data, 0, _player, BattleGroundTypeId(bgTypeId), fromWhere); - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) +void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) { - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEFIELD_PORT Message"); + sLog.outDebug("WORLD: Recvd CMSG_BATTLEFIELD_PORT Message"); uint8 type; // arenatype if arena uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1 @@ -380,7 +380,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) } uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId); WorldPacket data; - switch( action ) + switch(action) { case 1: // port to battleground if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId)) @@ -450,7 +450,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data) { - sLog.outDebug( "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); + sLog.outDebug("WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); recv_data.read_skip<uint8>(); // unk1 recv_data.read_skip<uint8>(); // unk2 @@ -466,10 +466,10 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data) _player->LeaveBattleground(); } -void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/) { // empty opcode - sLog.outDebug( "WORLD: Battleground status" ); + sLog.outDebug("WORLD: Battleground status"); WorldPacket data; // we must update all queues here @@ -530,7 +530,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) } } -void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); @@ -551,7 +551,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data ) } -void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); @@ -572,7 +572,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data ) } -void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) +void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); //recv_data.hexlike(); @@ -740,7 +740,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); } -void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data ) +void WorldSession::HandleReportPvPAFK(WorldPacket & recv_data) { uint64 playerGuid; recv_data >> playerGuid; diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index a3e3ac72576..4581ed6c958 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -48,7 +48,7 @@ #include "ProgressBar.h" #include "SharedDefines.h" -INSTANTIATE_SINGLETON_1( BattleGroundMgr ); +INSTANTIATE_SINGLETON_1(BattleGroundMgr); /*********************************************************/ /*** BATTLEGROUND QUEUE SYSTEM ***/ @@ -296,7 +296,7 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE } //check if there is enought values(we always add values > 0) - if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1] ) + if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1]) return (m_SumOfWaitTimes[team_index][bracket_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME); else //if there aren't enough values return 0 - not available @@ -431,9 +431,9 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime) { QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid); - return ( qItr != m_QueuedPlayers.end() + return (qItr != m_QueuedPlayers.end() && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == bgInstanceGuid - && qItr->second.GroupInfo->RemoveInviteTime == removeTime ); + && qItr->second.GroupInfo->RemoveInviteTime == removeTime); } bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo) @@ -547,7 +547,7 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId // At first we need to compare free space in bg and our selection pool int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()); int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()); - while ( abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0) ) + while (abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0)) { //each cycle execution we need to kick at least 1 group if (diffAli < diffHorde) @@ -598,10 +598,10 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint //start premade match //if groups aren't invited GroupsQueueType::const_iterator ali_group, horde_group; - for ( ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group) + for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group) if (!(*ali_group)->IsInvitedToBGInstanceGUID) break; - for ( horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group) + for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group) if (!(*horde_group)->IsInvitedToBGInstanceGUID) break; @@ -668,8 +668,8 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround uint32 j = BG_TEAM_ALLIANCE; if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()) j = BG_TEAM_HORDE; - if ( sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0 - && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers ) + if (sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0 + && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers) { //we will try to invite more groups to team with less players indexed by j ++(itr_team[j]); //this will not cause a crash, because for cycle above reached break; @@ -698,7 +698,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke uint32 teamIndex = BG_TEAM_ALLIANCE; uint32 otherTeam = BG_TEAM_HORDE; uint32 otherTeamId = HORDE; - if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam ) + if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam) { teamIndex = BG_TEAM_HORDE; otherTeam = BG_TEAM_ALLIANCE; @@ -757,10 +757,10 @@ should be called from BattleGround::RemovePlayer function in some cases void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating) { //if no players in queue - do nothing - if ( m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && + if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() && - m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty() ) + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty()) return; //battleground with free slot for player should be always in the beggining of the queue @@ -771,8 +771,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI next = itr; ++next; // DO NOT allow queue manager to invite new player to arena - if ( (*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id && - (*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE ) + if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id && + (*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE) { BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!) // and iterator is invalid @@ -881,7 +881,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI { // if there are enough players in pools, start new battleground or non rated arena if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam) - || (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)) ) + || (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam))) { // we successfully created a pool BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, false); @@ -904,7 +904,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI // found out the minimum and maximum ratings the newly added team should battle against // arenaRating is the rating of the latest joined team, or 0 // 0 is on (automatic update call) and we must set it to team's with longest wait time - if (!arenaRating ) + if (!arenaRating) { GroupQueueInfo* front1 = NULL; GroupQueueInfo* front2 = NULL; @@ -949,9 +949,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI for (; itr_team[i] != m_QueuedGroups[bracket_id][i].end(); ++(itr_team[i])) { // if group match conditions, then add it to pool - if ( !(*itr_team[i])->IsInvitedToBGInstanceGUID + if (!(*itr_team[i])->IsInvitedToBGInstanceGUID && (((*itr_team[i])->ArenaTeamRating >= arenaMinRating && (*itr_team[i])->ArenaTeamRating <= arenaMaxRating) - || (*itr_team[i])->JoinTime < discardTime) ) + || (*itr_team[i])->JoinTime < discardTime)) { m_SelectionPools[i].AddGroup((*itr_team[i]), MaxPlayersPerTeam); // break for cycle to be able to start selecting another group from same faction queue @@ -969,9 +969,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI ++itr_team[BG_TEAM_ALLIANCE]; for (; itr_team[BG_TEAM_ALLIANCE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++(itr_team[BG_TEAM_ALLIANCE])) { - if ( !(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID + if (!(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID && (((*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating <= arenaMaxRating) - || (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime) ) + || (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime)) { m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*itr_team[BG_TEAM_ALLIANCE]), MaxPlayersPerTeam); break; @@ -985,9 +985,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI ++itr_team[BG_TEAM_HORDE]; for (; itr_team[BG_TEAM_HORDE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++(itr_team[BG_TEAM_HORDE])) { - if ( !(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID + if (!(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID && (((*itr_team[BG_TEAM_HORDE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_HORDE])->ArenaTeamRating <= arenaMaxRating) - || (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime) ) + || (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime)) { m_SelectionPools[BG_TEAM_HORDE].AddGroup((*itr_team[BG_TEAM_HORDE]), MaxPlayersPerTeam); break; @@ -1041,7 +1041,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - Player* plr = objmgr.GetPlayer( m_PlayerGuid ); + Player* plr = objmgr.GetPlayer(m_PlayerGuid); // player logged off (we should do nothing, he is correctly removed from queue in another procedure) if (!plr) return true; @@ -1075,7 +1075,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/) /* this event has many possibilities when it is executed: - 1. player is in battleground ( he clicked enter on invitation window ) + 1. player is in battleground (he clicked enter on invitation window) 2. player left battleground queue and he isn't there any more 3. player left battleground queue and he joined it again and IsInvitedToBGInstanceGUID = 0 4. player left queue and he joined again and he has been invited to same battleground again -> we should not remove him from queue yet @@ -1084,7 +1084,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/) */ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - Player* plr = objmgr.GetPlayer( m_PlayerGuid ); + Player* plr = objmgr.GetPlayer(m_PlayerGuid); if (!plr) // player logged off (we should do nothing, he is correctly removed from queue in another procedure) return true; @@ -1487,7 +1487,7 @@ BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundT return NULL; } itr = m_BattleGrounds[bgTypeId].find(InstanceID); - return ( (itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL ); + return ((itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL); } BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId) @@ -1510,7 +1510,7 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI uint32 lastId = 0; for (std::set<uint32>::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracket_id].end();) { - if ( (++lastId) != *itr) //if there is a gap between the ids, we will break.. + if ((++lastId) != *itr) //if there is a gap between the ids, we will break.. break; lastId = *itr; } @@ -1772,7 +1772,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u battlegrounds", count ); + sLog.outString(">> Loaded %u battlegrounds", count); } void BattleGroundMgr::InitAutomaticArenaPointDistribution() @@ -1876,7 +1876,7 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6 *data << uint32(*itr); ++count; } - data->put<uint32>( count_pos , count); + data->put<uint32>(count_pos , count); } } } @@ -1915,13 +1915,13 @@ void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround * bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId) { - return ( bgTypeId == BATTLEGROUND_AA || + return (bgTypeId == BATTLEGROUND_AA || bgTypeId == BATTLEGROUND_BE || bgTypeId == BATTLEGROUND_NA || bgTypeId == BATTLEGROUND_DS || bgTypeId == BATTLEGROUND_RV || bgTypeId == BATTLEGROUND_RL || - bgTypeId == BATTLEGROUND_DS ); + bgTypeId == BATTLEGROUND_DS); } BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType) @@ -2074,21 +2074,21 @@ void BattleGroundMgr::LoadBattleMastersEntry() { mBattleMastersMap.clear(); // need for reload case - QueryResult_AutoPtr result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" ); + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry"); uint32 count = 0; if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 battlemaster entries - table is empty!" ); + sLog.outString(">> Loaded 0 battlemaster entries - table is empty!"); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2107,10 +2107,10 @@ void BattleGroundMgr::LoadBattleMastersEntry() mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u battlemaster entries", count ); + sLog.outString(">> Loaded %u battlemaster entries", count); } bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId) { diff --git a/src/game/BattleGroundRV.cpp b/src/game/BattleGroundRV.cpp index 3815cdf20c6..fcc53dbbcf9 100644 --- a/src/game/BattleGroundRV.cpp +++ b/src/game/BattleGroundRV.cpp @@ -194,7 +194,7 @@ void BattleGroundRV::Reset() bool BattleGroundRV::SetupBattleGround() { // Fence - if ( !AddObject(BG_RV_OBJECT_FENCE_1, BG_RV_OBJECT_TYPE_FENCE_1, 763.432373, -274.058197, 28.276695, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + if (!AddObject(BG_RV_OBJECT_FENCE_1, BG_RV_OBJECT_TYPE_FENCE_1, 763.432373, -274.058197, 28.276695, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_FENCE_2, BG_RV_OBJECT_TYPE_FENCE_2, 763.432373, -294.419464, 28.276684, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) // elevators || !AddObject(BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_TYPE_ELEVATOR_1, 763.536377, -294.535767, 0.505383, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) @@ -225,7 +225,7 @@ bool BattleGroundRV::SetupBattleGround() || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_3, BG_RV_OBJECT_TYPE_PILAR_COLLISION_3, 763.611145, -261.856750, 30.639660, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_4, BG_RV_OBJECT_TYPE_PILAR_COLLISION_4, 802.211609, -284.493256, 32.382710, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) */ - ) +) { sLog.outErrorDb("BatteGroundRV: Failed to spawn some object!"); return false; diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp index 9fdbd940cfe..c237f467aee 100644 --- a/src/game/BattleGroundSA.cpp +++ b/src/game/BattleGroundSA.cpp @@ -43,7 +43,7 @@ BattleGroundSA::~BattleGroundSA() void BattleGroundSA::Reset() { TotalTime = 0; - attackers = ( (urand(0,1)) ? TEAM_ALLIANCE : TEAM_HORDE); + attackers = ((urand(0,1)) ? TEAM_ALLIANCE : TEAM_HORDE); for (uint8 i = 0; i <= 5; i++) GateStatus[i] = BG_SA_GATE_OK; ShipsStarted = false; @@ -130,12 +130,12 @@ bool BattleGroundSA::ResetObjs() if (i == BG_SA_BEACH_GY) { GraveyardStatus[i] = attackers; - AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? HORDE : ALLIANCE)); + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE)? HORDE : ALLIANCE)); } else { - GraveyardStatus[i] = ((attackers == TEAM_HORDE )? TEAM_ALLIANCE : TEAM_HORDE); - if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? ALLIANCE : HORDE) )) + GraveyardStatus[i] = ((attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE); + if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE)? ALLIANCE : HORDE))) sLog.outError("SOTA: couldn't spawn GY: %u",i); } } @@ -151,13 +151,13 @@ bool BattleGroundSA::ResetObjs() } //Player may enter BEFORE we set up bG - lets update his worldstates anyway... - UpdateWorldState(BG_SA_RIGHT_GY_HORDE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0 ); - UpdateWorldState(BG_SA_LEFT_GY_HORDE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0 ); - UpdateWorldState(BG_SA_CENTER_GY_HORDE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0 ); + UpdateWorldState(BG_SA_RIGHT_GY_HORDE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0); + UpdateWorldState(BG_SA_LEFT_GY_HORDE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0); + UpdateWorldState(BG_SA_CENTER_GY_HORDE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0); - UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 ); - UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 ); - UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 ); + UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); if (attackers == TEAM_ALLIANCE) { @@ -207,7 +207,7 @@ void BattleGroundSA::StartShips() for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++) { - for ( BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++) + for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++) { if (Player* p = objmgr.GetPlayer(itr->first)) { @@ -311,13 +311,13 @@ void BattleGroundSA::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0); data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0); - data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0 ); - data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0 ); - data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0 ); + data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0); + data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0); + data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0); - data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 ); - data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 ); - data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 ); + data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks; data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks; @@ -590,7 +590,7 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i) GraveyardStatus[i] = (GraveyardStatus[i] == TEAM_ALLIANCE? TEAM_HORDE : TEAM_ALLIANCE); WorldSafeLocsEntry const *sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); - AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE )); + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE)); uint32 npc = 0; switch(i) diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 58776e6b5b8..f33a87e7c45 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -676,7 +676,7 @@ bool BattleGroundWS::SetupBattleGround() || !AddObject(BG_WS_OBJECT_DOOR_H_2, BG_OBJECT_DOOR_H_2_WS_ENTRY, 953.0507f, 1459.842f, 340.6526f, -1.99662f, -0.1971825f, 0.1575096f, -0.8239487f, 0.5073641f, RESPAWN_IMMEDIATELY) || !AddObject(BG_WS_OBJECT_DOOR_H_3, BG_OBJECT_DOOR_H_3_WS_ENTRY, 949.9523f, 1422.751f, 344.9273f, 0.0f, 0, 0, 0, 1, RESPAWN_IMMEDIATELY) || !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY) - ) +) { sLog.outErrorDb("BatteGroundWS: Failed to spawn some object BattleGround not created!"); return false; diff --git a/src/game/Cell.h b/src/game/Cell.h index 23d5f56c417..e61a96124dd 100644 --- a/src/game/Cell.h +++ b/src/game/Cell.h @@ -79,29 +79,29 @@ struct Cell Compute(x, y); cell.Compute(old_x, old_y); - if ( std::abs(int(x-old_x)) > 1 || std::abs(int(y-old_y)) > 1) + if (std::abs(int(x-old_x)) > 1 || std::abs(int(y-old_y)) > 1) { data.Part.reserved = ALL_DISTRICT; cell.data.Part.reserved = ALL_DISTRICT; return; } - if ( x < old_x ) + if (x < old_x) { data.Part.reserved |= LEFT_DISTRICT; cell.data.Part.reserved |= RIGHT_DISTRICT; } - else if ( old_x < x ) + else if (old_x < x) { data.Part.reserved |= RIGHT_DISTRICT; cell.data.Part.reserved |= LEFT_DISTRICT; } - if ( y < old_y ) + if (y < old_y) { data.Part.reserved |= UPPER_DISTRICT; cell.data.Part.reserved |= LOWER_DISTRICT; } - else if ( old_y < y ) + else if (old_y < y) { data.Part.reserved |= LOWER_DISTRICT; cell.data.Part.reserved |= UPPER_DISTRICT; @@ -116,14 +116,14 @@ struct Cell bool DiffCell(const Cell &cell) const { - return( data.Part.cell_x != cell.data.Part.cell_x || - data.Part.cell_y != cell.data.Part.cell_y ); + return(data.Part.cell_x != cell.data.Part.cell_x || + data.Part.cell_y != cell.data.Part.cell_y); } bool DiffGrid(const Cell &cell) const { - return( data.Part.grid_x != cell.data.Part.grid_x || - data.Part.grid_y != cell.data.Part.grid_y ); + return(data.Part.grid_x != cell.data.Part.grid_x || + data.Part.grid_y != cell.data.Part.grid_y); } uint32 CellX() const { return data.Part.cell_x; } diff --git a/src/game/CellImpl.h b/src/game/CellImpl.h index dad233722e4..d906e81a5c9 100644 --- a/src/game/CellImpl.h +++ b/src/game/CellImpl.h @@ -56,7 +56,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v CellPair begin_cell = standing_cell; CellPair end_cell = standing_cell; - switch( district ) + switch(district) { case ALL_DISTRICT: { @@ -112,7 +112,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v } default: { - assert( false ); + assert(false); break; } } diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index f8f59e596fb..38e5d53c85c 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -164,7 +164,7 @@ void Channel::Join(uint64 p, const char *pass) { if (HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && - (plr->GetGroup() || plr->m_lookingForGroup.Empty()) ) + (plr->GetGroup() || plr->m_lookingForGroup.Empty())) { MakeNotInLfg(&data); SendToOne(&data, p); @@ -177,7 +177,7 @@ void Channel::Join(uint64 p, const char *pass) plr->JoinedChannel(this); } - if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) )) + if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { MakeJoined(&data, p); SendToAll(&data); @@ -202,7 +202,7 @@ void Channel::Join(uint64 p, const char *pass) players[p].SetModerator(true); } /* - else if (!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID() )) + else if (!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID())) { SetOwner(p, (players.size() > 1 ? true : false)); players[p].SetModerator(true); @@ -237,7 +237,7 @@ void Channel::Leave(uint64 p, bool send) bool changeowner = players[p].IsOwner(); players.erase(p); - if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) )) + if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { WorldPacket data; MakeLeft(&data, p); @@ -445,8 +445,8 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) // allow make moderator from another team only if both is GMs // at this moment this only way to show channel post for GM from another team - if ( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) && - plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL) ) + if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) && + plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) { WorldPacket data; MakePlayerNotFound(&data, p2n); diff --git a/src/game/ChannelMgr.cpp b/src/game/ChannelMgr.cpp index 18011a742ee..24da2b00215 100644 --- a/src/game/ChannelMgr.cpp +++ b/src/game/ChannelMgr.cpp @@ -20,8 +20,8 @@ #include "Policies/SingletonImp.h" #include "World.h" -INSTANTIATE_SINGLETON_1( AllianceChannelMgr ); -INSTANTIATE_SINGLETON_1( HordeChannelMgr ); +INSTANTIATE_SINGLETON_1(AllianceChannelMgr); +INSTANTIATE_SINGLETON_1(HordeChannelMgr); ChannelMgr* channelMgr(uint32 team) { diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 58952daaa72..fb43f3909d7 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -136,7 +136,7 @@ void WorldSession::HandleCharEnum(QueryResult_AutoPtr result) data << num; - if ( result ) + if (result) { do { @@ -145,15 +145,15 @@ void WorldSession::HandleCharEnum(QueryResult_AutoPtr result) if (Player::BuildEnumData(result, &data)) ++num; } - while ( result->NextRow() ); + while (result->NextRow()); } data.put<uint8>(0, num); - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recv_data*/) { /// get all the data necessary for loading all characters (along with their pets) on the account CharacterDatabase.AsyncPQuery(&chrHandler, &CharacterHandler::HandleCharEnumCallback, GetAccountId(), @@ -183,7 +183,7 @@ void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ ) PET_SAVE_AS_CURRENT,GetAccountId()); } -void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) +void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) { std::string name; uint8 race_,class_; @@ -211,7 +211,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (disabled) { data << (uint8)CHAR_CREATE_DISABLED; - SendPacket( &data ); + SendPacket(&data); return; } } @@ -220,10 +220,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_); - if ( !classEntry || !raceEntry ) + if (!classEntry || !raceEntry) { data << (uint8)CHAR_CREATE_FAILED; - SendPacket( &data ); + SendPacket(&data); sLog.outError("Class: %u or Race %u not found in DBC (Wrong DBC files?) or Cheater?", class_, race_); return; } @@ -233,7 +233,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) { data << (uint8)CHAR_CREATE_EXPANSION; sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)",Expansion(),GetAccountId(),raceEntry->expansion,race_); - SendPacket( &data ); + SendPacket(&data); return; } @@ -242,7 +242,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) { data << (uint8)CHAR_CREATE_EXPANSION_CLASS; sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)",Expansion(),GetAccountId(),classEntry->expansion,class_); - SendPacket( &data ); + SendPacket(&data); return; } @@ -250,7 +250,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (!normalizePlayerName(name)) { data << (uint8)CHAR_NAME_NO_NAME; - SendPacket( &data ); + SendPacket(&data); sLog.outError("Account:[%d] but tried to Create character with empty [name] ",GetAccountId()); return; } @@ -260,21 +260,21 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (res != CHAR_NAME_SUCCESS) { data << uint8(res); - SendPacket( &data ); + SendPacket(&data); return; } if (GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(name)) { data << (uint8)CHAR_NAME_RESERVED; - SendPacket( &data ); + SendPacket(&data); return; } if (objmgr.GetPlayerGUIDByName(name)) { data << (uint8)CHAR_CREATE_NAME_IN_USE; - SendPacket( &data ); + SendPacket(&data); return; } @@ -287,14 +287,14 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (acctcharcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_ACCOUNT)) { data << (uint8)CHAR_CREATE_ACCOUNT_LIMIT; - SendPacket( &data ); + SendPacket(&data); return; } } QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", GetAccountId()); uint8 charcount = 0; - if ( result ) + if (result) { Field *fields=result->Fetch(); charcount = fields[0].GetUInt8(); @@ -302,7 +302,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (charcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_REALM)) { data << (uint8)CHAR_CREATE_SERVER_LIMIT; - SendPacket( &data ); + SendPacket(&data); return; } } @@ -312,7 +312,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; - SendPacket( &data ); + SendPacket(&data); return; } @@ -321,7 +321,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT; - SendPacket( &data ); + SendPacket(&data); return; } @@ -355,7 +355,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (heroic_free_slots==0) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; - SendPacket( &data ); + SendPacket(&data); return; } } @@ -379,7 +379,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (acc_team != team_) { data << (uint8)CHAR_CREATE_PVP_TEAMS_VIOLATION; - SendPacket( &data ); + SendPacket(&data); return; } } @@ -408,7 +408,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (heroic_free_slots==0) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; - SendPacket( &data ); + SendPacket(&data); return; } } @@ -427,7 +427,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic) { data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT; - SendPacket( &data ); + SendPacket(&data); return; } @@ -444,14 +444,14 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) } Player * pNewChar = new Player(this); - if (!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId )) + if (!pNewChar->Create(objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId)) { // Player not create (race/class problem?) pNewChar->CleanupsBeforeDelete(); delete pNewChar; data << (uint8)CHAR_CREATE_ERROR; - SendPacket( &data ); + SendPacket(&data); return; } @@ -472,14 +472,14 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) delete pNewChar; // created only to call SaveToDB() data << (uint8)CHAR_CREATE_SUCCESS; - SendPacket( &data ); + SendPacket(&data); std::string IP_str = GetRemoteAddress(); sLog.outDetail("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); } -void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) +void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; @@ -496,7 +496,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) { WorldPacket data(SMSG_CHAR_DELETE, 1); data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER; - SendPacket( &data ); + SendPacket(&data); return; } @@ -505,7 +505,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) { WorldPacket data(SMSG_CHAR_DELETE, 1); data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN; - SendPacket( &data ); + SendPacket(&data); return; } @@ -535,10 +535,10 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) WorldPacket data(SMSG_CHAR_DELETE, 1); data << (uint8)CHAR_DELETE_SUCCESS; - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data ) +void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recv_data) { if (PlayerLoading() || GetPlayer() != NULL) { @@ -549,7 +549,7 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data ) m_playerLoading = true; uint64 playerGuid = 0; - DEBUG_LOG( "WORLD: Recvd Player Logon Message" ); + DEBUG_LOG("WORLD: Recvd Player Logon Message"); recv_data >> playerGuid; @@ -588,7 +588,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) pCurrChar->SendDungeonDifficulty(false); - WorldPacket data( SMSG_LOGIN_VERIFY_WORLD, 20 ); + WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 20); data << pCurrChar->GetMapId(); data << pCurrChar->GetPositionX(); data << pCurrChar->GetPositionY(); @@ -615,7 +615,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) std::string::size_type pos, nextpos; pos = 0; - while ( (nextpos= str_motd.find('@',pos)) != std::string::npos ) + while ((nextpos= str_motd.find('@',pos)) != std::string::npos) { if (nextpos != pos) { @@ -633,14 +633,14 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) data.put(0, linecount); - SendPacket( &data ); - DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" ); + SendPacket(&data); + DEBUG_LOG("WORLD: Sent motd (SMSG_MOTD)"); // send server info if (sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1) chH.PSendSysMessage(_FULLVERSION); - DEBUG_LOG( "WORLD: Sent server info" ); + DEBUG_LOG("WORLD: Sent server info"); } //QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow()); @@ -668,7 +668,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) data << uint8(1); data << guild->GetMOTD(); SendPacket(&data); - DEBUG_LOG( "WORLD: Sent guild-motd (SMSG_GUILD_EVENT)" ); + DEBUG_LOG("WORLD: Sent guild-motd (SMSG_GUILD_EVENT)"); guild->DisplayGuildBankTabsInfo(this); @@ -678,7 +678,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) data<< pCurrChar->GetName(); data<< pCurrChar->GetGUID(); guild->BroadcastPacket(&data); - DEBUG_LOG( "WORLD: Sent guild-signed-on (SMSG_GUILD_EVENT)" ); + DEBUG_LOG("WORLD: Sent guild-signed-on (SMSG_GUILD_EVENT)"); } else { @@ -696,7 +696,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) pCurrChar->SendInitialPacketsBeforeAddToMap(); //Show cinematic at the first time that player login - if ( !pCurrChar->getCinematic() ) + if (!pCurrChar->getCinematic()) { pCurrChar->setCinematic(1); @@ -729,7 +729,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) CharacterDatabase.PExecute("UPDATE characters SET online = 1 WHERE guid = '%u'", pCurrChar->GetGUIDLow()); loginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = '%u'", GetAccountId()); - pCurrChar->SetInGameTime( getMSTime() ); + pCurrChar->SetInGameTime(getMSTime()); // announce group about member online (must be after add to player list to receive announce to self) if (Group *group = pCurrChar->GetGroup()) @@ -765,7 +765,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) pCurrChar->LoadPet(); // Set FFA PvP for non GM in non-rest mode - if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) ) + if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING)) pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) @@ -812,9 +812,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) delete holder; } -void WorldSession::HandleSetFactionAtWar( WorldPacket & recv_data ) +void WorldSession::HandleSetFactionAtWar(WorldPacket & recv_data) { - DEBUG_LOG( "WORLD: Received CMSG_SET_FACTION_ATWAR" ); + DEBUG_LOG("WORLD: Received CMSG_SET_FACTION_ATWAR"); uint32 repListID; uint8 flag; @@ -826,7 +826,7 @@ void WorldSession::HandleSetFactionAtWar( WorldPacket & recv_data ) } //I think this function is never used :/ I dunno, but i guess this opcode not exists -void WorldSession::HandleSetFactionCheat( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleSetFactionCheat(WorldPacket & /*recv_data*/) { sLog.outError("WORLD SESSION: HandleSetFactionCheat, not expected call, please report."); /* @@ -851,14 +851,14 @@ void WorldSession::HandleSetFactionCheat( WorldPacket & /*recv_data*/ ) GetPlayer()->GetReputationMgr().SendStates(); } -void WorldSession::HandleMeetingStoneInfo( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleMeetingStoneInfo(WorldPacket & /*recv_data*/) { - DEBUG_LOG( "WORLD: Received CMSG_MEETING_STONE_INFO" ); + DEBUG_LOG("WORLD: Received CMSG_MEETING_STONE_INFO"); SendLfgUpdate(0, 0, 0); } -void WorldSession::HandleTutorialFlag( WorldPacket & recv_data ) +void WorldSession::HandleTutorialFlag(WorldPacket & recv_data) { uint32 iFlag; recv_data >> iFlag; @@ -871,23 +871,23 @@ void WorldSession::HandleTutorialFlag( WorldPacket & recv_data ) } uint32 rInt = (iFlag % 32); - uint32 tutflag = GetTutorialInt( wInt ); + uint32 tutflag = GetTutorialInt(wInt); tutflag |= (1 << rInt); - SetTutorialInt( wInt, tutflag ); + SetTutorialInt(wInt, tutflag); //sLog.outDebug("Received Tutorial Flag Set {%u}.", iFlag); } -void WorldSession::HandleTutorialClear( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleTutorialClear(WorldPacket & /*recv_data*/) { for (int i = 0; i < 8; ++i) - SetTutorialInt( i, 0xFFFFFFFF ); + SetTutorialInt(i, 0xFFFFFFFF); } -void WorldSession::HandleTutorialReset( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleTutorialReset(WorldPacket & /*recv_data*/) { for (int i = 0; i < 8; ++i) - SetTutorialInt( i, 0x00000000 ); + SetTutorialInt(i, 0x00000000); } void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data) @@ -908,13 +908,13 @@ void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data) _player->GetReputationMgr().SetInactive(replistid, inactive); } -void WorldSession::HandleShowingHelmOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleShowingHelmOpcode(WorldPacket & /*recv_data*/) { DEBUG_LOG("CMSG_SHOWING_HELM for %s", _player->GetName()); _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); } -void WorldSession::HandleShowingCloakOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleShowingCloakOpcode(WorldPacket & /*recv_data*/) { DEBUG_LOG("CMSG_SHOWING_CLOAK for %s", _player->GetName()); _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); @@ -933,7 +933,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_RENAME, 1); data << uint8(CHAR_NAME_NO_NAME); - SendPacket( &data ); + SendPacket(&data); return; } @@ -942,7 +942,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_RENAME, 1); data << uint8(res); - SendPacket( &data ); + SendPacket(&data); return; } @@ -951,7 +951,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_RENAME, 1); data << uint8(CHAR_NAME_RESERVED); - SendPacket( &data ); + SendPacket(&data); return; } @@ -964,7 +964,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) GetAccountId(), newname, "SELECT guid, name FROM characters WHERE guid = %d AND account = %d AND (at_login & %d) = %d AND NOT EXISTS (SELECT NULL FROM characters WHERE name = '%s')", GUID_LOPART(guid), GetAccountId(), AT_LOGIN_RENAME, AT_LOGIN_RENAME, escaped_newname.c_str() - ); +); } void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string newname) @@ -977,7 +977,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult_AutoPtr resu { WorldPacket data(SMSG_CHAR_RENAME, 1); data << uint8(CHAR_CREATE_ERROR); - session->SendPacket( &data ); + session->SendPacket(&data); return; } @@ -1084,7 +1084,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) SendPacket(&data); } -void WorldSession::HandleAlterAppearance( WorldPacket & recv_data ) +void WorldSession::HandleAlterAppearance(WorldPacket & recv_data) { sLog.outDebug("CMSG_ALTER_APPEARANCE"); @@ -1103,7 +1103,7 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data ) BarberShopStyleEntry const* bs_skinColor = sBarberShopStyleStore.LookupEntry(SkinColor); - if ( bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender())) + if (bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender())) return; uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor); @@ -1139,7 +1139,7 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data ) _player->SetStandState(0); // stand up } -void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data ) +void WorldSession::HandleRemoveGlyph(WorldPacket & recv_data) { uint32 slot; recv_data >> slot; @@ -1177,7 +1177,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(CHAR_CREATE_ERROR); - SendPacket( &data ); + SendPacket(&data); return; } @@ -1188,7 +1188,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(CHAR_CREATE_ERROR); - SendPacket( &data ); + SendPacket(&data); return; } @@ -1197,7 +1197,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(CHAR_NAME_NO_NAME); - SendPacket( &data ); + SendPacket(&data); return; } @@ -1206,7 +1206,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(res); - SendPacket( &data ); + SendPacket(&data); return; } @@ -1215,7 +1215,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(CHAR_NAME_RESERVED); - SendPacket( &data ); + SendPacket(&data); return; } @@ -1226,7 +1226,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(CHAR_CREATE_NAME_IN_USE); - SendPacket( &data ); + SendPacket(&data); return; } } @@ -1339,11 +1339,11 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) continue; ItemPosCountVec sDest; - uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sDest, uItem, false ); + uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sDest, uItem, false); if (msg == EQUIP_ERR_OK) { _player->RemoveItem(INVENTORY_SLOT_BAG_0, i, true); - _player->StoreItem( sDest, uItem, true ); + _player->StoreItem(sDest, uItem, true); } else _player->SendEquipError(msg, uItem, NULL); diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index a5ca1191bf8..e4175622250 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1642,7 +1642,7 @@ valid examples: expectedName += " "; expectedName += suffix[i]; } - if ( expectedName == buffer) + if (expectedName == buffer) { foundName = true; break; diff --git a/src/game/Chat.h b/src/game/Chat.h index 92f7d9b87a4..4b33c51f612 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -48,27 +48,27 @@ class ChatHandler explicit ChatHandler(Player* player) : m_session(player->GetSession()) {} ~ChatHandler() {} - static void FillMessageData( WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker); + static void FillMessageData(WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker); - void FillMessageData( WorldPacket *data, uint8 type, uint32 language, uint64 target_guid, const char* message) + void FillMessageData(WorldPacket *data, uint8 type, uint32 language, uint64 target_guid, const char* message) { - FillMessageData( data, m_session, type, language, NULL, target_guid, message, NULL); + FillMessageData(data, m_session, type, language, NULL, target_guid, message, NULL); } - void FillSystemMessageData( WorldPacket *data, const char* message ) + void FillSystemMessageData(WorldPacket *data, const char* message) { - FillMessageData( data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, 0, message ); + FillMessageData(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, 0, message); } static char* LineFromMessage(char*& pos) { char* start = strtok(pos,"\n"); pos = NULL; return start; } // function with different implementation for chat/console virtual const char *GetTrinityString(int32 entry) const; - virtual void SendSysMessage( const char *str); + virtual void SendSysMessage(const char *str); - void SendSysMessage( int32 entry); - void PSendSysMessage( const char *format, ...) ATTR_PRINTF(2,3); - void PSendSysMessage( int32 entry, ... ); + void SendSysMessage(int32 entry); + void PSendSysMessage(const char *format, ...) ATTR_PRINTF(2,3); + void PSendSysMessage(int32 entry, ...); std::string PGetParseString(int32 entry, ...); int ParseCommands(const char* text); @@ -94,7 +94,7 @@ class ChatHandler void SendGlobalGMSysMessage(const char *str); - static bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand ); + static bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand); bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcommand); bool ShowHelpForCommand(ChatCommand *table, const char* cmd); bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd); @@ -645,7 +645,7 @@ class CliHandler : public ChatHandler Print* m_print; }; -char const *fmtstring( char const *format, ... ); +char const *fmtstring(char const *format, ...); #endif diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index 5bef3131f65..30aaca4a6e8 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -62,7 +62,7 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg return true; } -void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) +void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) { uint32 type; uint32 lang; @@ -76,7 +76,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) return; } - //sLog.outDebug("CHAT: packet received. type %u, lang %u", type, lang ); + //sLog.outDebug("CHAT: packet received. type %u, lang %u", type, lang); // prevent talking at unknown language (cheating) LanguageDesc const* langDesc = GetLanguageDescByID(lang); @@ -252,11 +252,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) return; } - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER ) + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER) { uint32 sidea = GetPlayer()->GetTeam(); uint32 sideb = player->GetTeam(); - if ( sidea != sideb ) + if (sidea != sideb) { SendPlayerNotFoundNotice(to); return; @@ -566,7 +566,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) std::string msg; recv_data >> msg; - if ((msg.empty() || !_player->isAFK()) && !_player->isInCombat() ) + if ((msg.empty() || !_player->isAFK()) && !_player->isInCombat()) { if (!_player->isAFK()) { @@ -605,7 +605,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleEmoteOpcode( WorldPacket & recv_data ) +void WorldSession::HandleEmoteOpcode(WorldPacket & recv_data) { if (!GetPlayer()->isAlive()) return; @@ -633,7 +633,7 @@ namespace Trinity data << (uint32)i_text_emote; data << i_emote_num; data << (uint32)namlen; - if ( namlen > 1 ) + if (namlen > 1) data.append(nam, namlen); else data << (uint8)0x00; @@ -647,7 +647,7 @@ namespace Trinity }; } // namespace Trinity -void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data ) +void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) { if (!GetPlayer()->isAlive()) return; @@ -705,7 +705,7 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data ) ((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(), text_emote); } -void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data ) +void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data) { uint64 iguid; uint8 unk; diff --git a/src/game/CombatAI.cpp b/src/game/CombatAI.cpp index f1fe1423572..5dc54c46dfc 100644 --- a/src/game/CombatAI.cpp +++ b/src/game/CombatAI.cpp @@ -24,7 +24,7 @@ int AggressorAI::Permissible(const Creature *creature) { // have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight - if ( !creature->isCivilian() && !creature->IsNeutralToAll() ) + if (!creature->isCivilian() && !creature->IsNeutralToAll()) return PERMIT_BASE_PROACTIVE; return PERMIT_BASE_NO; diff --git a/src/game/CombatHandler.cpp b/src/game/CombatHandler.cpp index a10e59893b9..404b70c1c84 100644 --- a/src/game/CombatHandler.cpp +++ b/src/game/CombatHandler.cpp @@ -26,12 +26,12 @@ #include "CreatureAI.h" #include "ObjectDefines.h" -void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAttackSwingOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; - DEBUG_LOG( "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid) ); + DEBUG_LOG("WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid)); Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid); @@ -40,7 +40,7 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data ) if (!IS_UNIT_GUID(guid)) sLog.outError("WORLD: Object %u (TypeID: %u) isn't player, pet or creature",GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); else - sLog.outError( "WORLD: Enemy %s %u not found",GetLogNameForGuid(guid),GUID_LOPART(guid)); + sLog.outError("WORLD: Enemy %s %u not found",GetLogNameForGuid(guid),GUID_LOPART(guid)); // stop attack state at client SendAttackStop(NULL); @@ -49,7 +49,7 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data ) if (!_player->canAttack(pEnemy)) { - sLog.outError( "WORLD: Enemy %s %u is friendly",(IS_PLAYER_GUID(guid) ? "player" : "creature"),GUID_LOPART(guid)); + sLog.outError("WORLD: Enemy %s %u is friendly",(IS_PLAYER_GUID(guid) ? "player" : "creature"),GUID_LOPART(guid)); // stop attack state at client SendAttackStop(pEnemy); @@ -59,17 +59,17 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data ) _player->Attack(pEnemy,true); } -void WorldSession::HandleAttackStopOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleAttackStopOpcode(WorldPacket & /*recv_data*/) { GetPlayer()->AttackStop(); } -void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetSheathedOpcode(WorldPacket & recv_data) { uint32 sheathed; recv_data >> sheathed; - //sLog.outDebug( "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed ); + //sLog.outDebug("WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed); if (sheathed >= MAX_SHEATH_STATE) { @@ -82,7 +82,7 @@ void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data ) void WorldSession::SendAttackStop(Unit const* enemy) { - WorldPacket data( SMSG_ATTACKSTOP, (4+20) ); // we guess size + WorldPacket data(SMSG_ATTACKSTOP, (4+20)); // we guess size data.append(GetPlayer()->GetPackGUID()); data.append(enemy ? enemy->GetPackGUID() : 0); // must be packed guid data << uint32(0); // unk, can be 1 also diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp index a1c95c5c2a0..43c6052d2d3 100644 --- a/src/game/ConfusedMovementGenerator.cpp +++ b/src/game/ConfusedMovementGenerator.cpp @@ -125,13 +125,13 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff) if (unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) return true; - if ( i_nextMoveTime.Passed() ) + if (i_nextMoveTime.Passed()) { // currently moving, update location Traveller<T> traveller(unit); - if ( i_destinationHolder.UpdateTraveller(traveller, diff)) + if (i_destinationHolder.UpdateTraveller(traveller, diff)) { - if ( i_destinationHolder.HasArrived()) + if (i_destinationHolder.HasArrived()) { // arrived, stop and wait a bit unit.clearUnitState(UNIT_STAT_MOVE); @@ -145,10 +145,10 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff) { // waiting for next move i_nextMoveTime.Update(diff); - if ( i_nextMoveTime.Passed() ) + if (i_nextMoveTime.Passed()) { // start moving - assert( i_nextMove <= MAX_CONF_WAYPOINTS ); + assert(i_nextMove <= MAX_CONF_WAYPOINTS); const float x = i_waypoints[i_nextMove][0]; const float y = i_waypoints[i_nextMove][1]; const float z = i_waypoints[i_nextMove][2]; diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 3e658e9c5dc..510ea13e78b 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -68,14 +68,14 @@ void Corpse::RemoveFromWorld() Object::RemoveFromWorld(); } -bool Corpse::Create( uint32 guidlow, Map *map ) +bool Corpse::Create(uint32 guidlow, Map *map) { SetMap(map); Object::_Create(guidlow, 0, HIGHGUID_CORPSE); return true; } -bool Corpse::Create( uint32 guidlow, Player *owner) +bool Corpse::Create(uint32 guidlow, Player *owner) { ASSERT(owner); @@ -94,8 +94,8 @@ bool Corpse::Create( uint32 guidlow, Player *owner) WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask()); - SetFloatValue( OBJECT_FIELD_SCALE_X, 1 ); - SetUInt64Value( CORPSE_FIELD_OWNER, owner->GetGUID() ); + SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID()); m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); @@ -118,14 +118,14 @@ void Corpse::SaveToDB() << GetOrientation() << ", " << GetZoneId() << ", " << GetMapId() << ", '"; - for (uint16 i = 0; i < m_valuesCount; ++i ) + for (uint16 i = 0; i < m_valuesCount; ++i) ss << GetUInt32Value(i) << " "; ss << "'," << uint64(m_time) <<", " << uint32(GetType()) << ", " << int(GetInstanceId()) << ", " << uint16(GetPhaseMask()) << ")"; // prevent out of range error - CharacterDatabase.Execute( ss.str().c_str() ); + CharacterDatabase.Execute(ss.str().c_str()); CharacterDatabase.CommitTransaction(); } @@ -161,7 +161,7 @@ bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId) // 0 1 2 3 4 5 6 7 8 9 result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,data,time,corpse_type,instance,phaseMask FROM corpse WHERE guid = '%u'",guid); - if ( !result ) + if (!result) { sLog.outError("Corpse (GUID: %u) not found in table `corpse`, can't load. ",guid); return false; @@ -193,7 +193,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields) Object::_Create(guid, 0, HIGHGUID_CORPSE); - if (!LoadValues( fields[5].GetString() )) + if (!LoadValues(fields[5].GetString())) { sLog.outError("Corpse #%d have broken data in `data` field. Can't be loaded.",guid); return false; diff --git a/src/game/Corpse.h b/src/game/Corpse.h index 0f2331c8980..bab95e99d14 100644 --- a/src/game/Corpse.h +++ b/src/game/Corpse.h @@ -51,14 +51,14 @@ enum CorpseFlags class Corpse : public WorldObject, public GridObject<Corpse> { public: - explicit Corpse( CorpseType type = CORPSE_BONES ); - ~Corpse( ); + explicit Corpse(CorpseType type = CORPSE_BONES); + ~Corpse(); void AddToWorld(); void RemoveFromWorld(); - bool Create( uint32 guidlow, Map *map ); - bool Create( uint32 guidlow, Player *owner ); + bool Create(uint32 guidlow, Map *map); + bool Create(uint32 guidlow, Player *owner); void SaveToDB(); //bool LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 42557af7c99..24677237ac8 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -60,9 +60,9 @@ TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const return NULL; } -bool VendorItemData::RemoveItem( uint32 item_id ) +bool VendorItemData::RemoveItem(uint32 item_id) { - for (VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i ) + for (VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i) { if ((*i)->item==item_id) { @@ -83,7 +83,7 @@ size_t VendorItemData::FindItemSlot(uint32 item_id) const VendorItem const* VendorItemData::FindItem(uint32 item_id) const { - for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i ) + for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i) if ((*i)->item==item_id) return *i; return NULL; @@ -263,7 +263,7 @@ void Creature::RemoveCorpse() /** * change the entry of creature until respawn */ -bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) +bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data) { CreatureInfo const *normalInfo = objmgr.GetCreatureTemplate(Entry); if (!normalInfo) @@ -337,12 +337,12 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) SetName(normalInfo->Name); // at normal entry always SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,minfo->bounding_radius); - SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach ); + SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach); SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); - SetSpeed(MOVE_WALK, cinfo->speed_walk ); - SetSpeed(MOVE_RUN, cinfo->speed_run ); + SetSpeed(MOVE_WALK, cinfo->speed_walk); + SetSpeed(MOVE_RUN, cinfo->speed_run); SetSpeed(MOVE_SWIM, 1.0f); // using 1.0 rate SetSpeed(MOVE_FLIGHT, 1.0f); // using 1.0 rate @@ -359,7 +359,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) return true; } -bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) +bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data) { if (!InitEntry(Entry,team,data)) return false; @@ -449,19 +449,19 @@ void Creature::Update(uint32 diff) else m_GlobalCooldown -= diff; - switch( m_deathState ) + switch(m_deathState) { case JUST_ALIVED: // Don't must be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. - sLog.outError("Creature (GUID: %u Entry: %u ) in wrong state: JUST_ALIVED (4)",GetGUIDLow(),GetEntry()); + sLog.outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)",GetGUIDLow(),GetEntry()); break; case JUST_DIED: // Don't must be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. - sLog.outError("Creature (GUID: %u Entry: %u ) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry()); + sLog.outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry()); break; case DEAD: { - if ( m_respawnTime <= time(NULL) ) + if (m_respawnTime <= time(NULL)) { if (!GetLinkedCreatureRespawnTime()) // Can respawn Respawn(); @@ -519,7 +519,7 @@ void Creature::Update(uint32 diff) { if (m_isDeadByDefault) { - if ( m_deathTimer <= diff ) + if (m_deathTimer <= diff) { RemoveCorpse(); DEBUG_LOG("Removing alive corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY)); @@ -530,7 +530,7 @@ void Creature::Update(uint32 diff) } } - Unit::Update( diff ); + Unit::Update(diff); // creature can be dead after Unit::Update call // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) @@ -658,7 +658,7 @@ void Creature::RegenerateHealth() float HealthIncreaseRate = sWorld.getRate(RATE_HEALTH); float Spirit = GetStat(STAT_SPIRIT); - if ( GetPower(POWER_MANA) > 0 ) + if (GetPower(POWER_MANA) > 0) addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); else addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); @@ -835,15 +835,15 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const pPlayer->PlayerTalkClass->ClearMenus(); switch(GetCreatureInfo()->trainer_class) { - case CLASS_DRUID: pPlayer->PlayerTalkClass->SendGossipMenu( 4913,GetGUID()); break; + case CLASS_DRUID: pPlayer->PlayerTalkClass->SendGossipMenu(4913,GetGUID()); break; case CLASS_HUNTER: pPlayer->PlayerTalkClass->SendGossipMenu(10090,GetGUID()); break; - case CLASS_MAGE: pPlayer->PlayerTalkClass->SendGossipMenu( 328,GetGUID()); break; - case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu( 1635,GetGUID()); break; - case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu( 4436,GetGUID()); break; - case CLASS_ROGUE: pPlayer->PlayerTalkClass->SendGossipMenu( 4797,GetGUID()); break; - case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu( 5003,GetGUID()); break; - case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu( 5836,GetGUID()); break; - case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu( 4985,GetGUID()); break; + case CLASS_MAGE: pPlayer->PlayerTalkClass->SendGossipMenu(328,GetGUID()); break; + case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu(1635,GetGUID()); break; + case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu(4436,GetGUID()); break; + case CLASS_ROGUE: pPlayer->PlayerTalkClass->SendGossipMenu(4797,GetGUID()); break; + case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu(5003,GetGUID()); break; + case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu(5836,GetGUID()); break; + case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu(4985,GetGUID()); break; } } return false; @@ -872,7 +872,7 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const case RACE_ORC: pPlayer->PlayerTalkClass->SendGossipMenu(5863,GetGUID()); break; case RACE_TAUREN: pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break; case RACE_TROLL: pPlayer->PlayerTalkClass->SendGossipMenu(5816,GetGUID()); break; - case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu( 624,GetGUID()); break; + case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu(624,GetGUID()); break; case RACE_BLOODELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862,GetGUID()); break; case RACE_DRAENEI: pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break; } @@ -941,8 +941,8 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3 /* uint32 timeElap = getMSTime(); if ((timeElap - m_startMove) < m_moveTime) { - oX = (dX - oX) * ( (timeElap - m_startMove) / m_moveTime ); - oY = (dY - oY) * ( (timeElap - m_startMove) / m_moveTime ); + oX = (dX - oX) * ((timeElap - m_startMove) / m_moveTime); + oY = (dY - oY) * ((timeElap - m_startMove) / m_moveTime); } else { @@ -1087,7 +1087,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) << (m_isDeadByDefault ? 1 : 0) << "," //is_dead << GetDefaultMovementType() << ")"; //default movement generator type - WorldDatabase.PExecuteLog( ss.str( ).c_str( ) ); + WorldDatabase.PExecuteLog(ss.str().c_str()); WorldDatabase.CommitTransaction(); } @@ -1445,7 +1445,7 @@ float Creature::GetAttackDistance(Unit const* pl) const int32 leveldif = int32(playerlevel) - int32(creaturelevel); // "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob." - if ( leveldif < - 25) + if (leveldif < - 25) leveldif = -25; // "The aggro radius of a mob having the same level as the player is roughly 20 yards" @@ -1491,7 +1491,7 @@ void Creature::setDeathState(DeathState s) setActive(false); if (!isPet() && GetCreatureInfo()->SkinLootId) - if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) ) + if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId)) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); if (HasSearchedAssistance()) @@ -1589,7 +1589,7 @@ void Creature::Respawn(bool force) LoadCreaturesAddon(true); } else - setDeathState( JUST_ALIVED ); + setDeathState(JUST_ALIVED); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(GetNativeDisplayId()); if (minfo) // Cancel load if no model defined @@ -1657,7 +1657,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) { if (!m_spells[i]) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i] ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %i", m_spells[i]); @@ -1667,11 +1667,11 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) bool bcontinue = true; for (uint32 j=0; j<3; j++) { - if ( (spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ) || + if ((spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE) || (spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) || (spellInfo->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) || - (spellInfo->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ) - ) + (spellInfo->Effect[j] == SPELL_EFFECT_HEALTH_LEECH) +) { bcontinue = false; break; @@ -1685,9 +1685,9 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) float range = GetSpellMaxRangeForHostile(srange); float minrange = GetSpellMinRangeForHostile(srange); float dist = GetDistance(pVictim); - //if (!isInFront( pVictim, range ) && spellInfo->AttributesEx ) + //if (!isInFront(pVictim, range) && spellInfo->AttributesEx) // continue; - if ( dist > range || dist < minrange ) + if (dist > range || dist < minrange) continue; if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) continue; @@ -1707,7 +1707,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) { if (!m_spells[i]) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i] ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %i", m_spells[i]); @@ -1717,7 +1717,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) bool bcontinue = true; for (uint32 j=0; j<3; j++) { - if ( (spellInfo->Effect[j] == SPELL_EFFECT_HEAL ) ) + if ((spellInfo->Effect[j] == SPELL_EFFECT_HEAL)) { bcontinue = false; break; @@ -1729,11 +1729,11 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) continue; SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRangeForFriend(srange); - float minrange = GetSpellMinRangeForFriend( srange); + float minrange = GetSpellMinRangeForFriend(srange); float dist = GetDistance(pVictim); - //if (!isInFront( pVictim, range ) && spellInfo->AttributesEx ) + //if (!isInFront(pVictim, range) && spellInfo->AttributesEx) // continue; - if ( dist > range || dist < minrange ) + if (dist > range || dist < minrange) continue; if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) continue; @@ -1757,7 +1757,7 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const // Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0 if (pl->isAlive() || pl->GetDeathTimer() > 0) { - if ( GetEntry() == VISUAL_WAYPOINT ) + if (GetEntry() == VISUAL_WAYPOINT) return false; return (isAlive() || m_deathTimer > 0 || (m_isDeadByDefault && m_deathState==CORPSE)); } @@ -1819,7 +1819,7 @@ void Creature::SendAIReaction(AiReaction reactionType) void Creature::CallAssistance() { - if ( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed()) + if (!m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed()) { SetNoCallAssistance(true); @@ -2184,7 +2184,7 @@ time_t Creature::GetRespawnTimeEx() const return now; } -void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float* dist ) const +void Creature::GetRespawnCoord(float &x, float &y, float &z, float* ori, float* dist) const { if (m_DBTableGuid) { @@ -2282,12 +2282,12 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) time_t ptime = time(NULL); - if ( vCount->lastIncrementTime + vItem->incrtime <= ptime ) + if (vCount->lastIncrementTime + vItem->incrtime <= ptime) { ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); - if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount ) + if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount) { m_vendorItemCounts.erase(itr); return vItem->maxcount; @@ -2321,12 +2321,12 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us time_t ptime = time(NULL); - if ( vCount->lastIncrementTime + vItem->incrtime <= ptime ) + if (vCount->lastIncrementTime + vItem->incrtime <= ptime) { ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); - if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount ) + if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount) vCount->count += diff * pProto->BuyCount; else vCount->count = vItem->maxcount; diff --git a/src/game/Creature.h b/src/game/Creature.h index 0a07c17b77b..047cfe8ae7f 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -59,7 +59,7 @@ enum CreatureFlagsExtra }; // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack(1) #else #pragma pack(push,1) @@ -298,7 +298,7 @@ enum ChatType }; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack() #else #pragma pack(pop) @@ -328,11 +328,11 @@ struct VendorItemData } bool Empty() const { return m_items.empty(); } uint8 GetItemCount() const { return m_items.size(); } - void AddItem( uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost) + void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost) { m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost)); } - bool RemoveItem( uint32 item_id ); + bool RemoveItem(uint32 item_id); VendorItem const* FindItem(uint32 item_id) const; size_t FindItemSlot(uint32 item_id) const; @@ -415,7 +415,7 @@ class Creature : public Unit, public GridObject<Creature> uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } char const* GetSubName() const { return GetCreatureInfo()->SubName; } - void Update( uint32 time ); // overwrited Unit::Update + void Update(uint32 time); // overwrited Unit::Update void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; uint32 GetEquipmentId() const { return GetCreatureInfo()->equipmentId; } diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index fb11f63ee55..bdd78f0fa63 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -164,7 +164,7 @@ void CreatureAI::EnterEvadeMode() me->GetVehicleKit()->Reset(); } -/*void CreatureAI::AttackedBy( Unit* attacker ) +/*void CreatureAI::AttackedBy(Unit* attacker) { if (!m_creature->getVictim()) AttackStart(attacker); diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index 66aa2f2785f..3f4b6e9b3f2 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -110,7 +110,7 @@ class CreatureAI : public UnitAI virtual void KilledUnit(Unit *) {} // Called when the creature summon successfully other creature - virtual void JustSummoned(Creature* ) {} + virtual void JustSummoned(Creature*) {} virtual void IsSummonedBy(Unit *summoner) {} virtual void SummonedCreatureDespawn(Creature* /*unit*/) {} @@ -153,7 +153,7 @@ class CreatureAI : public UnitAI //virtual void AttackStart(Unit *) {} // Called at World update tick - //virtual void UpdateAI(const uint32 diff ) {} + //virtual void UpdateAI(const uint32 diff) {} ///== State checks ================================= diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index 257e2966c30..1653dad9b18 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -49,7 +49,7 @@ namespace FactorySelector // AIname in db std::string ainame=creature->GetAIName(); if (!ai_factory && !ainame.empty()) - ai_factory = ai_registry.GetRegistryItem( ainame.c_str() ); + ai_factory = ai_registry.GetRegistryItem(ainame.c_str()); // select by NPC flags if (!ai_factory) @@ -85,9 +85,9 @@ namespace FactorySelector { const CreatureAICreator *factory = iter->second; const SelectableAI *p = dynamic_cast<const SelectableAI *>(factory); - assert( p != NULL ); + assert(p != NULL); int val = p->Permit(creature); - if ( val > best_val ) + if (val > best_val) { best_val = val; ai_factory = p; @@ -98,17 +98,17 @@ namespace FactorySelector // select NullCreatureAI if not another cases ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key(); - DEBUG_LOG("Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str() ); - return ( ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature) ); + DEBUG_LOG("Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str()); + return (ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature)); } MovementGenerator* selectMovementGenerator(Creature *creature) { MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance()); - assert( creature->GetCreatureInfo() != NULL ); - const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem( creature->GetDefaultMovementType()); + assert(creature->GetCreatureInfo() != NULL); + const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType()); - /* if ( mv_factory == NULL ) + /* if (mv_factory == NULL) { int best_val = -1; std::vector<std::string> l; @@ -117,9 +117,9 @@ namespace FactorySelector { const MovementGeneratorCreator *factory = mv_registry.GetRegistryItem((*iter).c_str()); const SelectableMovement *p = dynamic_cast<const SelectableMovement *>(factory); - assert( p != NULL ); + assert(p != NULL); int val = p->Permit(creature); - if ( val > best_val ) + if (val > best_val) { best_val = val; mv_factory = p; @@ -127,7 +127,7 @@ namespace FactorySelector } }*/ - return ( mv_factory == NULL ? NULL : mv_factory->Create(creature) ); + return (mv_factory == NULL ? NULL : mv_factory->Create(creature)); } } diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 74ed23304f6..41837faaf4c 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -56,7 +56,7 @@ int CreatureEventAI::Permissible(const Creature *creature) return PERMIT_BASE_NO; } -CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) +CreatureEventAI::CreatureEventAI(Creature *c) : CreatureAI(c) { // Need make copy for filter unneeded steps and safe in case table reload CreatureEventAI_Event_Map::const_iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(m_creature->GetEntry()); @@ -514,7 +514,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); if (!pCreature) - sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry()); + sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry()); else if (action.summon.target != TARGET_T_SELF && target) pCreature->AI()->AttackStart(target); break; @@ -610,12 +610,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 int32 new_phase = int32(Phase)+action.set_inc_phase.step; if (new_phase < 0) { - sLog.outErrorDb( "CreatureEventAI: Event %d decrease Phase under 0. CreatureEntry = %d", EventId, m_creature->GetEntry()); + sLog.outErrorDb("CreatureEventAI: Event %d decrease Phase under 0. CreatureEntry = %d", EventId, m_creature->GetEntry()); Phase = 0; } else if (new_phase >= MAX_PHASE) { - sLog.outErrorDb( "CreatureEventAI: Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE-1, MAX_PHASE-1, m_creature->GetEntry()); + sLog.outErrorDb("CreatureEventAI: Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE-1, MAX_PHASE-1, m_creature->GetEntry()); Phase = MAX_PHASE-1; } else @@ -666,7 +666,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (action.random_phase_range.phaseMin <= action.random_phase_range.phaseMax) Phase = urand(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax); else - sLog.outErrorDb( "CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); + sLog.outErrorDb("CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); break; case ACTION_T_SUMMON_ID: { @@ -675,7 +675,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 CreatureEventAI_Summon_Map::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId); if (i == CreatureEAI_Mgr.GetCreatureEventAISummonMap().end()) { - sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, m_creature->GetEntry()); + sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, m_creature->GetEntry()); return; } @@ -686,7 +686,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 pCreature = m_creature->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); if (!pCreature) - sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry()); + sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry()); else if (action.summon_id.target != TARGET_T_SELF && target) pCreature->AI()->AttackStart(target); @@ -1339,7 +1339,7 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote) } } -void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage ) +void CreatureEventAI::DamageTaken(Unit* done_by, uint32& damage) { if (InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage) { diff --git a/src/game/CreatureGroups.cpp b/src/game/CreatureGroups.cpp index 2af4b1cce03..6c688ab316f 100644 --- a/src/game/CreatureGroups.cpp +++ b/src/game/CreatureGroups.cpp @@ -82,7 +82,7 @@ void CreatureGroupManager::LoadCreatureFormations() if (!result) { - sLog.outErrorDb(" ...an error occured while loading the table creature_formations ( maybe it doesn't exist ?)\n"); + sLog.outErrorDb(" ...an error occured while loading the table creature_formations (maybe it doesn't exist ?)\n"); return; } @@ -96,7 +96,7 @@ void CreatureGroupManager::LoadCreatureFormations() } uint32 total_records = result->GetRowCount(); - barGoLink bar( total_records); + barGoLink bar(total_records); Field *fields; FormationInfo *group_member; @@ -147,7 +147,7 @@ void CreatureGroupManager::LoadCreatureFormations() while (result->NextRow()) ; sLog.outString(); - sLog.outString( ">> Loaded %u creatures in formations", total_records ); + sLog.outString(">> Loaded %u creatures in formations", total_records); sLog.outString(); } diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index f6a7671b1b0..9b3662202c5 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -235,8 +235,8 @@ void LoadDBCStores(const std::string& dataPath) // fill AreaId->DBC records sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag)); - // fill MapId->DBC records ( skip sub zones and continents ) - if (area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 ) + // fill MapId->DBC records (skip sub zones and continents) + if (area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571) sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid,area->exploreFlag)); } } @@ -413,7 +413,7 @@ void LoadDBCStores(const std::string& dataPath) // now have all max ranks (and then bit amount used for store talent ranks in inspect) for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId) { - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId ); + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentTabId); if (!talentTabInfo) continue; @@ -518,12 +518,12 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc"); // error checks - if (bad_dbc_files.size() >= DBCFilesCount ) + if (bad_dbc_files.size() >= DBCFilesCount) { sLog.outError("\nIncorrect DataDir value in Trinityd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str()); exit(1); } - else if (!bad_dbc_files.empty() ) + else if (!bad_dbc_files.empty()) { std::string str; for (std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i) @@ -534,19 +534,19 @@ void LoadDBCStores(const std::string& dataPath) } // Check loaded DBC files proper version - if ( !sSpellStore.LookupEntry(74445) || // last added spell in 3.3.2 + if (!sSpellStore.LookupEntry(74445) || // last added spell in 3.3.2 !sMapStore.LookupEntry(718) || // last map added in 3.3.2 !sGemPropertiesStore.LookupEntry(1629) || // last gem property added in 3.3.2 !sItemExtendedCostStore.LookupEntry(2982) || // last item extended cost added in 3.3.2 !sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.2 !sAreaStore.LookupEntry(3461) || // last area (areaflag) added in 3.3.2 - !sItemStore.LookupEntry(52686) ) // last client known item added in 3.3.2 + !sItemStore.LookupEntry(52686)) // last client known item added in 3.3.2 { sLog.outError("\nYou have _outdated_ DBC files. Please extract correct versions from current using client."); exit(1); } sLog.outString(); - sLog.outString( ">> Initialized %d data stores", DBCFilesCount ); + sLog.outString(">> Initialized %d data stores", DBCFilesCount); } SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember) @@ -728,7 +728,7 @@ MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) return itr != sMapDifficultyMap.end() ? &itr->second : NULL; } -PvPDifficultyEntry const* GetBattlegroundBracketByLevel( uint32 mapid, uint32 level ) +PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level) { // prevent out-of-range levels for dbc data if (level > DEFAULT_MAX_LEVEL) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index f369e86a4b2..8c38c9ca3a3 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -32,7 +32,7 @@ // Structures using to access raw DBC data and required packing to portability // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack(1) #else #pragma pack(push,1) @@ -1863,7 +1863,7 @@ struct WorldSafeLocsEntry }; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack() #else #pragma pack(pop) diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp index 2f827610657..93a283adaad 100644 --- a/src/game/Debugcmds.cpp +++ b/src/game/Debugcmds.cpp @@ -626,7 +626,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args) } if (item->GetState() == ITEM_REMOVED) continue; - Item *test = player->GetItemByPos( item->GetBagSlot(), item->GetSlot()); + Item *test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot()); if (test == NULL) { @@ -896,7 +896,7 @@ bool ChatHandler::HandleDebugItemExpireCommand(const char* args) if (!i) return false; - m_session->GetPlayer()->DestroyItem( i->GetBagSlot(),i->GetSlot(), true); + m_session->GetPlayer()->DestroyItem(i->GetBagSlot(),i->GetSlot(), true); sScriptMgr.ItemExpire(m_session->GetPlayer(),i->GetProto()); return true; @@ -980,14 +980,14 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args) { iValue = (uint32)atoi(py); sLog.outDebug(GetTrinityString(LANG_SET_UINT), GUID_LOPART(guid), Opcode, iValue); - target->SetUInt32Value( Opcode , iValue ); + target->SetUInt32Value(Opcode , iValue); PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), Opcode,iValue); } else { fValue = (float)atof(py); sLog.outDebug(GetTrinityString(LANG_SET_FLOAT), GUID_LOPART(guid), Opcode, fValue); - target->SetFloatValue( Opcode , fValue ); + target->SetFloatValue(Opcode , fValue); PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode,fValue); } @@ -1029,13 +1029,13 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args) if (isint32) { - iValue = target->GetUInt32Value( Opcode ); + iValue = target->GetUInt32Value(Opcode); sLog.outDebug(GetTrinityString(LANG_GET_UINT), GUID_LOPART(guid), Opcode, iValue); PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue); } else { - fValue = target->GetFloatValue( Opcode ); + fValue = target->GetFloatValue(Opcode); sLog.outDebug(GetTrinityString(LANG_GET_FLOAT), GUID_LOPART(guid), Opcode, fValue); PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue); } @@ -1059,16 +1059,16 @@ bool ChatHandler::HandleDebugMod32ValueCommand(const char* args) if (Opcode >= m_session->GetPlayer()->GetValuesCount()) { - PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, m_session->GetPlayer()->GetGUIDLow(), m_session->GetPlayer( )->GetValuesCount()); + PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, m_session->GetPlayer()->GetGUIDLow(), m_session->GetPlayer()->GetValuesCount()); return false; } sLog.outDebug(GetTrinityString(LANG_CHANGE_32BIT), Opcode, Value); - int CurrentValue = (int)m_session->GetPlayer( )->GetUInt32Value( Opcode ); + int CurrentValue = (int)m_session->GetPlayer()->GetUInt32Value(Opcode); CurrentValue += Value; - m_session->GetPlayer( )->SetUInt32Value( Opcode , (uint32)CurrentValue ); + m_session->GetPlayer()->SetUInt32Value(Opcode , (uint32)CurrentValue); PSendSysMessage(LANG_CHANGE_32BIT_FIELD, Opcode,CurrentValue); diff --git a/src/game/DestinationHolderImp.h b/src/game/DestinationHolderImp.h index 116209ca5dc..95ff90a6a2a 100644 --- a/src/game/DestinationHolderImp.h +++ b/src/game/DestinationHolderImp.h @@ -36,7 +36,7 @@ DestinationHolder<TRAVELLER>::_findOffSetPoint(float x1, float y1, float x2, flo * hence x = x2 - (offset/d)*(x2-x1) * like wise offset/d = (y2-y)/(y2-y1); */ - if ( offset == 0 ) + if (offset == 0) { x = x2; y = y2; @@ -198,7 +198,7 @@ template<typename TRAVELLER> void DestinationHolder<TRAVELLER>::GetLocationNowNoMicroMovement(float &x, float &y, float &z) const { - if ( HasArrived() ) + if (HasArrived()) { x = i_destX; y = i_destY; diff --git a/src/game/DuelHandler.cpp b/src/game/DuelHandler.cpp index 0014802b1cb..99c8a774b03 100644 --- a/src/game/DuelHandler.cpp +++ b/src/game/DuelHandler.cpp @@ -43,7 +43,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0) return; - //sLog.outDebug( "WORLD: received CMSG_DUEL_ACCEPTED" ); + //sLog.outDebug("WORLD: received CMSG_DUEL_ACCEPTED"); DEBUG_LOG("Player 1 is: %u (%s)", pl->GetGUIDLow(),pl->GetName()); DEBUG_LOG("Player 2 is: %u (%s)", plTarget->GetGUIDLow(),plTarget->GetName()); @@ -57,7 +57,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket) { - //sLog.outDebug( "WORLD: received CMSG_DUEL_CANCELLED" ); + //sLog.outDebug("WORLD: received CMSG_DUEL_CANCELLED"); // no duel requested if (!GetPlayer()->duel) diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index 16b0e3b5a2b..48179190a6e 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -86,18 +86,18 @@ bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, const P WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask()); SetEntry(spellId); - SetFloatValue( OBJECT_FIELD_SCALE_X, 1 ); - SetUInt64Value( DYNAMICOBJECT_CASTER, caster->GetGUID() ); + SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID()); // The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden // by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane. // If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but // precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells // I saw sniffed... - SetUInt32Value( DYNAMICOBJECT_BYTES, 0x00000001 ); - SetUInt32Value( DYNAMICOBJECT_SPELLID, spellId ); - SetFloatValue( DYNAMICOBJECT_RADIUS, radius ); - SetUInt32Value( DYNAMICOBJECT_CASTTIME, getMSTime() ); + SetUInt32Value(DYNAMICOBJECT_BYTES, 0x00000001); + SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId); + SetFloatValue(DYNAMICOBJECT_RADIUS, radius); + SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime()); m_isWorldObject = active; return true; diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp index 1d50de1b1a7..407a45389ec 100644 --- a/src/game/FleeingMovementGenerator.cpp +++ b/src/game/FleeingMovementGenerator.cpp @@ -32,10 +32,10 @@ template<class T> void FleeingMovementGenerator<T>::_setTargetLocation(T &owner) { - if ( !&owner ) + if (!&owner) return; - if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) ) + if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) return; if (!_setMoveData(owner)) @@ -161,7 +161,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) temp_y = y + distance * sin(angle); Trinity::NormalizeMapCoord(temp_x); Trinity::NormalizeMapCoord(temp_y); - if ( owner.IsWithinLOS(temp_x,temp_y,z)) + if (owner.IsWithinLOS(temp_x,temp_y,z)) { bool is_water_now = _map->IsInWater(x,y,z); @@ -181,7 +181,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) if ((is_water_now && !is_water_next && !is_land_ok) || (!is_water_now && is_water_next && !is_water_ok)) continue; - if ( !(new_z - z) || distance / fabs(new_z - z) > 1.0f) + if (!(new_z - z) || distance / fabs(new_z - z) > 1.0f) { float new_z_left = _map->GetHeight(temp_x + 1.0f*cos(angle+M_PI/2),temp_y + 1.0f*sin(angle+M_PI/2),z,true); float new_z_right = _map->GetHeight(temp_x + 1.0f*cos(angle-M_PI/2),temp_y + 1.0f*sin(angle-M_PI/2),z,true); @@ -196,7 +196,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) } } i_to_distance_from_caster = 0.0f; - i_nextCheckTime.Reset( urand(500,1000) ); + i_nextCheckTime.Reset(urand(500,1000)); return false; } @@ -215,12 +215,12 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner) (i_last_distance_from_caster < i_to_distance_from_caster && cur_dist_xyz > i_to_distance_from_caster) || // if we reach bigger distance (cur_dist_xyz > MAX_QUIET_DISTANCE) || // if we are too far - (i_last_distance_from_caster > MIN_QUIET_DISTANCE && cur_dist_xyz < MIN_QUIET_DISTANCE) ) + (i_last_distance_from_caster > MIN_QUIET_DISTANCE && cur_dist_xyz < MIN_QUIET_DISTANCE)) // if we leave 'quiet zone' { // we are very far or too close, stopping i_to_distance_from_caster = 0.0f; - i_nextCheckTime.Reset( urand(500,1000) ); + i_nextCheckTime.Reset(urand(500,1000)); return false; } else @@ -369,16 +369,16 @@ template<class T> bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff) { - if ( !&owner || !owner.isAlive() ) + if (!&owner || !owner.isAlive()) return false; - if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) ) + if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) return true; Traveller<T> traveller(owner); i_nextCheckTime.Update(time_diff); - if ( (owner.IsStopped() && !i_destinationHolder.HasArrived()) || !i_destinationHolder.HasDestination() ) + if ((owner.IsStopped() && !i_destinationHolder.HasArrived()) || !i_destinationHolder.HasDestination()) { _setTargetLocation(owner); return true; @@ -427,10 +427,10 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner) bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 & time_diff) { - if ( !owner.isAlive() ) + if (!owner.isAlive()) return false; - if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) ) + if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) return true; i_totalFleeTime.Update(time_diff); diff --git a/src/game/Formulas.h b/src/game/Formulas.h index d9103276d76..672f16663d1 100644 --- a/src/game/Formulas.h +++ b/src/game/Formulas.h @@ -114,7 +114,7 @@ namespace Trinity { if (u->GetTypeId() == TYPEID_UNIT && ( ((Creature*)u)->isTotem() || ((Creature*)u)->isPet() || - (((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) )) + (((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL))) return 0; uint32 xp_gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(),u->GetZoneId())); diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 3f96b7fd9d8..fda9c71316c 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -60,7 +60,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const time_t currenttime = time(NULL); for (std::set<uint16>::const_iterator itr = mGameEvent[entry].prerequisite_events.begin(); itr != mGameEvent[entry].prerequisite_events.end(); ++itr) { - if ( (mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one + if ((mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one mGameEvent[*itr].nextstart > currenttime) // if not in nextphase state for long enough, can't start this one return false; } @@ -119,7 +119,7 @@ void GameEventMgr::StartInternalEvent(uint16 event_id) StartEvent(event_id); } -bool GameEventMgr::StartEvent( uint16 event_id, bool overwrite ) +bool GameEventMgr::StartEvent(uint16 event_id, bool overwrite) { if (mGameEvent[event_id].state == GAMEEVENT_NORMAL || mGameEvent[event_id].state == GAMEEVENT_INTERNAL) @@ -136,7 +136,7 @@ bool GameEventMgr::StartEvent( uint16 event_id, bool overwrite ) } else { - if ( mGameEvent[event_id].state == GAMEEVENT_WORLD_INACTIVE ) + if (mGameEvent[event_id].state == GAMEEVENT_WORLD_INACTIVE) // set to conditions phase mGameEvent[event_id].state = GAMEEVENT_WORLD_CONDITIONS; @@ -159,7 +159,7 @@ bool GameEventMgr::StartEvent( uint16 event_id, bool overwrite ) } } -void GameEventMgr::StopEvent( uint16 event_id, bool overwrite ) +void GameEventMgr::StopEvent(uint16 event_id, bool overwrite) { bool serverwide_evt = mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL; @@ -265,10 +265,10 @@ void GameEventMgr::LoadFromDB() pGameEvent.description = fields[6].GetCppString(); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u game events", count ); + sLog.outString(">> Loaded %u game events", count); } // load game event saves @@ -285,12 +285,12 @@ void GameEventMgr::LoadFromDB() bar2.step(); sLog.outString(); - sLog.outString(">> Loaded %u game event saves in game events", count ); + sLog.outString(">> Loaded %u game event saves in game events", count); } else { - barGoLink bar2( result->GetRowCount() ); + barGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -318,9 +318,9 @@ void GameEventMgr::LoadFromDB() ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u game event saves in game events", count ); + sLog.outString(">> Loaded %u game event saves in game events", count); } // load game event links (prerequisites) @@ -334,12 +334,12 @@ void GameEventMgr::LoadFromDB() bar2.step(); sLog.outString(); - sLog.outString(">> Loaded %u game event prerequisites in game events", count ); + sLog.outString(">> Loaded %u game event prerequisites in game events", count); } else { - barGoLink bar2( result->GetRowCount() ); + barGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -374,7 +374,7 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u game event prerequisites in game events", count ); + sLog.outString(">> Loaded %u game event prerequisites in game events", count); } // Creatures @@ -387,18 +387,18 @@ void GameEventMgr::LoadFromDB() "FROM creature JOIN game_event_creature ON creature.guid = game_event_creature.guid"); count = 0; - if ( !result ) + if (!result) { barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString(">> Loaded %u creatures in game events", count ); + sLog.outString(">> Loaded %u creatures in game events", count); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -420,10 +420,10 @@ void GameEventMgr::LoadFromDB() GuidList& crelist = mGameEventCreatureGuids[internal_event_id]; crelist.push_back(guid); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u creatures in game events", count ); + sLog.outString(">> Loaded %u creatures in game events", count); } // Gameobjects @@ -436,18 +436,18 @@ void GameEventMgr::LoadFromDB() "FROM gameobject JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid"); count = 0; - if ( !result ) + if (!result) { barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString(">> Loaded %u gameobjects in game events", count ); + sLog.outString(">> Loaded %u gameobjects in game events", count); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -469,10 +469,10 @@ void GameEventMgr::LoadFromDB() GuidList& golist = mGameEventGameobjectGuids[internal_event_id]; golist.push_back(guid); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u gameobjects in game events", count ); + sLog.outString(">> Loaded %u gameobjects in game events", count); } // Model/Equipment Changes @@ -487,18 +487,18 @@ void GameEventMgr::LoadFromDB() "FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid"); count = 0; - if ( !result ) + if (!result) { barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString(">> Loaded %u model/equipment changes in game events", count ); + sLog.outString(">> Loaded %u model/equipment changes in game events", count); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -532,10 +532,10 @@ void GameEventMgr::LoadFromDB() equiplist.push_back(std::pair<uint32, ModelEquip>(guid, newModelEquipSet)); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u model/equipment changes in game events", count ); + sLog.outString(">> Loaded %u model/equipment changes in game events", count); } // Quests @@ -547,18 +547,18 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_creature_quest"); count = 0; - if ( !result ) + if (!result) { barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString(">> Loaded %u quests additions in game events", count ); + sLog.outString(">> Loaded %u quests additions in game events", count); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -578,9 +578,9 @@ void GameEventMgr::LoadFromDB() QuestRelList& questlist = mGameEventCreatureQuests[event_id]; questlist.push_back(QuestRelation(id, quest)); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u quests additions in game events", count ); + sLog.outString(">> Loaded %u quests additions in game events", count); } // GO Quests @@ -592,18 +592,18 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_gameobject_quest"); count = 0; - if ( !result ) + if (!result) { barGoLink bar3(1); bar3.step(); sLog.outString(); - sLog.outString(">> Loaded %u go quests additions in game events", count ); + sLog.outString(">> Loaded %u go quests additions in game events", count); } else { - barGoLink bar3( result->GetRowCount() ); + barGoLink bar3(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -623,10 +623,10 @@ void GameEventMgr::LoadFromDB() QuestRelList& questlist = mGameEventGameObjectQuests[event_id]; questlist.push_back(QuestRelation(id, quest)); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u quests additions in game events", count ); + sLog.outString(">> Loaded %u quests additions in game events", count); } // Load quest to (event,condition) mapping @@ -636,18 +636,18 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT quest, event_id, condition_id, num FROM game_event_quest_condition"); count = 0; - if ( !result ) + if (!result) { barGoLink bar3(1); bar3.step(); sLog.outString(); - sLog.outString(">> Loaded %u quest event conditions in game events", count ); + sLog.outString(">> Loaded %u quest event conditions in game events", count); } else { - barGoLink bar3( result->GetRowCount() ); + barGoLink bar3(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -669,9 +669,9 @@ void GameEventMgr::LoadFromDB() mQuestToEventConditions[quest].condition = condition; mQuestToEventConditions[quest].num = num; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u quest event conditions in game events", count ); + sLog.outString(">> Loaded %u quest event conditions in game events", count); } // load conditions of the events @@ -682,18 +682,18 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT event_id, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition"); count = 0; - if ( !result ) + if (!result) { barGoLink bar3(1); bar3.step(); sLog.outString(); - sLog.outString(">> Loaded %u conditions in game events", count ); + sLog.outString(">> Loaded %u conditions in game events", count); } else { - barGoLink bar3( result->GetRowCount() ); + barGoLink bar3(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -715,9 +715,9 @@ void GameEventMgr::LoadFromDB() ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u conditions in game events", count ); + sLog.outString(">> Loaded %u conditions in game events", count); } // load condition saves @@ -728,18 +728,18 @@ void GameEventMgr::LoadFromDB() result = CharacterDatabase.Query("SELECT event_id, condition_id, done FROM game_event_condition_save"); count = 0; - if ( !result ) + if (!result) { barGoLink bar3(1); bar3.step(); sLog.outString(); - sLog.outString(">> Loaded %u condition saves in game events", count ); + sLog.outString(">> Loaded %u condition saves in game events", count); } else { - barGoLink bar3( result->GetRowCount() ); + barGoLink bar3(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -767,9 +767,9 @@ void GameEventMgr::LoadFromDB() ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u condition saves in game events", count ); + sLog.outString(">> Loaded %u condition saves in game events", count); } mGameEventNPCFlags.resize(mGameEvent.size()); @@ -781,18 +781,18 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT guid, event_id, npcflag FROM game_event_npcflag"); count = 0; - if ( !result ) + if (!result) { barGoLink bar3(1); bar3.step(); sLog.outString(); - sLog.outString(">> Loaded %u npcflags in game events", count ); + sLog.outString(">> Loaded %u npcflags in game events", count); } else { - barGoLink bar3( result->GetRowCount() ); + barGoLink bar3(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -812,9 +812,9 @@ void GameEventMgr::LoadFromDB() ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u npcflags in game events", count ); + sLog.outString(">> Loaded %u npcflags in game events", count); } // Vendor @@ -826,18 +826,18 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT event, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor"); count = 0; - if ( !result ) + if (!result) { barGoLink bar3(1); bar3.step(); sLog.outString(); - sLog.outString(">> Loaded %u vendor additions in game events", count ); + sLog.outString(">> Loaded %u vendor additions in game events", count); } else { - barGoLink bar3( result->GetRowCount() ); + barGoLink bar3(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -872,7 +872,7 @@ void GameEventMgr::LoadFromDB() // get creature entry newEntry.entry = 0; - if ( CreatureData const* data = objmgr.GetCreatureData(guid) ) + if (CreatureData const* data = objmgr.GetCreatureData(guid)) newEntry.entry = data->id; // check validity with event's npcflag @@ -881,9 +881,9 @@ void GameEventMgr::LoadFromDB() ++count; vendors.push_back(newEntry); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u vendor additions in game events", count ); + sLog.outString(">> Loaded %u vendor additions in game events", count); } // load game event npc gossip ids @@ -894,18 +894,18 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT guid, event_id, textid FROM game_event_npc_gossip"); count = 0; - if ( !result ) + if (!result) { barGoLink bar3(1); bar3.step(); sLog.outString(); - sLog.outString(">> Loaded %u npc gossip textids in game events", count ); + sLog.outString(">> Loaded %u npc gossip textids in game events", count); } else { - barGoLink bar3( result->GetRowCount() ); + barGoLink bar3(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -925,9 +925,9 @@ void GameEventMgr::LoadFromDB() ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u npc gossip textids in game events", count ); + sLog.outString(">> Loaded %u npc gossip textids in game events", count); } // set all flags to 0 @@ -940,18 +940,18 @@ void GameEventMgr::LoadFromDB() result = WorldDatabase.Query("SELECT event, bgflag FROM game_event_battleground_holiday"); count = 0; - if ( !result ) + if (!result) { barGoLink bar3(1); bar3.step(); sLog.outString(); - sLog.outString(">> Loaded %u battleground holidays in game events", count ); + sLog.outString(">> Loaded %u battleground holidays in game events", count); } else { - barGoLink bar3( result->GetRowCount() ); + barGoLink bar3(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -970,9 +970,9 @@ void GameEventMgr::LoadFromDB() mGameEventBattleGroundHolidays[event_id] = fields[1].GetUInt32(); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u battleground holidays in game events", count ); + sLog.outString(">> Loaded %u battleground holidays in game events", count); } //////////////////////// @@ -988,18 +988,18 @@ void GameEventMgr::LoadFromDB() "FROM pool_template JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry"); count = 0; - if ( !result ) + if (!result) { barGoLink bar2(1); bar2.step(); sLog.outString(); - sLog.outString(">> Loaded %u pools in game events", count ); + sLog.outString(">> Loaded %u pools in game events", count); } else { - barGoLink bar2( result->GetRowCount() ); + barGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -1027,9 +1027,9 @@ void GameEventMgr::LoadFromDB() IdList& poollist = mGameEventPoolIds[internal_event_id]; poollist.push_back(entry); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u pools in game events", count ); + sLog.outString(">> Loaded %u pools in game events", count); } } @@ -1063,7 +1063,7 @@ uint32 GameEventMgr::Initialize() // return the next e { m_ActiveEvents.clear(); uint32 delay = Update(); - sLog.outBasic("Game Event system initialized." ); + sLog.outBasic("Game Event system initialized."); isSystemInit = true; return delay; } @@ -1194,7 +1194,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) for (NPCFlagList::iterator itr = mGameEventNPCFlags[event_id].begin(); itr != mGameEventNPCFlags[event_id].end(); ++itr) { // get the creature data from the low guid to get the entry, to be able to find out the whole guid - if ( CreatureData const* data = objmgr.GetCreatureData(itr->first) ) + if (CreatureData const* data = objmgr.GetCreatureData(itr->first)) { Creature * cr = HashMapHolder<Creature>::Find(MAKE_NEW_GUID(itr->first,data->id,HIGHGUID_UNIT)); // if we found the creature, modify its npcflag @@ -1215,7 +1215,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) void GameEventMgr::UpdateBattleGroundSettings() { uint32 mask = 0; - for (ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr ) + for (ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr) mask |= mGameEventBattleGroundHolidays[*itr]; sBattleGroundMgr.SetHolidayWeekends(mask); } @@ -1317,14 +1317,14 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin(); itr != mGameEventCreatureGuids[internal_event_id].end(); ++itr) { // check if it's needed by another event, if so, don't remove - if ( event_id > 0 && hasCreatureActiveEventExcept(*itr,event_id) ) + if (event_id > 0 && hasCreatureActiveEventExcept(*itr,event_id)) continue; // Remove the creature from grid - if ( CreatureData const* data = objmgr.GetCreatureData(*itr) ) + if (CreatureData const* data = objmgr.GetCreatureData(*itr)) { objmgr.RemoveCreatureFromGrid(*itr, data); - if ( Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL) ) + if (Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL)) pCreature->AddObjectToRemoveList(); } } @@ -1338,14 +1338,14 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr) { // check if it's needed by another event, if so, don't remove - if ( event_id >0 && hasGameObjectActiveEventExcept(*itr,event_id) ) + if (event_id >0 && hasGameObjectActiveEventExcept(*itr,event_id)) continue; // Remove the gameobject from grid if (GameObjectData const* data = objmgr.GetGOData(*itr)) { objmgr.RemoveGameobjectFromGrid(*itr, data); - if ( GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL) ) + if (GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL)) pGameobject->AddObjectToRemoveList(); } } @@ -1387,7 +1387,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) pCreature->SetDisplayId(itr->second.modelid); pCreature->SetNativeDisplayId(itr->second.modelid); pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,minfo->bounding_radius); - pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach ); + pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach); } } } @@ -1402,7 +1402,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) pCreature->SetDisplayId(itr->second.modelid_prev); pCreature->SetNativeDisplayId(itr->second.modelid_prev); pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,minfo->bounding_radius); - pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach ); + pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach); } } } diff --git a/src/game/GameEventMgr.h b/src/game/GameEventMgr.h index 39066308410..a1b65596ecd 100644 --- a/src/game/GameEventMgr.h +++ b/src/game/GameEventMgr.h @@ -103,7 +103,7 @@ class GameEventMgr uint32 NextCheck(uint16 entry) const; void LoadFromDB(); uint32 Update(); - bool IsActiveEvent(uint16 event_id) { return ( m_ActiveEvents.find(event_id) != m_ActiveEvents.end()); } + bool IsActiveEvent(uint16 event_id) { return (m_ActiveEvents.find(event_id) != m_ActiveEvents.end()); } uint32 Initialize(); void StartInternalEvent(uint16 event_id); bool StartEvent(uint16 event_id, bool overwrite = false); diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index a834d6aea62..f02cc1ba68e 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -135,7 +135,7 @@ void GameObject::RemoveFromWorld() if (Unit * owner = GetOwner(false)) owner->RemoveGameObject(this,false); else if (!IS_PLAYER_GUID(owner_guid)) - sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid)); + sLog.outError("Delete GameObject (GUID: %u Entry: %u) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid)); } WorldObject::RemoveFromWorld(); ObjectAccessor::Instance().RemoveObject(this); @@ -150,7 +150,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa Relocate(x,y,z,ang); if (!IsPositionValid()) { - sLog.outError("Gameobject (GUID: %u Entry: %u ) not created. Suggested coordinates isn't valid (X: %f Y: %f)",guidlow,name_id,x,y); + sLog.outError("Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",guidlow,name_id,x,y); return false; } @@ -245,7 +245,7 @@ void GameObject::Update(uint32 diff) case GAMEOBJECT_TYPE_FISHINGNODE: { // fishing code (bobber ready) - if ( time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME ) + if (time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME) { // splash bobber (bobber ready now) Unit* caster = GetOwner(); @@ -332,7 +332,7 @@ void GameObject::Update(uint32 diff) if (m_cooldownTime >= time(NULL)) return; - // Type 2 - Bomb ( will go away after casting it's spell ) + // Type 2 - Bomb (will go away after casting it's spell) if (goInfo->trap.charges == 2) { if (goInfo->trap.spellId) @@ -340,7 +340,7 @@ void GameObject::Update(uint32 diff) SetLootState(GO_JUST_DEACTIVATED); break; } - // Type 0 and 1 - trap ( type 0 will not get removed after casting a spell ) + // Type 0 and 1 - trap (type 0 will not get removed after casting a spell) Unit* owner = GetOwner(); Unit* ok = NULL; // pointer to appropriate target if found any @@ -619,7 +619,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) // updated in DB std::ostringstream ss; - ss << "INSERT INTO gameobject VALUES ( " + ss << "INSERT INTO gameobject VALUES (" << m_DBTableGuid << ", " << GetEntry() << ", " << mapid << ", " @@ -639,7 +639,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) WorldDatabase.BeginTransaction(); WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid); - WorldDatabase.PExecuteLog( ss.str( ).c_str( ) ); + WorldDatabase.PExecuteLog(ss.str().c_str()); WorldDatabase.CommitTransaction(); } @@ -647,7 +647,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) { GameObjectData const* data = objmgr.GetGOData(guid); - if ( !data ) + if (!data) { sLog.outErrorDb("Gameobject (GUID: %u) not found in table `gameobject`, can't load. ",guid); return false; @@ -673,7 +673,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) m_DBTableGuid = guid; if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, artKit) ) + if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, artKit)) return false; if (data->spawntimesecs >= 0) @@ -1214,9 +1214,9 @@ void GameObject::Use(Unit* user) uint32 zone, subzone; GetZoneAndAreaId(zone,subzone); - int32 zone_skill = objmgr.GetFishingBaseSkillLevel( subzone ); + int32 zone_skill = objmgr.GetFishingBaseSkillLevel(subzone); if (!zone_skill) - zone_skill = objmgr.GetFishingBaseSkillLevel( zone ); + zone_skill = objmgr.GetFishingBaseSkillLevel(zone); //provide error, no fishable zone or area should be 0 if (!zone_skill) @@ -1289,7 +1289,7 @@ void GameObject::Use(Unit* user) GameObjectInfo const* info = GetGOInfo(); - if ( !caster || caster->GetTypeId() != TYPEID_PLAYER ) + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; // accept only use by player from same group for caster except caster itself @@ -1337,7 +1337,7 @@ void GameObject::Use(Unit* user) if (info->spellcaster.partyOnly) { Unit* caster = GetOwner(); - if ( !caster || caster->GetTypeId() != TYPEID_PLAYER ) + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; if (user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster->ToPlayer())) @@ -1478,11 +1478,11 @@ void GameObject::Use(Unit* user) if (!spellId) return; - SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) { if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this)) - sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType()); + sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId,GetEntry(),GetGoType()); else sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId); return; diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 8b8673a5d61..783e5d5f768 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -28,7 +28,7 @@ #include "Database/DatabaseEnv.h" // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack(1) #else #pragma pack(push,1) @@ -519,7 +519,7 @@ union GameObjectValue }; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack() #else #pragma pack(pop) @@ -718,7 +718,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> // 0 = use `gameobject`.`spawntimesecs` void ResetDoorOrButton(); - void TriggeringLinkedGameObject( uint32 trapEntry, Unit* target); + void TriggeringLinkedGameObject(uint32 trapEntry, Unit* target); bool isVisibleForInState(Player const* u, bool inVisibleList) const; bool canDetectTrap(Player const* u, float distance) const; diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index e15557a486c..2595ba4d420 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -39,7 +39,7 @@ GossipMenu::~GossipMenu() void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded) { - ASSERT( m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS ); + ASSERT(m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS); GossipMenuItem gItem; @@ -67,7 +67,7 @@ void GossipMenu::AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, ui void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, bool Coded) { - AddMenuItem( Icon, Message, 0, 0, "", 0, Coded); + AddMenuItem(Icon, Message, 0, 0, "", 0, Coded); } void GossipMenu::AddMenuItem(uint8 Icon, char const* Message, bool Coded) @@ -80,23 +80,23 @@ void GossipMenu::AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, u AddMenuItem(Icon, std::string(Message ? Message : ""), dtSender, dtAction, std::string(BoxMessage ? BoxMessage : ""), BoxMoney, Coded); } -uint32 GossipMenu::MenuItemSender( unsigned int ItemId ) +uint32 GossipMenu::MenuItemSender(unsigned int ItemId) { - if ( ItemId >= m_gItems.size() ) return 0; + if (ItemId >= m_gItems.size()) return 0; return m_gItems[ ItemId ].m_gSender; } -uint32 GossipMenu::MenuItemAction( unsigned int ItemId ) +uint32 GossipMenu::MenuItemAction(unsigned int ItemId) { - if ( ItemId >= m_gItems.size() ) return 0; + if (ItemId >= m_gItems.size()) return 0; return m_gItems[ ItemId ].m_gOptionId; } -bool GossipMenu::MenuItemCoded( unsigned int ItemId ) +bool GossipMenu::MenuItemCoded(unsigned int ItemId) { - if ( ItemId >= m_gItems.size() ) return 0; + if (ItemId >= m_gItems.size()) return 0; return m_gItems[ ItemId ].m_gCoded; } @@ -107,7 +107,7 @@ void GossipMenu::ClearMenu() m_gItemsData.clear(); } -PlayerMenu::PlayerMenu( WorldSession *session ) : pSession(session) +PlayerMenu::PlayerMenu(WorldSession *session) : pSession(session) { } @@ -122,19 +122,19 @@ void PlayerMenu::ClearMenus() mQuestMenu.ClearMenu(); } -uint32 PlayerMenu::GossipOptionSender( unsigned int Selection ) +uint32 PlayerMenu::GossipOptionSender(unsigned int Selection) { - return mGossipMenu.MenuItemSender( Selection ); + return mGossipMenu.MenuItemSender(Selection); } -uint32 PlayerMenu::GossipOptionAction( unsigned int Selection ) +uint32 PlayerMenu::GossipOptionAction(unsigned int Selection) { - return mGossipMenu.MenuItemAction( Selection ); + return mGossipMenu.MenuItemAction(Selection); } -bool PlayerMenu::GossipOptionCoded( unsigned int Selection ) +bool PlayerMenu::GossipOptionCoded(unsigned int Selection) { - return mGossipMenu.MenuItemCoded( Selection ); + return mGossipMenu.MenuItemCoded(Selection); } void PlayerMenu::SendGossipMenu(uint32 TitleTextId, uint64 objectGUID) @@ -145,20 +145,20 @@ void PlayerMenu::SendGossipMenu(uint32 TitleTextId, uint64 objectGUID) data << uint32(TitleTextId); data << uint32(mGossipMenu.MenuItemCount()); // max count 0x10 - for (uint32 iI = 0; iI < mGossipMenu.MenuItemCount(); ++iI ) + for (uint32 iI = 0; iI < mGossipMenu.MenuItemCount(); ++iI) { GossipMenuItem const& gItem = mGossipMenu.GetItem(iI); - data << uint32( iI ); - data << uint8( gItem.m_gIcon ); - data << uint8( gItem.m_gCoded ); // makes pop up box password + data << uint32(iI); + data << uint8(gItem.m_gIcon); + data << uint8(gItem.m_gCoded); // makes pop up box password data << uint32(gItem.m_gBoxMoney); // money required to open menu, 2.0.3 data << gItem.m_gMessage; // text for gossip item data << gItem.m_gBoxMessage; // accept text (related to money) pop up box, 2.0.3 } - data << uint32( mQuestMenu.MenuItemCount() ); // max count 0x20 + data << uint32(mQuestMenu.MenuItemCount()); // max count 0x20 - for (uint32 iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI ) + for (uint32 iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI) { QuestMenuItem const& qItem = mQuestMenu.GetItem(iI); uint32 questID = qItem.m_qId; @@ -182,33 +182,33 @@ void PlayerMenu::SendGossipMenu(uint32 TitleTextId, uint64 objectGUID) data << Title; } - pSession->SendPacket( &data ); - //sLog.outDebug( "WORLD: Sent SMSG_GOSSIP_MESSAGE NPCGuid=%u",GUID_LOPART(npcGUID) ); + pSession->SendPacket(&data); + //sLog.outDebug("WORLD: Sent SMSG_GOSSIP_MESSAGE NPCGuid=%u",GUID_LOPART(npcGUID)); } void PlayerMenu::CloseGossip() { - WorldPacket data( SMSG_GOSSIP_COMPLETE, 0 ); - pSession->SendPacket( &data ); + WorldPacket data(SMSG_GOSSIP_COMPLETE, 0); + pSession->SendPacket(&data); - //sLog.outDebug( "WORLD: Sent SMSG_GOSSIP_COMPLETE" ); + //sLog.outDebug("WORLD: Sent SMSG_GOSSIP_COMPLETE"); } // Outdated -void PlayerMenu::SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, char const * locName ) +void PlayerMenu::SendPointOfInterest(float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, char const * locName) { - WorldPacket data( SMSG_GOSSIP_POI, (4+4+4+4+4+10) ); // guess size + WorldPacket data(SMSG_GOSSIP_POI, (4+4+4+4+4+10)); // guess size data << Flags; data << X << Y; data << uint32(Icon); data << uint32(Data); data << locName; - pSession->SendPacket( &data ); + pSession->SendPacket(&data); //sLog.outDebug("WORLD: Sent SMSG_GOSSIP_POI"); } -void PlayerMenu::SendPointOfInterest( uint32 poi_id ) +void PlayerMenu::SendPointOfInterest(uint32 poi_id) { PointOfInterest const* poi = objmgr.GetPointOfInterest(poi_id); if (!poi) @@ -230,7 +230,7 @@ void PlayerMenu::SendPointOfInterest( uint32 poi_id ) } } - WorldPacket data( SMSG_GOSSIP_POI, (4+4+4+4+4+10) ); // guess size + WorldPacket data(SMSG_GOSSIP_POI, (4+4+4+4+4+10)); // guess size data << uint32(poi->flags); data << float(poi->x); data << float(poi->y); @@ -238,15 +238,15 @@ void PlayerMenu::SendPointOfInterest( uint32 poi_id ) data << uint32(poi->data); data << icon_name; - pSession->SendPacket( &data ); + pSession->SendPacket(&data); //sLog.outDebug("WORLD: Sent SMSG_GOSSIP_POI"); } -void PlayerMenu::SendTalking( uint32 textID ) +void PlayerMenu::SendTalking(uint32 textID) { GossipText const* pGossip = objmgr.GetGossipText(textID); - WorldPacket data( SMSG_NPC_TEXT_UPDATE, 100 ); // guess size + WorldPacket data(SMSG_NPC_TEXT_UPDATE, 100); // guess size data << textID; // can be < 0 if (!pGossip) @@ -292,12 +292,12 @@ void PlayerMenu::SendTalking( uint32 textID ) { data << pGossip->Options[i].Probability; - if ( Text_0[i].empty() ) + if (Text_0[i].empty()) data << Text_1[i]; else data << Text_0[i]; - if ( Text_1[i].empty() ) + if (Text_1[i].empty()) data << Text_0[i]; else data << Text_1[i]; @@ -311,14 +311,14 @@ void PlayerMenu::SendTalking( uint32 textID ) } } } - pSession->SendPacket( &data ); + pSession->SendPacket(&data); - sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE " ); + sLog.outDebug("WORLD: Sent SMSG_NPC_TEXT_UPDATE "); } -void PlayerMenu::SendTalking( char const * title, char const * text ) +void PlayerMenu::SendTalking(char const * title, char const * text) { - WorldPacket data( SMSG_NPC_TEXT_UPDATE, 50 ); // guess size + WorldPacket data(SMSG_NPC_TEXT_UPDATE, 50); // guess size data << uint32(0); for (uint32 i = 0; i < 8; ++i) { @@ -334,9 +334,9 @@ void PlayerMenu::SendTalking( char const * title, char const * text ) data << uint32(0); } - pSession->SendPacket( &data ); + pSession->SendPacket(&data); - sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE " ); + sLog.outDebug("WORLD: Sent SMSG_NPC_TEXT_UPDATE "); } /*********************************************************/ @@ -353,12 +353,12 @@ QuestMenu::~QuestMenu() ClearMenu(); } -void QuestMenu::AddMenuItem( uint32 QuestId, uint8 Icon) +void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon) { Quest const* qinfo = objmgr.GetQuestTemplate(QuestId); if (!qinfo) return; - ASSERT( m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS ); + ASSERT(m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS); QuestMenuItem qItem; @@ -368,7 +368,7 @@ void QuestMenu::AddMenuItem( uint32 QuestId, uint8 Icon) m_qItems.push_back(qItem); } -bool QuestMenu::HasItem( uint32 questid ) +bool QuestMenu::HasItem(uint32 questid) { for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i) { @@ -385,16 +385,16 @@ void QuestMenu::ClearMenu() m_qItems.clear(); } -void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Title, uint64 npcGUID ) +void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, uint64 npcGUID) { - WorldPacket data( SMSG_QUESTGIVER_QUEST_LIST, 100 ); // guess size + WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100); // guess size data << uint64(npcGUID); data << Title; - data << uint32(eEmote._Delay ); // player emote - data << uint32(eEmote._Emote ); // NPC emote - data << uint8 ( mQuestMenu.MenuItemCount() ); + data << uint32(eEmote._Delay); // player emote + data << uint32(eEmote._Emote); // NPC emote + data << uint8 (mQuestMenu.MenuItemCount()); - for (uint32 iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI ) + for (uint32 iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI) { QuestMenuItem const& qmi = mQuestMenu.GetItem(iI); @@ -418,21 +418,21 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl data << uint32(pSession->GetPlayer()->GetQuestLevel(pQuest)); data << title; } - pSession->SendPacket( &data ); + pSession->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); } -void PlayerMenu::SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID ) +void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) { - WorldPacket data( SMSG_QUESTGIVER_STATUS, 9 ); + WorldPacket data(SMSG_QUESTGIVER_STATUS, 9); data << uint64(npcGUID); data << uint8(questStatus); - pSession->SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); + pSession->SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); } -void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept ) +void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID, bool ActivateAccept) { std::string Title = pQuest->GetTitle(); std::string Details = pQuest->GetDetails(); @@ -482,24 +482,24 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID data << uint32(pQuest->GetRewChoiceItemsCount()); for (uint32 i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i) { - if ( !pQuest->RewChoiceItemId[i] ) continue; + if (!pQuest->RewChoiceItemId[i]) continue; data << uint32(pQuest->RewChoiceItemId[i]); data << uint32(pQuest->RewChoiceItemCount[i]); IProto = objmgr.GetItemPrototype(pQuest->RewChoiceItemId[i]); - if ( IProto ) + if (IProto) data << uint32(IProto->DisplayInfoID); else - data << uint32( 0x00 ); + data << uint32(0x00); } data << uint32(pQuest->GetRewItemsCount()); for (uint32 i=0; i < QUEST_REWARDS_COUNT; ++i) { - if ( !pQuest->RewItemId[i] ) continue; + if (!pQuest->RewItemId[i]) continue; data << uint32(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemCount[i]); IProto = objmgr.GetItemPrototype(pQuest->RewItemId[i]); - if ( IProto ) + if (IProto) data << uint32(IProto->DisplayInfoID); else data << uint32(0); @@ -534,12 +534,12 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID data << uint32(pQuest->DetailsEmote[i]); data << uint32(pQuest->DetailsEmoteDelay[i]); // DetailsEmoteDelay (in ms) } - pSession->SendPacket( &data ); + pSession->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId()); } -void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) +void PlayerMenu::SendQuestQueryResponse(Quest const *pQuest) { std::string Title, Details, Objectives, EndText, CompletedText; std::string ObjectiveText[QUEST_OBJECTIVES_COUNT]; @@ -574,7 +574,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) } } - WorldPacket data( SMSG_QUEST_QUERY_RESPONSE, 100 ); // guess size + WorldPacket data(SMSG_QUEST_QUERY_RESPONSE, 100); // guess size data << uint32(pQuest->GetQuestId()); // quest id data << uint32(pQuest->GetQuestMethod()); // Accepted values: 0, 1 or 2. 0==IsAutoComplete() (skip objectives/details) @@ -682,11 +682,11 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI) data << ObjectiveText[iI]; - pSession->SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", pQuest->GetQuestId() ); + pSession->SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", pQuest->GetQuestId()); } -void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, bool EnableNext ) +void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID, bool EnableNext) { std::string Title = pQuest->GetTitle(); std::string OfferRewardText = pQuest->GetOfferRewardText(); @@ -704,7 +704,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, } } - WorldPacket data( SMSG_QUESTGIVER_OFFER_REWARD, 50 ); // guess size + WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 50); // guess size data << uint64(npcGUID); data << uint32(pQuest->GetQuestId()); @@ -734,12 +734,12 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, data << uint32(pQuest->GetRewChoiceItemsCount()); for (uint32 i=0; i < pQuest->GetRewChoiceItemsCount(); ++i) { - pItem = objmgr.GetItemPrototype( pQuest->RewChoiceItemId[i] ); + pItem = objmgr.GetItemPrototype(pQuest->RewChoiceItemId[i]); data << uint32(pQuest->RewChoiceItemId[i]); data << uint32(pQuest->RewChoiceItemCount[i]); - if ( pItem ) + if (pItem) data << uint32(pItem->DisplayInfoID); else data << uint32(0); @@ -752,7 +752,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, data << uint32(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemCount[i]); - if ( pItem ) + if (pItem) data << uint32(pItem->DisplayInfoID); else data << uint32(0); @@ -781,11 +781,11 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override? data << uint32(pQuest->RewRepValue[i]); - pSession->SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId() ); + pSession->SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId()); } -void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel ) +void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel) { // We can always call to RequestItems, but this packet only goes out if there are actually // items. Otherwise, we'll skip straight to the OfferReward @@ -812,7 +812,7 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID return; } - WorldPacket data( SMSG_QUESTGIVER_REQUEST_ITEMS, 50 ); // guess size + WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 50); // guess size data << npcGUID; data << pQuest->GetQuestId(); data << Title; @@ -836,22 +836,22 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID // Required Money data << uint32(pQuest->GetRewOrReqMoney() < 0 ? -pQuest->GetRewOrReqMoney() : 0); - data << uint32( pQuest->GetReqItemsCount() ); + data << uint32(pQuest->GetReqItemsCount()); ItemPrototype const *pItem; for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - if ( !pQuest->ReqItemId[i] ) continue; + if (!pQuest->ReqItemId[i]) continue; pItem = objmgr.GetItemPrototype(pQuest->ReqItemId[i]); data << uint32(pQuest->ReqItemId[i]); data << uint32(pQuest->ReqItemCount[i]); - if ( pItem ) + if (pItem) data << uint32(pItem->DisplayInfoID); else data << uint32(0); } - if ( !Completable ) + if (!Completable) data << uint32(0x00); else data << uint32(0x03); @@ -860,6 +860,6 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID data << uint32(0x08); data << uint32(0x10); - pSession->SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId() ); + pSession->SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId()); } diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h index b487653b402..ce2049cc23f 100644 --- a/src/game/GossipDef.h +++ b/src/game/GossipDef.h @@ -175,7 +175,7 @@ class GossipMenu return m_gItems.empty(); } - GossipMenuItem const& GetItem( unsigned int Id ) + GossipMenuItem const& GetItem(unsigned int Id) { return m_gItems[ Id ]; } @@ -185,9 +185,9 @@ class GossipMenu return m_gItemsData[indexId]; } - uint32 MenuItemSender( unsigned int ItemId ); - uint32 MenuItemAction( unsigned int ItemId ); - bool MenuItemCoded( unsigned int ItemId ); + uint32 MenuItemSender(unsigned int ItemId); + uint32 MenuItemAction(unsigned int ItemId); + bool MenuItemCoded(unsigned int ItemId); void ClearMenu(); @@ -204,7 +204,7 @@ class QuestMenu QuestMenu(); ~QuestMenu(); - void AddMenuItem( uint32 QuestId, uint8 Icon); + void AddMenuItem(uint32 QuestId, uint8 Icon); void ClearMenu(); uint8 MenuItemCount() const @@ -217,9 +217,9 @@ class QuestMenu return m_qItems.empty(); } - bool HasItem( uint32 questid ); + bool HasItem(uint32 questid); - QuestMenuItem const& GetItem( uint16 Id ) + QuestMenuItem const& GetItem(uint16 Id) { return m_qItems[ Id ]; } @@ -236,7 +236,7 @@ class PlayerMenu WorldSession* pSession; public: - PlayerMenu( WorldSession *Session ); + PlayerMenu(WorldSession *Session); ~PlayerMenu(); GossipMenu& GetGossipMenu() { return mGossipMenu; } @@ -245,28 +245,28 @@ class PlayerMenu bool Empty() const { return mGossipMenu.Empty() && mQuestMenu.Empty(); } void ClearMenus(); - uint32 GossipOptionSender( unsigned int Selection ); - uint32 GossipOptionAction( unsigned int Selection ); - bool GossipOptionCoded( unsigned int Selection ); + uint32 GossipOptionSender(unsigned int Selection); + uint32 GossipOptionAction(unsigned int Selection); + bool GossipOptionCoded(unsigned int Selection); - void SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ); + void SendGossipMenu(uint32 TitleTextId, uint64 npcGUID); void CloseGossip(); - void SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char * locName ); - void SendPointOfInterest( uint32 poi_id ); - void SendTalking( uint32 textID ); - void SendTalking( char const * title, char const * text ); + void SendPointOfInterest(float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char * locName); + void SendPointOfInterest(uint32 poi_id); + void SendTalking(uint32 textID); + void SendTalking(char const * title, char const * text); /*********************************************************/ /*** QUEST SYSTEM ***/ /*********************************************************/ - void SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID ); + void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID); - void SendQuestGiverQuestList( QEmote eEmote, const std::string& Title, uint64 npcGUID ); + void SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, uint64 npcGUID); - void SendQuestQueryResponse ( Quest const *pQuest ); - void SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept); + void SendQuestQueryResponse (Quest const *pQuest); + void SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID, bool ActivateAccept); - void SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, bool EnableNext ); - void SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel ); + void SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID, bool EnableNext); + void SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel); }; #endif diff --git a/src/game/GridDefines.h b/src/game/GridDefines.h index e0f2d72277f..d7a39fa08e7 100644 --- a/src/game/GridDefines.h +++ b/src/game/GridDefines.h @@ -89,7 +89,7 @@ struct CoordPair void operator<<(const uint32 val) { - if ( x_coord > val ) + if (x_coord > val) x_coord -= val; else x_coord = 0; @@ -97,7 +97,7 @@ struct CoordPair void operator>>(const uint32 val) { - if ( x_coord+val < LIMIT ) + if (x_coord+val < LIMIT) x_coord += val; else x_coord = LIMIT - 1; @@ -105,7 +105,7 @@ struct CoordPair void operator-=(const uint32 val) { - if ( y_coord > val ) + if (y_coord > val) y_coord -= val; else y_coord = 0; @@ -113,7 +113,7 @@ struct CoordPair void operator+=(const uint32 val) { - if ( y_coord+val < LIMIT ) + if (y_coord+val < LIMIT) y_coord += val; else y_coord = LIMIT - 1; diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index 0c4971feb33..0b38ae15c8f 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -315,7 +315,7 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m) void MessageDistDeliverer::VisitObject(Player* plr) { - if ( !i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()) ) + if (!i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam())) { SendPacket(plr); } @@ -340,10 +340,10 @@ bool CannibalizeObjectCheck::operator()(Corpse* u) Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID()); - if ( !owner || i_funit->IsFriendlyTo(owner)) + if (!owner || i_funit->IsFriendlyTo(owner)) return false; - if (i_funit->IsWithinDistInMap(u, i_range) ) + if (i_funit->IsWithinDistInMap(u, i_range)) return true; return false; diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 4d73b1d5c0b..addc55d8181 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -497,7 +497,7 @@ namespace Trinity { if (i_funit->GetTypeId() != TYPEID_PLAYER || !((Player*)i_funit)->isHonorOrXPTarget(u) || u->getDeathState() != CORPSE || u->isDeadByDefault() || u->isInFlight() || - ( u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1)) )==0 || + (u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1)))==0 || (u->GetDisplayId() != u->GetNativeDisplayId())) return false; @@ -542,7 +542,7 @@ namespace Trinity CannibalizeObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {} bool operator()(Player* u) { - if ( i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight() ) + if (i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight()) return false; return i_funit->IsWithinDistInMap(u, i_range); @@ -846,8 +846,8 @@ namespace Trinity NearestAttackableUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {} bool operator()(Unit* u) { - if ( u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) && - !i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,false) ) + if (u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) && + !i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,false)) { i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check return true; @@ -874,7 +874,7 @@ namespace Trinity Unit const* owner = i_funit->GetOwner(); if (owner) check = owner; - i_targetForPlayer = ( check->GetTypeId() == TYPEID_PLAYER ); + i_targetForPlayer = (check->GetTypeId() == TYPEID_PLAYER); } bool operator()(Unit* u) { @@ -884,7 +884,7 @@ namespace Trinity if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem()) return false; - if (( i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range)) + if ((i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u))&& i_obj->IsWithinDistInMap(u, i_range)) return true; return false; @@ -988,15 +988,15 @@ namespace Trinity if (u == i_funit) return false; - if ( !u->CanAssistTo(i_funit, i_enemy) ) + if (!u->CanAssistTo(i_funit, i_enemy)) return false; // too far - if ( !i_funit->IsWithinDistInMap(u, i_range) ) + if (!i_funit->IsWithinDistInMap(u, i_range)) return false; // only if see assisted creature - if ( !i_funit->IsWithinLOSInMap(u) ) + if (!i_funit->IsWithinLOSInMap(u)) return false; return true; @@ -1176,7 +1176,7 @@ namespace Trinity for (size_t i = 0; i < i_data_cache.size(); ++i) delete i_data_cache[i]; } - void operator()( Player* p ); + void operator()(Player* p); private: Builder& i_builder; @@ -1197,7 +1197,7 @@ namespace Trinity for (size_t j = 0; j < i_data_cache[i].size(); ++j) delete i_data_cache[i][j]; } - void operator()( Player* p ); + void operator()(Player* p); private: Builder& i_builder; diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 1765ed381fe..f4267ff7048 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -368,7 +368,7 @@ void Trinity::CreatureListSearcher<Check>::Visit(CreatureMapType &m) { for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) - if ( i_check(itr->getSource())) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } @@ -377,7 +377,7 @@ void Trinity::PlayerListSearcher<Check>::Visit(PlayerMapType &m) { for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) - if ( i_check(itr->getSource())) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } @@ -402,7 +402,7 @@ void Trinity::PlayerSearcher<Check>::Visit(PlayerMapType &m) } template<class Builder> -void Trinity::LocalizedPacketDo<Builder>::operator()( Player* p ) +void Trinity::LocalizedPacketDo<Builder>::operator()(Player* p) { int32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex(); uint32 cache_idx = loc_idx+1; @@ -427,7 +427,7 @@ void Trinity::LocalizedPacketDo<Builder>::operator()( Player* p ) } template<class Builder> -void Trinity::LocalizedPacketListDo<Builder>::operator()( Player* p ) +void Trinity::LocalizedPacketListDo<Builder>::operator()(Player* p) { int32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex(); uint32 cache_idx = loc_idx+1; diff --git a/src/game/GridStates.cpp b/src/game/GridStates.cpp index 94a1393bfa1..9d39531cfad 100644 --- a/src/game/GridStates.cpp +++ b/src/game/GridStates.cpp @@ -33,9 +33,9 @@ ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 &x, c { // Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle info.UpdateTimeTracker(t_diff); - if ( info.getTimeTracker().Passed() ) + if (info.getTimeTracker().Passed()) { - if ( grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y) ) + if (grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y)) { ObjectGridStoper stoper(grid); stoper.StopN(); @@ -63,9 +63,9 @@ RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 &x, c if (!info.getUnloadLock()) { info.UpdateTimeTracker(t_diff); - if ( info.getTimeTracker().Passed() ) + if (info.getTimeTracker().Passed()) { - if ( !m.UnloadGrid(x, y, false) ) + if (!m.UnloadGrid(x, y, false)) { sLog.outDebug("Grid[%u,%u] for map %u differed unloading due to players or active objects nearby", x, y, m.GetId()); m.ResetGridExpiry(grid); diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 968c9edcca1..9a9febc3c14 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -175,7 +175,7 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result do { LoadMemberFromDB((*result)[0].GetUInt32(), (*result)[1].GetUInt8(), (*result)[2].GetUInt8()); - } while ( result->NextRow() ); + } while (result->NextRow()); // group too small if (GetMembersCount() < 2) return false; @@ -221,12 +221,12 @@ void Group::ConvertToRaid() bool Group::AddInvite(Player *player) { - if ( !player || player->GetGroupInvite() ) + if (!player || player->GetGroupInvite()) return false; Group* group = player->GetGroup(); - if ( group && group->isBGGroup() ) + if (group && group->isBGGroup()) group = player->GetOriginalGroup(); - if ( group ) + if (group) return false; RemoveInvite(player); @@ -334,7 +334,7 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method) { bool leaderChanged = _removeMember(guid); - if (Player *player = objmgr.GetPlayer( guid )) + if (Player *player = objmgr.GetPlayer(guid)) { // quest related GO state dependent from raid membership if (isRaidGroup()) @@ -344,12 +344,12 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method) if (method == 1) { - data.Initialize( SMSG_GROUP_UNINVITE, 0 ); - player->GetSession()->SendPacket( &data ); + data.Initialize(SMSG_GROUP_UNINVITE, 0); + player->GetSession()->SendPacket(&data); } //we already removed player from group and in player->GetGroup() is his original group! - if ( Group* group = player->GetGroup() ) + if (Group* group = player->GetGroup()) { group->SendUpdate(); } @@ -407,12 +407,12 @@ void Group::Disband(bool hideDestroy) //we cannot call _removeMember because it would invalidate member iterator //if we are removing player from battleground raid - if ( isBGGroup() ) + if (isBGGroup()) player->RemoveFromBattleGroundRaid(); else { //we can remove player who is in battleground from his original group - if ( player->GetOriginalGroup() == this ) + if (player->GetOriginalGroup() == this) player->SetOriginalGroup(NULL); else player->SetGroup(NULL); @@ -433,7 +433,7 @@ void Group::Disband(bool hideDestroy) } //we already removed player from group and in player->GetGroup() is his original group, send update - if ( Group* group = player->GetGroup() ) + if (Group* group = player->GetGroup()) { group->SendUpdate(); } @@ -489,7 +489,7 @@ void Group::SendLootStartRoll(uint32 CountDown, const Roll &r) continue; if (itr->second != NOT_VALID) - p->GetSession()->SendPacket( &data ); + p->GetSession()->SendPacket(&data); } } @@ -513,7 +513,7 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin continue; if (itr->second != NOT_VALID) - p->GetSession()->SendPacket( &data ); + p->GetSession()->SendPacket(&data); } } @@ -536,7 +536,7 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid, continue; if (itr->second != NOT_VALID) - p->GetSession()->SendPacket( &data ); + p->GetSession()->SendPacket(&data); } } @@ -556,7 +556,7 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r) continue; if (itr->second != NOT_VALID) - p->GetSession()->SendPacket( &data ); + p->GetSession()->SendPacket(&data); } } @@ -790,7 +790,7 @@ void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 N //called when roll timer expires void Group::EndRoll(Loot *pLoot) { - for (Rolls::iterator itr = RollId.begin(); itr != RollId.end(); ) + for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();) { if ((*itr)->getLoot() == pLoot) { CountTheRoll(itr, GetMembersCount()); //i don't have to edit player votes, who didn't vote ... he will pass @@ -847,12 +847,12 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) item->is_looted = true; roll->getLoot()->NotifyItemRemoved(roll->itemSlot); roll->getLoot()->unlootedCount--; - player->StoreNewItem( dest, roll->itemid, true, item->randomPropertyId); + player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId); } else { item->is_blocked = false; - player->SendEquipError( msg, NULL, NULL ); + player->SendEquipError(msg, NULL, NULL); } } } @@ -937,9 +937,9 @@ void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid) return; // clean other icons - if ( targetGuid != 0 ) + if (targetGuid != 0) for (int i=0; i<TARGETICONCOUNT; ++i) - if ( m_targetIcons[i] == targetGuid ) + if (m_targetIcons[i] == targetGuid) SetTargetIcon(i, 0, 0); m_targetIcons[id] = targetGuid; @@ -969,7 +969,7 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_lev member_with_max_level = member; uint32 gray_level = Trinity::XP::GetGrayLevel(member->getLevel()); - if ( victim->getLevel() > gray_level && (!not_gray_member_with_max_level + if (victim->getLevel() > gray_level && (!not_gray_member_with_max_level || not_gray_member_with_max_level->getLevel() < member->getLevel())) not_gray_member_with_max_level = member; } @@ -1001,7 +1001,7 @@ void Group::SendUpdate() for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { player = objmgr.GetPlayer(citr->guid); - if (!player || !player->GetSession() || player->GetGroup() != this ) + if (!player || !player->GetSession() || player->GetGroup() != this) continue; WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+1+4+8+4+4+(GetMembersCount()-1)*(13+8+1+1+1+1)+8+1+8+1+1+1+1)); @@ -1043,7 +1043,7 @@ void Group::SendUpdate() data << uint8(m_raidDifficulty); // Raid Difficulty data << uint8(0); // 3.3 } - player->GetSession()->SendPacket( &data ); + player->GetSession()->SendPacket(&data); } } @@ -1069,7 +1069,7 @@ void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player *pl = itr->getSource(); - if (!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) ) + if (!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this)) continue; if (pl->GetSession() && (group==-1 || itr->getSubGroup()==group)) @@ -1149,10 +1149,10 @@ bool Group::_addMember(const uint64 &guid, const char* name, uint8 group) { player->SetGroupInvite(NULL); //if player is in group and he is being added to BG raid group, then call SetBattleGroundRaid() - if ( player->GetGroup() && isBGGroup() ) + if (player->GetGroup() && isBGGroup()) player->SetBattleGroundRaid(this, group); //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup() - else if ( player->GetGroup() ) + else if (player->GetGroup()) player->SetOriginalGroup(this, group); //if player is not in group, then call set group else @@ -1184,12 +1184,12 @@ bool Group::_removeMember(const uint64 &guid) if (player) { //if we are removing player from battleground raid - if ( isBGGroup() ) + if (isBGGroup()) player->RemoveFromBattleGroundRaid(); else { //we can remove player who is in battleground from his original group - if ( player->GetOriginalGroup() == this ) + if (player->GetOriginalGroup() == this) player->SetOriginalGroup(NULL); else player->SetGroup(NULL); @@ -1239,7 +1239,7 @@ void Group::_setLeader(const uint64 &guid) "DELETE FROM group_instance WHERE leaderguid='%u' AND (permanent = 1 OR " "instance IN (SELECT instance FROM character_instance WHERE guid = '%u')" ")", GUID_LOPART(m_leaderGuid), GUID_LOPART(slot->guid) - ); +); Player *player = objmgr.GetPlayer(slot->guid); if (player) @@ -1391,7 +1391,7 @@ void Group::ChangeMembersGroup(Player *player, const uint8 &group) if (_setMembersGroup(player->GetGUID(), group)) { uint8 prevSubGroup = player->GetSubGroup(); - if ( player->GetGroup() == this ) + if (player->GetGroup() == this) player->GetGroupRef().setSubGroup(group); //if player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference else @@ -1601,7 +1601,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) // we assume that when the difficulty changes, all instances that can be reset will be Difficulty diff = GetDifficulty(isRaid); - for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end(); ) + for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { InstanceSave *p = itr->second.save; const MapEntry *entry = sMapStore.LookupEntry(itr->first); diff --git a/src/game/Group.h b/src/game/Group.h index d003b371922..0cb632c62d7 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -345,7 +345,7 @@ class Group void EndRoll(Loot *loot); void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); } - void DelinkMember(GroupReference* /*pRef*/ ) { } + void DelinkMember(GroupReference* /*pRef*/) { } InstanceGroupBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false); void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false); diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index da5e2796552..05e490684bd 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -53,10 +53,10 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string& data << member; data << (uint32)res; - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data) { std::string membername; recv_data >> membername; @@ -110,14 +110,14 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) } Group *group = GetPlayer()->GetGroup(); - if ( group && group->isBGGroup() ) + if (group && group->isBGGroup()) group = GetPlayer()->GetOriginalGroup(); Group *group2 = player->GetGroup(); - if ( group2 && group2->isBGGroup() ) + if (group2 && group2->isBGGroup()) group2 = player->GetOriginalGroup(); // player already in another group or invited - if ( group2 || player->GetGroupInvite() ) + if (group2 || player->GetGroupInvite()) { SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_ALREADY_IN_GROUP); return; @@ -175,7 +175,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_OK); } -void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleGroupAcceptOpcode(WorldPacket & /*recv_data*/) { Group *group = GetPlayer()->GetGroupInvite(); if (!group) return; @@ -204,7 +204,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ ) // forming a new group, create it if (!group->IsCreated()) { - if ( leader ) + if (leader) group->RemoveInvite(leader); group->Create(group->GetLeaderGUID(), group->GetLeaderName()); objmgr.AddGroup(group); @@ -217,7 +217,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ ) group->BroadcastGroupUpdate(); } -void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/) { Group *group = GetPlayer()->GetGroupInvite(); if (!group) return; @@ -232,9 +232,9 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ ) return; // report - WorldPacket data( SMSG_GROUP_DECLINE, 10 ); // guess size + WorldPacket data(SMSG_GROUP_DECLINE, 10); // guess size data << GetPlayer()->GetName(); - leader->GetSession()->SendPacket( &data ); + leader->GetSession()->SendPacket(&data); } void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) @@ -317,7 +317,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data) SendPartyResult(PARTY_OP_LEAVE, membername, PARTY_RESULT_NOT_IN_YOUR_PARTY); } -void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket & recv_data) { Group *group = GetPlayer()->GetGroup(); if (!group) @@ -337,7 +337,7 @@ void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data ) group->ChangeLeader(guid); } -void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recv_data*/) { if (!GetPlayer()->GetGroup()) return; @@ -357,7 +357,7 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ ) GetPlayer()->RemoveFromGroup(); } -void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data ) +void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data) { Group *group = GetPlayer()->GetGroup(); if (!group) @@ -380,7 +380,7 @@ void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data ) group->SendUpdate(); } -void WorldSession::HandleLootRoll( WorldPacket &recv_data ) +void WorldSession::HandleLootRoll(WorldPacket &recv_data) { if (!GetPlayer()->GetGroup()) return; @@ -461,7 +461,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data) SendPacket(&data); } -void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket & recv_data) { Group *group = GetPlayer()->GetGroup(); if (!group) @@ -489,7 +489,7 @@ void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recv_data*/) { Group *group = GetPlayer()->GetGroup(); if (!group) @@ -508,7 +508,7 @@ void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ ) group->ConvertToRaid(); } -void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data) { // we will get correct pointer for group here, so we don't have to check if group is BG raid Group *group = GetPlayer()->GetGroup(); @@ -542,7 +542,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ) group->ChangeMembersGroup(movedPlayer, groupNr); } -void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket & recv_data) { Group *group = GetPlayer()->GetGroup(); if (!group) @@ -562,7 +562,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ) group->SetAssistant(guid, (flag != 0)); } -void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data ) +void WorldSession::HandlePartyAssignmentOpcode(WorldPacket & recv_data) { sLog.outDebug("MSG_PARTY_ASSIGNMENT"); @@ -589,7 +589,7 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data ) group->SetMainAssistant(guid, apply); } -void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket & recv_data) { Group *group = GetPlayer()->GetGroup(); if (!group) @@ -622,7 +622,7 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleRaidReadyCheckFinishedOpcode(WorldPacket & /*recv_data*/) { //Group* group = GetPlayer()->GetGroup(); //if (!group) @@ -804,7 +804,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke } /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/ -void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data ) +void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recv_data) { sLog.outDebug("WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS"); uint64 Guid; @@ -894,18 +894,18 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data ) SendPacket(&data); } -/*!*/void WorldSession::HandleRequestRaidInfoOpcode( WorldPacket & /*recv_data*/ ) +/*!*/void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket & /*recv_data*/) { // every time the player checks the character screen _player->SendRaidInfo(); } -/*void WorldSession::HandleGroupCancelOpcode( WorldPacket & recv_data ) +/*void WorldSession::HandleGroupCancelOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: got CMSG_GROUP_CANCEL." ); + sLog.outDebug("WORLD: got CMSG_GROUP_CANCEL."); }*/ -void WorldSession::HandleOptOutOfLootOpcode( WorldPacket & recv_data ) +void WorldSession::HandleOptOutOfLootOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received CMSG_OPT_OUT_OF_LOOT"); diff --git a/src/game/GroupRefManager.h b/src/game/GroupRefManager.h index d3314256a40..4fdeba2dd8c 100644 --- a/src/game/GroupRefManager.h +++ b/src/game/GroupRefManager.h @@ -30,7 +30,7 @@ class GroupReference; class GroupRefManager : public RefManager<Group, Player> { public: - GroupReference* getFirst() { return ((GroupReference* ) RefManager<Group, Player>::getFirst()); } + GroupReference* getFirst() { return ((GroupReference*) RefManager<Group, Player>::getFirst()); } }; #endif diff --git a/src/game/GuardAI.cpp b/src/game/GuardAI.cpp index b01fd1b67df..dbabea7a6af 100644 --- a/src/game/GuardAI.cpp +++ b/src/game/GuardAI.cpp @@ -27,7 +27,7 @@ int GuardAI::Permissible(const Creature *creature) { - if ( creature->isGuard()) + if (creature->isGuard()) return PERMIT_BASE_SPECIAL; return PERMIT_BASE_NO; @@ -40,11 +40,11 @@ GuardAI::GuardAI(Creature *c) : CreatureAI(c), i_victimGuid(0), i_state(STATE_NO void GuardAI::MoveInLineOfSight(Unit *u) { // Ignore Z for flying creatures - if ( !m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE ) + if (!m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) return; - if ( !m_creature->getVictim() && m_creature->canAttack(u) && - ( u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/ ) && + if (!m_creature->getVictim() && m_creature->canAttack(u) && + (u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/) && u->isInAccessiblePlaceFor(m_creature)) { float attackRadius = m_creature->GetAttackDistance(u); @@ -59,7 +59,7 @@ void GuardAI::MoveInLineOfSight(Unit *u) void GuardAI::EnterEvadeMode() { - if ( !m_creature->isAlive() ) + if (!m_creature->isAlive()) { DEBUG_LOG("Creature stopped attacking because he's dead [guid=%u]", m_creature->GetGUIDLow()); m_creature->GetMotionMaster()->MoveIdle(); @@ -72,21 +72,21 @@ void GuardAI::EnterEvadeMode() return; } - Unit* victim = ObjectAccessor::GetUnit(*m_creature, i_victimGuid ); + Unit* victim = ObjectAccessor::GetUnit(*m_creature, i_victimGuid); - if ( !victim ) + if (!victim) { DEBUG_LOG("Creature stopped attacking because victim is non exist [guid=%u]", m_creature->GetGUIDLow()); } - else if ( !victim ->isAlive() ) + else if (!victim ->isAlive()) { DEBUG_LOG("Creature stopped attacking because victim is dead [guid=%u]", m_creature->GetGUIDLow()); } - else if ( victim ->HasStealthAura() ) + else if (victim ->HasStealthAura()) { DEBUG_LOG("Creature stopped attacking because victim is using stealth [guid=%u]", m_creature->GetGUIDLow()); } - else if ( victim ->isInFlight() ) + else if (victim ->isInFlight()) { DEBUG_LOG("Creature stopped attacking because victim is flying away [guid=%u]", m_creature->GetGUIDLow()); } @@ -102,7 +102,7 @@ void GuardAI::EnterEvadeMode() i_state = STATE_NORMAL; // Remove TargetedMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead - if ( m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE ) + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) m_creature->GetMotionMaster()->MoveTargetedHome(); } @@ -114,9 +114,9 @@ void GuardAI::UpdateAI(const uint32 /*diff*/) i_victimGuid = m_creature->getVictim()->GetGUID(); - if ( m_creature->isAttackReady() ) + if (m_creature->isAttackReady()) { - if ( m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) { m_creature->AttackerStateUpdate(m_creature->getVictim()); m_creature->resetAttackTimer(); diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 9b5d6f884a2..91d2ee0f944 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -307,7 +307,7 @@ bool Guild::LoadRanksFromDB(QueryResult_AutoPtr guildRanksResult) rankRights |= GR_RIGHT_ALL; AddRank(rankName,rankRights,rankMoney); - }while ( guildRanksResult->NextRow() ); + }while (guildRanksResult->NextRow()); if (m_Ranks.size() < GUILD_RANKS_MIN_COUNT) // if too few ranks, renew them { @@ -327,7 +327,7 @@ bool Guild::LoadRanksFromDB(QueryResult_AutoPtr guildRanksResult) std::string name = m_Ranks[i].Name; uint32 rights = m_Ranks[i].Rights; CharacterDatabase.escape_string(name); - CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, uint32(i), name.c_str(), rights); + CharacterDatabase.PExecute("INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, uint32(i), name.c_str(), rights); } CharacterDatabase.CommitTransaction(); } @@ -417,7 +417,7 @@ bool Guild::LoadMembersFromDB(QueryResult_AutoPtr guildMembersResult) void Guild::SetMemberStats(uint64 guid) { MemberList::iterator itr = members.find(GUID_LOPART(guid)); - if (itr == members.end() ) + if (itr == members.end()) return; Player *pl = ObjectAccessor::FindPlayer(guid); @@ -489,7 +489,7 @@ void Guild::DelMember(uint64 guid, bool isDisbanding) BroadcastPacket(&data); } - sLog.outDebug( "WORLD: Sent (SMSG_GUILD_EVENT)" ); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)"); } members.erase(GUID_LOPART(guid)); @@ -516,7 +516,7 @@ void Guild::ChangeRank(uint64 guid, uint32 newRank) if (player) player->SetRank(newRank); - CharacterDatabase.PExecute( "UPDATE guild_member SET rank='%u' WHERE guid='%u'", newRank, GUID_LOPART(guid) ); + CharacterDatabase.PExecute("UPDATE guild_member SET rank='%u' WHERE guid='%u'", newRank, GUID_LOPART(guid)); } void Guild::SetPNOTE(uint64 guid,std::string pnote) @@ -554,7 +554,7 @@ void Guild::BroadcastToGuild(WorldSession *session, const std::string& msg, uint { Player *pl = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); - if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetGUIDLow()) ) + if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetGUIDLow())) pl->GetSession()->SendPacket(&data); } } @@ -619,7 +619,7 @@ void Guild::CreateRank(std::string name_,uint32 rights) } // name now can be used for encoding to DB CharacterDatabase.escape_string(name_); - CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, new_rank_id, name_.c_str(), rights ); + CharacterDatabase.PExecute("INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, new_rank_id, name_.c_str(), rights); } void Guild::AddRank(const std::string& name_,uint32 rights, uint32 money) @@ -765,7 +765,7 @@ void Guild::Roster(WorldSession *session /*= NULL*/) session->SendPacket(&data); else BroadcastPacket(&data); - sLog.outDebug( "WORLD: Sent (SMSG_GUILD_ROSTER)" ); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_ROSTER)"); } void Guild::Query(WorldSession *session) @@ -790,8 +790,8 @@ void Guild::Query(WorldSession *session) data << uint32(m_BackgroundColor); data << uint32(0); // something new in WotLK - session->SendPacket( &data ); - sLog.outDebug( "WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)" ); + session->SendPacket(&data); + sLog.outDebug("WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)"); } void Guild::SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor) @@ -1142,13 +1142,13 @@ void Guild::LoadGuildBankFromDB() if (TabId >= m_PurchasedTabs || TabId >= GUILD_BANK_MAX_TABS) { - sLog.outError( "Guild::LoadGuildBankFromDB: Invalid tab for item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry); + sLog.outError("Guild::LoadGuildBankFromDB: Invalid tab for item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry); continue; } if (SlotId >= GUILD_BANK_MAX_SLOTS) { - sLog.outError( "Guild::LoadGuildBankFromDB: Invalid slot for item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry); + sLog.outError("Guild::LoadGuildBankFromDB: Invalid slot for item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry); continue; } @@ -1156,7 +1156,7 @@ void Guild::LoadGuildBankFromDB() if (!proto) { - sLog.outError( "Guild::LoadGuildBankFromDB: Unknown item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry); + sLog.outError("Guild::LoadGuildBankFromDB: Unknown item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry); continue; } @@ -1568,7 +1568,7 @@ void Guild::LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uin m_Id, currentLogGuid, currentTabId, uint32(NewEvent.EventType), NewEvent.PlayerGuid, NewEvent.ItemOrMoney, uint32(NewEvent.ItemStackCount), uint32(NewEvent.DestTabId), NewEvent.TimeStamp); } -bool Guild::AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry ) +bool Guild::AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry) { CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE guildid = '%u' AND TabId = '%u'AND SlotId = '%u'", GuildId, BankTab, BankTabSlot); CharacterDatabase.PExecute("INSERT INTO guild_bank_item (guildid,TabId,SlotId,item_guid,item_entry) " @@ -1576,7 +1576,7 @@ bool Guild::AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot return true; } -void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *tab, int slot ) +void Guild::AppendDisplayGuildBankSlot(WorldPacket& data, GuildBankTab const *tab, int slot) { Item *pItem = tab->Slots[slot]; uint32 entry = pItem ? pItem->GetEntry() : 0; @@ -1612,7 +1612,7 @@ void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *t } } -Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pItem ) +Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pItem) { if (!pItem) return NULL; @@ -1639,12 +1639,12 @@ Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pIte } // Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case. -Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool clone ) +Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item *pItem, uint32 count, bool clone) { if (!pItem) return NULL; - sLog.outDebug( "GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count); + sLog.outDebug("GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count); Item* pItem2 = m_TabListMap[tab]->Slots[slot]; @@ -1670,7 +1670,7 @@ Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool } else { - pItem2->SetCount( pItem2->GetCount() + count ); + pItem2->SetCount(pItem2->GetCount() + count); pItem2->FSetState(ITEM_CHANGED); pItem2->SaveToDB(); // not in inventory and can be save standalone @@ -1685,14 +1685,14 @@ Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool } } -void Guild::RemoveItem(uint8 tab, uint8 slot ) +void Guild::RemoveItem(uint8 tab, uint8 slot) { m_TabListMap[tab]->Slots[slot] = NULL; CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE guildid='%u' AND TabId='%u' AND SlotId='%u'", GetId(), uint32(tab), uint32(slot)); } -uint8 Guild::_CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, GuildItemPosCountVec &dest, uint32& count, bool swap, Item* pSrcItem ) const +uint8 Guild::_CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, GuildItemPosCountVec &dest, uint32& count, bool swap, Item* pSrcItem) const { Item* pItem2 = m_TabListMap[tab]->Slots[slot]; @@ -1735,7 +1735,7 @@ uint8 Guild::_CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, GuildItemPosCo return EQUIP_ERR_OK; } -uint8 Guild::_CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec &dest, uint32& count, bool merge, Item* pSrcItem, uint8 skip_slot ) const +uint8 Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec &dest, uint32& count, bool merge, Item* pSrcItem, uint8 skip_slot) const { assert(pSrcItem); for (uint32 j = 0; j < GUILD_BANK_MAX_SLOTS; ++j) @@ -1793,9 +1793,9 @@ uint8 Guild::_CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec &dest, uint32& return EQUIP_ERR_OK; } -uint8 Guild::CanStoreItem( uint8 tab, uint8 slot, GuildItemPosCountVec &dest, uint32 count, Item *pItem, bool swap ) const +uint8 Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec &dest, uint32 count, Item *pItem, bool swap) const { - sLog.outDebug( "GUILD STORAGE: CanStoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count); + sLog.outDebug("GUILD STORAGE: CanStoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count); if (count > pItem->GetCount()) return EQUIP_ERR_COULDNT_SPLIT_ITEMS; @@ -1999,7 +1999,7 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT DisplayGuildBankContentUpdate(BankTabDst,BankTabSlotDst); } -void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount) +void Guild::MoveFromBankToChar(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount) { Item *pItemBank = GetItem(BankTab, BankTabSlot); Item *pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot); @@ -2115,7 +2115,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u // logging item move to bank if (pl->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { - sLog.outCommand(pl->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )", + sLog.outCommand(pl->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)", pl->GetName(), pl->GetSession()->GetAccountId(), pItemChar->GetProto()->Name1, pItemChar->GetEntry(), pItemChar->GetCount(), m_Id); @@ -2146,7 +2146,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u DisplayGuildBankContentUpdate(BankTab,BankTabSlot); } -void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount ) +void Guild::MoveFromCharToBank(Player * pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount) { Item *pItemBank = GetItem(BankTab, BankTabSlot); Item *pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot); @@ -2156,7 +2156,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, if (!pItemChar->CanBeTraded()) { - pl->SendEquipError( EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, pItemChar, NULL ); + pl->SendEquipError(EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, pItemChar, NULL); return; } @@ -2179,7 +2179,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, return; } - Item *pNewItem = pItemChar->CloneItem( SplitedAmount ); + Item *pNewItem = pItemChar->CloneItem(SplitedAmount); if (!pNewItem) { pl->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItemChar, NULL); @@ -2189,7 +2189,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, // logging item move to bank (before items merge if (pl->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { - sLog.outCommand(pl->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )", + sLog.outCommand(pl->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)", pl->GetName(), pl->GetSession()->GetAccountId(), pItemChar->GetProto()->Name1, pItemChar->GetEntry(), SplitedAmount,m_Id); } @@ -2197,7 +2197,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, CharacterDatabase.BeginTransaction(); LogBankEvent(GUILD_BANK_LOG_DEPOSIT_ITEM, BankTab, pl->GetGUIDLow(), pItemChar->GetEntry(), SplitedAmount); - pl->ItemRemovedQuestCheck( pItemChar->GetEntry(), SplitedAmount ); + pl->ItemRemovedQuestCheck(pItemChar->GetEntry(), SplitedAmount); pItemChar->SetCount(pItemChar->GetCount()-SplitedAmount); pItemChar->SetState(ITEM_CHANGED, pl); pl->SaveInventoryAndGoldToDB(); @@ -2215,7 +2215,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, // logging item move to bank if (pl->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { - sLog.outCommand(pl->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )", + sLog.outCommand(pl->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)", pl->GetName(), pl->GetSession()->GetAccountId(), pItemChar->GetProto()->Name1, pItemChar->GetEntry(), pItemChar->GetCount(), m_Id); @@ -2265,7 +2265,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, // logging item move to bank if (pl->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { - sLog.outCommand(pl->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )", + sLog.outCommand(pl->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)", pl->GetName(), pl->GetSession()->GetAccountId(), pItemChar->GetProto()->Name1, pItemChar->GetEntry(), pItemChar->GetCount(), m_Id); diff --git a/src/game/Guild.h b/src/game/Guild.h index 2fc52144d1b..c33f727b95c 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -390,9 +390,9 @@ class Guild void DisplayGuildBankContent(WorldSession *session, uint8 TabId); void DisplayGuildBankMoneyUpdate(WorldSession *session); - void SwapItems( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount); - void MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount); - void MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount); + void SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount); + void MoveFromBankToChar(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount); + void MoveFromCharToBank(Player * pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount); // Tabs void DisplayGuildBankTabsInfo(WorldSession *session); @@ -425,7 +425,7 @@ class Guild void LoadGuildBankEventLogFromDB(); void DisplayGuildBankLogs(WorldSession *session, uint8 TabId); void LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uint32 ItemOrMoney, uint8 ItemStackCount=0, uint8 DestTabId=0); - bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry ); + bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry); protected: void AddRank(const std::string& name,uint32 rights,uint32 money); @@ -467,16 +467,16 @@ class Guild private: // used only from high level Swap/Move functions Item* GetItem(uint8 TabId, uint8 SlotId); - uint8 CanStoreItem( uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32 count, Item *pItem, bool swap = false) const; - Item* StoreItem( uint8 tab, GuildItemPosCountVec const& pos, Item *pItem ); - void RemoveItem(uint8 tab, uint8 slot ); + uint8 CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32 count, Item *pItem, bool swap = false) const; + Item* StoreItem(uint8 tab, GuildItemPosCountVec const& pos, Item *pItem); + void RemoveItem(uint8 tab, uint8 slot); void DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2 = -1); void DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec const& slots); // internal common parts for CanStore/StoreItem functions - void AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *tab, int32 slot ); - uint8 _CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32& count, bool swap, Item *pSrcItem ) const; - uint8 _CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec& dest, uint32& count, bool merge, Item *pSrcItem, uint8 skip_slot ) const; - Item* _StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool clone ); + void AppendDisplayGuildBankSlot(WorldPacket& data, GuildBankTab const *tab, int32 slot); + uint8 _CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32& count, bool swap, Item *pSrcItem) const; + uint8 _CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest, uint32& count, bool merge, Item *pSrcItem, uint8 skip_slot) const; + Item* _StoreItem(uint8 tab, uint8 slot, Item *pItem, uint32 count, bool clone); }; #endif diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index f32fa8b37fa..763bc09a080 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -467,7 +467,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) return; } - if ( oldLeader->GetGUID() != guild->GetLeader()) + if (oldLeader->GetGUID() != guild->GetLeader()) { SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); return; @@ -809,7 +809,7 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) /****** GUILD BANK *******/ -void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */ ) +void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket & /* recv_data */) { sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)"); if (uint32 GuildId = GetPlayer()->GetGuildId()) @@ -817,7 +817,7 @@ void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */ pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow()); } -void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ ) +void WorldSession::HandleGuildPermissions(WorldPacket& /* recv_data */) { sLog.outDebug("WORLD: Received (MSG_GUILD_PERMISSIONS)"); @@ -846,7 +846,7 @@ void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ ) } /* Called when clicking on Guild bank gameobject */ -void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankerActivate(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANKER_ACTIVATE)"); @@ -870,7 +870,7 @@ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data ) } /* Called when opening guild bank tab only (first one) */ -void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)"); @@ -898,7 +898,7 @@ void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data ) pGuild->DisplayGuildBankContent(this, TabId); } -void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankDepositMoney(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_DEPOSIT_MONEY)"); @@ -949,7 +949,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data ) pGuild->DisplayGuildBankMoneyUpdate(this); } -void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_WITHDRAW_MONEY)"); @@ -1002,7 +1002,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data ) pGuild->DisplayGuildBankMoneyUpdate(this); } -void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_SWAP_ITEMS)"); @@ -1098,9 +1098,9 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) // Player <-> Bank // allow work with inventory only - if (!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) ) + if (!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT)) { - _player->SendEquipError( EQUIP_ERR_NONE, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_NONE, NULL, NULL); return; } @@ -1111,7 +1111,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) pGuild->MoveFromCharToBank(_player, PlayerBag, PlayerSlot, BankTab, BankTabSlot, SplitedAmount); } -void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankBuyTab(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_BUY_TAB)"); @@ -1152,7 +1152,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data ) pGuild->DisplayGuildBankTabsInfo(this); } -void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankUpdateTab(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_UPDATE_TAB)"); @@ -1191,7 +1191,7 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data ) pGuild->DisplayGuildBankContent(this, TabId); } -void WorldSession::HandleGuildBankLogQuery( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankLogQuery(WorldPacket & recv_data) { sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_LOG_QUERY)"); @@ -1257,9 +1257,9 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data) pGuild->SetGuildBankTabText(TabId, Text); } -void WorldSession::SendSaveGuildEmblem( uint32 msg ) +void WorldSession::SendSaveGuildEmblem(uint32 msg) { WorldPacket data(MSG_SAVE_GUILD_EMBLEM, 4); data << uint32(msg); // not part of guild - SendPacket( &data ); + SendPacket(&data); } diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp index cd3961a538c..b7f9ca318aa 100644 --- a/src/game/HomeMovementGenerator.cpp +++ b/src/game/HomeMovementGenerator.cpp @@ -43,10 +43,10 @@ HomeMovementGenerator<Creature>::Reset(Creature &) void HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner) { - if ( !&owner ) + if (!&owner) return; - if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) ) + if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) return; float x, y, z; @@ -62,7 +62,7 @@ HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner) bool HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff) { - CreatureTraveller traveller( owner); + CreatureTraveller traveller(owner); i_destinationHolder.UpdateTraveller(traveller, time_diff); if (time_diff > i_travel_timer) diff --git a/src/game/HostileRefManager.h b/src/game/HostileRefManager.h index 385accb233b..80b676312a1 100644 --- a/src/game/HostileRefManager.h +++ b/src/game/HostileRefManager.h @@ -57,7 +57,7 @@ class HostileRefManager : public RefManager<Unit, ThreatManager> // Remove specific faction references void deleteReferencesForFaction(uint32 faction); - HostileReference* getFirst() { return ((HostileReference* ) RefManager<Unit, ThreatManager>::getFirst()); } + HostileReference* getFirst() { return ((HostileReference*) RefManager<Unit, ThreatManager>::getFirst()); } void updateThreatTables(); diff --git a/src/game/IdleMovementGenerator.cpp b/src/game/IdleMovementGenerator.cpp index 0fa911003e4..450da1ba925 100644 --- a/src/game/IdleMovementGenerator.cpp +++ b/src/game/IdleMovementGenerator.cpp @@ -58,7 +58,7 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff) if (m_direction == ROTATE_DIRECTION_LEFT) { angle += (float)diff * M_PI * 2 / m_maxDuration; - while (angle >= M_PI * 2 ) angle -= M_PI * 2; + while (angle >= M_PI * 2) angle -= M_PI * 2; } else { diff --git a/src/game/InstanceData.cpp b/src/game/InstanceData.cpp index 5aacf436159..4ebf9572bb0 100644 --- a/src/game/InstanceData.cpp +++ b/src/game/InstanceData.cpp @@ -350,7 +350,7 @@ void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell) pPlayer->RemoveAurasDueToSpell(spell); } -bool InstanceData::CheckAchievementCriteriaMeet( uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/ ) +bool InstanceData::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/) { sLog.outError("Achievement system call InstanceData::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", instance->GetId(),criteria_id); diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 87898488fe9..de79dfa8923 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -43,7 +43,7 @@ #include "Policies/Singleton.h" #include "Policies/SingletonImp.h" -INSTANTIATE_SINGLETON_1( InstanceSaveManager ); +INSTANTIATE_SINGLETON_1(InstanceSaveManager); InstanceSaveManager::InstanceSaveManager() : lock_instLists(false) { @@ -142,7 +142,7 @@ void InstanceSaveManager::DeleteInstanceFromDB(uint32 instanceid) void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId) { - InstanceSaveHashMap::iterator itr = m_instanceSaveById.find( InstanceId ); + InstanceSaveHashMap::iterator itr = m_instanceSaveById.find(InstanceId); if (itr != m_instanceSaveById.end()) { // save the resettime for normal instances only when they get unloaded @@ -235,7 +235,7 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const va_list ap; char szQueryTail [MAX_QUERY_LEN]; va_start(ap, queryTail); - int res = vsnprintf( szQueryTail, MAX_QUERY_LEN, queryTail, ap ); + int res = vsnprintf(szQueryTail, MAX_QUERY_LEN, queryTail, ap); va_end(ap); QueryResult_AutoPtr result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail); @@ -345,7 +345,7 @@ void InstanceSaveManager::CleanupInstances() bar.step(); sLog.outString(); - sLog.outString( ">> Initialized %u instances", (uint32)InstanceSet.size()); + sLog.outString(">> Initialized %u instances", (uint32)InstanceSet.size()); } void InstanceSaveManager::PackInstances() @@ -394,7 +394,7 @@ void InstanceSaveManager::PackInstances() } sLog.outString(); - sLog.outString( ">> Instance numbers remapped, next instance id is %u", InstanceNumber ); + sLog.outString(">> Instance numbers remapped, next instance id is %u", InstanceNumber); } void InstanceSaveManager::LoadResetTimes() @@ -416,7 +416,7 @@ void InstanceSaveManager::LoadResetTimes() ResetTimeMapDiffInstances mapDiffResetInstances; QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0"); - if ( result ) + if (result) { do { @@ -433,7 +433,7 @@ void InstanceSaveManager::LoadResetTimes() // update reset time for normal instances with the max creature respawn time + X hours result = WorldDatabase.Query("SELECT MAX(respawntime), instance FROM creature_respawn WHERE instance > 0 GROUP BY instance"); - if ( result ) + if (result) { do { diff --git a/src/game/Item.cpp b/src/game/Item.cpp index f2971b98dc6..2579a0c26ed 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -233,7 +233,7 @@ bool ItemCanGoIntoBag(ItemPrototype const *pProto, ItemPrototype const *pBagProt return false; } -Item::Item( ) +Item::Item() { m_objectType |= TYPEMASK_ITEM; m_objectTypeId = TYPEID_ITEM; @@ -254,9 +254,9 @@ Item::Item( ) m_paidExtendedCost = 0; } -bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner) +bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner) { - Object::_Create( guidlow, 0, HIGHGUID_ITEM ); + Object::_Create(guidlow, 0, HIGHGUID_ITEM); SetEntry(itemid); SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); @@ -312,7 +312,7 @@ void Item::SaveToDB() ss << "REPLACE INTO item_instance (guid,owner_guid,data) VALUES (" << guid << "," << GUID_LOPART(GetOwnerGUID()) << ",'"; for (uint16 i = 0; i < m_valuesCount; ++i) ss << GetUInt32Value(i) << " "; - ss << "' )"; + ss << "')"; CharacterDatabase.Execute(ss.str().c_str()); }break; case ITEM_CHANGED: @@ -323,7 +323,7 @@ void Item::SaveToDB() ss << GetUInt32Value(i) << " "; ss << "', owner_guid = '" << GUID_LOPART(GetOwnerGUID()) << "' WHERE guid = '" << guid << "'"; - CharacterDatabase.Execute( ss.str().c_str() ); + CharacterDatabase.Execute(ss.str().c_str()); if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) CharacterDatabase.PExecute("UPDATE character_gifts SET guid = '%u' WHERE item_guid = '%u'", GUID_LOPART(GetOwnerGUID()),GetGUIDLow()); @@ -771,7 +771,7 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const { // Special case - accept vellum for armor/weapon requirements if ((spellInfo->EquippedItemClass==ITEM_CLASS_ARMOR && proto->IsArmorVellum()) - ||( spellInfo->EquippedItemClass==ITEM_CLASS_WEAPON && proto->IsWeaponVellum())) + ||(spellInfo->EquippedItemClass==ITEM_CLASS_WEAPON && proto->IsWeaponVellum())) if (spellmgr.IsSkillTypeSpell(spellInfo->Id, SKILL_ENCHANTING)) // only for enchanting spells return true; @@ -939,7 +939,7 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const return count; } -bool Item::IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const +bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const { ItemPrototype const* proto = GetProto(); return proto && (proto->Map && proto->Map != cur_mapId || proto->Area && proto->Area != cur_zoneId); @@ -959,12 +959,12 @@ void Item::SendTimeUpdate(Player* owner) owner->GetSession()->SendPacket(&data); } -Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) +Item* Item::CreateItem(uint32 item, uint32 count, Player const* player) { if (count < 1) return NULL; //don't create item at zero count - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); + ItemPrototype const *pProto = objmgr.GetItemPrototype(item); if (pProto) { if (count > pProto->GetMaxStackSize()) @@ -972,10 +972,10 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) assert(count !=0 && "pProto->Stackable==0 but checked at loading already"); - Item *pItem = NewItemOrBag( pProto ); + Item *pItem = NewItemOrBag(pProto); if (pItem->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), item, player)) { - pItem->SetCount( count ); + pItem->SetCount(count); return pItem; } else @@ -986,21 +986,21 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) return NULL; } -Item* Item::CloneItem( uint32 count, Player const* player ) const +Item* Item::CloneItem(uint32 count, Player const* player) const { - Item* newItem = CreateItem( GetEntry(), count, player ); + Item* newItem = CreateItem(GetEntry(), count, player); if (!newItem) return NULL; - newItem->SetUInt32Value( ITEM_FIELD_CREATOR, GetUInt32Value( ITEM_FIELD_CREATOR ) ); - newItem->SetUInt32Value( ITEM_FIELD_GIFTCREATOR, GetUInt32Value( ITEM_FIELD_GIFTCREATOR ) ); - newItem->SetUInt32Value( ITEM_FIELD_FLAGS, GetUInt32Value( ITEM_FIELD_FLAGS ) ); - newItem->SetUInt32Value( ITEM_FIELD_DURATION, GetUInt32Value( ITEM_FIELD_DURATION ) ); + newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR)); + newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR)); + newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS)); + newItem->SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION)); newItem->SetItemRandomProperties(GetItemRandomPropertyId()); return newItem; } -bool Item::IsBindedNotWith( Player const* player ) const +bool Item::IsBindedNotWith(Player const* player) const { // not binded item if (!IsSoulBound()) @@ -1026,7 +1026,7 @@ bool Item::IsBindedNotWith( Player const* player ) const } } -bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const +bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const { if (pUnitTarget->GetTypeId() != TYPEID_UNIT) return false; diff --git a/src/game/Item.h b/src/game/Item.h index 33018faefb8..c03b6388b27 100644 --- a/src/game/Item.h +++ b/src/game/Item.h @@ -221,12 +221,12 @@ bool ItemCanGoIntoBag(ItemPrototype const *proto, ItemPrototype const *pBagProto class Item : public Object { public: - static Item* CreateItem( uint32 item, uint32 count, Player const* player = NULL ); - Item* CloneItem( uint32 count, Player const* player = NULL ) const; + static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL); + Item* CloneItem(uint32 count, Player const* player = NULL) const; - Item ( ); + Item (); - virtual bool Create( uint32 guidlow, uint32 itemid, Player const* owner); + virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner); ItemPrototype const* GetProto() const; @@ -257,7 +257,7 @@ class Item : public Object bool IsFitToSpellRequirements(SpellEntry const* spellInfo) const; bool IsTargetValidForItemUse(Unit* pUnitTarget); - bool IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const; + bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const; bool GemsFitSockets() const; uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); } @@ -335,7 +335,7 @@ class Item : public Object uint32 GetPlayedTime(); bool IsRefundExpired(); - void BuildUpdate(UpdateDataMapType& ); + void BuildUpdate(UpdateDataMapType&); private: uint8 m_slot; diff --git a/src/game/ItemEnchantmentMgr.cpp b/src/game/ItemEnchantmentMgr.cpp index fd4fdd505e8..f86ecf1ba67 100644 --- a/src/game/ItemEnchantmentMgr.cpp +++ b/src/game/ItemEnchantmentMgr.cpp @@ -71,18 +71,18 @@ void LoadRandomEnchantmentsTable() chance = fields[2].GetFloat(); if (chance > 0.000001f && chance <= 100.0f) - RandomItemEnch[entry].push_back( EnchStoreItem(ench, chance) ); + RandomItemEnch[entry].push_back(EnchStoreItem(ench, chance)); ++count; } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u Item Enchantment definitions", count ); + sLog.outString(">> Loaded %u Item Enchantment definitions", count); } else { sLog.outString(); - sLog.outErrorDb( ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); + sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); } } diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index d323f84d016..38eee6a71ac 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -29,7 +29,7 @@ #include "UpdateData.h" #include "ObjectAccessor.h" -void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSplitItemOpcode(WorldPacket & recv_data) { //sLog.outDebug("WORLD: CMSG_SPLIT_ITEM"); uint8 srcbag, srcslot, dstbag, dstslot; @@ -38,8 +38,8 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data ) recv_data >> srcbag >> srcslot >> dstbag >> dstslot >> count; //sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u, count = %u", srcbag, srcslot, dstbag, dstslot, count); - uint16 src = ( (srcbag << 8) | srcslot ); - uint16 dst = ( (dstbag << 8) | dstslot ); + uint16 src = ((srcbag << 8) | srcslot); + uint16 dst = ((dstbag << 8) | dstslot); if (src==dst) return; @@ -49,20 +49,20 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data ) if (!_player->IsValidPos(srcbag,srcslot)) { - _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } if (!_player->IsValidPos(dstbag,dstslot)) { - _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); return; } - _player->SplitItem( src, dst, count ); + _player->SplitItem(src, dst, count); } -void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recv_data) { //sLog.outDebug("WORLD: CMSG_SWAP_INV_ITEM"); uint8 srcslot, dstslot; @@ -76,23 +76,23 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data ) if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot)) { - _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot)) { - _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); return; } - uint16 src = ( (INVENTORY_SLOT_BAG_0 << 8) | srcslot ); - uint16 dst = ( (INVENTORY_SLOT_BAG_0 << 8) | dstslot ); + uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot); + uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot); - _player->SwapItem( src, dst ); + _player->SwapItem(src, dst); } -void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket & recv_data) { uint64 itemguid; uint8 dstslot; @@ -111,7 +111,7 @@ void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data ) _player->SwapItem(item->GetPos(), dstpos); } -void WorldSession::HandleSwapItem( WorldPacket & recv_data ) +void WorldSession::HandleSwapItem(WorldPacket & recv_data) { //sLog.outDebug("WORLD: CMSG_SWAP_ITEM"); uint8 dstbag, dstslot, srcbag, srcslot; @@ -119,8 +119,8 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data ) recv_data >> dstbag >> dstslot >> srcbag >> srcslot ; //sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u", srcbag, srcslot, dstbag, dstslot); - uint16 src = ( (srcbag << 8) | srcslot ); - uint16 dst = ( (dstbag << 8) | dstslot ); + uint16 src = ((srcbag << 8) | srcslot); + uint16 dst = ((dstbag << 8) | dstslot); // prevent attempt swap same item to current position generated by client at special checting sequence if (src==dst) @@ -128,20 +128,20 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data ) if (!_player->IsValidPos(srcbag,srcslot)) { - _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } if (!_player->IsValidPos(dstbag,dstslot)) { - _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); return; } - _player->SwapItem( src, dst ); + _player->SwapItem(src, dst); } -void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recv_data) { //sLog.outDebug("WORLD: CMSG_AUTOEQUIP_ITEM"); uint8 srcbag, srcslot; @@ -149,22 +149,22 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) recv_data >> srcbag >> srcslot; //sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); - Item *pSrcItem = _player->GetItemByPos( srcbag, srcslot ); - if ( !pSrcItem ) + Item *pSrcItem = _player->GetItemByPos(srcbag, srcslot); + if (!pSrcItem) return; // only at cheat if (pSrcItem->m_lootGenerated) // prevent swap looting item { //best error message found for attempting to swap while looting - _player->SendEquipError( EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL ); + _player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL); return; } uint16 dest; - uint8 msg = _player->CanEquipItem( NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag() ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = _player->CanEquipItem(NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag()); + if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, pSrcItem, NULL ); + _player->SendEquipError(msg, pSrcItem, NULL); return; } @@ -172,11 +172,11 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) if (dest==src) // prevent equip in same slot, only at cheat return; - Item *pDstItem = _player->GetItemByPos( dest ); - if ( !pDstItem ) // empty slot, simple case + Item *pDstItem = _player->GetItemByPos(dest); + if (!pDstItem) // empty slot, simple case { - _player->RemoveItem( srcbag, srcslot, true ); - _player->EquipItem( dest, pSrcItem, true ); + _player->RemoveItem(srcbag, srcslot, true); + _player->EquipItem(dest, pSrcItem, true); _player->AutoUnequipOffhandIfNeed(); } else // have currently equipped item, not simple case @@ -184,42 +184,42 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) uint8 dstbag = pDstItem->GetBagSlot(); uint8 dstslot = pDstItem->GetSlot(); - msg = _player->CanUnequipItem( dest, !pSrcItem->IsBag() ); - if ( msg != EQUIP_ERR_OK ) + msg = _player->CanUnequipItem(dest, !pSrcItem->IsBag()); + if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, pDstItem, NULL ); + _player->SendEquipError(msg, pDstItem, NULL); return; } // check dest->src move possibility ItemPosCountVec sSrc; uint16 eSrc = 0; - if ( _player->IsInventoryPos( src ) ) + if (_player->IsInventoryPos(src)) { - msg = _player->CanStoreItem( srcbag, srcslot, sSrc, pDstItem, true ); - if ( msg != EQUIP_ERR_OK ) - msg = _player->CanStoreItem( srcbag, NULL_SLOT, sSrc, pDstItem, true ); - if ( msg != EQUIP_ERR_OK ) - msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sSrc, pDstItem, true ); + msg = _player->CanStoreItem(srcbag, srcslot, sSrc, pDstItem, true); + if (msg != EQUIP_ERR_OK) + msg = _player->CanStoreItem(srcbag, NULL_SLOT, sSrc, pDstItem, true); + if (msg != EQUIP_ERR_OK) + msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sSrc, pDstItem, true); } - else if ( _player->IsBankPos( src ) ) + else if (_player->IsBankPos(src)) { - msg = _player->CanBankItem( srcbag, srcslot, sSrc, pDstItem, true ); - if ( msg != EQUIP_ERR_OK ) - msg = _player->CanBankItem( srcbag, NULL_SLOT, sSrc, pDstItem, true ); - if ( msg != EQUIP_ERR_OK ) - msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, sSrc, pDstItem, true ); + msg = _player->CanBankItem(srcbag, srcslot, sSrc, pDstItem, true); + if (msg != EQUIP_ERR_OK) + msg = _player->CanBankItem(srcbag, NULL_SLOT, sSrc, pDstItem, true); + if (msg != EQUIP_ERR_OK) + msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, sSrc, pDstItem, true); } - else if ( _player->IsEquipmentPos( src ) ) + else if (_player->IsEquipmentPos(src)) { - msg = _player->CanEquipItem( srcslot, eSrc, pDstItem, true); - if ( msg == EQUIP_ERR_OK ) - msg = _player->CanUnequipItem( eSrc, true); + msg = _player->CanEquipItem(srcslot, eSrc, pDstItem, true); + if (msg == EQUIP_ERR_OK) + msg = _player->CanUnequipItem(eSrc, true); } - if ( msg != EQUIP_ERR_OK ) + if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, pDstItem, pSrcItem ); + _player->SendEquipError(msg, pDstItem, pSrcItem); return; } @@ -231,18 +231,18 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) _player->EquipItem(dest, pSrcItem, true); // add to src - if ( _player->IsInventoryPos( src ) ) + if (_player->IsInventoryPos(src)) _player->StoreItem(sSrc, pDstItem, true); - else if ( _player->IsBankPos( src ) ) + else if (_player->IsBankPos(src)) _player->BankItem(sSrc, pDstItem, true); - else if ( _player->IsEquipmentPos( src ) ) + else if (_player->IsEquipmentPos(src)) _player->EquipItem(eSrc, pDstItem, true); _player->AutoUnequipOffhandIfNeed(); } } -void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data) { //sLog.outDebug("WORLD: CMSG_DESTROYITEM"); uint8 bag, slot, count, data1, data2, data3; @@ -255,32 +255,32 @@ void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data ) // prevent drop unequipable items (in combat, for example) and non-empty bags if (_player->IsEquipmentPos(pos) || _player->IsBagPos(pos)) { - uint8 msg = _player->CanUnequipItem( pos, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = _player->CanUnequipItem(pos, false); + if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, _player->GetItemByPos(pos), NULL ); + _player->SendEquipError(msg, _player->GetItemByPos(pos), NULL); return; } } - Item *pItem = _player->GetItemByPos( bag, slot ); + Item *pItem = _player->GetItemByPos(bag, slot); if (!pItem) { - _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } if (count) { uint32 i_count = count; - _player->DestroyItemCount( pItem, i_count, true ); + _player->DestroyItemCount(pItem, i_count, true); } else - _player->DestroyItem( bag, slot, true ); + _player->DestroyItem(bag, slot, true); } // Only _static_ data send in this packet !!! -void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) +void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data) { //sLog.outDebug("WORLD: CMSG_ITEM_QUERY_SINGLE"); uint32 item; @@ -288,14 +288,14 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) sLog.outDetail("STORAGE: Item Query = %u", item); - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); - if ( pProto ) + ItemPrototype const *pProto = objmgr.GetItemPrototype(item); + if (pProto) { std::string Name = pProto->Name1; std::string Description = pProto->Description; int loc_idx = GetSessionDbLocaleIndex(); - if ( loc_idx >= 0 ) + if (loc_idx >= 0) { ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); if (il) @@ -307,7 +307,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) } } // guess size - WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600); + WorldPacket data(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600); data << pProto->ItemId; data << pProto->Class; data << pProto->SubClass; @@ -431,66 +431,66 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) data << abs(pProto->Duration); // added in 2.4.2.8209, duration (seconds) data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory data << pProto->HolidayId; // Holiday.dbc? - SendPacket( &data ); + SendPacket(&data); } else { - sLog.outDebug( "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item ); - WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); + sLog.outDebug("WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item); + WorldPacket data(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); data << uint32(item | 0x80000000); - SendPacket( &data ); + SendPacket(&data); } } -void WorldSession::HandleReadItem( WorldPacket & recv_data ) +void WorldSession::HandleReadItem(WorldPacket & recv_data) { - //sLog.outDebug( "WORLD: CMSG_READ_ITEM"); + //sLog.outDebug("WORLD: CMSG_READ_ITEM"); uint8 bag, slot; recv_data >> bag >> slot; //sLog.outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot); - Item *pItem = _player->GetItemByPos( bag, slot ); + Item *pItem = _player->GetItemByPos(bag, slot); - if ( pItem && pItem->GetProto()->PageText ) + if (pItem && pItem->GetProto()->PageText) { WorldPacket data; - uint8 msg = _player->CanUseItem( pItem ); - if ( msg == EQUIP_ERR_OK ) + uint8 msg = _player->CanUseItem(pItem); + if (msg == EQUIP_ERR_OK) { data.Initialize (SMSG_READ_ITEM_OK, 8); sLog.outDetail("STORAGE: Item page sent"); } else { - data.Initialize( SMSG_READ_ITEM_FAILED, 8 ); + data.Initialize(SMSG_READ_ITEM_FAILED, 8); sLog.outDetail("STORAGE: Unable to read item"); - _player->SendEquipError( msg, pItem, NULL ); + _player->SendEquipError(msg, pItem, NULL); } data << pItem->GetGUID(); SendPacket(&data); } else - _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); } -void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data ) +void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_PAGE_TEXT_QUERY" ); + sLog.outDebug("WORLD: Received CMSG_PAGE_TEXT_QUERY"); uint32 itemid; uint64 guid; recv_data >> itemid >> guid; - sLog.outDetail( "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u", + sLog.outDetail("Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u", itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid)); } -void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_SELL_ITEM" ); + sLog.outDebug("WORLD: Received CMSG_SELL_ITEM"); uint64 vendorguid, itemguid; uint32 count; @@ -502,8 +502,8 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); if (!pCreature) { - sLog.outDebug( "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); - _player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0); + sLog.outDebug("WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); + _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0); return; } @@ -511,27 +511,27 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - Item *pItem = _player->GetItemByGuid( itemguid ); - if ( pItem ) + Item *pItem = _player->GetItemByGuid(itemguid); + if (pItem) { // prevent sell not owner item if (_player->GetGUID()!=pItem->GetOwnerGUID()) { - _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); return; } // prevent sell non empty bag by drag-and-drop at vendor's item list if (pItem->IsBag() && !((Bag*)pItem)->IsEmpty()) { - _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); return; } // prevent sell currently looted item if (_player->GetLootGUID()==pItem->GetGUID()) { - _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); return; } @@ -545,58 +545,58 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) // prevent sell more items that exist in stack (possible only not from client) if (count > pItem->GetCount()) { - _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); return; } } ItemPrototype const *pProto = pItem->GetProto(); - if ( pProto ) + if (pProto) { - if ( pProto->SellPrice > 0 ) + if (pProto->SellPrice > 0) { if (count < pItem->GetCount()) // need split items { - Item *pNewItem = pItem->CloneItem( count, _player ); + Item *pNewItem = pItem->CloneItem(count, _player); if (!pNewItem) { - sLog.outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count ); - _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + sLog.outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); return; } - pItem->SetCount( pItem->GetCount() - count ); - _player->ItemRemovedQuestCheck( pItem->GetEntry(), count ); - if ( _player->IsInWorld() ) - pItem->SendUpdateToPlayer( _player ); + pItem->SetCount(pItem->GetCount() - count); + _player->ItemRemovedQuestCheck(pItem->GetEntry(), count); + if (_player->IsInWorld()) + pItem->SendUpdateToPlayer(_player); pItem->SetState(ITEM_CHANGED, _player); - _player->AddItemToBuyBackSlot( pNewItem ); - if ( _player->IsInWorld() ) - pNewItem->SendUpdateToPlayer( _player ); + _player->AddItemToBuyBackSlot(pNewItem); + if (_player->IsInWorld()) + pNewItem->SendUpdateToPlayer(_player); } else { - _player->ItemRemovedQuestCheck( pItem->GetEntry(), pItem->GetCount()); - _player->RemoveItem( pItem->GetBagSlot(), pItem->GetSlot(), true); + _player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount()); + _player->RemoveItem(pItem->GetBagSlot(), pItem->GetSlot(), true); pItem->RemoveFromUpdateQueueOf(_player); - _player->AddItemToBuyBackSlot( pItem ); + _player->AddItemToBuyBackSlot(pItem); } - _player->ModifyMoney( pProto->SellPrice * count ); + _player->ModifyMoney(pProto->SellPrice * count); } else - _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); return; } } - _player->SendSellError( SELL_ERR_CANT_FIND_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_FIND_ITEM, pCreature, itemguid, 0); return; } void WorldSession::HandleBuybackItem(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_BUYBACK_ITEM" ); + sLog.outDebug("WORLD: Received CMSG_BUYBACK_ITEM"); uint64 vendorguid; uint32 slot; @@ -605,8 +605,8 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); if (!pCreature) { - sLog.outDebug( "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); - _player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); + sLog.outDebug("WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); + _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); return; } @@ -614,36 +614,36 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - Item *pItem = _player->GetItemFromBuyBackSlot( slot ); - if ( pItem ) + Item *pItem = _player->GetItemFromBuyBackSlot(slot); + if (pItem) { - uint32 price = _player->GetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START ); - if ( _player->GetMoney() < price ) + uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START); + if (_player->GetMoney() < price) { - _player->SendBuyError( BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, pItem->GetEntry(), 0); + _player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, pItem->GetEntry(), 0); return; } ItemPosCountVec dest; - uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false ); - if ( msg == EQUIP_ERR_OK ) + uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false); + if (msg == EQUIP_ERR_OK) { - _player->ModifyMoney( -(int32)price ); - _player->RemoveItemFromBuyBackSlot( slot, false ); - _player->ItemAddedQuestCheck( pItem->GetEntry(), pItem->GetCount()); - _player->StoreItem( dest, pItem, true ); + _player->ModifyMoney(-(int32)price); + _player->RemoveItemFromBuyBackSlot(slot, false); + _player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount()); + _player->StoreItem(dest, pItem, true); } else - _player->SendEquipError( msg, pItem, NULL ); + _player->SendEquipError(msg, pItem, NULL); return; } else - _player->SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, 0, 0); + _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, 0, 0); } -void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM_IN_SLOT" ); + sLog.outDebug("WORLD: Received CMSG_BUY_ITEM_IN_SLOT"); uint64 vendorguid, bagguid; uint32 item, slot, count; uint8 bagslot; @@ -677,9 +677,9 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data ) GetPlayer()->BuyItemFromVendor(vendorguid,item,count,bag,bagslot); } -void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBuyItemOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM" ); + sLog.outDebug("WORLD: Received CMSG_BUY_ITEM"); uint64 vendorguid; uint32 item, slot, count; uint8 unk1; @@ -689,7 +689,7 @@ void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data ) GetPlayer()->BuyItemFromVendor(vendorguid,item,count,NULL_BAG,NULL_SLOT); } -void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleListInventoryOpcode(WorldPacket & recv_data) { uint64 guid; @@ -698,20 +698,20 @@ void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data ) if (!GetPlayer()->isAlive()) return; - sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" ); + sLog.outDebug("WORLD: Recvd CMSG_LIST_INVENTORY"); - SendListInventory( guid ); + SendListInventory(guid); } -void WorldSession::SendListInventory( uint64 vendorguid ) +void WorldSession::SendListInventory(uint64 vendorguid) { - sLog.outDebug( "WORLD: Sent SMSG_LIST_INVENTORY" ); + sLog.outDebug("WORLD: Sent SMSG_LIST_INVENTORY"); Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); if (!pCreature) { - sLog.outDebug( "WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); - _player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); + sLog.outDebug("WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); + _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); return; } @@ -725,20 +725,20 @@ void WorldSession::SendListInventory( uint64 vendorguid ) VendorItemData const* vItems = pCreature->GetVendorItems(); if (!vItems) { - _player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); + _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); return; } uint8 numitems = vItems->GetItemCount(); uint8 count = 0; - WorldPacket data( SMSG_LIST_INVENTORY, (8+1+numitems*8*4) ); + WorldPacket data(SMSG_LIST_INVENTORY, (8+1+numitems*8*4)); data << uint64(vendorguid); data << uint8(numitems); float discountMod = _player->GetReputationPriceDiscount(pCreature); - for (int i = 0; i < numitems; ++i ) + for (int i = 0; i < numitems; ++i) { if (VendorItem const* crItem = vItems->GetItem(i)) { @@ -770,14 +770,14 @@ void WorldSession::SendListInventory( uint64 vendorguid ) } } - if ( count == 0 || data.size() != 8 + 1 + size_t(count) * 8 * 4 ) + if (count == 0 || data.size() != 8 + 1 + size_t(count) * 8 * 4) return; data.put<uint8>(8, count); - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data) { //sLog.outDebug("WORLD: CMSG_AUTOSTORE_BAG_ITEM"); uint8 srcbag, srcslot, dstbag; @@ -785,34 +785,34 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data ) recv_data >> srcbag >> srcslot >> dstbag; //sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag); - Item *pItem = _player->GetItemByPos( srcbag, srcslot ); - if ( !pItem ) + Item *pItem = _player->GetItemByPos(srcbag, srcslot); + if (!pItem) return; if (!_player->IsValidPos(dstbag,NULL_SLOT)) { - _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); return; } uint16 src = pItem->GetPos(); // check unequip potability for equipped items and bank bags - if (_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src )) + if (_player->IsEquipmentPos (src) || _player->IsBagPos (src)) { - uint8 msg = _player->CanUnequipItem( src, !_player->IsBagPos ( src )); + uint8 msg = _player->CanUnequipItem(src, !_player->IsBagPos (src)); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, pItem, NULL ); + _player->SendEquipError(msg, pItem, NULL); return; } } ItemPosCountVec dest; - uint8 msg = _player->CanStoreItem( dstbag, NULL_SLOT, dest, pItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false); + if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, pItem, NULL ); + _player->SendEquipError(msg, pItem, NULL); return; } @@ -820,12 +820,12 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data ) if (dest.size()==1 && dest[0].pos==src) { // just remove grey item state - _player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL ); + _player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); return; } - _player->RemoveItem(srcbag, srcslot, true ); - _player->StoreItem( dest, pItem, true ); + _player->RemoveItem(srcbag, srcslot, true); + _player->StoreItem(dest, pItem, true); } void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) @@ -840,7 +840,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); if (!pCreature) { - sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } */ @@ -876,20 +876,20 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) recvPacket >> srcbag >> srcslot; sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); - Item *pItem = _player->GetItemByPos( srcbag, srcslot ); - if ( !pItem ) + Item *pItem = _player->GetItemByPos(srcbag, srcslot); + if (!pItem) return; ItemPosCountVec dest; - uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); + if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, pItem, NULL ); + _player->SendEquipError(msg, pItem, NULL); return; } _player->RemoveItem(srcbag, srcslot, true); - _player->BankItem( dest, pItem, true ); + _player->BankItem(dest, pItem, true); } void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) @@ -900,35 +900,35 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) recvPacket >> srcbag >> srcslot; sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); - Item *pItem = _player->GetItemByPos( srcbag, srcslot ); - if ( !pItem ) + Item *pItem = _player->GetItemByPos(srcbag, srcslot); + if (!pItem) return; if (_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory { ItemPosCountVec dest; - uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false); + if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, pItem, NULL ); + _player->SendEquipError(msg, pItem, NULL); return; } _player->RemoveItem(srcbag, srcslot, true); - _player->StoreItem( dest, pItem, true ); + _player->StoreItem(dest, pItem, true); } else // moving from inventory to bank { ItemPosCountVec dest; - uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); + if (msg != EQUIP_ERR_OK) { - _player->SendEquipError( msg, pItem, NULL ); + _player->SendEquipError(msg, pItem, NULL); return; } _player->RemoveItem(srcbag, srcslot, true); - _player->BankItem( dest, pItem, true ); + _player->BankItem(dest, pItem, true); } } @@ -936,7 +936,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data) { if (!GetPlayer()->isAlive()) { - GetPlayer()->SendEquipError( EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL ); + GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL); return; } @@ -980,8 +980,8 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) recv_data.read_skip<uint64>(); // guid sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); - ItemPrototype const *pProto = objmgr.GetItemPrototype( itemid ); - if ( pProto ) + ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid); + if (pProto) { std::string Name; Name = pProto->Name1; @@ -1028,67 +1028,67 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) sLog.outDebug("WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot); - Item *gift = _player->GetItemByPos( gift_bag, gift_slot ); + Item *gift = _player->GetItemByPos(gift_bag, gift_slot); if (!gift) { - _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL); return; } if (!gift->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER))// cheating: non-wrapper wrapper { - _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL); return; } - Item *item = _player->GetItemByPos( item_bag, item_slot ); + Item *item = _player->GetItemByPos(item_bag, item_slot); - if ( !item ) + if (!item) { - _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, item, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL); return; } if (item==gift) // not possable with pacjket from real client { - _player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL ); + _player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL); return; } if (item->IsEquipped()) { - _player->SendEquipError( EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, NULL ); + _player->SendEquipError(EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, NULL); return; } if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED); { - _player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL ); + _player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL); return; } if (item->IsBag()) { - _player->SendEquipError( EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, NULL ); + _player->SendEquipError(EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, NULL); return; } if (item->IsSoulBound()) { - _player->SendEquipError( EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, NULL ); + _player->SendEquipError(EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, NULL); return; } if (item->GetMaxStackCount() != 1) { - _player->SendEquipError( EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, NULL ); + _player->SendEquipError(EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, NULL); return; } // maybe not correct check (it is better than nothing) if (item->GetProto()->MaxCount>0) { - _player->SendEquipError( EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL ); + _player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL); return; } @@ -1098,8 +1098,8 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) switch (item->GetEntry()) { - case 5042: item->SetEntry( 5043); break; - case 5048: item->SetEntry( 5044); break; + case 5042: item->SetEntry(5043); break; + case 5048: item->SetEntry(5044); break; case 17303: item->SetEntry(17302); break; case 17304: item->SetEntry(17305); break; case 17307: item->SetEntry(17308); break; @@ -1216,7 +1216,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) { if (iGemProto->ItemId == Gems[j]->GetEntry()) { - _player->SendEquipError( EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL); return; } } @@ -1226,7 +1226,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) { if (iGemProto->ItemId == enchantEntry->GemID) { - _player->SendEquipError( EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL); return; } } @@ -1270,7 +1270,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) if (limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount) { - _player->SendEquipError( EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL ); + _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL); return; } } @@ -1281,7 +1281,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) { if (uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0)) { - _player->SendEquipError( res, itemTarget, NULL ); + _player->SendEquipError(res, itemTarget, NULL); return; } } @@ -1302,7 +1302,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) { itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i), GemEnchants[i],0,0); if (Item* guidItem = _player->GetItemByGuid(gem_guids[i])) - _player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true ); + _player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true); } } diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 6ad589a3379..741b215bc16 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -474,7 +474,7 @@ inline uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemS } // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack(1) #else #pragma pack(push,1) @@ -653,7 +653,7 @@ struct ItemLocale }; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack() #else #pragma pack(pop) diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp index 61e31420f5d..bd7b1076df1 100644 --- a/src/game/LFGHandler.cpp +++ b/src/game/LFGHandler.cpp @@ -70,14 +70,14 @@ static void AttemptJoin(Player* _player) // stop at success join if (plr->GetGroup()->AddMember(_player->GetGUID(), _player->GetName())) { - if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER ) + if (sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER) _player->LeaveLFGChannel(); break; } // full else { - if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER ) + if (sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER) plr->LeaveLFGChannel(); } } @@ -106,7 +106,7 @@ static void AttemptAddMore(Player* _player) continue; // skip not auto join or in group - if (!plr->GetSession()->LookingForGroup_auto_join || plr->GetGroup() ) + if (!plr->GetSession()->LookingForGroup_auto_join || plr->GetGroup()) continue; if (!plr->m_lookingForGroup.HaveInSlot(_player->m_lookingForGroup.more)) @@ -126,22 +126,22 @@ static void AttemptAddMore(Player* _player) } // stop at join fail (full) - if (!_player->GetGroup()->AddMember(plr->GetGUID(), plr->GetName()) ) + if (!_player->GetGroup()->AddMember(plr->GetGUID(), plr->GetName())) { - if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER ) + if (sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER) _player->LeaveLFGChannel(); break; } // joined - if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER ) + if (sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER) plr->LeaveLFGChannel(); // and group full - if (_player->GetGroup()->IsFull() ) + if (_player->GetGroup()->IsFull()) { - if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER ) + if (sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER) _player->LeaveLFGChannel(); break; @@ -149,7 +149,7 @@ static void AttemptAddMore(Player* _player) } } -void WorldSession::HandleLfgSetAutoJoinOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLfgSetAutoJoinOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("CMSG_LFG_SET_AUTOJOIN"); LookingForGroup_auto_join = true; @@ -160,13 +160,13 @@ void WorldSession::HandleLfgSetAutoJoinOpcode( WorldPacket & /*recv_data*/ ) AttemptJoin(_player); } -void WorldSession::HandleLfgClearAutoJoinOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLfgClearAutoJoinOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("CMSG_LFG_CLEAR_AUTOJOIN"); LookingForGroup_auto_join = false; } -void WorldSession::HandleLfmSetAutoFillOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLfmSetAutoFillOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("CMSG_LFM_SET_AUTOFILL"); LookingForGroup_auto_add = true; @@ -177,13 +177,13 @@ void WorldSession::HandleLfmSetAutoFillOpcode( WorldPacket & /*recv_data*/ ) AttemptAddMore(_player); } -void WorldSession::HandleLfmClearAutoFillOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLfmClearAutoFillOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("CMSG_LFM_CLEAR_AUTOFILL"); LookingForGroup_auto_add = false; } -void WorldSession::HandleLfgClearOpcode( WorldPacket & /*recv_data */ ) +void WorldSession::HandleLfgClearOpcode(WorldPacket & /*recv_data */) { // empty packet sLog.outDebug("CMSG_CLEAR_LOOKING_FOR_GROUP"); @@ -191,13 +191,13 @@ void WorldSession::HandleLfgClearOpcode( WorldPacket & /*recv_data */ ) for (int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i) _player->m_lookingForGroup.slots[i].Clear(); - if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER ) + if (sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER) _player->LeaveLFGChannel(); SendLfgUpdate(0, 0, 0); } -void WorldSession::HandleLfmClearOpcode( WorldPacket & /*recv_data */) +void WorldSession::HandleLfmClearOpcode(WorldPacket & /*recv_data */) { // empty packet sLog.outDebug("CMSG_CLEAR_LOOKING_FOR_MORE"); @@ -205,7 +205,7 @@ void WorldSession::HandleLfmClearOpcode( WorldPacket & /*recv_data */) _player->m_lookingForGroup.more.Clear(); } -void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetLfmOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_SET_LOOKING_FOR_MORE"); //recv_data.hexlike(); @@ -215,8 +215,8 @@ void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data ) recv_data >> temp >> unk1 >> unk2[0] >> unk2[1] >> unk2[2]; - entry = ( temp & 0x00FFFFFF); - type = ( (temp >> 24) & 0x000000FF); + entry = (temp & 0x00FFFFFF); + type = ((temp >> 24) & 0x000000FF); _player->m_lookingForGroup.more.Set(entry,type); sLog.outDebug("LFM set: temp %u, zone %u, type %u", temp, entry, type); @@ -227,7 +227,7 @@ void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data ) SendLfgResult(type, entry, 1); } -void WorldSession::HandleSetLfgCommentOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetLfgCommentOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_SET_LFG_COMMENT"); //recv_data.hexlike(); @@ -392,7 +392,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type) */ } -void WorldSession::HandleSetLfgOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetLfgOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_SET_LOOKING_FOR_GROUP"); recv_data.hexlike(); @@ -401,8 +401,8 @@ void WorldSession::HandleSetLfgOpcode( WorldPacket & recv_data ) recv_data >> slot >> temp >> roles >> unk1; - entry = ( temp & 0x00FFFFFF); - type = ( (temp >> 24) & 0x000000FF); + entry = (temp & 0x00FFFFFF); + type = ((temp >> 24) & 0x000000FF); if (slot >= MAX_LOOKING_FOR_GROUP_SLOT) return; diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index 94533d3354b..04af191c03f 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -122,14 +122,14 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) bool ChatHandler::HandleDismountCommand(const char* /*args*/) { //If player is not mounted, so go out :) - if (!m_session->GetPlayer( )->IsMounted()) + if (!m_session->GetPlayer()->IsMounted()) { SendSysMessage(LANG_CHAR_NON_MOUNTED); SetSentErrorMessage(true); return false; } - if (m_session->GetPlayer( )->isInFlight()) + if (m_session->GetPlayer()->isInFlight()) { SendSysMessage(LANG_YOU_IN_FLIGHT); SetSentErrorMessage(true); @@ -270,14 +270,14 @@ bool ChatHandler::HandleAccountLockCommand(const char* args) std::string argstr = (char*)args; if (argstr == "on") { - loginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%d'",m_session->GetAccountId()); + loginDatabase.PExecute("UPDATE account SET locked = '1' WHERE id = '%d'",m_session->GetAccountId()); PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED); return true; } if (argstr == "off") { - loginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%d'",m_session->GetAccountId()); + loginDatabase.PExecute("UPDATE account SET locked = '0' WHERE id = '%d'",m_session->GetAccountId()); PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED); return true; } diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 77aa0e49b75..95c005feb5d 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -290,7 +290,7 @@ std::string ChatHandler::PGetParseString(int32 entry, ...) va_list ap; char str [1024]; va_start(ap, entry); - vsnprintf(str,1024,format, ap ); + vsnprintf(str,1024,format, ap); va_end(ap); return (std::string)str; } @@ -467,7 +467,7 @@ bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args) // send abandon ticket WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); data << uint32(9); - plr->GetSession()->SendPacket( &data ); + plr->GetSession()->SendPacket(&data); return true; } @@ -478,7 +478,7 @@ bool ChatHandler::HandleGMTicketAssignToCommand(const char* args) char* tguid = strtok((char*)args, " "); uint64 ticketGuid = atoi(tguid); - char* targetgm = strtok( NULL, " "); + char* targetgm = strtok(NULL, " "); if (!targetgm) return false; @@ -577,7 +577,7 @@ bool ChatHandler::HandleGMTicketCommentCommand(const char* args) char* tguid = strtok((char*)args, " "); uint64 ticketGuid = atoi(tguid); - char* comment = strtok( NULL, "\n"); + char* comment = strtok(NULL, "\n"); if (!comment) return false; @@ -642,7 +642,7 @@ bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args) // Force abandon ticket WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); data << uint32(9); - plr->GetSession()->SendPacket( &data ); + plr->GetSession()->SendPacket(&data); } ticket = NULL; @@ -740,26 +740,26 @@ bool ChatHandler::HandleGPSCommand(const char* args) uint32 have_vmap = Map::ExistVMap(obj->GetMapId(),gx,gy) ? 1 : 0; PSendSysMessage(LANG_MAP_POSITION, - obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>" ), - zone_id, (zoneEntry ? zoneEntry->area_name[GetSessionDbcLocale()] : "<unknown>" ), - area_id, (areaEntry ? areaEntry->area_name[GetSessionDbcLocale()] : "<unknown>" ), + obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"), + zone_id, (zoneEntry ? zoneEntry->area_name[GetSessionDbcLocale()] : "<unknown>"), + area_id, (areaEntry ? areaEntry->area_name[GetSessionDbcLocale()] : "<unknown>"), obj->GetPhaseMask(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(), cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(), - zone_x, zone_y, ground_z, floor_z, have_map, have_vmap ); + zone_x, zone_y, ground_z, floor_z, have_map, have_vmap); sLog.outDebug("Player %s GPS call for %s '%s' (%s: %u):", m_session ? GetNameLink().c_str() : GetTrinityString(LANG_CONSOLE_COMMAND), (obj->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), obj->GetName(), - (obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow(): obj->GetEntry()) ); + (obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow(): obj->GetEntry())); sLog.outDebug(GetTrinityString(LANG_MAP_POSITION), - obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ), - zone_id, (zoneEntry ? zoneEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ), - area_id, (areaEntry ? areaEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ), + obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld.GetDefaultDbcLocale()] : "<unknown>"), + zone_id, (zoneEntry ? zoneEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>"), + area_id, (areaEntry ? areaEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>"), obj->GetPhaseMask(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(), cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(), - zone_x, zone_y, ground_z, floor_z, have_map, have_vmap ); + zone_x, zone_y, ground_z, floor_z, have_map, have_vmap); LiquidData liquid_status; ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status); @@ -1153,8 +1153,8 @@ bool ChatHandler::HandleModifyManaCommand(const char* args) if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_YOURS_MANA_CHANGED, GetNameLink().c_str(), mana, manam); - chr->SetMaxPower(POWER_MANA,manam ); - chr->SetPower(POWER_MANA, mana ); + chr->SetMaxPower(POWER_MANA,manam); + chr->SetPower(POWER_MANA, mana); return true; } @@ -1202,8 +1202,8 @@ bool ChatHandler::HandleModifyEnergyCommand(const char* args) if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, GetNameLink().c_str(), energy/10, energym/10); - chr->SetMaxPower(POWER_ENERGY,energym ); - chr->SetPower(POWER_ENERGY, energy ); + chr->SetMaxPower(POWER_ENERGY,energym); + chr->SetPower(POWER_ENERGY, energy); sLog.outDetail(GetTrinityString(LANG_CURRENT_ENERGY),chr->GetMaxPower(POWER_ENERGY)); @@ -1253,8 +1253,8 @@ bool ChatHandler::HandleModifyRageCommand(const char* args) if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, GetNameLink().c_str(), rage/10, ragem/10); - chr->SetMaxPower(POWER_RAGE,ragem ); - chr->SetPower(POWER_RAGE, rage ); + chr->SetMaxPower(POWER_RAGE,ragem); + chr->SetPower(POWER_RAGE, rage); return true; } @@ -1287,8 +1287,8 @@ bool ChatHandler::HandleModifyRunicPowerCommand(const char* args) if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, GetNameLink().c_str(), rune/10, runem/10); - chr->SetMaxPower(POWER_RUNIC_POWER,runem ); - chr->SetPower(POWER_RUNIC_POWER, rune ); + chr->SetMaxPower(POWER_RUNIC_POWER,runem); + chr->SetPower(POWER_RUNIC_POWER, rune); return true; } @@ -1322,7 +1322,7 @@ bool ChatHandler::HandleModifyFactionCommand(const char* args) return true; } - if ( !chr ) + if (!chr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -2016,18 +2016,18 @@ bool ChatHandler::HandleModifyMountCommand(const char* args) chr->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); chr->Mount(mId); - WorldPacket data( SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4) ); + WorldPacket data(SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4)); data.append(chr->GetPackGUID()); data << (uint32)0; data << (uint8)0; //new 2.1.0 data << float(speed); - chr->SendMessageToSet( &data, true ); + chr->SendMessageToSet(&data, true); - data.Initialize( SMSG_FORCE_SWIM_SPEED_CHANGE, (8+4+4) ); + data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, (8+4+4)); data.append(chr->GetPackGUID()); data << (uint32)0; data << float(speed); - chr->SendMessageToSet( &data, true ); + chr->SendMessageToSet(&data, true); return true; } @@ -2059,7 +2059,7 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args) int32 newmoney = int32(moneyuser) + addmoney; sLog.outDetail(GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney); - if (newmoney <= 0 ) + if (newmoney <= 0) { PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, GetNameLink(chr).c_str()); if (needReportToTarget(chr)) @@ -2075,7 +2075,7 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args) PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), GetNameLink(chr).c_str()); if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetNameLink().c_str(), abs(addmoney)); - chr->SetMoney( newmoney ); + chr->SetMoney(newmoney); } } else @@ -2087,10 +2087,10 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args) if (addmoney >=MAX_MONEY_AMOUNT) chr->SetMoney(MAX_MONEY_AMOUNT); else - chr->ModifyMoney( addmoney ); + chr->ModifyMoney(addmoney); } - sLog.outDetail(GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney() ); + sLog.outDetail(GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney()); return true; } @@ -2098,7 +2098,7 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args) //Edit Unit field bool ChatHandler::HandleModifyBitCommand(const char* args) { - if ( !*args ) + if (!*args) return false; Unit *unit = getSelectedUnit(); @@ -2137,14 +2137,14 @@ bool ChatHandler::HandleModifyBitCommand(const char* args) return false; } - if ( unit->HasFlag( field, (1<<(bit-1)) ) ) + if (unit->HasFlag(field, (1<<(bit-1)))) { - unit->RemoveFlag( field, (1<<(bit-1)) ); + unit->RemoveFlag(field, (1<<(bit-1))); PSendSysMessage(LANG_REMOVE_BIT, bit, field); } else { - unit->SetFlag( field, (1<<(bit-1)) ); + unit->SetFlag(field, (1<<(bit-1))); PSendSysMessage(LANG_SET_BIT, bit, field); } return true; @@ -2310,7 +2310,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args) return false; // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower(wnamepart); std::ostringstream reply; @@ -2408,7 +2408,7 @@ bool ChatHandler::HandleSendMailCommand(const char* args) // from console show not existed sender MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - uint32 itemTextId = !text.empty() ? objmgr.CreateItemText( text ) : 0; + uint32 itemTextId = !text.empty() ? objmgr.CreateItemText(text) : 0; MailDraft(subject, itemTextId) .SendMailTo(MailReceiver(target,GUID_LOPART(target_guid)),sender); @@ -2548,7 +2548,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args) { Player *pl = itr->getSource(); - if (!pl || !pl->GetSession() ) + if (!pl || !pl->GetSession()) continue; // check online security @@ -2609,9 +2609,9 @@ bool ChatHandler::HandleGroupgoCommand(const char* args) bool to_instance = gmMap->Instanceable(); // we are in instance, and can summon only player in our group with us as lead - if ( to_instance && ( + if (to_instance && ( !m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) || - (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ) ) + (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()))) // the last check is a bit excessive, but let it be, just in case { SendSysMessage(LANG_CANNOT_SUMMON_TO_INST); @@ -2623,7 +2623,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args) { Player *pl = itr->getSource(); - if (!pl || pl==m_session->GetPlayer() || !pl->GetSession() ) + if (!pl || pl==m_session->GetPlayer() || !pl->GetSession()) continue; // check online security @@ -2643,7 +2643,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args) { Map* plMap = pl->GetMap(); - if ( plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId() ) + if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId()) { // cannot summon from instance to instance PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,plNameLink.c_str()); @@ -2842,7 +2842,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args) AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid); - if ( x<0 || x>100 || y<0 || y>100 || !areaEntry ) + if (x<0 || x>100 || y<0 || y>100 || !areaEntry) { PSendSysMessage(LANG_INVALID_ZONE_COORD,x,y,areaid); SetSentErrorMessage(true); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index c59c4f30df7..c7ed2abe26b 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -84,7 +84,7 @@ bool ChatHandler::HandleMuteCommand(const char* args) if (target) target->GetSession()->m_muteTime = mutetime; - loginDatabase.PExecute("UPDATE account SET mutetime = " UI64FMTD " WHERE id = '%u'",uint64(mutetime), account_id ); + loginDatabase.PExecute("UPDATE account SET mutetime = " UI64FMTD " WHERE id = '%u'",uint64(mutetime), account_id); if (target) ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime, mutereasonstr.c_str()); @@ -128,7 +128,7 @@ bool ChatHandler::HandleUnmuteCommand(const char* args) target->GetSession()->m_muteTime = 0; } - loginDatabase.PExecute("UPDATE account SET mutetime = '0' WHERE id = '%u'", account_id ); + loginDatabase.PExecute("UPDATE account SET mutetime = '0' WHERE id = '%u'", account_id); if (target) ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); @@ -296,7 +296,7 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args) std::ostringstream whereClause; // User wants to teleport to the NPC's template entry - if ( strcmp(pParam1, "id") == 0 ) + if (strcmp(pParam1, "id") == 0) { //sLog.outError("DEBUG: ID found"); @@ -336,7 +336,7 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args) } //sLog.outError("DEBUG: %s", whereClause.c_str()); - QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM creature %s", whereClause.str().c_str() ); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM creature %s", whereClause.str().c_str()); if (!result) { SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND); @@ -511,7 +511,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args) pool_id = poolhandler.IsPartOfAPool<GameObject>(lowguid); if (!pool_id || poolhandler.IsSpawnedObject<GameObject>(lowguid)) found = true; - } while ( result->NextRow() && (!found) ); + } while (result->NextRow() && (!found)); if (!found) { @@ -760,7 +760,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args) return false; } - if ( spawntimeSecs ) + if (spawntimeSecs) { uint32 value = atoi((char*)spawntimeSecs); pGameObj->SetRespawnTime(value); @@ -815,7 +815,7 @@ bool ChatHandler::HandleGameObjectPhaseCommand(const char* args) char* phaseStr = strtok (NULL, " "); uint32 phasemask = phaseStr? atoi(phaseStr) : 0; - if ( phasemask == 0 ) + if (phasemask == 0) { SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); @@ -917,7 +917,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args) std::wstring wrankStr; if (!Utf8toWStr(rankStr,wrankStr)) return false; - wstrToLower( wrankStr ); + wstrToLower(wrankStr); int r = 0; amount = -42000; @@ -1177,7 +1177,7 @@ bool ChatHandler::HandleNpcChangeLevelCommand(const char* args) return false; uint8 lvl = (uint8) atoi((char*)args); - if ( lvl < 1 || lvl > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) + 3) + if (lvl < 1 || lvl > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) + 3) { SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); @@ -1203,9 +1203,9 @@ bool ChatHandler::HandleNpcChangeLevelCommand(const char* args) } else { - pCreature->SetMaxHealth( 100 + 30*lvl); - pCreature->SetHealth( 100 + 30*lvl); - pCreature->SetLevel( lvl); + pCreature->SetMaxHealth(100 + 30*lvl); + pCreature->SetHealth(100 + 30*lvl); + pCreature->SetLevel(lvl); pCreature->SaveToDB(); } @@ -1391,7 +1391,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) uint32 lowguid = 0; Creature* pCreature = NULL; - if ( dontdel_str ) + if (dontdel_str) { //sLog.outError("DEBUG: All 3 params are set"); @@ -1399,7 +1399,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) // GUID // type // doNotDEL - if ( stricmp( dontdel_str, "NODEL" ) == 0 ) + if (stricmp(dontdel_str, "NODEL") == 0) { //sLog.outError("DEBUG: doNotDelete = true;"); doNotDelete = true; @@ -1408,10 +1408,10 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) else { // Only 2 params - but maybe NODEL is set - if ( type_str ) + if (type_str) { sLog.outError("DEBUG: Only 2 params "); - if ( stricmp( type_str, "NODEL" ) == 0 ) + if (stricmp(type_str, "NODEL") == 0) { //sLog.outError("DEBUG: type_str, NODEL "); doNotDelete = true; @@ -1489,7 +1489,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) } pCreature->SaveToDB(); } - if ( doNotDelete == false ) + if (doNotDelete == false) { PSendSysMessage(LANG_MOVE_TYPE_SET,type_str); } @@ -1767,7 +1767,7 @@ bool ChatHandler::HandleNpcSetPhaseCommand(const char* args) return false; uint32 phasemask = (uint32) atoi((char*)args); - if ( phasemask == 0 ) + if (phasemask == 0) { SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); @@ -1945,7 +1945,7 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot); uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot); - m_session->GetPlayer()->SwapItem( src, dst ); + m_session->GetPlayer()->SwapItem(src, dst); return true; } @@ -2326,7 +2326,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args) pathid = target->GetWaypointPath(); else { - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(id) FROM waypoint_data"); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(id) FROM waypoint_data"); uint32 maxpathid = result->Fetch()->GetInt32(); pathid = maxpathid+1; sLog.outDebug("DEBUG: HandleWpAddCommand - New path started."); @@ -2348,9 +2348,9 @@ bool ChatHandler::HandleWpAddCommand(const char* args) sLog.outDebug("DEBUG: HandleWpAddCommand - point == 0"); - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid); - if ( result ) + if (result) point = (*result)[0].GetUInt32(); Player* player = m_session->GetPlayer(); @@ -2405,9 +2405,9 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args) } guidlow = target->GetDBTableGUIDLow(); - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow); - if ( result ) + if (result) WorldDatabase.PExecute("UPDATE creature_addon SET path_id = '%u' WHERE guid = '%u'", pathid, guidlow); else WorldDatabase.PExecute("INSERT INTO creature_addon(guid,path_id) VALUES ('%u','%u')", guidlow, pathid); @@ -2476,7 +2476,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args) std::string show = show_str; // Check - if ( (show != "add") && (show != "mod") && (show != "del") && (show != "listid")) return false; + if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid")) return false; char* arg_id = strtok(NULL, " "); uint32 id = 0; @@ -2488,9 +2488,9 @@ bool ChatHandler::HandleWpEventCommand(const char* args) if (id) { - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id FROM waypoint_scripts WHERE guid = %u", id); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid = %u", id); - if ( !result ) + if (!result) { WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id); PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: New waypoint event added: ", id); @@ -2500,7 +2500,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args) } else { - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(guid) FROM waypoint_scripts"); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(guid) FROM waypoint_scripts"); id = result->Fetch()->GetUInt32(); WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id+1); PSendSysMessage("%s%s%u|r", "|cff00ff00","Wp Event: New waypoint event added: |r|cff00ffff", id+1); @@ -2523,9 +2523,9 @@ bool ChatHandler::HandleWpEventCommand(const char* args) float a8, a9, a10, a11; char const* a7; - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = %u", id); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = %u", id); - if ( !result ) + if (!result) { PSendSysMessage("%s%s%u|r", "|cff33ffff", "Wp Event: No waypoint scripts found on id: ", id); return true; @@ -2556,9 +2556,9 @@ bool ChatHandler::HandleWpEventCommand(const char* args) { id = atoi(arg_id); - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid FROM waypoint_scripts WHERE guid = %u", id); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM waypoint_scripts WHERE guid = %u", id); - if ( result ) + if (result) { WorldDatabase.PExecuteLog("DELETE FROM waypoint_scripts WHERE guid = %u", id); PSendSysMessage("%s%s%u|r","|cff00ff00","Wp Event: Waypoint script removed: ", id); @@ -2595,7 +2595,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args) std::string arg_string = arg_2; - if ( (arg_string != "setid") && (arg_string != "delay") && (arg_string != "command") + if ((arg_string != "setid") && (arg_string != "delay") && (arg_string != "command") && (arg_string != "datalong") && (arg_string != "datalong2") && (arg_string != "dataint") && (arg_string != "posx") && (arg_string != "posy") && (arg_string != "posz") && (arg_string != "orientation")) { @@ -2701,9 +2701,9 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) std::string show = show_str; // Check // Remember: "show" must also be the name of a column! - if ( (show != "delay") && (show != "action") && (show != "action_chance") + if ((show != "delay") && (show != "action") && (show != "action_chance") && (show != "move_flag") && (show != "del") && (show != "move") && (show != "wpadd") - ) +) { return false; } @@ -2741,9 +2741,9 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) } // User did select a visual waypoint? // Check the creature - if (wpCreature->GetEntry() == VISUAL_WAYPOINT ) + if (wpCreature->GetEntry() == VISUAL_WAYPOINT) { - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); if (!result) { @@ -2757,7 +2757,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) // (0.001) - There is no other way to compare C++ floats with mySQL floats // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html const char* maxDIFF = "0.01"; - result = WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s ) and (abs(position_y - %f) <= %s ) and (abs(position_z - %f) <= %s )", + result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)", wpCreature->GetPositionX(), maxDIFF, wpCreature->GetPositionY(), maxDIFF, wpCreature->GetPositionZ(), maxDIFF); if (!result) { @@ -2773,7 +2773,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) pathid = fields[0].GetUInt32(); point = fields[1].GetUInt32(); } - while ( result->NextRow() ); + while (result->NextRow()); // We have the waypoint number and the GUID of the "master npc" // Text is enclosed in "<>", all other arguments not @@ -2796,7 +2796,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) // wpCreature Creature* wpCreature = NULL; - if ( wpGuid != 0 ) + if (wpGuid != 0) { wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); wpCreature->CombatStop(); @@ -2825,7 +2825,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) // What to do: // Move the visual spawnpoint // Respawn the owner of the waypoints - if ( wpGuid != 0 ) + if (wpGuid != 0) { wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); wpCreature->CombatStop(); @@ -2848,7 +2848,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) } WorldDatabase.PExecuteLog("UPDATE waypoint_data SET position_x = '%f',position_y = '%f',position_z = '%f' where id = '%u' AND point='%u'", - chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), pathid, point ); + chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), pathid, point); PSendSysMessage(LANG_WAYPOINT_CHANGED); } @@ -2857,7 +2857,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) const char *text = arg_str; - if ( text == 0 ) + if (text == 0) { // show_str check for present in list of correct values, no sql injection possible WorldDatabase.PExecuteLog("UPDATE waypoint_data SET %s=NULL WHERE id='%u' AND point='%u'", @@ -2937,14 +2937,14 @@ bool ChatHandler::HandleWpShowCommand(const char* args) if (show == "info") { // Check if the user did specify a visual waypoint - if ( target->GetEntry() != VISUAL_WAYPOINT ) + if (target->GetEntry() != VISUAL_WAYPOINT) { PSendSysMessage(LANG_WAYPOINT_VP_SELECT); SetSentErrorMessage(true); return false; } - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow()); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow()); if (!result) { @@ -2969,14 +2969,14 @@ bool ChatHandler::HandleWpShowCommand(const char* args) PSendSysMessage("|cff00ff00Show info: Waypoint event: |r|cff00ffff%u|r", ev_id); PSendSysMessage("|cff00ff00Show info: Event chance: |r|cff00ffff%u|r", ev_chance); } - while ( result->NextRow() ); + while (result->NextRow()); return true; } if (show == "on") { - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT point, position_x,position_y,position_z FROM waypoint_data WHERE id = '%u'", pathid); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT point, position_x,position_y,position_z FROM waypoint_data WHERE id = '%u'", pathid); if (!result) { @@ -2988,7 +2988,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) PSendSysMessage("|cff00ff00DEBUG: wp on, PathID: |cff00ffff%u|r", pathid); // Delete all visuals for this NPC - QueryResult_AutoPtr result2 = WorldDatabase.PQuery( "SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0", pathid); + QueryResult_AutoPtr result2 = WorldDatabase.PQuery("SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0", pathid); if (result2) { @@ -3013,9 +3013,9 @@ bool ChatHandler::HandleWpShowCommand(const char* args) } } - while ( result2->NextRow() ); + while (result2->NextRow()); - if ( hasError ) + if (hasError) { PSendSysMessage(LANG_WAYPOINT_TOOFAR1); PSendSysMessage(LANG_WAYPOINT_TOOFAR2); @@ -3061,7 +3061,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) wpCreature->SetLevel(point > MAX_LEVEL ? MAX_LEVEL : point); } } - while ( result->NextRow() ); + while (result->NextRow()); SendSysMessage("|cff00ff00Showing the current creature's path.|r"); return true; @@ -3071,7 +3071,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) { PSendSysMessage("|cff00ff00DEBUG: wp first, GUID: %u|r", pathid); - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT position_x,position_y,position_z FROM waypoint_data WHERE point='1' AND id = '%u'",pathid); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z FROM waypoint_data WHERE point='1' AND id = '%u'",pathid); if (!result) { PSendSysMessage(LANG_WAYPOINT_NOTFOUND, pathid); @@ -3114,13 +3114,13 @@ bool ChatHandler::HandleWpShowCommand(const char* args) { PSendSysMessage("|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff%u|r", pathid); - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid); - if ( result ) + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid); + if (result) Maxpoint = (*result)[0].GetUInt32(); else Maxpoint = 0; - result = WorldDatabase.PQuery( "SELECT position_x,position_y,position_z FROM waypoint_data WHERE point ='%u' AND id = '%u'",Maxpoint, pathid); + result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z FROM waypoint_data WHERE point ='%u' AND id = '%u'",Maxpoint, pathid); if (!result) { PSendSysMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid); @@ -3191,7 +3191,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) WorldDatabase.PExecuteLog("UPDATE waypoint_data SET wpguid = '0'"); //WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid = '0' WHERE wpguid <> '0'"); - if ( hasError ) + if (hasError) { PSendSysMessage(LANG_WAYPOINT_TOOFAR1); PSendSysMessage(LANG_WAYPOINT_TOOFAR2); @@ -3315,7 +3315,7 @@ bool ChatHandler::HandleModifyStandStateCommand(const char* args) return false; uint32 anim_id = atoi((char*)args); - m_session->GetPlayer( )->SetUInt32Value( UNIT_NPC_EMOTESTATE , anim_id ); + m_session->GetPlayer()->SetUInt32Value(UNIT_NPC_EMOTESTATE , anim_id); return true; } @@ -3397,7 +3397,7 @@ bool ChatHandler::HandleLookupEventCommand(const char* args) GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); - for (uint32 id = 0; id < events.size(); ++id ) + for (uint32 id = 0; id < events.size(); ++id) { GameEventData const& eventData = events[id]; @@ -3410,9 +3410,9 @@ bool ChatHandler::HandleLookupEventCommand(const char* args) char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : ""; if (m_session) - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,id,id,eventData.description.c_str(),active ); + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,id,id,eventData.description.c_str(),active); else - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,id,eventData.description.c_str(),active ); + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,id,eventData.description.c_str(),active); if (!found) found = true; @@ -3434,15 +3434,15 @@ bool ChatHandler::HandleEventActiveListCommand(const char* args) char const* active = GetTrinityString(LANG_ACTIVE); - for (GameEventMgr::ActiveEvents::const_iterator itr = activeEvents.begin(); itr != activeEvents.end(); ++itr ) + for (GameEventMgr::ActiveEvents::const_iterator itr = activeEvents.begin(); itr != activeEvents.end(); ++itr) { uint32 event_id = *itr; GameEventData const& eventData = events[event_id]; if (m_session) - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,event_id,event_id,eventData.description.c_str(),active ); + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,event_id,event_id,eventData.description.c_str(),active); else - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,event_id,eventData.description.c_str(),active ); + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,event_id,eventData.description.c_str(),active); ++counter; } @@ -3611,11 +3611,11 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id) continue; // wrong skill - if ( skillLine->skillId != skill_id) + if (skillLine->skillId != skill_id) continue; // not high rank - if (skillLine->forward_spellid ) + if (skillLine->forward_spellid) continue; // skip racial skills @@ -3623,7 +3623,7 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id) continue; // skip wrong class skills - if ( skillLine->classmask && (skillLine->classmask & classmask) == 0) + if (skillLine->classmask && (skillLine->classmask & classmask) == 0) continue; SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); @@ -3640,7 +3640,7 @@ bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); - if ( !skillInfo ) + if (!skillInfo) continue; if ((skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY) && @@ -3660,7 +3660,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) // Example: .learn all_recipes enchanting Player* target = getSelectedPlayer(); - if ( !target ) + if (!target) { SendSysMessage(LANG_PLAYER_NOT_FOUND); return false; @@ -3677,7 +3677,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) uint32 counter = 0; // Counter for figure out that we found smth. // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower(wnamepart); std::string name; @@ -3819,7 +3819,7 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 li PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER,name.c_str(),guid); ++i; - } while ( chars->NextRow() && ( limit == -1 || i < limit ) ); + } while (chars->NextRow() && (limit == -1 || i < limit)); } } while (result->NextRow()); @@ -4129,7 +4129,7 @@ bool ChatHandler::HandleTempGameObjectCommand(const char* args) char* spawntime = strtok(NULL, " "); uint32 spawntm = 300; - if ( spawntime ) + if (spawntime) spawntm = atoi((char*)spawntime); float x = chr->GetPositionX(); @@ -4244,7 +4244,7 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args) return false; // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower(wnamepart); uint32 counter = 0; // Counter for figure out that we found smth. diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index c237bccf4e5..fcbdb9118c7 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -588,7 +588,7 @@ bool ChatHandler::HandleReloadAllAreaCommand(const char*) bool ChatHandler::HandleReloadAllLootCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables..." ); + sLog.outString("Re-Loading Loot Tables..."); LoadLootTables(); SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded."); return true; @@ -609,7 +609,7 @@ bool ChatHandler::HandleReloadAllQuestCommand(const char* /*args*/) HandleReloadQuestAreaTriggersCommand("a"); HandleReloadQuestTemplateCommand("a"); - sLog.outString( "Re-Loading Quests Relations..." ); + sLog.outString("Re-Loading Quests Relations..."); objmgr.LoadQuestRelations(); SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded."); return true; @@ -624,7 +624,7 @@ bool ChatHandler::HandleReloadAllScriptsCommand(const char*) return false; } - sLog.outString( "Re-Loading Scripts..." ); + sLog.outString("Re-Loading Scripts..."); HandleReloadGameObjectScriptsCommand("a"); HandleReloadEventScriptsCommand("a"); HandleReloadQuestEndScriptsCommand("a"); @@ -687,7 +687,7 @@ bool ChatHandler::HandleReloadAllLocalesCommand(const char* /*args*/) bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/) { - sLog.outString( "Re-Loading config settings..." ); + sLog.outString("Re-Loading config settings..."); sWorld.LoadConfigSettings(true); MapManager::Instance().InitializeVisibilityDistanceInfo(); SendGlobalGMSysMessage("World config settings reloaded."); @@ -696,7 +696,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/) bool ChatHandler::HandleReloadAccessRequirementCommand(const char*) { - sLog.outString( "Re-Loading Access Requirement definitions..." ); + sLog.outString("Re-Loading Access Requirement definitions..."); objmgr.LoadAccessRequirements(); SendGlobalGMSysMessage("DB table `access_requirement` reloaded."); return true; @@ -704,7 +704,7 @@ bool ChatHandler::HandleReloadAccessRequirementCommand(const char*) bool ChatHandler::HandleReloadAchievementCriteriaDataCommand(const char*) { - sLog.outString( "Re-Loading Additional Achievement Criteria Data..." ); + sLog.outString("Re-Loading Additional Achievement Criteria Data..."); achievementmgr.LoadAchievementCriteriaData(); SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded."); return true; @@ -712,7 +712,7 @@ bool ChatHandler::HandleReloadAchievementCriteriaDataCommand(const char*) bool ChatHandler::HandleReloadAchievementRewardCommand(const char*) { - sLog.outString( "Re-Loading Achievement Reward Data..." ); + sLog.outString("Re-Loading Achievement Reward Data..."); achievementmgr.LoadRewards(); SendGlobalGMSysMessage("DB table `achievement_reward` reloaded."); return true; @@ -720,7 +720,7 @@ bool ChatHandler::HandleReloadAchievementRewardCommand(const char*) bool ChatHandler::HandleReloadAreaTriggerTavernCommand(const char*) { - sLog.outString( "Re-Loading Tavern Area Triggers..." ); + sLog.outString("Re-Loading Tavern Area Triggers..."); objmgr.LoadTavernAreaTriggers(); SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded."); return true; @@ -728,7 +728,7 @@ bool ChatHandler::HandleReloadAreaTriggerTavernCommand(const char*) bool ChatHandler::HandleReloadAreaTriggerTeleportCommand(const char*) { - sLog.outString( "Re-Loading AreaTrigger teleport definitions..." ); + sLog.outString("Re-Loading AreaTrigger teleport definitions..."); objmgr.LoadAreaTriggerTeleports(); SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded."); return true; @@ -751,7 +751,7 @@ bool ChatHandler::HandleReloadCommandCommand(const char*) bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(const char*) { - sLog.outString( "Loading Quests Relations... (`creature_questrelation`)" ); + sLog.outString("Loading Quests Relations... (`creature_questrelation`)"); objmgr.LoadCreatureQuestRelations(); SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded."); return true; @@ -759,7 +759,7 @@ bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(const char*) bool ChatHandler::HandleReloadCreatureLinkedRespawnCommand(const char *args) { - sLog.outString( "Loading Linked Respawns... (`creature_linked_respawn`)" ); + sLog.outString("Loading Linked Respawns... (`creature_linked_respawn`)"); objmgr.LoadCreatureLinkedRespawn(); SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded."); return true; @@ -767,7 +767,7 @@ bool ChatHandler::HandleReloadCreatureLinkedRespawnCommand(const char *args) bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(const char*) { - sLog.outString( "Loading Quests Relations... (`creature_involvedrelation`)" ); + sLog.outString("Loading Quests Relations... (`creature_involvedrelation`)"); objmgr.LoadCreatureInvolvedRelations(); SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded."); return true; @@ -775,7 +775,7 @@ bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(const char*) bool ChatHandler::HandleReloadGossipMenuCommand(const char*) { - sLog.outString( "Re-Loading `gossip_menu` Table!" ); + sLog.outString("Re-Loading `gossip_menu` Table!"); objmgr.LoadGossipMenu(); SendGlobalSysMessage("DB table `gossip_menu` reloaded."); return true; @@ -783,7 +783,7 @@ bool ChatHandler::HandleReloadGossipMenuCommand(const char*) bool ChatHandler::HandleReloadGossipMenuOptionCommand(const char*) { - sLog.outString( "Re-Loading `gossip_menu_option` Table!" ); + sLog.outString("Re-Loading `gossip_menu_option` Table!"); objmgr.LoadGossipMenuItems(); SendGlobalSysMessage("DB table `gossip_menu_option` reloaded."); return true; @@ -791,7 +791,7 @@ bool ChatHandler::HandleReloadGossipMenuOptionCommand(const char*) bool ChatHandler::HandleReloadGOQuestRelationsCommand(const char*) { - sLog.outString( "Loading Quests Relations... (`gameobject_questrelation`)" ); + sLog.outString("Loading Quests Relations... (`gameobject_questrelation`)"); objmgr.LoadGameobjectQuestRelations(); SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded."); return true; @@ -799,7 +799,7 @@ bool ChatHandler::HandleReloadGOQuestRelationsCommand(const char*) bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(const char*) { - sLog.outString( "Loading Quests Relations... (`gameobject_involvedrelation`)" ); + sLog.outString("Loading Quests Relations... (`gameobject_involvedrelation`)"); objmgr.LoadGameobjectInvolvedRelations(); SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded."); return true; @@ -807,7 +807,7 @@ bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(const char*) bool ChatHandler::HandleReloadQuestAreaTriggersCommand(const char*) { - sLog.outString( "Re-Loading Quest Area Triggers..." ); + sLog.outString("Re-Loading Quest Area Triggers..."); objmgr.LoadQuestAreaTriggers(); SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded."); return true; @@ -815,12 +815,12 @@ bool ChatHandler::HandleReloadQuestAreaTriggersCommand(const char*) bool ChatHandler::HandleReloadQuestTemplateCommand(const char*) { - sLog.outString( "Re-Loading Quest Templates..." ); + sLog.outString("Re-Loading Quest Templates..."); objmgr.LoadQuests(); SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded."); /// dependent also from `gameobject` but this table not reloaded anyway - sLog.outString( "Re-Loading GameObjects for quests..." ); + sLog.outString("Re-Loading GameObjects for quests..."); objmgr.LoadGameObjectForQuests(); SendGlobalGMSysMessage("Data GameObjects for quests reloaded."); return true; @@ -828,7 +828,7 @@ bool ChatHandler::HandleReloadQuestTemplateCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesCreatureCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`creature_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`creature_loot_template`)"); LoadLootTemplates_Creature(); LootTemplates_Creature.CheckLootRefs(); SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded."); @@ -837,7 +837,7 @@ bool ChatHandler::HandleReloadLootTemplatesCreatureCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesDisenchantCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`disenchant_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`disenchant_loot_template`)"); LoadLootTemplates_Disenchant(); LootTemplates_Disenchant.CheckLootRefs(); SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded."); @@ -846,7 +846,7 @@ bool ChatHandler::HandleReloadLootTemplatesDisenchantCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesFishingCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`fishing_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`fishing_loot_template`)"); LoadLootTemplates_Fishing(); LootTemplates_Fishing.CheckLootRefs(); SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded."); @@ -855,7 +855,7 @@ bool ChatHandler::HandleReloadLootTemplatesFishingCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesGameobjectCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`gameobject_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`gameobject_loot_template`)"); LoadLootTemplates_Gameobject(); LootTemplates_Gameobject.CheckLootRefs(); SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded."); @@ -864,7 +864,7 @@ bool ChatHandler::HandleReloadLootTemplatesGameobjectCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesItemCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`item_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`item_loot_template`)"); LoadLootTemplates_Item(); LootTemplates_Item.CheckLootRefs(); SendGlobalGMSysMessage("DB table `item_loot_template` reloaded."); @@ -873,7 +873,7 @@ bool ChatHandler::HandleReloadLootTemplatesItemCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesMillingCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`milling_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`milling_loot_template`)"); LoadLootTemplates_Milling(); LootTemplates_Milling.CheckLootRefs(); SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded."); @@ -882,7 +882,7 @@ bool ChatHandler::HandleReloadLootTemplatesMillingCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesPickpocketingCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`pickpocketing_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); LoadLootTemplates_Pickpocketing(); LootTemplates_Pickpocketing.CheckLootRefs(); SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded."); @@ -891,7 +891,7 @@ bool ChatHandler::HandleReloadLootTemplatesPickpocketingCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesProspectingCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`prospecting_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`prospecting_loot_template`)"); LoadLootTemplates_Prospecting(); LootTemplates_Prospecting.CheckLootRefs(); SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded."); @@ -900,7 +900,7 @@ bool ChatHandler::HandleReloadLootTemplatesProspectingCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesMailCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`mail_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`mail_loot_template`)"); LoadLootTemplates_Mail(); LootTemplates_Mail.CheckLootRefs(); SendGlobalSysMessage("DB table `mail_loot_template` reloaded."); @@ -909,7 +909,7 @@ bool ChatHandler::HandleReloadLootTemplatesMailCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesReferenceCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`reference_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`reference_loot_template`)"); LoadLootTemplates_Reference(); SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded."); return true; @@ -917,7 +917,7 @@ bool ChatHandler::HandleReloadLootTemplatesReferenceCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesSkinningCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`skinning_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`skinning_loot_template`)"); LoadLootTemplates_Skinning(); LootTemplates_Skinning.CheckLootRefs(); SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded."); @@ -926,7 +926,7 @@ bool ChatHandler::HandleReloadLootTemplatesSkinningCommand(const char*) bool ChatHandler::HandleReloadLootTemplatesSpellCommand(const char*) { - sLog.outString( "Re-Loading Loot Tables... (`spell_loot_template`)" ); + sLog.outString("Re-Loading Loot Tables... (`spell_loot_template`)"); LoadLootTemplates_Spell(); LootTemplates_Spell.CheckLootRefs(); SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded."); @@ -935,7 +935,7 @@ bool ChatHandler::HandleReloadLootTemplatesSpellCommand(const char*) bool ChatHandler::HandleReloadTrinityStringCommand(const char*) { - sLog.outString( "Re-Loading trinity_string Table!" ); + sLog.outString("Re-Loading trinity_string Table!"); objmgr.LoadTrinityStrings(); SendGlobalGMSysMessage("DB table `trinity_string` reloaded."); return true; @@ -943,7 +943,7 @@ bool ChatHandler::HandleReloadTrinityStringCommand(const char*) bool ChatHandler::HandleReloadNpcGossipCommand(const char*) { - sLog.outString( "Re-Loading `npc_gossip` Table!" ); + sLog.outString("Re-Loading `npc_gossip` Table!"); objmgr.LoadNpcTextId(); SendGlobalGMSysMessage("DB table `npc_gossip` reloaded."); return true; @@ -951,7 +951,7 @@ bool ChatHandler::HandleReloadNpcGossipCommand(const char*) bool ChatHandler::HandleReloadNpcTrainerCommand(const char*) { - sLog.outString( "Re-Loading `npc_trainer` Table!" ); + sLog.outString("Re-Loading `npc_trainer` Table!"); objmgr.LoadTrainerSpell(); SendGlobalGMSysMessage("DB table `npc_trainer` reloaded."); return true; @@ -959,7 +959,7 @@ bool ChatHandler::HandleReloadNpcTrainerCommand(const char*) bool ChatHandler::HandleReloadNpcVendorCommand(const char*) { - sLog.outString( "Re-Loading `npc_vendor` Table!" ); + sLog.outString("Re-Loading `npc_vendor` Table!"); objmgr.LoadVendors(); SendGlobalGMSysMessage("DB table `npc_vendor` reloaded."); return true; @@ -967,7 +967,7 @@ bool ChatHandler::HandleReloadNpcVendorCommand(const char*) bool ChatHandler::HandleReloadPointsOfInterestCommand(const char*) { - sLog.outString( "Re-Loading `points_of_interest` Table!" ); + sLog.outString("Re-Loading `points_of_interest` Table!"); objmgr.LoadPointsOfInterest(); SendGlobalGMSysMessage("DB table `points_of_interest` reloaded."); return true; @@ -975,7 +975,7 @@ bool ChatHandler::HandleReloadPointsOfInterestCommand(const char*) bool ChatHandler::HandleReloadSpellClickSpellsCommand(const char*) { - sLog.outString( "Re-Loading `npc_spellclick_spells` Table!" ); + sLog.outString("Re-Loading `npc_spellclick_spells` Table!"); objmgr.LoadNPCSpellClickSpells(); SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded."); return true; @@ -983,7 +983,7 @@ bool ChatHandler::HandleReloadSpellClickSpellsCommand(const char*) bool ChatHandler::HandleReloadReservedNameCommand(const char*) { - sLog.outString( "Loading ReservedNames... (`reserved_name`)" ); + sLog.outString("Loading ReservedNames... (`reserved_name`)"); objmgr.LoadReservedPlayersNames(); SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded."); return true; @@ -991,7 +991,7 @@ bool ChatHandler::HandleReloadReservedNameCommand(const char*) bool ChatHandler::HandleReloadSkillDiscoveryTemplateCommand(const char* /*args*/) { - sLog.outString( "Re-Loading Skill Discovery Table..." ); + sLog.outString("Re-Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded."); return true; @@ -999,7 +999,7 @@ bool ChatHandler::HandleReloadSkillDiscoveryTemplateCommand(const char* /*args*/ bool ChatHandler::HandleReloadSkillExtraItemTemplateCommand(const char* /*args*/) { - sLog.outString( "Re-Loading Skill Extra Item Table..." ); + sLog.outString("Re-Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded."); return true; @@ -1007,7 +1007,7 @@ bool ChatHandler::HandleReloadSkillExtraItemTemplateCommand(const char* /*args*/ bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/) { - sLog.outString( "Re-Loading Skill Fishing base level requirements..." ); + sLog.outString("Re-Loading Skill Fishing base level requirements..."); objmgr.LoadFishingBaseSkillLevel(); SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded."); return true; @@ -1015,7 +1015,7 @@ bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/) bool ChatHandler::HandleReloadSpellAreaCommand(const char*) { - sLog.outString( "Re-Loading SpellArea Data..." ); + sLog.outString("Re-Loading SpellArea Data..."); spellmgr.LoadSpellAreas(); SendGlobalGMSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded."); return true; @@ -1023,7 +1023,7 @@ bool ChatHandler::HandleReloadSpellAreaCommand(const char*) bool ChatHandler::HandleReloadSpellRequiredCommand(const char*) { - sLog.outString( "Re-Loading Spell Required Data... " ); + sLog.outString("Re-Loading Spell Required Data... "); spellmgr.LoadSpellRequired(); SendGlobalGMSysMessage("DB table `spell_required` reloaded."); return true; @@ -1031,7 +1031,7 @@ bool ChatHandler::HandleReloadSpellRequiredCommand(const char*) bool ChatHandler::HandleReloadSpellGroupsCommand(const char*) { - sLog.outString( "Re-Loading Spell Groups..." ); + sLog.outString("Re-Loading Spell Groups..."); spellmgr.LoadSpellGroups(); SendGlobalGMSysMessage("DB table `spell_group` (spell elixir types) reloaded."); return true; @@ -1039,7 +1039,7 @@ bool ChatHandler::HandleReloadSpellGroupsCommand(const char*) bool ChatHandler::HandleReloadSpellLearnSpellCommand(const char*) { - sLog.outString( "Re-Loading Spell Learn Spells..." ); + sLog.outString("Re-Loading Spell Learn Spells..."); spellmgr.LoadSpellLearnSpells(); SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded."); return true; @@ -1047,7 +1047,7 @@ bool ChatHandler::HandleReloadSpellLearnSpellCommand(const char*) bool ChatHandler::HandleReloadSpellLinkedSpellCommand(const char*) { - sLog.outString( "Re-Loading Spell Linked Spells..." ); + sLog.outString("Re-Loading Spell Linked Spells..."); spellmgr.LoadSpellLinked(); SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded."); return true; @@ -1055,7 +1055,7 @@ bool ChatHandler::HandleReloadSpellLinkedSpellCommand(const char*) bool ChatHandler::HandleReloadSpellProcEventCommand(const char*) { - sLog.outString( "Re-Loading Spell Proc Event conditions..." ); + sLog.outString("Re-Loading Spell Proc Event conditions..."); spellmgr.LoadSpellProcEvents(); SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded."); return true; @@ -1063,7 +1063,7 @@ bool ChatHandler::HandleReloadSpellProcEventCommand(const char*) bool ChatHandler::HandleReloadSpellBonusesCommand(const char*) { - sLog.outString( "Re-Loading Spell Bonus Data..." ); + sLog.outString("Re-Loading Spell Bonus Data..."); spellmgr.LoadSpellBonusess(); SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); return true; @@ -1071,7 +1071,7 @@ bool ChatHandler::HandleReloadSpellBonusesCommand(const char*) bool ChatHandler::HandleReloadSpellScriptTargetCommand(const char*) { - sLog.outString( "Re-Loading SpellsScriptTarget..." ); + sLog.outString("Re-Loading SpellsScriptTarget..."); spellmgr.LoadSpellScriptTarget(); SendGlobalGMSysMessage("DB table `spell_script_target` (spell targets selection in case specific creature/GO requirements) reloaded."); return true; @@ -1079,7 +1079,7 @@ bool ChatHandler::HandleReloadSpellScriptTargetCommand(const char*) bool ChatHandler::HandleReloadSpellTargetPositionCommand(const char*) { - sLog.outString( "Re-Loading Spell target coordinates..." ); + sLog.outString("Re-Loading Spell target coordinates..."); spellmgr.LoadSpellTargetPositions(); SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded."); return true; @@ -1087,7 +1087,7 @@ bool ChatHandler::HandleReloadSpellTargetPositionCommand(const char*) bool ChatHandler::HandleReloadSpellThreatsCommand(const char*) { - sLog.outString( "Re-Loading Aggro Spells Definitions..."); + sLog.outString("Re-Loading Aggro Spells Definitions..."); spellmgr.LoadSpellThreats(); SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded."); return true; @@ -1095,7 +1095,7 @@ bool ChatHandler::HandleReloadSpellThreatsCommand(const char*) bool ChatHandler::HandleReloadSpellGroupStackRulesCommand(const char*) { - sLog.outString( "Re-Loading Spell Group Stack Rules..." ); + sLog.outString("Re-Loading Spell Group Stack Rules..."); spellmgr.LoadSpellGroupStackRules(); SendGlobalGMSysMessage("DB table `spell_group_stack_rules` (spell stacking definitions) reloaded."); return true; @@ -1103,7 +1103,7 @@ bool ChatHandler::HandleReloadSpellGroupStackRulesCommand(const char*) bool ChatHandler::HandleReloadSpellPetAurasCommand(const char*) { - sLog.outString( "Re-Loading Spell pet auras..."); + sLog.outString("Re-Loading Spell pet auras..."); spellmgr.LoadSpellPetAuras(); SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded."); return true; @@ -1111,7 +1111,7 @@ bool ChatHandler::HandleReloadSpellPetAurasCommand(const char*) bool ChatHandler::HandleReloadPageTextsCommand(const char*) { - sLog.outString( "Re-Loading Page Texts..." ); + sLog.outString("Re-Loading Page Texts..."); objmgr.LoadPageTexts(); SendGlobalGMSysMessage("DB table `page_texts` reloaded."); return true; @@ -1119,7 +1119,7 @@ bool ChatHandler::HandleReloadPageTextsCommand(const char*) bool ChatHandler::HandleReloadItemEnchantementsCommand(const char*) { - sLog.outString( "Re-Loading Item Random Enchantments Table..." ); + sLog.outString("Re-Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded."); return true; @@ -1127,7 +1127,7 @@ bool ChatHandler::HandleReloadItemEnchantementsCommand(const char*) bool ChatHandler::HandleReloadItemRequiredTragetCommand(const char*) { - sLog.outString( "Re-Loading Item Required Targets Table..." ); + sLog.outString("Re-Loading Item Required Targets Table..."); objmgr.LoadItemRequiredTarget(); SendGlobalGMSysMessage("DB table `item_required_target` reloaded."); return true; @@ -1143,7 +1143,7 @@ bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg) } if (*arg!='a') - sLog.outString( "Re-Loading Scripts from `gameobject_scripts`..."); + sLog.outString("Re-Loading Scripts from `gameobject_scripts`..."); objmgr.LoadGameObjectScripts(); @@ -1163,7 +1163,7 @@ bool ChatHandler::HandleReloadEventScriptsCommand(const char* arg) } if (*arg!='a') - sLog.outString( "Re-Loading Scripts from `event_scripts`..."); + sLog.outString("Re-Loading Scripts from `event_scripts`..."); objmgr.LoadEventScripts(); @@ -1183,7 +1183,7 @@ bool ChatHandler::HandleReloadWpScriptsCommand(const char* arg) } if (*arg!='a') - sLog.outString( "Re-Loading Scripts from `waypoint_scripts`..."); + sLog.outString("Re-Loading Scripts from `waypoint_scripts`..."); objmgr.LoadWaypointScripts(); @@ -1196,7 +1196,7 @@ bool ChatHandler::HandleReloadWpScriptsCommand(const char* arg) bool ChatHandler::HandleReloadEventAITextsCommand(const char* arg) { - sLog.outString( "Re-Loading Texts from `creature_ai_texts`..."); + sLog.outString("Re-Loading Texts from `creature_ai_texts`..."); CreatureEAI_Mgr.LoadCreatureEventAI_Texts(); SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded."); return true; @@ -1204,7 +1204,7 @@ bool ChatHandler::HandleReloadEventAITextsCommand(const char* arg) bool ChatHandler::HandleReloadEventAISummonsCommand(const char* arg) { - sLog.outString( "Re-Loading Summons from `creature_ai_summons`..."); + sLog.outString("Re-Loading Summons from `creature_ai_summons`..."); CreatureEAI_Mgr.LoadCreatureEventAI_Summons(); SendGlobalGMSysMessage("DB table `creature_ai_summons` reloaded."); return true; @@ -1212,7 +1212,7 @@ bool ChatHandler::HandleReloadEventAISummonsCommand(const char* arg) bool ChatHandler::HandleReloadEventAIScriptsCommand(const char* arg) { - sLog.outString( "Re-Loading Scripts from `creature_ai_scripts`..."); + sLog.outString("Re-Loading Scripts from `creature_ai_scripts`..."); CreatureEAI_Mgr.LoadCreatureEventAI_Scripts(); SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded."); return true; @@ -1228,7 +1228,7 @@ bool ChatHandler::HandleReloadQuestEndScriptsCommand(const char* arg) } if (*arg!='a') - sLog.outString( "Re-Loading Scripts from `quest_end_scripts`..."); + sLog.outString("Re-Loading Scripts from `quest_end_scripts`..."); objmgr.LoadQuestEndScripts(); @@ -1248,7 +1248,7 @@ bool ChatHandler::HandleReloadQuestStartScriptsCommand(const char* arg) } if (*arg!='a') - sLog.outString( "Re-Loading Scripts from `quest_start_scripts`..."); + sLog.outString("Re-Loading Scripts from `quest_start_scripts`..."); objmgr.LoadQuestStartScripts(); @@ -1268,7 +1268,7 @@ bool ChatHandler::HandleReloadSpellScriptsCommand(const char* arg) } if (*arg!='a') - sLog.outString( "Re-Loading Scripts from `spell_scripts`..."); + sLog.outString("Re-Loading Scripts from `spell_scripts`..."); objmgr.LoadSpellScripts(); @@ -1280,7 +1280,7 @@ bool ChatHandler::HandleReloadSpellScriptsCommand(const char* arg) bool ChatHandler::HandleReloadDbScriptStringCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Script strings from `db_script_string`..."); + sLog.outString("Re-Loading Script strings from `db_script_string`..."); objmgr.LoadDbScriptStrings(); SendGlobalGMSysMessage("DB table `db_script_string` reloaded."); return true; @@ -1288,7 +1288,7 @@ bool ChatHandler::HandleReloadDbScriptStringCommand(const char* /*arg*/) bool ChatHandler::HandleReloadGameGraveyardZoneCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Graveyard-zone links..."); + sLog.outString("Re-Loading Graveyard-zone links..."); objmgr.LoadGraveyardZones(); @@ -1299,7 +1299,7 @@ bool ChatHandler::HandleReloadGameGraveyardZoneCommand(const char* /*arg*/) bool ChatHandler::HandleReloadGameTeleCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Game Tele coordinates..."); + sLog.outString("Re-Loading Game Tele coordinates..."); objmgr.LoadGameTele(); @@ -1310,7 +1310,7 @@ bool ChatHandler::HandleReloadGameTeleCommand(const char* /*arg*/) bool ChatHandler::HandleReloadSpellDisabledCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading spell disabled table..."); + sLog.outString("Re-Loading spell disabled table..."); objmgr.LoadSpellDisabledEntrys(); @@ -1321,7 +1321,7 @@ bool ChatHandler::HandleReloadSpellDisabledCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesAchievementRewardCommand(const char*) { - sLog.outString( "Re-Loading Locales Achievement Reward Data..." ); + sLog.outString("Re-Loading Locales Achievement Reward Data..."); achievementmgr.LoadRewardLocales(); SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded."); return true; @@ -1329,7 +1329,7 @@ bool ChatHandler::HandleReloadLocalesAchievementRewardCommand(const char*) bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Locales Creature ..."); + sLog.outString("Re-Loading Locales Creature ..."); objmgr.LoadCreatureLocales(); SendGlobalGMSysMessage("DB table `locales_creature` reloaded."); return true; @@ -1337,7 +1337,7 @@ bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesGameobjectCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Locales Gameobject ... "); + sLog.outString("Re-Loading Locales Gameobject ... "); objmgr.LoadGameObjectLocales(); SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded."); return true; @@ -1345,7 +1345,7 @@ bool ChatHandler::HandleReloadLocalesGameobjectCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Locales Item ... "); + sLog.outString("Re-Loading Locales Item ... "); objmgr.LoadItemLocales(); SendGlobalGMSysMessage("DB table `locales_item` reloaded."); return true; @@ -1353,7 +1353,7 @@ bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Locales NPC Text ... "); + sLog.outString("Re-Loading Locales NPC Text ... "); objmgr.LoadNpcTextLocales(); SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded."); return true; @@ -1361,7 +1361,7 @@ bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Locales Page Text ... "); + sLog.outString("Re-Loading Locales Page Text ... "); objmgr.LoadPageTextLocales(); SendGlobalGMSysMessage("DB table `locales_page_text` reloaded."); return true; @@ -1369,7 +1369,7 @@ bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesPointsOfInterestCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Locales Points Of Interest ... "); + sLog.outString("Re-Loading Locales Points Of Interest ... "); objmgr.LoadPointOfInterestLocales(); SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded."); return true; @@ -1377,7 +1377,7 @@ bool ChatHandler::HandleReloadLocalesPointsOfInterestCommand(const char* /*arg*/ bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Locales Quest ... "); + sLog.outString("Re-Loading Locales Quest ... "); objmgr.LoadQuestLocales(); SendGlobalGMSysMessage("DB table `locales_quest` reloaded."); return true; @@ -1385,7 +1385,7 @@ bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/) bool ChatHandler::HandleReloadMailLevelRewardCommand(const char* /*arg*/) { - sLog.outString( "Re-Loading Player level dependent mail rewards..." ); + sLog.outString("Re-Loading Player level dependent mail rewards..."); objmgr.LoadMailLevelRewards(); SendGlobalSysMessage("DB table `mail_level_reward` reloaded."); return true; @@ -1394,7 +1394,7 @@ bool ChatHandler::HandleReloadMailLevelRewardCommand(const char* /*arg*/) bool ChatHandler::HandleReloadAuctionsCommand(const char *args) { ///- Reload dynamic data tables from the database - sLog.outString( "Re-Loading Auctions..." ); + sLog.outString("Re-Loading Auctions..."); auctionmgr.LoadAuctionItems(); auctionmgr.LoadAuctions(); SendGlobalGMSysMessage("Auctions reloaded."); @@ -2354,7 +2354,7 @@ bool ChatHandler::HandleLearnAllGMCommand(const char* /*args*/) }; uint16 gmSpellIter = 0; - while ( strcmp(gmSpellList[gmSpellIter], "0") ) + while (strcmp(gmSpellList[gmSpellIter], "0")) { uint32 spell = atol((char*)gmSpellList[gmSpellIter++]); @@ -2401,12 +2401,12 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(const char* /*args*/) continue; // skip other spell families - if ( spellInfo->SpellFamilyName != family) + if (spellInfo->SpellFamilyName != family) continue; // skip spells with first rank learned as talent (and all talents then also) uint32 first_rank = spellmgr.GetFirstSpellInChain(spellInfo->Id); - if (GetTalentSpellCost(first_rank) > 0 ) + if (GetTalentSpellCost(first_rank) > 0) continue; // skip broken spells @@ -2431,11 +2431,11 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/) if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab ); + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; - if ( (classMask & talentTabInfo->ClassMask) == 0 ) + if ((classMask & talentTabInfo->ClassMask) == 0) continue; // search highest talent rank @@ -2508,7 +2508,7 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/) if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab ); + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -2690,24 +2690,24 @@ bool ChatHandler::HandleAddItemCommand(const char *args) // check space and find places ItemPosCountVec dest; - uint8 msg = plTarget->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount ); - if ( msg != EQUIP_ERR_OK ) // convert to possible store amount + uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) // convert to possible store amount count -= noSpaceForCount; - if ( count == 0 || dest.empty()) // can't add any + if (count == 0 || dest.empty()) // can't add any { - PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount ); + PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); SetSentErrorMessage(true); return false; } - Item* item = plTarget->StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); // remove binding (let GM give it to another player later) if (pl==plTarget) for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) if (Item* item1 = pl->GetItemByPos(itr->pos)) - item1->SetBinding( false ); + item1->SetBinding(false); if (count > 0 && item) { @@ -2759,14 +2759,14 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args) { found = true; ItemPosCountVec dest; - uint8 msg = plTarget->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pProto->ItemId, 1 ); + uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, pProto->ItemId, 1); if (msg == EQUIP_ERR_OK) { - Item* item = plTarget->StoreNewItem( dest, pProto->ItemId, true); + Item* item = plTarget->StoreNewItem(dest, pProto->ItemId, true); // remove binding (let GM give it to another player later) if (pl==plTarget) - item->SetBinding( false ); + item->SetBinding(false); pl->SendNewItem(item,1,false,true); if (pl!=plTarget) @@ -2774,7 +2774,7 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args) } else { - pl->SendEquipError( msg, NULL, NULL ); + pl->SendEquipError(msg, NULL, NULL); PSendSysMessage(LANG_ITEM_CANNOT_CREATE, pProto->ItemId, 1); } } @@ -3220,7 +3220,7 @@ bool ChatHandler::HandleLookupItemCommand(const char *args) continue; int loc_idx = GetSessionDbLocaleIndex(); - if ( loc_idx >= 0 ) + if (loc_idx >= 0) { ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); if (il) @@ -3279,7 +3279,7 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args) return false; // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower(wnamepart); bool found = false; @@ -3344,7 +3344,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args) return false; // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower(wnamepart); bool found = false; @@ -3423,7 +3423,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args) return false; // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower(wnamepart); bool found = false; @@ -3534,7 +3534,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args) Quest * qinfo = iter->second; int loc_idx = GetSessionDbLocaleIndex(); - if ( loc_idx >= 0 ) + if (loc_idx >= 0) { QuestLocale const *il = objmgr.GetQuestLocale(qinfo->GetQuestId()); if (il) @@ -3701,14 +3701,14 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args) bool found = false; - for (uint32 id = 0; id< sGOStorage.MaxEntry; id++ ) + for (uint32 id = 0; id< sGOStorage.MaxEntry; id++) { GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(id); if (!gInfo) continue; int loc_idx = GetSessionDbLocaleIndex(); - if ( loc_idx >= 0 ) + if (loc_idx >= 0) { GameObjectLocale const *gl = objmgr.GetGameObjectLocale(id); if (gl) @@ -3861,7 +3861,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args) return false; // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower(wnamepart); bool found = false; @@ -4215,7 +4215,7 @@ bool ChatHandler::HandleDieCommand(const char* /*args*/) return false; } - if ( target->isAlive() ) + if (target->isAlive()) { if (sWorld.getConfig(CONFIG_DIE_COMMAND_MODE)) m_session->GetPlayer()->Kill(target); @@ -4270,7 +4270,7 @@ bool ChatHandler::HandleDamageCommand(const char * args) SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); - if ( schoolmask & SPELL_SCHOOL_MASK_NORMAL ) + if (schoolmask & SPELL_SCHOOL_MASK_NORMAL) damage = m_session->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); char* spellStr = strtok((char*)NULL, " "); @@ -4360,7 +4360,7 @@ bool ChatHandler::HandleAuraCommand(const char *args) // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form uint32 spellID = extractSpellIdFromLink((char*)args); - if (SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID )) + if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID)) Aura::TryCreate(spellInfo, target, target); return true; @@ -4419,7 +4419,7 @@ bool ChatHandler::HandleLinkGraveCommand(const char *args) WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id); - if (!graveyard ) + if (!graveyard) { PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, g_id); SetSentErrorMessage(true); @@ -4431,7 +4431,7 @@ bool ChatHandler::HandleLinkGraveCommand(const char *args) uint32 zoneId = player->GetZoneId(); AreaTableEntry const *areaEntry = GetAreaEntryByAreaID(zoneId); - if (!areaEntry || areaEntry->zone !=0 ) + if (!areaEntry || areaEntry->zone !=0) { PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, g_id,zoneId); SetSentErrorMessage(true); @@ -4590,11 +4590,11 @@ bool ChatHandler::HandleNpcInfoCommand(const char* /*args*/) if (CreatureInfo const *master = GetCreatureInfo(linked->id)) PSendSysMessage(LANG_NPCINFO_LINKGUID, objmgr.GetLinkedRespawnGuid(target->GetDBTableGUIDLow()), linked->id, master->Name); - if ((npcflags & UNIT_NPC_FLAG_VENDOR) ) + if ((npcflags & UNIT_NPC_FLAG_VENDOR)) { SendSysMessage(LANG_NPCINFO_VENDOR); } - if ((npcflags & UNIT_NPC_FLAG_TRAINER) ) + if ((npcflags & UNIT_NPC_FLAG_TRAINER)) { SendSysMessage(LANG_NPCINFO_TRAINER); } @@ -4923,7 +4923,7 @@ bool ChatHandler::HandleHideAreaCommand(const char *args) bool ChatHandler::HandleBankCommand(const char* /*args*/) { - m_session->SendShowBank( m_session->GetPlayer()->GetGUID() ); + m_session->SendShowBank(m_session->GetPlayer()->GetGUID()); return true; } @@ -4997,7 +4997,7 @@ bool ChatHandler::HandleDebugSet32Bit(const char *args) sLog.outDebug(GetTrinityString(LANG_SET_32BIT), Opcode, Value); uint32 iValue = Value ? 1 << (Value - 1) : 0; - target->SetUInt32Value( Opcode , iValue); + target->SetUInt32Value(Opcode , iValue); PSendSysMessage(LANG_SET_32BIT_FIELD, Opcode, iValue); return true; @@ -5173,18 +5173,18 @@ static bool HandleResetStatsOrLevelHelper(Player* player) if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT)) player->m_form = FORM_NONE; - player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE ); - player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH ); + player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE); + player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH); player->setFactionForRace(player->getRace()); - player->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( player->getRace() ) | ( player->getClass() << 8 ) | ( player->getGender() << 16 ) | ( powertype << 24 ) ) ); + player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powertype << 24))); // reset only if player not in some form; if (player->m_form==FORM_NONE) player->InitDisplayIds(); - player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP ); + player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); player->SetByteValue(UNIT_FIELD_BYTES_2, 3, player->m_form); player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); @@ -5192,7 +5192,7 @@ static bool HandleResetStatsOrLevelHelper(Player* player) //-1 is default value player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); - //player->SetUInt32Value(PLAYER_FIELD_BYTES, 0xEEE00000 ); + //player->SetUInt32Value(PLAYER_FIELD_BYTES, 0xEEE00000); return true; } @@ -5318,7 +5318,7 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args) else if (target_guid) { uint32 at_flags = AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS; - CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'",at_flags, GUID_LOPART(target_guid) ); + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'",at_flags, GUID_LOPART(target_guid)); std::string nameLink = playerLink(target_name); PSendSysMessage(LANG_RESET_TALENTS_OFFLINE,nameLink.c_str()); return true; @@ -5559,12 +5559,12 @@ bool ChatHandler::HandleQuestAdd(const char *args) } // ok, normal (creature/GO starting) quest - if ( player->CanAddQuest( pQuest, true ) ) + if (player->CanAddQuest(pQuest, true)) { - player->AddQuest( pQuest, NULL ); + player->AddQuest(pQuest, NULL); - if ( player->CanCompleteQuest( entry ) ) - player->CompleteQuest( entry ); + if (player->CanCompleteQuest(entry)) + player->CompleteQuest(entry); } return true; @@ -5598,7 +5598,7 @@ bool ChatHandler::HandleQuestRemove(const char *args) } // remove all quest entries for 'entry' from quest log - for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot ) + for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) { uint32 quest = player->GetQuestSlotQuestId(slot); if (quest==entry) @@ -5606,12 +5606,12 @@ bool ChatHandler::HandleQuestRemove(const char *args) player->SetQuestSlot(slot,0); // we ignore unequippable quest items in this case, its' still be equipped - player->TakeQuestSourceItem( quest, false ); + player->TakeQuestSourceItem(quest, false); } } // set quest status to not started (will updated in DB at next save) - player->SetQuestStatus( entry, QUEST_STATUS_NONE); + player->SetQuestStatus(entry, QUEST_STATUS_NONE); // reset rewarded for restart repeatable quest player->getQuestStatusMap()[entry].m_rewarded = false; @@ -5659,10 +5659,10 @@ bool ChatHandler::HandleQuestComplete(const char *args) uint32 curItemCount = player->GetItemCount(id,true); ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, id, count-curItemCount ); - if ( msg == EQUIP_ERR_OK ) + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, id, count-curItemCount); + if (msg == EQUIP_ERR_OK) { - Item* item = player->StoreNewItem( dest, id, true); + Item* item = player->StoreNewItem(dest, id, true); player->SendNewItem(item,count-curItemCount,true,false); } } @@ -5928,7 +5928,7 @@ bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname) time_t unbandate = time_t(fields[3].GetUInt64()); bool active = false; - if (fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL)) ) + if (fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL))) active = true; bool permanent = (fields[1].GetUInt64() == (uint64)0); std::string bantime = permanent?GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true); @@ -6087,9 +6087,9 @@ bool ChatHandler::HandleBanListHelper(QueryResult_AutoPtr result) aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, fields2[2].GetString(),fields2[3].GetString()); } - }while ( banInfo->NextRow() ); + }while (banInfo->NextRow()); } - }while ( result->NextRow() ); + }while (result->NextRow()); SendSysMessage("==============================================================================="); } return true; @@ -6109,13 +6109,13 @@ bool ChatHandler::HandleBanListIPCommand(const char *args) { result = loginDatabase.Query ("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP())" - " ORDER BY unbandate" ); + " ORDER BY unbandate"); } else { - result = loginDatabase.PQuery( "SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" + result = loginDatabase.PQuery("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP()) AND ip "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'") - " ORDER BY unbandate",filter.c_str() ); + " ORDER BY unbandate",filter.c_str()); } if (!result) @@ -6146,7 +6146,7 @@ bool ChatHandler::HandleBanListIPCommand(const char *args) Field *fields = result->Fetch(); time_t t_ban = fields[1].GetUInt64(); tm* aTm_ban = localtime(&t_ban); - if ( fields[1].GetUInt64() == fields[2].GetUInt64() ) + if (fields[1].GetUInt64() == fields[2].GetUInt64()) { PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", fields[0].GetString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, @@ -6161,7 +6161,7 @@ bool ChatHandler::HandleBanListIPCommand(const char *args) aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, fields[3].GetString(), fields[4].GetString()); } - }while ( result->NextRow() ); + }while (result->NextRow()); SendSysMessage("==============================================================================="); } @@ -6402,7 +6402,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/) return false; } - PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature" ),unit->GetGUIDLow()); + PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"),unit->GetGUIDLow()); MotionMaster* mm = unit->GetMotionMaster(); for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) @@ -6480,16 +6480,16 @@ bool ChatHandler::HandleServerPLimitCommand(const char *args) int l = strlen(param); - if ( strncmp(param,"player",l) == 0 ) + if (strncmp(param,"player",l) == 0) sWorld.SetPlayerLimit(-SEC_PLAYER); - else if (strncmp(param,"moderator",l) == 0 ) + else if (strncmp(param,"moderator",l) == 0) sWorld.SetPlayerLimit(-SEC_MODERATOR); - else if (strncmp(param,"gamemaster",l) == 0 ) + else if (strncmp(param,"gamemaster",l) == 0) sWorld.SetPlayerLimit(-SEC_GAMEMASTER); - else if (strncmp(param,"administrator",l) == 0 ) + else if (strncmp(param,"administrator",l) == 0) sWorld.SetPlayerLimit(-SEC_ADMINISTRATOR); - else if (strncmp(param,"reset",l) == 0 ) - sWorld.SetPlayerLimit( sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT) ); + else if (strncmp(param,"reset",l) == 0) + sWorld.SetPlayerLimit(sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT)); else { int val = atoi(param); @@ -6554,7 +6554,7 @@ bool ChatHandler::HandleCastCommand(const char *args) if (trig_str) { int l = strlen(trig_str); - if (strncmp(trig_str,"triggered",l) != 0 ) + if (strncmp(trig_str,"triggered",l) != 0) return false; } @@ -6586,7 +6586,7 @@ bool ChatHandler::HandleCastBackCommand(const char *args) if (trig_str) { int l = strlen(trig_str); - if (strncmp(trig_str,"triggered",l) != 0 ) + if (strncmp(trig_str,"triggered",l) != 0) return false; } @@ -6631,7 +6631,7 @@ bool ChatHandler::HandleCastDistCommand(const char *args) if (trig_str) { int l = strlen(trig_str); - if (strncmp(trig_str,"triggered",l) != 0 ) + if (strncmp(trig_str,"triggered",l) != 0) return false; } @@ -6671,7 +6671,7 @@ bool ChatHandler::HandleCastTargetCommand(const char *args) if (trig_str) { int l = strlen(trig_str); - if (strncmp(trig_str,"triggered",l) != 0 ) + if (strncmp(trig_str,"triggered",l) != 0) return false; } @@ -6880,7 +6880,7 @@ bool ChatHandler::HandleGMListFullCommand(const char* /*args*/) { Field *fields = result->Fetch(); PSendSysMessage("|%15s|%6s|", fields[0].GetString(),fields[1].GetString()); - }while ( result->NextRow() ); + }while (result->NextRow()); PSendSysMessage("========================"); } @@ -7067,7 +7067,7 @@ bool ChatHandler::HandleSendItemsCommand(const char *args) // from console show not existed sender MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - uint32 itemTextId = !text.empty() ? objmgr.CreateItemText( text ) : 0; + uint32 itemTextId = !text.empty() ? objmgr.CreateItemText(text) : 0; // fill mail MailDraft draft(subject, itemTextId); @@ -7127,7 +7127,7 @@ bool ChatHandler::HandleSendMoneyCommand(const char *args) // from console show not existed sender MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - uint32 itemTextId = !text.empty() ? objmgr.CreateItemText( text ) : 0; + uint32 itemTextId = !text.empty() ? objmgr.CreateItemText(text) : 0; MailDraft(subject, itemTextId) .AddMoney(money) diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 645faeaa447..37d457575f8 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -32,7 +32,7 @@ #include "World.h" #include "Util.h" -void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_AUTOSTORE_LOOT_ITEM"); Player *player = GetPlayer(); @@ -57,7 +57,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) } else if (IS_ITEM_GUID(lguid)) { - Item *pItem = player->GetItemByGuid( lguid ); + Item *pItem = player->GetItemByGuid(lguid); if (!pItem) { @@ -83,7 +83,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed); - if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) ) + if (!ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) { player->SendLootRelease(lguid); return; @@ -100,7 +100,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) if (!item) { - player->SendEquipError( EQUIP_ERR_ALREADY_LOOTED, NULL, NULL ); + player->SendEquipError(EQUIP_ERR_ALREADY_LOOTED, NULL, NULL); return; } @@ -112,10 +112,10 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) } ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item->itemid, item->count ); - if ( msg == EQUIP_ERR_OK ) + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count); + if (msg == EQUIP_ERR_OK) { - Item * newitem = player->StoreNewItem( dest, item->itemid, true, item->randomPropertyId); + Item * newitem = player->StoreNewItem(dest, item->itemid, true, item->randomPropertyId); if (qitem) { @@ -155,10 +155,10 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count); } else - player->SendEquipError( msg, NULL, NULL ); + player->SendEquipError(msg, NULL, NULL); } -void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("WORLD: CMSG_LOOT_MONEY"); @@ -185,7 +185,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) { Corpse *bones = ObjectAccessor::GetCorpse(*GetPlayer(), guid); - if (bones && bones->IsWithinDistInMap(_player,INTERACTION_DISTANCE) ) + if (bones && bones->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) pLoot = &bones->loot; break; @@ -202,7 +202,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed); - if ( ok_loot && pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) ) + if (ok_loot && pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) pLoot = &pCreature->loot ; break; @@ -211,7 +211,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) return; // unlootable type } - if ( pLoot ) + if (pLoot) { if (!IS_ITEM_GUID(guid) && player->GetGroup()) //item can be looted only single player { @@ -231,17 +231,17 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) for (std::vector<Player*>::const_iterator i = playersNear.begin(); i != playersNear.end(); ++i) { - (*i)->ModifyMoney( money_per_player ); + (*i)->ModifyMoney(money_per_player); (*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, money_per_player); //Offset surely incorrect, but works - WorldPacket data( SMSG_LOOT_MONEY_NOTIFY, 4 ); + WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4); data << uint32(money_per_player); - (*i)->GetSession()->SendPacket( &data ); + (*i)->GetSession()->SendPacket(&data); } } else { - player->ModifyMoney( pLoot->gold ); + player->ModifyMoney(pLoot->gold); player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, pLoot->gold); } pLoot->gold = 0; @@ -249,7 +249,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) } } -void WorldSession::HandleLootOpcode( WorldPacket & recv_data ) +void WorldSession::HandleLootOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_LOOT"); @@ -263,7 +263,7 @@ void WorldSession::HandleLootOpcode( WorldPacket & recv_data ) GetPlayer()->SendLoot(guid, LOOT_CORPSE); } -void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data ) +void WorldSession::HandleLootReleaseOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_LOOT_RELEASE"); @@ -400,7 +400,7 @@ void WorldSession::DoLootRelease(uint64 lguid) } else if (IS_ITEM_GUID(lguid)) { - Item *pItem = player->GetItemByGuid(lguid ); + Item *pItem = player->GetItemByGuid(lguid); if (!pItem) return; @@ -471,7 +471,7 @@ void WorldSession::DoLootRelease(uint64 lguid) loot->RemoveLooter(player->GetGUID()); } -void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data ) +void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) { uint8 slotid; uint64 lootguid, target_playerguid; @@ -524,17 +524,17 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data ) LootItem& item = pLoot->items[slotid]; ItemPosCountVec dest; - uint8 msg = target->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item.itemid, item.count ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count); + if (msg != EQUIP_ERR_OK) { - target->SendEquipError( msg, NULL, NULL ); - _player->SendEquipError( msg, NULL, NULL ); // send duplicate of error massage to master looter + target->SendEquipError(msg, NULL, NULL); + _player->SendEquipError(msg, NULL, NULL); // send duplicate of error massage to master looter return; } // not move item from loot to target inventory - Item * newitem = target->StoreNewItem( dest, item.itemid, true, item.randomPropertyId ); - target->SendNewItem(newitem, uint32(item.count), false, false, true ); + Item * newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId); + target->SendNewItem(newitem, uint32(item.count), false, false, true); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count); diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index e4734f9b901..ac86023781c 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -37,18 +37,18 @@ static Rates const qualityToRate[MAX_ITEM_QUALITY] = { RATE_DROP_ITEM_ARTIFACT, // ITEM_QUALITY_ARTIFACT }; -LootStore LootTemplates_Creature( "creature_loot_template", "creature entry", true); -LootStore LootTemplates_Disenchant( "disenchant_loot_template", "item disenchant id", true); -LootStore LootTemplates_Fishing( "fishing_loot_template", "area id", true); -LootStore LootTemplates_Gameobject( "gameobject_loot_template", "gameobject entry", true); -LootStore LootTemplates_Item( "item_loot_template", "item entry", true); -LootStore LootTemplates_Mail( "mail_loot_template", "mail template id", false); -LootStore LootTemplates_Milling( "milling_loot_template", "item entry (herb)", true); +LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true); +LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true); +LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true); +LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true); +LootStore LootTemplates_Item("item_loot_template", "item entry", true); +LootStore LootTemplates_Mail("mail_loot_template", "mail template id", false); +LootStore LootTemplates_Milling("milling_loot_template", "item entry (herb)", true); LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid", true); -LootStore LootTemplates_Prospecting( "prospecting_loot_template", "item entry (ore)", true); -LootStore LootTemplates_Reference( "reference_loot_template", "reference id", false); -LootStore LootTemplates_Skinning( "skinning_loot_template", "creature skinning id", true); -LootStore LootTemplates_Spell( "spell_loot_template", "spell id (random item creating)",false); +LootStore LootTemplates_Prospecting("prospecting_loot_template", "item entry (ore)", true); +LootStore LootTemplates_Reference("reference_loot_template", "reference id", false); +LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true); +LootStore LootTemplates_Spell("spell_loot_template", "spell id (random item creating)",false); class LootTemplate::LootGroup // A set of loot definitions for items (refs are not allowed) { @@ -97,7 +97,7 @@ void LootStore::LoadLootTable() // Clearing store (for reloading case) Clear(); - sLog.outString( "%s :", GetName()); + sLog.outString("%s :", GetName()); // 0 1 2 3 4 5 6 7 8 9 QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, lootmode, groupid, mincountOrRef, maxcount, lootcondition, condition_value1, condition_value2 FROM %s",GetName()); @@ -148,7 +148,7 @@ void LootStore::LoadLootTable() { // Searching the template (in case template Id changed) tab = m_LootTemplates.find(entry); - if ( tab == m_LootTemplates.end() ) + if (tab == m_LootTemplates.end()) { std::pair< LootTemplateMap::iterator, bool > pr = m_LootTemplates.insert(LootTemplateMap::value_type(entry, new LootTemplate)); tab = pr.first; @@ -166,12 +166,12 @@ void LootStore::LoadLootTable() Verify(); // Checks validity of the loot store sLog.outString(); - sLog.outString( ">> Loaded %u loot definitions (%lu templates)", count, (unsigned long)m_LootTemplates.size()); + sLog.outString(">> Loaded %u loot definitions (%lu templates)", count, (unsigned long)m_LootTemplates.size()); } else { sLog.outString(); - sLog.outErrorDb( ">> Loaded 0 loot definitions. DB table `%s` is empty.",GetName() ); + sLog.outErrorDb(">> Loaded 0 loot definitions. DB table `%s` is empty.",GetName()); } } @@ -276,20 +276,20 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const return false; } - if ( chance == 0 && group == 0) // Zero chance is allowed for grouped entries only + if (chance == 0 && group == 0) // Zero chance is allowed for grouped entries only { sLog.outErrorDb("Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid); return false; } - if ( chance != 0 && chance < 0.000001f ) // loot with low chance + if (chance != 0 && chance < 0.000001f) // loot with low chance { sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped", store.GetName(), entry, itemid, chance); return false; } - if ( maxcount < mincountOrRef) // wrong max count + if (maxcount < mincountOrRef) // wrong max count { sLog.outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef); return false; @@ -300,7 +300,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const { if (needs_quest) sLog.outErrorDb("Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid); - else if ( chance == 0 ) // no chance for the reference + else if (chance == 0) // no chance for the reference { sLog.outErrorDb("Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid); return false; @@ -454,7 +454,7 @@ QuestItemList* Loot::FillFFALoot(Player* player) for (uint8 i = 0; i < items.size(); ++i) { LootItem &item = items[i]; - if (!item.is_looted && item.freeforall && item.AllowedForPlayer(player) ) + if (!item.is_looted && item.freeforall && item.AllowedForPlayer(player)) { ql->push_back(QuestItem(i)); ++unlootedCount; @@ -599,7 +599,7 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex) } } -void Loot::generateMoneyLoot( uint32 minAmount, uint32 maxAmount ) +void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount) { if (maxAmount > 0) { @@ -1047,7 +1047,7 @@ float LootTemplate::LootGroup::RawTotalChance() const float result = 0; for (LootStoreItemList::const_iterator i=ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i) - if ( !i->needs_quest ) + if (!i->needs_quest) result += i->chance; return result; @@ -1192,7 +1192,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con if (i->mincountOrRef < 0) // References { LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef); - if ( Referenced ==store.end()) + if (Referenced ==store.end()) continue; // Error message [should be] already printed at loading stage if (Referenced->second->HasQuestDrop(store, i->group)) return true; @@ -1502,7 +1502,7 @@ void LoadLootTemplates_Spell() continue; // possible cases - if ( !IsLootCraftingSpell(spellInfo)) + if (!IsLootCraftingSpell(spellInfo)) continue; if (ids_set.find(spell_id) == ids_set.end()) diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 3376d74e017..580da280a2a 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -44,7 +44,7 @@ enum MailShowFlags MAIL_SHOW_RETURN = 0x0010, }; -void WorldSession::HandleSendMail(WorldPacket & recv_data ) +void WorldSession::HandleSendMail(WorldPacket & recv_data) { uint64 mailbox, unk3; std::string receiver, subject, body; @@ -225,9 +225,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) pl->SendMailResult(0, MAIL_SEND, MAIL_OK); - uint32 itemTextId = !body.empty() ? objmgr.CreateItemText( body ) : 0; + uint32 itemTextId = !body.empty() ? objmgr.CreateItemText(body) : 0; - pl->ModifyMoney( -int32(reqmoney) ); + pl->ModifyMoney(-int32(reqmoney)); pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost); bool needItemDelay = false; @@ -284,7 +284,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) } //called when mail is read -void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data ) +void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data) { uint64 mailbox; uint32 mailId; @@ -308,7 +308,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data ) } //called when client deletes mail -void WorldSession::HandleMailDelete(WorldPacket & recv_data ) +void WorldSession::HandleMailDelete(WorldPacket & recv_data) { uint64 mailbox; uint32 mailId; @@ -336,7 +336,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data ) pl->SendMailResult(mailId, MAIL_DELETED, MAIL_OK); } -void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data ) +void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data) { uint64 mailbox; uint32 mailId; @@ -396,7 +396,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data ) } //called when player takes item attached in mail -void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) +void WorldSession::HandleMailTakeItem(WorldPacket & recv_data) { uint64 mailbox; uint32 mailId; @@ -427,7 +427,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) Item *it = pl->GetMItem(itemId); ItemPosCountVec dest; - uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, it, false ); + uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false); if (msg == EQUIP_ERR_OK) { m->RemoveItem(itemId); @@ -470,7 +470,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) .SendMailTo(MailReceiver(receive,m->sender),MailSender(MAIL_NORMAL,m->receiver), MAIL_CHECK_MASK_COD_PAYMENT); } - pl->ModifyMoney( -int32(m->COD) ); + pl->ModifyMoney(-int32(m->COD)); } m->COD = 0; m->state = MAIL_STATE_CHANGED; @@ -491,7 +491,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg); } -void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data ) +void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data) { uint64 mailbox; uint32 mailId; @@ -525,7 +525,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data ) } //called when player lists his received mails -void WorldSession::HandleGetMailList(WorldPacket & recv_data ) +void WorldSession::HandleGetMailList(WorldPacket & recv_data) { uint64 mailbox; recv_data >> mailbox; @@ -655,7 +655,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) } ///this function is called when client needs mail message body, or when player clicks on item which has ITEM_FIELD_ITEM_TEXT_ID > 0 -void WorldSession::HandleItemTextQuery(WorldPacket & recv_data ) +void WorldSession::HandleItemTextQuery(WorldPacket & recv_data) { uint32 itemTextId; uint32 mailId; //this value can be item id in bag, but it is also mail id @@ -669,12 +669,12 @@ void WorldSession::HandleItemTextQuery(WorldPacket & recv_data ) WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10));// guess size data << itemTextId; - data << objmgr.GetItemText( itemTextId ); + data << objmgr.GetItemText(itemTextId); SendPacket(&data); } //used when player copies mail body to his inventory -void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) +void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data) { uint64 mailbox; uint32 mailId; @@ -742,7 +742,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) } //TODO Fix me! ... this void has probably bad condition, but good data are sent -void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ ) +void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/) { WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8); @@ -801,7 +801,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ ) SendPacket(&data); } -MailSender::MailSender( Object* sender, MailStationery stationery ) : m_stationery(stationery) +MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery(stationery) { switch(sender->GetTypeId()) { @@ -829,22 +829,22 @@ MailSender::MailSender( Object* sender, MailStationery stationery ) : m_statione } } -MailSender::MailSender( AuctionEntry* sender ) +MailSender::MailSender(AuctionEntry* sender) : m_messageType(MAIL_AUCTION), m_senderId(sender->GetHouseId()), m_stationery(MAIL_STATIONERY_AUCTION) { } -MailReceiver::MailReceiver( Player* receiver ) : m_receiver(receiver), m_receiver_lowguid(receiver->GetGUIDLow()) +MailReceiver::MailReceiver(Player* receiver) : m_receiver(receiver), m_receiver_lowguid(receiver->GetGUIDLow()) { } -MailReceiver::MailReceiver( Player* receiver,uint32 receiver_lowguid ) : m_receiver(receiver), m_receiver_lowguid(receiver_lowguid) +MailReceiver::MailReceiver(Player* receiver,uint32 receiver_lowguid) : m_receiver(receiver), m_receiver_lowguid(receiver_lowguid) { ASSERT(!receiver || receiver->GetGUIDLow() == receiver_lowguid); } -MailDraft& MailDraft::AddItem( Item* item ) +MailDraft& MailDraft::AddItem(Item* item) { m_items[item->GetGUIDLow()] = item; return *this; } @@ -875,7 +875,7 @@ void MailDraft::prepareItems(Player* receiver) } } -void MailDraft::deleteIncludedItems( bool inDB /*= false*/ ) +void MailDraft::deleteIncludedItems(bool inDB /*= false*/) { for (MailItemMap::iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter) { @@ -890,7 +890,7 @@ void MailDraft::deleteIncludedItems( bool inDB /*= false*/ ) m_items.clear(); } -void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid ) +void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid) { Player *receiver = objmgr.GetPlayer(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER)); diff --git a/src/game/Map.cpp b/src/game/Map.cpp index a3b7eea375d..a4257087062 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -146,7 +146,7 @@ void Map::LoadVMap(int gx,int gy) void Map::LoadMap(int gx,int gy, bool reload) { - if ( i_InstanceId != 0 ) + if (i_InstanceId != 0) { if (GridMaps[gx][gy]) return; @@ -272,19 +272,19 @@ template<class T> void Map::SwitchGridContainers(T* obj, bool on) { CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("Map::SwitchGridContainers: Object " I64FMT " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } Cell cell(p); - if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) + if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; DEBUG_LOG("Switch object " I64FMT " from grid[%u,%u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); - assert( ngrid != NULL ); + assert(ngrid != NULL); GridType &grid = (*ngrid)(cell.CellX(), cell.CellY()); @@ -361,7 +361,7 @@ Map::EnsureGridLoadedAtEnter(const Cell &cell, Player *player) { EnsureGridLoaded(cell); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - assert( grid != NULL ); + assert(grid != NULL); if (player) { @@ -373,7 +373,7 @@ Map::EnsureGridLoadedAtEnter(const Cell &cell, Player *player) } // refresh grid state & timer - if ( grid->GetGridState() != GRID_STATE_ACTIVE ) + if (grid->GetGridState() != GRID_STATE_ACTIVE) { ResetGridExpiry(*grid, 0.1f); grid->SetGridState(GRID_STATE_ACTIVE); @@ -386,7 +386,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); assert(grid != NULL); - if ( !isGridObjectDataLoaded(cell.GridX(), cell.GridY()) ) + if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY())) { sLog.outDebug("Loading grid[%u,%u] for map %u instance %u", cell.GridX(), cell.GridY(), GetId(), i_InstanceId); @@ -415,7 +415,7 @@ bool Map::Add(Player *player) // Check if we are adding to correct map assert (player->GetMap() == this); CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("Map::Add: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord); return false; @@ -426,7 +426,7 @@ bool Map::Add(Player *player) Cell cell(p); EnsureGridLoadedAtEnter(cell, player); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - assert( grid != NULL ); + assert(grid != NULL); AddToGrid(player, grid, cell); player->AddToWorld(); @@ -445,7 +445,7 @@ void Map::Add(T *obj) { CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("Map::Add: Object " UI64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; @@ -464,7 +464,7 @@ Map::Add(T *obj) EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - assert( grid != NULL ); + assert(grid != NULL); AddToGrid(obj,grid,cell); //obj->SetMap(this); @@ -485,7 +485,7 @@ void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self) { CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("Map::MessageBroadcast: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord); return; @@ -495,7 +495,7 @@ void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self) cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) + if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; Trinity::MessageDeliverer post_man(*player, msg, to_self); @@ -508,7 +508,7 @@ void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg) { CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("Map::MessageBroadcast: Object (GUID: %u TypeId: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; @@ -518,7 +518,7 @@ void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg) cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) + if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; //TODO: currently on continents when Visibility.Distance.InFlight > Visibility.Distance.Continents @@ -533,7 +533,7 @@ void Map::MessageDistBroadcast(Player *player, WorldPacket *msg, float dist, boo { CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("Map::MessageBroadcast: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord); return; @@ -543,7 +543,7 @@ void Map::MessageDistBroadcast(Player *player, WorldPacket *msg, float dist, boo cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) + if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; Trinity::MessageDistDeliverer post_man(*player, msg, dist, to_self, own_team_only); @@ -556,7 +556,7 @@ void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist) { CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("Map::MessageBroadcast: Object (GUID: %u TypeId: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; @@ -566,7 +566,7 @@ void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist) cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - if ( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) + if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; Trinity::ObjectMessageDistDeliverer post_man(*obj, msg, dist); @@ -578,7 +578,7 @@ void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist) bool Map::loaded(const GridPair &p) const { - return ( getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord) ); + return (getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord)); } void Map::Update(const uint32 &t_diff) @@ -892,7 +892,7 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY()); RemoveFromGrid(player, oldGrid,old_cell); - if ( old_cell.DiffGrid(new_cell) ) + if (old_cell.DiffGrid(new_cell)) EnsureGridLoadedAtEnter(new_cell, player); NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY()); @@ -1076,10 +1076,10 @@ bool Map::CreatureRespawnRelocation(Creature *c) bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool unloadAll) { NGridType *grid = getNGrid(x, y); - assert( grid != NULL); + assert(grid != NULL); { - if (!unloadAll && ActiveObjectsNearGrid(x, y) ) + if (!unloadAll && ActiveObjectsNearGrid(x, y)) return false; sLog.outDebug("Unloading grid[%u,%u] for map %u", x,y, GetId()); @@ -1396,7 +1396,7 @@ float GridMap::getHeightFromFloat(float x, float y) const if (x > y) { // 1 triangle (h1, h2, h5 points) - float h1 = m_V9[(x_int )*129 + y_int]; + float h1 = m_V9[(x_int)*129 + y_int]; float h2 = m_V9[(x_int+1)*129 + y_int]; float h5 = 2 * m_V8[x_int*128 + y_int]; a = h2-h1; @@ -1429,7 +1429,7 @@ float GridMap::getHeightFromFloat(float x, float y) const else { // 4 triangle (h3, h4, h5 points) - float h3 = m_V9[(x_int )*129 + y_int+1]; + float h3 = m_V9[(x_int)*129 + y_int+1]; float h4 = m_V9[(x_int+1)*129 + y_int+1]; float h5 = 2 * m_V8[x_int*128 + y_int]; a = h4 - h3; @@ -1588,7 +1588,7 @@ float GridMap::getLiquidLevel(float x, float y) if (cx_int < 0 || cx_int >=m_liquid_height) return INVALID_HEIGHT; - if (cy_int < 0 || cy_int >=m_liquid_width ) + if (cy_int < 0 || cy_int >=m_liquid_width) return INVALID_HEIGHT; return m_liquid_map[cx_int*m_liquid_width + cy_int]; @@ -1635,7 +1635,7 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R int ly_int = y_int - m_liquid_offX; if (lx_int < 0 || lx_int >=m_liquid_height) return LIQUID_MAP_NO_WATER; - if (ly_int < 0 || ly_int >=m_liquid_width ) + if (ly_int < 0 || ly_int >=m_liquid_width) return LIQUID_MAP_NO_WATER; // Get water level @@ -1661,7 +1661,7 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R // Get position delta if (delta > 20) // Under water return LIQUID_MAP_UNDER_WATER; - if (delta > 0 ) // In water + if (delta > 0) // In water return LIQUID_MAP_IN_WATER; if (delta > -1) // Walk on water return LIQUID_MAP_WATER_WALK; @@ -1716,15 +1716,15 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const // mapHeight set for any above raw ground Z or <= INVALID_HEIGHT // vmapheight set for any under Z value or <= INVALID_HEIGHT - if ( vmapHeight > INVALID_HEIGHT ) + if (vmapHeight > INVALID_HEIGHT) { - if ( mapHeight > INVALID_HEIGHT ) + if (mapHeight > INVALID_HEIGHT) { // we have mapheight and vmapheight and must select more appropriate // we are already under the surface or vmap height above map heigt // or if the distance of the vmap height is less the land height distance - if ( z < mapHeight || vmapHeight > mapHeight || fabs(mapHeight-z) > fabs(vmapHeight-z) ) + if (z < mapHeight || vmapHeight > mapHeight || fabs(mapHeight-z) > fabs(vmapHeight-z)) return vmapHeight; else return mapHeight; // better use .map surface height @@ -1953,7 +1953,7 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const return areaflag; } -uint8 Map::GetTerrainType(float x, float y ) const +uint8 Map::GetTerrainType(float x, float y) const { if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y)) return gmap->getTerrainType(x, y); @@ -1969,7 +1969,7 @@ ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidTyp return LIQUID_MAP_NO_WATER; } -float Map::GetWaterLevel(float x, float y ) const +float Map::GetWaterLevel(float x, float y) const { if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) return gmap->getLiquidLevel(x, y); @@ -1991,8 +1991,8 @@ uint32 Map::GetZoneIdByAreaFlag(uint16 areaflag,uint32 map_id) { AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id); - if ( entry ) - return ( entry->zone != 0 ) ? entry->zone : entry->ID; + if (entry) + return (entry->zone != 0) ? entry->zone : entry->ID; else return 0; } @@ -2002,7 +2002,7 @@ void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 area AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id); areaid = entry ? entry->ID : 0; - zoneid = entry ? (( entry->zone != 0 ) ? entry->zone : entry->ID) : 0; + zoneid = entry ? ((entry->zone != 0) ? entry->zone : entry->ID) : 0; } bool Map::IsInWater(float x, float y, float pZ, float min_depth) const @@ -2054,7 +2054,7 @@ const char* Map::GetMapName() const return i_mapEntry ? i_mapEntry->name[sWorld.GetDefaultDbcLocale()] : "UNNAMEDMAP\x0"; } -void Map::UpdateObjectVisibility( WorldObject* obj, Cell cell, CellPair cellpair) +void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair) { cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -2063,7 +2063,7 @@ void Map::UpdateObjectVisibility( WorldObject* obj, Cell cell, CellPair cellpair cell.Visit(cellpair, player_notifier, *this, *obj, GetVisibilityDistance()); } -void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpair ) +void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair) { Trinity::VisibleNotifier notifier(*player); @@ -2078,7 +2078,7 @@ void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpa notifier.SendToSelf(); } /* -void Map::PlayerRelocationNotify( Player* player, Cell cell, CellPair cellpair ) +void Map::PlayerRelocationNotify(Player* player, Cell cell, CellPair cellpair) { Trinity::PlayerRelocationNotifier relocationNotifier(*player); cell.data.Part.reserved = ALL_DISTRICT; @@ -2104,7 +2104,7 @@ void Map::CreatureRelocationNotify(Creature *creature, Cell cell, CellPair cellp } */ -void Map::SendInitSelf( Player * player ) +void Map::SendInitSelf(Player * player) { sLog.outDetail("Creating player data for himself %u", player->GetGUIDLow()); @@ -2136,7 +2136,7 @@ void Map::SendInitSelf( Player * player ) player->GetSession()->SendPacket(&packet); } -void Map::SendInitTransports( Player * player ) +void Map::SendInitTransports(Player * player) { // Hack to send out transports MapManager::TransportMap& tmap = MapManager::Instance().m_TransportsByMap; @@ -2163,7 +2163,7 @@ void Map::SendInitTransports( Player * player ) player->GetSession()->SendPacket(&packet); } -void Map::SendRemoveTransports( Player * player ) +void Map::SendRemoveTransports(Player * player) { // Hack to send out transports MapManager::TransportMap& tmap = MapManager::Instance().m_TransportsByMap; @@ -2222,7 +2222,7 @@ void Map::AddObjectToRemoveList(WorldObject *obj) obj->CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links i_objectsToRemove.insert(obj); - //sLog.outDebug("Object (GUID: %u TypeId: %u ) added to removing list.",obj->GetGUIDLow(),obj->GetTypeId()); + //sLog.outDebug("Object (GUID: %u TypeId: %u) added to removing list.",obj->GetGUIDLow(),obj->GetTypeId()); } void Map::AddObjectToSwitchList(WorldObject *obj, bool on) @@ -2351,7 +2351,7 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const return false; } -void Map::AddToActive( Creature* c ) +void Map::AddToActive(Creature* c) { AddToActiveHelper(c); @@ -2372,7 +2372,7 @@ void Map::AddToActive( Creature* c ) } } -void Map::RemoveFromActive( Creature* c ) +void Map::RemoveFromActive(Creature* c) { RemoveFromActiveHelper(c); @@ -3096,7 +3096,7 @@ void Map::ScriptsProcess() sLog.outError("SCRIPT_COMMAND_MOVE_TO call for non-creature (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow()); break; } - source->ToCreature()->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, step.script->datalong2 ); + source->ToCreature()->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, step.script->datalong2); source->ToCreature()->GetMap()->CreatureRelocation((source->ToCreature()), step.script->x, step.script->y, step.script->z, 0); break; case SCRIPT_COMMAND_FLAG_SET: @@ -3254,22 +3254,22 @@ void Map::ScriptsProcess() TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); cell.Visit(p, object_checker, *summoner->GetMap()); - if ( !go ) + if (!go) { sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT failed for gameobject(guid: %u).", step.script->datalong); break; } - if ( go->GetGoType()==GAMEOBJECT_TYPE_FISHINGNODE || + if (go->GetGoType()==GAMEOBJECT_TYPE_FISHINGNODE || go->GetGoType()==GAMEOBJECT_TYPE_DOOR || go->GetGoType()==GAMEOBJECT_TYPE_BUTTON || - go->GetGoType()==GAMEOBJECT_TYPE_TRAP ) + go->GetGoType()==GAMEOBJECT_TYPE_TRAP) { sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT can not be used with gameobject of type %u (guid: %u).", uint32(go->GetGoType()), step.script->datalong); break; } - if ( go->isSpawned() ) + if (go->isSpawned()) break; //gameobject already spawned go->SetLootState(GO_READY); @@ -3368,18 +3368,18 @@ void Map::ScriptsProcess() TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); cell.Visit(p, object_checker, *caster->GetMap()); - if ( !door ) + if (!door) { sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR failed for gameobject(guid: %u).", step.script->datalong); break; } - if ( door->GetGoType() != GAMEOBJECT_TYPE_DOOR ) + if (door->GetGoType() != GAMEOBJECT_TYPE_DOOR) { sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR failed for non-door(GoType: %u, Entry: %u, GUID: %u).", door->GetGoType(),door->GetEntry(),door->GetGUIDLow()); break; } - if ( door->GetGoState() == GO_STATE_READY ) + if (door->GetGoState() == GO_STATE_READY) break; //door already closed door->UseDoorOrButton(time_to_open); @@ -3437,8 +3437,8 @@ void Map::ScriptsProcess() } // quest id and flags checked at script loading - if ( (worldObject->GetTypeId()!=TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) && - (step.script->datalong2==0 || worldObject->IsWithinDistInMap(player,float(step.script->datalong2))) ) + if ((worldObject->GetTypeId()!=TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) && + (step.script->datalong2==0 || worldObject->IsWithinDistInMap(player,float(step.script->datalong2)))) player->AreaExploredOrEventHappens(step.script->datalong); else player->FailQuest(step.script->datalong); diff --git a/src/game/Map.h b/src/game/Map.h index f89a685fd2b..4a120b16242 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -200,7 +200,7 @@ struct CreatureMover }; // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack(1) #else #pragma pack(push,1) @@ -224,7 +224,7 @@ enum LevelRequirementVsMode LEVELREQUIREMENT_HEROIC = 70 }; -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack() #else #pragma pack(pop) @@ -320,8 +320,8 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data = 0) const; uint16 GetAreaFlag(float x, float y, float z) const; - uint8 GetTerrainType(float x, float y ) const; - float GetWaterLevel(float x, float y ) const; + uint8 GetTerrainType(float x, float y) const; + float GetWaterLevel(float x, float y) const; bool IsUnderWater(float x, float y, float z) const; static uint32 GetAreaIdByAreaFlag(uint16 areaflag,uint32 map_id); @@ -380,7 +380,7 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl virtual bool RemoveBones(uint64 guid, float x, float y); void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair); - void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair ); + void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair); void resetMarkedCells() { marked_cells.reset(); } bool isCellMarked(uint32 pCellId) { return marked_cells.test(pCellId); } @@ -443,10 +443,10 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl void SetTimer(uint32 t) { i_gridExpiry = t < MIN_GRID_DELAY ? MIN_GRID_DELAY : t; } - void SendInitSelf( Player * player ); + void SendInitSelf(Player * player); - void SendInitTransports( Player * player ); - void SendRemoveTransports( Player * player ); + void SendInitTransports(Player * player); + void SendRemoveTransports(Player * player); bool CreatureCellRelocation(Creature *creature, Cell new_cell); @@ -634,7 +634,7 @@ Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor) const uint32 cell_x = cell.CellX(); const uint32 cell_y = cell.CellY(); - if ( !cell.NoCreate() || loaded(GridPair(x,y)) ) + if (!cell.NoCreate() || loaded(GridPair(x,y))) { EnsureGridLoaded(cell); getNGrid(x, y)->Visit(cell_x, cell_y, visitor); diff --git a/src/game/MapManager.h b/src/game/MapManager.h index 8f66178d607..5656fdd986c 100644 --- a/src/game/MapManager.h +++ b/src/game/MapManager.h @@ -67,7 +67,7 @@ class MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLock void SetGridCleanUpDelay(uint32 t) { - if ( t < MIN_GRID_DELAY ) + if (t < MIN_GRID_DELAY) i_gridCleanUpDelay = MIN_GRID_DELAY; else i_gridCleanUpDelay = t; @@ -75,7 +75,7 @@ class MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLock void SetMapUpdateInterval(uint32 t) { - if ( t > MIN_MAP_UPDATE_DELAY ) + if (t > MIN_MAP_UPDATE_DELAY) t = MIN_MAP_UPDATE_DELAY; i_timer.SetInterval(t); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index f2210976d80..513c1a5223b 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -49,9 +49,9 @@ #include "DBCEnums.h" #include "ScriptMgr.h" -void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Recvd CMSG_REPOP_REQUEST Message" ); + sLog.outDebug("WORLD: Recvd CMSG_REPOP_REQUEST Message"); recv_data.read_skip<uint8>(); @@ -75,7 +75,7 @@ void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data ) GetPlayer()->RepopAtGraveyard(); } -void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_GOSSIP_SELECT_OPTION"); @@ -101,7 +101,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } } @@ -110,13 +110,13 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) go = _player->GetMap()->GetGameObject(guid); if (!go) { - sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid))); return; } } else { - sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid))); return; } @@ -128,27 +128,27 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) { if (unit) { - if (!sScriptMgr.GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()) ) + if (!sScriptMgr.GossipSelectWithCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str())) _player->OnGossipSelect(unit, gossipListId, menuId); } else - sScriptMgr.GOSelectWithCode( _player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()); + sScriptMgr.GOSelectWithCode(_player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()); } else { if (unit) { - if (!sScriptMgr.GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)) ) + if (!sScriptMgr.GossipSelect(_player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId))) _player->OnGossipSelect(unit, gossipListId, menuId); } else - sScriptMgr.GOSelect( _player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)); + sScriptMgr.GOSelect(_player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)); } } -void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) +void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Recvd CMSG_WHO Message" ); + sLog.outDebug("WORLD: Recvd CMSG_WHO Message"); //recv_data.hexlike(); uint32 clientcount = 0; @@ -216,7 +216,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); uint32 gmLevelInWhoList = sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); - WorldPacket data( SMSG_WHO, 50 ); // guess size + WorldPacket data(SMSG_WHO, 50); // guess size data << clientcount; // clientcount place holder data << clientcount; // clientcount place holder @@ -227,7 +227,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) if (security == SEC_PLAYER) { // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST - if (itr->second->GetTeam() != team && !allowTwoSideWhoList ) + if (itr->second->GetTeam() != team && !allowTwoSideWhoList) continue; // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST @@ -303,7 +303,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) { if (wgname.find(str[i]) != std::wstring::npos || wpname.find(str[i]) != std::wstring::npos || - Utf8FitTo(aname, str[i]) ) + Utf8FitTo(aname, str[i])) { s_show = true; break; @@ -316,11 +316,11 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) data << pname; // player name data << gname; // guild name - data << uint32( lvl ); // player level - data << uint32( class_ ); // player class - data << uint32( race ); // player race + data << uint32(lvl); // player level + data << uint32(class_); // player class + data << uint32(race); // player race data << uint8(0); // new 2.4.0 - data << uint32( pzoneid ); // player zone id + data << uint32(pzoneid); // player zone id // 49 is maximum player count sent to client - can be overridden // through config, but is unstable @@ -328,32 +328,32 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) break; } - data.put( 0, clientcount ); //insert right count - data.put( sizeof(uint32), clientcount ); //insert right count + data.put(0, clientcount); //insert right count + data.put(sizeof(uint32), clientcount); //insert right count SendPacket(&data); - sLog.outDebug( "WORLD: Send SMSG_WHO Message" ); + sLog.outDebug("WORLD: Send SMSG_WHO Message"); } -void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) { - sLog.outDebug( "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity() ); + sLog.outDebug("WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity()); if (uint64 lguid = GetPlayer()->GetLootGUID()) DoLootRelease(lguid); //Can not logout if... - if ( GetPlayer()->isInCombat() || //...is in combat + if (GetPlayer()->isInCombat() || //...is in combat GetPlayer()->duel || //...is in Duel GetPlayer()->HasAura(9454) || //...is frozen by GM via freeze command //...is jumping ...is falling GetPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_JUMPING | MOVEMENTFLAG_FALLING)) { - WorldPacket data( SMSG_LOGOUT_RESPONSE, (2+4) ) ; + WorldPacket data(SMSG_LOGOUT_RESPONSE, (2+4)) ; data << (uint8)0xC; data << uint32(0); data << uint8(0); - SendPacket( &data ); + SendPacket(&data); LogoutRequest(0); return; } @@ -371,42 +371,42 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ ) { GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT); - WorldPacket data( SMSG_FORCE_MOVE_ROOT, (8+4) ); // guess size + WorldPacket data(SMSG_FORCE_MOVE_ROOT, (8+4)); // guess size data.append(GetPlayer()->GetPackGUID()); data << (uint32)2; - SendPacket( &data ); + SendPacket(&data); GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } - WorldPacket data( SMSG_LOGOUT_RESPONSE, 5 ); + WorldPacket data(SMSG_LOGOUT_RESPONSE, 5); data << uint32(0); data << uint8(0); - SendPacket( &data ); + SendPacket(&data); LogoutRequest(time(NULL)); } -void WorldSession::HandlePlayerLogoutOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandlePlayerLogoutOpcode(WorldPacket & /*recv_data*/) { - sLog.outDebug( "WORLD: Recvd CMSG_PLAYER_LOGOUT Message" ); + sLog.outDebug("WORLD: Recvd CMSG_PLAYER_LOGOUT Message"); } -void WorldSession::HandleLogoutCancelOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/) { - sLog.outDebug( "WORLD: Recvd CMSG_LOGOUT_CANCEL Message" ); + sLog.outDebug("WORLD: Recvd CMSG_LOGOUT_CANCEL Message"); LogoutRequest(0); - WorldPacket data( SMSG_LOGOUT_CANCEL_ACK, 0 ); - SendPacket( &data ); + WorldPacket data(SMSG_LOGOUT_CANCEL_ACK, 0); + SendPacket(&data); // not remove flags if can't free move - its not set in Logout request code. if (GetPlayer()->CanFreeMove()) { //!we can move again - data.Initialize( SMSG_FORCE_MOVE_UNROOT, 8 ); // guess size + data.Initialize(SMSG_FORCE_MOVE_UNROOT, 8); // guess size data.append(GetPlayer()->GetPackGUID()); data << uint32(0); - SendPacket( &data ); + SendPacket(&data); //! Stand Up GetPlayer()->SetStandState(UNIT_STAND_STATE_STAND); @@ -415,10 +415,10 @@ void WorldSession::HandleLogoutCancelOpcode( WorldPacket & /*recv_data*/ ) GetPlayer()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } - sLog.outDebug( "WORLD: sent SMSG_LOGOUT_CANCEL_ACK Message" ); + sLog.outDebug("WORLD: sent SMSG_LOGOUT_CANCEL_ACK Message"); } -void WorldSession::HandleTogglePvP( WorldPacket & recv_data ) +void WorldSession::HandleTogglePvP(WorldPacket & recv_data) { // this opcode can be used in two ways: Either set explicit new status or toggle old status if (recv_data.size() == 1) @@ -449,7 +449,7 @@ void WorldSession::HandleTogglePvP( WorldPacket & recv_data ) // pvp->HandlePlayerActivityChanged(_player); } -void WorldSession::HandleZoneUpdateOpcode( WorldPacket & recv_data ) +void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data) { uint32 newZone; recv_data >> newZone; @@ -463,7 +463,7 @@ void WorldSession::HandleZoneUpdateOpcode( WorldPacket & recv_data ) //GetPlayer()->SendInitWorldStates(true,newZone); } -void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetTargetOpcode(WorldPacket & recv_data) { // When this packet send? uint64 guid ; @@ -472,7 +472,7 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) _player->SetUInt32Value(UNIT_FIELD_TARGET, guid); // update reputation list if need - Unit* unit = ObjectAccessor::GetUnit(*_player, guid ); + Unit* unit = ObjectAccessor::GetUnit(*_player, guid); if (!unit) return; @@ -480,7 +480,7 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) _player->GetReputationMgr().SetVisible(factionTemplateEntry); } -void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; @@ -488,7 +488,7 @@ void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data ) _player->SetSelection(guid); // update reputation list if need - Unit* unit = ObjectAccessor::GetUnit(*_player, guid ); + Unit* unit = ObjectAccessor::GetUnit(*_player, guid); if (!unit) return; @@ -496,27 +496,27 @@ void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data ) _player->GetReputationMgr().SetVisible(factionTemplateEntry); } -void WorldSession::HandleStandStateChangeOpcode( WorldPacket & recv_data ) +void WorldSession::HandleStandStateChangeOpcode(WorldPacket & recv_data) { - // sLog.outDebug( "WORLD: Received CMSG_STANDSTATECHANGE" ); -- too many spam in log at lags/debug stop + // sLog.outDebug("WORLD: Received CMSG_STANDSTATECHANGE"); -- too many spam in log at lags/debug stop uint32 animstate; recv_data >> animstate; _player->SetStandState(animstate); } -void WorldSession::HandleContactListOpcode( WorldPacket & recv_data ) +void WorldSession::HandleContactListOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_CONTACT_LIST" ); + sLog.outDebug("WORLD: Received CMSG_CONTACT_LIST"); uint32 unk; recv_data >> unk; sLog.outDebug("unk value is %u", unk); _player->GetSocial()->SendSocialList(); } -void WorldSession::HandleAddFriendOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_ADD_FRIEND" ); + sLog.outDebug("WORLD: Received CMSG_ADD_FRIEND"); std::string friendName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); std::string friendNote; @@ -530,8 +530,8 @@ void WorldSession::HandleAddFriendOpcode( WorldPacket & recv_data ) CharacterDatabase.escape_string(friendName); // prevent SQL injection - normal name don't must changed by this call - sLog.outDebug( "WORLD: %s asked to add friend : '%s'", - GetPlayer()->GetName(), friendName.c_str() ); + sLog.outDebug("WORLD: %s asked to add friend : '%s'", + GetPlayer()->GetName(), friendName.c_str()); CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddFriendOpcodeCallBack, GetAccountId(), friendNote, "SELECT guid, race, account FROM characters WHERE name = '%s'", friendName.c_str()); } @@ -557,7 +557,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uin team = Player::TeamForRace((*result)[1].GetUInt8()); friendAcctid = (*result)[2].GetUInt32(); - if ( session->GetSecurity() >= SEC_MODERATOR || sWorld.getConfig(CONFIG_ALLOW_GM_FRIEND) || accmgr.GetSecurity(friendAcctid) < SEC_MODERATOR) + if (session->GetSecurity() >= SEC_MODERATOR || sWorld.getConfig(CONFIG_ALLOW_GM_FRIEND) || accmgr.GetSecurity(friendAcctid) < SEC_MODERATOR) { if (friendGuid) { @@ -570,14 +570,14 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uin else { Player* pFriend = ObjectAccessor::FindPlayer(friendGuid); - if ( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer())) + if (pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer())) friendResult = FRIEND_ADDED_ONLINE; else friendResult = FRIEND_ADDED_OFFLINE; if (!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false)) { friendResult = FRIEND_LIST_FULL; - sLog.outDebug( "WORLD: %s's friend list is full.", session->GetPlayer()->GetName()); + sLog.outDebug("WORLD: %s's friend list is full.", session->GetPlayer()->GetName()); } } session->GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote); @@ -587,14 +587,14 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uin sSocialMgr.SendFriendStatus(session->GetPlayer(), friendResult, GUID_LOPART(friendGuid), false); - sLog.outDebug( "WORLD: Sent (SMSG_FRIEND_STATUS)" ); + sLog.outDebug("WORLD: Sent (SMSG_FRIEND_STATUS)"); } -void WorldSession::HandleDelFriendOpcode( WorldPacket & recv_data ) +void WorldSession::HandleDelFriendOpcode(WorldPacket & recv_data) { uint64 FriendGUID; - sLog.outDebug( "WORLD: Received CMSG_DEL_FRIEND" ); + sLog.outDebug("WORLD: Received CMSG_DEL_FRIEND"); recv_data >> FriendGUID; @@ -602,12 +602,12 @@ void WorldSession::HandleDelFriendOpcode( WorldPacket & recv_data ) sSocialMgr.SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false); - sLog.outDebug( "WORLD: Sent motd (SMSG_FRIEND_STATUS)" ); + sLog.outDebug("WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } -void WorldSession::HandleAddIgnoreOpcode( WorldPacket & recv_data ) +void WorldSession::HandleAddIgnoreOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_ADD_IGNORE" ); + sLog.outDebug("WORLD: Received CMSG_ADD_IGNORE"); std::string IgnoreName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); @@ -618,8 +618,8 @@ void WorldSession::HandleAddIgnoreOpcode( WorldPacket & recv_data ) CharacterDatabase.escape_string(IgnoreName); // prevent SQL injection - normal name don't must changed by this call - sLog.outDebug( "WORLD: %s asked to Ignore: '%s'", - GetPlayer()->GetName(), IgnoreName.c_str() ); + sLog.outDebug("WORLD: %s asked to Ignore: '%s'", + GetPlayer()->GetName(), IgnoreName.c_str()); CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddIgnoreOpcodeCallBack, GetAccountId(), "SELECT guid FROM characters WHERE name = '%s'", IgnoreName.c_str()); } @@ -645,7 +645,7 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult_AutoPtr result, uin { if (IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself ignoreResult = FRIEND_IGNORE_SELF; - else if ( session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)) ) + else if (session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid))) ignoreResult = FRIEND_IGNORE_ALREADY; else { @@ -660,14 +660,14 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult_AutoPtr result, uin sSocialMgr.SendFriendStatus(session->GetPlayer(), ignoreResult, GUID_LOPART(IgnoreGuid), false); - sLog.outDebug( "WORLD: Sent (SMSG_FRIEND_STATUS)" ); + sLog.outDebug("WORLD: Sent (SMSG_FRIEND_STATUS)"); } -void WorldSession::HandleDelIgnoreOpcode( WorldPacket & recv_data ) +void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data) { uint64 IgnoreGUID; - sLog.outDebug( "WORLD: Received CMSG_DEL_IGNORE" ); + sLog.outDebug("WORLD: Received CMSG_DEL_IGNORE"); recv_data >> IgnoreGUID; @@ -675,10 +675,10 @@ void WorldSession::HandleDelIgnoreOpcode( WorldPacket & recv_data ) sSocialMgr.SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, GUID_LOPART(IgnoreGUID), false); - sLog.outDebug( "WORLD: Sent motd (SMSG_FRIEND_STATUS)" ); + sLog.outDebug("WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } -void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetContactNotesOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_SET_CONTACT_NOTES"); uint64 guid; @@ -687,7 +687,7 @@ void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data ) _player->GetSocial()->SetFriendNote(guid, note); } -void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBugOpcode(WorldPacket & recv_data) { uint32 suggestion, contentlen, typelen; std::string content, type; @@ -696,17 +696,17 @@ void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) recv_data >> typelen >> type; - if ( suggestion == 0 ) - sLog.outDebug( "WORLD: Received CMSG_BUG [Bug Report]" ); + if (suggestion == 0) + sLog.outDebug("WORLD: Received CMSG_BUG [Bug Report]"); else - sLog.outDebug( "WORLD: Received CMSG_BUG [Suggestion]" ); + sLog.outDebug("WORLD: Received CMSG_BUG [Suggestion]"); - sLog.outDebug("%s", type.c_str() ); - sLog.outDebug("%s", content.c_str() ); + sLog.outDebug("%s", type.c_str()); + sLog.outDebug("%s", content.c_str()); CharacterDatabase.escape_string(type); CharacterDatabase.escape_string(content); - CharacterDatabase.PExecute ("INSERT INTO bugreport (type,content) VALUES('%s', '%s')", type.c_str( ), content.c_str( )); + CharacterDatabase.PExecute ("INSERT INTO bugreport (type,content) VALUES('%s', '%s')", type.c_str(), content.c_str()); } void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) @@ -725,7 +725,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) Corpse *corpse = GetPlayer()->GetCorpse(); - if (!corpse ) + if (!corpse) return; // prevent resurrect before 30-sec delay after body release not finished @@ -776,7 +776,7 @@ void WorldSession::SendAreaTriggerMessage(const char* Text, ...) szStr[0] = '\0'; va_start(ap, Text); - vsnprintf( szStr, 1024, Text, ap ); + vsnprintf(szStr, 1024, Text, ap); va_end(ap); uint32 length = strlen(szStr)+1; @@ -852,9 +852,9 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) float dz = pl->GetPositionZ() - atEntry->z; float dx = rotPlayerX - atEntry->x; float dy = rotPlayerY - atEntry->y; - if ( (fabs(dx) > atEntry->box_x/2 + delta) || + if ((fabs(dx) > atEntry->box_x/2 + delta) || (fabs(dy) > atEntry->box_y/2 + delta) || - (fabs(dz) > atEntry->box_z/2 + delta) ) + (fabs(dz) > atEntry->box_z/2 + delta)) { sLog.outDebug("Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u", pl->GetName(), pl->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, Trigger_ID); @@ -865,14 +865,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) if (sScriptMgr.AreaTrigger(GetPlayer(), atEntry)) return; - uint32 quest_id = objmgr.GetQuestForAreaTrigger( Trigger_ID ); - if ( quest_id && GetPlayer()->isAlive() && GetPlayer()->IsActiveQuest(quest_id) ) + uint32 quest_id = objmgr.GetQuestForAreaTrigger(Trigger_ID); + if (quest_id && GetPlayer()->isAlive() && GetPlayer()->IsActiveQuest(quest_id)) { Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); - if ( pQuest ) + if (pQuest) { if (GetPlayer()->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE) - GetPlayer()->AreaExploredOrEventHappens( quest_id ); + GetPlayer()->AreaExploredOrEventHappens(quest_id); } } @@ -1011,7 +1011,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) { - sLog.outDebug( "WORLD: Received CMSG_SET_ACTION_BUTTON" ); + sLog.outDebug("WORLD: Received CMSG_SET_ACTION_BUTTON"); uint8 button; uint32 packetData; recv_data >> button >> packetData; @@ -1019,10 +1019,10 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) uint32 action = ACTION_BUTTON_ACTION(packetData); uint8 type = ACTION_BUTTON_TYPE(packetData); - sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u", button, action, type ); + sLog.outDetail("BUTTON: %u ACTION: %u TYPE: %u", button, action, type); if (!packetData) { - sLog.outDetail( "MISC: Remove action from button %u", button ); + sLog.outDetail("MISC: Remove action from button %u", button); GetPlayer()->removeActionButton(button); } else @@ -1031,39 +1031,39 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) { case ACTION_BUTTON_MACRO: case ACTION_BUTTON_CMACRO: - sLog.outDetail( "MISC: Added Macro %u into button %u", action, button ); + sLog.outDetail("MISC: Added Macro %u into button %u", action, button); break; case ACTION_BUTTON_EQSET: - sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button ); + sLog.outDetail("MISC: Added EquipmentSet %u into button %u", action, button); break; case ACTION_BUTTON_SPELL: - sLog.outDetail( "MISC: Added Spell %u into button %u", action, button ); + sLog.outDetail("MISC: Added Spell %u into button %u", action, button); break; case ACTION_BUTTON_ITEM: - sLog.outDetail( "MISC: Added Item %u into button %u", action, button ); + sLog.outDetail("MISC: Added Item %u into button %u", action, button); break; default: - sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button ); + sLog.outError("MISC: Unknown action button type %u for action %u into button %u", type, action, button); return; } GetPlayer()->addActionButton(button,action,type); } } -void WorldSession::HandleCompleteCinematic( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleCompleteCinematic(WorldPacket & /*recv_data*/) { - DEBUG_LOG( "WORLD: Player is watching cinema" ); + DEBUG_LOG("WORLD: Player is watching cinema"); } -void WorldSession::HandleNextCinematicCamera( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleNextCinematicCamera(WorldPacket & /*recv_data*/) { - DEBUG_LOG( "WORLD: Which movie to play" ); + DEBUG_LOG("WORLD: Which movie to play"); } -void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & recv_data ) +void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data) { - /* WorldSession::Update( getMSTime() );*/ - DEBUG_LOG( "WORLD: Time Lag/Synchronization Resent/Update" ); + /* WorldSession::Update(getMSTime());*/ + DEBUG_LOG("WORLD: Time Lag/Synchronization Resent/Update"); uint64 guid; if (!recv_data.readPackGUID(guid)) @@ -1077,13 +1077,13 @@ void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & recv_data ) uint32 time_skipped; recv_data >> guid; recv_data >> time_skipped; - sLog.outDebug( "WORLD: CMSG_MOVE_TIME_SKIPPED" ); + sLog.outDebug("WORLD: CMSG_MOVE_TIME_SKIPPED"); /// TODO must be need use in Trinity - We substract server Lags to move time ( AntiLags ) + We substract server Lags to move time (AntiLags) for exmaple - GetPlayer()->ModifyLastMoveTime( -int32(time_skipped) ); + GetPlayer()->ModifyLastMoveTime(-int32(time_skipped)); */ } @@ -1110,7 +1110,7 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data) return; } - sLog.outDebug( "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK" ); + sLog.outDebug("WORLD: CMSG_FORCE_MOVE_UNROOT_ACK"); recv_data.read_skip<uint32>(); // unk @@ -1136,7 +1136,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recv_data) return; } - sLog.outDebug( "WORLD: CMSG_FORCE_MOVE_ROOT_ACK" ); + sLog.outDebug("WORLD: CMSG_FORCE_MOVE_ROOT_ACK"); recv_data.read_skip<uint32>(); // unk @@ -1330,7 +1330,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) sLog.outDebug("Received whois command from player %s for character %s", GetPlayer()->GetName(), charname.c_str()); } -void WorldSession::HandleComplainOpcode( WorldPacket & recv_data ) +void WorldSession::HandleComplainOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_COMPLAIN"); recv_data.hexlike(); @@ -1371,7 +1371,7 @@ void WorldSession::HandleComplainOpcode( WorldPacket & recv_data ) sLog.outDebug("REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str()); } -void WorldSession::HandleRealmSplitOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRealmSplitOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_REALM_SPLIT"); @@ -1391,7 +1391,7 @@ void WorldSession::HandleRealmSplitOpcode( WorldPacket & recv_data ) //sLog.outDebug("response sent %u", unk); } -void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data ) +void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_FAR_SIGHT"); //recv_data.hexlike(); @@ -1420,7 +1420,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data ) GetPlayer()->UpdateVisibilityForPlayer(); } -void WorldSession::HandleSetTitleOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetTitleOpcode(WorldPacket & recv_data) { sLog.outDebug("CMSG_SET_TITLE"); @@ -1439,7 +1439,7 @@ void WorldSession::HandleSetTitleOpcode( WorldPacket & recv_data ) GetPlayer()->SetUInt32Value(PLAYER_CHOSEN_TITLE, title); } -void WorldSession::HandleTimeSyncResp( WorldPacket & recv_data ) +void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data) { sLog.outDebug("CMSG_TIME_SYNC_RESP"); @@ -1452,7 +1452,7 @@ void WorldSession::HandleTimeSyncResp( WorldPacket & recv_data ) sLog.outDebug("response sent: counter %u, time %u (HEX: %X), ms. time %u, diff %u", counter, time_, time_, getMSTime(), diff); } -void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("WORLD: CMSG_RESET_INSTANCES"); Group *pGroup = _player->GetGroup(); @@ -1471,7 +1471,7 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ ) } } -void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) { sLog.outDebug("MSG_SET_DUNGEON_DIFFICULTY"); @@ -1513,7 +1513,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) return; map = pGroupGuy->GetMap(); - if (map && map->IsRaidOrHeroicDungeon() ) + if (map && map->IsRaidOrHeroicDungeon()) { sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; @@ -1532,7 +1532,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) { sLog.outDebug("MSG_SET_RAID_DIFFICULTY"); @@ -1574,7 +1574,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data ) return; map = pGroupGuy->GetMap(); - if (map && map->IsRaidOrHeroicDungeon() ) + if (map && map->IsRaidOrHeroicDungeon()) { sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; @@ -1593,7 +1593,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleCancelMountAuraOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleCancelMountAuraOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("WORLD: CMSG_CANCEL_MOUNT_AURA"); @@ -1614,7 +1614,7 @@ void WorldSession::HandleCancelMountAuraOpcode( WorldPacket & /*recv_data*/ ) _player->RemoveAurasByType(SPELL_AURA_MOUNTED); } -void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data ) +void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data) { // fly mode on/off sLog.outDebug("WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); @@ -1635,7 +1635,7 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data ) _player->m_mover->m_movementInfo.flags = movementInfo.GetMovementFlags(); } -void WorldSession::HandleRequestPetInfoOpcode( WorldPacket & /*recv_data */) +void WorldSession::HandleRequestPetInfoOpcode(WorldPacket & /*recv_data */) { /* sLog.outDebug("WORLD: CMSG_REQUEST_PET_INFO"); @@ -1643,7 +1643,7 @@ void WorldSession::HandleRequestPetInfoOpcode( WorldPacket & /*recv_data */) */ } -void WorldSession::HandleSetTaxiBenchmarkOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket & recv_data) { uint8 mode; recv_data >> mode; @@ -1651,7 +1651,7 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode( WorldPacket & recv_data ) sLog.outDebug("Client used \"/timetest %d\" command", mode); } -void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data ) +void WorldSession::HandleQueryInspectAchievements(WorldPacket & recv_data) { uint64 guid; if (!recv_data.readPackGUID(guid)) diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index 8c0f222c154..5c20494bfcc 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -83,7 +83,7 @@ MotionMaster::UpdateMotion(uint32 diff) { if (i_owner->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) // what about UNIT_STAT_DISTRACTED? Why is this not included? return; - assert( !empty() ); + assert(!empty()); m_cleanFlag |= MMCF_UPDATE; if (!top()->Update(*i_owner, diff)) { @@ -226,7 +226,7 @@ MotionMaster::MoveConfused() else { DEBUG_LOG("Creature (Entry: %u GUID: %u) move confused", - i_owner->GetEntry(), i_owner->GetGUIDLow() ); + i_owner->GetEntry(), i_owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator<Creature>(), MOTION_SLOT_CONTROLLED); } } @@ -287,13 +287,13 @@ MotionMaster::MovePoint(uint32 id, float x, float y, float z) { if (i_owner->GetTypeId() == TYPEID_PLAYER) { - DEBUG_LOG("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z ); + DEBUG_LOG("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_ACTIVE); } else { DEBUG_LOG("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), id, x, y, z ); + i_owner->GetEntry(), i_owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator<Creature>(id,x,y,z), MOTION_SLOT_ACTIVE); } } @@ -331,13 +331,13 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee i_owner->m_TempSpeed = speedXY; if (i_owner->GetTypeId() == TYPEID_PLAYER) { - DEBUG_LOG("Player (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z ); + DEBUG_LOG("Player (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator<Player>(0,x,y,z), MOTION_SLOT_CONTROLLED); } else { DEBUG_LOG("Creature (Entry: %u GUID: %u) jump to point (X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z ); + i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator<Creature>(0,x,y,z), MOTION_SLOT_CONTROLLED); } @@ -354,13 +354,13 @@ MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id) i_owner->m_TempSpeed = speed; if (i_owner->GetTypeId() == TYPEID_PLAYER) { - DEBUG_LOG("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z ); + DEBUG_LOG("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_CONTROLLED); } else { DEBUG_LOG("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z ); + i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator<Creature>(id,x,y,z), MOTION_SLOT_CONTROLLED); } } @@ -383,7 +383,7 @@ MotionMaster::MoveSeekAssistance(float x, float y, float z) else { DEBUG_LOG("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z ); + i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z); i_owner->AttackStop(); i_owner->ToCreature()->SetReactState(REACT_PASSIVE); Mutate(new AssistanceMovementGenerator(x,y,z), MOTION_SLOT_ACTIVE); @@ -400,7 +400,7 @@ MotionMaster::MoveSeekAssistanceDistract(uint32 time) else { DEBUG_LOG("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), time ); + i_owner->GetEntry(), i_owner->GetGUIDLow(), time); Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE); } } @@ -418,7 +418,7 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time) { DEBUG_LOG("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", - enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow() ); + enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow()); Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED); } else @@ -447,7 +447,7 @@ MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) else { sLog.outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), path, pathnode ); + i_owner->GetEntry(), i_owner->GetGUIDLow(), path, pathnode); } } @@ -507,7 +507,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) MovementGenerator *curr = top(); curr->Finalize(*i_owner); pop(); - if ( !isStatic( curr ) ) + if (!isStatic(curr)) delete curr; }*/ @@ -517,7 +517,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) DEBUG_LOG("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", i_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", - i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO" ); + i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO"); } void MotionMaster::MoveRotate(uint32 time, RotateDirection direction) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 4e5ecd21885..c530237ce9b 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -34,9 +34,9 @@ #include "InstanceSaveMgr.h" #include "ObjectMgr.h" -void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket & /*recv_data*/) { - sLog.outDebug( "WORLD: got MSG_MOVE_WORLDPORT_ACK." ); + sLog.outDebug("WORLD: got MSG_MOVE_WORLDPORT_ACK."); HandleMoveWorldportAckOpcode(); } @@ -142,7 +142,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() Corpse *corpse = GetPlayer()->GetCorpse(); if (corpse && corpse->GetType() != CORPSE_BONES && corpse->GetMapId() == GetPlayer()->GetMapId()) { - if ( mEntry->IsDungeon() ) + if (mEntry->IsDungeon()) { GetPlayer()->ResurrectPlayer(0.5f,false); GetPlayer()->SpawnCorpseBones(); @@ -236,7 +236,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) GetPlayer()->ProcessDelayedOperations(); } -void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) +void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) { uint16 opcode = recv_data.GetOpcode(); //sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); @@ -677,7 +677,7 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvdata*/) GetPlayer()->SendMessageToSet(&data, false); } -void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data ) +void WorldSession::HandleMoveKnockBackAck(WorldPacket & recv_data) { sLog.outDebug("CMSG_MOVE_KNOCK_BACK_ACK"); @@ -691,7 +691,7 @@ void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data ) ReadMovementInfo(recv_data, &movementInfo); } -void WorldSession::HandleMoveHoverAck( WorldPacket& recv_data ) +void WorldSession::HandleMoveHoverAck(WorldPacket& recv_data) { sLog.outDebug("CMSG_MOVE_HOVER_ACK"); @@ -725,7 +725,7 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data) void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data) { - if (!_player->isAlive() || _player->isInCombat() ) + if (!_player->isAlive() || _player->isInCombat()) return; uint64 summoner_guid; diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index cc20f57e562..b3d60b73042 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -38,7 +38,7 @@ #include "Guild.h" #include "ScriptMgr.h" -void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data ) +void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; @@ -46,7 +46,7 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TABARDDESIGNER); if (!unit) { - sLog.outDebug( "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -57,25 +57,25 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data ) SendTabardVendorActivate(guid); } -void WorldSession::SendTabardVendorActivate( uint64 guid ) +void WorldSession::SendTabardVendorActivate(uint64 guid) { - WorldPacket data( MSG_TABARDVENDOR_ACTIVATE, 8 ); + WorldPacket data(MSG_TABARDVENDOR_ACTIVATE, 8); data << guid; - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBankerActivateOpcode(WorldPacket & recv_data) { uint64 guid; - sLog.outDebug( "WORLD: Received CMSG_BANKER_ACTIVATE" ); + sLog.outDebug("WORLD: Received CMSG_BANKER_ACTIVATE"); recv_data >> guid; Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_BANKER); if (!unit) { - sLog.outDebug( "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -86,35 +86,35 @@ void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data ) SendShowBank(guid); } -void WorldSession::SendShowBank( uint64 guid ) +void WorldSession::SendShowBank(uint64 guid) { - WorldPacket data( SMSG_SHOW_BANK, 8 ); + WorldPacket data(SMSG_SHOW_BANK, 8); data << guid; - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandleTrainerListOpcode( WorldPacket & recv_data ) +void WorldSession::HandleTrainerListOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; - SendTrainerList( guid ); + SendTrainerList(guid); } -void WorldSession::SendTrainerList( uint64 guid ) +void WorldSession::SendTrainerList(uint64 guid) { std::string str = GetTrinityString(LANG_NPC_TAINER_HELLO); - SendTrainerList( guid, str ); + SendTrainerList(guid, str); } -void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) +void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) { - sLog.outDebug( "WORLD: SendTrainerList" ); + sLog.outDebug("WORLD: SendTrainerList"); Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TRAINER); if (!unit) { - sLog.outDebug( "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: SendTrainerList - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -130,19 +130,19 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) if (!ci) { - sLog.outDebug( "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!",GUID_LOPART(guid) ); + sLog.outDebug("WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!",GUID_LOPART(guid)); return; } TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); if (!trainer_spells) { - sLog.outDebug( "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", + sLog.outDebug("WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", GUID_LOPART(guid), unit->GetEntry()); return; } - WorldPacket data( SMSG_TRAINER_LIST, 8+4+4+trainer_spells->spellList.size()*38 + strTitle.size()+1); + WorldPacket data(SMSG_TRAINER_LIST, 8+4+4+trainer_spells->spellList.size()*38 + strTitle.size()+1); data << guid; data << uint32(trainer_spells->trainerType); @@ -224,21 +224,21 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) data << strTitle; data.put<uint32>(count_pos,count); - SendPacket( &data ); + SendPacket(&data); } -void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) +void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data) { uint64 guid; uint32 spellId = 0; recv_data >> guid >> spellId; - sLog.outDebug( "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u",uint32(GUID_LOPART(guid)), spellId ); + sLog.outDebug("WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u",uint32(GUID_LOPART(guid)), spellId); Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - sLog.outDebug( "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -267,10 +267,10 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit))); // check money requirement - if (_player->GetMoney() < nSpellCost ) + if (_player->GetMoney() < nSpellCost) return; - _player->ModifyMoney( -int32(nSpellCost) ); + _player->ModifyMoney(-int32(nSpellCost)); WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); // visual effect on trainer data << uint64(guid) << uint32(0xB3); @@ -292,9 +292,9 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) SendPacket(&data); } -void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_GOSSIP_HELLO" ); + sLog.outDebug("WORLD: Received CMSG_GOSSIP_HELLO"); uint64 guid; recv_data >> guid; @@ -302,7 +302,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - sLog.outDebug( "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -311,7 +311,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) //if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) // GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - if ( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider()) + if (unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider()) { unit->StopMoving(); } @@ -336,7 +336,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) } } -/*void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) +/*void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_GOSSIP_SELECT_OPTION"); @@ -347,7 +347,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) recv_data >> guid >> unk >> option; - if (_player->PlayerTalkClass->GossipOptionCoded( option )) + if (_player->PlayerTalkClass->GossipOptionCoded(option)) { sLog.outDebug("reading string"); recv_data >> code; @@ -357,7 +357,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -367,7 +367,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) if (!code.empty()) { - if (!Script->GossipSelectWithCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str())) + if (!Script->GossipSelectWithCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction(option), code.c_str())) unit->OnGossipSelect (_player, option); } else @@ -377,7 +377,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) } }*/ -void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_SPIRIT_HEALER_ACTIVATE"); @@ -388,7 +388,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER); if (!unit) { - sLog.outDebug( "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -410,7 +410,7 @@ void WorldSession::SendSpiritResurrect() Corpse *corpse = _player->GetCorpse(); if (corpse) corpseGrave = objmgr.GetClosestGraveYard( - corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam() ); + corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam()); // now can spawn bones _player->SpawnCorpseBones(); @@ -419,7 +419,7 @@ void WorldSession::SendSpiritResurrect() if (corpseGrave) { WorldSafeLocsEntry const *ghostGrave = objmgr.GetClosestGraveYard( - _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam() ); + _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam()); if (corpseGrave != ghostGrave) _player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation()); @@ -432,7 +432,7 @@ void WorldSession::SendSpiritResurrect() _player->UpdateObjectVisibility(); } -void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBinderActivateOpcode(WorldPacket & recv_data) { uint64 npcGUID; recv_data >> npcGUID; @@ -443,7 +443,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID,UNIT_NPC_FLAG_INNKEEPER); if (!unit) { - sLog.outDebug( "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) ); + sLog.outDebug("WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID))); return; } @@ -474,19 +474,19 @@ void WorldSession::SendBindPoint(Creature *npc) // send spell for bind 3286 bind magic _player->CastSpell(_player, bindspell, true); - WorldPacket data( SMSG_TRAINER_BUY_SUCCEEDED, (8+4)); + WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, (8+4)); data << npc->GetGUID(); data << bindspell; - SendPacket( &data ); + SendPacket(&data); // binding - data.Initialize( SMSG_BINDPOINTUPDATE, (4+4+4+4+4) ); + data.Initialize(SMSG_BINDPOINTUPDATE, (4+4+4+4+4)); data << float(_player->GetPositionX()); data << float(_player->GetPositionY()); data << float(_player->GetPositionZ()); data << uint32(_player->GetMapId()); data << uint32(zone_id); - SendPacket( &data ); + SendPacket(&data); DEBUG_LOG("New Home Position X is %f",_player->GetPositionX()); DEBUG_LOG("New Home Position Y is %f",_player->GetPositionY()); @@ -495,15 +495,15 @@ void WorldSession::SendBindPoint(Creature *npc) DEBUG_LOG("New Home ZoneId is %u",zone_id); // zone update - data.Initialize( SMSG_PLAYERBOUND, 8+4 ); + data.Initialize(SMSG_PLAYERBOUND, 8+4); data << uint64(_player->GetGUID()); data << uint32(zone_id); - SendPacket( &data ); + SendPacket(&data); _player->PlayerTalkClass->CloseGossip(); } -void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data ) +void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: Recv MSG_LIST_STABLED_PETS"); uint64 npcGUID; @@ -513,7 +513,7 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER); if (!unit) { - sLog.outDebug( "WORLD: HandleListStabledPetsOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) ); + sLog.outDebug("WORLD: HandleListStabledPetsOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID))); return; } @@ -528,12 +528,12 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data ) SendStablePet(npcGUID); } -void WorldSession::SendStablePet(uint64 guid ) +void WorldSession::SendStablePet(uint64 guid) { sLog.outDebug("WORLD: Recv MSG_LIST_STABLED_PETS Send."); WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size - data << uint64 ( guid ); + data << uint64 (guid); Pet *pet = _player->GetPet(); @@ -572,14 +572,14 @@ void WorldSession::SendStablePet(uint64 guid ) data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show) ++num; - }while ( result->NextRow() ); + }while (result->NextRow()); } data.put<uint8>(wpos, num); // set real data to placeholder SendPacket(&data); } -void WorldSession::HandleStablePet( WorldPacket & recv_data ) +void WorldSession::HandleStablePet(WorldPacket & recv_data) { sLog.outDebug("WORLD: Recv CMSG_STABLE_PET"); uint64 npcGUID; @@ -592,7 +592,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER); if (!unit) { - sLog.outDebug( "WORLD: HandleStablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) ); + sLog.outDebug("WORLD: HandleStablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID))); return; } @@ -629,11 +629,11 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) // this slot not free, skip ++free_slot; - }while ( result->NextRow() ); + }while (result->NextRow()); } WorldPacket data(SMSG_STABLE_RESULT, 1); - if ( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots) + if (free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots) { _player->RemovePet(pet,PetSaveMode(free_slot)); data << uint8(0x08); @@ -644,7 +644,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) SendPacket(&data); } -void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) +void WorldSession::HandleUnstablePet(WorldPacket & recv_data) { sLog.outDebug("WORLD: Recv CMSG_UNSTABLE_PET."); uint64 npcGUID; @@ -655,7 +655,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER); if (!unit) { - sLog.outDebug( "WORLD: HandleUnstablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) ); + sLog.outDebug("WORLD: HandleUnstablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID))); return; } @@ -721,7 +721,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) SendPacket(&data); } -void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data ) +void WorldSession::HandleBuyStableSlot(WorldPacket & recv_data) { sLog.outDebug("WORLD: Recv CMSG_BUY_STABLE_SLOT."); uint64 npcGUID; @@ -731,7 +731,7 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER); if (!unit) { - sLog.outDebug( "WORLD: HandleBuyStableSlot - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) ); + sLog.outDebug("WORLD: HandleBuyStableSlot - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID))); return; } @@ -759,12 +759,12 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data ) SendPacket(&data); } -void WorldSession::HandleStableRevivePet( WorldPacket &/* recv_data */) +void WorldSession::HandleStableRevivePet(WorldPacket &/* recv_data */) { sLog.outDebug("HandleStableRevivePet: Not implemented"); } -void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) +void WorldSession::HandleStableSwapPet(WorldPacket & recv_data) { sLog.outDebug("WORLD: Recv CMSG_STABLE_SWAP_PET."); uint64 npcGUID; @@ -775,7 +775,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER); if (!unit) { - sLog.outDebug( "WORLD: HandleStableSwapPet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) ); + sLog.outDebug("WORLD: HandleStableSwapPet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID))); return; } @@ -834,7 +834,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) SendPacket(&data); } -void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRepairItemOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_REPAIR_ITEM"); @@ -846,7 +846,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR); if (!unit) { - sLog.outDebug( "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) ); + sLog.outDebug("WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID))); return; } diff --git a/src/game/NPCHandler.h b/src/game/NPCHandler.h index 9008d4e87f5..98e2fd218d3 100644 --- a/src/game/NPCHandler.h +++ b/src/game/NPCHandler.h @@ -22,7 +22,7 @@ #define __NPCHANDLER_H // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack(1) #else #pragma pack(push,1) @@ -37,7 +37,7 @@ struct PageText }; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack() #else #pragma pack(pop) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 5a1ff0315ab..433edb1a22b 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -66,7 +66,7 @@ uint32 GuidHigh2TypeId(uint32 guid_hi) return NUM_CLIENT_OBJECT_TYPES; // unknown } -Object::Object( ) : m_PackGUID(sizeof(uint64)+1) +Object::Object() : m_PackGUID(sizeof(uint64)+1) { m_objectTypeId = TYPEID_OBJECT; m_objectType = TYPEMASK_OBJECT; @@ -95,7 +95,7 @@ WorldObject::~WorldObject() } } -Object::~Object( ) +Object::~Object() { if (IsInWorld()) { @@ -133,12 +133,12 @@ void Object::_InitValues() m_objectUpdated = false; } -void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh ) +void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh) { if (!m_uint32Values) _InitValues(); uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh); - SetUInt64Value( OBJECT_FIELD_GUID, guid ); + SetUInt64Value(OBJECT_FIELD_GUID, guid); uint32 type = 0; switch(m_objectType) { @@ -151,17 +151,17 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh ) //case TYPEID_CORPSE: type = 129; break; //+64 default: type = m_objectType; break; } - SetUInt32Value( OBJECT_FIELD_TYPE, type ); - //SetUInt32Value( OBJECT_FIELD_TYPE, m_objectType ); + SetUInt32Value(OBJECT_FIELD_TYPE, type); + //SetUInt32Value(OBJECT_FIELD_TYPE, m_objectType); m_PackGUID.wpos(0); m_PackGUID.appendPackGUID(GetGUID()); } -void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags ) const +void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags) const { ByteBuffer buf(500); - buf << uint8( UPDATETYPE_MOVEMENT ); + buf << uint8(UPDATETYPE_MOVEMENT); buf.append(GetPackGUID()); _BuildMovementUpdate(&buf, flags); @@ -227,8 +227,8 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c _BuildMovementUpdate(&buf, flags); UpdateMask updateMask; - updateMask.SetCount( m_valuesCount ); - _SetCreateBits( &updateMask, target ); + updateMask.SetCount(m_valuesCount); + _SetCreateBits(&updateMask, target); _BuildValuesUpdate(updatetype, &buf, &updateMask, target); data->AddUpdateBlock(buf); } @@ -252,9 +252,9 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) c buf.append(GetPackGUID()); UpdateMask updateMask; - updateMask.SetCount( m_valuesCount ); + updateMask.SetCount(m_valuesCount); - _SetUpdateBits( &updateMask, target ); + _SetUpdateBits(&updateMask, target); _BuildValuesUpdate(UPDATETYPE_VALUES, &buf, &updateMask, target); data->AddUpdateBlock(buf); @@ -265,14 +265,14 @@ void Object::BuildOutOfRangeUpdateBlock(UpdateData * data) const data->AddOutOfRangeGUID(GetGUID()); } -void Object::DestroyForPlayer( Player *target, bool anim ) const +void Object::DestroyForPlayer(Player *target, bool anim) const { ASSERT(target); WorldPacket data(SMSG_DESTROY_OBJECT, 8 + 1); data << uint64(GetGUID()); data << uint8(anim ? 1 : 0); // WotLK (bool), may be despawn animation - target->GetSession()->SendPacket( &data ); + target->GetSession()->SendPacket(&data); } void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const @@ -284,15 +284,15 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const { ((Unit*)this)->BuildMovementPacket(data); - *data << ((Unit*)this)->GetSpeed( MOVE_WALK ); - *data << ((Unit*)this)->GetSpeed( MOVE_RUN ); - *data << ((Unit*)this)->GetSpeed( MOVE_SWIM_BACK ); - *data << ((Unit*)this)->GetSpeed( MOVE_SWIM ); - *data << ((Unit*)this)->GetSpeed( MOVE_RUN_BACK ); - *data << ((Unit*)this)->GetSpeed( MOVE_FLIGHT ); - *data << ((Unit*)this)->GetSpeed( MOVE_FLIGHT_BACK ); - *data << ((Unit*)this)->GetSpeed( MOVE_TURN_RATE ); - *data << ((Unit*)this)->GetSpeed( MOVE_PITCH_RATE ); + *data << ((Unit*)this)->GetSpeed(MOVE_WALK); + *data << ((Unit*)this)->GetSpeed(MOVE_RUN); + *data << ((Unit*)this)->GetSpeed(MOVE_SWIM_BACK); + *data << ((Unit*)this)->GetSpeed(MOVE_SWIM); + *data << ((Unit*)this)->GetSpeed(MOVE_RUN_BACK); + *data << ((Unit*)this)->GetSpeed(MOVE_FLIGHT); + *data << ((Unit*)this)->GetSpeed(MOVE_FLIGHT_BACK); + *data << ((Unit*)this)->GetSpeed(MOVE_TURN_RATE); + *data << ((Unit*)this)->GetSpeed(MOVE_PITCH_RATE); // 0x08000000 if (GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->isInFlight()) @@ -480,7 +480,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask { if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsDynTransport()) { - if ( ((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) + if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) IsActivateToQuest = true; updateMask->SetBit(GAMEOBJECT_DYNAMIC); @@ -490,7 +490,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask } else if (isType(TYPEMASK_UNIT)) { - if ( ((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) + if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) { updateMask->SetBit(UNIT_FIELD_AURASTATE); } @@ -500,7 +500,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask { if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport()) { - if ( ((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) + if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) { IsActivateToQuest = true; } @@ -509,7 +509,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask } else if (isType(TYPEMASK_UNIT)) { - if ( ((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) + if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) { updateMask->SetBit(UNIT_FIELD_AURASTATE); } @@ -519,14 +519,14 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask WPAssert(updateMask && updateMask->GetCount() == m_valuesCount); *data << (uint8)updateMask->GetBlockCount(); - data->append( updateMask->GetMask(), updateMask->GetLength() ); + data->append(updateMask->GetMask(), updateMask->GetLength()); // 2 specialized loops for speed optimization in non-unit case if (isType(TYPEMASK_UNIT)) // unit (creature/player) case { - for (uint16 index = 0; index < m_valuesCount; ++index ) + for (uint16 index = 0; index < m_valuesCount; ++index) { - if ( updateMask->GetBit( index ) ) + if (updateMask->GetBit(index)) { if (index == UNIT_NPC_FLAGS) { @@ -647,7 +647,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask if (index == UNIT_FIELD_BYTES_2) { // Allow targetting opposite faction in party when enabled in config - *data << ( m_uint32Values[ index ] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8) ); // this flag is at uint8 offset 1 !! + *data << (m_uint32Values[ index ] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8)); // this flag is at uint8 offset 1 !! } else { @@ -672,14 +672,14 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask } else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case { - for (uint16 index = 0; index < m_valuesCount; ++index ) + for (uint16 index = 0; index < m_valuesCount; ++index) { - if ( updateMask->GetBit( index ) ) + if (updateMask->GetBit(index)) { // send in current format (float as float, uint32 as uint32) - if (index == GAMEOBJECT_DYNAMIC ) + if (index == GAMEOBJECT_DYNAMIC) { - if (IsActivateToQuest ) + if (IsActivateToQuest) { switch(((GameObject*)this)->GetGoType()) { @@ -713,9 +713,9 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask } else // other objects case (no special index checks) { - for (uint16 index = 0; index < m_valuesCount; ++index ) + for (uint16 index = 0; index < m_valuesCount; ++index) { - if ( updateMask->GetBit( index ) ) + if (updateMask->GetBit(index)) { // send in current format (float as float, uint32 as uint32) *data << m_uint32Values[ index ]; @@ -740,9 +740,9 @@ void Object::BuildFieldsUpdate(Player *pl, UpdateDataMapType &data_map) const { UpdateDataMapType::iterator iter = data_map.find(pl); - if ( iter == data_map.end() ) + if (iter == data_map.end()) { - std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert( UpdateDataMapType::value_type(pl, UpdateData()) ); + std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert(UpdateDataMapType::value_type(pl, UpdateData())); assert(p.second); iter = p.first; } @@ -792,9 +792,9 @@ void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const } } -void Object::SetInt32Value( uint16 index, int32 value ) +void Object::SetInt32Value(uint16 index, int32 value) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); if (m_int32Values[ index ] != value) { @@ -811,9 +811,9 @@ void Object::SetInt32Value( uint16 index, int32 value ) } } -void Object::SetUInt32Value( uint16 index, uint32 value ) +void Object::SetUInt32Value(uint16 index, uint32 value) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); if (m_uint32Values[ index ] != value) { @@ -830,16 +830,16 @@ void Object::SetUInt32Value( uint16 index, uint32 value ) } } -void Object::UpdateUInt32Value( uint16 index, uint32 value ) +void Object::UpdateUInt32Value(uint16 index, uint32 value) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); m_uint32Values[ index ] = value; } -void Object::SetUInt64Value( uint16 index, const uint64 &value ) +void Object::SetUInt64Value(uint16 index, const uint64 &value) { - ASSERT( index + 1 < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true)); if (*((uint64*)&(m_uint32Values[ index ])) != value) { m_uint32Values[ index ] = *((uint32*)&value); @@ -858,7 +858,7 @@ void Object::SetUInt64Value( uint16 index, const uint64 &value ) bool Object::AddUInt64Value(uint16 index, const uint64 &value) { - ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , true)); if (value && !*((uint64*)&(m_uint32Values[index]))) { m_uint32Values[ index ] = *((uint32*)&value); @@ -879,7 +879,7 @@ bool Object::AddUInt64Value(uint16 index, const uint64 &value) bool Object::RemoveUInt64Value(uint16 index, const uint64 &value) { - ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , true)); if (value && *((uint64*)&(m_uint32Values[index])) == value) { m_uint32Values[ index ] = 0; @@ -898,9 +898,9 @@ bool Object::RemoveUInt64Value(uint16 index, const uint64 &value) return false; } -void Object::SetFloatValue( uint16 index, float value ) +void Object::SetFloatValue(uint16 index, float value) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); if (m_floatValues[ index ] != value) { @@ -917,9 +917,9 @@ void Object::SetFloatValue( uint16 index, float value ) } } -void Object::SetByteValue( uint16 index, uint8 offset, uint8 value ) +void Object::SetByteValue(uint16 index, uint8 offset, uint8 value) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); if (offset > 4) { @@ -943,9 +943,9 @@ void Object::SetByteValue( uint16 index, uint8 offset, uint8 value ) } } -void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value ) +void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); if (offset > 2) { @@ -969,7 +969,7 @@ void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value ) } } -void Object::SetStatFloatValue( uint16 index, float value) +void Object::SetStatFloatValue(uint16 index, float value) { if (value < 0) value = 0.0f; @@ -977,7 +977,7 @@ void Object::SetStatFloatValue( uint16 index, float value) SetFloatValue(index, value); } -void Object::SetStatInt32Value( uint16 index, int32 value) +void Object::SetStatInt32Value(uint16 index, int32 value) { if (value < 0) value = 0; @@ -1017,9 +1017,9 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply) SetFloatValue(index, cur); } -void Object::SetFlag( uint16 index, uint32 newFlag ) +void Object::SetFlag(uint16 index, uint32 newFlag) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); uint32 oldval = m_uint32Values[ index ]; uint32 newval = oldval | newFlag; @@ -1038,9 +1038,9 @@ void Object::SetFlag( uint16 index, uint32 newFlag ) } } -void Object::RemoveFlag( uint16 index, uint32 oldFlag ) +void Object::RemoveFlag(uint16 index, uint32 oldFlag) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); uint32 oldval = m_uint32Values[ index ]; uint32 newval = oldval & ~oldFlag; @@ -1059,9 +1059,9 @@ void Object::RemoveFlag( uint16 index, uint32 oldFlag ) } } -void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ) +void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); if (offset > 4) { @@ -1084,9 +1084,9 @@ void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ) } } -void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag ) +void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag) { - ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index, true)); if (offset > 4) { @@ -1143,7 +1143,7 @@ void WorldObject::SetWorldObject(bool on) GetMap()->AddObjectToSwitchList(this, on); } -void WorldObject::setActive( bool on ) +void WorldObject::setActive(bool on) { if (m_isActive == on) return; @@ -1180,7 +1180,7 @@ void WorldObject::CleanupsBeforeDelete(bool finalCleanup) { } -void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask ) +void WorldObject::_Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask) { Object::_Create(guidlow, 0, guidhigh); m_phaseMask = phaseMask; @@ -1212,7 +1212,7 @@ float WorldObject::GetDistanceZ(const WorldObject* obj) const float dz = fabs(GetPositionZ() - obj->GetPositionZ()); float sizefactor = GetObjectSize() + obj->GetObjectSize(); float dist = dz - sizefactor; - return ( dist > 0 ? dist : 0); + return (dist > 0 ? dist : 0); } bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const @@ -1236,7 +1236,7 @@ bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const if (!IsInMap(obj)) return false; float ox,oy,oz; obj->GetPosition(ox,oy,oz); - return(IsWithinLOS(ox, oy, oz )); + return(IsWithinLOS(ox, oy, oz)); } bool WorldObject::IsWithinLOS(float ox, float oy, float oz) const @@ -1339,11 +1339,11 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m float Position::GetAngle(const Position *obj) const { if (!obj) return 0; - return GetAngle( obj->GetPositionX(), obj->GetPositionY() ); + return GetAngle(obj->GetPositionX(), obj->GetPositionY()); } // Return angle in range 0..2*pi -float Position::GetAngle( const float x, const float y ) const +float Position::GetAngle(const float x, const float y) const { float dx = x - GetPositionX(); float dy = y - GetPositionY(); @@ -1379,12 +1379,12 @@ bool Position::HasInArc(float arc, const Position *obj) const return true; // move arc to range 0.. 2*pi - while ( arc >= 2.0f * M_PI ) + while (arc >= 2.0f * M_PI) arc -= 2.0f * M_PI; - while ( arc < 0 ) + while (arc < 0) arc += 2.0f * M_PI; - float angle = GetAngle( obj ); + float angle = GetAngle(obj); angle -= m_orientation; //if (angle > 100 || angle < -100) @@ -1397,14 +1397,14 @@ bool Position::HasInArc(float arc, const Position *obj) const //} // move angle to range -pi ... +pi - while ( angle > M_PI) + while (angle > M_PI) angle -= 2.0f * M_PI; while (angle < -M_PI) angle += 2.0f * M_PI; float lborder = -1 * (arc/2.0f); // in range -pi..0 float rborder = (arc/2.0f); // in range 0..pi - return (( angle >= lborder ) && ( angle <= rborder )); + return ((angle >= lborder) && (angle <= rborder)); } bool WorldObject::IsInBetween(const WorldObject *obj1, const WorldObject *obj2, float size) const @@ -1424,12 +1424,12 @@ bool WorldObject::IsInBetween(const WorldObject *obj1, const WorldObject *obj2, bool WorldObject::isInFront(WorldObject const* target, float distance, float arc) const { - return IsWithinDist(target, distance) && HasInArc( arc, target ); + return IsWithinDist(target, distance) && HasInArc(arc, target); } bool WorldObject::isInBack(WorldObject const* target, float distance, float arc) const { - return IsWithinDist(target, distance) && !HasInArc( 2 * M_PI - arc, target ); + return IsWithinDist(target, distance) && !HasInArc(2 * M_PI - arc, target); } void WorldObject::GetRandomPoint(const Position &pos, float distance, float &rand_x, float &rand_y, float &rand_z) const @@ -1503,9 +1503,9 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf) WorldPacket data(SMSG_PLAY_SOUND, 4); data << Sound; if (OnlySelf && GetTypeId() == TYPEID_PLAYER) - this->ToPlayer()->GetSession()->SendPacket( &data ); + this->ToPlayer()->GetSession()->SendPacket(&data); else - SendMessageToSet( &data, true ); // ToSelf ignored in this case + SendMessageToSet(&data, true); // ToSelf ignored in this case } void Object::ForceValuesUpdateAtIndex(uint32 i) @@ -1627,7 +1627,7 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* *data << (uint32)(strlen(name)+1); *data << name; *data << (uint64)targetGuid; // Unit Target - if ( targetGuid && !IS_PLAYER_GUID(targetGuid) ) + if (targetGuid && !IS_PLAYER_GUID(targetGuid)) { *data << (uint32)1; // target name length *data << (uint8)0; // target name @@ -2035,8 +2035,8 @@ namespace Trinity float x,y,z; - if ( !c->isAlive() || c->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) || - !c->GetMotionMaster()->GetDestination(x,y,z) ) + if (!c->isAlive() || c->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) || + !c->GetMotionMaster()->GetDestination(x,y,z)) { x = c->GetPositionX(); y = c->GetPositionY(); @@ -2070,7 +2070,7 @@ namespace Trinity float angle = i_object.GetAngle(u)-i_angle; // move angle to range -pi ... +pi - while ( angle > M_PI) + while (angle > M_PI) angle -= 2.0f * M_PI; while (angle < -M_PI) angle += 2.0f * M_PI; @@ -2090,7 +2090,7 @@ namespace Trinity //=================================================================================================== -void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle ) const +void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle) const { x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle); y = GetPositionY() + (GetObjectSize() + distance2d) * sin(absAngle); @@ -2099,7 +2099,7 @@ void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float abs Trinity::NormalizeMapCoord(y); } -void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle ) const +void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const { GetNearPoint2D(x,y,distance2d+searcher_size,absAngle); z = GetPositionZ(); @@ -2140,7 +2140,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, } // maybe can just place in primary position - if ( selector.CheckOriginal() ) + if (selector.CheckOriginal()) { UpdateGroundPositionZ(x,y,z); // update to LOS height if available @@ -2190,7 +2190,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, } // special case when one from list empty and then empty side preferred - if ( selector.IsNonBalanced() ) + if (selector.IsNonBalanced()) { if (!selector.FirstAngle(angle)) // _used_ pos { @@ -2244,25 +2244,25 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update) UpdateObjectVisibility(); } -void WorldObject::PlayDistanceSound( uint32 sound_id, Player* target /*= NULL*/ ) +void WorldObject::PlayDistanceSound(uint32 sound_id, Player* target /*= NULL*/) { WorldPacket data(SMSG_PLAY_OBJECT_SOUND,4+8); data << uint32(sound_id); data << uint64(GetGUID()); if (target) - target->SendDirectMessage( &data ); + target->SendDirectMessage(&data); else - SendMessageToSet( &data, true ); + SendMessageToSet(&data, true); } -void WorldObject::PlayDirectSound( uint32 sound_id, Player* target /*= NULL*/ ) +void WorldObject::PlayDirectSound(uint32 sound_id, Player* target /*= NULL*/) { WorldPacket data(SMSG_PLAY_SOUND, 4); data << uint32(sound_id); if (target) - target->SendDirectMessage( &data ); + target->SendDirectMessage(&data); else - SendMessageToSet( &data, true ); + SendMessageToSet(&data, true); } void WorldObject::DestroyForNearbyPlayers() diff --git a/src/game/Object.h b/src/game/Object.h index ca4c443c9cd..34e90b1c1c4 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -121,7 +121,7 @@ typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType; class Object { public: - virtual ~Object ( ); + virtual ~Object (); const bool IsInWorld() const { return m_inWorld; } virtual void AddToWorld() @@ -158,83 +158,83 @@ class Object TypeID GetTypeId() const { return m_objectTypeId; } bool isType(uint16 mask) const { return (mask & m_objectType); } - virtual void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const; + virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const; void SendUpdateToPlayer(Player* player); - void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const; - void BuildOutOfRangeUpdateBlock( UpdateData *data ) const; - void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const; + void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const; + void BuildOutOfRangeUpdateBlock(UpdateData *data) const; + void BuildMovementUpdateBlock(UpdateData * data, uint32 flags = 0) const; - virtual void DestroyForPlayer( Player *target, bool anim = false ) const; + virtual void DestroyForPlayer(Player *target, bool anim = false) const; - const int32& GetInt32Value( uint16 index ) const + const int32& GetInt32Value(uint16 index) const { - ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); + ASSERT(index < m_valuesCount || PrintIndexError(index , false)); return m_int32Values[ index ]; } - const uint32& GetUInt32Value( uint16 index ) const + const uint32& GetUInt32Value(uint16 index) const { - ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); + ASSERT(index < m_valuesCount || PrintIndexError(index , false)); return m_uint32Values[ index ]; } - const uint64& GetUInt64Value( uint16 index ) const + const uint64& GetUInt64Value(uint16 index) const { - ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , false) ); + ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , false)); return *((uint64*)&(m_uint32Values[ index ])); } - const float& GetFloatValue( uint16 index ) const + const float& GetFloatValue(uint16 index) const { - ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); + ASSERT(index < m_valuesCount || PrintIndexError(index , false)); return m_floatValues[ index ]; } - uint8 GetByteValue( uint16 index, uint8 offset) const + uint8 GetByteValue(uint16 index, uint8 offset) const { - ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); - ASSERT( offset < 4 ); + ASSERT(index < m_valuesCount || PrintIndexError(index , false)); + ASSERT(offset < 4); return *(((uint8*)&m_uint32Values[ index ])+offset); } - uint16 GetUInt16Value( uint16 index, uint8 offset) const + uint16 GetUInt16Value(uint16 index, uint8 offset) const { - ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); - ASSERT( offset < 2 ); + ASSERT(index < m_valuesCount || PrintIndexError(index , false)); + ASSERT(offset < 2); return *(((uint16*)&m_uint32Values[ index ])+offset); } - void SetInt32Value( uint16 index, int32 value ); - void SetUInt32Value( uint16 index, uint32 value ); - void UpdateUInt32Value( uint16 index, uint32 value ); - void SetUInt64Value( uint16 index, const uint64 &value ); - void SetFloatValue( uint16 index, float value ); - void SetByteValue( uint16 index, uint8 offset, uint8 value ); - void SetUInt16Value( uint16 index, uint8 offset, uint16 value ); - void SetInt16Value( uint16 index, uint8 offset, int16 value ) { SetUInt16Value(index,offset,(uint16)value); } - void SetStatFloatValue( uint16 index, float value); - void SetStatInt32Value( uint16 index, int32 value); + void SetInt32Value(uint16 index, int32 value); + void SetUInt32Value(uint16 index, uint32 value); + void UpdateUInt32Value(uint16 index, uint32 value); + void SetUInt64Value(uint16 index, const uint64 &value); + void SetFloatValue(uint16 index, float value); + void SetByteValue(uint16 index, uint8 offset, uint8 value); + void SetUInt16Value(uint16 index, uint8 offset, uint16 value); + void SetInt16Value(uint16 index, uint8 offset, int16 value) { SetUInt16Value(index,offset,(uint16)value); } + void SetStatFloatValue(uint16 index, float value); + void SetStatInt32Value(uint16 index, int32 value); - bool AddUInt64Value( uint16 index, const uint64 &value ); - bool RemoveUInt64Value( uint16 index, const uint64 &value ); + bool AddUInt64Value(uint16 index, const uint64 &value); + bool RemoveUInt64Value(uint16 index, const uint64 &value); void ApplyModUInt32Value(uint16 index, int32 val, bool apply); void ApplyModInt32Value(uint16 index, int32 val, bool apply); void ApplyModUInt64Value(uint16 index, int32 val, bool apply); - void ApplyModPositiveFloatValue( uint16 index, float val, bool apply); - void ApplyModSignedFloatValue( uint16 index, float val, bool apply); + void ApplyModPositiveFloatValue(uint16 index, float val, bool apply); + void ApplyModSignedFloatValue(uint16 index, float val, bool apply); void ApplyPercentModFloatValue(uint16 index, float val, bool apply) { val = val != -100.0f ? val : -99.9f ; - SetFloatValue(index, GetFloatValue(index) * (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val)) ); + SetFloatValue(index, GetFloatValue(index) * (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val))); } - void SetFlag( uint16 index, uint32 newFlag ); - void RemoveFlag( uint16 index, uint32 oldFlag ); + void SetFlag(uint16 index, uint32 newFlag); + void RemoveFlag(uint16 index, uint32 oldFlag); - void ToggleFlag( uint16 index, uint32 flag) + void ToggleFlag(uint16 index, uint32 flag) { if (HasFlag(index, flag)) RemoveFlag(index, flag); @@ -242,16 +242,16 @@ class Object SetFlag(index, flag); } - bool HasFlag( uint16 index, uint32 flag ) const + bool HasFlag(uint16 index, uint32 flag) const { - if ( index >= m_valuesCount && !PrintIndexError( index , false ) ) return false; + if (index >= m_valuesCount && !PrintIndexError(index , false)) return false; return (m_uint32Values[ index ] & flag) != 0; } - void SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ); - void RemoveByteFlag( uint16 index, uint8 offset, uint8 newFlag ); + void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag); + void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag); - void ToggleFlag( uint16 index, uint8 offset, uint8 flag ) + void ToggleFlag(uint16 index, uint8 offset, uint8 flag) { if (HasByteFlag(index, offset, flag)) RemoveByteFlag(index, offset, flag); @@ -259,33 +259,33 @@ class Object SetByteFlag(index, offset, flag); } - bool HasByteFlag( uint16 index, uint8 offset, uint8 flag ) const + bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const { - ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); - ASSERT( offset < 4 ); + ASSERT(index < m_valuesCount || PrintIndexError(index , false)); + ASSERT(offset < 4); return (((uint8*)&m_uint32Values[index])[offset] & flag) != 0; } - void ApplyModFlag( uint16 index, uint32 flag, bool apply) + void ApplyModFlag(uint16 index, uint32 flag, bool apply) { if (apply) SetFlag(index,flag); else RemoveFlag(index,flag); } - void SetFlag64( uint16 index, uint64 newFlag ) + void SetFlag64(uint16 index, uint64 newFlag) { uint64 oldval = GetUInt64Value(index); uint64 newval = oldval | newFlag; SetUInt64Value(index,newval); } - void RemoveFlag64( uint16 index, uint64 oldFlag ) + void RemoveFlag64(uint16 index, uint64 oldFlag) { uint64 oldval = GetUInt64Value(index); uint64 newval = oldval & ~oldFlag; SetUInt64Value(index,newval); } - void ToggleFlag64( uint16 index, uint64 flag) + void ToggleFlag64(uint16 index, uint64 flag) { if (HasFlag64(index, flag)) RemoveFlag64(index, flag); @@ -293,13 +293,13 @@ class Object SetFlag64(index, flag); } - bool HasFlag64( uint16 index, uint64 flag ) const + bool HasFlag64(uint16 index, uint64 flag) const { - ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); - return (GetUInt64Value( index ) & flag) != 0; + ASSERT(index < m_valuesCount || PrintIndexError(index , false)); + return (GetUInt64Value(index) & flag) != 0; } - void ApplyModFlag64( uint16 index, uint64 flag, bool apply) + void ApplyModFlag64(uint16 index, uint64 flag, bool apply) { if (apply) SetFlag64(index,flag); else RemoveFlag64(index,flag); } @@ -312,7 +312,7 @@ class Object virtual bool hasQuest(uint32 /* quest_id */) const { return false; } virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; } - virtual void BuildUpdate(UpdateDataMapType& ) {} + virtual void BuildUpdate(UpdateDataMapType&) {} void BuildFieldsUpdate(Player *, UpdateDataMapType &) const; // FG: some hacky helpers @@ -325,7 +325,7 @@ class Object protected: - Object ( ); + Object (); void _InitValues(); void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh); @@ -334,7 +334,7 @@ class Object virtual void _SetCreateBits(UpdateMask *updateMask, Player *target) const; void _BuildMovementUpdate(ByteBuffer * data, uint16 flags) const; - void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target ) const; + void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target) const; uint16 m_objectType; @@ -470,12 +470,12 @@ class WorldObject : public Object, public WorldLocation public: virtual ~WorldObject(); - virtual void Update ( uint32 /*time_diff*/ ) { } + virtual void Update (uint32 /*time_diff*/) { } - void _Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask); + void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask); - void GetNearPoint2D( float &x, float &y, float distance, float absAngle) const; - void GetNearPoint( WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const; + void GetNearPoint2D(float &x, float &y, float distance, float absAngle) const; + void GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const; void GetClosePoint(float &x, float &y, float &z, float size, float distance2d = 0, float angle = 0) const { // angle calculated from current orientation @@ -493,15 +493,15 @@ class WorldObject : public Object, public WorldLocation MovePosition(pos, radius * rand_norm(), rand_norm() * 2 * M_PI); } - void GetContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const + void GetContactPoint(const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const { // angle to face `obj` to `this` using distance includes size of `obj` - GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle( obj )); + GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle(obj)); } float GetObjectSize() const { - return ( m_valuesCount > UNIT_FIELD_COMBATREACH ) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE; + return (m_valuesCount > UNIT_FIELD_COMBATREACH) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE; } void UpdateGroundPositionZ(float x, float y, float &z) const; @@ -662,7 +662,7 @@ class WorldObject : public Object, public WorldLocation void DestroyForNearbyPlayers(); virtual void UpdateObjectVisibility(bool forced = true); - void BuildUpdate(UpdateDataMapType& ); + void BuildUpdate(UpdateDataMapType&); //relocation and visibility system functions void AddToNotify(uint16 f) { m_notifyflags |= f;} diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 1a8afaf7a3a..8e64eb48fa0 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -147,14 +147,14 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL return NULL; CellPair p = Trinity::ComputeCellPair(x, y); - if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); return NULL; } CellPair q = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - if (q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) + if (q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); return NULL; @@ -227,7 +227,7 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL void RemoveUpdateObject(Object* obj) { Guard guard(i_updateGuard); - i_objects.erase( obj ); + i_objects.erase(obj); } void Update(uint32 diff); diff --git a/src/game/ObjectDefines.h b/src/game/ObjectDefines.h index a4d53aeee96..2fe9757cc50 100644 --- a/src/game/ObjectDefines.h +++ b/src/game/ObjectDefines.h @@ -24,12 +24,12 @@ #include "Platform/Define.h" // used for creating values for respawn for example -#define MAKE_PAIR64(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) ) +#define MAKE_PAIR64(l, h) uint64(uint32(l) | (uint64(h) << 32)) #define PAIR64_HIPART(x) (uint32)((uint64(x) >> 32) & UI64LIT(0x00000000FFFFFFFF)) #define PAIR64_LOPART(x) (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF)) -#define MAKE_PAIR16(l, h) uint16( uint8(l) | ( uint16(h) << 8 ) ) -#define MAKE_PAIR32(l, h) uint32( uint16(l) | ( uint32(h) << 16 ) ) +#define MAKE_PAIR16(l, h) uint16(uint8(l) | (uint16(h) << 8)) +#define MAKE_PAIR32(l, h) uint32(uint16(l) | (uint32(h) << 16)) #define PAIR32_HIPART(x) (uint16)((uint32(x) >> 16) & 0x0000FFFF) #define PAIR32_LOPART(x) (uint16)(uint32(x) & 0x0000FFFF) @@ -48,27 +48,27 @@ enum HighGuid HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT) }; -#define IS_EMPTY_GUID(Guid) ( Guid == 0 ) +#define IS_EMPTY_GUID(Guid) (Guid == 0) -#define IS_CREATURE_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_UNIT ) -#define IS_PET_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_PET ) -#define IS_VEHICLE_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_VEHICLE ) -#define IS_CRE_OR_VEH_GUID(Guid) ( IS_CREATURE_GUID(Guid) || IS_VEHICLE_GUID(Guid) ) -#define IS_CRE_OR_VEH_OR_PET_GUID(Guid)( IS_CRE_OR_VEH_GUID(Guid) || IS_PET_GUID(Guid) ) -#define IS_PLAYER_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_PLAYER && Guid!=0 ) -#define IS_UNIT_GUID(Guid) ( IS_CRE_OR_VEH_OR_PET_GUID(Guid) || IS_PLAYER_GUID(Guid) ) +#define IS_CREATURE_GUID(Guid) (GUID_HIPART(Guid) == HIGHGUID_UNIT) +#define IS_PET_GUID(Guid) (GUID_HIPART(Guid) == HIGHGUID_PET) +#define IS_VEHICLE_GUID(Guid) (GUID_HIPART(Guid) == HIGHGUID_VEHICLE) +#define IS_CRE_OR_VEH_GUID(Guid) (IS_CREATURE_GUID(Guid) || IS_VEHICLE_GUID(Guid)) +#define IS_CRE_OR_VEH_OR_PET_GUID(Guid)(IS_CRE_OR_VEH_GUID(Guid) || IS_PET_GUID(Guid)) +#define IS_PLAYER_GUID(Guid) (GUID_HIPART(Guid) == HIGHGUID_PLAYER && Guid!=0) +#define IS_UNIT_GUID(Guid) (IS_CRE_OR_VEH_OR_PET_GUID(Guid) || IS_PLAYER_GUID(Guid)) // special case for empty guid need check -#define IS_ITEM_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_ITEM ) -#define IS_GAMEOBJECT_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT ) -#define IS_DYNAMICOBJECT_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_DYNAMICOBJECT ) -#define IS_CORPSE_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_CORPSE ) -#define IS_TRANSPORT(Guid) ( GUID_HIPART(Guid) == HIGHGUID_TRANSPORT ) -#define IS_MO_TRANSPORT(Guid) ( GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT ) +#define IS_ITEM_GUID(Guid) (GUID_HIPART(Guid) == HIGHGUID_ITEM) +#define IS_GAMEOBJECT_GUID(Guid) (GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT) +#define IS_DYNAMICOBJECT_GUID(Guid) (GUID_HIPART(Guid) == HIGHGUID_DYNAMICOBJECT) +#define IS_CORPSE_GUID(Guid) (GUID_HIPART(Guid) == HIGHGUID_CORPSE) +#define IS_TRANSPORT(Guid) (GUID_HIPART(Guid) == HIGHGUID_TRANSPORT) +#define IS_MO_TRANSPORT(Guid) (GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT) // l - OBJECT_FIELD_GUID // e - OBJECT_FIELD_ENTRY for GO (except GAMEOBJECT_TYPE_MO_TRANSPORT) and creatures or UNIT_FIELD_PETNUMBER for pets // h - OBJECT_FIELD_GUID + 1 -#define MAKE_NEW_GUID(l, e, h) uint64( uint64(l) | ( uint64(e) << 24 ) | ( uint64(h) << 48 ) ) +#define MAKE_NEW_GUID(l, e, h) uint64(uint64(l) | (uint64(e) << 24) | (uint64(h) << 48)) #define GUID_HIPART(x) (uint32)((uint64(x) >> 48) & 0x0000FFFF) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 3585e0dbc47..06c4bbf2069 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -188,10 +188,10 @@ ObjectMgr::ObjectMgr() ObjectMgr::~ObjectMgr() { - for (QuestMap::iterator i = mQuestTemplates.begin( ); i != mQuestTemplates.end( ); ++i ) + for (QuestMap::iterator i = mQuestTemplates.begin(); i != mQuestTemplates.end(); ++i) delete i->second; - for (PetLevelInfoMap::iterator i = petInfo.begin( ); i != petInfo.end( ); ++i ) + for (PetLevelInfoMap::iterator i = petInfo.begin(); i != petInfo.end(); ++i) delete[] i->second; // free only if loaded @@ -366,7 +366,7 @@ void ObjectMgr::LoadCreatureLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu creature locale strings", (unsigned long)mCreatureLocaleMap.size() ); + sLog.outString(">> Loaded %lu creature locale strings", (unsigned long)mCreatureLocaleMap.size()); } void ObjectMgr::LoadNpcOptionLocales() @@ -425,7 +425,7 @@ void ObjectMgr::LoadNpcOptionLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu gossip_menu_option locale strings", (unsigned long)mGossipMenuItemsLocaleMap.size() ); + sLog.outString(">> Loaded %lu gossip_menu_option locale strings", (unsigned long)mGossipMenuItemsLocaleMap.size()); } void ObjectMgr::LoadPointOfInterestLocales() @@ -466,7 +466,7 @@ void ObjectMgr::LoadPointOfInterestLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu points_of_interest locale strings", (unsigned long)mPointOfInterestLocaleMap.size() ); + sLog.outString(">> Loaded %lu points_of_interest locale strings", (unsigned long)mPointOfInterestLocaleMap.size()); } struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader> @@ -483,7 +483,7 @@ void ObjectMgr::LoadCreatureTemplates() SQLCreatureLoader loader; loader.Load(sCreatureStorage); - sLog.outString( ">> Loaded %u creature definitions", sCreatureStorage.RecordCount ); + sLog.outString(">> Loaded %u creature definitions", sCreatureStorage.RecordCount); sLog.outString(); std::set<uint32> difficultyEntries[MAX_DIFFICULTY - 1]; // already loaded difficulty 1 value in creatures @@ -720,7 +720,7 @@ void ObjectMgr::LoadCreatureTemplates() } // must exist or used hidden but used in data horse case - if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM ) + if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM) { sLog.outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`",cInfo->Entry,cInfo->family); const_cast<CreatureInfo*>(cInfo)->family = 0; @@ -850,7 +850,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]); cAura.spell_id = itr->first; cAura.effectMask = itr->second; - if ( cAura.effectMask > 7 || !cAura.effectMask) + if (cAura.effectMask > 7 || !cAura.effectMask) { sLog.outErrorDb("Creature (%s: %u) has wrong effect for spell %u in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.spell_id,table); continue; @@ -933,7 +933,7 @@ void ObjectMgr::LoadCreatureAddons() if (!sCreatureStorage.LookupEntry<CreatureInfo>(addon->guidOrEntry)) sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`",addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName()); - sLog.outString( "Loading Creature Addon Data..." ); + sLog.outString("Loading Creature Addon Data..."); LoadCreatureAddons(sCreatureDataAddonStorage,"GUID","creature addons"); // check entry ids @@ -988,7 +988,7 @@ void ObjectMgr::LoadEquipmentTemplates() } } } - sLog.outString( ">> Loaded %u equipment template", sEquipmentStorage.RecordCount ); + sLog.outString(">> Loaded %u equipment template", sEquipmentStorage.RecordCount); sLog.outString(); } @@ -1079,7 +1079,7 @@ void ObjectMgr::LoadCreatureModelInfo() } } - sLog.outString( ">> Loaded %u creature model based info", sCreatureModelStorage.RecordCount ); + sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.RecordCount); sLog.outString(); // check if combat_reach is valid @@ -1159,7 +1159,7 @@ void ObjectMgr::LoadCreatureLinkedRespawn() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u linked respawns", mCreatureLinkedRespawnMap.size() ); + sLog.outString(">> Loaded %u linked respawns", mCreatureLinkedRespawnMap.size()); } bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid) @@ -1267,12 +1267,12 @@ void ObjectMgr::LoadCreatures() MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { - sLog.outErrorDb("Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.",guid, data.mapid ); + sLog.outErrorDb("Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.",guid, data.mapid); continue; } if (data.spawnMask & ~spawnMasks[data.mapid]) - sLog.outErrorDb("Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).",guid, data.spawnMask, data.mapid ); + sLog.outErrorDb("Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).",guid, data.spawnMask, data.mapid); bool ok = true; for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff) @@ -1280,7 +1280,7 @@ void ObjectMgr::LoadCreatures() if (difficultyCreatures[diff].find(data.id) != difficultyCreatures[diff].end()) { sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.", - guid, diff + 1, data.id ); + guid, diff + 1, data.id); ok = false; } } @@ -1314,14 +1314,14 @@ void ObjectMgr::LoadCreatures() if (data.spawndist < 0.0f) { - sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.",guid,data.id ); + sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.",guid,data.id); data.spawndist = 0.0f; } else if (data.movementType == RANDOM_MOTION_TYPE) { if (data.spawndist == 0.0f) { - sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).",guid,data.id ); + sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).",guid,data.id); data.movementType = IDLE_MOTION_TYPE; } else if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) @@ -1331,14 +1331,14 @@ void ObjectMgr::LoadCreatures() { if (data.spawndist != 0.0f) { - sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.",guid,data.id ); + sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.",guid,data.id); data.spawndist = 0.0f; } } if (data.phaseMask==0) { - sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id ); + sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id); data.phaseMask = 1; } @@ -1364,7 +1364,7 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu creatures", (unsigned long)mCreatureDataMap.size() ); + sLog.outString(">> Loaded %lu creatures", (unsigned long)mCreatureDataMap.size()); } void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) @@ -1650,25 +1650,25 @@ void ObjectMgr::LoadGameobjects() if (data.rotation2 < -1.0f || data.rotation2 > 1.0f) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip",guid,data.id,data.rotation2 ); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip",guid,data.id,data.rotation2); continue; } if (data.rotation3 < -1.0f || data.rotation3 > 1.0f) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip",guid,data.id,data.rotation3 ); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip",guid,data.id,data.rotation3); continue; } if (!MapManager::IsValidMapCoord(data.mapid,data.posX,data.posY,data.posZ,data.orientation)) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid coordinates, skip",guid,data.id ); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid coordinates, skip",guid,data.id); continue; } if (data.phaseMask==0) { - sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id ); + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id); data.phaseMask = 1; } @@ -1679,7 +1679,7 @@ void ObjectMgr::LoadGameobjects() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu gameobjects", (unsigned long)mGameObjectDataMap.size()); + sLog.outString(">> Loaded %lu gameobjects", (unsigned long)mGameObjectDataMap.size()); } void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) @@ -1748,7 +1748,7 @@ void ObjectMgr::LoadCreatureRespawnTimes() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu creature respawn times", (unsigned long)mCreatureRespawnTimes.size() ); + sLog.outString(">> Loaded %lu creature respawn times", (unsigned long)mCreatureRespawnTimes.size()); } void ObjectMgr::LoadGameobjectRespawnTimes() @@ -1787,7 +1787,7 @@ void ObjectMgr::LoadGameobjectRespawnTimes() ++count; } while (result->NextRow()); - sLog.outString( ">> Loaded %lu gameobject respawn times", (unsigned long)mGORespawnTimes.size() ); + sLog.outString(">> Loaded %lu gameobject respawn times", (unsigned long)mGORespawnTimes.size()); sLog.outString(); } @@ -1926,7 +1926,7 @@ void ObjectMgr::LoadItemLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu Item locale strings", (unsigned long)mItemLocaleMap.size() ); + sLog.outString(">> Loaded %lu Item locale strings", (unsigned long)mItemLocaleMap.size()); } struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader> @@ -1942,7 +1942,7 @@ void ObjectMgr::LoadItemPrototypes() { SQLItemLoader loader; loader.Load(sItemStorage); - sLog.outString( ">> Loaded %u item prototypes", sItemStorage.RecordCount ); + sLog.outString(">> Loaded %u item prototypes", sItemStorage.RecordCount); sLog.outString(); // check data correctness @@ -2528,15 +2528,15 @@ void ObjectMgr::LoadPetLevelInfo() if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u level pet stats definitions", count ); - sLog.outErrorDb( "Error loading `pet_levelstats` table or empty table."); + sLog.outString(">> Loaded %u level pet stats definitions", count); + sLog.outErrorDb("Error loading `pet_levelstats` table or empty table."); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2590,7 +2590,7 @@ void ObjectMgr::LoadPetLevelInfo() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u level pet stats definitions", count ); + sLog.outString(">> Loaded %u level pet stats definitions", count); } // Fill gaps and check integrity @@ -2599,7 +2599,7 @@ void ObjectMgr::LoadPetLevelInfo() PetLevelInfo* pInfo = itr->second; // fatal error if no level 1 data - if (!pInfo || pInfo[0].health == 0 ) + if (!pInfo || pInfo[0].health == 0) { sLog.outErrorDb("Creature %u does not have pet stats data for Level 1!",itr->first); exit(1); @@ -2640,15 +2640,15 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u player create definitions", count ); - sLog.outErrorDb( "Error loading `playercreateinfo` table or empty table."); + sLog.outString(">> Loaded %u player create definitions", count); + sLog.outErrorDb("Error loading `playercreateinfo` table or empty table."); exit(1); } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2688,13 +2688,13 @@ void ObjectMgr::LoadPlayerInfo() } // accept DB data only for valid position (and non instanceable) - if ( !MapManager::IsValidMapCoord(mapId,positionX,positionY,positionZ) ) + if (!MapManager::IsValidMapCoord(mapId,positionX,positionY,positionZ)) { sLog.outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race); continue; } - if ( sMapStore.LookupEntry(mapId)->Instanceable() ) + if (sMapStore.LookupEntry(mapId)->Instanceable()) { sLog.outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race); continue; @@ -2717,7 +2717,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u player create definitions", count ); + sLog.outString(">> Loaded %u player create definitions", count); } // Load playercreate items @@ -2730,16 +2730,16 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u custom player create items", count ); + sLog.outString(">> Loaded %u custom player create items", count); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2777,7 +2777,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - pInfo->item.push_back(PlayerCreateInfoItem( item_id, amount)); + pInfo->item.push_back(PlayerCreateInfoItem(item_id, amount)); bar.step(); ++count; @@ -2785,7 +2785,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u custom player create items", count ); + sLog.outString(">> Loaded %u custom player create items", count); } } @@ -2803,15 +2803,15 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u player create spells", count ); - sLog.outErrorDb( "Error loading player starting spells or empty table."); + sLog.outString(">> Loaded %u player create spells", count); + sLog.outErrorDb("Error loading player starting spells or empty table."); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2847,10 +2847,10 @@ void ObjectMgr::LoadPlayerInfo() bar.step(); ++count; } - while ( result->NextRow() ); + while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u player create spells", count ); + sLog.outString(">> Loaded %u player create spells", count); } } @@ -2864,15 +2864,15 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u player create actions", count ); - sLog.outErrorDb( "Error loading `playercreateinfo_action` table or empty table."); + sLog.outString(">> Loaded %u player create actions", count); + sLog.outErrorDb("Error loading `playercreateinfo_action` table or empty table."); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2898,10 +2898,10 @@ void ObjectMgr::LoadPlayerInfo() bar.step(); ++count; } - while ( result->NextRow() ); + while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u player create actions", count ); + sLog.outString(">> Loaded %u player create actions", count); } } @@ -2915,15 +2915,15 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u level health/mana definitions", count ); - sLog.outErrorDb( "Error loading `player_classlevelstats` table or empty table."); + sLog.outString(">> Loaded %u level health/mana definitions", count); + sLog.outErrorDb("Error loading `player_classlevelstats` table or empty table."); exit(1); } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2965,7 +2965,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u level health/mana definitions", count ); + sLog.outString(">> Loaded %u level health/mana definitions", count); } // Fill gaps and check integrity @@ -2978,7 +2978,7 @@ void ObjectMgr::LoadPlayerInfo() PlayerClassInfo* pClassInfo = &playerClassInfo[class_]; // fatal error if no level 1 data - if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0 ) + if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0) { sLog.outErrorDb("Class %i Level 1 does not have health/mana data!",class_); exit(1); @@ -3005,15 +3005,15 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u level stats definitions", count ); - sLog.outErrorDb( "Error loading `player_levelstats` table or empty table."); + sLog.outString(">> Loaded %u level stats definitions", count); + sLog.outErrorDb("Error loading `player_levelstats` table or empty table."); exit(1); } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -3064,7 +3064,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u level stats definitions", count ); + sLog.outString(">> Loaded %u level stats definitions", count); } // Fill gaps and check integrity @@ -3095,7 +3095,7 @@ void ObjectMgr::LoadPlayerInfo() continue; // fatal error if no level 1 data - if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0 ) + if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0) { sLog.outErrorDb("Race %i Class %i Level 1 does not have stats data!",race,class_); exit(1); @@ -3127,15 +3127,15 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); sLog.outString(); - sLog.outString( ">> Loaded %u xp for level definitions", count ); - sLog.outErrorDb( "Error loading `player_xp_for_level` table or empty table."); + sLog.outString(">> Loaded %u xp for level definitions", count); + sLog.outErrorDb("Error loading `player_xp_for_level` table or empty table."); exit(1); } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -3163,7 +3163,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u xp for level definitions", count ); + sLog.outString(">> Loaded %u xp for level definitions", count); } // fill level gaps @@ -3300,7 +3300,7 @@ void ObjectMgr::LoadGuilds() bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u guild definitions", count ); + sLog.outString(">> Loaded %u guild definitions", count); return; } @@ -3338,7 +3338,7 @@ void ObjectMgr::LoadGuilds() !newGuild->LoadMembersFromDB(guildMembersResult) || !newGuild->LoadBankRightsFromDB(guildBankTabRightsResult) || !newGuild->CheckGuildStructure() - ) +) { newGuild->Disband(); delete newGuild; @@ -3357,7 +3357,7 @@ void ObjectMgr::LoadGuilds() CharacterDatabase.PQuery("DELETE FROM guild_bank_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT)); sLog.outString(); - sLog.outString( ">> Loaded %u guild definitions", count ); + sLog.outString(">> Loaded %u guild definitions", count); } void ObjectMgr::LoadArenaTeams() @@ -3365,20 +3365,20 @@ void ObjectMgr::LoadArenaTeams() uint32 count = 0; // 0 1 2 3 4 5 - QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT arena_team.arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle," + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT arena_team.arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle," // 6 7 8 9 10 11 12 13 14 "EmblemColor,BorderStyle,BorderColor, rating,games,wins,played,wins2,rank " - "FROM arena_team LEFT JOIN arena_team_stats ON arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY arena_team.arenateamid ASC" ); + "FROM arena_team LEFT JOIN arena_team_stats ON arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY arena_team.arenateamid ASC"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u arenateam definitions", count ); + sLog.outString(">> Loaded %u arenateam definitions", count); return; } @@ -3388,7 +3388,7 @@ void ObjectMgr::LoadArenaTeams() "SELECT arenateamid,member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class " "FROM arena_team_member member LEFT JOIN characters chars on member.guid = chars.guid ORDER BY member.arenateamid ASC"); - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -3406,10 +3406,10 @@ void ObjectMgr::LoadArenaTeams() continue; } AddArenaTeam(newArenaTeam); - }while ( result->NextRow() ); + }while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u arenateam definitions", count ); + sLog.outString(">> Loaded %u arenateam definitions", count); } void ObjectMgr::LoadGroups() @@ -3421,18 +3421,18 @@ void ObjectMgr::LoadGroups() // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid FROM groups"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u group definitions", count ); + sLog.outString(">> Loaded %u group definitions", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -3449,10 +3449,10 @@ void ObjectMgr::LoadGroups() continue; } AddGroup(group); - }while ( result->NextRow() ); + }while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u group definitions", count ); + sLog.outString(">> Loaded %u group definitions", count); // -- loading members -- count = 0; @@ -3462,12 +3462,12 @@ void ObjectMgr::LoadGroups() result = CharacterDatabase.Query("SELECT memberGuid, memberFlags, subgroup, leaderGuid FROM group_member ORDER BY leaderGuid"); if (!result) { - barGoLink bar2( 1 ); + barGoLink bar2(1); bar2.step(); } else { - barGoLink bar2( result->GetRowCount() ); + barGoLink bar2(result->GetRowCount()); do { bar2.step(); @@ -3490,7 +3490,7 @@ void ObjectMgr::LoadGroups() sLog.outErrorDb("Incorrect entry in group_member table : member %d cannot be added to player %d's group!", fields[0].GetUInt32(), fields[3].GetUInt32()); CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", fields[0].GetUInt32()); } - }while ( result->NextRow() ); + }while (result->NextRow()); } // clean groups @@ -3517,16 +3517,16 @@ void ObjectMgr::LoadGroups() // 6 "(SELECT COUNT(*) FROM character_instance WHERE guid = leaderGuid AND instance = group_instance.instance AND permanent = 1 LIMIT 1) " "FROM group_instance LEFT JOIN instance ON instance = id ORDER BY leaderGuid" - ); +); if (!result) { - barGoLink bar2( 1 ); + barGoLink bar2(1); bar2.step(); } else { - barGoLink bar2( result->GetRowCount() ); + barGoLink bar2(result->GetRowCount()); do { bar2.step(); @@ -3559,14 +3559,14 @@ void ObjectMgr::LoadGroups() InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true); group->BindToInstance(save, fields[3].GetBool(), true); - }while ( result->NextRow() ); + }while (result->NextRow()); } sLog.outString(); - sLog.outString( ">> Loaded %u group-instance binds total", count ); + sLog.outString(">> Loaded %u group-instance binds total", count); sLog.outString(); - sLog.outString( ">> Loaded %u group members total", count ); + sLog.outString(">> Loaded %u group members total", count); } void ObjectMgr::LoadQuests() @@ -3617,11 +3617,11 @@ void ObjectMgr::LoadQuests() " FROM quest_template"); if (result == NULL) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 quests definitions" ); + sLog.outString(">> Loaded 0 quests definitions"); sLog.outErrorDb("`quest_template` table is empty!"); return; } @@ -3629,7 +3629,7 @@ void ObjectMgr::LoadQuests() // create multimap previous quest for each existed quest // some quests can have many previous maps set by NextQuestId in previous quest // for example set of race quests can lead to single not race specific quest - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { bar.step(); @@ -3637,7 +3637,7 @@ void ObjectMgr::LoadQuests() Quest * newQuest = new Quest(fields); mQuestTemplates[newQuest->GetQuestId()] = newQuest; - } while ( result->NextRow() ); + } while (result->NextRow()); std::map<uint32,uint32> usedMailTemplates; @@ -3648,7 +3648,7 @@ void ObjectMgr::LoadQuests() // additional quest integrity checks (GO, creature_template and item_template must be loaded already) - if ( qinfo->GetQuestMethod() >= 3 ) + if (qinfo->GetQuestMethod() >= 3) { sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod()); } @@ -3672,7 +3672,7 @@ void ObjectMgr::LoadQuests() if (qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED) { // at auto-reward can be rewarded only RewChoiceItemId[0] - for (uint8 j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j ) + for (uint8 j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j) { if (uint32 id = qinfo->RewChoiceItemId[j]) { @@ -3684,7 +3684,7 @@ void ObjectMgr::LoadQuests() } // client quest log visual (area case) - if ( qinfo->ZoneOrSort > 0 ) + if (qinfo->ZoneOrSort > 0) { if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort)) { @@ -3694,17 +3694,17 @@ void ObjectMgr::LoadQuests() } } // client quest log visual (sort case) - if ( qinfo->ZoneOrSort < 0 ) + if (qinfo->ZoneOrSort < 0) { QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort)); - if ( !qSort ) + if (!qSort) { sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", qinfo->GetQuestId(),qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } //check SkillOrClass value (class case). - if ( ClassByQuestSort(-int32(qinfo->ZoneOrSort)) ) + if (ClassByQuestSort(-int32(qinfo->ZoneOrSort))) { // SkillOrClass should not have class case when class case already set in ZoneOrSort. if (qinfo->SkillOrClass < 0) @@ -3717,7 +3717,7 @@ void ObjectMgr::LoadQuests() if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) { // skill is positive value in SkillOrClass - if (qinfo->SkillOrClass != skill_id ) + if (qinfo->SkillOrClass != skill_id) { sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (skill sort case) but `SkillOrClass` does not have a corresponding value (%i).", qinfo->GetQuestId(),qinfo->ZoneOrSort,skill_id); @@ -3727,34 +3727,34 @@ void ObjectMgr::LoadQuests() } // SkillOrClass (class case) - if ( qinfo->SkillOrClass < 0 ) + if (qinfo->SkillOrClass < 0) { - if ( !sChrClassesStore.LookupEntry(-int32(qinfo->SkillOrClass)) ) + if (!sChrClassesStore.LookupEntry(-int32(qinfo->SkillOrClass))) { sLog.outErrorDb("Quest %u has `SkillOrClass` = %i (class case) but class (%i) does not exist", qinfo->GetQuestId(),qinfo->SkillOrClass,-qinfo->SkillOrClass); } } // SkillOrClass (skill case) - if ( qinfo->SkillOrClass > 0 ) + if (qinfo->SkillOrClass > 0) { - if ( !sSkillLineStore.LookupEntry(qinfo->SkillOrClass) ) + if (!sSkillLineStore.LookupEntry(qinfo->SkillOrClass)) { sLog.outErrorDb("Quest %u has `SkillOrClass` = %u (skill case) but skill (%i) does not exist", qinfo->GetQuestId(),qinfo->SkillOrClass,qinfo->SkillOrClass); } } - if ( qinfo->RequiredSkillValue ) + if (qinfo->RequiredSkillValue) { - if ( qinfo->RequiredSkillValue > sWorld.GetConfigMaxSkillValue() ) + if (qinfo->RequiredSkillValue > sWorld.GetConfigMaxSkillValue()) { sLog.outErrorDb("Quest %u has `RequiredSkillValue` = %u but max possible skill is %u, quest can't be done.", qinfo->GetQuestId(),qinfo->RequiredSkillValue,sWorld.GetConfigMaxSkillValue()); // no changes, quest can't be done for this requirement } - if ( qinfo->SkillOrClass <= 0 ) + if (qinfo->SkillOrClass <= 0) { sLog.outErrorDb("Quest %u has `RequiredSkillValue` = %u but `SkillOrClass` = %i (class case), value ignored.", qinfo->GetQuestId(),qinfo->RequiredSkillValue,qinfo->SkillOrClass); @@ -3805,28 +3805,28 @@ void ObjectMgr::LoadQuests() // no changes, quest can't be done for this requirement } - if (!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue > 0 ) + if (!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue > 0) { sLog.outErrorDb("Quest %u has `RepObjectiveValue` = %d but `RepObjectiveFaction` is 0, value has no effect", qinfo->GetQuestId(),qinfo->RepObjectiveValue); // warning } - if (!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 > 0 ) + if (!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 > 0) { sLog.outErrorDb("Quest %u has `RepObjectiveValue2` = %d but `RepObjectiveFaction2` is 0, value has no effect", qinfo->GetQuestId(),qinfo->RepObjectiveValue2); // warning } - if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue > 0 ) + if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue > 0) { sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", qinfo->GetQuestId(),qinfo->RequiredMinRepValue); // warning } - if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue > 0 ) + if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue > 0) { sLog.outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", qinfo->GetQuestId(),qinfo->RequiredMaxRepValue); @@ -3880,7 +3880,7 @@ void ObjectMgr::LoadQuests() } } - for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j ) + for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) { uint32 id = qinfo->ReqItemId[j]; if (id) @@ -3909,7 +3909,7 @@ void ObjectMgr::LoadQuests() } } - for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j ) + for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j) { uint32 id = qinfo->ReqSourceId[j]; if (id) @@ -3932,7 +3932,7 @@ void ObjectMgr::LoadQuests() } } - for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j ) + for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { uint32 id = qinfo->ReqSpell[j]; if (id) @@ -3978,7 +3978,7 @@ void ObjectMgr::LoadQuests() } } - for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j ) + for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { int32 id = qinfo->ReqCreatureOrGOId[j]; if (id < 0 && !sGOStorage.LookupEntry<GameObjectInfo>(-id)) @@ -4016,7 +4016,7 @@ void ObjectMgr::LoadQuests() } } - for (uint8 j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j ) + for (uint8 j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j) { uint32 id = qinfo->RewChoiceItemId[j]; if (id) @@ -4043,7 +4043,7 @@ void ObjectMgr::LoadQuests() } } - for (uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j ) + for (uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j) { uint32 id = qinfo->RewItemId[j]; if (id) @@ -4080,7 +4080,7 @@ void ObjectMgr::LoadQuests() } if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j])) { - sLog.outErrorDb("Quest %u has `RewRepFaction%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(),j+1,qinfo->RewRepFaction[j] ,qinfo->RewRepFaction[j] ); + sLog.outErrorDb("Quest %u has `RewRepFaction%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(),j+1,qinfo->RewRepFaction[j] ,qinfo->RewRepFaction[j]); qinfo->RewRepFaction[j] = 0; // quest will not reward this } } @@ -4174,7 +4174,7 @@ void ObjectMgr::LoadQuests() if (qNextItr == mQuestTemplates.end()) { sLog.outErrorDb("Quest %u has `NextQuestInChain` = %u but quest %u does not exist, quest chain will not work.", - qinfo->GetQuestId(),qinfo->NextQuestInChain ,qinfo->NextQuestInChain ); + qinfo->GetQuestId(),qinfo->NextQuestInChain ,qinfo->NextQuestInChain); qinfo->NextQuestInChain = 0; } else @@ -4245,7 +4245,7 @@ void ObjectMgr::LoadQuests() } sLog.outString(); - sLog.outString( ">> Loaded %lu quests definitions", (unsigned long)mQuestTemplates.size() ); + sLog.outString(">> Loaded %lu quests definitions", (unsigned long)mQuestTemplates.size()); } void ObjectMgr::LoadQuestLocales() @@ -4262,7 +4262,7 @@ void ObjectMgr::LoadQuestLocales() "Title_loc7,Details_loc7,Objectives_loc7,OfferRewardText_loc7,RequestItemsText_loc7,EndText_loc7,CompletedText_loc7,ObjectiveText1_loc7,ObjectiveText2_loc7,ObjectiveText3_loc7,ObjectiveText4_loc7," "Title_loc8,Details_loc8,Objectives_loc8,OfferRewardText_loc8,RequestItemsText_loc8,EndText_loc8,CompletedText_loc8,ObjectiveText1_loc8,ObjectiveText2_loc8,ObjectiveText3_loc8,ObjectiveText4_loc8" " FROM locales_quest" - ); +); if (!result) return; @@ -4384,7 +4384,7 @@ void ObjectMgr::LoadQuestLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu Quest locale strings", (unsigned long)mQuestLocaleMap.size() ); + sLog.outString(">> Loaded %lu Quest locale strings", (unsigned long)mQuestLocaleMap.size()); } void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) @@ -4392,25 +4392,25 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) if (sWorld.IsScriptScheduled()) // function don't must be called in time scripts use. return; - sLog.outString( "%s :", tablename); + sLog.outString("%s :", tablename); scripts.clear(); // need for reload support - QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id,delay,command,datalong,datalong2,dataint, x, y, z, o FROM %s", tablename ); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id,delay,command,datalong,datalong2,dataint, x, y, z, o FROM %s", tablename); uint32 count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u script definitions", count ); + sLog.outString(">> Loaded %u script definitions", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -4522,11 +4522,11 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) continue; } - if ( info->type==GAMEOBJECT_TYPE_FISHINGNODE || + if (info->type==GAMEOBJECT_TYPE_FISHINGNODE || info->type==GAMEOBJECT_TYPE_FISHINGHOLE || info->type==GAMEOBJECT_TYPE_DOOR || info->type==GAMEOBJECT_TYPE_BUTTON || - info->type==GAMEOBJECT_TYPE_TRAP ) + info->type==GAMEOBJECT_TYPE_TRAP) { sLog.outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",tablename,info->id,tmp.id); continue; @@ -4550,7 +4550,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) continue; } - if ( info->type!=GAMEOBJECT_TYPE_DOOR) + if (info->type!=GAMEOBJECT_TYPE_DOOR) { sLog.outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u",tablename,info->id,(tmp.command==SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"),tmp.id); continue; @@ -4643,10 +4643,10 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) scripts[tmp.id].insert(std::pair<uint32, ScriptInfo>(tmp.delay, tmp)); ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u script definitions", count ); + sLog.outString(">> Loaded %u script definitions", count); } void ObjectMgr::LoadGameObjectScripts() @@ -4705,10 +4705,10 @@ void ObjectMgr::LoadSpellScripts() for (uint8 i=0; i<3; ++i) { // skip empty effects - if ( !spellInfo->Effect[i] ) + if (!spellInfo->Effect[i]) continue; - if ( spellInfo->Effect[i] == SPELL_EFFECT_SCRIPT_EFFECT ) + if (spellInfo->Effect[i] == SPELL_EFFECT_SCRIPT_EFFECT) { found = true; break; @@ -4757,7 +4757,7 @@ void ObjectMgr::LoadEventScripts() { for (uint8 j=0; j<3; ++j) { - if ( spell->Effect[j] == SPELL_EFFECT_SEND_EVENT ) + if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT) { if (spell->EffectMiscValue[j]) evt_scripts.insert(spell->EffectMiscValue[j]); @@ -4801,17 +4801,17 @@ void ObjectMgr::LoadItemTexts() uint32 count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u item pages", count ); + sLog.outString(">> Loaded %u item pages", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); Field* fields; do @@ -4824,10 +4824,10 @@ void ObjectMgr::LoadItemTexts() ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u item texts", count ); + sLog.outString(">> Loaded %u item texts", count); } void ObjectMgr::LoadPageTexts() @@ -4835,7 +4835,7 @@ void ObjectMgr::LoadPageTexts() sPageTextStore.Free(); // for reload case sPageTextStore.Load(); - sLog.outString( ">> Loaded %u page texts", sPageTextStore.RecordCount ); + sLog.outString(">> Loaded %u page texts", sPageTextStore.RecordCount); sLog.outString(); for (uint32 i = 1; i < sPageTextStore.MaxEntry; ++i) @@ -4913,7 +4913,7 @@ void ObjectMgr::LoadPageTextLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu PageText locale strings", (unsigned long)mPageTextLocaleMap.size() ); + sLog.outString(">> Loaded %lu PageText locale strings", (unsigned long)mPageTextLocaleMap.size()); } struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader> @@ -4946,7 +4946,7 @@ void ObjectMgr::LoadInstanceTemplate() } } - sLog.outString( ">> Loaded %u Instance Template definitions", sInstanceTemplate.RecordCount ); + sLog.outString(">> Loaded %u Instance Template definitions", sInstanceTemplate.RecordCount); sLog.outString(); } @@ -4960,22 +4960,22 @@ GossipText const *ObjectMgr::GetGossipText(uint32 Text_ID) const void ObjectMgr::LoadGossipText() { - QueryResult_AutoPtr result = WorldDatabase.Query( "SELECT * FROM npc_text" ); + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT * FROM npc_text"); int count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u npc texts", count ); + sLog.outString(">> Loaded %u npc texts", count); return; } int cic; - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -5009,10 +5009,10 @@ void ObjectMgr::LoadGossipText() gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt32(); } } - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u npc texts", count ); + sLog.outString(">> Loaded %u npc texts", count); } void ObjectMgr::LoadNpcTextLocales() @@ -5077,7 +5077,7 @@ void ObjectMgr::LoadNpcTextLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu NpcText locale strings", (unsigned long)mNpcTextLocaleMap.size() ); + sLog.outString(">> Loaded %lu NpcText locale strings", (unsigned long)mNpcTextLocaleMap.size()); } //not very fast function but it is called only once a day, or on starting-up @@ -5090,7 +5090,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) CharacterDatabase.PExecute("DELETE FROM mail WHERE expire_time < '" UI64FMTD "' AND has_items = '0' AND itemTextId = 0", (uint64)basetime); // 0 1 2 3 4 5 6 7 8 9 QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" UI64FMTD "'", (uint64)basetime); - if ( !result ) + if (!result) { barGoLink bar(1); bar.step(); @@ -5101,10 +5101,10 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) //std::ostringstream delitems, delmails; //will be here for optimization //bool deletemail = false, deleteitem = false; - //delitems << "DELETE FROM item_instance WHERE guid IN ( "; - //delmails << "DELETE FROM mail WHERE id IN ( " + //delitems << "DELETE FROM item_instance WHERE guid IN ("; + //delmails << "DELETE FROM mail WHERE id IN (" - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); uint32 count = 0; Field *fields; @@ -5131,7 +5131,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) pl = GetPlayer((uint64)m->receiver); if (pl && pl->m_mailsLoaded) { //this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail - //his in mailbox and he has already listed his mails ) + //his in mailbox and he has already listed his mails) delete m; continue; } @@ -5179,28 +5179,28 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u mails", count ); + sLog.outString(">> Loaded %u mails", count); } void ObjectMgr::LoadQuestAreaTriggers() { mQuestAreaTriggerMap.clear(); // need for reload case - QueryResult_AutoPtr result = WorldDatabase.Query( "SELECT id,quest FROM areatrigger_involvedrelation" ); + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id,quest FROM areatrigger_involvedrelation"); uint32 count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u quest trigger points", count ); + sLog.outString(">> Loaded %u quest trigger points", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -5239,10 +5239,10 @@ void ObjectMgr::LoadQuestAreaTriggers() mQuestAreaTriggerMap[trigger_ID] = quest_ID; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u quest trigger points", count ); + sLog.outString(">> Loaded %u quest trigger points", count); } void ObjectMgr::LoadTavernAreaTriggers() @@ -5253,17 +5253,17 @@ void ObjectMgr::LoadTavernAreaTriggers() uint32 count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u tavern triggers", count ); + sLog.outString(">> Loaded %u tavern triggers", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -5282,10 +5282,10 @@ void ObjectMgr::LoadTavernAreaTriggers() } mTavernAreaTriggerSet.insert(Trigger_ID); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u tavern triggers", count ); + sLog.outString(">> Loaded %u tavern triggers", count); } void ObjectMgr::LoadAreaTriggerScripts() @@ -5295,17 +5295,17 @@ void ObjectMgr::LoadAreaTriggerScripts() uint32 count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u areatrigger scripts", count ); + sLog.outString(">> Loaded %u areatrigger scripts", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -5324,13 +5324,13 @@ void ObjectMgr::LoadAreaTriggerScripts() continue; } mAreaTriggerScripts[Trigger_ID] = GetScriptId(scriptName); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u areatrigger scripts", count ); + sLog.outString(">> Loaded %u areatrigger scripts", count); } -uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team ) +uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team) { bool found = false; float dist; @@ -5370,7 +5370,7 @@ uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, u return id; } -void ObjectMgr::GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost) +void ObjectMgr::GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uint32 &cost) { TaxiPathSetBySource::iterator src_i = sTaxiPathSetBySource.find(source); if (src_i==sTaxiPathSetBySource.end()) @@ -5394,7 +5394,7 @@ void ObjectMgr::GetTaxiPath( uint32 source, uint32 destination, uint32 &path, ui path = dest_i->second.ID; } -uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_alt_team /* = false */) +uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt_team /* = false */) { uint32 mount_entry = 0; uint32 mount_id = 0; @@ -5434,7 +5434,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_al return mount_id; } -void ObjectMgr::GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint32>& mapIds) +void ObjectMgr::GetTaxiPathNodes(uint32 path, Path &pathnodes, std::vector<uint32>& mapIds) { if (path >= sTaxiPathNodesByPath.size()) return; @@ -5454,7 +5454,7 @@ void ObjectMgr::GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint } } -void ObjectMgr::GetTransportPathNodes( uint32 path, TransportPath &pathnodes ) +void ObjectMgr::GetTransportPathNodes(uint32 path, TransportPath &pathnodes) { if (path >= sTaxiPathNodesByPath.size()) return; @@ -5482,17 +5482,17 @@ void ObjectMgr::LoadGraveyardZones() uint32 count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u graveyard-zone links", count ); + sLog.outString(">> Loaded %u graveyard-zone links", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -5533,10 +5533,10 @@ void ObjectMgr::LoadGraveyardZones() if (!AddGraveYardLink(safeLocId,zoneId,team,false)) sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u graveyard-zone links", count ); + sLog.outString(">> Loaded %u graveyard-zone links", count); } WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team) @@ -5684,7 +5684,7 @@ bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inD // add link to DB if (inDB) { - WorldDatabase.PExecuteLog("INSERT INTO game_graveyard_zone ( id,ghost_zone,faction) " + WorldDatabase.PExecuteLog("INSERT INTO game_graveyard_zone (id,ghost_zone,faction) " "VALUES ('%u', '%u','%u')",id,zoneId,team); } @@ -5746,19 +5746,19 @@ void ObjectMgr::LoadAreaTriggerTeleports() // 0 1 2 3 4 5 6 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, access_id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u area trigger teleport definitions", count ); + sLog.outString(">> Loaded %u area trigger teleport definitions", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -5801,10 +5801,10 @@ void ObjectMgr::LoadAreaTriggerTeleports() mAreaTriggers[Trigger_ID] = at; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u area trigger teleport definitions", count ); + sLog.outString(">> Loaded %u area trigger teleport definitions", count); } void ObjectMgr::LoadAccessRequirements() @@ -5815,19 +5815,19 @@ void ObjectMgr::LoadAccessRequirements() // 0 1 2 3 4 5 6 7 8 9 10 11 12 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, level_min, level_max, item, item2, heroic_key, heroic_key2, quest_done, quest_failed_text, heroic_quest_done, heroic_quest_failed_text, heroic_level_min, status FROM access_requirement"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u access requirement definitions", count ); + sLog.outString(">> Loaded %u access requirement definitions", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -5916,10 +5916,10 @@ void ObjectMgr::LoadAccessRequirements() mAccessRequirements[requiremt_ID] = ar; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u access requirement definitions", count ); + sLog.outString(">> Loaded %u access requirement definitions", count); } /* @@ -5960,16 +5960,16 @@ AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const void ObjectMgr::SetHighestGuids() { - QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT MAX(guid) FROM characters" ); - if ( result ) + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT MAX(guid) FROM characters"); + if (result) m_hiCharGuid = (*result)[0].GetUInt32()+1; - result = WorldDatabase.Query( "SELECT MAX(guid) FROM creature" ); - if ( result ) + result = WorldDatabase.Query("SELECT MAX(guid) FROM creature"); + if (result) m_hiCreatureGuid = (*result)[0].GetUInt32()+1; - result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" ); - if ( result ) + result = CharacterDatabase.Query("SELECT MAX(guid) FROM item_instance"); + if (result) m_hiItemGuid = (*result)[0].GetUInt32()+1; // Cleanup other tables from not existed guids (>=m_hiItemGuid) @@ -5978,24 +5978,24 @@ void ObjectMgr::SetHighestGuids() CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", m_hiItemGuid); CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", m_hiItemGuid); - result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject" ); - if ( result ) + result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject"); + if (result) m_hiGoGuid = (*result)[0].GetUInt32()+1; - result = CharacterDatabase.Query("SELECT MAX(id) FROM auctionhouse" ); - if ( result ) + result = CharacterDatabase.Query("SELECT MAX(id) FROM auctionhouse"); + if (result) m_auctionid = (*result)[0].GetUInt32()+1; - result = CharacterDatabase.Query( "SELECT MAX(id) FROM mail" ); - if ( result ) + result = CharacterDatabase.Query("SELECT MAX(id) FROM mail"); + if (result) m_mailid = (*result)[0].GetUInt32()+1; - result = CharacterDatabase.Query( "SELECT MAX(id) FROM item_text" ); - if ( result ) + result = CharacterDatabase.Query("SELECT MAX(id) FROM item_text"); + if (result) m_ItemTextId = (*result)[0].GetUInt32()+1; - result = CharacterDatabase.Query( "SELECT MAX(guid) FROM corpse" ); - if ( result ) + result = CharacterDatabase.Query("SELECT MAX(guid) FROM corpse"); + if (result) m_hiCorpseGuid = (*result)[0].GetUInt32()+1; result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team"); @@ -6006,7 +6006,7 @@ void ObjectMgr::SetHighestGuids() if (result) m_equipmentSetGuid = (*result)[0].GetUInt64()+1; - result = CharacterDatabase.Query( "SELECT MAX(guildid) FROM guild" ); + result = CharacterDatabase.Query("SELECT MAX(guildid) FROM guild"); if (result) m_guildId = (*result)[0].GetUInt32()+1; } @@ -6080,7 +6080,7 @@ uint32 ObjectMgr::CreateItemText(std::string text) CharacterDatabase.escape_string(text); //any Delete query needed, itemTextId is maximum of all ids std::ostringstream query; - query << "INSERT INTO item_text (id,text) VALUES ( '" << newItemTextId << "', '" << text << "')"; + query << "INSERT INTO item_text (id,text) VALUES ('" << newItemTextId << "', '" << text << "')"; CharacterDatabase.Execute(query.str().c_str()); //needs to be run this way, because mail body may be more than 1024 characters return newItemTextId; } @@ -6211,7 +6211,7 @@ void ObjectMgr::LoadGameObjectLocales() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %lu gameobject locale strings", (unsigned long)mGameObjectLocaleMap.size() ); + sLog.outString(">> Loaded %lu gameobject locale strings", (unsigned long)mGameObjectLocaleMap.size()); } struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader> @@ -6258,7 +6258,7 @@ inline void CheckGOSpellId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N) inline void CheckAndFixGOChairHeightId(GameObjectInfo const* goInfo,uint32 const& dataN,uint32 N) { - if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) ) + if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR)) return; sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", @@ -6446,7 +6446,7 @@ void ObjectMgr::LoadGameobjectInfo() } } - sLog.outString( ">> Loaded %u game object templates", sGOStorage.RecordCount ); + sLog.outString(">> Loaded %u game object templates", sGOStorage.RecordCount); sLog.outString(); } @@ -6481,7 +6481,7 @@ void ObjectMgr::LoadExplorationBaseXP() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u BaseXP definitions", count ); + sLog.outString(">> Loaded %u BaseXP definitions", count); } uint32 ObjectMgr::GetBaseXP(uint8 level) @@ -6508,7 +6508,7 @@ void ObjectMgr::LoadPetNames() bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u pet name parts", count ); + sLog.outString(">> Loaded %u pet name parts", count); return; } @@ -6531,7 +6531,7 @@ void ObjectMgr::LoadPetNames() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u pet name parts", count ); + sLog.outString(">> Loaded %u pet name parts", count); } void ObjectMgr::LoadPetNumber() @@ -6547,7 +6547,7 @@ void ObjectMgr::LoadPetNumber() bar.step(); sLog.outString(); - sLog.outString( ">> Loaded the max pet number: %d", m_hiPetNumber-1); + sLog.outString(">> Loaded the max pet number: %d", m_hiPetNumber-1); } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -6985,7 +6985,7 @@ void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t mCreatureRespawnTimes[MAKE_PAIR64(loguid,instance)] = t; WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE guid = '%u' AND instance = '%u'", loguid, instance); if (t) - WorldDatabase.PExecute("INSERT INTO creature_respawn VALUES ( '%u', '" UI64FMTD "', '%u' )", loguid, uint64(t), instance); + WorldDatabase.PExecute("INSERT INTO creature_respawn VALUES ('%u', '" UI64FMTD "', '%u')", loguid, uint64(t), instance); } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -7003,7 +7003,7 @@ void ObjectMgr::SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t) mGORespawnTimes[MAKE_PAIR64(loguid,instance)] = t; WorldDatabase.PExecute("DELETE FROM gameobject_respawn WHERE guid = '%u' AND instance = '%u'", loguid, instance); if (t) - WorldDatabase.PExecute("INSERT INTO gameobject_respawn VALUES ( '%u', '" UI64FMTD "', '%u' )", loguid, uint64(t), instance); + WorldDatabase.PExecute("INSERT INTO gameobject_respawn VALUES ('%u', '" UI64FMTD "', '%u')", loguid, uint64(t), instance); } void ObjectMgr::DeleteRespawnTimeForInstance(uint32 instance) @@ -7164,17 +7164,17 @@ void ObjectMgr::LoadReservedPlayersNames() uint32 count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u reserved player names", count ); + sLog.outString(">> Loaded %u reserved player names", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); Field* fields; do @@ -7186,7 +7186,7 @@ void ObjectMgr::LoadReservedPlayersNames() std::wstring wstr; if (!Utf8toWStr (name,wstr)) { - sLog.outError("Table `reserved_name` have invalid name: %s", name.c_str() ); + sLog.outError("Table `reserved_name` have invalid name: %s", name.c_str()); continue; } @@ -7194,13 +7194,13 @@ void ObjectMgr::LoadReservedPlayersNames() m_ReservedNames.insert(wstr); ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u reserved player names", count ); + sLog.outString(">> Loaded %u reserved player names", count); } -bool ObjectMgr::IsReservedName( const std::string& name ) const +bool ObjectMgr::IsReservedName(const std::string& name) const { std::wstring wstr; if (!Utf8toWStr (name,wstr)) @@ -7284,7 +7284,7 @@ bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bo return false; } -uint8 ObjectMgr::CheckPlayerName( const std::string& name, bool create ) +uint8 ObjectMgr::CheckPlayerName(const std::string& name, bool create) { std::wstring wname; if (!Utf8toWStr(name,wname)) @@ -7304,7 +7304,7 @@ uint8 ObjectMgr::CheckPlayerName( const std::string& name, bool create ) return CHAR_NAME_SUCCESS; } -bool ObjectMgr::IsValidCharterName( const std::string& name ) +bool ObjectMgr::IsValidCharterName(const std::string& name) { std::wstring wname; if (!Utf8toWStr(name,wname)) @@ -7322,7 +7322,7 @@ bool ObjectMgr::IsValidCharterName( const std::string& name ) return isValidString(wname,strictMask,true); } -PetNameInvalidReason ObjectMgr::CheckPetName( const std::string& name ) +PetNameInvalidReason ObjectMgr::CheckPetName(const std::string& name) { std::wstring wname; if (!Utf8toWStr(name,wname)) @@ -7342,7 +7342,7 @@ PetNameInvalidReason ObjectMgr::CheckPetName( const std::string& name ) return PET_NAME_SUCCESS; } -int ObjectMgr::GetIndexForLocale( LocaleConstant loc ) +int ObjectMgr::GetIndexForLocale(LocaleConstant loc) { if (loc==LOCALE_enUS) return -1; @@ -7362,7 +7362,7 @@ LocaleConstant ObjectMgr::GetLocaleForIndex(int i) return m_LocalForIndex[i]; } -int ObjectMgr::GetOrNewIndexForLocale( LocaleConstant loc ) +int ObjectMgr::GetOrNewIndexForLocale(LocaleConstant loc) { if (loc==LOCALE_enUS) return -1; @@ -7379,16 +7379,16 @@ void ObjectMgr::LoadGameObjectForQuests() { mGameObjectForQuestSet.clear(); // need for reload case - if ( !sGOStorage.MaxEntry ) + if (!sGOStorage.MaxEntry) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 GameObjects for quests" ); + sLog.outString(">> Loaded 0 GameObjects for quests"); return; } - barGoLink bar( sGOStorage.MaxEntry - 1 ); + barGoLink bar(sGOStorage.MaxEntry - 1); uint32 count = 0; // collect GO entries for GO that must activated @@ -7429,7 +7429,7 @@ void ObjectMgr::LoadGameObjectForQuests() } sLog.outString(); - sLog.outString( ">> Loaded %u GameObjects for quests", count ); + sLog.outString(">> Loaded %u GameObjects for quests", count); } bool ObjectMgr::LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value) @@ -7540,9 +7540,9 @@ bool ObjectMgr::LoadTrinityStrings(DatabaseType& db, char const* table, int32 mi sLog.outString(); if (min_value == MIN_TRINITY_STRING_ID) - sLog.outString( ">> Loaded %u Trinity strings from table %s", count,table); + sLog.outString(">> Loaded %u Trinity strings from table %s", count,table); else - sLog.outString( ">> Loaded %u string templates from %s", count,table); + sLog.outString(">> Loaded %u string templates from %s", count,table); return true; } @@ -7575,17 +7575,17 @@ void ObjectMgr::LoadSpellDisabledEntrys() uint32 total_count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u disabled spells", total_count ); + sLog.outString(">> Loaded %u disabled spells", total_count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); Field* fields; do @@ -7606,10 +7606,10 @@ void ObjectMgr::LoadSpellDisabledEntrys() if (disable_mask & SPELL_DISABLE_PET) m_DisabledPetSpells.insert(spellid); ++total_count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u disabled spells from `spell_disabled`", total_count); + sLog.outString(">> Loaded %u disabled spells from `spell_disabled`", total_count); } void ObjectMgr::LoadFishingBaseSkillLevel() @@ -7619,9 +7619,9 @@ void ObjectMgr::LoadFishingBaseSkillLevel() uint32 count = 0; QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,skill FROM skill_fishing_base_level"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); @@ -7630,7 +7630,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -7653,12 +7653,12 @@ void ObjectMgr::LoadFishingBaseSkillLevel() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u areas for fishing base skill level", count ); + sLog.outString(">> Loaded %u areas for fishing base skill level", count); } // Searches for the same condition already in Conditions store // Returns Id if found, else adds it to Conditions and returns Id -uint16 ObjectMgr::GetConditionId( ConditionType condition, uint32 value1, uint32 value2 ) +uint16 ObjectMgr::GetConditionId(ConditionType condition, uint32 value1, uint32 value2) { PlayerCondition lc = PlayerCondition(condition, value1, value2); for (uint16 i=0; i < mConditions.size(); ++i) @@ -7678,7 +7678,7 @@ uint16 ObjectMgr::GetConditionId( ConditionType condition, uint32 value1, uint32 return mConditions.size() - 1; } -bool ObjectMgr::CheckDeclinedNames( std::wstring mainpart, DeclinedName const& names ) +bool ObjectMgr::CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names) { for (uint8 i =0; i < MAX_DECLINED_NAME_CASES; ++i) { @@ -7703,7 +7703,7 @@ uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id) // Checks if player meets the condition bool PlayerCondition::Meets(Player const * player) const { - if ( !player ) + if (!player) return false; // player not present, return false switch (condition) @@ -7774,9 +7774,9 @@ bool PlayerCondition::Meets(Player const * player) const // Verification of condition values validity bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 value2) { - if ( condition >= MAX_CONDITION) // Wrong condition type + if (condition >= MAX_CONDITION) // Wrong condition type { - sLog.outErrorDb("Condition has bad type of %u, skipped ", condition ); + sLog.outErrorDb("Condition has bad type of %u, skipped ", condition); return false; } @@ -7858,7 +7858,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val sLog.outErrorDb("Skill condition specifies non-existing skill (%u), skipped", value1); return false; } - if (value2 < 1 || value2 > sWorld.GetConfigMaxSkillValue() ) + if (value2 < 1 || value2 > sWorld.GetConfigMaxSkillValue()) { sLog.outErrorDb("Skill condition specifies invalid skill value (%u), skipped", value2); return false; @@ -7958,9 +7958,9 @@ void ObjectMgr::LoadGameTele() uint32 count = 0; QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); @@ -7969,7 +7969,7 @@ void ObjectMgr::LoadGameTele() return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -8000,7 +8000,7 @@ void ObjectMgr::LoadGameTele() continue; } - wstrToLower( gt.wnameLow ); + wstrToLower(gt.wnameLow); m_GameTeleMap[id] = gt; @@ -8009,7 +8009,7 @@ void ObjectMgr::LoadGameTele() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u GameTeleports", count ); + sLog.outString(">> Loaded %u GameTeleports", count); } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -8020,7 +8020,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const return false; // converting string that we try to find to lower case - wstrToLower( wname ); + wstrToLower(wname); // Alternative first GameTele what contains wnameLow as substring in case no GameTele location found const GameTele* alt = NULL; @@ -8049,7 +8049,7 @@ bool ObjectMgr::AddGameTele(GameTele& tele) if (!Utf8toWStr(tele.name,tele.wnameLow)) return false; - wstrToLower( tele.wnameLow ); + wstrToLower(tele.wnameLow); m_GameTeleMap[new_id] = tele; @@ -8065,7 +8065,7 @@ bool ObjectMgr::DeleteGameTele(const std::string& name) return false; // converting string that we try to find to lower case - wstrToLower( wname ); + wstrToLower(wname); for (GameTeleMap::iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr) { @@ -8087,9 +8087,9 @@ void ObjectMgr::LoadMailLevelRewards() uint32 count = 0; QueryResult_AutoPtr result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); @@ -8098,7 +8098,7 @@ void ObjectMgr::LoadMailLevelRewards() return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -8142,7 +8142,7 @@ void ObjectMgr::LoadMailLevelRewards() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u level dependent mail rewards,", count ); + sLog.outString(">> Loaded %u level dependent mail rewards,", count); } bool ObjectMgr::AddSpellToTrainer(int32 entry, int32 spell, Field *fields, std::set<uint32> *skip_trainers, std::set<uint32> *talentIds) @@ -8168,7 +8168,7 @@ bool ObjectMgr::AddSpellToTrainer(int32 entry, int32 spell, Field *fields, std:: SpellEntry const *spellinfo = sSpellStore.LookupEntry(spell); if (!spellinfo) { - sLog.outErrorDb("Table `npc_trainer` for Trainer (Entry: %u ) has non existing spell %u, ignore", entry,spell); + sLog.outErrorDb("Table `npc_trainer` for Trainer (Entry: %u) has non existing spell %u, ignore", entry,spell); return false; } @@ -8236,15 +8236,15 @@ bool ObjectMgr::AddSpellToTrainer(int32 entry, int32 spell, Field *fields, std:: int ObjectMgr::LoadReferenceTrainer(int32 trainer, int32 spell, std::set<uint32> *skip_trainers, std::set<uint32> *talentIds) { QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT entry, spell,spellcost,reqskill,reqskillvalue,reqlevel FROM npc_trainer WHERE entry='%d'", spell); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); return 0; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); uint32 count = 0; do @@ -8254,9 +8254,9 @@ int ObjectMgr::LoadReferenceTrainer(int32 trainer, int32 spell, std::set<uint32> Field* fields = result->Fetch(); int32 spell = fields[1].GetInt32(); - if ( spell < 0 ) + if (spell < 0) count += this->LoadReferenceTrainer(trainer, -spell, skip_trainers, talentIds); - else if ( this->AddSpellToTrainer(trainer, spell, fields, skip_trainers, talentIds) ) + else if (this->AddSpellToTrainer(trainer, spell, fields, skip_trainers, talentIds)) ++count; } while (result->NextRow()); @@ -8274,9 +8274,9 @@ void ObjectMgr::LoadTrainerSpell() QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, spell,spellcost,reqskill,reqskillvalue,reqlevel FROM npc_trainer"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); @@ -8285,7 +8285,7 @@ void ObjectMgr::LoadTrainerSpell() return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); std::set<uint32> talentIds; @@ -8298,30 +8298,30 @@ void ObjectMgr::LoadTrainerSpell() uint32 entry = fields[0].GetUInt32(); int32 spell = fields[1].GetInt32(); - if ( spell < 0 ) + if (spell < 0) count += this->LoadReferenceTrainer(entry, -spell, &skip_trainers, &talentIds); - else if ( this->AddSpellToTrainer(entry, spell, fields, &skip_trainers, &talentIds) ) + else if (this->AddSpellToTrainer(entry, spell, fields, &skip_trainers, &talentIds)) ++count; } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %d Trainers", count ); + sLog.outString(">> Loaded %d Trainers", count); } int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors) { // find all items from the reference vendor QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor WHERE entry='%d'", item); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); return 0; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); uint32 count = 0; do @@ -8333,7 +8333,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s int32 item_id = fields[1].GetInt32(); // if item is a negative, its a reference - if ( item_id < 0 ) + if (item_id < 0) count += LoadReferenceVendor(vendor, -item_id, skip_vendors); else { @@ -8365,9 +8365,9 @@ void ObjectMgr::LoadVendors() std::set<uint32> skip_vendors; QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); @@ -8376,7 +8376,7 @@ void ObjectMgr::LoadVendors() return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); uint32 count = 0; do @@ -8388,7 +8388,7 @@ void ObjectMgr::LoadVendors() int32 item_id = fields[1].GetInt32(); // if item is a negative, its a reference - if ( item_id < 0 ) + if (item_id < 0) count += LoadReferenceVendor(entry, -item_id, &skip_vendors); else { @@ -8408,7 +8408,7 @@ void ObjectMgr::LoadVendors() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %d Vendors ", count ); + sLog.outString(">> Loaded %d Vendors ", count); } void ObjectMgr::LoadNpcTextId() @@ -8417,9 +8417,9 @@ void ObjectMgr::LoadNpcTextId() m_mCacheNpcTextIdMap.clear(); QueryResult_AutoPtr result = WorldDatabase.Query("SELECT npc_guid, textid FROM npc_gossip"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); @@ -8428,7 +8428,7 @@ void ObjectMgr::LoadNpcTextId() return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); uint32 count = 0; uint32 guid,textid; @@ -8458,7 +8458,7 @@ void ObjectMgr::LoadNpcTextId() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %d NpcTextId ", count ); + sLog.outString(">> Loaded %d NpcTextId ", count); } void ObjectMgr::LoadGossipMenu() @@ -8479,7 +8479,7 @@ void ObjectMgr::LoadGossipMenu() return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); uint32 count = 0; @@ -8529,7 +8529,7 @@ void ObjectMgr::LoadGossipMenu() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u gossip_menu entries", count); + sLog.outString(">> Loaded %u gossip_menu entries", count); } void ObjectMgr::LoadGossipMenuItems() @@ -8664,7 +8664,7 @@ void ObjectMgr::LoadGossipMenuItems() sLog.outString(">> Loaded %u gossip_menu_option entries", count); } -void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb) +void ObjectMgr::AddVendorItem(uint32 entry,uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb) { VendorItemData& vList = m_mCacheVendorItemMap[entry]; vList.AddItem(item,maxcount,incrtime,extendedcost); @@ -8672,7 +8672,7 @@ void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, int32 maxcount, uint32 if (savetodb) WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost); } -bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item, bool savetodb) +bool ObjectMgr::RemoveVendorItem(uint32 entry,uint32 item, bool savetodb) { CacheVendorItemMap::iterator iter = m_mCacheVendorItemMap.find(entry); if (iter == m_mCacheVendorItemMap.end()) @@ -8686,7 +8686,7 @@ bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item, bool savetodb) return true; } -bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag ) const +bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const { CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry); if (!cInfo) @@ -8736,7 +8736,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, int32 ma if (pl) ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount); else - sLog.outErrorDb( "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); + sLog.outErrorDb("Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); return false; } else if (maxcount==0 && incrtime > 0) @@ -8744,7 +8744,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, int32 ma if (pl) ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0"); else - sLog.outErrorDb( "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); + sLog.outErrorDb("Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); return false; } @@ -8757,7 +8757,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, int32 ma if (pl) ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST,item_id); else - sLog.outErrorDb( "Table `(game_event_)npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry); + sLog.outErrorDb("Table `(game_event_)npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry); return false; } @@ -8766,7 +8766,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, int32 ma if (pl) ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS); else - sLog.outErrorDb( "Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry); + sLog.outErrorDb("Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry); return false; } @@ -8811,7 +8811,7 @@ void ObjectMgr::LoadScriptNames() std::sort(m_scriptNames.begin(), m_scriptNames.end()); sLog.outString(); - sLog.outString( ">> Loaded %d Script Names", count ); + sLog.outString(">> Loaded %d Script Names", count); } uint32 ObjectMgr::GetScriptId(const char *name) @@ -8836,7 +8836,7 @@ void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids) case SCRIPT_COMMAND_TALK: { if (!GetTrinityStringLocale (itrM->second.dataint)) - sLog.outErrorDb( "Table `db_script_string` not has string id %u used db script (ID: %u)", itrM->second.dataint, itrMM->first); + sLog.outErrorDb("Table `db_script_string` not has string id %u used db script (ID: %u)", itrM->second.dataint, itrMM->first); if (ids.find(itrM->second.dataint) != ids.end()) ids.erase(itrM->second.dataint); @@ -8865,7 +8865,7 @@ void ObjectMgr::LoadDbScriptStrings() CheckScripts(sWaypointScripts,ids); for (std::set<int32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) - sLog.outErrorDb( "Table `db_script_string` has unused string id %u", *itr); + sLog.outErrorDb("Table `db_script_string` has unused string id %u", *itr); } // Functions for scripting access @@ -8912,15 +8912,15 @@ void ObjectMgr::LoadTransportEvents() QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, waypoint_id, event_id FROM transport_events"); - if ( !result ) + if (!result) { - barGoLink bar1( 1 ); + barGoLink bar1(1); bar1.step(); - sLog.outString( "\n>> Transport events table is empty \n" ); + sLog.outString("\n>> Transport events table is empty \n"); return; } - barGoLink bar1( result->GetRowCount() ); + barGoLink bar1(result->GetRowCount()); do { @@ -8938,7 +8938,7 @@ void ObjectMgr::LoadTransportEvents() } while (result->NextRow()); - sLog.outString( "\n>> Loaded %u transport events \n", result->GetRowCount() ); + sLog.outString("\n>> Loaded %u transport events \n", result->GetRowCount()); } CreatureInfo const* GetCreatureTemplateStore(uint32 entry) @@ -8966,14 +8966,14 @@ void ObjectMgr::LoadGMTickets() m_GMTicketList.clear(); m_GMticketid = 0; - QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed, assignedto, comment FROM gm_tickets" ); + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed, assignedto, comment FROM gm_tickets"); if (!result) { barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString(">> GM Tickets table is empty, no tickets were loaded." ); + sLog.outString(">> GM Tickets table is empty, no tickets were loaded."); return; } @@ -9002,7 +9002,7 @@ void ObjectMgr::LoadGMTickets() m_GMTicketList.push_back(ticket); - } while ( result->NextRow() ); + } while (result->NextRow()); result = CharacterDatabase.PQuery("SELECT MAX(guid) from gm_tickets"); @@ -9069,13 +9069,13 @@ void ObjectMgr::RemoveGMTicket(GM_Ticket *ticket, int64 source, bool permanently void ObjectMgr::RemoveGMTicket(uint64 ticketGuid, int64 source, bool permanently) { GM_Ticket *ticket = GetGMTicket(ticketGuid); - assert( ticket ); + assert(ticket); RemoveGMTicket(ticket, source, permanently); } CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unitClass) { - CreatureBaseStatsMap::const_iterator it = m_creatureBaseStatsMap.find( MAKE_PAIR16(level,unitClass) ); + CreatureBaseStatsMap::const_iterator it = m_creatureBaseStatsMap.find(MAKE_PAIR16(level,unitClass)); if (it != m_creatureBaseStatsMap.end()) return &(it->second); @@ -9159,11 +9159,11 @@ void ObjectMgr::LoadCreatureClassLevelStats() for (uint16 lvl = info->minlevel; lvl <= info->maxlevel; ++lvl) { - if (m_creatureBaseStatsMap.find( MAKE_PAIR16(lvl, info->unit_class) ) == m_creatureBaseStatsMap.end()) + if (m_creatureBaseStatsMap.find(MAKE_PAIR16(lvl, info->unit_class)) == m_creatureBaseStatsMap.end()) sLog.outErrorDb("Missing base stats for creature class %u level %u", info->unit_class, lvl); } } sLog.outString(); - sLog.outString( ">> Loaded %u creature base stats.", counter); + sLog.outString(">> Loaded %u creature base stats.", counter); } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 272c7a1753d..01fb9351404 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -173,7 +173,7 @@ typedef std::pair<ItemRequiredTargetMap::const_iterator, ItemRequiredTargetMap:: struct PetLevelInfo { - PetLevelInfo() : health(0), mana(0) { for (uint8 i=0; i < MAX_STATS; ++i ) stats[i] = 0; } + PetLevelInfo() : health(0), mana(0) { for (uint8 i=0; i < MAX_STATS; ++i) stats[i] = 0; } uint16 stats[MAX_STATS]; uint16 health; @@ -374,7 +374,7 @@ typedef std::list<GM_Ticket*> GmTicketList; SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial); #define MAX_PLAYER_NAME 12 // max allowed by client name length -#define MAX_INTERNAL_PLAYER_NAME 15 // max server internal player name length ( > MAX_PLAYER_NAME for support declined names ) +#define MAX_INTERNAL_PLAYER_NAME 15 // max server internal player name length (> MAX_PLAYER_NAME for support declined names) #define MAX_PET_NAME 12 // max allowed by client name length #define MAX_CHARTER_NAME 24 // max allowed by client name length @@ -435,8 +435,8 @@ class ObjectMgr void AddGameobjectInfo(GameObjectInfo *goinfo); Group * GetGroupByLeader(const uint64 &guid) const; - void AddGroup(Group* group) { mGroupSet.insert( group ); } - void RemoveGroup(Group* group) { mGroupSet.erase( group ); } + void AddGroup(Group* group) { mGroupSet.insert(group); } + void RemoveGroup(Group* group) { mGroupSet.erase(group); } Guild* GetGuildByLeader(uint64 const&guid) const; Guild* GetGuildById(uint32 GuildId) const; @@ -453,17 +453,17 @@ class ObjectMgr ArenaTeamMap::iterator GetArenaTeamMapBegin() { return mArenaTeamMap.begin(); } ArenaTeamMap::iterator GetArenaTeamMapEnd() { return mArenaTeamMap.end(); } - static CreatureInfo const *GetCreatureTemplate( uint32 id ); - CreatureModelInfo const *GetCreatureModelInfo( uint32 modelid ); + static CreatureInfo const *GetCreatureTemplate(uint32 id); + CreatureModelInfo const *GetCreatureModelInfo(uint32 modelid); CreatureModelInfo const* GetCreatureModelRandomGender(uint32 display_id); uint32 ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const CreatureData *data = NULL); - EquipmentInfo const *GetEquipmentInfo( uint32 entry ); - static CreatureDataAddon const *GetCreatureAddon( uint32 lowguid ) + EquipmentInfo const *GetEquipmentInfo(uint32 entry); + static CreatureDataAddon const *GetCreatureAddon(uint32 lowguid) { return sCreatureDataAddonStorage.LookupEntry<CreatureDataAddon>(lowguid); } - static CreatureDataAddon const *GetCreatureTemplateAddon( uint32 entry ) + static CreatureDataAddon const *GetCreatureTemplateAddon(uint32 entry) { return sCreatureInfoAddonStorage.LookupEntry<CreatureDataAddon>(entry); } @@ -500,11 +500,11 @@ class ObjectMgr uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const; uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const; - uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team ); - void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost); - uint32 GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_alt_team = false); - void GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint32>& mapIds ); - void GetTransportPathNodes( uint32 path, TransportPath &pathnodes ); + uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team); + void GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uint32 &cost); + uint32 GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt_team = false); + void GetTaxiPathNodes(uint32 path, Path &pathnodes, std::vector<uint32>& mapIds); + void GetTransportPathNodes(uint32 path, TransportPath &pathnodes); Quest const* GetQuestTemplate(uint32 quest_id) const { @@ -540,16 +540,16 @@ class ObjectMgr AreaTrigger const* GetAreaTrigger(uint32 trigger) const { - AreaTriggerMap::const_iterator itr = mAreaTriggers.find( trigger ); - if ( itr != mAreaTriggers.end( ) ) + AreaTriggerMap::const_iterator itr = mAreaTriggers.find(trigger); + if (itr != mAreaTriggers.end()) return &itr->second; return NULL; } AccessRequirement const* GetAccessRequirement(uint32 requirement) const { - AccessRequirementMap::const_iterator itr = mAccessRequirements.find( requirement ); - if ( itr != mAccessRequirements.end( ) ) + AccessRequirementMap::const_iterator itr = mAccessRequirements.find(requirement); + if (itr != mAccessRequirements.end()) return &itr->second; return NULL; } @@ -721,10 +721,10 @@ class ObjectMgr uint32 CreateItemText(std::string text); void AddItemText(uint32 itemTextId, std::string text) { mItemTexts[itemTextId] = text; } - std::string GetItemText( uint32 id ) + std::string GetItemText(uint32 id) { - ItemTextMap::const_iterator itr = mItemTexts.find( id ); - if ( itr != mItemTexts.end() ) + ItemTextMap::const_iterator itr = mItemTexts.find(id); + if (itr != mItemTexts.end()) return itr->second; else return "There is no info for this item"; @@ -875,9 +875,9 @@ class ObjectMgr bool IsReservedName(const std::string& name) const; // name with valid structure and symbols - static uint8 CheckPlayerName( const std::string& name, bool create = false ); - static PetNameInvalidReason CheckPetName( const std::string& name ); - static bool IsValidCharterName( const std::string& name ); + static uint8 CheckPlayerName(const std::string& name, bool create = false); + static PetNameInvalidReason CheckPetName(const std::string& name); + static bool IsValidCharterName(const std::string& name); static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names); @@ -937,7 +937,7 @@ class ObjectMgr } void AddVendorItem(uint32 entry,uint32 item, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); // for event - bool IsVendorItemValid( uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0 ) const; + bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const; void LoadScriptNames(); ScriptNameMap &GetScriptNames() { return m_scriptNames; } diff --git a/src/game/OutdoorPvP.cpp b/src/game/OutdoorPvP.cpp index 7f2566f518a..3fe3656226f 100644 --- a/src/game/OutdoorPvP.cpp +++ b/src/game/OutdoorPvP.cpp @@ -442,7 +442,7 @@ void OutdoorPvP::HandleKill(Player *killer, Unit * killed) // creature kills must be notified, even if not inside objective / not outdoor pvp active // player kills only count if active and inside objective - if (( pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy) ) || killed->GetTypeId() == TYPEID_UNIT) + if ((pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy)) || killed->GetTypeId() == TYPEID_UNIT) { HandleKillImpl(pGroupGuy, killed); } @@ -451,7 +451,7 @@ void OutdoorPvP::HandleKill(Player *killer, Unit * killed) else { // creature kills must be notified, even if not inside objective / not outdoor pvp active - if (killer && (( killer->IsOutdoorPvPActive() && IsInsideObjective(killer) ) || killed->GetTypeId() == TYPEID_UNIT)) + if (killer && ((killer->IsOutdoorPvPActive() && IsInsideObjective(killer)) || killed->GetTypeId() == TYPEID_UNIT)) { HandleKillImpl(killer, killed); } diff --git a/src/game/OutdoorPvPEP.cpp b/src/game/OutdoorPvPEP.cpp index 1ffa05c5a2c..5691a3ce8be 100644 --- a/src/game/OutdoorPvPEP.cpp +++ b/src/game/OutdoorPvPEP.cpp @@ -40,12 +40,12 @@ void OPvPCapturePointEP_EWT::ChangeState() if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out! { // if changing from controlling alliance to horde or vice versa - if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) + if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; } - else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) + else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; @@ -112,7 +112,7 @@ void OPvPCapturePointEP_EWT::SendChangePhase() // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes it resets :S SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct); @@ -145,7 +145,7 @@ bool OPvPCapturePointEP_EWT::HandlePlayerEnter(Player *plr) if (OPvPCapturePoint::HandlePlayerEnter(plr)) { plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct); return true; @@ -191,12 +191,12 @@ void OPvPCapturePointEP_NPT::ChangeState() if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out! { // if changing from controlling alliance to horde or vice versa - if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) + if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; } - else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) + else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; @@ -265,7 +265,7 @@ void OPvPCapturePointEP_NPT::SendChangePhase() // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes it resets :S SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct); @@ -298,7 +298,7 @@ bool OPvPCapturePointEP_NPT::HandlePlayerEnter(Player *plr) if (OPvPCapturePoint::HandlePlayerEnter(plr)) { plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct); return true; @@ -338,12 +338,12 @@ void OPvPCapturePointEP_CGT::ChangeState() if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out! { // if changing from controlling alliance to horde or vice versa - if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) + if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; } - else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) + else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; @@ -410,7 +410,7 @@ void OPvPCapturePointEP_CGT::SendChangePhase() // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes it resets :S SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct); @@ -443,7 +443,7 @@ bool OPvPCapturePointEP_CGT::HandlePlayerEnter(Player *plr) if (OPvPCapturePoint::HandlePlayerEnter(plr)) { plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct); return true; @@ -480,12 +480,12 @@ void OPvPCapturePointEP_PWT::ChangeState() if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out! { // if changing from controlling alliance to horde or vice versa - if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) + if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; } - else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) + else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; @@ -554,7 +554,7 @@ void OPvPCapturePointEP_PWT::SendChangePhase() // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes it resets :S SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct); @@ -587,7 +587,7 @@ bool OPvPCapturePointEP_PWT::HandlePlayerEnter(Player *plr) if (OPvPCapturePoint::HandlePlayerEnter(plr)) { plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct); return true; diff --git a/src/game/OutdoorPvPHP.cpp b/src/game/OutdoorPvPHP.cpp index a3bb1b8f5f8..b15c85a5936 100644 --- a/src/game/OutdoorPvPHP.cpp +++ b/src/game/OutdoorPvPHP.cpp @@ -268,7 +268,7 @@ void OPvPCapturePointHP::SendChangePhase() { SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_neutralValuePct); // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1); @@ -306,7 +306,7 @@ bool OPvPCapturePointHP::HandlePlayerEnter(Player *plr) if (OPvPCapturePoint::HandlePlayerEnter(plr)) { plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase); plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_neutralValuePct); return true; diff --git a/src/game/OutdoorPvPMgr.cpp b/src/game/OutdoorPvPMgr.cpp index 91b6c853f65..4a0baf49a04 100644 --- a/src/game/OutdoorPvPMgr.cpp +++ b/src/game/OutdoorPvPMgr.cpp @@ -27,7 +27,7 @@ #include "Player.h" #include "Policies/SingletonImp.h" -INSTANTIATE_SINGLETON_1( OutdoorPvPMgr ); +INSTANTIATE_SINGLETON_1(OutdoorPvPMgr); OutdoorPvPMgr::OutdoorPvPMgr() { diff --git a/src/game/OutdoorPvPNA.cpp b/src/game/OutdoorPvPNA.cpp index 7f976479b3c..3dedb4c0891 100644 --- a/src/game/OutdoorPvPNA.cpp +++ b/src/game/OutdoorPvPNA.cpp @@ -113,14 +113,14 @@ void OPvPCapturePointNA::SpawnGOsForTeam(uint32 team) return; for (int i = 0; i < NA_CONTROL_GO_NUM; ++i) { - if ( i == NA_ROOST_S || + if (i == NA_ROOST_S || i == NA_ROOST_W || i == NA_ROOST_N || i == NA_ROOST_E || i == NA_BOMB_WAGON_S || i == NA_BOMB_WAGON_W || i == NA_BOMB_WAGON_N || - i == NA_BOMB_WAGON_E ) + i == NA_BOMB_WAGON_E) continue; // roosts and bomb wagons are spawned when someone uses the matching destroyed roost AddObject(i,gos[i].entry,gos[i].map,gos[i].x,gos[i].y,gos[i].z,gos[i].o,gos[i].rot0,gos[i].rot1,gos[i].rot2,gos[i].rot3); } @@ -188,7 +188,7 @@ bool OPvPCapturePointNA::HandlePlayerEnter(Player *plr) if (OPvPCapturePoint::HandlePlayerEnter(plr)) { plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase); plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_neutralValuePct); return true; @@ -388,16 +388,16 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player * plr, uint32 spellId, GameObj int32 count = 10; uint32 itemid = 24538; // bomb id count - uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount ); - if ( msg != EQUIP_ERR_OK ) // convert to possible store amount + uint8 msg = plr->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) // convert to possible store amount count -= noSpaceForCount; - if ( count == 0 || dest.empty()) // can't add any + if (count == 0 || dest.empty()) // can't add any { return true; } - Item* item = plr->StoreNewItem( dest, itemid, true); + Item* item = plr->StoreNewItem(dest, itemid, true); if (count > 0 && item) { @@ -618,18 +618,18 @@ void OPvPCapturePointNA::SendChangePhase() // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase); SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_neutralValuePct); } void OPvPCapturePointNA::UpdateHalaaWorldState() { - m_PvP->SendUpdateWorldState( NA_MAP_HALAA_NEUTRAL ,uint32(bool(m_HalaaState & HALAA_N))); - m_PvP->SendUpdateWorldState( NA_MAP_HALAA_NEU_A ,uint32(bool(m_HalaaState & HALAA_N_A))); - m_PvP->SendUpdateWorldState( NA_MAP_HALAA_NEU_H ,uint32(bool(m_HalaaState & HALAA_N_H))); - m_PvP->SendUpdateWorldState( NA_MAP_HALAA_HORDE ,uint32(bool(m_HalaaState & HALAA_H))); - m_PvP->SendUpdateWorldState( NA_MAP_HALAA_ALLIANCE ,uint32(bool(m_HalaaState & HALAA_A))); + m_PvP->SendUpdateWorldState(NA_MAP_HALAA_NEUTRAL ,uint32(bool(m_HalaaState & HALAA_N))); + m_PvP->SendUpdateWorldState(NA_MAP_HALAA_NEU_A ,uint32(bool(m_HalaaState & HALAA_N_A))); + m_PvP->SendUpdateWorldState(NA_MAP_HALAA_NEU_H ,uint32(bool(m_HalaaState & HALAA_N_H))); + m_PvP->SendUpdateWorldState(NA_MAP_HALAA_HORDE ,uint32(bool(m_HalaaState & HALAA_H))); + m_PvP->SendUpdateWorldState(NA_MAP_HALAA_ALLIANCE ,uint32(bool(m_HalaaState & HALAA_A))); } void OPvPCapturePointNA::UpdateWyvernRoostWorldState(uint32 roost) diff --git a/src/game/OutdoorPvPTF.cpp b/src/game/OutdoorPvPTF.cpp index 4c0e6122e14..ee9d6a4a651 100644 --- a/src/game/OutdoorPvPTF.cpp +++ b/src/game/OutdoorPvPTF.cpp @@ -104,7 +104,7 @@ bool OPvPCapturePointTF::HandlePlayerEnter(Player *plr) if (OPvPCapturePoint::HandlePlayerEnter(plr)) { plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase); plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_neutralValuePct); return true; @@ -245,14 +245,14 @@ bool OPvPCapturePointTF::Update(uint32 diff) void OPvPCapturePointTF::ChangeState() { // if changing from controlling alliance to horde - if ( m_OldState == OBJECTIVESTATE_ALLIANCE ) + if (m_OldState == OBJECTIVESTATE_ALLIANCE) { if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled) ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled--; sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_A)); } // if changing from controlling horde to alliance - else if ( m_OldState == OBJECTIVESTATE_HORDE ) + else if (m_OldState == OBJECTIVESTATE_HORDE) { if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled) ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled--; @@ -300,7 +300,7 @@ void OPvPCapturePointTF::SendChangePhase() // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes it resets :S SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_neutralValuePct); diff --git a/src/game/OutdoorPvPZM.cpp b/src/game/OutdoorPvPZM.cpp index ad447b1b2cb..34c43944265 100644 --- a/src/game/OutdoorPvPZM.cpp +++ b/src/game/OutdoorPvPZM.cpp @@ -57,7 +57,7 @@ bool OPvPCapturePointZM_Beacon::HandlePlayerEnter(Player *plr) if (OPvPCapturePoint::HandlePlayerEnter(plr)) { plr->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1); - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); plr->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase); plr->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_neutralValuePct); return true; @@ -74,14 +74,14 @@ void OPvPCapturePointZM_Beacon::HandlePlayerLeave(Player *plr) void OPvPCapturePointZM_Beacon::ChangeState() { // if changing from controlling alliance to horde - if ( m_OldState == OBJECTIVESTATE_ALLIANCE ) + if (m_OldState == OBJECTIVESTATE_ALLIANCE) { if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled) ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled--; sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconLooseA[m_TowerType])); } // if changing from controlling horde to alliance - else if ( m_OldState == OBJECTIVESTATE_HORDE ) + else if (m_OldState == OBJECTIVESTATE_HORDE) { if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled) ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled--; @@ -119,7 +119,7 @@ void OPvPCapturePointZM_Beacon::SendChangePhase() // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1); // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil(( m_value + m_maxValue) / ( 2 * m_maxValue ) * 100.0f); + uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase); SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_neutralValuePct); } diff --git a/src/game/Path.h b/src/game/Path.h index 591c0d2eda2..9ec079f3c9c 100644 --- a/src/game/Path.h +++ b/src/game/Path.h @@ -34,7 +34,7 @@ class Path void SetLength(const unsigned int sz) { - i_nodes.resize( sz ); + i_nodes.resize(sz); } unsigned int Size() const { return i_nodes.size(); } @@ -51,7 +51,7 @@ class Path xd = i_nodes[ idx ].x - i_nodes[ idx-1 ].x; yd = i_nodes[ idx ].y - i_nodes[ idx-1 ].y; zd = i_nodes[ idx ].z - i_nodes[ idx-1 ].z; - len += sqrtf( xd*xd + yd*yd + zd*zd ); + len += sqrtf(xd*xd + yd*yd + zd*zd); } return len; } @@ -64,7 +64,7 @@ class Path xd = i_nodes[ idx ].x - i_nodes[ idx-1 ].x; yd = i_nodes[ idx ].y - i_nodes[ idx-1 ].y; zd = i_nodes[ idx ].z - i_nodes[ idx-1 ].z; - len += sqrtf( xd*xd + yd*yd + zd*zd ); + len += sqrtf(xd*xd + yd*yd + zd*zd); } if (curnode > 0) @@ -72,7 +72,7 @@ class Path xd = x - i_nodes[curnode-1].x; yd = y - i_nodes[curnode-1].y; zd = z - i_nodes[curnode-1].z; - len += sqrtf( xd*xd + yd*yd + zd*zd ); + len += sqrtf(xd*xd + yd*yd + zd*zd); } return len; diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index f1984eb93e7..8ab29861760 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -102,7 +102,7 @@ void Pet::RemoveFromWorld() } } -bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool current ) +bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool current) { m_loading = true; @@ -119,7 +119,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool // current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType " "FROM character_pet WHERE owner = '%u' AND slot = '%u'", - ownerid, PET_SAVE_AS_CURRENT ); + ownerid, PET_SAVE_AS_CURRENT); else if (petentry) // known petentry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets) // 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 @@ -233,7 +233,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32()); SetCreatorGUID(owner->GetGUID()); - SetReactState( ReactStates( fields[6].GetUInt8() )); + SetReactState(ReactStates(fields[6].GetUInt8())); SetCanModifyStats(true); InitStatsForLevel(petlevel); @@ -396,12 +396,12 @@ void Pet::SavePetToDB(PetSaveMode mode) CharacterDatabase.escape_string(name); CharacterDatabase.BeginTransaction(); // remove current data - CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner,m_charmInfo->GetPetNumber() ); + CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner,m_charmInfo->GetPetNumber()); // prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT) if (mode <= PET_SAVE_LAST_STABLE_SLOT) CharacterDatabase.PExecute("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'", - PET_SAVE_NOT_IN_SLOT, owner, uint32(mode) ); + PET_SAVE_NOT_IN_SLOT, owner, uint32(mode)); // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT if (getPetType()==HUNTER_PET && (mode==PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT)) @@ -409,7 +409,7 @@ void Pet::SavePetToDB(PetSaveMode mode) owner,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT); // save pet std::ostringstream ss; - ss << "INSERT INTO character_pet ( id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType) " + ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType) " << "VALUES (" << m_charmInfo->GetPetNumber() << ", " << GetEntry() << ", " @@ -438,7 +438,7 @@ void Pet::SavePetToDB(PetSaveMode mode) << GetUInt32Value(UNIT_CREATED_BY_SPELL) << ", " << uint32(getPetType()) << ")"; - CharacterDatabase.Execute( ss.str().c_str() ); + CharacterDatabase.Execute(ss.str().c_str()); CharacterDatabase.CommitTransaction(); } // delete @@ -466,7 +466,7 @@ void Pet::setDeathState(DeathState s) // overwrite virtual if (getPetType() == HUNTER_PET) { // pet corpse non lootable and non skinnable - SetUInt32Value( UNIT_DYNAMIC_FLAGS, 0x00 ); + SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0x00); RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); //lose happiness when died and not in BG/Arena @@ -492,11 +492,11 @@ void Pet::Update(uint32 diff) if (m_loading) return; - switch( m_deathState ) + switch(m_deathState) { case CORPSE: { - if (getPetType() != HUNTER_PET || m_deathTimer <= diff ) + if (getPetType() != HUNTER_PET || m_deathTimer <= diff) { Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER! return; @@ -516,7 +516,7 @@ void Pet::Update(uint32 diff) if (isControlled()) { - if ( owner->GetPetGUID() != GetGUID() ) + if (owner->GetPetGUID() != GetGUID()) { sLog.outError("Pet %u is not pet of owner %u, removed", GetEntry(), m_owner->GetName()); Remove(getPetType()==HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT); @@ -690,7 +690,7 @@ void Pet::GivePetXP(uint32 xp) if (getPetType() != HUNTER_PET) return; - if ( xp < 1 ) + if (xp < 1) return; if (!isAlive()) @@ -699,7 +699,7 @@ void Pet::GivePetXP(uint32 xp) uint8 level = getLevel(); // If pet is detected to be equal to player level, don't hand out XP - if ( level >= GetOwner()->getLevel() ) + if (level >= GetOwner()->getLevel()) return; uint32 curXP = GetUInt32Value(UNIT_FIELD_PETEXPERIENCE); @@ -707,7 +707,7 @@ void Pet::GivePetXP(uint32 xp) uint32 newXP = curXP + xp; // Check how much XP the pet should receive, and hand off have any left from previous levelups - while ( newXP >= nextLvlXP && level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ) + while (newXP >= nextLvlXP && level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { // Subtract newXP from amount needed for nextlevel newXP -= nextLvlXP; @@ -719,7 +719,7 @@ void Pet::GivePetXP(uint32 xp) nextLvlXP = GetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP); // Hitting the pet/playerlevel combolimitation, set UNIT_FIELD_PETEXPERIENCE (current XP) to 0 - if ( level >= GetOwner()->getLevel() ) { + if (level >= GetOwner()->getLevel()) { newXP = 0; SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, newXP); return; @@ -877,8 +877,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) else // not exist in DB, use some default fake data { // remove elite bonuses included in DB values - //SetCreateHealth(uint32(((float(cinfo->maxhealth) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) ); - //SetCreateMana( uint32(((float(cinfo->maxmana) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) ); + //SetCreateHealth(uint32(((float(cinfo->maxhealth) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel)); + //SetCreateMana(uint32(((float(cinfo->maxmana) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel)); SetCreateStat(STAT_STRENGTH, 22); SetCreateStat(STAT_AGILITY, 22); @@ -899,8 +899,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetBonusDamage(int32 (val * 0.15f)); //bonusAP += val * 0.57; - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) ); - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)) ); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); //SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, float(cinfo->attackpower)); break; @@ -910,9 +910,9 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(petlevel)*PET_XP_FACTOR); //these formula may not be correct; however, it is designed to be close to what it should be //this makes dps 0.5 of pets level - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) ); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); //damage range is then petlevel / 2 - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)) ); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); //damage is increased afterwards as strength and pet scaling modify attack power break; } @@ -926,7 +926,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) float val = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4; if (val < 0) val = 0; - SetBonusDamage( int32(val)); + SetBonusDamage(int32(val)); break; } case 1964: //force of nature @@ -1226,7 +1226,7 @@ void Pet::_LoadAuras(uint32 timediff) else remaincharges = 0; - if (Aura * aura = Aura::TryCreate( spellproto, effmask, this, NULL, &baseDamage[0], NULL, caster_guid)) + if (Aura * aura = Aura::TryCreate(spellproto, effmask, this, NULL, &baseDamage[0], NULL, caster_guid)) { if (!aura->CanBeSaved()) { @@ -1342,7 +1342,7 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel // talent: unlearn all other talent ranks (high and low) if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id)) { - if (TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id )) + if (TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) { for (uint8 i = 0; i < MAX_TALENT_RANK; ++i) { @@ -1364,7 +1364,7 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel { if (itr2->second.state == PETSPELL_REMOVED) continue; - if (spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) ) + if (spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first)) { // replace by new high rank if (spellmgr.IsHighRankOfSpell(spell_id,itr2->first)) @@ -1601,7 +1601,7 @@ bool Pet::resetTalents(bool no_cost) if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab ); + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; diff --git a/src/game/Pet.h b/src/game/Pet.h index 8d5b91251ba..11c5f25d718 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -140,7 +140,7 @@ class Pet : public Guardian bool Create (uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number); bool CreateBaseAtCreature(Creature* creature); - bool LoadPetFromDB( Player* owner,uint32 petentry = 0,uint32 petnumber = 0, bool current = false ); + bool LoadPetFromDB(Player* owner,uint32 petentry = 0,uint32 petnumber = 0, bool current = false); bool isBeingLoaded() const { return m_loading;} void SavePetToDB(PetSaveMode mode); void Remove(PetSaveMode mode, bool returnreagent = false); diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index 04245dc04ba..e8b21e807cf 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -32,7 +32,7 @@ int PetAI::Permissible(const Creature *creature) { - if ( creature->isPet()) + if (creature->isPet()) return PERMIT_BASE_SPECIAL; return PERMIT_BASE_NO; @@ -59,7 +59,7 @@ bool PetAI::_needToStop() const void PetAI::_stopAttack() { - if ( !m_creature->isAlive() ) + if (!m_creature->isAlive()) { DEBUG_LOG("Creature stoped attacking cuz his dead [guid=%u]", m_creature->GetGUIDLow()); m_creature->GetMotionMaster()->Clear(); @@ -89,9 +89,9 @@ void PetAI::UpdateAI(const uint32 diff) m_updateAlliesTimer -= diff; // m_creature->getVictim() can't be used for check in case stop fighting, m_creature->getVictim() clear at Unit death etc. - if ( m_creature->getVictim() ) + if (m_creature->getVictim()) { - if ( _needToStop() ) + if (_needToStop()) { DEBUG_LOG("Pet AI stoped attacking [guid=%u]", m_creature->GetGUIDLow()); _stopAttack(); @@ -203,9 +203,9 @@ void PetAI::UpdateAI(const uint32 diff) targetSpellStore.erase(targetSpellStore.begin() + index); SpellCastTargets targets; - targets.setUnitTarget( target ); + targets.setUnitTarget(target); - if ( !m_creature->HasInArc(M_PI, target) ) + if (!m_creature->HasInArc(M_PI, target)) { m_creature->SetInFront(target); if (target && target->GetTypeId() == TYPEID_PLAYER) diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 71b182bd99a..4b277797dfd 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -32,7 +32,7 @@ #include "Pet.h" #include "World.h" -void WorldSession::HandlePetAction( WorldPacket & recv_data ) +void WorldSession::HandlePetAction(WorldPacket & recv_data) { uint64 guid1; uint32 data; @@ -46,16 +46,16 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) // used also for charmed creature Unit* pet= ObjectAccessor::GetUnit(*_player, guid1); - sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) ); + sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); if (!pet) { - sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid1)) ); + sLog.outError("Pet %u not exist.", uint32(GUID_LOPART(guid1))); return; } if (pet != GetPlayer()->GetFirstControlled()) { - sLog.outError("HandlePetAction.Pet %u isn't pet of player %s.", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName() ); + sLog.outError("HandlePetAction.Pet %u isn't pet of player %s.", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName()); return; } @@ -98,7 +98,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid pet->AttackStop(); pet->InterruptNonMeleeSpells(false); pet->GetMotionMaster()->MoveIdle(); - charmInfo->SetCommandState( COMMAND_STAY ); + charmInfo->SetCommandState(COMMAND_STAY); charmInfo->SetIsCommandAttack(false); charmInfo->SetIsAtStay(true); @@ -110,7 +110,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid pet->AttackStop(); pet->InterruptNonMeleeSpells(false); pet->GetMotionMaster()->MoveFollow(_player,PET_FOLLOW_DIST,pet->GetFollowAngle()); - charmInfo->SetCommandState( COMMAND_FOLLOW ); + charmInfo->SetCommandState(COMMAND_FOLLOW); charmInfo->SetIsCommandAttack(false); charmInfo->SetIsAtStay(false); @@ -146,7 +146,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid pet->clearUnitState(UNIT_STAT_FOLLOW); // This is true if pet has no target or has target but targets differs. - if (pet->getVictim() != TargetUnit || ( pet->getVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack() )) + if (pet->getVictim() != TargetUnit || (pet->getVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack())) { if (pet->getVictim()) pet->AttackStop(); @@ -218,7 +218,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid case REACT_DEFENSIVE: //recovery case REACT_AGGRESSIVE: //activete if (pet->GetTypeId() == TYPEID_UNIT) - pet->ToCreature()->SetReactState( ReactStates(spellid) ); + pet->ToCreature()->SetReactState(ReactStates(spellid)); break; } break; @@ -232,7 +232,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid unit_target = ObjectAccessor::GetUnit(*_player,guid2); // do not cast unknown spells - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid); if (!spellInfo) { sLog.outError("WORLD: unknown PET spell id %i", spellid); @@ -274,13 +274,13 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid { pet->SetInFront(unit_target); if (unit_target->GetTypeId() == TYPEID_PLAYER) - pet->SendUpdateToPlayer( (Player*)unit_target ); + pet->SendUpdateToPlayer((Player*)unit_target); } else if (Unit *unit_target2 = spell->m_targets.getUnitTarget()) { pet->SetInFront(unit_target2); if (unit_target2->GetTypeId() == TYPEID_PLAYER) - pet->SendUpdateToPlayer( (Player*)unit_target2 ); + pet->SendUpdateToPlayer((Player*)unit_target2); } if (Unit* powner = pet->GetCharmerOrOwner()) if (powner->GetTypeId() == TYPEID_PLAYER) @@ -303,7 +303,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid pet->SendPetAIReaction(guid1); } - if ( unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pet->isPossessed() && !pet->IsVehicle()) + if (unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pet->isPossessed() && !pet->IsVehicle()) { // This is true if pet has no target or has target but targets differs. if (pet->getVictim() != unit_target) @@ -342,9 +342,9 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid } } -void WorldSession::HandlePetNameQuery( WorldPacket & recv_data ) +void WorldSession::HandlePetNameQuery(WorldPacket & recv_data) { - sLog.outDetail( "HandlePetNameQuery. CMSG_PET_NAME_QUERY" ); + sLog.outDetail("HandlePetNameQuery. CMSG_PET_NAME_QUERY"); uint32 petnumber; uint64 petguid; @@ -355,7 +355,7 @@ void WorldSession::HandlePetNameQuery( WorldPacket & recv_data ) SendPetNameQuery(petguid,petnumber); } -void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber) +void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber) { Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid); if (!pet) @@ -376,7 +376,7 @@ void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber) data << name.c_str(); data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP)); - if ( pet->isPet() && ((Pet*)pet)->GetDeclinedNames() ) + if (pet->isPet() && ((Pet*)pet)->GetDeclinedNames()) { data << uint8(1); for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) @@ -388,9 +388,9 @@ void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber) _player->GetSession()->SendPacket(&data); } -void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) +void WorldSession::HandlePetSetAction(WorldPacket & recv_data) { - sLog.outDetail( "HandlePetSetAction. CMSG_PET_SET_ACTION" ); + sLog.outDetail("HandlePetSetAction. CMSG_PET_SET_ACTION"); uint64 petguid; uint8 count; @@ -401,7 +401,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) if (!pet || pet != _player->GetFirstControlled()) { - sLog.outError( "HandlePetSetAction: Unknown pet or pet owner." ); + sLog.outError("HandlePetSetAction: Unknown pet or pet owner."); return; } @@ -470,7 +470,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data[i]); uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]); - sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state)); + sLog.outDetail("Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state)); //if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id))) @@ -498,9 +498,9 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) } } -void WorldSession::HandlePetRename( WorldPacket & recv_data ) +void WorldSession::HandlePetRename(WorldPacket & recv_data) { - sLog.outDetail( "HandlePetRename. CMSG_PET_RENAME" ); + sLog.outDetail("HandlePetRename. CMSG_PET_RENAME"); uint64 petguid; uint8 isdeclined; @@ -514,9 +514,9 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data ) Pet* pet = ObjectAccessor::GetPet(petguid); // check it! - if ( !pet || !pet->isPet() || ((Pet*)pet)->getPetType()!= HUNTER_PET || + if (!pet || !pet->isPet() || ((Pet*)pet)->getPetType()!= HUNTER_PET || !pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) || - pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo() ) + pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo()) return; PetNameInvalidReason res = ObjectMgr::CheckPetName(name); @@ -573,11 +573,11 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data ) pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); } -void WorldSession::HandlePetAbandon( WorldPacket & recv_data ) +void WorldSession::HandlePetAbandon(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; //pet guid - sLog.outDetail( "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid) ); + sLog.outDetail("HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); if (!_player->IsInWorld()) return; @@ -601,7 +601,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data ) } } -void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ) +void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) { sLog.outDetail("CMSG_PET_SPELL_AUTOCAST"); uint64 guid; @@ -619,7 +619,7 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ) if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm())) { - sLog.outError( "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() ); + sLog.outError("HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName()); return; } @@ -642,7 +642,7 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ) charmInfo->SetSpellAutocast(spellid,state); } -void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket ) +void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { sLog.outDetail("WORLD: CMSG_PET_CAST_SPELL"); @@ -663,7 +663,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket ) if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { - sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() ); + sLog.outError("HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName()); return; } @@ -756,7 +756,7 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec SendPacket(&data); } -void WorldSession::HandlePetLearnTalent( WorldPacket & recv_data ) +void WorldSession::HandlePetLearnTalent(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_PET_LEARN_TALENT"); @@ -768,7 +768,7 @@ void WorldSession::HandlePetLearnTalent( WorldPacket & recv_data ) _player->SendTalentsInfoData(true); } -void WorldSession::HandleLearnPreviewTalentsPet( WorldPacket & recv_data ) +void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket & recv_data) { sLog.outDebug("CMSG_LEARN_PREVIEW_TALENTS_PET"); diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index cc6775ea65d..74e9af8b893 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -186,7 +186,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } ItemPosCountVec dest; - uint8 msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount ); + uint8 msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount); if (msg != EQUIP_ERR_OK) { _player->SendBuyError(msg, pCreature, charterid, 0); @@ -226,8 +226,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) sLog.outDebug("Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str()); CharacterDatabase.escape_string(name); CharacterDatabase.BeginTransaction(); - CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid IN ( %s )", ssInvalidPetitionGUIDs.str().c_str()); - CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid IN ( %s )", ssInvalidPetitionGUIDs.str().c_str()); + CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid IN (%s)", ssInvalidPetitionGUIDs.str().c_str()); + CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid IN (%s)", ssInvalidPetitionGUIDs.str().c_str()); CharacterDatabase.PExecute("INSERT INTO petition (ownerguid, petitionguid, name, type) VALUES ('%u', '%u', '%s', '%u')", _player->GetGUIDLow(), charter->GetGUIDLow(), name.c_str(), type); CharacterDatabase.CommitTransaction(); @@ -611,7 +611,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) sLog.outDebug("OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid)); - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam() ) + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam()) { if (type != 9) SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8ef25a4fc7d..15e4ece04f8 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -196,7 +196,7 @@ void PlayerTaxi::LoadTaxiMask(const char* data) } } -void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all ) +void PlayerTaxi::AppendTaximaskTo(ByteBuffer& data, bool all) { if (all) { @@ -210,7 +210,7 @@ void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all ) } } -bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values, uint32 team ) +bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, uint32 team) { ClearTaxiDestinations(); @@ -358,7 +358,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_cinematic = 0; - PlayerTalkClass = new PlayerMenu( GetSession() ); + PlayerTalkClass = new PlayerMenu(GetSession()); m_currentBuybackSlot = BUYBACK_SLOT_START; m_DailyQuestChanged = false; @@ -557,7 +557,7 @@ void Player::CleanupsBeforeDelete(bool finalCleanup) itr->second.save->RemovePlayer(this); } -bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ) +bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId) { //FIXME: outfitId not used in player creating @@ -593,14 +593,14 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 setFactionForRace(race); - uint32 RaceClassGender = ( race ) | ( class_ << 8 ) | ( gender << 16 ); + uint32 RaceClassGender = (race) | (class_ << 8) | (gender << 16); - SetUInt32Value(UNIT_FIELD_BYTES_0, ( RaceClassGender | ( powertype << 24 ) ) ); + SetUInt32Value(UNIT_FIELD_BYTES_0, (RaceClassGender | (powertype << 24))); InitDisplayIds(); if (sWorld.getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld.getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP) { - SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP ); - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE ); + SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); } SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER); SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client @@ -613,18 +613,18 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x00 << 8) | (0x00 << 16) | (0x02 << 24))); SetByteValue(PLAYER_BYTES_3, 0, gender); - SetUInt32Value( PLAYER_GUILDID, 0 ); - SetUInt32Value( PLAYER_GUILDRANK, 0 ); - SetUInt32Value( PLAYER_GUILD_TIMESTAMP, 0 ); + SetUInt32Value(PLAYER_GUILDID, 0); + SetUInt32Value(PLAYER_GUILDRANK, 0); + SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0); - SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, 0 ); // 0=disabled - SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES1, 0 ); // 0=disabled - SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES2, 0 ); // 0=disabled - SetUInt32Value( PLAYER_CHOSEN_TITLE, 0 ); - SetUInt32Value( PLAYER_FIELD_KILLS, 0 ); - SetUInt32Value( PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0 ); - SetUInt32Value( PLAYER_FIELD_TODAY_CONTRIBUTION, 0 ); - SetUInt32Value( PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0 ); + SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, 0); // 0=disabled + SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES1, 0); // 0=disabled + SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES2, 0); // 0=disabled + SetUInt32Value(PLAYER_CHOSEN_TITLE, 0); + SetUInt32Value(PLAYER_FIELD_KILLS, 0); + SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0); + SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0); + SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0); // set starting level uint32 start_level = getClass() != CLASS_DEATH_KNIGHT @@ -796,31 +796,31 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 // or ammo not equipped in special bag for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) { - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { uint16 eDest; // equip offhand weapon/shield if it attempt equipped before main-hand weapon - uint8 msg = CanEquipItem( NULL_SLOT, eDest, pItem, false ); - if ( msg == EQUIP_ERR_OK ) + uint8 msg = CanEquipItem(NULL_SLOT, eDest, pItem, false); + if (msg == EQUIP_ERR_OK) { RemoveItem(INVENTORY_SLOT_BAG_0, i,true); - EquipItem( eDest, pItem, true); + EquipItem(eDest, pItem, true); } // move other items to more appropriate slots (ammo not equipped in special bag) else { ItemPosCountVec sDest; - msg = CanStoreItem( NULL_BAG, NULL_SLOT, sDest, pItem, false ); - if ( msg == EQUIP_ERR_OK ) + msg = CanStoreItem(NULL_BAG, NULL_SLOT, sDest, pItem, false); + if (msg == EQUIP_ERR_OK) { RemoveItem(INVENTORY_SLOT_BAG_0, i,true); - pItem = StoreItem( sDest, pItem, true); + pItem = StoreItem(sDest, pItem, true); } // if this is ammo then use it - msg = CanUseAmmo( pItem->GetEntry() ); - if ( msg == EQUIP_ERR_OK ) - SetAmmo( pItem->GetEntry() ); + msg = CanUseAmmo(pItem->GetEntry()); + if (msg == EQUIP_ERR_OK) + SetAmmo(pItem->GetEntry()); } } } @@ -837,11 +837,11 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) while (titem_amount > 0) { uint16 eDest; - uint8 msg = CanEquipNewItem( NULL_SLOT, eDest, titem_id, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = CanEquipNewItem(NULL_SLOT, eDest, titem_id, false); + if (msg != EQUIP_ERR_OK) break; - EquipNewItem( eDest, titem_id, true); + EquipNewItem(eDest, titem_id, true); AutoUnequipOffhandIfNeed(); --titem_amount; } @@ -852,10 +852,10 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) // attempt store ItemPosCountVec sDest; // store in main bag to simplify second pass (special bags can be not equipped yet at this moment) - uint8 msg = CanStoreNewItem( INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount ); - if ( msg == EQUIP_ERR_OK ) + uint8 msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount); + if (msg == EQUIP_ERR_OK) { - StoreNewItem( sDest, titem_id, true, Item::GenerateItemRandomPropertyId(titem_id) ); + StoreNewItem(sDest, titem_id, true, Item::GenerateItemRandomPropertyId(titem_id)); return true; // stored } @@ -879,7 +879,7 @@ void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 Curre data << Regen; data << (uint8)0; data << (uint32)0; // spell id - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::StopMirrorTimer(MirrorTimerType Type) @@ -887,7 +887,7 @@ void Player::StopMirrorTimer(MirrorTimerType Type) m_MirrorTimer[Type] = DISABLED_MIRROR_TIMER; WorldPacket data(SMSG_STOP_MIRROR_TIMER, 4); data << (uint32)Type; - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) @@ -1129,7 +1129,7 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId) SendMessageToSet(&data, true); } -void Player::Update( uint32 p_time ) +void Player::Update(uint32 p_time) { if (!IsInWorld()) return; @@ -1466,7 +1466,7 @@ void Player::setDeathState(DeathState s) } } -bool Player::BuildEnumData( QueryResult_AutoPtr result, WorldPacket * p_data ) +bool Player::BuildEnumData(QueryResult_AutoPtr result, WorldPacket * p_data) { // 0 1 2 3 4 5 6 7 // "SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.playerBytes, characters.playerBytes2, characters.level, " @@ -1873,7 +1873,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati else data << (uint32)mapid << (float)x << (float)y << (float)z << (float)orientation; - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); SendSavedInstances(); } @@ -2041,8 +2041,8 @@ void Player::RegenerateAll() if (m_regenTimerCount >= 2000) { // Not in combat or they have regeneration - if ( !isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) || - HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() ) + if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) || + HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed()) { RegenerateHealth(); } @@ -2483,7 +2483,7 @@ void Player::SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 RestXP) void Player::GiveXP(uint32 xp, Unit* victim) { - if ( xp < 1 ) + if (xp < 1) return; if (!isAlive()) @@ -2497,7 +2497,7 @@ void Player::GiveXP(uint32 xp, Unit* victim) // Favored experience increase START uint32 zone = GetZoneId(); float favored_exp_mult = 0; - if ( (HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) ) favored_exp_mult = 0.05; // Thrallmar's Favor and Honor Hold's Favor + if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) favored_exp_mult = 0.05; // Thrallmar's Favor and Honor Hold's Favor xp *= (1 + favored_exp_mult); // Favored experience increase END @@ -2521,11 +2521,11 @@ void Player::GiveXP(uint32 xp, Unit* victim) uint32 nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP); uint32 newXP = curXP + xp + rested_bonus_xp; - while ( newXP >= nextLvlXP && level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ) + while (newXP >= nextLvlXP && level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { newXP -= nextLvlXP; - if ( level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ) + if (level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) GiveLevel(level + 1); level = getLevel(); @@ -2617,7 +2617,7 @@ void Player::GiveLevel(uint8 level) void Player::InitTalentForLevel() { uint8 level = getLevel(); - // talents base at level diff ( talents = level - 9 but some can be used already) + // talents base at level diff (talents = level - 9 but some can be used already) if (level < 10) { // Remove all talent points @@ -2665,7 +2665,7 @@ void Player::InitStatsForLevel(bool reapplyMods) PlayerLevelInfo info; objmgr.GetPlayerLevelInfo(getRace(),getClass(),getLevel(),&info); - SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ); + SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)); SetUInt32Value(PLAYER_NEXT_LEVEL_XP, objmgr.GetXPForLevel(getLevel())); // reset before any aura state sources (health set/aura apply) @@ -2777,13 +2777,13 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); // cleanup unit flags (will be re-applied if need at aura load). - RemoveFlag( UNIT_FIELD_FLAGS, + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_PET_IN_COMBAT | UNIT_FLAG_SILENCED | UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_DISARMED | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_NOT_SELECTABLE | - UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_TAXI_FLIGHT ); - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE ); // must be set + UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_TAXI_FLIGHT); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); // must be set SetFlag(UNIT_FIELD_FLAGS_2,UNIT_FLAG2_REGENERATE_POWER);// must be set @@ -2880,7 +2880,7 @@ void Player::SendInitialSpells() GetSession()->SendPacket(&data); - sLog.outDetail( "CHARACTER: Sent Initial Spells" ); + sLog.outDetail("CHARACTER: Sent Initial Spells"); } void Player::RemoveMail(uint32 id) @@ -2902,9 +2902,9 @@ void Player::SendMailResult(uint32 mailId, MailResponseType mailAction, MailResp data << (uint32) mailId; data << (uint32) mailAction; data << (uint32) mailError; - if ( mailError == MAIL_ERR_EQUIP_ERROR ) + if (mailError == MAIL_ERR_EQUIP_ERROR) data << (uint32) equipError; - else if ( mailAction == MAIL_ITEM_TAKEN ) + else if (mailAction == MAIL_ITEM_TAKEN) { data << (uint32) item_guid; // item guid low? data << (uint32) item_count; // item count? @@ -2989,7 +2989,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning) itr->second->state = PLAYERSPELL_UNCHANGED; else if (TalentSpellPos const *talentPos = GetTalentSpellPos(spell_id)) { - if (TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id )) + if (TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) { for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) { @@ -3117,7 +3117,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); data << uint32(spell_id); data << uint32(next_active_spell_id); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } else { @@ -3168,7 +3168,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // talent: unlearn all other talent ranks (high and low) if (TalentSpellPos const *talentPos = GetTalentSpellPos(spell_id)) { - if (TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id )) + if (TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) { for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) { @@ -3199,13 +3199,13 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible if (newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0) { - for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2 ) + for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { if (itr2->second->state == PLAYERSPELL_REMOVED) continue; SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr2->first); if (!i_spellInfo) continue; - if ( spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) ) + if (spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first)) { if (itr2->second->active) { @@ -3216,7 +3216,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); data << uint32(itr2->first); data << uint32(spell_id); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } // mark old spell as disable (SMSG_SUPERCEDED_SPELL replace it in client by new) @@ -3232,7 +3232,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); data << uint32(spell_id); data << uint32(itr2->first); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } // mark new spell as disable (not learned yet for client and will not learned) @@ -3324,13 +3324,13 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen switch(GetSkillRangeType(pSkill,_spell_idx->second->racemask!=0)) { case SKILL_RANGE_LANGUAGE: - SetSkill(pSkill->id, 300, 300 ); + SetSkill(pSkill->id, 300, 300); break; case SKILL_RANGE_LEVEL: - SetSkill(pSkill->id, 1, GetMaxSkillValueForLevel() ); + SetSkill(pSkill->id, 1, GetMaxSkillValueForLevel()); break; case SKILL_RANGE_MONO: - SetSkill(pSkill->id, 1, 1 ); + SetSkill(pSkill->id, 1, 1); break; default: break; @@ -3635,7 +3635,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) } } -void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */) +void Player::RemoveSpellCooldown(uint32 spell_id, bool update /* = false */) { m_spellCooldowns.erase(spell_id); @@ -3679,9 +3679,9 @@ void Player::RemoveArenaSpellCooldowns() ++next; SpellEntry const * entry = sSpellStore.LookupEntry(itr->first); // check if spellentry is present and if the cooldown is less than 10 mins - if ( entry && + if (entry && entry->RecoveryTime <= 10 * MINUTE * IN_MILISECONDS && - entry->CategoryRecoveryTime <= 10 * MINUTE * IN_MILISECONDS ) + entry->CategoryRecoveryTime <= 10 * MINUTE * IN_MILISECONDS) { // remove & notify RemoveSpellCooldown(itr->first, true); @@ -3732,7 +3732,7 @@ void Player::_LoadSpellCooldowns(QueryResult_AutoPtr result) sLog.outDebug("Player (GUID: %u) spell %u, item %u cooldown loaded (%u secs).", GetGUIDLow(), spell_id, item_id, uint32(db_time-curTime)); } - while ( result->NextRow() ); + while (result->NextRow()); } } @@ -3770,7 +3770,7 @@ void Player::_SaveSpellCooldowns() } // if something changed execute if (!first_round) - CharacterDatabase.Execute( ss.str().c_str() ); + CharacterDatabase.Execute(ss.str().c_str()); } uint32 Player::resetTalentsCost() const @@ -4017,14 +4017,14 @@ void Player::InitVisibleBits() updateVisualBits.SetBit(PLAYER_CHOSEN_TITLE); } -void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const +void Player::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const { for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) { if (m_items[i] == NULL) continue; - m_items[i]->BuildCreateUpdateBlockForPlayer( data, target ); + m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); } if (target == this) @@ -4034,30 +4034,30 @@ void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) if (m_items[i] == NULL) continue; - m_items[i]->BuildCreateUpdateBlockForPlayer( data, target ); + m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); } for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { if (m_items[i] == NULL) continue; - m_items[i]->BuildCreateUpdateBlockForPlayer( data, target ); + m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); } } - Unit::BuildCreateUpdateBlockForPlayer( data, target ); + Unit::BuildCreateUpdateBlockForPlayer(data, target); } -void Player::DestroyForPlayer( Player *target, bool anim ) const +void Player::DestroyForPlayer(Player *target, bool anim) const { - Unit::DestroyForPlayer( target, anim ); + Unit::DestroyForPlayer(target, anim); for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { if (m_items[i] == NULL) continue; - m_items[i]->DestroyForPlayer( target ); + m_items[i]->DestroyForPlayer(target); } if (target == this) @@ -4067,14 +4067,14 @@ void Player::DestroyForPlayer( Player *target, bool anim ) const if (m_items[i] == NULL) continue; - m_items[i]->DestroyForPlayer( target ); + m_items[i]->DestroyForPlayer(target); } for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { if (m_items[i] == NULL) continue; - m_items[i]->DestroyForPlayer( target ); + m_items[i]->DestroyForPlayer(target); } } } @@ -4353,7 +4353,7 @@ void Player::SetMovement(PlayerMovementType pType) } data.append(GetPackGUID()); data << uint32(0); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } /* Preconditions: @@ -4392,7 +4392,7 @@ void Player::BuildPlayerRepop() GetMap()->Add(corpse); // convert player body to ghost - SetHealth( 1 ); + SetHealth(1); SetMovement(MOVE_WATER_WALK); if (!GetSession()->isLogingOut()) @@ -4524,7 +4524,7 @@ void Player::KillPlayer() StopMirrorTimers(); //disable timers(bars) setDeathState(CORPSE); - //SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP ); + //SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP); SetFlag(UNIT_DYNAMIC_FLAGS, 0x00); ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable()); @@ -4548,7 +4548,7 @@ void Player::CreateCorpse() uint32 _uf, _pb, _pb2, _cfb1, _cfb2; - Corpse *corpse = new Corpse( (m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH) ? CORPSE_RESURRECTABLE_PVP : CORPSE_RESURRECTABLE_PVE ); + Corpse *corpse = new Corpse((m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH) ? CORPSE_RESURRECTABLE_PVP : CORPSE_RESURRECTABLE_PVE); SetPvPDeath(false); if (!corpse->Create(objmgr.GenerateLowGuid(HIGHGUID_CORPSE), this)) @@ -4571,8 +4571,8 @@ void Player::CreateCorpse() _cfb1 = ((0x00) | (race << 8) | (getGender() << 16) | (skin << 24)); _cfb2 = ((face) | (hairstyle << 8) | (haircolor << 16) | (facialhair << 24)); - corpse->SetUInt32Value( CORPSE_FIELD_BYTES_1, _cfb1 ); - corpse->SetUInt32Value( CORPSE_FIELD_BYTES_2, _cfb2 ); + corpse->SetUInt32Value(CORPSE_FIELD_BYTES_1, _cfb1); + corpse->SetUInt32Value(CORPSE_FIELD_BYTES_2, _cfb2); uint32 flags = CORPSE_FLAG_UNK2; if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM)) @@ -4581,11 +4581,11 @@ void Player::CreateCorpse() flags |= CORPSE_FLAG_HIDE_CLOAK; if (InBattleGround() && !InArena()) flags |= CORPSE_FLAG_LOOTABLE; // to be able to remove insignia - corpse->SetUInt32Value( CORPSE_FIELD_FLAGS, flags ); + corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags); - corpse->SetUInt32Value( CORPSE_FIELD_DISPLAY_ID, GetNativeDisplayId() ); + corpse->SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, GetNativeDisplayId()); - corpse->SetUInt32Value( CORPSE_FIELD_GUILD, GetGuildId() ); + corpse->SetUInt32Value(CORPSE_FIELD_GUILD, GetGuildId()); uint32 iDisplayID; uint32 iIventoryType; @@ -4627,7 +4627,7 @@ Corpse* Player::GetCorpse() const void Player::DurabilityLossAll(double percent, bool inventory) { for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) DurabilityLoss(pItem,percent); if (inventory) @@ -4636,23 +4636,23 @@ void Player::DurabilityLossAll(double percent, bool inventory) // for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) DurabilityLoss(pItem,percent); // keys not have durability //for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) for (uint32 j = 0; j < pBag->GetBagSize(); j++) - if (Item* pItem = GetItemByPos( i, j )) + if (Item* pItem = GetItemByPos(i, j)) DurabilityLoss(pItem,percent); } } void Player::DurabilityLoss(Item* item, double percent) { - if (!item ) + if (!item) return; uint32 pMaxDurability = item ->GetUInt32Value(ITEM_FIELD_MAXDURABILITY); @@ -4662,7 +4662,7 @@ void Player::DurabilityLoss(Item* item, double percent) uint32 pDurabilityLoss = uint32(pMaxDurability*percent); - if (pDurabilityLoss < 1 ) + if (pDurabilityLoss < 1) pDurabilityLoss = 1; DurabilityPointsLoss(item,pDurabilityLoss); @@ -4671,7 +4671,7 @@ void Player::DurabilityLoss(Item* item, double percent) void Player::DurabilityPointsLossAll(int32 points, bool inventory) { for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) DurabilityPointsLoss(pItem,points); if (inventory) @@ -4680,16 +4680,16 @@ void Player::DurabilityPointsLossAll(int32 points, bool inventory) // for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) DurabilityPointsLoss(pItem,points); // keys not have durability //for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) for (uint32 j = 0; j < pBag->GetBagSize(); j++) - if (Item* pItem = GetItemByPos( i, j )) + if (Item* pItem = GetItemByPos(i, j)) DurabilityPointsLoss(pItem,points); } } @@ -4708,13 +4708,13 @@ void Player::DurabilityPointsLoss(Item* item, int32 points) if (pOldDurability != pNewDurability) { // modify item stats _before_ Durability set to 0 to pass _ApplyItemMods internal check - if ( pNewDurability == 0 && pOldDurability > 0 && item->IsEquipped()) + if (pNewDurability == 0 && pOldDurability > 0 && item->IsEquipped()) _ApplyItemMods(item,item->GetSlot(), false); item->SetUInt32Value(ITEM_FIELD_DURABILITY, pNewDurability); // modify item stats _after_ restore durability to pass _ApplyItemMods internal check - if ( pNewDurability > 0 && pOldDurability == 0 && item->IsEquipped()) + if (pNewDurability > 0 && pOldDurability == 0 && item->IsEquipped()) _ApplyItemMods(item,item->GetSlot(), true); item->SetState(ITEM_CHANGED, this); @@ -4723,7 +4723,7 @@ void Player::DurabilityPointsLoss(Item* item, int32 points) void Player::DurabilityPointLossForEquipSlot(EquipmentSlots slot) { - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, slot )) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) DurabilityPointsLoss(pItem,1); } @@ -4732,14 +4732,14 @@ uint32 Player::DurabilityRepairAll(bool cost, float discountMod, bool guildBank) uint32 TotalCost = 0; // equipped, backpack, bags itself for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) - TotalCost += DurabilityRepair(( (INVENTORY_SLOT_BAG_0 << 8) | i ),cost,discountMod, guildBank); + TotalCost += DurabilityRepair(((INVENTORY_SLOT_BAG_0 << 8) | i),cost,discountMod, guildBank); // bank, buyback and keys not repaired // items in inventory bags for (uint8 j = INVENTORY_SLOT_BAG_START; j < INVENTORY_SLOT_BAG_END; j++) for (uint8 i = 0; i < MAX_BAG_SIZE; i++) - TotalCost += DurabilityRepair(( (j << 8) | i ),cost,discountMod, guildBank); + TotalCost += DurabilityRepair(((j << 8) | i),cost,discountMod, guildBank); return TotalCost; } @@ -4826,7 +4826,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g return TotalCost; } else - ModifyMoney( -int32(costs) ); + ModifyMoney(-int32(costs)); } } @@ -4856,10 +4856,10 @@ void Player::RepopAtGraveyard() WorldSafeLocsEntry const *ClosestGrave = NULL; // Special handle for battleground maps - if ( BattleGround *bg = GetBattleGround() ) + if (BattleGround *bg = GetBattleGround()) ClosestGrave = bg->GetClosestGraveYard(this); else - ClosestGrave = objmgr.GetClosestGraveYard( GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam() ); + ClosestGrave = objmgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); // stop countdown until repop m_deathTimer = 0; @@ -4907,7 +4907,7 @@ void Player::CleanupChannels() sLog.outDebug("Player: channels cleaned up!"); } -void Player::UpdateLocalChannels(uint32 newZone ) +void Player::UpdateLocalChannels(uint32 newZone) { if (m_channels.empty()) return; @@ -4958,7 +4958,7 @@ void Player::UpdateLocalChannels(uint32 newZone ) void Player::LeaveLFGChannel() { - for (JoinedChannelsList::iterator i = m_channels.begin(); i != m_channels.end(); ++i ) + for (JoinedChannelsList::iterator i = m_channels.begin(); i != m_channels.end(); ++i) { if ((*i)->IsLFG()) { @@ -5386,11 +5386,11 @@ bool Player::UpdateSkill(uint32 skill_id, uint32 step) inline int SkillGainChance(uint32 SkillValue, uint32 GrayLevel, uint32 GreenLevel, uint32 YellowLevel) { - if ( SkillValue >= GrayLevel ) + if (SkillValue >= GrayLevel) return sWorld.getConfig(CONFIG_SKILL_CHANCE_GREY)*10; - if ( SkillValue >= GreenLevel ) + if (SkillValue >= GreenLevel) return sWorld.getConfig(CONFIG_SKILL_CHANCE_GREEN)*10; - if ( SkillValue >= YellowLevel ) + if (SkillValue >= YellowLevel) return sWorld.getConfig(CONFIG_SKILL_CHANCE_YELLOW)*10; return sWorld.getConfig(CONFIG_SKILL_CHANCE_ORANGE)*10; } @@ -5427,7 +5427,7 @@ bool Player::UpdateCraftSkill(uint32 spellid) return false; } -bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator ) +bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator) { sLog.outDebug("UpdateGatherSkill(SkillId %d SkillLevel %d RedLevel %d)", SkillId, SkillValue, RedLevel); @@ -5442,7 +5442,7 @@ bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLeve case SKILL_INSCRIPTION: return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, RedLevel+100, RedLevel+50, RedLevel+25)*Multiplicator,gathering_skill_gain); case SKILL_SKINNING: - if ( sWorld.getConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS)==0) + if (sWorld.getConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS)==0) return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, RedLevel+100, RedLevel+50, RedLevel+25)*Multiplicator,gathering_skill_gain); else return UpdateSkillPro(SkillId, (SkillGainChance(SkillValue, RedLevel+100, RedLevel+50, RedLevel+25)*Multiplicator) >> (SkillValue/sWorld.getConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS)), gathering_skill_gain); @@ -5476,7 +5476,7 @@ static uint32 bonusSkillLevels[] = {75,150,225,300,375,450}; bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) { sLog.outDebug("UpdateSkillPro(SkillId %d, Chance %3.1f%%)", SkillId, Chance/10.0); - if ( !SkillId ) + if (!SkillId) return false; if (Chance <= 0) // speedup in 0 chance case @@ -5495,12 +5495,12 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) uint16 SkillValue = SKILL_VALUE(data); uint16 MaxValue = SKILL_MAX(data); - if ( !MaxValue || !SkillValue || SkillValue >= MaxValue ) + if (!MaxValue || !SkillValue || SkillValue >= MaxValue) return false; int32 Roll = irand(1,1000); - if ( Roll <= Chance ) + if (Roll <= Chance) { uint32 new_value = SkillValue+step; if (new_value > MaxValue) @@ -5513,7 +5513,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) { if ((SkillValue < *bsl && new_value >= *bsl)) { - learnSkillRewardedSpells( SkillId, new_value); + learnSkillRewardedSpells(SkillId, new_value); break; } } @@ -5892,7 +5892,7 @@ return SKILL_TEMP_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos) void Player::SendActionButtons(uint32 state) const { - sLog.outDetail( "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); + sLog.outDetail("Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4)); data << uint8(state); // can be 0, 1, 2 @@ -5916,13 +5916,13 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - sLog.outError( "Action %u not added into button %u for player %s: button must be < 144", action, button, GetName() ); + sLog.outError("Action %u not added into button %u for player %s: button must be < 144", action, button, GetName()); return NULL; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - sLog.outError( "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE ); + sLog.outError("Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE); return NULL; } @@ -5931,20 +5931,20 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellStore.LookupEntry(action)) { - sLog.outError( "Action %u not added into button %u for player %s: spell not exist", action, button, GetName() ); + sLog.outError("Action %u not added into button %u for player %s: spell not exist", action, button, GetName()); return NULL; } if (!HasSpell(action)) { - sLog.outError( "Action %u not added into button %u for player %s: player don't known this spell", action, button, GetName() ); + sLog.outError("Action %u not added into button %u for player %s: player don't known this spell", action, button, GetName()); return NULL; } break; case ACTION_BUTTON_ITEM: if (!objmgr.GetItemPrototype(action)) { - sLog.outError( "Action %u not added into button %u for player %s: item not exist", action, button, GetName() ); + sLog.outError("Action %u not added into button %u for player %s: item not exist", action, button, GetName()); return NULL; } break; @@ -6099,14 +6099,14 @@ void Player::CheckExploreSystem() if (offset >= 128) { - sLog.outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < 128 ).",areaFlag,GetPositionX(),GetPositionY(),offset,offset); + sLog.outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u (%u must be < 128).",areaFlag,GetPositionX(),GetPositionY(),offset,offset); return; } uint32 val = (uint32)(1 << (areaFlag % 32)); uint32 currFields = GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); - if ( !(currFields & val) ) + if (!(currFields & val)) { SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val)); @@ -6147,7 +6147,7 @@ void Player::CheckExploreSystem() XP = uint32(objmgr.GetBaseXP(p->area_level)*sWorld.getRate(RATE_XP_EXPLORE)); } - GiveXP( XP, NULL ); + GiveXP(XP, NULL); SendExplorationExperience(area,XP); } sLog.outDetail("PLAYER: Player %u discovered a new area: %u", GetGUIDLow(), area); @@ -6189,7 +6189,7 @@ uint32 Player::getFactionForRace(uint8 race) void Player::setFactionForRace(uint8 race) { m_team = TeamForRace(race); - setFaction( getFactionForRace(race) ); + setFaction(getFactionForRace(race)); } ReputationRank Player::GetReputationRank(uint32 faction) const @@ -6264,8 +6264,8 @@ void Player::RewardReputation(Unit *pVictim, float rate) uint32 team = GetTeam(); float favored_rep_mult = 0; - if ( (HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) ) favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor - else if ( HasAura(30754) && (Rep->repfaction1 == 609 || Rep->repfaction2 == 609) && !ChampioningFaction ) favored_rep_mult = 0.25; // Cenarion Favor + if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor + else if (HasAura(30754) && (Rep->repfaction1 == 609 || Rep->repfaction2 == 609) && !ChampioningFaction) favored_rep_mult = 0.25; // Cenarion Favor if (favored_rep_mult > 0) favored_rep_mult *= 2; // Multiplied by 2 because the reputation is divided by 2 for some reason (See "donerep1 / 2" and "donerep2 / 2") -- if you know why this is done, please update/explain :) // Favored reputation increase END @@ -6363,7 +6363,7 @@ void Player::UpdateHonorFields() uint16 kills_today = PAIR32_LOPART(GetUInt32Value(PLAYER_FIELD_KILLS)); // update yesterday's contribution - if (m_lastHonorUpdateTime >= yesterday ) + if (m_lastHonorUpdateTime >= yesterday) { SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION)); @@ -6393,7 +6393,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt if (!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER) return false; - if ( GetBGTeam() == uVictim->ToPlayer()->GetBGTeam() ) + if (GetBGTeam() == uVictim->ToPlayer()->GetBGTeam()) return false; return true; @@ -6422,11 +6422,11 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt victim_guid = uVictim->GetGUID(); - if ( uVictim->GetTypeId() == TYPEID_PLAYER ) + if (uVictim->GetTypeId() == TYPEID_PLAYER) { Player *pVictim = uVictim->ToPlayer(); - if ( GetTeam() == pVictim->GetTeam() && !sWorld.IsFFAPvPRealm() ) + if (GetTeam() == pVictim->GetTeam() && !sWorld.IsFFAPvPRealm()) return false; float f = 1; //need for total kills (?? need more info) @@ -6516,7 +6516,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, uint32(honor), true); - if ( sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken ) + if (sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken) { if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) return true; @@ -6525,9 +6525,9 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt { // Check if allowed to receive it in current map uint8 MapType = sWorld.getConfig(CONFIG_PVP_TOKEN_MAP_TYPE); - if ( (MapType == 1 && !InBattleGround() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) + if ((MapType == 1 && !InBattleGround() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) || (MapType == 2 && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) - || (MapType == 3 && !InBattleGround()) ) + || (MapType == 3 && !InBattleGround())) return true; uint32 noSpaceForCount = 0; @@ -6536,18 +6536,18 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt // check space and find places ItemPosCountVec dest; - uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount ); - if ( msg != EQUIP_ERR_OK ) // convert to possible store amount + uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) // convert to possible store amount count = noSpaceForCount; - if ( count == 0 || dest.empty()) // can't add any + if (count == 0 || dest.empty()) // can't add any { // -- TODO: Send to mailbox if no space ChatHandler(this).PSendSysMessage("You don't have any space in your bags for a token."); return true; } - Item* item = StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); SendNewItem(item,count,true,false); ChatHandler(this).PSendSysMessage("You have been awarded a token for slaying another player."); } @@ -6594,8 +6594,8 @@ uint32 Player::GetGuildIdFromDB(uint64 guid) uint32 Player::GetRankFromDB(uint64 guid) { - QueryResult_AutoPtr result = CharacterDatabase.PQuery( "SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid) ); - if ( result ) + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid)); + if (result) { uint32 v = result->Fetch()[0].GetUInt32(); return v; @@ -6617,7 +6617,7 @@ uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type) uint32 Player::GetZoneIdFromDB(uint64 guid) { uint32 guidLow = GUID_LOPART(guid); - QueryResult_AutoPtr result = CharacterDatabase.PQuery( "SELECT zone FROM characters WHERE guid='%u'", guidLow ); + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT zone FROM characters WHERE guid='%u'", guidLow); if (!result) return 0; Field* fields = result->Fetch(); @@ -6627,7 +6627,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) { // stored zone is zero, use generic and slow zone detection result = CharacterDatabase.PQuery("SELECT map,position_x,position_y,position_z FROM characters WHERE guid='%u'", guidLow); - if ( !result ) + if (!result) return 0; fields = result->Fetch(); uint32 map = fields[0].GetUInt32(); @@ -6951,7 +6951,7 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply) uint8 attacktype = Player::GetAttackBySlot(slot); // check disarm only on mod apply to allow remove item mods - if (!CanUseAttackType(attacktype) ) + if (!CanUseAttackType(attacktype)) return; if (attacktype < MAX_ATTACK) @@ -7218,9 +7218,9 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl WeaponAttackType attType = BASE_ATTACK; float damage = 0.0f; - if ( slot == EQUIPMENT_SLOT_RANGED && ( + if (slot == EQUIPMENT_SLOT_RANGED && ( proto->InventoryType == INVTYPE_RANGED || proto->InventoryType == INVTYPE_THROWN || - proto->InventoryType == INVTYPE_RANGEDRIGHT )) + proto->InventoryType == INVTYPE_RANGEDRIGHT)) { attType = RANGED_ATTACK; } @@ -7242,14 +7242,14 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl maxDamage = 1.3f * average; } } - if (minDamage > 0 ) + if (minDamage > 0) { damage = apply ? minDamage : BASE_MINDAMAGE; SetBaseWeaponDamage(attType, MINDAMAGE, damage); //sLog.outError("applying mindam: assigning %f to weapon mindamage, now is: %f", damage, GetWeaponDamageRange(attType, MINDAMAGE)); } - if (maxDamage > 0 ) + if (maxDamage > 0) { damage = apply ? maxDamage : BASE_MAXDAMAGE; SetBaseWeaponDamage(attType, MAXDAMAGE, damage); @@ -7820,7 +7820,7 @@ void Player::_ApplyAmmoBonuses() float currentAmmoDPS; - ItemPrototype const *ammo_proto = objmgr.GetItemPrototype( ammo_id ); + ItemPrototype const *ammo_proto = objmgr.GetItemPrototype(ammo_id); if (!ammo_proto || ammo_proto->Class!=ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto)) currentAmmoDPS = 0.0f; else @@ -7841,12 +7841,12 @@ bool Player::CheckAmmoCompatibility(const ItemPrototype *ammo_proto) const return false; // check ranged weapon - Item *weapon = GetWeaponForAttack( RANGED_ATTACK ); + Item *weapon = GetWeaponForAttack(RANGED_ATTACK); if (!weapon || weapon->IsBroken()) return false; ItemPrototype const* weapon_proto = weapon->GetProto(); - if (!weapon_proto || weapon_proto->Class!=ITEM_CLASS_WEAPON ) + if (!weapon_proto || weapon_proto->Class!=ITEM_CLASS_WEAPON) return false; // check ammo ws. weapon compatibility @@ -7903,11 +7903,11 @@ void Player::RemovedInsignia(Player* looterPlr) looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA); } -void Player::SendLootRelease( uint64 guid ) +void Player::SendLootRelease(uint64 guid) { - WorldPacket data( SMSG_LOOT_RELEASE_RESPONSE, (8+1) ); + WorldPacket data(SMSG_LOOT_RELEASE_RESPONSE, (8+1)); data << uint64(guid) << uint8(1); - SendDirectMessage( &data ); + SendDirectMessage(&data); } void Player::SendLoot(uint64 guid, LootType loot_type) @@ -8222,14 +8222,14 @@ void Player::SendLoot(uint64 guid, LootType loot_type) void Player::SendNotifyLootMoneyRemoved() { WorldPacket data(SMSG_LOOT_CLEAR_MONEY, 0); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SendNotifyLootItemRemoved(uint8 lootSlot) { WorldPacket data(SMSG_LOOT_REMOVED, 1); data << uint8(lootSlot); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SendUpdateWorldState(uint32 Field, uint32 Value) @@ -8823,7 +8823,7 @@ uint32 Player::GetXPRestBonus(uint32 xp) if (rested_bonus > xp) // max rested_bonus == xp or (r+x) = 200% xp rested_bonus = xp; - SetRestBonus( GetRestBonus() - rested_bonus); + SetRestBonus(GetRestBonus() - rested_bonus); sLog.outDetail("Player gain %u xp (+ %u Rested Bonus). Rested points=%f",xp+rested_bonus,rested_bonus,GetRestBonus()); return rested_bonus; @@ -8833,7 +8833,7 @@ void Player::SetBindPoint(uint64 guid) { WorldPacket data(SMSG_BINDER_CONFIRM, 8); data << uint64(guid); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SendTalentWipeConfirm(uint64 guid) @@ -8842,7 +8842,7 @@ void Player::SendTalentWipeConfirm(uint64 guid) data << uint64(guid); uint32 cost = sWorld.getConfig(CONFIG_NO_RESET_TALENT_COST) ? 0 : resetTalentsCost(); data << cost; - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::ResetPetTalents() @@ -8868,7 +8868,7 @@ void Player::ResetPetTalents() /*** STORAGE SYSTEM ***/ /*********************************************************/ -void Player::SetVirtualItemSlot( uint8 i, Item* item) +void Player::SetVirtualItemSlot(uint8 i, Item* item) { assert(i < 3); if (i < 2 && item) @@ -8888,7 +8888,7 @@ void Player::SetVirtualItemSlot( uint8 i, Item* item) } } -void Player::SetSheath( SheathState sheathed ) +void Player::SetSheath(SheathState sheathed) { switch (sheathed) { @@ -8917,7 +8917,7 @@ void Player::SetSheath( SheathState sheathed ) Unit::SetSheath(sheathed); // this must visualize Sheath changing for other players... } -uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const +uint8 Player::FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap) const { uint8 pClass = getClass(); @@ -9081,7 +9081,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap return NULL_SLOT; } -uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const +uint8 Player::CanUnequipItems(uint32 item, uint32 count) const { uint32 tempcount = 0; @@ -9103,7 +9103,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const } for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == item) { tempcount += pItem->GetCount(); @@ -9112,7 +9112,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const } for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == item) { tempcount += pItem->GetCount(); @@ -9121,7 +9121,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const } for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) - if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) if (Item *pItem = GetItemByPos(i, j)) if (pItem->GetEntry() == item) @@ -9139,12 +9139,12 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const { uint32 count = 0; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetEntry() == item) count += pItem->GetCount(); for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetEntry() == item) count += pItem->GetCount(); @@ -9154,19 +9154,19 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const if (skipItem && skipItem->GetProto()->GemProperties) for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetProto()->Socket[0].Color) count += pItem->GetGemCountWithID(item); if (inBankAlso) { for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetEntry() == item) count += pItem->GetCount(); for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) count += pBag->GetItemCount(item,skipItem); if (skipItem && skipItem->GetProto()->GemProperties) @@ -9179,7 +9179,7 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const return count; } -Item* Player::GetItemByGuid( uint64 guid ) const +Item* Player::GetItemByGuid(uint64 guid) const { for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) @@ -9187,7 +9187,7 @@ Item* Player::GetItemByGuid( uint64 guid ) const return pItem; for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) - if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i)) + if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetGUID() == guid) return pItem; @@ -9208,21 +9208,21 @@ Item* Player::GetItemByGuid( uint64 guid ) const return NULL; } -Item* Player::GetItemByPos( uint16 pos ) const +Item* Player::GetItemByPos(uint16 pos) const { uint8 bag = pos >> 8; uint8 slot = pos & 255; - return GetItemByPos( bag, slot ); + return GetItemByPos(bag, slot); } -Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const +Item* Player::GetItemByPos(uint8 bag, uint8 slot) const { - if (bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) )) + if (bag == INVENTORY_SLOT_BAG_0 && (slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END))) return m_items[slot]; else if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END) || (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END)) { - if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag)) + if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, bag)) return pBag->GetItemByPos(slot); } return NULL; @@ -9267,7 +9267,7 @@ Item* Player::GetShield(bool useable) const return item; } -uint8 Player::GetAttackBySlot( uint8 slot ) +uint8 Player::GetAttackBySlot(uint8 slot) { switch(slot) { @@ -9278,51 +9278,51 @@ uint8 Player::GetAttackBySlot( uint8 slot ) } } -bool Player::IsInventoryPos( uint8 bag, uint8 slot ) +bool Player::IsInventoryPos(uint8 bag, uint8 slot) { - if ( bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT ) + if (bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT) return true; - if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END ) ) + if (bag == INVENTORY_SLOT_BAG_0 && (slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END)) return true; - if ( bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END ) + if (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END) return true; - if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) ) + if (bag == INVENTORY_SLOT_BAG_0 && (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)) return true; return false; } -bool Player::IsEquipmentPos( uint8 bag, uint8 slot ) +bool Player::IsEquipmentPos(uint8 bag, uint8 slot) { - if ( bag == INVENTORY_SLOT_BAG_0 && ( slot < EQUIPMENT_SLOT_END ) ) + if (bag == INVENTORY_SLOT_BAG_0 && (slot < EQUIPMENT_SLOT_END)) return true; - if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END ) ) + if (bag == INVENTORY_SLOT_BAG_0 && (slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END)) return true; return false; } -bool Player::IsBankPos( uint8 bag, uint8 slot ) +bool Player::IsBankPos(uint8 bag, uint8 slot) { - if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END ) ) + if (bag == INVENTORY_SLOT_BAG_0 && (slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END)) return true; - if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) ) + if (bag == INVENTORY_SLOT_BAG_0 && (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)) return true; - if ( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END ) + if (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END) return true; return false; } -bool Player::IsBagPos( uint16 pos ) +bool Player::IsBagPos(uint16 pos) { uint8 bag = pos >> 8; uint8 slot = pos & 255; - if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END ) ) + if (bag == INVENTORY_SLOT_BAG_0 && (slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END)) return true; - if ( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) ) + if (bag == INVENTORY_SLOT_BAG_0 && (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)) return true; return false; } -bool Player::IsValidPos( uint8 bag, uint8 slot ) +bool Player::IsValidPos(uint8 bag, uint8 slot) { // post selected if (bag == NULL_BAG) @@ -9376,7 +9376,7 @@ bool Player::IsValidPos( uint8 bag, uint8 slot ) } // bank bag content slots - if ( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END ) + if (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END) { Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag); if (!pBag) @@ -9393,40 +9393,40 @@ bool Player::IsValidPos( uint8 bag, uint8 slot ) return false; } -bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const +bool Player::HasItemCount(uint32 item, uint32 count, bool inBankAlso) const { uint32 tempcount = 0; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) { - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - if ( pItem && pItem->GetEntry() == item ) + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem && pItem->GetEntry() == item) { tempcount += pItem->GetCount(); - if ( tempcount >= count ) + if (tempcount >= count) return true; } } for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - if ( pItem && pItem->GetEntry() == item ) + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem && pItem->GetEntry() == item) { tempcount += pItem->GetCount(); - if ( tempcount >= count ) + if (tempcount >= count) return true; } } for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { for (uint32 j = 0; j < pBag->GetBagSize(); j++) { - Item* pItem = GetItemByPos( i, j ); - if ( pItem && pItem->GetEntry() == item ) + Item* pItem = GetItemByPos(i, j); + if (pItem && pItem->GetEntry() == item) { tempcount += pItem->GetCount(); - if ( tempcount >= count ) + if (tempcount >= count) return true; } } @@ -9437,25 +9437,25 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const { for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) { - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - if ( pItem && pItem->GetEntry() == item ) + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem && pItem->GetEntry() == item) { tempcount += pItem->GetCount(); - if ( tempcount >= count ) + if (tempcount >= count) return true; } } for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { for (uint32 j = 0; j < pBag->GetBagSize(); j++) { - Item* pItem = GetItemByPos( i, j ); - if ( pItem && pItem->GetEntry() == item ) + Item* pItem = GetItemByPos(i, j); + if (pItem && pItem->GetEntry() == item) { tempcount += pItem->GetCount(); - if ( tempcount >= count ) + if (tempcount >= count) return true; } } @@ -9466,7 +9466,7 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const return false; } -bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except_slot ) const +bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot) const { uint32 tempcount = 0; for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) @@ -9474,11 +9474,11 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except if (i == except_slot) continue; - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - if ( pItem && pItem->GetEntry() == item) + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem && pItem->GetEntry() == item) { tempcount += pItem->GetCount(); - if ( tempcount >= count ) + if (tempcount >= count) return true; } } @@ -9491,11 +9491,11 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except if (i == except_slot) continue; - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - if ( pItem && pItem->GetProto()->Socket[0].Color) + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem && pItem->GetProto()->Socket[0].Color) { tempcount += pItem->GetGemCountWithID(item); - if ( tempcount >= count ) + if (tempcount >= count) return true; } } @@ -9504,7 +9504,7 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except return false; } -bool Player::HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32 count, uint8 except_slot ) const +bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot) const { uint32 tempcount = 0; for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) @@ -9512,7 +9512,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32 if (i == except_slot) continue; - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!pItem) continue; @@ -9523,14 +9523,14 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32 if (pProto->ItemLimitCategory == limitCategory) { tempcount += pItem->GetCount(); - if ( tempcount >= count ) + if (tempcount >= count) return true; } - if ( pProto->Socket[0].Color) + if (pProto->Socket[0].Color) { tempcount += pItem->GetGemCountWithLimitCategory(limitCategory); - if ( tempcount >= count ) + if (tempcount >= count) return true; } } @@ -9543,7 +9543,7 @@ uint8 Player::CountItemWithLimitCategory(uint32 limitCategory, Item* skipItem) c uint8 tempcount = 0; for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) { - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!pItem) continue; @@ -9557,7 +9557,7 @@ uint8 Player::CountItemWithLimitCategory(uint32 limitCategory, Item* skipItem) c for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!pItem) continue; @@ -9571,13 +9571,13 @@ uint8 Player::CountItemWithLimitCategory(uint32 limitCategory, Item* skipItem) c for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { - Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!pBag) continue; for (uint32 j = 0; j < pBag->GetBagSize(); ++j) { - Item *pItem = GetItemByPos( i, j ); + Item *pItem = GetItemByPos(i, j); if (!pItem) continue; @@ -9592,7 +9592,7 @@ uint8 Player::CountItemWithLimitCategory(uint32 limitCategory, Item* skipItem) c for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) { - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!pItem) continue; @@ -9606,13 +9606,13 @@ uint8 Player::CountItemWithLimitCategory(uint32 limitCategory, Item* skipItem) c for (int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { - Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!pBag) continue; for (uint32 j = 0; j < pBag->GetBagSize(); ++j) { - Item *pItem = GetItemByPos( i, j ); + Item *pItem = GetItemByPos(i, j); if (!pItem) continue; @@ -9628,7 +9628,7 @@ uint8 Player::CountItemWithLimitCategory(uint32 limitCategory, Item* skipItem) c return tempcount; } -uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count ) const +uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count) const { ItemPrototype const *pProto = objmgr.GetItemPrototype(entry); if (!pProto) @@ -9675,29 +9675,29 @@ uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, return EQUIP_ERR_OK; } -bool Player::HasItemTotemCategory( uint32 TotemCategory ) const +bool Player::HasItemTotemCategory(uint32 TotemCategory) const { Item *pItem; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) { - pItem = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i ); - if ( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory )) + pItem = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory)) return true; } for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { - pItem = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i ); - if ( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory )) + pItem = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory)) return true; } for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { - if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { for (uint32 j = 0; j < pBag->GetBagSize(); ++j) { - pItem = GetUseableItemByPos( i, j ); - if ( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory )) + pItem = GetUseableItemByPos(i, j); + if (pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory)) return true; } } @@ -9705,9 +9705,9 @@ bool Player::HasItemTotemCategory( uint32 TotemCategory ) const return false; } -uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool swap, Item* pSrcItem ) const +uint8 Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool swap, Item* pSrcItem) const { - Item* pItem2 = GetItemByPos( bag, slot ); + Item* pItem2 = GetItemByPos(bag, slot); // ignore move item (this slot will be empty at move) if (pItem2==pSrcItem) @@ -9734,7 +9734,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV } else { - Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); + Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, bag); if (!pBag) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; @@ -9779,13 +9779,13 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV return EQUIP_ERR_OK; } -uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot ) const +uint8 Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const { // skip specific bag already processed in first called _CanStoreItem_InBag if (bag==skip_bag) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); + Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, bag); if (!pBag) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; @@ -9806,7 +9806,7 @@ uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototy if (j==skip_slot) continue; - Item* pItem2 = GetItemByPos( bag, j ); + Item* pItem2 = GetItemByPos(bag, j); // ignore move item (this slot will be empty at move) if (pItem2==pSrcItem) @@ -9855,7 +9855,7 @@ uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototy return EQUIP_ERR_OK; } -uint8 Player::_CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot ) const +uint8 Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const { for (uint32 j = slot_begin; j < slot_end; j++) { @@ -9863,7 +9863,7 @@ uint8 Player::_CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, if (INVENTORY_SLOT_BAG_0==skip_bag && j==skip_slot) continue; - Item* pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, j ); + Item* pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, j); // ignore move item (this slot will be empty at move) if (pItem2==pSrcItem) @@ -9911,9 +9911,9 @@ uint8 Player::_CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, return EQUIP_ERR_OK; } -uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item *pItem, bool swap, uint32* no_space_count ) const +uint8 Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item *pItem, bool swap, uint32* no_space_count) const { - sLog.outDebug( "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); + sLog.outDebug("STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); ItemPrototype const *pProto = objmgr.GetItemPrototype(entry); if (!pProto) @@ -10330,7 +10330,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } ////////////////////////////////////////////////////////////////////////// -uint8 Player::CanStoreItems( Item **pItems,int count) const +uint8 Player::CanStoreItems(Item **pItems,int count) const { Item *pItem2; @@ -10347,7 +10347,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem2 && !pItem2->IsInTrade()) { @@ -10357,7 +10357,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem2 && !pItem2->IsInTrade()) { @@ -10367,7 +10367,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const for (uint8 i = CURRENCYTOKEN_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); + pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem2 && !pItem2->IsInTrade()) { @@ -10377,11 +10377,11 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { for (uint32 j = 0; j < pBag->GetBagSize(); j++) { - pItem2 = GetItemByPos( i, j ); + pItem2 = GetItemByPos(i, j); if (pItem2 && !pItem2->IsInTrade()) { inv_bags[i-INVENTORY_SLOT_BAG_START][j] = pItem2->GetCount(); @@ -10398,11 +10398,11 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const // no item if (!pItem) continue; - sLog.outDebug( "STORAGE: CanStoreItems %i. item = %u, count = %u", k+1, pItem->GetEntry(), pItem->GetCount()); + sLog.outDebug("STORAGE: CanStoreItems %i. item = %u, count = %u", k+1, pItem->GetEntry(), pItem->GetCount()); ItemPrototype const *pProto = pItem->GetProto(); // strange item - if ( !pProto ) + if (!pProto) return EQUIP_ERR_ITEM_NOT_FOUND; // item it 'bind' @@ -10418,14 +10418,14 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const return res; // search stack for merge to - if ( pProto->Stackable != 1 ) + if (pProto->Stackable != 1) { bool b_found = false; for (int t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; ++t) { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if ( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) + pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, t); + if (pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) { inv_keys[t-KEYRING_SLOT_START] += pItem->GetCount(); b_found = true; @@ -10436,8 +10436,8 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if ( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) + pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, t); + if (pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) { inv_tokens[t-CURRENCYTOKEN_SLOT_START] += pItem->GetCount(); b_found = true; @@ -10448,8 +10448,8 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if ( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) + pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, t); + if (pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) { inv_slot_items[t-INVENTORY_SLOT_ITEM_START] += pItem->GetCount(); b_found = true; @@ -10460,13 +10460,13 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { - pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if ( pBag && ItemCanGoIntoBag(pItem->GetProto(), pBag->GetProto())) + pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, t); + if (pBag && ItemCanGoIntoBag(pItem->GetProto(), pBag->GetProto())) { for (uint32 j = 0; j < pBag->GetBagSize(); j++) { - pItem2 = GetItemByPos( t, j ); - if ( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize()) + pItem2 = GetItemByPos(t, j); + if (pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize()) { inv_bags[t-INVENTORY_SLOT_BAG_START][j] += pItem->GetCount(); b_found = true; @@ -10479,7 +10479,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } // special bag case - if ( pProto->BagFamily ) + if (pProto->BagFamily) { bool b_found = false; if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS) @@ -10487,7 +10487,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const uint32 keyringSize = GetMaxKeyringSize(); for (uint32 t = KEYRING_SLOT_START; t < KEYRING_SLOT_START+keyringSize; ++t) { - if ( inv_keys[t-KEYRING_SLOT_START] == 0 ) + if (inv_keys[t-KEYRING_SLOT_START] == 0) { inv_keys[t-KEYRING_SLOT_START] = 1; b_found = true; @@ -10502,7 +10502,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const { for (uint32 t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) { - if ( inv_tokens[t-CURRENCYTOKEN_SLOT_START] == 0 ) + if (inv_tokens[t-CURRENCYTOKEN_SLOT_START] == 0) { inv_tokens[t-CURRENCYTOKEN_SLOT_START] = 1; b_found = true; @@ -10515,18 +10515,18 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { - pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if ( pBag ) + pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, t); + if (pBag) { pBagProto = pBag->GetProto(); // not plain container check - if ( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) && - ItemCanGoIntoBag(pProto,pBagProto) ) + if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) && + ItemCanGoIntoBag(pProto,pBagProto)) { for (uint32 j = 0; j < pBag->GetBagSize(); j++) { - if ( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) + if (inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0) { inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1; b_found = true; @@ -10543,7 +10543,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const bool b_found = false; for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) { - if ( inv_slot_items[t-INVENTORY_SLOT_ITEM_START] == 0 ) + if (inv_slot_items[t-INVENTORY_SLOT_ITEM_START] == 0) { inv_slot_items[t-INVENTORY_SLOT_ITEM_START] = 1; b_found = true; @@ -10555,18 +10555,18 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const // search free slot in bags for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { - pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if ( pBag ) + pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, t); + if (pBag) { pBagProto = pBag->GetProto(); // special bag already checked - if ( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER)) + if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER)) continue; for (uint32 j = 0; j < pBag->GetBagSize(); j++) { - if ( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) + if (inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0) { inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1; b_found = true; @@ -10585,13 +10585,13 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } ////////////////////////////////////////////////////////////////////////// -uint8 Player::CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, bool swap ) const +uint8 Player::CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) const { dest = 0; - Item *pItem = Item::CreateItem( item, 1, this ); - if ( pItem ) + Item *pItem = Item::CreateItem(item, 1, this); + if (pItem) { - uint8 result = CanEquipItem(slot, dest, pItem, swap ); + uint8 result = CanEquipItem(slot, dest, pItem, swap); delete pItem; return result; } @@ -10599,14 +10599,14 @@ uint8 Player::CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, bool swap return EQUIP_ERR_ITEM_NOT_FOUND; } -uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading ) const +uint8 Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading) const { dest = 0; - if ( pItem ) + if (pItem) { - sLog.outDebug( "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount()); + sLog.outDebug("STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount()); ItemPrototype const *pProto = pItem->GetProto(); - if ( pProto ) + if (pProto) { if (pItem->IsBindedNotWith(this)) return EQUIP_ERR_DONT_OWN_THAT_ITEM; @@ -10627,13 +10627,13 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo // do not allow equipping gear except weapons, offhands, projectiles, relics in // - combat // - in-progress arenas - if ( !pProto->CanChangeEquipStateInCombat() ) + if (!pProto->CanChangeEquipStateInCombat()) { - if ( isInCombat() ) + if (isInCombat()) return EQUIP_ERR_NOT_IN_COMBAT; if (BattleGround* bg = GetBattleGround()) - if ( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS ) + if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS) return EQUIP_ERR_NOT_DURING_ARENA_MATCH; } @@ -10649,7 +10649,7 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < getLevel()) return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; - uint8 eslot = FindEquipSlot( pProto, slot, swap ); + uint8 eslot = FindEquipSlot(pProto, slot, swap); if (eslot == NULL_SLOT) return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; @@ -10717,11 +10717,11 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo if (!CanTitanGrip()) { // offhand item must can be stored in inventory for offhand item and it also must be unequipped - Item *offItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND ); + Item *offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); ItemPosCountVec off_dest; if (offItem && (!not_loading || CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND,false) != EQUIP_ERR_OK || - CanStoreItem( NULL_BAG, NULL_SLOT, off_dest, offItem, false ) != EQUIP_ERR_OK )) + CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) != EQUIP_ERR_OK)) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_INVENTORY_FULL; } } @@ -10733,7 +10733,7 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo return !swap ? EQUIP_ERR_ITEM_NOT_FOUND : EQUIP_ERR_ITEMS_CANT_BE_SWAPPED; } -uint8 Player::CanUnequipItem( uint16 pos, bool swap ) const +uint8 Player::CanUnequipItem(uint16 pos, bool swap) const { // Applied only to equipped items and bank bags if (!IsEquipmentPos(pos) && !IsBagPos(pos)) @@ -10742,25 +10742,25 @@ uint8 Player::CanUnequipItem( uint16 pos, bool swap ) const Item* pItem = GetItemByPos(pos); // Applied only to existed equipped item - if ( !pItem ) + if (!pItem) return EQUIP_ERR_OK; - sLog.outDebug( "STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount()); + sLog.outDebug("STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount()); ItemPrototype const *pProto = pItem->GetProto(); - if ( !pProto ) + if (!pProto) return EQUIP_ERR_ITEM_NOT_FOUND; // do not allow unequipping gear except weapons, offhands, projectiles, relics in // - combat // - in-progress arenas - if ( !pProto->CanChangeEquipStateInCombat() ) + if (!pProto->CanChangeEquipStateInCombat()) { - if ( isInCombat() ) + if (isInCombat()) return EQUIP_ERR_NOT_IN_COMBAT; if (BattleGround* bg = GetBattleGround()) - if ( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS ) + if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS) return EQUIP_ERR_NOT_DURING_ARENA_MATCH; } @@ -10770,7 +10770,7 @@ uint8 Player::CanUnequipItem( uint16 pos, bool swap ) const return EQUIP_ERR_OK; } -uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading ) const +uint8 Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading) const { if (!pItem) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; @@ -10783,7 +10783,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p uint32 count = pItem->GetCount(); - sLog.outDebug( "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); + sLog.outDebug("STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); ItemPrototype const *pProto = pItem->GetProto(); if (!pProto) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; @@ -10807,7 +10807,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p if (slot - BANK_SLOT_BAG_START >= GetBankBagSlotCount()) return EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT; - if (uint8 cantuse = CanUseItem( pItem, not_loading ) != EQUIP_ERR_OK) + if (uint8 cantuse = CanUseItem(pItem, not_loading) != EQUIP_ERR_OK) return cantuse; } @@ -10822,19 +10822,19 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p // not specific slot or have space for partly store only in specific slot // in specific bag - if ( bag != NULL_BAG ) + if (bag != NULL_BAG) { - if ( pProto->InventoryType == INVTYPE_BAG ) + if (pProto->InventoryType == INVTYPE_BAG) { Bag *pBag = (Bag*)pItem; - if ( pBag && !pBag->IsEmpty() ) + if (pBag && !pBag->IsEmpty()) return EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG; } // search stack in bag for merge to - if ( pProto->Stackable != 1 ) + if (pProto->Stackable != 1) { - if ( bag == INVENTORY_SLOT_BAG_0 ) + if (bag == INVENTORY_SLOT_BAG_0) { res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,true,pItem,bag,slot); if (res!=EQUIP_ERR_OK) @@ -10858,7 +10858,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p } // search free slot in bag - if ( bag == INVENTORY_SLOT_BAG_0 ) + if (bag == INVENTORY_SLOT_BAG_0) { res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,false,pItem,bag,slot); if (res!=EQUIP_ERR_OK) @@ -10884,7 +10884,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p // not specific bag or have space for partly store only in specific bag // search stack for merge to - if ( pProto->Stackable != 1 ) + if (pProto->Stackable != 1) { // in slots res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,true,pItem,bag,slot); @@ -10895,7 +10895,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p return EQUIP_ERR_OK; // in special bags - if ( pProto->BagFamily ) + if (pProto->BagFamily) { for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { @@ -10920,7 +10920,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p } // search free place in special bag - if ( pProto->BagFamily ) + if (pProto->BagFamily) { for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { @@ -10953,11 +10953,11 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p return EQUIP_ERR_BANK_FULL; } -uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const +uint8 Player::CanUseItem(Item *pItem, bool not_loading) const { if (pItem) { - sLog.outDebug( "STORAGE: CanUseItem item = %u", pItem->GetEntry()); + sLog.outDebug("STORAGE: CanUseItem item = %u", pItem->GetEntry()); if (!isAlive() && not_loading) return EQUIP_ERR_YOU_ARE_DEAD; @@ -11004,10 +11004,10 @@ uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const if (pProto->RequiredSkill != 0) { - if (GetSkillValue( pProto->RequiredSkill ) == 0) + if (GetSkillValue(pProto->RequiredSkill) == 0) return EQUIP_ERR_NO_REQUIRED_PROFICIENCY; - if (GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank) + if (GetSkillValue(pProto->RequiredSkill) < pProto->RequiredSkillRank) return EQUIP_ERR_ERR_CANT_EQUIP_SKILL; } @@ -11026,57 +11026,57 @@ uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const return EQUIP_ERR_ITEM_NOT_FOUND; } -bool Player::CanUseItem( ItemPrototype const *pProto ) +bool Player::CanUseItem(ItemPrototype const *pProto) { // Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player - if ( pProto ) + if (pProto) { - if ( (pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0 ) + if ((pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0) return false; - if ( pProto->RequiredSkill != 0 ) + if (pProto->RequiredSkill != 0) { - if ( GetSkillValue( pProto->RequiredSkill ) == 0 ) + if (GetSkillValue(pProto->RequiredSkill) == 0) return false; - else if ( GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank ) + else if (GetSkillValue(pProto->RequiredSkill) < pProto->RequiredSkillRank) return false; } - if ( pProto->RequiredSpell != 0 && !HasSpell( pProto->RequiredSpell ) ) + if (pProto->RequiredSpell != 0 && !HasSpell(pProto->RequiredSpell)) return false; - if ( getLevel() < pProto->RequiredLevel ) + if (getLevel() < pProto->RequiredLevel) return false; return true; } return false; } -uint8 Player::CanUseAmmo( uint32 item ) const +uint8 Player::CanUseAmmo(uint32 item) const { - sLog.outDebug( "STORAGE: CanUseAmmo item = %u", item); - if ( !isAlive() ) + sLog.outDebug("STORAGE: CanUseAmmo item = %u", item); + if (!isAlive()) return EQUIP_ERR_YOU_ARE_DEAD; - //if ( isStunned() ) + //if (isStunned()) // return EQUIP_ERR_YOU_ARE_STUNNED; - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); - if ( pProto ) + ItemPrototype const *pProto = objmgr.GetItemPrototype(item); + if (pProto) { - if ( pProto->InventoryType!= INVTYPE_AMMO ) + if (pProto->InventoryType!= INVTYPE_AMMO) return EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE; - if ( (pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0 ) + if ((pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0) return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM; - if ( pProto->RequiredSkill != 0 ) + if (pProto->RequiredSkill != 0) { - if ( GetSkillValue( pProto->RequiredSkill ) == 0 ) + if (GetSkillValue(pProto->RequiredSkill) == 0) return EQUIP_ERR_NO_REQUIRED_PROFICIENCY; - else if ( GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank ) + else if (GetSkillValue(pProto->RequiredSkill) < pProto->RequiredSkillRank) return EQUIP_ERR_ERR_CANT_EQUIP_SKILL; } - if ( pProto->RequiredSpell != 0 && !HasSpell( pProto->RequiredSpell ) ) + if (pProto->RequiredSpell != 0 && !HasSpell(pProto->RequiredSpell)) return EQUIP_ERR_NO_REQUIRED_PROFICIENCY; - /*if ( GetReputationMgr().GetReputation() < pProto->RequiredReputation ) + /*if (GetReputationMgr().GetReputation() < pProto->RequiredReputation) return EQUIP_ERR_CANT_EQUIP_REPUTATION; */ - if ( getLevel() < pProto->RequiredLevel ) + if (getLevel() < pProto->RequiredLevel) return EQUIP_ERR_CANT_EQUIP_LEVEL_I; // Requires No Ammo @@ -11088,22 +11088,22 @@ uint8 Player::CanUseAmmo( uint32 item ) const return EQUIP_ERR_ITEM_NOT_FOUND; } -void Player::SetAmmo( uint32 item ) +void Player::SetAmmo(uint32 item) { if (!item) return; // already set - if ( GetUInt32Value(PLAYER_AMMO_ID) == item ) + if (GetUInt32Value(PLAYER_AMMO_ID) == item) return; // check ammo if (item) { - uint8 msg = CanUseAmmo( item ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = CanUseAmmo(item); + if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, NULL, NULL ); + SendEquipError(msg, NULL, NULL); return; } } @@ -11124,27 +11124,27 @@ void Player::RemoveAmmo() } // Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case. -Item* Player::StoreNewItem( ItemPosCountVec const& dest, uint32 item, bool update,int32 randomPropertyId ) +Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update,int32 randomPropertyId) { uint32 count = 0; for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) count += itr->count; - Item *pItem = Item::CreateItem( item, count, this ); - if ( pItem ) + Item *pItem = Item::CreateItem(item, count, this); + if (pItem) { - ItemAddedQuestCheck( item, count ); + ItemAddedQuestCheck(item, count); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count); if (randomPropertyId) pItem->SetItemRandomProperties(randomPropertyId); - pItem = StoreItem( dest, pItem, update ); + pItem = StoreItem(dest, pItem, update); } return pItem; } -Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update ) +Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update) { - if ( !pItem ) + if (!pItem) return NULL; Item* lastItem = pItem; @@ -11169,17 +11169,17 @@ Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update ) } // Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case. -Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, bool update ) +Item* Player::_StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update) { - if ( !pItem ) + if (!pItem) return NULL; uint8 bag = pos >> 8; uint8 slot = pos & 255; - sLog.outDebug( "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); + sLog.outDebug("STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); - Item *pItem2 = GetItemByPos( bag, slot ); + Item *pItem2 = GetItemByPos(bag, slot); if (!pItem2) { @@ -11194,17 +11194,17 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo if (pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM || (pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos))) - pItem->SetBinding( true ); + pItem->SetBinding(true); if (bag == INVENTORY_SLOT_BAG_0) { m_items[slot] = pItem; - SetUInt64Value( PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID() ); - pItem->SetUInt64Value( ITEM_FIELD_CONTAINED, GetGUID() ); - pItem->SetUInt64Value( ITEM_FIELD_OWNER, GetGUID() ); + SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); + pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID()); + pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetGUID()); - pItem->SetSlot( slot ); - pItem->SetContainer( NULL ); + pItem->SetSlot(slot); + pItem->SetContainer(NULL); // need update known currency if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) @@ -11213,18 +11213,18 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo if (IsInWorld() && update) { pItem->AddToWorld(); - pItem->SendUpdateToPlayer( this ); + pItem->SendUpdateToPlayer(this); } pItem->SetState(ITEM_CHANGED, this); } - else if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag )) + else if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, bag)) { - pBag->StoreItem( slot, pItem, update ); - if ( IsInWorld() && update ) + pBag->StoreItem(slot, pItem, update); + if (IsInWorld() && update) { pItem->AddToWorld(); - pItem->SendUpdateToPlayer( this ); + pItem->SendUpdateToPlayer(this); } pItem->SetState(ITEM_CHANGED, this); pBag->SetState(ITEM_CHANGED, this); @@ -11240,11 +11240,11 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo if (pItem2->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem2->GetProto()->Bonding == BIND_QUEST_ITEM || (pItem2->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos))) - pItem2->SetBinding( true ); + pItem2->SetBinding(true); - pItem2->SetCount( pItem2->GetCount() + count ); + pItem2->SetCount(pItem2->GetCount() + count); if (IsInWorld() && update) - pItem2->SendUpdateToPlayer( this ); + pItem2->SendUpdateToPlayer(this); if (!clone) { @@ -11252,7 +11252,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo if (IsInWorld() && update) { pItem->RemoveFromWorld(); - pItem->DestroyForPlayer( this ); + pItem->DestroyForPlayer(this); } RemoveEnchantmentDurations(pItem); @@ -11272,19 +11272,19 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo } } -Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update ) +Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update) { - if (Item *pItem = Item::CreateItem( item, 1, this )) + if (Item *pItem = Item::CreateItem(item, 1, this)) { - ItemAddedQuestCheck( item, 1 ); + ItemAddedQuestCheck(item, 1); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, 1); - return EquipItem( pos, pItem, update ); + return EquipItem(pos, pItem, update); } return NULL; } -Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) +Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) { AddEnchantmentDurations(pItem); AddItemDurations(pItem); @@ -11292,11 +11292,11 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) uint8 bag = pos >> 8; uint8 slot = pos & 255; - Item *pItem2 = GetItemByPos( bag, slot ); + Item *pItem2 = GetItemByPos(bag, slot); - if ( !pItem2 ) + if (!pItem2) { - VisualizeItem( slot, pItem); + VisualizeItem(slot, pItem); if (isAlive()) { @@ -11333,20 +11333,20 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) } } - if ( IsInWorld() && update ) + if (IsInWorld() && update) { pItem->AddToWorld(); - pItem->SendUpdateToPlayer( this ); + pItem->SendUpdateToPlayer(this); } ApplyEquipCooldown(pItem); // update expertise and armor penetration - passive auras may need it - if ( slot == EQUIPMENT_SLOT_MAINHAND ) + if (slot == EQUIPMENT_SLOT_MAINHAND) UpdateExpertise(BASE_ATTACK); - else if ( slot == EQUIPMENT_SLOT_OFFHAND ) + else if (slot == EQUIPMENT_SLOT_OFFHAND) UpdateExpertise(OFF_ATTACK); switch(slot) @@ -11361,16 +11361,16 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) } else { - pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() ); - if ( IsInWorld() && update ) - pItem2->SendUpdateToPlayer( this ); + pItem2->SetCount(pItem2->GetCount() + pItem->GetCount()); + if (IsInWorld() && update) + pItem2->SendUpdateToPlayer(this); // delete item (it not in any slot currently) //pItem->DeleteFromDB(); - if ( IsInWorld() && update ) + if (IsInWorld() && update) { pItem->RemoveFromWorld(); - pItem->DestroyForPlayer( this ); + pItem->DestroyForPlayer(this); } RemoveEnchantmentDurations(pItem); @@ -11393,20 +11393,20 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) return pItem; } -void Player::QuickEquipItem( uint16 pos, Item *pItem) +void Player::QuickEquipItem(uint16 pos, Item *pItem) { - if ( pItem ) + if (pItem) { AddEnchantmentDurations(pItem); AddItemDurations(pItem); uint8 slot = pos & 255; - VisualizeItem( slot, pItem); + VisualizeItem(slot, pItem); - if ( IsInWorld() ) + if (IsInWorld()) { pItem->AddToWorld(); - pItem->SendUpdateToPlayer( this ); + pItem->SendUpdateToPlayer(this); } GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); @@ -11429,25 +11429,25 @@ void Player::SetVisibleItemSlot(uint8 slot, Item *pItem) } } -void Player::VisualizeItem( uint8 slot, Item *pItem) +void Player::VisualizeItem(uint8 slot, Item *pItem) { if (!pItem) return; // check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory) - if ( pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM ) - pItem->SetBinding( true ); + if (pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM) + pItem->SetBinding(true); - sLog.outDebug( "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); + sLog.outDebug("STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); m_items[slot] = pItem; - SetUInt64Value( PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID() ); - pItem->SetUInt64Value( ITEM_FIELD_CONTAINED, GetGUID() ); - pItem->SetUInt64Value( ITEM_FIELD_OWNER, GetGUID() ); - pItem->SetSlot( slot ); - pItem->SetContainer( NULL ); + SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); + pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID()); + pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetGUID()); + pItem->SetSlot(slot); + pItem->SetContainer(NULL); - if ( slot < EQUIPMENT_SLOT_END ) + if (slot < EQUIPMENT_SLOT_END) SetVisibleItemSlot(slot, pItem); pItem->SetState(ITEM_CHANGED, this); @@ -11463,7 +11463,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) Item *pItem = GetItemByPos(bag, slot); if (pItem) { - sLog.outDebug( "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + sLog.outDebug("STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); RemoveEnchantmentDurations(pItem); RemoveItemDurations(pItem); @@ -11583,7 +11583,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) Item *pItem = GetItemByPos(bag, slot); if (pItem) { - sLog.outDebug( "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + sLog.outDebug("STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); // start from destroy contained items (only equipped bag can have its) if (pItem->IsBag() && pItem->IsEquipped()) // this also prevent infinity loop if empty bag stored in bag==slot @@ -11600,7 +11600,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) pItem->SetNotRefundable(this); - ItemRemovedQuestCheck( pItem->GetEntry(), pItem->GetCount() ); + ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount()); if (bag == INVENTORY_SLOT_BAG_0) { @@ -11618,7 +11618,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) _ApplyItemMods(pItem, slot, false); } - if ( slot < EQUIPMENT_SLOT_END ) + if (slot < EQUIPMENT_SLOT_END) { // remove item dependent auras and casts (only weapon and armor slots) RemoveItemDependentAurasAndCasts(pItem); @@ -11648,7 +11648,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) m_items[slot] = NULL; } - else if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag )) + else if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, bag)) pBag->RemoveItem(slot, update); if (IsInWorld() && update) @@ -11666,13 +11666,13 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check) { - sLog.outDebug( "STORAGE: DestroyItemCount item = %u, count = %u", item, count); + sLog.outDebug("STORAGE: DestroyItemCount item = %u, count = %u", item, count); uint32 remcount = 0; // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) { - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { if (pItem->GetEntry() == item) { @@ -11680,7 +11680,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ { // all items in inventory can unequipped remcount += pItem->GetCount(); - DestroyItem( INVENTORY_SLOT_BAG_0, i, update); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); if (remcount >= count) return; @@ -11690,7 +11690,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); pItem->SetCount(pItem->GetCount() - count + remcount); if (IsInWorld() & update) - pItem->SendUpdateToPlayer( this ); + pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); return; } @@ -11700,7 +11700,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { if (pItem->GetEntry() == item) { @@ -11708,17 +11708,17 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ { // all keys can be unequipped remcount += pItem->GetCount(); - DestroyItem( INVENTORY_SLOT_BAG_0, i, update); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); if (remcount >= count) return; } else { - ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount ); - pItem->SetCount( pItem->GetCount() - count + remcount ); + ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); + pItem->SetCount(pItem->GetCount() - count + remcount); if (IsInWorld() & update) - pItem->SendUpdateToPlayer( this ); + pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); return; } @@ -11729,7 +11729,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ // in inventory bags for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { - if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { for (uint32 j = 0; j < pBag->GetBagSize(); j++) { @@ -11741,17 +11741,17 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ if (pItem->GetCount() + remcount <= count) { remcount += pItem->GetCount(); - DestroyItem( i, j, update ); + DestroyItem(i, j, update); if (remcount >= count) return; } else { - ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount ); - pItem->SetCount( pItem->GetCount() - count + remcount ); + ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); + pItem->SetCount(pItem->GetCount() - count + remcount); if (IsInWorld() && update) - pItem->SendUpdateToPlayer( this ); + pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); return; } @@ -11764,16 +11764,16 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ // in equipment and bag list for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) { - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { if (pItem && pItem->GetEntry() == item) { if (pItem->GetCount() + remcount <= count) { - if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK ) + if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK) { remcount += pItem->GetCount(); - DestroyItem( INVENTORY_SLOT_BAG_0, i, update); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); if (remcount >= count) return; @@ -11781,10 +11781,10 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ } else { - ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount ); - pItem->SetCount( pItem->GetCount() - count + remcount ); + ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount); + pItem->SetCount(pItem->GetCount() - count + remcount); if (IsInWorld() & update) - pItem->SendUpdateToPlayer( this ); + pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); return; } @@ -11793,24 +11793,24 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ } } -void Player::DestroyZoneLimitedItem( bool update, uint32 new_zone ) +void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone) { - sLog.outDebug( "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone ); + sLog.outDebug("STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) - DestroyItem( INVENTORY_SLOT_BAG_0, i, update); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) - DestroyItem( INVENTORY_SLOT_BAG_0, i, update); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); // in inventory bags for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) for (uint32 j = 0; j < pBag->GetBagSize(); j++) if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) @@ -11818,36 +11818,36 @@ void Player::DestroyZoneLimitedItem( bool update, uint32 new_zone ) // in equipment and bag list for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) - DestroyItem( INVENTORY_SLOT_BAG_0, i, update); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); } -void Player::DestroyConjuredItems( bool update ) +void Player::DestroyConjuredItems(bool update) { // used when entering arena // destroys all conjured items - sLog.outDebug( "STORAGE: DestroyConjuredItems" ); + sLog.outDebug("STORAGE: DestroyConjuredItems"); // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->IsConjuredConsumable()) - DestroyItem( INVENTORY_SLOT_BAG_0, i, update); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); // in inventory bags for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) for (uint32 j = 0; j < pBag->GetBagSize(); j++) if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->IsConjuredConsumable()) - DestroyItem( i, j, update); + DestroyItem(i, j, update); // in equipment and bag list for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->IsConjuredConsumable()) - DestroyItem( INVENTORY_SLOT_BAG_0, i, update); + DestroyItem(INVENTORY_SLOT_BAG_0, i, update); } Item* Player::GetItemByEntry(uint32 entry) const @@ -11855,7 +11855,7 @@ Item* Player::GetItemByEntry(uint32 entry) const // in inventory for (int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) { - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == entry) return pItem; } @@ -11863,7 +11863,7 @@ Item* Player::GetItemByEntry(uint32 entry) const for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { for (uint32 j = 0; j < pBag->GetBagSize(); ++j) { @@ -11877,7 +11877,7 @@ Item* Player::GetItemByEntry(uint32 entry) const for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i) { - if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry()==entry) return pItem; } @@ -11885,31 +11885,31 @@ Item* Player::GetItemByEntry(uint32 entry) const return NULL; } -void Player::DestroyItemCount( Item* pItem, uint32 &count, bool update ) +void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update) { if (!pItem) return; - sLog.outDebug( "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(),pItem->GetEntry(), count); + sLog.outDebug("STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(),pItem->GetEntry(), count); - if ( pItem->GetCount() <= count ) + if (pItem->GetCount() <= count) { count -= pItem->GetCount(); - DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), update); + DestroyItem(pItem->GetBagSlot(),pItem->GetSlot(), update); } else { - ItemRemovedQuestCheck( pItem->GetEntry(), count); - pItem->SetCount( pItem->GetCount() - count ); + ItemRemovedQuestCheck(pItem->GetEntry(), count); + pItem->SetCount(pItem->GetCount() - count); count = 0; - if ( IsInWorld() & update ) - pItem->SendUpdateToPlayer( this ); + if (IsInWorld() & update) + pItem->SendUpdateToPlayer(this); pItem->SetState(ITEM_CHANGED, this); } } -void Player::SplitItem( uint16 src, uint16 dst, uint32 count ) +void Player::SplitItem(uint16 src, uint16 dst, uint32 count) { uint8 srcbag = src >> 8; uint8 srcslot = src & 255; @@ -11917,106 +11917,106 @@ void Player::SplitItem( uint16 src, uint16 dst, uint32 count ) uint8 dstbag = dst >> 8; uint8 dstslot = dst & 255; - Item *pSrcItem = GetItemByPos( srcbag, srcslot ); - if ( !pSrcItem ) + Item *pSrcItem = GetItemByPos(srcbag, srcslot); + if (!pSrcItem) { - SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL ); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL); return; } // not let split all items (can be only at cheating) if (pSrcItem->GetCount() == count) { - SendEquipError( EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL ); + SendEquipError(EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL); return; } // not let split more existed items (can be only at cheating) if (pSrcItem->GetCount() < count) { - SendEquipError( EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, pSrcItem, NULL ); + SendEquipError(EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, pSrcItem, NULL); return; } if (pSrcItem->m_lootGenerated) // prevent split looting item (item { //best error message found for attempting to split while looting - SendEquipError( EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL ); + SendEquipError(EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL); return; } - sLog.outDebug( "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); - Item *pNewItem = pSrcItem->CloneItem( count, this ); - if ( !pNewItem ) + sLog.outDebug("STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); + Item *pNewItem = pSrcItem->CloneItem(count, this); + if (!pNewItem) { - SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL ); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL); return; } - if ( IsInventoryPos( dst ) ) + if (IsInventoryPos(dst)) { // change item amount before check (for unique max count check) - pSrcItem->SetCount( pSrcItem->GetCount() - count ); + pSrcItem->SetCount(pSrcItem->GetCount() - count); ItemPosCountVec dest; - uint8 msg = CanStoreItem( dstbag, dstslot, dest, pNewItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false); + if (msg != EQUIP_ERR_OK) { delete pNewItem; - pSrcItem->SetCount( pSrcItem->GetCount() + count ); - SendEquipError( msg, pSrcItem, NULL ); + pSrcItem->SetCount(pSrcItem->GetCount() + count); + SendEquipError(msg, pSrcItem, NULL); return; } - if ( IsInWorld() ) - pSrcItem->SendUpdateToPlayer( this ); + if (IsInWorld()) + pSrcItem->SendUpdateToPlayer(this); pSrcItem->SetState(ITEM_CHANGED, this); - StoreItem( dest, pNewItem, true); + StoreItem(dest, pNewItem, true); } - else if ( IsBankPos ( dst ) ) + else if (IsBankPos (dst)) { // change item amount before check (for unique max count check) - pSrcItem->SetCount( pSrcItem->GetCount() - count ); + pSrcItem->SetCount(pSrcItem->GetCount() - count); ItemPosCountVec dest; - uint8 msg = CanBankItem( dstbag, dstslot, dest, pNewItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false); + if (msg != EQUIP_ERR_OK) { delete pNewItem; - pSrcItem->SetCount( pSrcItem->GetCount() + count ); - SendEquipError( msg, pSrcItem, NULL ); + pSrcItem->SetCount(pSrcItem->GetCount() + count); + SendEquipError(msg, pSrcItem, NULL); return; } - if ( IsInWorld() ) - pSrcItem->SendUpdateToPlayer( this ); + if (IsInWorld()) + pSrcItem->SendUpdateToPlayer(this); pSrcItem->SetState(ITEM_CHANGED, this); - BankItem( dest, pNewItem, true); + BankItem(dest, pNewItem, true); } - else if ( IsEquipmentPos ( dst ) ) + else if (IsEquipmentPos (dst)) { // change item amount before check (for unique max count check), provide space for splitted items - pSrcItem->SetCount( pSrcItem->GetCount() - count ); + pSrcItem->SetCount(pSrcItem->GetCount() - count); uint16 dest; - uint8 msg = CanEquipItem( dstslot, dest, pNewItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = CanEquipItem(dstslot, dest, pNewItem, false); + if (msg != EQUIP_ERR_OK) { delete pNewItem; - pSrcItem->SetCount( pSrcItem->GetCount() + count ); - SendEquipError( msg, pSrcItem, NULL ); + pSrcItem->SetCount(pSrcItem->GetCount() + count); + SendEquipError(msg, pSrcItem, NULL); return; } - if ( IsInWorld() ) - pSrcItem->SendUpdateToPlayer( this ); + if (IsInWorld()) + pSrcItem->SendUpdateToPlayer(this); pSrcItem->SetState(ITEM_CHANGED, this); - EquipItem( dest, pNewItem, true); + EquipItem(dest, pNewItem, true); AutoUnequipOffhandIfNeed(); } } -void Player::SwapItem( uint16 src, uint16 dst ) +void Player::SwapItem(uint16 src, uint16 dst) { uint8 srcbag = src >> 8; uint8 srcslot = src & 255; @@ -12024,17 +12024,17 @@ void Player::SwapItem( uint16 src, uint16 dst ) uint8 dstbag = dst >> 8; uint8 dstslot = dst & 255; - Item *pSrcItem = GetItemByPos( srcbag, srcslot ); - Item *pDstItem = GetItemByPos( dstbag, dstslot ); + Item *pSrcItem = GetItemByPos(srcbag, srcslot); + Item *pDstItem = GetItemByPos(dstbag, dstslot); - if ( !pSrcItem ) + if (!pSrcItem) return; - sLog.outDebug( "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); + sLog.outDebug("STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); - if (!isAlive() ) + if (!isAlive()) { - SendEquipError( EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem ); + SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem); return; } @@ -12043,26 +12043,26 @@ void Player::SwapItem( uint16 src, uint16 dst ) if (pSrcItem->m_lootGenerated) // prevent swap looting item { //best error message found for attempting to swap while looting - SendEquipError( EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL ); + SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL); return; } // check unequip potability for equipped items and bank bags - if (IsEquipmentPos ( src ) || IsBagPos ( src )) + if (IsEquipmentPos (src) || IsBagPos (src)) { // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) - uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty())); + uint8 msg = CanUnequipItem(src, !IsBagPos (src) || IsBagPos (dst) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty())); if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, pSrcItem, pDstItem ); + SendEquipError(msg, pSrcItem, pDstItem); return; } } // prevent put equipped/bank bag in self - if ( IsBagPos ( src ) && srcslot == dstbag) + if (IsBagPos (src) && srcslot == dstbag) { - SendEquipError( EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, pSrcItem, pDstItem ); + SendEquipError(EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, pSrcItem, pDstItem); return; } @@ -12073,18 +12073,18 @@ void Player::SwapItem( uint16 src, uint16 dst ) if (pDstItem->m_lootGenerated) // prevent swap looting item { //best error message found for attempting to swap while looting - SendEquipError( EQUIP_ERR_CANT_DO_RIGHT_NOW, pDstItem, NULL ); + SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pDstItem, NULL); return; } // check unequip potability for equipped items and bank bags - if (IsEquipmentPos ( dst ) || IsBagPos ( dst )) + if (IsEquipmentPos (dst) || IsBagPos (dst)) { // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) - uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty())); + uint8 msg = CanUnequipItem(dst, !IsBagPos (dst) || IsBagPos (src) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty())); if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, pSrcItem, pDstItem ); + SendEquipError(msg, pSrcItem, pDstItem); return; } } @@ -12094,41 +12094,41 @@ void Player::SwapItem( uint16 src, uint16 dst ) // or swap empty bag with another empty or not empty bag (with items exchange) // Move case - if ( !pDstItem ) + if (!pDstItem) { - if ( IsInventoryPos( dst ) ) + if (IsInventoryPos(dst)) { ItemPosCountVec dest; - uint8 msg = CanStoreItem( dstbag, dstslot, dest, pSrcItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = CanStoreItem(dstbag, dstslot, dest, pSrcItem, false); + if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, pSrcItem, NULL ); + SendEquipError(msg, pSrcItem, NULL); return; } RemoveItem(srcbag, srcslot, true); - StoreItem( dest, pSrcItem, true); + StoreItem(dest, pSrcItem, true); } - else if ( IsBankPos ( dst ) ) + else if (IsBankPos (dst)) { ItemPosCountVec dest; - uint8 msg = CanBankItem( dstbag, dstslot, dest, pSrcItem, false); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false); + if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, pSrcItem, NULL ); + SendEquipError(msg, pSrcItem, NULL); return; } RemoveItem(srcbag, srcslot, true); - BankItem( dest, pSrcItem, true); + BankItem(dest, pSrcItem, true); } - else if ( IsEquipmentPos ( dst ) ) + else if (IsEquipmentPos (dst)) { uint16 dest; - uint8 msg = CanEquipItem( dstslot, dest, pSrcItem, false ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = CanEquipItem(dstslot, dest, pSrcItem, false); + if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, pSrcItem, NULL ); + SendEquipError(msg, pSrcItem, NULL); return; } @@ -12146,42 +12146,42 @@ void Player::SwapItem( uint16 src, uint16 dst ) uint8 msg; ItemPosCountVec sDest; uint16 eDest; - if ( IsInventoryPos( dst ) ) - msg = CanStoreItem( dstbag, dstslot, sDest, pSrcItem, false ); - else if ( IsBankPos ( dst ) ) - msg = CanBankItem( dstbag, dstslot, sDest, pSrcItem, false ); - else if ( IsEquipmentPos ( dst ) ) - msg = CanEquipItem( dstslot, eDest, pSrcItem, false ); + if (IsInventoryPos(dst)) + msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, false); + else if (IsBankPos (dst)) + msg = CanBankItem(dstbag, dstslot, sDest, pSrcItem, false); + else if (IsEquipmentPos (dst)) + msg = CanEquipItem(dstslot, eDest, pSrcItem, false); else return; // can be merge/fill if (msg == EQUIP_ERR_OK) { - if ( pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetProto()->GetMaxStackSize()) + if (pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetProto()->GetMaxStackSize()) { RemoveItem(srcbag, srcslot, true); - if ( IsInventoryPos( dst ) ) - StoreItem( sDest, pSrcItem, true); - else if ( IsBankPos ( dst ) ) - BankItem( sDest, pSrcItem, true); - else if ( IsEquipmentPos ( dst ) ) + if (IsInventoryPos(dst)) + StoreItem(sDest, pSrcItem, true); + else if (IsBankPos (dst)) + BankItem(sDest, pSrcItem, true); + else if (IsEquipmentPos (dst)) { - EquipItem( eDest, pSrcItem, true); + EquipItem(eDest, pSrcItem, true); AutoUnequipOffhandIfNeed(); } } else { - pSrcItem->SetCount( pSrcItem->GetCount() + pDstItem->GetCount() - pSrcItem->GetProto()->GetMaxStackSize()); - pDstItem->SetCount( pSrcItem->GetProto()->GetMaxStackSize()); + pSrcItem->SetCount(pSrcItem->GetCount() + pDstItem->GetCount() - pSrcItem->GetProto()->GetMaxStackSize()); + pDstItem->SetCount(pSrcItem->GetProto()->GetMaxStackSize()); pSrcItem->SetState(ITEM_CHANGED, this); pDstItem->SetState(ITEM_CHANGED, this); - if ( IsInWorld() ) + if (IsInWorld()) { - pSrcItem->SendUpdateToPlayer( this ); - pDstItem->SendUpdateToPlayer( this ); + pSrcItem->SendUpdateToPlayer(this); + pDstItem->SendUpdateToPlayer(this); } } return; @@ -12194,40 +12194,40 @@ void Player::SwapItem( uint16 src, uint16 dst ) // check src->dest move possibility ItemPosCountVec sDest; uint16 eDest = 0; - if ( IsInventoryPos( dst ) ) - msg = CanStoreItem( dstbag, dstslot, sDest, pSrcItem, true ); - else if ( IsBankPos( dst ) ) - msg = CanBankItem( dstbag, dstslot, sDest, pSrcItem, true ); - else if ( IsEquipmentPos( dst ) ) + if (IsInventoryPos(dst)) + msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, true); + else if (IsBankPos(dst)) + msg = CanBankItem(dstbag, dstslot, sDest, pSrcItem, true); + else if (IsEquipmentPos(dst)) { - msg = CanEquipItem( dstslot, eDest, pSrcItem, true ); - if ( msg == EQUIP_ERR_OK ) - msg = CanUnequipItem( eDest, true ); + msg = CanEquipItem(dstslot, eDest, pSrcItem, true); + if (msg == EQUIP_ERR_OK) + msg = CanUnequipItem(eDest, true); } - if ( msg != EQUIP_ERR_OK ) + if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, pSrcItem, pDstItem ); + SendEquipError(msg, pSrcItem, pDstItem); return; } // check dest->src move possibility ItemPosCountVec sDest2; uint16 eDest2 = 0; - if ( IsInventoryPos( src ) ) - msg = CanStoreItem( srcbag, srcslot, sDest2, pDstItem, true ); - else if ( IsBankPos( src ) ) - msg = CanBankItem( srcbag, srcslot, sDest2, pDstItem, true ); - else if ( IsEquipmentPos( src ) ) + if (IsInventoryPos(src)) + msg = CanStoreItem(srcbag, srcslot, sDest2, pDstItem, true); + else if (IsBankPos(src)) + msg = CanBankItem(srcbag, srcslot, sDest2, pDstItem, true); + else if (IsEquipmentPos(src)) { - msg = CanEquipItem( srcslot, eDest2, pDstItem, true); - if ( msg == EQUIP_ERR_OK ) - msg = CanUnequipItem( eDest2, true); + msg = CanEquipItem(srcslot, eDest2, pDstItem, true); + if (msg == EQUIP_ERR_OK) + msg = CanUnequipItem(eDest2, true); } - if ( msg != EQUIP_ERR_OK ) + if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, pDstItem, pSrcItem ); + SendEquipError(msg, pDstItem, pSrcItem); return; } @@ -12264,7 +12264,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) if (!bagItemProto || !ItemCanGoIntoBag(bagItemProto, emptyProto)) { // one from items not go to empty target bag - SendEquipError( EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, pSrcItem, pDstItem ); + SendEquipError(EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, pSrcItem, pDstItem); return; } @@ -12274,7 +12274,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) if (count > emptyBag->GetBagSize()) { // too small targeted bag - SendEquipError( EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, pSrcItem, pDstItem ); + SendEquipError(EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, pSrcItem, pDstItem); return; } @@ -12358,7 +12358,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) AutoUnequipOffhandIfNeed(); } -void Player::AddItemToBuyBackSlot( Item *pItem ) +void Player::AddItemToBuyBackSlot(Item *pItem) { if (pItem) { @@ -12366,10 +12366,10 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) // if current back slot non-empty search oldest or free if (m_items[slot]) { - uint32 oldest_time = GetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 ); + uint32 oldest_time = GetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1); uint32 oldest_slot = BUYBACK_SLOT_START; - for (uint32 i = BUYBACK_SLOT_START+1; i < BUYBACK_SLOT_END; ++i ) + for (uint32 i = BUYBACK_SLOT_START+1; i < BUYBACK_SLOT_END; ++i) { // found empty if (!m_items[i]) @@ -12378,7 +12378,7 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) break; } - uint32 i_time = GetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + i - BUYBACK_SLOT_START); + uint32 i_time = GetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + i - BUYBACK_SLOT_START); if (oldest_time > i_time) { @@ -12391,20 +12391,20 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) slot = oldest_slot; } - RemoveItemFromBuyBackSlot( slot, true ); - sLog.outDebug( "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); + RemoveItemFromBuyBackSlot(slot, true); + sLog.outDebug("STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); m_items[slot] = pItem; time_t base = time(NULL); uint32 etime = uint32(base - m_logintime + (30 * 3600)); uint32 eslot = slot - BUYBACK_SLOT_START; - SetUInt64Value( PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID() ); + SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID()); if (ItemPrototype const *pProto = pItem->GetProto()) - SetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount() ); + SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount()); else - SetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0 ); - SetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, (uint32)etime ); + SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0); + SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, (uint32)etime); // move to next (for non filled list is move most optimized choice) if (m_currentBuybackSlot < BUYBACK_SLOT_END - 1) @@ -12412,17 +12412,17 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) } } -Item* Player::GetItemFromBuyBackSlot( uint32 slot ) +Item* Player::GetItemFromBuyBackSlot(uint32 slot) { - sLog.outDebug( "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); + sLog.outDebug("STORAGE: GetItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) return m_items[slot]; return NULL; } -void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del ) +void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) { - sLog.outDebug( "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); + sLog.outDebug("STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) { Item *pItem = m_items[slot]; @@ -12446,9 +12446,9 @@ void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del ) } } -void Player::SendEquipError( uint8 msg, Item* pItem, Item *pItem2 ) +void Player::SendEquipError(uint8 msg, Item* pItem, Item *pItem2) { - sLog.outDebug( "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); + sLog.outDebug("WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); WorldPacket data(SMSG_INVENTORY_CHANGE_FAILURE, (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I ? 22 : 18)); data << uint8(msg); @@ -12472,10 +12472,10 @@ void Player::SendEquipError( uint8 msg, Item* pItem, Item *pItem2 ) GetSession()->SendPacket(&data); } -void Player::SendBuyError( uint8 msg, Creature* pCreature, uint32 item, uint32 param ) +void Player::SendBuyError(uint8 msg, Creature* pCreature, uint32 item, uint32 param) { - sLog.outDebug( "WORLD: Sent SMSG_BUY_FAILED" ); - WorldPacket data( SMSG_BUY_FAILED, (8+4+4+1) ); + sLog.outDebug("WORLD: Sent SMSG_BUY_FAILED"); + WorldPacket data(SMSG_BUY_FAILED, (8+4+4+1)); data << uint64(pCreature ? pCreature->GetGUID() : 0); data << uint32(item); if (param > 0) @@ -12484,10 +12484,10 @@ void Player::SendBuyError( uint8 msg, Creature* pCreature, uint32 item, uint32 p GetSession()->SendPacket(&data); } -void Player::SendSellError( uint8 msg, Creature* pCreature, uint64 guid, uint32 param ) +void Player::SendSellError(uint8 msg, Creature* pCreature, uint64 guid, uint32 param) { - sLog.outDebug( "WORLD: Sent SMSG_SELL_ITEM" ); - WorldPacket data( SMSG_SELL_ITEM,(8+8+(param?4:0)+1)); // last check 2.0.10 + sLog.outDebug("WORLD: Sent SMSG_SELL_ITEM"); + WorldPacket data(SMSG_SELL_ITEM,(8+8+(param?4:0)+1)); // last check 2.0.10 data << uint64(pCreature ? pCreature->GetGUID() : 0); data << uint64(guid); if (param > 0) @@ -12633,7 +12633,7 @@ void Player::RemoveArenaEnchantments(EnchantmentSlot slot) // in inventory bags for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) - if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) for (uint32 j = 0; j < pBag->GetBagSize(); j++) if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->GetEnchantmentId(slot)) @@ -12658,7 +12658,7 @@ void Player::AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 durat break; } } - if (item && duration > 0 ) + if (item && duration > 0) { GetSession()->SendItemEnchantTimeUpdate(GetGUID(), item->GetGUID(), slot, uint32(duration/1000)); m_enchantDuration.push_back(EnchantDuration(item, slot, duration)); @@ -12745,7 +12745,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool { if (item_rand->enchant_id[k] == enchant_id) { - basepoints = int32((item_rand->prefix[k] * item->GetItemSuffixFactor()) / 10000 ); + basepoints = int32((item_rand->prefix[k] * item->GetItemSuffixFactor()) / 10000); break; } } @@ -12771,7 +12771,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool { if (item_rand->enchant_id[k] == enchant_id) { - enchant_amount = uint32((item_rand->prefix[k] * item->GetItemSuffixFactor()) / 10000 ); + enchant_amount = uint32((item_rand->prefix[k] * item->GetItemSuffixFactor()) / 10000); break; } } @@ -12791,7 +12791,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool { if (item_rand_suffix->enchant_id[k] == enchant_id) { - enchant_amount = uint32((item_rand_suffix->prefix[k] * item->GetItemSuffixFactor()) / 10000 ); + enchant_amount = uint32((item_rand_suffix->prefix[k] * item->GetItemSuffixFactor()) / 10000); break; } } @@ -12988,7 +12988,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool addValue = float(enchant_amount * item->GetProto()->Delay / 1000.0f); HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, addValue, apply); } - else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND ) + else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND) { addValue = float(enchant_amount * item->GetProto()->Delay / 1000.0f); HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, addValue, apply); @@ -13055,7 +13055,7 @@ void Player::SendNewItem(Item *item, uint32 count, bool received, bool created, return; // last check 2.0.10 - WorldPacket data( SMSG_ITEM_PUSH_RESULT, (8+4+4+4+1+4+4+4+4+4) ); + WorldPacket data(SMSG_ITEM_PUSH_RESULT, (8+4+4+4+1+4+4+4+4+4)); data << uint64(GetGUID()); // player GUID data << uint32(received); // 0=looted, 1=from npc data << uint32(created); // 0=received, 1=created @@ -13465,7 +13465,7 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject *pSource) /*** QUEST SYSTEM ***/ /*********************************************************/ -void Player::PrepareQuestMenu( uint64 guid ) +void Player::PrepareQuestMenu(uint64 guid) { Object *pObject; QuestRelations* pObjectQR; @@ -13473,7 +13473,7 @@ void Player::PrepareQuestMenu( uint64 guid ) // pets also can have quests Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); - if ( pCreature ) + if (pCreature) { pObject = (Object*)pCreature; pObjectQR = &objmgr.mCreatureQuestRelations; @@ -13486,7 +13486,7 @@ void Player::PrepareQuestMenu( uint64 guid ) Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); ASSERT(_map); GameObject *pGameObject = _map->GetGameObject(guid); - if ( pGameObject ) + if (pGameObject) { pObject = (Object*)pGameObject; pObjectQR = &objmgr.mGOQuestRelations; @@ -13502,12 +13502,12 @@ void Player::PrepareQuestMenu( uint64 guid ) for (QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i) { uint32 quest_id = i->second; - QuestStatus status = GetQuestStatus( quest_id ); - if ( status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus( quest_id ) ) + QuestStatus status = GetQuestStatus(quest_id); + if (status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(quest_id)) qm.AddMenuItem(quest_id, DIALOG_STATUS_UNK2); - else if ( status == QUEST_STATUS_INCOMPLETE ) + else if (status == QUEST_STATUS_INCOMPLETE) qm.AddMenuItem(quest_id, DIALOG_STATUS_UNK2); - //else if (status == QUEST_STATUS_AVAILABLE ) + //else if (status == QUEST_STATUS_AVAILABLE) // qm.AddMenuItem(quest_id, DIALOG_STATUS_CHAT); } @@ -13517,11 +13517,11 @@ void Player::PrepareQuestMenu( uint64 guid ) Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); if (!pQuest) continue; - QuestStatus status = GetQuestStatus( quest_id ); + QuestStatus status = GetQuestStatus(quest_id); if (pQuest->IsAutoComplete() && CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, DIALOG_STATUS_UNK2); - else if ( status == QUEST_STATUS_NONE && CanTakeQuest( pQuest, false ) ) + else if (status == QUEST_STATUS_NONE && CanTakeQuest(pQuest, false)) qm.AddMenuItem(quest_id, DIALOG_STATUS_CHAT); } } @@ -13617,21 +13617,21 @@ void Player::SendPreparedQuest(uint64 guid) } } -bool Player::IsActiveQuest( uint32 quest_id ) const +bool Player::IsActiveQuest(uint32 quest_id) const { QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id); return itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE; } -Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) +Quest const * Player::GetNextQuest(uint64 guid, Quest const *pQuest) { Object *pObject; QuestRelations* pObjectQR; QuestRelations* pObjectQIR; Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid); - if ( pCreature ) + if (pCreature) { pObject = (Object*)pCreature; pObjectQR = &objmgr.mCreatureQuestRelations; @@ -13644,7 +13644,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); ASSERT(_map); GameObject *pGameObject = _map->GetGameObject(guid); - if ( pGameObject ) + if (pGameObject) { pObject = (Object*)pGameObject; pObjectQR = &objmgr.mGOQuestRelations; @@ -13664,12 +13664,12 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) return NULL; } -bool Player::CanSeeStartQuest( Quest const *pQuest ) +bool Player::CanSeeStartQuest(Quest const *pQuest) { - if ( SatisfyQuestRace( pQuest, false ) && SatisfyQuestSkillOrClass( pQuest, false ) && - SatisfyQuestExclusiveGroup( pQuest, false ) && SatisfyQuestReputation( pQuest, false ) && - SatisfyQuestPreviousQuest( pQuest, false ) && SatisfyQuestNextChain( pQuest, false ) && - SatisfyQuestPrevChain( pQuest, false ) && SatisfyQuestDay( pQuest, false ) ) + if (SatisfyQuestRace(pQuest, false) && SatisfyQuestSkillOrClass(pQuest, false) && + SatisfyQuestExclusiveGroup(pQuest, false) && SatisfyQuestReputation(pQuest, false) && + SatisfyQuestPreviousQuest(pQuest, false) && SatisfyQuestNextChain(pQuest, false) && + SatisfyQuestPrevChain(pQuest, false) && SatisfyQuestDay(pQuest, false)) { return getLevel() + sWorld.getConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= pQuest->GetMinLevel(); } @@ -13677,46 +13677,46 @@ bool Player::CanSeeStartQuest( Quest const *pQuest ) return false; } -bool Player::CanTakeQuest( Quest const *pQuest, bool msg ) +bool Player::CanTakeQuest(Quest const *pQuest, bool msg) { - return SatisfyQuestStatus( pQuest, msg ) && SatisfyQuestExclusiveGroup( pQuest, msg ) - && SatisfyQuestRace( pQuest, msg ) && SatisfyQuestLevel( pQuest, msg ) - && SatisfyQuestSkillOrClass( pQuest, msg ) && SatisfyQuestReputation( pQuest, msg ) - && SatisfyQuestPreviousQuest( pQuest, msg ) && SatisfyQuestTimed( pQuest, msg ) - && SatisfyQuestNextChain( pQuest, msg ) && SatisfyQuestPrevChain( pQuest, msg ) - && SatisfyQuestDay( pQuest, msg ); + return SatisfyQuestStatus(pQuest, msg) && SatisfyQuestExclusiveGroup(pQuest, msg) + && SatisfyQuestRace(pQuest, msg) && SatisfyQuestLevel(pQuest, msg) + && SatisfyQuestSkillOrClass(pQuest, msg) && SatisfyQuestReputation(pQuest, msg) + && SatisfyQuestPreviousQuest(pQuest, msg) && SatisfyQuestTimed(pQuest, msg) + && SatisfyQuestNextChain(pQuest, msg) && SatisfyQuestPrevChain(pQuest, msg) + && SatisfyQuestDay(pQuest, msg); } -bool Player::CanAddQuest( Quest const *pQuest, bool msg ) +bool Player::CanAddQuest(Quest const *pQuest, bool msg) { - if ( !SatisfyQuestLog( msg ) ) + if (!SatisfyQuestLog(msg)) return false; uint32 srcitem = pQuest->GetSrcItemId(); - if ( srcitem > 0 ) + if (srcitem > 0) { uint32 count = pQuest->GetSrcItemCount(); ItemPosCountVec dest; - uint8 msg2 = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count ); + uint8 msg2 = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count); // player already have max number (in most case 1) source item, no additional item needed and quest can be added. - if ( msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) + if (msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) return true; - else if ( msg2 != EQUIP_ERR_OK ) + else if (msg2 != EQUIP_ERR_OK) { - SendEquipError( msg2, NULL, NULL ); + SendEquipError(msg2, NULL, NULL); return false; } } return true; } -bool Player::CanCompleteQuest( uint32 quest_id ) +bool Player::CanCompleteQuest(uint32 quest_id) { - if ( quest_id ) + if (quest_id) { QuestStatusData& q_status = mQuestStatus[quest_id]; - if ( q_status.m_status == QUEST_STATUS_COMPLETE ) + if (q_status.m_status == QUEST_STATUS_COMPLETE) return false; // not allow re-complete quest Quest const* qInfo = objmgr.GetQuestTemplate(quest_id); @@ -13728,48 +13728,48 @@ bool Player::CanCompleteQuest( uint32 quest_id ) if (qInfo->IsAutoComplete() && CanTakeQuest(qInfo, false)) return true; - if ( q_status.m_status == QUEST_STATUS_INCOMPLETE ) + if (q_status.m_status == QUEST_STATUS_INCOMPLETE) { - if ( qInfo->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++) { - if ( qInfo->ReqItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i] ) + if (qInfo->ReqItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i]) return false; } } - if ( qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO) ) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) { for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++) { - if ( qInfo->ReqCreatureOrGOId[i] == 0 ) + if (qInfo->ReqCreatureOrGOId[i] == 0) continue; - if ( qInfo->ReqCreatureOrGOCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->ReqCreatureOrGOCount[i] ) + if (qInfo->ReqCreatureOrGOCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->ReqCreatureOrGOCount[i]) return false; } } - if ( qInfo->HasFlag( QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT ) && !q_status.m_explored ) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT) && !q_status.m_explored) return false; - if ( qInfo->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) && q_status.m_timer == 0 ) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_TIMED) && q_status.m_timer == 0) return false; - if ( qInfo->GetRewOrReqMoney() < 0 ) + if (qInfo->GetRewOrReqMoney() < 0) { - if ( GetMoney() < uint32(-qInfo->GetRewOrReqMoney()) ) + if (GetMoney() < uint32(-qInfo->GetRewOrReqMoney())) return false; } uint32 repFacId = qInfo->GetRepObjectiveFaction(); - if ( repFacId && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue() ) + if (repFacId && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue()) return false; uint32 repFacId2 = qInfo->GetRepObjectiveFaction2(); - if ( repFacId2 && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue2() ) + if (repFacId2 && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue2()) return false; return true; @@ -13778,26 +13778,26 @@ bool Player::CanCompleteQuest( uint32 quest_id ) return false; } -bool Player::CanCompleteRepeatableQuest( Quest const *pQuest ) +bool Player::CanCompleteRepeatableQuest(Quest const *pQuest) { // Solve problem that player don't have the quest and try complete it. // if repeatable she must be able to complete event if player don't have it. // Seem that all repeatable quest are DELIVER Flag so, no need to add more. - if ( !CanTakeQuest(pQuest, false) ) + if (!CanTakeQuest(pQuest, false)) return false; - if (pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER) ) + if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++) - if ( pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i],pQuest->ReqItemCount[i]) ) + if (pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i],pQuest->ReqItemCount[i])) return false; - if ( !CanRewardQuest(pQuest, false) ) + if (!CanRewardQuest(pQuest, false)) return false; return true; } -bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) +bool Player::CanRewardQuest(Quest const *pQuest, bool msg) { // not auto complete quest and not completed quest (only cheating case, then ignore without message) if (!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE) @@ -13812,58 +13812,58 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) return false; // prevent receive reward with quest items in bank - if ( pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) + if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++) { - if ( pQuest->ReqItemCount[i]!= 0 && - GetItemCount(pQuest->ReqItemId[i]) < pQuest->ReqItemCount[i] ) + if (pQuest->ReqItemCount[i]!= 0 && + GetItemCount(pQuest->ReqItemId[i]) < pQuest->ReqItemCount[i]) { if (msg) - SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return false; } } } // prevent receive reward with low money and GetRewOrReqMoney() < 0 - if (pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()) ) + if (pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney())) return false; return true; } -bool Player::CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ) +bool Player::CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg) { // prevent receive reward with quest items in bank or for not completed quest if (!CanRewardQuest(pQuest,msg)) return false; - if ( pQuest->GetRewChoiceItemsCount() > 0 ) + if (pQuest->GetRewChoiceItemsCount() > 0) { - if ( pQuest->RewChoiceItemId[reward] ) + if (pQuest->RewChoiceItemId[reward]) { ItemPosCountVec dest; - uint8 res = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward] ); - if ( res != EQUIP_ERR_OK ) + uint8 res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward]); + if (res != EQUIP_ERR_OK) { - SendEquipError( res, NULL, NULL ); + SendEquipError(res, NULL, NULL); return false; } } } - if ( pQuest->GetRewItemsCount() > 0 ) + if (pQuest->GetRewItemsCount() > 0) { for (uint32 i = 0; i < pQuest->GetRewItemsCount(); ++i) { - if ( pQuest->RewItemId[i] ) + if (pQuest->RewItemId[i]) { ItemPosCountVec dest; - uint8 res = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i] ); - if ( res != EQUIP_ERR_OK ) + uint8 res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i]); + if (res != EQUIP_ERR_OK) { - SendEquipError( res, NULL, NULL ); + SendEquipError(res, NULL, NULL); return false; } } @@ -13873,9 +13873,9 @@ bool Player::CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ) return true; } -void Player::AddQuest( Quest const *pQuest, Object *questGiver ) +void Player::AddQuest(Quest const *pQuest, Object *questGiver) { - uint16 log_slot = FindQuestSlot( 0 ); + uint16 log_slot = FindQuestSlot(0); assert(log_slot < MAX_QUEST_LOG_SIZE); uint32 quest_id = pQuest->GetQuestId(); @@ -13887,31 +13887,31 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver ) questStatusData.m_status = QUEST_STATUS_INCOMPLETE; questStatusData.m_explored = false; - if ( pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) + if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) questStatusData.m_itemcount[i] = 0; } - if ( pQuest->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO) ) + if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) { for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) questStatusData.m_creatureOrGOcount[i] = 0; } - GiveQuestSourceItem( pQuest ); - AdjustQuestReqItemCount( pQuest, questStatusData ); + GiveQuestSourceItem(pQuest); + AdjustQuestReqItemCount(pQuest, questStatusData); - if ( pQuest->GetRepObjectiveFaction() ) + if (pQuest->GetRepObjectiveFaction()) if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction())) GetReputationMgr().SetVisible(factionEntry); - if ( pQuest->GetRepObjectiveFaction2() ) + if (pQuest->GetRepObjectiveFaction2()) if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction2())) GetReputationMgr().SetVisible(factionEntry); uint32 qtime = 0; - if ( pQuest->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) ) + if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_TIMED)) { uint32 limittime = pQuest->GetLimitTime(); @@ -13919,7 +13919,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver ) if (questGiver && questGiver->GetTypeId() == TYPEID_PLAYER) limittime = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].m_timer / IN_MILISECONDS; - AddTimedQuest( quest_id ); + AddTimedQuest(quest_id); questStatusData.m_timer = limittime * IN_MILISECONDS; qtime = static_cast<uint32>(time(NULL)) + limittime; } @@ -13944,46 +13944,46 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver ) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if (itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area)) - if ( !HasAura(itr->second->spellId) ) + if (!HasAura(itr->second->spellId)) CastSpell(this,itr->second->spellId,true); } UpdateForQuestWorldObjects(); } -void Player::CompleteQuest( uint32 quest_id ) +void Player::CompleteQuest(uint32 quest_id) { - if ( quest_id ) + if (quest_id) { - SetQuestStatus( quest_id, QUEST_STATUS_COMPLETE ); + SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE); - uint16 log_slot = FindQuestSlot( quest_id ); - if ( log_slot < MAX_QUEST_LOG_SIZE) + uint16 log_slot = FindQuestSlot(quest_id); + if (log_slot < MAX_QUEST_LOG_SIZE) SetQuestSlotState(log_slot,QUEST_STATE_COMPLETE); if (Quest const* qInfo = objmgr.GetQuestTemplate(quest_id)) { - if ( qInfo->HasFlag(QUEST_FLAGS_AUTO_REWARDED) ) + if (qInfo->HasFlag(QUEST_FLAGS_AUTO_REWARDED)) RewardQuest(qInfo,0,this,false); else - SendQuestComplete( quest_id ); + SendQuestComplete(quest_id); } } } -void Player::IncompleteQuest( uint32 quest_id ) +void Player::IncompleteQuest(uint32 quest_id) { - if ( quest_id ) + if (quest_id) { - SetQuestStatus( quest_id, QUEST_STATUS_INCOMPLETE ); + SetQuestStatus(quest_id, QUEST_STATUS_INCOMPLETE); - uint16 log_slot = FindQuestSlot( quest_id ); - if ( log_slot < MAX_QUEST_LOG_SIZE) + uint16 log_slot = FindQuestSlot(quest_id); + if (log_slot < MAX_QUEST_LOG_SIZE) RemoveQuestSlotState(log_slot,QUEST_STATE_COMPLETE); } } -void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver, bool announce ) +void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver, bool announce) { //this THING should be here to protect code from quest, which cast on player far teleport as a reward //should work fine, cause far teleport will be executed in Player::Update() @@ -13993,7 +13993,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) if (pQuest->ReqItemId[i]) - DestroyItemCount( pQuest->ReqItemId[i], pQuest->ReqItemCount[i], true); + DestroyItemCount(pQuest->ReqItemId[i], pQuest->ReqItemCount[i], true); for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) { @@ -14011,9 +14011,9 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver if (uint32 itemId = pQuest->RewChoiceItemId[reward]) { ItemPosCountVec dest; - if (CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, pQuest->RewChoiceItemCount[reward] ) == EQUIP_ERR_OK) + if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, pQuest->RewChoiceItemCount[reward]) == EQUIP_ERR_OK) { - Item* item = StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); SendNewItem(item, pQuest->RewChoiceItemCount[reward], true, false); } } @@ -14026,9 +14026,9 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver if (uint32 itemId = pQuest->RewItemId[i]) { ItemPosCountVec dest; - if (CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, pQuest->RewItemCount[i] ) == EQUIP_ERR_OK) + if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, pQuest->RewItemCount[i]) == EQUIP_ERR_OK) { - Item* item = StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); SendNewItem(item, pQuest->RewItemCount[i], true, false); } } @@ -14044,7 +14044,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver QuestStatusData& q_status = mQuestStatus[quest_id]; // Not give XP in case already completed once repeatable quest - uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue( this )*sWorld.getRate(RATE_XP_QUEST)); + uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue(this)*sWorld.getRate(RATE_XP_QUEST)); // handle SPELL_AURA_MOD_XP_QUEST_PCT auras Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT); @@ -14109,13 +14109,13 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver q_status.uState = QUEST_CHANGED; if (announce) - SendQuestReward( pQuest, XP, questGiver ); + SendQuestReward(pQuest, XP, questGiver); // cast spells after mark quest complete (some spells have quest completed state reqyurements in spell_area data) if (pQuest->GetRewSpellCast() > 0) - CastSpell( this, pQuest->GetRewSpellCast(), true); - else if ( pQuest->GetRewSpell() > 0) - CastSpell( this, pQuest->GetRewSpell(), true); + CastSpell(this, pQuest->GetRewSpellCast(), true); + else if (pQuest->GetRewSpell() > 0) + CastSpell(this, pQuest->GetRewSpell(), true); if (pQuest->GetZoneOrSort() > 0) GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, pQuest->GetZoneOrSort()); @@ -14145,7 +14145,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if (itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area)) - if ( !HasAura(itr->second->spellId) ) + if (!HasAura(itr->second->spellId)) CastSpell(this,itr->second->spellId,true); } @@ -14204,10 +14204,10 @@ bool Player::SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg) uint8 reqSortClass = ClassByQuestSort(questSort); // check class sort cases in zoneOrSort - if ( reqSortClass != 0 && getClass() != reqSortClass) + if (reqSortClass != 0 && getClass() != reqSortClass) { if (msg) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } @@ -14218,7 +14218,7 @@ bool Player::SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg) if (getClass() != reqClass) { if (msg) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } } @@ -14229,7 +14229,7 @@ bool Player::SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg) if (GetSkillValue(reqSkill) < qInfo->GetRequiredSkillValue()) { if (msg) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } } @@ -14279,7 +14279,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) { uint32 prevId = abs(*iter); - QuestStatusMap::iterator i_prevstatus = mQuestStatus.find( prevId ); + QuestStatusMap::iterator i_prevstatus = mQuestStatus.find(prevId); Quest const* qPrevInfo = objmgr.GetQuestTemplate(prevId); if (qPrevInfo && i_prevstatus != mQuestStatus.end()) @@ -14291,7 +14291,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (qPrevInfo->GetExclusiveGroup() >= 0) return true; - // each-from-all exclusive group ( < 0) + // each-from-all exclusive group (< 0) // can be start if only all quests in prev quest exclusive group completed and rewarded ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); @@ -14312,7 +14312,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (i_exstatus == mQuestStatus.end() || !i_exstatus->second.m_rewarded) { if (msg) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } } @@ -14326,7 +14326,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (qPrevInfo->GetExclusiveGroup() >= 0) return true; - // each-from-all exclusive group ( < 0) + // each-from-all exclusive group (< 0) // can be start if only all quests in prev quest exclusive group active ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); @@ -14341,7 +14341,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (exclude_Id == prevId) continue; - QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id ); + QuestStatusMap::iterator i_exstatus = mQuestStatus.find(exclude_Id); // alternative quest from group also must be active if (i_exstatus == mQuestStatus.end() || @@ -14349,7 +14349,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) (i_prevstatus->second.m_status != QUEST_STATUS_COMPLETE || GetQuestRewardStatus(prevId))) { if (msg) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } } @@ -14374,7 +14374,7 @@ bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg) if ((reqraces & getRaceMask()) == 0) { if (msg) - SendCanTakeQuestResponse( INVALIDREASON_QUEST_FAILED_WRONG_RACE ); + SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_WRONG_RACE); return false; } return true; @@ -14401,13 +14401,13 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg) return true; } -bool Player::SatisfyQuestStatus( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestStatus(Quest const* qInfo, bool msg) { - QuestStatusMap::iterator itr = mQuestStatus.find( qInfo->GetQuestId() ); - if ( itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE ) + QuestStatusMap::iterator itr = mQuestStatus.find(qInfo->GetQuestId()); + if (itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE) { - if ( msg ) - SendCanTakeQuestResponse( INVALIDREASON_QUEST_ALREADY_ON ); + if (msg) + SendCanTakeQuestResponse(INVALIDREASON_QUEST_ALREADY_ON); return false; } return true; @@ -14424,7 +14424,7 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) return true; } -bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) { // non positive exclusive group, if > 0 then can be start if any other quest in exclusive group already started/completed if (qInfo->GetExclusiveGroup() <= 0) @@ -14445,75 +14445,75 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) // not allow have daily quest if daily quest from exclusive group already recently completed Quest const* Nquest = objmgr.GetQuestTemplate(exclude_Id); - if ( !SatisfyQuestDay(Nquest, false) ) + if (!SatisfyQuestDay(Nquest, false)) { - if ( msg ) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + if (msg) + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } - QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id ); + QuestStatusMap::iterator i_exstatus = mQuestStatus.find(exclude_Id); // alternative quest already started or completed - if ( i_exstatus != mQuestStatus.end() - && (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE) ) + if (i_exstatus != mQuestStatus.end() + && (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE)) { - if ( msg ) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + if (msg) + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } } return true; } -bool Player::SatisfyQuestNextChain( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestNextChain(Quest const* qInfo, bool msg) { if (!qInfo->GetNextQuestInChain()) return true; // next quest in chain already started or completed - QuestStatusMap::iterator itr = mQuestStatus.find( qInfo->GetNextQuestInChain() ); - if ( itr != mQuestStatus.end() - && (itr->second.m_status == QUEST_STATUS_COMPLETE || itr->second.m_status == QUEST_STATUS_INCOMPLETE) ) + QuestStatusMap::iterator itr = mQuestStatus.find(qInfo->GetNextQuestInChain()); + if (itr != mQuestStatus.end() + && (itr->second.m_status == QUEST_STATUS_COMPLETE || itr->second.m_status == QUEST_STATUS_INCOMPLETE)) { - if ( msg ) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + if (msg) + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } // check for all quests further up the chain // only necessary if there are quest chains with more than one quest that can be skipped - //return SatisfyQuestNextChain( qInfo->GetNextQuestInChain(), msg ); + //return SatisfyQuestNextChain(qInfo->GetNextQuestInChain(), msg); return true; } -bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestPrevChain(Quest const* qInfo, bool msg) { // No previous quest in chain - if ( qInfo->prevChainQuests.empty()) + if (qInfo->prevChainQuests.empty()) return true; - for (Quest::PrevChainQuests::const_iterator iter = qInfo->prevChainQuests.begin(); iter != qInfo->prevChainQuests.end(); ++iter ) + for (Quest::PrevChainQuests::const_iterator iter = qInfo->prevChainQuests.begin(); iter != qInfo->prevChainQuests.end(); ++iter) { uint32 prevId = *iter; - QuestStatusMap::iterator i_prevstatus = mQuestStatus.find( prevId ); + QuestStatusMap::iterator i_prevstatus = mQuestStatus.find(prevId); - if ( i_prevstatus != mQuestStatus.end() ) + if (i_prevstatus != mQuestStatus.end()) { // If any of the previous quests in chain active, return false - if ( i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE + if (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE || (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId))) { - if ( msg ) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + if (msg) + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } } // check for all quests further down the chain // only necessary if there are quest chains with more than one quest that can be skipped - //if ( !SatisfyQuestPrevChain( prevId, msg ) ) + //if (!SatisfyQuestPrevChain(prevId, msg)) // return false; } @@ -14521,7 +14521,7 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) return true; } -bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestDay(Quest const* qInfo, bool msg) { if (!qInfo->IsDaily()) return true; @@ -14539,36 +14539,36 @@ bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg ) if (!have_slot) { - if ( msg ) - SendCanTakeQuestResponse( INVALIDREASON_DAILY_QUESTS_REMAINING ); + if (msg) + SendCanTakeQuestResponse(INVALIDREASON_DAILY_QUESTS_REMAINING); return false; } return true; } -bool Player::GiveQuestSourceItem( Quest const *pQuest ) +bool Player::GiveQuestSourceItem(Quest const *pQuest) { uint32 srcitem = pQuest->GetSrcItemId(); - if ( srcitem > 0 ) + if (srcitem > 0) { uint32 count = pQuest->GetSrcItemCount(); - if ( count <= 0 ) + if (count <= 0) count = 1; ItemPosCountVec dest; - uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count ); - if ( msg == EQUIP_ERR_OK ) + uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count); + if (msg == EQUIP_ERR_OK) { Item * item = StoreNewItem(dest, srcitem, true); SendNewItem(item, count, true, false); return true; } // player already have max amount required item, just report success - else if ( msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) + else if (msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) return true; else - SendEquipError( msg, NULL, NULL ); + SendEquipError(msg, NULL, NULL); return false; } @@ -14635,7 +14635,7 @@ bool Player::CanShareQuest(uint32 quest_id) const Quest const* qInfo = objmgr.GetQuestTemplate(quest_id); if (qInfo && qInfo->HasFlag(QUEST_FLAGS_SHARABLE)) { - QuestStatusMap::const_iterator itr = mQuestStatus.find( quest_id ); + QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id); if (itr != mQuestStatus.end()) return itr->second.m_status == QUEST_STATUS_NONE || itr->second.m_status == QUEST_STATUS_INCOMPLETE; } @@ -14665,7 +14665,7 @@ uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) return 0; for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) - if ( qInfo->ReqCreatureOrGOId[j] == entry ) + if (qInfo->ReqCreatureOrGOId[j] == entry) return mQuestStatus[quest_id].m_creatureOrGOcount[j]; return 0; @@ -14673,7 +14673,7 @@ uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) void Player::AdjustQuestReqItemCount(Quest const* pQuest, QuestStatusData& questStatusData) { - if (pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER)) + if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { @@ -14690,7 +14690,7 @@ void Player::AdjustQuestReqItemCount(Quest const* pQuest, QuestStatusData& quest } } -uint16 Player::FindQuestSlot( uint32 quest_id ) const +uint16 Player::FindQuestSlot(uint32 quest_id) const { for (uint16 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) if (GetQuestSlotQuestId(i) == quest_id) @@ -14721,7 +14721,7 @@ void Player::AreaExploredOrEventHappens(uint32 questId) } //not used in Trinityd, function for external script library -void Player::GroupEventHappens( uint32 questId, WorldObject const* pEventObject ) +void Player::GroupEventHappens(uint32 questId, WorldObject const* pEventObject) { if (Group *pGroup = GetGroup()) { @@ -14738,7 +14738,7 @@ void Player::GroupEventHappens( uint32 questId, WorldObject const* pEventObject AreaExploredOrEventHappens(questId); } -void Player::ItemAddedQuestCheck( uint32 entry, uint32 count) +void Player::ItemAddedQuestCheck(uint32 entry, uint32 count) { for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { @@ -14752,7 +14752,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count) continue; Quest const* qInfo = objmgr.GetQuestTemplate(questid); - if ( !qInfo || !qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) + if (!qInfo || !qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) continue; for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) @@ -14770,8 +14770,8 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count) SendQuestUpdateAddItem(qInfo, j, additemcount); } - if ( CanCompleteQuest( questid)) - CompleteQuest( questid ); + if (CanCompleteQuest(questid)) + CompleteQuest(questid); return; } } @@ -14779,7 +14779,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count) UpdateForQuestWorldObjects(); } -void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count) +void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) { for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { @@ -14789,7 +14789,7 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count) Quest const* qInfo = objmgr.GetQuestTemplate(questid); if (!qInfo) continue; - if ( !qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) + if (!qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) continue; for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) @@ -14856,7 +14856,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) QuestStatusData& q_status = mQuestStatus[questid]; if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->GetType() == QUEST_TYPE_RAID)) { - if (qInfo->HasFlag( QUEST_TRINITY_FLAGS_KILL_OR_CAST)) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST)) { for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { @@ -14880,7 +14880,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED; - SendQuestUpdateAddCreatureOrGo( qInfo, guid, j, curkillcount, addkillcount); + SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curkillcount, addkillcount); } if (CanCompleteQuest(questid)) CompleteQuest(questid); @@ -14913,7 +14913,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) if (q_status.m_status == QUEST_STATUS_INCOMPLETE) { - if (qInfo->HasFlag( QUEST_TRINITY_FLAGS_KILL_OR_CAST)) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST)) { for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { @@ -15030,7 +15030,7 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid) } } -void Player::MoneyChanged( uint32 count ) +void Player::MoneyChanged(uint32 count) { for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { @@ -15185,15 +15185,15 @@ void Player::SendQuestComplete(uint32 quest_id) } } -void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGiver ) +void Player::SendQuestReward(Quest const *pQuest, uint32 XP, Object * questGiver) { uint32 questid = pQuest->GetQuestId(); - sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid ); + sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid); gameeventmgr.HandleQuestComplete(questid); - WorldPacket data( SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4) ); + WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4)); data << uint32(questid); - if ( getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ) + if (getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { data << uint32(XP); data << uint32(pQuest->GetRewOrReqMoney()); @@ -15207,40 +15207,40 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive data << uint32(10*Trinity::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills())); data << uint32(pQuest->GetBonusTalents()); // bonus talents data << uint32(pQuest->GetRewArenaPoints()); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); if (pQuest->GetQuestCompleteScript() != 0) GetMap()->ScriptsStart(sQuestEndScripts, pQuest->GetQuestCompleteScript(), questGiver, this); } -void Player::SendQuestFailed( uint32 quest_id ) +void Player::SendQuestFailed(uint32 quest_id) { - if ( quest_id ) + if (quest_id) { - WorldPacket data( SMSG_QUESTGIVER_QUEST_FAILED, 4+4 ); + WorldPacket data(SMSG_QUESTGIVER_QUEST_FAILED, 4+4); data << uint32(quest_id); data << uint32(0); // failed reason (4 for inventory is full) - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); } } -void Player::SendQuestTimerFailed( uint32 quest_id ) +void Player::SendQuestTimerFailed(uint32 quest_id) { - if ( quest_id ) + if (quest_id) { - WorldPacket data( SMSG_QUESTUPDATE_FAILEDTIMER, 4 ); + WorldPacket data(SMSG_QUESTUPDATE_FAILEDTIMER, 4); data << uint32(quest_id); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER"); } } -void Player::SendCanTakeQuestResponse( uint32 msg ) +void Player::SendCanTakeQuestResponse(uint32 msg) { - WorldPacket data( SMSG_QUESTGIVER_QUEST_INVALID, 4 ); + WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4); data << uint32(msg); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_INVALID"); } @@ -15271,28 +15271,28 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver) } } -void Player::SendPushToPartyResponse( Player *pPlayer, uint32 msg ) +void Player::SendPushToPartyResponse(Player *pPlayer, uint32 msg) { - if ( pPlayer ) + if (pPlayer) { - WorldPacket data( MSG_QUEST_PUSH_RESULT, (8+1) ); + WorldPacket data(MSG_QUEST_PUSH_RESULT, (8+1)); data << uint64(pPlayer->GetGUID()); data << uint8(msg); // valid values: 0-8 - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); sLog.outDebug("WORLD: Sent MSG_QUEST_PUSH_RESULT"); } } -void Player::SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint32 count ) +void Player::SendQuestUpdateAddItem(Quest const* pQuest, uint32 item_idx, uint32 count) { - WorldPacket data( SMSG_QUESTUPDATE_ADD_ITEM, 0 ); - sLog.outDebug( "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM" ); + WorldPacket data(SMSG_QUESTUPDATE_ADD_ITEM, 0); + sLog.outDebug("WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM"); //data << pQuest->ReqItemId[item_idx]; //data << count; - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } -void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count ) +void Player::SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count) { assert(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)"); @@ -15301,8 +15301,8 @@ void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, u // client expected gameobject template id in form (id|0x80000000) entry = (-entry) | 0x80000000; - WorldPacket data( SMSG_QUESTUPDATE_ADD_KILL, (4*4+8) ); - sLog.outDebug( "WORLD: Sent SMSG_QUESTUPDATE_ADD_KILL" ); + WorldPacket data(SMSG_QUESTUPDATE_ADD_KILL, (4*4+8)); + sLog.outDebug("WORLD: Sent SMSG_QUESTUPDATE_ADD_KILL"); data << uint32(pQuest->GetQuestId()); data << uint32(entry); data << uint32(old_count + add_count); @@ -15310,8 +15310,8 @@ void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, u data << uint64(guid); GetSession()->SendPacket(&data); - uint16 log_slot = FindQuestSlot( pQuest->GetQuestId() ); - if ( log_slot < MAX_QUEST_LOG_SIZE) + uint16 log_slot = FindQuestSlot(pQuest->GetQuestId()); + if (log_slot < MAX_QUEST_LOG_SIZE) SetQuestSlotCounter(log_slot,creatureOrGO_idx,GetQuestSlotCounter(log_slot,creatureOrGO_idx)+add_count); } @@ -15319,7 +15319,7 @@ void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, u /*** LOAD SYSTEM ***/ /*********************************************************/ -bool Player::MinimalLoadFromDB( QueryResult_AutoPtr result, uint32 guid ) +bool Player::MinimalLoadFromDB(QueryResult_AutoPtr result, uint32 guid) { if (!result) { @@ -15331,7 +15331,7 @@ bool Player::MinimalLoadFromDB( QueryResult_AutoPtr result, uint32 guid ) Field *fields = result->Fetch(); - if (!LoadValues( fields[1].GetString())) + if (!LoadValues(fields[1].GetString())) { sLog.outError("Player #%d have broken data in `data` field. Can't be loaded for character list.",GUID_LOPART(guid)); return false; @@ -15493,7 +15493,7 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& bool Player::LoadValuesArrayFromDB(Tokens& data, uint64 guid) { QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT data FROM characters WHERE guid='%u'",GUID_LOPART(guid)); - if ( !result ) + if (!result) return false; Field *fields = result->Fetch(); @@ -15538,7 +15538,7 @@ float Player::GetFloatValueFromDB(uint16 index, uint64 guid) return result; } -bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) +bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder) { //// 0 1 2 3 4 5 6 7 8 9 10 11 12 //QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags," @@ -15564,13 +15564,13 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // check if the character's account in the db and the logged in account match. // player should be able to load/delete character only with correct account! - if ( dbAccountId != GetSession()->GetAccountId() ) + if (dbAccountId != GetSession()->GetAccountId()) { sLog.outError("Player (GUID: %u) loading from wrong account (is: %u, should be: %u)",guid,GetSession()->GetAccountId(),dbAccountId); return false; } - Object::_Create( guid, 0, HIGHGUID_PLAYER ); + Object::_Create(guid, 0, HIGHGUID_PLAYER); m_name = fields[3].GetCppString(); @@ -15582,7 +15582,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) return false; } - if (!LoadValues( fields[2].GetString())) + if (!LoadValues(fields[2].GetString())) { sLog.outError("Player #%d have broken data in `data` field. Can't be loaded.", GUID_LOPART(guid)); return false; @@ -15618,7 +15618,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // cleanup inventory related item value fields (its will be filled correctly in _LoadInventory) for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot) { - SetUInt64Value( PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0 ); + SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); SetVisibleItemSlot(slot, NULL); if (m_items[slot]) @@ -15753,11 +15753,11 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_movementInfo.t_z = fields[29].GetFloat(); m_movementInfo.t_o = fields[30].GetFloat(); - if ( !Trinity::IsValidMapCoord( + if (!Trinity::IsValidMapCoord( GetPositionX()+m_movementInfo.t_x,GetPositionY()+m_movementInfo.t_y, GetPositionZ()+m_movementInfo.t_z,GetOrientation()+m_movementInfo.t_o) || // transport size limited - m_movementInfo.t_x > 50 || m_movementInfo.t_y > 50 || m_movementInfo.t_z > 50 ) + m_movementInfo.t_x > 50 || m_movementInfo.t_y > 50 || m_movementInfo.t_z > 50) { sLog.outError("Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid,GetPositionX()+m_movementInfo.t_x,GetPositionY()+m_movementInfo.t_y, @@ -15769,7 +15769,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) { for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) { - if ( (*iter)->GetGUIDLow() == transGUID) + if ((*iter)->GetGUIDLow() == transGUID) { m_transport = *iter; m_transport->AddPassenger(this); @@ -15944,7 +15944,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_resetTalentsTime = time_t(fields[26].GetUInt64()); // reserve some flags - uint32 old_safe_flags = GetUInt32Value(PLAYER_FLAGS) & ( PLAYER_FLAGS_HIDE_CLOAK | PLAYER_FLAGS_HIDE_HELM ); + uint32 old_safe_flags = GetUInt32Value(PLAYER_FLAGS) & (PLAYER_FLAGS_HIDE_CLOAK | PLAYER_FLAGS_HIDE_HELM); if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM)) SetUInt32Value(PLAYER_FLAGS, 0 | old_safe_flags); @@ -15986,8 +15986,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); // reset some aura modifiers before aura apply - SetUInt32Value(PLAYER_TRACK_CREATURES, 0 ); - SetUInt32Value(PLAYER_TRACK_RESOURCES, 0 ); + SetUInt32Value(PLAYER_TRACK_CREATURES, 0); + SetUInt32Value(PLAYER_TRACK_RESOURCES, 0); // make sure the unit is considered out of combat for proper loading ClearInCombat(); @@ -16224,7 +16224,7 @@ void Player::_LoadActions(QueryResult_AutoPtr result, bool startup) ab->uState = ACTIONBUTTON_UNCHANGED; else { - sLog.outError( " ...at loading, and will deleted in DB also"); + sLog.outError(" ...at loading, and will deleted in DB also"); // Will deleted in DB at next save (it can create data until save but marked as deleted) m_actionButtons[button].uState = ACTIONBUTTON_DELETED; @@ -16343,7 +16343,7 @@ void Player::LoadCorpse() else { if (Corpse *corpse = GetCorpse()) - ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sMapStore.LookupEntry(corpse->GetMapId())->Instanceable() ); + ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sMapStore.LookupEntry(corpse->GetMapId())->Instanceable()); else //Prevent Dead Player login without corpse ResurrectPlayer(0.5f); @@ -16381,7 +16381,7 @@ void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff) { CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_guid); CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guid); - sLog.outError( "Player::_LoadInventory: Player %s has an unknown item (id: #%u) in inventory, deleted.", GetName(),item_id ); + sLog.outError("Player::_LoadInventory: Player %s has an unknown item (id: #%u) in inventory, deleted.", GetName(),item_id); continue; } @@ -16389,7 +16389,7 @@ void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff) if (!item->LoadFromDB(item_guid, GetGUID(), result)) { - sLog.outError( "Player::_LoadInventory: Player %s has broken item (id: #%u) in inventory, deleted.", GetName(),item_id ); + sLog.outError("Player::_LoadInventory: Player %s has broken item (id: #%u) in inventory, deleted.", GetName(),item_id); CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_guid); item->FSetState(ITEM_REMOVED); item->SaveToDB(); // it also deletes item object ! @@ -16562,7 +16562,7 @@ void Player::_LoadMailedItems(Mail *mail) if (!proto) { - sLog.outError( "Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), item_guid_low, item_template,mail->messageID); + sLog.outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), item_guid_low, item_template,mail->messageID); CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", item_guid_low); CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guid_low); continue; @@ -16572,7 +16572,7 @@ void Player::_LoadMailedItems(Mail *mail) if (!item->LoadFromDB(item_guid_low, 0, result)) { - sLog.outError( "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, item_guid_low); + sLog.outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, item_guid_low); CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", item_guid_low); item->FSetState(ITEM_REMOVED); item->SaveToDB(); // it also deletes item object ! @@ -16630,7 +16630,7 @@ void Player::_LoadMail() if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) { - sLog.outError( "Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); + sLog.outError("Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); m->mailTemplateId = 0; } @@ -16689,8 +16689,8 @@ void Player::_LoadQuestStatus(QueryResult_AutoPtr result) sLog.outError("Player %s have invalid quest %d status (%d), replaced by QUEST_STATUS_NONE(0).",GetName(),quest_id,qstatus); } - questStatusData.m_rewarded = ( fields[2].GetUInt8() > 0 ); - questStatusData.m_explored = ( fields[3].GetUInt8() > 0 ); + questStatusData.m_rewarded = (fields[2].GetUInt8() > 0); + questStatusData.m_explored = (fields[3].GetUInt8() > 0); time_t quest_time = time_t(fields[4].GetUInt64()); @@ -17227,7 +17227,7 @@ bool Player::_LoadHomeBind(QueryResult_AutoPtr result) MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId); // accept saved data only for valid position (and non instanceable), and accessable - if ( MapManager::IsValidMapCoord(m_homebindMapId,m_homebindX,m_homebindY,m_homebindZ) && + if (MapManager::IsValidMapCoord(m_homebindMapId,m_homebindX,m_homebindY,m_homebindZ) && !bindMapEntry->Instanceable() && GetSession()->Expansion() >= bindMapEntry->Expansion()) ok = true; else @@ -17400,7 +17400,7 @@ void Player::SaveToDB() CharacterDatabase.BeginTransaction(); - CharacterDatabase.Execute( ss.str().c_str() ); + CharacterDatabase.Execute(ss.str().c_str()); if (m_mailsUpdated) //save mails only when needed _SaveMail(); @@ -17448,7 +17448,7 @@ void Player::_SaveActions() { case ACTIONBUTTON_NEW: CharacterDatabase.PExecute("INSERT INTO character_action (guid,spec,button,action,type) VALUES ('%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), (uint32)m_activeSpec, (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType() ); + GetGUIDLow(), (uint32)m_activeSpec, (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType()); itr->second.uState = ACTIONBUTTON_UNCHANGED; ++itr; break; @@ -17459,7 +17459,7 @@ void Player::_SaveActions() ++itr; break; case ACTIONBUTTON_DELETED: - CharacterDatabase.PExecute("DELETE FROM character_action WHERE guid = '%u' and button = '%u' and spec = '%u'", GetGUIDLow(), (uint32)itr->first, (uint32)m_activeSpec ); + CharacterDatabase.PExecute("DELETE FROM character_action WHERE guid = '%u' and button = '%u' and spec = '%u'", GetGUIDLow(), (uint32)itr->first, (uint32)m_activeSpec); m_actionButtons.erase(itr++); break; default: @@ -17665,7 +17665,7 @@ void Player::_SaveMail() void Player::_SaveQuestStatus() { // we don't need transactions here. - for (QuestStatusMap::iterator i = mQuestStatus.begin( ); i != mQuestStatus.end( ); ++i ) + for (QuestStatusMap::iterator i = mQuestStatus.begin(); i != mQuestStatus.end(); ++i) { switch (i->second.uState) { @@ -17676,7 +17676,7 @@ void Player::_SaveQuestStatus() break; case QUEST_CHANGED : CharacterDatabase.PExecute("UPDATE character_queststatus SET status = '%u',rewarded = '%u',explored = '%u',timer = '" UI64FMTD "',mobcount1 = '%u',mobcount2 = '%u',mobcount3 = '%u',mobcount4 = '%u',itemcount1 = '%u',itemcount2 = '%u',itemcount3 = '%u',itemcount4 = '%u' WHERE guid = '%u' AND quest = '%u' ", - i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / IN_MILISECONDS + sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3], GetGUIDLow(), i->first ); + i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / IN_MILISECONDS + sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3], GetGUIDLow(), i->first); break; case QUEST_UNCHANGED: break; @@ -17705,7 +17705,7 @@ void Player::_SaveDailyQuestStatus() void Player::_SaveSkills() { // we don't need transactions here. - for ( SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end(); ) + for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end();) { if (itr->second.uState == SKILL_UNCHANGED) { @@ -17715,7 +17715,7 @@ void Player::_SaveSkills() if (itr->second.uState == SKILL_DELETED) { - CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), itr->first ); + CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), itr->first); mSkillStatus.erase(itr++); continue; } @@ -17732,7 +17732,7 @@ void Player::_SaveSkills() break; case SKILL_CHANGED: CharacterDatabase.PExecute("UPDATE character_skills SET value = '%u',max = '%u'WHERE guid = '%u' AND skill = '%u' ", - value, max, GetGUIDLow(), itr->first ); + value, max, GetGUIDLow(), itr->first); break; }; itr->second.uState = SKILL_UNCHANGED; @@ -17831,7 +17831,7 @@ bool Player::CanSpeak() const void Player::SendAttackSwingNotInRange() { WorldPacket data(SMSG_ATTACKSWING_NOTINRANGE, 0); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint32 zone,uint64 guid) @@ -17850,7 +17850,7 @@ void Player::SaveDataFieldToDB() std::ostringstream ss; ss<<"UPDATE characters SET data='"; - for (uint16 i = 0; i < m_valuesCount; i++ ) + for (uint16 i = 0; i < m_valuesCount; i++) { ss << GetUInt32Value(i) << " "; } @@ -17926,37 +17926,37 @@ void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 void Player::SendAttackSwingDeadTarget() { WorldPacket data(SMSG_ATTACKSWING_DEADTARGET, 0); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SendAttackSwingCantAttack() { WorldPacket data(SMSG_ATTACKSWING_CANT_ATTACK, 0); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SendAttackSwingCancelAttack() { WorldPacket data(SMSG_CANCEL_COMBAT, 0); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SendAttackSwingBadFacingAttack() { WorldPacket data(SMSG_ATTACKSWING_BADFACING, 0); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SendAutoRepeatCancel(Unit *target) { WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, target->GetPackGUID().size()); data.append(target->GetPackGUID()); // may be it's target guid - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } void Player::SendExplorationExperience(uint32 Area, uint32 Experience) { - WorldPacket data( SMSG_EXPLORATION_EXPERIENCE, 8 ); + WorldPacket data(SMSG_EXPLORATION_EXPERIENCE, 8); data << Area; data << Experience; GetSession()->SendPacket(&data); @@ -17997,7 +17997,7 @@ void Player::ResetInstances(uint8 method, bool isRaid) // we assume that when the difficulty changes, all instances that can be reset will be Difficulty diff = GetDifficulty(isRaid); - for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end(); ) + for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { InstanceSave *p = itr->second.save; const MapEntry *entry = sMapStore.LookupEntry(itr->first); @@ -18153,10 +18153,10 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) if (spellInfo->Reagent[i] > 0) { ItemPosCountVec dest; //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout) - uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, spellInfo->Reagent[i], spellInfo->ReagentCount[i] ); - if ( msg == EQUIP_ERR_OK ) + uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellInfo->Reagent[i], spellInfo->ReagentCount[i]); + if (msg == EQUIP_ERR_OK) { - Item* item = StoreNewItem( dest, spellInfo->Reagent[i], true); + Item* item = StoreNewItem(dest, spellInfo->Reagent[i], true); if (IsInWorld()) SendNewItem(item,spellInfo->ReagentCount[i],true,false); } @@ -18686,7 +18686,7 @@ void Player::RemoveSpellMods(Spell * spell) void Player::DropModCharge(SpellModifier * mod, Spell * spell) { - if (spell && mod->ownerAura && mod->charges > 0 ) + if (spell && mod->ownerAura && mod->charges > 0) { --mod->charges; if (mod->charges == 0) @@ -18736,7 +18736,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) if (owner) owner->GetSession()->SendPetitionQueryOpcode(petitionguid); - } while ( result->NextRow() ); + } while (result->NextRow()); if (type==10) CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE playerguid = '%u'", GUID_LOPART(guid)); @@ -18875,7 +18875,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc return false; } - if ( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW ) + if (m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIPLAYERSHAPESHIFTED); @@ -18897,7 +18897,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc { RemoveAurasByType(SPELL_AURA_MOUNTED); - if ( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW ) + if (m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW) RemoveAurasDueToSpell(m_ShapeShiftFormSpellId); if (Spell* spell = GetCurrentSpell(CURRENT_GENERIC_SPELL)) @@ -19053,7 +19053,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc return true; } -bool Player::ActivateTaxiPathTo( uint32 taxi_path_id, uint32 spellid /*= 0*/ ) +bool Player::ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid /*= 0*/) { TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(taxi_path_id); if (!entry) @@ -19082,7 +19082,7 @@ void Player::ContinueTaxiFlight() if (!sourceNode) return; - sLog.outDebug( "WORLD: Restart character %u taxi flight", GetGUIDLow() ); + sLog.outDebug("WORLD: Restart character %u taxi flight", GetGUIDLow()); uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourceNode, GetTeam(),true); uint32 path = m_taxi.GetCurrentTaxiPath(); @@ -19129,7 +19129,7 @@ void Player::ContinueTaxiFlight() GetSession()->SendDoFlight(mountDisplayId, path, startNode); } -void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ) +void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs) { // last check 2.0.10 WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+m_spells.size()*8); @@ -19155,7 +19155,7 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ) if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE) continue; - if ((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs ) + if ((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs) { data << uint32(unSpellId); data << uint32(unTimeMs); // in m.secs @@ -19223,12 +19223,12 @@ void Player::InitDisplayIds() switch(gender) { case GENDER_FEMALE: - SetDisplayId(info->displayId_f ); - SetNativeDisplayId(info->displayId_f ); + SetDisplayId(info->displayId_f); + SetNativeDisplayId(info->displayId_f); break; case GENDER_MALE: - SetDisplayId(info->displayId_m ); - SetNativeDisplayId(info->displayId_m ); + SetDisplayId(info->displayId_m); + SetNativeDisplayId(info->displayId_m); break; default: sLog.outError("Invalid gender %u for player",gender); @@ -19249,32 +19249,32 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint if (!isAlive()) return false; - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); + ItemPrototype const *pProto = objmgr.GetItemPrototype(item); if (!pProto) { - SendBuyError( BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); + SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); return false; } Creature *pCreature = GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); if (!pCreature) { - sLog.outDebug( "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); - SendBuyError( BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0); + sLog.outDebug("WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); + SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0); return false; } VendorItemData const* vItems = pCreature->GetVendorItems(); if (!vItems || vItems->Empty()) { - SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); + SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); return false; } size_t vendor_slot = vItems->FindItemSlot(item); if (vendor_slot >= vItems->GetItemCount()) { - SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); + SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); return false; } @@ -19283,23 +19283,23 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint // check current item amount if it limited if (crItem->maxcount != 0) { - if (pCreature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count ) + if (pCreature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count) { - SendBuyError( BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0); + SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0); return false; } } if (pProto->RequiredReputationFaction && (uint32(GetReputationRank(pProto->RequiredReputationFaction)) < pProto->RequiredReputationRank)) { - SendBuyError( BUY_ERR_REPUTATION_REQUIRE, pCreature, item, 0); + SendBuyError(BUY_ERR_REPUTATION_REQUIRE, pCreature, item, 0); return false; } else if (!pProto->RequiredReputationFaction && pProto->RequiredReputationRank > 0) { if (uint32(GetReputationRank(pCreature->getFactionTemplateEntry()->faction)) < pProto->RequiredReputationRank) { - SendBuyError( BUY_ERR_REPUTATION_REQUIRE, pCreature, item, 0); + SendBuyError(BUY_ERR_REPUTATION_REQUIRE, pCreature, item, 0); return false; } } @@ -19338,7 +19338,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint } // check for personal arena rating requirement - if ( GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating ) + if (GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating) { // probably not the proper equip err SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK,NULL,NULL); @@ -19353,30 +19353,30 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint if (GetMoney() < price) { - SendBuyError( BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, item, 0); + SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, item, 0); return false; } if ((bag == NULL_BAG && slot == NULL_SLOT) || IsInventoryPos(bag, slot)) { ItemPosCountVec dest; - uint8 msg = CanStoreNewItem( bag, slot, dest, item, pProto->BuyCount * count ); + uint8 msg = CanStoreNewItem(bag, slot, dest, item, pProto->BuyCount * count); if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, NULL, NULL ); + SendEquipError(msg, NULL, NULL); return false; } - ModifyMoney( -(int32)price ); + ModifyMoney(-(int32)price); if (crItem->ExtendedCost) // case for new honor system { ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); if (iece->reqhonorpoints) - ModifyHonorPoints( - int32(iece->reqhonorpoints * count) ); + ModifyHonorPoints(- int32(iece->reqhonorpoints * count)); if (iece->reqarenapoints) - ModifyArenaPoints( - int32(iece->reqarenapoints * count) ); + ModifyArenaPoints(- int32(iece->reqarenapoints * count)); for (uint8 i = 0; i < 5; ++i) { @@ -19385,7 +19385,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint } } - if (Item *it = StoreNewItem( dest, item, true )) + if (Item *it = StoreNewItem(dest, item, true)) { uint32 new_count = pCreature->UpdateVendorItemCurrentCount(crItem,pProto->BuyCount * count); @@ -19411,27 +19411,27 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint { if (pProto->BuyCount * count != 1) { - SendEquipError( EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, NULL ); + SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, NULL); return false; } uint16 dest; - uint8 msg = CanEquipNewItem( slot, dest, item, false ); + uint8 msg = CanEquipNewItem(slot, dest, item, false); if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, NULL, NULL ); + SendEquipError(msg, NULL, NULL); return false; } - ModifyMoney( -(int32)price ); + ModifyMoney(-(int32)price); if (crItem->ExtendedCost) // case for new honor system { ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); if (iece->reqhonorpoints) - ModifyHonorPoints( - int32(iece->reqhonorpoints * count) ); + ModifyHonorPoints(- int32(iece->reqhonorpoints * count)); if (iece->reqarenapoints) - ModifyArenaPoints( - int32(iece->reqarenapoints * count) ); + ModifyArenaPoints(- int32(iece->reqarenapoints * count)); for (uint8 i = 0; i < 5; ++i) { @@ -19440,7 +19440,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint } } - if (Item *it = EquipNewItem( dest, item, true )) + if (Item *it = EquipNewItem(dest, item, true)) { uint32 new_count = pCreature->UpdateVendorItemCurrentCount(crItem,pProto->BuyCount * count); @@ -19467,7 +19467,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint } else { - SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); + SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); return false; } @@ -19654,7 +19654,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it if (catrec < 0) catrec = 0; // no cooldown after applying spell mods - if ( rec == 0 && catrec == 0) + if (rec == 0 && catrec == 0) return; catrecTime = catrec ? curTime+catrec/IN_MILISECONDS : 0; @@ -19819,7 +19819,7 @@ void Player::CorrectMetaGemEnchants(uint8 exceptslot, bool apply) if (slot == exceptslot) continue; - Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, slot ); + Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (!pItem || !pItem->GetProto()->Socket[0].Color) continue; @@ -19861,7 +19861,7 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply) if (slot == exceptslot) continue; - Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, slot ); + Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (!pItem || !pItem->GetProto()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item continue; @@ -19942,9 +19942,9 @@ void Player::LeaveBattleground(bool teleportToEntryPoint) bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true); // call after remove to be sure that player resurrected for correct cast - if ( bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) ) + if (bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER)) { - if ( bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN ) + if (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN) { //lets check if player was teleported from BG and schedule delayed Deserter spell cast if (IsBeingTeleportedFar()) @@ -20107,7 +20107,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool // player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting) if (!m_mover->canDetectInvisibilityOf(u)) - if (!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(const_cast<Player*>(u->ToPlayer() )))) + if (!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(const_cast<Player*>(u->ToPlayer())))) return false; } @@ -20131,7 +20131,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool return true; } -bool Player::IsVisibleInGridForPlayer( Player const * pl ) const +bool Player::IsVisibleInGridForPlayer(Player const * pl) const { // gamemaster in GM mode see all, including ghosts if (pl->isGameMaster() && GetSession()->GetSecurity() <= pl->GetSession()->GetSecurity()) @@ -20140,7 +20140,7 @@ bool Player::IsVisibleInGridForPlayer( Player const * pl ) const // It seems in battleground everyone sees everyone, except the enemy-faction ghosts if (InBattleGround()) { - if (!(isAlive() || m_deathTimer > 0) && !IsFriendlyTo(pl) ) + if (!(isAlive() || m_deathTimer > 0) && !IsFriendlyTo(pl)) return false; return true; } @@ -20171,7 +20171,7 @@ bool Player::IsVisibleInGridForPlayer( Player const * pl ) const return false; } -bool Player::IsVisibleGloballyFor( Player* u ) const +bool Player::IsVisibleGloballyFor(Player* u) const { if (!u) return false; @@ -20507,7 +20507,7 @@ void Player::SendInitialPacketsBeforeAddToMap() data << uint32(secsToTimeBitFields(sWorld.GetGameTime())); data << (float)0.01666667f; // game speed data << uint32(0); // added in 3.1.2 - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); GetReputationMgr().SendForceReactions(); // SMSG_SET_FORCED_REACTIONS @@ -20593,7 +20593,7 @@ void Player::SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 GetSession()->SendPacket(&data); } -void Player::SendInstanceResetWarning( uint32 mapid, Difficulty difficulty, uint32 time ) +void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time) { // type of warning, based on the time remaining until reset uint32 type; @@ -20619,18 +20619,18 @@ void Player::SendInstanceResetWarning( uint32 mapid, Difficulty difficulty, uint GetSession()->SendPacket(&data); } -void Player::ApplyEquipCooldown( Item * pItem ) +void Player::ApplyEquipCooldown(Item * pItem) { for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { _Spell const& spellData = pItem->GetProto()->Spells[i]; // no spell - if ( !spellData.SpellId ) + if (!spellData.SpellId) continue; // wrong triggering type (note: ITEM_SPELLTRIGGER_ON_NO_DELAY_USE not have cooldown) - if ( spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE ) + if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) continue; AddSpellCooldown(spellData.SpellId, pItem->GetEntry(), time(NULL) + 30); @@ -20719,7 +20719,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) uint32 src_spell_id = quest->GetSrcSpell(); // skip quests without rewarded spell - if ( !spell_id ) + if (!spell_id) return; // if RewSpellCast = -1 we remove aura do to SrcSpell from player. @@ -20750,11 +20750,11 @@ void Player::learnQuestRewardedSpells(Quest const* quest) // prevent learn non first rank unknown profession and second specialization for same profession) uint32 learned_0 = spellInfo->EffectTriggerSpell[0]; - if ( spellmgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0) ) + if (spellmgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0)) { // not have first rank learned (unlearned prof?) uint32 first_spell = spellmgr.GetFirstSpellInChain(learned_0); - if ( !HasSpell(first_spell) ) + if (!HasSpell(first_spell)) return; SpellEntry const *learnedInfo = sSpellStore.LookupEntry(learned_0); @@ -20791,7 +20791,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) } } - CastSpell( this, spell_id, true); + CastSpell(this, spell_id, true); } void Player::learnQuestRewardedSpells() @@ -20804,14 +20804,14 @@ void Player::learnQuestRewardedSpells() continue; Quest const* quest = objmgr.GetQuestTemplate(itr->first); - if ( !quest ) + if (!quest) continue; learnQuestRewardedSpells(quest); } } -void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value ) +void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value) { uint32 raceMask = getRaceMask(); uint32 classMask = getClassMask(); @@ -20880,7 +20880,7 @@ void Player::SendAurasForTarget(Unit *target) GetSession()->SendPacket(&data); } -void Player::SetDailyQuestStatus( uint32 quest_id ) +void Player::SetDailyQuestStatus(uint32 quest_id) { for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) { @@ -20939,7 +20939,7 @@ bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const return true; } -float Player::GetReputationPriceDiscount( Creature const* pCreature ) const +float Player::GetReputationPriceDiscount(Creature const* pCreature) const { FactionTemplateEntry const* vendor_faction = pCreature->getFactionTemplateEntry(); if (!vendor_faction || !vendor_faction->faction) @@ -20952,7 +20952,7 @@ float Player::GetReputationPriceDiscount( Creature const* pCreature ) const return 1.0f - 0.05f* (rank - REP_NEUTRAL); } -bool Player::IsSpellFitByClassAndRace( uint32 spell_id ) const +bool Player::IsSpellFitByClassAndRace(uint32 spell_id) const { uint32 racemask = getRaceMask(); uint32 classmask = getClassMask(); @@ -21149,7 +21149,7 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons case ITEM_CLASS_WEAPON: { for (uint8 i= EQUIPMENT_SLOT_MAINHAND; i < EQUIPMENT_SLOT_TABARD; ++i) - if (Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item *item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; break; @@ -21158,17 +21158,17 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons { // tabard not have dependent spells for (uint8 i= EQUIPMENT_SLOT_START; i< EQUIPMENT_SLOT_MAINHAND; ++i) - if (Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, i )) + if (Item *item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; // shields can be equipped to offhand slot - if (Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) + if (Item *item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; // ranged slot can have some armor subclasses - if (Item *item = GetUseableItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED)) + if (Item *item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; @@ -21200,7 +21200,7 @@ bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const return false; } -void Player::RemoveItemDependentAurasAndCasts( Item * pItem ) +void Player::RemoveItemDependentAurasAndCasts(Item * pItem) { for (AuraMap::iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end();) { @@ -21228,7 +21228,7 @@ void Player::RemoveItemDependentAurasAndCasts( Item * pItem ) // currently casted spells can be dependent from item for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i))) - if (spell->getState()!=SPELL_STATE_DELAYED && !HasItemFitToSpellReqirements(spell->m_spellInfo,pItem) ) + if (spell->getState()!=SPELL_STATE_DELAYED && !HasItemFitToSpellReqirements(spell->m_spellInfo,pItem)) InterruptSpell(CurrentSpellTypes(i)); } @@ -21241,7 +21241,7 @@ uint32 Player::GetResurrectionSpellId() for (AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) { // Soulstone Resurrection // prio: 3 (max, non death persistent) - if (prio < 2 && (*itr)->GetSpellProto()->SpellVisual[0] == 99 && (*itr)->GetSpellProto()->SpellIconID == 92 ) + if (prio < 2 && (*itr)->GetSpellProto()->SpellVisual[0] == 99 && (*itr)->GetSpellProto()->SpellIconID == 92) { switch ((*itr)->GetId()) { @@ -21473,18 +21473,18 @@ void Player::ResurectUsingRequestData() ResurrectPlayer(0.0f,false); if (GetMaxHealth() > m_resurrectHealth) - SetHealth( m_resurrectHealth ); + SetHealth(m_resurrectHealth); else - SetHealth( GetMaxHealth() ); + SetHealth(GetMaxHealth()); if (GetMaxPower(POWER_MANA) > m_resurrectMana) - SetPower(POWER_MANA, m_resurrectMana ); + SetPower(POWER_MANA, m_resurrectMana); else - SetPower(POWER_MANA, GetMaxPower(POWER_MANA) ); + SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); - SetPower(POWER_RAGE, 0 ); + SetPower(POWER_RAGE, 0); - SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY) ); + SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); SpawnCorpseBones(); } @@ -21499,17 +21499,17 @@ void Player::SetClientControl(Unit* target, uint8 allowMove) SetMover(this); } -void Player::UpdateZoneDependentAuras( uint32 newZone ) +void Player::UpdateZoneDependentAuras(uint32 newZone) { // Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newZone); for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if (itr->second->autocast && itr->second->IsFitToRequirements(this,newZone,0)) - if ( !HasAura(itr->second->spellId) ) + if (!HasAura(itr->second->spellId)) CastSpell(this,itr->second->spellId,true); } -void Player::UpdateAreaDependentAuras( uint32 newArea ) +void Player::UpdateAreaDependentAuras(uint32 newArea) { // remove auras from spells with area limitations for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) @@ -21525,7 +21525,7 @@ void Player::UpdateAreaDependentAuras( uint32 newArea ) SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newArea); for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if (itr->second->autocast && itr->second->IsFitToRequirements(this,m_zoneUpdateId,newArea)) - if ( !HasAura(itr->second->spellId) ) + if (!HasAura(itr->second->spellId)) CastSpell(this,itr->second->spellId,true); if (newArea == 4273 && GetVehicle() && GetPositionX() > 400) // Ulduar @@ -21548,7 +21548,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const if (!sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) return copseReclaimDelay[0]; } - else if (!sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) + else if (!sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)) return 0; time_t now = time(NULL); @@ -21563,7 +21563,7 @@ void Player::UpdateCorpseReclaimDelay() bool pvp = m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH; if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) || - (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )) + (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE))) return; time_t now = time(NULL); @@ -21599,8 +21599,8 @@ void Player::SendCorpseReclaimDelay(bool load) return; uint32 count; - if ( pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) || - !pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) + if (pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) || + !pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)) { count = (m_deathExpireTime-corpse->GetGhostTime())/DEATH_EXPIRE_STEP; if (count>=MAX_DEATH_COUNT) @@ -21625,7 +21625,7 @@ void Player::SendCorpseReclaimDelay(bool load) //! corpse reclaim delay 30 * 1000ms or longer at often deaths WorldPacket data(SMSG_CORPSE_RECLAIM_DELAY, 4); data << uint32(delay*IN_MILISECONDS); - GetSession()->SendPacket( &data ); + GetSession()->SendPacket(&data); } Player* Player::GetNextRandomRaidMember(float radius) @@ -21642,8 +21642,8 @@ Player* Player::GetNextRandomRaidMember(float radius) Player* Target = itr->getSource(); // IsHostileTo check duel and controlled by enemy - if ( Target && Target != this && IsWithinDistInMap(Target, radius) && - !Target->HasInvisibilityAura() && !IsHostileTo(Target) ) + if (Target && Target != this && IsWithinDistInMap(Target, radius) && + !Target->HasInvisibilityAura() && !IsHostileTo(Target)) nearMembers.push_back(Target); } @@ -21683,7 +21683,7 @@ void Player::RemoveFromBattleGroundRaid() { //remove existing reference m_group.unlink(); - if ( Group* group = GetOriginalGroup() ) + if (Group* group = GetOriginalGroup()) { m_group.link(group, this); m_group.setSubGroup(GetOriginalSubGroup()); @@ -21693,7 +21693,7 @@ void Player::RemoveFromBattleGroundRaid() void Player::SetOriginalGroup(Group *group, int8 subgroup) { - if ( group == NULL ) + if (group == NULL) m_originalGroup.unlink(); else { @@ -21704,7 +21704,7 @@ void Player::SetOriginalGroup(Group *group, int8 subgroup) } } -void Player::UpdateUnderwaterState( Map* m, float x, float y, float z ) +void Player::UpdateUnderwaterState(Map* m, float x, float y, float z) { LiquidData liquid_status; ZLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status); @@ -21720,7 +21720,7 @@ void Player::UpdateUnderwaterState( Map* m, float x, float y, float z ) // All liquids type - check under water position if (liquid_status.type&(MAP_LIQUID_TYPE_WATER|MAP_LIQUID_TYPE_OCEAN|MAP_LIQUID_TYPE_MAGMA|MAP_LIQUID_TYPE_SLIME)) { - if ( res & LIQUID_MAP_UNDER_WATER) + if (res & LIQUID_MAP_UNDER_WATER) m_MirrorTimerFlags |= UNDERWATER_INWATER; else m_MirrorTimerFlags &= ~UNDERWATER_INWATER; @@ -21750,7 +21750,7 @@ void Player::UpdateUnderwaterState( Map* m, float x, float y, float z ) } } -void Player::SetCanParry( bool value ) +void Player::SetCanParry(bool value) { if (m_canParry==value) return; @@ -21759,7 +21759,7 @@ void Player::SetCanParry( bool value ) UpdateParryPercentage(); } -void Player::SetCanBlock( bool value ) +void Player::SetCanBlock(bool value) { if (m_canBlock==value) return; @@ -21844,7 +21844,7 @@ bool Player::CanUseBattleGroundObject() // TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction) // maybe gameobject code should handle that ForceReaction usage // BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet - return ( //InBattleGround() && // in battleground - not need, check in other cases + return (//InBattleGround() && // in battleground - not need, check in other cases //!IsMounted() && - not correct, player is dismounted when he clicks on flag //player cannot use object when he is invulnerable (immune) !isTotalImmune() && // not totally immune @@ -21853,18 +21853,18 @@ bool Player::CanUseBattleGroundObject() !HasInvisibilityAura() && // not invisible !HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // can't pickup isAlive() // live player - ); +); } bool Player::CanCaptureTowerPoint() { - return ( !HasStealthAura() && // not stealthed + return (!HasStealthAura() && // not stealthed !HasInvisibilityAura() && // not invisible isAlive() // live player - ); +); } -uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin ) +uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin) { uint8 level = getLevel(); @@ -21935,7 +21935,7 @@ bool Player::isTotalImmune() for (AuraEffectList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr) { immuneMask |= (*itr)->GetMiscValue(); - if ( immuneMask & SPELL_SCHOOL_MASK_ALL ) // total immunity + if (immuneMask & SPELL_SCHOOL_MASK_ALL) // total immunity return true; } return false; @@ -22159,12 +22159,12 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons ItemPosCountVec dest; uint8 msg = CanStoreNewItem (bag,slot,dest,lootItem->itemid,lootItem->count); if (msg != EQUIP_ERR_OK && slot != NULL_SLOT) - msg = CanStoreNewItem( bag, NULL_SLOT,dest,lootItem->itemid,lootItem->count); - if ( msg != EQUIP_ERR_OK && bag != NULL_BAG) - msg = CanStoreNewItem( NULL_BAG, NULL_SLOT,dest,lootItem->itemid,lootItem->count); + msg = CanStoreNewItem(bag, NULL_SLOT,dest,lootItem->itemid,lootItem->count); + if (msg != EQUIP_ERR_OK && bag != NULL_BAG) + msg = CanStoreNewItem(NULL_BAG, NULL_SLOT,dest,lootItem->itemid,lootItem->count); if (msg != EQUIP_ERR_OK) { - SendEquipError( msg, NULL, NULL ); + SendEquipError(msg, NULL, NULL); continue; } @@ -22242,7 +22242,7 @@ void Player::_LoadSkills(QueryResult_AutoPtr result) if (value == 0) { sLog.outError("Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill); - CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), skill ); + CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), skill); continue; } @@ -22357,7 +22357,7 @@ uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) c return EQUIP_ERR_OK; } -uint8 Player::CanEquipUniqueItem( ItemPrototype const* itemProto, uint8 except_slot, uint32 limit_count) const +uint8 Player::CanEquipUniqueItem(ItemPrototype const* itemProto, uint8 except_slot, uint32 limit_count) const { // check unique-equipped on item if (itemProto->Flags & ITEM_FLAGS_UNIQUE_EQUIPPED) @@ -22395,7 +22395,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) // 14.57 can be calculated by resolving damageperc formula below to 0 if (z_diff >= 14.57f && !isDead() && !isGameMaster() && !HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) && - !HasAuraType(SPELL_AURA_FLY) && !IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL) ) + !HasAuraType(SPELL_AURA_FLY) && !IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL)) { //Safe fall, fall height reduction int32 safe_fall = GetTotalAuraModifier(SPELL_AURA_SAFE_FALL); @@ -22434,7 +22434,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // No fly zone - Parachute } -void Player::UpdateAchievementCriteria( AchievementCriteriaTypes type, uint32 miscvalue1/*=0*/, uint32 miscvalue2/*=0*/, Unit *unit/*=NULL*/, uint32 time/*=0*/ ) +void Player::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1/*=0*/, uint32 miscvalue2/*=0*/, Unit *unit/*=NULL*/, uint32 time/*=0*/) { GetAchievementMgr().UpdateAchievementCriteria(type, miscvalue1, miscvalue2, unit, time); } @@ -22454,18 +22454,18 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) if (talentRank >= MAX_TALENT_RANK) return; - TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentId ); + TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId); if (!talentInfo) return; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab ); + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) return; // prevent learn talent for different class (cheating) - if ( (getClassMask() & talentTabInfo->ClassMask) == 0 ) + if ((getClassMask() & talentTabInfo->ClassMask) == 0) return; // find current max talent rank (0~5) @@ -22540,7 +22540,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) // spell not set in talent.dbc uint32 spellid = talentInfo->RankID[talentRank]; - if ( spellid == 0 ) + if (spellid == 0) { sLog.outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); return; @@ -22677,7 +22677,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) // spell not set in talent.dbc uint32 spellid = talentInfo->RankID[talentRank]; - if ( spellid == 0 ) + if (spellid == 0) { sLog.outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); return; @@ -22706,7 +22706,7 @@ void Player::UpdateKnownCurrencies(uint32 itemId, bool apply) } } -void Player::UpdateFallInformationIfNeed( MovementInfo const& minfo,uint16 opcode ) +void Player::UpdateFallInformationIfNeed(MovementInfo const& minfo,uint16 opcode) { if (m_lastFallTime >= minfo.fallTime || m_lastFallZ <=minfo.z || opcode == MSG_MOVE_FALL_LAND) SetFallInformation(minfo.fallTime, minfo.z); @@ -22718,7 +22718,7 @@ void Player::UnsummonPetTemporaryIfAny() if (!pet) return; - if (!m_temporaryUnsummonedPetNumber && pet->isControlled() && !pet->isTemporarySummoned() ) + if (!m_temporaryUnsummonedPetNumber && pet->isControlled() && !pet->isTemporarySummoned()) { m_temporaryUnsummonedPetNumber = pet->GetCharmInfo()->GetPetNumber(); m_oldpetspell = pet->GetUInt32Value(UNIT_CREATED_BY_SPELL); @@ -22854,7 +22854,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data) for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId) { - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId ); + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentTabId); if (!talentTabInfo) continue; @@ -23076,7 +23076,7 @@ void Player::DeleteEquipmentSet(uint64 setGuid) } } -void Player::RemoveAtLoginFlag( AtLoginFlags f, bool in_db_also /*= false*/ ) +void Player::RemoveAtLoginFlag(AtLoginFlags f, bool in_db_also /*= false*/) { m_atLoginFlags &= ~f; @@ -23084,7 +23084,7 @@ void Player::RemoveAtLoginFlag( AtLoginFlags f, bool in_db_also /*= false*/ ) CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(f), GetGUIDLow()); } -void Player::SendClearCooldown( uint32 spell_id, Unit* target ) +void Player::SendClearCooldown(uint32 spell_id, Unit* target) { WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(spell_id); @@ -23155,7 +23155,7 @@ void Player::_LoadTalents(QueryResult_AutoPtr result) AddTalent(fields[0].GetUInt32(), fields[1].GetUInt32(), false); } - while ( result->NextRow() ); + while (result->NextRow()); } } diff --git a/src/game/Player.h b/src/game/Player.h index e9849d5f7ee..3f32047e4a9 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -158,7 +158,7 @@ enum ActionButtonType struct ActionButton { - ActionButton() : packedData(0), uState( ACTIONBUTTON_NEW ), canRemoveByClient(true){} + ActionButton() : packedData(0), uState(ACTIONBUTTON_NEW), canRemoveByClient(true){} uint32 packedData; ActionButtonUpdateState uState; @@ -209,7 +209,7 @@ struct PlayerClassInfo struct PlayerLevelInfo { - PlayerLevelInfo() { for (uint8 i=0; i < MAX_STATS; ++i ) stats[i] = 0; } + PlayerLevelInfo() { for (uint8 i=0; i < MAX_STATS; ++i) stats[i] = 0; } uint8 stats[MAX_STATS]; }; @@ -353,7 +353,7 @@ struct LookingForGroupSlot LookingForGroupSlot() : entry(0), type(0) {} bool Empty() const { return !entry && !type; } void Clear() { entry = 0; type = 0; } - void Set(uint32 _entry, uint32 _type ) { entry = _entry; type = _type; } + void Set(uint32 _entry, uint32 _type) { entry = _entry; type = _type; } bool Is(uint32 _entry, uint32 _type) const { return entry == _entry && type == _type; } bool canAutoJoin() const { return entry && (type == LFG_TYPE_DUNGEON || type == LFG_TYPE_HEROIC_DUNGEON); } @@ -914,7 +914,7 @@ class PlayerTaxi { uint8 field = uint8((nodeidx - 1) / 32); uint32 submask = 1<<((nodeidx-1)%32); - if ((m_taximask[field] & submask) != submask ) + if ((m_taximask[field] & submask) != submask) { m_taximask[field] |= submask; return true; @@ -982,7 +982,7 @@ class Player : public Unit, public GridObject<Player> friend void Item::RemoveFromUpdateQueueOf(Player *player); public: explicit Player (WorldSession *session); - ~Player ( ); + ~Player (); void CleanupsBeforeDelete(bool finalCleanup = true); @@ -1012,11 +1012,11 @@ class Player : public Unit, public GridObject<Player> } void SummonIfPossible(bool agree); - bool Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ); + bool Create(uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId); - void Update( uint32 time ); + void Update(uint32 time); - static bool BuildEnumData( QueryResult_AutoPtr result, WorldPacket * p_data ); + static bool BuildEnumData(QueryResult_AutoPtr result, WorldPacket * p_data); void SetInWater(bool apply); @@ -1116,15 +1116,15 @@ class Player : public Unit, public GridObject<Player> /*** STORAGE SYSTEM ***/ /*********************************************************/ - void SetVirtualItemSlot( uint8 i, Item* item); - void SetSheath( SheathState sheathed ); // overwrite Unit version - uint8 FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const; - uint32 GetItemCount( uint32 item, bool inBankAlso = false, Item* skipItem = NULL ) const; - Item* GetItemByGuid( uint64 guid ) const; - Item* GetItemByEntry( uint32 entry ) const; - Item* GetItemByPos( uint16 pos ) const; - Item* GetItemByPos( uint8 bag, uint8 slot ) const; - inline Item* GetUseableItemByPos( uint8 bag, uint8 slot ) const //Does additional check for disarmed weapons + void SetVirtualItemSlot(uint8 i, Item* item); + void SetSheath(SheathState sheathed); // overwrite Unit version + uint8 FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap) const; + uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const; + Item* GetItemByGuid(uint64 guid) const; + Item* GetItemByEntry(uint32 entry) const; + Item* GetItemByPos(uint16 pos) const; + Item* GetItemByPos(uint8 bag, uint8 slot) const; + inline Item* GetUseableItemByPos(uint8 bag, uint8 slot) const //Does additional check for disarmed weapons { if (!CanUseAttackType(GetAttackBySlot(slot))) return NULL; @@ -1132,118 +1132,118 @@ class Player : public Unit, public GridObject<Player> } Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const; Item* GetShield(bool useable = false) const; - static uint8 GetAttackBySlot( uint8 slot ); // MAX_ATTACK if not weapon slot + static uint8 GetAttackBySlot(uint8 slot); // MAX_ATTACK if not weapon slot std::vector<Item *> &GetItemUpdateQueue() { return m_itemUpdateQueue; } - static bool IsInventoryPos( uint16 pos ) { return IsInventoryPos(pos >> 8,pos & 255); } - static bool IsInventoryPos( uint8 bag, uint8 slot ); - static bool IsEquipmentPos( uint16 pos ) { return IsEquipmentPos(pos >> 8,pos & 255); } - static bool IsEquipmentPos( uint8 bag, uint8 slot ); - static bool IsBagPos( uint16 pos ); - static bool IsBankPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); } - static bool IsBankPos( uint8 bag, uint8 slot ); - bool IsValidPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); } - bool IsValidPos( uint8 bag, uint8 slot ); + static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8,pos & 255); } + static bool IsInventoryPos(uint8 bag, uint8 slot); + static bool IsEquipmentPos(uint16 pos) { return IsEquipmentPos(pos >> 8,pos & 255); } + static bool IsEquipmentPos(uint8 bag, uint8 slot); + static bool IsBagPos(uint16 pos); + static bool IsBankPos(uint16 pos) { return IsBankPos(pos >> 8,pos & 255); } + static bool IsBankPos(uint8 bag, uint8 slot); + bool IsValidPos(uint16 pos) { return IsBankPos(pos >> 8,pos & 255); } + bool IsValidPos(uint8 bag, uint8 slot); uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); } void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); } - bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const; + bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const; bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL); bool CanNoReagentCast(SpellEntry const* spellInfo) const; - bool HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; - bool HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const; + bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; + bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const; uint8 CountItemWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const; uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); } uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); } - uint8 CanStoreNewItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL ) const + uint8 CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL) const { - return _CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count ); + return _CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count); } - uint8 CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap = false ) const + uint8 CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap = false) const { if (!pItem) return EQUIP_ERR_ITEM_NOT_FOUND; uint32 count = pItem->GetCount(); - return _CanStoreItem( bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL ); + return _CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL); } - uint8 CanStoreItems( Item **pItem,int count) const; - uint8 CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, bool swap ) const; - uint8 CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading = true ) const; - - uint8 CanEquipUniqueItem( Item * pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1 ) const; - uint8 CanEquipUniqueItem( ItemPrototype const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1 ) const; - uint8 CanUnequipItems( uint32 item, uint32 count ) const; - uint8 CanUnequipItem( uint16 src, bool swap ) const; - uint8 CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap, bool not_loading = true ) const; - uint8 CanUseItem( Item *pItem, bool not_loading = true ) const; - bool HasItemTotemCategory( uint32 TotemCategory ) const; - bool CanUseItem( ItemPrototype const *pItem ); - uint8 CanUseAmmo( uint32 item ) const; - Item* StoreNewItem( ItemPosCountVec const& pos, uint32 item, bool update,int32 randomPropertyId = 0 ); - Item* StoreItem( ItemPosCountVec const& pos, Item *pItem, bool update ); - Item* EquipNewItem( uint16 pos, uint32 item, bool update ); - Item* EquipItem( uint16 pos, Item *pItem, bool update ); + uint8 CanStoreItems(Item **pItem,int count) const; + uint8 CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) const; + uint8 CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading = true) const; + + uint8 CanEquipUniqueItem(Item * pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const; + uint8 CanEquipUniqueItem(ItemPrototype const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const; + uint8 CanUnequipItems(uint32 item, uint32 count) const; + uint8 CanUnequipItem(uint16 src, bool swap) const; + uint8 CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap, bool not_loading = true) const; + uint8 CanUseItem(Item *pItem, bool not_loading = true) const; + bool HasItemTotemCategory(uint32 TotemCategory) const; + bool CanUseItem(ItemPrototype const *pItem); + uint8 CanUseAmmo(uint32 item) const; + Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update,int32 randomPropertyId = 0); + Item* StoreItem(ItemPosCountVec const& pos, Item *pItem, bool update); + Item* EquipNewItem(uint16 pos, uint32 item, bool update); + Item* EquipItem(uint16 pos, Item *pItem, bool update); void AutoUnequipOffhandIfNeed(bool force = false); bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count); void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false); void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG,NULL_SLOT,loot_id,store,broadcast); } uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; - uint8 _CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL ) const; + uint8 _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; void AddRefundReference(uint64 it); void DeleteRefundReference(uint64 it); - void ApplyEquipCooldown( Item * pItem ); - void SetAmmo( uint32 item ); + void ApplyEquipCooldown(Item * pItem); + void SetAmmo(uint32 item); void RemoveAmmo(); float GetAmmoDPS() const { return m_ammoDPS; } bool CheckAmmoCompatibility(const ItemPrototype *ammo_proto) const; - void QuickEquipItem( uint16 pos, Item *pItem); - void VisualizeItem( uint8 slot, Item *pItem); + void QuickEquipItem(uint16 pos, Item *pItem); + void VisualizeItem(uint8 slot, Item *pItem); void SetVisibleItemSlot(uint8 slot, Item *pItem); - Item* BankItem( ItemPosCountVec const& dest, Item *pItem, bool update ) + Item* BankItem(ItemPosCountVec const& dest, Item *pItem, bool update) { - return StoreItem( dest, pItem, update); + return StoreItem(dest, pItem, update); } - Item* BankItem( uint16 pos, Item *pItem, bool update ); - void RemoveItem( uint8 bag, uint8 slot, bool update ); + Item* BankItem(uint16 pos, Item *pItem, bool update); + void RemoveItem(uint8 bag, uint8 slot, bool update); void MoveItemFromInventory(uint8 bag, uint8 slot, bool update); // in trade, auction, guild bank, mail.... void MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB = false); // in trade, guild bank, mail.... - void RemoveItemDependentAurasAndCasts( Item * pItem ); - void DestroyItem( uint8 bag, uint8 slot, bool update ); - void DestroyItemCount( uint32 item, uint32 count, bool update, bool unequip_check = false); - void DestroyItemCount( Item* item, uint32& count, bool update ); - void DestroyConjuredItems( bool update ); - void DestroyZoneLimitedItem( bool update, uint32 new_zone ); - void SplitItem( uint16 src, uint16 dst, uint32 count ); - void SwapItem( uint16 src, uint16 dst ); - void AddItemToBuyBackSlot( Item *pItem ); - Item* GetItemFromBuyBackSlot( uint32 slot ); - void RemoveItemFromBuyBackSlot( uint32 slot, bool del ); + void RemoveItemDependentAurasAndCasts(Item * pItem); + void DestroyItem(uint8 bag, uint8 slot, bool update); + void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check = false); + void DestroyItemCount(Item* item, uint32& count, bool update); + void DestroyConjuredItems(bool update); + void DestroyZoneLimitedItem(bool update, uint32 new_zone); + void SplitItem(uint16 src, uint16 dst, uint32 count); + void SwapItem(uint16 src, uint16 dst); + void AddItemToBuyBackSlot(Item *pItem); + Item* GetItemFromBuyBackSlot(uint32 slot); + void RemoveItemFromBuyBackSlot(uint32 slot, bool del); uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; } - void SendEquipError( uint8 msg, Item* pItem, Item *pItem2 ); - void SendBuyError( uint8 msg, Creature* pCreature, uint32 item, uint32 param ); - void SendSellError( uint8 msg, Creature* pCreature, uint64 guid, uint32 param ); + void SendEquipError(uint8 msg, Item* pItem, Item *pItem2); + void SendBuyError(uint8 msg, Creature* pCreature, uint32 item, uint32 param); + void SendSellError(uint8 msg, Creature* pCreature, uint64 guid, uint32 param); void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; } void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; } uint32 GetWeaponProficiency() const { return m_WeaponProficiency; } uint32 GetArmorProficiency() const { return m_ArmorProficiency; } - bool IsUseEquipedWeapon( bool mainhand ) const + bool IsUseEquipedWeapon(bool mainhand) const { // disarm applied only to mainhand weapon - return !IsInFeralForm() && (!mainhand || !HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISARMED) ); + return !IsInFeralForm() && (!mainhand || !HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISARMED)); } bool IsTwoHandUsed() const { Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip(); } - void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false ); + void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast = false); bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint8 bag, uint8 slot); - float GetReputationPriceDiscount( Creature const* pCreature ) const; + float GetReputationPriceDiscount(Creature const* pCreature) const; Player* GetTrader() const { return pTrader; } void ClearTrade(); void TradeCancel(bool sendback); @@ -1288,46 +1288,46 @@ class Player : public Unit, public GridObject<Player> /*** QUEST SYSTEM ***/ /*********************************************************/ - int32 GetQuestLevel( Quest const* pQuest ) const { return pQuest && (pQuest->GetQuestLevel() > 0) ? pQuest->GetQuestLevel() : getLevel(); } + int32 GetQuestLevel(Quest const* pQuest) const { return pQuest && (pQuest->GetQuestLevel() > 0) ? pQuest->GetQuestLevel() : getLevel(); } - void PrepareQuestMenu( uint64 guid ); - void SendPreparedQuest( uint64 guid ); - bool IsActiveQuest( uint32 quest_id ) const; - Quest const *GetNextQuest( uint64 guid, Quest const *pQuest ); - bool CanSeeStartQuest( Quest const *pQuest ); - bool CanTakeQuest( Quest const *pQuest, bool msg ); - bool CanAddQuest( Quest const *pQuest, bool msg ); - bool CanCompleteQuest( uint32 quest_id ); + void PrepareQuestMenu(uint64 guid); + void SendPreparedQuest(uint64 guid); + bool IsActiveQuest(uint32 quest_id) const; + Quest const *GetNextQuest(uint64 guid, Quest const *pQuest); + bool CanSeeStartQuest(Quest const *pQuest); + bool CanTakeQuest(Quest const *pQuest, bool msg); + bool CanAddQuest(Quest const *pQuest, bool msg); + bool CanCompleteQuest(uint32 quest_id); bool CanCompleteRepeatableQuest(Quest const *pQuest); - bool CanRewardQuest( Quest const *pQuest, bool msg ); - bool CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ); - void AddQuest( Quest const *pQuest, Object *questGiver ); - void CompleteQuest( uint32 quest_id ); - void IncompleteQuest( uint32 quest_id ); - void RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver, bool announce = true ); - void FailQuest( uint32 quest_id ); - bool SatisfyQuestSkillOrClass( Quest const* qInfo, bool msg ); - bool SatisfyQuestLevel( Quest const* qInfo, bool msg ); - bool SatisfyQuestLog( bool msg ); - bool SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ); - bool SatisfyQuestRace( Quest const* qInfo, bool msg ); - bool SatisfyQuestReputation( Quest const* qInfo, bool msg ); - bool SatisfyQuestStatus( Quest const* qInfo, bool msg ); - bool SatisfyQuestTimed( Quest const* qInfo, bool msg ); - bool SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ); - bool SatisfyQuestNextChain( Quest const* qInfo, bool msg ); - bool SatisfyQuestPrevChain( Quest const* qInfo, bool msg ); - bool SatisfyQuestDay( Quest const* qInfo, bool msg ); - bool GiveQuestSourceItem( Quest const *pQuest ); - bool TakeQuestSourceItem( uint32 quest_id, bool msg ); - bool GetQuestRewardStatus( uint32 quest_id ) const; - QuestStatus GetQuestStatus( uint32 quest_id ) const; - void SetQuestStatus( uint32 quest_id, QuestStatus status ); - - void SetDailyQuestStatus( uint32 quest_id ); + bool CanRewardQuest(Quest const *pQuest, bool msg); + bool CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg); + void AddQuest(Quest const *pQuest, Object *questGiver); + void CompleteQuest(uint32 quest_id); + void IncompleteQuest(uint32 quest_id); + void RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver, bool announce = true); + void FailQuest(uint32 quest_id); + bool SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg); + bool SatisfyQuestLevel(Quest const* qInfo, bool msg); + bool SatisfyQuestLog(bool msg); + bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg); + bool SatisfyQuestRace(Quest const* qInfo, bool msg); + bool SatisfyQuestReputation(Quest const* qInfo, bool msg); + bool SatisfyQuestStatus(Quest const* qInfo, bool msg); + bool SatisfyQuestTimed(Quest const* qInfo, bool msg); + bool SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg); + bool SatisfyQuestNextChain(Quest const* qInfo, bool msg); + bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg); + bool SatisfyQuestDay(Quest const* qInfo, bool msg); + bool GiveQuestSourceItem(Quest const *pQuest); + bool TakeQuestSourceItem(uint32 quest_id, bool msg); + bool GetQuestRewardStatus(uint32 quest_id) const; + QuestStatus GetQuestStatus(uint32 quest_id) const; + void SetQuestStatus(uint32 quest_id, QuestStatus status); + + void SetDailyQuestStatus(uint32 quest_id); void ResetDailyQuestStatus(); - uint16 FindQuestSlot( uint32 quest_id ) const; + uint16 FindQuestSlot(uint32 quest_id) const; uint32 GetQuestSlotQuestId(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_ID_OFFSET); } uint32 GetQuestSlotState(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET); } uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const { return (uint16)(GetUInt64Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET) >> (counter * 16)); } @@ -1362,41 +1362,41 @@ class Player : public Unit, public GridObject<Player> } } uint32 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry); - void AreaExploredOrEventHappens( uint32 questId ); - void GroupEventHappens( uint32 questId, WorldObject const* pEventObject ); - void ItemAddedQuestCheck( uint32 entry, uint32 count ); - void ItemRemovedQuestCheck( uint32 entry, uint32 count ); - void KilledMonster( CreatureInfo const* cInfo, uint64 guid ); - void KilledMonsterCredit( uint32 entry, uint64 guid ); - void CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id ); - void TalkedToCreature( uint32 entry, uint64 guid ); - void MoneyChanged( uint32 value ); - void ReputationChanged(FactionEntry const* factionEntry ); - void ReputationChanged2(FactionEntry const* factionEntry ); - bool HasQuestForItem( uint32 itemid ) const; + void AreaExploredOrEventHappens(uint32 questId); + void GroupEventHappens(uint32 questId, WorldObject const* pEventObject); + void ItemAddedQuestCheck(uint32 entry, uint32 count); + void ItemRemovedQuestCheck(uint32 entry, uint32 count); + void KilledMonster(CreatureInfo const* cInfo, uint64 guid); + void KilledMonsterCredit(uint32 entry, uint64 guid); + void CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id); + void TalkedToCreature(uint32 entry, uint64 guid); + void MoneyChanged(uint32 value); + void ReputationChanged(FactionEntry const* factionEntry); + void ReputationChanged2(FactionEntry const* factionEntry); + bool HasQuestForItem(uint32 itemid) const; bool HasQuestForGO(int32 GOId) const; void UpdateForQuestWorldObjects(); bool CanShareQuest(uint32 quest_id) const; - void SendQuestComplete( uint32 quest_id ); - void SendQuestReward( Quest const *pQuest, uint32 XP, Object* questGiver ); - void SendQuestFailed( uint32 quest_id ); - void SendQuestTimerFailed( uint32 quest_id ); - void SendCanTakeQuestResponse( uint32 msg ); + void SendQuestComplete(uint32 quest_id); + void SendQuestReward(Quest const *pQuest, uint32 XP, Object* questGiver); + void SendQuestFailed(uint32 quest_id); + void SendQuestTimerFailed(uint32 quest_id); + void SendCanTakeQuestResponse(uint32 msg); void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver); - void SendPushToPartyResponse( Player *pPlayer, uint32 msg ); - void SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint32 count ); - void SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count ); + void SendPushToPartyResponse(Player *pPlayer, uint32 msg); + void SendQuestUpdateAddItem(Quest const* pQuest, uint32 item_idx, uint32 count); + void SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count); uint64 GetDivider() { return m_divider; } - void SetDivider( uint64 guid ) { m_divider = guid; } + void SetDivider(uint64 guid) { m_divider = guid; } uint32 GetInGameTime() { return m_ingametime; } - void SetInGameTime( uint32 time ) { m_ingametime = time; } + void SetInGameTime(uint32 time) { m_ingametime = time; } - void AddTimedQuest( uint32 quest_id ) { m_timedquests.insert(quest_id); } - void RemoveTimedQuest( uint32 quest_id ) { m_timedquests.erase(quest_id); } + void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); } + void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); } /*********************************************************/ /*** LOAD SYSTEM ***/ @@ -1437,7 +1437,7 @@ class Player : public Unit, public GridObject<Player> void SetBindPoint(uint64 guid); void SendTalentWipeConfirm(uint64 guid); void ResetPetTalents(); - void CalcRage( uint32 damage,bool attacker ); + void CalcRage(uint32 damage,bool attacker); void RegenerateAll(); void Regenerate(Powers power); void RegenerateHealth(); @@ -1445,7 +1445,7 @@ class Player : public Unit, public GridObject<Player> void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;} uint32 GetMoney() { return GetUInt32Value (PLAYER_FIELD_COINAGE); } - void ModifyMoney( int32 d ) + void ModifyMoney(int32 d) { d = GetSession()->HandleOnGetMoney(d); if (d < 0) @@ -1457,16 +1457,16 @@ class Player : public Unit, public GridObject<Player> if (GetMoney() >= MAX_MONEY_AMOUNT) SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD,NULL,NULL); } - void SetMoney( uint32 value ) + void SetMoney(uint32 value) { SetUInt32Value (PLAYER_FIELD_COINAGE, value); - MoneyChanged( value ); + MoneyChanged(value); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED); } QuestStatusMap& getQuestStatusMap() { return mQuestStatus; }; - const uint64& GetSelection( ) const { return m_curSelection; } + const uint64& GetSelection() const { return m_curSelection; } Unit *GetSelectedUnit() const; Player *GetSelectedPlayer() const; void SetSelection(const uint64 &guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); } @@ -1513,7 +1513,7 @@ class Player : public Unit, public GridObject<Player> void AddMItem(Item* it) { - ASSERT( it ); + ASSERT(it); //assert deleted, because items can be added before loading mMitems[it->GetGUIDLow()] = it; } @@ -1531,7 +1531,7 @@ class Player : public Unit, public GridObject<Player> bool HasSpell(uint32 spell) const; bool HasActiveSpell(uint32 spell) const; // show in spellbook TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const; - bool IsSpellFitByClassAndRace( uint32 spell_id ) const; + bool IsSpellFitByClassAndRace(uint32 spell_id) const; bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const; void SendProficiency(uint8 pr1, uint32 pr2); @@ -1613,13 +1613,13 @@ class Player : public Unit, public GridObject<Player> time_t t = time(NULL); return itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0; } - void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false ); + void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false); void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time); void SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = NULL); - void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ); + void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs); void RemoveSpellCooldown(uint32 spell_id, bool update = false); void RemoveSpellCategoryCooldown(uint32 cat, bool update = false); - void SendClearCooldown( uint32 spell_id, Unit* target ); + void SendClearCooldown(uint32 spell_id, Unit* target); void RemoveCategoryCooldown(uint32 cat); void RemoveArenaSpellCooldowns(); @@ -1670,8 +1670,8 @@ class Player : public Unit, public GridObject<Player> void UpdateZone(uint32 newZone,uint32 newArea); void UpdateArea(uint32 newArea); - void UpdateZoneDependentAuras( uint32 zone_id ); // zones - void UpdateAreaDependentAuras( uint32 area_id ); // subzones + void UpdateZoneDependentAuras(uint32 zone_id); // zones + void UpdateAreaDependentAuras(uint32 area_id); // subzones void UpdateAfkReport(time_t currTime); void UpdatePvPFlag(time_t currTime); @@ -1797,8 +1797,8 @@ class Player : public Unit, public GridObject<Player> WorldSession* GetSession() const { return m_session; } void SetSession(WorldSession *s) { m_session = s; } - void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const; - void DestroyForPlayer( Player *target, bool anim = false ) const; + void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const; + void DestroyForPlayer(Player *target, bool anim = false) const; void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP); // notifiers @@ -1819,7 +1819,7 @@ class Player : public Unit, public GridObject<Player> virtual bool SetPosition(float x, float y, float z, float orientation, bool teleport = false); bool SetPosition(const Position &pos, bool teleport = false) { return SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); } - void UpdateUnderwaterState( Map * m, float x, float y, float z ); + void UpdateUnderwaterState(Map * m, float x, float y, float z); void SendMessageToSet(WorldPacket *data, bool self);// overwrite Object::SendMessageToSet void SendMessageToSetInRange(WorldPacket *data, float fist, bool self);// overwrite Object::SendMessageToSetInRange @@ -1862,7 +1862,7 @@ class Player : public Unit, public GridObject<Player> void JoinedChannel(Channel *c); void LeftChannel(Channel *c); void CleanupChannels(); - void UpdateLocalChannels( uint32 newZone ); + void UpdateLocalChannels(uint32 newZone); void LeaveLFGChannel(); void UpdateDefense(); @@ -1920,8 +1920,8 @@ class Player : public Unit, public GridObject<Player> bool RewardHonor(Unit *pVictim, uint32 groupsize, float honor = -1, bool pvptoken = false); uint32 GetHonorPoints() { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); } uint32 GetArenaPoints() { return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY); } - void ModifyHonorPoints( int32 value ); - void ModifyArenaPoints( int32 value ); + void ModifyHonorPoints(int32 value); + void ModifyArenaPoints(int32 value); uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot); //End of PvP System @@ -1991,7 +1991,7 @@ class Player : public Unit, public GridObject<Player> std::vector<ItemSetEffect *> ItemSetEff; void SendLoot(uint64 guid, LootType loot_type); - void SendLootRelease( uint64 guid ); + void SendLootRelease(uint64 guid); void SendNotifyLootItemRemoved(uint8 lootSlot); void SendNotifyLootMoneyRemoved(); @@ -2554,16 +2554,16 @@ class Player : public Unit, public GridObject<Player> EquipmentSets m_EquipmentSets; private: // internal common parts for CanStore/StoreItem functions - uint8 _CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool swap, Item *pSrcItem ) const; - uint8 _CanStoreItem_InBag( uint8 bag, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const; - uint8 _CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const; - Item* _StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, bool update ); + uint8 _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool swap, Item *pSrcItem) const; + uint8 _CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const; + uint8 _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const; + Item* _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update); std::set<uint64> m_refundableItems; void UpdateKnownCurrencies(uint32 itemId, bool apply); int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest); - void AdjustQuestReqItemCount( Quest const* pQuest, QuestStatusData& questStatusData ); + void AdjustQuestReqItemCount(Quest const* pQuest, QuestStatusData& questStatusData); bool IsCanDelayTeleport() const { return m_bCanDelayTeleport; } void SetCanDelayTeleport(bool setting) { m_bCanDelayTeleport = setting; } @@ -2645,12 +2645,12 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas totalflat += mod->value; else if (mod->type == SPELLMOD_PCT) { - // skip percent mods for null basevalue (most important for spell mods with charges ) + // skip percent mods for null basevalue (most important for spell mods with charges) if (basevalue == T(0)) continue; // special case (skip >10sec spell casts for instant cast setting) - if ( mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) + if (mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) continue; totalmul *= 1.0f + (float)mod->value / 100.0f; diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 472f80a77ad..32aca45662f 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -271,7 +271,7 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl GUIDs const* guids = NULL; char const* fieldname = NULL; - switch ( type ) + switch (type) { case DTT_ITEM: fieldname = "guid"; guids = &items; break; case DTT_ITEM_GIFT: fieldname = "item_guid"; guids = &items; break; @@ -308,7 +308,7 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl do { // collect guids - switch ( type ) + switch (type) { case DTT_INVENTORY: StoreGUID(result,3,items); break; // item guid collection diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index 0ad727bfdd0..af6d8691a5f 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -425,12 +425,12 @@ void PoolHandler::LoadFromDB() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u objects pools", count ); + sLog.outString(">> Loaded %u objects pools", count); // Creatures sLog.outString(); - sLog.outString( "Loading Creatures Pooling Data..." ); + sLog.outString("Loading Creatures Pooling Data..."); mPoolCreatureGroups.resize(max_pool_id + 1); mCreatureSearchMap.clear(); @@ -444,7 +444,7 @@ void PoolHandler::LoadFromDB() bar2.step(); sLog.outString(); - sLog.outString(">> Loaded %u creatures in pools", count ); + sLog.outString(">> Loaded %u creatures in pools", count); } else { @@ -463,7 +463,7 @@ void PoolHandler::LoadFromDB() CreatureData const* data = objmgr.GetCreatureData(guid); if (!data) { - sLog.outErrorDb("`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id ); + sLog.outErrorDb("`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); continue; } if (pool_id > max_pool_id) @@ -488,12 +488,12 @@ void PoolHandler::LoadFromDB() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u creatures in pools", count ); + sLog.outString(">> Loaded %u creatures in pools", count); } // Gameobjects - sLog.outString( "Loading Gameobject Pooling Data..." ); + sLog.outString("Loading Gameobject Pooling Data..."); mPoolGameobjectGroups.resize(max_pool_id + 1); mGameobjectSearchMap.clear(); @@ -507,7 +507,7 @@ void PoolHandler::LoadFromDB() bar2.step(); sLog.outString(); - sLog.outString(">> Loaded %u gameobject in pools", count ); + sLog.outString(">> Loaded %u gameobject in pools", count); } else { @@ -526,7 +526,7 @@ void PoolHandler::LoadFromDB() GameObjectData const* data = objmgr.GetGOData(guid); if (!data) { - sLog.outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id ); + sLog.outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); continue; } GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(data->id); @@ -534,7 +534,7 @@ void PoolHandler::LoadFromDB() goinfo->type != GAMEOBJECT_TYPE_GOOBER && goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE) { - sLog.outErrorDb("`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id ); + sLog.outErrorDb("`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); continue; } if (pool_id > max_pool_id) @@ -558,14 +558,14 @@ void PoolHandler::LoadFromDB() SearchPair p(guid, pool_id); mGameobjectSearchMap.insert(p); - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u gameobject in pools", count ); + sLog.outString(">> Loaded %u gameobject in pools", count); } // Pool of pools - sLog.outString( "Loading Mother Pooling Data..." ); + sLog.outString("Loading Mother Pooling Data..."); mPoolPoolGroups.resize(max_pool_id + 1); // 1 2 3 @@ -578,12 +578,12 @@ void PoolHandler::LoadFromDB() bar2.step(); sLog.outString(); - sLog.outString(">> Loaded %u pools in pools", count ); + sLog.outString(">> Loaded %u pools in pools", count); } else { - barGoLink bar2( result->GetRowCount() ); + barGoLink bar2(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -625,7 +625,7 @@ void PoolHandler::LoadFromDB() SearchPair p(child_pool_id, mother_pool_id); mPoolSearchMap.insert(p); - } while ( result->NextRow() ); + } while (result->NextRow()); // Now check for circular reference for (uint16 i=0; i<max_pool_id; ++i) @@ -652,7 +652,7 @@ void PoolHandler::LoadFromDB() } sLog.outString(); - sLog.outString( ">> Loaded %u pools in mother pools", count ); + sLog.outString(">> Loaded %u pools in mother pools", count); } } @@ -707,7 +707,7 @@ void PoolHandler::SpawnPool<Pool>(uint16 pool_id, uint32 sub_pool_id) mPoolPoolGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, sub_pool_id); } -void PoolHandler::SpawnPool( uint16 pool_id ) +void PoolHandler::SpawnPool(uint16 pool_id) { SpawnPool<Pool>(pool_id, 0); SpawnPool<GameObject>(pool_id, 0); diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index aed1d5cf914..91037488927 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -39,7 +39,7 @@ void WorldSession::SendNameQueryOpcode(Player *p) if (!p) return; // guess size - WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10) ); + WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10)); data.append(p->GetPackGUID()); // player guid data << uint8(0); // added in 3.1 data << p->GetName(); // played name @@ -99,7 +99,7 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult_AutoPtr result, pClass = fields[4].GetUInt8(); } // guess size - WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10) ); + WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10)); data.appendPackGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); data << uint8(0); // added in 3.1 data << name; @@ -118,10 +118,10 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult_AutoPtr result, else data << uint8(0); // is not declined - session->SendPacket( &data ); + session->SendPacket(&data); } -void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleNameQueryOpcode(WorldPacket & recv_data) { uint64 guid; @@ -135,7 +135,7 @@ void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data ) SendNameQueryOpcodeFromDB(guid); } -void WorldSession::HandleQueryTimeOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recv_data*/) { SendQueryTimeResponse(); } @@ -149,7 +149,7 @@ void WorldSession::SendQueryTimeResponse() } /// Only _static_ data send in this packet !!! -void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) { uint32 entry; recv_data >> entry; @@ -178,7 +178,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) } sLog.outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name, entry); // guess size - WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 100 ); + WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 100); data << uint32(entry); // creature entry data << Name; data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty @@ -200,22 +200,22 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) for (uint32 i = 0; i < 6; ++i) data << uint32(ci->questItems[i]); // itemId[6], quest drop data << uint32(ci->movementId); // CreatureMovementInfo.dbc - SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" ); + SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE"); } else { sLog.outDebug("WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry); - WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 ); + WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 4); data << uint32(entry | 0x80000000); - SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" ); + SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE"); } } /// Only _static_ data send in this packet !!! -void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) { uint32 entryID; recv_data >> entryID; @@ -246,7 +246,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) } } sLog.outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name, entryID); - WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 150 ); + WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150); data << uint32(entryID); data << uint32(info->type); data << uint32(info->displayId); @@ -259,17 +259,17 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) data << float(info->size); // go size for (uint32 i = 0; i < 6; ++i) data << uint32(info->questItems[i]); // itemId[6], quest drop - SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE" ); + SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); } else { - sLog.outDebug( "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", - GUID_LOPART(guid), entryID ); - WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 4 ); + sLog.outDebug("WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", + GUID_LOPART(guid), entryID); + WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4); data << uint32(entryID | 0x80000000); - SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE" ); + SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); } } @@ -324,7 +324,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) SendPacket(&data); } -void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) { uint32 textID; uint64 guid; @@ -337,7 +337,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) GossipText const* pGossip = objmgr.GetGossipText(textID); - WorldPacket data( SMSG_NPC_TEXT_UPDATE, 100 ); // guess size + WorldPacket data(SMSG_NPC_TEXT_UPDATE, 100); // guess size data << textID; if (!pGossip) @@ -385,12 +385,12 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) { data << pGossip->Options[i].Probability; - if ( Text_0[i].empty() ) + if (Text_0[i].empty()) data << Text_1[i]; else data << Text_0[i]; - if ( Text_1[i].empty() ) + if (Text_1[i].empty()) data << Text_0[i]; else data << Text_1[i]; @@ -405,12 +405,12 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) } } - SendPacket( &data ); + SendPacket(&data); - sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE" ); + sLog.outDebug("WORLD: Sent SMSG_NPC_TEXT_UPDATE"); } -void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) { sLog.outDetail("WORLD: Received CMSG_PAGE_TEXT_QUERY"); recv_data.hexlike(); @@ -421,9 +421,9 @@ void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) while (pageID) { - PageText const *pPage = sPageTextStore.LookupEntry<PageText>( pageID ); + PageText const *pPage = sPageTextStore.LookupEntry<PageText>(pageID); // guess size - WorldPacket data( SMSG_PAGE_TEXT_QUERY_RESPONSE, 50 ); + WorldPacket data(SMSG_PAGE_TEXT_QUERY_RESPONSE, 50); data << pageID; if (!pPage) @@ -451,15 +451,15 @@ void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) data << uint32(pPage->Next_Page); pageID = pPage->Next_Page; } - SendPacket( &data ); + SendPacket(&data); - sLog.outDebug( "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE" ); + sLog.outDebug("WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE"); } } -void WorldSession::HandleCorpseMapPositionQuery( WorldPacket & recv_data ) +void WorldSession::HandleCorpseMapPositionQuery(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY" ); + sLog.outDebug("WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY"); uint32 unk; recv_data >> unk; diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp index 23222831fc4..7f3bda0682d 100644 --- a/src/game/QuestDef.cpp +++ b/src/game/QuestDef.cpp @@ -151,19 +151,19 @@ Quest::Quest(Field * questRecord) for (int i=0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - if ( ReqItemId[i] ) + if (ReqItemId[i]) ++m_reqitemscount; } for (int i=0; i < QUEST_OBJECTIVES_COUNT; ++i) { - if ( ReqCreatureOrGOId[i] ) + if (ReqCreatureOrGOId[i]) ++m_reqCreatureOrGOcount; } for (int i=0; i < QUEST_REWARDS_COUNT; ++i) { - if ( RewItemId[i] ) + if (RewItemId[i]) ++m_rewitemscount; } @@ -174,9 +174,9 @@ Quest::Quest(Field * questRecord) } } -uint32 Quest::XPValue( Player *pPlayer ) const +uint32 Quest::XPValue(Player *pPlayer) const { - if ( pPlayer ) + if (pPlayer) { const QuestXPEntry *xpentry; diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 39fbc071db6..57c0df30e00 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -176,10 +176,10 @@ class Quest friend class ObjectMgr; public: Quest(Field * questRecord); - uint32 XPValue( Player *pPlayer ) const; + uint32 XPValue(Player *pPlayer) const; - bool HasFlag( uint32 flag ) const { return ( QuestFlags & flag ) != 0; } - void SetFlag( uint32 flag ) { QuestFlags |= flag; } + bool HasFlag(uint32 flag) const { return (QuestFlags & flag) != 0; } + void SetFlag(uint32 flag) { QuestFlags |= flag; } // table data accessors: uint32 GetQuestId() const { return QuestId; } diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 8a1a5918603..f479aa79874 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -34,7 +34,7 @@ #include "BattleGroundAV.h" #include "ScriptMgr.h" -void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; @@ -52,22 +52,22 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) { case TYPEID_UNIT: { - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u",uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u",uint32(GUID_LOPART(guid))); Creature* cr_questgiver=questgiver->ToCreature(); - if ( !cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies + if (!cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies { questStatus = sScriptMgr.NPCDialogStatus(_player, cr_questgiver); - if ( questStatus > 6 ) + if (questStatus > 6) questStatus = getDialogStatus(_player, cr_questgiver, defstatus); } break; } case TYPEID_GAMEOBJECT: { - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u",uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u",uint32(GUID_LOPART(guid))); GameObject* go_questgiver=(GameObject*)questgiver; questStatus = sScriptMgr.GODialogStatus(_player, go_questgiver); - if ( questStatus > 6 ) + if (questStatus > 6) questStatus = getDialogStatus(_player, go_questgiver, defstatus); break; } @@ -80,7 +80,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) _player->PlayerTalkClass->SendQuestGiverStatus(questStatus, guid); } -void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data ) +void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; @@ -101,14 +101,14 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data ) // Stop the npc if moving pCreature->StopMoving(); - if (sScriptMgr.GossipHello( _player, pCreature ) ) + if (sScriptMgr.GossipHello(_player, pCreature)) return; _player->PrepareGossipMenu(pCreature, pCreature->GetCreatureInfo()->GossipMenuId); _player->SendPreparedGossip(pCreature); } -void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) +void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) { uint64 guid; uint32 quest; @@ -118,7 +118,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) if (!GetPlayer()->isAlive()) return; - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1 ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1); Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER); @@ -126,37 +126,37 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) if (!pObject || (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest)) || (pObject->GetTypeId() == TYPEID_PLAYER && !pObject->ToPlayer()->CanShareQuest(quest)) - ) +) { _player->PlayerTalkClass->CloseGossip(); - _player->SetDivider( 0 ); + _player->SetDivider(0); return; } Quest const* qInfo = objmgr.GetQuestTemplate(quest); - if ( qInfo ) + if (qInfo) { // prevent cheating - if (!GetPlayer()->CanTakeQuest(qInfo,true) ) + if (!GetPlayer()->CanTakeQuest(qInfo,true)) { _player->PlayerTalkClass->CloseGossip(); - _player->SetDivider( 0 ); + _player->SetDivider(0); return; } - if ( _player->GetDivider() != 0 ) + if (_player->GetDivider() != 0) { - Player *pPlayer = ObjectAccessor::FindPlayer( _player->GetDivider() ); - if ( pPlayer ) + Player *pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()); + if (pPlayer) { - pPlayer->SendPushToPartyResponse( _player, QUEST_PARTY_MSG_ACCEPT_QUEST ); - _player->SetDivider( 0 ); + pPlayer->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST); + _player->SetDivider(0); } } - if ( _player->CanAddQuest( qInfo, true ) ) + if (_player->CanAddQuest(qInfo, true)) { - _player->AddQuest( qInfo, pObject ); + _player->AddQuest(qInfo, pObject); if (qInfo->HasFlag(QUEST_FLAGS_PARTY_ACCEPT)) { @@ -182,18 +182,18 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) } } - if ( _player->CanCompleteQuest( quest ) ) - _player->CompleteQuest( quest ); + if (_player->CanCompleteQuest(quest)) + _player->CompleteQuest(quest); switch(pObject->GetTypeId()) { case TYPEID_UNIT: - sScriptMgr.QuestAccept(_player, (pObject->ToCreature()), qInfo ); + sScriptMgr.QuestAccept(_player, (pObject->ToCreature()), qInfo); break; case TYPEID_ITEM: case TYPEID_CONTAINER: { - sScriptMgr.ItemQuestAccept(_player, ((Item*)pObject), qInfo ); + sScriptMgr.ItemQuestAccept(_player, ((Item*)pObject), qInfo); // destroy not required for quest finish quest starting item bool destroyItem = true; @@ -212,13 +212,13 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) break; } case TYPEID_GAMEOBJECT: - sScriptMgr.GOQuestAccept(_player, ((GameObject*)pObject), qInfo ); + sScriptMgr.GOQuestAccept(_player, ((GameObject*)pObject), qInfo); break; } _player->PlayerTalkClass->CloseGossip(); - if ( qInfo->GetSrcSpell() > 0 ) - _player->CastSpell( _player, qInfo->GetSrcSpell(), true); + if (qInfo->GetSrcSpell() > 0) + _player->CastSpell(_player, qInfo->GetSrcSpell(), true); return; } @@ -227,13 +227,13 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) _player->PlayerTalkClass->CloseGossip(); } -void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data ) +void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data) { uint64 guid; uint32 quest; uint8 unk1; recv_data >> guid >> quest >> unk1; - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1 ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1); // Verify that the guid is valid and is a questgiver or involved in the requested quest Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM); @@ -244,26 +244,26 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data ) } Quest const* pQuest = objmgr.GetQuestTemplate(quest); - if ( pQuest ) + if (pQuest) { _player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, pObject->GetGUID(), true); } } -void WorldSession::HandleQuestQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleQuestQueryOpcode(WorldPacket & recv_data) { uint32 quest; recv_data >> quest; - sLog.outDebug( "WORLD: Received CMSG_QUEST_QUERY quest = %u",quest ); + sLog.outDebug("WORLD: Received CMSG_QUEST_QUERY quest = %u",quest); Quest const *pQuest = objmgr.GetQuestTemplate(quest); - if ( pQuest ) + if (pQuest) { - _player->PlayerTalkClass->SendQuestQueryResponse( pQuest ); + _player->PlayerTalkClass->SendQuestQueryResponse(pQuest); } } -void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data ) +void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) { uint32 quest, reward; uint64 guid; @@ -278,7 +278,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data ) if (!GetPlayer()->isAlive()) return; - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u",uint32(GUID_LOPART(guid)),quest,reward ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u",uint32(GUID_LOPART(guid)),quest,reward); Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!pObject) @@ -288,38 +288,38 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data ) return; Quest const *pQuest = objmgr.GetQuestTemplate(quest); - if ( pQuest ) + if (pQuest) { - if ( _player->CanRewardQuest( pQuest, reward, true ) ) + if (_player->CanRewardQuest(pQuest, reward, true)) { - _player->RewardQuest( pQuest, reward, pObject ); + _player->RewardQuest(pQuest, reward, pObject); switch(pObject->GetTypeId()) { case TYPEID_UNIT: - if ( !(sScriptMgr.ChooseReward( _player, (pObject->ToCreature()), pQuest, reward )) ) + if (!(sScriptMgr.ChooseReward(_player, (pObject->ToCreature()), pQuest, reward))) { // Send next quest - if (Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) ) + if (Quest const* nextquest = _player->GetNextQuest(guid ,pQuest)) _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest,guid,true); } break; case TYPEID_GAMEOBJECT: - if ( !sScriptMgr.GOChooseReward( _player, ((GameObject*)pObject), pQuest, reward ) ) + if (!sScriptMgr.GOChooseReward(_player, ((GameObject*)pObject), pQuest, reward)) { // Send next quest - if (Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) ) + if (Quest const* nextquest = _player->GetNextQuest(guid ,pQuest)) _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest,guid,true); } break; } } else - _player->PlayerTalkClass->SendQuestGiverOfferReward( pQuest, guid, true ); + _player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true); } } -void WorldSession::HandleQuestgiverRequestRewardOpcode( WorldPacket & recv_data ) +void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data) { uint32 quest; uint64 guid; @@ -328,30 +328,30 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode( WorldPacket & recv_data if (!GetPlayer()->isAlive()) return; - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest); Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!pObject||!pObject->hasInvolvedQuest(quest)) return; - if ( _player->CanCompleteQuest( quest ) ) - _player->CompleteQuest( quest ); + if (_player->CanCompleteQuest(quest)) + _player->CompleteQuest(quest); - if ( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE ) + if (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE) return; if (Quest const *pQuest = objmgr.GetQuestTemplate(quest)) - _player->PlayerTalkClass->SendQuestGiverOfferReward( pQuest, guid, true ); + _player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true); } -void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recv_data*/ ) +void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recv_data*/) { - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_CANCEL" ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_CANCEL"); _player->PlayerTalkClass->CloseGossip(); } -void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recv_data ) +void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recv_data) { uint8 slot1, slot2; recv_data >> slot1 >> slot2; @@ -359,7 +359,7 @@ void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recv_data ) if (slot1 == slot2 || slot1 >= MAX_QUEST_LOG_SIZE || slot2 >= MAX_QUEST_LOG_SIZE) return; - sLog.outDebug( "WORLD: Received CMSG_QUESTLOG_SWAP_QUEST slot 1 = %u, slot 2 = %u", slot1, slot2 ); + sLog.outDebug("WORLD: Received CMSG_QUESTLOG_SWAP_QUEST slot 1 = %u, slot 2 = %u", slot1, slot2); GetPlayer()->SwapQuestSlot(slot1,slot2); } @@ -369,13 +369,13 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data) uint8 slot; recv_data >> slot; - sLog.outDebug( "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u",slot ); + sLog.outDebug("WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u",slot); - if ( slot < MAX_QUEST_LOG_SIZE ) + if (slot < MAX_QUEST_LOG_SIZE) { if (uint32 quest = _player->GetQuestSlotQuestId(slot)) { - if (!_player->TakeQuestSourceItem( quest, true )) + if (!_player->TakeQuestSourceItem(quest, true)) return; // can't un-equip some items, reject quest cancel if (const Quest *pQuest = objmgr.GetQuestTemplate(quest)) @@ -385,7 +385,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data) } _player->TakeQuestSourceItem(quest, true); // remove quest src item from player - _player->SetQuestStatus( quest, QUEST_STATUS_NONE); + _player->SetQuestStatus(quest, QUEST_STATUS_NONE); } _player->SetQuestSlot(slot, 0); @@ -438,10 +438,10 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) if (!GetPlayer()->isAlive()) return; - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest); Quest const *pQuest = objmgr.GetQuestTemplate(quest); - if ( pQuest ) + if (pQuest) { // TODO: need a virtual function if (GetPlayer()->InBattleGround()) @@ -449,9 +449,9 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) if (bg->GetTypeID() == BATTLEGROUND_AV) ((BattleGroundAV*)bg)->HandleQuestComplete(quest, GetPlayer()); - if ( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE ) + if (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE) { - if ( pQuest->IsRepeatable() ) + if (pQuest->IsRepeatable()) _player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanCompleteRepeatableQuest(pQuest), false); else _player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest,false), false); @@ -468,7 +468,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) void WorldSession::HandleQuestgiverQuestAutoLaunch(WorldPacket& /*recvPacket*/) { - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH" ); + sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH"); } void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) @@ -534,18 +534,18 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) uint8 msg; recvPacket >> guid >> msg; - sLog.outDebug( "WORLD: Received MSG_QUEST_PUSH_RESULT" ); + sLog.outDebug("WORLD: Received MSG_QUEST_PUSH_RESULT"); - if ( _player->GetDivider() != 0 ) + if (_player->GetDivider() != 0) { - Player *pPlayer = ObjectAccessor::FindPlayer( _player->GetDivider() ); - if ( pPlayer ) + Player *pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()); + if (pPlayer) { - WorldPacket data( MSG_QUEST_PUSH_RESULT, (8+1) ); + WorldPacket data(MSG_QUEST_PUSH_RESULT, (8+1)); data << uint64(guid); data << uint8(msg); // valid values: 0-8 pPlayer->GetSession()->SendPacket(&data); - _player->SetDivider( 0 ); + _player->SetDivider(0); } } } @@ -577,45 +577,45 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 return DIALOG_STATUS_NONE; } - for (QuestRelations::const_iterator i = qir->lower_bound(questgiver->GetEntry()); i != qir->upper_bound(questgiver->GetEntry()); ++i ) + for (QuestRelations::const_iterator i = qir->lower_bound(questgiver->GetEntry()); i != qir->upper_bound(questgiver->GetEntry()); ++i) { uint32 result2 = 0; uint32 quest_id = i->second; Quest const *pQuest = objmgr.GetQuestTemplate(quest_id); - if ( !pQuest ) continue; + if (!pQuest) continue; - QuestStatus status = pPlayer->GetQuestStatus( quest_id ); - if ( (status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) || - (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) ) + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + if ((status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) || + (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false))) { - if ( pQuest->IsAutoComplete() && pQuest->IsRepeatable() ) + if (pQuest->IsAutoComplete() && pQuest->IsRepeatable()) result2 = DIALOG_STATUS_REWARD_REP; else result2 = DIALOG_STATUS_REWARD; } - else if ( status == QUEST_STATUS_INCOMPLETE ) + else if (status == QUEST_STATUS_INCOMPLETE) result2 = DIALOG_STATUS_INCOMPLETE; if (result2 > result) result = result2; } - for (QuestRelations::const_iterator i = qr->lower_bound(questgiver->GetEntry()); i != qr->upper_bound(questgiver->GetEntry()); ++i ) + for (QuestRelations::const_iterator i = qr->lower_bound(questgiver->GetEntry()); i != qr->upper_bound(questgiver->GetEntry()); ++i) { uint32 result2 = 0; uint32 quest_id = i->second; Quest const *pQuest = objmgr.GetQuestTemplate(quest_id); - if ( !pQuest ) + if (!pQuest) continue; - QuestStatus status = pPlayer->GetQuestStatus( quest_id ); - if ( status == QUEST_STATUS_NONE ) + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + if (status == QUEST_STATUS_NONE) { - if ( pPlayer->CanSeeStartQuest( pQuest ) ) + if (pPlayer->CanSeeStartQuest(pQuest)) { - if ( pPlayer->SatisfyQuestLevel(pQuest, false) ) + if (pPlayer->SatisfyQuestLevel(pQuest, false)) { - if ( pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && pPlayer->getQuestStatusMap()[quest_id].m_rewarded)) + if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && pPlayer->getQuestStatusMap()[quest_id].m_rewarded)) result2 = DIALOG_STATUS_REWARD_REP; else if (pPlayer->getLevel() <= ((pPlayer->GetQuestLevel(pQuest) == -1) ? pPlayer->getLevel() : pPlayer->GetQuestLevel(pQuest) + sWorld.getConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))) { @@ -662,7 +662,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) continue; questStatus = sScriptMgr.NPCDialogStatus(_player, questgiver); - if ( questStatus > 6 ) + if (questStatus > 6) questStatus = getDialogStatus(_player, questgiver, defstatus); data << uint64(questgiver->GetGUID()); @@ -677,7 +677,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) continue; questStatus = sScriptMgr.GODialogStatus(_player, questgiver); - if ( questStatus > 6 ) + if (questStatus > 6) questStatus = getDialogStatus(_player, questgiver, defstatus); data << uint64(questgiver->GetGUID()); @@ -690,7 +690,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket SendPacket(&data); } -void WorldSession::HandleQueryQuestsCompleted( WorldPacket & recv_data ) +void WorldSession::HandleQueryQuestsCompleted(WorldPacket & recv_data) { uint32 count = 0; diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp index 49abb2b13d2..13c861cbc93 100644 --- a/src/game/RandomMovementGenerator.cpp +++ b/src/game/RandomMovementGenerator.cpp @@ -185,7 +185,7 @@ RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff CreatureTraveller traveller(creature); - if ( i_destinationHolder.UpdateTraveller(traveller, diff, true) ) + if (i_destinationHolder.UpdateTraveller(traveller, diff, true)) { if (i_nextMoveTime.Passed()) { diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp index 8d1f2dea8eb..661d9ff3cb7 100644 --- a/src/game/ReactorAI.cpp +++ b/src/game/ReactorAI.cpp @@ -30,7 +30,7 @@ int ReactorAI::Permissible(const Creature *creature) { - if ( creature->isCivilian() || creature->IsNeutralToAll() ) + if (creature->isCivilian() || creature->IsNeutralToAll()) return PERMIT_BASE_REACTIVE; return PERMIT_BASE_NO; @@ -48,9 +48,9 @@ ReactorAI::UpdateAI(const uint32 /*time_diff*/) if (!UpdateVictim()) return; - if ( m_creature->isAttackReady() ) + if (m_creature->isAttackReady()) { - if ( m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) { m_creature->AttackerStateUpdate(m_creature->getVictim()); m_creature->resetAttackTimer(); diff --git a/src/game/ReputationMgr.cpp b/src/game/ReputationMgr.cpp index 438f79c2159..264f0fd1aed 100644 --- a/src/game/ReputationMgr.cpp +++ b/src/game/ReputationMgr.cpp @@ -30,7 +30,7 @@ ReputationRank ReputationMgr::ReputationToRank(int32 standing) for (int i = MAX_REPUTATION_RANK-1; i >= MIN_REPUTATION_RANK; --i) { limit -= PointsInRank[i]; - if (standing >= limit ) + if (standing >= limit) return ReputationRank(i); } return MIN_REPUTATION_RANK; @@ -58,12 +58,12 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const uint32 classMask = m_player->getClassMask(); for (int i=0; i < 4; i++) { - if ( (factionEntry->BaseRepRaceMask[i] & raceMask || + if ((factionEntry->BaseRepRaceMask[i] & raceMask || (factionEntry->BaseRepRaceMask[i] == 0 && - factionEntry->BaseRepClassMask[i] != 0 ) ) && + factionEntry->BaseRepClassMask[i] != 0)) && (factionEntry->BaseRepClassMask[i] & classMask || - factionEntry->BaseRepClassMask[i] == 0 ) - ) + factionEntry->BaseRepClassMask[i] == 0) +) return factionEntry->BaseRepValue[i]; } @@ -95,7 +95,7 @@ ReputationRank ReputationMgr::GetBaseRank(FactionEntry const* factionEntry) cons return ReputationToRank(reputation); } -void ReputationMgr::ApplyForceReaction( uint32 faction_id,ReputationRank rank,bool apply ) +void ReputationMgr::ApplyForceReaction(uint32 faction_id,ReputationRank rank,bool apply) { if (apply) m_forcedReactions[faction_id] = rank; @@ -112,12 +112,12 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con uint32 classMask = m_player->getClassMask(); for (int i=0; i < 4; i++) { - if ( (factionEntry->BaseRepRaceMask[i] & raceMask || + if ((factionEntry->BaseRepRaceMask[i] & raceMask || (factionEntry->BaseRepRaceMask[i] == 0 && - factionEntry->BaseRepClassMask[i] != 0 ) ) && + factionEntry->BaseRepClassMask[i] != 0)) && (factionEntry->BaseRepClassMask[i] & classMask || - factionEntry->BaseRepClassMask[i] == 0 ) - ) + factionEntry->BaseRepClassMask[i] == 0) +) return factionEntry->ReputationFlags[i]; } return 0; @@ -214,7 +214,7 @@ void ReputationMgr::Initialize() { FactionEntry const *factionEntry = sFactionStore.LookupEntry(i); - if ( factionEntry && (factionEntry->reputationListID >= 0)) + if (factionEntry && (factionEntry->reputationListID >= 0)) { FactionState newFaction; newFaction.ID = factionEntry->ID; @@ -223,7 +223,7 @@ void ReputationMgr::Initialize() newFaction.Flags = GetDefaultStateFlags(factionEntry); newFaction.Changed = true; - if ( newFaction.Flags & FACTION_FLAG_VISIBLE ) + if (newFaction.Flags & FACTION_FLAG_VISIBLE) ++m_visibleFactionCount; UpdateRankCounters(REP_HOSTILE,GetBaseRank(factionEntry)); @@ -323,7 +323,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in if (incremental) { // int32 *= float cause one point loss? - standing = floor( (float)standing * sWorld.getRate(RATE_REPUTATION_GAIN) + 0.5 ); + standing = floor((float)standing * sWorld.getRate(RATE_REPUTATION_GAIN) + 0.5); standing += itr->second.Standing + BaseRep; } @@ -366,7 +366,7 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const*factionTemplateEntry) if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction)) // Never show factions of the opposing team - if (!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom) ) + if (!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom)) SetVisible(factionEntry); } @@ -386,7 +386,7 @@ void ReputationMgr::SetVisible(FactionState* faction) { // always invisible or hidden faction can't be make visible // except if faction has FACTION_FLAG_SPECIAL - if (faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) && !(faction->Flags & FACTION_FLAG_SPECIAL) ) + if (faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) && !(faction->Flags & FACTION_FLAG_SPECIAL)) return; // already set @@ -401,14 +401,14 @@ void ReputationMgr::SetVisible(FactionState* faction) SendVisible(faction); } -void ReputationMgr::SetAtWar( RepListID repListID, bool on ) +void ReputationMgr::SetAtWar(RepListID repListID, bool on) { FactionStateList::iterator itr = m_factions.find(repListID); if (itr == m_factions.end()) return; // always invisible or hidden faction can't change war state - if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) ) + if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN)) return; SetAtWar(&itr->second,on); @@ -417,14 +417,14 @@ void ReputationMgr::SetAtWar( RepListID repListID, bool on ) void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) { // not allow declare war to own faction - if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) ) + if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED)) return; // already set if (((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar) return; - if ( atWar ) + if (atWar) faction->Flags |= FACTION_FLAG_AT_WAR; else faction->Flags &= ~FACTION_FLAG_AT_WAR; @@ -432,7 +432,7 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) faction->Changed = true; } -void ReputationMgr::SetInactive( RepListID repListID, bool on ) +void ReputationMgr::SetInactive(RepListID repListID, bool on) { FactionStateList::iterator itr = m_factions.find(repListID); if (itr == m_factions.end()) @@ -444,7 +444,7 @@ void ReputationMgr::SetInactive( RepListID repListID, bool on ) void ReputationMgr::SetInactive(FactionState* faction, bool inactive) { // always invisible or hidden faction can't be inactive - if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE) ) ) + if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE))) return; // already set @@ -473,7 +473,7 @@ void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result) Field *fields = result->Fetch(); FactionEntry const *factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt32()); - if ( factionEntry && (factionEntry->reputationListID >= 0)) + if (factionEntry && (factionEntry->reputationListID >= 0)) { FactionState* faction = &m_factions[factionEntry->reputationListID]; @@ -488,18 +488,18 @@ void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result) uint32 dbFactionFlags = fields[2].GetUInt32(); - if ( dbFactionFlags & FACTION_FLAG_VISIBLE ) + if (dbFactionFlags & FACTION_FLAG_VISIBLE) SetVisible(faction); // have internal checks for forced invisibility - if ( dbFactionFlags & FACTION_FLAG_INACTIVE) + if (dbFactionFlags & FACTION_FLAG_INACTIVE) SetInactive(faction,true); // have internal checks for visibility requirement - if ( dbFactionFlags & FACTION_FLAG_AT_WAR ) // DB at war + if (dbFactionFlags & FACTION_FLAG_AT_WAR) // DB at war SetAtWar(faction,true); // have internal checks for FACTION_FLAG_PEACE_FORCED else // DB not at war { // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN) - if ( faction->Flags & FACTION_FLAG_VISIBLE ) + if (faction->Flags & FACTION_FLAG_VISIBLE) SetAtWar(faction,false); // have internal checks for FACTION_FLAG_PEACE_FORCED } @@ -512,7 +512,7 @@ void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result) faction->Changed = false; } } - while ( result->NextRow() ); + while (result->NextRow()); } } @@ -529,7 +529,7 @@ void ReputationMgr::SaveToDB() } } -void ReputationMgr::UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank ) +void ReputationMgr::UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank) { if (old_rank >= REP_EXALTED) --m_exaltedFactionCount; diff --git a/src/game/ReputationMgr.h b/src/game/ReputationMgr.h index 604c40059aa..4c0fd778a4d 100644 --- a/src/game/ReputationMgr.h +++ b/src/game/ReputationMgr.h @@ -40,7 +40,7 @@ enum FactionFlags FACTION_FLAG_HIDDEN = 0x04, // hidden faction from reputation pane in client (player can gain reputation, but this update not sent to client) FACTION_FLAG_INVISIBLE_FORCED = 0x08, // always overwrite FACTION_FLAG_VISIBLE and hide faction in rep.list, used for hide opposite team factions FACTION_FLAG_PEACE_FORCED = 0x10, // always overwrite FACTION_FLAG_AT_WAR, used for prevent war with own team factions - FACTION_FLAG_INACTIVE = 0x20, // player controlled, state stored in characters.data ( CMSG_SET_FACTION_INACTIVE ) + FACTION_FLAG_INACTIVE = 0x20, // player controlled, state stored in characters.data (CMSG_SET_FACTION_INACTIVE) FACTION_FLAG_RIVAL = 0x40, // flag for the two competing outland factions FACTION_FLAG_SPECIAL = 0x80 // horde and alliance home cities and their northrend allies have this flag }; @@ -140,7 +140,7 @@ class ReputationMgr void SetAtWar(FactionState* faction, bool atWar); void SetInactive(FactionState* faction, bool inactive); void SendVisible(FactionState const* faction) const; - void UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank ); + void UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank); private: Player* m_player; FactionStateList m_factions; diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index a9965b2766a..f1c56061a55 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -48,42 +48,42 @@ struct Script std::string Name; //Methods to be scripted - void (*pOnLogin )(Player*); - void (*pOnLogout )(Player*); - void (*pOnPVPKill )(Player*, Player*); - bool (*pOnSpellCast )(Unit*, Item*, GameObject*, uint32, SpellEntry const*); - uint32 (*pOnGetXP )(Player*, uint32); - int32 (*pOnGetMoney )(Player*, int32); - bool (*pOnPlayerChat )(Player*, const char*); - void (*pOnServerStartup )(); - void (*pOnServerShutdown )(); - void (*pOnAreaChange )(Player*, AreaTableEntry const*); - bool (*pOnItemClick )(Player*, Item*); - bool (*pOnItemOpen )(Player*, Item*); - bool (*pOnGoClick )(Player*, GameObject*); - void (*pOnCreatureKill )(Player*, Creature*); - bool (*pGossipHello )(Player*, Creature*); - bool (*pQuestAccept )(Player*, Creature*, Quest const* ); - bool (*pGossipSelect )(Player*, Creature*, uint32 , uint32 ); - bool (*pGossipSelectWithCode)(Player*, Creature*, uint32 , uint32 , const char* ); - bool (*pGOSelect )(Player*, GameObject*, uint32 , uint32 ); - bool (*pGOSelectWithCode )(Player*, GameObject*, uint32 , uint32 , const char* ); - bool (*pQuestSelect )(Player*, Creature*, Quest const* ); - bool (*pQuestComplete )(Player*, Creature*, Quest const* ); - uint32 (*pNPCDialogStatus )(Player*, Creature* ); - uint32 (*pGODialogStatus )(Player*, GameObject * _GO ); - bool (*pChooseReward )(Player*, Creature*, Quest const*, uint32 ); - bool (*pItemHello )(Player*, Item*, Quest const* ); - bool (*pGOHello )(Player*, GameObject* ); - bool (*pAreaTrigger )(Player*, AreaTriggerEntry const* ); - bool (*pItemQuestAccept )(Player*, Item *, Quest const* ); - bool (*pGOQuestAccept )(Player*, GameObject*, Quest const* ); - bool (*pGOChooseReward )(Player*, GameObject*, Quest const*, uint32 ); - bool (*pItemUse )(Player*, Item*, SpellCastTargets const& ); - bool (*pItemExpire )(Player*, ItemPrototype const *); - bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature* ); - bool (*pEffectDummyGameObj )(Unit*, uint32, uint32, GameObject* ); - bool (*pEffectDummyItem )(Unit*, uint32, uint32, Item* ); + void (*pOnLogin)(Player*); + void (*pOnLogout)(Player*); + void (*pOnPVPKill)(Player*, Player*); + bool (*pOnSpellCast)(Unit*, Item*, GameObject*, uint32, SpellEntry const*); + uint32 (*pOnGetXP)(Player*, uint32); + int32 (*pOnGetMoney)(Player*, int32); + bool (*pOnPlayerChat)(Player*, const char*); + void (*pOnServerStartup)(); + void (*pOnServerShutdown)(); + void (*pOnAreaChange)(Player*, AreaTableEntry const*); + bool (*pOnItemClick)(Player*, Item*); + bool (*pOnItemOpen)(Player*, Item*); + bool (*pOnGoClick)(Player*, GameObject*); + void (*pOnCreatureKill)(Player*, Creature*); + bool (*pGossipHello)(Player*, Creature*); + bool (*pQuestAccept)(Player*, Creature*, Quest const*); + bool (*pGossipSelect)(Player*, Creature*, uint32 , uint32); + bool (*pGossipSelectWithCode)(Player*, Creature*, uint32 , uint32 , const char*); + bool (*pGOSelect)(Player*, GameObject*, uint32 , uint32); + bool (*pGOSelectWithCode)(Player*, GameObject*, uint32 , uint32 , const char*); + bool (*pQuestSelect)(Player*, Creature*, Quest const*); + bool (*pQuestComplete)(Player*, Creature*, Quest const*); + uint32 (*pNPCDialogStatus)(Player*, Creature*); + uint32 (*pGODialogStatus)(Player*, GameObject * _GO); + bool (*pChooseReward)(Player*, Creature*, Quest const*, uint32); + bool (*pItemHello)(Player*, Item*, Quest const*); + bool (*pGOHello)(Player*, GameObject*); + bool (*pAreaTrigger)(Player*, AreaTriggerEntry const*); + bool (*pItemQuestAccept)(Player*, Item *, Quest const*); + bool (*pGOQuestAccept)(Player*, GameObject*, Quest const*); + bool (*pGOChooseReward)(Player*, GameObject*, Quest const*, uint32); + bool (*pItemUse)(Player*, Item*, SpellCastTargets const&); + bool (*pItemExpire)(Player*, ItemPrototype const *); + bool (*pEffectDummyCreature)(Unit*, uint32, uint32, Creature*); + bool (*pEffectDummyGameObj)(Unit*, uint32, uint32, GameObject*); + bool (*pEffectDummyItem)(Unit*, uint32, uint32, Item*); CreatureAI* (*GetAI)(Creature*); InstanceData* (*GetInstanceData)(Map*); diff --git a/src/game/ScriptedCreature.cpp b/src/game/ScriptedCreature.cpp index 62751a074b4..32234e683bd 100644 --- a/src/game/ScriptedCreature.cpp +++ b/src/game/ScriptedCreature.cpp @@ -178,7 +178,7 @@ Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition) switch (pTarget) { case SELECT_TARGET_RANDOM: - advance (itr , uiPosition + (rand() % (threatlist.size() - uiPosition ) )); + advance (itr , uiPosition + (rand() % (threatlist.size() - uiPosition))); return Unit::GetUnit((*m_creature),(*itr)->getUnitGuid()); break; @@ -330,19 +330,19 @@ void FillSpellSummary() for (uint32 j = 0; j < 3; ++j) { //Spell targets self - if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ) + if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1); //Spell targets a single enemy if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY || - pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY ) + pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1); //Spell targets AoE at enemy if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER || - pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY ) + pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1); //Spell targets an enemy @@ -351,13 +351,13 @@ void FillSpellSummary() pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER || - pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY ) + pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1); //Spell targets a single friend(or self) if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY || - pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY ) + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1); //Spell targets aoe friends @@ -379,18 +379,18 @@ void FillSpellSummary() if (pTempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE || pTempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL || pTempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE || - pTempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ) + pTempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1); //Make sure that this spell includes a healing effect (or an apply aura with a periodic heal) if (pTempSpell->Effect[j] == SPELL_EFFECT_HEAL || pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH || pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL || - (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j]== 8 )) + (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j]== 8)) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1); //Make sure that this spell applies an aura - if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA ) + if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1); } } diff --git a/src/game/ScriptedCreature.h b/src/game/ScriptedCreature.h index 047cfc27b86..605bc7c3bc3 100644 --- a/src/game/ScriptedCreature.h +++ b/src/game/ScriptedCreature.h @@ -64,7 +64,7 @@ struct ScriptedAI : public CreatureAI void KilledUnit(Unit* who){} // Called when the creature summon successfully other creature - void JustSummoned(Creature* ) {} + void JustSummoned(Creature*) {} // Called when a summoned creature is despawned void SummonedCreatureDespawn(Creature*) {} diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 30540cb96bc..f41948411ea 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -74,7 +74,7 @@ enum Races ((1<<(RACE_HUMAN-1)) |(1<<(RACE_ORC-1)) |(1<<(RACE_DWARF-1)) | \ (1<<(RACE_NIGHTELF-1))|(1<<(RACE_UNDEAD_PLAYER-1))|(1<<(RACE_TAUREN-1)) | \ (1<<(RACE_GNOME-1)) |(1<<(RACE_TROLL-1)) |(1<<(RACE_BLOODELF-1))| \ - (1<<(RACE_DRAENEI-1)) ) + (1<<(RACE_DRAENEI-1))) // Class value is index in ChrClasses.dbc enum Classes @@ -99,7 +99,7 @@ enum Classes ((1<<(CLASS_WARRIOR-1))|(1<<(CLASS_PALADIN-1))|(1<<(CLASS_HUNTER-1))| \ (1<<(CLASS_ROGUE-1)) |(1<<(CLASS_PRIEST-1)) |(1<<(CLASS_SHAMAN-1))| \ (1<<(CLASS_MAGE-1)) |(1<<(CLASS_WARLOCK-1))|(1<<(CLASS_DRUID-1)) | \ - (1<<(CLASS_DEATH_KNIGHT-1)) ) + (1<<(CLASS_DEATH_KNIGHT-1))) // valid classes for creature_template.unit_class enum UnitClass @@ -110,7 +110,7 @@ enum UnitClass UNIT_CLASS_MAGE = 8, }; -#define CLASSMASK_ALL_CREATURES ((1<<(UNIT_CLASS_WARRIOR-1)) | (1<<(UNIT_CLASS_PALADIN-1)) | (1<<(UNIT_CLASS_ROGUE-1)) | (1<<(UNIT_CLASS_MAGE-1)) ) +#define CLASSMASK_ALL_CREATURES ((1<<(UNIT_CLASS_WARRIOR-1)) | (1<<(UNIT_CLASS_PALADIN-1)) | (1<<(UNIT_CLASS_ROGUE-1)) | (1<<(UNIT_CLASS_MAGE-1))) #define CLASSMASK_WAND_USERS ((1<<(CLASS_PRIEST-1))|(1<<(CLASS_MAGE-1))|(1<<(CLASS_WARLOCK-1))) @@ -180,24 +180,24 @@ enum SpellSchoolMask { SPELL_SCHOOL_MASK_NONE = 0x00, // not exist SPELL_SCHOOL_MASK_NORMAL = (1 << SPELL_SCHOOL_NORMAL), // PHYSICAL (Armor) - SPELL_SCHOOL_MASK_HOLY = (1 << SPELL_SCHOOL_HOLY ), - SPELL_SCHOOL_MASK_FIRE = (1 << SPELL_SCHOOL_FIRE ), + SPELL_SCHOOL_MASK_HOLY = (1 << SPELL_SCHOOL_HOLY), + SPELL_SCHOOL_MASK_FIRE = (1 << SPELL_SCHOOL_FIRE), SPELL_SCHOOL_MASK_NATURE = (1 << SPELL_SCHOOL_NATURE), - SPELL_SCHOOL_MASK_FROST = (1 << SPELL_SCHOOL_FROST ), + SPELL_SCHOOL_MASK_FROST = (1 << SPELL_SCHOOL_FROST), SPELL_SCHOOL_MASK_SHADOW = (1 << SPELL_SCHOOL_SHADOW), SPELL_SCHOOL_MASK_ARCANE = (1 << SPELL_SCHOOL_ARCANE), // unions // 124, not include normal and holy damage - SPELL_SCHOOL_MASK_SPELL = ( SPELL_SCHOOL_MASK_FIRE | + SPELL_SCHOOL_MASK_SPELL = (SPELL_SCHOOL_MASK_FIRE | SPELL_SCHOOL_MASK_NATURE | SPELL_SCHOOL_MASK_FROST | - SPELL_SCHOOL_MASK_SHADOW | SPELL_SCHOOL_MASK_ARCANE ), + SPELL_SCHOOL_MASK_SHADOW | SPELL_SCHOOL_MASK_ARCANE), // 126 - SPELL_SCHOOL_MASK_MAGIC = ( SPELL_SCHOOL_MASK_HOLY | SPELL_SCHOOL_MASK_SPELL ), + SPELL_SCHOOL_MASK_MAGIC = (SPELL_SCHOOL_MASK_HOLY | SPELL_SCHOOL_MASK_SPELL), // 127 - SPELL_SCHOOL_MASK_ALL = ( SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_MAGIC ) + SPELL_SCHOOL_MASK_ALL = (SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_MAGIC) }; inline SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask) @@ -287,7 +287,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = { #define SPELL_ATTR_EX_NEGATIVE 0x00000080 // 7 #define SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET 0x00000100 // 8 Spell req target not to be in combat state #define SPELL_ATTR_EX_UNK9 0x00000200 // 9 melee spells -#define SPELL_ATTR_EX_UNK10 0x00000400 // 10 no generates threat on cast 100%? ( old NO_INITIAL_AGGRO) +#define SPELL_ATTR_EX_UNK10 0x00000400 // 10 no generates threat on cast 100%? (old NO_INITIAL_AGGRO) #define SPELL_ATTR_EX_UNK11 0x00000800 // 11 aura #define SPELL_ATTR_EX_UNK12 0x00001000 // 12 #define SPELL_ATTR_EX_UNK13 0x00002000 // 13 @@ -992,7 +992,7 @@ enum AuraState AURA_STATE_HEALTH_ABOVE_75_PERCENT = 23, // C | }; -#define PER_CASTER_AURA_STATE_MASK ( \ +#define PER_CASTER_AURA_STATE_MASK (\ (1<<(AURA_STATE_CONFLAGRATE-1))|(1<<(AURA_STATE_DEADLY_POISON-1))) // Spell mechanics @@ -1033,19 +1033,19 @@ enum Mechanics }; // Used for spell 42292 Immune Movement Impairment and Loss of Control (0x49967da6) -#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK ( \ - (1<<MECHANIC_CHARM )|(1<<MECHANIC_DISORIENTED )|(1<<MECHANIC_FEAR )| \ - (1<<MECHANIC_ROOT )|(1<<MECHANIC_PACIFY )|(1<<MECHANIC_SLEEP )| \ - (1<<MECHANIC_SNARE )|(1<<MECHANIC_STUN )|(1<<MECHANIC_FREEZE)| \ +#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK (\ + (1<<MECHANIC_CHARM)|(1<<MECHANIC_DISORIENTED)|(1<<MECHANIC_FEAR)| \ + (1<<MECHANIC_ROOT)|(1<<MECHANIC_PACIFY)|(1<<MECHANIC_SLEEP)| \ + (1<<MECHANIC_SNARE)|(1<<MECHANIC_STUN)|(1<<MECHANIC_FREEZE)| \ (1<<MECHANIC_KNOCKOUT)|(1<<MECHANIC_POLYMORPH)|(1<<MECHANIC_BANISH)| \ - (1<<MECHANIC_SHACKLE )|(1<<MECHANIC_TURN )|(1<<MECHANIC_HORROR)| \ - (1<<MECHANIC_DAZE )|(1<<MECHANIC_SAPPED ) ) + (1<<MECHANIC_SHACKLE)|(1<<MECHANIC_TURN)|(1<<MECHANIC_HORROR)| \ + (1<<MECHANIC_DAZE)|(1<<MECHANIC_SAPPED)) // Daze and all croud control spells except polymorph are not removed -#define MECHANIC_NOT_REMOVED_BY_SHAPESHIFT ( \ - (1<<MECHANIC_CHARM )|(1<<MECHANIC_DISORIENTED)|(1<<MECHANIC_FEAR )|(1<<MECHANIC_PACIFY )| \ - (1<<MECHANIC_STUN )|(1<<MECHANIC_FREEZE )|(1<<MECHANIC_BANISH)|(1<<MECHANIC_SHACKLE)| \ - (1<<MECHANIC_HORROR)|(1<<MECHANIC_TURN )|(1<<MECHANIC_DAZE )|(1<<MECHANIC_SAPPED ) ) +#define MECHANIC_NOT_REMOVED_BY_SHAPESHIFT (\ + (1<<MECHANIC_CHARM)|(1<<MECHANIC_DISORIENTED)|(1<<MECHANIC_FEAR)|(1<<MECHANIC_PACIFY)| \ + (1<<MECHANIC_STUN)|(1<<MECHANIC_FREEZE)|(1<<MECHANIC_BANISH)|(1<<MECHANIC_SHACKLE)| \ + (1<<MECHANIC_HORROR)|(1<<MECHANIC_TURN)|(1<<MECHANIC_DAZE)|(1<<MECHANIC_SAPPED)) // Spell dispell type enum DispelType @@ -1064,7 +1064,7 @@ enum DispelType DESPEL_OLD_UNUSED = 11 }; -#define DISPEL_ALL_MASK ( (1<<DISPEL_MAGIC) | (1<<DISPEL_CURSE) | (1<<DISPEL_DISEASE) | (1<<DISPEL_POISON) ) +#define DISPEL_ALL_MASK ((1<<DISPEL_MAGIC) | (1<<DISPEL_CURSE) | (1<<DISPEL_DISEASE) | (1<<DISPEL_POISON)) //To all Immune system,if target has immunes, //some spell that related to ImmuneToDispel or ImmuneToSchool or ImmuneToDamage type can't cast to it, diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index 610e925ae31..05743573b97 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -60,7 +60,7 @@ void LoadSkillDiscoveryTable() if (!result) { sLog.outString(); - sLog.outString( ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty." ); + sLog.outString(">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); return; } @@ -114,7 +114,7 @@ void LoadSkillDiscoveryTable() continue; } - SkillDiscoveryStore[reqSkillOrSpell].push_back( SkillDiscoveryEntry(spellId, reqSkillValue, chance) ); + SkillDiscoveryStore[reqSkillOrSpell].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance)); } else if (reqSkillOrSpell == 0) // skill case { @@ -127,7 +127,7 @@ void LoadSkillDiscoveryTable() } for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) - SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back( SkillDiscoveryEntry(spellId, reqSkillValue, chance) ); + SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance)); } else { @@ -139,7 +139,7 @@ void LoadSkillDiscoveryTable() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u skill discovery definitions", count ); + sLog.outString(">> Loaded %u skill discovery definitions", count); if (!ssNonDiscoverableEntries.str().empty()) sLog.outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s",ssNonDiscoverableEntries.str().c_str()); diff --git a/src/game/SkillExtraItems.cpp b/src/game/SkillExtraItems.cpp index ad5d6dd565f..9f2247790a5 100644 --- a/src/game/SkillExtraItems.cpp +++ b/src/game/SkillExtraItems.cpp @@ -109,12 +109,12 @@ void LoadSkillExtraItemTable() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u spell specialization definitions", count ); + sLog.outString(">> Loaded %u spell specialization definitions", count); } else { sLog.outString(); - sLog.outString( ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty." ); + sLog.outString(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); } } diff --git a/src/game/SkillHandler.cpp b/src/game/SkillHandler.cpp index ad4d1c09a87..24e1fb045b1 100644 --- a/src/game/SkillHandler.cpp +++ b/src/game/SkillHandler.cpp @@ -28,7 +28,7 @@ #include "ObjectAccessor.h" #include "UpdateMask.h" -void WorldSession::HandleLearnTalentOpcode( WorldPacket & recv_data ) +void WorldSession::HandleLearnTalentOpcode(WorldPacket & recv_data) { uint32 talent_id, requested_rank; recv_data >> talent_id >> requested_rank; @@ -56,7 +56,7 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) _player->SendTalentsInfoData(false); } -void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data ) +void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recv_data) { sLog.outDetail("MSG_TALENT_WIPE_CONFIRM"); uint64 guid; @@ -65,7 +65,7 @@ void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TRAINER); if (!unit) { - sLog.outDebug( "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -75,10 +75,10 @@ void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data ) if (!(_player->resetTalents())) { - WorldPacket data( MSG_TALENT_WIPE_CONFIRM, 8+4); //you have not any talent + WorldPacket data(MSG_TALENT_WIPE_CONFIRM, 8+4); //you have not any talent data << uint64(0); data << uint32(0); - SendPacket( &data ); + SendPacket(&data); return; } diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index ec9686b6dc2..f0f27691007 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -28,7 +28,7 @@ #include "World.h" #include "Util.h" -INSTANTIATE_SINGLETON_1( SocialMgr ); +INSTANTIATE_SINGLETON_1(SocialMgr); PlayerSocial::PlayerSocial() { diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 01fc86ff186..859c872d24f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -82,7 +82,7 @@ class PrioritizeManaUnitWraper struct PrioritizeMana { - int operator()( PrioritizeManaUnitWraper const& x, PrioritizeManaUnitWraper const& y ) const + int operator()(PrioritizeManaUnitWraper const& x, PrioritizeManaUnitWraper const& y) const { return x.getPercent() > y.getPercent(); } @@ -106,7 +106,7 @@ private: struct PrioritizeHealth { - int operator()( PrioritizeHealthUnitWraper const& x, PrioritizeHealthUnitWraper const& y ) const + int operator()(PrioritizeHealthUnitWraper const& x, PrioritizeHealthUnitWraper const& y) const { return x.getPercent() > y.getPercent(); } @@ -206,7 +206,7 @@ void SpellCastTargets::Update(Unit* caster) { m_GOTarget = m_GOTargetGUID ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL; m_unitTarget = m_unitTargetGUID ? - ( m_unitTargetGUID == caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) : + (m_unitTargetGUID == caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID)) : NULL; m_itemTarget = NULL; @@ -224,7 +224,7 @@ void SpellCastTargets::Update(Unit* caster) } } -bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) +bool SpellCastTargets::read (WorldPacket * data, Unit *caster) { if (data->rpos() + 4 > data->size()) return false; @@ -238,7 +238,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) return true; // TARGET_FLAG_UNK2 is used for non-combat pets, maybe other? - if ( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_UNK2 )) + if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNK2)) { if (!data->readPackGUID(m_unitTargetGUID)) return false; @@ -246,22 +246,22 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) m_intTargetFlags |= FLAG_INT_UNIT; } - if ( m_targetMask & ( TARGET_FLAG_OBJECT )) + if (m_targetMask & (TARGET_FLAG_OBJECT)) { if (!data->readPackGUID(m_GOTargetGUID)) return false; m_intTargetFlags |= FLAG_INT_OBJECT; } - if (( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM )) && caster->GetTypeId() == TYPEID_PLAYER) + if ((m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM)) && caster->GetTypeId() == TYPEID_PLAYER) if (!data->readPackGUID(m_itemTargetGUID)) return false; - if ( m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) ) + if (m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE)) if (!data->readPackGUID(m_CorpseTargetGUID)) return false; - if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) + if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { if (data->rpos() + 1 + 4 + 4 + 4 > data->size()) return false; @@ -277,7 +277,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) else m_srcPos.Relocate(caster); - if ( m_targetMask & TARGET_FLAG_DEST_LOCATION ) + if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { if (data->rpos() + 1 + 4 + 4 + 4 > data->size()) return false; @@ -291,7 +291,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) m_intTargetFlags |= FLAG_INT_DST_LOC; - if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) + if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { if (data->rpos() + 4 + 4 <= data->size()) { @@ -306,7 +306,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) else m_dstPos.Relocate(caster); - if ( m_targetMask & TARGET_FLAG_STRING ) + if (m_targetMask & TARGET_FLAG_STRING) { if (data->rpos() + 1 > data->size()) return false; @@ -319,12 +319,12 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) return true; } -void SpellCastTargets::write ( WorldPacket * data ) +void SpellCastTargets::write (WorldPacket * data) { *data << uint32(m_targetMask); //sLog.outDebug("Spell write, target mask = %u", m_targetMask); - if ( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2 ) ) + if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2)) { if (m_targetMask & TARGET_FLAG_UNIT) { @@ -333,20 +333,20 @@ void SpellCastTargets::write ( WorldPacket * data ) else *data << uint8(0); } - else if ( m_targetMask & TARGET_FLAG_OBJECT ) + else if (m_targetMask & TARGET_FLAG_OBJECT) { if (m_GOTarget) data->append(m_GOTarget->GetPackGUID()); else *data << uint8(0); } - else if ( m_targetMask & ( TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) ) + else if (m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE)) data->appendPackGUID(m_CorpseTargetGUID); else *data << uint8(0); } - if ( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM ) ) + if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM)) { if (m_itemTarget) data->append(m_itemTarget->GetPackGUID()); @@ -354,23 +354,23 @@ void SpellCastTargets::write ( WorldPacket * data ) *data << uint8(0); } - if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) + if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { *data << uint8(0); // It seems the client doesn't like unit target GUID being sent here, we must send 0 *data << m_srcPos.m_positionX << m_srcPos.m_positionY << m_srcPos.m_positionZ; } - if ( m_targetMask & TARGET_FLAG_DEST_LOCATION ) + if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { *data << uint8(0); // It seems the client doesn't like unit target GUID being sent here, we must send 0 *data << m_dstPos.m_positionX << m_dstPos.m_positionY << m_dstPos.m_positionZ; } - if ( m_targetMask & TARGET_FLAG_STRING ) + if (m_targetMask & TARGET_FLAG_STRING) *data << m_strTarget; } -Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer, bool skipCheck ) +Spell::Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer, bool skipCheck) : m_spellInfo(info), m_spellValue(new SpellValue(m_spellInfo)) , m_caster(Caster) { @@ -776,8 +776,8 @@ void Spell::prepareDataForTriggerSystem(AuraEffect const * triggeredByAura) { //========================================================================================== // Now fill data for trigger system, need know: - // can spell trigger another or not ( m_canTrigger ) - // Create base triggers flags for Attacker and Victim ( m_procAttacker, m_procVictim and m_procEx) + // can spell trigger another or not (m_canTrigger) + // Create base triggers flags for Attacker and Victim (m_procAttacker, m_procVictim and m_procEx) //========================================================================================== m_procVictim = m_procAttacker = 0; @@ -956,7 +956,7 @@ void Spell::AddUnitTarget(uint64 unitGUID, uint32 effIndex) void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex) { - if ( m_spellInfo->Effect[effIndex] == 0 ) + if (m_spellInfo->Effect[effIndex] == 0) return; uint64 targetGUID = pVictim->GetGUID(); @@ -1004,7 +1004,7 @@ void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex) void Spell::AddItemTarget(Item* pitem, uint32 effIndex) { - if ( m_spellInfo->Effect[effIndex] == 0 ) + if (m_spellInfo->Effect[effIndex] == 0) return; // Lookup target in already in list @@ -1238,7 +1238,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo); // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) - // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) + // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm...) if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !spellHitTarget->ToCreature()->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself()) p->CastedCreatureOrGO(spellHitTarget->GetEntry(),spellHitTarget->GetGUID(),m_spellInfo->Id); @@ -1280,7 +1280,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit); } - if ( m_caster != unit ) + if (m_caster != unit) { // Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells if (m_spellInfo->speed > 0.0f && @@ -1290,7 +1290,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool return SPELL_MISS_EVADE; } - if ( !m_caster->IsFriendlyTo(unit) ) + if (!m_caster->IsFriendlyTo(unit)) { // reset damage to 0 if target has Invisibility and isn't visible for caster // I do not think this is a correct way to fix it. Sanctuary effect should make all delayed spells invalid @@ -1325,7 +1325,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool if (m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->ToPlayer()->UpdatePvP(true); } - if ( unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) ) + if (unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO)) { m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit); unit->getHostileRefManager().threatAssist(m_caster, 0.0f); @@ -1493,10 +1493,10 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target) HandleEffects(NULL, NULL, go, effectNumber); // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) - // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) + // ignore autorepeat/melee casts for speed (not exist quest for spells (hm...) + if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) { - if ( Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself() ) + if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself()) p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); } } @@ -1536,7 +1536,7 @@ bool Spell::UpdateChanneledTargetList() for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { - if ( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) ) + if (ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask)) { Unit *unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); @@ -1691,7 +1691,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, SpellNo Unit *target = m_targets.getUnitTarget(); if (!target) { - sLog.outError( "SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id ); + sLog.outError("SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id); return; } pos = target; @@ -1756,7 +1756,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType) range = m_caster->GetDistance(goScriptTarget); } } - else if ( focusObject ) //Focus Object + else if (focusObject) //Focus Object { float frange = m_caster->GetDistance(focusObject); if (range >= frange) @@ -2115,7 +2115,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) } else { - sLog.outDebug( "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id ); + sLog.outDebug("SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); Unit *target = NULL; if (uint64 guid = m_caster->GetUInt64Value(UNIT_FIELD_TARGET)) target = ObjectAccessor::GetUnit(*m_caster, guid); @@ -2143,7 +2143,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) { if (!m_originalCaster || !m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) { - sLog.outError( "SPELL: no current channeled spell for spell ID %u", m_spellInfo->Id ); + sLog.outError("SPELL: no current channeled spell for spell ID %u", m_spellInfo->Id); break; } @@ -2154,7 +2154,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID())) AddUnitTarget(target, i); else - sLog.outError( "SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id ); + sLog.outError("SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id); break; case TARGET_DEST_CHANNEL: if (m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.HasDst()) @@ -2162,7 +2162,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) else if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID())) m_targets.setDst(target); else - sLog.outError( "SPELL: cannot find channel spell destination for spell ID %u", m_spellInfo->Id ); + sLog.outError("SPELL: cannot find channel spell destination for spell ID %u", m_spellInfo->Id); break; } break; @@ -2431,9 +2431,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) Player* Target = itr->getSource(); // IsHostileTo check duel and controlled by enemy - if ( Target && targetPlayer->IsWithinDistInMap(Target, radius) && + if (Target && targetPlayer->IsWithinDistInMap(Target, radius) && targetPlayer->getClass() == Target->getClass() && - !m_caster->IsHostileTo(Target) ) + !m_caster->IsHostileTo(Target)) { AddUnitTarget(Target, i); } @@ -2740,7 +2740,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere { // stealth must be removed at cast starting (at show channel bar) // skip triggered spell (item equip spell casting and other not explicit character casts/item uses) - if (!m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) + if (!m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo)) { m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST); for (uint32 i = 0; i < 3; ++i) @@ -2753,7 +2753,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere } } - m_caster->SetCurrentCastedSpell( this ); + m_caster->SetCurrentCastedSpell(this); SendSpellStart(); if (!m_casttime && !m_spellInfo->StartRecoveryTime @@ -3080,9 +3080,9 @@ uint64 Spell::handle_delayed(uint64 t_offset) { if (ihit->processed == false) { - if ( single_missile || ihit->timeDelay <= t_offset ) + if (single_missile || ihit->timeDelay <= t_offset) DoAllEffectOnTarget(&(*ihit)); - else if ( next_time == 0 || ihit->timeDelay < next_time ) + else if (next_time == 0 || ihit->timeDelay < next_time) next_time = ihit->timeDelay; } } @@ -3092,9 +3092,9 @@ uint64 Spell::handle_delayed(uint64 t_offset) { if (ighit->processed == false) { - if ( single_missile || ighit->timeDelay <= t_offset ) + if (single_missile || ighit->timeDelay <= t_offset) DoAllEffectOnTarget(&(*ighit)); - else if ( next_time == 0 || ighit->timeDelay < next_time ) + else if (next_time == 0 || ighit->timeDelay < next_time) next_time = ighit->timeDelay; } } @@ -3133,7 +3133,7 @@ void Spell::_handle_immediate_phase() continue; // apply Send Event effect to ground in case empty target lists - if ( m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j) ) + if (m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j)) { HandleEffects(NULL, NULL, NULL, j); continue; @@ -3239,7 +3239,7 @@ void Spell::SendSpellCooldown() } // have infinity cooldown but set at aura apply // do not set cooldown for triggered spells (needed by reincarnation) - if (m_spellInfo->Attributes & (SPELL_ATTR_DISABLED_WHILE_ACTIVE | SPELL_ATTR_PASSIVE ) || m_IsTriggeredSpell) + if (m_spellInfo->Attributes & (SPELL_ATTR_DISABLED_WHILE_ACTIVE | SPELL_ATTR_PASSIVE) || m_IsTriggeredSpell) return; _player->AddSpellAndCategoryCooldowns(m_spellInfo,m_CastItem ? m_CastItem->GetEntry() : 0, this); @@ -3306,10 +3306,10 @@ void Spell::update(uint32 difftime) // channeled spell processed independently for quest targeting // cast at creature (or GO) quest objectives update at successful cast channel finished - // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if ( !IsAutoRepeat() && !IsNextMeleeSwingSpell() ) + // ignore autorepeat/melee casts for speed (not exist quest for spells (hm...) + if (!IsAutoRepeat() && !IsNextMeleeSwingSpell()) { - if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) + if (Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) { for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { @@ -3378,7 +3378,7 @@ void Spell::finish(bool ok) { // Unsummon statue uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL); - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell); if (spellInfo && spellInfo->SpellIconID==2056) { sLog.outDebug("Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id); @@ -3442,7 +3442,7 @@ void Spell::finish(bool ok) } // Stop Attack for some spells - if ( m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET ) + if (m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET) m_caster->AttackStop(); } @@ -3540,7 +3540,7 @@ void Spell::SendSpellStart() castFlags |= CAST_FLAG_AMMO; if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())) - && m_spellInfo->powerType != POWER_HEALTH ) + && m_spellInfo->powerType != POWER_HEALTH) castFlags |= CAST_FLAG_POWER_LEFT_SELF; if (m_spellInfo->runeCostID && m_spellInfo->powerType == POWER_RUNE) @@ -3576,10 +3576,10 @@ void Spell::SendSpellStart() if (castFlags & CAST_FLAG_POWER_LEFT_SELF) data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType)); - if ( castFlags & CAST_FLAG_AMMO ) + if (castFlags & CAST_FLAG_AMMO) WriteAmmoToPacket(&data); - if ( castFlags & CAST_FLAG_UNKNOWN_23 ) + if (castFlags & CAST_FLAG_UNKNOWN_23) { data << uint32(0); data << uint32(0); @@ -3606,7 +3606,7 @@ void Spell::SendSpellGo() castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())) - && m_spellInfo->powerType != POWER_HEALTH ) + && m_spellInfo->powerType != POWER_HEALTH) castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible if ((m_caster->GetTypeId() == TYPEID_PLAYER) @@ -3661,7 +3661,7 @@ void Spell::SendSpellGo() if (castFlags & CAST_FLAG_POWER_LEFT_SELF) data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType)); - if ( castFlags & CAST_FLAG_RUNE_LIST ) // rune cooldowns list + if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list { uint8 v1 = m_runesState; uint8 v2 = m_caster->ToPlayer()->GetRunesState(); @@ -3676,22 +3676,22 @@ void Spell::SendSpellGo() } } - if ( castFlags & CAST_FLAG_UNKNOWN_18 ) // unknown wotlk + if (castFlags & CAST_FLAG_UNKNOWN_18) // unknown wotlk { data << float(0); data << uint32(0); } - if ( castFlags & CAST_FLAG_AMMO ) + if (castFlags & CAST_FLAG_AMMO) WriteAmmoToPacket(&data); - if ( castFlags & CAST_FLAG_UNKNOWN_20 ) // unknown wotlk + if (castFlags & CAST_FLAG_UNKNOWN_20) // unknown wotlk { data << uint32(0); data << uint32(0); } - if ( m_targets.getTargetMask() & TARGET_FLAG_DEST_LOCATION ) + if (m_targets.getTargetMask() & TARGET_FLAG_DEST_LOCATION) { data << uint8(0); } @@ -3699,25 +3699,25 @@ void Spell::SendSpellGo() m_caster->SendMessageToSet(&data, true); } -void Spell::WriteAmmoToPacket( WorldPacket * data ) +void Spell::WriteAmmoToPacket(WorldPacket * data) { uint32 ammoInventoryType = 0; uint32 ammoDisplayID = 0; if (m_caster->GetTypeId() == TYPEID_PLAYER) { - Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack( RANGED_ATTACK ); + Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); if (pItem) { ammoInventoryType = pItem->GetProto()->InventoryType; - if ( ammoInventoryType == INVTYPE_THROWN ) + if (ammoInventoryType == INVTYPE_THROWN) ammoDisplayID = pItem->GetProto()->DisplayInfoID; else { uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID); if (ammoID) { - ItemPrototype const *pProto = objmgr.GetItemPrototype( ammoID ); + ItemPrototype const *pProto = objmgr.GetItemPrototype(ammoID); if (pProto) { ammoDisplayID = pProto->DisplayInfoID; @@ -3771,7 +3771,7 @@ void Spell::WriteAmmoToPacket( WorldPacket * data ) *data << uint32(ammoInventoryType); } -void Spell::WriteSpellGoTargets( WorldPacket * data ) +void Spell::WriteSpellGoTargets(WorldPacket * data) { // This function also fill data for channeled spells: // m_needAliveTargetMask req for stop channelig if one target die @@ -3807,11 +3807,11 @@ void Spell::WriteSpellGoTargets( WorldPacket * data ) *data << (uint8)miss; for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { - if ( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss + if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss { *data << uint64(ihit->targetGUID); *data << uint8(ihit->missCondition); - if ( ihit->missCondition == SPELL_MISS_REFLECT ) + if (ihit->missCondition == SPELL_MISS_REFLECT) *data << uint8(ihit->reflectResult); } } @@ -3956,7 +3956,7 @@ void Spell::SendChannelUpdate(uint32 time) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data( MSG_CHANNEL_UPDATE, 8+4 ); + WorldPacket data(MSG_CHANNEL_UPDATE, 8+4); data.append(m_caster->GetPackGUID()); data << uint32(time); @@ -3972,7 +3972,7 @@ void Spell::SendChannelStart(uint32 duration) { for (std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) { - if ( (itr->effectMask & (1 << 0)) && itr->reflectResult == SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID()) + if ((itr->effectMask & (1 << 0)) && itr->reflectResult == SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID()) { target = ObjectAccessor::GetUnit(*m_caster, itr->targetGUID); break; @@ -3983,7 +3983,7 @@ void Spell::SendChannelStart(uint32 duration) { for (std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) { - if (itr->effectMask & (1 << 0) ) + if (itr->effectMask & (1 << 0)) { target = m_caster->GetMap()->GetGameObject(itr->targetGUID); break; @@ -3991,7 +3991,7 @@ void Spell::SendChannelStart(uint32 duration) } } - WorldPacket data( MSG_CHANNEL_START, (8+4+4) ); + WorldPacket data(MSG_CHANNEL_START, (8+4+4)); data.append(m_caster->GetPackGUID()); data << uint32(m_spellInfo->Id); data << uint32(duration); @@ -4134,7 +4134,7 @@ void Spell::TakePower() // health as power used if (m_spellInfo->powerType == POWER_HEALTH) { - m_caster->ModifyHealth( -(int32)m_powerCost ); + m_caster->ModifyHealth(-(int32)m_powerCost); return; } @@ -4158,13 +4158,13 @@ void Spell::TakeAmmo() { if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER) { - Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack( RANGED_ATTACK ); + Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); // wands don't have ammo if (!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass==ITEM_SUBCLASS_WEAPON_WAND) return; - if ( pItem->GetProto()->InventoryType == INVTYPE_THROWN ) + if (pItem->GetProto()->InventoryType == INVTYPE_THROWN) { if (pItem->GetMaxStackCount()==1) { @@ -4175,7 +4175,7 @@ void Spell::TakeAmmo() { // decrease items amount for stackable throw weapon uint32 count = 1; - m_caster->ToPlayer()->DestroyItemCount( pItem, count, true); + m_caster->ToPlayer()->DestroyItemCount(pItem, count, true); } } else if (uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID)) @@ -4326,7 +4326,7 @@ void Spell::TakeReagents() if (m_CastItem) { ItemPrototype const *proto = m_CastItem->GetProto(); - if ( proto && proto->ItemId == itemid ) + if (proto && proto->ItemId == itemid) { for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) { @@ -4385,14 +4385,14 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar uint8 eff = m_spellInfo->Effect[i]; - sLog.outDebug( "Spell: %u Effect : %u", m_spellInfo->Id, eff); + sLog.outDebug("Spell: %u Effect : %u", m_spellInfo->Id, eff); //we do not need DamageMultiplier here. damage = CalculateDamage(i, NULL); if (eff < TOTAL_SPELL_EFFECTS) { - //sLog.outDebug( "WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff); + //sLog.outDebug("WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff); (this->*SpellEffects[eff])(i); } } @@ -4425,14 +4425,14 @@ SpellCastResult Spell::CheckCast(bool strict) } // only allow triggered spells if at an ended battleground - if ( !m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER) + if (!m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER) if (BattleGround * bg = m_caster->ToPlayer()->GetBattleGround()) if (bg->GetStatus() == STATUS_WAIT_LEAVE) return SPELL_FAILED_DONT_REPORT; // only check at first call, Stealth auras are already removed at second call // for now, ignore triggered spells - if ( strict && !m_IsTriggeredSpell) + if (strict && !m_IsTriggeredSpell) { bool checkForm = true; // Ignore form req aura @@ -4491,11 +4491,11 @@ SpellCastResult Spell::CheckCast(bool strict) // cancel autorepeat spells if cast start when moving // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code) - if ( m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() ) + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving()) { // skip stuck spell to allow use it in falling case and apply spell limitations at movement - if ( (!m_caster->ToPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) && - (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0) ) + if ((!m_caster->ToPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) && + (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0)) return SPELL_FAILED_MOVING; } @@ -4650,7 +4650,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_TARGET_AURASTATE; //Must be behind the target. - if ( m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster) + if (m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster) //Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags && (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags.IsEqual(0x20000,0,0))) //Mutilate no longer requires you be behind the target as of patch 3.0.3 @@ -4663,7 +4663,7 @@ SpellCastResult Spell::CheckCast(bool strict) } //Target must be facing you. - if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(M_PI, m_caster) ) + if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(M_PI, m_caster)) { SendInterrupted(2); return SPELL_FAILED_NOT_INFRONT; @@ -4723,10 +4723,10 @@ SpellCastResult Spell::CheckCast(bool strict) { for (uint8 j = 0; j < 3; ++j) { - if ( m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY || + if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY || m_spellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetA[j] != TARGET_UNIT_CASTER || m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY ) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) { SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id); SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id); @@ -4799,7 +4799,7 @@ SpellCastResult Spell::CheckCast(bool strict) CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap(), *m_caster, range); - if (p_Creature ) + if (p_Creature) { creatureScriptTarget = p_Creature; goScriptTarget = NULL; @@ -4814,7 +4814,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // store coordinates for TARGET_DST_NEARBY_ENTRY if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY ) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) { m_targets.setDst(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ()); @@ -4829,7 +4829,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // store coordinates for TARGET_DST_NEARBY_ENTRY if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY ) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) { m_targets.setDst(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ()); @@ -4884,7 +4884,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // spell different for friends and enemies // hurt version required facing - if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc( M_PI, m_targets.getUnitTarget() )) + if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc(M_PI, m_targets.getUnitTarget())) return SPELL_FAILED_UNIT_NOT_INFRONT; } else if (m_spellInfo->SpellIconID == 33 && m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA) @@ -5023,7 +5023,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetTypeId() != TYPEID_UNIT) return SPELL_FAILED_BAD_TARGETS; - if ( !(m_targets.getUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE) ) + if (!(m_targets.getUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE)) return SPELL_FAILED_TARGET_UNSKINNABLE; Creature* creature = m_targets.getUnitTarget()->ToCreature(); @@ -5039,30 +5039,30 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_LOW_CASTLEVEL; // chance for fail at orange skinning attempt - if ( (m_selfContainer && (*m_selfContainer) == this) && + if ((m_selfContainer && (*m_selfContainer) == this) && skillValue < sWorld.GetConfigMaxSkillValue() && - (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37) ) + (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37)) return SPELL_FAILED_TRY_AGAIN; break; } case SPELL_EFFECT_OPEN_LOCK: { - if ( m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT && - m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT_ITEM ) + if (m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT && + m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT_ITEM) break; - if ( m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc. + if (m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc. // we need a go target in case of TARGET_GAMEOBJECT || m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT && !m_targets.getGOTarget() // we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM || m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_ITEM && !m_targets.getGOTarget() && - (!m_targets.getItemTarget() || !m_targets.getItemTarget()->GetProto()->LockID || m_targets.getItemTarget()->GetOwner() != m_caster ) ) + (!m_targets.getItemTarget() || !m_targets.getItemTarget()->GetProto()->LockID || m_targets.getItemTarget()->GetOwner() != m_caster)) return SPELL_FAILED_BAD_TARGETS; // In BattleGround players can use only flags and banners - if ( m_caster->ToPlayer()->InBattleGround() && - !m_caster->ToPlayer()->CanUseBattleGroundObject() ) + if (m_caster->ToPlayer()->InBattleGround() && + !m_caster->ToPlayer()->CanUseBattleGroundObject()) return SPELL_FAILED_TRY_AGAIN; // get the lock entry @@ -5153,11 +5153,11 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_BAD_TARGETS; Player* target = objmgr.GetPlayer(m_caster->ToPlayer()->GetSelection()); - if ( !target || m_caster->ToPlayer() == target || !target->IsInSameRaidWith(m_caster->ToPlayer()) ) + if (!target || m_caster->ToPlayer() == target || !target->IsInSameRaidWith(m_caster->ToPlayer())) return SPELL_FAILED_BAD_TARGETS; // check if our map is dungeon - if ( sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon() ) + if (sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon()) { InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(m_caster->GetMapId()); if (!instance) @@ -5327,10 +5327,10 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_NO_MOUNTS_ALLOWED; ShapeshiftForm form = m_caster->m_form; - if ( form == FORM_CAT || form == FORM_TREE || form == FORM_TRAVEL || + if (form == FORM_CAT || form == FORM_TREE || form == FORM_TRAVEL || form == FORM_AQUA || form == FORM_BEAR || form == FORM_DIREBEAR || form == FORM_CREATUREBEAR || form == FORM_GHOSTWOLF || form == FORM_FLIGHT || - form == FORM_FLIGHT_EPIC || form == FORM_MOONKIN || form == FORM_METAMORPHOSIS ) + form == FORM_FLIGHT_EPIC || form == FORM_MOONKIN || form == FORM_METAMORPHOSIS) return SPELL_FAILED_NOT_SHAPESHIFT; break; @@ -5441,7 +5441,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) SpellCastResult Spell::CheckCasterAuras() const { - // spells totally immuned to caster auras ( wsg flag drop, give marks etc) + // spells totally immuned to caster auras (wsg flag drop, give marks etc) if (m_spellInfo->AttributesEx6& SPELL_ATTR_EX6_IGNORE_CASTER_AURAS) return SPELL_CAST_OK; @@ -5451,7 +5451,7 @@ SpellCastResult Spell::CheckCasterAuras() const // Check if the spell grants school or mechanic immunity. // We use bitmasks so the loop is done only once and not on every aura check below. - if ( m_spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY ) + if (m_spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { for (int i = 0; i < 3; ++i) { @@ -5492,11 +5492,11 @@ SpellCastResult Spell::CheckCasterAuras() const for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { Aura const * aura = itr->second->GetBase(); - if ( GetAllSpellMechanicMask(aura->GetSpellProto()) & mechanic_immune ) + if (GetAllSpellMechanicMask(aura->GetSpellProto()) & mechanic_immune) continue; - if ( GetSpellSchoolMask(aura->GetSpellProto()) & school_immune ) + if (GetSpellSchoolMask(aura->GetSpellProto()) & school_immune) continue; - if ( (1<<(aura->GetSpellProto()->Dispel)) & dispel_immune) + if ((1<<(aura->GetSpellProto()->Dispel)) & dispel_immune) continue; //Make a second check for spell failed so the right SPELL_FAILED message is returned. @@ -5522,9 +5522,9 @@ SpellCastResult Spell::CheckCasterAuras() const case SPELL_AURA_MOD_SILENCE: case SPELL_AURA_MOD_PACIFY: case SPELL_AURA_MOD_PACIFY_SILENCE: - if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) + if (m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) return SPELL_FAILED_PACIFIED; - else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) + else if (m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) return SPELL_FAILED_SILENCED; break; default: break; @@ -5548,21 +5548,21 @@ bool Spell::CanAutoCast(Unit* target) { if (m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) { - if ( m_spellInfo->StackAmount <= 1) + if (m_spellInfo->StackAmount <= 1) { - if ( target->HasAuraEffect(m_spellInfo->Id, j) ) + if (target->HasAuraEffect(m_spellInfo->Id, j)) return false; } else { - if ( AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j)) + if (AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j)) if (aureff->GetBase()->GetStackAmount() >= m_spellInfo->StackAmount) return false; } } - else if ( IsAreaAuraEffect( m_spellInfo->Effect[j] )) + else if (IsAreaAuraEffect(m_spellInfo->Effect[j])) { - if ( target->HasAuraEffect(m_spellInfo->Id, j) ) + if (target->HasAuraEffect(m_spellInfo->Id, j)) return false; } } @@ -5574,7 +5574,7 @@ bool Spell::CanAutoCast(Unit* target) SelectSpellTargets(); //check if among target units, our WANTED target is as well (->only self cast spells return false) for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) - if ( ihit->targetGUID == targetguid ) + if (ihit->targetGUID == targetguid) return true; } return false; //target invalid @@ -5619,8 +5619,8 @@ SpellCastResult Spell::CheckRange(bool strict) else if (min_range && m_caster->IsWithinCombatRange(target, min_range)) // skip this check if min_range = 0 return SPELL_FAILED_TOO_CLOSE; - if ( m_caster->GetTypeId() == TYPEID_PLAYER && - (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc( M_PI, target ) ) + if (m_caster->GetTypeId() == TYPEID_PLAYER && + (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(M_PI, target)) return SPELL_FAILED_UNIT_NOT_INFRONT; } @@ -5649,7 +5649,7 @@ SpellCastResult Spell::CheckPower() return SPELL_CAST_OK; } // Check valid power type - if ( m_spellInfo->powerType >= MAX_POWERS ) + if (m_spellInfo->powerType >= MAX_POWERS) { sLog.outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->powerType); return SPELL_FAILED_UNKNOWN; @@ -5686,7 +5686,7 @@ SpellCastResult Spell::CheckItems() else { uint32 itemid = m_CastItem->GetEntry(); - if ( !p_caster->HasItemCount(itemid, 1) ) + if (!p_caster->HasItemCount(itemid, 1)) return SPELL_FAILED_ITEM_NOT_READY; ItemPrototype const *proto = m_CastItem->GetProto(); @@ -5805,7 +5805,7 @@ SpellCastResult Spell::CheckItems() uint32 itemcount = m_spellInfo->ReagentCount[i]; // if CastItem is also spell reagent - if ( m_CastItem && m_CastItem->GetEntry() == itemid ) + if (m_CastItem && m_CastItem->GetEntry() == itemid) { ItemPrototype const *proto = m_CastItem->GetProto(); if (!proto) @@ -5821,7 +5821,7 @@ SpellCastResult Spell::CheckItems() } } } - if ( !p_caster->HasItemCount(itemid,itemcount) ) + if (!p_caster->HasItemCount(itemid,itemcount)) return SPELL_FAILED_ITEM_NOT_READY; //0x54 } } @@ -5832,7 +5832,7 @@ SpellCastResult Spell::CheckItems() { if (m_spellInfo->Totem[i] != 0) { - if ( p_caster->HasItemCount(m_spellInfo->Totem[i],1) ) + if (p_caster->HasItemCount(m_spellInfo->Totem[i],1)) { totems -= 1; continue; @@ -5849,7 +5849,7 @@ SpellCastResult Spell::CheckItems() { if (m_spellInfo->TotemCategory[i] != 0) { - if ( p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i]) ) + if (p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i])) { TotemCategory -= 1; continue; @@ -5872,13 +5872,13 @@ SpellCastResult Spell::CheckItems() if (!m_IsTriggeredSpell && m_spellInfo->EffectItemType[i]) { ItemPosCountVec dest; - uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1 ); - if (msg != EQUIP_ERR_OK ) + uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); + if (msg != EQUIP_ERR_OK) { ItemPrototype const *pProto = objmgr.GetItemPrototype(m_spellInfo->EffectItemType[i]); if (pProto && !(pProto->ItemLimitCategory)) { - p_caster->SendEquipError( msg, NULL, NULL ); + p_caster->SendEquipError(msg, NULL, NULL); return SPELL_FAILED_DONT_REPORT; } else @@ -5906,10 +5906,10 @@ SpellCastResult Spell::CheckItems() if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST) return SPELL_FAILED_TOTEM_CATEGORY; ItemPosCountVec dest; - uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1 ); - if (msg != EQUIP_ERR_OK ) + uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); + if (msg != EQUIP_ERR_OK) { - p_caster->SendEquipError( msg, NULL, NULL ); + p_caster->SendEquipError(msg, NULL, NULL); return SPELL_FAILED_DONT_REPORT; } } @@ -5919,10 +5919,10 @@ SpellCastResult Spell::CheckItems() if (!targetItem) return SPELL_FAILED_ITEM_NOT_FOUND; - if ( targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel ) + if (targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel) return SPELL_FAILED_LOWLEVEL; // Not allow enchant in trade slot for some enchant type - if ( targetItem->GetOwner() != m_caster ) + if (targetItem->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); @@ -5939,7 +5939,7 @@ SpellCastResult Spell::CheckItems() if (!item) return SPELL_FAILED_ITEM_NOT_FOUND; // Not allow enchant in trade slot for some enchant type - if ( item->GetOwner() != m_caster ) + if (item->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); @@ -5959,7 +5959,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_CANT_BE_DISENCHANTED; // prevent disenchanting in trade slot - if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() ) + if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID()) return SPELL_FAILED_CANT_BE_DISENCHANTED; ItemPrototype const* itemProto = m_targets.getItemTarget()->GetProto(); @@ -5989,7 +5989,7 @@ SpellCastResult Spell::CheckItems() if (!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS) return SPELL_FAILED_CANT_BE_PROSPECTED; //prevent prospecting in trade slot - if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() ) + if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID()) return SPELL_FAILED_CANT_BE_PROSPECTED; //Check for enough skill in jewelcrafting uint32 item_prospectingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank; @@ -6012,7 +6012,7 @@ SpellCastResult Spell::CheckItems() if (!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_HERBS) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS) return SPELL_FAILED_CANT_BE_MILLED; //prevent milling in trade slot - if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() ) + if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID()) return SPELL_FAILED_CANT_BE_MILLED; //Check for enough skill in inscription uint32 item_millingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank; @@ -6031,7 +6031,7 @@ SpellCastResult Spell::CheckItems() case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: { if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; - if ( m_attackType != RANGED_ATTACK ) + if (m_attackType != RANGED_ATTACK) break; Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType); if (!pItem || pItem->IsBroken()) @@ -6042,7 +6042,7 @@ SpellCastResult Spell::CheckItems() case ITEM_SUBCLASS_WEAPON_THROWN: { uint32 ammo = pItem->GetEntry(); - if ( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) ) + if (!m_caster->ToPlayer()->HasItemCount(ammo, 1)) return SPELL_FAILED_NO_AMMO; }; break; case ITEM_SUBCLASS_WEAPON_GUN: @@ -6059,7 +6059,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; } - ItemPrototype const *ammoProto = objmgr.GetItemPrototype( ammo ); + ItemPrototype const *ammoProto = objmgr.GetItemPrototype(ammo); if (!ammoProto) return SPELL_FAILED_NO_AMMO; @@ -6082,7 +6082,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; } - if ( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) ) + if (!m_caster->ToPlayer()->HasItemCount(ammo, 1)) return SPELL_FAILED_NO_AMMO; }; break; case ITEM_SUBCLASS_WEAPON_WAND: @@ -6122,7 +6122,7 @@ SpellCastResult Spell::CheckItems() Item* item = m_caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK); // skip spell if no weapon in slot or broken - if (!item || item->IsBroken() ) + if (!item || item->IsBroken()) return m_IsTriggeredSpell? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS; // skip spell if weapon not fit to triggered spell @@ -6136,7 +6136,7 @@ SpellCastResult Spell::CheckItems() Item* item = m_caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK); // skip spell if no weapon in slot or broken - if (!item || item->IsBroken() ) + if (!item || item->IsBroken()) return m_IsTriggeredSpell? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS; // skip spell if weapon not fit to triggered spell @@ -6159,7 +6159,7 @@ void Spell::Delayed() // only called in DealDamage() if (isDelayableNoMore()) // Spells may only be delayed twice return; - // spells not loosing casting time ( slam, dynamites, bombs.. ) + // spells not loosing casting time (slam, dynamites, bombs..) //if (!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE)) // return; @@ -6315,14 +6315,14 @@ bool Spell::CheckTarget(Unit* target, uint32 eff) // unselectable targets skipped in all cases except TARGET_UNIT_NEARBY_ENTRY targeting // in case TARGET_UNIT_NEARBY_ENTRY target selected by server always and can't be cheated - /*if ( target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && + /*if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && m_spellInfo->EffectImplicitTargetA[eff] != TARGET_UNIT_NEARBY_ENTRY && - m_spellInfo->EffectImplicitTargetB[eff] != TARGET_UNIT_NEARBY_ENTRY ) + m_spellInfo->EffectImplicitTargetB[eff] != TARGET_UNIT_NEARBY_ENTRY) return false;*/ } //Check player targets and remove if in GM mode or GM invisibility (for not self casting case) - if ( target != m_caster && target->GetTypeId() == TYPEID_PLAYER) + if (target != m_caster && target->GetTypeId() == TYPEID_PLAYER) { if (target->ToPlayer()->GetVisibility() == VISIBILITY_OFF) return false; @@ -6354,7 +6354,7 @@ bool Spell::CheckTarget(Unit* target, uint32 eff) if (m_IsTriggeredSpell) return true; - //Check targets for LOS visibility (except spells without range limitations ) + //Check targets for LOS visibility (except spells without range limitations) switch(m_spellInfo->Effect[eff]) { case SPELL_EFFECT_SUMMON_PLAYER: // from anywhere @@ -6406,7 +6406,7 @@ bool Spell::IsNeedSendToClient() const m_spellInfo->speed > 0.0f || !m_triggeredByAuraSpell && !m_IsTriggeredSpell; } -bool Spell::HaveTargetsForEffect( uint8 effect ) const +bool Spell::HaveTargetsForEffect(uint8 effect) const { for (std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) if (itr->effectMask & (1 << effect)) @@ -6741,7 +6741,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk skillId = SkillByLockType(LockType(lockInfo->Index[j])); - if ( skillId != SKILL_NONE ) + if (skillId != SKILL_NONE) { // skill bonus provided by casting spell (mostly item spells) // add the damage modifier from the spell casted (cheat lock / skeleton key etc.) (use m_currentBasePoints, CalculateDamage returns wrong value) @@ -6930,7 +6930,7 @@ void Spell::SelectTrajTargets() } } -void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster ) +void Spell::FillRaidOrPartyTargets(UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster) { Player *pTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); Group *pGroup = pTarget ? pTarget->GetGroup() : NULL; @@ -6974,7 +6974,7 @@ void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float ra } } -void Spell::FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster ) +void Spell::FillRaidOrPartyManaPriorityTargets(UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster) { FillRaidOrPartyTargets(TagUnitMap,target,radius,raid,withPets,withCaster); @@ -6991,7 +6991,7 @@ void Spell::FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* targ } } -void Spell::FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster ) +void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster) { FillRaidOrPartyTargets(TagUnitMap,target,radius,raid,withPets,withCaster); diff --git a/src/game/Spell.h b/src/game/Spell.h index 108765629e9..17235c77961 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -128,8 +128,8 @@ class SpellCastTargets SpellCastTargets(); ~SpellCastTargets(); - bool read ( WorldPacket * data, Unit *caster ); - void write ( WorldPacket * data ); + bool read (WorldPacket * data, Unit *caster); + void write (WorldPacket * data); SpellCastTargets& operator=(const SpellCastTargets &target) { @@ -266,11 +266,11 @@ enum SpellTargets class Spell { friend struct Trinity::SpellNotifierCreatureAndPlayer; - friend void Unit::SetCurrentCastedSpell( Spell * pSpell ); + friend void Unit::SetCurrentCastedSpell(Spell * pSpell); public: - void EffectNULL(uint32 ); - void EffectUnused(uint32 ); + void EffectNULL(uint32); + void EffectUnused(uint32); void EffectDistract(uint32 i); void EffectPull(uint32 i); void EffectSchoolDMG(uint32 i); @@ -388,7 +388,7 @@ class Spell typedef std::set<Aura *> UsedSpellMods; - Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL, bool skipCheck = false ); + Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL, bool skipCheck = false); ~Spell(); void prepare(SpellCastTargets const* targets, AuraEffect const * triggeredByAura = NULL); @@ -429,19 +429,19 @@ class Spell void setState(uint32 state) { m_spellState = state; } void DoCreateItem(uint32 i, uint32 itemtype); - void WriteSpellGoTargets( WorldPacket * data ); - void WriteAmmoToPacket( WorldPacket * data ); + void WriteSpellGoTargets(WorldPacket * data); + void WriteAmmoToPacket(WorldPacket * data); void SelectSpellTargets(); void SelectEffectTargets(uint32 i, uint32 cur); void SelectTrajTargets(); - void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster ); - void FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withcaster ); - void FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withcaster ); + void FillRaidOrPartyTargets(UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster); + void FillRaidOrPartyManaPriorityTargets(UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withcaster); + void FillRaidOrPartyHealthPriorityTargets(UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withcaster); template<typename T> WorldObject* FindCorpseUsing(); - bool CheckTarget( Unit* target, uint32 eff ); + bool CheckTarget(Unit* target, uint32 eff); bool CanAutoCast(Unit* target); void CheckSrc() { if (!m_targets.HasSrc()) m_targets.setSrc(m_caster); } void CheckDst() { if (!m_targets.HasDst()) m_targets.setDst(m_caster); } @@ -772,16 +772,16 @@ namespace Trinity } #ifdef WIN32 - template<> inline void Visit(CorpseMapType & ) {} - template<> inline void Visit(GameObjectMapType & ) {} - template<> inline void Visit(DynamicObjectMapType & ) {} + template<> inline void Visit(CorpseMapType &) {} + template<> inline void Visit(GameObjectMapType &) {} + template<> inline void Visit(DynamicObjectMapType &) {} #endif }; #ifndef WIN32 - template<> inline void SpellNotifierCreatureAndPlayer::Visit(CorpseMapType& ) {} - template<> inline void SpellNotifierCreatureAndPlayer::Visit(GameObjectMapType& ) {} - template<> inline void SpellNotifierCreatureAndPlayer::Visit(DynamicObjectMapType& ) {} + template<> inline void SpellNotifierCreatureAndPlayer::Visit(CorpseMapType&) {} + template<> inline void SpellNotifierCreatureAndPlayer::Visit(GameObjectMapType&) {} + template<> inline void SpellNotifierCreatureAndPlayer::Visit(DynamicObjectMapType&) {} #endif } diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp index c3c64f00beb..4ff5194458c 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -429,7 +429,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster) for (int t=0; t<MAX_SPELL_EFFECTS; t++) if (pEnchant->spellid[t] == m_spellProto->Id) { - amount = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000 ); + amount = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000); break; } } @@ -1018,7 +1018,7 @@ void AuraEffect::UpdatePeriodic(Unit * caster) // Haunting Spirits if (GetId() == 7057) { - m_amplitude = irand (0 , 60 ) + 30; + m_amplitude = irand (0 , 60) + 30; m_amplitude *= IN_MILISECONDS; } break; @@ -1225,7 +1225,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const uint32 absorb=0; uint32 resist=0; - CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); // ignore non positive values (can be result apply spellmods to aura damage uint32 damage = GetAmount() > 0 ? GetAmount() : 0; @@ -1236,7 +1236,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const // Calculate armor mitigation if it is a physical spell // But not for bleed mechanic spells - if ( GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL && + if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL && GetEffectMechanic(GetSpellProto(), m_effIndex) != MECHANIC_BLEED) { uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellProto()); @@ -1321,7 +1321,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const if (!caster->isAlive()) return; - if ( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA && + if (GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA && caster->SpellHitResult(target,GetSpellProto(),false)!=SPELL_MISS_NONE) return; @@ -1334,7 +1334,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const uint32 absorb=0; uint32 resist=0; - CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); //uint32 damage = GetModifierValuePerStack() > 0 ? GetModifierValuePerStack() : 0; uint32 damage = GetAmount() > 0 ? GetAmount() : 0; @@ -1464,8 +1464,8 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const target->SendPeriodicAuraLog(&pInfo); // add HoTs to amount healed in bgs - if ( caster->GetTypeId() == TYPEID_PLAYER ) - if ( BattleGround *bg = caster->ToPlayer()->GetBattleGround() ) + if (caster->GetTypeId() == TYPEID_PLAYER) + if (BattleGround *bg = caster->ToPlayer()->GetBattleGround()) bg->UpdatePlayerScore(caster->ToPlayer(), SCORE_HEALING_DONE, gain); target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); @@ -1481,7 +1481,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const caster->DealDamageMods(caster,damage,&absorb); caster->SendSpellNonMeleeDamageLog(caster, GetId(), damage, GetSpellSchoolMask(GetSpellProto()), absorb, 0, false, 0, false); - CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); caster->DealDamage(caster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true); } @@ -1507,7 +1507,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const if (!caster || !caster->isAlive()) break; - if ( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA && + if (GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA && caster->SpellHitResult(target,GetSpellProto(),false) != SPELL_MISS_NONE) break; @@ -1913,12 +1913,12 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const { // Feeding Frenzy Rank 1 case 53511: - if ( target->getVictim() && target->getVictim()->GetHealth() * 100 < target->getVictim()->GetMaxHealth() * 35 ) + if (target->getVictim() && target->getVictim()->GetHealth() * 100 < target->getVictim()->GetMaxHealth() * 35) target->CastSpell(target, 60096, true, 0, this); return; // Feeding Frenzy Rank 2 case 53512: - if ( target->getVictim() && target->getVictim()->GetHealth() * 100 < target->getVictim()->GetMaxHealth() * 35 ) + if (target->getVictim() && target->getVictim()->GetHealth() * 100 < target->getVictim()->GetMaxHealth() * 35) target->CastSpell(target, 60097, true, 0, this); return; default: @@ -2027,7 +2027,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const case 27746: if (target->GetPower(POWER_MANA) >= 10) { - target->ModifyPower( POWER_MANA, -10 ); + target->ModifyPower(POWER_MANA, -10); target->SendEnergizeSpellLog(caster, 27746, -10, POWER_MANA); } else @@ -2384,7 +2384,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const { if (target->GetTypeId() == TYPEID_PLAYER) target->ToPlayer()->RemoveSpellCooldown(spellId); - target->CastSpell(target, spellId, true, NULL, this ); + target->CastSpell(target, spellId, true, NULL, this); } if (spellId2) @@ -2764,7 +2764,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m modelid = target->GetModelForForm(form); // remove polymorph before changing display id to keep new display id - switch ( form ) + switch (form) { case FORM_CAT: case FORM_TREE: @@ -2862,12 +2862,12 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m case FORM_BEAR: case FORM_DIREBEAR: case FORM_CAT: - if (AuraEffect* dummy = target->GetAuraEffect(37315, 0) ) + if (AuraEffect* dummy = target->GetAuraEffect(37315, 0)) target->CastSpell(target,37316,true,NULL,dummy); break; // Nordrassil Regalia - bonus case FORM_MOONKIN: - if (AuraEffect* dummy = target->GetAuraEffect(37324, 0) ) + if (AuraEffect* dummy = target->GetAuraEffect(37324, 0)) target->CastSpell(target,37325,true,NULL,dummy); break; case FORM_BATTLESTANCE: @@ -3042,7 +3042,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode, { // for players, start regeneration after 1s (in polymorph fast regeneration case) // only if caster is Player (after patch 2.4.2) - if (IS_PLAYER_GUID(GetCasterGUID()) ) + if (IS_PLAYER_GUID(GetCasterGUID())) target->ToPlayer()->setRegenTimerCount(1*IN_MILISECONDS); //dismount polymorphed target (after patch 2.4.2) @@ -3145,7 +3145,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bo if (target->GetTypeId() != TYPEID_PLAYER) return; - if ( apply ) + if (apply) { /* WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9); @@ -3277,7 +3277,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode, // This is between the two because there is a check in _ApplyItemMods // we must make sure that flag is always removed when call that function // refer to DurabilityPointsLoss - if (Item *pItem = target->ToPlayer()->GetItemByPos( INVENTORY_SLOT_BAG_0, slot )) + if (Item *pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) target->ToPlayer()->_ApplyItemMods(pItem, slot, !apply); } @@ -3393,7 +3393,7 @@ void AuraEffect::HandleAuraTrackCreatures(AuraApplication const * aurApp, uint8 if (target->GetTypeId() != TYPEID_PLAYER) return; - target->SetUInt32Value(PLAYER_TRACK_CREATURES, (apply) ? ((uint32)1)<<(GetMiscValue()-1) : 0 ); + target->SetUInt32Value(PLAYER_TRACK_CREATURES, (apply) ? ((uint32)1)<<(GetMiscValue()-1) : 0); } void AuraEffect::HandleAuraTrackResources(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -3406,7 +3406,7 @@ void AuraEffect::HandleAuraTrackResources(AuraApplication const * aurApp, uint8 if (target->GetTypeId() != TYPEID_PLAYER) return; - target->SetUInt32Value(PLAYER_TRACK_RESOURCES, (apply) ? ((uint32)1)<<(GetMiscValue()-1): 0 ); + target->SetUInt32Value(PLAYER_TRACK_RESOURCES, (apply) ? ((uint32)1)<<(GetMiscValue()-1): 0); } void AuraEffect::HandleAuraTrackStealthed(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -3803,7 +3803,7 @@ void AuraEffect::HandlePreventFleeing(AuraApplication const * aurApp, uint8 mode Unit * target = aurApp->GetTarget(); Unit::AuraEffectList const& fearAuras = target->GetAuraEffectsByType(SPELL_AURA_MOD_FEAR); - if ( !fearAuras.empty() ) + if (!fearAuras.empty()) target->SetControlled(!(apply), UNIT_STAT_FLEEING); } @@ -3996,7 +3996,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const * aurApp target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply); // Dragonmaw Illusion (overwrite mount model, mounted aura already applied) - if ( apply && target->HasAuraEffect(42016,0) && target->GetMountID()) + if (apply && target->HasAuraEffect(42016,0) && target->GetMountID()) target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); } } @@ -4132,14 +4132,14 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const * aurApp, uin Unit * target = aurApp->GetTarget(); // when removing flag aura, handle flag drop - if ( !(apply) && target->GetTypeId() == TYPEID_PLAYER - && (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION) ) + if (!(apply) && target->GetTypeId() == TYPEID_PLAYER + && (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION)) { if (target->GetTypeId() == TYPEID_PLAYER) { if (target->ToPlayer()->InBattleGround()) { - if ( BattleGround *bg = target->ToPlayer()->GetBattleGround() ) + if (BattleGround *bg = target->ToPlayer()->GetBattleGround()) bg->EventPlayerDroppedFlag(target->ToPlayer()); } else @@ -4178,14 +4178,14 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uin target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,GetMiscValue(),(apply)); // remove all flag auras (they are positive, but they must be removed when you are immune) - if ( GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY - && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD ) + if (GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY + && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD) target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); // TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else if ((apply) && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY - && IsPositiveSpell(GetId()) ) //Only positive immunity removes auras + && IsPositiveSpell(GetId())) //Only positive immunity removes auras { uint32 school_mask = GetMiscValue(); Unit::AuraApplicationMap& Auras = target->GetAppliedAuras(); @@ -4195,7 +4195,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uin if ((GetSpellSchoolMask(spell) & school_mask)//Check for school mask && IsDispelableBySpell(GetSpellProto(),spell->Id, true) && !iter->second->IsPositive() //Don't remove positive spells - && spell->Id != GetId() ) //Don't remove self + && spell->Id != GetId()) //Don't remove self { target->RemoveAura(iter); } @@ -4205,7 +4205,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uin } if (GetSpellProto()->Mechanic == MECHANIC_BANISH) { - if ( apply ) + if (apply) target->addUnitState(UNIT_STAT_ISOLATED); else { @@ -4391,7 +4391,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const * aurApp, uint8 mode, b for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++) { - // -1 or -2 is all stats ( misc < -2 checked in function beginning ) + // -1 or -2 is all stats (misc < -2 checked in function beginning) if (GetMiscValue() < 0 || GetMiscValue() == i) { //target->ApplyStatMod(Stats(i), m_amount,apply); @@ -4523,7 +4523,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8 { target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply); if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet()) - target->ApplyStatPercentBuffMod(Stats(i), GetAmount(), apply ); + target->ApplyStatPercentBuffMod(Stats(i), GetAmount(), apply); } } @@ -5128,7 +5128,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode, } // GetMiscValue() is bitmask of spell schools - // 1 ( 0-bit ) - normal school damage (SPELL_SCHOOL_MASK_NORMAL) + // 1 (0-bit) - normal school damage (SPELL_SCHOOL_MASK_NORMAL) // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wands // 127 - full bitmask any damages // @@ -5163,7 +5163,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode, if ((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0) return; - if ( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 ) + if (GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0) { // wand magic case (skip generic to all item spell bonuses) // done in Player::_ApplyWeaponDependentAuraMods @@ -5215,7 +5215,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint } // GetMiscValue() is bitmask of spell schools - // 1 ( 0-bit ) - normal school damage (SPELL_SCHOOL_MASK_NORMAL) + // 1 (0-bit) - normal school damage (SPELL_SCHOOL_MASK_NORMAL) // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wand // 127 - full bitmask any damages // @@ -5245,7 +5245,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint if ((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0) return; - if ( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 ) + if (GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0) { // wand magic case (skip generic to all item spell bonuses) // done in Player::_ApplyWeaponDependentAuraMods @@ -5365,7 +5365,7 @@ void AuraEffect::HandleAuraRetainComboPoints(AuraApplication const * aurApp, uin // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost) - if ( !(apply) && GetBase()->GetDuration()==0 && target->ToPlayer()->GetComboTarget()) + if (!(apply) && GetBase()->GetDuration()==0 && target->ToPlayer()->GetComboTarget()) if (Unit* unit = ObjectAccessor::GetUnit(*target,target->ToPlayer()->GetComboTarget())) target->ToPlayer()->AddComboPoints(unit, -GetAmount()); } @@ -5418,7 +5418,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo { case 1515: // Tame beast // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness - if ( caster && target->CanHaveThreatList()) + if (caster && target->CanHaveThreatList()) target->AddThreat(caster, 10.0f); break; case 13139: // net-o-matic @@ -5437,11 +5437,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo // set 3 stacks and 3 charges (to make all auras not disappear at once) Aura * owner_aura = target->GetAura(34027,GetCasterGUID()); Aura * pet_aura = pet->GetAura(58914, GetCasterGUID()); - if ( owner_aura ) + if (owner_aura) { owner_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount); } - if ( pet_aura ) + if (pet_aura) { pet_aura->SetCharges(0); pet_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount); @@ -5471,7 +5471,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo target->CastSpell(target,55166,true,NULL,this); // set 3 stacks and 3 charges (to make all auras not disappear at once) Aura * owner_aura = target->GetAura(55166,GetCasterGUID()); - if ( owner_aura ) + if (owner_aura) { // This aura lasts 2 sec, need this hack to properly proc spells // TODO: drop aura charges for ApplySpellMod in ProcDamageAndSpell @@ -5554,7 +5554,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo // AT REMOVE else { - if ( (IsQuestTameSpell(GetId())) && caster && caster->isAlive() && target->isAlive()) + if ((IsQuestTameSpell(GetId())) && caster && caster->isAlive() && target->isAlive()) { uint32 finalSpelId = 0; switch(GetId()) @@ -5648,7 +5648,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo break; case SPELLFAMILY_DRUID: // Lifebloom - if ( GetSpellProto()->SpellFamilyFlags[1] & 0x10 ) + if (GetSpellProto()->SpellFamilyFlags[1] & 0x10) { if (!apply) { @@ -5686,7 +5686,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo target->SetReducedThreatPercent(0, 0); break; case SPELLFAMILY_DEATHKNIGHT: - // Summon Gargoyle ( will start feeding gargoyle ) + // Summon Gargoyle (will start feeding gargoyle) if (GetId()==61777) target->CastSpell(target,m_spellProto->EffectTriggerSpell[m_effIndex],true); break; @@ -6009,7 +6009,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mo ItemPosCountVec dest; uint8 msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount); - if ( msg != EQUIP_ERR_OK ) + if (msg != EQUIP_ERR_OK) { count-=noSpaceForCount; plCaster->SendEquipError(msg, NULL, NULL); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 528a4ab3d4b..935b85e3384 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -399,7 +399,7 @@ void Aura::_UnapplyForTarget(Unit * target, Unit * caster, AuraApplication * aur // reset cooldown state for spells if (caster && caster->GetTypeId() == TYPEID_PLAYER) { - if ( GetSpellProto()->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE ) + if (GetSpellProto()->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE) // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases) caster->ToPlayer()->SendCooldownEvent(GetSpellProto()); } @@ -817,7 +817,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, // some auras applied at aura apply else if (itr->second->autocast) { - if ( !target->HasAura(itr->second->spellId) ) + if (!target->HasAura(itr->second->spellId)) target->CastSpell(target,itr->second->spellId,true); } } @@ -1289,7 +1289,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, { case 19574: // Bestial Wrath // The Beast Within cast on owner if talent present - if ( Unit* owner = target->GetOwner() ) + if (Unit* owner = target->GetOwner()) { // Search talent if (owner->HasAura(34692)) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 2d156744e75..2763c9b881c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -521,7 +521,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) case SPELLFAMILY_PRIEST: { // Shadow Word: Death - deals damage equal to damage done to caster - if ((m_spellInfo->SpellFamilyFlags[1] & 0x2 )) + if ((m_spellInfo->SpellFamilyFlags[1] & 0x2)) { int32 back_damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); // Pain and Suffering reduces damage @@ -960,7 +960,7 @@ void Spell::EffectDummy(uint32 i) { WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); data << uint64(unitTarget->GetGUID()); - m_originalCaster->ToPlayer()->GetSession()->SendPacket( &data ); + m_originalCaster->ToPlayer()->GetSession()->SendPacket(&data); } return; } @@ -1013,16 +1013,16 @@ void Spell::EffectDummy(uint32 i) case 23448: // Transporter Arrival - Ultrasafe Transporter: Gadgetzan - backfires { int32 r = irand(0, 119); - if ( r < 20 ) // Transporter Malfunction - 1/6 polymorph + if (r < 20) // Transporter Malfunction - 1/6 polymorph m_caster->CastSpell(m_caster, 23444, true); - else if ( r < 100 ) // Evil Twin - 4/6 evil twin + else if (r < 100) // Evil Twin - 4/6 evil twin m_caster->CastSpell(m_caster, 23445, true); else // Transporter Malfunction - 1/6 miss the target m_caster->CastSpell(m_caster, 36902, true); return; } case 23453: // Gnomish Transporter - Ultrasafe Transporter: Gadgetzan - if ( roll_chance_i(50) ) // Gadgetzan Transporter - success + if (roll_chance_i(50)) // Gadgetzan Transporter - success m_caster->CastSpell(m_caster, 23441, true); else // Gadgetzan Transporter Failure - failure m_caster->CastSpell(m_caster, 23446, true); @@ -1068,7 +1068,7 @@ void Spell::EffectDummy(uint32 i) return; case 28006: // Arcane Cloaking { - if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER ) + if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER) // Naxxramas Entry Flag Effect DND m_caster->CastSpell(unitTarget, 29294, true); return; @@ -1085,7 +1085,7 @@ void Spell::EffectDummy(uint32 i) break; case 29200: // Purify Helboar Meat { - if ( m_caster->GetTypeId() != TYPEID_PLAYER ) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = roll_chance_i(50) @@ -1465,7 +1465,7 @@ void Spell::EffectDummy(uint32 i) break; } case SPELLFAMILY_MAGE: - switch(m_spellInfo->Id ) + switch(m_spellInfo->Id) { case 11958: // Cold Snap { @@ -1478,9 +1478,9 @@ void Spell::EffectDummy(uint32 i) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - if ( spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && + if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) && - spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 ) + spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0) { m_caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true); } @@ -1491,7 +1491,7 @@ void Spell::EffectDummy(uint32 i) } case 32826: // Polymorph Cast Visual { - if ( unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT ) + if (unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT) { //Polymorph Cast Visual Rank 1 const uint32 spell_list[6] = { @@ -1502,7 +1502,7 @@ void Spell::EffectDummy(uint32 i) 32819, // Worgen Form 32820 // Sheep Form }; - unitTarget->CastSpell( unitTarget, spell_list[urand(0, 5)], true); + unitTarget->CastSpell(unitTarget, spell_list[urand(0, 5)], true); } return; } @@ -1708,7 +1708,7 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(m_caster, 63848, true); break; } - switch(m_spellInfo->Id ) + switch(m_spellInfo->Id) { case 5938: // Shiv { @@ -1799,7 +1799,7 @@ void Spell::EffectDummy(uint32 i) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && spellInfo->Id != 19574 && GetSpellRecoveryTime(spellInfo) > 0 ) + if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && spellInfo->Id != 19574 && GetSpellRecoveryTime(spellInfo) > 0) m_caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true); else ++itr; @@ -2079,7 +2079,7 @@ void Spell::EffectDummy(uint32 i) } else if (m_spellInfo->Id == 46584) // Raise dead { - if ( m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; // Do we have talent Master of Ghouls? @@ -2097,7 +2097,7 @@ void Spell::EffectDummy(uint32 i) else { targets.setDst(m_caster); - // Corpse not found - take reagents ( only not triggered cast can take them) + // Corpse not found - take reagents (only not triggered cast can take them) triggered = false; } // Remove cooldown - summon spellls have category @@ -2135,7 +2135,7 @@ void Spell::EffectDummy(uint32 i) // Set corpse look unitTarget->SetDisplayId(25537+urand(0,3)); } - // Runic Power Feed ( keeping Gargoyle alive ) + // Runic Power Feed (keeping Gargoyle alive) else if (m_spellInfo->Id == 50524) { // No power, dismiss Gargoyle @@ -2152,7 +2152,7 @@ void Spell::EffectDummy(uint32 i) //spells triggered by dummy effect should not miss if (spell_id) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry( spell_id ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) { @@ -2188,7 +2188,7 @@ void Spell::EffectTriggerSpellWithValue(uint32 i) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[i]; // normal case - SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -2205,7 +2205,7 @@ void Spell::EffectTriggerSpellWithValue(uint32 i) void Spell::EffectTriggerRitualOfSummoning(uint32 i) { uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[i]; - SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -2220,13 +2220,13 @@ void Spell::EffectTriggerRitualOfSummoning(uint32 i) void Spell::EffectForceCast(uint32 i) { - if ( !unitTarget ) + if (!unitTarget) return; uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[i]; // normal case - SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -2406,7 +2406,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex) } // normal case - SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id); if (!spellInfo) { sLog.outError("EffectTriggerSpell of spell %u: triggering unknown spell id %i", m_spellInfo->Id,triggered_spell_id); @@ -2431,7 +2431,7 @@ void Spell::EffectTriggerMissileSpell(uint32 effect_idx) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effect_idx]; // normal case - SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -2494,7 +2494,7 @@ void Spell::EffectJump(uint32 i) } else { - sLog.outError( "Spell::EffectJump - unsupported target mode for spell ID %u", m_spellInfo->Id ); + sLog.outError("Spell::EffectJump - unsupported target mode for spell ID %u", m_spellInfo->Id); return; } @@ -2518,7 +2518,7 @@ void Spell::EffectTeleportUnits(uint32 i) // If not exist data for dest location - return if (!m_targets.HasDst()) { - sLog.outError( "Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id ); + sLog.outError("Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id); return; } @@ -2544,9 +2544,9 @@ void Spell::EffectTeleportUnits(uint32 i) case 23442: { int32 r = irand(0, 119); - if ( r >= 70 ) // 7/12 success + if (r >= 70) // 7/12 success { - if ( r < 100 ) // 4/12 evil twin + if (r < 100) // 4/12 evil twin m_caster->CastSpell(m_caster, 23445, true); else // 1/12 fire m_caster->CastSpell(m_caster, 23449, true); @@ -2556,10 +2556,10 @@ void Spell::EffectTeleportUnits(uint32 i) // Ultrasafe Transporter: Toshley's Station case 36941: { - if ( roll_chance_i(50) ) // 50% success + if (roll_chance_i(50)) // 50% success { int32 rand_eff = urand(1, 7); - switch ( rand_eff ) + switch (rand_eff) { case 1: // soul split - evil @@ -2580,7 +2580,7 @@ void Spell::EffectTeleportUnits(uint32 i) case 5: // Transform { - if (m_caster->ToPlayer()->GetTeam() == ALLIANCE ) + if (m_caster->ToPlayer()->GetTeam() == ALLIANCE) m_caster->CastSpell(m_caster, 36897, true); else m_caster->CastSpell(m_caster, 36899, true); @@ -2601,10 +2601,10 @@ void Spell::EffectTeleportUnits(uint32 i) // Dimensional Ripper - Area 52 case 36890: { - if ( roll_chance_i(50) ) // 50% success + if (roll_chance_i(50)) // 50% success { int32 rand_eff = urand(1, 4); - switch ( rand_eff ) + switch (rand_eff) { case 1: // soul split - evil @@ -2621,7 +2621,7 @@ void Spell::EffectTeleportUnits(uint32 i) case 4: // Transform { - if (m_caster->ToPlayer()->GetTeam() == ALLIANCE ) + if (m_caster->ToPlayer()->GetTeam() == ALLIANCE) m_caster->CastSpell(m_caster, 36897, true); else m_caster->CastSpell(m_caster, 36899, true); @@ -2650,7 +2650,7 @@ void Spell::EffectApplyAreaAura(uint32 i) m_spellAura->_ApplyEffectForTargets(i); } -void Spell::EffectUnlearnSpecialization( uint32 i ) +void Spell::EffectUnlearnSpecialization(uint32 i) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -2660,7 +2660,7 @@ void Spell::EffectUnlearnSpecialization( uint32 i ) _player->removeSpell(spellToUnlearn); - sLog.outDebug( "Spell: Player %u has unlearned spell %u from NpcGUID: %u", _player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow() ); + sLog.outDebug("Spell: Player %u has unlearned spell %u from NpcGUID: %u", _player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow()); } void Spell::EffectPowerDrain(uint32 i) @@ -2784,13 +2784,13 @@ void Spell::EffectPowerBurn(uint32 i) unitTarget->RemoveAurasByType(SPELL_AURA_MOD_FEAR); } -void Spell::EffectHeal( uint32 /*i*/ ) +void Spell::EffectHeal(uint32 /*i*/) { } void Spell::SpellDamageHeal(uint32 /*i*/) { - if ( unitTarget && unitTarget->isAlive() && damage >= 0) + if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster; @@ -2895,9 +2895,9 @@ void Spell::SpellDamageHeal(uint32 /*i*/) } } -void Spell::EffectHealPct( uint32 /*i*/ ) +void Spell::EffectHealPct(uint32 /*i*/) { - if ( unitTarget && unitTarget->isAlive() && damage >= 0) + if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster; @@ -2919,10 +2919,10 @@ void Spell::EffectHealPct( uint32 /*i*/ ) } } -void Spell::EffectHealMechanical( uint32 /*i*/ ) +void Spell::EffectHealMechanical(uint32 /*i*/) { // Mechanic creature type should be correctly checked by targetCreatureType field - if ( unitTarget && unitTarget->isAlive() && damage >= 0) + if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster; @@ -2960,7 +2960,7 @@ void Spell::EffectHealthLeech(uint32 i) else new_damage = int32(damage*multiplier); uint32 curHealth = unitTarget->GetHealth(); - new_damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, new_damage ); + new_damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, new_damage); if (curHealth < new_damage) new_damage = curHealth; @@ -2984,10 +2984,10 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) Player* player = (Player*)unitTarget; uint32 newitemid = itemtype; - ItemPrototype const *pProto = objmgr.GetItemPrototype( newitemid ); + ItemPrototype const *pProto = objmgr.GetItemPrototype(newitemid); if (!pProto) { - player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } @@ -3048,10 +3048,10 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) // the maximum number of created additional items uint8 additionalMaxNum=0; // get the chance and maximum number for creating extra items - if ( canCreateExtraItems(player, m_spellInfo->Id, additionalCreateChance, additionalMaxNum) ) + if (canCreateExtraItems(player, m_spellInfo->Id, additionalCreateChance, additionalMaxNum)) { // roll with this chance till we roll not to create or we create the max num - while ( roll_chance_f(additionalCreateChance) && items_count<=additionalMaxNum ) + while (roll_chance_f(additionalCreateChance) && items_count<=additionalMaxNum) ++items_count; } @@ -3061,16 +3061,16 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) // can the player store the new item? ItemPosCountVec dest; uint32 no_space = 0; - uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space ); - if ( msg != EQUIP_ERR_OK ) + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space); + if (msg != EQUIP_ERR_OK) { // convert to possible store amount - if ( msg == EQUIP_ERR_INVENTORY_FULL || msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) + if (msg == EQUIP_ERR_INVENTORY_FULL || msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) num_to_add -= no_space; else { // if not created by another reason from full inventory or unique items amount limitation - player->SendEquipError( msg, NULL, NULL ); + player->SendEquipError(msg, NULL, NULL); return; } } @@ -3078,12 +3078,12 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) if (num_to_add) { // create the new item and store it - Item* pItem = player->StoreNewItem( dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid)); + Item* pItem = player->StoreNewItem(dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid)); // was it successful? return error if not if (!pItem) { - player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } @@ -3374,7 +3374,7 @@ void Spell::EffectOpenLock(uint32 effIndex) { if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) { - sLog.outDebug( "WORLD: Open Lock - No Player Caster!"); + sLog.outDebug("WORLD: Open Lock - No Player Caster!"); return; } @@ -3388,8 +3388,8 @@ void Spell::EffectOpenLock(uint32 effIndex) { GameObjectInfo const* goInfo = gameObjTarget->GetGOInfo(); // Arathi Basin banner opening ! - if ( goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune || - goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK ) + if (goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune || + goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK) { //CanUseBattleGroundObject() already called in CheckCast() // in battleground check @@ -3428,7 +3428,7 @@ void Spell::EffectOpenLock(uint32 effIndex) } else { - sLog.outDebug( "WORLD: Open Lock - No GameObject/Item Target!"); + sLog.outDebug("WORLD: Open Lock - No GameObject/Item Target!"); return; } @@ -3454,9 +3454,9 @@ void Spell::EffectOpenLock(uint32 effIndex) if (gameObjTarget) { // Allow one skill-up until respawned - if ( !gameObjTarget->IsInSkillupList( player->GetGUIDLow() ) && - player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue) ) - gameObjTarget->AddToSkillupList( player->GetGUIDLow() ); + if (!gameObjTarget->IsInSkillupList(player->GetGUIDLow()) && + player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue)) + gameObjTarget->AddToSkillupList(player->GetGUIDLow()); } else if (itemTarget) { @@ -3505,7 +3505,7 @@ void Spell::EffectSummonChangeItem(uint32 i) if (player->IsInventoryPos(pos)) { ItemPosCountVec dest; - uint8 msg = player->CanStoreItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true ); + uint8 msg = player->CanStoreItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true); if (msg == EQUIP_ERR_OK) { player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); @@ -3780,7 +3780,7 @@ void Spell::EffectDispel(uint32 i) // Create dispel mask by dispel type uint32 dispel_type = m_spellInfo->EffectMiscValue[i]; - uint32 dispelMask = GetDispellMask( DispelType(dispel_type)); + uint32 dispelMask = GetDispellMask(DispelType(dispel_type)); Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { @@ -4060,7 +4060,7 @@ void Spell::EffectEnchantItemPerm(uint32 effect_idx) if (!item_owner) return; - if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) + if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(),p_caster->GetSession()->GetAccountId(), @@ -4119,7 +4119,7 @@ void Spell::EffectEnchantItemPrismatic(uint32 effect_idx) if (!item_owner) return; - if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) + if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(),p_caster->GetSession()->GetAccountId(), @@ -4188,7 +4188,7 @@ void Spell::EffectEnchantItemTmp(uint32 i) { Spell *spell = new Spell(m_caster, spellInfo, true); SpellCastTargets targets; - targets.setItemTarget( item ); + targets.setItemTarget(item); spell->prepare(&targets); } } @@ -4247,7 +4247,7 @@ void Spell::EffectEnchantItemTmp(uint32 i) if (!item_owner) return; - if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) + if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(), p_caster->GetSession()->GetAccountId(), @@ -4361,7 +4361,7 @@ void Spell::EffectSummonPet(uint32 i) //OldSummon->SetMap(owner->GetMap()); //owner->GetMap()->Add(OldSummon->ToCreature()); - if (owner->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled() ) + if (owner->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled()) owner->ToPlayer()->PetSpellInitialize(); return; @@ -4694,7 +4694,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i) } float weapon_total_pct = 1.0f; - if ( m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL ) + if (m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL) weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT); if (fixed_bonus) @@ -4794,7 +4794,7 @@ void Spell::EffectInterruptCast(uint32 i) // check if we can interrupt spell if ((spell->getState() == SPELL_STATE_CASTING || spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f) - && curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE ) + && curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) { if (m_originalCaster) { @@ -4814,7 +4814,7 @@ void Spell::EffectSummonObjectWild(uint32 i) GameObject* pGameObj = new GameObject; WorldObject* target = focusObject; - if ( !target ) + if (!target) target = m_caster; float x, y, z; @@ -5145,7 +5145,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 29830: { uint32 item = 0; - switch ( urand(1, 6) ) + switch (urand(1, 6)) { case 1: case 2: @@ -5808,7 +5808,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) default: return; } - DoCreateItem( effIndex, itemtype ); + DoCreateItem(effIndex, itemtype); return; } // Everlasting Affliction @@ -6097,7 +6097,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case SPELLFAMILY_DEATHKNIGHT: { // Pestilence - if ( m_spellInfo->SpellFamilyFlags[1]&0x10000 ) + if (m_spellInfo->SpellFamilyFlags[1]&0x10000) { // Get diseases on target of spell if (m_targets.getUnitTarget() && // Glyph of Disease - cast on unit target too to refresh aura @@ -6195,27 +6195,27 @@ void Spell::EffectDuel(uint32 i) Player *target = (Player*)unitTarget; // caster or target already have requested duel - if ( caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow()) ) + if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow())) return; // Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities) // Don't have to check the target's map since you cannot challenge someone across maps if (caster->GetMap()->Instanceable()) - //if ( mapid != 0 && mapid != 1 && mapid != 530 && mapid != 571 && mapid != 609) + //if (mapid != 0 && mapid != 1 && mapid != 530 && mapid != 571 && mapid != 609) { SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here return; } AreaTableEntry const* casterAreaEntry = GetAreaEntryByAreaID(caster->GetZoneId()); - if (casterAreaEntry && (casterAreaEntry->flags & AREA_FLAG_CAPITAL) ) + if (casterAreaEntry && (casterAreaEntry->flags & AREA_FLAG_CAPITAL)) { SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here return; } AreaTableEntry const* targetAreaEntry = GetAreaEntryByAreaID(target->GetZoneId()); - if (targetAreaEntry && (targetAreaEntry->flags & AREA_FLAG_CAPITAL) ) + if (targetAreaEntry && (targetAreaEntry->flags & AREA_FLAG_CAPITAL)) { SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here return; @@ -6238,8 +6238,8 @@ void Spell::EffectDuel(uint32 i) return; } - pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction() ); - pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()+1 ); + pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction()); + pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()+1); int32 duration = GetSpellDuration(m_spellInfo); pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); pGameObj->SetSpellId(m_spellInfo->Id); @@ -6389,7 +6389,7 @@ void Spell::EffectEnchantHeldItem(uint32 i) Player* item_owner = (Player*)unitTarget; Item* item = item_owner->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); - if (!item ) + if (!item) return; // must be equipped @@ -6514,7 +6514,7 @@ void Spell::EffectSummonObject(uint32 i) if (guid != 0) { GameObject* obj = NULL; - if ( m_caster ) + if (m_caster) obj = m_caster->GetMap()->GetGameObject(guid); if (obj) @@ -6607,14 +6607,14 @@ void Spell::EffectAddExtraAttacks(uint32 /*i*/) if (!unitTarget || !unitTarget->isAlive()) return; - if ( unitTarget->m_extraAttacks ) + if (unitTarget->m_extraAttacks) return; Unit *victim = unitTarget->getVictim(); // attack prevented // fixme, some attacks may not target current victim, this is right now not handled - if (!victim || !unitTarget->IsWithinMeleeRange(victim) || !unitTarget->HasInArc( 2*M_PI/3, victim )) + if (!victim || !unitTarget->IsWithinMeleeRange(victim) || !unitTarget->HasInArc(2*M_PI/3, victim)) return; // Only for proc/log informations @@ -6759,17 +6759,17 @@ void Spell::EffectSelfResurrect(uint32 i) Player *plr = unitTarget->ToPlayer(); plr->ResurrectPlayer(0.0f); - plr->SetHealth( health ); - plr->SetPower(POWER_MANA, mana ); - plr->SetPower(POWER_RAGE, 0 ); - plr->SetPower(POWER_ENERGY, plr->GetMaxPower(POWER_ENERGY) ); + plr->SetHealth(health); + plr->SetPower(POWER_MANA, mana); + plr->SetPower(POWER_RAGE, 0); + plr->SetPower(POWER_ENERGY, plr->GetMaxPower(POWER_ENERGY)); plr->SpawnCorpseBones(); } void Spell::EffectSkinning(uint32 /*i*/) { - if (unitTarget->GetTypeId() != TYPEID_UNIT ) + if (unitTarget->GetTypeId() != TYPEID_UNIT) return; if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) return; @@ -6787,7 +6787,7 @@ void Spell::EffectSkinning(uint32 /*i*/) int32 skillValue = m_caster->ToPlayer()->GetPureSkillValue(skill); // Double chances for elites - m_caster->ToPlayer()->UpdateGatherSkill(skill, skillValue, reqValue, creature->isElite() ? 2 : 1 ); + m_caster->ToPlayer()->UpdateGatherSkill(skill, skillValue, reqValue, creature->isElite() ? 2 : 1); } void Spell::EffectCharge(uint32 /*i*/) @@ -6804,7 +6804,7 @@ void Spell::EffectCharge(uint32 /*i*/) m_caster->GetMotionMaster()->MoveCharge(x, y, z); // not all charge effects used in negative spells - if ( !IsPositiveSpell(m_spellInfo->Id) && m_caster->GetTypeId() == TYPEID_PLAYER) + if (!IsPositiveSpell(m_spellInfo->Id) && m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->Attack(target, true); } @@ -6917,7 +6917,7 @@ void Spell::EffectDispelMechanic(uint32 i) continue; if ((GetAllSpellMechanicMask(aura->GetSpellProto()) & (1<<(mechanic))) && GetDispelChance(aura->GetCaster(), aura->GetId())) { - dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID() ) ); + dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID())); } } @@ -6946,9 +6946,9 @@ void Spell::EffectSummonDeadPet(uint32 /*i*/) pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); pet->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - pet->setDeathState( ALIVE ); + pet->setDeathState(ALIVE); pet->clearUnitState(UNIT_STAT_ALL_STATE); - pet->SetHealth( uint32(pet->GetMaxHealth()*(float(damage)/100))); + pet->SetHealth(uint32(pet->GetMaxHealth()*(float(damage)/100))); //pet->AIM_Initialize(); //_player->PetSpellInitialize(); @@ -7080,7 +7080,7 @@ void Spell::EffectTransmitted(uint32 effIndex) fx = 36.69+irand(-8,8);//random place for the bobber fy = -416.38+irand(-8,8); fz = -19.9645;//serpentshrine water level - }else if ( !cMap->IsInWater(fx, fy, fz-0.5f, 0.5f)) // Hack to prevent fishing bobber from failing to land on fishing hole + }else if (!cMap->IsInWater(fx, fy, fz-0.5f, 0.5f)) // Hack to prevent fishing bobber from failing to land on fishing hole { // but this is not proper, we really need to ignore not materialized objects SendCastResult(SPELL_FAILED_NOT_HERE); SendChannelUpdate(0); @@ -7194,7 +7194,7 @@ void Spell::EffectProspecting(uint32 /*i*/) if (itemTarget->GetCount() < 5) return; - if ( sWorld.getConfig(CONFIG_SKILL_PROSPECTING)) + if (sWorld.getConfig(CONFIG_SKILL_PROSPECTING)) { uint32 SkillValue = p_caster->GetPureSkillValue(SKILL_JEWELCRAFTING); uint32 reqSkillValue = itemTarget->GetProto()->RequiredSkillRank; @@ -7216,7 +7216,7 @@ void Spell::EffectMilling(uint32 /*i*/) if (itemTarget->GetCount() < 5) return; - if ( sWorld.getConfig(CONFIG_SKILL_MILLING)) + if (sWorld.getConfig(CONFIG_SKILL_MILLING)) { uint32 SkillValue = p_caster->GetPureSkillValue(SKILL_INSCRIPTION); uint32 reqSkillValue = itemTarget->GetProto()->RequiredSkillRank; @@ -7256,10 +7256,10 @@ void Spell::EffectSpiritHeal(uint32 /*i*/) void Spell::EffectSkinPlayerCorpse(uint32 /*i*/) { sLog.outDebug("Effect: SkinPlayerCorpse"); - if ( (m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->isAlive()) ) + if ((m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->isAlive())) return; - unitTarget->ToPlayer()->RemovedInsignia( (Player*)m_caster ); + unitTarget->ToPlayer()->RemovedInsignia((Player*)m_caster); } void Spell::EffectStealBeneficialBuff(uint32 i) @@ -7271,7 +7271,7 @@ void Spell::EffectStealBeneficialBuff(uint32 i) Unit::AuraList steal_list; // Create dispel mask by dispel type - uint32 dispelMask = GetDispellMask( DispelType(m_spellInfo->EffectMiscValue[i]) ); + uint32 dispelMask = GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i])); Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { @@ -7651,7 +7651,7 @@ void Spell::EffectRechargeManaGem(uint32 i) ItemPrototype const *pProto = objmgr.GetItemPrototype(item_id); if (!pProto) { - player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 6f937ad615c..5125ec18b6c 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -121,7 +121,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (!pItem->IsSoulBound()) { pItem->SetState(ITEM_CHANGED, pUser); - pItem->SetBinding( true ); + pItem->SetBinding(true); } } @@ -182,14 +182,14 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) Item *pItem = pUser->GetItemByPos(bagIndex, slot); if (!pItem) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } ItemPrototype const *proto = pItem->GetProto(); if (!proto) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); return; } @@ -204,7 +204,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!lockInfo) { - pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL); sLog.outError("WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", pItem->GetGUIDLow(), lockId); return; } @@ -212,7 +212,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) // required picklocking if (lockInfo->Skill[1] || lockInfo->Skill[0]) { - pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL); return; } } @@ -243,13 +243,13 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) pUser->SendLoot(pItem->GetGUID(),LOOT_CORPSE); } -void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGameObjectUseOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; - sLog.outDebug( "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); + sLog.outDebug("WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); // ignore for remote control state if (_player->m_mover != _player) @@ -305,7 +305,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i", spellId, cast_count, unk_flags, (uint32)recvPacket.size()); - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) { @@ -317,7 +317,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) if (mover->GetTypeId() == TYPEID_PLAYER) { // not have spell in spellbook or spell passive and not casted by client - if (!mover->ToPlayer()->HasActiveSpell (spellId) || IsPassiveSpell(spellId) ) + if (!mover->ToPlayer()->HasActiveSpell (spellId) || IsPassiveSpell(spellId)) { //cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet @@ -398,7 +398,7 @@ void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket) _player->InterruptNonMeleeSpells(false,spellId,false); } -void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) +void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) { uint32 spellId; recvPacket >> spellId; @@ -425,7 +425,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) _player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL); } -void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket) +void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) { uint64 guid; uint32 spellId; @@ -433,7 +433,7 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket) recvPacket >> guid; recvPacket >> spellId; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) { sLog.outError("WORLD: unknown PET spell id %u", spellId); @@ -444,13 +444,13 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket) if (!pet) { - sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid)) ); + sLog.outError("Pet %u not exist.", uint32(GUID_LOPART(guid))); return; } if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm()) { - sLog.outError( "HandlePetCancelAura.Pet %u isn't pet of player %s", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() ); + sLog.outError("HandlePetCancelAura.Pet %u isn't pet of player %s", uint32(GUID_LOPART(guid)),GetPlayer()->GetName()); return; } @@ -465,18 +465,18 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket) pet->AddCreatureSpellCooldown(spellId); } -void WorldSession::HandleCancelGrowthAuraOpcode( WorldPacket& /*recvPacket*/) +void WorldSession::HandleCancelGrowthAuraOpcode(WorldPacket& /*recvPacket*/) { } -void WorldSession::HandleCancelAutoRepeatSpellOpcode( WorldPacket& /*recvPacket*/) +void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPacket& /*recvPacket*/) { // may be better send SMSG_CANCEL_AUTO_REPEAT? // cancel and prepare for deleting _player->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); } -void WorldSession::HandleCancelChanneling( WorldPacket & recv_data) +void WorldSession::HandleCancelChanneling(WorldPacket & recv_data) { recv_data.read_skip<uint32>(); // spellid, not used @@ -488,7 +488,7 @@ void WorldSession::HandleCancelChanneling( WorldPacket & recv_data) mover->InterruptSpell(CURRENT_CHANNELED_SPELL); } -void WorldSession::HandleTotemDestroyed( WorldPacket& recvPacket) +void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket) { // ignore for remote control state if (_player->m_mover != _player) @@ -511,7 +511,7 @@ void WorldSession::HandleTotemDestroyed( WorldPacket& recvPacket) totem->ToTotem()->UnSummon(); } -void WorldSession::HandleSelfResOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleSelfResOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("WORLD: CMSG_SELF_RES"); // empty opcode @@ -525,7 +525,7 @@ void WorldSession::HandleSelfResOpcode( WorldPacket & /*recv_data*/ ) } } -void WorldSession::HandleSpellClick( WorldPacket & recv_data ) +void WorldSession::HandleSpellClick(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; @@ -565,7 +565,7 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data ) unit->AI()->DoAction(EVENT_SPELLCLICK); } -void WorldSession::HandleMirrrorImageDataRequest( WorldPacket & recv_data ) +void WorldSession::HandleMirrrorImageDataRequest(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_GET_MIRRORIMAGE_DATA"); uint64 guid; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 011b8c0e13d..492fa1e2bf4 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -297,7 +297,7 @@ bool GetDispelChance(Unit* caster, uint32 spellId) // Apply dispel mod from aura caster if (caster) { - if ( Player* modOwner = caster->GetSpellModOwner() ) + if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance); } // Try dispel @@ -403,7 +403,7 @@ uint32 CalculatePowerCost(SpellEntry const * spellInfo, Unit const * caster, Spe // Flat mod from caster auras by spell school powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school); // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost) - if ( spellInfo->AttributesEx4 & SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST ) + if (spellInfo->AttributesEx4 & SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST) powerCost += caster->GetAttackTime(OFF_ATTACK)/100; // Apply cost mod by spell if (Player* modOwner = caster->GetSpellModOwner()) @@ -461,7 +461,7 @@ AuraState GetSpellAuraState(SpellEntry const * spellInfo) return AURA_STATE_WARRIOR_VICTORY_RUSH; // Swiftmend state on Regrowth & Rejuvenation - if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && spellInfo->SpellFamilyFlags[0] & 0x50 ) + if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && spellInfo->SpellFamilyFlags[0] & 0x50) return AURA_STATE_SWIFTMEND; // Deadly poison aura state @@ -597,7 +597,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo) return SPELL_SPECIFIC_STING; // only hunter aspects have this (but not all aspects in hunter family) - if ( spellInfo->SpellFamilyFlags.HasFlag(0x00380000, 0x00440000, 0x00001010)) + if (spellInfo->SpellFamilyFlags.HasFlag(0x00380000, 0x00440000, 0x00001010)) return SPELL_SPECIFIC_ASPECT; break; @@ -615,7 +615,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo) return SPELL_SPECIFIC_JUDGEMENT; // only paladin auras have this (for palaldin class family) - if ( spellInfo->SpellFamilyFlags[2] & 0x00000020 ) + if (spellInfo->SpellFamilyFlags[2] & 0x00000020) return SPELL_SPECIFIC_AURA; break; @@ -973,7 +973,7 @@ bool SpellMgr::_isPositiveSpell(uint32 spellId, bool deep) const bool IsSingleTargetSpell(SpellEntry const *spellInfo) { // all other single target spells have if it has AttributesEx5 - if ( spellInfo->AttributesEx5 & SPELL_ATTR_EX5_SINGLE_TARGET_SPELL ) + if (spellInfo->AttributesEx5 & SPELL_ATTR_EX5_SINGLE_TARGET_SPELL) return true; switch(GetSpellSpecific(spellInfo)) @@ -991,8 +991,8 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI { // TODO - need better check // Equal icon and spellfamily - if ( spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName && - spellInfo1->SpellIconID == spellInfo2->SpellIconID ) + if (spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName && + spellInfo1->SpellIconID == spellInfo2->SpellIconID) return true; // TODO - need found Judgements rule @@ -1016,8 +1016,8 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 { // talents that learn spells can have stance requirements that need ignore // (this requirement only for client-side stance show in talent description) - if ( GetTalentSpellCost(spellInfo->Id) > 0 && - (spellInfo->Effect[0]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[1]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[2]==SPELL_EFFECT_LEARN_SPELL) ) + if (GetTalentSpellCost(spellInfo->Id) > 0 && + (spellInfo->Effect[0]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[1]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[2]==SPELL_EFFECT_LEARN_SPELL)) return SPELL_CAST_OK; uint32 stanceMask = (form ? 1 << (form - 1) : 0); @@ -1075,19 +1075,19 @@ void SpellMgr::LoadSpellTargetPositions() // 0 1 2 3 4 5 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell target coordinates", count ); + sLog.outString(">> Loaded %u spell target coordinates", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -1115,7 +1115,7 @@ void SpellMgr::LoadSpellTargetPositions() bool found = false; for (int i = 0; i < 3; ++i) { - if ( spellInfo->EffectImplicitTargetA[i]==TARGET_DST_DB || spellInfo->EffectImplicitTargetB[i]==TARGET_DST_DB ) + if (spellInfo->EffectImplicitTargetA[i]==TARGET_DST_DB || spellInfo->EffectImplicitTargetB[i]==TARGET_DST_DB) { found = true; break; @@ -1143,7 +1143,7 @@ void SpellMgr::LoadSpellTargetPositions() mSpellTargetPositions[Spell_ID] = st; ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); // Check all spells for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) @@ -1180,7 +1180,7 @@ void SpellMgr::LoadSpellTargetPositions() } sLog.outString(); - sLog.outString( ">> Loaded %u spell teleport coordinates", count ); + sLog.outString(">> Loaded %u spell teleport coordinates", count); } bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const @@ -1209,16 +1209,16 @@ void SpellMgr::LoadSpellProcEvents() // 0 1 2 3 4 5 6 7 8 9 10 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell proc event conditions", count ); + sLog.outString(">> Loaded %u spell proc event conditions", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); uint32 customProc = 0; do { @@ -1260,13 +1260,13 @@ void SpellMgr::LoadSpellProcEvents() customProc++; } ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); if (customProc) - sLog.outString( ">> Loaded %u extra spell proc event conditions + %u custom", count, customProc ); + sLog.outString(">> Loaded %u extra spell proc event conditions + %u custom", count, customProc); else - sLog.outString( ">> Loaded %u extra spell proc event conditions", count ); + sLog.outString(">> Loaded %u extra spell proc event conditions", count); } void SpellMgr::LoadSpellBonusess() @@ -1275,16 +1275,16 @@ void SpellMgr::LoadSpellBonusess() uint32 count = 0; // 0 1 2 3 4 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell bonus data", count); + sLog.outString(">> Loaded %u spell bonus data", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { Field *fields = result->Fetch(); @@ -1307,10 +1307,10 @@ void SpellMgr::LoadSpellBonusess() mSpellBonusMap[entry] = sbe; ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u extra spell bonus data", count); + sLog.outString(">> Loaded %u extra spell bonus data", count); } bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra, bool active) @@ -1395,7 +1395,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr // spellFamilyName is Ok need check for spellFamilyMask if present if (spellProcEvent->spellFamilyMask) { - if ((spellProcEvent->spellFamilyMask & procSpell->SpellFamilyFlags ) == 0) + if ((spellProcEvent->spellFamilyMask & procSpell->SpellFamilyFlags) == 0) return false; hasFamilyMask = true; // Some spells are not considered as active even with have spellfamilyflags @@ -1451,19 +1451,19 @@ void SpellMgr::LoadSpellGroups() // 0 1 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell group definitions", count ); + sLog.outString(">> Loaded %u spell group definitions", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); std::set<uint32> groups; @@ -1484,9 +1484,9 @@ void SpellMgr::LoadSpellGroups() groups.insert(std::set<uint32>::value_type(group_id)); mSpellGroupSpell.insert(SpellGroupSpellMap::value_type((SpellGroup)group_id, spell_id)); - } while ( result->NextRow() ); + } while (result->NextRow()); - for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr!= mSpellGroupSpell.end() ; ) + for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr!= mSpellGroupSpell.end() ;) { if (itr->second < 0) { @@ -1530,7 +1530,7 @@ void SpellMgr::LoadSpellGroups() } sLog.outString(); - sLog.outString( ">> Loaded %u spell group definitions", count ); + sLog.outString(">> Loaded %u spell group definitions", count); } void SpellMgr::LoadSpellGroupStackRules() @@ -1541,19 +1541,19 @@ void SpellMgr::LoadSpellGroupStackRules() // 0 1 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules"); - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell group stack rules", count ); + sLog.outString(">> Loaded %u spell group stack rules", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -1580,10 +1580,10 @@ void SpellMgr::LoadSpellGroupStackRules() mSpellGroupStack[(SpellGroup)group_id] = (SpellGroupStackRule)stack_rule; ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u spell group stack rules", count ); + sLog.outString(">> Loaded %u spell group stack rules", count); } void SpellMgr::LoadSpellThreats() @@ -1602,7 +1602,7 @@ void SpellMgr::LoadSpellThreats() bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u aggro generating spells", count ); + sLog.outString(">> Loaded %u aggro generating spells", count); return; } @@ -1629,7 +1629,7 @@ void SpellMgr::LoadSpellThreats() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u aggro generating spells", count ); + sLog.outString(">> Loaded %u aggro generating spells", count); } bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const @@ -1770,11 +1770,11 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell bool needRankSelection = false; for (int i=0; i<3; ++i) { - if ( IsPositiveEffect(spellInfo->Id, i) && ( + if (IsPositiveEffect(spellInfo->Id, i) && ( spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID - ) ) +)) { needRankSelection = true; break; @@ -1839,7 +1839,7 @@ void SpellMgr::LoadSpellLearnSkills() } sLog.outString(); - sLog.outString( ">> Loaded %u Spell Learn Skills from DBC", dbc_count ); + sLog.outString(">> Loaded %u Spell Learn Skills from DBC", dbc_count); } void SpellMgr::LoadSpellLearnSpells() @@ -1854,7 +1854,7 @@ void SpellMgr::LoadSpellLearnSpells() bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 spell learn spells" ); + sLog.outString(">> Loaded 0 spell learn spells"); sLog.outErrorDb("`spell_learn_spell` table is empty!"); return; } @@ -1947,7 +1947,7 @@ void SpellMgr::LoadSpellLearnSpells() } sLog.outString(); - sLog.outString( ">> Loaded %u spell learn spells + %u found in DBC", count, dbc_count ); + sLog.outString(">> Loaded %u spell learn spells + %u found in DBC", count, dbc_count); } void SpellMgr::LoadSpellScriptTarget() @@ -2133,7 +2133,7 @@ void SpellMgr::LoadSpellPetAuras() bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell pet auras", count); + sLog.outString(">> Loaded %u spell pet auras", count); return; } @@ -2184,7 +2184,7 @@ void SpellMgr::LoadSpellPetAuras() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u spell pet auras", count ); + sLog.outString(">> Loaded %u spell pet auras", count); } void SpellMgr::LoadPetLevelupSpellMap() @@ -2243,7 +2243,7 @@ void SpellMgr::LoadPetLevelupSpellMap() } sLog.outString(); - sLog.outString( ">> Loaded %u pet levelup and default spells for %u families", count, family_count ); + sLog.outString(">> Loaded %u pet levelup and default spells for %u families", count, family_count); } bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntry& petDefSpells) @@ -2372,8 +2372,8 @@ void SpellMgr::LoadPetDefaultSpells() } sLog.outString(); - sLog.outString( ">> Loaded addition spells for %u pet spell data entries.", countData ); - sLog.outString( ">> Loaded %u summonable creature templates.", countCreature ); + sLog.outString(">> Loaded addition spells for %u pet spell data entries.", countData); + sLog.outString(">> Loaded %u summonable creature templates.", countCreature); } /// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc @@ -2673,7 +2673,7 @@ void SpellMgr::LoadSpellAreas() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u spell area requirements", count ); + sLog.outString(">> Loaded %u spell area requirements", count); } SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player) @@ -3238,7 +3238,7 @@ void SpellMgr::LoadSpellEnchantProcData() bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell enchant proc event conditions", count ); + sLog.outString(">> Loaded %u spell enchant proc event conditions", count); return; } @@ -3270,7 +3270,7 @@ void SpellMgr::LoadSpellEnchantProcData() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u enchant proc data definitions", count); + sLog.outString(">> Loaded %u enchant proc data definitions", count); } void SpellMgr::LoadSpellRequired() @@ -3330,7 +3330,7 @@ void SpellMgr::LoadSpellRequired() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u spell required records", rows ); + sLog.outString(">> Loaded %u spell required records", rows); } void SpellMgr::LoadSpellRanks() @@ -3444,7 +3444,7 @@ void SpellMgr::LoadSpellRanks() } while (!finished); sLog.outString(); - sLog.outString( ">> Loaded %u spell rank records", rows ); + sLog.outString(">> Loaded %u spell rank records", rows); } // set data in core for now @@ -3854,7 +3854,7 @@ void SpellMgr::LoadSpellCustomAttr() CreatureAI::FillAISpellInfo(); sLog.outString(); - sLog.outString(">> Loaded %u custom spell attributes", count ); + sLog.outString(">> Loaded %u custom spell attributes", count); } // Fill custom data about enchancments @@ -3898,7 +3898,7 @@ void SpellMgr::LoadEnchantCustomAttr() } sLog.outString(); - sLog.outString( ">> Loaded %u custom enchant attributes", count ); + sLog.outString(">> Loaded %u custom enchant attributes", count); } bool SpellMgr::IsSkillTypeSpell(uint32 spellId, SkillType type) const @@ -3924,11 +3924,11 @@ void SpellMgr::LoadSpellLinked() barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u linked spells", count ); + sLog.outString(">> Loaded %u linked spells", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -3977,8 +3977,8 @@ void SpellMgr::LoadSpellLinked() mSpellLinkedMap[trigger].push_back(effect); ++count; - } while ( result->NextRow() ); + } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u linked spells", count ); + sLog.outString(">> Loaded %u linked spells", count); } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 56108fd289b..af9b669af78 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -267,8 +267,8 @@ inline bool IsSealSpell(SpellEntry const *spellInfo) { //Collection of all the seal family flags. No other paladin spell has any of those. return spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && - ( spellInfo->SpellFamilyFlags[1] & 0x26000C00 - || spellInfo->SpellFamilyFlags[0] & 0x0A000000 ); + (spellInfo->SpellFamilyFlags[1] & 0x26000C00 + || spellInfo->SpellFamilyFlags[0] & 0x0A000000); } inline bool IsElementalShield(SpellEntry const *spellInfo) @@ -392,7 +392,7 @@ inline bool IsAreaOfEffectSpell(SpellEntry const *spellInfo) inline bool IsAreaAuraEffect(uint32 effect) { - if ( effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || + if (effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID || effect == SPELL_EFFECT_APPLY_AREA_AURA_FRIEND || effect == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY || @@ -546,8 +546,8 @@ enum ProcFlags PROC_FLAG_TAKEN_ANY_DAMAGE = 0x00100000, // 20 Taken any damage PROC_FLAG_ON_TRAP_ACTIVATION = 0x00200000, // 21 On trap activation (possibly needs name change to ON_GAMEOBJECT_CAST or USE) - PROC_FLAG_TAKEN_OFFHAND_HIT = 0x00400000, // 22 Taken off-hand melee attacks ( this is probably wrong ) - PROC_FLAG_SUCCESSFUL_OFFHAND_HIT = 0x00800000, // 23 Successful off-hand melee attacks ( this is probably wrong ) + PROC_FLAG_TAKEN_OFFHAND_HIT = 0x00400000, // 22 Taken off-hand melee attacks (this is probably wrong) + PROC_FLAG_SUCCESSFUL_OFFHAND_HIT = 0x00800000, // 23 Successful off-hand melee attacks (this is probably wrong) PROC_FLAG_DEATH = 0x01000000 // 24 Died in any way }; @@ -748,7 +748,7 @@ struct SpellArea uint32 areaId; // zone/subzone/or 0 is not limited to zone uint32 questStart; // quest start (quest must be active or rewarded for spell apply) uint32 questEnd; // quest end (quest don't must be rewarded for spell apply) - int32 auraSpell; // spell aura must be applied for spell apply )if possitive) and it don't must be applied in other case + int32 auraSpell; // spell aura must be applied for spell apply)if possitive) and it don't must be applied in other case uint32 raceMask; // can be applied only to races Gender gender; // can be applied only to gender bool questStartCanActive; // if true then quest start can be active (not only rewarded) @@ -885,7 +885,7 @@ class SpellMgr uint32 IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const { SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellid); - for ( SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr) + for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr) { if (itr->second == groupid) return true; @@ -909,7 +909,7 @@ class SpellMgr usedGroups.insert(group_id); SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(group_id); - for ( SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second ; ++itr) + for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second ; ++itr) { if (itr->second < 0) { @@ -932,13 +932,13 @@ class SpellMgr // find SpellGroups which are common for both spells SpellSpellGroupMapBounds spellGroup1 = GetSpellSpellGroupMapBounds(spellid_1); std::set<SpellGroup> groups; - for ( SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second ; ++itr) + for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second ; ++itr) { if (IsSpellMemberOfSpellGroup(spellid_2, itr->second)) { bool add = true; SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(itr->second); - for ( SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second ; ++itr2) + for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second ; ++itr2) { if (itr2->second < 0) { @@ -981,17 +981,17 @@ class SpellMgr SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const { SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId); - if ( itr != mSpellProcEventMap.end( ) ) + if (itr != mSpellProcEventMap.end()) return &itr->second; return NULL; } - bool IsSpellProcEventCanTriggeredBy( SpellProcEventEntry const * spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra, bool active); + bool IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const * spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra, bool active); SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const { SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId); - if ( itr != mSpellEnchantProcEventMap.end( ) ) + if (itr != mSpellEnchantProcEventMap.end()) return &itr->second; return NULL; } @@ -1001,13 +1001,13 @@ class SpellMgr { // Lookup data SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId); - if ( itr != mSpellBonusMap.end( ) ) + if (itr != mSpellBonusMap.end()) return &itr->second; // Not found, try lookup for 1 spell rank if exist if (uint32 rank_1 = GetFirstSpellInChain(spellId)) { SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1); - if ( itr2 != mSpellBonusMap.end( ) ) + if (itr2 != mSpellBonusMap.end()) return &itr2->second; } return NULL; @@ -1016,8 +1016,8 @@ class SpellMgr // Spell target coordinates SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id) const { - SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find( spell_id ); - if ( itr != mSpellTargetPositions.end( ) ) + SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id); + if (itr != mSpellTargetPositions.end()) return &itr->second; return NULL; } diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index ab45859c722..2a7ec56372b 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -260,7 +260,7 @@ void Player::ApplyFeralAPBonus(int32 amount, bool apply) UpdateAttackPowerAndDamage(); } -void Player::UpdateAttackPowerAndDamage(bool ranged ) +void Player::UpdateAttackPowerAndDamage(bool ranged) { float val2 = 0.0f; float level = float(getLevel()); @@ -358,7 +358,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE); //add dynamic flat mods - if ( ranged ) + if (ranged) { if ((getClassMask() & CLASSMASK_WAND_USERS)==0) { @@ -1115,7 +1115,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged) val = 2 * GetStat(STAT_STRENGTH) - 20.0f; Unit* owner = GetOwner(); - if ( owner && owner->GetTypeId() == TYPEID_PLAYER) + if (owner && owner->GetTypeId() == TYPEID_PLAYER) { if (isHunterPet()) //hunter pets benefit from owner's attack power { @@ -1135,12 +1135,12 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged) } } bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod; - SetBonusDamage( int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod)); + SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod)); } else if (IsPetGhoul()) //ghouls benefit from deathknight's attack power (may be summon pet or not) { bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.22f; - SetBonusDamage( int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.1287f)); + SetBonusDamage(int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.1287f)); } //demons benefit from warlocks shadow or fire damage else if (isPet()) @@ -1150,7 +1150,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged) int32 maximum = (fire > shadow) ? fire : shadow; if (maximum < 0) maximum = 0; - SetBonusDamage( int32(maximum * 0.15f)); + SetBonusDamage(int32(maximum * 0.15f)); bonusAP = maximum * 0.57f; } //water elementals benefit from mage's frost damage @@ -1159,7 +1159,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged) int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST); if (frost < 0) frost = 0; - SetBonusDamage( int32(frost * 0.4f)); + SetBonusDamage(int32(frost * 0.4f)); } } diff --git a/src/game/TargetedMovementGenerator.cpp b/src/game/TargetedMovementGenerator.cpp index 29325fe294f..10c3e21f519 100644 --- a/src/game/TargetedMovementGenerator.cpp +++ b/src/game/TargetedMovementGenerator.cpp @@ -57,7 +57,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner) if (!i_target.isValid() || !i_target->IsInWorld()) return false; - if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) ) + if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) return false; float x, y, z; @@ -114,7 +114,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner) if (!i_offset) { // to nearest random contact position - i_target->GetRandomContactPoint( &owner, x, y, z, 0, MELEE_RANGE - 0.5f ); + i_target->GetRandomContactPoint(&owner, x, y, z, 0, MELEE_RANGE - 0.5f); } else if (!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW)) { @@ -140,7 +140,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner) //We don't update Mob Movement, if the difference between New destination and last destination is < BothObjectSize float bothObjectSize = i_target->GetObjectSize() + owner.GetObjectSize() + CONTACT_DISTANCE; - if ( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize ) + if (i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize) return; */ i_destinationHolder.SetDestination(traveller, x, y, z); diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index 1effa944cda..539f3da8016 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -31,44 +31,44 @@ #include "WaypointMovementGenerator.h" #include "DestinationHolderImp.h" -void WorldSession::HandleTaxiNodeStatusQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_TAXINODE_STATUS_QUERY" ); + sLog.outDebug("WORLD: Received CMSG_TAXINODE_STATUS_QUERY"); uint64 guid; recv_data >> guid; - SendTaxiStatus( guid ); + SendTaxiStatus(guid); } -void WorldSession::SendTaxiStatus( uint64 guid ) +void WorldSession::SendTaxiStatus(uint64 guid) { // cheating checks Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) { - sLog.outDebug( "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid))); return; } - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); + uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer()->GetTeam()); // not found nearest if (curloc == 0) return; - sLog.outDebug( "WORLD: current location %u ",curloc); + sLog.outDebug("WORLD: current location %u ",curloc); - WorldPacket data( SMSG_TAXINODE_STATUS, 9 ); + WorldPacket data(SMSG_TAXINODE_STATUS, 9); data << guid; - data << uint8( GetPlayer( )->m_taxi.IsTaximaskNodeKnown(curloc) ? 1 : 0 ); - SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_TAXINODE_STATUS" ); + data << uint8(GetPlayer()->m_taxi.IsTaximaskNodeKnown(curloc) ? 1 : 0); + SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_TAXINODE_STATUS"); } -void WorldSession::HandleTaxiQueryAvailableNodes( WorldPacket & recv_data ) +void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES" ); + sLog.outDebug("WORLD: Received CMSG_TAXIQUERYAVAILABLENODES"); uint64 guid; recv_data >> guid; @@ -77,7 +77,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!unit) { - sLog.outDebug( "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -86,39 +86,39 @@ void WorldSession::HandleTaxiQueryAvailableNodes( WorldPacket & recv_data ) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // unknown taxi node case - if ( SendLearnNewTaxiNode(unit) ) + if (SendLearnNewTaxiNode(unit)) return; // known taxi node case - SendTaxiMenu( unit ); + SendTaxiMenu(unit); } -void WorldSession::SendTaxiMenu( Creature* unit ) +void WorldSession::SendTaxiMenu(Creature* unit) { // find current node - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); + uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer()->GetTeam()); - if ( curloc == 0 ) + if (curloc == 0) return; bool lastTaxiCheaterState = GetPlayer()->isTaxiCheater(); if (unit->GetEntry() == 29480) GetPlayer()->SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it. - sLog.outDebug( "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ",curloc); + sLog.outDebug("WORLD: CMSG_TAXINODE_STATUS_QUERY %u ",curloc); - WorldPacket data( SMSG_SHOWTAXINODES, (4+8+4+8*4) ); - data << uint32( 1 ); - data << uint64( unit->GetGUID() ); - data << uint32( curloc ); + WorldPacket data(SMSG_SHOWTAXINODES, (4+8+4+8*4)); + data << uint32(1); + data << uint64(unit->GetGUID()); + data << uint32(curloc); GetPlayer()->m_taxi.AppendTaximaskTo(data,GetPlayer()->isTaxiCheater()); - SendPacket( &data ); + SendPacket(&data); - sLog.outDebug( "WORLD: Sent SMSG_SHOWTAXINODES" ); + sLog.outDebug("WORLD: Sent SMSG_SHOWTAXINODES"); GetPlayer()->SetTaxiCheater(lastTaxiCheaterState); } -void WorldSession::SendDoFlight( uint32 mountDisplayId, uint32 path, uint32 pathNode ) +void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode) { // remove fake death if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) @@ -128,28 +128,28 @@ void WorldSession::SendDoFlight( uint32 mountDisplayId, uint32 path, uint32 path GetPlayer()->GetMotionMaster()->MovementExpired(false); if (mountDisplayId) - GetPlayer()->Mount( mountDisplayId ); + GetPlayer()->Mount(mountDisplayId); GetPlayer()->GetMotionMaster()->MoveTaxiFlight(path,pathNode); } -bool WorldSession::SendLearnNewTaxiNode( Creature* unit ) +bool WorldSession::SendLearnNewTaxiNode(Creature* unit) { // find current node - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); + uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer()->GetTeam()); - if ( curloc == 0 ) + if (curloc == 0) return true; // `true` send to avoid WorldSession::SendTaxiMenu call with one more curlock seartch with same false result. - if ( GetPlayer()->m_taxi.SetTaximaskNode(curloc) ) + if (GetPlayer()->m_taxi.SetTaximaskNode(curloc)) { WorldPacket msg(SMSG_NEW_TAXI_PATH, 0); - SendPacket( &msg ); + SendPacket(&msg); - WorldPacket update( SMSG_TAXINODE_STATUS, 9 ); - update << uint64( unit->GetGUID() ); - update << uint8( 1 ); - SendPacket( &update ); + WorldPacket update(SMSG_TAXINODE_STATUS, 9); + update << uint64(unit->GetGUID()); + update << uint8(1); + SendPacket(&update); return true; } @@ -157,9 +157,9 @@ bool WorldSession::SendLearnNewTaxiNode( Creature* unit ) return false; } -void WorldSession::HandleActivateTaxiExpressOpcode ( WorldPacket & recv_data ) +void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXIEXPRESS" ); + sLog.outDebug("WORLD: Received CMSG_ACTIVATETAXIEXPRESS"); uint64 guid; uint32 node_count; @@ -169,7 +169,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode ( WorldPacket & recv_data ) Creature *npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { - sLog.outDebug( "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); return; } std::vector<uint32> nodes; @@ -184,14 +184,14 @@ void WorldSession::HandleActivateTaxiExpressOpcode ( WorldPacket & recv_data ) if (nodes.empty()) return; - sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d" ,nodes.front(),nodes.back()); + sLog.outDebug("WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d" ,nodes.front(),nodes.back()); GetPlayer()->ActivateTaxiPathTo(nodes, npc); } void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data) { - sLog.outDebug( "WORLD: Received CMSG_MOVE_SPLINE_DONE" ); + sLog.outDebug("WORLD: Received CMSG_MOVE_SPLINE_DONE"); uint64 guid; // used only for proper packet read if (!recv_data.readPackGUID(guid)) @@ -231,7 +231,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data) } uint32 destinationnode = GetPlayer()->m_taxi.NextTaxiDestination(); - if ( destinationnode > 0 ) // if more destinations to go + if (destinationnode > 0) // if more destinations to go { // current source node for next destination uint32 sourcenode = GetPlayer()->m_taxi.GetTaxiSource(); @@ -242,19 +242,19 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data) if (GetPlayer()->m_taxi.SetTaximaskNode(sourcenode)) { WorldPacket data(SMSG_NEW_TAXI_PATH, 0); - _player->GetSession()->SendPacket( &data ); + _player->GetSession()->SendPacket(&data); } } - sLog.outDebug( "WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode ); + sLog.outDebug("WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode); uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourcenode, GetPlayer()->GetTeam()); uint32 path, cost; - objmgr.GetTaxiPath( sourcenode, destinationnode, path, cost); + objmgr.GetTaxiPath(sourcenode, destinationnode, path, cost); if (path && mountDisplayId) - SendDoFlight( mountDisplayId, path, 1 ); // skip start fly node + SendDoFlight(mountDisplayId, path, 1); // skip start fly node else GetPlayer()->m_taxi.ClearTaxiDestinations(); // clear problematic path and next return; @@ -266,20 +266,20 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data) GetPlayer()->CastSpell(GetPlayer(), 2479, true); } -void WorldSession::HandleActivateTaxiOpcode( WorldPacket & recv_data ) +void WorldSession::HandleActivateTaxiOpcode(WorldPacket & recv_data) { - sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXI" ); + sLog.outDebug("WORLD: Received CMSG_ACTIVATETAXI"); uint64 guid; std::vector<uint32> nodes; nodes.resize(2); recv_data >> guid >> nodes[0] >> nodes[1]; - sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXI from %d to %d" ,nodes[0],nodes[1]); + sLog.outDebug("WORLD: Received CMSG_ACTIVATETAXI from %d to %d" ,nodes[0],nodes[1]); Creature *npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { - sLog.outDebug( "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug("WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); return; } diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 2badcf902b8..8005a6cb37d 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -37,7 +37,7 @@ Unit* TempSummon::GetSummoner() const return m_summonerGUID ? ObjectAccessor::GetUnit(*this, m_summonerGUID) : NULL; } -void TempSummon::Update( uint32 diff ) +void TempSummon::Update(uint32 diff) { Creature::Update(diff); @@ -81,7 +81,7 @@ void TempSummon::Update( uint32 diff ) case TEMPSUMMON_CORPSE_TIMED_DESPAWN: { - if ( m_deathState == CORPSE) + if (m_deathState == CORPSE) { if (m_timer <= diff) { @@ -96,7 +96,7 @@ void TempSummon::Update( uint32 diff ) case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if ( m_deathState == CORPSE || m_deathState == DEAD) + if (m_deathState == CORPSE || m_deathState == DEAD) { UnSummon(); return; @@ -106,7 +106,7 @@ void TempSummon::Update( uint32 diff ) } case TEMPSUMMON_DEAD_DESPAWN: { - if ( m_deathState == DEAD ) + if (m_deathState == DEAD) { UnSummon(); return; @@ -116,7 +116,7 @@ void TempSummon::Update( uint32 diff ) case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if ( m_deathState == CORPSE || m_deathState == DEAD) + if (m_deathState == CORPSE || m_deathState == DEAD) { UnSummon(); return; @@ -145,7 +145,7 @@ void TempSummon::Update( uint32 diff ) return; } - if (!isInCombat() && isAlive() ) + if (!isInCombat() && isAlive()) { if (m_timer <= diff) { diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index 02b4785ba7a..2800a86f380 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -285,7 +285,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile assert(target); // if the ref has status online the target must be there ! // some units are prefered in comparison to others - if (!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) ) + if (!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE))) { if (iter != lastRef) { @@ -309,7 +309,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile if (pCurrentVictim) // select 1.3/1.1 better target in comparison current target { // list sorted and and we check current target, then this is best case - if (pCurrentVictim == currentRef || currentRef->getThreat() <= 1.1f * pCurrentVictim->getThreat() ) + if (pCurrentVictim == currentRef || currentRef->getThreat() <= 1.1f * pCurrentVictim->getThreat()) { currentRef = pCurrentVictim; // for second case found = true; @@ -423,7 +423,7 @@ void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 iPercent) Unit* ThreatManager::getHostilTarget() { iThreatContainer.update(); - HostileReference* nextVictim = iThreatContainer.selectNextVictim( getOwner()->ToCreature(), getCurrentVictim()); + HostileReference* nextVictim = iThreatContainer.selectNextVictim(getOwner()->ToCreature(), getCurrentVictim()); setCurrentVictim(nextVictim); return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL; } diff --git a/src/game/ThreatManager.h b/src/game/ThreatManager.h index d1635ae4372..398fee12699 100644 --- a/src/game/ThreatManager.h +++ b/src/game/ThreatManager.h @@ -119,7 +119,7 @@ class HostileReference : public Reference<Unit, ThreatManager> //================================================= - HostileReference* next() { return ((HostileReference* ) Reference<Unit, ThreatManager>::next()); } + HostileReference* next() { return ((HostileReference*) Reference<Unit, ThreatManager>::next()); } //================================================= diff --git a/src/game/TicketHandler.cpp b/src/game/TicketHandler.cpp index 8cbc12a9d30..72ed25adbca 100644 --- a/src/game/TicketHandler.cpp +++ b/src/game/TicketHandler.cpp @@ -25,7 +25,7 @@ #include "Player.h" #include "World.h" -void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data) { if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_TICKET_LEVEL_REQ)) { @@ -35,9 +35,9 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) if (GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID())) { - WorldPacket data( SMSG_GMTICKET_CREATE, 4 ); + WorldPacket data(SMSG_GMTICKET_CREATE, 4); data << uint32(1); // 1 - You already have GM ticket - SendPacket( &data ); + SendPacket(&data); return; } @@ -79,7 +79,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) } -void WorldSession::HandleGMTicketUpdateOpcode( WorldPacket & recv_data) +void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data) { WorldPacket data(SMSG_GMTICKET_UPDATETEXT, 4); @@ -106,7 +106,7 @@ void WorldSession::HandleGMTicketUpdateOpcode( WorldPacket & recv_data) } -void WorldSession::HandleGMTicketDeleteOpcode( WorldPacket & /*recv_data*/) +void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recv_data*/) { GM_Ticket* ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()); @@ -116,13 +116,13 @@ void WorldSession::HandleGMTicketDeleteOpcode( WorldPacket & /*recv_data*/) data << uint32(9); SendPacket(&data); - sWorld.SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName(), ticket->guid ); + sWorld.SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName(), ticket->guid); objmgr.RemoveGMTicket(ticket, GetPlayer()->GetGUID(), false); SendGMTicketGetTicket(0x0A, 0); } } -void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/) +void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/) { SendQueryTimeResponse(); @@ -134,7 +134,7 @@ void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/) } -void WorldSession::HandleGMTicketSystemStatusOpcode( WorldPacket & /*recv_data*/) +void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recv_data*/) { WorldPacket data(SMSG_GMTICKET_SYSTEMSTATUS, 4); data << uint32(1); diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 0f0b8160523..6d461ef291d 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -33,7 +33,7 @@ Totem::Totem(SummonPropertiesEntry const *properties, Unit *owner) : Minion(prop m_type = TOTEM_PASSIVE; } -void Totem::Update( uint32 time ) +void Totem::Update(uint32 time) { if (!m_owner->isAlive() || !isAlive()) { @@ -49,7 +49,7 @@ void Totem::Update( uint32 time ) else m_duration -= time; - Creature::Update( time ); + Creature::Update(time); } void Totem::InitStats(uint32 duration) diff --git a/src/game/Totem.h b/src/game/Totem.h index 1234f3549f8..cf7d078e30b 100644 --- a/src/game/Totem.h +++ b/src/game/Totem.h @@ -37,7 +37,7 @@ class Totem : public Minion public: explicit Totem(SummonPropertiesEntry const *properties, Unit *owner); virtual ~Totem(){}; - void Update( uint32 time ); + void Update(uint32 time); void InitStats(uint32 duration); void InitSummon(); void UnSummon(); @@ -51,7 +51,7 @@ class Totem : public Minion void UpdateArmor() {} void UpdateMaxHealth() {} void UpdateMaxPower(Powers /*power*/) {} - void UpdateAttackPowerAndDamage(bool /*ranged*/ ) {} + void UpdateAttackPowerAndDamage(bool /*ranged*/) {} void UpdateDamagePhysical(WeaponAttackType /*attType*/) {} bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const; diff --git a/src/game/TotemAI.cpp b/src/game/TotemAI.cpp index f96071e8bfc..6102d2ee4d2 100644 --- a/src/game/TotemAI.cpp +++ b/src/game/TotemAI.cpp @@ -32,7 +32,7 @@ int TotemAI::Permissible(const Creature *creature) { - if ( creature->isTotem() ) + if (creature->isTotem()) return PERMIT_BASE_PROACTIVE; return PERMIT_BASE_NO; @@ -56,7 +56,7 @@ void TotemAI::EnterEvadeMode() void TotemAI::UpdateAI(const uint32 /*diff*/) { - if ( m_creature->ToTotem()->GetTotemType() != TOTEM_ACTIVE) + if (m_creature->ToTotem()->GetTotemType() != TOTEM_ACTIVE) return; if (!m_creature->isAlive() || m_creature->IsNonMeleeSpellCasted(false)) @@ -77,9 +77,9 @@ TotemAI::UpdateAI(const uint32 /*diff*/) Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*m_creature, i_victimGuid) : NULL; // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) - if ( !victim || + if (!victim || !victim->isTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) || - m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature,false) ) + m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature,false)) { victim = NULL; Trinity::NearestAttackableUnitInObjectRangeCheck u_check(m_creature, m_creature, max_range); diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index 2bcc4addd40..eeb24d6b8c9 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -96,13 +96,13 @@ void WorldSession::SendTradeStatus(uint32 status) void WorldSession::HandleIgnoreTradeOpcode(WorldPacket& /*recvPacket*/) { - sLog.outDebug( "WORLD: Ignore Trade %u",_player->GetGUIDLow()); + sLog.outDebug("WORLD: Ignore Trade %u",_player->GetGUIDLow()); // recvPacket.print_storage(); } void WorldSession::HandleBusyTradeOpcode(WorldPacket& /*recvPacket*/) { - sLog.outDebug( "WORLD: Busy Trade %u",_player->GetGUIDLow()); + sLog.outDebug("WORLD: Busy Trade %u",_player->GetGUIDLow()); // recvPacket.print_storage(); } @@ -110,7 +110,7 @@ void WorldSession::SendUpdateTrade() { Item *item = NULL; - if ( !_player || !_player->pTrader ) + if (!_player || !_player->pTrader) return; // reset trade status @@ -127,7 +127,7 @@ void WorldSession::SendUpdateTrade() } WorldPacket data(SMSG_TRADE_STATUS_EXTENDED, (100)); // guess size - data << (uint8 ) 1; // can be different (only seen 0 and 1) + data << (uint8) 1; // can be different (only seen 0 and 1) data << (uint32) 0; // added in 2.4.0, this value must be equal to value from TRADE_STATUS_OPEN_WINDOW status packet (different value for different players to block multiple trades?) data << (uint32) TRADE_SLOT_COUNT; // trade slots count/number?, = next field in most cases data << (uint32) TRADE_SLOT_COUNT; // trade slots count/number?, = prev field in most cases @@ -136,7 +136,7 @@ void WorldSession::SendUpdateTrade() for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) { - item = (_player->pTrader->tradeItems[i] != 0 ? _player->pTrader->GetItemByGuid( _player->pTrader->tradeItems[i] ) : NULL); + item = (_player->pTrader->tradeItems[i] != 0 ? _player->pTrader->GetItemByGuid(_player->pTrader->tradeItems[i]) : NULL); data << (uint8) i; // trade slot number, if not specified, then end of packet @@ -183,9 +183,9 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { ItemPosCountVec traderDst; ItemPosCountVec playerDst; - bool traderCanTrade = (myItems[i]==NULL || _player->pTrader->CanStoreItem( NULL_BAG, NULL_SLOT, traderDst, myItems[i], false ) == EQUIP_ERR_OK); - bool playerCanTrade = (hisItems[i]==NULL || _player->CanStoreItem( NULL_BAG, NULL_SLOT, playerDst, hisItems[i], false ) == EQUIP_ERR_OK); - if (traderCanTrade && playerCanTrade ) + bool traderCanTrade = (myItems[i]==NULL || _player->pTrader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, myItems[i], false) == EQUIP_ERR_OK); + bool playerCanTrade = (hisItems[i]==NULL || _player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, hisItems[i], false) == EQUIP_ERR_OK); + if (traderCanTrade && playerCanTrade) { // Ok, if trade item exists and can be stored // If we trade in both directions we had to check, if the trade will work before we actually do it @@ -194,7 +194,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { // logging sLog.outDebug("partner storing: %u",myItems[i]->GetGUIDLow()); - if ( _player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) + if (_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", _player->GetName(),_player->GetSession()->GetAccountId(), @@ -203,13 +203,13 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) } // store - _player->pTrader->MoveItemToInventory( traderDst, myItems[i], true, true); + _player->pTrader->MoveItemToInventory(traderDst, myItems[i], true, true); } if (hisItems[i]) { // logging sLog.outDebug("player storing: %u",hisItems[i]->GetGUIDLow()); - if ( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) + if (_player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(),"GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", _player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(), @@ -218,7 +218,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) } // store - _player->MoveItemToInventory( playerDst, hisItems[i], true, true); + _player->MoveItemToInventory(playerDst, hisItems[i], true, true); } } else @@ -229,7 +229,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { if (!traderCanTrade) sLog.outError("trader can't store item: %u",myItems[i]->GetGUIDLow()); - if (_player->CanStoreItem( NULL_BAG, NULL_SLOT, playerDst, myItems[i], false ) == EQUIP_ERR_OK) + if (_player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, myItems[i], false) == EQUIP_ERR_OK) _player->MoveItemToInventory(playerDst, myItems[i], true, true); else sLog.outError("player can't take item back: %u",myItems[i]->GetGUIDLow()); @@ -239,7 +239,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { if (!playerCanTrade) sLog.outError("player can't store item: %u",hisItems[i]->GetGUIDLow()); - if (_player->pTrader->CanStoreItem( NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false ) == EQUIP_ERR_OK) + if (_player->pTrader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false) == EQUIP_ERR_OK) _player->pTrader->MoveItemToInventory(traderDst, hisItems[i], true, true); else sLog.outError("trader can't take item back: %u",hisItems[i]->GetGUIDLow()); @@ -256,11 +256,11 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) Item *hisItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; bool myCanCompleteTrade=true,hisCanCompleteTrade=true; - if ( !GetPlayer()->pTrader ) + if (!GetPlayer()->pTrader) return; // not accept case incorrect money amount - if ( _player->tradeGold > _player->GetMoney() ) + if (_player->tradeGold > _player->GetMoney()) { SendNotification(LANG_NOT_ENOUGH_GOLD); _player->pTrader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); @@ -269,9 +269,9 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) } // not accept case incorrect money amount - if ( _player->pTrader->tradeGold > _player->pTrader->GetMoney() ) + if (_player->pTrader->tradeGold > _player->pTrader->GetMoney()) { - _player->pTrader->GetSession( )->SendNotification(LANG_NOT_ENOUGH_GOLD); + _player->pTrader->GetSession()->SendNotification(LANG_NOT_ENOUGH_GOLD); SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); _player->pTrader->acceptTrade = false; return; @@ -280,9 +280,9 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) // not accept if some items now can't be trade (cheating) for (int i=0; i<TRADE_SLOT_TRADED_COUNT; ++i) { - if (_player->tradeItems[i] != 0 ) + if (_player->tradeItems[i] != 0) { - if (Item* item =_player->GetItemByGuid( _player->tradeItems[i] )) + if (Item* item =_player->GetItemByGuid(_player->tradeItems[i])) { if (!item->CanBeTraded()) { @@ -293,7 +293,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) } if (_player->pTrader->tradeItems[i] != 0) { - if (Item* item =_player->pTrader->GetItemByGuid( _player->pTrader->tradeItems[i]) ) + if (Item* item =_player->pTrader->GetItemByGuid(_player->pTrader->tradeItems[i])) { if (!item->CanBeTraded()) { @@ -305,7 +305,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) } _player->acceptTrade = true; - if (_player->pTrader->acceptTrade ) + if (_player->pTrader->acceptTrade) { // inform partner client _player->pTrader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_ACCEPT); @@ -316,7 +316,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) if (_player->tradeItems[i] != 0) { //Can return NULL - myItems[i] = _player->GetItemByGuid( _player->tradeItems[i] ); + myItems[i] = _player->GetItemByGuid(_player->tradeItems[i]); if (myItems[i]) { myItems[i]->SetInTrade(); @@ -326,7 +326,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) if (_player->pTrader->tradeItems[i] != 0) { //Can return NULL - hisItems[i]=_player->pTrader->GetItemByGuid( _player->pTrader->tradeItems[i]); + hisItems[i]=_player->pTrader->GetItemByGuid(_player->pTrader->tradeItems[i]); if (hisItems[i]) { hisItems[i]->SetInTrade(); @@ -336,8 +336,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) } // test if item will fit in each inventory - hisCanCompleteTrade = (_player->pTrader->CanStoreItems( myItems,TRADE_SLOT_TRADED_COUNT )== EQUIP_ERR_OK); - myCanCompleteTrade = (_player->CanStoreItems( hisItems,TRADE_SLOT_TRADED_COUNT ) == EQUIP_ERR_OK); + hisCanCompleteTrade = (_player->pTrader->CanStoreItems(myItems,TRADE_SLOT_TRADED_COUNT)== EQUIP_ERR_OK); + myCanCompleteTrade = (_player->CanStoreItems(hisItems,TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK); // clear 'in-trade' flag for (int i=0; i<TRADE_SLOT_TRADED_COUNT; ++i) @@ -350,7 +350,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) if (!myCanCompleteTrade) { SendNotification(LANG_NOT_FREE_TRADE_SLOTS); - GetPlayer( )->pTrader->GetSession( )->SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS); + GetPlayer()->pTrader->GetSession()->SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS); SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); _player->pTrader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); return; @@ -370,13 +370,13 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) Item* iPtr = NULL; if (myItems[i]) { - myItems[i]->SetUInt64Value( ITEM_FIELD_GIFTCREATOR, _player->GetGUID()); + myItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID()); iPtr = _player->GetItemByGuid(_player->tradeItems[i]); _player->MoveItemFromInventory(iPtr->GetBagSlot(), iPtr->GetSlot(), true); } if (hisItems[i]) { - hisItems[i]->SetUInt64Value( ITEM_FIELD_GIFTCREATOR,_player->pTrader->GetGUID()); + hisItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR,_player->pTrader->GetGUID()); iPtr = _player->pTrader->GetItemByGuid(_player->pTrader->tradeItems[i]); _player->pTrader->MoveItemFromInventory(iPtr->GetBagSlot(), iPtr->GetSlot(), true); } @@ -388,14 +388,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) // logging money if (sWorld.getConfig(CONFIG_GM_LOG_TRADE)) { - if ( _player->GetSession()->GetSecurity() > SEC_PLAYER && _player->tradeGold > 0) + if (_player->GetSession()->GetSecurity() > SEC_PLAYER && _player->tradeGold > 0) { sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)", _player->GetName(),_player->GetSession()->GetAccountId(), _player->tradeGold, _player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId()); } - if ( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && _player->pTrader->tradeGold > 0) + if (_player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && _player->pTrader->tradeGold > 0) { sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(),"GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)", _player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(), @@ -405,10 +405,10 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) } // update money - _player->ModifyMoney( -int32(_player->tradeGold) ); - _player->ModifyMoney(_player->pTrader->tradeGold ); - _player->pTrader->ModifyMoney( -int32(_player->pTrader->tradeGold) ); - _player->pTrader->ModifyMoney(_player->tradeGold ); + _player->ModifyMoney(-int32(_player->tradeGold)); + _player->ModifyMoney(_player->pTrader->tradeGold); + _player->pTrader->ModifyMoney(-int32(_player->pTrader->tradeGold)); + _player->pTrader->ModifyMoney(_player->tradeGold); _player->ClearTrade(); _player->pTrader->ClearTrade(); @@ -433,7 +433,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleUnacceptTradeOpcode(WorldPacket& /*recvPacket*/) { - if ( !GetPlayer()->pTrader ) + if (!GetPlayer()->pTrader) return; _player->pTrader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); @@ -503,7 +503,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) recvPacket >> ID; - Player* pOther = ObjectAccessor::FindPlayer( ID ); + Player* pOther = ObjectAccessor::FindPlayer(ID); if (!pOther) { @@ -547,7 +547,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam() ) + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam()) { SendTradeStatus(TRADE_STATUS_WRONG_FACTION); return; diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 68476392373..c64777af1ce 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -37,17 +37,17 @@ void MapManager::LoadTransports() uint32 count = 0; - if ( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u transports", count ); + sLog.outString(">> Loaded %u transports", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -113,7 +113,7 @@ void MapManager::LoadTransports() } while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u transports", count ); + sLog.outString(">> Loaded %u transports", count); // check transport data DB integrity result = WorldDatabase.Query("SELECT gameobject.guid,gameobject.id,transports.name FROM gameobject,transports WHERE gameobject.id = transports.entry"); @@ -537,7 +537,7 @@ void Transport::Update(uint32 /*p_time*/) { PlayerSet::const_iterator it2 = itr; ++itr; - //(*it2)->SetPosition( m_curr->second.x + (*it2)->GetTransOffsetX(), m_curr->second.y + (*it2)->GetTransOffsetY(), m_curr->second.z + (*it2)->GetTransOffsetZ(), (*it2)->GetTransOffsetO() ); + //(*it2)->SetPosition(m_curr->second.x + (*it2)->GetTransOffsetX(), m_curr->second.y + (*it2)->GetTransOffsetY(), m_curr->second.z + (*it2)->GetTransOffsetZ(), (*it2)->GetTransOffsetO()); } */ diff --git a/src/game/Transports.h b/src/game/Transports.h index 2d5e000ed02..25b9ade1461 100644 --- a/src/game/Transports.h +++ b/src/game/Transports.h @@ -40,7 +40,7 @@ class TransportPath void SetLength(const unsigned int sz) { - i_nodes.resize( sz ); + i_nodes.resize(sz); } unsigned int Size(void) const { return i_nodes.size(); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7e81806e658..745385cba8e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -338,7 +338,7 @@ void Unit::SendMonsterStop(bool on_death) void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player) { - WorldPacket data( SMSG_MONSTER_MOVE, 1+12+4+1+4+4+4+12+GetPackGUID().size()); + WorldPacket data(SMSG_MONSTER_MOVE, 1+12+4+1+4+4+4+12+GetPackGUID().size()); data.append(GetPackGUID()); data << uint8(0); // new in 3.1 @@ -361,7 +361,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 T void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 MoveFlags, uint32 time, float speedZ, Player *player) { - WorldPacket data( SMSG_MONSTER_MOVE, 12+4+1+4+4+4+12+GetPackGUID().size()); + WorldPacket data(SMSG_MONSTER_MOVE, 12+4+1+4+4+4+12+GetPackGUID().size()); data.append(GetPackGUID()); data << uint8(0); // new in 3.1 @@ -442,17 +442,17 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end) uint32 pathSize = end - start; - WorldPacket data( SMSG_MONSTER_MOVE, (GetPackGUID().size()+1+4+4+4+4+1+4+4+4+pathSize*4*3) ); + WorldPacket data(SMSG_MONSTER_MOVE, (GetPackGUID().size()+1+4+4+4+4+1+4+4+4+pathSize*4*3)); data.append(GetPackGUID()); data << uint8(0); data << GetPositionX(); data << GetPositionY(); data << GetPositionZ(); data << uint32(getMSTime()); - data << uint8( 0 ); + data << uint8(0); data << uint32(((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) || isInFlight())? (MOVEFLAG_FLY|MOVEFLAG_WALK) : MOVEFLAG_WALK); - data << uint32( traveltime ); - data << uint32( pathSize ); + data << uint32(traveltime); + data << uint32(pathSize); data.append((char*)path.GetNodes(start), pathSize * 4 * 3); SendMessageToSet(&data, true); //MONSTER_MOVE_SPLINE_FLY @@ -862,7 +862,7 @@ void Unit::CastStop(uint32 except_spellid) void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, AuraEffect const * triggeredByAura, uint64 originalCaster) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) { @@ -894,7 +894,7 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I if (!originalCaster && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); - Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); + Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); spell->m_CastItem = castItem; spell->prepare(&targets, triggeredByAura); @@ -921,7 +921,7 @@ void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim, bool triggered, Item *castItem, AuraEffect const * triggeredByAura, uint64 originalCaster) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) { sLog.outError("CastSpell: unknown spell id %i by caster: %s %u)", spellId,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); @@ -934,7 +934,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* if (!originalCaster && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); - Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); + Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); if (castItem) { @@ -951,7 +951,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* // used for scripting void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, AuraEffect const * triggeredByAura, uint64 originalCaster, Unit* OriginalVictim) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) { @@ -965,7 +965,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, if (!originalCaster && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); - Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); + Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); SpellCastTargets targets; targets.setDst(x, y, z, GetOrientation()); @@ -981,7 +981,7 @@ void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castI if (!go) return; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) { @@ -989,7 +989,7 @@ void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castI return; } - if (!(spellInfo->Targets & ( TARGET_FLAG_OBJECT | TARGET_FLAG_OBJECT_UNK))) + if (!(spellInfo->Targets & (TARGET_FLAG_OBJECT | TARGET_FLAG_OBJECT_UNK))) { sLog.outError("CastSpell: spell id %i by caster: %s %u) is not gameobject spell", spellId,(GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; @@ -1001,7 +1001,7 @@ void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castI if (!originalCaster && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); - Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); + Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); SpellCastTargets targets; targets.setGOTarget(go); @@ -1504,7 +1504,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) data << uint32(damage); // Damage data << uint32(0); // Overkill data << uint32(i_spellProto->SchoolMask); - pVictim->SendMessageToSet(&data, true ); + pVictim->SendMessageToSet(&data, true); pVictim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, GetSpellSchoolMask(i_spellProto), i_spellProto, true); @@ -1520,7 +1520,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) void Unit::HandleEmoteCommand(uint32 anim_id) { - WorldPacket data( SMSG_EMOTE, 4 + 8 ); + WorldPacket data(SMSG_EMOTE, 4 + 8); data << uint32(anim_id); data << uint64(GetGUID()); SendMessageToSet(&data, true); @@ -1902,7 +1902,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff case 51271: // Unbreakable Armor if (Unit *caster = (*i)->GetCaster()) { - uint32 absorbed = uint32( currentAbsorb * caster->GetArmor() * 0.01f ); + uint32 absorbed = uint32(currentAbsorb * caster->GetArmor() * 0.01f); // Glyph of Unbreakable Armor if (AuraEffect *aurEff = caster->GetAuraEffect(58635, 0)) @@ -2161,9 +2161,9 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff } } -void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool extra ) +void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool extra) { - if (hasUnitState(UNIT_STAT_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED) ) + if (hasUnitState(UNIT_STAT_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) return; if (!pVictim->isAlive()) @@ -2246,7 +2246,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack int32 victimDefenseSkill = pVictim->GetDefenseSkillValue(this); // bonus from skills is 0.04% - int32 skillBonus = 4 * ( attackerWeaponSkill - victimMaxSkillValueForLevel ); + int32 skillBonus = 4 * (attackerWeaponSkill - victimMaxSkillValueForLevel); int32 sum = 0, tmp = 0; int32 roll = urand (0, 10000); @@ -2256,14 +2256,14 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack tmp = miss_chance; - if (tmp > 0 && roll < (sum += tmp )) + if (tmp > 0 && roll < (sum += tmp)) { DEBUG_LOG ("RollMeleeOutcomeAgainst: MISS"); return MELEE_HIT_MISS; } // always crit against a sitting target (except 0 crit chance) - if (pVictim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !pVictim->IsStandState() ) + if (pVictim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !pVictim->IsStandState()) { DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT (sitting victim)"); return MELEE_HIT_CRIT; @@ -2289,7 +2289,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack dodge_chance = int32 (float (dodge_chance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE)); tmp = dodge_chance; - if ( (tmp > 0) // check if unit _can_ dodge + if ((tmp > 0) // check if unit _can_ dodge && ((tmp -= skillBonus) > 0) && roll < (sum += tmp)) { @@ -2313,7 +2313,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack else parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE)*25; - if (pVictim->GetTypeId() == TYPEID_PLAYER || !(pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) ) + if (pVictim->GetTypeId() == TYPEID_PLAYER || !(pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY)) { int32 tmp2 = int32(parry_chance); if (tmp2 > 0 // check if unit _can_ parry @@ -2325,7 +2325,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack } } - if (pVictim->GetTypeId() == TYPEID_PLAYER || !(pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) ) + if (pVictim->GetTypeId() == TYPEID_PLAYER || !(pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)) { tmp = block_chance; if (tmp > 0 // check if unit _can_ block @@ -2458,12 +2458,12 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const void Unit::SendMeleeAttackStart(Unit* pVictim) { - WorldPacket data( SMSG_ATTACKSTART, 8 + 8 ); + WorldPacket data(SMSG_ATTACKSTART, 8 + 8); data << uint64(GetGUID()); data << uint64(pVictim->GetGUID()); SendMessageToSet(&data, true); - DEBUG_LOG( "WORLD: Sent SMSG_ATTACKSTART" ); + DEBUG_LOG("WORLD: Sent SMSG_ATTACKSTART"); } void Unit::SendMeleeAttackStop(Unit* victim) @@ -2471,7 +2471,7 @@ void Unit::SendMeleeAttackStop(Unit* victim) if (!victim) return; - WorldPacket data( SMSG_ATTACKSTOP, (4+16) ); // we guess size + WorldPacket data(SMSG_ATTACKSTOP, (4+16)); // we guess size data.append(GetPackGUID()); data.append(victim->GetPackGUID()); // can be 0x00... data << uint32(0); // can be 0x1 @@ -2493,14 +2493,14 @@ bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * /*spellProto*/, Weap { if (!(*i)->IsAffectedOnSpell(spellProto)) continue; - if ((*i)->GetMiscValue() == ) + if ((*i)->GetMiscValue() ==) return false; } */ // Check creatures flags_extra for disable block if (pVictim->GetTypeId() == TYPEID_UNIT && - pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK ) + pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) return false; float blockChance = pVictim->GetUnitBlockChance(); @@ -2894,7 +2894,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool bool isNormal = false; for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) { - if ( m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL) ) + if (m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL)) { isNormal = true; break; @@ -2940,14 +2940,14 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool else misschance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE); - // Modify miss chance from skill difference ( bonus from skills is 0.04% ) + // Modify miss chance from skill difference (bonus from skills is 0.04%) int32 skillBonus = int32(GetWeaponSkillValue(attType,pVictim)) - int32(pVictim->GetDefenseSkillValue(this)); misschance -= skillBonus * 0.04f; // Limit miss chance from 0 to 60% - if ( misschance < 0.0f) + if (misschance < 0.0f) return 0.0f; - if ( misschance > 60.0f) + if (misschance > 60.0f) return 60.0f; return misschance; @@ -2972,7 +2972,7 @@ float Unit::GetUnitDodgeChance() const { if (hasUnitState(UNIT_STAT_STUNNED)) return 0.0f; - if ( GetTypeId() == TYPEID_PLAYER ) + if (GetTypeId() == TYPEID_PLAYER) return GetFloatValue(PLAYER_DODGE_PERCENTAGE); else { @@ -2989,7 +2989,7 @@ float Unit::GetUnitDodgeChance() const float Unit::GetUnitParryChance() const { - if ( IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED)) + if (IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED)) return 0.0f; float chance = 0.0f; @@ -2997,7 +2997,7 @@ float Unit::GetUnitParryChance() const if (GetTypeId() == TYPEID_PLAYER) { Player const* player = (Player const*)this; - if (player->CanParry() ) + if (player->CanParry()) { Item *tmpitem = player->GetWeaponForAttack(BASE_ATTACK,true); if (!tmpitem) @@ -3021,13 +3021,13 @@ float Unit::GetUnitParryChance() const float Unit::GetUnitBlockChance() const { - if ( IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED)) + if (IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED)) return 0.0f; if (GetTypeId() == TYPEID_PLAYER) { Player const* player = (Player const*)this; - if (player->CanBlock() ) + if (player->CanBlock()) { Item *tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block) @@ -3058,13 +3058,13 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict switch(attackType) { case BASE_ATTACK: - crit = GetFloatValue( PLAYER_CRIT_PERCENTAGE ); + crit = GetFloatValue(PLAYER_CRIT_PERCENTAGE); break; case OFF_ATTACK: - crit = GetFloatValue( PLAYER_OFFHAND_CRIT_PERCENTAGE ); + crit = GetFloatValue(PLAYER_OFFHAND_CRIT_PERCENTAGE); break; case RANGED_ATTACK: - crit = GetFloatValue( PLAYER_RANGED_CRIT_PERCENTAGE ); + crit = GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE); break; // Just for good manner default: @@ -3150,7 +3150,7 @@ void Unit::_DeleteRemovedAuras() } } -void Unit::_UpdateSpells( uint32 time ) +void Unit::_UpdateSpells(uint32 time) { if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]) _UpdateAutoRepeatSpell(); @@ -3193,7 +3193,7 @@ void Unit::_UpdateSpells( uint32 time ) GameObjectList::iterator itr; for (itr = m_gameObj.begin(); itr != m_gameObj.end();) { - if ( !(*itr)->isSpawned() ) + if (!(*itr)->isSpawned()) { (*itr)->SetOwnerGUID(0); (*itr)->SetRespawnTime(0); @@ -3209,7 +3209,7 @@ void Unit::_UpdateSpells( uint32 time ) void Unit::_UpdateAutoRepeatSpell() { //check "realtime" interrupts - if ( (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isMoving()) || IsNonMeleeSpellCasted(false,false,true,m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == 75) ) + if ((GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isMoving()) || IsNonMeleeSpellCasted(false,false,true,m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == 75)) { // cancel wand shoot if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) @@ -3219,7 +3219,7 @@ void Unit::_UpdateAutoRepeatSpell() } //apply delay - if ( m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500 ) + if (m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500) setAttackTimer(RANGED_ATTACK,500); m_AutoRepeatFirstCast = false; @@ -3242,7 +3242,7 @@ void Unit::_UpdateAutoRepeatSpell() } } -void Unit::SetCurrentCastedSpell( Spell * pSpell ) +void Unit::SetCurrentCastedSpell(Spell * pSpell) { assert(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells @@ -3262,7 +3262,7 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell ) InterruptSpell(CURRENT_CHANNELED_SPELL,false); // autorepeat breaking - if ( m_currentSpells[CURRENT_AUTOREPEAT_SPELL] ) + if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]) { // break autorepeat if not Auto Shot if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) @@ -3279,8 +3279,8 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell ) InterruptSpell(CURRENT_CHANNELED_SPELL); // it also does break autorepeat if not Auto Shot - if ( m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && - m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75 ) + if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && + m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); addUnitState(UNIT_STAT_CASTING); } break; @@ -3362,22 +3362,22 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip // Maybe later some special spells will be excluded too. // generic spells are casted when they are not finished and not delayed - if ( m_currentSpells[CURRENT_GENERIC_SPELL] && + if (m_currentSpells[CURRENT_GENERIC_SPELL] && (m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_FINISHED) && - (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED) ) + (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED)) { if (!isAutoshoot || !(m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTOSHOT)) return(true); } // channeled spells may be delayed, but they are still considered casted - else if ( !skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] && - (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) ) + else if (!skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] && + (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)) { if (!isAutoshoot || !(m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTOSHOT)) return(true); } // autorepeat spells may be finished or delayed, but they are still considered casted - else if ( !skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL] ) + else if (!skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL]) return(true); return(false); @@ -3415,12 +3415,12 @@ int32 Unit::GetCurrentSpellCastTime(uint32 spell_id) const bool Unit::isInFrontInMap(Unit const* target, float distance, float arc) const { - return IsWithinDistInMap(target, distance) && HasInArc( arc, target ); + return IsWithinDistInMap(target, distance) && HasInArc(arc, target); } bool Unit::isInBackInMap(Unit const* target, float distance, float arc) const { - return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target ); + return IsWithinDistInMap(target, distance) && !HasInArc(2 * M_PI - arc, target); } void Unit::SetFacingToObject(WorldObject* pObject) @@ -3493,7 +3493,7 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster) Unit::AuraList& scAuras = caster->GetSingleCastAuras(); for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr) { - if ( (*itr) != aura && + if ((*itr) != aura && IsSingleTargetSpells((*itr)->GetSpellProto(), aura->GetSpellProto())) { (*itr)->Remove(); @@ -3521,8 +3521,8 @@ AuraApplication * Unit::_CreateAuraApplication(Aura * aura, uint8 effMask) uint32 aurId = aurSpellInfo->Id; // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) - if ( !isAlive() && !IsDeathPersistentSpell(aurSpellInfo) && - (GetTypeId() != TYPEID_PLAYER || !this->ToPlayer()->GetSession()->PlayerLoading()) ) + if (!isAlive() && !IsDeathPersistentSpell(aurSpellInfo) && + (GetTypeId() != TYPEID_PLAYER || !this->ToPlayer()->GetSession()->PlayerLoading())) return NULL; Unit * caster = aura->GetCaster(); @@ -4291,7 +4291,7 @@ void Unit::RemoveArenaAuras(bool onleave) { AuraApplication const * aurApp = iter->second; Aura const * aura = aurApp->GetBase(); - if ( !(aura->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras + if (!(aura->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras && !aura->IsPassive() // don't remove passive auras && (!(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) || !(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNK8)) // not unaffected by invulnerability auras or not having that unknown flag (that seemed the most probable) && (aurApp->IsPositive() ^ onleave)) // remove positive buffs on enter, negative buffs on leave @@ -4792,7 +4792,7 @@ void Unit::AddGameObject(GameObject* gameObj) m_gameObj.push_back(gameObj); gameObj->SetOwnerGUID(GetGUID()); - if ( GetTypeId() == TYPEID_PLAYER && gameObj->GetSpellId() ) + if (GetTypeId() == TYPEID_PLAYER && gameObj->GetSpellId()) { SpellEntry const* createBySpell = sSpellStore.LookupEntry(gameObj->GetSpellId()); // Need disable spell use for owner @@ -4824,7 +4824,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del) if (GetTypeId() == TYPEID_PLAYER) { - SpellEntry const* createBySpell = sSpellStore.LookupEntry(spellid ); + SpellEntry const* createBySpell = sSpellStore.LookupEntry(spellid); // Need activate spell use for owner if (createBySpell && createBySpell->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE) // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases) @@ -4895,7 +4895,7 @@ void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log) data << uint32(log->blocked); // blocked data << uint32(log->HitInfo); data << uint8 (0); // flag to use extend data - SendMessageToSet( &data, true ); + SendMessageToSet(&data, true); } void Unit::SendSpellNonMeleeDamageLog(Unit *target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit) @@ -5045,7 +5045,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) data << uint32(0); } - SendMessageToSet( &data, true ); + SendMessageToSet(&data, true); } void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount) @@ -5174,7 +5174,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE if (!target || target!=this && !target->isAlive()) return false; - if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; if (basepoints0) @@ -5182,7 +5182,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if ( cooldown && GetTypeId() == TYPEID_PLAYER ) + if (cooldown && GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; @@ -5610,7 +5610,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // mana cost save int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; basepoints0 = cost * triggerAmount/100; - if ( basepoints0 <=0 ) + if (basepoints0 <=0) return false; target = this; @@ -5665,7 +5665,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; basepoints0 = cost * triggerAmount/100; - if ( basepoints0 <=0 ) + if (basepoints0 <=0) return false; triggered_spell_id = 44450; target = this; @@ -5843,7 +5843,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if (procSpell && procSpell->Id == 27285) return false; // if damage is more than need or target die from damage deal finish spell - if ( triggeredByAura->GetAmount() <= damage || GetHealth() <= damage ) + if (triggeredByAura->GetAmount() <= damage || GetHealth() <= damage) { // remember guid before aura delete uint64 casterGuid = triggeredByAura->GetCasterGUID(); @@ -5865,7 +5865,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if (dummySpell->SpellFamilyFlags.IsEqual(0,0,0) && dummySpell->SpellIconID == 1932) { // if damage is more than need deal finish spell - if ( triggeredByAura->GetAmount() <= damage ) + if (triggeredByAura->GetAmount() <= damage) { // remember guid before aura delete uint64 casterGuid = triggeredByAura->GetCasterGUID(); @@ -5996,7 +5996,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case SPELLFAMILY_PRIEST: { // Vampiric Touch - if ( dummySpell->SpellFamilyFlags[1] & 0x00000400 ) + if (dummySpell->SpellFamilyFlags[1] & 0x00000400) { if (!pVictim || !pVictim->isAlive()) return false; @@ -6055,10 +6055,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case 40438: { // Shadow Word: Pain - if ( procSpell->SpellFamilyFlags[0] & 0x8000 ) + if (procSpell->SpellFamilyFlags[0] & 0x8000) triggered_spell_id = 40441; // Renew - else if ( procSpell->SpellFamilyFlags[0] & 0x40 ) + else if (procSpell->SpellFamilyFlags[0] & 0x40) triggered_spell_id = 40440; else return false; @@ -6126,7 +6126,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set case 39372: { - if (!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW))==0 ) + if (!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW))==0) return false; // heal amount @@ -6241,19 +6241,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger float chance; // Starfire - if ( procSpell->SpellFamilyFlags[0] & 0x4 ) + if (procSpell->SpellFamilyFlags[0] & 0x4) { triggered_spell_id = 40445; chance = 25.0f; } // Rejuvenation - else if ( procSpell->SpellFamilyFlags[0] & 0x10 ) + else if (procSpell->SpellFamilyFlags[0] & 0x10) { triggered_spell_id = 40446; chance = 25.0f; } // Mangle (Bear) and Mangle (Cat) - else if ( procSpell->SpellFamilyFlags[1] & 0x00000440) + else if (procSpell->SpellFamilyFlags[1] & 0x00000440) { triggered_spell_id = 40452; chance = 40.0f; @@ -6348,7 +6348,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger } } // Cut to the Chase - if ( dummySpell->SpellIconID == 2909 ) + if (dummySpell->SpellIconID == 2909) { // "refresh your Slice and Dice duration to its 5 combo point maximum" // lookup Slice and Dice @@ -6360,13 +6360,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger return false; } // Deadly Brew - else if ( dummySpell->SpellIconID == 2963 ) + else if (dummySpell->SpellIconID == 2963) { triggered_spell_id = 3409; break; } // Quick Recovery - else if ( dummySpell->SpellIconID == 2116 ) + else if (dummySpell->SpellIconID == 2116) { if (!procSpell) return false; @@ -6385,7 +6385,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case SPELLFAMILY_HUNTER: { // Thrill of the Hunt - if ( dummySpell->SpellIconID == 2236 ) + if (dummySpell->SpellIconID == 2236) { if (!procSpell) return false; @@ -6401,14 +6401,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger break; } // Hunting Party - if ( dummySpell->SpellIconID == 3406 ) + if (dummySpell->SpellIconID == 3406) { triggered_spell_id = 57669; target = this; break; } // Improved Mend Pet - if ( dummySpell->SpellIconID == 267 ) + if (dummySpell->SpellIconID == 267) { int32 chance = triggeredByAura->GetSpellProto()->EffectBasePoints[triggeredByAura->GetEffIndex()]; if (!roll_chance_i(chance)) @@ -6418,7 +6418,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger break; } // Lock and Load - if ( dummySpell->SpellIconID == 3579 ) + if (dummySpell->SpellIconID == 3579) { // Proc only from periodic (from trap activation proc another aura of this spell) if (!(procFlag & PROC_FLAG_ON_DO_PERIODIC) || !roll_chance_i(triggerAmount)) @@ -6624,7 +6624,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger return false; // At melee attack or Hammer of the Righteous spell damage considered as melee attack - if ((procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT) || (procSpell && procSpell->Id == 53595) ) + if ((procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT) || (procSpell && procSpell->Id == 53595)) triggered_spell_id = 31803; // On target with 5 stacks of Holy Vengeance direct damage is done if (Aura * aur = pVictim->GetAura(triggered_spell_id, GetGUID())) @@ -6686,13 +6686,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal) case 40470: { - if ( !procSpell ) + if (!procSpell) return false; float chance; // Flash of light/Holy light - if ( procSpell->SpellFamilyFlags[0] & 0xC0000000) + if (procSpell->SpellFamilyFlags[0] & 0xC0000000) { triggered_spell_id = 40471; chance = 15.0f; @@ -6776,7 +6776,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Totemic Power (The Earthshatterer set) case 28823: { - if ( !pVictim ) + if (!pVictim) return false; // Set class defined buff @@ -6818,7 +6818,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger return false; // custom cooldown processing case - if ( cooldown && this->ToPlayer()->HasSpellCooldown(dummySpell->Id)) + if (cooldown && this->ToPlayer()->HasSpellCooldown(dummySpell->Id)) return false; if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID()) @@ -6876,11 +6876,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger triggered_spell_id = 25504; // apply cooldown before cast to prevent processing itself - if ( cooldown ) + if (cooldown) this->ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown); // Attack Twice - for (uint32 i = 0; i<2; ++i ) + for (uint32 i = 0; i<2; ++i) CastCustomSpell(pVictim,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); return true; @@ -6941,7 +6941,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Shaman T8 Elemental 4P Bonus case 64928: { - basepoints0 = int32( triggerAmount * damage / 100 ); + basepoints0 = int32(triggerAmount * damage / 100); triggered_spell_id = 64930; // Electrified break; } @@ -7013,22 +7013,22 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger add_spellpower= add_spellpower / 100.0 * 3.84; // Enchant on Off-Hand and ready? - if ( castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && isAttackReady(OFF_ATTACK)) + if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && isAttackReady(OFF_ATTACK)) { float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK)/1000.0; // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed - basepoints0 = int32( (fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed) ); + basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed)); triggered_spell_id = 10444; } // Enchant on Main-Hand and ready? - else if ( castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK)) + else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK)) { float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK)/1000.0; // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed - basepoints0 = int32( (fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed) ); + basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed)); triggered_spell_id = 10444; } @@ -7067,11 +7067,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Lightning Overload if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura { - if (!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim ) + if (!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim) return false; // custom cooldown processing case - if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(dummySpell->Id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(dummySpell->Id)) return false; uint32 spellId = 0; @@ -7125,7 +7125,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger this->ToPlayer()->AddSpellMod(mod, false); - if ( cooldown && GetTypeId() == TYPEID_PLAYER ) + if (cooldown && GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown); return true; @@ -7425,7 +7425,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) return false; - if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; if (basepoints0) @@ -7433,7 +7433,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura, originalCaster); - if ( cooldown && GetTypeId() == TYPEID_PLAYER ) + if (cooldown && GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; @@ -7456,7 +7456,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* case SPELLFAMILY_HUNTER: { // Aspect of the Viper - if ( dummySpell->SpellFamilyFlags[1] & 0x40000 ) + if (dummySpell->SpellFamilyFlags[1] & 0x40000) { uint32 maxmana = GetMaxPower(POWER_MANA); basepoints0 = maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f; @@ -7484,14 +7484,14 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) return false; - if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; if (basepoints0) CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if ( cooldown && GetTypeId() == TYPEID_PLAYER ) + if (cooldown && GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; } @@ -7513,7 +7513,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff case SPELLFAMILY_PALADIN: { // Blessing of Sanctuary - if ( dummySpell->SpellFamilyFlags[0] & 0x10000000 ) + if (dummySpell->SpellFamilyFlags[0] & 0x10000000) { switch (getPowerType()) { @@ -7541,7 +7541,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) return false; - if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; if (basepoints0) @@ -7549,7 +7549,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if ( cooldown && GetTypeId() == TYPEID_PLAYER ) + if (cooldown && GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; @@ -7576,7 +7576,7 @@ bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura * triggeredByAura, return false; //last charge and crit - if (triggeredByAura->GetCharges() <= 1 && (procEx & PROC_EX_CRITICAL_HIT) ) + if (triggeredByAura->GetCharges() <= 1 && (procEx & PROC_EX_CRITICAL_HIT)) { RemoveAurasDueToSpell(28682); //-> remove Combustion auras return true; // charge counting (will removed) @@ -7637,13 +7637,13 @@ bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura * triggeredByAura, if (dummySpell->SpellIconID == 2622) { if (((Player*)this)->GetCurrentRune(i) == RUNE_DEATH || - ((Player*)this)->GetBaseRune(i) == RUNE_BLOOD ) + ((Player*)this)->GetBaseRune(i) == RUNE_BLOOD) continue; } else { if (((Player*)this)->GetCurrentRune(i) == RUNE_DEATH || - ((Player*)this)->GetBaseRune(i) != RUNE_BLOOD ) + ((Player*)this)->GetBaseRune(i) != RUNE_BLOOD) continue; } if (((Player*)this)->GetRuneCooldown(i) != ((Player*)this)->GetRuneBaseCooldown(i)) @@ -8082,7 +8082,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // All ok. Check current trigger spell SpellEntry const* triggerEntry = sSpellStore.LookupEntry(trigger_spell_id); - if ( triggerEntry == NULL ) + if (triggerEntry == NULL) { // Not cast unknown spell // sLog.outError("Unit::HandleProcTriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",auraSpellInfo->Id,triggeredByAura->GetEffIndex()); @@ -8090,7 +8090,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig } // not allow proc extra attack spell at extra attack - if ( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) + if (m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS)) return false; // Custom requirements (not listed in procEx) Warning! damage dealing after this @@ -8228,12 +8228,12 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig if (!target) return false; - if ( cooldown && GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->HasSpellCooldown(trigger_spell_id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->HasSpellCooldown(trigger_spell_id)) return false; target->CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura); - if ( cooldown && GetTypeId() == TYPEID_PLAYER ) + if (cooldown && GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown); return true; } @@ -8378,11 +8378,11 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig } } - if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(trigger_spell_id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(trigger_spell_id)) return false; // try detect target manually if not set - if ( target == NULL ) + if (target == NULL) target = !(procFlags & (PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT)) && IsPositiveSpell(trigger_spell_id) ? this : pVictim; // default case @@ -8394,7 +8394,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig else CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura); - if ( cooldown && GetTypeId() == TYPEID_PLAYER ) + if (cooldown && GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown); return true; @@ -8487,12 +8487,12 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraE return false; } - if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; CastSpell(pVictim, triggered_spell_id, true, castItem, triggeredByAura); - if ( cooldown && GetTypeId() == TYPEID_PLAYER ) + if (cooldown && GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; @@ -8671,7 +8671,7 @@ bool Unit::IsHostileTo(Unit const* unit) const // apply reputation state FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction); - if (raw_tester_faction && raw_tester_faction->reputationListID >=0 ) + if (raw_tester_faction && raw_tester_faction->reputationListID >=0) return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction) <= REP_HOSTILE; } } @@ -9934,7 +9934,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 int32 sumNegativeMod = 0; // sum the negative amount aura (that reduce the damage taken) AuraEffectList const& mModDamagePercentTaken = pVictim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); for (AuraEffectList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) - if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto) ) + if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto)) { if ((*i)->GetAmount() > 0) { @@ -10060,7 +10060,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } } // Distribute Damage over multiple effects, reduce by AoE - CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); + CastingTime = GetCastingTimeForBonus(spellProto, damagetype, CastingTime); // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) @@ -10117,7 +10117,7 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) if (((*i)->GetMiscValue() & schoolMask) != 0 && (*i)->GetSpellProto()->EquippedItemClass == -1 && // -1 == any item class (not wand then) - (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 ) + (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0) // 0 == any inventory type (not wand then) DoneAdvertisedBenefit += (*i)->GetAmount(); @@ -10185,7 +10185,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM crit_chance = 0.0f; // For other schools else if (GetTypeId() == TYPEID_PLAYER) - crit_chance = GetFloatValue( PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask)); + crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask)); else { crit_chance = m_baseSpellCritChance; @@ -10455,7 +10455,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint if (aura->GetCasterGUID()!=GetGUID()) continue; SpellEntry const* m_spell = aura->GetSpellProto(); - if ( m_spell->SpellFamilyName != SPELLFAMILY_DRUID || + if (m_spell->SpellFamilyName != SPELLFAMILY_DRUID || !(m_spell->SpellFamilyFlags[1] & 0x00000010 || m_spell->SpellFamilyFlags[0] & 0x50)) continue; modPercent += stepPercent * aura->GetStackAmount(); @@ -10579,12 +10579,12 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint } } // Distribute Damage over multiple effects, reduce by AoE - CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); + CastingTime = GetCastingTimeForBonus(spellProto, damagetype, CastingTime); // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) { if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || - spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH ) + spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) { CastingTime /= 2; break; @@ -10658,7 +10658,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint AuraEffectList const& mHealingGet= pVictim->GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) - if (GetGUID()==(*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto) ) + if (GetGUID()==(*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) TakenTotalMod *= ((*i)->GetAmount() + 100.0f) / 100.0f; heal = (int32(heal) + TakenTotal) * TakenTotalMod; @@ -11176,7 +11176,7 @@ void Unit::ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType ty for (AuraApplicationMap::iterator itr = auras.begin(); itr != auras.end();) { SpellEntry const* spell = itr->second->GetBase()->GetSpellProto(); - if ((1<<spell->Dispel) & dispelMask ) + if ((1<<spell->Dispel) & dispelMask) { // Dispel aura RemoveAura(itr); @@ -11217,7 +11217,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId) if (mount) SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, mount); - SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT ); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT); // unsummon pet if (GetTypeId() == TYPEID_PLAYER) @@ -11243,13 +11243,13 @@ void Unit::Mount(uint32 mount, uint32 VehicleId) GetVehicleKit()->Reset(); // Send others that we now have a vehicle - WorldPacket data( SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size()+4); + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size()+4); data.appendPackGUID(GetGUID()); data << uint32(VehicleId); - SendMessageToSet( &data,true ); + SendMessageToSet(&data,true); data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0); - this->ToPlayer()->GetSession()->SendPacket( &data ); + this->ToPlayer()->GetSession()->SendPacket(&data); } } } @@ -11265,7 +11265,7 @@ void Unit::Unmount() RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_MOUNTED); SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); - RemoveFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT ); + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT); // only resummon old pet if the player is already added to a map // this prevents adding a pet to a not created map which would otherwise cause a crash @@ -11283,7 +11283,7 @@ void Unit::Unmount() if (GetTypeId()==TYPEID_PLAYER && GetVehicleKit()) { // Send other players that we are no longer a vehicle - WorldPacket data( SMSG_PLAYER_VEHICLE_DATA, 8+4 ); + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4); data.appendPackGUID(GetGUID()); data << uint32(0); this->ToPlayer()->SendMessageToSet(&data, true); @@ -11361,7 +11361,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) if (GetTypeId() != TYPEID_PLAYER) { // Set home position at place of engaging combat for escorted creatures - if (( IsAIEnabled && this->ToCreature()->AI()->IsEscorted() ) || + if ((IsAIEnabled && this->ToCreature()->AI()->IsEscorted()) || GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE || GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) this->ToCreature()->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); @@ -11783,7 +11783,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) SetSpeed(mtype, speed, forced); } -float Unit::GetSpeed( UnitMoveType mtype ) const +float Unit::GetSpeed(UnitMoveType mtype) const { return m_speed_rate[mtype]*(IsControlledByPlayer() ? playerBaseMoveSpeed[mtype] : baseMoveSpeed[mtype]); } @@ -11848,7 +11848,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data << float(GetOrientation()); data << uint32(0); // fall time data << float(GetSpeed(mtype)); - SendMessageToSet( &data, true ); + SendMessageToSet(&data, true); } else { @@ -11901,7 +11901,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) if (mtype == MOVE_RUN) data << uint8(0); // new 2.1.0 data << float(GetSpeed(mtype)); - SendMessageToSet( &data, true ); + SendMessageToSet(&data, true); } } @@ -12493,7 +12493,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un duration = int32(duration * mod); } -void Unit::ApplyDiminishingAura( DiminishingGroup group, bool apply ) +void Unit::ApplyDiminishingAura(DiminishingGroup group, bool apply) { // Checking for existing in the table for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i) @@ -12560,7 +12560,7 @@ Creature* Unit::GetCreature(WorldObject& object, uint64 guid) return object.GetMap()->GetCreature(guid); } -bool Unit::isVisibleForInState( Player const* u, bool inVisibleList ) const +bool Unit::isVisibleForInState(Player const* u, bool inVisibleList) const { return u->canSeeOrDetect(this, false, inVisibleList, false); } @@ -12966,7 +12966,7 @@ void Unit::ApplyMaxPowerMod(Powers power, uint32 val, bool apply) } } -uint32 Unit::GetCreatePowers( Powers power ) const +uint32 Unit::GetCreatePowers(Powers power) const { // POWER_FOCUS and POWER_HAPPINESS only have hunter pet switch (power) @@ -13294,7 +13294,7 @@ void CharmInfo::SetPetNumber(uint32 petnumber, bool statwindow) m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, 0); } -void CharmInfo::LoadPetActionBar(const std::string& data ) +void CharmInfo::LoadPetActionBar(const std::string& data) { InitPetActionBar(); @@ -13325,13 +13325,13 @@ void CharmInfo::LoadPetActionBar(const std::string& data ) } } -void CharmInfo::BuildActionBar( WorldPacket* data ) +void CharmInfo::BuildActionBar(WorldPacket* data) { for (uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) *data << uint32(PetActionBar[i].packedData); } -void CharmInfo::SetSpellAutocast( uint32 spell_id, bool state ) +void CharmInfo::SetSpellAutocast(uint32 spell_id, bool state) { for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) { @@ -13489,7 +13489,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag, if (getClass() != CLASS_ROGUE) // skip Rogue Riposte { ModifyAuraState(AURA_STATE_DEFENSE, true); - StartReactiveTimer( REACTIVE_DEFENSE ); + StartReactiveTimer(REACTIVE_DEFENSE); } } // if victim and parry attack @@ -13499,19 +13499,19 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag, if (getClass() == CLASS_HUNTER) { ModifyAuraState(AURA_STATE_HUNTER_PARRY, true); - StartReactiveTimer( REACTIVE_HUNTER_PARRY ); + StartReactiveTimer(REACTIVE_HUNTER_PARRY); } else { ModifyAuraState(AURA_STATE_DEFENSE, true); - StartReactiveTimer( REACTIVE_DEFENSE ); + StartReactiveTimer(REACTIVE_DEFENSE); } } // if and victim block attack if (procExtra & PROC_EX_BLOCK) { ModifyAuraState(AURA_STATE_DEFENSE,true); - StartReactiveTimer( REACTIVE_DEFENSE ); + StartReactiveTimer(REACTIVE_DEFENSE); } } else //For attacker @@ -13520,7 +13520,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag, if (procExtra&PROC_EX_DODGE && GetTypeId() == TYPEID_PLAYER && getClass() == CLASS_WARRIOR) { this->ToPlayer()->AddComboPoints(pTarget, 1); - StartReactiveTimer( REACTIVE_OVERPOWER ); + StartReactiveTimer(REACTIVE_OVERPOWER); } } } @@ -13958,7 +13958,7 @@ void Unit::ClearAllReactives() this->ToPlayer()->ClearComboPoints(); } -void Unit::UpdateReactives( uint32 p_time ) +void Unit::UpdateReactives(uint32 p_time) { for (uint8 i = 0; i < MAX_REACTIVE; ++i) { @@ -13967,18 +13967,18 @@ void Unit::UpdateReactives( uint32 p_time ) if (!m_reactiveTimer[reactive]) continue; - if ( m_reactiveTimer[reactive] <= p_time) + if (m_reactiveTimer[reactive] <= p_time) { m_reactiveTimer[reactive] = 0; - switch ( reactive ) + switch (reactive) { case REACTIVE_DEFENSE: if (HasAuraState(AURA_STATE_DEFENSE)) ModifyAuraState(AURA_STATE_DEFENSE, false); break; case REACTIVE_HUNTER_PARRY: - if ( getClass() == CLASS_HUNTER && HasAuraState(AURA_STATE_HUNTER_PARRY)) + if (getClass() == CLASS_HUNTER && HasAuraState(AURA_STATE_HUNTER_PARRY)) ModifyAuraState(AURA_STATE_HUNTER_PARRY, false); break; case REACTIVE_OVERPOWER: @@ -14033,7 +14033,7 @@ Unit* Unit::SelectNearbyTarget(float dist) const return *tcIter; } -void Unit::ApplyAttackTimePercentMod( WeaponAttackType att,float val, bool apply ) +void Unit::ApplyAttackTimePercentMod(WeaponAttackType att,float val, bool apply) { float remainingTimePct = (float)m_attackTimer[att] / (GetAttackTime(att) * m_modAttackSpeedPct[att]); if (val > 0) @@ -14049,7 +14049,7 @@ void Unit::ApplyAttackTimePercentMod( WeaponAttackType att,float val, bool apply m_attackTimer[att] = uint32(GetAttackTime(att) * m_modAttackSpeedPct[att] * remainingTimePct); } -void Unit::ApplyCastTimePercentMod(float val, bool apply ) +void Unit::ApplyCastTimePercentMod(float val, bool apply) { if (val > 0) ApplyPercentModFloatValue(UNIT_MOD_CAST_SPEED,val,!apply); @@ -14057,7 +14057,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply ) ApplyPercentModFloatValue(UNIT_MOD_CAST_SPEED,-val,apply); } -uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime ) +uint32 Unit::GetCastingTimeForBonus(SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime) { // Not apply this to creature casted spells with casttime==0 if (CastingTime==0 && GetTypeId() == TYPEID_UNIT && !this->ToCreature()->isPet()) @@ -14076,7 +14076,7 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT for (uint32 i=0; i<MAX_SPELL_EFFECTS; i++) { - switch ( spellProto->Effect[i] ) + switch (spellProto->Effect[i]) { case SPELL_EFFECT_SCHOOL_DAMAGE: case SPELL_EFFECT_POWER_DRAIN: @@ -14087,12 +14087,12 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT DirectDamage = true; break; case SPELL_EFFECT_APPLY_AURA: - switch ( spellProto->EffectApplyAuraName[i] ) + switch (spellProto->EffectApplyAuraName[i]) { case SPELL_AURA_PERIODIC_DAMAGE: case SPELL_AURA_PERIODIC_HEAL: case SPELL_AURA_PERIODIC_LEECH: - if ( GetSpellDuration(spellProto) ) + if (GetSpellDuration(spellProto)) overTime = GetSpellDuration(spellProto); break; default: @@ -14109,7 +14109,7 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT } // Combined Spells with Both Over Time and Direct Damage - if ( overTime > 0 && CastingTime > 0 && DirectDamage ) + if (overTime > 0 && CastingTime > 0 && DirectDamage) { // mainly for DoTs which are 3500 here otherwise uint32 OriginalCastTime = GetSpellCastTime(spellProto); @@ -14118,22 +14118,22 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT // Portion to Over Time float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f)); - if ( damagetype == DOT ) + if (damagetype == DOT) CastingTime = uint32(CastingTime * PtOT); - else if ( PtOT < 1.0f ) + else if (PtOT < 1.0f) CastingTime = uint32(CastingTime * (1 - PtOT)); else CastingTime = 0; } // Area Effect Spells receive only half of bonus - if ( AreaEffect ) + if (AreaEffect) CastingTime /= 2; // -5% of total per any additional effect for (uint8 i=0; i<effects; ++i) { - if ( CastingTime > 175 ) + if (CastingTime > 175) { CastingTime -= 175; } @@ -14286,7 +14286,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) return pet; } -bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent ) +bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent) { SpellEntry const *spellProto = aura->GetSpellProto(); @@ -15224,8 +15224,8 @@ Unit *Unit::GetVehicleBase() const Creature *Unit::GetVehicleCreatureBase() const { - if ( Unit *veh = GetVehicleBase()) - if ( Creature *c = veh->ToCreature()) + if (Unit *veh = GetVehicleBase()) + if (Creature *c = veh->ToCreature()) return c; return NULL; @@ -16041,7 +16041,7 @@ void Unit::SetFlying(bool apply) } } -void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool casting /*= false*/ ) +void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool casting /*= false*/) { if (GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0)); @@ -16091,7 +16091,7 @@ void Unit::SendThreatListUpdate() { if (uint32 count = getThreatManager().getThreatList().size()) { - //sLog.outDebug( "WORLD: Send SMSG_THREAT_UPDATE Message" ); + //sLog.outDebug("WORLD: Send SMSG_THREAT_UPDATE Message"); WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); data.append(GetPackGUID()); data << uint32(count); @@ -16109,7 +16109,7 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) { if (uint32 count = getThreatManager().getThreatList().size()) { - sLog.outDebug( "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message" ); + sLog.outDebug("WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); data.append(GetPackGUID()); data.appendPackGUID(pHostileReference->getUnitGuid()); @@ -16126,7 +16126,7 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) void Unit::SendClearThreatListOpcode() { - sLog.outDebug( "WORLD: Send SMSG_THREAT_CLEAR Message" ); + sLog.outDebug("WORLD: Send SMSG_THREAT_CLEAR Message"); WorldPacket data(SMSG_THREAT_CLEAR, 8); data.append(GetPackGUID()); SendMessageToSet(&data, false); @@ -16134,14 +16134,14 @@ void Unit::SendClearThreatListOpcode() void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference) { - sLog.outDebug( "WORLD: Send SMSG_THREAT_REMOVE Message" ); + sLog.outDebug("WORLD: Send SMSG_THREAT_REMOVE Message"); WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8); data.append(GetPackGUID()); data.appendPackGUID(pHostileReference->getUnitGuid()); SendMessageToSet(&data, false); } -void Unit::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker ) +void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker) { float addRage; diff --git a/src/game/Unit.h b/src/game/Unit.h index dfe124652b6..2a4f4726ca8 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -218,7 +218,7 @@ enum ShapeshiftForm FORM_SPIRITOFREDEMPTION = 0x20 }; -// low byte ( 0 from 0..3 ) of UNIT_FIELD_BYTES_2 +// low byte (0 from 0..3) of UNIT_FIELD_BYTES_2 enum SheathState { SHEATH_STATE_UNARMED = 0, // non prepared weapon @@ -1095,7 +1095,7 @@ class Unit : public WorldObject typedef std::map<uint8, AuraApplication*> VisibleAuraMap; - virtual ~Unit ( ); + virtual ~Unit (); void AddToWorld(); void RemoveFromWorld(); @@ -1113,7 +1113,7 @@ class Unit : public WorldObject uint32 GetSpellMinRangeForTarget(Unit* target,const SpellRangeEntry * rangeEntry); uint32 GetSpellRadiusForTarget(Unit* target,const SpellRadiusEntry * radiusEntry); - virtual void Update( uint32 time ); + virtual void Update(uint32 time); void setAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; } void resetAttackTimer(WeaponAttackType type = BASE_ATTACK); @@ -1126,7 +1126,7 @@ class Unit : public WorldObject float GetMeleeReach() const { float reach = m_floatValues[UNIT_FIELD_COMBATREACH]; return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH; } bool IsWithinCombatRange(const Unit *obj, float dist2compare) const; bool IsWithinMeleeRange(const Unit *obj, float dist = MELEE_RANGE) const; - void GetRandomContactPoint( const Unit* target, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const; + void GetRandomContactPoint(const Unit* target, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const; uint32 m_extraAttacks; bool m_canDualWield; @@ -1169,7 +1169,7 @@ class Unit : public WorldObject bool CanFreeMove() const { return !hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_IN_FLIGHT | - UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED ) && GetOwnerGUID()==0; + UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) && GetOwnerGUID()==0; } uint32 HasUnitTypeMask(uint32 mask) const { return mask & m_unitTypeMask; } @@ -1200,16 +1200,16 @@ class Unit : public WorldObject uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); } uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } - void SetHealth( uint32 val); + void SetHealth(uint32 val); void SetMaxHealth(uint32 val); int32 ModifyHealth(int32 val); int32 GetHealthGain(int32 dVal); Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); } void setPowerType(Powers power); - uint32 GetPower( Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 +power); } + uint32 GetPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 +power); } uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1+power); } - void SetPower( Powers power, uint32 val); + void SetPower(Powers power, uint32 val); void SetMaxPower(Powers power, uint32 val); int32 ModifyPower(Powers power, int32 val); void ApplyPowerMod(Powers power, uint32 val, bool apply); @@ -1226,11 +1226,11 @@ class Unit : public WorldObject void ApplyCastTimePercentMod(float val, bool apply); SheathState GetSheath() const { return SheathState(GetByteValue(UNIT_FIELD_BYTES_2, 0)); } - virtual void SetSheath( SheathState sheathed ) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); } + virtual void SetSheath(SheathState sheathed) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); } // faction template id uint32 getFaction() const { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); } - void setFaction(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction ); } + void setFaction(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); } FactionTemplateEntry const* getFactionTemplateEntry() const; bool IsHostileTo(Unit const* unit) const; bool IsHostileToPlayers() const; @@ -1271,7 +1271,7 @@ class Unit : public WorldObject void SetStandFlags(uint8 flags) { SetByteFlag(UNIT_FIELD_BYTES_1, 2,flags); } void RemoveStandFlags(uint8 flags) { RemoveByteFlag(UNIT_FIELD_BYTES_1, 2,flags); } - bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT ); } + bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT); } uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); } void Mount(uint32 mount, uint32 vehicleId=0); void Unmount(); @@ -1283,10 +1283,10 @@ class Unit : public WorldObject int32 DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical = false); void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = NULL, SpellEntry const * procAura = NULL); - void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage , SpellEntry const * procAura = NULL); + void ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage , SpellEntry const * procAura = NULL); void HandleEmoteCommand(uint32 anim_id); - void AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false ); + void AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false); //float MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) const; @@ -1322,7 +1322,7 @@ class Unit : public WorldObject float GetUnitBlockChance() const; float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const; int32 GetMechanicResistChance(const SpellEntry *spell); - bool CanUseAttackType( uint8 attacktype ) const + bool CanUseAttackType(uint8 attacktype) const { switch(attacktype) { @@ -1343,29 +1343,29 @@ class Unit : public WorldObject MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType) const; MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const; - bool isVendor() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR ); } - bool isTrainer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER ); } - bool isQuestGiver() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER ); } - bool isGossip() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP ); } - bool isTaxi() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER ); } - bool isGuildMaster() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PETITIONER ); } - bool isBattleMaster() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BATTLEMASTER ); } - bool isBanker() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER ); } - bool isInnkeeper() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER ); } - bool isSpiritHealer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER ); } - bool isSpiritGuide() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITGUIDE ); } - bool isTabardDesigner()const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TABARDDESIGNER ); } - bool isAuctioner() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_AUCTIONEER ); } - bool isArmorer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_REPAIR ); } + bool isVendor() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR); } + bool isTrainer() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER); } + bool isQuestGiver() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } + bool isGossip() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } + bool isTaxi() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER); } + bool isGuildMaster() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PETITIONER); } + bool isBattleMaster() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BATTLEMASTER); } + bool isBanker() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER); } + bool isInnkeeper() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER); } + bool isSpiritHealer() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER); } + bool isSpiritGuide() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITGUIDE); } + bool isTabardDesigner()const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TABARDDESIGNER); } + bool isAuctioner() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_AUCTIONEER); } + bool isArmorer() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_REPAIR); } bool isServiceProvider() const { - return HasFlag( UNIT_NPC_FLAGS, + return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR | UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_FLIGHTMASTER | UNIT_NPC_FLAG_PETITIONER | UNIT_NPC_FLAG_BATTLEMASTER | UNIT_NPC_FLAG_BANKER | UNIT_NPC_FLAG_INNKEEPER | UNIT_NPC_FLAG_GUARD | UNIT_NPC_FLAG_SPIRITHEALER | - UNIT_NPC_FLAG_SPIRITGUIDE | UNIT_NPC_FLAG_TABARDDESIGNER | UNIT_NPC_FLAG_AUCTIONEER ); + UNIT_NPC_FLAG_SPIRITGUIDE | UNIT_NPC_FLAG_TABARDDESIGNER | UNIT_NPC_FLAG_AUCTIONEER); } - bool isSpiritService() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER | UNIT_NPC_FLAG_SPIRITGUIDE ); } + bool isSpiritService() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER | UNIT_NPC_FLAG_SPIRITGUIDE); } //Need fix or use this bool isGuard() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GUARD); } @@ -1451,7 +1451,7 @@ class Unit : public WorldObject void OutMovementInfo() const; bool isAlive() const { return (m_deathState == ALIVE); }; - bool isDead() const { return ( m_deathState == DEAD || m_deathState == CORPSE ); }; + bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); }; DeathState getDeathState() { return m_deathState; }; virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet @@ -1593,7 +1593,7 @@ class Unit : public WorldObject AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; AuraEffect * GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags - AuraEffect * GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1 , uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0 ); + AuraEffect * GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1 , uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0); inline AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const { return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);} AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; @@ -1628,7 +1628,7 @@ class Unit : public WorldObject int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const; int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const; - float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school ); } + float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school); } void SetResistanceBuffMods(SpellSchools school, bool positive, float val) { SetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school,val); } void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply) { ApplyModSignedFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val, apply); } void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply) { ApplyPercentModFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val, apply); } @@ -1654,7 +1654,7 @@ class Unit : public WorldObject float GetCreateStat(Stats stat) const { return m_createStats[stat]; } void SetCurrentCastedSpell(Spell * pSpell); - virtual void ProhibitSpellScholl(SpellSchoolMask /*idSchoolMask*/, uint32 /*unTimeMs*/ ) { } + virtual void ProhibitSpellScholl(SpellSchoolMask /*idSchoolMask*/, uint32 /*unTimeMs*/) { } void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed = true, bool withInstant = true); void FinishSpell(CurrentSpellTypes spellType, bool ok = true); @@ -1753,7 +1753,7 @@ class Unit : public WorldObject void TauntFadeOut(Unit *taunter); ThreatManager& getThreatManager() { return m_ThreatManager; } void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); }; - void removeHatedBy(HostileReference* /*pHostileReference*/ ) { /* nothing to do yet */ } + void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ } HostileRefManager& getHostileRefManager() { return m_HostileRefManager; } VisibleAuraMap const *GetVisibleAuras() { return &m_visibleAuras; } @@ -1815,7 +1815,7 @@ class Unit : public WorldObject void SetContestedPvP(Player *attackedPlayer = NULL); void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL); - uint32 GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime ); + uint32 GetCastingTimeForBonus(SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime); void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply); @@ -1825,13 +1825,13 @@ class Unit : public WorldObject bool IsImmunedToDamage(SpellEntry const* spellInfo); virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const; // redefined in Creature - uint32 CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damageSchoolMask); + uint32 CalcNotIgnoreDamageRedunction(uint32 damage, SpellSchoolMask damageSchoolMask); uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=MAX_ATTACK); void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellEntry const *spellInfo = NULL); void UpdateSpeed(UnitMoveType mtype, bool forced); - float GetSpeed( UnitMoveType mtype ) const; - float GetSpeedRate( UnitMoveType mtype ) const { return m_speed_rate[mtype]; } + float GetSpeed(UnitMoveType mtype) const; + float GetSpeedRate(UnitMoveType mtype) const { return m_speed_rate[mtype]; } void SetSpeed(UnitMoveType mtype, float rate, bool forced = false); float m_TempSpeed; @@ -1846,7 +1846,7 @@ class Unit : public WorldObject float CalculateLevelPenalty(SpellEntry const* spellProto) const; void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); } - void removeFollower(FollowerReference* /*pRef*/ ) { /* nothing to do yet */ } + void removeFollower(FollowerReference* /*pRef*/) { /* nothing to do yet */ } static Unit* GetUnit(WorldObject& object, uint64 guid); static Player* GetPlayer(uint64 guid); static Creature* GetCreature(WorldObject& object, uint64 guid); @@ -1879,7 +1879,7 @@ class Unit : public WorldObject // reactive attacks void ClearAllReactives(); - void StartReactiveTimer( ReactiveType reactive ) { m_reactiveTimer[reactive] = REACTIVE_TIMER_START;} + void StartReactiveTimer(ReactiveType reactive) { m_reactiveTimer[reactive] = REACTIVE_TIMER_START;} void UpdateReactives(uint32 p_time); // group updates @@ -1887,7 +1887,7 @@ class Unit : public WorldObject // proc trigger system bool CanProc(){return !m_procDeep;} - void SetCantProc( bool apply) + void SetCantProc(bool apply) { if (apply) ++m_procDeep; @@ -1950,7 +1950,7 @@ class Unit : public WorldObject bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING); } void SetFlying(bool apply); - void RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker ); + void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker); virtual float GetFollowAngle() const { return M_PI/2; } @@ -2034,11 +2034,11 @@ class Unit : public WorldObject uint32 m_unitTypeMask; private: - bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const * procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent ); - bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleSpellCritChanceAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleObsModEnergyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const * procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent); + bool HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); bool HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); bool HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled); bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); diff --git a/src/game/UnitEvents.h b/src/game/UnitEvents.h index 4e492ea144d..a218e0dd34d 100644 --- a/src/game/UnitEvents.h +++ b/src/game/UnitEvents.h @@ -60,7 +60,7 @@ enum UNIT_EVENT_TYPE //UEV_UNIT_HEALTH_CHANGE = 1<<8, }; -#define UEV_THREAT_REF_EVENT_MASK ( UEV_THREAT_REF_ONLINE_STATUS | UEV_THREAT_REF_THREAT_CHANGE | UEV_THREAT_REF_REMOVE_FROM_LIST | UEV_THREAT_REF_ASSECCIBLE_STATUS) +#define UEV_THREAT_REF_EVENT_MASK (UEV_THREAT_REF_ONLINE_STATUS | UEV_THREAT_REF_THREAT_CHANGE | UEV_THREAT_REF_REMOVE_FROM_LIST | UEV_THREAT_REF_ASSECCIBLE_STATUS) #define UEV_THREAT_MANAGER_EVENT_MASK (UEV_THREAT_SORT_LIST | UEV_THREAT_SET_NEXT_TARGET | UEV_THREAT_VICTIM_CHANGED) #define UEV_ALL_EVENT_MASK (0xffffffff) diff --git a/src/game/UpdateData.cpp b/src/game/UpdateData.cpp index cc3ae62db09..68f0501f304 100644 --- a/src/game/UpdateData.cpp +++ b/src/game/UpdateData.cpp @@ -126,23 +126,23 @@ bool UpdateData::BuildPacket(WorldPacket *packet) size_t pSize = buf.wpos(); // use real used data size - if (pSize > 100 ) // compress large packets + if (pSize > 100) // compress large packets { uint32 destsize = compressBound(pSize); - packet->resize( destsize + sizeof(uint32) ); + packet->resize(destsize + sizeof(uint32)); packet->put<uint32>(0, pSize); Compress(const_cast<uint8*>(packet->contents()) + sizeof(uint32), &destsize, (void*)buf.contents(), pSize); if (destsize == 0) return false; - packet->resize( destsize + sizeof(uint32) ); - packet->SetOpcode( SMSG_COMPRESSED_UPDATE_OBJECT ); + packet->resize(destsize + sizeof(uint32)); + packet->SetOpcode(SMSG_COMPRESSED_UPDATE_OBJECT); } else // send small packets without compression { - packet->append( buf ); - packet->SetOpcode( SMSG_UPDATE_OBJECT ); + packet->append(buf); + packet->SetOpcode(SMSG_UPDATE_OBJECT); } return true; diff --git a/src/game/UpdateMask.h b/src/game/UpdateMask.h index 3b46cdc03ea..527bec42aa7 100644 --- a/src/game/UpdateMask.h +++ b/src/game/UpdateMask.h @@ -27,10 +27,10 @@ class UpdateMask { public: - UpdateMask( ) : mCount( 0 ), mBlocks( 0 ), mUpdateMask( 0 ) { } - UpdateMask( const UpdateMask& mask ) : mUpdateMask( 0 ) { *this = mask; } + UpdateMask() : mCount(0), mBlocks(0), mUpdateMask(0) { } + UpdateMask(const UpdateMask& mask) : mUpdateMask(0) { *this = mask; } - ~UpdateMask( ) + ~UpdateMask() { if (mUpdateMask) delete [] mUpdateMask; @@ -38,17 +38,17 @@ class UpdateMask void SetBit (uint32 index) { - ( (uint8 *)mUpdateMask )[ index >> 3 ] |= 1 << ( index & 0x7 ); + ((uint8 *)mUpdateMask)[ index >> 3 ] |= 1 << (index & 0x7); } void UnsetBit (uint32 index) { - ( (uint8 *)mUpdateMask )[ index >> 3 ] &= (0xff ^ (1 << ( index & 0x7 ) ) ); + ((uint8 *)mUpdateMask)[ index >> 3 ] &= (0xff ^ (1 << (index & 0x7))); } bool GetBit (uint32 index) const { - return ( ( (uint8 *)mUpdateMask)[ index >> 3 ] & ( 1 << ( index & 0x7 ) )) != 0; + return (((uint8 *)mUpdateMask)[ index >> 3 ] & (1 << (index & 0x7))) != 0; } uint32 GetBlockCount() const { return mBlocks; } @@ -74,7 +74,7 @@ class UpdateMask memset(mUpdateMask, 0, mBlocks << 2); } - UpdateMask& operator = ( const UpdateMask& mask ) + UpdateMask& operator = (const UpdateMask& mask) { SetCount(mask.mCount); memcpy(mUpdateMask, mask.mUpdateMask, mBlocks << 2); @@ -82,21 +82,21 @@ class UpdateMask return *this; } - void operator &= ( const UpdateMask& mask ) + void operator &= (const UpdateMask& mask) { ASSERT(mask.mCount <= mCount); for (uint32 i = 0; i < mBlocks; ++i) mUpdateMask[i] &= mask.mUpdateMask[i]; } - void operator |= ( const UpdateMask& mask ) + void operator |= (const UpdateMask& mask) { ASSERT(mask.mCount <= mCount); for (uint32 i = 0; i < mBlocks; ++i) mUpdateMask[i] |= mask.mUpdateMask[i]; } - UpdateMask operator & ( const UpdateMask& mask ) const + UpdateMask operator & (const UpdateMask& mask) const { ASSERT(mask.mCount <= mCount); @@ -107,7 +107,7 @@ class UpdateMask return newmask; } - UpdateMask operator | ( const UpdateMask& mask ) const + UpdateMask operator | (const UpdateMask& mask) const { ASSERT(mask.mCount <= mCount); diff --git a/src/game/VoiceChatHandler.cpp b/src/game/VoiceChatHandler.cpp index 6daa27f13e6..78aafe1999b 100644 --- a/src/game/VoiceChatHandler.cpp +++ b/src/game/VoiceChatHandler.cpp @@ -24,7 +24,7 @@ #include "Opcodes.h" #include "Log.h" -void WorldSession::HandleVoiceSessionEnableOpcode( WorldPacket & recv_data ) +void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_VOICE_SESSION_ENABLE"); // uint8 isVoiceEnabled, uint8 isMicrophoneEnabled @@ -33,14 +33,14 @@ void WorldSession::HandleVoiceSessionEnableOpcode( WorldPacket & recv_data ) recv_data.hexlike(); } -void WorldSession::HandleChannelVoiceOnOpcode( WorldPacket & recv_data ) +void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_CHANNEL_VOICE_ON"); // Enable Voice button in channel context menu recv_data.hexlike(); } -void WorldSession::HandleSetActiveVoiceChannel( WorldPacket & recv_data ) +void WorldSession::HandleSetActiveVoiceChannel(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL"); recv_data.read_skip<uint32>(); diff --git a/src/game/Weather.cpp b/src/game/Weather.cpp index 92fbb313d45..d027277e2e6 100644 --- a/src/game/Weather.cpp +++ b/src/game/Weather.cpp @@ -37,7 +37,7 @@ Weather::Weather(uint32 zone, WeatherZoneChances const* weatherChances) : m_zone m_type = WEATHER_TYPE_FINE; m_grade = 0; - sLog.outDetail("WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILISECONDS)) ); + sLog.outDetail("WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILISECONDS))); } /// Launch a weather update @@ -188,18 +188,18 @@ bool Weather::ReGenerate() void Weather::SendWeatherUpdateToPlayer(Player *player) { - WorldPacket data( SMSG_WEATHER, (4+4+4) ); + WorldPacket data(SMSG_WEATHER, (4+4+4)); data << uint32(GetWeatherState()) << (float)m_grade << uint8(0); - player->GetSession()->SendPacket( &data ); + player->GetSession()->SendPacket(&data); } void Weather::SendFineWeatherUpdateToPlayer(Player *player) { - WorldPacket data( SMSG_WEATHER, (4+4+4) ); + WorldPacket data(SMSG_WEATHER, (4+4+4)); data << (uint32)WEATHER_STATE_FINE << (float)0.0f << uint8(0); - player->GetSession()->SendPacket( &data ); + player->GetSession()->SendPacket(&data); } /// Send the new weather to all players in the zone @@ -217,9 +217,9 @@ bool Weather::UpdateWeather() WeatherState state = GetWeatherState(); - WorldPacket data( SMSG_WEATHER, (4+4+4) ); + WorldPacket data(SMSG_WEATHER, (4+4+4)); data << uint32(state) << (float)m_grade << uint8(0); - player->SendMessageToSet( &data, true ); + player->SendMessageToSet(&data, true); ///- Log the event char const* wthstr; diff --git a/src/game/World.cpp b/src/game/World.cpp index 79427a207c6..52868f618ac 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1416,7 +1416,7 @@ void World::SetInitialWorldSettings() sLog.outString("Loading Quests..."); objmgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables - sLog.outString( "Loading Quest POI" ); + sLog.outString("Loading Quest POI"); objmgr.LoadQuestPOI(); sLog.outString("Loading Quests Relations..."); @@ -1479,7 +1479,7 @@ void World::SetInitialWorldSettings() sLog.outString("Loading Player Corpses..."); objmgr.LoadCorpses(); - sLog.outString( "Loading Player level dependent mail rewards..." ); + sLog.outString("Loading Player level dependent mail rewards..."); objmgr.LoadMailLevelRewards(); sLog.outString("Loading Disabled Spells..."); @@ -2618,7 +2618,7 @@ void World::LoadWorldStates() while (result->NextRow()); sLog.outString(); - sLog.outString( ">> Loaded %u world states.", counter); + sLog.outString(">> Loaded %u world states.", counter); } // Setting a worldstate will save it to DB diff --git a/src/game/World.h b/src/game/World.h index 8132a657b23..488fc79d41f 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -557,7 +557,7 @@ class World void Update(uint32 diff); - void UpdateSessions( uint32 diff ); + void UpdateSessions(uint32 diff); /// Set a server rate (see #Rates) void setRate(Rates rate,float value) { rate_values[rate]=value; } /// Get a server rate (see #Rates) @@ -611,7 +611,7 @@ class World static int32 GetVisibilityNotifyPeriodInBGArenas() { return m_visibility_notify_periodInBGArenas; } void ProcessCliCommands(); - void QueueCliCommand( CliCommandHolder::Print* zprintf, char const* input ) { cliCmdQueue.add(new CliCommandHolder(input, zprintf)); } + void QueueCliCommand(CliCommandHolder::Print* zprintf, char const* input) { cliCmdQueue.add(new CliCommandHolder(input, zprintf)); } void UpdateResultQueue(); void InitResultQueue(); diff --git a/src/game/WorldLog.cpp b/src/game/WorldLog.cpp index 89c058c5ce2..a80e8711424 100644 --- a/src/game/WorldLog.cpp +++ b/src/game/WorldLog.cpp @@ -38,7 +38,7 @@ WorldLog::WorldLog() : i_file(NULL) WorldLog::~WorldLog() { - if ( i_file != NULL ) + if (i_file != NULL) fclose(i_file); i_file = NULL; } @@ -65,7 +65,7 @@ void WorldLog::Initialize() void WorldLog::outTimestampLog(char const *fmt, ...) { - if ( LogWorld() ) + if (LogWorld()) { Guard guard(*this); ASSERT(i_file); @@ -74,7 +74,7 @@ void WorldLog::outTimestampLog(char const *fmt, ...) va_list args; va_start(args, fmt); vfprintf(i_file, fmt, args); - //fprintf(i_file, "\n" ); + //fprintf(i_file, "\n"); va_end(args); fflush(i_file); @@ -93,7 +93,7 @@ void WorldLog::outTimestampLog(char const *fmt, ...) void WorldLog::outLog(char const *fmt, ...) { - if ( LogWorld() ) + if (LogWorld()) { Guard guard(*this); ASSERT(i_file); @@ -101,7 +101,7 @@ void WorldLog::outLog(char const *fmt, ...) va_list args; va_start(args, fmt); vfprintf(i_file, fmt, args); - //fprintf(i_file, "\n" ); + //fprintf(i_file, "\n"); va_end(args); fflush(i_file); diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 686f98ebeb9..427082dfeb0 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -150,7 +150,7 @@ void WorldSession::QueuePacket(WorldPacket* new_packet) /// Logging helper for unexpected opcodes void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char *reason) { - sLog.outError( "SESSION: received unexpected opcode %s (0x%.4X) %s", + sLog.outError("SESSION: received unexpected opcode %s (0x%.4X) %s", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), reason); @@ -159,7 +159,7 @@ void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char *reason) /// Logging helper for unexpected opcodes void WorldSession::LogUnprocessedTail(WorldPacket *packet) { - sLog.outError( "SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)", + sLog.outError("SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), packet->rpos(),packet->wpos()); @@ -176,14 +176,14 @@ bool WorldSession::Update(uint32 /*diff*/) while (_recvQueue.next(packet) && m_Socket && !m_Socket->IsClosed ()) { /*#if 1 - sLog.outError( "MOEP: %s (0x%.4X)", + sLog.outError("MOEP: %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); #endif*/ if (packet->GetOpcode() >= NUM_MSG_TYPES) { - sLog.outError( "SESSION: received non-existed opcode %s (0x%.4X)", + sLog.outError("SESSION: received non-existed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); } @@ -253,7 +253,7 @@ bool WorldSession::Update(uint32 /*diff*/) break; case STATUS_NEVER: break; - sLog.outError( "SESSION: received not allowed opcode %s (0x%.4X)", + sLog.outError("SESSION: received not allowed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); break; @@ -446,14 +446,14 @@ void WorldSession::LogoutPlayer(bool Save) SetPlayer(NULL); // deleted in Remove call ///- Send the 'logout complete' packet to the client - WorldPacket data( SMSG_LOGOUT_COMPLETE, 0 ); - SendPacket( &data ); + WorldPacket data(SMSG_LOGOUT_COMPLETE, 0); + SendPacket(&data); ///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline //No SQL injection as AccountId is uint32 CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'", GetAccountId()); - sLog.outDebug( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" ); + sLog.outDebug("SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); } //Hook for OnLogout Event @@ -480,7 +480,7 @@ void WorldSession::SendNotification(const char *format,...) char szStr [1024]; szStr[0] = '\0'; va_start(ap, format); - vsnprintf( szStr, 1024, format, ap ); + vsnprintf(szStr, 1024, format, ap); va_end(ap); WorldPacket data(SMSG_NOTIFICATION, (strlen(szStr)+1)); @@ -498,7 +498,7 @@ void WorldSession::SendNotification(int32 string_id,...) char szStr [1024]; szStr[0] = '\0'; va_start(ap, string_id); - vsnprintf( szStr, 1024, format, ap ); + vsnprintf(szStr, 1024, format, ap); va_end(ap); WorldPacket data(SMSG_NOTIFICATION, (strlen(szStr)+1)); @@ -507,35 +507,35 @@ void WorldSession::SendNotification(int32 string_id,...) } } -const char * WorldSession::GetTrinityString( int32 entry ) const +const char * WorldSession::GetTrinityString(int32 entry) const { return objmgr.GetTrinityString(entry,GetSessionDbLocaleIndex()); } -void WorldSession::Handle_NULL( WorldPacket& recvPacket ) +void WorldSession::Handle_NULL(WorldPacket& recvPacket) { - sLog.outError( "SESSION: received unhandled opcode %s (0x%.4X)", + sLog.outError("SESSION: received unhandled opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } -void WorldSession::Handle_EarlyProccess( WorldPacket& recvPacket ) +void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket) { - sLog.outError( "SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", + sLog.outError("SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } -void WorldSession::Handle_ServerSide( WorldPacket& recvPacket ) +void WorldSession::Handle_ServerSide(WorldPacket& recvPacket) { - sLog.outError( "SESSION: received server-side opcode %s (0x%.4X)", + sLog.outError("SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } -void WorldSession::Handle_Deprecated( WorldPacket& recvPacket ) +void WorldSession::Handle_Deprecated(WorldPacket& recvPacket) { - sLog.outError( "SESSION: received deprecated opcode %s (0x%.4X)", + sLog.outError("SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } @@ -544,14 +544,14 @@ void WorldSession::SendAuthWaitQue(uint32 position) { if (position == 0) { - WorldPacket packet( SMSG_AUTH_RESPONSE, 1 ); - packet << uint8( AUTH_OK ); + WorldPacket packet(SMSG_AUTH_RESPONSE, 1); + packet << uint8(AUTH_OK); SendPacket(&packet); } else { - WorldPacket packet( SMSG_AUTH_RESPONSE, 5 ); - packet << uint8( AUTH_WAIT_QUEUE ); + WorldPacket packet(SMSG_AUTH_RESPONSE, 5); + packet << uint8(AUTH_WAIT_QUEUE); packet << uint32 (position); SendPacket(&packet); } @@ -562,7 +562,7 @@ void WorldSession::LoadGlobalAccountData() LoadAccountData( CharacterDatabase.PQuery("SELECT type, time, data FROM account_data WHERE account='%u'", GetAccountId()), GLOBAL_CACHE_MASK - ); +); } void WorldSession::LoadAccountData(QueryResult_AutoPtr result, uint32 mask) @@ -630,7 +630,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, std::strin void WorldSession::SendAccountDataTimes(uint32 mask) { - WorldPacket data( SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4 ); // changed in WotLK + WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4); // changed in WotLK data << uint32(time(NULL)); // unix time of something data << uint8(1); data << uint32(mask); // type mask @@ -642,7 +642,7 @@ void WorldSession::SendAccountDataTimes(uint32 mask) void WorldSession::LoadTutorialsData() { - for (int aX = 0 ; aX < 8 ; ++aX ) + for (int aX = 0 ; aX < 8 ; ++aX) m_Tutorials[ aX ] = 0; QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u'", GetAccountId()); @@ -656,7 +656,7 @@ void WorldSession::LoadTutorialsData() for (int iI = 0; iI < 8; ++iI) m_Tutorials[iI] = fields[iI].GetUInt32(); } - while ( result->NextRow() ); + while (result->NextRow()); } m_TutorialsChanged = false; } @@ -933,7 +933,7 @@ void WorldSession::SendAddonsInfo() SendPacket(&data); } -void WorldSession::SetPlayer( Player *plr ) +void WorldSession::SetPlayer(Player *plr) { _player = plr; diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index ddaeb87862e..cdb42cfadb7 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -161,28 +161,28 @@ class WorldSession /// Handle the authentication waiting queue (to be completed) void SendAuthWaitQue(uint32 position); - //void SendTestCreatureQueryOpcode( uint32 entry, uint64 guid, uint32 testvalue ); + //void SendTestCreatureQueryOpcode(uint32 entry, uint64 guid, uint32 testvalue); void SendNameQueryOpcode(Player* p); void SendNameQueryOpcodeFromDB(uint64 guid); static void SendNameQueryOpcodeFromDBCallBack(QueryResult_AutoPtr result, uint32 accountId); - void SendTrainerList( uint64 guid ); - void SendTrainerList( uint64 guid, const std::string& strTitle ); - void SendListInventory( uint64 guid ); - void SendShowBank( uint64 guid ); - void SendTabardVendorActivate( uint64 guid ); + void SendTrainerList(uint64 guid); + void SendTrainerList(uint64 guid, const std::string& strTitle); + void SendListInventory(uint64 guid); + void SendShowBank(uint64 guid); + void SendTabardVendorActivate(uint64 guid); void SendSpiritResurrect(); void SendBindPoint(Creature* npc); void SendAttackStop(Unit const* enemy); - void SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgTypeId ); + void SendBattlegGroundList(uint64 guid, BattleGroundTypeId bgTypeId); void SendTradeStatus(uint32 status); void SendCancelTrade(); - void SendStablePet(uint64 guid ); - void SendPetitionQueryOpcode( uint64 petitionguid); + void SendStablePet(uint64 guid); + void SendPetitionQueryOpcode(uint64 petitionguid); void SendUpdateTrade(); //pet @@ -197,7 +197,7 @@ class WorldSession void LoadTutorialsData(); void SendTutorialsData(); void SaveTutorialsData(); - uint32 GetTutorialInt(uint32 intId ) + uint32 GetTutorialInt(uint32 intId) { return m_Tutorials[intId]; } @@ -211,32 +211,32 @@ class WorldSession } } //used with item_page table - bool SendItemInfo( uint32 itemid, WorldPacket data ); + bool SendItemInfo(uint32 itemid, WorldPacket data); //auction - void SendAuctionHello( uint64 guid, Creature * unit ); - void SendAuctionCommandResult( uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0); - void SendAuctionBidderNotification( uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template); - void SendAuctionOwnerNotification( AuctionEntry * auction ); - void SendAuctionOutbiddedMail( AuctionEntry * auction, uint32 newPrice ); - void SendAuctionCancelledToBidderMail( AuctionEntry* auction ); + void SendAuctionHello(uint64 guid, Creature * unit); + void SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0); + void SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template); + void SendAuctionOwnerNotification(AuctionEntry * auction); + void SendAuctionOutbiddedMail(AuctionEntry * auction, uint32 newPrice); + void SendAuctionCancelledToBidderMail(AuctionEntry* auction); //Item Enchantment void SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID); void SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,uint32 slot,uint32 Duration); //Taxi - void SendTaxiStatus( uint64 guid ); - void SendTaxiMenu( Creature* unit ); - void SendDoFlight( uint32 mountDisplayId, uint32 path, uint32 pathNode = 0 ); - bool SendLearnNewTaxiNode( Creature* unit ); + void SendTaxiStatus(uint64 guid); + void SendTaxiMenu(Creature* unit); + void SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode = 0); + bool SendLearnNewTaxiNode(Creature* unit); // Guild/Arena Team void SendGuildCommandResult(uint32 typecmd, const std::string& str, uint32 cmdresult); void SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id); void BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, const std::string& str1, const std::string& str2, const std::string& str3); void SendNotInArenaTeamPacket(uint8 type); - void SendPetitionShowList( uint64 guid ); - void SendSaveGuildEmblem( uint32 msg ); + void SendPetitionShowList(uint64 guid); + void SendSaveGuildEmblem(uint32 msg); void SendBattleGroundOrArenaJoinError(uint8 err); // Looking For Group @@ -246,7 +246,7 @@ class WorldSession void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data); - void DoLootRelease( uint64 lguid ); + void DoLootRelease(uint64 lguid); // Account mute time time_t m_muteTime; @@ -263,7 +263,7 @@ class WorldSession public: // opcodes handlers void Handle_NULL(WorldPacket& recvPacket); // not used - void Handle_EarlyProccess( WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead + void Handle_EarlyProccess(WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client void Handle_Deprecated(WorldPacket& recvPacket); // never used anymore by client @@ -291,7 +291,7 @@ class WorldSession void HandleMoveWaterWalkAck(WorldPacket& recvPacket); void HandleFeatherFallAck(WorldPacket &recv_data); - void HandleMoveHoverAck( WorldPacket & recv_data ); + void HandleMoveHoverAck(WorldPacket & recv_data); void HandleMountSpecialAnimOpcode(WorldPacket &recvdata); @@ -306,7 +306,7 @@ class WorldSession void HandleMoveKnockBackAck(WorldPacket& recvPacket); void HandleMoveTeleportAck(WorldPacket& recvPacket); - void HandleForceSpeedChangeAck( WorldPacket & recv_data ); + void HandleForceSpeedChangeAck(WorldPacket & recv_data); void HandlePingOpcode(WorldPacket& recvPacket); void HandleAuthSessionOpcode(WorldPacket& recvPacket); @@ -352,8 +352,8 @@ class WorldSession void HandleAreaTriggerOpcode(WorldPacket& recvPacket); - void HandleSetFactionAtWar( WorldPacket & recv_data ); - void HandleSetFactionCheat( WorldPacket & recv_data ); + void HandleSetFactionAtWar(WorldPacket & recv_data); + void HandleSetFactionCheat(WorldPacket & recv_data); void HandleSetWatchedFactionOpcode(WorldPacket & recv_data); void HandleSetFactionInactiveOpcode(WorldPacket & recv_data); @@ -384,7 +384,7 @@ class WorldSession void HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data); void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data); - void HandleRequestRaidInfoOpcode( WorldPacket & recv_data ); + void HandleRequestRaidInfoOpcode(WorldPacket & recv_data); void HandleBattlefieldStatusOpcode(WorldPacket &recv_data); void HandleBattleMasterHelloOpcode(WorldPacket &recv_data); @@ -397,17 +397,17 @@ class WorldSession void HandleGroupUninviteGuidOpcode(WorldPacket& recvPacket); void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket); void HandleGroupDisbandOpcode(WorldPacket& recvPacket); - void HandleOptOutOfLootOpcode( WorldPacket &recv_data ); + void HandleOptOutOfLootOpcode(WorldPacket &recv_data); void HandleLootMethodOpcode(WorldPacket& recvPacket); - void HandleLootRoll( WorldPacket &recv_data ); - void HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data ); - void HandleRaidTargetUpdateOpcode( WorldPacket & recv_data ); - void HandleRaidReadyCheckOpcode( WorldPacket & recv_data ); - void HandleRaidReadyCheckFinishedOpcode( WorldPacket & recv_data ); - void HandleGroupRaidConvertOpcode( WorldPacket & recv_data ); - void HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ); - void HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ); - void HandlePartyAssignmentOpcode( WorldPacket & recv_data ); + void HandleLootRoll(WorldPacket &recv_data); + void HandleRequestPartyMemberStatsOpcode(WorldPacket &recv_data); + void HandleRaidTargetUpdateOpcode(WorldPacket & recv_data); + void HandleRaidReadyCheckOpcode(WorldPacket & recv_data); + void HandleRaidReadyCheckFinishedOpcode(WorldPacket & recv_data); + void HandleGroupRaidConvertOpcode(WorldPacket & recv_data); + void HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data); + void HandleGroupAssistantLeaderOpcode(WorldPacket & recv_data); + void HandlePartyAssignmentOpcode(WorldPacket & recv_data); void HandlePetitionBuyOpcode(WorldPacket& recv_data); void HandlePetitionShowSignOpcode(WorldPacket& recv_data); @@ -480,27 +480,27 @@ class WorldSession void HandleUnacceptTradeOpcode(WorldPacket& recvPacket); void HandleAuctionHelloOpcode(WorldPacket& recvPacket); - void HandleAuctionListItems( WorldPacket & recv_data ); - void HandleAuctionListBidderItems( WorldPacket & recv_data ); - void HandleAuctionSellItem( WorldPacket & recv_data ); - void HandleAuctionRemoveItem( WorldPacket & recv_data ); - void HandleAuctionListOwnerItems( WorldPacket & recv_data ); - void HandleAuctionPlaceBid( WorldPacket & recv_data ); - void HandleAuctionListPendingSales( WorldPacket & recv_data ); - - void HandleGetMailList( WorldPacket & recv_data ); - void HandleSendMail( WorldPacket & recv_data ); - void HandleMailTakeMoney( WorldPacket & recv_data ); - void HandleMailTakeItem( WorldPacket & recv_data ); - void HandleMailMarkAsRead( WorldPacket & recv_data ); - void HandleMailReturnToSender( WorldPacket & recv_data ); - void HandleMailDelete( WorldPacket & recv_data ); - void HandleItemTextQuery( WorldPacket & recv_data); - void HandleMailCreateTextItem(WorldPacket & recv_data ); - void HandleQueryNextMailTime(WorldPacket & recv_data ); - void HandleCancelChanneling(WorldPacket & recv_data ); - - void SendItemPageInfo( ItemPrototype *itemProto ); + void HandleAuctionListItems(WorldPacket & recv_data); + void HandleAuctionListBidderItems(WorldPacket & recv_data); + void HandleAuctionSellItem(WorldPacket & recv_data); + void HandleAuctionRemoveItem(WorldPacket & recv_data); + void HandleAuctionListOwnerItems(WorldPacket & recv_data); + void HandleAuctionPlaceBid(WorldPacket & recv_data); + void HandleAuctionListPendingSales(WorldPacket & recv_data); + + void HandleGetMailList(WorldPacket & recv_data); + void HandleSendMail(WorldPacket & recv_data); + void HandleMailTakeMoney(WorldPacket & recv_data); + void HandleMailTakeItem(WorldPacket & recv_data); + void HandleMailMarkAsRead(WorldPacket & recv_data); + void HandleMailReturnToSender(WorldPacket & recv_data); + void HandleMailDelete(WorldPacket & recv_data); + void HandleItemTextQuery(WorldPacket & recv_data); + void HandleMailCreateTextItem(WorldPacket & recv_data); + void HandleQueryNextMailTime(WorldPacket & recv_data); + void HandleCancelChanneling(WorldPacket & recv_data); + + void SendItemPageInfo(ItemPrototype *itemProto); void HandleSplitItemOpcode(WorldPacket& recvPacket); void HandleSwapInvItemOpcode(WorldPacket& recvPacket); void HandleDestroyItemOpcode(WorldPacket& recvPacket); @@ -513,7 +513,7 @@ class WorldSession void HandleAutoStoreBagItemOpcode(WorldPacket& recvPacket); void HandleReadItem(WorldPacket& recvPacket); void HandleAutoEquipItemSlotOpcode(WorldPacket & recvPacket); - void HandleSwapItem( WorldPacket & recvPacket); + void HandleSwapItem(WorldPacket & recvPacket); void HandleBuybackItem(WorldPacket & recvPacket); void HandleAutoBankItemOpcode(WorldPacket& recvPacket); void HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket); @@ -544,8 +544,8 @@ class WorldSession void HandleQuestgiverChooseRewardOpcode(WorldPacket& recvPacket); void HandleQuestgiverRequestRewardOpcode(WorldPacket& recvPacket); void HandleQuestQueryOpcode(WorldPacket& recvPacket); - void HandleQuestgiverCancel(WorldPacket& recv_data ); - void HandleQuestLogSwapQuest(WorldPacket& recv_data ); + void HandleQuestgiverCancel(WorldPacket& recv_data); + void HandleQuestLogSwapQuest(WorldPacket& recv_data); void HandleQuestLogRemoveQuest(WorldPacket& recv_data); void HandleQuestConfirmAccept(WorldPacket& recv_data); void HandleQuestgiverCompleteQuest(WorldPacket& recv_data); @@ -559,9 +559,9 @@ class WorldSession void HandleTextEmoteOpcode(WorldPacket& recvPacket); void HandleChatIgnoredOpcode(WorldPacket& recvPacket); - void HandleReclaimCorpseOpcode( WorldPacket& recvPacket ); - void HandleCorpseQueryOpcode( WorldPacket& recvPacket ); - void HandleCorpseMapPositionQuery( WorldPacket& recvPacket ); + void HandleReclaimCorpseOpcode(WorldPacket& recvPacket); + void HandleCorpseQueryOpcode(WorldPacket& recvPacket); + void HandleCorpseMapPositionQuery(WorldPacket& recvPacket); void HandleResurrectResponseOpcode(WorldPacket& recvPacket); void HandleSummonResponseOpcode(WorldPacket& recv_data); @@ -592,23 +592,23 @@ class WorldSession void HandlePageQuerySkippedOpcode(WorldPacket& recvPacket); void HandlePageTextQueryOpcode(WorldPacket& recvPacket); - void HandleTutorialFlag ( WorldPacket & recv_data ); - void HandleTutorialClear( WorldPacket & recv_data ); - void HandleTutorialReset( WorldPacket & recv_data ); + void HandleTutorialFlag (WorldPacket & recv_data); + void HandleTutorialClear(WorldPacket & recv_data); + void HandleTutorialReset(WorldPacket & recv_data); //Pet - void HandlePetAction( WorldPacket & recv_data ); + void HandlePetAction(WorldPacket & recv_data); void HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2); - void HandlePetNameQuery( WorldPacket & recv_data ); - void HandlePetSetAction( WorldPacket & recv_data ); - void HandlePetAbandon( WorldPacket & recv_data ); - void HandlePetRename( WorldPacket & recv_data ); - void HandlePetCancelAuraOpcode( WorldPacket& recvPacket ); - void HandlePetUnlearnOpcode( WorldPacket& recvPacket ); - void HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ); - void HandlePetCastSpellOpcode( WorldPacket& recvPacket ); - void HandlePetLearnTalent( WorldPacket& recvPacket ); - void HandleLearnPreviewTalentsPet( WorldPacket& recvPacket ); + void HandlePetNameQuery(WorldPacket & recv_data); + void HandlePetSetAction(WorldPacket & recv_data); + void HandlePetAbandon(WorldPacket & recv_data); + void HandlePetRename(WorldPacket & recv_data); + void HandlePetCancelAuraOpcode(WorldPacket& recvPacket); + void HandlePetUnlearnOpcode(WorldPacket& recvPacket); + void HandlePetSpellAutocastOpcode(WorldPacket& recvPacket); + void HandlePetCastSpellOpcode(WorldPacket& recvPacket); + void HandlePetLearnTalent(WorldPacket& recvPacket); + void HandleLearnPreviewTalentsPet(WorldPacket& recvPacket); void HandleSetActionBarToggles(WorldPacket& recv_data); @@ -622,12 +622,12 @@ class WorldSession void HandleBattlemasterHelloOpcode(WorldPacket &recv_data); void HandleBattlemasterJoinOpcode(WorldPacket &recv_data); void HandleBattleGroundPlayerPositionsOpcode(WorldPacket& recv_data); - void HandlePVPLogDataOpcode( WorldPacket &recv_data ); - void HandleBattleFieldPortOpcode( WorldPacket &recv_data ); - void HandleBattlefieldListOpcode( WorldPacket &recv_data ); - void HandleLeaveBattlefieldOpcode( WorldPacket &recv_data ); - void HandleBattlemasterJoinArena( WorldPacket &recv_data ); - void HandleReportPvPAFK( WorldPacket &recv_data ); + void HandlePVPLogDataOpcode(WorldPacket &recv_data); + void HandleBattleFieldPortOpcode(WorldPacket &recv_data); + void HandleBattlefieldListOpcode(WorldPacket &recv_data); + void HandleLeaveBattlefieldOpcode(WorldPacket &recv_data); + void HandleBattlemasterJoinArena(WorldPacket &recv_data); + void HandleReportPvPAFK(WorldPacket &recv_data); void HandleWardenDataOpcode(WorldPacket& recv_data); void HandleWorldTeleportOpcode(WorldPacket& recv_data); @@ -718,7 +718,7 @@ class WorldSession void HandleCalendarGetNumPending(WorldPacket& recv_data); void HandleSpellClick(WorldPacket& recv_data); - void HandleMirrrorImageDataRequest( WorldPacket & recv_data ); + void HandleMirrrorImageDataRequest(WorldPacket & recv_data); void HandleAlterAppearance(WorldPacket& recv_data); void HandleRemoveGlyph(WorldPacket& recv_data); void HandleCharCustomize(WorldPacket& recv_data); diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 387da651c57..7189c42a803 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -46,7 +46,7 @@ #include "Log.h" #include "WorldLog.h" -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack(1) #else #pragma pack(push,1) @@ -93,7 +93,7 @@ struct ClientPktHeader uint32 cmd; }; -#if defined( __GNUC__ ) +#if defined(__GNUC__) #pragma pack() #else #pragma pack(pop) @@ -484,7 +484,7 @@ int WorldSocket::handle_input_missing_data (void) { char buf [4096]; - ACE_Data_Block db ( sizeof (buf), + ACE_Data_Block db (sizeof (buf), ACE_Message_Block::MB_DATA, buf, 0, @@ -1015,7 +1015,7 @@ int WorldSocket::iSendPacket (const WorldPacket& pct) return -1; } - m_Crypt.EncryptSend ( header.header, header.getHeaderLength()); + m_Crypt.EncryptSend (header.header, header.getHeaderLength()); if (m_OutBuffer->copy ((char*) header.header, header.getHeaderLength()) == -1) ACE_ASSERT (false); diff --git a/src/game/WorldSocket.h b/src/game/WorldSocket.h index f7163be55d9..03a0185e05d 100644 --- a/src/game/WorldSocket.h +++ b/src/game/WorldSocket.h @@ -181,8 +181,8 @@ class WorldSocket : protected WorldHandler /// Flush m_PacketQueue if there are packets in it /// Need to be called with m_OutBufferLock lock held - /// @return true if it wrote to the buffer ( AKA you need - /// to mark the socket for output ). + /// @return true if it wrote to the buffer (AKA you need + /// to mark the socket for output). bool iFlushPacketQueue (); private: diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp index 4c3a5f81576..23a123ae990 100644 --- a/src/game/WorldSocketMgr.cpp +++ b/src/game/WorldSocketMgr.cpp @@ -251,7 +251,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) m_SockOutUBuff = sConfig.GetIntDefault ("Network.OutUBuff", 65536); - if ( m_SockOutUBuff <= 0 ) + if (m_SockOutUBuff <= 0) { sLog.outError ("Network.OutUBuff is wrong in your config file"); return -1; diff --git a/src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp b/src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp index f946e17b2d5..ae3062ea459 100644 --- a/src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp +++ b/src/scripts/eastern_kingdoms/blackwing_lair/boss_nefarian.cpp @@ -108,7 +108,7 @@ struct boss_nefarianAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if ( DespawnTimer <= diff) + if (DespawnTimer <= diff) { if (!UpdateVictim()) m_creature->ForcedDespawn(); diff --git a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp index d1a1888b224..a49ade8758f 100644 --- a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp +++ b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp @@ -869,31 +869,31 @@ struct npc_scarlet_minerAI : public npc_escortAI { AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000); AddWaypoint(2, 2341.812012, -5900.484863, 102.619743); - AddWaypoint(3, 2306.561279, -5901.738281, 91.792419 ); - AddWaypoint(4, 2300.098389, -5912.618652, 86.014885 ); - AddWaypoint(5, 2294.142090, -5927.274414, 75.316849 ); - AddWaypoint(6, 2286.984375, -5944.955566, 63.714966 ); - AddWaypoint(7, 2280.001709, -5961.186035, 54.228283 ); - AddWaypoint(8, 2259.389648, -5974.197754, 42.359348 ); - AddWaypoint(9, 2242.882812, -5984.642578, 32.827850 ); - AddWaypoint(10, 2217.265625, -6028.959473, 7.675705 ); - AddWaypoint(11, 2202.595947, -6061.325684, 5.882018 ); - AddWaypoint(12, 2188.974609, -6080.866699, 3.370027 ); + AddWaypoint(3, 2306.561279, -5901.738281, 91.792419); + AddWaypoint(4, 2300.098389, -5912.618652, 86.014885); + AddWaypoint(5, 2294.142090, -5927.274414, 75.316849); + AddWaypoint(6, 2286.984375, -5944.955566, 63.714966); + AddWaypoint(7, 2280.001709, -5961.186035, 54.228283); + AddWaypoint(8, 2259.389648, -5974.197754, 42.359348); + AddWaypoint(9, 2242.882812, -5984.642578, 32.827850); + AddWaypoint(10, 2217.265625, -6028.959473, 7.675705); + AddWaypoint(11, 2202.595947, -6061.325684, 5.882018); + AddWaypoint(12, 2188.974609, -6080.866699, 3.370027); if (urand(0,1)) { - AddWaypoint(13, 2176.483887, -6110.407227, 1.855181 ); - AddWaypoint(14, 2172.516602, -6146.752441, 1.074235 ); - AddWaypoint(15, 2138.918457, -6158.920898, 1.342926 ); - AddWaypoint(16, 2129.866699, -6174.107910, 4.380779 ); + AddWaypoint(13, 2176.483887, -6110.407227, 1.855181); + AddWaypoint(14, 2172.516602, -6146.752441, 1.074235); + AddWaypoint(15, 2138.918457, -6158.920898, 1.342926); + AddWaypoint(16, 2129.866699, -6174.107910, 4.380779); AddWaypoint(17, 2117.709473, -6193.830078, 13.3542, 10000); } else { - AddWaypoint(13, 2184.190186, -6166.447266, 0.968877 ); - AddWaypoint(14, 2234.265625, -6163.741211, 0.916021 ); - AddWaypoint(15, 2268.071777, -6158.750977, 1.822252 ); - AddWaypoint(16, 2270.028320, -6176.505859, 6.340538 ); + AddWaypoint(13, 2184.190186, -6166.447266, 0.968877); + AddWaypoint(14, 2234.265625, -6163.741211, 0.916021); + AddWaypoint(15, 2268.071777, -6158.750977, 1.822252); + AddWaypoint(16, 2270.028320, -6176.505859, 6.340538); AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000); } } diff --git a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp index 9965c273cc1..51e20cc3c78 100644 --- a/src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp +++ b/src/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp @@ -1609,10 +1609,10 @@ struct npc_highlord_darion_mograineAI : public npc_escortAI bool GossipHello_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu( pCreature->GetGUID() ); + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM( 0, "I am ready.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(0, "I am ready.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); diff --git a/src/scripts/kalimdor/azuremyst_isle.cpp b/src/scripts/kalimdor/azuremyst_isle.cpp index e773ecfaef1..2cbf41ba4b1 100644 --- a/src/scripts/kalimdor/azuremyst_isle.cpp +++ b/src/scripts/kalimdor/azuremyst_isle.cpp @@ -491,7 +491,7 @@ struct npc_geezleAI : public ScriptedAI for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY)==QUEST_STATUS_INCOMPLETE - &&(*itr)->HasAura(SPELL_TREE_DISGUISE) ) + &&(*itr)->HasAura(SPELL_TREE_DISGUISE)) { (*itr)->KilledMonsterCredit(MOB_SPARK,0); } diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp index 9a784c781d2..0401fab5cd9 100644 --- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp @@ -1155,7 +1155,7 @@ bool GossipHello_npc_arthas(Player* pPlayer, Creature* pCreature) } -bool GossipSelect_npc_arthas(Player *pPlayer, Creature *pCreature, uint32 sender, uint32 action ) +bool GossipSelect_npc_arthas(Player *pPlayer, Creature *pCreature, uint32 sender, uint32 action) { npc_arthasAI* pAI = CAST_AI(npc_arthasAI,pCreature->AI()); diff --git a/src/scripts/northrend/icecrown.cpp b/src/scripts/northrend/icecrown.cpp index 362075ee1ee..eb72b7f5cbf 100644 --- a/src/scripts/northrend/icecrown.cpp +++ b/src/scripts/northrend/icecrown.cpp @@ -150,7 +150,7 @@ enum eSquireDavid bool GossipHello_npc_squire_david(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_THE_ASPIRANT_S_CHALLENGE_H) == QUEST_STATUS_INCOMPLETE || - pPlayer->GetQuestStatus(QUEST_THE_ASPIRANT_S_CHALLENGE_A) == QUEST_STATUS_INCOMPLETE )//We need more info about it. + pPlayer->GetQuestStatus(QUEST_THE_ASPIRANT_S_CHALLENGE_A) == QUEST_STATUS_INCOMPLETE)//We need more info about it. { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SQUIRE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SQUIRE_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); diff --git a/src/scripts/northrend/storm_peaks.cpp b/src/scripts/northrend/storm_peaks.cpp index 6d5440dba25..b439a76d5a8 100644 --- a/src/scripts/northrend/storm_peaks.cpp +++ b/src/scripts/northrend/storm_peaks.cpp @@ -54,7 +54,7 @@ bool GossipHello_npc_agnetta_tyrsdottar(Player* pPlayer, Creature* pCreature) return true; } -bool GossipSelect_npc_agnetta_tyrsdottar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction ) +bool GossipSelect_npc_agnetta_tyrsdottar(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { @@ -273,7 +273,7 @@ bool GossipHello_npc_victorious_challenger(Player* pPlayer, Creature* pCreature) return false; } -bool GossipSelect_npc_victorious_challenger(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction ) +bool GossipSelect_npc_victorious_challenger(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { diff --git a/src/scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp b/src/scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp index 101ddf7a7a5..18dcbe1b1da 100644 --- a/src/scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp +++ b/src/scripts/northrend/ulduar/ulduar/boss_assembly_of_iron.cpp @@ -410,7 +410,7 @@ struct mob_rune_of_summoningAI : public ScriptedAI void SummonLightningElemental() { - m_creature->SummonCreature(CREATURE_RUNE_OF_SUMMONING, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN ); + m_creature->SummonCreature(CREATURE_RUNE_OF_SUMMONING, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN); m_creature->DealDamage(m_creature, m_creature->GetHealth()); } }; diff --git a/src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp b/src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp index 469271bd5f7..5d6c66a197a 100644 --- a/src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp +++ b/src/scripts/northrend/ulduar/ulduar/ulduar_teleporter.cpp @@ -21,7 +21,7 @@ The teleporter appears to be active and stable. #define WALKWAY 205 #define CONSERVATORY 206 -bool GoHello_ulduar_teleporter( Player *pPlayer, GameObject *pGO ) +bool GoHello_ulduar_teleporter(Player *pPlayer, GameObject *pGO) { ScriptedInstance *pInstance = pGO->GetInstanceData(); if (!pInstance) return true; @@ -48,7 +48,7 @@ bool GoHello_ulduar_teleporter( Player *pPlayer, GameObject *pGO ) return true; } -bool GOSelect_ulduar_teleporter( Player *pPlayer, GameObject *pGO, uint32 sender, uint32 action ) +bool GOSelect_ulduar_teleporter(Player *pPlayer, GameObject *pGO, uint32 sender, uint32 action) { if (sender != GOSSIP_SENDER_MAIN) return true; if (!pPlayer->getAttackers().empty()) return true; diff --git a/src/scripts/world/go_scripts.cpp b/src/scripts/world/go_scripts.cpp index 1ea5d5b9498..d068f538fa2 100644 --- a/src/scripts/world/go_scripts.cpp +++ b/src/scripts/world/go_scripts.cpp @@ -429,7 +429,7 @@ enum eFelCrystalforge bool GOHello_go_fel_crystalforge(Player *pPlayer, GameObject *pGO) { - if ( pGO->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER ) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ + if (pGO->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ pPlayer->PrepareQuestMenu(pGO->GetGUID()); /* return true*/ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FEL_CRYSTALFORGE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index 7e3325c7842..1737a86ba3c 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -1254,7 +1254,7 @@ bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 { if (pPlayer->GetMoney() < 10000000) { - pPlayer->SendBuyError( BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); pPlayer->PlayerTalkClass->CloseGossip(); break; } @@ -1822,7 +1822,7 @@ struct npc_ebon_gargoyleAI : CasterAI // Fly away when dismissed void SpellHit(Unit *source, const SpellEntry *spell) { - if (spell->Id != 50515 || !me->isAlive() ) + if (spell->Id != 50515 || !me->isAlive()) return; Unit *owner = me->GetOwner(); |