2021-12-05 17:54:36 +00:00
/*
* Darkflame Universe
* Copyright 2018
*/
# include "GameMessageHandler.h"
# include "MissionComponent.h"
2023-09-21 01:06:28 +00:00
# include "BitStreamUtils.h"
2021-12-05 17:54:36 +00:00
# include "dServer.h"
# include "../thirdparty/raknet/Source/RakNetworkFactory.h"
# include <future>
# include "User.h"
# include "UserManager.h"
# include "BitStream.h"
# include "RakPeer.h"
# include "DestroyableComponent.h"
# include "InventoryComponent.h"
# include "Character.h"
# include "ControllablePhysicsComponent.h"
# include "dZoneManager.h"
# include "Player.h"
# include "CppScripts.h"
# include "CDClientDatabase.h"
# include "CDClientManager.h"
# include "CDSkillBehaviorTable.h"
# include "SkillComponent.h"
# include "RacingControlComponent.h"
2023-01-07 05:17:05 +00:00
# include "RequestServerProjectileImpact.h"
# include "SyncSkill.h"
# include "StartSkill.h"
# include "EchoStartSkill.h"
# include "EchoSyncSkill.h"
2021-12-05 17:54:36 +00:00
# include "eMissionTaskType.h"
2023-03-04 07:16:37 +00:00
# include "eReplicaComponentType.h"
2023-05-03 21:38:32 +00:00
# include "eConnectionType.h"
2023-12-23 16:51:59 +00:00
# include "eGameMessageType.h"
2023-11-22 02:04:44 +00:00
# include "ePlayerFlag.h"
# include "dConfig.h"
2023-12-23 16:51:59 +00:00
# include "StringifiedEnum.h"
2021-12-05 17:54:36 +00:00
2023-05-03 21:38:32 +00:00
void GameMessageHandler : : HandleMessage ( RakNet : : BitStream * inStream , const SystemAddress & sysAddr , LWOOBJID objectID , eGameMessageType messageID ) {
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
CBITSTREAM ;
// Get the entity
2023-07-15 20:56:33 +00:00
Entity * entity = Game : : entityManager - > GetEntity ( objectID ) ;
2021-12-05 17:54:36 +00:00
User * usr = UserManager : : Instance ( ) - > GetUser ( sysAddr ) ;
2022-07-23 02:58:20 +00:00
if ( ! entity ) {
2023-12-23 16:51:59 +00:00
LOG ( " Failed to find associated entity (%llu), aborting GM: %4i, %s! " , objectID , messageID , StringifiedEnum : : ToString ( messageID ) . data ( ) ) ;
2022-07-23 02:58:20 +00:00
return ;
}
2021-12-05 17:54:36 +00:00
2023-12-24 00:11:00 +00:00
if ( messageID ! = eGameMessageType : : READY_FOR_UPDATES ) LOG_DEBUG ( " Received GM with ID and name: %4i, %s " , messageID , StringifiedEnum : : ToString ( messageID ) . data ( ) ) ;
2023-08-04 02:44:03 +00:00
2022-07-23 02:58:20 +00:00
switch ( messageID ) {
2021-12-05 17:54:36 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : UN_USE_BBB_MODEL : {
2022-11-28 00:48:46 +00:00
GameMessages : : HandleUnUseModel ( inStream , entity , sysAddr ) ;
break ;
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PLAY_EMOTE : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandlePlayEmote ( inStream , entity ) ;
break ;
}
2021-12-05 17:54:36 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MOVE_ITEM_IN_INVENTORY : {
2021-12-05 17:54:36 +00:00
GameMessages : : HandleMoveItemInInventory ( inStream , entity ) ;
break ;
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REMOVE_ITEM_FROM_INVENTORY : {
2021-12-05 17:54:36 +00:00
GameMessages : : HandleRemoveItemFromInventory ( inStream , entity , sysAddr ) ;
break ;
}
2023-08-04 02:27:40 +00:00
case eGameMessageType : : EQUIP_INVENTORY :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleEquipItem ( inStream , entity ) ;
break ;
2023-08-04 02:27:40 +00:00
case eGameMessageType : : UN_EQUIP_INVENTORY :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleUnequipItem ( inStream , entity ) ;
break ;
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : RESPOND_TO_MISSION : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleRespondToMission ( inStream , entity ) ;
break ;
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_USE : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleRequestUse ( inStream , entity , sysAddr ) ;
break ;
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : SET_FLAG : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleSetFlag ( inStream , entity ) ;
break ;
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : HAS_BEEN_COLLECTED : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleHasBeenCollected ( inStream , entity ) ;
break ;
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PLAYER_LOADED : {
2021-12-05 17:54:36 +00:00
GameMessages : : SendRestoreToPostLoadStats ( entity , sysAddr ) ;
entity - > SetPlayerReadyForUpdates ( ) ;
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
auto * player = dynamic_cast < Player * > ( entity ) ;
if ( player ! = nullptr ) {
player - > ConstructLimboEntities ( ) ;
}
InventoryComponent * inv = entity - > GetComponent < InventoryComponent > ( ) ;
if ( inv ) {
auto items = inv - > GetEquippedItems ( ) ;
for ( auto pair : items ) {
const auto item = pair . second ;
inv - > AddItemSkills ( item . lot ) ;
}
2022-07-28 13:39:57 +00:00
}
2021-12-05 17:54:36 +00:00
auto * destroyable = entity - > GetComponent < DestroyableComponent > ( ) ;
destroyable - > SetImagination ( destroyable - > GetImagination ( ) ) ;
2023-07-15 20:56:33 +00:00
Game : : entityManager - > SerializeEntity ( entity ) ;
2021-12-05 17:54:36 +00:00
2023-07-15 20:56:33 +00:00
std : : vector < Entity * > racingControllers = Game : : entityManager - > GetEntitiesByComponent ( eReplicaComponentType : : RACING_CONTROL ) ;
2021-12-05 17:54:36 +00:00
for ( Entity * racingController : racingControllers ) {
auto * racingComponent = racingController - > GetComponent < RacingControlComponent > ( ) ;
if ( racingComponent ! = nullptr ) {
racingComponent - > OnPlayerLoaded ( entity ) ;
}
2022-07-28 13:39:57 +00:00
}
2021-12-05 17:54:36 +00:00
2023-07-15 20:56:33 +00:00
Entity * zoneControl = Game : : entityManager - > GetZoneControlEntity ( ) ;
2021-12-05 17:54:36 +00:00
for ( CppScripts : : Script * script : CppScripts : : GetEntityScripts ( zoneControl ) ) {
script - > OnPlayerLoaded ( zoneControl , player ) ;
}
2023-07-15 20:56:33 +00:00
std : : vector < Entity * > scriptedActs = Game : : entityManager - > GetEntitiesByComponent ( eReplicaComponentType : : SCRIPT ) ;
2021-12-05 17:54:36 +00:00
for ( Entity * scriptEntity : scriptedActs ) {
if ( scriptEntity - > GetObjectID ( ) ! = zoneControl - > GetObjectID ( ) ) { // Don't want to trigger twice on instance worlds
for ( CppScripts : : Script * script : CppScripts : : GetEntityScripts ( scriptEntity ) ) {
script - > OnPlayerLoaded ( scriptEntity , player ) ;
}
}
2022-07-28 13:39:57 +00:00
}
2021-12-05 17:54:36 +00:00
//Kill player if health == 0
if ( entity - > GetIsDead ( ) ) {
entity - > Smash ( entity - > GetObjectID ( ) ) ;
}
//if the player has moved significantly, move them back:
if ( ( entity - > GetPosition ( ) . y - entity - > GetCharacter ( ) - > GetOriginalPos ( ) . y ) > 2.0f ) {
// Disabled until fixed
//GameMessages::SendTeleport(entity->GetObjectID(), entity->GetCharacter()->GetOriginalPos(), entity->GetCharacter()->GetOriginalRot(), entity->GetSystemAddress(), true, true);
2022-07-28 13:39:57 +00:00
}
2021-12-05 17:54:36 +00:00
2022-07-28 13:39:57 +00:00
/**
2021-12-05 17:54:36 +00:00
* Invoke the OnZoneLoad event on the player character
2022-07-28 13:39:57 +00:00
*/
2021-12-05 17:54:36 +00:00
auto * character = entity - > GetCharacter ( ) ;
2022-07-25 02:26:51 +00:00
if ( character ! = nullptr ) {
character - > OnZoneLoad ( ) ;
2022-07-28 13:39:57 +00:00
}
2021-12-05 17:54:36 +00:00
2023-10-21 23:31:55 +00:00
LOG ( " Player %s (%llu) loaded. " , entity - > GetCharacter ( ) - > GetName ( ) . c_str ( ) , entity - > GetObjectID ( ) ) ;
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
// After we've done our thing, tell the client they're ready
2022-07-23 02:58:20 +00:00
GameMessages : : SendPlayerReady ( entity , sysAddr ) ;
2023-07-17 22:55:33 +00:00
GameMessages : : SendPlayerReady ( Game : : zoneManager - > GetZoneControlObject ( ) , sysAddr ) ;
2022-07-25 02:26:51 +00:00
2023-11-22 02:04:44 +00:00
if ( Game : : config - > GetValue ( " allow_players_to_skip_cinematics " ) ! = " 1 "
| | ! entity - > GetCharacter ( )
| | ! entity - > GetCharacter ( ) - > GetPlayerFlag ( ePlayerFlag : : DLU_SKIP_CINEMATICS ) ) return ;
entity - > AddCallbackTimer ( 0.5f , [ entity , sysAddr ] ( ) {
if ( ! entity ) return ;
GameMessages : : SendEndCinematic ( entity - > GetObjectID ( ) , u " " , sysAddr ) ;
} ) ;
2022-07-23 02:58:20 +00:00
break ;
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_LINKED_MISSION : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleRequestLinkedMission ( inStream , entity ) ;
break ;
}
2021-12-05 17:54:36 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MISSION_DIALOGUE_OK : {
2021-12-05 17:54:36 +00:00
GameMessages : : HandleMissionDialogOK ( inStream , entity ) ;
break ;
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MISSION_DIALOGUE_CANCELLED : {
2022-07-23 02:58:20 +00:00
//This message is pointless for our implementation, as the client just carries on after
//rejecting a mission offer. We dont need to do anything. This is just here to remove a warning in our logs :)
break ;
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_PLATFORM_RESYNC : {
2021-12-05 17:54:36 +00:00
GameMessages : : HandleRequestPlatformResync ( inStream , entity , sysAddr ) ;
2022-07-23 02:58:20 +00:00
break ;
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : FIRE_EVENT_SERVER_SIDE : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleFireEventServerSide ( inStream , entity , sysAddr ) ;
break ;
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : SEND_ACTIVITY_SUMMARY_LEADERBOARD_DATA : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleActivitySummaryLeaderboardData ( inStream , entity , sysAddr ) ;
break ;
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_ACTIVITY_SUMMARY_LEADERBOARD_DATA : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleRequestActivitySummaryLeaderboardData ( inStream , entity , sysAddr ) ;
break ;
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : ACTIVITY_STATE_CHANGE_REQUEST : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleActivityStateChangeRequest ( inStream , entity ) ;
break ;
}
2021-12-05 17:54:36 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PARSE_CHAT_MESSAGE : {
2021-12-05 17:54:36 +00:00
GameMessages : : HandleParseChatMessage ( inStream , entity , sysAddr ) ;
break ;
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : NOTIFY_SERVER_LEVEL_PROCESSING_COMPLETE : {
2021-12-05 17:54:36 +00:00
GameMessages : : HandleNotifyServerLevelProcessingComplete ( inStream , entity ) ;
break ;
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PICKUP_CURRENCY : {
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePickupCurrency ( inStream , entity ) ;
break ;
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PICKUP_ITEM : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandlePickupItem ( inStream , entity ) ;
break ;
2021-12-05 17:54:36 +00:00
}
2023-05-03 21:38:32 +00:00
case eGameMessageType : : RESURRECT : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleResurrect ( inStream , entity ) ;
break ;
}
2021-12-05 17:54:36 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_RESURRECT : {
2022-07-23 02:58:20 +00:00
GameMessages : : SendResurrect ( entity ) ;
2022-07-28 13:39:57 +00:00
break ;
}
2023-08-04 02:27:40 +00:00
case eGameMessageType : : GET_HOT_PROPERTY_DATA : {
2022-07-23 02:58:20 +00:00
GameMessages : : HandleGetHotPropertyData ( inStream , entity , sysAddr ) ;
2022-07-28 13:39:57 +00:00
break ;
}
2021-12-05 17:54:36 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_SERVER_PROJECTILE_IMPACT :
2022-07-28 13:39:57 +00:00
{
2023-01-07 05:17:05 +00:00
auto message = RequestServerProjectileImpact ( ) ;
2021-12-05 17:54:36 +00:00
message . Deserialize ( inStream ) ;
auto * skill_component = entity - > GetComponent < SkillComponent > ( ) ;
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
if ( skill_component ! = nullptr ) {
2023-12-28 04:18:20 +00:00
auto * bs = new RakNet : : BitStream ( reinterpret_cast < unsigned char * > ( const_cast < char * > ( message . sBitStream . c_str ( ) ) ) , message . sBitStream . size ( ) , false ) ;
2021-12-05 17:54:36 +00:00
skill_component - > SyncPlayerProjectile ( message . i64LocalID , bs , message . i64TargetID ) ;
2022-07-25 02:26:51 +00:00
2022-07-23 02:58:20 +00:00
delete bs ;
}
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
break ;
2022-07-28 13:39:57 +00:00
}
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : START_SKILL : {
2023-01-07 05:17:05 +00:00
StartSkill startSkill = StartSkill ( ) ;
2021-12-05 17:54:36 +00:00
startSkill . Deserialize ( inStream ) ; // inStream replaces &bitStream
if ( startSkill . skillID = = 1561 | | startSkill . skillID = = 1562 | | startSkill . skillID = = 1541 ) return ;
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
MissionComponent * comp = entity - > GetComponent < MissionComponent > ( ) ;
if ( comp ) {
comp - > Progress ( eMissionTaskType : : USE_SKILL , startSkill . skillID ) ;
2022-07-28 13:39:57 +00:00
}
2021-12-05 17:54:36 +00:00
2023-03-17 14:36:21 +00:00
CDSkillBehaviorTable * skillTable = CDClientManager : : Instance ( ) . GetTable < CDSkillBehaviorTable > ( ) ;
2021-12-05 17:54:36 +00:00
unsigned int behaviorId = skillTable - > GetSkillByID ( startSkill . skillID ) . behaviorID ;
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
bool success = false ;
if ( behaviorId > 0 ) {
2023-12-28 04:18:20 +00:00
RakNet : : BitStream * bs = new RakNet : : BitStream ( reinterpret_cast < unsigned char * > ( const_cast < char * > ( startSkill . sBitStream . c_str ( ) ) ) , startSkill . sBitStream . size ( ) , false ) ;
2021-12-05 17:54:36 +00:00
2022-04-25 10:25:07 +00:00
auto * skillComponent = entity - > GetComponent < SkillComponent > ( ) ;
2021-12-05 17:54:36 +00:00
success = skillComponent - > CastPlayerSkill ( behaviorId , startSkill . uiSkillHandle , bs , startSkill . optionalTargetID , startSkill . skillID ) ;
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
if ( success & & entity - > GetCharacter ( ) ) {
DestroyableComponent * destComp = entity - > GetComponent < DestroyableComponent > ( ) ;
destComp - > SetImagination ( destComp - > GetImagination ( ) - skillTable - > GetSkillByID ( startSkill . skillID ) . imaginationcost ) ;
}
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
delete bs ;
}
if ( Game : : server - > GetZoneID ( ) = = 1302 ) {
break ;
}
if ( success ) {
//Broadcast our startSkill:
RakNet : : BitStream bitStreamLocal ;
2023-09-21 01:06:28 +00:00
BitStreamUtils : : WriteHeader ( bitStreamLocal , eConnectionType : : CLIENT , eClientMessageType : : GAME_MSG ) ;
2021-12-05 17:54:36 +00:00
bitStreamLocal . Write ( entity - > GetObjectID ( ) ) ;
2023-01-07 05:17:05 +00:00
EchoStartSkill echoStartSkill ;
2021-12-05 17:54:36 +00:00
echoStartSkill . bUsedMouse = startSkill . bUsedMouse ;
echoStartSkill . fCasterLatency = startSkill . fCasterLatency ;
echoStartSkill . iCastType = startSkill . iCastType ;
echoStartSkill . lastClickedPosit = startSkill . lastClickedPosit ;
echoStartSkill . optionalOriginatorID = startSkill . optionalOriginatorID ;
echoStartSkill . optionalTargetID = startSkill . optionalTargetID ;
echoStartSkill . originatorRot = startSkill . originatorRot ;
echoStartSkill . sBitStream = startSkill . sBitStream ;
echoStartSkill . skillID = startSkill . skillID ;
echoStartSkill . uiSkillHandle = startSkill . uiSkillHandle ;
echoStartSkill . Serialize ( & bitStreamLocal ) ;
2022-07-28 13:39:57 +00:00
2021-12-05 17:54:36 +00:00
Game : : server - > Send ( & bitStreamLocal , entity - > GetSystemAddress ( ) , true ) ;
2022-07-28 13:39:57 +00:00
}
} break ;
2021-12-05 17:54:36 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : SYNC_SKILL : {
2021-12-05 17:54:36 +00:00
RakNet : : BitStream bitStreamLocal ;
2023-09-21 01:06:28 +00:00
BitStreamUtils : : WriteHeader ( bitStreamLocal , eConnectionType : : CLIENT , eClientMessageType : : GAME_MSG ) ;
2021-12-05 17:54:36 +00:00
bitStreamLocal . Write ( entity - > GetObjectID ( ) ) ;
2023-01-07 05:17:05 +00:00
SyncSkill sync = SyncSkill ( inStream ) ; // inStream replaced &bitStream
2021-12-05 17:54:36 +00:00
2023-12-23 16:51:59 +00:00
std : : ostringstream buffer ;
2022-07-25 02:26:51 +00:00
2021-12-05 17:54:36 +00:00
for ( unsigned int k = 0 ; k < sync . sBitStream . size ( ) ; k + + ) {
char s ;
s = sync . sBitStream . at ( k ) ;
2023-12-23 16:51:59 +00:00
buffer < < std : : setw ( 2 ) < < std : : hex < < std : : setfill ( ' 0 ' ) < < static_cast < int > ( s ) < < " " ;
2022-07-28 13:39:57 +00:00
}
2021-12-05 17:54:36 +00:00
if ( usr ! = nullptr ) {
2023-12-28 04:18:20 +00:00
RakNet : : BitStream * bs = new RakNet : : BitStream ( reinterpret_cast < unsigned char * > ( const_cast < char * > ( sync . sBitStream . c_str ( ) ) ) , sync . sBitStream . size ( ) , false ) ;
2021-12-05 17:54:36 +00:00
auto * skillComponent = entity - > GetComponent < SkillComponent > ( ) ;
skillComponent - > SyncPlayerSkill ( sync . uiSkillHandle , sync . uiBehaviorHandle , bs ) ;
delete bs ;
2022-07-28 13:39:57 +00:00
}
2021-12-05 17:54:36 +00:00
2023-01-07 05:17:05 +00:00
EchoSyncSkill echo = EchoSyncSkill ( ) ;
2021-12-05 17:54:36 +00:00
echo . bDone = sync . bDone ;
echo . sBitStream = sync . sBitStream ;
echo . uiBehaviorHandle = sync . uiBehaviorHandle ;
echo . uiSkillHandle = sync . uiSkillHandle ;
echo . Serialize ( & bitStreamLocal ) ;
Game : : server - > Send ( & bitStreamLocal , sysAddr , true ) ;
} break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_SMASH_PLAYER :
2021-12-05 17:54:36 +00:00
entity - > Smash ( entity - > GetObjectID ( ) ) ;
break ;
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MOVE_ITEM_BETWEEN_INVENTORY_TYPES :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleMoveItemBetweenInventoryTypes ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MODULAR_BUILD_FINISH :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleModularBuildFinish ( inStream , entity , sysAddr ) ;
break ;
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PUSH_EQUIPPED_ITEMS_STATE :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePushEquippedItemsState ( inStream , entity ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : POP_EQUIPPED_ITEMS_STATE :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePopEquippedItemsState ( inStream , entity ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : BUY_FROM_VENDOR :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleBuyFromVendor ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : SELL_TO_VENDOR :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleSellToVendor ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : BUYBACK_FROM_VENDOR :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleBuybackFromVendor ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MODULAR_BUILD_MOVE_AND_EQUIP :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleModularBuildMoveAndEquip ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : DONE_ARRANGING_WITH_ITEM :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleDoneArrangingWithItem ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MODULAR_BUILD_CONVERT_MODEL :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleModularBuildConvertModel ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : BUILD_MODE_SET :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleBuildModeSet ( inStream , entity ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REBUILD_CANCEL :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleRebuildCancel ( inStream , entity ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MATCH_REQUEST :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleMatchRequest ( inStream , entity ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : USE_NON_EQUIPMENT_ITEM :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleUseNonEquipmentItem ( inStream , entity ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CLIENT_ITEM_CONSUMED :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleClientItemConsumed ( inStream , entity ) ;
2022-07-28 13:39:57 +00:00
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : SET_CONSUMABLE_ITEM :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleSetConsumableItem ( inStream , entity , sysAddr ) ;
2022-07-28 13:39:57 +00:00
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : VERIFY_ACK :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleVerifyAck ( inStream , entity , sysAddr ) ;
break ;
// Trading
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CLIENT_TRADE_REQUEST :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleClientTradeRequest ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CLIENT_TRADE_CANCEL :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleClientTradeCancel ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CLIENT_TRADE_ACCEPT :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleClientTradeAccept ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CLIENT_TRADE_UPDATE :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleClientTradeUpdate ( inStream , entity , sysAddr ) ;
break ;
// Pets
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PET_TAMING_TRY_BUILD :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePetTamingTryBuild ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : NOTIFY_TAMING_BUILD_SUCCESS :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleNotifyTamingBuildSuccess ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_SET_PET_NAME :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleRequestSetPetName ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : START_SERVER_PET_MINIGAME_TIMER :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleStartServerPetMinigameTimer ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CLIENT_EXIT_TAMING_MINIGAME :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleClientExitTamingMinigame ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : COMMAND_PET :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleCommandPet ( inStream , entity , sysAddr ) ;
break ;
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : DESPAWN_PET :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleDespawnPet ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MESSAGE_BOX_RESPOND :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleMessageBoxResponse ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CHOICE_BOX_RESPOND :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleChoiceBoxRespond ( inStream , entity , sysAddr ) ;
break ;
2022-07-23 02:58:20 +00:00
// Property
2023-05-03 21:38:32 +00:00
case eGameMessageType : : QUERY_PROPERTY_DATA :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleQueryPropertyData ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : START_BUILDING_WITH_ITEM :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleStartBuildingWithItem ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : SET_BUILD_MODE :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleSetBuildMode ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PROPERTY_EDITOR_BEGIN :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePropertyEditorBegin ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PROPERTY_EDITOR_END :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePropertyEditorEnd ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PROPERTY_CONTENTS_FROM_CLIENT :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePropertyContentsFromClient ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : ZONE_PROPERTY_MODEL_EQUIPPED :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePropertyModelEquipped ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PLACE_PROPERTY_MODEL :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePlacePropertyModel ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : UPDATE_MODEL_FROM_CLIENT :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleUpdatePropertyModel ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : DELETE_MODEL_FROM_CLIENT :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleDeletePropertyModel ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : BBB_LOAD_ITEM_REQUEST :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleBBBLoadItemRequest ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : BBB_SAVE_REQUEST :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleBBBSaveRequest ( inStream , entity , sysAddr ) ;
break ;
2023-08-04 02:27:40 +00:00
case eGameMessageType : : CONTROL_BEHAVIORS :
2022-07-20 08:28:57 +00:00
GameMessages : : HandleControlBehaviors ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PROPERTY_ENTRANCE_SYNC :
2021-12-05 17:54:36 +00:00
GameMessages : : HandlePropertyEntranceSync ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : ENTER_PROPERTY1 :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleEnterProperty ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : ZONE_PROPERTY_MODEL_ROTATED :
2023-07-15 20:56:33 +00:00
Game : : entityManager - > GetZoneControlEntity ( ) - > OnZonePropertyModelRotated ( usr - > GetLastUsedChar ( ) - > GetEntity ( ) ) ;
2021-12-05 17:54:36 +00:00
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : UPDATE_PROPERTY_OR_MODEL_FOR_FILTER_CHECK :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleUpdatePropertyOrModelForFilterCheck ( inStream , entity , sysAddr ) ;
break ;
2022-07-25 02:26:51 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : SET_PROPERTY_ACCESS :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleSetPropertyAccess ( inStream , entity , sysAddr ) ;
break ;
// Racing
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MODULE_ASSEMBLY_QUERY_DATA :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleModuleAssemblyQueryData ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : ACKNOWLEDGE_POSSESSION :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleAcknowledgePossession ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : VEHICLE_SET_WHEEL_LOCK_STATE :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleVehicleSetWheelLockState ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MODULAR_ASSEMBLY_NIF_COMPLETED :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleModularAssemblyNIFCompleted ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : RACING_CLIENT_READY :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleRacingClientReady ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_DIE :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleRequestDie ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-08-04 02:27:40 +00:00
case eGameMessageType : : NOTIFY_SERVER_VEHICLE_ADD_PASSIVE_BOOST_ACTION :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleVehicleNotifyServerAddPassiveBoostAction ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-08-04 02:27:40 +00:00
case eGameMessageType : : NOTIFY_SERVER_VEHICLE_REMOVE_PASSIVE_BOOST_ACTION :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleVehicleNotifyServerRemovePassiveBoostAction ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : RACING_PLAYER_INFO_RESET_FINISHED :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleRacingPlayerInfoResetFinished ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : VEHICLE_NOTIFY_HIT_IMAGINATION_SERVER :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleVehicleNotifyHitImaginationServer ( inStream , entity , sysAddr ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : UPDATE_PROPERTY_PERFORMANCE_COST :
2022-03-30 02:52:07 +00:00
GameMessages : : HandleUpdatePropertyPerformanceCost ( inStream , entity , sysAddr ) ;
break ;
2021-12-05 17:54:36 +00:00
// SG
2023-05-03 21:38:32 +00:00
case eGameMessageType : : UPDATE_SHOOTING_GALLERY_ROTATION :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleUpdateShootingGalleryRotation ( inStream , entity , sysAddr ) ;
break ;
// NT
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REQUEST_MOVE_ITEM_BETWEEN_INVENTORY_TYPES :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleRequestMoveItemBetweenInventoryTypes ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : TOGGLE_GHOST_REFERENCE_OVERRIDE :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleToggleGhostReferenceOverride ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : SET_GHOST_REFERENCE_POSITION :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleSetGhostReferencePosition ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : READY_FOR_UPDATES :
2022-07-23 02:58:20 +00:00
//We don't really care about this message, as it's simply here to inform us that the client is done loading an object.
//In the event we _do_ send an update to an object that hasn't finished loading, the client will handle it anyway.
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : REPORT_BUG :
2021-12-05 17:54:36 +00:00
GameMessages : : HandleReportBug ( inStream , entity ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CLIENT_RAIL_MOVEMENT_READY :
2022-07-23 02:58:20 +00:00
GameMessages : : HandleClientRailMovementReady ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CANCEL_RAIL_MOVEMENT :
2022-07-23 02:58:20 +00:00
GameMessages : : HandleCancelRailMovement ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : PLAYER_RAIL_ARRIVED_NOTIFICATION :
2022-07-23 02:58:20 +00:00
GameMessages : : HandlePlayerRailArrivedNotification ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : CINEMATIC_UPDATE :
2022-07-23 02:58:20 +00:00
GameMessages : : HandleCinematicUpdate ( inStream , entity , sysAddr ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : MODIFY_PLAYER_ZONE_STATISTIC :
2022-07-23 02:58:20 +00:00
GameMessages : : HandleModifyPlayerZoneStatistic ( inStream , entity ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : UPDATE_PLAYER_STATISTIC :
2022-07-23 02:58:20 +00:00
GameMessages : : HandleUpdatePlayerStatistic ( inStream , entity ) ;
break ;
2022-07-28 13:39:57 +00:00
2023-05-03 21:38:32 +00:00
case eGameMessageType : : DISMOUNT_COMPLETE :
2022-09-02 18:49:19 +00:00
GameMessages : : HandleDismountComplete ( inStream , entity , sysAddr ) ;
break ;
2023-08-04 02:27:40 +00:00
case eGameMessageType : : DECTIVATE_BUBBLE_BUFF :
2023-01-07 06:14:51 +00:00
GameMessages : : HandleDeactivateBubbleBuff ( inStream , entity ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : ACTIVATE_BUBBLE_BUFF :
2023-01-07 06:14:51 +00:00
GameMessages : : HandleActivateBubbleBuff ( inStream , entity ) ;
break ;
2023-05-03 21:38:32 +00:00
case eGameMessageType : : ZONE_SUMMARY_DISMISSED :
2023-03-25 10:26:39 +00:00
GameMessages : : HandleZoneSummaryDismissed ( inStream , entity ) ;
break ;
2023-05-11 00:26:04 +00:00
case eGameMessageType : : REQUEST_ACTIVITY_EXIT :
GameMessages : : HandleRequestActivityExit ( inStream , entity ) ;
break ;
2023-08-04 02:44:03 +00:00
case eGameMessageType : : ADD_DONATION_ITEM :
GameMessages : : HandleAddDonationItem ( inStream , entity , sysAddr ) ;
break ;
case eGameMessageType : : REMOVE_DONATION_ITEM :
GameMessages : : HandleRemoveDonationItem ( inStream , entity , sysAddr ) ;
break ;
case eGameMessageType : : CONFIRM_DONATION_ON_PLAYER :
GameMessages : : HandleConfirmDonationOnPlayer ( inStream , entity ) ;
break ;
case eGameMessageType : : CANCEL_DONATION_ON_PLAYER :
GameMessages : : HandleCancelDonationOnPlayer ( inStream , entity ) ;
break ;
2023-12-21 04:25:21 +00:00
case eGameMessageType : : REQUEST_VENDOR_STATUS_UPDATE :
GameMessages : : SendVendorStatusUpdate ( entity , sysAddr , true ) ;
break ;
2022-07-25 02:26:51 +00:00
default :
2023-12-24 00:11:00 +00:00
LOG_DEBUG ( " Received Unknown GM with ID: %4i, %s " , messageID , StringifiedEnum : : ToString ( messageID ) . data ( ) ) ;
2021-12-05 17:54:36 +00:00
break ;
2022-07-23 02:58:20 +00:00
}
2021-12-05 17:54:36 +00:00
}