mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
*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
This commit is contained in:
@@ -83,6 +83,9 @@ void GameObject::AddToWorld()
|
||||
///- Register the gameobject for guid lookup
|
||||
if(!IsInWorld())
|
||||
{
|
||||
if(m_zoneScript)
|
||||
m_zoneScript->OnGameObjectCreate(this, true);
|
||||
|
||||
ObjectAccessor::Instance().AddObject(this);
|
||||
WorldObject::AddToWorld();
|
||||
}
|
||||
@@ -93,16 +96,8 @@ void GameObject::RemoveFromWorld()
|
||||
///- Remove the gameobject from the accessor
|
||||
if(IsInWorld())
|
||||
{
|
||||
if(Map *map = FindMap())
|
||||
if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData())
|
||||
((InstanceMap*)map)->GetInstanceData()->OnObjectCreate(this, false);
|
||||
|
||||
switch(m_goInfo->type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_CAPTURE_POINT:
|
||||
sOutdoorPvPMgr.OnGameObjectCreate(this, false);
|
||||
break;
|
||||
}
|
||||
if(m_zoneScript)
|
||||
m_zoneScript->OnGameObjectCreate(this, false);
|
||||
|
||||
// Possible crash at access to deleted GO in Unit::m_gameobj
|
||||
if(uint64 owner_guid = GetOwnerGUID())
|
||||
@@ -181,18 +176,9 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
|
||||
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
|
||||
m_goValue->destructibleBuilding.health = goinfo->destructibleBuilding.damagedHealth;
|
||||
break;
|
||||
case GAMEOBJECT_TYPE_CAPTURE_POINT:
|
||||
sOutdoorPvPMgr.OnGameObjectCreate(this, true);
|
||||
break;
|
||||
}
|
||||
|
||||
//Notify the map's instance data.
|
||||
//Only works if you create the object in it, not if it is moves to that map.
|
||||
//Normally non-players do not teleport to other maps.
|
||||
if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData())
|
||||
{
|
||||
((InstanceMap*)map)->GetInstanceData()->OnObjectCreate(this, true);
|
||||
}
|
||||
SetZoneScript();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user