mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +00:00
format codebase
This commit is contained in:
@@ -7,14 +7,12 @@
|
||||
#include "dLogger.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
|
||||
{
|
||||
void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator;
|
||||
|
||||
auto* entity = EntityManager::Instance()->GetEntity(target);
|
||||
|
||||
if (entity == nullptr)
|
||||
{
|
||||
if (entity == nullptr) {
|
||||
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target);
|
||||
|
||||
return;
|
||||
@@ -22,8 +20,7 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
||||
|
||||
auto* component = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (component == nullptr)
|
||||
{
|
||||
if (component == nullptr) {
|
||||
Game::logger->Log("BuffBehavior", "Invalid target, no destroyable component (%llu)!", target);
|
||||
|
||||
return;
|
||||
@@ -35,27 +32,21 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
|
||||
if (!context->unmanaged)
|
||||
{
|
||||
if (branch.duration > 0)
|
||||
{
|
||||
if (!context->unmanaged) {
|
||||
if (branch.duration > 0) {
|
||||
context->RegisterTimerBehavior(this, branch);
|
||||
}
|
||||
else if (branch.start > 0)
|
||||
{
|
||||
} else if (branch.start > 0) {
|
||||
context->RegisterEndBehavior(this, branch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch)
|
||||
{
|
||||
void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
|
||||
const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator;
|
||||
|
||||
auto* entity = EntityManager::Instance()->GetEntity(target);
|
||||
|
||||
if (entity == nullptr)
|
||||
{
|
||||
if (entity == nullptr) {
|
||||
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target);
|
||||
|
||||
return;
|
||||
@@ -63,8 +54,7 @@ void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch
|
||||
|
||||
auto* component = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (component == nullptr)
|
||||
{
|
||||
if (component == nullptr) {
|
||||
Game::logger->Log("BuffBehavior", "Invalid target, no destroyable component (%llu)!", target);
|
||||
|
||||
return;
|
||||
@@ -77,18 +67,15 @@ void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
}
|
||||
|
||||
void BuffBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext branch, LWOOBJID second)
|
||||
{
|
||||
void BuffBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext branch, LWOOBJID second) {
|
||||
UnCast(context, branch);
|
||||
}
|
||||
|
||||
void BuffBehavior::End(BehaviorContext* context, const BehaviorBranchContext branch, LWOOBJID second)
|
||||
{
|
||||
void BuffBehavior::End(BehaviorContext* context, const BehaviorBranchContext branch, LWOOBJID second) {
|
||||
UnCast(context, branch);
|
||||
}
|
||||
|
||||
void BuffBehavior::Load()
|
||||
{
|
||||
void BuffBehavior::Load() {
|
||||
this->m_health = GetInt("life");
|
||||
|
||||
this->m_armor = GetInt("armor");
|
||||
|
Reference in New Issue
Block a user