[9181] Rewrite parts of GameObject use for GO type 10

This implement using autoclose time for type 10 and also sending a custom animation for some.
To avoid duplicate code, remove code from SendLoot() (handled in Use() instead)

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-01-15 01:23:11 +01:00
parent a461652636
commit 0d6b7f144c
3 changed files with 47 additions and 33 deletions

View file

@ -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: