theLaborInVain / kdm-manager-api

The API used by https://kdm-manager.com and related Kingdom Death: Monster utilities.
Other
3 stars 0 forks source link

/new/settlement failure during get_timeline_monster_event_options() #73

Closed toconnell closed 11 months ago

toconnell commented 11 months ago

User OID: 6313dfea1f7f543b730a4ebe Method: POST URL: http://api.kdm-manager.com/new/settlement JSON: {'name': None, 'campaign': 'people_of_the_sun', 'macros': [], 'expansions': ['kd_collection_fighting_arts_and_disorders', 'kd_collection_settlement_events', 'gorm', 'spidicules', 'lion_god', 'sunstalker', 'dung_beetle_knight', 'lion_knight', 'lonely_tree', 'slenderman'], 'survivors': [], 'random_name': True}

Traceback (most recent call last):
File "/home/toconnell/kdm-manager-api/venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
 rv = self.dispatch_request()
File "/home/toconnell/kdm-manager-api/venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
 return self.view_functions[rule.endpoint](**req.view_args)
File "/home/toconnell/kdm-manager-api/app/utils/crossdomain.py", line 57, in wrapped_function
 resp = flask.make_response(func(*args, **kwargs))
File "/home/toconnell/kdm-manager-api/app/routes.py", line 475, in new_asset
 return models.new_user_asset(asset_type)
File "/home/toconnell/kdm-manager-api/app/models/__init__.py", line 63, in new_user_asset
 return settlement_obj.serialize()
File "/home/toconnell/kdm-manager-api/app/utils/__init__.py", line 331, in not_timed
 return method(*args, **kwargs)
File "/home/toconnell/kdm-manager-api/app/models/settlements/_settlement.py", line 715, in serialize
 output["game_assets"][c] = self.get_timeline_monster_event_options(c)
File "/home/toconnell/kdm-manager-api/app/models/settlements/_settlement.py", line 983, in get_timeline_monster_event_options
 candidate_handles.append(self.campaign.asset['finale_monster'])
KeyError: 'finale_monster'
toconnell commented 11 months ago

This can be replicated in V3 and V4.

toconnell commented 11 months ago

potsun intentionally does NOT have a finale monster:

image

toconnell commented 11 months ago

I think the answer is just going to be to NOT try to pull finale monsters in for Nemesis options.

toconnell commented 11 months ago
diff --git a/app/models/settlements/_settlement.py b/app/models/settlements/_settlement.py
index 81e889e..97a66e1 100644
--- a/app/models/settlements/_settlement.py
+++ b/app/models/settlements/_settlement.py
@@ -980,7 +980,7 @@ class Settlement(UserAsset):
             candidate_handles.extend(
                 self.settlement.get("nemesis_monsters", [])
             )
-            candidate_handles.append(self.campaign.asset['finale_monster'])
+#            candidate_handles.append(self.campaign.asset['finale_monster'])
         elif context == "defeated_monsters":
             candidate_handles.extend(self.settlement.get("quarries", []))
             candidate_handles.extend(self.settlement.get("nemesis_monsters",[]))