From a5aaa1b79269416f5da95ba007e1ab524be066ff Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sat, 9 Feb 2019 23:54:49 +1100 Subject: [PATCH] set target correctly on action objs --- src/common/Common.h | 2 +- src/world/Manager/ActionMgr.cpp | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/common/Common.h b/src/common/Common.h index ef3362ac..0c43f9e6 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -548,7 +548,7 @@ namespace Sapphire::Common Status = 32, PLDGauge = 41, RDMGaugeBoth = 74, -// RDMGaugeBlack = 75, // not right? +// RDMGaugeBlack = 75, // not right? DRGGauge3Eyes = 76, }; diff --git a/src/world/Manager/ActionMgr.cpp b/src/world/Manager/ActionMgr.cpp index 8de3a03e..c9cccb35 100644 --- a/src/world/Manager/ActionMgr.cpp +++ b/src/world/Manager/ActionMgr.cpp @@ -2,7 +2,6 @@ #include "Action/Action.h" #include "Script/ScriptMgr.h" - #include "Actor/Player.h" #include @@ -36,6 +35,17 @@ void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& play auto action = Action::make_Action( player.getAsPlayer(), actionId, actionData, framework() ); + if( targetId != player.getId() ) + { + auto target = player.lookupTargetById( targetId ); + if( auto chara = target->getAsChara() ) + action->setTargetChara( chara ); + } + else + { + // maybe an eobj? wat do? + } + bootstrapAction( player, action, *actionData ); } @@ -112,10 +122,11 @@ bool World::Manager::ActionMgr::canPlayerUseAction( Entity::Player& player, return false; } - // todo: min tp - // todo: min mp - - // todo: script callback for action conditionals? + auto& actionCost = currentAction.getCostArray(); + for( uint8_t i = 0; i < actionCost.size(); ++i ) + { + // todo: validate costs/conditionals here + } return true; }