Core/DF: Add Dungeon Deserter debuff when leaving an incomplete DF match, and implemented Dungeon Cooldown for random dungeons

This commit is contained in:
Subv
2012-06-12 16:33:43 -05:00
parent 15eb5f0749
commit e8f4eb28f5
2 changed files with 12 additions and 6 deletions
+8 -3
View File
@@ -1417,6 +1417,10 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
waitTimesMap[(*it)->GetGUID()] = int32(joinTime - itQueue->second->joinTime); waitTimesMap[(*it)->GetGUID()] = int32(joinTime - itQueue->second->joinTime);
} }
// Set the dungeon difficulty
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId);
ASSERT(dungeon);
// Create a new group (if needed) // Create a new group (if needed)
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND); LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
Group* grp = pProposal->groupLowGuid ? sGroupMgr->GetGroupByGUID(pProposal->groupLowGuid) : NULL; Group* grp = pProposal->groupLowGuid ? sGroupMgr->GetGroupByGUID(pProposal->groupLowGuid) : NULL;
@@ -1481,11 +1485,12 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
m_teleport.push_back(pguid); m_teleport.push_back(pguid);
grp->SetLfgRoles(pguid, pProposal->players[pguid]->role); grp->SetLfgRoles(pguid, pProposal->players[pguid]->role);
SetState(pguid, LFG_STATE_DUNGEON); SetState(pguid, LFG_STATE_DUNGEON);
// Add the cooldown spell if queued for a random dungeon
if (dungeon->type == LFG_TYPE_RANDOM)
player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);
} }
// Set the dungeon difficulty
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId);
ASSERT(dungeon);
grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty)); grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty));
uint64 gguid = grp->GetGUID(); uint64 gguid = grp->GetGUID();
SetDungeon(gguid, dungeon->Entry()); SetDungeon(gguid, dungeon->Entry());
@@ -117,13 +117,14 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
return; return;
} }
uint32 state = sLFGMgr->GetState(gguid);
sLFGMgr->ClearState(guid); sLFGMgr->ClearState(guid);
sLFGMgr->SetState(guid, LFG_STATE_NONE); sLFGMgr->SetState(guid, LFG_STATE_NONE);
if (Player* player = ObjectAccessor::FindPlayer(guid)) if (Player* player = ObjectAccessor::FindPlayer(guid))
{ {
if (method == GROUP_REMOVEMETHOD_LEAVE && state != LFG_STATE_FINISHED_DUNGEON && player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
player->CastSpell(player, LFG_SPELL_DUNGEON_DESERTER, false);
/* /*
if (method == GROUP_REMOVEMETHOD_LEAVE)
// Add deserter flag
else if (group->isLfgKickActive()) else if (group->isLfgKickActive())
// Update internal kick cooldown of kicked // Update internal kick cooldown of kicked
*/ */
@@ -134,7 +135,7 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
sLFGMgr->TeleportPlayer(player, true); sLFGMgr->TeleportPlayer(player, true);
} }
if (sLFGMgr->GetState(gguid) != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon if (state != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon
sLFGMgr->OfferContinue(group); sLFGMgr->OfferContinue(group);
} }