Merge remote-tracking branch 'tc/3.3.5' into 4.3.4
Note: additional hand-picked ports from 6.x to fix build Conflicts: sql/updates/world/2016_02_22_00_world.sql sql/updates/world/2016_02_22_01_world.sql sql/updates/world/2016_02_22_02_world.sql sql/updates/world/2016_03_07_00_world.sql src/server/authserver/Realms/RealmList.cpp src/server/authserver/Realms/RealmList.h src/server/authserver/Server/AuthSession.cpp src/server/game/Accounts/AccountMgr.cpp src/server/game/AuctionHouse/AuctionHouseMgr.cpp src/server/game/Chat/Chat.cpp src/server/game/Conditions/ConditionMgr.cpp src/server/game/Conditions/ConditionMgr.h src/server/game/Entities/Player/Player.cpp src/server/game/Handlers/CharacterHandler.cpp src/server/game/Handlers/MiscHandler.cpp src/server/game/Scripting/ScriptLoader.cpp src/server/game/Scripting/ScriptLoader.h src/server/game/Server/WorldSession.cpp src/server/game/Server/WorldSocket.cpp src/server/game/World/World.cpp src/server/game/World/World.h src/server/scripts/CMakeLists.txt src/server/scripts/Commands/cs_gm.cpp src/server/scripts/Commands/cs_misc.cpp src/server/scripts/Commands/cs_rbac.cpp src/server/scripts/Commands/cs_ticket.cpp src/server/scripts/Commands/cs_wp.cpp src/server/scripts/EasternKingdoms/CMakeLists.txt src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp src/server/scripts/Kalimdor/CMakeLists.txt src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp src/server/scripts/Kalimdor/zone_orgrimmar.cpp src/server/scripts/OutdoorPvP/CMakeLists.txt src/server/scripts/Spells/spell_dk.cpp src/server/scripts/Spells/spell_hunter.cpp src/server/shared/CMakeLists.txt src/server/worldserver/CMakeLists.txt src/server/worldserver/Main.cpp src/tools/mmaps_generator/CMakeLists.txt
This commit is contained in:
commit
65aec5f8f7
143 files changed
+4022
-4094
No files matched your search
@@ -44,6 +44,7 @@
|
||||
#include "PetAI.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "PlayerAI.h"
|
||||
#include "QuestDef.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
@@ -3521,6 +3522,77 @@ void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode)
|
||||
RemoveAura(aurApp, mode);
|
||||
}
|
||||
|
||||
void Unit::RemoveAppliedAuras(std::function<bool(AuraApplication const*)> const& check)
|
||||
{
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
|
||||
{
|
||||
if (check(iter->second))
|
||||
{
|
||||
RemoveAura(iter);
|
||||
continue;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveOwnedAuras(std::function<bool(Aura const*)> const& check)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
|
||||
{
|
||||
if (check(iter->second))
|
||||
{
|
||||
RemoveOwnedAura(iter);
|
||||
continue;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAppliedAuras(uint32 spellId, std::function<bool(AuraApplication const*)> const& check)
|
||||
{
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
||||
{
|
||||
if (check(iter->second))
|
||||
{
|
||||
RemoveAura(iter);
|
||||
continue;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveOwnedAuras(uint32 spellId, std::function<bool(Aura const*)> const& check)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
|
||||
{
|
||||
if (check(iter->second))
|
||||
{
|
||||
RemoveOwnedAura(iter);
|
||||
continue;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAurasByType(AuraType auraType, std::function<bool(AuraApplication const*)> const& check)
|
||||
{
|
||||
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
|
||||
{
|
||||
Aura* aura = (*iter)->GetBase();
|
||||
AuraApplication * aurApp = aura->GetApplicationOfTarget(GetGUID());
|
||||
ASSERT(aurApp);
|
||||
|
||||
++iter;
|
||||
if (check(aurApp))
|
||||
{
|
||||
uint32 removedAuras = m_removedAurasCount;
|
||||
RemoveAura(aurApp);
|
||||
if (m_removedAurasCount > removedAuras + 1)
|
||||
iter = m_modAuras[auraType].begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
|
||||
{
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
||||
@@ -7605,10 +7677,10 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
||||
if (GetTypeId() == TYPEID_UNIT && !IsPet())
|
||||
{
|
||||
// should not let player enter combat by right clicking target - doesn't helps
|
||||
AddThreat(victim, 0.0f);
|
||||
SetInCombatWith(victim);
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
victim->SetInCombatWith(this);
|
||||
AddThreat(victim, 0.0f);
|
||||
|
||||
ToCreature()->SendAIReaction(AI_REACTION_HOSTILE);
|
||||
ToCreature()->CallAssistance();
|
||||
@@ -7852,7 +7924,7 @@ Unit* Unit::GetCharmer() const
|
||||
if (ObjectGuid charmerGUID = GetCharmerGUID())
|
||||
return ObjectAccessor::GetUnit(*this, charmerGUID);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const
|
||||
@@ -10798,7 +10870,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
if (Creature* creature = ToCreature())
|
||||
{
|
||||
uint32 immuneMask = creature->GetCreatureTemplate()->MechanicImmuneMask;
|
||||
if (immuneMask & (1 << MECHANIC_SNARE) || immuneMask & (1 << MECHANIC_DAZE))
|
||||
if (immuneMask & (1 << (MECHANIC_SNARE - 1)) || immuneMask & (1 << (MECHANIC_DAZE - 1)))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -12084,28 +12156,76 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
|
||||
|
||||
void Unit::UpdateCharmAI()
|
||||
{
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (i_disabledAI) // disabled AI must be primary AI
|
||||
switch (GetTypeId())
|
||||
{
|
||||
if (!IsCharmed())
|
||||
{
|
||||
delete i_AI;
|
||||
i_AI = i_disabledAI;
|
||||
i_disabledAI = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsCharmed())
|
||||
{
|
||||
i_disabledAI = i_AI;
|
||||
if (isPossessed() || IsVehicle())
|
||||
i_AI = new PossessedAI(ToCreature());
|
||||
case TYPEID_UNIT:
|
||||
if (i_disabledAI) // disabled AI must be primary AI
|
||||
{
|
||||
if (!IsCharmed())
|
||||
{
|
||||
delete i_AI;
|
||||
i_AI = i_disabledAI;
|
||||
i_disabledAI = nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
i_AI = new PetAI(ToCreature());
|
||||
{
|
||||
if (IsCharmed())
|
||||
{
|
||||
i_disabledAI = i_AI;
|
||||
if (isPossessed() || IsVehicle())
|
||||
i_AI = new PossessedAI(ToCreature());
|
||||
else
|
||||
i_AI = new PetAI(ToCreature());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
{
|
||||
if (IsCharmed()) // if we are currently being charmed, then we should apply charm AI
|
||||
{
|
||||
i_disabledAI = i_AI;
|
||||
|
||||
UnitAI* newAI = nullptr;
|
||||
// first, we check if the creature's own AI specifies an override playerai for its owned players
|
||||
if (Unit* charmer = GetCharmer())
|
||||
{
|
||||
if (Creature* creatureCharmer = charmer->ToCreature())
|
||||
{
|
||||
if (PlayerAI* charmAI = creatureCharmer->IsAIEnabled ? creatureCharmer->AI()->GetAIForCharmedPlayer(ToPlayer()) : nullptr)
|
||||
newAI = charmAI;
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("misc", "Attempt to assign charm AI to player %s who is charmed by non-creature %s.", GetGUID().ToString().c_str(), GetCharmerGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
if (!newAI) // otherwise, we default to the generic one
|
||||
newAI = new SimpleCharmedPlayerAI(ToPlayer());
|
||||
i_AI = newAI;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i_AI)
|
||||
{
|
||||
// we allow the charmed PlayerAI to clean up
|
||||
i_AI->OnCharmed(false);
|
||||
// then delete it
|
||||
delete i_AI;
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("misc", "Attempt to remove charm AI from player %s who doesn't currently have charm AI.", GetGUID().ToString().c_str());
|
||||
}
|
||||
// and restore our previous PlayerAI (if we had one)
|
||||
i_AI = i_disabledAI;
|
||||
i_disabledAI = nullptr;
|
||||
// IsAIEnabled gets handled in the caller
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
TC_LOG_ERROR("misc", "Attempt to update charm AI for unit %s, which is neither player nor creature.", GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14360,11 +14480,17 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
||||
ToCreature()->AI()->OnCharmed(true);
|
||||
GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
else
|
||||
else if (Player* player = ToPlayer())
|
||||
{
|
||||
Player* player = ToPlayer();
|
||||
if (player->isAFK())
|
||||
player->ToggleAFK();
|
||||
|
||||
if (charmer->GetTypeId() == TYPEID_UNIT) // we are charmed by a creature
|
||||
{
|
||||
// change AI to charmed AI on next Update tick
|
||||
NeedChangeAI = true;
|
||||
IsAIEnabled = false;
|
||||
}
|
||||
player->SetClientControl(this, false);
|
||||
}
|
||||
|
||||
@@ -14522,7 +14648,14 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
||||
}
|
||||
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
if (charmer->GetTypeId() == TYPEID_UNIT) // charmed by a creature, this means we had PlayerAI
|
||||
{
|
||||
NeedChangeAI = true;
|
||||
IsAIEnabled = false;
|
||||
}
|
||||
player->SetClientControl(this, true);
|
||||
}
|
||||
|
||||
// a guardian should always have charminfo
|
||||
if (playerCharmer && this != charmer->GetFirstControlled())
|
||||
|
||||
Reference in new issue
Block a user