EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FxProc Class Reference

#include "EffectsProcessor.h"

Inheritance diagram for FxProc:
Collaboration diagram for FxProc:

Public Member Functions

 FxProc ()
 
 ~FxProc ()
 
- Public Member Functions inherited from Singleton< FxProc >
 Singleton ()
 Primary constructor. More...
 

EffectsProcessor.cpp

This file is for decoding and processing the effect data Copyright 2017 EVEmu Team

: Allan

Date
: 24 January 2017 : 19 June 2019 (revised namespaces)
void ApplyEffects (InventoryItem *pItem, Character *pChar, ShipItem *pShip, bool update=false)
 
void ParseExpression (InventoryItem *pItem, Expression expression, fxData &data, GenericModule *pMod=nullptr)
 
int8 GetEnvironmentEnum (const std::string &domain)
 
int8 GetAssociationEnum (const std::string &association)
 
const char * GetSourceName (int8 id)
 
const char * GetMathMethodName (int8 id)
 
const char * GetTargLocName (int8 id)
 
const char * GetStateName (int8 id)
 
EvilNumber CalculateAttributeValue (EvilNumber val1, EvilNumber val2, int8 method)
 
void DecodeEffects (const uint16 fxID)
 
void EvaluateExpression (const uint16 expID, const char *type)
 
void DecodeExpression (Expression expression, fxData &data)
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< FxProc >
static FxProcget ()
 
- Static Protected Attributes inherited from Singleton< FxProc >
static std::shared_ptr< FxProcmInstance
 

Detailed Description

Definition at line 22 of file EffectsProcessor.h.

Constructor & Destructor Documentation

FxProc::FxProc ( )
inline

Definition at line 26 of file EffectsProcessor.h.

26 { /* do nothing here */ }
FxProc::~FxProc ( )
inline

Definition at line 27 of file EffectsProcessor.h.

27 { /* do nothing here */ }

Member Function Documentation

