From 9a6bcfa21a72dec54712f0cd3bc9db8f5e7300f7 Mon Sep 17 00:00:00 2001 From: clodan Date: Tue, 21 Jan 2025 22:57:13 +0000 Subject: [PATCH] ItemTplGenerator --- Libraries/Core/Models/Enums/ItemTpl.cs | 2 +- Libraries/Core/Models/Enums/Weapons.cs | 162 +++++++++++++++++- Libraries/Core/Services/LocaleService.cs | 3 - Tools/ItemTplGenerator/ItemOverrides.cs | 130 ++++++++++++++ Tools/ItemTplGenerator/ItemTplGenerator.cs | 81 ++++----- .../Properties/launchSettings.json | 2 +- 6 files changed, 329 insertions(+), 51 deletions(-) create mode 100644 Tools/ItemTplGenerator/ItemOverrides.cs diff --git a/Libraries/Core/Models/Enums/ItemTpl.cs b/Libraries/Core/Models/Enums/ItemTpl.cs index 710b4866..6db1f3e9 100644 --- a/Libraries/Core/Models/Enums/ItemTpl.cs +++ b/Libraries/Core/Models/Enums/ItemTpl.cs @@ -2815,7 +2815,7 @@ public static class ItemTpl public static string MAGAZINE_556X45_HK_STEEL_30RND = "5c05413a0db834001c390617"; public static string MAGAZINE_556X45_MAG5100_100RND = "5c6592372e221600133e47d7"; public static string MAGAZINE_556X45_MAG560_60RND = "544a37c44bdc2d25388b4567"; - public static string MAGAZINE_556X45_MK16_30RND = "61840d85568c120fdd2962a5"; + public static string MAGAZINE_556X45_MK16_FDE_30RND = "61840d85568c120fdd2962a5"; public static string MAGAZINE_556X45_PMAG_D60_60RND = "59c1383d86f774290a37e0ca"; public static string MAGAZINE_556X45_PM_GEN2_30RND = "5c6d450c2e221600114c997d"; public static string MAGAZINE_556X45_STANAG_30RND = "55d4887d4bdc2d962f8b4570"; diff --git a/Libraries/Core/Models/Enums/Weapons.cs b/Libraries/Core/Models/Enums/Weapons.cs index f99c8d17..2adb9ef8 100644 --- a/Libraries/Core/Models/Enums/Weapons.cs +++ b/Libraries/Core/Models/Enums/Weapons.cs @@ -2,5 +2,165 @@ namespace Core.Models.Enums; public static class Weapons { - + public static string ASSAULTCARBINE_762X39_OP_SKS = "587e02ff24597743df3deaeb"; + public static string ASSAULTCARBINE_762X39_SKS = "574d967124597745970e7c94"; + public static string ASSAULTCARBINE_762X51_VPO_101_VEPR_HUNTER = "5c501a4d2e221602b412b540"; + public static string ASSAULTCARBINE_762X54R_AVT_40 = "6410733d5dd49d77bd07847e"; + public static string ASSAULTCARBINE_762X54R_SVT_40 = "643ea5b23db6f9f57107d9fd"; + public static string ASSAULTCARBINE_9X39_9A_91 = "644674a13d52156624001fbc"; + public static string ASSAULTCARBINE_9X39_AS_VAL = "57c44b372459772d2b39b8ce"; + public static string ASSAULTCARBINE_9X39_SR_3M = "651450ce0e00edc794068371"; + public static string ASSAULTCARBINE_9X39_VSK_94 = "645e0c6b3b381ede770e1cc9"; + public static string ASSAULTRIFLE_127X55_ASH_12 = "5cadfbf7ae92152ac412eeef"; + public static string ASSAULTRIFLE_366TKM_VPO_209 = "59e6687d86f77411d949b251"; + public static string ASSAULTRIFLE_545X39_AKS_74 = "5bf3e0490db83400196199af"; + public static string ASSAULTRIFLE_545X39_AKS_74N = "5ab8e9fcd8ce870019439434"; + public static string ASSAULTRIFLE_545X39_AKS_74U = "57dc2fa62459775949412633"; + public static string ASSAULTRIFLE_545X39_AKS_74UB = "5839a40f24597726f856b511"; + public static string ASSAULTRIFLE_545X39_AKS_74UN = "583990e32459771419544dd2"; + public static string ASSAULTRIFLE_545X39_AK_105 = "5ac66d9b5acfc4001633997a"; + public static string ASSAULTRIFLE_545X39_AK_12 = "6499849fc93611967b034949"; + public static string ASSAULTRIFLE_545X39_AK_545 = "628b5638ad252a16da6dd245"; + public static string ASSAULTRIFLE_545X39_AK_545_SHORT = "628b9c37a733087d0d7fe84b"; + public static string ASSAULTRIFLE_545X39_AK_74 = "5bf3e03b0db834001d2c4a9c"; + public static string ASSAULTRIFLE_545X39_AK_74M = "5ac4cd105acfc40016339859"; + public static string ASSAULTRIFLE_545X39_AK_74N = "5644bd2b4bdc2d3b4c8b4572"; + public static string ASSAULTRIFLE_556X45_ADAR_2_15 = "5c07c60e0db834002330051f"; + public static string ASSAULTRIFLE_556X45_AK_101 = "5ac66cb05acfc40198510a10"; + public static string ASSAULTRIFLE_556X45_AK_102 = "5ac66d015acfc400180ae6e4"; + public static string ASSAULTRIFLE_556X45_AUG_A1 = "62e7c4fba689e8c9c50dfc38"; + public static string ASSAULTRIFLE_556X45_AUG_A3 = "63171672192e68c5460cebc5"; + public static string ASSAULTRIFLE_556X45_AUG_A3_BLACK = "6718817435e3cfd9550d2c27"; + public static string ASSAULTRIFLE_556X45_G36 = "623063e994fc3f7b302a9696"; + public static string ASSAULTRIFLE_556X45_HK_416A5 = "5bb2475ed4351e00853264e3"; + public static string ASSAULTRIFLE_556X45_M4A1 = "5447a9cd4bdc2dbd208b4567"; + public static string ASSAULTRIFLE_556X45_MDR = "5c488a752e221602b412af63"; + public static string ASSAULTRIFLE_556X45_MK_16 = "6184055050224f204c1da540"; + public static string ASSAULTRIFLE_556X45_MK_16_FDE = "618428466ef05c2ce828f218"; + public static string ASSAULTRIFLE_556X45_TX_15_DML = "5d43021ca4b9362eab4b5e25"; + public static string ASSAULTRIFLE_68X51_SPEAR_68 = "65290f395ae2ae97b80fdf2d"; + public static string ASSAULTRIFLE_762X35_MCX_300_BLK = "5fbcc1d9016cce60e8341ab3"; + public static string ASSAULTRIFLE_762X35_VELOCIRAPTOR_300_BLK = "674d6121c09f69dfb201a888"; + public static string ASSAULTRIFLE_762X39_AKM = "59d6088586f774275f37482f"; + public static string ASSAULTRIFLE_762X39_AKMN = "5a0ec13bfcdbcb00165aa685"; + public static string ASSAULTRIFLE_762X39_AKMS = "59ff346386f77477562ff5e2"; + public static string ASSAULTRIFLE_762X39_AKMSN = "5abcbc27d8ce8700182eceeb"; + public static string ASSAULTRIFLE_762X39_AK_103 = "5ac66d2e5acfc43b321d4b53"; + public static string ASSAULTRIFLE_762X39_AK_104 = "5ac66d725acfc43b321d4b60"; + public static string ASSAULTRIFLE_762X39_MK47 = "606587252535c57a13424cfd"; + public static string ASSAULTRIFLE_762X39_RD_704 = "628a60ae6b1d481ff772e9c8"; + public static string ASSAULTRIFLE_762X39_VPO_136_VEPR_KM = "59e6152586f77473dc057aa1"; + public static string ASSAULTRIFLE_762X51_MDR = "5dcbd56fdbd3d91b3e5468d5"; + public static string ASSAULTRIFLE_762X51_MK_17 = "6183afd850224f204c1da514"; + public static string ASSAULTRIFLE_762X51_MK_17_FDE = "6165ac306ef05c2ce828ef74"; + public static string ASSAULTRIFLE_762X51_SA58 = "5b0bbe4e5acfc40dc528a72d"; + public static string ASSAULTRIFLE_762X51_X_17 = "676176d362e0497044079f4c"; + public static string ASSAULTRIFLE_9X18PM_MASTER_HAND = "5ae083b25acfc4001a5fc702"; + public static string FLARE_26X75_BLUE = "66d98233302686954b0c6f81"; + public static string FLARE_26X75_FIREWORK = "675ea3d6312c0a5c4e04e317"; + public static string FLARE_26X75_FLARE_WHITE = "62178be9d0050232da3485d9"; + public static string FLARE_26X75_GREEN = "6217726288ed9f0845317459"; + public static string FLARE_26X75_RED = "62178c4d4ecf221597654e3d"; + public static string FLARE_26X75_S_YELLOW_SPECIAL_YELLOW = "66d9f1abb16d9aacf5068468"; + public static string FLARE_26X75_YELLOW = "624c0b3340357b5f566e8766"; + public static string GRENADELAUNCHER_40MMRU_FN40GL = "639af924d0446708ee62294e"; + public static string GRENADELAUNCHER_40X46_FN40GL = "5e81ebcd8e146c7080625e15"; + public static string GRENADELAUNCHER_40X46_FN40GL_2 = "639c3fbbd0446708ee622ee9"; + public static string MACHINEGUN_30X29_AGS_30 = "5d52cc5ba4b9367408500062"; + public static string MACHINEGUN_545X39_NSV_UTYOS = "5cdeb229d7f00c000e7ce174"; + public static string MACHINEGUN_545X39_RPK_16 = "5beed0f50db834001c062b12"; + public static string MACHINEGUN_762X39_RPD = "6513ef33e06849f06c0957ca"; + public static string MACHINEGUN_762X39_RPDN = "65268d8ecb944ff1e90ea385"; + public static string MACHINEGUN_762X51_M60E6 = "661ceb1b9311543c7104149b"; + public static string MACHINEGUN_762X51_M60E6_FDE = "661cec09b2c6356b4d0c7a36"; + public static string MACHINEGUN_762X51_MK_43_MOD_1 = "65fb023261d5829b2d090755"; + public static string MACHINEGUN_762X54R_PKM = "64637076203536ad5600c990"; + public static string MACHINEGUN_762X54R_PKP = "64ca3d3954fc657e230529cc"; + public static string MACHINEGUN_762X54R_PKTM = "657857faeff4c850222dff1b"; + public static string MARKSMANRIFLE_762X51_G28 = "6176aca650224f204c1da3fb"; + public static string MARKSMANRIFLE_762X51_M1A = "5aafa857e5b5b00018480968"; + public static string MARKSMANRIFLE_762X51_RFB = "5f2a9575926fd9352339381f"; + public static string MARKSMANRIFLE_762X51_RSASS = "5a367e5dc4a282000e49738f"; + public static string MARKSMANRIFLE_762X51_SR_25 = "5df8ce05b11454561e39243b"; + public static string MARKSMANRIFLE_762X54R_SVDS = "5c46fbd72e2216398b5a8c9c"; + public static string MARKSMANRIFLE_86X70_MK_18_MJLNIR = "5fc22d7c187fea44d52eda44"; + public static string MARKSMANRIFLE_9X39_VSS_VINTOREZ = "57838ad32459774a17445cd2"; + public static string PISTOL_127X33_DESERT_EAGLE_L5 = "669fa3f88abd2662d80eee77"; + public static string PISTOL_127X33_DESERT_EAGLE_L6 = "669fa39b48fc9f8db6035a0c"; + public static string PISTOL_127X33_DESERT_EAGLE_L6_WTS = "669fa3d876116c89840b1217"; + public static string PISTOL_127X33_DESERT_EAGLE_MK_XIX = "668fe5a998b5ad715703ddd6"; + public static string PISTOL_20X1MM_BLICKY = "66015072e9f84d5680039678"; + public static string PISTOL_45ACP_M1911A1 = "5e81c3cbac2bb513793cdc75"; + public static string PISTOL_45ACP_M45A1 = "5f36a0e5fbf956000b716b65"; + public static string PISTOL_45ACP_USP_45 = "6193a720f8ee7e52e42109ed"; + public static string PISTOL_57X28_FN_5_7 = "5d3eb3b0a4b93615055e84d2"; + public static string PISTOL_57X28_FN_5_7_FDE = "5d67abc1a4b93614ec50137f"; + public static string PISTOL_762X25TT_TT = "571a12c42459771f627b58a0"; + public static string PISTOL_762X25TT_TT_GOLD_GOLDEN = "5b3b713c5acfc4330140bd8d"; + public static string PISTOL_9X18PM_APB = "5abccb7dd8ce87001773e277"; + public static string PISTOL_9X18PM_APS = "5a17f98cfcdbcb0980087290"; + public static string PISTOL_9X18PM_PB = "56e0598dd2720bb5668b45a6"; + public static string PISTOL_9X18PM_PM = "5448bd6b4bdc2dfc2f8b4569"; + public static string PISTOL_9X18PM_PM_T = "579204f224597773d619e051"; + public static string PISTOL_9X19_GLOCK_17 = "5a7ae0c351dfba0017554310"; + public static string PISTOL_9X19_GLOCK_18C = "5b1fa9b25acfc40018633c01"; + public static string PISTOL_9X19_GLOCK_19X = "63088377b5cd696784087147"; + public static string PISTOL_9X19_M9A3 = "5cadc190ae921500103bb3b6"; + public static string PISTOL_9X19_MP_443_GRACH = "576a581d2459771e7b1bc4f1"; + public static string PISTOL_9X19_P226R = "56d59856d2720bd8418b456a"; + public static string PISTOL_9X19_PL_15 = "602a9740da11d6478d5a06dc"; + public static string PISTOL_9X21_SR_1MP = "59f98b4986f7746f546d2cef"; + public static string PISTOL_9X33R_DESERT_EAGLE_L5 = "669fa409933e898cce0c2166"; + public static string REVOLVER_127X55_RSH_12 = "633ec7c2a6918cb895019c6c"; + public static string REVOLVER_12G_MTS_255_12 = "60db29ce99594040e04c4a27"; + public static string REVOLVER_40X46_MSGL = "6275303a9f372d6ea97f9ec7"; + public static string REVOLVER_9X19_CR_200DS = "624c2e8614da335f1e034d8c"; + public static string REVOLVER_9X33R_CR_50DS = "61a4c8884f95bc3b2c5dc96f"; + public static string SHOTGUN_12G_590A1 = "5e870397991fd70db46995c8"; + public static string SHOTGUN_12G_AA_12_GEN_1 = "66ffa9b66e19cc902401c5e8"; + public static string SHOTGUN_12G_AA_12_GEN_2 = "67124dcfa3541f2a1f0e788b"; + public static string SHOTGUN_12G_M3_SUPER_90 = "6259b864ebedf17603599e88"; + public static string SHOTGUN_12G_M870 = "5a7828548dc32e5a9c28b516"; + public static string SHOTGUN_12G_MP_133 = "54491c4f4bdc2db1078b4568"; + public static string SHOTGUN_12G_MP_153 = "56dee2bdd2720bc8328b4567"; + public static string SHOTGUN_12G_MP_155 = "606dae0ab0e443224b421bb7"; + public static string SHOTGUN_12G_MP_43_1C = "5580223e4bdc2d1c128b457f"; + public static string SHOTGUN_12G_SAIGA_12K = "576165642459773c7a400233"; + public static string SHOTGUN_12G_SAIGA_12K_FA = "674fe9a75e51f1c47c04ec23"; + public static string SHOTGUN_12G_SAWED_OFF = "64748cb8de82c85eaf0a273a"; + public static string SHOTGUN_20G_TOZ_106 = "5a38e6bac4a2826c6e06d79b"; + public static string SHOTGUN_23X75_KS_23M = "5e848cc2988a8701445df1e8"; + public static string SHOTGUN_762X54R_MP_18 = "61f7c9e189e6fb1a5e3ea78d"; + public static string SIGNALPISTOL_26X75_SP_81 = "620109578d82e67e7911abf2"; + public static string SMG_45ACP_UMP_45 = "5fc3e272f8b6a877a729eac5"; + public static string SMG_45ACP_VECTOR_45ACP = "5fb64bc92b1b027b1f50bcf2"; + public static string SMG_46X30_MP7A1 = "5ba26383d4351e00334c93d9"; + public static string SMG_46X30_MP7A2 = "5bd70322209c4d00d7167b8f"; + public static string SMG_57X28_P90 = "5cc82d76e24e8d00134b4b83"; + public static string SMG_762X25TT_PPSH41 = "5ea03f7400685063ec28bfa8"; + public static string SMG_9X18PMM_PP_9_KLIN = "57f4c844245977379d5c14d1"; + public static string SMG_9X18PM_PP_91_01_KEDR_B = "57f3c6bd24597738e730fa2f"; + public static string SMG_9X18PM_PP_91_KEDR = "57d14d2524597714373db789"; + public static string SMG_9X19_MP5K_N = "5d2f0d8048f0356c925bc3b0"; + public static string SMG_9X19_MP5_NAVY_3_ROUND_BURST = "5926bb2186f7744b1c6c6e60"; + public static string SMG_9X19_MP9 = "5e00903ae9dc277128008b87"; + public static string SMG_9X19_MP9_N = "5de7bd7bfd6b4e6e2276dc25"; + public static string SMG_9X19_MPX = "58948c8e86f77409493f7266"; + public static string SMG_9X19_PP_19_01 = "59984ab886f7743e98271174"; + public static string SMG_9X19_SAIGA_9 = "59f9cabd86f7743a10721f46"; + public static string SMG_9X19_STM_9 = "60339954d62c9b14ed777c06"; + public static string SMG_9X19_UZI = "66992b349950f5f4cd06029f"; + public static string SMG_9X19_UZI_PRO_PISTOL = "6680304edadb7aa61d00cef0"; + public static string SMG_9X19_UZI_PRO_SMG = "668e71a8dadf42204c032ce1"; + public static string SMG_9X19_VECTOR_9X19 = "5fc3f2d5900b1d5091531e57"; + public static string SMG_9X21_SR_2M = "62e14904c2699c0ec93adc47"; + public static string SNIPERRIFLE_366TKM_VPO_215_GORNOSTAY = "5de652c31b7e3716273428be"; + public static string SNIPERRIFLE_762X51_DVL_10 = "588892092459774ac91d4b11"; + public static string SNIPERRIFLE_762X51_M700 = "5bfea6e90db834001b7347f3"; + public static string SNIPERRIFLE_762X51_T_5000M = "5df24cf80dee1b22f862e9bc"; + public static string SNIPERRIFLE_762X54R_MOSIN_INFANTRY = "5bfd297f0db834001a669119"; + public static string SNIPERRIFLE_762X54R_MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1"; + public static string SNIPERRIFLE_762X54R_SV_98 = "55801eed4bdc2d89578b4588"; + public static string SNIPERRIFLE_86X70_AXMC = "627e14b21713922ded6f2c15"; + public static string SNIPERRIFLE_86X70_TRG_M10 = "673cab3e03c6a20581028bc1"; } diff --git a/Libraries/Core/Services/LocaleService.cs b/Libraries/Core/Services/LocaleService.cs index f981482c..7293df72 100644 --- a/Libraries/Core/Services/LocaleService.cs +++ b/Libraries/Core/Services/LocaleService.cs @@ -13,9 +13,6 @@ public class LocaleService( ConfigServer _configServer ) { - protected ISptLogger _logger; - protected DatabaseServer _databaseServer; - protected ConfigServer _configServer; protected LocaleConfig _localeConfig = _configServer.GetConfig(); /** diff --git a/Tools/ItemTplGenerator/ItemOverrides.cs b/Tools/ItemTplGenerator/ItemOverrides.cs new file mode 100644 index 00000000..3d89ce7d --- /dev/null +++ b/Tools/ItemTplGenerator/ItemOverrides.cs @@ -0,0 +1,130 @@ +using System.Collections.ObjectModel; + +namespace ItemTplGenerator; + +public class ItemOverrides +{ + public static readonly ReadOnlyDictionary ItemOverridesDictionary = new( + new Dictionary() + { + // Stashes + { "5963866b86f7747bfa1c4462", "QuestOffline" }, + { "5963866286f7747bf429b572", "QuestRaid" }, + + // Usables + { "614451b71e5874611e2c7ae5", "Bottle of Tarkovskaya vodka (Bad)" }, + + // Special + { "557ffd194bdc2d28148b457f", "Pockets 1x4" }, + { "627a4e6b255f7527fb05a0f6", "Pockets 1x4 Special" }, + { "65e080be269cbd5c5005e529", "Pockets 1x4 TUE" }, + { "64cbd95a29b9b4283e216ff5", "Pockets 2x3" }, + { "665ee77ccf2d642e98220bca", "Secure container Gamma TUE" }, + + // Misc + { "6662e9f37fa79a6d83730fa0", "Dogtag USEC EOD" }, + { "6662ea05f6259762c56f3189", "Dogtag USEC TUE" }, + { "6662e9aca7e0b43baa3d5f74", "Dogtag BEAR EOD" }, + { "6662e9cda7e0b43baa3d5f76", "Dogtag BEAR TUE" }, + + // Quest Items + { "590de92486f77423d9312a33", "Watch Gold" }, + { "5937fc6786f7742cab753590", "Watch Silver" }, + { "5937fd0086f7742bf33fc198", "Watch Bronze" }, + { "638cbb3ba63f1b49be6a300e", "FlashDrive Car Service" }, + { "5eff135be0d3331e9d282b7b", "FlashDrive TerraGroup Employee" }, + { "638e9d5536b3b72c944e2fc7", "FlashDrive Watching You" }, + { "5a29357286f77409c705e025", "Flashdrive Wet Job Pt 4" }, + { "5939e9b286f77462a709572c", "Letter Terragroup" }, + { "591093bb86f7747caa7bb2ee", "Letter Postman Pat" }, + { "61904c9df62c89219a56e034", "Letter Hermit" }, + { "638cbc68a63f1b49be6a3010", "Letter Got Mail" }, + { "619252352be33f26043400a7", "Toughbook Seaside Vacation" }, + { "5a29284f86f77463ef3db363", "Toughbook Cargo" }, + { "64b91627dd13d43b9d01d6d1", "Toughbook Terragroup" }, + { "5a29276886f77435ed1b117c", "HDD Wet Job" }, + { "628393620d8524273e7eb028", "HDD Top Secret" }, + { "638dfc803083a019d447768e", "HDD Surveillance" }, + { "66760b3deb51b08bd40c2b08", "HDD Unused" }, + { "638e0057ab150a5f56238960", "Housing Journal" }, + { "6393262086e646067c176aa2", "Medical Record" }, + { "63989ced706b793c7d60cfef", "Informant Journal" }, + { "6398a072e301557ae24cec92", "Lightkeeper Intel" }, + { "6398a0861c712b1e1d4dadf1", "Lightkeeper Intel (Forged)" }, + { "638e0752ab150a5f56238962", "Lightkeeper Intel 2" }, + { "638e06c4b8bac37a110ed56d", "Lightkeeper Intel 2 (Forged)" }, + { "63927b29c115f907b14700b9", "ChemCont Samples" }, + { "5939e5a786f77461f11c0098", "Secure Folder 0013" }, + { "591092ef86f7747bb8703422", "Secure Folder 0022" }, + { "5938188786f77474f723e87f", "Secure Folder 0031" }, + { "593965cf86f774087a77e1b6", "Secure Folder 0048" }, + { "5938878586f7741b797c562f", "Secure Folder 0052" }, + { "5a6860d886f77411cd3a9e47", "Secure Folder 0060" }, + { "638cbb0f7f97256fac16167a", "Accountant's journal" }, + { "664a5775f3d3570fba06be64", "Arena Poster Bison" }, + { "664b69c5a082271bc46c4e11", "Arena Poster Killa" }, + { "664b69e8e1238e506d3630af", "Arena Poster Easy Money" }, + { "6575a6ca8778e96ded05a802", "Hard Drive TerraGroup Scientist" }, + { "6614217b6d9d5abcad0ff098", "Unheard phone" }, + { "6614230055afee107f05e998", "Unheard phone 2" }, + { "661421c7c1f2f548c50ee649", "Unheard laptop" }, + { "661423200d240a5f5d0f679b", "Unheard laptop 2" }, + { "66a0f0926fee20fa70036da6", "Quest blood sample nf2024" }, + + // Weapon Parts + { "5d1340b3d7ad1a0b52682ed7", "GEN M3 FDE" }, + { "55802d5f4bdc2dac148b458e", "GEN M3 Window" }, + { "5d1340cad7ad1a0b0b249869", "GEN M3 Window FDE" }, + { "5d1340bdd7ad1a0e8d245aab", "GEN M3 FDE" }, + { "5cbdaf89ae9215000e5b9c94", "6L23 Plum" }, + { "5e21a3c67e40bd02257a008a", "GEN M3 Banana" }, + { "6241c2c2117ad530666a5108", "GEN M3 AIRSOFT" }, + { "61840d85568c120fdd2962a5", "MK16 FDE" }, + + // Lootable Containers + { "5914944186f774189e5e76c2", "Jacket 204Key" }, + { "5937ef2b86f77408a47244b3", "Jacket MachineryKey" }, + { "59387ac686f77401442ddd61", "Jacket 114Key" }, + { "61aa1e9a32a4743c3453d2cf", "Duffle bag Adv" }, + { "61aa1ead84ea0800645777fd", "Medbag SMU06 Adv" }, + + // Storage Containers + { "5b6d9ce188a4501afc1b2b25", "THICC Weapon case" }, + { "5c0a840b86f7742ffa4f2482", "THICC Item case" }, + { "5d235bb686f77443f4331278", "SICC" }, + { "61aa1e6984ea0800645777f9", "Long Weapon Box" }, + + // Grenade launchers, they are weird, so just number them + { "5e81ebcd8e146c7080625e15", "FN40GL 01" }, + { "639c3fbbd0446708ee622ee9", "FN40GL 02" }, + { "639af924d0446708ee62294e", "FN40GL 03" }, + + // Airdrop crates + { "66da1b49099cf6adcc07a36b", "Airdrop technical supply crate event 1" }, + { "66da1b546916142b3b022777", "Airdrop technical supply crate event 2" }, + { "61a89e5445a2672acf66c877", "Airdrop technical supply crate event 3" }, + + // Posters + { "6759e7a44ff23436160d7ff5", "Girl poster 4" }, + { "6759e8b1c3102563bd01c985", "Girl poster 5" }, + { "6759e19a8367ee2b0c0f4b92", "Girl poster 1" }, + { "675a046b8f547d6cae01922e", "Arena poster 2" }, + { "6759e61067c8eb5cd10352f1", "Girl poster 2" }, + { "6759e6c39422e1708e0e9b81", "Girl poster 3" }, + + // Keys + { "63a71f1a0aa9fb29da61c537", "City key 26" }, + { "590de52486f774226a0c24c2", "Machinery tech key" }, + { "590de4a286f77423d9312a32", "Folding automobile key" }, + { "63a39e0f64283b5e9c56b282", "City key x" }, + + { "67499d2c69a58fceba104a43", "Lightkeeper btr quest rpg ammo case" }, + { "67499d4deca8acb2d206163b", "BTR quest electronic jamming device" }, + + { "6764207f2fa5e32733055c4a", "Dogtag USEC Prestige 1" }, + { "675dc9d37ae1a8792107ca96", "Dogtag BEAR Prestige 1" }, + { "675dcb0545b1a2d108011b2b", "Dogtag BEAR Prestige 2" }, + { "6764202ae307804338014c1a", "Dogtag USEC Prestige 2" }, + } + ); +} diff --git a/Tools/ItemTplGenerator/ItemTplGenerator.cs b/Tools/ItemTplGenerator/ItemTplGenerator.cs index ddccc091..8d8130a0 100644 --- a/Tools/ItemTplGenerator/ItemTplGenerator.cs +++ b/Tools/ItemTplGenerator/ItemTplGenerator.cs @@ -1,3 +1,4 @@ +using Core.Callbacks; using Core.DI; using Core.Helpers; using Core.Models.Eft.Common.Tables; @@ -23,22 +24,24 @@ public class ItemTplGenerator( { private string enumDir; private Dictionary items; - private Dictionary itemOverrides; - private List collidedEnumKeys = []; + private IDictionary itemOverrides; + private HashSet collidedEnumKeys = []; public async Task Run() { + itemOverrides = ItemOverrides.ItemOverridesDictionary; // Load all of the onload components, this gives us access to most of SPTs injections foreach (var onLoad in _onLoadComponents) { + if (onLoad is HttpCallbacks) + continue; await onLoad.OnLoad(); } // Figure out our source and target directories - var projectDir = Directory.GetParent("./").Parent; - enumDir = Path.Combine(projectDir.FullName, "Core", "Models", "Enums"); + var projectDir = Directory.GetParent("./").Parent.Parent.Parent.Parent.Parent; + enumDir = Path.Combine(projectDir.FullName, "Libraries", "Core", "Models", "Enums"); items = _databaseServer.GetTables().Templates.Items; - itemOverrides = new Dictionary(); // Generate an object containing all item name to ID associations var orderedItemsObject = GenerateItemsObject(); @@ -79,9 +82,11 @@ public class ItemTplGenerator( var itemPrefix = GetItemPrefix(item); var itemName = GetItemName(item); var itemSuffix = GetItemSuffix(item); - + // Handle the case where the item starts with the parent category name. Avoids things like 'POCKETS_POCKETS' - if (itemParentName == itemName.Substring(1, itemParentName.Length + 1) && itemPrefix == "") + if (itemName.Length > itemParentName.Length && + itemParentName == itemName.Substring(1, itemParentName.Length) && + itemPrefix == "") { itemName = itemName.Substring(itemParentName.Length + 1); if (itemName.Length > 0 && itemName[0] != '_') @@ -91,7 +96,8 @@ public class ItemTplGenerator( } // Handle the case where the item ends with the parent category name. Avoids things like 'KEY_DORM_ROOM_103_KEY' - if (itemParentName == itemName.Substring(itemName.Length - itemParentName.Length)) + if (itemName.Length >= itemParentName.Length && + itemParentName == itemName.Substring(itemName.Length - itemParentName.Length)) { itemName = itemName.Substring(0, itemName.Length - itemParentName.Length); @@ -113,14 +119,14 @@ public class ItemTplGenerator( collidedEnumKeys.Add(itemKey); var itemNameSuffix = GetItemNameSuffix(item); - if (itemNameSuffix != null) + if (!string.IsNullOrEmpty(itemNameSuffix)) { // Try to update the old key reference if we haven't already if (itemsObject.ContainsKey(itemKey)) { var oldItemId = itemsObject[itemKey]; var oldItemNameSuffix = GetItemNameSuffix(items[oldItemId]); - if (oldItemNameSuffix != null) + if (!string.IsNullOrEmpty(oldItemNameSuffix)) { var oldItemNewKey = SanitizeEnumKey($"{itemKey}_{oldItemNameSuffix}"); itemsObject.Remove(itemKey); @@ -140,9 +146,10 @@ public class ItemTplGenerator( } else { - _logger.Error( - $"New itemOverride entry required: itemsObject already contains {itemKey} {itemsObject[itemKey]} => {item.Id}" - ); + var val = itemsObject.ContainsKey(itemKey) ? + itemsObject[itemKey] : + itemKey; + _logger.Error($"New itemOverride entry required: itemsObject already contains {itemKey} {val} => {item.Id}"); continue; } } @@ -154,14 +161,6 @@ public class ItemTplGenerator( var itemList = itemsObject.ToList(); itemList.Sort((kv1, kv2) => kv1.Key.CompareTo(kv2.Key)); var orderedItemsObject = itemList.ToDictionary(kv => kv.Key, kv => kv.Value); - /* I think the above should be the same? - var orderedItemsObject = Object.keys(itemsObject) - .sort() - .reduce((obj, key) => { - obj[key] = itemsObject[key]; - return obj; - }, {}); - */ return orderedItemsObject; } @@ -181,7 +180,6 @@ public class ItemTplGenerator( } var caliber = CleanCaliber(kv.Value.Properties.AmmoCaliber.ToUpper()); - var localeDb = _localeService.GetLocaleDb(); var weaponShortName = _localeService.GetLocaleDb()[$"{kv.Key} ShortName"]?.ToUpper(); // Special case for the weird duplicated grenade launcher @@ -193,9 +191,9 @@ public class ItemTplGenerator( // Include any bracketed suffixes that exist, handles the case of colored gun variants var weaponFullName = _localeService.GetLocaleDb()[$"{kv.Key} Name"]?.ToUpper(); if (weaponFullName.RegexMatch("\\((.+?)\\)$", out var itemNameBracketSuffix) && - !weaponShortName.EndsWith(itemNameBracketSuffix.Captures[1].Value)) + !weaponShortName.EndsWith(itemNameBracketSuffix.Groups[1].Value)) { - weaponShortName += $"_{itemNameBracketSuffix.Captures[1].Value}"; + weaponShortName += $"_{itemNameBracketSuffix.Groups[1].Value}"; } var parentName = GetParentName(kv.Value); @@ -219,14 +217,6 @@ public class ItemTplGenerator( var itemList = weaponsObject.ToList(); itemList.Sort((kv1, kv2) => kv1.Key.CompareTo(kv2.Key)); var orderedWeaponsObject = itemList.ToDictionary(kv => kv.Key, kv => kv.Value); - /* I think the above should be the same? - var orderedWeaponsObject = Object.keys(weaponsObject.Keys) - .sort() - .reduce((obj, key) => { - obj[key] = weaponsObject[key]; - return obj; - }, {}); - */ return orderedWeaponsObject; } @@ -444,7 +434,7 @@ public class ItemTplGenerator( [ BaseClasses.RANDOM_LOOT_CONTAINER, BaseClasses.BUILT_IN_INSERTS, - BaseClasses.STASH, + BaseClasses.STASH ] ) ) @@ -455,28 +445,28 @@ public class ItemTplGenerator( else if (_itemHelper.IsOfBaseclasses(item.Id, [BaseClasses.AMMO, BaseClasses.AMMO_BOX, BaseClasses.MAGAZINE])) { if (localeDb.TryGetValue($"{item.Id} ShortName", out itemName)) - itemName.ToUpper(); + itemName = itemName.ToUpper(); } // For everything else, use the full name else { if (localeDb.TryGetValue($"{item.Id} Name", out itemName)) - itemName.ToUpper(); + itemName = itemName.ToUpper(); } // Fall back in the event we couldn't find a name - if (itemName == null) + if (string.IsNullOrEmpty(itemName)) { - if (localeDb.TryGetValue("{item.Id} Name", out itemName)) - itemName.ToUpper(); + if (localeDb.TryGetValue($"{item.Id} Name", out itemName)) + itemName = itemName.ToUpper(); } - if (itemName == null) + if (string.IsNullOrEmpty(itemName)) { itemName = item.Name?.ToUpper() ?? null; } - if (itemName == null) + if (string.IsNullOrEmpty(itemName)) { Console.WriteLine($"Unable to get shortname for {item.Id}"); return ""; @@ -496,7 +486,7 @@ public class ItemTplGenerator( // Add grid size for lootable containers if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.LOOT_CONTAINER)) { - return $"{item.Properties.Grids[0]?.Props.CellsH}X${item.Properties.Grids[0]?.Props.CellsV}"; + return $"{item.Properties.Grids[0]?.Props.CellsH}X{item.Properties.Grids[0]?.Props.CellsV}"; } // Add ammo caliber to conflicting weapons @@ -507,14 +497,14 @@ public class ItemTplGenerator( // If the item has a bracketed section at the end of its name, include that if (itemName?.RegexMatch("\\((.+?)\\)$", out var itemNameBracketSuffix) ?? false) { - return $"{caliber}_{itemNameBracketSuffix.Captures[1].Value}"; + return $"{caliber}_{itemNameBracketSuffix.Groups[1].Value}"; } return caliber; } // Make sure we have a full name - if (itemName == null) + if (string.IsNullOrEmpty(itemName)) { return ""; } @@ -522,13 +512,13 @@ public class ItemTplGenerator( // If the item has a bracketed section at the end of its name, use that if (itemName.RegexMatch("\\((.+?)\\)$", out var itemNameBracker)) { - return itemNameBracker.Captures[1].Value; + return itemNameBracker.Groups[1].Value; } // If the item has a number at the end of its name, use that if (itemName.RegexMatch("#([0-9]+)$", out var itemNameNumberSuffix)) { - return itemNameNumberSuffix.Captures[1].Value; + return itemNameNumberSuffix.Groups[1].Value; } return ""; @@ -572,6 +562,7 @@ public class ItemTplGenerator( enumFileData += "}\n"; } + // TODO: enable once we dont get any more errors // this.fileSystemSync.write(outputPath, enumFileData); } } diff --git a/Tools/ItemTplGenerator/Properties/launchSettings.json b/Tools/ItemTplGenerator/Properties/launchSettings.json index 0d4dbd13..678a4885 100644 --- a/Tools/ItemTplGenerator/Properties/launchSettings.json +++ b/Tools/ItemTplGenerator/Properties/launchSettings.json @@ -3,7 +3,7 @@ "profiles": { "ItemTplGenerator": { "commandName": "Project", - "hotReloadEnabled": true + "hotReloadEnabled": false } } }