squashed commit

This commit is contained in:
jadebenn 2023-12-17 04:02:32 -06:00
parent a9ca0198b0
commit e4d423be5e
7 changed files with 54 additions and 49 deletions

View File

@ -1603,7 +1603,7 @@ BEGIN_ENUM_WITH_VALUES(eGameMessageType, uint16_t)
DECLARE_ENUM_ELEMENT_WITH_VALUE(UPDATE_FORGED_ITEM, 1768) DECLARE_ENUM_ELEMENT_WITH_VALUE(UPDATE_FORGED_ITEM, 1768)
DECLARE_ENUM_ELEMENT_WITH_VALUE(CAN_ITEMS_BE_REFORGED, 1769) DECLARE_ENUM_ELEMENT_WITH_VALUE(CAN_ITEMS_BE_REFORGED, 1769)
DECLARE_ENUM_ELEMENT_WITH_VALUE(NOTIFY_CLIENT_RAIL_START_FAILED, 1771) DECLARE_ENUM_ELEMENT_WITH_VALUE(NOTIFY_CLIENT_RAIL_START_FAILED, 1771)
DECLARE_ENUM_ELEMENT_WITH_VALUE(GET_IS_ON_RAIL, 177) DECLARE_ENUM_ELEMENT_WITH_VALUE(GET_IS_ON_RAIL, 1772)
END_ENUM_WITH_VALUES(eGameMessageType, uint16_t) END_ENUM_WITH_VALUES(eGameMessageType, uint16_t)
#endif //!__EGAMEMESSAGETYPE__H__ #endif //!__EGAMEMESSAGETYPE__H__

View File

@ -1,43 +1,47 @@
#ifndef __EWORLDMESSAGETYPE__H__ #if (!defined(__EWORLDMESSAGETYPE__H__) || defined(GENERATE_ENUM_STRINGS))
#define __EWORLDMESSAGETYPE__H__
#if (!defined(__EWORLDMESSAGETYPE__H__))
#define __EWORLDMESSAGETYPE__H__
#endif
#include <cstdint> #include <cstdint>
#include "StringifyEnums.h"
enum class eWorldMessageType : uint32_t { BEGIN_ENUM_WITH_VALUES(eWorldMessageType, uint32_t)
VALIDATION = 1, // Session info DECLARE_ENUM_ELEMENT_WITH_VALUE(VALIDATION, 1) // Session info
CHARACTER_LIST_REQUEST, DECLARE_ENUM_ELEMENT_WITH_VALUE(CHARACTER_LIST_REQUEST, 2)
CHARACTER_CREATE_REQUEST, DECLARE_ENUM_ELEMENT_WITH_VALUE(CHARACTER_CREATE_REQUEST, 3)
LOGIN_REQUEST, // Character selected DECLARE_ENUM_ELEMENT_WITH_VALUE(LOGIN_REQUEST, 4) // Character selected
GAME_MSG, DECLARE_ENUM_ELEMENT_WITH_VALUE(GAME_MSG, 5)
CHARACTER_DELETE_REQUEST, DECLARE_ENUM_ELEMENT_WITH_VALUE(CHARACTER_DELETE_REQUEST, 6)
CHARACTER_RENAME_REQUEST, DECLARE_ENUM_ELEMENT_WITH_VALUE(CHARACTER_RENAME_REQUEST, 7)
HAPPY_FLOWER_MODE_NOTIFY, DECLARE_ENUM_ELEMENT_WITH_VALUE(HAPPY_FLOWER_MODE_NOTIFY, 8)
SLASH_RELOAD_MAP, // Reload map cmp DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_RELOAD_MAP, 9) // Reload map cmp
SLASH_PUSH_MAP_REQUEST, // Push map req cmd DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_PUSH_MAP_REQUEST, 10) // Push map req cmd
SLASH_PUSH_MAP, // Push map cmd DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_PUSH_MAP, 11) // Push map cmd
SLASH_PULL_MAP, // Pull map cmd DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_PULL_MAP, 12) // Pull map cmd
LOCK_MAP_REQUEST, DECLARE_ENUM_ELEMENT_WITH_VALUE(LOCK_MAP_REQUEST, 13)
GENERAL_CHAT_MESSAGE, // General chat message DECLARE_ENUM_ELEMENT_WITH_VALUE(GENERAL_CHAT_MESSAGE, 14) // General chat message
HTTP_MONITOR_INFO_REQUEST, DECLARE_ENUM_ELEMENT_WITH_VALUE(HTTP_MONITOR_INFO_REQUEST, 15)
SLASH_DEBUG_SCRIPTS, // Debug scripts cmd DECLARE_ENUM_ELEMENT_WITH_VALUE(SLASH_DEBUG_SCRIPTS, 16) // Debug scripts cmd
MODELS_CLEAR, DECLARE_ENUM_ELEMENT_WITH_VALUE(MODELS_CLEAR, 17)
EXHIBIT_INSERT_MODEL, DECLARE_ENUM_ELEMENT_WITH_VALUE(EXHIBIT_INSERT_MODEL, 18)
LEVEL_LOAD_COMPLETE, // Character data request DECLARE_ENUM_ELEMENT_WITH_VALUE(LEVEL_LOAD_COMPLETE, 19) // Character data request
TMP_GUILD_CREATE, DECLARE_ENUM_ELEMENT_WITH_VALUE(TMP_GUILD_CREATE, 20)
ROUTE_PACKET, // Social? DECLARE_ENUM_ELEMENT_WITH_VALUE(ROUTE_PACKET, 21) // Social?
POSITION_UPDATE, DECLARE_ENUM_ELEMENT_WITH_VALUE(POSITION_UPDATE, 22)
MAIL, DECLARE_ENUM_ELEMENT_WITH_VALUE(MAIL, 23)
WORD_CHECK, // Whitelist word check DECLARE_ENUM_ELEMENT_WITH_VALUE(WORD_CHECK, 24) // Whitelist word check
STRING_CHECK, // Whitelist string check DECLARE_ENUM_ELEMENT_WITH_VALUE(STRING_CHECK, 25) // Whitelist string check
GET_PLAYERS_IN_ZONE, DECLARE_ENUM_ELEMENT_WITH_VALUE(GET_PLAYERS_IN_ZONE, 26)
REQUEST_UGC_MANIFEST_INFO, DECLARE_ENUM_ELEMENT_WITH_VALUE(REQUEST_UGC_MANIFEST_INFO, 27)
BLUEPRINT_GET_ALL_DATA_REQUEST, DECLARE_ENUM_ELEMENT_WITH_VALUE(BLUEPRINT_GET_ALL_DATA_REQUEST, 28)
CANCEL_MAP_QUEUE, DECLARE_ENUM_ELEMENT_WITH_VALUE(CANCEL_MAP_QUEUE, 29)
HANDLE_FUNNESS, DECLARE_ENUM_ELEMENT_WITH_VALUE(HANDLE_FUNNESS, 30)
FAKE_PRG_CSR_MESSAGE, DECLARE_ENUM_ELEMENT_WITH_VALUE(FAKE_PRG_CSR_MESSAGE, 31)
REQUEST_FREE_TRIAL_REFRESH, DECLARE_ENUM_ELEMENT_WITH_VALUE(REQUEST_FREE_TRIAL_REFRESH, 32)
GM_SET_FREE_TRIAL_STATUS, DECLARE_ENUM_ELEMENT_WITH_VALUE(GM_SET_FREE_TRIAL_STATUS, 33)
UI_HELP_TOP_5 = 91 DECLARE_ENUM_ELEMENT_WITH_VALUE(UI_HELP_TOP_5, 91)
}; END_ENUM_WITH_VALUES(eWorldMessageType, uint32_t)
#endif //!__EWORLDMESSAGETYPE__H__ #endif //!__EWORLDMESSAGETYPE__H__

