mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 08:57:44 +00:00
Started stripping actors - readding after rewrite
This commit is contained in:
parent
c664c5de90
commit
322dce393d
18 changed files with 69 additions and 405 deletions
|
@ -3,7 +3,6 @@
|
|||
#include "Player.h"
|
||||
#include "Chara.h"
|
||||
#include "BattleNpc.h"
|
||||
#include "EventNpc.h"
|
||||
|
||||
Core::Entity::Actor::Actor( ObjKind type ) :
|
||||
m_objKind( type )
|
||||
|
@ -58,11 +57,6 @@ bool Core::Entity::Actor::isBattleNpc() const
|
|||
return m_objKind == ObjKind::BattleNpc;
|
||||
}
|
||||
|
||||
bool Core::Entity::Actor::isEventNpc() const
|
||||
{
|
||||
return m_objKind == ObjKind::EventNpc;
|
||||
}
|
||||
|
||||
/*! \return pointer to this instance as ActorPtr */
|
||||
Core::Entity::CharaPtr Core::Entity::Actor::getAsChara()
|
||||
{
|
||||
|
@ -84,11 +78,3 @@ Core::Entity::BattleNpcPtr Core::Entity::Actor::getAsBattleNpc()
|
|||
return nullptr;
|
||||
return boost::dynamic_pointer_cast< Entity::BattleNpc, Entity::Actor >( shared_from_this() );
|
||||
}
|
||||
|
||||
/*! \return pointer to this instance as EventNpcPtr */
|
||||
Core::Entity::EventNpcPtr Core::Entity::Actor::getAsEventNpc()
|
||||
{
|
||||
if( !isEventNpc() )
|
||||
return nullptr;
|
||||
return boost::dynamic_pointer_cast< Entity::EventNpc, Entity::Actor >( shared_from_this() );
|
||||
}
|
||||
|
|
|
@ -69,12 +69,10 @@ namespace Entity {
|
|||
|
||||
bool isPlayer() const;
|
||||
bool isBattleNpc() const;
|
||||
bool isEventNpc() const;
|
||||
|
||||
CharaPtr getAsChara();
|
||||
PlayerPtr getAsPlayer();
|
||||
BattleNpcPtr getAsBattleNpc();
|
||||
EventNpcPtr getAsEventNpc();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
#include "BattleNpcTemplate.h"
|
||||
|
||||
Core::Entity::BattleNpcTemplate::BattleNpcTemplate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Core::Entity::BattleNpcTemplate::BattleNpcTemplate( std::string templateName, uint32_t bnpcBaseId,
|
||||
uint32_t bnpcNameId, uint32_t modelId, std::string aiName ) :
|
||||
m_templateName( templateName ),
|
||||
m_bnpcBaseId( bnpcBaseId ),
|
||||
m_bnpcNameId( bnpcNameId ),
|
||||
m_modelId( modelId ),
|
||||
m_aiName( aiName )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Core::Entity::BattleNpcTemplate::~BattleNpcTemplate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::BattleNpcTemplate::getBnpcBaseId() const
|
||||
{
|
||||
return m_bnpcBaseId;
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::BattleNpcTemplate::getBnpcNameId() const
|
||||
{
|
||||
return m_bnpcNameId;
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::BattleNpcTemplate::getModelId() const
|
||||
{
|
||||
return m_modelId;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
#ifndef _BATTLENPCTEMPLATE_H
|
||||
#define _BATTLENPCTEMPLATE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
namespace Core {
|
||||
namespace Entity {
|
||||
|
||||
/**
|
||||
* \brief BattleNpcTemplate - Class which defines a template specific BNpcs can be created from
|
||||
*/
|
||||
class BattleNpcTemplate
|
||||
{
|
||||
public:
|
||||
BattleNpcTemplate();
|
||||
BattleNpcTemplate( std::string templateName, uint32_t bnpcBaseId, uint32_t bnpcNameId, uint32_t modelId, std::string aiName );
|
||||
|
||||
~BattleNpcTemplate();
|
||||
|
||||
uint32_t getBnpcBaseId() const;
|
||||
uint32_t getBnpcNameId() const;
|
||||
uint32_t getModelId() const;
|
||||
|
||||
private:
|
||||
std::string m_templateName;
|
||||
std::string m_aiName;
|
||||
uint32_t m_bnpcBaseId = 0;
|
||||
uint32_t m_bnpcNameId = 0;
|
||||
uint32_t m_modelId = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,118 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <common/Logging/Logger.h>
|
||||
#include <common/Util/Util.h>
|
||||
#include <common/Util/UtilMath.h>
|
||||
|
||||
#include "Player.h"
|
||||
#include "EventNpc.h"
|
||||
|
||||
#include "Network/PacketWrappers/MoveActorPacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
||||
using namespace Core::Common;
|
||||
using namespace Core::Network::Packets;
|
||||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
extern Core::Logger g_log;
|
||||
|
||||
uint32_t Core::Entity::EventNpc::m_nextID = 1249241694;
|
||||
|
||||
Core::Entity::EventNpc::EventNpc() :
|
||||
Chara( ObjKind::EventNpc )
|
||||
{
|
||||
m_id = 0;
|
||||
m_status = ActorStatus::Idle;
|
||||
}
|
||||
|
||||
Core::Entity::EventNpc::~EventNpc()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Core::Entity::EventNpc::EventNpc( uint32_t enpcId, const Common::FFXIVARR_POSITION3& spawnPos, float rotation ) :
|
||||
Chara( ObjKind::EventNpc )
|
||||
{
|
||||
EventNpc::m_nextID++;
|
||||
m_id = EventNpc::m_nextID;
|
||||
|
||||
m_pos = spawnPos;
|
||||
m_posOrigin = spawnPos;
|
||||
|
||||
m_targetId = static_cast< uint64_t >( INVALID_GAME_OBJECT_ID );
|
||||
|
||||
m_maxHp = 150;
|
||||
m_maxMp = 100;
|
||||
|
||||
m_baseStats.max_hp = m_maxHp;
|
||||
m_baseStats.max_mp = m_maxMp;
|
||||
|
||||
m_hp = m_maxHp;
|
||||
m_mp = m_maxMp;
|
||||
|
||||
m_currentStance = Stance::Passive;
|
||||
|
||||
m_eNpcId = enpcId;
|
||||
|
||||
m_status = ActorStatus::Idle;
|
||||
|
||||
m_invincibilityType = InvincibilityType::InvincibilityNone;
|
||||
m_rot = rotation;
|
||||
|
||||
}
|
||||
|
||||
// spawn this player for pTarget
|
||||
/*! TODO: Retail additionally sends Look+Models for EventNpcs even though it is not needed,
|
||||
add when the new exd reader is implemented(also counts for BNPCs) */
|
||||
void Core::Entity::EventNpc::spawn( PlayerPtr pTarget )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcNpcSpawn > spawnPacket( getId(), pTarget->getId() );
|
||||
|
||||
|
||||
spawnPacket.data().pos.x = m_pos.x;
|
||||
spawnPacket.data().pos.y = m_pos.y;
|
||||
spawnPacket.data().pos.z = m_pos.z;
|
||||
|
||||
spawnPacket.data().targetId = pTarget->getId();
|
||||
spawnPacket.data().hPCurr = 1;
|
||||
spawnPacket.data().hPMax = 1;
|
||||
|
||||
spawnPacket.data().bNPCBase = m_eNpcId;
|
||||
spawnPacket.data().bNPCName = m_eNpcId;
|
||||
spawnPacket.data().spawnIndex = pTarget->getSpawnIdForActorId( getId() );
|
||||
|
||||
spawnPacket.data().rotation = Math::Util::floatToUInt16Rot( getRotation() );
|
||||
|
||||
spawnPacket.data().type = static_cast< uint8_t >( m_objKind );
|
||||
|
||||
pTarget->queuePacket( spawnPacket );
|
||||
}
|
||||
|
||||
// despawn
|
||||
void Core::Entity::EventNpc::despawn( PlayerPtr pTarget )
|
||||
{
|
||||
pTarget->freePlayerSpawnId( getId() );
|
||||
|
||||
ActorControlPacket143 controlPacket( m_id, DespawnZoneScreenMsg, 0x04, getId(), 0x01 );
|
||||
pTarget->queuePacket( controlPacket );
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::EventNpc::getLevel() const
|
||||
{
|
||||
return m_level;
|
||||
}
|
||||
|
||||
void Core::Entity::EventNpc::resetPos()
|
||||
{
|
||||
m_pos = m_posOrigin;
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::EventNpc::getEnpcId() const
|
||||
{
|
||||
return m_eNpcId;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef _EVENTNPC_H
|
||||
#define _EVENTNPC_H
|
||||
|
||||
#include "Chara.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Entity {
|
||||
|
||||
// class for Mobs inheriting from Chara
|
||||
class EventNpc : public Chara
|
||||
{
|
||||
public:
|
||||
EventNpc();
|
||||
virtual ~EventNpc() override;
|
||||
|
||||
EventNpc( uint32_t enpcId, const Common::FFXIVARR_POSITION3& spawnPos, float rotation );
|
||||
|
||||
// send spawn packets to pTarget
|
||||
void spawn( PlayerPtr pTarget ) override;
|
||||
|
||||
// send despawn packets to pTarget
|
||||
void despawn( PlayerPtr pTarget ) override;
|
||||
|
||||
uint8_t getLevel() const override;
|
||||
|
||||
void resetPos();
|
||||
|
||||
uint32_t getEnpcId() const;
|
||||
|
||||
private:
|
||||
|
||||
static uint32_t m_nextID;
|
||||
Common::FFXIVARR_POSITION3 m_posOrigin;
|
||||
uint8_t m_level;
|
||||
uint32_t m_eNpcId;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
48
src/servers/sapphire_zone/Actor/EventObject.cpp
Normal file
48
src/servers/sapphire_zone/Actor/EventObject.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include "EventObject.h"
|
||||
#include "Zone/InstanceContent.h"
|
||||
|
||||
Core::Entity::EventObject::EventObject( uint32_t objectId, uint32_t mapLinkId ) :
|
||||
Core::Entity::Actor( ObjKind::EventObj ),
|
||||
m_mapLinkId( mapLinkId ),
|
||||
m_state( 0 )
|
||||
{
|
||||
m_id = objectId;
|
||||
}
|
||||
|
||||
Core::Entity::EventObject::EventObject( uint32_t objectId, uint32_t mapLinkId, Common::FFXIVARR_POSITION3 pos ) :
|
||||
EventObject( objectId, mapLinkId )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::EventObject::getHierachyId() const
|
||||
{
|
||||
return m_mapLinkId;
|
||||
}
|
||||
|
||||
void Core::Entity::EventObject::setHierachyId( uint32_t hierachyId )
|
||||
{
|
||||
m_mapLinkId = hierachyId;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::EventObject::getState() const
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
void Core::Entity::EventObject::setState( uint8_t state )
|
||||
{
|
||||
m_state = state;
|
||||
|
||||
//m_parentInstance->updateEObj( InstanceObjectPtr( this ) );
|
||||
}
|
||||
|
||||
void Core::Entity::EventObject::setParentInstance( Core::InstanceContentPtr instance )
|
||||
{
|
||||
m_parentInstance = instance;
|
||||
}
|
||||
|
||||
Core::InstanceContentPtr Core::Entity::EventObject::getParentInstance() const
|
||||
{
|
||||
return m_parentInstance;
|
||||
}
|
|
@ -7,11 +7,11 @@ namespace Core
|
|||
{
|
||||
namespace Entity
|
||||
{
|
||||
class InstanceObject : public Actor
|
||||
class EventObject : public Actor
|
||||
{
|
||||
public:
|
||||
InstanceObject( uint32_t objectId, uint32_t mapLinkId );
|
||||
InstanceObject( uint32_t objectId, uint32_t mapLinkId, Common::FFXIVARR_POSITION3 pos );
|
||||
EventObject( uint32_t objectId, uint32_t mapLinkId );
|
||||
EventObject( uint32_t objectId, uint32_t mapLinkId, Common::FFXIVARR_POSITION3 pos );
|
||||
|
||||
uint32_t getHierachyId() const;
|
||||
void setHierachyId( uint32_t hierachyId );
|
|
@ -1,48 +0,0 @@
|
|||
#include "InstanceObject.h"
|
||||
#include "Zone/InstanceContent.h"
|
||||
|
||||
Core::Entity::InstanceObject::InstanceObject( uint32_t objectId, uint32_t mapLinkId ) :
|
||||
Core::Entity::Actor( ObjKind::EventObj ),
|
||||
m_mapLinkId( mapLinkId ),
|
||||
m_state( 0 )
|
||||
{
|
||||
m_id = objectId;
|
||||
}
|
||||
|
||||
Core::Entity::InstanceObject::InstanceObject( uint32_t objectId, uint32_t mapLinkId, Common::FFXIVARR_POSITION3 pos ) :
|
||||
InstanceObject( objectId, mapLinkId )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::InstanceObject::getHierachyId() const
|
||||
{
|
||||
return m_mapLinkId;
|
||||
}
|
||||
|
||||
void Core::Entity::InstanceObject::setHierachyId( uint32_t hierachyId )
|
||||
{
|
||||
m_mapLinkId = hierachyId;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::InstanceObject::getState() const
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
void Core::Entity::InstanceObject::setState( uint8_t state )
|
||||
{
|
||||
m_state = state;
|
||||
|
||||
//m_parentInstance->updateInstanceObj( InstanceObjectPtr( this ) );
|
||||
}
|
||||
|
||||
void Core::Entity::InstanceObject::setParentInstance( Core::InstanceContentPtr instance )
|
||||
{
|
||||
m_parentInstance = instance;
|
||||
}
|
||||
|
||||
Core::InstanceContentPtr Core::Entity::InstanceObject::getParentInstance() const
|
||||
{
|
||||
return m_parentInstance;
|
||||
}
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "Actor/Player.h"
|
||||
#include "Actor/BattleNpc.h"
|
||||
#include "Actor/EventNpc.h"
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
#include "Zone/InstanceContent.h"
|
||||
|
@ -379,33 +378,6 @@ void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost:
|
|||
auto pPe = Network::Packets::make_GamePacket( opcode, 0x30, player.getId(), player.getId() );
|
||||
player.queuePacket( pPe );
|
||||
}
|
||||
else if( subCommand == "eventnpc-self" )
|
||||
{
|
||||
int32_t id;
|
||||
|
||||
sscanf( params.c_str(), "%d", &id );
|
||||
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcNpcSpawn > spawnPacket( player.getId() );
|
||||
spawnPacket.data().type = 3;
|
||||
spawnPacket.data().pos = player.getPos();
|
||||
spawnPacket.data().rotation = player.getRotation();
|
||||
spawnPacket.data().bNPCBase = id;
|
||||
spawnPacket.data().bNPCName = id;
|
||||
spawnPacket.data().targetId = player.getId();
|
||||
player.queuePacket( spawnPacket );
|
||||
}
|
||||
else if( subCommand == "eventnpc" )
|
||||
{
|
||||
int32_t id;
|
||||
|
||||
sscanf( params.c_str(), "%d", &id );
|
||||
|
||||
auto pENpc = Entity::make_EventNpc( id, player.getPos(), player.getRotation() );
|
||||
|
||||
auto pZone = player.getCurrentZone();
|
||||
pENpc->setCurrentZone( pZone );
|
||||
pZone->pushActor( pENpc );
|
||||
}
|
||||
else if( subCommand == "actrl" )
|
||||
{
|
||||
|
||||
|
@ -778,11 +750,11 @@ void Core::DebugCommandHandler::instance( char* data, Entity::Player &player, bo
|
|||
if( !instance )
|
||||
return;
|
||||
|
||||
auto obj = instance->getInstanceObject( objId );
|
||||
auto obj = instance->getEObj(objId);
|
||||
if( !obj )
|
||||
return;
|
||||
|
||||
instance->updateInstanceObj( obj );
|
||||
instance->updateEObj(obj);
|
||||
}
|
||||
else if( subCommand == "objstate" )
|
||||
{
|
||||
|
@ -795,7 +767,7 @@ void Core::DebugCommandHandler::instance( char* data, Entity::Player &player, bo
|
|||
if( !instance )
|
||||
return;
|
||||
|
||||
auto obj = instance->getInstanceObject( objId );
|
||||
auto obj = instance->getEObj(objId);
|
||||
if( !obj )
|
||||
return;
|
||||
|
||||
|
|
|
@ -38,9 +38,7 @@ namespace Core
|
|||
TYPE_FORWARD( Chara );
|
||||
TYPE_FORWARD( Player );
|
||||
TYPE_FORWARD( BattleNpc );
|
||||
TYPE_FORWARD( EventNpc );
|
||||
TYPE_FORWARD( BattleNpcTemplate );
|
||||
TYPE_FORWARD( InstanceObject );
|
||||
TYPE_FORWARD( EventObject );
|
||||
}
|
||||
|
||||
namespace Event
|
||||
|
|
|
@ -139,12 +139,6 @@ void Core::Scripting::ScriptManager::onPlayerFirstEnterWorld( Entity::Player& pl
|
|||
// }
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId,
|
||||
uint32_t bnpcNameId, uint32_t modelId, std::string aiName )
|
||||
{
|
||||
return g_serverZone.registerBnpcTemplate( templateName, bnpcBaseId, bnpcNameId, modelId, aiName );
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId )
|
||||
{
|
||||
|
||||
|
|
|
@ -37,8 +37,6 @@ namespace Core
|
|||
|
||||
void onPlayerFirstEnterWorld( Entity::Player& player );
|
||||
|
||||
static bool registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId, uint32_t bnpcNameId, uint32_t modelId, std::string aiName );
|
||||
|
||||
bool onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId );
|
||||
bool onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
||||
bool onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
|
|
|
@ -9,11 +9,11 @@ public:
|
|||
|
||||
void onInit( InstanceContent& instance ) override
|
||||
{
|
||||
auto exit = new Entity::InstanceObject( EXIT_OBJECT, 0, { 0, 0, -10 } );
|
||||
instance.registerInstanceObj( Entity::InstanceObjectPtr( exit ) );
|
||||
auto exit = new Entity::EventObject( EXIT_OBJECT, 0, { 0, 0, -10 } );
|
||||
instance.registerEObj(Entity::InstanceObjectPtr(exit));
|
||||
|
||||
auto start = new Entity::InstanceObject( START_CIRCLE, 4236868, { 0, 0, 24 } );
|
||||
instance.registerInstanceObj( Entity::InstanceObjectPtr( start ) );
|
||||
auto start = new Entity::EventObject( START_CIRCLE, 4236868, { 0, 0, 24 } );
|
||||
instance.registerEObj(Entity::InstanceObjectPtr(start));
|
||||
}
|
||||
|
||||
void onUpdate( InstanceContent& instance, uint32_t currTime ) override
|
||||
|
|
|
@ -65,34 +65,6 @@ size_t Core::ServerZone::getSessionCount() const
|
|||
return m_sessionMapById.size();
|
||||
}
|
||||
|
||||
bool Core::ServerZone::registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId,
|
||||
uint32_t bnpcNameId, uint32_t modelId, std::string aiName )
|
||||
{
|
||||
|
||||
auto it = m_bnpcTemplates.find( templateName );
|
||||
|
||||
if( it != m_bnpcTemplates.end() )
|
||||
{
|
||||
g_log.error( templateName + " already registered, skipping..." );
|
||||
return false;
|
||||
}
|
||||
|
||||
Entity::BattleNpcTemplatePtr pNpcTemplate( new Entity::BattleNpcTemplate( templateName, bnpcBaseId, bnpcNameId, modelId, aiName ) );
|
||||
m_bnpcTemplates[templateName] = pNpcTemplate;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::Entity::BattleNpcTemplatePtr Core::ServerZone::getBnpcTemplate( std::string templateName )
|
||||
{
|
||||
auto it = m_bnpcTemplates.find( templateName );
|
||||
|
||||
if (it != m_bnpcTemplates.end())
|
||||
return nullptr;
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
||||
{
|
||||
g_log.info( "Loading config " + m_configPath );
|
||||
|
@ -250,7 +222,6 @@ void Core::ServerZone::mainLoop()
|
|||
{
|
||||
this_thread::sleep_for( chrono::milliseconds( 50 ) );
|
||||
|
||||
|
||||
auto currTime = Util::getTimeSeconds();
|
||||
|
||||
g_territoryMgr.updateTerritoryInstances( currTime );
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <map>
|
||||
|
||||
#include "Forwards.h"
|
||||
#include "Actor/BattleNpcTemplate.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
@ -35,11 +34,6 @@ namespace Core {
|
|||
|
||||
size_t getSessionCount() const;
|
||||
|
||||
bool registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId,
|
||||
uint32_t bnpcNameId, uint32_t modelId, std::string aiName );
|
||||
|
||||
Entity::BattleNpcTemplatePtr getBnpcTemplate( std::string templateName );
|
||||
|
||||
void mainLoop();
|
||||
|
||||
bool isRunning() const;
|
||||
|
@ -66,8 +60,6 @@ namespace Core {
|
|||
|
||||
std::map< uint32_t, uint32_t > m_zones;
|
||||
|
||||
std::map< std::string, Entity::BattleNpcTemplatePtr > m_bnpcTemplates;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "Actor/Chara.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Actor/BattleNpc.h"
|
||||
#include "Actor/EventNpc.h"
|
||||
|
||||
#include "Forwards.h"
|
||||
|
||||
|
@ -323,14 +322,6 @@ void Core::Zone::pushActor( Entity::CharaPtr pChara )
|
|||
pBNpc->setPosition( pBNpc->getPos() );
|
||||
|
||||
}
|
||||
else if( pChara->isEventNpc() )
|
||||
{
|
||||
Entity::EventNpcPtr pENpc = pChara->getAsEventNpc();
|
||||
m_EventNpcMap[pENpc->getId()] = pENpc;
|
||||
pENpc->setPosition( pENpc->getPos() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Core::Zone::removeActor( Entity::CharaPtr pChara )
|
||||
|
@ -752,7 +743,7 @@ void Core::Zone::updateInRangeSet( Entity::CharaPtr pChara, Cell* pCell )
|
|||
}
|
||||
|
||||
}
|
||||
else if( ( pChara->isBattleNpc() || pChara->isEventNpc() ) && pCurAct->isPlayer() && pChara->isAlive() )
|
||||
else if( ( pChara->isBattleNpc() ) && pCurAct->isPlayer() && pChara->isAlive() )
|
||||
{
|
||||
auto pPlayer = pCurAct->getAsPlayer();
|
||||
if( pPlayer->isLoadingComplete() )
|
||||
|
@ -807,7 +798,7 @@ void Core::Zone::onInitDirector( Entity::Player& player )
|
|||
|
||||
}
|
||||
|
||||
void Core::Zone::registerInstanceObj( Entity::InstanceObjectPtr object )
|
||||
void Core::Zone::registerEObj( Entity::EventObjectPtr object )
|
||||
{
|
||||
if( !object )
|
||||
return;
|
||||
|
@ -819,7 +810,7 @@ void Core::Zone::registerInstanceObj( Entity::InstanceObjectPtr object )
|
|||
g_log.debug( "Registered instance eobj: " + std::to_string( object->getId() ) );
|
||||
}
|
||||
|
||||
Core::Entity::InstanceObjectPtr Core::Zone::getInstanceObject( uint32_t objId )
|
||||
Core::Entity::EventObjectPtr Core::Zone::getEObj( uint32_t objId )
|
||||
{
|
||||
auto obj = m_instanceObjects.find( objId );
|
||||
if( obj == m_instanceObjects.end() )
|
||||
|
@ -828,7 +819,7 @@ Core::Entity::InstanceObjectPtr Core::Zone::getInstanceObject( uint32_t objId )
|
|||
return obj->second;
|
||||
}
|
||||
|
||||
void Core::Zone::updateInstanceObj( Core::Entity::InstanceObjectPtr object )
|
||||
void Core::Zone::updateEObj( Entity::EventObjectPtr object )
|
||||
{
|
||||
if( !object )
|
||||
return;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "Cell.h"
|
||||
#include "CellHandler.h"
|
||||
#include "Actor/InstanceObject.h"
|
||||
#include "Actor/EventObject.h"
|
||||
|
||||
#include "Forwards.h"
|
||||
|
||||
|
@ -35,8 +35,7 @@ protected:
|
|||
|
||||
std::unordered_map< int32_t, Entity::PlayerPtr > m_playerMap;
|
||||
std::unordered_map< int32_t, Entity::BattleNpcPtr > m_BattleNpcMap;
|
||||
std::unordered_map< int32_t, Entity::EventNpcPtr > m_EventNpcMap;
|
||||
std::unordered_map< int32_t, Entity::InstanceObjectPtr > m_instanceObjects;
|
||||
std::unordered_map< int32_t, Entity::EventObjectPtr > m_instanceObjects;
|
||||
|
||||
std::set< Entity::BattleNpcPtr > m_BattleNpcDeadMap;
|
||||
|
||||
|
@ -114,9 +113,9 @@ public:
|
|||
|
||||
void updateSessions( bool changedWeather );
|
||||
|
||||
void registerInstanceObj( Entity::InstanceObjectPtr object );
|
||||
Entity::InstanceObjectPtr getInstanceObject( uint32_t objId );
|
||||
void updateInstanceObj( Entity::InstanceObjectPtr object );
|
||||
void registerEObj( Entity::EventObjectPtr object );
|
||||
Entity::EventObjectPtr getEObj( uint32_t objId );
|
||||
void updateEObj( Entity::EventObjectPtr object );
|
||||
|
||||
InstanceContentPtr getAsInstanceContent();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue