85 _log(EFFECTS__ERROR,
"FxProc::ParseExpression(): opATTR called with no expressionAttributeID defined");
94 _log(EFFECTS__WARNING,
"FxProc::ParseExpression(): opGROUP using expressionValue %s called by %s",\
97 _log(EFFECTS__ERROR,
"FxProc::ParseExpression(): opGROUP called with no expressionGroupID or expressionValue defined");
107 _log(EFFECTS__WARNING,
"FxProc::ParseExpression(): opTYPEID using expressionValue %s", expression.
expressionValue.c_str());
109 _log(EFFECTS__ERROR,
"FxProc::ParseExpression(): opTYPEID called with no expressionTypeID or expressionValue defined");
126 data1.srcRef = data.
srcRef;
166 if ((skill) and (!data.
fxSrc))
187 if ((skill) and (!data.
fxSrc))
269 if (
sConfig.debug.UseProfiling)
286 std::vector<InventoryItemRef> itemRefVec;
288 switch (cur.second.fxSrc) {
291 std::vector<InventoryItemRef> moduleList;
293 for (
auto mod : moduleList)
294 if (mod->groupID() == cur.second.grpID)
295 itemRefVec.push_back(mod);
299 _log(EFFECTS__WARNING,
"FxProc::ApplyEffects(): Source::Skill - typeID is invalid");
302 switch (cur.second.targLoc) {
306 itemRefVec.push_back(cur.second.srcRef);
309 if (cur.second.typeID) {
314 if (pShip->
HasReqSkill(cur.second.srcRef->typeID()))
315 itemRefVec.push_back(static_cast<InventoryItemRef>(pShip));
319 if (cur.second.typeID) {
322 std::vector<InventoryItemRef> allSkills;
324 for (
auto curSkill : allSkills)
325 if (curSkill->HasReqSkill(skillID))
326 itemRefVec.push_back(curSkill);
329 itemRefVec.push_back(static_cast<InventoryItemRef>(pChar));
334 itemRefVec.push_back(static_cast<InventoryItemRef>(pShip));
339 std::map<EVEItemFlags, InventoryItemRef> charges;
341 for (
auto mod : charges)
342 if (mod.second->HasReqSkill(cur.second.typeID))
343 itemRefVec.push_back(mod.second);
350 _log(EFFECTS__WARNING,
"FxProc::ApplyEffects(): Source::Skill target location invalid.");
356 _log(EFFECTS__ERROR,
"FxProc::ApplyEffects(): Source::Skill target undefined - %s.",
GetTargLocName(cur.second.targLoc));
362 switch (cur.second.targLoc) {
365 itemRefVec.push_back(static_cast<InventoryItemRef>(pChar));
369 itemRefVec.push_back(static_cast<InventoryItemRef>(pShip));
373 itemRefVec.push_back(cur.second.srcRef);
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,
\
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,
\
404 _log(EFFECTS__ERROR,
"FxProc::ApplyEffects(): Source::Self target invalid.");
409 _log(EFFECTS__ERROR,
"FxProc::ApplyEffects(): Source::Self target undefined - %s.",
GetTargLocName(cur.second.targLoc));
415 switch (cur.second.targLoc) {
419 itemRefVec.push_back(cur.second.srcRef);
432 _log(EFFECTS__ERROR,
"FxProc::ApplyEffects(): Source::Gang target undefined - %s.",
GetTargLocName(cur.second.targLoc));
438 _log(EFFECTS__DEBUG,
"FxProc::ApplyEffects(): %s is ship source calling target %s.", cur.second.srcRef->name(),
GetTargLocName(cur.second.targLoc));
441 _log(EFFECTS__ERROR,
"FxProc::ApplyEffects(): source location invalid.");
447 _log(EFFECTS__ERROR,
"FxProc::ApplyEffects(): source location %s not coded.",
GetSourceName(cur.second.fxSrc));
452 if (itemRefVec.empty())
453 if ((cur.second.typeID == 0)
454 and (cur.second.grpID == 0)) {
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.", \
466 EvilNumber srcValue = cur.second.srcRef->GetAttribute(cur.second.srcAttr);
477 int8 opID(cur.first);
478 for (
auto item : itemRefVec) {
479 if (
item.get() ==
nullptr)
482 targValue =
item->GetAttribute(cur.second.targAttr);
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(),
\
511 item->SetAttribute(cur.second.targAttr, newValue, update);
513 if (
sConfig.debug.UseProfiling)
546 return val1 * (1.0f + (val2 / 100.0f));
550 return val1 / (1.0f + (val2 / 100.0f));
552 _log(EFFECTS__WARNING,
"FxProc::CalculateNewAttributeValue() - Invalid Association used");
555 _log(EFFECTS__ERROR,
"FxProc::CalculateNewAttributeValue() - Unknown Association used: %i", (
int8)method);
561 if (association ==
"PreAssignment") {
563 }
else if (association ==
"PreDiv") {
565 }
else if (association ==
"PreMul") {
567 }
else if (association ==
"ModAdd") {
569 }
else if (association ==
"ModSub") {
571 }
else if (association ==
"PostPercent") {
573 }
else if (association ==
"PostMul") {
575 }
else if (association ==
"PostDiv") {
577 }
else if (association ==
"PostAssignment") {
579 }
else if (association ==
"SkillCheck") {
581 }
else if (association ==
"AddRate") {
583 }
else if (association ==
"SubRate") {
594 }
else if (env ==
"Char") {
596 }
else if (env ==
"Ship") {
598 }
else if (env ==
"Target") {
600 }
else if (env ==
"Area") {
602 }
else if (env ==
"Other") {
604 }
else if (env ==
"Charge") {
628 default:
return "Invalid";
643 default:
return "Invalid";
658 default:
return "Invalid";
674 default:
return "Invalid";
681 sLog.Green(
"DecodeEffects",
"fxID %u", fxID);
696 sLog.Green(
"EvaluateExpression",
"expID %u: %s", expID, name.c_str());
697 sLog.Cyan(
"EvaluateExpression",
" %s - <%s> src(%s:%u) targ(%s:%u)", \
745 data1.srcRef = data.
srcRef;
#define sConfig
A macro for easier access to the singleton.
bool HasReqSkill(const uint16 skillID)
#define _log(type, fmt,...)
InventoryItemRef GetLoadedChargeOnModule(EVEItemFlags flag)
void DecodeExpression(Expression expression, fxData &data)
int8 GetAssociationEnum(const std::string &association)
const char * GetTargLocName(int8 id)
ModuleManager * GetModuleManager()
void ApplyEffects(InventoryItem *pItem, Character *pChar, ShipItem *pShip, bool update=false)
InventoryItemRef GetTargetRef()
this is a class that kinda mimics how python polymorph's numbers.
void GetLoadedCharges(std::map< EVEItemFlags, InventoryItemRef > &charges)
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
std::string expressionName
#define sLog
Evaluates to a NewLog instance.
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 * GetStateName(int8 id)
const char * GetMathMethodName(int8 id)
GenericModule * GetModule(EVEItemFlags flag)
const char * GetSourceName(int8 id)
std::multimap< int8, fxData > m_modifiers
EvilNumber CalculateAttributeValue(EvilNumber val1, EvilNumber val2, int8 method)
if(sConfig.world.saveOnMove)
uint16 expressionAttributeID
int8 GetEnvironmentEnum(const std::string &domain)
void GetModuleListByReqSkill(uint16 skillID, std::vector< InventoryItemRef > &modVec)
void ParseExpression(InventoryItem *pItem, Expression expression, fxData &data, GenericModule *pMod=nullptr)
std::string expressionValue
void AddModifier(fxData &data)
void DecodeEffects(const uint16 fxID)
void GetSkillsList(std::vector< InventoryItemRef > &skills) const
void RemoveModifier(fxData &data)
void EvaluateExpression(const uint16 expID, const char *type)