001package com.fs.starfarer.api.impl.campaign.missions.academy; 002 003import java.awt.Color; 004import java.util.List; 005import java.util.Map; 006 007import com.fs.starfarer.api.campaign.InteractionDialogAPI; 008import com.fs.starfarer.api.campaign.econ.MarketAPI; 009import com.fs.starfarer.api.campaign.rules.MemoryAPI; 010import com.fs.starfarer.api.characters.PersonAPI; 011import com.fs.starfarer.api.impl.campaign.ids.People; 012import com.fs.starfarer.api.ui.TooltipMakerAPI; 013import com.fs.starfarer.api.util.Misc; 014import com.fs.starfarer.api.util.Misc.Token; 015 016public class GAIntro2 extends GABaseMission { 017 018 public static enum Stage { 019 GO_TO_ACADEMY, 020 COMPLETED, 021 } 022 023 protected int gaIntro2_credits; 024 protected PersonAPI baird; 025 protected PersonAPI sebestyen; 026 protected boolean pointAtSebestyen = false; 027 028 @Override 029 protected boolean create(MarketAPI createdAt, boolean barEvent) { 030 031 //System.out.print("attempting to start gaIntro2"); 032 033 // if already accepted by the player, abort 034 if (!setGlobalReference("$gaIntro2_ref")) { 035 //System.out.print("aborting because missions is already accepted"); 036 return false; 037 } 038 039 baird = getImportantPerson(People.BAIRD); 040 if (baird == null) return false; 041 042 sebestyen = getImportantPerson(People.SEBESTYEN); 043 if (sebestyen == null) return false; 044 045 setStartingStage(Stage.GO_TO_ACADEMY); 046 //setStartingStage(Stage.GO_TO_ACADEMY_SEB); 047 addSuccessStages(Stage.COMPLETED); 048 049 setStoryMission(); 050 051 //System.out.print("galatia found"); 052 053 gaIntro2_credits = 18000; // so its a fixed number, sue me. 054 055 setStartingStage(Stage.GO_TO_ACADEMY); 056 addSuccessStages(Stage.COMPLETED); 057 058 059 makeImportant(baird.getMarket(), "$gaIntro2_returnHere", Stage.GO_TO_ACADEMY); 060 setStageOnGlobalFlag(Stage.GO_TO_ACADEMY, "$gaIntro2_started"); // so it isn't offered again 061 062 //setStageOnGlobalFlag(Stage.GO_TO_ACADEMY_SEB, "$gaIntro2_started"); // so it isn't offered again 063 setStageOnGlobalFlag(Stage.COMPLETED, "$gaIntro2_completed"); 064 065 setRepFactionChangesNone(); 066 setRepPersonChangesNone(); 067 068 //System.out.print("starting gaIntro2 for real"); 069 070 return true; 071 } 072 073 protected boolean callAction(String action, String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) { 074 075 if ("makeSebestyenImportant".equals(action)) { 076 if (!pointAtSebestyen) { 077 makeImportant(sebestyen, null, Stage.GO_TO_ACADEMY); 078 makePrimaryObjective(sebestyen); 079 makeUnimportant(baird.getMarket()); 080 pointAtSebestyen = true; 081 } 082 return true; 083 } 084 return false; 085 } 086 087 protected void updateInteractionDataImpl() { 088 set("$gaIntro2_stage", getCurrentStage()); 089 set("$gaIntro2_credits", Misc.getWithDGS(gaIntro2_credits)); 090 } 091 092 @Override 093 public void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height) { 094 float opad = 10f; 095 //Color h = Misc.getHighlightColor(); 096 if (currentStage == Stage.GO_TO_ACADEMY) { 097 if (pointAtSebestyen) { 098 info.addPara("Return the data core to Academician Sebestyen. He'll get you your reward.", opad); 099 addStandardMarketDesc("Sebestyen is located " + sebestyen.getMarket().getOnOrAt(), sebestyen.getMarket(), info, opad); 100 } 101 else 102 { 103 info.addPara("Return the data core to the Galatia Academy for a reward.", opad); 104 } 105 } 106 } 107 108 @Override 109 public boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad) { 110 //Color h = Misc.getHighlightColor(); 111 if (currentStage == Stage.GO_TO_ACADEMY) { 112 113 if (pointAtSebestyen) { 114 info.addPara("Return the data core to Academician Sebestyen at the Galatia Academy in the Galatia system", tc, pad); 115 } 116 else 117 { 118 info.addPara("Go to the Galatia Academy in the Galatia system", tc, pad); 119 } 120 return true; 121 } 122 return false; 123 } 124 125 @Override 126 public String getBaseName() { 127 return "Return the Data Core"; 128 } 129 130 @Override 131 public String getPostfixForState() { 132 if (startingStage != null) { 133 return ""; 134 } 135 return super.getPostfixForState(); 136 } 137} 138 139 140 141 142