Core/BG/SA:

* replaced some trinity_string with broadcasttexts
* basic implementation of phasing in SA
* spawn some triggers in SA (fixes dest position of teleport pads)
* added text getter to broadcasttext struct
* some cleanup in destructable go event notification
This commit is contained in:
joschiwald committed 2014-04-26 03:40:30 +02:00
1 parent b1d1d65506
commit 211d56d633
16 files changed
+496 -362

No files matched your search

@@ -1274,10 +1274,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);
@@ -1294,7 +1292,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
@@ -1305,9 +1303,6 @@ void GameObject::Use(Unit* user)
break;
}
if (Battleground* bg = player->GetBattleground())
bg->EventPlayerUsedGO(player, this);
player->KillCreditGO(info->entry, GetGUID());
}
@@ -1803,7 +1798,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;
@@ -1811,8 +1806,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
@@ -1878,7 +1877,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)
@@ -1927,11 +1926,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);
@@ -1956,15 +1952,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);
@@ -1985,7 +1976,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;