View File

@ -197,18 +197,17 @@ void RebuildComponent::Update(float deltaTime) {
DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>(); DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>();
if (!destComp) break; if (!destComp) break;
int newImagination = destComp->GetImagination();
++m_DrainedImagination; ++m_DrainedImagination;
--newImagination; const int32_t imaginationCostRemaining = m_TakeImagination - m_DrainedImagination;
const int32_t newImagination = destComp->GetImagination() - 1;
destComp->SetImagination(newImagination); destComp->SetImagination(newImagination);
Game::entityManager->SerializeEntity(builder); Game::entityManager->SerializeEntity(builder);
if (newImagination <= 0) { if (newImagination <= 0 && imaginationCostRemaining > 0) {
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true); CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
break; break;
} }
} }
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) { if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {

View File

@ -285,7 +285,7 @@ private:
float m_CompleteTime = 0; float m_CompleteTime = 0;
/** /**
* The imagination that's deducted when compeleting the rebuild * The imagination that's deducted when completing the rebuild
*/ */
int m_TakeImagination = 0; int m_TakeImagination = 0;

View File

@ -38,8 +38,6 @@
#include "ePlayerFlag.h" #include "ePlayerFlag.h"
#include "dConfig.h" #include "dConfig.h"
using namespace std;
void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, eGameMessageType messageID) { void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, eGameMessageType messageID) {
CBITSTREAM; CBITSTREAM;

View File

@ -2,5 +2,6 @@
#include <map> #include <map>
#include "eGameMessageType.h" #include "eGameMessageType.h"
#include "eWorldMessageType.h"
#undef GENERATE_ENUM_STRINGS // Stop string generation #undef GENERATE_ENUM_STRINGS // Stop string generation

View File

@ -1244,7 +1244,10 @@ void HandlePacket(Packet* packet) {
} }
default: default:
LOG("Unknown world packet received: %i", int(packet->data[3])); const auto data = packet->data[3];
const uint32_t worldMessageId = static_cast<uint32_t>(data);
const char* worldMessageString = eWorldMessageType_as_string(static_cast<eWorldMessageType>(data));
LOG("Unknown world packet received: (%4i) %s", worldMessageId, worldMessageString);
} }
} }