1package com.fs.starfarer.api.impl.campaign;
3import java.util.HashMap;
6import com.fs.starfarer.api.Global;
7import com.fs.starfarer.api.campaign.CampaignFleetAPI;
8import com.fs.starfarer.api.campaign.CustomEntitySpecAPI;
9import com.fs.starfarer.api.campaign.FactionAPI;
10import com.fs.starfarer.api.campaign.RepLevel;
11import com.fs.starfarer.api.campaign.SectorEntityToken;
12import com.fs.starfarer.api.campaign.StarSystemAPI;
13import com.fs.starfarer.api.campaign.econ.MarketAPI;
14import com.fs.starfarer.api.campaign.rules.MemoryAPI;
15import com.fs.starfarer.api.campaign.rules.RuleTokenReplacementGeneratorPlugin;
16import com.fs.starfarer.api.characters.PersonAPI;
17import com.fs.starfarer.api.impl.campaign.ids.Factions;
18import com.fs.starfarer.api.impl.campaign.ids.MemFlags;
19import com.fs.starfarer.api.util.Misc;
23 public Map<String, String>
getTokenReplacements(String ruleId, Object entity, Map<String, MemoryAPI> memoryMap) {
58 Map<String, String> map =
new HashMap<String, String>();
72 if (playerPerson !=
null) {
73 if (playerPerson.
isMale()) {
74 map.put(
"$playerSirOrMadam",
"sir");
75 map.put(
"$PlayerSirOrMadam",
"Sir");
77 map.put(
"$playerBrotherOrSister",
"brother");
78 map.put(
"$PlayerBrotherOrSister",
"Brother");
80 map.put(
"$playerHisOrHer",
"his");
81 map.put(
"$PlayerHisOrHer",
"His");
82 map.put(
"$playerHimOrHer",
"him");
83 map.put(
"$PlayerHimOrHer",
"Him");
84 map.put(
"$playerHeOrShe",
"he");
85 map.put(
"$PlayerHeOrShe",
"He");
87 map.put(
"$playerSirOrMadam",
"ma'am");
88 map.put(
"$PlayerSirOrMadam",
"Ma'am");
90 map.put(
"$playerBrotherOrSister",
"sister");
91 map.put(
"$PlayerBrotherOrSister",
"Sister");
93 map.put(
"$playerHisOrHer",
"her");
94 map.put(
"$PlayerHisOrHer",
"Her");
95 map.put(
"$playerHimOrHer",
"her");
96 map.put(
"$PlayerHimOrHer",
"Her");
97 map.put(
"$playerHeOrShe",
"she");
98 map.put(
"$PlayerHeOrShe",
"She");
101 if (honorific !=
null && !honorific.isEmpty()) {
102 map.put(
"$playerSirOrMadam",
Misc.
lcFirst(honorific));
103 map.put(
"$PlayerSirOrMadam", honorific);
105 if (!
Misc.
SIR.toLowerCase().equals(honorific.toLowerCase()) &&
106 !
Misc.
MAAM.toLowerCase().equals(honorific.toLowerCase())) {
107 map.put(
"$playerBrotherOrSister",
"walker");
108 map.put(
"$PlayerBrotherOrSister",
"Walker");
113 if (market !=
null) {
115 map.put(
"$marketName", market.
getName());
120 map.put(
"$marketSystem",
"hyperspace");
127 map.put(
"$playerHostileTimeoutStr", days.toLowerCase());
128 mem.
set(
"$playerHostileTimeoutStr", days.toLowerCase(), 0);
132 if (target !=
null) {
133 map.put(
"$entityName", target.
getName());
134 map.put(
"$fleetName", target.
getName().toLowerCase());
135 map.put(
"$relayName", target.
getName());
152 if (factionName ==
null || factionName.isEmpty()) {
160 map.put(
"$faction", factionName);
161 map.put(
"$ownerFaction", factionName);
162 map.put(
"$marketFaction", factionName);
164 map.put(
"$OwnerFaction",
Misc.
ucFirst(factionName));
165 map.put(
"$MarketFaction",
Misc.
ucFirst(factionName));
180 if (target !=
null) {
181 map.put(
"$entityName", target.
getName());
182 map.put(
"$fleetName", target.
getName().toLowerCase());
183 map.put(
"$relayName", target.
getName());
189 if (factionName ==
null || factionName.isEmpty()) {
195 map.put(
"$faction", factionName);
196 map.put(
"$ownerFaction", factionName);
197 map.put(
"$marketFaction", factionName);
199 map.put(
"$OwnerFaction",
Misc.
ucFirst(factionName));
200 map.put(
"$MarketFaction",
Misc.
ucFirst(factionName));
216 String shipOrFleet =
"fleet";
218 shipOrFleet =
"ship";
220 shipOrFleet =
"fighter wing";
223 map.put(
"$shipOrFleet", shipOrFleet);
224 map.put(
"$fleetOrShip", shipOrFleet);
225 map.put(
"$ShipOrFleet",
Misc.
ucFirst(shipOrFleet));
226 map.put(
"$FleetOrShip",
Misc.
ucFirst(shipOrFleet));
230 String otherShipOrFleet =
"fleet";
232 shipOrFleet =
"ship";
234 shipOrFleet =
"fighter wing";
237 map.put(
"$otherShipOrFleet", otherShipOrFleet);
239 map.put(
"$otherFleetName", fleet.
getName().toLowerCase());
242 if (person !=
null) {
244 map.put(
"$hisOrHer",
"his");
245 map.put(
"$HisOrHer",
"His");
246 map.put(
"$himOrHer",
"him");
247 map.put(
"$HimOrHer",
"Him");
248 map.put(
"$heOrShe",
"he");
249 map.put(
"$HeOrShe",
"He");
250 map.put(
"$himOrHerself",
"himself");
251 map.put(
"$HimOrHerself",
"Himself");
252 map.put(
"$manOrWoman",
"man");
253 map.put(
"$ManOrWoman",
"Man");
254 map.put(
"$brotherOrSister",
"brother");
255 map.put(
"$BrotherOrSister",
"Brother");
256 map.put(
"$sirOrMadam",
"sir");
257 map.put(
"$SirOrMadam",
"Sir");
259 map.put(
"$hisOrHer",
"her");
260 map.put(
"$HisOrHer",
"Her");
261 map.put(
"$himOrHer",
"her");
262 map.put(
"$HimOrHer",
"Her");
263 map.put(
"$heOrShe",
"she");
264 map.put(
"$HeOrShe",
"She");
265 map.put(
"$himOrHerself",
"herself");
266 map.put(
"$HimOrHerself",
"Herself");
267 map.put(
"$manOrWoman",
"woman");
268 map.put(
"$ManOrWoman",
"Woman");
269 map.put(
"$brotherOrSister",
"sister");
270 map.put(
"$BrotherOrSister",
"Sister");
271 map.put(
"$sirOrMadam",
"ma'am");
272 map.put(
"$SirOrMadam",
"Ma'am");
275 if (person.
getRank() !=
null) {
276 map.put(
"$personRank", person.
getRank().toLowerCase());
280 if (person.
getPost() !=
null) {
281 map.put(
"$personPost", person.
getPost().toLowerCase());
292 if (faction !=
null) {
298 if (personFaction !=
null) {
300 if (factionName ==
null || factionName.isEmpty()) {
306 map.put(
"$personFaction", factionName);
307 map.put(
"$PersonFaction",
Misc.
ucFirst(factionName));
static SectorAPI getSector()
Map< String, String > getTokenReplacements(String ruleId, Object entity, Map< String, MemoryAPI > memoryMap)
static final String PLAYER
static final String MEMORY_KEY_PLAYER_HOSTILE_ACTIVITY_NEAR_MARKET
static MarketAPI getSourceMarket(CampaignFleetAPI fleet)
static String lcFirst(String str)
static String ucFirst(String str)
static String getAtLeastStringForDays(int days)
static RepLevel getLevelFor(float r)
FleetDataAPI getFleetData()
String getPersonNamePrefixAOrAn()
String getDisplayNameWithArticle()
float getRelationship(String id)
String getDisplayNameLongWithArticle()
String getEntityNamePrefix()
String getDisplayNameIsOrAre()
String getDisplayNameLong()
List< FleetMemberAPI > getMembersListCopy()
CampaignFleetAPI getPlayerFleet()
PersonAPI getPlayerPerson()
CharacterDataAPI getCharacterData()
String getCustomEntityType()
CustomEntitySpecAPI getCustomEntitySpec()
MemoryAPI getMemoryWithoutUpdate()
float getExpire(String key)
boolean contains(String key)
void set(String key, Object value)