feat: generate animal-care quests and render them in the journal
This commit is contained in:
@@ -494,16 +494,23 @@ static func from_dictionary(record_data: Dictionary) -> SimulationStateRecord:
|
||||
var quest_id := quest_record.get_quest_id()
|
||||
var quest_opportunity_id := quest_record.get_opportunity_id()
|
||||
var requester_id := quest_record.get_requester_npc_id()
|
||||
var has_valid_requester := npc_ids.has(requester_id)
|
||||
var has_valid_opportunity := (
|
||||
quest_record.has_animal_target() or opportunity_ids.has(quest_opportunity_id)
|
||||
)
|
||||
if (
|
||||
quest_ids.has(quest_id)
|
||||
or quest_opportunity_ids.has(quest_opportunity_id)
|
||||
or not npc_ids.has(requester_id)
|
||||
or not opportunity_ids.has(quest_opportunity_id)
|
||||
or not has_valid_requester
|
||||
or not has_valid_opportunity
|
||||
):
|
||||
return null
|
||||
if (
|
||||
quest_record.get_status() == PlayerQuestRecord.STATUS_OPEN
|
||||
and not opportunity_records_by_id.has(quest_opportunity_id)
|
||||
and (
|
||||
(not quest_record.has_animal_target())
|
||||
and not opportunity_records_by_id.has(quest_opportunity_id)
|
||||
)
|
||||
):
|
||||
return null
|
||||
if (
|
||||
@@ -511,8 +518,15 @@ static func from_dictionary(record_data: Dictionary) -> SimulationStateRecord:
|
||||
and not event_ids.has(quest_record.get_resolution_event_id())
|
||||
):
|
||||
return null
|
||||
var dedup_key := (
|
||||
"animal:%s" % String(quest_record.get_animal_id())
|
||||
if quest_record.has_animal_target()
|
||||
else "opp:%d" % quest_opportunity_id
|
||||
)
|
||||
if quest_ids.has(quest_id) or quest_opportunity_ids.has(dedup_key):
|
||||
return null
|
||||
quest_ids[quest_id] = true
|
||||
quest_opportunity_ids[quest_opportunity_id] = true
|
||||
quest_opportunity_ids[dedup_key] = true
|
||||
highest_quest_id = maxi(highest_quest_id, quest_id)
|
||||
record.player_quests.append(quest_record)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user