void FxProc::ApplyEffects ( InventoryItem pItem,
Character pChar,
ShipItem pShip,
bool  update = false 
)
Todo:
this needs more work
                @note  these are processed and applied in fleet code
                case Target::Ship:  {

....ship of member to apply leader's skill bonuses to itemRefVec.push_back(static_cast<InventoryItemRef>(pShip)); } break; case Target::Char: { ....our character itemRefVec.push_back(static_cast<InventoryItemRef>(pChar)); } break;

Definition at line 273 of file EffectsProcessor.cpp.

References _log, Profile::applyFX, FX::Target::Area, CalculateAttributeValue(), FX::Target::Char, EVEDB::invCategories::Charge, InventoryItem::ClearModifiers(), EvilOne, EvilZero, flagNone, FX::Source::Gang, EvilNumber::get_float(), ModuleManager::GetLoadedChargeOnModule(), ModuleManager::GetLoadedCharges(), GetMathMethodName(), ModuleManager::GetModule(), ModuleManager::GetModuleListByReqSkill(), ModuleManager::GetModuleListOfRefsAsc(), ShipItem::GetModuleManager(), Character::GetSkillsList(), GetSourceName(), ShipItem::GetTargetRef(), GetTargLocName(), GetTimeUSeconds(), Inv::Update::Group, InventoryItem::HasReqSkill(), EVEDB::invTypes::Invalid, Calendar::Flag::Invalid, item(), InventoryItem::m_modifiers, Corp::RoleLoc::Other, Inv::Update::Owner, FX::Math::PostDiv, FX::Math::PostMul, FX::Target::PowerCore, FX::Math::PreDiv, FX::Math::PreMul, sConfig, FX::Source::Self, Scanning::Group::Ship, EVEDB::invCategories::Skill, skillID(), sProfiler, FX::Source::Target, and EvE::traceStack().

274 {
275  using namespace FX;
276  //uint8 action = Action::dgmActInvalid;
277  for (auto cur : pItem->m_modifiers) { // k,v of assoc, data<math, src, targLoc, targAttr, srcAttr, grpID, typeID>
278  double profileStartTime = GetTimeUSeconds();
279  /*
280  if (cur.second.action) {
281  action = cur.second.action;
282  continue;
283  } */
284  //InventoryItemRef srcItemRef = cur.second.srcRef;
285 
286  std::vector<InventoryItemRef> itemRefVec;
287  // affected target depends on source. get source and target(s) here.
288  switch (cur.second.fxSrc) {
289  case Source::Group: { // not a source per se, but defines effect's target selection requirements
290  // this is to apply modifiers to ship's modules of groupID defined in 'grpID'
291  std::vector<InventoryItemRef> moduleList;
292  pShip->GetModuleManager()->GetModuleListOfRefsAsc(moduleList);
293  for (auto mod : moduleList)
294  if (mod->groupID() == cur.second.grpID)
295  itemRefVec.push_back(mod);
296  } break;
297  case Source::Skill: { // source of this effect is skill, implant, or booster
298  if (cur.second.typeID == EVEDB::invTypes::Invalid) { //invalid
299  _log(EFFECTS__WARNING, "FxProc::ApplyEffects(): Source::Skill - typeID is invalid");
300  continue; // make error here
301  }
302  switch (cur.second.targLoc) {
303  // apply the modifier to ....
304  case Target::Self: {
305  // ....item itself
306  itemRefVec.push_back(cur.second.srcRef);
307  } break;
308  case Target::Ship: {
309  if (cur.second.typeID) {
310  // .....ship's modules that require skillID defined in "typeID"
311  pShip->GetModuleManager()->GetModuleListByReqSkill(cur.second.typeID, itemRefVec);
312  } else {
313  // ..... ship that require skill in 'srcRef'
314  if (pShip->HasReqSkill(cur.second.srcRef->typeID()))
315  itemRefVec.push_back(static_cast<InventoryItemRef>(pShip));
316  }
317  } break;
318  case Target::Char: {
319  if (cur.second.typeID) {
320  // ....char skills that require skill in 'srcRef' or defined in 'typeID'
321  uint16 skillID = cur.second.typeID;
322  std::vector<InventoryItemRef> allSkills;
323  pChar->GetSkillsList(allSkills);
324  for (auto curSkill : allSkills)
325  if (curSkill->HasReqSkill(skillID))
326  itemRefVec.push_back(curSkill);
327  } else {
328  // ....character itself
329  itemRefVec.push_back(static_cast<InventoryItemRef>(pChar));
330  }
331  } break;
332  case Target::Other: {
333  // ....ship from 'core' pilot skills (electronics, mechanics, navigation, etc)
334  itemRefVec.push_back(static_cast<InventoryItemRef>(pShip));
335  } break;
336  case Target::Charge: {
337  // ....charges
338  // will need more testing to verify this.
339  std::map<EVEItemFlags, InventoryItemRef> charges;
340  pShip->GetModuleManager()->GetLoadedCharges(charges);
341  for (auto mod : charges)
342  if (mod.second->HasReqSkill(cur.second.typeID))
343  itemRefVec.push_back(mod.second);
344  } break;
345  case Target::Target: {
346  // ...current target (focused, volatile...removed on 'invalid target')
347  itemRefVec.push_back(pShip->GetTargetRef());
348  } break;
349  case Target::Invalid: { // null
350  _log(EFFECTS__WARNING, "FxProc::ApplyEffects(): Source::Skill target location invalid.");
351  continue;
352  } break;
353  case Target::Area: //not used
354  case Target::PowerCore: //defined but not used
355  default: {
356  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): Source::Skill target undefined - %s.", GetTargLocName(cur.second.targLoc));
357  } break;
358  }
359  } break;
360  case Source::Self: { // source is module or charge
361  // apply the modifier to ....
362  switch (cur.second.targLoc) {
363  case Target::Char: {
364  // ....character itself
365  itemRefVec.push_back(static_cast<InventoryItemRef>(pChar));
366  } break;
367  case Target::Ship: {
368  // ....the ship the calling item is located in/on
369  itemRefVec.push_back(static_cast<InventoryItemRef>(pShip));
370  } break;
371  case Target::Self: {
372  // ....item itself
373  itemRefVec.push_back(cur.second.srcRef);
374  } break;
375  case Target::Charge: {
376  // ....charge on src item (from module)
377  if (cur.second.srcRef->flag() == flagNone) {
378  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): SourceItem.flag is flagNone but need actual flag to acquire module.");
379  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): Item Data for %s(%u) - src(%s:%u) targ(%s:%u) .", \
380  cur.second.srcRef->name(), cur.second.srcRef->itemID(), GetSourceName(cur.second.fxSrc), cur.second.srcAttr, \
381  GetTargLocName(cur.second.targLoc), cur.second.targAttr);
382  EvE::traceStack();
383  continue;
384  }
385  itemRefVec.push_back(pShip->GetModuleManager()->GetLoadedChargeOnModule(cur.second.srcRef->flag()));
386  } break;
387  case Target::Other: {
388  // ....module containing the src item (from charge)
389  if (cur.second.srcRef->flag() == flagNone) {
390  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): SourceItem.flag is flagNone but need actual flag to acquire module.");
391  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): Item Data for %s(%u) - src(%s:%u) targ(%s:%u) .", \
392  cur.second.srcRef->name(), cur.second.srcRef->itemID(), GetSourceName(cur.second.fxSrc), cur.second.srcAttr, \
393  GetTargLocName(cur.second.targLoc), cur.second.targAttr);
394  EvE::traceStack();
395  continue;
396  }
397  itemRefVec.push_back(pShip->GetModuleManager()->GetModule(cur.second.srcRef->flag())->GetSelf());
398  } break;
399  case Target::Target: {
400  // ...current target (focused, volatile...removed on 'invalid target')
401  itemRefVec.push_back(pShip->GetTargetRef());
402  } break;
403  case Target::Invalid: {
404  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): Source::Self target invalid.");
405  } break;
406  case Target::Area: // not used
407  case Target::PowerCore: //defined but not used
408  default: {
409  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): Source::Self target undefined - %s.", GetTargLocName(cur.second.targLoc));
410  } break;
411  }
412  } break;
414  case Source::Gang: { // source is a gang leader skill
415  switch (cur.second.targLoc) {
416  // apply the modifier to ....
417  case Target::Self: {
418  // ....item itself
419  itemRefVec.push_back(cur.second.srcRef);
420  } break;
431  default: {
432  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): Source::Gang target undefined - %s.", GetTargLocName(cur.second.targLoc));
433  } break;
434  }
435  } break;
436  case Source::Ship: { // source is a subsystem
437  ; // not sure how to do this on yet. t3 ships arent implemented (actually blocked)
438  _log(EFFECTS__DEBUG, "FxProc::ApplyEffects(): %s is ship source calling target %s.", cur.second.srcRef->name(), GetTargLocName(cur.second.targLoc));
439  } break;
440  case Source::Invalid: {
441  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): source location invalid.");
442  continue;
443  } break;
444  // these are not used (not coded)
445  case Source::Target:
446  case Source::Owner: {
447  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): source location %s not coded.", GetSourceName(cur.second.fxSrc));
448  continue;
449  } break;
450  }
451 
452  if (itemRefVec.empty())
453  if ((cur.second.typeID == 0)
454  and (cur.second.grpID == 0)) {
455  // only concerned when typeID/grpID is 0. when either are populated, ship dont have that module. nbd
456  _log(EFFECTS__WARNING, "FxProc::ApplyEffects(%i): %s(%u): target item vector empty.", \
457  cur.first, cur.second.srcRef->name(), cur.second.srcRef->itemID());
458  _log(EFFECTS__WARNING, "Data: src(%s:%u), targ(%s:%u), grpID:%u, typeID:%u, math:%s.", \
459  GetSourceName(cur.second.fxSrc), cur.second.srcAttr, \
460  GetTargLocName(cur.second.targLoc), cur.second.targAttr, \
461  cur.second.grpID, cur.second.typeID, GetMathMethodName(cur.first));
462  continue;
463  }
464 
465  // get srcAttr
466  EvilNumber srcValue = cur.second.srcRef->GetAttribute(cur.second.srcAttr);
467  /*
468  // check for inf/nan and then reset? this will fuck up all previous fx processing on this value.
469  if (srcValue.isNaN() or srcValue.isInf()) {
470  srcValue = cur.second.srcRef->GetDefaultAttribute(cur.second.srcAttr);
471  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): srcValue isInf or isNaN. Data: %s(%u) - src(%s:%u) set to %.3f.", \
472  cur.second.srcRef->name(), cur.second.srcRef->itemID(), GetSourceName(cur.second.fxSrc), cur.second.srcAttr, srcValue.get_float());
473  } */
474 
475  // set target attr to modified value
476  EvilNumber targValue(EvilZero);
477  int8 opID(cur.first);
478  for (auto item : itemRefVec) {
479  if (item.get() == nullptr) // still occasional nulls in the vector (segfaults)
480  continue;
481  // get targAttr
482  targValue = item->GetAttribute(cur.second.targAttr);
483  // check for inf/nan and then reset? this will fuck up all previous fx processing on this value.
484  /*
485  if (targValue.isNaN() or targValue.isInf()) {
486  targValue = item->GetDefaultAttribute(cur.second.targAttr);
487  _log(EFFECTS__ERROR, "FxProc::ApplyEffects(): targValue isInf or isNaN. Data: %s(%u) - src(%s:%u) %.3f <%s> targ(%s:%u) set targ to %.3f.", \
488  cur.second.srcRef->name(), cur.second.srcRef->itemID(), GetSourceName(cur.second.fxSrc), cur.second.srcAttr, srcValue.get_float(), \
489  GetMathMethodName(opID), GetTargLocName(cur.second.targLoc), cur.second.targAttr, targValue.get_float());
490  } */
491 
492  switch (opID) {
493  case Math::PreMul:
494  case Math::PostMul:
495  case Math::PreDiv:
496  case Math::PostDiv: {
497  if (targValue == EvilZero)
498  targValue = EvilOne;
499  } break;
500  }
501 
502  // send data to calculator
503  EvilNumber newValue = CalculateAttributeValue(targValue, srcValue, opID);
504  // set new calculated value for target attribute
505  _log(EFFECTS__MESSAGE, "FxProc::ApplyEffects(%i): %s(%u) - src(%s:%u)=%.3f <%s> targ(%s:%u) set targ from %.3f to %.3f.", \
506  cur.first, cur.second.srcRef->name(), cur.second.srcRef->itemID(), \
507  GetSourceName(cur.second.fxSrc), cur.second.srcAttr, srcValue.get_float(), GetMathMethodName(opID), \
508  GetTargLocName(cur.second.targLoc), cur.second.targAttr, targValue.get_float(), newValue.get_float());
509 
510  // update is used to send attrib changes to client when changing module states while in space, but NOT for pilot login. (client acts funky)
511  item->SetAttribute(cur.second.targAttr, newValue, update);
512  }
513  if (sConfig.debug.UseProfiling)
514  sProfiler.AddTime(Profile::applyFX, GetTimeUSeconds() - profileStartTime);
515  }
516  /* not used
517  if (action)
518  sFxAct.DoAction(action, pShip->GetPilot()->GetShipSE()); // this MUST be called AFTER all active effects are applied, as it uses those modified values
519  */
520 
521  pItem->ClearModifiers();
522 }
#define sConfig
A macro for easier access to the singleton.
bool HasReqSkill(const uint16 skillID)
#define _log(type, fmt,...)
Definition: logsys.h:124
InventoryItemRef GetLoadedChargeOnModule(EVEItemFlags flag)
const char * GetTargLocName(int8 id)
ModuleManager * GetModuleManager()
Definition: Ship.h:80
InventoryItemRef GetTargetRef()
Definition: Ship.h:152
#define sProfiler
Definition: dbcore.cpp:39
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
void GetLoadedCharges(std::map< EVEItemFlags, InventoryItemRef > &charges)
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
signed __int8 int8
Definition: eve-compat.h:45
EvilNumber EvilZero
Definition: EvilNumber.cpp:32
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()()() itemID() itemID Fits selected item to active ship() skillID(level)-gives skillID to specified level." ) COMMAND( online
void GetModuleListOfRefsAsc(std::vector< InventoryItemRef > &modVec)
const char * GetMathMethodName(int8 id)
double GetTimeUSeconds()
Definition: utils_time.cpp:116
GenericModule * GetModule(EVEItemFlags flag)
const char * GetSourceName(int8 id)
std::multimap< int8, fxData > m_modifiers
Definition: EffectsData.h:84
EvilNumber CalculateAttributeValue(EvilNumber val1, EvilNumber val2, int8 method)
void GetModuleListByReqSkill(uint16 skillID, std::vector< InventoryItemRef > &modVec)
void GetSkillsList(std::vector< InventoryItemRef > &skills) const
Definition: Character.cpp:534
void traceStack(void)
Definition: misc.cpp:169
EvilNumber EvilOne
Definition: EvilNumber.cpp:34
float get_float()
Definition: EvilNumber.cpp:184
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

