106 for (CargoStackAPI stack :
playerCargo.getStacksCopy()) {
107 CommoditySpecAPI spec = stack.getResourceIfResource();
108 if (spec !=
null && spec.getDemandClass().equals(Commodities.AI_CORES)) {
109 copy.addFromStack(stack);
114 final float width = 310f;
115 dialog.showCargoPickerDialog(
"Select AI cores to turn in",
"Confirm",
"Cancel",
true, width, copy,
new CargoPickerListener() {
116 public void pickedCargo(CargoAPI cargo) {
117 if (cargo.isEmpty()) {
118 cancelledCargoSelection();
123 for (CargoStackAPI stack : cargo.getStacksCopy()) {
124 playerCargo.removeItems(stack.getType(), stack.getData(), stack.getSize());
125 if (stack.isCommodityStack()) {
126 int num = (int) stack.getSize();
129 String key =
"$turnedIn_" + stack.getCommodityId();
130 int turnedIn =
faction.getMemoryWithoutUpdate().getInt(key);
131 faction.getMemoryWithoutUpdate().set(key, turnedIn + num);
134 String key2 =
"$turnedIn_allCores";
135 int turnedIn2 =
faction.getMemoryWithoutUpdate().getInt(key2);
136 faction.getMemoryWithoutUpdate().set(key2, turnedIn2 + num);
148 if (repChange >= 1f) {
149 CustomRepImpact impact =
new CustomRepImpact();
150 impact.delta = repChange * 0.01f;
152 new RepActionEnvelope(RepActions.CUSTOM, impact,
156 impact.delta *= 0.25f;
157 if (impact.delta >= 0.01f) {
159 new RepActionEnvelope(RepActions.CUSTOM, impact,
167 public void cancelledCargoSelection() {
169 public void recreateTextPanel(TooltipMakerAPI panel, CargoAPI cargo, CargoStackAPI pickedUp,
boolean pickedUpFromSource, CargoAPI combined) {
178 panel.setParaFontOrbitron();
179 panel.addPara(Misc.ucFirst(
faction.getDisplayName()),
faction.getBaseUIColor(), 1f);
183 panel.setParaFontDefault();
185 panel.addImage(
faction.getLogo(), width * 1f, 3f);
191 panel.addPara(
"Compared to dealing with other factions, turning AI cores in to " +
192 faction.getDisplayNameLongWithArticle() +
" " +
193 "will result in:", opad);
194 panel.beginGridFlipped(width, 1, 40f, 10f);
196 panel.addToGrid(0, 0,
"Bounty value",
"" + (
int)(
valueMult * 100f) +
"%");
197 panel.addToGrid(0, 1,
"Reputation gain",
"" + (
int)(
repMult * 100f) +
"%");
200 panel.addPara(
"If you turn in the selected AI cores, you will receive a %s bounty " +
201 "and your standing with " +
faction.getDisplayNameWithArticle() +
" will improve by %s points.",
202 opad * 1f, Misc.getHighlightColor(),
203 Misc.getWithDGS(bounty) + Strings.C,
204 "" + (
int) repChange);