mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +00:00
Merge remote-tracking branch 'upstream/main' into more-cdclient-cleanup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -13,8 +13,9 @@
|
||||
#include "VehiclePhysicsComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Item.h"
|
||||
#include "AMFFormat.h"
|
||||
#include "Amf3.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);
|
||||
}
|
||||
@@ -733,6 +734,6 @@ void CharacterComponent::RemoveVentureVisionEffect(std::string ventureVisionType
|
||||
void CharacterComponent::UpdateClientMinimap(bool showFaction, std::string ventureVisionType) const {
|
||||
if (!m_Parent) return;
|
||||
AMFArrayValue arrayToSend;
|
||||
arrayToSend.InsertValue(ventureVisionType, showFaction ? static_cast<AMFValue*>(new AMFTrueValue()) : static_cast<AMFValue*>(new AMFFalseValue()));
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent ? m_Parent->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", &arrayToSend);
|
||||
arrayToSend.Insert(ventureVisionType, showFaction);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent ? m_Parent->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", arrayToSend);
|
||||
}
|
||||
|
@@ -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 = {};
|
||||
@@ -319,7 +320,7 @@ void ControllablePhysicsComponent::RemoveSpeedboost(float value) {
|
||||
|
||||
// Recalculate speedboost since we removed one
|
||||
m_SpeedBoost = 0.0f;
|
||||
if (m_ActiveSpeedBoosts.size() == 0) { // no active speed boosts left, so return to base speed
|
||||
if (m_ActiveSpeedBoosts.empty()) { // no active speed boosts left, so return to base speed
|
||||
auto* levelProgressionComponent = m_Parent->GetComponent<LevelProgressionComponent>();
|
||||
if (levelProgressionComponent) m_SpeedBoost = levelProgressionComponent->GetSpeedBase();
|
||||
} else { // Used the last applied speedboost
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
class Entity;
|
||||
class dpEntity;
|
||||
enum class eStateChangeType : uint32_t;
|
||||
|
||||
/**
|
||||
* Handles the movement of controllable Entities, e.g. enemies and players
|
||||
@@ -275,7 +276,7 @@ public:
|
||||
* The speed boosts of this component.
|
||||
* @return All active Speed boosts for this component.
|
||||
*/
|
||||
std::vector<float> GetActiveSpeedboosts() { return m_ActivePickupRadiusScales; };
|
||||
std::vector<float> GetActiveSpeedboosts() { return m_ActiveSpeedBoosts; };
|
||||
|
||||
/**
|
||||
* Activates the Bubble Buff
|
||||
|
@@ -4,8 +4,8 @@
|
||||
#include "Game.h"
|
||||
#include "dConfig.h"
|
||||
|
||||
#include "AMFFormat.h"
|
||||
#include "AMFFormat_BitStream.h"
|
||||
#include "Amf3.h"
|
||||
#include "AmfSerialize.h"
|
||||
#include "GameMessages.h"
|
||||
#include "User.h"
|
||||
#include "CDClientManager.h"
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "dZoneManager.h"
|
||||
#include "WorldConfig.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eStateChangeType.h"
|
||||
#include "eGameActivity.h"
|
||||
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
|
||||
@@ -243,16 +245,12 @@ void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
|
||||
if (playAnim) {
|
||||
// Now update the player bar
|
||||
if (!m_Parent->GetParentUser()) return;
|
||||
AMFStringValue* amount = new AMFStringValue();
|
||||
amount->SetStringValue(std::to_string(difference));
|
||||
AMFStringValue* type = new AMFStringValue();
|
||||
type->SetStringValue("health");
|
||||
|
||||
AMFArrayValue args;
|
||||
args.InsertValue("amount", amount);
|
||||
args.InsertValue("type", type);
|
||||
args.Insert("amount", std::to_string(difference));
|
||||
args.Insert("type", "health");
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
@@ -288,16 +286,12 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) {
|
||||
if (playAnim) {
|
||||
// Now update the player bar
|
||||
if (!m_Parent->GetParentUser()) return;
|
||||
AMFStringValue* amount = new AMFStringValue();
|
||||
amount->SetStringValue(std::to_string(value));
|
||||
AMFStringValue* type = new AMFStringValue();
|
||||
type->SetStringValue("armor");
|
||||
|
||||
AMFArrayValue args;
|
||||
args.InsertValue("amount", amount);
|
||||
args.InsertValue("type", type);
|
||||
args.Insert("amount", std::to_string(value));
|
||||
args.Insert("type", "armor");
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
@@ -332,16 +326,12 @@ void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
|
||||
if (playAnim) {
|
||||
// Now update the player bar
|
||||
if (!m_Parent->GetParentUser()) return;
|
||||
AMFStringValue* amount = new AMFStringValue();
|
||||
amount->SetStringValue(std::to_string(difference));
|
||||
AMFStringValue* type = new AMFStringValue();
|
||||
type->SetStringValue("imagination");
|
||||
|
||||
AMFArrayValue args;
|
||||
args.InsertValue("amount", amount);
|
||||
args.InsertValue("type", type);
|
||||
args.Insert("amount", std::to_string(difference));
|
||||
args.Insert("type", "imagination");
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
}
|
||||
@@ -468,7 +458,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 +504,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 +793,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 +982,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 +1013,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 +1037,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:
|
||||
{
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#include "InventoryComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Game.h"
|
||||
#include "AMFFormat.h"
|
||||
#include "Amf3.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "Mail.h"
|
||||
#include "MissionPrerequisites.h"
|
||||
|
@@ -14,7 +14,7 @@ class ModuleAssemblyComponent : public Component {
|
||||
public:
|
||||
static const eReplicaComponentType ComponentType = eReplicaComponentType::MODULE_ASSEMBLY;
|
||||
|
||||
ModuleAssemblyComponent(Entity* MSG_CHAT_INTERNAL_PLAYER_REMOVED_NOTIFICATION);
|
||||
ModuleAssemblyComponent(Entity* parent);
|
||||
~ModuleAssemblyComponent() override;
|
||||
|
||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||
|
@@ -307,13 +307,14 @@ float MovementAIComponent::GetBaseSpeed(LOT lot) {
|
||||
|
||||
foundComponent:
|
||||
|
||||
float speed;
|
||||
// Client defaults speed to 10 and if the speed is also null in the table, it defaults to 10.
|
||||
float speed = 10.0f;
|
||||
|
||||
if (physicsComponent == nullptr) {
|
||||
speed = 8;
|
||||
} else {
|
||||
speed = physicsComponent->speed;
|
||||
}
|
||||
if (physicsComponent) speed = physicsComponent->speed;
|
||||
|
||||
float delta = fabs(speed) - 1.0f;
|
||||
|
||||
if (delta <= std::numeric_limits<float>::epsilon()) speed = 10.0f;
|
||||
|
||||
m_PhysicsSpeedCache[lot] = speed;
|
||||
|
||||
|
@@ -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"
|
||||
@@ -23,6 +27,7 @@
|
||||
#include "EntityInfo.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eObjectBits.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
|
||||
std::unordered_map<LOT, PetComponent::PetPuzzleData> PetComponent::buildCache{};
|
||||
@@ -33,7 +38,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 +290,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
m_Parent->GetObjectID(),
|
||||
LWOOBJID_EMPTY,
|
||||
true,
|
||||
NOTIFY_TYPE_BEGIN,
|
||||
ePetTamingNotifyType::BEGIN,
|
||||
petPosition,
|
||||
position,
|
||||
rotation,
|
||||
@@ -297,7 +302,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
LWOOBJID_EMPTY,
|
||||
originator->GetObjectID(),
|
||||
true,
|
||||
NOTIFY_TYPE_BEGIN,
|
||||
ePetTamingNotifyType::BEGIN,
|
||||
petPosition,
|
||||
position,
|
||||
rotation,
|
||||
@@ -313,7 +318,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,8 +557,8 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
|
||||
LWOOBJID petSubKey = ObjectIDManager::Instance()->GenerateRandomObjectID();
|
||||
|
||||
petSubKey = GeneralUtils::SetBit(petSubKey, OBJECT_BIT_CHARACTER);
|
||||
petSubKey = GeneralUtils::SetBit(petSubKey, OBJECT_BIT_PERSISTENT);
|
||||
GeneralUtils::SetBit(petSubKey, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(petSubKey, eObjectBits::PERSISTENT);
|
||||
|
||||
m_DatabaseId = petSubKey;
|
||||
|
||||
@@ -566,7 +571,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 +595,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
LWOOBJID_EMPTY,
|
||||
LWOOBJID_EMPTY,
|
||||
false,
|
||||
NOTIFY_TYPE_NAMINGPET,
|
||||
ePetTamingNotifyType::NAMINGPET,
|
||||
NiPoint3::ZERO,
|
||||
NiPoint3::ZERO,
|
||||
NiQuaternion::IDENTITY,
|
||||
@@ -670,7 +675,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 +696,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 +716,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 +737,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 +767,7 @@ void PetComponent::ClientFailTamingMinigame() {
|
||||
m_Parent->GetObjectID(),
|
||||
m_Tamer,
|
||||
false,
|
||||
NOTIFY_TYPE_FAILED,
|
||||
ePetTamingNotifyType::FAILED,
|
||||
NiPoint3::ZERO,
|
||||
NiPoint3::ZERO,
|
||||
NiQuaternion::IDENTITY,
|
||||
@@ -783,7 +788,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 +889,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 +933,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
|
||||
|
@@ -216,6 +216,13 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\env_won_fv_gas-blocking-volume.hkx"){
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 390.496826f, 111.467964f, 600.821534f, true);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_Position.y -= (111.467964f * m_Scale) / 2;
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else {
|
||||
//Game::logger->Log("PhantomPhysicsComponent", "This one is supposed to have %s", info->physicsAsset.c_str());
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -11,7 +11,8 @@
|
||||
#include "CharacterComponent.h"
|
||||
#include "UserManager.h"
|
||||
#include "dLogger.h"
|
||||
#include "AMFFormat.h"
|
||||
#include "Amf3.h"
|
||||
#include "eObjectBits.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
|
||||
PropertyEntranceComponent::PropertyEntranceComponent(uint32_t componentID, Entity* parent) : Component(parent) {
|
||||
@@ -35,12 +36,9 @@ void PropertyEntranceComponent::OnUse(Entity* entity) {
|
||||
|
||||
AMFArrayValue args;
|
||||
|
||||
auto* state = new AMFStringValue();
|
||||
state->SetStringValue("property_menu");
|
||||
args.Insert("state", "property_menu");
|
||||
|
||||
args.InsertValue("state", state);
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(entity, entity->GetSystemAddress(), "pushGameState", &args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(entity, entity->GetSystemAddress(), "pushGameState", args);
|
||||
}
|
||||
|
||||
void PropertyEntranceComponent::OnEnterProperty(Entity* entity, uint32_t index, bool returnToZone, const SystemAddress& sysAddr) {
|
||||
@@ -243,8 +241,8 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
|
||||
|
||||
// Convert owner char id to LWOOBJID
|
||||
LWOOBJID ownerObjId = owner;
|
||||
ownerObjId = GeneralUtils::SetBit(ownerObjId, OBJECT_BIT_CHARACTER);
|
||||
ownerObjId = GeneralUtils::SetBit(ownerObjId, OBJECT_BIT_PERSISTENT);
|
||||
GeneralUtils::SetBit(ownerObjId, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(ownerObjId, eObjectBits::PERSISTENT);
|
||||
|
||||
// Query to get friend and best friend fields
|
||||
auto friendCheck = Database::CreatePreppedStmt("SELECT best_friend FROM friends WHERE (player_id = ? AND friend_id = ?) OR (player_id = ? AND friend_id = ?)");
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "PropertyEntranceComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eObjectBits.h"
|
||||
|
||||
#include <vector>
|
||||
#include "CppScripts.h"
|
||||
@@ -66,8 +67,8 @@ PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Compo
|
||||
if (propertyEntry->next()) {
|
||||
this->propertyId = propertyEntry->getUInt64(1);
|
||||
this->owner = propertyEntry->getUInt64(2);
|
||||
this->owner = GeneralUtils::SetBit(this->owner, OBJECT_BIT_CHARACTER);
|
||||
this->owner = GeneralUtils::SetBit(this->owner, OBJECT_BIT_PERSISTENT);
|
||||
GeneralUtils::SetBit(this->owner, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(this->owner, eObjectBits::PERSISTENT);
|
||||
this->clone_Id = propertyEntry->getInt(2);
|
||||
this->propertyName = propertyEntry->getString(5).c_str();
|
||||
this->propertyDescription = propertyEntry->getString(6).c_str();
|
||||
@@ -372,16 +373,15 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
|
||||
info.emulated = true;
|
||||
info.emulator = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID();
|
||||
|
||||
LWOOBJID id = static_cast<LWOOBJID>(persistentId) | 1ull << OBJECT_BIT_CLIENT;
|
||||
|
||||
info.spawnerID = id;
|
||||
info.spawnerID = persistentId;
|
||||
GeneralUtils::SetBit(info.spawnerID, eObjectBits::CLIENT);
|
||||
|
||||
const auto spawnerId = dZoneManager::Instance()->MakeSpawner(info);
|
||||
|
||||
auto* spawner = dZoneManager::Instance()->GetSpawner(spawnerId);
|
||||
|
||||
auto ldfModelBehavior = new LDFData<LWOOBJID>(u"modelBehaviors", 0);
|
||||
auto userModelID = new LDFData<LWOOBJID>(u"userModelID", id);
|
||||
auto userModelID = new LDFData<LWOOBJID>(u"userModelID", info.spawnerID);
|
||||
auto modelType = new LDFData<int>(u"modelType", 2);
|
||||
auto propertyObjectID = new LDFData<bool>(u"propertyObjectID", true);
|
||||
auto componentWhitelist = new LDFData<int>(u"componentWhitelist", 1);
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,8 +622,8 @@ void PropertyManagementComponent::Load() {
|
||||
//BBB property models need to have extra stuff set for them:
|
||||
if (lot == 14) {
|
||||
LWOOBJID blueprintID = lookupResult->getUInt(10);
|
||||
blueprintID = GeneralUtils::SetBit(blueprintID, OBJECT_BIT_CHARACTER);
|
||||
blueprintID = GeneralUtils::SetBit(blueprintID, OBJECT_BIT_PERSISTENT);
|
||||
GeneralUtils::SetBit(blueprintID, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(blueprintID, eObjectBits::PERSISTENT);
|
||||
|
||||
LDFBaseData* ldfBlueprintID = new LDFData<LWOOBJID>(u"blueprintid", blueprintID);
|
||||
LDFBaseData* componentWhitelist = new LDFData<int>(u"componentWhitelist", 1);
|
||||
|
@@ -23,6 +23,8 @@
|
||||
#include "dConfig.h"
|
||||
#include "Loot.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "CDActivitiesTable.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846264338327950288
|
||||
@@ -45,36 +47,14 @@ RacingControlComponent::RacingControlComponent(Entity* parent)
|
||||
m_EmptyTimer = 0;
|
||||
m_SoloRacing = Game::config->GetValue("solo_racing") == "1";
|
||||
|
||||
// Select the main world ID as fallback when a player fails to load.
|
||||
|
||||
m_MainWorld = 1200;
|
||||
const auto worldID = Game::server->GetZoneID();
|
||||
if (dZoneManager::Instance()->CheckIfAccessibleZone((worldID/10)*10)) m_MainWorld = (worldID/10)*10;
|
||||
|
||||
switch (worldID) {
|
||||
case 1203:
|
||||
m_ActivityID = 42;
|
||||
m_MainWorld = 1200;
|
||||
break;
|
||||
|
||||
case 1261:
|
||||
m_ActivityID = 60;
|
||||
m_MainWorld = 1260;
|
||||
break;
|
||||
|
||||
case 1303:
|
||||
m_ActivityID = 39;
|
||||
m_MainWorld = 1300;
|
||||
break;
|
||||
|
||||
case 1403:
|
||||
m_ActivityID = 54;
|
||||
m_MainWorld = 1400;
|
||||
break;
|
||||
|
||||
default:
|
||||
m_ActivityID = 42;
|
||||
m_MainWorld = 1200;
|
||||
break;
|
||||
}
|
||||
m_ActivityID = 42;
|
||||
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
||||
std::vector<CDActivities> activities = activitiesTable->Query([=](CDActivities entry) {return (entry.instanceMapID == worldID); });
|
||||
for (CDActivities activity : activities) m_ActivityID = activity.ActivityID;
|
||||
}
|
||||
|
||||
RacingControlComponent::~RacingControlComponent() {}
|
||||
@@ -311,7 +291,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;
|
||||
@@ -382,8 +362,7 @@ void RacingControlComponent::OnRacingPlayerInfoResetFinished(Entity* player) {
|
||||
}
|
||||
}
|
||||
|
||||
void RacingControlComponent::HandleMessageBoxResponse(Entity* player,
|
||||
const std::string& id) {
|
||||
void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t button, const std::string& id) {
|
||||
auto* data = GetPlayerData(player->GetObjectID());
|
||||
|
||||
if (data == nullptr) {
|
||||
@@ -425,7 +404,7 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player,
|
||||
missionComponent->Progress(eMissionTaskType::RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::LAST_PLACE_FINISH); // Finished first place in specific world.
|
||||
}
|
||||
}
|
||||
} else if (id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") {
|
||||
} else if ((id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") && button == m_ActivityExitConfirm) {
|
||||
auto* vehicle = EntityManager::Instance()->GetEntity(data->vehicleID);
|
||||
|
||||
if (vehicle == nullptr) {
|
||||
@@ -765,7 +744,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);
|
||||
|
@@ -144,7 +144,7 @@ public:
|
||||
/**
|
||||
* Invoked when the player responds to the GUI.
|
||||
*/
|
||||
void HandleMessageBoxResponse(Entity* player, const std::string& id);
|
||||
void HandleMessageBoxResponse(Entity* player, int32_t button, const std::string& id);
|
||||
|
||||
/**
|
||||
* Get the racing data from a player's LWOOBJID.
|
||||
@@ -246,4 +246,9 @@ private:
|
||||
float m_EmptyTimer;
|
||||
|
||||
bool m_SoloRacing;
|
||||
|
||||
/**
|
||||
* Value for message box response to know if we are exiting the race via the activity dialogue
|
||||
*/
|
||||
const int32_t m_ActivityExitConfirm = 1;
|
||||
};
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "dLogger.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t componentID) : Component(parent) {
|
||||
m_ComponentID = componentID;
|
||||
@@ -43,7 +44,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"
|
||||
@@ -48,7 +51,7 @@ RebuildComponent::~RebuildComponent() {
|
||||
|
||||
Entity* builder = GetBuilder();
|
||||
if (builder) {
|
||||
CancelRebuild(builder, eFailReason::REASON_BUILD_ENDED, true);
|
||||
CancelRebuild(builder, eQuickBuildFailReason::BUILD_ENDED, true);
|
||||
}
|
||||
|
||||
DespawnActivator();
|
||||
@@ -67,7 +70,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;
|
||||
@@ -91,7 +94,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);
|
||||
@@ -121,7 +124,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
}*/
|
||||
|
||||
switch (m_State) {
|
||||
case REBUILD_OPEN: {
|
||||
case eRebuildState::OPEN: {
|
||||
SpawnActivator();
|
||||
m_TimeBeforeDrain = 0;
|
||||
|
||||
@@ -151,7 +154,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
|
||||
@@ -173,7 +176,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case REBUILD_BUILDING:
|
||||
case eRebuildState::BUILDING:
|
||||
{
|
||||
Entity* builder = GetBuilder();
|
||||
|
||||
@@ -194,18 +197,18 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>();
|
||||
if (!destComp) break;
|
||||
|
||||
int newImagination = destComp->GetImagination() - 1;
|
||||
int newImagination = destComp->GetImagination();
|
||||
if (newImagination <= 0) {
|
||||
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
|
||||
break;
|
||||
}
|
||||
|
||||
++m_DrainedImagination;
|
||||
--newImagination;
|
||||
destComp->SetImagination(newImagination);
|
||||
EntityManager::Instance()->SerializeEntity(builder);
|
||||
|
||||
++m_DrainedImagination;
|
||||
|
||||
if (newImagination == 0 && m_DrainedImagination < m_TakeImagination) {
|
||||
CancelRebuild(builder, eFailReason::REASON_OUT_OF_IMAGINATION, true);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {
|
||||
@@ -214,7 +217,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
|
||||
@@ -235,11 +238,12 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
}
|
||||
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 +397,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 +436,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 +445,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 +524,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) {
|
||||
RenderComponent::PlayAnimation(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 +556,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 +572,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 +590,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
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "AMFFormat.h"
|
||||
#include "Amf3.h"
|
||||
#include "Component.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
|
@@ -15,8 +15,10 @@
|
||||
#include "PropertyEntranceComponent.h"
|
||||
#include "RocketLaunchLupComponent.h"
|
||||
#include "dServer.h"
|
||||
#include "dMessageIdentifiers.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "eObjectWorldState.h"
|
||||
#include "eConnectionType.h"
|
||||
#include "eMasterMessageType.h"
|
||||
|
||||
RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent, int rocketId) : Component(parent) {
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
@@ -77,7 +79,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);
|
||||
}
|
||||
@@ -135,7 +137,7 @@ LWOCLONEID RocketLaunchpadControlComponent::GetSelectedCloneId(LWOOBJID player)
|
||||
|
||||
void RocketLaunchpadControlComponent::TellMasterToPrepZone(int zoneID) {
|
||||
CBITSTREAM;
|
||||
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_PREP_ZONE);
|
||||
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::PREP_ZONE);
|
||||
bitStream.Write(zoneID);
|
||||
Game::server->SendToMaster(&bitStream);
|
||||
}
|
||||
|
@@ -18,13 +18,16 @@
|
||||
#include "dConfig.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "dMessageIdentifiers.h"
|
||||
#include "Loot.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eMatchUpdate.h"
|
||||
#include "eConnectionType.h"
|
||||
#include "eChatInternalMessageType.h"
|
||||
|
||||
#include "CDCurrencyTableTable.h"
|
||||
#include "CDActivityRewardsTable.h"
|
||||
#include "CDActivitiesTable.h"
|
||||
#include "LeaderboardManager.h"
|
||||
|
||||
ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activityID) : Component(parent) {
|
||||
m_ActivityID = activityID;
|
||||
@@ -33,10 +36,7 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit
|
||||
|
||||
for (CDActivities activity : activities) {
|
||||
m_ActivityInfo = activity;
|
||||
|
||||
const auto mapID = m_ActivityInfo.instanceMapID;
|
||||
|
||||
if ((mapID == 1203 || mapID == 1261 || mapID == 1303 || mapID == 1403) && Game::config->GetValue("solo_racing") == "1") {
|
||||
if (static_cast<LeaderboardType>(activity.leaderboardType) == LeaderboardType::Racing && Game::config->GetValue("solo_racing") == "1") {
|
||||
m_ActivityInfo.minTeamSize = 1;
|
||||
m_ActivityInfo.minTeams = 1;
|
||||
}
|
||||
@@ -167,9 +167,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 +185,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 +201,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 +242,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 +267,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 +375,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)
|
||||
@@ -516,7 +516,7 @@ void ActivityInstance::StartZone() {
|
||||
// only make a team if we have more than one participant
|
||||
if (participants.size() > 1) {
|
||||
CBITSTREAM;
|
||||
PacketUtils::WriteHeader(bitStream, CHAT_INTERNAL, MSG_CHAT_INTERNAL_CREATE_TEAM);
|
||||
PacketUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::CREATE_TEAM);
|
||||
|
||||
bitStream.Write(leader->GetObjectID());
|
||||
bitStream.Write(m_Participants.size());
|
||||
|
@@ -20,11 +20,11 @@
|
||||
#include "ScriptComponent.h"
|
||||
#include "BuffComponent.h"
|
||||
#include "EchoStartSkill.h"
|
||||
#include "dMessageIdentifiers.h"
|
||||
#include "DoClientProjectileImpact.h"
|
||||
#include "CDClientManager.h"
|
||||
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
#include "eConnectionType.h"
|
||||
#include "eClientMessageType.h"
|
||||
|
||||
ProjectileSyncEntry::ProjectileSyncEntry() {
|
||||
}
|
||||
@@ -134,6 +134,10 @@ void SkillComponent::Update(const float deltaTime) {
|
||||
CalculateUpdate(deltaTime);
|
||||
}
|
||||
|
||||
if (m_Parent->IsPlayer()) {
|
||||
for (const auto& pair : this->m_managedBehaviors) pair.second->UpdatePlayerSyncs(deltaTime);
|
||||
}
|
||||
|
||||
std::map<uint32_t, BehaviorContext*> keep{};
|
||||
|
||||
for (const auto& pair : this->m_managedBehaviors) {
|
||||
@@ -192,7 +196,15 @@ void SkillComponent::Interrupt() {
|
||||
auto* combat = m_Parent->GetComponent<BaseCombatAIComponent>();
|
||||
if (combat != nullptr && combat->GetStunImmune()) return;
|
||||
|
||||
for (const auto& behavior : this->m_managedBehaviors) behavior.second->Interrupt();
|
||||
for (const auto& behavior : this->m_managedBehaviors) {
|
||||
for (const auto& behaviorEndEntry : behavior.second->endEntries) {
|
||||
behaviorEndEntry.behavior->End(behavior.second, behaviorEndEntry.branchContext, behaviorEndEntry.second);
|
||||
}
|
||||
behavior.second->endEntries.clear();
|
||||
if (m_Parent->IsPlayer()) continue;
|
||||
behavior.second->Interrupt();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SkillComponent::RegisterCalculatedProjectile(const LWOOBJID projectileId, BehaviorContext* context, const BehaviorBranchContext& branch, const LOT lot, const float maxTime,
|
||||
@@ -215,7 +227,7 @@ void SkillComponent::RegisterCalculatedProjectile(const LWOOBJID projectileId, B
|
||||
this->m_managedProjectiles.push_back(entry);
|
||||
}
|
||||
|
||||
bool SkillComponent::CastSkill(const uint32_t skillId, LWOOBJID target, const LWOOBJID optionalOriginatorID){
|
||||
bool SkillComponent::CastSkill(const uint32_t skillId, LWOOBJID target, const LWOOBJID optionalOriginatorID) {
|
||||
uint32_t behaviorId = -1;
|
||||
// try to find it via the cache
|
||||
const auto& pair = m_skillBehaviorCache.find(skillId);
|
||||
@@ -248,6 +260,8 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
|
||||
context->caster = m_Parent->GetObjectID();
|
||||
|
||||
context->skillID = skillId;
|
||||
|
||||
context->clientInitalized = clientInitalized;
|
||||
|
||||
context->foundTarget = target != LWOOBJID_EMPTY || ignoreTarget || clientInitalized;
|
||||
@@ -290,7 +304,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
// Write message
|
||||
RakNet::BitStream message;
|
||||
|
||||
PacketUtils::WriteHeader(message, CLIENT, MSG_CLIENT_GAME_MSG);
|
||||
PacketUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||
message.Write(this->m_Parent->GetObjectID());
|
||||
start.Serialize(&message);
|
||||
|
||||
@@ -423,7 +437,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
||||
|
||||
RakNet::BitStream message;
|
||||
|
||||
PacketUtils::WriteHeader(message, CLIENT, MSG_CLIENT_GAME_MSG);
|
||||
PacketUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||
message.Write(this->m_Parent->GetObjectID());
|
||||
projectileImpact.Serialize(&message);
|
||||
|
||||
@@ -463,7 +477,7 @@ void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID targ
|
||||
delete context;
|
||||
}
|
||||
|
||||
SkillComponent::SkillComponent(Entity* parent) : Component(parent) {
|
||||
SkillComponent::SkillComponent(Entity* parent): Component(parent) {
|
||||
this->m_skillUid = 0;
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,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;
|
||||
|
@@ -83,8 +83,12 @@ void TriggerComponent::HandleTriggerCommand(LUTriggers::Command* command, Entity
|
||||
case eTriggerCommandType::REPEL_OBJECT:
|
||||
HandleRepelObject(targetEntity, command->args);
|
||||
break;
|
||||
case eTriggerCommandType::SET_TIMER: break;
|
||||
case eTriggerCommandType::CANCEL_TIMER: break;
|
||||
case eTriggerCommandType::SET_TIMER:
|
||||
HandleSetTimer(targetEntity, argArray);
|
||||
break;
|
||||
case eTriggerCommandType::CANCEL_TIMER:
|
||||
HandleCancelTimer(targetEntity, command->args);
|
||||
break;
|
||||
case eTriggerCommandType::PLAY_CINEMATIC:
|
||||
HandlePlayCinematic(targetEntity, argArray);
|
||||
break;
|
||||
@@ -194,7 +198,7 @@ void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string arg
|
||||
void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){
|
||||
auto* triggerComponent = targetEntity->GetComponent<TriggerComponent>();
|
||||
if (!triggerComponent) {
|
||||
Game::logger->Log("TriggerComponent::HandleToggleTrigger", "Trigger component not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandleToggleTrigger", "Trigger component not found!");
|
||||
return;
|
||||
}
|
||||
triggerComponent->SetTriggerEnabled(args == "1");
|
||||
@@ -203,7 +207,7 @@ void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string arg
|
||||
void TriggerComponent::HandleResetRebuild(Entity* targetEntity, std::string args){
|
||||
auto* rebuildComponent = targetEntity->GetComponent<RebuildComponent>();
|
||||
if (!rebuildComponent) {
|
||||
Game::logger->Log("TriggerComponent::HandleResetRebuild", "Rebuild component not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandleResetRebuild", "Rebuild component not found!");
|
||||
return;
|
||||
}
|
||||
rebuildComponent->ResetRebuild(args == "1");
|
||||
@@ -231,9 +235,11 @@ void TriggerComponent::HandleRotateObject(Entity* targetEntity, std::vector<std:
|
||||
}
|
||||
|
||||
void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::string> argArray){
|
||||
if (argArray.size() < 3) return;
|
||||
|
||||
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->Log("TriggerComponent::HandlePushObject", "Phantom Physics component not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandlePushObject", "Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
@@ -250,7 +256,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
|
||||
void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args){
|
||||
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->Log("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
float forceMultiplier;
|
||||
@@ -271,6 +277,20 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray){
|
||||
if (argArray.size() != 2) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleSetTimer", "Not ehought variables!");
|
||||
return;
|
||||
}
|
||||
float time = 0.0;
|
||||
GeneralUtils::TryParse<float>(argArray.at(1), time);
|
||||
m_Parent->AddTimer(argArray.at(0), time);
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleCancelTimer(Entity* targetEntity, std::string args){
|
||||
m_Parent->CancelTimer(args);
|
||||
}
|
||||
|
||||
void TriggerComponent::HandlePlayCinematic(Entity* targetEntity, std::vector<std::string> argArray) {
|
||||
float leadIn = -1.0;
|
||||
auto wait = eEndBehavior::RETURN;
|
||||
@@ -300,7 +320,7 @@ void TriggerComponent::HandlePlayCinematic(Entity* targetEntity, std::vector<std
|
||||
void TriggerComponent::HandleToggleBBB(Entity* targetEntity, std::string args) {
|
||||
auto* character = targetEntity->GetCharacter();
|
||||
if (!character) {
|
||||
Game::logger->Log("TriggerComponent::HandleToggleBBB", "Character was not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandleToggleBBB", "Character was not found!");
|
||||
return;
|
||||
}
|
||||
bool buildMode = !(character->GetBuildMode());
|
||||
@@ -316,7 +336,7 @@ void TriggerComponent::HandleUpdateMission(Entity* targetEntity, std::vector<std
|
||||
if (argArray.at(0) != "exploretask") return;
|
||||
MissionComponent* missionComponent = targetEntity->GetComponent<MissionComponent>();
|
||||
if (!missionComponent){
|
||||
Game::logger->Log("TriggerComponent::HandleUpdateMission", "Mission component not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandleUpdateMission", "Mission component not found!");
|
||||
return;
|
||||
}
|
||||
missionComponent->Progress(eMissionTaskType::EXPLORE, 0, 0, argArray.at(4));
|
||||
@@ -335,7 +355,7 @@ void TriggerComponent::HandlePlayEffect(Entity* targetEntity, std::vector<std::s
|
||||
void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
||||
auto* skillComponent = targetEntity->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) {
|
||||
Game::logger->Log("TriggerComponent::HandleCastSkill", "Skill component not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandleCastSkill", "Skill component not found!");
|
||||
return;
|
||||
}
|
||||
uint32_t skillId;
|
||||
@@ -346,7 +366,7 @@ void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
||||
void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::vector<std::string> argArray) {
|
||||
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->Log("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
@@ -381,7 +401,7 @@ void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::v
|
||||
void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::string args) {
|
||||
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->Log("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
||||
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(args == "On");
|
||||
|
@@ -30,6 +30,8 @@ private:
|
||||
void HandleRotateObject(Entity* targetEntity, std::vector<std::string> argArray);
|
||||
void HandlePushObject(Entity* targetEntity, std::vector<std::string> argArray);
|
||||
void HandleRepelObject(Entity* targetEntity, std::string args);
|
||||
void HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray);
|
||||
void HandleCancelTimer(Entity* targetEntity, std::string args);
|
||||
void HandlePlayCinematic(Entity* targetEntity, std::vector<std::string> argArray);
|
||||
void HandleToggleBBB(Entity* targetEntity, std::string args);
|
||||
void HandleUpdateMission(Entity* targetEntity, std::vector<std::string> argArray);
|
||||
|
@@ -11,6 +11,7 @@ VehiclePhysicsComponent::VehiclePhysicsComponent(Entity* parent) : Component(par
|
||||
m_DirtyPosition = true;
|
||||
m_DirtyVelocity = true;
|
||||
m_DirtyAngularVelocity = true;
|
||||
m_EndBehavior = GeneralUtils::GenerateRandomNumber<uint32_t>(0, 7);
|
||||
}
|
||||
|
||||
VehiclePhysicsComponent::~VehiclePhysicsComponent() {
|
||||
@@ -93,7 +94,7 @@ void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
|
||||
}
|
||||
|
||||
if (bIsInitialUpdate) {
|
||||
outBitStream->Write<uint8_t>(5);
|
||||
outBitStream->Write<uint8_t>(m_EndBehavior);
|
||||
outBitStream->Write1();
|
||||
}
|
||||
|
||||
|
@@ -109,4 +109,5 @@ private:
|
||||
bool m_IsOnRail;
|
||||
|
||||
float m_SoftUpdate = 0;
|
||||
uint32_t m_EndBehavior;
|
||||
};
|
||||
|
Reference in New Issue
Block a user