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