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
@@ -473,10 +473,8 @@ namespace Game.Chat
Player player = handler.GetPlayer();
Map map = player.GetMap();
GameObject obj = new GameObject();
Quaternion rotation = new Quaternion(Matrix3.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f));
if (!obj.Create(objectInfo.entry, map, player, rotation, 255, GameObjectState.Ready))
GameObject obj = GameObject.CreateGameObject(objectInfo.entry, map, player, new Quaternion(Matrix3.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f)), 255, GameObjectState.Ready);
if (!obj)
return false;
obj.CopyPhaseFrom(player);
@@ -491,7 +489,8 @@ namespace Game.Chat
ulong spawnId = obj.GetSpawnId();
// this will generate a new guid if the object is in an instance
if (!obj.LoadGameObjectFromDB(spawnId, map))
obj = GameObject.CreateGameObjectFromDB(spawnId, map);
if (!obj)
return false;
// TODO: is it really necessary to add both the real and DB table guid here ?