Add Hot Properties struct and address some whitespace (no functionality change) (#667)

* Add GameMessages

* General AMF cleanup

Proper memory management as well as style cleanup

* General AMF cleanup

Proper memory management as well as style cleanup

* General optimizations

Fix AMFArray so values are properly deleted when you leave the scope it was created in.
Add bounds check for deletion so you don't double delete.
Remove all AMFdeletions that are contained in an array since the array now manages its own memory and deletes it when it is no longer needed.

* Better tests and fix de-serialize

Fix de-serialize to be correct and implement a test to check this

* Update AMFDeserializeTests.cpp

* Update GameMessages.h

* Add GM

* Comment out function

* Spacing

* eof
This commit is contained in:
David Markowitz 2022-07-22 19:58:20 -07:00 committed by GitHub
parent 6a38b67ed5
commit ef0a3c6d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 547 additions and 467 deletions

View File

@ -243,6 +243,10 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
}*/ }*/
break; break;
} }
case GAME_MSG_HANDLE_HOT_PROPERTY_DATA: {
GameMessages::HandleGetHotPropertyData(inStream, entity, sysAddr);
break;
}
case GAME_MSG_REQUEST_SERVER_PROJECTILE_IMPACT: case GAME_MSG_REQUEST_SERVER_PROJECTILE_IMPACT:
{ {

View File

@ -5995,6 +5995,51 @@ void GameMessages::HandleMatchRequest(RakNet::BitStream* inStream, Entity* entit
} }
} }
void GameMessages::HandleGetHotPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
SendGetHotPropertyData(inStream, entity, sysAddr);
}
void GameMessages::SendGetHotPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
CBITSTREAM
CMSGHEADER
/**
* [u32] - Number of properties
* [objid] - property id
* [objid] - property owner id
* [wstring] - property owner name
* [u64] - total reputation
* [i32] - property template id
* [wstring] - property name
* [wstring] - property description
* [float] - performance cost
* [timestamp] - time last published
* [cloneid] - clone id
*
*/
// TODO This needs to be implemented when reputation is implemented for getting hot properties.
/**
bitStream.Write(entity->GetObjectID());
bitStream.Write(GAME_MSG::GAME_MSG_SEND_HOT_PROPERTY_DATA);
std::vector<int32_t> t = {25166, 25188, 25191, 25194};
bitStream.Write<uint32_t>(4);
for (uint8_t i = 0; i < 4; i++) {
bitStream.Write<LWOOBJID>(entity->GetObjectID());
bitStream.Write<LWOOBJID>(entity->GetObjectID());
bitStream.Write<uint32_t>(1);
bitStream.Write<uint16_t>('c');
bitStream.Write<uint64_t>(42069);
bitStream.Write<int32_t>(t[i]);
bitStream.Write<uint32_t>(1);
bitStream.Write<uint16_t>('c');
bitStream.Write<uint32_t>(1);
bitStream.Write<uint16_t>('c');
bitStream.Write<float>(420.69f);
bitStream.Write<uint64_t>(1658376385);
bitStream.Write<int32_t>(25166);
}
SEND_PACKET*/
}
void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity) { void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity) {
//Definitely not stolen from autogenerated code, no sir: //Definitely not stolen from autogenerated code, no sir:
std::u16string body; std::u16string body;

View File

@ -389,6 +389,38 @@ namespace GameMessages {
*/ */
void HandleAcknowledgePossession(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); void HandleAcknowledgePossession(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
/**
* @brief A request from a client to get the hot properties that would appear on the news feed
* This incoming message has NO DATA and is simply a request that expects to send a reply to the sender.
*
* @param inStream packet of data
* @param entity The Entity that sent the request
* @param sysAddr The SystemAddress of the Entity that sent the request
*/
void HandleGetHotPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
/**
* @brief A request from a client to get the hot properties that would appear on the news feed
* The struct of data to send is as follows
*
* [u32] - Number of properties
* [objid] - property id
* [objid] - property owner id
* [wstring] - property owner name
* [u64] - total reputation
* [i32] - property template id
* [wstring] - property name
* [wstring] - property description
* [float] - performance cost
* [timestamp] - time last published
* [cloneid] - clone id
*
* @param inStream packet of data
* @param entity The Entity that sent the request
* @param sysAddr The SystemAddress of the Entity that sent the request
*/
void SendGetHotPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
//Racing: //Racing:
void HandleModuleAssemblyQueryData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); void HandleModuleAssemblyQueryData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
@ -1078,7 +1110,4 @@ namespace GameMessages {
}; };
}; };
#endif // GAMEMESSAGES_H #endif // GAMEMESSAGES_H

View File

@ -532,6 +532,8 @@ enum GAME_MSG : unsigned short {
GAME_MSG_PLACE_PROPERTY_MODEL = 1170, GAME_MSG_PLACE_PROPERTY_MODEL = 1170,
GAME_MSG_VEHICLE_NOTIFY_HIT_IMAGINATION_SERVER = 1606, GAME_MSG_VEHICLE_NOTIFY_HIT_IMAGINATION_SERVER = 1606,
GAME_MSG_ADD_RUN_SPEED_MODIFIER = 1505, GAME_MSG_ADD_RUN_SPEED_MODIFIER = 1505,
GAME_MSG_HANDLE_HOT_PROPERTY_DATA = 1511,
GAME_MSG_SEND_HOT_PROPERTY_DATA = 1510,
GAME_MSG_REMOVE_RUN_SPEED_MODIFIER = 1506, GAME_MSG_REMOVE_RUN_SPEED_MODIFIER = 1506,
GAME_MSG_UPDATE_PROPERTY_PERFORMANCE_COST = 1547, GAME_MSG_UPDATE_PROPERTY_PERFORMANCE_COST = 1547,
GAME_MSG_PROPERTY_ENTRANCE_BEGIN = 1553, GAME_MSG_PROPERTY_ENTRANCE_BEGIN = 1553,