diff options
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r-- | src/game/GameObject.cpp | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index abfb1220e27..b0a42185aad 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -410,7 +410,17 @@ void GameObject::Update(uint32 /*p_time*/) if (GetGOInfo()->GetAutoCloseTime() && (m_cooldownTime < time(NULL))) ResetDoorOrButton(); break; - default: break; + case GAMEOBJECT_TYPE_GOOBER: + if (m_cooldownTime < time(NULL)) + { + RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + + SetLootState(GO_JUST_DEACTIVATED); + m_cooldownTime = 0; + } + break; + default: + break; } break; } @@ -427,15 +437,16 @@ void GameObject::Update(uint32 /*p_time*/) std::set<uint32>::const_iterator end = m_unique_users.end(); for (; it != end; ++it) { - Unit* owner = Unit::GetUnit(*this, uint64(*it)); - // For now we do not support go cast - //if (owner) owner->CastSpell(owner, spellId, false, 0, 0, GetGUID()); - if (owner) owner->CastSpell(owner, spellId, false); + if (Unit* owner = Unit::GetUnit(*this, uint64(*it))) + owner->CastSpell(owner, spellId, false); } m_unique_users.clear(); m_usetimes = 0; } + + SetGoState(GO_STATE_READY); + //any return here in case battleground traps } @@ -1096,13 +1107,39 @@ void GameObject::Use(Unit* user) player->SendPreparedGossip(this); } - // possible quest objective for active quests - player->CastedCreatureOrGO(info->id, GetGUID(), 0); - if (info->goober.eventId) + { + sLog.outDebug("Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow()); GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this); + } + + // possible quest objective for active quests + if (info->goober.questId && objmgr.GetQuestTemplate(info->goober.questId)) + { + //Quest require to be active for GO using + if (player->GetQuestStatus(info->goober.questId) != QUEST_STATUS_INCOMPLETE) + break; + } + + player->CastedCreatureOrGO(info->id, GetGUID(), 0); } + if (uint32 trapEntry = info->goober.linkedTrapId) + TriggeringLinkedGameObject(trapEntry, user); + + SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + SetLootState(GO_ACTIVATED); + + uint32 time_to_restore = info->GetAutoCloseTime(); + + // this appear to be ok, however others exist in addition to this that should have custom (ex: 190510, 188692, 187389) + if (time_to_restore && info->goober.customAnim) + SendCustomAnim(); + else + SetGoState(GO_STATE_ACTIVE); + + m_cooldownTime = time(NULL) + time_to_restore; + // cast this spell later if provided spellId = info->goober.spellId; |