mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
converted all tabs to 4 spaces
This commit is contained in:
@@ -110,93 +110,93 @@ typedef std::map<uint64, uint64> LfgGroupsMap;
|
||||
class Lfg5Guids
|
||||
{
|
||||
public:
|
||||
uint64 guid[5];
|
||||
LfgRolesMap* roles;
|
||||
Lfg5Guids() { memset(&guid, 0, 5*8); roles = NULL; }
|
||||
Lfg5Guids(uint64 g) { memset(&guid, 0, 5*8); guid[0] = g; roles = NULL; }
|
||||
Lfg5Guids(Lfg5Guids const& x) { memcpy(guid, x.guid, 5*8); if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; }
|
||||
Lfg5Guids(Lfg5Guids const& x, bool copyRoles) { memcpy(guid, x.guid, 5*8); roles = NULL; }
|
||||
~Lfg5Guids() { delete roles; }
|
||||
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
|
||||
void clear() { memset(&guid, 0, 5*8); }
|
||||
bool empty() const { return guid[0] == 0; }
|
||||
uint64 front() const { return guid[0]; }
|
||||
uint8 size() const
|
||||
{
|
||||
if (guid[2])
|
||||
{
|
||||
if (guid[4]) return 5;
|
||||
else if (guid[3]) return 4;
|
||||
return 3;
|
||||
}
|
||||
else if (guid[1]) return 2;
|
||||
else if (guid[0]) return 1;
|
||||
return 0;
|
||||
}
|
||||
void insert(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == 0) { guid[0] = g; return; }
|
||||
else if (g <= guid[0]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g; return; }
|
||||
if (guid[1] == 0) { guid[1] = g; return; }
|
||||
else if (g <= guid[1]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; guid[2] = guid[1]; guid[1] = g; return; }
|
||||
if (guid[2] == 0) { guid[2] = g; return; }
|
||||
else if (g <= guid[2]) { if (guid[3]) guid[4] = guid[3]; guid[3] = guid[2]; guid[2] = g; return; }
|
||||
if (guid[3] == 0) { guid[3] = g; return; }
|
||||
else if (g <= guid[3]) { guid[4] = guid[3]; guid[3] = g; return; }
|
||||
guid[4] = g;
|
||||
}
|
||||
void force_insert_front(const uint64& g)
|
||||
{
|
||||
if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g;
|
||||
}
|
||||
void remove(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == g) { if (guid[1]) guid[0] = guid[1]; else { guid[0] = 0; return; } if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
|
||||
if (guid[1] == g) { if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
|
||||
if (guid[2] == g) { if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
|
||||
if (guid[3] == g) { if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
|
||||
if (guid[4] == g) guid[4] = 0;
|
||||
}
|
||||
bool hasGuid(const uint64& g) const
|
||||
{
|
||||
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
|
||||
}
|
||||
bool operator<(const Lfg5Guids& x) const
|
||||
{
|
||||
// not neat, but fast xD
|
||||
if (guid[0]<=x.guid[0]) {
|
||||
if (guid[0] == x.guid[0]) {
|
||||
if (guid[1]<=x.guid[1]) {
|
||||
if (guid[1] == x.guid[1]) {
|
||||
if (guid[2]<=x.guid[2]) {
|
||||
if (guid[2] == x.guid[2]) {
|
||||
if (guid[3]<=x.guid[3]) {
|
||||
if (guid[3] == x.guid[3]) {
|
||||
if (guid[4]<=x.guid[4]) {
|
||||
if (guid[4] == x.guid[4]) return false; else return true;
|
||||
} else return false;
|
||||
} else return true;
|
||||
} else return false;
|
||||
} else return true;
|
||||
} else return false;
|
||||
} else return true;
|
||||
} else return false;
|
||||
} else return true;
|
||||
} else return false;
|
||||
}
|
||||
bool operator==(const Lfg5Guids& x) const
|
||||
{
|
||||
return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4];
|
||||
}
|
||||
void operator=(const Lfg5Guids& x) { memcpy(guid, x.guid, 5*8); delete roles; if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; }
|
||||
std::string toString() const // for debugging
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0);
|
||||
return o.str();
|
||||
}
|
||||
uint64 guid[5];
|
||||
LfgRolesMap* roles;
|
||||
Lfg5Guids() { memset(&guid, 0, 5*8); roles = NULL; }
|
||||
Lfg5Guids(uint64 g) { memset(&guid, 0, 5*8); guid[0] = g; roles = NULL; }
|
||||
Lfg5Guids(Lfg5Guids const& x) { memcpy(guid, x.guid, 5*8); if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; }
|
||||
Lfg5Guids(Lfg5Guids const& x, bool copyRoles) { memcpy(guid, x.guid, 5*8); roles = NULL; }
|
||||
~Lfg5Guids() { delete roles; }
|
||||
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
|
||||
void clear() { memset(&guid, 0, 5*8); }
|
||||
bool empty() const { return guid[0] == 0; }
|
||||
uint64 front() const { return guid[0]; }
|
||||
uint8 size() const
|
||||
{
|
||||
if (guid[2])
|
||||
{
|
||||
if (guid[4]) return 5;
|
||||
else if (guid[3]) return 4;
|
||||
return 3;
|
||||
}
|
||||
else if (guid[1]) return 2;
|
||||
else if (guid[0]) return 1;
|
||||
return 0;
|
||||
}
|
||||
void insert(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == 0) { guid[0] = g; return; }
|
||||
else if (g <= guid[0]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g; return; }
|
||||
if (guid[1] == 0) { guid[1] = g; return; }
|
||||
else if (g <= guid[1]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; guid[2] = guid[1]; guid[1] = g; return; }
|
||||
if (guid[2] == 0) { guid[2] = g; return; }
|
||||
else if (g <= guid[2]) { if (guid[3]) guid[4] = guid[3]; guid[3] = guid[2]; guid[2] = g; return; }
|
||||
if (guid[3] == 0) { guid[3] = g; return; }
|
||||
else if (g <= guid[3]) { guid[4] = guid[3]; guid[3] = g; return; }
|
||||
guid[4] = g;
|
||||
}
|
||||
void force_insert_front(const uint64& g)
|
||||
{
|
||||
if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g;
|
||||
}
|
||||
void remove(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == g) { if (guid[1]) guid[0] = guid[1]; else { guid[0] = 0; return; } if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
|
||||
if (guid[1] == g) { if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
|
||||
if (guid[2] == g) { if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
|
||||
if (guid[3] == g) { if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
|
||||
if (guid[4] == g) guid[4] = 0;
|
||||
}
|
||||
bool hasGuid(const uint64& g) const
|
||||
{
|
||||
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
|
||||
}
|
||||
bool operator<(const Lfg5Guids& x) const
|
||||
{
|
||||
// not neat, but fast xD
|
||||
if (guid[0]<=x.guid[0]) {
|
||||
if (guid[0] == x.guid[0]) {
|
||||
if (guid[1]<=x.guid[1]) {
|
||||
if (guid[1] == x.guid[1]) {
|
||||
if (guid[2]<=x.guid[2]) {
|
||||
if (guid[2] == x.guid[2]) {
|
||||
if (guid[3]<=x.guid[3]) {
|
||||
if (guid[3] == x.guid[3]) {
|
||||
if (guid[4]<=x.guid[4]) {
|
||||
if (guid[4] == x.guid[4]) return false; else return true;
|
||||
} else return false;
|
||||
} else return true;
|
||||
} else return false;
|
||||
} else return true;
|
||||
} else return false;
|
||||
} else return true;
|
||||
} else return false;
|
||||
} else return true;
|
||||
} else return false;
|
||||
}
|
||||
bool operator==(const Lfg5Guids& x) const
|
||||
{
|
||||
return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4];
|
||||
}
|
||||
void operator=(const Lfg5Guids& x) { memcpy(guid, x.guid, 5*8); delete roles; if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; }
|
||||
std::string toString() const // for debugging
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0);
|
||||
return o.str();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -140,86 +140,86 @@ enum LfgUpdateFlag // pussywizard: for raid browser
|
||||
|
||||
struct RBEntryInfo
|
||||
{
|
||||
RBEntryInfo() {}
|
||||
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
|
||||
uint8 roles;
|
||||
std::string comment;
|
||||
RBEntryInfo() {}
|
||||
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
|
||||
uint8 roles;
|
||||
std::string comment;
|
||||
};
|
||||
|
||||
struct RBInternalInfo
|
||||
{
|
||||
uint64 guid;
|
||||
std::string comment;
|
||||
bool isGroupLeader;
|
||||
uint64 groupGuid;
|
||||
uint8 roles;
|
||||
uint32 encounterMask;
|
||||
uint64 instanceGuid;
|
||||
uint64 guid;
|
||||
std::string comment;
|
||||
bool isGroupLeader;
|
||||
uint64 groupGuid;
|
||||
uint8 roles;
|
||||
uint32 encounterMask;
|
||||
uint64 instanceGuid;
|
||||
|
||||
// additional character info parameters:
|
||||
uint8 _online;
|
||||
uint8 _level;
|
||||
uint8 _class;
|
||||
uint8 _race;
|
||||
float _avgItemLevel;
|
||||
// --
|
||||
uint8 _talents0;
|
||||
uint8 _talents1;
|
||||
uint8 _talents2;
|
||||
uint32 _area;
|
||||
uint32 _armor;
|
||||
uint32 _spellDamage;
|
||||
uint32 _spellHeal;
|
||||
// --
|
||||
uint32 _critRatingMelee;
|
||||
uint32 _critRatingRanged;
|
||||
uint32 _critRatingSpell;
|
||||
float _mp5;
|
||||
float _mp5combat;
|
||||
// --
|
||||
uint32 _attackPower;
|
||||
uint32 _agility;
|
||||
uint32 _health;
|
||||
uint32 _mana;
|
||||
uint32 _defenseSkill;
|
||||
// --
|
||||
uint32 _dodgeRating;
|
||||
uint32 _blockRating;
|
||||
uint32 _parryRating;
|
||||
uint32 _hasteRating;
|
||||
uint32 _expertiseRating;
|
||||
// additional character info parameters:
|
||||
uint8 _online;
|
||||
uint8 _level;
|
||||
uint8 _class;
|
||||
uint8 _race;
|
||||
float _avgItemLevel;
|
||||
// --
|
||||
uint8 _talents0;
|
||||
uint8 _talents1;
|
||||
uint8 _talents2;
|
||||
uint32 _area;
|
||||
uint32 _armor;
|
||||
uint32 _spellDamage;
|
||||
uint32 _spellHeal;
|
||||
// --
|
||||
uint32 _critRatingMelee;
|
||||
uint32 _critRatingRanged;
|
||||
uint32 _critRatingSpell;
|
||||
float _mp5;
|
||||
float _mp5combat;
|
||||
// --
|
||||
uint32 _attackPower;
|
||||
uint32 _agility;
|
||||
uint32 _health;
|
||||
uint32 _mana;
|
||||
uint32 _defenseSkill;
|
||||
// --
|
||||
uint32 _dodgeRating;
|
||||
uint32 _blockRating;
|
||||
uint32 _parryRating;
|
||||
uint32 _hasteRating;
|
||||
uint32 _expertiseRating;
|
||||
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid,
|
||||
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
|
||||
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
|
||||
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
|
||||
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
|
||||
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
|
||||
: guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
|
||||
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
|
||||
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
|
||||
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
|
||||
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
|
||||
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
|
||||
{}
|
||||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel-i._avgItemLevel) < 0.01f
|
||||
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5-i._mp5) < 0.01f && fabs(_mp5combat-i._mp5combat) < 0.01f
|
||||
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
|
||||
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
|
||||
}
|
||||
void CopyStats(RBInternalInfo const& i)
|
||||
{
|
||||
_avgItemLevel = i._avgItemLevel;
|
||||
_talents0 = i._talents0; _talents1 = i._talents1; _talents2 = i._talents2; _area = i._area; _armor = i._armor; _spellDamage = i._spellDamage; _spellHeal = i._spellHeal;
|
||||
_critRatingMelee = i._critRatingMelee; _critRatingRanged = i._critRatingRanged; _critRatingSpell = i._critRatingSpell; _mp5 = i._mp5; _mp5combat = i._mp5combat;
|
||||
_attackPower = i._attackPower; _agility = i._agility; _health = i._health; _mana = i._mana; _defenseSkill = i._defenseSkill;
|
||||
_dodgeRating = i._dodgeRating; _blockRating = i._blockRating; _parryRating = i._parryRating; _hasteRating = i._hasteRating; _expertiseRating = i._expertiseRating;
|
||||
}
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid,
|
||||
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
|
||||
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
|
||||
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
|
||||
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
|
||||
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
|
||||
: guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
|
||||
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
|
||||
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
|
||||
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
|
||||
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
|
||||
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
|
||||
{}
|
||||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel-i._avgItemLevel) < 0.01f
|
||||
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5-i._mp5) < 0.01f && fabs(_mp5combat-i._mp5combat) < 0.01f
|
||||
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
|
||||
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
|
||||
}
|
||||
void CopyStats(RBInternalInfo const& i)
|
||||
{
|
||||
_avgItemLevel = i._avgItemLevel;
|
||||
_talents0 = i._talents0; _talents1 = i._talents1; _talents2 = i._talents2; _area = i._area; _armor = i._armor; _spellDamage = i._spellDamage; _spellHeal = i._spellHeal;
|
||||
_critRatingMelee = i._critRatingMelee; _critRatingRanged = i._critRatingRanged; _critRatingSpell = i._critRatingSpell; _mp5 = i._mp5; _mp5combat = i._mp5combat;
|
||||
_attackPower = i._attackPower; _agility = i._agility; _health = i._health; _mana = i._mana; _defenseSkill = i._defenseSkill;
|
||||
_dodgeRating = i._dodgeRating; _blockRating = i._blockRating; _parryRating = i._parryRating; _hasteRating = i._hasteRating; _expertiseRating = i._expertiseRating;
|
||||
}
|
||||
};
|
||||
|
||||
// Forward declaration (just to have all typedef together)
|
||||
@@ -395,20 +395,20 @@ class LFGMgr
|
||||
LFGMgr();
|
||||
~LFGMgr();
|
||||
|
||||
// pussywizard: RAIDBROWSER
|
||||
typedef UNORDERED_MAP<uint32 /*playerGuidLow*/, RBEntryInfo> RBEntryInfoMap;
|
||||
typedef UNORDERED_MAP<uint32 /*dungeonId*/, RBEntryInfoMap> RBStoreMap;
|
||||
RBStoreMap RaidBrowserStore[2]; // for 2 factions
|
||||
typedef UNORDERED_MAP<uint32 /*playerGuidLow*/, uint32 /*dungeonId*/> RBSearchersMap;
|
||||
RBSearchersMap RBSearchersStore[2]; // for 2 factions
|
||||
typedef UNORDERED_MAP<uint32 /*dungeonId*/, WorldPacket> RBCacheMap;
|
||||
RBCacheMap RBCacheStore[2]; // for 2 factions
|
||||
typedef UNORDERED_MAP<uint32 /*guidLow*/, RBInternalInfo> RBInternalInfoMap;
|
||||
typedef UNORDERED_MAP<uint32 /*dungeonId*/, RBInternalInfoMap> RBInternalInfoMapMap;
|
||||
RBInternalInfoMapMap RBInternalInfoStorePrev[2]; // for 2 factions
|
||||
RBInternalInfoMapMap RBInternalInfoStoreCurr[2]; // for 2 factions
|
||||
typedef std::set<uint32 /*dungeonId*/> RBUsedDungeonsSet; // needs to be ordered
|
||||
RBUsedDungeonsSet RBUsedDungeonsStore[2]; // for 2 factions
|
||||
// pussywizard: RAIDBROWSER
|
||||
typedef UNORDERED_MAP<uint32 /*playerGuidLow*/, RBEntryInfo> RBEntryInfoMap;
|
||||
typedef UNORDERED_MAP<uint32 /*dungeonId*/, RBEntryInfoMap> RBStoreMap;
|
||||
RBStoreMap RaidBrowserStore[2]; // for 2 factions
|
||||
typedef UNORDERED_MAP<uint32 /*playerGuidLow*/, uint32 /*dungeonId*/> RBSearchersMap;
|
||||
RBSearchersMap RBSearchersStore[2]; // for 2 factions
|
||||
typedef UNORDERED_MAP<uint32 /*dungeonId*/, WorldPacket> RBCacheMap;
|
||||
RBCacheMap RBCacheStore[2]; // for 2 factions
|
||||
typedef UNORDERED_MAP<uint32 /*guidLow*/, RBInternalInfo> RBInternalInfoMap;
|
||||
typedef UNORDERED_MAP<uint32 /*dungeonId*/, RBInternalInfoMap> RBInternalInfoMapMap;
|
||||
RBInternalInfoMapMap RBInternalInfoStorePrev[2]; // for 2 factions
|
||||
RBInternalInfoMapMap RBInternalInfoStoreCurr[2]; // for 2 factions
|
||||
typedef std::set<uint32 /*dungeonId*/> RBUsedDungeonsSet; // needs to be ordered
|
||||
RBUsedDungeonsSet RBUsedDungeonsStore[2]; // for 2 factions
|
||||
|
||||
public:
|
||||
// Functions used outside lfg namespace
|
||||
@@ -477,10 +477,10 @@ class LFGMgr
|
||||
uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid);
|
||||
/// Adds player to group
|
||||
void AddPlayerToGroup(uint64 gguid, uint64 guid);
|
||||
/// Xinef: Set Random Players Count
|
||||
void SetRandomPlayersCount(uint64 guid, uint8 count);
|
||||
/// Xinef: Get Random Players Count
|
||||
uint8 GetRandomPlayersCount(uint64 guid);
|
||||
/// Xinef: Set Random Players Count
|
||||
void SetRandomPlayersCount(uint64 guid, uint8 count);
|
||||
/// Xinef: Get Random Players Count
|
||||
uint8 GetRandomPlayersCount(uint64 guid);
|
||||
|
||||
// LFGHandler
|
||||
/// Get locked dungeons
|
||||
@@ -511,21 +511,21 @@ class LFGMgr
|
||||
void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment);
|
||||
/// Leaves lfg
|
||||
void LeaveLfg(uint64 guid);
|
||||
/// pussywizard: cleans all queues' data
|
||||
void LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid = 0);
|
||||
/// pussywizard: Raid Browser
|
||||
void JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment);
|
||||
void LeaveRaidBrowser(uint64 guid);
|
||||
void LfrSearchAdd(Player* p, uint32 dungeonId);
|
||||
void LfrSearchRemove(Player* p);
|
||||
void SendRaidBrowserCachedList(Player* player, uint32 dungeonId);
|
||||
void UpdateRaidBrowser(uint32 diff);
|
||||
/// pussywizard: cleans all queues' data
|
||||
void LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid = 0);
|
||||
/// pussywizard: Raid Browser
|
||||
void JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment);
|
||||
void LeaveRaidBrowser(uint64 guid);
|
||||
void LfrSearchAdd(Player* p, uint32 dungeonId);
|
||||
void LfrSearchRemove(Player* p);
|
||||
void SendRaidBrowserCachedList(Player* player, uint32 dungeonId);
|
||||
void UpdateRaidBrowser(uint32 diff);
|
||||
void LfrSetComment(Player* p, std::string comment);
|
||||
void SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment);
|
||||
void RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer);
|
||||
void RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer);
|
||||
void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer& buffer_deleted, uint32 groupCounter, ByteBuffer& buffer_groups, uint32 playerCounter, ByteBuffer& buffer_players);
|
||||
void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap& infoMap);
|
||||
void SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment);
|
||||
void RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer);
|
||||
void RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer);
|
||||
void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer& buffer_deleted, uint32 groupCounter, ByteBuffer& buffer_groups, uint32 playerCounter, ByteBuffer& buffer_players);
|
||||
void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap& infoMap);
|
||||
|
||||
// LfgQueue
|
||||
/// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
|
||||
@@ -554,7 +554,7 @@ class LFGMgr
|
||||
void SetLockedDungeons(uint64 guid, LfgLockMap const& lock);
|
||||
void DecreaseKicksLeft(uint64 guid);
|
||||
void SetState(uint64 guid, LfgState state);
|
||||
void SetCanOverrideRBState(uint64 guid, bool val);
|
||||
void SetCanOverrideRBState(uint64 guid, bool val);
|
||||
void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
|
||||
void _SaveToDB(uint64 guid);
|
||||
LFGDungeonData const* GetLFGDungeon(uint32 id);
|
||||
@@ -582,8 +582,8 @@ class LFGMgr
|
||||
uint32 m_lfgProposalId; ///< used as internal counter for proposals
|
||||
uint32 m_options; ///< Stores config options
|
||||
uint32 lastProposalId; ///< pussywizard, store it here because of splitting LFGMgr update into tasks
|
||||
uint32 m_raidBrowserUpdateTimer[2]; ///< pussywizard
|
||||
uint32 m_raidBrowserLastUpdatedDungeonId[2]; ///< pussywizard: for 2 factions
|
||||
uint32 m_raidBrowserUpdateTimer[2]; ///< pussywizard
|
||||
uint32 m_raidBrowserLastUpdatedDungeonId[2]; ///< pussywizard: for 2 factions
|
||||
|
||||
LfgQueueContainer QueuesStore; ///< Queues
|
||||
LfgCachedDungeonContainer CachedDungeonMapStore; ///< Stores all dungeons by groupType
|
||||
|
||||
@@ -31,8 +31,8 @@ LfgPlayerData::~LfgPlayerData()
|
||||
|
||||
void LfgPlayerData::SetState(LfgState state)
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
@@ -52,8 +52,8 @@ void LfgPlayerData::SetState(LfgState state)
|
||||
|
||||
void LfgPlayerData::RestoreState()
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
if (m_OldState == LFG_STATE_NONE)
|
||||
{
|
||||
@@ -95,12 +95,12 @@ void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
|
||||
|
||||
void LfgPlayerData::SetRandomPlayersCount(uint8 count)
|
||||
{
|
||||
m_randomPlayers = count;
|
||||
m_randomPlayers = count;
|
||||
}
|
||||
|
||||
uint8 LfgPlayerData::GetRandomPlayersCount() const
|
||||
{
|
||||
return m_randomPlayers;
|
||||
return m_randomPlayers;
|
||||
}
|
||||
|
||||
LfgState LfgPlayerData::GetState() const
|
||||
|
||||
@@ -39,7 +39,7 @@ class LfgPlayerData
|
||||
void SetLockedDungeons(LfgLockMap const& lock);
|
||||
void SetTeam(TeamId teamId);
|
||||
void SetGroup(uint64 group);
|
||||
void SetRandomPlayersCount(uint8 count);
|
||||
void SetRandomPlayersCount(uint8 count);
|
||||
|
||||
// Queue
|
||||
void SetRoles(uint8 roles);
|
||||
@@ -52,9 +52,9 @@ class LfgPlayerData
|
||||
LfgLockMap const& GetLockedDungeons() const;
|
||||
TeamId GetTeam() const;
|
||||
uint64 GetGroup() const;
|
||||
uint8 GetRandomPlayersCount() const;
|
||||
void SetCanOverrideRBState(bool val) { m_canOverrideRBState = val; }
|
||||
bool CanOverrideRBState() const { return m_canOverrideRBState; }
|
||||
uint8 GetRandomPlayersCount() const;
|
||||
void SetCanOverrideRBState(bool val) { m_canOverrideRBState = val; }
|
||||
bool CanOverrideRBState() const { return m_canOverrideRBState; }
|
||||
|
||||
// Queue
|
||||
uint8 GetRoles() const;
|
||||
@@ -65,12 +65,12 @@ class LfgPlayerData
|
||||
// General
|
||||
LfgState m_State; ///< State if group in LFG
|
||||
LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal
|
||||
bool m_canOverrideRBState; ///< pussywizard
|
||||
bool m_canOverrideRBState; ///< pussywizard
|
||||
// Player
|
||||
LfgLockMap m_LockedDungeons; ///< Dungeons player can't do and reason
|
||||
TeamId m_TeamId; ///< Player team - determines the queue to join
|
||||
uint64 m_Group; ///< Original group of player when joined LFG
|
||||
uint8 m_randomPlayers; ///< Xinef: Amount of random players you raid with
|
||||
uint8 m_randomPlayers; ///< Xinef: Amount of random players you raid with
|
||||
|
||||
// Queue
|
||||
uint8 m_Roles; ///< Roles the player selected when joined LFG
|
||||
|
||||
@@ -32,84 +32,84 @@ namespace lfg
|
||||
|
||||
void LFGQueue::AddToQueue(uint64 guid, bool failedProposal)
|
||||
{
|
||||
//sLog->outString("ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0);
|
||||
//sLog->outString("ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0);
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
|
||||
if (itQueue == QueueDataStore.end())
|
||||
{
|
||||
sLog->outError("LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid);
|
||||
return;
|
||||
}
|
||||
//sLog->outString("AddToQueue success: %u", GUID_LOPART(guid));
|
||||
//sLog->outString("AddToQueue success: %u", GUID_LOPART(guid));
|
||||
AddToNewQueue(guid, failedProposal);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromQueue(uint64 guid, bool partial)
|
||||
{
|
||||
//sLog->outString("REMOVE RemoveFromQueue: %u, partial: %u", GUID_LOPART(guid), partial ? 1 : 0);
|
||||
//sLog->outString("REMOVE RemoveFromQueue: %u, partial: %u", GUID_LOPART(guid), partial ? 1 : 0);
|
||||
RemoveFromNewQueue(guid);
|
||||
RemoveFromCompatibles(guid);
|
||||
|
||||
LfgQueueDataContainer::iterator itDelete = QueueDataStore.end();
|
||||
for (LfgQueueDataContainer::iterator itr = QueueDataStore.begin(); itr != QueueDataStore.end(); ++itr)
|
||||
{
|
||||
{
|
||||
if (itr->first != guid)
|
||||
{
|
||||
if (itr->second.bestCompatible.hasGuid(guid))
|
||||
{
|
||||
//sLog->outString("CLEAR bestCompatible: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
|
||||
{
|
||||
//sLog->outString("CLEAR bestCompatible: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
|
||||
itr->second.bestCompatible.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//sLog->outString("CLEAR bestCompatible SELF: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
|
||||
//itr->second.bestCompatible.clear(); // don't clear here, because UpdateQueueTimers will try to find with every diff update
|
||||
{
|
||||
//sLog->outString("CLEAR bestCompatible SELF: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
|
||||
//itr->second.bestCompatible.clear(); // don't clear here, because UpdateQueueTimers will try to find with every diff update
|
||||
itDelete = itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// xinef: partial
|
||||
// xinef: partial
|
||||
if (!partial && itDelete != QueueDataStore.end())
|
||||
{
|
||||
//sLog->outString("ERASE QueueDataStore for: %u", GUID_LOPART(guid));
|
||||
//sLog->outString("ERASE QueueDataStore for: %u, itDelete: %u,%u,%u", GUID_LOPART(guid), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
|
||||
{
|
||||
//sLog->outString("ERASE QueueDataStore for: %u", GUID_LOPART(guid));
|
||||
//sLog->outString("ERASE QueueDataStore for: %u, itDelete: %u,%u,%u", GUID_LOPART(guid), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
|
||||
QueueDataStore.erase(itDelete);
|
||||
//sLog->outString("ERASE QueueDataStore for: %u SUCCESS", GUID_LOPART(guid));
|
||||
}
|
||||
//sLog->outString("ERASE QueueDataStore for: %u SUCCESS", GUID_LOPART(guid));
|
||||
}
|
||||
}
|
||||
|
||||
void LFGQueue::AddToNewQueue(uint64 guid, bool front)
|
||||
{
|
||||
if (front)
|
||||
{
|
||||
//sLog->outString("ADD AddToNewQueue at FRONT: %u", GUID_LOPART(guid));
|
||||
restoredAfterProposal.push_back(guid);
|
||||
{
|
||||
//sLog->outString("ADD AddToNewQueue at FRONT: %u", GUID_LOPART(guid));
|
||||
restoredAfterProposal.push_back(guid);
|
||||
newToQueueStore.push_front(guid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//sLog->outString("ADD AddToNewQueue at the END: %u", GUID_LOPART(guid));
|
||||
{
|
||||
//sLog->outString("ADD AddToNewQueue at the END: %u", GUID_LOPART(guid));
|
||||
newToQueueStore.push_back(guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromNewQueue(uint64 guid)
|
||||
{
|
||||
//sLog->outString("REMOVE RemoveFromNewQueue: %u", GUID_LOPART(guid));
|
||||
//sLog->outString("REMOVE RemoveFromNewQueue: %u", GUID_LOPART(guid));
|
||||
newToQueueStore.remove(guid);
|
||||
restoredAfterProposal.remove(guid);
|
||||
restoredAfterProposal.remove(guid);
|
||||
}
|
||||
|
||||
void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
|
||||
{
|
||||
//sLog->outString("JOINED AddQueueData: %u", GUID_LOPART(guid));
|
||||
//sLog->outString("JOINED AddQueueData: %u", GUID_LOPART(guid));
|
||||
QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
|
||||
AddToQueue(guid);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveQueueData(uint64 guid)
|
||||
{
|
||||
//sLog->outString("LEFT RemoveQueueData: %u", GUID_LOPART(guid));
|
||||
//sLog->outString("LEFT RemoveQueueData: %u", GUID_LOPART(guid));
|
||||
LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
|
||||
if (it != QueueDataStore.end())
|
||||
QueueDataStore.erase(it);
|
||||
@@ -145,73 +145,73 @@ void LFGQueue::UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId)
|
||||
|
||||
void LFGQueue::RemoveFromCompatibles(uint64 guid)
|
||||
{
|
||||
//sLog->outString("COMPATIBLES REMOVE for: %u", GUID_LOPART(guid));
|
||||
//sLog->outString("COMPATIBLES REMOVE for: %u", GUID_LOPART(guid));
|
||||
for (LfgCompatibleContainer::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it)
|
||||
if (it->hasGuid(guid))
|
||||
{
|
||||
//sLog->outString("Removed Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
|
||||
{
|
||||
//sLog->outString("Removed Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
|
||||
it->clear(); // set to 0, this will be removed while iterating in FindNewGroups
|
||||
}
|
||||
}
|
||||
for (LfgCompatibleContainer::iterator itr = CompatibleTempList.begin(); itr != CompatibleTempList.end(); )
|
||||
{
|
||||
LfgCompatibleContainer::iterator it = itr++;
|
||||
{
|
||||
LfgCompatibleContainer::iterator it = itr++;
|
||||
if (it->hasGuid(guid))
|
||||
{
|
||||
//sLog->outString("Erased Temp Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
|
||||
{
|
||||
//sLog->outString("Erased Temp Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
|
||||
CompatibleTempList.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LFGQueue::AddToCompatibles(Lfg5Guids const& key)
|
||||
{
|
||||
//sLog->outString("COMPATIBLES ADD: %s", key.toString().c_str());
|
||||
//sLog->outString("COMPATIBLES ADD: %s", key.toString().c_str());
|
||||
CompatibleTempList.push_back(key);
|
||||
}
|
||||
|
||||
uint8 LFGQueue::FindGroups()
|
||||
{
|
||||
//sLog->outString("FIND GROUPS!");
|
||||
uint8 newGroupsProcessed = 0;
|
||||
//sLog->outString("FIND GROUPS!");
|
||||
uint8 newGroupsProcessed = 0;
|
||||
while (!newToQueueStore.empty())
|
||||
{
|
||||
++newGroupsProcessed;
|
||||
++newGroupsProcessed;
|
||||
uint64 newGuid = newToQueueStore.front();
|
||||
bool pushCompatiblesToFront = (std::find(restoredAfterProposal.begin(), restoredAfterProposal.end(), newGuid) != restoredAfterProposal.end());
|
||||
//sLog->outString("newToQueueStore guid: %u, front: %u", GUID_LOPART(newGuid), pushCompatiblesToFront ? 1 : 0);
|
||||
bool pushCompatiblesToFront = (std::find(restoredAfterProposal.begin(), restoredAfterProposal.end(), newGuid) != restoredAfterProposal.end());
|
||||
//sLog->outString("newToQueueStore guid: %u, front: %u", GUID_LOPART(newGuid), pushCompatiblesToFront ? 1 : 0);
|
||||
RemoveFromNewQueue(newGuid);
|
||||
|
||||
FindNewGroups(newGuid);
|
||||
|
||||
CompatibleList.splice((pushCompatiblesToFront ? CompatibleList.begin() : CompatibleList.end()), CompatibleTempList);
|
||||
CompatibleTempList.clear();
|
||||
CompatibleList.splice((pushCompatiblesToFront ? CompatibleList.begin() : CompatibleList.end()), CompatibleTempList);
|
||||
CompatibleTempList.clear();
|
||||
|
||||
return newGroupsProcessed; // pussywizard: only one per update, shouldn't be a problem
|
||||
return newGroupsProcessed; // pussywizard: only one per update, shouldn't be a problem
|
||||
}
|
||||
return newGroupsProcessed;
|
||||
}
|
||||
|
||||
LfgCompatibility LFGQueue::FindNewGroups(const uint64& newGuid)
|
||||
{
|
||||
// each combination of dps+heal+tank (tank*8 + heal+4 + dps) has a value assigned 0..15
|
||||
// first 16 bits of the mask are for marking if such combination was found once, second 16 bits for marking second occurence of that combination, etc
|
||||
uint64 foundMask = 0;
|
||||
uint32 foundCount = 0;
|
||||
// each combination of dps+heal+tank (tank*8 + heal+4 + dps) has a value assigned 0..15
|
||||
// first 16 bits of the mask are for marking if such combination was found once, second 16 bits for marking second occurence of that combination, etc
|
||||
uint64 foundMask = 0;
|
||||
uint32 foundCount = 0;
|
||||
|
||||
//sLog->outString("FIND NEW GROUPS for: %u", GUID_LOPART(newGuid));
|
||||
//sLog->outString("FIND NEW GROUPS for: %u", GUID_LOPART(newGuid));
|
||||
|
||||
// we have to take into account that FindNewGroups is called every X minutes if number of compatibles is low!
|
||||
// build set of already present compatibles for this guid
|
||||
std::set<Lfg5Guids> currentCompatibles;
|
||||
for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it)
|
||||
if (it->hasGuid(newGuid))
|
||||
{
|
||||
// unset roles here so they are not copied, restore after insertion
|
||||
LfgRolesMap* r = it->roles;
|
||||
it->roles = NULL;
|
||||
currentCompatibles.insert(*it);
|
||||
it->roles = r;
|
||||
}
|
||||
// we have to take into account that FindNewGroups is called every X minutes if number of compatibles is low!
|
||||
// build set of already present compatibles for this guid
|
||||
std::set<Lfg5Guids> currentCompatibles;
|
||||
for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it)
|
||||
if (it->hasGuid(newGuid))
|
||||
{
|
||||
// unset roles here so they are not copied, restore after insertion
|
||||
LfgRolesMap* r = it->roles;
|
||||
it->roles = NULL;
|
||||
currentCompatibles.insert(*it);
|
||||
it->roles = r;
|
||||
}
|
||||
|
||||
LfgCompatibility selfCompatibility = LFG_COMPATIBILITY_PENDING;
|
||||
if (currentCompatibles.empty())
|
||||
@@ -221,35 +221,35 @@ LfgCompatibility LFGQueue::FindNewGroups(const uint64& newGuid)
|
||||
return selfCompatibility;
|
||||
}
|
||||
|
||||
for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); )
|
||||
{
|
||||
Lfg5GuidsList::iterator itr = it++;
|
||||
if (itr->empty())
|
||||
{
|
||||
//sLog->outString("ERASE from CompatibleList");
|
||||
CompatibleList.erase(itr);
|
||||
continue;
|
||||
}
|
||||
LfgCompatibility compatibility = CheckCompatibility(*itr, newGuid, foundMask, foundCount, currentCompatibles);
|
||||
if (compatibility == LFG_COMPATIBLES_MATCH)
|
||||
return LFG_COMPATIBLES_MATCH;
|
||||
if ((foundMask & 0x3FFF3FFF3FFF3FFF) == 0x3FFF3FFF3FFF3FFF) // each combination of dps+heal+tank already found 4 times
|
||||
break;
|
||||
}
|
||||
for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); )
|
||||
{
|
||||
Lfg5GuidsList::iterator itr = it++;
|
||||
if (itr->empty())
|
||||
{
|
||||
//sLog->outString("ERASE from CompatibleList");
|
||||
CompatibleList.erase(itr);
|
||||
continue;
|
||||
}
|
||||
LfgCompatibility compatibility = CheckCompatibility(*itr, newGuid, foundMask, foundCount, currentCompatibles);
|
||||
if (compatibility == LFG_COMPATIBLES_MATCH)
|
||||
return LFG_COMPATIBLES_MATCH;
|
||||
if ((foundMask & 0x3FFF3FFF3FFF3FFF) == 0x3FFF3FFF3FFF3FFF) // each combination of dps+heal+tank already found 4 times
|
||||
break;
|
||||
}
|
||||
|
||||
return selfCompatibility;
|
||||
}
|
||||
|
||||
LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles)
|
||||
{
|
||||
//sLog->outString("CHECK CheckCompatibility: %s, new guid: %u", checkWith.toString().c_str(), GUID_LOPART(newGuid));
|
||||
Lfg5Guids check(checkWith, false); // here newGuid is at front
|
||||
Lfg5Guids strGuids(checkWith, false); // here guids are sorted
|
||||
check.force_insert_front(newGuid);
|
||||
strGuids.insert(newGuid);
|
||||
//sLog->outString("CHECK CheckCompatibility: %s, new guid: %u", checkWith.toString().c_str(), GUID_LOPART(newGuid));
|
||||
Lfg5Guids check(checkWith, false); // here newGuid is at front
|
||||
Lfg5Guids strGuids(checkWith, false); // here guids are sorted
|
||||
check.force_insert_front(newGuid);
|
||||
strGuids.insert(newGuid);
|
||||
|
||||
if (!currentCompatibles.empty() && currentCompatibles.find(strGuids) != currentCompatibles.end())
|
||||
return LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS;
|
||||
if (!currentCompatibles.empty() && currentCompatibles.find(strGuids) != currentCompatibles.end())
|
||||
return LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS;
|
||||
|
||||
LfgProposal proposal;
|
||||
LfgDungeonSet proposalDungeons;
|
||||
@@ -259,10 +259,10 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
||||
// Check if more than one LFG group and number of players joining
|
||||
uint8 numPlayers = 0;
|
||||
uint8 numLfgGroups = 0;
|
||||
uint64 guid;
|
||||
uint64 addToFoundMask = 0;
|
||||
uint64 guid;
|
||||
uint64 addToFoundMask = 0;
|
||||
|
||||
for (uint8 i=0; i<5 && (guid=check.guid[i]) != 0 && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++i)
|
||||
for (uint8 i=0; i<5 && (guid=check.guid[i]) != 0 && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++i)
|
||||
{
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
|
||||
if (itQueue == QueueDataStore.end())
|
||||
@@ -293,14 +293,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
||||
if (check.size() == 1 && numPlayers < MAXGROUPSIZE)
|
||||
{
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
|
||||
LfgRolesMap roles = itQueue->second.roles;
|
||||
LfgRolesMap roles = itQueue->second.roles;
|
||||
uint8 roleCheckResult = LFGMgr::CheckGroupRoles(roles);
|
||||
strGuids.addRoles(roles);
|
||||
itQueue->second.bestCompatible.clear(); // this may be left after a failed proposal (not cleared, because UpdateQueueTimers would try to generate it with every update)
|
||||
strGuids.addRoles(roles);
|
||||
itQueue->second.bestCompatible.clear(); // this may be left after a failed proposal (not cleared, because UpdateQueueTimers would try to generate it with every update)
|
||||
//UpdateBestCompatibleInQueue(itQueue, strGuids);
|
||||
AddToCompatibles(strGuids);
|
||||
if (roleCheckResult && roleCheckResult <= 15)
|
||||
foundMask |= ( (((uint64)1)<<(roleCheckResult-1)) | (((uint64)1)<<(16+roleCheckResult-1)) | (((uint64)1)<<(32+roleCheckResult-1)) | (((uint64)1)<<(48+roleCheckResult-1)) );
|
||||
if (roleCheckResult && roleCheckResult <= 15)
|
||||
foundMask |= ( (((uint64)1)<<(roleCheckResult-1)) | (((uint64)1)<<(16+roleCheckResult-1)) | (((uint64)1)<<(32+roleCheckResult-1)) | (((uint64)1)<<(48+roleCheckResult-1)) );
|
||||
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
||||
// If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining
|
||||
if (check.size() > 1)
|
||||
{
|
||||
for (uint8 i=0; i<5 && check.guid[i]; ++i)
|
||||
for (uint8 i=0; i<5 && check.guid[i]; ++i)
|
||||
{
|
||||
const LfgRolesMap &roles = QueueDataStore[check.guid[i]].roles;
|
||||
for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
|
||||
@@ -319,51 +319,51 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
||||
for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer)
|
||||
{
|
||||
if (itRoles->first == itPlayer->first)
|
||||
{
|
||||
// pussywizard: LFG ZOMG! this means that this player was in two different LfgQueueData (in QueueDataStore), and at least one of them is a group guid, because we do checks so there aren't 2 same guids in current CHECK
|
||||
{
|
||||
// pussywizard: LFG ZOMG! this means that this player was in two different LfgQueueData (in QueueDataStore), and at least one of them is a group guid, because we do checks so there aren't 2 same guids in current CHECK
|
||||
//sLog->outError("LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
|
||||
break;
|
||||
}
|
||||
if (itPlayer == proposalRoles.end())
|
||||
proposalRoles[itRoles->first] = itRoles->second;
|
||||
else
|
||||
break;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (numPlayers != proposalRoles.size())
|
||||
return LFG_INCOMPATIBLES_HAS_IGNORES;
|
||||
|
||||
uint8 roleCheckResult = LFGMgr::CheckGroupRoles(proposalRoles);
|
||||
uint8 roleCheckResult = LFGMgr::CheckGroupRoles(proposalRoles);
|
||||
if (!roleCheckResult || roleCheckResult > 0xF)
|
||||
return LFG_INCOMPATIBLES_NO_ROLES;
|
||||
|
||||
// now, every combination can occur only 4 times (explained in FindNewGroups)
|
||||
if (foundMask & (((uint64)1)<<(roleCheckResult-1)))
|
||||
{
|
||||
if (foundMask & (((uint64)1)<<(16+roleCheckResult-1)))
|
||||
{
|
||||
if (foundMask & (((uint64)1)<<(32+roleCheckResult-1)))
|
||||
{
|
||||
if (foundMask & (((uint64)1)<<(48+roleCheckResult-1)))
|
||||
{
|
||||
if (foundCount >= 10) // but only after finding at least 10 compatibles (this helps when there are few groups)
|
||||
return LFG_INCOMPATIBLES_NO_ROLES;
|
||||
}
|
||||
else
|
||||
addToFoundMask |= (((uint64)1)<<(48+roleCheckResult-1));
|
||||
}
|
||||
else
|
||||
addToFoundMask |= (((uint64)1)<<(32+roleCheckResult-1));
|
||||
}
|
||||
else
|
||||
addToFoundMask |= (((uint64)1)<<(16+roleCheckResult-1));
|
||||
}
|
||||
else
|
||||
addToFoundMask |= (((uint64)1)<<(roleCheckResult-1));
|
||||
// now, every combination can occur only 4 times (explained in FindNewGroups)
|
||||
if (foundMask & (((uint64)1)<<(roleCheckResult-1)))
|
||||
{
|
||||
if (foundMask & (((uint64)1)<<(16+roleCheckResult-1)))
|
||||
{
|
||||
if (foundMask & (((uint64)1)<<(32+roleCheckResult-1)))
|
||||
{
|
||||
if (foundMask & (((uint64)1)<<(48+roleCheckResult-1)))
|
||||
{
|
||||
if (foundCount >= 10) // but only after finding at least 10 compatibles (this helps when there are few groups)
|
||||
return LFG_INCOMPATIBLES_NO_ROLES;
|
||||
}
|
||||
else
|
||||
addToFoundMask |= (((uint64)1)<<(48+roleCheckResult-1));
|
||||
}
|
||||
else
|
||||
addToFoundMask |= (((uint64)1)<<(32+roleCheckResult-1));
|
||||
}
|
||||
else
|
||||
addToFoundMask |= (((uint64)1)<<(16+roleCheckResult-1));
|
||||
}
|
||||
else
|
||||
addToFoundMask |= (((uint64)1)<<(roleCheckResult-1));
|
||||
|
||||
proposalDungeons = QueueDataStore[check.front()].dungeons;
|
||||
for (uint8 i=1; i<5 && check.guid[i]; ++i)
|
||||
@@ -379,7 +379,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64 gguid = check.front();
|
||||
uint64 gguid = check.front();
|
||||
const LfgQueueData &queue = QueueDataStore[gguid];
|
||||
proposalDungeons = queue.dungeons;
|
||||
proposalRoles = queue.roles;
|
||||
@@ -389,16 +389,16 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
||||
// Enough players?
|
||||
if (numPlayers != MAXGROUPSIZE)
|
||||
{
|
||||
strGuids.addRoles(proposalRoles);
|
||||
for (uint8 i=0; i<5 && check.guid[i]; ++i)
|
||||
{
|
||||
LfgQueueDataContainer::iterator itr = QueueDataStore.find(check.guid[i]);
|
||||
if (!itr->second.bestCompatible.empty()) // update if groups don't have it empty (for empty it will be generated in UpdateQueueTimers)
|
||||
UpdateBestCompatibleInQueue(itr, strGuids);
|
||||
}
|
||||
strGuids.addRoles(proposalRoles);
|
||||
for (uint8 i=0; i<5 && check.guid[i]; ++i)
|
||||
{
|
||||
LfgQueueDataContainer::iterator itr = QueueDataStore.find(check.guid[i]);
|
||||
if (!itr->second.bestCompatible.empty()) // update if groups don't have it empty (for empty it will be generated in UpdateQueueTimers)
|
||||
UpdateBestCompatibleInQueue(itr, strGuids);
|
||||
}
|
||||
AddToCompatibles(strGuids);
|
||||
foundMask |= addToFoundMask;
|
||||
++foundCount;
|
||||
foundMask |= addToFoundMask;
|
||||
++foundCount;
|
||||
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
|
||||
}
|
||||
|
||||
@@ -436,8 +436,8 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
||||
data.accept = LFG_ANSWER_AGREE;
|
||||
}
|
||||
|
||||
for (uint8 i=0; i<5 && proposal.queues.guid[i]; ++i)
|
||||
RemoveFromQueue(proposal.queues.guid[i], true);
|
||||
for (uint8 i=0; i<5 && proposal.queues.guid[i]; ++i)
|
||||
RemoveFromQueue(proposal.queues.guid[i], true);
|
||||
|
||||
sLFGMgr->AddProposal(proposal);
|
||||
|
||||
@@ -446,52 +446,52 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
||||
|
||||
void LFGQueue::UpdateQueueTimers(uint32 diff)
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
bool sendQueueStatus = false;
|
||||
time_t currTime = time(NULL);
|
||||
bool sendQueueStatus = false;
|
||||
|
||||
if (m_QueueStatusTimer > LFG_QUEUEUPDATE_INTERVAL)
|
||||
{
|
||||
m_QueueStatusTimer = 0;
|
||||
sendQueueStatus = true;
|
||||
}
|
||||
else
|
||||
m_QueueStatusTimer += diff;
|
||||
|
||||
//sLog->outString("UPDATE UpdateQueueTimers");
|
||||
for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); )
|
||||
if (m_QueueStatusTimer > LFG_QUEUEUPDATE_INTERVAL)
|
||||
{
|
||||
Lfg5GuidsList::iterator itr = it++;
|
||||
if (itr->empty())
|
||||
{
|
||||
//sLog->outString("UpdateQueueTimers ERASE compatible");
|
||||
CompatibleList.erase(itr);
|
||||
}
|
||||
}
|
||||
m_QueueStatusTimer = 0;
|
||||
sendQueueStatus = true;
|
||||
}
|
||||
else
|
||||
m_QueueStatusTimer += diff;
|
||||
|
||||
if (!sendQueueStatus)
|
||||
{
|
||||
for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); )
|
||||
{
|
||||
if (currTime - itQueue->second.joinTime > 2*HOUR)
|
||||
{
|
||||
uint64 guid = itQueue->first;
|
||||
QueueDataStore.erase(itQueue++);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true);
|
||||
continue;
|
||||
}
|
||||
if (itQueue->second.bestCompatible.empty())
|
||||
{
|
||||
uint32 numOfCompatibles = FindBestCompatibleInQueue(itQueue);
|
||||
if (numOfCompatibles /*must be positive, because proposals don't delete QueueQueueData*/ && currTime-itQueue->second.lastRefreshTime >= 60 && numOfCompatibles < (5-itQueue->second.bestCompatible.roles->size())*25)
|
||||
{
|
||||
itQueue->second.lastRefreshTime = currTime;
|
||||
AddToQueue(itQueue->first, false);
|
||||
}
|
||||
}
|
||||
++itQueue;
|
||||
}
|
||||
return;
|
||||
}
|
||||
//sLog->outString("UPDATE UpdateQueueTimers");
|
||||
for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); )
|
||||
{
|
||||
Lfg5GuidsList::iterator itr = it++;
|
||||
if (itr->empty())
|
||||
{
|
||||
//sLog->outString("UpdateQueueTimers ERASE compatible");
|
||||
CompatibleList.erase(itr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!sendQueueStatus)
|
||||
{
|
||||
for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); )
|
||||
{
|
||||
if (currTime - itQueue->second.joinTime > 2*HOUR)
|
||||
{
|
||||
uint64 guid = itQueue->first;
|
||||
QueueDataStore.erase(itQueue++);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true);
|
||||
continue;
|
||||
}
|
||||
if (itQueue->second.bestCompatible.empty())
|
||||
{
|
||||
uint32 numOfCompatibles = FindBestCompatibleInQueue(itQueue);
|
||||
if (numOfCompatibles /*must be positive, because proposals don't delete QueueQueueData*/ && currTime-itQueue->second.lastRefreshTime >= 60 && numOfCompatibles < (5-itQueue->second.bestCompatible.roles->size())*25)
|
||||
{
|
||||
itQueue->second.lastRefreshTime = currTime;
|
||||
AddToQueue(itQueue->first, false);
|
||||
}
|
||||
}
|
||||
++itQueue;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//sLog->outTrace(LOG_FILTER_LFG, "Updating queue timers...");
|
||||
for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); ++itQueue)
|
||||
@@ -530,10 +530,10 @@ void LFGQueue::UpdateQueueTimers(uint32 diff)
|
||||
}
|
||||
|
||||
if (queueinfo.bestCompatible.empty())
|
||||
{
|
||||
//sLog->outString("found empty bestCompatible");
|
||||
{
|
||||
//sLog->outString("found empty bestCompatible");
|
||||
FindBestCompatibleInQueue(itQueue);
|
||||
}
|
||||
}
|
||||
|
||||
LfgQueueStatusData queueData(dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps);
|
||||
for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer)
|
||||
@@ -551,19 +551,19 @@ time_t LFGQueue::GetJoinTime(uint64 guid)
|
||||
|
||||
uint32 LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue)
|
||||
{
|
||||
uint32 numOfCompatibles = 0;
|
||||
uint32 numOfCompatibles = 0;
|
||||
for (LfgCompatibleContainer::const_iterator itr = CompatibleList.begin(); itr != CompatibleList.end(); ++itr)
|
||||
if (itr->hasGuid(itrQueue->first))
|
||||
{
|
||||
++numOfCompatibles;
|
||||
{
|
||||
++numOfCompatibles;
|
||||
UpdateBestCompatibleInQueue(itrQueue, *itr);
|
||||
}
|
||||
return numOfCompatibles;
|
||||
}
|
||||
return numOfCompatibles;
|
||||
}
|
||||
|
||||
void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key)
|
||||
{
|
||||
//sLog->outString("UpdateBestCompatibleInQueue: %s", key.toString().c_str());
|
||||
//sLog->outString("UpdateBestCompatibleInQueue: %s", key.toString().c_str());
|
||||
LfgQueueData& queueData = itrQueue->second;
|
||||
|
||||
uint8 storedSize = queueData.bestCompatible.size();
|
||||
|
||||
@@ -108,20 +108,20 @@ class LFGQueue
|
||||
void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key);
|
||||
|
||||
LfgCompatibility FindNewGroups(const uint64& newGuid);
|
||||
LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles);
|
||||
LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles);
|
||||
|
||||
// Queue
|
||||
uint32 m_QueueStatusTimer; ///< used to check interval of sending queue status
|
||||
LfgQueueDataContainer QueueDataStore; ///< Queued groups
|
||||
LfgCompatibleContainer CompatibleList; ///< Compatible dungeons
|
||||
LfgCompatibleContainer CompatibleTempList; ///< new compatibles are added to this container while main one is being iterated
|
||||
LfgCompatibleContainer CompatibleTempList; ///< new compatibles are added to this container while main one is being iterated
|
||||
|
||||
LfgWaitTimesContainer waitTimesAvgStore; ///< Average wait time to find a group queuing as multiple roles
|
||||
LfgWaitTimesContainer waitTimesTankStore; ///< Average wait time to find a group queuing as tank
|
||||
LfgWaitTimesContainer waitTimesHealerStore; ///< Average wait time to find a group queuing as healer
|
||||
LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps
|
||||
LfgGuidList newToQueueStore; ///< New groups to add to queue
|
||||
LfgGuidList restoredAfterProposal;
|
||||
LfgGuidList restoredAfterProposal;
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
@@ -55,13 +55,13 @@ void LFGPlayerScript::OnLogout(Player* player)
|
||||
sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true, player->GetGroup() ? player->GetGroup()->GetGUID() : 0);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
//if (sLFGMgr->GetState(player->GetGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
// sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
//if (sLFGMgr->GetState(player->GetGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
// sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
}
|
||||
|
||||
sLFGMgr->LfrSearchRemove(player);
|
||||
sLFGMgr->LfrSearchRemove(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLogin(Player* player)
|
||||
@@ -126,14 +126,14 @@ void LFGPlayerScript::OnMapChanged(Player* player)
|
||||
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
|
||||
|
||||
// Xinef: Destroy group if only one player is left
|
||||
if (Group* group = player->GetGroup())
|
||||
if (group->GetMembersCount() <= 1u)
|
||||
group->Disband();
|
||||
}
|
||||
// Xinef: Destroy group if only one player is left
|
||||
if (Group* group = player->GetGroup())
|
||||
if (group->GetMembersCount() <= 1u)
|
||||
group->Disband();
|
||||
}
|
||||
}
|
||||
|
||||
LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript")
|
||||
@@ -175,9 +175,9 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
|
||||
sLFGMgr->SetGroup(guid, gguid);
|
||||
sLFGMgr->AddPlayerToGroup(gguid, guid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
|
||||
@@ -205,33 +205,33 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
//if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||
// sLFGMgr->LeaveLfg(guid);
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
//if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||
// sLFGMgr->LeaveLfg(guid);
|
||||
|
||||
// Xinef: only LFG groups can go below
|
||||
if (!isLFG)
|
||||
return;
|
||||
// Xinef: only LFG groups can go below
|
||||
if (!isLFG)
|
||||
return;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
{
|
||||
// xinef: fixed dungeon deserter
|
||||
if (method != GROUP_REMOVEMETHOD_KICK_LFG && state != LFG_STATE_FINISHED_DUNGEON &&
|
||||
player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN) && players >= LFG_GROUP_KICK_VOTES_NEEDED)
|
||||
{
|
||||
player->AddAura(LFG_SPELL_DUNGEON_DESERTER, player);
|
||||
}
|
||||
// xinef: fixed dungeon deserter
|
||||
if (method != GROUP_REMOVEMETHOD_KICK_LFG && state != LFG_STATE_FINISHED_DUNGEON &&
|
||||
player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN) && players >= LFG_GROUP_KICK_VOTES_NEEDED)
|
||||
{
|
||||
player->AddAura(LFG_SPELL_DUNGEON_DESERTER, player);
|
||||
}
|
||||
//else if (state == LFG_STATE_BOOT)
|
||||
// Update internal kick cooldown of kicked
|
||||
|
||||
player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_LEADER_UNK1));
|
||||
if (player->GetMap()->IsDungeon()) // Teleport player out the dungeon
|
||||
{
|
||||
{
|
||||
// Xinef: no longer valid sLFGMgr->TeleportPlayer(player, true);
|
||||
if (!player->IsBeingTeleportedFar() && player->GetMapId() == sLFGMgr->GetDungeonMapId(gguid))
|
||||
player->TeleportToEntryPoint();
|
||||
}
|
||||
if (!player->IsBeingTeleportedFar() && player->GetMapId() == sLFGMgr->GetDungeonMapId(gguid))
|
||||
player->TeleportToEntryPoint();
|
||||
}
|
||||
}
|
||||
|
||||
if (state != LFG_STATE_FINISHED_DUNGEON) // Need more players to finish the dungeon
|
||||
@@ -247,9 +247,9 @@ void LFGGroupScript::OnDisband(Group* group)
|
||||
uint64 gguid = group->GetGUID();
|
||||
;//sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(group->GetLeaderGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(group->GetLeaderGUID());
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(group->GetLeaderGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(group->GetLeaderGUID());
|
||||
|
||||
sLFGMgr->RemoveGroupData(gguid);
|
||||
}
|
||||
@@ -264,9 +264,9 @@ void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 o
|
||||
;//sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
|
||||
sLFGMgr->SetLeader(gguid, newLeaderGuid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(oldLeaderGuid) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(oldLeaderGuid);
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(oldLeaderGuid) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(oldLeaderGuid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
|
||||
|
||||
Reference in New Issue
Block a user