001package com.fs.starfarer.api.impl.campaign.tutorial; 002 003import com.fs.starfarer.api.Global; 004import com.fs.starfarer.api.campaign.econ.MonthlyReport; 005import com.fs.starfarer.api.campaign.econ.MonthlyReport.FDNode; 006import com.fs.starfarer.api.campaign.listeners.EconomyTickListener; 007import com.fs.starfarer.api.impl.campaign.shared.SharedData; 008import com.fs.starfarer.api.ui.TooltipMakerAPI; 009import com.fs.starfarer.api.ui.TooltipMakerAPI.TooltipCreator; 010import com.fs.starfarer.api.util.Misc; 011 012public class SpacerObligation implements EconomyTickListener, TooltipCreator { 013 014 public static int DEBT_BASE = 1000; 015 public static int DEBT_PER_LEVEL = 3000; 016 017 protected long startTime = 0; 018 public SpacerObligation() { 019 Global.getSector().getListenerManager().addListener(this); 020 startTime = Global.getSector().getClock().getTimestamp(); 021 } 022 023 public void reportEconomyTick(int iterIndex) { 024 int lastIterInMonth = (int) Global.getSettings().getFloat("economyIterPerMonth") - 1; 025 if (iterIndex != lastIterInMonth) return; 026 027 MonthlyReport report = SharedData.getData().getCurrentReport(); 028 029 030 int debt = getDebt(); 031 FDNode fleetNode = report.getNode(MonthlyReport.FLEET); 032 033 FDNode stipendNode = report.getNode(fleetNode, "SpacerObligation"); 034 stipendNode.upkeep = debt; 035 stipendNode.name = "An obligation from your past"; 036 stipendNode.icon = Global.getSettings().getSpriteName("income_report", "generic_expense"); 037 stipendNode.tooltipCreator = this; 038 } 039 040 protected int getDebt() { 041 return DEBT_BASE + (Global.getSector().getPlayerStats().getLevel() - 1) * DEBT_PER_LEVEL; 042 } 043 044 public void reportEconomyMonthEnd() { 045 } 046 047 public void createTooltip(TooltipMakerAPI tooltip, boolean expanded, Object tooltipParam) { 048 tooltip.addPara("You never talk about it.", 049 0f, Misc.getHighlightColor(), Misc.getDGSCredits(getDebt())); 050 } 051 052 public float getTooltipWidth(Object tooltipParam) { 053 return 450; 054 } 055 056 public boolean isTooltipExpandable(Object tooltipParam) { 057 return false; 058 } 059} 060 061 062