EvilNumber FxProc::CalculateAttributeValue ( EvilNumber  val1,
EvilNumber  val2,
int8  method 
)

Definition at line 524 of file EffectsProcessor.cpp.

References _log, EvilZero, FX::Math::Invalid, FX::Math::ModAdd, FX::Math::ModSub, FX::Math::PostAssignment, FX::Math::PostDiv, FX::Math::PostMul, FX::Math::PostPercent, FX::Math::PreAssignment, FX::Math::PreDiv, FX::Math::PreMul, FX::Math::RevPostPercent, and FX::Math::SkillCheck.

Referenced by ApplyEffects().

525 {
526  switch (method) {
530  return val2;
531  case FX::Math::PreMul:
532  case FX::Math::PostMul:
533  return val1 * val2;
534  case FX::Math::PreDiv:
535  case FX::Math::PostDiv:
536  if (val2 == EvilZero)
537  return val1;
538  return val1 / val2;
539  case FX::Math::ModAdd:
540  return val1 + val2;
541  case FX::Math::ModSub:
542  return val1 - val2;
544  if (val2 == -100)
545  return 0;
546  return val1 * (1.0f + (val2 / 100.0f));
548  if (val2 == -100)
549  return 0; //val1
550  return val1 / (1.0f + (val2 / 100.0f));
551  case FX::Math::Invalid:
552  _log(EFFECTS__WARNING, "FxProc::CalculateNewAttributeValue() - Invalid Association used");
553  return val1;
554  }
555  _log(EFFECTS__ERROR, "FxProc::CalculateNewAttributeValue() - Unknown Association used: %i", (int8)method);
556  return val1;
557 }
#define _log(type, fmt,...)
Definition: logsys.h:124
signed __int8 int8
Definition: eve-compat.h:45
EvilNumber EvilZero
Definition: EvilNumber.cpp:32

Here is the caller graph for this function:

void FxProc::DecodeEffects ( const uint16  fxID)

Definition at line 680 of file EffectsProcessor.cpp.

References EvaluateExpression(), sFxDataMgr, and sLog.

