Starsector API
Loading...
Searching...
No Matches
LuddicFarmerBarEvent.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.intel.bar.events;
2
3import java.awt.Color;
4
5import com.fs.starfarer.api.campaign.econ.CommodityOnMarketAPI;
6import com.fs.starfarer.api.campaign.econ.MarketAPI;
7import com.fs.starfarer.api.characters.PersonAPI;
8import com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry;
9import com.fs.starfarer.api.impl.campaign.ids.Commodities;
10import com.fs.starfarer.api.impl.campaign.ids.Factions;
11import com.fs.starfarer.api.impl.campaign.ids.Ranks;
12import com.fs.starfarer.api.impl.campaign.ids.Tags;
13import com.fs.starfarer.api.impl.campaign.intel.contacts.ContactIntel;
14import com.fs.starfarer.api.util.Misc;
15
17
19 super();
20 }
21
22 public boolean shouldShowAtMarket(MarketAPI market) {
23 if (!super.shouldShowAtMarket(market)) return false;
25
26 if (!market.getFactionId().equals(Factions.LUDDIC_CHURCH) &&
27 !market.getFactionId().equals(Factions.LUDDIC_PATH)) {
28 return false;
29 }
30
31 if (market.getStabilityValue() < 4) return false;
32
33 CommodityOnMarketAPI com = market.getCommodityData(commodity);
34 if (com.getMaxSupply() <= 0) return false;
35 if (com.getAvailable() < com.getMaxDemand()) return false;
36
37 return true;
38 }
39
40 @Override
41 protected String getCommodityId() {
42 return Commodities.FOOD;
43 }
44
45 @Override
46 protected void doExtraConfirmActions() {
47 ContactIntel.addPotentialContact(person, market, text);
48 }
49
50 @Override
51 protected void adjustPerson(PersonAPI person) {
52 super.adjustPerson(person);
53 person.setImportanceAndVoice(pickLowImportance(), random);
54 person.addTag(Tags.CONTACT_TRADE);
55 }
56
57 @Override
58 protected String getPersonPost() {
59 return Ranks.POST_COMMUNE_LEADER;
60 }
61
62 @Override
63 protected String getPersonFaction() {
64 return Factions.LUDDIC_CHURCH;
65 }
66
67 @Override
68 protected String getPersonRank() {
69 return Ranks.CITIZEN;
70 }
71
72 @Override
73 protected int computeQuantity() {
74 int quantity = 50 + 10 * random.nextInt(6);
75
76 CommodityOnMarketAPI com = market.getCommodityData(commodity);
77 int size = Math.min(com.getAvailable(), com.getMaxSupply());
78 if (size < 1) size = 1;
79 //quantity *= BaseIndustry.getSizeMult(size);
80 quantity *= Math.max(1, BaseIndustry.getSizeMult(size) - 2);
81 return quantity;
82 }
83
84 @Override
85 protected float getPriceMult() {
86 return 0.75f;
87 }
88
89 @Override
90 protected String getPrompt() {
91 return "A weathered-looking " + getManOrWoman() + " whose worn but well-tailored " +
92 "work suit bears the sigil of a farming commune sits at a table drinking small-beer.";
93 }
94
95 @Override
96 protected String getOptionText() {
97 return "Chat up the weathered-looking " + getManOrWoman() + "";
98 }
99
100 @Override
101 protected String getMainText() {
102 String heOrShe = getHeOrShe();
103 return Misc.ucFirst(heOrShe) + " turns out to be the master of a farming commune " +
104 "and " + heOrShe + " has come \"to town\" to find distributors for their product. " +
105 Misc.ucFirst(heOrShe) + "'s got %s units of food that has to be moved as soon as possible and " +
106 "if you buy it all today, you'll get an under-market price of %s per unit. " +
107 "And, " + heOrShe + " says with a wink, \"As pious folk, we need not bother with the Church’s tariff.\",";
108 }
109
110 @Override
111 protected String [] getMainTextTokens() {
112 return new String [] { Misc.getWithDGS(quantity), Misc.getDGSCredits(unitPrice) };
113 }
114 @Override
115 protected Color [] getMainTextColors() {
116 return new Color [] { Misc.getHighlightColor(), Misc.getHighlightColor() };
117 }
118
119 @Override
120 protected String getConfirmText() {
121 return "Accept with a firm handshake and cryptokey exchange";
122 }
123
124 @Override
125 protected String getCancelText() {
126 return "Decline the deal, and thank " + getHimOrHer() + " for the proposal";
127 }
128
129 @Override
130 protected String getAcceptText() {
131 return "You make arrangements with the farm master for pickup of the cargo from a quiet warehouse " +
132 "on the outskirts of " + market.getName() + " and transmit the details " +
133 "to your quartermaster to handle.";
134 }
135
136 @Override
137 protected String [] getAcceptTextTokens() {
138 return new String [] { };
139 }
140 @Override
141 protected Color [] getAcceptTextColors() {
142 return new Color [] { };
143 }
144
145
146}
147
148
149