mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[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:
parent
a461652636
commit
0d6b7f144c
3 changed files with 47 additions and 33 deletions
|
|
@ -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<uint32>::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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue