mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
commit
3d5ad28df8
171 changed files with 1285 additions and 1484 deletions
|
@ -26,14 +26,13 @@
|
|||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <Framework.h>
|
||||
#include <Logging/Logger.h>
|
||||
|
||||
#include "SapphireApi.h"
|
||||
|
||||
#include <Util/CrashHandler.h>
|
||||
|
||||
Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
[[maybe_unused]] Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
|
||||
Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection > g_charaDb;
|
||||
Sapphire::Data::ExdDataGenerated g_exdDataGen;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "Logging/Logger.h"
|
||||
|
||||
#include "PreparedStatement.h"
|
||||
#include "Framework.h"
|
||||
|
||||
Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
|
||||
m_reconnecting( false ),
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "StatementTask.h"
|
||||
#include "Operation.h"
|
||||
#include "ZoneDbConnection.h"
|
||||
#include "Framework.h"
|
||||
|
||||
#include "Logging/Logger.h"
|
||||
#include <mysql.h>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#include "Framework.h"
|
||||
#include "Logging/Logger.h"
|
|
@ -1,37 +0,0 @@
|
|||
#ifndef _CORE_FRAMEWORK_H
|
||||
#define _CORE_FRAMEWORK_H
|
||||
|
||||
#include <map>
|
||||
#include <typeindex>
|
||||
#include <typeinfo>
|
||||
#include <memory>
|
||||
#include <cassert>
|
||||
|
||||
namespace Sapphire
|
||||
{
|
||||
|
||||
class Framework
|
||||
{
|
||||
using TypenameToObject = std::map< std::type_index, std::shared_ptr< void > >;
|
||||
TypenameToObject ObjectMap;
|
||||
|
||||
public:
|
||||
template< typename T >
|
||||
std::shared_ptr< T > get()
|
||||
{
|
||||
auto iType = ObjectMap.find( typeid( T ) );
|
||||
assert( !( iType == ObjectMap.end() ) );
|
||||
return std::static_pointer_cast< T >( iType->second );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
void set( std::shared_ptr< T > value )
|
||||
{
|
||||
assert( value ); // why would anyone store nullptrs....
|
||||
ObjectMap[ typeid( T ) ] = value;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // _CORE_FRAMEWORK_H
|
|
@ -1,17 +1,15 @@
|
|||
#include "Connection.h"
|
||||
#include "Hive.h"
|
||||
#include <functional>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
Network::Connection::Connection( HivePtr hive, FrameworkPtr pFw ) :
|
||||
Network::Connection::Connection( HivePtr hive ) :
|
||||
m_hive( hive ),
|
||||
m_socket( hive->getService() ),
|
||||
m_io_strand( hive->getService() ),
|
||||
m_receive_buffer_size( 32000 ),
|
||||
m_error_state( 0 ),
|
||||
m_pFw( pFw )
|
||||
m_error_state( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,8 @@ namespace Sapphire::Network
|
|||
std::list< std::vector< uint8_t > > m_pending_sends;
|
||||
int32_t m_receive_buffer_size;
|
||||
std::atomic< uint32_t > m_error_state;
|
||||
FrameworkPtr m_pFw;
|
||||
|
||||
Connection( HivePtr hive, FrameworkPtr pFw );
|
||||
Connection( HivePtr hive );
|
||||
|
||||
virtual ~Connection();
|
||||
|
||||
|
@ -141,13 +140,13 @@ namespace Sapphire::Network
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
template< class T >
|
||||
std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive, FrameworkPtr pFw )
|
||||
std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive )
|
||||
{
|
||||
try
|
||||
{
|
||||
AcceptorPtr acceptor( new Acceptor( pHive ) );
|
||||
acceptor->listen( listenIp, port );
|
||||
std::shared_ptr< T > connection( new T( pHive, acceptor, pFw ) );
|
||||
std::shared_ptr< T > connection( new T( pHive, acceptor ) );
|
||||
acceptor->accept( connection );
|
||||
return connection;
|
||||
}
|
||||
|
|
115
src/common/Service.h
Normal file
115
src/common/Service.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
#ifndef SAPPHIRE_SERVICE_H
|
||||
#define SAPPHIRE_SERVICE_H
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// stolen from: https://github.com/skypjack/entt/blob/master/src/entt/locator/locator.hpp
|
||||
|
||||
namespace Sapphire::Common
|
||||
{
|
||||
/**
|
||||
* @brief Service locator, nothing more.
|
||||
*
|
||||
* A service locator can be used to do what it promises: locate services.<br/>
|
||||
* Usually service locators are tightly bound to the services they expose and
|
||||
* thus it's hard to define a general purpose class to do that. This template
|
||||
* based implementation tries to fill the gap and to get rid of the burden of
|
||||
* defining a different specific locator for each application.
|
||||
*
|
||||
* @tparam SvcType Type of service managed by the locator.
|
||||
*/
|
||||
template< typename SvcType >
|
||||
struct Service
|
||||
{
|
||||
/*! @brief Type of service offered. */
|
||||
using ServiceType = SvcType;
|
||||
|
||||
/*! @brief Default constructor, deleted on purpose. */
|
||||
Service() = delete;
|
||||
|
||||
/*! @brief Default destructor, deleted on purpose. */
|
||||
~Service() = delete;
|
||||
|
||||
/**
|
||||
* @brief Tests if a valid service implementation is set.
|
||||
* @return True if the service is set, false otherwise.
|
||||
*/
|
||||
static bool empty() noexcept
|
||||
{
|
||||
return !static_cast< bool >( service );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a weak pointer to a service implementation, if any.
|
||||
*
|
||||
* Clients of a service shouldn't retain references to it. The recommended
|
||||
* way is to retrieve the service implementation currently set each and
|
||||
* every time the need of using it arises. Otherwise users can incur in
|
||||
* unexpected behaviors.
|
||||
*
|
||||
* @return A reference to the service implementation currently set, if any.
|
||||
*/
|
||||
static std::weak_ptr< SvcType > get() noexcept
|
||||
{
|
||||
return service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a weak reference to a service implementation, if any.
|
||||
*
|
||||
* Clients of a service shouldn't retain references to it. The recommended
|
||||
* way is to retrieve the service implementation currently set each and
|
||||
* every time the need of using it arises. Otherwise users can incur in
|
||||
* unexpected behaviors.
|
||||
*
|
||||
* @warning
|
||||
* In case no service implementation has been set, a call to this function
|
||||
* results in undefined behavior.
|
||||
*
|
||||
* @return A reference to the service implementation currently set, if any.
|
||||
*/
|
||||
static SvcType& ref() noexcept
|
||||
{
|
||||
return *service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets or replaces a service.
|
||||
* @tparam Impl Type of the new service to use.
|
||||
* @tparam Args Types of arguments to use to construct the service.
|
||||
* @param args Parameters to use to construct the service.
|
||||
*/
|
||||
template< typename Impl = SvcType, typename... Args >
|
||||
static void set( Args&& ... args )
|
||||
{
|
||||
service = std::make_shared< Impl >( std::forward< Args >( args )... );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets or replaces a service.
|
||||
* @param ptr Service to use to replace the current one.
|
||||
*/
|
||||
static void set( std::shared_ptr< SvcType > ptr )
|
||||
{
|
||||
assert( static_cast< bool >( ptr ) );
|
||||
service = std::move( ptr );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resets a service.
|
||||
*
|
||||
* The service is no longer valid after a reset.
|
||||
*/
|
||||
static void reset()
|
||||
{
|
||||
service.reset();
|
||||
}
|
||||
|
||||
private:
|
||||
inline static std::shared_ptr< SvcType > service = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SAPPHIRE_SERVICE_H
|
|
@ -8,7 +8,7 @@
|
|||
#include <common/Util/CrashHandler.h>
|
||||
#include <common/Config/ConfigMgr.h>
|
||||
|
||||
Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
[[maybe_unused]] Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
|
|
|
@ -12,11 +12,6 @@ x ## Ptr make_ ## x( Args &&...args ) { \
|
|||
return std::make_shared< x >( std::forward< Args >( args ) ... ); }\
|
||||
typedef std::vector< x > x ## PtrList;
|
||||
|
||||
namespace Sapphire
|
||||
{
|
||||
TYPE_FORWARD( Framework );
|
||||
}
|
||||
|
||||
namespace Sapphire::Lobby
|
||||
{
|
||||
TYPE_FORWARD( LobbySession );
|
||||
|
|
|
@ -25,9 +25,8 @@ extern Lobby::ServerLobby g_serverLobby;
|
|||
extern Lobby::RestConnector g_restConnector;
|
||||
|
||||
Lobby::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive,
|
||||
Sapphire::Network::AcceptorPtr pAcceptor,
|
||||
FrameworkPtr pFw ) :
|
||||
Sapphire::Network::Connection( pHive, pFw ),
|
||||
Sapphire::Network::AcceptorPtr pAcceptor ) :
|
||||
Sapphire::Network::Connection( pHive ),
|
||||
m_pAcceptor( pAcceptor ),
|
||||
m_bEncryptionInitialized( false )
|
||||
{
|
||||
|
@ -42,7 +41,7 @@ Lobby::GameConnection::~GameConnection()
|
|||
// overwrite the parents onConnect for our game socket needs
|
||||
void Lobby::GameConnection::onAccept( const std::string& host, uint16_t port )
|
||||
{
|
||||
auto connection = make_GameConnection( m_hive, m_pAcceptor, m_pFw );
|
||||
auto connection = make_GameConnection( m_hive, m_pAcceptor );
|
||||
m_pAcceptor->accept( connection );
|
||||
|
||||
Logger::info( "Connect from {0}", m_socket.remote_endpoint().address().to_string() );
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Sapphire::Lobby
|
|||
std::vector< uint8_t > m_packets;
|
||||
|
||||
public:
|
||||
GameConnection( Network::HivePtr pHive, Network::AcceptorPtr pAcceptor, FrameworkPtr pFw );
|
||||
GameConnection( Network::HivePtr pHive, Network::AcceptorPtr pAcceptor );
|
||||
|
||||
~GameConnection();
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <Logging/Logger.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
#include "ServerLobby.h"
|
||||
|
||||
|
@ -65,9 +64,8 @@ namespace Sapphire::Lobby
|
|||
|
||||
Logger::setLogLevel( m_config.global.general.logLevel );
|
||||
|
||||
auto pFw = make_Framework();
|
||||
auto hive = Network::make_Hive();
|
||||
Network::addServerToHive< GameConnection >( m_ip, m_port, hive, pFw );
|
||||
Network::addServerToHive< GameConnection >( m_ip, m_port, hive );
|
||||
|
||||
Logger::info( "Lobby server running on {0}:{1}", m_ip, m_port );
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <Util/CrashHandler.h>
|
||||
|
||||
Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
[[maybe_unused]] Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
|
||||
Sapphire::Lobby::ServerLobby g_serverLobby( "lobby.ini" );
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
|
||||
#include <Framework.h>
|
||||
#include <Manager/ShopMgr.h>
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -31,9 +31,10 @@ private:
|
|||
// buy
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
auto shopMgr = framework()->get< Sapphire::World::Manager::ShopMgr >();
|
||||
auto& shopMgr = Common::Service< Sapphire::World::Manager::ShopMgr >::ref();
|
||||
|
||||
shopMgr->purchaseGilShopItem( player, result.eventId, result.param3, result.param4 );
|
||||
|
||||
shopMgr.purchaseGilShopItem( player, result.eventId, result.param3, result.param4 );
|
||||
}
|
||||
|
||||
// sell
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
|
||||
#include <Framework.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
|
||||
#include <Service.h>
|
||||
|
||||
|
||||
using namespace Sapphire;
|
||||
|
@ -109,11 +108,9 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pExdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
||||
if( !pExdData )
|
||||
return;
|
||||
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto aetherInfo = pExdData->get< Sapphire::Data::Aetheryte >( eventId & 0xFFFF );
|
||||
auto aetherInfo = exdData.get< Sapphire::Data::Aetheryte >( eventId & 0xFFFF );
|
||||
if( !aetherInfo )
|
||||
return;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
|
||||
#include <Framework.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Territory/HousingZone.h>
|
||||
#include <Manager/PlayerMgr.h>
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -21,16 +21,14 @@ public:
|
|||
{
|
||||
player.playScene( eventId, 0, HIDE_HOTBAR | NO_DEFAULT_CAMERA, [this, eventId]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
auto pExdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
||||
if( !pExdData )
|
||||
return;
|
||||
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto housingZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !housingZone )
|
||||
return;
|
||||
|
||||
// param2 is the index starting from 0 inside housingaethernet.exd, but the ID column starts at 0x001E0000........ wtf
|
||||
auto pHousingAethernet = pExdData->get< Sapphire::Data::HousingAethernet >( getId() + result.param2 );
|
||||
auto pHousingAethernet = exdData.get< Sapphire::Data::HousingAethernet >( getId() + result.param2 );
|
||||
if( !pHousingAethernet )
|
||||
return;
|
||||
|
||||
|
@ -42,8 +40,8 @@ public:
|
|||
// moving a player inside an event will crash the game so we end it here
|
||||
player.eventFinish( eventId, 1 );
|
||||
|
||||
auto playerMgr = framework()->get< Sapphire::World::Manager::PlayerMgr >();
|
||||
playerMgr->movePlayerToLandDestination( player, pHousingAethernet->level, housingZone->getWardNum() );
|
||||
auto& playerMgr = Common::Service< Sapphire::World::Manager::PlayerMgr >::ref();
|
||||
playerMgr.movePlayerToLandDestination( player, pHousingAethernet->level, housingZone->getWardNum() );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Actor/EventObject.h"
|
||||
#include "Territory/HousingZone.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Territory/Land.h"
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -26,9 +26,7 @@ public:
|
|||
if( result.param2 != 1 )
|
||||
return;
|
||||
|
||||
auto terriMgr = framework()->get< Sapphire::World::Manager::TerritoryMgr >();
|
||||
if( !terriMgr )
|
||||
return;
|
||||
auto& terriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||
|
||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !zone )
|
||||
|
@ -40,7 +38,7 @@ public:
|
|||
ident.wardNum = zone->getWardNum();
|
||||
ident.worldId = 67;
|
||||
|
||||
auto internalZone = terriMgr->findOrCreateHousingInterior( ident );
|
||||
auto internalZone = terriMgr.findOrCreateHousingInterior( ident );
|
||||
if( !internalZone )
|
||||
{
|
||||
// an error occurred during event movement
|
||||
|
@ -60,6 +58,7 @@ public:
|
|||
|
||||
switch( land->getSize() )
|
||||
{
|
||||
// todo: think there's actually a poprange for this? double czech
|
||||
case 0:
|
||||
{
|
||||
pos = { 0.1321167f, 0.f, 2.746273f };
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <Network/PacketWrappers/ActorControlSelfPacket.h>
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
|
||||
using namespace Sapphire;
|
||||
|
@ -25,9 +25,6 @@ public:
|
|||
{
|
||||
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
auto pFw = framework();
|
||||
if( !pFw )
|
||||
return LandPurchaseResult::ERR_INTERNAL;
|
||||
// Purchase Land
|
||||
if( result.param2 == 2 )
|
||||
{
|
||||
|
@ -36,9 +33,9 @@ public:
|
|||
|
||||
auto pTerritory = player.getCurrentTerritory();
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
||||
auto pHouMgr = pFw->get< HousingMgr >();
|
||||
auto& pHouMgr = Common::Service< HousingMgr >::ref();
|
||||
|
||||
LandPurchaseResult res = pHouMgr->purchaseLand( player, activeLand.plot,
|
||||
LandPurchaseResult res = pHouMgr.purchaseLand( player, activeLand.plot,
|
||||
static_cast< uint8_t >( result.param2 ) );
|
||||
|
||||
switch( res )
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include "Territory/InstanceObjectCache.h"
|
||||
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Framework.h>
|
||||
#include <Manager/PlayerMgr.h>
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -32,16 +32,16 @@ public:
|
|||
player.eventFinish( 1310721, 0 );
|
||||
player.eventFinish( getId(), 1 );
|
||||
|
||||
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
||||
auto pPopRange = framework()->get< Sapphire::InstanceObjectCache >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
auto& popRange = Common::Service< Sapphire::InstanceObjectCache >::ref();
|
||||
|
||||
auto warp = exdData->get< Sapphire::Data::Warp >( getId() );
|
||||
auto warp = exdData.get< Sapphire::Data::Warp >( getId() );
|
||||
if( !warp )
|
||||
return;
|
||||
|
||||
auto playerMgr = framework()->get< Sapphire::World::Manager::PlayerMgr >();
|
||||
auto& playerMgr = Common::Service< Sapphire::World::Manager::PlayerMgr >::ref();
|
||||
|
||||
auto pPop = pPopRange->getPopRange( warp->territoryType, warp->popRange );
|
||||
auto pPop = popRange.getPopRange( warp->territoryType, warp->popRange );
|
||||
|
||||
if( !pPop )
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
std::cout << "found!!";
|
||||
}
|
||||
|
||||
playerMgr->movePlayerToLandDestination( player, warp->popRange, result.param3 );
|
||||
playerMgr.movePlayerToLandDestination( player, warp->popRange, result.param3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -75,11 +75,9 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
||||
if( !exdData )
|
||||
return;
|
||||
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto warp = exdData->get< Sapphire::Data::Warp >( eventId );
|
||||
auto warp = exdData.get< Sapphire::Data::Warp >( eventId );
|
||||
if( !warp )
|
||||
return;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <ScriptObject.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include "Event/EventHandler.h"
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManFst001_00039
|
||||
// Quest Name: Coming to Gridania
|
||||
|
@ -96,8 +96,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <ScriptObject.h>
|
||||
#include "Event/EventHandler.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManFst002_00124
|
||||
// Quest Name: Close to Home
|
||||
|
@ -193,8 +193,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManFst003_00123
|
||||
// Quest Name: Close to Home
|
||||
|
@ -82,8 +82,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManFst004_00124
|
||||
// Quest Name: Close to Home
|
||||
|
@ -80,8 +80,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ManFst004::Actor0 )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "Manager/EventMgr.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManFst005_00445
|
||||
// Quest Name: Chasing Shadows
|
||||
|
@ -61,8 +61,8 @@ class ManFst005 : public Sapphire::ScriptAPI::EventScript
|
|||
// Event Handlers
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
@ -142,11 +142,10 @@ class ManFst005 : public Sapphire::ScriptAPI::EventScript
|
|||
{
|
||||
if( result.param2 == 1 )
|
||||
{
|
||||
auto pTeriMgr = framework()->get< Sapphire::World::Manager::TerritoryMgr >();
|
||||
if( !pTeriMgr )
|
||||
return;
|
||||
auto& pTeriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||
|
||||
player.eventFinish( result.eventId, 0 );
|
||||
pTeriMgr->createAndJoinQuestBattle( player, Questbattle0 );
|
||||
pTeriMgr.createAndJoinQuestBattle( player, Questbattle0 );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManSea001_00107
|
||||
// Quest Name: Coming to Limsa Lominsa
|
||||
|
@ -142,8 +142,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManSea002_00108
|
||||
// Quest Name: Close to Home
|
||||
|
@ -48,8 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManSea003_00109
|
||||
// Quest Name: Close to Home
|
||||
|
@ -64,8 +64,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManWil001_00594
|
||||
// Quest Name: Coming to Ul'dah
|
||||
|
@ -174,8 +174,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManWil002_00568
|
||||
// Quest Name: Close to Home
|
||||
|
@ -70,8 +70,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManWil003_00569
|
||||
// Quest Name: Close to Home
|
||||
|
@ -70,8 +70,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
// Quest Script: ManWil004_00570
|
||||
// Quest Name: Close to Home
|
||||
|
@ -70,8 +70,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -57,8 +57,8 @@ class ClsLnc000 : public Sapphire::ScriptAPI::EventScript
|
|||
// Event Handlers
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = framework()->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -73,8 +73,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -59,8 +59,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 && !player.hasQuest( getId() ) )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -52,8 +52,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -56,8 +56,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -48,8 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast<uint32_t>( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if ( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -56,8 +56,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -52,8 +52,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -55,8 +55,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -49,8 +49,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -161,8 +161,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
@ -182,8 +182,8 @@ public:
|
|||
|
||||
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 )
|
||||
Scene00100( player );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -56,8 +56,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -54,8 +54,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -49,8 +49,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -51,8 +51,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -47,8 +47,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -65,8 +65,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -56,8 +56,8 @@ class SubFst034 : public Sapphire::ScriptAPI::EventScript
|
|||
// Event Handlers
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -42,8 +42,8 @@ class SubFst039 : public Sapphire::ScriptAPI::EventScript
|
|||
// Event Handlers
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -57,8 +57,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -47,8 +47,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast<uint32_t>( actorId ) );
|
||||
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if ( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -65,8 +65,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -48,8 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -48,8 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -49,8 +49,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -53,8 +53,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -58,8 +58,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -51,8 +51,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <ctime>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -55,8 +55,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
@ -90,8 +90,8 @@ public:
|
|||
|
||||
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && emoteId == 41 && player.getQuestSeq( getId() ) == Seq1 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -55,8 +55,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -47,8 +47,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <ctime>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -63,8 +63,8 @@ class SubWil020 : public Sapphire::ScriptAPI::EventScript
|
|||
// Event Handlers
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
/*player.setQuestUI8BH( getId(), 0 );
|
||||
player.setQuestUI8AL( getId(), 0 );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -52,8 +52,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -52,8 +52,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -46,8 +46,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -48,8 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -51,8 +51,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <filesystem>
|
||||
|
||||
Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
[[maybe_unused]] Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||
|
||||
using namespace Sapphire;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <filesystem>
|
||||
|
||||
Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
[[maybe_unused]] Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
|
||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||
xiv::dat::GameData* gameData = nullptr;
|
||||
|
|
|
@ -27,8 +27,8 @@ using namespace Sapphire;
|
|||
const std::string onTalkStr(
|
||||
" void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n"
|
||||
" {\n"
|
||||
" auto pEventMgr = m_framework->get< World::Manager::EventMgr >();\n"
|
||||
" auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );\n"
|
||||
" auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();\n"
|
||||
" auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );\n"
|
||||
" }\n\n"
|
||||
);
|
||||
|
||||
|
@ -41,8 +41,8 @@ const std::string onWithinRangeStr(
|
|||
const std::string onEmoteStr(
|
||||
" void onEmote( uint32_t eventId, Entity::Player& player, uint64_t actorId, uint32_t emoteId ) override\n"
|
||||
" {\n"
|
||||
" auto pEventMgr = m_framework->get< World::Manager::EventMgr >();\n"
|
||||
" auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );\n"
|
||||
" auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();\n"
|
||||
" auto actor = eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );\n"
|
||||
" }\n\n"
|
||||
);
|
||||
|
||||
|
@ -86,7 +86,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
|||
"#include <Actor/Player.h>\n"
|
||||
"#include \"Manager/EventMgr.h\"\n"
|
||||
"#include <ScriptObject.h>\n"
|
||||
"#include \"Framework.h\"\n\n"
|
||||
"#include <Service.h>\n\n"
|
||||
);
|
||||
|
||||
std::size_t splitPos( pQuestData->id.find( "_" ) );
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <filesystem>
|
||||
|
||||
Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
[[maybe_unused]] Sapphire::Common::Util::CrashHandler crashHandler;
|
||||
|
||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||
xiv::dat::GameData* gameData = nullptr;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Util/Util.h>
|
||||
#include "Framework.h"
|
||||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include <Math/CalcStats.h>
|
||||
|
@ -23,6 +22,7 @@
|
|||
|
||||
#include <Util/ActorFilter.h>
|
||||
#include <Util/UtilMath.h>
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::Common;
|
||||
|
@ -36,15 +36,14 @@ using namespace Sapphire::World;
|
|||
Action::Action::Action() = default;
|
||||
Action::Action::~Action() = default;
|
||||
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, FrameworkPtr fw ) :
|
||||
Action( std::move( caster ), actionId, sequence, nullptr, std::move( fw ) )
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence) :
|
||||
Action( std::move( caster ), actionId, sequence, nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence,
|
||||
Data::ActionPtr actionData, FrameworkPtr fw ) :
|
||||
Data::ActionPtr actionData ) :
|
||||
m_pSource( std::move( caster ) ),
|
||||
m_pFw( std::move( fw ) ),
|
||||
m_actionData( std::move( actionData ) ),
|
||||
m_id( actionId ),
|
||||
m_targetId( 0 ),
|
||||
|
@ -64,10 +63,9 @@ bool Action::Action::init()
|
|||
if( !m_actionData )
|
||||
{
|
||||
// need to get actionData
|
||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
assert( exdData );
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto actionData = exdData->get< Data::Action >( m_id );
|
||||
auto actionData = exdData.get< Data::Action >( m_id );
|
||||
assert( actionData );
|
||||
|
||||
m_actionData = actionData;
|
||||
|
@ -290,10 +288,10 @@ void Action::Action::start()
|
|||
m_recastTimeMs / 10 );
|
||||
player->queuePacket( actionStartPkt );
|
||||
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
|
||||
// check the lut too and see if we have something usable, otherwise cancel the cast
|
||||
if( !pScriptMgr->onStart( *this ) && !ActionLut::validEntryExists( static_cast< uint16_t >( getId() ) ) )
|
||||
if( !scriptMgr.onStart( *this ) && !ActionLut::validEntryExists( static_cast< uint16_t >( getId() ) ) )
|
||||
{
|
||||
// script not implemented and insufficient lut data (no potencies)
|
||||
interrupt();
|
||||
|
@ -342,8 +340,8 @@ void Action::Action::interrupt()
|
|||
m_pSource->sendToInRangeSet( control, true );
|
||||
}
|
||||
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
pScriptMgr->onInterrupt( *this );
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
scriptMgr.onInterrupt( *this );
|
||||
}
|
||||
|
||||
void Action::Action::execute()
|
||||
|
@ -357,7 +355,7 @@ void Action::Action::execute()
|
|||
return;
|
||||
}
|
||||
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
|
||||
if( hasCastTime() )
|
||||
{
|
||||
|
@ -385,7 +383,7 @@ void Action::Action::execute()
|
|||
}
|
||||
else if( auto player = m_pSource->getAsPlayer() )
|
||||
{
|
||||
pScriptMgr->onEObjHit( *player, m_targetId, getId() );
|
||||
scriptMgr.onEObjHit( *player, m_targetId, getId() );
|
||||
}
|
||||
|
||||
// set currently casted action as the combo action if it interrupts a combo
|
||||
|
@ -455,10 +453,10 @@ void Action::Action::buildEffects()
|
|||
{
|
||||
snapshotAffectedActors( m_hitActors );
|
||||
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
auto hasLutEntry = hasValidLutEntry();
|
||||
|
||||
if( !pScriptMgr->onExecute( *this ) && !hasLutEntry )
|
||||
if( !scriptMgr.onExecute( *this ) && !hasLutEntry )
|
||||
{
|
||||
if( auto player = m_pSource->getAsPlayer() )
|
||||
{
|
||||
|
@ -577,10 +575,9 @@ bool Action::Action::playerPreCheck( Entity::Player& player )
|
|||
if( actionClass != Common::ClassJob::Adventurer && currentClass != actionClass && !m_actionData->isRoleAction )
|
||||
{
|
||||
// check if not a base class action
|
||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
assert( exdData );
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto classJob = exdData->get< Data::ClassJob >( static_cast< uint8_t >( currentClass ) );
|
||||
auto classJob = exdData.get< Data::ClassJob >( static_cast< uint8_t >( currentClass ) );
|
||||
if( !classJob )
|
||||
return false;
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace Sapphire::World::Action
|
|||
public:
|
||||
|
||||
Action();
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, FrameworkPtr fw );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, Data::ActionPtr actionData, FrameworkPtr fw );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, Data::ActionPtr actionData );
|
||||
|
||||
virtual ~Action();
|
||||
|
||||
|
@ -183,7 +183,6 @@ namespace Sapphire::World::Action
|
|||
|
||||
Common::ActionInterruptType m_interruptType;
|
||||
|
||||
FrameworkPtr m_pFw;
|
||||
Data::ActionPtr m_actionData;
|
||||
|
||||
Common::FFXIVARR_POSITION3 m_pos;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <Logging/Logger.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Network/PacketWrappers/ActorControlPacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlSelfPacket.h"
|
||||
|
@ -9,7 +10,6 @@
|
|||
#include "Actor/Player.h"
|
||||
|
||||
#include "EventAction.h"
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World;
|
||||
|
@ -20,15 +20,13 @@ using namespace Sapphire::Network::Packets::Server;
|
|||
using namespace Sapphire::Network::ActorControl;
|
||||
|
||||
Action::EventAction::EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
||||
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional,
|
||||
FrameworkPtr pFw )
|
||||
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional )
|
||||
{
|
||||
m_additional = additional;
|
||||
m_eventId = eventId;
|
||||
m_id = action;
|
||||
m_pFw = pFw;
|
||||
auto pExdData = pFw->get< Data::ExdDataGenerated >();
|
||||
m_castTimeMs = pExdData->get< Sapphire::Data::EventAction >( action )->castTime * 1000; // TODO: Add security checks.
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
m_castTimeMs = exdData.get< Sapphire::Data::EventAction >( action )->castTime * 1000; // TODO: Add security checks.
|
||||
m_onActionFinishClb = std::move( finishRef );
|
||||
m_onActionInterruptClb = std::move( interruptRef );
|
||||
m_pSource = std::move( pActor );
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
virtual ~EventAction();
|
||||
|
||||
EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
||||
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional, FrameworkPtr pFw );
|
||||
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional );
|
||||
|
||||
void start() override;
|
||||
|
||||
|
|
|
@ -10,14 +10,13 @@ using namespace Sapphire::World::Action;
|
|||
|
||||
ItemAction::ItemAction( Sapphire::Entity::CharaPtr source, uint32_t itemId,
|
||||
Sapphire::Data::ItemActionPtr itemActionData, uint16_t itemSourceSlot,
|
||||
uint16_t itemSourceContainer, Sapphire::FrameworkPtr fw ) :
|
||||
uint16_t itemSourceContainer ) :
|
||||
m_itemAction( std::move( itemActionData ) ),
|
||||
m_itemSourceSlot( itemSourceSlot ),
|
||||
m_itemSourceContainer( itemSourceContainer )
|
||||
{
|
||||
m_id = itemId;
|
||||
m_pSource = std::move( source );
|
||||
m_pFw = std::move( fw );
|
||||
}
|
||||
|
||||
void ItemAction::start()
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Sapphire::World::Action
|
|||
{
|
||||
public:
|
||||
ItemAction( Entity::CharaPtr source, uint32_t itemId, Data::ItemActionPtr itemActionData,
|
||||
uint16_t itemSourceSlot, uint16_t itemSourceContainer, FrameworkPtr fw );
|
||||
uint16_t itemSourceSlot, uint16_t itemSourceContainer );
|
||||
virtual ~ItemAction() = default;
|
||||
|
||||
void start() override;
|
||||
|
|
|
@ -15,8 +15,8 @@ using namespace Sapphire::Network::Packets::Server;
|
|||
using namespace Sapphire::Network::ActorControl;
|
||||
using namespace Sapphire::World::Action;
|
||||
|
||||
MountAction::MountAction( Sapphire::Entity::CharaPtr source, uint16_t mountId, uint16_t sequence, Data::ActionPtr actionData, Sapphire::FrameworkPtr fw ) :
|
||||
Action::Action( source, 4, sequence, actionData, fw ),
|
||||
MountAction::MountAction( Sapphire::Entity::CharaPtr source, uint16_t mountId, uint16_t sequence, Data::ActionPtr actionData ) :
|
||||
Action::Action( source, 4, sequence, actionData ),
|
||||
m_mountId( mountId )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Sapphire::World::Action
|
|||
class MountAction : public Action
|
||||
{
|
||||
public:
|
||||
MountAction( Entity::CharaPtr source, uint16_t mountId, uint16_t sequence, Data::ActionPtr actionData, FrameworkPtr fw );
|
||||
MountAction( Entity::CharaPtr source, uint16_t mountId, uint16_t sequence, Data::ActionPtr actionData );
|
||||
virtual ~MountAction() = default;
|
||||
|
||||
bool preCheck() override;
|
||||
|
|
|
@ -35,26 +35,26 @@
|
|||
#include "BNpcTemplate.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "Framework.h"
|
||||
|
||||
#include <Manager/TerritoryMgr.h>
|
||||
#include <Manager/NaviMgr.h>
|
||||
#include <Manager/TerritoryMgr.h>
|
||||
#include <Manager/RNGMgr.h>
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
||||
Sapphire::Entity::BNpc::BNpc( FrameworkPtr pFw ) :
|
||||
Npc( ObjKind::BattleNpc, pFw )
|
||||
Sapphire::Entity::BNpc::BNpc() :
|
||||
Npc( ObjKind::BattleNpc )
|
||||
{
|
||||
}
|
||||
|
||||
Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
|
||||
uint8_t level, uint32_t maxHp, TerritoryPtr pZone, FrameworkPtr pFw ) :
|
||||
Npc( ObjKind::BattleNpc, pFw )
|
||||
uint8_t level, uint32_t maxHp, TerritoryPtr pZone ) :
|
||||
Npc( ObjKind::BattleNpc )
|
||||
{
|
||||
m_id = id;
|
||||
m_modelChara = pTemplate->getModelChara();
|
||||
|
@ -99,18 +99,17 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX
|
|||
memcpy( m_customize, pTemplate->getCustomize(), sizeof( m_customize ) );
|
||||
memcpy( m_modelEquip, pTemplate->getModelEquip(), sizeof( m_modelEquip ) );
|
||||
|
||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
assert( exdData );
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto bNpcBaseData = exdData->get< Data::BNpcBase >( m_bNpcBaseId );
|
||||
auto bNpcBaseData = exdData.get< Data::BNpcBase >( m_bNpcBaseId );
|
||||
assert( bNpcBaseData );
|
||||
|
||||
m_radius = bNpcBaseData->scale;
|
||||
|
||||
auto modelChara = exdData->get< Data::ModelChara >( bNpcBaseData->modelChara );
|
||||
auto modelChara = exdData.get< Data::ModelChara >( bNpcBaseData->modelChara );
|
||||
if( modelChara )
|
||||
{
|
||||
auto modelSkeleton = exdData->get< Data::ModelSkeleton >( modelChara->model );
|
||||
auto modelSkeleton = exdData.get< Data::ModelSkeleton >( modelChara->model );
|
||||
if( modelSkeleton )
|
||||
m_radius *= modelSkeleton->radius;
|
||||
}
|
||||
|
@ -359,8 +358,8 @@ bool Sapphire::Entity::BNpc::hateListHasActor( Sapphire::Entity::CharaPtr pChara
|
|||
|
||||
void Sapphire::Entity::BNpc::aggro( Sapphire::Entity::CharaPtr pChara )
|
||||
{
|
||||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
||||
auto variation = static_cast< uint32_t >( pRNGMgr->getRandGenerator< float >( 500, 1000 ).next() );
|
||||
auto& pRNGMgr = Common::Service< World::Manager::RNGMgr >::ref();
|
||||
auto variation = static_cast< uint32_t >( pRNGMgr.getRandGenerator< float >( 500, 1000 ).next() );
|
||||
|
||||
m_lastAttack = Util::getTimeMs() + variation;
|
||||
hateListUpdate( pChara, 1 );
|
||||
|
@ -692,7 +691,6 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
|
|||
m_lastAttack = tick;
|
||||
srand( static_cast< uint32_t >( tick ) );
|
||||
|
||||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
||||
auto damage = Math::CalcStats::calcAutoAttackDamage( *this );
|
||||
|
||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
|
||||
|
@ -716,10 +714,10 @@ void Sapphire::Entity::BNpc::calculateStats()
|
|||
uint8_t level = getLevel();
|
||||
uint8_t job = static_cast< uint8_t >( getClass() );
|
||||
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto classInfo = pExdData->get< Sapphire::Data::ClassJob >( job );
|
||||
auto paramGrowthInfo = pExdData->get< Sapphire::Data::ParamGrow >( level );
|
||||
auto classInfo = exdData.get< Sapphire::Data::ClassJob >( job );
|
||||
auto paramGrowthInfo = exdData.get< Sapphire::Data::ParamGrow >( level );
|
||||
|
||||
float base = Math::CalcStats::calculateBaseStat( *this );
|
||||
|
||||
|
|
|
@ -49,9 +49,9 @@ namespace Sapphire::Entity
|
|||
{
|
||||
|
||||
public:
|
||||
BNpc( FrameworkPtr pFw );
|
||||
BNpc();
|
||||
BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
|
||||
uint8_t level, uint32_t maxHp, TerritoryPtr pZone,FrameworkPtr pFw );
|
||||
uint8_t level, uint32_t maxHp, TerritoryPtr pZone );
|
||||
|
||||
virtual ~BNpc() override;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <utility>
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include <Service.h>
|
||||
|
||||
|
||||
#include "Forwards.h"
|
||||
|
@ -25,7 +26,6 @@
|
|||
#include "Chara.h"
|
||||
#include "Player.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Framework.h"
|
||||
#include "Common.h"
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
|
@ -33,11 +33,10 @@ using namespace Sapphire::Network::Packets;
|
|||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
||||
Sapphire::Entity::Chara::Chara( ObjKind type, FrameworkPtr pFw ) :
|
||||
Sapphire::Entity::Chara::Chara( ObjKind type ) :
|
||||
Actor( type ),
|
||||
m_pose( 0 ),
|
||||
m_targetId( INVALID_GAME_OBJECT_ID64 ),
|
||||
m_pFw( std::move( std::move( pFw ) ) ),
|
||||
m_directorId( 0 ),
|
||||
m_radius( 1.f )
|
||||
{
|
||||
|
@ -557,7 +556,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
|||
/*! \param StatusEffectPtr to be applied to the actor */
|
||||
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param )
|
||||
{
|
||||
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
|
||||
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000 );
|
||||
effect->setParam( param );
|
||||
addStatusEffect( effect );
|
||||
}
|
||||
|
@ -569,7 +568,7 @@ void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_
|
|||
if( hasStatusEffect( id ) )
|
||||
return;
|
||||
|
||||
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
|
||||
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000 );
|
||||
effect->setParam( param );
|
||||
addStatusEffect( effect );
|
||||
|
||||
|
@ -763,10 +762,9 @@ float Sapphire::Entity::Chara::getRadius() const
|
|||
|
||||
Sapphire::Common::BaseParam Sapphire::Entity::Chara::getPrimaryStat() const
|
||||
{
|
||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
assert( exdData );
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto classJob = exdData->get< Data::ClassJob >( static_cast< uint16_t >( getClass() ) );
|
||||
auto classJob = exdData.get< Data::ClassJob >( static_cast< uint16_t >( getClass() ) );
|
||||
assert( classJob );
|
||||
|
||||
return static_cast< Sapphire::Common::BaseParam >( classJob->primaryStat );
|
||||
|
|
|
@ -126,7 +126,6 @@ namespace Sapphire::Entity
|
|||
std::queue< uint8_t > m_statusEffectFreeSlotQueue;
|
||||
std::vector< std::pair< uint8_t, uint32_t > > m_statusEffectList;
|
||||
std::map< uint8_t, StatusEffect::StatusEffectPtr > m_statusEffectMap;
|
||||
FrameworkPtr m_pFw;
|
||||
|
||||
/*! Detour Crowd AgentId */
|
||||
uint32_t m_agentId;
|
||||
|
@ -135,7 +134,7 @@ namespace Sapphire::Entity
|
|||
float m_radius;
|
||||
|
||||
public:
|
||||
Chara( Common::ObjKind type, FrameworkPtr pFw );
|
||||
Chara( Common::ObjKind type );
|
||||
|
||||
virtual ~Chara() override;
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "Player.h"
|
||||
#include "Npc.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Framework.h"
|
||||
#include "Common.h"
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
|
@ -33,8 +32,8 @@ using namespace Sapphire::Network::Packets;
|
|||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
||||
Sapphire::Entity::Npc::Npc( ObjKind type, FrameworkPtr pFw ) :
|
||||
Chara( type, pFw )
|
||||
Sapphire::Entity::Npc::Npc( ObjKind type ) :
|
||||
Chara( type )
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Sapphire::Entity
|
|||
{
|
||||
|
||||
public:
|
||||
Npc( Common::ObjKind type, FrameworkPtr pFw );
|
||||
Npc( Common::ObjKind type );
|
||||
|
||||
virtual ~Npc() override;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <Network/CommonActorControl.h>
|
||||
#include <Network/PacketWrappers/EffectPacket.h>
|
||||
#include <cmath>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Session.h"
|
||||
#include "Player.h"
|
||||
|
@ -45,7 +46,6 @@
|
|||
#include "Math/CalcBattle.h"
|
||||
|
||||
#include "ServerMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
@ -58,8 +58,8 @@ using InvSlotPair = std::pair< uint16_t, int8_t >;
|
|||
using InvSlotPairVec = std::vector< InvSlotPair >;
|
||||
|
||||
// player constructor
|
||||
Sapphire::Entity::Player::Player( FrameworkPtr pFw ) :
|
||||
Chara( ObjKind::Player, pFw ),
|
||||
Sapphire::Entity::Player::Player() :
|
||||
Chara( ObjKind::Player ),
|
||||
m_lastWrite( 0 ),
|
||||
m_lastPing( 0 ),
|
||||
m_bIsLogin( false ),
|
||||
|
@ -114,8 +114,8 @@ Sapphire::Entity::Player::~Player()
|
|||
|
||||
void Sapphire::Entity::Player::injectPacket( const std::string& path )
|
||||
{
|
||||
auto pServerZone = m_pFw->get< World::ServerMgr >();
|
||||
auto session = pServerZone->getSession( getId() );
|
||||
auto& serverMgr = Common::Service< World::ServerMgr >::ref();
|
||||
auto session = serverMgr.getSession( getId() );
|
||||
if( session )
|
||||
session->getZoneConnection()->injectPacket( path, *this );
|
||||
}
|
||||
|
@ -200,9 +200,7 @@ bool Sapphire::Entity::Player::isMarkedForRemoval() const
|
|||
|
||||
Sapphire::Common::OnlineStatus Sapphire::Entity::Player::getOnlineStatus() const
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
if( !pExdData )
|
||||
return OnlineStatus::Online;
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
uint32_t statusDisplayOrder = 0xFF14;
|
||||
uint32_t applicableStatus = static_cast< uint32_t >( OnlineStatus::Online );
|
||||
|
@ -214,7 +212,7 @@ Sapphire::Common::OnlineStatus Sapphire::Entity::Player::getOnlineStatus() const
|
|||
if( !bit )
|
||||
continue;
|
||||
|
||||
auto pOnlineStatus = pExdData->get< Data::OnlineStatus >( i );
|
||||
auto pOnlineStatus = exdData.get< Data::OnlineStatus >( i );
|
||||
if( !pOnlineStatus )
|
||||
continue;
|
||||
|
||||
|
@ -255,11 +253,11 @@ void Sapphire::Entity::Player::calculateStats()
|
|||
uint8_t level = getLevel();
|
||||
uint8_t job = static_cast< uint8_t >( getClass() );
|
||||
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto classInfo = pExdData->get< Sapphire::Data::ClassJob >( job );
|
||||
auto tribeInfo = pExdData->get< Sapphire::Data::Tribe >( tribe );
|
||||
auto paramGrowthInfo = pExdData->get< Sapphire::Data::ParamGrow >( level );
|
||||
auto classInfo = exdData.get< Sapphire::Data::ClassJob >( job );
|
||||
auto tribeInfo = exdData.get< Sapphire::Data::Tribe >( tribe );
|
||||
auto paramGrowthInfo = exdData.get< Sapphire::Data::ParamGrow >( level );
|
||||
|
||||
float base = Math::CalcStats::calculateBaseStat( *this );
|
||||
|
||||
|
@ -292,7 +290,7 @@ void Sapphire::Entity::Player::calculateStats()
|
|||
|
||||
m_baseStats.max_mp = 10000;
|
||||
|
||||
m_baseStats.max_hp = Math::CalcStats::calculateMaxHp( getAsPlayer(), m_pFw );
|
||||
m_baseStats.max_hp = Math::CalcStats::calculateMaxHp( getAsPlayer() );
|
||||
|
||||
if( m_mp > m_baseStats.max_mp )
|
||||
m_mp = m_baseStats.max_mp;
|
||||
|
@ -343,18 +341,18 @@ void Sapphire::Entity::Player::sendStats()
|
|||
|
||||
void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
|
||||
auto data = pExdData->get< Sapphire::Data::Aetheryte >( aetheryteId );
|
||||
auto data = exdData.get< Sapphire::Data::Aetheryte >( aetheryteId );
|
||||
|
||||
if( data == nullptr )
|
||||
return;
|
||||
|
||||
setStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
|
||||
auto pInstanceObjectCache = m_pFw->get< InstanceObjectCache >();
|
||||
auto pop = pInstanceObjectCache->getPopRange( data->territory, data->level[ 0 ] );
|
||||
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
||||
auto pop = instanceObjectCache.getPopRange( data->territory, data->level[ 0 ] );
|
||||
|
||||
Common::FFXIVARR_POSITION3 pos;
|
||||
pos.x = 0;
|
||||
|
@ -377,8 +375,8 @@ void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
|||
}
|
||||
|
||||
sendDebug( "Teleport: {0} {1} ({2})",
|
||||
pExdData->get< Sapphire::Data::PlaceName >( data->placeName )->name,
|
||||
pExdData->get< Sapphire::Data::PlaceName >( data->aethernetName )->name,
|
||||
exdData.get< Sapphire::Data::PlaceName >( data->placeName )->name,
|
||||
exdData.get< Sapphire::Data::PlaceName >( data->aethernetName )->name,
|
||||
data->territory );
|
||||
|
||||
// TODO: this should be simplified and a type created in server_common/common.h.
|
||||
|
@ -420,16 +418,16 @@ void Sapphire::Entity::Player::returnToHomepoint()
|
|||
|
||||
void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
||||
{
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
m_onEnterEventDone = false;
|
||||
if( !pTeriMgr->movePlayer( zoneId, getAsPlayer() ) )
|
||||
if( !teriMgr.movePlayer( zoneId, getAsPlayer() ) )
|
||||
{
|
||||
// todo: this will require proper handling, for now just return the player to their previous area
|
||||
m_pos = m_prevPos;
|
||||
m_rot = m_prevRot;
|
||||
m_territoryTypeId = m_prevTerritoryTypeId;
|
||||
|
||||
if( !pTeriMgr->movePlayer( m_territoryTypeId, getAsPlayer() ) )
|
||||
if( !teriMgr.movePlayer( m_territoryTypeId, getAsPlayer() ) )
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -438,9 +436,9 @@ void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
|||
bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId )
|
||||
{
|
||||
m_onEnterEventDone = false;
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
|
||||
auto instance = pTeriMgr->getTerritoryByGuId( instanceContentId );
|
||||
auto instance = teriMgr.getTerritoryByGuId( instanceContentId );
|
||||
if( !instance )
|
||||
return false;
|
||||
|
||||
|
@ -453,7 +451,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance )
|
|||
if( !instance )
|
||||
return false;
|
||||
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto currentZone = getCurrentTerritory();
|
||||
|
||||
// zoning within the same zone won't cause the prev data to be overwritten
|
||||
|
@ -465,7 +463,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance )
|
|||
m_prevTerritoryId = getTerritoryId();
|
||||
}
|
||||
|
||||
return pTeriMgr->movePlayer( instance, getAsPlayer() );
|
||||
return teriMgr.movePlayer( instance, getAsPlayer() );
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIVARR_POSITION3 pos )
|
||||
|
@ -474,7 +472,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIV
|
|||
if( !instance )
|
||||
return false;
|
||||
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto currentZone = getCurrentTerritory();
|
||||
|
||||
// zoning within the same zone won't cause the prev data to be overwritten
|
||||
|
@ -486,7 +484,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIV
|
|||
m_prevTerritoryId = getTerritoryId();
|
||||
}
|
||||
|
||||
if( pTeriMgr->movePlayer( instance, getAsPlayer() ) )
|
||||
if( teriMgr.movePlayer( instance, getAsPlayer() ) )
|
||||
{
|
||||
m_pos = pos;
|
||||
return true;
|
||||
|
@ -497,7 +495,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIV
|
|||
|
||||
bool Sapphire::Entity::Player::exitInstance()
|
||||
{
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
|
||||
auto pZone = getCurrentTerritory();
|
||||
auto pInstance = pZone->getAsInstanceContent();
|
||||
|
@ -506,14 +504,14 @@ bool Sapphire::Entity::Player::exitInstance()
|
|||
resetMp();
|
||||
|
||||
// check if housing zone
|
||||
if( pTeriMgr->isHousingTerritory( m_prevTerritoryTypeId ) )
|
||||
if( teriMgr.isHousingTerritory( m_prevTerritoryTypeId ) )
|
||||
{
|
||||
if( !pTeriMgr->movePlayer( pTeriMgr->getZoneByLandSetId( m_prevTerritoryId ), getAsPlayer() ) )
|
||||
if( !teriMgr.movePlayer( teriMgr.getZoneByLandSetId( m_prevTerritoryId ), getAsPlayer() ) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !pTeriMgr->movePlayer( m_prevTerritoryTypeId, getAsPlayer() ) )
|
||||
if( !teriMgr.movePlayer( m_prevTerritoryTypeId, getAsPlayer() ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -601,12 +599,12 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
|||
|
||||
// section to starts at 320 - 4 bytes long
|
||||
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
int32_t offset = 4;
|
||||
|
||||
auto info = pExdData->get< Sapphire::Data::Map >(
|
||||
pExdData->get< Sapphire::Data::TerritoryType >( getCurrentTerritory()->getTerritoryTypeId() )->map );
|
||||
auto info = exdData.get< Sapphire::Data::Map >(
|
||||
exdData.get< Sapphire::Data::TerritoryType >( getCurrentTerritory()->getTerritoryTypeId() )->map );
|
||||
if( info->discoveryArrayByte )
|
||||
offset = 5 + 2 * info->discoveryIndex;
|
||||
else
|
||||
|
@ -621,7 +619,7 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
|||
|
||||
uint16_t level = getLevel();
|
||||
|
||||
uint32_t exp = ( pExdData->get< Sapphire::Data::ParamGrow >( level )->expToNext * 5 / 100 );
|
||||
uint32_t exp = ( exdData.get< Sapphire::Data::ParamGrow >( level )->expToNext * 5 / 100 );
|
||||
|
||||
gainExp( exp );
|
||||
|
||||
|
@ -705,11 +703,11 @@ void Sapphire::Entity::Player::gainExp( uint32_t amount )
|
|||
return;
|
||||
}
|
||||
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
uint32_t neededExpToLevel = pExdData->get< Sapphire::Data::ParamGrow >( level )->expToNext;
|
||||
uint32_t neededExpToLevel = exdData.get< Sapphire::Data::ParamGrow >( level )->expToNext;
|
||||
|
||||
uint32_t neededExpToLevelplus1 = pExdData->get< Sapphire::Data::ParamGrow >( level + 1 )->expToNext;
|
||||
uint32_t neededExpToLevelplus1 = exdData.get< Sapphire::Data::ParamGrow >( level + 1 )->expToNext;
|
||||
|
||||
queuePacket( makeActorControlSelf( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) );
|
||||
|
||||
|
@ -777,15 +775,15 @@ void Sapphire::Entity::Player::sendStatusUpdate()
|
|||
|
||||
uint8_t Sapphire::Entity::Player::getLevel() const
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
||||
}
|
||||
|
||||
uint8_t Sapphire::Entity::Player::getLevelForClass( Common::ClassJob pClass ) const
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( pClass ) )->expArrayIndex;
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( pClass ) )->expArrayIndex;
|
||||
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
||||
}
|
||||
|
||||
|
@ -797,15 +795,15 @@ bool Sapphire::Entity::Player::isClassJobUnlocked( Common::ClassJob classJob ) c
|
|||
|
||||
uint32_t Sapphire::Entity::Player::getExp() const
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||
return m_expArray[ classJobIndex ];
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::setExp( uint32_t amount )
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||
auto exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||
m_expArray[ classJobIndex ] = amount;
|
||||
}
|
||||
|
||||
|
@ -846,15 +844,15 @@ void Sapphire::Entity::Player::setClassJob( Common::ClassJob classJob )
|
|||
|
||||
void Sapphire::Entity::Player::setLevel( uint8_t level )
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||
m_classArray[ classJobIndex ] = level;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob classjob )
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( classjob ) )->expArrayIndex;
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( classjob ) )->expArrayIndex;
|
||||
|
||||
if( m_classArray[ classJobIndex ] == 0 )
|
||||
insertDbClass( classJobIndex );
|
||||
|
@ -996,8 +994,8 @@ const uint8_t* Sapphire::Entity::Player::getStateFlags() const
|
|||
|
||||
bool Sapphire::Entity::Player::actionHasCastTime( uint32_t actionId ) //TODO: Add logic for special cases
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto actionInfoPtr = pExdData->get< Sapphire::Data::Action >( actionId );
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
auto actionInfoPtr = exdData.get< Sapphire::Data::Action >( actionId );
|
||||
if( actionInfoPtr->preservesCombo )
|
||||
return false;
|
||||
|
||||
|
@ -1148,8 +1146,8 @@ void Sapphire::Entity::Player::update( uint64_t tickCount )
|
|||
|
||||
void Sapphire::Entity::Player::onMobKill( uint16_t nameId )
|
||||
{
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
pScriptMgr->onBNpcKill( *getAsPlayer(), nameId );
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
scriptMgr.onBNpcKill( *getAsPlayer(), nameId );
|
||||
|
||||
if( isActionLearned( static_cast< uint8_t >( Common::UnlockEntry::HuntingLog ) ) )
|
||||
{
|
||||
|
@ -1257,8 +1255,8 @@ const uint8_t* Sapphire::Entity::Player::getGcRankArray() const
|
|||
|
||||
void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||
{
|
||||
auto pServerZone = m_pFw->get< World::ServerMgr >();
|
||||
auto pSession = pServerZone->getSession( m_id );
|
||||
auto& serverMgr = Common::Service< World::ServerMgr >::ref();
|
||||
auto pSession = serverMgr.getSession( m_id );
|
||||
|
||||
if( !pSession )
|
||||
return;
|
||||
|
@ -1272,8 +1270,8 @@ void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr
|
|||
|
||||
void Sapphire::Entity::Player::queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||
{
|
||||
auto pServerZone = m_pFw->get< World::ServerMgr >();
|
||||
auto pSession = pServerZone->getSession( m_id );
|
||||
auto& serverMgr = Common::Service< World::ServerMgr >::ref();
|
||||
auto pSession = serverMgr.getSession( m_id );
|
||||
|
||||
if( !pSession )
|
||||
return;
|
||||
|
@ -1534,10 +1532,9 @@ void Sapphire::Entity::Player::dismount()
|
|||
|
||||
void Sapphire::Entity::Player::spawnCompanion( uint16_t id )
|
||||
{
|
||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
assert( exdData );
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto companion = exdData->get< Data::Companion >( id );
|
||||
auto companion = exdData.get< Data::Companion >( id );
|
||||
if( !id )
|
||||
return;
|
||||
|
||||
|
@ -1574,8 +1571,8 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
|||
//uint64_t tick = Util::getTimeMs();
|
||||
//srand(static_cast< uint32_t >(tick));
|
||||
|
||||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
||||
auto variation = static_cast< uint32_t >( pRNGMgr->getRandGenerator< float >( 0, 3 ).next() );
|
||||
auto& RNGMgr = Common::Service< World::Manager::RNGMgr >::ref();
|
||||
auto variation = static_cast< uint32_t >( RNGMgr.getRandGenerator< float >( 0, 3 ).next() );
|
||||
|
||||
auto damage = Math::CalcStats::calcAutoAttackDamage( *this );
|
||||
|
||||
|
@ -1689,8 +1686,8 @@ void Sapphire::Entity::Player::sendZonePackets()
|
|||
if( isLogin() )
|
||||
{
|
||||
//Update player map in servermgr - in case player name has been changed
|
||||
auto pServerMgr = m_pFw->get< World::ServerMgr >();
|
||||
pServerMgr->updatePlayerName( getId(), getName() );
|
||||
auto& serverMgr = Common::Service< World::ServerMgr >::ref();
|
||||
serverMgr.updatePlayerName( getId(), getName() );
|
||||
}
|
||||
|
||||
getCurrentTerritory()->onBeforePlayerZoneIn( *this );
|
||||
|
@ -1740,8 +1737,8 @@ void Sapphire::Entity::Player::sendZonePackets()
|
|||
sendItemLevel();
|
||||
}
|
||||
|
||||
auto pHousingMgr = m_pFw->get< HousingMgr >();
|
||||
if( Sapphire::LandPtr pLand = pHousingMgr->getLandByOwnerId( getId() ) )
|
||||
auto& housingMgr = Common::Service< HousingMgr >::ref();
|
||||
if( Sapphire::LandPtr pLand = housingMgr.getLandByOwnerId( getId() ) )
|
||||
{
|
||||
uint32_t state = 0;
|
||||
|
||||
|
@ -1868,14 +1865,14 @@ void Sapphire::Entity::Player::emoteInterrupt()
|
|||
|
||||
void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId )
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
// TODO: only register this action if enough gil is in possession
|
||||
auto targetAetheryte = pExdData->get< Sapphire::Data::Aetheryte >( aetheryteId );
|
||||
auto targetAetheryte = exdData.get< Sapphire::Data::Aetheryte >( aetheryteId );
|
||||
|
||||
if( targetAetheryte )
|
||||
{
|
||||
auto fromAetheryte = pExdData->get< Sapphire::Data::Aetheryte >(
|
||||
pExdData->get< Sapphire::Data::TerritoryType >( getZoneId() )->aetheryte );
|
||||
auto fromAetheryte = exdData.get< Sapphire::Data::Aetheryte >(
|
||||
exdData.get< Sapphire::Data::TerritoryType >( getZoneId() )->aetheryte );
|
||||
|
||||
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
|
||||
auto cost = static_cast< uint16_t > (
|
||||
|
@ -2019,7 +2016,7 @@ Sapphire::Common::HuntingLogEntry& Sapphire::Entity::Player::getHuntingLogEntry(
|
|||
|
||||
void Sapphire::Entity::Player::sendHuntingLog()
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint8_t count = 0;
|
||||
for( const auto& entry : m_huntingLogEntries )
|
||||
{
|
||||
|
@ -2036,7 +2033,7 @@ void Sapphire::Entity::Player::sendHuntingLog()
|
|||
bool allComplete = true;
|
||||
auto monsterNoteId = ( count + 1 ) * 10000 + entry.rank * 10 + i;
|
||||
|
||||
auto monsterNote = pExdData->get< Data::MonsterNote >( monsterNoteId );
|
||||
auto monsterNote = exdData.get< Data::MonsterNote >( monsterNoteId );
|
||||
if( !monsterNote )
|
||||
continue;
|
||||
|
||||
|
@ -2065,7 +2062,7 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id )
|
|||
{
|
||||
std::vector< uint32_t > rankRewards{ 2500, 10000, 20000, 30000, 40000 };
|
||||
const auto maxRank = 4;
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto& pExdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto& logEntry = m_huntingLogEntries[ static_cast< uint8_t >( getClass() ) - 1 ];
|
||||
|
||||
|
@ -2073,7 +2070,7 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id )
|
|||
|
||||
// make sure we get the matching base-class if a job is being used
|
||||
auto currentClass = static_cast< uint8_t >( getClass() );
|
||||
auto classJobInfo = pExdData->get< Sapphire::Data::ClassJob >( currentClass );
|
||||
auto classJobInfo = pExdData.get< Sapphire::Data::ClassJob >( currentClass );
|
||||
if( !classJobInfo )
|
||||
return;
|
||||
|
||||
|
@ -2083,7 +2080,7 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id )
|
|||
bool sectionComplete = true;
|
||||
bool sectionChanged = false;
|
||||
uint32_t monsterNoteId = static_cast< uint32_t >( classJobInfo->classJobParent * 10000 + logEntry.rank * 10 + i );
|
||||
auto note = pExdData->get< Sapphire::Data::MonsterNote >( monsterNoteId );
|
||||
auto note = pExdData.get< Sapphire::Data::MonsterNote >( monsterNoteId );
|
||||
|
||||
// for classes that don't have entries, if the first fails the rest will fail
|
||||
if( !note )
|
||||
|
@ -2091,7 +2088,7 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id )
|
|||
|
||||
for( auto x = 0; x < 4; ++x )
|
||||
{
|
||||
auto note1 = pExdData->get< Sapphire::Data::MonsterNoteTarget >( note->monsterNoteTarget[ x ] );
|
||||
auto note1 = pExdData.get< Sapphire::Data::MonsterNoteTarget >( note->monsterNoteTarget[ x ] );
|
||||
if( note1->bNpcName == id && logEntry.entries[ i - 1 ][ x ] < note->count[ x ] )
|
||||
{
|
||||
logEntry.entries[ i - 1 ][ x ]++;
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Sapphire::Entity
|
|||
{
|
||||
public:
|
||||
/*! Contructor */
|
||||
Player( FrameworkPtr pFw );
|
||||
Player();
|
||||
|
||||
/*! Destructor */
|
||||
~Player();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Common.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket.h"
|
||||
|
@ -13,7 +14,6 @@
|
|||
|
||||
#include "Territory/Territory.h"
|
||||
#include "ServerMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
#include "Action/EventAction.h"
|
||||
|
||||
|
@ -299,7 +299,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId,
|
|||
uint64_t additional )
|
||||
{
|
||||
auto pEventAction = World::Action::make_EventAction( getAsChara(), eventId, action,
|
||||
finishCallback, interruptCallback, additional, m_pFw );
|
||||
finishCallback, interruptCallback, additional );
|
||||
|
||||
auto pEvent = getEvent( eventId );
|
||||
|
||||
|
@ -341,8 +341,9 @@ void Sapphire::Entity::Player::eventItemActionStart( uint32_t eventId,
|
|||
|
||||
void Sapphire::Entity::Player::onLogin()
|
||||
{
|
||||
auto pServerMgr = m_pFw->get< Sapphire::World::ServerMgr >();
|
||||
auto motd = pServerMgr->getConfig().motd;
|
||||
auto& serverMgr = Common::Service< World::ServerMgr >::ref();
|
||||
|
||||
auto motd = serverMgr.getConfig().motd;
|
||||
|
||||
std::istringstream ss( motd );
|
||||
std::string msg;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
|
||||
#include "Player.h"
|
||||
#include "Framework.h"
|
||||
|
||||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
|
||||
|
@ -30,8 +29,7 @@
|
|||
#include "Manager/InventoryMgr.h"
|
||||
#include "Manager/ItemMgr.h"
|
||||
|
||||
#include "Framework.h"
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include <Service.h>
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
@ -43,7 +41,7 @@ void Sapphire::Entity::Player::initInventory()
|
|||
{
|
||||
auto setupContainer = [ this ]( InventoryType type, uint8_t maxSize, const std::string& tableName,
|
||||
bool isMultiStorage, bool isPersistentStorage = true )
|
||||
{ m_storageMap[ type ] = make_ItemContainer( type, maxSize, tableName, isMultiStorage, m_pFw, isPersistentStorage ); };
|
||||
{ m_storageMap[ type ] = make_ItemContainer( type, maxSize, tableName, isMultiStorage, isPersistentStorage ); };
|
||||
|
||||
// main bags
|
||||
setupContainer( Bag0, 34, "charaiteminventory", true );
|
||||
|
@ -114,13 +112,11 @@ void Sapphire::Entity::Player::sendItemLevel()
|
|||
|
||||
void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
||||
{
|
||||
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
||||
if( !exdData )
|
||||
return;
|
||||
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto itemInfo = exdData->get< Sapphire::Data::Item >( pItem->getId() );
|
||||
auto itemInfo = exdData.get< Sapphire::Data::Item >( pItem->getId() );
|
||||
auto itemClassJob = itemInfo->classJobUse;
|
||||
auto classJobInfo = exdData->get< Sapphire::Data::ClassJob >( static_cast< uint32_t >( getClass() ) );
|
||||
auto classJobInfo = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint32_t >( getClass() ) );
|
||||
auto currentParentClass = static_cast< ClassJob >( classJobInfo->classJobParent );
|
||||
auto newClassJob = static_cast< ClassJob >( itemClassJob );
|
||||
|
||||
|
@ -135,11 +131,9 @@ void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
|||
|
||||
void Sapphire::Entity::Player::equipSoulCrystal( ItemPtr pItem, bool updateJob )
|
||||
{
|
||||
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
||||
if ( !exdData )
|
||||
return;
|
||||
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto itemInfo = exdData->get< Sapphire::Data::Item >( pItem->getId() );
|
||||
auto itemInfo = exdData.get< Sapphire::Data::Item >( pItem->getId() );
|
||||
auto itemClassJob = itemInfo->classJobUse;
|
||||
auto newClassJob = static_cast< ClassJob >( itemClassJob );
|
||||
|
||||
|
@ -296,11 +290,9 @@ void Sapphire::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, Ite
|
|||
|
||||
void Sapphire::Entity::Player::unequipSoulCrystal( ItemPtr pItem )
|
||||
{
|
||||
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
||||
if ( !exdData )
|
||||
return;
|
||||
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||
|
||||
auto currentClassJob = exdData->get< Sapphire::Data::ClassJob >( static_cast< uint32_t >( getClass() ) );
|
||||
auto currentClassJob = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint32_t >( getClass() ) );
|
||||
auto parentClass = static_cast< ClassJob >( currentClassJob->classJobParent );
|
||||
setClassJob( parentClass );
|
||||
}
|
||||
|
@ -406,11 +398,11 @@ void Sapphire::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t
|
|||
|
||||
void Sapphire::Entity::Player::sendInventory()
|
||||
{
|
||||
auto pInvMgr = m_pFw->get< World::Manager::InventoryMgr >();
|
||||
auto& invMgr = Common::Service< World::Manager::InventoryMgr >::ref();
|
||||
|
||||
for( auto it = m_storageMap.begin(); it != m_storageMap.end(); ++it )
|
||||
{
|
||||
pInvMgr->sendInventoryContainer( *this, it->second );
|
||||
invMgr.sendInventoryContainer( *this, it->second );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,7 +466,7 @@ uint32_t Sapphire::Entity::Player::getCrystal( CrystalType type )
|
|||
|
||||
void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
|
||||
auto storage = m_storageMap[ type ];
|
||||
|
||||
|
@ -498,13 +490,13 @@ void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
|||
if( storage->isMultiStorage() )
|
||||
query += " AND storageId = " + std::to_string( static_cast< uint16_t >( type ) );
|
||||
|
||||
pDb->execute( query );
|
||||
db.execute( query );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_UP );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_UP );
|
||||
|
||||
// todo: add more fields
|
||||
stmt->setInt( 1, pItem->getStackSize() );
|
||||
|
@ -513,17 +505,17 @@ void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
|||
|
||||
stmt->setInt64( 4, pItem->getUId() );
|
||||
|
||||
pDb->directExecute( stmt );
|
||||
db.directExecute( stmt );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::deleteItemDb( Sapphire::ItemPtr item ) const
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_DELETE );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_DELETE );
|
||||
|
||||
stmt->setInt64( 1, item->getUId() );
|
||||
|
||||
pDb->directExecute( stmt );
|
||||
db.directExecute( stmt );
|
||||
}
|
||||
|
||||
|
||||
|
@ -536,9 +528,8 @@ bool Sapphire::Entity::Player::isObtainable( uint32_t catalogId, uint8_t quantit
|
|||
|
||||
Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_t quantity, bool isHq, bool silent, bool canMerge )
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
auto itemInfo = exdData.get< Sapphire::Data::Item >( catalogId );
|
||||
|
||||
// if item data doesn't exist or it's a blank field
|
||||
if( !itemInfo || itemInfo->levelItem == 0 )
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/QuestMessagePacket.h"
|
||||
|
||||
#include "Session.h"
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
@ -1036,15 +1036,15 @@ void Sapphire::Entity::Player::removeQuestsCompleted( uint32_t questId )
|
|||
|
||||
bool Sapphire::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optionalChoice )
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint32_t playerLevel = getLevel();
|
||||
auto questInfo = pExdData->get< Sapphire::Data::Quest >( questId );
|
||||
auto questInfo = exdData.get< Sapphire::Data::Quest >( questId );
|
||||
|
||||
|
||||
if( !questInfo )
|
||||
return false;
|
||||
|
||||
auto paramGrowth = pExdData->get< Sapphire::Data::ParamGrow >( questInfo->classJobLevel0 );
|
||||
auto paramGrowth = exdData.get< Sapphire::Data::ParamGrow >( questInfo->classJobLevel0 );
|
||||
|
||||
// TODO: use the correct formula, this one is wrong
|
||||
uint32_t exp =
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <Network/PacketContainer.h>
|
||||
#include <Common.h>
|
||||
#include <Database/DatabaseDef.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/PlayerSetupPacket.h"
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include "Manager/ItemMgr.h"
|
||||
|
||||
#include "ServerMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
@ -29,16 +29,16 @@ using namespace Sapphire::World::Manager;
|
|||
// load player from the db
|
||||
bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession )
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
m_pSession = pSession;
|
||||
|
||||
const std::string char_id_str = std::to_string( charId );
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL );
|
||||
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL );
|
||||
|
||||
stmt->setUInt( 1, charId );
|
||||
auto res = pDb->query( stmt );
|
||||
auto res = db.query( stmt );
|
||||
|
||||
if( !res->next() )
|
||||
return false;
|
||||
|
@ -67,10 +67,10 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
|||
TerritoryPtr pCurrZone = nullptr;
|
||||
|
||||
// if the zone is an instanceContent zone, we need to actually find the instance
|
||||
if( pTeriMgr->isInstanceContentTerritory( zoneId ) )
|
||||
if( teriMgr.isInstanceContentTerritory( zoneId ) )
|
||||
{
|
||||
// try to find an instance actually linked to this player
|
||||
pCurrZone = pTeriMgr->getLinkedInstance( m_id );
|
||||
pCurrZone = teriMgr.getLinkedInstance( m_id );
|
||||
// if none found, revert to previous zone and position
|
||||
if( !pCurrZone )
|
||||
{
|
||||
|
@ -79,13 +79,13 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
|||
m_pos.y = m_prevPos.y;
|
||||
m_pos.z = m_prevPos.z;
|
||||
setRot( m_prevRot );
|
||||
pCurrZone = pTeriMgr->getZoneByTerritoryTypeId( zoneId );
|
||||
pCurrZone = teriMgr.getZoneByTerritoryTypeId( zoneId );
|
||||
}
|
||||
}
|
||||
else if( pTeriMgr->isInternalEstateTerritory( zoneId ) )
|
||||
else if( teriMgr.isInternalEstateTerritory( zoneId ) )
|
||||
{
|
||||
// todo: this needs to go to the area just outside of the plot door
|
||||
pCurrZone = pTeriMgr->getZoneByLandSetId( m_prevTerritoryId );
|
||||
pCurrZone = teriMgr.getZoneByLandSetId( m_prevTerritoryId );
|
||||
|
||||
zoneId = m_prevTerritoryTypeId;
|
||||
m_pos.x = m_prevPos.x;
|
||||
|
@ -93,13 +93,13 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
|||
m_pos.z = m_prevPos.z;
|
||||
setRot( m_prevRot );
|
||||
}
|
||||
else if( pTeriMgr->isHousingTerritory( zoneId ) )
|
||||
else if( teriMgr.isHousingTerritory( zoneId ) )
|
||||
{
|
||||
pCurrZone = pTeriMgr->getZoneByLandSetId( m_territoryId );
|
||||
pCurrZone = teriMgr.getZoneByLandSetId( m_territoryId );
|
||||
}
|
||||
else
|
||||
{
|
||||
pCurrZone = pTeriMgr->getZoneByTerritoryTypeId( zoneId );
|
||||
pCurrZone = teriMgr.getZoneByTerritoryTypeId( zoneId );
|
||||
}
|
||||
|
||||
m_territoryTypeId = zoneId;
|
||||
|
@ -113,7 +113,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
|||
|
||||
// default to new gridania
|
||||
// TODO: should probably just abort and mark character as corrupt
|
||||
pCurrZone = pTeriMgr->getZoneByTerritoryTypeId( 132 );
|
||||
pCurrZone = teriMgr.getZoneByTerritoryTypeId( 132 );
|
||||
|
||||
m_pos.x = 0.0f;
|
||||
m_pos.y = 0.0f;
|
||||
|
@ -250,7 +250,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
|||
|
||||
initSpawnIdQueue();
|
||||
|
||||
if( !pTeriMgr->movePlayer( pCurrZone, getAsPlayer() ) )
|
||||
if( !teriMgr.movePlayer( pCurrZone, getAsPlayer() ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -258,11 +258,11 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
|||
|
||||
bool Sapphire::Entity::Player::loadActiveQuests()
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_QUEST );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_QUEST );
|
||||
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = pDb->query( stmt );
|
||||
auto res = db.query( stmt );
|
||||
|
||||
while( res->next() )
|
||||
{
|
||||
|
@ -294,11 +294,11 @@ bool Sapphire::Entity::Player::loadActiveQuests()
|
|||
|
||||
bool Sapphire::Entity::Player::loadClassData()
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
// ClassIdx, Exp, Lvl
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_SEL );
|
||||
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_SEL );
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = pDb->query( stmt );
|
||||
auto res = db.query( stmt );
|
||||
|
||||
while( res->next() )
|
||||
{
|
||||
|
@ -315,10 +315,10 @@ bool Sapphire::Entity::Player::loadClassData()
|
|||
|
||||
bool Sapphire::Entity::Player::loadSearchInfo()
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_SEARCHINFO );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_SEARCHINFO );
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = pDb->query( stmt );
|
||||
auto res = db.query( stmt );
|
||||
|
||||
if( !res->next() )
|
||||
{
|
||||
|
@ -340,10 +340,10 @@ bool Sapphire::Entity::Player::loadSearchInfo()
|
|||
|
||||
bool Sapphire::Entity::Player::loadHuntingLog()
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_MONSTERNOTE_SEL );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_MONSTERNOTE_SEL );
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = pDb->query( stmt );
|
||||
auto res = db.query( stmt );
|
||||
|
||||
if( !res->next() )
|
||||
{
|
||||
|
@ -363,7 +363,7 @@ bool Sapphire::Entity::Player::loadHuntingLog()
|
|||
|
||||
void Sapphire::Entity::Player::updateSql()
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
/*"Hp 1, Mp 2, Tp 3, Gp 4, Mode 5, Mount 6, InvincibleGM 7, Voice 8, "
|
||||
"Customize 9, ModelMainWeapon 10, ModelSubWeapon 11, ModelSystemWeapon 12, "
|
||||
"ModelEquip 13, EmoteModeType 14, Language 15, IsNewGame 16, IsNewAdventurer 17, "
|
||||
|
@ -377,7 +377,7 @@ void Sapphire::Entity::Player::updateSql()
|
|||
|
||||
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_UP );
|
||||
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_UP );
|
||||
|
||||
stmt->setInt( 1, getHp() );
|
||||
stmt->setInt( 2, getMp() );
|
||||
|
@ -490,7 +490,7 @@ void Sapphire::Entity::Player::updateSql()
|
|||
|
||||
stmt->setInt( 57, m_id );
|
||||
|
||||
pDb->execute( stmt );
|
||||
db.execute( stmt );
|
||||
|
||||
////// Searchinfo
|
||||
updateDbSearchInfo();
|
||||
|
@ -508,24 +508,24 @@ void Sapphire::Entity::Player::updateSql()
|
|||
|
||||
void Sapphire::Entity::Player::updateDbClass() const
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast<uint8_t>( getClass() ) )->expArrayIndex;
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast<uint8_t>( getClass() ) )->expArrayIndex;
|
||||
|
||||
//Exp = ?, Lvl = ? WHERE CharacterId = ? AND ClassIdx = ?
|
||||
auto stmtS = pDb->getPreparedStatement( Db::CHARA_CLASS_UP );
|
||||
auto stmtS = db.getPreparedStatement( Db::CHARA_CLASS_UP );
|
||||
stmtS->setInt( 1, getExp() );
|
||||
stmtS->setInt( 2, getLevel() );
|
||||
stmtS->setInt( 3, m_id );
|
||||
stmtS->setInt( 4, classJobIndex );
|
||||
pDb->execute( stmtS );
|
||||
db.execute( stmtS );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::updateDbMonsterNote()
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
// Category_0-11
|
||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_MONSTERNOTE_UP );
|
||||
auto stmt = db.getPreparedStatement( Db::CHARA_MONSTERNOTE_UP );
|
||||
//std::array< std::vector< uint8_t >, 12 > vectors;
|
||||
std::vector< uint8_t > vector( 41 );
|
||||
for( std::size_t i = 0; i < m_huntingLogEntries.size(); ++i )
|
||||
|
@ -538,48 +538,48 @@ void Sapphire::Entity::Player::updateDbMonsterNote()
|
|||
stmt->setBinary( i + 1, vector );
|
||||
}
|
||||
stmt->setInt( 13, m_id );
|
||||
pDb->execute( stmt );
|
||||
db.execute( stmt );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::insertDbClass( const uint8_t classJobIndex ) const
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmtClass = pDb->getPreparedStatement( Db::CHARA_CLASS_INS );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmtClass = db.getPreparedStatement( Db::CHARA_CLASS_INS );
|
||||
stmtClass->setInt( 1, getId() );
|
||||
stmtClass->setInt( 2, classJobIndex );
|
||||
stmtClass->setInt( 3, 0 );
|
||||
stmtClass->setInt( 4, 1 );
|
||||
pDb->directExecute( stmtClass );
|
||||
db.directExecute( stmtClass );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::updateDbSearchInfo() const
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmtS = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmtS = db.getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
||||
stmtS->setInt( 1, m_searchSelectClass );
|
||||
stmtS->setInt( 2, m_id );
|
||||
pDb->execute( stmtS );
|
||||
db.execute( stmtS );
|
||||
|
||||
auto stmtS1 = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTREGION );
|
||||
auto stmtS1 = db.getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTREGION );
|
||||
stmtS1->setInt( 1, m_searchSelectRegion );
|
||||
stmtS1->setInt( 2, m_id );
|
||||
pDb->execute( stmtS1 );
|
||||
db.execute( stmtS1 );
|
||||
|
||||
auto stmtS2 = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SEARCHCOMMENT );
|
||||
auto stmtS2 = db.getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SEARCHCOMMENT );
|
||||
stmtS2->setString( 1, std::string( m_searchMessage ) );
|
||||
stmtS2->setInt( 2, m_id );
|
||||
pDb->execute( stmtS2 );
|
||||
db.execute( stmtS2 );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::updateDbAllQuests() const
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
for( int32_t i = 0; i < 30; i++ )
|
||||
{
|
||||
if( !m_activeQuests[ i ] )
|
||||
continue;
|
||||
|
||||
auto stmtS3 = pDb->getPreparedStatement( Db::CHARA_QUEST_UP );
|
||||
auto stmtS3 = db.getPreparedStatement( Db::CHARA_QUEST_UP );
|
||||
stmtS3->setInt( 1, m_activeQuests[ i ]->c.sequence );
|
||||
stmtS3->setInt( 2, m_activeQuests[ i ]->c.flags );
|
||||
stmtS3->setInt( 3, m_activeQuests[ i ]->c.UI8A );
|
||||
|
@ -591,24 +591,24 @@ void Sapphire::Entity::Player::updateDbAllQuests() const
|
|||
stmtS3->setInt( 9, m_activeQuests[ i ]->c.padding1 );
|
||||
stmtS3->setInt( 10, m_id );
|
||||
stmtS3->setInt( 11, m_activeQuests[ i ]->c.questId );
|
||||
pDb->execute( stmtS3 );
|
||||
db.execute( stmtS3 );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::deleteQuest( uint16_t questId ) const
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_QUEST_DEL );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmt = db.getPreparedStatement( Db::CHARA_QUEST_DEL );
|
||||
stmt->setInt( 1, m_id );
|
||||
stmt->setInt( 2, questId );
|
||||
pDb->execute( stmt );
|
||||
db.execute( stmt );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uint8_t seq ) const
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_QUEST_INS );
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto stmt = db.getPreparedStatement( Db::CHARA_QUEST_INS );
|
||||
stmt->setInt( 1, m_id );
|
||||
stmt->setInt( 2, index );
|
||||
stmt->setInt( 3, questId );
|
||||
|
@ -621,15 +621,16 @@ void Sapphire::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uin
|
|||
stmt->setInt( 10, 0 );
|
||||
stmt->setInt( 11, 0 );
|
||||
stmt->setInt( 12, 0 );
|
||||
pDb->execute( stmt );
|
||||
db.execute( stmt );
|
||||
}
|
||||
|
||||
Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint32_t quantity )
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||
auto itemMgr = m_pFw->get< World::Manager::ItemMgr >();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto& itemMgr = Common::Service< World::Manager::ItemMgr >::ref();
|
||||
|
||||
auto itemInfo = exdData.get< Sapphire::Data::Item >( catalogId );
|
||||
|
||||
if( !itemInfo )
|
||||
return nullptr;
|
||||
|
@ -639,27 +640,27 @@ Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint
|
|||
|
||||
uint8_t flags = 0;
|
||||
|
||||
ItemPtr pItem = make_Item( itemMgr->getNextUId(), catalogId, m_pFw );
|
||||
ItemPtr pItem = make_Item( itemMgr.getNextUId(), catalogId );
|
||||
|
||||
pItem->setStackSize( quantity );
|
||||
|
||||
pDb->execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
|
||||
std::to_string( getId() ) + ", " +
|
||||
std::to_string( pItem->getUId() ) + ", " +
|
||||
std::to_string( pItem->getId() ) + ", " +
|
||||
std::to_string( quantity ) + ", " +
|
||||
std::to_string( flags ) + ");" );
|
||||
db.execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
|
||||
std::to_string( getId() ) + ", " +
|
||||
std::to_string( pItem->getUId() ) + ", " +
|
||||
std::to_string( pItem->getId() ) + ", " +
|
||||
std::to_string( quantity ) + ", " +
|
||||
std::to_string( flags ) + ");" );
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::loadInventory()
|
||||
{
|
||||
auto itemMgr = m_pFw->get< World::Manager::ItemMgr >();
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto& itemMgr = Common::Service< World::Manager::ItemMgr >::ref();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// load active gearset
|
||||
auto res = pDb->query( "SELECT storageId, container_0, container_1, container_2, container_3, "
|
||||
auto res = db.query( "SELECT storageId, container_0, container_1, container_2, container_3, "
|
||||
"container_4, container_5, container_6, container_7, "
|
||||
"container_8, container_9, container_10, container_11, "
|
||||
"container_12, container_13 "
|
||||
|
@ -677,7 +678,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
|||
if( uItemId == 0 )
|
||||
continue;
|
||||
|
||||
ItemPtr pItem = itemMgr->loadItem( uItemId );
|
||||
ItemPtr pItem = itemMgr.loadItem( uItemId );
|
||||
|
||||
if( pItem == nullptr )
|
||||
continue;
|
||||
|
@ -689,7 +690,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Load everything
|
||||
auto bagRes = pDb->query( "SELECT storageId, "
|
||||
auto bagRes = db.query( "SELECT storageId, "
|
||||
"container_0, container_1, container_2, container_3, container_4, "
|
||||
"container_5, container_6, container_7, container_8, container_9, "
|
||||
"container_10, container_11, container_12, container_13, container_14, "
|
||||
|
@ -710,7 +711,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
|||
if( uItemId == 0 )
|
||||
continue;
|
||||
|
||||
ItemPtr pItem = itemMgr->loadItem( uItemId );
|
||||
ItemPtr pItem = itemMgr.loadItem( uItemId );
|
||||
|
||||
if( pItem == nullptr )
|
||||
continue;
|
||||
|
|
|
@ -29,7 +29,6 @@ TYPE_FORWARD( ItemContainer );
|
|||
TYPE_FORWARD( ZonePosition );
|
||||
TYPE_FORWARD( Land );
|
||||
TYPE_FORWARD( Linkshell );
|
||||
TYPE_FORWARD( Framework );
|
||||
|
||||
namespace World
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "HousingItem.h"
|
||||
|
||||
Sapphire::Inventory::HousingItem::HousingItem( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw ) :
|
||||
Sapphire::Item( uId, catalogId, pFw, false )
|
||||
Sapphire::Inventory::HousingItem::HousingItem( uint64_t uId, uint32_t catalogId ) :
|
||||
Sapphire::Item( uId, catalogId, false )
|
||||
{
|
||||
m_stackSize = 1;
|
||||
m_spiritBond = 1;
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Sapphire::Inventory
|
|||
class HousingItem : public Item
|
||||
{
|
||||
public:
|
||||
HousingItem( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw );
|
||||
HousingItem( uint64_t uId, uint32_t catalogId );
|
||||
virtual ~HousingItem() = default;
|
||||
|
||||
void setRot( float rot );
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
#include <Common.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <CommonGen.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Framework.h"
|
||||
#include "Item.h"
|
||||
|
||||
Sapphire::Item::Item( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw, bool isHq ) :
|
||||
Sapphire::Item::Item( uint64_t uId, uint32_t catalogId, bool isHq ) :
|
||||
m_id( catalogId ),
|
||||
m_uId( uId ),
|
||||
m_isHq( isHq ),
|
||||
m_stain( 0 ),
|
||||
m_durability( 30000 ),
|
||||
m_spiritBond( 0 ),
|
||||
m_reservedFlag( 0 ),
|
||||
m_pFw( pFw )
|
||||
m_reservedFlag( 0 )
|
||||
{
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
auto itemInfo = exdData.get< Sapphire::Data::Item >( catalogId );
|
||||
|
||||
m_delayMs = itemInfo->delayms;
|
||||
m_physicalDmg = itemInfo->damagePhys;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Sapphire
|
|||
int16_t value;
|
||||
};
|
||||
|
||||
Item( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw, bool isHq = false );
|
||||
Item( uint64_t uId, uint32_t catalogId, bool isHq = false );
|
||||
|
||||
virtual ~Item() = default;
|
||||
|
||||
|
@ -116,7 +116,6 @@ namespace Sapphire
|
|||
uint32_t m_defense;
|
||||
uint32_t m_defenseMag;
|
||||
|
||||
FrameworkPtr m_pFw;
|
||||
uint32_t m_additionalData;
|
||||
|
||||
BaseParamStruct m_baseParam[6];
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
#include <Common.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Database/DatabaseDef.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Item.h"
|
||||
#include "Framework.h"
|
||||
#include "Forwards.h"
|
||||
#include "ItemContainer.h"
|
||||
|
||||
Sapphire::ItemContainer::ItemContainer( uint16_t storageId, uint8_t maxSize, const std::string& tableName,
|
||||
bool isMultiStorage, FrameworkPtr pFw, bool isPersistentStorage ) :
|
||||
bool isMultiStorage, bool isPersistentStorage ) :
|
||||
m_id( storageId ),
|
||||
m_size( maxSize ),
|
||||
m_tableName( tableName ),
|
||||
m_bMultiStorage( isMultiStorage ),
|
||||
m_pFw( pFw ),
|
||||
m_isPersistentStorage( isPersistentStorage )
|
||||
{
|
||||
|
||||
|
@ -38,13 +37,13 @@ uint8_t Sapphire::ItemContainer::getEntryCount() const
|
|||
|
||||
void Sapphire::ItemContainer::removeItem( uint8_t slotId, bool removeFromDb )
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto it = m_itemMap.find( slotId );
|
||||
|
||||
if( it != m_itemMap.end() )
|
||||
{
|
||||
if( m_isPersistentStorage && removeFromDb )
|
||||
pDb->execute( "DELETE FROM charaglobalitem WHERE itemId = " + std::to_string( it->second->getUId() ) );
|
||||
db.execute( "DELETE FROM charaglobalitem WHERE itemId = " + std::to_string( it->second->getUId() ) );
|
||||
|
||||
m_itemMap.erase( it );
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Sapphire
|
|||
|
||||
public:
|
||||
ItemContainer( uint16_t storageId, uint8_t maxSize, const std::string& tableName, bool isMultiStorage,
|
||||
FrameworkPtr pFw, bool isPersistentStorage = true );
|
||||
bool isPersistentStorage = true );
|
||||
|
||||
~ItemContainer();
|
||||
|
||||
|
@ -48,7 +48,6 @@ namespace Sapphire
|
|||
uint8_t m_size;
|
||||
std::string m_tableName;
|
||||
bool m_bMultiStorage;
|
||||
FrameworkPtr m_pFw;
|
||||
bool m_isPersistentStorage;
|
||||
ItemMap m_itemMap;
|
||||
Entity::PlayerPtr m_pOwner;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue