mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-26 15:33:34 +00:00
Move to shared pointer
This commit is contained in:
parent
ea9d0d8592
commit
9e9e4dc087
@ -136,7 +136,7 @@ void Entity::Initialize() {
|
||||
for (const auto& [componentTemplate, componentId] : components) {
|
||||
switch (componentTemplate) {
|
||||
case eReplicaComponentType::CONTROLLABLE_PHYSICS:
|
||||
AddComponent<ControllablePhysicsComponent>(this);
|
||||
AddComponent<ControllablePhysicsComponent>();
|
||||
break;
|
||||
case eReplicaComponentType::RENDER:
|
||||
break;
|
||||
@ -432,12 +432,12 @@ void Entity::Unsubscribe(LWOOBJID scriptObjId, const std::string& notificationNa
|
||||
}
|
||||
|
||||
void Entity::SetProximityRadius(float proxRadius, std::string name) {
|
||||
auto proximityMonitorComponent = AddComponent<ProximityMonitorComponent>(this);
|
||||
auto proximityMonitorComponent = AddComponent<ProximityMonitorComponent>();
|
||||
if (proximityMonitorComponent) proximityMonitorComponent->SetProximityRadius(proxRadius, name);
|
||||
}
|
||||
|
||||
void Entity::SetProximityRadius(dpEntity* entity, std::string name) {
|
||||
auto proximityMonitorComponent = AddComponent<ProximityMonitorComponent>(this);
|
||||
auto proximityMonitorComponent = AddComponent<ProximityMonitorComponent>();
|
||||
if (proximityMonitorComponent) proximityMonitorComponent->SetProximityRadius(entity, name);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef __ENTITY__H__
|
||||
#define __ENTITY__H__
|
||||
|
||||
#include <map>
|
||||
#include <functional>
|
||||
@ -146,8 +147,8 @@ public:
|
||||
|
||||
bool HasComponent(eReplicaComponentType componentId) const;
|
||||
|
||||
template<typename ComponentType, typename...ConstructorValues>
|
||||
std::shared_ptr<ComponentType> AddComponent(ConstructorValues... arguments);
|
||||
template<typename Cmpt, typename...ConstructorValues>
|
||||
std::shared_ptr<Cmpt> AddComponent(ConstructorValues... arguments);
|
||||
|
||||
std::vector<std::shared_ptr<ScriptComponent>> GetScriptComponents();
|
||||
|
||||
@ -290,6 +291,8 @@ public:
|
||||
|
||||
Entity* GetScheduledKiller() { return m_ScheduleKiller; }
|
||||
|
||||
std::unordered_map<eReplicaComponentType, ComponentPtr>& GetComponents() { return m_Components; }
|
||||
|
||||
protected:
|
||||
LWOOBJID m_ObjectID;
|
||||
|
||||
@ -481,9 +484,14 @@ T Entity::GetNetworkVar(const std::u16string& name) {
|
||||
return LDFData<T>::Default;
|
||||
}
|
||||
|
||||
template<typename ComponentType, typename...ConstructorValues>
|
||||
std::shared_ptr<ComponentType> Entity::AddComponent(ConstructorValues...arguments) {
|
||||
if (GetComponent<ComponentType>()) return nullptr;
|
||||
template<typename Cmpt, typename...ConstructorValues>
|
||||
std::shared_ptr<Cmpt> Entity::AddComponent(ConstructorValues...arguments) {
|
||||
auto component = GetComponent<Cmpt>();
|
||||
if (component) return component;
|
||||
|
||||
m_Components.insert_or_assign(ComponentType::ComponentType, std::make_shared<ComponentType>(arguments...));
|
||||
auto insertedComponent = m_Components.insert_or_assign(Cmpt::ComponentType,
|
||||
std::make_shared<Cmpt>(this, std::forward<ConstructorValues>(arguments)...)).first->second;
|
||||
return std::dynamic_pointer_cast<Cmpt>(insertedComponent);
|
||||
}
|
||||
|
||||
#endif //!__ENTITY__H__
|
||||
|
@ -630,8 +630,8 @@ no_ghosting:
|
||||
TriggerEvent(eTriggerEventType::CREATE, this);
|
||||
|
||||
if (m_Character) {
|
||||
auto* controllablePhysicsComponent = GetComponent<ControllablePhysicsComponent>();
|
||||
auto* levelComponent = GetComponent<LevelProgressionComponent>();
|
||||
auto controllablePhysicsComponent = GetComponent<ControllablePhysicsComponent>();
|
||||
auto levelComponent = GetComponent<LevelProgressionComponent>();
|
||||
|
||||
if (controllablePhysicsComponent && levelComponent) {
|
||||
controllablePhysicsComponent->SetSpeedMultiplier(levelComponent->GetSpeedBase() / 500.0f);
|
||||
|
@ -42,7 +42,7 @@ void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchCon
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return;
|
||||
|
@ -16,7 +16,7 @@ void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return;
|
||||
@ -40,7 +40,7 @@ void DamageReductionBehavior::Timer(BehaviorContext* context, BehaviorBranchCont
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return;
|
||||
|
@ -14,7 +14,7 @@ void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr) {
|
||||
return;
|
||||
@ -34,7 +34,7 @@ void DarkInspirationBehavior::Calculate(BehaviorContext* context, RakNet::BitStr
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr) {
|
||||
return;
|
||||
|
@ -11,7 +11,7 @@ void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!target) return;
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
controllablePhysicsComponent->SetGravityScale(m_PercentSlowed);
|
||||
EntityManager::Instance()->SerializeEntity(target);
|
||||
@ -39,7 +39,7 @@ void FallSpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext bran
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!target) return;
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
controllablePhysicsComponent->SetGravityScale(1);
|
||||
EntityManager::Instance()->SerializeEntity(target);
|
||||
|
@ -44,7 +44,7 @@ void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStrea
|
||||
|
||||
auto* casterEntity = EntityManager::Instance()->GetEntity(context->caster);
|
||||
if (casterEntity != nullptr) {
|
||||
auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
|
||||
if (m_Forward == 1) {
|
||||
@ -74,7 +74,7 @@ void ForceMovementBehavior::Load() {
|
||||
void ForceMovementBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
auto* casterEntity = EntityManager::Instance()->GetEntity(context->caster);
|
||||
if (casterEntity != nullptr) {
|
||||
auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
|
||||
controllablePhysicsComponent->SetPosition(controllablePhysicsComponent->GetPosition() + controllablePhysicsComponent->GetVelocity() * m_Duration);
|
||||
|
@ -16,7 +16,7 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
Game::logger->Log("HealBehavior", "Failed to find destroyable component for %(llu)!", branch.target);
|
||||
|
@ -13,7 +13,7 @@ void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return;
|
||||
|
@ -17,7 +17,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent) {
|
||||
destroyableComponent->SetStatusImmunity(
|
||||
eStateChangeType::PUSH,
|
||||
@ -33,7 +33,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
);
|
||||
}
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent) {
|
||||
controllablePhysicsComponent->SetStunImmunity(
|
||||
eStateChangeType::PUSH,
|
||||
@ -63,7 +63,7 @@ void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext bra
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent) {
|
||||
destroyableComponent->SetStatusImmunity(
|
||||
eStateChangeType::POP,
|
||||
@ -79,7 +79,7 @@ void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext bra
|
||||
);
|
||||
}
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent) {
|
||||
controllablePhysicsComponent->SetStunImmunity(
|
||||
eStateChangeType::POP,
|
||||
|
@ -46,7 +46,7 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
|
||||
if (target == nullptr) return;
|
||||
|
||||
auto* skillComponent = target->GetComponent<SkillComponent>();
|
||||
auto skillComponent = target->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
@ -71,7 +71,7 @@ void InterruptBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b
|
||||
|
||||
if (target == nullptr) return;
|
||||
|
||||
auto* skillComponent = target->GetComponent<SkillComponent>();
|
||||
auto skillComponent = target->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
|
@ -24,7 +24,7 @@ void KnockbackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
if (target != nullptr) {
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
blocked = destroyableComponent->IsKnockbackImmune();
|
||||
|
@ -24,7 +24,7 @@ void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
|
||||
if (entity == nullptr) return;
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
|
@ -24,7 +24,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", -context->originator);
|
||||
@ -69,7 +69,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", context->originator);
|
||||
|
@ -14,7 +14,7 @@ void PullToPointBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
return;
|
||||
}
|
||||
|
||||
auto* movement = target->GetComponent<MovementAIComponent>();
|
||||
auto movement = target->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (movement == nullptr) {
|
||||
return;
|
||||
|
@ -9,7 +9,7 @@ void RemoveBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit
|
||||
auto* entity = EntityManager::Instance()->GetEntity(context->caster);
|
||||
if (!entity) return;
|
||||
|
||||
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto buffComponent = entity->GetComponent<BuffComponent>();
|
||||
if (!buffComponent) return;
|
||||
|
||||
buffComponent->RemoveBuff(m_BuffId, false, m_RemoveImmunity);
|
||||
|
@ -16,7 +16,7 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
Game::logger->Log("RepairBehavior", "Failed to find destroyable component for %(llu)!", branch.target);
|
||||
|
@ -53,7 +53,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
entity->SetOwnerOverride(context->originator);
|
||||
|
||||
// Unset the flag to reposition the player, this makes it harder to glitch out of the map
|
||||
auto* rebuildComponent = entity->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = entity->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent != nullptr) {
|
||||
rebuildComponent->SetRepositionPlayer(false);
|
||||
@ -87,9 +87,9 @@ void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
if (!destroyable) {
|
||||
entity->Smash(context->originator);
|
||||
|
||||
return;
|
||||
|
@ -12,7 +12,7 @@ void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!target) return;
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
|
||||
controllablePhysicsComponent->AddSpeedboost(m_RunSpeed);
|
||||
@ -41,7 +41,7 @@ void SpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext branch,
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!target) return;
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
|
||||
controllablePhysicsComponent->RemoveSpeedboost(m_RunSpeed);
|
||||
|
@ -33,7 +33,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
||||
* If our target is an enemy we can go ahead and stun it.
|
||||
*/
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
auto combatAiComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
@ -56,7 +56,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
* See if we can stun ourselves
|
||||
*/
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
auto combatAiComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
@ -72,7 +72,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
if (target != nullptr) {
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
blocked = destroyableComponent->IsKnockbackImmune();
|
||||
@ -91,7 +91,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
* If our target is an enemy we can go ahead and stun it.
|
||||
*/
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
auto combatAiComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
|
@ -22,7 +22,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr) {
|
||||
return;
|
||||
@ -46,7 +46,7 @@ void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
state = entity != nullptr;
|
||||
|
||||
if (state && m_targetHasBuff != 0) {
|
||||
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto buffComponent = entity->GetComponent<BuffComponent>();
|
||||
|
||||
if (buffComponent != nullptr && !buffComponent->HasBuff(m_targetHasBuff)) {
|
||||
state = false;
|
||||
|
@ -82,7 +82,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
return;
|
||||
}
|
||||
|
||||
const auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
const auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if ((this->m_usePickedTarget || context->clientInitalized) && branch.target > 0) {
|
||||
const auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
@ -101,7 +101,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
return;
|
||||
}
|
||||
|
||||
auto* combatAi = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAi = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
const auto casterPosition = self->GetPosition();
|
||||
|
||||
|
@ -15,7 +15,7 @@ void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
return;
|
||||
}
|
||||
|
||||
auto* combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatComponent != nullptr) {
|
||||
combatComponent->Taunt(context->originator, m_threatToAdd);
|
||||
@ -31,7 +31,7 @@ void TauntBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
return;
|
||||
}
|
||||
|
||||
auto* combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatComponent != nullptr) {
|
||||
combatComponent->Taunt(context->originator, m_threatToAdd);
|
||||
|
@ -189,10 +189,11 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
|
||||
m_StartPosition = m_OwningEntity->GetPosition();
|
||||
}
|
||||
|
||||
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (m_MovementAI == nullptr) {
|
||||
return;
|
||||
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
if (m_MovementAI == nullptr) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (stunnedThisFrame) {
|
||||
@ -243,7 +244,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
|
||||
bool hadRemainingDowntime = m_SkillTime > 0.0f;
|
||||
if (m_SkillTime > 0.0f) m_SkillTime -= deltaTime;
|
||||
|
||||
auto* rebuild = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
auto rebuild = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuild != nullptr) {
|
||||
const auto state = rebuild->GetState();
|
||||
@ -253,7 +254,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
|
||||
}
|
||||
}
|
||||
|
||||
auto* skillComponent = m_OwningEntity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = m_OwningEntity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
@ -287,7 +288,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
|
||||
}
|
||||
|
||||
if (!m_TetherEffectActive && m_OutOfCombat && (m_OutOfCombatTime -= deltaTime) <= 0) {
|
||||
auto* destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr && destroyableComponent->HasFaction(4)) {
|
||||
auto serilizationRequired = false;
|
||||
@ -547,13 +548,13 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* referenceDestroyable = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
auto referenceDestroyable = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (referenceDestroyable == nullptr) {
|
||||
Game::logger->Log("BaseCombatAIComponent", "Invalid reference destroyable component on (%llu)!", m_OwningEntity->GetObjectID());
|
||||
@ -561,7 +562,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* quickbuild = entity->GetComponent<RebuildComponent>();
|
||||
auto quickbuild = entity->GetComponent<RebuildComponent>();
|
||||
|
||||
if (quickbuild != nullptr) {
|
||||
const auto state = quickbuild->GetState();
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "Component.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
@ -319,7 +320,7 @@ private:
|
||||
/**
|
||||
* The component that handles movement AI, also owned by this entity
|
||||
*/
|
||||
MovementAIComponent* m_MovementAI;
|
||||
std::shared_ptr<MovementAIComponent> m_MovementAI;
|
||||
|
||||
/**
|
||||
* The position at which this entity spawned
|
||||
|
@ -71,7 +71,7 @@ void BouncerComponent::LookupPetSwitch() {
|
||||
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup(group);
|
||||
|
||||
for (auto* entity : entities) {
|
||||
auto* switchComponent = entity->GetComponent<SwitchComponent>();
|
||||
auto switchComponent = entity->GetComponent<SwitchComponent>();
|
||||
|
||||
if (switchComponent != nullptr) {
|
||||
switchComponent->SetPetBouncer(this);
|
||||
|
@ -149,7 +149,7 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
|
||||
if (parameter.name == "max_health") {
|
||||
const auto maxHealth = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
@ -157,7 +157,7 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
|
||||
} else if (parameter.name == "max_armor") {
|
||||
const auto maxArmor = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
@ -165,13 +165,13 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
|
||||
} else if (parameter.name == "max_imagination") {
|
||||
const auto maxImagination = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
destroyable->SetMaxImagination(destroyable->GetMaxImagination() + maxImagination);
|
||||
} else if (parameter.name == "speed") {
|
||||
auto* controllablePhysicsComponent = this->GetOwningEntity()->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = this->GetOwningEntity()->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
const auto speed = parameter.value;
|
||||
controllablePhysicsComponent->AddSpeedboost(speed);
|
||||
@ -185,7 +185,7 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
|
||||
if (parameter.name == "max_health") {
|
||||
const auto maxHealth = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
@ -193,7 +193,7 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
|
||||
} else if (parameter.name == "max_armor") {
|
||||
const auto maxArmor = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
@ -201,13 +201,13 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
|
||||
} else if (parameter.name == "max_imagination") {
|
||||
const auto maxImagination = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
destroyable->SetMaxImagination(destroyable->GetMaxImagination() - maxImagination);
|
||||
} else if (parameter.name == "speed") {
|
||||
auto* controllablePhysicsComponent = this->GetOwningEntity()->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = this->GetOwningEntity()->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
const auto speed = parameter.value;
|
||||
controllablePhysicsComponent->RemoveSpeedboost(speed);
|
||||
|
@ -27,7 +27,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
|
||||
Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque");
|
||||
}
|
||||
|
||||
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = originator->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
@ -63,7 +63,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
|
||||
GameMessages::SendStartArrangingWithItem(originator, originator->GetSystemAddress(), true, buildArea, originator->GetPosition());
|
||||
}
|
||||
|
||||
InventoryComponent* inv = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
auto inv = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
inv->PushEquippedItems(); // technically this is supposed to happen automatically... but it doesnt? so just keep this here
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ void CharacterComponent::SetLastRocketConfig(std::u16string config) {
|
||||
Item* CharacterComponent::GetRocket(Entity* player) {
|
||||
Item* rocket = nullptr;
|
||||
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
|
||||
if (!inventoryComponent) return rocket;
|
||||
|
||||
|
@ -38,6 +38,6 @@ void Component::LoadTemplateData() {
|
||||
|
||||
}
|
||||
|
||||
void Component::Serialize(RakNet::BitStream* bitStream, bool isConstruction = false) {
|
||||
void Component::Serialize(RakNet::BitStream* bitStream, bool isConstruction) {
|
||||
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void ControllablePhysicsComponent::RemoveSpeedboost(float value) {
|
||||
// Recalculate speedboost since we removed one
|
||||
m_SpeedBoost = 0.0f;
|
||||
if (m_ActiveSpeedBoosts.empty()) { // no active speed boosts left, so return to base speed
|
||||
auto* levelProgressionComponent = m_OwningEntity->GetComponent<LevelProgressionComponent>();
|
||||
auto levelProgressionComponent = m_OwningEntity->GetComponent<LevelProgressionComponent>();
|
||||
if (levelProgressionComponent) m_SpeedBoost = levelProgressionComponent->GetSpeedBase();
|
||||
} else { // Used the last applied speedboost
|
||||
m_SpeedBoost = m_ActiveSpeedBoosts.back();
|
||||
|
@ -185,7 +185,7 @@ void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
|
||||
auto buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
|
||||
|
||||
if (buffComponent != nullptr) {
|
||||
buffComponent->LoadFromXml(doc);
|
||||
@ -207,7 +207,7 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
|
||||
auto buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
|
||||
|
||||
if (buffComponent != nullptr) {
|
||||
buffComponent->UpdateXml(doc);
|
||||
@ -224,7 +224,7 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
void DestroyableComponent::SetHealth(int32_t value) {
|
||||
m_DirtyHealth = true;
|
||||
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackHealthDelta(value - m_iHealth);
|
||||
}
|
||||
@ -262,14 +262,14 @@ void DestroyableComponent::SetArmor(int32_t value) {
|
||||
// If Destroyable Component already has zero armor do not trigger the passive ability again.
|
||||
bool hadArmor = m_iArmor > 0;
|
||||
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackArmorDelta(value - m_iArmor);
|
||||
}
|
||||
|
||||
m_iArmor = value;
|
||||
|
||||
auto* inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
auto inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
if (m_iArmor == 0 && inventroyComponent != nullptr && hadArmor) {
|
||||
inventroyComponent->TriggerPassiveAbility(PassiveAbilityTrigger::SentinelArmor);
|
||||
}
|
||||
@ -300,14 +300,14 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) {
|
||||
void DestroyableComponent::SetImagination(int32_t value) {
|
||||
m_DirtyHealth = true;
|
||||
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackImaginationDelta(value - m_iImagination);
|
||||
}
|
||||
|
||||
m_iImagination = value;
|
||||
|
||||
auto* inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
auto inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
if (m_iImagination == 0 && inventroyComponent != nullptr) {
|
||||
inventroyComponent->TriggerPassiveAbility(PassiveAbilityTrigger::AssemblyImagination);
|
||||
}
|
||||
@ -407,7 +407,7 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
|
||||
}
|
||||
|
||||
bool DestroyableComponent::IsEnemy(const Entity* other) const {
|
||||
const auto* otherDestroyableComponent = other->GetComponent<DestroyableComponent>();
|
||||
const auto otherDestroyableComponent = other->GetComponent<DestroyableComponent>();
|
||||
if (otherDestroyableComponent != nullptr) {
|
||||
for (const auto enemyFaction : m_EnemyFactionIDs) {
|
||||
for (const auto otherFaction : otherDestroyableComponent->GetFactionIDs()) {
|
||||
@ -421,7 +421,7 @@ bool DestroyableComponent::IsEnemy(const Entity* other) const {
|
||||
}
|
||||
|
||||
bool DestroyableComponent::IsFriend(const Entity* other) const {
|
||||
const auto* otherDestroyableComponent = other->GetComponent<DestroyableComponent>();
|
||||
const auto otherDestroyableComponent = other->GetComponent<DestroyableComponent>();
|
||||
if (otherDestroyableComponent != nullptr) {
|
||||
for (const auto enemyFaction : m_EnemyFactionIDs) {
|
||||
for (const auto otherFaction : otherDestroyableComponent->GetFactionIDs()) {
|
||||
@ -455,8 +455,8 @@ bool DestroyableComponent::IsImmune() const {
|
||||
}
|
||||
|
||||
bool DestroyableComponent::IsKnockbackImmune() const {
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto* inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (characterComponent != nullptr && inventoryComponent != nullptr && characterComponent->GetCurrentActivity() == eGameActivity::QUICKBUILDING) {
|
||||
const auto hasPassive = inventoryComponent->HasAnyPassive({
|
||||
@ -493,13 +493,13 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* targetDestroyable = targetEntity->GetComponent<DestroyableComponent>();
|
||||
auto targetDestroyable = targetEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (targetDestroyable == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* targetQuickbuild = targetEntity->GetComponent<RebuildComponent>();
|
||||
auto targetQuickbuild = targetEntity->GetComponent<RebuildComponent>();
|
||||
|
||||
if (targetQuickbuild != nullptr) {
|
||||
const auto state = targetQuickbuild->GetState();
|
||||
@ -651,7 +651,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
|
||||
}
|
||||
|
||||
if (health != 0) {
|
||||
auto* combatComponent = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatComponent = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatComponent != nullptr) {
|
||||
combatComponent->Taunt(source, sourceDamage * 10); // * 10 is arbatrary
|
||||
@ -710,13 +710,13 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
|
||||
const auto isEnemy = m_OwningEntity->GetComponent<BaseCombatAIComponent>() != nullptr;
|
||||
|
||||
auto* inventoryComponent = owner->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = owner->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent != nullptr && isEnemy) {
|
||||
inventoryComponent->TriggerPassiveAbility(PassiveAbilityTrigger::EnemySmashed, m_OwningEntity);
|
||||
}
|
||||
|
||||
auto* missions = owner->GetComponent<MissionComponent>();
|
||||
auto missions = owner->GetComponent<MissionComponent>();
|
||||
|
||||
if (missions != nullptr) {
|
||||
if (team != nullptr) {
|
||||
@ -725,7 +725,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
|
||||
if (member == nullptr) continue;
|
||||
|
||||
auto* memberMissions = member->GetComponent<MissionComponent>();
|
||||
auto memberMissions = member->GetComponent<MissionComponent>();
|
||||
|
||||
if (memberMissions == nullptr) continue;
|
||||
|
||||
@ -750,7 +750,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
|
||||
if (team != nullptr && m_OwningEntity->GetComponent<BaseCombatAIComponent>() != nullptr) {
|
||||
LWOOBJID specificOwner = LWOOBJID_EMPTY;
|
||||
auto* scriptedActivityComponent = m_OwningEntity->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivityComponent = m_OwningEntity->GetComponent<ScriptedActivityComponent>();
|
||||
uint32_t teamSize = team->members.size();
|
||||
uint32_t lootMatrixId = GetLootMatrixID();
|
||||
|
||||
@ -877,11 +877,11 @@ void DestroyableComponent::FixStats() {
|
||||
if (entity == nullptr) return;
|
||||
|
||||
// Reset skill component and buff component
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
// If any of the components are nullptr, return
|
||||
if (skillComponent == nullptr || buffComponent == nullptr || missionComponent == nullptr || inventoryComponent == nullptr || destroyableComponent == nullptr) {
|
||||
@ -976,7 +976,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
//check if this is a player:
|
||||
if (m_OwningEntity->IsPlayer()) {
|
||||
//remove hardcore_lose_uscore_on_death_percent from the player's uscore:
|
||||
auto* character = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto character = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto uscore = character->GetUScore();
|
||||
|
||||
auto uscoreToLose = uscore * (EntityManager::Instance()->GetHardcoreLoseUscoreOnDeathPercent() / 100);
|
||||
@ -986,7 +986,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
|
||||
if (EntityManager::Instance()->GetHardcoreDropinventoryOnDeath()) {
|
||||
//drop all items from inventory:
|
||||
auto* inventory = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
auto inventory = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
if (inventory) {
|
||||
//get the items inventory:
|
||||
auto items = inventory->GetInventory(eInventoryType::ITEMS);
|
||||
@ -1029,7 +1029,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
//award the player some u-score:
|
||||
auto* player = EntityManager::Instance()->GetEntity(source);
|
||||
if (player && player->IsPlayer()) {
|
||||
auto* playerStats = player->GetComponent<CharacterComponent>();
|
||||
auto playerStats = player->GetComponent<CharacterComponent>();
|
||||
if (playerStats) {
|
||||
//get the maximum health from this enemy:
|
||||
auto maxHealth = GetMaxHealth();
|
||||
|
@ -19,7 +19,7 @@ enum class eStateChangeType : uint32_t;
|
||||
*/
|
||||
class DestroyableComponent : public Component {
|
||||
public:
|
||||
static const eReplicaComponentType ComponentType = eReplicaComponentType::DESTROYABLE;
|
||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::DESTROYABLE;
|
||||
|
||||
DestroyableComponent(Entity* parentEntity);
|
||||
~DestroyableComponent() override;
|
||||
|
@ -189,7 +189,7 @@ void InventoryComponent::AddItem(
|
||||
inventoryType = Inventory::FindInventoryTypeForLot(lot);
|
||||
}
|
||||
|
||||
auto* missions = static_cast<MissionComponent*>(this->m_OwningEntity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missions = m_OwningEntity->GetComponent<MissionComponent>();
|
||||
|
||||
auto* inventory = GetInventory(inventoryType);
|
||||
|
||||
@ -378,7 +378,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
||||
item->SetCount(item->GetCount() - delta, false, false);
|
||||
}
|
||||
|
||||
auto* missionComponent = m_OwningEntity->GetComponent<MissionComponent>();
|
||||
auto missionComponent = m_OwningEntity->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
if (IsTransferInventory(inventory)) {
|
||||
@ -833,7 +833,7 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
|
||||
for (auto* lauchPad : rocketLauchPads) {
|
||||
if (Vector3::DistanceSquared(lauchPad->GetPosition(), position) > 13 * 13) continue;
|
||||
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
|
||||
if (characterComponent != nullptr) characterComponent->SetLastRocketItemID(item->GetId());
|
||||
|
||||
@ -950,10 +950,10 @@ void InventoryComponent::UnequipScripts(Item* unequippedItem) {
|
||||
}
|
||||
|
||||
void InventoryComponent::HandlePossession(Item* item) {
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (!characterComponent) return;
|
||||
|
||||
auto* possessorComponent = m_OwningEntity->GetComponent<PossessorComponent>();
|
||||
auto possessorComponent = m_OwningEntity->GetComponent<PossessorComponent>();
|
||||
if (!possessorComponent) return;
|
||||
|
||||
// Don't do anything if we are busy dismounting
|
||||
@ -986,7 +986,7 @@ void InventoryComponent::HandlePossession(Item* item) {
|
||||
auto* mount = EntityManager::Instance()->CreateEntity(info, nullptr, m_OwningEntity);
|
||||
|
||||
// Check to see if the mount is a vehicle, if so, flip it
|
||||
auto* vehicleComponent = mount->GetComponent<VehiclePhysicsComponent>();
|
||||
auto vehicleComponent = mount->GetComponent<VehiclePhysicsComponent>();
|
||||
if (vehicleComponent) {
|
||||
auto angles = startRotation.GetEulerAngles();
|
||||
// Make it right side up
|
||||
@ -1000,14 +1000,14 @@ void InventoryComponent::HandlePossession(Item* item) {
|
||||
}
|
||||
|
||||
// Setup the destroyable stats
|
||||
auto* destroyableComponent = mount->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = mount->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent) {
|
||||
destroyableComponent->SetIsSmashable(false);
|
||||
destroyableComponent->SetIsImmune(true);
|
||||
}
|
||||
|
||||
// Mount it
|
||||
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
auto possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent) {
|
||||
possessableComponent->SetIsItemSpawned(true);
|
||||
possessableComponent->SetPossessor(m_OwningEntity->GetObjectID());
|
||||
@ -1227,7 +1227,7 @@ bool InventoryComponent::HasAnyPassive(const std::vector<eItemSetPassiveAbilityI
|
||||
}
|
||||
|
||||
void InventoryComponent::DespawnPet() {
|
||||
auto* current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID());
|
||||
auto current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID());
|
||||
|
||||
if (current != nullptr) {
|
||||
current->Deactivate();
|
||||
@ -1235,7 +1235,7 @@ void InventoryComponent::DespawnPet() {
|
||||
}
|
||||
|
||||
void InventoryComponent::SpawnPet(Item* item) {
|
||||
auto* current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID());
|
||||
auto current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID());
|
||||
|
||||
if (current != nullptr) {
|
||||
current->Deactivate();
|
||||
@ -1261,7 +1261,7 @@ void InventoryComponent::SpawnPet(Item* item) {
|
||||
|
||||
auto* pet = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
auto* petComponent = pet->GetComponent<PetComponent>();
|
||||
auto petComponent = pet->GetComponent<PetComponent>();
|
||||
|
||||
if (petComponent != nullptr) {
|
||||
petComponent->Activate(item);
|
||||
@ -1339,7 +1339,7 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
|
||||
return entry.objectTemplate == static_cast<unsigned int>(item->GetLot());
|
||||
});
|
||||
|
||||
auto* missions = static_cast<MissionComponent*>(m_OwningEntity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missions = m_OwningEntity->GetComponent<MissionComponent>();
|
||||
|
||||
for (const auto& result : results) {
|
||||
if (result.castOnType == 1) {
|
||||
|
@ -49,8 +49,8 @@ void LevelProgressionComponent::HandleLevelUp() {
|
||||
const auto& rewards = rewardsTable->GetByLevelID(m_Level);
|
||||
bool rewardingItem = rewards.size() > 0;
|
||||
|
||||
auto* inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (!inventoryComponent || !controllablePhysicsComponent) return;
|
||||
// Tell the client we beginning to send level rewards.
|
||||
@ -84,6 +84,6 @@ void LevelProgressionComponent::HandleLevelUp() {
|
||||
|
||||
void LevelProgressionComponent::SetRetroactiveBaseSpeed(){
|
||||
if (m_Level >= 20) m_SpeedBase = 525.0f;
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent) controllablePhysicsComponent->SetSpeedMultiplier(m_SpeedBase / 500.0f);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ void MissionOfferComponent::OnUse(Entity* originator) {
|
||||
|
||||
void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifiedMissionId) {
|
||||
// First, get the entity's MissionComponent. If there is not one, then we cannot offer missions to this entity.
|
||||
auto* missionComponent = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
if (!missionComponent) {
|
||||
Game::logger->Log("MissionOfferComponent", "Unable to get mission component for Entity %llu", entity->GetObjectID());
|
||||
|
@ -22,7 +22,7 @@ MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) :
|
||||
|
||||
m_BaseCombatAI = nullptr;
|
||||
|
||||
m_BaseCombatAI = reinterpret_cast<BaseCombatAIComponent*>(m_OwningEntity->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
m_BaseCombatAI = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
//Try and fix the insane values:
|
||||
if (m_Info.wanderRadius > 5.0f) m_Info.wanderRadius = m_Info.wanderRadius * 0.5f;
|
||||
@ -322,7 +322,7 @@ foundComponent:
|
||||
}
|
||||
|
||||
void MovementAIComponent::SetPosition(const NiPoint3& value) {
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
controllablePhysicsComponent->SetPosition(value);
|
||||
@ -330,7 +330,7 @@ void MovementAIComponent::SetPosition(const NiPoint3& value) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
auto simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent != nullptr) {
|
||||
simplePhysicsComponent->SetPosition(value);
|
||||
@ -342,7 +342,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
controllablePhysicsComponent->SetRotation(value);
|
||||
@ -350,7 +350,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
auto simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent != nullptr) {
|
||||
simplePhysicsComponent->SetRotation(value);
|
||||
@ -358,7 +358,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) {
|
||||
}
|
||||
|
||||
void MovementAIComponent::SetVelocity(const NiPoint3& value) {
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
controllablePhysicsComponent->SetVelocity(value);
|
||||
@ -366,7 +366,7 @@ void MovementAIComponent::SetVelocity(const NiPoint3& value) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
auto simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent != nullptr) {
|
||||
simplePhysicsComponent->SetVelocity(value);
|
||||
|
@ -57,7 +57,7 @@ struct MovementAIInfo {
|
||||
*/
|
||||
class MovementAIComponent : public Component {
|
||||
public:
|
||||
static const eReplicaComponentType ComponentType = eReplicaComponentType::MOVEMENT_AI;
|
||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MOVEMENT_AI;
|
||||
|
||||
MovementAIComponent(Entity* parentEntity, MovementAIInfo info);
|
||||
~MovementAIComponent() override;
|
||||
@ -310,7 +310,7 @@ private:
|
||||
/**
|
||||
* Optional direct link to the combat AI component of the parent entity
|
||||
*/
|
||||
BaseCombatAIComponent* m_BaseCombatAI = nullptr;
|
||||
std::shared_ptr<BaseCombatAIComponent> m_BaseCombatAI = nullptr;
|
||||
|
||||
/**
|
||||
* The path the entity is currently following
|
||||
|
@ -163,7 +163,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
m_Tamer = LWOOBJID_EMPTY;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = originator->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
@ -173,7 +173,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* movementAIComponent = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
auto movementAIComponent = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (movementAIComponent != nullptr) {
|
||||
movementAIComponent->Stop();
|
||||
@ -224,7 +224,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
imaginationCost = cached->second.imaginationCost;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = originator->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = originator->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr) {
|
||||
return;
|
||||
@ -362,10 +362,9 @@ void PetComponent::Update(float deltaTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (m_MovementAI == nullptr) {
|
||||
return;
|
||||
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
if (!m_MovementAI) return;
|
||||
}
|
||||
|
||||
if (m_TresureTime > 0) {
|
||||
@ -488,7 +487,7 @@ void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) {
|
||||
|
||||
if (cached == buildCache.end()) return;
|
||||
|
||||
auto* destroyableComponent = tamer->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = tamer->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr) return;
|
||||
|
||||
@ -549,7 +548,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
|
||||
GameMessages::SendPetResponse(m_Tamer, m_OwningEntity->GetObjectID(), 0, 10, 0, tamer->GetSystemAddress());
|
||||
|
||||
auto* inventoryComponent = tamer->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = tamer->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
@ -607,7 +606,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
tamer->GetCharacter()->SetPlayerFlag(petFlags.at(m_OwningEntity->GetLOT()), true);
|
||||
}
|
||||
|
||||
auto* missionComponent = tamer->GetComponent<MissionComponent>();
|
||||
auto missionComponent = tamer->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->Progress(eMissionTaskType::PET_TAMING, m_OwningEntity->GetLOT());
|
||||
@ -615,7 +614,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
|
||||
SetStatus(1);
|
||||
|
||||
auto* characterComponent = tamer->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = tamer->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->UpdatePlayerStatistic(PetsTamed);
|
||||
}
|
||||
@ -649,7 +648,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
|
||||
|
||||
Game::logger->Log("PetComponent", "Got set pet name (%s)", GeneralUtils::UTF16ToWTF8(name).c_str());
|
||||
|
||||
auto* inventoryComponent = tamer->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = tamer->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
@ -841,7 +840,7 @@ void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming) {
|
||||
m_ItemId = item->GetId();
|
||||
m_DatabaseId = item->GetSubKey();
|
||||
|
||||
auto* inventoryComponent = item->GetInventory()->GetComponent();
|
||||
auto inventoryComponent = item->GetInventory()->GetComponent();
|
||||
|
||||
if (inventoryComponent == nullptr) return;
|
||||
|
||||
@ -963,7 +962,7 @@ void PetComponent::Deactivate() {
|
||||
}
|
||||
|
||||
void PetComponent::Release() {
|
||||
auto* inventoryComponent = GetOwner()->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = GetOwner()->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
@ -1039,7 +1038,7 @@ void PetComponent::SetAbility(PetAbilityType value) {
|
||||
m_Ability = value;
|
||||
}
|
||||
|
||||
PetComponent* PetComponent::GetTamingPet(LWOOBJID tamer) {
|
||||
std::shared_ptr<PetComponent> PetComponent::GetTamingPet(LWOOBJID tamer) {
|
||||
const auto& pair = currentActivities.find(tamer);
|
||||
|
||||
if (pair == currentActivities.end()) {
|
||||
@ -1057,7 +1056,7 @@ PetComponent* PetComponent::GetTamingPet(LWOOBJID tamer) {
|
||||
return entity->GetComponent<PetComponent>();
|
||||
}
|
||||
|
||||
PetComponent* PetComponent::GetActivePet(LWOOBJID owner) {
|
||||
std::shared_ptr<PetComponent> PetComponent::GetActivePet(LWOOBJID owner) {
|
||||
const auto& pair = activePets.find(owner);
|
||||
|
||||
if (pair == activePets.end()) {
|
||||
|
@ -195,14 +195,14 @@ public:
|
||||
* @param tamer the entity that's currently taming
|
||||
* @return the pet component of the entity that's being tamed
|
||||
*/
|
||||
static PetComponent* GetTamingPet(LWOOBJID tamer);
|
||||
static std::shared_ptr<PetComponent> GetTamingPet(LWOOBJID tamer);
|
||||
|
||||
/**
|
||||
* Returns the pet that's currently spawned for some entity (if any)
|
||||
* @param owner the owner of the pet that's spawned
|
||||
* @return the pet component of the entity that was spawned by the owner
|
||||
*/
|
||||
static PetComponent* GetActivePet(LWOOBJID owner);
|
||||
static std::shared_ptr<PetComponent> GetActivePet(LWOOBJID owner);
|
||||
|
||||
/**
|
||||
* Adds the timer to the owner of this pet to drain imagination at the rate
|
||||
@ -349,7 +349,7 @@ private:
|
||||
/**
|
||||
* The movement AI component that is related to this pet, required to move it around
|
||||
*/
|
||||
MovementAIComponent* m_MovementAI;
|
||||
std::shared_ptr<MovementAIComponent> m_MovementAI;
|
||||
|
||||
/**
|
||||
* Preconditions that need to be met before an entity can tame this pet
|
||||
|
@ -48,7 +48,7 @@ void PossessableComponent::Dismount() {
|
||||
}
|
||||
|
||||
void PossessableComponent::OnUse(Entity* originator) {
|
||||
auto* possessor = originator->GetComponent<PossessorComponent>();
|
||||
auto possessor = originator->GetComponent<PossessorComponent>();
|
||||
if (possessor) {
|
||||
possessor->Mount(m_OwningEntity);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ PossessorComponent::~PossessorComponent() {
|
||||
if (m_Possessable != LWOOBJID_EMPTY) {
|
||||
auto* mount = EntityManager::Instance()->GetEntity(m_Possessable);
|
||||
if (mount) {
|
||||
auto* possessable = mount->GetComponent<PossessableComponent>();
|
||||
auto possessable = mount->GetComponent<PossessableComponent>();
|
||||
if (possessable) {
|
||||
if (possessable->GetIsItemSpawned()) {
|
||||
GameMessages::SendMarkInventoryItemAsActive(m_OwningEntity->GetObjectID(), false, eUnequippableActiveType::MOUNT, GetMountItemID(), m_OwningEntity->GetSystemAddress());
|
||||
@ -43,7 +43,7 @@ void PossessorComponent::Mount(Entity* mount) {
|
||||
if (GetIsDismounting() || !mount) return;
|
||||
|
||||
GameMessages::SendSetMountInventoryID(m_OwningEntity, mount->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
auto possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent) {
|
||||
possessableComponent->SetPossessor(m_OwningEntity->GetObjectID());
|
||||
SetPossessable(mount->GetObjectID());
|
||||
@ -68,7 +68,7 @@ void PossessorComponent::Dismount(Entity* mount, bool forceDismount) {
|
||||
SetIsDismounting(true);
|
||||
|
||||
if (mount) {
|
||||
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
auto possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent) {
|
||||
possessableComponent->SetPossessor(LWOOBJID_EMPTY);
|
||||
if (forceDismount) possessableComponent->ForceDepossess();
|
||||
|
@ -26,10 +26,10 @@ PropertyEntranceComponent::PropertyEntranceComponent(uint32_t componentID, Entit
|
||||
}
|
||||
|
||||
void PropertyEntranceComponent::OnUse(Entity* entity) {
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (!characterComponent) return;
|
||||
|
||||
auto* rocket = entity->GetComponent<CharacterComponent>()->RocketEquip(entity);
|
||||
auto rocket = entity->GetComponent<CharacterComponent>()->RocketEquip(entity);
|
||||
if (!rocket) return;
|
||||
|
||||
GameMessages::SendPropertyEntranceBegin(m_OwningEntity->GetObjectID(), entity->GetSystemAddress());
|
||||
@ -63,7 +63,7 @@ void PropertyEntranceComponent::OnEnterProperty(Entity* entity, uint32_t index,
|
||||
cloneId = query[index].CloneId;
|
||||
}
|
||||
|
||||
auto* launcher = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
|
||||
auto launcher = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
|
||||
|
||||
if (launcher == nullptr) {
|
||||
return;
|
||||
|
@ -263,7 +263,7 @@ void PropertyManagementComponent::OnStartBuilding() {
|
||||
SetPrivacyOption(PropertyPrivacyOption::Private); // Cant visit player which is building
|
||||
|
||||
if (!entrance.empty()) {
|
||||
auto* rocketPad = entrance[0]->GetComponent<RocketLaunchpadControlComponent>();
|
||||
auto rocketPad = entrance[0]->GetComponent<RocketLaunchpadControlComponent>();
|
||||
|
||||
if (rocketPad != nullptr) {
|
||||
zoneId = rocketPad->GetDefaultZone();
|
||||
@ -302,7 +302,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
@ -417,7 +417,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
|
@ -87,7 +87,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
@ -141,8 +141,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
||||
// Make the vehicle a child of the racing controller.
|
||||
m_OwningEntity->AddChild(carEntity);
|
||||
|
||||
auto* destroyableComponent =
|
||||
carEntity->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = carEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
// Setup the vehicle stats.
|
||||
if (destroyableComponent != nullptr) {
|
||||
@ -151,16 +150,14 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
||||
}
|
||||
|
||||
// Setup the vehicle as being possessed by the player.
|
||||
auto* possessableComponent =
|
||||
carEntity->GetComponent<PossessableComponent>();
|
||||
auto possessableComponent = carEntity->GetComponent<PossessableComponent>();
|
||||
|
||||
if (possessableComponent != nullptr) {
|
||||
possessableComponent->SetPossessor(player->GetObjectID());
|
||||
}
|
||||
|
||||
// Load the vehicle's assemblyPartLOTs for display.
|
||||
auto* moduleAssemblyComponent =
|
||||
carEntity->GetComponent<ModuleAssemblyComponent>();
|
||||
auto moduleAssemblyComponent = carEntity->GetComponent<ModuleAssemblyComponent>();
|
||||
|
||||
if (moduleAssemblyComponent) {
|
||||
moduleAssemblyComponent->SetSubKey(item->GetSubKey());
|
||||
@ -175,7 +172,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
||||
}
|
||||
|
||||
// Setup the player as possessing the vehicle.
|
||||
auto* possessorComponent = player->GetComponent<PossessorComponent>();
|
||||
auto possessorComponent = player->GetComponent<PossessorComponent>();
|
||||
|
||||
if (possessorComponent != nullptr) {
|
||||
possessorComponent->SetPossessable(carEntity->GetObjectID());
|
||||
@ -183,7 +180,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
||||
}
|
||||
|
||||
// Set the player's current activity as racing.
|
||||
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = player->GetComponent<CharacterComponent>();
|
||||
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->SetIsRacing(true);
|
||||
@ -293,7 +290,7 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
|
||||
GameMessages::SendDie(vehicle, vehicle->GetObjectID(), LWOOBJID_EMPTY, true,
|
||||
eKillType::VIOLENT, u"", 0, 0, 90.0f, false, true, 0);
|
||||
|
||||
auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
|
||||
uint32_t respawnImagination = 0;
|
||||
// Reset imagination to half its current value, rounded up to the nearest value divisible by 10, as it was done in live.
|
||||
// Do not actually change the value yet. Do that on respawn.
|
||||
@ -318,13 +315,13 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
GameMessages::SendResurrect(vehicle);
|
||||
auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
|
||||
// Reset imagination to half its current value, rounded up to the nearest value divisible by 10, as it was done in live.
|
||||
if (destroyableComponent) destroyableComponent->SetImagination(respawnImagination);
|
||||
EntityManager::Instance()->SerializeEntity(vehicle);
|
||||
});
|
||||
|
||||
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = player->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->UpdatePlayerStatistic(RacingTimesWrecked);
|
||||
}
|
||||
@ -386,7 +383,7 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu
|
||||
m_OwningEntity->GetObjectID(), 2, 0, LWOOBJID_EMPTY, u"",
|
||||
player->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) return;
|
||||
|
||||
@ -639,8 +636,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
vehicle->SetPosition(player.respawnPosition);
|
||||
vehicle->SetRotation(player.respawnRotation);
|
||||
|
||||
auto* destroyableComponent =
|
||||
vehicle->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetImagination(0);
|
||||
@ -817,8 +813,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
"Best lap time (%llu)", lapTime);
|
||||
}
|
||||
|
||||
auto* missionComponent =
|
||||
playerEntity->GetComponent<MissionComponent>();
|
||||
auto missionComponent = playerEntity->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
|
||||
@ -841,7 +836,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
// Entire race time
|
||||
missionComponent->Progress(eMissionTaskType::RACING, (raceTime) * 1000, (LWOOBJID)eRacingTaskParam::TOTAL_TRACK_TIME);
|
||||
|
||||
auto* characterComponent = playerEntity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = playerEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackRaceCompleted(m_Finished == 1);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t component
|
||||
RailActivatorComponent::~RailActivatorComponent() = default;
|
||||
|
||||
void RailActivatorComponent::OnUse(Entity* originator) {
|
||||
auto* rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
if (rebuildComponent != nullptr && rebuildComponent->GetState() != eRebuildState::COMPLETED)
|
||||
return;
|
||||
|
||||
@ -116,7 +116,7 @@ void RailActivatorComponent::OnCancelRailMovement(Entity* originator) {
|
||||
true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
auto* rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent != nullptr) {
|
||||
// Set back reset time
|
||||
|
@ -194,7 +194,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
if (m_TimeBeforeDrain <= 0.0f) {
|
||||
m_TimeBeforeDrain = m_CompleteTime / static_cast<float>(m_TakeImagination);
|
||||
|
||||
DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>();
|
||||
auto destComp = builder->GetComponent<DestroyableComponent>();
|
||||
if (!destComp) break;
|
||||
|
||||
int newImagination = destComp->GetImagination();
|
||||
@ -400,7 +400,7 @@ void RebuildComponent::StartRebuild(Entity* user) {
|
||||
if (m_State == eRebuildState::OPEN || m_State == eRebuildState::COMPLETED || m_State == eRebuildState::INCOMPLETE) {
|
||||
m_Builder = user->GetObjectID();
|
||||
|
||||
auto* character = user->GetComponent<CharacterComponent>();
|
||||
auto character = user->GetComponent<CharacterComponent>();
|
||||
character->SetCurrentActivity(eGameActivity::QUICKBUILDING);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(user);
|
||||
@ -412,7 +412,7 @@ void RebuildComponent::StartRebuild(Entity* user) {
|
||||
m_StateDirty = true;
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
auto* movingPlatform = m_OwningEntity->GetComponent<MovingPlatformComponent>();
|
||||
auto movingPlatform = m_OwningEntity->GetComponent<MovingPlatformComponent>();
|
||||
if (movingPlatform != nullptr) {
|
||||
movingPlatform->OnRebuildInitilized();
|
||||
}
|
||||
@ -434,7 +434,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* characterComponent = user->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = user->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->SetCurrentActivity(eGameActivity::NONE);
|
||||
characterComponent->TrackRebuildComplete();
|
||||
@ -478,12 +478,12 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
for (const auto memberId : team->members) { // progress missions for all team members
|
||||
auto* member = EntityManager::Instance()->GetEntity(memberId);
|
||||
if (member) {
|
||||
auto* missionComponent = member->GetComponent<MissionComponent>();
|
||||
auto missionComponent = member->GetComponent<MissionComponent>();
|
||||
if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId);
|
||||
}
|
||||
}
|
||||
} else{
|
||||
auto* missionComponent = builder->GetComponent<MissionComponent>();
|
||||
auto missionComponent = builder->GetComponent<MissionComponent>();
|
||||
if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId);
|
||||
}
|
||||
LootGenerator::Instance().DropActivityLoot(builder, m_OwningEntity, m_ActivityId, 1);
|
||||
@ -503,7 +503,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
|
||||
m_OwningEntity->TriggerEvent(eTriggerEventType::REBUILD_COMPLETE, user);
|
||||
|
||||
auto* movingPlatform = m_OwningEntity->GetComponent<MovingPlatformComponent>();
|
||||
auto movingPlatform = m_OwningEntity->GetComponent<MovingPlatformComponent>();
|
||||
if (movingPlatform != nullptr) {
|
||||
movingPlatform->OnCompleteRebuild();
|
||||
}
|
||||
@ -588,7 +588,7 @@ void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failR
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterComponent* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) {
|
||||
characterComponent->SetCurrentActivity(eGameActivity::NONE);
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
|
@ -214,7 +214,7 @@ float RenderComponent::GetAnimationTime(Entity* self, const std::string& animati
|
||||
float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) {
|
||||
float returnlength = 0.0f;
|
||||
if (!self) return returnlength;
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
auto renderComponent = self->GetComponent<RenderComponent>();
|
||||
if (!renderComponent) return returnlength;
|
||||
|
||||
auto* animationsTable = CDClientManager::Instance().GetTable<CDAnimationsTable>();
|
||||
|
@ -17,7 +17,7 @@ RocketLaunchLupComponent::RocketLaunchLupComponent(Entity* parent) : Component(p
|
||||
RocketLaunchLupComponent::~RocketLaunchLupComponent() {}
|
||||
|
||||
void RocketLaunchLupComponent::OnUse(Entity* originator) {
|
||||
auto* rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
|
||||
auto rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
|
||||
if (!rocket) return;
|
||||
|
||||
// the LUP world menu is just the property menu, the client knows how to handle it
|
||||
@ -25,7 +25,7 @@ void RocketLaunchLupComponent::OnUse(Entity* originator) {
|
||||
}
|
||||
|
||||
void RocketLaunchLupComponent::OnSelectWorld(Entity* originator, uint32_t index) {
|
||||
auto* rocketLaunchpadControlComponent = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
|
||||
auto rocketLaunchpadControlComponent = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
|
||||
if (!rocketLaunchpadControlComponent) return;
|
||||
|
||||
rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0);
|
||||
|
@ -50,7 +50,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOMAPID mapId,
|
||||
}
|
||||
|
||||
// This also gets triggered by a proximity monitor + item equip, I will set that up when havok is ready
|
||||
auto* characterComponent = originator->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = originator->GetComponent<CharacterComponent>();
|
||||
auto* character = originator->GetCharacter();
|
||||
|
||||
if (!characterComponent || !character) return;
|
||||
@ -89,18 +89,18 @@ void RocketLaunchpadControlComponent::OnUse(Entity* originator) {
|
||||
// instead we let their OnUse handlers do their things
|
||||
// which components of an Object have their OnUse called when using them
|
||||
// so we don't need to call it here
|
||||
auto* propertyEntrance = m_OwningEntity->GetComponent<PropertyEntranceComponent>();
|
||||
auto propertyEntrance = m_OwningEntity->GetComponent<PropertyEntranceComponent>();
|
||||
if (propertyEntrance) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* rocketLaunchLUP = m_OwningEntity->GetComponent<RocketLaunchLupComponent>();
|
||||
auto rocketLaunchLUP = m_OwningEntity->GetComponent<RocketLaunchLupComponent>();
|
||||
if (rocketLaunchLUP) {
|
||||
return;
|
||||
}
|
||||
|
||||
// No rocket no launch
|
||||
auto* rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
|
||||
auto rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
|
||||
if (!rocket) {
|
||||
return;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit
|
||||
}
|
||||
}
|
||||
|
||||
auto* destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent) {
|
||||
// check for LMIs and set the loot LMIs
|
||||
@ -305,7 +305,7 @@ bool ScriptedActivityComponent::IsValidActivity(Entity* player) {
|
||||
// Makes it so that scripted activities with an unimplemented map cannot be joined
|
||||
/*if (player->GetGMLevel() < eGameMasterLevel::DEVELOPER && (m_ActivityInfo.instanceMapID == 1302 || m_ActivityInfo.instanceMapID == 1301)) {
|
||||
if (m_OwningEntity->GetLOT() == 4860) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
missionComponent->CompleteMission(229);
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ bool ScriptedActivityComponent::TakeCost(Entity* player) const {
|
||||
if (m_ActivityInfo.optionalCostLOT <= 0 || m_ActivityInfo.optionalCostCount <= 0)
|
||||
return true;
|
||||
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
if (inventoryComponent == nullptr)
|
||||
return false;
|
||||
|
||||
@ -555,7 +555,7 @@ void ActivityInstance::StartZone() {
|
||||
}
|
||||
|
||||
void ActivityInstance::RewardParticipant(Entity* participant) {
|
||||
auto* missionComponent = participant->GetComponent<MissionComponent>();
|
||||
auto missionComponent = participant->GetComponent<MissionComponent>();
|
||||
if (missionComponent) {
|
||||
missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityInfo.ActivityID);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ void SkillComponent::Reset() {
|
||||
|
||||
void SkillComponent::Interrupt() {
|
||||
// TODO: need to check immunities on the destroyable component, but they aren't implemented
|
||||
auto* combat = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
|
||||
auto combat = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
|
||||
if (combat != nullptr && combat->GetStunImmune()) return;
|
||||
|
||||
for (const auto& behavior : this->m_managedBehaviors) {
|
||||
|
@ -75,7 +75,7 @@ private:
|
||||
/**
|
||||
* Attached rebuild component.
|
||||
*/
|
||||
RebuildComponent* m_Rebuild;
|
||||
std::shared_ptr<RebuildComponent> m_Rebuild;
|
||||
|
||||
/**
|
||||
* If the switch is on or off.
|
||||
|
@ -196,7 +196,7 @@ void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string arg
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){
|
||||
auto* triggerComponent = targetEntity->GetComponent<TriggerComponent>();
|
||||
auto triggerComponent = targetEntity->GetComponent<TriggerComponent>();
|
||||
if (!triggerComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleToggleTrigger", "Trigger component not found!");
|
||||
return;
|
||||
@ -205,7 +205,7 @@ void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string arg
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleResetRebuild(Entity* targetEntity, std::string args){
|
||||
auto* rebuildComponent = targetEntity->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = targetEntity->GetComponent<RebuildComponent>();
|
||||
if (!rebuildComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleResetRebuild", "Rebuild component not found!");
|
||||
return;
|
||||
@ -237,7 +237,7 @@ 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_OwningEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
auto phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandlePushObject", "Phantom Physics component not found!");
|
||||
return;
|
||||
@ -254,7 +254,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
|
||||
|
||||
|
||||
void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args){
|
||||
auto* phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
auto phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!");
|
||||
return;
|
||||
@ -334,7 +334,7 @@ void TriggerComponent::HandleUpdateMission(Entity* targetEntity, std::vector<std
|
||||
// If others need to be implemented for modding
|
||||
// then we need a good way to convert this from a string to that enum
|
||||
if (argArray.at(0) != "exploretask") return;
|
||||
MissionComponent* missionComponent = targetEntity->GetComponent<MissionComponent>();
|
||||
auto missionComponent = targetEntity->GetComponent<MissionComponent>();
|
||||
if (!missionComponent){
|
||||
Game::logger->LogDebug("TriggerComponent::HandleUpdateMission", "Mission component not found!");
|
||||
return;
|
||||
@ -353,7 +353,7 @@ void TriggerComponent::HandlePlayEffect(Entity* targetEntity, std::vector<std::s
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
||||
auto* skillComponent = targetEntity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = targetEntity->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleCastSkill", "Skill component not found!");
|
||||
return;
|
||||
@ -364,7 +364,7 @@ void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::vector<std::string> argArray) {
|
||||
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
auto phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
||||
return;
|
||||
@ -399,7 +399,7 @@ void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::v
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::string args) {
|
||||
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
auto phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
||||
return;
|
||||
|
@ -110,7 +110,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
player->ConstructLimboEntities();
|
||||
}
|
||||
|
||||
InventoryComponent* inv = entity->GetComponent<InventoryComponent>();
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (inv) {
|
||||
auto items = inv->GetEquippedItems();
|
||||
for (auto pair : items) {
|
||||
@ -120,13 +120,13 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
}
|
||||
}
|
||||
|
||||
auto* destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
destroyable->SetImagination(destroyable->GetImagination());
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
|
||||
std::vector<Entity*> racingControllers = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
|
||||
for (Entity* racingController : racingControllers) {
|
||||
auto* racingComponent = racingController->GetComponent<RacingControlComponent>();
|
||||
auto racingComponent = racingController->GetComponent<RacingControlComponent>();
|
||||
if (racingComponent != nullptr) {
|
||||
racingComponent->OnPlayerLoaded(entity);
|
||||
}
|
||||
@ -243,13 +243,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
|
||||
case eGameMessageType::REQUEST_RESURRECT: {
|
||||
GameMessages::SendResurrect(entity);
|
||||
/*auto* dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
if (dest) {
|
||||
dest->SetHealth(4);
|
||||
dest->SetArmor(0);
|
||||
dest->SetImagination(6);
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
case eGameMessageType::HANDLE_HOT_PROPERTY_DATA: {
|
||||
@ -263,7 +256,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
|
||||
message.Deserialize(inStream);
|
||||
|
||||
auto* skill_component = entity->GetComponent<SkillComponent>();
|
||||
auto skill_component = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skill_component != nullptr) {
|
||||
auto* bs = new RakNet::BitStream((unsigned char*)message.sBitStream.c_str(), message.sBitStream.size(), false);
|
||||
@ -282,7 +275,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
|
||||
if (startSkill.skillID == 1561 || startSkill.skillID == 1562 || startSkill.skillID == 1541) return;
|
||||
|
||||
MissionComponent* comp = entity->GetComponent<MissionComponent>();
|
||||
auto comp = entity->GetComponent<MissionComponent>();
|
||||
if (comp) {
|
||||
comp->Progress(eMissionTaskType::USE_SKILL, startSkill.skillID);
|
||||
}
|
||||
@ -295,12 +288,12 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
if (behaviorId > 0) {
|
||||
RakNet::BitStream* bs = new RakNet::BitStream((unsigned char*)startSkill.sBitStream.c_str(), startSkill.sBitStream.size(), false);
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
success = skillComponent->CastPlayerSkill(behaviorId, startSkill.uiSkillHandle, bs, startSkill.optionalTargetID, startSkill.skillID);
|
||||
|
||||
if (success && entity->GetCharacter()) {
|
||||
DestroyableComponent* destComp = entity->GetComponent<DestroyableComponent>();
|
||||
auto destComp = entity->GetComponent<DestroyableComponent>();
|
||||
destComp->SetImagination(destComp->GetImagination() - skillTable->GetSkillByID(startSkill.skillID).imaginationcost);
|
||||
}
|
||||
|
||||
@ -357,7 +350,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
if (usr != nullptr) {
|
||||
RakNet::BitStream* bs = new RakNet::BitStream((unsigned char*)sync.sBitStream.c_str(), sync.sBitStream.size(), false);
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
skillComponent->SyncPlayerSkill(sync.uiSkillHandle, sync.uiBehaviorHandle, bs);
|
||||
|
||||
|
@ -935,10 +935,10 @@ void GameMessages::SendResurrect(Entity* entity) {
|
||||
// and just make sure the client has time to be ready.
|
||||
constexpr float respawnTime = 3.66700005531311f + 0.5f;
|
||||
entity->AddCallbackTimer(respawnTime, [=]() {
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr && entity->GetLOT() == 1) {
|
||||
auto* levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
auto levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
if (levelComponent) {
|
||||
int32_t healthToRestore = levelComponent->GetLevel() >= 45 ? 8 : 4;
|
||||
if (healthToRestore > destroyableComponent->GetMaxHealth()) healthToRestore = destroyableComponent->GetMaxHealth();
|
||||
@ -952,7 +952,7 @@ void GameMessages::SendResurrect(Entity* entity) {
|
||||
});
|
||||
|
||||
|
||||
auto cont = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
||||
auto cont = entity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (cont && entity->GetLOT() == 1) {
|
||||
cont->SetPosition(entity->GetRespawnPosition());
|
||||
cont->SetRotation(entity->GetRespawnRotation());
|
||||
@ -1149,7 +1149,7 @@ void GameMessages::SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPo
|
||||
bitStream.Write(position.y);
|
||||
bitStream.Write(position.z);
|
||||
|
||||
auto con = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
||||
auto con = entity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (con) {
|
||||
auto rot = con->GetRotation();
|
||||
bitStream.Write(rot.x);
|
||||
@ -1284,7 +1284,7 @@ void GameMessages::SendVendorStatusUpdate(Entity* entity, const SystemAddress& s
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
VendorComponent* vendor = static_cast<VendorComponent*>(entity->GetComponent(eReplicaComponentType::VENDOR));
|
||||
auto vendor = entity->GetComponent<VendorComponent>();
|
||||
if (!vendor) return;
|
||||
|
||||
std::map<LOT, int> vendorItems = vendor->GetInventory();
|
||||
@ -1406,7 +1406,7 @@ void GameMessages::SendMoveInventoryBatch(Entity* entity, uint32_t stackCount, i
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
Item* itemStack = inv->FindItemById(iObjID);
|
||||
@ -2182,7 +2182,7 @@ void GameMessages::HandleUnUseModel(RakNet::BitStream* inStream, Entity* entity,
|
||||
LWOOBJID objIdToAddToInventory{};
|
||||
inStream->Read(unknown);
|
||||
inStream->Read(objIdToAddToInventory);
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
if (inventoryComponent) {
|
||||
auto* inventory = inventoryComponent->GetInventory(eInventoryType::MODELS_IN_BBB);
|
||||
auto* item = inventory->FindItemById(objIdToAddToInventory);
|
||||
@ -2244,7 +2244,7 @@ void GameMessages::HandleQueryPropertyData(RakNet::BitStream* inStream, Entity*
|
||||
entity = entites[0];
|
||||
*/
|
||||
|
||||
auto* propertyVendorComponent = static_cast<PropertyVendorComponent*>(entity->GetComponent(eReplicaComponentType::PROPERTY_VENDOR));
|
||||
auto propertyVendorComponent = entity->GetComponent<PropertyVendorComponent>();
|
||||
|
||||
if (propertyVendorComponent != nullptr) {
|
||||
propertyVendorComponent->OnQueryPropertyData(entity, sysAddr);
|
||||
@ -2256,7 +2256,7 @@ void GameMessages::HandleQueryPropertyData(RakNet::BitStream* inStream, Entity*
|
||||
entity = entites[0];
|
||||
*/
|
||||
|
||||
auto* propertyManagerComponent = static_cast<PropertyManagementComponent*>(entity->GetComponent(eReplicaComponentType::PROPERTY_MANAGEMENT));
|
||||
auto propertyManagerComponent = entity->GetComponent<PropertyManagementComponent>();
|
||||
|
||||
if (propertyManagerComponent != nullptr) {
|
||||
propertyManagerComponent->OnQueryPropertyData(entity, sysAddr);
|
||||
@ -2422,7 +2422,7 @@ void GameMessages::HandleBBBLoadItemRequest(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
Game::logger->Log("BBB", "Load item request for: %lld", previousItemID);
|
||||
LWOOBJID newId = previousItemID;
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
if (inventoryComponent) {
|
||||
auto* inventory = inventoryComponent->GetInventory(eInventoryType::MODELS);
|
||||
auto* itemToMove = inventory->FindItemById(previousItemID);
|
||||
@ -2776,7 +2776,7 @@ void GameMessages::HandlePropertyEntranceSync(RakNet::BitStream* inStream, Entit
|
||||
|
||||
auto* player = Player::GetPlayer(sysAddr);
|
||||
|
||||
auto* entranceComponent = entity->GetComponent<PropertyEntranceComponent>();
|
||||
auto entranceComponent = entity->GetComponent<PropertyEntranceComponent>();
|
||||
|
||||
if (entranceComponent == nullptr) return;
|
||||
|
||||
@ -2803,7 +2803,7 @@ void GameMessages::HandleEnterProperty(RakNet::BitStream* inStream, Entity* enti
|
||||
|
||||
auto* player = Player::GetPlayer(sysAddr);
|
||||
|
||||
auto* entranceComponent = entity->GetComponent<PropertyEntranceComponent>();
|
||||
auto entranceComponent = entity->GetComponent<PropertyEntranceComponent>();
|
||||
if (entranceComponent != nullptr) {
|
||||
entranceComponent->OnEnterProperty(player, index, returnToZone, sysAddr);
|
||||
return;
|
||||
@ -2820,7 +2820,7 @@ void GameMessages::HandleSetConsumableItem(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
inStream->Read(lot);
|
||||
|
||||
auto* inventory = entity->GetComponent<InventoryComponent>();
|
||||
auto inventory = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventory == nullptr) return;
|
||||
|
||||
@ -3719,7 +3719,7 @@ void GameMessages::SendPetNameChanged(LWOOBJID objectId, int32_t moderationStatu
|
||||
void GameMessages::HandleClientExitTamingMinigame(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
bool bVoluntaryExit = inStream->ReadBit();
|
||||
|
||||
auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
|
||||
if (petComponent == nullptr) {
|
||||
return;
|
||||
@ -3729,7 +3729,7 @@ void GameMessages::HandleClientExitTamingMinigame(RakNet::BitStream* inStream, E
|
||||
}
|
||||
|
||||
void GameMessages::HandleStartServerPetMinigameTimer(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
|
||||
if (petComponent == nullptr) {
|
||||
return;
|
||||
@ -3757,7 +3757,7 @@ void GameMessages::HandlePetTamingTryBuild(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
clientFailed = inStream->ReadBit();
|
||||
|
||||
auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
|
||||
if (petComponent == nullptr) {
|
||||
return;
|
||||
@ -3771,7 +3771,7 @@ void GameMessages::HandleNotifyTamingBuildSuccess(RakNet::BitStream* inStream, E
|
||||
|
||||
inStream->Read(position);
|
||||
|
||||
auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
|
||||
if (petComponent == nullptr) {
|
||||
return;
|
||||
@ -3792,7 +3792,7 @@ void GameMessages::HandleRequestSetPetName(RakNet::BitStream* inStream, Entity*
|
||||
name.push_back(character);
|
||||
}
|
||||
|
||||
auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID());
|
||||
|
||||
if (petComponent == nullptr) {
|
||||
petComponent = PetComponent::GetActivePet(entity->GetObjectID());
|
||||
@ -3818,7 +3818,7 @@ void GameMessages::HandleCommandPet(RakNet::BitStream* inStream, Entity* entity,
|
||||
inStream->Read(iTypeID);
|
||||
overrideObey = inStream->ReadBit();
|
||||
|
||||
auto* petComponent = entity->GetComponent<PetComponent>();
|
||||
auto petComponent = entity->GetComponent<PetComponent>();
|
||||
|
||||
if (petComponent == nullptr) {
|
||||
return;
|
||||
@ -3832,7 +3832,7 @@ void GameMessages::HandleDespawnPet(RakNet::BitStream* inStream, Entity* entity,
|
||||
|
||||
bDeletePet = inStream->ReadBit();
|
||||
|
||||
auto* petComponent = PetComponent::GetActivePet(entity->GetObjectID());
|
||||
auto petComponent = PetComponent::GetActivePet(entity->GetObjectID());
|
||||
|
||||
if (petComponent == nullptr) {
|
||||
return;
|
||||
@ -3884,13 +3884,13 @@ void GameMessages::HandleMessageBoxResponse(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
entity->OnMessageBoxResponse(userEntity, iButton, identifier, userData);
|
||||
|
||||
auto* scriptedActivityComponent = entity->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivityComponent = entity->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent != nullptr) {
|
||||
scriptedActivityComponent->HandleMessageBoxResponse(userEntity, GeneralUtils::UTF16ToWTF8(identifier));
|
||||
}
|
||||
|
||||
auto* racingControlComponent = entity->GetComponent<RacingControlComponent>();
|
||||
auto racingControlComponent = entity->GetComponent<RacingControlComponent>();
|
||||
|
||||
if (racingControlComponent != nullptr) {
|
||||
racingControlComponent->HandleMessageBoxResponse(userEntity, iButton, GeneralUtils::UTF16ToWTF8(identifier));
|
||||
@ -4056,7 +4056,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
|
||||
|
||||
// If we aren't possessing somethings, the don't do anything
|
||||
if (objectId != LWOOBJID_EMPTY) {
|
||||
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
auto possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
auto* mount = EntityManager::Instance()->GetEntity(objectId);
|
||||
// make sure we have the things we need and they aren't null
|
||||
if (possessorComponent && mount) {
|
||||
@ -4066,7 +4066,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
|
||||
possessorComponent->SetPossessableType(ePossessionType::NO_POSSESSION);
|
||||
|
||||
// character related things
|
||||
auto* character = entity->GetComponent<CharacterComponent>();
|
||||
auto character = entity->GetComponent<CharacterComponent>();
|
||||
if (character) {
|
||||
// If we had an active item turn it off
|
||||
if (possessorComponent->GetMountItemID() != LWOOBJID_EMPTY) GameMessages::SendMarkInventoryItemAsActive(entity->GetObjectID(), false, eUnequippableActiveType::MOUNT, possessorComponent->GetMountItemID(), entity->GetSystemAddress());
|
||||
@ -4074,11 +4074,11 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
|
||||
}
|
||||
|
||||
// Set that the controllabel phsyics comp is teleporting
|
||||
auto* controllablePhysicsComponent = entity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = entity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent) controllablePhysicsComponent->SetIsTeleporting(true);
|
||||
|
||||
// Call dismoint on the possessable comp to let it handle killing the possessable
|
||||
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
auto possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent) possessableComponent->Dismount();
|
||||
|
||||
// Update the entity that was possessing
|
||||
@ -4102,7 +4102,7 @@ void GameMessages::HandleAcknowledgePossession(RakNet::BitStream* inStream, Enti
|
||||
//Racing
|
||||
|
||||
void GameMessages::HandleModuleAssemblyQueryData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
auto* moduleAssemblyComponent = entity->GetComponent<ModuleAssemblyComponent>();
|
||||
auto moduleAssemblyComponent = entity->GetComponent<ModuleAssemblyComponent>();
|
||||
|
||||
Game::logger->Log("HandleModuleAssemblyQueryData", "Got Query from %i", entity->GetLOT());
|
||||
|
||||
@ -4138,7 +4138,7 @@ void GameMessages::HandleRacingClientReady(RakNet::BitStream* inStream, Entity*
|
||||
return;
|
||||
}
|
||||
|
||||
auto* racingControlComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent<RacingControlComponent>();
|
||||
auto racingControlComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent<RacingControlComponent>();
|
||||
|
||||
if (racingControlComponent == nullptr) {
|
||||
return;
|
||||
@ -4188,12 +4188,12 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
|
||||
|
||||
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
|
||||
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
auto racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
|
||||
Game::logger->Log("HandleRequestDie", "Got die request: %i", entity->GetLOT());
|
||||
|
||||
if (racingControlComponent != nullptr) {
|
||||
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
||||
auto possessableComponent = entity->GetComponent<PossessableComponent>();
|
||||
|
||||
if (possessableComponent != nullptr) {
|
||||
entity = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
@ -4231,7 +4231,7 @@ void GameMessages::HandleRacingPlayerInfoResetFinished(RakNet::BitStream* inStre
|
||||
|
||||
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
|
||||
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
auto racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
|
||||
Game::logger->Log("HandleRacingPlayerInfoResetFinished", "Got finished: %i", entity->GetLOT());
|
||||
|
||||
@ -4293,7 +4293,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in
|
||||
return;
|
||||
}
|
||||
|
||||
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
||||
auto possessableComponent = entity->GetComponent<PossessableComponent>();
|
||||
|
||||
if (possessableComponent != nullptr) {
|
||||
entity = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
@ -4303,7 +4303,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in
|
||||
}
|
||||
}
|
||||
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->UpdatePlayerStatistic(RacingImaginationPowerUpsCollected);
|
||||
}
|
||||
@ -4630,7 +4630,7 @@ void GameMessages::HandleRequestMoveItemBetweenInventoryTypes(RakNet::BitStream*
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent != nullptr) {
|
||||
if (itemID != LWOOBJID_EMPTY) {
|
||||
@ -4639,7 +4639,7 @@ void GameMessages::HandleRequestMoveItemBetweenInventoryTypes(RakNet::BitStream*
|
||||
if (!item) return;
|
||||
|
||||
// Despawn the pet if we are moving that pet to the vault.
|
||||
auto* petComponent = PetComponent::GetActivePet(entity->GetObjectID());
|
||||
auto petComponent = PetComponent::GetActivePet(entity->GetObjectID());
|
||||
if (petComponent && petComponent->GetDatabaseId() == item->GetSubKey()) {
|
||||
inventoryComponent->DespawnPet();
|
||||
}
|
||||
@ -4723,7 +4723,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
|
||||
if (!player) return;
|
||||
|
||||
auto* propertyVendorComponent = static_cast<PropertyVendorComponent*>(entity->GetComponent(eReplicaComponentType::PROPERTY_VENDOR));
|
||||
auto propertyVendorComponent = entity->GetComponent<PropertyVendorComponent>();
|
||||
|
||||
if (propertyVendorComponent != nullptr) {
|
||||
propertyVendorComponent->OnBuyFromVendor(player, bConfirmed, item, count);
|
||||
@ -4733,10 +4733,10 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
|
||||
const auto isCommendationVendor = entity->GetLOT() == 13806;
|
||||
|
||||
auto* vend = entity->GetComponent<VendorComponent>();
|
||||
auto vend = entity->GetComponent<VendorComponent>();
|
||||
if (!vend && !isCommendationVendor) return;
|
||||
|
||||
auto* inv = player->GetComponent<InventoryComponent>();
|
||||
auto inv = player->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
if (!isCommendationVendor && !vend->SellsItem(item)) {
|
||||
@ -4764,7 +4764,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
@ -4827,10 +4827,10 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
|
||||
if (!player) return;
|
||||
Character* character = player->GetCharacter();
|
||||
if (!character) return;
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(player->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = player->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
VendorComponent* vend = static_cast<VendorComponent*>(entity->GetComponent(eReplicaComponentType::VENDOR));
|
||||
auto vend = entity->GetComponent<VendorComponent>();
|
||||
if (!vend) return;
|
||||
|
||||
Item* item = inv->FindItemById(iObjID);
|
||||
@ -4877,10 +4877,10 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
|
||||
if (!player) return;
|
||||
Character* character = player->GetCharacter();
|
||||
if (!character) return;
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(player->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = player->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
VendorComponent* vend = static_cast<VendorComponent*>(entity->GetComponent(eReplicaComponentType::VENDOR));
|
||||
auto vend = entity->GetComponent<VendorComponent>();
|
||||
if (!vend) return;
|
||||
|
||||
Item* item = inv->FindItemById(iObjID);
|
||||
@ -4974,7 +4974,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity
|
||||
LWOCLONEID cloneId = 0;
|
||||
LWOMAPID mapId = 0;
|
||||
|
||||
auto* rocketPad = entity->GetComponent<RocketLaunchpadControlComponent>();
|
||||
auto rocketPad = entity->GetComponent<RocketLaunchpadControlComponent>();
|
||||
|
||||
if (rocketPad == nullptr) return;
|
||||
|
||||
@ -5031,7 +5031,7 @@ void GameMessages::HandleRebuildCancel(RakNet::BitStream* inStream, Entity* enti
|
||||
inStream->Read(bEarlyRelease);
|
||||
inStream->Read(userID);
|
||||
|
||||
RebuildComponent* rebComp = static_cast<RebuildComponent*>(entity->GetComponent(eReplicaComponentType::QUICK_BUILD));
|
||||
auto rebComp = entity->GetComponent<RebuildComponent>();
|
||||
if (!rebComp) return;
|
||||
|
||||
rebComp->CancelRebuild(EntityManager::Instance()->GetEntity(userID), eQuickBuildFailReason::CANCELED_EARLY);
|
||||
@ -5064,7 +5064,7 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity,
|
||||
|
||||
if (bIsMultiInteractUse) {
|
||||
if (multiInteractType == 0) {
|
||||
auto* missionOfferComponent = static_cast<MissionOfferComponent*>(interactedObject->GetComponent(eReplicaComponentType::MISSION_OFFER));
|
||||
auto missionOfferComponent = interactedObject->GetComponent<MissionOfferComponent>();
|
||||
|
||||
if (missionOfferComponent != nullptr) {
|
||||
missionOfferComponent->OfferMissions(entity, multiInteractID);
|
||||
@ -5077,7 +5077,7 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity,
|
||||
}
|
||||
|
||||
//Perform use task if possible:
|
||||
auto missionComponent = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) return;
|
||||
|
||||
@ -5099,7 +5099,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
|
||||
if (emoteID == 0) return;
|
||||
std::string sAnimationName = "deaded"; //Default name in case we fail to get the emote
|
||||
|
||||
MissionComponent* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
if (!missionComponent) return;
|
||||
|
||||
if (targetID != LWOOBJID_EMPTY) {
|
||||
@ -5143,7 +5143,7 @@ void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, E
|
||||
if (!user) return;
|
||||
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
|
||||
if (!character) return;
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = character->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
auto* item = inv->FindItemById(modelID);
|
||||
@ -5186,7 +5186,7 @@ void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* e
|
||||
inStream->Read(isDefaultReward);
|
||||
if (isDefaultReward) inStream->Read(reward);
|
||||
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
if (!missionComponent) {
|
||||
Game::logger->Log("GameMessages", "Unable to get mission component for entity %llu to handle RespondToMission", playerID);
|
||||
return;
|
||||
@ -5229,7 +5229,7 @@ void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* en
|
||||
}
|
||||
|
||||
// Get the player's mission component
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (!missionComponent) {
|
||||
Game::logger->Log("GameMessages", "Unable to get mission component for entity %llu to handle MissionDialogueOK", player->GetObjectID());
|
||||
return;
|
||||
@ -5253,7 +5253,7 @@ void GameMessages::HandleRequestLinkedMission(RakNet::BitStream* inStream, Entit
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
|
||||
auto* missionOfferComponent = static_cast<MissionOfferComponent*>(entity->GetComponent(eReplicaComponentType::MISSION_OFFER));
|
||||
auto missionOfferComponent = entity->GetComponent<MissionOfferComponent>();
|
||||
|
||||
if (missionOfferComponent != nullptr) {
|
||||
missionOfferComponent->OfferMissions(player, 0);
|
||||
@ -5267,16 +5267,16 @@ void GameMessages::HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* e
|
||||
Entity* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (!player || !entity || entity->GetCollectibleID() == 0) return;
|
||||
|
||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (missionComponent) {
|
||||
missionComponent->Progress(eMissionTaskType::COLLECTION, entity->GetLOT(), entity->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void GameMessages::HandleNotifyServerLevelProcessingComplete(RakNet::BitStream* inStream, Entity* entity) {
|
||||
auto* levelComp = entity->GetComponent<LevelProgressionComponent>();
|
||||
auto levelComp = entity->GetComponent<LevelProgressionComponent>();
|
||||
if (!levelComp) return;
|
||||
auto* character = entity->GetComponent<CharacterComponent>();
|
||||
auto character = entity->GetComponent<CharacterComponent>();
|
||||
if (!character) return;
|
||||
|
||||
//Update our character's level in memory:
|
||||
@ -5284,7 +5284,7 @@ void GameMessages::HandleNotifyServerLevelProcessingComplete(RakNet::BitStream*
|
||||
|
||||
levelComp->HandleLevelUp();
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent != nullptr) {
|
||||
auto* inventory = inventoryComponent->GetInventory(ITEMS);
|
||||
@ -5370,7 +5370,7 @@ void GameMessages::HandleEquipItem(RakNet::BitStream* inStream, Entity* entity)
|
||||
inStream->Read(immediate); //twice?
|
||||
inStream->Read(objectID);
|
||||
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
Item* item = inv->FindItemById(objectID);
|
||||
@ -5389,7 +5389,7 @@ void GameMessages::HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity
|
||||
inStream->Read(immediate);
|
||||
inStream->Read(objectID);
|
||||
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
auto* item = inv->FindItemById(objectID);
|
||||
@ -5464,7 +5464,7 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En
|
||||
inStream->Read(iTradeIDIsDefault);
|
||||
if (iTradeIDIsDefault) inStream->Read(iTradeID);
|
||||
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
auto* item = inv->FindItemById(iObjID);
|
||||
@ -5485,7 +5485,7 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En
|
||||
item->SetCount(item->GetCount() - iStackCount, true);
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->Progress(eMissionTaskType::GATHER, item->GetLot(), LWOOBJID_EMPTY, "", -iStackCount);
|
||||
@ -5507,7 +5507,7 @@ void GameMessages::HandleMoveItemInInventory(RakNet::BitStream* inStream, Entity
|
||||
inStream->Read(responseCode);
|
||||
inStream->Read(slot);
|
||||
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
auto* item = inv->FindItemById(iObjID);
|
||||
@ -5584,7 +5584,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
if (!user) return;
|
||||
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
|
||||
if (!character) return;
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = character->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
Game::logger->Log("GameMessages", "Build finished");
|
||||
@ -5639,7 +5639,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
inv->AddItem(8092, 1, eLootSourceType::QUICKBUILD, eInventoryType::MODELS, config);
|
||||
}
|
||||
|
||||
auto* missionComponent = character->GetComponent<MissionComponent>();
|
||||
auto missionComponent = character->GetComponent<MissionComponent>();
|
||||
|
||||
if (entity->GetLOT() != 9980 || Game::server->GetZoneID() != 1200) {
|
||||
if (missionComponent != nullptr) {
|
||||
@ -5649,7 +5649,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
}
|
||||
}
|
||||
|
||||
ScriptComponent* script = static_cast<ScriptComponent*>(entity->GetComponent(eReplicaComponentType::SCRIPT));
|
||||
auto script = entity->GetComponent<ScriptComponent>();
|
||||
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(entity)) {
|
||||
script->OnModularBuildExit(entity, character, count >= 3, modList);
|
||||
@ -5672,7 +5672,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
|
||||
if (!user) return;
|
||||
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
|
||||
if (!character) return;
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = character->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
/**
|
||||
@ -5790,7 +5790,7 @@ void GameMessages::HandleModularBuildMoveAndEquip(RakNet::BitStream* inStream, E
|
||||
|
||||
inStream->Read(templateID);
|
||||
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = character->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
auto* item = inv->FindItemByLot(templateID, TEMP_MODELS);
|
||||
@ -5842,13 +5842,13 @@ void GameMessages::HandleResurrect(RakNet::BitStream* inStream, Entity* entity)
|
||||
}
|
||||
|
||||
void GameMessages::HandlePushEquippedItemsState(RakNet::BitStream* inStream, Entity* entity) {
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
inv->PushEquippedItems();
|
||||
}
|
||||
|
||||
void GameMessages::HandlePopEquippedItemsState(RakNet::BitStream* inStream, Entity* entity) {
|
||||
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
inv->PopEquippedItems();
|
||||
EntityManager::Instance()->SerializeEntity(entity); // so it updates on client side
|
||||
@ -5860,7 +5860,7 @@ void GameMessages::HandleClientItemConsumed(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
inStream->Read(itemConsumed);
|
||||
|
||||
auto* inventory = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inventory = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventory == nullptr) {
|
||||
return;
|
||||
@ -5874,7 +5874,7 @@ void GameMessages::HandleClientItemConsumed(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
item->Consume();
|
||||
|
||||
auto* missions = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missions = entity->GetComponent<MissionComponent>();
|
||||
if (missions != nullptr) {
|
||||
missions->Progress(eMissionTaskType::USE_ITEM, itemLot);
|
||||
}
|
||||
@ -5886,7 +5886,7 @@ void GameMessages::HandleUseNonEquipmentItem(RakNet::BitStream* inStream, Entity
|
||||
|
||||
inStream->Read(itemConsumed);
|
||||
|
||||
auto* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (!inv) return;
|
||||
|
||||
@ -5921,7 +5921,7 @@ void GameMessages::HandleMatchRequest(RakNet::BitStream* inStream, Entity* entit
|
||||
if (type == 0) { // join
|
||||
if (value != 0) {
|
||||
for (Entity* scriptedAct : scriptedActs) {
|
||||
ScriptedActivityComponent* comp = static_cast<ScriptedActivityComponent*>(scriptedAct->GetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY));
|
||||
auto comp = scriptedAct->GetComponent<ScriptedActivityComponent>();
|
||||
if (!comp) continue;
|
||||
if (comp->GetActivityID() == value) {
|
||||
comp->PlayerJoin(entity);
|
||||
@ -5932,7 +5932,7 @@ void GameMessages::HandleMatchRequest(RakNet::BitStream* inStream, Entity* entit
|
||||
}
|
||||
} else if (type == 1) { // ready/unready
|
||||
for (Entity* scriptedAct : scriptedActs) {
|
||||
ScriptedActivityComponent* comp = static_cast<ScriptedActivityComponent*>(scriptedAct->GetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY));
|
||||
auto comp = scriptedAct->GetComponent<ScriptedActivityComponent>();
|
||||
if (!comp) continue;
|
||||
if (comp->PlayerIsInQueue(entity)) {
|
||||
comp->PlayerReady(entity, value);
|
||||
@ -6052,7 +6052,7 @@ void
|
||||
GameMessages::HandleClientRailMovementReady(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR);
|
||||
for (const auto* possibleRail : possibleRails) {
|
||||
const auto* rail = possibleRail->GetComponent<RailActivatorComponent>();
|
||||
const auto rail = possibleRail->GetComponent<RailActivatorComponent>();
|
||||
if (rail != nullptr) {
|
||||
rail->OnRailMovementReady(entity);
|
||||
}
|
||||
@ -6064,7 +6064,7 @@ void GameMessages::HandleCancelRailMovement(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR);
|
||||
for (const auto* possibleRail : possibleRails) {
|
||||
auto* rail = possibleRail->GetComponent<RailActivatorComponent>();
|
||||
auto rail = possibleRail->GetComponent<RailActivatorComponent>();
|
||||
if (rail != nullptr) {
|
||||
rail->OnCancelRailMovement(entity);
|
||||
}
|
||||
@ -6113,7 +6113,7 @@ void GameMessages::HandleModifyPlayerZoneStatistic(RakNet::BitStream* inStream,
|
||||
}
|
||||
|
||||
// Notify the character component that something's changed
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->HandleZoneStatisticsUpdate(zone, statisticsName, value);
|
||||
}
|
||||
@ -6130,7 +6130,7 @@ void GameMessages::HandleUpdatePlayerStatistic(RakNet::BitStream* inStream, Enti
|
||||
updateValue = 1;
|
||||
}
|
||||
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->UpdatePlayerStatistic((StatisticID)updateID, (uint64_t)std::max(updateValue, int64_t(0)));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ Item::Item(
|
||||
|
||||
inventory->AddManagedItem(this);
|
||||
|
||||
auto* entity = inventory->GetComponent()->GetOwningEntity();
|
||||
auto entity = inventory->GetComponent()->GetOwningEntity();
|
||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, static_cast<int>(this->count), subKey, lootSourceType);
|
||||
|
||||
if (isModMoveAndEquip) {
|
||||
@ -166,7 +166,7 @@ void Item::SetCount(const uint32_t value, const bool silent, const bool disassem
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
auto* entity = inventory->GetComponent()->GetOwningEntity();
|
||||
auto entity = inventory->GetComponent()->GetOwningEntity();
|
||||
|
||||
if (value > count) {
|
||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta, LWOOBJID_EMPTY, lootSourceType);
|
||||
@ -231,7 +231,7 @@ void Item::UnEquip() {
|
||||
}
|
||||
|
||||
bool Item::IsEquipped() const {
|
||||
auto* component = inventory->GetComponent();
|
||||
auto component = inventory->GetComponent();
|
||||
|
||||
for (const auto& pair : component->GetEquippedItems()) {
|
||||
const auto item = pair.second;
|
||||
@ -278,7 +278,7 @@ void Item::UseNonEquip(Item* item) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* playerInventoryComponent = GetInventory()->GetComponent();
|
||||
auto playerInventoryComponent = GetInventory()->GetComponent();
|
||||
if (!playerInventoryComponent) {
|
||||
Game::logger->LogDebug("Item", "no inventory component attached to item id %llu lot %i", this->GetId(), this->GetLot());
|
||||
return;
|
||||
|
@ -125,8 +125,8 @@ void ItemSet::OnEquip(const LOT lot) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<SkillComponent>();
|
||||
auto* missionComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<MissionComponent>();
|
||||
auto skillComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<SkillComponent>();
|
||||
auto missionComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<MissionComponent>();
|
||||
|
||||
for (const auto skill : skillSet) {
|
||||
auto* skillTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
|
||||
|
@ -37,8 +37,8 @@ void ItemSetPassiveAbility::Activate(Entity* target) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr) {
|
||||
return;
|
||||
@ -196,8 +196,8 @@ std::vector<ItemSetPassiveAbility> ItemSetPassiveAbility::FindAbilities(uint32_t
|
||||
}
|
||||
|
||||
void ItemSetPassiveAbility::OnEnemySmshed(Entity* target) {
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr) {
|
||||
return;
|
||||
|
@ -319,12 +319,12 @@ void Mission::Complete(const bool yieldRewards) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackMissionCompletion(!info->isMission);
|
||||
}
|
||||
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
missionComponent->Progress(eMissionTaskType::META, info->id);
|
||||
|
||||
@ -372,7 +372,7 @@ void Mission::CheckCompletion() {
|
||||
void Mission::Catchup() {
|
||||
auto* entity = GetAssociate();
|
||||
|
||||
auto* inventory = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inventory = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
for (auto* task : m_Tasks) {
|
||||
const auto type = task->GetType();
|
||||
@ -414,11 +414,11 @@ void Mission::YieldRewards() {
|
||||
|
||||
auto* character = GetUser()->GetLastUsedChar();
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto* levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
auto characterComponent = entity->GetComponent<CharacterComponent>();
|
||||
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
// Remove mission items
|
||||
for (auto* task : m_Tasks) {
|
||||
|
@ -194,7 +194,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = mission->GetAssociate()->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = mission->GetAssociate()->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent != nullptr) {
|
||||
int32_t itemCount = inventoryComponent->GetLotCountNonTransfer(value);
|
||||
@ -213,7 +213,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
}
|
||||
|
||||
Entity* entity;
|
||||
ScriptedActivityComponent* activity;
|
||||
std::shared_ptr<ScriptedActivityComponent> activity;
|
||||
uint32_t activityId;
|
||||
uint32_t lot;
|
||||
uint32_t collectionId;
|
||||
@ -238,7 +238,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
break;
|
||||
}
|
||||
|
||||
activity = static_cast<ScriptedActivityComponent*>(entity->GetComponent(eReplicaComponentType::QUICK_BUILD));
|
||||
activity = entity->GetComponent<ScriptedActivityComponent>();
|
||||
if (activity == nullptr) {
|
||||
break;
|
||||
}
|
||||
@ -308,7 +308,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
|
||||
int32_t gameID = minigameManager->GetLOT();
|
||||
|
||||
auto* sac = minigameManager->GetComponent<ScriptedActivityComponent>();
|
||||
auto sac = minigameManager->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac != nullptr) {
|
||||
gameID = sac->GetActivityID();
|
||||
}
|
||||
@ -368,7 +368,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
||||
|
||||
if (entity == nullptr) break;
|
||||
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
auto missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) break;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "UpdateActionMessage.h"
|
||||
#include "UpdateStripUiMessage.h"
|
||||
|
||||
void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, ModelComponent* modelComponent, Entity* modelOwner, const SystemAddress& sysAddr) {
|
||||
void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, std::shared_ptr<ModelComponent> modelComponent, Entity* modelOwner, const SystemAddress& sysAddr) {
|
||||
// auto behavior = modelComponent->FindBehavior(behaviorID);
|
||||
// if (behavior->GetBehaviorID() == -1 || behavior->GetShouldSetNewID()) {
|
||||
// ObjectIDManager::Instance()->RequestPersistentID(
|
||||
@ -57,7 +57,7 @@ void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, ModelComponent* mode
|
||||
}
|
||||
|
||||
void ControlBehaviors::SendBehaviorListToClient(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner) {
|
||||
auto* modelComponent = modelEntity->GetComponent<ModelComponent>();
|
||||
auto modelComponent = modelEntity->GetComponent<ModelComponent>();
|
||||
|
||||
if (!modelComponent) return;
|
||||
|
||||
@ -79,7 +79,7 @@ void ControlBehaviors::SendBehaviorListToClient(Entity* modelEntity, const Syste
|
||||
GameMessages::SendUIMessageServerToSingleClient(modelOwner, sysAddr, "UpdateBehaviorList", behaviorsToSerialize);
|
||||
}
|
||||
|
||||
void ControlBehaviors::ModelTypeChanged(AMFArrayValue* arguments, ModelComponent* ModelComponent) {
|
||||
void ControlBehaviors::ModelTypeChanged(AMFArrayValue* arguments, std::shared_ptr<ModelComponent> ModelComponent) {
|
||||
auto* modelTypeAmf = arguments->Get<double>("ModelType");
|
||||
if (!modelTypeAmf) return;
|
||||
|
||||
@ -137,7 +137,7 @@ void ControlBehaviors::Rename(Entity* modelEntity, const SystemAddress& sysAddr,
|
||||
}
|
||||
|
||||
// TODO This is also supposed to serialize the state of the behaviors in progress but those aren't implemented yet
|
||||
void ControlBehaviors::SendBehaviorBlocksToClient(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
|
||||
void ControlBehaviors::SendBehaviorBlocksToClient(std::shared_ptr<ModelComponent> modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
|
||||
// uint32_t behaviorID = ControlBehaviors::GetBehaviorIDFromArgument(arguments);
|
||||
|
||||
// auto modelBehavior = modelComponent->FindBehavior(behaviorID);
|
||||
@ -266,7 +266,7 @@ void ControlBehaviors::UpdateAction(AMFArrayValue* arguments) {
|
||||
}
|
||||
}
|
||||
|
||||
void ControlBehaviors::MoveToInventory(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
|
||||
void ControlBehaviors::MoveToInventory(std::shared_ptr<ModelComponent> modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
|
||||
// This closes the UI menu should it be open while the player is removing behaviors
|
||||
AMFArrayValue args;
|
||||
|
||||
@ -281,7 +281,7 @@ void ControlBehaviors::MoveToInventory(ModelComponent* modelComponent, const Sys
|
||||
|
||||
void ControlBehaviors::ProcessCommand(Entity* modelEntity, const SystemAddress& sysAddr, AMFArrayValue* arguments, std::string command, Entity* modelOwner) {
|
||||
if (!isInitialized || !modelEntity || !modelOwner || !arguments) return;
|
||||
auto* modelComponent = modelEntity->GetComponent<ModelComponent>();
|
||||
auto modelComponent = modelEntity->GetComponent<ModelComponent>();
|
||||
|
||||
if (!modelComponent) return;
|
||||
|
||||
|
@ -41,9 +41,9 @@ public:
|
||||
*/
|
||||
BlockDefinition* GetBlockInfo(const BlockName& blockName);
|
||||
private:
|
||||
void RequestUpdatedID(int32_t behaviorID, ModelComponent* modelComponent, Entity* modelOwner, const SystemAddress& sysAddr);
|
||||
void RequestUpdatedID(int32_t behaviorID, std::shared_ptr<ModelComponent> modelComponent, Entity* modelOwner, const SystemAddress& sysAddr);
|
||||
void SendBehaviorListToClient(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner);
|
||||
void ModelTypeChanged(AMFArrayValue* arguments, ModelComponent* ModelComponent);
|
||||
void ModelTypeChanged(AMFArrayValue* arguments, std::shared_ptr<ModelComponent> ModelComponent);
|
||||
void ToggleExecutionUpdates();
|
||||
void AddStrip(AMFArrayValue* arguments);
|
||||
void RemoveStrip(AMFArrayValue* arguments);
|
||||
@ -56,9 +56,9 @@ private:
|
||||
void Add(AMFArrayValue* arguments);
|
||||
void RemoveActions(AMFArrayValue* arguments);
|
||||
void Rename(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
|
||||
void SendBehaviorBlocksToClient(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
|
||||
void SendBehaviorBlocksToClient(std::shared_ptr<ModelComponent> modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
|
||||
void UpdateAction(AMFArrayValue* arguments);
|
||||
void MoveToInventory(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
|
||||
void MoveToInventory(std::shared_ptr<ModelComponent> modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
|
||||
std::map<BlockName, BlockDefinition*> blockTypes{};
|
||||
|
||||
// If false, property behaviors will not be able to be edited.
|
||||
|
@ -137,7 +137,7 @@ LootGenerator::LootGenerator() {
|
||||
}
|
||||
|
||||
std::unordered_map<LOT, int32_t> LootGenerator::RollLootMatrix(Entity* player, uint32_t matrixIndex) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
std::unordered_map<LOT, int32_t> drops;
|
||||
|
||||
@ -283,7 +283,7 @@ void LootGenerator::GiveLoot(Entity* player, uint32_t matrixIndex, eLootSourceTy
|
||||
void LootGenerator::GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result, eLootSourceType lootSourceType) {
|
||||
player = player->GetOwner(); // if the owner is overwritten, we collect that here
|
||||
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
|
||||
if (!inventoryComponent)
|
||||
return;
|
||||
@ -330,7 +330,7 @@ void LootGenerator::GiveActivityLoot(Entity* player, Entity* source, uint32_t ac
|
||||
void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins) {
|
||||
player = player->GetOwner(); // if the owner is overwritten, we collect that here
|
||||
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
|
||||
if (!inventoryComponent)
|
||||
return;
|
||||
@ -343,7 +343,7 @@ void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matr
|
||||
void LootGenerator::DropLoot(Entity* player, Entity* killedObject, std::unordered_map<LOT, int32_t>& result, uint32_t minCoins, uint32_t maxCoins) {
|
||||
player = player->GetOwner(); // if the owner is overwritten, we collect that here
|
||||
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
|
||||
if (!inventoryComponent)
|
||||
return;
|
||||
|
@ -197,7 +197,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd
|
||||
//Inventory::InventoryType itemType;
|
||||
int mailCost = dZoneManager::Instance()->GetWorldConfig()->mailBaseFee;
|
||||
int stackSize = 0;
|
||||
auto inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
Item* item = nullptr;
|
||||
|
||||
if (itemID > 0 && attachmentCount > 0 && inv) {
|
||||
@ -267,7 +267,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd
|
||||
Game::logger->Log("Mail", "Trying to remove item with ID/count/LOT: %i %i %i", itemID, attachmentCount, itemLOT);
|
||||
inv->RemoveItem(itemLOT, attachmentCount, INVALID, true);
|
||||
|
||||
auto* missionCompoent = entity->GetComponent<MissionComponent>();
|
||||
auto missionCompoent = entity->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionCompoent != nullptr) {
|
||||
missionCompoent->Progress(eMissionTaskType::GATHER, itemLOT, LWOOBJID_EMPTY, "", -attachmentCount);
|
||||
@ -356,7 +356,7 @@ void Mail::HandleAttachmentCollect(RakNet::BitStream* packet, const SystemAddres
|
||||
attachmentCount = res->getInt(2);
|
||||
}
|
||||
|
||||
auto inv = static_cast<InventoryComponent*>(player->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = player->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
inv->AddItem(attachmentLOT, attachmentCount, eLootSourceType::MAIL);
|
||||
|
@ -115,10 +115,10 @@ bool Precondition::Check(Entity* player, bool evaluateCosts) const {
|
||||
|
||||
|
||||
bool Precondition::CheckValue(Entity* player, const uint32_t value, bool evaluateCosts) const {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
auto* destroyableComponent = player->GetComponent<DestroyableComponent>();
|
||||
auto* levelComponent = player->GetComponent<LevelProgressionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
auto destroyableComponent = player->GetComponent<DestroyableComponent>();
|
||||
auto levelComponent = player->GetComponent<LevelProgressionComponent>();
|
||||
auto* character = player->GetCharacter();
|
||||
|
||||
Mission* mission;
|
||||
|
@ -176,7 +176,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
if (chatCommand == "pvp") {
|
||||
auto* character = entity->GetComponent<CharacterComponent>();
|
||||
auto character = entity->GetComponent<CharacterComponent>();
|
||||
|
||||
if (character == nullptr) {
|
||||
Game::logger->Log("SlashCommandHandler", "Failed to find character component!");
|
||||
@ -227,9 +227,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
if (chatCommand == "fix-stats") {
|
||||
// Reset skill component and buff component
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
// If any of the components are nullptr, return
|
||||
if (skillComponent == nullptr || buffComponent == nullptr || destroyableComponent == nullptr) {
|
||||
@ -336,7 +336,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "resurrect") {
|
||||
ScriptedActivityComponent* scriptedActivityComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivityComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent) { // check if user is in activity world and if so, they can't resurrect
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"You cannot resurrect in an activity world.");
|
||||
@ -373,7 +373,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
EntityManager::Instance()->DestructEntity(entity, sysAddr);
|
||||
auto* charComp = entity->GetComponent<CharacterComponent>();
|
||||
auto charComp = entity->GetComponent<CharacterComponent>();
|
||||
std::string lowerName = args[0];
|
||||
if (lowerName.empty()) return;
|
||||
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), ::tolower);
|
||||
@ -413,7 +413,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
if ((chatCommand == "playanimation" || chatCommand == "playanim") && args.size() == 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
std::u16string anim = GeneralUtils::ASCIIToUTF16(args[0], args[0].size());
|
||||
RenderComponent::PlayAnimation(entity, anim);
|
||||
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
auto possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
if (possessorComponent) {
|
||||
auto* possessedComponent = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
if (possessedComponent) RenderComponent::PlayAnimation(possessedComponent, anim);
|
||||
@ -468,7 +468,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
auto* controllablePhysicsComponent = entity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = entity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (!controllablePhysicsComponent) return;
|
||||
controllablePhysicsComponent->SetSpeedMultiplier(boost);
|
||||
@ -480,7 +480,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
if (possessedID != LWOOBJID_EMPTY) {
|
||||
auto possessable = EntityManager::Instance()->GetEntity(possessedID);
|
||||
if (possessable) {
|
||||
auto* possessControllablePhysicsComponent = possessable->GetComponent<ControllablePhysicsComponent>();
|
||||
auto possessControllablePhysicsComponent = possessable->GetComponent<ControllablePhysicsComponent>();
|
||||
if (possessControllablePhysicsComponent) {
|
||||
possessControllablePhysicsComponent->SetSpeedMultiplier(boost);
|
||||
}
|
||||
@ -579,7 +579,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
GeneralUtils::to_u16string(size));
|
||||
} else ChatPackets::SendSystemMessage(sysAddr, u"Setting inventory ITEMS to size " + GeneralUtils::to_u16string(size));
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
if (inventoryComponent) {
|
||||
auto* inventory = inventoryComponent->GetInventory(selectedInventory);
|
||||
|
||||
@ -629,7 +629,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
auto comp = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto comp = entity->GetComponent<MissionComponent>();
|
||||
if (comp) comp->AcceptMission(missionID, true);
|
||||
return;
|
||||
}
|
||||
@ -644,7 +644,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
auto comp = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto comp = entity->GetComponent<MissionComponent>();
|
||||
if (comp) comp->CompleteMission(missionID, true);
|
||||
return;
|
||||
}
|
||||
@ -694,7 +694,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
auto* comp = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto comp = entity->GetComponent<MissionComponent>();
|
||||
|
||||
if (comp == nullptr) {
|
||||
return;
|
||||
@ -771,7 +771,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "getnavmeshheight" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
auto control = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
||||
auto control = entity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!control) return;
|
||||
|
||||
float y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(control->GetPosition());
|
||||
@ -788,7 +788,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inventory = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
inventory->AddItem(itemLOT, 1, eLootSourceType::MODERATION);
|
||||
} else if (args.size() == 2) {
|
||||
@ -806,7 +806,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inventory = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
inventory->AddItem(itemLOT, count, eLootSourceType::MODERATION);
|
||||
} else {
|
||||
@ -935,12 +935,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
|
||||
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
auto possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
if (possessorComponent) {
|
||||
auto* possassableEntity = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
|
||||
if (possassableEntity != nullptr) {
|
||||
auto* vehiclePhysicsComponent = possassableEntity->GetComponent<VehiclePhysicsComponent>();
|
||||
auto vehiclePhysicsComponent = possassableEntity->GetComponent<VehiclePhysicsComponent>();
|
||||
if (vehiclePhysicsComponent) {
|
||||
vehiclePhysicsComponent->SetPosition(pos);
|
||||
EntityManager::Instance()->SerializeEntity(possassableEntity);
|
||||
@ -962,7 +962,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "dismount" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
auto possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
if (possessorComponent) {
|
||||
auto possessableId = possessorComponent->GetPossessable();
|
||||
if (possessableId != LWOOBJID_EMPTY) {
|
||||
@ -1171,7 +1171,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
//-------------------------------------------------
|
||||
|
||||
if (chatCommand == "buffme" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto dest = entity->GetComponent<DestroyableComponent>();
|
||||
if (dest) {
|
||||
dest->SetHealth(999);
|
||||
dest->SetMaxHealth(999.0f);
|
||||
@ -1195,7 +1195,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "buffmed" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto dest = entity->GetComponent<DestroyableComponent>();
|
||||
if (dest) {
|
||||
dest->SetHealth(9);
|
||||
dest->SetMaxHealth(9.0f);
|
||||
@ -1209,7 +1209,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
if (chatCommand == "refillstats" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
|
||||
auto dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto dest = entity->GetComponent<DestroyableComponent>();
|
||||
if (dest) {
|
||||
dest->SetHealth((int)dest->GetMaxHealth());
|
||||
dest->SetArmor((int)dest->GetMaxArmor());
|
||||
@ -1242,7 +1242,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "spawn" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) {
|
||||
ControllablePhysicsComponent* comp = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
||||
auto comp = entity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!comp) return;
|
||||
|
||||
uint32_t lot;
|
||||
@ -1341,7 +1341,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterComponent* character = entity->GetComponent<CharacterComponent>();
|
||||
auto character = entity->GetComponent<CharacterComponent>();
|
||||
if (character) character->SetUScore(character->GetUScore() + uscore);
|
||||
// MODERATION should work but it doesn't. Relog to see uscore changes
|
||||
|
||||
@ -1486,7 +1486,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "gmimmune" && args.size() >= 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
int32_t state = false;
|
||||
|
||||
@ -1503,7 +1503,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "buff" && args.size() >= 2 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto buffComponent = entity->GetComponent<BuffComponent>();
|
||||
|
||||
int32_t id = 0;
|
||||
int32_t duration = 0;
|
||||
@ -1615,7 +1615,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if ((chatCommand == "boost") && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
auto possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
|
||||
if (possessorComponent == nullptr) {
|
||||
return;
|
||||
@ -1647,7 +1647,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if ((chatCommand == "unboost") && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
auto possessorComponent = entity->GetComponent<PossessorComponent>();
|
||||
|
||||
if (possessorComponent == nullptr) return;
|
||||
auto* vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
@ -1674,7 +1674,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
//Go tell physics to spawn all the vertices:
|
||||
auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PHANTOM_PHYSICS);
|
||||
for (auto en : entities) {
|
||||
auto phys = static_cast<PhantomPhysicsComponent*>(en->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
|
||||
auto phys = en->GetComponent<PhantomPhysicsComponent>();
|
||||
if (phys)
|
||||
phys->SpawnVertices();
|
||||
}
|
||||
@ -1683,7 +1683,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
if (chatCommand == "reportproxphys" && entity->GetGMLevel() >= eGameMasterLevel::JUNIOR_DEVELOPER) {
|
||||
auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PROXIMITY_MONITOR);
|
||||
for (auto en : entities) {
|
||||
auto phys = static_cast<ProximityMonitorComponent*>(en->GetComponent(eReplicaComponentType::PROXIMITY_MONITOR));
|
||||
auto phys = en->GetComponent<ProximityMonitorComponent>();
|
||||
if (phys) {
|
||||
for (auto prox : phys->GetProximitiesData()) {
|
||||
if (!prox.second) continue;
|
||||
@ -1717,7 +1717,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
if (!GeneralUtils::TryParse(args[0], baseItem)) return;
|
||||
if (!GeneralUtils::TryParse(args[1], reforgedItem)) return;
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) return;
|
||||
|
||||
@ -1779,7 +1779,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
dpWorld::Instance().Reload();
|
||||
auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
|
||||
for (auto entity : entities) {
|
||||
auto* scriptedActivityComponent = entity->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivityComponent = entity->GetComponent<ScriptedActivityComponent>();
|
||||
if (!scriptedActivityComponent) continue;
|
||||
|
||||
scriptedActivityComponent->ReloadConfig();
|
||||
@ -1842,7 +1842,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
if (!inventoryComponent) return;
|
||||
|
||||
auto* inventoryToDelete = inventoryComponent->GetInventory(inventoryType);
|
||||
@ -1930,7 +1930,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
if (args.size() >= 2) {
|
||||
if (args[1] == "-m" && args.size() >= 3) {
|
||||
auto* movingPlatformComponent = closest->GetComponent<MovingPlatformComponent>();
|
||||
auto movingPlatformComponent = closest->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
int32_t value = 0;
|
||||
|
||||
@ -1964,7 +1964,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
GeneralUtils::ASCIIToUTF16("< " + std::to_string(postion.x) + ", " + std::to_string(postion.y) + ", " + std::to_string(postion.z) + " >")
|
||||
);
|
||||
} else if (args[1] == "-f") {
|
||||
auto* destuctable = closest->GetComponent<DestroyableComponent>();
|
||||
auto destuctable = closest->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destuctable == nullptr) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"No destroyable component on this entity!");
|
||||
@ -1993,7 +1993,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
destuctable->AddFaction(faction, true);
|
||||
}
|
||||
} else if (args[1] == "-t") {
|
||||
auto* phantomPhysicsComponent = closest->GetComponent<PhantomPhysicsComponent>();
|
||||
auto phantomPhysicsComponent = closest->GetComponent<PhantomPhysicsComponent>();
|
||||
|
||||
if (phantomPhysicsComponent != nullptr) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Type: " + (GeneralUtils::to_u16string(static_cast<uint32_t>(phantomPhysicsComponent->GetEffectType()))));
|
||||
@ -2003,7 +2003,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Active: " + (GeneralUtils::to_u16string(phantomPhysicsComponent->GetPhysicsEffectActive())));
|
||||
}
|
||||
|
||||
auto* triggerComponent = closest->GetComponent<TriggerComponent>();
|
||||
auto triggerComponent = closest->GetComponent<TriggerComponent>();
|
||||
if (triggerComponent) {
|
||||
auto trigger = triggerComponent->GetTrigger();
|
||||
if (trigger) {
|
||||
|
@ -117,7 +117,7 @@ void VanityUtilities::SpawnVanity() {
|
||||
|
||||
npcEntity->SetVar<std::vector<std::string>>(u"chats", npc.m_Phrases);
|
||||
|
||||
auto* scriptComponent = npcEntity->GetComponent<ScriptComponent>();
|
||||
auto scriptComponent = npcEntity->GetComponent<ScriptComponent>();
|
||||
|
||||
if (scriptComponent != nullptr) {
|
||||
scriptComponent->SetScript(npc.m_Script);
|
||||
@ -161,13 +161,13 @@ Entity* VanityUtilities::SpawnNPC(LOT lot, const std::string& name, const NiPoin
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
entity->SetVar(u"npcName", name);
|
||||
|
||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent != nullptr) {
|
||||
inventoryComponent->SetNPCItems(inventory);
|
||||
}
|
||||
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetIsGMImmune(true);
|
||||
@ -519,7 +519,7 @@ void VanityUtilities::SetupNPCTalk(Entity* npc) {
|
||||
}
|
||||
|
||||
void VanityUtilities::NPCTalk(Entity* npc) {
|
||||
auto* proximityMonitorComponent = npc->GetComponent<ProximityMonitorComponent>();
|
||||
auto proximityMonitorComponent = npc->GetComponent<ProximityMonitorComponent>();
|
||||
|
||||
if (!proximityMonitorComponent->GetProximityObjects("talk").empty()) {
|
||||
const auto& chats = npc->GetVar<std::vector<std::string>>(u"chats");
|
||||
|
@ -29,9 +29,9 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
|
||||
//self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true, bImmuneToInterrupt = true }
|
||||
|
||||
//Get our components:
|
||||
destroyable = static_cast<DestroyableComponent*>(self->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
controllable = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
||||
combat = static_cast<BaseCombatAIComponent*>(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
auto destroyable = self->GetComponent<DestroyableComponent>();
|
||||
auto controllable = self->GetComponent<ControllablePhysicsComponent>();
|
||||
auto combat = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (!destroyable || !controllable) return;
|
||||
|
||||
@ -53,7 +53,7 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
|
||||
|
||||
void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
|
||||
if (dZoneManager::Instance()->GetZoneID().GetMapID() == instanceZoneID) {
|
||||
auto* missionComponent = killer->GetComponent<MissionComponent>();
|
||||
auto missionComponent = killer->GetComponent<MissionComponent>();
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
|
||||
@ -99,7 +99,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
|
||||
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
baseCombatAi->SetDisabled(true);
|
||||
|
||||
@ -123,7 +123,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
|
||||
//Cancel all remaining timers for say idle anims:
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
baseCombatAi->SetDisabled(false);
|
||||
|
||||
@ -314,7 +314,7 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact skill component!");
|
||||
@ -347,7 +347,7 @@ void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self) {
|
||||
|
||||
const auto target = attackTargetTable[0];
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
skillComponent->CalculateBehavior(1394, 32612, target, true);
|
||||
|
||||
@ -381,7 +381,7 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
|
||||
|
||||
attackTargetTable.push_back(attackFocus);
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
skillComponent->CalculateBehavior(1480, 36652, attackFocus, true);
|
||||
|
||||
@ -493,14 +493,14 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
|
||||
auto landingTarget = self->GetI64(u"LandingTarget");
|
||||
auto landingEntity = EntityManager::Instance()->GetEntity(landingTarget);
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY);
|
||||
}
|
||||
|
||||
if (landingEntity) {
|
||||
auto* landingSkill = landingEntity->GetComponent<SkillComponent>();
|
||||
auto landingSkill = landingEntity->GetComponent<SkillComponent>();
|
||||
|
||||
if (landingSkill != nullptr) {
|
||||
landingSkill->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY, true);
|
||||
|
@ -12,7 +12,7 @@
|
||||
void AmDarklingDragon::OnStartup(Entity* self) {
|
||||
self->SetVar<int32_t>(u"weakspot", 0);
|
||||
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetStunImmune(true);
|
||||
@ -46,7 +46,7 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
|
||||
}
|
||||
}
|
||||
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
if (destroyableComponent->GetArmor() > 0) return;
|
||||
@ -56,8 +56,8 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
|
||||
if (weakpoint == 0) {
|
||||
self->AddTimer("ReviveTimer", 12);
|
||||
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetDisabled(true);
|
||||
@ -127,8 +127,8 @@ void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
|
||||
RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
|
||||
self->AddTimer("backToAttack", 1);
|
||||
} else if (timerName == "backToAttack") {
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetDisabled(false);
|
||||
baseCombatAIComponent->SetStunned(false);
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AmSkeletonEngineer::OnHit(Entity* self, Entity* attacker) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr) {
|
||||
return;
|
||||
|
@ -10,7 +10,7 @@
|
||||
void FvMaelstromDragon::OnStartup(Entity* self) {
|
||||
self->SetVar<int32_t>(u"weakspot", 0);
|
||||
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetStunImmune(true);
|
||||
@ -59,7 +59,7 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
|
||||
}
|
||||
}
|
||||
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
if (destroyableComponent->GetArmor() > 0) return;
|
||||
@ -71,8 +71,8 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
|
||||
|
||||
self->AddTimer("ReviveTimer", 12);
|
||||
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetDisabled(true);
|
||||
@ -143,8 +143,8 @@ void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName) {
|
||||
RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
|
||||
self->AddTimer("backToAttack", 1.0f);
|
||||
} else if (timerName == "backToAttack") {
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetDisabled(false);
|
||||
|
@ -31,11 +31,11 @@ void BaseEnemyApe::OnSkillCast(Entity* self, uint32_t skillID) {
|
||||
}
|
||||
|
||||
void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr && destroyableComponent->GetArmor() < 1 && !self->GetBoolean(u"knockedOut")) {
|
||||
StunApe(self, true);
|
||||
self->CancelTimer("spawnQBTime");
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent) {
|
||||
skillComponent->Reset();
|
||||
}
|
||||
@ -52,7 +52,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
// Revives the ape, giving it back some armor
|
||||
const auto timesStunned = self->GetVar<uint32_t>(u"timesStunned");
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned);
|
||||
}
|
||||
@ -104,7 +104,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(1273, 29446, self->GetObjectID(), true, false, player->GetObjectID());
|
||||
}
|
||||
@ -123,12 +123,12 @@ void BaseEnemyApe::OnFireEventServerSide(Entity* self, Entity* sender, std::stri
|
||||
}
|
||||
|
||||
void BaseEnemyApe::StunApe(Entity* self, bool stunState) {
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(stunState);
|
||||
combatAIComponent->SetStunned(stunState);
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->Interrupt();
|
||||
}
|
||||
|
@ -9,14 +9,14 @@
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void BaseEnemyMech::OnStartup(Entity* self) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetFaction(4);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
|
||||
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
||||
auto controlPhys = self->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controlPhys) return;
|
||||
|
||||
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void EnemyNjBuff::OnStartup(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
|
@ -15,7 +15,7 @@ void TreasureChestDragonServer::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
self->SetVar<bool>(u"bUsed", true);
|
||||
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent == nullptr) {
|
||||
return;
|
||||
|
@ -4,7 +4,7 @@
|
||||
void AgSurvivalMech::OnStartup(Entity* self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
|
||||
auto* destroyable = self->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyable != nullptr) {
|
||||
destroyable->SetFaction(4);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
void AgSurvivalSpiderling::OnStartup(Entity* self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
|
||||
auto* combatAI = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAI = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAI != nullptr) {
|
||||
combatAI->SetStunImmune(true);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ void WaveBossApe::OnStartup(Entity* self) {
|
||||
self->SetVar<float_t>(u"AnchorDamageDelayTime", 0.5f);
|
||||
self->SetVar<float_t>(u"spawnQBTime", 5.0f);
|
||||
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(true);
|
||||
combatAIComponent->SetStunImmune(true);
|
||||
@ -30,7 +30,7 @@ void WaveBossApe::OnDie(Entity* self, Entity* killer) {
|
||||
void WaveBossApe::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args == "startAI") {
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(false);
|
||||
combatAIComponent->SetStunImmune(false);
|
||||
|
@ -5,7 +5,7 @@
|
||||
void WaveBossHammerling::OnStartup(Entity* self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(true);
|
||||
combatAIComponent->SetStunImmune(true);
|
||||
@ -17,7 +17,7 @@ void WaveBossHammerling::OnStartup(Entity* self) {
|
||||
void WaveBossHammerling::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == "startAI") {
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(false);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
void WaveBossHorsemen::OnStartup(Entity* self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(true);
|
||||
combatAIComponent->SetStunImmune(true);
|
||||
@ -18,7 +18,7 @@ void
|
||||
WaveBossHorsemen::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args == "startAI") {
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(false);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
void WaveBossSpiderling::OnStartup(Entity* self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(true);
|
||||
combatAIComponent->SetStunImmune(true);
|
||||
@ -17,7 +17,7 @@ void WaveBossSpiderling::OnStartup(Entity* self) {
|
||||
void WaveBossSpiderling::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == "startAI") {
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(false);
|
||||
combatAIComponent->SetStunImmune(false);
|
||||
|
@ -35,13 +35,13 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
|
||||
// Make sure players only dig up one booty per instance
|
||||
player->SetVar<bool>(u"bootyDug", true);
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
auto* mission = missionComponent->GetMission(1881);
|
||||
if (mission != nullptr && (mission->GetMissionState() == eMissionState::ACTIVE || mission->GetMissionState() == eMissionState::COMPLETE_ACTIVE)) {
|
||||
mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
|
||||
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
auto renderComponent = self->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr)
|
||||
renderComponent->PlayEffect(7730, u"cast", "bootyshine");
|
||||
|
||||
|
@ -8,7 +8,7 @@ void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
|
||||
void AgBugsprayer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "castSkill") {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
|
@ -21,7 +21,7 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
|
||||
character->SetPlayerFlag(ePlayerFlag::CAGED_SPIDER, true);
|
||||
|
||||
//Remove the maelstrom cube:
|
||||
auto inv = static_cast<InventoryComponent*>(user->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inv) {
|
||||
inv->RemoveItem(14553, 1);
|
||||
|
@ -8,7 +8,7 @@ void AgLaserSensorServer::OnStartup(Entity* self) {
|
||||
self->SetBoolean(u"active", true);
|
||||
auto repelForce = self->GetVarAs<float>(u"repelForce");
|
||||
if (!repelForce) repelForce = m_RepelForce;
|
||||
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
|
||||
auto phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) return;
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE);
|
||||
@ -22,7 +22,7 @@ void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!active) return;
|
||||
auto skillCastID = self->GetVarAs<float>(u"skillCastID");
|
||||
if (skillCastID == 0) skillCastID = m_SkillCastID;
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) return;
|
||||
skillComponent->CastSkill(m_SkillCastID, target->GetObjectID());
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ void NpcAgCourseStarter::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void NpcAgCourseStarter::OnUse(Entity* self, Entity* user) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent == nullptr) {
|
||||
return;
|
||||
@ -27,7 +27,7 @@ void NpcAgCourseStarter::OnUse(Entity* self, Entity* user) {
|
||||
}
|
||||
|
||||
void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent == nullptr) {
|
||||
return;
|
||||
@ -70,7 +70,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
|
||||
|
||||
void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (scriptedActivityComponent == nullptr)
|
||||
return;
|
||||
|
||||
@ -88,7 +88,7 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
|
||||
data->values[2] = *(float*)&finish;
|
||||
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
auto missionComponent = sender->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->ForceProgressTaskType(1884, 1, 1, false);
|
||||
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, -finish, self->GetObjectID(),
|
||||
|
@ -7,7 +7,7 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = target->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
|
@ -12,7 +12,7 @@ void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int
|
||||
if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"switch", 0, 0, LWOOBJID_EMPTY, "", target->GetSystemAddress());
|
||||
|
||||
auto* inv = static_cast<InventoryComponent*>(target->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = target->GetComponent<InventoryComponent>();
|
||||
|
||||
// If we are ready to complete our missions, we take the kit from you:
|
||||
if (inv && missionState == eMissionState::READY_TO_COMPLETE) {
|
||||
@ -23,7 +23,7 @@ void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int
|
||||
}
|
||||
}
|
||||
} else if (missionState == eMissionState::AVAILABLE) {
|
||||
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missionComponent = target->GetComponent<MissionComponent>();
|
||||
missionComponent->CompleteMission(mailAchievement, true);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "InventoryComponent.h"
|
||||
|
||||
void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
auto* inventory = target->GetComponent<InventoryComponent>();
|
||||
auto inventory = target->GetComponent<InventoryComponent>();
|
||||
if (inventory != nullptr && missionID == 1881) {
|
||||
auto* luckyShovel = inventory->FindItemByLot(14591);
|
||||
|
||||
|
@ -9,7 +9,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
||||
if (missionID != 1849 && missionID != 1883)
|
||||
return;
|
||||
|
||||
auto* inventory = target->GetComponent<InventoryComponent>();
|
||||
auto inventory = target->GetComponent<InventoryComponent>();
|
||||
if (inventory == nullptr)
|
||||
return;
|
||||
|
||||
|
@ -23,7 +23,7 @@ void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int mis
|
||||
if (missionID != defaultMission && missionID != 313) return;
|
||||
|
||||
if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) {
|
||||
auto inv = static_cast<InventoryComponent*>(target->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = target->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
//remove the inventory items
|
||||
|
@ -28,7 +28,7 @@ void ZoneAgSpiderQueen::BasePlayerLoaded(Entity* self, Entity* player) {
|
||||
ActivityManager::TakeActivityCost(self, player->GetObjectID());
|
||||
|
||||
// Make sure the player has full stats when they join
|
||||
auto* playerDestroyableComponent = player->GetComponent<DestroyableComponent>();
|
||||
auto playerDestroyableComponent = player->GetComponent<DestroyableComponent>();
|
||||
if (playerDestroyableComponent != nullptr) {
|
||||
playerDestroyableComponent->SetImagination(playerDestroyableComponent->GetMaxImagination());
|
||||
playerDestroyableComponent->SetArmor(playerDestroyableComponent->GetMaxArmor());
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "Character.h"
|
||||
|
||||
void AmBlueX::OnUse(Entity* self, Entity* user) {
|
||||
auto* skillComponent = user->GetComponent<SkillComponent>();
|
||||
auto skillComponent = user->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(m_SwordSkill, m_SwordBehavior, self->GetObjectID());
|
||||
}
|
||||
@ -37,7 +37,7 @@ void AmBlueX::OnSkillEventFired(Entity* self, Entity* caster, const std::string&
|
||||
self->AddCallbackTimer(m_BombTime, [this, self, fxObjectID, playerID]() {
|
||||
auto* fxObject = EntityManager::Instance()->GetEntity(fxObjectID);
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr)
|
||||
return;
|
||||
|
@ -60,7 +60,7 @@ void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
self->SetNetworkVar(u"BridgeLeaving", false);
|
||||
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
auto simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent == nullptr) {
|
||||
return;
|
||||
@ -87,7 +87,7 @@ void AmDrawBridge::OnNotifyObject(Entity* self, Entity* sender, const std::strin
|
||||
}
|
||||
|
||||
void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) {
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
auto simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent == nullptr) {
|
||||
return;
|
||||
|
@ -10,14 +10,14 @@ void AmDropshipComputer::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
auto missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (missionComponent == nullptr || inventoryComponent == nullptr) {
|
||||
return;
|
||||
@ -70,7 +70,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr) {
|
||||
return;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
void AmScrollReaderServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
if (identifier == u"story_end") {
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
auto missionComponent = sender->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
|
@ -15,7 +15,7 @@ void AmShieldGenerator::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGenerator::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (status == "ENTER" && name == "shield") {
|
||||
if (destroyableComponent->HasFaction(4)) {
|
||||
@ -102,7 +102,7 @@ void AmShieldGenerator::StartShield(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGenerator::BuffPlayers(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
@ -122,8 +122,8 @@ void AmShieldGenerator::BuffPlayers(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGenerator::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
auto baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) {
|
||||
return;
|
||||
|
@ -15,7 +15,7 @@ void AmShieldGeneratorQuickbuild::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (name == "shield") {
|
||||
if (!destroyableComponent->HasFaction(4) || entering->IsPlayer()) {
|
||||
@ -122,7 +122,7 @@ void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
@ -154,7 +154,7 @@ void AmShieldGeneratorQuickbuild::StartShield(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
@ -174,14 +174,14 @@ void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
auto baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) {
|
||||
return;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user