Add Unimplemented GameMessages (#662)

This commit is contained in:
David Markowitz 2022-07-20 01:28:57 -07:00 committed by GitHub
parent 74bca38253
commit 45a7dbdadd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 0 deletions

View File

@ -535,6 +535,10 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
GameMessages::HandleBBBSaveRequest(inStream, entity, sysAddr); GameMessages::HandleBBBSaveRequest(inStream, entity, sysAddr);
break; break;
case GAME_MSG_CONTROL_BEHAVIOR:
GameMessages::HandleControlBehaviors(inStream, entity, sysAddr);
break;
case GAME_MSG_PROPERTY_ENTRANCE_SYNC: case GAME_MSG_PROPERTY_ENTRANCE_SYNC:
GameMessages::HandlePropertyEntranceSync(inStream, entity, sysAddr); GameMessages::HandlePropertyEntranceSync(inStream, entity, sysAddr);
break; break;

View File

@ -2420,6 +2420,42 @@ void GameMessages::HandleBBBLoadItemRequest(RakNet::BitStream* inStream, Entity*
SEND_PACKET; SEND_PACKET;
} }
void GameMessages::SendSmash(Entity* entity, float force, float ghostOpacity, LWOOBJID killerID, bool ignoreObjectVisibility) {
CBITSTREAM
CMSGHEADER
bitStream.Write(entity->GetObjectID());
bitStream.Write(GAME_MSG::GAME_MSG_SMASH);
bitStream.Write(ignoreObjectVisibility);
bitStream.Write(force);
bitStream.Write(ghostOpacity);
bitStream.Write(killerID);
SEND_PACKET_BROADCAST
}
void GameMessages::SendUnSmash(Entity* entity, LWOOBJID builderID, float duration) {
CBITSTREAM
CMSGHEADER
bitStream.Write(entity->GetObjectID());
bitStream.Write(GAME_MSG::GAME_MSG_UNSMASH);
bitStream.Write(builderID != LWOOBJID_EMPTY);
if (builderID != LWOOBJID_EMPTY) bitStream.Write(builderID);
bitStream.Write(duration != 3.0f);
if (duration != 3.0f) bitStream.Write(duration);
SEND_PACKET_BROADCAST
}
void GameMessages::HandleControlBehaviors(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
// TODO
Game::logger->Log("GameMessages", "Recieved Control Behavior GameMessage, but property behaviors are unimplemented.\n");
}
void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
/* /*
___ ___ ___ ___

View File

@ -122,6 +122,39 @@ namespace GameMessages {
void SendStartCelebrationEffect(Entity* entity, const SystemAddress& sysAddr, int celebrationID); void SendStartCelebrationEffect(Entity* entity, const SystemAddress& sysAddr, int celebrationID);
/**
* Sends a message to an Entity to smash itself, but not delete or destroy itself from the world
*
* @param entity The Entity that will smash itself into bricks
* @param force The force the Entity will be smashed with
* @param ghostOpacity The ghosting opacity of the smashed Entity
* @param killerID The Entity that invoked the smash, if none exists, this should be LWOOBJID_EMPTY
* @param ignoreObjectVisibility Whether or not to ignore the objects visibility
*/
void SendSmash(Entity* entity, float force, float ghostOpacity, LWOOBJID killerID, bool ignoreObjectVisibility = false);
/**
* Sends a message to an Entity to UnSmash itself (aka rebuild itself over a duration)
*
* @param entity The Entity that will UnSmash itself
* @param builderID The Entity that invoked the build (LWOOBJID_EMPTY if none exists or invoked the rebuild)
* @param duration The duration for the Entity to rebuild over. 3 seconds by default
*/
void SendUnSmash(Entity* entity, LWOOBJID builderID = LWOOBJID_EMPTY, float duration = 3.0f);
/**
* @brief This GameMessage is the one that handles all of the property behavior incoming messages from the client.
*
* The GameMessage struct can be located here https://lcdruniverse.org/lu_packets/lu_packets/world/gm/server/struct.ControlBehaviors.html
* For information on the AMF3 format can be found here https://rtmp.veriskope.com/pdf/amf3-file-format-spec.pdf
* For any questions regarding AMF3 you can contact EmosewaMC on GitHub
*
* @param inStream The incoming data sent from the client
* @param entity The Entity that sent the message
* @param sysAddr The SystemAddress that sent the message
*/
void HandleControlBehaviors(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
// Rails stuff // Rails stuff
void SendSetRailMovement(const LWOOBJID& objectID, bool pathGoForward, std::u16string pathName, uint32_t pathStart, void SendSetRailMovement(const LWOOBJID& objectID, bool pathGoForward, std::u16string pathName, uint32_t pathStart,
const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS,

View File

@ -274,6 +274,7 @@ enum GAME_MSG : unsigned short {
GAME_MSG_REQUEST_DIE = 38, GAME_MSG_REQUEST_DIE = 38,
GAME_MSG_PLAY_EMOTE = 41, GAME_MSG_PLAY_EMOTE = 41,
GAME_MSG_PLAY_ANIMATION = 43, GAME_MSG_PLAY_ANIMATION = 43,
GAME_MSG_CONTROL_BEHAVIOR = 48,
GAME_MSG_SET_NAME = 72, GAME_MSG_SET_NAME = 72,
GAME_MSG_ECHO_START_SKILL = 118, GAME_MSG_ECHO_START_SKILL = 118,
GAME_MSG_START_SKILL = 119, GAME_MSG_START_SKILL = 119,
@ -345,6 +346,8 @@ enum GAME_MSG : unsigned short {
GAME_MSG_DISPLAY_MESSAGE_BOX = 529, GAME_MSG_DISPLAY_MESSAGE_BOX = 529,
GAME_MSG_MESSAGE_BOX_RESPOND = 530, GAME_MSG_MESSAGE_BOX_RESPOND = 530,
GAME_MSG_CHOICE_BOX_RESPOND = 531, GAME_MSG_CHOICE_BOX_RESPOND = 531,
GAME_MSG_SMASH = 537,
GAME_MSG_UNSMASH = 538,
GAME_MSG_SET_SHOOTING_GALLERY_RETICULE_EFFECT = 548, GAME_MSG_SET_SHOOTING_GALLERY_RETICULE_EFFECT = 548,
GAME_MSG_PLACE_MODEL_RESPONSE = 0x223, GAME_MSG_PLACE_MODEL_RESPONSE = 0x223,
GAME_MSG_SET_JET_PACK_MODE = 561, GAME_MSG_SET_JET_PACK_MODE = 561,