Skip to content

Commit

Permalink
fick director bgm;
Browse files Browse the repository at this point in the history
  • Loading branch information
hkAlice committed Jun 25, 2024
1 parent 75a2fcb commit cf2d610
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/world/Manager/DebugCommandMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ActorControlPacket.h"
#include "Network/PacketWrappers/ActorControlSelfPacket.h"
#include "Network/CommonActorControl.h"
#include "Network/PacketWrappers/MoveActorPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/PlayerSpawnPacket.h"
Expand Down Expand Up @@ -844,6 +845,7 @@ void DebugCommandMgr::script( char* data, Entity::Player& player, std::shared_pt

void DebugCommandMgr::instance( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto& server = Common::Service< World::WorldServer >::ref();
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );

Expand Down Expand Up @@ -1104,6 +1106,14 @@ void DebugCommandMgr::instance( char* data, Entity::Player& player, std::shared_
if( auto instance = pCurrentZone->getAsInstanceContent() )
instance->setCurrentBGM( bgmId );
}
else if( subCommand == "dir_update" ) {
uint32_t dirType;
uint32_t param;
sscanf( params.c_str(), "%x %d", &dirType, &param );
if( auto instance = pCurrentZone->getAsInstanceContent() )
server.queueForPlayer( player.getCharacterId(), makeActorControlSelf( player.getId(), Network::ActorControl::DirectorUpdate, instance->getDirectorId(),
dirType, param ) );
}
else
{
PlayerMgr::sendDebug( player, "Unknown sub command." );
Expand Down
4 changes: 2 additions & 2 deletions src/world/Territory/InstanceContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,15 +661,15 @@ void Sapphire::InstanceContent::setCurrentBGM( uint16_t bgmIndex )
auto player = playerIt.second;
server.queueForPlayer( player->getCharacterId(),
makeActorControlSelf( player->getId(), DirectorUpdate, getDirectorId(),
DirectorEventId::BattleGroundMusic, bgmIndex ) );
DirectorEventId::BGM, bgmIndex ) );
}
}

void Sapphire::InstanceContent::setPlayerBGM( Sapphire::Entity::Player& player, uint16_t bgmId )
{
auto& server = Common::Service< World::WorldServer >::ref();
server.queueForPlayer( player.getCharacterId(), makeActorControlSelf( player.getId(), DirectorUpdate, getDirectorId(),
DirectorEventId::BattleGroundMusic, bgmId ) );
DirectorEventId::BGM, bgmId ) );
}

uint16_t Sapphire::InstanceContent::getCurrentBGM() const
Expand Down
11 changes: 10 additions & 1 deletion src/world/Territory/InstanceContent.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ namespace Sapphire
0x4000000E - INSTANCE_CONTENT_ORDER_SYSTEM_Unknown - no args - some timer set */
enum DirectorEventId : uint32_t
{
// 2.3
DEBUG_TimeSync = 0xC0000001,
DutyCommence = 0x40000001,
DutyComplete = 0x40000002,
SetStringendoMode = 0x40000003,
SetDutyTime = 0x40000004,
LoadingScreen = 0x40000005,
Forward = 0x40000006,
BattleGroundMusic = 0x40000007,
//BattleGroundMusic = 0x40000007,
InvalidateTodoList = 0x40000008,
VoteState = 0x40000009,
VoteStart = 0x4000000A,
Expand All @@ -53,6 +54,14 @@ namespace Sapphire
FirstTimeNotify = 0x4000000D,
TreasureVoteRefresh = 0x4000000E,
SetSharedGroupId = 0x4000000F,
// 3.3x onwards
Sync = 0x80000000,
BGM = 0x80000001,
SyncDutyTimer = 0x80000003,
// some vote stuff here
StartEventCutscene = 0x80000008,
EndEventCutscene = 0x80000009,
StartQTE = 0x8000000A
};

enum EventHandlerOrderId : uint32_t
Expand Down

0 comments on commit cf2d610

Please sign in to comment.