2017-08-08 13:53:47 +02:00
|
|
|
#ifndef _ZONE_H
|
|
|
|
#define _ZONE_H
|
|
|
|
|
|
|
|
#include <unordered_map>
|
2018-03-06 22:22:19 +01:00
|
|
|
#include <Common.h>
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
#include "Cell.h"
|
|
|
|
#include "CellHandler.h"
|
|
|
|
|
2017-12-08 15:38:25 +01:00
|
|
|
#include "Forwards.h"
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
#include <set>
|
2018-02-28 10:26:03 +01:00
|
|
|
#include <map>
|
2017-08-08 13:53:47 +02:00
|
|
|
#include <boost/enable_shared_from_this.hpp>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2018-02-28 10:26:03 +01:00
|
|
|
|
2017-08-08 13:53:47 +02:00
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
class Session;
|
|
|
|
|
|
|
|
class ZonePosition;
|
|
|
|
|
2018-01-27 23:52:49 +01:00
|
|
|
using SessionSet = std::set< SessionPtr >;
|
2018-02-28 10:26:03 +01:00
|
|
|
namespace Data
|
|
|
|
{
|
|
|
|
struct InstanceContent;
|
|
|
|
struct TerritoryType;
|
|
|
|
}
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
class Zone : public CellHandler< Cell >, public boost::enable_shared_from_this< Zone >
|
|
|
|
{
|
|
|
|
protected:
|
2018-01-27 23:52:49 +01:00
|
|
|
uint32_t m_territoryId;
|
|
|
|
uint32_t m_guId;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-01-27 23:52:49 +01:00
|
|
|
std::string m_placeName;
|
|
|
|
std::string m_internalName;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2017-12-08 15:38:25 +01:00
|
|
|
std::unordered_map< int32_t, Entity::PlayerPtr > m_playerMap;
|
2018-02-21 11:28:34 +01:00
|
|
|
std::unordered_map< int32_t, Entity::EventObjectPtr > m_eventObjects;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
SessionSet m_sessionSet;
|
|
|
|
|
2018-02-14 21:11:23 +01:00
|
|
|
Common::Weather m_currentWeather;
|
|
|
|
Common::Weather m_weatherOverride;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
uint64_t m_lastMobUpdate;
|
|
|
|
|
2018-02-03 02:11:29 +11:00
|
|
|
uint16_t m_currentFestivalId;
|
2018-02-01 23:32:59 +01:00
|
|
|
boost::shared_ptr< Data::TerritoryType > m_territoryTypeInfo;
|
|
|
|
|
|
|
|
std::map< uint8_t, int32_t> m_weatherRateMap;
|
2018-02-03 02:11:29 +11:00
|
|
|
|
2018-02-23 23:47:21 +01:00
|
|
|
uint32_t m_nextEObjId;
|
|
|
|
|
2017-08-08 13:53:47 +02:00
|
|
|
public:
|
|
|
|
Zone();
|
|
|
|
|
2018-01-29 18:10:11 +11:00
|
|
|
Zone( uint16_t territoryId, uint32_t guId, const std::string& internalName, const std::string& placeName );
|
2017-08-08 13:53:47 +02:00
|
|
|
virtual ~Zone();
|
|
|
|
|
|
|
|
/*! overrides the zone's weather, set to 0 to unlock */
|
2018-02-14 21:11:23 +01:00
|
|
|
void setWeatherOverride( Common::Weather weather );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-14 21:11:23 +01:00
|
|
|
Common::Weather getCurrentWeather() const;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-03 02:11:29 +11:00
|
|
|
uint16_t getCurrentFestival() const;
|
|
|
|
void setCurrentFestival( uint16_t festivalId );
|
|
|
|
|
2018-02-23 23:47:21 +01:00
|
|
|
virtual bool init();
|
|
|
|
|
2017-08-08 13:53:47 +02:00
|
|
|
virtual void loadCellCache();
|
2018-02-06 00:01:23 +01:00
|
|
|
virtual uint32_t getTerritoryId() const;
|
2018-03-05 22:10:14 +11:00
|
|
|
virtual void onBeforePlayerZoneIn( Entity::Player &player ) {};
|
|
|
|
virtual void onPlayerZoneIn( Entity::Player &player );
|
2018-02-10 01:21:31 +01:00
|
|
|
virtual void onFinishLoading( Entity::Player& player );
|
|
|
|
virtual void onInitDirector( Entity::Player& player );
|
2018-07-17 22:39:04 +02:00
|
|
|
virtual void onDirectorSync( Entity::Player& player ) {};
|
2018-02-10 01:21:31 +01:00
|
|
|
virtual void onLeaveTerritory( Entity::Player& player );
|
2018-02-04 23:35:16 +01:00
|
|
|
virtual void onUpdate( uint32_t currTime );
|
2018-02-23 23:47:21 +01:00
|
|
|
virtual void onRegisterEObj( Entity::EventObjectPtr object ) {};
|
2018-03-05 22:10:14 +11:00
|
|
|
virtual void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-14 21:11:23 +01:00
|
|
|
Common::Weather getNextWeather();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-22 22:15:32 +01:00
|
|
|
void pushActor( Entity::ActorPtr pActor );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-22 22:15:32 +01:00
|
|
|
void removeActor( Entity::ActorPtr pActor );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-22 18:12:36 +01:00
|
|
|
void updateActorPosition( Entity::Actor &pActor );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
bool isCellActive( uint32_t x, uint32_t y );
|
|
|
|
|
2017-08-11 22:56:30 +01:00
|
|
|
void updateCellActivity( uint32_t x, uint32_t y, int32_t radius );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-22 22:15:32 +01:00
|
|
|
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-06-28 00:07:07 +02:00
|
|
|
void queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range, Network::Packets::FFXIVPacketBasePtr pPacketEntry );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-06 00:01:23 +01:00
|
|
|
uint32_t getGuId() const;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-23 23:47:21 +01:00
|
|
|
uint32_t getNextEObjId();
|
|
|
|
|
2017-08-08 13:53:47 +02:00
|
|
|
const std::string& getName() const;
|
|
|
|
const std::string& getInternalName() const;
|
|
|
|
|
|
|
|
std::size_t getPopCount() const;
|
2018-02-14 21:11:23 +01:00
|
|
|
void loadWeatherRates();
|
2017-08-08 13:53:47 +02:00
|
|
|
bool checkWeather();
|
2018-02-21 12:48:27 +01:00
|
|
|
//void updateBnpcs( int64_t tickCount );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-04 23:35:16 +01:00
|
|
|
bool update( uint32_t currTime );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-02-14 20:44:35 +01:00
|
|
|
void updateSessions( bool changedWeather );
|
|
|
|
|
2018-02-27 02:13:01 +11:00
|
|
|
Entity::EventObjectPtr registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
|
2018-03-04 17:41:17 +11:00
|
|
|
uint8_t state, Common::FFXIVARR_POSITION3 pos, float scale, float rotation );
|
2018-02-25 01:23:40 +01:00
|
|
|
|
2018-02-20 23:42:09 +01:00
|
|
|
void registerEObj( Entity::EventObjectPtr object );
|
|
|
|
Entity::EventObjectPtr getEObj( uint32_t objId );
|
2018-02-10 21:53:16 +11:00
|
|
|
|
|
|
|
InstanceContentPtr getAsInstanceContent();
|
|
|
|
|
2017-08-08 13:53:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|