1package com.fs.starfarer.api.loading;
3import java.util.HashSet;
6import org.json.JSONException;
7import org.json.JSONObject;
9import com.fs.starfarer.api.Global;
10import com.fs.starfarer.api.campaign.PersonImportance;
11import com.fs.starfarer.api.campaign.RepLevel;
12import com.fs.starfarer.api.impl.campaign.missions.hub.BaseHubMission;
13import com.fs.starfarer.api.impl.campaign.missions.hub.HubMission;
14import com.fs.starfarer.api.util.Misc;
36 protected Set<String>
tags =
new HashSet<String>();
37 protected Set<String>
tagsAny =
new HashSet<String>();
38 protected Set<String>
tagsAll =
new HashSet<String>();
39 protected Set<String>
tagsNotAny =
new HashSet<String>();
45 protected RepLevel
min;
46 protected RepLevel
max;
62 personId = row.optString(
"person id",
null);
67 min = Misc.mapToEnum(row,
"min rep", RepLevel.class, RepLevel.VENGEFUL);
68 max = Misc.mapToEnum(row,
"max rep", RepLevel.class, RepLevel.COOPERATIVE);
70 freq = (float)row.optDouble(
"freq", 10f);
71 minTimeout = (float)row.optDouble(
"min timeout", 10f);
72 maxTimeout = (float)row.optDouble(
"max timeout", 10f);
74 importance = Misc.mapToEnum(row,
"importance", PersonImportance.class, PersonImportance.VERY_LOW);
78 icon = row.optString(
"icon");
79 if (
icon ==
null ||
icon.isEmpty()) {
83 String requiresAllStr = row.optString(
"tagsAll",
null);
84 if (requiresAllStr !=
null) {
85 String [] split = requiresAllStr.split(
",");
86 for (String tag : split) {
88 if (tag.isEmpty())
continue;
93 String requiresAnyStr = row.optString(
"tagsAny",
null);
94 if (requiresAnyStr !=
null) {
95 String [] split = requiresAnyStr.split(
",");
96 for (String tag : split) {
98 if (tag.isEmpty())
continue;
103 String requiresNotAny = row.optString(
"tagsNotAny",
null);
104 if (requiresNotAny !=
null) {
105 String [] split = requiresNotAny.split(
",");
106 for (String tag : split) {
108 if (tag.isEmpty())
continue;
113 String tagsStr = row.optString(
"tags",
null);
114 if (tagsStr !=
null) {
115 String [] split = tagsStr.split(
",");
116 for (String tag : split) {
118 if (tag.isEmpty())
continue;
124 String reqs = row.optString(
"reqMissionAny",
null);
126 String [] split = reqs.split(
",");
127 for (String tag : split) {
129 if (tag.isEmpty())
continue;
134 reqs = row.optString(
"reqMissionAll",
null);
136 String [] split = reqs.split(
",");
137 for (String tag : split) {
139 if (tag.isEmpty())
continue;
144 reqs = row.optString(
"reqMissionNone",
null);
146 String [] split = reqs.split(
",");
147 for (String tag : split) {
149 if (tag.isEmpty())
continue;
264 if (
icon !=
null && mission instanceof BaseHubMission) {
265 BaseHubMission bhm = (BaseHubMission) mission;
266 bhm.setIconName(
icon);
280 return tags.contains(tag);
286 boolean foundAll =
true;
288 if (!
tags.contains(tag)) {
293 if (!foundAll && !
getTagsAll().isEmpty())
return false;
296 boolean foundOne =
false;
298 if (
tags.contains(tag)) {
303 if (!foundOne && !
getTagsAny().isEmpty())
return false;
308 if (
tags.contains(tag)) {
313 if (foundOne)
return false;
320 boolean foundAll =
true;
322 if (!completed.contains(
id)) {
330 boolean foundOne =
false;
332 if (completed.contains(
id)) {
342 if (completed.contains(tag)) {
347 if (foundOne)
return false;
static SettingsAPI getSettings()
void setMissionId(String missionId)
void setPersonId(String personId)
Set< String > reqMissionAny
void setMaxTimeout(float maxTimeout)
Set< String > getReqMissionAny()
PersonImportance getImportance()
boolean completedMissionsMatch(Set< String > completed)
boolean hasTag(String tag)
void setPluginClass(String pluginClass)
Set< String > reqMissionAll
Set< String > reqMissionNone
void setImportance(PersonImportance importance)
Set< String > getReqMissionNone()
void setMaxRep(RepLevel max)
HubMission createMission()
void setMinRep(RepLevel min)
PersonMissionSpec(JSONObject row)
Set< String > getTagsNotAny()
Set< String > getReqMissionAll()
PersonImportance importance
void setIcon(String icon)
boolean tagsMatch(Set< String > tags)
void setMinTimeout(float minTimeout)
Set< String > getTagsAll()
Set< String > getTagsAny()
Object getInstanceOfScript(String className)