Core/Dungeon Finder: Do not allow to join if selected dungeons and raids

--HG--
branch : trunk
This commit is contained in:
Spp
2010-11-22 12:28:06 +01:00
parent a2ef7e18a1
commit a7d262ce03
2 changed files with 28 additions and 10 deletions
+24 -7
View File
@@ -570,15 +570,33 @@ void LFGMgr::Join(Player* plr)
if (!dungeons || !dungeons->size()) if (!dungeons || !dungeons->size())
result = LFG_JOIN_NOT_MEET_REQS; result = LFG_JOIN_NOT_MEET_REQS;
else // Check if all dungeons are valid else // Check if all dungeons are valid
{
bool isDungeon = false;
bool isRaid = false;
LfgType type = LFG_TYPE_NONE;
for (LfgDungeonSet::const_iterator it = dungeons->begin(); it != dungeons->end(); ++it) for (LfgDungeonSet::const_iterator it = dungeons->begin(); it != dungeons->end(); ++it)
{ {
if (!GetDungeonGroupType(*it)) type = GetDungeonType(*it);
switch(type)
{ {
case LFG_TYPE_DUNGEON:
case LFG_TYPE_HEROIC:
if (isRaid)
result = LFG_JOIN_MIXED_RAID_DUNGEON;
isDungeon = true;
break;
case LFG_TYPE_RAID:
if (isDungeon)
result = LFG_JOIN_MIXED_RAID_DUNGEON;
isRaid = true;
break;
default:
result = LFG_JOIN_DUNGEON_INVALID; result = LFG_JOIN_DUNGEON_INVALID;
break; break;
} }
} }
} }
}
// Group checks // Group checks
if (grp && result == LFG_JOIN_OK) if (grp && result == LFG_JOIN_OK)
@@ -614,7 +632,6 @@ void LFGMgr::Join(Player* plr)
if (grp && !grp->isLFGGroup()) if (grp && !grp->isLFGGroup())
plr->SetLfgState(LFG_STATE_NONE); plr->SetLfgState(LFG_STATE_NONE);
plr->GetSession()->SendLfgJoinResult(result); plr->GetSession()->SendLfgJoinResult(result);
plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_ROLECHECK_FAILED);
return; return;
} }
@@ -2174,17 +2191,17 @@ LfgReward const* LFGMgr::GetRandomDungeonReward(uint32 dungeon, uint8 level)
} }
/// <summary> /// <summary>
/// Given a Dungeon id returns the dungeon Group Type /// Given a Dungeon id returns the dungeon Type
/// </summary> /// </summary>
/// <param name="uint32">Dungeon id</param> /// <param name="uint32">Dungeon id</param>
/// <returns>uint8: GroupType</returns> /// <returns>uint8: Type</returns>
uint8 LFGMgr::GetDungeonGroupType(uint32 dungeonId) LfgType LFGMgr::GetDungeonType(uint32 dungeonId)
{ {
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId);
if (!dungeon) if (!dungeon)
return 0; return LFG_TYPE_NONE;
return dungeon->grouptype; return LfgType(dungeon->type);
} }
/// <summary> /// <summary>
+2 -1
View File
@@ -42,6 +42,7 @@ enum LFGenum
enum LfgType enum LfgType
{ {
LFG_TYPE_NONE = 0, // Internal use only
LFG_TYPE_DUNGEON = 1, LFG_TYPE_DUNGEON = 1,
LFG_TYPE_RAID = 2, LFG_TYPE_RAID = 2,
LFG_TYPE_QUEST = 3, LFG_TYPE_QUEST = 3,
@@ -294,7 +295,7 @@ class LFGMgr
LfgLockStatusMap* GetGroupLockStatusDungeons(PlayerSet* pPlayers, LfgDungeonSet* dungeons, bool useEntry = true); LfgLockStatusMap* GetGroupLockStatusDungeons(PlayerSet* pPlayers, LfgDungeonSet* dungeons, bool useEntry = true);
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon); LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
LfgDungeonSet* GetAllDungeons(); LfgDungeonSet* GetAllDungeons();
uint8 GetDungeonGroupType(uint32 dungeon); LfgType GetDungeonType(uint32 dungeon);
LfgRewardMap m_RewardMap; // Stores rewards for random dungeons LfgRewardMap m_RewardMap; // Stores rewards for random dungeons
std::map<uint32, uint32> m_EncountersByAchievement; // Stores dungeon ids associated with achievements (for rewards) std::map<uint32, uint32> m_EncountersByAchievement; // Stores dungeon ids associated with achievements (for rewards)