Core/DF: Add Dungeon Deserter debuff when leaving an incomplete DF match, and implemented Dungeon Cooldown for random dungeons
This commit is contained in:
@@ -1417,6 +1417,10 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
|
||||
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)
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
|
||||
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);
|
||||
grp->SetLfgRoles(pguid, pProposal->players[pguid]->role);
|
||||
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));
|
||||
uint64 gguid = grp->GetGUID();
|
||||
SetDungeon(gguid, dungeon->Entry());
|
||||
|
||||
@@ -117,13 +117,14 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 state = sLFGMgr->GetState(gguid);
|
||||
sLFGMgr->ClearState(guid);
|
||||
sLFGMgr->SetState(guid, LFG_STATE_NONE);
|
||||
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())
|
||||
// Update internal kick cooldown of kicked
|
||||
*/
|
||||
@@ -134,7 +135,7 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user