Code style (game + scripts only):

"( " --> "("
" )" --> ")"

--HG--
branch : trunk
This commit is contained in:
Spp
2010-04-07 22:59:46 +02:00
parent d19e127080
commit 49d05ba9aa
176 changed files with 4789 additions and 4789 deletions
+1 -1
View File
@@ -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);
}
+51 -51
View File
@@ -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());
}
+4 -4
View File
@@ -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)
+2 -2
View File
@@ -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;
+13 -13
View File
@@ -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;
+5 -5
View File
@@ -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;
+16 -16
View File
@@ -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);
+1 -1
View File
@@ -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);
+7 -7
View File
@@ -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)
+77 -77
View File
@@ -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");
+1 -1
View File
@@ -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
+4 -4
View File
@@ -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);
+24 -24
View File
@@ -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;
+37 -37
View File
@@ -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)
{
+2 -2
View File
@@ -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;
+18 -18
View File
@@ -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)
+1 -1
View File
@@ -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;
+9 -9
View File
@@ -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; }
+2 -2
View File
@@ -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;
}
}
+6 -6
View File
@@ -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);
+2 -2
View File
@@ -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)
{
+72 -72
View File
@@ -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);
+1 -1
View File
@@ -1642,7 +1642,7 @@ valid examples:
expectedName += " ";
expectedName += suffix[i];
}
if ( expectedName == buffer)
if (expectedName == buffer)
{
foundName = true;
break;
+11 -11
View File
@@ -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
+9 -9
View File
@@ -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;
+1 -1
View File
@@ -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;
+8 -8
View File
@@ -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
+5 -5
View File
@@ -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];
+8 -8
View File
@@ -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;
+4 -4
View File
@@ -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);
+48 -48
View File
@@ -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;
+5 -5
View File
@@ -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; }
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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 =================================
+11 -11
View File
@@ -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));
}
}
+8 -8
View File
@@ -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)
{
+3 -3
View File
@@ -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();
}
+9 -9
View File
@@ -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)
+2 -2
View File
@@ -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)
+9 -9
View File
@@ -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);
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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)
+6 -6
View File
@@ -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;
+12 -12
View File
@@ -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);
+1 -1
View File
@@ -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()));
+89 -89
View File
@@ -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);
}
}
}
+1 -1
View File
@@ -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);
+15 -15
View File
@@ -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;
+3 -3
View File
@@ -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;
+82 -82
View File
@@ -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());
}
+22 -22
View File
@@ -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
+4 -4
View File
@@ -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;
+3 -3
View File
@@ -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;
+11 -11
View File
@@ -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;
+4 -4
View File
@@ -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;
+4 -4
View File
@@ -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);
+31 -31
View File
@@ -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);
+1 -1
View File
@@ -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);
+26 -26
View File
@@ -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");
+1 -1
View File
@@ -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
+13 -13
View File
@@ -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();
+33 -33
View File
@@ -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);
+11 -11
View File
@@ -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
+15 -15
View File
@@ -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);
}
+3 -3
View File
@@ -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)
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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
{
+1 -1
View File
@@ -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);
+7 -7
View File
@@ -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
{
+19 -19
View File
@@ -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;
+6 -6
View File
@@ -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;
+3 -3
View File
@@ -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.");
}
}
+196 -196
View File
@@ -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);
}
}
+2 -2
View File
@@ -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)
+22 -22
View File
@@ -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;
+4 -4
View File
@@ -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;
}
+43 -43
View File
@@ -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);
+72 -72
View File
@@ -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.
+150 -150
View File
File diff suppressed because it is too large Load Diff
+26 -26
View File
@@ -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);
+24 -24
View File
@@ -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())
+22 -22
View File
@@ -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));
+55 -55
View File
@@ -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);
+9 -9
View File
@@ -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);
+2 -2
View File
@@ -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);
+121 -121
View File
@@ -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))
+14 -14
View File
@@ -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)
+7 -7
View File
@@ -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;
+65 -65
View File
@@ -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;
}
+2 -2
View File
@@ -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)
+94 -94
View File
@@ -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()
+65 -65
View File
@@ -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;}
+3 -3
View File
@@ -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);
+18 -18
View File
@@ -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)
+339 -339
View File
File diff suppressed because it is too large Load Diff
+25 -25
View File
@@ -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; }
+2 -2
View File
@@ -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);
}
+16 -16
View File
@@ -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;
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -27,7 +27,7 @@
#include "Player.h"
#include "Policies/SingletonImp.h"
INSTANTIATE_SINGLETON_1( OutdoorPvPMgr );
INSTANTIATE_SINGLETON_1(OutdoorPvPMgr);
OutdoorPvPMgr::OutdoorPvPMgr()
{

Some files were not shown because too many files have changed in this diff Show More