mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
Merge pull request #1608 from DarkflameUniverse/feat--spectate-command
feat: spectate command
This commit is contained in:
commit
af651f0d63
@ -6212,3 +6212,18 @@ void GameMessages::SendSlashCommandFeedbackText(Entity* entity, std::u16string t
|
|||||||
auto sysAddr = entity->GetSystemAddress();
|
auto sysAddr = entity->GetSystemAddress();
|
||||||
SEND_PACKET;
|
SEND_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameMessages::SendForceCameraTargetCycle(Entity* entity, bool bForceCycling, eCameraTargetCyclingMode cyclingMode, LWOOBJID optionalTargetID) {
|
||||||
|
CBITSTREAM;
|
||||||
|
CMSGHEADER;
|
||||||
|
|
||||||
|
bitStream.Write(entity->GetObjectID());
|
||||||
|
bitStream.Write(eGameMessageType::FORCE_CAMERA_TARGET_CYCLE);
|
||||||
|
bitStream.Write(bForceCycling);
|
||||||
|
bitStream.Write(cyclingMode != eCameraTargetCyclingMode::ALLOW_CYCLE_TEAMMATES);
|
||||||
|
if (cyclingMode != eCameraTargetCyclingMode::ALLOW_CYCLE_TEAMMATES) bitStream.Write(cyclingMode);
|
||||||
|
bitStream.Write(optionalTargetID);
|
||||||
|
|
||||||
|
auto sysAddr = entity->GetSystemAddress();
|
||||||
|
SEND_PACKET;
|
||||||
|
}
|
||||||
|
@ -40,6 +40,11 @@ enum class eQuickBuildState : uint32_t;
|
|||||||
enum class BehaviorSlot : int32_t;
|
enum class BehaviorSlot : int32_t;
|
||||||
enum class eVendorTransactionResult : uint32_t;
|
enum class eVendorTransactionResult : uint32_t;
|
||||||
|
|
||||||
|
enum class eCameraTargetCyclingMode : int32_t {
|
||||||
|
ALLOW_CYCLE_TEAMMATES,
|
||||||
|
DISALLOW_CYCLING
|
||||||
|
};
|
||||||
|
|
||||||
namespace GameMessages {
|
namespace GameMessages {
|
||||||
class PropertyDataMessage;
|
class PropertyDataMessage;
|
||||||
void SendFireEventClientSide(const LWOOBJID& objectID, const SystemAddress& sysAddr, std::u16string args, const LWOOBJID& object, int64_t param1, int param2, const LWOOBJID& sender);
|
void SendFireEventClientSide(const LWOOBJID& objectID, const SystemAddress& sysAddr, std::u16string args, const LWOOBJID& object, int64_t param1, int param2, const LWOOBJID& sender);
|
||||||
@ -666,6 +671,7 @@ namespace GameMessages {
|
|||||||
void HandleCancelDonationOnPlayer(RakNet::BitStream& inStream, Entity* entity);
|
void HandleCancelDonationOnPlayer(RakNet::BitStream& inStream, Entity* entity);
|
||||||
|
|
||||||
void SendSlashCommandFeedbackText(Entity* entity, std::u16string text);
|
void SendSlashCommandFeedbackText(Entity* entity, std::u16string text);
|
||||||
|
void SendForceCameraTargetCycle(Entity* entity, bool bForceCycling, eCameraTargetCyclingMode cyclingMode, LWOOBJID optionalTargetID);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GAMEMESSAGES_H
|
#endif // GAMEMESSAGES_H
|
||||||
|
@ -929,6 +929,15 @@ void SlashCommandHandler::Startup() {
|
|||||||
};
|
};
|
||||||
RegisterCommand(FindPlayerCommand);
|
RegisterCommand(FindPlayerCommand);
|
||||||
|
|
||||||
|
Command SpectateCommand{
|
||||||
|
.help = "Spectate a player",
|
||||||
|
.info = "Specify a player name to spectate. They must be in the same world as you. Leave blank to stop spectating",
|
||||||
|
.aliases = { "spectate", "follow" },
|
||||||
|
.handle = GMGreaterThanZeroCommands::Spectate,
|
||||||
|
.requiredLevel = eGameMasterLevel::JUNIOR_MODERATOR
|
||||||
|
};
|
||||||
|
RegisterCommand(SpectateCommand);
|
||||||
|
|
||||||
// Register GM Zero Commands
|
// Register GM Zero Commands
|
||||||
|
|
||||||
Command HelpCommand{
|
Command HelpCommand{
|
||||||
|
@ -322,4 +322,19 @@ namespace GMGreaterThanZeroCommands {
|
|||||||
request.Serialize(bitStream);
|
request.Serialize(bitStream);
|
||||||
Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false);
|
Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Spectate(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||||
|
if (args.empty()) {
|
||||||
|
GameMessages::SendForceCameraTargetCycle(entity, false, eCameraTargetCyclingMode::DISALLOW_CYCLING, entity->GetObjectID());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto player = PlayerManager::GetPlayer(args);
|
||||||
|
if (!player) {
|
||||||
|
GameMessages::SendSlashCommandFeedbackText(entity, u"Player not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GameMessages::SendSlashCommandFeedbackText(entity, u"Spectating Player");
|
||||||
|
GameMessages::SendForceCameraTargetCycle(entity, false, eCameraTargetCyclingMode::DISALLOW_CYCLING, player->GetObjectID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ namespace GMGreaterThanZeroCommands {
|
|||||||
void Title(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void Title(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void ShowAll(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void ShowAll(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
void FindPlayer(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
void FindPlayer(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
|
void Spectate(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!GMGREATERTHANZEROCOMMANDS_H
|
#endif //!GMGREATERTHANZEROCOMMANDS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user