fix(Core/Conditions): correctly check if player queued random dungeon (#24424)
This commit is contained in:
@@ -542,13 +542,13 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
|
|||||||
condMeets = object->GetMap()->GetDifficulty() == ConditionValue1;
|
condMeets = object->GetMap()->GetDifficulty() == ConditionValue1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CONDITION_RANDOM_DUNGEON:
|
case CONDITION_PLAYER_QUEUED_RANDOM_DUNGEON:
|
||||||
{
|
{
|
||||||
if (Unit* unit = object->ToUnit())
|
if (Unit* unit = object->ToUnit())
|
||||||
{
|
{
|
||||||
if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself())
|
if (Player* player = unit->ToPlayer())
|
||||||
{
|
{
|
||||||
if (sLFGMgr->selectedRandomLfgDungeon(player->GetGUID()))
|
if (sLFGMgr->IsPlayerQueuedForRandomDungeon(player->GetGUID()))
|
||||||
{
|
{
|
||||||
if (!ConditionValue1)
|
if (!ConditionValue1)
|
||||||
condMeets = true;
|
condMeets = true;
|
||||||
@@ -803,7 +803,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
|
|||||||
case CONDITION_CHARMED:
|
case CONDITION_CHARMED:
|
||||||
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
|
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
|
||||||
break;
|
break;
|
||||||
case CONDITION_RANDOM_DUNGEON:
|
case CONDITION_PLAYER_QUEUED_RANDOM_DUNGEON:
|
||||||
mask |= GRID_MAP_TYPE_MASK_PLAYER;
|
mask |= GRID_MAP_TYPE_MASK_PLAYER;
|
||||||
break;
|
break;
|
||||||
case CONDITION_WORLD_SCRIPT:
|
case CONDITION_WORLD_SCRIPT:
|
||||||
@@ -2486,7 +2486,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CONDITION_RANDOM_DUNGEON:
|
case CONDITION_PLAYER_QUEUED_RANDOM_DUNGEON:
|
||||||
if (cond->ConditionValue1 > 1)
|
if (cond->ConditionValue1 > 1)
|
||||||
{
|
{
|
||||||
LOG_ERROR("sql.sql", "RandomDungeon condition has useless data in value1 ({}).", cond->ConditionValue1);
|
LOG_ERROR("sql.sql", "RandomDungeon condition has useless data in value1 ({}).", cond->ConditionValue1);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ enum ConditionTypes
|
|||||||
CONDITION_HAS_AURA_TYPE = 102, // aura_type 0 0 true if has aura type
|
CONDITION_HAS_AURA_TYPE = 102, // aura_type 0 0 true if has aura type
|
||||||
CONDITION_WORLD_SCRIPT = 103, // conditionId state 0 true if WorldState::IsConditionFulfilled returns true
|
CONDITION_WORLD_SCRIPT = 103, // conditionId state 0 true if WorldState::IsConditionFulfilled returns true
|
||||||
CONDITION_AI_DATA = 104, // dataId value 0 true if AI::GetData returns value
|
CONDITION_AI_DATA = 104, // dataId value 0 true if AI::GetData returns value
|
||||||
CONDITION_RANDOM_DUNGEON = 105, // difficulty (0 = any) 0 0 true if player is queued for a random dungeon via RDF (param1 = Difficulty)
|
CONDITION_PLAYER_QUEUED_RANDOM_DUNGEON = 105, // checkDifficulty difficulty 0 true if player is queued for a random dungeon via RDF
|
||||||
|
|
||||||
CONDITION_AC_END = 106 // placeholder
|
CONDITION_AC_END = 106 // placeholder
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -139,4 +139,13 @@ namespace lfg
|
|||||||
return m_KicksLeft;
|
return m_KicksLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LfgGroupData::AddRandomQueuedPlayer(ObjectGuid guid)
|
||||||
|
{
|
||||||
|
m_RandomQueuedPlayers.insert(guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool LfgGroupData::IsRandomQueuedPlayer(ObjectGuid guid) const
|
||||||
|
{
|
||||||
|
return m_RandomQueuedPlayers.contains(guid);
|
||||||
|
}
|
||||||
} // namespace lfg
|
} // namespace lfg
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ namespace lfg
|
|||||||
void SetState(LfgState state);
|
void SetState(LfgState state);
|
||||||
void RestoreState();
|
void RestoreState();
|
||||||
void AddPlayer(ObjectGuid guid);
|
void AddPlayer(ObjectGuid guid);
|
||||||
|
void AddRandomQueuedPlayer(ObjectGuid guid);
|
||||||
|
[[nodiscard]] bool IsRandomQueuedPlayer(ObjectGuid guid) const;
|
||||||
uint8 RemovePlayer(ObjectGuid guid);
|
uint8 RemovePlayer(ObjectGuid guid);
|
||||||
void RemoveAllPlayers();
|
void RemoveAllPlayers();
|
||||||
void SetLeader(ObjectGuid guid);
|
void SetLeader(ObjectGuid guid);
|
||||||
@@ -66,6 +68,7 @@ namespace lfg
|
|||||||
LfgState m_OldState; ///< Old State
|
LfgState m_OldState; ///< Old State
|
||||||
ObjectGuid m_Leader; ///< Leader GUID
|
ObjectGuid m_Leader; ///< Leader GUID
|
||||||
LfgGuidSet m_Players; ///< Players in group
|
LfgGuidSet m_Players; ///< Players in group
|
||||||
|
LfgGuidSet m_RandomQueuedPlayers; ///< Players that queued for random dungeon
|
||||||
// Dungeon
|
// Dungeon
|
||||||
uint32 m_Dungeon; ///< Dungeon entry
|
uint32 m_Dungeon; ///< Dungeon entry
|
||||||
bool _isLFGGroup;
|
bool _isLFGGroup;
|
||||||
|
|||||||
@@ -2583,6 +2583,18 @@ namespace lfg
|
|||||||
GroupsStore[gguid].AddPlayer(guid);
|
GroupsStore[gguid].AddPlayer(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LFGMgr::AddPlayerQueuedForRandomDungeonToGroup(ObjectGuid gguid, ObjectGuid guid)
|
||||||
|
{
|
||||||
|
const LfgDungeonSet& dungeons = GetSelectedDungeons(guid);
|
||||||
|
if (dungeons.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint32 dungeonId = *dungeons.begin();
|
||||||
|
LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId);
|
||||||
|
if (dungeon && (dungeon->type == LFG_TYPE_RANDOM))
|
||||||
|
GroupsStore[gguid].AddRandomQueuedPlayer(guid);
|
||||||
|
}
|
||||||
|
|
||||||
void LFGMgr::SetLeader(ObjectGuid gguid, ObjectGuid leader)
|
void LFGMgr::SetLeader(ObjectGuid gguid, ObjectGuid leader)
|
||||||
{
|
{
|
||||||
GroupsStore[gguid].SetLeader(leader);
|
GroupsStore[gguid].SetLeader(leader);
|
||||||
@@ -2839,4 +2851,12 @@ namespace lfg
|
|||||||
sDisableMgr->IsDisabledFor(DISABLE_TYPE_LFG_MAP, mapId, nullptr);
|
sDisableMgr->IsDisabledFor(DISABLE_TYPE_LFG_MAP, mapId, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LFGMgr::IsPlayerQueuedForRandomDungeon(ObjectGuid guid)
|
||||||
|
{
|
||||||
|
auto gguid = GetGroup(guid);
|
||||||
|
if (!gguid)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return GroupsStore[gguid].IsRandomQueuedPlayer(guid);
|
||||||
|
}
|
||||||
} // namespace lfg
|
} // namespace lfg
|
||||||
|
|||||||
@@ -506,6 +506,9 @@ namespace lfg
|
|||||||
uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid);
|
uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid);
|
||||||
/// Adds player to group
|
/// Adds player to group
|
||||||
void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid);
|
void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid);
|
||||||
|
/// Store player that selected random queue to group
|
||||||
|
void AddPlayerQueuedForRandomDungeonToGroup(ObjectGuid gguid, ObjectGuid guid);
|
||||||
|
bool IsPlayerQueuedForRandomDungeon(ObjectGuid guid);
|
||||||
/// Xinef: Set Random Players Count
|
/// Xinef: Set Random Players Count
|
||||||
void SetRandomPlayersCount(ObjectGuid guid, uint8 count);
|
void SetRandomPlayersCount(ObjectGuid guid, uint8 count);
|
||||||
/// Xinef: Get Random Players Count
|
/// Xinef: Get Random Players Count
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ namespace lfg
|
|||||||
|
|
||||||
sLFGMgr->SetGroup(guid, gguid);
|
sLFGMgr->SetGroup(guid, gguid);
|
||||||
sLFGMgr->AddPlayerToGroup(gguid, guid);
|
sLFGMgr->AddPlayerToGroup(gguid, guid);
|
||||||
|
sLFGMgr->AddPlayerQueuedForRandomDungeonToGroup(gguid, guid);
|
||||||
|
|
||||||
// pussywizard: after all necessary actions handle raid browser
|
// pussywizard: after all necessary actions handle raid browser
|
||||||
if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||||
|
|||||||
Reference in New Issue
Block a user