Core/Entities: Created factory methods to create new areatriggers, creatures and gameobjects

This commit is contained in:
hondacrx
2018-01-27 20:15:24 -05:00
parent 854ae39aeb
commit 419ee1b882
19 changed files with 382 additions and 328 deletions
+5 -12
View File
@@ -869,12 +869,7 @@ namespace Game
Map map = Global.MapMgr.CreateBaseMap(data.mapid);
// We use spawn coords to spawn
if (!map.Instanceable() && map.IsGridLoaded(data.posX, data.posY))
{
Creature creature = new Creature();
if (!creature.LoadCreatureFromDB(obj.guid, map))
return;
}
Creature.CreateCreatureFromDB(obj.guid, map);
}
break;
case "GameObject":
@@ -888,13 +883,11 @@ namespace Game
// We use current coords to unspawn, not spawn coords since creature can have changed grid
if (!map.Instanceable() && map.IsGridLoaded(data_.posX, data_.posY))
{
GameObject pGameobject = new GameObject();
if (!pGameobject.LoadGameObjectFromDB(obj.guid, map, false))
return;
else
GameObject go = GameObject.CreateGameObjectFromDB(obj.guid, map, false);
if (go)
{
if (pGameobject.isSpawnedByDefault())
map.AddToMap(pGameobject);
if (go.isSpawnedByDefault())
map.AddToMap(go);
}
}
}