mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
@@ -1644,7 +1644,7 @@ public:
|
||||
ObjectGuid::LowType lowguid = creature->GetSpawnId();
|
||||
if (creature->GetFormation())
|
||||
{
|
||||
handler->PSendSysMessage("Selected creature is already member of group %u", creature->GetFormation()->GetId());
|
||||
handler->PSendSysMessage("Selected creature is already member of group %u", creature->GetFormation()->GetLeaderSpawnId());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1652,24 +1652,19 @@ public:
|
||||
return false;
|
||||
|
||||
Player* chr = handler->GetSession()->GetPlayer();
|
||||
FormationInfo* group_member;
|
||||
|
||||
group_member = new FormationInfo;
|
||||
group_member->follow_angle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180 / float(M_PI);
|
||||
group_member->follow_dist = std::sqrt(std::pow(chr->GetPositionX() - creature->GetPositionX(), 2.f) + std::pow(chr->GetPositionY() - creature->GetPositionY(), 2.f));
|
||||
group_member->leaderGUID = leaderGUID;
|
||||
group_member->groupAI = 0;
|
||||
|
||||
sFormationMgr->CreatureGroupMap[lowguid] = group_member;
|
||||
float followAngle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180.0f / float(M_PI);
|
||||
float followDist = std::sqrt(std::pow(chr->GetPositionX() - creature->GetPositionX(), 2.f) + std::pow(chr->GetPositionY() - creature->GetPositionY(), 2.f));
|
||||
uint32 groupAI = 0;
|
||||
sFormationMgr->AddFormationMember(lowguid, followAngle, followDist, leaderGUID, groupAI);
|
||||
creature->SearchFormation();
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_FORMATION);
|
||||
|
||||
stmt->setUInt32(0, leaderGUID);
|
||||
stmt->setUInt32(1, lowguid);
|
||||
stmt->setFloat(2, group_member->follow_dist);
|
||||
stmt->setFloat(3, group_member->follow_angle);
|
||||
stmt->setUInt32(4, uint32(group_member->groupAI));
|
||||
stmt->setFloat (2, followAngle);
|
||||
stmt->setFloat (3, followDist);
|
||||
stmt->setUInt32(4, groupAI);
|
||||
|
||||
WorldDatabase.Execute(stmt);
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ struct npc_cameron : public ScriptedAI
|
||||
_childrenGUIDs.push_back(jose->GetGUID());
|
||||
|
||||
// If Formation was disbanded, remake.
|
||||
if (!me->GetFormation()->isFormed())
|
||||
if (!me->GetFormation()->IsFormed())
|
||||
for (auto guid : _childrenGUIDs)
|
||||
if (Creature* child = ObjectAccessor::GetCreature(*me, guid))
|
||||
child->SearchFormation();
|
||||
|
||||
Reference in New Issue
Block a user