680  {
681  sLog.Green("DecodeEffects", "fxID %u", fxID);
682  EvaluateExpression(sFxDataMgr.GetEffect(fxID).preExpression, "Pre");
683  EvaluateExpression(sFxDataMgr.GetEffect(fxID).postExpression, "Post");
684 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
#define sFxDataMgr
void EvaluateExpression(const uint16 expID, const char *type)

Here is the call graph for this function:

void FxProc::DecodeExpression ( Expression  expression,
fxData data 
)
protected

Definition at line 703 of file EffectsProcessor.cpp.

References FX::Operands::AGRSM, FX::Operands::AGSM, FX::Operands::AIM, FX::Operands::ALGM, FX::Operands::ALM, FX::Operands::ALRSM, FX::Operands::AORSM, Expression::arg1, Expression::arg2, FX::Operands::ATT, FX::Operands::COMBINE, FX::Operands::DEFASSOCIATION, FX::Operands::DEFATTRIBUTE, FX::Operands::DEFBOOL, FX::Operands::DEFENVIDX, FX::Operands::DEFGROUP, FX::Operands::DEFINT, FX::Operands::DEFTYPEID, FX::Operands::EFF, Expression::expressionAttributeID, Expression::expressionGroupID, Expression::expressionTypeID, Expression::expressionValue, fxData::fxSrc, FX::Operands::GA, FX::Operands::GET, GetAssociationEnum(), GetEnvironmentEnum(), FX::Operands::GETTYPE, FX::Operands::GM, Inv::Update::Group, fxData::grpID, Acct::Type::IA, Calendar::Flag::Invalid, FX::Operands::LG, fxData::math, Expression::operandID, FX::Operands::RGGM, FX::Operands::RGORSM, FX::Operands::RGRSM, FX::Operands::RGSM, FX::Operands::RIM, FX::Operands::RLGM, FX::Operands::RLM, FX::Operands::RLRSM, FX::Operands::RORSM, FX::Operands::RSA, sFxDataMgr, fxData::srcAttr, fxData::srcRef, FX::Operands::SRLG, fxData::targAttr, fxData::targLoc, and fxData::typeID.

Referenced by EvaluateExpression().

704 {
705  using namespace FX;
706  switch(expression.operandID) {
707  // these return the given expressionValue
708  case Operands::DEFBOOL: //23 this evaulates to 'true' (Bool(1))
709  case Operands::DEFINT: { //27 this is used as 0,1,2,{raceID}
710  } break;
711  case Operands::DEFASSOCIATION: { //21
712  data.math = GetAssociationEnum(expression.expressionValue);
713  } break;
714  case Operands::DEFENVIDX: { //24
715  data.targLoc = GetEnvironmentEnum(expression.expressionValue);
716  } break;
717  // these provide the given expressionID (attrib/grp)
718  case Operands::DEFATTRIBUTE: { //22
719  if (expression.expressionAttributeID) {
720  if (data.targAttr) { // always processed first
721  data.srcAttr = expression.expressionAttributeID;
722  } else {
723  data.targAttr = expression.expressionAttributeID;
724  }
725  }
726  } break;
727  case Operands::DEFGROUP: { //26
728  data.fxSrc = Source::Group;
729  if (expression.expressionGroupID)
730  data.grpID = expression.expressionGroupID;
731  } break;
732  case Operands::DEFTYPEID: { //29
733  if (expression.expressionTypeID)
734  data.typeID = expression.expressionTypeID;
735  } break;
736  case Operands::GETTYPE: { //36, %(arg1)s.GetTypeID() --used by SRLG in AORSM
737  if (!data.typeID) // verify this isnt set yet (dont overwrite)
738  data.typeID = 0; //data.srcRef->typeID(); // get items on ship that require SkillItem in srcRef
739  } break;
740  // do as stated
741  case Operands::COMBINE: { //17, %(arg1)s); (%(arg2)s --executes two statements
742  DecodeExpression(sFxDataMgr.GetExpression(expression.arg1), data);
743  fxData data1 = fxData();
744  data1.action = Action::Invalid;
745  data1.srcRef = data.srcRef;
746  DecodeExpression(sFxDataMgr.GetExpression(expression.arg2), data1);
747  } break;
748  case Operands::LG: { //48, %(arg1)s.LocationGroup.%(arg2)s -- specify a group by grpID for a location' used by ALGM
749  DecodeExpression(sFxDataMgr.GetExpression(expression.arg1), data); //source
750  DecodeExpression(sFxDataMgr.GetExpression(expression.arg2), data); //groupID
751  } break;
752  case Operands::SRLG: { //49, %(arg1)s.SkillRequiredLocationGroup[%(arg2)s] -- specify a group by skillID for a location used by ALRSM and AORSM
753  DecodeExpression(sFxDataMgr.GetExpression(expression.arg1), data); //source
754  DecodeExpression(sFxDataMgr.GetExpression(expression.arg2), data); //skillID
755  } break;
756  case Operands::ATT: //12, %(arg1)s->%(arg2)s --(item:attribID)
757  case Operands::EFF: //31, %(arg2)s.%(arg1)s --define association type
758  case Operands::GA: //34, %(arg1)s.%(arg2)s --GetAttribute (no known uses)
759  case Operands::GET: //35, %(arg1)s.%(arg2)s() --used a lot. eg. Get(Ship:101) means 'get attribute 101 on ShipItem'
760  case Operands::IA: { //40, %(arg1)s --used by AGSM
761  DecodeExpression(sFxDataMgr.GetExpression(expression.arg1), data);
762  if (expression.arg2)
763  DecodeExpression(sFxDataMgr.GetExpression(expression.arg2), data);
764  } break;
765  // effect function calls.
766  // here is where we'll actually add the modifier data to the item's map
767  case Operands::AIM: //6, AddItemModifier(env,%(arg1)s, %(arg2)s)
768  case Operands::ALGM: //7, (%(arg1)s).AddLocationGroupModifier (%(arg2)s)
769  case Operands::ALM: //8, (%(arg1)s).AddLocationModifier (%(arg2)s)
770  case Operands::ALRSM: //9, (%(arg1)s).AddLocationRequiredSkillModifier(%(arg2)s)
771  case Operands::AORSM: //11, (%(arg1)s).AddOwnerRequiredSkillModifier(%(arg2)s)
772  case Operands::AGRSM: //5, [%(arg1)s].AGRSM(%(arg2)s) --AddGangRequiredSkillModifier
773  case Operands::AGSM: //3, [%(arg1)s].AGSM(%(arg2)s) --AddGangShipModifier
774  case Operands::GM: //37, %(arg1)s.GetModule(%(arg2)s) --used by subsystems as (GetModule(Ship:201):55)
775  case Operands::RSA: //64, %(arg1)s.%(arg2)s -- used by AGRSM
776  case Operands::RIM: //58, (%(arg1)s).RemoveItemModifier (%(arg2)s)
777  case Operands::RGGM: //54, [%(arg1)s].RemoveGangGroupModifier(%(arg2)s)
778  case Operands::RGSM: //55, [%(arg1)s].RemoveGangShipModifier(%(arg2)s)
779  case Operands::RGORSM: //56, [%(arg1)s].RemoveGangOwnerRequiredSkillModifier(%(arg2)s)
780  case Operands::RGRSM: //57, [%(arg1)s].RemoveGangRequiredSkillModifier(%(arg2)s)
781  case Operands::RLGM: //59, (%(arg1)s).RemoveLocationGroupModifier (%(arg2)s)
782  case Operands::RLM: //60, (%(arg1)s).RemoveLocationModifier (%(arg2)s)
783  case Operands::RLRSM: //61, (%(arg1)s).RemoveLocationRequiredSkillModifier(%(arg2)s)
784  case Operands::RORSM: { //62, (%(arg1)s).RemoveOwnerRequiredSkillModifier(%(arg2)s)
785  DecodeExpression(sFxDataMgr.GetExpression(expression.arg1), data);
786  DecodeExpression(sFxDataMgr.GetExpression(expression.arg2), data);
787  } break;
788  }
789 
790 }
void DecodeExpression(Expression expression, fxData &data)
int8 GetAssociationEnum(const std::string &association)
int8 operandID
Definition: EffectsData.h:44
uint16 expressionTypeID
Definition: EffectsData.h:48
InventoryItemRef srcRef
Definition: EffectsData.h:78
uint16 arg2
Definition: EffectsData.h:47
#define sFxDataMgr
int8 math
Definition: EffectsData.h:70
Definition: EffectsData.h:84
uint16 typeID
Definition: EffectsData.h:77
uint16 arg1
Definition: EffectsData.h:46
uint16 expressionAttributeID
Definition: EffectsData.h:50
int8 fxSrc
Definition: EffectsData.h:71
int8 GetEnvironmentEnum(const std::string &domain)
uint16 expressionGroupID
Definition: EffectsData.h:49
std::string expressionValue
Definition: EffectsData.h:51
uint16 grpID
Definition: EffectsData.h:76
uint16 targAttr
Definition: EffectsData.h:74
int8 targLoc
Definition: EffectsData.h:72
uint16 srcAttr
Definition: EffectsData.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

void FxProc::EvaluateExpression ( const uint16  expID,
const char *  type 
)
protected

Definition at line 686 of file EffectsProcessor.cpp.

References DecodeExpression(), Expression::description, Expression::expressionName, fxData::fxSrc, GetMathMethodName(), GetSourceName(), GetTargLocName(), if(), fxData::math, sFxDataMgr, sLog, fxData::srcAttr, fxData::targAttr, and fxData::targLoc.

Referenced by DecodeEffects().

687 {
688  fxData data = fxData();
689  Expression expression = sFxDataMgr.GetExpression(expID);
690  DecodeExpression(expression, data);
691  std::string name(expression.description);
692  if (name.empty())
693  name = expression.expressionName;
694  if (name.empty())
695  name = "No Name";
696  sLog.Green("EvaluateExpression", "expID %u: %s", expID, name.c_str());
697  sLog.Cyan("EvaluateExpression", " %s - <%s> src(%s:%u) targ(%s:%u)", \
698  type, GetMathMethodName(data.math), \
699  GetSourceName(data.fxSrc), data.srcAttr, \
700  GetTargLocName(data.targLoc), data.targAttr);
701 }
void DecodeExpression(Expression expression, fxData &data)
const char * GetTargLocName(int8 id)
std::string expressionName
Definition: EffectsData.h:53
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * GetMathMethodName(int8 id)
const char * GetSourceName(int8 id)
#define sFxDataMgr
int8 math
Definition: EffectsData.h:70
if(sConfig.world.saveOnMove)
int8 fxSrc
Definition: EffectsData.h:71
uint16 targAttr
Definition: EffectsData.h:74
std::string description
Definition: EffectsData.h:52
int8 targLoc
Definition: EffectsData.h:72
uint16 srcAttr
Definition: EffectsData.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

int8 FxProc::GetAssociationEnum ( const std::string &  association)

Definition at line 559 of file EffectsProcessor.cpp.

References FX::Math::AddRate, FX::Math::Invalid, FX::Math::ModAdd, FX::Math::ModSub, FX::Math::PostAssignment, FX::Math::PostDiv, FX::Math::PostMul, FX::Math::PostPercent, FX::Math::PreAssignment, FX::Math::PreDiv, FX::Math::PreMul, FX::Math::SkillCheck, and FX::Math::SubRate.

Referenced by DecodeExpression(), and ParseExpression().

560 { // opID 21
561  if (association == "PreAssignment") {
563  } else if (association == "PreDiv") {
564  return FX::Math::PreDiv;
565  } else if (association == "PreMul") {
566  return FX::Math::PreMul;
567  } else if (association == "ModAdd") {
568  return FX::Math::ModAdd;
569  } else if (association == "ModSub") {
570  return FX::Math::ModSub;
571  } else if (association == "PostPercent") {
572  return FX::Math::PostPercent;
573  } else if (association == "PostMul") {
574  return FX::Math::PostMul;
575  } else if (association == "PostDiv") {
576  return FX::Math::PostDiv;
577  } else if (association == "PostAssignment") {
579  } else if (association == "SkillCheck") {
580  return FX::Math::SkillCheck;
581  } else if (association == "AddRate") {
582  return FX::Math::AddRate;
583  } else if (association == "SubRate") {
584  return FX::Math::SubRate;
585  } else {
586  return FX::Math::Invalid; //throw std::bad_typeid();
587  }
588 }

Here is the caller graph for this function:

int8 FxProc::GetEnvironmentEnum ( const std::string &  domain)

Definition at line 590 of file EffectsProcessor.cpp.

References FX::Target::Area, FX::Target::Char, FX::Target::Charge, FX::Target::Invalid, FX::Target::Other, FX::Target::Self, FX::Target::Ship, and FX::Target::Target.

Referenced by DecodeExpression(), and ParseExpression().

591 { // opID 24
592  if (env == "Self") {
593  return FX::Target::Self;
594  } else if (env == "Char") {
595  return FX::Target::Char;
596  } else if (env == "Ship") {
597  return FX::Target::Ship;
598  } else if (env == "Target") {
599  return FX::Target::Target;
600  } else if (env == "Area") {
601  return FX::Target::Area;
602  } else if (env == "Other") {
603  return FX::Target::Other;
604  } else if (env == "Charge") {
605  return FX::Target::Charge;
606  } else {
607  return FX::Target::Invalid; //throw std::bad_typeid();
608  }
609 }

Here is the caller graph for this function:

const char * FxProc::GetMathMethodName ( int8  id)

Definition at line 611 of file EffectsProcessor.cpp.

References FX::Math::AddRate, FX::Math::Invalid, FX::Math::ModAdd, FX::Math::ModSub, FX::Math::PostAssignment, FX::Math::PostDiv, FX::Math::PostMul, FX::Math::PostPercent, FX::Math::PreAssignment, FX::Math::PreDiv, FX::Math::PreMul, FX::Math::RevPostPercent, FX::Math::SkillCheck, and FX::Math::SubRate.

Referenced by ApplyEffects(), and EvaluateExpression().

612 {
613  switch (id) {
614  case FX::Math::PreAssignment: return "PreAssignment";
615  case FX::Math::PreDiv: return "PreDiv";
616  case FX::Math::PreMul: return "PreMul";
617  case FX::Math::ModAdd: return "ModAdd";
618  case FX::Math::ModSub: return "ModSub";
619  case FX::Math::PostPercent: return "PostPercent";
620  case FX::Math::RevPostPercent: return "RevPostPercent";
621  case FX::Math::PostMul: return "PostMul";
622  case FX::Math::PostDiv: return "PostDiv";
623  case FX::Math::PostAssignment: return "PostAssignment";
624  case FX::Math::SkillCheck: return "SkillCheck";
625  case FX::Math::AddRate: return "AddRate";
626  case FX::Math::SubRate: return "SubRate";
627  case FX::Math::Invalid:
628  default: return "Invalid";
629  }
630 }

Here is the caller graph for this function:

const char * FxProc::GetSourceName ( int8  id)

Definition at line 632 of file EffectsProcessor.cpp.

References FX::Source::Gang, FX::Source::Group, FX::Source::Invalid, FX::Source::Owner, FX::Source::Self, FX::Source::Ship, FX::Source::Skill, and FX::Source::Target.

Referenced by ApplyEffects(), and EvaluateExpression().

633 {
634  switch (id) {
635  case FX::Source::Self: return "Self";
636  case FX::Source::Skill: return "Skill";
637  case FX::Source::Ship: return "Ship";
638  case FX::Source::Owner: return "Owner";
639  case FX::Source::Gang: return "Gang";
640  case FX::Source::Group: return "Group";
641  case FX::Source::Target: return "Target";
642  case FX::Source::Invalid:
643  default: return "Invalid";
644  }
645 }

Here is the caller graph for this function:

const char * FxProc::GetStateName ( int8  id)

Definition at line 662 of file EffectsProcessor.cpp.

References FX::State::Active, FX::State::Area, FX::State::Dungeon, FX::State::Invalid, FX::State::Online, FX::State::Overloaded, FX::State::Passive, FX::State::System, and FX::State::Target.

663 {
664  switch (id) {
665  case FX::State::Passive: return "Passive";
666  case FX::State::Active: return "Active";
667  case FX::State::Target: return "Target";
668  case FX::State::Area: return "Area";
669  case FX::State::Online: return "Online";
670  case FX::State::Overloaded: return "Overload";
671  case FX::State::Dungeon: return "Dungeon";
672  case FX::State::System: return "System";
673  case FX::State::Invalid:
674  default: return "Invalid";
675  }
676 
677 }
const char * FxProc::GetTargLocName ( int8  id)

Definition at line 647 of file EffectsProcessor.cpp.

References FX::Target::Area, FX::Target::Char, FX::Target::Charge, FX::Target::Invalid, FX::Target::Other, FX::Target::Self, FX::Target::Ship, and FX::Target::Target.

Referenced by ApplyEffects(), and EvaluateExpression().

648 {
649  switch (id) {
650  case FX::Target::Self: return "Self";
651  case FX::Target::Char: return "Char";
652  case FX::Target::Ship: return "Ship";
653  case FX::Target::Target: return "Target";
654  case FX::Target::Area: return "Area";
655  case FX::Target::Other: return "Other";
656  case FX::Target::Charge: return "Charge";
657  case FX::Target::Invalid:
658  default: return "Invalid";
659  }
660 }

Here is the caller graph for this function:

void FxProc::ParseExpression ( InventoryItem pItem,
Expression  expression,
fxData data,
GenericModule pMod = nullptr 
)
Todo:
if this is used, change the Put* methods to use ModuleItem int8 value = atoi(expression.expressionValue.c_str()); if (module) { if (value == 0) data.srcRef->PutOffline(); if (value == 1) data.srcRef->PutOnline(isRig); return; // we are done at this point }

Definition at line 30 of file EffectsProcessor.cpp.

References _log, InventoryItem::AddModifier(), FX::Operands::AGRSM, FX::Operands::AGSM, FX::Operands::AIM, FX::Operands::ALGM, FX::Operands::ALM, FX::Operands::ALRSM, FX::Operands::AORSM, Expression::arg1, Expression::arg2, FX::Operands::ATT, InventoryItem::categoryID(), FX::Operands::COMBINE, FX::Operands::DEFASSOCIATION, FX::Operands::DEFATTRIBUTE, FX::Operands::DEFBOOL, FX::Operands::DEFENVIDX, FX::Operands::DEFGROUP, FX::Operands::DEFINT, FX::Operands::DEFTYPEID, FX::Operands::EFF, Expression::expressionAttributeID, Expression::expressionGroupID, Expression::expressionName, Expression::expressionTypeID, Expression::expressionValue, fxData::fxSrc, FX::Operands::GA, FX::Operands::GET, GetAssociationEnum(), GetEnvironmentEnum(), GetTimeUSeconds(), FX::Operands::GETTYPE, FX::Operands::GM, Inv::Update::Group, fxData::grpID, Acct::Type::IA, EVEDB::invCategories::Implant, Calendar::Flag::Invalid, FX::Operands::LG, fxData::math, Expression::operandID, Profile::parseFX, InventoryItem::RemoveModifier(), FX::Operands::RGGM, FX::Operands::RGORSM, FX::Operands::RGRSM, FX::Operands::RGSM, FX::Operands::RIM, FX::Operands::RLGM, FX::Operands::RLM, FX::Operands::RLRSM, FX::Operands::RORSM, FX::Operands::RSA, sConfig, sFxDataMgr, EVEDB::invCategories::Skill, sProfiler, fxData::srcAttr, fxData::srcRef, FX::Operands::SRLG, fxData::targAttr, fxData::targLoc, fxData::typeID, and InventoryItem::typeID().

31 {
32  double profileStartTime = GetTimeUSeconds();
33 
34  bool skill = false;
35  switch (data.srcRef->categoryID()) {
37  case EVEDB::invCategories::Implant: { // cat::implant also covers grp::booster
38  skill = true;
39  } break;
40  }
41 
42  using namespace FX;
43  switch(expression.operandID) {
44  // these return the given expressionValue
45  case Operands::DEFBOOL: //23 this evaulates to 'true' (Bool(1))
46  case Operands::DEFINT: { //27 this is used as 0,1,2,{raceID}
47  // seems to be called only to online/offline modules (and screws up my Online/Offline code...)
57  } break;
58  case Operands::DEFASSOCIATION: { //21
59  data.math = GetAssociationEnum(expression.expressionValue);
60  /*
61  if (data.math > Math::MaxMathMethod) {
62  Operand operand = sFxDataMgr.GetOperand(expression.operandID);
63  _log(EFFECTS__ERROR, "FxProc::ParseExpression(): out of range mathOp: %s(%i) for operand %u (%s).", \
64  GetMathMethodName(data.math), data.math, expression.operandID, operand.operandKey.c_str());
65  } */
66  } break;
67  case Operands::DEFENVIDX: { //24
68  data.targLoc = GetEnvironmentEnum(expression.expressionValue);
69  /*
70  if (data.targLoc > Target::MaxTargLocation) {
71  Operand operand = sFxDataMgr.GetOperand(expression.operandID);
72  _log(EFFECTS__ERROR, "FxProc::ParseExpression(): out of range targLoc: %i for operand %u (%s).", \
73  data.targAttr, expression.operandID, operand.operandKey.c_str());
74  } */
75  } break;
76  // these provide the given expressionID (attrib/grp)
77  case Operands::DEFATTRIBUTE: { //22
78  if (expression.expressionAttributeID) {
79  if (data.targAttr) { // always processed first
80  data.srcAttr = expression.expressionAttributeID;
81  } else {
82  data.targAttr = expression.expressionAttributeID;
83  }
84  } else {
85  _log(EFFECTS__ERROR, "FxProc::ParseExpression(): opATTR called with no expressionAttributeID defined");
86  }
87  } break;
88  case Operands::DEFGROUP: { //26
89  data.fxSrc = Source::Group;
90  if (expression.expressionGroupID) {
91  data.grpID = expression.expressionGroupID;
92  } else if (expression.expressionValue != "") {
93  ; // will have to figure out how to do this one.
94  _log(EFFECTS__WARNING, "FxProc::ParseExpression(): opGROUP using expressionValue %s called by %s",\
95  expression.expressionValue.c_str(), expression.expressionName.c_str());
96  } else {
97  _log(EFFECTS__ERROR, "FxProc::ParseExpression(): opGROUP called with no expressionGroupID or expressionValue defined");
98  }
99  } break;
100  case Operands::DEFTYPEID: { //29
101  if (skill)
102  data.fxSrc = Source::Skill;
103  if (expression.expressionTypeID) {
104  data.typeID = expression.expressionTypeID;
105  } else if (expression.expressionValue != "") {
106  ; // will have to figure out how to do this one.
107  _log(EFFECTS__WARNING, "FxProc::ParseExpression(): opTYPEID using expressionValue %s", expression.expressionValue.c_str());
108  } else {
109  _log(EFFECTS__ERROR, "FxProc::ParseExpression(): opTYPEID called with no expressionTypeID or expressionValue defined");
110  }
111  } break;
112  case Operands::GETTYPE: { //36, %(arg1)s.GetTypeID() --used by SRLG in AORSM
113  if (!data.typeID)
114  data.typeID = data.srcRef->typeID(); // get items on ship that require SkillItem in srcRef
115  } break;
116  // do as stated
117  case Operands::GM: //37, %(arg1)s.GetModule(%(arg2)s) --used by subsystems as (GetModule(Ship:201):55)
118  case Operands::RSA: { //64, %(arg1)s.%(arg2)s -- used by AGRSM
119  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data, pMod);
120  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data, pMod);
121  } break;
122  case Operands::COMBINE: { //17, %(arg1)s); (%(arg2)s --executes two statements
123  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data, pMod);
124  fxData data1 = fxData();
125  data1.action = Action::Invalid;
126  data1.srcRef = data.srcRef;
127  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data1, pMod);
128  } break;
129  case Operands::LG: { //48, %(arg1)s.LocationGroup.%(arg2)s -- specify a group by grpID for a location' used by ALGM
130  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data, pMod); //source
131  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data, pMod); //groupID
132  } break;
133  case Operands::SRLG: { //49, %(arg1)s.SkillRequiredLocationGroup[%(arg2)s] -- specify a group by skillID for a location used by ALRSM and AORSM
134  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data, pMod); //source
135  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data, pMod); //skillID
136  if (!data.fxSrc) { // fxSrc = Self in this case. update to remove this hack?
137  //_log(EFFECTS__TRACE, "FxProc::ParseExpression(): SRLG: setting fxSrc from %s to Skill for %s. self: %s", \
138  GetSourceName(data.fxSrc), data.srcRef->name(), (pItem == data.srcRef.get() ? "true" : "false"));
139  data.fxSrc = Source::Skill;
140  }
141  } break;
142  case Operands::ATT: //12, %(arg1)s->%(arg2)s --(item:attribID)
143  case Operands::EFF: //31, %(arg2)s.%(arg1)s --define association type
144  case Operands::GA: //34, %(arg1)s.%(arg2)s --GetAttribute (no known uses)
145  case Operands::GET: //35, %(arg1)s.%(arg2)s() --used a lot. eg. Get(Ship:101) means 'get attribute 101 on ShipItem'
146  case Operands::IA: { //40, %(arg1)s --used by AGSM
147  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data);
148  if (expression.arg2)
149  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data);
150  } break;
151  // effect function calls.
152  // here is where we'll actually add the modifier data to the item's map
153  case Operands::AIM: //6, AddItemModifier(env,%(arg1)s, %(arg2)s)
154  case Operands::AGRSM: //5, [%(arg1)s].AGRSM(%(arg2)s) --AddGangRequiredSkillModifier
155  case Operands::AGSM: { //3, [%(arg1)s].AGSM(%(arg2)s) --AddGangShipModifier
156  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data, pMod);
157  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data, pMod);
158  pItem->AddModifier(data);
159  } break;
160  case Operands::ALGM: //7, (%(arg1)s).AddLocationGroupModifier (%(arg2)s)
161  case Operands::ALM: //8, (%(arg1)s).AddLocationModifier (%(arg2)s)
162  case Operands::ALRSM: //9, (%(arg1)s).AddLocationRequiredSkillModifier(%(arg2)s)
163  case Operands::AORSM: { //11, (%(arg1)s).AddOwnerRequiredSkillModifier(%(arg2)s)
164  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data, pMod);
165  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data, pMod);
166  if ((skill) and (!data.fxSrc)) // fxSrc = Self in this case. update to remove this hack?
167  data.fxSrc = Source::Skill;
168  pItem->AddModifier(data);
169  } break;
170  // remove modifier calls only partially enabled for modules and charges.
171  // will implement for implants and boosters when those systems are written.
172  case Operands::RIM: //58, (%(arg1)s).RemoveItemModifier (%(arg2)s)
173  case Operands::RGGM: //54, [%(arg1)s].RemoveGangGroupModifier(%(arg2)s)
174  case Operands::RGSM: //55, [%(arg1)s].RemoveGangShipModifier(%(arg2)s)
175  case Operands::RGORSM: //56, [%(arg1)s].RemoveGangOwnerRequiredSkillModifier(%(arg2)s)
176  case Operands::RGRSM: { //57, [%(arg1)s].RemoveGangRequiredSkillModifier(%(arg2)s)
177  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data, pMod);
178  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data, pMod);
179  pItem->RemoveModifier(data);
180  } break;
181  case Operands::RLGM: //59, (%(arg1)s).RemoveLocationGroupModifier (%(arg2)s)
182  case Operands::RLM: //60, (%(arg1)s).RemoveLocationModifier (%(arg2)s)
183  case Operands::RLRSM: //61, (%(arg1)s).RemoveLocationRequiredSkillModifier(%(arg2)s)
184  case Operands::RORSM: { //62, (%(arg1)s).RemoveOwnerRequiredSkillModifier(%(arg2)s)
185  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), data, pMod);
186  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), data, pMod);
187  if ((skill) and (!data.fxSrc)) // fxSrc = Self in this case. update to remove this hack?
188  data.fxSrc = Source::Skill;
189  pItem->RemoveModifier(data);
190  } break;
191  /*
192  // next 3 not used here, as they are only used by effect 16 (Online), which is covered in GenericModule class.
193  case Operands::OR: //'%(arg1)s OR %(arg2)s' -- used with 'if' in arg2 as 'y'. ((if x then y) OR z) (used as "else" or elif)
194  case Operands::AND: //'(%(arg1)s) AND (%(arg2)s)' -- used with 'if' in arg1 as 'x'. (if (x AND y) then ....)
195  case Operands::IF: { //'If(%(arg1)s), Then (%(arg2)s)' -- std conditional. (if x then y)
196  } break;
197  // trivial attribute operations
198  case Operands::ADD: { //1, (%(arg1)s)+(%(arg2)s)
199  // this isnt complete.
200  fxData arg1 = fxData();
201  arg1.srcRef = data.srcRef;
202  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), arg1, pMod);
203  fxData arg2 = fxData();
204  arg2.srcRef = data.srcRef;
205  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), arg2, pMod);
206  data.result = (arg1.result + arg2.result);
207  } break;
208  case Operands::GTE: { //39 %(arg1)s>=%(arg2)s
209  fxData arg1 = fxData();
210  arg1.srcRef = data.srcRef;
211  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg1), arg1, pMod);
212  fxData arg2 = fxData();
213  arg2.srcRef = data.srcRef;
214  ParseExpression(pItem, sFxDataMgr.GetExpression(expression.arg2), arg2, pMod);
215  // this needs work
216  //if (arg1.srcRef->GetAttribute(arg1.srcAttr) >= arg2.targLoc->GetAttribute(arg2.targAttr))
217  // data.result = true;
218 
219  } break;
220  case Operands::GT: { //38 %(arg1)s> %(arg2)s
221 
222  } break;
223 
224  case Operands::UE: { //73 UserError(%(arg1)s)
225  // not using this yet.
226  } break;
227  case Operands::SKILLCHECK: { //67 SkillCheck(%(arg1)s)
228  //data.result = true;
229  } break;
230  // module action method calls...not used.
231  case Operands::ATTACK: // 13,
232  case Operands::CARGOSCAN: // 14,
233  case Operands::CHEATTELEDOCK: // 15,
234  case Operands::CHEATTELEGATE: // 16,
235  case Operands::DECLOAKWAVE: // 19,
236  case Operands::ECMBURST: // 30,
237  case Operands::EMPWAVE: // 32,
238  case Operands::LAUNCH: // 44,
239  case Operands::LAUNCHDEFENDERMISSILE: // 45,
240  case Operands::LAUNCHDRONE: // 46,
241  case Operands::LAUNCHFOFMISSILE: // 47,
242  case Operands::MINE: // 50,
243  case Operands::POWERBOOST: // 53,
244  case Operands::SHIPSCAN: // 66,
245  case Operands::SURVEYSCAN: // 69,
246  case Operands::TARGETHOSTILES: // 70,
247  case Operands::TARGETSILENTLY: // 71,
248  case Operands::TOOLTARGETSKILLS: // 72,
249  case Operands::SPEEDBOOST: { //75 EVEmu-specific operand to apply modified speed attribs to destiny variables and update bubble
250  data.action = expression.operandID;
251  // pItem->AddModifier(data);
252  } break;
253  default: { // in case the op hasnt been defined, make a note here
254  if (is_log_enabled(EFFECTS__UNDEFINED)) {
255  std::ostringstream ret;
256  Operand operand = sFxDataMgr.GetOperand(expression.operandID);
257  ret << "Operand id:" << expression.operandID << " key:" << operand.operandKey;
258  if (operand.format.empty()) {
259  ret << " - has not been defined.";
260  } else { // % {'arg1': arg1, 'arg2': arg2, 'value': expression.expressionValue}
261  ret << " - should be added as " << operand.format.c_str();
262  }
263  _log(EFFECTS__UNDEFINED, "FxProc::ParseExpression() - %s", ret.str().c_str());
264  }
265  } break;
266  */
267  }
268 
269  if (sConfig.debug.UseProfiling)
270  sProfiler.AddTime(Profile::parseFX, GetTimeUSeconds() - profileStartTime);
271 }
#define sConfig
A macro for easier access to the singleton.
#define _log(type, fmt,...)
Definition: logsys.h:124
int8 GetAssociationEnum(const std::string &association)
int8 operandID
Definition: EffectsData.h:44
uint16 expressionTypeID
Definition: EffectsData.h:48
#define sProfiler
Definition: dbcore.cpp:39
InventoryItemRef srcRef
Definition: EffectsData.h:78
std::string expressionName
Definition: EffectsData.h:53
double GetTimeUSeconds()
Definition: utils_time.cpp:116
uint16 arg2
Definition: EffectsData.h:47
#define sFxDataMgr
int8 math
Definition: EffectsData.h:70
Definition: EffectsData.h:84
uint16 typeID
Definition: EffectsData.h:77
uint16 arg1
Definition: EffectsData.h:46
uint16 expressionAttributeID
Definition: EffectsData.h:50
int8 fxSrc
Definition: EffectsData.h:71
int8 GetEnvironmentEnum(const std::string &domain)
uint16 expressionGroupID
Definition: EffectsData.h:49
void ParseExpression(InventoryItem *pItem, Expression expression, fxData &data, GenericModule *pMod=nullptr)
std::string expressionValue
Definition: EffectsData.h:51
uint16 grpID
Definition: EffectsData.h:76
void AddModifier(fxData &data)
uint16 targAttr
Definition: EffectsData.h:74
void RemoveModifier(fxData &data)
uint16 typeID() const
int8 targLoc
Definition: EffectsData.h:72
uint8 categoryID() const
uint16 srcAttr
Definition: EffectsData.h:75

Here is the call graph for this function:


The documentation for this class was generated from the following files: