Mod.cs 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. using SPTarkov.DI.Annotations;
  7. using SPTarkov.Server.Core.DI;
  8. using SPTarkov.Server.Core.Models.Common;
  9. using SPTarkov.Server.Core.Models.Eft.Common.Tables;
  10. using SPTarkov.Server.Core.Models.Spt.Tables;
  11. using SPTarkov.Common.Models.Logging;
  12. namespace Pj568.WeaponCrossModding;
  13. /// <summary>
  14. /// 服务端 mod:
  15. /// 1. 让 UZI StormWerkz 瞄具基座的 mod_scope 槽支持安装 ELCAN SpecterDR 1x/4x 及其 FDE 变体,
  16. /// 以及 SIG Sauer BRAVO4 4x30 瞄准镜;
  17. /// 2. 让 StormWerkz 顶盖导轨可安装到 CR 200DS 转轮手枪的前准星槽;
  18. /// 3. 让 CR 200DS 的前准星槽支持安装 MP-18 瞄具基座;
  19. /// 4. 让 PPSh-41 冲锋枪的枪管槽支持安装莫辛纳甘的全部 4 种尺寸枪管;
  20. /// 5. 让 PPSh-41 冲锋枪的枪托槽支持安装 Benelli M3 可伸缩枪托、PKM / PKP 枪托、Ultima MP-155 塑料手枪式握把与 KS-23 金属枪托;
  21. /// 6. 让 HUXWRX HX-QD 消音器(含黄褐色变体)与 PPSh-41 防尘盖互不兼容;
  22. /// 7. 让 Aim Sports“三轨”莫辛步枪导轨的第一个战术配件槽(mod_tactical_000)支持安装多种前握把(不含 KeyMod / M-LOK 型);
  23. /// 8. 让 UZI StormWerkz 护木底轨的 mod_tactical 槽支持安装 Zenit RK 系列前握把;
  24. /// 9. 让 PPSh-41 冲锋枪的枪托槽支持安装 M14 SAGE International M14ALCS (MOD-0) 枪托;
  25. /// 10. 让 Aim Sports“三轨”的瞄具槽支持安装 M14 DCSB 瞄具基座;
  26. /// 11. 让 Aim Sports“三轨”的第一个战术配件槽支持安装 SV-98 隔热带与 Fortis Shift 战术前握把;
  27. /// 12. 让 Aim Sports“三轨”的第二个战术配件槽支持安装 SV-98 隔热带;
  28. /// 13. 让 M14 SAGE International M14ALCS (MOD-0) 枪托的握把位支持安装 AR-15 Tactical Dynamics 镂空手枪式握把、
  29. /// Tyrant Designs MOD Chevron AR-15 镂空手枪式握把(黑 / 黄 / 红)与 AS VAL Rotor 43 手枪式握把附缓冲管转接器;
  30. /// 14. 让 CR 50DS 转轮手枪的前准星槽支持安装 StormWerkz 顶盖导轨与 MP-18 瞄具基座;
  31. /// 15. 让 CR 50DS 转轮手枪的战术设备槽支持安装 Zenit RK 系列前握把、KAC MWS 脚架转接器
  32. /// 与 BT10 V8 Atlas 折叠脚架;
  33. /// 16. 让 730mm 标准莫辛枪管的前准星槽支持安装 MDR BLK LBL ALX 脚架(16 与 20 型号);
  34. /// 17. 让 AA-12 457mm 枪管的导轨槽(mod_mount)支持安装 M60 脚架;
  35. /// 18. 让 MP-18 与 Marlin MXLR 的枪托槽(mod_stock)支持安装 KS-23 金属枪托;
  36. /// 19. 让 RPD 520mm 枪管的枪口槽(mod_muzzle)支持安装 AKM PBS-1 消音器;
  37. /// 20. 让 PPSh-41 冲锋枪的枪管槽支持安装 M700 的全部 4 种枪管、ORSIS T-5000M 枪管
  38. /// 与 SKS / OP-SKS 的 520mm 枪管;
  39. /// 21. 让 PPSh-41 冲锋枪的枪托槽支持安装 Zveno PK 缓冲管转接器;
  40. /// 22. 让 PPSh-41 冲锋枪的机匣槽支持安装 TAPCO Intrafuse 与 Fab Defence UAS SKS 枪身套件;
  41. /// 23. 让两个 SKS 枪身套件与除 KS-23 金属枪托之外的全部 PPSh-41 枪托(含原装木制枪托与 Zveno 缓冲管转接器)互不兼容;
  42. /// 24. 让两个 SKS 枪身套件与 PPSh-41 的 71 发弹鼓互不兼容;
  43. /// 25. 让 KS-23 金属枪托与两个 SKS 枪身套件枪托槽可装的配件互不兼容;
  44. /// 26. 让 SKS 与 OP-SKS 照门固定环的照门槽(mod_sight_rear)支持安装 TKPD 导轨防尘盖;
  45. /// 27. 让 TKPD 导轨防尘盖与 SKS / OP-SKS 枪本体互不兼容;
  46. /// 28. 让 PPSh-41 冲锋枪的枪管槽支持安装 SVT-40 / AVT-40 共用的 7.62x54R 625mm 枪管;
  47. /// 29. 让 SVT-40 625mm 枪管的照门槽(mod_sight_rear)支持安装 TKPD 导轨防尘盖;
  48. /// 30. 让 TKPD 导轨防尘盖与 SVT-40 / AVT-40 枪本体双向互不兼容;
  49. /// 31. 让 SVT-40 标准枪口装置的准星槽(mod_sight_front)支持安装 MDR BLK LBL ALX 脚架(16 与 20 型号);
  50. /// 32. 让 PPSh-41 冲锋枪的枪管槽支持安装 SVDS 照门固定环;
  51. /// 33. 将莫辛 200mm、M700 全部 4 种、ORSIS T-5000M 枪管自 PPSh-41 枪管槽移至 SVDS 照门固定环的护木槽(mod_handguard),
  52. /// 并让这些枪管与 SVDS 枪本体双向互不兼容;
  53. /// 34. 让 SVDS 照门固定环的照门槽(mod_sight_rear)支持安装 TKPD 导轨防尘盖,且该防尘盖与 SVDS 枪本体双向互不兼容;
  54. /// 35. 让 SVDS 照门固定环的护木槽(mod_handguard)支持安装 SVDS 枪管,且 SVDS 枪管与自身互斥;
  55. /// 36. 让 SVDS 照门固定环与 PPSh-41 防尘盖双向互不兼容;
  56. /// 37. 让 SVDS 照门固定环与 TAPCO Intrafuse SKS 枪身套件双向互不兼容;
  57. /// 38. 让 SVDS 照门固定环护木槽可装的 3 种原版 SVDS 护木与 PPSh-41 枪本体双向互不兼容;
  58. /// 39. 让 Fab Defence UAS SKS 枪身套件的下导轨(mod_tactical_002)支持安装 MDR BLK LBL ALX 20 脚架;
  59. /// 40. 让 SVDS 照门固定环的护木槽支持安装 SVT-40 625mm 枪管,且该枪管与 SVDS 枪本体双向互不兼容;
  60. /// 41. 让 TKPD 导轨防尘盖与自身互斥,防止重复安装;
  61. /// 42. 让 SVT-40 625mm 枪管的照门槽支持安装 5 种 SKS 导气管防尘盖;
  62. /// 43. 让 MDR BLK LBL ALX 20 脚架与自身互斥,防止重复安装;
  63. /// 44. 让 SVDS 照门固定环的护木槽支持安装照门固定环自身;
  64. /// 45. 让 SVDS 照门固定环的照门槽支持安装 OP-SKS 标准 / SKS 木制标准 / ATI Monte Carlo 3 种 SKS 导气管防尘盖与 UltiMAK M1-B AK 导气管套件;
  65. /// 46. 让 5 种 SKS 导气管防尘盖与 UltiMAK M1-B AK 导气管套件彼此之间(含与自身)互不兼容,使一把武器上最多只能装一个;
  66. /// 47. 让 UltiMAK M1-B AK 导气管套件的战术配件槽(mod_tactical_000)支持安装 MDR BLK LBL ALX 20 脚架。
  67. /// 48. 让 20x1mm 玩具枪的膛室在保留 20x1mm 能力的同时支持全部 7 种 7.62x25 托卡列夫弹药
  68. /// (只补膛室白名单,不动武器单值 ammoCaliber;其原装弹匣不直接支持,改由 MXLR 弹仓链路供弹)。
  69. /// 49. 让 Marlin MXLR .308 ME 杠杆步枪的 5 发管状弹仓支持全部 7 种 7.62x25 托卡列夫弹药。
  70. /// 50. 让 20x1mm 玩具枪的 mod_magazine 槽支持安装 Marlin MXLR 的 5 发管状弹仓。
  71. /// 51. 让 Alpha Dog Alpha 9 9x19 声音抑制器的 mod_scope 槽支持安装 M14 SAGE International DCSB 瞄具基座。
  72. /// 52. 让 EMTI-019 基座的 mod_scope 槽支持安装 DCSB 瞄具基座。
  73. /// 53. 让 MTs-255-12 12 号左轮霰弹枪的护木槽(mod_handguard)支持安装 MP-18 的全部护木(木制 / 塑料),
  74. /// 枪托槽(mod_stock)支持安装雷明顿 Model 870 的 Magpul SGA、Remington SPS 与 Shockwave Raptor 枪托
  75. /// (不含 Mesa Tactical LEO 转接器与 Fab Defence AGR 握把)。
  76. ///
  77. /// 做法:往目标槽的 SlotFilter.Filter(HashSet&lt;MongoId&gt;)追加物品 id(幂等)。
  78. /// </summary>
  79. [Injectable(InjectionType.Singleton, OnLoadOrder.Preload + 4)]
  80. public class WeaponCrossModdingPlugin(
  81. ISptLogger<WeaponCrossModdingPlugin> logger,
  82. TemplateTable templateTable) : IOnLoad
  83. {
  84. private const string ScopeSlotName = "mod_scope";
  85. private const string SightSlotName = "mod_sight_front";
  86. private const string SightRearSlotName = "mod_sight_rear";
  87. private const string BarrelSlotName = "mod_barrel";
  88. private const string StockSlotName = "mod_stock";
  89. private const string TacticalSlotName = "mod_tactical";
  90. private const string MountSlotName = "mod_mount";
  91. private const string MuzzleSlotName = "mod_muzzle";
  92. private const string RecieverSlotName = "mod_reciever"; // 游戏数据拼写即 reciever
  93. private const string HandguardSlotName = "mod_handguard";
  94. // UZI StormWerkz 瞄具基座(顶盖导轨)
  95. private const string StormwerkzTopCoverRailId = "6698c90829e062525d0ad8ad";
  96. // ELCAN SpecterDR 1x/4x(黑)与 FDE 变体
  97. private const string SpecterDrId = "57ac965c24597706be5f975c";
  98. private const string SpecterDrFdeId = "57aca93d2459771f2c7e26db";
  99. // SIG Sauer BRAVO4 4x30 瞄准镜
  100. private const string Bravo4Id = "57adff4f24597737f373b6e6";
  101. // CR 200DS 转轮手枪(Chiappa Rhino 200DS 9x19 revolver)—— 前准星槽。
  102. private const string Cr200DsId = "624c2e8614da335f1e034d8c";
  103. // CR 50DS 转轮手枪(Chiappa Rhino 50DS .357 revolver)—— 前准星槽与战术设备槽。
  104. private const string Cr50DsId = "61a4c8884f95bc3b2c5dc96f";
  105. // MP-18 瞄具基座
  106. private const string Mp18ScopeBaseId = "61f804acfcba9556ea304cb8";
  107. // KAC MWS 脚架转接器(自带 mod_bipod 槽)与 BT10 V8 Atlas 折叠脚架。
  108. private const string KacMwsBipodAdapterId = "676175bb48fa5c377e06fc36";
  109. private const string Bt10AtlasBipodId = "6644920d49817dc7d505ca71";
  110. // PPSh-41 冲锋枪(承载枪管槽与枪托槽)。
  111. private const string Ppsh41Id = "5ea03f7400685063ec28bfa8";
  112. // 莫辛纳甘枪管(4 种尺寸)
  113. private const string MosinBarrel200Id = "5bfd4cc90db834001d23e846"; // 200mm 锯短
  114. private const string MosinBarrel220ThreadedId = "5bfd4cd60db834001c38f095"; // 220mm 锯短螺纹
  115. private const string MosinBarrel514Id = "5bfd4cbe0db834001b73449f"; // 514mm 卡宾
  116. private const string MosinBarrel730Id = "5ae09bff5acfc4001562219d"; // 730mm 标准
  117. // MDR BLK LBL ALX 脚架(16 / 20 型号,由 WTT-ContentBackport 注入;安装于 730mm 标准莫辛枪管的前准星槽)。
  118. private const string AlxBipod16Id = "680f6d9a4d7624d36e06527b";
  119. private const string AlxBipod20Id = "680f7e4aeee716732708e84e";
  120. private const string AlxBipod20Label = "MDR BLK LBL ALX 20 bipod";
  121. // PPSh-41 枪托槽兼容的枪托 / 握把。
  122. private const string BenelliM3TelescopicStockId = "6259c3387d6aab70bc23a18d"; // Benelli M3 可伸缩枪托
  123. private const string PkmWoodenStockId = "646371a9f2404ab67905c8e6"; // PKM 木制枪托
  124. private const string PkZenitPt2StockId = "6492d7847363b8a52206bc52"; // Zenit PT-2 "Klassika" PK 机枪枪托
  125. private const string PkpPolymerStockId = "6492e3a97df7d749100e29ee"; // PKP 聚合物枪托
  126. private const string UltimaMp155PistolGripId = "606eef46232e5a31c233d500"; // Ultima MP-155 塑料手枪式握把
  127. private const string Ks23MetalStockId = "5e848dc4e4dbc5266a4ec63d"; // KS-23 金属枪托(原版仅可装于 KS-23M 聚合物手枪式握把的 mod_stock 槽)
  128. // M14 SAGE International M14ALCS (MOD-0) 枪托。
  129. private const string M14AlcsButtstockId = "5addc7ac5acfc400194dbd90";
  130. // M14 SAGE International DCSB 瞄具基座。
  131. private const string M14DcsbMountId = "5addbffe5acfc4001714dfac";
  132. // Alpha Dog Alpha 9 9x19 声音抑制器(其 mod_scope 槽承载 M14 DCSB 瞄具基座)。
  133. private const string AlphaDogSuppressorId = "5a33a8ebc4a282000c5a950d";
  134. private const string AlphaDogSuppressorLabel = "Alpha Dog 9x19 suppressor";
  135. // PPSh-41 防尘盖(mod_reciever 槽承载物品)。
  136. private const string Ppsh41DustCoverId = "5ea03e5009aa976f2e7a514b";
  137. // HUXWRX HX-QD 7.62x51 消音器(黑 / 黄褐色变体)—— 由 WTT-ContentBackport 注入。
  138. private const string HuxwrxHxQdId = "6a158e4abf497aade10030e0";
  139. private const string HuxwrxHxQdTanId = "6a1eb32c6cd328ea90037455";
  140. // Aim Sports“三轨”莫辛步枪导轨;改第一个与第二个战术配件槽(mod_tactical_000 / mod_tactical_001)。
  141. private const string AimSportsTriRailId = "5bbdb811d4351e45020113c7";
  142. private const string AimSportsTriRailTacticalSlotName = "mod_tactical_000";
  143. private const string AimSportsTriRailSecondTacticalSlotName = "mod_tactical_001";
  144. private const string AimSportsTriRailLabel = "Aim Sports tri-rail";
  145. // Fab Defence UAS SKS 枪身套件的下导轨(原本兼容脚架的第三个战术槽)。
  146. private const string FabDefenceUasLowerRailSlotName = "mod_tactical_002";
  147. // UltiMAK M1-B AK 导气管套件的第一个战术配件槽。
  148. private const string UltimakM1BTacticalSlotName = "mod_tactical_000";
  149. // UZI StormWerkz 护木底轨(mod_tactical 槽)。
  150. private const string StormwerkzLowerHandguardRailId = "66992f7d9950f5f4cd0602a8";
  151. private const string StormwerkzLowerHandguardLabel = "UZI StormWerkz lower handguard rail";
  152. // Zenit RK 系列前握把。
  153. private static readonly string[] ZenitRkForegripIds =
  154. [
  155. "5c1bc4812e22164bef5cfde7", // RK-0
  156. "5c1bc5612e221602b5429350", // RK-1
  157. "5c1bc5af2e221602b412949b", // RK-2
  158. "5c1bc5fb2e221602b1779b32", // RK-4
  159. "5c1bc7432e221602b412949d", // RK-5
  160. "5c1bc7752e221602b1779b34", // RK-6
  161. ];
  162. // Aim Sports“三轨”第一个战术配件槽兼容的前握把(RK 系列见上;不含 KeyMod / M-LOK 型)。
  163. private static readonly string[] AimSportsTriRailForegripIds =
  164. [
  165. .. ZenitRkForegripIds,
  166. // 镂空前握把
  167. "5f6340d3ca442212f4047eb2", // Tactical Dynamics 镂空前握把
  168. // 垂直前握把
  169. "5c7fc87d2e221644f31c0298", // BCM GUNFIGHTER MOD 3 vertical
  170. "5c87ca002e221600114cb150", // KAC vertical
  171. "5cda9bcfd7f00c0c0b53e900", // ASh-12 vertical
  172. // TangoDown Stubby BGV-MK46K
  173. "558032614bdc2de7118b4585", // (Black)
  174. "58c157be86f77403c74b2bb6", // (FDE)
  175. "58c157c886f774032749fb06", // (Stealth Grey)
  176. ];
  177. // Aim Sports“三轨”第一 / 第二个战术配件槽兼容的其它配件。
  178. private const string Sv98HeatRibbonId = "56083eab4bdc2d26448b456a"; // SV-98 隔热带(anti-heat ribbon)
  179. private const string FortisShiftForegripId = "59f8a37386f7747af3328f06"; // Fortis Shift 战术前握把
  180. // AK-100 系列聚合物护木(handguard_ak_izhmash_ak100_rail_plastic)的 mod_foregrip 槽兼容的全部前握把。
  181. private static readonly string[] Ak100PolymerHandguardForegripIds =
  182. [
  183. // 垂直前握把
  184. "5c7fc87d2e221644f31c0298", // BCM GUNFIGHTER MOD 3 vertical
  185. "5cda9bcfd7f00c0c0b53e900", // ASh-12 vertical
  186. "5c87ca002e221600114cb150", // KAC vertical
  187. // Zenit RK 系列
  188. "5c1bc4812e22164bef5cfde7", // RK-0
  189. "5c1bc5612e221602b5429350", // RK-1
  190. "5c1bc5af2e221602b412949b", // RK-2
  191. "5c1bc5fb2e221602b1779b32", // RK-4
  192. "5c1bc7432e221602b412949d", // RK-5
  193. "5c1bc7752e221602b1779b34", // RK-6
  194. // 镂空前握把
  195. "5f6340d3ca442212f4047eb2", // Tactical Dynamics 镂空前握把
  196. // TangoDown Stubby BGV-MK46K
  197. "558032614bdc2de7118b4585", // (Black)
  198. "58c157be86f77403c74b2bb6", // (FDE)
  199. "58c157c886f774032749fb06", // (Stealth Grey)
  200. // 其它前握把
  201. "59f8a37386f7747af3328f06", // Fortis Shift 战术前握把
  202. "619386379fb0c665d5490dbe",
  203. "59fc48e086f77463b1118392",
  204. "5fce0cf655375d18a253eff0",
  205. "5cf4fb76d7f00c065703d3ac",
  206. "5b057b4f5acfc4771e1bd3e9",
  207. "5c791e872e2216001219c40a",
  208. "591af28e86f77414a27a9e1d",
  209. "5c1cd46f2e22164bef5cfedb",
  210. // 较新增前握把(可能来自更新或模组)
  211. "64806bdd26c80811d408d37a",
  212. "64807a29e5ffe165600abc97",
  213. "648067db042be0705c0b3009",
  214. "65169d5b30425317755f8e25",
  215. "655df24fdf80b12750626d0a",
  216. "655dccfdbdcc6b5df71382b6",
  217. "661e52e29c8b4dadef008577",
  218. "661e53149c8b4dadef008579",
  219. "661e52415be02310ed07a07a",
  220. "661e52b5b099f32c28003586",
  221. ];
  222. // M14 SAGE International M14ALCS (MOD-0) 枪托的握把位兼容的握把。
  223. private const string M14AlcsPistolGripSlotName = "mod_pistol_grip";
  224. private const string TacticalDynamicsSkeletonizedGripId = "5b07db875acfc40dc528a5f6"; // AR-15 Tactical Dynamics 镂空手枪式握把
  225. // Tyrant Designs MOD Chevron AR-15 镂空手枪式握把(黑 / 黄 / 红变体)—— 由 WTT-ContentBackport 注入。
  226. private const string TyrantChevronGripBlackId = "6984b7d56be2752c150e6895";
  227. private const string TyrantChevronGripYellowId = "698dac21772d6f3dc00e4284";
  228. private const string TyrantChevronGripRedId = "6985eb089edef67ade080b72";
  229. // AS VAL Rotor 43 手枪式握把附缓冲管转接器(自带 AR 规格缓冲管与 mod_stock_000 槽)。
  230. private const string AsValRotor43GripId = "5a69a2ed8dc32e000d46d1f1";
  231. // AA-12 457mm 枪管(mod_mount 导轨槽宿主)。
  232. private const string Aa12Barrel457Id = "670fced86a7e274b1a0964e8";
  233. // MTs-255-12 12 号左轮霰弹枪(weapon_ckib_mc_255_12g)—— 护木槽与枪托槽宿主。
  234. private const string Mts255Id = "60db29ce99594040e04c4a27";
  235. // MP-18 7.62x54R 单发步枪及其全部护木(木制 / 塑料)。
  236. private const string Mp18RifleId = "61f7c9e189e6fb1a5e3ea78d";
  237. private const string Mp18HandguardWoodId = "61f7b85367ddd414173fdb36";
  238. private const string Mp18HandguardPlasticId = "61f8024263dc1250e26eb029";
  239. // 雷明顿 Model 870 12 号霰弹枪(5a7828548dc32e5a9c28b516)mod_stock 枪托槽支持的枪托
  240. //(已去掉 Mesa Tactical LEO 转接器与 Fab Defence AGR 握把)。
  241. private static readonly string[] M870StockIds =
  242. [
  243. "5a78813bc5856700186c4abe", // Magpul SGA
  244. "5a7880d0c5856700142fdd9d", // Remington SPS
  245. "5a788169c5856700142fdd9e", // Shockwave Technologies Raptor grip
  246. ];
  247. // Marlin MXLR .308 ME 杠杆步枪(由 WTT-ContentBackport 注入)。
  248. private const string MarlinMxlrId = "67c6de3ce39861860909e8e5";
  249. // M60 脚架。
  250. private const string M60BipodId = "66012d9a3dff5074ed002e33";
  251. // RPD 520mm 枪管(mod_muzzle 枪口槽宿主)与 AKM PBS-1 消音器。
  252. private const string RpdBarrel520Id = "6513eff1e06849f06c0957d4";
  253. private const string AkmPbs1Id = "5a0d63621526d8dba31fe3bf";
  254. // M700 枪管(4 种)与 ORSIS T-5000M 枪管(可安装于 PPSh-41 枪管槽)。
  255. private const string M700Barrel660Id = "5bfebc250db834001a6694e1"; // 26 英寸
  256. private const string M700Barrel508ThreadedId = "5bfebc320db8340019668d79"; // 20 英寸螺纹
  257. private const string M700BarrelStainless660Id = "5d2702e88abbc31ed91efc44"; // 26 英寸不锈钢
  258. private const string M700BarrelStainless508ThreadedId = "5d2703038abbc3105103d94c"; // 20 英寸不锈钢螺纹
  259. private const string T5000Barrel660Id = "5df256570dee1b22f862e9c4"; // ORSIS T-5000M 660mm
  260. // SKS 与 OP-SKS 的 520mm 枪管(可安装于 PPSh-41 枪管槽)。
  261. private const string SksBarrel520Id = "634f02331f9f536910079b51"; // SKS(TOZ)
  262. private const string OpsksBarrel520Id = "634eff66517ccc8a960fc735"; // OP-SKS(Molot)
  263. // SKS 枪身套件(可安装于 PPSh-41 机匣槽):TAPCO Intrafuse 与 Fab Defence UAS。
  264. private const string TapcoIntrafuseSksId = "5afd7ded5acfc40017541f5e";
  265. private const string FabDefenceUasSksId = "5d0236dad7ad1a0940739d29";
  266. // UltiMAK M1-B AK 导气管套件(其 mod_tactical_000 战术配件槽承载 MDR BLK LBL ALX 20 脚架)。
  267. private const string UltimakM1BId = "59ccfdba86f7747f2109a587";
  268. // 上述两个套件的枪托槽分别只接受的配件(用于与 KS-23 金属枪托建立互斥)。
  269. private const string TapcoIntrafuseBufferTubeId = "5afd7e095acfc40017541f61";
  270. private const string FabDefenceUasFoldingStockId = "653ed132896b99b40a0292e6";
  271. // PPSh-41 原装木制枪托(用于与 SKS 枪身套件建立互斥)。
  272. private const string Ppsh41StockWoodId = "5ea03e9400685063ec28bfa4";
  273. // Zveno PK 缓冲管转接器(由 WTT-ContentBackport 注入;可安装于 PPSh-41 枪托槽)。
  274. private const string ZvenoBufferTubeId = "6a182c39b913af92800d8b5d";
  275. // PPSh-41 7.62x25 71 发弹鼓。
  276. private const string Ppsh71DrumMagId = "5ea034f65aad6446a939737e";
  277. // 20x1mm 玩具枪(weapon_ussr_pd_20x1mm):其膛室兼容 7.62x25,弹匣槽用于搭载 MXLR 弹仓。
  278. private const string ToyGunId = "66015072e9f84d5680039678";
  279. private const string ToyGunLabel = "20x1mm toy gun";
  280. // Marlin MXLR .308 ME 杠杆步枪的 5 发管状弹仓(由 WTT-ContentBackport 注入)。
  281. // 让 MXLR 弹仓兼容 7.62x25;玩具枪弹匣槽兼容 MXLR 弹仓。
  282. private const string MxlrMagId = "67c5424826265106dd0697a4";
  283. private const string MxlrMagLabel = "Marlin MXLR 5-round magazine";
  284. // 弹匣槽名(玩具枪等宿主共用)。
  285. private const string MagazineSlotName = "mod_magazine";
  286. // 7.62x25 托卡列夫弹药(Caliber762x25TT)全部 7 种。
  287. private static readonly (string Id, string Label)[] Caliber762x25Ammo =
  288. [
  289. ("5735fdcd2459776445391d61", "AKBS"),
  290. ("5735ff5c245977640e39ba7e", "FMJ43"),
  291. ("573601b42459776410737435", "LRN"),
  292. ("573602322459776445391df1", "LRNPC"),
  293. ("5736026a245977644601dc61", "P Gl"),
  294. ("573603562459776430731618", "Pst gzh"),
  295. ("573603c924597764442bd9cb", "T Gzh"),
  296. ];
  297. // EMTI-019 基座(游戏本体自带,非 Mod 物品):其瞄具槽支持 DCSB 瞄具基座。
  298. private const string EmtiId = "5dfe14f30b92095fd441edaf";
  299. private const string EmtiLabel = "EMTI-019 mount";
  300. // SKS / OP-SKS 照门固定环(mod_sight_rear 照门槽宿主)与 TKPD 导轨防尘盖(由 WTT 注入)。
  301. private const string SksRearSightBlockId = "634f04d82e5def262d0b30c6";
  302. private const string OpsksRearSightBlockId = "634f05a21f9f536910079b56";
  303. private const string TkpdRailedDustCoverId = "68aee8f8130c00663d08aeb3";
  304. // SKS 与 OP-SKS 枪本体(用于与 TKPD 导轨防尘盖建立互斥)。
  305. private const string SksWeaponId = "574d967124597745970e7c94";
  306. private const string OpsksWeaponId = "587e02ff24597743df3deaeb";
  307. // SVT-40 7.62x54R 625mm 枪管(可安装于 PPSh-41 枪管槽;其 mod_sight_rear 照门槽承载 TKPD 导轨防尘盖)。
  308. private const string Svt40Barrel625Id = "6410758c857473525b08bb77";
  309. // SVT-40 与 AVT-40 枪本体(用于与 TKPD 导轨防尘盖建立互斥)。
  310. private const string Svt40WeaponId = "643ea5b23db6f9f57107d9fd";
  311. private const string Avt40WeaponId = "6410733d5dd49d77bd07847e";
  312. // SVT-40 标准枪口装置(其 mod_sight_front 准星槽承载 MDR BLK LBL ALX 脚架;SVT-40 与 AVT-40 共用)。
  313. private const string Svt40MuzzleStdId = "64119d1f2c6d6f921a0929f8";
  314. // SVDS 照门固定环(mount_svd_izhmash_svd_s_lower_band_std,含 mod_handguard 护木槽与 mod_sight_rear 照门槽)。
  315. private const string SvdsRearSightBlockId = "5c471c2d2e22164bef5d077f";
  316. // SVDS 枪本体与 SVDS 枪管(枪管用于与自身建立互斥以防重复安装)。
  317. private const string SvdsWeaponId = "5c46fbd72e2216398b5a8c9c";
  318. private const string SvdsBarrelId = "5c471cb32e221602b177afaa";
  319. // 自 PPSh-41 枪管槽移至 SVDS 照门固定环护木槽的枪管(用于与 SVDS 枪本体建立互斥)。
  320. private static readonly (string Id, string Label)[] SvdsMovedBarrels =
  321. [
  322. (MosinBarrel200Id, "Mosin 200mm barrel"),
  323. (M700Barrel660Id, "M700 26-inch barrel"),
  324. (M700Barrel508ThreadedId, "M700 20-inch threaded barrel"),
  325. (M700BarrelStainless660Id, "M700 26-inch stainless barrel"),
  326. (M700BarrelStainless508ThreadedId, "M700 20-inch stainless threaded barrel"),
  327. (T5000Barrel660Id, "ORSIS T-5000M 660mm barrel"),
  328. ];
  329. // SVDS 照门固定环 mod_handguard 护木槽可装的原版护木(用于与 PPSh-41 枪本体建立双向互斥)。
  330. private static readonly (string Id, string Label)[] SvdsHandguards =
  331. [
  332. ("5e5699df2161e06ac158df6f", "SVDS CAA XRS DRG handguard"),
  333. ("5e56991336989c75ab4f03f6", "SVDS modernized kit handguard"),
  334. ("5c471c6c2e221602b66cd9ae", "SVDS standard handguard"),
  335. ];
  336. // 原生 SKS 导气箍 mod_mount_000 槽可装的 5 种导气管防尘盖(用于 SVT-40 625mm 枪管照门槽白名单)。
  337. private static readonly (string Id, string Label)[] SksGasTubeCovers =
  338. [
  339. ("634f03d40384a3ba4f06f874", "OP-SKS standard gas cover"),
  340. ("634f08a21f9f536910079b5a", "SKS wooden standard gas cover"),
  341. ("653ecd065a1690d9d90491e6", "TAPCO SKS gas cover"),
  342. ("653ece125a1690d9d90491e8", "Fab Defence UAS SKS gas cover"),
  343. ("653ecc425a1690d9d90491e4", "ATI Monte Carlo SKS gas cover"),
  344. ];
  345. // SVDS 照门固定环照门槽兼容的 4 种导气管件:3 种 SKS 导气管防尘盖与 UltiMAK M1-B AK 导气管套件。
  346. private static readonly (string Id, string Label)[] SvdsGasTubeItems =
  347. [
  348. ("634f03d40384a3ba4f06f874", "OP-SKS standard gas cover"),
  349. ("634f08a21f9f536910079b5a", "SKS wooden standard gas cover"),
  350. ("653ecc425a1690d9d90491e4", "ATI Monte Carlo SKS gas cover"),
  351. (UltimakM1BId, "UltiMAK M1-B AK gas tube kit"),
  352. ];
  353. // 参与“一把武器最多一个”互斥的 6 种导气管件:5 种 SKS 导气管防尘盖与 UltiMAK M1-B AK 导气管套件。
  354. private static readonly (string Id, string Label)[] ExclusiveGasTubeItems =
  355. [
  356. .. SksGasTubeCovers,
  357. (UltimakM1BId, "UltiMAK M1-B AK gas tube kit"),
  358. ];
  359. // PPSh-41 枪托槽可装的全部枪托(用于与 SKS 枪身套件建立双向互斥;不含 KS-23 金属枪托)。
  360. private static readonly (string Id, string Label)[] Ppsh41StockConflicts =
  361. [
  362. (Ppsh41StockWoodId, "PPSh-41 wooden stock"),
  363. (BenelliM3TelescopicStockId, "Benelli M3 telescopic stock"),
  364. (PkmWoodenStockId, "PKM wooden stock"),
  365. (PkZenitPt2StockId, "Zenit PT-2 stock"),
  366. (PkpPolymerStockId, "PKP polymer stock"),
  367. (UltimaMp155PistolGripId, "Ultima MP-155 pistol grip"),
  368. (M14AlcsButtstockId, "M14ALCS (MOD-0) stock"),
  369. (ZvenoBufferTubeId, "Zveno buffer tube adapter"),
  370. ];
  371. // PPSh-41 机匣槽可装的 SKS 枪身套件。
  372. private static readonly (string Id, string Label)[] SksChassisKits =
  373. [
  374. (TapcoIntrafuseSksId, "TAPCO Intrafuse SKS"),
  375. (FabDefenceUasSksId, "Fab Defence UAS SKS"),
  376. ];
  377. // 两个 SKS 枪身套件枪托槽可装的配件(用于与 KS-23 金属枪托建立双向互斥)。
  378. private static readonly (string Id, string Label)[] SksChassisStockParts =
  379. [
  380. (TapcoIntrafuseBufferTubeId, "TAPCO Intrafuse buffer tube"),
  381. (FabDefenceUasFoldingStockId, "Fab Defence UAS folding stock"),
  382. ];
  383. // 日志中用于标识槽位承载者的短名。
  384. private const string MountLabel = "mount";
  385. private const string Cr200DsLabel = "CR 200DS";
  386. private const string Cr50DsLabel = "CR 50DS";
  387. private const string Ppsh41Label = "PPSh-41";
  388. private const string M14ButtstockLabel = "M14ALCS (MOD-0) stock";
  389. private const string RpdBarrel520Label = "RPD 520mm barrel";
  390. private const string MosinBarrel730Label = "Mosin 730mm barrel";
  391. private const string Aa12Barrel457Label = "AA-12 457mm barrel";
  392. private const string Mp18RifleLabel = "MP-18 rifle";
  393. private const string Mts255Label = "MTs-255-12";
  394. private const string MarlinMxlrLabel = "Marlin MXLR";
  395. private const string SksRearSightBlockLabel = "SKS rear sight block";
  396. private const string OpsksRearSightBlockLabel = "OP-SKS rear sight block";
  397. private const string TkpdRailedDustCoverLabel = "TKPD railed dust cover";
  398. private const string Svt40Barrel625Label = "SVT-40 625mm barrel";
  399. private const string Svt40MuzzleStdLabel = "SVT-40 muzzle";
  400. private const string SvdsRearSightBlockLabel = "SVDS rear sight block";
  401. private const string SvdsBarrelLabel = "SVDS barrel";
  402. private const string FabDefenceUasSksLabel = "Fab Defence UAS SKS";
  403. private const string UltimakM1BLabel = "UltiMAK M1-B AK gas tube kit";
  404. public Task OnLoadAsync(CancellationToken cancellationToken)
  405. {
  406. try
  407. {
  408. cancellationToken.ThrowIfCancellationRequested();
  409. Dictionary<MongoId, TemplateItem> items = templateTable.Items;
  410. // UZI StormWerkz 顶盖导轨的 mod_scope 槽:追加 SpecterDR 与 BRAVO4 瞄具。
  411. AddItemIdsToSlot(items, StormwerkzTopCoverRailId, MountLabel, ScopeSlotName, SpecterDrId, SpecterDrFdeId, Bravo4Id);
  412. // CR 200DS 前准星槽:追加 StormWerkz 顶盖导轨与 MP-18 瞄具基座。
  413. AddItemIdsToSlot(items, Cr200DsId, Cr200DsLabel, SightSlotName, StormwerkzTopCoverRailId, Mp18ScopeBaseId);
  414. // CR 50DS 前准星槽:追加 StormWerkz 顶盖导轨与 MP-18 瞄具基座。
  415. AddItemIdsToSlot(items, Cr50DsId, Cr50DsLabel, SightSlotName, StormwerkzTopCoverRailId, Mp18ScopeBaseId);
  416. // CR 50DS 战术设备槽:追加 Zenit RK 系列前握把、KAC MWS 脚架转接器与 BT10 V8 Atlas 折叠脚架。
  417. AddItemIdsToSlot(items, Cr50DsId, Cr50DsLabel, TacticalSlotName, [.. ZenitRkForegripIds, KacMwsBipodAdapterId, Bt10AtlasBipodId]);
  418. // PPSh-41 枪管槽:追加莫辛纳甘 220mm 螺纹 / 514mm / 730mm 枪管、SKS / OP-SKS 的 520mm 枪管、
  419. // SVT-40 / AVT-40 共用的 625mm 枪管与 SVDS 照门固定环(原莫辛 200mm、M700、ORSIS T-5000M 已移至 SVDS 照门固定环)。
  420. AddItemIdsToSlot(items, Ppsh41Id, Ppsh41Label, BarrelSlotName,
  421. MosinBarrel220ThreadedId, MosinBarrel514Id, MosinBarrel730Id,
  422. SksBarrel520Id, OpsksBarrel520Id, Svt40Barrel625Id,
  423. SvdsRearSightBlockId);
  424. // PPSh-41 机匣槽(mod_reciever):追加 TAPCO Intrafuse 与 Fab Defence UAS SKS 枪身套件。
  425. AddItemIdsToSlot(items, Ppsh41Id, Ppsh41Label, RecieverSlotName, TapcoIntrafuseSksId, FabDefenceUasSksId);
  426. // 730mm 标准莫辛枪管的前准星槽:追加 MDR BLK LBL ALX 脚架(16 与 20 型号)。
  427. AddItemIdsToSlot(items, MosinBarrel730Id, MosinBarrel730Label, SightSlotName, AlxBipod16Id, AlxBipod20Id);
  428. // SVT-40 标准枪口装置的 mod_sight_front 前准星槽:追加 MDR BLK LBL ALX 脚架(16 与 20 型号)。
  429. AddItemIdsToSlot(items, Svt40MuzzleStdId, Svt40MuzzleStdLabel, SightSlotName, AlxBipod16Id, AlxBipod20Id);
  430. // PPSh-41 枪托槽:追加 Benelli M3 可伸缩枪托、PKM / PKP 枪托、Ultima MP-155 握把、
  431. // KS-23 金属枪托、M14 SAGE International M14ALCS (MOD-0) 枪托与 Zveno PK 缓冲管转接器。
  432. AddItemIdsToSlot(items, Ppsh41Id, Ppsh41Label, StockSlotName, BenelliM3TelescopicStockId, PkmWoodenStockId, PkZenitPt2StockId, PkpPolymerStockId, UltimaMp155PistolGripId, Ks23MetalStockId, M14AlcsButtstockId, ZvenoBufferTubeId);
  433. // SKS / OP-SKS 照门固定环的 mod_sight_rear 照门槽:追加 TKPD 导轨防尘盖。
  434. AddItemIdsToSlot(items, SksRearSightBlockId, SksRearSightBlockLabel, SightRearSlotName, TkpdRailedDustCoverId);
  435. AddItemIdsToSlot(items, OpsksRearSightBlockId, OpsksRearSightBlockLabel, SightRearSlotName, TkpdRailedDustCoverId);
  436. // SVT-40 625mm 枪管的 mod_sight_rear 照门槽:追加 TKPD 导轨防尘盖与 5 种 SKS 导气管防尘盖。
  437. AddItemIdsToSlot(items, Svt40Barrel625Id, Svt40Barrel625Label, SightRearSlotName,
  438. [TkpdRailedDustCoverId, .. SksGasTubeCovers.Select(x => x.Id)]);
  439. // SVDS 照门固定环的 mod_handguard 护木槽:追加莫辛 200mm、M700 全部 4 种、ORSIS T-5000M、SVDS 枪管、SVT-40 625mm 枪管与照门固定环自身。
  440. AddItemIdsToSlot(items, SvdsRearSightBlockId, SvdsRearSightBlockLabel, HandguardSlotName,
  441. MosinBarrel200Id, M700Barrel660Id, M700Barrel508ThreadedId, M700BarrelStainless660Id, M700BarrelStainless508ThreadedId, T5000Barrel660Id,
  442. SvdsBarrelId, Svt40Barrel625Id, SvdsRearSightBlockId);
  443. // SVDS 照门固定环的 mod_sight_rear 照门槽:追加 TKPD 导轨防尘盖与 4 种导气管件(3 种 SKS 防尘盖 + UltiMAK M1-B)。
  444. AddItemIdsToSlot(items, SvdsRearSightBlockId, SvdsRearSightBlockLabel, SightRearSlotName,
  445. [TkpdRailedDustCoverId, .. SvdsGasTubeItems.Select(x => x.Id)]);
  446. // PPSh-41 防尘盖与 HUXWRX HX-QD 消音器互不兼容。
  447. AddDustCoverSuppressorConflict(items);
  448. // 两个 SKS 枪身套件(机匣槽)与除 KS-23 金属枪托之外的全部 PPSh-41 枪托互不兼容。
  449. AddSksChassisConflicts(items);
  450. // 两个 SKS 枪身套件与 PPSh-41 的 71 发弹鼓互不兼容。
  451. AddSksChassisDrumConflict(items);
  452. // KS-23 金属枪托与两个 SKS 枪身套件枪托槽可装的配件互不兼容。
  453. AddKs23StockSksChassisStockPartConflicts(items);
  454. // TKPD 导轨防尘盖与 SKS / OP-SKS 枪本体互不兼容。
  455. AddDustCoverSksConflicts(items);
  456. // TKPD 导轨防尘盖与自身互不兼容(防止重复安装)。
  457. AddTkpdSelfConflict(items);
  458. // TKPD 导轨防尘盖与 SVT-40 / AVT-40 枪本体双向互不兼容。
  459. AddDustCoverSvtAvtConflicts(items);
  460. // SVDS 照门固定环引入的互斥(移植枪管、TKPD 与 SVDS 枪本体;SVDS 枪管防重;照门固定环与 PPSh-41 防尘盖)。
  461. AddSvdsConflicts(items);
  462. // MDR BLK LBL ALX 20 脚架与自身互不兼容(防止重复安装)。
  463. AddAlxBipod20SelfConflict(items);
  464. // 5 种 SKS 导气管防尘盖与 UltiMAK M1-B 彼此(含与自身)互不兼容,使一把武器上最多只能装一个。
  465. AddGasTubeMutualConflicts(items);
  466. // Aim Sports“三轨”的第一个战术配件槽:追加多种前握把、SV-98 隔热带与 Fortis Shift 前握把。
  467. AddItemIdsToSlot(items, AimSportsTriRailId, AimSportsTriRailLabel, AimSportsTriRailTacticalSlotName, [.. AimSportsTriRailForegripIds, Sv98HeatRibbonId, FortisShiftForegripId]);
  468. // Aim Sports“三轨”的第二个战术配件槽:追加 SV-98 隔热带。
  469. AddItemIdsToSlot(items, AimSportsTriRailId, AimSportsTriRailLabel, AimSportsTriRailSecondTacticalSlotName, Sv98HeatRibbonId);
  470. // Aim Sports“三轨”的瞄具槽:追加 M14 DCSB 瞄具基座。
  471. AddItemIdsToSlot(items, AimSportsTriRailId, AimSportsTriRailLabel, ScopeSlotName, M14DcsbMountId);
  472. // Alpha Dog 9x19 声音抑制器的 mod_scope 槽:追加 M14 DCSB 瞄具基座。
  473. AddItemIdsToSlot(items, AlphaDogSuppressorId, AlphaDogSuppressorLabel, ScopeSlotName, M14DcsbMountId);
  474. // Fab Defence UAS SKS 枪身套件的下导轨(mod_tactical_002):追加 MDR BLK LBL ALX 20 脚架与 AK-100 聚合物护木兼容的全部前握把。
  475. AddItemIdsToSlot(items, FabDefenceUasSksId, FabDefenceUasSksLabel, FabDefenceUasLowerRailSlotName, [AlxBipod20Id, .. Ak100PolymerHandguardForegripIds]);
  476. // UltiMAK M1-B AK 导气管套件的战术配件槽(mod_tactical_000):追加 MDR BLK LBL ALX 20 脚架。
  477. AddItemIdsToSlot(items, UltimakM1BId, UltimakM1BLabel, UltimakM1BTacticalSlotName, AlxBipod20Id);
  478. // M14ALCS (MOD-0) 枪托的握把位:追加 AR-15 Tactical Dynamics 镂空手枪式握把、
  479. // Tyrant Designs MOD Chevron 镂空手枪式握把(黑 / 黄 / 红)与 AS VAL Rotor 43 手枪式握把。
  480. AddItemIdsToSlot(items, M14AlcsButtstockId, M14ButtstockLabel, M14AlcsPistolGripSlotName,
  481. TacticalDynamicsSkeletonizedGripId, TyrantChevronGripBlackId, TyrantChevronGripYellowId, TyrantChevronGripRedId, AsValRotor43GripId);
  482. // UZI StormWerkz 护木底轨的 mod_tactical 槽:追加 Zenit RK 系列前握把。
  483. AddItemIdsToSlot(items, StormwerkzLowerHandguardRailId, StormwerkzLowerHandguardLabel, TacticalSlotName, ZenitRkForegripIds);
  484. // AA-12 457mm 枪管的 mod_mount 导轨槽:追加 M60 脚架。
  485. AddItemIdsToSlot(items, Aa12Barrel457Id, Aa12Barrel457Label, MountSlotName, M60BipodId);
  486. // RPD 520mm 枪管的 mod_muzzle 枪口槽:追加 AKM PBS-1 消音器。
  487. AddItemIdsToSlot(items, RpdBarrel520Id, RpdBarrel520Label, MuzzleSlotName, AkmPbs1Id);
  488. // MP-18 与 Marlin MXLR 的 mod_stock 枪托槽:追加 KS-23 金属枪托。
  489. AddItemIdsToSlot(items, Mp18RifleId, Mp18RifleLabel, StockSlotName, Ks23MetalStockId);
  490. AddItemIdsToSlot(items, MarlinMxlrId, MarlinMxlrLabel, StockSlotName, Ks23MetalStockId);
  491. // MTs-255-12 的 mod_handguard 护木槽:追加 MP-18 的全部护木;
  492. // mod_stock 枪托槽:追加雷明顿 Model 870 支持的全部枪托。
  493. AddItemIdsToSlot(items, Mts255Id, Mts255Label, HandguardSlotName, Mp18HandguardWoodId, Mp18HandguardPlasticId);
  494. AddItemIdsToSlot(items, Mts255Id, Mts255Label, StockSlotName, M870StockIds);
  495. // 20x1mm 玩具枪的膛室:保留 7.62x25 托卡列夫全部 7 种弹药兼容(不动 ammoCaliber;其原装弹匣不直接支持,改由 MXLR 弹仓供弹)。
  496. AddAmmoIdsToContainer(items, ToyGunId, ToyGunLabel, isChamber: true, [.. Caliber762x25Ammo.Select(x => x.Id)]);
  497. // Marlin MXLR 5 发管状弹仓的装填位:追加 7.62x25 托卡列夫全部 7 种弹药。
  498. AddAmmoIdsToContainer(items, MxlrMagId, MxlrMagLabel, isChamber: false, [.. Caliber762x25Ammo.Select(x => x.Id)]);
  499. // 20x1mm 玩具枪的 mod_magazine 槽:追加 Marlin MXLR 5 发管状弹仓。
  500. AddItemIdsToSlot(items, ToyGunId, ToyGunLabel, MagazineSlotName, MxlrMagId);
  501. // EMTI-019 基座的 mod_scope 槽:追加 DCSB 瞄具基座。
  502. AddItemIdsToSlot(items, EmtiId, EmtiLabel, ScopeSlotName, M14DcsbMountId);
  503. }
  504. catch (Exception ex)
  505. {
  506. logger.Error("WeaponCrossModding failed: " + ex.Message);
  507. }
  508. return Task.CompletedTask;
  509. }
  510. /// <summary>
  511. /// 往 <paramref name="ownerId"/> 名为 <paramref name="slotName"/> 的槽的各 Filter 追加 <paramref name="itemIds"/>(幂等)。
  512. /// </summary>
  513. private void AddItemIdsToSlot(
  514. Dictionary<MongoId, TemplateItem> items,
  515. string ownerId,
  516. string ownerLabel,
  517. string slotName,
  518. params string[] itemIds)
  519. {
  520. if (!items.TryGetValue(ownerId, out TemplateItem? owner))
  521. {
  522. logger.Warning($"WeaponCrossModding: {ownerLabel} id '{ownerId}' not found in Items");
  523. return;
  524. }
  525. IEnumerable<Slot>? slots = owner.Properties?.Slots;
  526. if (slots is null)
  527. {
  528. logger.Warning($"WeaponCrossModding: {ownerLabel} has no slots");
  529. return;
  530. }
  531. foreach (Slot slot in slots.Where(s => s is not null && string.Equals(s.Name, slotName, StringComparison.OrdinalIgnoreCase)))
  532. {
  533. IEnumerable<SlotFilter>? filters = slot.Properties?.Filters;
  534. if (filters is null)
  535. {
  536. continue;
  537. }
  538. foreach (SlotFilter filter in filters)
  539. {
  540. foreach (string itemId in itemIds)
  541. {
  542. AddToFilter(filter, itemId, owner, slot);
  543. }
  544. }
  545. }
  546. }
  547. /// <summary>
  548. /// 往 <paramref name="ownerId"/> 的膛室(Chambers)或弹匣装填位(Cartridges)各 Filter 追加弹药 id(幂等)。
  549. /// 这两者都是 <see cref="Slot"/> 列表,其 <c>Properties.Filters[].Filter</c> 决定可容纳的弹药模板。
  550. /// </summary>
  551. private void AddAmmoIdsToContainer(
  552. Dictionary<MongoId, TemplateItem> items,
  553. string ownerId,
  554. string ownerLabel,
  555. bool isChamber,
  556. params string[] ammoIds)
  557. {
  558. if (!items.TryGetValue(ownerId, out TemplateItem? owner))
  559. {
  560. logger.Warning($"WeaponCrossModding: {ownerLabel} id '{ownerId}' not found in Items");
  561. return;
  562. }
  563. IEnumerable<Slot>? containers = isChamber ? owner.Properties?.Chambers : owner.Properties?.Cartridges;
  564. if (containers is null)
  565. {
  566. logger.Warning($"WeaponCrossModding: {ownerLabel} has no {(isChamber ? "chambers" : "cartridges")}");
  567. return;
  568. }
  569. foreach (Slot container in containers.Where(c => c is not null))
  570. {
  571. IEnumerable<SlotFilter>? filters = container.Properties?.Filters;
  572. if (filters is null)
  573. {
  574. continue;
  575. }
  576. foreach (SlotFilter filter in filters)
  577. {
  578. foreach (string ammoId in ammoIds)
  579. {
  580. AddToFilter(filter, ammoId, owner, container);
  581. }
  582. }
  583. }
  584. }
  585. /// <summary>
  586. /// 让 PPSh-41 防尘盖与 HUXWRX HX-QD 消音器(含黄褐色变体)互不兼容(幂等)。
  587. /// 防尘盖为原版物品、必定存在;消音器由 WTT-ContentBackport 注入,若不在 Items 中则跳过
  588. /// (防尘盖侧足以建立冲突,且避开了第三方 mod 的加载时序依赖)。
  589. /// </summary>
  590. private void AddDustCoverSuppressorConflict(Dictionary<MongoId, TemplateItem> items)
  591. {
  592. AddConflictingItems(items, Ppsh41DustCoverId, "PPSh-41 dust cover", HuxwrxHxQdId, HuxwrxHxQdTanId);
  593. AddConflictingItems(items, HuxwrxHxQdId, "HUXWRX HX-QD", Ppsh41DustCoverId);
  594. AddConflictingItems(items, HuxwrxHxQdTanId, "HUXWRX HX-QD (Tan)", Ppsh41DustCoverId);
  595. }
  596. /// <summary>
  597. /// 让两个 SKS 枪身套件(装于 PPSh-41 机匣槽)与除 KS-23 金属枪托之外的
  598. /// 全部 PPSh-41 枪托双向互不兼容(幂等)。
  599. /// Zveno 由 WTT-ContentBackport 注入,若缺失则跳过该项。
  600. /// </summary>
  601. private void AddSksChassisConflicts(Dictionary<MongoId, TemplateItem> items)
  602. {
  603. foreach ((string chassisId, string chassisLabel) in SksChassisKits)
  604. {
  605. AddConflictingItems(items, chassisId, chassisLabel, [.. Ppsh41StockConflicts.Select(x => x.Id)]);
  606. foreach ((string stockId, string stockLabel) in Ppsh41StockConflicts)
  607. {
  608. AddConflictingItems(items, stockId, stockLabel, chassisId);
  609. }
  610. }
  611. }
  612. /// <summary>
  613. /// 让两个 SKS 枪身套件(装于 PPSh-41 机匣槽)与 PPSh-41 的 71 发弹鼓双向互不兼容(幂等)。
  614. /// 两者均为原版物品、必定存在,故双向建立冲突。
  615. /// </summary>
  616. private void AddSksChassisDrumConflict(Dictionary<MongoId, TemplateItem> items)
  617. {
  618. foreach ((string chassisId, string chassisLabel) in SksChassisKits)
  619. {
  620. AddConflictingItems(items, chassisId, chassisLabel, Ppsh71DrumMagId);
  621. AddConflictingItems(items, Ppsh71DrumMagId, "PPSh-41 71-round drum", chassisId);
  622. }
  623. }
  624. /// <summary>
  625. /// 让 KS-23 金属枪托与两个 SKS 枪身套件枪托槽可装的配件双向互不兼容(幂等)。
  626. /// 所有相关物品均为原版物品、必定存在,故双向建立冲突。
  627. /// </summary>
  628. private void AddKs23StockSksChassisStockPartConflicts(Dictionary<MongoId, TemplateItem> items)
  629. {
  630. foreach ((string partId, string partLabel) in SksChassisStockParts)
  631. {
  632. AddConflictingItems(items, Ks23MetalStockId, "KS-23 metal stock", partId);
  633. AddConflictingItems(items, partId, partLabel, Ks23MetalStockId);
  634. }
  635. }
  636. /// <summary>
  637. /// 让 TKPD 导轨防尘盖与 SKS / OP-SKS 枪本体双向互不兼容(幂等)。
  638. /// SKS / OP-SKS 为原版物品;TKPD 导轨防尘盖由 WTT-ContentBackport 注入,若缺失则跳过。
  639. /// </summary>
  640. private void AddDustCoverSksConflicts(Dictionary<MongoId, TemplateItem> items)
  641. {
  642. AddConflictingItems(items, TkpdRailedDustCoverId, TkpdRailedDustCoverLabel, SksWeaponId, OpsksWeaponId);
  643. AddConflictingItems(items, SksWeaponId, "SKS", TkpdRailedDustCoverId);
  644. AddConflictingItems(items, OpsksWeaponId, "OP-SKS", TkpdRailedDustCoverId);
  645. }
  646. /// <summary>
  647. /// 让 TKPD 导轨防尘盖与 SVT-40 / AVT-40 枪本体双向互不兼容(幂等)。
  648. /// SVT-40 / AVT-40 为原版物品;TKPD 导轨防尘盖由 WTT-ContentBackport 注入,若缺失则跳过。
  649. /// </summary>
  650. private void AddDustCoverSvtAvtConflicts(Dictionary<MongoId, TemplateItem> items)
  651. {
  652. AddConflictingItems(items, TkpdRailedDustCoverId, TkpdRailedDustCoverLabel, Svt40WeaponId, Avt40WeaponId);
  653. AddConflictingItems(items, Svt40WeaponId, "SVT-40", TkpdRailedDustCoverId);
  654. AddConflictingItems(items, Avt40WeaponId, "AVT-40", TkpdRailedDustCoverId);
  655. }
  656. /// <summary>
  657. /// SVDS 照门固定环引入的互斥(幂等):
  658. /// 移植到护木槽的枪管(含 SVT-40 625mm 枪管)与 SVDS 枪本体双向互斥(避免经照门固定环装到原版 SVDS 上);
  659. /// TKPD 导轨防尘盖与 SVDS 枪本体双向互斥;SVDS 枪管与自身互斥(防止装两个);
  660. /// SVDS 照门固定环与 PPSh-41 防尘盖、TAPCO Intrafuse SKS 枪身套件双向互斥;
  661. /// SVDS 照门固定环护木槽的原版护木与 PPSh-41 枪本体双向互斥。
  662. /// TKPD 与 SVDS 枪管由 WTT-ContentBackport 注入,若缺失则跳过其侧。
  663. /// </summary>
  664. private void AddSvdsConflicts(Dictionary<MongoId, TemplateItem> items)
  665. {
  666. AddConflictingItems(items, SvdsWeaponId, "SVDS", [.. SvdsMovedBarrels.Select(x => x.Id)]);
  667. foreach ((string barrelId, string barrelLabel) in SvdsMovedBarrels)
  668. {
  669. AddConflictingItems(items, barrelId, barrelLabel, SvdsWeaponId);
  670. }
  671. AddConflictingItems(items, TkpdRailedDustCoverId, TkpdRailedDustCoverLabel, SvdsWeaponId);
  672. AddConflictingItems(items, SvdsWeaponId, "SVDS", TkpdRailedDustCoverId);
  673. // SVDS 照门固定环护木槽新增的 SVT-40 625mm 枪管与 SVDS 枪本体双向互斥。
  674. AddConflictingItems(items, Svt40Barrel625Id, Svt40Barrel625Label, SvdsWeaponId);
  675. AddConflictingItems(items, SvdsWeaponId, "SVDS", Svt40Barrel625Id);
  676. AddConflictingItems(items, SvdsBarrelId, SvdsBarrelLabel, SvdsBarrelId);
  677. AddConflictingItems(items, SvdsRearSightBlockId, SvdsRearSightBlockLabel, Ppsh41DustCoverId);
  678. AddConflictingItems(items, Ppsh41DustCoverId, "PPSh-41 dust cover", SvdsRearSightBlockId);
  679. AddConflictingItems(items, SvdsRearSightBlockId, SvdsRearSightBlockLabel, TapcoIntrafuseSksId);
  680. AddConflictingItems(items, TapcoIntrafuseSksId, "TAPCO Intrafuse SKS", SvdsRearSightBlockId);
  681. AddConflictingItems(items, Ppsh41Id, Ppsh41Label, [.. SvdsHandguards.Select(x => x.Id)]);
  682. foreach ((string handguardId, string handguardLabel) in SvdsHandguards)
  683. {
  684. AddConflictingItems(items, handguardId, handguardLabel, Ppsh41Id);
  685. }
  686. }
  687. /// <summary>
  688. /// 让 TKPD 导轨防尘盖与自身互不兼容(幂等),防止重复安装。
  689. /// </summary>
  690. private void AddTkpdSelfConflict(Dictionary<MongoId, TemplateItem> items)
  691. {
  692. AddConflictingItems(items, TkpdRailedDustCoverId, TkpdRailedDustCoverLabel, TkpdRailedDustCoverId);
  693. }
  694. /// <summary>
  695. /// 让 MDR BLK LBL ALX 20 脚架与自身互不兼容(幂等),防止重复安装。
  696. /// ALX 20 由 WTT-ContentBackport 注入,若缺失则跳过。
  697. /// </summary>
  698. private void AddAlxBipod20SelfConflict(Dictionary<MongoId, TemplateItem> items)
  699. {
  700. AddConflictingItems(items, AlxBipod20Id, AlxBipod20Label, AlxBipod20Id);
  701. }
  702. /// <summary>
  703. /// 让 5 种 SKS 导气管防尘盖与 UltiMAK M1-B AK 导气管套件彼此之间(含与自身)互不兼容(幂等),使一把武器上最多只能装一个。
  704. /// </summary>
  705. private void AddGasTubeMutualConflicts(Dictionary<MongoId, TemplateItem> items)
  706. {
  707. string[] ids = [.. ExclusiveGasTubeItems.Select(x => x.Id)];
  708. foreach ((string id, string label) in ExclusiveGasTubeItems)
  709. {
  710. AddConflictingItems(items, id, label, ids);
  711. }
  712. }
  713. /// <summary>
  714. /// 往 <paramref name="ownerId"/> 的 ConflictingItems 追加 <paramref name="conflictIds"/>(幂等)。
  715. /// </summary>
  716. private void AddConflictingItems(
  717. Dictionary<MongoId, TemplateItem> items,
  718. string ownerId,
  719. string ownerLabel,
  720. params string[] conflictIds)
  721. {
  722. if (!items.TryGetValue(ownerId, out TemplateItem? owner))
  723. {
  724. logger.Debug($"WeaponCrossModding: {ownerLabel} id '{ownerId}' not in Items, skip conflicting items");
  725. return;
  726. }
  727. owner.Properties ??= new TemplateItemProperties();
  728. owner.Properties.ConflictingItems ??= new HashSet<MongoId>();
  729. foreach (string conflictId in conflictIds)
  730. {
  731. if (owner.Properties.ConflictingItems.Add(conflictId))
  732. {
  733. logger.Info($"WeaponCrossModding: added conflicting item '{conflictId}' to '{ownerLabel}' ({owner.Name})");
  734. }
  735. else
  736. {
  737. logger.Debug($"WeaponCrossModding: conflicting item '{conflictId}' already on '{ownerLabel}' ({owner.Name})");
  738. }
  739. }
  740. }
  741. private void AddToFilter(SlotFilter? filter, string itemId, TemplateItem parent, Slot slot)
  742. {
  743. if (filter is null)
  744. {
  745. return;
  746. }
  747. filter.Filter ??= new HashSet<MongoId>();
  748. if (filter.Filter.Add(itemId))
  749. {
  750. logger.Info($"WeaponCrossModding: added '{itemId}' to slot '{slot.Name}' ({parent.Name})");
  751. }
  752. else
  753. {
  754. logger.Debug($"WeaponCrossModding: '{itemId}' already in slot '{slot.Name}' ({parent.Name})");
  755. }
  756. }
  757. }