Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion data/strings/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,17 @@
"mb_filters_Location_Distance": "Filter by distance to target",
"mb_filters_Location_FuelRange": "Lock distance filter to your fuel range",
"mb_filters_Location_SliderTitle": "Distance (LY)",
"mb_sort": "Sort",
"mb_sort_Ascending": "Ascending",
"mb_sort_Descending": "Descending",
"mb_sort_Alphabetical": "Alphabetical",
"mb_sort_Distance": "Distance",
"mb_sort_Credits": "Credits",
"mb_sort_FirstCreated": "Time Posted",
"mb_sort_DropNonHostiles": "Drop non-hostiles in populated areas",
"mb_sort_DropNonHostilesTooltip": "When enabled, non-hostile bounty targets located in systems with a size 4 or larger friendly market will be moved to the bottom of the list and colored red.\n\nE.G: If killing a bounty target would unavoidably trigger a war with a faction.",


"mb_intelTutorial": "Select a bounty on the left to see more information.\nFilter the list by clicking \"Filters\" at the top of the list.\nIf the job terms are acceptable, click Accept in the bottom-right of the info panel.",

# MagicAchievements
Expand Down Expand Up @@ -331,6 +342,6 @@
"subsystemState_Cooldown": "",
"subsystemState_OutOfRange": "OUT OF RANGE",
"subsystemState_NoTarget": "NO TARGET",
"subsystemState_FluxCapped": "FLUX TOO HIGH",
"subsystemState_FluxCapped": "FLUX TOO HIGH"
}
}
13 changes: 11 additions & 2 deletions src/org/magiclib/bounty/MagicBountyIntel.java
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,13 @@ public void createSmallDescription(TooltipMakerAPI info, float width, float heig
Misc.ucFirst(MagicBountyUtilsInternal.getPronoun(bounty.getCaptain())),
bounty.getFleetSpawnLocation().getStarSystem().getNameWithLowercaseType());
break;
case Distance:
info.addPara(MagicTxt.getString("mb_distance"),
10f,
Misc.getTextColor(),
Misc.getHighlightColor(),
Math.round(Misc.getDistanceLY(Global.getSector().getPlayerFleet(), bounty.getFleetSpawnLocation())) + "");
break;
default:
info.addPara(MagicBountyUtilsInternal.createLocationEstimateText(bounty), 10f);
break;
Expand Down Expand Up @@ -459,8 +466,10 @@ public SectorEntityToken getMapLocation(SectorMapAPI map) {
case Exact:
case System:
return hideoutLocation;
// case None:
// return null; NOPE, the icon should always be placed somewhere otherwise there is no way to get the location information again.
//case Vague:
case Distance:
case None:
return Global.getSector().getPlayerFleet();
default:
// From PersonBountyIntel.getMapLocation
Constellation c = hideoutLocation.getConstellation();
Expand Down
98 changes: 0 additions & 98 deletions src/org/magiclib/bounty/intel/AssassinationMagicBountyInfo.kt

This file was deleted.

18 changes: 11 additions & 7 deletions src/org/magiclib/bounty/intel/BountyInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@ import com.fs.starfarer.api.impl.campaign.ids.Tags
import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.special.BreadcrumbSpecial
import com.fs.starfarer.api.ui.TooltipMakerAPI
import org.magiclib.bounty.ActiveBounty
import org.magiclib.bounty.intel.filters.LocationParam
import org.magiclib.bounty.ui.lists.filtered.Filterable
import org.magiclib.bounty.ui.lists.filtered.FilterableParam
import org.magiclib.bounty.ui.lists.sorted.Sortable
import org.magiclib.bounty.ui.lists.sorted.SortableParam
import org.magiclib.util.MagicTxt
import java.awt.Color

interface BountyInfo : Filterable<BountyInfo> {
interface BountyInfo : Sortable<BountyInfo> {
fun getBountyId(): String
fun getBountyName(): String
fun getBountyType(): String
fun getBountyPayout(): Int
fun getJobIcon(): String?
fun getLocationIfBountyIsActive(): LocationAPI?
fun getSortIndex(): Int = 1
fun getPlayerKnownDistanceIfBountyIsActive(): Float?

fun getCustomPanelColor(): Color?
fun setCustomPanelColor(value: Color?)

fun addNotificationBulletpoints(info: TooltipMakerAPI) {
}

Expand Down Expand Up @@ -49,9 +53,9 @@ interface BountyInfo : Filterable<BountyInfo> {

fun layoutPanel(tooltip: TooltipMakerAPI, width: Float, height: Float)

override fun getFilterData(): List<FilterableParam<BountyInfo, *>> {
override fun getSorterData(): List<SortableParam<BountyInfo, *>> {
return mutableListOf(
LocationParam(this)
//LocatioParam(this)
)
}

Expand Down
25 changes: 14 additions & 11 deletions src/org/magiclib/bounty/intel/BountyListPanelPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import com.fs.starfarer.api.ui.TooltipMakerAPI
import com.fs.starfarer.api.ui.UIPanelAPI
import com.fs.starfarer.api.util.Misc
import org.lwjgl.opengl.GL11
import org.magiclib.bounty.intel.filters.LocationFilter
import org.magiclib.bounty.intel.sorters.TogglePrimarySorter
import org.magiclib.bounty.ui.BaseUIPanelPlugin
import org.magiclib.bounty.ui.lists.ListItemUIPanelPlugin
import org.magiclib.bounty.ui.lists.filtered.FilteredListPanelPlugin
import org.magiclib.bounty.ui.lists.filtered.ListFilter
import org.magiclib.bounty.ui.lists.sorted.ListSorter
import org.magiclib.bounty.ui.lists.sorted.SortedListPanelPlugin
import org.magiclib.kotlin.setAlpha
import org.magiclib.util.MagicTxt
import java.awt.Color

class BountyListPanelPlugin(parentPanel: CustomPanelAPI) : FilteredListPanelPlugin<BountyInfo>(parentPanel) {
class BountyListPanelPlugin(parentPanel: CustomPanelAPI) : SortedListPanelPlugin<BountyInfo>(parentPanel) {
override val rowWidth
get() = panelWidth - 4f
override val rowHeight = 68f
Expand All @@ -27,11 +27,11 @@ class BountyListPanelPlugin(parentPanel: CustomPanelAPI) : FilteredListPanelPlug
private var selectedItem: BountyInfo? = null
private var finalItem: BountyInfo? = null

override fun getApplicableFilters(): List<ListFilter<BountyInfo, *>> {
return listOf(LocationFilter())
override fun getApplicableSorters(): List<ListSorter<BountyInfo, *>> {
return listOf(TogglePrimarySorter())
}

override fun getFiltersFromItem(item: BountyInfo): List<String> {
override fun getSortersFromItem(item: BountyInfo): List<String> {
return listOf(item.getBountyType())
}

Expand All @@ -55,7 +55,7 @@ class BountyListPanelPlugin(parentPanel: CustomPanelAPI) : FilteredListPanelPlug
}

override fun layoutPanels(members: List<BountyInfo>): CustomPanelAPI {
finalItem = members.lastOrNull()
finalItem = members.maxByOrNull { it.getSortIndex() }

val outerPanelLocal = super.layoutPanels(members)

Expand Down Expand Up @@ -142,9 +142,12 @@ class BountyListPanelPlugin(parentPanel: CustomPanelAPI) : FilteredListPanelPlug
ListItemUIPanelPlugin<BountyInfo>(item) {
private var wasHovered: Boolean = false
private var wasSelected: Boolean = false
var baseBgColor: Color = Color(255, 255, 255, 0)
var hoveredColor: Color = Misc.getBasePlayerColor().setAlpha(75)
var selectedColor: Color = Misc.getBasePlayerColor().setAlpha(125)
val defaultBgColor: Color = Color(255, 255, 255, 0)
val defaultHoveredColor: Color = Misc.getBasePlayerColor().setAlpha(75)
val defaultSelectedColor: Color = Misc.getBasePlayerColor().setAlpha(125)
var baseBgColor: Color = defaultBgColor
var hoveredColor: Color = defaultHoveredColor
var selectedColor: Color = defaultSelectedColor
override var bgColor: Color = baseBgColor

override fun layoutPanel(tooltip: TooltipMakerAPI): CustomPanelAPI {
Expand Down
3 changes: 0 additions & 3 deletions src/org/magiclib/bounty/intel/MagicBountyBoardProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ class MagicBountyBoardProvider: BountyBoardProvider {
.entries
.distinctBy { it.key }
.map { (key, spec) ->
if (spec.job_type == MagicBountyLoader.JobType.Assassination)
AssassinationMagicBountyInfo(key, spec)
else
MagicBountyInfo(key, spec)
}
}
Expand Down
Loading