mirror of
https://github.com/mangosfour/server.git
synced 2025-12-27 01:37:04 +00:00
[11222] Move possition setup for Creature and subclases before Create call.
Some called from Create code can req. proper pos setup for creature. Bad side: But in way how currently code orginized impossible setup excetly position for most Creature sublasses. So in this part need more work.
This commit is contained in:
parent
c132e54f73
commit
51b4556c4b
7 changed files with 171 additions and 105 deletions
|
|
@ -149,6 +149,13 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||
return false;
|
||||
}
|
||||
|
||||
// FIXME: Setup near to finish point because GetObjectBoundingRadius set in Create but some Create calls can be dependent from proper position
|
||||
// if pet have creature_template_addon.auras with persistent point for example or script call
|
||||
float px, py, pz;
|
||||
owner->GetClosePoint(px, py, pz, 0, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE, this);
|
||||
|
||||
Relocate(px, py, pz, owner->GetOrientation());
|
||||
|
||||
Map *map = owner->GetMap();
|
||||
uint32 guid = map->GenerateLocalLowGuid(HIGHGUID_PET);
|
||||
if (!Create(guid, map, owner->GetPhaseMask(), petentry, pet_number))
|
||||
|
|
@ -157,7 +164,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||
return false;
|
||||
}
|
||||
|
||||
float px, py, pz;
|
||||
owner->GetClosePoint(px, py, pz, GetObjectBoundingRadius(), PET_FOLLOW_DIST, PET_FOLLOW_ANGLE, this);
|
||||
|
||||
Relocate(px, py, pz, owner->GetOrientation());
|
||||
|
|
@ -803,17 +809,10 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
|||
{
|
||||
if(!creature)
|
||||
{
|
||||
sLog.outError("CRITICAL: NULL pointer parsed into CreateBaseAtCreature()");
|
||||
sLog.outError("CRITICAL: NULL pointer passed into CreateBaseAtCreature()");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 guid = creature->GetMap()->GenerateLocalLowGuid(HIGHGUID_PET);
|
||||
|
||||
BASIC_LOG("Create pet");
|
||||
uint32 pet_number = sObjectMgr.GeneratePetNumber();
|
||||
if(!Create(guid, creature->GetMap(), creature->GetPhaseMask(), creature->GetEntry(), pet_number))
|
||||
return false;
|
||||
|
||||
Relocate(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
|
||||
|
||||
if(!IsPositionValid())
|
||||
|
|
@ -823,6 +822,13 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32 guid = creature->GetMap()->GenerateLocalLowGuid(HIGHGUID_PET);
|
||||
|
||||
BASIC_LOG("Create pet");
|
||||
uint32 pet_number = sObjectMgr.GeneratePetNumber();
|
||||
if(!Create(guid, creature->GetMap(), creature->GetPhaseMask(), creature->GetEntry(), pet_number))
|
||||
return false;
|
||||
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
if(!cinfo)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue