#include "basicdefines_A3.hpp"

class CfgPatches
{
    class AMF_PGM_ULTIMA_RATIO
    {
        units[] = {};
        weapons[] =
        {
                "braf_pgm_ultimaratio"
        };
        requiredVersion = 0.1;
        requiredAddons[] =
        {
                "A3_Weapons_F",
                "cba_main",
                "A3_Anims_F",
        };
    };
};

class Extended_PreInit_EventHandlers
{
    bg_wepframework_init = "call ('\braf\braf_weapons_sniper_rifles\762mm_PGM_Ultima_Ratio\XEH_INIT.sqf' call SLX_XEH_COMPILE)";
};

class Extended_FiredBIS_Eventhandlers
{
    class CAManBase
    {
        bg_wepframe_fired = "_this call bg_wepframe_fired_eh";
    };
};

class Mode_SemiAuto;
class MuzzleSlot;
class CowsSlot;
class PointerSlot;
class UnderBarrelSlot;

class CfgWeapons
{
    class Rifle_Base_F;
    class Rifle_Long_Base_F : Rifle_Base_F
    {
        class WeaponSlotsInfo;
        class GunParticles;
    };
    class braf_pgm_ultimaratio : Rifle_Long_Base_F
    {
        ACE_barrelTwist = 290;
        ACE_barrelLength = 550;
        author = "Wisexe & AMF Team";
        scope = 2;
        _generalMacro = "AMF_PGM_ULTIMA_RATIO_01_F";
        model = "\braf\braf_weapons_sniper_rifles\762mm_PGM_Ultima_Ratio\PGM_UltimaRatio.p3d";
        displayName = "PGM Ultima Ratio";
        picture = "\braf\braf_weapons_sniper_rifles\762mm_PGM_Ultima_Ratio\Data\UI\AMF_PGM_ULTIMA_RATIO_GEAR.paa";
        deployedPivot = "bipod";                                                                  /// what point should be used to be on surface while unfolded
        //soundBipodDown[] = {"A3\Sounds_F_Mark\arsenal\sfx\bipods\Bipod_BLU_down", db - 3, 1, 20}; /// what sound should be played during unfolding
        //soundBipodUp[] = {"A3\Sounds_F_Mark\arsenal\sfx\bipods\Bipod_BLU_up", db - 3, 1, 20};     /// what sound should be played during folding
        magazines[] =
            {
                "10Rnd_762x51_Mag",
            };
        cursor = "srifle";
        class Library
        {
            libTextDesc = "PGM ultima Ratio";
        };
        inertia = 1.2;
        dexterity = 1.0;
        reloadAction = "GestureReloadLRR";
        recoil = "recoil_dmr_02";
        maxZeroing = 2000;
        descriptionShort = "AMF PGM ULTIMA RATIO";
        class ItemInfo
        {
            priority = 1;
        };
        class bg_weaponparameters
        {
            class onFired_Action
            {
                HandAction = "AMF_PGM_ULTIMA_RATIO_Gesture_Rechamber";
                Actiondelay = 0.02;
                Sound = "AMF_PGM_ULTIMA_RATIO_BOLT_SOUND";
                Sound_Location = "RightHandMiddle1";
                hasOptic = 0;
            };
        };
        handAnim[] =
            {
                "OFP2_ManSkeleton",
                "\braf\braf_weapons_anim\animations\762mm_PGM_UltimaRatio\AMF_PGM_ULTIMA_RATIO.rtm",
            };
        opticsPPEffects[] = {};
        opticsFlare = 1;
        opticsDisablePeripherialVision = 1;
        class GunParticles
        {
            class FirstEffect
            {
                effectName = "SniperCloud";
                positionName = "Usti hlavne";
                directionName = "Konec hlavne";
            };
        };
        distanceZoomMin = 500;
        distanceZoomMax = 500;
        modes[] = {"Single", "single_close_optics1", "single_medium_optics1", "single_far_optics1"};
        reloadMagazineSound[] = {"A3\Sounds_F\arsenal\weapons\LongRangeRifles\M320\M320_reload", 2, 1, 10};
        drySound[] = {"A3\Sounds_F\arsenal\weapons\LongRangeRifles\M320\M320_dry", 1.5011872, 1, 20};
        class Single : Mode_SemiAuto
        {
            sounds[] = {"StandardSound"};
            class BaseSoundModeType
            {
                closure1[] = {"\braf\braf_weapons_sound\weapons\PGM_UltimaRatio\AMF_PGM_ULTIMA_RATIO.wss", 1.0, 1, 30};
                closure2[] = {"\braf\braf_weapons_sound\weapons\PGM_UltimaRatio\AMF_PGM_ULTIMA_RATIO.wss", 1.0, 1, 30};
                soundClosure[] = {"closure1", 0.5, "closure2", 0.5};
            };
            class StandardSound : BaseSoundModeType
            {
                begin1[] = {"\braf\braf_weapons_sound\weapons\PGM_UltimaRatio\AMF_PGM_ULTIMA_RATIO.wss", 3.0118723, 1, 2200};
                begin2[] = {"\braf\braf_weapons_sound\weapons\PGM_UltimaRatio\AMF_PGM_ULTIMA_RATIO.wss", 3.0118723, 1, 2200};
                begin3[] = {"\braf\braf_weapons_sound\weapons\PGM_UltimaRatio\AMF_PGM_ULTIMA_RATIO.wss", 3.0118723, 1, 2200};
                soundBegin[] = {"begin1", 0.33, "begin2", 0.33, "begin2", 0.34};
                class SoundTails
                {
                    class TailInterior
                    {
                        sound[] = {"A3\Sounds_F_Mark\arsenal\weapons\LongRangeRifles\DMR_02_MAR10\DMR_02_tail_interior", 2.2387211, 1, 2200};
                        frequency = 1;
                        volume = "interior";
                    };
                    class TailTrees
                    {
                        sound[] = {"A3\Sounds_F_Mark\arsenal\weapons\LongRangeRifles\DMR_02_MAR10\DMR_02_tail_trees", 2.2387211, 1, 2200};
                        frequency = 1;
                        volume = "(1-interior/1.4)*trees";
                    };
                    class TailForest
                    {
                        sound[] = {"A3\Sounds_F_Mark\arsenal\weapons\LongRangeRifles\DMR_02_MAR10\DMR_02_tail_forest", 2.2387211, 1, 2200};
                        frequency = 1;
                        volume = "(1-interior/1.4)*forest";
                    };
                    class TailMeadows
                    {
                        sound[] = {"A3\Sounds_F_Mark\arsenal\weapons\LongRangeRifles\DMR_02_MAR10\DMR_02_tail_meadows", 2.2387211, 1, 2200};
                        frequency = 1;
                        volume = "(1-interior/1.4)*(meadows/2 max sea/2)";
                    };
                    class TailHouses
                    {
                        sound[] = {"A3\Sounds_F_Mark\arsenal\weapons\LongRangeRifles\DMR_02_MAR10\DMR_02_tail_houses", 2.2387211, 1, 2200};
                        frequency = 1;
                        volume = "(1-interior/1.4)*houses";
                    };
                };
            };

