mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-04 17:57:47 +00:00
debug command to force bnpc action
This commit is contained in:
parent
542f37fb3d
commit
34770bd70f
3 changed files with 44 additions and 3 deletions
|
@ -1035,14 +1035,16 @@ void Sapphire::Entity::Player::despawn( Entity::PlayerPtr pTarget )
|
|||
|
||||
Sapphire::Entity::ActorPtr Sapphire::Entity::Player::lookupTargetById( uint64_t targetId )
|
||||
{
|
||||
ActorPtr targetActor;
|
||||
if( targetId == 0 || targetId == INVALID_GAME_OBJECT_ID64 )
|
||||
return nullptr;
|
||||
|
||||
auto inRange = getInRangeActors( true );
|
||||
for( auto actor : inRange )
|
||||
{
|
||||
if( actor->getId() == targetId )
|
||||
targetActor = actor;
|
||||
return actor;
|
||||
}
|
||||
return targetActor;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::setLastPing( uint32_t ping )
|
||||
|
|
|
@ -22,6 +22,10 @@ void World::Manager::ActionMgr::handlePlacedAction( Entity::Chara& chara, uint32
|
|||
if( auto player = chara.getAsPlayer() )
|
||||
player->sendDebug( "got aoe act: {0}", actionData->name );
|
||||
|
||||
if( !actionData )
|
||||
{
|
||||
actionData = Common::Service< Data::ExdDataGenerated >::ref().get< Data::Action >( actionId );
|
||||
}
|
||||
|
||||
auto action = Action::make_Action( chara.getAsChara(), actionId, sequence, actionData );
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "Script/ScriptMgr.h"
|
||||
#include "Script/NativeScriptMgr.h"
|
||||
|
||||
#include "Actor/Actor.h"
|
||||
#include "Actor/EventObject.h"
|
||||
#include "Actor/BNpc.h"
|
||||
|
||||
|
@ -38,6 +39,7 @@
|
|||
#include "Territory/PublicContent.h"
|
||||
#include "Territory/InstanceObjectCache.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Manager/ActionMgr.h"
|
||||
#include "Event/EventDefs.h"
|
||||
|
||||
#include "ServerMgr.h"
|
||||
|
@ -466,6 +468,28 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
|
|||
}
|
||||
player.setVisualEffect( id );
|
||||
}
|
||||
else if( subCommand == "bnpccast" || subCommand == "bcast" )
|
||||
{
|
||||
if( auto target = player.lookupTargetById( player.getTargetId() ) )
|
||||
{
|
||||
if( auto bnpc = target->getAsBNpc() )
|
||||
{
|
||||
int32_t id;
|
||||
sscanf( params.c_str(), "%d", &id );
|
||||
auto actionData = Common::Service< Data::ExdDataGenerated >::ref().get< Data::Action >( id );
|
||||
if ( !actionData )
|
||||
return;
|
||||
if( !actionData->targetArea && bnpc->getTargetId() != 0 && bnpc->getTargetId() != INVALID_GAME_OBJECT_ID64 )
|
||||
{
|
||||
Service< World::Manager::ActionMgr >::ref().handleTargetedAction( *bnpc, id, actionData, bnpc->getTargetId(), 0 );
|
||||
}
|
||||
else if ( actionData->targetArea )
|
||||
{
|
||||
Service< World::Manager::ActionMgr >::ref().handlePlacedAction( *bnpc, id, actionData, player.getPos(), 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendUrgent( "{0} is not a valid SET command.", subCommand );
|
||||
|
@ -696,6 +720,17 @@ void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player&
|
|||
player.sendNotice( "x:{}, y:{}, z:{}", pPopRange->header.transform.translation.x, pPopRange->header.transform.translation.y, pPopRange->header.transform.translation.z );
|
||||
}
|
||||
}
|
||||
else if ( ( subCommand == "targetinfo" ) || ( subCommand == "tinfo" ) || subCommand == "ti" )
|
||||
{
|
||||
if( auto target = player.lookupTargetById( player.getTargetId() ) )
|
||||
{
|
||||
if( auto bnpc = target->getAsBNpc() )
|
||||
{
|
||||
player.sendNotice( "BNpcBaseId: {}, BNpcNameId, {}", bnpc->getBNpcBaseId(), bnpc->getBNpcNameId() );
|
||||
}
|
||||
//else if
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendUrgent( "{0} is not a valid GET command.", subCommand );
|
||||
|
|
Loading…
Add table
Reference in a new issue