mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-09 05:17:17 +00:00
Breakout rest of the enums from dCommonVars and clean it up (#1061)
* Breakout rest of the enums from dcommonvars so we don't have to deal with merge conflicts ePlayerFlags is not a scoped enum, yet, due to it's complexity * address feedback * make player flag types consistent * fix typo
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "eMissionState.h"
|
||||
#include "eObjectBits.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "ePlayerFlag.h"
|
||||
|
||||
Character::Character(uint32_t id, User* parentUser) {
|
||||
//First load the name, etc:
|
||||
@@ -362,9 +363,9 @@ void Character::SaveXMLToDatabase() {
|
||||
}
|
||||
|
||||
// Prevents the news feed from showing up on world transfers
|
||||
if (GetPlayerFlag(ePlayerFlags::IS_NEWS_SCREEN_VISIBLE)) {
|
||||
if (GetPlayerFlag(ePlayerFlag::IS_NEWS_SCREEN_VISIBLE)) {
|
||||
auto* s = m_Doc->NewElement("s");
|
||||
s->SetAttribute("si", ePlayerFlags::IS_NEWS_SCREEN_VISIBLE);
|
||||
s->SetAttribute("si", ePlayerFlag::IS_NEWS_SCREEN_VISIBLE);
|
||||
flags->LinkEndChild(s);
|
||||
}
|
||||
|
||||
@@ -417,7 +418,7 @@ void Character::WriteToDatabase() {
|
||||
delete printer;
|
||||
}
|
||||
|
||||
void Character::SetPlayerFlag(const uint32_t flagId, const bool value) {
|
||||
void Character::SetPlayerFlag(const int32_t flagId, const bool value) {
|
||||
// If the flag is already set, we don't have to recalculate it
|
||||
if (GetPlayerFlag(flagId) == value) return;
|
||||
|
||||
@@ -464,7 +465,7 @@ void Character::SetPlayerFlag(const uint32_t flagId, const bool value) {
|
||||
GameMessages::SendNotifyClientFlagChange(m_ObjectID, flagId, value, m_ParentUser->GetSystemAddress());
|
||||
}
|
||||
|
||||
bool Character::GetPlayerFlag(const uint32_t flagId) const {
|
||||
bool Character::GetPlayerFlag(const int32_t flagId) const {
|
||||
// Calculate the index first
|
||||
const auto flagIndex = uint32_t(std::floor(flagId / 64));
|
||||
|
||||
@@ -481,8 +482,8 @@ bool Character::GetPlayerFlag(const uint32_t flagId) const {
|
||||
|
||||
void Character::SetRetroactiveFlags() {
|
||||
// Retroactive check for if player has joined a faction to set their 'joined a faction' flag to true.
|
||||
if (GetPlayerFlag(ePlayerFlags::VENTURE_FACTION) || GetPlayerFlag(ePlayerFlags::ASSEMBLY_FACTION) || GetPlayerFlag(ePlayerFlags::PARADOX_FACTION) || GetPlayerFlag(ePlayerFlags::SENTINEL_FACTION)) {
|
||||
SetPlayerFlag(ePlayerFlags::JOINED_A_FACTION, true);
|
||||
if (GetPlayerFlag(ePlayerFlag::VENTURE_FACTION) || GetPlayerFlag(ePlayerFlag::ASSEMBLY_FACTION) || GetPlayerFlag(ePlayerFlag::PARADOX_FACTION) || GetPlayerFlag(ePlayerFlag::SENTINEL_FACTION)) {
|
||||
SetPlayerFlag(ePlayerFlag::JOINED_A_FACTION, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,7 +543,7 @@ void Character::OnZoneLoad() {
|
||||
if (missionComponent != nullptr) {
|
||||
// Fix the monument race flag
|
||||
if (missionComponent->GetMissionState(319) >= eMissionState::READY_TO_COMPLETE) {
|
||||
SetPlayerFlag(33, true);
|
||||
SetPlayerFlag(ePlayerFlag::AG_FINISH_LINE_BUILT, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,7 +559,7 @@ void Character::OnZoneLoad() {
|
||||
*/
|
||||
if (HasPermission(ePermissionMap::Old)) {
|
||||
if (GetCoins() > 1000000) {
|
||||
SetCoins(1000000, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
SetCoins(1000000, eLootSourceType::NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -636,7 +637,7 @@ void Character::SetBillboardVisible(bool visible) {
|
||||
|
||||
// The GameMessage we send for turning the nameplate off just deletes the BillboardSubcomponent from the parent component.
|
||||
// Because that same message does not allow for custom parameters, we need to create the BillboardSubcomponent a different way
|
||||
// This workaround involves sending an unrelated GameMessage that does not apply to player entites,
|
||||
// This workaround involves sending an unrelated GameMessage that does not apply to player entites,
|
||||
// but forces the client to create the necessary SubComponent that controls the billboard.
|
||||
GameMessages::SendShowBillboardInteractIcon(UNASSIGNED_SYSTEM_ADDRESS, m_OurEntity->GetObjectID());
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ struct Packet;
|
||||
class Entity;
|
||||
enum class ePermissionMap : uint64_t;
|
||||
enum class eGameMasterLevel : uint8_t;
|
||||
enum class eLootSourceType : uint32_t;
|
||||
|
||||
/**
|
||||
* Meta information about a character, like their name and style
|
||||
@@ -414,14 +415,14 @@ public:
|
||||
* @param flagId the ID of the flag to set
|
||||
* @param value the value to set for the flag
|
||||
*/
|
||||
void SetPlayerFlag(uint32_t flagId, bool value);
|
||||
void SetPlayerFlag(int32_t flagId, bool value);
|
||||
|
||||
/**
|
||||
* Gets the value for a certain character flag
|
||||
* @param flagId the ID of the flag to get a value for
|
||||
* @return the value of the flag given the ID (the default is false, obviously)
|
||||
*/
|
||||
bool GetPlayerFlag(uint32_t flagId) const;
|
||||
bool GetPlayerFlag(int32_t flagId) const;
|
||||
|
||||
/**
|
||||
* Notifies the character that they're now muted
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
#include "TriggerComponent.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eReplicaPacketType.h"
|
||||
|
||||
// Table includes
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
@@ -876,7 +877,7 @@ void Entity::SetGMLevel(eGameMasterLevel value) {
|
||||
}
|
||||
|
||||
void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacketType packetType) {
|
||||
if (packetType == PACKET_TYPE_CONSTRUCTION) {
|
||||
if (packetType == eReplicaPacketType::CONSTRUCTION) {
|
||||
outBitStream->Write(m_ObjectID);
|
||||
outBitStream->Write(m_TemplateID);
|
||||
|
||||
@@ -978,8 +979,8 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke
|
||||
}
|
||||
|
||||
// Only serialize parent / child info should the info be dirty (changed) or if this is the construction of the entity.
|
||||
outBitStream->Write(m_IsParentChildDirty || packetType == PACKET_TYPE_CONSTRUCTION);
|
||||
if (m_IsParentChildDirty || packetType == PACKET_TYPE_CONSTRUCTION) {
|
||||
outBitStream->Write(m_IsParentChildDirty || packetType == eReplicaPacketType::CONSTRUCTION);
|
||||
if (m_IsParentChildDirty || packetType == eReplicaPacketType::CONSTRUCTION) {
|
||||
m_IsParentChildDirty = false;
|
||||
outBitStream->Write(m_ParentEntity != nullptr);
|
||||
if (m_ParentEntity) {
|
||||
@@ -1004,7 +1005,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
|
||||
bool destroyableSerialized = false;
|
||||
bool bIsInitialUpdate = false;
|
||||
if (packetType == PACKET_TYPE_CONSTRUCTION) bIsInitialUpdate = true;
|
||||
if (packetType == eReplicaPacketType::CONSTRUCTION) bIsInitialUpdate = true;
|
||||
unsigned int flags = 0;
|
||||
|
||||
PossessableComponent* possessableComponent;
|
||||
@@ -1624,7 +1625,7 @@ void Entity::PickupItem(const LWOOBJID& objectID) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
inv->AddItem(p.second.lot, p.second.count, eLootSourceType::LOOT_SOURCE_PICKUP, eInventoryType::INVALID, {}, LWOOBJID_EMPTY, true, false, LWOOBJID_EMPTY, eInventoryType::INVALID, 1);
|
||||
inv->AddItem(p.second.lot, p.second.count, eLootSourceType::PICKUP, eInventoryType::INVALID, {}, LWOOBJID_EMPTY, true, false, LWOOBJID_EMPTY, eInventoryType::INVALID, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "NiPoint3.h"
|
||||
#include "NiQuaternion.h"
|
||||
#include "LDFFormat.h"
|
||||
#include "eKillType.h"
|
||||
|
||||
namespace Loot {
|
||||
class Info;
|
||||
@@ -33,6 +34,8 @@ class EntityCallbackTimer;
|
||||
enum class eTriggerEventType;
|
||||
enum class eGameMasterLevel : uint8_t;
|
||||
enum class eReplicaComponentType : uint32_t;
|
||||
enum class eReplicaPacketType : uint8_t;
|
||||
enum class eCinematicEvent : uint32_t;
|
||||
|
||||
namespace CppScripts {
|
||||
class Script;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "eObjectBits.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eReplicaPacketType.h"
|
||||
|
||||
EntityManager* EntityManager::m_Address = nullptr;
|
||||
|
||||
@@ -197,8 +198,8 @@ void EntityManager::UpdateEntities(const float deltaTime) {
|
||||
stream.Write(static_cast<char>(ID_REPLICA_MANAGER_SERIALIZE));
|
||||
stream.Write(static_cast<unsigned short>(entity->GetNetworkId()));
|
||||
|
||||
entity->WriteBaseReplicaData(&stream, PACKET_TYPE_SERIALIZATION);
|
||||
entity->WriteComponents(&stream, PACKET_TYPE_SERIALIZATION);
|
||||
entity->WriteBaseReplicaData(&stream, eReplicaPacketType::SERIALIZATION);
|
||||
entity->WriteComponents(&stream, eReplicaPacketType::SERIALIZATION);
|
||||
|
||||
if (entity->GetIsGhostingCandidate()) {
|
||||
for (auto* player : Player::GetAllPlayers()) {
|
||||
@@ -218,9 +219,9 @@ void EntityManager::UpdateEntities(const float deltaTime) {
|
||||
if (!entity) continue;
|
||||
|
||||
if (entity->GetScheduledKiller()) {
|
||||
entity->Smash(entity->GetScheduledKiller()->GetObjectID(), SILENT);
|
||||
entity->Smash(entity->GetScheduledKiller()->GetObjectID(), eKillType::SILENT);
|
||||
} else {
|
||||
entity->Smash(LWOOBJID_EMPTY, SILENT);
|
||||
entity->Smash(LWOOBJID_EMPTY, eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
m_EntitiesToKill.clear();
|
||||
@@ -352,8 +353,8 @@ void EntityManager::ConstructEntity(Entity* entity, const SystemAddress& sysAddr
|
||||
stream.Write(true);
|
||||
stream.Write(static_cast<unsigned short>(entity->GetNetworkId()));
|
||||
|
||||
entity->WriteBaseReplicaData(&stream, PACKET_TYPE_CONSTRUCTION);
|
||||
entity->WriteComponents(&stream, PACKET_TYPE_CONSTRUCTION);
|
||||
entity->WriteBaseReplicaData(&stream, eReplicaPacketType::CONSTRUCTION);
|
||||
entity->WriteComponents(&stream, eReplicaPacketType::CONSTRUCTION);
|
||||
|
||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) {
|
||||
if (skipChecks) {
|
||||
|
||||
@@ -156,21 +156,21 @@ void Trade::Complete() {
|
||||
}
|
||||
|
||||
// Now actually do the trade.
|
||||
characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||
characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||
characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB, eLootSourceType::TRADE);
|
||||
characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, eLootSourceType::TRADE);
|
||||
|
||||
for (const auto& tradeItem : m_ItemsA) {
|
||||
auto* itemToRemove = inventoryA->FindItemById(tradeItem.itemId);
|
||||
if (itemToRemove) itemToRemove->SetCount(itemToRemove->GetCount() - tradeItem.itemCount);
|
||||
missionsA->Progress(eMissionTaskType::GATHER, tradeItem.itemLot, LWOOBJID_EMPTY, "", -tradeItem.itemCount);
|
||||
inventoryB->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||
inventoryB->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::TRADE);
|
||||
}
|
||||
|
||||
for (const auto& tradeItem : m_ItemsB) {
|
||||
auto* itemToRemove = inventoryB->FindItemById(tradeItem.itemId);
|
||||
if (itemToRemove) itemToRemove->SetCount(itemToRemove->GetCount() - tradeItem.itemCount);
|
||||
missionsB->Progress(eMissionTaskType::GATHER, tradeItem.itemLot, LWOOBJID_EMPTY, "", -tradeItem.itemCount);
|
||||
inventoryA->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||
inventoryA->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::TRADE);
|
||||
}
|
||||
|
||||
characterA->SaveXMLToDatabase();
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "dMessageIdentifiers.h"
|
||||
#include "eObjectBits.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eCharacterCreationResponse.h"
|
||||
#include "eRenameResponse.h"
|
||||
|
||||
UserManager* UserManager::m_Address = nullptr;
|
||||
|
||||
@@ -269,13 +271,13 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
|
||||
|
||||
if (name != "" && !UserManager::IsNameAvailable(name)) {
|
||||
Game::logger->Log("UserManager", "AccountID: %i chose unavailable name: %s", u->GetAccountID(), name.c_str());
|
||||
WorldPackets::SendCharacterCreationResponse(sysAddr, CREATION_RESPONSE_CUSTOM_NAME_IN_USE);
|
||||
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::CUSTOM_NAME_IN_USE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsNameAvailable(predefinedName)) {
|
||||
Game::logger->Log("UserManager", "AccountID: %i chose unavailable predefined name: %s", u->GetAccountID(), predefinedName.c_str());
|
||||
WorldPackets::SendCharacterCreationResponse(sysAddr, CREATION_RESPONSE_PREDEFINED_NAME_IN_USE);
|
||||
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::PREDEFINED_NAME_IN_USE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -294,7 +296,7 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
|
||||
|
||||
if (overlapResult->next()) {
|
||||
Game::logger->Log("UserManager", "Character object id unavailable, check objectidtracker!");
|
||||
WorldPackets::SendCharacterCreationResponse(sysAddr, CREATION_RESPONSE_OBJECT_ID_UNAVAILABLE);
|
||||
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::OBJECT_ID_UNAVAILABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -370,7 +372,7 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
|
||||
stmt->execute();
|
||||
delete stmt;
|
||||
|
||||
WorldPackets::SendCharacterCreationResponse(sysAddr, CREATION_RESPONSE_SUCCESS);
|
||||
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::SUCCESS);
|
||||
UserManager::RequestCharacterList(sysAddr);
|
||||
});
|
||||
});
|
||||
@@ -500,10 +502,10 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
||||
|
||||
if (!hasCharacter || !character) {
|
||||
Game::logger->Log("UserManager", "User %i tried to rename a character that it does not own!", u->GetAccountID());
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, RENAME_RESPONSE_UNKNOWN_ERROR);
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::UNKNOWN_ERROR);
|
||||
} else if (hasCharacter && character) {
|
||||
if (newName == character->GetName()) {
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, RENAME_RESPONSE_NAME_UNAVAILABLE);
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::NAME_UNAVAILABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -517,7 +519,7 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
||||
delete stmt;
|
||||
|
||||
Game::logger->Log("UserManager", "Character %s now known as %s", character->GetName().c_str(), newName.c_str());
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, RENAME_RESPONSE_SUCCESS);
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::SUCCESS);
|
||||
UserManager::RequestCharacterList(sysAddr);
|
||||
} else {
|
||||
sql::PreparedStatement* stmt = Database::CreatePreppedStmt("UPDATE charinfo SET pending_name=?, needs_rename=0, last_login=? WHERE id=? LIMIT 1");
|
||||
@@ -528,15 +530,15 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
||||
delete stmt;
|
||||
|
||||
Game::logger->Log("UserManager", "Character %s has been renamed to %s and is pending approval by a moderator.", character->GetName().c_str(), newName.c_str());
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, RENAME_RESPONSE_SUCCESS);
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::SUCCESS);
|
||||
UserManager::RequestCharacterList(sysAddr);
|
||||
}
|
||||
} else {
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, RENAME_RESPONSE_NAME_IN_USE);
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::NAME_IN_USE);
|
||||
}
|
||||
} else {
|
||||
Game::logger->Log("UserManager", "Unknown error occurred when renaming character, either hasCharacter or character variable != true.");
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, RENAME_RESPONSE_UNKNOWN_ERROR);
|
||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::UNKNOWN_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "dLogger.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "ControllablePhysicsComponent.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
@@ -248,7 +248,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
|
||||
if (rebuild != nullptr) {
|
||||
const auto state = rebuild->GetState();
|
||||
|
||||
if (state != REBUILD_COMPLETED) {
|
||||
if (state != eRebuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -566,7 +566,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
|
||||
if (quickbuild != nullptr) {
|
||||
const auto state = quickbuild->GetState();
|
||||
|
||||
if (state != REBUILD_COMPLETED) {
|
||||
if (state != eRebuildState::COMPLETED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "Item.h"
|
||||
#include "AMFFormat.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eGameActivity.h"
|
||||
|
||||
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
|
||||
m_Character = character;
|
||||
@@ -35,7 +36,7 @@ CharacterComponent::CharacterComponent(Entity* parent, Character* character) : C
|
||||
m_EditorLevel = m_GMLevel;
|
||||
m_Reputation = 0;
|
||||
|
||||
m_CurrentActivity = 0;
|
||||
m_CurrentActivity = eGameActivity::NONE;
|
||||
m_CountryCode = 0;
|
||||
m_LastUpdateTimestamp = std::time(nullptr);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "tinyxml2.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
enum class eGameActivity : uint32_t;
|
||||
|
||||
/**
|
||||
* The statistics that can be achieved per zone
|
||||
*/
|
||||
@@ -112,13 +114,13 @@ public:
|
||||
* Gets the current activity that the character is partaking in, see ScriptedActivityComponent for more details
|
||||
* @return the current activity that the character is partaking in
|
||||
*/
|
||||
const uint32_t GetCurrentActivity() const { return m_CurrentActivity; }
|
||||
const eGameActivity GetCurrentActivity() const { return m_CurrentActivity; }
|
||||
|
||||
/**
|
||||
* Set the current activity of the character, see ScriptedActivityComponent for more details
|
||||
* @param currentActivity the activity to set
|
||||
*/
|
||||
void SetCurrentActivity(uint32_t currentActivity) { m_CurrentActivity = currentActivity; m_DirtyCurrentActivity = true; }
|
||||
void SetCurrentActivity(eGameActivity currentActivity) { m_CurrentActivity = currentActivity; m_DirtyCurrentActivity = true; }
|
||||
|
||||
/**
|
||||
* Gets if the entity is currently racing
|
||||
@@ -353,7 +355,7 @@ private:
|
||||
/**
|
||||
* The ID of the curently active activity
|
||||
*/
|
||||
int m_CurrentActivity;
|
||||
eGameActivity m_CurrentActivity;
|
||||
|
||||
/**
|
||||
* Whether the social info has been changed
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "Character.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity) : Component(entity) {
|
||||
m_Position = {};
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
class Entity;
|
||||
class dpEntity;
|
||||
enum class eStateChangeType : uint32_t;
|
||||
|
||||
/**
|
||||
* Handles the movement of controllable Entities, e.g. enemies and players
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "dZoneManager.h"
|
||||
#include "WorldConfig.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eStateChangeType.h"
|
||||
#include "eGameActivity.h"
|
||||
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
|
||||
@@ -468,7 +470,7 @@ bool DestroyableComponent::IsKnockbackImmune() const {
|
||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto* inventoryComponent = m_Parent->GetComponent<InventoryComponent>();
|
||||
|
||||
if (characterComponent != nullptr && inventoryComponent != nullptr && characterComponent->GetCurrentActivity() == eGameActivities::ACTIVITY_QUICKBUILDING) {
|
||||
if (characterComponent != nullptr && inventoryComponent != nullptr && characterComponent->GetCurrentActivity() == eGameActivity::QUICKBUILDING) {
|
||||
const auto hasPassive = inventoryComponent->HasAnyPassive({
|
||||
eItemSetPassiveAbilityID::EngineerRank2, eItemSetPassiveAbilityID::EngineerRank3,
|
||||
eItemSetPassiveAbilityID::SummonerRank2, eItemSetPassiveAbilityID::SummonerRank3,
|
||||
@@ -514,7 +516,7 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor
|
||||
if (targetQuickbuild != nullptr) {
|
||||
const auto state = targetQuickbuild->GetState();
|
||||
|
||||
if (state != REBUILD_COMPLETED) {
|
||||
if (state != eRebuildState::COMPLETED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -803,7 +805,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
coinsTotal -= coinsToLose;
|
||||
|
||||
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLose, coinsToLose);
|
||||
character->SetCoins(coinsTotal, eLootSourceType::LOOT_SOURCE_PICKUP);
|
||||
character->SetCoins(coinsTotal, eLootSourceType::PICKUP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -992,7 +994,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
auto uscoreToLose = uscore * (EntityManager::Instance()->GetHardcoreLoseUscoreOnDeathPercent() / 100);
|
||||
character->SetUScore(uscore - uscoreToLose);
|
||||
|
||||
GameMessages::SendModifyLEGOScore(m_Parent, m_Parent->GetSystemAddress(), -uscoreToLose, eLootSourceType::LOOT_SOURCE_MISSION);
|
||||
GameMessages::SendModifyLEGOScore(m_Parent, m_Parent->GetSystemAddress(), -uscoreToLose, eLootSourceType::MISSION);
|
||||
|
||||
if (EntityManager::Instance()->GetHardcoreDropinventoryOnDeath()) {
|
||||
//drop all items from inventory:
|
||||
@@ -1023,7 +1025,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
auto coins = chars->GetCoins();
|
||||
|
||||
//lose all coins:
|
||||
chars->SetCoins(0, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
chars->SetCoins(0, eLootSourceType::NONE);
|
||||
|
||||
//drop all coins:
|
||||
GameMessages::SendDropClientLoot(m_Parent, source, LOT_NULL, coins, m_Parent->GetPosition());
|
||||
@@ -1047,7 +1049,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
int uscore = maxHealth * EntityManager::Instance()->GetHardcoreUscoreEnemiesMultiplier();
|
||||
|
||||
playerStats->SetUScore(playerStats->GetUScore() + uscore);
|
||||
GameMessages::SendModifyLEGOScore(player, player->GetSystemAddress(), uscore, eLootSourceType::LOOT_SOURCE_MISSION);
|
||||
GameMessages::SendModifyLEGOScore(player, player->GetSystemAddress(), uscore, eLootSourceType::MISSION);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
namespace CppScripts {
|
||||
class Script;
|
||||
}; //! namespace CppScripts
|
||||
enum class eStateChangeType : uint32_t;
|
||||
|
||||
/**
|
||||
* Represents the stats of an entity, for example its health, imagination and armor. Also handles factions, which
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "eUnequippableActiveType.h"
|
||||
#include "CppScripts.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eStateChangeType.h"
|
||||
#include "eUseItemResponse.h"
|
||||
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "CDInventoryComponentTable.h"
|
||||
@@ -356,7 +358,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
||||
|
||||
left -= delta;
|
||||
|
||||
AddItem(lot, delta, eLootSourceType::LOOT_SOURCE_NONE, inventory, {}, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, false, preferredSlot);
|
||||
AddItem(lot, delta, eLootSourceType::NONE, inventory, {}, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, false, preferredSlot);
|
||||
|
||||
item->SetCount(item->GetCount() - delta, false, false);
|
||||
|
||||
@@ -371,7 +373,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
||||
|
||||
const auto delta = std::min<uint32_t>(item->GetCount(), count);
|
||||
|
||||
AddItem(lot, delta, eLootSourceType::LOOT_SOURCE_NONE, inventory, config, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, subkey, origin->GetType(), 0, item->GetBound(), preferredSlot);
|
||||
AddItem(lot, delta, eLootSourceType::NONE, inventory, config, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, subkey, origin->GetType(), 0, item->GetBound(), preferredSlot);
|
||||
|
||||
item->SetCount(item->GetCount() - delta, false, false);
|
||||
}
|
||||
@@ -1247,7 +1249,7 @@ void InventoryComponent::SpawnPet(Item* item) {
|
||||
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (Game::config->GetValue("pets_take_imagination") == "1" && destroyableComponent && destroyableComponent->GetImagination() <= 0) {
|
||||
GameMessages::SendUseItemRequirementsResponse(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), UseItemResponse::NoImaginationForPet);
|
||||
GameMessages::SendUseItemRequirementsResponse(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), eUseItemResponse::NoImaginationForPet);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "PossessorComponent.h"
|
||||
#include "eInventoryType.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eLootSourceType.h"
|
||||
|
||||
class Entity;
|
||||
class ItemSet;
|
||||
@@ -99,7 +100,7 @@ public:
|
||||
void AddItem(
|
||||
LOT lot,
|
||||
uint32_t count,
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE,
|
||||
eLootSourceType lootSourceType = eLootSourceType::NONE,
|
||||
eInventoryType inventoryType = INVALID,
|
||||
const std::vector<LDFBaseData*>& config = {},
|
||||
LWOOBJID parent = LWOOBJID_EMPTY,
|
||||
|
||||
@@ -59,7 +59,7 @@ void LevelProgressionComponent::HandleLevelUp() {
|
||||
for (auto* reward : rewards) {
|
||||
switch (reward->rewardType) {
|
||||
case 0:
|
||||
inventoryComponent->AddItem(reward->value, reward->count, eLootSourceType::LOOT_SOURCE_LEVEL_REWARD);
|
||||
inventoryComponent->AddItem(reward->value, reward->count, eLootSourceType::LEVEL_REWARD);
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include "PetDigServer.h"
|
||||
#include "../dWorldServer/ObjectIDManager.h"
|
||||
#include "eUnequippableActiveType.h"
|
||||
#include "eTerminateType.h"
|
||||
#include "ePetTamingNotifyType.h"
|
||||
#include "eUseItemResponse.h"
|
||||
#include "ePlayerFlag.h"
|
||||
|
||||
#include "Game.h"
|
||||
#include "dConfig.h"
|
||||
@@ -33,7 +37,7 @@ std::unordered_map<LWOOBJID, LWOOBJID> PetComponent::activePets{};
|
||||
* Maps all the pet lots to a flag indicating that the player has caught it. All basic pets have been guessed by ObjID
|
||||
* while the faction ones could be checked using their respective missions.
|
||||
*/
|
||||
std::map<LOT, uint32_t> PetComponent::petFlags = {
|
||||
std::map<LOT, int32_t> PetComponent::petFlags = {
|
||||
{ 3050, 801 }, // Elephant
|
||||
{ 3054, 803 }, // Cat
|
||||
{ 3195, 806 }, // Triceratops
|
||||
@@ -285,7 +289,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
m_Parent->GetObjectID(),
|
||||
LWOOBJID_EMPTY,
|
||||
true,
|
||||
NOTIFY_TYPE_BEGIN,
|
||||
ePetTamingNotifyType::BEGIN,
|
||||
petPosition,
|
||||
position,
|
||||
rotation,
|
||||
@@ -297,7 +301,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
LWOOBJID_EMPTY,
|
||||
originator->GetObjectID(),
|
||||
true,
|
||||
NOTIFY_TYPE_BEGIN,
|
||||
ePetTamingNotifyType::BEGIN,
|
||||
petPosition,
|
||||
position,
|
||||
rotation,
|
||||
@@ -313,7 +317,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
|
||||
// Notify the start of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, originator, NOTIFY_TYPE_BEGIN);
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, originator, ePetTamingNotifyType::BEGIN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +570,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
|
||||
GameMessages::SendRegisterPetDBID(m_Tamer, petSubKey, tamer->GetSystemAddress());
|
||||
|
||||
inventoryComponent->AddItem(m_Parent->GetLOT(), 1, eLootSourceType::LOOT_SOURCE_ACTIVITY, eInventoryType::MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey);
|
||||
inventoryComponent->AddItem(m_Parent->GetLOT(), 1, eLootSourceType::ACTIVITY, eInventoryType::MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey);
|
||||
auto* item = inventoryComponent->FindItemBySubKey(petSubKey, MODELS);
|
||||
|
||||
if (item == nullptr) {
|
||||
@@ -590,7 +594,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
LWOOBJID_EMPTY,
|
||||
LWOOBJID_EMPTY,
|
||||
false,
|
||||
NOTIFY_TYPE_NAMINGPET,
|
||||
ePetTamingNotifyType::NAMINGPET,
|
||||
NiPoint3::ZERO,
|
||||
NiPoint3::ZERO,
|
||||
NiQuaternion::IDENTITY,
|
||||
@@ -670,7 +674,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
|
||||
m_Parent->GetObjectID(),
|
||||
m_Tamer,
|
||||
false,
|
||||
NOTIFY_TYPE_SUCCESS,
|
||||
ePetTamingNotifyType::SUCCESS,
|
||||
NiPoint3::ZERO,
|
||||
NiPoint3::ZERO,
|
||||
NiQuaternion::IDENTITY,
|
||||
@@ -691,7 +695,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, NOTIFY_TYPE_SUCCESS);
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, ePetTamingNotifyType::SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,7 +715,7 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
|
||||
m_Parent->GetObjectID(),
|
||||
m_Tamer,
|
||||
false,
|
||||
NOTIFY_TYPE_QUIT,
|
||||
ePetTamingNotifyType::QUIT,
|
||||
NiPoint3::ZERO,
|
||||
NiPoint3::ZERO,
|
||||
NiQuaternion::IDENTITY,
|
||||
@@ -732,7 +736,7 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, NOTIFY_TYPE_QUIT);
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, ePetTamingNotifyType::QUIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,7 +766,7 @@ void PetComponent::ClientFailTamingMinigame() {
|
||||
m_Parent->GetObjectID(),
|
||||
m_Tamer,
|
||||
false,
|
||||
NOTIFY_TYPE_FAILED,
|
||||
ePetTamingNotifyType::FAILED,
|
||||
NiPoint3::ZERO,
|
||||
NiPoint3::ZERO,
|
||||
NiQuaternion::IDENTITY,
|
||||
@@ -783,7 +787,7 @@ void PetComponent::ClientFailTamingMinigame() {
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, NOTIFY_TYPE_FAILED);
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, ePetTamingNotifyType::FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,7 +888,7 @@ void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming) {
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
|
||||
owner->GetCharacter()->SetPlayerFlag(69, true);
|
||||
owner->GetCharacter()->SetPlayerFlag(ePlayerFlag::FIRST_MANUAL_PET_HIBERNATE, true);
|
||||
|
||||
if (registerPet) {
|
||||
GameMessages::SendAddPetToPlayer(m_Owner, 0, GeneralUtils::UTF8ToUTF16(m_Name), m_DatabaseId, m_Parent->GetLOT(), owner->GetSystemAddress());
|
||||
@@ -928,7 +932,7 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
|
||||
auto playerEntity = playerDestroyableComponent->GetParent();
|
||||
if (!playerEntity) return;
|
||||
|
||||
GameMessages::SendUseItemRequirementsResponse(playerEntity->GetObjectID(), playerEntity->GetSystemAddress(), UseItemResponse::NoImaginationForPet);
|
||||
GameMessages::SendUseItemRequirementsResponse(playerEntity->GetObjectID(), playerEntity->GetSystemAddress(), eUseItemResponse::NoImaginationForPet);
|
||||
}
|
||||
|
||||
this->AddDrainImaginationTimer(item);
|
||||
|
||||
@@ -263,7 +263,7 @@ private:
|
||||
/**
|
||||
* Flags that indicate that a player has tamed a pet, indexed by the LOT of the pet
|
||||
*/
|
||||
static std::map<LOT, uint32_t> petFlags;
|
||||
static std::map<LOT, int32_t> petFlags;
|
||||
|
||||
/**
|
||||
* The ID of the component in the pet component table
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "eUnequippableActiveType.h"
|
||||
#include "eControlScheme.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
PossessorComponent::PossessorComponent(Entity* parent) : Component(parent) {
|
||||
m_Possessable = LWOOBJID_EMPTY;
|
||||
@@ -78,5 +80,5 @@ void PossessorComponent::Dismount(Entity* mount, bool forceDismount) {
|
||||
if (characterComponent) characterComponent->SetIsRacing(false);
|
||||
}
|
||||
// Make sure we don't have wacky controls
|
||||
GameMessages::SendSetPlayerControlScheme(m_Parent, eControlSceme::SCHEME_A);
|
||||
GameMessages::SendSetPlayerControlScheme(m_Parent, eControlScheme::SCHEME_A);
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
||||
settings.push_back(propertyObjectID);
|
||||
settings.push_back(modelType);
|
||||
|
||||
inventoryComponent->AddItem(6662, 1, eLootSourceType::LOOT_SOURCE_DELETION, eInventoryType::MODELS_IN_BBB, settings, LWOOBJID_EMPTY, false, false, spawnerId);
|
||||
inventoryComponent->AddItem(6662, 1, eLootSourceType::DELETION, eInventoryType::MODELS_IN_BBB, settings, LWOOBJID_EMPTY, false, false, spawnerId);
|
||||
auto* item = inventoryComponent->FindItemBySubKey(spawnerId);
|
||||
|
||||
if (item == nullptr) {
|
||||
@@ -498,7 +498,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
||||
if (spawner != nullptr) {
|
||||
dZoneManager::Instance()->RemoveSpawner(spawner->m_Info.spawnerID);
|
||||
} else {
|
||||
model->Smash(SILENT);
|
||||
model->Smash(LWOOBJID_EMPTY, eKillType::SILENT);
|
||||
}
|
||||
|
||||
item->SetCount(0, true, false, false);
|
||||
@@ -506,7 +506,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
||||
return;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(model->GetLOT(), 1, eLootSourceType::LOOT_SOURCE_DELETION, INVALID, {}, LWOOBJID_EMPTY, false);
|
||||
inventoryComponent->AddItem(model->GetLOT(), 1, eLootSourceType::DELETION, INVALID, {}, LWOOBJID_EMPTY, false);
|
||||
|
||||
auto* item = inventoryComponent->FindItemByLot(model->GetLOT());
|
||||
|
||||
@@ -551,7 +551,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
||||
if (spawner != nullptr) {
|
||||
dZoneManager::Instance()->RemoveSpawner(spawner->m_Info.spawnerID);
|
||||
} else {
|
||||
model->Smash(SILENT);
|
||||
model->Smash(LWOOBJID_EMPTY, eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
|
||||
if (!racingPlayer.noSmashOnReload) {
|
||||
racingPlayer.smashedTimes++;
|
||||
GameMessages::SendDie(vehicle, vehicle->GetObjectID(), LWOOBJID_EMPTY, true,
|
||||
VIOLENT, u"", 0, 0, 90.0f, false, true, 0);
|
||||
eKillType::VIOLENT, u"", 0, 0, 90.0f, false, true, 0);
|
||||
|
||||
auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
|
||||
uint32_t respawnImagination = 0;
|
||||
@@ -765,7 +765,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
// be smashed by death plane
|
||||
if (vehiclePosition.y < -500) {
|
||||
GameMessages::SendDie(vehicle, m_Parent->GetObjectID(),
|
||||
LWOOBJID_EMPTY, true, VIOLENT, u"", 0, 0, 0,
|
||||
LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0,
|
||||
true, false, 0);
|
||||
|
||||
OnRequestDie(playerEntity);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "RebuildComponent.h"
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t componentID) : Component(parent) {
|
||||
m_ComponentID = componentID;
|
||||
@@ -41,7 +42,7 @@ RailActivatorComponent::~RailActivatorComponent() = default;
|
||||
|
||||
void RailActivatorComponent::OnUse(Entity* originator) {
|
||||
auto* rebuildComponent = m_Parent->GetComponent<RebuildComponent>();
|
||||
if (rebuildComponent != nullptr && rebuildComponent->GetState() != REBUILD_COMPLETED)
|
||||
if (rebuildComponent != nullptr && rebuildComponent->GetState() != eRebuildState::COMPLETED)
|
||||
return;
|
||||
|
||||
if (rebuildComponent != nullptr) {
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eTriggerEventType.h"
|
||||
#include "eQuickBuildFailReason.h"
|
||||
#include "eTerminateType.h"
|
||||
#include "eGameActivity.h"
|
||||
|
||||
#include "dServer.h"
|
||||
#include "PacketUtils.h"
|
||||
@@ -47,7 +50,7 @@ RebuildComponent::~RebuildComponent() {
|
||||
|
||||
Entity* builder = GetBuilder();
|
||||
if (builder) {
|
||||
CancelRebuild(builder, eFailReason::REASON_BUILD_ENDED, true);
|
||||
CancelRebuild(builder, eQuickBuildFailReason::BUILD_ENDED, true);
|
||||
}
|
||||
|
||||
DespawnActivator();
|
||||
@@ -66,7 +69,7 @@ void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitia
|
||||
// If build state is completed and we've already serialized once in the completed state,
|
||||
// don't serializing this component anymore as this will cause the build to jump again.
|
||||
// If state changes, serialization will begin again.
|
||||
if (!m_StateDirty && m_State == REBUILD_COMPLETED) {
|
||||
if (!m_StateDirty && m_State == eRebuildState::COMPLETED) {
|
||||
outBitStream->Write0();
|
||||
outBitStream->Write0();
|
||||
return;
|
||||
@@ -90,7 +93,7 @@ void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitia
|
||||
|
||||
outBitStream->Write1();
|
||||
|
||||
outBitStream->Write<uint32_t>(m_State);
|
||||
outBitStream->Write(m_State);
|
||||
|
||||
outBitStream->Write(m_ShowResetEffect);
|
||||
outBitStream->Write(m_Activator != nullptr);
|
||||
@@ -120,7 +123,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
}*/
|
||||
|
||||
switch (m_State) {
|
||||
case REBUILD_OPEN: {
|
||||
case eRebuildState::OPEN: {
|
||||
SpawnActivator();
|
||||
m_TimeBeforeDrain = 0;
|
||||
|
||||
@@ -150,7 +153,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
|
||||
break;
|
||||
}
|
||||
case REBUILD_COMPLETED: {
|
||||
case eRebuildState::COMPLETED: {
|
||||
m_Timer += deltaTime;
|
||||
|
||||
// For reset times < 0 this has to be handled manually
|
||||
@@ -172,7 +175,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case REBUILD_BUILDING:
|
||||
case eRebuildState::BUILDING:
|
||||
{
|
||||
Entity* builder = GetBuilder();
|
||||
|
||||
@@ -201,7 +204,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
++m_DrainedImagination;
|
||||
|
||||
if (newImagination == 0 && m_DrainedImagination < m_TakeImagination) {
|
||||
CancelRebuild(builder, eFailReason::REASON_OUT_OF_IMAGINATION, true);
|
||||
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -213,7 +216,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
|
||||
break;
|
||||
}
|
||||
case REBUILD_INCOMPLETE: {
|
||||
case eRebuildState::INCOMPLETE: {
|
||||
m_TimerIncomplete += deltaTime;
|
||||
|
||||
// For reset times < 0 this has to be handled manually
|
||||
@@ -234,12 +237,12 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case REBUILD_RESETTING: break;
|
||||
case eRebuildState::RESETTING: break;
|
||||
}
|
||||
}
|
||||
|
||||
void RebuildComponent::OnUse(Entity* originator) {
|
||||
if (GetBuilder() != nullptr || m_State == REBUILD_COMPLETED) {
|
||||
if (GetBuilder() != nullptr || m_State == eRebuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -393,18 +396,18 @@ void RebuildComponent::SetRepositionPlayer(bool value) {
|
||||
}
|
||||
|
||||
void RebuildComponent::StartRebuild(Entity* user) {
|
||||
if (m_State == eRebuildState::REBUILD_OPEN || m_State == eRebuildState::REBUILD_COMPLETED || m_State == eRebuildState::REBUILD_INCOMPLETE) {
|
||||
if (m_State == eRebuildState::OPEN || m_State == eRebuildState::COMPLETED || m_State == eRebuildState::INCOMPLETE) {
|
||||
m_Builder = user->GetObjectID();
|
||||
|
||||
auto* character = user->GetComponent<CharacterComponent>();
|
||||
character->SetCurrentActivity(eGameActivities::ACTIVITY_QUICKBUILDING);
|
||||
character->SetCurrentActivity(eGameActivity::QUICKBUILDING);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(user);
|
||||
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::REBUILD_BUILDING, user->GetObjectID());
|
||||
GameMessages::SendEnableRebuild(m_Parent, true, false, false, eFailReason::REASON_NOT_GIVEN, 0.0f, user->GetObjectID());
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::BUILDING, user->GetObjectID());
|
||||
GameMessages::SendEnableRebuild(m_Parent, true, false, false, eQuickBuildFailReason::NOT_GIVEN, 0.0f, user->GetObjectID());
|
||||
|
||||
m_State = eRebuildState::REBUILD_BUILDING;
|
||||
m_State = eRebuildState::BUILDING;
|
||||
m_StateDirty = true;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
|
||||
@@ -432,7 +435,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
|
||||
auto* characterComponent = user->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->SetCurrentActivity(eGameActivities::ACTIVITY_NONE);
|
||||
characterComponent->SetCurrentActivity(eGameActivity::NONE);
|
||||
characterComponent->TrackRebuildComplete();
|
||||
} else {
|
||||
Game::logger->Log("RebuildComponent", "Some user tried to finish the rebuild but they didn't have a character somehow.");
|
||||
@@ -441,13 +444,13 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(user);
|
||||
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::REBUILD_COMPLETED, user->GetObjectID());
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::COMPLETED, user->GetObjectID());
|
||||
GameMessages::SendPlayFXEffect(m_Parent, 507, u"create", "BrickFadeUpVisCompleteEffect", LWOOBJID_EMPTY, 0.4f, 1.0f, true);
|
||||
GameMessages::SendEnableRebuild(m_Parent, false, false, true, eFailReason::REASON_NOT_GIVEN, m_ResetTime, user->GetObjectID());
|
||||
GameMessages::SendEnableRebuild(m_Parent, false, false, true, eQuickBuildFailReason::NOT_GIVEN, m_ResetTime, user->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
|
||||
|
||||
|
||||
m_State = eRebuildState::REBUILD_COMPLETED;
|
||||
m_State = eRebuildState::COMPLETED;
|
||||
m_StateDirty = true;
|
||||
m_Timer = 0.0f;
|
||||
m_DrainedImagination = 0;
|
||||
@@ -520,17 +523,17 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
void RebuildComponent::ResetRebuild(bool failed) {
|
||||
Entity* builder = GetBuilder();
|
||||
|
||||
if (m_State == eRebuildState::REBUILD_BUILDING && builder) {
|
||||
GameMessages::SendEnableRebuild(m_Parent, false, false, failed, eFailReason::REASON_NOT_GIVEN, m_ResetTime, builder->GetObjectID());
|
||||
if (m_State == eRebuildState::BUILDING && builder) {
|
||||
GameMessages::SendEnableRebuild(m_Parent, false, false, failed, eQuickBuildFailReason::NOT_GIVEN, m_ResetTime, builder->GetObjectID());
|
||||
|
||||
if (failed) {
|
||||
GameMessages::SendPlayAnimation(builder, u"rebuild-fail");
|
||||
}
|
||||
}
|
||||
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::REBUILD_RESETTING, LWOOBJID_EMPTY);
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::RESETTING, LWOOBJID_EMPTY);
|
||||
|
||||
m_State = eRebuildState::REBUILD_RESETTING;
|
||||
m_State = eRebuildState::RESETTING;
|
||||
m_StateDirty = true;
|
||||
m_Timer = 0.0f;
|
||||
m_TimerIncomplete = 0.0f;
|
||||
@@ -552,15 +555,15 @@ void RebuildComponent::ResetRebuild(bool failed) {
|
||||
}
|
||||
}
|
||||
|
||||
void RebuildComponent::CancelRebuild(Entity* entity, eFailReason failReason, bool skipChecks) {
|
||||
if (m_State != eRebuildState::REBUILD_COMPLETED || skipChecks) {
|
||||
void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failReason, bool skipChecks) {
|
||||
if (m_State != eRebuildState::COMPLETED || skipChecks) {
|
||||
|
||||
m_Builder = LWOOBJID_EMPTY;
|
||||
|
||||
const auto entityID = entity != nullptr ? entity->GetObjectID() : LWOOBJID_EMPTY;
|
||||
|
||||
// Notify the client that a state has changed
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::REBUILD_INCOMPLETE, entityID);
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::INCOMPLETE, entityID);
|
||||
GameMessages::SendEnableRebuild(m_Parent, false, true, false, failReason, m_Timer, entityID);
|
||||
|
||||
// Now terminate any interaction with the rebuild
|
||||
@@ -568,7 +571,7 @@ void RebuildComponent::CancelRebuild(Entity* entity, eFailReason failReason, boo
|
||||
GameMessages::SendTerminateInteraction(m_Parent->GetObjectID(), eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
|
||||
|
||||
// Now update the component itself
|
||||
m_State = eRebuildState::REBUILD_INCOMPLETE;
|
||||
m_State = eRebuildState::INCOMPLETE;
|
||||
m_StateDirty = true;
|
||||
|
||||
// Notify scripts and possible subscribers
|
||||
@@ -586,7 +589,7 @@ void RebuildComponent::CancelRebuild(Entity* entity, eFailReason failReason, boo
|
||||
|
||||
CharacterComponent* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) {
|
||||
characterComponent->SetCurrentActivity(eGameActivities::ACTIVITY_NONE);
|
||||
characterComponent->SetCurrentActivity(eGameActivity::NONE);
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
#include "Preconditions.h"
|
||||
#include "Component.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eRebuildState.h"
|
||||
|
||||
class Entity;
|
||||
enum class eQuickBuildFailReason : uint32_t;
|
||||
|
||||
/**
|
||||
* Component that handles entities that can be built into other entities using the quick build mechanic. Generally
|
||||
@@ -215,7 +217,7 @@ public:
|
||||
* @param failReason the reason the rebuild was cancelled
|
||||
* @param skipChecks whether or not to skip the check for the rebuild not being completed
|
||||
*/
|
||||
void CancelRebuild(Entity* builder, eFailReason failReason, bool skipChecks = false);
|
||||
void CancelRebuild(Entity* builder, eQuickBuildFailReason failReason, bool skipChecks = false);
|
||||
private:
|
||||
/**
|
||||
* Whether or not the quickbuild state has been changed since we last serialized it.
|
||||
@@ -225,7 +227,7 @@ private:
|
||||
/**
|
||||
* The state the rebuild is currently in
|
||||
*/
|
||||
eRebuildState m_State = eRebuildState::REBUILD_OPEN;
|
||||
eRebuildState m_State = eRebuildState::OPEN;
|
||||
|
||||
/**
|
||||
* The time that has passed since initiating the rebuild
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "dServer.h"
|
||||
#include "dMessageIdentifiers.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "eObjectWorldState.h"
|
||||
|
||||
RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent, int rocketId) : Component(parent) {
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
@@ -77,7 +78,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOMAPID mapId,
|
||||
|
||||
GameMessages::SendFireEventClientSide(m_Parent->GetObjectID(), originator->GetSystemAddress(), u"RocketEquipped", rocket->GetId(), cloneId, -1, originator->GetObjectID());
|
||||
|
||||
GameMessages::SendChangeObjectWorldState(rocket->GetId(), WORLDSTATE_ATTACHED, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendChangeObjectWorldState(rocket->GetId(), eObjectWorldState::ATTACHED, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(originator);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "dMessageIdentifiers.h"
|
||||
#include "Loot.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eMatchUpdate.h"
|
||||
|
||||
#include "CDCurrencyTableTable.h"
|
||||
#include "CDActivityRewardsTable.h"
|
||||
@@ -167,9 +168,9 @@ void ScriptedActivityComponent::PlayerJoinLobby(Entity* player) {
|
||||
}
|
||||
|
||||
std::string matchUpdate = "player=9:" + std::to_string(entity->GetObjectID()) + "\nplayerName=0:" + entity->GetCharacter()->GetName();
|
||||
GameMessages::SendMatchUpdate(player, player->GetSystemAddress(), matchUpdate, eMatchUpdate::MATCH_UPDATE_PLAYER_JOINED);
|
||||
GameMessages::SendMatchUpdate(player, player->GetSystemAddress(), matchUpdate, eMatchUpdate::PLAYER_ADDED);
|
||||
PlayerReady(entity, joinedPlayer->ready);
|
||||
GameMessages::SendMatchUpdate(entity, entity->GetSystemAddress(), matchUpdateJoined, eMatchUpdate::MATCH_UPDATE_PLAYER_JOINED);
|
||||
GameMessages::SendMatchUpdate(entity, entity->GetSystemAddress(), matchUpdateJoined, eMatchUpdate::PLAYER_ADDED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,7 +186,7 @@ void ScriptedActivityComponent::PlayerJoinLobby(Entity* player) {
|
||||
if (m_ActivityInfo.maxTeamSize != 1 && playerLobby->players.size() >= m_ActivityInfo.minTeamSize || m_ActivityInfo.maxTeamSize == 1 && playerLobby->players.size() >= m_ActivityInfo.minTeams) {
|
||||
// Update the joining player on the match timer
|
||||
std::string matchTimerUpdate = "time=3:" + std::to_string(playerLobby->timer);
|
||||
GameMessages::SendMatchUpdate(player, player->GetSystemAddress(), matchTimerUpdate, eMatchUpdate::MATCH_UPDATE_TIME);
|
||||
GameMessages::SendMatchUpdate(player, player->GetSystemAddress(), matchTimerUpdate, eMatchUpdate::PHASE_WAIT_READY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +202,7 @@ void ScriptedActivityComponent::PlayerLeave(LWOOBJID playerID) {
|
||||
if (entity == nullptr)
|
||||
continue;
|
||||
|
||||
GameMessages::SendMatchUpdate(entity, entity->GetSystemAddress(), matchUpdateLeft, eMatchUpdate::MATCH_UPDATE_PLAYER_LEFT);
|
||||
GameMessages::SendMatchUpdate(entity, entity->GetSystemAddress(), matchUpdateLeft, eMatchUpdate::PLAYER_REMOVED);
|
||||
}
|
||||
|
||||
delete lobby->players[i];
|
||||
@@ -242,7 +243,7 @@ void ScriptedActivityComponent::Update(float deltaTime) {
|
||||
continue;
|
||||
|
||||
std::string matchTimerUpdate = "time=3:" + std::to_string(lobby->timer);
|
||||
GameMessages::SendMatchUpdate(entity, entity->GetSystemAddress(), matchTimerUpdate, eMatchUpdate::MATCH_UPDATE_TIME);
|
||||
GameMessages::SendMatchUpdate(entity, entity->GetSystemAddress(), matchTimerUpdate, eMatchUpdate::PHASE_WAIT_READY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +268,7 @@ void ScriptedActivityComponent::Update(float deltaTime) {
|
||||
if (entity == nullptr)
|
||||
continue;
|
||||
|
||||
GameMessages::SendMatchUpdate(entity, entity->GetSystemAddress(), matchTimerUpdate, eMatchUpdate::MATCH_UPDATE_TIME_START_DELAY);
|
||||
GameMessages::SendMatchUpdate(entity, entity->GetSystemAddress(), matchTimerUpdate, eMatchUpdate::PHASE_WAIT_START);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,8 +376,8 @@ void ScriptedActivityComponent::PlayerReady(Entity* player, bool bReady) {
|
||||
|
||||
// Update players in lobby on player being ready
|
||||
std::string matchReadyUpdate = "player=9:" + std::to_string(player->GetObjectID());
|
||||
eMatchUpdate readyStatus = eMatchUpdate::MATCH_UPDATE_PLAYER_READY;
|
||||
if (!bReady) readyStatus = eMatchUpdate::MATCH_UPDATE_PLAYER_UNREADY;
|
||||
eMatchUpdate readyStatus = eMatchUpdate::PLAYER_READY;
|
||||
if (!bReady) readyStatus = eMatchUpdate::PLAYER_NOT_READY;
|
||||
for (LobbyPlayer* otherPlayer : lobby->players) {
|
||||
auto* entity = otherPlayer->GetEntity();
|
||||
if (entity == nullptr)
|
||||
|
||||
@@ -39,7 +39,7 @@ bool SwitchComponent::GetActive() const {
|
||||
void SwitchComponent::EntityEnter(Entity* entity) {
|
||||
if (!m_Active) {
|
||||
if (m_Rebuild) {
|
||||
if (m_Rebuild->GetState() != eRebuildState::REBUILD_COMPLETED) return;
|
||||
if (m_Rebuild->GetState() != eRebuildState::COMPLETED) return;
|
||||
}
|
||||
m_Active = true;
|
||||
if (!m_Parent) return;
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
#include "eMissionState.h"
|
||||
#include "eObjectBits.h"
|
||||
#include "eTriggerEventType.h"
|
||||
#include "eMatchUpdate.h"
|
||||
#include "eCyclingMode.h"
|
||||
#include "eCinematicEvent.h"
|
||||
#include "eQuickBuildFailReason.h"
|
||||
#include "eControlScheme.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <future>
|
||||
@@ -294,9 +300,9 @@ void GameMessages::SendPlayerSetCameraCyclingMode(const LWOOBJID& objectID, cons
|
||||
|
||||
bitStream.Write(bAllowCyclingWhileDeadOnly);
|
||||
|
||||
bitStream.Write(cyclingMode != ALLOW_CYCLE_TEAMMATES);
|
||||
if (cyclingMode != ALLOW_CYCLE_TEAMMATES) {
|
||||
bitStream.Write<uint32_t>(cyclingMode);
|
||||
bitStream.Write(cyclingMode != eCyclingMode::ALLOW_CYCLE_TEAMMATES);
|
||||
if (cyclingMode != eCyclingMode::ALLOW_CYCLE_TEAMMATES) {
|
||||
bitStream.Write(cyclingMode);
|
||||
}
|
||||
|
||||
SEND_PACKET;
|
||||
@@ -440,8 +446,8 @@ void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const System
|
||||
bitStream.Write(item->GetInfo().isBOE);
|
||||
bitStream.Write(item->GetInfo().isBOP);
|
||||
|
||||
bitStream.Write(lootSourceType != eLootSourceType::LOOT_SOURCE_NONE); // Loot source
|
||||
if (lootSourceType != eLootSourceType::LOOT_SOURCE_NONE) bitStream.Write(lootSourceType);
|
||||
bitStream.Write(lootSourceType != eLootSourceType::NONE); // Loot source
|
||||
if (lootSourceType != eLootSourceType::NONE) bitStream.Write(lootSourceType);
|
||||
LWONameValue extraInfo;
|
||||
|
||||
auto config = item->GetConfig();
|
||||
@@ -489,7 +495,7 @@ void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const System
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendNotifyClientFlagChange(const LWOOBJID& objectID, int iFlagID, bool bFlag, const SystemAddress& sysAddr) {
|
||||
void GameMessages::SendNotifyClientFlagChange(const LWOOBJID& objectID, uint32_t iFlagID, bool bFlag, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -501,7 +507,7 @@ void GameMessages::SendNotifyClientFlagChange(const LWOOBJID& objectID, int iFla
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendChangeObjectWorldState(const LWOOBJID& objectID, int state, const SystemAddress& sysAddr) {
|
||||
void GameMessages::SendChangeObjectWorldState(const LWOOBJID& objectID, eObjectWorldState state, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -582,8 +588,8 @@ void GameMessages::SendModifyLEGOScore(Entity* entity, const SystemAddress& sysA
|
||||
bitStream.Write((uint16_t)GAME_MSG_MODIFY_LEGO_SCORE);
|
||||
bitStream.Write(score);
|
||||
|
||||
bitStream.Write(sourceType != eLootSourceType::LOOT_SOURCE_NONE);
|
||||
if (sourceType != eLootSourceType::LOOT_SOURCE_NONE) bitStream.Write(sourceType);
|
||||
bitStream.Write(sourceType != eLootSourceType::NONE);
|
||||
if (sourceType != eLootSourceType::NONE) bitStream.Write(sourceType);
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
@@ -743,14 +749,14 @@ void GameMessages::SendSetCurrency(Entity* entity, int64_t currency, int lootTyp
|
||||
bitStream.Write(sourceTradeID != LWOOBJID_EMPTY);
|
||||
if (sourceTradeID != LWOOBJID_EMPTY) bitStream.Write(sourceTradeID);
|
||||
|
||||
bitStream.Write(sourceType != LOOTTYPE_NONE);
|
||||
if (sourceType != LOOTTYPE_NONE) bitStream.Write(sourceType);
|
||||
bitStream.Write(sourceType != eLootSourceType::NONE);
|
||||
if (sourceType != eLootSourceType::NONE) bitStream.Write(sourceType);
|
||||
|
||||
SystemAddress sysAddr = entity->GetSystemAddress();
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendRebuildNotifyState(Entity* entity, int prevState, int state, const LWOOBJID& playerID) {
|
||||
void GameMessages::SendRebuildNotifyState(Entity* entity, eRebuildState prevState, eRebuildState state, const LWOOBJID& playerID) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -764,7 +770,7 @@ void GameMessages::SendRebuildNotifyState(Entity* entity, int prevState, int sta
|
||||
SEND_PACKET_BROADCAST;
|
||||
}
|
||||
|
||||
void GameMessages::SendEnableRebuild(Entity* entity, bool enable, bool fail, bool success, int failReason, float duration, const LWOOBJID& playerID) {
|
||||
void GameMessages::SendEnableRebuild(Entity* entity, bool enable, bool fail, bool success, eQuickBuildFailReason failReason, float duration, const LWOOBJID& playerID) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -775,8 +781,8 @@ void GameMessages::SendEnableRebuild(Entity* entity, bool enable, bool fail, boo
|
||||
bitStream.Write(fail);
|
||||
bitStream.Write(success);
|
||||
|
||||
bitStream.Write(failReason != eFailReason::REASON_NOT_GIVEN);
|
||||
if (failReason != eFailReason::REASON_NOT_GIVEN) bitStream.Write(failReason);
|
||||
bitStream.Write(failReason != eQuickBuildFailReason::NOT_GIVEN);
|
||||
if (failReason != eQuickBuildFailReason::NOT_GIVEN) bitStream.Write(failReason);
|
||||
|
||||
bitStream.Write(duration);
|
||||
bitStream.Write(playerID);
|
||||
@@ -843,8 +849,8 @@ void GameMessages::SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOB
|
||||
bitStream.Write(directionRelative_AngleY);
|
||||
bitStream.Write(directionRelative_Force);
|
||||
|
||||
bitStream.Write(killType != VIOLENT);
|
||||
if (killType != VIOLENT) bitStream.Write(killType);
|
||||
bitStream.Write(killType != eKillType::VIOLENT);
|
||||
if (killType != eKillType::VIOLENT) bitStream.Write(killType);
|
||||
|
||||
bitStream.Write(killerID);
|
||||
|
||||
@@ -1104,7 +1110,7 @@ void GameMessages::SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID,
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendSetPlayerControlScheme(Entity* entity, eControlSceme controlScheme) {
|
||||
void GameMessages::SendSetPlayerControlScheme(Entity* entity, eControlScheme controlScheme) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -1117,8 +1123,8 @@ void GameMessages::SendSetPlayerControlScheme(Entity* entity, eControlSceme cont
|
||||
bitStream.Write(bDelayCamSwitchIfInCinematic);
|
||||
bitStream.Write(bSwitchCam);
|
||||
|
||||
bitStream.Write(controlScheme != SCHEME_A);
|
||||
if (controlScheme != SCHEME_A) bitStream.Write(controlScheme);
|
||||
bitStream.Write(controlScheme != eControlScheme::SCHEME_A);
|
||||
if (controlScheme != eControlScheme::SCHEME_A) bitStream.Write(controlScheme);
|
||||
|
||||
SystemAddress sysAddr = entity->GetSystemAddress();
|
||||
SEND_PACKET;
|
||||
@@ -1376,7 +1382,7 @@ void GameMessages::SendUseItemResult(Entity* entity, LOT templateID, bool useIte
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendUseItemRequirementsResponse(LWOOBJID objectID, const SystemAddress& sysAddr, UseItemResponse itemResponse) {
|
||||
void GameMessages::SendUseItemRequirementsResponse(LWOOBJID objectID, const SystemAddress& sysAddr, eUseItemResponse itemResponse) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -1449,7 +1455,7 @@ void GameMessages::SendMatchResponse(Entity* entity, const SystemAddress& sysAdd
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendMatchUpdate(Entity* entity, const SystemAddress& sysAddr, std::string data, int type) {
|
||||
void GameMessages::SendMatchUpdate(Entity* entity, const SystemAddress& sysAddr, std::string data, eMatchUpdate type) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -2879,7 +2885,7 @@ void GameMessages::SendEndCinematic(LWOOBJID objectId, std::u16string pathName,
|
||||
void GameMessages::HandleCinematicUpdate(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
eCinematicEvent event;
|
||||
if (!inStream->ReadBit()) {
|
||||
event = STARTED;
|
||||
event = eCinematicEvent::STARTED;
|
||||
} else {
|
||||
inStream->Read<eCinematicEvent>(event);
|
||||
}
|
||||
@@ -3425,7 +3431,7 @@ void GameMessages::HandleClientTradeUpdate(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
//Pets:
|
||||
|
||||
void GameMessages::SendNotifyPetTamingMinigame(LWOOBJID objectId, LWOOBJID petId, LWOOBJID playerTamingId, bool bForceTeleport, uint32_t notifyType, NiPoint3 petsDestPos, NiPoint3 telePos, NiQuaternion teleRot, const SystemAddress& sysAddr) {
|
||||
void GameMessages::SendNotifyPetTamingMinigame(LWOOBJID objectId, LWOOBJID petId, LWOOBJID playerTamingId, bool bForceTeleport, ePetTamingNotifyType notifyType, NiPoint3 petsDestPos, NiPoint3 telePos, NiQuaternion teleRot, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -4141,7 +4147,7 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
|
||||
float directionRelativeAngleXZ;
|
||||
float directionRelativeAngleY;
|
||||
float directionRelativeForce;
|
||||
int32_t killType = VIOLENT;
|
||||
eKillType killType = eKillType::VIOLENT;
|
||||
LWOOBJID killerID;
|
||||
LWOOBJID lootOwnerID = LWOOBJID_EMPTY;
|
||||
|
||||
@@ -4415,7 +4421,7 @@ void GameMessages::SendVehicleStopBoost(Entity* targetEntity, const SystemAddres
|
||||
|
||||
bitStream.Write(targetEntity->GetObjectID());
|
||||
bitStream.Write(GAME_MSG::GAME_MSG_VEHICLE_STOP_BOOST);
|
||||
|
||||
|
||||
bitStream.Write(affectPassive);
|
||||
|
||||
SEND_PACKET_BROADCAST;
|
||||
@@ -4427,7 +4433,7 @@ void GameMessages::SendSetResurrectRestoreValues(Entity* targetEntity, int32_t a
|
||||
|
||||
bitStream.Write(targetEntity->GetObjectID());
|
||||
bitStream.Write(GAME_MSG::GAME_MSG_SET_RESURRECT_RESTORE_VALUES);
|
||||
|
||||
|
||||
bitStream.Write(armorRestore != -1);
|
||||
if (armorRestore != -1) bitStream.Write(armorRestore);
|
||||
|
||||
@@ -4766,7 +4772,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
|
||||
inv->RemoveItem(tokenId, altCurrencyCost);
|
||||
|
||||
inv->AddItem(item, count, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
inv->AddItem(item, count, eLootSourceType::VENDOR);
|
||||
} else {
|
||||
float buyScalar = vend->GetBuyScalar();
|
||||
|
||||
@@ -4786,8 +4792,8 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
inv->RemoveItem(itemComp.currencyLOT, altCurrencyCost);
|
||||
}
|
||||
|
||||
character->SetCoins(character->GetCoins() - (coinCost), eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
inv->AddItem(item, count, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
character->SetCoins(character->GetCoins() - (coinCost), eLootSourceType::VENDOR);
|
||||
inv->AddItem(item, count, eLootSourceType::VENDOR);
|
||||
}
|
||||
|
||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||
@@ -4829,12 +4835,12 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
|
||||
float sellScalar = vend->GetSellScalar();
|
||||
if (Inventory::IsValidItem(itemComp.currencyLOT)) {
|
||||
const auto altCurrency = static_cast<uint32_t>(itemComp.altCurrencyCost * sellScalar) * count;
|
||||
inv->AddItem(itemComp.currencyLOT, std::floor(altCurrency), eLootSourceType::LOOT_SOURCE_VENDOR); // Return alt currencies like faction tokens.
|
||||
inv->AddItem(itemComp.currencyLOT, std::floor(altCurrency), eLootSourceType::VENDOR); // Return alt currencies like faction tokens.
|
||||
}
|
||||
|
||||
//inv->RemoveItem(count, -1, iObjID);
|
||||
inv->MoveItemToInventory(item, eInventoryType::VENDOR_BUYBACK, count, true, false, true);
|
||||
character->SetCoins(std::floor(character->GetCoins() + (static_cast<uint32_t>(itemComp.baseValue * sellScalar) * count)), eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
character->SetCoins(std::floor(character->GetCoins() + (static_cast<uint32_t>(itemComp.baseValue * sellScalar) * count)), eLootSourceType::VENDOR);
|
||||
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||
}
|
||||
@@ -4893,7 +4899,7 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
//inv->RemoveItem(count, -1, iObjID);
|
||||
inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false);
|
||||
character->SetCoins(character->GetCoins() - cost, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
character->SetCoins(character->GetCoins() - cost, eLootSourceType::VENDOR);
|
||||
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||
}
|
||||
@@ -5015,7 +5021,7 @@ void GameMessages::HandleRebuildCancel(RakNet::BitStream* inStream, Entity* enti
|
||||
RebuildComponent* rebComp = static_cast<RebuildComponent*>(entity->GetComponent(eReplicaComponentType::QUICK_BUILD));
|
||||
if (!rebComp) return;
|
||||
|
||||
rebComp->CancelRebuild(EntityManager::Instance()->GetEntity(userID), eFailReason::REASON_CANCELED_EARLY);
|
||||
rebComp->CancelRebuild(EntityManager::Instance()->GetEntity(userID), eQuickBuildFailReason::CANCELED_EARLY);
|
||||
}
|
||||
|
||||
void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
@@ -5135,12 +5141,12 @@ void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, E
|
||||
|
||||
item->Disassemble(TEMP_MODELS);
|
||||
|
||||
item->SetCount(item->GetCount() - 1, false, false, true, eLootSourceType::LOOT_SOURCE_QUICKBUILD);
|
||||
item->SetCount(item->GetCount() - 1, false, false, true, eLootSourceType::QUICKBUILD);
|
||||
}
|
||||
|
||||
void GameMessages::HandleSetFlag(RakNet::BitStream* inStream, Entity* entity) {
|
||||
bool bFlag{};
|
||||
int iFlagID{};
|
||||
int32_t iFlagID{};
|
||||
|
||||
inStream->Read(bFlag);
|
||||
inStream->Read(iFlagID);
|
||||
@@ -5301,7 +5307,7 @@ void GameMessages::HandlePickupCurrency(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
auto* ch = entity->GetCharacter();
|
||||
if (entity->CanPickupCoins(currency)) {
|
||||
ch->SetCoins(ch->GetCoins() + currency, eLootSourceType::LOOT_SOURCE_PICKUP);
|
||||
ch->SetCoins(ch->GetCoins() + currency, eLootSourceType::PICKUP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5615,9 +5621,9 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
config.push_back(moduleAssembly);
|
||||
|
||||
if (count == 3) {
|
||||
inv->AddItem(6416, 1, eLootSourceType::LOOT_SOURCE_QUICKBUILD, eInventoryType::MODELS, config);
|
||||
inv->AddItem(6416, 1, eLootSourceType::QUICKBUILD, eInventoryType::MODELS, config);
|
||||
} else if (count == 7) {
|
||||
inv->AddItem(8092, 1, eLootSourceType::LOOT_SOURCE_QUICKBUILD, eInventoryType::MODELS, config);
|
||||
inv->AddItem(8092, 1, eLootSourceType::QUICKBUILD, eInventoryType::MODELS, config);
|
||||
}
|
||||
|
||||
auto* missionComponent = character->GetComponent<MissionComponent>();
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include "eMovementPlatformState.h"
|
||||
#include "NiPoint3.h"
|
||||
#include "eEndBehavior.h"
|
||||
#include "eCyclingMode.h"
|
||||
#include "eLootSourceType.h"
|
||||
#include "Brick.h"
|
||||
|
||||
class AMFValue;
|
||||
class Entity;
|
||||
@@ -23,6 +26,16 @@ enum class eAnimationFlags : uint32_t;
|
||||
enum class eUnequippableActiveType;
|
||||
enum eInventoryType : uint32_t;
|
||||
enum class eGameMasterLevel : uint8_t;
|
||||
enum class eMatchUpdate : int32_t;
|
||||
enum class eKillType : uint32_t;
|
||||
enum class eObjectWorldState : uint32_t;
|
||||
enum class eTerminateType : uint32_t;
|
||||
enum class eControlScheme : uint32_t;
|
||||
enum class eStateChangeType : uint32_t;
|
||||
enum class ePetTamingNotifyType : uint32_t;
|
||||
enum class eUseItemResponse : uint32_t;
|
||||
enum class eQuickBuildFailReason : uint32_t;
|
||||
enum class eRebuildState : uint32_t;
|
||||
|
||||
namespace GameMessages {
|
||||
class PropertyDataMessage;
|
||||
@@ -51,8 +64,7 @@ namespace GameMessages {
|
||||
int targetTYPE = 0
|
||||
);
|
||||
|
||||
void SendPlayerSetCameraCyclingMode(const LWOOBJID& objectID, const SystemAddress& sysAddr,
|
||||
bool bAllowCyclingWhileDeadOnly = true, eCyclingMode cyclingMode = ALLOW_CYCLE_TEAMMATES);
|
||||
void SendPlayerSetCameraCyclingMode(const LWOOBJID& objectID, const SystemAddress& sysAddr, bool bAllowCyclingWhileDeadOnly = true, eCyclingMode cyclingMode = eCyclingMode::ALLOW_CYCLE_TEAMMATES);
|
||||
|
||||
void SendPlayNDAudioEmitter(Entity* entity, const SystemAddress& sysAddr, std::string audioGUID);
|
||||
|
||||
@@ -66,9 +78,9 @@ namespace GameMessages {
|
||||
void SendGMLevelBroadcast(const LWOOBJID& objectID, eGameMasterLevel level);
|
||||
void SendChatModeUpdate(const LWOOBJID& objectID, eGameMasterLevel level);
|
||||
|
||||
void SendAddItemToInventoryClientSync(Entity* entity, const SystemAddress& sysAddr, Item* item, const LWOOBJID& objectID, bool showFlyingLoot, int itemCount, LWOOBJID subKey = LWOOBJID_EMPTY, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
void SendNotifyClientFlagChange(const LWOOBJID& objectID, int iFlagID, bool bFlag, const SystemAddress& sysAddr);
|
||||
void SendChangeObjectWorldState(const LWOOBJID& objectID, int state, const SystemAddress& sysAddr);
|
||||
void SendAddItemToInventoryClientSync(Entity* entity, const SystemAddress& sysAddr, Item* item, const LWOOBJID& objectID, bool showFlyingLoot, int itemCount, LWOOBJID subKey = LWOOBJID_EMPTY, eLootSourceType lootSourceType = eLootSourceType::NONE);
|
||||
void SendNotifyClientFlagChange(const LWOOBJID& objectID, uint32_t iFlagID, bool bFlag, const SystemAddress& sysAddr);
|
||||
void SendChangeObjectWorldState(const LWOOBJID& objectID, eObjectWorldState state, const SystemAddress& sysAddr);
|
||||
|
||||
void SendOfferMission(const LWOOBJID& entity, const SystemAddress& sysAddr, int32_t missionID, const LWOOBJID& offererID);
|
||||
void SendNotifyMission(Entity* entity, const SystemAddress& sysAddr, int missionID, int missionState, bool sendingRewards);
|
||||
@@ -86,8 +98,8 @@ namespace GameMessages {
|
||||
void SendBroadcastTextToChatbox(Entity* entity, const SystemAddress& sysAddr, const std::u16string& attrs, const std::u16string& wsText);
|
||||
void SendSetCurrency(Entity* entity, int64_t currency, int lootType, const LWOOBJID& sourceID, const LOT& sourceLOT, int sourceTradeID, bool overrideCurrent, eLootSourceType sourceType);
|
||||
|
||||
void SendRebuildNotifyState(Entity* entity, int prevState, int state, const LWOOBJID& playerID);
|
||||
void SendEnableRebuild(Entity* entity, bool enable, bool fail, bool success, int failReason, float duration, const LWOOBJID& playerID);
|
||||
void SendRebuildNotifyState(Entity* entity, eRebuildState prevState, eRebuildState state, const LWOOBJID& playerID);
|
||||
void SendEnableRebuild(Entity* entity, bool enable, bool fail, bool success, eQuickBuildFailReason failReason, float duration, const LWOOBJID& playerID);
|
||||
void AddActivityOwner(Entity* entity, LWOOBJID& ownerID);
|
||||
void SendTerminateInteraction(const LWOOBJID& objectID, eTerminateType type, const LWOOBJID& terminator);
|
||||
|
||||
@@ -104,7 +116,7 @@ namespace GameMessages {
|
||||
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 SendSetPlayerControlScheme(Entity* entity, eControlSceme controlScheme);
|
||||
void SendSetPlayerControlScheme(Entity* entity, eControlScheme controlScheme);
|
||||
void SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPoint3& position, const NiQuaternion& rotation);
|
||||
|
||||
void SendAddSkill(Entity* entity, TSkillID skillID, int slotID);
|
||||
@@ -123,7 +135,7 @@ namespace GameMessages {
|
||||
void SendMoveInventoryBatch(Entity* entity, uint32_t stackCount, int srcInv, int dstInv, const LWOOBJID& iObjID);
|
||||
|
||||
void SendMatchResponse(Entity* entity, const SystemAddress& sysAddr, int response);
|
||||
void SendMatchUpdate(Entity* entity, const SystemAddress& sysAddr, std::string data, int type);
|
||||
void SendMatchUpdate(Entity* entity, const SystemAddress& sysAddr, std::string data, eMatchUpdate type);
|
||||
|
||||
void HandleUnUseModel(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
|
||||
void SendStartCelebrationEffect(Entity* entity, const SystemAddress& sysAddr, int celebrationID);
|
||||
@@ -350,7 +362,7 @@ namespace GameMessages {
|
||||
void HandleClientTradeUpdate(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
|
||||
|
||||
//Pets:
|
||||
void SendNotifyPetTamingMinigame(LWOOBJID objectId, LWOOBJID petId, LWOOBJID playerTamingId, bool bForceTeleport, uint32_t notifyType, NiPoint3 petsDestPos, NiPoint3 telePos, NiQuaternion teleRot, const SystemAddress& sysAddr);
|
||||
void SendNotifyPetTamingMinigame(LWOOBJID objectId, LWOOBJID petId, LWOOBJID playerTamingId, bool bForceTeleport, ePetTamingNotifyType notifyType, NiPoint3 petsDestPos, NiPoint3 telePos, NiQuaternion teleRot, const SystemAddress& sysAddr);
|
||||
|
||||
void SendNotifyPetTamingPuzzleSelected(LWOOBJID objectId, std::vector<Brick>& bricks, const SystemAddress& sysAddr);
|
||||
|
||||
@@ -520,7 +532,7 @@ namespace GameMessages {
|
||||
void SendActivityPause(LWOOBJID objectId, bool pause = false, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
|
||||
void SendStartActivityTime(LWOOBJID objectId, float_t startTime, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
|
||||
void SendRequestActivityEnter(LWOOBJID objectId, const SystemAddress& sysAddr, bool bStart, LWOOBJID userID);
|
||||
void SendUseItemRequirementsResponse(LWOOBJID objectID, const SystemAddress& sysAddr, UseItemResponse itemResponse);
|
||||
void SendUseItemRequirementsResponse(LWOOBJID objectID, const SystemAddress& sysAddr, eUseItemResponse itemResponse);
|
||||
|
||||
// SG:
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "Loot.h"
|
||||
#include "eObjectBits.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eUseItemResponse.h"
|
||||
|
||||
#include "CDBrickIDTableTable.h"
|
||||
#include "CDObjectSkillsTable.h"
|
||||
@@ -330,7 +331,7 @@ void Item::UseNonEquip(Item* item) {
|
||||
}
|
||||
}
|
||||
if (playerInventoryComponent->HasSpaceForLoot(rolledLoot)) {
|
||||
LootGenerator::Instance().GiveLoot(playerInventoryComponent->GetParent(), rolledLoot, eLootSourceType::LOOT_SOURCE_CONSUMPTION);
|
||||
LootGenerator::Instance().GiveLoot(playerInventoryComponent->GetParent(), rolledLoot, eLootSourceType::CONSUMPTION);
|
||||
item->SetCount(item->GetCount() - 1);
|
||||
} else {
|
||||
success = false;
|
||||
@@ -339,7 +340,7 @@ void Item::UseNonEquip(Item* item) {
|
||||
GameMessages::SendUseItemRequirementsResponse(
|
||||
playerInventoryComponent->GetParent()->GetObjectID(),
|
||||
playerInventoryComponent->GetParent()->GetSystemAddress(),
|
||||
UseItemResponse::FailedPrecondition
|
||||
eUseItemResponse::FailedPrecondition
|
||||
);
|
||||
success = false;
|
||||
}
|
||||
@@ -379,7 +380,7 @@ void Item::Disassemble(const eInventoryType inventoryType) {
|
||||
}
|
||||
|
||||
for (const auto mod : modArray) {
|
||||
inventory->GetComponent()->AddItem(mod, 1, eLootSourceType::LOOT_SOURCE_DELETION, inventoryType);
|
||||
inventory->GetComponent()->AddItem(mod, 1, eLootSourceType::DELETION, inventoryType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -477,7 +478,7 @@ void Item::DisassembleModel() {
|
||||
continue;
|
||||
}
|
||||
|
||||
GetInventory()->GetComponent()->AddItem(brickID[0].NDObjectID, 1, eLootSourceType::LOOT_SOURCE_DELETION);
|
||||
GetInventory()->GetComponent()->AddItem(brickID[0].NDObjectID, 1, eLootSourceType::DELETION);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "dLogger.h"
|
||||
#include "Preconditions.h"
|
||||
#include "eInventoryType.h"
|
||||
#include "eLootSourceType.h"
|
||||
|
||||
/**
|
||||
* An item that can be stored in an inventory and optionally consumed or equipped
|
||||
@@ -38,7 +39,7 @@ public:
|
||||
const std::vector<LDFBaseData*>& config,
|
||||
LWOOBJID parent,
|
||||
LWOOBJID subKey,
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||
eLootSourceType lootSourceType = eLootSourceType::NONE
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
bool isModMoveAndEquip = false,
|
||||
LWOOBJID subKey = LWOOBJID_EMPTY,
|
||||
bool bound = false,
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||
eLootSourceType lootSourceType = eLootSourceType::NONE
|
||||
);
|
||||
|
||||
~Item();
|
||||
@@ -89,7 +90,7 @@ public:
|
||||
* @param disassemble if items were removed, this returns all the sub parts of the item individually if it had assembly part lots
|
||||
* @param showFlyingLoot shows flying loot to the client, if not silent
|
||||
*/
|
||||
void SetCount(uint32_t value, bool silent = false, bool disassemble = true, bool showFlyingLoot = true, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
void SetCount(uint32_t value, bool silent = false, bool disassemble = true, bool showFlyingLoot = true, eLootSourceType lootSourceType = eLootSourceType::NONE);
|
||||
|
||||
/**
|
||||
* Returns the number of items this item represents (e.g. for stacks)
|
||||
|
||||
@@ -388,7 +388,7 @@ void Mission::Catchup() {
|
||||
}
|
||||
|
||||
if (type == eMissionTaskType::PLAYER_FLAG) {
|
||||
for (auto target : task->GetAllTargets()) {
|
||||
for (int32_t target : task->GetAllTargets()) {
|
||||
const auto flag = GetUser()->GetLastUsedChar()->GetPlayerFlag(target);
|
||||
|
||||
if (!flag) {
|
||||
@@ -442,7 +442,7 @@ void Mission::YieldRewards() {
|
||||
|
||||
int32_t coinsToSend = 0;
|
||||
if (info->LegoScore > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
|
||||
if (levelComponent->GetLevel() >= dZoneManager::Instance()->GetWorldConfig()->levelCap) {
|
||||
// Since the character is at the level cap we reward them with coins instead of UScore.
|
||||
coinsToSend += info->LegoScore * dZoneManager::Instance()->GetWorldConfig()->levelCapCurrencyConversion;
|
||||
@@ -475,11 +475,11 @@ void Mission::YieldRewards() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT);
|
||||
}
|
||||
|
||||
if (info->reward_currency_repeatable > 0 || coinsToSend > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable + coinsToSend, lootSource);
|
||||
}
|
||||
|
||||
@@ -508,11 +508,11 @@ void Mission::YieldRewards() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT);
|
||||
}
|
||||
|
||||
if (info->reward_currency > 0 || coinsToSend > 0) {
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT;
|
||||
eLootSourceType lootSource = info->isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT;
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency + coinsToSend, lootSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -318,13 +318,13 @@ void LootGenerator::GiveActivityLoot(Entity* player, Entity* source, uint32_t ac
|
||||
maxCoins = currencyTable[0].maxvalue;
|
||||
}
|
||||
|
||||
GiveLoot(player, selectedReward->LootMatrixIndex, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
GiveLoot(player, selectedReward->LootMatrixIndex, eLootSourceType::ACTIVITY);
|
||||
|
||||
uint32_t coins = (int)(minCoins + GeneralUtils::GenerateRandomNumber<float>(0, 1) * (maxCoins - minCoins));
|
||||
|
||||
auto* character = player->GetCharacter();
|
||||
|
||||
character->SetCoins(character->GetCoins() + coins, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
character->SetCoins(character->GetCoins() + coins, eLootSourceType::ACTIVITY);
|
||||
}
|
||||
|
||||
void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins) {
|
||||
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
|
||||
std::unordered_map<LOT, int32_t> RollLootMatrix(Entity* player, uint32_t matrixIndex);
|
||||
std::unordered_map<LOT, int32_t> RollLootMatrix(uint32_t matrixIndex);
|
||||
void GiveLoot(Entity* player, uint32_t matrixIndex, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
void GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
void GiveLoot(Entity* player, uint32_t matrixIndex, eLootSourceType lootSourceType = eLootSourceType::NONE);
|
||||
void GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result, eLootSourceType lootSourceType = eLootSourceType::NONE);
|
||||
void GiveActivityLoot(Entity* player, Entity* source, uint32_t activityID, int32_t rating = 0);
|
||||
void DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins);
|
||||
void DropLoot(Entity* player, Entity* killedObject, std::unordered_map<LOT, int32_t>& result, uint32_t minCoins, uint32_t maxCoins);
|
||||
|
||||
@@ -259,7 +259,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd
|
||||
}
|
||||
|
||||
Mail::SendSendResponse(sysAddr, Mail::MailSendResponse::Success);
|
||||
entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost, eLootSourceType::LOOT_SOURCE_MAIL);
|
||||
entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost, eLootSourceType::MAIL);
|
||||
|
||||
Game::logger->Log("Mail", "Seeing if we need to remove item with ID/count/LOT: %i %i %i", itemID, attachmentCount, itemLOT);
|
||||
|
||||
@@ -359,7 +359,7 @@ void Mail::HandleAttachmentCollect(RakNet::BitStream* packet, const SystemAddres
|
||||
auto inv = static_cast<InventoryComponent*>(player->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
if (!inv) return;
|
||||
|
||||
inv->AddItem(attachmentLOT, attachmentCount, eLootSourceType::LOOT_SOURCE_MAIL);
|
||||
inv->AddItem(attachmentLOT, attachmentCount, eLootSourceType::MAIL);
|
||||
|
||||
Mail::SendAttachmentRemoveConfirm(sysAddr, mailID);
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
#include "eObjectBits.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eControlScheme.h"
|
||||
|
||||
#include "CDObjectsTable.h"
|
||||
#include "CDZoneTableTable.h"
|
||||
@@ -497,7 +498,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
const auto state = !entity->GetVar<bool>(u"freecam");
|
||||
entity->SetVar<bool>(u"freecam", state);
|
||||
|
||||
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlSceme>(state ? 9 : 1));
|
||||
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlScheme>(state ? 9 : 1));
|
||||
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Toggled freecam.");
|
||||
return;
|
||||
@@ -511,7 +512,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlSceme>(scheme));
|
||||
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlScheme>(scheme));
|
||||
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Switched control scheme.");
|
||||
return;
|
||||
@@ -653,7 +654,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "setflag" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 1) {
|
||||
uint32_t flagId;
|
||||
int32_t flagId;
|
||||
|
||||
if (!GeneralUtils::TryParse(args[0], flagId)) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag id.");
|
||||
@@ -664,7 +665,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "setflag" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 2) {
|
||||
uint32_t flagId;
|
||||
int32_t flagId;
|
||||
std::string onOffFlag = args[0];
|
||||
if (!GeneralUtils::TryParse(args[1], flagId)) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag id.");
|
||||
@@ -677,7 +678,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
entity->GetCharacter()->SetPlayerFlag(flagId, onOffFlag == "on");
|
||||
}
|
||||
if (chatCommand == "clearflag" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 1) {
|
||||
uint32_t flagId;
|
||||
int32_t flagId;
|
||||
|
||||
if (!GeneralUtils::TryParse(args[0], flagId)) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag id.");
|
||||
@@ -793,7 +794,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
|
||||
inventory->AddItem(itemLOT, 1, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
inventory->AddItem(itemLOT, 1, eLootSourceType::MODERATION);
|
||||
} else if (args.size() == 2) {
|
||||
uint32_t itemLOT;
|
||||
|
||||
@@ -811,7 +812,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
|
||||
inventory->AddItem(itemLOT, count, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
inventory->AddItem(itemLOT, count, eLootSourceType::MODERATION);
|
||||
} else {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /gmadditem <lot>");
|
||||
}
|
||||
@@ -1346,9 +1347,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
CharacterComponent* character = entity->GetComponent<CharacterComponent>();
|
||||
if (character) character->SetUScore(character->GetUScore() + uscore);
|
||||
// LOOT_SOURCE_MODERATION should work but it doesn't. Relog to see uscore changes
|
||||
// MODERATION should work but it doesn't. Relog to see uscore changes
|
||||
|
||||
eLootSourceType lootType = eLootSourceType::LOOT_SOURCE_MODERATION;
|
||||
eLootSourceType lootType = eLootSourceType::MODERATION;
|
||||
|
||||
int32_t type;
|
||||
if (args.size() >= 2 && GeneralUtils::TryParse(args[1], type)) {
|
||||
@@ -1466,7 +1467,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
auto* ch = entity->GetCharacter();
|
||||
ch->SetCoins(ch->GetCoins() + money, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
ch->SetCoins(ch->GetCoins() + money, eLootSourceType::MODERATION);
|
||||
}
|
||||
|
||||
if ((chatCommand == "setcurrency") && args.size() == 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
@@ -1478,7 +1479,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
auto* ch = entity->GetCharacter();
|
||||
ch->SetCoins(money, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
ch->SetCoins(money, eLootSourceType::MODERATION);
|
||||
}
|
||||
|
||||
// Allow for this on even while not a GM, as it sometimes toggles incorrrectly.
|
||||
@@ -1727,7 +1728,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
std::vector<LDFBaseData*> data{};
|
||||
data.push_back(new LDFData<int32_t>(u"reforgedLOT", reforgedItem));
|
||||
|
||||
inventoryComponent->AddItem(baseItem, 1, eLootSourceType::LOOT_SOURCE_MODERATION, eInventoryType::INVALID, data);
|
||||
inventoryComponent->AddItem(baseItem, 1, eLootSourceType::MODERATION, eInventoryType::INVALID, data);
|
||||
}
|
||||
|
||||
if (chatCommand == "crash" && entity->GetGMLevel() >= eGameMasterLevel::OPERATOR) {
|
||||
|
||||
Reference in New Issue
Block a user