"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mod = exports.HandbookTPL = exports.WeaponIds = void 0;
const Item_Preset_json_1 = __importDefault(require("../src/Item_Preset.json"));
const global_item_preset_json_1 = __importDefault(require("../src/global_item_preset.json"));
//import spawnPoints from "../src/loot/Spawns.json";
const ItemTpl_1 = require("C:/snapshot/project/obj/models/enums/ItemTpl");
const Traders_1 = require("C:/snapshot/project/obj/models/enums/Traders");
var WeaponIds;
(function (WeaponIds) {
    WeaponIds["KSG12"] = "66ce63fe2fce038160aa9ac6";
    WeaponIds["KSG12_MAG"] = "66ce64029424740723b70288";
})(WeaponIds || (exports.WeaponIds = WeaponIds = {}));
var HandbookTPL;
(function (HandbookTPL) {
    HandbookTPL["SHOTGUN"] = "5b5f794b86f77409407a7f92";
    HandbookTPL["ASSAULT_RIFLE"] = "5b5f78fc86f77409407a7f90";
    HandbookTPL["PISTOL"] = "5b5f792486f77447ed5636b3";
    HandbookTPL["CARBINE"] = "5b5f78e986f77447ed5636b1";
    HandbookTPL["MARKSMAN"] = "5b5f791486f774093f2ed3be";
    HandbookTPL["SMG"] = "5b5f796a86f774093f2ed3c0";
})(HandbookTPL || (exports.HandbookTPL = HandbookTPL = {}));
class Mod {
    postDBLoad(container) {
        const customitem = container.resolve("CustomItemService");
        const databaseServer = container.resolve("DatabaseServer");
        const db = databaseServer.getTables();
        const globals = db.globals;
        const PK = db.traders[Traders_1.Traders.PEACEKEEPER].assort;
        const SKR = db.traders[Traders_1.Traders.SKIER].assort;
        // WEAPON LISTING AND ATTACHMENT
        const ksg_12g = {
            itemTplToClone: ItemTpl_1.ItemTpl.SHOTGUN_REMINGTON_MODEL_870_12GA_PUMPACTION,
            overrideProperties: {
                Prefab: {
                    path: "ksg12/weapon_keltec_ksg_12g_container.bundle",
                    rcid: ""
                },
                AimPlane: 0.27,
                Name: "weapon_keltec_ksg_12g",
                ShortName: "weapon_keltec_ksg_12g",
                Description: "weapon_keltec_ksg_12g",
                CenterOfImpact: 0.35,
                Width: 5,
                Height: 2,
                Ergonomics: 54,
                ExaminedByDefault: false,
                ExamineExperience: 20,
                IronSightRange: 50,
                LootExperience: 15,
                RecoilAngle: 94,
                RecoilCenter: {
                    x: 0,
                    y: 0.027,
                    z: -0.039
                },
                RecoilForceUp: 256,
                RecoilForceBack: 344,
                RecoilPosZMult: 0.7,
                RecoilCamera: 0.215,
                RecoilReturnPathDampingHandRotation: 0.62,
                RecoilReturnSpeedHandRotation: 3.75,
                RecoilDampingHandRotation: 0.51,
                CameraToWeaponAngleStep: 0.2,
                CameraSnap: 3.2,
                CompactHandling: false,
                RotationCenterNoStock: {
                    x: 0,
                    y: -0.193,
                    z: -0.03899999
                },
                Slots: [
                    {
                        _id: "66ce675cd29851414a241834",
                        "_mergeSlotWithChildren": false,
                        "_name": "mod_magazine",
                        "_parent": WeaponIds.KSG12,
                        "_props": {
                            "filters": [
                                {
                                    "AnimationIndex": 0,
                                    "Filter": [
                                        WeaponIds.KSG12_MAG
                                    ]
                                }
                            ]
                        },
                        "_proto": "55d30c394bdc2dae468b4577",
                        "_required": true
                    },
                    {
                        "_name": "mod_scope",
                        "_id": "66ce68e4bdd6e19c47c184b7",
                        "_parent": WeaponIds.KSG12,
                        "_props": {
                            "filters": [
                                {
                                    "Shift": 0,
                                    "Filter": [
                                        "57ac965c24597706be5f975c",
                                        "57aca93d2459771f2c7e26db",
                                        "544a3f024bdc2d1d388b4568",
                                        "544a3a774bdc2d3a388b4567",
                                        "5d2dc3e548f035404a1a4798",
                                        "57adff4f24597737f373b6e6",
                                        "5c0517910db83400232ffee5",
                                        "591c4efa86f7741030027726",
                                        "570fd79bd2720bc7458b4583",
                                        "570fd6c2d2720bc6458b457f",
                                        "558022b54bdc2dac148b458d",
                                        "5c07dd120db834001c39092d",
                                        "5c0a2cec0db834001b7ce47d",
                                        "58491f3324597764bc48fa02",
                                        "584924ec24597768f12ae244",
                                        "5b30b0dc5acfc400153b7124",
                                        "6165ac8c290d254f5e6b2f6c",
                                        "60a23797a37c940de7062d02",
                                        "5d2da1e948f035477b1ce2ba",
                                        "5c0505e00db834001b735073",
                                        "609a63b6e2ff132951242d09",
                                        "584984812459776a704a82a6",
                                        "59f9d81586f7744c7506ee62",
                                        "570fd721d2720bc5458b4596",
                                        "57ae0171245977343c27bfcf",
                                        "5dfe6104585a0c3e995c7b82",
                                        "5d1b5e94d7ad1a2b865a96b0",
                                        "609bab8b455afd752b2e6138",
                                        "58d39d3d86f77445bb794ae7",
                                        "616554fe50224f204c1da2aa",
                                        "5c7d55f52e221644f31bff6a",
                                        "616584766ef05c2ce828ef57",
                                        "5b3b6dc75acfc47a8773fb1e",
                                        "615d8d878004cc50514c3233",
                                        "5b2389515acfc4771e1be0c0",
                                        "577d128124597739d65d0e56",
                                        "618b9643526131765025ab35",
                                        "618bab21526131765025ab3f",
                                        "5c86592b2e2216000e69e77c",
                                        "5a37ca54c4a282000d72296a",
                                        "5d0a29fed7ad1a002769ad08",
                                        "5c064c400db834001d23f468",
                                        "58d2664f86f7747fec5834f6",
                                        "57c69dd424597774c03b7bbc",
                                        "5b3b99265acfc4704b4a1afb",
                                        "5aa66a9be5b5b0214e506e89",
                                        "5aa66c72e5b5b00016327c93",
                                        "5c1cdd302e221602b3137250",
                                        "61714b2467085e45ef140b2c",
                                        "6171407e50224f204c1da3c5",
                                        "61713cc4d8e3106d9806c109",
                                        "5b31163c5acfc400153b71cb",
                                        "5a33b652c4a28232996e407c",
                                        "5a33b2c9c4a282000c5a9511",
                                        "59db7eed86f77461f8380365",
                                        "5a1ead28fcdbcb001912fa9f",
                                        "626bb8532c923541184624b4",
                                        "62811f461d5df4475f46a332",
                                        "63fc449f5bd61c6cf3784a88",
                                        "6477772ea8a38bb2050ed4db",
                                        "6478641c19d732620e045e17",
                                        "64785e7c19d732620e045e15",
                                        "65392f611406374f82152ba5",
                                        "653931da5db71d30ab1d6296",
                                        "655f13e0a246670fb0373245"
                                    ]
                                }
                            ]
                        },
                        "_required": false,
                        "_mergeSlotWithChildren": false,
                        "_proto": "55d30c4c4bdc2db4468b457e"
                    },
                    {
                        "_name": "mod_foregrip",
                        "_id": "66ce69648498e374463500a6",
                        "_parent": WeaponIds.KSG12,
                        "_props": {
                            "filters": [
                                {
                                    "Shift": 0,
                                    "Filter": [
                                        "5c7fc87d2e221644f31c0298",
                                        "5cda9bcfd7f00c0c0b53e900",
                                        "59f8a37386f7747af3328f06",
                                        "619386379fb0c665d5490dbe",
                                        "5c87ca002e221600114cb150",
                                        "588226d124597767ad33f787",
                                        "588226dd24597767ad33f789",
                                        "588226e62459776e3e094af7",
                                        "588226ef24597767af46e39c",
                                        "59fc48e086f77463b1118392",
                                        "5fce0cf655375d18a253eff0",
                                        "5cf4fb76d7f00c065703d3ac",
                                        "5b057b4f5acfc4771e1bd3e9",
                                        "5c791e872e2216001219c40a",
                                        "558032614bdc2de7118b4585",
                                        "58c157be86f77403c74b2bb6",
                                        "58c157c886f774032749fb06",
                                        "5f6340d3ca442212f4047eb2",
                                        "591af28e86f77414a27a9e1d",
                                        "5c1cd46f2e22164bef5cfedb",
                                        "5c1bc4812e22164bef5cfde7",
                                        "5c1bc5612e221602b5429350",
                                        "5c1bc5af2e221602b412949b",
                                        "5c1bc5fb2e221602b1779b32",
                                        "5c1bc7432e221602b412949d",
                                        "5c1bc7752e221602b1779b34",
                                        "648067db042be0705c0b3009",
                                        "64807a29e5ffe165600abc97",
                                        "64806bdd26c80811d408d37a",
                                        "65169d5b30425317755f8e25",
                                        "655df24fdf80b12750626d0a",
                                        "655dccfdbdcc6b5df71382b6"
                                    ]
                                }
                            ]
                        },
                        "_required": false,
                        "_mergeSlotWithChildren": false,
                        "_proto": "55d30c4c4bdc2db4468b457e"
                    },
                    {
                        "_name": "mod_sight_rear",
                        "_id": "66ce69d9b539f92cb86b9691",
                        "_parent": WeaponIds.KSG12,
                        "_props": {
                            "filters": [
                                {
                                    "Shift": 0,
                                    "Filter": [
                                        "5bb20e49d4351e3bac1212de",
                                        "5ba26b17d4351e00367f9bdd",
                                        "5dfa3d7ac41b2312ea33362a",
                                        "5c1780312e221602b66cc189",
                                        "5fb6564947ce63734e3fa1da",
                                        "5bc09a18d4351e003562b68e",
                                        "5c18b9192e2216398b5a8104",
                                        "5fc0fa957283c4046c58147e",
                                        "5894a81786f77427140b8347",
                                        "55d5f46a4bdc2d1b198b4567"
                                    ]
                                }
                            ]
                        },
                        "_required": false,
                        "_mergeSlotWithChildren": false,
                        "_proto": "55d30c4c4bdc2db4468b457e"
                    },
                    {
                        "_name": "mod_sight_front",
                        "_id": "66ce69f01b281721aa000457",
                        "_parent": WeaponIds.KSG12,
                        "_props": {
                            "filters": [
                                {
                                    "Shift": 0,
                                    "Filter": [
                                        "5ba26b01d4351e0085325a51",
                                        "5dfa3d950dee1b22f862eae0",
                                        "5c17804b2e2216152006c02f",
                                        "5fb6567747ce63734e3fa1dc",
                                        "5bc09a30d4351e00367fb7c8",
                                        "5c18b90d2e2216152142466b",
                                        "5fc0fa362770a0045c59c677",
                                        "5894a73486f77426d259076c",
                                        "55d4af3a4bdc2d972f8b456f"
                                    ]
                                }
                            ]
                        },
                        "_required": false,
                        "_mergeSlotWithChildren": false,
                        "_proto": "55d30c4c4bdc2db4468b457e"
                    }
                ],
                Weight: 3.02,
                ammoCaliber: "Caliber12g",
                defAmmo: "560d5e524bdc2d25448b4571",
                defMagType: WeaponIds.KSG12_MAG,
                durabSpawnMax: 100,
                durabSpawnMin: 35,
                AllowFeed: false,
                AllowJam: false,
                AllowMisfire: false,
                AllowSlide: false,
                AllowOverheat: false
            },
            parentId: "5447b6094bdc2dc3278b4567",
            newId: WeaponIds.KSG12,
            handbookParentId: "5b5f794b86f77409407a7f92",
            handbookPriceRoubles: 64431,
            fleaPriceRoubles: 88763,
            locales: {
                "en": {
                    name: "Kel-Tec KSG-12g Shotgun",
                    shortName: "KSG-12",
                    description: "The Kel-Tec KSG is a bullpup 12-gauge pump-action shotgun designed by Kel-Tec. It has two tube magazines which the user of the gun can switch between manually (visual only, non functional). Rounds are loaded into the magazines through a large loading/ejection port, located at the bottom of the gun in the stock, behind the pistol grip. Empty shells are ejected down through the same port. Sighting equipment (iron sights and/or red dot sights) can be installed using the standard Picatinny rail located above the barrel. A second Picatinny rail is provided at the bottom of the sliding forend, permitting installation of other accessories."
                }
            }
        };
        customitem.createItemFromClone(ksg_12g);
        const ksg_cap = {
            itemTplToClone: ItemTpl_1.ItemTpl.MAGAZINE_12G_M870X10_10RND,
            overrideProperties: {
                Cartridges: [
                    {
                        "_id": "66515612ca5e57294f5e3527",
                        "_max_count": 14,
                        "_name": "cartridges",
                        "_parent": "665154c4019e9e7d5ad6d0cc",
                        "_props": {
                            "filters": [
                                {
                                    "Filter": [
                                        "560d5e524bdc2d25448b4571",
                                        "5d6e6772a4b936088465b17c",
                                        "5d6e67fba4b9361bc73bc779",
                                        "5d6e6806a4b936088465b17e",
                                        "5d6e68dea4b9361bcc29e659",
                                        "5d6e6911a4b9361bd5780d52",
                                        "5c0d591486f7744c505b416f",
                                        "58820d1224597753c90aeb13",
                                        "5d6e68c4a4b9361b93413f79",
                                        "5d6e68a8a4b9360b6c0d54e2",
                                        "5d6e68e6a4b9361c140bcfe0",
                                        "5d6e6869a4b9361c140bcfde",
                                        "5d6e68b3a4b9361bca7e50b5",
                                        "5d6e6891a4b9361bd473feea",
                                        "5d6e689ca4b9361bc8618956",
                                        "5d6e68d1a4b93622fe60e845",
                                        "64b8ee384b75259c590fa89b"
                                    ]
                                }
                            ]
                        },
                        "_proto": "5748538b2459770af276a261"
                    }
                ],
                Ergonomics: -8,
                Weight: 0.08,
                ExamineExperience: 4,
                ExaminedByDefault: false,
                Name: "mod_magazine_ksg_12g_tube_cap",
                ShortName: "mod_magazine_ksg_12g_tube_cap",
                Description: "mod_magazine_ksg_12g_tube_cap",
                Width: 1,
                ExtraSizeLeft: 0,
                Prefab: {
                    path: "ksg12/mod_magazine_ksg_12g_tube_cap.bundle",
                    rcid: ""
                }
            },
            parentId: "5448bc234bdc2d3c308b4569",
            newId: WeaponIds.KSG12_MAG,
            handbookParentId: "5b5f754a86f774094242f19b",
            handbookPriceRoubles: 2644,
            fleaPriceRoubles: 3874,
            locales: {
                "en": {
                    name: "Kel-Tec KSG-12g 14-round Mag Cap",
                    shortName: "KSG-12",
                    description: "14-Round standard magazine cap for the KSG-12."
                }
            }
        };
        customitem.createItemFromClone(ksg_cap);
        // MASTERY AND TRADER
        const ksg_mastery = {
            "Name": "Kel-Tec KSG-12",
            "Templates": [
                WeaponIds.KSG12
            ],
            "Level2": 500,
            "Level3": 960
        };
        globals.config.Mastering.push(ksg_mastery);
        for (const lang in db.locales.global) {
            db.locales.global[lang]["66cf2968f9beb45c3d12d323"] = "Lucky Shooter";
            db.locales.global[lang]["66cf290ff22275c4f39ccecc"] = "CQB";
        }
        for (const itemPreset in global_item_preset_json_1.default.ItemPresets) {
            globals.ItemPresets[itemPreset] = global_item_preset_json_1.default.ItemPresets[itemPreset];
        }
        //trader push
        PK.items.push(...Item_Preset_json_1.default.items);
        for (const bsc in Item_Preset_json_1.default.barter_scheme) {
            PK.barter_scheme[bsc] = Item_Preset_json_1.default.barter_scheme[bsc];
        }
        for (const llv in Item_Preset_json_1.default.loyal_level_items) {
            PK.loyal_level_items[llv] = Item_Preset_json_1.default.loyal_level_items[llv];
        }
        //push loot
        const weaponcrateloot = {
            "tpl": WeaponIds.KSG12,
            "relativeProbability": 17
        };
        const locations = db.locations;
        /* locations.rezervbase.looseLoot.spawnpoints.push(...spawnPoints.spawnsRezerv);
        locations.woods.looseLoot.spawnpoints.push(...spawnPoints.spawnsWoods);
        locations.factory4_day.looseLoot.spawnpoints.push(...spawnPoints.spawnsFactory);
        locations.factory4_night.looseLoot.spawnpoints.push(...spawnPoints.spawnsFactory); */
        for (const locationKey in locations) {
            const location = locations[locationKey];
            if (!location || !location.staticLoot) {
                continue;
            }
            location.staticLoot[ItemTpl_1.ItemTpl.LOOTCONTAINER_WEAPON_BOX_5X5]?.itemDistribution.push(weaponcrateloot);
            location.staticLoot[ItemTpl_1.ItemTpl.LOOTCONTAINER_WEAPON_BOX_6X3]?.itemDistribution.push(weaponcrateloot);
            location.staticLoot[ItemTpl_1.ItemTpl.LOOTCONTAINER_WEAPON_BOX_5X2]?.itemDistribution.push(weaponcrateloot);
        }
        const pipe = db.bots.types["followerbigpipe"];
        pipe.inventory.equipment.SecondPrimaryWeapon[WeaponIds.KSG12] = 825;
        pipe.inventory.mods[WeaponIds.KSG12] =
            {
                mod_magazine: [
                    WeaponIds.KSG12_MAG
                ],
                mod_sight_rear: [
                    "5bc09a18d4351e003562b68e"
                ],
                mod_sight_front: [
                    "5bc09a30d4351e00367fb7c8"
                ],
                mod_scope: [
                    "58491f3324597764bc48fa02"
                ],
                mod_foregrip: [
                    "5c87ca002e221600114cb150"
                ]
            };
        customitem.addCustomWeaponToPMCs(WeaponIds.KSG12, 12, "FirstPrimaryWeapon");
        //ON GOD WACKY AHH ID INVENTORY THING
        db.templates.items["55d7217a4bdc2d86028b456d"]._props.Slots[0]._props.filters[0].Filter.push(WeaponIds.KSG12);
        db.templates.items["55d7217a4bdc2d86028b456d"]._props.Slots[1]._props.filters[0].Filter.push(WeaponIds.KSG12);
    }
}
exports.mod = new Mod();
//# sourceMappingURL=mod.js.map