Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
This commit is contained in:
commit
5586950dec
20 files changed
+701
-363
No files matched your search
@@ -1275,10 +1275,8 @@ void GameObject::Use(Unit* user)
|
||||
{
|
||||
GameObjectTemplate const* info = GetGOInfo();
|
||||
|
||||
if (user->GetTypeId() == TYPEID_PLAYER)
|
||||
if (Player* player = user->ToPlayer())
|
||||
{
|
||||
Player* player = user->ToPlayer();
|
||||
|
||||
if (info->goober.pageId) // show page...
|
||||
{
|
||||
WorldPacket data(SMSG_GAMEOBJECT_PAGETEXT, 8);
|
||||
@@ -1295,7 +1293,7 @@ void GameObject::Use(Unit* user)
|
||||
{
|
||||
TC_LOG_DEBUG("maps.script", "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow());
|
||||
GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this);
|
||||
EventInform(info->goober.eventId);
|
||||
EventInform(info->goober.eventId, user);
|
||||
}
|
||||
|
||||
// possible quest objective for active quests
|
||||
@@ -1306,9 +1304,6 @@ void GameObject::Use(Unit* user)
|
||||
break;
|
||||
}
|
||||
|
||||
if (Battleground* bg = player->GetBattleground())
|
||||
bg->EventPlayerUsedGO(player, this);
|
||||
|
||||
player->KillCreditGO(info->entry, GetGUID());
|
||||
}
|
||||
|
||||
@@ -1804,7 +1799,7 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
|
||||
&& dz < info->maxZ + radius && dz > info->minZ - radius;
|
||||
}
|
||||
|
||||
void GameObject::EventInform(uint32 eventId)
|
||||
void GameObject::EventInform(uint32 eventId, WorldObject* invoker /*= NULL*/)
|
||||
{
|
||||
if (!eventId)
|
||||
return;
|
||||
@@ -1812,8 +1807,12 @@ void GameObject::EventInform(uint32 eventId)
|
||||
if (AI())
|
||||
AI()->EventInform(eventId);
|
||||
|
||||
if (m_zoneScript)
|
||||
m_zoneScript->ProcessEvent(this, eventId);
|
||||
if (GetZoneScript())
|
||||
GetZoneScript()->ProcessEvent(this, eventId);
|
||||
|
||||
if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
|
||||
if (bgMap->GetBG())
|
||||
bgMap->GetBG()->ProcessEvent(this, eventId, invoker);
|
||||
}
|
||||
|
||||
// overwrite WorldObject function for proper name localization
|
||||
@@ -1879,7 +1878,7 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, u
|
||||
// Set the health bar, value = 255 * healthPct;
|
||||
SetGoAnimProgress(m_goValue.Building.Health * 255 / m_goValue.Building.MaxHealth);
|
||||
|
||||
Player* player = attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
Player* player = attackerOrHealer ? attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself() : NULL;
|
||||
|
||||
// dealing damage, send packet
|
||||
if (player)
|
||||
@@ -1928,11 +1927,8 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
||||
break;
|
||||
case GO_DESTRUCTIBLE_DAMAGED:
|
||||
{
|
||||
EventInform(m_goInfo->building.damagedEvent);
|
||||
EventInform(m_goInfo->building.damagedEvent, eventInvoker);
|
||||
sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
|
||||
if (eventInvoker)
|
||||
if (Battleground* bg = eventInvoker->GetBattleground())
|
||||
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
|
||||
|
||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
|
||||
@@ -1957,15 +1953,10 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
||||
case GO_DESTRUCTIBLE_DESTROYED:
|
||||
{
|
||||
sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
|
||||
EventInform(m_goInfo->building.destroyedEvent);
|
||||
EventInform(m_goInfo->building.destroyedEvent, eventInvoker);
|
||||
if (eventInvoker)
|
||||
{
|
||||
if (Battleground* bg = eventInvoker->GetBattleground())
|
||||
{
|
||||
bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.destroyedEvent);
|
||||
bg->DestroyGate(eventInvoker, this);
|
||||
}
|
||||
}
|
||||
|
||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
|
||||
@@ -1986,7 +1977,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
||||
}
|
||||
case GO_DESTRUCTIBLE_REBUILDING:
|
||||
{
|
||||
EventInform(m_goInfo->building.rebuildingEvent);
|
||||
EventInform(m_goInfo->building.rebuildingEvent, eventInvoker);
|
||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_DESTROYED);
|
||||
|
||||
uint32 modelId = m_goInfo->displayId;
|
||||
|
||||
Reference in new issue
Block a user