Core/Spells: Implement SPELL_EFFECT_TELEPORT_TO_LFG_DUNGEON
This commit is contained in:
@@ -371,6 +371,8 @@ class TC_GAME_API LFGMgr
|
||||
void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid);
|
||||
/// Return Lfg dungeon entry for given dungeon id
|
||||
uint32 GetLFGDungeonEntry(uint32 id);
|
||||
/// Dungeon data, teleport location included (SPELL_EFFECT_TELEPORT_TO_LFG_DUNGEON)
|
||||
LFGDungeonData const* GetLFGDungeon(uint32 id);
|
||||
|
||||
// cs_lfg
|
||||
/// Get current player roles
|
||||
@@ -478,7 +480,6 @@ class TC_GAME_API LFGMgr
|
||||
void RemovePlayerData(ObjectGuid guid);
|
||||
void GetCompatibleDungeons(LfgDungeonSet* dungeons, GuidSet const& players, LfgLockPartyMap* lockMap, std::vector<std::string_view>* playersMissingRequirement, bool isContinue);
|
||||
void _SaveToDB(ObjectGuid guid, uint32 db_guid);
|
||||
LFGDungeonData const* GetLFGDungeon(uint32 id);
|
||||
|
||||
// Proposals
|
||||
void RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type);
|
||||
|
||||
@@ -1071,11 +1071,22 @@ void Spell::EffectTeleportToLFGDungeon()
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
Player* player = Object::ToPlayer(unitTarget);
|
||||
if (!player)
|
||||
Player* player = unitTarget ? unitTarget->ToPlayer() : nullptr;
|
||||
if (!player || player->IsInFlight())
|
||||
return;
|
||||
|
||||
sLFGMgr->TeleportPlayer(player, false);
|
||||
// MiscValueB is the LFGDungeons id; its entrance comes from lfg_dungeon_template or the map's entrance areatrigger
|
||||
lfg::LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(effectInfo->MiscValueB);
|
||||
if (!dungeon || (dungeon->x == 0.0f && dungeon->y == 0.0f && dungeon->z == 0.0f))
|
||||
{
|
||||
TC_LOG_ERROR("spells.effect.nospell", "Spell::EffectTeleportToLFGDungeon: spell {} names LFG dungeon {}, which has no teleport location (lfg_dungeon_template or an entrance areatrigger).",
|
||||
m_spellInfo->Id, effectInfo->MiscValueB);
|
||||
return;
|
||||
}
|
||||
|
||||
// as LFGMgr::TeleportPlayer does: the dungeon id goes with the teleport, so the instance knows its LFG dungeon and
|
||||
// ScenarioMgr can take that dungeon's ScenarioID when no scenario row matches the map's difficulty (ScenarioMgr.cpp:41-45)
|
||||
player->TeleportTo({ .Location = WorldLocation(dungeon->map, dungeon->x, dungeon->y, dungeon->z, dungeon->o), .LfgDungeonsId = dungeon->id });
|
||||
}
|
||||
|
||||
class DelayedSpellTeleportEvent : public BasicEvent
|
||||
|
||||
Reference in New Issue
Block a user