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

View File

@@ -570,14 +570,32 @@ void LFGMgr::Join(Player* plr)
if (!dungeons || !dungeons->size())
result = LFG_JOIN_NOT_MEET_REQS;
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)
{
if (!GetDungeonGroupType(*it))
type = GetDungeonType(*it);
switch(type)
{
result = LFG_JOIN_DUNGEON_INVALID;
break;
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;
break;
}
}
}
}
// Group checks
@@ -614,7 +632,6 @@ void LFGMgr::Join(Player* plr)
if (grp && !grp->isLFGGroup())
plr->SetLfgState(LFG_STATE_NONE);
plr->GetSession()->SendLfgJoinResult(result);
plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_ROLECHECK_FAILED);
return;
}
@@ -2174,17 +2191,17 @@ LfgReward const* LFGMgr::GetRandomDungeonReward(uint32 dungeon, uint8 level)
}
/// <summary>
/// Given a Dungeon id returns the dungeon Group Type
/// Given a Dungeon id returns the dungeon Type
/// </summary>
/// <param name="uint32">Dungeon id</param>
/// <returns>uint8: GroupType</returns>
uint8 LFGMgr::GetDungeonGroupType(uint32 dungeonId)
/// <returns>uint8: Type</returns>
LfgType LFGMgr::GetDungeonType(uint32 dungeonId)
{
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId);
if (!dungeon)
return 0;
return LFG_TYPE_NONE;
return dungeon->grouptype;
return LfgType(dungeon->type);
}
/// <summary>

View File

@@ -42,6 +42,7 @@ enum LFGenum
enum LfgType
{
LFG_TYPE_NONE = 0, // Internal use only
LFG_TYPE_DUNGEON = 1,
LFG_TYPE_RAID = 2,
LFG_TYPE_QUEST = 3,
@@ -294,7 +295,7 @@ class LFGMgr
LfgLockStatusMap* GetGroupLockStatusDungeons(PlayerSet* pPlayers, LfgDungeonSet* dungeons, bool useEntry = true);
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
LfgDungeonSet* GetAllDungeons();
uint8 GetDungeonGroupType(uint32 dungeon);
LfgType GetDungeonType(uint32 dungeon);
LfgRewardMap m_RewardMap; // Stores rewards for random dungeons
std::map<uint32, uint32> m_EncountersByAchievement; // Stores dungeon ids associated with achievements (for rewards)