            reloadTime = 2;
            dispersion = 0.00011;
            recoil = "recoil_single_dmr";
            recoilProne = "recoil_single_prone_dmr";
            minRange = 2;
            minRangeProbab = 0.3;
            midRange = 350;
            midRangeProbab = 0.7;
            maxRange = 500;
            maxRangeProbab = 0.05;
        };

        class WeaponSlotsInfo : WeaponSlotsInfo
        {
            mass = 160;
            class MuzzleSlot : MuzzleSlot
            {
                linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE";        /// this can be set, but having some common helps a bit
                compatibleItems[] = {};                                      /// A custom made suppressor for this weapon
                iconPosition[] = {0.0, 0.45};                                /// position of the slot icon inside of the weapon icon, relative to top-left corner in {right, down} format
                iconScale = 0.2;                                             /// scale of icon described in iconPicture
                iconPicture = "\A3\Weapons_F\Data\UI\attachment_muzzle.paa"; /// icon for selected slot
                iconPinpoint = "Center";                                     /// top, bottom, left, right, center alignment of the icon on snap point
            };
            class CowsSlot : CowsSlot /// default accessories for this slot
            {
                iconPosition[] = {0.5, 0.35};
                iconScale = 0.2;
            };
            class PointerSlot : PointerSlot /// default accessories for this slot
            {
                compatibleItems[] = {};
                iconPosition[] = {0.20, 0.45};
                iconScale = 0.25;
            };

            class UnderBarrelSlot : UnderBarrelSlot /// using AMF bipod
            {
                iconPosition[] = {0.2, 0.7};
                iconScale = 0.2;
                compatibleItems[] = {"bipod_01_F_blk", "bipod_02_F_blk", "bipod_03_F_blk", "bipod_01_F_khk", "bipod_01_F_snd", "bipod_01_F_mtp", "bipod_02_F_tan", "bipod_02_F_hex", "bipod_03_F_oli"};
            };
        };

        class single_close_optics1 : Single
        {
            requiredOpticType = 1;
            showToPlayer = 0;
            minRange = 2;
            minRangeProbab = 0.05;
            midRange = 300;
            midRangeProbab = 0.8;
            maxRange = 500;
            maxRangeProbab = 0.01;
            aiRateOfFire = 2;
            aiRateOfFireDistance = 300;
        };
        class single_medium_optics1 : single_close_optics1
        {
            minRange = 300;
            minRangeProbab = 0.05;
            midRange = 500;
            midRangeProbab = 0.7;
            maxRange = 700;
            maxRangeProbab = 0.05;
            aiRateOfFire = 2;
            aiRateOfFireDistance = 500;
        };
        class single_far_optics1 : single_medium_optics1
        {
            requiredOpticType = 2;
            minRange = 300;
            minRangeProbab = 0.05;
            midRange = 700;
            midRangeProbab = 0.5;
            maxRange = 1000;
            maxRangeProbab = 0.05;
            aiRateOfFire = 4;
            aiRateOfFireDistance = 600;
        };
        aiDispersionCoefY = 3;
        aiDispersionCoefX = 2;
    };
};
