Core/DungeonFinder:

- Corrections to c6c23b7f7e: Properly fixed #6748 after misunderstanding the issue.
- Display proper error message when teleportating as fatigued
This commit is contained in:
kaelima
2012-06-13 08:21:29 +02:00
parent 5180bc4601
commit 9cdf3fb4c0
3 changed files with 22 additions and 13 deletions
+20 -13
View File
@@ -1420,7 +1420,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
// Set the dungeon difficulty // Set the dungeon difficulty
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId);
ASSERT(dungeon); 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;
@@ -1431,6 +1431,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
Group* group = player->GetGroup(); Group* group = player->GetGroup();
if (sendUpdate) if (sendUpdate)
player->GetSession()->SendLfgUpdateProposal(proposalId, pProposal); player->GetSession()->SendLfgUpdateProposal(proposalId, pProposal);
if (group) if (group)
{ {
player->GetSession()->SendLfgUpdateParty(updateData); player->GetSession()->SendLfgUpdateParty(updateData);
@@ -1482,10 +1483,11 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
break; break;
} }
} }
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 // Add the cooldown spell if queued for a random dungeon
if (dungeon->type == LFG_TYPE_RANDOM) if (dungeon->type == LFG_TYPE_RANDOM)
player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false); player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);
@@ -1749,14 +1751,7 @@ void LFGMgr::UpdateBoot(Player* player, bool accept)
void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*/) void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*/)
{ {
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", player->GetGUID(), out ? "out" : "in"); sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", player->GetGUID(), out ? "out" : "in");
if (out)
{
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
player->TeleportToBGEntryPoint();
return;
}
// TODO Add support for LFG_TELEPORTERROR_FATIGUE
LfgTeleportError error = LFG_TELEPORTERROR_OK; LfgTeleportError error = LFG_TELEPORTERROR_OK;
Group* grp = player->GetGroup(); Group* grp = player->GetGroup();
@@ -1766,13 +1761,25 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
error = LFG_TELEPORTERROR_PLAYER_DEAD; error = LFG_TELEPORTERROR_PLAYER_DEAD;
else if (player->IsFalling() || player->HasUnitState(UNIT_STATE_JUMPING)) else if (player->IsFalling() || player->HasUnitState(UNIT_STATE_JUMPING))
error = LFG_TELEPORTERROR_FALLING; error = LFG_TELEPORTERROR_FALLING;
else if (player->IsMirrorTimerActive(FATIGUE_TIMER))
error = LFG_TELEPORTERROR_FATIGUE;
else else
{ {
uint64 gguid = grp->GetGUID(); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(grp->GetGUID()));
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(gguid));
if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) if (out)
error = LFG_TELEPORTERROR_INVALID_LOCATION; {
// Player needs to be inside the LFG dungeon to be able to teleport out
if (dungeon && player->GetMapId() == uint32(dungeon->map))
{
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
player->TeleportToBGEntryPoint();
}
else
player->GetSession()->SendLfgTeleportError(LFG_TELEPORTERROR_DONT_REPORT); // Not sure which error message to send
return;
}
if (!dungeon) if (!dungeon)
error = LFG_TELEPORTERROR_INVALID_LOCATION; error = LFG_TELEPORTERROR_INVALID_LOCATION;
+1
View File
@@ -68,6 +68,7 @@ enum LfgTeleportError
LFG_TELEPORTERROR_OK = 0, // Internal use LFG_TELEPORTERROR_OK = 0, // Internal use
LFG_TELEPORTERROR_PLAYER_DEAD = 1, LFG_TELEPORTERROR_PLAYER_DEAD = 1,
LFG_TELEPORTERROR_FALLING = 2, LFG_TELEPORTERROR_FALLING = 2,
LFG_TELEPORTERROR_DONT_REPORT = 3,
LFG_TELEPORTERROR_FATIGUE = 4, LFG_TELEPORTERROR_FATIGUE = 4,
LFG_TELEPORTERROR_INVALID_LOCATION = 6 LFG_TELEPORTERROR_INVALID_LOCATION = 6
}; };
+1
View File
@@ -1970,6 +1970,7 @@ class Player : public Unit, public GridObject<Player>
StopMirrorTimer(BREATH_TIMER); StopMirrorTimer(BREATH_TIMER);
StopMirrorTimer(FIRE_TIMER); StopMirrorTimer(FIRE_TIMER);
} }
bool IsMirrorTimerActive(MirrorTimerType type) { return m_MirrorTimer[type] == getMaxTimer(type); }
void SetMovement(PlayerMovementType pType); void SetMovement(PlayerMovementType pType);