diff options
Diffstat (limited to 'src')
33 files changed, 494 insertions, 243 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index b59397d763c..31262d8eedd 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -27,6 +27,7 @@ #include "Creature.h" #include "World.h" #include "Util.h" +#include "Group.h" int PetAI::Permissible(const Creature *creature) { diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index cb5d455dacc..7717513d409 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -11,6 +11,7 @@ EndScriptData */ #include "ScriptPCH.h" #include "ScriptedEscortAI.h" +#include "Group.h" enum ePoints { diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index c64af4b3619..d9f753306cc 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -11,6 +11,7 @@ EndScriptData */ #include "ScriptPCH.h" #include "ScriptedFollowerAI.h" +#include "Group.h" const float MAX_PLAYER_DISTANCE = 100.0f; diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 57bf8ef9e92..7509fa4e329 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -29,6 +29,7 @@ #include "CellImpl.h" #include "InstanceScript.h" #include "ScriptedCreature.h" +#include "Group.h" #include "SmartAI.h" #include "ScriptPCH.h" diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b74bc2e78bd..27e4afc2a3e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -33,6 +33,7 @@ #include "ScriptedCreature.h" #include "SmartScript.h" #include "SmartAI.h" +#include "Group.h" SmartScript::SmartScript() { diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 0e221256857..1300489f74f 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -21,6 +21,7 @@ #include "ArenaTeam.h" #include "World.h" +#include "Group.h" void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot) { diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index b29b4b9d8d8..ef664b24b8b 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -22,6 +22,7 @@ #include "Chat.h" #include "ObjectMgr.h" #include "Log.h" +#include "Group.h" /*********************************************************/ /*** BATTLEGROUND QUEUE SYSTEM ***/ diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp index 23793abf946..52c67c7c756 100755 --- a/src/server/game/Chat/Commands/Level1.cpp +++ b/src/server/game/Chat/Commands/Level1.cpp @@ -34,6 +34,7 @@ #include "CellImpl.h" #include "InstanceSaveMgr.h" #include "Util.h" +#include "Group.h" #ifdef _DEBUG_VMAPS #include "VMapFactory.h" diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index bfb6c79768c..efff0a0c88a 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -60,6 +60,7 @@ #include "LFGMgr.h" #include "CreatureTextMgr.h" #include "SmartAI.h" +#include "Group.h" bool ChatHandler::HandleMaxSkillCommand(const char* /*args*/) { diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 74c6263d5bf..6c943721b5b 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -46,6 +46,7 @@ #include "CreatureGroups.h" #include "Vehicle.h" #include "SpellAuraEffects.h" +#include "Group.h" // apply implementation of the singletons diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 4a1521264e5..5cf6240bea6 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -39,6 +39,7 @@ #include "BattlegroundAV.h" #include "ScriptMgr.h" #include "CreatureAISelector.h" +#include "Group.h" GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue), m_AI(NULL) { diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 8a07569b6fb..2b02020299a 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -29,6 +29,7 @@ #include "CreatureAI.h" #include "Unit.h" #include "Util.h" +#include "Group.h" char const* petTypeSuffix[MAX_PET_TYPE] = { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index f24cd6b3e92..d09be1ec43a 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -19,38 +19,39 @@ #ifndef _PLAYER_H #define _PLAYER_H +#include "AchievementMgr.h" +#include "Battleground.h" +#include "Bag.h" #include "Common.h" +#include "DatabaseEnv.h" +#include "DBCEnums.h" +#include "GroupReference.h" #include "ItemPrototype.h" -#include "Unit.h" #include "Item.h" -#include "DatabaseEnv.h" +#include "LFG.h" +#include "MapReference.h" #include "NPCHandler.h" -#include "QuestDef.h" -#include "Group.h" -#include "Bag.h" -#include "WorldSession.h" #include "Pet.h" -#include "MapReference.h" -#include "Util.h" // for Tokens typedef -#include "AchievementMgr.h" +#include "QuestDef.h" #include "ReputationMgr.h" -#include "Battleground.h" -#include "DBCEnums.h" -#include "LFG.h" - +#include "Unit.h" +#include "Util.h" // for Tokens typedef +#include "WorldSession.h" + #include<string> #include<vector> - + struct Mail; class Channel; -class DynamicObject; class Creature; +class DynamicObject; +class Group; +class OutdoorPvP; class Pet; class PlayerMenu; -class UpdateMask; -class SpellCastTargets; class PlayerSocial; -class OutdoorPvP; +class SpellCastTargets; +class UpdateMask; typedef std::deque<Mail*> PlayerMails; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 1049ce06f7c..9244544e91a 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -33,6 +33,26 @@ #include "MapInstanced.h" #include "Util.h" +Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid), +itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count), +totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0), +rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT) +{ +} +Roll::~Roll() +{ +} + +void Roll::setLoot(Loot *pLoot) +{ + link(pLoot, this); +} + +Loot* Roll::getLoot() +{ + return getTarget(); +} + Group::Group() { m_leaderGuid = 0; @@ -1900,3 +1920,346 @@ void Group::ResetMaxEnchantingLevel() m_maxEnchantingLevel = pMember->GetSkillValue(SKILL_ENCHANTING); } } + +void Group::SetLootMethod(LootMethod method) +{ + m_lootMethod = method; +} + +void Group::SetLooterGuid(const uint64 &guid) +{ + m_looterGuid = guid; +} + +void Group::SetLootThreshold(ItemQualities threshold) +{ + m_lootThreshold = threshold; +} + +void Group::SetLfgQueued(bool queued) +{ + m_LfgQueued = queued; +} + +bool Group::isLfgQueued() +{ + return m_LfgQueued; +} + +void Group::SetLfgStatus(uint8 status) +{ + m_LfgStatus = status; +} + +uint8 Group::GetLfgStatus() +{ + return m_LfgStatus; +} + +bool Group::isLfgDungeonComplete() const +{ + return m_LfgStatus == LFG_STATUS_COMPLETE; +} + +void Group::SetLfgDungeonEntry(uint32 dungeonEntry) +{ + m_LfgDungeonEntry = dungeonEntry; +} + +uint32 Group::GetLfgDungeonEntry(bool id /* = true*/) +{ + if (id) + return (m_LfgDungeonEntry & 0x00FFFFFF); + else + return m_LfgDungeonEntry; +} + +bool Group::isLfgKickActive() const +{ + return m_LfgkicksActive; +} + +void Group::SetLfgKickActive(bool active) +{ + m_LfgkicksActive = active; +} + +uint8 Group::GetLfgKicks() const +{ + return m_Lfgkicks; +} + +void Group::SetLfgKicks(uint8 kicks) +{ + m_Lfgkicks = kicks; +} + +void Group::SetLfgRoles(uint64 guid, const uint8 roles) +{ + member_witerator slot = _getMemberWSlot(guid); + if (slot == m_memberSlots.end()) + return; + + slot->roles = roles; + SendUpdate(); +} + +bool Group::IsFull() const +{ + return isRaidGroup() ? (m_memberSlots.size() >= MAXRAIDSIZE) : (m_memberSlots.size() >= MAXGROUPSIZE); +} + +bool Group::isLFGGroup() const +{ + return m_groupType & GROUPTYPE_LFG; +} + +bool Group::isRaidGroup() const +{ + return m_groupType & GROUPTYPE_RAID; +} + +bool Group::isBGGroup() const +{ + return m_bgGroup != NULL; +} + +bool Group::IsCreated() const +{ + return GetMembersCount() > 0; +} + +const uint64& Group::GetLeaderGUID() const +{ + return m_leaderGuid; +} + +const uint64& Group::GetGUID() const +{ + return m_guid; +} + +uint32 Group::GetLowGUID() const +{ + return GUID_LOPART(m_guid); +} + +const char * Group::GetLeaderName() const +{ + return m_leaderName.c_str(); +} + +LootMethod Group::GetLootMethod() const +{ + return m_lootMethod; +} + +const uint64& Group::GetLooterGuid() const +{ + return m_looterGuid; +} + +ItemQualities Group::GetLootThreshold() const +{ + return m_lootThreshold; +} + +bool Group::IsMember(const uint64& guid) const +{ + return _getMemberCSlot(guid) != m_memberSlots.end(); +} + +bool Group::IsLeader(const uint64& guid) const +{ + return (GetLeaderGUID() == guid); +} + +uint64 Group::GetMemberGUID(const std::string& name) +{ + for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + if (itr->name == name) + return itr->guid; + return 0; +} + +bool Group::IsAssistant(uint64 guid) const +{ + member_citerator mslot = _getMemberCSlot(guid); + if (mslot == m_memberSlots.end()) + return false; + return mslot->flags & MEMBER_FLAG_ASSISTANT; +} + +bool Group::SameSubGroup(uint64 guid1,const uint64& guid2) const +{ + member_citerator mslot2 = _getMemberCSlot(guid2); + if (mslot2 == m_memberSlots.end()) + return false; + return SameSubGroup(guid1,&*mslot2); +} + +bool Group::SameSubGroup(uint64 guid1, MemberSlot const* slot2) const +{ + member_citerator mslot1 = _getMemberCSlot(guid1); + if (mslot1 == m_memberSlots.end() || !slot2) + return false; + return (mslot1->group == slot2->group); +} + +bool Group::HasFreeSlotSubGroup(uint8 subgroup) const +{ + return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE); +} + +Group::MemberSlotList const& Group::GetMemberSlots() const +{ + return m_memberSlots; +} + +GroupReference* Group::GetFirstMember() +{ + return m_memberMgr.getFirst(); +} + +uint32 Group::GetMembersCount() const +{ + return m_memberSlots.size(); +} + +uint8 Group::GetMemberGroup(uint64 guid) const +{ + member_citerator mslot = _getMemberCSlot(guid); + if (mslot == m_memberSlots.end()) + return (MAX_RAID_SUBGROUPS+1); + return mslot->group; +} + +void Group::SetBattlegroundGroup(Battleground *bg) +{ + m_bgGroup = bg; +} + +void Group::SetAssistant(uint64 guid, const bool &apply) +{ + if (!isRaidGroup()) + return; + + if (_setAssistantFlag(guid, apply)) + SendUpdate(); +} + +void Group::SetMainTank(uint64 guid, const bool &apply) +{ + if (!isRaidGroup()) + return; + + if (_setMainTank(guid, apply)) + SendUpdate(); +} + +void Group::SetMainAssistant(uint64 guid, const bool &apply) +{ + if (!isRaidGroup()) + return; + + if (_setMainAssistant(guid, apply)) + SendUpdate(); +} + +Difficulty Group::GetDifficulty(bool isRaid) const +{ + return isRaid ? m_raidDifficulty : m_dungeonDifficulty; +} + +Difficulty Group::GetDungeonDifficulty() const +{ + return m_dungeonDifficulty; +} + +Difficulty Group::GetRaidDifficulty() const +{ + return m_raidDifficulty; +} + +bool Group::isRollLootActive() const +{ + return !RollId.empty(); +} + +Group::Rolls::iterator Group::GetRoll(uint64 Guid) +{ + Rolls::iterator iter; + for (iter=RollId.begin(); iter != RollId.end(); ++iter) + if ((*iter)->itemGUID == Guid && (*iter)->isValid()) + return iter; + return RollId.end(); +} + +void Group::LinkMember(GroupReference *pRef) +{ + m_memberMgr.insertFirst(pRef); +} + +void Group::DelinkMember(GroupReference* /*pRef*/) +{ +} + +Group::BoundInstancesMap& Group::GetBoundInstances(Difficulty difficulty) +{ + return m_boundInstances[difficulty]; +} + +void Group::_initRaidSubGroupsCounter() +{ + // Sub group counters initialization + if (!m_subGroupsCounts) + m_subGroupsCounts = new uint8[MAX_RAID_SUBGROUPS]; + + memset((void*)m_subGroupsCounts, 0, (MAX_RAID_SUBGROUPS)*sizeof(uint8)); + + for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + ++m_subGroupsCounts[itr->group]; +} + +Group::member_citerator Group::_getMemberCSlot(uint64 Guid) const +{ + for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + if (itr->guid == Guid) + return itr; + return m_memberSlots.end(); +} + +Group::member_witerator Group::_getMemberWSlot(uint64 Guid) +{ + for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + if (itr->guid == Guid) + return itr; + return m_memberSlots.end(); +} + +void Group::SubGroupCounterIncrease(uint8 subgroup) +{ + if (m_subGroupsCounts) + ++m_subGroupsCounts[subgroup]; +} + +void Group::SubGroupCounterDecrease(uint8 subgroup) +{ + if (m_subGroupsCounts) + --m_subGroupsCounts[subgroup]; +} + +void Group::RemoveUniqueGroupMemberFlag(GroupMemberFlags flag) +{ + for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + if (itr->flags & flag) + itr->flags &= ~flag; +} + +void Group::ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply) +{ + if (apply) + slot->flags |= flag; + else + slot->flags &= ~flag; +}
\ No newline at end of file diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 64b61732c1b..924f39f67da 100755 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -19,13 +19,24 @@ #ifndef TRINITYCORE_GROUP_H #define TRINITYCORE_GROUP_H -#include "GroupReference.h" -#include "GroupRefManager.h" +#include "BattleGround.h" #include "DBCEnums.h" -#include "Battleground.h" +#include "GroupRefManager.h" +#include "LootMgr.h" +#include "QueryResult.h" +#include "SharedDefines.h" + +class Creature; +class GroupReference; +class InstanceSave; +class Map; +class Player; +class Unit; +class WorldObject; +class WorldPacket; +class WorldSession; -#include <map> -#include <vector> +struct MapEntry; #define MAXGROUPSIZE 5 #define MAXRAIDSIZE 40 @@ -34,11 +45,6 @@ #define GROUP_MAX_LFG_KICKS 3 #define GROUP_LFG_KICK_VOTES_NEEDED 3 -class InstanceSave; -class Player; -class Unit; -class WorldSession; - enum RollVote { PASS = 0, @@ -114,13 +120,6 @@ enum GroupUpdateFlags GROUP_UPDATE_FULL = 0x0007FFFF, // all known flags }; -enum RemoveMethod -{ - GROUP_REMOVEMETHOD_DEFAULT = 0, - GROUP_REMOVEMETHOD_KICK = 1, - GROUP_REMOVEMETHOD_LEAVE = 2, -}; - #define GROUP_UPDATE_FLAGS_COUNT 20 // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19 static const uint8 GroupUpdateLength[GROUP_UPDATE_FLAGS_COUNT] = { 0, 2, 2, 2, 1, 2, 2, 2, 2, 4, 8, 8, 1, 2, 2, 2, 1, 2, 2, 8}; @@ -128,12 +127,10 @@ static const uint8 GroupUpdateLength[GROUP_UPDATE_FLAGS_COUNT] = { 0, 2, 2, 2, 1 class Roll : public LootValidatorRef { public: - Roll(uint64 _guid, LootItem const& li) - : itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count), - totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0), rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT) {} - ~Roll() { } - void setLoot(Loot *pLoot) { link(pLoot, this); } - Loot *getLoot() { return getTarget(); } + Roll(uint64 _guid, LootItem const& li); + ~Roll(); + void setLoot(Loot *pLoot); + Loot *getLoot(); void targetObjectBuildLink(); uint64 itemGUID; @@ -198,156 +195,76 @@ class Group bool AddMember(const uint64 &guid, const char* name); uint32 RemoveMember(const uint64 &guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL); void ChangeLeader(const uint64 &guid); - void SetLootMethod(LootMethod method) { m_lootMethod = method; } - void SetLooterGuid(const uint64 &guid) { m_looterGuid = guid; } + void SetLootMethod(LootMethod method); + void SetLooterGuid(const uint64 &guid); void UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed = false); - void SetLootThreshold(ItemQualities threshold) { m_lootThreshold = threshold; } + void SetLootThreshold(ItemQualities threshold); void Disband(bool hideDestroy=false); // Dungeon Finder - void SetLfgQueued(bool queued) { m_LfgQueued = queued; } - bool isLfgQueued() { return m_LfgQueued; } - void SetLfgStatus(uint8 status) { m_LfgStatus = status; } - uint8 GetLfgStatus() { return m_LfgStatus; } - bool isLfgDungeonComplete() const { return m_LfgStatus == LFG_STATUS_COMPLETE; } - void SetLfgDungeonEntry(uint32 dungeonEntry) { m_LfgDungeonEntry = dungeonEntry; } - uint32 GetLfgDungeonEntry(bool id = true) - { - if (id) - return (m_LfgDungeonEntry & 0x00FFFFFF); - else - return m_LfgDungeonEntry; - } - bool isLfgKickActive() const { return m_LfgkicksActive; } - void SetLfgKickActive(bool active) { m_LfgkicksActive = active; } - uint8 GetLfgKicks() const { return m_Lfgkicks; } - void SetLfgKicks(uint8 kicks) { m_Lfgkicks = kicks; } - void SetLfgRoles(uint64 guid, const uint8 roles) - { - member_witerator slot = _getMemberWSlot(guid); - if (slot == m_memberSlots.end()) - return; - - slot->roles = roles; - SendUpdate(); - } + void SetLfgQueued(bool queued); + bool isLfgQueued(); + void SetLfgStatus(uint8 status); + uint8 GetLfgStatus(); + bool isLfgDungeonComplete() const; + void SetLfgDungeonEntry(uint32 dungeonEntry); + uint32 GetLfgDungeonEntry(bool id = true); + bool isLfgKickActive() const; + void SetLfgKickActive(bool active); + uint8 GetLfgKicks() const; + void SetLfgKicks(uint8 kicks); + void SetLfgRoles(uint64 guid, const uint8 roles); // properties accessories - bool IsFull() const { return isRaidGroup() ? (m_memberSlots.size() >= MAXRAIDSIZE) : (m_memberSlots.size() >= MAXGROUPSIZE); } - bool isLFGGroup() const { return m_groupType & GROUPTYPE_LFG; } - bool isRaidGroup() const { return m_groupType & GROUPTYPE_RAID; } - bool isBGGroup() const { return m_bgGroup != NULL; } - bool IsCreated() const { return GetMembersCount() > 0; } - const uint64& GetLeaderGUID() const { return m_leaderGuid; } - const uint64& GetGUID() const { return m_guid; } - uint32 GetLowGUID() const { return GUID_LOPART(m_guid); } - const char * GetLeaderName() const { return m_leaderName.c_str(); } - LootMethod GetLootMethod() const { return m_lootMethod; } - const uint64& GetLooterGuid() const { return m_looterGuid; } - ItemQualities GetLootThreshold() const { return m_lootThreshold; } + bool IsFull() const; + bool isLFGGroup() const; + bool isRaidGroup() const; + bool isBGGroup() const; + bool IsCreated() const; + const uint64& GetLeaderGUID() const; + const uint64& GetGUID() const; + uint32 GetLowGUID() const; + const char * GetLeaderName() const; + LootMethod GetLootMethod() const; + const uint64& GetLooterGuid() const; + ItemQualities GetLootThreshold() const; // member manipulation methods - bool IsMember(const uint64& guid) const { return _getMemberCSlot(guid) != m_memberSlots.end(); } - bool IsLeader(const uint64& guid) const { return (GetLeaderGUID() == guid); } - uint64 GetMemberGUID(const std::string& name) - { - for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) - { - if (itr->name == name) - { - return itr->guid; - } - } - return 0; - } - bool IsAssistant(uint64 guid) const - { - member_citerator mslot = _getMemberCSlot(guid); - if (mslot == m_memberSlots.end()) - return false; + bool IsMember(const uint64& guid) const; + bool IsLeader(const uint64& guid) const; + uint64 GetMemberGUID(const std::string& name); + bool IsAssistant(uint64 guid) const; - return mslot->flags & MEMBER_FLAG_ASSISTANT; - } Player* GetInvited(const uint64& guid) const; Player* GetInvited(const std::string& name) const; - bool SameSubGroup(uint64 guid1,const uint64& guid2) const - { - member_citerator mslot2 = _getMemberCSlot(guid2); - if (mslot2 == m_memberSlots.end()) - return false; - - return SameSubGroup(guid1,&*mslot2); - } - - bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const - { - member_citerator mslot1 = _getMemberCSlot(guid1); - if (mslot1 == m_memberSlots.end() || !slot2) - return false; - - return (mslot1->group == slot2->group); - } - - bool HasFreeSlotSubGroup(uint8 subgroup) const - { - return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE); - } - + bool SameSubGroup(uint64 guid1, const uint64& guid2) const; + bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const; bool SameSubGroup(Player const* member1, Player const* member2) const; + bool HasFreeSlotSubGroup(uint8 subgroup) const; - MemberSlotList const& GetMemberSlots() const { return m_memberSlots; } - GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); } - uint32 GetMembersCount() const { return m_memberSlots.size(); } + MemberSlotList const& GetMemberSlots() const; + GroupReference* GetFirstMember(); + uint32 GetMembersCount() const; void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level); - uint8 GetMemberGroup(uint64 guid) const - { - member_citerator mslot = _getMemberCSlot(guid); - if (mslot == m_memberSlots.end()) - return (MAX_RAID_SUBGROUPS+1); - - return mslot->group; - } + uint8 GetMemberGroup(uint64 guid) const; void ConvertToLFG(); - // some additional raid methods void ConvertToRaid(); - void SetBattlegroundGroup(Battleground *bg) { m_bgGroup = bg; } + void SetBattlegroundGroup(Battleground *bg); GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); void ChangeMembersGroup(const uint64 &guid, const uint8 &group); void ChangeMembersGroup(Player *player, const uint8 &group); - - void SetAssistant(uint64 guid, const bool &apply) - { - if (!isRaidGroup()) - return; - if (_setAssistantFlag(guid, apply)) - SendUpdate(); - } - void SetMainTank(uint64 guid, const bool &apply) - { - if (!isRaidGroup()) - return; - - if (_setMainTank(guid, apply)) - SendUpdate(); - } - void SetMainAssistant(uint64 guid, const bool &apply) - { - if (!isRaidGroup()) - return; - - if (_setMainAssistant(guid, apply)) - SendUpdate(); - } - + void SetAssistant(uint64 guid, const bool &apply); + void SetMainTank(uint64 guid, const bool &apply); + void SetMainAssistant(uint64 guid, const bool &apply); void SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid); - Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; } - Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; } - Difficulty GetRaidDifficulty() const { return m_raidDifficulty; } + Difficulty GetDifficulty(bool isRaid) const; + Difficulty GetDungeonDifficulty() const; + Difficulty GetRaidDifficulty() const; void SetDungeonDifficulty(Difficulty difficulty); void SetRaidDifficulty(Difficulty difficulty); uint16 InInstance(); @@ -368,7 +285,7 @@ class Group /*** LOOT SYSTEM ***/ /*********************************************************/ - bool isRollLootActive() const { return !RollId.empty(); } + bool isRollLootActive() const; void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r); void SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); void SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); @@ -377,18 +294,7 @@ class Group void GroupLoot(Loot *loot, WorldObject* pLootedObject); void NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject); void MasterLoot(Loot *loot, WorldObject* pLootedObject); - Rolls::iterator GetRoll(uint64 Guid) - { - Rolls::iterator iter; - for (iter=RollId.begin(); iter != RollId.end(); ++iter) - { - if ((*iter)->itemGUID == Guid && (*iter)->isValid()) - { - return iter; - } - } - return RollId.end(); - } + Rolls::iterator GetRoll(uint64 Guid); void CountTheRoll(Rolls::iterator roll, uint32 NumberOfPlayers); void CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 NumberOfPlayers, uint8 Choise); void EndRoll(Loot *loot); @@ -396,15 +302,15 @@ class Group // related to disenchant rolls void ResetMaxEnchantingLevel(); - void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); } - void DelinkMember(GroupReference* /*pRef*/) { } + void LinkMember(GroupReference *pRef); + void DelinkMember(GroupReference* /*pRef*/); InstanceGroupBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false); void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false); InstanceGroupBind* GetBoundInstance(Player* player); InstanceGroupBind* GetBoundInstance(Map* aMap); InstanceGroupBind* GetBoundInstance(MapEntry const* mapEntry); - BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; } + BoundInstancesMap& GetBoundInstances(Difficulty difficulty); // FG: evil hacks void BroadcastGroupUpdate(void); @@ -424,66 +330,13 @@ class Group void _homebindIfInstance(Player *player); - void _initRaidSubGroupsCounter() - { - // Sub group counters initialization - if (!m_subGroupsCounts) - m_subGroupsCounts = new uint8[MAX_RAID_SUBGROUPS]; - - memset((void*)m_subGroupsCounts, 0, (MAX_RAID_SUBGROUPS)*sizeof(uint8)); - - for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) - ++m_subGroupsCounts[itr->group]; - } - - member_citerator _getMemberCSlot(uint64 Guid) const - { - for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) - { - if (itr->guid == Guid) - return itr; - } - return m_memberSlots.end(); - } - - member_witerator _getMemberWSlot(uint64 Guid) - { - for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) - { - if (itr->guid == Guid) - return itr; - } - return m_memberSlots.end(); - } - - void SubGroupCounterIncrease(uint8 subgroup) - { - if (m_subGroupsCounts) - ++m_subGroupsCounts[subgroup]; - } - - void SubGroupCounterDecrease(uint8 subgroup) - { - if (m_subGroupsCounts) - --m_subGroupsCounts[subgroup]; - } - - void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag) - { - for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) - { - if (itr->flags & flag) - itr->flags &= ~flag; - } - } - - void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply) - { - if (apply) - slot->flags |= flag; - else - slot->flags &= ~flag; - } + void _initRaidSubGroupsCounter(); + member_citerator _getMemberCSlot(uint64 Guid) const; + member_witerator _getMemberWSlot(uint64 Guid); + void SubGroupCounterIncrease(uint8 subgroup); + void SubGroupCounterDecrease(uint8 subgroup); + void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag); + void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply); MemberSlotList m_memberSlots; GroupRefManager m_memberMgr; diff --git a/src/server/game/Groups/GroupReference.cpp b/src/server/game/Groups/GroupReference.cpp index b62581f1ac7..d06f05f8366 100755 --- a/src/server/game/Groups/GroupReference.cpp +++ b/src/server/game/Groups/GroupReference.cpp @@ -16,7 +16,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Player.h" #include "Group.h" #include "GroupReference.h" diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 55510cb735d..f25029765c1 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -24,6 +24,7 @@ #include "Util.h" #include "SharedDefines.h" #include "SpellMgr.h" +#include "Group.h" static Rates const qualityToRate[MAX_ITEM_QUALITY] = { RATE_DROP_ITEM_POOR, // ITEM_QUALITY_POOR diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 184e85b6c04..5e0ec7dd896 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -29,6 +29,7 @@ #include "ObjectAccessor.h" #include "MapManager.h" #include "ObjectMgr.h" +#include "Group.h" #define DEFAULT_GRID_EXPIRY 300 #define MAX_GRID_LOAD_TIME 50 diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 8e05e8aee97..217448f2953 100755 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -23,6 +23,7 @@ #include "VMapFactory.h" #include "InstanceSaveMgr.h" #include "World.h" +#include "Group.h" MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEON_DIFFICULTY_NORMAL) { diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index a71addd3469..2eca66f82d0 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -33,6 +33,7 @@ #include "ObjectMgr.h" #include "Language.h" #include "WorldPacket.h" +#include "Group.h" extern GridState* si_GridStates[]; // debugging code, should be deleted some day diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 24c84446698..a08e5a74cfd 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -2867,4 +2867,11 @@ enum XPColorChar XP_GRAY }; +enum RemoveMethod +{ + GROUP_REMOVEMETHOD_DEFAULT = 0, + GROUP_REMOVEMETHOD_KICK = 1, + GROUP_REMOVEMETHOD_LEAVE = 2, +}; + #endif diff --git a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp index fe98f6a0481..bf64f48c8b3 100755 --- a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp @@ -33,6 +33,7 @@ #include "Object.h" #include "Opcodes.h" #include "DisableMgr.h" +#include "Group.h" void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data) { diff --git a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp index be8d223507e..45dea6d98ce 100755 --- a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp @@ -20,6 +20,7 @@ #include "WorldPacket.h" #include "Player.h" #include "ObjectMgr.h" +#include "Group.h" void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet* lockSet) { diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index a2563486df3..b782c8ad4ee 100755 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -49,6 +49,7 @@ #include "InstanceScript.h" #include "LFGMgr.h" #include "GameObjectAI.h" +#include "Group.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { diff --git a/src/server/game/Server/Protocol/Handlers/PetHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetHandler.cpp index 8644f810604..080ec2d68ee 100755 --- a/src/server/game/Server/Protocol/Handlers/PetHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/PetHandler.cpp @@ -29,6 +29,7 @@ #include "Util.h" #include "Pet.h" #include "World.h" +#include "Group.h" void WorldSession::HandleDismissCritter(WorldPacket &recv_data) { diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 5ee1d25af91..cada62a684c 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ObjectMgr.h" #include "MapManager.h" #include "Chat.h" +#include "Group.h" class tele_commandscript : public CommandScript { diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 4c24bf39789..2efb151e925 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -32,6 +32,7 @@ EndContentData */ #include "ScriptPCH.h" #include "stratholme.h" +#include "Group.h" /*###### ## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist) diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index 4b7a207a838..1c89f5e733e 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -30,6 +30,7 @@ quest_a_pawn_on_the_eternal_pawn EndContentData */ #include "ScriptPCH.h" +#include "Group.h" /*### ## npc_highlord_demitrian diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 7424d9bdb94..ff406537c93 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -20,6 +20,7 @@ #include "ScriptedCreature.h" #include "SpellScript.h" #include "icecrown_citadel.h" +#include "Group.h" enum eScriptTexts { diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index a4883f84f74..66ccb80a3c2 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -43,6 +43,7 @@ EndContentData */ #include "ScriptPCH.h" #include "ScriptedEscortAI.h" +#include "Group.h" /*##### # mob_mature_netherwing_drake diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp index d95d9f84bb0..ab02793de84 100644 --- a/src/server/scripts/Outland/terokkar_forest.cpp +++ b/src/server/scripts/Outland/terokkar_forest.cpp @@ -35,6 +35,7 @@ EndContentData */ #include "ScriptPCH.h" #include "ScriptedEscortAI.h" +#include "Group.h" /*###### ## mob_unkor_the_ruthless diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp index a440f2d51c6..04202cc994d 100755 --- a/src/server/scripts/World/chat_log.cpp +++ b/src/server/scripts/World/chat_log.cpp @@ -18,6 +18,7 @@ #include "ScriptPCH.h" #include "Channel.h" #include "Guild.h" +#include "Group.h" class ChatLogScript : public PlayerScript { diff --git a/src/server/scripts/World/dungeon_finder.cpp b/src/server/scripts/World/dungeon_finder.cpp index b770ae2fed8..60a8ede4360 100644 --- a/src/server/scripts/World/dungeon_finder.cpp +++ b/src/server/scripts/World/dungeon_finder.cpp @@ -21,6 +21,7 @@ #include "ScriptPCH.h" #include "LFGMgr.h" +#include "Group.h" class DungeonFinderScript: public GroupScript, PlayerScript { |