mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-03 17:27:47 +00:00
add SayEventHandler
This commit is contained in:
parent
94653a6739
commit
1b4dcd2786
9 changed files with 56 additions and 0 deletions
|
@ -410,6 +410,7 @@ enum ClientZoneIpcType :
|
|||
BuildPresetHandler = 0x0D9, // updated 6.58 hotfix 2
|
||||
|
||||
TalkEventHandler = 0x23A, // updated 6.58 hotfix 2
|
||||
SayEventHandler = 0x25D, // updated 6.58 hotfix 2
|
||||
EmoteEventHandler = 0x1B5, // updated 6.58 hotfix 2
|
||||
WithinRangeEventHandler = 0x38E, // updated 6.58 hotfix 2
|
||||
OutOfRangeEventHandler = 0x200, // updated 6.58 hotfix 2
|
||||
|
|
|
@ -160,6 +160,13 @@ struct FFXIVIpcEventHandlerTalk :
|
|||
/* 0008 */ uint32_t eventId;
|
||||
};
|
||||
|
||||
struct FFXIVIpcEventHandlerSay :
|
||||
FFXIVIpcBasePacket< SayEventHandler >
|
||||
{
|
||||
/* 0000 */ uint64_t actorId;
|
||||
/* 0008 */ uint32_t eventId;
|
||||
};
|
||||
|
||||
struct FFXIVIpcPingHandler :
|
||||
FFXIVIpcBasePacket< PingHandler >
|
||||
{
|
||||
|
|
|
@ -96,6 +96,7 @@ Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pH
|
|||
setZoneHandler( ClientZoneIpcType::HousingEditInterior, "HousingEditInterior", &GameConnection::housingEditInterior );
|
||||
|
||||
setZoneHandler( ClientZoneIpcType::TalkEventHandler, "EventHandlerTalk", &GameConnection::eventHandlerTalk );
|
||||
setZoneHandler( ClientZoneIpcType::SayEventHandler, "EventHandlerSay", &GameConnection::eventHandlerSay );
|
||||
setZoneHandler( ClientZoneIpcType::EmoteEventHandler, "EventHandlerEmote", &GameConnection::eventHandlerEmote );
|
||||
setZoneHandler( ClientZoneIpcType::WithinRangeEventHandler, "EventHandlerWithinRange",
|
||||
&GameConnection::eventHandlerWithinRange );
|
||||
|
|
|
@ -133,6 +133,8 @@ namespace Sapphire::Network
|
|||
|
||||
DECLARE_HANDLER( eventHandlerTalk );
|
||||
|
||||
DECLARE_HANDLER( eventHandlerSay );
|
||||
|
||||
DECLARE_HANDLER( eventHandlerEmote );
|
||||
|
||||
DECLARE_HANDLER( eventHandlerWithinRange );
|
||||
|
|
|
@ -80,6 +80,32 @@ void Sapphire::Network::GameConnection::eventHandlerTalk( const Packets::FFXIVAR
|
|||
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::eventHandlerSay( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||
{
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||
auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
|
||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerSay >( inPacket );
|
||||
|
||||
const auto actorId = packet.data().actorId;
|
||||
const auto eventId = packet.data().eventId;
|
||||
|
||||
std::string eventName = "onSay";
|
||||
std::string objName = eventMgr.getEventName( eventId );
|
||||
|
||||
player.sendDebug( "Chara: {0} -> {1} \neventId: {2} ({3:08X})", actorId,
|
||||
eventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ), eventId, eventId );
|
||||
|
||||
player.sendDebug( "Calling: {0}.{1}", objName, eventName );
|
||||
|
||||
player.eventStart( actorId, eventId, Event::EventHandler::Say, 0, 0 );
|
||||
|
||||
scriptMgr.onSay( player, actorId, eventId );
|
||||
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::eventHandlerEmote( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||
Entity::Player& player )
|
||||
{
|
||||
|
|
|
@ -99,6 +99,10 @@ namespace Sapphire::ScriptAPI
|
|||
{
|
||||
}
|
||||
|
||||
void EventScript::onSay( uint32_t eventId, Entity::Player& player, uint64_t actorId )
|
||||
{
|
||||
}
|
||||
|
||||
void EventScript::onBNpcKill( uint32_t nameId, Entity::Player& player )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -150,6 +150,8 @@ namespace Sapphire::ScriptAPI
|
|||
|
||||
virtual void onTalk( uint32_t eventId, Sapphire::Entity::Player& player, uint64_t actorId );
|
||||
|
||||
virtual void onSay( uint32_t eventId, Sapphire::Entity::Player& player, uint64_t actorId );
|
||||
|
||||
virtual void onBNpcKill( uint32_t nameId, Sapphire::Entity::Player& player );
|
||||
|
||||
virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Sapphire::Entity::Player& player );
|
||||
|
|
|
@ -192,6 +192,17 @@ bool Sapphire::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t ac
|
|||
}
|
||||
}
|
||||
|
||||
bool Sapphire::Scripting::ScriptMgr::onSay( Entity::Player& player, uint64_t actorId, uint32_t eventId )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||
if( script )
|
||||
{
|
||||
script->onSay( eventId, player, actorId );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Sapphire::Scripting::ScriptMgr::onEnterTerritory( Entity::Player& player, uint32_t eventId,
|
||||
uint16_t param1, uint16_t param2 )
|
||||
{
|
||||
|
|
|
@ -56,6 +56,8 @@ namespace Sapphire::Scripting
|
|||
|
||||
bool onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId );
|
||||
|
||||
bool onSay( 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 );
|
||||
|
|
Loading…
Add table
Reference in a new issue