diff options
Diffstat (limited to 'src/game/Level2.cpp')
-rw-r--r-- | src/game/Level2.cpp | 57 |
1 files changed, 5 insertions, 52 deletions
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index d9516835201..e7eeda7966d 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1117,21 +1117,12 @@ bool ChatHandler::HandleNpcAddCommand(const char* args) Map *map = chr->GetMap(); Creature* pCreature = new Creature; - if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, (uint32)teamval)) + if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, (uint32)teamval, x, y, z, o)) { delete pCreature; return false; } - pCreature->Relocate(x,y,z,o); - - if(!pCreature->IsPositionValid()) - { - sLog.outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY()); - delete pCreature; - return false; - } - pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); uint32 db_guid = pCreature->GetDBTableGUIDLow(); @@ -3100,20 +3091,12 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) wpCreature->AddObjectToRemoveList(); // re-create Creature* wpCreature2 = new Creature; - if (!wpCreature2->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0)) + if (!wpCreature2->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) { PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); delete wpCreature2; return false; } - wpCreature2->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()); - - if(!wpCreature2->IsPositionValid()) - { - sLog.outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",wpCreature2->GetGUIDLow(),wpCreature2->GetEntry(),wpCreature2->GetPositionX(),wpCreature2->GetPositionY()); - delete wpCreature2; - return false; - } wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); @@ -3327,7 +3310,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) float o = chr->GetOrientation(); Creature* wpCreature = new Creature; - if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0)) + if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, x, y, z, o)) { PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete wpCreature; @@ -3335,16 +3318,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - wpCreature->Relocate(x, y, z, o); - - if(!wpCreature->IsPositionValid()) - { - sLog.outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",wpCreature->GetGUIDLow(),wpCreature->GetEntry(),wpCreature->GetPositionX(),wpCreature->GetPositionY()); - delete wpCreature; - delete result; - return false; - } - sLog.outDebug("DEBUG: UPDATE waypoint_data SET wpguid = '%u"); // set "wpguid" column to the visual waypoint WorldDatabase.PExecuteLog("UPDATE waypoint_data SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), pathid, point); @@ -3391,7 +3364,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) Map *map = chr->GetMap(); Creature* pCreature = new Creature; - if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT),map, chr->GetPhaseMaskForSpawn(), id, 0)) + if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT),map, chr->GetPhaseMaskForSpawn(), id, 0, x, y, z, o)) { PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete pCreature; @@ -3399,16 +3372,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - pCreature->Relocate(x, y, z, o); - - if(!pCreature->IsPositionValid()) - { - sLog.outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY()); - delete pCreature; - delete result; - return false; - } - pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map); map->Add(pCreature); @@ -3456,7 +3419,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) Map *map = chr->GetMap(); Creature* pCreature = new Creature; - if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0)) + if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, x, y, z, o)) { PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); delete pCreature; @@ -3464,16 +3427,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - pCreature->Relocate(x, y, z, o); - - if(!pCreature->IsPositionValid()) - { - sLog.outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY()); - delete pCreature; - delete result; - return false; - } - pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map); map->Add(pCreature); |