WIP, but working

This commit is contained in:
Aaron Kimbre 2024-03-25 07:10:22 -05:00
parent 2b253a8248
commit a7b84f3170
6 changed files with 1960 additions and 1840 deletions

View File

@ -790,9 +790,10 @@ enum class eGameMessageType : uint16_t {
GET_MISSION_TYPE_STATES = 853,
GET_TIME_PLAYED = 854,
SET_MISSION_VIEWED = 855,
SLASH_COMMAND_TEXT_FEEDBACK = 856,
HANDLE_SLASH_COMMAND_KORE_DEBUGGER = 857,
HKX_VEHICLE_LOADED = 856,
SLASH_COMMAND_TEXT_FEEDBACK = 857,
BROADCAST_TEXT_TO_CHATBOX = 858,
HANDLE_SLASH_COMMAND_KORE_DEBUGGER = 859,
OPEN_PROPERTY_MANAGEMENT = 860,
OPEN_PROPERTY_VENDOR = 861,
VOTE_ON_PROPERTY = 862,

View File

@ -6203,3 +6203,15 @@ void GameMessages::HandleCancelDonationOnPlayer(RakNet::BitStream& inStream, Ent
if (!characterComponent) return;
characterComponent->SetCurrentInteracting(LWOOBJID_EMPTY);
}
void GameMessages::SendSlashCommandFeedbackText(Entity* entity, std::u16string text) {
CBITSTREAM;
CMSGHEADER;
bitStream.Write(entity->GetObjectID());
bitStream.Write(eGameMessageType::SLASH_COMMAND_TEXT_FEEDBACK);
bitStream.Write<uint32_t>(text.size());
bitStream.Write(text);
auto sysAddr = entity->GetSystemAddress();
SEND_PACKET;
}

View File

@ -664,6 +664,8 @@ namespace GameMessages {
void HandleRemoveDonationItem(RakNet::BitStream& inStream, Entity* entity, const SystemAddress& sysAddr);
void HandleConfirmDonationOnPlayer(RakNet::BitStream& inStream, Entity* entity);
void HandleCancelDonationOnPlayer(RakNet::BitStream& inStream, Entity* entity);
void SendSlashCommandFeedbackText(Entity* entity, std::u16string text);
};
#endif // GAMEMESSAGES_H

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,37 @@
#define SLASHCOMMANDHANDLER_H
#include "RakNetTypes.h"
#include "eGameMasterLevel.h"
#include <string>
class Entity;
namespace SlashCommandHandler {
void HandleChatCommand(const std::u16string& command, Entity* entity, const SystemAddress& sysAddr);
void SendAnnouncement(const std::string& title, const std::string& message);
struct Command {
std::string description = "Default Command Description";
std::string help = "Default Command Help Text";
eGameMasterLevel requiredLevel = eGameMasterLevel::DEVELOPER;
std::function<void(Entity*,const std::string)> handle;
};
namespace SlashCommandHandler {
void Startup();
void HandleChatCommand(const std::u16string& command, Entity* entity, const SystemAddress& sysAddr);
void SendAnnouncement(const std::string& title, const std::string& message);
void RegisterCommand(Command info, std::string command);
};
namespace DEVGMCommands {
void SetGMLevel(Entity* entity, const std::string args);
void ToggleNameplate(Entity* entity, const std::string args);
void ToggleSkipCinematics(Entity* entity, const std::string args);
}
namespace GMZeroCommands {
void Help(Entity* entity, const std::string args);
}
namespace GreaterThanZeroCommands {
}
#endif // SLASHCOMMANDHANDLER_H

View File

@ -79,6 +79,7 @@
#include "PositionUpdate.h"
#include "PlayerManager.h"
#include "eLoginResponse.h"
#include "SlashCommandHandler.h"
namespace Game {
Logger* logger = nullptr;
@ -313,6 +314,9 @@ int main(int argc, char** argv) {
uint32_t sqlPingTime = 10 * 60 * currentFramerate; // 10 minutes in frames
uint32_t emptyShutdownTime = (cloneID == 0 ? 30 : 5) * 60 * currentFramerate; // 30 minutes for main worlds, 5 for all others.
// Register slash commands
SlashCommandHandler::Startup();
Game::logger->Flush(); // once immediately before the main loop
while (true) {
Metrics::StartMeasurement(MetricVariable::Frame);