diff options
Diffstat (limited to 'src/server/game/AI')
40 files changed, 424 insertions, 483 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index 13609a9b56..fa1bf61b15 100644 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -80,7 +80,7 @@ void CombatAI::JustEngagedWith(Unit* who) if (AISpellInfo[*i].condition == AICOND_AGGRO) me->CastSpell(who, *i, false); else if (AISpellInfo[*i].condition == AICOND_COMBAT) - events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand() % AISpellInfo[*i].cooldown); + events.ScheduleEvent(*i, Milliseconds(AISpellInfo[*i].cooldown + rand() % AISpellInfo[*i].cooldown)); } } @@ -97,7 +97,7 @@ void CombatAI::UpdateAI(uint32 diff) if (uint32 spellId = events.ExecuteEvent()) { DoCast(spellId); - events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + rand() % AISpellInfo[spellId].cooldown); + events.ScheduleEvent(spellId, Milliseconds(AISpellInfo[spellId].cooldown + rand() % AISpellInfo[spellId].cooldown)); } else DoMeleeAttackIfReady(); @@ -143,7 +143,7 @@ void CasterAI::JustEngagedWith(Unit* who) DoCast(spells[spell]); cooldown += me->GetCurrentSpellCastTime(*itr); } - events.ScheduleEvent(*itr, cooldown); + events.ScheduleEvent(*itr, Milliseconds(cooldown)); } } } @@ -168,7 +168,7 @@ void CasterAI::UpdateAI(uint32 diff) { DoCast(spellId); uint32 casttime = me->GetCurrentSpellCastTime(spellId); - events.ScheduleEvent(spellId, (casttime ? casttime : 500) + GetAISpellInfo(spellId)->realCooldown); + events.ScheduleEvent(spellId, Milliseconds((casttime ? casttime : 500) + GetAISpellInfo(spellId)->realCooldown)); } } diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h index 19dbd4618c..36ebbf58b9 100644 --- a/src/server/game/AI/CoreAI/CombatAI.h +++ b/src/server/game/AI/CoreAI/CombatAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/GameObjectAI.cpp b/src/server/game/AI/CoreAI/GameObjectAI.cpp index 2e0b09fa01..47097946dd 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.cpp +++ b/src/server/game/AI/CoreAI/GameObjectAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index b366d3c2bd..962d989d01 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -46,7 +46,7 @@ public: // Pass parameters between AI virtual void DoAction(int32 /*param = 0 */) {} - virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id = 0 */) {} + virtual void SetGUID(ObjectGuid const& /*guid*/, int32 /*id = 0 */) {} virtual ObjectGuid GetGUID(int32 /*id = 0 */) const { return ObjectGuid::Empty; } static int32 Permissible(GameObject const* go); diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 8bf17be73e..588e93ea6c 100644 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h index d8c7c93109..2a15e9aa33 100644 --- a/src/server/game/AI/CoreAI/GuardAI.h +++ b/src/server/game/AI/CoreAI/GuardAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp index 0fbfaef991..5d9ecca752 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.cpp +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h index c9844cb989..9f44ef3f86 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.h +++ b/src/server/game/AI/CoreAI/PassiveAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 5b3aad614b..c4a39d6637 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 7db553adb1..0d52f9679d 100644 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/ReactorAI.cpp b/src/server/game/AI/CoreAI/ReactorAI.cpp index 9286c0ee35..b92a05725b 100644 --- a/src/server/game/AI/CoreAI/ReactorAI.cpp +++ b/src/server/game/AI/CoreAI/ReactorAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/ReactorAI.h b/src/server/game/AI/CoreAI/ReactorAI.h index b6a203189b..8e2f984642 100644 --- a/src/server/game/AI/CoreAI/ReactorAI.h +++ b/src/server/game/AI/CoreAI/ReactorAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 79b9045930..7a207be78d 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -135,6 +135,6 @@ void TotemAI::AttackStart(Unit* /*victim*/) data << me->GetGUID(); data << me->GetPositionX(); data << me->GetPositionY(); - me->GetOwner()->ToPlayer()->GetSession()->SendPacket(&data); + me->GetOwner()->ToPlayer()->SendDirectMessage(&data); } } diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h index 355f7dfb5a..602f4824d9 100644 --- a/src/server/game/AI/CoreAI/TotemAI.h +++ b/src/server/game/AI/CoreAI/TotemAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 25d24a7cd0..81bd5ab52f 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 17533d4e4c..178aaf93ba 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -217,7 +217,7 @@ public: virtual void DoAction(int32 /*param*/) {} virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; } virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} - virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id*/ = 0) {} + virtual void SetGUID(ObjectGuid const& /*guid*/, int32 /*id*/ = 0) {} virtual ObjectGuid GetGUID(int32 /*id*/ = 0) const { return ObjectGuid::Empty; } // Select the best target (in <targetType> order) from the threat list that fulfill the following: diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 12698c35dc..f21e93230e 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -50,9 +50,9 @@ AISpellInfoType* GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; * @param WorldObject target The target of the speech, in case it has elements such as $n, where the target's name will be referrenced. * @param Milliseconds delay Delay until the creature says the text line. Creatures will talk immediately by default. */ -void CreatureAI::Talk(uint8 id, WorldObject const* target /*= nullptr*/, Milliseconds delay /*= 0s*/) +void CreatureAI::Talk(uint8 id, WorldObject const* target /*= nullptr*/, Milliseconds delay /*= 0ms*/) { - if (delay > Seconds::zero()) + if (delay > 0ms) { ObjectGuid targetGuid; @@ -83,29 +83,19 @@ WorldObject* CreatureAI::GetSummoner() const inline bool IsValidCombatTarget(Creature* source, Player* target) { if (target->IsGameMaster()) - { return false; - } if (!source->IsInWorld() || !target->IsInWorld()) - { return false; - } if (!source->IsAlive() || !target->IsAlive()) - { return false; - } if (!source->InSamePhase(target)) - { return false; - } - if (source->HasUnitState(UNIT_STATE_IN_FLIGHT) || target->HasUnitState(UNIT_STATE_IN_FLIGHT)) - { + if (source->IsInFlight() || target->IsInFlight()) return false; - } return true; } @@ -182,7 +172,7 @@ void CreatureAI::MoveInLineOfSight(Unit* who) if (me->IsMoveInLineOfSightDisabled()) if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || // nothing more to do, return !who->IsInCombat() || // if not in combat, nothing more to do - !me->IsWithinDist(who, ATTACK_DISTANCE, true, false)) // if in combat and in dist - neutral to all can actually assist other creatures + !me->IsWithinDist(who, ATTACK_DISTANCE, true, false, false)) // if in combat and in dist - neutral to all can actually assist other creatures return; if (me->HasReactState(REACT_AGGRESSIVE) && me->CanStartAttack(who)) diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index cadd3b9f4c..57ea6f7ffd 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -94,7 +94,7 @@ public: EVADE_REASON_OTHER }; - void Talk(uint8 id, WorldObject const* whisperTarget = nullptr, Milliseconds delay = 0s); + void Talk(uint8 id, WorldObject const* whisperTarget = nullptr, Milliseconds delay = 0ms); void Talk(uint8 id, Milliseconds delay) { Talk(id, nullptr, delay); } WorldObject* GetSummoner() const; diff --git a/src/server/game/AI/CreatureAIFactory.h b/src/server/game/AI/CreatureAIFactory.h index 6ae188a7bb..d57e4e0b50 100644 --- a/src/server/game/AI/CreatureAIFactory.h +++ b/src/server/game/AI/CreatureAIFactory.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index 5550c48400..c0bd08b1a0 100644 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CreatureAIRegistry.cpp b/src/server/game/AI/CreatureAIRegistry.cpp index 1982924941..42efd8d320 100644 --- a/src/server/game/AI/CreatureAIRegistry.cpp +++ b/src/server/game/AI/CreatureAIRegistry.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CreatureAIRegistry.h b/src/server/game/AI/CreatureAIRegistry.h index b3cf8aae84..93a870cb83 100644 --- a/src/server/game/AI/CreatureAIRegistry.h +++ b/src/server/game/AI/CreatureAIRegistry.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 2a80bf53f9..5caa213ced 100644 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/CreatureAISelector.h b/src/server/game/AI/CreatureAISelector.h index 58b6a4978a..77c81b4002 100644 --- a/src/server/game/AI/CreatureAISelector.h +++ b/src/server/game/AI/CreatureAISelector.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/GameObjectAIFactory.h b/src/server/game/AI/GameObjectAIFactory.h index 2de110f7b2..18878bcd0c 100644 --- a/src/server/game/AI/GameObjectAIFactory.h +++ b/src/server/game/AI/GameObjectAIFactory.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 043fa814bd..762dc6e12e 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -68,7 +68,7 @@ void SummonList::DespawnEntry(uint32 entry) } } -void SummonList::DespawnAll(uint32 delay /*= 0*/) +void SummonList::DespawnAll(Milliseconds delay /*= 0ms*/) { while (!storage_.empty()) { @@ -325,13 +325,13 @@ void ScriptedAI::ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax return; } - scheduler.Schedule(timerMin == 0s ? timerMax : timerMin, timerMax, [exec, repeatMin, repeatMax, uniqueId](TaskContext context) + scheduler.Schedule(timerMin == 0ms ? timerMax : timerMin, timerMax, [exec, repeatMin, repeatMax, uniqueId](TaskContext context) { exec(); if (!uniqueId) { - repeatMax > 0s ? context.Repeat(repeatMin, repeatMax) : context.Repeat(repeatMin); + repeatMax > 0ms ? context.Repeat(repeatMin, repeatMax) : context.Repeat(repeatMin); } }); @@ -531,10 +531,6 @@ void ScriptedAI::SetEquipmentSlots(bool loadDefault, int32 mainHand /*= EQUIP_NO if (loadDefault) { me->LoadEquipment(me->GetOriginalEquipmentId(), true); - if (me->HasWeapon(OFF_ATTACK)) - me->SetCanDualWield(true); - else - me->SetCanDualWield(false); return; } @@ -547,10 +543,6 @@ void ScriptedAI::SetEquipmentSlots(bool loadDefault, int32 mainHand /*= EQUIP_NO if (offHand >= 0) { me->SetVirtualItem(1, uint32(offHand)); - if (offHand >= 1) - me->SetCanDualWield(true); - else - me->SetCanDualWield(false); } if (ranged >= 0) @@ -574,7 +566,7 @@ Player* ScriptedAI::SelectTargetFromPlayerList(float maxdist, uint32 excludeAura std::vector<Player*> tList; for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) { - if (!me->IsWithinDistInMap(itr->GetSource(), maxdist, true, false) || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) + if (!me->IsWithinDistInMap(itr->GetSource(), maxdist, true, false, false) || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) continue; if (excludeAura && itr->GetSource()->HasAura(excludeAura)) continue; @@ -662,7 +654,7 @@ void BossAI::_JustEngagedWith() ScheduleTasks(); if (callForHelpRange) { - ScheduleTimedEvent(0s, [&] + ScheduleTimedEvent(0ms, [&] { me->CallForHelp(callForHelpRange); }, 2s); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index f3d9e11a51..4aceb3fae5 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -88,7 +88,7 @@ public: void Summon(Creature const* summon) { storage_.push_back(summon->GetGUID()); } void Despawn(Creature const* summon) { storage_.remove(summon->GetGUID()); } void DespawnEntry(uint32 entry); - void DespawnAll(uint32 delay = 0); + void DespawnAll(Milliseconds delay = 0ms); bool IsAnyCreatureAlive() const; bool IsAnyCreatureWithEntryAlive(uint32 entry) const; bool IsAnyCreatureInCombat() const; @@ -355,11 +355,11 @@ struct ScriptedAI : public CreatureAI void ClearUniqueTimedEventsDone() { _uniqueTimedEvents.clear(); } // Schedules a timed event using task scheduler. - void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0s, uint32 uniqueId = 0); - void ScheduleTimedEvent(Milliseconds timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0s, uint32 uniqueId = 0) { ScheduleTimedEvent(0s, timerMax, exec, repeatMin, repeatMax, uniqueId); }; + void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0ms, uint32 uniqueId = 0); + void ScheduleTimedEvent(Milliseconds timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0ms, uint32 uniqueId = 0) { ScheduleTimedEvent(0ms, timerMax, exec, repeatMin, repeatMax, uniqueId); }; // Schedules a timed event using task scheduler that never repeats. Requires an unique non-zero ID. - void ScheduleUniqueTimedEvent(Milliseconds timer, std::function<void()> exec, uint32 uniqueId) { ScheduleTimedEvent(0s, timer, exec, 0s, 0s, uniqueId); }; + void ScheduleUniqueTimedEvent(Milliseconds timer, std::function<void()> exec, uint32 uniqueId) { ScheduleTimedEvent(0ms, timer, exec, 0ms, 0ms, uniqueId); }; bool HealthBelowPct(uint32 pct) const { return me->HealthBelowPct(pct); } bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); } @@ -463,7 +463,7 @@ enum HealthCheckStatus struct HealthCheckEventData { - HealthCheckEventData(uint8 healthPct, std::function<void()> exec, uint8 status = HEALTH_CHECK_SCHEDULED, bool allowedWhileCasting = true, Milliseconds Delay = 0s) : _healthPct(healthPct), _exec(exec), _status(status), _allowedWhileCasting(allowedWhileCasting), _delay(Delay) { }; + HealthCheckEventData(uint8 healthPct, std::function<void()> exec, uint8 status = HEALTH_CHECK_SCHEDULED, bool allowedWhileCasting = true, Milliseconds Delay = 0ms) : _healthPct(healthPct), _exec(exec), _status(status), _allowedWhileCasting(allowedWhileCasting), _delay(Delay) { }; uint8 _healthPct; std::function<void()> _exec; diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index ddabc130fb..bf156a6e96 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -33,7 +33,6 @@ npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), m_pQuestForEscort(nullptr), m_bIsActiveAttacker(true), - m_bIsRunning(false), m_bCanInstantRespawn(false), m_bCanReturnToStart(false), DespawnAtEnd(true), @@ -186,9 +185,8 @@ void npc_escortAI::JustRespawned() void npc_escortAI::ReturnToLastPoint() { float x, y, z, o; - me->SetWalk(false); me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z); + me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z, FORCED_MOVEMENT_RUN); } void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/) @@ -220,10 +218,10 @@ bool npc_escortAI::IsPlayerOrGroupInRange() { for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) if (Player* member = groupRef->GetSource()) - if (me->IsWithinDistInMap(member, GetMaxPlayerDistance(), true, false)) + if (me->IsWithinDistInMap(member, GetMaxPlayerDistance(), true, false, false)) return true; } - else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance(), true, false)) + else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance(), true, false, false)) return true; } @@ -329,7 +327,6 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) { LOG_DEBUG("scripts.ai", "EscortAI has returned to original position before combat"); - me->SetWalk(!m_bIsRunning); RemoveEscortState(STATE_ESCORT_RETURNING); if (!m_uiWPWaitTimer) @@ -418,28 +415,8 @@ void npc_escortAI::FillPointMovementListForCreature() } } -void npc_escortAI::SetRun(bool on) -{ - if (on) - { - if (!m_bIsRunning) - me->SetWalk(false); - else - LOG_DEBUG("scripts.ai", "EscortAI attempt to set run mode, but is already running."); - } - else - { - if (m_bIsRunning) - me->SetWalk(true); - else - LOG_DEBUG("scripts.ai", "EscortAI attempt to set walk mode, but is already walking."); - } - - m_bIsRunning = on; -} - //TODO: get rid of this many variables passed in function. -void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = ObjectGuid::Empty */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */) +void npc_escortAI::Start(bool isActiveAttacker /* = true*/, ObjectGuid playerGUID /* = ObjectGuid::Empty */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */) { if (me->GetVictim()) { @@ -469,7 +446,6 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false //set variables m_bIsActiveAttacker = isActiveAttacker; - m_bIsRunning = run; m_uiPlayerGUID = playerGUID; m_pQuestForEscort = quest; @@ -495,17 +471,11 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false me->SetImmuneToNPC(false); } - LOG_DEBUG("scripts.ai", "EscortAI started with {} waypoints. ActiveAttacker = {}, Run = {}, PlayerGUID = {}", - uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID.ToString()); + LOG_DEBUG("scripts.ai", "EscortAI started with {} waypoints. ActiveAttacker = {}, PlayerGUID = {}", + uint64(WaypointList.size()), m_bIsActiveAttacker, m_uiPlayerGUID.ToString()); CurrentWP = WaypointList.begin(); - //Set initial speed - if (m_bIsRunning) - me->SetWalk(false); - else - me->SetWalk(true); - AddEscortState(STATE_ESCORT_ESCORTING); if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == ESCORT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 1332837ff9..a1e2aeee4a 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -90,9 +90,8 @@ public: virtual void WaypointReached(uint32 pointId) = 0; virtual void WaypointStart(uint32 /*pointId*/) {} - void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true); + void Start(bool isActiveAttacker = true, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true); - void SetRun(bool on = true); void SetEscortPaused(bool on); bool HasEscortState(uint32 escortState) { return (m_uiEscortState & escortState); } @@ -130,7 +129,6 @@ private: std::list<Escort_Waypoint>::iterator CurrentWP; bool m_bIsActiveAttacker; //obsolete, determined by faction. - bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK) bool m_bCanInstantRespawn; //if creature should respawn instantly after escort over (if not, database respawntime are used) bool m_bCanReturnToStart; //if creature can walk same path (loop) without despawn. Not for regular escort quests. bool DespawnAtEnd; diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 019bb58b5d..ab059e8bb4 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -202,7 +202,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff) { Player* member = groupRef->GetSource(); - if (member && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE, true, false)) + if (member && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE, true, false, false)) { bIsMaxRangeExceeded = false; break; @@ -211,7 +211,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff) } else { - if (me->IsWithinDistInMap(player, MAX_PLAYER_DISTANCE, true, false)) + if (me->IsWithinDistInMap(player, MAX_PLAYER_DISTANCE, true, false, false)) bIsMaxRangeExceeded = false; } } diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index f827f7e368..beec7c23ae 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.cpp b/src/server/game/AI/ScriptedAI/ScriptedGossip.cpp index 120a75582d..cae80a09a0 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedGossip.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -42,7 +42,7 @@ void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItem player->PlayerTalkClass->GetGossipMenu().AddMenuItem(gossipMenuID, gossipMenuItemID, sender, action, boxMoney); } -void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const guid) +void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const& guid) { player->PlayerTalkClass->SendGossipMenu(npcTextID, guid); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.h b/src/server/game/AI/ScriptedAI/ScriptedGossip.h index eee8411480..d70d82c5ae 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedGossip.h +++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -94,7 +94,7 @@ void AddGossipItemFor(Player* player, uint32 icon, std::string const& text, uint void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItemID, uint32 sender, uint32 action, uint32 boxMoney = 0); // Send menu text -void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const guid); +void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const& guid); void SendGossipMenuFor(Player* player, uint32 npcTextID, Creature const* creature); // Close menu diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index cb4067e0c8..f888403491 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -43,15 +43,14 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mCanRepeatPath = false; - // spawn in run mode - // Xinef: spawn in run mode and set mRun to run... this overrides SetWalk EVERYWHERE - mRun = true; mEvadeDisabled = false; mCanAutoAttack = true; mForcedPaused = false; + mForcedMovement = FORCED_MOVEMENT_NONE; + mEscortQuestID = 0; mDespawnTime = 0; @@ -109,20 +108,20 @@ void SmartAI::UpdateDespawn(const uint32 diff) mDespawnTime -= diff; } -WayPoint* SmartAI::GetNextWayPoint() +WaypointData const* SmartAI::GetNextWayPoint() { if (!mWayPoints || mWayPoints->empty()) return nullptr; mCurrentWPID++; - WPPath::const_iterator itr = mWayPoints->find(mCurrentWPID); + auto itr = mWayPoints->find(mCurrentWPID); if (itr != mWayPoints->end()) { - mLastWP = (*itr).second; + mLastWP = &(*itr).second; if (mLastWP->id != mCurrentWPID) LOG_ERROR("scripts.ai.sai", "SmartAI::GetNextWayPoint: Got not expected waypoint id {}, expected {}", mLastWP->id, mCurrentWPID); - return (*itr).second; + return &(*itr).second; } return nullptr; } @@ -139,12 +138,15 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points) points->clear(); points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); uint32 wpCounter = mCurrentWPID; - WPPath::const_iterator itr; - while ((itr = mWayPoints->find(wpCounter++)) != mWayPoints->end()) + auto itr = mWayPoints->find(wpCounter++); + do { - WayPoint* wp = (*itr).second; - points->push_back(G3D::Vector3(wp->x, wp->y, wp->z)); + WaypointData const& wp = (*itr).second; + points->push_back(G3D::Vector3(wp.x, wp.y, wp.z)); + + itr = mWayPoints->find(wpCounter++); } + while (itr != mWayPoints->end()); } else { @@ -153,15 +155,15 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points) std::vector<G3D::Vector3> pVector; // xinef: first point in vector is unit real position pVector.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + uint32 wpCounter = mCurrentWPID; + uint32 length = (mWayPoints->size() - mCurrentWPID) * size; uint32 cnt = 0; - uint32 wpCounter = mCurrentWPID; - WPPath::const_iterator itr; - while ((itr = mWayPoints->find(wpCounter++)) != mWayPoints->end() && cnt++ <= length) + for (auto itr = mWayPoints->find(wpCounter); itr != mWayPoints->end() && cnt++ <= length; ++itr) { - WayPoint* wp = (*itr).second; - pVector.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); + WaypointData const& wp = (*itr).second; + pVector.push_back(G3D::Vector3(wp.x, wp.y, wp.z)); } if (pVector.size() > 2) // more than source + dest @@ -190,25 +192,25 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points) } } -void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker) +void SmartAI::StartPath(ForcedMovement forcedMovement, uint32 path, bool repeat, Unit* invoker, PathSource pathSource) { if (HasEscortState(SMART_ESCORT_ESCORTING)) StopPath(); if (path) { - if (!LoadPath(path)) + if (!LoadPath(path, pathSource)) return; } if (!mWayPoints || mWayPoints->empty()) return; - if (WayPoint* wp = GetNextWayPoint()) + if (WaypointData const* wp = GetNextWayPoint()) { AddEscortState(SMART_ESCORT_ESCORTING); mCanRepeatPath = repeat; - SetRun(run); + mForcedMovement = forcedMovement; if (invoker && invoker->IsPlayer()) { @@ -219,21 +221,38 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker) Movement::PointsArray pathPoints; GenerateWayPointArray(&pathPoints); - me->GetMotionMaster()->MoveSplinePath(&pathPoints); - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, wp->id, GetScript()->GetPathId()); + me->GetMotionMaster()->MoveSplinePath(&pathPoints, mForcedMovement); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_START, nullptr, wp->id, GetScript()->GetPathId()); } } -bool SmartAI::LoadPath(uint32 entry) +bool SmartAI::LoadPath(uint32 entry, PathSource pathSource) { if (HasEscortState(SMART_ESCORT_ESCORTING)) return false; - mWayPoints = sSmartWaypointMgr->GetPath(entry); - if (!mWayPoints) + switch (pathSource) { - GetScript()->SetPathId(0); - return false; + case PathSource::SMART_WAYPOINT_MGR: + { + mWayPoints = sSmartWaypointMgr->GetPath(entry); + if (!mWayPoints) + { + GetScript()->SetPathId(0); + return false; + } + break; + } + case PathSource::WAYPOINT_MGR: + { + mWayPoints = sWaypointMgr->GetPath(entry); + if (!mWayPoints) + { + GetScript()->SetPathId(0); + return false; + } + break; + } } GetScript()->SetPathId(entry); @@ -256,7 +275,6 @@ void SmartAI::PausePath(uint32 delay, bool forced) if (forced && !mWPReached) { mForcedPaused = forced; - SetRun(mRun); if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == ESCORT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); @@ -264,12 +282,12 @@ void SmartAI::PausePath(uint32 delay, bool forced) me->GetMotionMaster()->MoveIdle();//force stop auto waypoint = mWayPoints->find(mCurrentWPID); - if (waypoint->second->o.has_value()) + if (waypoint->second.orientation.has_value()) { - me->SetFacingTo(waypoint->second->o.has_value()); + me->SetFacingTo(*waypoint->second.orientation); } } - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, nullptr, mCurrentWPID, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_PAUSED, nullptr, mCurrentWPID, GetScript()->GetPathId()); } void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail) @@ -287,7 +305,7 @@ void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail) me->StopMoving(); me->GetMotionMaster()->MoveIdle(); - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_STOPPED, nullptr, mCurrentWPID, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_STOPPED, nullptr, mCurrentWPID, GetScript()->GetPathId()); EndPath(fail); } @@ -356,13 +374,13 @@ void SmartAI::EndPath(bool fail) return; } - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, mCurrentWPID, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_ENDED, nullptr, mCurrentWPID, GetScript()->GetPathId()); mCurrentWPID = 0; if (mCanRepeatPath) { if (IsAIControlled()) - StartPath(mRun, GetScript()->GetPathId(), true); + StartPath(mForcedMovement, GetScript()->GetPathId(), true); } else GetScript()->SetPathId(0); @@ -373,14 +391,12 @@ void SmartAI::EndPath(bool fail) void SmartAI::ResumePath() { - SetRun(mRun); - if (mLastWP) { Movement::PointsArray pathPoints; GenerateWayPointArray(&pathPoints); - me->GetMotionMaster()->MoveSplinePath(&pathPoints); + me->GetMotionMaster()->MoveSplinePath(&pathPoints, mForcedMovement); } } @@ -389,10 +405,9 @@ void SmartAI::ReturnToLastOOCPos() if (!IsAIControlled()) return; - me->SetWalk(false); float x, y, z, o; me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, x, y, z); + me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, x, y, z, FORCED_MOVEMENT_RUN); } void SmartAI::UpdatePath(const uint32 diff) @@ -410,7 +425,7 @@ void SmartAI::UpdatePath(const uint32 diff) // Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me); - me->DespawnOrUnsummon(1); + me->DespawnOrUnsummon(1ms); return; } mEscortInvokerCheckTimer = 1000; @@ -425,7 +440,7 @@ void SmartAI::UpdatePath(const uint32 diff) { if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING) && (mWPReached || mForcedPaused)) { - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, nullptr, mCurrentWPID, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_RESUMED, nullptr, mCurrentWPID, GetScript()->GetPathId()); RemoveEscortState(SMART_ESCORT_PAUSED); if (mForcedPaused)// if paused between 2 wps resend movement { @@ -469,7 +484,6 @@ void SmartAI::UpdatePath(const uint32 diff) EndPath(); else if (GetNextWayPoint()) { - SetRun(mRun); // xinef: if we have reached waypoint, and there is no working spline movement it means our splitted array has ended, make new one if (me->movespline->Finalized()) ResumePath(); @@ -605,7 +619,7 @@ void SmartAI::MovepointReached(uint32 id) } mWPReached = true; - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, mCurrentWPID); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_REACHED, nullptr, mCurrentWPID); if (mLastWP) { @@ -629,7 +643,6 @@ void SmartAI::MovepointReached(uint32 id) EndPath(); else if (GetNextWayPoint()) { - SetRun(mRun); // xinef: if we have reached waypoint, and there is no working spline movement it means our splitted array has ended, make new one if (me->movespline->Finalized()) ResumePath(); @@ -643,7 +656,7 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data) me->ClearUnitState(UNIT_STATE_EVADE); if (MovementType == WAYPOINT_MOTION_TYPE) - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_DATA_REACHED, nullptr, Data + 1); // Data + 1 to align smart_scripts and waypoint_data Id rows + GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, Data); // data now corresponds to columns GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, nullptr, MovementType, Data); if (!HasEscortState(SMART_ESCORT_ESCORTING)) @@ -675,7 +688,6 @@ void SmartAI::EnterEvadeMode(EvadeReason /*why*/) GetScript()->ProcessEventsFor(SMART_EVENT_EVADE); //must be after aura clear so we can cast spells from db - SetRun(mRun); if (HasEscortState(SMART_ESCORT_ESCORTING)) { AddEscortState(SMART_ESCORT_RETURNING); @@ -794,7 +806,7 @@ void SmartAI::JustReachedHome() GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME); if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath()) - me->GetMotionMaster()->MovePath(me->GetWaypointPath(), true); + me->GetMotionMaster()->MoveWaypoint(me->GetWaypointPath(), true); } mJustReset = false; @@ -850,7 +862,6 @@ void SmartAI::AttackStart(Unit* who) { if (!me->HasUnitState(UNIT_STATE_NO_COMBAT_MOVEMENT)) { - SetRun(mRun); MovementGeneratorType type = me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE); if (type == ESCORT_MOTION_TYPE || type == POINT_MOTION_TYPE) { @@ -952,9 +963,7 @@ void SmartAI::OnCharmed(bool /* apply */) if (!charmed && !me->IsInEvadeMode()) { if (mCanRepeatPath) - StartPath(mRun, GetScript()->GetPathId(), true); - else - me->SetWalk(!mRun); + StartPath(mForcedMovement, GetScript()->GetPathId(), true); if (Unit* charmer = me->GetCharmer()) AttackStart(charmer); @@ -993,7 +1002,7 @@ void SmartAI::SetData(uint32 id, uint32 value, WorldObject* invoker) GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, unit, id, value, false, nullptr, gob); } -void SmartAI::SetGUID(ObjectGuid /*guid*/, int32 /*id*/) +void SmartAI::SetGUID(ObjectGuid const& /*guid*/, int32 /*id*/) { } @@ -1002,12 +1011,6 @@ ObjectGuid SmartAI::GetGUID(int32 /*id*/) const return ObjectGuid::Empty; } -void SmartAI::SetRun(bool run) -{ - me->SetWalk(!run); - mRun = run; -} - void SmartAI::SetFly(bool fly) { // xinef: set proper flag! @@ -1108,7 +1111,6 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui mFollowArrivedEntry = end; mFollowArrivedAlive = !aliveState; // negate - 0 is alive mFollowCreditType = creditType; - SetRun(mRun); me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle); } @@ -1167,7 +1169,7 @@ void SmartAI::OnSpellClick(Unit* clicker, bool& /*result*/) void SmartAI::PathEndReached(uint32 /*pathId*/) { - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_DATA_ENDED, nullptr, 0, me->GetWaypointPath()); + GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, 0, me->GetWaypointPath()); me->LoadPath(0); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 5bd9fcd8b3..d6b957cc00 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -52,13 +52,13 @@ public: bool IsAIControlled() const; // Start moving to the desired MovePoint - void StartPath(bool run = false, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr); - bool LoadPath(uint32 entry); + void StartPath(ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr, PathSource pathSource = PathSource::SMART_WAYPOINT_MGR); + bool LoadPath(uint32 entry, PathSource pathSource); void PausePath(uint32 delay, bool forced = false); void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false); void EndPath(bool fail = false); void ResumePath(); - WayPoint* GetNextWayPoint(); + WaypointData const* GetNextWayPoint(); void GenerateWayPointArray(Movement::PointsArray* points); bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); } void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; } @@ -164,7 +164,7 @@ public: void SetData(uint32 id, uint32 value, WorldObject* invoker); // Used in scripts to share variables - void SetGUID(ObjectGuid guid, int32 id = 0) override; + void SetGUID(ObjectGuid const& guid, int32 id = 0) override; // Used in scripts to share variables ObjectGuid GetGUID(int32 id = 0) const override; @@ -175,9 +175,6 @@ public: // Called at movepoint reached void MovepointReached(uint32 id); - // Makes the creature run/walk - void SetRun(bool run = true); - void SetFly(bool fly = true); void SetSwim(bool swim = true); @@ -230,21 +227,21 @@ private: void ReturnToLastOOCPos(); void UpdatePath(const uint32 diff); SmartScript mScript; - WPPath* mWayPoints; + WaypointPath const* mWayPoints; uint32 mEscortState; uint32 mCurrentWPID; bool mWPReached; bool mOOCReached; uint32 mWPPauseTimer; - WayPoint* mLastWP; + WaypointData const* mLastWP; uint32 mEscortNPCFlags; uint32 GetWPCount() { return mWayPoints ? mWayPoints->size() : 0; } bool mCanRepeatPath; - bool mRun; bool mEvadeDisabled; bool mCanAutoAttack; bool mForcedPaused; uint32 mInvincibilityHpLevel; + ForcedMovement mForcedMovement; bool AssistPlayerInCombatAgainst(Unit* who); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 1a64641e95..a9b42edeb4 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -1683,10 +1683,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsCreature(target)) { - if (IsSmart(target->ToCreature())) - CAST_AI(SmartAI, target->ToCreature()->AI())->SetRun(e.action.setRun.run); - else - target->ToCreature()->SetWalk(e.action.setRun.run ? false : true); // Xinef: reversed + target->ToCreature()->SetWalk(e.action.setRun.run ? false : true); } } @@ -1726,12 +1723,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset, e.action.setCounter.subtract); break; } - case SMART_ACTION_WP_START: + case SMART_ACTION_ESCORT_START: { if (!IsSmart()) break; - bool run = e.action.wpStart.run != 0; + ForcedMovement forcedMovement = static_cast<ForcedMovement>(e.action.wpStart.forcedMovement); uint32 entry = e.action.wpStart.pathID; bool repeat = e.action.wpStart.repeat != 0; @@ -1745,7 +1742,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } me->SetReactState((ReactStates)e.action.wpStart.reactState); - CAST_AI(SmartAI, me->AI())->StartPath(run, entry, repeat, unit); + CAST_AI(SmartAI, me->AI())->StartPath(forcedMovement, entry, repeat, unit); uint32 quest = e.action.wpStart.quest; uint32 DespawnTime = e.action.wpStart.despawnTime; @@ -1753,16 +1750,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u CAST_AI(SmartAI, me->AI())->SetDespawnTime(DespawnTime); break; } - case SMART_ACTION_WP_PAUSE: + case SMART_ACTION_ESCORT_PAUSE: { if (!IsSmart()) break; uint32 delay = e.action.wpPause.delay; - CAST_AI(SmartAI, me->AI())->PausePath(delay, e.GetEventType() == SMART_EVENT_WAYPOINT_REACHED ? false : true); + CAST_AI(SmartAI, me->AI())->PausePath(delay, e.GetEventType() == SMART_EVENT_ESCORT_REACHED ? false : true); break; } - case SMART_ACTION_WP_STOP: + case SMART_ACTION_ESCORT_STOP: { if (!IsSmart()) break; @@ -1773,7 +1770,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u CAST_AI(SmartAI, me->AI())->StopPath(DespawnTime, quest, fail); break; } - case SMART_ACTION_WP_RESUME: + case SMART_ACTION_ESCORT_RESUME: { if (!IsSmart()) break; @@ -1854,8 +1851,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (TransportBase* trans = me->GetDirectTransport()) trans->CalculatePassengerPosition(dest.x, dest.y, dest.z); - me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, dest.x, dest.y, dest.z, true, isForced, - isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE, e.target.o); + me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, dest.x, dest.y, dest.z, FORCED_MOVEMENT_NONE, + 0.f, e.target.o, true, isForced, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); break; } @@ -1871,9 +1868,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u randomPoint.m_positionX, randomPoint.m_positionY, randomPoint.m_positionZ, - true, - isForced, - isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE + FORCED_MOVEMENT_NONE, + 0.f, 0.f, true, isForced, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE ); } @@ -1897,7 +1893,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u else if (e.action.moveToPos.ContactDistance) target->GetNearPoint(me, x, y, z, e.action.moveToPos.ContactDistance, 0, target->GetAngle(me)); - me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, true, isForced, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); + me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, FORCED_MOVEMENT_NONE, + 0.f, 0.f, true, isForced, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); break; } @@ -1914,7 +1911,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u SAIBool isForced = !e.action.moveToPosTarget.disableForceDestination; Creature* ctarget = target->ToCreature(); - ctarget->GetMotionMaster()->MovePoint(e.action.moveToPosTarget.pointId, e.target.x, e.target.y, e.target.z, true, isForced, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); + ctarget->GetMotionMaster()->MovePoint(e.action.moveToPosTarget.pointId, e.target.x, e.target.y, e.target.z, FORCED_MOVEMENT_NONE, + 0.f, 0.f, true, isForced, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); } } @@ -2521,21 +2519,19 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { for (uint32 wp = e.action.startClosestWaypoint.pathId1; wp <= e.action.startClosestWaypoint.pathId2; ++wp) { - WPPath* path = sSmartWaypointMgr->GetPath(wp); + WaypointPath* path = sSmartWaypointMgr->GetPath(wp); if (!path || path->empty()) continue; auto itrWp = path->find(1); if (itrWp != path->end()) { - if (WayPoint* wpData = itrWp->second) + WaypointData& wpData = itrWp->second; + float distToThisPath = creature->GetExactDistSq(wpData.x, wpData.y, wpData.z); + if (distToThisPath < distanceToClosest) { - float distToThisPath = creature->GetExactDistSq(wpData->x, wpData->y, wpData->z); - if (distToThisPath < distanceToClosest) - { - distanceToClosest = distToThisPath; - closestWpId = wp; - } + distanceToClosest = distToThisPath; + closestWpId = wp; } } } @@ -2543,9 +2539,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (closestWpId) { bool repeat = e.action.startClosestWaypoint.repeat; - bool run = e.action.startClosestWaypoint.run; + ForcedMovement forcedMovement = static_cast<ForcedMovement>(e.action.startClosestWaypoint.forcedMovement); - CAST_AI(SmartAI, creature->AI())->StartPath(repeat, closestWpId, run); + CAST_AI(SmartAI, creature->AI())->StartPath(forcedMovement, closestWpId, repeat); } } } @@ -3223,7 +3219,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } break; } - case SMART_ACTION_WAYPOINT_DATA_START: + case SMART_ACTION_WAYPOINT_START: { if (e.action.wpData.pathId) { @@ -3232,7 +3228,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsCreature(target)) { target->ToCreature()->LoadPath(e.action.wpData.pathId); - target->ToCreature()->GetMotionMaster()->MovePath(e.action.wpData.pathId, e.action.wpData.repeat); + target->ToCreature()->GetMotionMaster()->MoveWaypoint(e.action.wpData.pathId, e.action.wpData.repeat, e.action.wpData.pathSource); } } } @@ -3249,7 +3245,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { uint32 path = urand(e.action.wpDataRandom.pathId1, e.action.wpDataRandom.pathId2); target->ToCreature()->LoadPath(path); - target->ToCreature()->GetMotionMaster()->MovePath(path, e.action.wpDataRandom.repeat); + target->ToCreature()->GetMotionMaster()->MoveWaypoint(path, e.action.wpDataRandom.repeat); } } } @@ -4400,22 +4396,24 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui { if ((e.event.movementInform.type && var0 != e.event.movementInform.type) || (e.event.movementInform.id && var1 != e.event.movementInform.id)) return; + if (e.event.movementInform.pathId != 0 && e.event.movementInform.pathId != me->GetWaypointPath()) + return; ProcessAction(e, unit, var0, var1); break; } case SMART_EVENT_TRANSPORT_RELOCATE: - case SMART_EVENT_WAYPOINT_START: + case SMART_EVENT_ESCORT_START: { if (e.event.waypoint.pathID && var0 != e.event.waypoint.pathID) return; ProcessAction(e, unit, var0); break; } - case SMART_EVENT_WAYPOINT_REACHED: - case SMART_EVENT_WAYPOINT_RESUMED: - case SMART_EVENT_WAYPOINT_PAUSED: - case SMART_EVENT_WAYPOINT_STOPPED: - case SMART_EVENT_WAYPOINT_ENDED: + case SMART_EVENT_ESCORT_REACHED: + case SMART_EVENT_ESCORT_RESUMED: + case SMART_EVENT_ESCORT_PAUSED: + case SMART_EVENT_ESCORT_STOPPED: + case SMART_EVENT_ESCORT_ENDED: { if (!me || (e.event.waypoint.pointID && var0 != e.event.waypoint.pointID) || (e.event.waypoint.pathID && GetPathId() != e.event.waypoint.pathID)) return; @@ -4809,8 +4807,8 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui RecalcTimer(e, 1200, 1200); break; } - case SMART_EVENT_WAYPOINT_DATA_REACHED: - case SMART_EVENT_WAYPOINT_DATA_ENDED: + case SMART_EVENT_WAYPOINT_REACHED: + case SMART_EVENT_WAYPOINT_ENDED: { if (!me || (e.event.wpData.pointId && var0 != e.event.wpData.pointId) || (e.event.wpData.pathId && me->GetWaypointPath() != e.event.wpData.pathId)) return; diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 4f98c49d1a..e0f32438c8 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 6db3e4cb2d..c4dab89b91 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -48,12 +48,9 @@ void SmartWaypointMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - for (std::unordered_map<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr) + for (auto itr : waypoint_map) { - for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr) - delete pathItr->second; - - delete itr->second; + delete itr.second; } waypoint_map.clear(); @@ -88,7 +85,7 @@ void SmartWaypointMgr::LoadFromDB() if (last_entry != entry) { - waypoint_map[entry] = new WPPath(); + waypoint_map[entry] = new WaypointPath(); last_id = 1; count++; } @@ -97,7 +94,15 @@ void SmartWaypointMgr::LoadFromDB() LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry {}, unexpected point id {}, expected {}.", entry, id, last_id); last_id++; - (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z, o, delay); + WaypointData data; + data.id = id; + data.x = x; + data.y = y; + data.z = z; + data.orientation = o; + data.delay = delay; + data.move_type = WAYPOINT_MOVE_TYPE_MAX; + (*waypoint_map[entry]).emplace(id, data); last_entry = entry; total++; @@ -109,12 +114,9 @@ void SmartWaypointMgr::LoadFromDB() SmartWaypointMgr::~SmartWaypointMgr() { - for (std::unordered_map<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr) + for (auto itr : waypoint_map) { - for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr) - delete pathItr->second; - - delete itr->second; + delete itr.second; } } @@ -555,6 +557,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) case SMART_TARGET_RANDOM_POINT: case SMART_TARGET_ROLE_SELECTION: case SMART_TARGET_LOOT_RECIPIENTS: + case SMART_TARGET_VEHICLE_PASSENGER: case SMART_EVENT_SUMMONED_UNIT_DIES: case SMART_EVENT_SUMMONED_UNIT_EVADE: case SMART_TARGET_PLAYER_RANGE: @@ -624,8 +627,8 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) case SMART_EVENT_CORPSE_REMOVED: return NO_PARAMS; case SMART_EVENT_AI_INIT: return NO_PARAMS; case SMART_EVENT_DATA_SET: return sizeof(SmartEvent::dataSet); - case SMART_EVENT_WAYPOINT_START: return sizeof(SmartEvent::waypoint); - case SMART_EVENT_WAYPOINT_REACHED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_START: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_REACHED: return sizeof(SmartEvent::waypoint); case SMART_EVENT_TRANSPORT_ADDPLAYER: return NO_PARAMS; case SMART_EVENT_TRANSPORT_ADDCREATURE: return sizeof(SmartEvent::transportAddCreature); case SMART_EVENT_TRANSPORT_REMOVE_PLAYER: return NO_PARAMS; @@ -640,10 +643,10 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) case SMART_EVENT_TEXT_OVER: return sizeof(SmartEvent::textOver); case SMART_EVENT_RECEIVE_HEAL: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_JUST_SUMMONED: return NO_PARAMS; - case SMART_EVENT_WAYPOINT_PAUSED: return sizeof(SmartEvent::waypoint); - case SMART_EVENT_WAYPOINT_RESUMED: return sizeof(SmartEvent::waypoint); - case SMART_EVENT_WAYPOINT_STOPPED: return sizeof(SmartEvent::waypoint); - case SMART_EVENT_WAYPOINT_ENDED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_PAUSED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_RESUMED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_STOPPED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_ENDED: return sizeof(SmartEvent::waypoint); case SMART_EVENT_TIMED_EVENT_TRIGGERED: return sizeof(SmartEvent::timedEvent); case SMART_EVENT_UPDATE: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_LINK: return NO_PARAMS; @@ -676,8 +679,8 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) case SMART_EVENT_AREA_CASTING: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_AREA_RANGE: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_SUMMONED_UNIT_EVADE: return sizeof(SmartEvent::summoned); - case SMART_EVENT_WAYPOINT_DATA_REACHED: return sizeof(SmartEvent::wpData); - case SMART_EVENT_WAYPOINT_DATA_ENDED: return sizeof(SmartEvent::wpData); + case SMART_EVENT_WAYPOINT_REACHED: return sizeof(SmartEvent::wpData); + case SMART_EVENT_WAYPOINT_ENDED: return sizeof(SmartEvent::wpData); default: LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an event {} with no unused params specified in SmartAIMgr::CheckUnusedEventParams(), please report this.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetEventType()); @@ -764,9 +767,9 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) case SMART_ACTION_SUMMON_GO: return sizeof(SmartAction::summonGO); case SMART_ACTION_KILL_UNIT: return NO_PARAMS; case SMART_ACTION_ACTIVATE_TAXI: return sizeof(SmartAction::taxi); - case SMART_ACTION_WP_START: return sizeof(SmartAction::wpStart); - case SMART_ACTION_WP_PAUSE: return sizeof(SmartAction::wpPause); - case SMART_ACTION_WP_STOP: return sizeof(SmartAction::wpStop); + case SMART_ACTION_ESCORT_START: return sizeof(SmartAction::wpStart); + case SMART_ACTION_ESCORT_PAUSE: return sizeof(SmartAction::wpPause); + case SMART_ACTION_ESCORT_STOP: return sizeof(SmartAction::wpStop); case SMART_ACTION_ADD_ITEM: return sizeof(SmartAction::item); case SMART_ACTION_REMOVE_ITEM: return sizeof(SmartAction::item); case SMART_ACTION_INSTALL_AI_TEMPLATE: return sizeof(SmartAction::installTtemplate); @@ -776,7 +779,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) case SMART_ACTION_TELEPORT: return sizeof(SmartAction::teleport); case SMART_ACTION_SET_COUNTER: return sizeof(SmartAction::setCounter); case SMART_ACTION_STORE_TARGET_LIST: return sizeof(SmartAction::storeTargets); - case SMART_ACTION_WP_RESUME: return NO_PARAMS; + case SMART_ACTION_ESCORT_RESUME: return NO_PARAMS; case SMART_ACTION_SET_ORIENTATION: return sizeof(SmartAction::orientation); case SMART_ACTION_CREATE_TIMED_EVENT: return sizeof(SmartAction::timeEvent); case SMART_ACTION_PLAYMOVIE: return sizeof(SmartAction::movie); @@ -866,6 +869,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) case SMART_ACTION_ZONE_UNDER_ATTACK: return NO_PARAMS; case SMART_ACTION_LOAD_GRID: return NO_PARAMS; case SMART_ACTION_MUSIC: return sizeof(SmartAction::music); + case SMART_ACTION_DO_ACTION: return sizeof(SmartAction::doAction); case SMART_ACTION_SET_GUID: return sizeof(SmartAction::setGuid); case SMART_ACTION_SCRIPTED_SPAWN: return sizeof(SmartAction::scriptSpawn); case SMART_ACTION_SET_SCALE: return sizeof(SmartAction::setScale); @@ -873,13 +877,14 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) case SMART_ACTION_PLAY_SPELL_VISUAL: return sizeof(SmartAction::spellVisual); case SMART_ACTION_FOLLOW_GROUP: return sizeof(SmartAction::followGroup); case SMART_ACTION_SET_ORIENTATION_TARGET: return sizeof(SmartAction::orientationTarget); - case SMART_ACTION_WAYPOINT_DATA_START: return sizeof(SmartAction::wpData); + case SMART_ACTION_WAYPOINT_START: return sizeof(SmartAction::wpData); case SMART_ACTION_WAYPOINT_DATA_RANDOM: return sizeof(SmartAction::wpDataRandom); case SMART_ACTION_MOVEMENT_STOP: return NO_PARAMS; case SMART_ACTION_MOVEMENT_PAUSE: return sizeof(SmartAction::move); case SMART_ACTION_MOVEMENT_RESUME: return sizeof(SmartAction::move); case SMART_ACTION_WORLD_SCRIPT: return sizeof(SmartAction::worldStateScript); case SMART_ACTION_DISABLE_REWARD: return sizeof(SmartAction::reward); + case SMART_ACTION_DISMOUNT: return NO_PARAMS; default: LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an action with no unused params specified in SmartAIMgr::CheckUnusedActionParams(), please report this.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); @@ -944,6 +949,9 @@ bool SmartAIMgr::CheckUnusedTargetParams(SmartScriptHolder const& e) case SMART_TARGET_VEHICLE_PASSENGER: return sizeof(SmartTarget::vehicle); // case SMART_TARGET_CLOSEST_UNSPAWNED_GAMEOBJECT: return sizeof(SmartTarget::goClosest); case SMART_TARGET_PLAYER_WITH_AURA: return sizeof(SmartTarget::playerWithAura); + case SMART_TARGET_RANDOM_POINT: return sizeof(SmartTarget::randomPoint); + case SMART_TARGET_SUMMONED_CREATURES: return sizeof(SmartTarget::summonedCreatures); + case SMART_TARGET_INSTANCE_STORAGE: return sizeof(SmartTarget::instanceStorage); default: LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using a target {} with no unused params specified in SmartAIMgr::CheckUnusedTargetParams(), please report this.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType()); @@ -1414,19 +1422,19 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_QUEST_REWARDED: case SMART_EVENT_QUEST_FAIL: case SMART_EVENT_JUST_SUMMONED: - case SMART_EVENT_WAYPOINT_START: - case SMART_EVENT_WAYPOINT_REACHED: - case SMART_EVENT_WAYPOINT_PAUSED: - case SMART_EVENT_WAYPOINT_RESUMED: - case SMART_EVENT_WAYPOINT_STOPPED: - case SMART_EVENT_WAYPOINT_ENDED: + case SMART_EVENT_ESCORT_START: + case SMART_EVENT_ESCORT_REACHED: + case SMART_EVENT_ESCORT_PAUSED: + case SMART_EVENT_ESCORT_RESUMED: + case SMART_EVENT_ESCORT_STOPPED: + case SMART_EVENT_ESCORT_ENDED: case SMART_EVENT_GOSSIP_SELECT: case SMART_EVENT_GOSSIP_HELLO: case SMART_EVENT_JUST_CREATED: case SMART_EVENT_FOLLOW_COMPLETED: case SMART_EVENT_ON_SPELLCLICK: - case SMART_EVENT_WAYPOINT_DATA_REACHED: - case SMART_EVENT_WAYPOINT_DATA_ENDED: + case SMART_EVENT_WAYPOINT_REACHED: + case SMART_EVENT_WAYPOINT_ENDED: break; default: LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type({}), Entry {} SourceType {} Event {} Action {}, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); @@ -1562,11 +1570,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } - if (e.action.startClosestWaypoint.repeat > 1 || e.action.startClosestWaypoint.run > 1) + if (e.action.startClosestWaypoint.repeat > 1 || e.action.startClosestWaypoint.forcedMovement >= FORCED_MOVEMENT_MAX) { - LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has invalid run ({}) or repeat ({}) parameter, must be 0 or 1.", + LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} has invalid forcedMovement ({}) or repeat ({}) parameter, must be 0 or 1.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), - e.action.startClosestWaypoint.repeat, e.action.startClosestWaypoint.run); + e.action.startClosestWaypoint.repeat, e.action.startClosestWaypoint.forcedMovement); return false; } break; @@ -1719,11 +1727,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } break; - case SMART_ACTION_WP_STOP: + case SMART_ACTION_ESCORT_STOP: if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest)) return false; return IsSAIBoolValid(e, e.action.wpStop.fail); - case SMART_ACTION_WP_START: + case SMART_ACTION_ESCORT_START: { if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID)) { @@ -1743,8 +1751,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } - return IsSAIBoolValid(e, e.action.wpStart.run) && - IsSAIBoolValid(e, e.action.wpStart.repeat); + if (e.action.wpStart.forcedMovement >= FORCED_MOVEMENT_MAX) + { + LOG_ERROR("sql.sql", "SmartAIMgr: Creature {} Event {} Action {} uses invalid forcedMovement {}, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.forcedMovement); + return false; + } + + return IsSAIBoolValid(e, e.action.wpStart.repeat); } case SMART_ACTION_CREATE_TIMED_EVENT: { @@ -1933,7 +1946,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_STORE_TARGET_LIST: case SMART_ACTION_COMBAT_STOP: case SMART_ACTION_DIE: - case SMART_ACTION_WP_RESUME: + case SMART_ACTION_ESCORT_RESUME: case SMART_ACTION_KILL_UNIT: case SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL: case SMART_ACTION_RESET_GOBJECT: @@ -1943,7 +1956,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_SET_INST_DATA64: case SMART_ACTION_SET_DATA: case SMART_ACTION_MOVE_FORWARD: - case SMART_ACTION_WP_PAUSE: + case SMART_ACTION_ESCORT_PAUSE: case SMART_ACTION_SET_FLY: case SMART_ACTION_FORCE_DESPAWN: case SMART_ACTION_SET_INGAME_PHASE_MASK: @@ -2013,7 +2026,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_PLAY_SPELL_VISUAL: case SMART_ACTION_FOLLOW_GROUP: case SMART_ACTION_SET_ORIENTATION_TARGET: - case SMART_ACTION_WAYPOINT_DATA_START: + case SMART_ACTION_WAYPOINT_START: case SMART_ACTION_WAYPOINT_DATA_RANDOM: case SMART_ACTION_MOVEMENT_STOP: case SMART_ACTION_MOVEMENT_PAUSE: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 47b0d47961..5e8e5e9e0c 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -26,29 +26,10 @@ #include "Optional.h" #include "SpellMgr.h" #include <limits> +#include "WaypointMgr.h" typedef uint32 SAIBool; -struct WayPoint -{ - WayPoint(uint32 _id, float _x, float _y, float _z, Optional<float> _o, uint32 _delay) - { - id = _id; - x = _x; - y = _y; - z = _z; - o = _o; - delay = _delay; - } - - uint32 id; - float x; - float y; - float z; - std::optional<float> o; - uint32 delay; -}; - enum eSmartAI { SMART_EVENT_PARAM_COUNT = 4, @@ -149,13 +130,13 @@ enum SMART_EVENT SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax SMART_EVENT_DAMAGED_TARGET = 33, // MinDmg, MaxDmg, CooldownMin, CooldownMax - SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID + SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID, PathId(0 - any) SMART_EVENT_SUMMON_DESPAWNED = 35, // Entry, CooldownMin, CooldownMax SMART_EVENT_CORPSE_REMOVED = 36, // NONE SMART_EVENT_AI_INIT = 37, // NONE SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax - SMART_EVENT_WAYPOINT_START = 39, // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_REACHED = 40, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_START = 39, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_REACHED = 40, // PointId(0any), pathID(0any) SMART_EVENT_TRANSPORT_ADDPLAYER = 41, // NONE SMART_EVENT_TRANSPORT_ADDCREATURE = 42, // Entry (0 any) SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, // NONE @@ -170,10 +151,10 @@ enum SMART_EVENT SMART_EVENT_TEXT_OVER = 52, // GroupId from creature_text, creature entry who talks (0 any) SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax SMART_EVENT_JUST_SUMMONED = 54, // none - SMART_EVENT_WAYPOINT_PAUSED = 55, // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_RESUMED = 56, // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_STOPPED = 57, // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_ENDED = 58, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_PAUSED = 55, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_RESUMED = 56, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_STOPPED = 57, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_ENDED = 58, // PointId(0any), pathID(0any) SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, // id SMART_EVENT_UPDATE = 60, // InitialMin, InitialMax, RepeatMin, RepeatMax SMART_EVENT_LINK = 61, // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly @@ -213,8 +194,8 @@ enum SMART_EVENT SMART_EVENT_AREA_CASTING = 105, // min, max, repeatMin, repeatMax, rangeMin, rangeMax SMART_EVENT_AREA_RANGE = 106, // min, max, repeatMin, repeatMax, rangeMin, rangeMax SMART_EVENT_SUMMONED_UNIT_EVADE = 107, // CreatureId(0 all), CooldownMin, CooldownMax - SMART_EVENT_WAYPOINT_DATA_REACHED = 108, // PointId (0: any), pathId (0: any) - SMART_EVENT_WAYPOINT_DATA_ENDED = 109, // PointId (0: any), pathId (0: any) + SMART_EVENT_WAYPOINT_REACHED = 108, // PointId (0: any), pathId (0: any) + SMART_EVENT_WAYPOINT_ENDED = 109, // PointId (0: any), pathId (0: any) SMART_EVENT_IS_IN_MELEE_RANGE = 110, // min, max, repeatMin, repeatMax, dist, invert (0: false, 1: true) SMART_EVENT_AC_END = 111 @@ -356,6 +337,7 @@ struct SmartEvent { uint32 type; uint32 id; + uint32 pathId; } movementInform; struct @@ -608,9 +590,9 @@ enum SMART_ACTION SMART_ACTION_SUMMON_GO = 50, // GameObjectID, DespawnTime, targetSummon, summonType (0 time or summoner dies/1 time) SMART_ACTION_KILL_UNIT = 51, // SMART_ACTION_ACTIVATE_TAXI = 52, // TaxiID - SMART_ACTION_WP_START = 53, // run/walk, pathID, canRepeat, quest, despawntime, reactState - SMART_ACTION_WP_PAUSE = 54, // time - SMART_ACTION_WP_STOP = 55, // despawnTime, quest, fail? + SMART_ACTION_ESCORT_START = 53, // run/walk, pathID, canRepeat, quest, despawntime, reactState + SMART_ACTION_ESCORT_PAUSE = 54, // time + SMART_ACTION_ESCORT_STOP = 55, // despawnTime, quest, fail? SMART_ACTION_ADD_ITEM = 56, // itemID, count SMART_ACTION_REMOVE_ITEM = 57, // itemID, count SMART_ACTION_INSTALL_AI_TEMPLATE = 58, // AITemplateID @@ -620,7 +602,7 @@ enum SMART_ACTION SMART_ACTION_TELEPORT = 62, // mapID, SMART_ACTION_SET_COUNTER = 63, // id, value, reset (0/1) SMART_ACTION_STORE_TARGET_LIST = 64, // varID, - SMART_ACTION_WP_RESUME = 65, // none + SMART_ACTION_ESCORT_RESUME = 65, // none SMART_ACTION_SET_ORIENTATION = 66, // quick change, random orientation? (0/1), turnAngle SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance SMART_ACTION_PLAYMOVIE = 68, // entry @@ -732,7 +714,7 @@ enum SMART_ACTION SMART_ACTION_PLAY_SPELL_VISUAL = 229, // visualId, visualIdImpact SMART_ACTION_FOLLOW_GROUP = 230, // followState, followType, dist SMART_ACTION_SET_ORIENTATION_TARGET = 231, // type, target_type, target_param1, target_param2, target_param3, target_param4 - SMART_ACTION_WAYPOINT_DATA_START = 232, // pathId, repeat + SMART_ACTION_WAYPOINT_START = 232, // pathId, repeat, pathSource SMART_ACTION_WAYPOINT_DATA_RANDOM = 233, // pathId1, pathId2, repeat SMART_ACTION_MOVEMENT_STOP = 234, // SMART_ACTION_MOVEMENT_PAUSE = 235, // timer @@ -1041,7 +1023,7 @@ struct SmartAction struct { - SAIBool run; + uint32 forcedMovement; uint32 pathID; SAIBool repeat; uint32 quest; @@ -1295,7 +1277,7 @@ struct SmartAction uint32 pathId1; uint32 pathId2; uint32 repeat; - uint32 run; + uint32 forcedMovement; } startClosestWaypoint; struct @@ -1482,6 +1464,7 @@ struct SmartAction { uint32 pathId; SAIBool repeat; + PathSource pathSource; } wpData; struct @@ -1853,8 +1836,8 @@ const uint32 SmartAIEventMask[SMART_EVENT_AC_END][2] = {SMART_EVENT_CORPSE_REMOVED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_AI_INIT, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_DATA_SET, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, - {SMART_EVENT_WAYPOINT_START, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_START, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_TRANSPORT_ADDPLAYER, SMART_SCRIPT_TYPE_MASK_TRANSPORT }, {SMART_EVENT_TRANSPORT_ADDCREATURE, SMART_SCRIPT_TYPE_MASK_TRANSPORT }, {SMART_EVENT_TRANSPORT_REMOVE_PLAYER, SMART_SCRIPT_TYPE_MASK_TRANSPORT }, @@ -1869,10 +1852,10 @@ const uint32 SmartAIEventMask[SMART_EVENT_AC_END][2] = {SMART_EVENT_TEXT_OVER, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_RECEIVE_HEAL, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_JUST_SUMMONED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_PAUSED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_RESUMED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_STOPPED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_ENDED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_PAUSED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_RESUMED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_STOPPED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_ENDED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_TIMED_EVENT_TRIGGERED, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_UPDATE, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_LINK, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT + SMART_SCRIPT_TYPE_MASK_AREATRIGGER + SMART_SCRIPT_TYPE_MASK_EVENT + SMART_SCRIPT_TYPE_MASK_GOSSIP + SMART_SCRIPT_TYPE_MASK_QUEST + SMART_SCRIPT_TYPE_MASK_SPELL + SMART_SCRIPT_TYPE_MASK_TRANSPORT + SMART_SCRIPT_TYPE_MASK_INSTANCE }, @@ -1922,8 +1905,8 @@ const uint32 SmartAIEventMask[SMART_EVENT_AC_END][2] = {SMART_EVENT_AREA_CASTING, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_AREA_RANGE, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_SUMMONED_UNIT_EVADE, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, - {SMART_EVENT_WAYPOINT_DATA_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_DATA_ENDED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_WAYPOINT_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_WAYPOINT_ENDED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_IS_IN_MELEE_RANGE, SMART_SCRIPT_TYPE_MASK_CREATURE }, }; @@ -2010,8 +1993,6 @@ public: static constexpr uint32 DEFAULT_PRIORITY = std::numeric_limits<uint32>::max(); }; -typedef std::unordered_map<uint32, WayPoint*> WPPath; - typedef std::vector<WorldObject*> ObjectVector; class ObjectGuidVector @@ -2059,7 +2040,7 @@ public: void LoadFromDB(); - WPPath* GetPath(uint32 id) + WaypointPath* GetPath(uint32 id) { if (waypoint_map.find(id) != waypoint_map.end()) return waypoint_map[id]; @@ -2067,7 +2048,7 @@ public: } private: - std::unordered_map<uint32, WPPath*> waypoint_map; + std::unordered_map<uint32, WaypointPath*> waypoint_map; }; // all events for a single entry diff --git a/src/server/game/AI/enuminfo_CreatureAI.cpp b/src/server/game/AI/enuminfo_CreatureAI.cpp index 12b2b20b89..785b80b373 100644 --- a/src/server/game/AI/enuminfo_CreatureAI.cpp +++ b/src/server/game/AI/enuminfo_CreatureAI.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along |
