Cmangos Cata commits applied

I thankee, cmangos :-)

Commits:

13271d6 Commit Ported  Core Pet DB cleanup and simplification
60d6e29 Commit Imported  Core Utilize flags in PetAI (And uniform extra
flags with the other cores)
06d30ce Commit Ported  Core Make pet assist owner on summon if not a
passive
2821da8 Commit Ported  Core Fix Guardian reactions
4f88a9e Commit Ported  Core Pet AI Fixup
67e0558 Commit Imported  Core Fix pet unsummon on mount
f50041f Commit Imported  Core Fix player rooted after possesing an unit.
df59a93 Commit Imported  Core Syncing up pet work
056f4f5 Commit Imported  Core Fix a couple of invalid name for spell
attributes
6a58f1f Commit Imported  Core only save correct auras on
pet::SavePetToDB
34ab59b Commit Imported  Core Hunter summon pet (call pet) checkcast
fixup
dfbb69c Commit Imported  Core Handle owner entering combat properly
4b10eb4 Commit Imported  Core Pet Aggro
1bdb7e3 Commit Ported  Core Clean up pet stay functionality
1bdb7e3 Commit Ported  Core Clean up pet stay functionality
9b7b50e Commit Imported  Core UNIT_BYTE2_FLAG work
0777235 Commit Imported  Core Implement displaying group leader
indicators on players
5efab47 Commit Imported  Core Health funnel fixes
60e6a84 Commit Ported  Core Fix SMSG_QUESTGIVER_STATUS_MULTIPLE and
GetDialogStatus
60e6a84 Commit Ported  Core Fix SMSG_QUESTGIVER_STATUS_MULTIPLE and

GetDialogStatus
f8d3cbd Commit Imported  Core Fix talent spell cannot stack
32ba32e Commit Imported  Core Fix channeled spell distance check
interval
47ec2fa Commit Imported  Core Adding state to aura holder Now proc
cannot remove an aura not finalized
34588dc Commit Ported  Core Unbreak creature pets
bd079a1 Commit Imported  Core The (not so)Great Pet Rework
This commit is contained in:
Charles A Edwards 2016-09-15 14:56:42 +01:00 committed by Antz
parent c4c83f5b58
commit 600205641d
20 changed files with 634 additions and 507 deletions

View file

@ -2687,6 +2687,9 @@ void Player::GiveLevel(uint32 level)
MailDraft(mailReward->mailTemplateId).SendMailTo(this, MailSender(MAIL_CREATURE, mailReward->senderEntry));
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
// resend quests status directly
SendQuestGiverStatusMultiple();
}
void Player::UpdateFreeTalentPoints(bool resetIfNeed)
@ -2877,7 +2880,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK | PLAYER_FLAGS_DND | PLAYER_FLAGS_GM | PLAYER_FLAGS_GHOST);
RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // one form stealth modified bytes
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP | UNIT_BYTE2_FLAG_SUPPORTABLE);
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
// restore if need some important flags
SetUInt32Value(PLAYER_FIELD_BYTES2, 0); // flags empty by default
@ -13897,6 +13900,9 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver,
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
// resend quests status directly
SendQuestGiverStatusMultiple();
}
void Player::IncompleteQuest(uint32 quest_id)
@ -15199,6 +15205,60 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, ObjectGuid guid
SetQuestSlotCounter(log_slot, creatureOrGO_idx, count);
}
void Player::SendQuestGiverStatusMultiple()
{
uint32 count = 0;
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
data << uint32(count); // placeholder
for (GuidSet::const_iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
{
if (itr->IsAnyTypeCreature())
{
// need also pet quests case support
Creature* questgiver = GetMap()->GetAnyTypeCreature(*itr);
if (!questgiver || questgiver->IsHostileTo(this))
continue;
if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
continue;
uint8 dialogStatus = sScriptMgr.GetDialogStatus(this, questgiver);
if (dialogStatus == DIALOG_STATUS_REWARD_REP)
dialogStatus = GetSession()->getDialogStatus(this, questgiver, DIALOG_STATUS_NONE);
data << questgiver->GetObjectGuid();
data << uint8(dialogStatus);
++count;
}
else if (itr->IsGameObject())
{
GameObject* questgiver = GetMap()->GetGameObject(*itr);
if (!questgiver)
continue;
if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
continue;
uint8 dialogStatus = sScriptMgr.GetDialogStatus(this, questgiver);
if (dialogStatus == DIALOG_STATUS_REWARD_REP)
dialogStatus = GetSession()->getDialogStatus(this, questgiver, DIALOG_STATUS_NONE);
data << questgiver->GetObjectGuid();
data << uint8(dialogStatus);
++count;
}
}
data.put<uint32>(0, count); // write real count
GetSession()->SendPacket(&data);
}
/*********************************************************/
/*** LOAD SYSTEM ***/
/*********************************************************/
@ -16840,6 +16900,7 @@ void Player::_LoadTalents(QueryResult* result)
while (result->NextRow());
delete result;
}
UpdateGroupLeaderFlag();
}
void Player::_LoadGroup(QueryResult* result)
@ -21497,6 +21558,18 @@ PartyResult Player::CanUninviteFromGroup() const
return ERR_PARTY_RESULT_OK;
}
void Player::UpdateGroupLeaderFlag(const bool remove /*= false*/)
{
const Group* group = GetGroup();
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER))
{
if (remove || !group || group->GetLeaderGuid() != GetObjectGuid())
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
}
else if (!remove && group && group->GetLeaderGuid() == GetObjectGuid())
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER);
}
void Player::SetBattleGroundRaid(Group* group, int8 subgroup)
{
// we must move references from m_group to m_originalGroup