diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index d4a3a5632..833196135 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -377,7 +377,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; } @@ -394,13 +404,16 @@ void GameObject::Update(uint32 /*p_time*/) std::set::const_iterator end = m_unique_users.end(); for (; it != end; it++) { - Unit* owner = Unit::GetUnit(*this, uint64(*it)); - if (owner) owner->CastSpell(owner, spellId, false, 0, 0, GetGUID()); + if (Unit* owner = Unit::GetUnit(*this, uint64(*it))) + owner->CastSpell(owner, spellId, false, NULL, NULL, GetGUID()); } m_unique_users.clear(); m_usetimes = 0; } + + SetGoState(GO_STATE_READY); + //any return here in case battleground traps } @@ -960,13 +973,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 && sObjectMgr.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) + SendGameObjectCustomAnim(GetGUID()); + else + SetGoState(GO_STATE_ACTIVE); + + m_cooldownTime = time(NULL) + time_to_restore; + // cast this spell later if provided spellId = info->goober.spellId; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 0e437fd1a..7193df3b9 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -3116,32 +3116,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) return; case GAMEOBJECT_TYPE_GOOBER: - // goober_scripts can be triggered if the player don't have the quest - if (gameObjTarget->GetGOInfo()->goober.eventId) - { - sLog.outDebug("Goober ScriptStart id %u for GO %u", gameObjTarget->GetGOInfo()->goober.eventId,gameObjTarget->GetDBTableGUIDLow()); - player->GetMap()->ScriptsStart(sEventScripts, gameObjTarget->GetGOInfo()->goober.eventId, player, gameObjTarget); - } - - // cast goober spell - if (gameObjTarget->GetGOInfo()->goober.questId) - ///Quest require to be active for GO using - if (player->GetQuestStatus(gameObjTarget->GetGOInfo()->goober.questId) != QUEST_STATUS_INCOMPLETE) - return; - - gameObjTarget->AddUniqueUse(player); - gameObjTarget->SetLootState(GO_JUST_DEACTIVATED); - - //TODO? Objective counting called without spell check but with quest objective check - // if send spell id then this line will duplicate to spell casting call (double counting) - // So we or have this line and not required in quest_template have reqSpellIdN - // or must remove this line and required in DB have data in quest_template have reqSpellIdN for all quest using cases. - player->CastedCreatureOrGO(gameObjTarget->GetEntry(), gameObjTarget->GetGUID(), 0); - - // triggering linked GO - if (uint32 trapEntry = gameObjTarget->GetGOInfo()->goober.linkedTrapId) - gameObjTarget->TriggeringLinkedGameObject(trapEntry,m_caster); - + gameObjTarget->Use(m_caster); return; case GAMEOBJECT_TYPE_CHEST: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 11ef52248..66f4f79f5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9180" + #define REVISION_NR "9181" #endif // __REVISION_NR_H__