Files
TCPlayerbotCore/src/server/game/Groups/Group.h
T

514 lines
20 KiB
C++
Raw Normal View History

2010-10-07 15:54:07 +02:00
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that 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/>.
2008-10-02 16:23:55 -05:00
*/
2009-10-17 15:51:44 -07:00
2008-10-14 11:57:03 -05:00
#ifndef TRINITYCORE_GROUP_H
#define TRINITYCORE_GROUP_H
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#include "GroupReference.h"
#include "GroupRefManager.h"
2009-12-17 11:11:54 +01:00
#include "DBCEnums.h"
#include "Battleground.h"
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#include <map>
#include <vector>
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#define MAXGROUPSIZE 5
#define MAXRAIDSIZE 40
#define MAX_RAID_SUBGROUPS MAXRAIDSIZE/MAXGROUPSIZE
2008-10-02 16:23:55 -05:00
#define TARGETICONCOUNT 8
2010-08-13 15:38:10 +02:00
#define GROUP_MAX_LFG_KICKS 3
#define GROUP_LFG_KICK_VOTES_NEEDED 3
2009-10-17 15:51:44 -07:00
class InstanceSave;
class Player;
class Unit;
class WorldSession;
2008-10-02 16:23:55 -05:00
enum RollVote
{
PASS = 0,
NEED = 1,
GREED = 2,
2010-02-14 19:13:14 -07:00
DISENCHANT = 3,
NOT_EMITED_YET = 4,
NOT_VALID = 5
2008-10-02 16:23:55 -05:00
};
2009-10-17 15:51:44 -07:00
2010-08-13 15:38:10 +02:00
enum LfgDungeonStatus
{
LFG_STATUS_SAVED = 0,
LFG_STATUS_NOT_SAVED = 1,
LFG_STATUS_COMPLETE = 2,
};
2008-10-02 16:23:55 -05:00
enum GroupMemberOnlineStatus
{
MEMBER_STATUS_OFFLINE = 0x0000,
MEMBER_STATUS_ONLINE = 0x0001,
MEMBER_STATUS_PVP = 0x0002,
MEMBER_STATUS_UNK0 = 0x0004, // dead? (health=0)
MEMBER_STATUS_UNK1 = 0x0008, // ghost? (health=1)
MEMBER_STATUS_UNK2 = 0x0010, // never seen
MEMBER_STATUS_UNK3 = 0x0020, // never seen
MEMBER_STATUS_UNK4 = 0x0040, // appears with dead and ghost flags
MEMBER_STATUS_UNK5 = 0x0080, // never seen
};
2009-10-17 15:51:44 -07:00
enum GroupMemberFlags
{
2010-03-09 20:33:59 +01:00
MEMBER_FLAG_ASSISTANT = 0x01,
MEMBER_FLAG_MAINTANK = 0x02,
MEMBER_FLAG_MAINASSIST = 0x04,
};
2008-10-02 16:23:55 -05:00
enum GroupType
{
2010-02-14 19:13:14 -07:00
GROUPTYPE_NORMAL = 0x00,
GROUPTYPE_BG = 0x01,
GROUPTYPE_RAID = 0x02,
GROUPTYPE_BGRAID = GROUPTYPE_BG | GROUPTYPE_RAID, // mask
2010-08-11 15:20:20 +02:00
GROUPTYPE_UNK1 = 0x04,
GROUPTYPE_LFG = 0x08,
2010-02-14 19:13:14 -07:00
// 0x10, leave/change group?, I saw this flag when leaving group and after leaving BG while in group
2008-10-02 16:23:55 -05:00
};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
enum GroupUpdateFlags
{
GROUP_UPDATE_FLAG_NONE = 0x00000000, // nothing
GROUP_UPDATE_FLAG_STATUS = 0x00000001, // uint16, flags
GROUP_UPDATE_FLAG_CUR_HP = 0x00000002, // uint32
GROUP_UPDATE_FLAG_MAX_HP = 0x00000004, // uint32
2008-10-02 16:23:55 -05:00
GROUP_UPDATE_FLAG_POWER_TYPE = 0x00000008, // uint8
GROUP_UPDATE_FLAG_CUR_POWER = 0x00000010, // uint16
GROUP_UPDATE_FLAG_MAX_POWER = 0x00000020, // uint16
GROUP_UPDATE_FLAG_LEVEL = 0x00000040, // uint16
GROUP_UPDATE_FLAG_ZONE = 0x00000080, // uint16
GROUP_UPDATE_FLAG_POSITION = 0x00000100, // uint16, uint16
GROUP_UPDATE_FLAG_AURAS = 0x00000200, // uint64 mask, for each bit set uint32 spellid + uint8 unk
2008-10-02 16:23:55 -05:00
GROUP_UPDATE_FLAG_PET_GUID = 0x00000400, // uint64 pet guid
GROUP_UPDATE_FLAG_PET_NAME = 0x00000800, // pet name, NULL terminated string
GROUP_UPDATE_FLAG_PET_MODEL_ID = 0x00001000, // uint16, model id
GROUP_UPDATE_FLAG_PET_CUR_HP = 0x00002000, // uint32 pet cur health
GROUP_UPDATE_FLAG_PET_MAX_HP = 0x00004000, // uint32 pet max health
2008-10-02 16:23:55 -05:00
GROUP_UPDATE_FLAG_PET_POWER_TYPE = 0x00008000, // uint8 pet power type
GROUP_UPDATE_FLAG_PET_CUR_POWER = 0x00010000, // uint16 pet cur power
GROUP_UPDATE_FLAG_PET_MAX_POWER = 0x00020000, // uint16 pet max power
GROUP_UPDATE_FLAG_PET_AURAS = 0x00040000, // uint64 mask, for each bit set uint32 spellid + uint8 unk, pet auras...
GROUP_UPDATE_FLAG_VEHICLE_SEAT = 0x00080000, // uint32 vehicle_seat_id (index from VehicleSeat.dbc)
2008-10-02 16:23:55 -05:00
GROUP_UPDATE_PET = 0x0007FC00, // all pet flags
GROUP_UPDATE_FULL = 0x0007FFFF, // all known flags
};
2009-10-17 15:51:44 -07:00
enum RemoveMethod
{
GROUP_REMOVEMETHOD_DEFAULT = 0,
GROUP_REMOVEMETHOD_KICK = 1,
GROUP_REMOVEMETHOD_LEAVE = 2,
};
2008-10-02 16:23:55 -05:00
#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};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
class Roll : public LootValidatorRef
{
public:
Roll(uint64 _guid, LootItem const& li)
2009-12-17 11:11:54 +01:00
: 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) {}
2008-10-02 16:23:55 -05:00
~Roll() { }
void setLoot(Loot *pLoot) { link(pLoot, this); }
Loot *getLoot() { return getTarget(); }
void targetObjectBuildLink();
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
uint64 itemGUID;
uint32 itemid;
int32 itemRandomPropId;
uint32 itemRandomSuffix;
2009-12-17 11:11:54 +01:00
uint8 itemCount;
2008-10-02 16:23:55 -05:00
typedef std::map<uint64, RollVote> PlayerVote;
PlayerVote playerVote; //vote position correspond with player position (in group)
uint8 totalPlayersRolling;
uint8 totalNeed;
uint8 totalGreed;
uint8 totalPass;
uint8 itemSlot;
uint8 rollVoteMask;
2008-10-02 16:23:55 -05:00
};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
struct InstanceGroupBind
{
InstanceSave *save;
bool perm;
/* permanent InstanceGroupBinds exist if the leader has a permanent
2008-10-02 16:23:55 -05:00
PlayerInstanceBind for the same instance. */
InstanceGroupBind() : save(NULL), perm(false) {}
};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
/** request member stats checken **/
/** todo: uninvite people that not accepted invite **/
2010-02-05 00:31:28 +01:00
class Group
2008-10-02 16:23:55 -05:00
{
public:
struct MemberSlot
{
uint64 guid;
std::string name;
uint8 group;
uint8 flags;
2010-08-11 15:20:20 +02:00
uint8 roles;
2008-10-02 16:23:55 -05:00
};
typedef std::list<MemberSlot> MemberSlotList;
typedef MemberSlotList::const_iterator member_citerator;
2009-10-17 15:51:44 -07:00
typedef UNORDERED_MAP< uint32 /*mapId*/, InstanceGroupBind> BoundInstancesMap;
2008-10-02 16:23:55 -05:00
protected:
typedef MemberSlotList::iterator member_witerator;
2008-12-12 11:21:28 -06:00
typedef std::set<Player*> InvitesList;
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
typedef std::vector<Roll*> Rolls;
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
public:
Group();
~Group();
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
// group manipulation methods
bool Create(const uint64 &guid, const char * name);
2010-09-11 21:10:54 +02:00
bool LoadGroupFromDB(const uint32 &guid, QueryResult result, bool loadMembers = true);
2010-09-10 13:40:20 +02:00
bool LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles);
2008-10-02 16:23:55 -05:00
bool AddInvite(Player *player);
uint32 RemoveInvite(Player *player);
void RemoveAllInvites();
bool AddLeaderInvite(Player *player);
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);
2008-10-02 16:23:55 -05:00
void ChangeLeader(const uint64 &guid);
void SetLootMethod(LootMethod method) { m_lootMethod = method; }
void SetLooterGuid(const uint64 &guid) { m_looterGuid = guid; }
void UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed = false);
2008-10-02 16:23:55 -05:00
void SetLootThreshold(ItemQualities threshold) { m_lootThreshold = threshold; }
void Disband(bool hideDestroy=false);
2009-10-17 15:51:44 -07:00
2010-08-13 15:38:10 +02:00
// Dungeon Finder
2010-08-11 15:20:20 +02:00
void SetLfgQueued(bool queued) { m_LfgQueued = queued; }
bool isLfgQueued() { return m_LfgQueued; }
void SetLfgStatus(uint8 status) { m_LfgStatus = status; }
uint8 GetLfgStatus() { return m_LfgStatus; }
2010-08-13 15:38:10 +02:00
bool isLfgDungeonComplete() const { return m_LfgStatus == LFG_STATUS_COMPLETE; }
2010-08-11 15:20:20 +02:00
void SetLfgDungeonEntry(uint32 dungeonEntry) { m_LfgDungeonEntry = dungeonEntry; }
uint32 GetLfgDungeonEntry(bool id = true)
{
if (id)
return (m_LfgDungeonEntry & 0x00FFFFFF);
else
return m_LfgDungeonEntry;
}
2010-08-13 15:38:10 +02:00
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)
2010-08-11 15:20:20 +02:00
{
member_witerator slot = _getMemberWSlot(guid);
if (slot == m_memberSlots.end())
return;
slot->roles = roles;
SendUpdate();
}
2010-08-13 15:38:10 +02:00
2008-10-02 16:23:55 -05:00
// properties accessories
bool IsFull() const { return isRaidGroup() ? (m_memberSlots.size() >= MAXRAIDSIZE) : (m_memberSlots.size() >= MAXGROUPSIZE); }
2010-08-11 15:20:20 +02:00
bool isLFGGroup() const { return m_groupType & GROUPTYPE_LFG; }
bool isRaidGroup() const { return m_groupType & GROUPTYPE_RAID; }
2008-10-02 16:23:55 -05:00
bool isBGGroup() const { return m_bgGroup != NULL; }
bool IsCreated() const { return GetMembersCount() > 0; }
const uint64& GetLeaderGUID() const { return m_leaderGuid; }
2010-05-08 01:58:47 +02:00
const uint64& GetGUID() const { return m_guid; }
2010-08-24 14:44:56 +02:00
uint32 GetLowGUID() const { return GUID_LOPART(m_guid); }
2008-10-02 16:23:55 -05:00
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; }
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
// member manipulation methods
bool IsMember(const uint64& guid) const { return _getMemberCSlot(guid) != m_memberSlots.end(); }
2008-12-12 11:21:28 -06:00
bool IsLeader(const uint64& guid) const { return (GetLeaderGUID() == guid); }
uint64 GetMemberGUID(const std::string& name)
{
2009-10-17 16:20:24 -07:00
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2008-12-12 11:21:28 -06:00
{
2010-04-07 19:14:10 +02:00
if (itr->name == name)
2008-12-12 11:21:28 -06:00
{
return itr->guid;
}
}
return 0;
}
2008-10-02 16:23:55 -05:00
bool IsAssistant(uint64 guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
2010-04-07 23:25:02 +02:00
if (mslot == m_memberSlots.end())
2008-10-02 16:23:55 -05:00
return false;
2009-10-17 15:51:44 -07:00
return mslot->flags & MEMBER_FLAG_ASSISTANT;
2008-10-02 16:23:55 -05:00
}
2008-12-12 11:21:28 -06:00
Player* GetInvited(const uint64& guid) const;
Player* GetInvited(const std::string& name) const;
2009-10-17 15:51:44 -07:00
bool SameSubGroup(uint64 guid1,const uint64& guid2) const
2008-10-02 16:23:55 -05:00
{
member_citerator mslot2 = _getMemberCSlot(guid2);
2010-04-07 23:25:02 +02:00
if (mslot2 == m_memberSlots.end())
2008-10-02 16:23:55 -05:00
return false;
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
return SameSubGroup(guid1,&*mslot2);
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const
{
member_citerator mslot1 = _getMemberCSlot(guid1);
2010-04-07 23:25:02 +02:00
if (mslot1 == m_memberSlots.end() || !slot2)
2008-10-02 16:23:55 -05:00
return false;
2009-10-17 15:51:44 -07:00
2010-04-07 23:25:02 +02:00
return (mslot1->group == slot2->group);
2008-10-02 16:23:55 -05:00
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
bool HasFreeSlotSubGroup(uint8 subgroup) const
{
return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE);
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
bool SameSubGroup(Player const* member1, Player const* member2) const;
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
MemberSlotList const& GetMemberSlots() const { return m_memberSlots; }
GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); }
uint32 GetMembersCount() const { return m_memberSlots.size(); }
void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level);
2008-10-02 16:23:55 -05:00
uint8 GetMemberGroup(uint64 guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
2010-04-07 23:25:02 +02:00
if (mslot == m_memberSlots.end())
return (MAX_RAID_SUBGROUPS+1);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
return mslot->group;
}
2009-10-17 15:51:44 -07:00
2010-08-11 15:20:20 +02:00
void ConvertToLFG();
2008-10-02 16:23:55 -05:00
// some additional raid methods
void ConvertToRaid();
2009-10-17 15:51:44 -07:00
2010-08-08 04:37:24 +02:00
void SetBattlegroundGroup(Battleground *bg) { m_bgGroup = bg; }
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
void ChangeMembersGroup(const uint64 &guid, const uint8 &group);
void ChangeMembersGroup(Player *player, const uint8 &group);
2009-10-17 15:51:44 -07:00
void SetAssistant(uint64 guid, const bool &apply)
2008-10-02 16:23:55 -05:00
{
2010-04-07 19:14:10 +02:00
if (!isRaidGroup())
2008-10-02 16:23:55 -05:00
return;
2010-04-07 19:14:10 +02:00
if (_setAssistantFlag(guid, apply))
2008-10-02 16:23:55 -05:00
SendUpdate();
}
void SetMainTank(uint64 guid, const bool &apply)
2008-10-02 16:23:55 -05:00
{
2010-04-07 19:14:10 +02:00
if (!isRaidGroup())
2008-10-02 16:23:55 -05:00
return;
2009-10-17 15:51:44 -07:00
2010-04-07 19:14:10 +02:00
if (_setMainTank(guid, apply))
2008-10-02 16:23:55 -05:00
SendUpdate();
}
void SetMainAssistant(uint64 guid, const bool &apply)
2008-10-02 16:23:55 -05:00
{
2010-04-07 19:14:10 +02:00
if (!isRaidGroup())
2008-10-02 16:23:55 -05:00
return;
2009-10-17 15:51:44 -07:00
2010-04-07 19:14:10 +02:00
if (_setMainAssistant(guid, apply))
2008-10-02 16:23:55 -05:00
SendUpdate();
}
2009-10-17 15:51:44 -07:00
2010-02-14 19:13:14 -07:00
void SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid);
2009-12-17 11:11:54 +01:00
Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; }
Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; }
Difficulty GetRaidDifficulty() const { return m_raidDifficulty; }
void SetDungeonDifficulty(Difficulty difficulty);
void SetRaidDifficulty(Difficulty difficulty);
2008-10-02 16:23:55 -05:00
uint16 InInstance();
bool InCombatToInstance(uint32 instanceId);
2009-12-17 11:11:54 +01:00
void ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
// -no description-
//void SendInit(WorldSession *session);
void SendTargetIconList(WorldSession *session);
void SendUpdate();
void UpdatePlayerOutOfRange(Player* pPlayer);
// ignore: GUID of player that will be ignored
void BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int group=-1, uint64 ignore=0);
2008-10-02 16:23:55 -05:00
void BroadcastReadyCheck(WorldPacket *packet);
void OfflineReadyCheck();
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
/*********************************************************/
/*** LOOT SYSTEM ***/
/*********************************************************/
2009-10-17 15:51:44 -07:00
2010-08-13 15:38:10 +02:00
bool isRollLootActive() const { return !RollId.empty(); }
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);
2008-10-02 16:23:55 -05:00
void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r);
void SendLooter(Creature *pCreature, Player *pLooter);
2010-04-11 14:25:02 +04:00
void GroupLoot(Loot *loot, WorldObject* pLootedObject);
void NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject);
void MasterLoot(Loot *loot, WorldObject* pLootedObject);
2008-10-02 16:23:55 -05:00
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();
}
void CountTheRoll(Rolls::iterator roll, uint32 NumberOfPlayers);
void CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 NumberOfPlayers, uint8 Choise);
void EndRoll(Loot *loot);
2009-10-17 15:51:44 -07:00
// related to disenchant rolls
void ResetMaxEnchantingLevel();
2008-10-02 16:23:55 -05:00
void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); }
2010-04-07 22:59:46 +02:00
void DelinkMember(GroupReference* /*pRef*/) { }
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
InstanceGroupBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false);
void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false);
2009-12-17 11:11:54 +01:00
InstanceGroupBind* GetBoundInstance(Player* player);
InstanceGroupBind* GetBoundInstance(Map* aMap);
InstanceGroupBind* GetBoundInstance(MapEntry const* mapEntry);
2009-12-17 11:11:54 +01:00
BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
2009-10-17 15:51:44 -07:00
2009-01-15 21:29:32 -05:00
// FG: evil hacks
void BroadcastGroupUpdate(void);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
protected:
bool _addMember(const uint64 &guid, const char* name);
bool _addMember(const uint64 &guid, const char* name, uint8 group);
2008-10-02 16:23:55 -05:00
bool _removeMember(const uint64 &guid); // returns true if leader has changed
void _setLeader(const uint64 &guid);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
void _removeRolls(const uint64 &guid);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
bool _setMembersGroup(const uint64 &guid, const uint8 &group);
bool _setAssistantFlag(const uint64 &guid, const bool &apply);
bool _setMainTank(const uint64 &guid, const bool &apply);
bool _setMainAssistant(const uint64 &guid, const bool &apply);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
void _homebindIfInstance(Player *player);
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void _initRaidSubGroupsCounter()
{
// Sub group counters initialization
if (!m_subGroupsCounts)
m_subGroupsCounts = new uint8[MAX_RAID_SUBGROUPS];
2009-10-17 15:51:44 -07:00
memset((void*)m_subGroupsCounts, 0, (MAX_RAID_SUBGROUPS)*sizeof(uint8));
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
++m_subGroupsCounts[itr->group];
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
member_citerator _getMemberCSlot(uint64 Guid) const
{
2009-10-17 16:20:24 -07:00
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2008-10-02 16:23:55 -05:00
{
if (itr->guid == Guid)
return itr;
}
return m_memberSlots.end();
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
member_witerator _getMemberWSlot(uint64 Guid)
{
2009-10-17 16:20:24 -07:00
for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
2008-10-02 16:23:55 -05:00
{
if (itr->guid == Guid)
return itr;
}
return m_memberSlots.end();
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void SubGroupCounterIncrease(uint8 subgroup)
{
if (m_subGroupsCounts)
++m_subGroupsCounts[subgroup];
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void SubGroupCounterDecrease(uint8 subgroup)
{
if (m_subGroupsCounts)
--m_subGroupsCounts[subgroup];
}
2010-02-14 19:13:14 -07:00
void RemoveUniqueGroupMemberFlag(GroupMemberFlags flag)
{
for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
{
if (itr->flags & flag)
2009-12-23 11:46:23 +01:00
itr->flags &= ~flag;
}
}
2010-02-14 19:13:14 -07:00
void ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
{
if (apply)
slot->flags |= flag;
else
slot->flags &= ~flag;
2010-02-14 19:13:14 -07:00
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
MemberSlotList m_memberSlots;
GroupRefManager m_memberMgr;
InvitesList m_invitees;
uint64 m_leaderGuid;
std::string m_leaderName;
GroupType m_groupType;
2009-12-17 11:11:54 +01:00
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
2010-08-08 04:37:24 +02:00
Battleground* m_bgGroup;
2008-10-02 16:23:55 -05:00
uint64 m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
uint64 m_looterGuid;
Rolls RollId;
2009-12-17 11:11:54 +01:00
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
2009-02-09 08:16:34 -05:00
uint8* m_subGroupsCounts;
2010-05-08 01:58:47 +02:00
uint64 m_guid;
uint32 m_counter; // used only in SMSG_GROUP_LIST
uint32 m_maxEnchantingLevel;
2010-08-11 15:20:20 +02:00
bool m_LfgQueued;
uint8 m_LfgStatus;
uint32 m_LfgDungeonEntry;
2010-08-13 15:38:10 +02:00
uint8 m_Lfgkicks;
bool m_LfgkicksActive;
2008-10-02 16:23:55 -05:00
};
#endif