Skip to content

Commit b74737c

Browse files
authored
Initial JSONification of some faction mission descriptions (#82364)
* Initial JSONification of some faction mission descriptions * Update data/json/faction_missions.json * Update data/json/faction_missions.json --------- Co-authored-by: Maleclypse <[email protected]>
2 parents 3c6a3bb + c323d0b commit b74737c

File tree

10 files changed

+678
-264
lines changed

10 files changed

+678
-264
lines changed

data/json/faction_missions.json

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
[
2+
{
3+
"type": "faction_mission",
4+
"id": "camp_gathering",
5+
"name": "Gathering",
6+
"desc": "Send a companion to gather materials for the next camp upgrade.",
7+
"skill": "survival",
8+
"items_label": "Gathering",
9+
"risk": "VERY_LOW",
10+
"activity": "LIGHT_EXERCISE",
11+
"time": "3 Hours, Repeated",
12+
"positions": 3
13+
},
14+
{
15+
"type": "faction_mission",
16+
"id": "camp_collect_firewood",
17+
"name": "Collect Firewood",
18+
"desc": "Send a companion to gather light brush and stout branches.",
19+
"items_label": "Gathering",
20+
"items_possibilities": [ "stout branches", "withered plants", "splintered wood" ],
21+
"risk": "LOW",
22+
"activity": "LIGHT_EXERCISE",
23+
"time": "3 Hours, Repeated",
24+
"positions": 3
25+
},
26+
{
27+
"type": "faction_mission",
28+
"id": "camp_menial",
29+
"name": "Sorting",
30+
"desc": "Send a companion to do low level chores and sort supplies.",
31+
"skill": "fabrication",
32+
"effects": [ "Material left in the unsorted loot zone will be sorted into a defined loot zone." ],
33+
"risk": "NONE",
34+
"time": "3 Hours",
35+
"positions": 1
36+
},
37+
{
38+
"type": "faction_mission",
39+
"id": "camp_cut_logs",
40+
"name": "Cut Logs",
41+
"desc": "Send a companion to a nearby forest to cut logs.",
42+
"skill": "fabrication",
43+
"effects": [
44+
"50% of trees/trunks at the forest position will be cut down.",
45+
"100% of total material will be brought back.",
46+
"Repeatable with diminishing returns.",
47+
"Will eventually turn forests into fields."
48+
],
49+
"risk": "NONE",
50+
"difficulty": "LOW",
51+
"activity": "ACTIVE_EXERCISE",
52+
"time": "6 Hours Base + Travel Time + Cutting Time",
53+
"positions": 1
54+
},
55+
{
56+
"type": "faction_mission",
57+
"id": "camp_clearcut",
58+
"name": "Clear Cut",
59+
"desc": "Send a companion to clear a nearby forest.",
60+
"skill": "fabrication",
61+
"effects": [
62+
"95% of trees/trunks at the forest position will be cut down.",
63+
"0% of total material will be brought back.",
64+
"Forest should become a field tile.",
65+
"Useful for clearing land for another faction camp."
66+
],
67+
"risk": "NONE",
68+
"difficulty": "VERY_LOW",
69+
"activity": "ACTIVE_EXERCISE",
70+
"time": "6 Hour Base + Travel Time + Cutting Time",
71+
"positions": 1,
72+
"footer": "Note that it's likely both forest and field roads look exactly the same after having been cleared."
73+
},
74+
{
75+
"type": "faction_mission",
76+
"id": "camp_setup_hide_site",
77+
"name": "Setup Hide Site",
78+
"desc": "Send a companion to build an improvised shelter and stock it with equipment at a distant map location.",
79+
"skill": "survival",
80+
"effects": [
81+
"Good for setting up resupply or contingency points.",
82+
"Gear is left unattended and could be stolen.",
83+
"Time dependent on weight of equipment being sent forward."
84+
],
85+
"risk": "MEDIUM",
86+
"difficulty": "MEDIUM",
87+
"activity": "LIGHT_EXERCISE",
88+
"time": "6 Hour Construction + Travel",
89+
"positions": 1
90+
},
91+
{
92+
"type": "faction_mission",
93+
"id": "camp_relay_hide_site",
94+
"name": "Relay Hide Site",
95+
"desc": "Push gear out to a hide site or bring gear back from one.",
96+
"skill": "survival",
97+
"effects": [
98+
"Good for returning equipment you left in the hide site shelter.",
99+
"Gear is left unattended and could be stolen.",
100+
"Time dependent on weight of equipment being sent forward or back."
101+
],
102+
"risk": "MEDIUM",
103+
"difficulty": "VERY_LOW",
104+
"activity": "LIGHT_EXERCISE",
105+
"time": "1 Hour Base + Travel",
106+
"positions": 1
107+
},
108+
{
109+
"type": "faction_mission",
110+
"id": "camp_foraging",
111+
"name": "Foraging",
112+
"desc": "Send a companion to forage for edible plants.",
113+
"skill": "survival",
114+
"items_label": "Foraging",
115+
"items_possibilities": [ "wild vegetables", "fruits and nuts depending on season" ],
116+
"risk": "VERY_LOW",
117+
"activity": "LIGHT_EXERCISE",
118+
"time": "4 Hours, Repeated",
119+
"positions": 3
120+
},
121+
{
122+
"type": "faction_mission",
123+
"id": "camp_trapping",
124+
"name": "Trapping",
125+
"desc": "Send a companion to set traps for small game.",
126+
"skill": "traps",
127+
"items_label": "Trapping",
128+
"items_possibilities": [ "small and tiny animal corpses" ],
129+
"risk": "LOW",
130+
"activity": "LIGHT_EXERCISE",
131+
"time": "6 Hours, Repeated",
132+
"positions": 2,
133+
"footer": "WARNING: May produce less food than consumed!"
134+
},
135+
{
136+
"type": "faction_mission",
137+
"id": "camp_hunting",
138+
"name": "Hunting",
139+
"desc": "Send a companion to hunt large animals.",
140+
"skill": "gun",
141+
"items_label": "Hunting",
142+
"items_possibilities": [ "small, medium, or large animal corpses" ],
143+
"risk": "MEDIUM",
144+
"activity": "MODERATE_EXERCISE",
145+
"time": "6 Hours, Repeated",
146+
"positions": 1,
147+
"footer": "WARNING: May produce less food than consumed!"
148+
},
149+
{
150+
"type": "faction_mission",
151+
"id": "camp_scouting",
152+
"name": "Scouting",
153+
"desc": "Send a companion out into the great unknown. High survival skills are needed to avoid combat but you should expect an encounter or two.",
154+
"skill": "survival",
155+
"effects": [
156+
"Select checkpoints to customize path.",
157+
"Reveals terrain around the path.",
158+
"Can bounce off hide sites to extend range."
159+
],
160+
"risk": "HIGH",
161+
"difficulty": "MEDIUM",
162+
"activity": "BRISK_EXERCISE",
163+
"time": "Travel",
164+
"positions": 3
165+
},
166+
{
167+
"type": "faction_mission",
168+
"id": "camp_combat_patrol",
169+
"name": "Combat Patrol",
170+
"desc": "Send a companion to purge the wasteland. Their goal is to kill anything hostile they encounter and return when their wounds are too great or the odds are stacked against them.",
171+
"skill": "survival",
172+
"effects": [
173+
"Pulls creatures encountered into combat instead of fleeing.",
174+
"Select checkpoints to customize path.",
175+
"Can bounce off hide sites to extend range."
176+
],
177+
"risk": "VERY_HIGH",
178+
"difficulty": "HIGH",
179+
"activity": "BRISK_EXERCISE",
180+
"time": "Travel",
181+
"positions": 3
182+
},
183+
{
184+
"type": "faction_mission",
185+
"id": "camp_plow",
186+
"name": "Plowing",
187+
"desc": "Plow any spaces that have reverted to dirt or grass.",
188+
"skill": "fabrication",
189+
"effects": [ "Restores farm plots created in previous expansion upgrades.", "Does not damage existing crops." ],
190+
"risk": "NONE",
191+
"activity": "MODERATE_EXERCISE",
192+
"time": "5 Min / Plot",
193+
"positions": 1
194+
},
195+
{
196+
"type": "faction_mission",
197+
"id": "camp_plant",
198+
"name": "Planting",
199+
"desc": "Plant designated seeds in the spaces that have already been tilled.",
200+
"skill": "survival",
201+
"effects": [
202+
"Choose which seed type or all of your seeds.",
203+
"Stops when out of seeds or planting locations.",
204+
"Will plant in ALL dirt mounds in the expansion."
205+
],
206+
"risk": "NONE",
207+
"activity": "MODERATE_EXERCISE",
208+
"time": "1 Min / Plot",
209+
"positions": 1
210+
},
211+
{
212+
"type": "faction_mission",
213+
"id": "camp_harvest",
214+
"name": "Harvest",
215+
"desc": "Harvest any plants that are ripe and bring the produce back.",
216+
"skill": "survival",
217+
"effects": [ "Will dump all harvesting products onto your location." ],
218+
"risk": "NONE",
219+
"activity": "MODERATE_EXERCISE",
220+
"time": "3 Min / Plot",
221+
"positions": 1
222+
},
223+
{
224+
"type": "faction_mission",
225+
"id": "camp_survey_field",
226+
"name": "Survey Field",
227+
"desc": "Nearby terrain can be turned into fields if it is completely cleared of terrain that isn't grass or dirt. Doing so makes that terrain eligible for usage for standard base camp expansion. Note that log cutting does this conversion automatically when the trees are depleted, but not all terrain can be logged.",
228+
"effects": [
229+
"If the expansion direction selected is eligible for conversion into a field this mission will perform that conversion. If it is not eligible you are told as much, and would have to make it suitable for conversion by removing everything that isn't grass or soil. Mining zones are useful to remove pavement, for instance. Note that removal of buildings is dangerous, laborious, and may still fail to get rid of everything if e.g. a basement or an opening to underground areas (such as a manhole) remains."
230+
],
231+
"risk": "NONE",
232+
"activity": "MODERATE_EXERCISE",
233+
"time": "Immediate",
234+
"positions": 1
235+
},
236+
{
237+
"type": "faction_mission",
238+
"id": "camp_survey_expansion",
239+
"name": "Survey Expansion",
240+
"desc": "Expansions open up new opportunities but can be expensive and time-consuming. Pick them carefully, at most 8 can be built at each camp.",
241+
"effects": [
242+
"Choose any one of the available expansions. Starting with a farm is always a solid choice since food is used to support companion missions and minimal investment is needed to get it going. A forge is also a great idea, allowing you to refine resources for subsequent expansions, craft better gear and make charcoal."
243+
],
244+
"risk": "NONE",
245+
"activity": "MODERATE_EXERCISE",
246+
"time": "3 Hours",
247+
"positions": 1
248+
}
249+
]

doc/JSON/FACTION_MISSIONS.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
- [Overview](#overview)
4+
- [Faction Missions](#faction-missions)
5+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
6+
7+
# Overview
8+
9+
Faction Camps (aka basecamps) can send NPC followers on missions to perform some actions.
10+
11+
Those missions are currently mostly hardcoded, but we have begun moving them into JSON, starting
12+
with their descriptions.
13+
14+
# Faction Mission JSON Object
15+
16+
| Field | Required? | Description |
17+
| ----- | --------- | ----------- |
18+
| `"type"` | yes | Must be `"faction_mission"` |
19+
| `"id"` | yes | Unique identifier for the mission, often `"camp_something"` |
20+
| `"name"` | yes | Short name for identifying the mission in a list or header |
21+
| `"desc"` | yes | Longer description of the mission |
22+
| `"skill"` | no | Skill checked and/or trained by performing the mission |
23+
| `"items_label"` | no | First word in "Foo possibilities:" header for list of possible items |
24+
| `"items_possibilities"` | no | Array of names of possible items returned from the mission |
25+
| `"effects"` | no | Array of descriptions of what the mission accomplishes |
26+
| `"risk"` | no | One of `"NONE"`, `"VERY_LOW"`, `"LOW"`, `"MEDIUM"`, `"HIGH"`, `"VERY_HIGH"` |
27+
| `"difficulty"` | no | One of `"NONE"`, `"VERY_LOW"`, `"LOW"`, `"MEDIUM"`, `"HIGH"`, `"VERY_HIGH"` |
28+
| `"activity"` | no | Exercise level, see [Player Activity](../PLAYER_ACTIVITY.md#json-properties) |
29+
| `"time"` | no | Description of how long the mission takes |
30+
| `"positions"` | no | Number of NPCs that can perform this mission at once |
31+
| `"footer"` | no | Text to display at the bottom of the entire description |
32+
33+
## Example
34+
35+
```json
36+
{
37+
"type": "faction_mission",
38+
"id": "camp_gathering",
39+
"name": "Gathering",
40+
"desc": "Send a companion to gather materials for the next camp upgrade.",
41+
"skill": "survival",
42+
"items_label": "Gathering",
43+
"items_possibilities": [ "stout branches", "withered plants", "splintered wood" ],
44+
"risk": "VERY_LOW",
45+
"activity": "LIGHT_EXERCISE",
46+
"time": "3 Hours, Repeated",
47+
"positions": 3
48+
},
49+
```

lang/string_extractor/parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from .parsers.end_screen import parse_end_screen
2121
from .parsers.event_statistic import parse_event_statistic
2222
from .parsers.faction import parse_faction
23+
from .parsers.faction_mission import parse_faction_mission
2324
from .parsers.fault import parse_fault
2425
from .parsers.fault_fix import parse_fault_fix
2526
from .parsers.field_type import parse_field_type
@@ -140,6 +141,7 @@ def dummy_parser(json, origin):
140141
"event_transformation": dummy_parser,
141142
"external_option": dummy_parser,
142143
"faction": parse_faction,
144+
"faction_mission": parse_faction_mission,
143145
"fault": parse_fault,
144146
"fault_fix": parse_fault_fix,
145147
"fault_group": dummy_parser,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from ..helper import get_singular_name
2+
from ..write_text import write_text
3+
4+
5+
def parse_faction_mission(json, origin):
6+
name = get_singular_name(json.get("name", json["id"]))
7+
if "name" in json:
8+
write_text(json["name"], origin, comment="Faction mission name")
9+
if "desc" in json:
10+
write_text(json["desc"], origin,
11+
comment="Description of faction mission "
12+
"\"{}\"".format(name))
13+
if "time" in json:
14+
write_text(json["time"], origin,
15+
comment="Duration of faction mission \"{}\"".format(name))
16+
if "footer" in json:
17+
write_text(json["footer"], origin,
18+
comment="Footer of faction mission \"{}\"".format(name))
19+
if "items_label" in json:
20+
write_text(json["items_label"], origin,
21+
comment="Gather items header label of faction mission "
22+
"\"{}\"".format(name))
23+
if "items_possibilities" in json:
24+
for item in json["items_possibilities"]:
25+
write_text(item, origin,
26+
comment="Possible item from faction mission "
27+
"\"{}\"".format(name))
28+
if "effects" in json:
29+
for item in json["effects"]:
30+
write_text(item, origin,
31+
comment="Effect of faction mission \"{}\"".format(name))

src/basecamp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ class basecamp
343343
std::string recruit_description( int npc_count ) const;
344344
/// Provides a "guess" for some of the things your gatherers will return with
345345
/// to upgrade the camp
346-
std::string gathering_description();
346+
std::vector<std::string> gathering_description() const;
347347
/// Returns a string for the number of plants that are harvestable, plots ready to plant,
348348
/// and ground that needs tilling
349-
std::string farm_description( const point_rel_omt &dir, size_t &plots_count,
350-
farm_ops operation );
349+
std::vector<std::string> farm_description( const point_rel_omt &dir, size_t &plots_count,
350+
farm_ops operation );
351351
/// Returns the description of a camp crafting options. converts fire charges to charcoal,
352352
/// allows dark crafting
353353
std::string craft_description( const recipe_id &itm );

0 commit comments

Comments
 (0)