Skip to content

Commit

Permalink
Fixed battleTalk
Browse files Browse the repository at this point in the history
  • Loading branch information
SapphireMordred committed Jan 7, 2025
1 parent beeae1b commit 0f982a4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
12 changes: 6 additions & 6 deletions data/EncounterTimelines/IfritNormal.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@
},
{
"data": {
"battleTalkId": 2939,
"battleTalkId": 2601,
"handlerActorName": "Ifrit",
"kind": 1,
"nameId": 2961,
"kind": 2,
"nameId": 1185,
"params": [
0
],
Expand Down Expand Up @@ -219,10 +219,10 @@
"timepoints": [
{
"data": {
"battleTalkId": 2939,
"battleTalkId": 2602,
"handlerActorName": "Ifrit",
"kind": 1,
"nameId": 2961,
"kind": 2,
"nameId": 1185,
"params": [
0
],
Expand Down
1 change: 1 addition & 0 deletions src/common/Network/PacketDef/Zone/ServerZoneDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,7 @@ namespace Sapphire::Network::Packets::WorldPackets::Server
struct FFXIVIpcBattleTalkN
{
uint32_t handlerId;
uint32_t padding;
uint64_t talkerId;
uint8_t kind;
uint8_t __padding1;
Expand Down
13 changes: 12 additions & 1 deletion src/world/Encounter/Timepoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,23 @@ namespace Sapphire::Encounter

// todo: use Actrl EventBattleDialog = 0x39C maybe?,
auto& playerMgr = Common::Service< Sapphire::World::Manager::PlayerMgr >::ref();

// todo: this does not always need to be a director, and can also be an eventhandler
// needs further investigation
Event::DirectorPtr pDirector = pTeri->getAsInstanceContent();
if( pDirector == nullptr )
pDirector = pTeri->getAsQuestBattle();

if( pDirector )
handlerId = pDirector->getDirectorId();

for( auto& player : pTeri->getPlayers() )
{

auto& pPlayer = player.second;
if( pPlayer )
playerMgr.sendBattleTalk( *pPlayer.get(), pBtData->m_battleTalkId, handlerId,
pBtData->m_kind, pBtData->m_nameId, talkerId,
pBtData->m_kind, pBtData->m_nameId, talkerId, m_duration,
params[ 0 ], params[ 1 ], params[ 2 ], params[ 3 ],
params[ 4 ], params[ 5 ], params[ 6 ], params[ 7 ] );
}
Expand Down
4 changes: 2 additions & 2 deletions src/world/Manager/PlayerMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,11 @@ void PlayerMgr::sendLogMessage( Entity::Player& player, uint32_t messageId, uint
}

void PlayerMgr::sendBattleTalk( Sapphire::Entity::Player& player, uint32_t battleTalkId, uint32_t handlerId,
uint32_t kind, uint32_t nameId, uint32_t talkerId,
uint32_t kind, uint32_t nameId, uint32_t talkerId, uint32_t time,
uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4,
uint32_t param5, uint32_t param6, uint32_t param7, uint32_t param8 )
{
Network::Util::Packet::sendBattleTalk( player, battleTalkId, handlerId, kind, nameId, talkerId,
Network::Util::Packet::sendBattleTalk( player, battleTalkId, handlerId, kind, nameId, talkerId, time,
param1, param2, param3, param4, param5, param6, param7, param8 );
}

Expand Down
2 changes: 1 addition & 1 deletion src/world/Manager/PlayerMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace Sapphire::World::Manager
uint32_t param4 = 0, uint32_t param5 = 0, uint32_t param6 = 0 );

static void sendBattleTalk( Sapphire::Entity::Player& player, uint32_t battleTalkId, uint32_t handlerId, uint32_t kind,
uint32_t nameId, uint32_t talkerId,
uint32_t nameId, uint32_t talkerId, uint32_t time,
uint32_t param1 = 0, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0,
uint32_t param5 = 0, uint32_t param6 = 0, uint32_t param7 = 0, uint32_t param8 = 0 );

Expand Down
3 changes: 2 additions & 1 deletion src/world/Network/Util/PacketUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void Util::Packet::sendActorControlTarget( const std::set< uint64_t >& character
}

void Sapphire::Network::Util::Packet::sendBattleTalk( Sapphire::Entity::Player& player, uint32_t battleTalkId, uint32_t handlerId,
uint32_t kind, uint32_t nameId, uint32_t talkerId,
uint32_t kind, uint32_t nameId, uint32_t talkerId, uint32_t time,
uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4,
uint32_t param5, uint32_t param6, uint32_t param7, uint32_t param8 )
{
Expand All @@ -179,6 +179,7 @@ void Sapphire::Network::Util::Packet::sendBattleTalk( Sapphire::Entity::Player&
data.nameId = nameId;
data.kind = kind;
data.talkerId = talkerId;
data.time = time;

data.args[ 0 ] = param1;
data.args[ 1 ] = param2;
Expand Down
2 changes: 1 addition & 1 deletion src/world/Network/Util/PacketUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace Sapphire::Network::Util::Packet
uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, uint32_t param5 = 0, uint32_t param6 = 0 );

void sendBattleTalk( Sapphire::Entity::Player& player, uint32_t battleTalkId, uint32_t handlerId,
uint32_t kind, uint32_t nameId, uint32_t talkerId,
uint32_t kind, uint32_t nameId, uint32_t talkerId, uint32_t time,
uint32_t param1 = 0, uint32_t param2= 0, uint32_t param3 = 0, uint32_t param4 = 0,
uint32_t param5 = 0, uint32_t param6= 0, uint32_t param7 = 0, uint32_t param8 = 0 );
}

0 comments on commit 0f982a4

Please sign in to comment.