diff options
author | Spp <spp@jorge.gr> | 2013-02-04 05:50:52 +0100 |
---|---|---|
committer | Spp <spp@jorge.gr> | 2013-02-04 05:50:52 +0100 |
commit | f743424f630af8c8b940bcc3a8ed08512708540c (patch) | |
tree | a249522ca4b664c570ba9f61337e1e9ad408e43d | |
parent | 9bdfc877748501066a6fce91b9d5f774eab5ac77 (diff) |
Core/Dungeon Finder: Corrections to previous commit
- player::inRandomLfgDungeon was supposed to return if current player map and difficulty are the ones player applied for
-rw-r--r-- | src/server/game/DungeonFinding/LFG.cpp | 17 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 5 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.h | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 8 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 2 |
5 files changed, 30 insertions, 4 deletions
diff --git a/src/server/game/DungeonFinding/LFG.cpp b/src/server/game/DungeonFinding/LFG.cpp index e146899841f..ce16ad5533e 100644 --- a/src/server/game/DungeonFinding/LFG.cpp +++ b/src/server/game/DungeonFinding/LFG.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #include "LFG.h" #include "Language.h" #include "ObjectMgr.h" diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 05a15b9cb6a..3e8cc7d4aa9 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1960,7 +1960,7 @@ void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid) AddPlayerToGroup(gguid, guid); } -bool LFGMgr::inRandomLfgDungeon(uint64 guid) +bool LFGMgr::selectedRandomLfgDungeon(uint64 guid) { if (GetState(guid) != LFG_STATE_NONE) { @@ -1978,6 +1978,9 @@ bool LFGMgr::inRandomLfgDungeon(uint64 guid) bool LFGMgr::inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty) { + if (!IS_GROUP_GUID(guid)) + guid = GetGroup(guid); + if (uint32 dungeonId = GetDungeon(guid, true)) if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId)) if (uint32(dungeon->map) == map && dungeon->difficulty == difficulty) diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 20116caaaf3..43ae128174f 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -381,7 +381,7 @@ class LFGMgr void SetupGroupMember(uint64 guid, uint64 gguid); uint64 GetGroup(uint64 guid); - bool inRandomLfgDungeon(uint64 guid); + bool selectedRandomLfgDungeon(uint64 guid); bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty); private: diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 9c398bd88fb..72ddd0b8595 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23465,7 +23465,13 @@ bool Player::isUsingLfg() bool Player::inRandomLfgDungeon() { - return sLFGMgr->inRandomLfgDungeon(GetGUID()); + if (sLFGMgr->selectedRandomLfgDungeon(GetGUID())) + { + Map const* map = GetMap(); + return sLFGMgr->inLfgDungeonMap(GetGUID(), map->GetId(), map->GetDifficulty()); + } + + return false; } void Player::SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 54ca3efd6d5..61f4a81bc73 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1728,7 +1728,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader if (!group || group->isLFGGroup()) return false; - if (!sLFGMgr->inRandomLfgDungeon(owner->GetGUID())) + if (!sLFGMgr->selectedRandomLfgDungeon(owner->GetGUID())) return false; map = owner->GetMap(); |