From edb00d4f7432575965e8e3630f505c2ef09ed3b2 Mon Sep 17 00:00:00 2001 From: Gildor Date: Mon, 18 Sep 2023 11:48:52 +0200 Subject: [PATCH 01/13] Core/Pets: Avoid loading creature_addon/creature_template_addon (#29331) *Also removed spawnId when the pet is created --- src/server/game/Entities/Creature/Creature.cpp | 4 +++- src/server/game/Entities/Pet/Pet.cpp | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 98ebb98f2b..089a414f7a 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2041,7 +2041,9 @@ void Creature::setDeathState(DeathState s) Motion_Initialize(); Unit::setDeathState(ALIVE); - LoadCreaturesAddon(); + + if (!IsPet()) + LoadCreaturesAddon(); } } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index d4b8d373fc..1b26f6a4f8 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1874,7 +1874,6 @@ bool Pet::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 SetPhaseMask(phaseMask, false); Object::_Create(guidlow, petId, HighGuid::Pet); - m_spawnId = guidlow; m_originalEntry = Entry; if (!InitEntry(Entry)) From f746c7f7ff639787c37e1b5c2b63a66a560dc06d Mon Sep 17 00:00:00 2001 From: M'Dic Date: Tue, 19 Sep 2023 15:26:27 -0400 Subject: [PATCH 02/13] Core/Groups: Reduce differences between branches (define naming) (#29332) --- src/server/game/DungeonFinding/LFGMgr.cpp | 2 +- src/server/game/DungeonFinding/LFGQueue.cpp | 12 ++++---- src/server/game/Groups/Group.cpp | 20 ++++++------- src/server/game/Groups/Group.h | 11 +++---- src/server/game/Handlers/LFGHandler.cpp | 2 +- .../Scholomance/boss_darkmaster_gandling.cpp | 2 +- .../boss_doctor_theolen_krastinov.cpp | 2 +- .../Scholomance/boss_illucia_barov.cpp | 2 +- .../Scholomance/boss_instructor_malicia.cpp | 2 +- .../Scholomance/boss_lord_alexei_barov.cpp | 2 +- .../Scholomance/boss_lorekeeper_polkelt.cpp | 2 +- .../Scholomance/boss_the_ravenian.cpp | 2 +- .../Scholomance/instance_scholomance.cpp | 30 +++++++++---------- .../EasternKingdoms/Scholomance/scholomance.h | 14 ++++----- 14 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 8cc8676f6c..3e4bc2c92e 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -445,7 +445,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const joinData.result = LFG_JOIN_NOT_MEET_REQS; else if (grp) { - if (grp->GetMembersCount() > MAXGROUPSIZE) + if (grp->GetMembersCount() > MAX_GROUP_SIZE) joinData.result = LFG_JOIN_TOO_MUCH_MEMBERS; else { diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 6d47952e11..1580206eac 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -370,7 +370,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) LfgRolesMap proposalRoles; // Check for correct size - if (check.size() > MAXGROUPSIZE || check.empty()) + if (check.size() > MAX_GROUP_SIZE || check.empty()) { TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}): Size wrong - Not compatibles", GetDetailedMatchRoles(check)); return LFG_INCOMPATIBLES_WRONG_GROUP_SIZE; @@ -396,7 +396,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) // Check if more than one LFG group and number of players joining uint8 numPlayers = 0; uint8 numLfgGroups = 0; - for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it) + for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAX_GROUP_SIZE; ++it) { ObjectGuid guid = *it; LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); @@ -421,8 +421,8 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) } } - // Group with less that MAXGROUPSIZE members always compatible - if (check.size() == 1 && numPlayers != MAXGROUPSIZE) + // Group with less that MAX_GROUP_SIZE members always compatible + if (check.size() == 1 && numPlayers != MAX_GROUP_SIZE) { TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) single group. Compatibles", GetDetailedMatchRoles(check)); LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front()); @@ -443,7 +443,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS; } - if (numPlayers > MAXGROUPSIZE) + if (numPlayers > MAX_GROUP_SIZE) { TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) Too many players ({})", GetDetailedMatchRoles(check), numPlayers); SetCompatibles(strGuids, LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS); @@ -520,7 +520,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) } // Enough players? - if (numPlayers != MAXGROUPSIZE) + if (numPlayers != MAX_GROUP_SIZE) { TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) Compatibles but not enough players({})", GetDetailedMatchRoles(check), numPlayers); LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS); diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 26e0117a70..4fa1ce16d7 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -64,7 +64,7 @@ m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY m_bgGroup(nullptr), m_bfGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(), m_masterLooterGuid(), m_subGroupsCounts(nullptr), m_guid(), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0), m_isLeaderOffline(false) { - for (uint8 i = 0; i < TARGETICONCOUNT; ++i) + for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i) m_targetIcons[i].Clear(); } @@ -232,7 +232,7 @@ void Group::LoadGroupFromDB(Field* fields) m_looterGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32()); m_lootThreshold = ItemQualities(fields[3].GetUInt8()); - for (uint8 i = 0; i < TARGETICONCOUNT; ++i) + for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i) m_targetIcons[i].Set(fields[4 + i].GetUInt64()); m_groupType = GroupType(fields[12].GetUInt8()); @@ -401,7 +401,7 @@ bool Group::AddMember(Player* player) bool groupFound = false; for (; subGroup < MAX_RAID_SUBGROUPS; ++subGroup) { - if (m_subGroupsCounts[subGroup] < MAXGROUPSIZE) + if (m_subGroupsCounts[subGroup] < MAX_GROUP_SIZE) { groupFound = true; break; @@ -438,7 +438,7 @@ bool Group::AddMember(Player* player) if (!isRaidGroup()) // reset targetIcons for non-raid-groups { - for (uint8 i = 0; i < TARGETICONCOUNT; ++i) + for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i) m_targetIcons[i].Clear(); } @@ -1627,12 +1627,12 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid) { - if (id >= TARGETICONCOUNT) + if (id >= TARGET_ICONS_COUNT) return; // clean other icons if (targetGuid) - for (int i=0; i= MAXRAIDSIZE) : (m_memberSlots.size() >= MAXGROUPSIZE); + return isRaidGroup() ? (m_memberSlots.size() >= MAX_RAID_SIZE) : (m_memberSlots.size() >= MAX_GROUP_SIZE); } bool Group::isLFGGroup() const @@ -2501,7 +2501,7 @@ bool Group::SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const bool Group::HasFreeSlotSubGroup(uint8 subgroup) const { - return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE); + return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAX_GROUP_SIZE); } uint8 Group::GetMemberGroup(ObjectGuid guid) const diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 4bf4378686..7793e09297 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -39,10 +39,11 @@ class WorldSession; struct MapEntry; -#define MAXGROUPSIZE 5 -#define MAXRAIDSIZE 40 -#define MAX_RAID_SUBGROUPS MAXRAIDSIZE/MAXGROUPSIZE -#define TARGETICONCOUNT 8 +#define MAX_GROUP_SIZE 5 +#define MAX_RAID_SIZE 40 +#define MAX_RAID_SUBGROUPS MAX_RAID_SIZE / MAX_GROUP_SIZE + +#define TARGET_ICONS_COUNT 8 enum RollVote { @@ -357,7 +358,7 @@ class TC_GAME_API Group Difficulty m_raidDifficulty; Battleground* m_bgGroup; Battlefield* m_bfGroup; - ObjectGuid m_targetIcons[TARGETICONCOUNT]; + ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]; LootMethod m_lootMethod; ItemQualities m_lootThreshold; ObjectGuid m_looterGuid; diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index fd3fae44bd..2ba9dff0b6 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -52,7 +52,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPackets::LFG::LFGJoin& packet) { if (!sLFGMgr->isOptionEnabled(lfg::LFG_OPTION_ENABLE_DUNGEON_FINDER | lfg::LFG_OPTION_ENABLE_RAID_BROWSER) || (GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() && - (GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup()))) + (GetPlayer()->GetGroup()->GetMembersCount() == MAX_GROUP_SIZE || !GetPlayer()->GetGroup()->isLFGGroup()))) return; if (packet.Slots.empty()) diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index aed2154129..f8c7b97cb4 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -60,7 +60,7 @@ class boss_darkmaster_gandling : public CreatureScript struct boss_darkmaster_gandlingAI : public BossAI { - boss_darkmaster_gandlingAI(Creature* creature) : BossAI(creature, DATA_DARKMASTERGANDLING) { } + boss_darkmaster_gandlingAI(Creature* creature) : BossAI(creature, DATA_DARKMASTER_GANDLING) { } void Reset() override { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp index f058d2ac3d..56c78aa416 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp @@ -51,7 +51,7 @@ class boss_doctor_theolen_krastinov : public CreatureScript struct boss_theolenkrastinovAI : public BossAI { - boss_theolenkrastinovAI(Creature* creature) : BossAI(creature, DATA_DOCTORTHEOLENKRASTINOV) { } + boss_theolenkrastinovAI(Creature* creature) : BossAI(creature, DATA_DOCTOR_THEOLEN_KRASTINOV) { } void JustEngagedWith(Unit* who) override { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp index 1efb043fd0..28e7529fa5 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp @@ -49,7 +49,7 @@ class boss_illucia_barov : public CreatureScript struct boss_illuciabarovAI : public BossAI { - boss_illuciabarovAI(Creature* creature) : BossAI(creature, DATA_LADYILLUCIABAROV) { } + boss_illuciabarovAI(Creature* creature) : BossAI(creature, DATA_LADY_ILLUCIA_BAROV) { } void JustEngagedWith(Unit* who) override { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp index eef824e3d0..9a8002b070 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp @@ -50,7 +50,7 @@ class boss_instructor_malicia : public CreatureScript struct boss_instructormaliciaAI : public BossAI { - boss_instructormaliciaAI(Creature* creature) : BossAI(creature, DATA_INSTRUCTORMALICIA) + boss_instructormaliciaAI(Creature* creature) : BossAI(creature, DATA_INSTRUCTOR_MALICIA) { Initialize(); } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp index 20be79069e..22ed088934 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp @@ -45,7 +45,7 @@ class boss_lord_alexei_barov : public CreatureScript struct boss_lordalexeibarovAI : public BossAI { - boss_lordalexeibarovAI(Creature* creature) : BossAI(creature, DATA_LORDALEXEIBAROV) { } + boss_lordalexeibarovAI(Creature* creature) : BossAI(creature, DATA_LORD_ALEXEI_BAROV) { } void Reset() override { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp index 8ae50697d9..0761583732 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp @@ -48,7 +48,7 @@ class boss_lorekeeper_polkelt : public CreatureScript struct boss_lorekeeperpolkeltAI : public BossAI { - boss_lorekeeperpolkeltAI(Creature* creature) : BossAI(creature, DATA_LOREKEEPERPOLKELT) { } + boss_lorekeeperpolkeltAI(Creature* creature) : BossAI(creature, DATA_LOREKEEPER_POLKELT) { } void JustEngagedWith(Unit* who) override { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp index 63050b56ab..3b6965f758 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp @@ -48,7 +48,7 @@ class boss_the_ravenian : public CreatureScript struct boss_theravenianAI : public BossAI { - boss_theravenianAI(Creature* creature) : BossAI(creature, DATA_THERAVENIAN) { } + boss_theravenianAI(Creature* creature) : BossAI(creature, DATA_THE_RAVENIAN) { } void JustEngagedWith(Unit* who) override { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index 4bbba1d1a8..504cdaf3ca 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -85,12 +85,12 @@ class instance_scholomance : public InstanceMapScript switch (type) { - case DATA_LORDALEXEIBAROV: - case DATA_DOCTORTHEOLENKRASTINOV: - case DATA_THERAVENIAN: - case DATA_LOREKEEPERPOLKELT: - case DATA_INSTRUCTORMALICIA: - case DATA_LADYILLUCIABAROV: + case DATA_LORD_ALEXEI_BAROV: + case DATA_DOCTOR_THEOLEN_KRASTINOV: + case DATA_THE_RAVENIAN: + case DATA_LOREKEEPER_POLKELT: + case DATA_INSTRUCTOR_MALICIA: + case DATA_LADY_ILLUCIA_BAROV: CheckToSpawnGandling(); break; default: @@ -133,20 +133,20 @@ class instance_scholomance : public InstanceMapScript { switch (bossId) { - case DATA_DARKMASTERGANDLING: - if (GetBossState(DATA_LORDALEXEIBAROV) != DONE) + case DATA_DARKMASTER_GANDLING: + if (GetBossState(DATA_LORD_ALEXEI_BAROV) != DONE) return false; - if (GetBossState(DATA_DOCTORTHEOLENKRASTINOV) != DONE) + if (GetBossState(DATA_DOCTOR_THEOLEN_KRASTINOV) != DONE) return false; - if (GetBossState(DATA_THERAVENIAN) != DONE) + if (GetBossState(DATA_THE_RAVENIAN) != DONE) return false; - if (GetBossState(DATA_LOREKEEPERPOLKELT) != DONE) + if (GetBossState(DATA_LOREKEEPER_POLKELT) != DONE) return false; - if (GetBossState(DATA_INSTRUCTORMALICIA) != DONE) + if (GetBossState(DATA_INSTRUCTOR_MALICIA) != DONE) return false; - if (GetBossState(DATA_LADYILLUCIABAROV) != DONE) + if (GetBossState(DATA_LADY_ILLUCIA_BAROV) != DONE) return false; - if (GetBossState(DATA_DARKMASTERGANDLING) == DONE) + if (GetBossState(DATA_DARKMASTER_GANDLING) == DONE) return false; break; default: @@ -158,7 +158,7 @@ class instance_scholomance : public InstanceMapScript void CheckToSpawnGandling() { - if (CheckPreBosses(DATA_DARKMASTERGANDLING)) + if (CheckPreBosses(DATA_DARKMASTER_GANDLING)) instance->SummonCreature(NPC_DARKMASTER_GANDLING, GandlingLoc); } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h index 651f1c2662..42b075eb4b 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h +++ b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h @@ -27,13 +27,13 @@ uint32 const EncounterCount = 8; enum SCDataTypes { - DATA_DOCTORTHEOLENKRASTINOV = 0, - DATA_INSTRUCTORMALICIA = 1, - DATA_LADYILLUCIABAROV = 2, - DATA_LORDALEXEIBAROV = 3, - DATA_LOREKEEPERPOLKELT = 4, - DATA_THERAVENIAN = 5, - DATA_DARKMASTERGANDLING = 6, + DATA_DOCTOR_THEOLEN_KRASTINOV = 0, + DATA_INSTRUCTOR_MALICIA = 1, + DATA_LADY_ILLUCIA_BAROV = 2, + DATA_LORD_ALEXEI_BAROV = 3, + DATA_LOREKEEPER_POLKELT = 4, + DATA_THE_RAVENIAN = 5, + DATA_DARKMASTER_GANDLING = 6, DATA_KIRTONOS = 7 }; From fe2da02cc65a4c549bfea5709d7655c367dca1e9 Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Sat, 23 Sep 2023 20:25:25 +0200 Subject: [PATCH 03/13] Core/Battlegrounds: Fix group loot (#29300) --- src/server/game/Battlegrounds/Battleground.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 9965641bc9..a06c87d2ee 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -27,6 +27,7 @@ #include "GameTime.h" #include "GridNotifiersImpl.h" #include "Group.h" +#include "GroupMgr.h" #include "MiscPackets.h" #include "Object.h" #include "ObjectAccessor.h" @@ -1042,6 +1043,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team) group = new Group; SetBgRaid(team, group); group->Create(player); + sGroupMgr->AddGroup(group); } else // raid already exist { From a5217f59b2ed871c8a64f8965951917ac98b0a63 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Tue, 12 Sep 2023 12:46:33 +0200 Subject: [PATCH 04/13] Core/World: added underlying types to world config enums --- src/server/game/World/World.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 8119d1321c..62caaefc12 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -86,7 +86,7 @@ enum WorldTimers }; /// Configuration elements -enum WorldBoolConfigs +enum WorldBoolConfigs : uint32 { CONFIG_DURABILITY_LOSS_IN_PVP = 0, CONFIG_ADDON_CHANNEL, @@ -181,7 +181,7 @@ enum WorldBoolConfigs BOOL_CONFIG_VALUE_COUNT }; -enum WorldFloatConfigs +enum WorldFloatConfigs : uint32 { CONFIG_GROUP_XP_DISTANCE = 0, CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE, @@ -206,7 +206,7 @@ enum WorldFloatConfigs FLOAT_CONFIG_VALUE_COUNT }; -enum WorldIntConfigs +enum WorldIntConfigs : uint32 { CONFIG_COMPRESSION = 0, CONFIG_INTERVAL_SAVE, From d11d992df9e15503c321ffcce566f13923f51508 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Tue, 12 Sep 2023 12:52:15 +0200 Subject: [PATCH 05/13] Core/Player: return player corpse locations by reference instead of creating copies --- src/server/game/Entities/Player/Player.cpp | 3 +-- src/server/game/Entities/Player/Player.h | 2 +- src/server/game/Handlers/NPCHandler.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index e6a3b4fe12..5543652b36 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4512,8 +4512,7 @@ void Player::BuildPlayerRepop() // there must be SMSG.STOP_MIRROR_TIMER // the player cannot have a corpse already on current map, only bones which are not returned by GetCorpse - WorldLocation corpseLocation = GetCorpseLocation(); - if (corpseLocation.GetMapId() == GetMapId()) + if (GetCorpseLocation().GetMapId() == GetMapId()) { TC_LOG_ERROR("entities.player", "Player::BuildPlayerRepop: Player '{}' ({}) already has a corpse", GetName(), GetGUID().ToString()); return; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index d67225835a..2b5b12c641 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1700,7 +1700,7 @@ class TC_GAME_API Player : public Unit, public GridObject void KillPlayer(); static void OfflineResurrect(ObjectGuid const& guid, CharacterDatabaseTransaction trans); bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; } - WorldLocation GetCorpseLocation() const { return _corpseLocation; } + WorldLocation const& GetCorpseLocation() const { return _corpseLocation; } uint32 GetResurrectionSpellId(); void ResurrectPlayer(float restore_percent, bool applySickness = false); void BuildPlayerRepop(); diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 9d9e90b1f6..98f1e1ab29 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -218,9 +218,9 @@ void WorldSession::SendSpiritResurrect() // get corpse nearest graveyard WorldSafeLocsEntry const* corpseGrave = nullptr; - WorldLocation corpseLocation = _player->GetCorpseLocation(); if (_player->HasCorpse()) { + WorldLocation const& corpseLocation = _player->GetCorpseLocation(); corpseGrave = sObjectMgr->GetClosestGraveyard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(), corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeam()); } From b3dbc8bd6dd920cc8da19f26447b78d94578e4fb Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Tue, 12 Sep 2023 13:06:08 +0200 Subject: [PATCH 06/13] Core/World: refactored locale detection to resolve a ill-defined for loop warning --- src/server/game/World/World.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 4b31ea6fbf..f080cc537a 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2247,27 +2247,30 @@ void World::DetectDBCLang() std::string availableLocalsStr; uint8 default_locale = TOTAL_LOCALES; - for (uint8 i = default_locale-1; i < TOTAL_LOCALES; --i) // -1 will be 255 due to uint8 + for (uint8 i = LOCALE_enUS; i < TOTAL_LOCALES; ++i) { if (race->Name[i][0] != '\0') // check by race names { - default_locale = i; + // Mark the first found locale as default locale + if (default_locale == TOTAL_LOCALES) + default_locale = i; + m_availableDbcLocaleMask |= (1 << i); availableLocalsStr += localeNames[i]; availableLocalsStr += " "; } } - if (default_locale != m_lang_confid && m_lang_confid < TOTAL_LOCALES && - (m_availableDbcLocaleMask & (1 << m_lang_confid))) + if (m_availableDbcLocaleMask == 0) { - default_locale = m_lang_confid; + TC_LOG_ERROR("server.loading", "Unable to determine your DBC Locale! (corrupt DBC?)"); + exit(1); } - if (default_locale >= TOTAL_LOCALES) + if (default_locale != m_lang_confid && m_lang_confid < TOTAL_LOCALES && + (m_availableDbcLocaleMask & (1 << m_lang_confid))) { - TC_LOG_ERROR("server.loading", "Unable to determine your DBC Locale! (corrupt DBC?)"); - exit(1); + default_locale = m_lang_confid; } m_defaultDbcLocale = LocaleConstant(default_locale); From ff0d198ef5b2c74aea2e346bfda3b52a957a1876 Mon Sep 17 00:00:00 2001 From: Edgars Baduns Date: Fri, 29 Sep 2023 13:29:29 +0100 Subject: [PATCH 07/13] Build: Fixed tools only build (#29341) (cherry picked from commit 592e01cf7a5d7b6f7ec63d30edc09dd9d4062b62) --- dep/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt index 71fa48710c..41bd55fa91 100644 --- a/dep/CMakeLists.txt +++ b/dep/CMakeLists.txt @@ -22,6 +22,7 @@ if(SERVERS OR TOOLS) add_subdirectory(openssl) add_subdirectory(jemalloc) add_subdirectory(argon2) + add_subdirectory(short_alloc) endif() if(SERVERS) @@ -29,7 +30,6 @@ if(SERVERS) add_subdirectory(readline) add_subdirectory(gsoap) add_subdirectory(efsw) - add_subdirectory(short_alloc) endif() if(TOOLS) From 163c674adb6413089134e081180c10e6871f3a04 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 25 May 2022 22:07:47 +0200 Subject: [PATCH 08/13] Core/Objects: Remove restriction on what object types can be set as active (cherry picked from commit 3031fbb63bfb2df2aa041bd9c04c5c42b0c07c05) --- src/server/game/Grids/ObjectGridLoader.cpp | 21 +---- src/server/game/Grids/ObjectGridLoader.h | 3 +- src/server/game/Maps/Map.cpp | 93 ++++++++++++---------- src/server/game/Maps/Map.h | 6 +- 4 files changed, 59 insertions(+), 64 deletions(-) diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index e34c353edb..bcb6e6b41a 100644 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -79,31 +79,14 @@ class ObjectWorldLoader uint32& i_corpses; }; -template void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellCoord const& /*cellCoord*/) { } - -template<> void ObjectGridLoader::SetObjectCell(Creature* obj, CellCoord const& cellCoord) -{ - Cell cell(cellCoord); - obj->SetCurrentCell(cell); -} - -template<> void ObjectGridLoader::SetObjectCell(GameObject* obj, CellCoord const& cellCoord) +void ObjectGridLoader::SetObjectCell(MapObject* obj, CellCoord const& cellCoord) { Cell cell(cellCoord); obj->SetCurrentCell(cell); } template -void AddObjectHelper(CellCoord &cell, GridRefManager &m, uint32 &count, Map* /*map*/, T *obj) -{ - obj->AddToGrid(m); - ObjectGridLoader::SetObjectCell(obj, cell); - obj->AddToWorld(); - ++count; -} - -template <> -void AddObjectHelper(CellCoord &cell, CreatureMapType &m, uint32 &count, Map* map, Creature *obj) +void AddObjectHelper(CellCoord &cell, GridRefManager &m, uint32 &count, Map* map, T *obj) { obj->AddToGrid(m); ObjectGridLoader::SetObjectCell(obj, cell); diff --git a/src/server/game/Grids/ObjectGridLoader.h b/src/server/game/Grids/ObjectGridLoader.h index e07d834578..4621420c52 100644 --- a/src/server/game/Grids/ObjectGridLoader.h +++ b/src/server/game/Grids/ObjectGridLoader.h @@ -24,6 +24,7 @@ #include "GridDefines.h" #include "Cell.h" +class MapObject; class ObjectWorldLoader; class TC_GAME_API ObjectGridLoader @@ -42,7 +43,7 @@ class TC_GAME_API ObjectGridLoader void LoadN(void); - template static void SetObjectCell(T* obj, CellCoord const& cellCoord); + static void SetObjectCell(MapObject* obj, CellCoord const& cellCoord); private: Cell i_cell; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 3f50c404f5..bd597e9ad8 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3719,71 +3719,84 @@ bool Map::ActiveObjectsNearGrid(NGridType const& ngrid) const return false; } -template -void Map::AddToActive(T* obj) +void Map::AddToActive(WorldObject* obj) { AddToActiveHelper(obj); -} -template <> -void Map::AddToActive(Creature* c) -{ - AddToActiveHelper(c); + Optional respawnLocation; + switch (obj->GetTypeId()) + { + case TYPEID_UNIT: + if (Creature* creature = obj->ToCreature(); !creature->IsPet() && creature->GetSpawnId()) + { + respawnLocation.emplace(); + creature->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ); + } + break; + case TYPEID_GAMEOBJECT: + if (GameObject* gameObject = obj->ToGameObject(); gameObject->GetSpawnId()) + { + respawnLocation.emplace(); + gameObject->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ); + } + break; + default: + break; + } - // also not allow unloading spawn grid to prevent creating creature clone at load - if (!c->IsPet() && c->GetSpawnId()) + if (respawnLocation) { - float x, y, z; - c->GetRespawnPosition(x, y, z); - GridCoord p = Trinity::ComputeGridCoord(x, y); + GridCoord p = Trinity::ComputeGridCoord(respawnLocation->GetPositionX(), respawnLocation->GetPositionY()); if (getNGrid(p.x_coord, p.y_coord)) getNGrid(p.x_coord, p.y_coord)->incUnloadActiveLock(); else { - GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); - TC_LOG_ERROR("maps", "Active creature{} added to grid[{}, {}] but spawn grid[{}, {}] was not loaded.", - c->GetGUID().ToString(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); + GridCoord p2 = Trinity::ComputeGridCoord(obj->GetPositionX(), obj->GetPositionY()); + TC_LOG_ERROR("maps", "Active object {} added to grid[{}, {}] but spawn grid[{}, {}] was not loaded.", + obj->GetGUID().ToString(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } } } -template<> -void Map::AddToActive(DynamicObject* d) +void Map::RemoveFromActive(WorldObject* obj) { - AddToActiveHelper(d); -} - -template -void Map::RemoveFromActive(T* /*obj*/) { } + RemoveFromActiveHelper(obj); -template <> -void Map::RemoveFromActive(Creature* c) -{ - RemoveFromActiveHelper(c); + Optional respawnLocation; + switch (obj->GetTypeId()) + { + case TYPEID_UNIT: + if (Creature* creature = obj->ToCreature(); !creature->IsPet() && creature->GetSpawnId()) + { + respawnLocation.emplace(); + creature->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ); + } + break; + case TYPEID_GAMEOBJECT: + if (GameObject* gameObject = obj->ToGameObject(); gameObject->GetSpawnId()) + { + respawnLocation.emplace(); + gameObject->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ); + } + break; + default: + break; + } - // also allow unloading spawn grid - if (!c->IsPet() && c->GetSpawnId()) + if (respawnLocation) { - float x, y, z; - c->GetRespawnPosition(x, y, z); - GridCoord p = Trinity::ComputeGridCoord(x, y); + GridCoord p = Trinity::ComputeGridCoord(respawnLocation->GetPositionX(), respawnLocation->GetPositionY()); if (getNGrid(p.x_coord, p.y_coord)) getNGrid(p.x_coord, p.y_coord)->decUnloadActiveLock(); else { - GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); - TC_LOG_ERROR("maps", "Active creature {} removed from grid[{}, {}] but spawn grid[{}, {}] was not loaded.", - c->GetGUID().ToString(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); + GridCoord p2 = Trinity::ComputeGridCoord(obj->GetPositionX(), obj->GetPositionY()); + TC_LOG_ERROR("maps", "Active object {} removed from grid[{}, {}] but spawn grid[{}, {}] was not loaded.", + obj->GetGUID().ToString(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } } } -template<> -void Map::RemoveFromActive(DynamicObject* obj) -{ - RemoveFromActiveHelper(obj); -} - template TC_GAME_API bool Map::AddToMap(Corpse*); template TC_GAME_API bool Map::AddToMap(Creature*); template TC_GAME_API bool Map::AddToMap(GameObject*); diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index f6814efbdc..dadd8cc14d 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -489,12 +489,10 @@ class TC_GAME_API Map : public GridRefManager void ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* source, Object* target); // must called with AddToWorld - template - void AddToActive(T* obj); + void AddToActive(WorldObject* obj); // must called with RemoveFromWorld - template - void RemoveFromActive(T* obj); + void RemoveFromActive(WorldObject* obj); template void SwitchGridContainers(T* obj, bool on); std::unordered_map CreatureGroupHolder; From 2df1bc3ec12d4a3ed7bac1274d8810ca3538607d Mon Sep 17 00:00:00 2001 From: robinsch Date: Thu, 12 Oct 2023 12:48:23 +0200 Subject: [PATCH 09/13] Core/Object: Remove casts in WorldObject::setActive --- src/server/game/Entities/Object/Object.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index a265ec4c77..3fa2ebf40c 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1011,19 +1011,9 @@ void WorldObject::setActive(bool on) return; if (on) - { - if (GetTypeId() == TYPEID_UNIT) - map->AddToActive(ToCreature()); - else if (GetTypeId() == TYPEID_DYNAMICOBJECT) - map->AddToActive((DynamicObject*)this); - } + map->AddToActive(this); else - { - if (GetTypeId() == TYPEID_UNIT) - map->RemoveFromActive(ToCreature()); - else if (GetTypeId() == TYPEID_DYNAMICOBJECT) - map->RemoveFromActive((DynamicObject*)this); - } + map->RemoveFromActive(this); } void WorldObject::SetFarVisible(bool on) From a85dcb6fc1e8008fe6808117ba474da8dee32787 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 14 Oct 2023 16:55:12 +0200 Subject: [PATCH 10/13] Core/Auras: Registering a new owned aura will now search existing owned auras instead of applied auras to check for unstackable one Closes #22234 (cherry picked from commit dc661a34b1d1e099e2c1854e8fa9446115e30c96) --- src/server/game/Entities/Unit/Unit.cpp | 27 +++++++------------------- src/server/game/Entities/Unit/Unit.h | 2 +- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1e515b4858..e0c3a42ded 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3269,7 +3269,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster) ASSERT(!m_cleanupDone); m_ownedAuras.emplace(aura->GetId(), aura); - _RemoveNoStackAurasDueToAura(aura); + _RemoveNoStackAurasDueToAura(aura, true); if (aura->IsRemoved()) return; @@ -3363,7 +3363,7 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint8 effMask) { Aura* aura = aurApp->GetBase(); - _RemoveNoStackAurasDueToAura(aura); + _RemoveNoStackAurasDueToAura(aura, false); if (aurApp->GetRemoveMode()) return; @@ -3517,7 +3517,7 @@ void Unit::_UnapplyAura(AuraApplication* aurApp, AuraRemoveMode removeMode) ABORT(); } -void Unit::_RemoveNoStackAurasDueToAura(Aura* aura) +void Unit::_RemoveNoStackAurasDueToAura(Aura* aura, bool owned) { SpellInfo const* spellProto = aura->GetSpellInfo(); @@ -3531,23 +3531,10 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura) return; } - bool remove = false; - for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i) - { - if (remove) - { - remove = false; - i = m_appliedAuras.begin(); - } - - if (aura->CanStackWith(i->second->GetBase())) - continue; - - RemoveAura(i, AURA_REMOVE_BY_DEFAULT); - if (i == m_appliedAuras.end()) - break; - remove = true; - } + if (owned) + RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); }, AURA_REMOVE_BY_DEFAULT); + else + RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); }, AURA_REMOVE_BY_DEFAULT); } void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 99fb781cef..1e2753842f 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1320,7 +1320,7 @@ class TC_GAME_API Unit : public WorldObject void _ApplyAura(AuraApplication* aurApp, uint8 effMask); void _UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveMode removeMode); void _UnapplyAura(AuraApplication* aurApp, AuraRemoveMode removeMode); - void _RemoveNoStackAurasDueToAura(Aura* aura); + void _RemoveNoStackAurasDueToAura(Aura* aura, bool owned); void _RegisterAuraEffect(AuraEffect* aurEff, bool apply); // m_ownedAuras container management From d028bb0e374acfc635b2f6f224f5732d3bfa13fd Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 15 Oct 2023 14:20:50 +0200 Subject: [PATCH 11/13] Core/Auras: Implemented SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD (suppress aura applications while dead without removing the aura) (cherry picked from commit 0f7dd4eadf90a5407fd232d083485430d725152f) --- src/server/game/Entities/Unit/UnitDefines.h | 8 ++++---- src/server/game/Spells/Auras/SpellAuras.cpp | 3 +++ src/server/shared/SharedDefines.h | 2 +- src/server/shared/enuminfo_SharedDefines.cpp | 6 +++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h index af72559baa..a26da83b29 100644 --- a/src/server/game/Entities/Unit/UnitDefines.h +++ b/src/server/game/Entities/Unit/UnitDefines.h @@ -171,9 +171,9 @@ enum UnitFlags : uint32 UNIT_FLAG_SILENCED | UNIT_FLAG_NON_ATTACKABLE_2 | UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_ON_TAXI | UNIT_FLAG_DISARMED | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_POSSESSED | UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_UNK_28 | - UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_SHEATHE | UNIT_FLAG_IMMUNE), + UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_SHEATHE | UNIT_FLAG_IMMUNE), // SKIP - UNIT_FLAG_ALLOWED = (0xFFFFFFFF & ~UNIT_FLAG_DISALLOWED) + UNIT_FLAG_ALLOWED = (0xFFFFFFFF & ~UNIT_FLAG_DISALLOWED) // SKIP }; DEFINE_ENUM_FLAG(UnitFlags); @@ -222,9 +222,9 @@ enum UnitFlags2 : uint32 /* UNIT_FLAG2_PLAY_DEATH_ANIM | */ UNIT_FLAG2_ALLOW_CHEAT_SPELLS | UNIT_FLAG2_UNUSED_1 | UNIT_FLAG2_UNUSED_2 | UNIT_FLAG2_UNUSED_3 | UNIT_FLAG2_UNUSED_4 | UNIT_FLAG2_UNUSED_5 | UNIT_FLAG2_UNUSED_6 | UNIT_FLAG2_UNUSED_7 | UNIT_FLAG2_UNUSED_8 | UNIT_FLAG2_UNUSED_9 | - UNIT_FLAG2_UNUSED_10 | UNIT_FLAG2_UNUSED_11 | UNIT_FLAG2_UNUSED_12 | UNIT_FLAG2_UNUSED_13), + UNIT_FLAG2_UNUSED_10 | UNIT_FLAG2_UNUSED_11 | UNIT_FLAG2_UNUSED_12 | UNIT_FLAG2_UNUSED_13), // SKIP - UNIT_FLAG2_ALLOWED = (0xFFFFFFFF & ~UNIT_FLAG2_DISALLOWED) + UNIT_FLAG2_ALLOWED = (0xFFFFFFFF & ~UNIT_FLAG2_DISALLOWED) // SKIP }; DEFINE_ENUM_FLAG(UnitFlags2); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 48b281c364..1b12ecf336 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2597,6 +2597,9 @@ void UnitAura::Remove(AuraRemoveMode removeMode) void UnitAura::FillTargetMap(std::unordered_map& targets, Unit* caster) { + if (GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD) && !GetUnitOwner()->IsAlive()) + return; + Unit* ref = caster; if (!ref) ref = GetUnitOwner(); diff --git a/src/server/shared/SharedDefines.h b/src/server/shared/SharedDefines.h index 0bdd89004f..f23b5ee486 100644 --- a/src/server/shared/SharedDefines.h +++ b/src/server/shared/SharedDefines.h @@ -664,7 +664,7 @@ enum SpellAttr7 : uint32 { SPELL_ATTR7_UNK0 = 0x00000001, // TITLE Unknown attribute 0@Attr7 SPELL_ATTR7_IGNORE_DURATION_MODS = 0x00000002, // TITLE Ignore duration modifiers - SPELL_ATTR7_REACTIVATE_AT_RESURRECT = 0x00000004, // TITLE Reactivate at resurrect (client only) + SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD = 0x00000004, // TITLE Disable Aura While Dead SPELL_ATTR7_IS_CHEAT_SPELL = 0x00000008, // TITLE Is cheat spell DESCRIPTION Cannot cast if caster doesn't have UnitFlag2 & UNIT_FLAG2_ALLOW_CHEAT_SPELLS SPELL_ATTR7_UNK4 = 0x00000010, // TITLE Unknown attribute 4@Attr7 DESCRIPTION Soulstone related? SPELL_ATTR7_SUMMON_PLAYER_TOTEM = 0x00000020, // TITLE Summons player-owned totem diff --git a/src/server/shared/enuminfo_SharedDefines.cpp b/src/server/shared/enuminfo_SharedDefines.cpp index bc6b4d7763..bfb9ed3487 100644 --- a/src/server/shared/enuminfo_SharedDefines.cpp +++ b/src/server/shared/enuminfo_SharedDefines.cpp @@ -1173,7 +1173,7 @@ TC_API_EXPORT EnumText EnumUtils::ToString(SpellAttr7 value) { case SPELL_ATTR7_UNK0: return { "SPELL_ATTR7_UNK0", "Unknown attribute 0@Attr7", "" }; case SPELL_ATTR7_IGNORE_DURATION_MODS: return { "SPELL_ATTR7_IGNORE_DURATION_MODS", "Ignore duration modifiers", "" }; - case SPELL_ATTR7_REACTIVATE_AT_RESURRECT: return { "SPELL_ATTR7_REACTIVATE_AT_RESURRECT", "Reactivate at resurrect (client only)", "" }; + case SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD: return { "SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD", "Disable Aura While Dead", "" }; case SPELL_ATTR7_IS_CHEAT_SPELL: return { "SPELL_ATTR7_IS_CHEAT_SPELL", "Is cheat spell", "Cannot cast if caster doesn't have UnitFlag2 & UNIT_FLAG2_ALLOW_CHEAT_SPELLS" }; case SPELL_ATTR7_UNK4: return { "SPELL_ATTR7_UNK4", "Unknown attribute 4@Attr7", "Soulstone related?" }; case SPELL_ATTR7_SUMMON_PLAYER_TOTEM: return { "SPELL_ATTR7_SUMMON_PLAYER_TOTEM", "Summons player-owned totem", "" }; @@ -1217,7 +1217,7 @@ TC_API_EXPORT SpellAttr7 EnumUtils::FromIndex(size_t index) { case 0: return SPELL_ATTR7_UNK0; case 1: return SPELL_ATTR7_IGNORE_DURATION_MODS; - case 2: return SPELL_ATTR7_REACTIVATE_AT_RESURRECT; + case 2: return SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD; case 3: return SPELL_ATTR7_IS_CHEAT_SPELL; case 4: return SPELL_ATTR7_UNK4; case 5: return SPELL_ATTR7_SUMMON_PLAYER_TOTEM; @@ -1258,7 +1258,7 @@ TC_API_EXPORT size_t EnumUtils::ToIndex(SpellAttr7 value) { case SPELL_ATTR7_UNK0: return 0; case SPELL_ATTR7_IGNORE_DURATION_MODS: return 1; - case SPELL_ATTR7_REACTIVATE_AT_RESURRECT: return 2; + case SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD: return 2; case SPELL_ATTR7_IS_CHEAT_SPELL: return 3; case SPELL_ATTR7_UNK4: return 4; case SPELL_ATTR7_SUMMON_PLAYER_TOTEM: return 5; From 3bdc5ecbdbedfefcd81e36d7b318614bf39f2a12 Mon Sep 17 00:00:00 2001 From: M'Dic Date: Mon, 16 Oct 2023 10:18:16 -0400 Subject: [PATCH 12/13] update (module): core aligntment --- src/server/game/DungeonFinding/LFGMgr.cpp | 2 +- src/server/game/DungeonFinding/LFGQueue.cpp | 12 +++++------ src/server/game/Groups/Group.cpp | 22 ++++++++++----------- src/server/game/Groups/Group.h | 10 +++++----- src/server/game/Handlers/LFGHandler.cpp | 2 +- src/server/shared/DataStores/DBCStructure.h | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index bd7c55a702..0f3cc9425d 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -446,7 +446,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const joinData.result = LFG_JOIN_NOT_MEET_REQS; else if (grp) { - if (grp->GetMembersCount() > MAXGROUPSIZE) + if (grp->GetMembersCount() > MAX_GROUP_SIZE) joinData.result = LFG_JOIN_TOO_MUCH_MEMBERS; else { diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 034f158697..c9274a6d84 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -370,7 +370,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) LfgRolesMap proposalRoles; // Check for correct size - if (check.size() > MAXGROUPSIZE || check.empty()) + if (check.size() > MAX_GROUP_SIZE || check.empty()) { TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}): Size wrong - Not compatibles", GetDetailedMatchRoles(check)); return LFG_INCOMPATIBLES_WRONG_GROUP_SIZE; @@ -396,7 +396,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) // Check if more than one LFG group and number of players joining uint8 numPlayers = 0; uint8 numLfgGroups = 0; - for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it) + for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAX_GROUP_SIZE; ++it) { ObjectGuid guid = *it; LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); @@ -421,8 +421,8 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) } } - // Group with less that MAXGROUPSIZE members always compatible - if (!sLFGMgr->IsSoloLFG() && numPlayers != MAXGROUPSIZE) //solo lfg + // Group with less that MAX_GROUP_SIZE members always compatible + if (!sLFGMgr->IsSoloLFG() && numPlayers != MAX_GROUP_SIZE) //solo lfg { TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) single group. Compatibles", GetDetailedMatchRoles(check)); LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front()); @@ -443,7 +443,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS; } - if (numPlayers > MAXGROUPSIZE) + if (numPlayers > MAX_GROUP_SIZE) { TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) Too many players ({})", GetDetailedMatchRoles(check), numPlayers); SetCompatibles(strGuids, LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS); @@ -520,7 +520,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) } // Enough players? - if (!sLFGMgr->IsSoloLFG() && numPlayers != MAXGROUPSIZE) //solo lfg + if (!sLFGMgr->IsSoloLFG() && numPlayers != MAX_GROUP_SIZE) //solo lfg { TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) Compatibles but not enough players({})", GetDetailedMatchRoles(check), numPlayers); LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS); diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 26e0117a70..693b400225 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -64,7 +64,7 @@ m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY m_bgGroup(nullptr), m_bfGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(), m_masterLooterGuid(), m_subGroupsCounts(nullptr), m_guid(), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0), m_isLeaderOffline(false) { - for (uint8 i = 0; i < TARGETICONCOUNT; ++i) + for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i) m_targetIcons[i].Clear(); } @@ -232,7 +232,7 @@ void Group::LoadGroupFromDB(Field* fields) m_looterGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32()); m_lootThreshold = ItemQualities(fields[3].GetUInt8()); - for (uint8 i = 0; i < TARGETICONCOUNT; ++i) + for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i) m_targetIcons[i].Set(fields[4 + i].GetUInt64()); m_groupType = GroupType(fields[12].GetUInt8()); @@ -401,7 +401,7 @@ bool Group::AddMember(Player* player) bool groupFound = false; for (; subGroup < MAX_RAID_SUBGROUPS; ++subGroup) { - if (m_subGroupsCounts[subGroup] < MAXGROUPSIZE) + if (m_subGroupsCounts[subGroup] < MAX_GROUP_SIZE) { groupFound = true; break; @@ -438,7 +438,7 @@ bool Group::AddMember(Player* player) if (!isRaidGroup()) // reset targetIcons for non-raid-groups { - for (uint8 i = 0; i < TARGETICONCOUNT; ++i) + for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i) m_targetIcons[i].Clear(); } @@ -1627,12 +1627,12 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid) { - if (id >= TARGETICONCOUNT) + if (id >= TARGET_ICONS_COUNT) return; // clean other icons if (targetGuid) - for (int i=0; i bgEntry->MaxGroupSize) // no MinPlayerCount for battlegrounds + if (memberscount > bgEntry->MAX_GROUP_SIZE) // no MinPlayerCount for battlegrounds return ERR_BATTLEGROUND_NONE; // ERR_GROUP_JOIN_BATTLEGROUND_TOO_MANY handled on client side // get a player as reference, to compare other players' stats to (arena team id, queue id based on level, etc.) @@ -2387,7 +2387,7 @@ void Group::SetLfgRoles(ObjectGuid guid, uint8 roles) bool Group::IsFull() const { - return isRaidGroup() ? (m_memberSlots.size() >= MAXRAIDSIZE) : (m_memberSlots.size() >= MAXGROUPSIZE); + return isRaidGroup() ? (m_memberSlots.size() >= MAX_RAID_SIZE) : (m_memberSlots.size() >= MAX_GROUP_SIZE); } bool Group::isLFGGroup() const @@ -2501,7 +2501,7 @@ bool Group::SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const bool Group::HasFreeSlotSubGroup(uint8 subgroup) const { - return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE); + return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAX_GROUP_SIZE); } uint8 Group::GetMemberGroup(ObjectGuid guid) const diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 4bf4378686..1f41825107 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -39,10 +39,10 @@ class WorldSession; struct MapEntry; -#define MAXGROUPSIZE 5 -#define MAXRAIDSIZE 40 -#define MAX_RAID_SUBGROUPS MAXRAIDSIZE/MAXGROUPSIZE -#define TARGETICONCOUNT 8 +#define MAX_GROUP_SIZE 5 +#define MAX_RAID_SIZE 40 +#define MAX_RAID_SUBGROUPS MAX_RAID_SIZE/MAX_GROUP_SIZE +#define TARGET_ICONS_COUNT 8 enum RollVote { @@ -357,7 +357,7 @@ class TC_GAME_API Group Difficulty m_raidDifficulty; Battleground* m_bgGroup; Battlefield* m_bfGroup; - ObjectGuid m_targetIcons[TARGETICONCOUNT]; + ObjectGuid m_targetIcons[TARGET_ICONS_COUNT]; LootMethod m_lootMethod; ItemQualities m_lootThreshold; ObjectGuid m_looterGuid; diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index fd3fae44bd..2ba9dff0b6 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -52,7 +52,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPackets::LFG::LFGJoin& packet) { if (!sLFGMgr->isOptionEnabled(lfg::LFG_OPTION_ENABLE_DUNGEON_FINDER | lfg::LFG_OPTION_ENABLE_RAID_BROWSER) || (GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() && - (GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup()))) + (GetPlayer()->GetGroup()->GetMembersCount() == MAX_GROUP_SIZE || !GetPlayer()->GetGroup()->isLFGGroup()))) return; if (packet.Slots.empty()) diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index e2c12efee3..a4134efbd0 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -300,7 +300,7 @@ struct BattlemasterListEntry //uint32 GroupsAllowed; // 10 char const* Name[16]; // 11-26 //uint32 Name_lang_mask; // 27 - uint32 MaxGroupSize; // 28 used for checking if queue as group + uint32 MAX_GROUP_SIZE; // 28 used for checking if queue as group uint32 HolidayWorldState; // 29 //uint32 MinLevel; // 30 //uint32 MaxLevel; // 31 From 5c4bcdf15ec63f3baed7dda160b65fe306a45279 Mon Sep 17 00:00:00 2001 From: M'Dic Date: Mon, 16 Oct 2023 10:20:44 -0400 Subject: [PATCH 13/13] Update DBCStructure.h --- src/server/shared/DataStores/DBCStructure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index a4134efbd0..e2c12efee3 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -300,7 +300,7 @@ struct BattlemasterListEntry //uint32 GroupsAllowed; // 10 char const* Name[16]; // 11-26 //uint32 Name_lang_mask; // 27 - uint32 MAX_GROUP_SIZE; // 28 used for checking if queue as group + uint32 MaxGroupSize; // 28 used for checking if queue as group uint32 HolidayWorldState; // 29 //uint32 MinLevel; // 30 //uint32 MaxLevel; // 31