From 8d1f4f9ea0beb503e2a3014abb95263e501ef1c5 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 30 May 2009 22:15:05 -0500 Subject: *Provide another way to implement dynamic spawns. Now a creature will call its zonescript before spawn to determine the spawned entry. This can be used to implement zones such as wintergrasp with less data requirement (only need to know the entry of counterpart creatures, not require spawn points) *Use zonescript as basic class of opvp script and dugeon script (can also be used for bg) *Store zonescript in worldobject. *Add door for sapphiron. --HG-- branch : trunk --- src/game/OutdoorPvP.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/game/OutdoorPvP.cpp') diff --git a/src/game/OutdoorPvP.cpp b/src/game/OutdoorPvP.cpp index 97626c8c4e6..483574c45f7 100644 --- a/src/game/OutdoorPvP.cpp +++ b/src/game/OutdoorPvP.cpp @@ -146,22 +146,13 @@ bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 teamval, ui if(!pMap) return true; Creature* pCreature = new Creature; - if (!pCreature->Create(guid, pMap, PHASEMASK_NORMAL, entry, teamval)) + if (!pCreature->Create(guid, pMap, PHASEMASK_NORMAL, entry, teamval, x, y, z, o)) { sLog.outError("Can't create creature entry: %u",entry); delete pCreature; return false; } - pCreature->Relocate(x, y, z, o); - - if(!pCreature->IsPositionValid()) - { - sLog.outError("ERROR: Creature (guidlow %d, entry %d) not added to opvp. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY()); - delete pCreature; - return false; - } - if(spawntimedelay) pCreature->SetRespawnDelay(spawntimedelay); @@ -638,3 +629,13 @@ void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2) TeamCastSpell(team, spellId); TeamCastSpell(OTHER_TEAM(team), spellId2 ? -(int32)spellId2 : -(int32)spellId); } + +void OutdoorPvP::OnGameObjectCreate(GameObject *go, bool add) +{ + if(go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) + return; + + for(OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) + if((*itr)->m_CapturePointGUID == go->GetDBTableGUIDLow()) + (*itr)->m_capturePoint = add ? go : NULL; +} -- cgit v1.2.3