aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-06-17 07:16:40 +0200
committerKudlaty <none@none>2009-06-17 07:16:40 +0200
commite62c77fb1d4e069fff0719cca7f2c618c2b72b67 (patch)
treee801fda9ec333bae672dd3a924f335f5367767c6 /src/game
parent3c502513b00c7f3cb85207c61a01051425cbb9a9 (diff)
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
Diffstat (limited to 'src/game')
-rw-r--r--src/game/InstanceData.cpp37
-rw-r--r--src/game/InstanceData.h6
2 files changed, 43 insertions, 0 deletions
diff --git a/src/game/InstanceData.cpp b/src/game/InstanceData.cpp
index d2b341b2d2c..551db4eb2cb 100644
--- a/src/game/InstanceData.cpp
+++ b/src/game/InstanceData.cpp
@@ -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);
+ }
+}
diff --git a/src/game/InstanceData.h b/src/game/InstanceData.h
index 819185eacaa..fac766c761e 100644
--- a/src/game/InstanceData.h
+++ b/src/game/InstanceData.h
@@ -143,6 +143,12 @@ class TRINITY_DLL_SPEC InstanceData : public ZoneScript
//use HandleGameObject(GUID,boolen,NULL); in any other script
void HandleGameObject(uint64 GUID, bool open, GameObject *go = NULL);
+ //change active state of doors or buttons
+ void DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime = 0, bool bUseAlternativeState = false);
+
+ //Respawns a GO having negative spawntimesecs in gameobject-table
+ void DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn = MINUTE);
+
virtual bool SetBossState(uint32 id, EncounterState state);
const BossBoundaryMap * GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; }
protected: