MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / customIndicator

Method customIndicator

source/game/StarQuests.cpp:460–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460Maybe<String> Quest::customIndicator(EntityPtr const& entity) const {
461 if (!m_inited)
462 return {};
463
464 for (String const& indicator : m_indicators) {
465 auto param = parameters().get(indicator);
466 if (param.detail.is<QuestEntity>()) {
467 QuestEntity questEntity = param.detail.get<QuestEntity>();
468 if (questEntity.uniqueId && entity->uniqueId() == questEntity.uniqueId) {
469 return param.indicator.value(defaultCustomIndicator());
470 }
471
472 } else if (param.detail.is<QuestItem>()) {
473 QuestItem questItem = param.detail.get<QuestItem>();
474 if (hasItemIndicator(entity, {questItem.descriptor()}))
475 return param.indicator.value(defaultCustomIndicator());
476
477 } else if (param.detail.is<QuestItemTag>()) {
478 String questItemTag = param.detail.get<QuestItemTag>();
479 if (auto itemDrop = as<ItemDrop>(entity)) {
480 if (itemDrop->item()->itemTags().contains(questItemTag))
481 return param.indicator.value(defaultCustomIndicator());
482 }
483
484 } else if (param.detail.is<QuestItemList>()) {
485 QuestItemList questItemList = param.detail.get<QuestItemList>();
486 if (hasItemIndicator(entity, questItemList))
487 return param.indicator.value(defaultCustomIndicator());
488
489 } else if (param.detail.is<QuestMonsterType>()) {
490 QuestMonsterType questMonsterType = param.detail.get<QuestMonsterType>();
491 if (auto monster = as<Monster>(entity)) {
492 if (monster->typeName() == questMonsterType.typeName) {
493 TeamType team = monster->getTeam().type;
494 if (team == TeamType::Enemy || team == TeamType::Passive)
495 return param.indicator.value(defaultCustomIndicator());
496 }
497 }
498
499 }
500 }
501 return {};
502}
503
504Maybe<JsonArray> Quest::objectiveList() const {
505 return m_objectiveList;

Callers 1

getQuestIndicatorMethod · 0.80

Calls 10

hasItemIndicatorFunction · 0.85
uniqueIdMethod · 0.80
getMethod · 0.45
valueMethod · 0.45
descriptorMethod · 0.45
containsMethod · 0.45
itemTagsMethod · 0.45
itemMethod · 0.45
typeNameMethod · 0.45
getTeamMethod · 0.45

Tested by

no test coverage detected