fix(Core/Creature): Fixed GroupAI flags usage in creature_formations (#7544)

* fix(Core/Creature): Fixed GroupAI flags usage

* fix(Core/Creature): build fix + code style...

* fix(Core/Creatures): trailing white spaces...

* Core/Formations: allow only certain members to have follow formation

* Core/Formations: fixed ancient data corruption in CreatureGroup::LeaderMoveTo

* Core/Formations: minor optimization

* Core/Formations: improved some warning messages

* Core/Formations: do not load invalid formation data which has unsupported group ai

* Core/Formations: minor adjust for recent commit

* Core/Formations: log formation data which has angle and distance but dont have GROUP_AI_FLAG_FOLLOW_LEADER flag

* Core/Formations: Minor optimization for formation data handling

* Core/Formations: make sure that FormationInfo members are always initialized on its creation

* Core/Formations: minor warnings adjustments

* DB/Formations: fixed some warnings

* Core/Formations: check group flags only if there is any
I have gues that maybe leader could not assist any member at all but members maybe could be linked for motion

* DB/Formations: fixed rest of DB warnings

* Core/Formations: more improvements for supported AI mask check

* Core/Formations: more improvements for data checks

* DB/Formations: fixed warnings

* meh

* DB/Formations: minor correction

* Core/Formations: code style - brackets, you suck... :D
This commit is contained in:
Andrius Peleckas
2021-09-24 20:51:55 +03:00
committed by GitHub
parent 5d08c6c64b
commit e6b1201e50
5 changed files with 177 additions and 89 deletions

View File

@@ -1474,13 +1474,11 @@ 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 / M_PI;
group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - creature->GetPositionX(), int(2)) + pow(chr->GetPositionY() - creature->GetPositionY(), int(2)));
group_member->leaderGUID = leaderGUID;
group_member->groupAI = 0;
FormationInfo group_member;
group_member.follow_angle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180 / M_PI;
group_member.follow_dist = sqrtf(pow(chr->GetPositionX() - creature->GetPositionX(), int(2)) + pow(chr->GetPositionY() - creature->GetPositionY(), int(2)));
group_member.leaderGUID = leaderGUID;
group_member.groupAI = 0;
sFormationMgr->CreatureGroupMap[lowguid] = group_member;
creature->SearchFormation();
@@ -1488,9 +1486,9 @@ public:
WorldDatabasePreparedStatement* 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, group_member.follow_dist);
stmt->setFloat(3, group_member.follow_angle);
stmt->setUInt32(4, uint32(group_member.groupAI));
WorldDatabase.Execute(stmt);