Scripts/Player: Add OnMapChanged to PlayerScripts (after map changed)

Core/Dungeon Finder: Use OnMapChanged script to cast/remove Luck of the draw
- Also move code to force party update to LfgPlayerScript
- Remove some obsolete Lfg code after recent commits
This commit is contained in:
Spp committed 2013-02-04 16:52:43 +01:00
1 parent 30e1516387
commit 61979f8591
10 files changed
+29 -103

No files matched your search

@@ -88,6 +88,24 @@ void LFGPlayerScript::OnBindToInstance(Player* player, Difficulty difficulty, ui
sLFGMgr->InitializeLockedDungeons(player);
}
void LFGPlayerScript::OnMapChanged(Player* player)
{
Map const* map = player->GetMap();
if (sLFGMgr->inLfgDungeonMap(player->GetGUID(), map->GetId(), map->GetDifficulty()))
{
Group* group = player->GetGroup();
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
if (Player* member = itr->getSource())
player->GetSession()->SendNameQueryOpcode(member->GetGUID());
if (sLFGMgr->selectedRandomLfgDungeon(player->GetGUID()))
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
}
else // if (player->HasAura(lfg:LFG_SPELL_LUCK_OF_THE_DRAW))
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
}
LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript")
{
}