| 458 | } |
| 459 | |
| 460 | Maybe<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 | |
| 504 | Maybe<JsonArray> Quest::objectiveList() const { |
| 505 | return m_objectiveList; |
no test coverage detected