mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-16 04:18:08 +00:00
Update in response to feedback
This commit is contained in:
@@ -22,8 +22,8 @@ TriggerComponent::TriggerComponent(Entity* parent, const std::string triggerInfo
|
||||
|
||||
std::vector<std::string> tokens = GeneralUtils::SplitString(triggerInfo, ':');
|
||||
|
||||
const auto sceneID = GeneralUtils::TryParse<uint32_t>(tokens.at(0)).value();
|
||||
const auto triggerID = GeneralUtils::TryParse<uint32_t>(tokens.at(1)).value();
|
||||
const auto sceneID = GeneralUtils::TryParse<uint32_t>(tokens.at(0)).value_or(0);
|
||||
const auto triggerID = GeneralUtils::TryParse<uint32_t>(tokens.at(1)).value_or(0);
|
||||
|
||||
m_Trigger = Game::zoneManager->GetZone()->GetTrigger(sceneID, triggerID);
|
||||
|
||||
@@ -189,7 +189,7 @@ void TriggerComponent::HandleFireEvent(Entity* targetEntity, std::string args) {
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string args){
|
||||
const eKillType killType = GeneralUtils::TryParse<eKillType>(args).value_or(eKillType::SILENT);
|
||||
const eKillType killType = GeneralUtils::TryParse<eKillType>(args).value_or(eKillType::VIOLENT);
|
||||
targetEntity->Smash(m_Parent->GetObjectID(), killType);
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
|
||||
LOG_DEBUG("Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
const float forceMultiplier = GeneralUtils::TryParse<float>(args).value();
|
||||
const float forceMultiplier = GeneralUtils::TryParse<float>(args).value_or(1.0f);
|
||||
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE);
|
||||
@@ -356,7 +356,7 @@ void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
||||
LOG_DEBUG("Skill component not found!");
|
||||
return;
|
||||
}
|
||||
const uint32_t skillId = GeneralUtils::TryParse<uint32_t>(args).value();
|
||||
const uint32_t skillId = GeneralUtils::TryParse<uint32_t>(args).value_or(0);
|
||||
skillComponent->CastSkill(skillId, targetEntity->GetObjectID());
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include "dCommonVars.h"
|
||||
|
||||
BehaviorMessageBase::BehaviorMessageBase(AMFArrayValue* arguments) {
|
||||
this->behaviorId = GetBehaviorIdFromArgument(arguments);
|
||||
m_BehaviorId = GetBehaviorIdFromArgument(arguments);
|
||||
}
|
||||
|
||||
int32_t BehaviorMessageBase::GetBehaviorIdFromArgument(AMFArrayValue* arguments) {
|
||||
@@ -13,13 +13,13 @@ int32_t BehaviorMessageBase::GetBehaviorIdFromArgument(AMFArrayValue* arguments)
|
||||
auto* behaviorIDValue = arguments->Get<std::string>(key);
|
||||
|
||||
if (behaviorIDValue && behaviorIDValue->GetValueType() == eAmf::String) {
|
||||
this->behaviorId =
|
||||
GeneralUtils::TryParse<int32_t>(behaviorIDValue->GetValue()).value_or(this->behaviorId);
|
||||
m_BehaviorId =
|
||||
GeneralUtils::TryParse<int32_t>(behaviorIDValue->GetValue()).value_or(m_BehaviorId);
|
||||
} else if (arguments->Get(key) && arguments->Get(key)->GetValueType() != eAmf::Undefined) {
|
||||
throw std::invalid_argument("Unable to find behavior ID");
|
||||
}
|
||||
|
||||
return this->behaviorId;
|
||||
return m_BehaviorId;
|
||||
}
|
||||
|
||||
int32_t BehaviorMessageBase::GetActionIndexFromArgument(AMFArrayValue* arguments, const std::string& keyName) {
|
||||
|
@@ -16,13 +16,13 @@ enum class BehaviorState : uint32_t;
|
||||
class BehaviorMessageBase {
|
||||
public:
|
||||
static inline int32_t DefaultBehaviorId = -1;
|
||||
const int32_t GetBehaviorId() const { return behaviorId; };
|
||||
bool IsDefaultBehaviorId() { return behaviorId == DefaultBehaviorId; };
|
||||
const int32_t GetBehaviorId() const { return m_BehaviorId; };
|
||||
bool IsDefaultBehaviorId() { return m_BehaviorId == DefaultBehaviorId; };
|
||||
BehaviorMessageBase(AMFArrayValue* arguments);
|
||||
protected:
|
||||
int32_t GetBehaviorIdFromArgument(AMFArrayValue* arguments);
|
||||
int32_t GetActionIndexFromArgument(AMFArrayValue* arguments, const std::string& keyName = "actionIndex");
|
||||
int32_t behaviorId = DefaultBehaviorId;
|
||||
int32_t m_BehaviorId = DefaultBehaviorId;
|
||||
};
|
||||
|
||||
#endif //!__BEHAVIORMESSAGEBASE__H__
|
||||
|
@@ -1902,8 +1902,6 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
if (chatCommand == "inspect" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) {
|
||||
Entity* closest = nullptr;
|
||||
|
||||
//eReplicaComponentType component;
|
||||
|
||||
std::u16string ldf;
|
||||
|
||||
bool isLDF = false;
|
||||
|
Reference in New Issue
Block a user