diff options
Diffstat (limited to 'src/server/game')
613 files changed, 5685 insertions, 5480 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 diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 4129609db0..8be9d5168e 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.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/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index 3f2eb983e5..c6fbbea318 100644 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.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/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index f96775eb44..2451aac3d9 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.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 @@ -1826,6 +1826,15 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve // someone on this realm has already completed that achievement if (sAchievementMgr->IsRealmCompleted(achievement)) return false; + + // A character may only have 1 race-specific 'Realm First!' achievement + // prevent clever use of the race/faction change service to obtain multiple 'Realm First!' achievements + constexpr std::array<uint32, 9> raceSpecificRealmFirstAchievements { 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413 }; + bool isRaceSpecific = std::ranges::find(raceSpecificRealmFirstAchievements, achievement->ID) != std::ranges::end(raceSpecificRealmFirstAchievements); + if (isRaceSpecific) + for (uint32 raceAchievementId : raceSpecificRealmFirstAchievements) + if (raceAchievementId != achievement->ID && HasAchieved(raceAchievementId)) + return false; } // pussywizard: progress will be deleted after getting the achievement (optimization) @@ -2378,7 +2387,7 @@ void AchievementMgr::SendAllAchievementData() const { WorldPacket data(SMSG_ALL_ACHIEVEMENT_DATA, _completedAchievements.size() * 8 + 4 + _criteriaProgress.size() * 38 + 4); BuildAllDataPacket(&data); - GetPlayer()->GetSession()->SendPacket(&data); + GetPlayer()->SendDirectMessage(&data); } void AchievementMgr::SendRespondInspectAchievements(Player* player) const @@ -2386,7 +2395,7 @@ void AchievementMgr::SendRespondInspectAchievements(Player* player) const WorldPacket data(SMSG_RESPOND_INSPECT_ACHIEVEMENTS, 9 + _completedAchievements.size() * 8 + 4 + _criteriaProgress.size() * 38 + 4); data << GetPlayer()->GetPackGUID(); BuildAllDataPacket(&data); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } /** diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h index adbb6ea3cd..268084e840 100644 --- a/src/server/game/Achievements/AchievementMgr.h +++ b/src/server/game/Achievements/AchievementMgr.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/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 650a26feaa..4e139b7481 100644 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.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/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h index e9bb2ebd5d..1c9037f89a 100644 --- a/src/server/game/Addons/AddonMgr.h +++ b/src/server/game/Addons/AddonMgr.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/ArenaSpectator/ArenaSpectator.cpp b/src/server/game/ArenaSpectator/ArenaSpectator.cpp index e1f0c76027..fe0e49c120 100644 --- a/src/server/game/ArenaSpectator/ArenaSpectator.cpp +++ b/src/server/game/ArenaSpectator/ArenaSpectator.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 @@ -306,7 +306,7 @@ AC_GAME_API void ArenaSpectator::SendPacketTo(Player const* player, std::string& { WorldPacket data; CreatePacket(data, message); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } template<> diff --git a/src/server/game/ArenaSpectator/ArenaSpectator.h b/src/server/game/ArenaSpectator/ArenaSpectator.h index 7e050ab3cd..9bb2f20b25 100644 --- a/src/server/game/ArenaSpectator/ArenaSpectator.h +++ b/src/server/game/ArenaSpectator/ArenaSpectator.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/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index dcc1b76621..2cf588a0d3 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.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/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index 6045d5a2c3..60ead26a32 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.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/AuctionHouse/AuctionHouseSearcher.cpp b/src/server/game/AuctionHouse/AuctionHouseSearcher.cpp index 0d50d7eafa..909091d04b 100644 --- a/src/server/game/AuctionHouse/AuctionHouseSearcher.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseSearcher.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 @@ -354,7 +354,7 @@ void AuctionHouseSearcher::Update() { Player* player = ObjectAccessor::FindConnectedPlayer(response->playerGuid); if (player) - player->GetSession()->SendPacket(&response->packet); + player->SendDirectMessage(&response->packet); delete response; } diff --git a/src/server/game/AuctionHouse/AuctionHouseSearcher.h b/src/server/game/AuctionHouse/AuctionHouseSearcher.h index b1f547f426..d778633d2c 100644 --- a/src/server/game/AuctionHouse/AuctionHouseSearcher.h +++ b/src/server/game/AuctionHouse/AuctionHouseSearcher.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/Autobroadcast/AutobroadcastMgr.cpp b/src/server/game/Autobroadcast/AutobroadcastMgr.cpp index f41e27bb01..befbb4ba3f 100644 --- a/src/server/game/Autobroadcast/AutobroadcastMgr.cpp +++ b/src/server/game/Autobroadcast/AutobroadcastMgr.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 @@ -203,6 +203,6 @@ void AutobroadcastMgr::SendNotificationAnnouncement(uint8 textId) data << localizedMessage; // Send packet to the player - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); }); } diff --git a/src/server/game/Autobroadcast/AutobroadcastMgr.h b/src/server/game/Autobroadcast/AutobroadcastMgr.h index 05dc6319ef..44ebca1d5c 100644 --- a/src/server/game/Autobroadcast/AutobroadcastMgr.h +++ b/src/server/game/Autobroadcast/AutobroadcastMgr.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/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index f74aebff2f..9ad1a9c9a4 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.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 @@ -458,7 +458,7 @@ void Battlefield::BroadcastPacketToZone(WorldPacket const* data) const for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team) for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) - player->GetSession()->SendPacket(data); + player->SendDirectMessage(data); } void Battlefield::BroadcastPacketToQueue(WorldPacket const* data) const @@ -466,7 +466,7 @@ void Battlefield::BroadcastPacketToQueue(WorldPacket const* data) const for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team) for (GuidUnorderedSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) - player->GetSession()->SendPacket(data); + player->SendDirectMessage(data); } void Battlefield::BroadcastPacketToWar(WorldPacket const* data) const @@ -474,7 +474,7 @@ void Battlefield::BroadcastPacketToWar(WorldPacket const* data) const for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team) for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) - player->GetSession()->SendPacket(data); + player->SendDirectMessage(data); } void Battlefield::SendWarning(uint8 id, WorldObject const* target /*= nullptr*/) @@ -663,7 +663,7 @@ void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const ObjectGu data << guid << time; ASSERT(player); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } // ---------------------- @@ -855,7 +855,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z return go; } -Creature* Battlefield::GetCreature(ObjectGuid const guid) +Creature* Battlefield::GetCreature(ObjectGuid const& guid) { if (!m_Map) return nullptr; @@ -863,7 +863,7 @@ Creature* Battlefield::GetCreature(ObjectGuid const guid) return m_Map->GetCreature(guid); } -GameObject* Battlefield::GetGameObject(ObjectGuid const guid) +GameObject* Battlefield::GetGameObject(ObjectGuid const& guid) { if (!m_Map) return nullptr; diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index ab00697c33..f67e168629 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.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 @@ -146,6 +146,7 @@ class BfGraveyard { public: BfGraveyard(Battlefield* Bf); + virtual ~BfGraveyard() = default; // Method to changing who controls the graveyard void GiveControlTo(TeamId team); @@ -302,8 +303,8 @@ public: Creature* SpawnCreature(uint32 entry, Position pos, TeamId teamId); GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o); - Creature* GetCreature(ObjectGuid const guid); - GameObject* GetGameObject(ObjectGuid const guid); + Creature* GetCreature(ObjectGuid const& guid); + GameObject* GetGameObject(ObjectGuid const& guid); // Script-methods diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 5fcbd2b2b8..6d90c7ec1b 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.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/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 57844197f7..3993d0bc77 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.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/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h index 6eaaa5c047..3cb79d355d 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.h +++ b/src/server/game/Battlefield/BattlefieldMgr.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/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index c0a4f55362..6f61e1fa7c 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.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 @@ -415,7 +415,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer) { for (GuidUnorderedSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Creature* creature = GetCreature(*itr)) - creature->DespawnOrUnsummon(1); + creature->DespawnOrUnsummon(1ms); m_vehicles[team].clear(); } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 3f285ef76f..ae0f0b3710 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.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/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index d3e70fc31c..92a97fa5a4 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.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/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h index 165e2dc8e2..75fe9c2269 100644 --- a/src/server/game/Battlegrounds/Arena.h +++ b/src/server/game/Battlegrounds/Arena.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/Battlegrounds/ArenaScore.h b/src/server/game/Battlegrounds/ArenaScore.h index 4535b6c14d..6b466ebc0f 100644 --- a/src/server/game/Battlegrounds/ArenaScore.h +++ b/src/server/game/Battlegrounds/ArenaScore.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/Battlegrounds/ArenaSeason/ArenaSeasonMgr.cpp b/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonMgr.cpp index e466eb7185..2da4b128f8 100644 --- a/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonMgr.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/Battlegrounds/ArenaSeason/ArenaSeasonMgr.h b/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonMgr.h index 7a1ee97c72..f238b2a909 100644 --- a/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonMgr.h +++ b/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonMgr.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/Battlegrounds/ArenaSeason/ArenaSeasonRewardsDistributor.cpp b/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonRewardsDistributor.cpp index dff7961a2b..a575e61ff2 100644 --- a/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonRewardsDistributor.cpp +++ b/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonRewardsDistributor.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/Battlegrounds/ArenaSeason/ArenaSeasonRewardsDistributor.h b/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonRewardsDistributor.h index 144fae5fff..7a7864e7d3 100644 --- a/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonRewardsDistributor.h +++ b/src/server/game/Battlegrounds/ArenaSeason/ArenaSeasonRewardsDistributor.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/Battlegrounds/ArenaSeason/ArenaTeamFilter.h b/src/server/game/Battlegrounds/ArenaSeason/ArenaTeamFilter.h index 2ac66344fa..6bfb1cd118 100644 --- a/src/server/game/Battlegrounds/ArenaSeason/ArenaTeamFilter.h +++ b/src/server/game/Battlegrounds/ArenaSeason/ArenaTeamFilter.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/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 753fc9d481..985193f9d5 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.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 @@ -162,7 +162,7 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid) // Feed data to the struct ArenaTeamMember newMember; - //newMember.Name = playerName; + newMember.Name = playerName; newMember.Guid = playerGuid; newMember.Class = playerClass; newMember.SeasonGames = 0; @@ -249,7 +249,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) newMember.WeekWins = fields[3].Get<uint16>(); newMember.SeasonGames = fields[4].Get<uint16>(); newMember.SeasonWins = fields[5].Get<uint16>(); - //newMember.Name = fields[6].Get<std::string>(); + newMember.Name = fields[6].Get<std::string>(); newMember.Class = fields[7].Get<uint8>(); newMember.PersonalRating = fields[8].Get<uint16>(); newMember.MatchMakerRating = fields[9].Get<uint16>() > 0 ? fields[9].Get<uint16>() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING); @@ -349,7 +349,7 @@ void ArenaTeam::DelMember(ObjectGuid guid, bool cleanDb) playerMember->RemoveBattlegroundQueueId(bgQueue); sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, nullptr, playerMember->GetBattlegroundQueueIndex(bgQueue), STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL); queue.RemovePlayer(playerMember->GetGUID(), true); - playerMember->GetSession()->SendPacket(&data); + playerMember->SendDirectMessage(&data); } } } @@ -567,7 +567,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet) { for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) if (Player* player = ObjectAccessor::FindConnectedPlayer(itr->Guid)) - player->GetSession()->SendPacket(packet); + player->SendDirectMessage(packet); } void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3) diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h index 3aa09b3e5c..33c47920e2 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.h +++ b/src/server/game/Battlegrounds/ArenaTeam.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/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index 8ba0e3cd4c..4eb240b3cc 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.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/Battlegrounds/ArenaTeamMgr.h b/src/server/game/Battlegrounds/ArenaTeamMgr.h index 6ca67b5f30..0e8229c0c9 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.h +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.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/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 7ddd4e87e2..70b8a90670 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.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 @@ -608,7 +608,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) { WorldPacket status; sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType(), player->GetBgTeamId()); - player->GetSession()->SendPacket(&status); + player->SendDirectMessage(&status); player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); player->ResetAllPowers(); @@ -652,7 +652,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) data << t->GetGUID(); data << uint32(t->GetZoneId()); data << uint32(15 * IN_MILLISECONDS); - p->GetSession()->SendPacket(&data); + p->SendDirectMessage(&data); } m_ToBeTeleported.clear(); } @@ -713,14 +713,14 @@ Position const* Battleground::GetTeamStartPosition(TeamId teamId) const void Battleground::SendPacketToAll(WorldPacket const* packet) { for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - itr->second->GetSession()->SendPacket(packet); + itr->second->SendDirectMessage(packet); } void Battleground::SendPacketToTeam(TeamId teamId, WorldPacket const* packet, Player* sender, bool self) { for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second)) - itr->second->GetSession()->SendPacket(packet); + itr->second->SendDirectMessage(packet); } void Battleground::SendChatMessage(Creature* source, uint8 textId, WorldObject* target /*= nullptr*/) @@ -937,7 +937,7 @@ void Battleground::EndBattleground(PvPTeamId winnerTeamId) BlockMovement(player); - player->GetSession()->SendPacket(&pvpLogData); + player->SendDirectMessage(&pvpLogData); if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) { @@ -964,7 +964,7 @@ void Battleground::EndBattleground(PvPTeamId winnerTeamId) WorldPacket data; sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType(), player->GetBgTeamId()); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, player->GetMapId()); } @@ -1062,7 +1062,7 @@ void Battleground::RemovePlayerAtLeave(Player* player) WorldPacket data; sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetBgTypeID(), GetArenaType()); @@ -1178,16 +1178,19 @@ void Battleground::AddPlayer(Player* player) sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, player); SendPacketToTeam(teamId, &data, player, false); - player->RemoveAurasByType(SPELL_AURA_MOUNTED); - // add arena specific auras if (isArena()) { // restore pets health before remove - if (Pet* pet = player->GetPet()) + Pet* pet = player->GetPet(); + if (pet) if (pet->IsAlive()) pet->SetHealth(pet->GetMaxHealth()); + player->RemoveArenaAuras(); + if (pet) + pet->RemoveArenaAuras(); + player->RemoveArenaSpellCooldowns(true); player->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT); player->DestroyConjuredItems(true); player->UnsummonPetTemporaryIfAny(); @@ -1338,7 +1341,7 @@ bool Battleground::HasFreeSlots() const void Battleground::SpectatorsSendPacket(WorldPacket& data) { for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr) - (*itr)->GetSession()->SendPacket(&data); + (*itr)->SendDirectMessage(&data); } void Battleground::ReadyMarkerClicked(Player* p) @@ -1810,10 +1813,10 @@ void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* player) BlockMovement(player); BuildPvPLogDataPacket(data); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType(), player->GetBgTeamId()); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } uint32 Battleground::GetAlivePlayersCountByTeam(TeamId teamId) const diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 90b828e697..b22cdc143a 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.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/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index f447a47d41..e290c9b6b6 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.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 @@ -670,7 +670,7 @@ void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battlegrou if (time_ == uint32(-1)) time_ = 0; data << guid << time_; - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId) diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index 36c8a30c3d..313bee8f0d 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.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/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 81832437b8..60da08d670 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.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 @@ -366,7 +366,7 @@ void BattlegroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount) void BattlegroundQueue::AddEvent(BasicEvent* Event, uint64 e_time) { - m_events.AddEvent(Event, m_events.CalculateTime(e_time)); + m_events.AddEventAtOffset(Event, Milliseconds(e_time)); } bool BattlegroundQueue::IsPlayerInvitedToRatedArena(ObjectGuid pl_guid) @@ -1274,7 +1274,7 @@ void BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, // send status packet WorldPacket data; sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated()); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); // pussywizard: if (bg->isArena() && bg->isRated()) @@ -1312,7 +1312,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) // send remaining time in queue WorldPacket data; sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType, TEAM_NEUTRAL, bg->isRated(), m_BgTypeId); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } } diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h index d3589b3047..475fae9621 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.h +++ b/src/server/game/Battlegrounds/BattlegroundQueue.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/Battlegrounds/BattlegroundScore.h b/src/server/game/Battlegrounds/BattlegroundScore.h index 33345bd8af..80ce87fe05 100644 --- a/src/server/game/Battlegrounds/BattlegroundScore.h +++ b/src/server/game/Battlegrounds/BattlegroundScore.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/Battlegrounds/BattlegroundSpamProtect.cpp b/src/server/game/Battlegrounds/BattlegroundSpamProtect.cpp index 2105960aa8..f917c61bc2 100644 --- a/src/server/game/Battlegrounds/BattlegroundSpamProtect.cpp +++ b/src/server/game/Battlegrounds/BattlegroundSpamProtect.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/Battlegrounds/BattlegroundSpamProtect.h b/src/server/game/Battlegrounds/BattlegroundSpamProtect.h index c08fa9825d..7990deb999 100644 --- a/src/server/game/Battlegrounds/BattlegroundSpamProtect.h +++ b/src/server/game/Battlegrounds/BattlegroundSpamProtect.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/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 10c0956e5d..cff3ec3ffc 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.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 @@ -101,7 +101,7 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) uint8 controlledPoints = _controlledPoints[teamId]; if (controlledPoints == 0) { - _bgEvents.ScheduleEvent(eventId, 3000); + _bgEvents.ScheduleEvent(eventId, 3s); break; } @@ -115,7 +115,7 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics)) RewardHonorToTeam(GetBonusHonorFromKill(1), teamId); if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics)) - RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId); + RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, uint32(10 * _abReputationRate), teamId); if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE)) { if (teamId == TEAM_ALLIANCE) @@ -170,8 +170,8 @@ void BattlegroundAB::StartingEventOpenDoors() DoorOpen(BG_AB_OBJECT_GATE_A); DoorOpen(BG_AB_OBJECT_GATE_H); StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_AB_EVENT_START_BATTLE); - _bgEvents.ScheduleEvent(BG_AB_EVENT_ALLIANCE_TICK, 3000); - _bgEvents.ScheduleEvent(BG_AB_EVENT_HORDE_TICK, 3000); + _bgEvents.ScheduleEvent(BG_AB_EVENT_ALLIANCE_TICK, 3s); + _bgEvents.ScheduleEvent(BG_AB_EVENT_HORDE_TICK, 3s); } void BattlegroundAB::AddPlayer(Player* player) @@ -421,6 +421,7 @@ bool BattlegroundAB::SetupBattleground() { _honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID(true)) ? BG_AB_HONOR_TICK_WEEKEND : BG_AB_HONOR_TICK_NORMAL; _reputationTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID(true)) ? BG_AB_REP_TICK_WEEKEND : BG_AB_REP_TICK_NORMAL; + _abReputationRate = sWorld->getRate(RATE_REPUTATION_GAIN_AB); for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index a250c9f16e..72932386a1 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.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 @@ -170,12 +170,11 @@ enum BG_AB_Misc BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400, BG_AB_MAX_TEAM_SCORE = 1600, - - BG_AB_FLAG_CAPTURING_TIME = 60000, - BG_AB_BANNER_UPDATE_TIME = 2000 }; +constexpr Milliseconds BG_AB_FLAG_CAPTURING_TIME = 60s; +constexpr Milliseconds BG_AB_BANNER_UPDATE_TIME = 2s; -const uint32 BG_AB_TickIntervals[BG_AB_DYNAMIC_NODES_COUNT + 1] = {0, 12000, 9000, 6000, 3000, 1000}; +const Milliseconds BG_AB_TickIntervals[BG_AB_DYNAMIC_NODES_COUNT + 1] = {0ms, 12s, 9s, 6s, 3s, 1s}; const uint32 BG_AB_TickPoints[BG_AB_DYNAMIC_NODES_COUNT + 1] = {0, 10, 10, 10, 10, 30}; const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899}; @@ -299,6 +298,7 @@ private: EventMap _bgEvents; uint32 _honorTics; uint32 _reputationTics; + float _abReputationRate; uint8 _controlledPoints[PVP_TEAMS_COUNT] {}; bool _teamScores500Disadvantage[PVP_TEAMS_COUNT] {}; uint32 _configurableMaxTeamScore; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 5b6a8b335f..d00a7cb83f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.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 @@ -194,21 +194,21 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) case AV_QUEST_A_COMMANDER1: case AV_QUEST_H_COMMANDER1: m_Team_QuestStatus[teamId][1]++; - RewardReputationToTeam(teamId, 1, teamId); + RewardReputationToTeam(teamId, uint32(1 * _avReputationRate), teamId); if (m_Team_QuestStatus[teamId][1] == 30) LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid); break; case AV_QUEST_A_COMMANDER2: case AV_QUEST_H_COMMANDER2: m_Team_QuestStatus[teamId][2]++; - RewardReputationToTeam(teamId, 1, teamId); + RewardReputationToTeam(teamId, uint32(1 * _avReputationRate), teamId); if (m_Team_QuestStatus[teamId][2] == 60) LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid); break; case AV_QUEST_A_COMMANDER3: case AV_QUEST_H_COMMANDER3: m_Team_QuestStatus[teamId][3]++; - RewardReputationToTeam(teamId, 1, teamId); + RewardReputationToTeam(teamId, uint32(1 * _avReputationRate), teamId); if (m_Team_QuestStatus[teamId][3] == 120) LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid); break; @@ -316,21 +316,21 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) type -= AV_CPLACE_MAX; cinfoid = uint16(BG_AV_StaticCreaturePos[type][4]); creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid], - type + AV_CPLACE_MAX, - BG_AV_StaticCreaturePos[type][0], - BG_AV_StaticCreaturePos[type][1], - BG_AV_StaticCreaturePos[type][2], - BG_AV_StaticCreaturePos[type][3]); + type + AV_CPLACE_MAX, + BG_AV_StaticCreaturePos[type][0], + BG_AV_StaticCreaturePos[type][1], + BG_AV_StaticCreaturePos[type][2], + BG_AV_StaticCreaturePos[type][3]); isStatic = true; } else { creature = AddCreature(BG_AV_CreatureInfo[cinfoid], - type, - BG_AV_CreaturePos[type][0], - BG_AV_CreaturePos[type][1], - BG_AV_CreaturePos[type][2], - BG_AV_CreaturePos[type][3]); + type, + BG_AV_CreaturePos[type][0], + BG_AV_CreaturePos[type][1], + BG_AV_CreaturePos[type][2], + BG_AV_CreaturePos[type][3]); } if (!creature) return nullptr; @@ -344,7 +344,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))) { if (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3) - || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))) + || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))) { CreatureData& data = sObjectMgr->NewOrExistCreatureData(creature->GetSpawnId()); data.wander_distance = 5; @@ -814,11 +814,11 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) if (!trigger) { trigger = AddCreature(WORLD_TRIGGER, - node + 302, - BG_AV_CreaturePos[node + 302][0], - BG_AV_CreaturePos[node + 302][1], - BG_AV_CreaturePos[node + 302][2], - BG_AV_CreaturePos[node + 302][3]); + node + 302, + BG_AV_CreaturePos[node + 302][0], + BG_AV_CreaturePos[node + 302][1], + BG_AV_CreaturePos[node + 302][2], + BG_AV_CreaturePos[node + 302][3]); } //add bonus honor aura trigger creature when node is accupied @@ -1240,25 +1240,28 @@ GraveyardStruct const* BattlegroundAV::GetClosestGraveyard(Player* player) bool BattlegroundAV::SetupBattleground() { + _avReputationRate = sWorld->getRate(RATE_REPUTATION_GAIN_AV); + if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID(true))) { - _reputationTower = 18; - _reputationCaptain = 185; - _reputationBoss = 525; - _reputationPerOwnedGraveyard = 18; - _reputationSurvivingCaptain = 175; - _reputationSurvivingTower = 18; - _reputationPerOwnedMine = 36; + _reputationTower = uint32(18 * _avReputationRate); + _reputationCaptain = uint32(185 * _avReputationRate); + _reputationBoss = uint32(525 * _avReputationRate); + _reputationPerOwnedGraveyard = uint32(18 * _avReputationRate); + _reputationSurvivingCaptain = uint32(175 * _avReputationRate); + _reputationSurvivingTower = uint32(18 * _avReputationRate); + _reputationPerOwnedMine = uint32(36 * _avReputationRate); } else { - _reputationTower = 12; - _reputationCaptain = 125; - _reputationBoss = sWorld->getIntConfig(CONFIG_BATTLEGROUND_ALTERAC_REP_ONBOSSDEATH); - _reputationPerOwnedGraveyard = 12; - _reputationSurvivingCaptain = 125; - _reputationSurvivingTower = 12; - _reputationPerOwnedMine = 24; + _reputationTower = uint32(12 * _avReputationRate); + _reputationCaptain = uint32(125 * _avReputationRate); + // Special case: This value comes from another config setting, but we still apply our multiplier + _reputationBoss = uint32(sWorld->getIntConfig(CONFIG_BATTLEGROUND_ALTERAC_REP_ONBOSSDEATH) * _avReputationRate); + _reputationPerOwnedGraveyard = uint32(12 * _avReputationRate); + _reputationSurvivingCaptain = uint32(125 * _avReputationRate); + _reputationSurvivingTower = uint32(12 * _avReputationRate); + _reputationPerOwnedMine = uint32(24 * _avReputationRate); } // Create starting objects diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index a058f1d98c..57417dd1db 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.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 @@ -1846,6 +1846,7 @@ private: uint32 _reputationSurvivingCaptain = 0; // 125, 175 uint32 _reputationSurvivingTower = 0; // 12, 18 uint32 _reputationPerOwnedMine = 0; // 24, 36 + float _avReputationRate; bool m_IsInformedNearVictory[2] {}; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index ae37785618..a467d30324 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.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/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index 77d5c34234..abb16edb2d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.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/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 8331451514..bd3a61f682 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.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/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 2c8340f70e..103ec6cfe5 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.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/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index ed636bcf5e..68d057900b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.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 BattlegroundEY::PostUpdateImpl(uint32 diff) AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]); if (_ownedPointsCount[TEAM_HORDE] > 0) AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]); - _bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (GameTime::GetGameTimeMS().count() % BG_EY_FPOINTS_TICK_TIME)); + _bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (GameTime::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME)); break; case BG_EY_EVENT_FLAG_ON_GROUND: RespawnFlagAfterDrop(); @@ -78,7 +78,7 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff) break; case BG_EY_EVENT_CHECK_CPOINTS: UpdatePointsState(); - _bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (GameTime::GetGameTimeMS().count() % BG_EY_FPOINTS_CHECK_TIME)); + _bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (GameTime::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME)); break; } } @@ -106,8 +106,8 @@ void BattlegroundEY::StartingEventOpenDoors() // Achievement: Flurry StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_EY_EVENT_START_BATTLE); - _bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, 0); - _bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, 0); + _bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, 0ms); + _bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, 0ms); } void BattlegroundEY::AddPoints(TeamId teamId, uint32 points) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 1cdf29992b..2730a06041 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.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 @@ -31,13 +31,10 @@ enum BG_EY_Events BG_EY_EVENT_CHECK_CPOINTS = 4 }; -enum BG_EY_Timers -{ - BG_EY_FLAG_RESPAWN_TIME = 10 * IN_MILLISECONDS, - BG_EY_FLAG_ON_GROUND_TIME = 10 * IN_MILLISECONDS, - BG_EY_FPOINTS_CHECK_TIME = 2 * IN_MILLISECONDS, - BG_EY_FPOINTS_TICK_TIME = 2 * IN_MILLISECONDS -}; +constexpr Milliseconds BG_EY_FLAG_RESPAWN_TIME = 10s; +constexpr Milliseconds BG_EY_FLAG_ON_GROUND_TIME = 10s; +constexpr Milliseconds BG_EY_FPOINTS_CHECK_TIME = 2s; +constexpr Milliseconds BG_EY_FPOINTS_TICK_TIME = 2s; enum BG_EY_ProgressBarConsts { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index e1eb6b812f..50721aa037 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.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/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 33bb9a776e..9f859ddfe0 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.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/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index fbc0eca1b2..fd1ec0bfae 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.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/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index e75b30d220..889b9ed0e2 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.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/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index 8f209d4d0e..ac845386ff 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.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/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index bfcf6f5ffa..3e273810c1 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.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/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 39a7836ff8..5b77fc9a33 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.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/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 722de1c79a..ffa3d58090 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.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/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index d02e6c03b7..0bfa0abec1 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.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 @@ -307,7 +307,7 @@ void BattlegroundSA::StartShips() WorldPacket pkt; GetBGObject(i)->BuildValuesUpdateBlockForPlayer(&data, itr->second); data.BuildPacket(pkt); - itr->second->GetSession()->SendPacket(&pkt); + itr->second->SendDirectMessage(&pkt); } } ShipsStarted = true; @@ -1141,7 +1141,7 @@ void BattlegroundSA::SendTransportInit(Player* player) GetBGObject(BG_SA_BOAT_TWO)->BuildCreateUpdateBlockForPlayer(&transData, player); WorldPacket packet; transData.BuildPacket(packet); - player->GetSession()->SendPacket(&packet); + player->SendDirectMessage(&packet); } } @@ -1156,7 +1156,7 @@ void BattlegroundSA::SendTransportsRemove(Player* player) GetBGObject(BG_SA_BOAT_TWO)->BuildOutOfRangeUpdateBlock(&transData); WorldPacket packet; transData.BuildPacket(packet); - player->GetSession()->SendPacket(&packet); + player->SendDirectMessage(&packet); } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 7b3197567c..e76f22da7e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.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/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 272f07fbad..f5bd8a84f8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.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 @@ -63,7 +63,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) { case BG_WS_EVENT_UPDATE_GAME_TIME: UpdateWorldState(WORLD_STATE_BATTLEGROUND_WS_STATE_TIMER, GetMatchTime()); - _bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE * IN_MILLISECONDS)) + 1); + _bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, Milliseconds(((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE * IN_MILLISECONDS)) + 1)); break; case BG_WS_EVENT_NO_TIME_LEFT: if (GetTeamScore(TEAM_ALLIANCE) == GetTeamScore(TEAM_HORDE)) @@ -137,8 +137,8 @@ void BattlegroundWS::StartingEventOpenDoors() StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE); UpdateWorldState(WORLD_STATE_BATTLEGROUND_WS_STATE_TIMER_ACTIVE, 1); - _bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0); - _bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2 * MINUTE * IN_MILLISECONDS); // 27 - 2 = 25 minutes + _bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0ms); + _bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, Milliseconds(BG_WS_TOTAL_GAME_TIME - 2 * MINUTE * IN_MILLISECONDS)); // 27 - 2 = 25 minutes _bgEvents.ScheduleEvent(BG_WS_EVENT_DESPAWN_DOORS, BG_WS_DOOR_DESPAWN_TIME); } @@ -229,7 +229,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) EndBattleground(GetTeamScore(TEAM_HORDE) == _configurableMaxTeamScore ? TEAM_HORDE : TEAM_ALLIANCE); } else - _bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, BG_WS_FLAG_RESPAWN_TIME); + _bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, Milliseconds(BG_WS_FLAG_RESPAWN_TIME)); _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); @@ -426,15 +426,17 @@ void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger) bool BattlegroundWS::SetupBattleground() { + _wsReputationRate = sWorld->getRate(RATE_REPUTATION_GAIN_WSG); + if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID(true))) { - _reputationCapture = 45; + _reputationCapture = uint32(45 * _wsReputationRate); _honorWinKills = 3; _honorEndKills = 4; } else { - _reputationCapture = 35; + _reputationCapture = uint32(35 * _wsReputationRate); _honorWinKills = 1; _honorEndKills = 2; } @@ -578,10 +580,10 @@ uint32 BattlegroundWS::GetAssaultSpellId() const { if ((!GetFlagPickerGUID(TEAM_ALLIANCE) && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) || (!GetFlagPickerGUID(TEAM_HORDE) && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) || - _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0) + _bgEvents.HasTimeUntilEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10)) return 0; - return _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT15) > 0 ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT; + return _bgEvents.HasTimeUntilEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15) ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT; } void BattlegroundWS::RemoveAssaultAuras() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 61fa2516ed..ff3dc64d61 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.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 @@ -39,12 +39,12 @@ enum BG_WS_TimerOrScore BG_WS_MAX_TEAM_SCORE = 3, BG_WS_TOTAL_GAME_TIME = 27 * MINUTE * IN_MILLISECONDS, - BG_WS_FLAG_RESPAWN_TIME = 23 * IN_MILLISECONDS, - BG_WS_FLAG_DROP_TIME = 10 * IN_MILLISECONDS, - BG_WS_SPELL_FORCE_TIME = 10 * MINUTE * IN_MILLISECONDS, - BG_WS_SPELL_BRUTAL_TIME = 15 * MINUTE * IN_MILLISECONDS, - BG_WS_DOOR_DESPAWN_TIME = 5 * IN_MILLISECONDS + BG_WS_FLAG_RESPAWN_TIME = 23 * IN_MILLISECONDS }; +constexpr Milliseconds BG_WS_FLAG_DROP_TIME = 10s; +constexpr Milliseconds BG_WS_SPELL_FORCE_TIME = 600s; +constexpr Milliseconds BG_WS_SPELL_BRUTAL_TIME = 900s; +constexpr Milliseconds BG_WS_DOOR_DESPAWN_TIME = 5s; enum BG_WS_BroadcastTexts { @@ -258,6 +258,7 @@ private: ObjectGuid _droppedFlagGUID[2]; uint8 _flagState[2]; TeamId _lastFlagCaptureTeam; + float _wsReputationRate; uint32 _reputationCapture; uint32 _honorWinKills; uint32 _honorEndKills; diff --git a/src/server/game/Battlegrounds/enuminfo_ArenaTeam.cpp b/src/server/game/Battlegrounds/enuminfo_ArenaTeam.cpp index 952a2458e4..042f267c2a 100644 --- a/src/server/game/Battlegrounds/enuminfo_ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/enuminfo_ArenaTeam.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/Cache/CharacterCache.cpp b/src/server/game/Cache/CharacterCache.cpp index a46165c2d6..f940173dc4 100644 --- a/src/server/game/Cache/CharacterCache.cpp +++ b/src/server/game/Cache/CharacterCache.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/Cache/CharacterCache.h b/src/server/game/Cache/CharacterCache.h index 4c513a1158..c0f8572ac7 100644 --- a/src/server/game/Cache/CharacterCache.h +++ b/src/server/game/Cache/CharacterCache.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/Cache/WhoListCacheMgr.cpp b/src/server/game/Cache/WhoListCacheMgr.cpp index 6af42b662b..1c5bbefe87 100644 --- a/src/server/game/Cache/WhoListCacheMgr.cpp +++ b/src/server/game/Cache/WhoListCacheMgr.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/Cache/WhoListCacheMgr.h b/src/server/game/Cache/WhoListCacheMgr.h index 067c6246a3..cfa7f08ab2 100644 --- a/src/server/game/Cache/WhoListCacheMgr.h +++ b/src/server/game/Cache/WhoListCacheMgr.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/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index 014d990560..e258e2420d 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.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/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h index 79ea79712d..b33d74c32c 100644 --- a/src/server/game/Calendar/CalendarMgr.h +++ b/src/server/game/Calendar/CalendarMgr.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/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index b072230304..05e887a6be 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.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 @@ -908,26 +908,26 @@ void Channel::SendToAll(WorldPacket* data, ObjectGuid guid) { for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) if (!guid || !i->second.plrPtr->GetSocial()->HasIgnore(guid)) - i->second.plrPtr->GetSession()->SendPacket(data); + i->second.plrPtr->SendDirectMessage(data); } void Channel::SendToAllButOne(WorldPacket* data, ObjectGuid who) { for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) if (i->first != who) - i->second.plrPtr->GetSession()->SendPacket(data); + i->second.plrPtr->SendDirectMessage(data); } void Channel::SendToOne(WorldPacket* data, ObjectGuid who) { if (Player* player = ObjectAccessor::FindConnectedPlayer(who)) - player->GetSession()->SendPacket(data); + player->SendDirectMessage(data); } void Channel::SendToAllWatching(WorldPacket* data) { for (PlayersWatchingContainer::const_iterator i = playersWatchingStore.begin(); i != playersWatchingStore.end(); ++i) - (*i)->GetSession()->SendPacket(data); + (*i)->SendDirectMessage(data); } bool Channel::ShouldAnnouncePlayer(Player const* player) const diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h index e2d1bd9a15..32e9bec91a 100644 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.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/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 99f613b89e..8c651125a8 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.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 @@ -150,7 +150,7 @@ Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pk { WorldPacket data; MakeNotOnPacket(&data, name); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } return nullptr; diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index 5b42c4b8d4..daf595d2f6 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.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/Chat/Channels/enuminfo_Channel.cpp b/src/server/game/Chat/Channels/enuminfo_Channel.cpp index b6ad0335dc..1d82c35739 100644 --- a/src/server/game/Chat/Channels/enuminfo_Channel.cpp +++ b/src/server/game/Chat/Channels/enuminfo_Channel.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/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 5b82ed2c53..a0dc7f090d 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.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/Chat/Chat.h b/src/server/game/Chat/Chat.h index 90cbad152f..e2891a3b83 100644 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.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/Chat/ChatCommands/ChatCommand.cpp b/src/server/game/Chat/ChatCommands/ChatCommand.cpp index c15e4d9a8e..0e763f1b32 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommand.cpp +++ b/src/server/game/Chat/ChatCommands/ChatCommand.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/Chat/ChatCommands/ChatCommand.h b/src/server/game/Chat/ChatCommands/ChatCommand.h index b7e81bc204..e0eb9ee7a2 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommand.h +++ b/src/server/game/Chat/ChatCommands/ChatCommand.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/Chat/ChatCommands/ChatCommandArgs.cpp b/src/server/game/Chat/ChatCommands/ChatCommandArgs.cpp index da32757e69..4a67a24140 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandArgs.cpp +++ b/src/server/game/Chat/ChatCommands/ChatCommandArgs.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/Chat/ChatCommands/ChatCommandArgs.h b/src/server/game/Chat/ChatCommands/ChatCommandArgs.h index 35d38149c2..62d9bd6d89 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandArgs.h +++ b/src/server/game/Chat/ChatCommands/ChatCommandArgs.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/Chat/ChatCommands/ChatCommandHelpers.cpp b/src/server/game/Chat/ChatCommands/ChatCommandHelpers.cpp index 0c5f141479..fd87ab912c 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandHelpers.cpp +++ b/src/server/game/Chat/ChatCommands/ChatCommandHelpers.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/Chat/ChatCommands/ChatCommandHelpers.h b/src/server/game/Chat/ChatCommands/ChatCommandHelpers.h index a4bff85b9c..6ab9f01de9 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandHelpers.h +++ b/src/server/game/Chat/ChatCommands/ChatCommandHelpers.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/Chat/ChatCommands/ChatCommandTags.cpp b/src/server/game/Chat/ChatCommands/ChatCommandTags.cpp index 57e678d13b..4014bc6e02 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandTags.cpp +++ b/src/server/game/Chat/ChatCommands/ChatCommandTags.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/Chat/ChatCommands/ChatCommandTags.h b/src/server/game/Chat/ChatCommands/ChatCommandTags.h index 450be4cc24..ad1286a7ab 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandTags.h +++ b/src/server/game/Chat/ChatCommands/ChatCommandTags.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/Chat/HyperlinkTags.cpp b/src/server/game/Chat/HyperlinkTags.cpp index 2cb36b6983..bf33832298 100644 --- a/src/server/game/Chat/HyperlinkTags.cpp +++ b/src/server/game/Chat/HyperlinkTags.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/Chat/Hyperlinks.cpp b/src/server/game/Chat/Hyperlinks.cpp index af2ac277cf..8b20d961c8 100644 --- a/src/server/game/Chat/Hyperlinks.cpp +++ b/src/server/game/Chat/Hyperlinks.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/Chat/Hyperlinks.h b/src/server/game/Chat/Hyperlinks.h index d67342017a..e1f5bae5ea 100644 --- a/src/server/game/Chat/Hyperlinks.h +++ b/src/server/game/Chat/Hyperlinks.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/Combat/HostileRefMgr.cpp b/src/server/game/Combat/HostileRefMgr.cpp index 16fc944a52..e8a1ebebe1 100644 --- a/src/server/game/Combat/HostileRefMgr.cpp +++ b/src/server/game/Combat/HostileRefMgr.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/Combat/HostileRefMgr.h b/src/server/game/Combat/HostileRefMgr.h index 163c9a16cd..728f201bb8 100644 --- a/src/server/game/Combat/HostileRefMgr.h +++ b/src/server/game/Combat/HostileRefMgr.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/Combat/ThreatMgr.cpp b/src/server/game/Combat/ThreatMgr.cpp index 899eee48ec..a421b3ac9e 100644 --- a/src/server/game/Combat/ThreatMgr.cpp +++ b/src/server/game/Combat/ThreatMgr.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/Combat/ThreatMgr.h b/src/server/game/Combat/ThreatMgr.h index 8e02351e0e..3f31c9ac8e 100644 --- a/src/server/game/Combat/ThreatMgr.h +++ b/src/server/game/Combat/ThreatMgr.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/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h index 1f106898fb..da2c1a9651 100644 --- a/src/server/game/Combat/UnitEvents.h +++ b/src/server/game/Combat/UnitEvents.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/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index bb6fa29c49..1d1bbec23f 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.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/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index eaa1d14e21..d8a29e4d1d 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.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/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index abb9681beb..234ddfe5a2 100644 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.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/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h index bfad29a4d6..8b0ae668b4 100644 --- a/src/server/game/Conditions/DisableMgr.h +++ b/src/server/game/Conditions/DisableMgr.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/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 2184bcd20e..7aa7413325 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.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/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 0f71e25fdd..ec8cb68bbc 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.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/DataStores/M2Stores.cpp b/src/server/game/DataStores/M2Stores.cpp index 598ff0fc63..edb7888a7e 100644 --- a/src/server/game/DataStores/M2Stores.cpp +++ b/src/server/game/DataStores/M2Stores.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/DataStores/M2Stores.h b/src/server/game/DataStores/M2Stores.h index 66de48de29..80488cab9c 100644 --- a/src/server/game/DataStores/M2Stores.h +++ b/src/server/game/DataStores/M2Stores.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/DataStores/M2Structure.h b/src/server/game/DataStores/M2Structure.h index 520cd50bf5..2ac6926d93 100644 --- a/src/server/game/DataStores/M2Structure.h +++ b/src/server/game/DataStores/M2Structure.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/DungeonFinding/LFG.cpp b/src/server/game/DungeonFinding/LFG.cpp index b22ece0962..63e2f61c15 100644 --- a/src/server/game/DungeonFinding/LFG.cpp +++ b/src/server/game/DungeonFinding/LFG.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/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h index 0d5124cdbf..4ba61eefef 100644 --- a/src/server/game/DungeonFinding/LFG.h +++ b/src/server/game/DungeonFinding/LFG.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/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp index eed5cef241..0f522d2782 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.cpp +++ b/src/server/game/DungeonFinding/LFGGroupData.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/DungeonFinding/LFGGroupData.h b/src/server/game/DungeonFinding/LFGGroupData.h index 61220d02f8..281beaff47 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.h +++ b/src/server/game/DungeonFinding/LFGGroupData.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/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 2449fada7a..b88d04c65e 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.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 @@ -961,7 +961,7 @@ namespace lfg RBCacheMap::iterator itr = RBCacheStore[player->GetTeamId()].find(dungeonId); if (itr != RBCacheStore[player->GetTeamId()].end()) { - player->GetSession()->SendPacket(&(itr->second)); + player->SendDirectMessage(&(itr->second)); return; } // send empty packet if cache not found @@ -973,7 +973,7 @@ namespace lfg data << (uint32)0; data << (uint32)0; data << (uint32)0; - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } void LFGMgr::UpdateRaidBrowser(uint32 diff) @@ -1220,7 +1220,7 @@ namespace lfg for (RBSearchersMap::const_iterator sitr = RBSearchersStore[team].begin(); sitr != RBSearchersStore[team].end(); ++sitr) if (sitr->second == dungeonId) if (Player* p = ObjectAccessor::FindConnectedPlayer(sitr->first)) - p->GetSession()->SendPacket(&differencePacket); + p->SendDirectMessage(&differencePacket); break; // one dungeon updated in one LFGMgr::UpdateRaidBrowser } @@ -1508,7 +1508,7 @@ namespace lfg lockMap.clear(); } - uint8 LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true*/) + uint8 LFGMgr::CheckGroupRoles(LfgRolesMap& groles) { if (groles.empty()) return 0; @@ -1517,21 +1517,18 @@ namespace lfg uint8 tank = 0; uint8 healer = 0; - if (removeLeaderFlag) - for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it) - it->second &= ~PLAYER_ROLE_LEADER; - for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it) { - if (it->second == PLAYER_ROLE_NONE) + uint8 const role = it->second & ~PLAYER_ROLE_LEADER; + if (role == PLAYER_ROLE_NONE) return 0; - if (it->second & PLAYER_ROLE_DAMAGE) + if (role & PLAYER_ROLE_DAMAGE) { - if (it->second != PLAYER_ROLE_DAMAGE) + if (role != PLAYER_ROLE_DAMAGE) { it->second -= PLAYER_ROLE_DAMAGE; - if (uint8 x = CheckGroupRoles(groles, false)) + if (uint8 x = CheckGroupRoles(groles)) return x; it->second += PLAYER_ROLE_DAMAGE; } @@ -1541,12 +1538,12 @@ namespace lfg damage++; } - if (it->second & PLAYER_ROLE_HEALER) + if (role & PLAYER_ROLE_HEALER) { - if (it->second != PLAYER_ROLE_HEALER) + if (role != PLAYER_ROLE_HEALER) { it->second -= PLAYER_ROLE_HEALER; - if (uint8 x = CheckGroupRoles(groles, false)) + if (uint8 x = CheckGroupRoles(groles)) return x; it->second += PLAYER_ROLE_HEALER; } @@ -1556,12 +1553,12 @@ namespace lfg healer++; } - if (it->second & PLAYER_ROLE_TANK) + if (role & PLAYER_ROLE_TANK) { - if (it->second != PLAYER_ROLE_TANK) + if (role != PLAYER_ROLE_TANK) { it->second -= PLAYER_ROLE_TANK; - if (uint8 x = CheckGroupRoles(groles, false)) + if (uint8 x = CheckGroupRoles(groles)) return x; it->second += PLAYER_ROLE_TANK; } diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 0eb27e71c0..426f0c679a 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.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 @@ -568,7 +568,7 @@ namespace lfg /// Checks if all players are queued bool AllQueued(Lfg5Guids const& check); /// Checks if given roles match, modifies given roles map with new roles - static uint8 CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag = true); + static uint8 CheckGroupRoles(LfgRolesMap& groles); /// Checks if given players are ignoring each other static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2); /// Sends queue status to player diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp index ddfeec2fcf..8328c22c8a 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.cpp +++ b/src/server/game/DungeonFinding/LFGPlayerData.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/DungeonFinding/LFGPlayerData.h b/src/server/game/DungeonFinding/LFGPlayerData.h index ad6e36e7a1..94d2b08012 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.h +++ b/src/server/game/DungeonFinding/LFGPlayerData.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/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 4c0b828980..aae5df67aa 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.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/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h index 2cc49f645f..1ce7537306 100644 --- a/src/server/game/DungeonFinding/LFGQueue.h +++ b/src/server/game/DungeonFinding/LFGQueue.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/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index c6a2d5c30d..b4faf18fa6 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.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/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h index 918c7eac2a..0dbacd7aab 100644 --- a/src/server/game/DungeonFinding/LFGScripts.h +++ b/src/server/game/DungeonFinding/LFGScripts.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/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 249ac7adb9..b5344bda30 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.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 @@ -121,7 +121,7 @@ void Corpse::DeleteFromDB(CharacterDatabaseTransaction trans) DeleteFromDB(GetOwnerGUID(), trans); } -void Corpse::DeleteFromDB(ObjectGuid const ownerGuid, CharacterDatabaseTransaction trans) +void Corpse::DeleteFromDB(ObjectGuid const& ownerGuid, CharacterDatabaseTransaction trans) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSE); stmt->SetData(0, ownerGuid.GetCounter()); diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index e74f2c9439..d0bf50c590 100644 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.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 @@ -63,7 +63,7 @@ public: bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields); void DeleteFromDB(CharacterDatabaseTransaction trans); - static void DeleteFromDB(ObjectGuid const ownerGuid, CharacterDatabaseTransaction trans); + static void DeleteFromDB(ObjectGuid const& ownerGuid, CharacterDatabaseTransaction trans); [[nodiscard]] ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 19fe38a3c9..370e4c07df 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.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 @@ -251,7 +251,7 @@ CreatureBaseStats const* CreatureBaseStats::GetBaseStats(uint8 level, uint8 unit bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - m_owner.DespawnOrUnsummon(0s, m_respawnTimer); // since we are here, we are not TempSummon as object type cannot change during runtime + m_owner.DespawnOrUnsummon(0ms, m_respawnTimer); // since we are here, we are not TempSummon as object type cannot change during runtime return true; } @@ -525,7 +525,8 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data) SetFloatValue(UNIT_FIELD_HOVERHEIGHT, cinfo->HoverHeight); - SetCanDualWield(cinfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK)); + if (cinfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK)) + SetDualWieldMode(DualWieldMode::ENABLED); // checked at loading m_defaultMovementType = MovementGeneratorType(cinfo->MovementType); @@ -571,7 +572,8 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele ReplaceAllDynamicFlags(dynamicflags); - SetCanDualWield(cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK)); + if (cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK)) + SetDualWieldMode(DualWieldMode::ENABLED); SetAttackTime(BASE_ATTACK, cInfo->BaseAttackTime); SetAttackTime(OFF_ATTACK, cInfo->BaseAttackTime); @@ -769,7 +771,7 @@ void Creature::Update(uint32 diff) } Unit* owner = GetCharmerOrOwner(); - if (IsCharmed() && !IsWithinDistInMap(owner, GetMap()->GetVisibilityRange(), true, false)) + if (IsCharmed() && !IsWithinDistInMap(owner, GetMap()->GetVisibilityRange(), true, false, false)) { RemoveCharmAuras(); } @@ -1942,7 +1944,7 @@ bool Creature::CanStartAttack(Unit const* who) const if (!_IsTargetAcceptable(who)) return false; - if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false)) // pussywizard: +m_combatDistance for turrets and similar + if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false, false)) // pussywizard: +m_combatDistance for turrets and similar return false; if (!CanCreatureAttack(who)) @@ -1996,8 +1998,8 @@ void Creature::setDeathState(DeathState state, bool despawn) m_formation->FormationReset(true, false); bool needsFalling = !despawn && (IsFlying() || IsHovering()) && !IsUnderWater(); - SetHover(false, false, false); - SetDisableGravity(false, false, false); + SetHover(false); + SetDisableGravity(false); if (needsFalling) GetMotionMaster()->MoveFall(0, true); @@ -2157,12 +2159,12 @@ void Creature::Respawn(bool force) } } -void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer) +void Creature::ForcedDespawn(Milliseconds timeMSToDespawn, Seconds forceRespawnTimer) { - if (timeMSToDespawn) + if (timeMSToDespawn > 0ms) { ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this, forceRespawnTimer); - m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn)); + m_Events.AddEventAtOffset(pEvent, timeMSToDespawn); return; } @@ -2172,17 +2174,17 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer) // Xinef: Set new respawn time, ignore corpse decay time... RemoveCorpse(true); - if (forceRespawnTimer > Seconds::zero()) + if (forceRespawnTimer > 0s) if (GetMap()) GetMap()->ScheduleCreatureRespawn(GetGUID(), forceRespawnTimer); } -void Creature::DespawnOrUnsummon(Milliseconds msTimeToDespawn /*= 0*/, Seconds forcedRespawnTimer) +void Creature::DespawnOrUnsummon(Milliseconds msTimeToDespawn /*= 0ms*/, Seconds forcedRespawnTimer /*= 0s*/) { if (TempSummon* summon = this->ToTempSummon()) - summon->UnSummon(msTimeToDespawn.count()); + summon->UnSummon(msTimeToDespawn); else - ForcedDespawn(msTimeToDespawn.count(), forcedRespawnTimer); + ForcedDespawn(msTimeToDespawn, forcedRespawnTimer); } void Creature::DespawnOnEvade(Seconds respawnDelay) @@ -2202,7 +2204,7 @@ void Creature::DespawnOnEvade(Seconds respawnDelay) return; } - DespawnOrUnsummon(Milliseconds(0), respawnDelay); + DespawnOrUnsummon(0ms, respawnDelay); } void Creature::InitializeReactState() @@ -2462,7 +2464,7 @@ void Creature::CallAssistance(Unit* target /*= nullptr*/) e->AddAssistant((*assistList.begin())->GetGUID()); assistList.pop_front(); } - m_Events.AddEvent(e, m_Events.CalculateTime(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY))); + m_Events.AddEventAtOffset(e, Milliseconds(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY))); } } } @@ -3195,10 +3197,23 @@ bool Creature::IsImmuneToKnockback() const bool Creature::HasWeapon(WeaponAttackType type) const { + if (type == OFF_ATTACK) + { + switch (_dualWieldMode) + { + case DualWieldMode::ENABLED: + return true; + case DualWieldMode::DISABLED: + return false; + case DualWieldMode::AUTO: + default: + break; + } + } + const uint8 slot = uint8(type); ItemEntry const* item = sItemStore.LookupEntry(GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + slot)); - - return ((item && item->ClassID == ITEM_CLASS_WEAPON) || (type == OFF_ATTACK && CanDualWield())); + return (item && item->ClassID == ITEM_CLASS_WEAPON); } /** @@ -3215,46 +3230,6 @@ bool Creature::SetWalk(bool enable) return true; } -/** - * @brief Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING. Infom also the client - */ -bool Creature::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/) -{ - //! It's possible only a packet is sent but moveflags are not updated - //! Need more research on this - if (!packetOnly && !Unit::SetDisableGravity(disable)) - return false; - - if (m_movedByPlayer) - { - WorldPacket data(disable ? SMSG_MOVE_GRAVITY_DISABLE : SMSG_MOVE_GRAVITY_ENABLE, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - m_movedByPlayer->ToPlayer()->SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_GRAVITY_CHNG, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false); - return true; - } - - if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !IsRooted()) - { - if (IsLevitating()) - SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_FLY); - else if (IsHovering()) - SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_HOVER); - else - SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_GROUND); - } - - WorldPacket data(disable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9); - data << GetPackGUID(); - SendMessageToSet(&data, false); - return true; -} - bool Creature::SetSwim(bool enable) { if (!Unit::SetSwim(enable)) @@ -3303,107 +3278,6 @@ void Creature::RefreshSwimmingFlag(bool recheck) SetUnitFlag(UNIT_FLAG_SWIMMING); } -bool Creature::SetCanFly(bool enable, bool /*packetOnly*/ /* = false */) -{ - if (!Unit::SetCanFly(enable)) - return false; - - if (m_movedByPlayer) - { - sScriptMgr->AnticheatSetCanFlybyServer(m_movedByPlayer->ToPlayer(), enable); - - if (!enable) - m_movedByPlayer->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), m_movedByPlayer->ToPlayer()->GetPositionZ()); - - WorldPacket data(enable ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - m_movedByPlayer->ToPlayer()->SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_UPDATE_CAN_FLY, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false); - return true; - } - - WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9); - data << GetPackGUID(); - SendMessageToSet(&data, false); - return true; -} - -bool Creature::SetWaterWalking(bool enable, bool packetOnly /* = false */) -{ - if (!packetOnly && !Unit::SetWaterWalking(enable)) - return false; - - if (m_movedByPlayer) - { - WorldPacket data(enable ? SMSG_MOVE_WATER_WALK : SMSG_MOVE_LAND_WALK, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - m_movedByPlayer->ToPlayer()->SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_WATER_WALK, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false); - return true; - } - - WorldPacket data(enable ? SMSG_SPLINE_MOVE_WATER_WALK : SMSG_SPLINE_MOVE_LAND_WALK, 9); - data << GetPackGUID(); - SendMessageToSet(&data, true); - return true; -} - -bool Creature::SetFeatherFall(bool enable, bool packetOnly /* = false */) -{ - if (!packetOnly && !Unit::SetFeatherFall(enable)) - return false; - - if (m_movedByPlayer) - { - WorldPacket data(enable ? SMSG_MOVE_FEATHER_FALL : SMSG_MOVE_NORMAL_FALL, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - m_movedByPlayer->ToPlayer()->SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_FEATHER_FALL, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false); - return true; - } - - WorldPacket data(enable ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL, 9); - data << GetPackGUID(); - SendMessageToSet(&data, true); - return true; -} - -bool Creature::SetHover(bool enable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/) -{ - if (!packetOnly && !Unit::SetHover(enable)) - return false; - - if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !IsRooted()) - { - if (IsLevitating()) - SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_FLY); - else if (IsHovering()) - SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_HOVER); - else - SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_GROUND); - } - - WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9); - data << GetPackGUID(); - SendMessageToSet(&data, false); - return true; -} - float Creature::GetAggroRange(Unit const* target) const { // Determines the aggro range for creatures @@ -3470,19 +3344,23 @@ void Creature::UpdateMovementFlags() if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling()) { - if (GetMovementTemplate().Flight == CreatureFlightMovementType::CanFly) + if (GetMovementTemplate().Flight == CreatureFlightMovementType::CanFly && !m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY)) SetCanFly(true); - else + else if (!IsLevitating()) SetDisableGravity(true); - if (!HasHoverAura()) + if (!HasHoverAura() && IsHovering()) SetHover(false); } else { - SetCanFly(false); - SetDisableGravity(false); - if (IsAlive() && (CanHover() || HasHoverAura())) + if (m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY)) + SetCanFly(false); + + if (IsLevitating()) + SetDisableGravity(false); + + if (IsAlive() && (GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || HasHoverAura()) && !IsHovering()) SetHover(true); } @@ -3798,6 +3676,33 @@ bool Creature::CanGeneratePickPocketLoot() const return (lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < GameTime::GetGameTime().count()); } +void Creature::SetTextRepeatId(uint8 textGroup, uint8 id) +{ + CreatureTextRepeatIds& repeats = m_textRepeat[textGroup]; + if (std::find(repeats.begin(), repeats.end(), id) == repeats.end()) + repeats.push_back(id); + else + LOG_ERROR("sql.sql", "CreatureTextMgr: TextGroup {} for Creature({}) {}, id {} already added", uint32(textGroup), GetName(), GetGUID().ToString(), uint32(id)); +} + +CreatureTextRepeatIds const& Creature::GetTextRepeatGroup(uint8 textGroup) +{ + static CreatureTextRepeatIds const emptyIds; + + CreatureTextRepeatGroup::const_iterator groupItr = m_textRepeat.find(textGroup); + if (groupItr != m_textRepeat.end()) + return groupItr->second; + + return emptyIds; +} + +void Creature::ClearTextRepeatGroup(uint8 textGroup) +{ + CreatureTextRepeatGroup::iterator groupItr = m_textRepeat.find(textGroup); + if (groupItr != m_textRepeat.end()) + groupItr->second.clear(); +} + void Creature::SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? GameTime::GetGameTime().count() + respawn : 0; @@ -3820,7 +3725,7 @@ void Creature::ModifyThreatPercentTemp(Unit* victim, int32 percent, Milliseconds } TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat); - m_Events.AddEvent(pEvent, m_Events.CalculateTime(duration.count())); + m_Events.AddEventAtOffset(pEvent, duration); } } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index a2c2947020..11db152ac4 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.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 @@ -39,6 +39,10 @@ class CreatureGroup; #define MAX_VENDOR_ITEMS 150 // Limitation in 3.x.x item count in SMSG_LIST_INVENTORY +//used for handling non-repeatable random texts +typedef std::vector<uint8> CreatureTextRepeatIds; +typedef std::unordered_map<uint8, CreatureTextRepeatIds> CreatureTextRepeatGroup; + class Creature : public Unit, public GridObject<Creature>, public MovableMapObject, public UpdatableMapObject { public: @@ -79,7 +83,7 @@ public: [[nodiscard]] bool CanWalk() const { return GetMovementTemplate().IsGroundAllowed(); } [[nodiscard]] bool CanSwim() const override; [[nodiscard]] bool CanEnterWater() const override; - [[nodiscard]] bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); } + [[nodiscard]] bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); } [[nodiscard]] bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || IsHovering(); } [[nodiscard]] bool IsRooted() const { return GetMovementTemplate().IsRooted(); } @@ -141,12 +145,7 @@ public: [[nodiscard]] CreatureAI* AI() const { return (CreatureAI*)i_AI; } bool SetWalk(bool enable) override; - bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true) override; bool SetSwim(bool enable) override; - bool SetCanFly(bool enable, bool packetOnly = false) override; - bool SetWaterWalking(bool enable, bool packetOnly = false) override; - bool SetFeatherFall(bool enable, bool packetOnly = false) override; - bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true) override; bool HasSpellFocus(Spell const* focusSpell = nullptr) const; struct @@ -283,8 +282,7 @@ public: void RemoveCorpse(bool setSpawnTime = true, bool skipVisibility = false); - void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer); - void DespawnOrUnsummon(uint32 msTimeToDespawn = 0) { DespawnOrUnsummon(Milliseconds(msTimeToDespawn), 0s); }; + void DespawnOrUnsummon(Milliseconds msTimeToDespawn = 0ms, Seconds forcedRespawnTimer = 0s); void DespawnOnEvade(Seconds respawnDelay = 20s); [[nodiscard]] time_t const& GetRespawnTime() const { return m_respawnTime; } @@ -392,6 +390,10 @@ public: void UpdateLeashExtensionTime(); uint8 GetLeashTimer() const; + CreatureTextRepeatIds const& GetTextRepeatGroup(uint8 textGroup); + void SetTextRepeatId(uint8 textGroup, uint8 id); + void ClearTextRepeatGroup(uint8 textGroup); + bool IsFreeToMove(); static constexpr uint32 MOVE_CIRCLE_CHECK_INTERVAL = 3000; static constexpr uint32 MOVE_BACKWARDS_CHECK_INTERVAL = 2000; @@ -502,7 +504,7 @@ protected: bool IsAlwaysDetectableFor(WorldObject const* seer) const override; private: - void ForcedDespawn(uint32 timeMSToDespawn = 0, Seconds forcedRespawnTimer = 0s); + void ForcedDespawn(Milliseconds timeMSToDespawn = 0ms, Seconds forcedRespawnTimer = 0s); [[nodiscard]] bool CanPeriodicallyCallForAssistance() const; @@ -523,6 +525,8 @@ private: Spell const* _focusSpell; ///> Locks the target during spell cast for proper facing + CreatureTextRepeatGroup m_textRepeat; + bool _isMissingSwimmingFlagOutOfCombat; uint32 m_assistanceTimer; diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h index 4ca6cda4ab..2c8b4eb22a 100644 --- a/src/server/game/Entities/Creature/CreatureData.h +++ b/src/server/game/Entities/Creature/CreatureData.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 @@ -99,18 +99,18 @@ enum class CreatureFlightMovementType : uint8 enum class CreatureChaseMovementType : uint8 { - Run, - CanWalk, - AlwaysWalk, + Run = 0, + CanWalk = 1, + AlwaysWalk = 2, Max }; enum class CreatureRandomMovementType : uint8 { - Walk, - CanRun, - AlwaysRun, + Walk = 0, + CanRun = 1, + AlwaysRun = 2, Max }; diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index c603b51da6..8afb585e09 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.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/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h index 54b01c08ce..3e52ad00ed 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.h +++ b/src/server/game/Entities/Creature/CreatureGroups.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/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index bd0b472d41..8fa590e109 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.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/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h index 7c306c0291..b6a06092c5 100644 --- a/src/server/game/Entities/Creature/GossipDef.h +++ b/src/server/game/Entities/Creature/GossipDef.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/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 0b0c17a1ed..6d90495585 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.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 @@ -284,13 +284,12 @@ void TempSummon::SetTempSummonType(TempSummonType type) m_type = type; } -void TempSummon::UnSummon(uint32 msTime) +void TempSummon::UnSummon(Milliseconds msTime) { - if (msTime) + if (msTime > 0ms) { ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this); - - m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime)); + m_Events.AddEventAtOffset(pEvent, msTime); return; } diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index 72a1993270..4140d37c7d 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.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 @@ -44,7 +44,7 @@ public: void Update(uint32 time) override; virtual void InitStats(uint32 lifetime); virtual void InitSummon(); - virtual void UnSummon(uint32 msTime = 0); + virtual void UnSummon(Milliseconds msTime = 0ms); void UpdateObjectVisibilityOnCreate() override; void RemoveFromWorld() override; void SetTempSummonType(TempSummonType type); @@ -133,4 +133,5 @@ public: private: TempSummon& m_owner; }; + #endif diff --git a/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp b/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp index a2efe7bcc7..2f0aebebae 100644 --- a/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp +++ b/src/server/game/Entities/Creature/enuminfo_CreatureData.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/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index f712691b15..5a64654045 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.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/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h index 7ccd31f2f5..b5ff4b1c7d 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.h +++ b/src/server/game/Entities/DynamicObject/DynamicObject.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/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index f258db1caf..aa07590f65 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.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 @@ -517,7 +517,7 @@ void GameObject::Update(uint32 diff) WorldPacket packet; BuildValuesUpdateBlockForPlayer(&udata, caster->ToPlayer()); udata.BuildPacket(packet); - caster->ToPlayer()->GetSession()->SendPacket(&packet); + caster->ToPlayer()->SendDirectMessage(&packet); SendCustomAnim(GetGoAnimProgress()); } @@ -637,7 +637,7 @@ void GameObject::Update(uint32 diff) caster->ToPlayer()->RemoveGameObject(this, false); WorldPacket data(SMSG_FISH_ESCAPED, 0); - caster->ToPlayer()->GetSession()->SendPacket(&data); + caster->ToPlayer()->SendDirectMessage(&data); } // can be delete m_lootState = GO_JUST_DEACTIVATED; @@ -929,7 +929,7 @@ void GameObject::AddUniqueUse(Player* player) m_unique_users.insert(player->GetGUID()); } -void GameObject::DespawnOrUnsummon(Milliseconds delay, Seconds forceRespawnTime) +void GameObject::DespawnOrUnsummon(Milliseconds delay /*= 0ms*/, Seconds forceRespawnTime /*= 0s*/) { if (delay > 0ms) { @@ -1466,7 +1466,7 @@ void GameObject::Use(Unit* user) // by default spell caster is user Unit* spellCaster = user; uint32 spellId = 0; - bool triggered = false; + uint32 triggeredFlags = TRIGGERED_NONE; if (Player* playerUser = user->ToPlayer()) { @@ -1486,6 +1486,10 @@ void GameObject::Use(Unit* user) m_cooldownTime = GameTime::GetGameTimeMS().count() + cooldown * IN_MILLISECONDS; } + if (user->IsPlayer() && GetGoType() != GAMEOBJECT_TYPE_TRAP) // workaround for GO casting + if (!m_goInfo->IsUsableMounted()) + user->RemoveAurasByType(SPELL_AURA_MOUNTED); + switch (GetGoType()) { case GAMEOBJECT_TYPE_DOOR: //0 @@ -1624,7 +1628,7 @@ void GameObject::Use(Unit* user) { WorldPacket data(SMSG_GAMEOBJECT_PAGETEXT, 8); data << GetGUID(); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } else if (info->goober.gossipID) { @@ -1731,34 +1735,40 @@ void GameObject::Use(Unit* user) uint32 zone, subzone; GetZoneAndAreaId(zone, subzone); - int32 zone_skill = sObjectMgr->GetFishingBaseSkillLevel(subzone); - if (!zone_skill) - zone_skill = sObjectMgr->GetFishingBaseSkillLevel(zone); + int32 zoneSkill = sObjectMgr->GetFishingBaseSkillLevel(subzone); + if (!zoneSkill) + zoneSkill = sObjectMgr->GetFishingBaseSkillLevel(zone); //provide error, no fishable zone or area should be 0 - if (!zone_skill) + if (!zoneSkill) LOG_ERROR("sql.sql", "Fishable areaId {} are not properly defined in `skill_fishing_base_level`.", subzone); - int32 skill = player->GetSkillValue(SKILL_FISHING); + // no miss skill is zone skill + 95 since at least patch 2.1 + int32 const noMissSkill = zoneSkill + 95; + + int32 const skill = player->GetSkillValue(SKILL_FISHING); int32 chance; - if (skill < zone_skill) + // fishing pool catches are 100% + //TODO: find reasonable value for fishing hole search + GameObject* fishingHole = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE); + if (fishingHole) + chance = 100; + else if (skill < noMissSkill) { - chance = int32(pow((double)skill / zone_skill, 2) * 100); + chance = int32(pow((double)skill / noMissSkill, 2) * 100); if (chance < 1) chance = 1; } else chance = 100; - int32 roll = irand(1, 100); + int32 const roll = irand(1, 100); - LOG_DEBUG("entities.gameobject", "Fishing check (skill: {} zone min skill: {} chance {} roll: {}", skill, zone_skill, chance, roll); + LOG_DEBUG("entities.gameobject", "Fishing check (skill: {} zone min skill: {} no-miss skill: {} chance {} roll: {})", skill, zoneSkill, noMissSkill, chance, roll); - if (sScriptMgr->OnPlayerUpdateFishingSkill(player, skill, zone_skill, chance, roll)) - { + if (sScriptMgr->OnPlayerUpdateFishingSkill(player, skill, zoneSkill, chance, roll)) player->UpdateFishingSkill(); - } // but you will likely cause junk in areas that require a high fishing skill (not yet implemented) if (chance >= roll) { @@ -1768,11 +1778,10 @@ void GameObject::Use(Unit* user) SetOwnerGUID(player->GetGUID()); SetSpellId(0); // prevent removing unintended auras at Unit::RemoveGameObject - //TODO: find reasonable value for fishing hole search - GameObject* ok = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE); - if (ok) + // fishing pool catch + if (fishingHole) { - ok->Use(player); + fishingHole->Use(player); SetLootState(GO_JUST_DEACTIVATED); } else @@ -1789,7 +1798,7 @@ void GameObject::Use(Unit* user) SetLootState(GO_JUST_DEACTIVATED); WorldPacket data(SMSG_FISH_NOT_HOOKED, 0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); break; } } @@ -1881,7 +1890,6 @@ void GameObject::Use(Unit* user) } } - user->RemoveAurasByType(SPELL_AURA_MOUNTED); spellId = info->spellcaster.spellId; break; } @@ -2026,7 +2034,7 @@ void GameObject::Use(Unit* user) player->TeleportTo(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET); WorldPacket data(SMSG_ENABLE_BARBER_SHOP, 0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); player->SetStandState(UNIT_STAND_STATE_SIT_LOW_CHAIR + info->barberChair.chairheight); return; @@ -2051,12 +2059,15 @@ void GameObject::Use(Unit* user) return; } + if (m_goInfo->IsUsableMounted()) + triggeredFlags |= TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE; + if (Player* player = user->ToPlayer()) sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this); if (spellCaster) { - if ((spellCaster->CastSpell(user, spellInfo, triggered) == SPELL_CAST_OK) && GetGoType() == GAMEOBJECT_TYPE_SPELLCASTER) + if ((spellCaster->CastSpell(user, spellInfo, TriggerCastFlags(triggeredFlags)) == SPELL_CAST_OK) && GetGoType() == GAMEOBJECT_TYPE_SPELLCASTER) AddUse(); } else @@ -2300,7 +2311,7 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= nullptr*/ data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event // change >= 0 triggers SPELL_BUILDING_DAMAGE event data << uint32(spellId); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } GameObjectDestructibleState newState = GetDestructibleState(); @@ -3046,13 +3057,13 @@ SpellInfo const* GameObject::GetSpellForLock(Player const* player) const return nullptr; } -void GameObject::AddToSkillupList(ObjectGuid playerGuid) +void GameObject::AddToSkillupList(ObjectGuid const& playerGuid) { int32 timer = GetMap()->IsDungeon() ? -1 : 10 * MINUTE * IN_MILLISECONDS; m_SkillupList[playerGuid] = timer; } -bool GameObject::IsInSkillupList(ObjectGuid playerGuid) const +bool GameObject::IsInSkillupList(ObjectGuid const& playerGuid) const { for (auto const& itr : m_SkillupList) { diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 1b8ccd0477..12154547e3 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.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 @@ -231,8 +231,8 @@ public: void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; } void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; } - void AddToSkillupList(ObjectGuid playerGuid); - [[nodiscard]] bool IsInSkillupList(ObjectGuid playerGuid) const; + void AddToSkillupList(ObjectGuid const& playerGuid); + [[nodiscard]] bool IsInSkillupList(ObjectGuid const& playerGuid) const; void AddUniqueUse(Player* player); void AddUse() { ++m_usetimes; } @@ -414,7 +414,7 @@ private: void UpdatePackedRotation(); //! Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size. - bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/, bool /*useBoundingRadius = true*/) const override + bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/, bool /*incOwnRadius = true*/, bool /*incTargetRadius = true*/) const override { //! Following check does check 3d distance dist2compare += obj->GetObjectSize(); diff --git a/src/server/game/Entities/GameObject/GameObjectData.h b/src/server/game/Entities/GameObject/GameObjectData.h index fd95aa5149..7615dbbbe8 100644 --- a/src/server/game/Entities/GameObject/GameObjectData.h +++ b/src/server/game/Entities/GameObject/GameObjectData.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/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index 100df46046..4dfa6208ac 100644 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.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/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h index 071f4d9023..dff1d41437 100644 --- a/src/server/game/Entities/Item/Container/Bag.h +++ b/src/server/game/Entities/Item/Container/Bag.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/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 9b58746e95..9aea0ea743 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.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 @@ -1066,7 +1066,7 @@ void Item::SendUpdateSockets() for (uint32 i = SOCK_ENCHANTMENT_SLOT; i <= BONUS_ENCHANTMENT_SLOT; ++i) data << uint32(GetEnchantmentId(EnchantmentSlot(i))); - GetOwner()->GetSession()->SendPacket(&data); + GetOwner()->SendDirectMessage(&data); } // Though the client has the information in the item's data field, @@ -1081,7 +1081,7 @@ void Item::SendTimeUpdate(Player* owner) WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8 + 4)); data << GetGUID(); data << uint32(duration); - owner->GetSession()->SendPacket(&data); + owner->SendDirectMessage(&data); } Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clone, uint32 randomPropertyId) diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index a4ce99fdd0..51289594b9 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.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/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index dd781062ea..c50d0991eb 100644 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.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/Entities/Item/ItemEnchantmentMgr.h b/src/server/game/Entities/Item/ItemEnchantmentMgr.h index 68e992490d..0634bccc2a 100644 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.h +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.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/Entities/Item/ItemTemplate.h b/src/server/game/Entities/Item/ItemTemplate.h index 40cc6f38e1..b41616c112 100644 --- a/src/server/game/Entities/Item/ItemTemplate.h +++ b/src/server/game/Entities/Item/ItemTemplate.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/Entities/Item/enuminfo_Item.cpp b/src/server/game/Entities/Item/enuminfo_Item.cpp index 54edf959bc..9bb99651c7 100644 --- a/src/server/game/Entities/Item/enuminfo_Item.cpp +++ b/src/server/game/Entities/Item/enuminfo_Item.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/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index a183d14672..3d86fd0599 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.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 @@ -240,7 +240,7 @@ void Object::SendUpdateToPlayer(Player* player) BuildCreateUpdateBlockForPlayer(&upd, player); upd.BuildPacket(packet); - player->GetSession()->SendPacket(&packet); + player->SendDirectMessage(&packet); } void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) @@ -272,7 +272,7 @@ void Object::DestroyForPlayer(Player* target, bool onDeath) const { WorldPacket data(SMSG_ARENA_UNIT_DESTROYED, 8); data << GetGUID(); - target->GetSession()->SendPacket(&data); + target->SendDirectMessage(&data); } } } @@ -282,7 +282,7 @@ void Object::DestroyForPlayer(Player* target, bool onDeath) const //! If the following bool is true, the client will call "void CGUnit_C::OnDeath()" for this object. //! OnDeath() does for eg trigger death animation and interrupts certain spells/missiles/auras/sounds... data << uint8(onDeath ? 1 : 0); - target->GetSession()->SendPacket(&data); + target->SendDirectMessage(&data); } [[nodiscard]] int32 Object::GetInt32Value(uint16 index) const @@ -1095,23 +1095,45 @@ void WorldObject::SetVisibilityDistanceOverride(VisibilityDistanceType type) if (type == GetVisibilityOverrideType()) return; - if (IsPlayer()) + if (!IsCreature() && !IsGameObject() && !IsDynamicObject()) return; - if (IsVisibilityOverridden()) - { - if (IsFarVisible()) - GetMap()->RemoveWorldObjectFromFarVisibleMap(this); - else if (IsZoneWideVisible()) - GetMap()->RemoveWorldObjectFromZoneWideVisibleMap(GetZoneId(), this); - } - - if (type == VisibilityDistanceType::Large || type == VisibilityDistanceType::Gigantic) - GetMap()->AddWorldObjectToFarVisibleMap(this); - else if (type == VisibilityDistanceType::Infinite) - GetMap()->AddWorldObjectToZoneWideVisibleMap(GetZoneId(), this); + // Important to remove from old visibility override containers first + RemoveFromMapVisibilityOverrideContainers(); + // Always update _visibilityDistanceOverrideType, even when not in world _visibilityDistanceOverrideType = type; + + // Finally, add to new visibility override containers + AddToMapVisibilityOverrideContainers(); +} + +void WorldObject::RemoveFromMapVisibilityOverrideContainers() +{ + if (!IsVisibilityOverridden()) + return; + + if (!IsInWorld()) + return; + + if (IsFarVisible()) + GetMap()->RemoveWorldObjectFromFarVisibleMap(this); + else if (IsZoneWideVisible()) + GetMap()->RemoveWorldObjectFromZoneWideVisibleMap(_zoneId, this); +} + +void WorldObject::AddToMapVisibilityOverrideContainers() +{ + if (!IsVisibilityOverridden()) + return; + + if (!IsInWorld()) + return; + + if (IsFarVisible()) + GetMap()->AddWorldObjectToFarVisibleMap(this); + else if (IsZoneWideVisible()) + GetMap()->AddWorldObjectToZoneWideVisibleMap(_zoneId, this); } void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/) @@ -1177,6 +1199,9 @@ void WorldObject::AddToWorld() Object::AddToWorld(); GetMap()->GetZoneAndAreaId(GetPhaseMask(), _zoneId, _areaId, GetPositionX(), GetPositionY(), GetPositionZ()); GetMap()->AddObjectToPendingUpdateList(this); + + if (IsZoneWideVisible()) + GetMap()->AddWorldObjectToZoneWideVisibleMap(_zoneId, this); } void WorldObject::RemoveFromWorld() @@ -1184,8 +1209,7 @@ void WorldObject::RemoveFromWorld() if (!IsInWorld()) return; - if (IsZoneWideVisible()) - GetMap()->RemoveWorldObjectFromZoneWideVisibleMap(GetZoneId(), this); + RemoveFromMapVisibilityOverrideContainers(); DestroyForVisiblePlayers(); @@ -1208,10 +1232,14 @@ float WorldObject::GetDistanceZ(WorldObject const* obj) const return (dist > 0 ? dist : 0); } -bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool useBoundingRadius) const +bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius, bool incTargetRadius) const { - float sizefactor = useBoundingRadius ? GetObjectSize() + obj->GetObjectSize() : 0.0f; - float maxdist = dist2compare + sizefactor; + float maxdist = dist2compare; + if (incOwnRadius) + maxdist += GetObjectSize(); + + if (incTargetRadius) + maxdist += obj->GetObjectSize(); if (m_transport && obj->GetTransport() && obj->GetTransport()->GetGUID() == m_transport->GetGUID()) { @@ -1318,14 +1346,14 @@ bool WorldObject::IsWithinDist2d(const Position* pos, float dist) const } // use only if you will sure about placing both object at same map -bool WorldObject::IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool useBoundingRadius) const +bool WorldObject::IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius, bool incTargetRadius) const { - return obj && _IsWithinDist(obj, dist2compare, is3D, useBoundingRadius); + return obj && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius); } -bool WorldObject::IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D, bool useBoundingRadius) const +bool WorldObject::IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius, bool incTargetRadius) const { - return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, useBoundingRadius); + return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius); } bool WorldObject::IsWithinLOS(float ox, float oy, float oz, VMAP::ModelIgnoreFlags ignoreFlags, LineOfSightChecks checks) const @@ -1752,6 +1780,8 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo WorldObject const* viewpoint = this; if (Player const* thisPlayer = ToPlayer()) { + viewpoint = thisPlayer->GetSeer(); + if (Creature const* creature = obj->ToCreature()) { if (TempSummon const* tempSummon = creature->ToTempSummon()) @@ -1791,13 +1821,8 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo return false; } - if (thisPlayer->GetViewpoint()) - viewpoint = thisPlayer->GetViewpoint(); - if (thisPlayer->GetFarSightDistance() && !thisPlayer->isInFront(obj)) - { return false; - } } // Xinef: check reversely obj vs viewpoint, object could be a gameObject which overrides _IsWithinDist function to include gameobject size @@ -2044,7 +2069,7 @@ void WorldObject::SendPlayMusic(uint32 Music, bool OnlySelf) WorldPacket data(SMSG_PLAY_MUSIC, 4); data << Music; if (OnlySelf && IsPlayer()) - this->ToPlayer()->GetSession()->SendPacket(&data); + ToPlayer()->SendDirectMessage(&data); else SendMessageToSet(&data, true); // ToSelf ignored in this case } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 23784c9c63..9e84a3732a 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.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 @@ -41,7 +41,7 @@ #include "UpdateFields.h" -class ElunaEventProcessor; +class ALEEventProcessor; enum TempSummonType { @@ -541,8 +541,8 @@ public: [[nodiscard]] bool IsWithinDist2d(float x, float y, float dist) const; bool IsWithinDist2d(const Position* pos, float dist) const; // use only if you will sure about placing both object at same map - bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true, bool useBoundingRadius = true) const; - bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true, bool useBoundingRadius = true) const; + bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true, bool incOwnRadius = true, bool incTargetRadius = true) const; + bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true, bool incOwnRadius = true, bool incTargetRadius = true) const; [[nodiscard]] bool IsWithinLOS(float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags = VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS) const; [[nodiscard]] bool IsWithinLOSInMap(WorldObject const* obj, VMAP::ModelIgnoreFlags ignoreFlags = VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS, Optional<float> collisionHeight = { }, Optional<float> combatReach = { }) const; [[nodiscard]] Position GetHitSpherePointFor(Position const& dest, Optional<float> collisionHeight = { }, Optional<float> combatReach = { }) const; @@ -727,7 +727,7 @@ public: ObjectVisibilityContainer const& GetObjectVisibilityContainer() const { return _objectVisibilityContainer; } // Event handler - ElunaEventProcessor* elunaEvents; + ALEEventProcessor* ALEEvents; EventProcessor m_Events; protected: @@ -770,7 +770,7 @@ private: uint16 m_notifyflags; uint16 m_executed_notifies; - virtual bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool useBoundingRadius = true) const; + virtual bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius = true, bool incTargetRadius = true) const; bool CanNeverSee(WorldObject const* obj) const; virtual bool CanAlwaysSee(WorldObject const* /*obj*/) const { return false; } @@ -780,6 +780,9 @@ private: //bool CanDetectStealthOf(WorldObject const* obj) const; bool CanDetectStealthOf(WorldObject const* obj, bool checkAlert = false) const; + void RemoveFromMapVisibilityOverrideContainers(); + void AddToMapVisibilityOverrideContainers(); + GuidUnorderedSet _allowedLooters; ObjectVisibilityContainer _objectVisibilityContainer; diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h index fb0daa500b..89c773a397 100644 --- a/src/server/game/Entities/Object/ObjectDefines.h +++ b/src/server/game/Entities/Object/ObjectDefines.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/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp index f14a967bcd..2a6e230723 100644 --- a/src/server/game/Entities/Object/ObjectGuid.cpp +++ b/src/server/game/Entities/Object/ObjectGuid.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/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index a8d99fe80e..f92229e99f 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.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 @@ -269,7 +269,7 @@ class PackedGuid explicit PackedGuid(ObjectGuid guid) : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid.appendPackGUID(guid.GetRawValue()); } void Set(uint64 guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid); } - void Set(ObjectGuid guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid.GetRawValue()); } + void Set(ObjectGuid const& guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid.GetRawValue()); } [[nodiscard]] std::size_t size() const { return _packedGuid.size(); } diff --git a/src/server/game/Entities/Object/ObjectPosSelector.cpp b/src/server/game/Entities/Object/ObjectPosSelector.cpp index 849a777e95..91d79ccbf3 100644 --- a/src/server/game/Entities/Object/ObjectPosSelector.cpp +++ b/src/server/game/Entities/Object/ObjectPosSelector.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/Entities/Object/ObjectPosSelector.h b/src/server/game/Entities/Object/ObjectPosSelector.h index 1f24c7b221..466957bf7e 100644 --- a/src/server/game/Entities/Object/ObjectPosSelector.h +++ b/src/server/game/Entities/Object/ObjectPosSelector.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/Entities/Object/ObjectVisibilityContainer.cpp b/src/server/game/Entities/Object/ObjectVisibilityContainer.cpp index 358626180b..7ab7104456 100644 --- a/src/server/game/Entities/Object/ObjectVisibilityContainer.cpp +++ b/src/server/game/Entities/Object/ObjectVisibilityContainer.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/Entities/Object/ObjectVisibilityContainer.h b/src/server/game/Entities/Object/ObjectVisibilityContainer.h index 07444c6356..bb289e7a8e 100644 --- a/src/server/game/Entities/Object/ObjectVisibilityContainer.h +++ b/src/server/game/Entities/Object/ObjectVisibilityContainer.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/Entities/Object/Position.cpp b/src/server/game/Entities/Object/Position.cpp index 65c2ede216..77f17ea544 100644 --- a/src/server/game/Entities/Object/Position.cpp +++ b/src/server/game/Entities/Object/Position.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/Entities/Object/Position.h b/src/server/game/Entities/Object/Position.h index baeff5a80d..8ffb41928a 100644 --- a/src/server/game/Entities/Object/Position.h +++ b/src/server/game/Entities/Object/Position.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/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp index 00c565c665..361d50d4a2 100644 --- a/src/server/game/Entities/Object/Updates/UpdateData.cpp +++ b/src/server/game/Entities/Object/Updates/UpdateData.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/Entities/Object/Updates/UpdateData.h b/src/server/game/Entities/Object/Updates/UpdateData.h index 6a795bd7e0..dbf54b7206 100644 --- a/src/server/game/Entities/Object/Updates/UpdateData.h +++ b/src/server/game/Entities/Object/Updates/UpdateData.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/Entities/Object/Updates/UpdateFieldFlags.cpp b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp index 5946c90590..149ca6da4a 100644 --- a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp +++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.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/Entities/Object/Updates/UpdateFieldFlags.h b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h index 4675f11db5..4b499b11e7 100644 --- a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h +++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.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/Entities/Object/Updates/UpdateFields.h b/src/server/game/Entities/Object/Updates/UpdateFields.h index a22602824d..7f57183af4 100644 --- a/src/server/game/Entities/Object/Updates/UpdateFields.h +++ b/src/server/game/Entities/Object/Updates/UpdateFields.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/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h index 906209c639..11250f13a3 100644 --- a/src/server/game/Entities/Object/Updates/UpdateMask.h +++ b/src/server/game/Entities/Object/Updates/UpdateMask.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/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index dc33162260..4cb7d3d1b1 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.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 @@ -692,7 +692,7 @@ void Pet::Update(uint32 diff) } } - if (m_duration > 0s) + if (m_duration > 0ms) { if (m_duration > _diff) m_duration -= _diff; @@ -708,7 +708,7 @@ void Pet::Update(uint32 diff) if (getPowerType() == POWER_FOCUS) { m_petRegenTimer -= _diff; - if (m_petRegenTimer <= 0s) + if (m_petRegenTimer <= 0ms) { m_petRegenTimer += PET_FOCUS_REGEN_INTERVAL; Regenerate(POWER_FOCUS); @@ -1026,7 +1026,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) Unit* owner = GetOwner(); if (!owner) // just to be sure, asynchronous now { - DespawnOrUnsummon(1000); + DespawnOrUnsummon(1s); return false; } @@ -1512,7 +1512,7 @@ void Pet::_LoadSpellCooldowns(PreparedQueryResult result) if (!cooldowns.empty() && GetOwner()) { BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, cooldowns); - GetOwner()->GetSession()->SendPacket(&data); + GetOwner()->SendDirectMessage(&data); } } } diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index e737bab11f..5639fff43d 100644 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.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,7 +52,7 @@ public: PetType getPetType() const { return m_petType; } void setPetType(PetType type) { m_petType = type; } bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; } - bool isTemporarySummoned() const { return m_duration > 0s; } + bool isTemporarySummoned() const { return m_duration > 0ms; } bool IsPermanentPetFor(Player* owner) const; // pet have tab in character windows and set UNIT_FIELD_PETNUMBER diff --git a/src/server/game/Entities/Pet/PetDefines.h b/src/server/game/Entities/Pet/PetDefines.h index 6bb873258e..3721cce89d 100644 --- a/src/server/game/Entities/Pet/PetDefines.h +++ b/src/server/game/Entities/Pet/PetDefines.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 @@ -23,6 +23,7 @@ #include <array> #include <string> #include <vector> +#include <numbers> enum ReactStates : uint8; @@ -75,10 +76,10 @@ enum ActionFeedback FEEDBACK_CANT_ATT_TARGET = 3 }; -enum PetTalk +enum PetAction : int32 { - PET_TALK_SPECIAL_SPELL = 0, - PET_TALK_ATTACK = 1 + PET_ACTION_SPECIAL_SPELL = 0, + PET_ACTION_ATTACK = 1 }; enum PetLoadState @@ -202,8 +203,10 @@ enum PetScalingSpells SPELL_RISEN_GHOUL_SELF_STUN = 47466, }; -#define PET_FOLLOW_DIST 1.0f -#define PET_FOLLOW_ANGLE (M_PI/2) +constexpr float PET_FOLLOW_DIST = 2.0f; +constexpr float PET_FOLLOW_ANGLE = std::numbers::pi_v<float> / 2; +constexpr float MINI_PET_SUMMON_ANGLE = std::numbers::pi_v<float> / 4; +constexpr float MINI_PET_FOLLOW_ANGLE = std::numbers::pi_v<float>; class PetStable { diff --git a/src/server/game/Entities/Player/CinematicMgr.cpp b/src/server/game/Entities/Player/CinematicMgr.cpp index 8dbe3fb416..d8091d9180 100644 --- a/src/server/game/Entities/Player/CinematicMgr.cpp +++ b/src/server/game/Entities/Player/CinematicMgr.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/Entities/Player/CinematicMgr.h b/src/server/game/Entities/Player/CinematicMgr.h index 2baeb54bf1..1dffe9957f 100644 --- a/src/server/game/Entities/Player/CinematicMgr.h +++ b/src/server/game/Entities/Player/CinematicMgr.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/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp index 606dd15476..dce44da0f5 100644 --- a/src/server/game/Entities/Player/KillRewarder.cpp +++ b/src/server/game/Entities/Player/KillRewarder.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/Entities/Player/KillRewarder.h b/src/server/game/Entities/Player/KillRewarder.h index 3efc3cc62b..a91a2a0452 100644 --- a/src/server/game/Entities/Player/KillRewarder.h +++ b/src/server/game/Entities/Player/KillRewarder.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/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 02adb9ef0c..111392968a 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.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 @@ -78,6 +78,7 @@ #include "TicketMgr.h" #include "Tokenize.h" #include "Transport.h" +#include "Unit.h" #include "UpdateData.h" #include "Util.h" #include "Vehicle.h" @@ -90,6 +91,7 @@ #include "WorldStateDefines.h" #include "WorldStatePackets.h" #include <cmath> +#include <queue> /// @todo: this import is not necessary for compilation and marked as unused by the IDE // however, for some reasons removing it would cause a damn linking issue @@ -416,6 +418,8 @@ Player::Player(WorldSession* session): Unit(), m_mover(this) GetObjectVisibilityContainer().InitForPlayer(); sScriptMgr->OnConstructPlayer(this); + + _expectingChangeTransport = false; } Player::~Player() @@ -1337,9 +1341,10 @@ void Player::SendTeleportAckPacket() { WorldPacket data(MSG_MOVE_TELEPORT_ACK, 41); data << GetPackGUID(); - data << uint32(0); // this value increments every time + data << GetSession()->GetOrderCounter(); // movement counter BuildMovementPacket(&data); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); + GetSession()->IncrementOrderCounter(); } bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options /*= 0*/, Unit* target /*= nullptr*/, bool newInstance /*= false*/) @@ -1529,17 +1534,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati CombatStop(); - // remove arena spell coldowns/buffs now to also remove pet's cooldowns before it's temporarily unsummoned - if (mEntry->IsBattleArena() && (HasPendingSpectatorForBG(0) || !HasPendingSpectatorForBG(GetBattlegroundId()))) - { - // KEEP THIS ORDER! - RemoveArenaAuras(); - if (pet) - pet->RemoveArenaAuras(); - - RemoveArenaSpellCooldowns(true); - } - // remove pet on map change if (pet) UnsummonPetTemporaryIfAny(); @@ -1556,6 +1550,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati //remove auras before removing from map... RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP | AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING); + SetMapChangeOrderCounter(); + if (!GetSession()->PlayerLogout()) { // send transfer packets @@ -1564,24 +1560,13 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (m_transport) data << m_transport->GetEntry() << GetMapId(); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } // remove from old map now if (oldmap) oldmap->RemovePlayerFromMap(this, false); - // xinef: do this before setting fall information! - if (IsMounted() && (!GetMap()->GetEntry()->IsDungeon() && !GetMap()->GetEntry()->IsBattlegroundOrArena()) && !m_transport) - { - AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOUNTED); - if (!auras.empty()) - { - SetMountBlockId((*auras.begin())->GetId()); - RemoveAurasByType(SPELL_AURA_MOUNTED); - } - } - teleportStore_dest = WorldLocation(mapid, x, y, z, orientation); SetFallInformation(GameTime::GetGameTime().count(), z); // if the player is saved before worldportack (at logout for example) @@ -1597,7 +1582,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati else data << teleportStore_dest.PositionXYZOStream(); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); SendSavedInstances(); } @@ -2086,7 +2071,7 @@ bool Player::CanInteractWithQuestGiver(Object* questGiver) return false; } -Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask) +Creature* Player::GetNPCIfCanInteractWith(ObjectGuid const& guid, uint32 npcflagmask) { // unit checks if (!guid) @@ -2143,7 +2128,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask) return creature; } -GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const +GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid const& guid, GameobjectTypes type) const { if (GameObject* go = GetMap()->GetGameObject(guid)) { @@ -2379,7 +2364,7 @@ void Player::SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool re } data << uint8(recruitAFriend ? 1 : 0); // does the GivenXP include a RaF bonus? - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward) @@ -2499,6 +2484,7 @@ void Player::GiveLevel(uint8 level) m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset _ApplyAllLevelScaleItemMods(false); + _RemoveAllAuraStatMods(); SetLevel(level); @@ -2521,6 +2507,7 @@ void Player::GiveLevel(uint8 level) UpdateSkillsToMaxSkillsForLevel(); _ApplyAllLevelScaleItemMods(true); + _ApplyAllAuraStatMods(); if (!isDead()) { @@ -2854,7 +2841,7 @@ void Player::SendInitialSpells() data << uint32(itr->second.category ? cooldown : 0); // category cooldown } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::RemoveMail(uint32 id) @@ -2883,7 +2870,7 @@ void Player::SendMailResult(uint32 mailId, MailResponseType mailAction, MailResp data << (uint32) item_guid; // item guid low? data << (uint32) item_count; // item count? } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendNewMail() @@ -2891,7 +2878,7 @@ void Player::SendNewMail() // deliver undelivered mail WorldPacket data(SMSG_RECEIVED_MAIL, 4); data << (uint32) 0; - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::AddNewMailDeliverTime(time_t deliver_time) @@ -3049,13 +3036,13 @@ void Player::SendLearnPacket(uint32 spellId, bool learn) WorldPacket data(SMSG_LEARNED_SPELL, 6); data << uint32(spellId); data << uint16(0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } else { WorldPacket data(SMSG_REMOVED_SPELL, 4); data << uint32(spellId); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } } @@ -3087,7 +3074,7 @@ bool Player::addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); data << uint32(nextSpellInfo->Id); data << uint32(spellInfo->Id); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } return false; } @@ -3800,7 +3787,7 @@ bool Player::resetTalents(bool noResetCost) if (m_canTitanGrip) SetCanTitanGrip(false); // xinef: remove dual wield if player does not have dual wield spell (shamans) - if (!HasSpell(674) && m_canDualWield) + if (!HasSpell(674) && CanDualWield()) SetCanDualWield(false); AutoUnequipOffhandIfNeed(); @@ -4422,32 +4409,6 @@ void Player::DeleteOldRecoveryItems(uint32 keepDays) } } -void Player::SetMovement(PlayerMovementType pType) -{ - WorldPacket data; - switch (pType) - { - case MOVE_ROOT: - data.Initialize(SMSG_FORCE_MOVE_ROOT, GetPackGUID().size() + 4); - break; - case MOVE_UNROOT: - data.Initialize(SMSG_FORCE_MOVE_UNROOT, GetPackGUID().size() + 4); - break; - case MOVE_WATER_WALK: - data.Initialize(SMSG_MOVE_WATER_WALK, GetPackGUID().size() + 4); - break; - case MOVE_LAND_WALK: - data.Initialize(SMSG_MOVE_LAND_WALK, GetPackGUID().size() + 4); - break; - default: - LOG_ERROR("entities.player", "Player::SetMovement: Unsupported move type ({}), data not sent to client.", pType); - return; - } - data << GetPackGUID(); - data << uint32(0); - GetSession()->SendPacket(&data); -} - /* Preconditions: - a resurrectable corpse must not be loaded for the player (only bones) - the player must be in world @@ -4456,7 +4417,7 @@ void Player::BuildPlayerRepop() { WorldPacket data(SMSG_PRE_RESURRECT, GetPackGUID().size()); data << GetPackGUID(); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); if (getRace(true) == RACE_NIGHTELF) { CastSpell(this, 20584, true); @@ -4483,12 +4444,11 @@ void Player::BuildPlayerRepop() } GetMap()->AddToMap(corpse); SetHealth(1); // convert player body to ghost - SetMovement(MOVE_WATER_WALK); SetWaterWalking(true); - if (!GetSession()->isLogingOut()) - { - SetMovement(MOVE_UNROOT); - } + + if (!IsImmobilizedState()) + SendMoveRoot(false); + RemoveUnitFlag(UNIT_FLAG_SKINNABLE); // BG - remove insignia related int32 corpseReclaimDelay = CalculateCorpseReclaimDelay(); if (corpseReclaimDelay >= 0) @@ -4511,7 +4471,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) data << float(0); data << float(0); data << float(0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); // speed change, land walk @@ -4524,8 +4484,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) SetDynamicFlag(UNIT_DYNFLAG_REFER_A_FRIEND); setDeathState(DeathState::Alive); - SetMovement(MOVE_LAND_WALK); - SetMovement(MOVE_UNROOT); + SendMoveRoot(false); SetWaterWalking(false); m_deathTimer = 0; @@ -4589,7 +4548,7 @@ void Player::KillPlayer() if (IsFlying() && !GetTransport()) GetMotionMaster()->MoveFall(); - SetMovement(MOVE_ROOT); + SendMoveRoot(true); StopMirrorTimers(); //disable timers(bars) @@ -4616,7 +4575,7 @@ void Player::KillPlayer() //UpdateObjectVisibility(); // pussywizard: not needed } -void Player::OfflineResurrect(ObjectGuid const guid, CharacterDatabaseTransaction trans) +void Player::OfflineResurrect(ObjectGuid const& guid, CharacterDatabaseTransaction trans) { Corpse::DeleteFromDB(guid, trans); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); @@ -4998,7 +4957,7 @@ void Player::RepopAtGraveyard() data << ClosestGrave->x; data << ClosestGrave->y; data << ClosestGrave->z; - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } } else if (GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY())) @@ -5608,7 +5567,7 @@ void Player::SendActionButtons(uint32 state) const } } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); LOG_DEBUG("entities.player", "Action Buttons for {} spec {} Sent", GetGUID().ToString(), m_activeSpec); } @@ -6235,7 +6194,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar // Xinef: non quest case, quest honor obtain is send in quest reward packet if (uVictim || groupsize > 0) - GetSession()->SendPacket(&data); + SendDirectMessage(&data); // add honor points ModifyHonorPoints(honor); @@ -6428,7 +6387,7 @@ void Player::CheckDuelDistance(time_t currTime) duel->OutOfBoundsTime = currTime + 10; WorldPacket data(SMSG_DUEL_OUTOFBOUNDS, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } } else @@ -6438,7 +6397,7 @@ void Player::CheckDuelDistance(time_t currTime) duel->OutOfBoundsTime = 0; WorldPacket data(SMSG_DUEL_INBOUNDS, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } else if (currTime >= duel->OutOfBoundsTime) DuelComplete(DUEL_FLED); @@ -6613,13 +6572,13 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) LOG_DEBUG("entities.player", "applying mods for item {} ", item->GetGUID().ToString()); - uint8 attacktype = Player::GetAttackBySlot(slot); + WeaponAttackType attacktype = Player::GetAttackBySlot(slot); if (item->HasSocket()) //only (un)equipping of items with sockets can influence metagems, so no need to waste time with normal items CorrectMetaGemEnchants(slot, apply); if (attacktype < MAX_ATTACK) - _ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), apply); + _ApplyWeaponDependentAuraMods(item, attacktype, apply); _ApplyItemBonuses(proto, slot, apply); @@ -6906,7 +6865,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply if (proto->ArcaneRes) HandleStatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(proto->ArcaneRes), apply); - uint8 attType = Player::GetAttackBySlot(slot); + WeaponAttackType attType = Player::GetAttackBySlot(slot); if (attType != MAX_ATTACK) { _ApplyWeaponDamage(slot, proto, ssv, apply); @@ -6953,7 +6912,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt ssv = ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : nullptr; } - uint8 attType = Player::GetAttackBySlot(slot); + WeaponAttackType attType = Player::GetAttackBySlot(slot); if (!IsInFeralForm() && apply && !CanUseAttackType(attType)) { return; @@ -6984,12 +6943,12 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt if (minDamage > 0.f) { - SetBaseWeaponDamage(WeaponAttackType(attType), MINDAMAGE, minDamage, i); + SetBaseWeaponDamage(attType, MINDAMAGE, minDamage, i); } if (maxDamage > 0.f) { - SetBaseWeaponDamage(WeaponAttackType(attType), MAXDAMAGE, maxDamage, i); + SetBaseWeaponDamage(attType, MAXDAMAGE, maxDamage, i); } } } @@ -6998,8 +6957,8 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt { for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) { - SetBaseWeaponDamage(WeaponAttackType(attType), MINDAMAGE, 0.f, i); - SetBaseWeaponDamage(WeaponAttackType(attType), MAXDAMAGE, 0.f, i); + SetBaseWeaponDamage(attType, MINDAMAGE, 0.f, i); + SetBaseWeaponDamage(attType, MAXDAMAGE, 0.f, i); } if (attType == BASE_ATTACK) @@ -7023,8 +6982,8 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt if (IsInFeralForm()) return; - if (CanModifyStats() && (GetWeaponDamageRange(WeaponAttackType(attType), MAXDAMAGE) || proto->Delay)) - UpdateDamagePhysical(WeaponAttackType(attType)); + if (CanModifyStats() && (GetWeaponDamageRange(attType, MAXDAMAGE) || proto->Delay)) + UpdateDamagePhysical(attType); } void Player::CastAllObtainSpells() @@ -7617,9 +7576,9 @@ void Player::_RemoveAllItemMods() if (!proto) continue; - uint32 attacktype = Player::GetAttackBySlot(i); + WeaponAttackType attacktype = Player::GetAttackBySlot(i); if (attacktype < MAX_ATTACK) - _ApplyWeaponDependentAuraMods(m_items[i], WeaponAttackType(attacktype), false); + _ApplyWeaponDependentAuraMods(m_items[i], attacktype, false); _ApplyItemBonuses(proto, i, false); @@ -7646,9 +7605,9 @@ void Player::_ApplyAllItemMods() if (!proto) continue; - uint32 attacktype = Player::GetAttackBySlot(i); + WeaponAttackType attacktype = Player::GetAttackBySlot(i); if (attacktype < MAX_ATTACK) - _ApplyWeaponDependentAuraMods(m_items[i], WeaponAttackType(attacktype), true); + _ApplyWeaponDependentAuraMods(m_items[i], attacktype, true); _ApplyItemBonuses(proto, i, true); @@ -7801,7 +7760,7 @@ void Player::SendQuestGiverStatusMultiple() }); data.put<uint32>(0, count); // write real count - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } /* If in a battleground a player dies, and an enemy removes the insignia, the player's bones is lootable @@ -8248,14 +8207,14 @@ void Player::SendLootError(ObjectGuid guid, LootError error) void Player::SendNotifyLootMoneyRemoved() { WorldPacket data(SMSG_LOOT_CLEAR_MONEY, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendNotifyLootItemRemoved(uint8 lootSlot) { WorldPacket data(SMSG_LOOT_REMOVED, 1); data << uint8(lootSlot); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } // TODO - InitWorldStates should NOT always send the same states @@ -8960,7 +8919,7 @@ void Player::SetBindPoint(ObjectGuid guid) { WorldPacket data(SMSG_BINDER_CONFIRM, 8); data << guid; - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendTalentWipeConfirm(ObjectGuid guid) @@ -8969,7 +8928,7 @@ void Player::SendTalentWipeConfirm(ObjectGuid guid) data << guid; uint32 cost = sWorld->getBoolConfig(CONFIG_NO_RESET_TALENT_COST) ? 0 : resetTalentsCost(); data << cost; - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::ResetPetTalents() @@ -9014,7 +8973,7 @@ Pet* Player::GetPet() const return nullptr; } -Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration /*= 0s*/, uint32 healthPct /*= 0*/) +Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration /*= 0ms*/, uint32 healthPct /*= 0*/) { PetStable& petStable = GetOrInitPetStable(); @@ -9035,7 +8994,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy ++itr; } - if (duration > 0s) + if (duration > 0ms) pet->SetDuration(duration); // Generate a new name for the newly summoned ghoul @@ -9129,7 +9088,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy } } - if (duration > 0s) + if (duration > 0ms) pet->SetDuration(duration); if (NeedSendSpectatorData() && pet->GetCreatureTemplate()->family) @@ -9232,7 +9191,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) { WorldPacket data(SMSG_PET_SPELLS, 8); data << uint64(0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); if (GetGroup()) SetGroupUpdateFlag(GROUP_UPDATE_PET); @@ -9426,11 +9385,7 @@ void Player::Say(std::string_view text, Language language, WorldObject const* /* { std::string _text(text); if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_SAY, language, _text)) - { return; - } - - sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_SAY, language, this, this, _text); @@ -9452,11 +9407,7 @@ void Player::Yell(std::string_view text, Language language, WorldObject const* / std::string _text(text); if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_YELL, language, _text)) - { return; - } - - sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_YELL, language, this, this, _text); @@ -9478,11 +9429,7 @@ void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/, std::string _text(text); if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text)) - { return; - } - - sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, _text); @@ -9511,22 +9458,18 @@ void Player::Whisper(std::string_view text, Language language, Player* target, b std::string _text(text); if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_WHISPER, language, _text, target)) - { return; - } - - sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, language, this, this, _text); - target->GetSession()->SendPacket(&data); + target->SendDirectMessage(&data); // rest stuff shouldn't happen in case of addon message if (isAddonMessage) return; ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER_INFORM, Language(language), target, target, _text); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); if (!isAcceptWhispers() && !IsGameMaster() && !target->IsGameMaster()) { @@ -9635,7 +9578,7 @@ void Player::PetSpellInitialize() data << uint32(category ? cooldown : 0); // category cooldown } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::PossessSpellInitialize() @@ -9663,7 +9606,7 @@ void Player::PossessSpellInitialize() data << uint8(0); // spells count data << uint8(0); // cooldowns count - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::VehicleSpellInitialize() @@ -9738,7 +9681,7 @@ void Player::VehicleSpellInitialize() data << uint32(category ? cooldown : 0); // category cooldown } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::CharmSpellInitialize() @@ -9792,14 +9735,14 @@ void Player::CharmSpellInitialize() data << uint8(0); // cooldowns count - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendRemoveControlBar() { WorldPacket data(SMSG_PET_SPELLS, 8); data << uint64(0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } bool Player::HasSpellMod(SpellModifier* mod, Spell* spell) @@ -10149,7 +10092,7 @@ void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) { WorldPacket data(SMSG_SET_PROFICIENCY, 1 + 4); data << uint8(itemClass) << uint32(itemSubclassMask); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type) @@ -10601,7 +10544,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) if (!cooldowns.empty()) { BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, cooldowns); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } } @@ -10721,7 +10664,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c data << uint32(vendorslot + 1); // numbered from 1 at client data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); data << uint32(count); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); SendNewItem(it, pProto->BuyCount * count, true, false, false); if (!bStore) @@ -11138,7 +11081,7 @@ void Player::ModifySpellCooldown(uint32 spellId, int32 cooldown) data << uint32(spellId); // Spell ID data << GetGUID(); // Player GUID data << int32(cooldown); // Cooldown mod in milliseconds - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= nullptr*/, bool setCooldown /*= true*/) @@ -11614,7 +11557,7 @@ void Player::SendInitialPacketsBeforeAddToMap() data << m_homebindX << m_homebindY << m_homebindZ; data << (uint32) m_homebindMapId; data << (uint32) m_homebindAreaId; - GetSession()->SendPacket(&data); + SendDirectMessage(&data); // SMSG_SET_PROFICIENCY // SMSG_SET_PCT_SPELL_MODIFIER @@ -11627,13 +11570,13 @@ void Player::SendInitialPacketsBeforeAddToMap() data.Initialize(SMSG_INSTANCE_DIFFICULTY, 4 + 4); data << uint32(GetMap()->GetDifficulty()); data << uint32(GetMap()->GetEntry()->IsDynamicDifficultyMap() && GetMap()->IsHeroic()); // Raid dynamic difficulty - GetSession()->SendPacket(&data); + SendDirectMessage(&data); SendInitialSpells(); data.Initialize(SMSG_SEND_UNLEARN_SPELLS, 4); data << uint32(0); // count, for (count) uint32; - GetSession()->SendPacket(&data); + SendDirectMessage(&data); SendInitialActionButtons(); m_reputationMgr->SendInitialReputations(); @@ -11645,7 +11588,7 @@ void Player::SendInitialPacketsBeforeAddToMap() data.AppendPackedTime(GameTime::GetGameTime().count()); data << float(0.01666667f); // game speed data << uint32(0); // added in 3.1.2 - GetSession()->SendPacket(&data); + SendDirectMessage(&data); GetReputationMgr().SendForceReactions(); // SMSG_SET_FORCED_REACTIONS @@ -11698,16 +11641,56 @@ void Player::SendInitialPacketsAfterAddToMap() GetZoneAndAreaId(newzone, newarea); UpdateZone(newzone, newarea); // also call SendInitWorldStates(); - if (HasStunAura()) - SetMovement(MOVE_ROOT); + WorldPacket setCompoundState(SMSG_MULTIPLE_MOVES, 100); + setCompoundState << uint32(0); // size placeholder // manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that must not be re-applied. - if (HasRootAura()) + if (IsImmobilizedState()) + { + uint32 const counter = GetSession()->GetOrderCounter(); + setCompoundState << uint8(2 + GetPackGUID().size() + 4); + setCompoundState << uint16(SMSG_FORCE_MOVE_ROOT); + setCompoundState << GetPackGUID(); + setCompoundState << uint32(counter); + GetSession()->IncrementOrderCounter(); + } + + if (HasAuraType(SPELL_AURA_FEATHER_FALL)) { - WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10); - data2 << GetPackGUID(); - data2 << (uint32)2; - SendMessageToSet(&data2, true); + uint32 const counter = GetSession()->GetOrderCounter(); + setCompoundState << uint8(2 + GetPackGUID().size() + 4); + setCompoundState << uint16(SMSG_MOVE_FEATHER_FALL); + setCompoundState << GetPackGUID(); + setCompoundState << uint32(counter); + GetSession()->IncrementOrderCounter(); + } + + if (HasAuraType(SPELL_AURA_WATER_WALK) || HasAura(8326)) + { + uint32 const counter = GetSession()->GetOrderCounter(); + setCompoundState << uint8(2 + GetPackGUID().size() + 4); + setCompoundState << uint16(SMSG_MOVE_WATER_WALK); + setCompoundState << GetPackGUID(); + setCompoundState << uint32(counter); + GetSession()->IncrementOrderCounter(); + } + + if (HasAuraType(SPELL_AURA_HOVER)) + { + uint32 const counter = GetSession()->GetOrderCounter(); + setCompoundState << uint8(2 + GetPackGUID().size() + 4); + setCompoundState << uint16(SMSG_MOVE_SET_HOVER); + setCompoundState << GetPackGUID(); + setCompoundState << uint32(counter); + GetSession()->IncrementOrderCounter(); + } + + // TODO: Pending mount protocol + + if (setCompoundState.size() > 4) + { + setCompoundState.put<uint32>(0, setCompoundState.size() - 4); + SendDirectMessage(&setCompoundState); } SendEnchantmentDurations(); // must be after add to map @@ -11757,7 +11740,7 @@ void Player::SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 default: break; } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool onEnterMap) @@ -11792,7 +11775,7 @@ void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint3 data << uint8(bind && bind->perm); // is locked data << uint8(bind && bind->extended); // is extended, ignored if prev field is 0 } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::ApplyEquipCooldown(Item* pItem) @@ -11839,7 +11822,7 @@ void Player::ApplyEquipCooldown(Item* pItem) WorldPacket data(SMSG_ITEM_COOLDOWN, 12); data << pItem->GetGUID(); data << uint32(spellData.SpellId); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } } @@ -12089,18 +12072,6 @@ void Player::GetAurasForTarget(Unit* target, bool force /*= false*/) if (!target || (!force && target->GetVisibleAuras()->empty())) // speedup things return; - /*! Blizz sends certain movement packets sometimes even before CreateObject - These movement packets are usually found in SMSG_COMPRESSED_MOVES - */ - if (target->HasFeatherFallAura()) - target->SendMovementFeatherFall(this); - - if (target->HasWaterWalkAura()) - target->SendMovementWaterWalking(this); - - if (target->HasHoverAura()) - target->SendMovementHover(this); - WorldPacket data(SMSG_AURA_UPDATE_ALL); data<< target->GetPackGUID(); @@ -12111,7 +12082,7 @@ void Player::GetAurasForTarget(Unit* target, bool force /*= false*/) auraApp->BuildUpdatePacket(data, false); } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SetDailyQuestStatus(uint32 quest_id) @@ -12881,7 +12852,7 @@ void Player::SetClientControl(Unit* target, bool allowMove, bool packetOnly /*= WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, target->GetPackGUID().size() + 1); data << target->GetPackGUID(); data << uint8((allowMove && !target->HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED)) ? 1 : 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); // We want to set the packet only if (packetOnly) @@ -13002,7 +12973,7 @@ void Player::SendCorpseReclaimDelay(uint32 delay) { WorldPacket data(SMSG_CORPSE_RECLAIM_DELAY, 4); data << uint32(delay); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } Player* Player::GetNextRandomRaidMember(float radius) @@ -13229,7 +13200,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply) SetSeer(this); //WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0); - //GetSession()->SendPacket(&data); + //SendDirectMessage(&data); } } @@ -13385,7 +13356,7 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost) WorldPacket data(SMSG_TITLE_EARNED, 4 + 4); data << uint32(title->bit_index); data << uint32(lost ? 0 : 1); // 1 - earned, 0 - lost - GetSession()->SendPacket(&data); + SendDirectMessage(&data); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK); } @@ -13445,7 +13416,7 @@ void Player::ConvertRune(uint8 index, RuneType newType) WorldPacket data(SMSG_CONVERT_RUNE, 2); data << uint8(index); data << uint8(newType); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::ResyncRunes(uint8 count) @@ -13457,14 +13428,14 @@ void Player::ResyncRunes(uint8 count) data << uint8(GetCurrentRune(i)); // rune type data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255) } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::AddRunePower(uint8 index) { WorldPacket data(SMSG_ADD_RUNE_POWER, 4); data << uint32(1 << index); // mask (0x00-0x3F probably) - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } static RuneType runeSlotTypes[MAX_RUNES] = @@ -14325,6 +14296,73 @@ bool Player::CanSeeSpellClickOn(Creature const* c) const return false; } +/** + * @brief Checks if any vendor option is available in the gossip menu tree for a given creature. + * + * @param menuId The starting gossip menu ID to check. + * @param creature Pointer to the creature whose gossip menus are being checked. + * @return true if a vendor option is available in any accessible menu; false otherwise. + */ +bool Player::AnyVendorOptionAvailable(uint32 menuId, Creature const* creature) const +{ + { + GossipMenuItemsMapBounds menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId); + if (menuItemBounds.first == menuItemBounds.second) + return true; + } + + std::set<uint32> visitedMenus; + std::queue<uint32> menusToCheck; + menusToCheck.push(menuId); + + while (!menusToCheck.empty()) + { + uint32 const currentMenuId = menusToCheck.front(); + menusToCheck.pop(); + + if (visitedMenus.find(currentMenuId) != visitedMenus.end()) + continue; + + visitedMenus.insert(currentMenuId); + + GossipMenuItemsMapBounds menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(currentMenuId); + + if (menuItemBounds.first == menuItemBounds.second && currentMenuId != 0) + continue; + + for (auto itr = menuItemBounds.first; itr != menuItemBounds.second; ++itr) + { + if (!sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(this), const_cast<Creature*>(creature), itr->second.Conditions)) + continue; + + if (itr->second.OptionType == GOSSIP_OPTION_VENDOR) + return true; + else if (itr->second.ActionMenuID) + { + GossipMenusMapBounds menuBounds = sObjectMgr->GetGossipMenusMapBounds(itr->second.ActionMenuID); + bool menuAccessible = false; + + if (menuBounds.first == menuBounds.second) + menuAccessible = true; + else + { + for (auto menuItr = menuBounds.first; menuItr != menuBounds.second; ++menuItr) + if (sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(this), const_cast<Creature*>(creature), menuItr->second.Conditions)) + { + menuAccessible = true; + break; + } + } + + if (menuAccessible) + menusToCheck.push(itr->second.ActionMenuID); + } + } + } + + return false; +} + bool Player::CanSeeVendor(Creature const* creature) const { if (!creature->HasNpcFlag(UNIT_NPC_FLAG_VENDOR)) @@ -14332,9 +14370,11 @@ bool Player::CanSeeVendor(Creature const* creature) const ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), 0); if (!sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(this), const_cast<Creature*>(creature), conditions)) - { return false; - } + + uint32 const menuId = creature->GetCreatureTemplate()->GossipMenuId; + if (!AnyVendorOptionAvailable(menuId, creature)) + return false; return true; } @@ -14453,7 +14493,7 @@ void Player::SendTalentsInfoData(bool pet) BuildPetTalentsInfoData(&data); else BuildPlayerTalentsInfoData(&data); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::BuildEnchantmentsInfoData(WorldPacket* data) @@ -14526,7 +14566,7 @@ void Player::SendEquipmentSetList() ++count; // client have limit but it checked at loading and set } data.put<uint32>(count_pos, count); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset) @@ -14564,7 +14604,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset) WorldPacket data(SMSG_EQUIPMENT_SET_SAVED, 4 + 1); data << uint32(index); data.appendPackGUID(eqslot.Guid); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } eqslot.state = old_state == EQUIPMENT_SET_NEW ? EQUIPMENT_SET_NEW : EQUIPMENT_SET_CHANGED; @@ -15270,7 +15310,7 @@ void Player::ActivateSpec(uint8 spec) if (!HasTalent(46917, GetActiveSpec()) && m_canTitanGrip) SetCanTitanGrip(false); // xinef: remove dual wield if player does not have dual wield spell (shamans) - if (!HasSpell(674) && m_canDualWield) + if (!HasSpell(674) && CanDualWield()) SetCanDualWield(false); AutoUnequipOffhandIfNeed(); @@ -15375,7 +15415,7 @@ void Player::SendDuelCountdown(uint32 counter) { WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); data << uint32(counter); // seconds - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SetIsSpectator(bool on) @@ -15579,7 +15619,7 @@ void Player::SendRefundInfo(Item* item) } data << uint32(0); data << uint32(GetTotalPlayedTime() - item->GetPlayedTime()); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } bool Player::AddItem(uint32 itemId, uint32 count) @@ -15627,7 +15667,7 @@ void Player::RefundItem(Item* item) WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4); data << item->GetGUID(); // Guid data << uint32(10); // Error! - GetSession()->SendPacket(&data); + SendDirectMessage(&data); return; } @@ -15668,7 +15708,7 @@ void Player::RefundItem(Item* item) WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4); data << item->GetGUID(); // Guid data << uint32(10); // Error! - GetSession()->SendPacket(&data); + SendDirectMessage(&data); return; } @@ -15683,7 +15723,7 @@ void Player::RefundItem(Item* item) data << uint32(iece->reqitem[i]); data << uint32(iece->reqitemcount[i]); } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem @@ -15925,108 +15965,6 @@ bool Player::IsInWhisperWhiteList(ObjectGuid guid) return false; } -bool Player::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool /*updateAnimationTier = true*/) -{ - if (!packetOnly && !Unit::SetDisableGravity(disable)) - return false; - - WorldPacket data(disable ? SMSG_MOVE_GRAVITY_DISABLE : SMSG_MOVE_GRAVITY_ENABLE, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_GRAVITY_CHNG, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - SendMessageToSet(&data, false); - return true; -} - -bool Player::SetCanFly(bool apply, bool packetOnly /*= false*/) -{ - sScriptMgr->AnticheatSetCanFlybyServer(this, apply); - - if (!packetOnly && !Unit::SetCanFly(apply)) - return false; - - if (!apply) - SetFallInformation(GameTime::GetGameTime().count(), GetPositionZ()); - - WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_UPDATE_CAN_FLY, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - SendMessageToSet(&data, false); - return true; -} - -bool Player::SetHover(bool apply, bool packetOnly /*= false*/, bool /*updateAnimationTier = true*/) -{ - // moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed - if (!packetOnly /* && !Unit::SetHover(apply)*/) - { - Unit::SetHover(apply); - // return false; - } - - WorldPacket data(apply ? SMSG_MOVE_SET_HOVER : SMSG_MOVE_UNSET_HOVER, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_HOVER, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - SendMessageToSet(&data, false); - return true; -} - -bool Player::SetWaterWalking(bool apply, bool packetOnly /*= false*/) -{ - // moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed - if (!packetOnly /* && !Unit::SetWaterWalking(apply)*/) - { - Unit::SetWaterWalking(apply); - // return false; - } - - WorldPacket data(apply ? SMSG_MOVE_WATER_WALK : SMSG_MOVE_LAND_WALK, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_WATER_WALK, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - SendMessageToSet(&data, false); - return true; -} - -bool Player::SetFeatherFall(bool apply, bool packetOnly /*= false*/) -{ - // Xinef: moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed - if (!packetOnly/* && !Unit::SetFeatherFall(apply)*/) - { - Unit::SetFeatherFall(apply); - //return false; - } - - WorldPacket data(apply ? SMSG_MOVE_FEATHER_FALL : SMSG_MOVE_NORMAL_FALL, 12); - data << GetPackGUID(); - data << uint32(0); //! movement counter - SendDirectMessage(&data); - - data.Initialize(MSG_MOVE_FEATHER_FALL, 64); - data << GetPackGUID(); - BuildMovementPacket(&data); - SendMessageToSet(&data, false); - return true; -} - Guild* Player::GetGuild() const { uint32 guildId = GetGuildId(); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index c8dd9fc7ab..1603a4f687 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.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 @@ -41,6 +41,7 @@ #include "TradeData.h" #include "Unit.h" #include "WorldSession.h" +#include <set> #include <string> #include <vector> @@ -448,8 +449,6 @@ typedef std::list<Item*> ItemDurationList; enum PlayerMovementType { - MOVE_ROOT = 1, - MOVE_UNROOT = 2, MOVE_WATER_WALK = 3, MOVE_LAND_WALK = 4 }; @@ -1129,8 +1128,8 @@ public: void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool onEnterMap); bool CanInteractWithQuestGiver(Object* questGiver); - Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask); - [[nodiscard]] GameObject* GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const; + Creature* GetNPCIfCanInteractWith(ObjectGuid const& guid, uint32 npcflagmask); + [[nodiscard]] GameObject* GetGameObjectIfCanInteractWith(ObjectGuid const& guid, GameobjectTypes type) const; void ToggleAFK(); void ToggleDND(); @@ -1156,6 +1155,7 @@ public: void SetCommentator(bool on) { ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_COMMENTATOR2, on); } [[nodiscard]] bool IsDeveloper() const { return HasPlayerFlag(PLAYER_FLAGS_DEVELOPER); } void SetDeveloper(bool on) { ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER, on); } + void SetBeastMaster(bool on) { if (on) SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); else RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); } [[nodiscard]] bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; } void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; } [[nodiscard]] bool IsGameMaster() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; } @@ -1210,7 +1210,7 @@ public: [[nodiscard]] PetStable const* GetPetStable() const { return m_petStable.get(); } [[nodiscard]] Pet* GetPet() const; - Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration = 0s, uint32 healthPct = 0); + Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration = 0ms, uint32 healthPct = 0); void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false); bool CanPetResurrect(); bool IsExistPet(); @@ -1257,7 +1257,7 @@ public: bool HasWeapon(WeaponAttackType type) const override { return GetWeaponForAttack(type, false); } bool HasWeaponForAttack(WeaponAttackType type) const override { return (Unit::HasWeaponForAttack(type) && GetWeaponForAttack(type, true)); } [[nodiscard]] Item* GetShield(bool useable = false) const; - static uint8 GetAttackBySlot(uint8 slot); // MAX_ATTACK if not weapon slot + static WeaponAttackType GetAttackBySlot(uint8 slot); // MAX_ATTACK if not weapon slot std::vector<Item*>& GetItemUpdateQueue() { return m_itemUpdateQueue; } static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8, pos & 255); } static bool IsInventoryPos(uint8 bag, uint8 slot); @@ -2033,7 +2033,7 @@ public: Corpse* CreateCorpse(); void RemoveCorpse(); void KillPlayer(); - static void OfflineResurrect(ObjectGuid const guid, CharacterDatabaseTransaction trans); + static void OfflineResurrect(ObjectGuid const& guid, CharacterDatabaseTransaction trans); [[nodiscard]] bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; } [[nodiscard]] WorldLocation GetCorpseLocation() const { return _corpseLocation; } uint32 GetResurrectionSpellId(); @@ -2059,8 +2059,6 @@ public: } bool IsMirrorTimerActive(MirrorTimerType type) { return m_MirrorTimer[type] == getMaxTimer(type); } - void SetMovement(PlayerMovementType pType); - bool CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone); void JoinedChannel(Channel* c); @@ -2351,6 +2349,7 @@ public: void SetMover(Unit* target); void SetSeer(WorldObject* target) { m_seer = target; } + WorldObject* GetSeer() const { return m_seer; } void SetViewpoint(WorldObject* target, bool apply); [[nodiscard]] WorldObject* GetViewpoint() const; void StopCastingCharm(Aura* except = nullptr); @@ -2549,7 +2548,9 @@ public: //bool isActiveObject() const { return true; } bool CanSeeSpellClickOn(Creature const* creature) const; [[nodiscard]] bool CanSeeVendor(Creature const* creature) const; - +private: + [[nodiscard]] bool AnyVendorOptionAvailable(uint32 menuId, Creature const* creature) const; +public: [[nodiscard]] uint32 GetChampioningFaction() const { return m_ChampioningFaction; } void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; } Spell* m_spellModTakingSpell; @@ -2563,14 +2564,9 @@ public: bool IsInWhisperWhiteList(ObjectGuid guid); void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); } - bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true) override; - bool SetCanFly(bool apply, bool packetOnly = false) override; - bool SetWaterWalking(bool apply, bool packetOnly = false) override; - bool SetFeatherFall(bool apply, bool packetOnly = false) override; - bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true) override; - [[nodiscard]] bool CanFly() const override { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); } [[nodiscard]] bool CanEnterWater() const override { return true; } + bool IsFreeFlying() const { return HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || HasAuraType(SPELL_AURA_FLY); } // saving void AdditionalSavingAddMask(uint8 mask) { m_additionalSaveTimer = 2000; m_additionalSaveMask |= mask; } @@ -2635,6 +2631,15 @@ public: std::string GetDebugInfo() const override; + bool IsExpectingChangeTransport() const { return _expectingChangeTransport; } + void SetExpectingChangeTransport(bool state) { _expectingChangeTransport = state; } + + uint32 GetPendingFlightChange() const { return _pendingFlightChangeCounter; } + void SetPendingFlightChange(uint32 counter) { _pendingFlightChangeCounter = counter; } + + void SetMapChangeOrderCounter() { _mapChangeOrderCounter = GetSession()->GetOrderCounter(); } + uint32 GetMapChangeOrderCounter() { return _mapChangeOrderCounter; } + /*********************************************************/ /*** SPELL QUEUE SYSTEM ***/ /*********************************************************/ @@ -3015,6 +3020,10 @@ private: PlayerSettingMap m_charSettingsMap; Seconds m_creationTime; + + bool _expectingChangeTransport; + uint32 _pendingFlightChangeCounter; + uint32 _mapChangeOrderCounter; }; void AddItemsSetItem(Player* player, Item* item); diff --git a/src/server/game/Entities/Player/PlayerGossip.cpp b/src/server/game/Entities/Player/PlayerGossip.cpp index 609d9776dd..806a8c9afa 100644 --- a/src/server/game/Entities/Player/PlayerGossip.cpp +++ b/src/server/game/Entities/Player/PlayerGossip.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/Entities/Player/PlayerMisc.cpp b/src/server/game/Entities/Player/PlayerMisc.cpp index 715e20fec5..0d3311a6c5 100644 --- a/src/server/game/Entities/Player/PlayerMisc.cpp +++ b/src/server/game/Entities/Player/PlayerMisc.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 @@ -78,7 +78,7 @@ bool Player::CanSpeak() const void Player::SendAttackSwingNotInRange() { WorldPacket data(SMSG_ATTACKSWING_NOTINRANGE, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid) @@ -128,25 +128,25 @@ void Player::Customize(CharacterCustomizeInfo const* customizeInfo, CharacterDat void Player::SendAttackSwingDeadTarget() { WorldPacket data(SMSG_ATTACKSWING_DEADTARGET, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendAttackSwingCantAttack() { WorldPacket data(SMSG_ATTACKSWING_CANT_ATTACK, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendAttackSwingCancelAttack() { WorldPacket data(SMSG_CANCEL_COMBAT, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendAttackSwingBadFacingAttack() { WorldPacket data(SMSG_ATTACKSWING_BADFACING, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendAutoRepeatCancel(Unit* target) @@ -161,7 +161,7 @@ void Player::SendExplorationExperience(uint32 Area, uint32 Experience) WorldPacket data(SMSG_EXPLORATION_EXPERIENCE, 8); data << uint32(Area); data << uint32(Experience); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendDungeonDifficulty(bool IsInGroup) @@ -171,7 +171,7 @@ void Player::SendDungeonDifficulty(bool IsInGroup) data << (uint32)GetDungeonDifficulty(); data << uint32(val); data << uint32(IsInGroup); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty) @@ -181,14 +181,14 @@ void Player::SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty) data << uint32(forcedDifficulty == -1 ? GetRaidDifficulty() : forcedDifficulty); data << uint32(val); data << uint32(IsInGroup); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendResetFailedNotify(uint32 mapid) { WorldPacket data(SMSG_RESET_FAILED_NOTIFY, 4); data << uint32(mapid); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } /// Reset all solo instances and optionally send a message on success for each @@ -327,7 +327,7 @@ void Player::SendResetInstanceSuccess(uint32 MapId) { WorldPacket data(SMSG_INSTANCE_RESET, 4); data << uint32(MapId); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) @@ -340,7 +340,7 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4); data << uint32(reason); data << uint32(MapId); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } /*********************************************************/ diff --git a/src/server/game/Entities/Player/PlayerQuest.cpp b/src/server/game/Entities/Player/PlayerQuest.cpp index 9f663ff2fa..554622bba6 100644 --- a/src/server/game/Entities/Player/PlayerQuest.cpp +++ b/src/server/game/Entities/Player/PlayerQuest.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 @@ -740,9 +740,9 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, if (log_slot < MAX_QUEST_LOG_SIZE) SetQuestSlot(log_slot, 0); - bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest(); + bool const rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest() && !(quest->IsDaily() || quest->IsWeekly() || quest->IsMonthly()); - // Not give XP in case already completed once repeatable quest + // Repeatable quests (not time-based reset ones) should not give XP on subsequent completions uint32 XP = rewarded ? 0 : CalculateQuestRewardXP(quest); sScriptMgr->OnPlayerQuestComputeXP(this, quest, XP); @@ -990,7 +990,7 @@ bool Player::SatisfyQuestLog(bool msg) if (msg) { WorldPacket data(SMSG_QUESTLOG_FULL, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTLOG_FULL"); } return false; @@ -2349,7 +2349,7 @@ void Player::SendQuestComplete(uint32 quest_id) { WorldPacket data(SMSG_QUESTUPDATE_COMPLETE, 4); data << uint32(quest_id); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = {}", quest_id); } } @@ -2376,7 +2376,7 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP) data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest))); data << uint32(quest->GetBonusTalents()); // bonus talents data << uint32(quest->GetRewArenaPoints()); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendQuestFailed(uint32 questId, InventoryResult reason) @@ -2386,7 +2386,7 @@ void Player::SendQuestFailed(uint32 questId, InventoryResult reason) WorldPacket data(SMSG_QUESTGIVER_QUEST_FAILED, 4 + 4); data << uint32(questId); data << uint32(reason); // failed reason (valid reasons: 4, 16, 50, 17, 74, other values show default message) - GetSession()->SendPacket(&data); + SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); } } @@ -2397,7 +2397,7 @@ void Player::SendQuestTimerFailed(uint32 quest_id) { WorldPacket data(SMSG_QUESTUPDATE_FAILEDTIMER, 4); data << uint32(quest_id); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER"); } } @@ -2406,7 +2406,7 @@ void Player::SendCanTakeQuestResponse(uint32 msg) const { WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4); data << uint32(msg); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_INVALID"); } @@ -2426,7 +2426,7 @@ void Player::SendQuestConfirmAccept(const Quest* quest, Player* pReceiver) data << uint32(quest->GetQuestId()); data << quest->GetTitle(); data << GetGUID(); - pReceiver->GetSession()->SendPacket(&data); + pReceiver->SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT"); } @@ -2439,7 +2439,7 @@ void Player::SendPushToPartyResponse(Player const* player, uint8 msg) const WorldPacket data(MSG_QUEST_PUSH_RESULT, (8 + 1)); data << player->GetGUID(); data << uint8(msg); // valid values: 0-8 - GetSession()->SendPacket(&data); + SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent MSG_QUEST_PUSH_RESULT"); } } @@ -2450,7 +2450,7 @@ void Player::SendQuestUpdateAddItem(Quest const* /*quest*/, uint32 /*item_idx*/, LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM"); //data << quest->RequiredItemId[item_idx]; //data << count; - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count) @@ -2469,7 +2469,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, data << uint32(old_count + add_count); data << uint32(quest->RequiredNpcOrGoCount[ creatureOrGO_idx ]); data << guid; - GetSession()->SendPacket(&data); + SendDirectMessage(&data); uint16 log_slot = FindQuestSlot(quest->GetQuestId()); if (log_slot < MAX_QUEST_LOG_SIZE) @@ -2485,7 +2485,7 @@ void Player::SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint data << uint32(quest->GetQuestId()); data << uint32(old_count + add_count); data << uint32(quest->GetPlayersSlain()); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); uint16 log_slot = FindQuestSlot(quest->GetQuestId()); if (log_slot < MAX_QUEST_LOG_SIZE) diff --git a/src/server/game/Entities/Player/PlayerSettings.cpp b/src/server/game/Entities/Player/PlayerSettings.cpp index 65e84d52f6..f1eb86367c 100644 --- a/src/server/game/Entities/Player/PlayerSettings.cpp +++ b/src/server/game/Entities/Player/PlayerSettings.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/Entities/Player/PlayerSettings.h b/src/server/game/Entities/Player/PlayerSettings.h index 221303ee33..496685e230 100644 --- a/src/server/game/Entities/Player/PlayerSettings.h +++ b/src/server/game/Entities/Player/PlayerSettings.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/Entities/Player/PlayerStorage.cpp b/src/server/game/Entities/Player/PlayerStorage.cpp index d45533ad63..bad5c36824 100644 --- a/src/server/game/Entities/Player/PlayerStorage.cpp +++ b/src/server/game/Entities/Player/PlayerStorage.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 @@ -51,6 +51,7 @@ #include "QuestDef.h" #include "ReputationMgr.h" #include "ScriptMgr.h" +#include "ScriptObjectFwd.h" #include "SocialMgr.h" #include "Spell.h" #include "SpellAuraEffects.h" @@ -539,7 +540,7 @@ Item* Player::GetShield(bool useable) const return item; } -uint8 Player::GetAttackBySlot(uint8 slot) +WeaponAttackType Player::GetAttackBySlot(uint8 slot) { switch (slot) { @@ -1847,8 +1848,13 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool return EQUIP_ERR_NOT_DURING_ARENA_MATCH; } - if (IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer != 0) - return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err + if (IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC)) + { + uint32 cooldownSpell = IsClass(CLASS_ROGUE, CLASS_CONTEXT_WEAPON_SWAP) ? 6123 : 6119; + uint32 startRecoveryTime = sSpellMgr->GetSpellInfo(cooldownSpell)->StartRecoveryTime; + if (m_weaponChangeTimer != 0 && m_weaponChangeTimer != startRecoveryTime) + return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err + } if (IsNonMeleeSpellCast(false)) return EQUIP_ERR_CANT_DO_RIGHT_NOW; @@ -2757,7 +2763,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) WorldPacket data; BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_INCLUDE_GCD, cooldownSpell, 0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } } } @@ -4051,7 +4057,7 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint break; } } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param) @@ -4063,7 +4069,7 @@ void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 if (param > 0) data << uint32(param); data << uint8(msg); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::SendSellError(SellResult msg, Creature* creature, ObjectGuid guid, uint32 param) @@ -4075,7 +4081,7 @@ void Player::SendSellError(SellResult msg, Creature* creature, ObjectGuid guid, if (param > 0) data << uint32(param); data << uint8(msg); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::TradeCancel(bool sendback, TradeStatus status /*= TRADE_STATUS_TRADE_CANCELED*/) @@ -4770,7 +4776,7 @@ void Player::SendNewItem(Item* item, uint32 count, bool received, bool created, if (broadcast && GetGroup()) GetGroup()->BroadcastPacket(&data, true); else - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } /*********************************************************/ @@ -6520,7 +6526,7 @@ void Player::BindToInstance() WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4); data << uint32(0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); sInstanceSaveMgr->PlayerBindToInstance(this->GetGUID(), mapSave, true, this); } @@ -6555,7 +6561,7 @@ void Player::SendRaidInfo() } } data.put<uint32>(p_counter, counter); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } /* @@ -6582,7 +6588,7 @@ void Player::SendSavedInstances() //Send opcode 811. true or false means, whether you have current raid/heroic instances data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP); data << uint32(hasBeenSaved); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); if (!hasBeenSaved) return; @@ -6596,7 +6602,7 @@ void Player::SendSavedInstances() { data.Initialize(SMSG_UPDATE_LAST_INSTANCE); data << uint32(itr->second.save->GetMapId()); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } } } @@ -6833,7 +6839,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map || missingPlayerItems.size() || missingPlayerQuests.size() || missingPlayerAchievements.size() || missingLeaderItems.size() || missingLeaderQuests.size() || missingLeaderAchievements.size()) { - if (!sScriptMgr->OnPlayerNotAvoidSatisfy(partyLeader, ar, target_map, report)) + if (!sScriptMgr->OnPlayerNotAvoidSatisfy(this, ar, target_map, report)) return true; if (report) diff --git a/src/server/game/Entities/Player/PlayerTaxi.cpp b/src/server/game/Entities/Player/PlayerTaxi.cpp index 9c56f58243..29afc666e7 100644 --- a/src/server/game/Entities/Player/PlayerTaxi.cpp +++ b/src/server/game/Entities/Player/PlayerTaxi.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/Entities/Player/PlayerTaxi.h b/src/server/game/Entities/Player/PlayerTaxi.h index 3b064ba7af..e8041cb090 100644 --- a/src/server/game/Entities/Player/PlayerTaxi.h +++ b/src/server/game/Entities/Player/PlayerTaxi.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/Entities/Player/PlayerUpdates.cpp b/src/server/game/Entities/Player/PlayerUpdates.cpp index d3798a083f..2913f66238 100644 --- a/src/server/game/Entities/Player/PlayerUpdates.cpp +++ b/src/server/game/Entities/Player/PlayerUpdates.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 @@ -1401,7 +1401,7 @@ void Player::UpdateHomebindTime(uint32 time) WorldPacket data(SMSG_RAID_GROUP_ONLY, 4 + 4); data << uint32(0); data << uint32(0); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } // instance is valid, reset homebind timer m_HomebindTimer = 0; @@ -1424,7 +1424,7 @@ void Player::UpdateHomebindTime(uint32 time) WorldPacket data(SMSG_RAID_GROUP_ONLY, 4 + 4); data << uint32(m_HomebindTimer); data << uint32(1); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); LOG_DEBUG( "maps", "PLAYER: Player '{}' ({}) will be teleported to homebind in 60 " @@ -1439,6 +1439,9 @@ void Player::UpdatePvPState() if (pvpInfo.IsHostile) // in hostile area { + if (IsInFlight()) // on taxi + return; + if (!IsPvP() || pvpInfo.EndTimer != 0) UpdatePvP(true, true); } @@ -1771,7 +1774,7 @@ void Player::UpdateTriggerVisibility() WorldPacket packet; udata.BuildPacket(packet); - GetSession()->SendPacket(&packet); + SendDirectMessage(&packet); } void Player::UpdateForQuestWorldObjects() @@ -1824,7 +1827,7 @@ void Player::UpdateForQuestWorldObjects() WorldPacket packet; udata.BuildPacket(packet); - GetSession()->SendPacket(&packet); + SendDirectMessage(&packet); } void Player::UpdateTitansGrip() @@ -1968,10 +1971,7 @@ void Player::UpdateCharmedAI() Unit* target = GetVictim(); if (target) - { SetInFront(target); - SendMovementFlagUpdate(true); - } if (HasUnitState(UNIT_STATE_CASTING)) return; diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index d5b5fdf59a..ed59470ddd 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.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 @@ -37,7 +37,7 @@ uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag) const return counter; } -bool PlayerSocial::AddToSocialList(ObjectGuid friendGuid, SocialFlag flag) +bool PlayerSocial::AddToSocialList(ObjectGuid const& friendGuid, SocialFlag flag) { // check client limits if (GetNumberOfSocialsWithFlag(flag) >= (((flag & SOCIAL_FLAG_FRIEND) != 0) ? SOCIALMGR_FRIEND_LIMIT : SOCIALMGR_IGNORE_LIMIT)) @@ -71,7 +71,7 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friendGuid, SocialFlag flag) return true; } -void PlayerSocial::RemoveFromSocialList(ObjectGuid friendGuid, SocialFlag flag) +void PlayerSocial::RemoveFromSocialList(ObjectGuid const& friendGuid, SocialFlag flag) { auto itr = m_playerSocialMap.find(friendGuid); if (itr == m_playerSocialMap.end()) // not exist @@ -102,7 +102,7 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friendGuid, SocialFlag flag) } } -void PlayerSocial::SetFriendNote(ObjectGuid friendGuid, std::string note) +void PlayerSocial::SetFriendNote(ObjectGuid const& friendGuid, std::string note) { auto itr = m_playerSocialMap.find(friendGuid); if (itr == m_playerSocialMap.end()) // not exist @@ -172,11 +172,11 @@ void PlayerSocial::SendSocialList(Player* player, uint32 flags) } data.put<uint32>(countPos, totalCount); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent SMSG_CONTACT_LIST"); } -bool PlayerSocial::_checkContact(ObjectGuid guid, SocialFlag flags) const +bool PlayerSocial::_checkContact(ObjectGuid const& guid, SocialFlag flags) const { auto const& itr = m_playerSocialMap.find(guid); if (itr != m_playerSocialMap.end()) @@ -185,12 +185,12 @@ bool PlayerSocial::_checkContact(ObjectGuid guid, SocialFlag flags) const return false; } -bool PlayerSocial::HasFriend(ObjectGuid friend_guid) const +bool PlayerSocial::HasFriend(ObjectGuid const& friend_guid) const { return _checkContact(friend_guid, SOCIAL_FLAG_FRIEND); } -bool PlayerSocial::HasIgnore(ObjectGuid ignore_guid) const +bool PlayerSocial::HasIgnore(ObjectGuid const& ignore_guid) const { return _checkContact(ignore_guid, SOCIAL_FLAG_IGNORED); } @@ -209,7 +209,7 @@ SocialMgr* SocialMgr::instance() return &instance; } -void SocialMgr::GetFriendInfo(Player* player, ObjectGuid friendGUID, FriendInfo& friendInfo) +void SocialMgr::GetFriendInfo(Player* player, ObjectGuid const& friendGUID, FriendInfo& friendInfo) { if (!player) return; @@ -247,14 +247,14 @@ void SocialMgr::GetFriendInfo(Player* player, ObjectGuid friendGUID, FriendInfo& } } -void SocialMgr::MakeFriendStatusPacket(FriendsResult result, ObjectGuid guid, WorldPacket* data) +void SocialMgr::MakeFriendStatusPacket(FriendsResult result, ObjectGuid const& guid, WorldPacket* data) { data->Initialize(SMSG_FRIEND_STATUS, 9); *data << uint8(result); *data << guid; } -void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGuid friendGuid, bool broadcast) +void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGuid const& friendGuid, bool broadcast) { FriendInfo fi; GetFriendInfo(player, friendGuid, fi); @@ -288,7 +288,7 @@ void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGui if (broadcast) BroadcastToFriendListers(player, &data); else - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) @@ -311,12 +311,12 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && (!AccountMgr::IsPlayerAccount(pFriend->GetSession()->GetSecurity()) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend)) - pFriend->GetSession()->SendPacket(packet); + pFriend->SendDirectMessage(packet); } } } -PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, ObjectGuid guid) +PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, ObjectGuid const& guid) { PlayerSocial* social = &m_socialMap[guid]; social->SetPlayerGUID(guid); diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h index a35187b6fb..ff1208a2e9 100644 --- a/src/server/game/Entities/Player/SocialMgr.h +++ b/src/server/game/Entities/Player/SocialMgr.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 @@ -104,19 +104,19 @@ class PlayerSocial public: PlayerSocial(); // adding/removing - bool AddToSocialList(ObjectGuid friend_guid, SocialFlag flag); - void RemoveFromSocialList(ObjectGuid friend_guid, SocialFlag flag); - void SetFriendNote(ObjectGuid friendGuid, std::string note); + bool AddToSocialList(ObjectGuid const& friend_guid, SocialFlag flag); + void RemoveFromSocialList(ObjectGuid const& friend_guid, SocialFlag flag); + void SetFriendNote(ObjectGuid const& friendGuid, std::string note); // Packet send's void SendSocialList(Player* player, uint32 flags); // Misc - bool HasFriend(ObjectGuid friend_guid) const; - bool HasIgnore(ObjectGuid ignore_guid) const; - ObjectGuid GetPlayerGUID() const { return m_playerGUID; } - void SetPlayerGUID(ObjectGuid guid) { m_playerGUID = guid; } + bool HasFriend(ObjectGuid const& friend_guid) const; + bool HasIgnore(ObjectGuid const& ignore_guid) const; + ObjectGuid const& GetPlayerGUID() const { return m_playerGUID; } + void SetPlayerGUID(ObjectGuid const& guid) { m_playerGUID = guid; } uint32 GetNumberOfSocialsWithFlag(SocialFlag flag) const; private: - bool _checkContact(ObjectGuid guid, SocialFlag flags) const; + bool _checkContact(ObjectGuid const& guid, SocialFlag flags) const; typedef std::map<ObjectGuid, FriendInfo> PlayerSocialMap; PlayerSocialMap m_playerSocialMap; ObjectGuid m_playerGUID; @@ -131,14 +131,14 @@ class SocialMgr public: static SocialMgr* instance(); // Misc - void RemovePlayerSocial(ObjectGuid guid) { m_socialMap.erase(guid); } - static void GetFriendInfo(Player* player, ObjectGuid friendGUID, FriendInfo& friendInfo); + void RemovePlayerSocial(ObjectGuid const& guid) { m_socialMap.erase(guid); } + static void GetFriendInfo(Player* player, ObjectGuid const& friendGUID, FriendInfo& friendInfo); // Packet management - void MakeFriendStatusPacket(FriendsResult result, ObjectGuid friend_guid, WorldPacket* data); - void SendFriendStatus(Player* player, FriendsResult result, ObjectGuid friend_guid, bool broadcast); + void MakeFriendStatusPacket(FriendsResult result, ObjectGuid const& friend_guid, WorldPacket* data); + void SendFriendStatus(Player* player, FriendsResult result, ObjectGuid const& friend_guid, bool broadcast); void BroadcastToFriendListers(Player* player, WorldPacket* packet); // Loading - PlayerSocial* LoadFromDB(PreparedQueryResult result, ObjectGuid guid); + PlayerSocial* LoadFromDB(PreparedQueryResult result, ObjectGuid const& guid); private: typedef std::map<ObjectGuid, PlayerSocial> SocialMap; SocialMap m_socialMap; diff --git a/src/server/game/Entities/Player/TradeData.cpp b/src/server/game/Entities/Player/TradeData.cpp index 363e338e6f..7f0fca7f19 100644 --- a/src/server/game/Entities/Player/TradeData.cpp +++ b/src/server/game/Entities/Player/TradeData.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/Entities/Player/TradeData.h b/src/server/game/Entities/Player/TradeData.h index 997726140f..5eb57e5fbc 100644 --- a/src/server/game/Entities/Player/TradeData.h +++ b/src/server/game/Entities/Player/TradeData.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/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index db4fae0e62..f0e71d231f 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.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 @@ -119,11 +119,11 @@ void Totem::InitSummon() } } -void Totem::UnSummon(uint32 msTime) +void Totem::UnSummon(Milliseconds msTime) { - if (msTime) + if (msTime > 0ms) { - m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(msTime)); + m_Events.AddEventAtOffset(new ForcedUnsummonDelayEvent(*this), msTime); return; } diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h index 5265435d53..3149e63984 100644 --- a/src/server/game/Entities/Totem/Totem.h +++ b/src/server/game/Entities/Totem/Totem.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 @@ -55,7 +55,7 @@ public: void Update(uint32 time) override; void InitStats(uint32 duration) override; void InitSummon() override; - void UnSummon(uint32 msTime = 0) override; + void UnSummon(Milliseconds msTime = 0ms) override; uint32 GetSpell(uint8 slot = 0) const { return m_spells[slot]; } uint32 GetTotemDuration() const { return m_duration; } void SetTotemDuration(uint32 duration) { m_duration = duration; } diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index ee87af41d5..cb19879200 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.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/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index 9b50775afb..8287699df1 100644 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.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/Entities/Unit/CharmInfo.cpp b/src/server/game/Entities/Unit/CharmInfo.cpp index 6a7cde11aa..da08245c4a 100644 --- a/src/server/game/Entities/Unit/CharmInfo.cpp +++ b/src/server/game/Entities/Unit/CharmInfo.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/Entities/Unit/CharmInfo.h b/src/server/game/Entities/Unit/CharmInfo.h index 1b22d5fac2..10b86eb265 100644 --- a/src/server/game/Entities/Unit/CharmInfo.h +++ b/src/server/game/Entities/Unit/CharmInfo.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/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index d9dce3c37d..9009bc7d73 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.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/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7963773799..31da399db5 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.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,6 +50,7 @@ #include "PassiveAI.h" #include "Pet.h" #include "PetAI.h" +#include "PetPackets.h" #include "Player.h" #include "ReputationMgr.h" #include "ScriptMgr.h" @@ -242,9 +243,7 @@ Unit::Unit() : WorldObject(), m_modAttackSpeedPct[OFF_ATTACK] = 1.0f; m_modAttackSpeedPct[RANGED_ATTACK] = 1.0f; - m_canDualWield = false; - - m_rootTimes = 0; + _dualWieldMode = DualWieldMode::AUTO; m_state = 0; m_deathState = DeathState::Alive; @@ -868,6 +867,9 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras) if (spellProto) { + if (attacker && damagetype != DOT && spellProto->DmgClass == SPELL_DAMAGE_CLASS_MELEE && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_HOLY)) + attacker->DealDamageShieldDamage(victim); + if (!spellProto->HasAttribute(SPELL_ATTR4_REACTIVE_DAMAGE_PROC)) victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TAKE_DAMAGE, spellProto->Id); } @@ -1085,12 +1087,10 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD))) victim->ToCreature()->UpdateLeashExtensionTime(); - if (attacker) + if (attacker && attacker != victim) { if (spellProto && victim->CanHaveThreatList() && !victim->HasUnitState(UNIT_STATE_EVADE) && !victim->IsInCombatWith(attacker)) - { victim->CombatStart(attacker, !(spellProto->AttributesEx3 & SPELL_ATTR3_SUPPRESS_TARGET_PROCS)); - } victim->AddThreat(attacker, float(damage), damageSchoolMask, spellProto); } @@ -1864,7 +1864,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) auto canTakeMeleeDamage = [&]() { - return victim->IsAlive() && !victim->HasUnitState(UNIT_STATE_IN_FLIGHT) && (!victim->IsCreature() || !victim->ToCreature()->IsEvadingAttacks()); + return victim->IsAlive() && !victim->IsInFlight() && (!victim->IsCreature() || !victim->ToCreature()->IsEvadingAttacks()); }; if (!canTakeMeleeDamage()) @@ -1956,10 +1956,11 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) Probability = 0.65f * victim->GetLevel() + 0.5f; uint32 VictimDefense = victim->GetDefenseSkillValue(); + uint32 VictimAuraDefense = -victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE) * 25; uint32 AttackerMeleeSkill = GetUnitMeleeSkill(); // xinef: fix daze mechanics - Probability -= ((float)VictimDefense - AttackerMeleeSkill) * 0.1428f; + Probability -= ((float)VictimDefense + (float)VictimAuraDefense - AttackerMeleeSkill) * 0.1428f; if (Probability > 40.0f) Probability = 40.0f; @@ -1975,57 +1976,60 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) // Do effect if any damage done to target if (damageInfo->damages[0].damage + damageInfo->damages[1].damage) + DealDamageShieldDamage(victim); +} + +void Unit::DealDamageShieldDamage(Unit* victim) +{ + // We're going to call functions which can modify content of the list during iteration over it's elements + // Let's copy the list so we can prevent iterator invalidation + AuraEffectList vDamageShieldsCopy(victim->GetAuraEffectsByType(SPELL_AURA_DAMAGE_SHIELD)); + for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr) { - // We're going to call functions which can modify content of the list during iteration over it's elements - // Let's copy the list so we can prevent iterator invalidation - AuraEffectList vDamageShieldsCopy(victim->GetAuraEffectsByType(SPELL_AURA_DAMAGE_SHIELD)); - for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr) + SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo(); + // Damage shield can be resisted... + if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto, false)) { - SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo(); - // Damage shield can be resisted... - if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto, false)) - { - victim->SendSpellMiss(this, i_spellProto->Id, missInfo); - continue; - } + victim->SendSpellMiss(this, i_spellProto->Id, missInfo); + continue; + } - // ...or immuned - if (IsImmunedToDamageOrSchool(i_spellProto)) - { - victim->SendSpellDamageImmune(this, i_spellProto->Id); - continue; - } + // ...or immuned + if (IsImmunedToDamageOrSchool(i_spellProto)) + { + victim->SendSpellDamageImmune(this, i_spellProto->Id); + continue; + } - uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation + uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation - if (Unit* caster = (*dmgShieldItr)->GetCaster()) - { - damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE, (*dmgShieldItr)->GetEffIndex()); - damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE); - } + if (Unit* caster = (*dmgShieldItr)->GetCaster()) + { + damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE, (*dmgShieldItr)->GetEffIndex()); + damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE); + } - uint32 absorb = 0; + uint32 absorb = 0; - DamageInfo dmgInfo(victim, this, damage, i_spellProto, i_spellProto->GetSchoolMask(), SPELL_DIRECT_DAMAGE); - Unit::CalcAbsorbResist(dmgInfo); - absorb = dmgInfo.GetAbsorb(); - damage = dmgInfo.GetDamage(); + DamageInfo dmgInfo(victim, this, damage, i_spellProto, i_spellProto->GetSchoolMask(), SPELL_DIRECT_DAMAGE); + Unit::CalcAbsorbResist(dmgInfo); + absorb = dmgInfo.GetAbsorb(); + damage = dmgInfo.GetDamage(); - Unit::DealDamageMods(this, damage, &absorb); + Unit::DealDamageMods(this, damage, &absorb); - /// @todo: Move this to a packet handler - WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8 + 8 + 4 + 4 + 4 + 4)); - data << victim->GetGUID(); - data << GetGUID(); - data << uint32(i_spellProto->Id); - data << uint32(damage); // Damage - int32 overkill = int32(damage) - int32(GetHealth()); - data << uint32(overkill > 0 ? overkill : 0); // Overkill - data << uint32(i_spellProto->GetSchoolMask()); - victim->SendMessageToSet(&data, true); + /// @todo: Move this to a packet handler + WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8 + 8 + 4 + 4 + 4 + 4)); + data << victim->GetGUID(); + data << GetGUID(); + data << uint32(i_spellProto->Id); + data << uint32(damage); // Damage + int32 overkill = int32(damage) - int32(GetHealth()); + data << uint32(overkill > 0 ? overkill : 0); // Overkill + data << uint32(i_spellProto->GetSchoolMask()); + victim->SendMessageToSet(&data, true); - Unit::DealDamage(victim, this, damage, 0, SPELL_DIRECT_DAMAGE, i_spellProto->GetSchoolMask(), i_spellProto, true); - } + Unit::DealDamage(victim, this, damage, 0, SPELL_DIRECT_DAMAGE, i_spellProto->GetSchoolMask(), i_spellProto, true); } } @@ -4332,10 +4336,10 @@ void Unit::ProcessTerrainStatusUpdate() LiquidData const& liquidData = GetLiquidData(); - // remove appropriate auras if we are swimming/not swimming respectively - if (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) + // remove appropriate auras if we are swimming/not swimming respectively - exact mirror of client logic + if (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING && (liquidData.Level - GetPositionZ()) > GetCollisionHeight() * 0.75f) // Shallow water at ~75% of collision height) RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER); - else if (!isSwimming()) + else RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); // liquid aura handling @@ -8176,7 +8180,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID()) return false; - WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot())); + WeaponAttackType attType = player->GetAttackBySlot(castItem->GetSlot()); if ((attType != BASE_ATTACK && attType != OFF_ATTACK) || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)) @@ -8367,7 +8371,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (!IsPlayer() || !victim || !victim->IsAlive() || !castItem || !castItem->IsEquipped()) return false; - WeaponAttackType attType = WeaponAttackType(Player::GetAttackBySlot(castItem->GetSlot())); + WeaponAttackType attType = Player::GetAttackBySlot(castItem->GetSlot()); if ((attType != BASE_ATTACK && attType != OFF_ATTACK) || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)) @@ -9285,28 +9289,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg { switch (auraSpellInfo->Id) { - // Soul Preserver - case 60510: - { - switch (getClass()) - { - case CLASS_DRUID: - trigger_spell_id = 60512; - break; - case CLASS_PALADIN: - trigger_spell_id = 60513; - break; - case CLASS_PRIEST: - trigger_spell_id = 60514; - break; - case CLASS_SHAMAN: - trigger_spell_id = 60515; - break; - } - - target = this; - break; - } case 37657: // Lightning Capacitor case 54841: // Thunder Capacitor case 67712: // Item - Coliseum 25 Normal Caster Trinket @@ -10982,7 +10964,11 @@ void Unit::SetCharm(Unit* charm, bool apply) charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); } else + { charm->m_ControlledByPlayer = false; + if (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED)) + charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); + } // PvP, FFAPvP charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1)); @@ -11091,7 +11077,7 @@ int32 Unit::DealHeal(Unit* healer, Unit* victim, uint32 addhealth) return gain; } -bool RedirectSpellEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) +bool RedirectSpellEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { if (Unit* auraOwner = ObjectAccessor::GetUnit(_self, _auraOwnerGUID)) { @@ -13581,7 +13567,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry) SendMessageToSet(&data, true); data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); // mounts can also have accessories GetVehicleKit()->InstallAllAccessories(false); @@ -13607,9 +13593,10 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry) WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4); data << GetPackGUID(); - data << uint32(GameTime::GetGameTime().count()); // Packet counter + data << player->GetSession()->GetOrderCounter(); // movement counter data << player->GetCollisionHeight(); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); + player->GetSession()->IncrementOrderCounter(); } RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT); @@ -13623,13 +13610,14 @@ void Unit::Dismount() SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); RemoveUnitFlag(UNIT_FLAG_MOUNT); - if (Player* thisPlayer = ToPlayer()) + if (Player* player = ToPlayer()) { WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4); data << GetPackGUID(); - data << uint32(GameTime::GetGameTime().count()); // Packet counter - data << thisPlayer->GetCollisionHeight(); - thisPlayer->GetSession()->SendPacket(&data); + data << player->GetSession()->GetOrderCounter(); // movement counter + data << player->GetCollisionHeight(); + player->SendDirectMessage(&data); + player->GetSession()->IncrementOrderCounter(); } WorldPacket data(SMSG_DISMOUNT, 8); @@ -14540,114 +14528,55 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) propagateSpeedChange(); - WorldPacket data; - if (!forced) + SpeedOpcodePair const& speedOpcodes = SetSpeed2Opc_table[mtype]; + + if (forced && IsClientControlled()) { - switch (mtype) - { - case MOVE_WALK: - data.Initialize(MSG_MOVE_SET_WALK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - case MOVE_RUN: - data.Initialize(MSG_MOVE_SET_RUN_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - case MOVE_RUN_BACK: - data.Initialize(MSG_MOVE_SET_RUN_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - case MOVE_SWIM: - data.Initialize(MSG_MOVE_SET_SWIM_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - case MOVE_SWIM_BACK: - data.Initialize(MSG_MOVE_SET_SWIM_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - case MOVE_TURN_RATE: - data.Initialize(MSG_MOVE_SET_TURN_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - case MOVE_FLIGHT: - data.Initialize(MSG_MOVE_SET_FLIGHT_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - case MOVE_FLIGHT_BACK: - data.Initialize(MSG_MOVE_SET_FLIGHT_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - case MOVE_PITCH_RATE: - data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); - break; - default: - LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type ({}), data not sent to client.", mtype); - return; - } + Player* player = const_cast<Player*>(GetClientControlling()); + uint32 const counter = player->GetSession()->GetOrderCounter(); + // register forced speed changes for WorldSession::HandleForceSpeedChangeAck + // and do it only for real sent packets and use run for run/mounted as client expected + ++player->m_forced_speed_changes[mtype]; + + WorldPacket data(speedOpcodes[static_cast<size_t>(SpeedOpcodeIndex::PC)], 18); + data << GetPackGUID(); + data << counter; + if (mtype == MOVE_RUN) + data << uint8(0); // new 2.1.0 + + data << GetSpeed(mtype); + player->GetSession()->SendPacket(&data); + player->GetSession()->IncrementOrderCounter(); + } + else if (forced) + { + WorldPacket data(speedOpcodes[static_cast<size_t>(SpeedOpcodeIndex::NPC)], 12); data << GetPackGUID(); - BuildMovementPacket(&data); data << float(GetSpeed(mtype)); SendMessageToSet(&data, true); } - else + + if (IsPlayer()) { - if (IsPlayer()) + // Xinef: update speed of pet also + if (!IsInCombat()) { - // register forced speed changes for WorldSession::HandleForceSpeedChangeAck - // and do it only for real sent packets and use run for run/mounted as client expected - ++ToPlayer()->m_forced_speed_changes[mtype]; + Unit* pet = ToPlayer()->GetPet(); + if (!pet) + pet = GetCharm(); - // Xinef: update speed of pet also - if (!IsInCombat()) - { - Unit* pet = ToPlayer()->GetPet(); - if (!pet) - pet = GetCharm(); + // xinef: do not affect vehicles and possesed pets + if (pet && (pet->HasUnitFlag(UNIT_FLAG_POSSESSED) || pet->IsVehicle())) + pet = nullptr; - // xinef: do not affect vehicles and possesed pets - if (pet && (pet->HasUnitFlag(UNIT_FLAG_POSSESSED) || pet->IsVehicle())) - pet = nullptr; + if (pet && pet->IsCreature() && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE) + pet->UpdateSpeed(mtype, forced); - if (pet && pet->IsCreature() && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE) - pet->UpdateSpeed(mtype, forced); - if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID())) - critter->UpdateSpeed(mtype, forced); - } - ToPlayer()->SetCanTeleport(true); - } - - switch (mtype) - { - case MOVE_WALK: - data.Initialize(SMSG_FORCE_WALK_SPEED_CHANGE, 16); - break; - case MOVE_RUN: - data.Initialize(SMSG_FORCE_RUN_SPEED_CHANGE, 17); - break; - case MOVE_RUN_BACK: - data.Initialize(SMSG_FORCE_RUN_BACK_SPEED_CHANGE, 16); - break; - case MOVE_SWIM: - data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, 16); - break; - case MOVE_SWIM_BACK: - data.Initialize(SMSG_FORCE_SWIM_BACK_SPEED_CHANGE, 16); - break; - case MOVE_TURN_RATE: - data.Initialize(SMSG_FORCE_TURN_RATE_CHANGE, 16); - break; - case MOVE_FLIGHT: - data.Initialize(SMSG_FORCE_FLIGHT_SPEED_CHANGE, 16); - break; - case MOVE_FLIGHT_BACK: - data.Initialize(SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE, 16); - break; - case MOVE_PITCH_RATE: - data.Initialize(SMSG_FORCE_PITCH_RATE_CHANGE, 16); - break; - default: - LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type ({}), data not sent to client.", mtype); - return; + if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID())) + critter->UpdateSpeed(mtype, forced); } - data << GetPackGUID(); - data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39 - if (mtype == MOVE_RUN) - data << uint8(0); // new 2.1.0 - data << float(GetSpeed(mtype)); - SendMessageToSet(&data, true); + ToPlayer()->SetCanTeleport(true); } } @@ -16688,7 +16617,7 @@ Player* Unit::GetSpellModOwner() const } ///----------Pet responses methods----------------- -void Unit::SendPetActionFeedback(uint8 msg) +void Unit::SendPetActionFeedback(uint8 msg) const { Unit* owner = GetOwner(); if (!owner || !owner->IsPlayer()) @@ -16696,22 +16625,21 @@ void Unit::SendPetActionFeedback(uint8 msg) WorldPacket data(SMSG_PET_ACTION_FEEDBACK, 1); data << uint8(msg); - owner->ToPlayer()->GetSession()->SendPacket(&data); + owner->ToPlayer()->SendDirectMessage(&data); } -void Unit::SendPetTalk(uint32 pettalk) +void Unit::SendPetActionSound(PetAction action) const { - Unit* owner = GetOwner(); - if (!owner || !owner->IsPlayer()) - return; + SendMessageToSet(WorldPackets::Pet::PetActionSound(GetGUID(), static_cast<int32>(action)).Write(), false); +} - WorldPacket data(SMSG_PET_ACTION_SOUND, 8 + 4); - data << GetGUID(); - data << uint32(pettalk); - owner->ToPlayer()->GetSession()->SendPacket(&data); +void Unit::SendPetDismissSound() const +{ + if (CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId())) + SendMessageToSet(WorldPackets::Pet::PetDismissSound(static_cast<int32>(displayInfo->ModelId), GetPosition()).Write(), false); } -void Unit::SendPetAIReaction(ObjectGuid guid) +void Unit::SendPetAIReaction(ObjectGuid guid) const { Unit* owner = GetOwner(); if (!owner || !owner->IsPlayer()) @@ -16720,7 +16648,7 @@ void Unit::SendPetAIReaction(ObjectGuid guid) WorldPacket data(SMSG_AI_REACTION, 8 + 4); data << guid; data << uint32(AI_REACTION_HOSTILE); - owner->ToPlayer()->GetSession()->SendPacket(&data); + owner->ToPlayer()->SendDirectMessage(&data); } ///----------End of Pet responses methods---------- @@ -16786,6 +16714,13 @@ void Unit::StopMovingOnCurrentPos() void Unit::SendMovementFlagUpdate(bool self /* = false */) { + if (IsRooted()) + { + // each case where this occurs has to be examined and reported and dealt with. + LOG_ERROR("Unit", "Attempted sending heartbeat with root flag for guid {}", GetGUID().ToString()); + return; + } + WorldPacket data; BuildHeartBeatMsg(&data); SendMessageToSet(&data, self); @@ -16806,6 +16741,15 @@ bool Unit::IsStandState() const return !IsSitState() && s != UNIT_STAND_STATE_SLEEP && s != UNIT_STAND_STATE_KNEEL; } +bool Unit::IsStandUpOnMovementState() const +{ + uint8 s = getStandState(); + return + s == UNIT_STAND_STATE_SIT_CHAIR || s == UNIT_STAND_STATE_SIT_LOW_CHAIR || + s == UNIT_STAND_STATE_SIT_MEDIUM_CHAIR || s == UNIT_STAND_STATE_SIT_HIGH_CHAIR || + s == UNIT_STAND_STATE_SIT || s == UNIT_STAND_STATE_SLEEP; +} + void Unit::SetStandState(uint8 state) { SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_STAND_STATE, state); @@ -16817,7 +16761,7 @@ void Unit::SetStandState(uint8 state) { WorldPacket data(SMSG_STANDSTATE_UPDATE, 1); data << (uint8)state; - ToPlayer()->GetSession()->SendPacket(&data); + ToPlayer()->SendDirectMessage(&data); } } @@ -18252,10 +18196,8 @@ void Unit::SetControlled(bool apply, UnitState state, Unit* source /*= nullptr*/ void Unit::SetStunned(bool apply) { - if (HasUnitState(UNIT_STATE_IN_FLIGHT)) - { + if (IsInFlight()) return; - } if (apply) { @@ -18298,74 +18240,65 @@ void Unit::SetStunned(bool apply) } } -void Unit::SetRooted(bool apply, bool isStun) +void Unit::SetRooted(bool apply, bool stun, bool logout) { + const uint32 state = (stun ? (logout ? UNIT_STATE_LOGOUT_TIMER : UNIT_STATE_STUNNED) : UNIT_STATE_ROOT); + if (apply) { - if (m_rootTimes > 0) // blizzard internal check? - m_rootTimes++; + AddUnitState(state); - // MOVEMENTFLAG_ROOT cannot be used in conjunction with MOVEMENTFLAG_MASK_MOVING (tested 3.3.5a) - // this will freeze clients. That's why we remove MOVEMENTFLAG_MASK_MOVING before - // setting MOVEMENTFLAG_ROOT - RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING); + SendMoveRoot(true); + } + else + { + ClearUnitState(state); - if (IsFalling()) - { - AddUnitMovementFlag(MOVEMENTFLAG_PENDING_ROOT); - } - else - { - AddUnitMovementFlag(MOVEMENTFLAG_ROOT); - } + // Prevent giving ability to move if more immobilizers are active + if (!IsImmobilizedState()) + SendMoveRoot(false); + } +} - // Creature specific - if (!IsPlayer()) - { - if (isStun && movespline->Finalized()) - { - StopMovingOnCurrentPos(); - } - else - { - StopMoving(); - } - } +void Unit::SendMoveRoot(bool apply) +{ + const Player* client = GetClientControlling(); - if (m_movedByPlayer) + // Apply flags in-place when unit currently is not controlled by a player + if (!client) + { + if (apply) { - WorldPacket data(SMSG_FORCE_MOVE_ROOT, GetPackGUID().size() + 4); - data << GetPackGUID(); - data << m_rootTimes; - m_movedByPlayer->ToPlayer()->SendDirectMessage(&data); + m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_MASK_MOVING_FLY); + m_movementInfo.AddMovementFlag(MOVEMENTFLAG_ROOT); + if (!client) + StopMoving(); } else - { - WorldPacket data(SMSG_SPLINE_MOVE_ROOT, GetPackGUID().size()); - data << GetPackGUID(); - SendMessageToSet(&data, true); - } + m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ROOT); + } + + if (!IsInWorld()) + return; + + const PackedGuid& guid = GetPackGUID(); + // Wrath+ spline root: when unit is currently not controlled by a player + if (!client) + { + WorldPacket data(apply ? SMSG_SPLINE_MOVE_ROOT : SMSG_SPLINE_MOVE_UNROOT, guid.size()); + data << guid; + SendMessageToSet(&data, true); } + // Wrath+ force root: when unit is controlled by a player else { - RemoveUnitMovementFlag(MOVEMENTFLAG_ROOT | MOVEMENTFLAG_PENDING_ROOT); + uint32 const counter = client->GetSession()->GetOrderCounter(); - if (!HasUnitState(UNIT_STATE_STUNNED)) // prevent moving if it also has stun effect - { - if (m_movedByPlayer) - { - WorldPacket data(SMSG_FORCE_MOVE_UNROOT, GetPackGUID().size() + 4); - data << GetPackGUID(); - data << m_rootTimes; - m_movedByPlayer->ToPlayer()->SendDirectMessage(&data); - } - else - { - WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, GetPackGUID().size()); - data << GetPackGUID(); - SendMessageToSet(&data, true); - } - } + WorldPacket data(apply ? SMSG_FORCE_MOVE_ROOT : SMSG_FORCE_MOVE_UNROOT, guid.size() + 4); + data << guid; + data << counter; + client->GetSession()->SendPacket(&data); + client->GetSession()->IncrementOrderCounter(); } } @@ -19261,16 +19194,14 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ) WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4)); data << GetPackGUID(); - data << uint32(0); // counter + data << player->GetSession()->GetOrderCounter(); // movement counter data << float(vcos); // x direction data << float(vsin); // y direction data << float(speedXY); // Horizontal speed data << float(-speedZ); // Z Movement speed (vertical) - player->GetSession()->SendPacket(&data); - - if (player->HasIncreaseMountedFlightSpeedAura() || player->HasFlyAura()) - player->SetCanFly(true, true); + player->SendDirectMessage(&data); + player->GetSession()->IncrementOrderCounter(); player->SetCanKnockback(true); } @@ -19369,7 +19300,7 @@ void Unit::JumpTo(float speedXY, float speedZ, bool forward) data << float(speedXY); // Horizontal speed data << float(-speedZ); // Z Movement speed (vertical) - ToPlayer()->GetSession()->SendPacket(&data); + ToPlayer()->SendDirectMessage(&data); } } @@ -19527,7 +19458,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a bg->EventPlayerDroppedFlag(player); WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } ASSERT(!m_vehicle); @@ -19590,7 +19521,7 @@ void Unit::ExitVehicle(Position const* /*exitPosition*/) } } -bool VehicleDespawnEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) +bool VehicleDespawnEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { Position pos = _self; _self.MovePositionToFirstCollision(pos, 20.0f, M_PI); @@ -19621,6 +19552,9 @@ void Unit::_ExitVehicle(Position const* exitPosition) if (!vehicleBase) return; + if (IsPlayer()) + ToPlayer()->SetExpectingChangeTransport(true); + SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT Position pos; @@ -19651,12 +19585,6 @@ void Unit::_ExitVehicle(Position const* exitPosition) sScriptMgr->AnticheatSetUnderACKmount(player); } - else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT)) - { - WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8); - data << GetPackGUID(); - SendMessageToSet(&data, false); - } // xinef: hack for flameleviathan seat vehicle VehicleEntry const* vehicleInfo = vehicle->GetVehicleInfo(); @@ -19697,7 +19625,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) else if (vehicleBase->IsCreature()) { vehicle->Uninstall(); - vehicleBase->m_Events.AddEvent(new VehicleDespawnEvent(*vehicleBase, 2000), vehicleBase->m_Events.CalculateTime(2000)); + vehicleBase->m_Events.AddEventAtOffset(new VehicleDespawnEvent(*vehicleBase, 2s), 2s); } // xinef: ugly hack, no appripriate hook later to cast spell @@ -19717,7 +19645,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) setDeathState(DeathState::JustDied); // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon else - ToTempSummon()->UnSummon(2000); // Approximation + ToTempSummon()->UnSummon(2s); // Approximation } if (player) @@ -20104,7 +20032,7 @@ class AuraMunchingQueue : public BasicEvent public: AuraMunchingQueue(Unit& owner, ObjectGuid targetGUID, int32 basePoints, uint32 spellId, AuraEffect* aurEff, AuraType auraType) : _owner(owner), _targetGUID(targetGUID), _basePoints(basePoints), _spellId(spellId), _aurEff(aurEff), _auraType(auraType) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override + bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override { if (_owner.IsInWorld() && _owner.FindMap()) if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID)) @@ -20133,24 +20061,6 @@ private: AuraType _auraType; }; -class ResetToHomeOrientation : public BasicEvent -{ -public: - ResetToHomeOrientation(Creature& self) : _self(self) { } - - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override - { - if (_self.IsInWorld() && _self.FindMap() && _self.IsAlive() && !_self.IsInCombat()) - { - _self.SetFacingTo(_self.GetHomePosition().GetOrientation()); - } - - return true; - } -private: - Creature& _self; -}; - void Unit::CastDelayedSpellWithPeriodicAmount(Unit* caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex) { AuraEffect* aurEff = nullptr; @@ -20376,7 +20286,7 @@ void Unit::SetFacingTo(float ori) init.Launch(); } -void Unit::SetFacingToObject(WorldObject* object) +void Unit::SetFacingToObject(WorldObject* object, Milliseconds timed /*= 0ms*/) { // never face when already moving if (!IsStopped()) @@ -20387,24 +20297,20 @@ void Unit::SetFacingToObject(WorldObject* object) init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ()); init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming init.Launch(); -} - -void Unit::SetTimedFacingToObject(WorldObject* object, uint32 time) -{ - // never face when already moving - if (!IsStopped() || !time) - return; - /// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is. - Movement::MoveSplineInit init(this); - init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ()); - init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming - init.Launch(); - - if (Creature* c = ToCreature()) - c->m_Events.AddEvent(new ResetToHomeOrientation(*c), c->m_Events.CalculateTime(time)); - else - LOG_ERROR("entities.unit", "Unit::SetTimedFacingToObject called on non-creature unit {}. This should never happen.", GetEntry()); + if (timed > 0ms) + { + if (Creature* c = ToCreature()) + { + c->m_Events.AddEventAtOffset([c]() + { + if (c->IsInWorld() && c->FindMap() && c->IsAlive() && !c->IsInCombat()) + c->SetFacingTo(c->GetHomePosition().GetOrientation()); + }, timed); + } + else + LOG_ERROR("entities.unit", "Unit::SetFacingToObject called on non-creature unit {}. This should never happen.", GetEntry()); + } } bool Unit::SetWalk(bool enable) @@ -20421,22 +20327,39 @@ bool Unit::SetWalk(bool enable) return true; } -bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/, bool /*updateAnimationTier = true*/) +void Unit::SetDisableGravity(bool enable) { - if (disable == IsLevitating()) - return false; + bool isClientControlled = IsClientControlled(); - if (disable) + if (!isClientControlled) { - AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); - RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING); + if (enable) + m_movementInfo.AddMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); + else + m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); } - else + + if (!IsInWorld()) // is sent on add to map + return; + + if (isClientControlled) { - RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); + if (Player const* player = GetClientControlling()) + { + uint32 const counter = player->GetSession()->GetOrderCounter(); + + WorldPacket data(enable ? SMSG_MOVE_GRAVITY_DISABLE : SMSG_MOVE_GRAVITY_ENABLE, GetPackGUID().size() + 4); + data << GetPackGUID(); + data << counter; + player->GetSession()->SendPacket(&data); + player->GetSession()->IncrementOrderCounter(); + return; + } } - return true; + WorldPacket data(enable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9); + data << GetPackGUID(); + SendMessageToSet(&data, true); } bool Unit::SetSwim(bool enable) @@ -20464,98 +20387,187 @@ bool Unit::SetSwim(bool enable) * * Doesn't inform the client. */ -bool Unit::SetCanFly(bool enable, bool /*packetOnly = false */) +void Unit::SetCanFly(bool enable) { - if (enable == HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY)) - return false; + bool isClientControlled = IsClientControlled(); - if (enable) + if (!isClientControlled) { - AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); - RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING); + if (enable) + m_movementInfo.AddMovementFlag(MOVEMENTFLAG_CAN_FLY); + else + m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_CAN_FLY); } - else + + if (!IsInWorld()) // is sent on add to map + return; + + if (isClientControlled) { - RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_MASK_MOVING_FLY); + if (Player const* player = GetClientControlling()) + { + uint32 const counter = player->GetSession()->GetOrderCounter(); + const_cast<Player*>(player)->SetPendingFlightChange(counter); + + WorldPacket data(enable ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, GetPackGUID().size() + 4); + data << GetPackGUID(); + data << counter; + player->SendDirectMessage(&data); + player->GetSession()->IncrementOrderCounter(); + return; + } } - return true; + WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9); + data << GetPackGUID(); + SendMessageToSet(&data, true); } -/** - * @brief Allow to walk on water. Doesn't inform the client. - * Need to use SendMovementWaterWalking() if it's for players. - */ -bool Unit::SetWaterWalking(bool enable, bool /*packetOnly = false*/) +void Unit::SetFeatherFall(bool enable) { - if (enable == HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING)) - return false; - - if (enable) - AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING); - else - RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING); + bool isClientControlled = IsClientControlled(); - return true; -} + if (!isClientControlled) + { + if (enable) + m_movementInfo.AddMovementFlag(MOVEMENTFLAG_FALLING_SLOW); + else + m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_FALLING_SLOW); + } -void Unit::SendMovementWaterWalking(Player* sendTo) -{ - if (!movespline->Initialized()) + if (!IsInWorld()) // is sent on add to map return; - WorldPacket data(SMSG_SPLINE_MOVE_WATER_WALK, 9); + + if (isClientControlled) + { + if (Player const* player = GetClientControlling()) + { + uint32 const counter = player->GetSession()->GetOrderCounter(); + + WorldPacket data(enable ? SMSG_MOVE_FEATHER_FALL : SMSG_MOVE_NORMAL_FALL, GetPackGUID().size() + 4); + + data << GetPackGUID(); + data << counter; + player->SendDirectMessage(&data); + player->GetSession()->IncrementOrderCounter(); + + // start fall from current height + if (!enable) + const_cast<Player*>(player)->SetFallInformation(0, GetPositionZ()); + + return; + } + } + + WorldPacket data(enable ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL); data << GetPackGUID(); - sendTo->SendDirectMessage(&data); + SendMessageToSet(&data, true); } -bool Unit::SetFeatherFall(bool enable, bool /*packetOnly = false*/) +void Unit::SetHover(bool enable) { - if (enable == HasUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW)) - return false; + bool isClientControlled = IsClientControlled(); + + if (!isClientControlled) + { + if (enable) + m_movementInfo.AddMovementFlag(MOVEMENTFLAG_HOVER); + else + m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_HOVER); + } + + float hoverHeight = GetHoverHeight(); if (enable) - AddUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW); + { + if (hoverHeight && GetPositionZ() - GetMap()->GetHeight(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ()) < hoverHeight) + Relocate(GetPositionX(), GetPositionY(), GetPositionZ() + hoverHeight); + } else - RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW); - - return true; -} + { + if (IsAlive() || !IsUnit()) + { + float newZ = std::max<float>(GetMap()->GetHeight(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ()), GetPositionZ() - hoverHeight); + UpdateAllowedPositionZ(GetPositionX(), GetPositionY(), newZ); + Relocate(GetPositionX(), GetPositionY(), newZ); + } + } -void Unit::SendMovementFeatherFall(Player* sendTo) -{ - if (!movespline->Initialized()) + if (!IsInWorld()) // is sent on add to map return; - WorldPacket data(SMSG_SPLINE_MOVE_FEATHER_FALL, 9); + + if (isClientControlled) + { + if (Player const* player = GetClientControlling()) + { + WorldPacket data(enable ? SMSG_MOVE_SET_HOVER : SMSG_MOVE_UNSET_HOVER, GetPackGUID().size() + 4); + + uint32 const counter = player->GetSession()->GetOrderCounter(); + + data << GetPackGUID(); + data << counter; + player->SendDirectMessage(&data); + player->GetSession()->IncrementOrderCounter(); + return; + } + } + + WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9); data << GetPackGUID(); - sendTo->SendDirectMessage(&data); + SendMessageToSet(&data, true); } -bool Unit::SetHover(bool enable, bool /*packetOnly = false*/, bool /*updateAnimationTier = true*/) +void Unit::SetWaterWalking(bool enable) { - if (enable == HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) - return false; + bool isClientControlled = IsClientControlled(); - float hoverHeight = GetFloatValue(UNIT_FIELD_HOVERHEIGHT); - - if (enable) + if (!isClientControlled) { - AddUnitMovementFlag(MOVEMENTFLAG_HOVER); - if (hoverHeight && GetPositionZ() - GetFloorZ() < hoverHeight) - UpdateHeight(GetPositionZ() + hoverHeight); + if (enable) + m_movementInfo.AddMovementFlag(MOVEMENTFLAG_WATERWALKING); + else + m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_WATERWALKING); } - else + + if (!IsInWorld()) // is sent on add to map + return; + + if (isClientControlled) { - RemoveUnitMovementFlag(MOVEMENTFLAG_HOVER); - if (hoverHeight && (!isDying() || !IsCreature())) + if (Player const* player = GetClientControlling()) { - float newZ = std::max<float>(GetFloorZ(), GetPositionZ() - hoverHeight); - UpdateAllowedPositionZ(GetPositionX(), GetPositionY(), newZ); - UpdateHeight(newZ); + uint32 const counter = player->GetSession()->GetOrderCounter(); + + WorldPacket data(enable ? SMSG_MOVE_WATER_WALK : SMSG_MOVE_LAND_WALK, GetPackGUID().size() + 4); + data << GetPackGUID(); + data << counter; + player->SendDirectMessage(&data); + player->GetSession()->IncrementOrderCounter(); + return; } - SendMovementFlagUpdate(); // pussywizard: needed for falling after death (instead of falling onto air at hover height) } - return true; + WorldPacket data(enable ? SMSG_SPLINE_MOVE_WATER_WALK : SMSG_SPLINE_MOVE_LAND_WALK, 9); + data << GetPackGUID(); + SendMessageToSet(&data, true); +} + +void Unit::SendMovementWaterWalking(Player* sendTo) +{ + if (!movespline->Initialized()) + return; + WorldPacket data(SMSG_SPLINE_MOVE_WATER_WALK, 9); + data << GetPackGUID(); + sendTo->SendDirectMessage(&data); +} + +void Unit::SendMovementFeatherFall(Player* sendTo) +{ + if (!movespline->Initialized()) + return; + WorldPacket data(SMSG_SPLINE_MOVE_FEATHER_FALL, 9); + data << GetPackGUID(); + sendTo->SendDirectMessage(&data); } void Unit::SendMovementHover(Player* sendTo) @@ -20719,7 +20731,10 @@ void Unit::PatchValuesUpdate(ByteBuffer& valuesUpdateBuf, BuildValuesCachePosPoi appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK; if (!target->CanSeeVendor(creature)) + { + appendValue &= ~UNIT_NPC_FLAG_REPAIR; appendValue &= ~UNIT_NPC_FLAG_VENDOR_MASK; + } if (!creature->IsValidTrainerForPlayer(target, &appendValue)) appendValue &= ~UNIT_NPC_FLAG_TRAINER; @@ -21203,3 +21218,58 @@ std::string Unit::GetDebugInfo() const << " Class: " << std::to_string(getClass()); return sstr.str(); } + +bool Unit::IsClientControlled(Player const* exactClient /*= nullptr*/) const +{ + // Severvide method to check if unit is client controlled (optionally check for specific client in control) + + // Applies only to player controlled units + if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + return false; + + // These flags are meant to be used when server controls this unit, client control is taken away + if (HasFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING))) + return false; + + // If unit is possessed, it has lost original control... + if (ObjectGuid const& guid = GetCharmerGUID()) + { + // ... but if it is a possessing charm, then we have to check if some other player controls it + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) && guid.IsPlayer()) + return (exactClient ? (exactClient->GetGUID() == guid) : true); + return false; + } + + // By default: players have client control over themselves + if (IsPlayer()) + return (exactClient ? (exactClient == this) : true); + return false; +} + +Player const* Unit::GetClientControlling() const +{ + // Serverside reverse "mover" deduction logic at controlled unit + + // Applies only to player controlled units + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + { + // Charm always removes control from original client... + if (GetCharmerGUID()) + { + // ... but if it is a possessing charm, some other client may have control + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) + { + Unit const* charmer = GetCharmer(); + if (charmer && charmer->IsPlayer()) + return static_cast<Player const*>(charmer); + } + } + else if (IsPlayer()) + { + // Check if anything prevents original client from controlling + if (IsClientControlled(static_cast<Player const*>(this))) + return static_cast<Player const*>(this); + } + } + return nullptr; +} diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 2fcccdb905..c335f7e0ed 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.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,6 +26,7 @@ #include "ItemTemplate.h" #include "MotionMaster.h" #include "Object.h" +#include "PetDefines.h" #include "SharedDefines.h" #include "SpellAuraDefines.h" #include "SpellDefines.h" @@ -567,6 +568,13 @@ enum class SearchMethod typedef std::list<Player*> SharedVisionList; +enum class DualWieldMode : uint8 +{ + AUTO = 0, // non-player units must have a valid offhand weapon to enable dual wield + DISABLED = 1, + ENABLED = 2, +}; + struct AttackPosition { AttackPosition(Position pos) : _pos(std::move(pos)), _taken(false) {} bool operator==(const int val) @@ -616,6 +624,28 @@ typedef std::unordered_map<uint32, uint32> PacketCooldowns; struct SpellProcEventEntry; // used only privately +enum class SpeedOpcodeIndex : uint32 +{ + PC, + NPC, + ACK_RESPONSE, + MAX +}; + +typedef const Opcodes SpeedOpcodePair[static_cast<size_t>(SpeedOpcodeIndex::MAX)]; +SpeedOpcodePair SetSpeed2Opc_table[MAX_MOVE_TYPE] = +{ + {SMSG_FORCE_WALK_SPEED_CHANGE, SMSG_SPLINE_SET_WALK_SPEED, MSG_MOVE_SET_WALK_SPEED}, + {SMSG_FORCE_RUN_SPEED_CHANGE, SMSG_SPLINE_SET_RUN_SPEED, MSG_MOVE_SET_RUN_SPEED}, + {SMSG_FORCE_RUN_BACK_SPEED_CHANGE, SMSG_SPLINE_SET_RUN_BACK_SPEED, MSG_MOVE_SET_RUN_BACK_SPEED}, + {SMSG_FORCE_SWIM_SPEED_CHANGE, SMSG_SPLINE_SET_SWIM_SPEED, MSG_MOVE_SET_SWIM_SPEED}, + {SMSG_FORCE_SWIM_BACK_SPEED_CHANGE, SMSG_SPLINE_SET_SWIM_BACK_SPEED, MSG_MOVE_SET_SWIM_BACK_SPEED}, + {SMSG_FORCE_TURN_RATE_CHANGE, SMSG_SPLINE_SET_TURN_RATE, MSG_MOVE_SET_TURN_RATE}, + {SMSG_FORCE_FLIGHT_SPEED_CHANGE, SMSG_SPLINE_SET_FLIGHT_SPEED, MSG_MOVE_SET_FLIGHT_SPEED}, + {SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE, SMSG_SPLINE_SET_FLIGHT_BACK_SPEED, MSG_MOVE_SET_FLIGHT_BACK_SPEED}, + {SMSG_FORCE_PITCH_RATE_CHANGE, SMSG_SPLINE_SET_PITCH_RATE, MSG_MOVE_SET_PITCH_RATE}, +}; + class Unit : public WorldObject { public: @@ -737,6 +767,7 @@ public: void SetExtraUnitMovementFlags(uint16 f) { m_movementInfo.flags2 = f; } inline bool IsCrowdControlled() const { return HasFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_STUNNED)); } + inline bool IsImmobilizedState() const { return HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED); } /*********************************************************/ /*** UNIT TYPES, CLASSES, RACES... ***/ @@ -819,6 +850,11 @@ public: bool IsValidAssistTarget(Unit const* target) const; bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const; + // Client controlled: check if unit currently is under client control (has active "mover"), optionally check for specific client (server-side) + bool IsClientControlled(Player const* exactClient = nullptr) const; + // Controlling client: server PoV on which client (player) controls movement of the unit at the moment, obtain "mover" (server-side) + Player const* GetClientControlling() const; + // Combat range [[nodiscard]] float GetBoundaryRadius() const { return m_floatValues[UNIT_FIELD_BOUNDINGRADIUS]; } [[nodiscard]] float GetCombatReach() const override { return m_floatValues[UNIT_FIELD_COMBATREACH]; } @@ -917,8 +953,9 @@ public: // Weapons systems [[nodiscard]] bool haveOffhandWeapon() const; - [[nodiscard]] bool CanDualWield() const { return m_canDualWield; } - virtual void SetCanDualWield(bool value) { m_canDualWield = value; } + [[nodiscard]] bool CanDualWield() const { return _dualWieldMode == DualWieldMode::ENABLED; } + virtual void SetCanDualWield(bool value) { _dualWieldMode = value ? DualWieldMode::ENABLED : DualWieldMode::DISABLED; } + virtual void SetDualWieldMode(DualWieldMode mode) { _dualWieldMode = mode; } virtual bool HasWeapon(WeaponAttackType type) const = 0; inline bool HasMainhandWeapon() const { return HasWeapon(BASE_ATTACK); } @@ -930,7 +967,7 @@ public: inline bool HasMainhandWeaponForAttack() const { return HasWeaponForAttack(BASE_ATTACK); } inline bool HasOffhandWeaponForAttack() const { return HasWeaponForAttack(OFF_ATTACK); } inline bool HasRangedWeaponForAttack() const { return HasWeaponForAttack(RANGED_ATTACK); } - [[nodiscard]] bool CanUseAttackType(uint8 attacktype) const + [[nodiscard]] bool CanUseAttackType(WeaponAttackType attacktype) const { switch (attacktype) { @@ -1157,6 +1194,7 @@ public: static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false, Spell const* spell = nullptr); void DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss); void DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss, Spell const* spell = nullptr); + void DealDamageShieldDamage(Unit* victim); static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb); static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr); @@ -1629,6 +1667,7 @@ public: [[nodiscard]] virtual bool CanFly() const = 0; [[nodiscard]] bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_DISABLE_GRAVITY); } [[nodiscard]] bool IsFalling() const; + [[nodiscard]] bool IsRooted() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT); } [[nodiscard]] float GetHoverHeight() const { return IsHovering() ? GetFloatValue(UNIT_FIELD_HOVERHEIGHT) : 0.0f; } @@ -1661,17 +1700,15 @@ public: void propagateSpeedChange() { GetMotionMaster()->propagateSpeedChange(); } void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf = SPLINEFLAG_WALK_MODE); // pussywizard: need to just send packet, with no movement/spline - void MonsterMoveWithSpeed(float x, float y, float z, float speed); - //void SetFacing(float ori, WorldObject* obj = nullptr); - //void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = nullptr); + void MonsterMoveWithSpeed(float x, float y, float z, float speed); // Not to be used outside of cinematics virtual bool SetWalk(bool enable); - virtual bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true); + void SetDisableGravity(bool disable); virtual bool SetSwim(bool enable); - virtual bool SetCanFly(bool enable, bool packetOnly = false); - virtual bool SetWaterWalking(bool enable, bool packetOnly = false); - virtual bool SetFeatherFall(bool enable, bool packetOnly = false); - virtual bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true); + void SetCanFly(bool enable); + void SetWaterWalking(bool enable); + void SetFeatherFall(bool enable); + void SetHover(bool enable); MotionMaster* GetMotionMaster() { return i_motionMaster; } [[nodiscard]] const MotionMaster* GetMotionMaster() const { return i_motionMaster; } @@ -1698,6 +1735,7 @@ public: [[nodiscard]] uint8 getStandState() const { return GetByteValue(UNIT_FIELD_BYTES_1, 0); } [[nodiscard]] bool IsSitState() const; [[nodiscard]] bool IsStandState() const; + [[nodiscard]] bool IsStandUpOnMovementState() const; void SetStandState(uint8 state); void SetStandFlags(uint8 flags) { SetByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_VIS_FLAG, flags); } @@ -1904,8 +1942,8 @@ public: void SetInFront(WorldObject const* target); void SetFacingTo(float ori); - void SetFacingToObject(WorldObject* object); - void SetTimedFacingToObject(WorldObject* object, uint32 time); // Reset to home orientation after given time + // <timed>Reset to home orientation after given time + void SetFacingToObject(WorldObject* object, Milliseconds timed = 0ms); bool isInAccessiblePlaceFor(Creature const* c) const; bool isInFrontInMap(Unit const* target, float distance, float arc = M_PI) const; @@ -1947,9 +1985,10 @@ public: void SendPlaySpellVisual(uint32 id); void SendPlaySpellImpact(ObjectGuid guid, uint32 id); - void SendPetActionFeedback (uint8 msg); - void SendPetTalk (uint32 pettalk); - void SendPetAIReaction(ObjectGuid guid); + void SendPetActionFeedback(uint8 msg) const; + void SendPetActionSound(PetAction action) const; + void SendPetDismissSound() const; + void SendPetAIReaction(ObjectGuid guid) const; void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo); @@ -1988,7 +2027,7 @@ public: //----------- Public variables ----------// uint32 m_extraAttacks; - bool m_canDualWield; + DualWieldMode _dualWieldMode; ControlSet m_Controlled; @@ -2049,7 +2088,8 @@ protected: void SetFeared(bool apply, Unit* fearedBy = nullptr, bool isFear = false); void SetConfused(bool apply); void SetStunned(bool apply); - void SetRooted(bool apply, bool isStun = false); + void SetRooted(bool apply, bool stun = false, bool logout = false); + void SendMoveRoot(bool state); //----------- Protected variables ----------// UnitAI* i_AI; @@ -2121,8 +2161,6 @@ protected: bool m_applyResilience; bool _instantCast; - uint32 m_rootTimes; - private: bool IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent, ProcEventInfo const& eventInfo); bool HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, ProcEventInfo const& eventInfo); diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h index e6885fe162..af52a98912 100644 --- a/src/server/game/Entities/Unit/UnitDefines.h +++ b/src/server/game/Entities/Unit/UnitDefines.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 @@ -197,7 +197,9 @@ enum UnitState UNIT_STATE_IGNORE_PATHFINDING = 0x10000000, // do not use pathfinding in any MovementGenerator UNIT_STATE_NO_ENVIRONMENT_UPD = 0x20000000, - UNIT_STATE_NO_COMBAT_MOVEMENT, // serverside only - should never be changed outside of core and hence shouldnt have a defined static value and be at the end + // serverside region + UNIT_STATE_NO_COMBAT_MOVEMENT = 0x40000000, // should not be changed outside the core and should be placed at the end + UNIT_STATE_LOGOUT_TIMER = 0x80000000, // Unit is logging out UNIT_STATE_ALL_STATE_SUPPORTED = UNIT_STATE_DIED | UNIT_STATE_MELEE_ATTACKING | UNIT_STATE_STUNNED | UNIT_STATE_ROAMING | UNIT_STATE_CHASE | UNIT_STATE_FLEEING | UNIT_STATE_IN_FLIGHT | UNIT_STATE_FOLLOW | UNIT_STATE_ROOT | UNIT_STATE_CONFUSED @@ -412,6 +414,8 @@ enum MovementFlags MOVEMENTFLAG_MASK_PLAYER_ONLY = MOVEMENTFLAG_FLYING, + MOVEMENTFLAG_MASK_MOVING_OR_TURN = MOVEMENTFLAG_MASK_MOVING | MOVEMENTFLAG_MASK_TURNING, + /// Movement flags that have change status opcodes associated for players MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE = MOVEMENTFLAG_DISABLE_GRAVITY | MOVEMENTFLAG_ROOT | MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_WATERWALKING | MOVEMENTFLAG_FALLING_SLOW | MOVEMENTFLAG_HOVER diff --git a/src/server/game/Entities/Unit/UnitUtils.h b/src/server/game/Entities/Unit/UnitUtils.h index 42f0ba1a03..e863426605 100644 --- a/src/server/game/Entities/Unit/UnitUtils.h +++ b/src/server/game/Entities/Unit/UnitUtils.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/Entities/Unit/enuminfo_Unit.cpp b/src/server/game/Entities/Unit/enuminfo_Unit.cpp index 01747bdb69..6ded62396c 100644 --- a/src/server/game/Entities/Unit/enuminfo_Unit.cpp +++ b/src/server/game/Entities/Unit/enuminfo_Unit.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/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index b0752ecd2d..d18e721adb 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.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 @@ -423,7 +423,9 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) if (_me->IsInWorld()) { unit->SendClearTarget(); // SMSG_BREAK_TARGET - unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures) + unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures) + if (unit->IsPlayer()) + unit->ToPlayer()->SetExpectingChangeTransport(true); // also adds MOVEMENTFLAG_ROOT Movement::MoveSplineInit init(unit); init.DisableTransportPathTransformations(); diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index 3d5115e7f0..04594870b0 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.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 @@ -100,12 +100,12 @@ private: class VehicleDespawnEvent : public BasicEvent { public: - VehicleDespawnEvent(Unit& self, uint32 duration) : _self(self), _duration(duration) { } + VehicleDespawnEvent(Unit& self, Milliseconds duration) : _self(self), _duration(duration) { } bool Execute(uint64 e_time, uint32 p_time) override; protected: Unit& _self; - uint32 _duration; + Milliseconds _duration; }; #endif diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index 1f4e99e6c0..1aa2545819 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.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/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 4e98280fc1..509d5235ed 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.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/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h index 9cc0adcb6b..fc7f3726d1 100644 --- a/src/server/game/Events/GameEventMgr.h +++ b/src/server/game/Events/GameEventMgr.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/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index f9a4cb01e3..7ed1f0c2ad 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.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 @@ -112,7 +112,7 @@ namespace PlayerNameMapHolder } // namespace PlayerNameMapHolder -WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid const guid) +WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid const& guid) { switch (guid.GetHigh()) { @@ -138,7 +138,7 @@ WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid con return nullptr; } -Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid const guid, uint32 typemask) +Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid const& guid, uint32 typemask) { switch (guid.GetHigh()) { @@ -176,27 +176,27 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid con return nullptr; } -Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, ObjectGuid const guid) +Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, ObjectGuid const& guid) { return u.GetMap()->GetCorpse(guid); } -GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, ObjectGuid const guid) +GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, ObjectGuid const& guid) { return u.GetMap()->GetGameObject(guid); } -Transport* ObjectAccessor::GetTransport(WorldObject const& u, ObjectGuid const guid) +Transport* ObjectAccessor::GetTransport(WorldObject const& u, ObjectGuid const& guid) { return u.GetMap()->GetTransport(guid); } -DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, ObjectGuid const guid) +DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, ObjectGuid const& guid) { return u.GetMap()->GetDynamicObject(guid); } -Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid const guid) +Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid const& guid) { if (guid.IsPlayer()) return GetPlayer(u, guid); @@ -207,17 +207,17 @@ Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid const guid) return GetCreature(u, guid); } -Creature* ObjectAccessor::GetCreature(WorldObject const& u, ObjectGuid const guid) +Creature* ObjectAccessor::GetCreature(WorldObject const& u, ObjectGuid const& guid) { return u.GetMap()->GetCreature(guid); } -Pet* ObjectAccessor::GetPet(WorldObject const& u, ObjectGuid const guid) +Pet* ObjectAccessor::GetPet(WorldObject const& u, ObjectGuid const& guid) { return u.GetMap()->GetPet(guid); } -Player* ObjectAccessor::GetPlayer(Map const* m, ObjectGuid const guid) +Player* ObjectAccessor::GetPlayer(Map const* m, ObjectGuid const& guid) { if (Player * player = HashMapHolder<Player>::Find(guid)) if (player->IsInWorld() && player->GetMap() == m) @@ -226,12 +226,12 @@ Player* ObjectAccessor::GetPlayer(Map const* m, ObjectGuid const guid) return nullptr; } -Player* ObjectAccessor::GetPlayer(WorldObject const& u, ObjectGuid const guid) +Player* ObjectAccessor::GetPlayer(WorldObject const& u, ObjectGuid const& guid) { return GetPlayer(u.GetMap(), guid); } -Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, ObjectGuid const guid) +Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, ObjectGuid const& guid) { if (guid.IsPet()) return GetPet(u, guid); diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 2fbe70bf5b..d7d2aaa8a7 100644 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.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 @@ -60,18 +60,18 @@ public: namespace ObjectAccessor { // these functions return objects only if in map of specified object - WorldObject* GetWorldObject(WorldObject const&, ObjectGuid const guid); - Object* GetObjectByTypeMask(WorldObject const&, ObjectGuid const guid, uint32 typemask); - Corpse* GetCorpse(WorldObject const& u, ObjectGuid const guid); - GameObject* GetGameObject(WorldObject const& u, ObjectGuid const guid); - Transport* GetTransport(WorldObject const& u, ObjectGuid const guid); - DynamicObject* GetDynamicObject(WorldObject const& u, ObjectGuid const guid); - Unit* GetUnit(WorldObject const&, ObjectGuid const guid); - Creature* GetCreature(WorldObject const& u, ObjectGuid const guid); - Pet* GetPet(WorldObject const&, ObjectGuid const guid); - Player* GetPlayer(Map const*, ObjectGuid const guid); - Player* GetPlayer(WorldObject const&, ObjectGuid const guid); - Creature* GetCreatureOrPetOrVehicle(WorldObject const&, ObjectGuid const); + WorldObject* GetWorldObject(WorldObject const&, ObjectGuid const& guid); + Object* GetObjectByTypeMask(WorldObject const&, ObjectGuid const& guid, uint32 typemask); + Corpse* GetCorpse(WorldObject const& u, ObjectGuid const& guid); + GameObject* GetGameObject(WorldObject const& u, ObjectGuid const& guid); + Transport* GetTransport(WorldObject const& u, ObjectGuid const& guid); + DynamicObject* GetDynamicObject(WorldObject const& u, ObjectGuid const& guid); + Unit* GetUnit(WorldObject const&, ObjectGuid const& guid); + Creature* GetCreature(WorldObject const& u, ObjectGuid const& guid); + Pet* GetPet(WorldObject const&, ObjectGuid const& guid); + Player* GetPlayer(Map const*, ObjectGuid const& guid); + Player* GetPlayer(WorldObject const&, ObjectGuid const& guid); + Creature* GetCreatureOrPetOrVehicle(WorldObject const&, ObjectGuid const&); // these functions return objects if found in whole world // ACCESS LIKE THAT IS NOT THREAD SAFE diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c532f5fe7e..f22606ec27 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.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 @@ -1122,8 +1122,22 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (!cInfo->Models.size()) LOG_ERROR("sql.sql", "Creature (Entry: {}) does not have any existing display id in creature_template_model.", cInfo->Entry); - else if (std::accumulate(cInfo->Models.begin(), cInfo->Models.end(), 0.0f, [](float sum, CreatureModel const& model) { return sum + model.Probability; }) <= 0.0f) - LOG_ERROR("sql.sql", "Creature (Entry: {}) has zero total chance for all models in creature_template_model.", cInfo->Entry); + else + { + float const totalProbability = std::accumulate(cInfo->Models.begin(), cInfo->Models.end(), 0.0f, [](float sum, CreatureModel const& model) { return sum + model.Probability; }); + + if (totalProbability <= 0.0f) + { // There are many cases in official data of all models having a probability of 0. Believe to be treated equivalent to equal chance ONLY if all are zeroed + if (totalProbability == 0.0f) + LOG_DEBUG("sql.sql", "Creature (Entry: {}) has zero total chance for all models in creature_template_model. Setting all to 1.0.", cInfo->Entry); + else // Custom, likely bad data + LOG_ERROR("sql.sql", "Creature (Entry: {}) has less than zero total chance for all models in creature_template_model. Setting all to 1.0.", cInfo->Entry); + + auto& models = const_cast<CreatureTemplate*>(cInfo)->Models; + for (auto& model : models) + model.Probability = 1.0f; + } + } if (!cInfo->unit_class || ((1 << (cInfo->unit_class - 1)) & CLASSMASK_ALL_CREATURES) == 0) { diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index f6492ad317..173447ce8c 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.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/Globals/WorldGlobals.cpp b/src/server/game/Globals/WorldGlobals.cpp index fcfb3369e0..fd1663dc31 100644 --- a/src/server/game/Globals/WorldGlobals.cpp +++ b/src/server/game/Globals/WorldGlobals.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/Globals/WorldGlobals.h b/src/server/game/Globals/WorldGlobals.h index e8695d02b9..5eca5f6618 100644 --- a/src/server/game/Globals/WorldGlobals.h +++ b/src/server/game/Globals/WorldGlobals.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/Grids/Cells/Cell.h b/src/server/game/Grids/Cells/Cell.h index a54f7f4cd8..72097e7e7d 100644 --- a/src/server/game/Grids/Cells/Cell.h +++ b/src/server/game/Grids/Cells/Cell.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/Grids/Cells/CellImpl.h b/src/server/game/Grids/Cells/CellImpl.h index 997840367a..4bc1a66ed5 100644 --- a/src/server/game/Grids/Cells/CellImpl.h +++ b/src/server/game/Grids/Cells/CellImpl.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/Grids/GridCell.h b/src/server/game/Grids/GridCell.h index 65e3a0315b..dda22551d4 100644 --- a/src/server/game/Grids/GridCell.h +++ b/src/server/game/Grids/GridCell.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/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h index 5c1d09c63e..8904ff41d1 100644 --- a/src/server/game/Grids/GridDefines.h +++ b/src/server/game/Grids/GridDefines.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/Grids/GridObjectLoader.cpp b/src/server/game/Grids/GridObjectLoader.cpp index d8b39ebd69..07a5d2211b 100644 --- a/src/server/game/Grids/GridObjectLoader.cpp +++ b/src/server/game/Grids/GridObjectLoader.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/Grids/GridObjectLoader.h b/src/server/game/Grids/GridObjectLoader.h index ec60447315..892df35cbe 100644 --- a/src/server/game/Grids/GridObjectLoader.h +++ b/src/server/game/Grids/GridObjectLoader.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/Grids/GridRefMgr.h b/src/server/game/Grids/GridRefMgr.h index 32dd3cfeb6..09b307ae91 100644 --- a/src/server/game/Grids/GridRefMgr.h +++ b/src/server/game/Grids/GridRefMgr.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/Grids/GridReference.h b/src/server/game/Grids/GridReference.h index e365a56010..35a808c9c6 100644 --- a/src/server/game/Grids/GridReference.h +++ b/src/server/game/Grids/GridReference.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/Grids/GridTerrainData.cpp b/src/server/game/Grids/GridTerrainData.cpp index e2439dc2e5..ab4a1c2869 100644 --- a/src/server/game/Grids/GridTerrainData.cpp +++ b/src/server/game/Grids/GridTerrainData.cpp @@ -527,9 +527,11 @@ float GridTerrainData::getLiquidLevel(float x, float y) const } // Get water state on map -LiquidData const GridTerrainData::GetLiquidData(float x, float y, float z, float collisionHeight, uint8 ReqLiquidType) const +LiquidData const GridTerrainData::GetLiquidData(float x, float y, float z, float collisionHeight, Optional<uint8> ReqLiquidType) const { LiquidData liquidData; + liquidData.Status = LIQUID_MAP_NO_WATER; + if (!_loadedLiquidData) return liquidData; @@ -575,7 +577,7 @@ LiquidData const GridTerrainData::GetLiquidData(float x, float y, float z, float } // Check req liquid type mask - if (type != 0 && (!ReqLiquidType || (ReqLiquidType & type) != 0)) + if (type != 0 && (!ReqLiquidType || (*ReqLiquidType & type) != 0)) { // Check water level: // Check water height map diff --git a/src/server/game/Grids/GridTerrainData.h b/src/server/game/Grids/GridTerrainData.h index 6d6b898252..18324d574e 100644 --- a/src/server/game/Grids/GridTerrainData.h +++ b/src/server/game/Grids/GridTerrainData.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 @@ -186,7 +186,7 @@ struct LoadedHoleData HolesType holes; }; -enum LiquidStatus +enum LiquidStatus : uint32 { LIQUID_MAP_NO_WATER = 0x00000000, LIQUID_MAP_ABOVE_WATER = 0x00000001, @@ -249,7 +249,7 @@ public: inline float getHeight(float x, float y) const { return (this->*_gridGetHeight)(x, y); } float getMinHeight(float x, float y) const; float getLiquidLevel(float x, float y) const; - LiquidData const GetLiquidData(float x, float y, float z, float collisionHeight, uint8 ReqLiquidType) const; + LiquidData const GetLiquidData(float x, float y, float z, float collisionHeight, Optional<uint8> ReqLiquidType) const; }; #endif diff --git a/src/server/game/Grids/GridTerrainLoader.h b/src/server/game/Grids/GridTerrainLoader.h index 39cbc0d622..e1d6019bf4 100644 --- a/src/server/game/Grids/GridTerrainLoader.h +++ b/src/server/game/Grids/GridTerrainLoader.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/Grids/MapGrid.h b/src/server/game/Grids/MapGrid.h index c80c3b4d3f..cecad754a5 100644 --- a/src/server/game/Grids/MapGrid.h +++ b/src/server/game/Grids/MapGrid.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/Grids/MapGridManager.h b/src/server/game/Grids/MapGridManager.h index 3eb7c629d5..59f6e45c89 100644 --- a/src/server/game/Grids/MapGridManager.h +++ b/src/server/game/Grids/MapGridManager.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/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index 5dd717f321..36ed177442 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.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 @@ -83,7 +83,7 @@ void VisibleNotifier::SendToSelf() WorldPacket packet; i_data.BuildPacket(packet); - i_player.GetSession()->SendPacket(&packet); + i_player.SendDirectMessage(&packet); for (std::vector<Unit*>::const_iterator it = i_visibleNow.begin(); it != i_visibleNow.end(); ++it) i_player.GetInitialVisiblePackets(*it); diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index d35e8600c1..afb6b71bbc 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.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 @@ -126,7 +126,7 @@ namespace Acore if (!player->HaveAtClient(i_source)) return; - player->GetSession()->SendPacket(i_message); + player->SendDirectMessage(i_message); } }; @@ -151,7 +151,7 @@ namespace Acore if (player == i_source || !player->HaveAtClient(i_source) || player->IsFriendlyTo(i_source)) return; - player->GetSession()->SendPacket(i_message); + player->SendDirectMessage(i_message); } }; @@ -1092,10 +1092,9 @@ namespace Acore { return false; } - } - if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->IsDynamicObject() ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false)) + if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->IsDynamicObject() ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false, true)) return true; @@ -1192,7 +1191,7 @@ namespace Acore } bool operator()(Unit* u) { - if (!me->IsWithinDistInMap(u, m_range, true, false)) + if (!me->IsWithinDistInMap(u, m_range, true, false, false)) return false; if (!me->IsValidAttackTarget(u)) @@ -1218,7 +1217,7 @@ namespace Acore explicit NearestHostileUnitInAttackDistanceCheck(Creature const* creature, float dist) : me(creature), m_range(dist) {} bool operator()(Unit* u) { - if (!me->IsWithinDistInMap(u, m_range, true, false)) + if (!me->IsWithinDistInMap(u, m_range, true, false, false)) return false; if (!me->CanStartAttack(u)) diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h index a24e873745..3bbd580b1f 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h +++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.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/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index b4b2331e11..d2338ca813 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.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 @@ -580,14 +580,14 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R if (method == GROUP_REMOVEMETHOD_KICK || method == GROUP_REMOVEMETHOD_KICK_LFG) { data.Initialize(SMSG_GROUP_UNINVITE, 0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } // Do we really need to send this opcode? data.Initialize(SMSG_GROUP_LIST, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 8); data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0); data << m_guid << uint32(m_counter) << uint32(0) << uint64(0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } // Remove player from group in DB @@ -799,7 +799,7 @@ void Group::Disband(bool hideDestroy /* = false */) if (!hideDestroy) { data.Initialize(SMSG_GROUP_DESTROYED, 0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } //we already removed player from group and in player->GetGroup() is his original group, send update @@ -812,7 +812,7 @@ void Group::Disband(bool hideDestroy /* = false */) data.Initialize(SMSG_GROUP_LIST, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 8); data << uint8(0x10) << uint8(0) << uint8(0) << uint8(0); data << m_guid << uint32(m_counter) << uint32(0) << uint64(0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } } RollId.clear(); @@ -870,7 +870,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll& r) continue; if (itr->second == NOT_EMITED_YET) - p->GetSession()->SendPacket(&data); + p->SendDirectMessage(&data); } } @@ -893,7 +893,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, voteMask &= ~ROLL_FLAG_TYPE_NEED; data << uint8(voteMask); // roll type mask - p->GetSession()->SendPacket(&data); + p->SendDirectMessage(&data); } void Group::SendLootRoll(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll, bool autoPass) @@ -916,7 +916,7 @@ void Group::SendLootRoll(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 rol continue; if (itr->second != NOT_VALID) - p->GetSession()->SendPacket(&data); + p->SendDirectMessage(&data); } } @@ -939,7 +939,7 @@ void Group::SendLootRollWon(ObjectGuid sourceGuid, ObjectGuid targetGuid, uint8 continue; if (itr->second != NOT_VALID) - p->GetSession()->SendPacket(&data); + p->SendDirectMessage(&data); } } @@ -959,7 +959,7 @@ void Group::SendLootAllPassed(Roll const& roll) continue; if (itr->second != NOT_VALID) - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } } @@ -1353,7 +1353,7 @@ void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject) for (Player* looter : looters) { - looter->GetSession()->SendPacket(&data); + looter->SendDirectMessage(&data); } } @@ -1735,7 +1735,7 @@ void Group::SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot) data << uint8(m_raidDifficulty >= RAID_DIFFICULTY_10MAN_HEROIC); // 3.3 Dynamic Raid Difficulty - 0 normal/1 heroic } - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } void Group::UpdatePlayerOutOfRange(Player* player) @@ -1750,7 +1750,7 @@ void Group::UpdatePlayerOutOfRange(Player* player) { Player* member = itr->GetSource(); if (member && (!member->IsInMap(player) || !member->IsWithinDist(player, member->GetSightRange(player), false))) - member->GetSession()->SendPacket(&data); + member->SendDirectMessage(&data); } } @@ -1763,7 +1763,7 @@ void Group::BroadcastPacket(WorldPacket const* packet, bool ignorePlayersInBGRai continue; if (group == -1 || itr->getSubGroup() == group) - player->GetSession()->SendPacket(packet); + player->SendDirectMessage(packet); } } @@ -1774,7 +1774,7 @@ void Group::BroadcastReadyCheck(WorldPacket const* packet) Player* player = itr->GetSource(); if (player) if (IsLeader(player->GetGUID()) || IsAssistant(player->GetGUID())) - player->GetSession()->SendPacket(packet); + player->SendDirectMessage(packet); } } diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index acf6fc0e1d..c4a9b92627 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.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/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 81ba1deded..4ce8475385 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.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/Groups/GroupMgr.h b/src/server/game/Groups/GroupMgr.h index 72358121ac..7fa4d052fa 100644 --- a/src/server/game/Groups/GroupMgr.h +++ b/src/server/game/Groups/GroupMgr.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/Groups/GroupRefMgr.h b/src/server/game/Groups/GroupRefMgr.h index 025121d167..3a965d1955 100644 --- a/src/server/game/Groups/GroupRefMgr.h +++ b/src/server/game/Groups/GroupRefMgr.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/Groups/GroupReference.cpp b/src/server/game/Groups/GroupReference.cpp index 3e12577aa5..69f7df5135 100644 --- a/src/server/game/Groups/GroupReference.cpp +++ b/src/server/game/Groups/GroupReference.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/Groups/GroupReference.h b/src/server/game/Groups/GroupReference.h index ea0ec3e243..dec6e6586b 100644 --- a/src/server/game/Groups/GroupReference.h +++ b/src/server/game/Groups/GroupReference.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/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index a39c14b6b8..d388381215 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.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 @@ -2123,7 +2123,7 @@ void Guild::BroadcastToGuild(WorldSession* session, bool officerOnly, std::strin for (auto const& [guid, member] : m_members) if (Player* player = member.FindPlayer()) if (_HasRankRight(player, officerOnly ? GR_RIGHT_OFFCHATLISTEN : GR_RIGHT_GCHATLISTEN) && !player->GetSocial()->HasIgnore(session->GetPlayer()->GetGUID())) - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } } @@ -2132,14 +2132,14 @@ void Guild::BroadcastPacketToRank(WorldPacket const* packet, uint8 rankId) const for (auto const& [guid, member] : m_members) if (member.IsRank(rankId)) if (Player* player = member.FindPlayer()) - player->GetSession()->SendPacket(packet); + player->SendDirectMessage(packet); } void Guild::BroadcastPacket(WorldPacket const* packet) const { for (auto const& [guid, member] : m_members) if (Player* player = member.FindPlayer()) - player->GetSession()->SendPacket(packet); + player->SendDirectMessage(packet); } void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 maxLevel, uint32 minRank) diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 202041389d..ab5d47295d 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.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/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 3df4968def..bfa1986864 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.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/Guilds/GuildMgr.h b/src/server/game/Guilds/GuildMgr.h index ad645d7b6e..7f7e698572 100644 --- a/src/server/game/Guilds/GuildMgr.h +++ b/src/server/game/Guilds/GuildMgr.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/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp index fd8954907d..2ac47870c5 100644 --- a/src/server/game/Handlers/AddonHandler.cpp +++ b/src/server/game/Handlers/AddonHandler.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/Handlers/AddonHandler.h b/src/server/game/Handlers/AddonHandler.h index 3382b3e031..c8cd5f7c7b 100644 --- a/src/server/game/Handlers/AddonHandler.h +++ b/src/server/game/Handlers/AddonHandler.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/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp index e982f61fc4..65ad0e0c70 100644 --- a/src/server/game/Handlers/ArenaTeamHandler.cpp +++ b/src/server/game/Handlers/ArenaTeamHandler.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 @@ -160,7 +160,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData) WorldPacket data(SMSG_ARENA_TEAM_INVITE, (8 + 10)); data << GetPlayer()->GetName(); data << arenaTeam->GetName(); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_INVITE"); } diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index a3205df4b3..50df6f4d34 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.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/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp index 45a87579b9..52dcffdecd 100644 --- a/src/server/game/Handlers/AuthHandler.cpp +++ b/src/server/game/Handlers/AuthHandler.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/Handlers/BankHandler.cpp b/src/server/game/Handlers/BankHandler.cpp index 85e1bd8780..3138727194 100644 --- a/src/server/game/Handlers/BankHandler.cpp +++ b/src/server/game/Handlers/BankHandler.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/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index c66ea7361d..dba88af1b7 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.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 @@ -265,7 +265,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) { WorldPacket data; sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); - member->GetSession()->SendPacket(&data); + member->SendDirectMessage(&data); }); return; @@ -283,10 +283,10 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) // send status packet sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, member->AddBattlegroundQueueId(bgQueueTypeId), STATUS_WAIT_QUEUE, avgWaitTime, 0, 0, TEAM_NEUTRAL); - member->GetSession()->SendPacket(&data); + member->SendDirectMessage(&data); sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); - member->GetSession()->SendPacket(&data); + member->SendDirectMessage(&data); sScriptMgr->OnPlayerJoinBG(member); }); @@ -879,7 +879,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) if (err <= 0) { sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); - member->GetSession()->SendPacket(&data); + member->SendDirectMessage(&data); continue; } @@ -887,10 +887,10 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) // send status packet sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, queueSlot, STATUS_WAIT_QUEUE, avgWaitTime, 0, arenatype, TEAM_NEUTRAL, isRated); - member->GetSession()->SendPacket(&data); + member->SendDirectMessage(&data); sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); - member->GetSession()->SendPacket(&data); + member->SendDirectMessage(&data); LOG_DEBUG("bg.battleground", "Battleground: player joined queue for arena as group bg queue type {} bg type {}: {}, NAME {}", bgQueueTypeId, bgTypeId, member->GetGUID().ToString(), member->GetName()); diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 53cccbf4e0..d5b41e41c1 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.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 @@ -35,6 +35,7 @@ Copied events should probably have a new owner #include "ArenaTeamMgr.h" #include "CalendarMgr.h" +#include "CalendarPackets.h" #include "DatabaseEnv.h" #include "DisableMgr.h" #include "GameEventMgr.h" @@ -184,43 +185,31 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) SendPacket(&data); } -void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) +void WorldSession::HandleCalendarGetEvent(WorldPackets::Calendar::GetEvent& packet) { - uint64 eventId; - recvData >> eventId; + LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [{}] Event [{}]", _player->GetGUID().ToString(), packet.EventId); - LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [{}] Event [{}]", _player->GetGUID().ToString(), eventId); - - if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) + if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(packet.EventId)) sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET); else sCalendarMgr->SendCalendarCommandResult(_player->GetGUID(), CALENDAR_ERROR_EVENT_INVALID); } -void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) +void WorldSession::HandleCalendarGuildFilter(WorldPackets::Calendar::GuildFilter& packet) { LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [{}]", _player->GetGUID().ToString()); - uint32 minLevel; - uint32 maxLevel; - uint32 minRank; - - recvData >> minLevel >> maxLevel >> minRank; - if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId())) - guild->MassInviteToEvent(this, minLevel, maxLevel, minRank); + guild->MassInviteToEvent(this, packet.MinimumLevel, packet.MaximumLevel, packet.MinimumRank); - LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER: Min level [{}], Max level [{}], Min rank [{}]", minLevel, maxLevel, minRank); + LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER: Min level [{}], Max level [{}], Min rank [{}]", packet.MinimumLevel, packet.MaximumLevel, packet.MinimumRank); } -void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) +void WorldSession::HandleCalendarArenaTeam(WorldPackets::Calendar::ArenaTeam& packet) { LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [{}]", _player->GetGUID().ToString()); - uint32 arenaTeamId; - recvData >> arenaTeamId; - - if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(arenaTeamId)) + if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(packet.ArenaTeamId)) team->MassInviteToEvent(this); } @@ -763,14 +752,11 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID); } -void WorldSession::HandleCalendarComplain(WorldPacket& recvData) +void WorldSession::HandleCalendarComplain(WorldPackets::Calendar::CalendarComplain& packet) { ObjectGuid guid = _player->GetGUID(); - uint64 eventId; - ObjectGuid complainGUID; - recvData >> eventId >> complainGUID; - LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [{}] EventId [{}] guid [{}]", guid.ToString(), eventId, complainGUID.ToString()); + LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [{}] EventId [{}] guid [{}]", guid.ToString(), packet.EventId, packet.ComplainGuid.ToString()); // what to do with complains? } diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index 37c7a34c71..2193daaabe 100644 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.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/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 259bf34158..eeff0d3d64 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.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 @@ -668,51 +668,46 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) { - m_playerLoading = true; - ObjectGuid playerGuid; - recvData >> playerGuid; + if (!sWorld->getBoolConfig(CONFIG_REALM_LOGIN_ENABLED)) + { + SendCharLoginFailed(LoginFailureReason::NoWorld); + return; + } - if (PlayerLoading() || GetPlayer() != nullptr || !playerGuid.IsPlayer()) + if (PlayerLoading() || GetPlayer() != nullptr) { - // limit player interaction with the world - if (!sWorld->getBoolConfig(CONFIG_REALM_LOGIN_ENABLED)) - { - WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); - // see LoginFailureReason enum for more reasons - data << uint8(LoginFailureReason::NoWorld); - SendPacket(&data); - return; - } + LOG_ERROR("network", "Player tried to login again, AccountId = {}", GetAccountId()); + KickPlayer("WorldSession::HandlePlayerLoginOpcode Another client logging in"); + return; } - if (!playerGuid.IsPlayer() || !IsLegitCharacterForAccount(playerGuid)) + ObjectGuid playerGuid; + recvData >> playerGuid; + + if (!IsLegitCharacterForAccount(playerGuid)) { LOG_ERROR("network", "Account ({}) can't login with that character ({}).", GetAccountId(), playerGuid.ToString()); KickPlayer("Account can't login with this character"); return; } - auto SendCharLogin = [&](ResponseCodes result) - { - WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); - data << uint8(result); - SendPacket(&data); - }; - // pussywizard: if (WorldSession* sess = sWorldSessionMgr->FindOfflineSessionForCharacterGUID(playerGuid.GetCounter())) + { if (sess->GetAccountId() != GetAccountId()) { - SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER); + SendCharLoginFailed(LoginFailureReason::DuplicateCharacter); return; } + } + // pussywizard: if (WorldSession* sess = sWorldSessionMgr->FindOfflineSession(GetAccountId())) { Player* p = sess->GetPlayer(); if (!p || sess->IsKicked()) { - SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER); + SendCharLoginFailed(LoginFailureReason::DuplicateCharacter); return; } @@ -723,7 +718,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) // pussywizard: players stay ingame no matter what (prevent abuse), but allow to turn it off to stop crashing if (!sWorld->getBoolConfig(CONFIG_ENABLE_LOGIN_AFTER_DC)) { - SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER); + SendCharLoginFailed(LoginFailureReason::DuplicateCharacter); return; } @@ -765,7 +760,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) } if (!p->FindMap() || !p->IsInWorld() || sess->IsKicked()) { - SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER); + SendCharLoginFailed(LoginFailureReason::DuplicateCharacter); return; } @@ -781,11 +776,9 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) std::shared_ptr<LoginQueryHolder> holder = std::make_shared<LoginQueryHolder>(GetAccountId(), playerGuid); if (!holder->Initialize()) - { - m_playerLoading = false; return; - } + m_playerLoading = true; AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(holder)).AfterComplete([this](SQLQueryHolderBase const& holder) { HandlePlayerLoginFromDB(static_cast<LoginQueryHolder const&>(holder)); @@ -957,7 +950,6 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder) pCurrChar->CastSpell(pCurrChar, 20584, true, 0); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) - pCurrChar->SetMovement(MOVE_WATER_WALK); } // Set FFA PvP for non GM in non-rest mode @@ -1171,8 +1163,17 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar) SendPacket(&data); // Xinef: fix possible problem with flag UNIT_FLAG_STUNNED added during logout - if (!pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) + if (pCurrChar->HasUnitState(UNIT_STATE_LOGOUT_TIMER)) + { + pCurrChar->SetRooted(false, true, true); pCurrChar->RemoveUnitFlag(UNIT_FLAG_STUNNED); + } + + if (pCurrChar->GetPendingFlightChange() <= pCurrChar->GetMapChangeOrderCounter()) + { + if (!pCurrChar->HasIncreaseMountedFlightSpeedAura() && !pCurrChar->HasFlyAura()) + pCurrChar->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_CAN_FLY); + } pCurrChar->SendInitialPacketsBeforeAddToMap(); @@ -1761,9 +1762,21 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData) std::string name; recvData >> name; + if (name.length() > 16) // Client limitation + { + LOG_ERROR("entities.player.cheat", "Character GUID {} tried to create equipment set {} with too long a name!", _player->GetGUID().ToString(), setGuid); + return; + } + std::string iconName; recvData >> iconName; + if (iconName.length() > 100) // DB limitation + { + LOG_ERROR("entities.player.cheat", "Character GUID {} tried to create equipment set {} with too long an icon name!", _player->GetGUID().ToString(), setGuid); + return; + } + EquipmentSet eqSet; eqSet.Guid = setGuid; @@ -2575,6 +2588,13 @@ void WorldSession::SendCharDelete(ResponseCodes result) SendPacket(&data); } +void WorldSession::SendCharLoginFailed(LoginFailureReason reason) +{ + WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); + data << uint8(reason); + SendPacket(&data); +}; + void WorldSession::SendCharRename(ResponseCodes result, CharacterRenameInfo const* renameInfo) { WorldPacket data(SMSG_CHAR_RENAME, 1 + 8 + renameInfo->Name.size() + 1); diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 04337cd9c8..f191dc05ae 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.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 @@ -434,11 +434,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) return; if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group)) - { return; - } - - sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group); WorldPacket data; ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), sender, nullptr, msg); @@ -452,11 +448,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId())) { if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, guild)) - { return; - } - - sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild); guild->BroadcastToGuild(this, false, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); } @@ -470,11 +462,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId())) { if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, guild)) - { return; - } - - sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild); guild->BroadcastToGuild(this, true, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); } @@ -493,11 +481,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group)) - { return; - } - - sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID, Language(lang), sender, nullptr, msg); @@ -516,11 +500,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group)) - { return; - } - - sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_LEADER, Language(lang), sender, nullptr, msg); @@ -534,11 +514,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) return; if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group)) - { return; - } - - sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group); // In battleground, raid warning is sent only to players in battleground - code is ok WorldPacket data; @@ -554,11 +530,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) return; if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group)) - { return; - } - - sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND, Language(lang), sender, nullptr, msg); @@ -573,11 +545,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) return; if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group)) - { return; - } - - sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND_LEADER, Language(lang), sender, nullptr, msg); @@ -600,11 +568,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) if (Channel* chn = cMgr->GetChannel(channel, sender)) { if (!sScriptMgr->OnPlayerCanUseChat(sender, type, lang, msg, chn)) - { return; - } - - sScriptMgr->OnPlayerChat(sender, type, lang, msg, chn); chn->Say(sender->GetGUID(), msg.c_str(), lang); } @@ -633,11 +597,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } if (!sScriptMgr->OnPlayerCanUseChat(sender, type, lang, msg)) - { return; - } - - sScriptMgr->OnPlayerChat(sender, type, lang, msg); } break; } @@ -661,11 +621,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } if (!sScriptMgr->OnPlayerCanUseChat(sender, type, lang, msg)) - { return; - } - - sScriptMgr->OnPlayerChat(sender, type, lang, msg); break; } @@ -803,7 +759,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData) WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_IGNORED, LANG_UNIVERSAL, _player, _player, GetPlayer()->GetName()); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } void WorldSession::HandleChannelDeclineInvite(WorldPacket& recvPacket) diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index 4ea3cb00e2..7f945eb175 100644 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.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/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp index 88a3d7949b..ab34ee98bc 100644 --- a/src/server/game/Handlers/DuelHandler.cpp +++ b/src/server/game/Handlers/DuelHandler.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/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index c8f14779be..179a4469a8 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.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 @@ -149,7 +149,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) data << uint32(0); // unk data << uint8(0); // count data << uint32(0); // unk - invitedPlayer->GetSession()->SendPacket(&data); + invitedPlayer->SendDirectMessage(&data); } return; @@ -209,7 +209,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) data << uint32(0); // unk data << uint8(0); // count data << uint32(0); // unk - invitedPlayer->GetSession()->SendPacket(&data); + invitedPlayer->SendDirectMessage(&data); SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK); } @@ -292,7 +292,7 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recvData*/) // report WorldPacket data(SMSG_GROUP_DECLINE, GetPlayer()->GetName().length()); data << GetPlayer()->GetName(); - leader->GetSession()->SendPacket(&data); + leader->SendDirectMessage(&data); } void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index eac43c69b5..35134009dd 100644 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.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/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 880440a3dc..aef8767541 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.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/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 4a2fbbf1b5..934f6b84c6 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.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/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index f1b00066b5..50636f27c7 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.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 @@ -206,7 +206,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1); data << uint32(goldPerPlayer); data << uint8(playersNear.size() > 1 ? 0 : 1); // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..." - (*i)->GetSession()->SendPacket(&data); + (*i)->SendDirectMessage(&data); } } else diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 76cb7fc0d1..bcf3701625 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.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/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 942eae9c54..fd5167cbe1 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.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 @@ -468,7 +468,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequ GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT); } - GetPlayer()->SetRooted(true); + GetPlayer()->SetRooted(true, true, true); GetPlayer()->SetUnitFlag(UNIT_FLAG_STUNNED); } @@ -492,7 +492,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCance // not remove flags if can't free move - its not set in Logout request code. if (GetPlayer()->CanFreeMove()) { - GetPlayer()->SetRooted(false); + GetPlayer()->SetRooted(false, true, true); GetPlayer()->SetStandState(UNIT_STAND_STATE_STAND); GetPlayer()->RemoveUnitFlag(UNIT_FLAG_STUNNED); @@ -949,12 +949,6 @@ void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recv_data*/) GetPlayer()->GetCinematicMgr()->BeginCinematic(); } -void WorldSession::HandleFeatherFallAck(WorldPacket& recv_data) -{ - // no used - recv_data.rfinish(); // prevent warnings spam -} - void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) { uint8 ActionBar; @@ -1144,45 +1138,18 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) LOG_DEBUG("network", "Received whois command from player {} for character {}", GetPlayer()->GetName(), charname); } -void WorldSession::HandleComplainOpcode(WorldPacket& recv_data) +void WorldSession::HandleComplainOpcode(WorldPackets::Misc::Complain& packet) { LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN"); - uint8 spam_type; // 0 - mail, 1 - chat - ObjectGuid spammer_guid; - uint32 unk1 = 0; - uint32 unk2 = 0; - uint32 unk3 = 0; - uint32 unk4 = 0; - std::string description = ""; - recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat) - recv_data >> spammer_guid; // player guid - switch (spam_type) - { - case 0: - recv_data >> unk1; // const 0 - recv_data >> unk2; // probably mail id - recv_data >> unk3; // const 0 - break; - case 1: - recv_data >> unk1; // probably language - recv_data >> unk2; // message type? - recv_data >> unk3; // probably channel id - recv_data >> unk4; // unk random value - recv_data >> description; // spam description string (messagetype, channel name, player name, message) - break; - } - // NOTE: all chat messages from this spammer automatically ignored by spam reporter until logout in case chat spam. // if it's mail spam - ALL mails from this spammer automatically removed by client // Complaint Received message - WorldPacket data(SMSG_COMPLAIN_RESULT, 1); - data << uint8(0); - SendPacket(&data); + SendPacket(WorldPackets::Misc::ComplainResult().Write()); LOG_DEBUG("network", "REPORT SPAM: type {}, {}, unk1 {}, unk2 {}, unk3 {}, unk4 {}, message {}", - spam_type, spammer_guid.ToString(), unk1, unk2, unk3, unk4, description); + packet.SpamType, packet.SpammerGuid.ToString(), packet.Unk1, packet.Unk2, packet.Unk3, packet.Unk4, packet.Description); } void WorldSession::HandleRealmSplitOpcode(WorldPacket& recv_data) @@ -1519,12 +1486,15 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recv_data*/) _player->RemoveAurasByType(SPELL_AURA_MOUNTED); } -void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data) +void WorldSession::HandleMoveFlagChangeOpcode(WorldPacket& recv_data) { - // fly mode on/off - LOG_DEBUG("network", "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); + LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging((Opcodes)recv_data.GetOpcode())); + + Opcodes opcode = (Opcodes)recv_data.GetOpcode(); ObjectGuid guid; + uint32 counter; + uint32 isApplied; recv_data >> guid.ReadAsPacked(); if (!_player) @@ -1533,17 +1503,51 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data) return; } - recv_data.read_skip<uint32>(); // unk + recv_data >> counter; MovementInfo movementInfo; movementInfo.guid = guid; ReadMovementInfo(recv_data, &movementInfo); - recv_data.read_skip<float>(); // unk2 + if (opcode != CMSG_MOVE_GRAVITY_DISABLE_ACK && opcode != CMSG_MOVE_GRAVITY_ENABLE_ACK) + recv_data >> isApplied; sScriptMgr->AnticheatSetCanFlybyServer(_player, movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY)); - _player->m_mover->m_movementInfo.flags = movementInfo.GetMovementFlags(); + Unit* mover = _player->m_mover; + Player* plrMover = mover->ToPlayer(); + + mover->m_movementInfo.flags = movementInfo.GetMovementFlags(); + + // old map - async processing, ignore + if (counter <= _player->GetMapChangeOrderCounter()) + return; + + if (!ProcessMovementInfo(movementInfo, mover, plrMover, recv_data)) + { + recv_data.rfinish(); // prevent warnings spam + return; + } + + if (_player->GetPendingFlightChange() == counter && opcode == CMSG_MOVE_SET_CAN_FLY_ACK) + _player->SetPendingFlightChange(false); + + Opcodes response; + + switch (recv_data.GetOpcode()) + { + case CMSG_MOVE_HOVER_ACK: response = MSG_MOVE_HOVER; break; + case CMSG_MOVE_FEATHER_FALL_ACK: response = MSG_MOVE_FEATHER_FALL; break; + case CMSG_MOVE_WATER_WALK_ACK: response = MSG_MOVE_WATER_WALK; break; + case CMSG_MOVE_SET_CAN_FLY_ACK: response = MSG_MOVE_UPDATE_CAN_FLY; break; + case CMSG_MOVE_GRAVITY_DISABLE_ACK: response = MSG_MOVE_GRAVITY_CHNG; break; + case CMSG_MOVE_GRAVITY_ENABLE_ACK: response = MSG_MOVE_GRAVITY_CHNG; break; + default: return; + } + + WorldPacket data(response, 8); + WriteMovementInfo(&data, &movementInfo); + _player->m_mover->SendMessageToSet(&data, _player); } void WorldSession::HandleRequestPetInfo(WorldPackets::Pet::RequestPetInfo& /*packet*/) diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 77b5bb43bd..8e7e6c1f35 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.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 @@ -105,6 +105,13 @@ void WorldSession::HandleMoveWorldportAck() GetPlayer()->UpdatePositionData(); GetPlayer()->SendInitialPacketsBeforeAddToMap(); + + if (GetPlayer()->GetPendingFlightChange() <= GetPlayer()->GetMapChangeOrderCounter()) + { + if (!GetPlayer()->HasIncreaseMountedFlightSpeedAura() && !GetPlayer()->HasFlyAura()) + GetPlayer()->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_CAN_FLY); + } + if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer())) { LOG_ERROR("network.opcode", "WORLD: failed to teleport player {} ({}) to map {} because of unknown reason!", @@ -370,82 +377,46 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) movementInfo.guid = guid; ReadMovementInfo(recvData, &movementInfo); - // Stop emote on move - if (Player* plrMover = mover->ToPlayer()) - { - if (plrMover->GetUInt32Value(UNIT_NPC_EMOTESTATE) != EMOTE_ONESHOT_NONE && movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING)) - { - plrMover->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - } - } - - if (!movementInfo.pos.IsPositionValid()) + if (!ProcessMovementInfo(movementInfo, mover, plrMover, recvData)) { - if (plrMover) - { - sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo); - } - recvData.rfinish(); // prevent warnings spam return; } - if (!mover->movespline->Finalized()) - { - recvData.rfinish(); // prevent warnings spam + if (opcode == CMSG_MOVE_FALL_RESET || opcode == CMSG_MOVE_CHNG_TRANSPORT) return; - } - // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE - if (mover->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) - { - // Xinef: skip moving packets - if (movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING)) - { - if (plrMover) - { - sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo); - } - return; - } - movementInfo.pos.Relocate(mover->GetPositionX(), mover->GetPositionY(), mover->GetPositionZ()); + /* process position-change */ + WorldPacket data(opcode, recvData.size()); + WriteMovementInfo(&data, &movementInfo); + mover->SendMessageToSet(&data, _player); +} - if (mover->IsCreature()) - { - movementInfo.transport.guid = mover->m_movementInfo.transport.guid; - movementInfo.transport.pos.Relocate(mover->m_movementInfo.transport.pos.GetPositionX(), mover->m_movementInfo.transport.pos.GetPositionY(), mover->m_movementInfo.transport.pos.GetPositionZ()); - movementInfo.transport.seat = mover->m_movementInfo.transport.seat; - } +void WorldSession::SynchronizeMovement(MovementInfo& movementInfo) +{ + int64 movementTime = (int64)movementInfo.time + _timeSyncClockDelta; + if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF) + { + LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead"); + movementInfo.time = getMSTime(); } - - if (movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + else { - // We were teleported, skip packets that were broadcast before teleport - if (movementInfo.pos.GetExactDist2d(mover) > SIZE_OF_GRIDS) - { - if (plrMover) - { - sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo); - //LOG_INFO("anticheat", "MovementHandler:: 2 We were teleported, skip packets that were broadcast before teleport"); - } - recvData.rfinish(); // prevent warnings spam - return; - } + movementInfo.time = (uint32)movementTime; + } +} - if (!Acore::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.transport.pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.transport.pos.GetPositionY(), - movementInfo.pos.GetPositionZ() + movementInfo.transport.pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.transport.pos.GetOrientation())) - { - if (plrMover) - { - sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo); - } +void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo, Unit* mover) +{ + SynchronizeMovement(movementInfo); - recvData.rfinish(); // prevent warnings spam - return; - } + mover->UpdatePosition(movementInfo.pos); + mover->m_movementInfo = movementInfo; + if (mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + { // if we boarded a transport, add us to it - if (plrMover) + if (Player* plrMover = mover->ToPlayer()) { if (!plrMover->GetTransport()) { @@ -483,44 +454,95 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) } } } - else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave + else if (mover->IsPlayer()) { - sScriptMgr->AnticheatSetUnderACKmount(plrMover); // just for safe + if (Player* plrMover = mover->ToPlayer()) + { + if (plrMover->GetTransport()) // if we were on a transport, leave + { + sScriptMgr->AnticheatSetUnderACKmount(plrMover); // just for safe - plrMover->m_transport->RemovePassenger(plrMover); - plrMover->m_transport = nullptr; - movementInfo.transport.Reset(); + plrMover->m_transport->RemovePassenger(plrMover); + plrMover->m_transport = nullptr; + movementInfo.transport.Reset(); + } + } } - // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map). - if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->IsInFlight()) + // Some vehicles allow the passenger to turn by himself + if (Vehicle* vehicle = mover->GetVehicle()) { - plrMover->HandleFall(movementInfo); - - sScriptMgr->AnticheatSetJumpingbyOpcode(plrMover, false); + if (VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(mover)) + { + if (seat->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING && movementInfo.pos.GetOrientation() != mover->GetOrientation()) + { + mover->SetOrientation(movementInfo.pos.GetOrientation()); + mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING); + } + } } - // interrupt parachutes upon falling or landing in water - if (opcode == MSG_MOVE_FALL_LAND || opcode == MSG_MOVE_START_SWIM) + if (Player* plrMover = mover->ToPlayer()) // nothing is charmed, or player charmed { - mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // Parachutes + if (plrMover->IsSitState() && (movementInfo.flags & (MOVEMENTFLAG_MASK_MOVING | MOVEMENTFLAG_MASK_TURNING))) + plrMover->SetStandState(UNIT_STAND_STATE_STAND); + + if (movementInfo.pos.GetPositionZ() < plrMover->GetMap()->GetMinHeight(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY())) + { + if (!plrMover->GetBattleground() || !plrMover->GetBattleground()->HandlePlayerUnderMap(_player)) + { + if (plrMover->IsAlive()) + { + plrMover->SetPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS); + plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); + // player can be alive if GM + if (plrMover->IsAlive()) + plrMover->KillPlayer(); + } + else if (!plrMover->HasPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS)) + { + GraveyardStruct const* grave = sGraveyard->GetClosestGraveyard(plrMover, plrMover->GetTeamId()); + if (grave) + { + plrMover->TeleportTo(grave->Map, grave->x, grave->y, grave->z, plrMover->GetOrientation()); + plrMover->Relocate(grave->x, grave->y, grave->z, plrMover->GetOrientation()); + } + } + } + } + } +} +bool WorldSession::VerifyMovementInfo(MovementInfo const& movementInfo, Player* plrMover, Unit* mover, Opcodes opcode) const +{ + if (!movementInfo.pos.IsPositionValid()) + { if (plrMover) { - sScriptMgr->AnticheatSetJumpingbyOpcode(plrMover, false); + sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo); } + + return false; } - if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater()) + if (!mover->movespline->Finalized()) { - // now client not include swimming flag in case jumping under water - plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetMap()->IsUnderWater(plrMover->GetPhaseMask(), movementInfo.pos.GetPositionX(), - movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ(), plrMover->GetCollisionHeight())); + if (!mover->movespline->isBoarding() || (opcode != CMSG_FORCE_MOVE_UNROOT_ACK && opcode != CMSG_FORCE_MOVE_ROOT_ACK)) + return false; } - if (plrMover)//Hook for OnPlayerMove + // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE + if (mover->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) { - sScriptMgr->OnPlayerMove(plrMover, movementInfo, opcode); + // Xinef: skip moving packets + if (movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING)) + { + if (plrMover) + { + sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo); + } + return false; + } } bool jumpopcode = false; @@ -530,7 +552,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) if (plrMover && !sScriptMgr->AnticheatHandleDoubleJump(plrMover, mover)) { plrMover->GetSession()->KickPlayer(); - return; + return false; } } @@ -538,74 +560,104 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) if (plrMover && !sScriptMgr->AnticheatCheckMovementInfo(plrMover, movementInfo, mover, jumpopcode)) { plrMover->GetSession()->KickPlayer(); - return; + return false; } - /* process position-change */ - WorldPacket data(opcode, recvData.size()); - int64 movementTime = (int64)movementInfo.time + _timeSyncClockDelta; - if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF) + if (movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) { - LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead"); - movementInfo.time = getMSTime(); + // We were teleported, skip packets that were broadcast before teleport + if (movementInfo.pos.GetExactDist2d(mover) > SIZE_OF_GRIDS) + { + if (plrMover) + { + sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo); + //LOG_INFO("anticheat", "MovementHandler:: 2 We were teleported, skip packets that were broadcast before teleport"); + } + return false; + } + + if (!Acore::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.transport.pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.transport.pos.GetPositionY(), + movementInfo.pos.GetPositionZ() + movementInfo.transport.pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.transport.pos.GetOrientation())) + { + if (plrMover) + { + sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo); + } + + return false; + } } - else + + // rooted mover sent packet without root or moving AND root - ignore, due to client crash possibility + if (opcode != CMSG_FORCE_MOVE_UNROOT_ACK) + if (mover->IsRooted() && (!movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT) || movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING))) + return false; + + return true; +} + +bool WorldSession::ProcessMovementInfo(MovementInfo& movementInfo, Unit* mover, Player* plrMover, WorldPacket& recvData) +{ + Opcodes opcode = (Opcodes)recvData.GetOpcode(); + if (!VerifyMovementInfo(movementInfo, plrMover, mover, opcode)) + return false; + + if (mover->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) { - movementInfo.time = (uint32) movementTime; + movementInfo.pos.Relocate(mover->GetPositionX(), mover->GetPositionY(), mover->GetPositionZ()); + + if (mover->IsCreature()) + { + movementInfo.transport.guid = mover->m_movementInfo.transport.guid; + movementInfo.transport.pos.Relocate(mover->m_movementInfo.transport.pos.GetPositionX(), mover->m_movementInfo.transport.pos.GetPositionY(), mover->m_movementInfo.transport.pos.GetPositionZ()); + movementInfo.transport.seat = mover->m_movementInfo.transport.seat; + } } - movementInfo.guid = mover->GetGUID(); - WriteMovementInfo(&data, &movementInfo); - mover->SendMessageToSet(&data, _player); + // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map). + if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->IsInFlight()) + { + plrMover->HandleFall(movementInfo); - mover->m_movementInfo = movementInfo; + sScriptMgr->AnticheatSetJumpingbyOpcode(plrMover, false); + } - // Some vehicles allow the passenger to turn by himself - if (Vehicle* vehicle = mover->GetVehicle()) + // interrupt parachutes upon falling or landing in water + if (opcode == MSG_MOVE_FALL_LAND || opcode == MSG_MOVE_START_SWIM) { - if (VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(mover)) + mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // Parachutes + + if (plrMover) { - if (seat->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING && movementInfo.pos.GetOrientation() != mover->GetOrientation()) - { - mover->SetOrientation(movementInfo.pos.GetOrientation()); - mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING); - } + sScriptMgr->AnticheatSetJumpingbyOpcode(plrMover, false); } + } - return; + if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater()) + { + // now client not include swimming flag in case jumping under water + plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetMap()->IsUnderWater(plrMover->GetPhaseMask(), movementInfo.pos.GetPositionX(), + movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ(), plrMover->GetCollisionHeight())); } - mover->UpdatePosition(movementInfo.pos); + if (plrMover)//Hook for OnPlayerMove + { + sScriptMgr->OnPlayerMove(plrMover, movementInfo, opcode); + } - if (plrMover) // nothing is charmed, or player charmed + if (movementInfo.GetMovementFlags() & MOVEMENTFLAG_MASK_MOVING_OR_TURN) { - if (plrMover->IsSitState() && (movementInfo.flags & (MOVEMENTFLAG_MASK_MOVING | MOVEMENTFLAG_MASK_TURNING))) - plrMover->SetStandState(UNIT_STAND_STATE_STAND); + if (mover->IsStandState()) + mover->SetStandState(UNIT_STAND_STATE_STAND); + mover->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + } + + HandleMoverRelocation(movementInfo, mover); + if (plrMover && opcode != CMSG_MOVE_KNOCK_BACK_ACK) plrMover->UpdateFallInformationIfNeed(movementInfo, opcode); - if (movementInfo.pos.GetPositionZ() < plrMover->GetMap()->GetMinHeight(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY())) - if (!plrMover->GetBattleground() || !plrMover->GetBattleground()->HandlePlayerUnderMap(_player)) - { - if (plrMover->IsAlive()) - { - plrMover->SetPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS); - plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); - // player can be alive if GM - if (plrMover->IsAlive()) - plrMover->KillPlayer(); - } - else if (!plrMover->HasPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS)) - { - GraveyardStruct const* grave = sGraveyard->GetClosestGraveyard(plrMover, plrMover->GetTeamId()); - if (grave) - { - plrMover->TeleportTo(grave->Map, grave->x, grave->y, grave->z, plrMover->GetOrientation()); - plrMover->Relocate(grave->x, grave->y, grave->z, plrMover->GetOrientation()); - } - } - } - } + return true; } void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData) @@ -615,26 +667,43 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData) /* extract packet */ ObjectGuid guid; - uint32 unk1; + uint32 counter; + MovementInfo movementInfo; float newspeed; recvData >> guid.ReadAsPacked(); + recvData >> counter; // counter or moveEvent + movementInfo.guid = guid; + ReadMovementInfo(recvData, &movementInfo); + recvData >> newspeed; + + Unit* mover = _player->m_mover; // pussywizard: special check, only player mover allowed here - if (guid != _player->m_mover->GetGUID() || guid != _player->GetGUID()) + if (guid != mover->GetGUID() || guid != _player->GetGUID()) { recvData.rfinish(); // prevent warnings spam return; } - // continue parse packet - recvData >> unk1; // counter or moveEvent + // old map - async processing, ignore + if (counter <= _player->GetMapChangeOrderCounter()) + return; - MovementInfo movementInfo; - movementInfo.guid = guid; - ReadMovementInfo(recvData, &movementInfo); + if (!ProcessMovementInfo(movementInfo, mover, _player, recvData)) + { + recvData.rfinish(); // prevent warnings spam + return; + } - recvData >> newspeed; + if (opcode == CMSG_MOVE_SET_COLLISION_HGT_ACK) + { + WorldPacket data(MSG_MOVE_SET_COLLISION_HGT, 18); + WriteMovementInfo(&data, &movementInfo); + data << newspeed; // new collision height + mover->SendMessageToSet(&data, _player); + return; + } // client ACK send one packet for mounted/run case and need skip all except last from its // in other cases anti-cheat check can be fail in false case @@ -645,42 +714,15 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData) switch (opcode) { - case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: - move_type = MOVE_WALK; - force_move_type = MOVE_WALK; - break; - case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: - move_type = MOVE_RUN; - force_move_type = MOVE_RUN; - break; - case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK: - move_type = MOVE_RUN_BACK; - force_move_type = MOVE_RUN_BACK; - break; - case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK: - move_type = MOVE_SWIM; - force_move_type = MOVE_SWIM; - break; - case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: - move_type = MOVE_SWIM_BACK; - force_move_type = MOVE_SWIM_BACK; - break; - case CMSG_FORCE_TURN_RATE_CHANGE_ACK: - move_type = MOVE_TURN_RATE; - force_move_type = MOVE_TURN_RATE; - break; - case CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK: - move_type = MOVE_FLIGHT; - force_move_type = MOVE_FLIGHT; - break; - case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: - move_type = MOVE_FLIGHT_BACK; - force_move_type = MOVE_FLIGHT_BACK; - break; - case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: - move_type = MOVE_PITCH_RATE; - force_move_type = MOVE_PITCH_RATE; - break; + case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break; + case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break; + case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK: move_type = MOVE_RUN_BACK; force_move_type = MOVE_RUN_BACK; break; + case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = MOVE_SWIM; force_move_type = MOVE_SWIM; break; + case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: move_type = MOVE_SWIM_BACK; force_move_type = MOVE_SWIM_BACK; break; + case CMSG_FORCE_TURN_RATE_CHANGE_ACK: move_type = MOVE_TURN_RATE; force_move_type = MOVE_TURN_RATE; break; + case CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT; force_move_type = MOVE_FLIGHT; break; + case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break; + case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break; default: LOG_ERROR("network.opcode", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: {}", opcode); return; @@ -688,6 +730,12 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData) sScriptMgr->AnticheatSetUnderACKmount(_player); + SpeedOpcodePair const& speedOpcodes = SetSpeed2Opc_table[move_type]; + WorldPacket data(speedOpcodes[static_cast<size_t>(SpeedOpcodeIndex::ACK_RESPONSE)], 18); + WriteMovementInfo(&data, &movementInfo); + data << newspeed; + mover->SendMessageToSet(&data, _player); + // skip all forced speed changes except last and unexpected // in run/mounted case used one ACK and it must be skipped.m_forced_speed_changes[MOVE_RUN} store both. if (_player->m_forced_speed_changes[force_move_type] > 0) @@ -762,11 +810,13 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) { LOG_DEBUG("network", "CMSG_MOVE_KNOCK_BACK_ACK"); + Unit* mover = _player->m_mover; + ObjectGuid guid; recvData >> guid.ReadAsPacked(); // pussywizard: typical check for incomming movement packets - if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID()) + if (!mover || !mover->IsInWorld() || mover->IsDuringRemoveFromWorld() || guid != mover->GetGUID()) { recvData.rfinish(); // prevent warnings spam return; @@ -778,7 +828,10 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) movementInfo.guid = guid; ReadMovementInfo(recvData, &movementInfo); - _player->m_mover->m_movementInfo = movementInfo; + mover->m_movementInfo = movementInfo; + + if (mover->IsPlayer() && static_cast<Player*>(mover)->IsFreeFlying()) + mover->SetCanFly(true); WorldPacket data(MSG_MOVE_KNOCK_BACK, 66); data << guid.WriteAsPacked(); @@ -793,38 +846,6 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) _player->SendMessageToSet(&data, false); } -void WorldSession::HandleMoveHoverAck(WorldPacket& recvData) -{ - LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK"); - - ObjectGuid guid; - recvData >> guid.ReadAsPacked(); - - recvData.read_skip<uint32>(); // unk - - MovementInfo movementInfo; - movementInfo.guid = guid; - ReadMovementInfo(recvData, &movementInfo); - - recvData.read_skip<uint32>(); // unk2 -} - -void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData) -{ - LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK"); - - ObjectGuid guid; - recvData >> guid.ReadAsPacked(); - - recvData.read_skip<uint32>(); // unk - - MovementInfo movementInfo; - movementInfo.guid = guid; - ReadMovementInfo(recvData, &movementInfo); - - recvData.read_skip<uint32>(); // unk2 -} - void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData) { if (!_player->IsAlive() || _player->IsInCombat()) @@ -954,79 +975,44 @@ void WorldSession::ComputeNewClockDelta() void WorldSession::HandleMoveRootAck(WorldPacket& recvData) { - ObjectGuid guid; - recvData >> guid.ReadAsPacked(); - - Unit* mover = _player->m_mover; - if (!mover || guid != mover->GetGUID()) - { - recvData.rfinish(); // prevent warnings spam - return; - } - - uint32 movementCounter; - recvData >> movementCounter; + Opcodes opcode = (Opcodes)recvData.GetOpcode(); + LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging(opcode)); + ObjectGuid guid; + uint32 counter; MovementInfo movementInfo; + recvData >> guid.ReadAsPacked(); + recvData >> counter; movementInfo.guid = guid; ReadMovementInfo(recvData, &movementInfo); - /* process position-change */ - int64 movementTime = (int64) movementInfo.time + _timeSyncClockDelta; - if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF) - { - LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead"); - movementInfo.time = getMSTime(); - } - else - { - movementInfo.time = (uint32)movementTime; - } - - movementInfo.guid = mover->GetGUID(); - mover->m_movementInfo = movementInfo; - mover->UpdatePosition(movementInfo.pos); - -} - -void WorldSession::HandleMoveUnRootAck(WorldPacket& recvData) -{ - ObjectGuid guid; - recvData >> guid.ReadAsPacked(); - Unit* mover = _player->m_mover; - if (!mover || guid != mover->GetGUID()) - { - recvData.rfinish(); // prevent warnings spam - return; - } - uint32 movementCounter; - recvData >> movementCounter; - - MovementInfo movementInfo; - movementInfo.guid = guid; - ReadMovementInfo(recvData, &movementInfo); + if (mover->GetGUID() != guid) + return; - /* process position-change */ - int64 movementTime = (int64) movementInfo.time + _timeSyncClockDelta; - if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF) + if (opcode == CMSG_FORCE_MOVE_UNROOT_ACK) // unroot case { - LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead"); - movementInfo.time = getMSTime(); + if (!mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT)) + return; } - else + else // root case { - movementInfo.time = (uint32)movementTime; + if (mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT)) + return; } - if (G3D::fuzzyEq(movementInfo.fallTime, 0.f)) - { - movementInfo.RemoveMovementFlag(MOVEMENTFLAG_FALLING); - } + // old map - async processing, ignore + if (counter <= _player->GetMapChangeOrderCounter()) + return; - movementInfo.guid = mover->GetGUID(); - mover->m_movementInfo = movementInfo; - mover->UpdatePosition(movementInfo.pos); + if (!ProcessMovementInfo(movementInfo, mover, _player, recvData)) + return; + + if (_player->IsExpectingChangeTransport()) + return; + WorldPacket data(opcode == CMSG_FORCE_MOVE_UNROOT_ACK ? MSG_MOVE_UNROOT : MSG_MOVE_ROOT); + WriteMovementInfo(&data, &movementInfo); + mover->SendMessageToSet(&data, _player); } diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index b969e81057..66b7d01af1 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.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/Handlers/NPCHandler.h b/src/server/game/Handlers/NPCHandler.h index 9a4511d008..1cdb7cd14f 100644 --- a/src/server/game/Handlers/NPCHandler.h +++ b/src/server/game/Handlers/NPCHandler.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/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 38b66926e5..d445be9ed7 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.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 @@ -262,8 +262,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe pet->ToCreature()->AI()->AttackStart(TargetUnit); //10% chance to play special pet attack talk, else growl - if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10) - pet->SendPetTalk((uint32)PET_TALK_ATTACK); + if (pet->IsPet() && pet->ToPet()->getPetType() == SUMMON_PET && pet != TargetUnit && roll_chance_i(10)) + pet->SendPetActionSound(PET_ACTION_ATTACK); else { // 90% chance for pet and 100% chance for charmed creature @@ -297,8 +297,11 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe if (pet->ToPet()->getPetType() == HUNTER_PET) GetPlayer()->RemovePet(pet->ToPet(), PET_SAVE_AS_DELETED); else + { + pet->SendPetDismissSound(); //dismissing a summoned pet is like killing them (this prevents returning a soulshard...) pet->setDeathState(DeathState::Corpse); + } } else if (pet->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_SUMMON | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLLABLE_GUARDIAN)) { @@ -413,8 +416,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe //10% chance to play special pet attack talk, else growl //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell - if (pet->IsPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10)) - pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL); + if (pet->IsPet() && (pet->ToPet()->getPetType() == SUMMON_PET) && (pet != unit_target) && roll_chance_i(10)) + pet->SendPetActionSound(PET_ACTION_SPECIAL_SPELL); else { pet->SendPetAIReaction(guid1); @@ -509,8 +512,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe pet->ToCreature()->AI()->AttackStart(TargetUnit); - if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10) - pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL); + if (pet->IsPet() && pet->ToPet()->getPetType() == SUMMON_PET && pet != TargetUnit && roll_chance_i(10)) + pet->SendPetActionSound(PET_ACTION_SPECIAL_SPELL); else pet->SendPetAIReaction(guid1); } @@ -558,8 +561,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe pet->GetMotionMaster()->MoveFollow(unit_target, PET_FOLLOW_DIST, rand_norm() * 2 * M_PI); - if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != unit_target && urand(0, 100) < 10) - pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL); + if (pet->IsPet() && pet->ToPet()->getPetType() == SUMMON_PET && pet != unit_target && roll_chance_i(10)) + pet->SendPetActionSound(PET_ACTION_SPECIAL_SPELL); else { pet->SendPetAIReaction(guid1); @@ -1059,8 +1062,8 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { // 10% chance to play special pet attack talk, else growl // actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell - if (pet->getPetType() == SUMMON_PET && (urand(0, 100) < 10)) - pet->SendPetTalk(PET_TALK_SPECIAL_SPELL); + if (pet->getPetType() == SUMMON_PET && roll_chance_i(10)) + pet->SendPetActionSound(PET_ACTION_SPECIAL_SPELL); else pet->SendPetAIReaction(guid); } diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index 7ff2091d40..7ce5870153 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.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 @@ -494,7 +494,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) // update for owner if online if (Player* owner = ObjectAccessor::FindConnectedPlayer(petition->ownerGuid)) - owner->GetSession()->SendPacket(&data); + owner->SendDirectMessage(&data); return; } @@ -527,7 +527,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) // update for owner if online if (Player* owner = ObjectAccessor::FindConnectedPlayer(petition->ownerGuid)) - owner->GetSession()->SendPacket(&data); + owner->SendDirectMessage(&data); } void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData) @@ -547,7 +547,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData) { WorldPacket data(MSG_PETITION_DECLINE, 8); data << _player->GetGUID(); - owner->GetSession()->SendPacket(&data); + owner->SendDirectMessage(&data); } } @@ -639,7 +639,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) data << uint32(0); // there 0 ... } - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 604977301b..478dbe5abe 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.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/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 80063d6382..946d23b851 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.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 @@ -625,7 +625,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) WorldPacket data(MSG_QUEST_PUSH_RESULT, 8 + 4 + 1); data << _player->GetGUID(); data << uint8(msg); // valid values: 0-8 - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); _player->SetDivider(); } } diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp index e616d7b47b..20d17e86fd 100644 --- a/src/server/game/Handlers/ReferAFriendHandler.cpp +++ b/src/server/game/Handlers/ReferAFriendHandler.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 @@ -60,7 +60,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData) WorldPacket data2(SMSG_PROPOSE_LEVEL_GRANT, 8); data2 << _player->GetPackGUID(); - target->GetSession()->SendPacket(&data2); + target->SendDirectMessage(&data2); } void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData) diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 5768900cc5..0cc383454b 100644 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.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/Handlers/Socialhandler.cpp b/src/server/game/Handlers/Socialhandler.cpp index 5a4557cc95..6fccfa1d30 100644 --- a/src/server/game/Handlers/Socialhandler.cpp +++ b/src/server/game/Handlers/Socialhandler.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/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 6117637db6..0ab498b43b 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.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/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 8a76a2bd63..4fd089b6b2 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.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 @@ -198,54 +198,70 @@ void WorldSession::HandleActivateTaxiExpressOpcode(WorldPacket& recvData) void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) { - ObjectGuid guid; // used only for proper packet read - recvData >> guid.ReadAsPacked(); - - MovementInfo movementInfo; // used only for proper packet read - movementInfo.guid = guid; - ReadMovementInfo(recvData, &movementInfo); + ObjectGuid guid; // used only for proper packet read + MovementInfo movementInfo; // used only for proper packet read + uint32 movementCounter; // spline counter - recvData.read_skip<uint32>(); // spline id + Unit* mover = _player->m_mover; - // in taxi flight packet received in 2 case: - // 1) end taxi path in far (multi-node) flight - // 2) switch from one map to other in case multim-map taxi path - // we need process only (1) + recvData >> guid.ReadAsPacked(); + ReadMovementInfo(recvData, &movementInfo); + recvData >> movementCounter; - uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination(); - if (curDest) + if (_player->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_TAXI_FLIGHT)) // taxi spline case { - TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest); + // in taxi flight packet received in 2 case: + // 1) end taxi path in far (multi-node) flight + // 2) switch from one map to other in case multim-map taxi path + // we need process only (1) - // far teleport case - if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE) + uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination(); + if (curDest) { - if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top())) - { - // short preparations to continue flight - flight->SetCurrentNodeAfterTeleport(); - TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()]; - flight->SkipCurrentNode(); + TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest); - GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI); + // far teleport case + if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE) + { + if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top())) + { + // short preparations to continue flight + flight->SetCurrentNodeAfterTeleport(); + TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()]; + flight->SkipCurrentNode(); + + GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI); + } } + + return; } + // at this point only 1 node is expected (final destination) + if (GetPlayer()->m_taxi.GetPath().size() != 1) + { + return; + } + + GetPlayer()->CleanupAfterTaxiFlight(); + GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ()); + if (GetPlayer()->pvpInfo.IsHostile) + { + GetPlayer()->CastSpell(GetPlayer(), 2479, true); + } return; } - // at this point only 1 node is expected (final destination) - if (GetPlayer()->m_taxi.GetPath().size() != 1) - { + if (mover->GetGUID() != guid) return; - } - GetPlayer()->CleanupAfterTaxiFlight(); - GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ()); - if (GetPlayer()->pvpInfo.IsHostile) - { - GetPlayer()->CastSpell(GetPlayer(), 2479, true); - } + if (!_player->IsExpectingChangeTransport() || !mover->movespline || mover->movespline->GetId() != movementCounter) + return; + + _player->SetExpectingChangeTransport(false); + WorldPacket data(_player->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT) ? MSG_MOVE_ROOT : MSG_MOVE_UNROOT, recvData.size()); + WriteMovementInfo(&data, &movementInfo); + mover->SendMessageToSet(&data, _player); } void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData) diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index 089546aa51..9ab4fb3442 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.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/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index ce316965ef..6bef09eb0e 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.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 @@ -646,7 +646,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) WorldPacket data(SMSG_TRADE_STATUS, 12); data << uint32(TRADE_STATUS_BEGIN_TRADE); data << _player->GetGUID(); - pOther->GetSession()->SendPacket(&data); + pOther->SendDirectMessage(&data); } void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket) diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index 180cb6c293..28b5a83a3c 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.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/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp index 1badb072f4..c81eff848d 100644 --- a/src/server/game/Handlers/VoiceChatHandler.cpp +++ b/src/server/game/Handlers/VoiceChatHandler.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/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 5088742c80..da03677fe0 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.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/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index 686a6fe729..ce9cd722a7 100644 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.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/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index bb510cf128..5b72b94647 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.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/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 86ec413a9b..b10db66e9e 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.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/Loot/LootItemStorage.cpp b/src/server/game/Loot/LootItemStorage.cpp index 434ad43250..6d66e83515 100644 --- a/src/server/game/Loot/LootItemStorage.cpp +++ b/src/server/game/Loot/LootItemStorage.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/Loot/LootItemStorage.h b/src/server/game/Loot/LootItemStorage.h index c1b2771421..10d7685298 100644 --- a/src/server/game/Loot/LootItemStorage.h +++ b/src/server/game/Loot/LootItemStorage.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/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index b5bcbea318..59a6c9d204 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.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/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index ebdfc2d3dc..d906a56a09 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.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/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index f8d838776f..81bc4085f6 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.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/Mails/Mail.h b/src/server/game/Mails/Mail.h index f89a5e1271..0f9bc71d0d 100644 --- a/src/server/game/Mails/Mail.h +++ b/src/server/game/Mails/Mail.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/Mails/ServerMailMgr.cpp b/src/server/game/Mails/ServerMailMgr.cpp index 8ed35ffc17..9f8d05377c 100644 --- a/src/server/game/Mails/ServerMailMgr.cpp +++ b/src/server/game/Mails/ServerMailMgr.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/Mails/ServerMailMgr.h b/src/server/game/Mails/ServerMailMgr.h index 12eee5113d..73092d5467 100644 --- a/src/server/game/Mails/ServerMailMgr.h +++ b/src/server/game/Mails/ServerMailMgr.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/Maps/AreaBoundary.cpp b/src/server/game/Maps/AreaBoundary.cpp index e5b1848761..80bacdc841 100644 --- a/src/server/game/Maps/AreaBoundary.cpp +++ b/src/server/game/Maps/AreaBoundary.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/Maps/AreaBoundary.h b/src/server/game/Maps/AreaBoundary.h index 48a5e66713..392bfef22d 100644 --- a/src/server/game/Maps/AreaBoundary.h +++ b/src/server/game/Maps/AreaBoundary.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/Maps/AreaDefines.h b/src/server/game/Maps/AreaDefines.h index a7af304579..1730cd09d4 100644 --- a/src/server/game/Maps/AreaDefines.h +++ b/src/server/game/Maps/AreaDefines.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/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index de0e4a9bd6..0ea47ff8ab 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.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 @@ -54,6 +54,10 @@ Map::~Map() { // UnloadAll must be called before deleting the map + // Kill all scheduled events without executing them, since the map and its objects are being destroyed. + // This prevents events from running on invalid or deleted objects during map destruction. + Events.KillAllEvents(false); + sScriptMgr->OnDestroyMap(this); if (!m_scriptSchedule.empty()) @@ -417,12 +421,12 @@ void Map::UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone) if (oldZone != MAP_INVALID_ZONE) { uint32& oldZoneCount = _zonePlayerCountMap[oldZone]; - if (!oldZoneCount) - LOG_ERROR("maps", "A player left zone {} (went to {}) - but there were no players in the zone!", oldZone, newZone); - else + if (oldZoneCount) --oldZoneCount; } - ++_zonePlayerCountMap[newZone]; + + if (newZone != MAP_INVALID_ZONE) + ++_zonePlayerCountMap[newZone]; } void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/) @@ -447,7 +451,7 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/) } } - _creatureRespawnScheduler.Update(t_diff); + Events.Update(t_diff); if (!t_diff) { @@ -696,8 +700,8 @@ struct ResetNotifier void Map::RemovePlayerFromMap(Player* player, bool remove) { - // Before leaving map, update zone/area for stats - player->UpdateZone(MAP_INVALID_ZONE, 0); + UpdatePlayerZoneStats(player->GetZoneId(), MAP_INVALID_ZONE); + player->getHostileRefMgr().deleteReferences(true); // pussywizard: multithreading crashfix player->RemoveFromWorld(); @@ -725,8 +729,6 @@ void Map::RemoveFromMap(T* obj, bool remove) obj->RemoveFromWorld(); obj->RemoveFromGrid(); - if (obj->IsFarVisible()) - RemoveWorldObjectFromFarVisibleMap(obj); obj->ResetMap(); @@ -1099,7 +1101,7 @@ float Map::GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, fl if (ground) *ground = ground_z; - LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phasemask, x, y, ground_z, collisionHeight, MAP_ALL_LIQUIDS); + LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phasemask, x, y, ground_z, collisionHeight, {}); switch (liquidData.Status) { case LIQUID_MAP_ABOVE_WATER: @@ -1200,27 +1202,18 @@ static inline bool IsInWMOInterior(uint32 mogpFlags) bool Map::GetAreaInfo(uint32 phaseMask, float x, float y, float z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const { - float vmap_z = z; - float dynamic_z = z; float check_z = z; VMAP::IVMapMgr* vmgr = VMAP::VMapFactory::createOrGetVMapMgr(); - uint32 vflags; - int32 vadtId; - int32 vrootId; - int32 vgroupId; - uint32 dflags; - int32 dadtId; - int32 drootId; - int32 dgroupId; - - bool hasVmapAreaInfo = vmgr->GetAreaInfo(GetId(), x, y, vmap_z, vflags, vadtId, vrootId, vgroupId); - bool hasDynamicAreaInfo = _dynamicTree.GetAreaInfo(x, y, dynamic_z, phaseMask, dflags, dadtId, drootId, dgroupId); - auto useVmap = [&]() { check_z = vmap_z; flags = vflags; adtId = vadtId; rootId = vrootId; groupId = vgroupId; }; - auto useDyn = [&]() { check_z = dynamic_z; flags = dflags; adtId = dadtId; rootId = drootId; groupId = dgroupId; }; + VMAP::AreaAndLiquidData vdata; + VMAP::AreaAndLiquidData ddata; + bool hasVmapAreaInfo = vmgr->GetAreaAndLiquidData(GetId(), x, y, z, {}, vdata) && vdata.areaInfo.has_value(); + bool hasDynamicAreaInfo = _dynamicTree.GetAreaAndLiquidData(x, y, z, phaseMask, {}, ddata) && ddata.areaInfo.has_value(); + auto useVmap = [&] { check_z = vdata.floorZ; groupId = vdata.areaInfo->groupId; adtId = vdata.areaInfo->adtId; rootId = vdata.areaInfo->rootId; flags = vdata.areaInfo->mogpFlags; }; + auto useDyn = [&] { check_z = ddata.floorZ; groupId = ddata.areaInfo->groupId; adtId = ddata.areaInfo->adtId; rootId = ddata.areaInfo->rootId; flags = ddata.areaInfo->mogpFlags; }; if (hasVmapAreaInfo) { - if (hasDynamicAreaInfo && dynamic_z > vmap_z) + if (hasDynamicAreaInfo && ddata.floorZ > vdata.floorZ) useDyn(); else useVmap(); @@ -1301,32 +1294,30 @@ void Map::GetZoneAndAreaId(uint32 phaseMask, uint32& zoneid, uint32& areaid, flo zoneid = area->zone; } -LiquidData const Map::GetLiquidData(uint32 phaseMask, float x, float y, float z, float collisionHeight, uint8 ReqLiquidType) +LiquidData const Map::GetLiquidData(uint32 phaseMask, float x, float y, float z, float collisionHeight, Optional<uint8> ReqLiquidType) { LiquidData liquidData; + liquidData.Status = LIQUID_MAP_NO_WATER; VMAP::IVMapMgr* vmgr = VMAP::VMapFactory::createOrGetVMapMgr(); - float liquid_level = INVALID_HEIGHT; - float ground_level = INVALID_HEIGHT; - uint32 liquid_type = 0; - uint32 mogpFlags = 0; + VMAP::AreaAndLiquidData vmapData; bool useGridLiquid = true; - if (vmgr->GetLiquidLevel(GetId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type, mogpFlags)) + if (vmgr->GetAreaAndLiquidData(GetId(), x, y, z, ReqLiquidType, vmapData) && vmapData.liquidInfo) { - useGridLiquid = !IsInWMOInterior(mogpFlags); - LOG_DEBUG("maps", "GetLiquidStatus(): vmap liquid level: {} ground: {} type: {}", liquid_level, ground_level, liquid_type); + useGridLiquid = !vmapData.areaInfo || !IsInWMOInterior(vmapData.areaInfo->mogpFlags); + LOG_DEBUG("maps", "GetLiquidStatus(): vmap liquid level: {} ground: {} type: {}", vmapData.liquidInfo->level, vmapData.floorZ, vmapData.liquidInfo->type); // Check water level and ground level - if (liquid_level > ground_level && G3D::fuzzyGe(z, ground_level - GROUND_HEIGHT_TOLERANCE)) + if (vmapData.liquidInfo->level > vmapData.floorZ && G3D::fuzzyGe(z, vmapData.floorZ - GROUND_HEIGHT_TOLERANCE)) { // hardcoded in client like this - if (GetId() == MAP_OUTLAND && liquid_type == 2) - liquid_type = 15; + if (GetId() == MAP_OUTLAND && vmapData.liquidInfo->type == 2) + vmapData.liquidInfo->type = 15; uint32 liquidFlagType = 0; - if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_type)) + if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(vmapData.liquidInfo->type)) liquidFlagType = liq->Type; - if (liquid_type && liquid_type < 21) + if (vmapData.liquidInfo->type && vmapData.liquidInfo->type < 21) { if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(GetAreaId(phaseMask, x, y, z))) { @@ -1340,19 +1331,19 @@ LiquidData const Map::GetLiquidData(uint32 phaseMask, float x, float y, float z, if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) { - liquid_type = overrideLiquid; + vmapData.liquidInfo->type = overrideLiquid; liquidFlagType = liq->Type; } } } - liquidData.Level = liquid_level; - liquidData.DepthLevel = ground_level; - liquidData.Entry = liquid_type; + liquidData.Level = vmapData.liquidInfo->level; + liquidData.DepthLevel = vmapData.floorZ; + liquidData.Entry = vmapData.liquidInfo->type; liquidData.Flags = 1 << liquidFlagType; } - float delta = liquid_level - z; + float delta = vmapData.liquidInfo->level - z; // Get position delta if (delta > collisionHeight) @@ -1371,7 +1362,7 @@ LiquidData const Map::GetLiquidData(uint32 phaseMask, float x, float y, float z, { LiquidData const& map_data = gmap->GetLiquidData(x, y, z, collisionHeight, ReqLiquidType); // Not override LIQUID_MAP_ABOVE_WATER with LIQUID_MAP_NO_WATER: - if (map_data.Status != LIQUID_MAP_NO_WATER && (map_data.Level > ground_level)) + if (map_data.Status != LIQUID_MAP_NO_WATER && (map_data.Level > vmapData.floorZ)) { // hardcoded in client like this uint32 liquidEntry = map_data.Entry; @@ -1387,7 +1378,7 @@ LiquidData const Map::GetLiquidData(uint32 phaseMask, float x, float y, float z, return liquidData; } -void Map::GetFullTerrainStatusForPosition(uint32 /*phaseMask*/, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus& data, uint8 reqLiquidType) +void Map::GetFullTerrainStatusForPosition(uint32 /*phaseMask*/, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus& data, Optional<uint8> reqLiquidType) { GridTerrainData* gmap = GetGridTerrainData(x, y); @@ -1602,7 +1593,7 @@ float Map::GetHeight(uint32 phasemask, float x, float y, float z, bool vmap/*=tr bool Map::IsInWater(uint32 phaseMask, float x, float y, float pZ, float collisionHeight) const { - LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phaseMask, x, y, pZ, collisionHeight, MAP_ALL_LIQUIDS); + LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phaseMask, x, y, pZ, collisionHeight, {}); return (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) != 0; } @@ -1693,7 +1684,7 @@ void Map::SendInitTransports(Player* player) WorldPacket packet; transData.BuildPacket(packet); - player->GetSession()->SendPacket(&packet); + player->SendDirectMessage(&packet); } void Map::SendRemoveTransports(Player* player) @@ -1712,7 +1703,7 @@ void Map::SendRemoveTransports(Player* player) WorldPacket packet; transData.BuildPacket(packet); - player->GetSession()->SendPacket(&packet); + player->SendDirectMessage(&packet); } void Map::SendObjectUpdates() @@ -1732,7 +1723,7 @@ void Map::SendObjectUpdates() for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter) { iter->second.BuildPacket(packet); - iter->first->GetSession()->SendPacket(&packet); + iter->first->SendDirectMessage(&packet); packet.clear(); // clean the string } } @@ -1852,7 +1843,7 @@ uint32 Map::GetPlayersCountExceptGMs() const void Map::SendToPlayers(WorldPacket const* data) const { for (MapRefMgr::const_iterator itr = m_mapRefMgr.begin(); itr != m_mapRefMgr.end(); ++itr) - itr->GetSource()->GetSession()->SendPacket(data); + itr->GetSource()->SendDirectMessage(data); } template bool Map::AddToMap(Corpse*, bool); @@ -2057,7 +2048,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) data << uint32(60000); data << uint32(instance_data ? instance_data->GetCompletedEncounterMask() : 0); data << uint8(0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); player->SetPendingBind(mapSave->GetInstanceId(), 60000); } } @@ -2120,7 +2111,7 @@ void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 compl if (instance_data) isOtherAI = true; - // if Eluna AI was fetched succesfully we should not call CreateInstanceData nor set the unused scriptID + // if ALE AI was fetched succesfully we should not call CreateInstanceData nor set the unused scriptID if (!isOtherAI) { InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId()); @@ -2134,7 +2125,7 @@ void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 compl if (!instance_data) return; - // use mangos behavior if we are dealing with Eluna AI + // use mangos behavior if we are dealing with ALE AI // initialize should then be called only if load is false if (!isOtherAI || !load) { @@ -2229,7 +2220,7 @@ void InstanceMap::PermBindAllPlayers() { WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4); data << uint32(0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); sInstanceSaveMgr->PlayerBindToInstance(player->GetGUID(), save, true, player); } @@ -2358,27 +2349,27 @@ void BattlegroundMap::RemoveAllPlayers() player->TeleportTo(player->GetEntryPoint()); } -Corpse* Map::GetCorpse(ObjectGuid const guid) +Corpse* Map::GetCorpse(ObjectGuid const& guid) { return _objectsStore.Find<Corpse>(guid); } -Creature* Map::GetCreature(ObjectGuid const guid) +Creature* Map::GetCreature(ObjectGuid const& guid) { return _objectsStore.Find<Creature>(guid); } -GameObject* Map::GetGameObject(ObjectGuid const guid) +GameObject* Map::GetGameObject(ObjectGuid const& guid) { return _objectsStore.Find<GameObject>(guid); } -Pet* Map::GetPet(ObjectGuid const guid) +Pet* Map::GetPet(ObjectGuid const& guid) { return dynamic_cast<Pet*>(_objectsStore.Find<Creature>(guid)); } -Transport* Map::GetTransport(ObjectGuid guid) +Transport* Map::GetTransport(ObjectGuid const& guid) { if (guid.GetHigh() != HighGuid::Mo_Transport && guid.GetHigh() != HighGuid::Transport) return nullptr; @@ -2387,7 +2378,7 @@ Transport* Map::GetTransport(ObjectGuid guid) return go ? go->ToTransport() : nullptr; } -DynamicObject* Map::GetDynamicObject(ObjectGuid guid) +DynamicObject* Map::GetDynamicObject(ObjectGuid const& guid) { return _objectsStore.Find<DynamicObject>(guid); } @@ -2679,7 +2670,7 @@ void Map::RemoveCorpse(Corpse* corpse) _corpseBones.erase(corpse); } -Corpse* Map::ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia /*= false*/) +Corpse* Map::ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia /*= false*/) { Corpse* corpse = GetCorpseByPlayer(ownerGuid); if (!corpse) @@ -2760,13 +2751,13 @@ void Map::RemoveOldCorpses() void Map::ScheduleCreatureRespawn(ObjectGuid creatureGuid, Milliseconds respawnTimer, Position pos) { - _creatureRespawnScheduler.Schedule(respawnTimer, [this, creatureGuid, pos](TaskContext) + Events.AddEventAtOffset([this, creatureGuid, pos]() { if (Creature* creature = GetCreature(creatureGuid)) creature->Respawn(); else SummonCreature(creatureGuid.GetEntry(), pos); - }); + }, respawnTimer); } /// Send a packet to all players (or players selected team) in the zone (except self if mentioned) diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 20551da8a0..21226c54a9 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.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 @@ -23,6 +23,7 @@ #include "DataMap.h" #include "Define.h" #include "DynamicTree.h" +#include "EventProcessor.h" #include "GameObjectModel.h" #include "GridDefines.h" #include "GridRefMgr.h" @@ -33,7 +34,6 @@ #include "PathGenerator.h" #include "Position.h" #include "SharedDefines.h" -#include "TaskScheduler.h" #include "Timer.h" #include "GridTerrainData.h" #include <bitset> @@ -172,7 +172,7 @@ public: // currently unused for normal maps bool CanUnload(uint32 diff) { - if (!m_unloadTimer) + if (!m_unloadTimer || Events.HasEvents()) return false; if (m_unloadTimer <= diff) @@ -243,8 +243,8 @@ public: [[nodiscard]] float GetMinHeight(float x, float y) const; Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = nullptr); - void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus& data, uint8 reqLiquidType = MAP_ALL_LIQUIDS); - LiquidData const GetLiquidData(uint32 phaseMask, float x, float y, float z, float collisionHeight, uint8 ReqLiquidType); + void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus& data, Optional<uint8> reqLiquidType = {}); + LiquidData const GetLiquidData(uint32 phaseMask, float x, float y, float z, float collisionHeight, Optional<uint8> ReqLiquidType); [[nodiscard]] bool GetAreaInfo(uint32 phaseMask, float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId) const; [[nodiscard]] uint32 GetAreaId(uint32 phaseMask, float x, float y, float z) const; @@ -338,12 +338,12 @@ public: GameObject* SummonGameObject(uint32 entry, Position const& pos, float rotation0 = 0.0f, float rotation1 = 0.0f, float rotation2 = 0.0f, float rotation3 = 0.0f, uint32 respawnTime = 100, bool checkTransport = true); void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr); - Corpse* GetCorpse(ObjectGuid const guid); - Creature* GetCreature(ObjectGuid const guid); - GameObject* GetGameObject(ObjectGuid const guid); - Transport* GetTransport(ObjectGuid const guid); - DynamicObject* GetDynamicObject(ObjectGuid const guid); - Pet* GetPet(ObjectGuid const guid); + Corpse* GetCorpse(ObjectGuid const& guid); + Creature* GetCreature(ObjectGuid const& guid); + GameObject* GetGameObject(ObjectGuid const& guid); + Transport* GetTransport(ObjectGuid const& guid); + DynamicObject* GetDynamicObject(ObjectGuid const& guid); + Pet* GetPet(ObjectGuid const& guid); MapStoredObjectTypesContainer& GetObjectsStore() { return _objectsStore; } @@ -430,7 +430,7 @@ public: void UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone); [[nodiscard]] uint32 ApplyDynamicModeRespawnScaling(WorldObject const* obj, uint32 respawnDelay) const; - TaskScheduler _creatureRespawnScheduler; + EventProcessor Events; void ScheduleCreatureRespawn(ObjectGuid /*creatureGuid*/, Milliseconds /*respawnTimer*/, Position pos = Position()); @@ -438,7 +438,7 @@ public: void DeleteCorpseData(); void AddCorpse(Corpse* corpse); void RemoveCorpse(Corpse* corpse); - Corpse* ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia = false); + Corpse* ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia = false); void RemoveOldCorpses(); static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId); @@ -514,6 +514,14 @@ public: void RemoveWorldObjectFromZoneWideVisibleMap(uint32 zoneId, WorldObject* obj); ZoneWideVisibleWorldObjectsSet const* GetZoneWideVisibleWorldObjectsForZone(uint32 zoneId) const; + [[nodiscard]] uint32 GetPlayerCountInZone(uint32 zoneId) const + { + if (auto const& it = _zonePlayerCountMap.find(zoneId); it != _zonePlayerCountMap.end()) + return it->second; + + return 0; + }; + private: template<class T> void InitializeObject(T* obj); diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 9d8172a733..cbe0a3a17e 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.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/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h index e50057c9e5..75601434cd 100644 --- a/src/server/game/Maps/MapInstanced.h +++ b/src/server/game/Maps/MapInstanced.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/Maps/MapMgr.cpp b/src/server/game/Maps/MapMgr.cpp index e113c93d27..94044f7997 100644 --- a/src/server/game/Maps/MapMgr.cpp +++ b/src/server/game/Maps/MapMgr.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 @@ -205,7 +205,7 @@ Map::EnterState MapMgr::PlayerCannotEnter(uint32 mapid, Player* player, bool log if (!corpseMap) { WorldPacket data(SMSG_CORPSE_NOT_IN_INSTANCE, 0); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); LOG_DEBUG("maps", "MAP: Player '{}' does not have a corpse in instance '{}' and cannot enter.", player->GetName(), mapName); return Map::CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE; } diff --git a/src/server/game/Maps/MapMgr.h b/src/server/game/Maps/MapMgr.h index 2872ddd7c8..c2336707e4 100644 --- a/src/server/game/Maps/MapMgr.h +++ b/src/server/game/Maps/MapMgr.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/Maps/MapRefMgr.h b/src/server/game/Maps/MapRefMgr.h index ddedb076d9..cb5f6486f1 100644 --- a/src/server/game/Maps/MapRefMgr.h +++ b/src/server/game/Maps/MapRefMgr.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/Maps/MapReference.h b/src/server/game/Maps/MapReference.h index 002771c76a..82c47a71ee 100644 --- a/src/server/game/Maps/MapReference.h +++ b/src/server/game/Maps/MapReference.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/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index ea5fe96025..d2ad9e6708 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.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/Maps/MapUpdater.h b/src/server/game/Maps/MapUpdater.h index 9576e7e1f0..a2e9aaae45 100644 --- a/src/server/game/Maps/MapUpdater.h +++ b/src/server/game/Maps/MapUpdater.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/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index f065ccf56a..00afdf2b64 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.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 @@ -448,31 +448,45 @@ void TransportMgr::SpawnContinentTransports() LOG_INFO("server.loading", ">> Spawned {} continent motion transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); } + // Preloads Deeprun Tram to fix issues with Subway carts syncronization + /// @todo: This is a temporary workaround. Consider removing TransportMgr::PreloadGridsFromQuery() as part of fix. + /** + Takenbacon: "In the long run the most likely ideal fix would be to always spawn all transport types (and thus loading their grid) on map creation" + See https://github.com/azerothcore/azerothcore-wotlk/pull/23009 for more details. + */ + PreloadGridsFromQuery("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11 AND g.map = 369", count); + if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING)) { // pussywizard: preload grids for continent static transports - QueryResult result2 = WorldDatabase.Query("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11"); + PreloadGridsFromQuery("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11 AND g.map != 369", count); + LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); + } +} - if (result2) +void TransportMgr::PreloadGridsFromQuery(std::string const& query, uint32& count) +{ + if (QueryResult result = WorldDatabase.Query(query)) + { + do { - do - { - Field* fields = result2->Fetch(); - uint16 mapId = fields[0].Get<uint16>(); - float x = fields[1].Get<float>(); - float y = fields[2].Get<float>(); + Field* fields = result->Fetch(); + uint16 mapId = fields[0].Get<uint16>(); + float x = fields[1].Get<float>(); + float y = fields[2].Get<float>(); - MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); - if (mapEntry && !mapEntry->Instanceable()) + if (MapEntry const* mapEntry = sMapStore.LookupEntry(mapId)) + { + if (!mapEntry->Instanceable()) + { if (Map* map = sMapMgr->CreateBaseMap(mapId)) { map->LoadGrid(x, y); ++count; } - } while (result2->NextRow()); - } - - LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); + } + } + } while (result->NextRow()); } } diff --git a/src/server/game/Maps/TransportMgr.h b/src/server/game/Maps/TransportMgr.h index 9767ab3359..73a5655fb0 100644 --- a/src/server/game/Maps/TransportMgr.h +++ b/src/server/game/Maps/TransportMgr.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 @@ -158,6 +158,8 @@ private: TransportInstanceMap _instanceTransports; TransportAnimationContainer _transportAnimations; + + void PreloadGridsFromQuery(std::string const& query, uint32& count); }; #define sTransportMgr TransportMgr::instance() diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h index c257115da0..3dd66ce290 100644 --- a/src/server/game/Maps/ZoneScript.h +++ b/src/server/game/Maps/ZoneScript.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/Misc/BanMgr.cpp b/src/server/game/Misc/BanMgr.cpp index 70fcf80d3c..bc2bb0d38f 100644 --- a/src/server/game/Misc/BanMgr.cpp +++ b/src/server/game/Misc/BanMgr.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/Misc/BanMgr.h b/src/server/game/Misc/BanMgr.h index e8eefae76a..8ba74f13a8 100644 --- a/src/server/game/Misc/BanMgr.h +++ b/src/server/game/Misc/BanMgr.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/Misc/DynamicVisibility.cpp b/src/server/game/Misc/DynamicVisibility.cpp index 60889c4bcc..cf1eed670e 100644 --- a/src/server/game/Misc/DynamicVisibility.cpp +++ b/src/server/game/Misc/DynamicVisibility.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/Misc/DynamicVisibility.h b/src/server/game/Misc/DynamicVisibility.h index 00d7fe6790..b0ec2d1fd5 100644 --- a/src/server/game/Misc/DynamicVisibility.h +++ b/src/server/game/Misc/DynamicVisibility.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/Misc/GameGraveyard.cpp b/src/server/game/Misc/GameGraveyard.cpp index 338e31ff42..e497a92457 100644 --- a/src/server/game/Misc/GameGraveyard.cpp +++ b/src/server/game/Misc/GameGraveyard.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/Misc/GameGraveyard.h b/src/server/game/Misc/GameGraveyard.h index c3f0a3a395..1ba22d1f72 100644 --- a/src/server/game/Misc/GameGraveyard.h +++ b/src/server/game/Misc/GameGraveyard.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/Miscellaneous/Formulas.cpp b/src/server/game/Miscellaneous/Formulas.cpp index 76c6c292d8..e8b6ea568a 100644 --- a/src/server/game/Miscellaneous/Formulas.cpp +++ b/src/server/game/Miscellaneous/Formulas.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 @@ -84,14 +84,9 @@ uint32 Acore::XP::Gain(Player* player, Unit* unit, bool isBattleGround /*= false if (gain && creature) { if (creature->isElite()) - { - // Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus. - if (unit->GetMap() && unit->GetMap()->IsDungeon()) - xpMod *= 2.75f; - else - xpMod *= 2.0f; - } + xpMod *= 2.0f; + // Instanced mobs (particularly bosses) oftentimes have higher bonuses, especially in later content levels xpMod *= creature->GetCreatureTemplate()->ModExperience; } diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index eba9431c76..a8b87ae20f 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.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/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 5658e4147d..66db5fd998 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.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 @@ -978,7 +978,8 @@ enum AcoreStrings LANG_GUILD_INFO_EXTRA_INFO = 1183, LANG_GUILD_INFO_RANKS = 1184, LANG_GUILD_INFO_RANKS_LIST = 1185, - // Room for more level 3 1186-1198 not used + LANG_COMMAND_BEASTMASTER_MODE = 1186, + // Room for more level 3 1187-1198 not used // Debug commands LANG_DO_NOT_USE_6X_DEBUG_AREATRIGGER_LEFT = 1999, diff --git a/src/server/game/Modules/ModuleMgr.cpp b/src/server/game/Modules/ModuleMgr.cpp index ed9ce90abd..7f4dcb274e 100644 --- a/src/server/game/Modules/ModuleMgr.cpp +++ b/src/server/game/Modules/ModuleMgr.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/Modules/ModuleMgr.h b/src/server/game/Modules/ModuleMgr.h index 3513dc5deb..c9a166be09 100644 --- a/src/server/game/Modules/ModuleMgr.h +++ b/src/server/game/Modules/ModuleMgr.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/Motd/MotdMgr.cpp b/src/server/game/Motd/MotdMgr.cpp index 8c85222d27..ad4df47a26 100644 --- a/src/server/game/Motd/MotdMgr.cpp +++ b/src/server/game/Motd/MotdMgr.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/Motd/MotdMgr.h b/src/server/game/Motd/MotdMgr.h index 1f85ba921c..7eff1b0686 100644 --- a/src/server/game/Motd/MotdMgr.h +++ b/src/server/game/Motd/MotdMgr.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/Movement/FollowerRefMgr.h b/src/server/game/Movement/FollowerRefMgr.h index c33e764651..6c2e6de436 100644 --- a/src/server/game/Movement/FollowerRefMgr.h +++ b/src/server/game/Movement/FollowerRefMgr.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/Movement/FollowerReference.cpp b/src/server/game/Movement/FollowerReference.cpp index de9eb97442..287a0d9c75 100644 --- a/src/server/game/Movement/FollowerReference.cpp +++ b/src/server/game/Movement/FollowerReference.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/Movement/FollowerReference.h b/src/server/game/Movement/FollowerReference.h index de172b6d79..2d1c77f46b 100644 --- a/src/server/game/Movement/FollowerReference.h +++ b/src/server/game/Movement/FollowerReference.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/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 2b2aba6ef9..bf4df28aad 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.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 @@ -32,6 +32,7 @@ #include "TargetedMovementGenerator.h" #include "WaypointMgr.h" #include "WaypointMovementGenerator.h" +#include "SmartScriptMgr.h" inline MovementGenerator* GetIdleMovementGenerator() { @@ -387,6 +388,7 @@ void MotionMaster::MoveBackwards(Unit* target, float dist) Movement::MoveSplineInit init(_owner); init.MoveTo(point.x, point.y, point.z, false); + init.SetWalk(true); init.SetFacing(target); init.SetOrientationInversed(); init.Launch(); @@ -469,7 +471,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo * * For transition movement between the ground and the air, use MoveLand or MoveTakeoff instead. */ -void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath, bool forceDestination, MovementSlot slot, float orientation /* = 0.0f*/) +void MotionMaster::MovePoint(uint32 id, float x, float y, float z, ForcedMovement forcedMovement, float speed, float orientation, bool generatePath, bool forceDestination, MovementSlot slot) { if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; @@ -477,16 +479,16 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) targeted point (Id: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z); - Mutate(new PointMovementGenerator<Player>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot); + Mutate(new PointMovementGenerator<Player>(id, x, y, z, forcedMovement, speed, orientation, nullptr, generatePath, forceDestination), slot); } else { LOG_DEBUG("movement.motionmaster", "Creature ({}) targeted point (ID: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z); - Mutate(new PointMovementGenerator<Creature>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot); + Mutate(new PointMovementGenerator<Creature>(id, x, y, z, forcedMovement, speed, orientation, nullptr, generatePath, forceDestination), slot); } } -void MotionMaster::MoveSplinePath(Movement::PointsArray* path) +void MotionMaster::MoveSplinePath(Movement::PointsArray* path, ForcedMovement forcedMovement) { // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) @@ -494,27 +496,43 @@ void MotionMaster::MoveSplinePath(Movement::PointsArray* path) if (_owner->IsPlayer()) { - Mutate(new EscortMovementGenerator<Player>(path), MOTION_SLOT_ACTIVE); + Mutate(new EscortMovementGenerator<Player>(forcedMovement, path), MOTION_SLOT_ACTIVE); } else { - Mutate(new EscortMovementGenerator<Creature>(path), MOTION_SLOT_ACTIVE); + Mutate(new EscortMovementGenerator<Creature>(forcedMovement, path), MOTION_SLOT_ACTIVE); } } -void MotionMaster::MoveSplinePath(uint32 path_id) +void MotionMaster::MovePath(uint32 path_id, ForcedMovement forcedMovement, PathSource pathSource) { - // convert the path id to a Movement::PointsArray* - Movement::PointsArray* points = new Movement::PointsArray(); - WaypointPath const* path = sWaypointMgr->GetPath(path_id); - for (uint8 i = 0; i < path->size(); ++i) + WaypointPath const* path; + switch (pathSource) + { + default: + case PathSource::WAYPOINT_MGR: + path = sWaypointMgr->GetPath(path_id); + break; + case PathSource::SMART_WAYPOINT_MGR: + path = sSmartWaypointMgr->GetPath(path_id); + break; + } + + if (path == nullptr) + { + LOG_ERROR("sql.sql", "WaypointMovementGenerator::LoadPath: creature {} ({}) doesn't have waypoint path id: {} pathSource: {}", + _owner->GetName(), _owner->GetGUID().ToString(), path_id, pathSource); + return; + } + + Movement::PointsArray points; + for (auto& point : *path) { - WaypointData const* node = path->at(i); - points->push_back(G3D::Vector3(node->x, node->y, node->z)); + points.push_back(G3D::Vector3(point.second.x, point.second.y, point.second.z)); } // pass the new PointsArray* to the appropriate MoveSplinePath function - MoveSplinePath(points); + MoveSplinePath(&points, forcedMovement); } /** @@ -539,8 +557,8 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed /* = 0.0 } init.SetAnimation(Movement::ToGround); - init.Launch(); - Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE); + + Mutate(new EffectMovementGenerator(init, id), MOTION_SLOT_ACTIVE); } /** @@ -569,16 +587,12 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed /* = init.MoveTo(x, y, z); if (speed > 0.0f) - { init.SetVelocity(speed); - } if (!skipAnimation) - { init.SetAnimation(Movement::ToFly); - } - init.Launch(); - Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE); + + Mutate(new EffectMovementGenerator(init, id), MOTION_SLOT_ACTIVE); } /** @@ -612,8 +626,8 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa init.SetParabolic(max_height, 0); init.SetOrientationFixed(true); init.SetVelocity(speedXY); - init.Launch(); - Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED); + + Mutate(new EffectMovementGenerator(init, 0), MOTION_SLOT_CONTROLLED); } /** @@ -652,8 +666,8 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee init.SetVelocity(speedXY); if (target) init.SetFacing(target); - init.Launch(); - Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); + + Mutate(new EffectMovementGenerator(init, id), MOTION_SLOT_CONTROLLED); } /** @@ -695,8 +709,8 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC) Movement::MoveSplineInit init(_owner); init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz + _owner->GetHoverHeight()); init.SetFall(); - init.Launch(); - Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); + + Mutate(new EffectMovementGenerator(init, id), MOTION_SLOT_CONTROLLED); } /** @@ -713,12 +727,12 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id, if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z); - Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED); + Mutate(new PointMovementGenerator<Player>(id, x, y, z, FORCED_MOVEMENT_NONE, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED); } else { LOG_DEBUG("movement.motionmaster", "Creature ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z); - Mutate(new PointMovementGenerator<Creature>(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED); + Mutate(new PointMovementGenerator<Creature>(id, x, y, z, FORCED_MOVEMENT_NONE, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED); } } @@ -884,7 +898,7 @@ void MotionMaster::Mutate(MovementGenerator* m, MovementSlot slot) /** * @brief Move the unit following a specific path. Doesn't work with UNIT_FLAG_DISABLE_MOVE */ -void MotionMaster::MovePath(uint32 path_id, bool repeatable) +void MotionMaster::MoveWaypoint(uint32 path_id, bool repeatable, PathSource pathSource) { if (!path_id) return; @@ -892,20 +906,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - //We set waypoint movement as new default movement generator - // clear ALL movement generators (including default) - /*while (!empty()) - { - MovementGenerator *curr = top(); - curr->Finalize(*_owner); - pop(); - if (!isStatic(curr)) - delete curr; - }*/ - - //_owner->IsPlayer() ? - //Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)): - Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE); + Mutate(new WaypointMovementGenerator<Creature>(path_id, pathSource, repeatable), MOTION_SLOT_IDLE); LOG_DEBUG("movement.motionmaster", "{} ({}) start moving over path(Id:{}, repeatable: {})", _owner->IsPlayer() ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO"); diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 0fcf5abae8..637e43a91b 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.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 @@ -80,6 +80,21 @@ enum RotateDirection ROTATE_DIRECTION_RIGHT }; +enum ForcedMovement +{ + FORCED_MOVEMENT_NONE = 0, + FORCED_MOVEMENT_WALK = 1, + FORCED_MOVEMENT_RUN = 2, + + FORCED_MOVEMENT_MAX +}; + +enum class PathSource +{ + WAYPOINT_MGR = 0, + SMART_WAYPOINT_MGR = 1, +}; + struct ChaseRange { ChaseRange(float range); @@ -210,11 +225,11 @@ public: void MoveForwards(Unit* target, float dist); void MoveConfused(); void MoveFleeing(Unit* enemy, uint32 time = 0); - void MovePoint(uint32 id, const Position& pos, bool generatePath = true, bool forceDestination = true) - { MovePoint(id, pos.m_positionX, pos.m_positionY, pos.m_positionZ, generatePath, forceDestination, MOTION_SLOT_ACTIVE, pos.GetOrientation()); } - void MovePoint(uint32 id, float x, float y, float z, bool generatePath = true, bool forceDestination = true, MovementSlot slot = MOTION_SLOT_ACTIVE, float orientation = 0.0f); - void MoveSplinePath(Movement::PointsArray* path); - void MoveSplinePath(uint32 path_id); + void MovePoint(uint32 id, const Position& pos, ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, float speed = 0.f, bool generatePath = true, bool forceDestination = true) + { MovePoint(id, pos.m_positionX, pos.m_positionY, pos.m_positionZ, forcedMovement, speed, pos.GetOrientation(), generatePath, forceDestination, MOTION_SLOT_ACTIVE); } + void MovePoint(uint32 id, float x, float y, float z, ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, float speed = 0.f, float orientation = 0.0f, bool generatePath = true, bool forceDestination = true, MovementSlot slot = MOTION_SLOT_ACTIVE); + void MoveSplinePath(Movement::PointsArray* path, ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE); + void MovePath(uint32 path_id, ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, PathSource pathSource = PathSource::WAYPOINT_MGR); // These two movement types should only be used with creatures having landing/takeoff animations void MoveLand(uint32 id, Position const& pos, float speed = 0.0f); @@ -235,7 +250,7 @@ public: void MoveSeekAssistanceDistract(uint32 timer); void MoveTaxiFlight(uint32 path, uint32 pathnode); void MoveDistract(uint32 time); - void MovePath(uint32 path_id, bool repeatable); + void MoveWaypoint(uint32 path_id, bool repeatable, PathSource pathSource = PathSource::WAYPOINT_MGR); void MoveRotate(uint32 time, RotateDirection direction); [[nodiscard]] MovementGeneratorType GetCurrentMovementGeneratorType() const; diff --git a/src/server/game/Movement/MovementGenerator.cpp b/src/server/game/Movement/MovementGenerator.cpp index a14578b26e..d92939c5fe 100644 --- a/src/server/game/Movement/MovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerator.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/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h index 4ddd4a1d43..89ff556839 100644 --- a/src/server/game/Movement/MovementGenerator.h +++ b/src/server/game/Movement/MovementGenerator.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/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index 6d3d1007c8..2839e8bdd8 100644 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.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 @@ -146,6 +146,7 @@ bool ConfusedMovementGenerator<T>::DoUpdate(T* unit, uint32 diff) float z = i_waypoints[i_nextMove][2]; Movement::MoveSplineInit init(unit); init.MoveTo(x, y, z, true); + init.SetWalk(true); init.Launch(); } } diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h index 73038a1387..bb119338e0 100644 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.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/Movement/MovementGenerators/EscortMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.cpp index 14133dbe26..35d09cf42a 100644 --- a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.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 @@ -36,6 +36,11 @@ void EscortMovementGenerator<T>::DoInitialize(T* unit) else if (m_precomputedPath.size()) init.MovebyPath(m_precomputedPath); + if (_forcedMovement == FORCED_MOVEMENT_WALK) + init.SetWalk(true); + else if (_forcedMovement == FORCED_MOVEMENT_RUN) + init.SetWalk(false); + init.Launch(); _splineId = unit->movespline->GetId(); @@ -79,6 +84,11 @@ bool EscortMovementGenerator<T>::DoUpdate(T* unit, uint32 /*diff*/) init.MoveTo(m_precomputedPath[1].x, m_precomputedPath[1].y, m_precomputedPath[1].z, true); } + if (_forcedMovement == FORCED_MOVEMENT_WALK) + init.SetWalk(true); + else if (_forcedMovement == FORCED_MOVEMENT_RUN) + init.SetWalk(false); + init.Launch(); // Xinef: Override spline Id on recalculate launch _splineId = unit->movespline->GetId(); diff --git a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h index edb410b8a8..fdb4d317f3 100644 --- a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.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 @@ -24,7 +24,7 @@ template<class T> class EscortMovementGenerator : public MovementGeneratorMedium< T, EscortMovementGenerator<T> > { public: - EscortMovementGenerator(Movement::PointsArray* _path = nullptr) : i_recalculateSpeed(false) + EscortMovementGenerator(ForcedMovement forcedMovement, Movement::PointsArray* _path = nullptr) : i_recalculateSpeed(false), _forcedMovement(forcedMovement) { if (_path) m_precomputedPath = *_path; @@ -46,6 +46,7 @@ private: Movement::PointsArray m_precomputedPath; uint32 _splineId; + ForcedMovement _forcedMovement; }; #endif diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index d340246555..45b14e1ae1 100644 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.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/Movement/MovementGenerators/FleeingMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h index bcde0966ea..a169a5fb31 100644 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.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/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index be1667e5bc..d4928722a5 100644 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.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 @@ -31,8 +31,6 @@ void HomeMovementGenerator<Creature>::DoFinalize(Creature* owner) owner->ClearUnitState(UNIT_STATE_EVADE); if (arrived) { - // Xinef: npc run by default - //owner->SetWalk(true); owner->LoadCreaturesAddon(true); owner->AI()->JustReachedHome(); } diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h index 82da2b0f2f..fe01f12d18 100644 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.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/Movement/MovementGenerators/IdleMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp index c1505f9af1..0aef8cd733 100644 --- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.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/Movement/MovementGenerators/IdleMovementGenerator.h b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h index 293862bdda..fa7c948e4b 100644 --- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.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/Movement/MovementGenerators/PathGenerator.cpp b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp index c59def7b72..5ddbc2c45a 100644 --- a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PathGenerator.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 @@ -211,8 +211,8 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con { bool buildShortcut = false; - auto liquidDataStart = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), startPos.x, startPos.y, startPos.z, _source->GetCollisionHeight(), MAP_ALL_LIQUIDS); - auto liquidDataEnd = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), endPos.x, endPos.y, endPos.z, _source->GetCollisionHeight(), MAP_ALL_LIQUIDS); + auto liquidDataStart = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), startPos.x, startPos.y, startPos.z, _source->GetCollisionHeight(), {}); + auto liquidDataEnd = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), endPos.x, endPos.y, endPos.z, _source->GetCollisionHeight(), {}); bool startUnderWaterEndInWater = liquidDataStart.Status == LIQUID_MAP_UNDER_WATER && (liquidDataEnd.Status & MAP_LIQUID_STATUS_IN_CONTACT) != 0; @@ -698,7 +698,7 @@ void PathGenerator::UpdateFilter() NavTerrain PathGenerator::GetNavTerrain(float x, float y, float z) const { - LiquidData const& liquidData = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), x, y, z, _source->GetCollisionHeight(), MAP_ALL_LIQUIDS); + LiquidData const& liquidData = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), x, y, z, _source->GetCollisionHeight(), {}); if (liquidData.Status == LIQUID_MAP_NO_WATER) return NAV_GROUND; diff --git a/src/server/game/Movement/MovementGenerators/PathGenerator.h b/src/server/game/Movement/MovementGenerators/PathGenerator.h index b26f961a84..56b55d2f96 100644 --- a/src/server/game/Movement/MovementGenerators/PathGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PathGenerator.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/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index fdce942480..95e3c5621f 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.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 @@ -84,6 +84,11 @@ void PointMovementGenerator<T>::DoInitialize(T* unit) if (speed > 0.0f) init.SetVelocity(speed); + if (_forcedMovement == FORCED_MOVEMENT_WALK) + init.SetWalk(true); + else if (_forcedMovement == FORCED_MOVEMENT_RUN) + init.SetWalk(false); + if (i_orientation > 0.0f) { init.SetFacing(i_orientation); @@ -142,6 +147,11 @@ bool PointMovementGenerator<T>::DoUpdate(T* unit, uint32 /*diff*/) if (speed > 0.0f) // Default value for point motion type is 0.0, if 0.0 spline will use GetSpeed on unit init.SetVelocity(speed); + if (_forcedMovement == FORCED_MOVEMENT_WALK) + init.SetWalk(true); + else if (_forcedMovement == FORCED_MOVEMENT_RUN) + init.SetWalk(false); + if (i_orientation > 0.0f) { init.SetFacing(i_orientation); @@ -200,9 +210,14 @@ template <> void PointMovementGenerator<Creature>::MovementInform(Creature* unit if (Unit* summoner = unit->GetCharmerOrOwner()) { if (UnitAI* AI = summoner->GetAI()) - { AI->SummonMovementInform(unit, POINT_MOTION_TYPE, id); - } + } + else + { + if (TempSummon* tempSummon = unit->ToTempSummon()) + if (Unit* summoner = tempSummon->GetSummonerUnit()) + if (UnitAI* AI = summoner->GetAI()) + AI->SummonMovementInform(unit, POINT_MOTION_TYPE, id); } } @@ -228,6 +243,11 @@ bool EffectMovementGenerator::Update(Unit* unit, uint32) return !unit->movespline->Finalized(); } +void EffectMovementGenerator::Initialize(Unit*) +{ + i_spline.Launch(); +} + void EffectMovementGenerator::Finalize(Unit* unit) { if (!unit->IsCreature()) diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h index f19e04d422..6dc16eb4eb 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.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 @@ -20,15 +20,16 @@ #include "Creature.h" #include "MovementGenerator.h" +#include "MoveSplineInit.h" template<class T> class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> > { public: - PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f, float orientation = 0.0f, const Movement::PointsArray* _path = nullptr, - bool generatePath = false, bool forceDestination = false, ObjectGuid chargeTargetGUID = ObjectGuid::Empty) - : id(_id), i_x(_x), i_y(_y), i_z(_z), speed(_speed), i_orientation(orientation), _generatePath(generatePath), _forceDestination(forceDestination), - _chargeTargetGUID(chargeTargetGUID) + PointMovementGenerator(uint32 _id, float _x, float _y, float _z, ForcedMovement forcedMovement, float _speed = 0.0f, float orientation = 0.0f, const Movement::PointsArray* _path = nullptr, + bool generatePath = false, bool forceDestination = false, ObjectGuid chargeTargetGUID = ObjectGuid::Empty, bool reverseOrientation = false, ObjectGuid facingTargetGuid = ObjectGuid()) + : id(_id), i_x(_x), i_y(_y), i_z(_z), speed(_speed), i_orientation(orientation), _generatePath(generatePath), _forceDestination(forceDestination), _reverseOrientation(reverseOrientation), + _chargeTargetGUID(chargeTargetGUID), _forcedMovement(forcedMovement), _facingTargetGuid(facingTargetGuid) { if (_path) m_precomputedPath = *_path; @@ -55,14 +56,17 @@ private: Movement::PointsArray m_precomputedPath; bool _generatePath; bool _forceDestination; + bool _reverseOrientation; ObjectGuid _chargeTargetGUID; + ForcedMovement _forcedMovement; + ObjectGuid _facingTargetGuid; }; class AssistanceMovementGenerator : public PointMovementGenerator<Creature> { public: AssistanceMovementGenerator(float _x, float _y, float _z) : - PointMovementGenerator<Creature>(0, _x, _y, _z) {} + PointMovementGenerator<Creature>(0, _x, _y, _z, FORCED_MOVEMENT_NONE) {} MovementGeneratorType GetMovementGeneratorType() { return ASSISTANCE_MOTION_TYPE; } void Finalize(Unit*); @@ -72,14 +76,15 @@ public: class EffectMovementGenerator : public MovementGenerator { public: - explicit EffectMovementGenerator(uint32 Id) : m_Id(Id) {} - void Initialize(Unit*) override {} + explicit EffectMovementGenerator(Movement::MoveSplineInit& spline, uint32 Id) : m_Id(Id), i_spline(spline) {} + void Initialize(Unit*) override; void Finalize(Unit*) override; void Reset(Unit*) override {} bool Update(Unit*, uint32) override; MovementGeneratorType GetMovementGeneratorType() override { return EFFECT_MOTION_TYPE; } private: uint32 m_Id; + Movement::MoveSplineInit i_spline; }; #endif diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 5d904d31ac..56109087f3 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.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 @@ -51,7 +51,21 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature) creature->AddUnitState(UNIT_STATE_ROAMING_MOVE); Movement::MoveSplineInit init(creature); init.MoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ()); - init.SetWalk(true); + + bool walk = true; + switch (creature->GetMovementTemplate().GetRandom()) + { + case CreatureRandomMovementType::CanRun: + walk = creature->IsWalking(); + break; + case CreatureRandomMovementType::AlwaysRun: + walk = false; + break; + default: + break; + } + + init.SetWalk(walk); init.Launch(); if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature) creature->GetFormation()->LeaderMoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ(), 0); @@ -270,7 +284,6 @@ template<> void RandomMovementGenerator<Creature>::DoFinalize(Creature* creature) { creature->ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); - creature->SetWalk(false); } template<> diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h index d765e3d3e8..f5bdabdac0 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.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/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index 4dfc688282..eff2249dae 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.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 @@ -113,7 +113,7 @@ bool ChaseMovementGenerator<T>::DispatchSplineToPosition(T* owner, float x, floa } owner->StopMoving(); - return true; + return false; } if (cutPath) @@ -134,7 +134,7 @@ bool ChaseMovementGenerator<T>::DispatchSplineToPosition(T* owner, float x, floa init.SetWalk(walk); init.Launch(); - return false; + return true; } template<class T> @@ -219,18 +219,21 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff) { i_recheckDistance.Reset(400); // Sniffed value - if (i_recalculateTravel && PositionOkay(owner, target, _movingTowards ? maxTarget : Optional<float>(), angle)) + if (m_currentMode != CHASE_MODE_DISTANCING) { - if ((owner->HasUnitState(UNIT_STATE_CHASE_MOVE) && !target->isMoving() && !mutualChase) || _range) + if (i_recalculateTravel && PositionOkay(owner, target, _movingTowards ? maxTarget : Optional<float>(), angle)) { - i_recalculateTravel = false; - i_path = nullptr; - if (cOwner) - cOwner->SetCannotReachTarget(); - owner->StopMoving(); - owner->SetInFront(target); - MovementInform(owner); - return true; + if ((owner->HasUnitState(UNIT_STATE_CHASE_MOVE) && !target->isMoving() && !mutualChase) || _range) + { + i_recalculateTravel = false; + i_path = nullptr; + if (cOwner) + cOwner->SetCannotReachTarget(); + owner->StopMoving(); + owner->SetInFront(target); + MovementInform(owner); + return true; + } } } } @@ -262,6 +265,9 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff) i_leashExtensionTimer.Reset(cOwner->GetAttackTime(BASE_ATTACK)); } + if (m_currentMode == CHASE_MODE_DISTANCING) + return true; + // if the target moved, we have to consider whether to adjust if (!_lastTargetPosition || target->GetPosition() != _lastTargetPosition.value() || mutualChase != _mutualChase || !owner->IsWithinLOSInMap(target)) { @@ -365,7 +371,6 @@ void ChaseMovementGenerator<Creature>::DoInitialize(Creature* owner) _lastTargetPosition.reset(); i_recheckDistance.Reset(0); i_leashExtensionTimer.Reset(owner->GetAttackTime(BASE_ATTACK)); - owner->SetWalk(false); owner->AddUnitState(UNIT_STATE_CHASE); } diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h index e5e87f845b..4e7721be38 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.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/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index be3c0d57f1..c113f69764 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.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 @@ -28,13 +28,26 @@ #include "Spell.h" #include "Transport.h" #include "World.h" +#include "SmartScriptMgr.h" void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature) { - if (!path_id) - path_id = creature->GetWaypointPath(); + switch (i_pathSource) + { + case PathSource::WAYPOINT_MGR: + { + if (!path_id) + path_id = creature->GetWaypointPath(); - i_path = sWaypointMgr->GetPath(path_id); + i_path = sWaypointMgr->GetPath(path_id); + break; + } + case PathSource::SMART_WAYPOINT_MGR: + { + i_path = sSmartWaypointMgr->GetPath(path_id); + break; + } + } if (!i_path) { @@ -44,6 +57,8 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature) return; } + i_currentNode = i_path->begin()->first; + StartMoveNow(creature); } @@ -56,7 +71,6 @@ void WaypointMovementGenerator<Creature>::DoInitialize(Creature* creature) void WaypointMovementGenerator<Creature>::DoFinalize(Creature* creature) { creature->ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); - creature->SetWalk(false); } void WaypointMovementGenerator<Creature>::DoReset(Creature* creature) @@ -79,22 +93,24 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature) creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); m_isArrivalDone = true; - if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) + auto currentNodeItr = i_path->find(i_currentNode); + + if (currentNodeItr->second.event_id && urand(0, 99) < currentNodeItr->second.event_chance) { LOG_DEBUG("maps.script", "Creature movement start script {} at point {} for {}.", - i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID().ToString()); + currentNodeItr->second.event_id, i_currentNode, creature->GetGUID().ToString()); creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); - creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, nullptr); + creature->GetMap()->ScriptsStart(sWaypointScripts, currentNodeItr->second.event_id, creature, nullptr); } // Inform script MovementInform(creature); creature->UpdateWaypointID(i_currentNode); - if (i_path->at(i_currentNode)->delay) + if (currentNodeItr->second.delay) { creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); - Stop(i_path->at(i_currentNode)->delay); + Stop(currentNodeItr->second.delay); } } @@ -114,12 +130,11 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature) if (m_isArrivalDone) { - // Xinef: not true... update this at every waypoint! - //if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint { - float x = i_path->at(i_currentNode)->x; - float y = i_path->at(i_currentNode)->y; - float z = i_path->at(i_currentNode)->z; + auto currentNodeItr = i_path->find(i_currentNode); + float x = currentNodeItr->second.x; + float y = currentNodeItr->second.y; + float z = currentNodeItr->second.z; float o = creature->GetOrientation(); if (!transportPath) @@ -140,14 +155,17 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature) } // Xinef: moved the upper IF here - if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint + uint32 lastPoint = i_path->rbegin()->first; + if ((i_currentNode == lastPoint) && !repeating) // If that's our last waypoint { creature->AI()->PathEndReached(path_id); creature->GetMotionMaster()->Initialize(); return false; } - i_currentNode = (i_currentNode + 1) % i_path->size(); + ++i_currentNode; + if (lastPoint < i_currentNode) + i_currentNode = i_path->begin()->first; } // xinef: do not initialize motion if we got stunned in movementinform @@ -156,13 +174,14 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature) return true; } - WaypointData const* node = i_path->at(i_currentNode); + auto currentNodeItr = i_path->find(i_currentNode); + WaypointData const& node = currentNodeItr->second; m_isArrivalDone = false; creature->AddUnitState(UNIT_STATE_ROAMING_MOVE); - Movement::Location formationDest(node->x, node->y, node->z, 0.0f); + Movement::Location formationDest(node.x, node.y, node.z, 0.0f); Movement::MoveSplineInit init(creature); //! If creature is on transport, we assume waypoints set in DB are already transport offsets @@ -173,16 +192,16 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature) trans->CalculatePassengerPosition(formationDest.x, formationDest.y, formationDest.z, &formationDest.orientation); } - float z = node->z; - creature->UpdateAllowedPositionZ(node->x, node->y, z); + float z = node.z; + creature->UpdateAllowedPositionZ(node.x, node.y, z); //! Do not use formationDest here, MoveTo requires transport offsets due to DisableTransportPathTransformations() call //! but formationDest contains global coordinates - init.MoveTo(node->x, node->y, z, true, true); + init.MoveTo(node.x, node.y, z, true, true); - if (node->orientation.has_value() && node->delay > 0) - init.SetFacing(*node->orientation); + if (node.orientation.has_value() && node.delay > 0) + init.SetFacing(*node.orientation); - switch (node->move_type) + switch (node.move_type) { case WAYPOINT_MOVE_TYPE_LAND: init.SetAnimation(Movement::ToGround); @@ -204,7 +223,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature) //Call for creature group update if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature) - creature->GetFormation()->LeaderMoveTo(formationDest.x, formationDest.y, formationDest.z, node->move_type); + creature->GetFormation()->LeaderMoveTo(formationDest.x, formationDest.y, formationDest.z, node.move_type); return true; } @@ -240,13 +259,7 @@ bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 di } else { - bool finished = creature->movespline->Finalized(); - // xinef: code to detect pre-empetively if we should start movement to next waypoint - // xinef: do not start pre-empetive movement if current node has delay or we are ending waypoint movement - //if (!finished && !i_path->at(i_currentNode)->delay && ((i_currentNode != i_path->size() - 1) || repeating)) - // finished = (creature->movespline->_Spline().length(creature->movespline->_currentSplineIdx() + 1) - creature->movespline->timePassed()) < 200; - - if (finished) + if (creature->movespline->Finalized()) { OnArrived(creature); return StartMove(creature); @@ -263,22 +276,14 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature) if (Unit* owner = creature->GetCharmerOrOwner()) { if (UnitAI* AI = owner->GetAI()) - { AI->SummonMovementInform(creature, WAYPOINT_MOTION_TYPE, i_currentNode); - } } else { if (TempSummon* tempSummon = creature->ToTempSummon()) - { if (Unit* owner = tempSummon->GetSummonerUnit()) - { if (UnitAI* AI = owner->GetAI()) - { AI->SummonMovementInform(creature, WAYPOINT_MOTION_TYPE, i_currentNode); - } - } - } } } @@ -405,6 +410,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player) player->m_taxi.ClearTaxiDestinations(); player->Dismount(); player->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); + player->UpdatePvPState(); // to account for cases such as flying into a PvP territory, as it does not flag on the way in if (player->m_taxi.empty()) { @@ -434,6 +440,9 @@ void FlightPathMovementGenerator::DoReset(Player* player) return; } + if (player->pvpInfo.EndTimer) + player->UpdatePvP(false, true); // PvP flag timer immediately ends when starting taxi + player->getHostileRefMgr().setOnlineOfflineState(false); player->AddUnitState(UNIT_STATE_IN_FLIGHT); player->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index 3161894a2b..44194581e6 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.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 @@ -54,8 +54,8 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea public PathMovementBase<Creature, WaypointPath const*> { public: - WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true, bool _stalled = false) - : PathMovementBase((WaypointPath const*)nullptr), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating), stalled(_stalled) {} + WaypointMovementGenerator(uint32 _path_id = 0, PathSource pathSource = PathSource::WAYPOINT_MGR, bool _repeating = true, bool _stalled = false) + : PathMovementBase((WaypointPath const*)nullptr), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating), stalled(_stalled), i_pathSource(pathSource) {} ~WaypointMovementGenerator() { i_path = nullptr; } void DoInitialize(Creature*); void DoFinalize(Creature*); @@ -96,6 +96,7 @@ private: uint32 path_id; bool repeating; bool stalled; + PathSource i_pathSource; }; /** FlightPathMovementGenerator generates movement of the player for the paths diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 3d3be3769b..513a789ef9 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.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/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h index 5ebe5f5aa5..40aee12547 100644 --- a/src/server/game/Movement/Spline/MoveSpline.h +++ b/src/server/game/Movement/Spline/MoveSpline.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 @@ -117,6 +117,7 @@ namespace Movement [[nodiscard]] bool isCyclic() const { return splineflags.cyclic; } [[nodiscard]] bool isFalling() const { return splineflags.falling; } [[nodiscard]] bool isWalking() const { return splineflags.walkmode; } + [[nodiscard]] bool isBoarding() const { return splineflags.transportEnter || splineflags.transportExit; } [[nodiscard]] Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3(); } [[nodiscard]] Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1) : Vector3(); } [[nodiscard]] int32 currentPathIdx() const; diff --git a/src/server/game/Movement/Spline/MoveSplineFlag.h b/src/server/game/Movement/Spline/MoveSplineFlag.h index 17e8128156..3020e46c29 100644 --- a/src/server/game/Movement/Spline/MoveSplineFlag.h +++ b/src/server/game/Movement/Spline/MoveSplineFlag.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/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index c2f6664b68..8cdb1ffdf3 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.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 @@ -23,6 +23,7 @@ #include "Unit.h" #include "Vehicle.h" #include "WorldPacket.h" +#include "Log.h" namespace Movement { @@ -103,7 +104,13 @@ namespace Movement bool isOrientationOnly = args.path.size() == 2 && args.path[0] == args.path[1]; - if ((moveFlags & MOVEMENTFLAG_ROOT) || isOrientationOnly) + if (moveFlags & MOVEMENTFLAG_ROOT) // This case should essentially never occur - hence the trace logging - hints to issues elsewhere + { + LOG_TRACE("movement", "Invalid movement during root. Entry: {} IsImmobilized {}, moveflags {}", unit->GetEntry(), unit->IsImmobilizedState() ? "true" : "false", moveFlags); + moveFlags &= ~MOVEMENTFLAG_MASK_MOVING; + } + + if (isOrientationOnly) moveFlags &= ~MOVEMENTFLAG_MASK_MOVING; if (!args.HasVelocity) diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h index a98da34465..5be1ebe26b 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.h +++ b/src/server/game/Movement/Spline/MoveSplineInit.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/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h index 68ad95b142..ed4a268b77 100644 --- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h +++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.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/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index b360c6b3dc..7aa6838d8c 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.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/Movement/Spline/MovementPacketBuilder.h b/src/server/game/Movement/Spline/MovementPacketBuilder.h index 711eccc33e..7177f72745 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.h +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.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/Movement/Spline/MovementTypedefs.h b/src/server/game/Movement/Spline/MovementTypedefs.h index 512bcc7dc1..c28d7e6c6f 100644 --- a/src/server/game/Movement/Spline/MovementTypedefs.h +++ b/src/server/game/Movement/Spline/MovementTypedefs.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/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp index 2b5a2e1b66..86f293dd36 100644 --- a/src/server/game/Movement/Spline/MovementUtil.cpp +++ b/src/server/game/Movement/Spline/MovementUtil.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/Movement/Spline/Spline.cpp b/src/server/game/Movement/Spline/Spline.cpp index a4f1916792..9c65619b54 100644 --- a/src/server/game/Movement/Spline/Spline.cpp +++ b/src/server/game/Movement/Spline/Spline.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/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index b8800eb2c0..9645eb6075 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.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/Movement/Spline/SplineImpl.h b/src/server/game/Movement/Spline/SplineImpl.h index 48b9b2ac05..2b4d8e5445 100644 --- a/src/server/game/Movement/Spline/SplineImpl.h +++ b/src/server/game/Movement/Spline/SplineImpl.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/Movement/Waypoints/WaypointMgr.cpp b/src/server/game/Movement/Waypoints/WaypointMgr.cpp index 7a2596fbf7..5d673b35a7 100644 --- a/src/server/game/Movement/Waypoints/WaypointMgr.cpp +++ b/src/server/game/Movement/Waypoints/WaypointMgr.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 @@ -30,9 +30,6 @@ WaypointMgr::~WaypointMgr() { for (WaypointPathContainer::iterator itr = _waypointStore.begin(); itr != _waypointStore.end(); ++itr) { - for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it) - delete *it; - itr->second.clear(); } @@ -64,7 +61,7 @@ void WaypointMgr::Load() do { Field* fields = result->Fetch(); - WaypointData* wp = new WaypointData(); + WaypointData data; uint32 pathId = fields[0].Get<uint32>(); WaypointPath& path = _waypointStore[pathId]; @@ -79,28 +76,40 @@ void WaypointMgr::Load() Acore::NormalizeMapCoord(x); Acore::NormalizeMapCoord(y); - wp->id = fields[1].Get<uint32>(); - wp->x = x; - wp->y = y; - wp->z = z; - wp->orientation = o; - wp->move_type = fields[6].Get<uint32>(); + data.id = fields[1].Get<uint32>(); + data.x = x; + data.y = y; + data.z = z; + data.orientation = o; + data.move_type = fields[6].Get<uint32>(); - if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX) + if (data.move_type >= WAYPOINT_MOVE_TYPE_MAX) { //LOG_ERROR("sql.sql", "Waypoint {} in waypoint_data has invalid move_type, ignoring", wp->id); - delete wp; continue; } - wp->delay = fields[7].Get<uint32>(); - wp->event_id = fields[8].Get<uint32>(); - wp->event_chance = fields[9].Get<int16>(); + data.delay = fields[7].Get<uint32>(); + data.event_id = fields[8].Get<uint32>(); + data.event_chance = fields[9].Get<int16>(); - path.push_back(wp); + path.emplace(data.id, data); ++count; } while (result->NextRow()); + for (auto itr = _waypointStore.begin(); itr != _waypointStore.end(); ) + { + uint32 first = itr->second.begin()->first; + uint32 last = itr->second.rbegin()->first; + if (last - first + 1 != itr->second.size()) + { + LOG_ERROR("sql.sql", "Waypoint {} in waypoint_data has non-contiguous pointids, skipping", itr->first); + itr = _waypointStore.erase(itr); + } + else + ++itr; + } + LOG_INFO("server.loading", ">> Loaded {} waypoints in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); LOG_INFO("server.loading", " "); } @@ -110,9 +119,6 @@ void WaypointMgr::ReloadPath(uint32 id) WaypointPathContainer::iterator itr = _waypointStore.find(id); if (itr != _waypointStore.end()) { - for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it) - delete *it; - _waypointStore.erase(itr); } @@ -130,7 +136,7 @@ void WaypointMgr::ReloadPath(uint32 id) do { Field* fields = result->Fetch(); - WaypointData* wp = new WaypointData(); + WaypointData data; float x = fields[1].Get<float>(); float y = fields[2].Get<float>(); @@ -142,24 +148,23 @@ void WaypointMgr::ReloadPath(uint32 id) Acore::NormalizeMapCoord(x); Acore::NormalizeMapCoord(y); - wp->id = fields[0].Get<uint32>(); - wp->x = x; - wp->y = y; - wp->z = z; - wp->orientation = o; - wp->move_type = fields[5].Get<uint32>(); + data.id = fields[0].Get<uint32>(); + data.x = x; + data.y = y; + data.z = z; + data.orientation = o; + data.move_type = fields[5].Get<uint32>(); - if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX) + if (data.move_type >= WAYPOINT_MOVE_TYPE_MAX) { //LOG_ERROR("sql.sql", "Waypoint {} in waypoint_data has invalid move_type, ignoring", wp->id); - delete wp; continue; } - wp->delay = fields[6].Get<uint32>(); - wp->event_id = fields[7].Get<uint32>(); - wp->event_chance = fields[8].Get<uint8>(); + data.delay = fields[6].Get<uint32>(); + data.event_id = fields[7].Get<uint32>(); + data.event_chance = fields[8].Get<uint8>(); - path.push_back(wp); + path.emplace(data.id, data); } while (result->NextRow()); } diff --git a/src/server/game/Movement/Waypoints/WaypointMgr.h b/src/server/game/Movement/Waypoints/WaypointMgr.h index ea588a28c5..f9c0d59df5 100644 --- a/src/server/game/Movement/Waypoints/WaypointMgr.h +++ b/src/server/game/Movement/Waypoints/WaypointMgr.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 @@ -22,6 +22,7 @@ #include <optional> #include <unordered_map> #include <vector> +#include <map> enum WaypointMoveType { @@ -39,12 +40,12 @@ struct WaypointData float x, y, z; std::optional<float> orientation; uint32 delay; - uint32 event_id; - uint32 move_type; - uint8 event_chance; + uint32 event_id = 0; + uint32 move_type = 0; + uint8 event_chance = 0; }; -typedef std::vector<WaypointData*> WaypointPath; +typedef std::map<uint32, WaypointData> WaypointPath; typedef std::unordered_map<uint32, WaypointPath> WaypointPathContainer; class WaypointMgr diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 330d99c3f6..9ca84858d7 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.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 @@ -635,7 +635,7 @@ void OutdoorPvP::BroadcastPacket(WorldPacket& data) const for (auto const& playerSet : _players) for (auto itr : playerSet) if (Player* const player = ObjectAccessor::FindPlayer(itr)) - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } void OutdoorPvP::RegisterZone(uint32 zoneId) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index fe773f1d3b..60ef22ed81 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.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/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index a27e534d75..7a8b6b986c 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.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/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h index 8737c0b5c7..1c1abf4921 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.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/Petitions/PetitionMgr.cpp b/src/server/game/Petitions/PetitionMgr.cpp index 7e946923ee..fc9633f016 100644 --- a/src/server/game/Petitions/PetitionMgr.cpp +++ b/src/server/game/Petitions/PetitionMgr.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/Petitions/PetitionMgr.h b/src/server/game/Petitions/PetitionMgr.h index cd7d47eadc..e28a983c47 100644 --- a/src/server/game/Petitions/PetitionMgr.h +++ b/src/server/game/Petitions/PetitionMgr.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/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 2a31e74740..479fd6ede2 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.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/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h index 89e6754471..cf251352c8 100644 --- a/src/server/game/Pools/PoolMgr.h +++ b/src/server/game/Pools/PoolMgr.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/PrecompiledHeaders/gamePCH.h b/src/server/game/PrecompiledHeaders/gamePCH.h index 1547ad29e9..89f2c6230e 100644 --- a/src/server/game/PrecompiledHeaders/gamePCH.h +++ b/src/server/game/PrecompiledHeaders/gamePCH.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/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 12edb29a2c..dff4763a44 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.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/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 247ac1ec21..97bd2f7590 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.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/Quests/enuminfo_QuestDef.cpp b/src/server/game/Quests/enuminfo_QuestDef.cpp index 6fbf2beb9c..61c519cd41 100644 --- a/src/server/game/Quests/enuminfo_QuestDef.cpp +++ b/src/server/game/Quests/enuminfo_QuestDef.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/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 2aae16a1c2..c9061158cd 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.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/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h index 1d9cbdad70..79d855ec05 100644 --- a/src/server/game/Reputation/ReputationMgr.h +++ b/src/server/game/Reputation/ReputationMgr.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/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 76e945a9c5..321b02c920 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.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 @@ -442,7 +442,7 @@ void Map::ScriptsProcess() if (step.script->MoveTo.TravelTime != 0) { float speed = unit->GetDistance(step.script->MoveTo.DestX, step.script->MoveTo.DestY, step.script->MoveTo.DestZ) / ((float)step.script->MoveTo.TravelTime * 0.001f); - unit->MonsterMoveWithSpeed(step.script->MoveTo.DestX, step.script->MoveTo.DestY, step.script->MoveTo.DestZ, speed); + unit->GetMotionMaster()->MovePoint(0, step.script->MoveTo.DestX, step.script->MoveTo.DestY, step.script->MoveTo.DestZ, FORCED_MOVEMENT_NONE, speed); } else unit->NearTeleportTo(step.script->MoveTo.DestX, step.script->MoveTo.DestY, step.script->MoveTo.DestZ, unit->GetOrientation()); @@ -757,7 +757,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_DESPAWN_SELF: // Target or source must be Creature. if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script, true)) - cSource->DespawnOrUnsummon(step.script->DespawnSelf.DespawnDelay); + cSource->DespawnOrUnsummon(Milliseconds(step.script->DespawnSelf.DespawnDelay)); break; case SCRIPT_COMMAND_LOAD_PATH: @@ -767,7 +767,7 @@ void Map::ScriptsProcess() if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID)) LOG_ERROR("maps.script", "{} source object has an invalid path ({}), skipping.", step.script->GetDebugInfo(), step.script->LoadPath.PathID); else - unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); + unit->GetMotionMaster()->MoveWaypoint(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); } break; @@ -880,7 +880,6 @@ void Map::ScriptsProcess() if (!cSource->IsAlive()) return; - cSource->GetMotionMaster()->MovementExpired(); cSource->GetMotionMaster()->MoveIdle(); switch (step.script->Movement.MovementType) @@ -889,7 +888,7 @@ void Map::ScriptsProcess() cSource->GetMotionMaster()->MoveRandom((float)step.script->Movement.MovementDistance); break; case WAYPOINT_MOTION_TYPE: - cSource->GetMotionMaster()->MovePath(step.script->Movement.Path, false); + cSource->GetMotionMaster()->MoveWaypoint(step.script->Movement.Path, false); break; } } diff --git a/src/server/game/Scripting/ScriptDefines/ElunaScript.cpp b/src/server/game/Scripting/ScriptDefines/ALEScript.cpp index fbaa7af765..480ddaa510 100644 --- a/src/server/game/Scripting/ScriptDefines/ElunaScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/ALEScript.cpp @@ -1,26 +1,26 @@ /* * 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 * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ElunaScript.h" +#include "ALEScript.h" #include "ScriptMgr.h" -ElunaScript::ElunaScript(const char* name) : ScriptObject(name) +ALEScript::ALEScript(const char* name) : ScriptObject(name) { - ScriptRegistry<ElunaScript>::AddScript(this); + ScriptRegistry<ALEScript>::AddScript(this); } -template class AC_GAME_API ScriptRegistry<ElunaScript>; +template class AC_GAME_API ScriptRegistry<ALEScript>; diff --git a/src/server/game/Scripting/ScriptDefines/ElunaScript.h b/src/server/game/Scripting/ScriptDefines/ALEScript.h index da028a7baf..a95c05d48e 100644 --- a/src/server/game/Scripting/ScriptDefines/ElunaScript.h +++ b/src/server/game/Scripting/ScriptDefines/ALEScript.h @@ -1,29 +1,29 @@ /* * 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 * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SCRIPT_OBJECT_ELUNA_SCRIPT_H_ -#define SCRIPT_OBJECT_ELUNA_SCRIPT_H_ +#ifndef SCRIPT_OBJECT_ALE_SCRIPT_H_ +#define SCRIPT_OBJECT_ALE_SCRIPT_H_ #include "ScriptObject.h" -class ElunaScript : public ScriptObject +class ALEScript : public ScriptObject { protected: - ElunaScript(const char* name); + ALEScript(const char* name); public: /** diff --git a/src/server/game/Scripting/ScriptDefines/AccountScript.cpp b/src/server/game/Scripting/ScriptDefines/AccountScript.cpp index 2749cd1a73..3527fcdc13 100644 --- a/src/server/game/Scripting/ScriptDefines/AccountScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AccountScript.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/Scripting/ScriptDefines/AccountScript.h b/src/server/game/Scripting/ScriptDefines/AccountScript.h index 3a06a1e989..038663ee32 100644 --- a/src/server/game/Scripting/ScriptDefines/AccountScript.h +++ b/src/server/game/Scripting/ScriptDefines/AccountScript.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/Scripting/ScriptDefines/AchievementCriteriaScript.cpp b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp index 9e0e44e677..f216726736 100644 --- a/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.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/Scripting/ScriptDefines/AchievementCriteriaScript.h b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.h index 9e097fbe08..9de6ad4463 100644 --- a/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.h +++ b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.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/Scripting/ScriptDefines/AchievementScript.cpp b/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp index 9bc742b73c..af84907379 100644 --- a/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AchievementScript.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/Scripting/ScriptDefines/AchievementScript.h b/src/server/game/Scripting/ScriptDefines/AchievementScript.h index 84aa3746e4..04c7e62041 100644 --- a/src/server/game/Scripting/ScriptDefines/AchievementScript.h +++ b/src/server/game/Scripting/ScriptDefines/AchievementScript.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/Scripting/ScriptDefines/AllBattlegroundScript.cpp b/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.cpp index af617ddba3..0c9c3c8f45 100644 --- a/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.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/Scripting/ScriptDefines/AllBattlegroundScript.h b/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.h index 9e8baba151..9ab6eea782 100644 --- a/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.h +++ b/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.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/Scripting/ScriptDefines/AllCommandScript.cpp b/src/server/game/Scripting/ScriptDefines/AllCommandScript.cpp index cf01d40919..0a5e795bb6 100644 --- a/src/server/game/Scripting/ScriptDefines/AllCommandScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AllCommandScript.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/Scripting/ScriptDefines/AllCommandScript.h b/src/server/game/Scripting/ScriptDefines/AllCommandScript.h index e56615b152..87d124739b 100644 --- a/src/server/game/Scripting/ScriptDefines/AllCommandScript.h +++ b/src/server/game/Scripting/ScriptDefines/AllCommandScript.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/Scripting/ScriptDefines/AllCreatureScript.cpp b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp index f34599d815..1093a4479c 100644 --- a/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.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/Scripting/ScriptDefines/AllCreatureScript.h b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.h index 71e230e8b3..d734f06c3a 100644 --- a/src/server/game/Scripting/ScriptDefines/AllCreatureScript.h +++ b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.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/Scripting/ScriptDefines/AllGameObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp index 55bd6cd16c..2a1f09d672 100644 --- a/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.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/Scripting/ScriptDefines/AllGameObjectScript.h b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.h index 2dd5ba2a76..496bc5300e 100644 --- a/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.h +++ b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.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/Scripting/ScriptDefines/AllItemScript.cpp b/src/server/game/Scripting/ScriptDefines/AllItemScript.cpp index c276bb5d0c..ecc51c5cda 100644 --- a/src/server/game/Scripting/ScriptDefines/AllItemScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AllItemScript.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/Scripting/ScriptDefines/AllItemScript.h b/src/server/game/Scripting/ScriptDefines/AllItemScript.h index 94c54c4b06..c28cf6acb7 100644 --- a/src/server/game/Scripting/ScriptDefines/AllItemScript.h +++ b/src/server/game/Scripting/ScriptDefines/AllItemScript.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/Scripting/ScriptDefines/AllMapScript.cpp b/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp index a02ae745ce..5f14b352d0 100644 --- a/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AllMapScript.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/Scripting/ScriptDefines/AllMapScript.h b/src/server/game/Scripting/ScriptDefines/AllMapScript.h index 86e7a0e6d2..31b97c7d69 100644 --- a/src/server/game/Scripting/ScriptDefines/AllMapScript.h +++ b/src/server/game/Scripting/ScriptDefines/AllMapScript.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/Scripting/ScriptDefines/AllScriptsObjects.h b/src/server/game/Scripting/ScriptDefines/AllScriptsObjects.h index 9196c32845..92dc41756e 100644 --- a/src/server/game/Scripting/ScriptDefines/AllScriptsObjects.h +++ b/src/server/game/Scripting/ScriptDefines/AllScriptsObjects.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 @@ -39,7 +39,7 @@ #include "CreatureScript.h" #include "DatabaseScript.h" #include "DynamicObjectScript.h" -#include "ElunaScript.h" +#include "ALEScript.h" #include "FormulaScript.h" #include "GameEventScript.h" #include "GameObjectScript.h" diff --git a/src/server/game/Scripting/ScriptDefines/AllSpellScript.cpp b/src/server/game/Scripting/ScriptDefines/AllSpellScript.cpp index 44f0866ee2..3f15648935 100644 --- a/src/server/game/Scripting/ScriptDefines/AllSpellScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AllSpellScript.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/Scripting/ScriptDefines/AllSpellScript.h b/src/server/game/Scripting/ScriptDefines/AllSpellScript.h index 3dd2711bdb..7536f8cf5b 100644 --- a/src/server/game/Scripting/ScriptDefines/AllSpellScript.h +++ b/src/server/game/Scripting/ScriptDefines/AllSpellScript.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/Scripting/ScriptDefines/AreaTriggerScript.cpp b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp index 6d3429606f..bb809d7cdc 100644 --- a/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.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 @@ -16,7 +16,7 @@ */ #include "AreaTriggerScript.h" -#include "ElunaScript.h" +#include "ALEScript.h" #include "Player.h" #include "ScriptMgr.h" #include "ScriptMgrMacros.h" @@ -26,7 +26,7 @@ bool ScriptMgr::OnAreaTrigger(Player* player, AreaTrigger const* trigger) ASSERT(player); ASSERT(trigger); - auto ret = IsValidBoolScript<ElunaScript>([&](ElunaScript* script) + auto ret = IsValidBoolScript<ALEScript>([&](ALEScript* script) { return script->CanAreaTrigger(player, trigger); }); diff --git a/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.h b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.h index 1ce1e59d06..186a87bc70 100644 --- a/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.h +++ b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.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/Scripting/ScriptDefines/ArenaScript.cpp b/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp index b0869c7996..af3baf3328 100644 --- a/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/ArenaScript.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/Scripting/ScriptDefines/ArenaScript.h b/src/server/game/Scripting/ScriptDefines/ArenaScript.h index e9a3f1c800..152dd75842 100644 --- a/src/server/game/Scripting/ScriptDefines/ArenaScript.h +++ b/src/server/game/Scripting/ScriptDefines/ArenaScript.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/Scripting/ScriptDefines/ArenaTeamScript.cpp b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp index e232e646a4..a5cc123c15 100644 --- a/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.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/Scripting/ScriptDefines/ArenaTeamScript.h b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.h index 0e80dee804..1a6c997046 100644 --- a/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.h +++ b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.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/Scripting/ScriptDefines/AuctionHouseScript.cpp b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp index be3e010cf2..bb978bc811 100644 --- a/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.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/Scripting/ScriptDefines/AuctionHouseScript.h b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.h index e2d014b976..c821da64a7 100644 --- a/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.h +++ b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.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/Scripting/ScriptDefines/BattlegroundMapScript.cpp b/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.cpp index 1d0ac139ab..6f084bd5e1 100644 --- a/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.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/Scripting/ScriptDefines/BattlegroundMapScript.h b/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.h index c0c9c4518a..090206c0d2 100644 --- a/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.h +++ b/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.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/Scripting/ScriptDefines/BattlegroundScript.cpp b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp index 89cb1462e1..b91d159396 100644 --- a/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.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/Scripting/ScriptDefines/BattlegroundScript.h b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.h index 70b59f2d46..b91502e86c 100644 --- a/src/server/game/Scripting/ScriptDefines/BattlegroundScript.h +++ b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.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/Scripting/ScriptDefines/CommandScript.cpp b/src/server/game/Scripting/ScriptDefines/CommandScript.cpp index 5d930ec0ab..e9e672d88f 100644 --- a/src/server/game/Scripting/ScriptDefines/CommandScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/CommandScript.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/Scripting/ScriptDefines/CommandScript.h b/src/server/game/Scripting/ScriptDefines/CommandScript.h index 397332481b..7c89cdf5e1 100644 --- a/src/server/game/Scripting/ScriptDefines/CommandScript.h +++ b/src/server/game/Scripting/ScriptDefines/CommandScript.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/Scripting/ScriptDefines/ConditionScript.cpp b/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp index eab4efb6f8..64a73c3fd9 100644 --- a/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/ConditionScript.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/Scripting/ScriptDefines/ConditionScript.h b/src/server/game/Scripting/ScriptDefines/ConditionScript.h index 3f7295e823..c530458697 100644 --- a/src/server/game/Scripting/ScriptDefines/ConditionScript.h +++ b/src/server/game/Scripting/ScriptDefines/ConditionScript.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/Scripting/ScriptDefines/CreatureScript.cpp b/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp index d1a76580d1..6e4f36927e 100644 --- a/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/CreatureScript.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/Scripting/ScriptDefines/CreatureScript.h b/src/server/game/Scripting/ScriptDefines/CreatureScript.h index 4fab28f94e..508ba2b49f 100644 --- a/src/server/game/Scripting/ScriptDefines/CreatureScript.h +++ b/src/server/game/Scripting/ScriptDefines/CreatureScript.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/Scripting/ScriptDefines/DatabaseScript.cpp b/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp index 550564373e..df84d21564 100644 --- a/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/DatabaseScript.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/Scripting/ScriptDefines/DatabaseScript.h b/src/server/game/Scripting/ScriptDefines/DatabaseScript.h index 3340676fa8..708f0a9864 100644 --- a/src/server/game/Scripting/ScriptDefines/DatabaseScript.h +++ b/src/server/game/Scripting/ScriptDefines/DatabaseScript.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/Scripting/ScriptDefines/DynamicObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp index a3dc5ebfab..d2826b1c41 100644 --- a/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.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/Scripting/ScriptDefines/DynamicObjectScript.h b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.h index b29f5a6bcc..da51a86d59 100644 --- a/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.h +++ b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.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/Scripting/ScriptDefines/FormulaScript.cpp b/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp index 7eb79ae0e5..da9fe26a05 100644 --- a/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/FormulaScript.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/Scripting/ScriptDefines/FormulaScript.h b/src/server/game/Scripting/ScriptDefines/FormulaScript.h index 2145e0f0c5..a95a676037 100644 --- a/src/server/game/Scripting/ScriptDefines/FormulaScript.h +++ b/src/server/game/Scripting/ScriptDefines/FormulaScript.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/Scripting/ScriptDefines/GameEventScript.cpp b/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp index 1c47e071e1..75d7133119 100644 --- a/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/GameEventScript.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/Scripting/ScriptDefines/GameEventScript.h b/src/server/game/Scripting/ScriptDefines/GameEventScript.h index 7902d56af3..6829cd651f 100644 --- a/src/server/game/Scripting/ScriptDefines/GameEventScript.h +++ b/src/server/game/Scripting/ScriptDefines/GameEventScript.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/Scripting/ScriptDefines/GameObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp index f8b15a7ab9..ddc5fdbaf5 100644 --- a/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/GameObjectScript.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/Scripting/ScriptDefines/GameObjectScript.h b/src/server/game/Scripting/ScriptDefines/GameObjectScript.h index 418a28883a..174ca61ba3 100644 --- a/src/server/game/Scripting/ScriptDefines/GameObjectScript.h +++ b/src/server/game/Scripting/ScriptDefines/GameObjectScript.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/Scripting/ScriptDefines/GlobalScript.cpp b/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp index 3d2ccc4524..28285e9c23 100644 --- a/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/GlobalScript.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/Scripting/ScriptDefines/GlobalScript.h b/src/server/game/Scripting/ScriptDefines/GlobalScript.h index c683650f4b..b22a22fb95 100644 --- a/src/server/game/Scripting/ScriptDefines/GlobalScript.h +++ b/src/server/game/Scripting/ScriptDefines/GlobalScript.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/Scripting/ScriptDefines/GroupScript.cpp b/src/server/game/Scripting/ScriptDefines/GroupScript.cpp index aed5e68ffb..5e808a3b17 100644 --- a/src/server/game/Scripting/ScriptDefines/GroupScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/GroupScript.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/Scripting/ScriptDefines/GroupScript.h b/src/server/game/Scripting/ScriptDefines/GroupScript.h index 96f396418d..0995e3e919 100644 --- a/src/server/game/Scripting/ScriptDefines/GroupScript.h +++ b/src/server/game/Scripting/ScriptDefines/GroupScript.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/Scripting/ScriptDefines/GuildScript.cpp b/src/server/game/Scripting/ScriptDefines/GuildScript.cpp index 480c9968ca..ee141e598f 100644 --- a/src/server/game/Scripting/ScriptDefines/GuildScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/GuildScript.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/Scripting/ScriptDefines/GuildScript.h b/src/server/game/Scripting/ScriptDefines/GuildScript.h index ebdfad81f7..206b3a8828 100644 --- a/src/server/game/Scripting/ScriptDefines/GuildScript.h +++ b/src/server/game/Scripting/ScriptDefines/GuildScript.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/Scripting/ScriptDefines/InstanceMapScript.cpp b/src/server/game/Scripting/ScriptDefines/InstanceMapScript.cpp index c930b829bb..ada552c0a6 100644 --- a/src/server/game/Scripting/ScriptDefines/InstanceMapScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/InstanceMapScript.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/Scripting/ScriptDefines/InstanceMapScript.h b/src/server/game/Scripting/ScriptDefines/InstanceMapScript.h index 74b5024ba3..b4632e5d59 100644 --- a/src/server/game/Scripting/ScriptDefines/InstanceMapScript.h +++ b/src/server/game/Scripting/ScriptDefines/InstanceMapScript.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/Scripting/ScriptDefines/ItemScript.h b/src/server/game/Scripting/ScriptDefines/ItemScript.h index baa8c07f1b..e29af46402 100644 --- a/src/server/game/Scripting/ScriptDefines/ItemScript.h +++ b/src/server/game/Scripting/ScriptDefines/ItemScript.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/Scripting/ScriptDefines/LootScript.cpp b/src/server/game/Scripting/ScriptDefines/LootScript.cpp index a6231b4a48..c17ca9d2b1 100644 --- a/src/server/game/Scripting/ScriptDefines/LootScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/LootScript.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/Scripting/ScriptDefines/LootScript.h b/src/server/game/Scripting/ScriptDefines/LootScript.h index 445abdddcc..c501bedf05 100644 --- a/src/server/game/Scripting/ScriptDefines/LootScript.h +++ b/src/server/game/Scripting/ScriptDefines/LootScript.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/Scripting/ScriptDefines/MailScript.cpp b/src/server/game/Scripting/ScriptDefines/MailScript.cpp index 0f867fb08b..3191ad356c 100644 --- a/src/server/game/Scripting/ScriptDefines/MailScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/MailScript.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/Scripting/ScriptDefines/MailScript.h b/src/server/game/Scripting/ScriptDefines/MailScript.h index 4591168a5d..479ca8d3b6 100644 --- a/src/server/game/Scripting/ScriptDefines/MailScript.h +++ b/src/server/game/Scripting/ScriptDefines/MailScript.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/Scripting/ScriptDefines/MiscScript.cpp b/src/server/game/Scripting/ScriptDefines/MiscScript.cpp index 7ec76e4e7c..1bc6d6faa9 100644 --- a/src/server/game/Scripting/ScriptDefines/MiscScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/MiscScript.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/Scripting/ScriptDefines/MiscScript.h b/src/server/game/Scripting/ScriptDefines/MiscScript.h index 607c34dce1..17fe66d24a 100644 --- a/src/server/game/Scripting/ScriptDefines/MiscScript.h +++ b/src/server/game/Scripting/ScriptDefines/MiscScript.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/Scripting/ScriptDefines/ModuleScript.cpp b/src/server/game/Scripting/ScriptDefines/ModuleScript.cpp index 3205d24548..95256bfcea 100644 --- a/src/server/game/Scripting/ScriptDefines/ModuleScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/ModuleScript.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/Scripting/ScriptDefines/ModuleScript.h b/src/server/game/Scripting/ScriptDefines/ModuleScript.h index 7ae228caec..2d0201e048 100644 --- a/src/server/game/Scripting/ScriptDefines/ModuleScript.h +++ b/src/server/game/Scripting/ScriptDefines/ModuleScript.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/Scripting/ScriptDefines/MovementHandlerScript.cpp b/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.cpp index a0fa539b9d..e55fdfb006 100644 --- a/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.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/Scripting/ScriptDefines/MovementHandlerScript.h b/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.h index 82f80af6c6..df45266ed1 100644 --- a/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.h +++ b/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.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/Scripting/ScriptDefines/OutdoorPvPScript.cpp b/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.cpp index d7fff6cdbf..49fadf77b8 100644 --- a/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.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/Scripting/ScriptDefines/OutdoorPvPScript.h b/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.h index 9fc7f39513..fc8d2dea4e 100644 --- a/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.h +++ b/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.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/Scripting/ScriptDefines/PetScript.cpp b/src/server/game/Scripting/ScriptDefines/PetScript.cpp index 2734e80776..7778c809b7 100644 --- a/src/server/game/Scripting/ScriptDefines/PetScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/PetScript.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/Scripting/ScriptDefines/PetScript.h b/src/server/game/Scripting/ScriptDefines/PetScript.h index b7731bf581..12090149bd 100644 --- a/src/server/game/Scripting/ScriptDefines/PetScript.h +++ b/src/server/game/Scripting/ScriptDefines/PetScript.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/Scripting/ScriptDefines/PlayerScript.cpp b/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp index 26ba8cba5b..b032688930 100644 --- a/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/PlayerScript.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 @@ -169,36 +169,11 @@ void ScriptMgr::OnPlayerDuelEnd(Player* winner, Player* loser, DuelCompleteType CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_DUEL_END, script->OnPlayerDuelEnd(winner, loser, type)); } -void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg) -{ - CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_CHAT, script->OnPlayerChat(player, type, lang, msg)); -} - void ScriptMgr::OnPlayerBeforeSendChatMessage(Player* player, uint32& type, uint32& lang, std::string& msg) { CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_SEND_CHAT_MESSAGE, script->OnPlayerBeforeSendChatMessage(player, type, lang, msg)); } -void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* receiver) -{ - CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_CHAT_WITH_RECEIVER, script->OnPlayerChat(player, type, lang, msg, receiver)); -} - -void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) -{ - CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_CHAT_WITH_GROUP, script->OnPlayerChat(player, type, lang, msg, group)); -} - -void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild) -{ - CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_CHAT_WITH_GUILD, script->OnPlayerChat(player, type, lang, msg, guild)); -} - -void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel) -{ - CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_CHAT_WITH_CHANNEL, script->OnPlayerChat(player, type, lang, msg, channel)); -} - void ScriptMgr::OnPlayerEmote(Player* player, uint32 emote) { CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_EMOTE, script->OnPlayerEmote(player, emote)); diff --git a/src/server/game/Scripting/ScriptDefines/PlayerScript.h b/src/server/game/Scripting/ScriptDefines/PlayerScript.h index 2faa19539c..3b6dfe7284 100644 --- a/src/server/game/Scripting/ScriptDefines/PlayerScript.h +++ b/src/server/game/Scripting/ScriptDefines/PlayerScript.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 @@ -55,12 +55,7 @@ enum PlayerHook PLAYERHOOK_ON_DUEL_REQUEST, PLAYERHOOK_ON_DUEL_START, PLAYERHOOK_ON_DUEL_END, - PLAYERHOOK_ON_CHAT, PLAYERHOOK_ON_BEFORE_SEND_CHAT_MESSAGE, - PLAYERHOOK_ON_CHAT_WITH_RECEIVER, - PLAYERHOOK_ON_CHAT_WITH_GROUP, - PLAYERHOOK_ON_CHAT_WITH_GUILD, - PLAYERHOOK_ON_CHAT_WITH_CHANNEL, PLAYERHOOK_ON_EMOTE, PLAYERHOOK_ON_TEXT_EMOTE, PLAYERHOOK_ON_SPELL_CAST, @@ -303,18 +298,8 @@ public: virtual void OnPlayerDuelEnd(Player* /*winner*/, Player* /*loser*/, DuelCompleteType /*type*/) { } // The following methods are called when a player sends a chat message. - virtual void OnPlayerChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/) { } - virtual void OnPlayerBeforeSendChatMessage(Player* /*player*/, uint32& /*type*/, uint32& /*lang*/, std::string& /*msg*/) { } - virtual void OnPlayerChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Player* /*receiver*/) { } - - virtual void OnPlayerChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Group* /*group*/) { } - - virtual void OnPlayerChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Guild* /*guild*/) { } - - virtual void OnPlayerChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Channel* /*channel*/) { } - // Both of the below are called on emote opcodes. virtual void OnPlayerEmote(Player* /*player*/, uint32 /*emote*/) { } diff --git a/src/server/game/Scripting/ScriptDefines/ServerScript.cpp b/src/server/game/Scripting/ScriptDefines/ServerScript.cpp index 1384d680be..9794127f09 100644 --- a/src/server/game/Scripting/ScriptDefines/ServerScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/ServerScript.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/Scripting/ScriptDefines/ServerScript.h b/src/server/game/Scripting/ScriptDefines/ServerScript.h index 89c29b1f0d..5f3a7787b0 100644 --- a/src/server/game/Scripting/ScriptDefines/ServerScript.h +++ b/src/server/game/Scripting/ScriptDefines/ServerScript.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/Scripting/ScriptDefines/SpellScriptLoader.cpp b/src/server/game/Scripting/ScriptDefines/SpellScriptLoader.cpp index 06aecaa12e..b95c35700c 100644 --- a/src/server/game/Scripting/ScriptDefines/SpellScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptDefines/SpellScriptLoader.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/Scripting/ScriptDefines/SpellScriptLoader.h b/src/server/game/Scripting/ScriptDefines/SpellScriptLoader.h index 826d5288ea..841ccb5f22 100644 --- a/src/server/game/Scripting/ScriptDefines/SpellScriptLoader.h +++ b/src/server/game/Scripting/ScriptDefines/SpellScriptLoader.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/Scripting/ScriptDefines/TicketScript.cpp b/src/server/game/Scripting/ScriptDefines/TicketScript.cpp index a7e72076fd..9d2663799c 100644 --- a/src/server/game/Scripting/ScriptDefines/TicketScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/TicketScript.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/Scripting/ScriptDefines/TicketScript.h b/src/server/game/Scripting/ScriptDefines/TicketScript.h index 43bf616aed..7a5ab745f2 100644 --- a/src/server/game/Scripting/ScriptDefines/TicketScript.h +++ b/src/server/game/Scripting/ScriptDefines/TicketScript.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/Scripting/ScriptDefines/TransportScript.cpp b/src/server/game/Scripting/ScriptDefines/TransportScript.cpp index f6eb1df821..d9a4639579 100644 --- a/src/server/game/Scripting/ScriptDefines/TransportScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/TransportScript.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/Scripting/ScriptDefines/TransportScript.h b/src/server/game/Scripting/ScriptDefines/TransportScript.h index df1f5ed68a..3a6fa60188 100644 --- a/src/server/game/Scripting/ScriptDefines/TransportScript.h +++ b/src/server/game/Scripting/ScriptDefines/TransportScript.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/Scripting/ScriptDefines/UnitScript.cpp b/src/server/game/Scripting/ScriptDefines/UnitScript.cpp index 68c53367f0..2975ec4f1a 100644 --- a/src/server/game/Scripting/ScriptDefines/UnitScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/UnitScript.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/Scripting/ScriptDefines/UnitScript.h b/src/server/game/Scripting/ScriptDefines/UnitScript.h index efee6defe2..26c4e2b13d 100644 --- a/src/server/game/Scripting/ScriptDefines/UnitScript.h +++ b/src/server/game/Scripting/ScriptDefines/UnitScript.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/Scripting/ScriptDefines/VehicleScript.cpp b/src/server/game/Scripting/ScriptDefines/VehicleScript.cpp index 590050f4d4..35cc6fbebd 100644 --- a/src/server/game/Scripting/ScriptDefines/VehicleScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/VehicleScript.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/Scripting/ScriptDefines/VehicleScript.h b/src/server/game/Scripting/ScriptDefines/VehicleScript.h index b1e7cf7bfd..c1f6b7b87f 100644 --- a/src/server/game/Scripting/ScriptDefines/VehicleScript.h +++ b/src/server/game/Scripting/ScriptDefines/VehicleScript.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/Scripting/ScriptDefines/WeatherScript.cpp b/src/server/game/Scripting/ScriptDefines/WeatherScript.cpp index 5232ae0ca4..863b576226 100644 --- a/src/server/game/Scripting/ScriptDefines/WeatherScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/WeatherScript.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 @@ -16,7 +16,7 @@ */ #include "WeatherScript.h" -#include "ElunaScript.h" +#include "ALEScript.h" #include "ScriptMgr.h" #include "ScriptMgrMacros.h" @@ -24,7 +24,7 @@ void ScriptMgr::OnWeatherChange(Weather* weather, WeatherState state, float grad { ASSERT(weather); - ExecuteScript<ElunaScript>([&](ElunaScript* script) + ExecuteScript<ALEScript>([&](ALEScript* script) { script->OnWeatherChange(weather, state, grade); }); diff --git a/src/server/game/Scripting/ScriptDefines/WeatherScript.h b/src/server/game/Scripting/ScriptDefines/WeatherScript.h index 60a86290b3..b85d158763 100644 --- a/src/server/game/Scripting/ScriptDefines/WeatherScript.h +++ b/src/server/game/Scripting/ScriptDefines/WeatherScript.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/Scripting/ScriptDefines/WorldMapScript.cpp b/src/server/game/Scripting/ScriptDefines/WorldMapScript.cpp index bacbabc92d..da35cebc37 100644 --- a/src/server/game/Scripting/ScriptDefines/WorldMapScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/WorldMapScript.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/Scripting/ScriptDefines/WorldMapScript.h b/src/server/game/Scripting/ScriptDefines/WorldMapScript.h index bbfc0d83b9..40ff656c7c 100644 --- a/src/server/game/Scripting/ScriptDefines/WorldMapScript.h +++ b/src/server/game/Scripting/ScriptDefines/WorldMapScript.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/Scripting/ScriptDefines/WorldObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/WorldObjectScript.cpp index 5a5a8de268..040465e652 100644 --- a/src/server/game/Scripting/ScriptDefines/WorldObjectScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/WorldObjectScript.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/Scripting/ScriptDefines/WorldObjectScript.h b/src/server/game/Scripting/ScriptDefines/WorldObjectScript.h index 84398629e6..e83bea37b4 100644 --- a/src/server/game/Scripting/ScriptDefines/WorldObjectScript.h +++ b/src/server/game/Scripting/ScriptDefines/WorldObjectScript.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/Scripting/ScriptDefines/WorldScript.cpp b/src/server/game/Scripting/ScriptDefines/WorldScript.cpp index dc328a1267..e5eef46755 100644 --- a/src/server/game/Scripting/ScriptDefines/WorldScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/WorldScript.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/Scripting/ScriptDefines/WorldScript.h b/src/server/game/Scripting/ScriptDefines/WorldScript.h index 1c1c0885bd..75589426e4 100644 --- a/src/server/game/Scripting/ScriptDefines/WorldScript.h +++ b/src/server/game/Scripting/ScriptDefines/WorldScript.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/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 3a78145cab..34ad17546d 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.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 @@ -127,7 +127,7 @@ void ScriptMgr::Unload() SCR_CLEAR<CreatureScript>(); SCR_CLEAR<DatabaseScript>(); SCR_CLEAR<DynamicObjectScript>(); - SCR_CLEAR<ElunaScript>(); + SCR_CLEAR<ALEScript>(); SCR_CLEAR<FormulaScript>(); SCR_CLEAR<GameEventScript>(); SCR_CLEAR<GameObjectScript>(); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 6b3efdb86d..6a9a0914d3 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.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 @@ -319,12 +319,7 @@ public: /* PlayerScript */ void OnPlayerDuelRequest(Player* target, Player* challenger); void OnPlayerDuelStart(Player* player1, Player* player2); void OnPlayerDuelEnd(Player* winner, Player* loser, DuelCompleteType type); - void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg); void OnPlayerBeforeSendChatMessage(Player* player, uint32& type, uint32& lang, std::string& msg); - void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* receiver); - void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group); - void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild); - void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel); void OnPlayerEmote(Player* player, uint32 emote); void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid); void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck); diff --git a/src/server/game/Scripting/ScriptMgrMacros.h b/src/server/game/Scripting/ScriptMgrMacros.h index 10232c589c..8089597679 100644 --- a/src/server/game/Scripting/ScriptMgrMacros.h +++ b/src/server/game/Scripting/ScriptMgrMacros.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/Scripting/ScriptObject.cpp b/src/server/game/Scripting/ScriptObject.cpp index 1143f328d7..0afe6ad520 100644 --- a/src/server/game/Scripting/ScriptObject.cpp +++ b/src/server/game/Scripting/ScriptObject.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/Scripting/ScriptObject.h b/src/server/game/Scripting/ScriptObject.h index fe6cb2c12d..bd2021417c 100644 --- a/src/server/game/Scripting/ScriptObject.h +++ b/src/server/game/Scripting/ScriptObject.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/Scripting/ScriptObjectFwd.h b/src/server/game/Scripting/ScriptObjectFwd.h index dc8036fb62..dba980d447 100644 --- a/src/server/game/Scripting/ScriptObjectFwd.h +++ b/src/server/game/Scripting/ScriptObjectFwd.h @@ -1,14 +1,14 @@ /* - * This file is part of the AzeerothCore Project. See AUTHORS file for Copyright information + * 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/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index d6aa37b35e..c3e29e88ae 100644 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.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/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index 3a33cca7ae..087ab3b0a1 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.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/Server/Packet.cpp b/src/server/game/Server/Packet.cpp index 47d4e4fbec..23f069fb25 100644 --- a/src/server/game/Server/Packet.cpp +++ b/src/server/game/Server/Packet.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/Server/Packet.h b/src/server/game/Server/Packet.h index 0bb5664ae8..766e356553 100644 --- a/src/server/game/Server/Packet.h +++ b/src/server/game/Server/Packet.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/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h index 498dafb907..e0cbdf7d1c 100644 --- a/src/server/game/Server/Packets/AllPackets.h +++ b/src/server/game/Server/Packets/AllPackets.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 @@ -19,6 +19,7 @@ #define AllPackets_h__ #include "BankPackets.h" +#include "CalendarPackets.h" #include "CharacterPackets.h" #include "ChatPackets.h" #include "CombatLogPackets.h" diff --git a/src/server/game/Server/Packets/BankPackets.cpp b/src/server/game/Server/Packets/BankPackets.cpp index c593730826..23ceff679f 100644 --- a/src/server/game/Server/Packets/BankPackets.cpp +++ b/src/server/game/Server/Packets/BankPackets.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/Server/Packets/BankPackets.h b/src/server/game/Server/Packets/BankPackets.h index 707680579a..2f24210bd1 100644 --- a/src/server/game/Server/Packets/BankPackets.h +++ b/src/server/game/Server/Packets/BankPackets.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/Server/Packets/CalendarPackets.cpp b/src/server/game/Server/Packets/CalendarPackets.cpp new file mode 100644 index 0000000000..2ff2cdd0d6 --- /dev/null +++ b/src/server/game/Server/Packets/CalendarPackets.cpp @@ -0,0 +1,41 @@ +/* + * 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 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "CalendarPackets.h" + +void WorldPackets::Calendar::GetEvent::Read() +{ + _worldPacket >> EventId; +} + +void WorldPackets::Calendar::GuildFilter::Read() +{ + _worldPacket >> MinimumLevel; + _worldPacket >> MaximumLevel; + _worldPacket >> MinimumRank; +} + +void WorldPackets::Calendar::ArenaTeam::Read() +{ + _worldPacket >> ArenaTeamId; +} + +void WorldPackets::Calendar::CalendarComplain::Read() +{ + _worldPacket >> EventId; + _worldPacket >> ComplainGuid; +} diff --git a/src/server/game/Server/Packets/CalendarPackets.h b/src/server/game/Server/Packets/CalendarPackets.h new file mode 100644 index 0000000000..f8ee056cb6 --- /dev/null +++ b/src/server/game/Server/Packets/CalendarPackets.h @@ -0,0 +1,73 @@ +/* + * 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 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef CalendarPackets_h__ +#define CalendarPackets_h__ + +#include "Guild.h" +#include "Packet.h" + +namespace WorldPackets +{ + namespace Calendar + { + class GetEvent final : public ClientPacket + { + public: + GetEvent(WorldPacket&& packet) : ClientPacket(CMSG_CALENDAR_GET_EVENT, std::move(packet)) {} + + void Read() override; + + uint64 EventId = 0; + }; + + class GuildFilter final : public ClientPacket + { + public: + GuildFilter(WorldPacket&& packet) : ClientPacket(CMSG_CALENDAR_GUILD_FILTER, std::move(packet)) {} + + void Read() override; + + uint32 MinimumLevel = 1; + uint32 MaximumLevel = 1; + uint32 MinimumRank = GR_GUILDMASTER; + }; + + class ArenaTeam final : public ClientPacket + { + public: + ArenaTeam(WorldPacket&& packet) : ClientPacket(CMSG_CALENDAR_ARENA_TEAM, std::move(packet)) {} + + void Read() override; + + uint32 ArenaTeamId = 0; + }; + + class CalendarComplain final : public ClientPacket + { + public: + CalendarComplain(WorldPacket&& packet) : ClientPacket(CMSG_CALENDAR_COMPLAIN, std::move(packet)) {} + + void Read() override; + + uint64 EventId = 0; + ObjectGuid ComplainGuid; + }; + } +} + +#endif // CalendarPackets_h__ diff --git a/src/server/game/Server/Packets/CharacterPackets.cpp b/src/server/game/Server/Packets/CharacterPackets.cpp index d641849e81..2f26595380 100644 --- a/src/server/game/Server/Packets/CharacterPackets.cpp +++ b/src/server/game/Server/Packets/CharacterPackets.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/Server/Packets/CharacterPackets.h b/src/server/game/Server/Packets/CharacterPackets.h index a1d0a952b5..0defd6e51b 100644 --- a/src/server/game/Server/Packets/CharacterPackets.h +++ b/src/server/game/Server/Packets/CharacterPackets.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/Server/Packets/ChatPackets.cpp b/src/server/game/Server/Packets/ChatPackets.cpp index b840b888c4..55fc089d37 100644 --- a/src/server/game/Server/Packets/ChatPackets.cpp +++ b/src/server/game/Server/Packets/ChatPackets.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/Server/Packets/ChatPackets.h b/src/server/game/Server/Packets/ChatPackets.h index aec83b167c..df17bfbecb 100644 --- a/src/server/game/Server/Packets/ChatPackets.h +++ b/src/server/game/Server/Packets/ChatPackets.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/Server/Packets/CombatLogPackets.cpp b/src/server/game/Server/Packets/CombatLogPackets.cpp index 1b6d6535e2..d6c4b1c4f8 100644 --- a/src/server/game/Server/Packets/CombatLogPackets.cpp +++ b/src/server/game/Server/Packets/CombatLogPackets.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/Server/Packets/CombatLogPackets.h b/src/server/game/Server/Packets/CombatLogPackets.h index 30bb759073..6902a60243 100644 --- a/src/server/game/Server/Packets/CombatLogPackets.h +++ b/src/server/game/Server/Packets/CombatLogPackets.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/Server/Packets/CombatPackets.cpp b/src/server/game/Server/Packets/CombatPackets.cpp index 7a82cf0b8c..a58ec7edb6 100644 --- a/src/server/game/Server/Packets/CombatPackets.cpp +++ b/src/server/game/Server/Packets/CombatPackets.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/Server/Packets/CombatPackets.h b/src/server/game/Server/Packets/CombatPackets.h index 1126d907de..b379c33f24 100644 --- a/src/server/game/Server/Packets/CombatPackets.h +++ b/src/server/game/Server/Packets/CombatPackets.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/Server/Packets/GuildPackets.cpp b/src/server/game/Server/Packets/GuildPackets.cpp index cbb1aeeb56..f624ca9da8 100644 --- a/src/server/game/Server/Packets/GuildPackets.cpp +++ b/src/server/game/Server/Packets/GuildPackets.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/Server/Packets/GuildPackets.h b/src/server/game/Server/Packets/GuildPackets.h index ee68324af7..b2d19c261b 100644 --- a/src/server/game/Server/Packets/GuildPackets.h +++ b/src/server/game/Server/Packets/GuildPackets.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/Server/Packets/ItemPackets.cpp b/src/server/game/Server/Packets/ItemPackets.cpp index e86ae3879d..e48ae274b2 100644 --- a/src/server/game/Server/Packets/ItemPackets.cpp +++ b/src/server/game/Server/Packets/ItemPackets.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/Server/Packets/ItemPackets.h b/src/server/game/Server/Packets/ItemPackets.h index 04d8841888..93fe08bb73 100644 --- a/src/server/game/Server/Packets/ItemPackets.h +++ b/src/server/game/Server/Packets/ItemPackets.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/Server/Packets/LFGPackets.cpp b/src/server/game/Server/Packets/LFGPackets.cpp index 4079bf52f6..777b8b399b 100644 --- a/src/server/game/Server/Packets/LFGPackets.cpp +++ b/src/server/game/Server/Packets/LFGPackets.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/Server/Packets/LFGPackets.h b/src/server/game/Server/Packets/LFGPackets.h index e91dc84c16..eb45977fdd 100644 --- a/src/server/game/Server/Packets/LFGPackets.h +++ b/src/server/game/Server/Packets/LFGPackets.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/Server/Packets/MiscPackets.cpp b/src/server/game/Server/Packets/MiscPackets.cpp index 1098453813..64e248dd52 100644 --- a/src/server/game/Server/Packets/MiscPackets.cpp +++ b/src/server/game/Server/Packets/MiscPackets.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 @@ -140,3 +140,31 @@ WorldPacket const* WorldPackets::Misc::UITime::Write() return &_worldPacket; } + +void WorldPackets::Misc::Complain::Read() +{ + _worldPacket >> SpamType; // 0 - mail, 1 - chat + _worldPacket >> SpammerGuid; + switch (SpamType) + { + case 0: + _worldPacket >> Unk1; // const 0 + _worldPacket >> Unk2; // probably mail id + _worldPacket >> Unk3; // const 0 + break; + case 1: + _worldPacket >> Unk1; // probably language + _worldPacket >> Unk2; // message type? + _worldPacket >> Unk3; // probably channel id + _worldPacket >> Unk4; // unk random value + _worldPacket >> Description; // spam description string (messagetype, channel name, player name, message) + break; + } +} + +WorldPacket const* WorldPackets::Misc::ComplainResult::Write() +{ + _worldPacket << Unk; + + return &_worldPacket; +} diff --git a/src/server/game/Server/Packets/MiscPackets.h b/src/server/game/Server/Packets/MiscPackets.h index 7453ad7fc4..5b0689168b 100644 --- a/src/server/game/Server/Packets/MiscPackets.h +++ b/src/server/game/Server/Packets/MiscPackets.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 @@ -210,6 +210,32 @@ namespace WorldPackets uint32 Time = 0; }; + + class Complain final : public ClientPacket + { + public: + Complain(WorldPacket&& packet) : ClientPacket(CMSG_COMPLAIN, std::move(packet)) {} + + void Read() override; + + uint8 SpamType = 0; // 0 - mail, 1 - chat + ObjectGuid SpammerGuid; + uint32 Unk1 = 0; + uint32 Unk2 = 0; + uint32 Unk3 = 0; + uint32 Unk4 = 0; + std::string Description = ""; + }; + + class ComplainResult final : public ServerPacket + { + public: + ComplainResult() : ServerPacket(SMSG_COMPLAIN_RESULT, 1) {} + + WorldPacket const* Write() override; + + uint8 Unk = 0; + }; } } diff --git a/src/server/game/Server/Packets/PacketUtilities.cpp b/src/server/game/Server/Packets/PacketUtilities.cpp index e92ede5df2..36675f02ac 100644 --- a/src/server/game/Server/Packets/PacketUtilities.cpp +++ b/src/server/game/Server/Packets/PacketUtilities.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/Server/Packets/PacketUtilities.h b/src/server/game/Server/Packets/PacketUtilities.h index 62deeca650..b80d3b7b3e 100644 --- a/src/server/game/Server/Packets/PacketUtilities.h +++ b/src/server/game/Server/Packets/PacketUtilities.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/Server/Packets/PetPackets.cpp b/src/server/game/Server/Packets/PetPackets.cpp index 8028bce25c..03001b4d5b 100644 --- a/src/server/game/Server/Packets/PetPackets.cpp +++ b/src/server/game/Server/Packets/PetPackets.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,3 +50,19 @@ WorldPacket const* WorldPackets::Pet::PetUnlearnedSpell::Write() _worldPacket << uint32(SpellID); return &_worldPacket; } + +WorldPacket const* WorldPackets::Pet::PetActionSound::Write() +{ + _worldPacket << UnitGUID; + _worldPacket << int32(Action); + return &_worldPacket; +} + +WorldPacket const* WorldPackets::Pet::PetDismissSound::Write() +{ + _worldPacket << int32(ModelId); + _worldPacket << float(ModelPosition.x); + _worldPacket << float(ModelPosition.y); + _worldPacket << float(ModelPosition.z); + return &_worldPacket; +} diff --git a/src/server/game/Server/Packets/PetPackets.h b/src/server/game/Server/Packets/PetPackets.h index cbb96db700..4120e0a9f4 100644 --- a/src/server/game/Server/Packets/PetPackets.h +++ b/src/server/game/Server/Packets/PetPackets.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 @@ -20,6 +20,7 @@ #include "ObjectGuid.h" #include "Packet.h" +#include "G3D/Vector3.h" namespace WorldPackets { @@ -94,6 +95,30 @@ namespace WorldPackets void Read() override { } }; + + class PetActionSound final : public ServerPacket + { + public: + PetActionSound(ObjectGuid unitGUID, int32 action) + : ServerPacket(SMSG_PET_ACTION_SOUND, 8 + 4), UnitGUID(unitGUID), Action(action) { } + + WorldPacket const* Write() override; + + ObjectGuid UnitGUID; + int32 Action = 0; + }; + + class PetDismissSound final : public ServerPacket + { + public: + PetDismissSound(int32 modelId, G3D::Vector3 modelPosition) + : ServerPacket(SMSG_PET_DISMISS_SOUND, 4 + 12), ModelId(modelId), ModelPosition(modelPosition) { } + + WorldPacket const* Write() override; + + int32 ModelId = 0; + G3D::Vector3 ModelPosition; + }; } } diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp index 6efa96275f..c1ad0d8e5a 100644 --- a/src/server/game/Server/Packets/QueryPackets.cpp +++ b/src/server/game/Server/Packets/QueryPackets.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/Server/Packets/QueryPackets.h b/src/server/game/Server/Packets/QueryPackets.h index 85d7a76ce7..b5f773779f 100644 --- a/src/server/game/Server/Packets/QueryPackets.h +++ b/src/server/game/Server/Packets/QueryPackets.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/Server/Packets/TotemPackets.cpp b/src/server/game/Server/Packets/TotemPackets.cpp index 82531e3db6..02ff705e19 100644 --- a/src/server/game/Server/Packets/TotemPackets.cpp +++ b/src/server/game/Server/Packets/TotemPackets.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/Server/Packets/TotemPackets.h b/src/server/game/Server/Packets/TotemPackets.h index 98e559562b..dff16fd1c1 100644 --- a/src/server/game/Server/Packets/TotemPackets.h +++ b/src/server/game/Server/Packets/TotemPackets.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/Server/Packets/WorldStatePackets.cpp b/src/server/game/Server/Packets/WorldStatePackets.cpp index fde6964096..c0590703e6 100644 --- a/src/server/game/Server/Packets/WorldStatePackets.cpp +++ b/src/server/game/Server/Packets/WorldStatePackets.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/Server/Packets/WorldStatePackets.h b/src/server/game/Server/Packets/WorldStatePackets.h index 89382a7835..2a8d95072a 100644 --- a/src/server/game/Server/Packets/WorldStatePackets.h +++ b/src/server/game/Server/Packets/WorldStatePackets.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/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index bc12f7764f..2e85d484f5 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.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 @@ -363,7 +363,7 @@ void OpcodeTable::Initialize() /*0x0E8*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_FORCE_MOVE_ROOT, STATUS_NEVER); /*0x0E9*/ DEFINE_HANDLER(CMSG_FORCE_MOVE_ROOT_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveRootAck ); /*0x0EA*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_FORCE_MOVE_UNROOT, STATUS_NEVER); - /*0x0EB*/ DEFINE_HANDLER(CMSG_FORCE_MOVE_UNROOT_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveUnRootAck ); + /*0x0EB*/ DEFINE_HANDLER(CMSG_FORCE_MOVE_UNROOT_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveRootAck ); /*0x0EC*/ DEFINE_HANDLER(MSG_MOVE_ROOT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x0ED*/ DEFINE_HANDLER(MSG_MOVE_UNROOT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x0EE*/ DEFINE_HANDLER(MSG_MOVE_HEARTBEAT, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMovementOpcodes ); @@ -374,7 +374,7 @@ void OpcodeTable::Initialize() /*0x0F3*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_NORMAL_FALL, STATUS_NEVER); /*0x0F4*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_SET_HOVER, STATUS_NEVER); /*0x0F5*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_UNSET_HOVER, STATUS_NEVER); - /*0x0F6*/ DEFINE_HANDLER(CMSG_MOVE_HOVER_ACK, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleMoveHoverAck ); + /*0x0F6*/ DEFINE_HANDLER(CMSG_MOVE_HOVER_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveFlagChangeOpcode ); /*0x0F7*/ DEFINE_SERVER_OPCODE_HANDLER(MSG_MOVE_HOVER, STATUS_NEVER); /*0x0F8*/ DEFINE_HANDLER(CMSG_TRIGGER_CINEMATIC_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x0F9*/ DEFINE_HANDLER(CMSG_OPENING_CINEMATIC, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); @@ -847,8 +847,8 @@ void OpcodeTable::Initialize() /*0x2CC*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_RAID_INSTANCE_INFO, STATUS_NEVER); /*0x2CD*/ DEFINE_HANDLER(CMSG_REQUEST_RAID_INFO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestRaidInfoOpcode ); /*0x2CE*/ DEFINE_HANDLER(CMSG_MOVE_TIME_SKIPPED, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveTimeSkippedOpcode ); - /*0x2CF*/ DEFINE_HANDLER(CMSG_MOVE_FEATHER_FALL_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleFeatherFallAck ); - /*0x2D0*/ DEFINE_HANDLER(CMSG_MOVE_WATER_WALK_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveWaterWalkAck ); + /*0x2CF*/ DEFINE_HANDLER(CMSG_MOVE_FEATHER_FALL_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveFlagChangeOpcode ); + /*0x2D0*/ DEFINE_HANDLER(CMSG_MOVE_WATER_WALK_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveFlagChangeOpcode ); /*0x2D1*/ DEFINE_HANDLER(CMSG_MOVE_NOT_ACTIVE_MOVER, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveNotActiveMover ); /*0x2D2*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PLAY_SOUND, STATUS_NEVER); /*0x2D3*/ DEFINE_HANDLER(CMSG_BATTLEFIELD_STATUS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlefieldStatusOpcode ); @@ -965,7 +965,7 @@ void OpcodeTable::Initialize() /*0x342*/ DEFINE_HANDLER(MSG_MOVE_STOP_SWIM_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x343*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_SET_CAN_FLY, STATUS_NEVER); /*0x344*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_UNSET_CAN_FLY, STATUS_NEVER); - /*0x345*/ DEFINE_HANDLER(CMSG_MOVE_SET_CAN_FLY_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveSetCanFlyAckOpcode ); + /*0x345*/ DEFINE_HANDLER(CMSG_MOVE_SET_CAN_FLY_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveFlagChangeOpcode ); /*0x346*/ DEFINE_HANDLER(CMSG_MOVE_SET_FLY, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMovementOpcodes ); /*0x347*/ DEFINE_HANDLER(CMSG_SOCKET_GEMS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleSocketOpcode ); /*0x348*/ DEFINE_HANDLER(CMSG_ARENA_TEAM_CREATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); @@ -1245,7 +1245,7 @@ void OpcodeTable::Initialize() /*0x45A*/ DEFINE_HANDLER(MSG_MOVE_SET_PITCH_RATE_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x45B*/ DEFINE_HANDLER(MSG_MOVE_SET_PITCH_RATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x45C*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_FORCE_PITCH_RATE_CHANGE, STATUS_NEVER); - /*0x45D*/ DEFINE_HANDLER(CMSG_FORCE_PITCH_RATE_CHANGE_ACK, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); + /*0x45D*/ DEFINE_HANDLER(CMSG_FORCE_PITCH_RATE_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck ); /*0x45E*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPLINE_SET_PITCH_RATE, STATUS_NEVER); /*0x45F*/ DEFINE_HANDLER(CMSG_CALENDAR_EVENT_INVITE_NOTES, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x460*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CALENDAR_EVENT_INVITE_NOTES, STATUS_NEVER); @@ -1359,9 +1359,9 @@ void OpcodeTable::Initialize() /*0x4CC*/ DEFINE_HANDLER(CMSG_END_BATTLEFIELD_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x4CD*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MULTIPLE_PACKETS, STATUS_NEVER); /*0x4CE*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_GRAVITY_DISABLE, STATUS_NEVER); - /*0x4CF*/ DEFINE_HANDLER(CMSG_MOVE_GRAVITY_DISABLE_ACK, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); + /*0x4CF*/ DEFINE_HANDLER(CMSG_MOVE_GRAVITY_DISABLE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveFlagChangeOpcode ); /*0x4D0*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_GRAVITY_ENABLE, STATUS_NEVER); - /*0x4D1*/ DEFINE_HANDLER(CMSG_MOVE_GRAVITY_ENABLE_ACK, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); + /*0x4D1*/ DEFINE_HANDLER(CMSG_MOVE_GRAVITY_ENABLE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveFlagChangeOpcode ); /*0x4D2*/ DEFINE_SERVER_OPCODE_HANDLER(MSG_MOVE_GRAVITY_CHNG, STATUS_NEVER); /*0x4D3*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPLINE_MOVE_GRAVITY_DISABLE, STATUS_NEVER); /*0x4D4*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPLINE_MOVE_GRAVITY_ENABLE, STATUS_NEVER); @@ -1431,7 +1431,7 @@ void OpcodeTable::Initialize() /*0x514*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_ALL_COMBAT_LOG, STATUS_NEVER); /*0x515*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_OPEN_LFG_DUNGEON_FINDER, STATUS_NEVER); /*0x516*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_SET_COLLISION_HGT, STATUS_NEVER); - /*0x517*/ DEFINE_HANDLER(CMSG_MOVE_SET_COLLISION_HGT_ACK, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL ); + /*0x517*/ DEFINE_HANDLER(CMSG_MOVE_SET_COLLISION_HGT_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck ); /*0x518*/ DEFINE_HANDLER(MSG_MOVE_SET_COLLISION_HGT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x519*/ DEFINE_HANDLER(CMSG_CLEAR_RANDOM_BG_WIN_TIME, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x51A*/ DEFINE_HANDLER(CMSG_CLEAR_HOLIDAY_BG_WIN_TIME, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 3eb61151e3..cb994b3e80 100644 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.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/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp index 2047bf84b9..f08d088b52 100644 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ b/src/server/game/Server/Protocol/PacketLog.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/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h index 7ff34079f6..3add1959dc 100644 --- a/src/server/game/Server/Protocol/PacketLog.h +++ b/src/server/game/Server/Protocol/PacketLog.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/Server/Protocol/ServerPktHeader.h b/src/server/game/Server/Protocol/ServerPktHeader.h index 67ed3f7a79..d9c1895685 100644 --- a/src/server/game/Server/Protocol/ServerPktHeader.h +++ b/src/server/game/Server/Protocol/ServerPktHeader.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/Server/WorldPacket.h b/src/server/game/Server/WorldPacket.h index 4b18d6bb13..2bd1a9ac16 100644 --- a/src/server/game/Server/WorldPacket.h +++ b/src/server/game/Server/WorldPacket.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/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index c8d336fe53..04ff5ba9b1 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.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 @@ -136,7 +136,8 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 accountFlags, s _addonMessageReceiveCount(0), _timeSyncClockDeltaQueue(6), _timeSyncClockDelta(0), - _pendingTimeSyncRequests() + _pendingTimeSyncRequests(), + _orderCounter(0) { memset(m_Tutorials, 0, sizeof(m_Tutorials)); @@ -1509,3 +1510,9 @@ void WorldSession::InitializeSessionCallback(CharacterDatabaseQueryHolder const& SendClientCacheVersion(clientCacheVersion); SendTutorialsData(); } + +void WorldSession::SetPacketLogging(bool state) +{ + if (m_Socket) + m_Socket->SetPacketLogging(state); +} diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 15c0a73685..c12fb7df0e 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.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 @@ -150,6 +150,7 @@ namespace WorldPackets { class MinimapPingClient; class RandomRollClient; + class Complain; } namespace Pet @@ -189,6 +190,14 @@ namespace WorldPackets class ItemRefundInfo; class ItemRefund; } + + namespace Calendar + { + class GetEvent; + class GuildFilter; + class ArenaTeam; + class CalendarComplain; + } } enum AccountDataType @@ -379,6 +388,10 @@ public: void ReadMovementInfo(WorldPacket& data, MovementInfo* mi); void WriteMovementInfo(WorldPacket* data, MovementInfo* mi); + void SynchronizeMovement(MovementInfo& movementInfo); + void HandleMoverRelocation(MovementInfo& movementInfo, Unit* mover); + bool VerifyMovementInfo(MovementInfo const& movementInfo, Player* plrMover, Unit* mover, Opcodes opcode) const; + bool ProcessMovementInfo(MovementInfo& movementInfo, Unit* mover, Player* plrMover, WorldPacket& recvData); void SendPacket(WorldPacket const* packet); void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName* declinedName); @@ -582,6 +595,10 @@ public: // Time Synchronisation void ResetTimeSync(); void SendTimeSync(); + + // Movement packet order + uint32 GetOrderCounter() const { return _orderCounter; } + void IncrementOrderCounter() { ++_orderCounter; } public: // opcodes handlers void Handle_NULL(WorldPacket& null); // not used void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead @@ -601,6 +618,7 @@ public: // opcodes handlers void SendCharCreate(ResponseCodes result); void SendCharDelete(ResponseCodes result); + void SendCharLoginFailed(LoginFailureReason reason); void SendCharRename(ResponseCodes result, CharacterRenameInfo const* renameInfo); void SendCharCustomize(ResponseCodes result, CharacterCustomizeInfo const* customizeInfo); void SendCharFactionChange(ResponseCodes result, CharacterFactionChangeInfo const* factionChangeInfo); @@ -610,7 +628,6 @@ public: // opcodes handlers void HandlePlayedTime(WorldPackets::Character::PlayedTimeClient& packet); // new - void HandleMoveUnRootAck(WorldPacket& recvPacket); void HandleMoveRootAck(WorldPacket& recvPacket); // new inspect @@ -619,11 +636,6 @@ public: // opcodes handlers // new party stats void HandleInspectHonorStatsOpcode(WorldPacket& recvPacket); - void HandleMoveWaterWalkAck(WorldPacket& recvPacket); - void HandleFeatherFallAck(WorldPacket& recvData); - - void HandleMoveHoverAck(WorldPacket& recvData); - void HandleMountSpecialAnimOpcode(WorldPacket& recvdata); // character view @@ -968,7 +980,7 @@ public: // opcodes handlers void HandleFarSightOpcode(WorldPacket& recvData); void HandleSetDungeonDifficultyOpcode(WorldPacket& recvData); void HandleSetRaidDifficultyOpcode(WorldPacket& recvData); - void HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData); + void HandleMoveFlagChangeOpcode(WorldPacket& recvData); void HandleSetTitleOpcode(WorldPacket& recvData); void HandleRealmSplitOpcode(WorldPacket& recvData); void HandleTimeSyncResp(WorldPacket& recvData); @@ -1032,7 +1044,7 @@ public: // opcodes handlers void HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData); void HandleCancelMountAuraOpcode(WorldPacket& recvData); void HandleSelfResOpcode(WorldPacket& recvData); - void HandleComplainOpcode(WorldPacket& recvData); + void HandleComplainOpcode(WorldPackets::Misc::Complain& packet); void HandleRequestPetInfo(WorldPackets::Pet::RequestPetInfo& packet); // Socket gem @@ -1069,9 +1081,9 @@ public: // opcodes handlers // Calendar void HandleCalendarGetCalendar(WorldPacket& recvData); - void HandleCalendarGetEvent(WorldPacket& recvData); - void HandleCalendarGuildFilter(WorldPacket& recvData); - void HandleCalendarArenaTeam(WorldPacket& recvData); + void HandleCalendarGetEvent(WorldPackets::Calendar::GetEvent& packet); + void HandleCalendarGuildFilter(WorldPackets::Calendar::GuildFilter& packet); + void HandleCalendarArenaTeam(WorldPackets::Calendar::ArenaTeam& packet); void HandleCalendarAddEvent(WorldPacket& recvData); void HandleCalendarUpdateEvent(WorldPacket& recvData); void HandleCalendarRemoveEvent(WorldPacket& recvData); @@ -1081,7 +1093,7 @@ public: // opcodes handlers void HandleCalendarEventRemoveInvite(WorldPacket& recvData); void HandleCalendarEventStatus(WorldPacket& recvData); void HandleCalendarEventModeratorStatus(WorldPacket& recvData); - void HandleCalendarComplain(WorldPacket& recvData); + void HandleCalendarComplain(WorldPackets::Calendar::CalendarComplain& packet); void HandleCalendarGetNumPending(WorldPacket& recvData); void HandleCalendarEventSignup(WorldPacket& recvData); @@ -1126,6 +1138,8 @@ public: // opcodes handlers void InitializeSession(); void InitializeSessionCallback(CharacterDatabaseQueryHolder const& realmHolder, uint32 clientCacheVersion); + void SetPacketLogging(bool state); + private: void ProcessQueryCallbacks(); @@ -1236,6 +1250,8 @@ private: uint32 _timeSyncNextCounter; uint32 _timeSyncTimer; + uint32 _orderCounter; + WorldSession(WorldSession const& right) = delete; WorldSession& operator=(WorldSession const& right) = delete; }; diff --git a/src/server/game/Server/WorldSessionMgr.cpp b/src/server/game/Server/WorldSessionMgr.cpp index e033b66286..b430996692 100644 --- a/src/server/game/Server/WorldSessionMgr.cpp +++ b/src/server/game/Server/WorldSessionMgr.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/Server/WorldSessionMgr.h b/src/server/game/Server/WorldSessionMgr.h index ba818da489..af85ed7a0f 100644 --- a/src/server/game/Server/WorldSessionMgr.h +++ b/src/server/game/Server/WorldSessionMgr.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/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 51705d18e0..452a16ad17 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.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 @@ -117,7 +117,7 @@ void EncryptableAndCompressiblePacket::CompressIfNeeded() } WorldSocket::WorldSocket(tcp::socket&& socket) - : Socket(std::move(socket)), _OverSpeedPings(0), _worldSession(nullptr), _authed(false), _sendBufferSize(4096) + : Socket(std::move(socket)), _OverSpeedPings(0), _worldSession(nullptr), _authed(false), _sendBufferSize(4096), _loggingPackets(false) { Acore::Crypto::GetRandomBytes(_authSeed); _headerBuffer.Resize(sizeof(ClientPktHeader)); @@ -406,7 +406,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler() WorldPacket packet(opcode, std::move(_packetBuffer)); WorldPacket* packetToQueue; - if (sPacketLog->CanLogPacket()) + if (sPacketLog->CanLogPacket() && IsLoggingPackets()) sPacketLog->LogPacket(packet, CLIENT_TO_SERVER, GetRemoteIpAddress(), GetRemotePort()); std::unique_lock<std::mutex> sessionGuard(_worldSessionLock, std::defer_lock); @@ -520,7 +520,7 @@ void WorldSocket::SendPacket(WorldPacket const& packet) if (!IsOpen()) return; - if (sPacketLog->CanLogPacket()) + if (sPacketLog->CanLogPacket() && IsLoggingPackets()) sPacketLog->LogPacket(packet, SERVER_TO_CLIENT, GetRemoteIpAddress(), GetRemotePort()); _bufferQueue.Enqueue(new EncryptableAndCompressiblePacket(packet, _authCrypt.IsInitialized())); diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h index aa65dfa093..347e9b5068 100644 --- a/src/server/game/Server/WorldSocket.h +++ b/src/server/game/Server/WorldSocket.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 @@ -85,6 +85,9 @@ public: void SetSendBufferSize(std::size_t sendBufferSize) { _sendBufferSize = sendBufferSize; } + bool IsLoggingPackets() const { return _loggingPackets; } + void SetPacketLogging(bool state) { _loggingPackets = state; } + protected: void OnClose() override; void ReadHandler() override; @@ -133,6 +136,8 @@ private: QueryCallbackProcessor _queryProcessor; std::string _ipCountry; + + bool _loggingPackets; }; #endif diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp index 15e75e188b..07e9d4dce9 100644 --- a/src/server/game/Server/WorldSocketMgr.cpp +++ b/src/server/game/Server/WorldSocketMgr.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/Server/WorldSocketMgr.h b/src/server/game/Server/WorldSocketMgr.h index cf37c3c988..a93a12fa61 100644 --- a/src/server/game/Server/WorldSocketMgr.h +++ b/src/server/game/Server/WorldSocketMgr.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/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index aaced18f8a..89b5da2381 100644 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.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/Skills/SkillDiscovery.h b/src/server/game/Skills/SkillDiscovery.h index 262b010323..3665f926b7 100644 --- a/src/server/game/Skills/SkillDiscovery.h +++ b/src/server/game/Skills/SkillDiscovery.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/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index e6b757a2f7..b16f0b504b 100644 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.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/Skills/SkillExtraItems.h b/src/server/game/Skills/SkillExtraItems.h index f260bedeed..0db55f3d3f 100644 --- a/src/server/game/Skills/SkillExtraItems.h +++ b/src/server/game/Skills/SkillExtraItems.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/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h index cebfaf9a9b..327cd044e8 100644 --- a/src/server/game/Spells/Auras/SpellAuraDefines.h +++ b/src/server/game/Spells/Auras/SpellAuraDefines.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/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index eb470bd9e3..06d3166e0a 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.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 @@ -3002,12 +3002,12 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, { if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) { - uint8 attacktype = Player::GetAttackBySlot(slot); + WeaponAttackType attacktype = Player::GetAttackBySlot(slot); if (attacktype < MAX_ATTACK) { target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), nullptr, !apply); - target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply); + target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, attacktype, !apply); } } } @@ -6177,7 +6177,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, if (apply) { data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0); - target->ToPlayer()->GetSession()->SendPacket(&data); + target->ToPlayer()->SendDirectMessage(&data); } } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 7fdf0df91f..73640626bc 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.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/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 02758c1b90..7d6260e24e 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.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/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index c1433c3814..7b7ab603ec 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.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/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 4ae8bfca43..aad6a4f2d6 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.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 @@ -1384,7 +1384,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici float ground = m_caster->GetMapHeight(x, y, z, true); float liquidLevel = VMAP_INVALID_HEIGHT_VALUE; - LiquidData const& liquidData = m_caster->GetMap()->GetLiquidData(m_caster->GetPhaseMask(), x, y, z, m_caster->GetCollisionHeight(), MAP_ALL_LIQUIDS); + LiquidData const& liquidData = m_caster->GetMap()->GetLiquidData(m_caster->GetPhaseMask(), x, y, z, m_caster->GetCollisionHeight(), {}); if (liquidData.Status) liquidLevel = liquidData.Level; @@ -2392,7 +2392,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= targetInfo.reflectResult = SPELL_MISS_PARRY; // Increase time interval for reflected spells by 1.5 - m_caster->m_Events.AddEvent(new ReflectEvent(m_caster, targetInfo.targetGUID, m_spellInfo), m_caster->m_Events.CalculateTime(targetInfo.timeDelay)); + m_caster->m_Events.AddEventAtOffset(new ReflectEvent(m_caster, targetInfo.targetGUID, m_spellInfo), Milliseconds(targetInfo.timeDelay)); targetInfo.timeDelay += targetInfo.timeDelay >> 1; m_spellFlags |= SPELL_FLAG_REFLECTED; @@ -3439,7 +3439,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const // create and add update event for this spell _spellEvent = new SpellEvent(this); - m_caster->m_Events.AddEvent(_spellEvent, m_caster->m_Events.CalculateTime(1)); + m_caster->m_Events.AddEventAtOffset(_spellEvent, 1ms); if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, m_caster)) { @@ -4612,7 +4612,7 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas WorldPacket data(SMSG_CAST_FAILED, 1 + 4 + 1); WriteCastResultInfo(data, caster, spellInfo, castCount, result, customError); - caster->GetSession()->SendPacket(&data); + caster->SendDirectMessage(&data); } void Spell::SendCastResult(SpellCastResult result) @@ -4649,7 +4649,7 @@ void Spell::SendPetCastResult(SpellCastResult result) WorldPacket data(SMSG_PET_CAST_FAILED, 1 + 4 + 1); WriteCastResultInfo(data, player, m_spellInfo, m_cast_count, result, m_customError); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } void Spell::SendSpellStart() @@ -5184,7 +5184,7 @@ void Spell::SendResurrectRequest(Player* target) // override delay sent with SMSG_CORPSE_RECLAIM_DELAY, set instant resurrection for spells with this attribute if (m_spellInfo->HasAttribute(SPELL_ATTR3_NO_RES_TIMER)) data << uint32(0); - target->GetSession()->SendPacket(&data); + target->SendDirectMessage(&data); } void Spell::TakeCastItem() @@ -8166,7 +8166,7 @@ bool SpellEvent::IsDeletable() const return m_Spell->IsDeletable(); } -bool ReflectEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) +bool ReflectEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { Unit* target = ObjectAccessor::GetUnit(*_caster, _targetGUID); if (target && _caster->IsInMap(target)) diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 3025e803e6..331d48997a 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.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/Spells/SpellDefines.h b/src/server/game/Spells/SpellDefines.h index 89dda8dfe1..eaa6541981 100644 --- a/src/server/game/Spells/SpellDefines.h +++ b/src/server/game/Spells/SpellDefines.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/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index d8dcba2d5b..8bb4c793ef 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.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 @@ -2429,8 +2429,14 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) } break; } - case SUMMON_TYPE_JEEVES: case SUMMON_TYPE_MINIPET: + // For companions, recalculate the position to ensure they spawn at the intended π/4 angle. + destTarget->Relocate(m_originalCaster->GetNearPosition( + m_originalCaster->GetDistance2d(destTarget->GetPositionX(), destTarget->GetPositionY()), + MINI_PET_SUMMON_ANGLE + )); + [[fallthrough]]; + case SUMMON_TYPE_JEEVES: { summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn); if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION)) @@ -2446,8 +2452,9 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) //summon->AI()->EnterEvadeMode(); if (properties->Type != SUMMON_TYPE_JEEVES) { + summon->SetFacingToObject(m_originalCaster); summon->GetMotionMaster()->Clear(false); - summon->GetMotionMaster()->MoveFollow(m_originalCaster, PET_FOLLOW_DIST, summon->GetFollowAngle(), MOTION_SLOT_ACTIVE); + summon->GetMotionMaster()->MoveFollow(m_originalCaster, PET_FOLLOW_DIST, MINI_PET_FOLLOW_ANGLE, MOTION_SLOT_ACTIVE); } break; } @@ -4155,8 +4162,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex) WorldPacket data(SMSG_DUEL_REQUESTED, 8 + 8); data << pGameObj->GetGUID(); data << caster->GetGUID(); - caster->GetSession()->SendPacket(&data); - target->GetSession()->SendPacket(&data); + caster->SendDirectMessage(&data); + target->SendDirectMessage(&data); // create duel-info bool isMounted = (GetSpellInfo()->Id == 62875); @@ -4238,7 +4245,7 @@ void Spell::EffectSummonPlayer(SpellEffIndex /*effIndex*/) data << m_caster->GetGUID(); // summoner guid data << uint32(m_caster->GetZoneId()); // summoner zone data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); // auto decline after msecs - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } void Spell::EffectActivateObject(SpellEffIndex effIndex) @@ -5206,7 +5213,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/) { // Position passed to SummonPet is irrelevant with current implementation, // pet will be relocated without using these coords in Pet::LoadPetFromDB - player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0s, damage); + player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0ms, damage); return; } @@ -6338,5 +6345,5 @@ void Spell::EffectSummonRaFFriend(SpellEffIndex /*effIndex*/) data << m_caster->GetGUID(); data << uint32(m_caster->GetZoneId()); data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); // auto decline after msecs - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 64a25a2b4a..2a54900431 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.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 @@ -1824,7 +1824,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta { if (Player const* player = unitTarget->ToPlayer()) { - if (player->GetWeaponForAttack(WeaponAttackType(BASE_ATTACK + i), true)) + if (player->GetWeaponForAttack(WeaponAttackType(i), true)) { valid = true; break; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 534ad254a6..eba1ad9013 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.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/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index 9873af3253..623c43f1e1 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.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 @@ -2187,12 +2187,6 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(1); }); - // Halls of Lightning, Arcing Burn - ApplySpellFix({ 52671, 59834 }, [](SpellInfo* spellInfo) - { - spellInfo->AttributesEx3 |= SPELL_ATTR3_DOT_STACKING_RULE; - }); - // Trial of the Champion, Death's Respite ApplySpellFix({ 68306 }, [](SpellInfo* spellInfo) { @@ -5151,6 +5145,24 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->AttributesEx3 |= SPELL_ATTR3_ALWAYS_HIT; }); + // Earth Shield + ApplySpellFix({ 55599, 58981 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx5 |= SPELL_ATTR5_LIMIT_N; + }); + + // Acid Splash + ApplySpellFix({ 52446, 59363 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx3 |= SPELL_ATTR3_DOT_STACKING_RULE; + }); + + // King Mrlg-Mrgl's Spare Suit + ApplySpellFix({ 45278 }, [](SpellInfo* spellInfo) + { + spellInfo->ProcCharges = 1; + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index b9ee0a9b31..f424be399a 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.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/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 3a9700b6d8..feb1e4f7ec 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.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/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 930861de5b..d726e2ea86 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.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/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 5ada4e0f41..8ab04fd704 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.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/Texts/ChatTextBuilder.cpp b/src/server/game/Texts/ChatTextBuilder.cpp index ad0ff1fed3..1f6c3ff731 100644 --- a/src/server/game/Texts/ChatTextBuilder.cpp +++ b/src/server/game/Texts/ChatTextBuilder.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/Texts/ChatTextBuilder.h b/src/server/game/Texts/ChatTextBuilder.h index 724f9f7b22..54bc48379e 100644 --- a/src/server/game/Texts/ChatTextBuilder.h +++ b/src/server/game/Texts/ChatTextBuilder.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/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index c471c78154..501bea861f 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.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 @@ -83,7 +83,7 @@ void CreatureTextMgr::LoadCreatureTexts() uint32 oldMSTime = getMSTime(); mTextMap.clear(); // for reload case - mTextRepeatMap.clear(); //reset all currently used temp texts + //all currently used temp texts are NOT reset WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_TEXT); PreparedQueryResult result = WorldDatabase.Query(stmt); @@ -218,7 +218,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject } CreatureTextGroup const& textGroupContainer = itr->second; //has all texts in the group - CreatureTextRepeatIds repeatGroup = GetRepeatGroup(source, textGroup);//has all textIDs from the group that were already said + CreatureTextRepeatIds repeatGroup = source->GetTextRepeatGroup(textGroup);//has all textIDs from the group that were already said CreatureTextGroup tempGroup;//will use this to talk after sorting repeatGroup for (CreatureTextGroup::const_iterator giter = textGroupContainer.begin(); giter != textGroupContainer.end(); ++giter) @@ -227,52 +227,14 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject if (tempGroup.empty()) { - CreatureTextRepeatMap::iterator mapItr = mTextRepeatMap.find(source->GetGUID()); - if (mapItr != mTextRepeatMap.end()) - { - CreatureTextRepeatGroup::iterator groupItr = mapItr->second.find(textGroup); - groupItr->second.clear(); - } - + source->ClearTextRepeatGroup(textGroup); tempGroup = textGroupContainer; } - uint8 count = 0; - float lastChance = -1; - bool isEqualChanced = true; - - float totalChance = 0; - - for (CreatureTextGroup::const_iterator iter = tempGroup.begin(); iter != tempGroup.end(); ++iter) - { - if (lastChance >= 0 && lastChance != iter->probability) - isEqualChanced = false; - - lastChance = iter->probability; - totalChance += iter->probability; - ++count; - } - - int32 offset = -1; - if (!isEqualChanced) + auto iter = Acore::Containers::SelectRandomWeightedContainerElement(tempGroup, [](CreatureTextEntry const& t) -> double { - for (CreatureTextGroup::const_iterator iter = tempGroup.begin(); iter != tempGroup.end(); ++iter) - { - uint32 chance = uint32(iter->probability); - uint32 r = urand(0, 100); - ++offset; - if (r <= chance) - break; - } - } - - uint32 pos = 0; - if (isEqualChanced || offset < 0) - pos = urand(0, count - 1); - else if (offset >= 0) - pos = offset; - - CreatureTextGroup::const_iterator iter = tempGroup.begin() + pos; + return t.probability; + }); ChatMsg finalType = (msgType == CHAT_MSG_ADDON) ? iter->type : msgType; Language finalLang = (language == LANG_ADDON) ? iter->lang : language; @@ -301,9 +263,8 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject CreatureTextBuilder builder(finalSource, finalSource->getGender(), finalType, iter->group, iter->id, finalLang, target); SendChatPacket(finalSource, builder, finalType, target, range, teamId, gmOnly); } - if (isEqualChanced || (!isEqualChanced && totalChance == 100.0f)) - SetRepeatId(source, textGroup, iter->id); + source->SetTextRepeatId(textGroup, iter->id); return iter->duration; } @@ -348,7 +309,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const* if (!target || !target->IsPlayer()) return; - target->ToPlayer()->GetSession()->SendPacket(data); + target->ToPlayer()->SendDirectMessage(data); return; } break; @@ -365,7 +326,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const* Map::PlayerList const& players = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (itr->GetSource()->GetAreaId() == areaId && (teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster())) - itr->GetSource()->GetSession()->SendPacket(data); + itr->GetSource()->SendDirectMessage(data); return; } case TEXT_RANGE_ZONE: @@ -374,7 +335,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const* Map::PlayerList const& players = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (itr->GetSource()->GetZoneId() == zoneId && (teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster())) - itr->GetSource()->GetSession()->SendPacket(data); + itr->GetSource()->SendDirectMessage(data); return; } case TEXT_RANGE_MAP: @@ -382,7 +343,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const* Map::PlayerList const& players = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if ((teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster())) - itr->GetSource()->GetSession()->SendPacket(data); + itr->GetSource()->SendDirectMessage(data); return; } case TEXT_RANGE_WORLD: @@ -391,7 +352,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const* for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr) if (Player* player = itr->second->GetPlayer()) if ((teamId == TEAM_NEUTRAL || player->GetTeamId() == teamId) && (!gmOnly || player->IsGameMaster())) - player->GetSession()->SendPacket(data); + player->SendDirectMessage(data); return; } case TEXT_RANGE_NORMAL: @@ -410,34 +371,6 @@ void CreatureTextMgr::SendEmote(Unit* source, uint32 emote) source->HandleEmoteCommand(emote); } -void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id) -{ - if (!source) - return; - - CreatureTextRepeatIds& repeats = mTextRepeatMap[source->GetGUID()][textGroup]; - if (std::find(repeats.begin(), repeats.end(), id) == repeats.end()) - repeats.push_back(id); - else - LOG_ERROR("sql.sql", "CreatureTextMgr: TextGroup {} for Creature {} ({}), id {} already added", - uint32(textGroup), source->GetName(), source->GetGUID().ToString(), uint32(id)); -} - -CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) -{ - ASSERT(source);//should never happen - CreatureTextRepeatIds ids; - - CreatureTextRepeatMap::const_iterator mapItr = mTextRepeatMap.find(source->GetGUID()); - if (mapItr != mTextRepeatMap.end()) - { - CreatureTextRepeatGroup::const_iterator groupItr = (*mapItr).second.find(textGroup); - if (groupItr != mapItr->second.end()) - ids = groupItr->second; - } - return ids; -} - bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup) { if (!sourceEntry) diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index d84d91c8dd..37a3934965 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.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 @@ -77,11 +77,6 @@ typedef std::unordered_map<uint32, CreatureTextHolder> CreatureTextMap; // a typedef std::map<CreatureTextId, CreatureTextLocale> LocaleCreatureTextMap; -//used for handling non-repeatable random texts -typedef std::vector<uint8> CreatureTextRepeatIds; -typedef std::unordered_map<uint8, CreatureTextRepeatIds> CreatureTextRepeatGroup; -typedef std::unordered_map<ObjectGuid, CreatureTextRepeatGroup> CreatureTextRepeatMap;//guid based - class CreatureTextMgr { CreatureTextMgr() { } @@ -105,14 +100,10 @@ public: template<class Builder> void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* target = nullptr, CreatureTextRange range = TEXT_RANGE_NORMAL, TeamId teamId = TEAM_NEUTRAL, bool gmOnly = false) const; private: - CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup); - void SetRepeatId(Creature* source, uint8 textGroup, uint8 id); - void SendNonChatPacket(WorldObject* source, WorldPacket const* data, ChatMsg msgType, WorldObject const* target, CreatureTextRange range, TeamId teamId, bool gmOnly) const; float GetRangeForChatType(ChatMsg msgType) const; CreatureTextMap mTextMap; - CreatureTextRepeatMap mTextRepeatMap; LocaleCreatureTextMap mLocaleTextMap; }; diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 543b40cd54..7c6337b301 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.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/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index d345567166..7293f23c3e 100644 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.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/Time/GameTime.cpp b/src/server/game/Time/GameTime.cpp index 3dbcbc0f25..123b4402aa 100644 --- a/src/server/game/Time/GameTime.cpp +++ b/src/server/game/Time/GameTime.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/Time/GameTime.h b/src/server/game/Time/GameTime.h index 3350a14d40..40d96f6a57 100644 --- a/src/server/game/Time/GameTime.h +++ b/src/server/game/Time/GameTime.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/Time/UpdateTime.cpp b/src/server/game/Time/UpdateTime.cpp index 3b584a6155..d555ce2e09 100644 --- a/src/server/game/Time/UpdateTime.cpp +++ b/src/server/game/Time/UpdateTime.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 @@ -162,7 +162,7 @@ void WorldUpdateTime::SetRecordUpdateTimeInterval(Milliseconds t) void WorldUpdateTime::RecordUpdateTime(Milliseconds gameTimeMs, uint32 diff, uint32 sessionCount) { - if (_recordUpdateTimeInverval > 0s && diff > _recordUpdateTimeMin.count()) + if (_recordUpdateTimeInverval > 0ms && diff > _recordUpdateTimeMin.count()) { if (GetMSTimeDiff(_lastRecordTime, gameTimeMs) > _recordUpdateTimeInverval) { diff --git a/src/server/game/Time/UpdateTime.h b/src/server/game/Time/UpdateTime.h index d6618f4305..8d163dc7bd 100644 --- a/src/server/game/Time/UpdateTime.h +++ b/src/server/game/Time/UpdateTime.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/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index 4c4d69f53b..329a6283ce 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.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/Tools/CharacterDatabaseCleaner.h b/src/server/game/Tools/CharacterDatabaseCleaner.h index 30a4832544..382d5ccfb8 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.h +++ b/src/server/game/Tools/CharacterDatabaseCleaner.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/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 95fbdd7872..1f4cb8cc2d 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.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/Tools/PlayerDump.h b/src/server/game/Tools/PlayerDump.h index 64b3f4b6cb..fb4af53d6c 100644 --- a/src/server/game/Tools/PlayerDump.h +++ b/src/server/game/Tools/PlayerDump.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/Warden/Modules/WardenModuleMac.h b/src/server/game/Warden/Modules/WardenModuleMac.h index 90ec6651d4..b7c729a2dd 100644 --- a/src/server/game/Warden/Modules/WardenModuleMac.h +++ b/src/server/game/Warden/Modules/WardenModuleMac.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/Warden/Modules/WardenModuleWin.h b/src/server/game/Warden/Modules/WardenModuleWin.h index 5e3d7647db..4798aadc9a 100644 --- a/src/server/game/Warden/Modules/WardenModuleWin.h +++ b/src/server/game/Warden/Modules/WardenModuleWin.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/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index a3e0295b53..1cad8c86b4 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.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/Warden/Warden.h b/src/server/game/Warden/Warden.h index 88d972a0f4..797a664c46 100644 --- a/src/server/game/Warden/Warden.h +++ b/src/server/game/Warden/Warden.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/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index a061ec4e81..bac4424f60 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.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/Warden/WardenCheckMgr.h b/src/server/game/Warden/WardenCheckMgr.h index db5a98c669..0b70c2a3e4 100644 --- a/src/server/game/Warden/WardenCheckMgr.h +++ b/src/server/game/Warden/WardenCheckMgr.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/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index d3e7f4a605..75e25990bd 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.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/Warden/WardenMac.h b/src/server/game/Warden/WardenMac.h index 30e3dc51f2..3d1888d44d 100644 --- a/src/server/game/Warden/WardenMac.h +++ b/src/server/game/Warden/WardenMac.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/Warden/WardenPayloadMgr.cpp b/src/server/game/Warden/WardenPayloadMgr.cpp index d6a06edc34..e6ef106b1c 100644 --- a/src/server/game/Warden/WardenPayloadMgr.cpp +++ b/src/server/game/Warden/WardenPayloadMgr.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/Warden/WardenPayloadMgr.h b/src/server/game/Warden/WardenPayloadMgr.h index aa71595197..8cc5bd4d87 100644 --- a/src/server/game/Warden/WardenPayloadMgr.h +++ b/src/server/game/Warden/WardenPayloadMgr.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/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 520dd6d015..906f153928 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.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/Warden/WardenWin.h b/src/server/game/Warden/WardenWin.h index 2d88c4156e..1fbebea555 100644 --- a/src/server/game/Warden/WardenWin.h +++ b/src/server/game/Warden/WardenWin.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/Warden/enuminfo_WardenCheckMgr.cpp b/src/server/game/Warden/enuminfo_WardenCheckMgr.cpp index 61bd60f377..ac62c1ae0e 100644 --- a/src/server/game/Warden/enuminfo_WardenCheckMgr.cpp +++ b/src/server/game/Warden/enuminfo_WardenCheckMgr.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/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index 6f4f51e640..ee4fbb85aa 100644 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.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/Weather/Weather.h b/src/server/game/Weather/Weather.h index ebad658352..8f4b5c866e 100644 --- a/src/server/game/Weather/Weather.h +++ b/src/server/game/Weather/Weather.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/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 73161edbd3..bf4bd05e74 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.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/Weather/WeatherMgr.h b/src/server/game/Weather/WeatherMgr.h index ddd5f8fdf8..0d87a7cf4d 100644 --- a/src/server/game/Weather/WeatherMgr.h +++ b/src/server/game/Weather/WeatherMgr.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/World/IWorld.h b/src/server/game/World/IWorld.h index bf1af8cf8b..03e70e55c1 100644 --- a/src/server/game/World/IWorld.h +++ b/src/server/game/World/IWorld.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/World/World.cpp b/src/server/game/World/World.cpp index 651d857856..83adc9e63d 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.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/World/World.h b/src/server/game/World/World.h index 1674c975d8..942665b4df 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.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/World/WorldConfig.cpp b/src/server/game/World/WorldConfig.cpp index eedd61eaf4..761b8dd7be 100644 --- a/src/server/game/World/WorldConfig.cpp +++ b/src/server/game/World/WorldConfig.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 @@ -85,6 +85,9 @@ void WorldConfig::BuildConfigCache() SetConfigValue<float>(RATE_BUYVALUE_ITEM_HEIRLOOM, "Rate.BuyValue.Item.Heirloom", 1.0f); SetConfigValue<float>(RATE_REPUTATION_GAIN, "Rate.Reputation.Gain", 1.0f); + SetConfigValue<float>(RATE_REPUTATION_GAIN_AB, "Rate.Reputation.Gain.AB", 1.0f); + SetConfigValue<float>(RATE_REPUTATION_GAIN_AV, "Rate.Reputation.Gain.AV", 1.0f); + SetConfigValue<float>(RATE_REPUTATION_GAIN_WSG, "Rate.Reputation.Gain.WSG", 1.0f); SetConfigValue<float>(RATE_REPUTATION_LOWLEVEL_KILL, "Rate.Reputation.LowLevel.Kill", 1.0f); SetConfigValue<float>(RATE_REPUTATION_LOWLEVEL_QUEST, "Rate.Reputation.LowLevel.Quest", 1.0f); SetConfigValue<float>(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS, "Rate.Reputation.RecruitAFriendBonus", 0.1f); diff --git a/src/server/game/World/WorldConfig.h b/src/server/game/World/WorldConfig.h index ce089b65a3..540fd8324c 100644 --- a/src/server/game/World/WorldConfig.h +++ b/src/server/game/World/WorldConfig.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 @@ -437,6 +437,9 @@ enum ServerConfigs RATE_XP_PET_NEXT_LEVEL, RATE_REPAIRCOST, RATE_REPUTATION_GAIN, + RATE_REPUTATION_GAIN_AB, + RATE_REPUTATION_GAIN_AV, + RATE_REPUTATION_GAIN_WSG, RATE_REPUTATION_LOWLEVEL_KILL, RATE_REPUTATION_LOWLEVEL_QUEST, RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS, diff --git a/src/server/game/World/WorldState.cpp b/src/server/game/World/WorldState.cpp index ebb11b8bfe..9613f8938f 100644 --- a/src/server/game/World/WorldState.cpp +++ b/src/server/game/World/WorldState.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 @@ -852,7 +852,7 @@ void WorldState::HandleSunsReachSubPhaseTransition(int32 subPhaseMask, bool init if (!initial) { std::lock_guard<std::mutex> guard(m_sunsReachData.m_sunsReachReclamationMutex); - for (ObjectGuid& guid : m_sunsReachData.m_sunsReachReclamationPlayers) + for (ObjectGuid const& guid : m_sunsReachData.m_sunsReachReclamationPlayers) if (Player* player = ObjectAccessor::FindPlayer(guid)) { if (start) @@ -1778,7 +1778,7 @@ bool WorldState::SummonPallid(Map* map, ScourgeInvasionData::CityAttack& zone, c else pathID = spawnLoc == 0 ? PATH_STORMWIND_KEEP : PATH_STORMWIND_TRADE_DISTRICT; - pallid->GetMotionMaster()->MovePath(pathID, false); + pallid->GetMotionMaster()->MoveWaypoint(pathID, false); sWorldState->SetPallidGuid(zone.zoneId, pallid->GetGUID()); } diff --git a/src/server/game/World/WorldState.h b/src/server/game/World/WorldState.h index b850010ac0..8a9142a0bd 100644 --- a/src/server/game/World/WorldState.h +++ b/src/server/game/World/WorldState.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/World/WorldStateDefines.h b/src/server/game/World/WorldStateDefines.h index a1ce0d11ea..d2d14d1020 100644 --- a/src/server/game/World/WorldStateDefines.h +++ b/src/server/game/World/WorldStateDefines.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 |
