mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 16:57:47 +00:00
Update bnpcs to include nonpop flag
This commit is contained in:
parent
11b0683e7e
commit
f421021497
7 changed files with 15818 additions and 15 deletions
15690
sql/migrations/20211217125038_UpdateBattleNpc.sql
Normal file
15690
sql/migrations/20211217125038_UpdateBattleNpc.sql
Normal file
File diff suppressed because it is too large
Load diff
|
@ -889,6 +889,7 @@ namespace Sapphire::Common
|
||||||
|
|
||||||
enum ItemActionType : uint16_t
|
enum ItemActionType : uint16_t
|
||||||
{
|
{
|
||||||
|
KeyItemAction = 1,
|
||||||
ItemActionVFX = 852,
|
ItemActionVFX = 852,
|
||||||
ItemActionVFX2 = 944,
|
ItemActionVFX2 = 944,
|
||||||
};
|
};
|
||||||
|
|
|
@ -265,7 +265,7 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
||||||
"bnpc.SenseRangeRate, bnpc.Level, bnpc.ActiveType, bnpc.PopInterval, bnpc.PopRate, bnpc.PopEvent, bnpc.LinkGroup, bnpc.LinkFamily, bnpc.LinkRange,"
|
"bnpc.SenseRangeRate, bnpc.Level, bnpc.ActiveType, bnpc.PopInterval, bnpc.PopRate, bnpc.PopEvent, bnpc.LinkGroup, bnpc.LinkFamily, bnpc.LinkRange,"
|
||||||
"bnpc.LinkCountLimit, bnpc.NonpopInitZone, bnpc.InvalidRepop, bnpc.LinkParent, bnpc.LinkOverride, bnpc.LinkReply, bnpc.HorizontalPopRange, "
|
"bnpc.LinkCountLimit, bnpc.NonpopInitZone, bnpc.InvalidRepop, bnpc.LinkParent, bnpc.LinkOverride, bnpc.LinkReply, bnpc.HorizontalPopRange, "
|
||||||
"bnpc.VerticalPopRange, bnpc.BNpcBaseData, bnpc.RepopId, bnpc.BNPCRankId, bnpc.TerritoryRange, bnpc.BoundInstanceID, bnpc.FateLayoutLabelId,"
|
"bnpc.VerticalPopRange, bnpc.BNpcBaseData, bnpc.RepopId, bnpc.BNPCRankId, bnpc.TerritoryRange, bnpc.BoundInstanceID, bnpc.FateLayoutLabelId,"
|
||||||
"bnpc.NormalAI, bnpc.ServerPathId, bnpc.EquipmentID, bnpc.CustomizeID, bnpc.rotation "
|
"bnpc.NormalAI, bnpc.ServerPathId, bnpc.EquipmentID, bnpc.CustomizeID, bnpc.rotation, bnpc.Nonpop "
|
||||||
"FROM battlenpc as bnpc LEFT JOIN battlenpcgroupmapping AS bnpcgroup "
|
"FROM battlenpc as bnpc LEFT JOIN battlenpcgroupmapping AS bnpcgroup "
|
||||||
"ON bnpc.groupid = bnpcgroup.layergroupid where bnpcgroup.territorytypeid = ?;",
|
"ON bnpc.groupid = bnpcgroup.layergroupid where bnpcgroup.territorytypeid = ?;",
|
||||||
CONNECTION_BOTH );
|
CONNECTION_BOTH );
|
||||||
|
|
|
@ -317,6 +317,7 @@ void writeBNPCEntry( std::string& name, std::ofstream& out, LgbEntry* pObj, cons
|
||||||
std::to_string( pBNpc->data.LinkParent ) + ", " +
|
std::to_string( pBNpc->data.LinkParent ) + ", " +
|
||||||
std::to_string( pBNpc->data.LinkOverride ) + ", " +
|
std::to_string( pBNpc->data.LinkOverride ) + ", " +
|
||||||
std::to_string( pBNpc->data.LinkReply ) + ", " +
|
std::to_string( pBNpc->data.LinkReply ) + ", " +
|
||||||
|
std::to_string( pBNpc->data.Nonpop ) + ", " +
|
||||||
std::to_string( pBNpc->data.HorizontalPopRange ) + ", " +
|
std::to_string( pBNpc->data.HorizontalPopRange ) + ", " +
|
||||||
std::to_string( pBNpc->data.VerticalPopRange ) + ", " +
|
std::to_string( pBNpc->data.VerticalPopRange ) + ", " +
|
||||||
std::to_string( pBNpc->data.BNpcBaseData ) + ", " +
|
std::to_string( pBNpc->data.BNpcBaseData ) + ", " +
|
||||||
|
@ -328,12 +329,7 @@ void writeBNPCEntry( std::string& name, std::ofstream& out, LgbEntry* pObj, cons
|
||||||
std::to_string( pBNpc->data.NormalAI ) + ", " +
|
std::to_string( pBNpc->data.NormalAI ) + ", " +
|
||||||
std::to_string( pBNpc->data.ServerPathId ) + ", " +
|
std::to_string( pBNpc->data.ServerPathId ) + ", " +
|
||||||
std::to_string( pBNpc->data.EquipmentID ) + ", " +
|
std::to_string( pBNpc->data.EquipmentID ) + ", " +
|
||||||
std::to_string( pBNpc->data.CustomizeID ) + ", " +
|
std::to_string( pBNpc->data.CustomizeID ) + " " +
|
||||||
std::to_string( pBNpc->baseData.TerritoryRange ) + ", " +
|
|
||||||
std::to_string( pBNpc->baseData.Sense[0] ) + ", " +
|
|
||||||
std::to_string( pBNpc->baseData.Sense[1] ) + ", " +
|
|
||||||
std::to_string( pBNpc->baseData.SenseRange[0] ) + ", " +
|
|
||||||
std::to_string( pBNpc->baseData.SenseRange[1] ) + " " +
|
|
||||||
"\n" );
|
"\n" );
|
||||||
|
|
||||||
out.write( outStr.c_str(), outStr.size() );
|
out.write( outStr.c_str(), outStr.size() );
|
||||||
|
@ -380,9 +376,9 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
std::string data = std::string("GroupId, GroupName, TerritoryName, name, instanceId, x, y, z, Rotation, BaseId, PopWeather, PopTimeStart, PopTimeEnd, MoveAI, WanderingRange, Route, ") +
|
std::string data = std::string("GroupId, GroupName, TerritoryName, name, instanceId, x, y, z, Rotation, BaseId, PopWeather, PopTimeStart, PopTimeEnd, MoveAI, WanderingRange, Route, ") +
|
||||||
std::string("EventGroup, NameId, DropItem, SenseRangeRate, Level, ActiveType, PopInterval,PopRate, PopEvent, LinkGroup, ") +
|
std::string("EventGroup, NameId, DropItem, SenseRangeRate, Level, ActiveType, PopInterval,PopRate, PopEvent, LinkGroup, ") +
|
||||||
std::string("LinkFamily, LinkRange, LinkCountLimit, NonpopInitZone, InvalidRepop, LinkParent, LinkOverride, LinkReply, ") +
|
std::string("LinkFamily, LinkRange, LinkCountLimit, NonpopInitZone, InvalidRepop, LinkParent, LinkOverride, LinkReply, Nonpop, ") +
|
||||||
std::string("HorizontalPopRange, VerticalPopRange, BNpcBaseData, RepopId, BNPCRankId, TerritoryRange, BoundInstanceID, ") +
|
std::string("HorizontalPopRange, VerticalPopRange, BNpcBaseData, RepopId, BNPCRankId, TerritoryRange, BoundInstanceID, ") +
|
||||||
std::string("FateLayoutLabelId, NormalAI, ServerPathId, EquipmentID, CustomizeID, BaseTeriRange, BaseSenseType1, BaseSenseType2, BaseSenseRange1, BaseSenseRange2 \n");
|
std::string("FateLayoutLabelId, NormalAI, ServerPathId, EquipmentID, CustomizeID \n");
|
||||||
|
|
||||||
discoverySql.write( data.c_str(), data.size() );
|
discoverySql.write( data.c_str(), data.size() );
|
||||||
|
|
||||||
|
|
75
src/world/Action/EventItemAction.cpp
Normal file
75
src/world/Action/EventItemAction.cpp
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#include "ItemAction.h"
|
||||||
|
|
||||||
|
#include <Exd/ExdData.h>
|
||||||
|
#include <Exd/Structs.h>
|
||||||
|
|
||||||
|
#include <Actor/Player.h>
|
||||||
|
#include <Network/PacketWrappers/EffectPacket.h>
|
||||||
|
|
||||||
|
#include "Manager/PlayerMgr.h"
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
using namespace Sapphire::World::Action;
|
||||||
|
using namespace Sapphire::Network::Packets::WorldPackets::Server;
|
||||||
|
|
||||||
|
ItemAction::ItemAction( Sapphire::Entity::CharaPtr source, uint32_t itemId,
|
||||||
|
std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel::ItemAction > > itemActionData, uint16_t itemSourceSlot,
|
||||||
|
uint16_t itemSourceContainer ) :
|
||||||
|
m_itemAction( std::move( itemActionData ) ),
|
||||||
|
m_itemSourceSlot( itemSourceSlot ),
|
||||||
|
m_itemSourceContainer( itemSourceContainer )
|
||||||
|
{
|
||||||
|
m_id = itemId;
|
||||||
|
m_pSource = std::move( source );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ItemAction::start()
|
||||||
|
{
|
||||||
|
if( !m_pSource->isPlayer() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// todo: check inv slot for item
|
||||||
|
|
||||||
|
// todo: can we just do this?
|
||||||
|
execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ItemAction::execute()
|
||||||
|
{
|
||||||
|
switch( m_itemAction->data().Action )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Manager::PlayerMgr::sendDebug( *getSourceChara()->getAsPlayer(), "ItemAction type {0} not supported.", m_itemAction->data().Action );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Common::ItemActionType::ItemActionVFX:
|
||||||
|
case Common::ItemActionType::ItemActionVFX2:
|
||||||
|
{
|
||||||
|
handleVFXItem();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ItemAction::interrupt()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ItemAction::handleVFXItem()
|
||||||
|
{
|
||||||
|
Common::CalcResultParam effect{};
|
||||||
|
effect.Type = Common::ActionEffectType::CALC_RESULT_TYPE_CHECK_BARRIER;
|
||||||
|
effect.Value = m_itemAction->data().Calcu0Arg[ 0 ];
|
||||||
|
|
||||||
|
auto effectPacket = std::make_shared< EffectPacket >( getSourceChara()->getId(), getSourceChara()->getId(), getId() );
|
||||||
|
effectPacket->setTargetActor( getSourceChara()->getId() );
|
||||||
|
effectPacket->setAnimationId( Common::ItemActionType::ItemActionVFX );
|
||||||
|
effectPacket->setDisplayType( Common::ActionEffectDisplayType::ShowItemName );
|
||||||
|
effectPacket->addEffect( effect, static_cast< uint64_t >( getSourceChara()->getId() ) );
|
||||||
|
|
||||||
|
m_pSource->sendToInRangeSet( effectPacket, true );
|
||||||
|
}
|
36
src/world/Action/EventItemAction.h
Normal file
36
src/world/Action/EventItemAction.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Action.h"
|
||||||
|
#include <Exd/Structs.h>
|
||||||
|
|
||||||
|
namespace Sapphire::Data
|
||||||
|
{
|
||||||
|
struct ItemAction;
|
||||||
|
using ItemActionPtr = std::shared_ptr< ItemAction >;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Sapphire::World::Action
|
||||||
|
{
|
||||||
|
class ItemAction : public Action
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ItemAction( Entity::CharaPtr source, uint32_t itemId, std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel::ItemAction > > itemActionData,
|
||||||
|
uint16_t itemSourceSlot, uint16_t itemSourceContainer );
|
||||||
|
virtual ~ItemAction() = default;
|
||||||
|
|
||||||
|
void start() override;
|
||||||
|
|
||||||
|
void execute() override;
|
||||||
|
|
||||||
|
void interrupt() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void handleVFXItem();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel::ItemAction > > m_itemAction;
|
||||||
|
|
||||||
|
uint16_t m_itemSourceSlot;
|
||||||
|
uint16_t m_itemSourceContainer;
|
||||||
|
};
|
||||||
|
}
|
|
@ -959,16 +959,21 @@ bool Sapphire::Territory::loadBNpcs()
|
||||||
bnpc->EquipmentID = res->getInt( 43 );
|
bnpc->EquipmentID = res->getInt( 43 );
|
||||||
bnpc->CustomizeID = res->getInt( 44 );
|
bnpc->CustomizeID = res->getInt( 44 );
|
||||||
bnpc->rotation = res->getFloat( 45 );
|
bnpc->rotation = res->getFloat( 45 );
|
||||||
|
bnpc->Nonpop = res->getInt( 46 );
|
||||||
|
|
||||||
m_bNpcBaseMap[ bnpc->instanceId ] = bnpc;
|
m_bNpcBaseMap[ bnpc->instanceId ] = bnpc;
|
||||||
|
|
||||||
SpawnInfo info;
|
if( bnpc->Nonpop != 1 )
|
||||||
info.bnpcPtr = nullptr;
|
{
|
||||||
info.infoPtr = bnpc;
|
SpawnInfo info;
|
||||||
info.lastSpawn = 0;
|
info.bnpcPtr = nullptr;
|
||||||
info.timeOfDeath = 0;
|
info.infoPtr = bnpc;
|
||||||
|
info.lastSpawn = 0;
|
||||||
|
info.timeOfDeath = 0;
|
||||||
|
|
||||||
|
m_spawnInfo.emplace_back( info );
|
||||||
|
}
|
||||||
|
|
||||||
m_spawnInfo.emplace_back( info );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue