killtype

package
v0.1.84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package killtype is the kill-list type registry.

A "type" is one of the named subsets the site slices killmails by — highsec, titans, solo, 10b and so on. Two things consume it and they must never disagree: the SQL predicates that select a subset for a page, and the classifier that bumps the kills_daily_count rollup as each killmail arrives. If they drift, the count in the navigation stops matching the list behind it.

The subsets are deliberately not mutually exclusive. A seven-billion ISK solo titan loss in nullsec belongs to `latest`, `nullsec`, `solo`, `big`, `5b` and `titans` at once, and each of those counts it.

Index

Constants

View Source
const (
	BigISK      = 1_000_000_000
	FiveBISK    = 5_000_000_000
	TenBISK     = 10_000_000_000
	HundredBISK = 100_000_000_000
	TrillionISK = 1_000_000_000_000
)

ISK thresholds. Non-exclusive: a 7b kill is both `big` and `5b`.

View Source
const (
	WSpaceRegionMin  = 11_000_001
	WSpaceRegionMax  = 11_000_033
	AbyssalRegionMin = 12_000_001
	AbyssalRegionMax = 12_000_005
	PochvenRegionID  = 10_000_070

	// NullsecMaxRegionID is the w-space floor: nullsec is security <= 0 in any
	// region below it, which excludes wormholes and abyssal pockets that also
	// have non-positive security.
	NullsecMaxRegionID = 11_000_000
)

Region ranges. Wormhole and abyssal space occupy contiguous blocks of region ids, which is why they are ranges rather than lists.

View Source
const (
	CategoryIDShip        = 6
	CategoryIDDrone       = 18
	CategoryIDDeployable  = 22
	CategoryIDStarbase    = 23
	CategoryIDSovereignty = 40
	CategoryIDOrbital     = 46
	CategoryIDCitadel     = 65
	CategoryIDFighter     = 87
	CategoryIDInfantry    = 350001
	MetaT2                = 2
	MetaFaction           = 4
	MetaT3Strategic       = 14
)

SDE-derived constants used by the meta-group subsets.

Variables

View Source
var JoveRegionIDs = []int32{10_000_004, 10_000_017, 10_000_019}

JoveRegionIDs are the unreachable Jove regions.

View Source
var Labels = []Label{
	{ID: "highsec", Name: "Highsec", Category: "Space", Description: "Killmails in systems whose displayed security rounds to 0.5 or higher.", Search: searchLocation("highsec")},
	{ID: "lowsec", Name: "Lowsec", Category: "Space", Description: "Killmails in systems with security above 0.0 and below the highsec boundary.", Search: searchLocation("lowsec")},
	{ID: "nullsec", Name: "Nullsec", Category: "Space", Description: "Killmails in ordinary New Eden systems with security at or below 0.0.", Search: searchLocation("nullsec")},
	{ID: "wspace", Name: "W-Space", Category: "Space", Description: "Killmails in wormhole-space regions.", Search: searchLocation("wspace")},
	{ID: "abyssal", Name: "Abyssal", Category: "Space", Description: "Killmails in Abyssal regions.", Search: searchLocation("abyssal")},
	{ID: "pochven", Name: "Pochven", Category: "Space", Description: "Killmails in the Pochven region.", Search: searchLocation("pochven")},
	{ID: "jove", Name: "Jove Space", Category: "Space", Description: "Killmails associated with the unreachable Jove regions."},

	{ID: "timezone-au", Name: "AU Timezone", Category: "Timezone", Description: "Killmails from 08:00 through 13:59 UTC."},
	{ID: "timezone-ru", Name: "RU Timezone", Category: "Timezone", Description: "Killmails from 14:00 through 16:59 UTC."},
	{ID: "timezone-eu", Name: "EU Timezone", Category: "Timezone", Description: "Killmails from 17:00 through 21:59 UTC."},
	{ID: "timezone-us-east", Name: "US East Timezone", Category: "Timezone", Description: "Killmails from 22:00 through 03:59 UTC."},
	{ID: "timezone-us-west", Name: "US West Timezone", Category: "Timezone", Description: "Killmails from 04:00 through 07:59 UTC."},

	{ID: "solo", Name: "Solo", Category: "Engagement", Description: "PvP killmails with exactly one player attacker.", Search: map[string]any{"attackerCount": "solo"}},
	{ID: "attackers-1", Name: "1 Attacker (Non-solo)", Category: "Engagement", Description: "Killmails with one recorded attacker that are not classified as solo."},
	{ID: "attackers-2-4", Name: "2–4 Attackers", Category: "Engagement", Description: "Killmails with two through four attackers."},
	{ID: "attackers-5-9", Name: "5–9 Attackers", Category: "Engagement", Description: "Killmails with five through nine attackers."},
	{ID: "attackers-10-24", Name: "10–24 Attackers", Category: "Engagement", Description: "Killmails with ten through twenty-four attackers."},
	{ID: "attackers-25-49", Name: "25–49 Attackers", Category: "Engagement", Description: "Killmails with twenty-five through forty-nine attackers."},
	{ID: "attackers-50-99", Name: "50–99 Attackers", Category: "Engagement", Description: "Killmails with fifty through ninety-nine attackers."},
	{ID: "attackers-100-999", Name: "100–999 Attackers", Category: "Engagement", Description: "Killmails with one hundred through nine hundred ninety-nine attackers."},
	{ID: "attackers-1000-plus", Name: "1,000+ Attackers", Category: "Engagement", Description: "Killmails with at least one thousand attackers."},
	{ID: "pvp", Name: "PvP", Category: "Killmail Type", Description: "Killmails attributed to player combat."},
	{ID: "ganked", Name: "Ganked", Category: "Killmail Type", Description: "Non-NPC highsec killmails with at least ten attackers.", Search: map[string]any{"attackerType": "ganked"}},
	{ID: "npc", Name: "NPC", Category: "Engagement", Description: "Killmails classified as NPC kills.", Search: map[string]any{"attackerType": "npc"}},
	{ID: "awox", Name: "Awox", Category: "Involvement", Description: "Non-NPC kills where the final-blow attacker belongs to the victim's corporation."},
	{ID: "capital-involved", Name: "Capital Involved", Category: "Involvement", Description: "A capital-class victim or attacker participated in the killmail."},
	{ID: "supercarrier-involved", Name: "Supercarrier Involved", Category: "Involvement", Description: "A supercarrier victim or attacker participated in the killmail."},
	{ID: "titan-involved", Name: "Titan Involved", Category: "Involvement", Description: "A titan victim or attacker participated in the killmail."},
	{ID: "at-ship-involved", Name: "AT Ship Involved", Category: "Involvement", Description: "An Alliance Tournament prize ship was the victim or an attacker."},

	{ID: "fw-caldari-winner", Name: "Caldari FW Victory", Category: "Faction Warfare", Description: "Caldari militia defeated a Gallente militia victim."},
	{ID: "fw-gallente-winner", Name: "Gallente FW Victory", Category: "Faction Warfare", Description: "Gallente militia defeated a Caldari militia victim."},
	{ID: "fw-amarr-winner", Name: "Amarr FW Victory", Category: "Faction Warfare", Description: "Amarr militia defeated a Minmatar militia victim."},
	{ID: "fw-minmatar-winner", Name: "Minmatar FW Victory", Category: "Faction Warfare", Description: "Minmatar militia defeated an Amarr militia victim."},
	{ID: "fw-caldari-gallente", Name: "Caldari–Gallente FW", Category: "Faction Warfare", Description: "Faction-warfare combat between the Caldari and Gallente militias."},
	{ID: "fw-amarr-minmatar", Name: "Amarr–Minmatar FW", Category: "Faction Warfare", Description: "Faction-warfare combat between the Amarr and Minmatar militias."},

	{ID: "big", Name: "1B+ ISK", Category: "Value", Description: "Killmails valued at one billion ISK or more.", Search: map[string]any{"iskValue": "1b"}},
	{ID: "5b", Name: "5B+ ISK", Category: "Value", Description: "Killmails valued at five billion ISK or more.", Search: map[string]any{"iskValue": "5b"}},
	{ID: "10b", Name: "10B+ ISK", Category: "Value", Description: "Killmails valued at ten billion ISK or more.", Search: map[string]any{"iskValue": "10b"}},
	{ID: "under-1b", Name: "Under 1B ISK", Category: "Value Bands", Description: "Killmails valued below one billion ISK."},
	{ID: "1b-5b", Name: "1B–5B ISK", Category: "Value Bands", Description: "Killmails valued from one billion up to five billion ISK."},
	{ID: "5b-10b", Name: "5B–10B ISK", Category: "Value Bands", Description: "Killmails valued from five billion up to ten billion ISK."},
	{ID: "10b-100b", Name: "10B–100B ISK", Category: "Value Bands", Description: "Killmails valued from ten billion up to one hundred billion ISK."},
	{ID: "100b-1t", Name: "100B–1T ISK", Category: "Value Bands", Description: "Killmails valued from one hundred billion up to one trillion ISK."},
	{ID: "1t-plus", Name: "1T+ ISK", Category: "Value Bands", Description: "Killmails valued at one trillion ISK or more."},

	{ID: "category-deployable", Name: "Deployable", Category: "Victim Category", Description: "Victims in the Deployable inventory category."},
	{ID: "category-drone", Name: "Drone", Category: "Victim Category", Description: "Victims in the Drone inventory category."},
	{ID: "category-fighter", Name: "Fighter", Category: "Victim Category", Description: "Victims in the Fighter inventory category."},
	{ID: "category-orbital", Name: "Orbital", Category: "Victim Category", Description: "Victims in the Orbitals inventory category."},
	{ID: "category-starbase", Name: "Starbase", Category: "Victim Category", Description: "Victims in the Starbase inventory category."},
	{ID: "category-ship", Name: "Ship", Category: "Victim Category", Description: "Victims in the Ship inventory category."},
	{ID: "category-sovereignty", Name: "Sovereignty Structure", Category: "Victim Category", Description: "Victims in the Sovereignty Structures inventory category."},
	{ID: "category-structure", Name: "Structure", Category: "Victim Category", Description: "Victims in the Structure inventory category."},
	{ID: "category-infantry", Name: "Infantry", Category: "Victim Category", Description: "Victims in the Infantry inventory category."},

	{ID: "frigates", Name: "Frigates", Category: "Victim Hull", Description: "Destroyed frigate-class hulls.", Search: searchShipCategory("frigates")},
	{ID: "destroyers", Name: "Destroyers", Category: "Victim Hull", Description: "Destroyed destroyer-class hulls.", Search: searchShipCategory("destroyers")},
	{ID: "cruisers", Name: "Cruisers", Category: "Victim Hull", Description: "Destroyed cruiser-class hulls.", Search: searchShipCategory("cruisers")},
	{ID: "battlecruisers", Name: "Battlecruisers", Category: "Victim Hull", Description: "Destroyed battlecruiser-class hulls.", Search: searchShipCategory("battlecruisers")},
	{ID: "battleships", Name: "Battleships", Category: "Victim Hull", Description: "Destroyed battleship-class hulls.", Search: searchShipCategory("battleships")},
	{ID: "capitals", Name: "Capitals", Category: "Victim Hull", Description: "Destroyed capital, supercapital, or titan hulls.", Search: searchShipCategory("capitals")},
	{ID: "freighters", Name: "Freighters", Category: "Victim Hull", Description: "Destroyed freighter or jump-freighter hulls.", Search: searchShipCategory("freighters")},
	{ID: "supercarriers", Name: "Supercarriers", Category: "Victim Hull", Description: "Destroyed supercarrier hulls.", Search: searchShipCategory("supercarriers")},
	{ID: "titans", Name: "Titans", Category: "Victim Hull", Description: "Destroyed titan hulls.", Search: searchShipCategory("titans")},
	{ID: "citadels", Name: "Structures", Category: "Victim Hull", Description: "Destroyed Upwell structure hulls.", Search: searchShipCategory("citadels")},

	{ID: "t1", Name: "Tech I", Category: "Technology", Description: "Destroyed Tech I hulls.", Search: searchTech("t1")},
	{ID: "t2", Name: "Tech II", Category: "Technology", Description: "Destroyed Tech II hulls.", Search: searchTech("t2")},
	{ID: "t3", Name: "Tech III", Category: "Technology", Description: "Destroyed Tech III strategic-cruiser hulls.", Search: searchTech("t3")},
	{ID: "faction", Name: "Faction", Category: "Technology", Description: "Destroyed faction hulls.", Search: searchTech("faction")},
}

Labels is the public classification catalogue in display order. `latest` is deliberately absent: it is the unfiltered feed, not a classification.

View Source
var ShipGroups = map[string][]int32{
	"frigates":       {25, 324, 830, 831, 834, 893, 1283, 1527},
	"destroyers":     {420, 1305, 1534},
	"cruisers":       {26, 358, 832, 833, 906, 894, 963, 1972},
	"battlecruisers": {419, 1201, 540},
	"battleships":    {27, 898, 900},
	"capitals":       {547, 485, 1538, 883, 659, 30, 4594},
	"freighters":     {513, 902},
	"supercarriers":  {659},
	"titans":         {30},
}

ShipGroups are the victim ship group ids per hull class, taken from the SDE and stable across patches.

View Source
var StableFactTypes = []string{
	"awox", "capital-involved", "supercarrier-involved", "titan-involved", "at-ship-involved",
	"fw-caldari-winner", "fw-gallente-winner", "fw-amarr-winner", "fw-minmatar-winner",
	"fw-caldari-gallente", "fw-amarr-minmatar",
}

StableFactTypes are the rollups affected by the attacker-derived stable-fact backfill. Operators can pass this list to kills-daily-count without rebuilding unrelated labels.

View Source
var Types = []string{
	"latest",
	"highsec", "lowsec", "nullsec", "wspace", "abyssal", "pochven", "jove",
	"timezone-au", "timezone-ru", "timezone-eu", "timezone-us-east", "timezone-us-west",
	"solo", "attackers-1", "attackers-2-4", "attackers-5-9", "attackers-10-24",
	"attackers-25-49", "attackers-50-99", "attackers-100-999", "attackers-1000-plus",
	"pvp", "ganked", "npc",
	"awox", "capital-involved", "supercarrier-involved", "titan-involved", "at-ship-involved",
	"fw-caldari-winner", "fw-gallente-winner", "fw-amarr-winner", "fw-minmatar-winner",
	"fw-caldari-gallente", "fw-amarr-minmatar",
	"big", "5b", "10b",
	"under-1b", "1b-5b", "5b-10b", "10b-100b", "100b-1t", "1t-plus",
	"category-deployable", "category-drone",
	"category-fighter", "category-orbital", "category-starbase", "category-ship",
	"category-sovereignty", "category-structure", "category-infantry",
	"frigates", "destroyers", "cruisers", "battlecruisers", "battleships",
	"capitals", "freighters", "supercarriers", "titans",
	"citadels", "t1", "t2", "t3", "faction",
}

Types is every kill-list type, in display order.

Functions

func AttackerBucket added in v0.1.50

func AttackerBucket(n int32) string

func CategoryType added in v0.1.50

func CategoryType(id int32) string

func Classify

func Classify(s Subject) []string

Classify returns every subset a killmail belongs to.

This must agree exactly with Predicates: the counts it produces are what the navigation shows, and the predicates are what the list behind that number selects. A kill counted here but not selected there is a page that says 41 and shows 40.

func Predicates

func Predicates() map[string]string

Predicates returns the SQL WHERE fragment for each type, written against the `k` alias of the killmails table.

These are fragments rather than parameterised queries because they are composed into an INSERT ... SELECT that groups over a date range; every value in them is a compile-time constant from this file, never input.

`latest` is "TRUE" on purpose so the same INSERT ... SELECT shape works for it without a special case.

func RegionBucket

func RegionBucket(regionID int32) string

RegionBucket classifies a kill by the kind of space its region is.

Checked before the wormhole range because Pochven and the Jove regions sit outside it but are likewise not ordinary nullsec.

func SecurityBucket

func SecurityBucket(security float64, hasSecurity bool, regionID int32) string

SecurityBucket classifies a kill by the security of the system it happened in, mirroring the highsec/lowsec/nullsec predicates exactly.

Returns "" for kills that belong to none of them — wormhole, abyssal, Pochven and Jove space are region-based and handled by RegionBucket instead.

func ShipClass

func ShipClass(groupID int32) []string

ShipClass returns the hull class subset a victim ship group belongs to, or "" when it belongs to none.

A group can appear in more than one class — 30 (titans) and 659 (supercarriers) are both also capitals — so this reports the most specific one and Classify records the rest.

func TimezoneBucket added in v0.1.50

func TimezoneBucket(t time.Time) string

Types

type Label added in v0.1.50

type Label struct {
	ID          string
	Name        string
	Description string
	Category    string
	Search      map[string]any
}

Label describes one public killmail classification. The ID is also the kill-list type and kills_daily_count type, which keeps the explorer, list, historical SQL and live classifier on one stable contract.

type Subject

type Subject struct {
	KillmailTime time.Time
	Security     float64
	HasSecurity  bool
	RegionID     int32

	IsSolo            bool
	IsNPC             bool
	AttackerCount     int32
	IsAwox            bool
	IsCapitalInvolved bool
	IsSuperInvolved   bool
	IsTitanInvolved   bool
	IsATShipInvolved  bool
	FWWinnerFactionID int32

	TotalValue    float64
	HasTotalValue bool

	VictimShipGroupID int32

	// GroupCategoryID is the SDE category of the victim's hull group. Only
	// CategoryIDCitadel is interesting, but the caller has it for free from the
	// same lookup that produced the group.
	GroupCategoryID int32

	// MetaGroupID is the victim hull's meta group. Zero and one both mean T1 —
	// the SDE leaves it null for ordinary hulls.
	MetaGroupID    int32
	HasVictimShip  bool
	HasVictimGroup bool
}

Subject is the part of a killmail that decides which subsets it belongs to.

Assembled by the caller rather than read from the killmail row, because the two things it needs beyond the row — the system's security and the victim hull's meta group — live in the SDE cache, and the classifier must not reach for a database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL