mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Merge remote-tracking branch 'upstream/main' into PetFixes
This commit is contained in:
@@ -13,13 +13,13 @@ public:
|
||||
bUsedMouse = false;
|
||||
fCasterLatency = 0.0f;
|
||||
iCastType = 0;
|
||||
lastClickedPosit = NiPoint3::ZERO;
|
||||
lastClickedPosit = NiPoint3Constant::ZERO;
|
||||
optionalTargetID = LWOOBJID_EMPTY;
|
||||
originatorRot = NiQuaternion::IDENTITY;
|
||||
originatorRot = NiQuaternionConstant::IDENTITY;
|
||||
uiSkillHandle = 0;
|
||||
}
|
||||
|
||||
EchoStartSkill(LWOOBJID _optionalOriginatorID, std::string _sBitStream, TSkillID _skillID, bool _bUsedMouse = false, float _fCasterLatency = 0.0f, int32_t _iCastType = 0, NiPoint3 _lastClickedPosit = NiPoint3::ZERO, LWOOBJID _optionalTargetID = LWOOBJID_EMPTY, NiQuaternion _originatorRot = NiQuaternion::IDENTITY, uint32_t _uiSkillHandle = 0) {
|
||||
EchoStartSkill(LWOOBJID _optionalOriginatorID, std::string _sBitStream, TSkillID _skillID, bool _bUsedMouse = false, float _fCasterLatency = 0.0f, int32_t _iCastType = 0, NiPoint3 _lastClickedPosit = NiPoint3Constant::ZERO, LWOOBJID _optionalTargetID = LWOOBJID_EMPTY, NiQuaternion _originatorRot = NiQuaternionConstant::IDENTITY, uint32_t _uiSkillHandle = 0) {
|
||||
bUsedMouse = _bUsedMouse;
|
||||
fCasterLatency = _fCasterLatency;
|
||||
iCastType = _iCastType;
|
||||
@@ -50,16 +50,16 @@ public:
|
||||
stream->Write(iCastType != 0);
|
||||
if (iCastType != 0) stream->Write(iCastType);
|
||||
|
||||
stream->Write(lastClickedPosit != NiPoint3::ZERO);
|
||||
if (lastClickedPosit != NiPoint3::ZERO) stream->Write(lastClickedPosit);
|
||||
stream->Write(lastClickedPosit != NiPoint3Constant::ZERO);
|
||||
if (lastClickedPosit != NiPoint3Constant::ZERO) stream->Write(lastClickedPosit);
|
||||
|
||||
stream->Write(optionalOriginatorID);
|
||||
|
||||
stream->Write(optionalTargetID != LWOOBJID_EMPTY);
|
||||
if (optionalTargetID != LWOOBJID_EMPTY) stream->Write(optionalTargetID);
|
||||
|
||||
stream->Write(originatorRot != NiQuaternion::IDENTITY);
|
||||
if (originatorRot != NiQuaternion::IDENTITY) stream->Write(originatorRot);
|
||||
stream->Write(originatorRot != NiQuaternionConstant::IDENTITY);
|
||||
if (originatorRot != NiQuaternionConstant::IDENTITY) stream->Write(originatorRot);
|
||||
|
||||
uint32_t sBitStreamLength = sBitStream.length();
|
||||
stream->Write(sBitStreamLength);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include "Character.h"
|
||||
#include "ControllablePhysicsComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "Player.h"
|
||||
#include "CppScripts.h"
|
||||
|
||||
#include "CDClientDatabase.h"
|
||||
@@ -37,6 +36,7 @@
|
||||
#include "eGameMessageType.h"
|
||||
#include "ePlayerFlag.h"
|
||||
#include "dConfig.h"
|
||||
#include "GhostComponent.h"
|
||||
#include "StringifiedEnum.h"
|
||||
|
||||
void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, eGameMessageType messageID) {
|
||||
@@ -108,9 +108,9 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
GameMessages::SendRestoreToPostLoadStats(entity, sysAddr);
|
||||
entity->SetPlayerReadyForUpdates();
|
||||
|
||||
auto* player = dynamic_cast<Player*>(entity);
|
||||
if (player != nullptr) {
|
||||
player->ConstructLimboEntities();
|
||||
auto* ghostComponent = entity->GetComponent<GhostComponent>();
|
||||
if (ghostComponent != nullptr) {
|
||||
ghostComponent->ConstructLimboEntities();
|
||||
}
|
||||
|
||||
InventoryComponent* inv = entity->GetComponent<InventoryComponent>();
|
||||
@@ -137,14 +137,14 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
|
||||
Entity* zoneControl = Game::entityManager->GetZoneControlEntity();
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
|
||||
script->OnPlayerLoaded(zoneControl, player);
|
||||
script->OnPlayerLoaded(zoneControl, entity);
|
||||
}
|
||||
|
||||
std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPT);
|
||||
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);
|
||||
script->OnPlayerLoaded(scriptEntity, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,8 +196,8 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
}
|
||||
|
||||
case eGameMessageType::MISSION_DIALOGUE_CANCELLED: {
|
||||
//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 :)
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
comp->Progress(eMissionTaskType::USE_SKILL, startSkill.skillID);
|
||||
}
|
||||
|
||||
CDSkillBehaviorTable* skillTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
|
||||
CDSkillBehaviorTable* skillTable = CDClientManager::GetTable<CDSkillBehaviorTable>();
|
||||
unsigned int behaviorId = skillTable->GetSkillByID(startSkill.skillID).behaviorID;
|
||||
|
||||
bool success = false;
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#include "GameMessages.h"
|
||||
#include "User.h"
|
||||
#include "Entity.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "BitStreamUtils.h"
|
||||
#include "BitStream.h"
|
||||
#include "Game.h"
|
||||
@@ -21,7 +20,6 @@
|
||||
#include "WorldPackets.h"
|
||||
#include "Item.h"
|
||||
#include "ZCompression.h"
|
||||
#include "Player.h"
|
||||
#include "dConfig.h"
|
||||
#include "TeamManager.h"
|
||||
#include "ChatPackets.h"
|
||||
@@ -81,6 +79,7 @@
|
||||
#include "RailActivatorComponent.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
#include "DonationVendorComponent.h"
|
||||
#include "GhostComponent.h"
|
||||
|
||||
// Message includes:
|
||||
#include "dZoneManager.h"
|
||||
@@ -97,7 +96,9 @@
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eClientMessageType.h"
|
||||
#include "eGameMessageType.h"
|
||||
#include "ePetAbilityType.h"
|
||||
#include "ActivityManager.h"
|
||||
#include "PlayerManager.h"
|
||||
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "CDObjectsTable.h"
|
||||
@@ -385,8 +386,8 @@ void GameMessages::SendPlatformResync(Entity* entity, const SystemAddress& sysAd
|
||||
float fIdleTimeElapsed = 0.0f;
|
||||
float fMoveTimeElapsed = 0.0f;
|
||||
float fPercentBetweenPoints = 0.0f;
|
||||
NiPoint3 ptUnexpectedLocation = NiPoint3::ZERO;
|
||||
NiQuaternion qUnexpectedRotation = NiQuaternion::IDENTITY;
|
||||
NiPoint3 ptUnexpectedLocation = NiPoint3Constant::ZERO;
|
||||
NiQuaternion qUnexpectedRotation = NiQuaternionConstant::IDENTITY;
|
||||
|
||||
bitStream.Write(bReverse);
|
||||
bitStream.Write(bStopAtDesiredWaypoint);
|
||||
@@ -403,8 +404,8 @@ void GameMessages::SendPlatformResync(Entity* entity, const SystemAddress& sysAd
|
||||
bitStream.Write(ptUnexpectedLocation.y);
|
||||
bitStream.Write(ptUnexpectedLocation.z);
|
||||
|
||||
bitStream.Write(qUnexpectedRotation != NiQuaternion::IDENTITY);
|
||||
if (qUnexpectedRotation != NiQuaternion::IDENTITY) {
|
||||
bitStream.Write(qUnexpectedRotation != NiQuaternionConstant::IDENTITY);
|
||||
if (qUnexpectedRotation != NiQuaternionConstant::IDENTITY) {
|
||||
bitStream.Write(qUnexpectedRotation.x);
|
||||
bitStream.Write(qUnexpectedRotation.y);
|
||||
bitStream.Write(qUnexpectedRotation.z);
|
||||
@@ -636,6 +637,25 @@ void GameMessages::SendUIMessageServerToSingleClient(Entity* entity, const Syste
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendUIMessageServerToSingleClient(const std::string& message, AMFBaseValue& args, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
LWOOBJID empty = 0;
|
||||
bitStream.Write(empty);
|
||||
bitStream.Write(eGameMessageType::UI_MESSAGE_SERVER_TO_ALL_CLIENTS); // This is intentional to allow the server to send a ui message to a client via their system address.
|
||||
|
||||
bitStream.Write<AMFBaseValue&>(args);
|
||||
uint32_t strMessageNameLength = message.size();
|
||||
bitStream.Write(strMessageNameLength);
|
||||
|
||||
for (uint32_t k = 0; k < strMessageNameLength; k++) {
|
||||
bitStream.Write<char>(message[k]);
|
||||
}
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendUIMessageServerToAllClients(const std::string& message, AMFBaseValue& args) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
@@ -762,7 +782,7 @@ void GameMessages::SendSetCurrency(Entity* entity, int64_t currency, int lootTyp
|
||||
bitStream.Write(lootType != LOOTTYPE_NONE);
|
||||
if (lootType != LOOTTYPE_NONE) bitStream.Write(lootType);
|
||||
|
||||
bitStream.Write(NiPoint3::ZERO);
|
||||
bitStream.Write(NiPoint3Constant::ZERO);
|
||||
|
||||
bitStream.Write(sourceLOT != LOT_NULL);
|
||||
if (sourceLOT != LOT_NULL) bitStream.Write(sourceLOT);
|
||||
@@ -1071,7 +1091,7 @@ void GameMessages::SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID,
|
||||
entity->RegisterCoinDrop(currency);
|
||||
}
|
||||
|
||||
if (spawnPos != NiPoint3::ZERO) {
|
||||
if (spawnPos != NiPoint3Constant::ZERO) {
|
||||
bUsePosition = true;
|
||||
|
||||
//Calculate where the loot will go:
|
||||
@@ -1093,8 +1113,8 @@ void GameMessages::SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID,
|
||||
|
||||
bitStream.Write(bUsePosition);
|
||||
|
||||
bitStream.Write(finalPosition != NiPoint3::ZERO);
|
||||
if (finalPosition != NiPoint3::ZERO) bitStream.Write(finalPosition);
|
||||
bitStream.Write(finalPosition != NiPoint3Constant::ZERO);
|
||||
if (finalPosition != NiPoint3Constant::ZERO) bitStream.Write(finalPosition);
|
||||
|
||||
bitStream.Write(currency);
|
||||
bitStream.Write(item);
|
||||
@@ -1102,14 +1122,14 @@ void GameMessages::SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID,
|
||||
bitStream.Write(owner);
|
||||
bitStream.Write(sourceID);
|
||||
|
||||
bitStream.Write(spawnPos != NiPoint3::ZERO);
|
||||
if (spawnPos != NiPoint3::ZERO) bitStream.Write(spawnPos);
|
||||
bitStream.Write(spawnPos != NiPoint3Constant::ZERO);
|
||||
if (spawnPos != NiPoint3Constant::ZERO) bitStream.Write(spawnPos);
|
||||
|
||||
auto* team = TeamManager::Instance()->GetTeam(owner);
|
||||
|
||||
// Currency and powerups should not sync
|
||||
if (team != nullptr && currency == 0) {
|
||||
CDObjectsTable* objectsTable = CDClientManager::Instance().GetTable<CDObjectsTable>();
|
||||
CDObjectsTable* objectsTable = CDClientManager::GetTable<CDObjectsTable>();
|
||||
|
||||
const CDObjects& object = objectsTable->GetByID(item);
|
||||
|
||||
@@ -1162,7 +1182,7 @@ void GameMessages::SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPo
|
||||
bitStream.Write(position.y);
|
||||
bitStream.Write(position.z);
|
||||
|
||||
const bool bIsNotIdentity = rotation != NiQuaternion::IDENTITY;
|
||||
const bool bIsNotIdentity = rotation != NiQuaternionConstant::IDENTITY;
|
||||
bitStream.Write(bIsNotIdentity);
|
||||
|
||||
if (bIsNotIdentity) {
|
||||
@@ -1638,8 +1658,8 @@ void GameMessages::SendNotifyClientShootingGalleryScore(LWOOBJID objectId, const
|
||||
|
||||
void GameMessages::HandleUpdateShootingGalleryRotation(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
float angle = 0.0f;
|
||||
NiPoint3 facing = NiPoint3::ZERO;
|
||||
NiPoint3 muzzlePos = NiPoint3::ZERO;
|
||||
NiPoint3 facing = NiPoint3Constant::ZERO;
|
||||
NiPoint3 muzzlePos = NiPoint3Constant::ZERO;
|
||||
inStream->Read(angle);
|
||||
inStream->Read(facing);
|
||||
inStream->Read(muzzlePos);
|
||||
@@ -1739,8 +1759,6 @@ void GameMessages::SendStartCelebrationEffect(Entity* entity, const SystemAddres
|
||||
bitStream.Write<uint32_t>(0); //subtext
|
||||
|
||||
SEND_PACKET;
|
||||
|
||||
//PacketUtils::SavePacket("StartCelebrationEffect.bin", (char*)bitStream.GetData(), bitStream.GetNumberOfBytesUsed());
|
||||
}
|
||||
|
||||
|
||||
@@ -1963,7 +1981,6 @@ void GameMessages::SendBBBSaveResponse(const LWOOBJID& objectId, const LWOOBJID&
|
||||
bitStream.Write(buffer[i]);
|
||||
|
||||
SEND_PACKET;
|
||||
//PacketUtils::SavePacket("eGameMessageType::BBB_SAVE_RESPONSE.bin", reinterpret_cast<char*>(bitStream.GetData()), bitStream.GetNumberOfBytesUsed());
|
||||
}
|
||||
|
||||
// Property
|
||||
@@ -2098,8 +2115,8 @@ void GameMessages::SendPlaceModelResponse(LWOOBJID objectId, const SystemAddress
|
||||
bitStream.Write(objectId);
|
||||
bitStream.Write(eGameMessageType::PLACE_MODEL_RESPONSE);
|
||||
|
||||
bitStream.Write(position != NiPoint3::ZERO);
|
||||
if (position != NiPoint3::ZERO) {
|
||||
bitStream.Write(position != NiPoint3Constant::ZERO);
|
||||
if (position != NiPoint3Constant::ZERO) {
|
||||
bitStream.Write(position);
|
||||
}
|
||||
|
||||
@@ -2113,8 +2130,8 @@ void GameMessages::SendPlaceModelResponse(LWOOBJID objectId, const SystemAddress
|
||||
bitStream.Write(response);
|
||||
}
|
||||
|
||||
bitStream.Write(rotation != NiQuaternion::IDENTITY);
|
||||
if (rotation != NiQuaternion::IDENTITY) {
|
||||
bitStream.Write(rotation != NiQuaternionConstant::IDENTITY);
|
||||
if (rotation != NiQuaternionConstant::IDENTITY) {
|
||||
bitStream.Write(response);
|
||||
}
|
||||
|
||||
@@ -2266,7 +2283,7 @@ void GameMessages::HandleSetBuildMode(RakNet::BitStream* inStream, Entity* entit
|
||||
bool modePaused{};
|
||||
int modeValue = 1;
|
||||
LWOOBJID playerId{};
|
||||
NiPoint3 startPosition = NiPoint3::ZERO;
|
||||
NiPoint3 startPosition = NiPoint3Constant::ZERO;
|
||||
|
||||
inStream->Read(start);
|
||||
|
||||
@@ -2285,7 +2302,7 @@ void GameMessages::HandleSetBuildMode(RakNet::BitStream* inStream, Entity* entit
|
||||
|
||||
auto* player = Game::entityManager->GetEntity(playerId);
|
||||
|
||||
if (startPosition == NiPoint3::ZERO) {
|
||||
if (startPosition == NiPoint3Constant::ZERO) {
|
||||
startPosition = player->GetPosition();
|
||||
}
|
||||
|
||||
@@ -2379,13 +2396,13 @@ void GameMessages::HandlePlacePropertyModel(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
inStream->Read(model);
|
||||
|
||||
PropertyManagementComponent::Instance()->UpdateModelPosition(model, NiPoint3::ZERO, NiQuaternion::IDENTITY);
|
||||
PropertyManagementComponent::Instance()->UpdateModelPosition(model, NiPoint3Constant::ZERO, NiQuaternionConstant::IDENTITY);
|
||||
}
|
||||
|
||||
void GameMessages::HandleUpdatePropertyModel(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
LWOOBJID model;
|
||||
NiPoint3 position;
|
||||
NiQuaternion rotation = NiQuaternion::IDENTITY;
|
||||
NiQuaternion rotation = NiQuaternionConstant::IDENTITY;
|
||||
|
||||
inStream->Read(model);
|
||||
inStream->Read(position);
|
||||
@@ -2579,6 +2596,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
//We need to get a new ID for our model first:
|
||||
ObjectIDManager::RequestPersistentID([=](uint32_t newID) {
|
||||
if (!entity || !entity->GetCharacter() || !entity->GetCharacter()->GetParentUser()) return;
|
||||
LWOOBJID newIDL = newID;
|
||||
GeneralUtils::SetBit(newIDL, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(newIDL, eObjectBits::PERSISTENT);
|
||||
@@ -2601,13 +2619,13 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
//Insert into ugc:
|
||||
std::string str(sd0Data.get(), sd0Size);
|
||||
std::istringstream sd0DataStream(str);
|
||||
Database::Get()->InsertNewUgcModel(sd0DataStream, blueprintIDSmall, entity->GetParentUser()->GetAccountID(), entity->GetCharacter()->GetID());
|
||||
Database::Get()->InsertNewUgcModel(sd0DataStream, blueprintIDSmall, entity->GetCharacter()->GetParentUser()->GetAccountID(), entity->GetCharacter()->GetID());
|
||||
|
||||
//Insert into the db as a BBB model:
|
||||
IPropertyContents::Model model;
|
||||
model.id = newIDL;
|
||||
model.ugcId = blueprintIDSmall;
|
||||
model.position = NiPoint3::ZERO;
|
||||
model.position = NiPoint3Constant::ZERO;
|
||||
model.rotation = NiQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
model.lot = 14;
|
||||
Database::Get()->InsertNewPropertyModel(propertyId, model, "Objects_14_name");
|
||||
@@ -2709,7 +2727,7 @@ void GameMessages::HandlePropertyEntranceSync(RakNet::BitStream* inStream, Entit
|
||||
filterText.push_back(c);
|
||||
}
|
||||
|
||||
auto* player = Player::GetPlayer(sysAddr);
|
||||
auto* player = PlayerManager::GetPlayer(sysAddr);
|
||||
|
||||
auto* entranceComponent = entity->GetComponent<PropertyEntranceComponent>();
|
||||
|
||||
@@ -2736,7 +2754,7 @@ void GameMessages::HandleEnterProperty(RakNet::BitStream* inStream, Entity* enti
|
||||
inStream->Read(index);
|
||||
inStream->Read(returnToZone);
|
||||
|
||||
auto* player = Player::GetPlayer(sysAddr);
|
||||
auto* player = PlayerManager::GetPlayer(sysAddr);
|
||||
|
||||
auto* entranceComponent = entity->GetComponent<PropertyEntranceComponent>();
|
||||
if (entranceComponent != nullptr) {
|
||||
@@ -3388,7 +3406,7 @@ void GameMessages::SendNotifyPetTamingMinigame(LWOOBJID objectId, LWOOBJID petId
|
||||
bitStream.Write(petsDestPos);
|
||||
bitStream.Write(telePos);
|
||||
|
||||
const bool hasDefault = teleRot != NiQuaternion::IDENTITY;
|
||||
const bool hasDefault = teleRot != NiQuaternionConstant::IDENTITY;
|
||||
bitStream.Write(hasDefault);
|
||||
if (hasDefault) bitStream.Write(teleRot);
|
||||
|
||||
@@ -3533,7 +3551,7 @@ void GameMessages::SendClientExitTamingMinigame(LWOOBJID objectId, bool bVolunta
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendShowPetActionButton(const LWOOBJID& objectId, const ePetAbilityType petAbility, const bool bShow, const SystemAddress& sysAddr) {
|
||||
void GameMessages::SendShowPetActionButton(const LWOOBJID objectId, const ePetAbilityType petAbility, const bool bShow, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -4240,7 +4258,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in
|
||||
LWOOBJID pickupObjID = LWOOBJID_EMPTY;
|
||||
LWOOBJID pickupSpawnerID = LWOOBJID_EMPTY;
|
||||
int32_t pickupSpawnerIndex = -1;
|
||||
NiPoint3 vehiclePosition = NiPoint3::ZERO;
|
||||
NiPoint3 vehiclePosition = NiPoint3Constant::ZERO;
|
||||
|
||||
if (inStream->ReadBit()) inStream->Read(pickupObjID);
|
||||
if (inStream->ReadBit()) inStream->Read(pickupSpawnerID);
|
||||
@@ -4644,10 +4662,11 @@ void GameMessages::HandleToggleGhostReferenceOverride(RakNet::BitStream* inStrea
|
||||
|
||||
inStream->Read(bOverride);
|
||||
|
||||
auto* player = Player::GetPlayer(sysAddr);
|
||||
auto* player = PlayerManager::GetPlayer(sysAddr);
|
||||
|
||||
if (player != nullptr) {
|
||||
player->SetGhostOverride(bOverride);
|
||||
auto* ghostComponent = entity->GetComponent<GhostComponent>();
|
||||
if (ghostComponent) ghostComponent->SetGhostOverride(bOverride);
|
||||
|
||||
Game::entityManager->UpdateGhosting(player);
|
||||
}
|
||||
@@ -4659,10 +4678,11 @@ void GameMessages::HandleSetGhostReferencePosition(RakNet::BitStream* inStream,
|
||||
|
||||
inStream->Read(position);
|
||||
|
||||
auto* player = Player::GetPlayer(sysAddr);
|
||||
auto* player = PlayerManager::GetPlayer(sysAddr);
|
||||
|
||||
if (player != nullptr) {
|
||||
player->SetGhostOverridePoint(position);
|
||||
auto* ghostComponent = entity->GetComponent<GhostComponent>();
|
||||
if (ghostComponent) ghostComponent->SetGhostOverridePoint(position);
|
||||
|
||||
Game::entityManager->UpdateGhosting(player);
|
||||
}
|
||||
@@ -4670,7 +4690,7 @@ void GameMessages::HandleSetGhostReferencePosition(RakNet::BitStream* inStream,
|
||||
|
||||
|
||||
void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
bool bConfirmed{}; // this doesnt even do anything, thanks ND!
|
||||
bool bConfirmed{}; // This doesn't appear to do anything. Further research is needed.
|
||||
bool countIsDefault{};
|
||||
int count = 1;
|
||||
LOT item;
|
||||
@@ -4706,8 +4726,8 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
return;
|
||||
}
|
||||
|
||||
CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
|
||||
CDItemComponentTable* itemComponentTable = CDClientManager::Instance().GetTable<CDItemComponentTable>();
|
||||
CDComponentsRegistryTable* compRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
|
||||
CDItemComponentTable* itemComponentTable = CDClientManager::GetTable<CDItemComponentTable>();
|
||||
|
||||
int itemCompID = compRegistryTable->GetByIDAndType(item, eReplicaComponentType::ITEM);
|
||||
CDItemComponent itemComp = itemComponentTable->GetItemComponentByID(itemCompID);
|
||||
@@ -4798,8 +4818,8 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
|
||||
Item* item = inv->FindItemById(iObjID);
|
||||
if (!item) return;
|
||||
|
||||
CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
|
||||
CDItemComponentTable* itemComponentTable = CDClientManager::Instance().GetTable<CDItemComponentTable>();
|
||||
CDComponentsRegistryTable* compRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
|
||||
CDItemComponentTable* itemComponentTable = CDClientManager::GetTable<CDItemComponentTable>();
|
||||
|
||||
int itemCompID = compRegistryTable->GetByIDAndType(item->GetLot(), eReplicaComponentType::ITEM);
|
||||
CDItemComponent itemComp = itemComponentTable->GetItemComponentByID(itemCompID);
|
||||
@@ -4848,8 +4868,8 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
|
||||
Item* item = inv->FindItemById(iObjID);
|
||||
if (!item) return;
|
||||
|
||||
CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
|
||||
CDItemComponentTable* itemComponentTable = CDClientManager::Instance().GetTable<CDItemComponentTable>();
|
||||
CDComponentsRegistryTable* compRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
|
||||
CDItemComponentTable* itemComponentTable = CDClientManager::GetTable<CDItemComponentTable>();
|
||||
|
||||
int itemCompID = compRegistryTable->GetByIDAndType(item->GetLot(), eReplicaComponentType::ITEM);
|
||||
CDItemComponent itemComp = itemComponentTable->GetItemComponentByID(itemCompID);
|
||||
@@ -4923,7 +4943,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity
|
||||
inStream->Read(senderID);
|
||||
|
||||
auto* sender = Game::entityManager->GetEntity(senderID);
|
||||
auto* player = Player::GetPlayer(sysAddr);
|
||||
auto* player = PlayerManager::GetPlayer(sysAddr);
|
||||
|
||||
if (!player) {
|
||||
return;
|
||||
@@ -5061,7 +5081,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
|
||||
if (emoteID == 0) return;
|
||||
std::string sAnimationName = "deaded"; //Default name in case we fail to get the emote
|
||||
|
||||
CDEmoteTableTable* emotes = CDClientManager::Instance().GetTable<CDEmoteTableTable>();
|
||||
CDEmoteTableTable* emotes = CDClientManager::GetTable<CDEmoteTableTable>();
|
||||
if (emotes) {
|
||||
CDEmoteTable* emote = emotes->GetEmote(emoteID);
|
||||
if (emote) sAnimationName = emote->animationName;
|
||||
@@ -5130,13 +5150,8 @@ void GameMessages::HandleSetFlag(RakNet::BitStream* inStream, Entity* entity) {
|
||||
inStream->Read(bFlag);
|
||||
inStream->Read(iFlagID);
|
||||
|
||||
auto user = entity->GetParentUser();
|
||||
if (user) {
|
||||
auto character = user->GetLastUsedChar();
|
||||
if (!character) return;
|
||||
|
||||
character->SetPlayerFlag(iFlagID, bFlag);
|
||||
}
|
||||
auto character = entity->GetCharacter();
|
||||
if (character) character->SetPlayerFlag(iFlagID, bFlag);
|
||||
}
|
||||
|
||||
void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* entity) {
|
||||
|
@@ -34,6 +34,7 @@ enum class eObjectWorldState : uint32_t;
|
||||
enum class eTerminateType : uint32_t;
|
||||
enum class eControlScheme : uint32_t;
|
||||
enum class eStateChangeType : uint32_t;
|
||||
enum class ePetAbilityType : uint32_t;
|
||||
enum class ePetTamingNotifyType : uint32_t;
|
||||
enum class eUseItemResponse : uint32_t;
|
||||
enum class eQuickBuildFailReason : uint32_t;
|
||||
@@ -56,14 +57,14 @@ namespace GameMessages {
|
||||
const SystemAddress& sysAddr,
|
||||
bool bFirstTime = true,
|
||||
const LWOOBJID& buildAreaID = LWOOBJID_EMPTY,
|
||||
NiPoint3 buildStartPOS = NiPoint3::ZERO,
|
||||
NiPoint3 buildStartPOS = NiPoint3Constant::ZERO,
|
||||
int sourceBAG = 0,
|
||||
const LWOOBJID& sourceID = LWOOBJID_EMPTY,
|
||||
LOT sourceLOT = 0,
|
||||
int sourceTYPE = 8,
|
||||
const LWOOBJID& targetID = 0,
|
||||
LOT targetLOT = 0,
|
||||
NiPoint3 targetPOS = NiPoint3::ZERO,
|
||||
NiPoint3 targetPOS = NiPoint3Constant::ZERO,
|
||||
int targetTYPE = 0
|
||||
);
|
||||
|
||||
@@ -94,6 +95,9 @@ namespace GameMessages {
|
||||
|
||||
void SendModifyLEGOScore(Entity* entity, const SystemAddress& sysAddr, int64_t score, eLootSourceType sourceType);
|
||||
void SendUIMessageServerToSingleClient(Entity* entity, const SystemAddress& sysAddr, const std::string& message, AMFBaseValue& args);
|
||||
|
||||
// Specify sysAddr if you need to send a flash message to a client who you dont know the objectID of.
|
||||
void SendUIMessageServerToSingleClient(const std::string& message, AMFBaseValue& args, const SystemAddress& sysAddr);
|
||||
void SendUIMessageServerToAllClients(const std::string& message, AMFBaseValue& args);
|
||||
|
||||
void SendPlayEmbeddedEffectOnAllClientsNearObject(Entity* entity, std::u16string effectName, const LWOOBJID& fromObjectID, float radius);
|
||||
@@ -121,7 +125,7 @@ namespace GameMessages {
|
||||
void SendStop2DAmbientSound(Entity* entity, bool force, std::string audioGUID, bool result = false);
|
||||
void SendPlay2DAmbientSound(Entity* entity, std::string audioGUID, bool result = false);
|
||||
void SendSetNetworkScriptVar(Entity* entity, const SystemAddress& sysAddr, std::string data);
|
||||
void SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID, LOT item, int currency, NiPoint3 spawnPos = NiPoint3::ZERO, int count = 1);
|
||||
void SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID, LOT item, int currency, NiPoint3 spawnPos = NiPoint3Constant::ZERO, int count = 1);
|
||||
|
||||
void SendSetPlayerControlScheme(Entity* entity, eControlScheme controlScheme);
|
||||
void SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPoint3& position, const NiQuaternion& rotation);
|
||||
@@ -238,7 +242,7 @@ namespace GameMessages {
|
||||
|
||||
void SendLockNodeRotation(Entity* entity, std::string nodeName);
|
||||
|
||||
void SendSetBuildModeConfirmed(LWOOBJID objectId, const SystemAddress& sysAddr, bool start, bool warnVisitors, bool modePaused, int32_t modeValue, LWOOBJID playerId, NiPoint3 startPos = NiPoint3::ZERO);
|
||||
void SendSetBuildModeConfirmed(LWOOBJID objectId, const SystemAddress& sysAddr, bool start, bool warnVisitors, bool modePaused, int32_t modeValue, LWOOBJID playerId, NiPoint3 startPos = NiPoint3Constant::ZERO);
|
||||
|
||||
void SendGetModelsOnProperty(LWOOBJID objectId, std::map<LWOOBJID, LWOOBJID> models, const SystemAddress& sysAddr);
|
||||
|
||||
@@ -389,7 +393,7 @@ namespace GameMessages {
|
||||
|
||||
void SendClientExitTamingMinigame(LWOOBJID objectId, bool bVoluntaryExit, const SystemAddress& sysAddr);
|
||||
|
||||
void SendShowPetActionButton(const LWOOBJID& objectId, const ePetAbilityType petAbility, const bool bShow, const SystemAddress& sysAddr);
|
||||
void SendShowPetActionButton(const LWOOBJID objectId, const ePetAbilityType petAbility, const bool bShow, const SystemAddress& sysAddr);
|
||||
|
||||
void SendPlayEmote(LWOOBJID objectId, int32_t emoteID, LWOOBJID target, const SystemAddress& sysAddr);
|
||||
|
||||
|
@@ -103,7 +103,7 @@ void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) con
|
||||
}
|
||||
|
||||
GameMessages::PropertyDataMessage::PropertyDataMessage(uint32_t mapID) {
|
||||
const auto propertyTemplate = CDClientManager::Instance().GetTable<CDPropertyTemplateTable>()->GetByMapID(mapID);
|
||||
const auto propertyTemplate = CDClientManager::GetTable<CDPropertyTemplateTable>()->GetByMapID(mapID);
|
||||
|
||||
TemplateID = propertyTemplate.id;
|
||||
ZoneId = propertyTemplate.mapID;
|
||||
|
@@ -16,13 +16,13 @@ public:
|
||||
consumableItemID = LWOOBJID_EMPTY;
|
||||
fCasterLatency = 0.0f;
|
||||
iCastType = 0;
|
||||
lastClickedPosit = NiPoint3::ZERO;
|
||||
lastClickedPosit = NiPoint3Constant::ZERO;
|
||||
optionalTargetID = LWOOBJID_EMPTY;
|
||||
originatorRot = NiQuaternion::IDENTITY;
|
||||
originatorRot = NiQuaternionConstant::IDENTITY;
|
||||
uiSkillHandle = 0;
|
||||
}
|
||||
|
||||
StartSkill(LWOOBJID _optionalOriginatorID, std::string _sBitStream, TSkillID _skillID, bool _bUsedMouse = false, LWOOBJID _consumableItemID = LWOOBJID_EMPTY, float _fCasterLatency = 0.0f, int32_t _iCastType = 0, NiPoint3 _lastClickedPosit = NiPoint3::ZERO, LWOOBJID _optionalTargetID = LWOOBJID_EMPTY, NiQuaternion _originatorRot = NiQuaternion::IDENTITY, uint32_t _uiSkillHandle = 0) {
|
||||
StartSkill(LWOOBJID _optionalOriginatorID, std::string _sBitStream, TSkillID _skillID, bool _bUsedMouse = false, LWOOBJID _consumableItemID = LWOOBJID_EMPTY, float _fCasterLatency = 0.0f, int32_t _iCastType = 0, NiPoint3 _lastClickedPosit = NiPoint3Constant::ZERO, LWOOBJID _optionalTargetID = LWOOBJID_EMPTY, NiQuaternion _originatorRot = NiQuaternionConstant::IDENTITY, uint32_t _uiSkillHandle = 0) {
|
||||
bUsedMouse = _bUsedMouse;
|
||||
consumableItemID = _consumableItemID;
|
||||
fCasterLatency = _fCasterLatency;
|
||||
@@ -57,16 +57,16 @@ public:
|
||||
stream->Write(iCastType != 0);
|
||||
if (iCastType != 0) stream->Write(iCastType);
|
||||
|
||||
stream->Write(lastClickedPosit != NiPoint3::ZERO);
|
||||
if (lastClickedPosit != NiPoint3::ZERO) stream->Write(lastClickedPosit);
|
||||
stream->Write(lastClickedPosit != NiPoint3Constant::ZERO);
|
||||
if (lastClickedPosit != NiPoint3Constant::ZERO) stream->Write(lastClickedPosit);
|
||||
|
||||
stream->Write(optionalOriginatorID);
|
||||
|
||||
stream->Write(optionalTargetID != LWOOBJID_EMPTY);
|
||||
if (optionalTargetID != LWOOBJID_EMPTY) stream->Write(optionalTargetID);
|
||||
|
||||
stream->Write(originatorRot != NiQuaternion::IDENTITY);
|
||||
if (originatorRot != NiQuaternion::IDENTITY) stream->Write(originatorRot);
|
||||
stream->Write(originatorRot != NiQuaternionConstant::IDENTITY);
|
||||
if (originatorRot != NiQuaternionConstant::IDENTITY) stream->Write(originatorRot);
|
||||
|
||||
uint32_t sBitStreamLength = sBitStream.length();
|
||||
stream->Write(sBitStreamLength);
|
||||
|
Reference in New Issue
Block a user