Core/Player: Implemented new CMSG_ACTIVATE_TAXI fields to select a random favorite mount instead of standard gryphon/wyvern and enabled it

Closes #17778
This commit is contained in:
Shauren
2016-11-12 00:27:07 +01:00
parent 54376e026b
commit bfeb32d4a9
6 changed files with 18 additions and 7 deletions
+1
View File
@@ -124,6 +124,7 @@ TC_GAME_API extern DB2Storage<MailTemplateEntry> sMailTemplat
TC_GAME_API extern DB2Storage<MapEntry> sMapStore;
TC_GAME_API extern DB2Storage<ModifierTreeEntry> sModifierTreeStore;
TC_GAME_API extern DB2Storage<MountCapabilityEntry> sMountCapabilityStore;
TC_GAME_API extern DB2Storage<MountEntry> sMountStore;
TC_GAME_API extern DB2Storage<MovieEntry> sMovieStore;
TC_GAME_API extern DB2Storage<OverrideSpellDataEntry> sOverrideSpellDataStore;
TC_GAME_API extern DB2Storage<PhaseEntry> sPhaseStore;
+3 -2
View File
@@ -825,8 +825,9 @@ enum SummonPropFlags
enum TaxiNodeFlags
{
TAXI_NODE_FLAG_ALLIANCE = 0x1,
TAXI_NODE_FLAG_HORDE = 0x2
TAXI_NODE_FLAG_ALLIANCE = 0x01,
TAXI_NODE_FLAG_HORDE = 0x02,
TAXI_NODE_FLAG_USE_FAVORITE_MOUNT = 0x10
};
enum TaxiPathNodeFlags
+6 -2
View File
@@ -21434,7 +21434,7 @@ void Player::SetRestBonus(float rest_bonus_new)
SetUInt32Value(PLAYER_FIELD_REST_INFO + REST_RESTED_XP, uint32(m_rest_bonus));
}
bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= nullptr*/, uint32 spellid /*= 0*/)
bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= nullptr*/, uint32 spellid /*= 0*/, uint32 preferredMountDisplay /*= 0*/)
{
if (nodes.size() < 2)
{
@@ -21576,7 +21576,11 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
// only one mount ID for both sides. Probably not good to use 315 in case DBC nodes
// change but I couldn't find a suitable alternative. OK to use class because only DK
// can use this taxi.
uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == nullptr || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT));
uint32 mount_display_id;
if (node->Flags & TAXI_NODE_FLAG_USE_FAVORITE_MOUNT && preferredMountDisplay)
mount_display_id = preferredMountDisplay;
else
mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == nullptr || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT));
// in spell case allow 0 model
if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
+1 -1
View File
@@ -1260,7 +1260,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
PlayerTaxi m_taxi;
void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(), getClass(), getLevel()); }
bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 0);
bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 0, uint32 preferredMountDisplay = 0);
bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0);
void CleanupAfterTaxiFlight();
void ContinueTaxiFlight() const;
+6 -1
View File
@@ -182,9 +182,14 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPackets::Taxi::ActivateTaxi& ac
}
}
uint32 preferredMountDisplay = 0;
if (MountEntry const* mount = sMountStore.LookupEntry(activateTaxi.FlyingMountID))
if (GetPlayer()->HasSpell(mount->SpellId))
preferredMountDisplay = mount->DisplayId;
std::vector<uint32> nodes;
sTaxiPathGraph.GetCompleteNodeRoute(from, to, GetPlayer(), nodes);
GetPlayer()->ActivateTaxiPathTo(nodes, unit);
GetPlayer()->ActivateTaxiPathTo(nodes, unit, 0, preferredMountDisplay);
}
void WorldSession::SendActivateTaxiReply(ActivateTaxiReply reply)
+1 -1
View File
@@ -130,7 +130,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_ACCEPT_LEVEL_GRANT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAcceptGrantLevel);
DEFINE_HANDLER(CMSG_ACCEPT_TRADE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAcceptTradeOpcode);
DEFINE_HANDLER(CMSG_ACCEPT_WARGAME_INVITE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_ACTIVATE_TAXI, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleActivateTaxiOpcode);
DEFINE_HANDLER(CMSG_ACTIVATE_TAXI, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleActivateTaxiOpcode);
DEFINE_HANDLER(CMSG_ADDON_LIST, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_ADD_BATTLENET_FRIEND, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_ADD_FRIEND, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAddFriendOpcode);