tiger_lib/
item.rs

1//! Giant enum for all the [`Item`] types in the game.
2
3use std::fmt::{Display, Formatter};
4
5use strum_macros::{EnumCount, EnumIter, IntoStaticStr};
6
7use crate::block::Block;
8use crate::db::Db;
9#[cfg(doc)]
10use crate::everything::Everything;
11use crate::game::{Game, GameFlags};
12use crate::pdxfile::PdxEncoding;
13use crate::report::{Confidence, Severity};
14use crate::token::Token;
15
16/// "items" are all the things that can be looked up in the game databases.
17/// Anything that can be looked up in script with a literal string key, or that's loaded into
18/// tiger's database and needs a unique key, is an `Item`.
19///
20/// There is some overlap with scopes, for example "culture" is both an `Item` and a scope type,
21/// but the difference is that scopes are runtime values while items are always strings.
22///
23/// For example if a trigger takes a culture *scope*, you could supply either `culture:german` or
24/// `scope:target_culture`, while if a trigger takes a culture *item*, you would have to supply just
25/// `german` and don't have the option of supplying something determined at runtime.
26#[derive(Copy, Clone, Debug, PartialEq, Eq, IntoStaticStr, Hash, PartialOrd, Ord, EnumCount, EnumIter)]
27#[strum(serialize_all = "snake_case")]
28#[non_exhaustive]
29// The item table is in several alphabetized sections. First the generic items, then items used by
30// multiple games, then a section for each game.
31//
32// Each item is marked with a cfg clause for its game. This is not strictly necessary, but it helps
33// prevent "leakage" between the games, where they accidentally use each other's item types.
34#[rustfmt::skip] // having cfg and the variant on the same line is much more readable
35pub enum Item {
36    // Generic items used by all games and assumed to be there by the validators in
37    // non-game-specific `data` modules.
38    #[cfg(feature = "jomini")]
39    Accessory,
40    #[cfg(feature = "jomini")]
41    AccessoryTag,
42    #[cfg(feature = "jomini")]
43    AccessoryVariation,
44    #[cfg(feature = "jomini")]
45    AccessoryVariationLayout,
46    #[cfg(feature = "jomini")]
47    AccessoryVariationTextures,
48    Achievement,
49    #[cfg(feature = "jomini")]
50    AchievementGroup,
51    Asset,
52    BlendShape,
53    #[cfg(feature = "jomini")]
54    CharacterInteraction,
55    #[cfg(feature = "jomini")]
56    Coa,
57    #[cfg(feature = "jomini")]
58    CoaColorList,
59    #[cfg(feature = "jomini")]
60    CoaColoredEmblemList,
61    #[cfg(feature = "ck3")]
62    CoaDesignerColorPalette,
63    #[cfg(feature = "jomini")]
64    CoaDesignerColoredEmblem,
65    #[cfg(feature = "ck3")]
66    CoaDesignerEmblemLayout,
67    #[cfg(feature = "jomini")]
68    CoaDesignerPattern,
69    #[cfg(feature = "jomini")]
70    CoaPatternList,
71    #[cfg(feature = "jomini")]
72    CoaTemplate,
73    #[cfg(feature = "jomini")]
74    CoaTemplateList,
75    #[cfg(feature = "jomini")]
76    CoaTexturedEmblemList,
77    #[cfg(feature = "jomini")]
78    Culture,
79    #[cfg(feature = "jomini")]
80    CustomLocalization,
81    Decision,
82    Define,
83    Directory,
84    Dlc,
85    DlcFeature,
86    DlcName,
87    #[cfg(feature = "jomini")]
88    EffectLocalization,
89    Entity,
90    Entry,
91    #[cfg(feature = "jomini")]
92    Ethnicity,
93    Event,
94    EventNamespace,
95    File,
96    Font,
97    Fontfiles,
98    #[cfg(feature = "jomini")]
99    GameConcept,
100    GameRule,
101    GameRuleSetting,
102    #[cfg(feature = "jomini")]
103    GeneAgePreset,
104    #[cfg(feature = "jomini")]
105    GeneAttribute,
106    #[cfg(feature = "jomini")]
107    GeneCategory,
108    #[cfg(feature = "jomini")]
109    GovernmentType,
110    GuiLayer,
111    GuiTemplate,
112    GuiType,
113    #[cfg(feature = "jomini")]
114    LawGroup,
115    Localization,
116    MapEnvironment,
117    MapMode,
118    Modifier,
119    Music,
120    #[cfg(feature = "jomini")]
121    MusicPlayerCategory,
122    #[cfg(feature = "jomini")]
123    NamedColor,
124    OnAction,
125    Pdxmesh,
126    #[cfg(feature = "jomini")]
127    PortraitAnimation,
128    #[cfg(feature = "jomini")]
129    PortraitCamera,
130    #[cfg(feature = "jomini")]
131    PortraitEnvironment,
132    #[cfg(feature = "jomini")]
133    PortraitModifierGroup,
134    #[cfg(feature = "jomini")]
135    PortraitModifierPack,
136    Province,
137    #[cfg(feature = "jomini")]
138    Religion,
139    ScriptedEffect,
140    ScriptedGui,
141    #[cfg(feature = "jomini")]
142    ScriptedList,
143    #[cfg(feature = "jomini")]
144    ScriptedModifier,
145    #[cfg(feature = "jomini")]
146    ScriptedRule,
147    ScriptedTrigger,
148    #[cfg(feature = "jomini")]
149    ScriptValue,
150    Shortcut,
151    Sound,
152    Terrain,
153    TextFormat,
154    TextIcon,
155    TextureFile,
156    #[cfg(feature = "jomini")]
157    TriggerLocalization,
158    WidgetName,
159
160    // Items shared by more than one game
161    #[cfg(any(feature = "vic3", feature = "hoi4"))]
162    AiStrategy,
163    #[cfg(any(feature = "ck3", feature = "imperator", feature = "hoi4"))]
164    Building,
165    #[cfg(any(feature = "ck3", feature = "hoi4"))]
166    Character,
167    #[cfg(any(feature = "ck3", feature = "vic3"))]
168    CharacterTemplate,
169    #[cfg(any(feature = "vic3", feature = "imperator"))]
170    CharacterTrait,
171    #[cfg(any(feature = "imperator", feature = "hoi4"))]
172    CombatTactic,
173    #[cfg(any(feature = "vic3", feature = "imperator", feature = "hoi4"))]
174    Country,
175    #[cfg(any(feature = "ck3", feature = "imperator"))]
176    DeathReason,
177    #[cfg(any(feature = "ck3", feature = "vic3"))]
178    Dna,
179    #[cfg(any(feature = "ck3", feature = "imperator"))]
180    EventTheme,
181    #[cfg(any(feature = "imperator", feature = "hoi4"))]
182    Idea,
183    #[cfg(any(feature = "vic3", feature = "hoi4"))]
184    Ideology,
185    #[cfg(any(feature = "ck3", feature = "imperator"))]
186    Law,
187    #[cfg(any(feature = "ck3", feature = "vic3"))]
188    Message,
189    #[cfg(any(feature = "imperator", feature = "hoi4"))]
190    Mission,
191    #[cfg(any(feature = "vic3", feature = "imperator"))]
192    PopType,
193    #[cfg(any(feature = "ck3", feature = "imperator"))]
194    Region,
195    #[cfg(any(feature = "vic3", feature = "hoi4"))] 
196    StrategicRegion,
197    #[cfg(any(feature = "vic3", feature = "imperator"))]
198    SubjectType,
199    #[cfg(any(feature = "vic3", feature = "hoi4"))]
200    Technology,
201    #[cfg(any(feature = "ck3", feature = "vic3"))]
202    TutorialLesson,
203    #[cfg(any(feature = "ck3", feature = "vic3"))]
204    TutorialLessonChain,
205    #[cfg(any(feature = "ck3", feature = "vic3"))]
206    TutorialLessonStep,
207    #[cfg(any(feature = "vic3", feature = "imperator"))]
208    Wargoal,
209
210    // Items for ck3
211    #[cfg(feature = "ck3")] AccoladeCategory,
212    #[cfg(feature = "ck3")] AccoladeIcon,
213    #[cfg(feature = "ck3")] AccoladeName,
214    #[cfg(feature = "ck3")] AccoladeParameter,
215    #[cfg(feature = "ck3")] AccoladeType,
216    #[cfg(feature = "ck3")] ActivityGroupType,
217    #[cfg(feature = "ck3")] ActivityIntent,
218    #[cfg(feature = "ck3")] ActivityLocale,
219    #[cfg(feature = "ck3")] ActivityOption,
220    #[cfg(feature = "ck3")] ActivityOptionCategory,
221    #[cfg(feature = "ck3")] ActivityPhase,
222    #[cfg(feature = "ck3")] ActivityPulseAction,
223    #[cfg(feature = "ck3")] ActivityState,
224    #[cfg(feature = "ck3")] ActivityType,
225    #[cfg(feature = "ck3")] AiWarStance,
226    #[cfg(feature = "ck3")] AgentType,
227    #[cfg(feature = "ck3")] Amenity,
228    #[cfg(feature = "ck3")] AmenitySetting,
229    #[cfg(feature = "ck3")] ArtifactBlueprint,
230    #[cfg(feature = "ck3")] ArtifactFeature,
231    #[cfg(feature = "ck3")] ArtifactFeatureGroup,
232    #[cfg(feature = "ck3")] ArtifactHistory,
233    #[cfg(feature = "ck3")] ArtifactRarity,
234    #[cfg(feature = "ck3")] ArtifactSlot,
235    #[cfg(feature = "ck3")] ArtifactSlotType,
236    #[cfg(feature = "ck3")] ArtifactTemplate,
237    #[cfg(feature = "ck3")] ArtifactType,
238    #[cfg(feature = "ck3")] ArtifactVisual,
239    #[cfg(feature = "ck3")] Bookmark,
240    #[cfg(feature = "ck3")] BookmarkGroup,
241    #[cfg(feature = "ck3")] BookmarkPortrait,
242    #[cfg(feature = "ck3")] BuildingFlag,
243    #[cfg(feature = "ck3")] BuildingGfx,
244    #[cfg(feature = "ck3")] CasusBelli,
245    #[cfg(feature = "ck3")] CasusBelliGroup,
246    #[cfg(feature = "ck3")] Catalyst,
247    #[cfg(feature = "ck3")] ChallengeCharacter,
248    #[cfg(feature = "ck3")] CharacterBackground,
249    #[cfg(feature = "ck3")] CharacterInteractionCategory,
250    #[cfg(feature = "ck3")] Climate,
251    #[cfg(feature = "ck3")] ClothingGfx,
252    #[cfg(feature = "ck3")] CoaGfx,
253    #[cfg(feature = "ck3")] CoaDynamicDefinition,
254    #[cfg(feature = "ck3")] CombatEffect,
255    #[cfg(feature = "ck3")] CombatPhaseEvent,
256    #[cfg(feature = "ck3")] CouncilPosition,
257    #[cfg(feature = "ck3")] CouncilTask,
258    #[cfg(feature = "ck3")] Countermeasure,
259    #[cfg(feature = "ck3")] CountermeasureParameter,
260    #[cfg(feature = "ck3")] CourtPosition,
261    #[cfg(feature = "ck3")] CourtPositionTask,
262    #[cfg(feature = "ck3")] CourtSceneCulture,
263    #[cfg(feature = "ck3")] CourtSceneGroup,
264    #[cfg(feature = "ck3")] CourtSceneRole,
265    #[cfg(feature = "ck3")] CourtSceneSetting,
266    #[cfg(feature = "ck3")] CourtType,
267    #[cfg(feature = "ck3")] CourtierGuestManagement,
268    #[cfg(feature = "ck3")] CultureAesthetic,
269    #[cfg(feature = "ck3")] CultureCreationName,
270    #[cfg(feature = "ck3")] CultureEra,
271    #[cfg(feature = "ck3")] CultureEthos,
272    #[cfg(feature = "ck3")] CultureHeritage,
273    #[cfg(feature = "ck3")] CultureHistory,
274    #[cfg(feature = "ck3")] CultureParameter,
275    #[cfg(feature = "ck3")] CulturePillar,
276    #[cfg(feature = "ck3")] CultureTradition,
277    #[cfg(feature = "ck3")] CultureTraditionCategory,
278    #[cfg(feature = "ck3")] DangerType,
279    #[cfg(feature = "ck3")] DecisionGroup,
280    #[cfg(feature = "ck3")] DiarchyMandate,
281    #[cfg(feature = "ck3")] DiarchyParameter,
282    #[cfg(feature = "ck3")] DiarchyType,
283    #[cfg(feature = "ck3")] Doctrine,
284    #[cfg(feature = "ck3")] DoctrineBooleanParameter,
285    #[cfg(feature = "ck3")] DoctrineCategory,
286    #[cfg(feature = "ck3")] DoctrineParameter,
287    #[cfg(feature = "ck3")] DomicileBuilding,
288    #[cfg(feature = "ck3")] DomicileParameter,
289    #[cfg(feature = "ck3")] DomicileType,
290    #[cfg(feature = "ck3")] Dynasty,
291    #[cfg(feature = "ck3")] DynastyLegacy,
292    #[cfg(feature = "ck3")] DynastyPerk,
293    #[cfg(feature = "ck3")] EpidemicType,
294    #[cfg(feature = "ck3")] EpidemicDeathReason,
295    #[cfg(feature = "ck3")] EventBackground,
296    #[cfg(feature = "ck3")] EventEffect2d,
297    #[cfg(feature = "ck3")] EventTransition,
298    #[cfg(feature = "ck3")] Faction,
299    #[cfg(feature = "ck3")] Faith,
300    #[cfg(feature = "ck3")] FaithIcon,
301    #[cfg(feature = "ck3")] FervorModifier,
302    #[cfg(feature = "ck3")] Flavorization,
303    #[cfg(feature = "ck3")] Focus,
304    #[cfg(feature = "ck3")] GeneticConstraint,
305    #[cfg(feature = "ck3")] GovernmentFlag,
306    #[cfg(feature = "ck3")] GraphicalFaith,
307    #[cfg(feature = "ck3")] GuestInviteRule,
308    #[cfg(feature = "ck3")] GuestSubset,
309    #[cfg(feature = "ck3")] GuestSystem,
310    #[cfg(feature = "ck3")] HeadDetermination,
311    #[cfg(feature = "ck3")] HoldingParameter,
312    #[cfg(feature = "ck3")] HoldingType,
313    #[cfg(feature = "ck3")] HolySite,
314    #[cfg(feature = "ck3")] HolySiteFlag,
315    #[cfg(feature = "ck3")] Hook,
316    #[cfg(feature = "ck3")] House,
317    #[cfg(feature = "ck3")] HousePowerBonus,
318    #[cfg(feature = "ck3")] HouseUnity,
319    #[cfg(feature = "ck3")] HouseUnityParameter,
320    #[cfg(feature = "ck3")] HouseUnityStage,
321    #[cfg(feature = "ck3")] ImportantAction,
322    #[cfg(feature = "ck3")] Innovation,
323    #[cfg(feature = "ck3")] InnovationFlag,
324    #[cfg(feature = "ck3")] Inspiration,
325    #[cfg(feature = "ck3")] Language,
326    #[cfg(feature = "ck3")] LawFlag,
327    #[cfg(feature = "ck3")] LeaseContract,
328    #[cfg(feature = "ck3")] LegendChapter,
329    #[cfg(feature = "ck3")] LegendChronicle,
330    #[cfg(feature = "ck3")] LegendProperty,
331    #[cfg(feature = "ck3")] LegendSeed,
332    #[cfg(feature = "ck3")] LegendType,
333    #[cfg(feature = "ck3")] LegitimacyFlag,
334    #[cfg(feature = "ck3")] LegitimacyType,
335    #[cfg(feature = "ck3")] Lifestyle,
336    #[cfg(feature = "ck3")] LineType,
337    #[cfg(feature = "ck3")] MartialCustom,
338    #[cfg(feature = "ck3")] MemoryCategory,
339    #[cfg(feature = "ck3")] MemoryType,
340    #[cfg(feature = "ck3")] MenAtArms,
341    #[cfg(feature = "ck3")] MenAtArmsBase,
342    #[cfg(feature = "ck3")] MessageFilterType,
343    #[cfg(feature = "ck3")] MessageGroupType,
344    #[cfg(feature = "ck3")] ModifierFormat,
345    #[cfg(feature = "ck3")] MottoInsert,
346    #[cfg(feature = "ck3")] Motto,
347    #[cfg(feature = "ck3")] NameEquivalency,
348    #[cfg(feature = "ck3")] NameList,
349    #[cfg(feature = "ck3")] Nickname,
350    #[cfg(feature = "ck3")] OpinionModifier,
351    #[cfg(feature = "ck3")] Perk,
352    #[cfg(feature = "ck3")] PerkTree,
353    #[cfg(feature = "ck3")] PlayableDifficultyInfo,
354    #[cfg(feature = "ck3")] PointOfInterest,
355    #[cfg(feature = "ck3")] PoolSelector,
356    #[cfg(feature = "ck3")] PortraitType,
357    #[cfg(feature = "ck3")] PrisonType,
358    #[cfg(feature = "ck3")] ProvinceEffect,
359    #[cfg(feature = "ck3")] ProvinceMapping,
360    #[cfg(feature = "ck3")] RaidIntent,
361    #[cfg(feature = "ck3")] Relation,
362    #[cfg(feature = "ck3")] RelationFlag,
363    #[cfg(feature = "ck3")] ReligionFamily,
364    #[cfg(feature = "ck3")] RewardItem,
365    #[cfg(feature = "ck3")] Scheme,
366    #[cfg(feature = "ck3")] SchemePulseAction,
367    #[cfg(feature = "ck3")] ScriptedAnimation,
368    #[cfg(feature = "ck3")] ScriptedCost,
369    #[cfg(feature = "ck3")] ScriptedIllustration,
370    #[cfg(feature = "ck3")] Secret,
371    #[cfg(feature = "ck3")] Sexuality,
372    #[cfg(feature = "ck3")] Situation,
373    #[cfg(feature = "ck3")] SituationCatalyst,
374    #[cfg(feature = "ck3")] SituationHistory,
375    #[cfg(feature = "ck3")] SituationParticipantGroup,
376    #[cfg(feature = "ck3")] SituationPhase,
377    #[cfg(feature = "ck3")] SituationPhaseParameter,
378    #[cfg(feature = "ck3")] SituationSubRegion,
379    #[cfg(feature = "ck3")] Skill,
380    #[cfg(feature = "ck3")] SpecialBuilding,
381    #[cfg(feature = "ck3")] SpecialGuest,
382    #[cfg(feature = "ck3")] Story,
383    #[cfg(feature = "ck3")] Struggle,
384    #[cfg(feature = "ck3")] StruggleHistory,
385    #[cfg(feature = "ck3")] StrugglePhase,
386    #[cfg(feature = "ck3")] StrugglePhaseParameter,
387    #[cfg(feature = "ck3")] SubjectContract,
388    #[cfg(feature = "ck3")] SubjectContractFlag,
389    #[cfg(feature = "ck3")] SubjectContractGroup,
390    #[cfg(feature = "ck3")] SubjectContractObligationLevel,
391    #[cfg(feature = "ck3")] SuccessionAppointment,
392    #[cfg(feature = "ck3")] SuccessionElection,
393    #[cfg(feature = "ck3")] Suggestion,
394    #[cfg(feature = "ck3")] TaskContractGroup,
395    #[cfg(feature = "ck3")] TaskContractReward,
396    #[cfg(feature = "ck3")] TaskContractType,
397    #[cfg(feature = "ck3")] TaxSlotObligation,
398    #[cfg(feature = "ck3")] TaxSlotType,
399    #[cfg(feature = "ck3")] Title,
400    #[cfg(feature = "ck3")] TitleHistory,
401    #[cfg(feature = "ck3")] Trait,
402    #[cfg(feature = "ck3")] TraitCategory,
403    #[cfg(feature = "ck3")] TraitFlag,
404    #[cfg(feature = "ck3")] TraitPortraitModifier,
405    #[cfg(feature = "ck3")] TraitTrack,
406    #[cfg(feature = "ck3")] TravelOption,
407    #[cfg(feature = "ck3")] UnitGfx,
408    #[cfg(feature = "ck3")] VassalStance,
409
410    // Items specific to vic3
411    #[cfg(feature = "vic3")] AcceptanceStatus,
412    #[cfg(feature = "vic3")] AirGraphics,
413    #[cfg(feature = "vic3")] Alert,
414    #[cfg(feature = "vic3")] AlertGroup,
415    #[cfg(feature = "vic3")] Approval,
416    #[cfg(feature = "vic3")] ArmyDiorama,
417    #[cfg(feature = "vic3")] Attitude,
418    #[cfg(feature = "vic3")] BattleCondition,
419    #[cfg(feature = "vic3")] BuildingGroup,
420    #[cfg(feature = "vic3")] BuildingType,
421    #[cfg(feature = "vic3")] BuyPackage,
422    #[cfg(feature = "vic3")] CanalType,
423    #[cfg(feature = "vic3")] CharacterRole,
424    #[cfg(feature = "vic3")] CityBuildingVfx,
425    #[cfg(feature = "vic3")] CityCenterpiece,
426    #[cfg(feature = "vic3")] CityGraphicsType,
427    #[cfg(feature = "vic3")] CityVfx,
428    #[cfg(feature = "vic3")] CombatUnit,
429    #[cfg(feature = "vic3")] CombatUnitExperienceLevel,
430    #[cfg(feature = "vic3")] CombatUnitGroup,
431    #[cfg(feature = "vic3")] CommanderOrder,
432    #[cfg(feature = "vic3")] CommanderRank,
433    #[cfg(feature = "vic3")] CompanyType,
434    #[cfg(feature = "vic3")] CompanyCharterType,
435    #[cfg(feature = "vic3")] CohesionLevel,
436    #[cfg(feature = "vic3")] CountryCreation,
437    #[cfg(feature = "vic3")] CountryFormation,
438    #[cfg(feature = "vic3")] CountryRank,
439    #[cfg(feature = "vic3")] CountryTier,
440    #[cfg(feature = "vic3")] CountryType,
441    #[cfg(feature = "vic3")] CultureGraphics,
442    #[cfg(feature = "vic3")] Decree,
443    #[cfg(feature = "vic3")] DiplomaticAction,
444    #[cfg(feature = "vic3")] DiplomaticCatalyst,
445    #[cfg(feature = "vic3")] DiplomaticCatalystCategory,
446    #[cfg(feature = "vic3")] DiplomaticPlay,
447    #[cfg(feature = "vic3")] DiscriminationTrait,
448    #[cfg(feature = "vic3")] DiscriminationTraitGroup,
449    #[cfg(feature = "vic3")] DynamicCompanyName,
450    #[cfg(feature = "vic3")] DynamicCountryMapColor,
451    #[cfg(feature = "vic3")] DynamicCountryName,
452    #[cfg(feature = "vic3")] DynamicTreatyName,
453    #[cfg(feature = "vic3")] EventCategory,
454    #[cfg(feature = "vic3")] FlagDefinition,
455    #[cfg(feature = "vic3")] FleetDiorama,
456    #[cfg(feature = "vic3")] FrontGraphics,
457    #[cfg(feature = "vic3")] Goods,
458    #[cfg(feature = "vic3")] GradientBorderSettings,
459    #[cfg(feature = "vic3")] HarvestConditionType,
460    #[cfg(feature = "vic3")] HeritageTrait,
461    #[cfg(feature = "vic3")] InfamyThreshold,
462    #[cfg(feature = "vic3")] Institution,
463    #[cfg(feature = "vic3")] InterestGroup,
464    #[cfg(feature = "vic3")] InterestGroupTrait,
465    #[cfg(feature = "vic3")] JournalEntry,
466    #[cfg(feature = "vic3")] JournalEntryGroup,
467    #[cfg(feature = "vic3")] LanguageTrait,
468    #[cfg(feature = "vic3")] LawType,
469    #[cfg(feature = "vic3")] LegitimacyLevel,
470    #[cfg(feature = "vic3")] Level,
471    #[cfg(feature = "vic3")] LibertyDesireLevel,
472    #[cfg(feature = "vic3")] MapLayer,
473    #[cfg(feature = "vic3")] MapInteractionType,
474    #[cfg(feature = "vic3")] MapNotificationType,
475    #[cfg(feature = "vic3")] MediaAlias,
476    #[cfg(feature = "vic3")] MilitaryFormationFlag,
477    #[cfg(feature = "vic3")] MobilizationOption,
478    #[cfg(feature = "vic3")] MobilizationOptionGroup,
479    #[cfg(feature = "vic3")] ModifierTypeDefinition,
480    #[cfg(feature = "vic3")] Objective,
481    #[cfg(feature = "vic3")] ObjectiveSubgoal,
482    #[cfg(feature = "vic3")] ObjectiveSubgoalCategory,
483    #[cfg(feature = "vic3")] Party,
484    #[cfg(feature = "vic3")] PoliticalLobby,
485    #[cfg(feature = "vic3")] PoliticalLobbyAppeasement,
486    #[cfg(feature = "vic3")] PoliticalMovement,
487    #[cfg(feature = "vic3")] PoliticalMovementCategory,
488    #[cfg(feature = "vic3")] PoliticalMovementPopSupport,
489    #[cfg(feature = "vic3")] PopNeed,
490    #[cfg(feature = "vic3")] PowerBlocCoaPiece,
491    #[cfg(feature = "vic3")] PowerBlocIdentity,
492    #[cfg(feature = "vic3")] PowerBlocMapTexture,
493    #[cfg(feature = "vic3")] PowerBlocName,
494    #[cfg(feature = "vic3")] PrestigeGoods,
495    #[cfg(feature = "vic3")] Principle,
496    #[cfg(feature = "vic3")] PrincipleGroup,
497    #[cfg(feature = "vic3")] ProductionMethod,
498    #[cfg(feature = "vic3")] ProductionMethodGroup,
499    #[cfg(feature = "vic3")] ProposalType,
500    #[cfg(feature = "vic3")] RelationsThreshold,
501    #[cfg(feature = "vic3")] ScriptedButton,
502    #[cfg(feature = "vic3")] ScriptedProgressBar,
503    #[cfg(feature = "vic3")] ScriptedTest,
504    #[cfg(feature = "vic3")] SecretGoal,
505    #[cfg(feature = "vic3")] Skin,
506    #[cfg(feature = "vic3")] SocialClass,
507    #[cfg(feature = "vic3")] SocialHierarchy,
508    #[cfg(feature = "vic3")] StateRegion,
509    #[cfg(feature = "vic3")] StateTrait,
510    #[cfg(feature = "vic3")] Strata,
511    #[cfg(feature = "vic3")] TechnologyEra,
512    #[cfg(feature = "vic3")] TerrainKey,
513    #[cfg(feature = "vic3")] TerrainLabel,
514    #[cfg(feature = "vic3")] TerrainManipulator,
515    #[cfg(feature = "vic3")] TerrainMask,
516    #[cfg(feature = "vic3")] TerrainMaterial,
517    #[cfg(feature = "vic3")] Theme,
518    #[cfg(feature = "vic3")] TraditionTrait,
519    #[cfg(feature = "vic3")] TransferOfPower,
520    #[cfg(feature = "vic3")] TreatyArticle,
521
522    // Items specific to imperator
523    #[cfg(feature = "imperator")] Ambition,
524    #[cfg(feature = "imperator")] AiPlanGoals,
525    #[cfg(feature = "imperator")] Area,
526    #[cfg(feature = "imperator")] CultureGroup,
527    #[cfg(feature = "imperator")] Deity,
528    #[cfg(feature = "imperator")] DeityCategory,
529    #[cfg(feature = "imperator")] DiplomaticStance,
530    #[cfg(feature = "imperator")] EconomicPolicy,
531    #[cfg(feature = "imperator")] EventPicture,
532    #[cfg(feature = "imperator")] GovernorPolicy,
533    #[cfg(feature = "imperator")] GraphicalCultureType,
534    #[cfg(feature = "imperator")] GreatWorkEffectTier,
535    #[cfg(feature = "imperator")] GreatWorkEffect,
536    #[cfg(feature = "imperator")] GreatWorkCategory,
537    #[cfg(feature = "imperator")] GreatWorkMaterial,
538    #[cfg(feature = "imperator")] GreatWorkModule,
539    #[cfg(feature = "imperator")] GreatWorkTemplate,
540    #[cfg(feature = "imperator")] Heritage,
541    #[cfg(feature = "imperator")] Invention,
542    #[cfg(feature = "imperator")] InventionGroup,
543    #[cfg(feature = "imperator")] LegionDistinction,
544    #[cfg(feature = "imperator")] LevyTemplate,
545    #[cfg(feature = "imperator")] Loyalty,
546    #[cfg(feature = "imperator")] MilitaryTraditionTree,
547    #[cfg(feature = "imperator")] MilitaryTradition,
548    #[cfg(feature = "imperator")] MissionTask,
549    #[cfg(feature = "imperator")] Office,
550    #[cfg(feature = "imperator")] Opinion,
551    #[cfg(feature = "imperator")] PartyAgenda,
552    #[cfg(feature = "imperator")] PartyType,
553    #[cfg(feature = "imperator")] PostSetupCharacters,
554    #[cfg(feature = "imperator")] Price,
555    #[cfg(feature = "imperator")] ProvinceRank,
556    #[cfg(feature = "imperator")] SetupCharacters,
557    #[cfg(feature = "imperator")] SetupProvinces,
558    #[cfg(feature = "imperator")] TechnologyTable,
559    #[cfg(feature = "imperator")] TradeGood,
560    #[cfg(feature = "imperator")] Treasure,
561    #[cfg(feature = "imperator")] Unit,
562    #[cfg(feature = "imperator")] UnitAbility,
563
564    #[cfg(feature = "hoi4")] Ability,
565    #[cfg(feature = "hoi4")] Acclimatation,
566    #[cfg(feature = "hoi4")] AceModifier,
567    #[cfg(feature = "hoi4")] AdjacencyRule,
568    #[cfg(feature = "hoi4")] AiArea,
569    #[cfg(feature = "hoi4")] AiStrategyType,
570    #[cfg(feature = "hoi4")] AdvisorSlot,
571    #[cfg(feature = "hoi4")] CharacterIdeaToken,
572    #[cfg(feature = "hoi4")] CombatTacticPhase,
573    #[cfg(feature = "hoi4")] Continent,
574    #[cfg(feature = "hoi4")] CountryLeaderTrait,
575    #[cfg(feature = "hoi4")] CountryHistory,
576    #[cfg(feature = "hoi4")] CountryTag,
577    #[cfg(feature = "hoi4")] CountryTagAlias,
578    #[cfg(feature = "hoi4")] DecisionCategory,
579    #[cfg(feature = "hoi4")] DivisionNamesGroup,
580    #[cfg(feature = "hoi4")] DivisionTemplate,
581    #[cfg(feature = "hoi4")] DynamicModifier,
582    #[cfg(feature = "hoi4")] Equipment,
583    #[cfg(feature = "hoi4")] EquipmentBonusType,
584    #[cfg(feature = "hoi4")] EquipmentCategory,
585    #[cfg(feature = "hoi4")] EquipmentGroup,
586    #[cfg(feature = "hoi4")] EquipmentModule,
587    #[cfg(feature = "hoi4")] EquipmentModuleCategory,
588    #[cfg(feature = "hoi4")] EquipmentSearchFilter,
589    #[cfg(feature = "hoi4")] EquipmentStat,
590    #[cfg(feature = "hoi4")] EquipmentUpgrade,
591    #[cfg(feature = "hoi4")] GraphicalTerrain,
592    #[cfg(feature = "hoi4")] IdeaCategory,
593    #[cfg(feature = "hoi4")] IdeologyGroup,
594    #[cfg(feature = "hoi4")] IndustrialOrg,
595    #[cfg(feature = "hoi4")] IndustrialOrgBonusWeight,
596    #[cfg(feature = "hoi4")] IndustrialOrgPolicy,
597    #[cfg(feature = "hoi4")] IndustrialOrgTrait,
598    #[cfg(feature = "hoi4")] IntelligenceAgencyBranch,
599    #[cfg(feature = "hoi4")] IntelligenceAgencyUpgrade,
600    #[cfg(feature = "hoi4")] MusicAsset,
601    #[cfg(feature = "hoi4")] NationalFocus,
602    #[cfg(feature = "hoi4")] NationalFocusStyle,
603    #[cfg(feature = "hoi4")] NationalFocusTree,
604    #[cfg(feature = "hoi4")] Operation,
605    #[cfg(feature = "hoi4")] OperationPhase,
606    #[cfg(feature = "hoi4")] OperationToken,
607    #[cfg(feature = "hoi4")] PowerBalance,
608    #[cfg(feature = "hoi4")] PowerBalanceSide,
609    #[cfg(feature = "hoi4")] ProductionStat,
610    #[cfg(feature = "hoi4")] PrototypeReward,
611    #[cfg(feature = "hoi4")] RailwayGunNames,
612    #[cfg(feature = "hoi4")] Resource,
613    #[cfg(feature = "hoi4")] ScriptEnum,
614    #[cfg(feature = "hoi4")] ScriptedConstant,
615    #[cfg(feature = "hoi4")] ScriptedLocalisation,
616    #[cfg(feature = "hoi4")] ShipNames,
617    #[cfg(feature = "hoi4")] SoundEffect,
618    #[cfg(feature = "hoi4")] SoundFalloff,
619    #[cfg(feature = "hoi4")] SpawnPoint,
620    #[cfg(feature = "hoi4")] Specialization,
621    #[cfg(feature = "hoi4")] SpecialProject,
622    #[cfg(feature = "hoi4")] SpecialProjectTag,
623    #[cfg(feature = "hoi4")] ScientistTrait,
624    #[cfg(feature = "hoi4")] ShipName,
625    #[cfg(feature = "hoi4")] Sprite,
626    #[cfg(feature = "hoi4")] State,
627    #[cfg(feature = "hoi4")] StateCategory,
628    #[cfg(feature = "hoi4")] SubUnit,
629    #[cfg(feature = "hoi4")] SubUnitCategory,
630    #[cfg(feature = "hoi4")] SupplyArea,
631    #[cfg(feature = "hoi4")] TechnologyCategory,
632    #[cfg(feature = "hoi4")] TechnologyFolder,
633    #[cfg(feature = "hoi4")] TechnologySharing,
634    #[cfg(feature = "hoi4")] UnitHistory,
635    #[cfg(feature = "hoi4")] UnitLeaderSkill,
636    #[cfg(feature = "hoi4")] UnitLeaderTrait,
637    #[cfg(feature = "hoi4")] UnitNames,
638}
639
640/// Display items in `separated word case` for maximum friendliness.
641///
642/// Unfortunately there's no option for this in `strum` so we have to roll our own
643/// by using `snake_case` and changing the `_` to a space.
644impl Display for Item {
645    fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> {
646        let s: &'static str = self.into();
647        write!(f, "{}", s.replace('_', " "))
648    }
649}
650
651impl Item {
652    /// Returns a path where items of this type are kept in the script files. Can be `""` for items
653    /// that are built in.
654    ///
655    /// These paths are used both for the user in error reports, and to find the items when loading them.
656    pub fn path(self) -> &'static str {
657        #[allow(clippy::match_same_arms)]
658        // These variants are in the same order as the Item enum declaration
659        match self {
660            #[cfg(feature = "jomini")]
661            Item::Accessory => "gfx/portraits/accessories/",
662            #[cfg(feature = "jomini")]
663            Item::AccessoryTag => "gfx/portraits/accessories/",
664            #[cfg(feature = "jomini")]
665            Item::AccessoryVariation => "gfx/portraits/accessory_variations/",
666            #[cfg(feature = "jomini")]
667            Item::AccessoryVariationLayout => "gfx/portraits/accessory_variations/",
668            #[cfg(feature = "jomini")]
669            Item::AccessoryVariationTextures => "gfx/portraits/accessory_variations/",
670            Item::Achievement => match Game::game() {
671                #[cfg(feature = "ck3")]
672                Game::Ck3 => "common/achievements/",
673                #[cfg(feature = "vic3")]
674                Game::Vic3 => "common/achievements/",
675                #[cfg(feature = "imperator")]
676                Game::Imperator => "common/achievements/",
677                #[cfg(feature = "hoi4")]
678                Game::Hoi4 => "common/achievements.txt",
679            },
680            #[cfg(feature = "jomini")]
681            Item::AchievementGroup => "common/achievement_groups.txt",
682            Item::Asset => "gfx/models/",
683            Item::BlendShape => "gfx/models/",
684            #[cfg(feature = "jomini")]
685            Item::CharacterInteraction => "common/character_interactions/",
686            #[cfg(feature = "jomini")]
687            Item::Coa => "common/coat_of_arms/coat_of_arms/",
688            #[cfg(feature = "jomini")]
689            Item::CoaColorList => "common/coat_of_arms/template_lists/",
690            #[cfg(feature = "jomini")]
691            Item::CoaColoredEmblemList => "common/coat_of_arms/template_lists/",
692            #[cfg(feature = "ck3")]
693            Item::CoaDesignerColorPalette => "gfx/coat_of_arms/color_palettes/",
694            #[cfg(feature = "jomini")]
695            Item::CoaDesignerColoredEmblem => "gfx/coat_of_arms/colored_emblems/",
696            #[cfg(feature = "ck3")]
697            Item::CoaDesignerEmblemLayout => "gfx/coat_of_arms/emblem_layouts/",
698            #[cfg(feature = "jomini")]
699            Item::CoaDesignerPattern => "gfx/coat_of_arms/patterns/",
700            #[cfg(feature = "jomini")]
701            Item::CoaPatternList => "common/coat_of_arms/template_lists/",
702            #[cfg(feature = "jomini")]
703            Item::CoaTemplate => "common/coat_of_arms/coat_of_arms/",
704            #[cfg(feature = "jomini")]
705            Item::CoaTemplateList => "common/coat_of_arms/template_lists/",
706            #[cfg(feature = "jomini")]
707            Item::CoaTexturedEmblemList => "common/coat_of_arms/template_lists/",
708            #[cfg(feature = "jomini")]
709            Item::Culture => match Game::game() {
710                #[cfg(feature = "ck3")]
711                Game::Ck3 => "common/culture/cultures/",
712                #[cfg(feature = "vic3")]
713                Game::Vic3 => "common/cultures/",
714                #[cfg(feature = "imperator")]
715                Game::Imperator => "common/cultures/",
716                #[cfg(feature = "hoi4")]
717                Game::Hoi4 => unreachable!(),
718            },
719            #[cfg(feature = "jomini")]
720            Item::CustomLocalization => "common/customizable_localization/",
721            Item::Decision => match Game::game() {
722                #[cfg(feature = "ck3")]
723                Game::Ck3 => "common/decisions/",
724                #[cfg(feature = "vic3")]
725                Game::Vic3 => "common/decisions/",
726                #[cfg(feature = "imperator")]
727                Game::Imperator => "decisions/",
728                #[cfg(feature = "hoi4")]
729                Game::Hoi4 => "common/decisions/",
730            },
731            Item::Define => "common/defines/",
732            Item::Dlc => "dlc_metadata/",
733            Item::DlcFeature => "",
734            Item::DlcName => "dlc_metadata/",
735            Item::Directory => "",
736            #[cfg(feature = "jomini")]
737            Item::EffectLocalization => "common/effect_localization/",
738            Item::Entity => "gfx/models/",
739            Item::Entry => "",
740            #[cfg(feature = "jomini")]
741            Item::Ethnicity => "common/ethnicities/",
742            Item::Event => "events/",
743            Item::EventNamespace => "events/",
744            Item::File => "",
745            Item::Font => "fonts/",
746            Item::Fontfiles => "fonts/",
747            #[cfg(feature = "jomini")]
748            Item::GameConcept => "common/game_concepts/",
749            Item::GameRule => "common/game_rules/",
750            Item::GameRuleSetting => "common/game_rules/",
751            #[cfg(feature = "jomini")]
752            Item::GeneAgePreset => "common/genes/",
753            #[cfg(feature = "jomini")]
754            Item::GeneAttribute => "gfx/models/",
755            #[cfg(feature = "jomini")]
756            Item::GeneCategory => "common/genes/",
757            #[cfg(feature = "jomini")]
758            Item::GovernmentType => match Game::game() {
759                #[cfg(feature = "ck3")]
760                Game::Ck3 => "common/governments/",
761                #[cfg(feature = "vic3")]
762                Game::Vic3 => "common/government_types/",
763                #[cfg(feature = "imperator")]
764                Game::Imperator => "common/governments/",
765                #[cfg(feature = "hoi4")]
766                Game::Hoi4 => unreachable!(),
767            },
768            Item::GuiLayer => "gui/",
769            Item::GuiTemplate => "gui/",
770            Item::GuiType => "gui/",
771            Item::Localization => "localization/",
772            Item::MapEnvironment => "gfx/map/environment/",
773            Item::MapMode => "gfx/map/map_modes/",
774            Item::Modifier => match Game::game() {
775                #[cfg(feature = "ck3")]
776                Game::Ck3 => "common/modifiers/",
777                #[cfg(feature = "vic3")]
778                Game::Vic3 => "common/static_modifiers/",
779                #[cfg(feature = "imperator")]
780                Game::Imperator => "common/modifiers/",
781                #[cfg(feature = "hoi4")]
782                Game::Hoi4 => "common/modifiers/", // TODO HOI4
783            },
784            Item::Music => "music/",
785            #[cfg(feature = "jomini")]
786            Item::MusicPlayerCategory => "music/music_player_categories/",
787            #[cfg(feature = "jomini")]
788            Item::NamedColor => "common/named_colors/",
789            Item::OnAction => match Game::game() {
790                #[cfg(feature = "ck3")]
791                Game::Ck3 => "common/on_action/",
792                #[cfg(feature = "vic3")]
793                Game::Vic3 => "common/on_actions/",
794                #[cfg(feature = "imperator")]
795                Game::Imperator => "common/on_action/",
796                #[cfg(feature = "hoi4")]
797                Game::Hoi4 => "common/on_actions/", // TODO HOI4
798            },
799            Item::Pdxmesh => "gfx/models/",
800            #[cfg(feature = "jomini")]
801            Item::PortraitAnimation => "gfx/portraits/portrait_animations/",
802            #[cfg(feature = "jomini")]
803            Item::PortraitCamera => "gfx/portraits/cameras/",
804            #[cfg(feature = "jomini")]
805            Item::PortraitEnvironment => "gfx/portraits/environments/",
806            #[cfg(feature = "jomini")]
807            Item::PortraitModifierGroup => "gfx/portraits/portrait_modifiers/",
808            #[cfg(feature = "jomini")]
809            Item::PortraitModifierPack => "gfx/portraits/portrait_animations/",
810            Item::Province => match Game::game() {
811                #[cfg(feature = "ck3")]
812                Game::Ck3 => "map_data/definition.csv",
813                #[cfg(feature = "vic3")]
814                Game::Vic3 => "map_data/provinces.png",
815                #[cfg(feature = "imperator")]
816                Game::Imperator => "map_data/provinces.png",
817                #[cfg(feature = "hoi4")]
818                Game::Hoi4 => "map/definition.csv", // TODO HOI4
819            },
820            #[cfg(feature = "jomini")]
821            Item::Religion => match Game::game() {
822                #[cfg(feature = "ck3")]
823                Game::Ck3 => "common/religion/religions/",
824                #[cfg(feature = "vic3")]
825                Game::Vic3 => "common/religions/",
826                #[cfg(feature = "imperator")]
827                Game::Imperator => "common/religions/",
828                #[cfg(feature = "hoi4")]
829                Game::Hoi4 => unreachable!(),
830            },
831            Item::ScriptedEffect => "common/scripted_effects/",
832            Item::ScriptedGui => "common/scripted_guis/",
833            #[cfg(feature = "jomini")]
834            Item::ScriptedList => "common/scripted_lists/",
835            #[cfg(feature = "jomini")]
836            Item::ScriptedModifier => "common/scripted_modifiers/",
837            #[cfg(feature = "jomini")]
838            Item::ScriptedRule => "common/scripted_rules/",
839            Item::ScriptedTrigger => "common/scripted_triggers/",
840            #[cfg(feature = "jomini")]
841            Item::ScriptValue => "common/script_values/",
842            Item::Shortcut => "gui/shortcuts.shortcuts",
843            Item::Sound => match Game::game() {
844                #[cfg(feature = "hoi4")]
845                Game::Hoi4 => "sound/",
846                #[cfg(feature = "jomini")]
847                _ => "",
848            },
849            Item::Terrain => match Game::game() {
850                #[cfg(feature = "ck3")]
851                Game::Ck3 => "common/terrain_types/",
852                #[cfg(feature = "vic3")]
853                Game::Vic3 => "common/terrain/",
854                #[cfg(feature = "imperator")]
855                Game::Imperator => "common/terrain_types/",
856                #[cfg(feature = "hoi4")]
857                Game::Hoi4 => "common/terrain/",
858            },
859            Item::TextFormat => "gui/",
860            Item::TextIcon => "gui/",
861            Item::TextureFile => "gfx/models/",
862            #[cfg(feature = "jomini")]
863            Item::TriggerLocalization => "common/trigger_localization/",
864            Item::WidgetName => "gui/",
865
866            #[cfg(any(feature = "vic3", feature = "hoi4"))]
867            Item::AiStrategy => match Game::game() {
868                #[cfg(feature = "vic3")]
869                Game::Vic3 => "common/ai_strategies/",
870                #[cfg(feature = "hoi4")]
871                Game::Hoi4 => "common/ai_strategy/",
872                #[allow(unreachable_patterns)]
873                _ => unreachable!(),
874            },
875            #[cfg(any(feature = "ck3", feature = "imperator", feature = "hoi4"))]
876            Item::Building => "common/buildings/",
877            #[cfg(any(feature = "ck3", feature = "hoi4"))]
878            Item::Character => match Game::game() {
879                #[cfg(feature = "ck3")]
880                Game::Ck3 => "history/characters/",
881                #[cfg(feature = "hoi4")]
882                Game::Hoi4 => "common/characters/",
883                #[allow(unreachable_patterns)]
884                _ => unreachable!(),
885            },
886            #[cfg(any(feature = "ck3", feature = "vic3"))]
887            Item::CharacterTemplate => match Game::game() {
888                #[cfg(feature = "ck3")]
889                Game::Ck3 => "common/scripted_character_templates/",
890                #[cfg(feature = "vic3")]
891                Game::Vic3 => "common/character_templates/",
892                #[allow(unreachable_patterns)]
893                _ => unreachable!(),
894            },
895            #[cfg(any(feature = "vic3", feature = "imperator"))]
896            Item::CharacterTrait => match Game::game() {
897                #[cfg(feature = "vic3")]
898                Game::Vic3 => "common/character_traits/",
899                #[cfg(feature = "imperator")]
900                Game::Imperator => "common/traits/",
901                #[allow(unreachable_patterns)]
902                _ => unreachable!(),
903            },
904            #[cfg(any(feature = "imperator", feature = "hoi4"))]
905            Item::CombatTactic => match Game::game() {
906                #[cfg(feature = "imperator")]
907                Game::Imperator => "common/combat_tactics/",
908                #[cfg(feature = "hoi4")]
909                Game::Hoi4 => "common/combat_tactics.txt", // TODO HOI4
910                #[allow(unreachable_patterns)]
911                _ => unreachable!(),
912            },
913            #[cfg(any(feature = "vic3", feature = "imperator", feature = "hoi4"))]
914            Item::Country => match Game::game() {
915                #[cfg(feature = "vic3")]
916                Game::Vic3 => "common/country_definitions/",
917                #[cfg(feature = "imperator")]
918                Game::Imperator => "setup/countries/countries.txt",
919                #[cfg(feature = "hoi4")]
920                Game::Hoi4 => "common/countries/", // TODO HOI4
921                #[allow(unreachable_patterns)]
922                _ => unreachable!(),
923            },
924            #[cfg(any(feature = "ck3", feature = "imperator"))]
925            Item::DeathReason => "common/deathreasons/",
926            #[cfg(any(feature = "ck3", feature = "vic3"))]
927            Item::Dna => "common/dna_data/",
928            #[cfg(any(feature = "ck3", feature = "imperator"))]
929            Item::EventTheme => "common/event_themes/",
930            #[cfg(any(feature = "imperator", feature = "hoi4"))]
931            Item::Idea => "common/ideas/", // TODO HOI4
932            #[cfg(any(feature = "vic3", feature = "hoi4"))]
933            Item::Ideology => "common/ideologies/",
934            #[cfg(any(feature = "ck3", feature = "imperator"))]
935            Item::Law => "common/laws/",
936            #[cfg(any(feature = "ck3", feature = "vic3", feature = "imperator"))]
937            Item::LawGroup => match Game::game() {
938                #[cfg(feature = "ck3")]
939                Game::Ck3 => "common/laws/",
940                #[cfg(feature = "imperator")]
941                Game::Imperator => "common/laws/",
942                #[cfg(feature = "vic3")]
943                Game::Vic3 => "common/law_groups/",
944                #[allow(unreachable_patterns)]
945                _ => unreachable!(),
946            },
947            #[cfg(any(feature = "ck3", feature = "vic3"))]
948            Item::Message => "common/messages",
949            #[cfg(any(feature = "imperator", feature = "hoi4"))]
950            Item::Mission => match Game::game() {
951                #[cfg(feature = "imperator")]
952                Game::Imperator => "common/missions/",
953                #[cfg(feature = "hoi4")]
954                Game::Hoi4 => "common/script_enums.txt",
955                #[allow(unreachable_patterns)]
956                _ => unreachable!(),
957            },
958            #[cfg(any(feature = "vic3", feature = "imperator"))]
959            Item::PopType => "common/pop_types/",
960            #[cfg(any(feature = "ck3", feature = "imperator"))]
961            Item::Region => match Game::game() {
962                #[cfg(feature = "ck3")]
963                Game::Ck3 => "map_data/geographical_regions/",
964                #[cfg(feature = "imperator")]
965                Game::Imperator => "map_data/regions.txt",
966                #[allow(unreachable_patterns)]
967                _ => unreachable!(),
968            },
969            #[cfg(any(feature = "vic3", feature = "hoi4"))]
970            Item::StrategicRegion => match Game::game() {
971                #[cfg(feature = "vic3")]
972                Game::Vic3 => "common/strategic_regions/",
973                #[cfg(feature = "hoi4")]
974                Game::Hoi4 => "map/strategicregions/",
975                #[allow(unreachable_patterns)]
976                _ => unreachable!(),
977            },
978            #[cfg(any(feature = "vic3", feature = "imperator"))]
979            Item::SubjectType => "common/subject_types/",
980            #[cfg(any(feature = "vic3", feature = "hoi4"))]
981            Item::Technology => match Game::game() {
982                #[cfg(feature = "vic3")]
983                Game::Vic3 => "common/technology/technologies/",
984                #[cfg(feature = "hoi4")]
985                Game::Hoi4 => "common/technologies/",
986                #[allow(unreachable_patterns)]
987                _ => unreachable!(),
988            },
989            #[cfg(any(feature = "ck3", feature = "vic3"))]
990            Item::TutorialLesson => "common/tutorial_lessons",
991            #[cfg(any(feature = "ck3", feature = "vic3"))]
992            Item::TutorialLessonChain => "common/tutorial_lesson_chains",
993            #[cfg(any(feature = "ck3", feature = "vic3"))]
994            Item::TutorialLessonStep => "common/tutorial_lessons",
995            #[cfg(any(feature = "vic3", feature = "imperator"))]
996            Item::Wargoal => match Game::game() {
997                #[cfg(feature = "vic3")]
998                Game::Vic3 => "",
999                #[cfg(feature = "imperator")]
1000                Game::Imperator => "common/wargoals",
1001                #[allow(unreachable_patterns)]
1002                _ => unreachable!(),
1003            },
1004
1005            #[cfg(feature = "ck3")]
1006            Item::AccoladeCategory => "common/accolade_types/",
1007            #[cfg(feature = "ck3")]
1008            Item::AccoladeIcon => "common/accolade_icons/",
1009            #[cfg(feature = "ck3")]
1010            Item::AccoladeName => "common/accolade_names/",
1011            #[cfg(feature = "ck3")]
1012            Item::AccoladeParameter => "common/accolade_types/",
1013            #[cfg(feature = "ck3")]
1014            Item::AccoladeType => "common/accolade_types/",
1015            #[cfg(feature = "ck3")]
1016            Item::ActivityGroupType => "common/activities/activity_group_types/",
1017            #[cfg(feature = "ck3")]
1018            Item::ActivityIntent => "common/activities/intents/",
1019            #[cfg(feature = "ck3")]
1020            Item::ActivityLocale => "common/activities/activity_locales/",
1021            #[cfg(feature = "ck3")]
1022            Item::ActivityOption => "common/activities/activity_types/",
1023            #[cfg(feature = "ck3")]
1024            Item::ActivityOptionCategory => "common/activities/activity_types/",
1025            #[cfg(feature = "ck3")]
1026            Item::ActivityPhase => "common/activities/activity_types/",
1027            #[cfg(feature = "ck3")]
1028            Item::ActivityPulseAction => "common/activities/pulse_actions/",
1029            #[cfg(feature = "ck3")]
1030            Item::ActivityState => "",
1031            #[cfg(feature = "ck3")]
1032            Item::ActivityType => "common/activities/activity_types/",
1033            #[cfg(feature = "ck3")]
1034            Item::AiWarStance => "common/ai_war_stances/",
1035            #[cfg(feature = "ck3")]
1036            Item::AgentType => "common/schemes/agent_types/",
1037            #[cfg(feature = "ck3")]
1038            Item::Amenity => "common/court_amenities/",
1039            #[cfg(feature = "ck3")]
1040            Item::AmenitySetting => "common/court_amenities/",
1041            #[cfg(feature = "ck3")]
1042            Item::ArtifactBlueprint => "common/artifacts/blueprints/",
1043            #[cfg(feature = "ck3")]
1044            Item::ArtifactFeature => "common/artifacts/features/",
1045            #[cfg(feature = "ck3")]
1046            Item::ArtifactFeatureGroup => "common/artifacts/feature_groups/",
1047            #[cfg(feature = "ck3")]
1048            Item::ArtifactHistory => "",
1049            #[cfg(feature = "ck3")]
1050            Item::ArtifactRarity => "",
1051            #[cfg(feature = "ck3")]
1052            Item::ArtifactSlot => "common/artifacts/slots/",
1053            #[cfg(feature = "ck3")]
1054            Item::ArtifactSlotType => "common/artifacts/slots/",
1055            #[cfg(feature = "ck3")]
1056            Item::ArtifactTemplate => "common/artifacts/templates/",
1057            #[cfg(feature = "ck3")]
1058            Item::ArtifactType => "common/artifacts/types/",
1059            #[cfg(feature = "ck3")]
1060            Item::ArtifactVisual => "common/artifacts/visuals/",
1061            #[cfg(feature = "ck3")]
1062            Item::Bookmark => "common/bookmarks/bookmarks/",
1063            #[cfg(feature = "ck3")]
1064            Item::BookmarkGroup => "common/bookmarks/groups/",
1065            #[cfg(feature = "ck3")]
1066            Item::BookmarkPortrait => "common/bookmark_portraits/",
1067            #[cfg(feature = "ck3")]
1068            Item::BuildingFlag => "common/buildings/",
1069            #[cfg(feature = "ck3")]
1070            Item::BuildingGfx => "common/culture/cultures/",
1071            #[cfg(feature = "ck3")]
1072            Item::CasusBelli => "common/casus_belli_types/",
1073            #[cfg(feature = "ck3")]
1074            Item::CasusBelliGroup => "common/casus_belli_groups/",
1075            #[cfg(feature = "ck3")]
1076            Item::Catalyst => "common/struggle/catalysts/",
1077            #[cfg(feature = "ck3")]
1078            Item::ChallengeCharacter => "common/bookmarks/challenge_characters/",
1079            #[cfg(feature = "ck3")]
1080            Item::CharacterBackground => "common/character_backgrounds/",
1081            #[cfg(feature = "ck3")]
1082            Item::CharacterInteractionCategory => "common/character_interaction_categories/",
1083            #[cfg(feature = "ck3")]
1084            Item::Climate => "map_data/climate.txt",
1085            #[cfg(feature = "ck3")]
1086            Item::ClothingGfx => "common/culture/cultures/",
1087            #[cfg(feature = "ck3")]
1088            Item::CoaGfx => "common/culture/cultures/",
1089            #[cfg(feature = "ck3")]
1090            Item::CoaDynamicDefinition => "common/coat_of_arms/dynamic_definitions/",
1091            #[cfg(feature = "ck3")]
1092            Item::CombatEffect => "common/combat_effects/",
1093            #[cfg(feature = "ck3")]
1094            Item::CombatPhaseEvent => "common/combat_phase_events/",
1095            #[cfg(feature = "ck3")]
1096            Item::CouncilPosition => "common/council_positions/",
1097            #[cfg(feature = "ck3")]
1098            Item::CouncilTask => "common/council_tasks/",
1099            #[cfg(feature = "ck3")]
1100            Item::Countermeasure => "common/schemes/scheme_countermeasures/",
1101            #[cfg(feature = "ck3")]
1102            Item::CountermeasureParameter => "common/schemes/scheme_countermeasures/",
1103            #[cfg(feature = "ck3")]
1104            Item::CourtPosition => "common/court_positions/types/",
1105            #[cfg(feature = "ck3")]
1106            Item::CourtPositionTask => "common/court_positions/tasks/",
1107            #[cfg(feature = "ck3")]
1108            Item::CourtSceneCulture => "gfx/court_scene/scene_cultures/",
1109            #[cfg(feature = "ck3")]
1110            Item::CourtSceneGroup => "gfx/court_scene/character_groups/",
1111            #[cfg(feature = "ck3")]
1112            Item::CourtSceneRole => "gfx/court_scene/character_roles/",
1113            #[cfg(feature = "ck3")]
1114            Item::CourtSceneSetting => "gfx/court_scene/scene_settings/",
1115            #[cfg(feature = "ck3")]
1116            Item::CourtType => "common/court_types/",
1117            #[cfg(feature = "ck3")]
1118            Item::CourtierGuestManagement => "common/courtier_guest_management/",
1119            #[cfg(feature = "ck3")]
1120            Item::CultureAesthetic => "common/culture/aesthetics_bundles/",
1121            #[cfg(feature = "ck3")]
1122            Item::CultureCreationName => "common/culture/creation_names/",
1123            #[cfg(feature = "ck3")]
1124            Item::CultureEra => "common/culture/eras/",
1125            #[cfg(feature = "ck3")]
1126            Item::CultureEthos => "common/culture/pillars/",
1127            #[cfg(feature = "ck3")]
1128            Item::CultureHeritage => "common/culture/pillars/",
1129            #[cfg(feature = "ck3")]
1130            Item::CultureHistory => "history/cultures/",
1131            #[cfg(feature = "ck3")]
1132            // This is ugly since it isn't a path, but the path won't be used except in messages.
1133            Item::CultureParameter => "common/culture/ parameters blocks",
1134            #[cfg(feature = "ck3")]
1135            Item::CulturePillar => "common/culture/pillars/",
1136            #[cfg(feature = "ck3")]
1137            Item::CultureTradition => "common/culture/traditions/",
1138            #[cfg(feature = "ck3")]
1139            Item::CultureTraditionCategory => "common/culture/traditions/",
1140            #[cfg(feature = "ck3")]
1141            Item::DangerType => "",
1142            #[cfg(feature = "ck3")]
1143            Item::DecisionGroup => "common/decision_group_types/",
1144            #[cfg(feature = "ck3")]
1145            Item::DiarchyMandate => "common/diarchies/diarchy_mandates/",
1146            #[cfg(feature = "ck3")]
1147            Item::DiarchyParameter => "common/diarchies/diarchy_types/",
1148            #[cfg(feature = "ck3")]
1149            Item::DiarchyType => "common/diarchies/diarchy_types/",
1150            #[cfg(feature = "ck3")]
1151            Item::Doctrine => "common/religion/doctrines/",
1152            #[cfg(feature = "ck3")]
1153            Item::DoctrineBooleanParameter => "common/religion/doctrines/",
1154            #[cfg(feature = "ck3")]
1155            Item::DoctrineCategory => "common/religion/doctrines/",
1156            #[cfg(feature = "ck3")]
1157            Item::DoctrineParameter => "common/religion/doctrines/",
1158            #[cfg(feature = "ck3")]
1159            Item::DomicileBuilding => "common/domiciles/buildings/",
1160            #[cfg(feature = "ck3")]
1161            Item::DomicileParameter => "common/domiciles/buildings/",
1162            #[cfg(feature = "ck3")]
1163            Item::DomicileType => "common/domiciles/types/",
1164            #[cfg(feature = "ck3")]
1165            Item::Dynasty => "common/dynasties/",
1166            #[cfg(feature = "ck3")]
1167            Item::DynastyLegacy => "common/dynasty_legacies/",
1168            #[cfg(feature = "ck3")]
1169            Item::DynastyPerk => "common/dynasty_perks/",
1170            #[cfg(feature = "ck3")]
1171            Item::EpidemicType => "common/epidemics/",
1172            #[cfg(feature = "ck3")]
1173            Item::EpidemicDeathReason => "common/deathreasons/",
1174            #[cfg(feature = "ck3")]
1175            Item::EventBackground => "common/event_backgrounds/",
1176            #[cfg(feature = "ck3")]
1177            Item::EventEffect2d => "common/event_2d_effects/",
1178            #[cfg(feature = "ck3")]
1179            Item::EventTransition => "common/event_transitions/",
1180            #[cfg(feature = "ck3")]
1181            Item::Faith => "common/religion/religions/",
1182            #[cfg(feature = "ck3")]
1183            Item::FaithIcon => "common/religion/religions/",
1184            #[cfg(feature = "ck3")]
1185            Item::FervorModifier => "common/religion/fervor_modifiers/",
1186            #[cfg(feature = "ck3")]
1187            Item::Faction => "common/factions/",
1188            #[cfg(feature = "ck3")]
1189            Item::Flavorization => "common/flavorization/",
1190            #[cfg(feature = "ck3")]
1191            Item::Focus => "common/focuses/",
1192            #[cfg(feature = "ck3")]
1193            Item::GeneticConstraint => "common/traits/",
1194            #[cfg(feature = "ck3")]
1195            Item::GovernmentFlag => "common/governments/",
1196            #[cfg(feature = "ck3")]
1197            Item::GraphicalFaith => "common/religion/religions/",
1198            #[cfg(feature = "ck3")]
1199            Item::GuestInviteRule => "common/activities/guest_invite_rules/",
1200            #[cfg(feature = "ck3")]
1201            Item::GuestSubset => "common/activities/activity_types/",
1202            #[cfg(feature = "ck3")]
1203            Item::GuestSystem => "common/guest_system/",
1204            #[cfg(feature = "ck3")]
1205            Item::HeadDetermination => "common/culture/pillars/",
1206            #[cfg(feature = "ck3")]
1207            Item::HoldingParameter => "common/holdings/",
1208            #[cfg(feature = "ck3")]
1209            Item::HoldingType => "common/holdings/",
1210            #[cfg(feature = "ck3")]
1211            Item::HolySite => "common/religion/holy_sites/",
1212            #[cfg(feature = "ck3")]
1213            Item::HolySiteFlag => "common/religion/holy_sites/",
1214            #[cfg(feature = "ck3")]
1215            Item::Hook => "common/hook_types/",
1216            #[cfg(feature = "ck3")]
1217            Item::House => "common/dynasty_houses/",
1218            #[cfg(feature = "ck3")]
1219            Item::HousePowerBonus => "common/house_power_bonus/",
1220            #[cfg(feature = "ck3")]
1221            Item::HouseUnity => "common/house_unities/",
1222            #[cfg(feature = "ck3")]
1223            Item::HouseUnityParameter => "common/house_unities",
1224            #[cfg(feature = "ck3")]
1225            Item::HouseUnityStage => "common/house_unities/",
1226            #[cfg(feature = "ck3")]
1227            Item::ImportantAction => "common/important_actions/",
1228            #[cfg(feature = "ck3")]
1229            Item::Innovation => "common/culture/innovations/",
1230            #[cfg(feature = "ck3")]
1231            Item::InnovationFlag => "common/culture/innovations/",
1232            #[cfg(feature = "ck3")]
1233            Item::Inspiration => "common/inspirations/",
1234            #[cfg(feature = "ck3")]
1235            Item::Language => "common/culture/pillars/",
1236            #[cfg(feature = "ck3")]
1237            Item::LawFlag => "common/laws/",
1238            #[cfg(feature = "ck3")]
1239            Item::LeaseContract => "common/lease_contracts/",
1240            #[cfg(feature = "ck3")]
1241            Item::LegendChapter => "common/legends/chronicles/",
1242            #[cfg(feature = "ck3")]
1243            Item::LegendChronicle => "common/legends/chronicles/",
1244            #[cfg(feature = "ck3")]
1245            Item::LegendProperty => "common/legends/chronicles/",
1246            #[cfg(feature = "ck3")]
1247            Item::LegendSeed => "common/legends/legend_seeds/",
1248            #[cfg(feature = "ck3")]
1249            Item::LegendType => "common/legends/legend_types/",
1250            #[cfg(feature = "ck3")]
1251            Item::LegitimacyFlag => "common/legitimacy/",
1252            #[cfg(feature = "ck3")]
1253            Item::LegitimacyType => "common/legitimacy/",
1254            #[cfg(feature = "ck3")]
1255            Item::Lifestyle => "common/lifestyles/",
1256            #[cfg(feature = "ck3")]
1257            Item::LineType => "gfx/lines/lines.lines",
1258            #[cfg(feature = "ck3")]
1259            Item::MartialCustom => "common/culture/pillars/",
1260            #[cfg(feature = "ck3")]
1261            Item::MemoryCategory => "common/character_memory_types/",
1262            #[cfg(feature = "ck3")]
1263            Item::MemoryType => "common/character_memory_types/",
1264            #[cfg(feature = "ck3")]
1265            Item::MenAtArms => "common/men_at_arms_types/",
1266            #[cfg(feature = "ck3")]
1267            Item::MenAtArmsBase => "common/men_at_arms_types/",
1268            #[cfg(feature = "ck3")]
1269            Item::MessageFilterType => "common/message_filter_types/",
1270            #[cfg(feature = "ck3")]
1271            Item::MessageGroupType => "common/message_group_types/",
1272            #[cfg(feature = "ck3")]
1273            Item::ModifierFormat => "common/modifier_definition_formats/",
1274            #[cfg(feature = "ck3")]
1275            Item::MottoInsert => "common/dynasty_house_motto_inserts/",
1276            #[cfg(feature = "ck3")]
1277            Item::Motto => "common/dynasty_house_mottos/",
1278            #[cfg(feature = "ck3")]
1279            Item::NameEquivalency => "common/culture/name_equivalency/",
1280            #[cfg(feature = "ck3")]
1281            Item::NameList => "common/culture/name_lists/",
1282            #[cfg(feature = "ck3")]
1283            Item::Nickname => "common/nicknames/",
1284            #[cfg(feature = "ck3")]
1285            Item::OpinionModifier => "common/opinion_modifiers/",
1286            #[cfg(feature = "ck3")]
1287            Item::Perk => "common/lifestyle_perks/",
1288            #[cfg(feature = "ck3")]
1289            Item::PerkTree => "common/lifestyle_perks/",
1290            #[cfg(feature = "ck3")]
1291            Item::PlayableDifficultyInfo => "common/playable_difficulty_infos/",
1292            #[cfg(feature = "ck3")]
1293            Item::PointOfInterest => "common/travel/point_of_interest_types/",
1294            #[cfg(feature = "ck3")]
1295            Item::PoolSelector => "common/pool_character_selectors/",
1296            #[cfg(feature = "ck3")]
1297            Item::PortraitType => "common/portrait_types/",
1298            #[cfg(feature = "ck3")]
1299            Item::ProvinceEffect => "gfx/map/province_effects/",
1300            #[cfg(feature = "ck3")]
1301            Item::ProvinceMapping => "history/province_mapping/",
1302            #[cfg(feature = "ck3")]
1303            Item::PrisonType => "",
1304            #[cfg(feature = "ck3")]
1305            Item::RaidIntent => "common/raids/intents/",
1306            #[cfg(feature = "ck3")]
1307            Item::Relation => "common/scripted_relations/",
1308            #[cfg(feature = "ck3")]
1309            Item::RelationFlag => "common/scripted_relations/",
1310            #[cfg(feature = "ck3")]
1311            Item::ReligionFamily => "common/religion/religion_families/",
1312            #[cfg(feature = "ck3")]
1313            Item::RewardItem => "",
1314            #[cfg(feature = "ck3")]
1315            Item::SubjectContract => "common/subject_contracts/contracts/",
1316            #[cfg(feature = "ck3")]
1317            Item::SubjectContractFlag => "common/subject_contracts/contracts/",
1318            #[cfg(feature = "ck3")]
1319            Item::SubjectContractGroup => "common/subject_contracts/groups/",
1320            #[cfg(feature = "ck3")]
1321            Item::SubjectContractObligationLevel => "common/subject_contracts/contracts/",
1322            #[cfg(feature = "ck3")]
1323            Item::Scheme => "common/schemes/scheme_types",
1324            #[cfg(feature = "ck3")]
1325            Item::SchemePulseAction => "common/schemes/pulse_actions",
1326            #[cfg(feature = "ck3")]
1327            Item::ScriptedAnimation => "common/scripted_animations/",
1328            #[cfg(feature = "ck3")]
1329            Item::ScriptedCost => "common/scripted_costs/",
1330            #[cfg(feature = "ck3")]
1331            Item::ScriptedIllustration => "gfx/interface/illustrations/scripted_illustrations/",
1332            #[cfg(feature = "ck3")]
1333            Item::Secret => "common/secret_types/",
1334            #[cfg(feature = "ck3")]
1335            Item::Sexuality => "",
1336            #[cfg(feature = "ck3")]
1337            Item::Situation => "common/situation/situations/",
1338            #[cfg(feature = "ck3")]
1339            Item::SituationCatalyst => "common/situation/catalysts/",
1340            #[cfg(feature = "ck3")]
1341            Item::SituationHistory => "history/situations/",
1342            #[cfg(feature = "ck3")]
1343            Item::SituationParticipantGroup => "common/situation/situations/",
1344            #[cfg(feature = "ck3")]
1345            Item::SituationPhase => "common/situation/situations/",
1346            #[cfg(feature = "ck3")]
1347            Item::SituationPhaseParameter => "common/situation/situations/",
1348            #[cfg(feature = "ck3")]
1349            Item::SituationSubRegion => "common/situation/situations/",
1350            #[cfg(feature = "ck3")]
1351            Item::Skill => "",
1352            #[cfg(feature = "ck3")]
1353            Item::SpecialBuilding => "common/buildings/",
1354            #[cfg(feature = "ck3")]
1355            Item::SpecialGuest => "common/activities/activity_types/",
1356            #[cfg(feature = "ck3")]
1357            Item::Story => "common/story_cycles/",
1358            #[cfg(feature = "ck3")]
1359            Item::Struggle => "common/struggle/struggles/",
1360            #[cfg(feature = "ck3")]
1361            Item::StruggleHistory => "history/struggles/",
1362            #[cfg(feature = "ck3")]
1363            Item::StrugglePhase => "common/struggle/struggles/",
1364            #[cfg(feature = "ck3")]
1365            Item::StrugglePhaseParameter => "common/struggle/struggles/",
1366            #[cfg(feature = "ck3")]
1367            Item::SuccessionAppointment => "common/succession_appointment/",
1368            #[cfg(feature = "ck3")]
1369            Item::SuccessionElection => "common/succession_election/",
1370            #[cfg(feature = "ck3")]
1371            Item::Suggestion => "common/suggestions/",
1372            #[cfg(feature = "ck3")]
1373            Item::TaskContractGroup => "common/task_contracts/",
1374            #[cfg(feature = "ck3")]
1375            Item::TaskContractReward => "common/task_contracts/",
1376            #[cfg(feature = "ck3")]
1377            Item::TaskContractType => "common/task_contracts/",
1378            #[cfg(feature = "ck3")]
1379            Item::TaxSlotObligation => "common/tax_slots/obligations",
1380            #[cfg(feature = "ck3")]
1381            Item::TaxSlotType => "common/tax_slots/types",
1382            #[cfg(feature = "ck3")]
1383            Item::Title => "common/landed_titles/",
1384            #[cfg(feature = "ck3")]
1385            Item::TitleHistory => "history/titles/",
1386            #[cfg(feature = "ck3")]
1387            Item::Trait => "common/traits/",
1388            #[cfg(feature = "ck3")]
1389            Item::TraitCategory => "",
1390            #[cfg(feature = "ck3")]
1391            Item::TraitFlag => "common/traits/",
1392            #[cfg(feature = "ck3")]
1393            Item::TraitPortraitModifier => "gfx/portraits/trait_portrait_modifiers",
1394            #[cfg(feature = "ck3")]
1395            Item::TraitTrack => "common/traits/",
1396            #[cfg(feature = "ck3")]
1397            Item::TravelOption => "common/travel/travel_options/",
1398            #[cfg(feature = "ck3")]
1399            Item::UnitGfx => "common/culture/cultures/",
1400            #[cfg(feature = "ck3")]
1401            Item::VassalStance => "common/vassal_stances/",
1402
1403            #[cfg(feature = "vic3")]
1404            Item::AcceptanceStatus => "common/acceptance_statuses/",
1405            #[cfg(feature = "vic3")]
1406            Item::AirGraphics => "gfx/map/air_graphics/",
1407            #[cfg(feature = "vic3")]
1408            Item::Alert => "common/alert_types",
1409            #[cfg(feature = "vic3")]
1410            Item::AlertGroup => "common/alert_groups",
1411            #[cfg(feature = "vic3")]
1412            Item::Approval => "",
1413            #[cfg(feature = "vic3")]
1414            Item::ArmyDiorama => "gfx/map/army_dioramas/",
1415            #[cfg(feature = "vic3")]
1416            Item::Attitude => "",
1417            #[cfg(feature = "vic3")]
1418            Item::BattleCondition => "common/battle_conditions/",
1419            #[cfg(feature = "vic3")]
1420            Item::BuildingGroup => "common/building_groups/",
1421            #[cfg(feature = "vic3")]
1422            Item::BuildingType => "common/buildings/",
1423            #[cfg(feature = "vic3")]
1424            Item::BuyPackage => "common/buy_packages/",
1425            #[cfg(feature = "vic3")]
1426            Item::CanalType => "common/canals/",
1427            #[cfg(feature = "vic3")]
1428            Item::CharacterRole => "",
1429            #[cfg(feature = "vic3")]
1430            Item::CityBuildingVfx => "gfx/map/city_data/city_building_vfx/",
1431            #[cfg(feature = "vic3")]
1432            Item::CityCenterpiece => "gfx/map/city_data/city_centerpiece/",
1433            #[cfg(feature = "vic3")]
1434            Item::CityGraphicsType => "gfx/map/city_data/city_types/",
1435            #[cfg(feature = "vic3")]
1436            Item::CityVfx => "gfx/map/city_data/city_vfx/",
1437            #[cfg(feature = "vic3")]
1438            Item::CombatUnit => "common/combat_unit_types/",
1439            #[cfg(feature = "vic3")]
1440            Item::CombatUnitExperienceLevel => "common/combat_unit_experience_levels/",
1441            #[cfg(feature = "vic3")]
1442            Item::CombatUnitGroup => "common/combat_unit_groups/",
1443            #[cfg(feature = "vic3")]
1444            Item::CommanderOrder => "common/commander_orders/",
1445            #[cfg(feature = "vic3")]
1446            Item::CommanderRank => "common/commander_ranks/",
1447            #[cfg(feature = "vic3")]
1448            Item::CompanyType => "common/company_types/",
1449            #[cfg(feature = "vic3")]
1450            Item::CompanyCharterType => "common/company_charter_types/",
1451            #[cfg(feature = "vic3")]
1452            Item::CohesionLevel => "common/cohesion_levels/",
1453            #[cfg(feature = "vic3")]
1454            Item::CountryCreation => "common/country_creation/",
1455            #[cfg(feature = "vic3")]
1456            Item::CountryFormation => "common/country_formation/",
1457            #[cfg(feature = "vic3")]
1458            Item::CountryRank => "common/country_ranks/",
1459            #[cfg(feature = "vic3")]
1460            Item::CountryTier => "",
1461            #[cfg(feature = "vic3")]
1462            Item::CountryType => "common/country_types/",
1463            #[cfg(feature = "vic3")]
1464            Item::CultureGraphics => "common/culture_graphics/",
1465            #[cfg(feature = "vic3")]
1466            Item::Decree => "common/decrees/",
1467            #[cfg(feature = "vic3")]
1468            Item::DiplomaticAction => "common/diplomatic_actions/",
1469            #[cfg(feature = "vic3")]
1470            Item::DiplomaticCatalyst => "common/diplomatic_catalysts/",
1471            #[cfg(feature = "vic3")]
1472            Item::DiplomaticCatalystCategory => "common/diplomatic_catalyst_categories/",
1473            #[cfg(feature = "vic3")]
1474            Item::DiplomaticPlay => "common/diplomatic_plays/",
1475            #[cfg(feature = "vic3")]
1476            Item::DiscriminationTrait => "common/discrimination_traits/",
1477            #[cfg(feature = "vic3")]
1478            Item::DiscriminationTraitGroup => "common/discrimination_trait_groups/",
1479            #[cfg(feature = "vic3")]
1480            Item::DynamicCompanyName => "common/dynamic_company_names/",
1481            #[cfg(feature = "vic3")]
1482            Item::DynamicCountryMapColor => "common/dynamic_country_map_colors/",
1483            #[cfg(feature = "vic3")]
1484            Item::DynamicCountryName => "common/dynamic_country_names/",
1485            #[cfg(feature = "vic3")]
1486            Item::DynamicTreatyName => "common/dynamic_treaty_names/",
1487            #[cfg(feature = "vic3")]
1488            Item::EventCategory => "",
1489            #[cfg(feature = "vic3")]
1490            Item::FlagDefinition => "common/flag_definitions/",
1491            #[cfg(feature = "vic3")]
1492            Item::FleetDiorama => "gfx/map/fleet_dioramas/",
1493            #[cfg(feature = "vic3")]
1494            Item::FrontGraphics => "gfx/map/borders/front_graphics/",
1495            #[cfg(feature = "vic3")]
1496            Item::Goods => "common/goods/",
1497            #[cfg(feature = "vic3")]
1498            // TODO: find out if different filenames are acceptable in this dir
1499            Item::GradientBorderSettings => "gfx/map/gradient_border_settings/",
1500            #[cfg(feature = "vic3")]
1501            Item::HarvestConditionType => "common/harvest_condition_types/",
1502            #[cfg(feature = "vic3")]
1503            Item::HeritageTrait => "common/discrimination_traits/",
1504            #[cfg(feature = "vic3")]
1505            Item::InfamyThreshold => "",
1506            #[cfg(feature = "vic3")]
1507            Item::Institution => "common/institutions/",
1508            #[cfg(feature = "vic3")]
1509            Item::InterestGroup => "common/interest_groups/",
1510            #[cfg(feature = "vic3")]
1511            Item::InterestGroupTrait => "common/interest_group_traits/",
1512            #[cfg(feature = "vic3")]
1513            Item::JournalEntry => "common/journal_entries/",
1514            #[cfg(feature = "vic3")]
1515            Item::JournalEntryGroup => "common/journal_entry_groups/",
1516            #[cfg(feature = "vic3")]
1517            Item::LawType => "common/laws/",
1518            #[cfg(feature = "vic3")]
1519            Item::LanguageTrait => "common/discrimination_traits/",
1520            #[cfg(feature = "vic3")]
1521            Item::LegitimacyLevel => "common/legitimacy_levels/",
1522            #[cfg(feature = "vic3")]
1523            Item::Level => "",
1524            #[cfg(feature = "vic3")]
1525            Item::LibertyDesireLevel => "common/liberty_desire_levels/",
1526            #[cfg(feature = "vic3")]
1527            Item::MapLayer => "gfx/map/map_object_data/layers.txt",
1528            #[cfg(feature = "vic3")]
1529            Item::MapInteractionType => "common/map_interaction_types/",
1530            #[cfg(feature = "vic3")]
1531            Item::MapNotificationType => "common/map_notification_types/",
1532            #[cfg(feature = "vic3")]
1533            Item::MediaAlias => "gfx/media_aliases/",
1534            #[cfg(feature = "vic3")]
1535            Item::MilitaryFormationFlag => "common/military_formation_flags/",
1536            #[cfg(feature = "vic3")]
1537            Item::MobilizationOption => "common/mobilization_options/",
1538            #[cfg(feature = "vic3")]
1539            Item::MobilizationOptionGroup => "common/mobilization_option_groups/",
1540            #[cfg(feature = "vic3")]
1541            Item::ModifierTypeDefinition => "common/modifier_type_definitions/",
1542            #[cfg(feature = "vic3")]
1543            Item::Objective => "common/objectives/",
1544            #[cfg(feature = "vic3")]
1545            Item::ObjectiveSubgoal => "common/objective_subgoals/",
1546            #[cfg(feature = "vic3")]
1547            Item::ObjectiveSubgoalCategory => "common/objective_subgoal_categories/",
1548            #[cfg(feature = "vic3")]
1549            Item::Party => "common/parties/",
1550            #[cfg(feature = "vic3")]
1551            Item::PoliticalLobby => "common/political_lobbies/",
1552            #[cfg(feature = "vic3")]
1553            Item::PoliticalLobbyAppeasement => "common/political_lobby_appeasement/",
1554            #[cfg(feature = "vic3")]
1555            Item::PoliticalMovement => "common/political_movements",
1556            #[cfg(feature = "vic3")]
1557            Item::PoliticalMovementCategory => "common/political_movement_categories",
1558            #[cfg(feature = "vic3")]
1559            Item::PoliticalMovementPopSupport => "common/political_movement_pop_support",
1560            #[cfg(feature = "vic3")]
1561            Item::PopNeed => "common/pop_needs/",
1562            #[cfg(feature = "vic3")]
1563            Item::PowerBlocCoaPiece => "common/power_bloc_coa_pieces/",
1564            #[cfg(feature = "vic3")]
1565            Item::PowerBlocIdentity => "common/power_bloc_identities/",
1566            #[cfg(feature = "vic3")]
1567            Item::PowerBlocMapTexture => "common/power_bloc_map_textures/",
1568            #[cfg(feature = "vic3")]
1569            Item::PowerBlocName => "common/power_bloc_names/",
1570            #[cfg(feature = "vic3")]
1571            Item::PrestigeGoods => "common/prestige_goods/",
1572            #[cfg(feature = "vic3")]
1573            Item::Principle => "common/power_bloc_principles/",
1574            #[cfg(feature = "vic3")]
1575            Item::PrincipleGroup => "common/power_bloc_principle_groups/",
1576            #[cfg(feature = "vic3")]
1577            Item::ProductionMethod => "common/production_methods/",
1578            #[cfg(feature = "vic3")]
1579            Item::ProductionMethodGroup => "common/production_method_groups/",
1580            #[cfg(feature = "vic3")]
1581            Item::ProposalType => "common/proposal_types/",
1582            #[cfg(feature = "vic3")]
1583            Item::RelationsThreshold => "",
1584            #[cfg(feature = "vic3")]
1585            Item::ScriptedButton => "common/scripted_buttons/",
1586            #[cfg(feature = "vic3")]
1587            Item::ScriptedProgressBar => "common/scripted_progress_bars/",
1588            #[cfg(feature = "vic3")]
1589            Item::ScriptedTest => "tools/scripted_tests/",
1590            #[cfg(feature = "vic3")]
1591            Item::SecretGoal => "",
1592            #[cfg(feature = "vic3")]
1593            Item::Skin => "gfx/skins/",
1594            #[cfg(feature = "vic3")]
1595            Item::SocialClass => "common/social_classes/",
1596            #[cfg(feature = "vic3")]
1597            Item::SocialHierarchy => "common/social_hierarchies/",
1598            #[cfg(feature = "vic3")]
1599            Item::StateRegion => "map_data/state_regions/",
1600            #[cfg(feature = "vic3")]
1601            Item::StateTrait => "common/state_traits/",
1602            #[cfg(feature = "vic3")]
1603            Item::Strata => "",
1604            #[cfg(feature = "vic3")]
1605            Item::TechnologyEra => "common/technology/eras/",
1606            #[cfg(feature = "vic3")]
1607            Item::TerrainKey => "common/labels/",
1608            #[cfg(feature = "vic3")]
1609            Item::TerrainLabel => "common/labels/",
1610            #[cfg(feature = "vic3")]
1611            Item::TerrainManipulator => "common/terrain_manipulators/",
1612            #[cfg(feature = "vic3")]
1613            Item::TerrainMask => "gfx/map/masks/",
1614            #[cfg(feature = "vic3")]
1615            Item::TerrainMaterial => "gfx/map/terrain/materials.settings",
1616            #[cfg(feature = "vic3")]
1617            Item::Theme => "common/themes/",
1618            #[cfg(feature = "vic3")]
1619            Item::TraditionTrait => "common/discrimination_traits/",
1620            #[cfg(feature = "vic3")]
1621            Item::TransferOfPower => "",
1622            #[cfg(feature = "vic3")]
1623            Item::TreatyArticle => "common/treaty_articles/",
1624
1625            #[cfg(feature = "imperator")]
1626            Item::AiPlanGoals => "common/ai_plan_goals/",
1627            #[cfg(feature = "imperator")]
1628            Item::Ambition => "common/ambitions/",
1629            #[cfg(feature = "imperator")]
1630            Item::Area => "map_data/areas.txt",
1631            #[cfg(feature = "imperator")]
1632            Item::CultureGroup => "common/cultures/",
1633            #[cfg(feature = "imperator")]
1634            Item::Deity => "common/deities/",
1635            #[cfg(feature = "imperator")]
1636            Item::DeityCategory => "common/deity_categories/",
1637            #[cfg(feature = "imperator")]
1638            Item::DiplomaticStance => "common/diplomatic_stances/",
1639            #[cfg(feature = "imperator")]
1640            Item::EconomicPolicy => "common/economic_policies/",
1641            #[cfg(feature = "imperator")]
1642            Item::EventPicture => "common/event_pictures/",
1643            #[cfg(feature = "imperator")]
1644            Item::GovernorPolicy => "common/governor_policies/",
1645            #[cfg(feature = "imperator")]
1646            Item::GraphicalCultureType => "common/graphical_culture_types/",
1647            #[cfg(feature = "imperator")]
1648            Item::GreatWorkEffect => "common/great_work_effects/",
1649            #[cfg(feature = "imperator")]
1650            Item::GreatWorkEffectTier => "common/great_work_effect_tiers/",
1651            #[cfg(feature = "imperator")]
1652            Item::GreatWorkCategory => "common/great_work_categories/",
1653            #[cfg(feature = "imperator")]
1654            Item::GreatWorkMaterial => "common/great_work_materials/",
1655            #[cfg(feature = "imperator")]
1656            Item::GreatWorkModule => "common/great_work_modules/",
1657            #[cfg(feature = "imperator")]
1658            Item::GreatWorkTemplate => "common/great_work_templates/",
1659            #[cfg(feature = "imperator")]
1660            Item::Heritage => "common/heritage/",
1661            #[cfg(feature = "imperator")]
1662            Item::Invention => "common/inventions/",
1663            #[cfg(feature = "imperator")]
1664            Item::InventionGroup => "common/inventions/",
1665            #[cfg(feature = "imperator")]
1666            Item::LegionDistinction => "common/legion_distinctions/",
1667            #[cfg(feature = "imperator")]
1668            Item::LevyTemplate => "common/levy_templates/",
1669            #[cfg(feature = "imperator")]
1670            Item::Loyalty => "common/loyalty/",
1671            #[cfg(feature = "imperator")]
1672            Item::MilitaryTraditionTree => "common/military_traditions/",
1673            #[cfg(feature = "imperator")]
1674            Item::MilitaryTradition => "common/military_traditions/",
1675            #[cfg(feature = "imperator")]
1676            Item::MissionTask => "common/missions/",
1677            #[cfg(feature = "imperator")]
1678            Item::Office => "common/offices/",
1679            #[cfg(feature = "imperator")]
1680            Item::Opinion => "common/opinions/",
1681            #[cfg(feature = "imperator")]
1682            Item::PartyAgenda => "common/party_agendas",
1683            #[cfg(feature = "imperator")]
1684            Item::PartyType => "common/party_types/",
1685            #[cfg(feature = "imperator")]
1686            Item::PostSetupCharacters => "setup/post_character/",
1687            #[cfg(feature = "imperator")]
1688            Item::Price => "common/prices/",
1689            #[cfg(feature = "imperator")]
1690            Item::ProvinceRank => "common/province_ranks/",
1691            #[cfg(feature = "imperator")]
1692            Item::TechnologyTable => "common/technology_tables/",
1693            #[cfg(feature = "imperator")]
1694            Item::SetupCharacters => "setup/characters/",
1695            #[cfg(feature = "imperator")]
1696            Item::SetupProvinces => "setup/provinces/",
1697            #[cfg(feature = "imperator")]
1698            Item::TradeGood => "common/trade_goods/",
1699            #[cfg(feature = "imperator")]
1700            Item::Treasure => "setup/main/",
1701            #[cfg(feature = "imperator")]
1702            Item::Unit => "common/units/",
1703            #[cfg(feature = "imperator")]
1704            Item::UnitAbility => "common/unit_abilities/",
1705
1706            #[cfg(feature = "hoi4")]
1707            Item::Ability => "common/abilities/",
1708            #[cfg(feature = "hoi4")]
1709            Item::Acclimatation => "common/acclimatation.txt",
1710            #[cfg(feature = "hoi4")]
1711            Item::AdjacencyRule => "map/adjacency_rules.txt",
1712            #[cfg(feature = "hoi4")]
1713            Item::AceModifier => "common/aces",
1714            #[cfg(feature = "hoi4")]
1715            Item::AdvisorSlot => "common/script_enums.txt",
1716            #[cfg(feature = "hoi4")]
1717            Item::AiArea => "common/ai_areas/",
1718            #[cfg(feature = "hoi4")]
1719            Item::AiStrategyType => "common/ai_strategy/_documentation.md",
1720            #[cfg(feature = "hoi4")]
1721            Item::CharacterIdeaToken => "common/characters/",
1722            #[cfg(feature = "hoi4")]
1723            Item::CombatTacticPhase => "common/combat_tactics.txt",
1724            #[cfg(feature = "hoi4")]
1725            Item::Continent => "map/continent.txt",
1726            #[cfg(feature = "hoi4")]
1727            Item::CountryLeaderTrait => "common/country_leader/",
1728            #[cfg(feature = "hoi4")]
1729            Item::CountryHistory => "history/countries/",
1730            #[cfg(feature = "hoi4")]
1731            Item::CountryTag => "common/country_tags/",
1732            #[cfg(feature = "hoi4")]
1733            Item::CountryTagAlias => "common/country_tag_aliases/",
1734            #[cfg(feature = "hoi4")]
1735            Item::DecisionCategory => "common/decisions/categories/",
1736            #[cfg(feature = "hoi4")]
1737            Item::DivisionNamesGroup => "common/units/names_divisions/",
1738            #[cfg(feature = "hoi4")]
1739            Item::DivisionTemplate => "history/units/",
1740            #[cfg(feature = "hoi4")]
1741            Item::DynamicModifier => "common/dynamic_modifiers/",
1742            #[cfg(feature = "hoi4")]
1743            Item::Equipment => "common/units/equipment/",
1744            #[cfg(feature = "hoi4")]
1745            Item::EquipmentBonusType => "common/script_enums.txt",
1746            #[cfg(feature = "hoi4")]
1747            Item::EquipmentCategory => "common/script_enums.txt",
1748            #[cfg(feature = "hoi4")]
1749            Item::EquipmentGroup => "common/equipment_groups/",
1750            #[cfg(feature = "hoi4")]
1751            Item::EquipmentModule => "common/units/equipment/modules/",
1752            #[cfg(feature = "hoi4")]
1753            Item::EquipmentModuleCategory => "common/units/equipment/modules/",
1754            #[cfg(feature = "hoi4")]
1755            Item::EquipmentSearchFilter => "common/units/equipment/",
1756            #[cfg(feature = "hoi4")]
1757            Item::EquipmentStat => "common/script_enums.txt",
1758            #[cfg(feature = "hoi4")]
1759            Item::EquipmentUpgrade => "common/units/equipment/upgrades/", // TODO HOI4
1760            #[cfg(feature = "hoi4")]
1761            Item::GraphicalTerrain => "common/terrain/",
1762            #[cfg(feature = "hoi4")]
1763            Item::IdeaCategory => "common/idea_tags/",
1764            #[cfg(feature = "hoi4")]
1765            Item::IdeologyGroup => "common/ideologies/",
1766            #[cfg(feature = "hoi4")]
1767            Item::IndustrialOrg => "common/military_industrial_organization/organizations/",
1768            #[cfg(feature = "hoi4")]
1769            Item::IndustrialOrgBonusWeight => {
1770                "common/military_industrial_organization/ai_bonus_weights/"
1771            }
1772            #[cfg(feature = "hoi4")]
1773            Item::IndustrialOrgPolicy => "common/military_industrial_organization/policies/",
1774            #[cfg(feature = "hoi4")]
1775            Item::IndustrialOrgTrait => "common/military_industrial_organization/organizations/",
1776            #[cfg(feature = "hoi4")]
1777            Item::IntelligenceAgencyBranch => "common/intelligence_agency_upgrades/",
1778            #[cfg(feature = "hoi4")]
1779            Item::IntelligenceAgencyUpgrade => "common/intelligence_agency_upgrades/",
1780            #[cfg(feature = "hoi4")]
1781            Item::MusicAsset => "music/",
1782            #[cfg(feature = "hoi4")]
1783            Item::NationalFocus => "common/national_focus/",
1784            #[cfg(feature = "hoi4")]
1785            Item::NationalFocusStyle => "common/national_focus/",
1786            #[cfg(feature = "hoi4")]
1787            Item::NationalFocusTree => "common/national_focus/",
1788            #[cfg(feature = "hoi4")]
1789            Item::Operation => "common/operations/",
1790            #[cfg(feature = "hoi4")]
1791            Item::OperationPhase => "common/operation_phases/",
1792            #[cfg(feature = "hoi4")]
1793            Item::OperationToken => "common/operation_tokens/",
1794            #[cfg(feature = "hoi4")]
1795            Item::PowerBalance => "common/bop/",
1796            #[cfg(feature = "hoi4")]
1797            Item::PowerBalanceSide => "common/bop/",
1798            #[cfg(feature = "hoi4")]
1799            Item::ProductionStat => "common/script_enum.txt",
1800            #[cfg(feature = "hoi4")]
1801            Item::PrototypeReward => "common/special_projects/prototype_rewards/",
1802            #[cfg(feature = "hoi4")]
1803            Item::RailwayGunNames => "common/units/names_railway_guns/",
1804            #[cfg(feature = "hoi4")]
1805            Item::Resource => "common/resources/",
1806            #[cfg(feature = "hoi4")]
1807            Item::ScriptEnum => "common/script_enums.txt",
1808            #[cfg(feature = "hoi4")]
1809            Item::ScriptedConstant => "common/scripted_constants/", // TODO HOI4
1810            #[cfg(feature = "hoi4")]
1811            Item::ScriptedLocalisation => "common/scripted_localisation/",
1812            #[cfg(feature = "hoi4")]
1813            Item::ShipNames => "common/units/names_ships/",
1814            #[cfg(feature = "hoi4")]
1815            Item::SoundEffect | Item::SoundFalloff => "sound/",
1816            #[cfg(feature = "hoi4")]
1817            Item::SpawnPoint => "common/buildings/",
1818            #[cfg(feature = "hoi4")]
1819            Item::Specialization => "common/special_projects/specialization/",
1820            #[cfg(feature = "hoi4")]
1821            Item::SpecialProject => "common/special_projects/projects/",
1822            #[cfg(feature = "hoi4")]
1823            Item::SpecialProjectTag => "common/special_projects/project_tags/",
1824            #[cfg(feature = "hoi4")]
1825            Item::ScientistTrait => "common/scientist_traits/",
1826            #[cfg(feature = "hoi4")]
1827            Item::ShipName => "history/units/",
1828            #[cfg(feature = "hoi4")]
1829            Item::Sprite => "gfx/",
1830            #[cfg(feature = "hoi4")]
1831            Item::State => "history/states/",
1832            #[cfg(feature = "hoi4")]
1833            Item::StateCategory => "common/state_category/",
1834            #[cfg(feature = "hoi4")]
1835            Item::SubUnit => "common/units/",
1836            #[cfg(feature = "hoi4")]
1837            Item::SubUnitCategory => "common/unit_tags/",
1838            #[cfg(feature = "hoi4")]
1839            Item::SupplyArea => "map/supplyareas",
1840            #[cfg(feature = "hoi4")]
1841            Item::TechnologyCategory => "common/technology_tags/",
1842            #[cfg(feature = "hoi4")]
1843            Item::TechnologyFolder => "common/technology_tags/",
1844            #[cfg(feature = "hoi4")]
1845            Item::TechnologySharing => "common/technology_sharing/",
1846            #[cfg(feature = "hoi4")]
1847            Item::UnitHistory => "history/units/",
1848            #[cfg(feature = "hoi4")]
1849            Item::UnitLeaderSkill => "common/unit_leader/",
1850            #[cfg(feature = "hoi4")]
1851            Item::UnitLeaderTrait => "common/unit_leader/",
1852            #[cfg(feature = "hoi4")]
1853            Item::UnitNames => "common/units/names/",
1854        }
1855    }
1856
1857    /// Confidence value to use when reporting that an item is missing.
1858    /// Should be `Strong` for most, `Weak` for items that aren't defined anywhere but just used (such as gfx flags).
1859    pub fn confidence(self) -> Confidence {
1860        match self {
1861            #[cfg(feature = "jomini")]
1862            Item::AccessoryTag => Confidence::Weak,
1863
1864            // GuiType and GuiTemplate are here because referring to templates in other mods is a
1865            // common compatibility technique.
1866            Item::GuiType | Item::GuiTemplate | Item::Sound => Confidence::Weak,
1867
1868            #[cfg(feature = "ck3")]
1869            Item::AccoladeCategory
1870            | Item::BuildingGfx
1871            | Item::ClothingGfx
1872            | Item::CoaGfx
1873            | Item::CultureParameter
1874            | Item::MemoryCategory
1875            | Item::UnitGfx => Confidence::Weak,
1876
1877            #[cfg(feature = "ck3")]
1878            Item::SpecialBuilding => Confidence::Reasonable,
1879
1880            _ => Confidence::Strong,
1881        }
1882    }
1883
1884    /// Severity value to use when reporting that an item is missing.
1885    /// * `Error` - most things
1886    /// * `Warning` - things that only impact visuals or presentation
1887    /// * `Untidy` - things that don't matter much at all
1888    /// * `Fatal` - things that cause crashes if they're missing
1889    ///
1890    /// This is only one piece of the severity puzzle. It can also depend on the caller who's expecting the item to exist.
1891    /// That part isn't handled yet.
1892    pub fn severity(self) -> Severity {
1893        match self {
1894            // GuiType and GuiTemplate are here because referring to templates in other mods is a
1895            // common compatibility technique.
1896            Item::GuiType | Item::GuiTemplate => Severity::Untidy,
1897
1898            Item::File | Item::Localization | Item::MapEnvironment => Severity::Warning,
1899
1900            #[cfg(feature = "jomini")]
1901            Item::Accessory
1902            | Item::AccessoryTag
1903            | Item::AccessoryVariation
1904            | Item::AccessoryVariationLayout
1905            | Item::AccessoryVariationTextures
1906            | Item::Coa
1907            | Item::CoaColorList
1908            | Item::CoaColoredEmblemList
1909            | Item::CoaPatternList
1910            | Item::CoaTemplate
1911            | Item::CoaTemplateList
1912            | Item::CoaTexturedEmblemList
1913            | Item::CustomLocalization
1914            | Item::EffectLocalization
1915            | Item::Ethnicity
1916            | Item::GameConcept
1917            | Item::NamedColor
1918            | Item::PortraitAnimation
1919            | Item::PortraitCamera
1920            | Item::PortraitEnvironment
1921            | Item::Sound
1922            | Item::TextFormat
1923            | Item::TextIcon
1924            | Item::TextureFile
1925            | Item::TriggerLocalization => Severity::Warning,
1926
1927            #[cfg(feature = "ck3")]
1928            Item::AccoladeIcon
1929            | Item::ArtifactVisual
1930            | Item::BuildingGfx
1931            | Item::ClothingGfx
1932            | Item::CoaDynamicDefinition
1933            | Item::CoaGfx
1934            | Item::CultureAesthetic
1935            | Item::CultureCreationName
1936            | Item::EventBackground
1937            | Item::EventTheme
1938            | Item::EventTransition
1939            | Item::Flavorization
1940            | Item::GraphicalFaith
1941            | Item::ModifierFormat
1942            | Item::MottoInsert
1943            | Item::Motto
1944            | Item::Music
1945            | Item::Nickname
1946            | Item::ScriptedIllustration
1947            | Item::UnitGfx => Severity::Warning,
1948
1949            #[cfg(feature = "vic3")]
1950            Item::MapLayer
1951            | Item::ModifierTypeDefinition
1952            | Item::TerrainManipulator
1953            | Item::TerrainMask
1954            | Item::TerrainMaterial => Severity::Warning,
1955
1956            #[cfg(feature = "hoi4")]
1957            Item::Sprite => Severity::Warning,
1958
1959            _ => Severity::Error,
1960        }
1961    }
1962}
1963
1964/// The callback type for adding one item instance to the database.
1965pub(crate) type ItemAdder = fn(&mut Db, Token, Block);
1966
1967/// The specification for loading an [`Item`] type into the [`Db`].
1968///
1969/// An instance of this can be placed in every `data` module using the `inventory::submit!` macro.
1970/// This will register the loader so that the [`Everything`] object can load all defined items.
1971// Note that this is an enum so that users can more conveniently construct it. It used to be a
1972// struct with various constructor functions, but that didn't work because the ItemAdder type has a
1973// &mut in it, and that wasn't allowed in const functions even though the function pointer itself
1974// is const. See https://github.com/rust-lang/rust/issues/57349 for details.
1975// TODO: once that issue stabilizes, we can revisit the ItemLoader type.
1976pub(crate) enum ItemLoader {
1977    /// A convenience variant for loaders that are the most common type.
1978    ///
1979    /// * [`GameFlags`] is which games this item loader is for.
1980    /// * [`Item`] is the item type being loaded.
1981    ///
1982    /// The [`ItemAdder`] function does not have to load exclusively this type of item.
1983    /// Related items are ok. The main use of the [`Item`] field is to get the path for this item
1984    /// type, so that files are loaded from that folder.
1985    ///
1986    /// `Normal` loaders have extension `.txt`, `LoadAsFile::No`, and `Recursive::Maybe`. They default
1987    /// to a [`PdxEncoding`] appropriate to the game being validated.
1988    Normal(GameFlags, Item, ItemAdder),
1989    /// A variant that allows the full range of item loader behvavior.
1990    /// * [`PdxEncoding`] indicates whether to expect utf-8 and/or a BOM in the files.
1991    /// * The `&'static str` is the file extension to look for (including the dot).
1992    /// * [`LoadAsFile`] is whether to load the whole file as one item, or treat it as normal with a
1993    ///   series of items in one file.
1994    /// * [`Recursive`] indicates whether to load subfolders of the item's main folder.
1995    ///   `Recursive::Maybe` means apply game-dependent logic.
1996    Full(GameFlags, Item, PdxEncoding, &'static str, LoadAsFile, Recursive, ItemAdder),
1997}
1998
1999inventory::collect!(ItemLoader);
2000
2001impl ItemLoader {
2002    pub fn for_game(&self, game: Game) -> bool {
2003        let game_flags = match self {
2004            ItemLoader::Normal(game_flags, _, _)
2005            | ItemLoader::Full(game_flags, _, _, _, _, _, _) => game_flags,
2006        };
2007        game_flags.contains(GameFlags::from(game))
2008    }
2009
2010    pub fn itype(&self) -> Item {
2011        match self {
2012            ItemLoader::Normal(_, itype, _) | ItemLoader::Full(_, itype, _, _, _, _, _) => *itype,
2013        }
2014    }
2015
2016    pub fn encoding(&self) -> PdxEncoding {
2017        match self {
2018            ItemLoader::Normal(_, _, _) => {
2019                #[cfg(feature = "hoi4")]
2020                if Game::is_hoi4() {
2021                    return PdxEncoding::Utf8NoBom;
2022                }
2023                PdxEncoding::Utf8Bom
2024            }
2025            ItemLoader::Full(_, _, encoding, _, _, _, _) => *encoding,
2026        }
2027    }
2028
2029    pub fn extension(&self) -> &'static str {
2030        match self {
2031            ItemLoader::Normal(_, _, _) => ".txt",
2032            ItemLoader::Full(_, _, _, extension, _, _, _) => extension,
2033        }
2034    }
2035
2036    pub fn whole_file(&self) -> bool {
2037        match self {
2038            ItemLoader::Normal(_, _, _) => false,
2039            ItemLoader::Full(_, _, _, _, load_as_file, _, _) => {
2040                matches!(load_as_file, LoadAsFile::Yes)
2041            }
2042        }
2043    }
2044
2045    pub fn recursive(&self) -> bool {
2046        match self {
2047            ItemLoader::Normal(_, _, _) => {
2048                Game::is_ck3() && self.itype().path().starts_with("common/")
2049            }
2050            ItemLoader::Full(_, _, _, _, _, recursive, _) => match recursive {
2051                Recursive::Yes => true,
2052                Recursive::No => false,
2053                Recursive::Maybe => Game::is_ck3() && self.itype().path().starts_with("common/"),
2054            },
2055        }
2056    }
2057
2058    pub fn adder(&self) -> ItemAdder {
2059        match self {
2060            ItemLoader::Normal(_, _, adder) | ItemLoader::Full(_, _, _, _, _, _, adder) => *adder,
2061        }
2062    }
2063}
2064
2065pub enum LoadAsFile {
2066    Yes,
2067    No,
2068}
2069
2070pub enum Recursive {
2071    Yes,
2072    No,
2073    #[allow(dead_code)]
2074    Maybe,
2075}