1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-25 11:07:45 +00:00

enter dwarf house

This commit is contained in:
collett 2020-05-05 00:36:27 +09:00
parent 1d2945542b
commit 7e09643b20
9 changed files with 91 additions and 5 deletions

View file

@ -395,6 +395,8 @@ namespace Sapphire::Network::ActorControl
RequestEventBattle = 0x232C,
Trigger612 = 0x264,
QuestJournalUpdateQuestVisibility = 0x2BE,
QuestJournalClosed = 0x2BF,

View file

@ -376,6 +376,7 @@ namespace Sapphire::Network::Packets
PerformNoteHandler = 0x029B, // updated 4.3
MapInteractionHandler = 0x0285, // updated 5.25
};
////////////////////////////////////////////////////////////////////////////////

View file

@ -344,6 +344,16 @@ struct FFXIVIpcFreeCompanyUpdateShortMessageHandler :
uint16_t unknown2;
};
struct FFXIVIpcMapInteractionHandler :
FFXIVIpcBasePacket< MapInteractionHandler >
{
uint32_t action;
uint32_t unknown2;
uint64_t unknown3;
uint32_t unknown4;
Common::FFXIVARR_POSITION3 position;
};
}
#endif //_CORE_NETWORK_PACKETS_ZONE_CLIENT_IPC_H

View file

@ -535,20 +535,30 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
sendStatusEffectUpdate(); // although client buff displays correctly without this but retail sends it so we do it as well
}
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param )
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param, bool sendActorControl )
{
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000 );
effect->setParam( param );
if( sendActorControl )
{
auto p = makeActorControl( getId(), Network::ActorControl::StatusEffectGain, id, 0, 0, 0 );
sendToInRangeSet( p, true );
}
addStatusEffect( effect );
}
void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param )
void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param, bool sendActorControl )
{
if( getStatusEffectById( id ).second )
return;
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000 );
effect->setParam( param );
if( sendActorControl )
{
auto p = makeActorControl( getId(), Network::ActorControl::StatusEffectGain, id, 0, 0, 0 );
sendToInRangeSet( p, true );
}
addStatusEffect( effect );
}

View file

@ -174,10 +174,10 @@ namespace Sapphire::Entity
const uint32_t* getModelArray() const;
// add a status effect by id
void addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 );
void addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0, bool sendActorControl = false );
// add a status effect by id if it doesn't exist
void addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 );
void addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0, bool sendActorControl = false );
/// End Status Effect Functions

View file

@ -130,6 +130,8 @@ Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pH
setZoneHandler( ClientZoneIpcType::MarketBoardRequestItemListings, "MarketBoardRequestItemListings",
&GameConnection::marketBoardRequestItemListings );
setZoneHandler( ClientZoneIpcType::MapInteractionHandler, "MapInteractionHandler", &GameConnection::eventHandlerMapInteraction );
setChatHandler( ClientChatIpcType::TellReq, "TellReq", &GameConnection::tellHandler );
}

View file

@ -143,6 +143,8 @@ namespace Sapphire::Network
DECLARE_HANDLER( eventHandlerShop );
DECLARE_HANDLER( eventHandlerMapInteraction );
DECLARE_HANDLER( eventHandlerLinkshell );
DECLARE_HANDLER( logoutHandler );

View file

@ -489,7 +489,11 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
player.sendDebug( "event battle level sync: {0}, ilevel sync?: {1}", param12, param2 );
break;
}
case ClientTriggerType::Trigger612:
{
player.sendStateFlags();
break;
}
default:
{
Logger::debug( "[{0}] Unhandled action: {1:04X}", m_pSession->getId(), commandId );

View file

@ -8,6 +8,9 @@
#include <Network/PacketDef/Zone/ClientZoneDef.h>
#include "Network/GameConnection.h"
#include <Network/CommonActorControl.h>
#include "Network/PacketWrappers/ActorControlPacket.h"
#include "Network/PacketWrappers/ActorControlSelfPacket.h"
#include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/EventStartPacket.h"
#include "Network/PacketWrappers/EventFinishPacket.h"
@ -273,5 +276,57 @@ void Sapphire::Network::GameConnection::eventHandlerShop( const Packets::FFXIVAR
scriptMgr.onTalk( player, player.getId(), eventId );
}
void Sapphire::Network::GameConnection::eventHandlerMapInteraction( const Packets::FFXIVARR_PACKET_RAW& inPacket,
Entity::Player& player )
{
const auto packet = ZoneChannelPacket< Client::FFXIVIpcMapInteractionHandler >( inPacket );
if( packet.data().action == 0xD4 && player.getRace() == 3 ) // enter dwarf house lalafell only of course
{
// looks like shit but IT WORKS.
auto x = packet.data().position.x;
auto z = packet.data().position.z;
if( x < -448 && x > -453 )
{
// west
if( x > -451 )
{
// enter
auto p = makeActorControl( player.getId(), 242, 1174189454, 817758208, 67, 0 );
queueOutPacket( p );
player.addStatusEffectById( 1945, 0, player, 0, true );
}
else
{
// exit
auto p = makeActorControl( player.getId(), 242, 1182315916, 827392000, 68, 0 );
queueOutPacket( p );
player.removeSingleStatusEffectById( 1945 );
}
}
else if ( x > 637 && x < 641 )
{
// east
if( z > -188 )
{
// enter
auto p = makeActorControl( player.getId(), 242, 3521816124, 1737687040, 69, 0 );
queueOutPacket( p );
player.addStatusEffectById( 1945, 0, player, 0, true );
}
else
{
// exit
auto p = makeActorControl( player.getId(), 242, 3517228601, 1749483520, 70, 0 );
queueOutPacket( p );
player.removeSingleStatusEffectById( 1945 );
}
}
else
{
player.sendDebug( "Unknown dwarf house." );
}
}
}