mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
Changed multi-segment taxi paths to fly nearby flight masters along the way, not directly through them. Taxi cost on multi-segment paths is now charged per segment when it is started. Properly send taxi node status on login, as well as if the taxi master is out of range. Apply reputation discount to all points in multi-segment paths. Properly clean up list of taxi destinations upon arrival at final node. Teleport players to the destination taxi node location instead of their current ground position. Don't start a spline with just 1 point in FlightPathMovementGenerator Source: TrinityCore.
87 lines
3.0 KiB
C++
87 lines
3.0 KiB
C++
/*
|
|
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU Affero General Public License as published by the
|
|
* Free Software Foundation; either version 3 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 Affero 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/>.
|
|
*/
|
|
|
|
#ifndef __PLAYER_TAXI_H__
|
|
#define __PLAYER_TAXI_H__
|
|
|
|
#include "DBCStructure.h"
|
|
#include <vector>
|
|
|
|
class ByteBuffer;
|
|
|
|
class AC_GAME_API PlayerTaxi
|
|
{
|
|
public:
|
|
PlayerTaxi() : m_flightMasterFactionId(0) { m_taximask.fill(0); }
|
|
~PlayerTaxi() = default;
|
|
|
|
// Nodes
|
|
void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level);
|
|
bool LoadTaxiMask(std::string_view data);
|
|
|
|
[[nodiscard]] bool IsTaximaskNodeKnown(uint32 nodeidx) const
|
|
{
|
|
uint8 field = uint8((nodeidx - 1) / 32);
|
|
uint32 submask = 1 << ((nodeidx - 1) % 32);
|
|
return (m_taximask[field] & submask) == submask;
|
|
}
|
|
|
|
bool SetTaximaskNode(uint32 nodeidx)
|
|
{
|
|
uint8 field = uint8((nodeidx - 1) / 32);
|
|
uint32 submask = 1 << ((nodeidx - 1) % 32);
|
|
if ((m_taximask[field] & submask) != submask)
|
|
{
|
|
m_taximask[field] |= submask;
|
|
return true;
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
|
|
void AppendTaximaskTo(ByteBuffer& data, bool all);
|
|
|
|
// Destinations
|
|
bool LoadTaxiDestinationsFromString(std::string const& values, TeamId teamId);
|
|
std::string SaveTaxiDestinationsToString();
|
|
|
|
void ClearTaxiDestinations() { m_TaxiDestinations.clear(); }
|
|
void AddTaxiDestination(uint32 dest) { m_TaxiDestinations.push_back(dest); }
|
|
[[nodiscard]] uint32 GetTaxiSource() const { return m_TaxiDestinations.empty() ? 0 : m_TaxiDestinations.front(); }
|
|
[[nodiscard]] uint32 GetTaxiDestination() const { return m_TaxiDestinations.size() < 2 ? 0 : m_TaxiDestinations[1]; }
|
|
[[nodiscard]] uint32 GetCurrentTaxiPath() const;
|
|
uint32 NextTaxiDestination()
|
|
{
|
|
m_TaxiDestinations.pop_front();
|
|
return GetTaxiDestination();
|
|
}
|
|
|
|
[[nodiscard]] std::deque<uint32> const& GetPath() const { return m_TaxiDestinations; }
|
|
[[nodiscard]] bool empty() const { return m_TaxiDestinations.empty(); }
|
|
[[nodiscard]] FactionTemplateEntry const* GetFlightMasterFactionTemplate() const;
|
|
void SetFlightMasterFactionTemplateId(uint32 factionTemplateId) { m_flightMasterFactionId = factionTemplateId; }
|
|
|
|
friend std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi);
|
|
|
|
private:
|
|
TaxiMask m_taximask;
|
|
std::deque<uint32> m_TaxiDestinations;
|
|
uint32 m_flightMasterFactionId;
|
|
};
|
|
|
|
#endif
|