mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Merge [SD2]
r1021 Remove ScriptedAI boolean InCombat and use real combat state instead where check is needed. r1022 Added new ScriptedInstance function, DoUseDoorOrButton() for future use in instance scripts. r1023 Updated instance function DoUseDoorOrButton with additional variables. Remove some older code and replace to use new function. r1024 Fix typo in previous commit. - Skip r1025 Added instance script for blood furnace and make bosses set instance data. Some code cleanup - only some code cleanup --HG-- branch : trunk
This commit is contained in:
@@ -242,3 +242,40 @@ std::string InstanceData::GetBossSaveData()
|
||||
saveStream << (uint32)i->state << " ";
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void InstanceData::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, bool bUseAlternativeState)
|
||||
{
|
||||
if (!uiGuid)
|
||||
return;
|
||||
|
||||
GameObject* pGo = instance->GetGameObject(uiGuid);
|
||||
|
||||
if (pGo)
|
||||
{
|
||||
if (pGo->GetGoType() == GAMEOBJECT_TYPE_DOOR || pGo->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
|
||||
{
|
||||
if (pGo->getLootState() == GO_READY)
|
||||
pGo->UseDoorOrButton(uiWithRestoreTime,bUseAlternativeState);
|
||||
else if (pGo->getLootState() == GO_ACTIVATED)
|
||||
pGo->ResetDoorOrButton();
|
||||
}
|
||||
else
|
||||
error_log("SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.",pGo->GetEntry(),pGo->GetGoType());
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceData::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn)
|
||||
{
|
||||
if (GameObject* pGo = instance->GetGameObject(uiGuid))
|
||||
{
|
||||
//not expect any of these should ever be handled
|
||||
if (pGo->GetGoType()==GAMEOBJECT_TYPE_FISHINGNODE || pGo->GetGoType()==GAMEOBJECT_TYPE_DOOR ||
|
||||
pGo->GetGoType()==GAMEOBJECT_TYPE_BUTTON || pGo->GetGoType()==GAMEOBJECT_TYPE_TRAP)
|
||||
return;
|
||||
|
||||
if (pGo->isSpawned())
|
||||
return;
|
||||
|
||||
pGo->SetRespawnTime(uiTimeToDespawn);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user