mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
feat: spectate command
This commit is contained in:
parent
a54600b41e
commit
b56d077892
@ -6212,3 +6212,17 @@ 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);
|
||||||
|
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",
|
||||||
|
.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,12 @@ 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.length() <= 0) GameMessages::SendSlashCommandFeedbackText(entity, u"No player Given");
|
||||||
|
auto player = PlayerManager::GetPlayer(args);
|
||||||
|
if (!player) GameMessages::SendSlashCommandFeedbackText(entity, u"Player not found");
|
||||||
|
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