mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-08 11:47:45 +00:00
move to new service locator
This commit is contained in:
parent
3a2272594e
commit
ca102697f4
161 changed files with 1053 additions and 1395 deletions
|
@ -26,7 +26,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <Framework.h>
|
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
|
|
||||||
#include "SapphireApi.h"
|
#include "SapphireApi.h"
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "Logging/Logger.h"
|
#include "Logging/Logger.h"
|
||||||
|
|
||||||
#include "PreparedStatement.h"
|
#include "PreparedStatement.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
|
Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
|
||||||
m_reconnecting( false ),
|
m_reconnecting( false ),
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "StatementTask.h"
|
#include "StatementTask.h"
|
||||||
#include "Operation.h"
|
#include "Operation.h"
|
||||||
#include "ZoneDbConnection.h"
|
#include "ZoneDbConnection.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
#include "Logging/Logger.h"
|
#include "Logging/Logger.h"
|
||||||
#include <mysql.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 "Connection.h"
|
||||||
#include "Hive.h"
|
#include "Hive.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
Network::Connection::Connection( HivePtr hive, FrameworkPtr pFw ) :
|
Network::Connection::Connection( HivePtr hive ) :
|
||||||
m_hive( hive ),
|
m_hive( hive ),
|
||||||
m_socket( hive->getService() ),
|
m_socket( hive->getService() ),
|
||||||
m_io_strand( hive->getService() ),
|
m_io_strand( hive->getService() ),
|
||||||
m_receive_buffer_size( 32000 ),
|
m_receive_buffer_size( 32000 ),
|
||||||
m_error_state( 0 ),
|
m_error_state( 0 )
|
||||||
m_pFw( pFw )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,8 @@ namespace Sapphire::Network
|
||||||
std::list< std::vector< uint8_t > > m_pending_sends;
|
std::list< std::vector< uint8_t > > m_pending_sends;
|
||||||
int32_t m_receive_buffer_size;
|
int32_t m_receive_buffer_size;
|
||||||
std::atomic< uint32_t > m_error_state;
|
std::atomic< uint32_t > m_error_state;
|
||||||
FrameworkPtr m_pFw;
|
|
||||||
|
|
||||||
Connection( HivePtr hive, FrameworkPtr pFw );
|
Connection( HivePtr hive );
|
||||||
|
|
||||||
virtual ~Connection();
|
virtual ~Connection();
|
||||||
|
|
||||||
|
@ -141,13 +140,13 @@ namespace Sapphire::Network
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
template< class T >
|
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
|
try
|
||||||
{
|
{
|
||||||
AcceptorPtr acceptor( new Acceptor( pHive ) );
|
AcceptorPtr acceptor( new Acceptor( pHive ) );
|
||||||
acceptor->listen( listenIp, port );
|
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 );
|
acceptor->accept( connection );
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Config/ConfigMgr.h>
|
#include <Config/ConfigMgr.h>
|
||||||
|
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
#include "ServerLobby.h"
|
#include "ServerLobby.h"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
#include <Framework.h>
|
|
||||||
#include <Manager/ShopMgr.h>
|
#include <Manager/ShopMgr.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -31,9 +31,10 @@ private:
|
||||||
// buy
|
// buy
|
||||||
if( result.param2 == 1 )
|
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
|
// sell
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
#include <Framework.h>
|
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
@ -109,11 +108,9 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pExdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
auto exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||||
if( !pExdData )
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto aetherInfo = pExdData->get< Sapphire::Data::Aetheryte >( eventId & 0xFFFF );
|
auto aetherInfo = exdData.get< Sapphire::Data::Aetheryte >( eventId & 0xFFFF );
|
||||||
if( !aetherInfo )
|
if( !aetherInfo )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
#include <Framework.h>
|
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <Territory/HousingZone.h>
|
#include <Territory/HousingZone.h>
|
||||||
#include <Manager/PlayerMgr.h>
|
#include <Manager/PlayerMgr.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
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 )
|
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 >();
|
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||||
if( !pExdData )
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto housingZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto housingZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||||
if( !housingZone )
|
if( !housingZone )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// param2 is the index starting from 0 inside housingaethernet.exd, but the ID column starts at 0x001E0000........ wtf
|
// 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 )
|
if( !pHousingAethernet )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -42,8 +40,8 @@ public:
|
||||||
// moving a player inside an event will crash the game so we end it here
|
// moving a player inside an event will crash the game so we end it here
|
||||||
player.eventFinish( eventId, 1 );
|
player.eventFinish( eventId, 1 );
|
||||||
|
|
||||||
auto playerMgr = framework()->get< Sapphire::World::Manager::PlayerMgr >();
|
auto& playerMgr = Common::Service< Sapphire::World::Manager::PlayerMgr >::ref();
|
||||||
playerMgr->movePlayerToLandDestination( player, pHousingAethernet->level, housingZone->getWardNum() );
|
playerMgr.movePlayerToLandDestination( player, pHousingAethernet->level, housingZone->getWardNum() );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
#include "Actor/EventObject.h"
|
#include "Actor/EventObject.h"
|
||||||
#include "Territory/HousingZone.h"
|
#include "Territory/HousingZone.h"
|
||||||
#include "Manager/TerritoryMgr.h"
|
#include "Manager/TerritoryMgr.h"
|
||||||
#include "Territory/Land.h"
|
#include "Territory/Land.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ public:
|
||||||
if( result.param2 != 1 )
|
if( result.param2 != 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto terriMgr = framework()->get< Sapphire::World::Manager::TerritoryMgr >();
|
auto& terriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||||
if( !terriMgr )
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||||
if( !zone )
|
if( !zone )
|
||||||
|
@ -40,7 +38,7 @@ public:
|
||||||
ident.wardNum = zone->getWardNum();
|
ident.wardNum = zone->getWardNum();
|
||||||
ident.worldId = 67;
|
ident.worldId = 67;
|
||||||
|
|
||||||
auto internalZone = terriMgr->findOrCreateHousingInterior( ident );
|
auto internalZone = terriMgr.findOrCreateHousingInterior( ident );
|
||||||
if( !internalZone )
|
if( !internalZone )
|
||||||
{
|
{
|
||||||
// an error occurred during event movement
|
// an error occurred during event movement
|
||||||
|
@ -60,6 +58,7 @@ public:
|
||||||
|
|
||||||
switch( land->getSize() )
|
switch( land->getSize() )
|
||||||
{
|
{
|
||||||
|
// todo: think there's actually a poprange for this? double czech
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
pos = { 0.1321167f, 0.f, 2.746273f };
|
pos = { 0.1321167f, 0.f, 2.746273f };
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <Network/PacketWrappers/ActorControlSelfPacket.h>
|
#include <Network/PacketWrappers/ActorControlSelfPacket.h>
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
@ -25,9 +25,6 @@ public:
|
||||||
{
|
{
|
||||||
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
|
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
auto pFw = framework();
|
|
||||||
if( !pFw )
|
|
||||||
return LandPurchaseResult::ERR_INTERNAL;
|
|
||||||
// Purchase Land
|
// Purchase Land
|
||||||
if( result.param2 == 2 )
|
if( result.param2 == 2 )
|
||||||
{
|
{
|
||||||
|
@ -36,9 +33,9 @@ public:
|
||||||
|
|
||||||
auto pTerritory = player.getCurrentTerritory();
|
auto pTerritory = player.getCurrentTerritory();
|
||||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
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 ) );
|
static_cast< uint8_t >( result.param2 ) );
|
||||||
|
|
||||||
switch( res )
|
switch( res )
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "Territory/InstanceObjectCache.h"
|
#include "Territory/InstanceObjectCache.h"
|
||||||
|
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <Framework.h>
|
|
||||||
#include <Manager/PlayerMgr.h>
|
#include <Manager/PlayerMgr.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -32,16 +32,16 @@ public:
|
||||||
player.eventFinish( 1310721, 0 );
|
player.eventFinish( 1310721, 0 );
|
||||||
player.eventFinish( getId(), 1 );
|
player.eventFinish( getId(), 1 );
|
||||||
|
|
||||||
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto pPopRange = framework()->get< Sapphire::InstanceObjectCache >();
|
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 )
|
if( !warp )
|
||||||
return;
|
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 )
|
if( !pPop )
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ public:
|
||||||
std::cout << "found!!";
|
std::cout << "found!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
playerMgr->movePlayerToLandDestination( player, warp->popRange, result.param3 );
|
playerMgr.movePlayerToLandDestination( player, warp->popRange, result.param3 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -75,11 +75,9 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
auto exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||||
if( !exdData )
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto warp = exdData->get< Sapphire::Data::Warp >( eventId );
|
auto warp = exdData.get< Sapphire::Data::Warp >( eventId );
|
||||||
if( !warp )
|
if( !warp )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include "Event/EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManFst001_00039
|
// Quest Script: ManFst001_00039
|
||||||
// Quest Name: Coming to Gridania
|
// Quest Name: Coming to Gridania
|
||||||
|
@ -96,8 +96,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR0 )
|
if( actor == ACTOR0 )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Event/EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManFst002_00124
|
// Quest Script: ManFst002_00124
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -193,8 +193,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR0 )
|
if( actor == ACTOR0 )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManFst003_00123
|
// Quest Script: ManFst003_00123
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -82,8 +82,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManFst004_00124
|
// Quest Script: ManFst004_00124
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -80,8 +80,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ManFst004::Actor0 )
|
if( actor == ManFst004::Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include "Manager/TerritoryMgr.h"
|
#include "Manager/TerritoryMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManFst005_00445
|
// Quest Script: ManFst005_00445
|
||||||
// Quest Name: Chasing Shadows
|
// Quest Name: Chasing Shadows
|
||||||
|
@ -61,8 +61,8 @@ class ManFst005 : public Sapphire::ScriptAPI::EventScript
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
@ -142,11 +142,10 @@ class ManFst005 : public Sapphire::ScriptAPI::EventScript
|
||||||
{
|
{
|
||||||
if( result.param2 == 1 )
|
if( result.param2 == 1 )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = framework()->get< Sapphire::World::Manager::TerritoryMgr >();
|
auto& pTeriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||||
if( !pTeriMgr )
|
|
||||||
return;
|
|
||||||
player.eventFinish( result.eventId, 0 );
|
player.eventFinish( result.eventId, 0 );
|
||||||
pTeriMgr->createAndJoinQuestBattle( player, Questbattle0 );
|
pTeriMgr.createAndJoinQuestBattle( player, Questbattle0 );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManSea001_00107
|
// Quest Script: ManSea001_00107
|
||||||
// Quest Name: Coming to Limsa Lominsa
|
// Quest Name: Coming to Limsa Lominsa
|
||||||
|
@ -142,8 +142,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR0 )
|
if( actor == ACTOR0 )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManSea002_00108
|
// Quest Script: ManSea002_00108
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -48,8 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR0 )
|
if( actor == ACTOR0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManSea003_00109
|
// Quest Script: ManSea003_00109
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -64,8 +64,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManWil001_00594
|
// Quest Script: ManWil001_00594
|
||||||
// Quest Name: Coming to Ul'dah
|
// Quest Name: Coming to Ul'dah
|
||||||
|
@ -174,8 +174,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR0 )
|
if( actor == ACTOR0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManWil002_00568
|
// Quest Script: ManWil002_00568
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -70,8 +70,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManWil003_00569
|
// Quest Script: ManWil003_00569
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -70,8 +70,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
// Quest Script: ManWil004_00570
|
// Quest Script: ManWil004_00570
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -70,8 +70,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ class ClsLnc000 : public Sapphire::ScriptAPI::EventScript
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = framework()->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR0 )
|
if( actor == ACTOR0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR0 && !player.hasQuest( getId() ) )
|
if( actor == ACTOR0 && !player.hasQuest( getId() ) )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast<uint32_t>( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if ( actor == Actor0 )
|
if ( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR0 )
|
if( actor == ACTOR0 )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -161,8 +161,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( !player.hasQuest( getId() ) )
|
if( !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
@ -182,8 +182,8 @@ public:
|
||||||
|
|
||||||
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 )
|
if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 )
|
||||||
Scene00100( player );
|
Scene00100( player );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) )
|
if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -65,8 +65,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ class SubFst034 : public Sapphire::ScriptAPI::EventScript
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ class SubFst039 : public Sapphire::ScriptAPI::EventScript
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast<uint32_t>( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if ( actor == Actor0 )
|
if ( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -65,8 +65,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
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
|
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && emoteId == 41 && player.getQuestSeq( getId() ) == Seq1 )
|
if( actor == Actor0 && emoteId == 41 && player.getQuestSeq( getId() ) == Seq1 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ class SubWil020 : public Sapphire::ScriptAPI::EventScript
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
/*player.setQuestUI8BH( getId(), 0 );
|
/*player.setQuestUI8BH( getId(), 0 );
|
||||||
player.setQuestUI8AL( getId(), 0 );
|
player.setQuestUI8AL( getId(), 0 );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Manager/EventMgr.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
auto pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
if( actor == Actor0 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
"#include <Actor/Player.h>\n"
|
"#include <Actor/Player.h>\n"
|
||||||
"#include \"Manager/EventMgr.h\"\n"
|
"#include \"Manager/EventMgr.h\"\n"
|
||||||
"#include <ScriptObject.h>\n"
|
"#include <ScriptObject.h>\n"
|
||||||
"#include \"Framework.h\"\n\n"
|
"#include <Service.h>\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
std::size_t splitPos( pQuestData->id.find( "_" ) );
|
std::size_t splitPos( pQuestData->id.find( "_" ) );
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <Util/Util.h>
|
#include <Util/Util.h>
|
||||||
#include "Framework.h"
|
|
||||||
#include "Script/ScriptMgr.h"
|
#include "Script/ScriptMgr.h"
|
||||||
|
|
||||||
#include <Math/CalcStats.h>
|
#include <Math/CalcStats.h>
|
||||||
|
@ -23,6 +22,7 @@
|
||||||
|
|
||||||
#include <Util/ActorFilter.h>
|
#include <Util/ActorFilter.h>
|
||||||
#include <Util/UtilMath.h>
|
#include <Util/UtilMath.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
|
@ -36,15 +36,14 @@ using namespace Sapphire::World;
|
||||||
Action::Action::Action() = default;
|
Action::Action::Action() = default;
|
||||||
Action::Action::~Action() = default;
|
Action::Action::~Action() = default;
|
||||||
|
|
||||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, FrameworkPtr fw ) :
|
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence) :
|
||||||
Action( std::move( caster ), actionId, sequence, nullptr, std::move( fw ) )
|
Action( std::move( caster ), actionId, sequence, nullptr )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence,
|
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_pSource( std::move( caster ) ),
|
||||||
m_pFw( std::move( fw ) ),
|
|
||||||
m_actionData( std::move( actionData ) ),
|
m_actionData( std::move( actionData ) ),
|
||||||
m_id( actionId ),
|
m_id( actionId ),
|
||||||
m_targetId( 0 ),
|
m_targetId( 0 ),
|
||||||
|
@ -64,10 +63,9 @@ bool Action::Action::init()
|
||||||
if( !m_actionData )
|
if( !m_actionData )
|
||||||
{
|
{
|
||||||
// need to get actionData
|
// need to get actionData
|
||||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
assert( exdData );
|
|
||||||
|
|
||||||
auto actionData = exdData->get< Data::Action >( m_id );
|
auto actionData = exdData.get< Data::Action >( m_id );
|
||||||
assert( actionData );
|
assert( actionData );
|
||||||
|
|
||||||
m_actionData = actionData;
|
m_actionData = actionData;
|
||||||
|
@ -290,10 +288,10 @@ void Action::Action::start()
|
||||||
m_recastTimeMs / 10 );
|
m_recastTimeMs / 10 );
|
||||||
player->queuePacket( actionStartPkt );
|
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
|
// 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)
|
// script not implemented and insufficient lut data (no potencies)
|
||||||
interrupt();
|
interrupt();
|
||||||
|
@ -342,8 +340,8 @@ void Action::Action::interrupt()
|
||||||
m_pSource->sendToInRangeSet( control, true );
|
m_pSource->sendToInRangeSet( control, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||||
pScriptMgr->onInterrupt( *this );
|
scriptMgr.onInterrupt( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Action::Action::execute()
|
void Action::Action::execute()
|
||||||
|
@ -357,7 +355,7 @@ void Action::Action::execute()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||||
|
|
||||||
if( hasCastTime() )
|
if( hasCastTime() )
|
||||||
{
|
{
|
||||||
|
@ -385,7 +383,7 @@ void Action::Action::execute()
|
||||||
}
|
}
|
||||||
else if( auto player = m_pSource->getAsPlayer() )
|
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
|
// set currently casted action as the combo action if it interrupts a combo
|
||||||
|
@ -455,10 +453,10 @@ void Action::Action::buildEffects()
|
||||||
{
|
{
|
||||||
snapshotAffectedActors( m_hitActors );
|
snapshotAffectedActors( m_hitActors );
|
||||||
|
|
||||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||||
auto hasLutEntry = hasValidLutEntry();
|
auto hasLutEntry = hasValidLutEntry();
|
||||||
|
|
||||||
if( !pScriptMgr->onExecute( *this ) && !hasLutEntry )
|
if( !scriptMgr.onExecute( *this ) && !hasLutEntry )
|
||||||
{
|
{
|
||||||
if( auto player = m_pSource->getAsPlayer() )
|
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 )
|
if( actionClass != Common::ClassJob::Adventurer && currentClass != actionClass && !m_actionData->isRoleAction )
|
||||||
{
|
{
|
||||||
// check if not a base class action
|
// check if not a base class action
|
||||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
assert( exdData );
|
|
||||||
|
|
||||||
auto classJob = exdData->get< Data::ClassJob >( static_cast< uint8_t >( currentClass ) );
|
auto classJob = exdData.get< Data::ClassJob >( static_cast< uint8_t >( currentClass ) );
|
||||||
if( !classJob )
|
if( !classJob )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ namespace Sapphire::World::Action
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Action();
|
Action();
|
||||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, 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, FrameworkPtr fw );
|
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, Data::ActionPtr actionData );
|
||||||
|
|
||||||
virtual ~Action();
|
virtual ~Action();
|
||||||
|
|
||||||
|
@ -183,7 +183,6 @@ namespace Sapphire::World::Action
|
||||||
|
|
||||||
Common::ActionInterruptType m_interruptType;
|
Common::ActionInterruptType m_interruptType;
|
||||||
|
|
||||||
FrameworkPtr m_pFw;
|
|
||||||
Data::ActionPtr m_actionData;
|
Data::ActionPtr m_actionData;
|
||||||
|
|
||||||
Common::FFXIVARR_POSITION3 m_pos;
|
Common::FFXIVARR_POSITION3 m_pos;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
#include "Network/PacketWrappers/ActorControlPacket.h"
|
#include "Network/PacketWrappers/ActorControlPacket.h"
|
||||||
#include "Network/PacketWrappers/ActorControlSelfPacket.h"
|
#include "Network/PacketWrappers/ActorControlSelfPacket.h"
|
||||||
|
@ -9,7 +10,6 @@
|
||||||
#include "Actor/Player.h"
|
#include "Actor/Player.h"
|
||||||
|
|
||||||
#include "EventAction.h"
|
#include "EventAction.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
using namespace Sapphire::World;
|
using namespace Sapphire::World;
|
||||||
|
@ -20,15 +20,13 @@ using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
Action::EventAction::EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
Action::EventAction::EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
||||||
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional,
|
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional )
|
||||||
FrameworkPtr pFw )
|
|
||||||
{
|
{
|
||||||
m_additional = additional;
|
m_additional = additional;
|
||||||
m_eventId = eventId;
|
m_eventId = eventId;
|
||||||
m_id = action;
|
m_id = action;
|
||||||
m_pFw = pFw;
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto pExdData = pFw->get< Data::ExdDataGenerated >();
|
m_castTimeMs = exdData.get< Sapphire::Data::EventAction >( action )->castTime * 1000; // TODO: Add security checks.
|
||||||
m_castTimeMs = pExdData->get< Sapphire::Data::EventAction >( action )->castTime * 1000; // TODO: Add security checks.
|
|
||||||
m_onActionFinishClb = std::move( finishRef );
|
m_onActionFinishClb = std::move( finishRef );
|
||||||
m_onActionInterruptClb = std::move( interruptRef );
|
m_onActionInterruptClb = std::move( interruptRef );
|
||||||
m_pSource = std::move( pActor );
|
m_pSource = std::move( pActor );
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
virtual ~EventAction();
|
virtual ~EventAction();
|
||||||
|
|
||||||
EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
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;
|
void start() override;
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,13 @@ using namespace Sapphire::World::Action;
|
||||||
|
|
||||||
ItemAction::ItemAction( Sapphire::Entity::CharaPtr source, uint32_t itemId,
|
ItemAction::ItemAction( Sapphire::Entity::CharaPtr source, uint32_t itemId,
|
||||||
Sapphire::Data::ItemActionPtr itemActionData, uint16_t itemSourceSlot,
|
Sapphire::Data::ItemActionPtr itemActionData, uint16_t itemSourceSlot,
|
||||||
uint16_t itemSourceContainer, Sapphire::FrameworkPtr fw ) :
|
uint16_t itemSourceContainer ) :
|
||||||
m_itemAction( std::move( itemActionData ) ),
|
m_itemAction( std::move( itemActionData ) ),
|
||||||
m_itemSourceSlot( itemSourceSlot ),
|
m_itemSourceSlot( itemSourceSlot ),
|
||||||
m_itemSourceContainer( itemSourceContainer )
|
m_itemSourceContainer( itemSourceContainer )
|
||||||
{
|
{
|
||||||
m_id = itemId;
|
m_id = itemId;
|
||||||
m_pSource = std::move( source );
|
m_pSource = std::move( source );
|
||||||
m_pFw = std::move( fw );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemAction::start()
|
void ItemAction::start()
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Sapphire::World::Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ItemAction( Entity::CharaPtr source, uint32_t itemId, Data::ItemActionPtr itemActionData,
|
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;
|
virtual ~ItemAction() = default;
|
||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
|
|
|
@ -15,8 +15,8 @@ using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
using namespace Sapphire::World::Action;
|
using namespace Sapphire::World::Action;
|
||||||
|
|
||||||
MountAction::MountAction( Sapphire::Entity::CharaPtr source, uint16_t mountId, uint16_t sequence, Data::ActionPtr actionData, Sapphire::FrameworkPtr fw ) :
|
MountAction::MountAction( Sapphire::Entity::CharaPtr source, uint16_t mountId, uint16_t sequence, Data::ActionPtr actionData ) :
|
||||||
Action::Action( source, 4, sequence, actionData, fw ),
|
Action::Action( source, 4, sequence, actionData ),
|
||||||
m_mountId( mountId )
|
m_mountId( mountId )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Sapphire::World::Action
|
||||||
class MountAction : public Action
|
class MountAction : public Action
|
||||||
{
|
{
|
||||||
public:
|
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;
|
virtual ~MountAction() = default;
|
||||||
|
|
||||||
bool preCheck() override;
|
bool preCheck() override;
|
||||||
|
|
|
@ -35,26 +35,26 @@
|
||||||
#include "BNpcTemplate.h"
|
#include "BNpcTemplate.h"
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
#include <Manager/TerritoryMgr.h>
|
#include <Manager/TerritoryMgr.h>
|
||||||
#include <Manager/NaviMgr.h>
|
#include <Manager/NaviMgr.h>
|
||||||
#include <Manager/TerritoryMgr.h>
|
#include <Manager/TerritoryMgr.h>
|
||||||
#include <Manager/RNGMgr.h>
|
#include <Manager/RNGMgr.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
Sapphire::Entity::BNpc::BNpc( FrameworkPtr pFw ) :
|
Sapphire::Entity::BNpc::BNpc() :
|
||||||
Npc( ObjKind::BattleNpc, pFw )
|
Npc( ObjKind::BattleNpc )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
|
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 ) :
|
uint8_t level, uint32_t maxHp, TerritoryPtr pZone ) :
|
||||||
Npc( ObjKind::BattleNpc, pFw )
|
Npc( ObjKind::BattleNpc )
|
||||||
{
|
{
|
||||||
m_id = id;
|
m_id = id;
|
||||||
m_modelChara = pTemplate->getModelChara();
|
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_customize, pTemplate->getCustomize(), sizeof( m_customize ) );
|
||||||
memcpy( m_modelEquip, pTemplate->getModelEquip(), sizeof( m_modelEquip ) );
|
memcpy( m_modelEquip, pTemplate->getModelEquip(), sizeof( m_modelEquip ) );
|
||||||
|
|
||||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
assert( exdData );
|
|
||||||
|
|
||||||
auto bNpcBaseData = exdData->get< Data::BNpcBase >( m_bNpcBaseId );
|
auto bNpcBaseData = exdData.get< Data::BNpcBase >( m_bNpcBaseId );
|
||||||
assert( bNpcBaseData );
|
assert( bNpcBaseData );
|
||||||
|
|
||||||
m_radius = bNpcBaseData->scale;
|
m_radius = bNpcBaseData->scale;
|
||||||
|
|
||||||
auto modelChara = exdData->get< Data::ModelChara >( bNpcBaseData->modelChara );
|
auto modelChara = exdData.get< Data::ModelChara >( bNpcBaseData->modelChara );
|
||||||
if( modelChara )
|
if( modelChara )
|
||||||
{
|
{
|
||||||
auto modelSkeleton = exdData->get< Data::ModelSkeleton >( modelChara->model );
|
auto modelSkeleton = exdData.get< Data::ModelSkeleton >( modelChara->model );
|
||||||
if( modelSkeleton )
|
if( modelSkeleton )
|
||||||
m_radius *= modelSkeleton->radius;
|
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 )
|
void Sapphire::Entity::BNpc::aggro( Sapphire::Entity::CharaPtr pChara )
|
||||||
{
|
{
|
||||||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
auto& pRNGMgr = Common::Service< World::Manager::RNGMgr >::ref();
|
||||||
auto variation = static_cast< uint32_t >( pRNGMgr->getRandGenerator< float >( 500, 1000 ).next() );
|
auto variation = static_cast< uint32_t >( pRNGMgr.getRandGenerator< float >( 500, 1000 ).next() );
|
||||||
|
|
||||||
m_lastAttack = Util::getTimeMs() + variation;
|
m_lastAttack = Util::getTimeMs() + variation;
|
||||||
hateListUpdate( pChara, 1 );
|
hateListUpdate( pChara, 1 );
|
||||||
|
@ -692,7 +691,6 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
|
||||||
m_lastAttack = tick;
|
m_lastAttack = tick;
|
||||||
srand( static_cast< uint32_t >( tick ) );
|
srand( static_cast< uint32_t >( tick ) );
|
||||||
|
|
||||||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
|
||||||
auto damage = Math::CalcStats::calcAutoAttackDamage( *this );
|
auto damage = Math::CalcStats::calcAutoAttackDamage( *this );
|
||||||
|
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
|
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 level = getLevel();
|
||||||
uint8_t job = static_cast< uint8_t >( getClass() );
|
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 classInfo = exdData.get< Sapphire::Data::ClassJob >( job );
|
||||||
auto paramGrowthInfo = pExdData->get< Sapphire::Data::ParamGrow >( level );
|
auto paramGrowthInfo = exdData.get< Sapphire::Data::ParamGrow >( level );
|
||||||
|
|
||||||
float base = Math::CalcStats::calculateBaseStat( *this );
|
float base = Math::CalcStats::calculateBaseStat( *this );
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,9 @@ namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BNpc( FrameworkPtr pFw );
|
BNpc();
|
||||||
BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
|
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;
|
virtual ~BNpc() override;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
|
@ -25,7 +26,6 @@
|
||||||
#include "Chara.h"
|
#include "Chara.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Manager/TerritoryMgr.h"
|
#include "Manager/TerritoryMgr.h"
|
||||||
#include "Framework.h"
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
|
@ -33,11 +33,10 @@ using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
Sapphire::Entity::Chara::Chara( ObjKind type, FrameworkPtr pFw ) :
|
Sapphire::Entity::Chara::Chara( ObjKind type ) :
|
||||||
Actor( type ),
|
Actor( type ),
|
||||||
m_pose( 0 ),
|
m_pose( 0 ),
|
||||||
m_targetId( INVALID_GAME_OBJECT_ID64 ),
|
m_targetId( INVALID_GAME_OBJECT_ID64 ),
|
||||||
m_pFw( std::move( std::move( pFw ) ) ),
|
|
||||||
m_directorId( 0 ),
|
m_directorId( 0 ),
|
||||||
m_radius( 1.f )
|
m_radius( 1.f )
|
||||||
{
|
{
|
||||||
|
@ -557,7 +556,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
||||||
/*! \param StatusEffectPtr to be applied to the actor */
|
/*! \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 )
|
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 );
|
effect->setParam( param );
|
||||||
addStatusEffect( effect );
|
addStatusEffect( effect );
|
||||||
}
|
}
|
||||||
|
@ -569,7 +568,7 @@ void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_
|
||||||
if( hasStatusEffect( id ) )
|
if( hasStatusEffect( id ) )
|
||||||
return;
|
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 );
|
effect->setParam( param );
|
||||||
addStatusEffect( effect );
|
addStatusEffect( effect );
|
||||||
|
|
||||||
|
@ -763,10 +762,9 @@ float Sapphire::Entity::Chara::getRadius() const
|
||||||
|
|
||||||
Sapphire::Common::BaseParam Sapphire::Entity::Chara::getPrimaryStat() const
|
Sapphire::Common::BaseParam Sapphire::Entity::Chara::getPrimaryStat() const
|
||||||
{
|
{
|
||||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
assert( exdData );
|
|
||||||
|
|
||||||
auto classJob = exdData->get< Data::ClassJob >( static_cast< uint16_t >( getClass() ) );
|
auto classJob = exdData.get< Data::ClassJob >( static_cast< uint16_t >( getClass() ) );
|
||||||
assert( classJob );
|
assert( classJob );
|
||||||
|
|
||||||
return static_cast< Sapphire::Common::BaseParam >( classJob->primaryStat );
|
return static_cast< Sapphire::Common::BaseParam >( classJob->primaryStat );
|
||||||
|
|
|
@ -126,7 +126,6 @@ namespace Sapphire::Entity
|
||||||
std::queue< uint8_t > m_statusEffectFreeSlotQueue;
|
std::queue< uint8_t > m_statusEffectFreeSlotQueue;
|
||||||
std::vector< std::pair< uint8_t, uint32_t > > m_statusEffectList;
|
std::vector< std::pair< uint8_t, uint32_t > > m_statusEffectList;
|
||||||
std::map< uint8_t, StatusEffect::StatusEffectPtr > m_statusEffectMap;
|
std::map< uint8_t, StatusEffect::StatusEffectPtr > m_statusEffectMap;
|
||||||
FrameworkPtr m_pFw;
|
|
||||||
|
|
||||||
/*! Detour Crowd AgentId */
|
/*! Detour Crowd AgentId */
|
||||||
uint32_t m_agentId;
|
uint32_t m_agentId;
|
||||||
|
@ -135,7 +134,7 @@ namespace Sapphire::Entity
|
||||||
float m_radius;
|
float m_radius;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Chara( Common::ObjKind type, FrameworkPtr pFw );
|
Chara( Common::ObjKind type );
|
||||||
|
|
||||||
virtual ~Chara() override;
|
virtual ~Chara() override;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Npc.h"
|
#include "Npc.h"
|
||||||
#include "Manager/TerritoryMgr.h"
|
#include "Manager/TerritoryMgr.h"
|
||||||
#include "Framework.h"
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
|
@ -33,8 +32,8 @@ using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
Sapphire::Entity::Npc::Npc( ObjKind type, FrameworkPtr pFw ) :
|
Sapphire::Entity::Npc::Npc( ObjKind type ) :
|
||||||
Chara( type, pFw )
|
Chara( type )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Npc( Common::ObjKind type, FrameworkPtr pFw );
|
Npc( Common::ObjKind type );
|
||||||
|
|
||||||
virtual ~Npc() override;
|
virtual ~Npc() override;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include "Math/CalcBattle.h"
|
#include "Math/CalcBattle.h"
|
||||||
|
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
@ -59,8 +58,8 @@ using InvSlotPair = std::pair< uint16_t, int8_t >;
|
||||||
using InvSlotPairVec = std::vector< InvSlotPair >;
|
using InvSlotPairVec = std::vector< InvSlotPair >;
|
||||||
|
|
||||||
// player constructor
|
// player constructor
|
||||||
Sapphire::Entity::Player::Player( FrameworkPtr pFw ) :
|
Sapphire::Entity::Player::Player() :
|
||||||
Chara( ObjKind::Player, pFw ),
|
Chara( ObjKind::Player ),
|
||||||
m_lastWrite( 0 ),
|
m_lastWrite( 0 ),
|
||||||
m_lastPing( 0 ),
|
m_lastPing( 0 ),
|
||||||
m_bIsLogin( false ),
|
m_bIsLogin( false ),
|
||||||
|
@ -201,9 +200,7 @@ bool Sapphire::Entity::Player::isMarkedForRemoval() const
|
||||||
|
|
||||||
Sapphire::Common::OnlineStatus Sapphire::Entity::Player::getOnlineStatus() const
|
Sapphire::Common::OnlineStatus Sapphire::Entity::Player::getOnlineStatus() const
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
if( !pExdData )
|
|
||||||
return OnlineStatus::Online;
|
|
||||||
|
|
||||||
uint32_t statusDisplayOrder = 0xFF14;
|
uint32_t statusDisplayOrder = 0xFF14;
|
||||||
uint32_t applicableStatus = static_cast< uint32_t >( OnlineStatus::Online );
|
uint32_t applicableStatus = static_cast< uint32_t >( OnlineStatus::Online );
|
||||||
|
@ -215,7 +212,7 @@ Sapphire::Common::OnlineStatus Sapphire::Entity::Player::getOnlineStatus() const
|
||||||
if( !bit )
|
if( !bit )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto pOnlineStatus = pExdData->get< Data::OnlineStatus >( i );
|
auto pOnlineStatus = exdData.get< Data::OnlineStatus >( i );
|
||||||
if( !pOnlineStatus )
|
if( !pOnlineStatus )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -256,11 +253,11 @@ void Sapphire::Entity::Player::calculateStats()
|
||||||
uint8_t level = getLevel();
|
uint8_t level = getLevel();
|
||||||
uint8_t job = static_cast< uint8_t >( getClass() );
|
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 classInfo = exdData.get< Sapphire::Data::ClassJob >( job );
|
||||||
auto tribeInfo = pExdData->get< Sapphire::Data::Tribe >( tribe );
|
auto tribeInfo = exdData.get< Sapphire::Data::Tribe >( tribe );
|
||||||
auto paramGrowthInfo = pExdData->get< Sapphire::Data::ParamGrow >( level );
|
auto paramGrowthInfo = exdData.get< Sapphire::Data::ParamGrow >( level );
|
||||||
|
|
||||||
float base = Math::CalcStats::calculateBaseStat( *this );
|
float base = Math::CalcStats::calculateBaseStat( *this );
|
||||||
|
|
||||||
|
@ -293,7 +290,7 @@ void Sapphire::Entity::Player::calculateStats()
|
||||||
|
|
||||||
m_baseStats.max_mp = 10000;
|
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 )
|
if( m_mp > m_baseStats.max_mp )
|
||||||
m_mp = m_baseStats.max_mp;
|
m_mp = m_baseStats.max_mp;
|
||||||
|
@ -344,18 +341,18 @@ void Sapphire::Entity::Player::sendStats()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
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 )
|
if( data == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setStateFlag( PlayerStateFlag::BetweenAreas );
|
setStateFlag( PlayerStateFlag::BetweenAreas );
|
||||||
|
|
||||||
auto pInstanceObjectCache = m_pFw->get< InstanceObjectCache >();
|
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
||||||
auto pop = pInstanceObjectCache->getPopRange( data->territory, data->level[ 0 ] );
|
auto pop = instanceObjectCache.getPopRange( data->territory, data->level[ 0 ] );
|
||||||
|
|
||||||
Common::FFXIVARR_POSITION3 pos;
|
Common::FFXIVARR_POSITION3 pos;
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
|
@ -378,8 +375,8 @@ void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
||||||
}
|
}
|
||||||
|
|
||||||
sendDebug( "Teleport: {0} {1} ({2})",
|
sendDebug( "Teleport: {0} {1} ({2})",
|
||||||
pExdData->get< Sapphire::Data::PlaceName >( data->placeName )->name,
|
exdData.get< Sapphire::Data::PlaceName >( data->placeName )->name,
|
||||||
pExdData->get< Sapphire::Data::PlaceName >( data->aethernetName )->name,
|
exdData.get< Sapphire::Data::PlaceName >( data->aethernetName )->name,
|
||||||
data->territory );
|
data->territory );
|
||||||
|
|
||||||
// TODO: this should be simplified and a type created in server_common/common.h.
|
// TODO: this should be simplified and a type created in server_common/common.h.
|
||||||
|
@ -421,16 +418,16 @@ void Sapphire::Entity::Player::returnToHomepoint()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
m_onEnterEventDone = false;
|
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
|
// todo: this will require proper handling, for now just return the player to their previous area
|
||||||
m_pos = m_prevPos;
|
m_pos = m_prevPos;
|
||||||
m_rot = m_prevRot;
|
m_rot = m_prevRot;
|
||||||
m_territoryTypeId = m_prevTerritoryTypeId;
|
m_territoryTypeId = m_prevTerritoryTypeId;
|
||||||
|
|
||||||
if( !pTeriMgr->movePlayer( m_territoryTypeId, getAsPlayer() ) )
|
if( !teriMgr.movePlayer( m_territoryTypeId, getAsPlayer() ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,9 +436,9 @@ void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
||||||
bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId )
|
bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId )
|
||||||
{
|
{
|
||||||
m_onEnterEventDone = false;
|
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 )
|
if( !instance )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -454,7 +451,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance )
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
auto currentZone = getCurrentTerritory();
|
auto currentZone = getCurrentTerritory();
|
||||||
|
|
||||||
// zoning within the same zone won't cause the prev data to be overwritten
|
// zoning within the same zone won't cause the prev data to be overwritten
|
||||||
|
@ -466,7 +463,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance )
|
||||||
m_prevTerritoryId = getTerritoryId();
|
m_prevTerritoryId = getTerritoryId();
|
||||||
}
|
}
|
||||||
|
|
||||||
return pTeriMgr->movePlayer( instance, getAsPlayer() );
|
return teriMgr.movePlayer( instance, getAsPlayer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIVARR_POSITION3 pos )
|
bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIVARR_POSITION3 pos )
|
||||||
|
@ -475,7 +472,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIV
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
auto currentZone = getCurrentTerritory();
|
auto currentZone = getCurrentTerritory();
|
||||||
|
|
||||||
// zoning within the same zone won't cause the prev data to be overwritten
|
// zoning within the same zone won't cause the prev data to be overwritten
|
||||||
|
@ -487,7 +484,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIV
|
||||||
m_prevTerritoryId = getTerritoryId();
|
m_prevTerritoryId = getTerritoryId();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pTeriMgr->movePlayer( instance, getAsPlayer() ) )
|
if( teriMgr.movePlayer( instance, getAsPlayer() ) )
|
||||||
{
|
{
|
||||||
m_pos = pos;
|
m_pos = pos;
|
||||||
return true;
|
return true;
|
||||||
|
@ -498,7 +495,7 @@ bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIV
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::exitInstance()
|
bool Sapphire::Entity::Player::exitInstance()
|
||||||
{
|
{
|
||||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
|
|
||||||
auto pZone = getCurrentTerritory();
|
auto pZone = getCurrentTerritory();
|
||||||
auto pInstance = pZone->getAsInstanceContent();
|
auto pInstance = pZone->getAsInstanceContent();
|
||||||
|
@ -507,14 +504,14 @@ bool Sapphire::Entity::Player::exitInstance()
|
||||||
resetMp();
|
resetMp();
|
||||||
|
|
||||||
// check if housing zone
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !pTeriMgr->movePlayer( m_prevTerritoryTypeId, getAsPlayer() ) )
|
if( !teriMgr.movePlayer( m_prevTerritoryTypeId, getAsPlayer() ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,12 +599,12 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
||||||
|
|
||||||
// section to starts at 320 - 4 bytes long
|
// 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;
|
int32_t offset = 4;
|
||||||
|
|
||||||
auto info = pExdData->get< Sapphire::Data::Map >(
|
auto info = exdData.get< Sapphire::Data::Map >(
|
||||||
pExdData->get< Sapphire::Data::TerritoryType >( getCurrentTerritory()->getTerritoryTypeId() )->map );
|
exdData.get< Sapphire::Data::TerritoryType >( getCurrentTerritory()->getTerritoryTypeId() )->map );
|
||||||
if( info->discoveryArrayByte )
|
if( info->discoveryArrayByte )
|
||||||
offset = 5 + 2 * info->discoveryIndex;
|
offset = 5 + 2 * info->discoveryIndex;
|
||||||
else
|
else
|
||||||
|
@ -622,7 +619,7 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
||||||
|
|
||||||
uint16_t level = getLevel();
|
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 );
|
gainExp( exp );
|
||||||
|
|
||||||
|
@ -706,11 +703,11 @@ void Sapphire::Entity::Player::gainExp( uint32_t amount )
|
||||||
return;
|
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 ) );
|
queuePacket( makeActorControlSelf( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) );
|
||||||
|
|
||||||
|
@ -778,15 +775,15 @@ void Sapphire::Entity::Player::sendStatusUpdate()
|
||||||
|
|
||||||
uint8_t Sapphire::Entity::Player::getLevel() const
|
uint8_t Sapphire::Entity::Player::getLevel() const
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||||
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Sapphire::Entity::Player::getLevelForClass( Common::ClassJob pClass ) const
|
uint8_t Sapphire::Entity::Player::getLevelForClass( Common::ClassJob pClass ) const
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( pClass ) )->expArrayIndex;
|
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( pClass ) )->expArrayIndex;
|
||||||
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,15 +795,15 @@ bool Sapphire::Entity::Player::isClassJobUnlocked( Common::ClassJob classJob ) c
|
||||||
|
|
||||||
uint32_t Sapphire::Entity::Player::getExp() const
|
uint32_t Sapphire::Entity::Player::getExp() const
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||||
return m_expArray[ classJobIndex ];
|
return m_expArray[ classJobIndex ];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setExp( uint32_t amount )
|
void Sapphire::Entity::Player::setExp( uint32_t amount )
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||||
m_expArray[ classJobIndex ] = amount;
|
m_expArray[ classJobIndex ] = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,15 +844,15 @@ void Sapphire::Entity::Player::setClassJob( Common::ClassJob classJob )
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setLevel( uint8_t level )
|
void Sapphire::Entity::Player::setLevel( uint8_t level )
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||||
m_classArray[ classJobIndex ] = level;
|
m_classArray[ classJobIndex ] = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob classjob )
|
void Sapphire::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob classjob )
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( classjob ) )->expArrayIndex;
|
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( classjob ) )->expArrayIndex;
|
||||||
|
|
||||||
if( m_classArray[ classJobIndex ] == 0 )
|
if( m_classArray[ classJobIndex ] == 0 )
|
||||||
insertDbClass( classJobIndex );
|
insertDbClass( classJobIndex );
|
||||||
|
@ -997,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
|
bool Sapphire::Entity::Player::actionHasCastTime( uint32_t actionId ) //TODO: Add logic for special cases
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto actionInfoPtr = pExdData->get< Sapphire::Data::Action >( actionId );
|
auto actionInfoPtr = exdData.get< Sapphire::Data::Action >( actionId );
|
||||||
if( actionInfoPtr->preservesCombo )
|
if( actionInfoPtr->preservesCombo )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1149,8 +1146,8 @@ void Sapphire::Entity::Player::update( uint64_t tickCount )
|
||||||
|
|
||||||
void Sapphire::Entity::Player::onMobKill( uint16_t nameId )
|
void Sapphire::Entity::Player::onMobKill( uint16_t nameId )
|
||||||
{
|
{
|
||||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||||
pScriptMgr->onBNpcKill( *getAsPlayer(), nameId );
|
scriptMgr.onBNpcKill( *getAsPlayer(), nameId );
|
||||||
|
|
||||||
if( isActionLearned( static_cast< uint8_t >( Common::UnlockEntry::HuntingLog ) ) )
|
if( isActionLearned( static_cast< uint8_t >( Common::UnlockEntry::HuntingLog ) ) )
|
||||||
{
|
{
|
||||||
|
@ -1535,10 +1532,9 @@ void Sapphire::Entity::Player::dismount()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::spawnCompanion( uint16_t id )
|
void Sapphire::Entity::Player::spawnCompanion( uint16_t id )
|
||||||
{
|
{
|
||||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
assert( exdData );
|
|
||||||
|
|
||||||
auto companion = exdData->get< Data::Companion >( id );
|
auto companion = exdData.get< Data::Companion >( id );
|
||||||
if( !id )
|
if( !id )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1575,8 +1571,8 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
||||||
//uint64_t tick = Util::getTimeMs();
|
//uint64_t tick = Util::getTimeMs();
|
||||||
//srand(static_cast< uint32_t >(tick));
|
//srand(static_cast< uint32_t >(tick));
|
||||||
|
|
||||||
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
|
auto& RNGMgr = Common::Service< World::Manager::RNGMgr >::ref();
|
||||||
auto variation = static_cast< uint32_t >( pRNGMgr->getRandGenerator< float >( 0, 3 ).next() );
|
auto variation = static_cast< uint32_t >( RNGMgr.getRandGenerator< float >( 0, 3 ).next() );
|
||||||
|
|
||||||
auto damage = Math::CalcStats::calcAutoAttackDamage( *this );
|
auto damage = Math::CalcStats::calcAutoAttackDamage( *this );
|
||||||
|
|
||||||
|
@ -1741,8 +1737,8 @@ void Sapphire::Entity::Player::sendZonePackets()
|
||||||
sendItemLevel();
|
sendItemLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pHousingMgr = m_pFw->get< HousingMgr >();
|
auto& housingMgr = Common::Service< HousingMgr >::ref();
|
||||||
if( Sapphire::LandPtr pLand = pHousingMgr->getLandByOwnerId( getId() ) )
|
if( Sapphire::LandPtr pLand = housingMgr.getLandByOwnerId( getId() ) )
|
||||||
{
|
{
|
||||||
uint32_t state = 0;
|
uint32_t state = 0;
|
||||||
|
|
||||||
|
@ -1869,14 +1865,14 @@ void Sapphire::Entity::Player::emoteInterrupt()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId )
|
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
|
// 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 )
|
if( targetAetheryte )
|
||||||
{
|
{
|
||||||
auto fromAetheryte = pExdData->get< Sapphire::Data::Aetheryte >(
|
auto fromAetheryte = exdData.get< Sapphire::Data::Aetheryte >(
|
||||||
pExdData->get< Sapphire::Data::TerritoryType >( getZoneId() )->aetheryte );
|
exdData.get< Sapphire::Data::TerritoryType >( getZoneId() )->aetheryte );
|
||||||
|
|
||||||
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
|
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
|
||||||
auto cost = static_cast< uint16_t > (
|
auto cost = static_cast< uint16_t > (
|
||||||
|
@ -2020,7 +2016,7 @@ Sapphire::Common::HuntingLogEntry& Sapphire::Entity::Player::getHuntingLogEntry(
|
||||||
|
|
||||||
void Sapphire::Entity::Player::sendHuntingLog()
|
void Sapphire::Entity::Player::sendHuntingLog()
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for( const auto& entry : m_huntingLogEntries )
|
for( const auto& entry : m_huntingLogEntries )
|
||||||
{
|
{
|
||||||
|
@ -2037,7 +2033,7 @@ void Sapphire::Entity::Player::sendHuntingLog()
|
||||||
bool allComplete = true;
|
bool allComplete = true;
|
||||||
auto monsterNoteId = ( count + 1 ) * 10000 + entry.rank * 10 + i;
|
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 )
|
if( !monsterNote )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -2066,7 +2062,7 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id )
|
||||||
{
|
{
|
||||||
std::vector< uint32_t > rankRewards{ 2500, 10000, 20000, 30000, 40000 };
|
std::vector< uint32_t > rankRewards{ 2500, 10000, 20000, 30000, 40000 };
|
||||||
const auto maxRank = 4;
|
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 ];
|
auto& logEntry = m_huntingLogEntries[ static_cast< uint8_t >( getClass() ) - 1 ];
|
||||||
|
|
||||||
|
@ -2074,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
|
// make sure we get the matching base-class if a job is being used
|
||||||
auto currentClass = static_cast< uint8_t >( getClass() );
|
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 )
|
if( !classJobInfo )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2084,7 +2080,7 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id )
|
||||||
bool sectionComplete = true;
|
bool sectionComplete = true;
|
||||||
bool sectionChanged = false;
|
bool sectionChanged = false;
|
||||||
uint32_t monsterNoteId = static_cast< uint32_t >( classJobInfo->classJobParent * 10000 + logEntry.rank * 10 + i );
|
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
|
// for classes that don't have entries, if the first fails the rest will fail
|
||||||
if( !note )
|
if( !note )
|
||||||
|
@ -2092,7 +2088,7 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id )
|
||||||
|
|
||||||
for( auto x = 0; x < 4; ++x )
|
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 ] )
|
if( note1->bNpcName == id && logEntry.entries[ i - 1 ][ x ] < note->count[ x ] )
|
||||||
{
|
{
|
||||||
logEntry.entries[ i - 1 ][ x ]++;
|
logEntry.entries[ i - 1 ][ x ]++;
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*! Contructor */
|
/*! Contructor */
|
||||||
Player( FrameworkPtr pFw );
|
Player();
|
||||||
|
|
||||||
/*! Destructor */
|
/*! Destructor */
|
||||||
~Player();
|
~Player();
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
#include "Territory/Territory.h"
|
#include "Territory/Territory.h"
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
#include "Action/EventAction.h"
|
#include "Action/EventAction.h"
|
||||||
|
|
||||||
|
@ -300,7 +299,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId,
|
||||||
uint64_t additional )
|
uint64_t additional )
|
||||||
{
|
{
|
||||||
auto pEventAction = World::Action::make_EventAction( getAsChara(), eventId, action,
|
auto pEventAction = World::Action::make_EventAction( getAsChara(), eventId, action,
|
||||||
finishCallback, interruptCallback, additional, m_pFw );
|
finishCallback, interruptCallback, additional );
|
||||||
|
|
||||||
auto pEvent = getEvent( eventId );
|
auto pEvent = getEvent( eventId );
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||||
|
|
||||||
|
@ -30,8 +29,7 @@
|
||||||
#include "Manager/InventoryMgr.h"
|
#include "Manager/InventoryMgr.h"
|
||||||
#include "Manager/ItemMgr.h"
|
#include "Manager/ItemMgr.h"
|
||||||
|
|
||||||
#include "Framework.h"
|
#include <Service.h>
|
||||||
#include <Network/CommonActorControl.h>
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
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,
|
auto setupContainer = [ this ]( InventoryType type, uint8_t maxSize, const std::string& tableName,
|
||||||
bool isMultiStorage, bool isPersistentStorage = true )
|
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
|
// main bags
|
||||||
setupContainer( Bag0, 34, "charaiteminventory", true );
|
setupContainer( Bag0, 34, "charaiteminventory", true );
|
||||||
|
@ -114,13 +112,11 @@ void Sapphire::Entity::Player::sendItemLevel()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
||||||
{
|
{
|
||||||
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||||
if( !exdData )
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto itemInfo = exdData->get< Sapphire::Data::Item >( pItem->getId() );
|
auto itemInfo = exdData.get< Sapphire::Data::Item >( pItem->getId() );
|
||||||
auto itemClassJob = itemInfo->classJobUse;
|
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 currentParentClass = static_cast< ClassJob >( classJobInfo->classJobParent );
|
||||||
auto newClassJob = static_cast< ClassJob >( itemClassJob );
|
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 )
|
void Sapphire::Entity::Player::equipSoulCrystal( ItemPtr pItem, bool updateJob )
|
||||||
{
|
{
|
||||||
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
auto exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||||
if ( !exdData )
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto itemInfo = exdData->get< Sapphire::Data::Item >( pItem->getId() );
|
auto itemInfo = exdData.get< Sapphire::Data::Item >( pItem->getId() );
|
||||||
auto itemClassJob = itemInfo->classJobUse;
|
auto itemClassJob = itemInfo->classJobUse;
|
||||||
auto newClassJob = static_cast< ClassJob >( itemClassJob );
|
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 )
|
void Sapphire::Entity::Player::unequipSoulCrystal( ItemPtr pItem )
|
||||||
{
|
{
|
||||||
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||||
if ( !exdData )
|
|
||||||
return;
|
|
||||||
|
|
||||||
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 );
|
auto parentClass = static_cast< ClassJob >( currentClassJob->classJobParent );
|
||||||
setClassJob( parentClass );
|
setClassJob( parentClass );
|
||||||
}
|
}
|
||||||
|
@ -406,11 +398,11 @@ void Sapphire::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t
|
||||||
|
|
||||||
void Sapphire::Entity::Player::sendInventory()
|
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 )
|
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 )
|
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 ];
|
auto storage = m_storageMap[ type ];
|
||||||
|
|
||||||
|
@ -498,13 +490,13 @@ void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
||||||
if( storage->isMultiStorage() )
|
if( storage->isMultiStorage() )
|
||||||
query += " AND storageId = " + std::to_string( static_cast< uint16_t >( type ) );
|
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
|
void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_UP );
|
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_UP );
|
||||||
|
|
||||||
// todo: add more fields
|
// todo: add more fields
|
||||||
stmt->setInt( 1, pItem->getStackSize() );
|
stmt->setInt( 1, pItem->getStackSize() );
|
||||||
|
@ -513,17 +505,17 @@ void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
||||||
|
|
||||||
stmt->setInt64( 4, pItem->getUId() );
|
stmt->setInt64( 4, pItem->getUId() );
|
||||||
|
|
||||||
pDb->directExecute( stmt );
|
db.directExecute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::deleteItemDb( Sapphire::ItemPtr item ) const
|
void Sapphire::Entity::Player::deleteItemDb( Sapphire::ItemPtr item ) const
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_DELETE );
|
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_DELETE );
|
||||||
|
|
||||||
stmt->setInt64( 1, item->getUId() );
|
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 )
|
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& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto itemInfo = exdData.get< Sapphire::Data::Item >( catalogId );
|
||||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
|
||||||
|
|
||||||
// if item data doesn't exist or it's a blank field
|
// if item data doesn't exist or it's a blank field
|
||||||
if( !itemInfo || itemInfo->levelItem == 0 )
|
if( !itemInfo || itemInfo->levelItem == 0 )
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
#include "Network/GameConnection.h"
|
#include "Network/GameConnection.h"
|
||||||
#include "Network/PacketWrappers/QuestMessagePacket.h"
|
#include "Network/PacketWrappers/QuestMessagePacket.h"
|
||||||
|
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
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 )
|
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();
|
uint32_t playerLevel = getLevel();
|
||||||
auto questInfo = pExdData->get< Sapphire::Data::Quest >( questId );
|
auto questInfo = exdData.get< Sapphire::Data::Quest >( questId );
|
||||||
|
|
||||||
|
|
||||||
if( !questInfo )
|
if( !questInfo )
|
||||||
return false;
|
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
|
// TODO: use the correct formula, this one is wrong
|
||||||
uint32_t exp =
|
uint32_t exp =
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
#include <Database/DatabaseDef.h>
|
#include <Database/DatabaseDef.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
#include "Network/GameConnection.h"
|
#include "Network/GameConnection.h"
|
||||||
#include "Network/PacketWrappers/PlayerSetupPacket.h"
|
#include "Network/PacketWrappers/PlayerSetupPacket.h"
|
||||||
|
@ -19,7 +20,6 @@
|
||||||
#include "Manager/ItemMgr.h"
|
#include "Manager/ItemMgr.h"
|
||||||
|
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
@ -29,16 +29,16 @@ using namespace Sapphire::World::Manager;
|
||||||
// load player from the db
|
// load player from the db
|
||||||
bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession )
|
bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession )
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
m_pSession = pSession;
|
m_pSession = pSession;
|
||||||
|
|
||||||
const std::string char_id_str = std::to_string( charId );
|
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 );
|
stmt->setUInt( 1, charId );
|
||||||
auto res = pDb->query( stmt );
|
auto res = db.query( stmt );
|
||||||
|
|
||||||
if( !res->next() )
|
if( !res->next() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -67,10 +67,10 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
||||||
TerritoryPtr pCurrZone = nullptr;
|
TerritoryPtr pCurrZone = nullptr;
|
||||||
|
|
||||||
// if the zone is an instanceContent zone, we need to actually find the instance
|
// 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
|
// 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 none found, revert to previous zone and position
|
||||||
if( !pCurrZone )
|
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.y = m_prevPos.y;
|
||||||
m_pos.z = m_prevPos.z;
|
m_pos.z = m_prevPos.z;
|
||||||
setRot( m_prevRot );
|
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
|
// 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;
|
zoneId = m_prevTerritoryTypeId;
|
||||||
m_pos.x = m_prevPos.x;
|
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;
|
m_pos.z = m_prevPos.z;
|
||||||
setRot( m_prevRot );
|
setRot( m_prevRot );
|
||||||
}
|
}
|
||||||
else if( pTeriMgr->isHousingTerritory( zoneId ) )
|
else if( teriMgr.isHousingTerritory( zoneId ) )
|
||||||
{
|
{
|
||||||
pCurrZone = pTeriMgr->getZoneByLandSetId( m_territoryId );
|
pCurrZone = teriMgr.getZoneByLandSetId( m_territoryId );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pCurrZone = pTeriMgr->getZoneByTerritoryTypeId( zoneId );
|
pCurrZone = teriMgr.getZoneByTerritoryTypeId( zoneId );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_territoryTypeId = zoneId;
|
m_territoryTypeId = zoneId;
|
||||||
|
@ -113,7 +113,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
||||||
|
|
||||||
// default to new gridania
|
// default to new gridania
|
||||||
// TODO: should probably just abort and mark character as corrupt
|
// 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.x = 0.0f;
|
||||||
m_pos.y = 0.0f;
|
m_pos.y = 0.0f;
|
||||||
|
@ -250,7 +250,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
||||||
|
|
||||||
initSpawnIdQueue();
|
initSpawnIdQueue();
|
||||||
|
|
||||||
if( !pTeriMgr->movePlayer( pCurrZone, getAsPlayer() ) )
|
if( !teriMgr.movePlayer( pCurrZone, getAsPlayer() ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -258,11 +258,11 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadActiveQuests()
|
bool Sapphire::Entity::Player::loadActiveQuests()
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_QUEST );
|
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_QUEST );
|
||||||
|
|
||||||
stmt->setUInt( 1, m_id );
|
stmt->setUInt( 1, m_id );
|
||||||
auto res = pDb->query( stmt );
|
auto res = db.query( stmt );
|
||||||
|
|
||||||
while( res->next() )
|
while( res->next() )
|
||||||
{
|
{
|
||||||
|
@ -294,11 +294,11 @@ bool Sapphire::Entity::Player::loadActiveQuests()
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadClassData()
|
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
|
// 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 );
|
stmt->setUInt( 1, m_id );
|
||||||
auto res = pDb->query( stmt );
|
auto res = db.query( stmt );
|
||||||
|
|
||||||
while( res->next() )
|
while( res->next() )
|
||||||
{
|
{
|
||||||
|
@ -315,10 +315,10 @@ bool Sapphire::Entity::Player::loadClassData()
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadSearchInfo()
|
bool Sapphire::Entity::Player::loadSearchInfo()
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_SEARCHINFO );
|
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_SEARCHINFO );
|
||||||
stmt->setUInt( 1, m_id );
|
stmt->setUInt( 1, m_id );
|
||||||
auto res = pDb->query( stmt );
|
auto res = db.query( stmt );
|
||||||
|
|
||||||
if( !res->next() )
|
if( !res->next() )
|
||||||
{
|
{
|
||||||
|
@ -340,10 +340,10 @@ bool Sapphire::Entity::Player::loadSearchInfo()
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadHuntingLog()
|
bool Sapphire::Entity::Player::loadHuntingLog()
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_MONSTERNOTE_SEL );
|
auto stmt = db.getPreparedStatement( Db::ZoneDbStatements::CHARA_MONSTERNOTE_SEL );
|
||||||
stmt->setUInt( 1, m_id );
|
stmt->setUInt( 1, m_id );
|
||||||
auto res = pDb->query( stmt );
|
auto res = db.query( stmt );
|
||||||
|
|
||||||
if( !res->next() )
|
if( !res->next() )
|
||||||
{
|
{
|
||||||
|
@ -363,7 +363,7 @@ bool Sapphire::Entity::Player::loadHuntingLog()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateSql()
|
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, "
|
/*"Hp 1, Mp 2, Tp 3, Gp 4, Mode 5, Mount 6, InvincibleGM 7, Voice 8, "
|
||||||
"Customize 9, ModelMainWeapon 10, ModelSubWeapon 11, ModelSystemWeapon 12, "
|
"Customize 9, ModelMainWeapon 10, ModelSubWeapon 11, ModelSystemWeapon 12, "
|
||||||
"ModelEquip 13, EmoteModeType 14, Language 15, IsNewGame 16, IsNewAdventurer 17, "
|
"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( 1, getHp() );
|
||||||
stmt->setInt( 2, getMp() );
|
stmt->setInt( 2, getMp() );
|
||||||
|
@ -490,7 +490,7 @@ void Sapphire::Entity::Player::updateSql()
|
||||||
|
|
||||||
stmt->setInt( 57, m_id );
|
stmt->setInt( 57, m_id );
|
||||||
|
|
||||||
pDb->execute( stmt );
|
db.execute( stmt );
|
||||||
|
|
||||||
////// Searchinfo
|
////// Searchinfo
|
||||||
updateDbSearchInfo();
|
updateDbSearchInfo();
|
||||||
|
@ -508,24 +508,24 @@ void Sapphire::Entity::Player::updateSql()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateDbClass() const
|
void Sapphire::Entity::Player::updateDbClass() const
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast<uint8_t>( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = exdData.get< Sapphire::Data::ClassJob >( static_cast<uint8_t>( getClass() ) )->expArrayIndex;
|
||||||
|
|
||||||
//Exp = ?, Lvl = ? WHERE CharacterId = ? AND ClassIdx = ?
|
//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( 1, getExp() );
|
||||||
stmtS->setInt( 2, getLevel() );
|
stmtS->setInt( 2, getLevel() );
|
||||||
stmtS->setInt( 3, m_id );
|
stmtS->setInt( 3, m_id );
|
||||||
stmtS->setInt( 4, classJobIndex );
|
stmtS->setInt( 4, classJobIndex );
|
||||||
pDb->execute( stmtS );
|
db.execute( stmtS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateDbMonsterNote()
|
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
|
// 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::array< std::vector< uint8_t >, 12 > vectors;
|
||||||
std::vector< uint8_t > vector( 41 );
|
std::vector< uint8_t > vector( 41 );
|
||||||
for( std::size_t i = 0; i < m_huntingLogEntries.size(); ++i )
|
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->setBinary( i + 1, vector );
|
||||||
}
|
}
|
||||||
stmt->setInt( 13, m_id );
|
stmt->setInt( 13, m_id );
|
||||||
pDb->execute( stmt );
|
db.execute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::insertDbClass( const uint8_t classJobIndex ) const
|
void Sapphire::Entity::Player::insertDbClass( const uint8_t classJobIndex ) const
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmtClass = pDb->getPreparedStatement( Db::CHARA_CLASS_INS );
|
auto stmtClass = db.getPreparedStatement( Db::CHARA_CLASS_INS );
|
||||||
stmtClass->setInt( 1, getId() );
|
stmtClass->setInt( 1, getId() );
|
||||||
stmtClass->setInt( 2, classJobIndex );
|
stmtClass->setInt( 2, classJobIndex );
|
||||||
stmtClass->setInt( 3, 0 );
|
stmtClass->setInt( 3, 0 );
|
||||||
stmtClass->setInt( 4, 1 );
|
stmtClass->setInt( 4, 1 );
|
||||||
pDb->directExecute( stmtClass );
|
db.directExecute( stmtClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateDbSearchInfo() const
|
void Sapphire::Entity::Player::updateDbSearchInfo() const
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmtS = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
auto stmtS = db.getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
||||||
stmtS->setInt( 1, m_searchSelectClass );
|
stmtS->setInt( 1, m_searchSelectClass );
|
||||||
stmtS->setInt( 2, m_id );
|
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( 1, m_searchSelectRegion );
|
||||||
stmtS1->setInt( 2, m_id );
|
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->setString( 1, std::string( m_searchMessage ) );
|
||||||
stmtS2->setInt( 2, m_id );
|
stmtS2->setInt( 2, m_id );
|
||||||
pDb->execute( stmtS2 );
|
db.execute( stmtS2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateDbAllQuests() const
|
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++ )
|
for( int32_t i = 0; i < 30; i++ )
|
||||||
{
|
{
|
||||||
if( !m_activeQuests[ i ] )
|
if( !m_activeQuests[ i ] )
|
||||||
continue;
|
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( 1, m_activeQuests[ i ]->c.sequence );
|
||||||
stmtS3->setInt( 2, m_activeQuests[ i ]->c.flags );
|
stmtS3->setInt( 2, m_activeQuests[ i ]->c.flags );
|
||||||
stmtS3->setInt( 3, m_activeQuests[ i ]->c.UI8A );
|
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( 9, m_activeQuests[ i ]->c.padding1 );
|
||||||
stmtS3->setInt( 10, m_id );
|
stmtS3->setInt( 10, m_id );
|
||||||
stmtS3->setInt( 11, m_activeQuests[ i ]->c.questId );
|
stmtS3->setInt( 11, m_activeQuests[ i ]->c.questId );
|
||||||
pDb->execute( stmtS3 );
|
db.execute( stmtS3 );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::deleteQuest( uint16_t questId ) const
|
void Sapphire::Entity::Player::deleteQuest( uint16_t questId ) const
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_QUEST_DEL );
|
auto stmt = db.getPreparedStatement( Db::CHARA_QUEST_DEL );
|
||||||
stmt->setInt( 1, m_id );
|
stmt->setInt( 1, m_id );
|
||||||
stmt->setInt( 2, questId );
|
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
|
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& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_QUEST_INS );
|
auto stmt = db.getPreparedStatement( Db::CHARA_QUEST_INS );
|
||||||
stmt->setInt( 1, m_id );
|
stmt->setInt( 1, m_id );
|
||||||
stmt->setInt( 2, index );
|
stmt->setInt( 2, index );
|
||||||
stmt->setInt( 3, questId );
|
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( 10, 0 );
|
||||||
stmt->setInt( 11, 0 );
|
stmt->setInt( 11, 0 );
|
||||||
stmt->setInt( 12, 0 );
|
stmt->setInt( 12, 0 );
|
||||||
pDb->execute( stmt );
|
db.execute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint32_t quantity )
|
Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint32_t quantity )
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
auto& itemMgr = Common::Service< World::Manager::ItemMgr >::ref();
|
||||||
auto itemMgr = m_pFw->get< World::Manager::ItemMgr >();
|
|
||||||
|
auto itemInfo = exdData.get< Sapphire::Data::Item >( catalogId );
|
||||||
|
|
||||||
if( !itemInfo )
|
if( !itemInfo )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -639,11 +640,11 @@ Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint
|
||||||
|
|
||||||
uint8_t flags = 0;
|
uint8_t flags = 0;
|
||||||
|
|
||||||
ItemPtr pItem = make_Item( itemMgr->getNextUId(), catalogId, m_pFw );
|
ItemPtr pItem = make_Item( itemMgr.getNextUId(), catalogId );
|
||||||
|
|
||||||
pItem->setStackSize( quantity );
|
pItem->setStackSize( quantity );
|
||||||
|
|
||||||
pDb->execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
|
db.execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
|
||||||
std::to_string( getId() ) + ", " +
|
std::to_string( getId() ) + ", " +
|
||||||
std::to_string( pItem->getUId() ) + ", " +
|
std::to_string( pItem->getUId() ) + ", " +
|
||||||
std::to_string( pItem->getId() ) + ", " +
|
std::to_string( pItem->getId() ) + ", " +
|
||||||
|
@ -655,11 +656,11 @@ Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadInventory()
|
bool Sapphire::Entity::Player::loadInventory()
|
||||||
{
|
{
|
||||||
auto itemMgr = m_pFw->get< World::Manager::ItemMgr >();
|
auto& itemMgr = Common::Service< World::Manager::ItemMgr >::ref();
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// load active gearset
|
// 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_4, container_5, container_6, container_7, "
|
||||||
"container_8, container_9, container_10, container_11, "
|
"container_8, container_9, container_10, container_11, "
|
||||||
"container_12, container_13 "
|
"container_12, container_13 "
|
||||||
|
@ -677,7 +678,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
||||||
if( uItemId == 0 )
|
if( uItemId == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ItemPtr pItem = itemMgr->loadItem( uItemId );
|
ItemPtr pItem = itemMgr.loadItem( uItemId );
|
||||||
|
|
||||||
if( pItem == nullptr )
|
if( pItem == nullptr )
|
||||||
continue;
|
continue;
|
||||||
|
@ -689,7 +690,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Load everything
|
// 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_0, container_1, container_2, container_3, container_4, "
|
||||||
"container_5, container_6, container_7, container_8, container_9, "
|
"container_5, container_6, container_7, container_8, container_9, "
|
||||||
"container_10, container_11, container_12, container_13, container_14, "
|
"container_10, container_11, container_12, container_13, container_14, "
|
||||||
|
@ -710,7 +711,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
||||||
if( uItemId == 0 )
|
if( uItemId == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ItemPtr pItem = itemMgr->loadItem( uItemId );
|
ItemPtr pItem = itemMgr.loadItem( uItemId );
|
||||||
|
|
||||||
if( pItem == nullptr )
|
if( pItem == nullptr )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "HousingItem.h"
|
#include "HousingItem.h"
|
||||||
|
|
||||||
Sapphire::Inventory::HousingItem::HousingItem( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw ) :
|
Sapphire::Inventory::HousingItem::HousingItem( uint64_t uId, uint32_t catalogId ) :
|
||||||
Sapphire::Item( uId, catalogId, pFw, false )
|
Sapphire::Item( uId, catalogId, false )
|
||||||
{
|
{
|
||||||
m_stackSize = 1;
|
m_stackSize = 1;
|
||||||
m_spiritBond = 1;
|
m_spiritBond = 1;
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Sapphire::Inventory
|
||||||
class HousingItem : public Item
|
class HousingItem : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HousingItem( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw );
|
HousingItem( uint64_t uId, uint32_t catalogId );
|
||||||
virtual ~HousingItem() = default;
|
virtual ~HousingItem() = default;
|
||||||
|
|
||||||
void setRot( float rot );
|
void setRot( float rot );
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <CommonGen.h>
|
#include <CommonGen.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
#include "Framework.h"
|
|
||||||
#include "Item.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_id( catalogId ),
|
||||||
m_uId( uId ),
|
m_uId( uId ),
|
||||||
m_isHq( isHq ),
|
m_isHq( isHq ),
|
||||||
m_stain( 0 ),
|
m_stain( 0 ),
|
||||||
m_durability( 30000 ),
|
m_durability( 30000 ),
|
||||||
m_spiritBond( 0 ),
|
m_spiritBond( 0 ),
|
||||||
m_reservedFlag( 0 ),
|
m_reservedFlag( 0 )
|
||||||
m_pFw( pFw )
|
|
||||||
{
|
{
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
auto itemInfo = exdData.get< Sapphire::Data::Item >( catalogId );
|
||||||
|
|
||||||
m_delayMs = itemInfo->delayms;
|
m_delayMs = itemInfo->delayms;
|
||||||
m_physicalDmg = itemInfo->damagePhys;
|
m_physicalDmg = itemInfo->damagePhys;
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Sapphire
|
||||||
int16_t value;
|
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;
|
virtual ~Item() = default;
|
||||||
|
|
||||||
|
@ -116,7 +116,6 @@ namespace Sapphire
|
||||||
uint32_t m_defense;
|
uint32_t m_defense;
|
||||||
uint32_t m_defenseMag;
|
uint32_t m_defenseMag;
|
||||||
|
|
||||||
FrameworkPtr m_pFw;
|
|
||||||
uint32_t m_additionalData;
|
uint32_t m_additionalData;
|
||||||
|
|
||||||
BaseParamStruct m_baseParam[6];
|
BaseParamStruct m_baseParam[6];
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Database/DatabaseDef.h>
|
#include <Database/DatabaseDef.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
#include "Actor/Player.h"
|
#include "Actor/Player.h"
|
||||||
|
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "Framework.h"
|
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
#include "ItemContainer.h"
|
#include "ItemContainer.h"
|
||||||
|
|
||||||
Sapphire::ItemContainer::ItemContainer( uint16_t storageId, uint8_t maxSize, const std::string& tableName,
|
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_id( storageId ),
|
||||||
m_size( maxSize ),
|
m_size( maxSize ),
|
||||||
m_tableName( tableName ),
|
m_tableName( tableName ),
|
||||||
m_bMultiStorage( isMultiStorage ),
|
m_bMultiStorage( isMultiStorage ),
|
||||||
m_pFw( pFw ),
|
|
||||||
m_isPersistentStorage( isPersistentStorage )
|
m_isPersistentStorage( isPersistentStorage )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -38,13 +37,13 @@ uint8_t Sapphire::ItemContainer::getEntryCount() const
|
||||||
|
|
||||||
void Sapphire::ItemContainer::removeItem( uint8_t slotId, bool removeFromDb )
|
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 );
|
auto it = m_itemMap.find( slotId );
|
||||||
|
|
||||||
if( it != m_itemMap.end() )
|
if( it != m_itemMap.end() )
|
||||||
{
|
{
|
||||||
if( m_isPersistentStorage && removeFromDb )
|
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 );
|
m_itemMap.erase( it );
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Sapphire
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ItemContainer( uint16_t storageId, uint8_t maxSize, const std::string& tableName, bool isMultiStorage,
|
ItemContainer( uint16_t storageId, uint8_t maxSize, const std::string& tableName, bool isMultiStorage,
|
||||||
FrameworkPtr pFw, bool isPersistentStorage = true );
|
bool isPersistentStorage = true );
|
||||||
|
|
||||||
~ItemContainer();
|
~ItemContainer();
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ namespace Sapphire
|
||||||
uint8_t m_size;
|
uint8_t m_size;
|
||||||
std::string m_tableName;
|
std::string m_tableName;
|
||||||
bool m_bMultiStorage;
|
bool m_bMultiStorage;
|
||||||
FrameworkPtr m_pFw;
|
|
||||||
bool m_isPersistentStorage;
|
bool m_isPersistentStorage;
|
||||||
ItemMap m_itemMap;
|
ItemMap m_itemMap;
|
||||||
Entity::PlayerPtr m_pOwner;
|
Entity::PlayerPtr m_pOwner;
|
||||||
|
|
|
@ -7,18 +7,11 @@
|
||||||
#include "Actor/Player.h"
|
#include "Actor/Player.h"
|
||||||
|
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
#include <Network/PacketWrappers/EffectPacket.h>
|
#include <Network/PacketWrappers/EffectPacket.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
World::Manager::ActionMgr::ActionMgr( Sapphire::FrameworkPtr pFw ) :
|
|
||||||
BaseManager( pFw )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void World::Manager::ActionMgr::handlePlacedPlayerAction( Entity::Player& player, uint32_t actionId,
|
void World::Manager::ActionMgr::handlePlacedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos,
|
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos,
|
||||||
uint16_t sequence )
|
uint16_t sequence )
|
||||||
|
@ -26,7 +19,7 @@ void World::Manager::ActionMgr::handlePlacedPlayerAction( Entity::Player& player
|
||||||
player.sendDebug( "got aoe act: {0}", actionData->name );
|
player.sendDebug( "got aoe act: {0}", actionData->name );
|
||||||
|
|
||||||
|
|
||||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, sequence, actionData, framework() );
|
auto action = Action::make_Action( player.getAsPlayer(), actionId, sequence, actionData );
|
||||||
|
|
||||||
action->setPos( pos );
|
action->setPos( pos );
|
||||||
|
|
||||||
|
@ -47,7 +40,7 @@ void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& play
|
||||||
Data::ActionPtr actionData, uint64_t targetId,
|
Data::ActionPtr actionData, uint64_t targetId,
|
||||||
uint16_t sequence )
|
uint16_t sequence )
|
||||||
{
|
{
|
||||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, sequence, actionData, framework() );
|
auto action = Action::make_Action( player.getAsPlayer(), actionId, sequence, actionData );
|
||||||
|
|
||||||
action->setTargetId( targetId );
|
action->setTargetId( targetId );
|
||||||
|
|
||||||
|
@ -73,7 +66,7 @@ void World::Manager::ActionMgr::handleItemAction( Sapphire::Entity::Player& play
|
||||||
player.sendDebug( "got item act: {0}, slot: {1}, container: {2}", itemId, itemSourceSlot, itemSourceContainer );
|
player.sendDebug( "got item act: {0}, slot: {1}, container: {2}", itemId, itemSourceSlot, itemSourceContainer );
|
||||||
|
|
||||||
auto action = Action::make_ItemAction( player.getAsChara(), itemId, itemActionData,
|
auto action = Action::make_ItemAction( player.getAsChara(), itemId, itemActionData,
|
||||||
itemSourceSlot, itemSourceContainer, framework() );
|
itemSourceSlot, itemSourceContainer );
|
||||||
|
|
||||||
// todo: item actions don't have cast times? if so we can just start it and we're good
|
// todo: item actions don't have cast times? if so we can just start it and we're good
|
||||||
action->start();
|
action->start();
|
||||||
|
@ -85,7 +78,7 @@ void World::Manager::ActionMgr::handleMountAction( Entity::Player& player, uint1
|
||||||
{
|
{
|
||||||
player.sendDebug( "mount: {0}", mountId );
|
player.sendDebug( "mount: {0}", mountId );
|
||||||
|
|
||||||
auto action = Action::make_MountAction( player.getAsPlayer(), mountId, sequence, actionData, framework() );
|
auto action = Action::make_MountAction( player.getAsPlayer(), mountId, sequence, actionData );
|
||||||
|
|
||||||
action->setTargetId( targetId );
|
action->setTargetId( targetId );
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef SAPPHIRE_ACTIONMGR_H
|
#ifndef SAPPHIRE_ACTIONMGR_H
|
||||||
#define SAPPHIRE_ACTIONMGR_H
|
#define SAPPHIRE_ACTIONMGR_H
|
||||||
|
|
||||||
#include "BaseManager.h"
|
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
namespace Sapphire::Data
|
namespace Sapphire::Data
|
||||||
|
@ -15,10 +14,10 @@ namespace Sapphire::Data
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
class ActionMgr : public Manager::BaseManager
|
class ActionMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ActionMgr( FrameworkPtr pFw );
|
ActionMgr() = default;
|
||||||
~ActionMgr() = default;
|
~ActionMgr() = default;
|
||||||
|
|
||||||
void handleTargetedPlayerAction( Entity::Player& player, uint32_t actionId,
|
void handleTargetedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#ifndef SAPPHIRE_MANAGER_H
|
|
||||||
#define SAPPHIRE_MANAGER_H
|
|
||||||
|
|
||||||
#include "ForwardsZone.h"
|
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
|
||||||
{
|
|
||||||
|
|
||||||
class BaseManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit BaseManager( FrameworkPtr pFw ) : m_pFw( std::move( pFw ) ) {};
|
|
||||||
virtual ~BaseManager() = default;
|
|
||||||
|
|
||||||
FrameworkPtr framework() const
|
|
||||||
{ return m_pFw; }
|
|
||||||
void setFw( FrameworkPtr pFw )
|
|
||||||
{ m_pFw = pFw; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
FrameworkPtr m_pFw;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //SAPPHIRE_MANAGER_H
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
|
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
using namespace Sapphire::Network;
|
using namespace Sapphire::Network;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
@ -46,8 +45,7 @@ using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::World::Manager;
|
using namespace Sapphire::World::Manager;
|
||||||
|
|
||||||
// instanciate and initialize commands
|
// instanciate and initialize commands
|
||||||
Sapphire::World::Manager::DebugCommandMgr::DebugCommandMgr( FrameworkPtr pFw ) :
|
Sapphire::World::Manager::DebugCommandMgr::DebugCommandMgr()
|
||||||
BaseManager( pFw )
|
|
||||||
{
|
{
|
||||||
// Push all commands onto the register map ( command name - function - description - required GM level )
|
// Push all commands onto the register map ( command name - function - description - required GM level )
|
||||||
registerCommand( "set", &DebugCommandMgr::set, "Executes SET commands.", 1 );
|
registerCommand( "set", &DebugCommandMgr::set, "Executes SET commands.", 1 );
|
||||||
|
@ -144,8 +142,8 @@ void Sapphire::World::Manager::DebugCommandMgr::help( char* data, Entity::Player
|
||||||
void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player& player,
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pTerriMgr = framework()->get< TerritoryMgr >();
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
std::string subCommand = "";
|
std::string subCommand = "";
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -293,11 +291,11 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
|
||||||
|
|
||||||
sscanf( params.c_str(), "%hu %hu", &festivalId, &additionalId );
|
sscanf( params.c_str(), "%hu %hu", &festivalId, &additionalId );
|
||||||
|
|
||||||
pTerriMgr->setCurrentFestival( festivalId, additionalId );
|
terriMgr.setCurrentFestival( festivalId, additionalId );
|
||||||
}
|
}
|
||||||
else if( subCommand == "festivaldisable" )
|
else if( subCommand == "festivaldisable" )
|
||||||
{
|
{
|
||||||
pTerriMgr->disableCurrentFestival();
|
terriMgr.disableCurrentFestival();
|
||||||
}
|
}
|
||||||
else if( subCommand == "BitFlag" )
|
else if( subCommand == "BitFlag" )
|
||||||
{
|
{
|
||||||
|
@ -406,7 +404,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
|
||||||
sscanf( params.c_str(), "%d %d %hu", &id, &duration, ¶m );
|
sscanf( params.c_str(), "%d %d %hu", &id, &duration, ¶m );
|
||||||
|
|
||||||
auto effect = StatusEffect::make_StatusEffect( id, player.getAsPlayer(), player.getAsPlayer(),
|
auto effect = StatusEffect::make_StatusEffect( id, player.getAsPlayer(), player.getAsPlayer(),
|
||||||
duration, 3000, framework() );
|
duration, 3000 );
|
||||||
effect->setParam( param );
|
effect->setParam( param );
|
||||||
|
|
||||||
player.addStatusEffect( effect );
|
player.addStatusEffect( effect );
|
||||||
|
@ -435,7 +433,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
|
||||||
player.getPos().y,
|
player.getPos().y,
|
||||||
player.getPos().z,
|
player.getPos().z,
|
||||||
player.getRot(),
|
player.getRot(),
|
||||||
1, 1000, playerZone, framework() );
|
1, 1000, playerZone );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -537,7 +535,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
|
||||||
void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player& player,
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
auto exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -561,7 +559,7 @@ void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player&
|
||||||
if( ( subCommand == "pos" ) )
|
if( ( subCommand == "pos" ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
int16_t map_id = pExdData->get< Sapphire::Data::TerritoryType >( player.getCurrentTerritory()->getTerritoryTypeId() )->map;
|
int16_t map_id = exdData.get< Sapphire::Data::TerritoryType >( player.getCurrentTerritory()->getTerritoryTypeId() )->map;
|
||||||
|
|
||||||
player.sendNotice( "Pos:\n {0}\n {1}\n {2}\n {3}\n MapId: {4}\n ZoneId:{5}",
|
player.sendNotice( "Pos:\n {0}\n {1}\n {2}\n {3}\n MapId: {4}\n ZoneId:{5}",
|
||||||
player.getPos().x, player.getPos().y, player.getPos().z,
|
player.getPos().x, player.getPos().y, player.getPos().z,
|
||||||
|
@ -709,7 +707,7 @@ Sapphire::World::Manager::DebugCommandMgr::serverInfo( char* data, Entity::Playe
|
||||||
void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Player& player,
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pScriptMgr = framework()->get< Scripting::ScriptMgr >();
|
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -735,7 +733,7 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
{
|
{
|
||||||
if( subCommand == params )
|
if( subCommand == params )
|
||||||
player.sendDebug( "Command failed: requires name of script" );
|
player.sendDebug( "Command failed: requires name of script" );
|
||||||
else if( pScriptMgr->getNativeScriptHandler().unloadScript( params ) )
|
else if( scriptMgr.getNativeScriptHandler().unloadScript( params ) )
|
||||||
player.sendDebug( "Unloaded script successfully." );
|
player.sendDebug( "Unloaded script successfully." );
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to unload script: {0}", params );
|
player.sendDebug( "Failed to unload script: {0}", params );
|
||||||
|
@ -747,7 +745,7 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::set< Sapphire::Scripting::ScriptInfo* > scripts;
|
std::set< Sapphire::Scripting::ScriptInfo* > scripts;
|
||||||
pScriptMgr->getNativeScriptHandler().findScripts( scripts, params );
|
scriptMgr.getNativeScriptHandler().findScripts( scripts, params );
|
||||||
|
|
||||||
if( !scripts.empty() )
|
if( !scripts.empty() )
|
||||||
{
|
{
|
||||||
|
@ -769,7 +767,7 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
player.sendDebug( "Command failed: requires relative path to script" );
|
player.sendDebug( "Command failed: requires relative path to script" );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pScriptMgr->getNativeScriptHandler().loadScript( params ) )
|
if( scriptMgr.getNativeScriptHandler().loadScript( params ) )
|
||||||
player.sendDebug( "Loaded '{0}' successfully", params );
|
player.sendDebug( "Loaded '{0}' successfully", params );
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to load '{0}'", params );
|
player.sendDebug( "Failed to load '{0}'", params );
|
||||||
|
@ -782,7 +780,7 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
player.sendDebug( "Command failed: requires name of script to reload" );
|
player.sendDebug( "Command failed: requires name of script to reload" );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pScriptMgr->getNativeScriptHandler().queueScriptReload( params );
|
scriptMgr.getNativeScriptHandler().queueScriptReload( params );
|
||||||
player.sendDebug( "Queued script reload for script: {0}", params );
|
player.sendDebug( "Queued script reload for script: {0}", params );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -795,7 +793,7 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player& player,
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
||||||
|
@ -819,7 +817,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
uint32_t contentFinderConditionId;
|
uint32_t contentFinderConditionId;
|
||||||
sscanf( params.c_str(), "%d", &contentFinderConditionId );
|
sscanf( params.c_str(), "%d", &contentFinderConditionId );
|
||||||
|
|
||||||
auto instance = pTeriMgr->createInstanceContent( contentFinderConditionId );
|
auto instance = terriMgr.createInstanceContent( contentFinderConditionId );
|
||||||
if( instance )
|
if( instance )
|
||||||
player.sendDebug( "Created instance with id#{0} -> {1}", instance->getGuId(), instance->getName() );
|
player.sendDebug( "Created instance with id#{0} -> {1}", instance->getGuId(), instance->getName() );
|
||||||
else
|
else
|
||||||
|
@ -830,7 +828,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
uint32_t instanceId;
|
uint32_t instanceId;
|
||||||
sscanf( params.c_str(), "%d", &instanceId );
|
sscanf( params.c_str(), "%d", &instanceId );
|
||||||
|
|
||||||
auto terri = pTeriMgr->getTerritoryByGuId( instanceId );
|
auto terri = terriMgr.getTerritoryByGuId( instanceId );
|
||||||
if( terri )
|
if( terri )
|
||||||
{
|
{
|
||||||
auto pInstanceContent = terri->getAsInstanceContent();
|
auto pInstanceContent = terri->getAsInstanceContent();
|
||||||
|
@ -853,7 +851,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
uint32_t instanceId;
|
uint32_t instanceId;
|
||||||
sscanf( params.c_str(), "%d", &instanceId );
|
sscanf( params.c_str(), "%d", &instanceId );
|
||||||
|
|
||||||
auto instance = pTeriMgr->getTerritoryByGuId( instanceId );
|
auto instance = terriMgr.getTerritoryByGuId( instanceId );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Unknown instance with id#{0} ", instanceId );
|
player.sendDebug( "Unknown instance with id#{0} ", instanceId );
|
||||||
|
@ -875,7 +873,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
uint32_t zoneId;
|
uint32_t zoneId;
|
||||||
sscanf( params.c_str(), "%d", &zoneId );
|
sscanf( params.c_str(), "%d", &zoneId );
|
||||||
|
|
||||||
auto instance = pTeriMgr->createTerritoryInstance( zoneId );
|
auto instance = terriMgr.createTerritoryInstance( zoneId );
|
||||||
if( instance )
|
if( instance )
|
||||||
player.sendDebug(
|
player.sendDebug(
|
||||||
"Created instance with id: " + std::to_string( instance->getGuId() ) + " -> " + instance->getName() );
|
"Created instance with id: " + std::to_string( instance->getGuId() ) + " -> " + instance->getName() );
|
||||||
|
@ -887,7 +885,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
uint32_t terriId;
|
uint32_t terriId;
|
||||||
sscanf( params.c_str(), "%d", &terriId );
|
sscanf( params.c_str(), "%d", &terriId );
|
||||||
|
|
||||||
if( pTeriMgr->removeTerritoryInstance( terriId ) )
|
if( terriMgr.removeTerritoryInstance( terriId ) )
|
||||||
player.sendDebug( "Removed instance with id#{0}", terriId );
|
player.sendDebug( "Removed instance with id#{0}", terriId );
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to remove instance with id#{0}", terriId );
|
player.sendDebug( "Failed to remove instance with id#{0}", terriId );
|
||||||
|
@ -1015,7 +1013,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity::Player& player,
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
||||||
|
@ -1039,7 +1037,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
uint32_t contentFinderConditionId;
|
uint32_t contentFinderConditionId;
|
||||||
sscanf( params.c_str(), "%d", &contentFinderConditionId );
|
sscanf( params.c_str(), "%d", &contentFinderConditionId );
|
||||||
|
|
||||||
auto instance = pTeriMgr->createQuestBattle( contentFinderConditionId );
|
auto instance = terriMgr.createQuestBattle( contentFinderConditionId );
|
||||||
if( instance )
|
if( instance )
|
||||||
player.sendDebug( "Created instance with id#{0} -> {1}", instance->getGuId(), instance->getName() );
|
player.sendDebug( "Created instance with id#{0} -> {1}", instance->getGuId(), instance->getName() );
|
||||||
else
|
else
|
||||||
|
@ -1070,7 +1068,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
uint32_t zoneId;
|
uint32_t zoneId;
|
||||||
sscanf( params.c_str(), "%d", &zoneId );
|
sscanf( params.c_str(), "%d", &zoneId );
|
||||||
|
|
||||||
auto instance = pTeriMgr->createTerritoryInstance( zoneId );
|
auto instance = terriMgr.createTerritoryInstance( zoneId );
|
||||||
if( instance )
|
if( instance )
|
||||||
player.sendDebug(
|
player.sendDebug(
|
||||||
"Created instance with id: " + std::to_string( instance->getGuId() ) + " -> " + instance->getName() );
|
"Created instance with id: " + std::to_string( instance->getGuId() ) + " -> " + instance->getName() );
|
||||||
|
@ -1082,7 +1080,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
uint32_t terriId;
|
uint32_t terriId;
|
||||||
sscanf( params.c_str(), "%d", &terriId );
|
sscanf( params.c_str(), "%d", &terriId );
|
||||||
|
|
||||||
if( pTeriMgr->removeTerritoryInstance( terriId ) )
|
if( terriMgr.removeTerritoryInstance( terriId ) )
|
||||||
player.sendDebug( "Removed instance with id#{0}", terriId );
|
player.sendDebug( "Removed instance with id#{0}", terriId );
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to remove instance with id#{0}", terriId );
|
player.sendDebug( "Failed to remove instance with id#{0}", terriId );
|
||||||
|
@ -1210,7 +1208,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Player& player,
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
||||||
|
@ -1237,7 +1235,7 @@ void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Pla
|
||||||
// if ( permissionSet < 5 )
|
// if ( permissionSet < 5 )
|
||||||
// {
|
// {
|
||||||
// auto pZone = player.getCurrentTerritory();
|
// auto pZone = player.getCurrentTerritory();
|
||||||
// if( pTeriMgr->isHousingTerritory( pZone->getTerritoryTypeId() ) )
|
// if( terriMgr.isHousingTerritory( pZone->getTerritoryTypeId() ) )
|
||||||
// {
|
// {
|
||||||
// auto pHousing = std::dynamic_pointer_cast< HousingZone >( pZone );
|
// auto pHousing = std::dynamic_pointer_cast< HousingZone >( pZone );
|
||||||
// if( pHousing )
|
// if( pHousing )
|
||||||
|
|
|
@ -6,20 +6,19 @@
|
||||||
|
|
||||||
#include "DebugCommand/DebugCommand.h"
|
#include "DebugCommand/DebugCommand.h"
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
#include "BaseManager.h"
|
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
|
|
||||||
// handler for in game commands
|
// handler for in game commands
|
||||||
class DebugCommandMgr : public Manager::BaseManager
|
class DebugCommandMgr
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// container mapping command string to command object
|
// container mapping command string to command object
|
||||||
std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap;
|
std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebugCommandMgr( FrameworkPtr pFw );
|
DebugCommandMgr();
|
||||||
|
|
||||||
~DebugCommandMgr();
|
~DebugCommandMgr();
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,16 @@
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <Util/Util.h>
|
#include <Util/Util.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
#include "Framework.h"
|
|
||||||
#include "EventMgr.h"
|
#include "EventMgr.h"
|
||||||
#include "Event/EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
|
|
||||||
Sapphire::World::Manager::EventMgr::EventMgr( Sapphire::FrameworkPtr pFw ) :
|
|
||||||
BaseManager( pFw )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
{
|
{
|
||||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
uint16_t eventType = eventId >> 16;
|
uint16_t eventType = eventId >> 16;
|
||||||
|
|
||||||
auto unknown = std::string{ "unknown" };
|
auto unknown = std::string{ "unknown" };
|
||||||
|
@ -25,7 +19,7 @@ std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
{
|
{
|
||||||
case Event::EventHandler::EventHandlerType::Quest:
|
case Event::EventHandler::EventHandlerType::Quest:
|
||||||
{
|
{
|
||||||
auto questInfo = pExdData->get< Sapphire::Data::Quest >( eventId );
|
auto questInfo = exdData.get< Sapphire::Data::Quest >( eventId );
|
||||||
if( !questInfo )
|
if( !questInfo )
|
||||||
return unknown + "Quest";
|
return unknown + "Quest";
|
||||||
|
|
||||||
|
@ -36,7 +30,7 @@ std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
}
|
}
|
||||||
case Event::EventHandler::EventHandlerType::CustomTalk:
|
case Event::EventHandler::EventHandlerType::CustomTalk:
|
||||||
{
|
{
|
||||||
auto customTalkInfo = pExdData->get< Sapphire::Data::CustomTalk >( eventId );
|
auto customTalkInfo = exdData.get< Sapphire::Data::CustomTalk >( eventId );
|
||||||
if( !customTalkInfo )
|
if( !customTalkInfo )
|
||||||
return unknown + "CustomTalk";
|
return unknown + "CustomTalk";
|
||||||
|
|
||||||
|
@ -47,14 +41,14 @@ std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
}
|
}
|
||||||
case Event::EventHandler::EventHandlerType::Opening:
|
case Event::EventHandler::EventHandlerType::Opening:
|
||||||
{
|
{
|
||||||
auto openingInfo = pExdData->get< Sapphire::Data::Opening >( eventId );
|
auto openingInfo = exdData.get< Sapphire::Data::Opening >( eventId );
|
||||||
if( openingInfo )
|
if( openingInfo )
|
||||||
return openingInfo->name;
|
return openingInfo->name;
|
||||||
return unknown + "Opening";
|
return unknown + "Opening";
|
||||||
}
|
}
|
||||||
case Event::EventHandler::EventHandlerType::Aetheryte:
|
case Event::EventHandler::EventHandlerType::Aetheryte:
|
||||||
{
|
{
|
||||||
auto aetherInfo = pExdData->get< Sapphire::Data::Aetheryte >( eventId & 0xFFFF );
|
auto aetherInfo = exdData.get< Sapphire::Data::Aetheryte >( eventId & 0xFFFF );
|
||||||
if( aetherInfo->isAetheryte )
|
if( aetherInfo->isAetheryte )
|
||||||
return "Aetheryte";
|
return "Aetheryte";
|
||||||
return "Aethernet";
|
return "Aethernet";
|
||||||
|
@ -67,10 +61,10 @@ std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
case Event::EventHandler::EventHandlerType::QuestBattleDirector:
|
case Event::EventHandler::EventHandlerType::QuestBattleDirector:
|
||||||
{
|
{
|
||||||
|
|
||||||
auto qbInfo = pExdData->get< Sapphire::Data::QuestBattle >( eventId & 0xFFFF );
|
auto qbInfo = exdData.get< Sapphire::Data::QuestBattle >( eventId & 0xFFFF );
|
||||||
if( !qbInfo )
|
if( !qbInfo )
|
||||||
return "unknown";
|
return "unknown";
|
||||||
auto questInfo = pExdData->get< Sapphire::Data::Quest >( qbInfo->quest );
|
auto questInfo = exdData.get< Sapphire::Data::Quest >( qbInfo->quest );
|
||||||
if( !questInfo )
|
if( !questInfo )
|
||||||
return "unknown";
|
return "unknown";
|
||||||
|
|
||||||
|
@ -84,7 +78,7 @@ std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
|
|
||||||
case Event::EventHandler::EventHandlerType::Warp:
|
case Event::EventHandler::EventHandlerType::Warp:
|
||||||
{
|
{
|
||||||
auto warpInfo = pExdData->get< Sapphire::Data::Warp >( eventId );
|
auto warpInfo = exdData.get< Sapphire::Data::Warp >( eventId );
|
||||||
if( warpInfo )
|
if( warpInfo )
|
||||||
return "WarpTaxi";
|
return "WarpTaxi";
|
||||||
return unknown + "ChocoboWarp"; //who know
|
return unknown + "ChocoboWarp"; //who know
|
||||||
|
@ -92,7 +86,7 @@ std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
|
|
||||||
case Event::EventHandler::EventHandlerType::Shop:
|
case Event::EventHandler::EventHandlerType::Shop:
|
||||||
{
|
{
|
||||||
auto shopInfo = pExdData->get< Sapphire::Data::GilShop >( eventId );
|
auto shopInfo = exdData.get< Sapphire::Data::GilShop >( eventId );
|
||||||
|
|
||||||
return "GilShop" + std::to_string( eventId );
|
return "GilShop" + std::to_string( eventId );
|
||||||
/*if( shopInfo )
|
/*if( shopInfo )
|
||||||
|
@ -112,8 +106,8 @@ std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
|
|
||||||
uint32_t Sapphire::World::Manager::EventMgr::mapEventActorToRealActor( uint32_t eventActorId )
|
uint32_t Sapphire::World::Manager::EventMgr::mapEventActorToRealActor( uint32_t eventActorId )
|
||||||
{
|
{
|
||||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto levelInfo = pExdData->get< Sapphire::Data::Level >( eventActorId );
|
auto levelInfo = exdData.get< Sapphire::Data::Level >( eventActorId );
|
||||||
if( levelInfo )
|
if( levelInfo )
|
||||||
return levelInfo->object;
|
return levelInfo->object;
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,14 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Manager/BaseManager.h"
|
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
|
|
||||||
class EventMgr : public BaseManager
|
class EventMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EventMgr( FrameworkPtr pFw );
|
EventMgr() = default;
|
||||||
|
|
||||||
std::string getEventName( uint32_t eventId );
|
std::string getEventName( uint32_t eventId );
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "Territory/Housing/HousingInteriorTerritory.h"
|
#include "Territory/Housing/HousingInteriorTerritory.h"
|
||||||
#include "HousingMgr.h"
|
#include "HousingMgr.h"
|
||||||
#include "Territory/Land.h"
|
#include "Territory/Land.h"
|
||||||
#include "Framework.h"
|
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Territory/House.h"
|
#include "Territory/House.h"
|
||||||
#include "InventoryMgr.h"
|
#include "InventoryMgr.h"
|
||||||
|
@ -35,8 +34,7 @@ using namespace Sapphire::Network;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
|
|
||||||
Sapphire::World::Manager::HousingMgr::HousingMgr( FrameworkPtr pFw ) :
|
Sapphire::World::Manager::HousingMgr::HousingMgr()
|
||||||
BaseManager( pFw )
|
|
||||||
{
|
{
|
||||||
m_containerMap[ 0 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
m_containerMap[ 0 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||||
m_containerMap[ 1 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems2, InventoryType::HousingInteriorStoreroom2 );
|
m_containerMap[ 1 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems2, InventoryType::HousingInteriorStoreroom2 );
|
||||||
|
@ -114,10 +112,10 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
||||||
{
|
{
|
||||||
Logger::info( "HousingMgr: Loading inventories for estates" );
|
Logger::info( "HousingMgr: Loading inventories for estates" );
|
||||||
|
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
|
|
||||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_SEL_ALL );
|
auto stmt = db.getPreparedStatement( Db::LAND_INV_SEL_ALL );
|
||||||
auto res = pDb->query( stmt );
|
auto res = db.query( stmt );
|
||||||
|
|
||||||
uint32_t itemCount = 0;
|
uint32_t itemCount = 0;
|
||||||
while( res->next() )
|
while( res->next() )
|
||||||
|
@ -131,7 +129,7 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
||||||
auto stain = res->getUInt8( "stain" );
|
auto stain = res->getUInt8( "stain" );
|
||||||
auto characterId = res->getUInt64( "CharacterId" );
|
auto characterId = res->getUInt64( "CharacterId" );
|
||||||
|
|
||||||
auto item = Inventory::make_HousingItem( itemId, catalogId, framework() );
|
auto item = Inventory::make_HousingItem( itemId, catalogId );
|
||||||
item->setStain( stain );
|
item->setStain( stain );
|
||||||
item->setStackSize( 1 );
|
item->setStackSize( 1 );
|
||||||
// todo: need to set the owner character id on the item
|
// todo: need to set the owner character id on the item
|
||||||
|
@ -172,10 +170,10 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::initLandCache()
|
void Sapphire::World::Manager::HousingMgr::initLandCache()
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
|
|
||||||
auto stmt = pDb->getPreparedStatement( Db::LAND_SEL_ALL );
|
auto stmt = db.getPreparedStatement( Db::LAND_SEL_ALL );
|
||||||
auto res = pDb->query( stmt );
|
auto res = db.query( stmt );
|
||||||
|
|
||||||
while( res->next() )
|
while( res->next() )
|
||||||
{
|
{
|
||||||
|
@ -243,7 +241,7 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
||||||
|
|
||||||
auto makeContainer = [ &containers, this ]( Common::InventoryType type, uint16_t size )
|
auto makeContainer = [ &containers, this ]( Common::InventoryType type, uint16_t size )
|
||||||
{
|
{
|
||||||
containers[ type ] = make_ItemContainer( type, size, "houseiteminventory", false, framework(), false );
|
containers[ type ] = make_ItemContainer( type, size, "houseiteminventory", false, false );
|
||||||
};
|
};
|
||||||
|
|
||||||
uint16_t count = 0;
|
uint16_t count = 0;
|
||||||
|
@ -273,8 +271,8 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
||||||
|
|
||||||
uint64_t Sapphire::World::Manager::HousingMgr::getNextHouseId()
|
uint64_t Sapphire::World::Manager::HousingMgr::getNextHouseId()
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto pQR = pDb->query( "SELECT MAX( HouseId ) FROM house" );
|
auto pQR = db.query( "SELECT MAX( HouseId ) FROM house" );
|
||||||
|
|
||||||
if( !pQR->next() )
|
if( !pQR->next() )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -289,14 +287,14 @@ uint32_t Sapphire::World::Manager::HousingMgr::toLandSetId( uint16_t territoryTy
|
||||||
|
|
||||||
Sapphire::Data::HousingZonePtr Sapphire::World::Manager::HousingMgr::getHousingZoneByLandSetId( uint32_t id )
|
Sapphire::Data::HousingZonePtr Sapphire::World::Manager::HousingMgr::getHousingZoneByLandSetId( uint32_t id )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
return std::dynamic_pointer_cast< HousingZone >( pTeriMgr->getZoneByLandSetId( id ) );
|
return std::dynamic_pointer_cast< HousingZone >( terriMgr.getZoneByLandSetId( id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32_t id )
|
Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32_t id )
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto res = pDb->query( "SELECT LandSetId, LandId FROM land WHERE OwnerId = " + std::to_string( id ) );
|
auto res = db.query( "SELECT LandSetId, LandId FROM land WHERE OwnerId = " + std::to_string( id ) );
|
||||||
|
|
||||||
if( !res->next() )
|
if( !res->next() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -562,16 +560,16 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
||||||
auto itemMax = land->getInventoryItemMax();
|
auto itemMax = land->getInventoryItemMax();
|
||||||
|
|
||||||
// type, maxSize, tableName, isMultiStorage
|
// type, maxSize, tableName, isMultiStorage
|
||||||
auto intContainer = make_ItemContainer( InventoryType::HousingInteriorAppearance, itemMax.second, "houseiteminventory", true, framework() );
|
auto intContainer = make_ItemContainer( InventoryType::HousingInteriorAppearance, itemMax.second, "houseiteminventory", true );
|
||||||
auto extContainer = make_ItemContainer( InventoryType::HousingExteriorAppearance, itemMax.first, "houseiteminventory", true, framework() );
|
auto extContainer = make_ItemContainer( InventoryType::HousingExteriorAppearance, itemMax.first, "houseiteminventory", true );
|
||||||
|
|
||||||
// add containers to inv collection
|
// add containers to inv collection
|
||||||
auto& houseInventory = getEstateInventory( house->getLandIdent() );
|
auto& houseInventory = getEstateInventory( house->getLandIdent() );
|
||||||
houseInventory[ InventoryType::HousingInteriorAppearance ] = intContainer;
|
houseInventory[ InventoryType::HousingInteriorAppearance ] = intContainer;
|
||||||
houseInventory[ InventoryType::HousingExteriorAppearance ] = extContainer;
|
houseInventory[ InventoryType::HousingExteriorAppearance ] = extContainer;
|
||||||
|
|
||||||
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||||
auto preset = exdData->get< Sapphire::Data::HousingPreset >( getItemAdditionalData( presetCatalogId ) );
|
auto preset = exdData.get< Sapphire::Data::HousingPreset >( getItemAdditionalData( presetCatalogId ) );
|
||||||
if( !preset )
|
if( !preset )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -623,7 +621,7 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
// create and link items
|
// create and link items
|
||||||
for( auto& destContainer : invMap )
|
for( auto& destContainer : invMap )
|
||||||
|
@ -636,12 +634,12 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
||||||
if( item.second == 0 )
|
if( item.second == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto pItem = invMgr->createItem( player, static_cast< uint32_t >( item.second ) );
|
auto pItem = invMgr.createItem( player, static_cast< uint32_t >( item.second ) );
|
||||||
|
|
||||||
container->setItem( static_cast< uint8_t >( item.first ), pItem );
|
container->setItem( static_cast< uint8_t >( item.first ), pItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
invMgr->saveHousingContainer( land->getLandIdent(), container );
|
invMgr.saveHousingContainer( land->getLandIdent(), container );
|
||||||
}
|
}
|
||||||
|
|
||||||
// lift off
|
// lift off
|
||||||
|
@ -652,16 +650,16 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::createHouse( Sapphire::HousePtr house ) const
|
void Sapphire::World::Manager::HousingMgr::createHouse( Sapphire::HousePtr house ) const
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
|
|
||||||
auto stmt = pDb->getPreparedStatement( Db::HOUSING_HOUSE_INS );
|
auto stmt = db.getPreparedStatement( Db::HOUSING_HOUSE_INS );
|
||||||
// LandSetId, HouseId, HouseName
|
// LandSetId, HouseId, HouseName
|
||||||
|
|
||||||
stmt->setUInt( 1, house->getLandSetId() );
|
stmt->setUInt( 1, house->getLandSetId() );
|
||||||
stmt->setUInt( 2, house->getId() );
|
stmt->setUInt( 2, house->getId() );
|
||||||
stmt->setString( 3, house->getHouseName() );
|
stmt->setString( 3, house->getHouseName() );
|
||||||
|
|
||||||
pDb->execute( stmt );
|
db.execute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetCatalogId )
|
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetCatalogId )
|
||||||
|
@ -681,7 +679,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
|
||||||
// create house
|
// create house
|
||||||
auto ident = pLand->getLandIdent();
|
auto ident = pLand->getLandIdent();
|
||||||
auto house = make_House( getNextHouseId(), pLand->getLandSetId(), ident,
|
auto house = make_House( getNextHouseId(), pLand->getLandSetId(), ident,
|
||||||
"Estate #" + std::to_string( ident.landId + 1 ), "", framework() );
|
"Estate #" + std::to_string( ident.landId + 1 ), "" );
|
||||||
|
|
||||||
pLand->setHouse( house );
|
pLand->setHouse( house );
|
||||||
|
|
||||||
|
@ -871,8 +869,8 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
|
||||||
if( it == containers.end() )
|
if( it == containers.end() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto invMgr = framework()->get< Manager::InventoryMgr >();
|
auto invMgr = Common::Service< Manager::InventoryMgr >::ref();
|
||||||
invMgr->sendInventoryContainer( player, it->second );
|
invMgr.sendInventoryContainer( player, it->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
const Sapphire::World::Manager::HousingMgr::LandSetLandCacheMap&
|
const Sapphire::World::Manager::HousingMgr::LandSetLandCacheMap&
|
||||||
|
@ -946,8 +944,8 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr
|
||||||
|
|
||||||
uint32_t Sapphire::World::Manager::HousingMgr::getItemAdditionalData( uint32_t catalogId )
|
uint32_t Sapphire::World::Manager::HousingMgr::getItemAdditionalData( uint32_t catalogId )
|
||||||
{
|
{
|
||||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
auto& pExdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto info = pExdData->get< Sapphire::Data::Item >( catalogId );
|
auto info = pExdData.get< Sapphire::Data::Item >( catalogId );
|
||||||
return info->additionalData;
|
return info->additionalData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,7 +1068,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
|
||||||
if( !hasPermission( player, *land, 0 ) )
|
if( !hasPermission( player, *land, 0 ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Common::Service< InventoryMgr >::ref();
|
||||||
auto ident = land->getLandIdent();
|
auto ident = land->getLandIdent();
|
||||||
auto& containers = getEstateInventory( ident );
|
auto& containers = getEstateInventory( ident );
|
||||||
|
|
||||||
|
@ -1087,8 +1085,8 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
|
||||||
return;
|
return;
|
||||||
|
|
||||||
container->setItem( static_cast< uint8_t >( freeSlot ), item );
|
container->setItem( static_cast< uint8_t >( freeSlot ), item );
|
||||||
invMgr->sendInventoryContainer( player, container );
|
invMgr.sendInventoryContainer( player, container );
|
||||||
invMgr->saveHousingContainer( ident, container );
|
invMgr.saveHousingContainer( ident, container );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1110,8 +1108,8 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
|
||||||
return;
|
return;
|
||||||
|
|
||||||
container->setItem( static_cast< uint8_t >( freeSlot ), item );
|
container->setItem( static_cast< uint8_t >( freeSlot ), item );
|
||||||
invMgr->sendInventoryContainer( player, container );
|
invMgr.sendInventoryContainer( player, container );
|
||||||
invMgr->saveHousingContainer( ident, container );
|
invMgr.saveHousingContainer( ident, container );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1120,7 +1118,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
|
||||||
Inventory::HousingItemPtr item,
|
Inventory::HousingItemPtr item,
|
||||||
Common::LandIdent ident )
|
Common::LandIdent ident )
|
||||||
{
|
{
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
auto& container = getEstateInventory( ident )[ InventoryType::HousingExteriorPlacedItems ];
|
auto& container = getEstateInventory( ident )[ InventoryType::HousingExteriorPlacedItems ];
|
||||||
|
|
||||||
|
@ -1135,11 +1133,11 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
|
||||||
|
|
||||||
// we need to save the item again as removing it from the container on the player will remove it from charaglobalitem
|
// we need to save the item again as removing it from the container on the player will remove it from charaglobalitem
|
||||||
// todo: this needs to be handled a bit better as it might be possible to overwrite another item that is created in the meantime
|
// todo: this needs to be handled a bit better as it might be possible to overwrite another item that is created in the meantime
|
||||||
invMgr->saveItem( player, item );
|
invMgr.saveItem( player, item );
|
||||||
|
|
||||||
invMgr->sendInventoryContainer( player, container );
|
invMgr.sendInventoryContainer( player, container );
|
||||||
invMgr->saveHousingContainer( ident, container );
|
invMgr.saveHousingContainer( ident, container );
|
||||||
invMgr->updateHousingItemPosition( item );
|
invMgr.updateHousingItemPosition( item );
|
||||||
|
|
||||||
// add to zone and spawn
|
// add to zone and spawn
|
||||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||||
|
@ -1153,7 +1151,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
|
||||||
bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& player,
|
bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& player,
|
||||||
Inventory::HousingItemPtr item )
|
Inventory::HousingItemPtr item )
|
||||||
{
|
{
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
||||||
assert( zone );
|
assert( zone );
|
||||||
|
@ -1182,9 +1180,9 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
|
||||||
container->setItem( static_cast< uint8_t >( freeSlot ), item );
|
container->setItem( static_cast< uint8_t >( freeSlot ), item );
|
||||||
|
|
||||||
// resend container
|
// resend container
|
||||||
invMgr->sendInventoryContainer( player, container );
|
invMgr.sendInventoryContainer( player, container );
|
||||||
invMgr->saveHousingContainer( ident, container );
|
invMgr.saveHousingContainer( ident, container );
|
||||||
invMgr->updateHousingItemPosition( item );
|
invMgr.updateHousingItemPosition( item );
|
||||||
|
|
||||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
||||||
assert( zone );
|
assert( zone );
|
||||||
|
@ -1224,7 +1222,7 @@ void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sap
|
||||||
else
|
else
|
||||||
containerIds = m_internalPlacedItemContainers;
|
containerIds = m_internalPlacedItemContainers;
|
||||||
|
|
||||||
auto invMgr = framework()->get< Manager::InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
auto& containers = getEstateInventory( zone->getLandIdent() );
|
auto& containers = getEstateInventory( zone->getLandIdent() );
|
||||||
|
|
||||||
for( auto containerId : containerIds )
|
for( auto containerId : containerIds )
|
||||||
|
@ -1233,7 +1231,7 @@ void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sap
|
||||||
if( container == containers.end() )
|
if( container == containers.end() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
invMgr->sendInventoryContainer( player, container->second );
|
invMgr.sendInventoryContainer( player, container->second );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1296,8 +1294,8 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
|
||||||
item->setRot( rot );
|
item->setRot( rot );
|
||||||
|
|
||||||
// save
|
// save
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
invMgr->updateHousingItemPosition( item );
|
invMgr.updateHousingItemPosition( item );
|
||||||
|
|
||||||
terri.updateHousingObjectPosition( player, slot, item->getPos(), static_cast< uint16_t >( item->getRot() ) );
|
terri.updateHousingObjectPosition( player, slot, item->getPos(), static_cast< uint16_t >( item->getRot() ) );
|
||||||
|
|
||||||
|
@ -1334,8 +1332,8 @@ bool Sapphire::World::Manager::HousingMgr::moveExternalItem( Entity::Player& pla
|
||||||
item->setPos( pos );
|
item->setPos( pos );
|
||||||
item->setRot( rot );
|
item->setRot( rot );
|
||||||
|
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
invMgr->updateHousingItemPosition( item );
|
invMgr.updateHousingItemPosition( item );
|
||||||
|
|
||||||
terri.updateYardObjectPos( player, slot, static_cast< uint16_t >( ident.landId ), *item );
|
terri.updateYardObjectPos( player, slot, static_cast< uint16_t >( ident.landId ), *item );
|
||||||
|
|
||||||
|
@ -1423,13 +1421,13 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
|
||||||
if( !player.getFreeInventoryContainerSlot( containerPair ) )
|
if( !player.getFreeInventoryContainerSlot( containerPair ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
// remove it from housing inventory
|
// remove it from housing inventory
|
||||||
container->removeItem( static_cast< uint8_t >( slotId ) );
|
container->removeItem( static_cast< uint8_t >( slotId ) );
|
||||||
invMgr->sendInventoryContainer( player, container );
|
invMgr.sendInventoryContainer( player, container );
|
||||||
invMgr->removeHousingItemPosition( *item );
|
invMgr.removeHousingItemPosition( *item );
|
||||||
invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId );
|
invMgr.removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId );
|
||||||
|
|
||||||
// add to player inv
|
// add to player inv
|
||||||
player.insertInventoryItem( containerPair.first, containerPair.second, item );
|
player.insertInventoryItem( containerPair.first, containerPair.second, item );
|
||||||
|
@ -1445,16 +1443,16 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
|
||||||
if( !freeContainer )
|
if( !freeContainer )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
container->removeItem( static_cast< uint8_t >( slotId ) );
|
container->removeItem( static_cast< uint8_t >( slotId ) );
|
||||||
invMgr->sendInventoryContainer( player, container );
|
invMgr.sendInventoryContainer( player, container );
|
||||||
invMgr->removeHousingItemPosition( *item );
|
invMgr.removeHousingItemPosition( *item );
|
||||||
invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId );
|
invMgr.removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId );
|
||||||
|
|
||||||
freeContainer->setItem( static_cast< uint8_t >( slotId ), item );
|
freeContainer->setItem( static_cast< uint8_t >( slotId ), item );
|
||||||
invMgr->sendInventoryContainer( player, freeContainer );
|
invMgr.sendInventoryContainer( player, freeContainer );
|
||||||
invMgr->saveHousingContainer( terri.getLandIdent(), freeContainer );
|
invMgr.saveHousingContainer( terri.getLandIdent(), freeContainer );
|
||||||
}
|
}
|
||||||
|
|
||||||
// despawn
|
// despawn
|
||||||
|
@ -1485,7 +1483,7 @@ bool Sapphire::World::Manager::HousingMgr::removeExternalItem( Entity::Player& p
|
||||||
|
|
||||||
bool shouldDespawnItem = containerType != InventoryType::HousingExteriorStoreroom;
|
bool shouldDespawnItem = containerType != InventoryType::HousingExteriorStoreroom;
|
||||||
|
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
if( sendToStoreroom )
|
if( sendToStoreroom )
|
||||||
{
|
{
|
||||||
|
@ -1496,13 +1494,13 @@ bool Sapphire::World::Manager::HousingMgr::removeExternalItem( Entity::Player& p
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
sourceContainer->removeItem( slotId );
|
sourceContainer->removeItem( slotId );
|
||||||
invMgr->sendInventoryContainer( player, sourceContainer );
|
invMgr.sendInventoryContainer( player, sourceContainer );
|
||||||
invMgr->removeItemFromHousingContainer( land.getLandIdent(), sourceContainer->getId(), slotId );
|
invMgr.removeItemFromHousingContainer( land.getLandIdent(), sourceContainer->getId(), slotId );
|
||||||
invMgr->removeHousingItemPosition( *item );
|
invMgr.removeHousingItemPosition( *item );
|
||||||
|
|
||||||
storeroomContainer->setItem( static_cast< uint8_t >( freeSlot ), item );
|
storeroomContainer->setItem( static_cast< uint8_t >( freeSlot ), item );
|
||||||
invMgr->sendInventoryContainer( player, storeroomContainer );
|
invMgr.sendInventoryContainer( player, storeroomContainer );
|
||||||
invMgr->saveHousingContainer( land.getLandIdent(), storeroomContainer );
|
invMgr.saveHousingContainer( land.getLandIdent(), storeroomContainer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1512,9 +1510,9 @@ bool Sapphire::World::Manager::HousingMgr::removeExternalItem( Entity::Player& p
|
||||||
|
|
||||||
// remove from housing inv
|
// remove from housing inv
|
||||||
sourceContainer->removeItem( slotId );
|
sourceContainer->removeItem( slotId );
|
||||||
invMgr->sendInventoryContainer( player, sourceContainer );
|
invMgr.sendInventoryContainer( player, sourceContainer );
|
||||||
invMgr->removeHousingItemPosition( *item );
|
invMgr.removeHousingItemPosition( *item );
|
||||||
invMgr->removeItemFromHousingContainer( land.getLandIdent(), sourceContainer->getId(), slotId );
|
invMgr.removeItemFromHousingContainer( land.getLandIdent(), sourceContainer->getId(), slotId );
|
||||||
|
|
||||||
// add to player inv
|
// add to player inv
|
||||||
player.insertInventoryItem( containerPair.first, containerPair.second, item );
|
player.insertInventoryItem( containerPair.first, containerPair.second, item );
|
||||||
|
@ -1570,9 +1568,9 @@ void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::E
|
||||||
if( it == inv.end() )
|
if( it == inv.end() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
invMgr->sendInventoryContainer( player, it->second );
|
invMgr.sendInventoryContainer( player, it->second );
|
||||||
|
|
||||||
auto pkt = Server::makeActorControlSelf( player.getId(), Network::ActorControl::ShowEstateExternalAppearanceUI, plot );
|
auto pkt = Server::makeActorControlSelf( player.getId(), Network::ActorControl::ShowEstateExternalAppearanceUI, plot );
|
||||||
player.queuePacket( pkt );
|
player.queuePacket( pkt );
|
||||||
|
@ -1600,9 +1598,9 @@ void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::E
|
||||||
if( it == inv.end() )
|
if( it == inv.end() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto invMgr = framework()->get< InventoryMgr >();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
invMgr->sendInventoryContainer( player, it->second );
|
invMgr.sendInventoryContainer( player, it->second );
|
||||||
|
|
||||||
auto pkt = Server::makeActorControlSelf( player.getId(), Network::ActorControl::ShowEstateInternalAppearanceUI );
|
auto pkt = Server::makeActorControlSelf( player.getId(), Network::ActorControl::ShowEstateInternalAppearanceUI );
|
||||||
player.queuePacket( pkt );
|
player.queuePacket( pkt );
|
||||||
|
@ -1627,5 +1625,5 @@ Sapphire::Inventory::HousingItemPtr Sapphire::World::Manager::HousingMgr::getHou
|
||||||
if( !tmpItem )
|
if( !tmpItem )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId(), framework() );
|
return Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define SAPPHIRE_HOUSINGMGR_H
|
#define SAPPHIRE_HOUSINGMGR_H
|
||||||
|
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
#include "BaseManager.h"
|
|
||||||
#include "Territory/HousingZone.h"
|
#include "Territory/HousingZone.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -15,7 +14,7 @@ namespace Sapphire::Data
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
class HousingMgr : public BaseManager
|
class HousingMgr
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -69,7 +68,7 @@ namespace Sapphire::World::Manager
|
||||||
*/
|
*/
|
||||||
using LandIdentToInventoryContainerMap = std::unordered_map< uint64_t, ContainerIdToContainerMap >;
|
using LandIdentToInventoryContainerMap = std::unordered_map< uint64_t, ContainerIdToContainerMap >;
|
||||||
|
|
||||||
HousingMgr( FrameworkPtr pFw );
|
HousingMgr();
|
||||||
virtual ~HousingMgr();
|
virtual ~HousingMgr();
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
|
|
|
@ -10,15 +10,10 @@
|
||||||
|
|
||||||
#include <Database/DatabaseDef.h>
|
#include <Database/DatabaseDef.h>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
|
#include <Service.h>
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
|
||||||
Sapphire::World::Manager::InventoryMgr::InventoryMgr( Sapphire::FrameworkPtr pFw ) :
|
|
||||||
BaseManager( pFw )
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void Sapphire::World::Manager::InventoryMgr::sendInventoryContainer( Sapphire::Entity::Player& player,
|
void Sapphire::World::Manager::InventoryMgr::sendInventoryContainer( Sapphire::Entity::Player& player,
|
||||||
Sapphire::ItemContainerPtr container )
|
Sapphire::ItemContainerPtr container )
|
||||||
{
|
{
|
||||||
|
@ -71,15 +66,14 @@ void Sapphire::World::Manager::InventoryMgr::sendInventoryContainer( Sapphire::E
|
||||||
Sapphire::ItemPtr Sapphire::World::Manager::InventoryMgr::createItem( Entity::Player& player,
|
Sapphire::ItemPtr Sapphire::World::Manager::InventoryMgr::createItem( Entity::Player& player,
|
||||||
uint32_t catalogId, uint32_t quantity )
|
uint32_t catalogId, uint32_t quantity )
|
||||||
{
|
{
|
||||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
auto& pExdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& itemMgr = Common::Service< Manager::ItemMgr >::ref();
|
||||||
auto itemMgr = framework()->get< Manager::ItemMgr >();
|
auto itemInfo = pExdData.get< Sapphire::Data::Item >( catalogId );
|
||||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
|
||||||
|
|
||||||
if( !itemInfo )
|
if( !itemInfo )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto item = make_Item( itemMgr->getNextUId(), catalogId, framework() );
|
auto item = make_Item( itemMgr.getNextUId(), catalogId );
|
||||||
|
|
||||||
item->setStackSize( std::max< uint32_t >( 1, quantity ) );
|
item->setStackSize( std::max< uint32_t >( 1, quantity ) );
|
||||||
|
|
||||||
|
@ -103,9 +97,9 @@ void Sapphire::World::Manager::InventoryMgr::removeItemFromHousingContainer( Sap
|
||||||
uint16_t containerId,
|
uint16_t containerId,
|
||||||
uint16_t slotId )
|
uint16_t slotId )
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
|
|
||||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_DEL );
|
auto stmt = db.getPreparedStatement( Db::LAND_INV_DEL );
|
||||||
|
|
||||||
auto u64ident = *reinterpret_cast< uint64_t* >( &ident );
|
auto u64ident = *reinterpret_cast< uint64_t* >( &ident );
|
||||||
|
|
||||||
|
@ -113,16 +107,16 @@ void Sapphire::World::Manager::InventoryMgr::removeItemFromHousingContainer( Sap
|
||||||
stmt->setUInt( 2, containerId );
|
stmt->setUInt( 2, containerId );
|
||||||
stmt->setUInt( 3, slotId );
|
stmt->setUInt( 3, slotId );
|
||||||
|
|
||||||
pDb->directExecute( stmt );
|
db.directExecute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::InventoryMgr::saveHousingContainerItem( uint64_t ident,
|
void Sapphire::World::Manager::InventoryMgr::saveHousingContainerItem( uint64_t ident,
|
||||||
uint16_t containerId, uint16_t slotId,
|
uint16_t containerId, uint16_t slotId,
|
||||||
uint64_t itemId )
|
uint64_t itemId )
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
|
|
||||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_UP );
|
auto stmt = db.getPreparedStatement( Db::LAND_INV_UP );
|
||||||
// LandIdent, ContainerId, SlotId, ItemId, ItemId
|
// LandIdent, ContainerId, SlotId, ItemId, ItemId
|
||||||
|
|
||||||
stmt->setUInt64( 1, ident );
|
stmt->setUInt64( 1, ident );
|
||||||
|
@ -134,14 +128,14 @@ void Sapphire::World::Manager::InventoryMgr::saveHousingContainerItem( uint64_t
|
||||||
// the second time is for the ON DUPLICATE KEY UPDATE condition
|
// the second time is for the ON DUPLICATE KEY UPDATE condition
|
||||||
stmt->setUInt64( 5, itemId );
|
stmt->setUInt64( 5, itemId );
|
||||||
|
|
||||||
pDb->directExecute( stmt );
|
db.directExecute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::InventoryMgr::updateHousingItemPosition( Sapphire::Inventory::HousingItemPtr item )
|
void Sapphire::World::Manager::InventoryMgr::updateHousingItemPosition( Sapphire::Inventory::HousingItemPtr item )
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
|
|
||||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_UP_ITEMPOS );
|
auto stmt = db.getPreparedStatement( Db::LAND_INV_UP_ITEMPOS );
|
||||||
// ItemId, PosX, PosY, PosZ, Rotation, PosX, PosY, PosZ, Rotation
|
// ItemId, PosX, PosY, PosZ, Rotation, PosX, PosY, PosZ, Rotation
|
||||||
|
|
||||||
auto pos = item->getPos();
|
auto pos = item->getPos();
|
||||||
|
@ -159,29 +153,29 @@ void Sapphire::World::Manager::InventoryMgr::updateHousingItemPosition( Sapphire
|
||||||
stmt->setUInt( 8, pos.z );
|
stmt->setUInt( 8, pos.z );
|
||||||
stmt->setInt( 9, rot );
|
stmt->setInt( 9, rot );
|
||||||
|
|
||||||
pDb->execute( stmt );
|
db.execute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::InventoryMgr::removeHousingItemPosition( Sapphire::Inventory::HousingItem& item )
|
void Sapphire::World::Manager::InventoryMgr::removeHousingItemPosition( Sapphire::Inventory::HousingItem& item )
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
|
|
||||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_DEL_ITEMPOS );
|
auto stmt = db.getPreparedStatement( Db::LAND_INV_DEL_ITEMPOS );
|
||||||
|
|
||||||
stmt->setUInt64( 1, item.getUId() );
|
stmt->setUInt64( 1, item.getUId() );
|
||||||
|
|
||||||
pDb->directExecute( stmt );
|
db.directExecute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::InventoryMgr::saveItem( Sapphire::Entity::Player& player, Sapphire::ItemPtr item )
|
void Sapphire::World::Manager::InventoryMgr::saveItem( Sapphire::Entity::Player& player, Sapphire::ItemPtr item )
|
||||||
{
|
{
|
||||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_INS );
|
auto stmt = db.getPreparedStatement( Db::CHARA_ITEMGLOBAL_INS );
|
||||||
|
|
||||||
stmt->setUInt( 1, player.getId() );
|
stmt->setUInt( 1, player.getId() );
|
||||||
stmt->setUInt64( 2, item->getUId() );
|
stmt->setUInt64( 2, item->getUId() );
|
||||||
stmt->setUInt( 3, item->getId() );
|
stmt->setUInt( 3, item->getId() );
|
||||||
stmt->setUInt( 4, item->getStackSize() );
|
stmt->setUInt( 4, item->getStackSize() );
|
||||||
|
|
||||||
pDb->directExecute( stmt );
|
db.directExecute( stmt );
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue