From 628d33984d9228f1781d13a65fbb80f35facc899 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:55:24 +0300 Subject: init --- Client/Action/Action_Build.sqf | 1 + Client/Action/Action_BuildRepair.sqf | 1 + Client/Action/Action_EjectCargo.sqf | 23 + Client/Action/Action_HALO.sqf | 9 + Client/Action/Action_Menu.sqf | 1 + Client/Action/Action_Push.sqf | 8 + Client/Action/Action_RepairMHQ.sqf | 29 + Client/Action/Action_TaxiReverse.sqf | 8 + Client/Action/Action_ToggleLock.sqf | 7 + Client/Action/Action_ToggleMHQLock.sqf | 9 + Client/Client_EndGame.sqf | 67 + Client/Client_Killed.sqf | 55 + Client/FSM/conquest_helper.fsm | 148 ++ Client/FSM/fasttimecli.fsm | 171 +++ Client/FSM/overcast.fsm | 177 +++ Client/FSM/resources_cli.fsm | 111 ++ Client/FSM/updateactions.fsm | 138 ++ Client/FSM/updateavailableactions.fsm | 268 ++++ Client/FSM/updatecapture.fsm | 262 ++++ Client/FSM/updateclient.fsm | 175 +++ Client/FSM/updatesalvage.fsm | 165 +++ Client/FSM/updatesupply.fsm | 213 +++ Client/FSM/updateteamsmarkers.fsm | 125 ++ Client/FSM/updatetownmarkers.fsm | 112 ++ Client/Functions/Client_BuildUnit.sqf | 240 ++++ Client/Functions/Client_ChangePlayerFunds.sqf | 1 + Client/Functions/Client_CommandChatMessage.sqf | 1 + Client/Functions/Client_CommanderUpgrade.sqf | 34 + Client/Functions/Client_DebugHint.sqf | 8 + Client/Functions/Client_DisplayInventory.sqf | 98 ++ Client/Functions/Client_EquipDefaultLoadout.sqf | 17 + Client/Functions/Client_FX.sqf | 50 + Client/Functions/Client_GetIncome.sqf | 33 + Client/Functions/Client_GetMarkerColoration.sqf | 1 + Client/Functions/Client_GetPlayerFunds.sqf | 1 + Client/Functions/Client_GetRespawnAvailable.sqf | 58 + .../Functions/Client_GetStructureMarkerLabel.sqf | 16 + Client/Functions/Client_GetTime.sqf | 1 + Client/Functions/Client_GroupChatMessage.sqf | 1 + Client/Functions/Client_HandleHQAction.sqf | 12 + Client/Functions/Client_HandleOnMap.sqf | 17 + Client/Functions/Client_HandlePVF.sqf | 30 + Client/Functions/Client_InitTownsAndCamps.sqf | 40 + Client/Functions/Client_IsOnMap.sqf | 17 + Client/Functions/Client_MarkerAnim.sqf | 45 + Client/Functions/Client_OnRespawnHandler.sqf | 78 ++ Client/Functions/Client_PreRespawnHandler.sqf | 15 + Client/Functions/Client_ReplaceArray.sqf | 12 + Client/Functions/Client_ReplaceInventoryAmmo.sqf | 65 + Client/Functions/Client_RequestFireMission.sqf | 25 + Client/Functions/Client_RespawnBag.sqf | 33 + Client/Functions/Client_ReturnArraySortAsc.sqf | 30 + Client/Functions/Client_SetControlFadeAnim.sqf | 28 + Client/Functions/Client_SetControlFadeAnimStop.sqf | 9 + Client/Functions/Client_SetGroupsID.sqf | 13 + Client/Functions/Client_SupportHeal.sqf | 99 ++ Client/Functions/Client_SupportRearm.sqf | 78 ++ Client/Functions/Client_SupportRefuel.sqf | 78 ++ Client/Functions/Client_SupportRepair.sqf | 78 ++ Client/Functions/Client_TaskSystem.sqf | 69 + Client/Functions/Client_TitleTextMessage.sqf | 7 + Client/Functions/Client_UIAddItem.sqf | 11 + Client/Functions/Client_UIAddMagazine.sqf | 35 + Client/Functions/Client_UIChangeComboBuyUnits.sqf | 15 + Client/Functions/Client_UIFillListBuyUnits.sqf | 35 + Client/Functions/Client_UIFillListTeamOrders.sqf | 42 + Client/Functions/Client_UIFindLBValue.sqf | 12 + Client/Functions/Client_UIGearFillList.sqf | 40 + Client/Functions/Client_UIGearFillTemplateList.sqf | 31 + Client/GUI/GUI_ArtilleryMenu.sqf | 649 +++++++++ Client/GUI/GUI_BuyUnits.sqf | 453 +++++++ Client/GUI/GUI_ClearCurrentCutDisplay.sqf | 1 + Client/GUI/GUI_CommandMenu.sqf | 53 + Client/GUI/GUI_CommanderMenu.sqf | 159 +++ Client/GUI/GUI_Display_Parameters.sqf | 30 + Client/GUI/GUI_EASA.sqf | 50 + Client/GUI/GUI_EndOfGameStats.sqf | 184 +++ Client/GUI/GUI_GearAce.sqf | 1415 ++++++++++++++++++++ Client/GUI/GUI_GearBeta.sqf | 1057 +++++++++++++++ Client/GUI/GUI_GearV.sqf | 774 +++++++++++ Client/GUI/GUI_Menu.sqf | 161 +++ Client/GUI/GUI_Menu_BuyUnits.sqf | 466 +++++++ Client/GUI/GUI_Menu_Command.sqf | 532 ++++++++ Client/GUI/GUI_Menu_EASA.sqf | 48 + Client/GUI/GUI_Menu_Economy.sqf | 239 ++++ Client/GUI/GUI_Menu_Respawn.sqf | 161 +++ Client/GUI/GUI_Menu_Service.sqf | 254 ++++ Client/GUI/GUI_Menu_Tactical.sqf | 659 +++++++++ Client/GUI/GUI_Menu_Team.sqf | 145 ++ Client/GUI/GUI_Menu_UnitCamera.sqf | 89 ++ Client/GUI/GUI_Menu_Upgrade.sqf | 223 +++ Client/GUI/GUI_Menu_Voting.sqf | 75 ++ Client/GUI/GUI_MissionTasks.sqf | 65 + Client/GUI/GUI_Parameters.sqf | 23 + Client/GUI/GUI_Respawn.sqf | 156 +++ Client/GUI/GUI_SetCurrentCutDisplay.sqf | 1 + Client/GUI/GUI_SupportMenu.sqf | 271 ++++ Client/GUI/GUI_TeamMenu.sqf | 174 +++ Client/GUI/GUI_TeamOrders.sqf | 571 ++++++++ Client/GUI/GUI_UnitsCamera.sqf | 91 ++ Client/GUI/GUI_UpdateCommanderVoteMenu.sqf | 74 + Client/GUI/GUI_Upgrade.sqf | 198 +++ Client/Images/con_depot.paa | Bin 0 -> 5655 bytes Client/Images/con_task.paa | Bin 0 -> 5655 bytes Client/Images/geariconall.paa | Bin 0 -> 5625 bytes Client/Images/geariconmisc.paa | Bin 0 -> 5625 bytes Client/Images/geariconprimary.paa | Bin 0 -> 5625 bytes Client/Images/geariconsecondary.paa | Bin 0 -> 5625 bytes Client/Images/geariconsidearm.paa | Bin 0 -> 5625 bytes Client/Images/gearicontemplate.paa | Bin 0 -> 5625 bytes Client/Images/i_backpack.paa | Bin 0 -> 1552 bytes Client/Images/i_clear.paa | Bin 0 -> 1552 bytes Client/Images/i_commander.paa | Bin 0 -> 5625 bytes Client/Images/i_driver.paa | Bin 0 -> 5625 bytes Client/Images/i_extra.paa | Bin 0 -> 5625 bytes Client/Images/i_gunner.paa | Bin 0 -> 5625 bytes Client/Images/i_lock.paa | Bin 0 -> 5625 bytes Client/Images/i_reload.paa | Bin 0 -> 1552 bytes Client/Images/icon_wf_building_aa_radar.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_air.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_am_radar.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_barracks.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_cc.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_cc_ca.paa | Bin 0 -> 5655 bytes Client/Images/icon_wf_building_firstaid.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_gear.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_hangar.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_hvs.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_lvs.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_mhq.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_building_repair.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_support_artilery.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_support_cas.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_support_fasttravel.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_support_mortar.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_support_supplydrop.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_support_transport.paa | Bin 0 -> 5625 bytes Client/Images/icon_wf_support_uav.paa | Bin 0 -> 5625 bytes Client/Images/picturepapercar_ca.paa | Bin 0 -> 11081 bytes Client/Images/tog_arty.paa | Bin 0 -> 5655 bytes Client/Images/ui_button_main_down.paa | Bin 0 -> 11918 bytes Client/Images/ui_button_main_focus.paa | Bin 0 -> 6755 bytes Client/Images/ui_button_main_normal.paa | Bin 0 -> 6130 bytes Client/Images/ui_button_main_over.paa | Bin 0 -> 8951 bytes Client/Images/wf_air.paa | Bin 0 -> 2911 bytes Client/Images/wf_amm.paa | Bin 0 -> 2911 bytes Client/Images/wf_art.paa | Bin 0 -> 2911 bytes Client/Images/wf_b.paa | Bin 0 -> 2911 bytes Client/Images/wf_eas.paa | Bin 0 -> 2911 bytes Client/Images/wf_fas.paa | Bin 0 -> 2911 bytes Client/Images/wf_fia.paa | Bin 0 -> 2911 bytes Client/Images/wf_fla.paa | Bin 0 -> 2911 bytes Client/Images/wf_gea.PAA | Bin 0 -> 2911 bytes Client/Images/wf_hvf.paa | Bin 0 -> 2911 bytes Client/Images/wf_lif.paa | Bin 0 -> 2911 bytes Client/Images/wf_lvf.paa | Bin 0 -> 2911 bytes Client/Images/wf_mib.paa | Bin 0 -> 2911 bytes Client/Images/wf_par.paa | Bin 0 -> 2911 bytes Client/Images/wf_pas.paa | Bin 0 -> 2911 bytes Client/Images/wf_shl.paa | Bin 0 -> 2911 bytes Client/Images/wf_sup.paa | Bin 0 -> 2911 bytes Client/Images/wf_uav.paa | Bin 0 -> 2911 bytes Client/Init/Init_BaseStructure.sqf | 34 + Client/Init/Init_Blacklist.sqf | 15 + Client/Init/Init_Client.sqf | 376 ++++++ Client/Init/Init_Coin.sqf | 91 ++ Client/Init/Init_Faction.sqf | 19 + Client/Init/Init_Keybind.sqf | 26 + Client/Module/Arty/ARTY_HandleILLUM.sqf | 26 + Client/Module/Arty/ARTY_HandleSADARM.sqf | 108 ++ Client/Module/Arty/ARTY_mobileMissionFinish.sqf | 12 + Client/Module/Arty/ARTY_mobileMissionPrep.sqf | 10 + Client/Module/CM/CM_Countermeasures.sqf | 22 + Client/Module/CM/CM_Flares.sqf | 46 + Client/Module/CM/CM_Init.sqf | 9 + Client/Module/CM/CM_Spoofing.sqf | 18 + Client/Module/CoIn/coin_interface.sqf | 950 +++++++++++++ Client/Module/EASA/EASA_Equip.sqf | 45 + Client/Module/EASA/EASA_Init.sqf | 378 ++++++ Client/Module/EASA/EASA_RemoveLoadout.sqf | 13 + Client/Module/ISIS/ISIS_Action.sqf | 1 + Client/Module/ISIS/ISIS_Clientfx.sqf | 63 + Client/Module/ISIS/ISIS_Heal.sqf | 76 ++ Client/Module/ISIS/ISIS_Wound.sqf | 62 + Client/Module/ISIS/ISIS_Wounded.sqf | 51 + Client/Module/Nuke/damage.sqf | 30 + Client/Module/Nuke/nuke.sqf | 146 ++ Client/Module/Nuke/nukeincoming.sqf | 59 + Client/Module/Nuke/radzone.sqf | 20 + .../Module/Skill/Actions/Officer_Undeploy_MASH.sqf | 22 + Client/Module/Skill/Skill_Apply.sqf | 66 + Client/Module/Skill/Skill_Engineer.sqf | 32 + Client/Module/Skill/Skill_Init.sqf | 41 + Client/Module/Skill/Skill_Officer.sqf | 32 + Client/Module/Skill/Skill_Sniper.sqf | 31 + Client/Module/Skill/Skill_SpecOps.sqf | 52 + Client/Module/UAV/uav.sqf | 136 ++ Client/Module/UAV/uav_interface.sqf | 304 +++++ Client/Module/UAV/uav_interface_oa.sqf | 162 +++ Client/Module/UAV/uav_spotter.sqf | 28 + Client/Module/ZetaCargo/Zeta_Hook.sqf | 40 + Client/Module/ZetaCargo/Zeta_Init.sqf | 12 + Client/Module/ZetaCargo/Zeta_Unhook.sqf | 21 + Client/PVFunctions/AllCampsCaptured.sqf | 20 + Client/PVFunctions/AwardBounty.sqf | 19 + Client/PVFunctions/CampCaptured.sqf | 42 + Client/PVFunctions/CanJoin.sqf | 7 + Client/PVFunctions/ChangeScore.sqf | 8 + Client/PVFunctions/CommanderVote.sqf | 11 + Client/PVFunctions/DisplayICBM.sqf | 6 + Client/PVFunctions/EndGame.sqf | 9 + Client/PVFunctions/ISIS_AddAction.sqf | 5 + Client/PVFunctions/LocalizeMessage.sqf | 23 + Client/PVFunctions/M_BASE_Attack.sqf | 85 ++ Client/PVFunctions/M_PLAYERS_Attack_Air.sqf | 28 + Client/PVFunctions/M_TOWN_Attack.sqf | 84 ++ Client/PVFunctions/M_UAV_RetrieveModule.sqf | 65 + Client/PVFunctions/Penalty.sqf | 9 + Client/PVFunctions/PerformAction.sqf | 10 + Client/PVFunctions/SetHQStatus.sqf | 5 + Client/PVFunctions/SetTask.sqf | 36 + Client/PVFunctions/SetVehicleLock.sqf | 1 + Client/PVFunctions/TownCaptured.sqf | 98 ++ Client/PVFunctions/TownCapturedPublic.sqf | 96 ++ Client/PVFunctions/UAV_Reveal.sqf | 27 + Client/PVFunctions/VoteForCommander.sqf | 9 + Client/kb/hq.bikb | 190 +++ Client/kb/hq.fsm | 110 ++ Client/kb/hq.sqf | 1 + 229 files changed, 18132 insertions(+) create mode 100644 Client/Action/Action_Build.sqf create mode 100644 Client/Action/Action_BuildRepair.sqf create mode 100644 Client/Action/Action_EjectCargo.sqf create mode 100644 Client/Action/Action_HALO.sqf create mode 100644 Client/Action/Action_Menu.sqf create mode 100644 Client/Action/Action_Push.sqf create mode 100644 Client/Action/Action_RepairMHQ.sqf create mode 100644 Client/Action/Action_TaxiReverse.sqf create mode 100644 Client/Action/Action_ToggleLock.sqf create mode 100644 Client/Action/Action_ToggleMHQLock.sqf create mode 100644 Client/Client_EndGame.sqf create mode 100644 Client/Client_Killed.sqf create mode 100644 Client/FSM/conquest_helper.fsm create mode 100644 Client/FSM/fasttimecli.fsm create mode 100644 Client/FSM/overcast.fsm create mode 100644 Client/FSM/resources_cli.fsm create mode 100644 Client/FSM/updateactions.fsm create mode 100644 Client/FSM/updateavailableactions.fsm create mode 100644 Client/FSM/updatecapture.fsm create mode 100644 Client/FSM/updateclient.fsm create mode 100644 Client/FSM/updatesalvage.fsm create mode 100644 Client/FSM/updatesupply.fsm create mode 100644 Client/FSM/updateteamsmarkers.fsm create mode 100644 Client/FSM/updatetownmarkers.fsm create mode 100644 Client/Functions/Client_BuildUnit.sqf create mode 100644 Client/Functions/Client_ChangePlayerFunds.sqf create mode 100644 Client/Functions/Client_CommandChatMessage.sqf create mode 100644 Client/Functions/Client_CommanderUpgrade.sqf create mode 100644 Client/Functions/Client_DebugHint.sqf create mode 100644 Client/Functions/Client_DisplayInventory.sqf create mode 100644 Client/Functions/Client_EquipDefaultLoadout.sqf create mode 100644 Client/Functions/Client_FX.sqf create mode 100644 Client/Functions/Client_GetIncome.sqf create mode 100644 Client/Functions/Client_GetMarkerColoration.sqf create mode 100644 Client/Functions/Client_GetPlayerFunds.sqf create mode 100644 Client/Functions/Client_GetRespawnAvailable.sqf create mode 100644 Client/Functions/Client_GetStructureMarkerLabel.sqf create mode 100644 Client/Functions/Client_GetTime.sqf create mode 100644 Client/Functions/Client_GroupChatMessage.sqf create mode 100644 Client/Functions/Client_HandleHQAction.sqf create mode 100644 Client/Functions/Client_HandleOnMap.sqf create mode 100644 Client/Functions/Client_HandlePVF.sqf create mode 100644 Client/Functions/Client_InitTownsAndCamps.sqf create mode 100644 Client/Functions/Client_IsOnMap.sqf create mode 100644 Client/Functions/Client_MarkerAnim.sqf create mode 100644 Client/Functions/Client_OnRespawnHandler.sqf create mode 100644 Client/Functions/Client_PreRespawnHandler.sqf create mode 100644 Client/Functions/Client_ReplaceArray.sqf create mode 100644 Client/Functions/Client_ReplaceInventoryAmmo.sqf create mode 100644 Client/Functions/Client_RequestFireMission.sqf create mode 100644 Client/Functions/Client_RespawnBag.sqf create mode 100644 Client/Functions/Client_ReturnArraySortAsc.sqf create mode 100644 Client/Functions/Client_SetControlFadeAnim.sqf create mode 100644 Client/Functions/Client_SetControlFadeAnimStop.sqf create mode 100644 Client/Functions/Client_SetGroupsID.sqf create mode 100644 Client/Functions/Client_SupportHeal.sqf create mode 100644 Client/Functions/Client_SupportRearm.sqf create mode 100644 Client/Functions/Client_SupportRefuel.sqf create mode 100644 Client/Functions/Client_SupportRepair.sqf create mode 100644 Client/Functions/Client_TaskSystem.sqf create mode 100644 Client/Functions/Client_TitleTextMessage.sqf create mode 100644 Client/Functions/Client_UIAddItem.sqf create mode 100644 Client/Functions/Client_UIAddMagazine.sqf create mode 100644 Client/Functions/Client_UIChangeComboBuyUnits.sqf create mode 100644 Client/Functions/Client_UIFillListBuyUnits.sqf create mode 100644 Client/Functions/Client_UIFillListTeamOrders.sqf create mode 100644 Client/Functions/Client_UIFindLBValue.sqf create mode 100644 Client/Functions/Client_UIGearFillList.sqf create mode 100644 Client/Functions/Client_UIGearFillTemplateList.sqf create mode 100644 Client/GUI/GUI_ArtilleryMenu.sqf create mode 100644 Client/GUI/GUI_BuyUnits.sqf create mode 100644 Client/GUI/GUI_ClearCurrentCutDisplay.sqf create mode 100644 Client/GUI/GUI_CommandMenu.sqf create mode 100644 Client/GUI/GUI_CommanderMenu.sqf create mode 100644 Client/GUI/GUI_Display_Parameters.sqf create mode 100644 Client/GUI/GUI_EASA.sqf create mode 100644 Client/GUI/GUI_EndOfGameStats.sqf create mode 100644 Client/GUI/GUI_GearAce.sqf create mode 100644 Client/GUI/GUI_GearBeta.sqf create mode 100644 Client/GUI/GUI_GearV.sqf create mode 100644 Client/GUI/GUI_Menu.sqf create mode 100644 Client/GUI/GUI_Menu_BuyUnits.sqf create mode 100644 Client/GUI/GUI_Menu_Command.sqf create mode 100644 Client/GUI/GUI_Menu_EASA.sqf create mode 100644 Client/GUI/GUI_Menu_Economy.sqf create mode 100644 Client/GUI/GUI_Menu_Respawn.sqf create mode 100644 Client/GUI/GUI_Menu_Service.sqf create mode 100644 Client/GUI/GUI_Menu_Tactical.sqf create mode 100644 Client/GUI/GUI_Menu_Team.sqf create mode 100644 Client/GUI/GUI_Menu_UnitCamera.sqf create mode 100644 Client/GUI/GUI_Menu_Upgrade.sqf create mode 100644 Client/GUI/GUI_Menu_Voting.sqf create mode 100644 Client/GUI/GUI_MissionTasks.sqf create mode 100644 Client/GUI/GUI_Parameters.sqf create mode 100644 Client/GUI/GUI_Respawn.sqf create mode 100644 Client/GUI/GUI_SetCurrentCutDisplay.sqf create mode 100644 Client/GUI/GUI_SupportMenu.sqf create mode 100644 Client/GUI/GUI_TeamMenu.sqf create mode 100644 Client/GUI/GUI_TeamOrders.sqf create mode 100644 Client/GUI/GUI_UnitsCamera.sqf create mode 100644 Client/GUI/GUI_UpdateCommanderVoteMenu.sqf create mode 100644 Client/GUI/GUI_Upgrade.sqf create mode 100644 Client/Images/con_depot.paa create mode 100644 Client/Images/con_task.paa create mode 100644 Client/Images/geariconall.paa create mode 100644 Client/Images/geariconmisc.paa create mode 100644 Client/Images/geariconprimary.paa create mode 100644 Client/Images/geariconsecondary.paa create mode 100644 Client/Images/geariconsidearm.paa create mode 100644 Client/Images/gearicontemplate.paa create mode 100644 Client/Images/i_backpack.paa create mode 100644 Client/Images/i_clear.paa create mode 100644 Client/Images/i_commander.paa create mode 100644 Client/Images/i_driver.paa create mode 100644 Client/Images/i_extra.paa create mode 100644 Client/Images/i_gunner.paa create mode 100644 Client/Images/i_lock.paa create mode 100644 Client/Images/i_reload.paa create mode 100644 Client/Images/icon_wf_building_aa_radar.paa create mode 100644 Client/Images/icon_wf_building_air.paa create mode 100644 Client/Images/icon_wf_building_am_radar.paa create mode 100644 Client/Images/icon_wf_building_barracks.paa create mode 100644 Client/Images/icon_wf_building_cc.paa create mode 100644 Client/Images/icon_wf_building_cc_ca.paa create mode 100644 Client/Images/icon_wf_building_firstaid.paa create mode 100644 Client/Images/icon_wf_building_gear.paa create mode 100644 Client/Images/icon_wf_building_hangar.paa create mode 100644 Client/Images/icon_wf_building_hvs.paa create mode 100644 Client/Images/icon_wf_building_lvs.paa create mode 100644 Client/Images/icon_wf_building_mhq.paa create mode 100644 Client/Images/icon_wf_building_repair.paa create mode 100644 Client/Images/icon_wf_support_artilery.paa create mode 100644 Client/Images/icon_wf_support_cas.paa create mode 100644 Client/Images/icon_wf_support_fasttravel.paa create mode 100644 Client/Images/icon_wf_support_mortar.paa create mode 100644 Client/Images/icon_wf_support_supplydrop.paa create mode 100644 Client/Images/icon_wf_support_transport.paa create mode 100644 Client/Images/icon_wf_support_uav.paa create mode 100644 Client/Images/picturepapercar_ca.paa create mode 100644 Client/Images/tog_arty.paa create mode 100644 Client/Images/ui_button_main_down.paa create mode 100644 Client/Images/ui_button_main_focus.paa create mode 100644 Client/Images/ui_button_main_normal.paa create mode 100644 Client/Images/ui_button_main_over.paa create mode 100644 Client/Images/wf_air.paa create mode 100644 Client/Images/wf_amm.paa create mode 100644 Client/Images/wf_art.paa create mode 100644 Client/Images/wf_b.paa create mode 100644 Client/Images/wf_eas.paa create mode 100644 Client/Images/wf_fas.paa create mode 100644 Client/Images/wf_fia.paa create mode 100644 Client/Images/wf_fla.paa create mode 100644 Client/Images/wf_gea.PAA create mode 100644 Client/Images/wf_hvf.paa create mode 100644 Client/Images/wf_lif.paa create mode 100644 Client/Images/wf_lvf.paa create mode 100644 Client/Images/wf_mib.paa create mode 100644 Client/Images/wf_par.paa create mode 100644 Client/Images/wf_pas.paa create mode 100644 Client/Images/wf_shl.paa create mode 100644 Client/Images/wf_sup.paa create mode 100644 Client/Images/wf_uav.paa create mode 100644 Client/Init/Init_BaseStructure.sqf create mode 100644 Client/Init/Init_Blacklist.sqf create mode 100644 Client/Init/Init_Client.sqf create mode 100644 Client/Init/Init_Coin.sqf create mode 100644 Client/Init/Init_Faction.sqf create mode 100644 Client/Init/Init_Keybind.sqf create mode 100644 Client/Module/Arty/ARTY_HandleILLUM.sqf create mode 100644 Client/Module/Arty/ARTY_HandleSADARM.sqf create mode 100644 Client/Module/Arty/ARTY_mobileMissionFinish.sqf create mode 100644 Client/Module/Arty/ARTY_mobileMissionPrep.sqf create mode 100644 Client/Module/CM/CM_Countermeasures.sqf create mode 100644 Client/Module/CM/CM_Flares.sqf create mode 100644 Client/Module/CM/CM_Init.sqf create mode 100644 Client/Module/CM/CM_Spoofing.sqf create mode 100644 Client/Module/CoIn/coin_interface.sqf create mode 100644 Client/Module/EASA/EASA_Equip.sqf create mode 100644 Client/Module/EASA/EASA_Init.sqf create mode 100644 Client/Module/EASA/EASA_RemoveLoadout.sqf create mode 100644 Client/Module/ISIS/ISIS_Action.sqf create mode 100644 Client/Module/ISIS/ISIS_Clientfx.sqf create mode 100644 Client/Module/ISIS/ISIS_Heal.sqf create mode 100644 Client/Module/ISIS/ISIS_Wound.sqf create mode 100644 Client/Module/ISIS/ISIS_Wounded.sqf create mode 100644 Client/Module/Nuke/damage.sqf create mode 100644 Client/Module/Nuke/nuke.sqf create mode 100644 Client/Module/Nuke/nukeincoming.sqf create mode 100644 Client/Module/Nuke/radzone.sqf create mode 100644 Client/Module/Skill/Actions/Officer_Undeploy_MASH.sqf create mode 100644 Client/Module/Skill/Skill_Apply.sqf create mode 100644 Client/Module/Skill/Skill_Engineer.sqf create mode 100644 Client/Module/Skill/Skill_Init.sqf create mode 100644 Client/Module/Skill/Skill_Officer.sqf create mode 100644 Client/Module/Skill/Skill_Sniper.sqf create mode 100644 Client/Module/Skill/Skill_SpecOps.sqf create mode 100644 Client/Module/UAV/uav.sqf create mode 100644 Client/Module/UAV/uav_interface.sqf create mode 100644 Client/Module/UAV/uav_interface_oa.sqf create mode 100644 Client/Module/UAV/uav_spotter.sqf create mode 100644 Client/Module/ZetaCargo/Zeta_Hook.sqf create mode 100644 Client/Module/ZetaCargo/Zeta_Init.sqf create mode 100644 Client/Module/ZetaCargo/Zeta_Unhook.sqf create mode 100644 Client/PVFunctions/AllCampsCaptured.sqf create mode 100644 Client/PVFunctions/AwardBounty.sqf create mode 100644 Client/PVFunctions/CampCaptured.sqf create mode 100644 Client/PVFunctions/CanJoin.sqf create mode 100644 Client/PVFunctions/ChangeScore.sqf create mode 100644 Client/PVFunctions/CommanderVote.sqf create mode 100644 Client/PVFunctions/DisplayICBM.sqf create mode 100644 Client/PVFunctions/EndGame.sqf create mode 100644 Client/PVFunctions/ISIS_AddAction.sqf create mode 100644 Client/PVFunctions/LocalizeMessage.sqf create mode 100644 Client/PVFunctions/M_BASE_Attack.sqf create mode 100644 Client/PVFunctions/M_PLAYERS_Attack_Air.sqf create mode 100644 Client/PVFunctions/M_TOWN_Attack.sqf create mode 100644 Client/PVFunctions/M_UAV_RetrieveModule.sqf create mode 100644 Client/PVFunctions/Penalty.sqf create mode 100644 Client/PVFunctions/PerformAction.sqf create mode 100644 Client/PVFunctions/SetHQStatus.sqf create mode 100644 Client/PVFunctions/SetTask.sqf create mode 100644 Client/PVFunctions/SetVehicleLock.sqf create mode 100644 Client/PVFunctions/TownCaptured.sqf create mode 100644 Client/PVFunctions/TownCapturedPublic.sqf create mode 100644 Client/PVFunctions/UAV_Reveal.sqf create mode 100644 Client/PVFunctions/VoteForCommander.sqf create mode 100644 Client/kb/hq.bikb create mode 100644 Client/kb/hq.fsm create mode 100644 Client/kb/hq.sqf (limited to 'Client') diff --git a/Client/Action/Action_Build.sqf b/Client/Action/Action_Build.sqf new file mode 100644 index 0000000..e61bb1a --- /dev/null +++ b/Client/Action/Action_Build.sqf @@ -0,0 +1 @@ +[player,player,2,MCoin,getpos player,(sideJoined) Call GetSideHQ] ExecVM "Client\Module\CoIn\coin_interface.sqf"; \ No newline at end of file diff --git a/Client/Action/Action_BuildRepair.sqf b/Client/Action/Action_BuildRepair.sqf new file mode 100644 index 0000000..3437303 --- /dev/null +++ b/Client/Action/Action_BuildRepair.sqf @@ -0,0 +1 @@ +[player,player,2,RCoin,getpos player,_this select 0] ExecVM "Client\Module\CoIn\coin_interface.sqf"; \ No newline at end of file diff --git a/Client/Action/Action_EjectCargo.sqf b/Client/Action/Action_EjectCargo.sqf new file mode 100644 index 0000000..a10bfd1 --- /dev/null +++ b/Client/Action/Action_EjectCargo.sqf @@ -0,0 +1,23 @@ +Private ["_cargo","_vehicle"]; + +_vehicle = _this select 0; + +//--- Get the crew. +_cargo = (crew _vehicle) - [driver _vehicle, gunner _vehicle, commander _vehicle]; + +{ + if (alive _x && _vehicle == vehicle _x) then { + if (local _x) then { + //--- Dealing with a local unit, probably an AI. + unassignVehicle _x; + _x action ["EJECT", _vehicle]; + } else { + //--- Dealing with a player or a non local unit. + if (isPlayer(leader (group _x))) then { + WFBE_PerformAction = [vehicleVarName(leader(group _x)),'CLTFNCPERFORMACTION',[_x, "EJECT", _vehicle]]; + publicVariable 'WFBE_PerformAction'; + }; + }; + }; + sleep 1; +} forEach _cargo; \ No newline at end of file diff --git a/Client/Action/Action_HALO.sqf b/Client/Action/Action_HALO.sqf new file mode 100644 index 0000000..57aacf9 --- /dev/null +++ b/Client/Action/Action_HALO.sqf @@ -0,0 +1,9 @@ +Private ["_act","_caller","_vehicle"]; + +_vehicle = _this select 0; +_caller = _this select 1; +_act = _this select 2; + +_caller action ["EJECT",_vehicle]; +_caller setVelocity [0,0,0]; +[_caller] Exec "ca\air2\Halo\data\Scripts\HALO_getout.sqs"; \ No newline at end of file diff --git a/Client/Action/Action_Menu.sqf b/Client/Action/Action_Menu.sqf new file mode 100644 index 0000000..acb0e60 --- /dev/null +++ b/Client/Action/Action_Menu.sqf @@ -0,0 +1 @@ +createDialog "WF_Menu"; \ No newline at end of file diff --git a/Client/Action/Action_Push.sqf b/Client/Action/Action_Push.sqf new file mode 100644 index 0000000..8d2429c --- /dev/null +++ b/Client/Action/Action_Push.sqf @@ -0,0 +1,8 @@ +Private ["_dir","_speed","_vehicle","_vel"]; + +_vehicle = _this select 0; + +_vel = velocity _vehicle; +_dir = direction _vehicle; +_speed = 10; +_vehicle setVelocity [(_vel select 0)+((sin _dir)*_speed),(_vel select 1)+((cos _dir)*_speed),(_vel select 2)]; \ No newline at end of file diff --git a/Client/Action/Action_RepairMHQ.sqf b/Client/Action/Action_RepairMHQ.sqf new file mode 100644 index 0000000..4a7eddc --- /dev/null +++ b/Client/Action/Action_RepairMHQ.sqf @@ -0,0 +1,29 @@ +Private ["_currency","_currencySym","_hq","_isBeingFixed","_repairPrice","_vehicle"]; + +_vehicle = _this select 0; + +_hq = (sideJoinedText) Call GetSideHQ; +if (alive _hq || (_hq distance _vehicle > 30)) exitWith {hint (localize "STR_WF_INFO_Repair_MHQ_None")}; + +//--- Is HQ already being fixed? +_isBeingFixed = WF_Logic getVariable Format ["%1MHQRepair",sideJoinedText]; +if (_isBeingFixed) exitWith {hint (localize "STR_WF_INFO_Repair_MHQ_BeingRepaired")}; + +_repairPrice = 'WFBE_MHQREPAIRPRICE' Call GetNamespace; +_currency = if !(paramMoneyOnly) then {(sideJoined) Call GetSideSupply} else {Call GetPlayerFunds}; +_currencySym = if !(paramMoneyOnly) then {"S"} else {"$"}; +if (_currency < _repairPrice) exitWith {hint Format [localize "STR_WF_INFO_Repair_MHQ_Funds",_currencySym,_repairPrice - _currency]}; + +if !(paramMoneyOnly) then { + [sideJoined,-_repairPrice] Call ChangeSideSupply; +} else { + -(_repairPrice) Call ChangePlayerFunds; +}; + +WFBE_RequestMHQRepair = ['SRVFNCREQUESTMHQREPAIR',sideJoined]; +publicVariable 'WFBE_RequestMHQRepair'; +if (isHostedServer) then {['SRVFNCREQUESTMHQREPAIR',sideJoined] Spawn HandleSPVF}; + +WF_Logic setVariable [Format ["%1MHQRepair",sideJoinedText],true,true]; + +hint (localize "STR_WF_INFO_Repair_MHQ_Repair"); \ No newline at end of file diff --git a/Client/Action/Action_TaxiReverse.sqf b/Client/Action/Action_TaxiReverse.sqf new file mode 100644 index 0000000..6b1b8b5 --- /dev/null +++ b/Client/Action/Action_TaxiReverse.sqf @@ -0,0 +1,8 @@ +Private ["_dir","_speed","_vehicle","_vel"]; + +_vehicle = _this select 0; + +_vel = velocity _vehicle; +_dir = direction _vehicle; +_speed = -5; +_vehicle setVelocity [(_vel select 0)+((sin _dir)*_speed),(_vel select 1)+((cos _dir)*_speed),(_vel select 2)]; \ No newline at end of file diff --git a/Client/Action/Action_ToggleLock.sqf b/Client/Action/Action_ToggleLock.sqf new file mode 100644 index 0000000..e0a5add --- /dev/null +++ b/Client/Action/Action_ToggleLock.sqf @@ -0,0 +1,7 @@ +Private ["_lock","_vehicle"]; + +_vehicle = _this select 0; + +_lock = if (locked _vehicle) then {false} else {true}; + +[_vehicle,_lock] Call CLTFNCSetVehicleLock; \ No newline at end of file diff --git a/Client/Action/Action_ToggleMHQLock.sqf b/Client/Action/Action_ToggleMHQLock.sqf new file mode 100644 index 0000000..3edb19a --- /dev/null +++ b/Client/Action/Action_ToggleMHQLock.sqf @@ -0,0 +1,9 @@ +Private ["_lock","_MHQ"]; + +_MHQ = _this select 0; + +_lock = if (locked _MHQ) then {false} else {true}; + +WFBE_RequestVehicleLock = ['SRVFNCREQUESTVEHICLELOCK',[_MHQ,_lock]]; +publicVariable 'WFBE_RequestVehicleLock'; +if (isHostedServer) then {['SRVFNCREQUESTVEHICLELOCK',[_MHQ,_lock]] Spawn HandleSPVF}; diff --git a/Client/Client_EndGame.sqf b/Client/Client_EndGame.sqf new file mode 100644 index 0000000..e6ccb0f --- /dev/null +++ b/Client/Client_EndGame.sqf @@ -0,0 +1,67 @@ +Private ['_HQ','_base','_blist','_camShotOrder','_camera','_nvgstate','_position','_secTarget','_side','_track','_vehi']; + +_side = _this select 0; +_blist = _this select 1; + +[_side] ExecVM "Client\GUI\GUI_EndOfGameStats.sqf"; +//_track = if (WF_A2_Vanilla) then {"Track21_Rise_Of_The_Fallen"} else {"EP1_Track15"}; //---old +_track = if (WF_A2_Vanilla) then {["Track21_Rise_Of_The_Fallen",41]} else {["EP1_Track13",91]}; //---changed-MrNiceGuy +playMusic _track; +_base = WestMHQ; +_secTarget = EastMHQ; +if (_side == West) then {_base = EastMHQ;_secTarget = WestMHQ}; +_position = getPos _base; + +_blist = [_secTarget,_blist] Call SortByDistance; +_blist = [_secTarget] + _blist; + +//--- Safety Pos. +_HQ = (sideJoinedText) Call GetSideHQ; +_vehi = vehicle player; +if (_vehi != player) then {player action ["EJECT", _vehi];_vehi = player}; +_vehi setVelocity [0,0,-0.1]; +_vehi setPos ([getPos _HQ,20,30] Call GetRandomPosition); + +if (!isNil "DeathCamera") then { + DeathCamera cameraEffect["TERMINATE","BACK"]; + camDestroy DeathCamera; + "colorCorrections" ppEffectEnable false; + "dynamicBlur" ppEffectEnable false; +}; + +_camera = "camera" camCreate _position; +_camera camSetDir 0; +_camera camSetFov 0.200; +_camera cameraEffect["Internal","back"]; +_camera camSetTarget getPos _base; +_camera camSetRelPos [160.80,130.29,140.07]; +_camera camCommit 0; +_nvgstate = if (daytime > 18.5 || daytime < 5.5) then {true} else {false}; +camUseNVG _nvgstate; + +waitUntil {camCommitted _camera}; + +_camera camSetRelPos [-190.71,190.55,180.94]; +_camera camCommit 10; + +waitUntil {camCommitted _camera}; + +_camShotOrder = [[0,100,35],[50,0,20],[0,-50,20],[-50,0,20]]; + +{ + _camera camSetPos getPos _x; + _camera camSetTarget getPos _x; + + { + _camera camSetRelPos _x; + _camera camCommit 5; + waitUntil {camCommitted _camera}; + } forEach _camShotOrder; + + _camera camSetRelPos [0,100,35]; + _camera camCommit 5; + waitUntil {camCommitted _camera}; +} forEach _blist; + +sleep 3; +failMission "END1"; \ No newline at end of file diff --git a/Client/Client_Killed.sqf b/Client/Client_Killed.sqf new file mode 100644 index 0000000..ac723b7 --- /dev/null +++ b/Client/Client_Killed.sqf @@ -0,0 +1,55 @@ +/* Player KEH. */ + + +private ["_isInertObject","_killer","_isTKFriendly"]; +if (playerDead) exitWith {}; +playerDead = true; + +{player removeAction 0} forEach [0,1,2,3,4,5]; +if !(isNil "HQAction") then {player removeAction HQAction}; +player removeAction Options; + +deathLocation = getPos player; + +if (mysql) then { + Private ['_isInertObject','_isTKFriendly','_killer']; + _killer = _this select 1; + _isTKFriendly = if (side _killer == sideJoined && !isPlayer(_killer)) then {true} else {false}; + _isInertObject = false; + if (vehicle _killer == _killer) then { + _isInertObject = if (count(crew _killer) == 0) then {true} else {false}; + }; + + if (_this select 0 == _killer || _isTKFriendly || _isInertObject) then { + WF_Logic setVariable ["WF_MYSQL_CLIENT",(WF_Logic getVariable "WF_MYSQL_CLIENT") + [Format ["MYSQLDATA_WFBE_Update%1%2suicide%3",getPlayerUID(player),name player,worldName]],true]; + }; +}; + +closeDialog 0; + +sleep 0.11; + +"dynamicBlur" ppEffectEnable true; +"dynamicBlur" ppEffectAdjust [1]; +"dynamicBlur" ppEffectCommit 0.1; +"colorCorrections" ppEffectAdjust [1, 1, 0, [0.1, 0.0, 0.0, 1], [1.0, 0.5, 0.5, 0.1], [0.199, 0.587, 0.114, 0.0]]; +"colorCorrections" ppEffectCommit 0.1; +"colorCorrections" ppEffectEnable true; +"colorCorrections" ppEffectAdjust [1, 1, 0, [0.1, 0.0, 0.0, 0.5], [1.0, 0.5, 0.5, 0.1], [0.199, 0.587, 0.114, 0.0]]; +"colorCorrections" ppEffectCommit 0.3; + +DeathCamera = "camera" camCreate deathLocation; +DeathCamera camSetDir 0; +DeathCamera camSetFov 1; +DeathCamera cameraEffect["Internal","TOP"]; + +DeathCamera camSetTarget deathLocation; +DeathCamera camSetPos [deathLocation select 0,(deathLocation select 1) + 2,5]; +DeathCamera camCommit 0; + +waitUntil {camCommitted DeathCamera}; + +DeathCamera camSetPos [deathLocation select 0,(deathLocation select 1) + 2,30]; +DeathCamera camCommit ('WFBE_RESPAWNDELAY' Call GetNamespace)+2; + +createDialog "RscMenu_Respawn"; \ No newline at end of file diff --git a/Client/FSM/conquest_helper.fsm b/Client/FSM/conquest_helper.fsm new file mode 100644 index 0000000..fab822e --- /dev/null +++ b/Client/FSM/conquest_helper.fsm @@ -0,0 +1,148 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,4346,53.240814,-221.988968,143.240845,-171.989166,0.000000,"Init"}; +item1[] = {"End",1,250,-216.387955,-52.508366,-126.387947,-2.508394,0.000000,"End"}; +item2[] = {"Update_Conquest",2,250,-82.090652,-139.314026,7.909359,-89.314034,0.000000,"Update" \n "Conquest"}; +item3[] = {"Loop",4,218,53.846153,-139.681244,143.846161,-89.681236,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.387955,-139.464890,-126.387947,-89.464890,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {2,3}; +link2[] = {2,4}; +link3[] = {3,2}; +link4[] = {4,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,8,6316128,1,-348.696411,348.696136,79.849762,-328.514618,921,592,1}; +window[] = {0,-1,-1,-1,-1,837,100,1513,100,1,939}; +*//*%FSM*/ +class FSM +{ + fsmName = "conquest_helper"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_ntime = 0;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Conquest"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time > _ntime"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Conquest + { + name = "Update_Conquest"; + init = /*%FSM*/"_t = [];" \n + "" \n + "{" \n + " if ((_x getVariable 'sideID') == sideID) then {_t = _t + [_x]};" \n + "} forEach towns;" \n + "" \n + "_set = [];" \n + "" \n + "if (count _t > 0) then {" \n + " {" \n + " _neighbors = _x getVariable ""neighbors"";" \n + " " \n + " if !(isNil ""_neighbors"") then {" \n + " {" \n + " if ((_x getVariable 'sideID') != sideID) then {" \n + " if (isNil {_x getVariable ""wfbe_marker""}) then {" \n + " _marker = Format [""wfbe_conquest_%1"", buildingMarker];" \n + " buildingMarker = buildingMarker + 1;" \n + " _x setVariable ['wfbe_marker', _marker];" \n + " createMarkerLocal [_marker, getPos _x];" \n + " _marker setMarkerColorLocal ""ColorOrange"";" \n + " _marker setMarkerShapeLocal ""ELLIPSE"";" \n + " _marker setMarkerAlphaLocal 0.4;" \n + " _marker setMarkerBrushLocal ""SOLID"";" \n + " _marker setMarkerSizeLocal [300,300];" \n + " };" \n + " if !(_x in _set) then {_set = _set + [_x]};" \n + " };" \n + " } forEach _neighbors;" \n + " };" \n + " } forEach _t;" \n + "} else {" \n + " _hq = (sideJoined) Call GetSideHQ;" \n + " _nearest = ([_hq, towns] Call SortByDistance) select 0;" \n + " if (isNil {_nearest getVariable ""wfbe_marker""}) then {" \n + " _marker = Format [""wfbe_conquest_%1"", buildingMarker];" \n + " buildingMarker = buildingMarker + 1;" \n + " _nearest setVariable ['wfbe_marker', _marker];" \n + " createMarkerLocal [_marker, getPos _nearest];" \n + " _marker setMarkerColorLocal ""ColorOrange"";" \n + " _marker setMarkerShapeLocal ""ELLIPSE"";" \n + " _marker setMarkerAlphaLocal 0.4;" \n + " _marker setMarkerBrushLocal ""SOLID"";" \n + " _marker setMarkerSizeLocal [300,300];" \n + " };" \n + " _set = [_nearest];" \n + "};" \n + "" \n + "_set = towns - _set;" \n + "{" \n + " if !(isNil {_x getVariable ""wfbe_marker""}) then {" \n + " deleteMarkerLocal (_x getVariable ""wfbe_marker"");" \n + " _x setVariable [""wfbe_marker"", nil];" \n + " };" \n + "} forEach _set;" \n + "" \n + "_ntime = time + 10;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Conquest"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time > _ntime"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End", + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/fasttimecli.fsm b/Client/FSM/fasttimecli.fsm new file mode 100644 index 0000000..870b433 --- /dev/null +++ b/Client/FSM/fasttimecli.fsm @@ -0,0 +1,171 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.063538,-295.568512,25.936447,-245.568604,0.000000,"Init"}; +item1[] = {"Update_Time",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Time"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +item5[] = {"Wait_for_Init",4,218,65.886307,-194.314407,155.886276,-144.314407,0.000000,"Wait for Init"}; +item6[] = {"Advanced_Init",2,250,-63.879562,-194.314392,26.121157,-144.314392,0.000000,"Advanced Init"}; +item7[] = {"_",8,218,-34.448154,-230.434799,-2.642141,-207.859543,0.000000,""}; +item8[] = {"Init_Done",2,4346,191.498337,-194.033432,281.498260,-144.033432,0.000000,"Init Done"}; +item9[] = {"Init_Done",4,218,-63.535187,-123.100403,26.464882,-73.100349,0.000000,"Init Done"}; +item10[] = {"",7,210,233.129700,-102.521011,241.129700,-94.521011,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +link5[] = {5,8}; +link6[] = {6,5}; +link7[] = {6,9}; +link8[] = {7,6}; +link9[] = {8,5}; +link10[] = {8,10}; +link11[] = {9,1}; +link12[] = {10,9}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-395.307037,395.306915,79.046959,-351.956635,897,489,1}; +window[] = {0,-1,-1,-1,-1,734,100,1360,100,1,915}; +*//*%FSM*/ +class FSM +{ + fsmName = "fasttime"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_currentTime = 0;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Advanced_Init"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Time + { + name = "Update_Time"; + init = /*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"";" \n + "SkipTime (_currentTime - DayTime);" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Advanced_Init + { + name = "Advanced_Init"; + init = /*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Init_Done + { + priority = 0.000000; + to="Update_Time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isNil ""_currentTime"""/*%FSM*/; + action=/*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Wait_for_Init + { + priority = 0.000000; + to="Init_Done"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNil ""_currentTime"""/*%FSM*/; + action=/*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Init_Done + { + name = "Init_Done"; + init = /*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"";"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Init_Done + { + priority = 0.000000; + to="Update_Time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isNil ""_currentTime"""/*%FSM*/; + action=/*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Wait_for_Init + { + priority = 0.000000; + to="Init_Done"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNil ""_currentTime"""/*%FSM*/; + action=/*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/overcast.fsm b/Client/FSM/overcast.fsm new file mode 100644 index 0000000..4c815fd --- /dev/null +++ b/Client/FSM/overcast.fsm @@ -0,0 +1,177 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.063538,-295.568512,25.936447,-245.568604,0.000000,"Init"}; +item1[] = {"Update_Weather",2,4346,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Weather"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +item5[] = {"Wait_for_Init",4,218,65.886307,-194.314407,155.886276,-144.314407,0.000000,"Wait for Init"}; +item6[] = {"Advanced_Init",2,250,-63.879562,-194.314392,26.121157,-144.314392,0.000000,"Advanced Init"}; +item7[] = {"_",8,218,-34.448154,-230.434799,-2.642141,-207.859543,0.000000,""}; +item8[] = {"Wait",2,250,192.379745,-194.033447,282.379883,-144.033447,0.000000,"Wait"}; +item9[] = {"Init_Done",4,218,-63.535187,-123.100403,26.464882,-73.100349,0.000000,"Init Done"}; +item10[] = {"",7,210,233.129700,-102.521011,241.129700,-94.521011,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +link5[] = {5,8}; +link6[] = {6,5}; +link7[] = {6,9}; +link8[] = {7,6}; +link9[] = {8,5}; +link10[] = {8,10}; +link11[] = {9,1}; +link12[] = {10,9}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-395.307037,395.306915,79.046959,-351.956635,897,514,1}; +window[] = {0,-1,-1,-1,-1,659,25,1285,25,1,915}; +*//*%FSM*/ +class FSM +{ + fsmName = "overcast"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_lastOverCast = -1;" \n + "_overCast = 0;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Advanced_Init"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Weather + { + name = "Update_Weather"; + init = /*%FSM*/"_overCast = WF_Logic getVariable ""overCast"";" \n + "if (_overCast != _lastOverCast) then {" \n + " ('WFBE_WEATHERTRANSITION' Call GetNamespace) setOvercast _overCast;" \n + " _lastOverCast = _overCast;" \n + "};" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Weather"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Advanced_Init + { + name = "Advanced_Init"; + init = /*%FSM*/"_overCast = WF_Logic getVariable ""overCast"""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Init_Done + { + priority = 0.000000; + to="Update_Weather"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isNil ""_overCast"""/*%FSM*/; + action=/*%FSM*/"_overCast = WF_Logic getVariable ""overCast"";" \n + "if (time > 10) then {0 setOvercast _overCast;_lastOverCast = _overCast};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Wait_for_Init + { + priority = 0.000000; + to="Wait"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNil ""_overCast"""/*%FSM*/; + action=/*%FSM*/"_overCast = WF_Logic getVariable ""overCast"""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Wait + { + name = "Wait"; + init = /*%FSM*/"_overCast = WF_Logic getVariable ""overCast"";"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Init_Done + { + priority = 0.000000; + to="Update_Weather"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isNil ""_overCast"""/*%FSM*/; + action=/*%FSM*/"_overCast = WF_Logic getVariable ""overCast"";" \n + "if (time > 10) then {0 setOvercast _overCast;_lastOverCast = _overCast};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Wait_for_Init + { + priority = 0.000000; + to="Wait"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNil ""_overCast"""/*%FSM*/; + action=/*%FSM*/"_overCast = WF_Logic getVariable ""overCast"""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/resources_cli.fsm b/Client/FSM/resources_cli.fsm new file mode 100644 index 0000000..24899bb --- /dev/null +++ b/Client/FSM/resources_cli.fsm @@ -0,0 +1,111 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,65.361679,-140.426117,155.361542,-90.426193,0.000000,"Init"}; +item1[] = {"Update_Income",2,4346,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Income"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-365.650940,391.210938,85.220795,-348.477112,758,514,1}; +window[] = {0,-1,-1,-1,-1,734,100,1360,100,1,776}; +*//*%FSM*/ +class FSM +{ + fsmName = "resources_cli"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_pside = _this;" \n + "" \n + "_lastUpdate = time;" \n + "" \n + "_is = 'WFBE_INCOMESYSTEM' Call GetNamespace;" \n + "_ii = 'WFBE_INCOMEINTERVAL' Call GetNamespace;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Income"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > _ii && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Income + { + name = "Update_Income"; + init = /*%FSM*/"_lastUpdate = time;" \n + "" \n + "_income = 0;" \n + "" \n + "//--- Income Getter." \n + "{" \n + " _side = (_x getVariable ""sideID"") Call GetSideFromID;" \n + " _supply = _x getVariable ""supplyValue"";" \n + " if (_side == _pside) then {_income = _income + (_supply / _is)};" \n + "} forEach towns;" \n + "" \n + "//--- Only change the funds if needed." \n + "if (_income > 0) then {" \n + " (_income) Call ChangePlayerFunds;" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Income"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > _ii && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End", + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updateactions.fsm b/Client/FSM/updateactions.fsm new file mode 100644 index 0000000..27d60ad --- /dev/null +++ b/Client/FSM/updateactions.fsm @@ -0,0 +1,138 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.944939,-176.579712,25.055046,-126.579880,0.000000,"Init"}; +item1[] = {"Check_Player",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Player"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Not_Alive",4,218,-216.668854,-56.267559,-126.668869,-6.267574,1.000000,"Not Alive"}; +item5[] = {"Update_Actions",2,4346,66.545509,15.865158,156.545563,65.865219,0.000000,"Update Actions"}; +item6[] = {"Alive",4,218,-66.545601,15.865162,23.454397,65.865189,0.000000,"Alive"}; +item7[] = {"_",8,218,-37.459465,-108.411957,-3.868937,-87.498108,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {3,1}; +link5[] = {4,2}; +link6[] = {5,3}; +link7[] = {6,5}; +link8[] = {7,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,29,6316128,1,-395.307037,395.306915,167.465607,-285.572937,407,514,1}; +window[] = {0,-1,-1,-1,-1,834,200,1460,200,1,425}; +*//*%FSM*/ +class FSM +{ + fsmName = "updateactions"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_optionsID = -1;" \n + "_lastVehicle = player;" \n + "_UpdateActions = true;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Check_Player"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Player + { + name = "Check_Player"; + init = /*%FSM*/"if (Vehicle player != _lastVehicle) then {_UpdateActions = true};" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Not_Alive + { + priority = 1.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver || !alive player"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Alive + { + priority = 0.000000; + to="Update_Actions"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"alive player && !gameOver && _UpdateActions"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Player"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 0.5 && !gameOver && alive player && !_UpdateActions"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/"_lastVehicle RemoveAction _optionsID"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Actions + { + name = "Update_Actions"; + init = /*%FSM*/"_UpdateActions = false;" \n + "_vehicle = Vehicle player;" \n + "if (_vehicle != player) then {_optionsID = _vehicle addAction ["""" + (localize ""STR_WF_Options"") + """",""Client\Action\Action_Menu.sqf"", """", 1, false, true, """", """"]} else {_lastVehicle RemoveAction _optionsID};" \n + "_lastVehicle = _vehicle;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Player"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 0.5 && !gameOver && alive player && !_UpdateActions"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updateavailableactions.fsm b/Client/FSM/updateavailableactions.fsm new file mode 100644 index 0000000..ca1ee4c --- /dev/null +++ b/Client/FSM/updateavailableactions.fsm @@ -0,0 +1,268 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,4346,64.986191,-133.045959,154.986206,-83.046036,0.000000,"Init"}; +item1[] = {"Update_Client_Ac",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Client" \n "Actions"}; +item2[] = {"End",1,250,-207.023727,26.287281,-117.023697,76.287277,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-64.280334,28.850353,25.719648,78.850410,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +globals[] = {0.000000,0,0,0,0,640,480,1,38,6316128,1,-317.581665,500.648590,697.417725,-204.557556,596,657,1}; +window[] = {0,-1,-1,-1,-1,802,25,1285,25,1,614}; +*//*%FSM*/ +class FSM +{ + fsmName = "updateavailableactions"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_lastUpdate = time;" \n + "_txt = '';" \n + "_handle = nil;" \n + "_ft = 'WFBE_FASTTRAVEL' Call GetNamespace;" \n + "_ftr = 'WFBE_FASTTRAVELRANGE' Call GetNamespace;" \n + "_mhqbr = 'WFBE_MHQBUILDINGRANGE' Call GetNamespace;" \n + "_pur = 'WFBE_PURCHASEUNITSRANGE' Call GetNamespace;" \n + "_pura = 'WFBE_PURCHASEUNITSRANGEAIR' Call GetNamespace;" \n + "_ccr = 'WFBE_COMMANDCENTERRANGE' Call GetNamespace;" \n + "_pgr = 'WFBE_PURCHASEGEARRANGE' Call GetNamespace;" \n + "_rptr = 'WFBE_REPAIRTRUCKRANGE' Call GetNamespace;" \n + "_spr = 'WFBE_SERVICEPOINTRANGE' Call GetNamespace;" \n + "_tpr = 'WFBE_TOWNBUILDPROTECTIONRANGE' Call GetNamespace;" \n + "_tcr = 'WFBE_TOWNCAPTURERANGE' Call GetNamespace;" \n + "_is = 'WFBE_INCOMESYSTEM' Call GetNamespace;" \n + "_ac = 'WFBE_ARTILLERYCOMPUTER' Call GetNamespace;" \n + "_buygearfrom = missionNamespace getVariable ""WFBE_TOWNGEAR"";" \n + "_acenabled = false;" \n + "" \n + "_fastTravel = false;" \n + "" \n + "_commandCenter = objNull;" \n + "" \n + "_typeRepair = Format['WFBE_%1REPAIRTRUCKS',sideJoinedText] Call GetNamespace;" \n + "" \n + "//--- Keep actions updated (GUI). - changed-MrNiceGuy " \n + "12450 cutRsc [""OptionsAvailable"",""PLAIN"",0];" \n + "_icons = [" \n + """Client\Images\icon_wf_building_mhq.paa"", //mhq deployable" \n + """Client\Images\icon_wf_building_barracks.paa"", //barracks " \n + """Client\Images\icon_wf_building_gear.paa"", //gear avail" \n + """Client\Images\icon_wf_building_lvs.paa"", //lvsp" \n + """Client\Images\icon_wf_building_hvs.paa"", //hvsp" \n + """Client\Images\icon_wf_building_air.paa"", //helipad" \n + """Client\Images\icon_wf_building_hangar.paa"", //hangar" \n + """Client\Images\icon_wf_building_repair.paa"", //rearm | repair | refuel" \n + """Client\Images\icon_wf_building_firstaid.paa"", //heal " \n + """Client\Images\icon_wf_support_fasttravel.paa"", //fast travel" \n + """Client\Images\icon_wf_building_cc.paa"", //command center" \n + """Client\Images\icon_wf_building_aa_radar.paa"", //AA radar" \n + """Client\Images\icon_wf_building_am_radar.paa"", //ARTY radar" \n + """Client\Images\icon_wf_support_transport.paa"", //transport" \n + """Client\Images\icon_wf_support_supplydrop.paa"", //supply drop" \n + """Client\Images\icon_wf_support_artilery.paa"", //ARTY" \n + """Client\Images\icon_wf_support_mortar.paa"", //ARTY - mortar" \n + """Client\Images\icon_wf_support_cas.paa"", //CAS" \n + """Client\Images\icon_wf_support_uav.paa"" //UAV" \n + "];" \n + "" \n + "_buildings = (sideJoinedText) Call GetSideStructures;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client_Ac"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _lastUpdate > 5 || WFBE_ForceUpdate) && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Client_Ac + { + name = "Update_Client_Ac"; + init = /*%FSM*/"_buildings = (sideJoinedText) Call GetSideStructures;" \n + "_base = (sideJoinedText) Call GetSideHQ;" \n + "_upgrades = (sideJoinedText) Call GetSideUpgrades;" \n + " " \n + "_purchaseRange = if (commandInRange) then {_ccr} else {_pur};" \n + " " \n + "_nearTown = [player,towns] Call SortByDistance;" \n + "_closest = _nearTown select 0;" \n + "" \n + "if (!isNull(commanderTeam) && paramHighCommand) then {" \n + " if (commanderTeam == group player) then {" \n + " {if !(isNil '_x') then {if !(_x in (hcAllGroups player)) then {player HCSetGroup [_x]}}} forEach clientTeams;" \n + " };" \n + "};" \n + "" \n + "//--- Boundaries are limited ?" \n + "if (paramBoundaries) then {" \n + " _isOnMap = Call BoundariesIsOnMap;" \n + " if !(_isOnMap && alive player) then {" \n + " if !(paramBoundariesRunning) then {_handle = [] Spawn BoundariesHandleOnMap};" \n + " } else {" \n + " if !(isNil '_handle') then {terminate _handle;_handle = nil};" \n + " paramBoundariesRunning = false;" \n + " };" \n + "};" \n + "" \n + "//--- Map info." \n + "if (visibleMap) then {" \n + " if (!isNull commanderTeam) then {_txt = format [localize 'STR_WF_Commander',name (leader commanderTeam)]} else {_txt = format [localize 'STR_WF_Commander',localize 'STR_WF_AI']};" \n + " _txt = _txt + ' ' + Format [localize ""STR_WF_Income"",Call GetPlayerFunds,(sideJoined) Call GetIncome];" \n + " if (_is in [3,4]) then {_txt = _txt + Format["" (%1%2)"", Call Compile Format[""%1CommanderPercent"",sideJoined],""%""]};" \n + " if !(paramMoneyOnly) then {_txt = _txt + ' ' + localize 'STR_WF_UPGRADE_Supply' + ': '+ str((sideJoined) Call GetSideSupply)};" \n + " (findDisplay 12 displayCtrl 116) ctrlSetText _txt;" \n + "};" \n + "" \n + "//--- HQ." \n + "if !(isNull _base) then {hqInRange = if ((player distance _base < _mhqbr)&&(alive _base)&&(player distance _closest > _tpr)) then {true} else {false}};" \n + "" \n + "barracksInRange = if (isNull (['BARRACKSTYPE',_buildings,_purchaseRange,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "gearInRange = if (isNull (['BARRACKSTYPE',_buildings,_pgr,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "if !(gearInRange) then {" \n + " if (_buygearfrom in [1,2,3]) then {" \n + " _lookfor = switch (_buygearfrom) do { case 1:{WFCAMP}; case 2:{WFDEPOT}; case 3:{WFCAMP + WFDEPOT}; default{[]}};" \n + " _nObjects = nearestObjects [player, _lookfor, 5];" \n + " _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};" \n + " if !(isNull _nObject) then {" \n + " _sideID = _nObject getVariable ""sideID"";" \n + " if !(isNil '_sideID') then {" \n + " if (!gearInRange && sideID == _sideID) then {gearInRange = true} else {gearInRange = false};" \n + " };" \n + " };" \n + " };" \n + "};" \n + "" \n + "lightInRange = if (isNull (['LIGHTTYPE',_buildings,_purchaseRange,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "heavyInRange = if (isNull (['HEAVYTYPE',_buildings,_purchaseRange,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "aircraftInRange = if (isNull (['AIRCRAFTTYPE',_buildings,_purchaseRange,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "serviceInRange = if (isNull (['SERVICEPOINTTYPE',_buildings,_spr,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "" \n + "if !(serviceInRange) then {" \n + " _checks = (getPos player) nearEntities[_typeRepair,_rptr];" \n + " if (count _checks > 0) then {serviceInRange = true};" \n + "};" \n + "" \n + "if (paramAARadar) then {" \n + " _checks = [sideJoined, Format [""WFBE_%1AARADARTYPE"",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;" \n + " if (count _checks > 0) then {antiAirRadarInRange = true} else {antiAirRadarInRange = false};" \n + "};" \n + "" \n + "//--- Town Depot." \n + "_nObjects = nearestObjects [vehicle player, WFDEPOT,('WFBE_TOWNPURCHASERANGE' Call GetNamespace)];" \n + "_nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};" \n + "if (!isNull _nObject) then {" \n + " _sideID = _nObject getVariable ""sideID"";" \n + " if !(isNil ""_sideID"") then {" \n + " if (_sideID == sideID) then {if (vehicle player distance _nObject < _tcr) then {serviceInRange = true;depotInRange = true} else {depotInRange = false}};" \n + " };" \n + "} else {depotInRange = false};" \n + "" \n + "_checks = ['COMMANDCENTERTYPE',_buildings,_ccr,sideJoined,player] Call BuildingInRange;" \n + "_commandCenter = _checks;" \n + "commandInRange = if (isNull _checks) then {false} else {true};" \n + "" \n + "//--- Airport." \n + "if (paramHangars) then {" \n + " _sorted = [player,Airfields] Call SortByDistance;" \n + " if (count _sorted > 0) then {" \n + " if ((_sorted select 0) distance player < _pura && alive(_sorted select 0)) then {hangarInRange = true} else {hangarInRange = false};" \n + " } else {hangarInRange = false};" \n + "};" \n + "" \n + "//--- Fast Travel." \n + "if ((_ft > 0) && commandInRange) then {" \n + " _fastTravel = false;" \n + " _isDeployed = (sideJoinedText) Call GetSideHQDeployed;" \n + " if (_upgrades select 12 > 0) then {" \n + " if (player distance _base < _ftr && alive _base && _isDeployed) then {_fastTravel = true} else {" \n + " _closest = _nearTown select 0;" \n + " _sideID = _closest getVariable 'sideID';" \n + " if (player distance _closest < _ftr && _sideID == sideID) then {_fastTravel = true} else {" \n + " if (!isNull _commandCenter) then {" \n + " if (player distance _commandCenter < _ftr) then {_fastTravel = true};" \n + " };" \n + " };" \n + " }; " \n + " }; " \n + "};" \n + "" \n + "//--- AC." \n + "if (_ac == 1 && !_acenabled && !WF_A2_Vanilla) then {" \n + " if ((_upgrades select 10) == 3) then {Call Compile ""enableEngineArtillery true;"";_acenabled = true};" \n + "};" \n + "" \n + "_usable = [hqInRange,barracksInRange,gearInRange,lightInRange,heavyInRange,aircraftInRange,hangarInRange,serviceInRange,serviceInRange,_fastTravel,commandInRange,antiAirRadarInRange];" \n + "" \n + "_c = 0;" \n + "if (isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {12450 cutRsc[""OptionsAvailable"",""PLAIN"",0]};" \n + "{" \n + " if (_x) then {" \n + " (([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl (3500 + _c)) CtrlSetText (_icons select _c);" \n + " } else {" \n + " (([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl (3500 + _c)) CtrlSetText """";" \n + " };" \n + " _c = _c + 1;" \n + "}forEach _usable;" \n + "" \n + "if (WFBE_ForceUpdate) then {WFBE_ForceUpdate = false};" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client_Ac"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _lastUpdate > 5 || WFBE_ForceUpdate) && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updatecapture.fsm b/Client/FSM/updatecapture.fsm new file mode 100644 index 0000000..0dd0934 --- /dev/null +++ b/Client/FSM/updatecapture.fsm @@ -0,0 +1,262 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,4346,64.981941,-136.945908,154.981949,-86.946060,0.000000,"Init"}; +item1[] = {"Check_Towns",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Towns"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +item5[] = {"Update_Capture",2,250,66.545486,22.916348,156.545471,72.916397,0.000000,"Update Capture"}; +item6[] = {"In_Range",4,218,-66.545563,22.916351,23.454376,72.916374,0.000000,"In Range"}; +item7[] = {"Not_in_Range",4,218,-167.954971,85.174767,-77.955025,135.174774,0.000000,"Not in Range"}; +item8[] = {"Hide",2,250,215.453018,86.056137,305.453064,136.056137,0.000000,"Hide"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {1,7}; +link5[] = {3,1}; +link6[] = {4,2}; +link7[] = {5,3}; +link8[] = {6,5}; +link9[] = {7,8}; +link10[] = {8,3}; +globals[] = {0.000000,0,0,0,0,640,480,1,25,6316128,1,-526.153625,526.153442,261.834167,-341.160065,1024,906,1}; +window[] = {2,-1,-1,-1,-1,834,200,1460,200,3,1042}; +*//*%FSM*/ +class FSM +{ + fsmName = "updatecapture"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"disableSerialization;" \n + "_delay = 4;" \n + "_lastCheck = """";" \n + "_lastSID = -1;" \n + "_lastUpdate = time;" \n + "" \n + "_tcarm = 'WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace;" \n + "" \n + "_colorBlue = [0,0,0.7,0.7];" \n + "_colorGreen = [0,0.7,0,0.7];" \n + "_colorRed = [0.7,0,0,0.7];" \n + "" \n + "_colorFriendly = switch ('Friendly' Call GetMarkerColoration) do {" \n + " case ""ColorGreen"": {_colorGreen};" \n + " case ""ColorBlue"": {_colorBlue};" \n + " case ""ColorRed"": {_colorRed};" \n + " default {_colorGreen};" \n + "};" \n + "" \n + "_colorEnemy = switch ('Enemy' Call GetMarkerColoration) do {" \n + " case ""ColorGreen"": {_colorGreen};" \n + " case ""ColorBlue"": {_colorBlue};" \n + " case ""ColorRed"": {_colorRed};" \n + " default {_colorRed};" \n + "};" \n + "" \n + "_coloResistance = switch ('Resistance' Call GetMarkerColoration) do {" \n + " case ""ColorGreen"": {_colorGreen};" \n + " case ""ColorBlue"": {_colorBlue};" \n + " case ""ColorRed"": {_colorRed};" \n + " default {_colorBlue};" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 2 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Towns + { + name = "Check_Towns"; + init = /*%FSM*/"_sorted = [player,towns] Call SortByDistance;" \n + "_nearest = _sorted select 0;" \n + "_range = (_nearest getVariable ""range"") * _tcarm;" \n + "" \n + "_update = false;" \n + "if (player distance _nearest < _range && alive player) then {_update = true};" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class In_Range + { + priority = 0.000000; + to="Update_Capture"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_update && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Not_in_Range + { + priority = 0.000000; + to="Hide"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!_update && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 2 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Capture + { + name = "Update_Capture"; + init = /*%FSM*/"_sideID = _nearest getVariable ""sideID"";" \n + "if (isNil '_sideID') then {_sideID = -1};" \n + "_curSV = _nearest getVariable ""supplyValue"";" \n + "_maxSV = _nearest getVariable ""maxSupplyValue"";" \n + "_txt = """";" \n + "_nObjects = nearestObjects [player, WFCAMP, 10];" \n + "_nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};" \n + "if !(isNull _nObject) then {" \n + " _sideID = _nObject getVariable ""sideID"";" \n + " if !(isNil '_sideID') then {" \n + " _curSV = _nObject getVariable ""supplyValue"";" \n + " if (_lastCheck == ""Town"") then {_delay = 0};" \n + " _lastCheck = ""Camp"";" \n + " } else {" \n + " _sideID = -1;" \n + " };" \n + " if (player distance _nObject >= 10) then {" \n + " _lastCheck = ""Town"";" \n + " _sideID = _nearest getVariable ""sideID"";" \n + " _curSV = _nearest getVariable ""supplyValue"";" \n + " _txt = Format [""SV: %1/%2"",_curSV,_maxSV];" \n + " };" \n + "} else {" \n + " if (_lastCheck == ""Camp"") then {_delay = 0};" \n + " _lastCheck = ""Town"";" \n + " _txt = Format [""SV: %1/%2"",_curSV,_maxSV];" \n + "};" \n + "" \n + "_barColor = [];" \n + "if (_sideID == RESISTANCEID || _sideID == -1) then {_barColor = _coloResistance};" \n + "if ((_sideID == WESTID)&&(sideID == WESTID) || (_sideID == EASTID)&&(sideID == EASTID)) then {_barColor = _colorFriendly}; //--- Green" \n + "if ((_sideID == WESTID)&&(sideID == EASTID) || (_sideID == EASTID)&&(sideID == WESTID)) then {_barColor = _colorEnemy};" \n + "if (_sideID != _lastSID) then {_delay = 0};" \n + "if (isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {12450 cutRsc[""OptionsAvailable"",""PLAIN"",0];_delay = 0};" \n + "if (!isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {" \n + " _control = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3800;" \n + " _control ctrlShow true;" \n + " _control CtrlSetBackgroundColor _barColor;" \n + " _backgroundControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3600;" \n + " _backgroundControl ctrlShow true;" \n + " _backgroundControl CtrlSetBackgroundColor [0.1882, 0.2588, 0.149, 0.76];" \n + " _textControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3900;" \n + " _textControl ctrlShow true;" \n + " _textControl ctrlSetText _txt;" \n + " _maxWidth = (CtrlPosition _backgroundControl Select 2) - 0.02;" \n + " _position = CtrlPosition _control;" \n + " _position Set[2,_maxWidth * _curSV / _maxSV];" \n + " _control CtrlSetPosition _position;" \n + " _control CtrlCommit _delay;" \n + " _delay = 4;" \n + " _lastSID = _sideID;" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 2 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Hide + { + name = "Hide"; + init = /*%FSM*/"_delay = 0;" \n + "if (isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {12450 cutRsc[""OptionsAvailable"",""PLAIN"",0]};" \n + "if (!isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {" \n + " _control = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3800;" \n + " _backgroundControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3600;" \n + " _textControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3900;" \n + " _control ctrlShow false;" \n + " _backgroundControl ctrlShow false;" \n + " _textControl ctrlShow false;" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 2 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updateclient.fsm b/Client/FSM/updateclient.fsm new file mode 100644 index 0000000..f6f1538 --- /dev/null +++ b/Client/FSM/updateclient.fsm @@ -0,0 +1,175 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,66.278671,-152.869141,156.278748,-102.869209,0.000000,"Init"}; +item1[] = {"Update_Client",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Client"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +item5[] = {"Update_Commander",2,4346,66.545486,22.916348,156.545471,72.916397,0.000000,"Update" \n "Commander"}; +item6[] = {"Change_Commander",4,218,-66.545563,22.916351,23.454376,72.916374,0.000000,"Change" \n "Commander"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {3,1}; +link5[] = {4,2}; +link6[] = {5,3}; +link7[] = {6,5}; +globals[] = {0.000000,0,0,0,0,640,480,1,22,6316128,1,-345.209412,345.209290,108.499458,-297.536255,1028,906,1}; +window[] = {2,-1,-1,-1,-1,834,200,1652,200,3,1046}; +*//*%FSM*/ +class FSM +{ + fsmName = "updateclient"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"commanderTeam = (SideJoined) Call GetCommanderTeam;" \n + "" \n + "_lastCommanderTeam = commanderTeam;" \n + "_changeCommander = false;" \n + "_timer = 0;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Client + { + name = "Update_Client"; + init = /*%FSM*/"commanderTeam = (sideJoined) Call GetCommanderTeam;" \n + "if (IsNull commanderTeam && !IsNull _lastCommanderTeam) then {_changeCommander = true};" \n + "if (!IsNull commanderTeam && IsNull _lastCommanderTeam) then {_changeCommander = true};" \n + "if (!isNull commanderTeam && !isNull _lastCommanderTeam) then {" \n + " if (commanderTeam != _lastCommanderTeam) then {_changeCommander = true};" \n + "};" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Change_Commander + { + priority = 0.000000; + to="Update_Commander"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_changeCommander && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Commander + { + name = "Update_Commander"; + init = /*%FSM*/"_changeCommander = false;" \n + "_lastCommanderTeam = commanderTeam; " \n + "_MHQ = (sideJoinedText) Call GetSideHQ;" \n + "" \n + "if (IsNull commanderTeam) then {" \n + " if (!IsNull _MHQ) then {" \n + " _MHQ RemoveAction 0;" \n + " _MHQ RemoveAction 1;" \n + " _MHQ RemoveAction 2;" \n + " _MHQ RemoveAction 3;" \n + " };" \n + " if (!isNil ""HQAction"") then {player removeAction HQAction};" \n + " if (count (hcAllGroups player) > 0) then {HCRemoveAllGroups player};" \n + " {[_x,false] Call SetTeamAutonomous} forEach clientTeams;" \n + "};" \n + " " \n + "if (!isNull(commanderTeam)) then {" \n + " if (commanderTeam == Group player) then {" \n + " if (!IsNull _MHQ) then {" \n + " _MHQ addAction [localize ""STR_WF_Unlock_MHQ"",""Client\Action\Action_ToggleLock.sqf"", [], 95, false, true, '', 'alive _target && locked _target'];" \n + " _MHQ addAction [localize ""STR_WF_Lock_MHQ"",""Client\Action\Action_ToggleLock.sqf"", [], 94, false, true, '', 'alive _target && !(locked _target)'];" \n + " };" \n + " _deployed = (sideJoinedText) Call GetSideHQDeployed;" \n + " if (_deployed) then {" \n + " ['WFBE_AREAHQDEPLOYED' Call GetNameSpace,true,MCoin] Call Compile PreprocessFile ""Client\Init\Init_Coin.sqf"";" \n + " } else {" \n + " ['WFBE_AREAHQUNDEPLOYED' Call GetNamespace,false,MCoin] Call Compile PreprocessFile ""Client\Init\Init_Coin.sqf"";" \n + " };" \n + " HQAction = leader(group player) addAction [localize ""STR_WF_BuildMenu"",""Client\Action\Action_Build.sqf"", [_MHQ], 100, false, true, """", ""hqInRange && canBuildWHQ && (_target == player)""]; " \n + " if (paramHighCommand) then {player setVariable [""BIS_HC_scope"",HC];{if !(isNil '_x') then {player HCSetGroup [_x]; [_x,false] Call SetTeamAutonomous}} forEach clientTeams};" \n + " [Localize ""STR_WF_CHAT_PlayerCommander""] Call TitleTextMessage;" \n + " } else {" \n + " if (!isNil ""HQAction"") then {player removeAction HQAction};" \n + " if (count (hcAllGroups player) > 0 && paramHighCommand) then {HCRemoveAllGroups player};" \n + " };" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updatesalvage.fsm b/Client/FSM/updatesalvage.fsm new file mode 100644 index 0000000..2030f0c --- /dev/null +++ b/Client/FSM/updatesalvage.fsm @@ -0,0 +1,165 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.944939,-176.579712,25.055046,-126.579880,0.000000,"Init"}; +item1[] = {"Check_Towns",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Towns"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Truck_is_Dead",4,218,-216.668854,-56.267559,-126.668869,-6.267574,1.000000,"Truck is" \n "Dead"}; +item5[] = {"Check_Wrecks",2,4346,66.545509,15.865158,156.545563,65.865219,0.000000,"Check Wrecks"}; +item6[] = {"Has_Driver",4,218,-66.545601,15.865162,23.454397,65.865189,0.000000,"Has Driver"}; +item7[] = {"_",8,218,-37.459465,-108.411957,-3.868937,-87.498108,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {3,1}; +link5[] = {4,2}; +link6[] = {5,3}; +link7[] = {6,5}; +link8[] = {7,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,29,6316128,1,-280.138428,228.260757,186.219727,-258.197296,588,514,1}; +window[] = {0,-1,-1,-1,-1,732,48,1308,98,1,606}; +*//*%FSM*/ +class FSM +{ + fsmName = "updatesalvage"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_vehicle = _this select 0;" \n + "" \n + "_salvagerRange = 'WFBE_SALVAGERRANGE' Call GetNamespace;" \n + "_percentage = 'WFBE_SALVAGERPERCENT' Call GetNamespace;" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Towns + { + name = "Check_Towns"; + init = /*%FSM*/"_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Truck_is_Dead + { + priority = 1.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver || !(alive _vehicle)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Has_Driver + { + priority = 0.000000; + to="Check_Wrecks"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(isNull (driver _vehicle)) && !gameOver && alive _vehicle"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver && alive _vehicle"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Wrecks + { + name = "Check_Wrecks"; + init = /*%FSM*/"_vehicles = nearestObjects [getPos _vehicle, ['Car','Motorcycle','Ship','Air','Tank','StaticWeapon'],_salvagerRange];" \n + "" \n + "_wrecks = [];" \n + "{" \n + " if !(alive _x) then {_wrecks = _wrecks + [_x]};" \n + "} forEach _vehicles;" \n + "" \n + "_hqw = (west) Call GetSideHQ;" \n + "_hqe = (east) Call GetSideHQ;" \n + "" \n + "_wrecks = _wrecks - [_hqw,_hqe];" \n + "" \n + "_overAllCost = 0;" \n + "{" \n + " _isNeeded = _x getVariable 'keepAlive';" \n + " " \n + " if (isNil '_isNeeded') then {" \n + " _get = (typeOf _x) Call GetNamespace;" \n + " _salvageCost = 250;" \n + " if !(isNil '_get') then {" \n + " _salvageCost = round(((_get select QUERYUNITPRICE)*_percentage) / 100);" \n + " };" \n + " " \n + " _overAllCost = _overAllCost + _salvageCost;" \n + " (Format [localize 'STR_WF_CHAT_Salvaged_Unit',_salvageCost,[typeOf _x,'displayName'] Call GetConfigInfo]) Call GroupChatMessage;" \n + " " \n + " deleteVehicle _x;" \n + " };" \n + "} foreach _wrecks;" \n + "" \n + "if (_overAllCost > 0) then {(_overAllCost) Call ChangePlayerfunds};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver && alive _vehicle"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End", + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updatesupply.fsm b/Client/FSM/updatesupply.fsm new file mode 100644 index 0000000..1340f01 --- /dev/null +++ b/Client/FSM/updatesupply.fsm @@ -0,0 +1,213 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.944939,-176.579712,25.055046,-126.579880,0.000000,"Init"}; +item1[] = {"Check_Towns",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Towns"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Truck_is_Dead",4,218,-216.668854,-56.267559,-126.668869,-6.267574,1.000000,"Truck is" \n "Dead"}; +item5[] = {"Truck_Check",2,4346,66.545509,15.865158,156.545563,65.865219,0.000000,"Truck Check"}; +item6[] = {"Has_Driver",4,218,-66.545601,15.865162,23.454397,65.865189,0.000000,"Has Driver"}; +item7[] = {"_",8,218,-37.459465,-108.411957,-3.868937,-87.498108,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {3,1}; +link5[] = {4,2}; +link6[] = {5,3}; +link7[] = {6,5}; +link8[] = {7,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,29,6316128,1,-395.307037,395.306915,167.465607,-285.572937,588,519,1}; +window[] = {0,-1,-1,-1,-1,745,56,1316,111,1,606}; +*//*%FSM*/ +class FSM +{ + fsmName = "updatesupply"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_vehicle = _this select 0;" \n + "_side = _this select 1;" \n + "_driver = driver _vehicle;" \n + "_lastDriver = driver _vehicle;" \n + "" \n + "_SV = 1000;" \n + "_currentSV = 0;" \n + "_maxSV = 0;" \n + "_timer = 0;" \n + "_exit = false;" \n + "_canDeliver = false;" \n + "_hq = (sideJoinedText) Call GetSideHQ;" \n + "_lastDestination = _hq;" \n + "_delRange = 'WFBE_DELIVERYRANGE' Call GetNamespace;" \n + "_fpsp = 'WFBE_FUNDSPERSUPPLYPOINT' Call GetNamespace;" \n + "_spsp = 'WFBE_SCOREPERSUPPLYPOINT' Call GetNamespace;" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Towns + { + name = "Check_Towns"; + init = /*%FSM*/"if (!alive _vehicle || isNull _vehicle) then {_exit = true}; " \n + "" \n + "_driver = driver _vehicle;" \n + "_hasDriver = false;" \n + "_playerInVehicle = false;" \n + "if (!IsNull _driver) then {" \n + " if (Alive _driver) then {_hasDriver = true};" \n + " if (isPlayer _driver) then {_playerInVehicle = true};" \n + "};" \n + "" \n + "_lastDriver = _driver;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Truck_is_Dead + { + priority = 1.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver || _exit"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Has_Driver + { + priority = 0.000000; + to="Truck_Check"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_hasDriver && !gameOver && !_exit"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 3 && !gameOver && !_exit"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Truck_Check + { + name = "Truck_Check"; + init = /*%FSM*/"if (!isNull _driver) then {" \n + " if (_driver != _lastDriver) then {" \n + " _lastDriver = _driver;" \n + " if (_playerInVehicle) then {" \n + " _txt = localize ""STR_WF_INFO_Supply_Full"";" \n + " if (_SV != 1000) then {_txt = Format [localize ""STR_WF_INFO_Supply_Status"",_SV]};" \n + " hint _txt;" \n + " };" \n + " };" \n + "};" \n + " " \n + "_hq = (sideJoinedText) Call GetSideHQ;" \n + "_isDeployed = (sideJoinedText) Call GetSideHQDeployed;" \n + "if (_vehicle Distance _hq < 70 && _SV != 1000 && getDammage _hq < 1 && _isDeployed) then {_SV = 1000;_vehicle setFuel 1;_lastDestination = _hq;if (_playerInVehicle) then {hint (localize ""STR_WF_INFO_Supply_Full"")}};" \n + "" \n + "if (_SV != 1000) then {" \n + " _buildings = (sideJoinedText) Call GetSideStructures;" \n + " _checks = [sideJoined,Format [""WFBE_%1SERVICEPOINTTYPE"",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;" \n + " if (count _checks > 0) then {" \n + " _sorted = [_vehicle,_checks] Call SortByDistance;" \n + " _nearest = _sorted select 0;" \n + " if (_vehicle distance _nearest < 70) then {_SV = 1000;_vehicle setFuel 1;_lastDestination = _nearest;if (_playerInVehicle) then {hint (localize ""STR_WF_INFO_Supply_Full"")}};" \n + " };" \n + "};" \n + "" \n + "_loc = [_vehicle,towns] Call SortByDistance;" \n + "_closest = _loc select 0;" \n + "_name = _closest getVariable ""name"";" \n + "_locationSide = (_closest getVariable ""sideID"") Call GetSideFromID;" \n + "" \n + "_canDeliver = if (_locationSide == _side) then {true} else {false};" \n + "" \n + "if ((_vehicle Distance _closest < _delRange)&&(_canDeliver)&&(_lastDestination != _closest)) then {" \n + " _lastDestination = _closest;" \n + " _currentSV = _closest getVariable ""supplyValue"";" \n + " _maxSV = _closest getVariable ""maxSupplyValue"";" \n + " if (_SV > _currentSV) then {" \n + " if (_currentSV != _maxSV) then {" \n + " _upgrades = (sideJoinedText) Call GetSideUpgrades;" \n + " _increaseOf = (Format[""WFBE_MAXSUPPLYTRUCKSSV%1"",_upgrades select 6] Call GetNamespace);" \n + " _currentSV = _currentSV + _increaseOf;" \n + " if (_currentSV > _maxSV) then {_currentSV = _maxSV};" \n + " _closest setVariable [""supplyValue"",_currentSV,true];" \n + " };" \n + " _SV = _currentSV;" \n + " _funds = _SV * _fpsp * 2;" \n + " hint Format[localize ""STR_WF_INFO_Supply_Deliver"",_name,_SV,_maxSV,_funds];" \n + " _funds Call ChangePlayerFunds;" \n + " } else {" \n + " hint Format[localize ""STR_WF_INFO_Supply_Equal"",_name,_currentSV,_maxSV];" \n + " _SV = _currentSV;" \n + " };" \n + " WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + _spsp]];" \n + " publicVariable 'WFBE_RequestChangeScore';" \n + " if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + _spsp]] Spawn HandleSPVF};" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 3 && !gameOver && !_exit"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updateteamsmarkers.fsm b/Client/FSM/updateteamsmarkers.fsm new file mode 100644 index 0000000..a304236 --- /dev/null +++ b/Client/FSM/updateteamsmarkers.fsm @@ -0,0 +1,125 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,66.542603,-131.405823,156.542603,-81.406097,0.000000,"Init"}; +item1[] = {"Update_Markers",2,4346,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Markers"}; +item2[] = {"End",1,250,-194.208939,14.422928,-104.208908,64.422928,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-192.871109,-57.148956,-102.871117,-7.148972,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-395.307037,395.306915,79.046959,-351.956635,725,514,1}; +window[] = {0,-1,-1,-1,-1,734,100,1360,100,1,743}; +*//*%FSM*/ +class FSM +{ + fsmName = "updateteamsmarkers"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_sideText = sideJoinedText;" \n + "_label = """";" \n + "" \n + "_count = 1;" \n + "{" \n + " _marker = Format[""%1AdvancedSquad%2Marker"",_sideText,_count];" \n + " createMarkerLocal [_marker,[0,0,0]];" \n + " _marker setMarkerTypeLocal ""b_inf"";" \n + " _marker setMarkerColorLocal ""ColorBlue"";" \n + " _marker setMarkerSizeLocal [1,1];" \n + " _count = _count +1;" \n + "} forEach clientTeams;" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Markers"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Markers + { + name = "Update_Markers"; + init = /*%FSM*/"_count = 1;" \n + "{" \n + " if !(isNil '_x') then {" \n + " _markerType = ""b_inf"";" \n + " _marker = Format[""%1AdvancedSquad%2Marker"",_sideText,_count];" \n + " " \n + " if (alive (leader _x)) then {" \n + " _label = """";" \n + " if (isPlayer (leader _x)) then {_label = Format[""%1 [%2]"",name (leader _x),_count]} else {_label = Format[""AI [%1]"",_count]};" \n + " _marker setMarkerTextLocal _label;" \n + " _marker setMarkerPosLocal GetPos (leader _x);" \n + " } else {" \n + " _markerType = ""b_empty"";" \n + " };" \n + " " \n + " _marker setMarkerTypeLocal _markerType;" \n + " };" \n + " _count = _count + 1;" \n + "} forEach clientTeams;" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Markers"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updatetownmarkers.fsm b/Client/FSM/updatetownmarkers.fsm new file mode 100644 index 0000000..ac92ea9 --- /dev/null +++ b/Client/FSM/updatetownmarkers.fsm @@ -0,0 +1,112 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,64.620567,-141.323822,154.620590,-91.323967,0.000000,"Init"}; +item1[] = {"Check_Towns",2,250,-65.773369,-55.204887,24.226547,-5.204931,0.000000,"Check Towns"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,4314,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +globals[] = {0.000000,0,0,0,0,640,480,1,30,6316128,1,-395.307037,395.306915,93.428192,-337.575409,744,519,1}; +window[] = {0,-1,-1,-1,-1,721,66,1398,87,1,762}; +*//*%FSM*/ +class FSM +{ + fsmName = "updatetownmarkers"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_lastUpdate = time;" \n + "_lastSV = [];" \n + "" \n + "_tcarm = 'WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Towns + { + name = "Check_Towns"; + init = /*%FSM*/"_count = 0;" \n + "_units = (Units Group player) Call GetLiveUnits;" \n + "while {_count < totalTowns} do {" \n + " _location = towns Select _count;" \n + " _locationName = _location getVariable ""name"";" \n + " _maxSV = _location getVariable ""maxSupplyValue"";" \n + " _range = (_location getVariable ""range"") * _tcarm;" \n + " _sideID = _location getVariable ""sideID"";" \n + " _SV = _location getVariable ""supplyValue"";" \n + " _visible = false;" \n + " if (_sideID == sideID) then {_visible = true} else {{if (_x Distance _location < _range) then {_visible = true}} ForEach _units};" \n + " _marker = Format[""%1Depot"",Str _location];" \n + " if (_visible) then {_marker SetMarkerTextLocal Format["" SV: %1/%2"",_SV,_maxSV]} else {_marker SetMarkerTextLocal """"};" \n + " _lastSV set [_count,_SV];" \n + " _count = _count + 1;" \n + "};" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/Functions/Client_BuildUnit.sqf b/Client/Functions/Client_BuildUnit.sqf new file mode 100644 index 0000000..ae71a20 --- /dev/null +++ b/Client/Functions/Client_BuildUnit.sqf @@ -0,0 +1,240 @@ +Private ["_building","_cpt","_commander","_created","_crew","_currentUnit","_description","_direction","_distance","_driver","_extracrew","_factory","_factoryPosition","_factoryType","_group","_gunner","_index","_init","_isArtillery","_isMan","_locked","_longest","_position","_queu","_queu2","_ret","_show","_soldier","_waitTime","_txt","_type","_upgrades","_unique","_unit","_vehi","_vehicle","_vehicles"]; +_building = _this select 0; +_unit = _this select 1; +_vehi = _this select 2; +_factory = _this select 3; +_cpt = _this select 4; + +_isMan = if (_unit isKindOf "Man") then {true} else {false}; + +unitQueu = unitQueu + _cpt; + +_distance = 0; +_direction = 0; +_longest = 0; +_position = 0; +_waitTime = 0; +_factoryType = ""; +_description = ""; + +_currentUnit = _unit Call GetNamespace; +_waitTime = _currentUnit select QUERYUNITTIME; +_description = _currentUnit select QUERYUNITLABEL; + +_type = typeOf _building; +_index = (Format ["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace) find _type; +if (_index != -1) then { + _distance = (Format ["WFBE_%1STRUCTUREDISTANCES",sideJoinedText] Call GetNamespace) select _index; + _direction = (Format ["WFBE_%1STRUCTUREDIRECTIONS",sideJoinedText] Call GetNamespace) select _index; + _factoryType = (Format ["WFBE_%1STRUCTURES",sideJoinedText] Call GetNamespace) select _index; + _position = [getPos _building,_distance,getDir _building + _direction] Call GetPositionFrom; + _longest = Format ["WFBE_LONGEST%1BUILDTIME",_factoryType] Call GetNamespace; +} else { + if (_type in WFDEPOT) then { + _distance = depotDistance; + _direction = depotDirection; + _factoryType = "Depot"; + }; + if (_type in WFHANGAR) then { + _distance = airportDistance; + _direction = airportDirection; + _factoryType = "Airport"; + }; + _position = [getPos _building,_distance,getDir _building + _direction] Call GetPositionFrom; + _longest = Format ["WFBE_LONGEST%1BUILDTIME",_factoryType] Call GetNamespace; +}; + +_unique = varQueu; +varQueu = (random 10)+(random 100)+(random 1000); +_queu = _building getVariable "queu"; +if (isNil "_queu") then {_queu = []}; +_queu = _queu + [_unique]; +_building setVariable ["queu",_queu,true]; + +_ret = 0; +_queu2 = [0]; + +if (count _queu > 0) then {_queu2 = _building getVariable "queu"}; + +_show = false; +while {_unique != _queu select 0 && alive _building && !isNull _building} do { + sleep 4; + _show = true; + _ret = _ret + 4; + _queu = _building getVariable "queu"; + + if (_queu select 0 == _queu2 select 0) then { + if (_ret > _longest) then { + if (count _queu > 0) then { + _queu = _building getVariable "queu"; + _queu = _queu - [_queu select 0]; + _building setVariable ["queu",_queu,true]; + }; + }; + }; + if (count _queu != count _queu2) then { + _ret = 0; + _queu2 = _building getVariable "queu"; + }; +}; + +if (_show) then {hint(parseText(Format [localize "STR_WF_INFO_BuyEffective",_description]))}; + +sleep _waitTime; + +_queu = _building getVariable "queu"; +_queu = _queu - [_unique]; +_building setVariable ["queu",_queu,true]; + +_group = group player; +if !(alive _building) exitWith { + unitQueu = unitQueu - _cpt; + [Format["WFBE_C_QUEUE_%1",_factory],(Format["WFBE_C_QUEUE_%1",_factory] Call GetNamespace)-1,true] Call SetNamespace; +}; + +_created = objNull; +if (_isMan) then { + _soldier = [_unit,_group,_position,sideJoined] Call CreateMan; + _created = _soldier; + [sideJoinedText,'UnitsCreated',1] Call UpdateStatistics; +} else { + _driver = _vehi select 0; + _gunner = _vehi select 1; + _commander = _vehi select 2; + _extracrew = _vehi select 3; + _locked = _vehi select 4; + _vehicle = [_unit,_position,sideJoined,_locked] Call CreateVehi; + _created = _vehicle; + clientTeam reveal _vehicle; + _factoryPosition = getPos _building; + _vehicle setDir -((((_position select 1) - (_factoryPosition select 1)) atan2 ((_position select 0) - (_factoryPosition select 0))) - 90); + _vehicle setVelocity [0,0,-1]; + _vehicles = (WF_Logic getVariable "emptyVehicles") + [_vehicle]; + WF_Logic setVariable ["emptyVehicles",_vehicles,true]; + + if (isHostedServer) then {_vehicle setVariable ["WFBE_Taxi_Prohib", true]}; + + //--- Clear the vehicle. + clearWeaponCargo _vehicle; + clearMagazineCargo _vehicle; + + /* Section: Init */ + + //--- Units that can lift vehicles. + if (_unit in Zeta_Lifter) then { + _upgrades = (sideJoinedText) Call GetSideUpgrades; + if (_upgrades select 8 > 0) then {_vehicle addAction [localize "STR_WF_Lift","Client\Module\ZetaCargo\Zeta_Hook.sqf"]}; + }; + + //--- Lock / Unlock. + _vehicle addAction [localize "STR_WF_Unlock","Client\Action\Action_ToggleLock.sqf", [], 95, false, true, '', 'alive _target && locked _target']; + _vehicle addAction [localize "STR_WF_Lock","Client\Action\Action_ToggleLock.sqf", [], 94, false, true, '', 'alive _target && !(locked _target)']; + + //--- Repair Truck. + if (_unit in (Format['WFBE_%1REPAIRTRUCKS',sideJoinedText] Call GetNamespace)) then { + if (('WFBE_VICTORYCONDITION' Call GetNamespace) != 1) then { + _vehicle setVehicleInit Format ["this addAction [localize 'STR_WF_BuildMenu_Repair','Client\Action\Action_BuildRepair.sqf', [], 99, false, true, '', 'side player == side _target && alive _target && player distance _target <= %1'];this addAction [localize 'STR_WF_Repair_MHQ','Client\Action\Action_RepairMHQ.sqf', [], 98, false, true, '', 'alive _target']",'WFBE_REPAIRTRUCKRANGE' Call GetNamespace]; + } else { + _vehicle setVehicleInit Format ["this addAction [localize 'STR_WF_BuildMenu_Repair','Client\Action\Action_BuildRepair.sqf', [], 99, false, true, '', 'side player == side _target && alive _target && player distance _target <= %1']",'WFBE_REPAIRTRUCKRANGE' Call GetNamespace]; + }; + processInitCommands; + }; + + //--- Supply Truck. + if (_unit in (Format['WFBE_%1SUPPLYTRUCKS',sideJoinedText] Call GetNamespace)) then {[_vehicle,sideJoined] ExecFSM 'Client\FSM\updatesupply.fsm'}; + + //--- Salvage Truck. + if (_unit in (Format['WFBE_%1SALVAGETRUCK',sideJoinedText] Call GetNamespace)) then {[_vehicle] ExecFSM 'Client\FSM\updatesalvage.fsm'}; + + //--- Deal with ship units. + if (_unit isKindOf "Ship") then {_vehicle addAction [localize "STR_WF_Push","Client\Action\Action_Push.sqf", [], 93, false, true, "", "driver _target == _this && alive _target && speed _target < 30"]}; + + //--- Deal with Air units. + if (_unit isKindOf "Air") then { + _init = ""; + + //--- Add HALO + Cargo Eject to the vehicle if it can transport soldiers. + if !(_isMan) then { + if ((getNumber (configFile >> 'CfgVehicles' >> _unit >> 'transportSoldier')) > 0) then { + _init = _init + Format["this AddAction ['HALO','Client\Action\Action_HALO.sqf', [], 97, false, true, '', 'getPos _target select 2 >= %1 && alive _target'];this addAction [localize 'STR_WF_Cargo_Eject','Client\Action\Action_EjectCargo.sqf', [], 99, false, true, '', 'driver _target == _this && alive _target'];",('WFBE_HALOJUMPHEIGHT' Call GetNamespace)]; + }; + }; + + //--- Countermeasures parameter (Vanilla). + if (paramCounterMeasures) then { + _upgrades = (sideJoinedText) Call GetSideUpgrades; + if (_upgrades select 9 > 0) then {_init = _init + "nullReturn = [this] ExecVM 'Client\Module\CM\CM_Init.sqf';this addEventHandler ['incomingMissile',{_this Spawn CM_Countermeasures}];"}; + }; + + //--- AAR Tracking. + if (paramAARadar) then {_init = _init + Format["nullReturn = [this,%1] ExecVM 'Common\Common_AARadarMarkerUpdate.sqf';",sideJoined]}; + + //--- Planes have a Taxi Reverse feature. + if (_unit isKindOf "Plane") then {_vehicle addAction [localize "STR_WF_TaxiReverse","Client\Action\Action_TaxiReverse.sqf", [], 92, false, true, "", "driver _target == _this && alive _target && speed _target < 4 && speed _target > -4 && getPos _target select 2 < 4"]}; + + //--- Process the init. + if (_init != "") then {_vehicle setVehicleInit _init; processInitCommands}; + }; + + //--- Units Balancing. + if (_unit in ('WFBE_BALANCEDUNITS' Call GetNamespace) && paramBalancing) then {[_vehicle] Spawn BalanceInit}; + + //--- Are we dealing with an artillery unit. + _isArtillery = [_unit,sideJoinedText] Call IsArtillery; + if (_isArtillery != -1) then {[_vehicle,_isArtillery,sideJoinedText] Call EquipArtillery}; + + /* Section: Creation */ + + [sideJoinedText,'VehiclesCreated',1] Call UpdateStatistics; + _built = 0; + _group addVehicle _vehicle; + + //--- Empty Vehicle. + if (!_driver && !_gunner && !_commander) exitWith {}; + + //--- Crew Management. + _crew = Format ["WFBE_%1SOLDIER",sideJoinedText] Call GetNamespace; + if (_unit isKindOf "Tank") then {_crew = Format ["WFBE_%1CREW",sideJoinedText] Call GetNamespace}; + if (_unit isKindOf "Air") then {_crew = Format ["WFBE_%1PILOT",sideJoinedText] Call GetNamespace}; + + //--- Driver. + if (_driver) then { + _soldier = [_crew,_group,_position,sideJoined] Call CreateMan; + [_soldier] allowGetIn true; + _soldier moveInDriver _vehicle; + }; + + //--- Gunner. + if (_gunner) then { + _soldier = [_crew,_group,_position,sideJoined] Call CreateMan; + [_soldier] allowGetIn true; + _soldier moveInGunner _vehicle; + }; + + //--- Commander. + if (_commander) then { + _soldier = [_crew,_group,_position,sideJoined] Call CreateMan; + [_soldier] allowGetIn true; + _soldier moveInCommander _vehicle; + }; + + //--- Extra vehicle turrets. + if (_extracrew) then { + Private ["_turrets"]; + _turrets = _currentUnit select QUERYUNITTURRETS; + + { + if (isNull (_vehicle turretUnit _x)) then { + _soldier = [_crew,_group,_position,sideJoined] Call CreateMan; + [_soldier] allowGetIn true; + _soldier moveInTurret [_vehicle, _x]; + }; + } forEach _turrets; + }; + [sideJoinedText,'UnitsCreated',_cpt] Call UpdateStatistics; +}; + +unitQueu = unitQueu - _cpt; + +[Format["WFBE_C_QUEUE_%1",_factory],(Format["WFBE_C_QUEUE_%1",_factory] Call GetNamespace)-1,true] Call SetNamespace; +hint parseText(Format [localize "STR_WF_INFO_Build_Complete",_description]); \ No newline at end of file diff --git a/Client/Functions/Client_ChangePlayerFunds.sqf b/Client/Functions/Client_ChangePlayerFunds.sqf new file mode 100644 index 0000000..6732640 --- /dev/null +++ b/Client/Functions/Client_ChangePlayerFunds.sqf @@ -0,0 +1 @@ +[clientTeam, _this] Call ChangeTeamFunds; \ No newline at end of file diff --git a/Client/Functions/Client_CommandChatMessage.sqf b/Client/Functions/Client_CommandChatMessage.sqf new file mode 100644 index 0000000..38de886 --- /dev/null +++ b/Client/Functions/Client_CommandChatMessage.sqf @@ -0,0 +1 @@ +player commandChat _this; \ No newline at end of file diff --git a/Client/Functions/Client_CommanderUpgrade.sqf b/Client/Functions/Client_CommanderUpgrade.sqf new file mode 100644 index 0000000..366fa31 --- /dev/null +++ b/Client/Functions/Client_CommanderUpgrade.sqf @@ -0,0 +1,34 @@ +private ["_i","_index","_index2","_name","_time","_upgrades"]; +_time = _this select 0; +_index = _this select 1; +_index2 = _this select 2; +_name = _this select 3; +isUpgrading = true; + +hint Format [localize "STR_WF_Upgrade_Start",_name]; + +WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERUPGRADESCORE' Call GetNamespace)]]; +publicVariable 'WFBE_RequestChangeScore'; +if (!isMultiplayer || (isServer && local player)) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERUPGRADESCORE' Call GetNamespace)]] Spawn HandleSPVF}; + +_i = _time; +while {_i > 0} do { + _i = _i - 1; + upgradingTime = _i; + sleep 1; +}; +_upgrades = (sideJoinedText) Call GetSideUpgrades; +_upgrades Set [_index,_index2 + 1]; +Call Compile Format ["%1Upgrades = _upgrades; publicVariable '%1Upgrades';",sideJoinedText]; +upgradingTime = -1; +isUpgrading = false; +hint Format [localize "STR_WF_Upgrade_Complete",_name,_index2 + 1]; +WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['UpgradeComplete',_index,(_index2 + 1)]]; +publicVariable 'WFBE_LocalizeMessage'; +if (!isMultiplayer || (isServer && local player) || local player) then {[sideJoined,'CLTFNCLOCALIZEMESSAGE',['UpgradeComplete',_index,(_index2 + 1)]] Spawn HandlePVF}; + +sleep 0.3; + +WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',['upgrade',sideJoined]]; +publicVariable 'WFBE_RequestSpecial'; +if (!isMultiplayer || (isServer && local player)) then {['SRVFNCREQUESTSPECIAL',['upgrade',sideJoined]] Spawn HandleSPVF}; diff --git a/Client/Functions/Client_DebugHint.sqf b/Client/Functions/Client_DebugHint.sqf new file mode 100644 index 0000000..5c6af51 --- /dev/null +++ b/Client/Functions/Client_DebugHint.sqf @@ -0,0 +1,8 @@ +Private ["_string"]; + +_string = _this; +if (isMultiplayer) then { + hint _string; +} else { + hintC _string; +}; \ No newline at end of file diff --git a/Client/Functions/Client_DisplayInventory.sqf b/Client/Functions/Client_DisplayInventory.sqf new file mode 100644 index 0000000..7765609 --- /dev/null +++ b/Client/Functions/Client_DisplayInventory.sqf @@ -0,0 +1,98 @@ +Private ['_cost','_count','_get','_inventoryGUI','_inventorySlots','_items','_loadout','_misca','_miscInvGUI','_miscItemSlots','_primary','_secondary','_sidearm','_sidearmInvGUI','_sidearmInventorySlots','_slot','_sorted']; +_loadout = _this select 0; +_items = _this select 1; + +_inventoryGUI = 3503; +_sidearmInvGUI = 3515; +_miscInvGUI = 3523; + +for [{_count = 0},{_count < 12},{_count = _count + 1}] do {CtrlSetText[_inventoryGUI + _count,"\Ca\UI\Data\ui_gear_mag_gs.paa"]}; +for [{_count = 0},{_count < 8},{_count = _count + 1}] do {CtrlSetText[_sidearmInvGUI + _count,"\Ca\UI\Data\ui_gear_mag_gs.paa"]}; +for [{_count = 0},{_count < 12},{_count = _count + 1}] do {CtrlSetText[_miscInvGUI + _count,"\Ca\UI\Data\ui_gear_eq_gs.paa"]}; + +_cost = 0; +_slot = 0; +_inventorySlots = []; +_sidearmInventorySlots = []; +_miscItemSlots = []; + +_primary = []; +_secondary = []; +_sidearm = []; +_misca = []; + +{ + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + switch (_get select QUERYGEARTYPE) do { + case 'primary': {_primary = _primary + [_x]}; + case 'secondary': {_secondary = _secondary + [_x]}; + case 'sidearm': {_sidearm = _sidearm + [_x]}; + case 'CfgMagazines': {_misca = _misca + [_x]}; + case 'CfgWeapons': {_misca = _misca + [_x]}; + }; + }; + +} forEach _loadout; + +_sorted = _primary + _secondary + _misca; +_sidearm = _sidearm + _misca; + +{ + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + if (!(_get select QUERYGEARHANDGUNPOOL)) then { + ctrlSetText[_inventoryGUI + _slot,(_get select QUERYGEARPICTURE)]; + _cost = _cost + (_get select QUERYGEARCOST); + _slot = _slot + 1; + _inventorySlots = _inventorySlots + [_x]; + for [{_count = (_get Select QUERYGEARSPACE) - 1},{_count > 0},{_count = _count - 1}] do { + ctrlSetText[_inventoryGUI + _slot,""]; + _slot = _slot + 1; + _inventorySlots = _inventorySlots + [""]; + }; + }; + }; +} forEach _sorted; + +_slot = 0; + +{ + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + if (_get select QUERYGEARHANDGUNPOOL) then { + ctrlSetText[_sidearmInvGUI + _slot,(_get select QUERYGEARPICTURE)]; + _cost = _cost + (_get select QUERYGEARCOST); + _slot = _slot + 1; + _sidearmInventorySlots = _sidearmInventorySlots + [_x]; + for [{_count = (_get Select QUERYGEARSPACE) - 1},{_count > 0},{_count = _count - 1}] do { + ctrlSetText[_sidearmInvGUI + _slot,""]; + _slot = _slot + 1; + _sidearmInventorySlots = _sidearmInventorySlots + [""]; + }; + }; + }; +} forEach _sidearm; + +_slot = 0; + +{ + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + CtrlSetText[_miscInvGUI + _slot,(_get select QUERYGEARPICTURE)]; + _slot = _slot + 1; + _miscItemSlots = _miscItemSlots + [_x]; + _cost = _cost + (_get select QUERYGEARCOST); + for [{_count = (_get Select QUERYGEARSPACE) - 1},{_count > 0},{_count = _count - 1}] do { + ctrlSetText[_miscInvGUI + _slot,""]; + _slot = _slot + 1; + _miscItemSlots = _miscItemSlots + [""]; + }; + }; +} forEach _items; + +[_inventorySlots,_sidearmInventorySlots,_miscItemSlots,_cost] \ No newline at end of file diff --git a/Client/Functions/Client_EquipDefaultLoadout.sqf b/Client/Functions/Client_EquipDefaultLoadout.sqf new file mode 100644 index 0000000..29c2f45 --- /dev/null +++ b/Client/Functions/Client_EquipDefaultLoadout.sqf @@ -0,0 +1,17 @@ +private ["_unit", "_defaultWeap", "_defaultAmmo"]; + +_unit = _this; + +_defaultWeap = Format ["WFBE_%1DEFAULTWEAPONS",sideJoinedText] Call GetNamespace; +_defaultAmmo = Format ["WFBE_%1DEFAULTAMMO",sideJoinedText] Call GetNamespace; + +if (paramAceWounds) then +{ + _defaultAmmo = _defaultAmmo + [ 'ACE_Bandage', 'ACE_Bandage', 'ACE_Morphine', 'ACE_Morphine' ]; + if(getNumber(configFile >> "CfgVehicles" >> (typeOf _unit) >> "attendant") == 1) then + { + _defaultAmmo = _defaultAmmo + [ 'ACE_Epinephrine', 'ACE_Epinephrine', 'ACE_Medkit', 'ACE_Medkit' ]; + }; +}; + +[_unit,_defaultWeap,_defaultAmmo] Call EquipLoadout; \ No newline at end of file diff --git a/Client/Functions/Client_FX.sqf b/Client/Functions/Client_FX.sqf new file mode 100644 index 0000000..7fc9d21 --- /dev/null +++ b/Client/Functions/Client_FX.sqf @@ -0,0 +1,50 @@ +Private ["_index"]; +_index = _this select 0; + +switch (_index) do { + case 0: { + // None. + "colorCorrections" ppEffectEnable false; + "chromAberration" ppEffectEnable false; + "radialBlur" ppEffectEnable false; + "filmGrain" ppEffectEnable false; + }; + case 1: { + // High contrast postprocess added. + "colorCorrections" ppEffectAdjust [1, 0.9, -0.002, [0.0, 0.0, 0.0, 0.0], [1.0, 0.6, 0.4, 0.6], [0.199, 0.587, 0.114, 0.0]]; + "colorCorrections" ppEffectCommit 1; + "colorCorrections" ppEffectEnable true; + }; + case 2: { + // Blue color corrections added (movie night style). + "colorCorrections" ppEffectAdjust [1, 1, 0, [0.0, 0.0, 0.0, 0.0], [0.6, 0.6, 1.8, 0.7], [0.199, 0.587, 0.114, 0.0]]; + "colorCorrections" ppEffectCommit 1; + "colorCorrections" ppEffectEnable true; + }; + case 3: { + // Color corrections. + "colorCorrections" ppEffectAdjust [1, 0.8, -0.002, [0.0, 0.0, 0.0, 0.0], [0.6, 0.7, 0.8, 0.65], [0.199, 0.587, 0.114, 0.0]]; + "colorCorrections" ppEffectCommit 1; + "colorCorrections" ppEffectEnable true; + }; + case 4: { + // Color corrections. + "colorCorrections" ppEffectAdjust [1, 1, -0.0045, [0.0, 0.0, 0.0, 0.0], [1, 0.6, 0.4, 0.4], [0.199, 0.587, 0.114, 0.0]]; + "colorCorrections" ppEffectCommit 1; + "colorCorrections" ppEffectEnable true; + // Light film grain. + "filmGrain" ppEffectEnable true; + "filmGrain" ppEffectAdjust [0.02, 1, 1, 0.1, 1, false]; + "filmGrain" ppEffectCommit 1; + }; + case 5: { + // Color corrections. + "colorCorrections" ppEffectAdjust [1, 1, -0.002, [0.1, 0.05, 0.0, 0.02], [1.2, 1.0, 0.8, 0.666], [0.5, 0.5, 0.5, 0.0]]; + "colorCorrections" ppEffectCommit 1; + "colorCorrections" ppEffectEnable true; + // Light film grain. + "filmGrain" ppEffectEnable true; + "filmGrain" ppEffectAdjust [0.02, 1, 1, 0.1, 1, false]; + "filmGrain" ppEffectCommit 1; + }; +}; \ No newline at end of file diff --git a/Client/Functions/Client_GetIncome.sqf b/Client/Functions/Client_GetIncome.sqf new file mode 100644 index 0000000..c3e2529 --- /dev/null +++ b/Client/Functions/Client_GetIncome.sqf @@ -0,0 +1,33 @@ +Private["_commanderTeam","_income","_incomeSystem","_side"]; + +_side = _this; +_incomeSystem = 'WFBE_INCOMESYSTEM' Call GetNamespace; +_income = (_side) Call GetTownsIncome; + +switch (_incomeSystem) do { + case 2: {_income = round(_income /2)}; + case 3: { + Private["_ply"]; + _commanderTeam = (_side) Call GetCommanderTeam; + if (isNull _commanderTeam) then {_commanderTeam = grpNull}; + _ply = round(_income * (((100 - (Call Compile Format ["%1CommanderPercent",_side]))/100)/maxPlayers)); + if (_commanderTeam == group player) then { + _income = round((_income * ((Call Compile Format ["%1CommanderPercent",_side])/100)) / ('WFBE_INC_DIVIDE_COM' Call GetNamespace)) + _ply; + } else { + _income = _ply; + }; + }; + case 4: { + Private["_ply"]; + _commanderTeam = (_side) Call GetCommanderTeam; + if (isNull _commanderTeam) then {_commanderTeam = grpNull}; + _ply = round(_income * (100 - (Call Compile Format ["%1CommanderPercent",_side])) / 100); + if (_commanderTeam == group player) then { + _income = _ply + round((_income - _ply)*maxPlayers); + } else { + _income = _ply; + }; + }; +}; + +_income \ No newline at end of file diff --git a/Client/Functions/Client_GetMarkerColoration.sqf b/Client/Functions/Client_GetMarkerColoration.sqf new file mode 100644 index 0000000..33920a6 --- /dev/null +++ b/Client/Functions/Client_GetMarkerColoration.sqf @@ -0,0 +1 @@ +Private ["_color","_colorationMode","_colorFor"]; _colorFor = _this; _colorationMode = 'WFBE_MAPCOLORATION' Call GetNamespace; _color = ""; switch (_colorFor) do { case "Friendly": { switch (_colorationMode) do { case 0: {_color = "ColorGreen"}; case 1: {_color = if (sideJoined == west) then {"ColorBlue"} else {"ColorRed"}}; }; }; case "Enemy": { switch (_colorationMode) do { case 0: {_color = "ColorRed"}; case 1: {_color = if (sideJoined == west) then {"ColorRed"} else {"ColorBlue"}}; }; }; case "Resistance": { switch (_colorationMode) do { case 0: {_color = "ColorBlue"}; case 1: {_color = "ColorGreen"}; }; }; case "Leader": { switch (_colorationMode) do { case 0: {_color = "ColorBlue"}; case 1: {_color = "ColorBlue"}; }; }; }; _color \ No newline at end of file diff --git a/Client/Functions/Client_GetPlayerFunds.sqf b/Client/Functions/Client_GetPlayerFunds.sqf new file mode 100644 index 0000000..6c8989d --- /dev/null +++ b/Client/Functions/Client_GetPlayerFunds.sqf @@ -0,0 +1 @@ +(clientTeam) Call GetTeamFunds \ No newline at end of file diff --git a/Client/Functions/Client_GetRespawnAvailable.sqf b/Client/Functions/Client_GetRespawnAvailable.sqf new file mode 100644 index 0000000..4155ee8 --- /dev/null +++ b/Client/Functions/Client_GetRespawnAvailable.sqf @@ -0,0 +1,58 @@ +Private ["_availableSpawn","_buildings","_checks","_deathLoc","_farps","_hq","_mobileRespawns","_range","_side","_sideText","_upgrades"]; + +_side = _this select 0; +_deathLoc = _this select 1; +_sideText = str _side; + +//--- Base. +_hq = (_sideText) Call GetSideHQ; +_availableSpawn = [_hq]; +_buildings = (_sideText) Call GetSideStructures; +_checks = [_side,Format ["WFBE_%1BARRACKSTYPE",_sideText] Call GetNamespace,_buildings] Call GetFactories; +if (count _checks > 0) then {_availableSpawn = _availableSpawn + _checks}; +_checks = [_side,Format ["WFBE_%1LIGHTTYPE",_sideText] Call GetNamespace,_buildings] Call GetFactories; +if (count _checks > 0) then {_availableSpawn = _availableSpawn + _checks}; +_checks = [_side,Format ["WFBE_%1COMMANDCENTERTYPE",_sideText] Call GetNamespace,_buildings] Call GetFactories; +if (count _checks > 0) then {_availableSpawn = _availableSpawn + _checks}; +_checks = [_side,Format ["WFBE_%1HEAVYTYPE",_sideText] Call GetNamespace,_buildings] Call GetFactories; +if (count _checks > 0) then {_availableSpawn = _availableSpawn + _checks}; +_checks = [_side,Format ["WFBE_%1AIRCRAFTTYPE",_sideText] Call GetNamespace,_buildings] Call GetFactories; +if (count _checks > 0) then {_availableSpawn = _availableSpawn + _checks}; +_checks = [_side,Format ["WFBE_%1SERVICEPOINTTYPE",_sideText] Call GetNamespace,_buildings] Call GetFactories; +if (count _checks > 0) then {_availableSpawn = _availableSpawn + _checks}; + +//--- HQ is dead, but we can spawn at other buildings. +if (!alive _hq && count _availableSpawn > 1) then {_availableSpawn = _availableSpawn - [_hq]}; + +//--- Mobile respawn. +if (paramMobileRespawn) then { + _mobileRespawns = Format ["WFBE_%1AMBULANCES",_sideText] Call GetNamespace; + _upgrades = (_sideText) Call GetSideUpgrades; + _range = (Format["WFBE_RESPAWNMOBILERANGE%1",(_upgrades select 7)] Call GetNamespace); + _checks = _deathLoc nearEntities[_mobileRespawns,_range]; + if (count _checks > 0) then { + { + if (_x emptyPositions "cargo" > 0) then { + _availableSpawn = _availableSpawn + [_x]; + }; + } forEach _checks; + }; +}; + +//--- MASH. +if (paramRespawnMASH) then { + _farps = Format ["WFBE_%1FARP",_sideText] Call GetNamespace; + _upgrades = (_sideText) Call GetSideUpgrades; + _range = (Format["WFBE_RESPAWNMOBILERANGE%1",(_upgrades select 7)] Call GetNamespace); + _checks = nearestObjects [_deathLoc, [_farps], _range]; + if (count _checks > 0) then { + {if (alive _x) then {_availableSpawn = _availableSpawn + [_x]}} forEach _checks; + }; +}; + +//--- Camps. +if (('WFBE_RESPAWNCAMPSMODE' Call GetNamespace) > 0) then { + _availableSpawn = _availableSpawn + ([_deathLoc, _side] Call GetRespawnCamps); +}; + +_availableSpawn \ No newline at end of file diff --git a/Client/Functions/Client_GetStructureMarkerLabel.sqf b/Client/Functions/Client_GetStructureMarkerLabel.sqf new file mode 100644 index 0000000..50e14bb --- /dev/null +++ b/Client/Functions/Client_GetStructureMarkerLabel.sqf @@ -0,0 +1,16 @@ +Private["_class","_label","_structure"]; + +_structure = _this Select 0; + +_label = ""; +_class = TypeOf _structure; + +if (_class == EASTBAR || _class == WESTBAR) then {_label = "B"}; +if (_class == EASTLVF || _class == WESTLVF) then {_label = "L"}; +if (_class == EASTCC || _class == WESTCC) then {_label = "C"}; +if (_class == EASTHEAVY || _class == WESTHEAVY) then {_label = "H"}; +if (_class == EASTAIR || _class == WESTAIR) then {_label = "A"}; +if (_class == EASTSP || _class == WESTSP) then {_label = "S"}; +if (_class == EASTAAR || _class == WESTAAR) then {_label = "AAR"}; + +_label \ No newline at end of file diff --git a/Client/Functions/Client_GetTime.sqf b/Client/Functions/Client_GetTime.sqf new file mode 100644 index 0000000..995efdc --- /dev/null +++ b/Client/Functions/Client_GetTime.sqf @@ -0,0 +1 @@ +Private ["_days","_hours","_minutes","_seconds","_uptime"]; _days = 0; _hours = 0; _minutes = 0; _seconds = 0; _uptime = time; _days = floor(_uptime / 86400); _hours = floor((_uptime - (_days * 86400)) / 3600); _minutes = floor((_uptime - (_hours * 3600) - (_days * 86400)) / 60); _seconds = floor(_uptime - (_minutes * 60) - (_hours * 3600) -(_days * 86400)); [_days,_hours,_minutes,_seconds] \ No newline at end of file diff --git a/Client/Functions/Client_GroupChatMessage.sqf b/Client/Functions/Client_GroupChatMessage.sqf new file mode 100644 index 0000000..f13fb76 --- /dev/null +++ b/Client/Functions/Client_GroupChatMessage.sqf @@ -0,0 +1 @@ +player groupChat _this \ No newline at end of file diff --git a/Client/Functions/Client_HandleHQAction.sqf b/Client/Functions/Client_HandleHQAction.sqf new file mode 100644 index 0000000..b8e4e60 --- /dev/null +++ b/Client/Functions/Client_HandleHQAction.sqf @@ -0,0 +1,12 @@ +Private ['_hq']; +_hq = _this; + +if (isNull _hq) exitWith {}; + +/* Lag Handler */ +while {!isNull _hq} do { + canBuildWHQ = false; + sleep 0.21; +}; + +canBuildWHQ = true; \ No newline at end of file diff --git a/Client/Functions/Client_HandleOnMap.sqf b/Client/Functions/Client_HandleOnMap.sqf new file mode 100644 index 0000000..c98f961 --- /dev/null +++ b/Client/Functions/Client_HandleOnMap.sqf @@ -0,0 +1,17 @@ +Private ['_isOnMap','_timeToKill']; + +_timeToKill = 'WFBE_OFFMAPMAXTIME' Call GetNamespace; +paramBoundariesRunning = true; + +while {true} do { + sleep 1; + _isOnMap = Call BoundariesIsOnMap; + if !(_isOnMap) then { + hint parseText(Format[localize 'STR_WF_INFO_OffmapWarning',_timeToKill]); + _timeToKill = _timeToKill - 1; + }; + if (_timeToKill < 0 || _isOnMap || !(alive player)) exitWith { + if !(_isOnMap && alive player) then {(vehicle player) setDamage 1}; + paramBoundariesRunning = false; + }; +}; \ No newline at end of file diff --git a/Client/Functions/Client_HandlePVF.sqf b/Client/Functions/Client_HandlePVF.sqf new file mode 100644 index 0000000..3d61118 --- /dev/null +++ b/Client/Functions/Client_HandlePVF.sqf @@ -0,0 +1,30 @@ +/* + description: + - New network system handler. + destination: + - Nil: Everyone + - String: vehicleVarName of the unit to trigger on. + - Side: A side + note: + - addPublicVariableEventHandler is triggered everywhere BUT on the caller. + usage: + - [destination,client PVF to run,parameters] +*/ + +Private ["_destination","_exit","_parameters","_publicVar","_script"]; +_publicVar = _this; +_exit = true; + +_destination = _publicVar select 0; +if (isNil '_destination') then {_destination = 0;_exit = false}; +if (typeName(_destination) == 'SIDE') then {if (sideJoined == _destination) then {_exit = false}}; +if (typeName(_destination) == 'STRING') then { + if (vehicleVarName player == _destination) then {_exit = false}; +}; + +if (_exit) exitWith {}; + +_script = _publicVar select 1; +_parameters = if (count _this > 2) then {_publicVar select 2} else {[]}; + +_parameters Spawn (Call Compile _script); \ No newline at end of file diff --git a/Client/Functions/Client_InitTownsAndCamps.sqf b/Client/Functions/Client_InitTownsAndCamps.sqf new file mode 100644 index 0000000..cdddcbc --- /dev/null +++ b/Client/Functions/Client_InitTownsAndCamps.sqf @@ -0,0 +1,40 @@ +Private ["_camp","_campSideID","_camps","_count","_count1","_marker","_town","_townSideID"]; + +for [{_count = totalTowns - 1},{_count >= 0},{_count = _count - 1}] do { + _town = towns select _count; + _townSideID = _town getVariable "sideID"; + + if (sideID == _townSideID) then { + _marker = Format["%1Depot",str _town]; + _marker setMarkerColorLocal ("Friendly" Call GetMarkerColoration); + }; + + while {true} do { + sleep .005; + _camps = _town getVariable "camps"; + if !(isNil "_camps") exitWith {}; + }; + _camps = _town getVariable "camps"; + + for [{_count1 = count _camps - 1},{_count1 >= 0},{_count1 = _count1 - 1}] do { + _camp = _camps select _count1; + if !(isNull _camp) then { + _marker = Format["%1Camp%2",str _town,_camps find _camp]; + + while {true} do { + sleep .005; + _campSideID = _camp getVariable "sideID"; + if !(isNil "_campSideID") exitWith {}; + }; + _campSideID = _camp getVariable "sideID"; + + if (sideID == _campSideID) then { + _marker setMarkerColorLocal ("Friendly" Call GetMarkerColoration); + } else{ + if (_townSideID == sideID) then { + _marker setMarkerColorLocal ("Enemy" Call GetMarkerColoration); + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/Client/Functions/Client_IsOnMap.sqf b/Client/Functions/Client_IsOnMap.sqf new file mode 100644 index 0000000..db72724 --- /dev/null +++ b/Client/Functions/Client_IsOnMap.sqf @@ -0,0 +1,17 @@ +Private ['_adis','_bdis','_borderdis','_boundary','_difx','_dify','_dir','_position','_positiondis','_sqrradH','_sqrradHR']; + +_boundary = 'WFBE_BOUNDARIESXY' Call GetNamespace; +_sqrradH = _boundary / 2; +_sqrradHR = [_sqrradH,_sqrradH]; +_position = [getPos player select 0, getPos player select 1]; + +_difx = (_position select 0) - _sqrradH; +_dify = (_position select 1) - _sqrradH; +_dir = atan (_difx / _dify); +if (_dify < 0) then {_dir = _dir + 180}; +_adis = abs (_sqrradH / cos (90 - _dir)); +_bdis = abs (_sqrradH / cos _dir); +_borderdis = _adis min _bdis; +_positiondis = _position distance _sqrradHR; + +if (_positiondis < _borderdis) then {true} else {false} \ No newline at end of file diff --git a/Client/Functions/Client_MarkerAnim.sqf b/Client/Functions/Client_MarkerAnim.sqf new file mode 100644 index 0000000..beb85b2 --- /dev/null +++ b/Client/Functions/Client_MarkerAnim.sqf @@ -0,0 +1,45 @@ +Private ["_additionalErase","_direction","_expand","_markerColor","_markerMax","_markerMin","_markerName","_markerPosition","_markerSize","_markerType"]; +_markerName = _this select 0; +_markerPosition = _this select 1; +_markerType = _this select 2; +_markerSize = _this select 3; +_markerColor = _this select 4; +_markerMin = _this select 5; +_markerMax = _this select 6; +_additionalErase = ""; +if (count _this > 7) then {_additionalErase = _this select 7}; + +deleteMarkerLocal _markerName; +CreateMarkerLocal [_markerName,_markerPosition]; +_markerName setMarkerTypeLocal _markerType; +_markerName setMarkerColorLocal _markerColor; +_markerName setMarkerSizeLocal [_markerSize,_markerSize]; + +_difference = (_markerMax - _markerMin)/10; +_direction = 0; +_expand = true; +activeAnimMarker = true; + +if (_additionalErase != "") then { + Private ["_pr"]; + _pr = 'WFBE_PATROLRANGE' Call GetNamespace; + createMarkerLocal [_additionalErase,_markerPosition]; + _additionalErase setMarkerShapeLocal "Ellipse"; + _additionalErase setMarkerColorLocal _markerColor; + _additionalErase setMarkerSizeLocal [_pr,_pr]; +}; + +while {activeAnimMarker} do { + sleep 0.03; + + _direction = (_direction + 1) % 360; + _markerName setMarkerDirLocal _direction; + _markerName setMarkerSizeLocal [_markerSize,_markerSize]; + + if (_markerSize > _markerMax) then {_expand = false}; + if (_markerSize < _markerMin) then {_expand = true}; + if (_expand) then {_markerSize = _markerSize + _difference} else {_markerSize = _markerSize - _difference}; +}; + +deleteMarkerLocal _markerName; +if (_additionalErase != "") then {deleteMarkerLocal _additionalErase}; \ No newline at end of file diff --git a/Client/Functions/Client_OnRespawnHandler.sqf b/Client/Functions/Client_OnRespawnHandler.sqf new file mode 100644 index 0000000..fe6c57d --- /dev/null +++ b/Client/Functions/Client_OnRespawnHandler.sqf @@ -0,0 +1,78 @@ +Private ["_buildings","_charge","_funds","_loadDefault","_listbp","_mode","_price","_safeArray","_skip","_spawn","_spawnInside","_temp","_unit","_weaps"]; + +_unit = _this select 0; +_spawn = _this select 1; +_loadDefault = true; + +//--- Respawn. +_spawnInside = false; +if ((typeOf _spawn) in (Format ["WFBE_%1AMBULANCES",sideJoinedText] Call GetNamespace) && alive _spawn) then { + if (_spawn emptyPositions "cargo" > 0 && !(locked _spawn)) then {_unit moveInCargo _spawn;_spawnInside = true}; +}; + +if !(_spawnInside) then {_unit setPos ([getPos _spawn,10,20] Call GetRandomPosition)}; + +//--- Loadout. +if (!isNil "respawnWeapons" && !WFBE_RespawnDefaultGear) then { + _mode = 'WFBE_RESPAWNPENALTY' Call GetNamespace; + + if (_mode in [0,2,3,4,5]) then { + //--- Calculate the price/funds. + if (_mode != 0) then { + _price = 0; + + //--- Get the mode pricing. + switch (_mode) do { + case 2: {_price = respawnGearCost}; + case 3: {_price = round(respawnGearCost/2)}; + case 4: {_price = round(respawnGearCost/4)}; + case 5: {_price = respawnGearCost}; + }; + + //--- Are we charging only on mobile respawn? + _charge = true; + if (_mode == 5) then { + _buildings = (sideJoinedText) Call GetSideStructures; + if (_spawn in _buildings || _spawn == ((sideJoinedText) Call GetSideHQ)) then {_charge = false}; + }; + + if (_charge) then { + //--- Charge if possible. + _funds = Call GetPlayerFunds; + if (_funds < _price) then { + // Just take it down to zero. + _price = _funds; + }; + -(_price) Call ChangePlayerFunds; + (Format[localize 'STR_WF_CHAT_Gear_RespawnCharge',_price]) Call GroupChatMessage; + }; + }; + + //--- Use the respawn loadout. + if(WF_ACE) then + { + [player, respawnWeapons, respawnAmmo] Call EquipLoadout; + player setVariable ["ACE_weapononback", respawnWeaponOnBack]; + _safeArray = respawnAceRuckContents select 1; + player setVariable ["ACE_RuckMagContents", +_safeArray]; + _safeArray = respawnAceRuckContents select 0; + player setVariable ["ACE_RuckWepContents", +_safeArray]; + } + else + { + _temp = +(respawnWeapons); + _listbp = 'WFBE_BACKPACKS' Call GetNamespace; + {if (_x in _listbp) then {_temp = _temp - [_x]}} forEach respawnWeapons; + _weaps = _temp; + + [_unit,_weaps,respawnAmmo] Call EquipLoadout; + if !(WF_A2_Vanilla) then {Call RespawningBag}; + }; + _loadDefault = false; + }; +}; + +//--- Load the default loadout. +if (_loadDefault) then { + player Call EquipDefaultLoadout; +}; \ No newline at end of file diff --git a/Client/Functions/Client_PreRespawnHandler.sqf b/Client/Functions/Client_PreRespawnHandler.sqf new file mode 100644 index 0000000..189fe60 --- /dev/null +++ b/Client/Functions/Client_PreRespawnHandler.sqf @@ -0,0 +1,15 @@ +Private ["_hq","_unit"]; + +_unit = _this; + +(_unit) Call WFBE_SK_FNC_Apply; +[] ExecFSM "Client\FSM\updateactions.fsm"; + +Options = _unit addAction ["" + (localize "STR_WF_Options") + "","Client\Action\Action_Menu.sqf", "", 1, false, true, "", "_target == player"]; + +if (!isNull commanderTeam) then { + _hq = (sideJoinedText) Call GetSideHQ; + if (commanderTeam == group _unit) then {HQAction = _unit addAction [localize "STR_WF_BuildMenu","Client\Action\Action_Build.sqf", [_hq], 100, false, true, "", "hqInRange && canBuildWHQ && (_target == player)"]}; +}; + +[sideJoinedText,'UnitsCreated',1] Call UpdateStatistics; \ No newline at end of file diff --git a/Client/Functions/Client_ReplaceArray.sqf b/Client/Functions/Client_ReplaceArray.sqf new file mode 100644 index 0000000..b05136c --- /dev/null +++ b/Client/Functions/Client_ReplaceArray.sqf @@ -0,0 +1,12 @@ +Private ['_array','_indexExcluded','_newArray','_z']; +_array = _this select 0; +_indexExcluded = _this select 1; + +_newArray = []; +for [{_z = 0},{_z < count(_array)},{_z = _z + 1}] do { + if (_z != _indexExcluded) then { + _newArray = _newArray + [_array select _z]; + }; +}; + +_newArray \ No newline at end of file diff --git a/Client/Functions/Client_ReplaceInventoryAmmo.sqf b/Client/Functions/Client_ReplaceInventoryAmmo.sqf new file mode 100644 index 0000000..810e4e2 --- /dev/null +++ b/Client/Functions/Client_ReplaceInventoryAmmo.sqf @@ -0,0 +1,65 @@ +Private ['_freeSpace','_futureSpace','_get','_limit','_magazines','_newMag','_newMagIsSide','_newMagSpace','_oldMags','_presentMags','_replacement','_rlIndex','_size','_spaceToReduce','_totalToReplace','_z']; +_newMag = _this select 0; +_oldMags = _this select 1; +_magazines = _this select 2; + +_presentMags = []; +_replacement = []; +_size = 0; +_spaceToReduce = 0; + +{ + Private['_cmag','_ct']; + _cmag = _x; + _ct = {_x == _cmag} count _oldMags; + + if (_ct > 0) then { + _get = _cmag Call GetNamespace; + _presentMags = _presentMags + [_cmag]; + _spaceToReduce = _spaceToReduce + (_get select QUERYGEARSPACE); + }; +} forEach _magazines; + +if (_newMag == "") exitWith {_magazines - _presentMags}; + +_get = _newMag Call GetNamespace; +_newMagSpace = _get select QUERYGEARSPACE; +_newMagIsSide = _get select QUERYGEARHANDGUNPOOL; +_limit = if (_newMagIsSide) then {8} else {12}; + +if (_newMagIsSide) then { + { + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + if (_get select QUERYGEARHANDGUNPOOL) then { + _size = _size + (_get select QUERYGEARSPACE); + }; + }; + } forEach _magazines; +} else { + { + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + if !(_get select QUERYGEARHANDGUNPOOL) then { + _size = _size + (_get select QUERYGEARSPACE); + }; + }; + } forEach _magazines; +}; + +_totalToReplace = count _presentMags; +_freeSpace = _size - _spaceToReduce; + +_futureSpace = _totalToReplace * _newMagSpace; +while {(_futureSpace + _freeSpace) > _limit} do { + _totalToReplace = _totalToReplace - 1; + _futureSpace = _totalToReplace * _newMagSpace; +}; + +for [{_z = 0},{_z < _totalToReplace},{_z = _z + 1}] do {_replacement = _replacement + [_newMag]}; + +_magazines = (_magazines - _presentMags) + _replacement; + +_magazines \ No newline at end of file diff --git a/Client/Functions/Client_RequestFireMission.sqf b/Client/Functions/Client_RequestFireMission.sqf new file mode 100644 index 0000000..8657fa7 --- /dev/null +++ b/Client/Functions/Client_RequestFireMission.sqf @@ -0,0 +1,25 @@ +Private ["_count","_destination","_index","_type","_units"]; + +_destination = _this select 0; +_index = _this select 1; +_type = 0; + +scopeName "FireMission"; + +_units = [group player,false,_index,sideJoinedText] Call GetTeamArtillery; + +if (count _units < 1) exitWith {}; +_type = ((Format ['WFBE_%1_ARTILLERY_NAMES',sideJoinedText] Call GetNamespace) select _index) find (typeOf (_units select 0)); + +if (_type < 0) exitWith {_type}; + +_units = [group player,false,_index,sideJoinedText] Call GetTeamArtillery; +if (Count _units < 1) then {breakTo "FireMission"}; + +for [{_count = count _units - 1},{_count >= 0},{_count = _count - 1}] do { + [_units select _count,_destination,Side player,artyRange,_index] Spawn FireArtillery; +}; + +//Keep weapons reloaded. +_units = [Group player,true,_index,sideJoinedText] Call GetTeamArtillery; +{if (!someAmmo _x) then {[_x,sideJoinedText] Call RearmVehicle}} forEach _units; \ No newline at end of file diff --git a/Client/Functions/Client_RespawnBag.sqf b/Client/Functions/Client_RespawnBag.sqf new file mode 100644 index 0000000..dd20527 --- /dev/null +++ b/Client/Functions/Client_RespawnBag.sqf @@ -0,0 +1,33 @@ +private ["_add"]; + +if !(isNil 'respawnBag') then { + _add = false; + /* Player did purchase a backpack and have one by default */ + if !(isNull (unitBackPack player)) then { + /* If the backpack type is different from the current one, then we remove it */ + if (typeOf (unitBackPack player) != respawnBag) then { + removeBackpack player; + _add = true; + }; + } else { + _add = true; + }; + + /* We give a new backpack to the player */ + if (_add) then {player addBackpack respawnBag}; + + /* We clear the new backpack content */ + clearMagazineCargo (unitBackpack player); + + /* We add the player's backpack content inside the new one */ + if (count (respawnBagContent select 0) > 0) then { + for '_u' from 0 to count(respawnBagContent select 0)-1 do { + (unitBackpack player) addMagazineCargo [(respawnBagContent select 0) select _u, (respawnBagContent select 1) select _u]; + }; + }; +} else { + /* Player did not purchase a backpack but have one by default */ + if !(isNull (unitBackPack player)) then { + removeBackpack player; + }; +}; \ No newline at end of file diff --git a/Client/Functions/Client_ReturnArraySortAsc.sqf b/Client/Functions/Client_ReturnArraySortAsc.sqf new file mode 100644 index 0000000..82b1bcb --- /dev/null +++ b/Client/Functions/Client_ReturnArraySortAsc.sqf @@ -0,0 +1,30 @@ +/* Only use string ! */ +Private['_ammo','_asciAr','_copy','_i','_index','_k','_list','_lowest','_unit','_weapon','_weapons']; + +_list = _this; +_temp = []; + +_asciAr = []; +/* Get the ascii value */ +{ + _asciAr = _asciAr + [(toArray(_x)) select 0]; +} forEach _list; +_copy = +_asciAr; + +_lowest = 100000; +_index = -1; +for [{_i = 0},{_i < count _asciAr},{_i = _i + 1}] do { + /* Get Lowest */ + for [{_k = 0},{_k < count _copy},{_k = _k + 1}] do { + if (_lowest > (_copy select _k) && (_copy select _k) != -1) then { + _lowest = _copy select _k; + _index = _k; + }; + }; + + _temp = _temp + [_index]; + _copy set [_index, -1]; + _lowest = 100000; +}; + +_temp \ No newline at end of file diff --git a/Client/Functions/Client_SetControlFadeAnim.sqf b/Client/Functions/Client_SetControlFadeAnim.sqf new file mode 100644 index 0000000..941de91 --- /dev/null +++ b/Client/Functions/Client_SetControlFadeAnim.sqf @@ -0,0 +1,28 @@ +Private ["_color","_control","_duration","_text","_textcontent"]; +_control = _this select 0; +_text = _this select 1; +_duration = _this select 2; +_color = _this select 3; + +//--- Animate. +_textcontent = parsetext (Format["%2",_color,_text]); +with uinamespace do { + (currentBEDialog displayCtrl _control) ctrlSetStructuredText _textcontent; + (currentBEDialog displayCtrl _control) ctrlShow true; +}; + +_i = 0; +while {_i < _duration} do { + with uinamespace do { + (currentBEDialog displayCtrl _control) ctrlSetFade (_i % 2); + (currentBEDialog displayCtrl _control) ctrlCommit 1; + }; + + _i = _i + 1; + sleep 1; +}; + +with uinamespace do { + (currentBEDialog displayCtrl _control) ctrlSetStructuredText parseText (""); + (currentBEDialog displayCtrl _control) ctrlShow false; +}; \ No newline at end of file diff --git a/Client/Functions/Client_SetControlFadeAnimStop.sqf b/Client/Functions/Client_SetControlFadeAnimStop.sqf new file mode 100644 index 0000000..6f39abe --- /dev/null +++ b/Client/Functions/Client_SetControlFadeAnimStop.sqf @@ -0,0 +1,9 @@ +Private ["_control","_duration","_text","_textcontent"]; +_control = _this select 0; + +with uinamespace do { + if !(ctrlShown (currentBEDialog displayCtrl _control)) exitWith {}; + + (currentBEDialog displayCtrl _control) ctrlSetStructuredText parseText (""); + (currentBEDialog displayCtrl _control) ctrlShow false; +}; \ No newline at end of file diff --git a/Client/Functions/Client_SetGroupsID.sqf b/Client/Functions/Client_SetGroupsID.sqf new file mode 100644 index 0000000..6c6ab62 --- /dev/null +++ b/Client/Functions/Client_SetGroupsID.sqf @@ -0,0 +1,13 @@ +Private ["_m","_milalpha","_u"]; + +_milalpha = ["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike", +"November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-Ray","Yankee","Zulu", +"Razor","Fatman","StarForce","Frostbite","Battlemage","Manhattan","Firefly","Swordsman","Sabre","Hammer","Reaper", +"Anvil","Fortune"]; + +_u = 0; +_m = count _milalpha; +{ + if !(isNil '_x' && _u < _m) then {_x setGroupID [_milalpha select _u]}; + _u = _u + 1; +} forEach clientTeams \ No newline at end of file diff --git a/Client/Functions/Client_SupportHeal.sqf b/Client/Functions/Client_SupportHeal.sqf new file mode 100644 index 0000000..4680487 --- /dev/null +++ b/Client/Functions/Client_SupportHeal.sqf @@ -0,0 +1,99 @@ +Private ['_airCoef','_artCoef','_cts','_distanceMin','_heaCoef','_healTime','_i','_ligCoef','_name','_nearIsDP','_nearIsRT','_nearIsSP','_repairRange','_spType','_supportRange','_supports','_typeRepair','_veh']; +_veh = _this select 0; +_supports = _this select 1; +_typeRepair = _this select 2; +_spType = _this select 3; +_supportRange = 'WFBE_SUPPORTRANGE' Call GetNamespace; +_repairRange = 'WFBE_REPAIRTRUCKRANGE' Call GetNamespace; + +//--- Retrieve Informations. +_name = [typeOf _veh, 'displayName'] Call GetConfigInfo; +_healTime = 'WFBE_SUPPORTHEALTIME' Call GetNamespace; + +//--- SP? +_nearIsSP = false; +_nearIsDP = false; +_nearIsRT = false; +{ + if ((typeOf _x) == _spType) then {_nearIsSP = true}; + if ((typeOf _x) in WFDEPOT) then {_nearIsDP = true}; + if ((typeOf _x) in _typeRepair) then {_nearIsRT = true}; +} forEach _supports; + +//--- Coefficient Vary depending on the support type. +_airCoef = 1; +_artCoef = 1; +_heaCoef = 1; +_ligCoef = 1; +if (_nearIsRT) then { + _airCoef = 2.8; + _artCoef = 2.4; + _heaCoef = 2.2; + _ligCoef = 2.0; +}; +if (_nearIsDP) then { + _airCoef = 2.3; + _artCoef = 2.1; + _heaCoef = 1.9; + _ligCoef = 1.7; +}; +if (_nearIsSP) then { + _airCoef = 1.8; + _artCoef = 1.6; + _heaCoef = 1.4; + _ligCoef = 1.2; +}; + +//--- Class Malus. +if (_veh isKindOf 'Air') then {_healTime = round(_healTime * (_airCoef + getDammage _veh))}; +if (_veh isKindOf 'StaticWeapon') then {_healTime = round(_healTime * (_artCoef + getDammage _veh))}; +if (_veh isKindOf 'Tank') then {_healTime = round(_healTime * (_heaCoef + getDammage _veh))}; +if (_veh isKindOf 'Car' || _veh isKindOf 'Motorcycle') then {_healTime = round(_healTime * (_ligCoef + getDammage _veh))}; + +//--- Inform the player. +hint parseText(Format[localize "STR_WF_INFO_Healing",_name,_healTime]); + +//--- Make sure that we still have something as a support. +_cts = 0; +_i = 0; +while {true} do { + sleep 1; + + //--- Check the distance & alive. + _cts = 0; + { + _distanceMin = if ((typeOf _x) in _typeRepair) then {_repairRange} else {_supportRange}; + if ((alive _x) && ((_veh distance _x) < _distanceMin)) then {_cts = _cts + 1}; + } forEach _supports; + + _i = _i + 1; + + if (_cts == 0 || !(alive _veh) || (getPos _veh) select 2 > 2) exitWith {hint parseText(Format[localize "STR_WF_INFO_Heal_Failed",_name])}; + if (_i >= _healTime) exitWith {hint parseText(Format[localize "STR_WF_INFO_Heal_Success",_name])}; +}; + +//--- Heal the damages? +if (_cts != 0) then { + if (_veh isKindOf "Man") then { + _veh setDammage 0; + if (paramAceWounds) then + { + _veh call ace_sys_wounds_fnc_RemoveBleed; + _veh call ace_sys_wounds_fnc_RemovePain; + _vel call ace_sys_wounds_fnc_RemoveUncon; + }; + } else { + _crews = crew _veh; + if (count _crews > 0) then { + { + _x setDammage 0; + if (paramAceWounds) then + { + _x call ace_sys_wounds_fnc_RemoveBleed; + _x call ace_sys_wounds_fnc_RemovePain; + _x call ace_sys_wounds_fnc_RemoveUncon; + }; + } forEach _crews + }; + }; +}; \ No newline at end of file diff --git a/Client/Functions/Client_SupportRearm.sqf b/Client/Functions/Client_SupportRearm.sqf new file mode 100644 index 0000000..ac2697e --- /dev/null +++ b/Client/Functions/Client_SupportRearm.sqf @@ -0,0 +1,78 @@ +Private ['_airCoef','_artCoef','_cts','_distanceMin','_heaCoef','_i','_ligCoef','_name','_nearIsDP','_nearIsRT','_nearIsSP','_repairRange','_rearmTime','_spType','_supportRange','_supports','_typeRepair','_veh']; +_veh = _this select 0; +_supports = _this select 1; +_typeRepair = _this select 2; +_spType = _this select 3; +_supportRange = 'WFBE_SUPPORTRANGE' Call GetNamespace; +_repairRange = 'WFBE_REPAIRTRUCKRANGE' Call GetNamespace; + +//--- Retrieve Informations. +_name = [typeOf _veh, 'displayName'] Call GetConfigInfo; +_rearmTime = 'WFBE_SUPPORTREARMTIME' Call GetNamespace; + +//--- SP? +_nearIsSP = false; +_nearIsDP = false; +_nearIsRT = false; +{ + if ((typeOf _x) == _spType) then {_nearIsSP = true}; + if ((typeOf _x) in WFDEPOT) then {_nearIsDP = true}; + if ((typeOf _x) in _typeRepair) then {_nearIsRT = true}; +} forEach _supports; + +//--- Coefficient Vary depending on the support type. +_airCoef = 1; +_artCoef = 1; +_heaCoef = 1; +_ligCoef = 1; +if (_nearIsRT) then { + _airCoef = 3.4; + _artCoef = 3; + _heaCoef = 2.8; + _ligCoef = 2.6; +}; +if (_nearIsDP) then { + _airCoef = 2.5; + _artCoef = 2.4; + _heaCoef = 2.2; + _ligCoef = 2; +}; +if (_nearIsSP) then { + _airCoef = 1.9; + _artCoef = 1.7; + _heaCoef = 1.5; + _ligCoef = 1.2; +}; + +//--- Class Malus. +if (_veh isKindOf 'Air') then {_rearmTime = round(_rearmTime * _airCoef)}; +if (_veh isKindOf 'StaticWeapon') then {_rearmTime = round(_rearmTime * _artCoef)}; +if (_veh isKindOf 'Tank') then {_rearmTime = round(_rearmTime * _heaCoef)}; +if (_veh isKindOf 'Car' || _veh isKindOf 'Motorcycle') then {_rearmTime = round(_rearmTime * _ligCoef)}; + +//--- Inform the player. +hint parseText(Format[localize "STR_WF_INFO_Rearming",_name,_rearmTime]); + +//--- Make sure that we still have something as a support. +_cts = 0; +_i = 0; +while {true} do { + sleep 1; + + //--- Check the distance & alive. + _cts = 0; + { + _distanceMin = if ((typeOf _x) in _typeRepair) then {_repairRange} else {_supportRange}; + if ((alive _x) && ((_veh distance _x) < _distanceMin)) then {_cts = _cts + 1}; + } forEach _supports; + + _i = _i + 1; + + if (_cts == 0 || !(alive _veh) || (getPos _veh) select 2 > 2) exitWith {hint parseText(Format[localize "STR_WF_INFO_Rearm_Failed",_name])}; + if (_i >= _rearmTime) exitWith {hint parseText(Format[localize "STR_WF_INFO_Rearm_Success",_name])}; +}; + +//--- Rearm? +if (_cts != 0) then { + [_veh,sideJoined] Spawn RearmVehicle; +}; \ No newline at end of file diff --git a/Client/Functions/Client_SupportRefuel.sqf b/Client/Functions/Client_SupportRefuel.sqf new file mode 100644 index 0000000..25cef76 --- /dev/null +++ b/Client/Functions/Client_SupportRefuel.sqf @@ -0,0 +1,78 @@ +Private ['_airCoef','_artCoef','_cts','_distanceMin','_heaCoef','_i','_ligCoef','_name','_nearIsDP','_nearIsRT','_nearIsSP','_repairRange','_refTime','_spType','_supportRange','_supports','_typeRepair','_veh']; +_veh = _this select 0; +_supports = _this select 1; +_typeRepair = _this select 2; +_spType = _this select 3; +_supportRange = 'WFBE_SUPPORTRANGE' Call GetNamespace; +_repairRange = 'WFBE_REPAIRTRUCKRANGE' Call GetNamespace; + +//--- Retrieve Informations. +_name = [typeOf _veh, 'displayName'] Call GetConfigInfo; +_refTime = 'WFBE_SUPPORTREFUELTIME' Call GetNamespace; + +//--- SP? +_nearIsSP = false; +_nearIsDP = false; +_nearIsRT = false; +{ + if ((typeOf _x) == _spType) then {_nearIsSP = true}; + if ((typeOf _x) in WFDEPOT) then {_nearIsDP = true}; + if ((typeOf _x) in _typeRepair) then {_nearIsRT = true}; +} forEach _supports; + +//--- Coefficient Vary depending on the support type. +_airCoef = 1; +_artCoef = 1; +_heaCoef = 1; +_ligCoef = 1; +if (_nearIsRT) then { + _airCoef = 2.8; + _artCoef = 2.4; + _heaCoef = 2.2; + _ligCoef = 2.0; +}; +if (_nearIsDP) then { + _airCoef = 2.3; + _artCoef = 2.1; + _heaCoef = 1.9; + _ligCoef = 1.7; +}; +if (_nearIsSP) then { + _airCoef = 1.8; + _artCoef = 1.6; + _heaCoef = 1.4; + _ligCoef = 1.2; +}; + +//--- Class Malus. +if (_veh isKindOf 'Air') then {_refTime = round(_refTime * (_airCoef + (1 - fuel _veh)))}; +if (_veh isKindOf 'StaticWeapon') then {_refTime = round(_refTime * (_artCoef + (1 - fuel _veh)))}; +if (_veh isKindOf 'Tank') then {_refTime = round(_refTime * (_heaCoef + (1 - fuel _veh)))}; +if (_veh isKindOf 'Car' || _veh isKindOf 'Motorcycle') then {_refTime = round(_refTime * (_ligCoef + (1 - fuel _veh)))}; + +//--- Inform the player. +hint parseText(Format[localize "STR_WF_INFO_Refueling",_name,_refTime]); + +//--- Make sure that we still have something as a support. +_cts = 0; +_i = 0; +while {true} do { + sleep 1; + + //--- Check the distance & alive. + _cts = 0; + { + _distanceMin = if ((typeOf _x) in _typeRepair) then {_repairRange} else {_supportRange}; + if ((alive _x) && ((_veh distance _x) < _distanceMin)) then {_cts = _cts + 1}; + } forEach _supports; + + _i = _i + 1; + + if (_cts == 0 || !(alive _veh) || (getPos _veh) select 2 > 2) exitWith {hint parseText(Format[localize "STR_WF_INFO_Refueling_Failed",_name])}; + if (_i >= _refTime) exitWith {hint parseText(Format[localize "STR_WF_INFO_Refueling_Success",_name])}; +}; + +//--- Refuel the vehicle? +if (_cts != 0) then { + _veh setFuel 1; +}; \ No newline at end of file diff --git a/Client/Functions/Client_SupportRepair.sqf b/Client/Functions/Client_SupportRepair.sqf new file mode 100644 index 0000000..57169f2 --- /dev/null +++ b/Client/Functions/Client_SupportRepair.sqf @@ -0,0 +1,78 @@ +Private ['_airCoef','_artCoef','_cts','_distanceMin','_heaCoef','_i','_ligCoef','_name','_nearIsDP','_nearIsRT','_nearIsSP','_repairRange','_repTime','_spType','_supportRange','_supports','_typeRepair','_veh']; +_veh = _this select 0; +_supports = _this select 1; +_typeRepair = _this select 2; +_spType = _this select 3; +_supportRange = 'WFBE_SUPPORTRANGE' Call GetNamespace; +_repairRange = 'WFBE_REPAIRTRUCKRANGE' Call GetNamespace; + +//--- Retrieve Informations. +_name = [typeOf _veh, 'displayName'] Call GetConfigInfo; +_repTime = 'WFBE_SUPPORTREPAIRTIME' Call GetNamespace; + +//--- SP? +_nearIsSP = false; +_nearIsDP = false; +_nearIsRT = false; +{ + if ((typeOf _x) == _spType) then {_nearIsSP = true}; + if ((typeOf _x) in WFDEPOT) then {_nearIsDP = true}; + if ((typeOf _x) in _typeRepair) then {_nearIsRT = true}; +} forEach _supports; + +//--- Coefficient Vary depending on the support type. +_airCoef = 1; +_artCoef = 1; +_heaCoef = 1; +_ligCoef = 1; +if (_nearIsRT) then { + _airCoef = 2.4; + _artCoef = 1.8; + _heaCoef = 1.6; + _ligCoef = 1.4; +}; +if (_nearIsDP) then { + _airCoef = 1.9; + _artCoef = 1.5; + _heaCoef = 1.3; + _ligCoef = 1.1; +}; +if (_nearIsSP) then { + _airCoef = 1.4; + _artCoef = 1; + _heaCoef = 0.8; + _ligCoef = 0.6; +}; + +//--- Class Malus. +if (_veh isKindOf 'Air') then {_repTime = round(_repTime * (_airCoef + getDammage _veh))}; +if (_veh isKindOf 'StaticWeapon') then {_repTime = round(_repTime * (_artCoef + getDammage _veh))}; +if (_veh isKindOf 'Tank') then {_repTime = round(_repTime * (_heaCoef + getDammage _veh))}; +if (_veh isKindOf 'Car' || _veh isKindOf 'Motorcycle') then {_repTime = round(_repTime * (_ligCoef + getDammage _veh))}; + +//--- Inform the player. +hint parseText(Format[localize "STR_WF_INFO_Repairing",_name,_repTime]); + +//--- Make sure that we still have something as a support. +_cts = 0; +_i = 0; +while {true} do { + sleep 1; + + //--- Check the distance & alive. + _cts = 0; + { + _distanceMin = if ((typeOf _x) in _typeRepair) then {_repairRange} else {_supportRange}; + if ((alive _x) && ((_veh distance _x) < _distanceMin)) then {_cts = _cts + 1}; + } forEach _supports; + + _i = _i + 1; + + if (_cts == 0 || !(alive _veh) || (getPos _veh) select 2 > 2) exitWith {hint parseText(Format[localize "STR_WF_INFO_Repair_Failed",_name])}; + if (_i >= _repTime) exitWith {hint parseText(Format[localize "STR_WF_INFO_Repair_Success",_name])}; +}; + +//--- Fix the damages? +if (_cts != 0) then { + _veh setDammage 0; +}; \ No newline at end of file diff --git a/Client/Functions/Client_TaskSystem.sqf b/Client/Functions/Client_TaskSystem.sqf new file mode 100644 index 0000000..3072fb2 --- /dev/null +++ b/Client/Functions/Client_TaskSystem.sqf @@ -0,0 +1,69 @@ +Private ["_i","_location","_locations","_next","_sideID","_sorted","_task","_type"]; +_type = _this select 0; +_location = if (count _this > 1) then {_this select 1} else {objNull}; + +switch (_type) do { + //--- Complete Towns set initialization. + case "TownAddComplete": { + //--- Todo: improve the sort by with other digits instead of the first one. + sleep 4; + Private ["_addOrder","_returned","_town","_towns","_townsLabel"]; + _townsLabel = []; + {_townsLabel = _townsLabel + [_x getVariable 'name']} forEach towns; + _towns = ([_townsLabel,true,towns] Call CIPHER_SortArray) select 1; + + for '_i' from 0 to count(_towns)-1 do { + _town = _towns select _i; + waitUntil {_sideID = _town getVariable 'sideID';!isNil '_sideID'}; + _sideID = _town getVariable "sideID"; + _task = player createSimpleTask [Format["TakeTowns_%1",str _town]]; + if (_sideID != sideID) then { + _task setSimpleTaskDescription [Format[localize "STR_WF_TaskTown",_town getVariable "name"], Format [localize "STR_WF_CHAT_TaskTown_Display",_town getVariable "name"], Format [localize "STR_WF_CHAT_TaskTown_Display",_town getVariable "name"]]; + } else { + _task setSimpleTaskDescription [Format[localize "STR_WF_TaskTown_Complete",_town getVariable "name"], Format [localize "STR_WF_CHAT_TaskTown_Display",_town getVariable "name"], Format [localize "STR_WF_CHAT_TaskTown_Display",_town getVariable "name"]]; + _task setTaskState "Succeeded"; + }; + _task setSimpleTaskDestination (getPos _town); + _town setVariable ['taskLink',_task]; + }; + + ["TownAssignClosest"] Spawn TaskSystem; + }; + + //--- Assign the closest town to the player. + case "TownAssignClosest": { + sleep 4; + _next = [player,sideJoined] Call GetClosestLocationBySide; + if !(isNull _next) then { + ["TownHintNew",_next] Spawn TaskSystem; + _task = (_next getVariable 'taskLink'); + /* Keep the commander order ! */ + if (!isNull comTask) then { + if (taskState comTask == "Succeeded") then {player setCurrentTask _task}; + } else { + player setCurrentTask _task; + }; + }; + }; + + //--- Update a town's value. + case "TownUpdate": { + _task = _location getVariable 'taskLink'; + _sideID = _location getVariable "sideID"; + if !(isNil '_task') then { + if (_sideID == sideID) then { + _task setTaskState "Succeeded"; + _task setSimpleTaskDescription [Format[localize "STR_WF_TaskTown_Complete",_location getVariable "name"], Format [localize "STR_WF_CHAT_TaskTown_Display",_location getVariable "name"], Format [localize "STR_WF_CHAT_TaskTown_Display",_location getVariable "name"]]; + } else { + _task setTaskState "Created"; + _task setSimpleTaskDescription [Format[localize "STR_WF_TaskTown",_location getVariable "name"], Format [localize "STR_WF_CHAT_TaskTown_Display",_location getVariable "name"], Format [localize "STR_WF_CHAT_TaskTown_Display",_location getVariable "name"]]; + }; + } + }; + + //--- Hint for a new town task. + case "TownHintNew": {taskHint [format [localize "str_taskNew" + "\n%1",Format [localize "STR_WF_CHAT_TaskTown_Display",_location getVariable "name"]], [1,1,1,1], "taskNew"]}; + + //--- Hint for a completed town task. + case "TownHintDone": {taskHint [format [localize "str_taskAccomplished" + "\n%1",Format [localize "STR_WF_CHAT_TaskTown_Display",_location getVariable "name"]], [1,1,1,1], "taskDone"]}; +}; \ No newline at end of file diff --git a/Client/Functions/Client_TitleTextMessage.sqf b/Client/Functions/Client_TitleTextMessage.sqf new file mode 100644 index 0000000..113e55b --- /dev/null +++ b/Client/Functions/Client_TitleTextMessage.sqf @@ -0,0 +1,7 @@ +Private["_message","_style"]; + +_message = _this Select 0; +_style = "PLAIN"; +if (Count _this > 1) then {_style = _this Select 1}; + +12451 cutText ["\n\n\n\n\n\n\n" + _message,_style]; \ No newline at end of file diff --git a/Client/Functions/Client_UIAddItem.sqf b/Client/Functions/Client_UIAddItem.sqf new file mode 100644 index 0000000..b7e84f6 --- /dev/null +++ b/Client/Functions/Client_UIAddItem.sqf @@ -0,0 +1,11 @@ +Private ['_items','_limit','_mag','_size']; +_items = _this select 0; +_mag = _this select 1; +_size = 0; +_limit = 12; + +{_size = _size + 1} forEach _items; + +if (_size + 1 <= _limit) then {_items = _items + [_mag]}; + +_items \ No newline at end of file diff --git a/Client/Functions/Client_UIAddMagazine.sqf b/Client/Functions/Client_UIAddMagazine.sqf new file mode 100644 index 0000000..509c515 --- /dev/null +++ b/Client/Functions/Client_UIAddMagazine.sqf @@ -0,0 +1,35 @@ +private ["_get","_limit","_newMagSpace","_newMagSideInv","_mag","_magazines","_size"]; +_magazines = _this select 0; +_mag = _this select 1; +_size = 0; +_limit = 12; + +_get = _mag Call GetNamespace; +_newMagSpace = _get select QUERYGEARSPACE; +_newMagSideInv = _get select QUERYGEARHANDGUNPOOL; +_limit = if (_newMagSideInv) then {8} else {12}; + +if (_newMagSideInv) then { + { + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + if (_get select QUERYGEARHANDGUNPOOL) then { + _size = _size + (_get select QUERYGEARSPACE); + }; + }; + } forEach _magazines; +} else { + { + _get = _x Call GetNamespace; + + if !(isNil '_get') then { + if !(_get select QUERYGEARHANDGUNPOOL) then { + _size = _size + (_get select QUERYGEARSPACE); + }; + }; + } forEach _magazines; +}; + +if (_size + _newMagSpace <= _limit) then {_magazines = _magazines + [_mag]}; +_magazines \ No newline at end of file diff --git a/Client/Functions/Client_UIChangeComboBuyUnits.sqf b/Client/Functions/Client_UIChangeComboBuyUnits.sqf new file mode 100644 index 0000000..6867d89 --- /dev/null +++ b/Client/Functions/Client_UIChangeComboBuyUnits.sqf @@ -0,0 +1,15 @@ +Private['_get','_lb','_type']; +_lb = _this select 0; +_type = _this select 1; + +lbClear _lb; +{ + lbAdd [_lb,_x]; +} forEach (Format["WFBE_%1%2FACTIONS",sideJoinedText,_type] Call GetNamespace); + +_get = Format["WFBE_%1%2CURRENTFACTIONSELECTED",sideJoinedText,_type] Call GetNamespace; +if (isNil '_get') then { + lbSetCurSel [_lb,0]; +} else { + lbSetCurSel [_lb,_get]; +}; \ No newline at end of file diff --git a/Client/Functions/Client_UIFillListBuyUnits.sqf b/Client/Functions/Client_UIFillListBuyUnits.sqf new file mode 100644 index 0000000..78e8881 --- /dev/null +++ b/Client/Functions/Client_UIFillListBuyUnits.sqf @@ -0,0 +1,35 @@ +Private ['_addin','_c','_currentUpgrades','_filler','_filter','_i','_listBox','_listNames','_u','_value']; +_listNames = _this select 0; +_filler = _this select 1; +_listBox = _this select 2; +_value = _this select 3; +_u = 0; +_i = 0; + +_currentUpgrades = (sideJoinedText) Call GetSideUpgrades; +_filter = Format["WFBE_%1%2CURRENTFACTIONSELECTED",sideJoinedText,_filler] Call GetNamespace; +if (isNil '_filter') then {_filter = "nil"} else { + if (_filter == 0) then { + _filter = 'nil'; + } else { + _filter = ((Format["WFBE_%1%2FACTIONS",sideJoinedText,_filler] Call GetNamespace) select _filter); + }; +}; + +lnbClear _listBox; +{ + _addin = true; + _c = _x Call GetNamespace; + if (_filter != "nil") then { + if ((_c select QUERYUNITFACTION) != _filter) then {_addin = false}; + }; + if ((_c select QUERYUNITUPGRADE) <= (_currentUpgrades select _value) && _addin) then { + lnbAddRow [_listBox,['$'+str (_c select QUERYUNITPRICE),(_c select QUERYUNITLABEL)]]; + lnbSetData [_listBox,[_i,0],_filler]; + lnbSetValue [_listBox,[_i,0],_u]; + _i = _i + 1; + }; + _u = _u + 1; +} forEach _listNames; + +if (_i > 0) then {lnbSetCurSelRow [_listBox,0]} else {lnbSetCurSelRow [_listBox,-1]}; \ No newline at end of file diff --git a/Client/Functions/Client_UIFillListTeamOrders.sqf b/Client/Functions/Client_UIFillListTeamOrders.sqf new file mode 100644 index 0000000..8d3a0f8 --- /dev/null +++ b/Client/Functions/Client_UIFillListTeamOrders.sqf @@ -0,0 +1,42 @@ +Private ['_color','_extra','_i','_isVehicle','_listBox','_listContent','_pic','_unit']; +_listContent = _this select 0; +_listBox = _this select 1; +_i = 0; +_pic = ""; + +lnbClear _listBox; + +{ + _unit = vehicle _x; + _isVehicle = if (_x != _unit) then {true} else {false}; + + _color = []; + _extra = ""; + if (round(((getDammage _unit)*-100)+100) < 75) then { + _color = [0.875, 0.5, 0, 1]; + _extra = "[Injured] "; + if (round(((getDammage _unit)*-100)+100) < 50) then { + _extra = "[Injured] "; + _color = [0.875, 0, 0, 1]; + if !(alive _x) then {_extra = "[Dead]"}; + }; + }; + if (count _color == 0 && _isVehicle) then { + if !(canMove _unit) then { + _extra = "[Immobilized] "; + _color = [0.875, 0.875, 0, 1]; + }; + }; + + lnbAddRow [_listBox,[str(round(((getDammage _unit)*-100)+100)) + "%",_extra+"("+([typeOf _unit, 'displayName'] Call GetConfigInfo)+") "+name _x]]; + _pic = if (_isVehicle) then {[typeOf _unit, 'picture'] Call GetConfigInfo} else {[typeOf _unit, 'portrait'] Call GetConfigInfo}; + lnbSetPicture [_listBox,[_i,1],_pic]; + + if (count _color > 0) then { + lnbSetColor [_listBox,[_i,0],_color]; + lnbSetColor [_listBox,[_i,1],_color]; + }; + _i = _i + 1; +} forEach _listContent; + +if (_i > 0) then {lnbSetCurSelRow [_listBox,0]} else {lnbSetCurSelRow [_listBox,-1]}; \ No newline at end of file diff --git a/Client/Functions/Client_UIFindLBValue.sqf b/Client/Functions/Client_UIFindLBValue.sqf new file mode 100644 index 0000000..ae06622 --- /dev/null +++ b/Client/Functions/Client_UIFindLBValue.sqf @@ -0,0 +1,12 @@ +Private ['_itemsCount','_listbox','_retVal','_value']; +_listbox = _this select 0; +_value = _this select 1; + +_itemsCount = lbSize _listbox; + +_retVal = -1; +for '_i' from 0 to _itemsCount-1 do { + if (lbValue[_listbox, _i] == _value) exitWith {_retVal = _i}; +}; + +_retVal \ No newline at end of file diff --git a/Client/Functions/Client_UIGearFillList.sqf b/Client/Functions/Client_UIGearFillList.sqf new file mode 100644 index 0000000..2eb0d55 --- /dev/null +++ b/Client/Functions/Client_UIGearFillList.sqf @@ -0,0 +1,40 @@ +Private ['_add','_currentGearUpgr','_filler','_get','_i','_listBox','_listNames','_u']; +_listNames = _this select 0; +_filler = _this select 1; +_listBox = _this select 2; +_u = 0; +_i = 0; +_get = []; + +_currentGearUpgr = ((sideJoinedText) Call GetSideUpgrades) select 13; + +{ + /* Get */ + if (_filler == 'secondary' || _filler == 'all') then { + _get = (_x+'_W') Call GetNamespace; + if (isNil '_get') then { + _get = _x Call GetNamespace; + }; + } else { + _get = _x Call GetNamespace; + }; + + if !(isNil '_get') then { + if ((_get select QUERYGEARUPGRADE) <= _currentGearUpgr) then { + _add = true; + if (paramGearRestriction && !gearInRange) then { + if !(_get select QUERYGEARALLOWED) then {_add = false}; + }; + if (_add) then { + lnbAddRow [_listBox,['$'+str (_get Select QUERYGEARCOST),(_get select QUERYGEARLABEL)]]; + lnbSetPicture [_listBox,[_i,0],_get select QUERYGEARPICTURE]; + lnbSetData [_listBox,[_i,0],_filler]; + lnbSetValue [_listBox,[_i,0],_u]; + _i = _i + 1; + }; + }; + }; + _u = _u + 1; +} forEach _listNames; + +lnbSetCurSelRow [_listBox,0] \ No newline at end of file diff --git a/Client/Functions/Client_UIGearFillTemplateList.sqf b/Client/Functions/Client_UIGearFillTemplateList.sqf new file mode 100644 index 0000000..25dc6cc --- /dev/null +++ b/Client/Functions/Client_UIGearFillTemplateList.sqf @@ -0,0 +1,31 @@ +Private ['_add','_currentUpgrades','_filler','_i','_listBox','_listCosts','_listNames','_listPictures','_listUpgrades','_listAllowed','_u']; +_listCosts = _this select 0; +_listNames = _this select 1; +_listPictures = _this select 2; +_listUpgrades = _this select 3; +_listAllowed = _this select 4; +_filler = _this select 5; +_listBox = _this select 6; +_u = 0; +_i = 0; + +_currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + +{ + if ((_listUpgrades select _u) <= (_currentUpgrades select 13)) then { + _add = true; + if (gearRestriction && !gearInRange) then { + if !(_listAllowed select _u) then {_add = false}; + }; + if (_add) then { + lnbAddRow [_listBox,['$'+str (_listCosts Select _u),_x]]; + lnbSetPicture [_listBox,[_i,0],_listPictures select _u]; + lnbSetData [_listBox,[_i,0],_filler]; + lnbSetValue [_listBox,[_i,0],_u]; + _i = _i + 1; + }; + }; + _u = _u + 1; +} forEach _listNames; + +lnbSetCurSelRow [_listBox,0] \ No newline at end of file diff --git a/Client/GUI/GUI_ArtilleryMenu.sqf b/Client/GUI/GUI_ArtilleryMenu.sqf new file mode 100644 index 0000000..82aec12 --- /dev/null +++ b/Client/GUI/GUI_ArtilleryMenu.sqf @@ -0,0 +1,649 @@ + +private ["_canFT","_startPoint","_closest","_sorted","_buildings","_checks","_sideID","_camps","_allCamps","_locations","_skip","_FTLocations","_markerName","_markers","_i","_lastUpdate","_base","_isDeployed","_currentLevel","_commander","_enable","_callPos","_travelingWith","_destination","_compass","_GPS","_pad","_radio","_watch","_locationPosition","_camera","_delay","_obj","_nukeMarker","_fireTime","_status","_txt","_units","_currentUpgrades","_funds","_lastRange","_display","_ftr","_marker","_area","_map","_pard","_IDCS"]; +disableSerialization; + +_display = _this select 0; +_lastRange = artyRange; +_lastUpdate = 0; +_listBox = 17019; + +sliderSetRange[17005,10,'WFBE_MAXARTILLERYAREA' Call GetNamespace]; +sliderSetPosition[17005,artyRange]; + +ctrlSetText [17025,localize "STR_WF_ArtilleryOverview" + " :"]; + +_markers = []; +_FTLocations = []; +_checks = []; +_fireTime = 0; +_status = 0; +_canFT = false; +_forceReload = true; +_ft = 'WFBE_FASTTRAVEL' Call GetNamespace; +_ftr = 'WFBE_FASTTRAVELRANGE' Call GetNamespace; +_startPoint = objNull; + +_marker = "artilleryMarker"; +createMarkerLocal [_marker,artyPos]; +_marker setMarkerTypeLocal "mil_destroy"; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerSizeLocal [1,1]; + +_area = "artilleryAreaMarker"; +createMarkerLocal [_area,artyPos]; +_area setMarkerShapeLocal "Ellipse"; +_area setMarkerColorLocal "ColorRed"; +_area setMarkerSizeLocal [artyRange,artyRange]; + +_map = _display DisplayCtrl 17002; +_listboxControl = _display DisplayCtrl _listBox; + +_pard = 'WFBE_PARADELAY' Call GetNamespace; +{lbAdd[17008,_x]} forEach (Format ["WFBE_%1_ARTILLERY_DESC",sideJoinedText] Call GetNamespace); +lbSetCurSel[17008,0]; + +_IDCS = [17005,17006,17007,17008]; +if !(paramArty) then {{ctrlEnable [_x,false]} forEach _IDCS}; + +{ctrlEnable [_x, false]} forEach [17010,17011,17012,17013,17014,17015,17017,17018,17020]; + +MenuAction = -1; +mouseButtonUp = -1; +_currentValue = -1; +_currentFee = -1; +_currentSpecial = ""; +_currentFee = -1; + +//--- Support List. +_lastSel = -1; +_addToList = [localize 'STR_WF_FastTravel',localize 'STR_WF_ICBM',localize 'STR_WF_Paradrop_Ammo',localize 'STR_WF_Paradrop_Vehicle',localize 'STR_WF_Paratroop',localize 'STR_WF_UnitCam',localize 'STR_WF_UAV',localize 'STR_WF_UAV_Destroy',localize 'STR_WF_UAV_RemoteControl']; +_addToListID = ["Fast_Travel","ICBM","Paradrop_Ammo","Paradrop_Vehicle","Paratroopers","Units_Camera","UAV","UAV_Destroy","UAV_Remote_Control"]; +_addToListFee = [0,150000,9500,3500,8500,0,12500,0,0]; +_addToListInterval = [0,1000,800,600,900,0,0,0,0]; + +for '_i' from 0 to count(_addToList)-1 do { + lbAdd [_listBox,_addToList select _i]; + lbSetValue [_listBox, _i, _i]; +}; + +lbSort _listboxControl; + +//--- Artillery Mode. +_mode = 'WFBE_V_ARTILLERYMINMAP' Call GetNamespace; +if (isNil '_mode') then {_mode = 2;['WFBE_V_ARTILLERYMINMAP',_mode,true] Call SetNamespace}; +_trackingArray = []; +_trackingArrayID = []; +_lastArtyUpdate = -60; +_minRange = 100; +_maxRange = 200; +_requestMarkerTransition = false; +_requestRangedList = true; +_startLoad = true; + +//--- Startup coloration. +with uinamespace do { + currentBEDialog = _display; + switch (_mode) do { + case 0: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [1,1,1,1]}; + case 1: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0,0.635294,0.909803,1]}; + case 2: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0.6,0.850980,0.917647,1]}; + }; +}; + +lbSetCurSel[_listbox, 0]; + +_textAnimHandler = [] spawn {}; + +while {alive player && dialog} do { + if (side player != sideJoined) exitWith {deleteMarkerLocal _marker;deleteMarkerLocal _area;{deleteMarkerLocal _x} forEach _markers;closeDialog 0}; + if (!dialog) exitWith {deleteMarkerLocal _marker;deleteMarkerLocal _area;{deleteMarkerLocal _x} forEach _markers}; + + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + + if (_ft > 0) then { + //--- TODO: Travel fee, mod parameter > FT free or pay, do a clt fct. + _currentLevel = _currentUpgrades select 12; + if (time - _lastUpdate > 15 && _currentLevel > 0) then { + {deleteMarkerLocal _x} forEach _markers; + _markers = []; + _FTLocations = []; + _canFT = false; + _startPoint = objNull; + _lastUpdate = time; + _base = (sideJoinedText) Call GetSideHQ; + _isDeployed = (sideJoinedText) Call GetSideHQDeployed; + if (player distance _base < _ftr && alive _base && vehicle player != _base && _isDeployed) then { + _canFT = true; + _startPoint = _base; + } else { + _sorted = [player,towns] Call SortByDistance; + _closest = _sorted select 0; + _sideID = _closest getVariable "sideID"; + _camps = [_closest,sideJoined] Call GetFriendlyCamps; + _allCamps = _closest getVariable "camps"; + if (_sideID == sideID && player distance _closest < _ftr && (count _camps == count _allCamps)) then {_canFT = true;_startPoint = _closest} else { + _buildings = (sideJoinedText) Call GetSideStructures; + _checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories; + if (count _checks > 0) then { + _sorted = [player,_checks] Call SortByDistance; + _closest = _sorted select 0; + if (player distance _closest < _ftr) then { + _canFT = true; + _closest = _sorted select 0; + _startPoint = _closest; + }; + }; + }; + }; + if (!canMove (vehicle player)) then {_canFT = false}; + if (_canFT) then { + _buildings = (sideJoinedText) Call GetSideStructures; + _checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories; + _locations = towns + _checks; + if (alive _base && _isDeployed) then {_locations = _locations + [_base]}; + _i = 0; + _fee = 0; + _funds = if (_ft == 2) then {Call GetPlayerFunds} else {0}; + { + if (_x distance player <= ('WFBE_FASTTRAVELMAXRANGE' Call GetNamespace) && _x distance player > _ftr) then { + _skip = false; + if (_x in towns) then { + _sideID = _x getVariable "sideID"; + _camps = [_x,sideJoined] Call GetFriendlyCamps; + _allCamps = _x getVariable "camps"; + if (_sideID != sideID || (count _camps != count _allCamps)) then {_skip = true}; + if (_ft == 2) then { + _fee = round(((_x distance player)/1000) * ('WFBE_FASTTRAVELPRICEKM' Call GetNamespace)); + if (_funds < _fee) then {_skip = true}; + }; + }; + if !(_skip) then { + _FTLocations = _FTLocations + [_x]; + _markerName = Format ["FTMarker%1",_i]; + _markers = _markers + [_markerName]; + createMarkerLocal [_markerName,getPos _x]; + _markerName setMarkerTypeLocal "mil_circle"; + _markerName setMarkerColorLocal "ColorYellow"; + _markerName setMarkerSizeLocal [1,1]; + //--- Fee, Cheap marker stuff, TBD: Add prompt or something. + if (_ft == 2) then { + _markerName = Format ["FTMarker%1%1",_i]; + _markers = _markers + [_markerName]; + createMarkerLocal [_markerName,[(getPos _x select 0)-5,(getPos _x select 1)+75]]; + _markerName setMarkerTypeLocal "mil_circle"; + _markerName setMarkerColorLocal "ColorYellow"; + _markerName setMarkerSizeLocal [0,0]; + _markerName setMarkerTextLocal Format ["$ %1.",_fee]; + }; + _i = _i + 1; + }; + }; + } forEach _locations; + }; + }; + }; + + _currentSel = lbCurSel(_listBox); + + //--- Special changed or a reload is requested. + if (_currentSel != _lastSel || _forceReload) then { + _currentValue = lbValue[_listBox, _currentSel]; + + _currentSpecial = _addToListID select _currentValue; + _currentFee = _addToListFee select _currentValue; + _currentInterval = _addToListInterval select _currentValue; + + _forceReload = false; + _controlEnable = false; + + _funds = Call GetPlayerFunds; + + ctrlSetText[17021,Format ["%1: $%2.",localize 'STR_WF_Price',_currentFee]]; + + //--- Enabled or disabled? + switch (_currentSpecial) do { + case "Fast_Travel": { + if (_ft > 0) then { + _currentLevel = _currentUpgrades select 12; + _controlEnable = if (count _FTLocations > 0 && _currentLevel > 0) then {true} else {false}; + }; + }; + case "ICBM": { + if (paramICBM) then { + _commander = false; + if (!isNull(commanderTeam)) then { + if (commanderTeam == group player) then {_commander = true}; + }; + _currentLevel = _currentUpgrades select 11; + _controlEnable = if (_currentLevel > 0 && _commander && _funds >= _currentFee) then {true} else {false}; + }; + }; + case "Paratroopers": { + _currentLevel = _currentUpgrades select 4; + _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastParaCall > _currentInterval) then {true} else {false}; + }; + case "Paradrop_Ammo": { + _currentLevel = _currentUpgrades select 16; + _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastSupplyCall > _currentInterval) then {true} else {false}; + }; + case "Paradrop_Vehicle": { + _currentLevel = _currentUpgrades select 16; + _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastSupplyCall > _currentInterval) then {true} else {false}; + }; + case "UAV": { + _currentLevel = _currentUpgrades select 5; + _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && !(alive playerUAV)) then {true} else {false}; + }; + case "UAV_Destroy": { + _controlEnable = if (alive playerUAV) then {true} else {false}; + }; + case "UAV_Remote_Control": { + _controlEnable = if (alive playerUAV) then {true} else {false}; + }; + case "Units_Camera": { + _controlEnable = commandInRange; + }; + }; + + ctrlEnable[17020, _controlEnable]; + }; + + //--- Action triggered. + if (MenuAction == 20) then { + MenuAction = -1; + + //--- Output. + switch (_currentSpecial) do { + case "Fast_Travel": { + MenuAction = 7; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim; + }; + case "ICBM": { + MenuAction = 8; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim; + }; + case "Paratroopers": { + MenuAction = 3; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim; + }; + case "Paradrop_Ammo": { + MenuAction = 10; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim; + }; + case "Paradrop_Vehicle": { + MenuAction = 9; + + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_ClickOnMap',10,"1da4fd"] spawn SetControlFadeAnim; + }; + case "UAV": { + closeDialog 0; + ExecVM "Client\Module\UAV\uav.sqf"; + }; + case "UAV_Destroy": { + if !(isNull playerUAV) then { + {_x setDammage 1} forEach (crew playerUAV); + playerUAV setDammage 1; + playerUAV = objNull; + }; + }; + case "UAV_Remote_Control": { + closeDialog 0; + ExecVM "Client\Module\UAV\uav.sqf"; + }; + case "Units_Camera": { + closeDialog 0; + createDialog "RscUnitCamera"; + }; + }; + + _forceReload = true; + }; + + artyRange = floor (sliderPosition 17005); + if (_lastRange != artyRange) then {_area setMarkerSizeLocal [artyRange,artyRange];}; + + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + //--- Set Artillery Marker on map. + if (MenuAction == 1) then { + MenuAction = -1; + artyPos = _map posScreenToWorld[mouseX,mouseY]; + _marker setMarkerPosLocal artyPos; + _area setMarkerPosLocal artyPos; + _requestRangedList = true; + }; + //--- Paratroops. + if (MenuAction == 3) then { + MenuAction = -1; + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + _callPos = _map posScreenToWorld[mouseX,mouseY]; + if (!surfaceIsWater _callPos) then { + lastParaCall = time; + -(_currentFee) Call ChangePlayerFunds; + WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["Paratroops",sideJoined,_callPos,clientTeam]]; + publicVariable 'WFBE_RequestSpecial'; + if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["Paratroops",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF}; + hint (localize "STR_WF_Paratroop_Info"); + }; + }; + //--- Fast Travel. + if (MenuAction == 7) then { + MenuAction = -1; + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + _callPos = _map PosScreenToWorld[mouseX,mouseY]; + _sorted = [_callPos,_FTLocations] Call SortByDistance; + if (_callPos distance (_sorted select 0) < 500) then { + closeDialog 0; + deleteMarkerLocal _marker; + deleteMarkerLocal _area; + + _destination = _sorted select 0; + + if (_ft == 2) then { + _fee = round(((player distance _destination)/1000) * ('WFBE_FASTTRAVELPRICEKM' Call GetNamespace)); + -(_fee) Call ChangePlayerFunds; + }; + + _travelingWith = []; + {if (_x distance _startPoint < _ftr && !(_x in _travelingWith) && canMove _x && !(vehicle _x isKindOf "StaticWeapon") && !stopped _x && !((currentCommand _x) in ["WAIT","STOP"])) then {_travelingWith = _travelingWith + [vehicle _x]}} forEach units (group player); + + ForceMap true; + _compass = shownCompass; + _GPS = shownGPS; + _pad = shownPad; + _radio = shownRadio; + _watch = shownWatch; + + showCompass false; + showGPS false; + showPad false; + showRadio false; + showWatch false; + + mapAnimClear; + mapAnimCommit; + + _locationPosition = getPos _destination; + _camera = "camera" camCreate _locationPosition; + _camera camSetDir 0; + _camera camSetFov 1; + _camera cameraEffect["Internal","TOP"]; + + _camera camSetTarget _locationPosition; + _camera camSetPos [_locationPosition select 0,(_locationPosition select 1) + 2,100]; + _camera camCommit 0; + + mapAnimAdd [0,0.05,GetPos _startPoint]; + mapAnimCommit; + + _delay = ((_startPoint distance _destination) / 50) * ('WFBE_FASTTRAVELTIMECOEF' Call GetNamespace); + mapAnimAdd [_delay,.18,getPos _destination]; + mapAnimCommit; + + waitUntil {mapAnimDone || !alive player}; + _skip = false; + if (!alive player) then {_skip = true}; + if (!_skip) then { + {[_x,_locationPosition,120] Call PlaceSafe} forEach _travelingWith; + }; + sleep 1; + + ForceMap false; + showCompass _compass; + showGPS _GPS; + showPad _pad; + showRadio _radio; + showWatch _watch; + + _camera cameraEffect["TERMINATE","BACK"]; + camDestroy _camera; + }; + }; + //--- ICBM Strike. + if (MenuAction == 8) then { + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + MenuAction = -1; + -_currentFee Call ChangePlayerFunds; + _callPos = _map PosScreenToWorld[mouseX,mouseY]; + _obj = "HeliHEmpty" createVehicle _callPos; + _nukeMarker = createMarkerLocal ["icbmstrike", position _obj]; + _nukeMarker setMarkerTypeLocal "mil_warning"; + _nukeMarker setMarkerTextLocal "ICBM"; + _nukeMarker setMarkerColorLocal "ColorRed"; + [_obj,_nukeMarker] Spawn NukeIncomming; + }; + //--- Vehicle Paradrop. + if (MenuAction == 9) then { + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + MenuAction = -1; + lastSupplyCall = time; + -_currentFee Call ChangePlayerFunds; + _callPos = _map PosScreenToWorld[mouseX,mouseY]; + WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ParaVehi",sideJoined,_callPos,clientTeam]]; + publicVariable 'WFBE_RequestSpecial'; + if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ParaVehi",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF}; + }; + //--- Ammo Paradrop. + if (MenuAction == 10) then { + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + MenuAction = -1; + lastSupplyCall = time; + -_currentFee Call ChangePlayerFunds; + _callPos = _map PosScreenToWorld[mouseX,mouseY]; + WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ParaAmmo",sideJoined,_callPos,clientTeam]]; + publicVariable 'WFBE_RequestSpecial'; + if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ParaAmmo",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF}; + }; + }; + + //--- Update the Artillery Status. + if (paramArty) then { + _fireTime = (Format["WFBE_FIREMISSIONTIMEOUT%1",(_currentUpgrades select 10)] Call GetNamespace); + _status = round(_fireTime - (time - fireMissionTime)); + _txt = if (time - fireMissionTime > _fireTime) then {Format['%1:
%2',localize 'STR_WF_Status',localize 'STR_WF_Available']} else {Format ['%1:
%2 %3',localize 'STR_WF_Status',_status,localize 'STR_WF_Seconds']}; + (_display displayCtrl 17016) ctrlSetStructuredText (parseText _txt); + _enable = if (_status > 0) then {false} else {true}; + ctrlEnable [17007,_enable]; + }; + + //--- Request Fire Mission. + if (MenuAction == 2) then { + MenuAction = -1; + _units = [Group player,false,lbCurSel(17008),sideJoinedText] Call GetTeamArtillery; + if (Count _units > 0) then { + fireMissionTime = time; + [GetMarkerPos "artilleryMarker",lbCurSel(17008)] Spawn RequestFireMission; + } else { + hint (localize "STR_WF_NoArty"); + }; + }; + + //--- Arty Combo Change or Script init. + if (MenuAction == 200 || _startLoad) then { + MenuAction = -1; + + _index = lbCurSel(17008); + _minRange = (Format ["WFBE_%1_ARTILLERY_MINRANGES",sideJoined] Call GetNamespace) select _index; + _maxRange = (Format ["WFBE_%1_ARTILLERY_MAXRANGES",sideJoined] Call GetNamespace) select _index; + + _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery; + + _requestMarkerTransition = true; + _requestRangedList = true; + _startLoad = false; + }; + + //--- Focus on an artillery cannon. + if (MenuAction == 60) then { + MenuAction = -1; + + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [1,.475,getPos(_trackingArray select (lnbCurSelRow 17024))]; + ctrlMapAnimCommit _map; + }; + + //--- Flush on change. + if (_requestMarkerTransition) then { + _requestMarkerTransition = false; + + { + _track = (_x select 0); + _vehicle = (_x select 1); + + _vehicle setVariable ['WFBE_A_Tracked', nil]; + deleteMarkerLocal Format ["WFBE_A_Large%1",_track]; + deleteMarkerLocal Format ["WFBE_A_Small%1",_track]; + } forEach _trackingArrayID; + _trackingArrayID = []; + }; + + //--- Artillery List. + if (paramArty && (_requestRangedList || time - _lastArtyUpdate > 3)) then { + _requestRangedList = false; + + //--- No need to update the list all the time. + if (time - _lastArtyUpdate > 5) then { + _lastArtyUpdate = time; + _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery; + }; + + //--- Clear & Fill; + lnbClear 17024; + _i = 0; + { + _distance = _x distance (getMarkerPos _marker); + _color = [0, 0.875, 0, 0.8]; + _text = "In Range"; + if (_distance > _maxRange) then {_color = [0.875, 0, 0, 0.8];_text = "Out of Range"}; + if (_distance <= _minRange) then {_color = [0.875, 0.5, 0, 0.8];_text = "Too close"}; + lnbAddRow [17024,[[typeOf _x, 'displayName'] Call GetConfigInfo,_text]]; + lnbSetPicture [17024,[_i,0],[typeOf _x, 'picture'] Call GetConfigInfo]; + + lnbSetColor [17024,[_i,0],_color]; + lnbSetColor [17024,[_i,1],_color]; + + _i = _i + 1; + } forEach _trackingArray; + }; + + //--- Artillery map toggle. + if (MenuAction == 40) then { + MenuAction = -1; + if (_mode == -1) then {_mode = 0}; + _mode = if (_mode == 2) then {0} else {_mode + 1}; + with uinamespace do { + switch (_mode) do { + case 0: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [1,1,1,1]}; + case 1: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0,0.635294,0.909803,1]}; + case 2: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0.6,0.850980,0.917647,1]}; + }; + }; + + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_ArtilleryMinimapInfo',7,"f05555"] spawn SetControlFadeAnim; + + ['WFBE_V_ARTILLERYMINMAP',_mode,true] Call SetNamespace; + + _requestMarkerTransition = true; + }; + + //--- Update artillery display. + if (_mode != -1) then { + + //--- Nothing. + if (_mode == 0) then { + _requestMarkerTransition = true; + _mode = -1; + }; + + //--- Filled Content. + if (_mode == 1 || _mode == 2) then { + //--- Remove if dead or null or sel changed. + { + _track = (_x select 0); + _vehicle = (_x select 1); + + if !(alive _vehicle) then { + deleteMarkerLocal Format ["WFBE_A_Large%1",_track]; + deleteMarkerLocal Format ["WFBE_A_Small%1",_track]; + }; + } forEach _trackingArrayID; + + //--- No need to update the marker all the time. + if (time - _lastArtyUpdate > 5) then { + _lastArtyUpdate = time; + _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery; + }; + + //--- Live Feed. + _trackingArrayID = []; + { + _track = _x getVariable 'WFBE_A_Tracked'; + if (isNil '_track') then { + _track = buildingMarker; + buildingMarker = buildingMarker + 1; + _x setVariable ['WFBE_A_Tracked', _track]; + _dmarker = Format ["WFBE_A_Large%1",_track]; + createMarkerLocal [_dmarker, getPos _x]; + _dmarker setMarkerColorLocal "ColorBlue"; + _dmarker setMarkerShapeLocal "ELLIPSE"; + _brush = "SOLID"; + if (_mode == 1) then {_brush = "SOLID"}; + if (_mode == 2) then {_brush = "BORDER"}; + _dmarker setMarkerBrushLocal _brush; + _dmarker setMarkerAlphaLocal 0.4; + _dmarker setMarkerSizeLocal [_maxRange,_maxRange]; + _dmarker = Format ["WFBE_A_Small%1",_track]; + createMarkerLocal [_dmarker, getPos _x]; + _dmarker setMarkerColorLocal "ColorBlack"; + _dmarker setMarkerShapeLocal "ELLIPSE"; + _dmarker setMarkerBrushLocal "SOLID"; + _dmarker setMarkerAlphaLocal 0.4; + _dmarker setMarkerSizeLocal [_minRange,_minRange]; + } else { + _dmarker = Format ["WFBE_A_Large%1",_track]; + _dmarker setMarkerPosLocal (getPos _x); + _dmarker = Format ["WFBE_A_Small%1",_track]; + _dmarker setMarkerPosLocal (getPos _x); + }; + _trackingArrayID = _trackingArrayID + [[_track,_x]]; + } forEach _trackingArray; + }; + }; + + _lastRange = artyRange; + _lastSel = lbCurSel(_listbox); + sleep 0.1; +}; + +deleteMarkerLocal _marker; +deleteMarkerLocal _area; +{deleteMarkerLocal _x} forEach _markers; + +if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + +//--- Remove Markers. +{ + _track = (_x select 0); + _vehicle = (_x select 1); + + _vehicle setVariable ['WFBE_A_Tracked', nil]; + + deleteMarkerLocal Format ["WFBE_A_Large%1",_track]; + deleteMarkerLocal Format ["WFBE_A_Small%1",_track]; +} forEach _trackingArrayID; \ No newline at end of file diff --git a/Client/GUI/GUI_BuyUnits.sqf b/Client/GUI/GUI_BuyUnits.sqf new file mode 100644 index 0000000..7f4799f --- /dev/null +++ b/Client/GUI/GUI_BuyUnits.sqf @@ -0,0 +1,453 @@ + +private ["_i","_break","_currentIDC","_type","_val","_con","_extra","_currentCost","_skip","_cpt","_size","_txt","_queu","_params","_funds","_currentRow","_currentValue","_unit","_currentUnit","_update","_driver","_updateDetails","_gunner","_commander","_factSel","_closest","_updateMap","_isLocked","_listUnits","_IDCS","_updateList","_nObjects","_sorted","_buildings","_factories","_countAlive","_nearest","_nearTown","_maxOut","_show","_c","_color","_slots","_isInfantry","_utype","_lastCheck","_value","_lastSel","_lastType","_disabledColor","_display","_enabledColor","_IDCLock","_IDCSVehi","_listBox","_comboFaction","_map","_mbu","_status","_statusLabel","_statusVals","_fillList","_changeFactionCombo"]; +disableSerialization; + +//--- Init. +MenuAction = -1; + +_listUnits = []; + +_closest = objNull; +_commander = false; +_extracrew = false; +_countAlive = 0; +_currentCost = 0; +_currentIDC = 0; +_disabledColor = [0.4, 0.4, 0.4, 1]; +_display = _this select 0; +_driver = false; +_enabledColor = [1, 1, 1, 0.75]; +_gunner = false; +_IDCLock = 12023; +_IDCS = [12005,12006,12007,12008,12020,12021]; +_IDCSVehi = [12012,12013,12014,12041]; +_isInfantry = false; +_isLocked = true; +_lastCheck = 0; +_lastSel = -1; +_lastType = 'nil'; +_listBox = 12001; +_comboFaction = 12026; +_map = _display displayCtrl 12015; +_sorted = []; +_type = 'nil'; +_update = true; +_updateDetails = true; +_updateList = true; +_updateMap = true; +_val = 0; +_mbu = 'WFBE_MAXGROUPSIZE' Call GetNamespace; + +ctrlSetText[12025,localize 'STR_WF_Faction' + ":"]; + +//--- Get the closest Factory Type in range. +_break = false; +_status = [barracksInRange,lightInRange,heavyInRange,aircraftInRange,depotInRange,hangarInRange]; +_statusLabel = ['Barracks','Light','Heavy','Aircraft','Depot','Airport']; +_statusVals = [0,1,2,3,4,3]; +for [{_i = 0},{(_i < 6) && !_break},{_i = _i + 1}] do { + if (_status select _i) then { + _break = true; + _currentIDC = _IDCS select _i; + _type = _statusLabel select _i; + _val = _statusVals select _i; + }; +}; + +if (_type == 'nil') exitWith {closeDialog 0}; + +//--- Destroy local variables. +_break = nil; +_status = nil; +_statusLabel = nil; +_statusVals = nil; + +//--- Enable the current IDC. +_IDCS = _IDCS - [_currentIDC]; +{ + _con = _display DisplayCtrl _x; + _con ctrlSetTextColor [0.4, 0.4, 0.4, 1]; +} forEach _IDCS; + +//--- Loop. +while {alive player && dialog} do { + //--- Nothing in range? exit!. + if (!barracksInRange && !lightInRange && !heavyInRange && !aircraftInRange && !hangarInRange && !depotInRange) exitWith {closeDialog 0}; + if (side player != sideJoined || !dialog) exitWith {closeDialog 0}; + + //--- Purchase. + if (MenuAction == 1) then { + MenuAction = -1; + _currentRow = lnbCurSelRow _listBox; + _currentValue = lnbValue[_listBox,[_currentRow,0]]; + _unit = _listUnits select _currentValue; + _currentUnit = _unit Call GetNamespace; + _currentCost = _currentUnit select QUERYUNITPRICE; + _cpt = 1; + if !(_isInfantry) then { + _extra = 0; + if (_driver) then {_extra = _extra + 1}; + if (_gunner) then {_extra = _extra + 1}; + if (_commander) then {_extra = _extra + 1}; + if (_extracrew) then {_extra = _extra + ((_currentUnit select QUERYUNITCREW) select 3)}; + _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra); + }; + if ((_currentRow) != -1) then { + _funds = Call GetPlayerFunds; + _skip = false; + if (_funds < _currentCost) then {_skip = true;hint parseText(Format[localize 'STR_WF_Funds_Missing',_currentCost - _funds,_currentUnit select QUERYUNITLABEL])}; + if !(_skip) then { + _size = Count ((Units (group player)) Call GetLiveUnits); + //--- Get the infantry limit based off the infantry upgrade. + _realSize = ((sideJoined) Call GetSideUpgrades) select 0; + switch (_realSize) do { + case 0: {_realSize = round(_mbu / 4)}; + case 1: {_realSize = round(_mbu / 4)*2}; + case 2: {_realSize = round(_mbu / 4)*3}; + case 3: {_realSize = _mbu}; + default {_realSize = _mbu}; + }; + if (_isInfantry) then {if ((unitQueu + _size + 1) > _realSize) then {_skip = true;hint parseText(Format [localize 'STR_WF_MaxGroup',_realSize])}}; + + if (!_isInfantry && !_skip) then { + _cpt = 0; + if (_driver) then {_cpt = _cpt + 1}; + if (_gunner) then {_cpt = _cpt + 1}; + if (_commander) then {_cpt = _cpt + 1}; + if (_extracrew) then {_cpt = _cpt + ((_currentUnit select QUERYUNITCREW) select 3)}; + if ((unitQueu + _size + _cpt) > _realSize && _cpt != 0) then {_skip = true;hint parseText(Format [localize 'STR_WF_MaxGroup',_realSize])}; + }; + }; + if !(_skip) then { + //--- Check the max queu. + if ((Format["WFBE_C_QUEUE_%1",_type] Call GetNamespace) < (Format["WFBE_C_QUEUE_%1_MAX",_type] Call GetNamespace)) then { + [Format["WFBE_C_QUEUE_%1",_type],(Format["WFBE_C_QUEUE_%1",_type] Call GetNamespace)+1,true] Call SetNamespace; + + _queu = _closest getVariable 'queu'; + _txt = parseText(Format [localize 'STR_WF_BuyEffective',_currentUnit select QUERYUNITLABEL]); + if (!isNil '_queu') then {if (count _queu > 0) then {_txt = parseText(Format [localize 'STR_WF_Queu',_currentUnit select QUERYUNITLABEL])}}; + hint _txt; + _params = if (_isInfantry) then {[_closest,_unit,[],_type,_cpt]} else {[_closest,_unit,[_driver,_gunner,_commander,_extracrew,_isLocked],_type,_cpt]}; + _params Spawn BuildUnit; + -(_currentCost) Call ChangePlayerFunds; + } else { + hint parseText(Format [localize 'STR_WF_Queu_Max',Format["WFBE_C_QUEUE_%1_MAX",_type] Call GetNamespace]); + }; + }; + }; + }; + + //--- Tabs selection. + if (MenuAction == 101) then {MenuAction = -1;if (barracksInRange) then {_currentIDC = 12005;_type = 'Barracks';_val = 0;_update = true}}; + if (MenuAction == 102) then {MenuAction = -1;if (lightInRange) then {_currentIDC = 12006;_type = 'Light';_val = 1;_update = true}}; + if (MenuAction == 103) then {MenuAction = -1;if (heavyInRange) then {_currentIDC = 12007;_type = 'Heavy';_val = 2;_update = true}}; + if (MenuAction == 104) then {MenuAction = -1;if (aircraftInRange) then {_currentIDC = 12008;_type = 'Aircraft';_val = 3;_update = true}}; + if (MenuAction == 105) then {MenuAction = -1;if (depotInRange) then {_currentIDC = 12020;_type = 'Depot';_val = 4;_update = true}}; + if (MenuAction == 106) then {MenuAction = -1;if (hangarInRange) then {_currentIDC = 12021;_type = 'Airport';_val = 3;_update = true}}; + + //--- driver-gunner-commander icons. + if (MenuAction == 201) then {MenuAction = -1;_driver = if (_driver) then {false} else {true};_updateDetails = true}; + if (MenuAction == 202) then {MenuAction = -1;_gunner = if (_gunner) then {false} else {true};_updateDetails = true}; + if (MenuAction == 203) then {MenuAction = -1;_commander = if (_commander) then {false} else {true};_updateDetails = true}; + if (MenuAction == 204) then {MenuAction = -1;_extracrew = if (_extracrew) then {false} else {true};_updateDetails = true}; + + //--- Factory DropDown list value has changed. + if (MenuAction == 301) then {MenuAction = -1;_factSel = lbCurSel 12018;_closest = _sorted select _factSel;_updateMap = true}; + + //--- Selection change, we update the details. + if (MenuAction == 302) then {MenuAction = -1;_updateDetails = true}; + + //--- Faction Filter changed. + if (MenuAction == 303) then {MenuAction = -1;_update = true;[Format["WFBE_%1%2CURRENTFACTIONSELECTED",sideJoinedText,_type],(lbCurSel _comboFaction),true] Call SetNamespace}; + + //--- Lock icon. + if (MenuAction == 401) then {MenuAction = -1;_isLocked = if (_isLocked) then {false} else {true};_updateDetails = true}; + + //--- Player funds. + ctrlSetText [12019,Format [localize 'STR_WF_Cash',Call GetPlayerFunds]]; + + //--- Update tabs. + if (_update) then { + _listUnits = Format ['WFBE_%1%2UNITS',sideJoinedText,_type] Call GetNamespace; + + [_comboFaction,_type] Call UIChangeComboBuyUnits; + [_listUnits,_type,_listBox,_val] Call UIFillListBuyUnits; + + //--- Update tabs icons. + _IDCS = [12005,12006,12007,12008,12020,12021]; + _IDCS = _IDCS - [_currentIDC]; + _con = _display DisplayCtrl _currentIDC; + _con ctrlSetTextColor [0.75,0.75,0.75,1]; + {_con = _display DisplayCtrl _x;_con ctrlSetTextColor [0.4, 0.4, 0.4, 1]} forEach _IDCS; + + _update = false; + _updateList = true; + _updateDetails = true; + }; + + //--- Update factories. + if (_updateList) then { + switch (_type) do { + //--- Specials. + case 'Depot': { + _nObjects = nearestObjects [(vehicle player), WFDEPOT,('WFBE_TOWNPURCHASERANGE' Call GetNamespace)]; + _closest = if (count _nObjects > 0) then {_nObjects select 0} else {objNull}; + _sorted = [_closest]; + }; + case 'Airport': { + _sorted = [(vehicle player),Airfields] Call SortByDistance; + _closest = _sorted select 0; + _sorted = [_closest]; + }; + //--- Factories + default { + _buildings = (sideJoinedText) Call GetSideStructures; + _factories = [sideJoined,Format ['WFBE_%1%2TYPE',sideJoinedText,_type] Call GetNamespace,_buildings] Call GetFactories; + _sorted = [(vehicle player),_factories] Call SortByDistance; + _closest = _sorted select 0; + _countAlive = count _factories; + }; + }; + + //--- Refresh the Factory DropDown list. + lbClear 12018; + { + _nearest = [_x,towns] Call SortByDistance; + _nearTown = (_nearest select 0) getVariable 'name'; + _txt = _type + ' ' + _nearTown + ' ' + str (round((vehicle player) distance _x)) + 'M'; + lbAdd[12018,_txt]; + } forEach _sorted; + lbSetCurSel [12018,0]; + + _updateList = false; + _updateMap = true; + }; + + //--- Display Factory Queu. + _queu = _closest getVariable "queu"; + _value = if (isNil '_queu') then {0} else {count (_closest getVariable "queu")}; + ctrlSetText[12024,Format[localize 'STR_WF_Queued',str _value]]; + + //--- List selection changed. + if (_updateDetails) then { + _currentRow = lnbCurSelRow _listBox; + //--- Our list is not empty. + if (_currentRow != -1) then { + _currentValue = lnbValue[_listBox,[_currentRow,0]]; + _unit = _listUnits select _currentValue; + _currentUnit = _unit Call GetNamespace; + ctrlSetText [12009,_currentUnit select QUERYUNITPICTURE]; + ctrlSetText [12033,_currentUnit select QUERYUNITFACTION]; + ctrlSetText [12035,str (_currentUnit select QUERYUNITTIME)]; + _currentCost = _currentUnit select QUERYUNITPRICE; + + _isInfantry = if (_unit isKindOf 'Man') then {true} else {false}; + + //--- Update driver-gunner-commander icons. + if !(_isInfantry) then { + ctrlSetText [12036,"N/A"]; + ctrlSetText [12037,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'transportSoldier'))]; + ctrlSetText [12038,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'maxSpeed'))]; + ctrlSetText [12039,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'armor'))]; + if (_type != 'Depot') then { + _slots = _currentUnit select QUERYUNITCREW; + + if (typeName _slots == "ARRAY") then { + _hasCommander = _slots select 0; + _hasGunner = _slots select 1; + _turretsCount = _slots select 3; + _extra = 0; + + _maxOut = false; + if (_lastType != _type || _lastSel != _currentRow) then {_maxOut = true}; + + if (_maxOut) then { + _driver = true; + _gunner = true; + _commander = true; + _extracrew = false; + }; + + if !(_hasGunner) then {_gunner = false}; + + if !(_hasCommander) then {_commander = false}; + + if (_turretsCount == 0) then {_extracrew = false}; + + ctrlShow[_IDCSVehi select 0, true]; + ctrlShow[_IDCSVehi select 1, _hasGunner]; + ctrlShow[_IDCSVehi select 2, _hasCommander]; + ctrlShow[_IDCSVehi select 3, if (_turretsCount == 0) then {false} else {true}]; + + _c = 0; + { + _color = if (_x) then {_enabledColor} else {_disabledColor}; + _con = _display displayCtrl (_IDCSVehi select _c); + _con ctrlSetTextColor _color; + + _c = _c + 1; + } forEach [_driver,_gunner,_commander,_extracrew]; + + if (_driver) then {_extra = _extra + 1}; + if (_gunner) then {_extra = _extra + 1}; + if (_commander) then {_extra = _extra + 1}; + if (_extracrew) then {_extra = _extra + _turretsCount}; + + //--- Set the 'extra' price. + _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra); + } else {//--- Backward compability. + _c = 0; + _extra = 0; + + //--- Enabled AI by default. + _extracrew = false; + _maxOut = false; + if (_lastType != _type || _lastSel != _currentRow) then {_maxOut = true}; + + switch (_slots) do { + case 1: { + if (_maxOut) then {_driver = true}; + if (_driver) then {_extra = _extra + 1}; + _gunner = false; + _commander = false; + }; + case 2: { + if (_maxOut) then {_driver = true;_gunner = true}; + if (_driver) then {_extra = _extra + 1}; + if (_gunner) then {_extra = _extra + 1}; + _commander = false; + }; + case 3: { + if (_maxOut) then {_driver = true;_gunner = true;_commander = true}; + if (_driver) then {_extra = _extra + 1}; + if (_gunner) then {_extra = _extra + 1}; + if (_commander) then {_extra = _extra + 1}; + }; + }; + + //--- Show the icons. + { + _show = false; + if (_c < _slots) then {_show = true}; + ctrlShow [_x,_show]; + _c = _c + 1; + } forEach _IDCSVehi; + + //--- Mask extra crew. + ctrlShow[_IDCSVehi select 3, false]; + + _i = 0; + + //--- Set the icons. + { + _color = if (_x) then {_enabledColor} else {_disabledColor}; + _con = _display displayCtrl (_IDCSVehi select _i); + _con ctrlSetTextColor _color; + _i = _i + 1; + } forEach [_driver,_gunner,_commander,_extracrew]; + + //--- Set the 'extra' price. + _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra); + }; + } else { + {ctrlShow [_x,false]} forEach (_IDCSVehi); + _driver = false; + _gunner = false; + _commander = false; + _extracrew = false; + }; + } else { + ctrlSetText [12036,Format ["%1/100",(_currentUnit select QUERYUNITSKILL) * 100]]; + ctrlSetText [12037,"N/A"]; + ctrlSetText [12038,"N/A"]; + ctrlSetText [12039,"N/A"]; + + {ctrlShow [_x,false]} forEach (_IDCSVehi); + _driver = false; + _gunner = false; + _commander = false; + _extracrew = false; + + //--- Display a unit's loadout. + _weapons = (getArray (configFile >> 'CfgVehicles' >> _unit >> 'weapons')) - ['Put','Throw']; + _magazines = getArray (configFile >> 'CfgVehicles' >> _unit >> 'magazines'); + + _classMags = []; + _classMagsAmount = []; + _MagsLabel = []; + + { + _findAt = _classMags find _x; + if (_findAt == -1) then { + _classMags = _classMags + [_x]; + _classMagsAmount = _classMagsAmount + [1]; + _MagsLabel = _MagsLabel + [[_x,'displayName','CfgMagazines'] Call GetConfigInfo]; + } else { + _classMagsAmount set [_findAt, (_classMagsAmount select _findAt) + 1]; + }; + } forEach _magazines; + _txt = "" + (localize 'STR_WF_Weapons') + " :
{"; + for [{_i = 0},{_i < count _weapons},{_i = _i + 1}] do { + _txt = _txt + "" + ([(_weapons select _i),'displayName','CfgWeapons'] Call GetConfigInfo) + ""; + if ((_i+1) < count _weapons) then {_txt = _txt + ", "}; + }; + _txt = _txt + "}

"; + _txt = _txt + "" + (localize 'STR_WF_Magazines') + " :
{"; + for [{_i = 0},{_i < count _MagsLabel},{_i = _i + 1}] do { + _txt = _txt + "" + ((_MagsLabel select _i) + " x " + str (_classMagsAmount select _i)) + ""; + if ((_i+1) < count _MagsLabel) then {_txt = _txt + ", "}; + }; + _txt = _txt + "}"; + + (_display displayCtrl 12022) ctrlSetStructuredText (parseText _txt); + }; + + //--- Lock Icon. + if !(_isInfantry) then { + ctrlShow[_IDCLock,true]; + _color = if (_isLocked) then {_enabledColor} else {_disabledColor}; + _con = _display displayCtrl _IDCLock; + _con ctrlSetTextColor _color; + } else { + ctrlShow[_IDCLock,false]; + }; + + //--- Long description. + if !(_isInfantry) then { + if (isClass (configFile >> 'CfgVehicles' >> _unit >> 'Library')) then { + _txt = getText (configFile >> 'CfgVehicles' >> _unit >> 'Library' >> 'libTextDesc'); + (_display displayCtrl 12022) ctrlSetStructuredText (parseText _txt); + } else { + (_display displayCtrl 12022) ctrlSetStructuredText (parseText ''); + }; + }; + + ctrlSetText [12034,Format ["$ %1.",_currentCost]]; + _updateDetails = false; + } else { + {ctrlSetText [_x , ""]} forEach [12009,12010,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037,12038,12039]; + (_display displayCtrl 12022) ctrlSetStructuredText (parseText ''); + }; + }; + + //--- Update the Factory Minimap position. + if (_updateMap) then { + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [2,.075,getPos _closest]; + ctrlMapAnimCommit _map; + _updateMap = false; + }; + + //--- Check that the factories of the current type are still alive. + _lastCheck = _lastCheck + 0.1; + if (_lastCheck > 2 && _type != 'Depot' && _type != 'Airport') then { + _lastCheck = 0; + _buildings = (sideJoinedText) Call GetSideStructures; + _factories = [sideJoined,Format ['WFBE_%1%2TYPE',sideJoinedText,_type] Call GetNamespace,_buildings] Call GetFactories; + if (count _factories != _countAlive) then {_updateList = true}; + }; + + _lastSel = lnbCurSelRow _listBox; + _lastType = _type; + sleep 0.1; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_ClearCurrentCutDisplay.sqf b/Client/GUI/GUI_ClearCurrentCutDisplay.sqf new file mode 100644 index 0000000..610fbfe --- /dev/null +++ b/Client/GUI/GUI_ClearCurrentCutDisplay.sqf @@ -0,0 +1 @@ +["currentCutDisplay", displayNull] call BIS_FNC_GUIset; \ No newline at end of file diff --git a/Client/GUI/GUI_CommandMenu.sqf b/Client/GUI/GUI_CommandMenu.sqf new file mode 100644 index 0000000..c373036 --- /dev/null +++ b/Client/GUI/GUI_CommandMenu.sqf @@ -0,0 +1,53 @@ + +private ["_enable","_exited"]; +MenuAction = -1; + +while {alive player && dialog} do { + //--- Command AI. + _enable = false; + if (!isNull(commanderTeam)) then {if (commanderTeam == group player) then {_enable = true}}; + ctrlEnable [13001,_enable]; //--- Team Orders + ctrlEnable [13004,_enable]; //--- Commander Menu + ctrlEnable [13002,commandInRange]; //--- Special Menu + ctrlEnable [13003,commandInRange]; //--- Upgrade Menu + + sleep 0.1; + + if (side player != sideJoined) exitWith {closeDialog 0}; + if !(dialog) exitWith {}; + + //--- Command AI. + if (MenuAction == 1) exitWith { + MenuAction = -1; + CloseDialog 0; + CreateDialog "RscOrderMenu"; + }; + + //--- Artillery Menu. + if (MenuAction == 2) exitWith { + MenuAction = -1; + CloseDialog 0; + CreateDialog "RscArtilleryMenu"; + }; + + //--- Upgrade Menu. + if (MenuAction == 3) exitWith { + MenuAction = -1; + CloseDialog 0; + CreateDialog "RscUpgradeMenu"; + }; + + //--- Commander Menu. + if (MenuAction == 4) exitWith { + MenuAction = -1; + CloseDialog 0; + CreateDialog "RscCommanderMenu"; + }; + + //--- Support Menu. + if (MenuAction == 5) exitWith { + MenuAction = -1; + CloseDialog 0; + CreateDialog "RscSupportMenu"; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_CommanderMenu.sqf b/Client/GUI/GUI_CommanderMenu.sqf new file mode 100644 index 0000000..20864e3 --- /dev/null +++ b/Client/GUI/GUI_CommanderMenu.sqf @@ -0,0 +1,159 @@ +disableSerialization; + +_display = _this select 0; +_map = _display DisplayCtrl 23002; + +_hqDeployed = (sideJoined) Call GetSideHQDeployed; +if (!_hqDeployed || !paramUseWorkers) then {ctrlEnable [23004, false];ctrlEnable [23006, false]}; +if !(paramUseWorkers) then {ctrlSetText[23005, localize 'STR_WF_Disabled']}; + +MenuAction = -1; + +_maxWorkers = 'WFBE_WORKERS_MAX' Call GetNamespace; +_workerPrice = 'WFBE_WORKERS_PRICE' Call GetNamespace; +_incomeSystem = 'WFBE_INCOMESYSTEM' Call GetNamespace; +_incomeDividision = 'WFBE_INC_DIVIDE_COM' Call GetNamespace; +_aliveWorkers = []; +_workers = []; +_lastWorkersUpdate = -10; +_lastComboUpdate = -30; +_lastPurchase = -5; +_income = 0; +_updateComboWorker = true; +_hasStarted = true; + +if (_incomeSystem in [3,4]) then { + sliderSetRange[23010,0,100]; + _income = Call Compile Format["%1CommanderPercent",sideJoined]; + sliderSetPosition[23010, _income]; +} else { + ctrlEnable [23012, false]; +}; + +while {alive player && dialog} do { + if (side player != sideJoined) exitWith {closeDialog 0}; + if !(dialog) exitWith {}; + + _funds = Call GetPlayerFunds; + + //--- Income System. + if (_incomeSystem in [3,4]) then { + ctrlSetText[23011, Format["%1%2",_income,"%"]]; + _currentPercent = Call Compile Format["%1CommanderPercent",sideJoined]; + + _income = floor(sliderPosition 23010); + + sliderSetPosition[23010, _income]; + + _calInc = (sideJoined) Call GetTownsIncome; + + if (_currentPercent != _income || _hasStarted) then { + if (_hasStarted) then {_hasStarted = false}; + + _income_players = 0; + _income_commander = 0; + switch (_incomeSystem) do { + case 3: { + _income_players = round(_calInc * (((100 - _income)/100)/maxPlayers)); + _income_commander = round((_calInc * (_income/100)) / _incomeDividision) + _income_players; + }; + case 4: { + _income_players = round(_calInc * (100 - _income) / 100); + _income_commander = round((_calInc - _income_players)*maxPlayers) + _income_players; + }; + }; + + ctrlSetText [23013, localize 'STR_WF_Income_Sys_Com' + ": $" + str(_income_commander) + "."]; + ctrlSetText [23014, localize 'STR_WF_Income_Sys_Ply' + ": $" + str(_income_players) + "."]; + }; + + if (MenuAction == 3) then { + MenuAction = -1; + + if (_currentPercent != _income) then { + Call Compile Format["%1CommanderPercent = _income; publicVariable '%1CommanderPercent';",sideJoined]; + }; + }; + }; + + //--- Workers System. + if (paramUseWorkers) then { + if (time - _lastComboUpdate > 5) then { + _updateComboWorker = true; + _lastComboUpdate = time; + }; + + _workers = Call Compile Format ["WF_%1Workers",sideJoinedText]; + if (time - _lastWorkersUpdate > 5) then {_aliveWorkers = (_workers) Call GetLiveUnits;_lastWorkersUpdate = time}; + _hqDeployed = (sideJoined) Call GetSideHQDeployed; + + if (!_hqDeployed || time - _lastPurchase < 3 || count _aliveWorkers >= _maxWorkers || _funds < _workerPrice) then {ctrlEnable [23004, false]} else {ctrlEnable [23004, true]}; + + //--- Workers tracker. + if (_updateComboWorker) then { + _updateComboWorker = false; + lbClear 23007; + + for '_i' from 0 to count(_aliveWorkers)-1 do { + lbAdd [23007, localize "STR_WF_Workers" + " " + str(_i+1)]; + }; + }; + + ctrlSetText [23005, Format ["$%1. (%2/%3)",_workerPrice,count _aliveWorkers,_maxWorkers]]; + }; + + //--- Hire Workers. + if (MenuAction == 1) then { + MenuAction = -1; + + //--- Which index. + _index = 0; + for '_i' from 0 to count(_workers)-1 do { + if (isNull (_workers select _i)) exitWith {_index = _i}; + }; + + if (_index == 0 && count(_workers) > 0) then {_index = count _workers}; + + if (count _aliveWorkers <= _maxWorkers && _hqDeployed) then { + -(_workerPrice) Call ChangePlayerFunds; + + WFBE_RequestWorker = ['SRVFNCREQUESTWORKER',[sideJoined,(sideJoined) Call GetSideHQ,_index]]; + publicVariable 'WFBE_RequestWorker'; + if (isHostedServer) then {['SRVFNCREQUESTWORKER',[sideJoined,(sideJoined) Call GetSideHQ,_index]] Spawn HandleSPVF}; + + _workers set [_index, WF_Logic]; + Call Compile Format ["WF_%1Workers = _workers; publicVariable 'WF_%1Workers';",sideJoinedText]; + + _lastPurchase = time; + _lastWorkersUpdate = -10; + _updateComboWorker = true; + }; + }; + + //--- Disband Worker. + if (MenuAction == 2) then { + MenuAction = -1; + + _value = lbCurSel 23007; + + if (_value != -1) then { + (_aliveWorkers select _value) setDammage 1; + _lastWorkersUpdate = -10; + _updateComboWorker = true; + }; + }; + + //--- Minimap update. + if (MenuAction == 100) then { + MenuAction = -1; + _value = lbCurSel 23007; + + if (_value != -1) then { + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [1,.175,getPos(_aliveWorkers select _value)]; + ctrlMapAnimCommit _map; + }; + }; + + sleep 0.1; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Display_Parameters.sqf b/Client/GUI/GUI_Display_Parameters.sqf new file mode 100644 index 0000000..84e7956 --- /dev/null +++ b/Client/GUI/GUI_Display_Parameters.sqf @@ -0,0 +1,30 @@ +/* Ingame parameters dump. */ + +for [{_i = 0},{_i < (count (missionConfigFile/"Params"))},{_i = _i + 1}] do { + _paramName = (configName ((missionConfigFile >> "Params") select _i)); + _text = getText (missionConfigFile >> "Params" >> _paramName >> "title"); + _values = getArray (missionConfigFile >> "Params" >> _paramName >> "values"); + _texts = getArray (missionConfigFile >> "Params" >> _paramName >> "texts"); + + _value = if (isMultiplayer) then {paramsArray select _i} else {getNumber (missionConfigFile >> "Params" >> _paramName >> "default")}; + _status = _texts select (_values find _value); + + lnbAddRow [22003,[_text,_status]]; +}; + +while {alive player && dialog} do { +/*---it is in the Main Menu now //MrNiceGuy + _uptime = Call GetTime; + ctrlSetText [22005,Format[localize 'STR_WF_MAIN_Uptime',_uptime select 0,_uptime select 1,_uptime select 2, _uptime select 3]]; +*/ + sleep 0.1; + if (side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; + + //--- Back Button. + if (MenuAction == 1) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_EASA.sqf b/Client/GUI/GUI_EASA.sqf new file mode 100644 index 0000000..590a019 --- /dev/null +++ b/Client/GUI/GUI_EASA.sqf @@ -0,0 +1,50 @@ + +private ["_i","_j","_listPrice","_listDesc","_cdata","_funds","_iddx","_type","_data","_listBox"]; +MenuAction = -1; + +_type = ('WFBE_EASA_Vehicles' Call GetNamespace) find (typeOf (vehicle player)); +if (_type == -1) exitWith {diag_log Format['[WFBE (ERROR)][frameno:%2 | ticktime:%3] GUI_EASA: The player vehicle was not found within the list (%1)',_type,diag_frameno,diag_tickTime]}; +_data = (('WFBE_EASA_Loadouts' Call GetNamespace) select _type); + + +_listPrice = []; +_listDesc = []; +_listBox = 23003; +for [{_i = 0},{_i < count(_data)},{_i = _i + 1}] do { + _cdata = _data select _i; + for [{_j = 0},{_j < count(_cdata)},{_j = _j + 1}] do { + if (_j == 0) then {_listPrice = _listPrice + [(_cdata select 0) select 0]}; + if (_j == 1) then { + _listDesc = _listDesc + [(_cdata select 1) select 0]; + lnbAddRow [_listBox,["$"+str((_cdata select 0) select 0)+".",(_cdata select 1) select 0]]}; + if (_j > 1) then { + }; + }; +}; + +if (count _listPrice > 0) then {lnbSetCurSelRow [_listBox,0]} else {lnbSetCurSelRow [_listBox,-1]}; + +while {alive player && dialog} do { + sleep 0.1; + + if (side player != sideJoined) exitWith {closeDialog 0}; + if !(dialog) exitWith {}; + + //--- Command AI. + if (MenuAction == 101) then { + MenuAction = -1; + _funds = Call GetPlayerFunds; + + _iddx = lnbCurSelRow _listBox; + if (_iddx != -1) then { + if (_funds > (_listPrice select _iddx)) then { + [vehicle player, _iddx, true] Call EASA_Equip; + -(_listPrice select _iddx) Call ChangePlayerFunds; + hint parseText(Format[localize 'STR_WF_EASA_Purchase',(_listDesc select _iddx)]); + closeDialog 0; + } else { + hint parseText(Format[localize 'STR_WF_Funds_Missing',(_listPrice select _iddx) - _funds,_listDesc select _iddx]); + }; + }; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_EndOfGameStats.sqf b/Client/GUI/GUI_EndOfGameStats.sqf new file mode 100644 index 0000000..af224cb --- /dev/null +++ b/Client/GUI/GUI_EndOfGameStats.sqf @@ -0,0 +1,184 @@ + +private ["_sideText","_recruited","_casualties","_created","_lost","_eastRecruitedCount","_eastCasualtyCount","_eastCreatedCount","_eastLostCount","_westRecruitedCount","_westCasualtyCount","_westCreatedCount","_westLostCount","_timePassed","_side","_sideName","_width","_eastUnitsCreated","_eastCasualties","_eastVehiclesCreated","_eastVehiclesLost","_westUnitsCreated","_westCasualties","_westVehiclesCreated","_westVehiclesLost","_eastCreatedRate","_eastLostRate","_eastRecruitedRate","_eastCasualtiesRate","_westCreatedRate","_westLostRate","_westRecruitedRate","_westCasualtiesRate","_westRecruitedCounter","_westRecruitedBar","_westCasualtyCounter","_westCasualtyBar","_westCreatedCounter","_westCreatedBar","_westLostCounter","_westLostBar","_position","_eastRecruitedCounter","_eastRecruitedBar","_eastCasualtyCounter","_eastCasualtyBar","_eastCreatedCounter","_eastCreatedBar","_eastLostCounter","_eastLostBar"]; +disableSerialization; + +12450 cutText ["","PLAIN",0]; + +_side = _this Select 0; +_sideText = Localize "STR_WF_PARAMETER_Side_East"; +if (_side == West) then {_sideText = Localize "STR_WF_PARAMETER_Side_West"}; +_sideName = Format[Localize "STR_WF_END_Victory",_sideText]; + +_width = 0.4; +TitleText["","PLAIN"]; +sleep 0.5; +CutRsc["EndOfGameStats","PLAIN",0]; + +_eastUnitsCreated = WF_Logic getVariable "eastUnitsCreated"; +_eastCasualties = WF_Logic getVariable "eastCasualties"; +_eastVehiclesCreated = WF_Logic getVariable "eastVehiclesCreated"; +_eastVehiclesLost = WF_Logic getVariable "eastVehiclesLost"; +_westUnitsCreated = WF_Logic getVariable "westUnitsCreated"; +_westCasualties = WF_Logic getVariable "westCasualties"; +_westVehiclesCreated = WF_Logic getVariable "westVehiclesCreated"; +_westVehiclesLost = WF_Logic getVariable "westVehiclesLost"; + +_eastCreatedRate = _eastVehiclesCreated / 5 * .1; +_eastLostRate = _eastVehiclesLost / 5 * .1; +_eastRecruitedRate = _eastUnitsCreated / 5 * .1; +_eastCasualtiesRate = _eastCasualties / 5 * .1; + +_westCreatedRate = _westVehiclesCreated / 5 * .1; +_westLostRate = _westVehiclesLost / 5 * .1; +_westRecruitedRate = _westUnitsCreated / 5 * .1; +_westCasualtiesRate = _westCasualties / 5 * .1; + +waitUntil {!isNull (["currentCutDisplay"] call BIS_FNC_GUIget)}; +((["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90001) CtrlSetText _sideName; + +_westRecruitedCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90200; +_westRecruitedBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90201; +_westCasualtyCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90202; +_westCasualtyBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90203; +_westCreatedCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90204; +_westCreatedBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90205; +_westLostCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90206; +_westLostBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90207; + +_position = CtrlPosition _westRecruitedBar; +_recruited = _width * (_westUnitsCreated / 500); +if (_recruited > _width) then {_recruited = _width}; +_position Set[2,0]; +_westRecruitedBar CtrlSetPosition _position; +_westRecruitedBar CtrlCommit 0; +_position Set[2,_recruited]; +_westRecruitedBar CtrlSetPosition _position; +_westRecruitedBar CtrlCommit 8; + +_position = CtrlPosition _westCasualtyBar; +_casualties = _width * (_westCasualties / 500); +if (_casualties > _width) then {_casualties = _width}; +_position Set[2,0]; +_westCasualtyBar CtrlSetPosition _position; +_westCasualtyBar CtrlCommit 0; +_position Set[2,_casualties]; +_westCasualtyBar CtrlSetPosition _position; +_westCasualtyBar CtrlCommit 8; + +_position = CtrlPosition _westCreatedBar; +_created = _width * (_westVehiclesCreated / 150); +if (_created > _width) then {_created = _width}; +_position Set[2,0]; +_westCreatedBar CtrlSetPosition _position; +_westCreatedBar CtrlCommit 0; +_position Set[2,_created]; +_westCreatedBar CtrlSetPosition _position; +_westCreatedBar CtrlCommit 8; + +_position = CtrlPosition _westLostBar; +_lost = _width * (_westVehiclesLost / 150); +if (_lost > _width) then {_lost = _width}; +_position Set[2,0]; +_westLostBar CtrlSetPosition _position; +_westLostBar CtrlCommit 0; +_position Set[2,_lost]; +_westLostBar CtrlSetPosition _position; +_westLostBar CtrlCommit 8; + +_eastRecruitedCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90101; +_eastRecruitedBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90102; +_eastCasualtyCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90103; +_eastCasualtyBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90104; +_eastCreatedCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90105; +_eastCreatedBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90106; +_eastLostCounter = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90107; +_eastLostBar = (["currentCutDisplay"] call BIS_FNC_GUIget) DisplayCtrl 90108; + +_position = CtrlPosition _eastRecruitedBar; +_recruited = _width * (_eastUnitsCreated / 500); +if (_recruited > _width) then {_recruited = _width}; +_position Set[2,0]; +_eastRecruitedBar CtrlSetPosition _position; +_eastRecruitedBar CtrlCommit 0; +_position Set[2,_recruited]; +_eastRecruitedBar CtrlSetPosition _position; +_eastRecruitedBar CtrlCommit 8; + +_position = CtrlPosition _eastCasualtyBar; +_casualties = _width * (_eastCasualties / 500); +if (_casualties > _width) then {_casualties = _width}; +_position Set[2,0]; +_eastCasualtyBar CtrlSetPosition _position; +_eastCasualtyBar CtrlCommit 0; +_position Set[2,_casualties]; +_eastCasualtyBar CtrlSetPosition _position; +_eastCasualtyBar CtrlCommit 8; + +_position = CtrlPosition _eastCreatedBar; +_created = _width * (_eastVehiclesCreated / 150); +if (_created > _width) then {_created = _width}; +_position Set[2,0]; +_eastCreatedBar CtrlSetPosition _position; +_eastCreatedBar CtrlCommit 0; +_position Set[2,_created]; +_eastCreatedBar CtrlSetPosition _position; +_eastCreatedBar CtrlCommit 8; + +_position = CtrlPosition _eastLostBar; +_lost = _width * (_eastVehiclesLost / 150); +if (_lost > _width) then {_lost = _width}; +_position Set[2,0]; +_eastLostBar CtrlSetPosition _position; +_eastLostBar CtrlCommit 0; +_position Set[2,_lost]; +_eastLostBar CtrlSetPosition _position; +_eastLostBar CtrlCommit 8; + +_timePassed = 0; +_eastCasualtyCount = 0; +_eastRecruitedCount = 0; +_eastCreatedCount = 0; +_eastLostCount = 0; + +_westCasualtyCount = 0; +_westRecruitedCount = 0; +_westCreatedCount = 0; +_westLostCount = 0; + +while {_timePassed < 8} do { + sleep 0.1; + + _eastRecruitedCount = _eastRecruitedCount + _eastRecruitedRate; + if (_eastRecruitedCount > _eastUnitsCreated) then {_eastRecruitedCount = _eastUnitsCreated}; + _eastRecruitedCounter CtrlSetText Format["%1",_eastRecruitedCount - (_eastRecruitedCount % 1)]; + + _eastCasualtyCount = _eastCasualtyCount + _eastCasualtiesRate; + if (_eastCasualtyCount > _eastCasualties) then {_eastCasualtyCount = _eastCasualties}; + _eastCasualtyCounter CtrlSetText Format["%1",_eastCasualtyCount - (_eastCasualtyCount % 1)]; + + _eastCreatedCount = _eastCreatedCount + _eastCreatedRate; + if (_eastCreatedCount > _eastVehiclesCreated) then {_eastCreatedCount = _eastVehiclesCreated}; + _eastCreatedCounter CtrlSetText Format["%1",_eastCreatedCount - (_eastCreatedCount % 1)]; + + _eastLostCount = _eastLostCount + _eastLostRate; + if (_eastLostCount > _eastVehiclesLost) then {_eastLostCount = _eastVehiclesLost}; + _eastLostCounter CtrlSetText Format["%1",_eastLostCount - (_eastLostCount % 1)]; + + _westRecruitedCount = _westRecruitedCount + _westRecruitedRate; + if (_westRecruitedCount > _westUnitsCreated) then {_westRecruitedCount = _westUnitsCreated}; + _westRecruitedCounter CtrlSetText Format["%1",_westRecruitedCount - (_westRecruitedCount % 1)]; + + _westCasualtyCount = _westCasualtyCount + _westCasualtiesRate; + if (_westCasualtyCount > _westCasualties) then {_westCasualtyCount = _westCasualties}; + _westCasualtyCounter CtrlSetText Format["%1",_westCasualtyCount - (_westCasualtyCount % 1)]; + + _westCreatedCount = _westCreatedCount + _westCreatedRate; + if (_westCreatedCount > _westVehiclesCreated) then {_westCreatedCount = _westVehiclesCreated}; + _westCreatedCounter CtrlSetText Format["%1",_westCreatedCount - (_westCreatedCount % 1)]; + + _westLostCount = _westLostCount + _westLostRate; + if (_westLostCount > _westVehiclesLost) then {_westLostCount = _westVehiclesLost}; + _westLostCounter CtrlSetText Format["%1",_westLostCount - (_westLostCount % 1)]; + + _timePassed = _timePassed + 0.1; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_GearAce.sqf b/Client/GUI/GUI_GearAce.sqf new file mode 100644 index 0000000..e92a7e2 --- /dev/null +++ b/Client/GUI/GUI_GearAce.sqf @@ -0,0 +1,1415 @@ +private ["_indexWeapons", "_indexMagazines", "_indexOnBack", "_indexRuckWeapons", "_indexRuckMags", "_indexPrimary", "_indexSecondary", "_indexSidearm", "_typesIFAK", "_filterNames", "_primary", "_secondary", "_sidearm", "_misc", "_magazine", "_all", "_primaryBackpack", "_secondaryBackpack", "_sidearmBackpack", "_miscBackpack", "_allBackpack", "_currentGear", "_currentWeaponUIState", "_currentMagazineUIState", "_getCompatibleMagazines", "_weapon", "_weaponMags", "_mags", "_muzzles", "_getItemDataByConfigType", "_data", "_configType", "_item", "_W", "_getItemDataByFilterType", "_filter", "_get", "_inventoryToGear", "_ret", "_unit", "_backwep", "_current", "_ruckmags", "_ruckweapons", "_safeArray", "_getItemCost", "_itemName", "_getItemWeight", "_getRuckItemsVolume", "_gear", "_volume", "_getGearCost", "_price", "_cost", "_getGearWeight", "_weight", "_totalWeight", "_fillInBlankImages", "_i", "_renderGear", "_pic", "_itemIndex", "_specialIndex", "_mainMagIndex", "_sideMagIndex", "_ifakCount", "_isIFAK", "_wob", "_weaponUIState", "_magazineUIState", "_magazineSpace", "_forEachIndex", "_getItemCountByType", "_count", "_itemType", "_countThisOne", "_renderRuckContents", "_u", "_capacity", "_getGearRuck", "_getMagazineCountByPool", "_handgunpool", "_addMagazineToGear", "_magCount", "_magLimit", "_magSize", "_oldMagazines", "_applyGearToUnit", "_maybeRuck", "_addItemToRuck", "_ruck", "_size", "_added", "_packable", "_currentUnit", "_initialCost", "_updateGear", "_updateMainList", "_updateSecondaryList", "_updateUnit", "_backpackSelected", "_selectedWeapon", "_currentFilter", "_defaultWeap", "_defaultAmmo", "_defaultLoadoutCost", "_lbSelChanged", "_mainCommand", "_inventoryClick", "_gearAction", "_weaponList", "_magazineList", "_funds", "_respawnCost", "_mag", "_ruckIndex", "_ruckItemClass", "_ruckItem", "_add", "_itemCount", "_temp", "_respawnPenalty","_divisor"]; + +_indexWeapons = 0; +_indexMagazines = 1; +_indexOnBack = 2; +_indexRuckWeapons = 3; +_indexRuckMags = 4; +_indexPrimary = 5; +_indexSecondary = 6; +_indexSidearm = 7; +_typesIFAK = [ "ACE_Morphine", "ACE_Bandage", "ACE_Epinephrine" ]; +_filterNames = [ "all", "primary", "secondary", "sidearm", "misc" ]; + +_primary = +(WF_Logic getVariable 'primaryClasses'); +_secondary = +(WF_Logic getVariable 'secondaryClasses'); +_sidearm = +(WF_Logic getVariable 'sidearmClasses'); +_misc = +(WF_Logic getVariable 'miscClasses'); +_magazine = +(WF_Logic getVariable 'magazineClasses'); + +_all = _primary + _secondary + _sidearm + _misc; + +_primaryBackpack = []; +_secondaryBackpack = []; +_sidearmBackpack = _sidearm; +_miscBackpack = _misc + _magazine; +_allBackpack = _misc + _sidearm + _magazine; + +// Gear Array. Many methods use this format. It is: +// 0: Weapons +// 1: Magazines +// 2: ACE weapon on back +// 3: Weapons in rucksack as a sequence of doubles: [ item, quantity ] +// 4: Magazines in rucksack as a sequence of doubles: [ item, quantity ] +// 5: Current primary weapon +// 6: Current secondary weapon +// 7: Current sidearm +_currentGear = [ [], [], "", [], [], "", "", "" ]; + +// The following twe are arrays of doubles. Each double is [id, index] that maps +// UI controls to gear in the _currentGear structure. +// +// id: Control ID of a control in the gear dialog. +// index: index into the magazine or weapon array in _currentGear that corresponds to the +// weapon or magazine represented by the control in question. +_currentWeaponUIState = []; +_currentMagazineUIState = []; + +// Given a weapon class, get the magazines that will fit in it. +_getCompatibleMagazines = +{ + private ["_weapon","_weaponMags","_mags","_muzzles","_supportedMags","_csw"]; + + _weapon = _this; + _weaponMags = []; + _supportedMags = _magazine + _misc; + + _csw = ""; + + if(isText(configFile >> "CfgWeapons" >> _weapon >> "ace_crewmgtype")) then + { + _csw = getText(configFile >> "CfgWeapons" >> _weapon >> "ace_crewmgtype"); + }; + + if(_csw == "" && isText(configFile >> "CfgWeapons" >> _weapon >> "ace_crewtripodtype")) then + { + _csw = getText(configFile >> "CfgWeapons" >> _weapon >> "ace_crewtripodtype"); + }; + + if(_csw != "") then + { + _mags = getArray(configFile >> "CfgVehicles" >> _csw >> "ace_crewdummymags"); + if(!isNil "_mags") then + { + { + if(!(_x in _weaponMags) && _x in _supportedMags) then + { + _weaponMags = _weaponMags + [ _x ]; + }; + } forEach(_mags); + }; + } + else + { + // Disposable weapons have no magazines. + if(getNumber(configFile >> "CfgWeapons" >> _weapon >> "ace_disposable") != 1) then + { + // Main muzzle magazines... + _mags = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); + if (!isNil "_mags") then + { + { + if(!(_x in _weaponMags) && _x in _supportedMags) then + { + _weaponMags = _weaponMags + [ _x ]; + }; + } forEach(_mags); + }; + + _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); + if(!isNil "_muzzles") then + { + { + if ((typeName _x) == "STRING") then + { + _mags = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); + if (!isNil "_mags") then + { + { + if(!(_x in _weaponMags) && _x in _supportedMags) then + { + _weaponMags = _weaponMags + [_x]; + }; + } forEach(_mags); + }; + }; + } forEach(_muzzles); + }; + }; + }; + _weaponMags +}; + +// arg 0: item class +// arg 1: true if weapon, false if magazine +// returns item data +_getItemDataByConfigType = +{ + private ["_data", "_configType", "_item"]; + + _item = _this select 0; + _configType = _this select 1; + _data = nil; + if(_configType && !(isNil "_item")) then + { + _data = (_item+'_W') Call GetNamespace; + }; + if(isNil "_data") then + { + _data = _item Call GetNamespace; + }; + _data +}; + +// arg 0: item class +// arg 1: filter type e.g. "all" or "sidearm" +// returns item data +_getItemDataByFilterType = +{ + private [ "_item", "_filter", "_get" ]; + + _item = _this select 0; + _filter = _this select 1; + + if (_filter == 'secondary' || _filter == 'all') then { + _get = (_item+'_W') Call GetNamespace; + if (isNil '_get') then { + _get = _item Call GetNamespace; + }; + } else { + _get = _item Call GetNamespace; + }; + _get +}; + +// Argument 0: a unit +// +// Takes that unit's inventory and returns a gear array from it (see above). +_inventoryToGear = { + private ["_ret","_unit","_backwep","_get","_current","_ruckmags","_ruckweapons","_temp"]; + + _unit = _this select 0; + + _ret = [ [], [], "", [], [], "", "", "" ]; + + _backwep = _unit getVariable "ACE_weapononback"; + if (!isNil "_backwep") then + { + if ((typeName _backwep) == "STRING") then + { + _ret set [ _indexOnBack, _backwep ]; + }; + }; + + _temp = []; + { + _get = [ _x, true ] call _getItemDataByConfigType; + if(!isNil "_get") then + { + _temp = _temp + [_x]; + }; + } forEach(weapons _unit); + _ret set [ _indexWeapons, _temp ]; + + _temp = []; + { + _get = [ _x, false ] call _getItemDataByConfigType; + if(!isNil "_get") then + { + _temp = _temp + [_x]; + }; + } forEach(magazines _unit); + _ret set [ _indexMagazines, _temp ]; + + _get = [ primaryWeapon _unit, true ] call _getItemDataByConfigType; + if(!isNil "_get") then + { + _ret set [ _indexPrimary, primaryWeapon _unit ]; + } + else + { + _ret set [ _indexPrimary, "" ]; + }; + + _get = [ secondaryWeapon _unit, true ] call _getItemDataByConfigType; + if(!isNil "_get") then + { + _ret set [ _indexSecondary, secondaryWeapon _unit ]; + } + else + { + _ret set [ _indexSecondary, "" ]; + }; + + { + if (_x in _sidearm) exitWith + { + _ret set [ _indexSidearm, _x ]; + }; + } forEach(_ret select _indexWeapons); + + if ([_unit] call ACE_fnc_HasRuck) then { + _ruckmags = _unit getVariable "ACE_RuckMagContents"; + _ruckweapons = _unit getVariable "ACE_RuckWepContents"; + if(!isNil "_ruckweapons") then + { + _temp = []; + { + _get = [ _x select 0, true ] call _getItemDataByConfigType; + if(!isNil "_get") then + { + _temp = _temp + [_x]; + }; + } forEach(_ruckweapons); + _ret set [ _indexRuckWeapons, _temp ]; + }; + if(!isNil "_ruckmags") then + { + _temp = []; + { + _get = [ _x select 0, false ] call _getItemDataByConfigType; + if(!isNil "_get") then + { + _temp = _temp + [_x]; + }; + } forEach(_ruckmags); + _ret set [ _indexRuckMags, _temp ]; + }; + }; + + _ret +}; + +// Get an item's cost. +// Arguments [ item-name, is-weapon ] +// is-weapon is true for weapons or false for magazines +_getItemCost = +{ + private ["_itemName", "_configType","_ret","_get"]; + _itemName = _this select 0; + _configType = _this select 1; + _get = [ _itemName, _configType] call _getItemDataByConfigType; + _ret = 0; + if(!isNil "_get") then + { + _ret = _get select QUERYGEARCOST; + }; + _ret +}; + +// Get an item's weight +// Arguments [ item-name, config-type ] +// config-type is usually CfgWeapons or CfgMagazines. +_getItemWeight = +{ + private ["_itemName", "_configType","_ret"]; + _itemName = _this select 0; + _configType = _this select 1; + _ret = getNumber (configFile >> _configType >> _itemName >> "ACE_Weight"); + _ret +}; + +// arg: gear array +// returns: total volume of gear in ruck sack +_getRuckItemsVolume = +{ + private ["_gear", "_volume"]; + + _gear = _this; + _volume = 0; + + { + _volume = _volume + + (getNumber(configFile >> "CfgWeapons" >> (_x select 0) >> "ACE_size") * (_x select 1)); + } forEach(_gear select _indexRuckWeapons); + + { + _volume = _volume + + (getNumber(configFile >> "CfgMagazines" >> (_x select 0) >> "ACE_size") * (_x select 1)); + } forEach(_gear select _indexRuckMags); + _volume +}; + +// Takes a gear array for an argument and returns its cost. +_getGearCost = +{ + private ["_gear","_get","_price","_cost"]; + + _gear = _this; + _price = 0; + + { + _cost = [_x, true] call _getItemCost; + if(!isNil "_cost") then + { + _price = _price + _cost; + }; + } forEach(_gear select _indexWeapons); + + { + _cost = [_x, false] call _getItemCost; + if(!isNil "_cost") then + { + _price = _price + _cost; + }; + } forEach(_gear select _indexMagazines); + + if((_gear select _indexOnBack) != "") then + { + _cost = [_gear select _indexOnBack, true] call _getItemCost; + if(!isNil "_cost") then + { + _price = _price + _cost; + }; + }; + + { + _cost = [_x select 0, true] call _getItemCost; + if(!isNil "_cost") then + { + _price = _price + (_cost * (_x select 1)); + }; + } forEach(_gear select _indexRuckWeapons); + + { + _cost = [_x select 0, false] call _getItemCost; + if(!isNil "_cost") then + { + _price = _price + (_cost * (_x select 1)); + }; + } forEach(_gear select _indexRuckMags); + _price +}; + +// Takes a gear array for an argument and returns its totalweight. +_getGearWeight = +{ + private ["_gear","_get","_weight","_totalWeight"]; + + _gear = _this; + _totalWeight = 0; + + { + _weight = [_x, "CfgWeapons"] call _getItemWeight; + if(!isNil "_weight") then + { + _totalWeight = _totalWeight + _weight; + }; + } forEach(_gear select _indexWeapons); + + { + _weight = [_x, "CfgMagazines"] call _getItemWeight; + if(!isNil "_weight") then + { + _totalWeight = _totalWeight + _weight; + }; + } forEach(_gear select _indexMagazines); + + _weight = [_gear select _indexOnBack, "CfgWeapons"] call _getItemWeight; + if(!isNil "_weight") then + { + _totalWeight = _totalWeight + _weight; + }; + + { + _weight = [_x select 0, "CfgWeapons"] call _getItemWeight; + if(!isNil "_weight") then + { + _totalWeight = _totalWeight + (_weight * (_x select 1)); + }; + } forEach(_gear select _indexRuckWeapons); + + { + _weight = [_x select 0, "CfgMagazines"] call _getItemWeight; + if(!isNil "_weight") then + { + _totalWeight = _totalWeight + (_weight * (_x select 1)); + }; + } forEach(_gear select _indexRuckMags); + _totalWeight +}; + +// Fill in base blank-slot images to the UI +_fillInBlankImages = +{ + ctrlSetText [107, "\ca\ui\data\ui_gear_gun_gs.paa"]; + ctrlSetText [108, "\ca\ui\data\ui_gear_sec_gs.paa"]; + + for "_i" from 109 to 120 do + { + ctrlSetText [_i, "\ca\ui\data\ui_gear_mag_gs.paa"]; + }; + + ctrlSetText [121, "\ca\ui\data\ui_gear_hgun_gs.paa"]; + + for "_i" from 122 to 129 do + { + ctrlSetText [_i, "\ca\ui\data\ui_gear_hgunmag_gs.paa"]; + }; + + for "_i" from 130 to 131 do + { + ctrlSetText [_i, "\ca\ui\data\ui_gear_eq_gs.paa"]; + }; + + for "_i" from 134 to 145 do + { + ctrlSetText [_i, "\ca\ui\data\ui_gear_eq_gs.paa"]; + }; + + ctrlSetText [90020, "\ca\ui\data\ui_gear_gun_gs.paa"]; + ctrlSetText [90104, "\x\ace\addons\sys_wounds\data\equip\m_morphine_ca.paa"]; + ctrlSetText [90105, "\x\ace\addons\sys_wounds\data\equip\m_bandage_ca.paa"]; + ctrlSetText [90106, "\x\ace\addons\sys_wounds\data\equip\m_epi_ca.paa"]; +}; + +// Takes a gear array and renders it to the UI +// Returns an array of 2 arrays. The 2 arrays returned are of the format of +// _currentWeaponUIState and _currentMagazineUIState respectively. See top of file +// for details. +_renderGear = +{ + private ["_gear","_get","_pic","_itemIndex","_specialIndex","_mainMagIndex","_sideMagIndex","_ifakCount","_item","_isIFAK","_wob", + "_weight","_weaponUIState", "_magazineUIState","_magazineSpace"]; + _gear = _this; + + call _fillInBlankImages; + + _specialIndex = 0; + _mainMagIndex = 0; + _sideMagIndex = 0; + _itemIndex = 0; + _ifakCount = [ 0, 0, 0 ]; + _isIFAK = false; + _weaponUIState = []; + _magazineUIState = []; + + { + _get = [_x, true] call _getItemDataByConfigType; + if (!isNil "_get") then + { + _pic = _get select QUERYGEARPICTURE; + if((_get select QUERYGEARTYPE) == "Item" && _itemIndex < 12) then + { + ctrlSetText [134+_itemIndex, _pic]; + _weaponUIState = _weaponUIState + [ [134+_itemIndex, _forEachIndex] ]; + _itemIndex = _itemIndex + 1; + } + else + { + if (_x == (_gear select _indexPrimary)) then + { + ctrlSetText [107, _pic]; + _weaponUIState = _weaponUIState + [ [107, _forEachIndex] ]; + } + else + { + if(_x == (_gear select _indexSecondary)) then + { + _weaponUIState = _weaponUIState + [ [108, _forEachIndex] ]; + ctrlSetText [108, _pic]; + } + else + { + if(_x == (_gear select _indexSidearm)) then + { + _weaponUIState = _weaponUIState + [ [121, _forEachIndex] ]; + ctrlSetText [121, _pic]; + } + else + { + ctrlSetText [130+_specialIndex, _pic]; + _weaponUIState = _weaponUIState + [ [130+_specialIndex, _forEachIndex] ]; + _specialIndex = _specialIndex + 1; + }; + }; + }; + }; + }; + } forEach(_gear select _indexWeapons); + + { + _get = [_x, false] call _getItemDataByConfigType; + if (!isNil "_get") then + { + _item = _x; + _isIFAK = false; + { + if(_x == _item && + (_ifakCount select _forEachIndex) < 2) exitWith + { + _ifakCount set [_forEachIndex, (_ifakCount select _forEachIndex) + 1]; + _isIFAK = true; + }; + } forEach(_typesIFAK); + + if(!_isIFAK) then + { + _pic = _get select QUERYGEARPICTURE; + _magazineSpace = _get select QUERYGEARSPACE; + if(_magazineSpace < 1) then + { + _magazineSpace = 1; + }; + if(!(_get select QUERYGEARHANDGUNPOOL)) then + { + if((_mainMagIndex + _magazineSpace) <= 12) then + { + ctrlSetText [109+_mainMagIndex, _pic]; + _magazineUIState = _magazineUIState + [ [109+_mainMagIndex, _forEachIndex] ]; + _mainMagIndex = _mainMagIndex + 1; + + _magazineSpace = _magazineSpace - 1; + while { _magazineSpace > 0 } do + { + ctrlSetText [109+_mainMagIndex, ""]; + _magazineSpace = _magazineSpace - 1; + _mainMagIndex = _mainMagIndex + 1; + }; + }; + } + else + { + if((_sideMagIndex + _magazineSpace) <= 8) then + { + ctrlSetText [122+_sideMagIndex, _pic]; + _magazineUIState = _magazineUIState + [ [122+_sideMagIndex, _forEachIndex] ]; + _sideMagIndex = _sideMagIndex + 1; + + _magazineSpace = _magazineSpace - 1; + while { _magazineSpace > 0 } do + { + ctrlSetText [122+_sideMagIndex, ""]; + _magazineSpace = _magazineSpace - 1; + _sideMagIndex = _sideMagIndex + 1; + }; + }; + }; + }; + }; + } forEach(_gear select _indexMagazines); + + { + ctrlSetText [90107 + _forEachIndex, str _x]; + } forEach(_ifakCount); + + _wob = _gear select _indexOnBack; + + if(!isNil "_wob" && _wob != '') then + { + _get = [_wob, true] call _getItemDataByConfigType; + ctrlSetText [90020, _get select QUERYGEARPICTURE]; + }; + + _weight = _gear call _getGearWeight; + ctrlSetText [90009, format ["%1 kg", _weight]]; + + [ _weaponUIState, _magazineUIState ] +}; + +// Given a gear array, get the number of "special" items (binocs, rangefinder, etc.) in it. +// arg0: gear array +// arg1: type of item e.g. "Special" +// returns: number of that type contained in gear array. +_getItemCountByType = +{ + private [ "_gear", "_count", "_get", "_itemType", "_countThisOne" ]; + + _gear = _this select 0; + _itemType = _this select 1; + + _count = + { + _countThisOne = false; + _get = [ _x, true ] call _getItemDataByConfigType; + if (!isNil "_get" && (_get select QUERYGEARTYPE) == _itemType) then + { + _countThisOne = true; + } + else + { + _countThisOne = false; + }; + _countThisOne + } count (_gear select _indexWeapons); + _count +}; + +_renderRuckContents = +{ + private [ "_gear", "_get", "_i", "_u", "_capacity", "_volume" ]; + _gear = _this; + + lnbClear 3701; + _i = 0; + _u = 0; + _volume = 0; + { + _get = [ _x select 0, true ] call _getItemDataByConfigType; + if (!isNil "_get") then + { + lnbAddRow [3701,[str (_x select 1) + "x",(_get select QUERYGEARLABEL)]]; + lnbSetPicture [3701,[_i,0],_get select QUERYGEARPICTURE]; + lnbSetData [3701,[_i,0],"CfgWeapons"]; + lnbSetValue [3701,[_i,0],_u]; + _i = _i + 1; + _u = _u + 1; + _volume = _volume + getNumber(configFile >> "CfgWeapons" >> (_x select 0) >> "ACE_size") * (_x select 1); + }; + } forEach(_gear select _indexRuckWeapons); + + _u = 0; + { + _get = [ _x select 0, false ] call _getItemDataByConfigType; + if (!isNil "_get") then + { + lnbAddRow [3701,[str (_x select 1) + "x",(_get select QUERYGEARLABEL)]]; + lnbSetPicture [3701,[_i,0],_get select QUERYGEARPICTURE]; + lnbSetData [3701,[_i,0],"CfgMagazines"]; + lnbSetValue [3701,[_i,0],_u]; + _i = _i + 1; + _u = _u + 1; + _volume = _volume + getNumber(configFile >> "CfgMagazines" >> (_x select 0) >> "ACE_size") * (_x select 1); + }; + } forEach(_gear select _indexRuckMags); + + _capacity = getNumber(configFile >> "CfgWeapons" >> (_gear call _getGearRuck) >> "ACE_PackSize"); + ctrlSetText [90000, format [localize "STR_WF_Ruck_Space_Free", _capacity - _volume]]; +}; + +// arg0: gear array +// arg1: true if we are looking at handgun magazines +// returns number of magazines slots consumed (taking magazine size into account) +// in handgun pool or main pool (according to arg1) +_getMagazineCountByPool = +{ + private [ "_gear", "_get", "_handgunpool", "_count", "_isIFAK", "_ifakCount", "_item" ]; + + _gear = _this select 0; + _handgunpool = _this select 1; + _count = 0; + _ifakCount = [ 0, 0, 0 ]; + + { + _isIFAK = false; + _item = _x; + { + if(_x == _item && + (_ifakCount select _forEachIndex) < 2) exitWith + { + _ifakCount set [_forEachIndex, (_ifakCount select _forEachIndex) + 1]; + _isIFAK = true; + }; + } forEach(_typesIFAK); + + if (!_isIFAK) then + { + _get = [_item, false] call _getItemDataByConfigType; + if((_handgunpool && (_get select QUERYGEARHANDGUNPOOL)) || + (!_handgunpool && !(_get select QUERYGEARHANDGUNPOOL))) then + { + if((_get select QUERYGEARSPACE) == 0) then + { + _count = _count + 1; + } + else + { + _count = _count + (_get select QUERYGEARSPACE); + }; + }; + }; + } forEach(_gear select _indexMagazines); + _count +}; + +// arg0: gear array +// arg1: magazine to add +// arg2: (optional) item data on the magazine we are adding. +// Will only succeed if the magazine fits. +_addMagazineToGear = +{ + private [ "_gear", "_magazine", "_get", "_magCount", "_magLimit", "_magSize", "_oldMagazines" ]; + + _gear = _this select 0; + _magazine = _this select 1; + + if ((count _this) >= 3) then + { + _get = _this select 2; + } + else + { + _get = [_magazine, false] call _getItemDataByConfigType; + }; + + // Add magazines to a temporary copy of the gear array, and see if it's too much. + // This handles the IFAK stuff (infantry first aid kit) for us. + _oldMagazines = _gear select _indexMagazines; + _gear set [_indexMagazines, + _oldMagazines + [ _magazine ] ]; + _magCount = [ _gear, _get select QUERYGEARHANDGUNPOOL] call _getMagazineCountByPool; + _magLimit = if(_get select QUERYGEARHANDGUNPOOL) then { 8 } else { 12 }; + + // DEBUG + diag_log format ["WFBE (AceGear): magCount: %1 magLimit: %2 mag: ", _magCount, _magLimit, _magazine ]; + + if(_magCount > _magLimit) then + { + // Doesn't fit; revert back + _gear set [ _indexMagazines, _oldMagazines ]; + }; +}; + +// arg0: unit +// arg1: gear array +// equip that gear to the unit. +_applyGearToUnit = +{ + private ["_gear","_unit","_muzzles"]; + + _unit = _this select 0; + _gear = _this select 1; + + removeAllWeapons _unit; + removeAllItems _unit; + removeBackpack _unit; + {_unit addMagazine _x} foreach (_gear select _indexMagazines); + {_unit addWeapon _x} foreach (_gear select _indexWeapons); + if (primaryWeapon _unit != "") then + { + _unit selectWeapon (primaryWeapon _unit); + _muzzles = getArray(configFile>>"cfgWeapons" >> primaryWeapon _unit >> "muzzles"); + _unit selectWeapon (_muzzles select 0); + }; + + _safeArray = _gear select _indexRuckMags; + _unit setVariable ["ACE_RuckMagContents", +_safeArray]; + _safeArray = _gear select _indexRuckWeapons; + _unit setVariable ["ACE_RuckWepContents", +_safeArray]; + + if((_gear select _indexOnBack) != "") then + { + _unit setVariable ["ACE_weapononback", _gear select _indexOnBack]; + } + else + { + _unit setVariable ["ACE_weapononback", ""]; + }; +}; + +// arg: gear array +// returns: rucksack in gear or "" +_getGearRuck = +{ + private ["_gear","_maybeRuck"]; + + _gear = _this; + _maybeRuck = _gear select _indexSecondary; + if(!isNumber(configFile >> "CfgWeapons" >> _maybeRuck >> "ACE_PackSize")) then + { + _maybeRuck = _gear select _indexOnBack; + if(isClass(configFile >> "CfgWeapons" >> _maybeRuck)) then + { + if(!isNumber(configFile >> "CfgWeapons" >> _maybeRuck >> "ACE_PackSize")) then + { + _maybeRuck = ""; + }; + } + else + { + _maybeRuck = ""; + }; + }; + _maybeRuck +}; + +// arg 0: item +// arg 1: config type (CfgWeapons, etc.) +// arg 2: gear array +_addItemToRuck = +{ + private [ "_item", "_gear", "_configType", "_ruck", "_capacity", "_size", "_added", "_packable" ]; + + _item = _this select 0; + _configType = _this select 1; + _gear = _this select 2; + _packable = true; + + if(getNumber(configFile >> _configType >> _item >> "ACE_NoPack") == 1 || + getNumber(configFile >> _configType >> _item >> "ACE_disposable") == 1) then + { + _packable = false; + }; + + _ruck = _gear call _getGearRuck; + _capacity = 0; + if(_ruck != "") then + { + _capacity = getNumber(configFile >> "CfgWeapons" >> _ruck >> "ACE_PackSize"); + }; + _size = getNumber(configFile >> _configType >> _item >> "ACE_size"); + _size = _size + (_gear call _getRuckItemsVolume); + if(_packable && _size <= _capacity) then + { + if(_configType == "CfgWeapons") then + { + _added = false; + { + if((_x select 0) == _item) exitWith + { + _added = true; + _x set [1, (_x select 1) + 1]; + }; + } forEach(_gear select _indexRuckWeapons); + if(!_added) then + { + _gear set [_indexRuckWeapons, + (_gear select _indexRuckWeapons) + + [ [ _item, 1 ] ] ]; + }; + } + else + { + _added = false; + { + if((_x select 0) == _item) exitWith + { + _added = true; + _x set [1, (_x select 1) + 1]; + }; + } forEach(_gear select _indexRuckMags); + if(!_added) then + { + _gear set [_indexRuckMags, + (_gear select _indexRuckMags) + + [ [ _item, 1 ] ] ]; + }; + }; + }; +}; + +_currentUnit = 0; +{ + if(isPlayer _x) exitWith + { + _currentUnit = _forEachIndex; + }; +} forEach(units group player); + +_currentGear = [player] call _inventoryToGear; +_initialCost = _currentGear call _getGearCost; +_updateGear = true; +_updateMainList = true; +_updateSecondaryList = true; +_updateUnit = true; +_backpackSelected = false; +_selectedWeapon = ''; +_currentMagazineUIState = []; +_currentWeaponUIState = []; +_currentFilter = 0; +_updateCosts = true; + +_defaultWeap = Format ["WFBE_%1DEFAULTWEAPONS",sideJoinedText] Call GetNamespace; +_defaultAmmo = Format ["WFBE_%1DEFAULTAMMO",sideJoinedText] Call GetNamespace; + +if (paramAceWounds) then +{ + _defaultAmmo = _defaultAmmo + [ 'ACE_Morphine', 'ACE_Morphine', 'ACE_Bandage', 'ACE_Bandage' ]; + if(getNumber(configFile >> "CfgVehicles" >> (typeOf player) >> "attendant") == 1) then + { + _defaultAmmo = _defaultAmmo + [ 'ACE_Epinephrine', 'ACE_Epinephrine', 'ACE_Medkit', 'ACE_Medkit' ]; + }; +}; + +_defaultLoadoutCost = [ _defaultWeap, _defaultAmmo, "", [], [], "", "", "" ] call _getGearCost; + +WF_Logic setVariable ['InventoryClick',-1]; +WF_Logic setVariable ['lbMainAction','']; +WF_Logic setVariable ['lbChange',false]; +WF_Logic setVariable ['WF_Gear_Action',""]; + +call _fillInBlankImages; + +// And now the main UI loop. +while {alive player && dialog} do { + _lbSelChanged = WF_Logic getVariable 'lbChange'; + _mainCommand = WF_Logic getVariable 'lbMainAction'; + _inventoryClick = WF_Logic getVariable 'InventoryClick'; + _gearAction = WF_Logic getVariable 'WF_Gear_Action'; + + if (_lbSelChanged) then + { + WF_Logic setVariable ['lbChange',false]; + _weaponList = call compile format ["_%1%2", _filterNames select _currentFilter, + if(_backpackSelected) then { "Backpack" } else { "" }]; + _selectedWeapon = _weaponList select lnbValue [3700, [lnbCurSelRow 3700, 0]]; + _get = [_selectedWeapon, _filterNames select _currentFilter] call _getItemDataByFilterType; + _configType = _get select QUERYGEARCLASS; + + if(!_backpackSelected) then + { + _weight = getNumber(configFile >> _configType >> _selectedWeapon >> "ACE_weight"); + ctrlSetText [ 90005, format [ "%1 kg", _weight ]]; + _updateSecondaryList = true; + }; + }; + + if (_inventoryClick != -1) then + { + WF_Logic setVariable ['InventoryClick',-1]; + if(_inventoryClick == 90020) then + { + _currentGear set [_indexOnBack, ""]; + _updateGear = true; + } + else + { + { + if(_inventoryClick == (_x select 0)) exitWith + { + _weapon = (_currentGear select _indexWeapons) select (_x select 1); + + if (_weapon == (_currentGear select _indexPrimary)) then + { + _currentGear set [_indexPrimary, ""]; + }; + if (_weapon == (_currentGear select _indexSecondary)) then + { + _currentGear set [_indexSecondary, ""]; + }; + if (_weapon == (_currentGear select _indexSidearm)) then + { + _currentGear set [_indexSidearm, ""]; + }; + if (_weapon == (_currentGear select _indexOnBack)) then + { + _currentGear set [_indexOnBack, ""]; + }; + + (_currentGear select _indexWeapons) set [_x select 1, 0]; + _currentGear set [_indexWeapons, + (_currentGear select _indexWeapons) - [ 0 ]]; + }; + } forEach(_currentWeaponUIState); + }; + + { + if(_inventoryClick == (_x select 0)) exitWith + { + (_currentGear select _indexMagazines) set [_x select 1, 0]; + _currentGear set [_indexMagazines, + (_currentGear select _indexMagazines) - [ 0 ]]; + }; + } forEach(_currentMagazineUIState); + + // If ruck was removed, remove contents too. + if ((_currentGear call _getGearRuck) == "") then + { + _currentGear set [_indexRuckWeapons, []]; + _currentGear set [_indexRuckMags, []]; + if(_backpackSelected) then + { + _backpackSelected = false; + _updateSecondaryList = true; + }; + }; + _updateGear = true; + }; + + if (_mainCommand != '') then + { + WF_Logic setVariable ['lbMainAction','']; + _weaponList = call compile format ["_%1%2", _filterNames select _currentFilter, + if(_backpackSelected) then { "Backpack" } else { "" }]; + if (_selectedWeapon != '') then + { + _magazineList = _selectedWeapon call _getCompatibleMagazines; + } + else + { + _magazineList = []; + }; + + switch (_mainCommand) do + { + case 'unitPlus': { + _currentUnit = _currentUnit + 1; + if(_currentUnit >= (count units group player)) then + { + _currentUnit = 0; + }; + _updateUnit = true; + }; + + case 'unitMinus': { + _currentUnit = _currentUnit - 1; + if(_currentUnit < 0) then + { + _currentUnit = (count units group player) - 1; + }; + _updateUnit = true; + }; + + case 'filterPlus': { + _currentFilter = _currentFilter + 1; + if(_currentFilter >= 5) then + { + _currentFilter = 0; + }; + ctrlSetText [148, format ["\ca\ui\data\igui_gear_filter_%1_ca.paa", + _currentFilter+1]]; + _updateMainList = true; + }; + + case 'filterMinus': { + _currentFilter = _currentFilter - 1; + if(_currentFilter < 0) then + { + _currentFilter = 4; + }; + ctrlSetText [148, format ["\ca\ui\data\igui_gear_filter_%1_ca.paa", + _currentFilter+1]]; + _updateMainList = true; + }; + + case 'buy': { + _funds = call GetPlayerFunds; + _cost = (_currentGear call _getGearCost) - _initialCost; + if(_funds >= _cost) then + { + (-_cost) Call ChangePlayerFunds; + _unit = (units group player) select _currentUnit; + if(isNil "_unit" || !alive _unit) then + { + _currentUnit = 0; + _updateUnit = true; + } + else + { + [ _unit, _currentGear] call _applyGearToUnit; + if (isPlayer _unit) then + { + respawnGearCost = _respawnCost; + respawnWeapons = _currentGear select _indexWeapons; + respawnAmmo = _currentGear select _indexMagazines; + respawnWeaponOnBack = _currentGear select _indexOnBack; + respawnAceRuckContents = [ _currentGear select _indexRuckWeapons, + _currentGear select _indexRuckMags ]; + }; + _initialCost = (_currentGear call _getGearCost); + _updateGear = true; + }; + } + else + { + hint parseText(Format [localize "STR_WF_Funds_Missing_Gear",_cost - _funds]); + }; + }; + + case 'addMagazine': { + if(!_backpackSelected) then + { + _mag = _magazineList select lnbValue [3701, [lnbCurSelRow 3701, 0]]; + [ _currentGear, _mag ] call _addMagazineToGear; + _updateGear = true; + } + else + { + // A double click in ruck mode actually means remove from inventory. + _ruckIndex = lnbValue [3701, [lnbCurSelRow 3701, 0]]; + _ruckItemClass = lnbData [3701, [lnbCurSelRow 3701, 0]]; + + if(_ruckItemClass == "CfgWeapons") then + { + _ruckItem = (_currentGear select _indexRuckWeapons) select _ruckIndex; + if((_ruckItem select 1) > 1) then + { + _ruckItem set [1, (_ruckItem select 1) - 1]; + } + else + { + (_currentGear select _indexRuckWeapons) set [_ruckIndex, 0]; + _currentGear set [_indexRuckWeapons, + (_currentGear select _indexRuckWeapons) - [ 0 ]]; + }; + } + else + { + _ruckItem = (_currentGear select _indexRuckMags) select _ruckIndex; + if((_ruckItem select 1) > 1) then + { + _ruckItem set [1, (_ruckItem select 1) - 1]; + } + else + { + (_currentGear select _indexRuckMags) set [_ruckIndex, 0]; + _currentGear set [_indexRuckMags, + (_currentGear select _indexRuckMags) - [ 0 ]]; + }; + }; + _updateSecondaryList = true; + _updateCosts = true; + }; + }; + + case 'addMainItem': { + _weapon = _weaponList select lnbValue [3700, [lnbCurSelRow 3700, 0]]; + _get = [_weapon, _filterNames select _currentFilter] call _getItemDataByFilterType; + + if ((_get select QUERYGEARCLASS) == "CfgMagazines") then + { + if(_backpackSelected) then + { + [_weapon, "CfgMagazines", _currentGear] call _addItemToRuck; + _updateSecondaryList = true; + _updateCosts = true; + } + else + { + [_currentGear, _weapon, _get] call _addMagazineToGear; + _updateGear = true; + }; + } + else + { + if(_backpackSelected) then + { + [_weapon, "CfgWeapons", _currentGear] call _addItemToRuck; + _updateSecondaryList = true; + _updateCosts = true; + } + else + { + _add = false; + if (_weapon in _primary) then + { + if ((_currentGear select _indexPrimary) != '') then + { + _currentGear set [ _indexWeapons, + (_currentGear select _indexWeapons) - [ _currentGear select _indexPrimary ] ]; + }; + _currentGear set [_indexPrimary, _weapon]; + _add = true; + } + else + { + if (_weapon in _secondary) then + { + if ((_currentGear select _indexSecondary) != '') then + { + _currentGear set [ _indexWeapons, + (_currentGear select _indexWeapons) - [ _currentGear select _indexSecondary ] ]; + }; + _currentGear set [_indexSecondary, _weapon]; + _add = true; + } + else + { + if (_weapon in _sidearm) then + { + if ((_currentGear select _indexSidearm) != '') then + { + _currentGear set [ _indexWeapons, + (_currentGear select _indexWeapons) - [ _currentGear select _indexSidearm ] ]; + }; + _currentGear set [_indexSidearm, _weapon]; + _add = true; + } + else + { + if ((_get select QUERYGEARTYPE) == "Special") then + { + _itemCount = [_currentGear, "Special"] call _getItemCountByType; + if(_itemCount < 2) then + { + _add = true; + }; + }; + + if((_get select QUERYGEARTYPE) == "Item") then + { + _itemCount = [_currentGear, "Item"] call _getItemCountByType; + if(_itemCount < 12) then + { + _add = true; + }; + }; + }; + }; + }; + + if(_add) then + { + _currentGear set [ _indexWeapons, + (_currentGear select _indexWeapons) + [ _weapon ]]; + _updateGear = true; + }; + }; + }; + }; + }; + }; + + if(_gearAction != "") then + { + WF_Logic setVariable ["WF_Gear_Action",""]; + switch(_gearAction) do + { + case 'backpack': { + if(_backpackSelected) then + { + _backpackSelected = false; + _updateSecondaryList = true; + _updateMainList = true; + } + else + { + if((_currentGear call _getGearRuck) != "") then + { + _backpackSelected = true; + _updateSecondaryList = true; + _updateMainList = true; + }; + }; + }; + + case 'reload': { + if(!isNil "respawnWeapons") then + { + _currentGear set [_indexWeapons, respawnWeapons]; + _currentGear set [_indexMagazines, respawnAmmo]; + _currentGear set [_indexOnBack, respawnWeaponOnBack]; + _currentGear set [_indexRuckWeapons, respawnAceRuckContents select 0]; + _currentGear set [_indexRuckMags, respawnAceRuckContents select 1]; + } + else + { + _currentGear set [_indexWeapons, Format ["WFBE_%1DEFAULTWEAPONS",sideJoinedText] Call GetNamespace]; + _currentGear set [_indexMagazines, Format ["WFBE_%1DEFAULTAMMO",sideJoinedText] Call GetNamespace]; + _currentGear set [_indexOnBack, ""]; + _currentGear set [_indexRuckWeapons, []]; + _currentGear set [_indexRuckMags, []]; + }; + + { + if(_x in _primary) then + { + _currentGear set [_indexPrimary, _x]; + }; + + if(_x in _secondary) then + { + _currentGear set [_indexSecondary, _x]; + }; + + if(_x in _sidearm) then + { + _currentGear set [_indexSidearm, _x]; + }; + } forEach(_currentGear select _indexWeapons); + + _updateGear = true; + }; + + case 'clear': { + _currentGear = [ [], [], "", [], [], "", "", "" ]; + _updateGear = true; + }; + + case 'primary_onback': { + if ((_currentGear select _indexPrimary) != '') then + { + _weapon = _currentGear select _indexPrimary; + _currentGear set [ _indexWeapons, + (_currentGear select _indexWeapons) - [ _currentGear select _indexPrimary ] ]; + _currentGear set [_indexPrimary, ""]; + _currentGear set [_indexOnBack, _weapon]; + _updateGear = true; + }; + }; + + case 'secondary_onback': { + if ((_currentGear select _indexSecondary) != '') then + { + _weapon = _currentGear select _indexSecondary; + _currentGear set [ _indexWeapons, + (_currentGear select _indexWeapons) - [ _currentGear select _indexSecondary ] ]; + _currentGear set [_indexSecondary, ""]; + _currentGear set [_indexOnBack, _weapon]; + _updateGear = true; + }; + }; + }; + }; + + if (_updateUnit) then + { + _unit = (units group player) select _currentUnit; + _backpackSelected = false; + _currentGear = [_unit] call _inventoryToGear; + _updateGear = true; + _updateMainList = true; + _updateSecondaryList = true; + ctrlSetText [101, format ["[%1] " + name _unit, _currentUnit]]; + _initialCost = _currentGear call _getGearCost; + _updateUnit = false; + }; + + if (_updateGear) then + { + _temp = _currentGear call _renderGear; + _currentWeaponUIState = _temp select 0; + _currentMagazineUIState = _temp select 1; + _updateGear = false; + _updateCosts = true; + }; + + if(_updateCosts) then + { + _updateCosts = false; + _cost = _currentGear call _getGearCost; + ctrlSetText [152, (localize "STR_WF_GEAR_CostLabel") + " " + (format [localize "STR_WF_GEAR_Cost", _cost - _initialCost])]; + ctrlSetText [150, (localize "STR_WF_GEAR_CashLabel") + " " + (format [localize "STR_WF_GEAR_Cost", call GetPlayerFunds])]; + + _respawnCost = _cost - _defaultLoadoutCost; + if(_respawnCost < 0) then + { + _respawnCost = 0; + }; + + _respawnPenalty = 'WFBE_RESPAWNPENALTY' Call GetNamespace; + + if (isPlayer (units group player select _currentUnit) && _respawnPenalty in [2,3,4,5]) then + { + _divisor = 1; + switch (_respawnPenalty) do + { + case 3: {_divisor = 2}; + case 4: {_divisor = 4}; + }; + ctrlSetText [151, format [localize "STR_WF_Respawn_Cost", round (_respawnCost / _divisor) ]]; + } + else + { + ctrlSetText [151, ""]; + }; + }; + + if(_updateMainList) then + { + lnbClear 3700; + _weaponList = call compile format ["_%1%2", _filterNames select _currentFilter, + if(_backpackSelected) then { "Backpack" } else { "" }]; + [_weaponList, _filterNames select _currentFilter, 3700] call UIGearFillList; + _updateMainList = false; + _selectedWeapon = ""; + _updateSecondaryList = true; + }; + + if(_updateSecondaryList) then + { + lnbClear 3701; + if (_backpackSelected) then + { + _currentGear call _renderRuckContents; + ctrlSetText [90009, format ["%1 kg", _currentGear call _getGearWeight]]; + } + else + { + ctrlSetText [90000,localize "STR_WF_Magazines"]; + ctrlSetText [90005, ""]; + ctrlSetText [90007, ""]; + if (_selectedWeapon != '') then + { + _magazineList = _selectedWeapon call _getCompatibleMagazines; + [_magazineList, "magazine", 3701] call UIGearFillList; + }; + }; + _updateSecondaryList = false; + }; + sleep 0.05; +}; + +WF_Logic setVariable ['InventoryClick',nil]; +WF_Logic setVariable ['lbMainAction',nil]; +WF_Logic setVariable ['lbChange',nil]; \ No newline at end of file diff --git a/Client/GUI/GUI_GearBeta.sqf b/Client/GUI/GUI_GearBeta.sqf new file mode 100644 index 0000000..c0d8c64 --- /dev/null +++ b/Client/GUI/GUI_GearBeta.sqf @@ -0,0 +1,1057 @@ +/* Important, use +array if you plan to use Setters */ + + +private ["_backpack","_get","_u","_unitBP","_inRange","_sideID","_nObjects","_nObject","_unitList", +"_text","_amount","_val","_val2","_ainumber","_txt","_type","_check","_updateFiller","_manageBackpack", +"_list","_id","_changed","_currentMags","_currentRow","_currentData","_currentValue","_currentItem", +"_skip","_backpackloadout","_bpcost","_get2","_oldMags","_currentMagazines","_slist","_index", +"_currentWeapons","_displayInv","_arrayType","_arrayAmount","_currentBPRow","_currentBPValue", +"_currentBPItem","_hasSpace","_updateBackpack","_zt","_currentSpecialCost","_currentSpecials", +"_currentItems","_currentUpgrades","_getnum","_currentPrimary","_currentPrimaryCost","_currentSecondary", +"_currentSecondaryCost","_currentSidearm","_currentSidearmCost","_cwep","_x","_tempWeapons", +"_tempItems","_tempMags","_tempSpecs","_currentBackpackLoadout","_currentBackpackLoadoutAmount", +"_tfil","_currentMagValue","_currentMag","_currentBPItemValue","_itemAmount","_currentUnit","_updateUnit", +"_currentCost","_sideGear","_found","_show","_data","_inventorySlots","_sidearmInventorySlots", +"_miscItemSlots","_cost","_slot","_upgradeCost","_currentBackpackLoadoutCost","_currentBackpackLoadoutPictures", +"_currentBackpackLoadoutNames","_currentBackpackLoadoutUpgrades","_currentBackpackLoadoutAllowed", +"_temp","_weaps","_add","_funds","_template","_templateCosts","_templatePictures","_templateNames", +"_templateMags","_templateItems","_templateSpecs","_templateUpgrades","_templateAllowed","_cAllow", +"_desc","_pict","_upgr","_addin","_filler","_mainAction","_inventoryClick","_unitSwap","_actionSE", +"_lastFiller","_primary","_secondary","_sidearm","_misc","_magazine","_returnProperBag","_listbp", +"_all","_lb","_lbm","_primaryIDC","_secondaryIDC","_sidearmIDC","_specialIDC","_display","_totalWeapons", +"_fillerIDC","_fillerTypes","_old","_disp","_buildings","_getpp","_isPrimAllowTwo","_getss","_isSecoAllowTwo", +"_sskip","_query","_pallow","_sallow","_secondarySlotIDC"]; + +_primary = +(WF_Logic getVariable 'primaryClasses'); +_secondary = +(WF_Logic getVariable 'secondaryClasses'); +_sidearm = +(WF_Logic getVariable 'sidearmClasses'); +_misc = +(WF_Logic getVariable 'miscClasses'); +_magazine = +(WF_Logic getVariable 'magazineClasses'); + +_template = +(WF_Logic getVariable 'templateClasses'); +_templateCosts = +(WF_Logic getVariable 'templateCosts'); +_templatePictures = +(WF_Logic getVariable 'templatePictures'); +_templateNames = +(WF_Logic getVariable 'templateNames'); +_templateMags = +(WF_Logic getVariable 'templateMags'); +_templateItems = +(WF_Logic getVariable 'templateItems'); +_templateSpecs = +(WF_Logic getVariable 'templateSpecs'); +_templateUpgrades = +(WF_Logic getVariable 'templateUpgrades'); +_templateAllowed = +(WF_Logic getVariable 'templateAllowed'); + +_currentUnit = player; +_secondarySlotIDC = 3501; + +_returnProperBag = { + Private ['_bag']; + _bag = _this select 0; + + if (_bag in ['US_Assault_Pack_Ammo_EP1','US_Assault_Pack_AmmoSAW_EP1','US_Assault_Pack_AT_EP1','US_Assault_Pack_Explosives_EP1']) then {_bag = 'US_Assault_Pack_EP1'}; + if (_bag in ['US_Patrol_Pack_Ammo_EP1','US_Patrol_Pack_Specops_EP1']) then {_bag = 'US_Patrol_Pack_EP1'}; + if (_bag in ['US_Backpack_AmmoMG_EP1','US_Backpack_AT_EP1','US_Backpack_Specops_EP1']) then {_bag = 'US_Backpack_EP1'}; + if (_bag in ['TK_ALICE_Pack_Explosives_EP1','TK_ALICE_Pack_AmmoMG_EP1','TKA_ALICE_Pack_Ammo_EP1','TKG_ALICE_Pack_AmmoAK47_EP1','TKG_ALICE_Pack_AmmoAK74_EP1']) then {_bag = 'TK_ALICE_Pack_EP1'}; + if (_bag in ['TK_Assault_Pack_RPK_EP1','TKA_Assault_Pack_Ammo_EP1']) then {_bag = 'TK_Assault_Pack_EP1'}; + if (paramDLCBAF) then {if (_bag in ['BAF_AssaultPack_ARAmmo','BAF_AssaultPack_MGAmmo','BAF_AssaultPack_ATAmmo','BAF_AssaultPack_HATAmmo','BAF_AssaultPack_Special','BAF_AssaultPack_FAC','BAF_AssaultPack_HAAAmmo','BAF_AssaultPack_LRRAmmo']) then {_bag = 'BAF_AssaultPack_RifleAmmo'}}; + + _bag +}; + +/* Backpack management - Init */ +_backpackloadout = []; +_backpack = []; + +_currentBackpackLoadout = []; +_currentBackpackLoadoutAmount = []; +_currentBackpackLoadoutCost = []; +_currentBackpackLoadoutPictures = []; +_currentBackpackLoadoutNames = []; +_currentBackpackLoadoutUpgrades = []; +_currentBackpackLoadoutAllowed = []; +_unitBP = ""; +_bpcost = 0; +_listbp = 'WFBE_BACKPACKS' Call GetNamespace; +if !(WF_A2_Vanilla) then { + _u = 0; + _backpack = _magazine; + { + _get = '_x' Call GetNamespace; + if ((_get select QUERYGEARTYPE) == 'CfgMagazines') then { + _backpack = _backpack + [_x]; + }; + _u = _u + 1; + } forEach _misc; + + if !(isNull (unitBackpack _currentUnit)) then { + _unitBP = typeOf (unitBackpack _currentUnit); + _unitBP = [_unitBP] Call _returnProperBag; + }; +}; + +_all = _primary + _secondary + _sidearm + _misc; + +WF_Logic setVariable ['lbChange',false]; +WF_Logic setVariable ['lbMainAction','']; +WF_Logic setVariable ['InventoryClick',-1]; +WF_Logic setVariable ['WF_GEAR_Swap',false]; +WF_Logic setVariable ['WF_Gear_Action','']; + +primClicked = false; +secoClicked = false; +sideClicked = false; +deleteLoadout = false; +saveLoadout = false; +buyLoadout = false; +_displayInv = false; +_updateUnit = true; +_updateFiller = false; +_manageBackpack = false; +_updateBackpack = false; + +disableSerialization; +_lb = 3700; +_lbm = 3701; +_primaryIDC = 3500; +_secondaryIDC = 3501; +_sidearmIDC = 3502; +_specialIDC = 3535; +_display = _this select 0; + +_totalWeapons = count _primary + count _secondary + count _sidearm; + +_fillerIDC = [3400,3401,3402,3403,3404,3405]; +_fillerTypes = ['template','all','primary','secondary','sidearm','misc']; +_inventorySlots = []; +_lastFiller = 'nil'; +_id = _fillerTypes find 'primary'; +_list = []; +_miscItemSlots = []; +_sidearmInventorySlots = []; +(_display DisplayCtrl (_fillerIDC select _id)) ctrlSetTextColor [1, 1, 1, 1]; + +_currentItem = ''; +_currentMags = []; +_currentData = ''; +_currentValue = ''; +_currentCost = 0; +_cost = 0; + +_currentPrimary = ''; +_currentSecondary = ''; +_currentSidearm = ''; +_currentPrimaryCost = 0; +_currentSecondaryCost = 0; +_currentSidearmCost = 0; +_currentSpecialCost = 0; + +_old = ''; + +_currentWeapons = []; +_currentSpecials = []; +_currentItems = []; +_currentMagazines = []; + +_disp = (findDisplay 16000) displayAddEventHandler ['KeyDown','_this Call WF_Gear_Hotkeys']; +_buygearfrom = missionNamespace getVariable "WFBE_TOWNGEAR"; + +//--- Fill the available units list. +_unitList = []; +_buildings = (sideJoinedText) Call GetSideStructures; +_i = 0; +{ + _check = ['BARRACKSTYPE',_buildings,'WFBE_PURCHASEGEARRANGE' Call GetNamespace,sideJoined,_x] Call BuildingInRange; + _inRange = if (isNull _check) then {false} else {true}; + + if (!_inRange && _buygearfrom in [1,2,3]) then { + _lookfor = switch (_buygearfrom) do { case 1:{WFCAMP}; case 2:{WFDEPOT}; case 3:{WFCAMP + WFDEPOT}; default{[]}}; + _nObjects = nearestObjects [_x, _lookfor, 25]; + _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull}; + if !(isNull _nObject) then { + _sideID = _nObject getVariable "sideID"; + if !(isNil "_sideID") then { + if (_sideID == sideID) then {_inRange = true}; + }; + }; + }; + + if (_inRange) then { + _txt = (_x) Call GetAIDigit; + _unitList = _unitList + [_x]; + + _type = [typeOf _x, 'displayName'] Call GetConfigInfo; + lbAdd [3854,Format["[%1] %2 (%3)",_txt,name _x,_type]]; + + if (_currentUnit == _x) then {lbSetCurSel[3854,_i]}; + _i = _i + 1; + }; +} forEach units(group player); + +while {alive player && dialog} do { + if (Side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; + + //--- Something changed since the last time? + _filler = WF_Logic getVariable 'filler'; + _changed = WF_Logic getVariable 'lbChange'; + _mainAction = WF_Logic getVariable 'lbMainAction'; + _inventoryClick = WF_Logic getVariable 'InventoryClick'; + _unitSwap = WF_Logic getVariable 'WF_GEAR_Swap'; + _actionSE = WF_Logic getVariable 'WF_Gear_Action'; + + //--- Filter Changed. + if (_filler != _lastFiller || _updateFiller) then { + _updateFiller = false; + _manageBackpack = false; + _list = Call Compile Format ['_%1',_filler]; + lnbClear _lb; + if (_filler != 'template') then { + [_list,_filler,_lb] Call UIGearFillList; + } else { + [_templateCosts,_templateNames,_templatePictures,_templateUpgrades,_templateAllowed,_filler,_lb] Call UIGearFillTemplateList; + }; + _id = _fillerTypes find _filler; + {(_display displayCtrl _x) ctrlSetTextColor [0.7490, 0.7490, 0.7490, 0.7]} forEach _fillerIDC; + (_display displayCtrl (_fillerIDC select _id)) ctrlSetTextColor [1, 1, 1, 1]; + //--- Update the list since the filler changed. + _changed = true; + }; + + //--- List Selection Changed. + if (_changed) then { + if !(_manageBackpack) then { + WF_Logic setVariable ['lbChange',false]; + _currentRow = lnbCurSelRow _lb; + _currentData = lnbData[_lb,[_currentRow,0]]; + _currentValue = lnbValue[_lb,[_currentRow,0]]; + _currentItem = _list select _currentValue; + lnbClear _lbm; + _get = []; + + /* Get */ + if (_filler != 'template') then { + if (_filler == 'secondary' || _filler == 'all') then { + _get = (_currentItem+'_W') Call GetNamespace; + if (isNil '_get') then { + _get = _currentItem Call GetNamespace; + }; + } else { + _get = _currentItem Call GetNamespace; + }; + + if !(isNil '_get') then { + _currentMags = _get select QUERYGEARMAGAZINES; + if (typeName _currentMags != 'SCALAR') then { + if (count _currentMags > 0) then { + [_currentMags,'magazine',_lbm] Call UIGearFillList; + }; + }; + }; + }; + }; + WF_Logic setVariable ['lbChange',false]; + }; + + //--- Player have clicked on one of the listbox. + if (_mainAction != '') then { + switch (_mainAction) do { + case 'addWeapon': { + _skip = true; + _sskip = false; + _get = []; + + if (_filler != 'template') then { + _get = (_currentItem+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _currentItem Call GetNamespace; + }; + }; + + + _tfil = if (_manageBackpack) then {'backpack'} else {_filler}; + if (_tfil == 'primary' || _tfil == 'secondary' || _tfil == 'sidearm' || _tfil == 'all') then { + if (_currentItem in _misc) then {_skip = false;_currentValue = _currentValue - _totalWeapons}; + if (_skip) then { + _slist = Call Compile Format ['_%1',_currentData]; + _index = _slist find _currentItem; + if (_index != -1) then { + if (_filler == 'all') then { + if (_currentItem in _primary) then {_currentData = 'primary'} else { + if (_currentItem in _secondary) then {_currentData = 'secondary'} else { + if (_currentItem in _sidearm) then {_currentData = 'sidearm'}; + }; + }; + }; + + /* Handle the extended inventory system if disabled */ + _isSecoAllowTwo = true; + _isPrimAllowTwo = true; + if (paramExtendedInventory && (_tfil == 'primary' || _tfil == 'secondary' || _tfil == 'all')) then { + _getpp = []; + _getss = []; + + _query = if (_currentData == 'primary') then {_currentItem} else {_currentPrimary}; + if (_query != '') then { + _getpp = (_query+"_W") Call GetNamespace; + if (isNil '_getpp') then { + _getpp = _query Call GetNamespace; + }; + }; + if (_query != '') then {_isPrimAllowTwo = _getpp select QUERYGEARALLOWTWO}; + + _query = if (_currentData == 'secondary') then {_currentItem} else {_currentSecondary}; + if (_query != '') then { + _getss = (_query+"_W") Call GetNamespace; + if (isNil '_getss') then { + _getss = _query Call GetNamespace; + }; + }; + if (_query != '') then {_isSecoAllowTwo = _getss select QUERYGEARALLOWTWO}; + + if (!_isSecoAllowTwo && !_isPrimAllowTwo) then { + _sskip = true; + hint parseText (localize 'STR_WF_INFO_Gear_AllowTwo'); + }; + }; + + if !(_sskip) then { + if (_currentData == 'secondary') then { + if (_currentItem in _listbp) then { + _unitBP = _currentItem; + }; + _backpackloadout = [[],[]]; + _bpcost = 0; + }; + Call Compile Format ['_old = _current%1;_currentWeapons = _currentWeapons - [_current%1]; _current%1Cost = %2; _current%1 = "%3";ctrlSetText[_%1IDC,"%4"]',_currentData,_get select QUERYGEARCOST,_currentItem,_get select QUERYGEARPICTURE]; + //--- New Magazines. + _currentMags = _get select QUERYGEARMAGAZINES; + //--- Old Magazines. + _get2 = (_old+"_W") Call GetNamespace; + if (isNil '_get2') then { + _get2 = _old Call GetNamespace; + }; + if !(isNil '_get2') then { + if (typeName (_get2 select QUERYGEARMAGAZINES) != 'SCALAR' && typeName (_get select QUERYGEARMAGAZINES) != 'SCALAR') then { + _oldMags = _get2 select QUERYGEARMAGAZINES; + _currentMagazines = [_currentMags select 0,_oldMags,_currentMagazines] Call ReplaceInventoryAmmo; + }; + if !(isNil '_get2') then { + if (typeName (_get2 select QUERYGEARMAGAZINES) != 'SCALAR' && typeName (_get select QUERYGEARMAGAZINES) != 'SCALAR') then { + _oldMags = _get2 select QUERYGEARMAGAZINES; + _use = ""; + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + { + _upgr = (missionNamespace getVariable _x) select QUERYGEARUPGRADE; + if ((_currentUpgrades select 13) >= _upgr) exitWith {_use = _x}; + } forEach _currentMags; + _currentMagazines = [_use,_oldMags,_currentMagazines] Call ReplaceInventoryAmmo; + }; + }; + }; + }; + }; + if (!_sskip) then { + _currentWeapons = _currentWeapons + [_currentItem]; + _displayInv = true; + }; + }; + }; + if (_tfil == 'backpack') then { + _currentBPRow = lnbCurSelRow _lb; + _currentBPValue = lnbValue[_lb,[_currentBPRow,0]]; + _currentBPItem = _backpack select _currentBPValue; + + _hasSpace = [_unitBP,_backpackloadout,_currentBPItem] Call BackpackHasSpace; + + if (_hasSpace) then { + _id = (_backpackloadout select 0) find _currentBPItem; + if (_id == -1) then { + _arrayType = (_backpackloadout select 0) + [_currentBPItem]; + _arrayAmount = (_backpackloadout select 1) + [1]; + _backpackloadout set[0, _arrayType]; + _backpackloadout set[1, _arrayAmount]; + } else { + _arrayAmount = (_backpackloadout select 1) set [_id,((_backpackloadout select 1) select _id)+1]; + }; + }; + + _updateBackpack = true; + }; + if (_filler == 'misc' || !_skip) then { + _type = _get select QUERYGEARTYPE; + if (_type == 'CfgMagazines') then { + _currentMagazines = [_currentMagazines,_currentItem] Call UIAddMagazine; + _displayInv = true; + }; + if (_type == 'Special' && count _currentSpecials < 3 && !(_currentItem in _currentSpecials)) then { + _currentSpecials = _currentSpecials + [_currentItem]; + _currentSpecialCost = 0; + _u = 0; + { + _zt = _x Call GetNamespace; + ctrlSetText[_specialIDC + _u,_zt select QUERYGEARPICTURE]; + _currentSpecialCost = _currentSpecialCost + (_zt select QUERYGEARCOST); + _u = _u + 1; + } forEach _currentSpecials; + _displayInv = true; + }; + if (_type == 'Item') then { + if (!(_currentItem in _currentItems)) then { + _currentItems = [_currentItems,_currentItem] Call UIAddItem; + _displayInv = true; + }; + }; + }; + if (_tfil == 'template') then { + _tempWeapons = _template select _currentValue; + _tempItems = _templateItems select _currentValue; + _tempMags = _templateMags select _currentValue; + _tempSpecs = _templateSpecs select _currentValue; + _currentPrimary = ''; + _currentSecondary = ''; + _currentSidearm = ''; + _currentPrimaryCost = 0; + _currentSecondaryCost = 0; + _currentSidearmCost = 0; + _getnum = 0; + _currentWeapons = []; + _currentItems = []; + _backpackloadout = [[],[]]; + { + if (typeName _x == 'STRING') then {_currentItems = _currentItems + [_x]}; + if (typeName _x == 'ARRAY') then {_backpackloadout = _x}; + } forEach _tempItems; + _bpcost = 0; + + if (count (_backpackloadout select 0) > 0) then { + _getnum = getNumber(configFile >> 'CfgVehicles' >> typeOf _currentUnit >> 'canCarryBackPack'); + if (_getnum == 1) then { + _u = 0; + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + { + _get = _x Call GetNamespace; + if !(isNil '_get') then { + if ((_currentUpgrades select 13) >= (_get select QUERYGEARUPGRADE)) then { + _bpcost = _bpcost + ((_get select QUERYGEARCOST)*((_backpackloadout select 1) select _u)); + }; + }; + _u = _u + 1; + } forEach (_backpackloadout select 0); + }; + }; + _currentBackpackLoadout = (_backpackloadout select 0); + _currentBackpackLoadoutAmount = (_backpackloadout select 1); + { + _cwep = _x; + _get = (_x+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _x Call GetNamespace; + }; + + if (({_x == _cwep} count _primary) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE]} else { + if (({_x == _cwep} count _secondary) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE]} else { + if (({_x == _cwep} count _sidearm) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE]}; + }; + }; + } forEach _tempWeapons; + if (_currentPrimary == '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']}; + if (_currentSecondary == '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']}; + if (_currentSidearm == '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']}; + if (_currentSecondary in _listbp && _getnum == 1) then {_unitBP = _currentSecondary} else {_unitBP = ""}; + _currentMagazines = _tempMags; + _currentSpecials = _tempSpecs; + _currentSpecialCost = 0; + for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']}; + _u = 0; + { + _get = _x Call GetNamespace; + _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST); + ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE]; + _u = _u + 1; + } forEach _currentSpecials; + _displayInv = true; + }; + }; + + case 'addMagazine': { + if !(_manageBackpack) then { + _currentMagValue = lnbValue[_lbm,[lnbCurSelRow _lbm,0]]; + _currentMag = _currentMags select _currentMagValue; + _currentMagazines = [_currentMagazines,_currentMag] Call UIAddMagazine; + _displayInv = true; + } else { + _currentBPItemValue = lnbValue[_lbm,[lnbCurSelRow _lbm,0]]; + //--- todo find + _arrayType = _backpackloadout select 0; + _arrayAmount = _backpackloadout select 1; + _itemAmount = _arrayAmount select _currentBPItemValue; + if ((_itemAmount -1) <= 0) then { + _arrayType set [_currentBPItemValue, 'nil']; + _arrayAmount set [_currentBPItemValue, 'nil']; + _arrayType = _arrayType - ['nil']; + _arrayAmount = _arrayAmount - ['nil']; + } else { + _arrayAmount set [_currentBPItemValue, (_arrayAmount select _currentBPItemValue)-1]; + }; + _backpackloadout set [0, _arrayType]; + _backpackloadout set [1, _arrayAmount]; + _updateBackpack = true; + }; + }; + }; + WF_Logic setVariable ['lbMainAction','']; + }; + + //--- Remove a weapon by clicking on it. + if (primClicked) then {primClicked = false;if (_currentPrimary != '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa'];_index = _primary find _currentPrimary;_currentPrimaryCost = 0;_currentWeapons = _currentWeapons - [_currentPrimary];_currentPrimary = '';_displayInv = true}}; + if (secoClicked) then {secoClicked = false;if (_currentSecondary != '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa'];_index = _secondary find _currentSecondary;_currentSecondaryCost = 0;_currentWeapons = _currentWeapons - [_currentSecondary];_currentSecondary = '';_displayInv = true;_backpackloadout = [[],[]];_bpcost = 0;_unitBP = ""}}; + if (sideClicked) then {sideClicked = false;if (_currentSidearm != '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa'];_index = _sidearm find _currentSidearm;_currentSidearmCost = 0;_currentWeapons = _currentWeapons - [_currentSidearm];_currentSidearm = '';_displayInv = true}}; + + if (_unitSwap) then { + WF_Logic setVariable ['WF_GEAR_Swap',false]; + if (count _unitList > 0) then {_currentUnit = _unitList select (lbCurSel 3854)} else {_currentUnit = player}; + _updateUnit = true; + }; + + if (_updateUnit) then { + _currentWeapons = weapons _currentUnit; + _currentCost = 0; + _unitBP = ""; + if !(isNull(unitBackpack _currentUnit)) then { + _unitBP = typeOf(unitBackpack _currentUnit); + _unitBP = [_unitBP] Call _returnProperBag; + _currentWeapons = _currentWeapons + [_unitBP]; + + //--- Retrieve the backpack content cost. + _backpackloadout = getMagazineCargo (unitBackPack _currentUnit); + _currentCost = _currentCost - _bpcost; + _bpcost = 0; + if (count (_backpackloadout select 0) > 0) then { + _u = 0; + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + { + _get = _x Call GetNamespace; + if !(isNil '_get') then { + if ((_currentUpgrades select 13) >= (_get select QUERYGEARUPGRADE)) then { + _bpcost = _bpcost + ((_get select QUERYGEARCOST)*((_backpackloadout select 1) select _u)); + }; + }; + _u = _u + 1; + } forEach (_backpackloadout select 0); + }; + _currentCost = _currentCost + _bpcost; + }; + + _get = getNumber(configFile >> 'CfgVehicles' >> typeOf _currentUnit >> 'canCarryBackPack'); + _show = if (_get == 1) then {true} else {false}; + ctrlShow [3802,_show]; + + if (_manageBackpack) then {_updateFiller = true}; + + _currentSpecials = []; + _currentItems = []; + _currentMagazines = magazines _currentUnit; + + _currentPrimary = ''; + _currentSecondary = ''; + _currentSidearm = ''; + + _sideGear = _currentWeapons; + {if (!(_x in _all)) then {_sideGear = _sideGear - [_x]}} forEach _currentWeapons; + _currentWeapons = _sideGear; + + _sideGear = _currentMagazines; + {if (!(_x in _misc) && !(_x in _magazine)) then {_sideGear = _sideGear - [_x]}} forEach _currentMagazines; + _currentMagazines = _sideGear; + + _currentPrimaryCost = 0; + _currentSecondaryCost = 0; + _currentSidearmCost = 0; + _currentSpecialCost = 0; + + ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']; + ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']; + ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']; + ctrlSetText [3535,'\Ca\UI\Data\ui_gear_eq_gs.paa']; + ctrlSetText [3536,'\Ca\UI\Data\ui_gear_eq_gs.paa']; + + { + _cwep = _x; + _get = (_cwep+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _cwep Call GetNamespace; + }; + + if !(isNil '_get') then { + _found = false; + _index = {_x == _cwep} count _primary; + if (_index > 0) then {_currentPrimary = _cwep;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE];_found = true}; + if !(_found) then { + _index = {_x == _cwep} count _secondary; + if (_index > 0) then {_currentSecondary = _cwep;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE];_found = true}; + if !(_found) then { + _index = {_x == _cwep} count _sidearm; + if (_index > 0) then {_currentSidearm = _cwep;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE];_found = true}; + if !(_found) then { + _index = {_x == _cwep} count _misc; + if (_index > 0) then { + switch (_get select QUERYGEARTYPE) do { + case 'Special': { + _currentSpecials = _currentSpecials + [_x]; + _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST); + _u = 0; + { + _zt = _x Call GetNamespace; + ctrlSetText[_specialIDC + _u,_zt select QUERYGEARPICTURE]; + _u = _u + 1; + } forEach _currentSpecials; + }; + case 'Item': { + _currentItems = _currentItems + [_x]; + }; + }; + }; + }; + }; + }; + }; + } forEach _currentWeapons; + + _currentWeapons = _currentWeapons - _misc; + _data = [_currentMagazines,_currentItems] Call DisplayInventory; + _inventorySlots = _data select 0; + _sidearmInventorySlots = _data select 1; + _miscItemSlots = _data select 2; + _currentCost = _currentCost + (_data select 3) + _currentPrimaryCost + _currentSecondaryCost + _currentSidearmCost + _currentSpecialCost; + _cost = 0; + _updateUnit = false; + }; + + //--- Remove a magazine by clicking on it. + if (_inventoryClick != -1) then { + //--- Main Inventory. + if (_inventoryClick > 3502 && _inventoryClick < 3515) then { + _slot = _inventoryClick - 3503; + if (_slot < Count _inventorySlots) then { + _index = _currentMagazines find (_inventorySlots Select _slot); + if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] Call ReplaceArray}; + }; + }; + //--- Handgun Inventory + if (_inventoryClick > 3514 && _inventoryClick < 3523) then { + _slot = _inventoryClick - 3515; + if (_slot < Count _sidearmInventorySlots) then { + _index = _currentMagazines find (_sidearmInventorySlots Select _slot); + if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] Call ReplaceArray}; + }; + }; + //--- Misc Inventory + if (_inventoryClick > 3522 && _inventoryClick < 3535) then { + _slot = _inventoryClick - 3523; + if (_slot < Count _miscItemSlots) then { + _index = _currentItems find (_miscItemSlots Select _slot); + if (_index != -1) then {_currentItems = [_currentItems,_index] Call ReplaceArray}; + }; + }; + //--- Remove a special item. + if (_inventoryClick == 3535 || _inventoryClick == 3536) then { + _slot = _inventoryClick - 3535; + if (_slot < Count _currentSpecials) then { + _currentSpecialCost = 0; + _currentSpecials = _currentSpecials - [_currentSpecials select _slot]; + for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']}; + _u = 0; + { + _get = _x Call GetNamespace; + _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST); + ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE]; + _u = _u + 1; + } forEach _currentSpecials; + }; + }; + WF_Logic setVariable ['InventoryClick',-1]; + _displayInv = true; + }; + + //--- Custom UA. + if (_actionSE != '') then { + switch (_actionSE) do { + case 'reload': { + if !(isNil 'respawnWeapons') then { + _currentPrimary = ''; + _currentSecondary = ''; + _currentSidearm = ''; + _currentPrimaryCost = 0; + _currentSecondaryCost = 0; + _currentSidearmCost = 0; + _currentWeapons = []; + _currentItems = []; + _currentSpecials = []; + _backpackloadout = [[],[]]; + + { + _cwep = _x; + _get = (_cwep+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _cwep Call GetNamespace; + }; + + if !(isNil '_get') then { + _index = {_x == _cwep} count _primary; + if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE]} else { + _index = {_x == _cwep} count _secondary; + if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE]} else { + _index = {_x == _cwep} count _sidearm; + if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE]} else { + _index = {_x == _cwep} count _misc; + if (_index > 0) then { + switch (_get select QUERYGEARTYPE) do { + case 'Special': { + _currentSpecials = _currentSpecials + [_x]; + }; + case 'Item': { + _currentItems = _currentItems + [_x]; + }; + }; + }; + }; + }; + }; + }; + } forEach respawnWeapons; + + if !(isNil 'respawnBagContent') then { + if (count (respawnBagContent select 0) > 0) then { + _backpackloadout = [respawnBagContent select 0,respawnBagContent select 1]; + _bpcost = 0; + + if (count (_backpackloadout select 0) > 0) then { + _u = 0; + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + { + _get = _x Call GetNamespace; + if !(isNil '_get') then { + if ((_currentUpgrades select 13) >= (_get select QUERYGEARUPGRADE)) then { + _bpcost = _bpcost + ((_get select QUERYGEARCOST)*((_backpackloadout select 1) select _u)); + }; + }; + _u = _u + 1; + } forEach (_backpackloadout select 0); + }; + _currentBackpackLoadout = (_backpackloadout select 0); + _currentBackpackLoadoutAmount = (_backpackloadout select 1); + }; + }; + + if (_currentSecondary in _listbp) then { + _unitBP = _currentSecondary; + }; + + if (_currentPrimary == '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']}; + if (_currentSecondary == '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']}; + if (_currentSidearm == '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']}; + + _currentMagazines = respawnAmmo; + _currentSpecialCost = 0; + + for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']}; + + _u = 0; + { + _get = _x Call GetNamespace; + _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST); + ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE]; + _u = _u + 1; + } forEach _currentSpecials; + + _displayInv = true; + }; + }; + case 'clear': { + _currentPrimary = ''; + _currentSecondary = ''; + _currentSidearm = ''; + _unitBP = ""; + _currentPrimaryCost = 0; + _currentSecondaryCost = 0; + _currentSidearmCost = 0; + _currentSpecialCost = 0; + _bpcost = 0; + _currentWeapons = []; + _currentItems = []; + _currentSpecials = []; + _currentMagazines = []; + ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']; + ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']; + ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']; + for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']}; + _displayInv = true; + }; + case 'backpack': { + if (_unitBP != "") then { + lnbClear _lb; + [_backpack,'backpack',_lb] Call UIGearFillList; + _manageBackpack = true; + _updateBackpack = true; + }; + }; + }; + WF_Logic setVariable ['WF_Gear_Action','']; + }; + + //--- Show inventory (Icons). + if (_displayInv) then { + _displayInv = false; + _upgradeCost = _currentSpecialCost; + _data = [_currentMagazines,_currentItems] Call DisplayInventory; + _inventorySlots = _data select 0; + _sidearmInventorySlots = _data select 1; + _miscItemSlots = _data select 2; + _upgradeCost = _upgradeCost + (_data select 3); + if (_currentPrimary != '') then {_upgradeCost = _upgradeCost + _currentPrimaryCost}; + if (_currentSecondary != '') then {_upgradeCost = _upgradeCost + _currentSecondaryCost}; + if (_currentSidearm != '') then {_upgradeCost = _upgradeCost + _currentSidearmCost}; + if !(_currentSecondary in _listbp) then {_unitBP = ""}; + _cost = (_upgradeCost+_bpcost) - _currentCost; + }; + + //--- Update the backpack + if (_updateBackpack) then { + _updateBackpack = false; + + _currentBackpackLoadout = []; + _currentBackpackLoadoutAmount = []; + _currentBackpackLoadoutCost = []; + _currentBackpackLoadoutPictures = []; + _currentBackpackLoadoutNames = []; + _currentBackpackLoadoutUpgrades = []; + _currentBackpackLoadoutAllowed = []; + _u = 0; + _cost = _cost - _bpcost; + _bpcost = 0; + if (count (_backpackloadout select 0) > 0) then { + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + { + _get = _x Call GetNamespace; + if !(isNil '_x') then { + if ((_currentUpgrades select 13) >= (_get select QUERYGEARUPGRADE)) then { + _currentBackpackLoadout = _currentBackpackLoadout + [_x]; + _currentBackpackLoadoutAmount = _currentBackpackLoadoutAmount + [(_backpackloadout select 1) select _u]; + _currentBackpackLoadoutCost = _currentBackpackLoadoutCost + [_get select QUERYGEARCOST]; + _bpcost = _bpcost + ((_get select QUERYGEARCOST)*((_backpackloadout select 1) select _u)); + _currentBackpackLoadoutPictures = _currentBackpackLoadoutPictures + [_get select QUERYGEARPICTURE]; + _currentBackpackLoadoutNames = _currentBackpackLoadoutNames + [str((_backpackloadout select 1) select _u)+"x "+(_get select QUERYGEARLABEL)]; + _currentBackpackLoadoutUpgrades = _currentBackpackLoadoutUpgrades + [_get select QUERYGEARUPGRADE]; + _currentBackpackLoadoutAllowed = _currentBackpackLoadoutAllowed + [_get select QUERYGEARALLOWED]; + }; + }; + _u = _u + 1; + } forEach (_backpackloadout select 0); + }; + _cost = _cost + _bpcost; + lnbClear _lbm; + [_currentBackpackLoadoutCost,_currentBackpackLoadoutNames,_currentBackpackLoadoutPictures,_currentBackpackLoadoutUpgrades,_currentBackpackLoadoutAllowed,'backpack',_lbm] Call UIGearFillTemplateList; + }; + + //--- Buy a loadout. + if (buyLoadout) then { + buyLoadout = false; + _funds = Call GetPlayerFunds; + if (_funds >= _cost) then { + (-_cost) Call ChangePlayerFunds; + //--- Player's respawn loadout. + if (_currentUnit == player && (vehicleVarName player == clientIdentification)) then { + respawnWeapons = _currentWeapons + _currentSpecials + _currentItems; + respawnAmmo = _currentMagazines; + if (_unitBP != '') then { + respawnBag = _unitBP; + respawnBagContent = [_currentBackpackLoadout,_currentBackpackLoadoutAmount]; + } else { + respawnBag = nil; + respawnBagContent = [[],[]]; + }; + }; + + /* Equip the core before the backpack */ + _weaps = _currentWeapons; + if !(WF_A2_Vanilla) then { + _temp = _weaps; + { + if (_x in _listbp) then {_temp = _temp - [_x]}; + } forEach _weaps; + _weaps = _temp; + }; + [_currentUnit,(_weaps + _currentSpecials + _currentItems),_currentMagazines] Call EquipLoadout; + + /* Equip backpack if needed */ + if !(WF_A2_Vanilla) then { + if (_unitBP != "" || !isNull (unitBackpack _currentUnit)) then { + _add = true; + if ((_unitBP == "" && !isNull (unitBackpack _currentUnit)) || (_unitBP != "" && !isNull (unitBackpack _currentUnit))) then {removeBackpack _currentUnit;}; + if !(isNull (unitBackpack _currentUnit)) then { + if (typeOf (unitBackpack _currentUnit) == _unitBP) then {_add = false}; + }; + + if (_add && _unitBP != "") then { + _currentUnit addBackpack _unitBP; + }; + + [unitBackpack _currentUnit,[_currentBackpackLoadout,_currentBackpackLoadoutAmount]] Call EquipBackpack; + }; + }; + _data = [_currentMagazines,_currentItems] Call DisplayInventory; + _inventorySlots = _data select 0; + _sidearmInventorySlots = _data select 1; + _miscItemSlots = _data select 2; + _currentCost = (_data select 3) + _currentPrimaryCost + _currentSecondaryCost + _currentSidearmCost + _currentSpecialCost + _bpcost; + respawnGearCost = _currentCost; + _cost = 0; + } else { + hint parseText(Format [localize "STR_WF_INFO_Funds_Missing_Gear",_cost - _funds]); + }; + }; + + //--- Remove an existing template. + if (deleteLoadout) then { + deleteLoadout = false; + //--- Behave only on template filler. + if (_filler == 'template') then { + _currentRow = lnbCurSelRow _lb; + _currentValue = lnbValue[_lb,[_currentRow,0]]; + //--- Update the templates. + _template set [_currentValue, "DELETE"]; + _template = _template - ["DELETE"]; + WF_Logic setVariable["templateClasses",_template]; + _templateCosts set [_currentValue, "DELETE"]; + _templateCosts = _templateCosts - ["DELETE"]; + WF_Logic setVariable["templateCosts",_templateCosts]; + _templatePictures set [_currentValue, "DELETE"]; + _templatePictures = _templatePictures - ["DELETE"]; + WF_Logic setVariable["templatePictures",_templatePictures]; + _templateNames set [_currentValue, "DELETE"]; + _templateNames = _templateNames - ["DELETE"]; + WF_Logic setVariable["templateNames",_templateNames]; + _templateMags set [_currentValue, "DELETE"]; + _templateMags = _templateMags - ["DELETE"]; + WF_Logic setVariable["templateMags",_templateMags]; + _templateItems set [_currentValue, "DELETE"]; + _templateItems = _templateItems - ["DELETE"]; + WF_Logic setVariable["templateItems",_templateItems]; + _templateSpecs set [_currentValue, "DELETE"]; + _templateSpecs = _templateSpecs - ["DELETE"]; + WF_Logic setVariable["templateSpecs",_templateSpecs]; + _templateUpgrades set [_currentValue, "DELETE"]; + _templateUpgrades = _templateUpgrades - ["DELETE"]; + WF_Logic setVariable["templateUpgrades",_templateUpgrades]; + _templateAllowed set [_currentValue, "DELETE"]; + _templateAllowed = _templateAllowed - ["DELETE"]; + WF_Logic setVariable["templateAllowed",_templateAllowed]; + _updateFiller = true; + }; + }; + + if (saveLoadout) then { + saveLoadout = false; + //--- Behave only on template filler. + if (_filler == 'template') then { + //--- Update the templates. + _desc = ''; + _pict = ''; + _temp = []; + _cAllow = true; + _upgr = 0; + _pallow = true; + _sallow = true; + + if (_currentPrimary != '') then { + _get = _currentPrimary Call GetNamespace; + _temp = _temp + [_currentPrimary]; + _desc = _desc + (_get select QUERYGEARLABEL); + _pict = (_get select QUERYGEARPICTURE); + if !(_get select QUERYGEARALLOWED) then {_cAllow = false}; + _upgr = _get select QUERYGEARUPGRADE; + _pallow = _get select QUERYGEARALLOWTWO; + }; + if (_currentSecondary != '') then { + _get = (_currentSecondary+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _currentSecondary Call GetNamespace; + }; + _temp = _temp + [_currentSecondary]; + if (_desc != '') then { _desc = _desc + "/"}; + //--- Needless to check if the primary is prohibed. + _desc = _desc + (_get select QUERYGEARLABEL); + if (_pict == '') then {_pict = _get select QUERYGEARPICTURE}; + if (_cAllow) then {if !(_get select QUERYGEARALLOWED) then {_cAllow = false}}; + if ((_get select QUERYGEARUPGRADE) > _upgr) then {_upgr = (_get select QUERYGEARUPGRADE)}; + _sallow = _get select QUERYGEARALLOWTWO; + }; + if (_currentSidearm != '') then { + _get = _currentSidearm Call GetNamespace; + _temp = _temp + [_currentSidearm]; + if (_desc != '') then { _desc = _desc + "/"}; + //--- Needless to check if the secondary is prohibed. + _desc = _desc + (_get select QUERYGEARLABEL); + if (_pict == '') then {_pict = _get select QUERYGEARPICTURE}; + if (_cAllow) then {if !(_get select QUERYGEARALLOWED) then {_cAllow = false}}; + if ((_get select QUERYGEARUPGRADE) > _upgr) then {_upgr = (_get select QUERYGEARUPGRADE)}; + }; + //--- Handle Backpack Content. + _addin = [_currentItems]; + if (_unitBP != '') then { + _extra = [_currentBackpackLoadout,_currentBackpackLoadoutAmount]; + _addin = [_currentItems + [_extra]]; + }; + if (_pallow || _sallow || !paramExtendedInventory) then { + _template = _template + [_temp]; + WF_Logic setVariable["templateClasses",_template]; + _templateCosts = _templateCosts + [(_cost + _currentCost)]; + WF_Logic setVariable["templateCosts",_templateCosts]; + _templatePictures = _templatePictures + [_pict]; + WF_Logic setVariable["templatePictures",_templatePictures]; + _templateNames = _templateNames + [_desc]; + WF_Logic setVariable["templateNames",_templateNames]; + _templateMags = _templateMags + [_currentMagazines]; + WF_Logic setVariable["templateMags",_templateMags]; + _templateItems = _templateItems + _addin; + WF_Logic setVariable["templateItems",_templateItems]; + _templateSpecs = _templateSpecs + [_currentSpecials]; + WF_Logic setVariable["templateSpecs",_templateSpecs]; + _templateUpgrades = _templateUpgrades + [_upgr]; + WF_Logic setVariable["templateUpgrades",_templateUpgrades]; + _templateAllowed = _templateAllowed + [_cAllow]; + WF_Logic setVariable["templateAllowed",_templateAllowed]; + _updateFiller = true; + } else { + hint parseText (localize 'STR_WF_INFO_Gear_AllowTwo'); + }; + }; + }; + + //--- Loadout Cost. + ctrlSetText[3850,Format[localize 'STR_WF_GEAR_Cost',_cost]]; + //--- Player's Cash. + //ctrlSetText[3851,Format["%1 $ %2.",localize 'STR_WF_GEAR_CashLabel',Call GetPlayerFunds]]; + ctrlSetText[3851,Format["$%1",Call GetPlayerFunds]]; //---changes-MrNiceGuy + + _lastFiller = _filler; + sleep 0.05; + + //--- Back Button. + if (MenuAction == 1) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; + +//--- Variables destruction. +WF_Logic setVariable ['lbChange',nil]; +WF_Logic setVariable ['lbMainAction',nil]; +WF_Logic setVariable ['InventoryClick',nil]; +WF_Gear_Hotkeys = nil; +primClicked = nil; +secoClicked = nil; +sideClicked = nil; +buyLoadout = nil; +saveLoadout = nil; +deleteLoadout = nil; + +(findDisplay 16000) displayRemoveEventHandler ['KeyDown',_disp]; \ No newline at end of file diff --git a/Client/GUI/GUI_GearV.sqf b/Client/GUI/GUI_GearV.sqf new file mode 100644 index 0000000..ef8114d --- /dev/null +++ b/Client/GUI/GUI_GearV.sqf @@ -0,0 +1,774 @@ +/* Important, use +array if you plan to use Setters */ + +private ["_inRange","_sideID","_nObjects","_nObject","_unitList","_text","_amount","_val","_val2", +"_ainumber","_txt","_type","_check","_updateFiller","_list","_id","_changed","_get","_currentMags", +"_currentRow","_currentData","_currentValue","_currentItem","_skip","_get2","_oldMags","_currentMagazines", +"_slist","_index","_currentWeapons","_displayInv","_zt","_currentSpecialCost","_u", +"_currentSpecials","_currentItems","_currentPrimary","_currentPrimaryCost","_currentSecondary", +"_currentSecondaryCost","_currentSidearm","_currentSidearmCost","_cwep","_x","_tempWeapons", +"_tempItems","_tempMags","_tempSpecs","_currentMagValue","_currentMag","_currentUnit","_updateUnit", +"_sideGear","_found","_data","_inventorySlots","_sidearmInventorySlots","_miscItemSlots","_currentCost", +"_cost","_slot","_upgradeCost","_funds","_template","_templateCosts","_templatePictures","_templateNames", +"_templateMags","_templateItems","_templateSpecs","_templateUpgrades","_templateAllowed", +"_cAllow","_temp","_desc","_pict","_upgr","_filler","_mainAction","_inventoryClick","_unitSwap", +"_actionSE","_lastFiller","_primary","_secondary","_sidearm","_misc","_magazine","_all","_lb", +"_lbm","_primaryIDC","_secondaryIDC","_sidearmIDC","_specialIDC","_display","_totalWeapons", +"_fillerIDC","_fillerTypes","_old","_disp","_buildings","_getpp","_isPrimAllowTwo","_getss","_isSecoAllowTwo", +"_sskip","_query","_tfil","_pallow","_sallow"]; + +_primary = +(WF_Logic getVariable 'primaryClasses'); +_secondary = +(WF_Logic getVariable 'secondaryClasses'); +_sidearm = +(WF_Logic getVariable 'sidearmClasses'); +_misc = +(WF_Logic getVariable 'miscClasses'); +_magazine = +(WF_Logic getVariable 'magazineClasses'); + +_template = +(WF_Logic getVariable 'templateClasses'); +_templateCosts = +(WF_Logic getVariable 'templateCosts'); +_templatePictures = +(WF_Logic getVariable 'templatePictures'); +_templateNames = +(WF_Logic getVariable 'templateNames'); +_templateMags = +(WF_Logic getVariable 'templateMags'); +_templateItems = +(WF_Logic getVariable 'templateItems'); +_templateSpecs = +(WF_Logic getVariable 'templateSpecs'); +_templateUpgrades = +(WF_Logic getVariable 'templateUpgrades'); +_templateAllowed = +(WF_Logic getVariable 'templateAllowed'); + +_all = _primary + _secondary + _sidearm + _misc; + +WF_Logic setVariable ['lbChange',false]; +WF_Logic setVariable ['lbMainAction','']; +WF_Logic setVariable ['InventoryClick',-1]; +WF_Logic setVariable ['WF_GEAR_Swap',false]; +WF_Logic setVariable ['WF_Gear_Action','']; + +ctrlShow[3802,false]; + +primClicked = false; +secoClicked = false; +sideClicked = false; +deleteLoadout = false; +saveLoadout = false; +buyLoadout = false; +_displayInv = false; +_updateUnit = true; +_updateFiller = false; + +disableSerialization; +_lb = 3700; +_lbm = 3701; +_primaryIDC = 3500; +_secondaryIDC = 3501; +_sidearmIDC = 3502; +_specialIDC = 3535; +_display = _this select 0; + +_totalWeapons = count _primary + count _secondary + count _sidearm; + +_fillerIDC = [3400,3401,3402,3403,3404,3405]; +_fillerTypes = ['template','all','primary','secondary','sidearm','misc']; +_inventorySlots = []; +_lastFiller = 'nil'; +_id = _fillerTypes find 'primary'; +_list = []; +_miscItemSlots = []; +_sidearmInventorySlots = []; +(_display DisplayCtrl (_fillerIDC select _id)) ctrlSetTextColor [1, 1, 1, 1]; + +_currentItem = ''; +_currentMags = []; +_currentData = ''; +_currentValue = ''; +_currentCost = 0; +_cost = 0; + +_currentPrimary = ''; +_currentSecondary = ''; +_currentSidearm = ''; +_currentPrimaryCost = 0; +_currentSecondaryCost = 0; +_currentSidearmCost = 0; +_currentSpecialCost = 0; + +_old = ''; + +_currentWeapons = []; +_currentSpecials = []; +_currentItems = []; +_currentMagazines = []; + +_disp = (findDisplay 16000) displayAddEventHandler ['KeyDown','_this Call WF_Gear_Hotkeys']; +_buygearfrom = missionNamespace getVariable "WFBE_TOWNGEAR"; + +//--- Fill the available units list. +_unitList = []; +_buildings = (sideJoinedText) Call GetSideStructures; +_i = 0; +{ + _check = ['BARRACKSTYPE',_buildings,'WFBE_PURCHASEGEARRANGE' Call GetNamespace,sideJoined,_x] Call BuildingInRange; + _inRange = if (isNull _check) then {false} else {true}; + + if (!_inRange && _buygearfrom in [1,2,3]) then { + _lookfor = switch (_buygearfrom) do { case 1:{WFCAMP}; case 2:{WFDEPOT}; case 3:{WFCAMP + WFDEPOT}; default{[]}}; + _nObjects = nearestObjects [_x, _lookfor, 25]; + _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull}; + if !(isNull _nObject) then { + _sideID = _nObject getVariable "sideID"; + if !(isNil "_sideID") then { + if (_sideID == sideID) then {_inRange = true}; + }; + }; + }; + + if (_inRange) then { + _txt = (_x) Call GetAIDigit; + _unitList = _unitList + [_x]; + + _type = [typeOf _x, 'displayName'] Call GetConfigInfo; + lbAdd [3854,Format["[%1] %2 (%3)",_txt,name _x,_type]]; + + if (_currentUnit == _x) then {lbSetCurSel[3854,_i]}; + _i = _i + 1; + }; +} forEach units(group player); + +_currentUnit = player; + +while {alive player && dialog} do { + if (Side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; + + //--- Something changed since the last time? + _filler = WF_Logic getVariable 'filler'; + _changed = WF_Logic getVariable 'lbChange'; + _mainAction = WF_Logic getVariable 'lbMainAction'; + _inventoryClick = WF_Logic getVariable 'InventoryClick'; + _unitSwap = WF_Logic getVariable 'WF_GEAR_Swap'; + _actionSE = WF_Logic getVariable 'WF_Gear_Action'; + + //--- Filter Changed. + if (_filler != _lastFiller || _updateFiller) then { + _updateFiller = false; + _list = Call Compile Format ['_%1',_filler]; + lnbClear _lb; + if (_filler != 'template') then { + [_list,_filler,_lb] Call UIGearFillList; + } else { + [_templateCosts,_templateNames,_templatePictures,_templateUpgrades,_templateAllowed,_filler,_lb] Call UIGearFillTemplateList; + }; + _id = _fillerTypes find _filler; + {(_display displayCtrl _x) ctrlSetTextColor [0.7490, 0.7490, 0.7490, 0.7]} forEach _fillerIDC; + (_display displayCtrl (_fillerIDC select _id)) ctrlSetTextColor [1, 1, 1, 1]; + //--- Update the list since the filler changed. + _changed = true; + }; + + //--- List Selection Changed. + if (_changed) then { + WF_Logic setVariable ['lbChange',false]; + _currentRow = lnbCurSelRow _lb; + _currentData = lnbData[_lb,[_currentRow,0]]; + _currentValue = lnbValue[_lb,[_currentRow,0]]; + _currentItem = _list select _currentValue; + lnbClear _lbm; + _get = []; + + /* Get */ + if (_filler != 'template') then { + if (_filler == 'secondary' || _filler == 'all') then { + _get = (_currentItem+'_W') Call GetNamespace; + if (isNil '_get') then { + _get = _currentItem Call GetNamespace; + }; + } else { + _get = _currentItem Call GetNamespace; + }; + + if !(isNil '_get') then { + _currentMags = _get select QUERYGEARMAGAZINES; + if (typeName _currentMags != 'SCALAR') then { + if (count _currentMags > 0) then { + [_currentMags,'magazine',_lbm] Call UIGearFillList; + }; + }; + }; + }; + }; + + //--- Player have clicked on one of the listbox. + if (_mainAction != '') then { + switch (_mainAction) do { + case 'addWeapon': { + _skip = true; + _sskip = false; + _get = []; + + if (_filler != 'template') then { + _get = (_currentItem+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _currentItem Call GetNamespace; + }; + }; + + if (_filler == 'primary' || _filler == 'secondary' || _filler == 'sidearm' || _filler == 'all') then { + if (_currentItem in _misc) then {_skip = false;_currentValue = _currentValue - _totalWeapons}; + if (_skip) then { + _slist = Call Compile Format ['_%1',_currentData]; + _index = _slist find _currentItem; + if (_index != -1) then { + if (_filler == 'all') then { + if (_currentItem in _primary) then {_currentData = 'primary'} else { + if (_currentItem in _secondary) then {_currentData = 'secondary'} else { + if (_currentItem in _sidearm) then {_currentData = 'sidearm'}; + }; + }; + }; + + /* Handle the extended inventory system if disabled */ + _isSecoAllowTwo = true; + _isPrimAllowTwo = true; + if (paramExtendedInventory && (_filler == 'primary' || _filler == 'secondary' || _filler == 'all')) then { + _getpp = []; + _getss = []; + + _query = if (_currentData == 'primary') then {_currentItem} else {_currentPrimary}; + if (_query != '') then { + _getpp = (_query+"_W") Call GetNamespace; + if (isNil '_getpp') then { + _getpp = _query Call GetNamespace; + }; + }; + if (_query != '') then {_isPrimAllowTwo = _getpp select QUERYGEARALLOWTWO}; + + _query = if (_currentData == 'secondary') then {_currentItem} else {_currentSecondary}; + if (_query != '') then { + _getss = (_query+"_W") Call GetNamespace; + if (isNil '_getss') then { + _getss = _query Call GetNamespace; + }; + }; + if (_query != '') then {_isSecoAllowTwo = _getss select QUERYGEARALLOWTWO}; + + if (!_isSecoAllowTwo && !_isPrimAllowTwo) then { + _sskip = true; + hint parseText (localize 'STR_WF_INFO_Gear_AllowTwo'); + }; + }; + + if (!_sskip) then { + Call Compile Format ['_old = _current%1;_currentWeapons = _currentWeapons - [_current%1]; _current%1Cost = %2; _current%1 = "%3";ctrlSetText[_%1IDC,"%4"]',_currentData,_get select QUERYGEARCOST,_currentItem,_get select QUERYGEARPICTURE]; + //--- New Magazines. + _currentMags = _get select QUERYGEARMAGAZINES; + //--- Old Magazines. + _get2 = (_old+"_W") Call GetNamespace; + if (isNil '_get2') then { + _get2 = _old Call GetNamespace; + }; + if !(isNil '_get2') then { + _oldMags = _get2 select QUERYGEARMAGAZINES; + _use = ""; + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + { + _upgr = (missionNamespace getVariable _x) select QUERYGEARUPGRADE; + if ((_currentUpgrades select 13) >= _upgr) exitWith {_use = _x}; + } forEach _currentMags; + _currentMagazines = [_use,_oldMags,_currentMagazines] Call ReplaceInventoryAmmo; + }; + }; + if !(isNil '_get2') then { + _oldMags = _get2 select QUERYGEARMAGAZINES; + _currentMagazines = [_currentMags select 0,_oldMags,_currentMagazines] Call ReplaceInventoryAmmo; + }; + }; + }; + if (!_sskip) then { + _currentWeapons = _currentWeapons + [_currentItem]; + _displayInv = true; + }; + }; + }; + if (_filler == 'misc' || !_skip) then { + _type = _get select QUERYGEARTYPE; + if (_type == 'CfgMagazines') then { + _currentMagazines = [_currentMagazines,_currentItem] Call UIAddMagazine; + _displayInv = true; + }; + if (_type == 'Special' && count _currentSpecials < 3 && !(_currentItem in _currentSpecials)) then { + _currentSpecials = _currentSpecials + [_currentItem]; + _currentSpecialCost = 0; + _u = 0; + { + _zt = _x Call GetNamespace; + ctrlSetText[_specialIDC + _u,_zt select QUERYGEARPICTURE]; + _currentSpecialCost = _currentSpecialCost + (_zt select QUERYGEARCOST); + _u = _u + 1; + } forEach _currentSpecials; + _displayInv = true; + }; + if (_type == 'Item') then { + if (!(_currentItem in _currentItems)) then { + _currentItems = [_currentItems,_currentItem] Call UIAddItem; + _displayInv = true; + }; + }; + }; + /* TODO */ + if (_filler == 'template') then { + _tempWeapons = _template select _currentValue; + _tempItems = _templateItems select _currentValue; + _tempMags = _templateMags select _currentValue; + _tempSpecs = _templateSpecs select _currentValue; + _currentPrimary = ''; + _currentSecondary = ''; + _currentSidearm = ''; + _currentPrimaryCost = 0; + _currentSecondaryCost = 0; + _currentSidearmCost = 0; + _currentWeapons = []; + _currentItems = _tempItems; + { + _cwep = _x; + _get = (_x+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _x Call GetNamespace; + }; + + if (({_x == _cwep} count _primary) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE]} else { + if (({_x == _cwep} count _secondary) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE]} else { + if (({_x == _cwep} count _sidearm) > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE]}; + }; + }; + } forEach _tempWeapons; + if (_currentPrimary == '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']}; + if (_currentSecondary == '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']}; + if (_currentSidearm == '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']}; + _currentMagazines = _tempMags; + _currentSpecials = _tempSpecs; + _currentSpecialCost = 0; + for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']}; + _u = 0; + { + _get = _x Call GetNamespace; + _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST); + ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE]; + _u = _u + 1; + } forEach _currentSpecials; + _displayInv = true; + }; + }; + + case 'addMagazine': { + _currentMagValue = lnbValue[_lbm,[lnbCurSelRow _lbm,0]]; + _currentMag = _currentMags select _currentMagValue; + _currentMagazines = [_currentMagazines,_currentMag] Call UIAddMagazine; + _displayInv = true; + }; + }; + WF_Logic setVariable ['lbMainAction','']; + }; + + //--- Remove a weapon by clicking on it. + if (primClicked) then {primClicked = false;if (_currentPrimary != '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa'];_index = _primary find _currentPrimary;_currentPrimaryCost = 0;_currentWeapons = _currentWeapons - [_currentPrimary];_currentPrimary = '';_displayInv = true}}; + if (secoClicked) then {secoClicked = false;if (_currentSecondary != '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa'];_index = _secondary find _currentSecondary;_currentSecondaryCost = 0;_currentWeapons = _currentWeapons - [_currentSecondary];_currentSecondary = '';_displayInv = true}}; + if (sideClicked) then {sideClicked = false;if (_currentSidearm != '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa'];_index = _sidearm find _currentSidearm;_currentSidearmCost = 0;_currentWeapons = _currentWeapons - [_currentSidearm];_currentSidearm = '';_displayInv = true}}; + + if (_unitSwap) then { + WF_Logic setVariable ['WF_GEAR_Swap',false]; + if (count _unitList > 0) then {_currentUnit = _unitList select (lbCurSel 3854)} else {_currentUnit = player}; + _updateUnit = true; + }; + + if (_updateUnit) then { + _currentWeapons = weapons _currentUnit; + _currentSpecials = []; + _currentItems = []; + _currentMagazines = magazines _currentUnit; + + _currentPrimary = ''; + _currentSecondary = ''; + _currentSidearm = ''; + + _sideGear = _currentWeapons; + {if (!(_x in _all)) then {_sideGear = _sideGear - [_x]}} forEach _currentWeapons; + _currentWeapons = _sideGear; + + _sideGear = _currentMagazines; + {if (!(_x in _misc) && !(_x in _magazine)) then {_sideGear = _sideGear - [_x]}} forEach _currentMagazines; + _currentMagazines = _sideGear; + + _currentPrimaryCost = 0; + _currentSecondaryCost = 0; + _currentSidearmCost = 0; + _currentSpecialCost = 0; + + ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']; + ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']; + ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']; + ctrlSetText [3535,'\Ca\UI\Data\ui_gear_eq_gs.paa']; + ctrlSetText [3536,'\Ca\UI\Data\ui_gear_eq_gs.paa']; + + { + _cwep = _x; + _get = (_cwep+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _cwep Call GetNamespace; + }; + + if !(isNil '_get') then { + _found = false; + _index = {_x == _cwep} count _primary; + if (_index > 0) then {_currentPrimary = _cwep;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE];_found = true}; + if !(_found) then { + _index = {_x == _cwep} count _secondary; + if (_index > 0) then {_currentSecondary = _cwep;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE];_found = true}; + if !(_found) then { + _index = {_x == _cwep} count _sidearm; + if (_index > 0) then {_currentSidearm = _cwep;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE];_found = true}; + if !(_found) then { + _index = {_x == _cwep} count _misc; + if (_index > 0) then { + switch (_get select QUERYGEARTYPE) do { + case 'Special': { + _currentSpecials = _currentSpecials + [_x]; + _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST); + _u = 0; + { + _zt = _x Call GetNamespace; + ctrlSetText[_specialIDC + _u,_zt select QUERYGEARPICTURE]; + _u = _u + 1; + } forEach _currentSpecials; + }; + case 'Item': { + _currentItems = _currentItems + [_x]; + }; + }; + }; + }; + }; + }; + }; + } forEach _currentWeapons; + + _currentWeapons = _currentWeapons - _misc; + _data = [_currentMagazines,_currentItems] Call DisplayInventory; + _inventorySlots = _data select 0; + _sidearmInventorySlots = _data select 1; + _miscItemSlots = _data select 2; + _currentCost = (_data select 3) + _currentPrimaryCost + _currentSecondaryCost + _currentSidearmCost + _currentSpecialCost; + _cost = 0; + _updateUnit = false; + }; + + //--- Remove a magazine by clicking on it. + if (_inventoryClick != -1) then { + //--- Main Inventory. + if (_inventoryClick > 3502 && _inventoryClick < 3515) then { + _slot = _inventoryClick - 3503; + if (_slot < Count _inventorySlots) then { + _index = _currentMagazines find (_inventorySlots select _slot); + if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] Call ReplaceArray}; + }; + }; + //--- Handgun Inventory + if (_inventoryClick > 3514 && _inventoryClick < 3523) then { + _slot = _inventoryClick - 3515; + if (_slot < Count _sidearmInventorySlots) then { + _index = _currentMagazines find (_sidearmInventorySlots select _slot); + if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] Call ReplaceArray}; + }; + }; + //--- Misc Inventory + if (_inventoryClick > 3522 && _inventoryClick < 3535) then { + _slot = _inventoryClick - 3523; + if (_slot < Count _miscItemSlots) then { + _index = _currentItems find (_miscItemSlots select _slot); + if (_index != -1) then {_currentItems = [_currentItems,_index] Call ReplaceArray}; + }; + }; + //--- Remove a special item. + if (_inventoryClick == 3535 || _inventoryClick == 3536) then { + _slot = _inventoryClick - 3535; + if (_slot < Count _currentSpecials) then { + _currentSpecialCost = 0; + _currentSpecials = _currentSpecials - [_currentSpecials select _slot]; + for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']}; + _u = 0; + { + _get = _x Call GetNamespace; + _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST); + ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE]; + _u = _u + 1; + } forEach _currentSpecials; + }; + }; + WF_Logic setVariable ['InventoryClick',-1]; + _displayInv = true; + }; + + //--- Custom UA. + if (_actionSE != '') then { + switch (_actionSE) do { + case 'reload': { + if !(isNil 'respawnWeapons') then { + _currentPrimary = ''; + _currentSecondary = ''; + _currentSidearm = ''; + _currentPrimaryCost = 0; + _currentSecondaryCost = 0; + _currentSidearmCost = 0; + _currentWeapons = []; + _currentItems = []; + _currentSpecials = []; + { + _cwep = _x; + _get = (_cwep+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _cwep Call GetNamespace; + }; + + if !(isNil '_get') then { + _index = {_x == _cwep} count _primary; + if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;_currentPrimaryCost = _get select QUERYGEARCOST;ctrlSetText[_primaryIDC,_get select QUERYGEARPICTURE]} else { + _index = {_x == _cwep} count _secondary; + if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;_currentSecondaryCost = _get select QUERYGEARCOST;ctrlSetText[_secondaryIDC,_get select QUERYGEARPICTURE]} else { + _index = {_x == _cwep} count _sidearm; + if (_index > 0) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;_currentSidearmCost = _get select QUERYGEARCOST;ctrlSetText[_sidearmIDC,_get select QUERYGEARPICTURE]} else { + _index = {_x == _cwep} count _misc; + if (_index > 0) then { + switch (_get select QUERYGEARTYPE) do { + case 'Special': { + _currentSpecials = _currentSpecials + [_x]; + }; + case 'Item': { + _currentItems = _currentItems + [_x]; + }; + }; + }; + }; + }; + }; + }; + } forEach respawnWeapons; + + if (_currentPrimary == '') then {ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']}; + if (_currentSecondary == '') then {ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']}; + if (_currentSidearm == '') then {ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']}; + + _currentMagazines = respawnAmmo; + _currentSpecialCost = 0; + + for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']}; + + _u = 0; + { + _get = _x Call GetNamespace; + _currentSpecialCost = _currentSpecialCost + (_get select QUERYGEARCOST); + ctrlSetText[_specialIDC + _u,_get select QUERYGEARPICTURE]; + _u = _u + 1; + } forEach _currentSpecials; + + _displayInv = true; + }; + }; + + case 'clear': { + _currentPrimary = ''; + _currentSecondary = ''; + _currentSidearm = ''; + _currentPrimaryCost = 0; + _currentSecondaryCost = 0; + _currentSidearmCost = 0; + _currentSpecialCost = 0; + _currentWeapons = []; + _currentItems = []; + _currentSpecials = []; + _currentMagazines = []; + ctrlSetText [_primaryIDC,'\ca\ui\data\ui_gear_gun_gs.paa']; + ctrlSetText [_secondaryIDC,'\ca\ui\data\ui_gear_sec_gs.paa']; + ctrlSetText [_sidearmIDC,'\ca\ui\data\ui_gear_hgun_gs.paa']; + for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,'\Ca\UI\Data\ui_gear_eq_gs.paa']}; + _displayInv = true; + }; + }; + WF_Logic setVariable ['WF_Gear_Action','']; + }; + + //--- Show inventory (Icons). + if (_displayInv) then { + _displayInv = false; + _upgradeCost = _currentSpecialCost; + _data = [_currentMagazines,_currentItems] Call DisplayInventory; + _inventorySlots = _data select 0; + _sidearmInventorySlots = _data select 1; + _miscItemSlots = _data select 2; + _upgradeCost = _upgradeCost + (_data select 3); + if (_currentPrimary != '') then {_upgradeCost = _upgradeCost + _currentPrimaryCost}; + if (_currentSecondary != '') then {_upgradeCost = _upgradeCost + _currentSecondaryCost}; + if (_currentSidearm != '') then {_upgradeCost = _upgradeCost + _currentSidearmCost}; + _cost = _upgradeCost - _currentCost; + }; + + //--- Buy a loadout. + if (buyLoadout) then { + buyLoadout = false; + _funds = Call GetPlayerFunds; + if (_funds >= _cost) then { + (-_cost) Call ChangePlayerFunds; + //--- Player's respawn loadout. + if (_currentUnit == player && (vehicleVarName player == clientIdentification)) then { + respawnWeapons = _currentWeapons + _currentSpecials + _currentItems; + respawnAmmo = _currentMagazines; + }; + [_currentUnit,(_currentWeapons + _currentSpecials + _currentItems),_currentMagazines] Call EquipLoadout; + _data = [_currentMagazines,_currentItems] Call DisplayInventory; + _inventorySlots = _data select 0; + _sidearmInventorySlots = _data select 1; + _miscItemSlots = _data select 2; + _currentCost = (_data select 3) + _currentPrimaryCost + _currentSecondaryCost + _currentSidearmCost + _currentSpecialCost; + respawnGearCost = _currentCost; + _cost = 0; + } else { + hint parseText(Format [localize "STR_WF_INFO_Funds_Missing_Gear",_cost - _funds]); + }; + }; + + //--- Remove an existing template. + if (deleteLoadout) then { + deleteLoadout = false; + //--- Behave only on template filler. + if (_filler == 'template') then { + _currentRow = lnbCurSelRow _lb; + _currentValue = lnbValue[_lb,[_currentRow,0]]; + //--- Update the templates. + _template set [_currentValue, "DELETE"]; + _template = _template - ["DELETE"]; + WF_Logic setVariable["templateClasses",_template]; + _templateCosts set [_currentValue, "DELETE"]; + _templateCosts = _templateCosts - ["DELETE"]; + WF_Logic setVariable["templateCosts",_templateCosts]; + _templatePictures set [_currentValue, "DELETE"]; + _templatePictures = _templatePictures - ["DELETE"]; + WF_Logic setVariable["templatePictures",_templatePictures]; + _templateNames set [_currentValue, "DELETE"]; + _templateNames = _templateNames - ["DELETE"]; + WF_Logic setVariable["templateNames",_templateNames]; + _templateMags set [_currentValue, "DELETE"]; + _templateMags = _templateMags - ["DELETE"]; + WF_Logic setVariable["templateMags",_templateMags]; + _templateItems set [_currentValue, "DELETE"]; + _templateItems = _templateItems - ["DELETE"]; + WF_Logic setVariable["templateItems",_templateItems]; + _templateSpecs set [_currentValue, "DELETE"]; + _templateSpecs = _templateSpecs - ["DELETE"]; + WF_Logic setVariable["templateSpecs",_templateSpecs]; + _templateUpgrades set [_currentValue, "DELETE"]; + _templateUpgrades = _templateUpgrades - ["DELETE"]; + WF_Logic setVariable["templateUpgrades",_templateUpgrades]; + _templateAllowed set [_currentValue, "DELETE"]; + _templateAllowed = _templateAllowed - ["DELETE"]; + WF_Logic setVariable["templateAllowed",_templateAllowed]; + _updateFiller = true; + }; + }; + + //--- TODO + if (saveLoadout) then { + saveLoadout = false; + //--- Behave only on template filler. + if (_filler == 'template') then { + //--- Update the templates. + _desc = ''; + _pict = ''; + _temp = []; + _cAllow = true; + _upgr = 0; + _pallow = true; + _sallow = true; + + if (_currentPrimary != '') then { + _get = _currentPrimary Call GetNamespace; + _temp = _temp + [_currentPrimary]; + _desc = _desc + (_get select QUERYGEARLABEL); + _pict = (_get select QUERYGEARPICTURE); + if !(_get select QUERYGEARALLOWED) then {_cAllow = false}; + _upgr = _get select QUERYGEARUPGRADE; + _pallow = _get select QUERYGEARALLOWTWO; + }; + if (_currentSecondary != '') then { + _get = (_currentSecondary+"_W") Call GetNamespace; + if (isNil '_get') then { + _get = _currentSecondary Call GetNamespace; + }; + _temp = _temp + [_currentSecondary]; + if (_desc != '') then { _desc = _desc + "/"}; + //--- Needless to check if the primary is prohibed. + _desc = _desc + (_get select QUERYGEARLABEL); + if (_pict == '') then {_pict = _get select QUERYGEARPICTURE}; + if (_cAllow) then {if !(_get select QUERYGEARALLOWED) then {_cAllow = false}}; + if ((_get select QUERYGEARUPGRADE) > _upgr) then {_upgr = (_get select QUERYGEARUPGRADE)}; + _sallow = _get select QUERYGEARALLOWTWO; + }; + if (_currentSidearm != '') then { + _get = _currentSidearm Call GetNamespace; + _temp = _temp + [_currentSidearm]; + if (_desc != '') then { _desc = _desc + "/"}; + //--- Needless to check if the secondary is prohibed. + _desc = _desc + (_get select QUERYGEARLABEL); + if (_pict == '') then {_pict = _get select QUERYGEARPICTURE}; + if (_cAllow) then {if !(_get select QUERYGEARALLOWED) then {_cAllow = false}}; + if ((_get select QUERYGEARUPGRADE) > _upgr) then {_upgr = (_get select QUERYGEARUPGRADE)}; + }; + if (_pallow || _sallow || !paramExtendedInventory) then { + _template = _template + [_temp]; + WF_Logic setVariable["templateClasses",_template]; + _templateCosts = _templateCosts + [(_cost + _currentCost)]; + WF_Logic setVariable["templateCosts",_templateCosts]; + _templatePictures = _templatePictures + [_pict]; + WF_Logic setVariable["templatePictures",_templatePictures]; + _templateNames = _templateNames + [_desc]; + WF_Logic setVariable["templateNames",_templateNames]; + _templateMags = _templateMags + [_currentMagazines]; + WF_Logic setVariable["templateMags",_templateMags]; + _templateItems = _templateItems + [_currentItems]; + WF_Logic setVariable["templateItems",_templateItems]; + _templateSpecs = _templateSpecs + [_currentSpecials]; + WF_Logic setVariable["templateSpecs",_templateSpecs]; + _templateUpgrades = _templateUpgrades + [_upgr]; + WF_Logic setVariable["templateUpgrades",_templateUpgrades]; + _templateAllowed = _templateAllowed + [_cAllow]; + WF_Logic setVariable["templateAllowed",_templateAllowed]; + _updateFiller = true; + } else { + hint parseText (localize 'STR_WF_INFO_Gear_AllowTwo'); + }; + }; + }; + + //--- Loadout Cost. + ctrlSetText[3850,Format[localize 'STR_WF_GEAR_Cost',_cost]]; + //--- Player's Cash. + //ctrlSetText[3851,Format["%1 $ %2.",localize 'STR_WF_GEAR_CashLabel',Call GetPlayerFunds]]; + ctrlSetText[3851,Format["$%1",Call GetPlayerFunds]]; //---changed-MrNiceGuy + + _lastFiller = _filler; + sleep 0.05; + + //--- Back Button. + if (MenuAction == 1) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; + +//--- Variables destruction. +WF_Logic setVariable ['lbChange',nil]; +WF_Logic setVariable ['lbMainAction',nil]; +WF_Logic setVariable ['InventoryClick',nil]; +WF_Gear_Hotkeys = nil; +primClicked = nil; +secoClicked = nil; +sideClicked = nil; +buyLoadout = nil; +saveLoadout = nil; +deleteLoadout = nil; + +(findDisplay 16000) displayRemoveEventHandler ['KeyDown',_disp]; \ No newline at end of file diff --git a/Client/GUI/GUI_Menu.sqf b/Client/GUI/GUI_Menu.sqf new file mode 100644 index 0000000..c21ad4a --- /dev/null +++ b/Client/GUI/GUI_Menu.sqf @@ -0,0 +1,161 @@ + +private ["_enable","_exited","_skip","_voteTime","_timer"]; +MenuAction = -1; +_exited = false; +_timer = 3; + +WFBE_ForceUpdate = true; + +while {alive player && dialog} do { + //--- Build Units. + _enable = false; + if (barracksInRange || lightInRange || heavyInRange || aircraftInRange || hangarInRange || depotInRange) then {_enable = true}; + ctrlEnable [11001,_enable]; + ctrlEnable [11002,gearInRange]; + + _timer = _timer + 0.1; + + sleep 0.1; + + if (Side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog || _exited) exitWith {}; + + //--- Buy Units. + if (MenuAction == 1) then { + MenuAction = -1; + closeDialog 0; + createDialog "RscMenu_BuyUnits"; + _exited = true; + }; + + //--- Buy Gear. + if (MenuAction == 2) then { + MenuAction = -1; + CloseDialog 0; + CreateDialog "RscAceGear"; + _exited = true; + }; + + //--- Team Menu. + if (MenuAction == 3) then { + MenuAction = -1; + closeDialog 0; + createDialog "RscMenu_Team"; + _exited = true; + }; + + //--- Voting Menu. + if (MenuAction == 4) then { + MenuAction = -1; + _skip = false; + _voteTime = WF_Logic getVariable Format["%1CommanderVoteTime",sideJoinedText]; + if (_voteTime <= 0) then {_skip = true}; + if (!_skip) then { + CloseDialog 0; + CreateDialog "RscMenu_Voting"; + if !(_skip) exitWith {}; + }; + WFBE_RequestCommanderVote = ['SRVFNCREQUESTCOMMANDERVOTE',sideJoined]; + publicVariable 'WFBE_RequestCommanderVote'; + if (isHostedServer) then {['SRVFNCREQUESTCOMMANDERVOTE',sideJoined] Spawn HandleSPVF}; + voted = true; + waitUntil {((WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText])>0) || !dialog || !alive player}; + if (!alive player || !dialog) exitWith {_exited = true}; + closeDialog 0; + createDialog "RscMenu_Voting"; + _exited = true; + }; + + //--- Unflip Vehicle. + if (MenuAction == 10) then { //added-MrNiceGuy + MenuAction = -1; + _vehicle = vehicle player; + if (player != _vehicle) then { + if (getPos _vehicle select 2 > 3 && !surfaceIsWater (getPos _x)) then { + [_vehicle, getPos _vehicle, 15] Call PlaceSafe; + } else { + _vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 0.5]; + _vehicle setVelocity [0,0,-0.5]; + }; + }; + if (player == _vehicle) then { + _objects = player nearEntities[["Car","Motorcycle","Tank"],10]; + if (count _objects > 0) then { + { + if (getPos _x select 2 > 3 && !surfaceIsWater (getPos _x)) then { + [_x, getPos _x, 15] Call PlaceSafe; + } else { + _x setPos [getPos _x select 0, getPos _x select 1, 0.5]; + _x setVelocity [0,0,-0.5]; + }; + } forEach _objects; + }; + }; + }; + + //--- Headbug Fix. + if (MenuAction == 11) then { //added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + titleCut["","BLACK FADED",0]; + _pos = position player; + _vehi = "Lada1" createVehicle [0,0,0]; + player moveInCargo _vehi; + deleteVehicle _vehi; + player setPos _pos; + titleCut["","BLACK IN",5]; + }; + + //--- Display Parameters. + if (MenuAction == 12) exitWith { //added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "RscDisplay_Parameters"; + }; + + //--- Uptime. + _uptime = Call GetTime; //added-MrNiceGuy + ctrlSetText [11015,Format[localize 'STR_WF_MAIN_Uptime',_uptime select 0,_uptime select 1,_uptime select 2, _uptime select 3]]; + + _enable = false; //added-MrNiceGuy + if (!isNull(commanderTeam)) then {if (commanderTeam == group player) then {_enable = true}}; + ctrlEnable [11005,_enable]; //--- Team Orders + ctrlEnable [11008,_enable]; //--- Commander Menu + ctrlEnable [11006,commandInRange]; //--- Special Menu + ctrlEnable [11007,commandInRange]; //--- Upgrade Menu + + //--- Command Menu. + if (MenuAction == 5) exitWith { //added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "RscMenu_Command"; + }; + + //--- Tactical Menu. + if (MenuAction == 6) exitWith { //added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "RscMenu_Tactical"; + }; + + //--- Upgrade Menu. + if (MenuAction == 7) exitWith { //added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "RscMenu_Upgrade"; + }; + + //--- Economy Menu. + if (MenuAction == 8) exitWith { //added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "RscMenu_Economy"; + }; + + //--- Service Menu. + if (MenuAction == 9) exitWith { //added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "RscMenu_Service"; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Menu_BuyUnits.sqf b/Client/GUI/GUI_Menu_BuyUnits.sqf new file mode 100644 index 0000000..75e367f --- /dev/null +++ b/Client/GUI/GUI_Menu_BuyUnits.sqf @@ -0,0 +1,466 @@ +disableSerialization; + +//--- Init. +MenuAction = -1; + +_listUnits = []; + +_closest = objNull; +_commander = false; +_extracrew = false; +_countAlive = 0; +_currentCost = 0; +_currentIDC = 0; +_disabledColor = [0.7961, 0.8000, 0.7961, 1]; +_display = _this select 0; +_driver = false; +_enabledColor = [0, 1, 0, 1]; +_enabledColor2 = [1, 0, 0, 1]; //---NEW (LOCK) +_gunner = false; +_IDCLock = 12023; +_IDCS = [12005,12006,12007,12008,12020,12021]; +_IDCSVehi = [12012,12013,12014,12041]; +_isInfantry = false; +_isLocked = true; +_lastCheck = 0; +_lastSel = -1; +_lastType = 'nil'; +_listBox = 12001; +_comboFaction = 12026; +_map = _display displayCtrl 12015; +_sorted = []; +_type = 'nil'; +_update = true; +_updateDetails = true; +_updateList = true; +_updateMap = true; +_val = 0; +_mbu = 'WFBE_MAXGROUPSIZE' Call GetNamespace; + +ctrlSetText[12025,localize 'STR_WF_UNITS_FactionChoiceLabel' + ":"]; // changed-MrNiceGuy + +//--- Get the closest Factory Type in range. +_break = false; +_status = [barracksInRange,lightInRange,heavyInRange,aircraftInRange,depotInRange,hangarInRange]; +_statusLabel = ['Barracks','Light','Heavy','Aircraft','Depot','Airport']; +_statusVals = [0,1,2,3,4,3]; +for [{_i = 0},{(_i < 6) && !_break},{_i = _i + 1}] do { + if (_status select _i) then { + _break = true; + _currentIDC = _IDCS select _i; + _type = _statusLabel select _i; + _val = _statusVals select _i; + }; +}; + +if (_type == 'nil') exitWith {closeDialog 0}; + +//--- Destroy local variables. +_break = nil; +_status = nil; +_statusLabel = nil; +_statusVals = nil; + +//--- Enable the current IDC. +_IDCS = _IDCS - [_currentIDC]; +{ + _con = _display DisplayCtrl _x; + _con ctrlSetTextColor [0.4, 0.4, 0.4, 1]; +} forEach _IDCS; + +//--- Loop. +while {alive player && dialog} do { + //--- Nothing in range? exit!. + if (!barracksInRange && !lightInRange && !heavyInRange && !aircraftInRange && !hangarInRange && !depotInRange) exitWith {closeDialog 0}; + if (side player != sideJoined || !dialog) exitWith {closeDialog 0}; + + //--- Purchase. + if (MenuAction == 1) then { + MenuAction = -1; + _currentRow = lnbCurSelRow _listBox; + _currentValue = lnbValue[_listBox,[_currentRow,0]]; + _unit = _listUnits select _currentValue; + _currentUnit = _unit Call GetNamespace; + _currentCost = _currentUnit select QUERYUNITPRICE; + _cpt = 1; + _isInfantry = if (_unit isKindOf 'Man') then {true} else {false}; + if !(_isInfantry) then { + _extra = 0; + if (_driver) then {_extra = _extra + 1}; + if (_gunner) then {_extra = _extra + 1}; + if (_commander) then {_extra = _extra + 1}; + if (_extracrew) then {_extra = _extra + ((_currentUnit select QUERYUNITCREW) select 3)}; + _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra); + }; + if ((_currentRow) != -1) then { + _funds = Call GetPlayerFunds; + _skip = false; + if (_funds < _currentCost) then {_skip = true;hint parseText(Format[localize 'STR_WF_INFO_Funds_Missing',_currentCost - _funds,_currentUnit select QUERYUNITLABEL])}; + //--- Make sure that we own all camps before being able to purchase infantry. + if (_type == "Depot" && _isInfantry) then { + _totalCamps = _closest Call GetTotalCamps; + _campsSide = [_closest,sideJoined] Call GetTotalCampsOnSide; + if (_totalCamps != _campsSide) then {_skip = true; hint parseText(localize 'STR_WF_INFO_Camps_Purchase')}; + }; + if !(_skip) then { + _size = Count ((Units (group player)) Call GetLiveUnits); + //--- Get the infantry limit based off the infantry upgrade. + _realSize = ((sideJoined) Call GetSideUpgrades) select 0; + switch (_realSize) do { + case 0: {_realSize = round(_mbu / 4)}; + case 1: {_realSize = round(_mbu / 4)*2}; + case 2: {_realSize = round(_mbu / 4)*3}; + case 3: {_realSize = _mbu}; + default {_realSize = _mbu}; + }; + if (_isInfantry) then {if ((unitQueu + _size + 1) > _realSize) then {_skip = true;hint parseText(Format [localize 'STR_WF_INFO_MaxGroup',_realSize])}}; + + if (!_isInfantry && !_skip) then { + _cpt = 0; + if (_driver) then {_cpt = _cpt + 1}; + if (_gunner) then {_cpt = _cpt + 1}; + if (_commander) then {_cpt = _cpt + 1}; + if (_extracrew) then {_cpt = _cpt + ((_currentUnit select QUERYUNITCREW) select 3)}; + if ((unitQueu + _size + _cpt) > _realSize && _cpt != 0) then {_skip = true;hint parseText(Format [localize 'STR_WF_INFO_MaxGroup',_realSize])}; + }; + }; + if !(_skip) then { + //--- Check the max queu. + if ((Format["WFBE_C_QUEUE_%1",_type] Call GetNamespace) < (Format["WFBE_C_QUEUE_%1_MAX",_type] Call GetNamespace)) then { + [Format["WFBE_C_QUEUE_%1",_type],(Format["WFBE_C_QUEUE_%1",_type] Call GetNamespace)+1,true] Call SetNamespace; + + _queu = _closest getVariable 'queu'; + _txt = parseText(Format [localize 'STR_WF_INFO_BuyEffective',_currentUnit select QUERYUNITLABEL]); + if (!isNil '_queu') then {if (count _queu > 0) then {_txt = parseText(Format [localize 'STR_WF_INFO_Queu',_currentUnit select QUERYUNITLABEL])}}; + hint _txt; + _params = if (_isInfantry) then {[_closest,_unit,[],_type,_cpt]} else {[_closest,_unit,[_driver,_gunner,_commander,_extracrew,_isLocked],_type,_cpt]}; + _params Spawn BuildUnit; + -(_currentCost) Call ChangePlayerFunds; + } else { + hint parseText(Format [localize 'STR_WF_INFO_Queu_Max',Format["WFBE_C_QUEUE_%1_MAX",_type] Call GetNamespace]); + }; + }; + }; + }; + + //--- Tabs selection. + if (MenuAction == 101) then {MenuAction = -1;if (barracksInRange) then {_currentIDC = 12005;_type = 'Barracks';_val = 0;_update = true}}; + if (MenuAction == 102) then {MenuAction = -1;if (lightInRange) then {_currentIDC = 12006;_type = 'Light';_val = 1;_update = true}}; + if (MenuAction == 103) then {MenuAction = -1;if (heavyInRange) then {_currentIDC = 12007;_type = 'Heavy';_val = 2;_update = true}}; + if (MenuAction == 104) then {MenuAction = -1;if (aircraftInRange) then {_currentIDC = 12008;_type = 'Aircraft';_val = 3;_update = true}}; + if (MenuAction == 105) then {MenuAction = -1;if (depotInRange) then {_currentIDC = 12020;_type = 'Depot';_val = 4;_update = true}}; + if (MenuAction == 106) then {MenuAction = -1;if (hangarInRange) then {_currentIDC = 12021;_type = 'Airport';_val = 3;_update = true}}; + + //--- driver-gunner-commander icons. + if (MenuAction == 201) then {MenuAction = -1;_driver = if (_driver) then {false} else {true};_updateDetails = true}; + if (MenuAction == 202) then {MenuAction = -1;_gunner = if (_gunner) then {false} else {true};_updateDetails = true}; + if (MenuAction == 203) then {MenuAction = -1;_commander = if (_commander) then {false} else {true};_updateDetails = true}; + if (MenuAction == 204) then {MenuAction = -1;_extracrew = if (_extracrew) then {false} else {true};_updateDetails = true}; + + //--- Factory DropDown list value has changed. + if (MenuAction == 301) then {MenuAction = -1;_factSel = lbCurSel 12018;_closest = _sorted select _factSel;_updateMap = true}; + + //--- Selection change, we update the details. + if (MenuAction == 302) then {MenuAction = -1;_updateDetails = true}; + + //--- Faction Filter changed. + if (MenuAction == 303) then {MenuAction = -1;_update = true;[Format["WFBE_%1%2CURRENTFACTIONSELECTED",sideJoinedText,_type],(lbCurSel _comboFaction),true] Call SetNamespace}; + + //--- Lock icon. + if (MenuAction == 401) then {MenuAction = -1;_isLocked = if (_isLocked) then {false} else {true};_updateDetails = true}; + + //--- Player funds. + ctrlSetText [12019,Format [localize 'STR_WF_UNITS_Cash',Call GetPlayerFunds]]; + + //--- Update tabs. + if (_update) then { + _listUnits = Format ['WFBE_%1%2UNITS',sideJoinedText,_type] Call GetNamespace; + + [_comboFaction,_type] Call UIChangeComboBuyUnits; + [_listUnits,_type,_listBox,_val] Call UIFillListBuyUnits; + + //--- Update tabs icons. + _IDCS = [12005,12006,12007,12008,12020,12021]; + _IDCS = _IDCS - [_currentIDC]; + _con = _display DisplayCtrl _currentIDC; + _con ctrlSetTextColor [1, 1, 1, 1]; + {_con = _display DisplayCtrl _x;_con ctrlSetTextColor [0.4, 0.4, 0.4, 1]} forEach _IDCS; + + _update = false; + _updateList = true; + _updateDetails = true; + }; + + //--- Update factories. + if (_updateList) then { + switch (_type) do { + //--- Specials. + case 'Depot': { + _nObjects = nearestObjects [(vehicle player), WFDEPOT,('WFBE_TOWNPURCHASERANGE' Call GetNamespace)]; + _closest = if (count _nObjects > 0) then {_nObjects select 0} else {objNull}; + _sorted = [_closest]; + }; + case 'Airport': { + _sorted = [(vehicle player),Airfields] Call SortByDistance; + _closest = _sorted select 0; + _sorted = [_closest]; + }; + //--- Factories + default { + _buildings = (sideJoinedText) Call GetSideStructures; + _factories = [sideJoined,Format ['WFBE_%1%2TYPE',sideJoinedText,_type] Call GetNamespace,_buildings] Call GetFactories; + _sorted = [(vehicle player),_factories] Call SortByDistance; + _closest = _sorted select 0; + _countAlive = count _factories; + }; + }; + + //--- Refresh the Factory DropDown list. + lbClear 12018; + { + _nearest = [_x,towns] Call SortByDistance; + _nearTown = (_nearest select 0) getVariable 'name'; + _txt = _type + ' ' + _nearTown + ' ' + str (round((vehicle player) distance _x)) + 'M'; + lbAdd[12018,_txt]; + } forEach _sorted; + lbSetCurSel [12018,0]; + + _updateList = false; + _updateMap = true; + }; + + //--- Display Factory Queu. + _queu = _closest getVariable "queu"; + _value = if (isNil '_queu') then {0} else {count (_closest getVariable "queu")}; + ctrlSetText[12024,Format[localize 'STR_WF_UNITS_QueuedLabel',str _value]]; + + //--- List selection changed. + if (_updateDetails) then { + _currentRow = lnbCurSelRow _listBox; + //--- Our list is not empty. + if (_currentRow != -1) then { + _currentValue = lnbValue[_listBox,[_currentRow,0]]; + _unit = _listUnits select _currentValue; + _currentUnit = _unit Call GetNamespace; + ctrlSetText [12009,_currentUnit select QUERYUNITPICTURE]; + ctrlSetText [12033,_currentUnit select QUERYUNITFACTION]; + ctrlSetText [12035,str (_currentUnit select QUERYUNITTIME)]; + _currentCost = _currentUnit select QUERYUNITPRICE; + + _isInfantry = if (_unit isKindOf 'Man') then {true} else {false}; + + //--- Update driver-gunner-commander icons. + if !(_isInfantry) then { + ctrlSetText [12036,"N/A"]; + ctrlSetText [12037,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'transportSoldier'))]; + ctrlSetText [12038,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'maxSpeed'))]; + ctrlSetText [12039,str (getNumber (configFile >> 'CfgVehicles' >> _unit >> 'armor'))]; + if (_type != 'Depot') then { + _slots = _currentUnit select QUERYUNITCREW; + + if (typeName _slots == "ARRAY") then { + _hasCommander = _slots select 0; + _hasGunner = _slots select 1; + _turretsCount = _slots select 3; + _extra = 0; + + _maxOut = false; + if (_lastType != _type || _lastSel != _currentRow) then {_maxOut = true}; + + if (_maxOut) then { + _driver = true; + _gunner = true; + _commander = true; + _extracrew = false; + }; + + if !(_hasGunner) then {_gunner = false}; + + if !(_hasCommander) then {_commander = false}; + + if (_turretsCount == 0) then {_extracrew = false}; + + ctrlShow[_IDCSVehi select 0, true]; + ctrlShow[_IDCSVehi select 1, _hasGunner]; + ctrlShow[_IDCSVehi select 2, _hasCommander]; + ctrlShow[_IDCSVehi select 3, if (_turretsCount == 0) then {false} else {true}]; + + _c = 0; + { + _color = if (_x) then {_enabledColor} else {_disabledColor}; + _con = _display displayCtrl (_IDCSVehi select _c); + _con ctrlSetTextColor _color; + + _c = _c + 1; + } forEach [_driver,_gunner,_commander,_extracrew]; + + if (_driver) then {_extra = _extra + 1}; + if (_gunner) then {_extra = _extra + 1}; + if (_commander) then {_extra = _extra + 1}; + if (_extracrew) then {_extra = _extra + _turretsCount}; + + //--- Set the 'extra' price. + _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra); + } else {//--- Backward compability. + _c = 0; + _extra = 0; + + //--- Enabled AI by default. + _extracrew = false; + _maxOut = false; + if (_lastType != _type || _lastSel != _currentRow) then {_maxOut = true}; + + switch (_slots) do { + case 1: { + if (_maxOut) then {_driver = true}; + if (_driver) then {_extra = _extra + 1}; + _gunner = false; + _commander = false; + }; + case 2: { + if (_maxOut) then {_driver = true;_gunner = true}; + if (_driver) then {_extra = _extra + 1}; + if (_gunner) then {_extra = _extra + 1}; + _commander = false; + }; + case 3: { + if (_maxOut) then {_driver = true;_gunner = true;_commander = true}; + if (_driver) then {_extra = _extra + 1}; + if (_gunner) then {_extra = _extra + 1}; + if (_commander) then {_extra = _extra + 1}; + }; + }; + + //--- Show the icons. + { + _show = false; + if (_c < _slots) then {_show = true}; + ctrlShow [_x,_show]; + _c = _c + 1; + } forEach _IDCSVehi; + + //--- Mask extra crew. + ctrlShow[_IDCSVehi select 3, false]; + + _i = 0; + + //--- Set the icons. + { + _color = if (_x) then {_enabledColor} else {_disabledColor}; + _con = _display displayCtrl (_IDCSVehi select _i); + _con ctrlSetTextColor _color; + _i = _i + 1; + } forEach [_driver,_gunner,_commander,_extracrew]; + + //--- Set the 'extra' price. + _currentCost = _currentCost + (('WFBE_CREWCOST' Call GetNamespace) * _extra); + }; + } else { + {ctrlShow [_x,false]} forEach (_IDCSVehi); + _driver = false; + _gunner = false; + _commander = false; + _extracrew = false; + }; + } else { + ctrlSetText [12036,Format ["%1/100",(_currentUnit select QUERYUNITSKILL) * 100]]; + ctrlSetText [12037,"N/A"]; + ctrlSetText [12038,"N/A"]; + ctrlSetText [12039,"N/A"]; + + {ctrlShow [_x,false]} forEach (_IDCSVehi); + _driver = false; + _gunner = false; + _commander = false; + _extracrew = false; + + //--- Display a unit's loadout. + _weapons = (getArray (configFile >> 'CfgVehicles' >> _unit >> 'weapons')) - ['Put','Throw']; + _magazines = getArray (configFile >> 'CfgVehicles' >> _unit >> 'magazines'); + + _classMags = []; + _classMagsAmount = []; + _MagsLabel = []; + + { + _findAt = _classMags find _x; + if (_findAt == -1) then { + _classMags = _classMags + [_x]; + _classMagsAmount = _classMagsAmount + [1]; + _MagsLabel = _MagsLabel + [[_x,'displayName','CfgMagazines'] Call GetConfigInfo]; + } else { + _classMagsAmount set [_findAt, (_classMagsAmount select _findAt) + 1]; + }; + } forEach _magazines; + _txt = "" + (localize 'STR_WF_UNITS_Weapons') + ":
"; + for [{_i = 0},{_i < count _weapons},{_i = _i + 1}] do { + _txt = _txt + "" + ([(_weapons select _i),'displayName','CfgWeapons'] Call GetConfigInfo) + ""; + if ((_i+1) < count _weapons) then {_txt = _txt + ", "}; + }; + _txt = _txt + "

"; + _txt = _txt + "" + (localize 'STR_WF_UNITS_Magazines') + ":
"; + for [{_i = 0},{_i < count _MagsLabel},{_i = _i + 1}] do { + _txt = _txt + "" + ((_MagsLabel select _i) + " x" + str (_classMagsAmount select _i)) + ""; + if ((_i+1) < count _MagsLabel) then {_txt = _txt + ", "}; + }; + _txt = _txt + ""; + + (_display displayCtrl 12022) ctrlSetStructuredText (parseText _txt); + }; + + //--- Lock Icon. + if !(_isInfantry) then { + ctrlShow[_IDCLock,true]; + _color = if (_isLocked) then {_enabledColor2} else {_disabledColor}; + _con = _display displayCtrl _IDCLock; + _con ctrlSetTextColor _color; + } else { + ctrlShow[_IDCLock,false]; + }; + + //--- Long description. + if !(_isInfantry) then { + if (isClass (configFile >> 'CfgVehicles' >> _unit >> 'Library')) then { + _txt = getText (configFile >> 'CfgVehicles' >> _unit >> 'Library' >> 'libTextDesc'); + (_display displayCtrl 12022) ctrlSetStructuredText (parseText _txt); + } else { + (_display displayCtrl 12022) ctrlSetStructuredText (parseText ''); + }; + }; + + ctrlSetText [12034,Format ["$ %1",_currentCost]]; + _updateDetails = false; + } else { + {ctrlSetText [_x , ""]} forEach [12009,12010,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037,12038,12039]; + (_display displayCtrl 12022) ctrlSetStructuredText (parseText ''); + }; + }; + + //--- Update the Factory Minimap position. + if (_updateMap) then { + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [2,.075,getPos _closest]; + ctrlMapAnimCommit _map; + _updateMap = false; + }; + + //--- Check that the factories of the current type are still alive. + _lastCheck = _lastCheck + 0.1; + if (_lastCheck > 2 && _type != 'Depot' && _type != 'Airport') then { + _lastCheck = 0; + _buildings = (sideJoinedText) Call GetSideStructures; + _factories = [sideJoined,Format ['WFBE_%1%2TYPE',sideJoinedText,_type] Call GetNamespace,_buildings] Call GetFactories; + if (count _factories != _countAlive) then {_updateList = true}; + }; + + _lastSel = lnbCurSelRow _listBox; + _lastType = _type; + sleep 0.1; + + //--- Back Button. + if (MenuAction == 2) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Menu_Command.sqf b/Client/GUI/GUI_Menu_Command.sqf new file mode 100644 index 0000000..a85003b --- /dev/null +++ b/Client/GUI/GUI_Menu_Command.sqf @@ -0,0 +1,532 @@ +disableSerialization; + +MenuAction = -1; +mouseButtonUp = -1; +_display = _this select 0; + +//--- Alt. +_mode = 0; //--- Team properties. + +_updateProperties = true; +_updateRespawn = true; +_updateTab = true; + +_IDCTeam = [14009,14010,14016,14017,14018,14019,14020,14021,14022,14023,14024,14025,14026,14027,14030,14031,14901,14902]; +_IDCTasks = [14017,14018,14021,14022,14030,14032]; +_IDCDetails = [14030,14041,14042,14043]; +{ctrlShow[_x,false]} forEach (_IDCTasks + _IDCDetails); +{ctrlShow[_x,true]} forEach _IDCTeam; +_TaskTypes = ["Assist","Attack","Defend","Destroy","Guard","Hold","Patrol","Move","Search and Destroy","Seize","Support"]; +_TaskDuration = [1,2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60]; +_TaskDurationLabel = ["1 Min","2 Min","3 Min","4 Min","5 Min","6 Min","7 Min","8 Min","9 Min","10 Min","15 Min","20 Min","25 Min","30 Min","35 Min","40 Min","45 Min","50 Min","55 Min","60 Min"]; +_detailGroup = []; + +ctrlSetText [14026,localize "STR_WF_COMMAND_Respawn" + ":"]; + +_listbox_teams = _display displayCtrl 14012; +_u = 1; +lbAdd[14012,localize "STR_WF_COMMAND_All"]; +{lbAdd [14012,Format["[%1] %2",_u,name (leader _x)]];_u = _u + 1} forEach clientTeams; +lbSetCurSel [14012,1]; + +_radioLabel = ["All","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-Ray","Yankee","Zulu","Razor","Fatman","StarForce","Frostbite","Battlemage","Manhattan","Firefly","Swordsman","Sabre","Hammer","Reaper","Anvil","Fortune"]; + +_templates = Format["WFBE_%1AITEAMTEMPLATEDESCRIPTIONS",sideJoinedText] Call GetNamespace; +_templates_upgrades = Format["WFBE_%1AITEAMUPGRADES",sideJoinedText] Call GetNamespace; +_upgrades = (sideJoined) Call GetSideUpgrades; +_u = 0; +_i = 0; +{ + _temp_upgr = _templates_upgrades select _i; + + _canAdd = true; + for '_k' from 0 to 3 do { + if ((_temp_upgr select _k) > (_upgrades select _k)) exitWith {_canAdd = false}; + }; + + if (_canAdd) then { + lbAdd [14010,_x]; + lbSetValue [14010, _u, _i]; + _u = _u + 1; + }; + _i = _i + 1; +} forEach _templates; +lbSort (_display displayCtrl 14010); + +_curSel = lbCurSel 14012; +_teams = []; +_team = if (_curSel != 0) then {clientTeams select (_curSel - 1)} else {clientTeams select (_curSel + 1)}; + +_index = (_team) Call GetTeamType; +if (_index == -1) then {_index = 1}; +lbSetCurSel [14010,[14010,_index] Call UIFindLBValue]; + +_txt = (_team) Call GetTeamMoveMode; +if (_txt == "" || _txt == "towns") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_TakeTowns"}; +if (_txt == "move") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Move"}; +if (_txt == "patrol") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Patrol"}; +if (_txt == "defense") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Defense"}; +ctrlSetText [14013,_txt]; + +_map = _display displayCtrl 14002; +//_map ctrlMapAnimAdd [1,.075,getPos (leader(clientTeams select 0))]; +//ctrlMapAnimCommit _map; + +ctrlEnable [14015,false]; +ctrlEnable [14014,false]; + +//--- Set the combo properties. +_behaviors = ["AWARE","CARELESS","COMBAT","SAFE","STEALTH"]; +_combatModes = ["BLUE","GREEN","RED","WHITE","YELLOW"]; +_formations = ["COLUMN","DIAMOND","ECH LEFT","ECH RIGHT","FILE","LINE","STAG COLUMN","VEE","WEDGE"]; +_speeds = ["LIMITED","FULL","NORMAL"]; + +{lbAdd [14017, _x]} forEach _behaviors; +{lbAdd [14018, _x]} forEach _combatModes; +{lbAdd [14019, _x]} forEach _formations; +{lbAdd [14020, _x]} forEach _speeds; + +_structures = [""]; +_hq = (sideJoinedText) Call GetSideHQ; +if (alive _hq) then {_structures = _structures + [_hq]}; +_structures = _structures + ((sideJoinedText) Call GetSideStructures); +_structuresLbl = ["Default"]; +lbAdd[14025,"Default"]; + +{ + if (typeName _x == "OBJECT") then { + _nearest = [_x,towns] Call SortByDistance; + _nearTown = (_nearest select 0) getVariable 'name'; + _type = [typeOf _x, 'displayName'] Call GetConfigInfo; + _lbl = _type + ' ' + _nearTown + ' ' + str (round(player distance _x)) + 'M'; + _structuresLbl = _structuresLbl + [_lbl]; + lbAdd[14025,_lbl]; + }; +} forEach _structures; + +while {alive player && dialog} do { + sleep 0.1; + if (side player != sideJoined) exitWith {activeAnimMarker = false;closeDialog 0}; + if (!dialog) exitWith {activeAnimMarker = false}; + + if (MenuAction == 601) then {if (_mode != 0) then {_updateTab = true};_mode = 0};//--- Team properties. + if (MenuAction == 602) then {if (_mode != 1) then {_updateTab = true};_mode = 1};//--- Task. + if (MenuAction == 603) then {if (_mode != 2) then {_updateTab = true};_mode = 2};//--- Task. + + _curSel = lbCurSel 14012; + _isAll = if (_curSel == 0 || (0 in _teams)) then {true} else {false}; + _team = if !(_isAll) then {clientTeams select (_curSel - 1)} else {clientTeams select (_curSel + 1)}; + _teams = lbSelection _listbox_teams; + + if (_updateTab) then { + _currentIDC = 0; + switch (_mode) do { + case 0: { + {ctrlShow[_x,false]} forEach (_IDCDetails + _IDCTasks); + {ctrlShow[_x,true]} forEach _IDCTeam; + ctrlSetText[14021,localize "STR_WF_COMMAND_Behavior"]; + ctrlSetText[14022,localize "STR_WF_COMMAND_CombatMode"]; + ctrlSetText[14030,localize "STR_WF_COMMAND_SquadSettingsLabel"]; + lbClear 14017; + lbClear 14018; + {lbAdd [14017, _x]} forEach _behaviors; + {lbAdd [14018, _x]} forEach _combatModes; + _updateProperties = true; + _currentIDC = 14500; + }; + case 1: { + {ctrlShow[_x,false]} forEach (_IDCDetails + _IDCTeam); + {ctrlShow[_x,true]} forEach _IDCTasks; + lbClear 14017; + lbClear 14018; + {lbAdd [14017, _x]} forEach _TaskTypes; + {lbAdd [14018, _x]} forEach _TaskDurationLabel; + ctrlSetText[14021,localize "STR_WF_COMMAND_TaskTO_Do" + ":"]; + ctrlSetText[14022,localize "STR_WF_COMMAND_TaskTO_Time" + ":"]; + ctrlSetText[14030,localize "STR_WF_COMMAND_Tasks"]; + lbSetCurSel[14017,0]; + lbSetCurSel[14018,0]; + _currentIDC = 14501; + }; + case 2: { + {ctrlShow[_x,false]} forEach (_IDCTasks + _IDCTeam); + {ctrlShow[_x,true]} forEach _IDCDetails; + ctrlSetText[14030,localize "STR_WF_COMMAND_SquadManagmentLabel"]; + _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]}; + [_detailGroup,14041] Call UIFillListTeamOrders; + _enable = if !(isPlayer leader _team) then {true} else {false}; + ctrlEnable [14043,_enable]; + _enable = if !(isPlayer (vehicle leader _team) && vehicle leader _team != leader _team) then {true} else {false}; + ctrlEnable [14042,_enable]; + _currentIDC = 14502; + }; + }; + _hidc = [14500,14502,14501]; + _hidc = _hidc - [_currentIDC]; + _con = _display DisplayCtrl _currentIDC; + _con ctrlSetTextColor [1, 1, 1, 1]; + {_con = _display DisplayCtrl _x;_con ctrlSetTextColor [0.4, 0.4, 0.4, 1]} forEach _hidc; + _updateTab = false; + }; + + _txt = (_team) Call GetTeamMoveMode; + if (_txt == "" || _txt == "towns") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_TakeTowns"}; + if (_txt == "move") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Move"}; + if (_txt == "patrol") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Patrol"}; + if (_txt == "defense") then {_txt = localize "STR_WF_COMMAND_Mission" + ": " + localize "STR_WF_COMMAND_Defense"}; + ctrlSetText [14013,_txt]; + + //--- Team Funds. + ctrlSetText [14028,Format [localize 'STR_WF_COMMAND_Cash',str ((_team) Call GetTeamFunds)]]; + + if (MenuAction == 1) then { + MenuAction = -1; + activeAnimMarker = false; + + _index = (_team) Call GetTeamType; + _currentCoord = (_team) Call GetTeamMovePos; + _currentMission = (_team) Call GetTeamMoveMode; + if (typeName _currentCoord == "ARRAY") then { + if (count _currentCoord > 0) then { + _position = _currentCoord; + if (_currentMission == "move") then {["TempAnim",_position,"selector_selectedMission",1,"ColorOrange",1,1.2] Spawn MarkerAnim}; + if (_currentMission == "patrol") then {["TempAnim",_position,"selector_selectedMission",1,"ColorYellow",1,1.2,"areaPatrol"] Spawn MarkerAnim}; + if (_currentMission == "defense") then {["TempAnim",_position,"selector_selectedMission",1,"ColorRed",1,1.2] Spawn MarkerAnim}; + }; + }; + if (typeName _currentCoord == "OBJECT") then { + if (_currentMission == "towns") then {["TempAnim",getPos _currentCoord,"selector_selectedMission",1,"ColorBlue",1,1.2] Spawn MarkerAnim}; + }; + + _enable = if (isPlayer(leader _team)) then {false} else {true}; + _special = if (_isAll) then {false} else {if !(isPlayer(leader _team)) then {true} else {false}}; + ctrlEnable [14011,_special]; + ctrlEnable [14014,_enable]; + ctrlEnable [14015,_enable]; + + if (_enable) then { + _isDisabled = (_team) Call GetTeamAutonomous; + if (_isDisabled) then { + ctrlEnable [14014,true]; + ctrlEnable [14015,false]; + } else { + ctrlEnable [14015,true]; + ctrlEnable [14014,false]; + }; + }; + if (_index == -1) then {_index = 1}; + lbSetCurSel [14010,[14010,_index] Call UIFindLBValue]; + if (_mode == 0) then { + _updateProperties = true; + _updateRespawn = true; + }; + if (_mode == 2) then { + _detailGroup = if !(_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]}; + [_detailGroup,14041] Call UIFillListTeamOrders; + _enable = if !(isPlayer leader _team) then {true} else {false}; + ctrlEnable [14043,_enable]; + }; + }; + + //--- Focus. + if (MenuAction == 2) then { + MenuAction = -1; + + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [2,.075,getPos(leader _team)]; + ctrlMapAnimCommit _map; + }; + + //--- Focus (AI Sub). + if (MenuAction == 3) then { + MenuAction = -1; + _iddx = lnbCurSelRow 14041; + if (_iddx != -1) then { + _map ctrlMapAnimAdd [1,.095,getPos (_detailGroup select _iddx)]; + ctrlMapAnimCommit _map; + }; + }; + + //--- Take Towns. + if (MenuAction == 101) then { + MenuAction = -1; + if (!_isAll) then { + [_team,'towns'] Call SetTeamMoveMode; + } else { + {[_x,'towns'] Call SetTeamMoveMode} forEach clientTeams; + }; + activeAnimMarker = false; + }; + + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + //--- Move | Patrol | Defend. + if (MenuAction == 102 || MenuAction == 103 || MenuAction == 104) then { + _color = ""; + _order = ""; + _isAdded = ""; + switch (MenuAction) do { + case 102: {_color = "ColorOrange";_order = "MOVE"}; + case 103: {_color = "ColorYellow";_order = "PATROL";_isAdded = "areaPatrol"}; + case 104: {_color = "ColorRed";_order = "DEFENSE"}; + }; + MenuAction = -1; + _position = _map posScreenToWorld[mouseX,mouseY]; + + [_curSel,_position,_order,_isAll,_teams] Spawn { + Private ["_curSel","_isAll","_order","_position","_radio","_radioLabel","_sideTeam","_teams"]; + _curSel = _this select 0; + _position = _this select 1; + _order = _this select 2; + _isAll = _this select 3; + _teams = _this select 4; + //_radio = ["all","alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa","quebec","romeo","sierra","tango","uniform","victor","whiskey","xray","yankee","zulu"]; + _radioLabel = ["All","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-Ray","Yankee","Zulu","Razor","Fatman","StarForce","Frostbite","Battlemage","Manhattan","Firefly","Swordsman","Sabre","Hammer","Reaper","Anvil","Fortune"]; + + if (!_isAll) then { + _sideTeam = "Team "; + for '_i' from 0 to count _teams-1 do { + _selected = clientTeams select ((_teams select _i) - 1); + _sideTeam = _sideTeam + (_radioLabel select (_teams select _i)); + if (_i != count _teams -1) then {_sideTeam = _sideTeam + ", "} else {_sideTeam = _sideTeam + " "}; + }; + + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSent",["1","",_sideTeam,[if (sideJoined == west) then {"blueTeam"} else {"redTeam"}]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true]; + { + _selected = clientTeams select (_x - 1); + [_selected,_position] Call SetTeamMovePos; + [_selected,_order] Call SetTeamMoveMode; + } forEach _teams; + } else { + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSentAll",["1","","All",["all"]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true]; + { + [_x,_position] Call SetTeamMovePos; + [_x,_order] Call SetTeamMoveMode; + } forEach clientTeams; + }; + }; + + activeAnimMarker = false; + _array = if (_isAdded == "") then {["TempAnim",_position,"selector_selectedMission",1,_color,1,1.2]} else {["TempAnim",_position,"selector_selectedMission",1,_color,1,1.2,_isAdded]}; + _array Spawn MarkerAnim; + }; + + //--- Set a Task. + if (MenuAction == 306) then { + MenuAction = -1; + _taskType = _TaskTypes select (lbCurSel 14017); + _taskTime = _TaskDuration select (lbCurSel 14018); + _taskTimeLabel = _TaskDurationLabel select (lbCurSel 14018); + _position = _map posScreenToWorld[mouseX,mouseY]; + if (!_isAll) then { + _sideTeam = "Team "; + for '_i' from 0 to count _teams-1 do { + _selected = clientTeams select ((_teams select _i) - 1); + _sideTeam = _sideTeam + (_radioLabel select (_teams select _i)); + if (_i != count _teams -1) then {_sideTeam = _sideTeam + ", "} else {_sideTeam = _sideTeam + " "}; + }; + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSent",["1","",_sideTeam,[if (sideJoined == west) then {"blueTeam"} else {"redTeam"}]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true]; + + { + _selected = clientTeams select (_x - 1); + if (alive (leader _selected)) then { + WFBE_SetTask = [vehicleVarName (leader _selected),'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]]; + publicVariable 'WFBE_SetTask'; + if (isHostedServer) then {[vehicleVarName (leader _selected),'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]] Spawn HandlePVF}; + }; + } forEach _teams; + } else { + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSentAll",["1","","All",["all"]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true]; + WFBE_SetTask = [sideJoined,'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]]; + publicVariable 'WFBE_SetTask'; + if (isHostedServer) then {[sideJoined,'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]] Spawn HandlePVF}; + }; + }; + }; + + //--- Respawn. + if (MenuAction == 201) then { + MenuAction = -1; + [_team] Spawn { + Private ["_team"]; + _team = _this select 0; + _units = Units _team; + if (paramMobileRespawn || (('WFBE_RESPAWNCAMPSMODE' Call GetNamespace) > 0)) then {//--- Make sure that the unit won't spawn back at a camp/ambu. + [_team,"forceRespawn"] Call SetTeamRespawn; + sleep 2; + }; + _units = _units + ([_team,false] Call GetTeamVehicles); + {_x setDammage 1} forEach _units; + }; + }; + + //--- Auto AI. + if (MenuAction == 301) then { + MenuAction = -1; + _isDisabled = (_team) Call GetTeamAutonomous; + if (_isDisabled) then { + ctrlEnable [14015,true]; + ctrlEnable [14014,false]; + if (!_isAll) then { + { + _selected = clientTeams select (_x - 1); + [_selected,false] Call SetTeamAutonomous; + } forEach _teams; + } else { + {[_x,false] Call SetTeamAutonomous} forEach clientTeams; + }; + } else { + ctrlEnable [14014,true]; + ctrlEnable [14015,false]; + if (!_isAll) then { + { + _selected = clientTeams select (_x - 1); + [_selected,true] Call SetTeamAutonomous; + } forEach _teams; + } else { + {[_x,true] Call SetTeamAutonomous} forEach clientTeams; + }; + }; + }; + + //--- Set buy Type + if (MenuAction == 302) then { + MenuAction = -1; + _curType = lbValue [14010, lbCurSel(14010)]; + if (!_isAll) then { + { + _selected = clientTeams select (_x - 1); + [_selected,_curType] Call SetTeamType; + } forEach _teams; + } else { + {[_x,_curType] Call SetTeamType} forEach clientTeams; + }; + }; + + //--- Set property to team. + if (MenuAction == 303) then { + MenuAction = -1; + _behavior = _behaviors select (lbCurSel(14017)); + _combat = _combatModes select (lbCurSel(14018)); + _formation = _formations select (lbCurSel(14019)); + _speed = _speeds select (lbCurSel(14020)); + + //--- Locality, process on server. + _to = sideJoined; + if (!_isAll) then { + _to = []; + { + _selected = clientTeams select (_x - 1); + _to = _to + [_selected]; + } foreach _teams; + }; + + WFBE_RequestTeamUpdate = ['SRVFNCREQUESTTEAMUPDATE',[_to,_behavior,_combat,_formation,_speed]]; + publicVariable 'WFBE_RequestTeamUpdate'; + if (isHostedServer) then {['SRVFNCREQUESTTEAMUPDATE',[_to,_behavior,_combat,_formation,_speed]] Spawn HandleSPVF}; + }; + + //--- Set respawn. + if (MenuAction == 304) then { + MenuAction = -1; + _curSel = lbCurSel 14025; + if (_curSel == -1) then {_curSel = 0}; + if (!_isAll) then { + { + _selected = clientTeams select (_x - 1); + [_selected,(_structures select _curSel)] Call SetTeamRespawn; + } forEach _teams; + } else { + {[_x,(_structures select _curSel)] Call SetTeamRespawn} forEach clientTeams; + }; + }; + + //--- Update the respawn info. + if (_updateRespawn) then { + _updateRespawn = false; + _respawn = (_team) Call GetTeamRespawn; + _id = _structures find _respawn; + if (_id != -1) then {lbSetCurSel [14025,_id]} else {lbSetCurSel[14025,0]}; + }; + + //--- Minimap update (Only refresh when the combo is selected). + if (MenuAction == 305 && _updateProperties) then {MenuAction = -1}; + if (MenuAction == 305) then { + MenuAction = -1; + _curSel = lbCurSel 14025; + if (_curSel == -1) then {_curSel = 0}; + if (typeName (_structures select _curSel) == "OBJECT") then { + _map ctrlMapAnimAdd [1,.095,getPos (_structures select _curSel)]; + ctrlMapAnimCommit _map; + }; + }; + + //--- Units Details. + if (MenuAction == 401) then { + MenuAction = -1; + _iddx = lnbCurSelRow 14041; + if (_iddx != -1) then { + _unit = _detailGroup select _iddx; + _enable = if (!(isPlayer (vehicle _unit)) && vehicle _unit != _unit) then {true} else {false}; + ctrlEnable [14042,_enable]; + }; + }; + + //--- Units Details (Unflip) + if (MenuAction == 402) then { + MenuAction = -1; + _iddx = lnbCurSelRow 14041; + if (_iddx != -1) then { + _unit = _detailGroup select _iddx; + if ((getPos _unit select 2) < 5) then { + _unit setPos [getPos _unit select 0,getpos _unit select 1,0.5]; + _unit setVelocity [0,0,-1]; + _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]}; + [_detailGroup,14041] Call UIFillListTeamOrders; + }; + }; + }; + + //--- Units Details (Disband) + if (MenuAction == 403) then { + MenuAction = -1; + _iddx = lnbCurSelRow 14041; + if (_iddx != -1) then { + _unit = _detailGroup select _iddx; + _unit setDamage 1; + _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]}; + [_detailGroup,14041] Call UIFillListTeamOrders; + }; + }; + + //--- Update team properties. + if (_updateProperties) then { + _updateProperties = false; + _behavior = behaviour (leader _team); + _combat = combatMode (leader _team); + _formation = formation (leader _team); + _speed = speedMode (leader _team); + + //--- Behavior. + _id =_behaviors find _behavior; + if (_id != -1) then {lbSetCurSel [14017,_id]}; + //--- Combat Mode. + _id =_combatModes find _combat; + if (_id != -1) then {lbSetCurSel [14018,_id]}; + //--- Formation. + _id =_formations find _formation; + if (_id != -1) then {lbSetCurSel [14019,_id]}; + //--- Speed. + _id =_speeds find _speed; + if (_id != -1) then {lbSetCurSel [14020,_id]}; + }; + + //--- Back Button. + if (MenuAction == 4) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; + +activeAnimMarker = false; diff --git a/Client/GUI/GUI_Menu_EASA.sqf b/Client/GUI/GUI_Menu_EASA.sqf new file mode 100644 index 0000000..66f929e --- /dev/null +++ b/Client/GUI/GUI_Menu_EASA.sqf @@ -0,0 +1,48 @@ +MenuAction = -1; + +_type = ('WFBE_EASA_Vehicles' Call GetNamespace) find (typeOf (vehicle player)); +if (_type == -1) exitWith {diag_log Format['[WFBE (ERROR)][frameno:%2 | ticktime:%3] GUI_EASA: The player vehicle was not found within the list (%1)',_type,diag_frameno,diag_tickTime]}; +_data = (('WFBE_EASA_Loadouts' Call GetNamespace) select _type); + + +_listPrice = []; +_listDesc = []; +_listBox = 23003; +for [{_i = 0},{_i < count(_data)},{_i = _i + 1}] do { + _cdata = _data select _i; + for [{_j = 0},{_j < count(_cdata)},{_j = _j + 1}] do { + if (_j == 0) then {_listPrice = _listPrice + [(_cdata select 0) select 0]}; + if (_j == 1) then { + _listDesc = _listDesc + [(_cdata select 1) select 0]; + lnbAddRow [_listBox,["$"+str((_cdata select 0) select 0)+".",(_cdata select 1) select 0]]}; + if (_j > 1) then { + }; + }; +}; + +if (count _listPrice > 0) then {lnbSetCurSelRow [_listBox,0]} else {lnbSetCurSelRow [_listBox,-1]}; + +while {alive player && dialog} do { + sleep 0.1; + + if (side player != sideJoined) exitWith {closeDialog 0}; + if !(dialog) exitWith {}; + + //--- Command AI. + if (MenuAction == 101) then { + MenuAction = -1; + _funds = Call GetPlayerFunds; + + _iddx = lnbCurSelRow _listBox; + if (_iddx != -1) then { + if (_funds > (_listPrice select _iddx)) then { + [vehicle player, _iddx, true] Call EASA_Equip; + -(_listPrice select _iddx) Call ChangePlayerFunds; + hint parseText(Format[localize 'STR_WF_INFO_EASA_Purchase',(_listDesc select _iddx)]); + closeDialog 0; + } else { + hint parseText(Format[localize 'STR_WF_INFO_Funds_Missing',(_listPrice select _iddx) - _funds,_listDesc select _iddx]); + }; + }; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Menu_Economy.sqf b/Client/GUI/GUI_Menu_Economy.sqf new file mode 100644 index 0000000..aa0fac0 --- /dev/null +++ b/Client/GUI/GUI_Menu_Economy.sqf @@ -0,0 +1,239 @@ +disableSerialization; + +_display = _this select 0; +_map = _display DisplayCtrl 23002; + +_hqDeployed = (sideJoined) Call GetSideHQDeployed; +if (!_hqDeployed || !paramUseWorkers) then {ctrlEnable [23004, false];ctrlEnable [23006, false]}; +if !(paramUseWorkers) then {ctrlSetText[23005, localize 'STR_WF_Disabled']}; + +MenuAction = -1; + +_maxWorkers = 'WFBE_WORKERS_MAX' Call GetNamespace; +_workerPrice = 'WFBE_WORKERS_PRICE' Call GetNamespace; +_incomeSystem = 'WFBE_INCOMESYSTEM' Call GetNamespace; +_incomeDividision = 'WFBE_INC_DIVIDE_COM' Call GetNamespace; +_supplySystem = 'WFBE_SUPPLYSYSTEM' Call GetNamespace; +_aliveWorkers = []; +_workers = []; +_lastWorkersUpdate = -10; +_lastComboUpdate = -30; +_lastPurchase = -5; +_income = 0; +_updateComboWorker = true; +_hasStarted = true; + +_lastUse = 0; +ctrlEnable [23016,false]; +if (_supplySystem != 0) then {ctrlShow [23016, false]}; + +if (_incomeSystem in [3,4]) then { + sliderSetRange[23010,0,100]; + _income = Call Compile Format["%1CommanderPercent",sideJoined]; + sliderSetPosition[23010, _income]; +} else { + ctrlEnable [23012, false]; +}; + +while {alive player && dialog} do { + if (side player != sideJoined) exitWith {closeDialog 0}; + if !(dialog) exitWith {}; + + _funds = Call GetPlayerFunds; + + //--- Income System. + if (_incomeSystem in [3,4]) then { + ctrlSetText[23011, Format["%1%2",_income,"%"]]; + _currentPercent = Call Compile Format["%1CommanderPercent",sideJoined]; + + _income = floor(sliderPosition 23010); + + sliderSetPosition[23010, _income]; + + _calInc = (sideJoined) Call GetTownsIncome; + + if (_currentPercent != _income || _hasStarted) then { + if (_hasStarted) then {_hasStarted = false}; + + _income_players = 0; + _income_commander = 0; + switch (_incomeSystem) do { + case 3: { + _income_players = round(_calInc * (((100 - _income)/100)/maxPlayers)); + _income_commander = round((_calInc * (_income/100)) / _incomeDividision) + _income_players; + }; + case 4: { + _income_players = round(_calInc * (100 - _income) / 100); + _income_commander = round((_calInc - _income_players)*maxPlayers) + _income_players; + }; + }; + + ctrlSetText [23013, localize 'STR_WF_ECONOMY_Income_Sys_Com' + ": $" + str(_income_commander)]; + ctrlSetText [23014, localize 'STR_WF_ECONOMY_Income_Sys_Ply' + ": $" + str(_income_players)]; + }; + + if (MenuAction == 3) then { + MenuAction = -1; + + if (_currentPercent != _income) then { + Call Compile Format["%1CommanderPercent = _income; publicVariable '%1CommanderPercent';",sideJoined]; + }; + }; + }; + + //--- Workers System. + if (paramUseWorkers) then { + if (time - _lastComboUpdate > 5) then { + _updateComboWorker = true; + _lastComboUpdate = time; + }; + + _workers = Call Compile Format ["WF_%1Workers",sideJoinedText]; + if (time - _lastWorkersUpdate > 5) then {_aliveWorkers = (_workers) Call GetLiveUnits;_lastWorkersUpdate = time}; + _hqDeployed = (sideJoined) Call GetSideHQDeployed; + + if (!_hqDeployed || time - _lastPurchase < 3 || count _aliveWorkers >= _maxWorkers || _funds < _workerPrice) then {ctrlEnable [23004, false]} else {ctrlEnable [23004, true]}; + + //--- Workers tracker. + if (_updateComboWorker) then { + _updateComboWorker = false; + lbClear 23007; + + for '_i' from 0 to count(_aliveWorkers)-1 do { + lbAdd [23007, localize "STR_WF_ECONOMY_Workers" + " " + str(_i+1)]; + }; + }; + + ctrlSetText [23005, Format ["$%1 (%2/%3)",_workerPrice,count _aliveWorkers,_maxWorkers]]; + }; + + //--- Hire Workers. + if (MenuAction == 1) then { + MenuAction = -1; + + //--- Which index. + _index = 0; + for '_i' from 0 to count(_workers)-1 do { + if (isNull (_workers select _i)) exitWith {_index = _i}; + }; + + if (_index == 0 && count(_workers) > 0) then {_index = count _workers}; + + if (count _aliveWorkers <= _maxWorkers && _hqDeployed) then { + -(_workerPrice) Call ChangePlayerFunds; + + WFBE_RequestWorker = ['SRVFNCREQUESTWORKER',[sideJoined,(sideJoined) Call GetSideHQ,_index]]; + publicVariable 'WFBE_RequestWorker'; + if (isHostedServer) then {['SRVFNCREQUESTWORKER',[sideJoined,(sideJoined) Call GetSideHQ,_index]] Spawn HandleSPVF}; + + _workers set [_index, WF_Logic]; + Call Compile Format ["WF_%1Workers = _workers; publicVariable 'WF_%1Workers';",sideJoinedText]; + + _lastPurchase = time; + _lastWorkersUpdate = -10; + _updateComboWorker = true; + }; + }; + + //--- Disband Worker. + if (MenuAction == 2) then { + MenuAction = -1; + + _value = lbCurSel 23007; + + if (_value != -1) then { + (_aliveWorkers select _value) setDammage 1; + _lastWorkersUpdate = -10; + _updateComboWorker = true; + }; + }; + + //--- ST Handler. + if (_supplySystem == 0) then { + _isCommander = false; + if (!isNull(commanderTeam)) then {if (commanderTeam == group player) then {_isCommander = true}}; + ctrlEnable [23016,if (time - _lastUse > 5 && _isCommander) then {true} else {false}]; + }; + + //--- Respawn Supply Trucks. + if (MenuAction == 4) then { + MenuAction = -1; + WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["RespawnST",sideJoined]]; + publicVariable 'WFBE_RequestSpecial'; + if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["RespawnST",sideJoined]] Spawn HandleSPVF}; + _lastUse = time; + }; + + //--- Minimap update. + if (MenuAction == 100) then { + MenuAction = -1; + _value = lbCurSel 23007; + + if (_value != -1) then { + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [1,.175,getPos(_aliveWorkers select _value)]; + ctrlMapAnimCommit _map; + }; + }; + + //added-MrNiceGuy + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + //--- Sell Building. + if (MenuAction == 105) then { + MenuAction = -1; + _position = _map posScreenToWorld[mouseX,mouseY]; + _structures = (sideJoinedText) Call GetSideStructures; + _existingStruct = [_position,_structures] Call SortByDistance; + if (count _existingStruct > 0) then { + _closest = _existingStruct select 0; + //--- 100 meters close only. + if (_closest distance _position < 100 && isNil {_closest getVariable "WFBE_SOLD"}) then { + //--- Spawn a sell thread. + (_closest) Spawn { + Private ["_closest","_delay","_id","_supplyB","_type"]; + _closest = _this; + _closest setVariable ["WFBE_SOLD", true]; + _delay = 'WFBE_BUILDINGSELLDELAY' Call GetNamespace; + _type = typeOf _closest; + + //--- Inform the side (before). + WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['StructureSell',_type,_delay]]; + publicVariable 'WFBE_LocalizeMessage'; + ['StructureSell',_type,_delay] Spawn CLTFNCLocalizeMessage; + + sleep _delay; + + if !(alive _closest) exitWith {}; + + _id = (Format ["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace) find _type; + + //--- TODO: Change the find system with a getvar system. + if (_id > 0) then { + _supplyB = (Format ["WFBE_%1STRUCTURECOSTS",sideJoinedText] Call GetNamespace) select _id; + _supplyB = round((_supplyB * ('WFBE_STRUCTURESELLPERCENT' Call GetNamespace)) / 100); + + if !(paramMoneyOnly) then {[sideJoined, _supplyB] Call ChangeSideSupply} else {(_supplyB) Call ChangePlayerFunds}; + }; + + //--- Inform the side. + WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['StructureSold',_type]]; + publicVariable 'WFBE_LocalizeMessage'; + ['StructureSold',_type] Spawn CLTFNCLocalizeMessage; + if (paramUseWorkers) then {_closest setVariable ["sold",true,true]}; + _closest setDammage 1; + }; + }; + }; + }; + }; + + sleep 0.1; + + //--- Back Button. + if (MenuAction == 5) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Menu_Respawn.sqf b/Client/GUI/GUI_Menu_Respawn.sqf new file mode 100644 index 0000000..4425fab --- /dev/null +++ b/Client/GUI/GUI_Menu_Respawn.sqf @@ -0,0 +1,161 @@ +disableSerialization; + +MenuAction = -1; +mouseButtonUp = -1; +_display = _this select 0; +_map = _display displayCtrl 15001; + +_spawn = objNull; +_availableSpawn = []; +_markers = []; +_markerIndex = 0; +_ta = ""; +_lastSpawnUpdate = 0; + +//--- Prevent AI from moving to the temp spawn. +{_x disableAI "MOVE"} forEach (units clientTeam); + +//--- Wait until the player respawned. +waitUntil {alive player}; + +//--- Position the player at the temp location during his respawn. +player setPos ([getMarkerPos Format["%1TempRespawnMarker",sideJoinedText],1,10] Call GetRandomPosition); +if (leader(group player) != player) then {(group player) selectLeader player}; + +//--- Call the pre respawn routine. +(player) Call PreRespawnHandler; + +//--- Spawn a countdown thread. +respawnDone = false; +_handleTimer = [] Spawn { + if (isNil 'respawnStatus') then {respawnStatus = 'WFBE_RESPAWNDELAY' Call GetNamespace}; + while {respawnStatus >= 0} do { + sleep 1; + respawnStatus = respawnStatus - 1; + }; + respawnDone = true; +}; + +//--- Run the main respawn thread. +while {!respawnDone} do { + //--- Exit the thread if the client died. + if !(alive player) exitWith {}; + + //--- Loadout Selection. + ctrlSetText [15004, if (WFBE_RespawnDefaultGear) then {localize "STR_WF_RESPAWN_GearDefault"} else {localize "STR_WF_RESPAWN_GearCurrent"}]; //changed-MrNiceGuy + + //--- Preloading Status. + ctrlSetText [15005, if (WFBE_EnablePreload) then {localize "STR_WF_RESPAWN_PreloadYes"} else {localize "STR_WF_RESPAWN_PreloadNo"}]; //changed-MrNiceGuy + + //--- Update the respawn info. + if (time - _lastSpawnUpdate > 2) then { + _lastSpawnUpdate = time; + _lastAvailableSpawn = _availableSpawn; + _availableSpawn = [sideJoined,deathLocation] Call GetRespawnAvailable; + + //--- First launch. + if (isNull _spawn) then { + _spawn = _availableSpawn select 0; + _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim; + respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo; + }; + + //--- Properly update the client's map - Update removal. + _found = false; + { + if !(_x in _availableSpawn) then { + _mid = _x getVariable 'WFBE_IDRMarker'; + _markers = _markers - [_mid]; + deleteMarkerLocal _mid; + _x setVariable ['WFBE_IDRMarker',nil]; + if (_x == _spawn && !_found) then { + _found = true; + _spawn = ([_x, _availableSpawn] Call SortByDistance) select 0; + terminate _ta; + deleteMarkerLocal "TempAnim"; + _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim; + respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo; + }; + }; + } forEach _lastAvailableSpawn; + + //--- Properly update the client's map - Update add. + { + if !(_x in _lastAvailableSpawn) then { + _markerName = Format ["respawnMarker%1",_markerIndex]; + _markers = _markers + [_markerName]; + createMarkerLocal [_markerName,getPos _x]; + _markerName setMarkerTypeLocal "Select"; + _markerName setMarkerColorLocal "ColorYellow"; + _markerName setMarkerSizeLocal [1,1]; + _markerIndex = _markerIndex + 1; + _x setVariable ['WFBE_IDRMarker',_markerName]; + }; + } forEach _availableSpawn; + }; + + //--- Update the respawn timer. + ctrlSetText [15003,Format [localize "STR_WF_RESPAWN_Status",respawnStatus,respawnName]]; + + //--- The client has clicked on the map. + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + if (count _availableSpawn > 1) then { + _position = _map PosScreenToWorld[mouseX,mouseY]; + _sorted = [_position,_availableSpawn] Call SortByDistance; + if ((_sorted select 0) distance _position < 500) then { + _spawn = _sorted select 0; + activeAnimMarker = false; + terminate _ta; + deleteMarkerLocal "TempAnim"; + _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim; + respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo; + }; + }; + }; + + sleep 0.1; +}; + +//--- If the spawn is null, we use the HQ. +if (isNull _spawn) then { + _hq = (sideJoinedText) Call GetSideHQ; + _spawn = _hq; +}; + +//--- Pre-render. +if (WFBE_EnablePreload) then { + ctrlSetText [15003,localize 'STR_WF_RESPAWN_Preload']; + waitUntil{preloadCamera (getPos _spawn) || !(alive player)}; +}; + +//--- Execute on respawn code only if the player's alive. +if (alive player) then { + [player,_spawn] Call OnRespawnHandler; +}; + +//--- Terminate the threads & cleaning. +{deleteMarkerLocal _x} forEach _markers; +{_x setVariable ['WFBE_IDRMarker',nil]} forEach _availableSpawn; +if !(isNil "DeathCamera") then { + DeathCamera cameraEffect["TERMINATE","BACK"]; + camDestroy DeathCamera; +}; + +"dynamicBlur" ppEffectEnable false; +"colorCorrections" ppEffectEnable false; +[currentFX] Spawn FX; +terminate _ta; +if !(scriptDone _handleTimer) then {terminate _handleTimer}; +deleteMarkerLocal "TempAnim"; +activeAnimMarker = false; +playerDead = false; +respawnDone = nil; +respawnName = nil; +respawnStatus = nil; +closeDialog 0; + +//--- Enable AI movement again. +{_x enableAI "MOVE"} forEach (units clientTeam); + +hint (localize "STR_WF_INFO_RespawnInfo"); \ No newline at end of file diff --git a/Client/GUI/GUI_Menu_Service.sqf b/Client/GUI/GUI_Menu_Service.sqf new file mode 100644 index 0000000..5917c35 --- /dev/null +++ b/Client/GUI/GUI_Menu_Service.sqf @@ -0,0 +1,254 @@ +MenuAction = -1; + +_vehi = [group player,false] Call GetTeamVehicles; +_alives = (units group player) Call GetLiveUnits; +{if (vehicle _x == _x) then {_vehi = _vehi + [_x]}} forEach _alives; +_lastUse = 0; +_typeRepair = Format['WFBE_%1REPAIRTRUCKS',sideJoinedText] Call GetNamespace; +_sheal = 'WFBE_SUPPORTHEALTIME' Call GetNamespace; +_srearm = 'WFBE_SUPPORTREARMTIME' Call GetNamespace; +_srefuel = 'WFBE_SUPPORTREFUELTIME' Call GetNamespace; +_srepair = 'WFBE_SUPPORTREPAIRTIME' Call GetNamespace; + +_healPrice = 0; +_repairPrice = 0; +_refuelPrice = 0; +_rearmPrice = 0; +_lastVeh = objNull; +_lastDmg = 0; +_lastFue = 0; + +_buildings = (sideJoinedText) Call GetSideStructures; + +//--- Service Point. +_csp = objNull; +_sp = [sideJoined, Format ["WFBE_%1SERVICEPOINTTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories; +if (count _sp > 0) then { + _sorted = [player,_sp] Call SortByDistance; + _csp = _sorted select 0; +}; + +if (paramEASA) then { + _enable = false; + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + _easaLevel = _currentUpgrades select 15; + if (!(isNull _csp) && _easaLevel > 0) then { + if (player distance _csp < ('WFBE_SUPPORTRANGE' Call GetNamespace)) then { + if (typeOf(vehicle player) in ('WFBE_EASA_Vehicles' Call GetNamespace)) then { + if (driver (vehicle player) == player) then {_enable = true}; + }; + }; + }; + ctrlEnable [20010,_enable]; +} else { + ctrlEnable [20010,false]; +}; + +_effective = []; +_nearSupport = []; +_spType = Call Compile Format ["%1SP",sideJoinedText]; +_i = 0; +{ + _closestSP = objNull; + _add = false; + + _nearSupport set [_i, []]; + + //--- Service Point. + if (count _sp > 0) then { + _sorted = [_x,_sp] Call SortByDistance; + _closestSP = _sorted select 0; + if !(isNull _closestSP) then { + if (_x distance _closestSP < ('WFBE_SUPPORTRANGE' Call GetNamespace)) then { + _add = true; + _nearSupport set [_i,(_nearSupport select _i) + [_closestSP]]; + }; + }; + }; + + //--- Depots. + _nObjects = nearestObjects [_x, WFDEPOT,('WFBE_SUPPORTRANGE' Call GetNamespace)]; + _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull}; + if !(isNull _nObject) then { + _sideID = _nObject getVariable "sideID"; + if !(isNil "_sideID") then { + if (_sideID == sideID) then { + _add = true; + _nearSupport set [_i,(_nearSupport select _i) + [_nObject]]; + }; + }; + }; + + //--- Repairs Trucks. + _checks = (getPos _x) nearEntities[_typeRepair,'WFBE_REPAIRTRUCKRANGE' Call GetNamespace]; + if (count _checks > 0) then { + _add = true; + _nearSupport set [_i,(_nearSupport select _i) + _checks]; + }; + + //--- Add the vehicle ? + if (_add) then { + _effective = _effective + [_x]; + _desc = [typeOf _x, 'displayName'] Call GetConfigInfo; + _finalNumber = (_x) Call GetAIDigit; + _isInVehicle = ""; + if (_x != vehicle _x) then { + _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo; + _isInVehicle = " [" + _descVehi + "] "; + }; + _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle; + lbAdd[20002,_txt]; + + _i = _i + 1; + }; +} forEach _vehi; + +_checks = (getPos player) nearEntities[_typeRepair,'WFBE_REPAIRTRUCKRANGE' Call GetNamespace]; +if (count _checks > 0) then { + _repair = _checks select 0; + _vehi = ((getPos _repair) nearEntities[["Car","Motorcycle","Tank","Air","Ship","StaticWeapon"],100]) - [_repair]; + { + if !(_x in _effective) then { + _effective = _effective + [_x]; + _nearSupport set [_i,[_repair]]; + _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo; + lbAdd[20002,_descVehi]; + + _i = _i + 1; + }; + } forEach _vehi; +}; + +if (count _effective > 0) then {lbSetCurSel[20002,0]}; + +while {true} do { + sleep 0.1; + + if (Side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; + _curSel = lbCurSel(20002); + + if (_curSel != -1) then { + _veh = (vehicle (_effective select _curSel)); + _funds = Call GetPlayerFunds; + + if (_veh isKindOf "Man") then { + {ctrlEnable [_x,false]} forEach [20003,20004,20005]; + _enabled = if (_funds >= _healPrice) then {true} else {false}; + ctrlEnable [20008,_enabled]; + //--- Healing. + _healPrice = round((getDammage _veh)*('WFBE_SUPPORTHEALPRICE' Call GetNamespace)); + ctrlSetText [20011,"$0"]; + ctrlSetText [20012,"$0"]; + ctrlSetText [20013,"$0"]; + ctrlSetText [20014,"$"+str(_healPrice)]; + } else { + //--- Prevent on the air re-supply. + _canBeUsed = if ((getPos _veh) select 2 <= 2 && speed _veh <= 20) then {true} else {false}; + _enabled = if (_canBeUsed && _funds >= _rearmPrice) then {true} else {false}; + ctrlEnable [20003,_enabled]; + _enabled = if (_canBeUsed && _funds >= _repairPrice) then {true} else {false}; + ctrlEnable [20004,_enabled]; + _enabled = if (_canBeUsed && _funds >= _refuelPrice) then {true} else {false}; + ctrlEnable [20005,_enabled]; + _enabled = if (_canBeUsed && _funds >= _healPrice) then {true} else {false}; + ctrlEnable [20008,_enabled]; + //--- Healing. + _healPrice = 0; + { + if (alive _x) then {_healPrice = _healPrice + round((getDammage _x)*('WFBE_SUPPORTHEALPRICE' Call GetNamespace))}; + } forEach (crew _veh); + ctrlSetText [20014,"$"+str(_healPrice)]; + //--- Repair. + if (_veh != _lastVeh || getDammage _veh != _lastDmg) then { + _type = typeOf _veh; + _lastDmg = getDammage _veh; + _get = _type Call GetNamespace; + if !(isNil '_get') then { + _repairPrice = round((getDammage _veh)*((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREPAIRPRICE' Call GetNamespace))); + } else { + _repairPrice = 500; + }; + }; + ctrlSetText [20012,"$"+str(_repairPrice)]; + //--- Rearm. + if (_veh != _lastVeh) then { + _type = typeOf _veh; + _get = _type Call GetNamespace; + if !(isNil '_get') then { + _rearmPrice = round((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREARMPRICE' Call GetNamespace)); + } else { + _rearmPrice = 500; + }; + }; + ctrlSetText [20011,"$"+str(_rearmPrice)]; + //--- Refuel. + if (_veh != _lastVeh || fuel _veh != _lastFue) then { + _type = typeOf _veh; + _lastFue = fuel _veh; + _get = _type Call GetNamespace; + if !(isNil '_get') then { + _fuel = ((fuel _veh) -1) * -1; + _refuelPrice = round(_fuel*((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREFUELPRICE' Call GetNamespace))); + } else { + _refuelPrice = 200; + }; + }; + ctrlSetText [20013,"$"+str(_refuelPrice)]; + }; + + _lastVeh = _veh; + + //--- Rearm. + if (MenuAction == 1) then { + MenuAction = -1; + -_rearmPrice Call ChangePlayerFunds; + + //--- Spawn a Rearm thread. + [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRearm; + }; + + //--- Repair. + if (MenuAction == 2) then { + MenuAction = -1; + -_repairPrice Call ChangePlayerFunds; + + //--- Spawn a Repair thread. + [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRepair; + }; + + //--- Refuel. + if (MenuAction == 3) then { + MenuAction = -1; + -_refuelPrice Call ChangePlayerFunds; + + //--- Spawn a Refuel thread. + [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRefuel; + }; + + //--- Heal. + if (MenuAction == 5) then { + MenuAction = -1; + -_healPrice Call ChangePlayerFunds; + + //--- Spawn a Healing thread. + [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportHeal; + }; + } else { + {ctrlEnable[_x,false]} forEach [20003,20004,20005,20008]; + }; + + //--- EASA. TBD: Add dialog; + if (MenuAction == 7) then { + MenuAction = -1; + closeDialog 0; + createDialog "RscMenu_EASA"; + }; + + //--- Back Button. + if (MenuAction == 8) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; diff --git a/Client/GUI/GUI_Menu_Tactical.sqf b/Client/GUI/GUI_Menu_Tactical.sqf new file mode 100644 index 0000000..3aea39f --- /dev/null +++ b/Client/GUI/GUI_Menu_Tactical.sqf @@ -0,0 +1,659 @@ +disableSerialization; + +_display = _this select 0; +_lastRange = artyRange; +_lastUpdate = 0; +_listBox = 17019; + +sliderSetRange[17005,10,'WFBE_MAXARTILLERYAREA' Call GetNamespace]; +sliderSetPosition[17005,artyRange]; + +ctrlSetText [17025,localize "STR_WF_TACTICAL_ArtilleryOverview" + ":"]; + +_markers = []; +_FTLocations = []; +_checks = []; +_fireTime = 0; +_status = 0; +_canFT = false; +_forceReload = true; +_ft = 'WFBE_FASTTRAVEL' Call GetNamespace; +_ftr = 'WFBE_FASTTRAVELRANGE' Call GetNamespace; +_startPoint = objNull; + +_marker = "artilleryMarker"; +createMarkerLocal [_marker,artyPos]; +_marker setMarkerTypeLocal "mil_destroy"; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerSizeLocal [1,1]; + +_area = "artilleryAreaMarker"; +createMarkerLocal [_area,artyPos]; +_area setMarkerShapeLocal "Ellipse"; +_area setMarkerColorLocal "ColorRed"; +_area setMarkerSizeLocal [artyRange,artyRange]; + +_map = _display DisplayCtrl 17002; +_listboxControl = _display DisplayCtrl _listBox; + +_pard = 'WFBE_PARADELAY' Call GetNamespace; +{lbAdd[17008,_x]} forEach (Format ["WFBE_%1_ARTILLERY_DESC",sideJoinedText] Call GetNamespace); +lbSetCurSel[17008,0]; + +_IDCS = [17005,17006,17007,17008]; +if !(paramArty) then {{ctrlEnable [_x,false]} forEach _IDCS}; + +{ctrlEnable [_x, false]} forEach [17010,17011,17012,17013,17014,17015,17017,17018,17020]; + +MenuAction = -1; +mouseButtonUp = -1; +_currentValue = -1; +_currentFee = -1; +_currentSpecial = ""; +_currentFee = -1; + +//--- Support List. +_lastSel = -1; +_addToList = [localize 'STR_WF_TACTICAL_FastTravel',localize 'STR_WF_ICBM',localize 'STR_WF_TACTICAL_ParadropAmmo',localize 'STR_WF_TACTICAL_ParadropVehicle',localize 'STR_WF_TACTICAL_Paratroop',localize 'STR_WF_TACTICAL_UnitCam',localize 'STR_WF_TACTICAL_UAV',localize 'STR_WF_TACTICAL_UAVDestroy',localize 'STR_WF_TACTICAL_UAVRemoteControl']; +_addToListID = ["Fast_Travel","ICBM","Paradrop_Ammo","Paradrop_Vehicle","Paratroopers","Units_Camera","UAV","UAV_Destroy","UAV_Remote_Control"]; +_addToListFee = [0,150000,9500,3500,8500,0,12500,0,0]; +_addToListInterval = [0,1000,800,600,900,0,0,0,0]; + +for '_i' from 0 to count(_addToList)-1 do { + lbAdd [_listBox,_addToList select _i]; + lbSetValue [_listBox, _i, _i]; +}; + +lbSort _listboxControl; + +//--- Artillery Mode. +_mode = 'WFBE_V_ARTILLERYMINMAP' Call GetNamespace; +if (isNil '_mode') then {_mode = 2;['WFBE_V_ARTILLERYMINMAP',_mode,true] Call SetNamespace}; +_trackingArray = []; +_trackingArrayID = []; +_lastArtyUpdate = -60; +_minRange = 100; +_maxRange = 200; +_requestMarkerTransition = false; +_requestRangedList = true; +_startLoad = true; + +//--- Startup coloration. +with uinamespace do { + currentBEDialog = _display; + switch (_mode) do { + case 0: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [1,1,1,1]}; + case 1: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0,0.635294,0.909803,1]}; + case 2: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0.6,0.850980,0.917647,1]}; + }; +}; + +lbSetCurSel[_listbox, 0]; + +if (!paramArty) then { + (_display displayCtrl 17016) ctrlSetStructuredText (parseText Format['%1',localize 'STR_WF_Disabled']); +}; + +_textAnimHandler = [] spawn {}; + +while {alive player && dialog} do { + if (side player != sideJoined) exitWith {deleteMarkerLocal _marker;deleteMarkerLocal _area;{deleteMarkerLocal _x} forEach _markers;closeDialog 0}; + if (!dialog) exitWith {deleteMarkerLocal _marker;deleteMarkerLocal _area;{deleteMarkerLocal _x} forEach _markers}; + + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + + if (_ft > 0) then { + //--- TODO: Travel fee, mod parameter > FT free or pay, do a clt fct. + _currentLevel = _currentUpgrades select 12; + if (time - _lastUpdate > 15 && _currentLevel > 0) then { + {deleteMarkerLocal _x} forEach _markers; + _markers = []; + _FTLocations = []; + _canFT = false; + _startPoint = objNull; + _lastUpdate = time; + _base = (sideJoinedText) Call GetSideHQ; + _isDeployed = (sideJoinedText) Call GetSideHQDeployed; + if (player distance _base < _ftr && alive _base && vehicle player != _base && _isDeployed) then { + _canFT = true; + _startPoint = _base; + } else { + _sorted = [player,towns] Call SortByDistance; + _closest = _sorted select 0; + _sideID = _closest getVariable "sideID"; + _camps = [_closest,sideJoined] Call GetFriendlyCamps; + _allCamps = _closest getVariable "camps"; + if (_sideID == sideID && player distance _closest < _ftr && (count _camps == count _allCamps)) then {_canFT = true;_startPoint = _closest} else { + _buildings = (sideJoinedText) Call GetSideStructures; + _checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories; + if (count _checks > 0) then { + _sorted = [player,_checks] Call SortByDistance; + _closest = _sorted select 0; + if (player distance _closest < _ftr) then { + _canFT = true; + _closest = _sorted select 0; + _startPoint = _closest; + }; + }; + }; + }; + if (!canMove (vehicle player)) then {_canFT = false}; + if (_canFT) then { + _buildings = (sideJoinedText) Call GetSideStructures; + _checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories; + _locations = towns + _checks; + if (alive _base && _isDeployed) then {_locations = _locations + [_base]}; + _i = 0; + _fee = 0; + _funds = if (_ft == 2) then {Call GetPlayerFunds} else {0}; + { + if (_x distance player <= ('WFBE_FASTTRAVELMAXRANGE' Call GetNamespace) && _x distance player > _ftr) then { + _skip = false; + if (_x in towns) then { + _sideID = _x getVariable "sideID"; + _camps = [_x,sideJoined] Call GetFriendlyCamps; + _allCamps = _x getVariable "camps"; + if (_sideID != sideID || (count _camps != count _allCamps)) then {_skip = true}; + if (_ft == 2) then { + _fee = round(((_x distance player)/1000) * ('WFBE_FASTTRAVELPRICEKM' Call GetNamespace)); + if (_funds < _fee) then {_skip = true}; + }; + }; + if !(_skip) then { + _FTLocations = _FTLocations + [_x]; + _markerName = Format ["FTMarker%1",_i]; + _markers = _markers + [_markerName]; + createMarkerLocal [_markerName,getPos _x]; + _markerName setMarkerTypeLocal "mil_circle"; + _markerName setMarkerColorLocal "ColorYellow"; + _markerName setMarkerSizeLocal [1,1]; + //--- Fee, Cheap marker stuff, TBD: Add prompt or something. + if (_ft == 2) then { + _markerName = Format ["FTMarker%1%1",_i]; + _markers = _markers + [_markerName]; + createMarkerLocal [_markerName,[(getPos _x select 0)-5,(getPos _x select 1)+75]]; + _markerName setMarkerTypeLocal "mil_circle"; + _markerName setMarkerColorLocal "ColorYellow"; + _markerName setMarkerSizeLocal [0,0]; + _markerName setMarkerTextLocal Format ["$%1",_fee]; + }; + _i = _i + 1; + }; + }; + } forEach _locations; + }; + }; + }; + + _currentSel = lbCurSel(_listBox); + + //--- Special changed or a reload is requested. + if (_currentSel != _lastSel || _forceReload) then { + _currentValue = lbValue[_listBox, _currentSel]; + + _currentSpecial = _addToListID select _currentValue; + _currentFee = _addToListFee select _currentValue; + _currentInterval = _addToListInterval select _currentValue; + + _forceReload = false; + _controlEnable = false; + + _funds = Call GetPlayerFunds; + + //ctrlSetText[17021,Format ["%1: $%2",localize 'STR_WF_Price',_currentFee]]; //---old + ctrlSetText[17021,Format ["$%1",_currentFee]]; //---added-MrNiceGuy + + //--- Enabled or disabled? + switch (_currentSpecial) do { + case "Fast_Travel": { + if (_ft > 0) then { + _currentLevel = _currentUpgrades select 12; + _controlEnable = if (count _FTLocations > 0 && _currentLevel > 0) then {true} else {false}; + }; + }; + case "ICBM": { + if (paramICBM) then { + _commander = false; + if (!isNull(commanderTeam)) then { + if (commanderTeam == group player) then {_commander = true}; + }; + _currentLevel = _currentUpgrades select 11; + _controlEnable = if (_currentLevel > 0 && _commander && _funds >= _currentFee) then {true} else {false}; + }; + }; + case "Paratroopers": { + _currentLevel = _currentUpgrades select 4; + _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastParaCall > _currentInterval) then {true} else {false}; + }; + case "Paradrop_Ammo": { + _currentLevel = _currentUpgrades select 16; + _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastSupplyCall > _currentInterval) then {true} else {false}; + }; + case "Paradrop_Vehicle": { + _currentLevel = _currentUpgrades select 16; + _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && time - lastSupplyCall > _currentInterval) then {true} else {false}; + }; + case "UAV": { + _currentLevel = _currentUpgrades select 5; + _controlEnable = if (_funds >= _currentFee && _currentLevel > 0 && !(alive playerUAV)) then {true} else {false}; + }; + case "UAV_Destroy": { + _controlEnable = if (alive playerUAV) then {true} else {false}; + }; + case "UAV_Remote_Control": { + _controlEnable = if (alive playerUAV) then {true} else {false}; + }; + case "Units_Camera": { + _controlEnable = commandInRange; + }; + }; + + ctrlEnable[17020, _controlEnable]; + }; + + //--- Action triggered. + if (MenuAction == 20) then { + MenuAction = -1; + + //--- Output. + switch (_currentSpecial) do { + case "Fast_Travel": { + MenuAction = 7; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim; + }; + case "ICBM": { + MenuAction = 8; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim; + }; + case "Paratroopers": { + MenuAction = 3; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim; + }; + case "Paradrop_Ammo": { + MenuAction = 10; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim; + }; + case "Paradrop_Vehicle": { + MenuAction = 9; + + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ClickOnMap',10,"ff9900"] spawn SetControlFadeAnim; + }; + case "UAV": { + closeDialog 0; + ExecVM "Client\Module\UAV\uav.sqf"; + }; + case "UAV_Destroy": { + if !(isNull playerUAV) then { + {_x setDammage 1} forEach (crew playerUAV); + playerUAV setDammage 1; + playerUAV = objNull; + }; + }; + case "UAV_Remote_Control": { + closeDialog 0; + ExecVM "Client\Module\UAV\uav.sqf"; + }; + case "Units_Camera": { + closeDialog 0; + createDialog "RscMenu_UnitCamera"; + }; + }; + + _forceReload = true; + }; + + artyRange = floor (sliderPosition 17005); + if (_lastRange != artyRange) then {_area setMarkerSizeLocal [artyRange,artyRange];}; + + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + //--- Set Artillery Marker on map. + if (MenuAction == 1) then { + MenuAction = -1; + artyPos = _map posScreenToWorld[mouseX,mouseY]; + _marker setMarkerPosLocal artyPos; + _area setMarkerPosLocal artyPos; + _requestRangedList = true; + }; + //--- Paratroops. + if (MenuAction == 3) then { + MenuAction = -1; + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + _callPos = _map posScreenToWorld[mouseX,mouseY]; + if (!surfaceIsWater _callPos) then { + lastParaCall = time; + -(_currentFee) Call ChangePlayerFunds; + WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["Paratroops",sideJoined,_callPos,clientTeam]]; + publicVariable 'WFBE_RequestSpecial'; + if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["Paratroops",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF}; + hint (localize "STR_WF_INFO_Paratroop_Info"); + }; + }; + //--- Fast Travel. + if (MenuAction == 7) then { + MenuAction = -1; + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + _callPos = _map PosScreenToWorld[mouseX,mouseY]; + _sorted = [_callPos,_FTLocations] Call SortByDistance; + if (_callPos distance (_sorted select 0) < 500) then { + closeDialog 0; + deleteMarkerLocal _marker; + deleteMarkerLocal _area; + + _destination = _sorted select 0; + + if (_ft == 2) then { + _fee = round(((player distance _destination)/1000) * ('WFBE_FASTTRAVELPRICEKM' Call GetNamespace)); + -(_fee) Call ChangePlayerFunds; + }; + + _travelingWith = []; + {if (_x distance _startPoint < _ftr && !(_x in _travelingWith) && canMove _x && !(vehicle _x isKindOf "StaticWeapon") && !stopped _x && !((currentCommand _x) in ["WAIT","STOP"])) then {_travelingWith = _travelingWith + [vehicle _x]}} forEach units (group player); + + ForceMap true; + _compass = shownCompass; + _GPS = shownGPS; + _pad = shownPad; + _radio = shownRadio; + _watch = shownWatch; + + showCompass false; + showGPS false; + showPad false; + showRadio false; + showWatch false; + + mapAnimClear; + mapAnimCommit; + + _locationPosition = getPos _destination; + _camera = "camera" camCreate _locationPosition; + _camera camSetDir 0; + _camera camSetFov 1; + _camera cameraEffect["Internal","TOP"]; + + _camera camSetTarget _locationPosition; + _camera camSetPos [_locationPosition select 0,(_locationPosition select 1) + 2,100]; + _camera camCommit 0; + + mapAnimAdd [0,0.05,GetPos _startPoint]; + mapAnimCommit; + + _delay = ((_startPoint distance _destination) / 50) * ('WFBE_FASTTRAVELTIMECOEF' Call GetNamespace); + mapAnimAdd [_delay,.18,getPos _destination]; + mapAnimCommit; + + waitUntil {mapAnimDone || !alive player}; + _skip = false; + if (!alive player) then {_skip = true}; + if (!_skip) then { + {[_x,_locationPosition,120] Call PlaceSafe} forEach _travelingWith; + }; + sleep 1; + + ForceMap false; + showCompass _compass; + showGPS _GPS; + showPad _pad; + showRadio _radio; + showWatch _watch; + + _camera cameraEffect["TERMINATE","BACK"]; + camDestroy _camera; + }; + }; + //--- ICBM Strike. + if (MenuAction == 8) then { + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + MenuAction = -1; + -_currentFee Call ChangePlayerFunds; + _callPos = _map PosScreenToWorld[mouseX,mouseY]; + _obj = "HeliHEmpty" createVehicle _callPos; + _nukeMarker = createMarkerLocal ["icbmstrike", position _obj]; + _nukeMarker setMarkerTypeLocal "mil_warning"; + _nukeMarker setMarkerTextLocal "ICBM"; + _nukeMarker setMarkerColorLocal "ColorRed"; + [_obj,_nukeMarker] Spawn NukeIncomming; + }; + //--- Vehicle Paradrop. + if (MenuAction == 9) then { + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + MenuAction = -1; + lastSupplyCall = time; + -_currentFee Call ChangePlayerFunds; + _callPos = _map PosScreenToWorld[mouseX,mouseY]; + WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ParaVehi",sideJoined,_callPos,clientTeam]]; + publicVariable 'WFBE_RequestSpecial'; + if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ParaVehi",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF}; + }; + //--- Ammo Paradrop. + if (MenuAction == 10) then { + _forceReload = true; + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + [17022] Call SetControlFadeAnimStop; + MenuAction = -1; + lastSupplyCall = time; + -_currentFee Call ChangePlayerFunds; + _callPos = _map PosScreenToWorld[mouseX,mouseY]; + WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ParaAmmo",sideJoined,_callPos,clientTeam]]; + publicVariable 'WFBE_RequestSpecial'; + if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ParaAmmo",sideJoined,_callPos,clientTeam]] Spawn HandleSPVF}; + }; + }; + + //--- Update the Artillery Status. + if (paramArty) then { + _fireTime = (Format["WFBE_FIREMISSIONTIMEOUT%1",(_currentUpgrades select 10)] Call GetNamespace); + _status = round(_fireTime - (time - fireMissionTime)); + _txt = if (time - fireMissionTime > _fireTime) then {Format['%1',localize 'STR_WF_TACTICAL_Available']} else {Format ['%1 %2',_status,localize 'STR_WF_Seconds']}; + (_display displayCtrl 17016) ctrlSetStructuredText (parseText _txt); + _enable = if (_status > 0) then {false} else {true}; + ctrlEnable [17007,_enable]; + }; + + //--- Request Fire Mission. + if (MenuAction == 2) then { + MenuAction = -1; + _units = [Group player,false,lbCurSel(17008),sideJoinedText] Call GetTeamArtillery; + if (Count _units > 0) then { + fireMissionTime = time; + [GetMarkerPos "artilleryMarker",lbCurSel(17008)] Spawn RequestFireMission; + } else { + hint (localize "STR_WF_INFO_NoArty"); + }; + }; + + //--- Arty Combo Change or Script init. + if (MenuAction == 200 || _startLoad) then { + MenuAction = -1; + + _index = lbCurSel(17008); + _minRange = (Format ["WFBE_%1_ARTILLERY_MINRANGES",sideJoined] Call GetNamespace) select _index; + _maxRange = (Format ["WFBE_%1_ARTILLERY_MAXRANGES",sideJoined] Call GetNamespace) select _index; + + _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery; + + _requestMarkerTransition = true; + _requestRangedList = true; + _startLoad = false; + }; + + //--- Focus on an artillery cannon. + if (MenuAction == 60) then { + MenuAction = -1; + + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [1,.475,getPos(_trackingArray select (lnbCurSelRow 17024))]; + ctrlMapAnimCommit _map; + }; + + //--- Flush on change. + if (_requestMarkerTransition) then { + _requestMarkerTransition = false; + + { + _track = (_x select 0); + _vehicle = (_x select 1); + + _vehicle setVariable ['WFBE_A_Tracked', nil]; + deleteMarkerLocal Format ["WFBE_A_Large%1",_track]; + deleteMarkerLocal Format ["WFBE_A_Small%1",_track]; + } forEach _trackingArrayID; + _trackingArrayID = []; + }; + + //--- Artillery List. + if (paramArty && (_requestRangedList || time - _lastArtyUpdate > 3)) then { + _requestRangedList = false; + + //--- No need to update the list all the time. + if (time - _lastArtyUpdate > 5) then { + _lastArtyUpdate = time; + _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery; + }; + + //--- Clear & Fill; + lnbClear 17024; + _i = 0; + { + _distance = _x distance (getMarkerPos _marker); + _color = [0, 0.875, 0, 0.8]; + _text = localize 'STR_WF_TACTICAL_ArtilleryInRange'; //---changed-MrNiceGuy //"In Range"; + if (_distance > _maxRange) then {_color = [0.875, 0, 0, 0.8];_text = localize 'STR_WF_TACTICAL_ArtilleryOutOfRange'}; //---changed-MrNiceGuy //"Out of Range"}; + if (_distance <= _minRange) then {_color = [0.875, 0.5, 0, 0.8];_text = localize 'STR_WF_TACTICAL_ArtilleryRangeTooClose'}; //---changed-MrNiceGuy //"Too close"}; + lnbAddRow [17024,[[typeOf _x, 'displayName'] Call GetConfigInfo,_text]]; + lnbSetPicture [17024,[_i,0],[typeOf _x, 'picture'] Call GetConfigInfo]; + + lnbSetColor [17024,[_i,0],_color]; + lnbSetColor [17024,[_i,1],_color]; + + _i = _i + 1; + } forEach _trackingArray; + }; + + //--- Artillery map toggle. + if (MenuAction == 40) then { + MenuAction = -1; + if (_mode == -1) then {_mode = 0}; + _mode = if (_mode == 2) then {0} else {_mode + 1}; + with uinamespace do { + switch (_mode) do { + case 0: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [1,1,1,1]}; + case 1: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0,0.635294,0.909803,1]}; + case 2: {(currentBEDialog displayCtrl 17023) ctrlSetTextColor [0.6,0.850980,0.917647,1]}; + }; + }; + + if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + _textAnimHandler = [17022,localize 'STR_WF_TACTICAL_ArtilleryMinimapInfo',7,"ff9900"] spawn SetControlFadeAnim; + + ['WFBE_V_ARTILLERYMINMAP',_mode,true] Call SetNamespace; + + _requestMarkerTransition = true; + }; + + //--- Update artillery display. + if (_mode != -1) then { + + //--- Nothing. + if (_mode == 0) then { + _requestMarkerTransition = true; + _mode = -1; + }; + + //--- Filled Content. + if (_mode == 1 || _mode == 2) then { + //--- Remove if dead or null or sel changed. + { + _track = (_x select 0); + _vehicle = (_x select 1); + + if !(alive _vehicle) then { + deleteMarkerLocal Format ["WFBE_A_Large%1",_track]; + deleteMarkerLocal Format ["WFBE_A_Small%1",_track]; + }; + } forEach _trackingArrayID; + + //--- No need to update the marker all the time. + if (time - _lastArtyUpdate > 5) then { + _lastArtyUpdate = time; + _trackingArray = [group player,true,lbCurSel(17008),sideJoined] Call GetTeamArtillery; + }; + + //--- Live Feed. + _trackingArrayID = []; + { + _track = _x getVariable 'WFBE_A_Tracked'; + if (isNil '_track') then { + _track = buildingMarker; + buildingMarker = buildingMarker + 1; + _x setVariable ['WFBE_A_Tracked', _track]; + _dmarker = Format ["WFBE_A_Large%1",_track]; + createMarkerLocal [_dmarker, getPos _x]; + _dmarker setMarkerColorLocal "ColorBlue"; + _dmarker setMarkerShapeLocal "ELLIPSE"; + _brush = "SOLID"; + if (_mode == 1) then {_brush = "SOLID"}; + if (_mode == 2) then {_brush = "BORDER"}; + _dmarker setMarkerBrushLocal _brush; + _dmarker setMarkerAlphaLocal 0.4; + _dmarker setMarkerSizeLocal [_maxRange,_maxRange]; + _dmarker = Format ["WFBE_A_Small%1",_track]; + createMarkerLocal [_dmarker, getPos _x]; + _dmarker setMarkerColorLocal "ColorBlack"; + _dmarker setMarkerShapeLocal "ELLIPSE"; + _dmarker setMarkerBrushLocal "SOLID"; + _dmarker setMarkerAlphaLocal 0.4; + _dmarker setMarkerSizeLocal [_minRange,_minRange]; + } else { + _dmarker = Format ["WFBE_A_Large%1",_track]; + _dmarker setMarkerPosLocal (getPos _x); + _dmarker = Format ["WFBE_A_Small%1",_track]; + _dmarker setMarkerPosLocal (getPos _x); + }; + _trackingArrayID = _trackingArrayID + [[_track,_x]]; + } forEach _trackingArray; + }; + }; + + _lastRange = artyRange; + _lastSel = lbCurSel(_listbox); + sleep 0.1; + + //--- Back Button. + if (MenuAction == 30) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; + +deleteMarkerLocal _marker; +deleteMarkerLocal _area; +{deleteMarkerLocal _x} forEach _markers; + +if !(scriptDone _textAnimHandler) then {terminate _textAnimHandler}; + +//--- Remove Markers. +{ + _track = (_x select 0); + _vehicle = (_x select 1); + + _vehicle setVariable ['WFBE_A_Tracked', nil]; + + deleteMarkerLocal Format ["WFBE_A_Large%1",_track]; + deleteMarkerLocal Format ["WFBE_A_Small%1",_track]; +} forEach _trackingArrayID; \ No newline at end of file diff --git a/Client/GUI/GUI_Menu_Team.sqf b/Client/GUI/GUI_Menu_Team.sqf new file mode 100644 index 0000000..e243b4b --- /dev/null +++ b/Client/GUI/GUI_Menu_Team.sqf @@ -0,0 +1,145 @@ +disableSerialization; + +_display = _this select 0; +MenuAction = -1; + +_currentVD = viewDistance; +_funds = Call GetPlayerFunds; + +if (votePopUp) then { + ctrlSetText[13019, localize "STR_WF_VOTING_PopUpOffButton"]; +} else { + ctrlSetText[13019, localize "STR_WF_VOTING_PopUpOnButton"]; +}; + +ctrlSetText [13002, Format [localize "STR_WF_TEAM_ViewDistanceLabel",_currentVD]]; +ctrlSetText [13004, Format [localize "STR_WF_TEAM_TerrainGridLabel",currentTG]]; +ctrlSetText [13006, Format [localize "STR_WF_TEAM_MoneyTransfer",0]]; +ctrlSetText [13010, Format [localize "STR_WF_Income",Call GetPlayerFunds,(sideJoined) Call GetIncome]]; + +SliderSetRange[13003,1,('WFBE_MAXVIEWDISTANCE' Call GetNamespace)]; +SliderSetRange[13005,1,('WFBE_MAXCLUTTERDISTANCE' Call GetNamespace)]; +SliderSetRange[13007,0,_funds]; +SliderSetPosition[13003,_currentVD]; +SliderSetPosition[13005,currentTG]; +_lastvd = _currentVD; +_lasttg = currentTG; +_timer = 0; + +_i = 1; +{ + _xtra = if (isPlayer (leader _x)) then {name (leader _x)} else {"AI"}; + lbAdd[13008,Format ["[%1] %2",_i,_xtra]]; + _i = _i + 1; +} forEach clientTeams; +lbSetCurSel[13008,0]; + +_units = ((Units Group player) Call GetLiveUnits); +_units = _units - [player]; +{ + _desc = [typeOf _x, 'displayName'] Call GetConfigInfo; + _finalNumber = (_x) Call GetAIDigit; + _isInVehicle = ""; + if (_x != vehicle _x) then { + _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo; + _isInVehicle = " [" + _descVehi + "] "; + }; + _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle; + lbAdd[13013,_txt]; +} forEach _units; +lbSetCurSel[13013,0]; + +{lbAdd[13018,_x]} forEach ["None","FX 1","FX 2","FX 3","FX 4","FX 5"]; +lbSetCurSel[13018,currentFX]; + +while {alive player && dialog} do { + sleep 0.05; + + if (Side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; + + _curSel = lbCurSel 13008; + _currentVD = Floor (SliderPosition 13003); + currentTG = Floor (SliderPosition 13005); + _transferAmount = Floor (SliderPosition 13007); + + ctrlSetText [13002, Format [localize "STR_WF_TEAM_ViewDistanceLabel",_currentVD]]; + ctrlSetText [13004, Format [localize "STR_WF_TEAM_TerrainGridLabel",currentTG]]; + ctrlSetText [13006, Format [localize "STR_WF_TEAM_MoneyTransfer",_transferAmount]]; + + if (MenuAction == 1) then { + MenuAction = -1; + if ((_transferAmount != 0)&&((clientTeams select _curSel) != group player)) then { + [(clientTeams select _curSel),_transferAmount] Call ChangeTeamFunds; + -_transferAmount Call ChangePlayerFunds; + _funds = Call GetPlayerFunds; + WFBE_LocalizeMessage = [vehicleVarName leader (clientTeams select _curSel),'CLTFNCLOCALIZEMESSAGE',['FundsTransfer',_transferAmount,name player]]; + publicVariable 'WFBE_LocalizeMessage'; + if (isHostedServer) then {[vehicleVarName leader (clientTeams select _curSel),'CLTFNCLOCALIZEMESSAGE',['FundsTransfer',_transferAmount,name player]] Spawn HandlePVF}; + sliderSetRange[13007,0,_funds]; + }; + }; + + if (MenuAction == 3) then { + MenuAction = -1; + _curUnitSel = lbCurSel 13013; + if (_curUnitSel != -1) then { + _vehicle = vehicle (_units select _curUnitSel); + _destroy = [(_units select _curUnitSel)]; + if (_vehicle != (_units select _curUnitSel)) then {_destroy = _destroy + [_vehicle]}; + { + if (_x isKindOf 'Man') then {removeAllWeapons _x}; + _x setDammage 1; + } forEach _destroy; + + _units = ((Units Group player) Call GetLiveUnits); + _units = _units - [leader group player]; + lbClear 13013; + { + _desc = [typeOf _x, 'displayName'] Call GetConfigInfo; + _finalNumber = (_x) Call GetAIDigit; + _isInVehicle = ""; + if (_x != vehicle _x) then { + _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo; + _isInVehicle = " [" + _descVehi + "] "; + }; + _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle; + lbAdd[13013,_txt]; + } forEach _units; + lbSetCurSel[13013,0]; + }; + }; + + if (MenuAction == 6) then { + MenuAction = -1; + currentFX = lbCurSel 13018; + [currentFX] Spawn FX; + }; + + //--- Vote Pop-Up //added-MrNiceGuy + if (MenuAction == 13) then { + MenuAction = -1; + if (votePopUp) then { + votePopUp = false; + ctrlSetText[13019, localize "STR_WF_VOTING_PopUpOnButton"]; + } else { + votePopUp = true; + ctrlSetText[13019, localize "STR_WF_VOTING_PopUpOffButton"]; + }; + }; + + if (_currentVD != _lastvd) then {setViewDistance _currentVD}; + if (currentTG != _lasttg) then {setTerrainGrid currentTG}; + _lastvd = _currentVD; + _lasttg = currentTG; + + if (_timer > 2) then {ctrlSetText [13010, Format [localize "STR_WF_Income",Call GetPlayerFunds,(sideJoined) Call GetIncome]];_timer = 0}; + _timer = _timer + 0.05; + + //--- Back Button. + if (MenuAction == 8) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; diff --git a/Client/GUI/GUI_Menu_UnitCamera.sqf b/Client/GUI/GUI_Menu_UnitCamera.sqf new file mode 100644 index 0000000..a019ad7 --- /dev/null +++ b/Client/GUI/GUI_Menu_UnitCamera.sqf @@ -0,0 +1,89 @@ +disableSerialization; +_display = _this select 0; +MenuAction = -1; +mouseButtonUp = -1; + +_cameraModes = ["Internal","External","Gunner","Group"]; + +_n = 1; +{lbAdd[21002,Format["[%1] %2",_n,name (leader _x)]];_n = _n + 1} forEach clientTeams; +_id = clientTeams find playerTeam; +lbSetCurSel[21002,_id]; +_currentUnit = (player) Call GetUnitVehicle; +_currentMode = "Internal"; +_currentUnit switchCamera _currentMode; +_units = (Units (group player) - [player]) Call GetLiveUnits; +{lbAdd[21004,Format["(%1) %2",getText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units; + +_type = if (!(difficultyEnabled "3rdPersonView")) then {["Internal"]} else {["Internal","External","Ironsight","Group"]}; +{lbAdd[21006,_x]} forEach _type; +lbSetCurSel[21006,0]; + +_map = _display displayCtrl 21007; +_map ctrlMapAnimAdd [0,.25,getPos _currentUnit]; +ctrlMapAnimCommit _map; + +while {true} do { + sleep 0.1; + + _cameraSwap = false; + if (Side player != sideJoined || !dialog) exitWith {}; + + //--- Map click. + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + _near = _map PosScreenToWorld[mouseX,mouseY]; + _list = _near nearEntities [["Man","Car","Motorcycle","Ship","Tank","Air"],200]; + if (count _list > 0) then { + _objects = []; + {if (!(_x isKindOf "Man") && side _x != sideJoined) then {if (count (crew _x) == 0) then {_objects = _objects - [_x]}};if (side _x == sideJoined) then {_objects = _objects + [_x]}} forEach _list; + if (count _objects > 0) then { + _units = [_near,_objects] Call SortByDistance; + _currentUnit = (_units select 0) Call GetUnitVehicle; + _cameraSwap = true; + }; + }; + }; + + //--- Leader Selection. + if (MenuAction == 101) then { + MenuAction = -1; + _selected = leader (clientTeams select (lbCurSel 21002)); + _currentUnit = (_selected) Call GetUnitVehicle; + _n = 0; + _units = (Units (group _selected) - [_selected]) Call GetLiveUnits; + lbClear 21004; + {lbAdd[21004,Format["(%1) %2",GetText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units; + _cameraSwap = true; + }; + + //--- Leader commands AIs. + if (MenuAction == 102) then { + MenuAction = -1; + _currentUnit = (_units select (lbCurSel 21004)) Call GetUnitVehicle; + _cameraSwap = true; + }; + + //--- Camera Modes + if (MenuAction == 103) then { + MenuAction = -1; + _currentMode = (_cameraModes select (lbCurSel 21006)); + _cameraSwap = true; + }; + + if !(alive _currentUnit) then { + _currentUnit = (player) Call GetUnitVehicle; + _cameraSwap = true; + }; + + //--- Update the Camera. + if (_cameraSwap) then { + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [1,.25,getPos _currentUnit]; + ctrlMapAnimCommit _map; + _currentUnit switchCamera _currentMode; + }; +}; + +closeDialog 0; +((player) Call GetUnitVehicle) switchCamera _currentMode; \ No newline at end of file diff --git a/Client/GUI/GUI_Menu_Upgrade.sqf b/Client/GUI/GUI_Menu_Upgrade.sqf new file mode 100644 index 0000000..1ceb51e --- /dev/null +++ b/Client/GUI/GUI_Menu_Upgrade.sqf @@ -0,0 +1,223 @@ +disableSerialization; + +_display = _this select 0; +displayUpgrade = ""; + +MenuAction = -1; +mouseX = -1; +mouseY = -1; + +_requiredFunds = 0; +_requiredSupply = 0; + +_tooltip = _display DisplayCtrl 18998; +_tooltip_text = _display DisplayCtrl 18999; + +_controls = []; +_u = 18001; +_curIDC = _display DisplayCtrl _u; +while {!isNull _curIDC} do {_controls = _controls + [_curIDC];_u = _u + 1;_curIDC = _display DisplayCtrl _u}; + +_level = 0; +_val = 0; +_time = 0; +_name = ''; +_tooltip_text_content = ''; +_canUpgrade = false; +_dependent = false; +_isUpgrading = false; +_lastTimerUpdate = -5; +_upgr = 'WFBE_UPGRADELABELS' Call GetNamespace; +_upgrlev = 'WFBE_UPGRADELEVELS' Call GetNamespace; +_upgrdep = 'WFBE_UPGRADEDEPENDENCIES' Call GetNamespace; +_upgrcond = 'WFBE_UPGRADECONDITION' Call GetNamespace; +_upgrdesc = 'WFBE_UPGRADEDESCRIPTION' Call GetNamespace; //---added MrNiceGuy + + +while {alive player && dialog} do { + if (Side player != sideJoined) exitWith {closeDialog 0}; + if !(dialog) exitWith {}; + + _upgrades = (sideJoinedText) Call GetSideUpgrades; + + if (time - _lastTimerUpdate > 1) then {_lastTimerUpdate = time;_isUpgrading = Call Compile Format ["WFBE_%1_Upgrading",sideJoinedText]}; + + _u = 0; + { + _level = _upgrades select _u; + _maxLevel = _upgrlev select _u; + _dependencie = _upgrdep select _u; + _condition = _upgrcond select _u; + if (_level == _maxLevel) then {_x ctrlSetTextColor [0, 1, 0, 1]}; + if (!_condition) then {_x ctrlSetTextColor [1, 0, 0, 1]}; + if (count _dependencie > 0 && _level != _maxLevel && _condition) then { + if (_upgrades select (_dependencie select 0) < (_dependencie select 1)) then { + _x ctrlSetTextColor [1, 0, 0, 1]; + } else { + if (_level != _maxLevel) then { + _x ctrlSetTextColor [0.75,0.75,0.75,1]; + }; + }; + }; + _u = _u + 1; + } forEach _controls; + + //--- Tooltips. + if (displayUpgrade != "") then { + + switch (displayUpgrade) do { + case "infantry": {_val = 0}; + case "light": {_val = 1}; + case "heavy": {_val = 2}; + case "air": {_val = 3}; + case "parachutist": {_val = 4}; + case "uav": {_val = 5}; + case "supply": {_val = 6}; + case "ambuSpawn": {_val = 7}; + case "airlift": {_val = 8}; + case "flares": {_val = 9}; + case "artillery": {_val = 10}; + case "icbm": {_val = 11}; + case "fasttravel": {_val = 12}; + case "gear": {_val = 13}; + case "ammo": {_val = 14}; + case "easa": {_val = 15}; + case "paradrop": {_val = 16}; + case "shells": {_val = 17}; + }; + + ctrlSetFocus (_controls select _val); + + _dependencie = _upgrdep select _val; + _condition = _upgrcond select _val; + _maxLevel = _upgrlev select _val; + _name = _upgr select _val; + _level = _upgrades select _val; + _desc = _upgrdesc select _val; //---added MrNiceGuy + + + _enabled = true; + if (!_condition) then {_enabled = false}; + if (count _dependencie > 0 && _enabled) then { + if (_upgrades select (_dependencie select 0) < (_dependencie select 1)) then { + _dependent = true; + } else {_dependent = false}; + } else {_dependent = false}; + + _bpath = if (_level == _maxLevel) then {_level} else {_level + 1}; + _time = (Format["WFBE_UPGRADETIMESLEVEL%1",_bpath] Call GetNamespace) select _val; + _needed = (Format["WFBE_UPGRADEPRICESLEVEL%1",_bpath] Call GetNamespace) select _val; + _requiredSupply = _needed select 0; + _requiredFunds = _needed select 1; + + _currentSupply = (sideJoined) Call GetSideSupply; + _currentFunds = Call GetPlayerfunds; + + _colorSupply = "'#ff9900'"; + _colorFunds = "'#ff9900'"; + _hasFunds = true; + if !(paramMoneyOnly) then {if (_currentSupply < _requiredSupply) then {_colorSupply = "'#ff0033'";_hasFunds = false}}; + if (_currentFunds < _requiredFunds) then {_colorFunds = "'#ff0033'";_hasFunds = false}; + + if (!_isUpgrading && _level < _maxLevel && !_dependent && _enabled && _hasFunds) then {_canUpgrade = true} else {_canUpgrade = false}; + + _tooltip_w = 0.30; + _tooltip_h = 0.50; + _tooltip_x = if ((1 - mouseX) < _tooltip_w) then {mouseX - _tooltip_w - 0.02} else {mouseX + 0.02}; + _tooltip_y = if (mouseY > 0.5) then {mouseY - _tooltip_h - 0.02} else {mouseY + 0.02}; + + if (_level != _maxLevel) then { + _supplyCd = if !(paramMoneyOnly) then {Format ["%1
",Format [localize 'STR_WF_UPGRADE_Cost',"" + str(_requiredSupply) + '' + '/' + "" + str(_currentSupply) + ' S']]} else {""}; + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format ["%1

",Format [localize 'STR_WF_UPGRADE_Level',"" + str(_level) + '' + "/" + str(_maxLevel) + '']] + + _supplyCd + + Format ["%1
",Format [localize 'STR_WF_UPGRADE_Cost',"" + str(_requiredFunds) + '' + '/' + "" + str(_currentFunds) + ' $']] + + Format ["%1

",Format [localize 'STR_WF_UPGRADE_Duration',"" + str(_time) + ' ' + localize 'STR_WF_Seconds']] + + Format ["%1
",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */ + Format ["%1
",_desc] /* added MrNiceGuy */ + ); + + if (_isUpgrading) then { + //_tooltip_h = 0.12; + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format ["%1

",Format [localize 'STR_WF_UPGRADE_Level',"" + str(_level) + '' + "/" + str(_maxLevel) + '']] + /* added MrNiceGuy */ + Format ["%1

",localize 'STR_WF_UPGRADE_AlreadyRunning']+ + Format ["%1
",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */ + Format ["%1
",_desc] /* added MrNiceGuy */ + ); + }; + if (!_enabled) then { + //_tooltip_h = 0.12; /* added MrNiceGuy */ + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format ["%1

",localize 'STR_WF_UPGRADE_Condition'] + + Format ["%1
",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */ + Format ["%1
",_desc] /* added MrNiceGuy */ + ); + }; + if (_dependent && !_isUpgrading && _enabled) then { + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format ["%1

",Format [localize 'STR_WF_UPGRADE_Level',"" + str(_level) + '' + "/" + str(_maxLevel) + '']] + /* added MrNiceGuy */ + Format ["%1

",Format[localize 'STR_WF_UPGRADE_Dependent',_upgr select (_dependencie select 0),_dependencie select 1]] + + Format ["%1
",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */ + Format ["%1
",_desc] /* added MrNiceGuy */ + ); + }; + } else { + //_tooltip_h = 0.12; + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format ["%1

",Format [localize 'STR_WF_UPGRADE_Level',"" + str(_level) + '' + "/" + str(_maxLevel) + '']] + /* added MrNiceGuy */ + Format ["%1

",localize 'STR_WF_UPGRADE_Maximum'] + + Format ["%1
",localize 'STR_WF_UPGRADE_Description'] + /* added MrNiceGuy */ + Format ["%1
",_desc] /* added MrNiceGuy */ + + ); + }; + + if ((ctrlPosition _tooltip select 0) == 0 || true) then {_tooltip ctrlSetPosition [_tooltip_x,_tooltip_y,_tooltip_w,_tooltip_h]}; + _tooltip ctrlCommit 0; + + _tooltip_text ctrlSetStructuredText _tooltip_text_content; + if ((ctrlPosition _tooltip_text select 0) == 0 || true) then {_tooltip_text ctrlSetPosition [_tooltip_x,_tooltip_y,_tooltip_w,_tooltip_h]}; + _tooltip_text ctrlCommit 0; + + } else { + if ((ctrlPosition _tooltip select 0) != 0) then {_tooltip ctrlSetPosition [0,0,0,0];_tooltip ctrlCommit 0}; + if ((ctrlPosition _tooltip_text select 0) != 0) then {_tooltip_text ctrlSetPosition [0,0,0,0];_tooltip_text ctrlCommit 0}; + }; + + _commander = false; + if (!isNull(commanderTeam)) then { + if (commanderTeam == group player) then {_commander = true}; + }; + + if (MenuAction == 1 && _canUpgrade && _commander) then { + MenuAction = -1; + -(_requiredFunds) Call ChangePlayerFunds; + if !(paramMoneyOnly) then {[sideJoined, -_requiredSupply] Call ChangeSideSupply}; + + WFBE_RequestUpgrade = ['SRVFNCREQUESTUPGRADE',[_time,_level,_val,_name,sideJoined]]; + publicVariable 'WFBE_RequestUpgrade'; + if (isHostedServer) then {['SRVFNCREQUESTUPGRADE',[_time,_level,_val,_name,sideJoined]] Spawn HandleSPVF}; + + Call Compile Format ["WFBE_%1_Upgrading = true;",sideJoinedText]; + _isUpgrading = true; + hint Format [localize "STR_WF_INFO_Upgrade_Start",_name]; + } else {MenuAction = -1}; + + _txt = if (_isUpgrading) then {localize "STR_WF_UPGRADE_RunningInfo" + "..."} else {""}; + ctrlSetText[18802,_txt]; + + sleep 0.05; + + //--- Back Button. + if (MenuAction == 2) exitWith { //---added-MrNiceGuy + MenuAction = -1; + closeDialog 0; + createDialog "WF_Menu"; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Menu_Voting.sqf b/Client/GUI/GUI_Menu_Voting.sqf new file mode 100644 index 0000000..987f40e --- /dev/null +++ b/Client/GUI/GUI_Menu_Voting.sqf @@ -0,0 +1,75 @@ +MenuAction = -1; //added-MrNiceGuy - Benny`s solution + +_voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText]; +if (_voteTime <= 0) exitWith {}; + +_name = ""; +_lastTeams = []; +_lastTeam = -2; + +_lastVotes = [sideJoined] Call GetCommanderVotes; + +while {true} do { + sleep 0.1; + + if (!(alive player) || Side player != sideJoined) exitWith {CloseDialog 0;_exit = true}; + if !(dialog) exitWith {}; + + _commanderTeam = [sideJoined] Call GetCommanderFromVotes; + if (IsNull _commanderTeam) then {_name = Localize "STR_WF_AI"} else {_name = name leader _commanderTeam}; + + _voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText]; + ctrlSetText [10007,Format ["%1",_name]]; //changed-MrNiceGuy + ctrlSetText [10008,Format ["%2: %3",_name,Localize "STR_WF_VOTING_TimeLeft",_voteTime]]; //added-MrNiceGuy + + if (_voteTime <= 0) exitWith {CloseDialog 0}; + + _refresh = false; + _playerSlots = []; + { + if !(isNil '_x') then {if (isPlayer (leader _x)) then {_playerSlots = _playerSlots + [_x]}}; + } forEach clientTeams; + + _count = 0; + _votes = [sideJoined] Call GetCommanderVotes; + + {if (_x != (_votes Select _count)) then {_refresh = true};_count = _count + 1} ForEach _lastVotes; + {if !(_x In _lastTeams) then {_refresh = true}} ForEach _playerSlots; + {if !(_x In _playerSlots) then {_refresh = true}} ForEach _lastTeams; + + if (_refresh) then { + + _reselect = false; + _selected = lbCurSel 10006; + _selectedTeam = lbValue[10006,_selected]; + _selectedText = lbText[10006,_selected]; + _lastVotes = _votes; + + if (_selected != -1) then {_reselect = true}; + + lbClear 10006; + _AI = lbAdd[10006,Format["%1 %2",_votes select 0,Localize "STR_WF_AI"]]; + lbSetValue [10006,_AI,-1]; + + _count = 0; + _total = 1; + + { + if !(isNil '_x') then {if (_x In _playerSlots) then {_total = _total + 1;_selection = lbAdd[10006,Format ["%1 %2",_votes select _count+1,name (leader _x)]];lbSetValue [10006,_selection,_count]}};_count = _count + 1; + } forEach clientTeams; + _lastTeams = +_playerSlots; + + if (_reselect) then { + _selected = 0; + for [{_count = 0},{_count < _total},{_count = _count + 1}] do {if (lbValue[10006,_count] == _selectedTeam) then {_selected = _count}}; + lbSetCurSel[10006,_selected]; + }; + }; + + _selected = lbCurSel 10006; + if (_selected != -1) then { + _selectedTeam = lbValue[10006,_selected]; + if (_selectedTeam != _lastTeam) then {Call Compile Format["%1Team%2Vote = _selectedTeam;publicVariable '%1Team%2Vote';",sideJoinedText,clientID]}; + _lastTeam = _selectedTeam; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_MissionTasks.sqf b/Client/GUI/GUI_MissionTasks.sqf new file mode 100644 index 0000000..e5700b6 --- /dev/null +++ b/Client/GUI/GUI_MissionTasks.sqf @@ -0,0 +1,65 @@ + +private ["_locations","_sideID","_names","_skip","_curSel","_display","_map","_sorted"]; +disableSerialization; + +MenuAction = -1; +mouseButtonUp = -1; + +_display = _this select 0; +_map = _display DisplayCtrl 19002; + +if (isNull currentMission) then {ctrlSetText [19007,Format [localize "STR_WF_CurrentMission","N/A"]]} else {ctrlSetText [19007,Format [localize "STR_WF_CurrentMission",currentMission getVariable "name"]];}; + +_names = []; +_locations = []; +{_sideID = _x getVariable "sideID"; if (_sideID != sideID) then {_locations = _locations + [_x]}} forEach towns; +_sorted = [player,_locations] Call SortByDistance; +{_names = _names + [_x getVariable "name"]} forEach _sorted; + +{lbAdd[19005,_x]} forEach _names; +if (count _sorted > 0) then { + lbSetCurSel[19005,0]; + _map CtrlMapAnimAdd [2,.140,GetPos (_sorted select 0)]; + CtrlMapAnimCommit _map; +}; + +while {alive player && dialog} do { + sleep 0.1; + if (Side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; + + //--- Accept Mision. + if (MenuAction == 1) then { + MenuAction = -1; + _skip = false; + if (!isNil "townTask") then {if (taskState townTask == "Succeeded") then {["TownRemove",currentMission] Call TaskSystem;currentMission = objNull}} ; + if (!isNull currentMission) then {hint (localize "STR_WF_Mission_Running");_skip = true}; + if (!_skip) then { + _curSel = lbCurSel (19005); + currentMission = _sorted select _curSel; + ctrlSetText [19007,Format [localize "STR_WF_CurrentMission",currentMission getVariable "name"]]; + //--- Task System. + ["TownAdd",currentMission] Spawn TaskSystem; + }; + }; + + //--- Abort Mision. + if (MenuAction == 2) then { + MenuAction = -1; + if (!isNull currentMission) then { + ["TownRemove",currentMission] Call TaskSystem; + ctrlSetText [19007,Format [localize "STR_WF_CurrentMission","N/A"]]; + currentMission = objNull; + hint (localize "STR_WF_Mission_Abort"); + }; + }; + + //--- Other Town selected. + if (MenuAction == 101) then { + MenuAction = -1; + _curSel = lbCurSel (19005); + CtrlMapAnimClear _map; + _map CtrlMapAnimAdd [2,.140,GetPos (_sorted select _curSel)]; + CtrlMapAnimCommit _map; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Parameters.sqf b/Client/GUI/GUI_Parameters.sqf new file mode 100644 index 0000000..4f93ce9 --- /dev/null +++ b/Client/GUI/GUI_Parameters.sqf @@ -0,0 +1,23 @@ +/* Ingame parameters dump. */ +private ["_i","_paramName","_text","_values","_texts","_value","_status","_uptime","_getTime"]; + +for [{_i = 0},{_i < (count (missionConfigFile/"Params"))},{_i = _i + 1}] do { + _paramName = (configName ((missionConfigFile >> "Params") select _i)); + _text = getText (missionConfigFile >> "Params" >> _paramName >> "title"); + _values = getArray (missionConfigFile >> "Params" >> _paramName >> "values"); + _texts = getArray (missionConfigFile >> "Params" >> _paramName >> "texts"); + + _value = if (isMultiplayer) then {paramsArray select _i} else {getNumber (missionConfigFile >> "Params" >> _paramName >> "default")}; + _status = _texts select (_values find _value); + + lnbAddRow [22003,[_text,_status]]; +}; + +while {alive player && dialog} do { + _uptime = Call GetTime; + ctrlSetText [22005,Format[localize 'STR_WF_Uptime',_uptime select 0,_uptime select 1,_uptime select 2, _uptime select 3]]; + + sleep 0.1; + if (side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Respawn.sqf b/Client/GUI/GUI_Respawn.sqf new file mode 100644 index 0000000..897080a --- /dev/null +++ b/Client/GUI/GUI_Respawn.sqf @@ -0,0 +1,156 @@ +private ["_display", "_map", "_hq", "_respawnCampsRuleMode", "_availableSpawn", "_buildings", "_checks", "_mobileRespawns", "_upgrades", "_range", "_farps", "_markers", "_markerIndex", "_markerName", "_spawn", "_ta", "_position", "_sorted", "_loadDefault", "_mode", "_skip", "_price", "_funds", "_safeArray", "_temp", "_listbp", "_weaps"]; +disableSerialization; + +MenuAction = -1; +mouseButtonUp = -1; +_display = _this select 0; +_map = _display displayCtrl 15001; + +_spawn = objNull; +_availableSpawn = []; +_markers = []; +_markerIndex = 0; +_ta = ""; +_lastSpawnUpdate = 0; + +//--- Wait until the player respawned. +waitUntil {alive player}; + +//--- Position the player at the temp location during his respawn. +player setPos ([getMarkerPos Format["%1TempRespawnMarker",sideJoinedText],1,10] Call GetRandomPosition); +if (leader(group player) != player) then {(group player) selectLeader player}; + +//--- Call the pre respawn routine. +(player) Call PreRespawnHandler; + +//--- Spawn a countdown thread. +respawnDone = false; +_handleTimer = [] Spawn { + if (isNil 'respawnStatus') then {respawnStatus = 'WFBE_RESPAWNDELAY' Call GetNamespace}; + while {respawnStatus >= 0} do { + sleep 1; + respawnStatus = respawnStatus - 1; + }; + respawnDone = true; +}; + +//--- Run the main respawn thread. +while {!respawnDone} do { + //--- Exit the thread if the client died. + if !(alive player) exitWith {}; + + //--- Loadout Selection. + ctrlSetText [15004, if (WFBE_RespawnDefaultGear) then {"D"} else {"C"}]; + + //--- Preloading Status. + ctrlSetText [15005, if (WFBE_EnablePreload) then {"P"} else {"N"}]; + + //--- Update the respawn info. + if (time - _lastSpawnUpdate > 2) then { + _lastSpawnUpdate = time; + _lastAvailableSpawn = _availableSpawn; + _availableSpawn = [sideJoined,deathLocation] Call GetRespawnAvailable; + + //--- First launch. + if (isNull _spawn) then { + _spawn = _availableSpawn select 0; + _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim; + respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo; + }; + + //--- Properly update the client's map - Update removal. + _found = false; + { + if !(_x in _availableSpawn) then { + _mid = _x getVariable 'WFBE_IDRMarker'; + _markers = _markers - [_mid]; + deleteMarkerLocal _mid; + _x setVariable ['WFBE_IDRMarker',nil]; + if (_x == _spawn && !_found) then { + _found = true; + _spawn = ([_x, _availableSpawn] Call SortByDistance) select 0; + terminate _ta; + deleteMarkerLocal "TempAnim"; + _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim; + respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo; + }; + }; + } forEach _lastAvailableSpawn; + + //--- Properly update the client's map - Update add. + { + if !(_x in _lastAvailableSpawn) then { + _markerName = Format ["respawnMarker%1",_markerIndex]; + _markers = _markers + [_markerName]; + createMarkerLocal [_markerName,getPos _x]; + _markerName setMarkerTypeLocal "Select"; + _markerName setMarkerColorLocal "ColorYellow"; + _markerName setMarkerSizeLocal [1,1]; + _markerIndex = _markerIndex + 1; + _x setVariable ['WFBE_IDRMarker',_markerName]; + }; + } forEach _availableSpawn; + }; + + //--- Update the respawn timer. + ctrlSetText [15003,Format [localize "STR_WF_RespawnStatus",respawnStatus,respawnName]]; + + //--- The client has clicked on the map. + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + if (count _availableSpawn > 1) then { + _position = _map PosScreenToWorld[mouseX,mouseY]; + _sorted = [_position,_availableSpawn] Call SortByDistance; + if ((_sorted select 0) distance _position < 500) then { + _spawn = _sorted select 0; + activeAnimMarker = false; + terminate _ta; + deleteMarkerLocal "TempAnim"; + _ta = ["TempAnim",getPos _spawn,"Select",1.4,"ColorBlue",1.4,1.8] Spawn MarkerAnim; + respawnName = [typeOf _spawn, 'displayName'] Call GetConfigInfo; + }; + }; + }; + + sleep 0.1; +}; + +//--- If the spawn is null, we use the HQ. +if (isNull _spawn) then { + _hq = (sideJoinedText) Call GetSideHQ; + _spawn = _hq; +}; + +//--- Pre-render. +if (WFBE_EnablePreload) then { + ctrlSetText [15003,localize 'STR_WF_Preload']; + waitUntil{preloadCamera (getPos _spawn) || !(alive player)}; +}; + +//--- Execute on respawn code only if the player's alive. +if (alive player) then { + [player,_spawn] Call OnRespawnHandler; +}; + +//--- Terminate the threads & cleaning. +{deleteMarkerLocal _x} forEach _markers; +{_x setVariable ['WFBE_IDRMarker',nil]} forEach _availableSpawn; +if !(isNil "DeathCamera") then { + DeathCamera cameraEffect["TERMINATE","BACK"]; + camDestroy DeathCamera; +}; + +"dynamicBlur" ppEffectEnable false; +"colorCorrections" ppEffectEnable false; +[currentFX] Spawn FX; +terminate _ta; +if !(scriptDone _handleTimer) then {terminate _handleTimer}; +deleteMarkerLocal "TempAnim"; +activeAnimMarker = false; +playerDead = false; +respawnDone = nil; +respawnName = nil; +respawnStatus = nil; +closeDialog 0; + +hint (localize "STR_WF_RespawnInfo"); \ No newline at end of file diff --git a/Client/GUI/GUI_SetCurrentCutDisplay.sqf b/Client/GUI/GUI_SetCurrentCutDisplay.sqf new file mode 100644 index 0000000..546a648 --- /dev/null +++ b/Client/GUI/GUI_SetCurrentCutDisplay.sqf @@ -0,0 +1 @@ +["currentCutDisplay", _this Select 0] call BIS_FNC_GUIset; \ No newline at end of file diff --git a/Client/GUI/GUI_SupportMenu.sqf b/Client/GUI/GUI_SupportMenu.sqf new file mode 100644 index 0000000..282ee37 --- /dev/null +++ b/Client/GUI/GUI_SupportMenu.sqf @@ -0,0 +1,271 @@ +MenuAction = -1; + +_vehi = [group player,false] Call GetTeamVehicles; +_alives = (units group player) Call GetLiveUnits; +{if (vehicle _x == _x) then {_vehi = _vehi + [_x]}} forEach _alives; +_lastUse = 0; +ctrlEnable [20007,false]; +_typeRepair = Format['WFBE_%1REPAIRTRUCKS',sideJoinedText] Call GetNamespace; +_ss = 'WFBE_SUPPLYSYSTEM' Call GetNamespace; +_sheal = 'WFBE_SUPPORTHEALTIME' Call GetNamespace; +_srearm = 'WFBE_SUPPORTREARMTIME' Call GetNamespace; +_srefuel = 'WFBE_SUPPORTREFUELTIME' Call GetNamespace; +_srepair = 'WFBE_SUPPORTREPAIRTIME' Call GetNamespace; + +_healPrice = 0; +_repairPrice = 0; +_refuelPrice = 0; +_rearmPrice = 0; +_lastVeh = objNull; +_lastDmg = 0; +_lastFue = 0; + +_buildings = (sideJoinedText) Call GetSideStructures; + +//--- Service Point. +_csp = objNull; +_sp = [sideJoined, Format ["WFBE_%1SERVICEPOINTTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories; +if (count _sp > 0) then { + _sorted = [player,_sp] Call SortByDistance; + _csp = _sorted select 0; +}; + +if (paramEASA) then { + _enable = false; + _currentUpgrades = (sideJoinedText) Call GetSideUpgrades; + _easaLevel = _currentUpgrades select 15; + if (!(isNull _csp) && _easaLevel > 0) then { + if (player distance _csp < ('WFBE_SUPPORTRANGE' Call GetNamespace)) then { + if (typeOf(vehicle player) in ('WFBE_EASA_Vehicles' Call GetNamespace)) then { + if (driver (vehicle player) == player) then {_enable = true}; + }; + }; + }; + ctrlEnable [20010,_enable]; +} else { + ctrlEnable [20010,false]; +}; + +_effective = []; +_nearSupport = []; +_spType = Call Compile Format ["%1SP",sideJoinedText]; +_i = 0; +{ + _closestSP = objNull; + _add = false; + + _nearSupport set [_i, []]; + + //--- Service Point. + if (count _sp > 0) then { + _sorted = [_x,_sp] Call SortByDistance; + _closestSP = _sorted select 0; + if !(isNull _closestSP) then { + if (_x distance _closestSP < ('WFBE_SUPPORTRANGE' Call GetNamespace)) then { + _add = true; + _nearSupport set [_i,(_nearSupport select _i) + [_closestSP]]; + }; + }; + }; + + //--- Depots. + _nObjects = nearestObjects [_x, WFDEPOT,('WFBE_SUPPORTRANGE' Call GetNamespace)]; + _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull}; + if !(isNull _nObject) then { + _sideID = _nObject getVariable "sideID"; + if !(isNil "_sideID") then { + if (_sideID == sideID) then { + _add = true; + _nearSupport set [_i,(_nearSupport select _i) + [_nObject]]; + }; + }; + }; + + //--- Repairs Trucks. + _checks = (getPos _x) nearEntities[_typeRepair,'WFBE_REPAIRTRUCKRANGE' Call GetNamespace]; + if (count _checks > 0) then { + _add = true; + _nearSupport set [_i,(_nearSupport select _i) + _checks]; + }; + + //--- Add the vehicle ? + if (_add) then { + _effective = _effective + [_x]; + _desc = [typeOf _x, 'displayName'] Call GetConfigInfo; + _finalNumber = (_x) Call GetAIDigit; + _isInVehicle = ""; + if (_x != vehicle _x) then { + _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo; + _isInVehicle = " [" + _descVehi + "] "; + }; + _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle; + lbAdd[20002,_txt]; + + _i = _i + 1; + }; +} forEach _vehi; + +_checks = (getPos player) nearEntities[_typeRepair,'WFBE_REPAIRTRUCKRANGE' Call GetNamespace]; +if (count _checks > 0) then { + _repair = _checks select 0; + _vehi = ((getPos _repair) nearEntities[["Car","Motorcycle","Tank","Air","Ship","StaticWeapon"],100]) - [_repair]; + { + if !(_x in _effective) then { + _effective = _effective + [_x]; + _nearSupport set [_i,[_repair]]; + _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo; + lbAdd[20002,_descVehi]; + + _i = _i + 1; + }; + } forEach _vehi; +}; + +if (count _effective > 0) then {lbSetCurSel[20002,0]}; + +while {true} do { + sleep 0.1; + + if (Side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; + _curSel = lbCurSel(20002); + + _isCommander = false; + + if (!isNull(commanderTeam)) then {if (commanderTeam == Group player) then {_isCommander = true}}; + _enabled = if (time - _lastUse > 5 && _isCommander && _ss == 0) then {true} else {false}; + ctrlEnable [20007,_enabled]; + + if (_curSel != -1) then { + _veh = (vehicle (_effective select _curSel)); + _funds = Call GetPlayerFunds; + + if (_veh isKindOf "Man") then { + {ctrlEnable [_x,false]} forEach [20003,20004,20005]; + _enabled = if (_funds >= _healPrice) then {true} else {false}; + ctrlEnable [20008,_enabled]; + //--- Healing. + _healPrice = round((getDammage _veh)*('WFBE_SUPPORTHEALPRICE' Call GetNamespace)); + ctrlSetText [20011,"$0."]; + ctrlSetText [20012,"$0."]; + ctrlSetText [20013,"$0."]; + ctrlSetText [20014,"$"+str(_healPrice)+"."]; + } else { + //--- Prevent on the air re-supply. + _canBeUsed = if ((getPos _veh) select 2 <= 2 && speed _veh <= 20) then {true} else {false}; + _enabled = if (_canBeUsed && _funds >= _rearmPrice) then {true} else {false}; + ctrlEnable [20003,_enabled]; + _enabled = if (_canBeUsed && _funds >= _repairPrice) then {true} else {false}; + ctrlEnable [20004,_enabled]; + _enabled = if (_canBeUsed && _funds >= _refuelPrice) then {true} else {false}; + ctrlEnable [20005,_enabled]; + _enabled = if (_canBeUsed && _funds >= _healPrice) then {true} else {false}; + ctrlEnable [20008,_enabled]; + //--- Healing. + _healPrice = 0; + { + if (alive _x) then {_healPrice = _healPrice + round((getDammage _x)*('WFBE_SUPPORTHEALPRICE' Call GetNamespace))}; + } forEach (crew _veh); + ctrlSetText [20014,"$"+str(_healPrice)+"."]; + //--- Repair. + if (_veh != _lastVeh || getDammage _veh != _lastDmg) then { + _type = typeOf _veh; + _lastDmg = getDammage _veh; + _get = _type Call GetNamespace; + if !(isNil '_get') then { + _repairPrice = round((getDammage _veh)*((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREPAIRPRICE' Call GetNamespace))); + } else { + _repairPrice = 500; + }; + }; + ctrlSetText [20012,"$"+str(_repairPrice)+"."]; + //--- Rearm. + if (_veh != _lastVeh) then { + _type = typeOf _veh; + _get = _type Call GetNamespace; + if !(isNil '_get') then { + _rearmPrice = round((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREARMPRICE' Call GetNamespace)); + } else { + _rearmPrice = 500; + }; + }; + ctrlSetText [20011,"$"+str(_rearmPrice)+"."]; + //--- Refuel. + if (_veh != _lastVeh || fuel _veh != _lastFue) then { + _type = typeOf _veh; + _lastFue = fuel _veh; + _get = _type Call GetNamespace; + if !(isNil '_get') then { + _fuel = ((fuel _veh) -1) * -1; + _refuelPrice = round(_fuel*((_get select QUERYUNITPRICE)/('WFBE_SUPPORTREFUELPRICE' Call GetNamespace))); + } else { + _refuelPrice = 200; + }; + }; + ctrlSetText [20013,"$"+str(_refuelPrice)+"."]; + }; + + _lastVeh = _veh; + + //--- Rearm. + if (MenuAction == 1) then { + MenuAction = -1; + -_rearmPrice Call ChangePlayerFunds; + + //--- Spawn a Rearm thread. + [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRearm; + }; + + //--- Repair. + if (MenuAction == 2) then { + MenuAction = -1; + -_repairPrice Call ChangePlayerFunds; + + //--- Spawn a Repair thread. + [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRepair; + }; + + //--- Refuel. + if (MenuAction == 3) then { + MenuAction = -1; + -_refuelPrice Call ChangePlayerFunds; + + //--- Spawn a Refuel thread. + [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportRefuel; + }; + + //--- Heal. + if (MenuAction == 5) then { + MenuAction = -1; + -_healPrice Call ChangePlayerFunds; + + //--- Spawn a Healing thread. + [_veh,_nearSupport select _curSel,_typeRepair,_spType] Spawn SupportHeal; + }; + } else { + {ctrlEnable[_x,false]} forEach [20003,20004,20005,20008]; + }; + + //--- Respawn Supply Trucks. + if (MenuAction == 4) then { + MenuAction = -1; + WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["RespawnST",sideJoined]]; + publicVariable 'WFBE_RequestSpecial'; + if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["RespawnST",sideJoined]] Spawn HandleSPVF}; + _lastUse = time; + }; + + //--- EASA. TBD: Add dialog; + if (MenuAction == 7) then { + MenuAction = -1; + closeDialog 0; + createDialog "RscDisplayEASA"; + }; + + //--- Parameters. + if (MenuAction == 6) exitWith { + MenuAction = -1; + closeDialog 0; + createDialog "RscDisplayIngameParameters"; + }; +}; diff --git a/Client/GUI/GUI_TeamMenu.sqf b/Client/GUI/GUI_TeamMenu.sqf new file mode 100644 index 0000000..2206ad3 --- /dev/null +++ b/Client/GUI/GUI_TeamMenu.sqf @@ -0,0 +1,174 @@ + +private ["_xtra","_i","_descVehi","_isInVehicle","_desc","_text","_amount","_val","_val2", +"_ainumber","_finalNumber","_txt","_funds","_objects","_vehicle","_destroy","_units","_curUnitSel", +"_pos","_vehi","_timer","_curSel","_currentVD","_transferAmount","_lastvd","_lasttg","_is","_x"]; +disableSerialization; + +MenuAction = -1; + +switch (votePopUp) do { + case true: {CtrlShow [13017,false]}; + case false: {CtrlShow [13016,false]}; +}; + +_currentVD = viewDistance; +_funds = Call GetPlayerFunds; +ctrlSetText [13002, Format [localize "STR_WF_ViewDistance",_currentVD]]; +ctrlSetText [13004, Format [localize "STR_WF_TerrainGrid",currentTG]]; +ctrlSetText [13006, Format [localize "STR_WF_MoneyTransfer",0]]; +ctrlSetText [13010, Format [localize "STR_WF_Income",Call GetPlayerFunds,(sideJoined) Call GetIncome]]; + +SliderSetRange[13003,1,('WFBE_MAXVIEWDISTANCE' Call GetNamespace)]; +SliderSetRange[13005,1,('WFBE_MAXCLUTTERDISTANCE' Call GetNamespace)]; +SliderSetRange[13007,0,_funds]; +SliderSetPosition[13003,_currentVD]; +SliderSetPosition[13005,currentTG]; +_lastvd = _currentVD; +_lasttg = currentTG; +_timer = 0; + +_i = 1; +{ + _xtra = if (isPlayer (leader _x)) then {name (leader _x)} else {"AI"}; + lbAdd[13008,Format ["[%1] %2",_i,_xtra]]; + _i = _i + 1; +} forEach clientTeams; +lbSetCurSel[13008,0]; + +_units = ((Units Group player) Call GetLiveUnits); +_units = _units - [player]; +{ + _desc = [typeOf _x, 'displayName'] Call GetConfigInfo; + _finalNumber = (_x) Call GetAIDigit; + _isInVehicle = ""; + if (_x != vehicle _x) then { + _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo; + _isInVehicle = " [" + _descVehi + "] "; + }; + _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle; + lbAdd[13013,_txt]; +} forEach _units; +lbSetCurSel[13013,0]; + +{lbAdd[13018,_x]} forEach ["None","FX 1","FX 2","FX 3","FX 4","FX 5"]; +lbSetCurSel[13018,currentFX]; + +while {alive player && dialog} do { + sleep 0.05; + + if (Side player != sideJoined) exitWith {closeDialog 0}; + if (!dialog) exitWith {}; + + _curSel = lbCurSel 13008; + _currentVD = Floor (SliderPosition 13003); + currentTG = Floor (SliderPosition 13005); + _transferAmount = Floor (SliderPosition 13007); + + ctrlSetText [13002, Format [localize "STR_WF_ViewDistance",_currentVD]]; + ctrlSetText [13004, Format [localize "STR_WF_TerrainGrid",currentTG]]; + ctrlSetText [13006, Format [localize "STR_WF_MoneyTransfer",_transferAmount]]; + + if (MenuAction == 1) then { + MenuAction = -1; + if ((_transferAmount != 0)&&((clientTeams select _curSel) != group player)) then { + [(clientTeams select _curSel),_transferAmount] Call ChangeTeamFunds; + -_transferAmount Call ChangePlayerFunds; + _funds = Call GetPlayerFunds; + WFBE_LocalizeMessage = [vehicleVarName leader (clientTeams select _curSel),'CLTFNCLOCALIZEMESSAGE',['FundsTransfer',_transferAmount,name player]]; + publicVariable 'WFBE_LocalizeMessage'; + if (isHostedServer) then {[vehicleVarName leader (clientTeams select _curSel),'CLTFNCLOCALIZEMESSAGE',['FundsTransfer',_transferAmount,name player]] Spawn HandlePVF}; + sliderSetRange[13007,0,_funds]; + }; + }; + + if (MenuAction == 2) then { + MenuAction = -1; + _vehicle = vehicle player; + if (player != _vehicle) then { + if (getPos _vehicle select 2 > 3 && !surfaceIsWater (getPos _x)) then { + [_vehicle, getPos _vehicle, 15] Call PlaceSafe; + } else { + _vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 0.5]; + _vehicle setVelocity [0,0,-0.5]; + }; + }; + if (player == _vehicle) then { + _objects = player nearEntities[["Car","Motorcycle","Tank"],10]; + if (count _objects > 0) then { + { + if (getPos _x select 2 > 3 && !surfaceIsWater (getPos _x)) then { + [_x, getPos _x, 15] Call PlaceSafe; + } else { + _x setPos [getPos _x select 0, getPos _x select 1, 0.5]; + _x setVelocity [0,0,-0.5]; + }; + } forEach _objects; + }; + }; + }; + + if (MenuAction == 3) then { + MenuAction = -1; + _curUnitSel = lbCurSel 13013; + if (_curUnitSel != -1) then { + _vehicle = vehicle (_units select _curUnitSel); + _destroy = [(_units select _curUnitSel)]; + if (_vehicle != (_units select _curUnitSel)) then {_destroy = _destroy + [_vehicle]}; + { + if (_x isKindOf 'Man') then {removeAllWeapons _x}; + _x setDammage 1; + } forEach _destroy; + + _units = ((Units Group player) Call GetLiveUnits); + _units = _units - [leader group player]; + lbClear 13013; + { + _desc = [typeOf _x, 'displayName'] Call GetConfigInfo; + _finalNumber = (_x) Call GetAIDigit; + _isInVehicle = ""; + if (_x != vehicle _x) then { + _descVehi = [typeOf (vehicle _x), 'displayName'] Call GetConfigInfo; + _isInVehicle = " [" + _descVehi + "] "; + }; + _txt = "["+_finalNumber+"] "+ _desc + _isInVehicle; + lbAdd[13013,_txt]; + } forEach _units; + lbSetCurSel[13013,0]; + }; + }; + + if (MenuAction == 4) then { + MenuAction = -1; + closeDialog 0; + titleCut["","BLACK FADED",0]; + _pos = position player; + _vehi = "Lada1" createVehicle [0,0,0]; + player moveInCargo _vehi; + deleteVehicle _vehi; + player setPos _pos; + titleCut["","BLACK IN",5]; + }; + + if (MenuAction == 5) then { + MenuAction = -1; + if (votePopUp) then {votePopUp = false} else {votePopUp = true}; + switch (votePopUp) do { + case true: {CtrlShow [13017,false];CtrlShow [13016,true]}; + case false: {CtrlShow [13016,false];CtrlShow [13017,true]}; + }; + }; + + if (MenuAction == 6) then { + MenuAction = -1; + currentFX = lbCurSel 13018; + [currentFX] Spawn FX; + }; + + if (_currentVD != _lastvd) then {setViewDistance _currentVD}; + if (currentTG != _lasttg) then {setTerrainGrid currentTG}; + _lastvd = _currentVD; + _lasttg = currentTG; + + if (_timer > 2) then {ctrlSetText [13010, Format [localize "STR_WF_Income",Call GetPlayerFunds,(sideJoined) Call GetIncome]];_timer = 0}; + _timer = _timer + 0.05; +}; diff --git a/Client/GUI/GUI_TeamOrders.sqf b/Client/GUI/GUI_TeamOrders.sqf new file mode 100644 index 0000000..3b67594 --- /dev/null +++ b/Client/GUI/GUI_TeamOrders.sqf @@ -0,0 +1,571 @@ +private ["_display","_mode","_updateProperties","_updateRespawn","_updateTab","_IDCTeam", +"_IDCTasks","_IDCDetails","_TaskTypes","_TaskDuration","_TaskDurationLabel","_radio","_radioLabel", +"_detailGroup","_u","_templates","_curSel","_team","_index","_txt","_map","_behaviors","_combatModes", +"_formations","_speeds","_structures","_hq","_structuresLbl","_nearest","_nearTown","_type","_lbl", +"_fillList","_isAll","_enable","_currentCoord","_currentMission","_position","_special","_isDisabled","_color", +"_order","_isAdded","_array","_existingStruct","_closest","_id","_supplyB","_supply","_taskType", +"_taskTime","_taskTimeLabel","_curType","_behavior","_combat","_formation","_speed","_to","_respawn","_iddx","_unit"]; + +disableSerialization; + +MenuAction = -1; +mouseButtonUp = -1; +_display = _this select 0; + +//--- Alt. +_mode = 0; //--- Team properties. + +_updateProperties = true; +_updateRespawn = true; +_updateTab = false; + +_IDCTeam = [14009,14010,14016,14017,14018,14019,14020,14021,14022,14023,14024,14025,14026,14027,14030,14031,14901,14902]; +_IDCTasks = [14017,14018,14021,14022,14030,14032]; +_IDCDetails = [14030,14041,14042,14043]; +{ctrlShow[_x,false]} forEach (_IDCTasks + _IDCDetails); +{ctrlShow[_x,true]} forEach _IDCTeam; +_TaskTypes = ["Assist","Attack","Defend","Destroy","Guard","Hold","Patrol","Move","Search and Destroy","Seize","Support"]; +_TaskDuration = [1,2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60]; +_TaskDurationLabel = ["1 Min","2 Min","3 Min","4 Min","5 Min","6 Min","7 Min","8 Min","9 Min","10 Min","15 Min","20 Min","25 Min","30 Min","35 Min","40 Min","45 Min","50 Min","55 Min","60 Min"]; +_radio = ["all","alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa"]; +_radioLabel = ["All","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa"]; +_detailGroup = []; + +ctrlSetText [14026,localize "STR_WF_Respawn" + " :"]; + +_listbox_teams = _display displayCtrl 14012; +_u = 1; +lbAdd[14012,localize "STR_WF_All"]; +{lbAdd [14012,Format["[%1] %2",_u,name (leader _x)]];_u = _u + 1} forEach clientTeams; +lbSetCurSel [14012,1]; + +_templates = Format["WFBE_%1AITEAMTEMPLATEDESCRIPTIONS",sideJoinedText] Call GetNamespace; +_templates_upgrades = Format["WFBE_%1AITEAMUPGRADES",sideJoinedText] Call GetNamespace; +_upgrades = (sideJoined) Call GetSideUpgrades; +_u = 0; +_i = 0; +{ + _temp_upgr = _templates_upgrades select _i; + + _canAdd = true; + for '_k' from 0 to 3 do { + if ((_temp_upgr select _k) > (_upgrades select _k)) exitWith {_canAdd = false}; + }; + + if (_canAdd) then { + lbAdd [14010,_x]; + lbSetValue [14010, _u, _i]; + _u = _u + 1; + }; + _i = _i + 1; +} forEach _templates; +lbSort (_display displayCtrl 14010); + +_curSel = lbCurSel 14012; +_teams = []; +_team = if (_curSel != 0) then {clientTeams select (_curSel - 1)} else {clientTeams select (_curSel + 1)}; + +_index = (_team) Call GetTeamType; +if (_index == -1) then {_index = 1}; +lbSetCurSel [14010,[14010,_index] Call UIFindLBValue]; + +_txt = (_team) Call GetTeamMoveMode; +if (_txt == "" || _txt == "towns") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_TakeTowns"}; +if (_txt == "move") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Move"}; +if (_txt == "patrol") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Patrol"}; +if (_txt == "defense") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Defense"}; +ctrlSetText [14013,_txt]; + +_map = _display displayCtrl 14002; +//_map ctrlMapAnimAdd [1,.075,getPos (leader(clientTeams select 0))]; +//ctrlMapAnimCommit _map; + +ctrlEnable [14015,false]; +ctrlEnable [14014,false]; + +//--- Set the combo properties. +_behaviors = ["AWARE","CARELESS","COMBAT","SAFE","STEALTH"]; +_combatModes = ["BLUE","GREEN","RED","WHITE","YELLOW"]; +_formations = ["COLUMN","DIAMOND","ECH LEFT","ECH RIGHT","FILE","LINE","STAG COLUMN","VEE","WEDGE"]; +_speeds = ["LIMITED","FULL","NORMAL"]; + +{lbAdd [14017, _x]} forEach _behaviors; +{lbAdd [14018, _x]} forEach _combatModes; +{lbAdd [14019, _x]} forEach _formations; +{lbAdd [14020, _x]} forEach _speeds; + +_structures = [""]; +_hq = (sideJoinedText) Call GetSideHQ; +if (alive _hq) then {_structures = _structures + [_hq]}; +_structures = _structures + ((sideJoinedText) Call GetSideStructures); +_structuresLbl = ["Default"]; +lbAdd[14025,"Default"]; + +{ + if (typeName _x == "OBJECT") then { + _nearest = [_x,towns] Call SortByDistance; + _nearTown = (_nearest select 0) getVariable 'name'; + _type = [typeOf _x, 'displayName'] Call GetConfigInfo; + _lbl = _type + ' ' + _nearTown + ' ' + str (round(player distance _x)) + 'M'; + _structuresLbl = _structuresLbl + [_lbl]; + lbAdd[14025,_lbl]; + }; +} forEach _structures; + +while {alive player && dialog} do { + sleep 0.1; + if (side player != sideJoined) exitWith {activeAnimMarker = false;closeDialog 0}; + if (!dialog) exitWith {activeAnimMarker = false}; + + if (MenuAction == 601) then {if (_mode != 0) then {_updateTab = true};_mode = 0};//--- Team properties. + if (MenuAction == 602) then {if (_mode != 1) then {_updateTab = true};_mode = 1};//--- Task. + if (MenuAction == 603) then {if (_mode != 2) then {_updateTab = true};_mode = 2};//--- Task. + + _curSel = lbCurSel 14012; + _isAll = if (_curSel == 0 || (0 in _teams)) then {true} else {false}; + _team = if !(_isAll) then {clientTeams select (_curSel - 1)} else {clientTeams select (_curSel + 1)}; + _teams = lbSelection _listbox_teams; + + if (_updateTab) then { + switch (_mode) do { + case 0: { + {ctrlShow[_x,false]} forEach (_IDCDetails + _IDCTasks); + {ctrlShow[_x,true]} forEach _IDCTeam; + ctrlSetText[14021,localize "STR_WF_Behavior"]; + ctrlSetText[14022,localize "STR_WF_CombatMode"]; + ctrlSetText[14030,localize "STR_WF_TeamsSetting"]; + lbClear 14017; + lbClear 14018; + {lbAdd [14017, _x]} forEach _behaviors; + {lbAdd [14018, _x]} forEach _combatModes; + _updateProperties = true; + }; + case 1: { + {ctrlShow[_x,false]} forEach (_IDCDetails + _IDCTeam); + {ctrlShow[_x,true]} forEach _IDCTasks; + lbClear 14017; + lbClear 14018; + {lbAdd [14017, _x]} forEach _TaskTypes; + {lbAdd [14018, _x]} forEach _TaskDurationLabel; + ctrlSetText[14021,localize "STR_WF_TaskTO" + " :"]; + ctrlSetText[14022,localize "STR_WF_TaskTO_Time" + " :"]; + ctrlSetText[14030,localize "STR_WF_Tasks"]; + lbSetCurSel[14017,0]; + lbSetCurSel[14018,0]; + }; + case 2: { + {ctrlShow[_x,false]} forEach (_IDCTasks + _IDCTeam); + {ctrlShow[_x,true]} forEach _IDCDetails; + ctrlSetText[14030,localize "STR_WF_TeamsDetails"]; + _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]}; + [_detailGroup,14041] Call UIFillListTeamOrders; + _enable = if !(isPlayer leader _team) then {true} else {false}; + ctrlEnable [14043,_enable]; + _enable = if !(isPlayer (vehicle leader _team) && vehicle leader _team != leader _team) then {true} else {false}; + ctrlEnable [14042,_enable]; + }; + }; + _updateTab = false; + }; + + _txt = (_team) Call GetTeamMoveMode; + if (_txt == "" || _txt == "towns") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_TakeTowns"}; + if (_txt == "move") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Move"}; + if (_txt == "patrol") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Patrol"}; + if (_txt == "defense") then {_txt = localize "STR_WF_Mission" + ": " + localize "STR_WF_Defense"}; + ctrlSetText [14013,_txt]; + + //--- Team Funds. + ctrlSetText [14028,Format [localize 'STR_WF_Cash',str ((_team) Call GetTeamFunds)]]; + + if (MenuAction == 1) then { + MenuAction = -1; + activeAnimMarker = false; + + _index = (_team) Call GetTeamType; + _currentCoord = (_team) Call GetTeamMovePos; + _currentMission = (_team) Call GetTeamMoveMode; + if (typeName _currentCoord == "ARRAY") then { + if (count _currentCoord > 0) then { + _position = _currentCoord; + if (_currentMission == "move") then {["TempAnim",_position,"selector_selectedMission",1,"ColorOrange",1,1.2] Spawn MarkerAnim}; + if (_currentMission == "patrol") then {["TempAnim",_position,"selector_selectedMission",1,"ColorYellow",1,1.2,"areaPatrol"] Spawn MarkerAnim}; + if (_currentMission == "defense") then {["TempAnim",_position,"selector_selectedMission",1,"ColorRed",1,1.2] Spawn MarkerAnim}; + }; + }; + if (typeName _currentCoord == "OBJECT") then { + if (_currentMission == "towns") then {["TempAnim",getPos _currentCoord,"selector_selectedMission",1,"ColorBlue",1,1.2] Spawn MarkerAnim}; + }; + + _enable = if (isPlayer(leader _team)) then {false} else {true}; + _special = if (_isAll) then {false} else {if !(isPlayer(leader _team)) then {true} else {false}}; + ctrlEnable [14011,_special]; + ctrlEnable [14014,_enable]; + ctrlEnable [14015,_enable]; + + if (_enable) then { + _isDisabled = (_team) Call GetTeamAutonomous; + if (_isDisabled) then { + ctrlEnable [14014,true]; + ctrlEnable [14015,false]; + } else { + ctrlEnable [14015,true]; + ctrlEnable [14014,false]; + }; + }; + if (_index == -1) then {_index = 1}; + lbSetCurSel [14010,[14010,_index] Call UIFindLBValue]; + if (_mode == 0) then { + _updateProperties = true; + _updateRespawn = true; + }; + if (_mode == 2) then { + _detailGroup = if !(_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]}; + [_detailGroup,14041] Call UIFillListTeamOrders; + _enable = if !(isPlayer leader _team) then {true} else {false}; + ctrlEnable [14043,_enable]; + }; + }; + + //--- Focus. + if (MenuAction == 2) then { + MenuAction = -1; + + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [2,.075,getPos(leader _team)]; + ctrlMapAnimCommit _map; + }; + + //--- Focus (AI Sub). + if (MenuAction == 3) then { + MenuAction = -1; + _iddx = lnbCurSelRow 14041; + if (_iddx != -1) then { + _map ctrlMapAnimAdd [1,.095,getPos (_detailGroup select _iddx)]; + ctrlMapAnimCommit _map; + }; + }; + + //--- Take Towns. + if (MenuAction == 101) then { + MenuAction = -1; + if (!_isAll) then { + [_team,'towns'] Call SetTeamMoveMode; + } else { + {[_x,'towns'] Call SetTeamMoveMode} forEach clientTeams; + }; + activeAnimMarker = false; + }; + + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + //--- Move | Patrol | Defend. + if (MenuAction == 102 || MenuAction == 103 || MenuAction == 104) then { + _color = ""; + _order = ""; + _isAdded = ""; + switch (MenuAction) do { + case 102: {_color = "ColorOrange";_order = "MOVE"}; + case 103: {_color = "ColorYellow";_order = "PATROL";_isAdded = "areaPatrol"}; + case 104: {_color = "ColorRed";_order = "DEFENSE"}; + }; + MenuAction = -1; + _position = _map posScreenToWorld[mouseX,mouseY]; + + [_curSel,_position,_order,_isAll,_teams] Spawn { + Private ["_curSel","_isAll","_order","_position","_radio","_radioLabel","_sideTeam","_teams"]; + _curSel = _this select 0; + _position = _this select 1; + _order = _this select 2; + _isAll = _this select 3; + _teams = _this select 4; + //_radio = ["all","alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa","quebec","romeo","sierra","tango","uniform","victor","whiskey","xray","yankee","zulu"]; + _radioLabel = ["All","Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliet","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-Ray","Yankee","Zulu"]; + if (!_isAll) then { + _sideTeam = "Team "; + for '_i' from 0 to count _teams-1 do { + _selected = clientTeams select ((_teams select _i) - 1); + _sideTeam = _sideTeam + (_radioLabel select (_teams select _i)); + if (_i != count _teams -1) then {_sideTeam = _sideTeam + ", "} else {_sideTeam = _sideTeam + " "}; + }; + + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSent",["1","",_sideTeam,[if (sideJoined == west) then {"blueTeam"} else {"redTeam"}]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true]; + { + _selected = clientTeams select (_x - 1); + [_selected,_position] Call SetTeamMovePos; + [_selected,_order] Call SetTeamMoveMode; + } forEach _teams; + } else { + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSentAll",["1","","All",["all"]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true]; + { + [_x,_position] Call SetTeamMovePos; + [_x,_order] Call SetTeamMoveMode; + } forEach clientTeams; + }; + }; + + activeAnimMarker = false; + _array = if (_isAdded == "") then {["TempAnim",_position,"selector_selectedMission",1,_color,1,1.2]} else {["TempAnim",_position,"selector_selectedMission",1,_color,1,1.2,_isAdded]}; + _array Spawn MarkerAnim; + }; + + //--- Sell Building. + if (MenuAction == 105) then { + MenuAction = -1; + _position = _map posScreenToWorld[mouseX,mouseY]; + _structures = (sideJoinedText) Call GetSideStructures; + _existingStruct = [_position,_structures] Call SortByDistance; + if (count _existingStruct > 0) then { + _closest = _existingStruct select 0; + //--- 100 meters close only. + if (_closest distance _position < 100 && isNil {_closest getVariable "WFBE_SOLD"}) then { + //--- Spawn a sell thread. + (_closest) Spawn { + Private ["_closest","_delay","_id","_supplyB","_type"]; + _closest = _this; + _closest setVariable ["WFBE_SOLD", true]; + _delay = 'WFBE_BUILDINGSELLDELAY' Call GetNamespace; + _type = typeOf _closest; + + //--- Inform the side (before). + WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['StructureSell',_type,_delay]]; + publicVariable 'WFBE_LocalizeMessage'; + ['StructureSell',_type,_delay] Spawn CLTFNCLocalizeMessage; + + sleep _delay; + + if !(alive _closest) exitWith {}; + + _id = (Format ["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace) find _type; + + //--- TODO: Change the find system with a getvar system. + if (_id > 0) then { + _supplyB = (Format ["WFBE_%1STRUCTURECOSTS",sideJoinedText] Call GetNamespace) select _id; + _supplyB = round((_supplyB * ('WFBE_STRUCTURESELLPERCENT' Call GetNamespace)) / 100); + + if !(paramMoneyOnly) then {[sideJoined, _supplyB] Call ChangeSideSupply} else {(_supplyB) Call ChangePlayerFunds}; + }; + + //--- Inform the side. + WFBE_LocalizeMessage = [sideJoined,'CLTFNCLOCALIZEMESSAGE',['StructureSold',_type]]; + publicVariable 'WFBE_LocalizeMessage'; + ['StructureSold',_type] Spawn CLTFNCLocalizeMessage; + if (paramUseWorkers) then {_closest setVariable ["sold",true,true]}; + _closest setDammage 1; + }; + }; + }; + }; + + //--- Set a Task. + if (MenuAction == 306) then { + MenuAction = -1; + _taskType = _TaskTypes select (lbCurSel 14017); + _taskTime = _TaskDuration select (lbCurSel 14018); + _taskTimeLabel = _TaskDurationLabel select (lbCurSel 14018); + _position = _map posScreenToWorld[mouseX,mouseY]; + if (!_isAll) then { + _sideTeam = "Team "; + for '_i' from 0 to count _teams-1 do { + _selected = clientTeams select ((_teams select _i) - 1); + _sideTeam = _sideTeam + (_radioLabel select (_teams select _i)); + if (_i != count _teams -1) then {_sideTeam = _sideTeam + ", "} else {_sideTeam = _sideTeam + " "}; + }; + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSent",["1","",_sideTeam,[if (sideJoined == west) then {"blueTeam"} else {"redTeam"}]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true]; + + { + _selected = clientTeams select (_x - 1); + if (alive (leader _selected)) then { + WFBE_SetTask = [vehicleVarName (leader _selected),'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]]; + publicVariable 'WFBE_SetTask'; + if (isHostedServer) then {[vehicleVarName (leader _selected),'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]] Spawn HandlePVF}; + }; + } forEach _teams; + } else { + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderSentAll",["1","","All",["all"]],["2","","moving to position",["HC_MovingToPosition"]],["3","","over.",["Over1"]],true]; + WFBE_SetTask = [sideJoined,'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]]; + publicVariable 'WFBE_SetTask'; + if (isHostedServer) then {[sideJoined,'CLTFNCSETTASK',[_taskType,_taskTime,_taskTimeLabel,_position]] Spawn HandlePVF}; + }; + }; + }; + + //--- Respawn. + if (MenuAction == 201) then { + MenuAction = -1; + [_team] Spawn { + Private ["_team","_units"]; + _team = _this select 0; + _units = Units _team; + if (paramMobileRespawn || (('WFBE_RESPAWNCAMPSMODE' Call GetNamespace) > 0)) then {//--- Make sure that the unit won't spawn back at a camp/ambu. + [_team,"forceRespawn"] Call SetTeamRespawn; + sleep 2; + }; + _units = _units + ([_team,false] Call GetTeamVehicles); + {_x setDammage 1} forEach _units; + }; + }; + + //--- Auto AI. + if (MenuAction == 301) then { + MenuAction = -1; + _isDisabled = (_team) Call GetTeamAutonomous; + if (_isDisabled) then { + ctrlEnable [14015,true]; + ctrlEnable [14014,false]; + if (!_isAll) then { + { + _selected = clientTeams select (_x - 1); + [_selected,false] Call SetTeamAutonomous; + } forEach _teams; + } else { + {[_x,false] Call SetTeamAutonomous} forEach clientTeams; + }; + } else { + ctrlEnable [14014,true]; + ctrlEnable [14015,false]; + if (!_isAll) then { + { + _selected = clientTeams select (_x - 1); + [_selected,true] Call SetTeamAutonomous; + } forEach _teams; + } else { + {[_x,true] Call SetTeamAutonomous} forEach clientTeams; + }; + }; + }; + + //--- Set buy Type + if (MenuAction == 302) then { + MenuAction = -1; + _curType = lbValue [14010, lbCurSel(14010)]; + if (!_isAll) then { + { + _selected = clientTeams select (_x - 1); + [_selected,_curType] Call SetTeamType; + } forEach _teams; + } else { + {[_x,_curType] Call SetTeamType} forEach clientTeams; + }; + }; + + //--- Set property to team. + if (MenuAction == 303) then { + MenuAction = -1; + _behavior = _behaviors select (lbCurSel(14017)); + _combat = _combatModes select (lbCurSel(14018)); + _formation = _formations select (lbCurSel(14019)); + _speed = _speeds select (lbCurSel(14020)); + + //--- Locality, process on server. + _to = sideJoined; + if (!_isAll) then { + _to = []; + { + _selected = clientTeams select (_x - 1); + _to = _to + [_selected]; + } foreach _teams; + }; + + WFBE_RequestTeamUpdate = ['SRVFNCREQUESTTEAMUPDATE',[_to,_behavior,_combat,_formation,_speed]]; + publicVariable 'WFBE_RequestTeamUpdate'; + if (isHostedServer) then {['SRVFNCREQUESTTEAMUPDATE',[_to,_behavior,_combat,_formation,_speed]] Spawn HandleSPVF}; + }; + + //--- Set respawn. + if (MenuAction == 304) then { + MenuAction = -1; + _curSel = lbCurSel 14025; + if (_curSel == -1) then {_curSel = 0}; + if (!_isAll) then { + { + _selected = clientTeams select (_x - 1); + [_selected,(_structures select _curSel)] Call SetTeamRespawn; + } forEach _teams; + } else { + {[_x,(_structures select _curSel)] Call SetTeamRespawn} forEach clientTeams; + }; + }; + + //--- Update the respawn info. + if (_updateRespawn) then { + _updateRespawn = false; + _respawn = (_team) Call GetTeamRespawn; + _id = _structures find _respawn; + if (_id != -1) then {lbSetCurSel [14025,_id]} else {lbSetCurSel[14025,0]}; + }; + + //--- Minimap update (Only refresh when the combo is selected). + if (MenuAction == 305 && _updateProperties) then {MenuAction = -1}; + if (MenuAction == 305) then { + MenuAction = -1; + _curSel = lbCurSel 14025; + if (_curSel == -1) then {_curSel = 0}; + if (typeName (_structures select _curSel) == "OBJECT") then { + _map ctrlMapAnimAdd [1,.095,getPos (_structures select _curSel)]; + ctrlMapAnimCommit _map; + }; + }; + + //--- Units Details. + if (MenuAction == 401) then { + MenuAction = -1; + _iddx = lnbCurSelRow 14041; + if (_iddx != -1) then { + _unit = _detailGroup select _iddx; + _enable = if (!(isPlayer (vehicle _unit)) && vehicle _unit != _unit) then {true} else {false}; + ctrlEnable [14042,_enable]; + }; + }; + + //--- Units Details (Unflip) + if (MenuAction == 402) then { + MenuAction = -1; + _iddx = lnbCurSelRow 14041; + if (_iddx != -1) then { + _unit = _detailGroup select _iddx; + if ((getPos _unit select 2) < 5) then { + _unit setPos [getPos _unit select 0,getpos _unit select 1,0.5]; + _unit setVelocity [0,0,-1]; + _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]}; + [_detailGroup,14041] Call UIFillListTeamOrders; + }; + }; + }; + + //--- Units Details (Disband) + if (MenuAction == 403) then { + MenuAction = -1; + _iddx = lnbCurSelRow 14041; + if (_iddx != -1) then { + _unit = _detailGroup select _iddx; + _unit setDamage 1; + _detailGroup = if (!_isAll) then {(units(clientTeams select (_curSel - 1))) Call GetLiveUnits} else {[]}; + [_detailGroup,14041] Call UIFillListTeamOrders; + }; + }; + + //--- Update team properties. + if (_updateProperties) then { + _updateProperties = false; + _behavior = behaviour (leader _team); + _combat = combatMode (leader _team); + _formation = formation (leader _team); + _speed = speedMode (leader _team); + + //--- Behavior. + _id =_behaviors find _behavior; + if (_id != -1) then {lbSetCurSel [14017,_id]}; + //--- Combat Mode. + _id =_combatModes find _combat; + if (_id != -1) then {lbSetCurSel [14018,_id]}; + //--- Formation. + _id =_formations find _formation; + if (_id != -1) then {lbSetCurSel [14019,_id]}; + //--- Speed. + _id =_speeds find _speed; + if (_id != -1) then {lbSetCurSel [14020,_id]}; + }; +}; + +activeAnimMarker = false; diff --git a/Client/GUI/GUI_UnitsCamera.sqf b/Client/GUI/GUI_UnitsCamera.sqf new file mode 100644 index 0000000..2a71926 --- /dev/null +++ b/Client/GUI/GUI_UnitsCamera.sqf @@ -0,0 +1,91 @@ + +private ["_n","_objects","_units","_currentUnit","_cameraSwap","_near","_list","_selected","_currentMode","_display","_cameraModes","_id","_type","_map"]; +disableSerialization; +_display = _this select 0; +MenuAction = -1; +mouseButtonUp = -1; + +_cameraModes = ["Internal","External","Gunner","Group"]; + +_n = 1; +{lbAdd[21002,Format["[%1] %2",_n,name (leader _x)]];_n = _n + 1} forEach clientTeams; +_id = clientTeams find playerTeam; +lbSetCurSel[21002,_id]; +_currentUnit = (player) Call GetUnitVehicle; +_currentMode = "Internal"; +_currentUnit switchCamera _currentMode; +_units = (Units (group player) - [player]) Call GetLiveUnits; +{lbAdd[21004,Format["(%1) %2",getText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units; + +_type = if (!(difficultyEnabled "3rdPersonView")) then {["Internal"]} else {["Internal","External","Ironsight","Group"]}; +{lbAdd[21006,_x]} forEach _type; +lbSetCurSel[21006,0]; + +_map = _display displayCtrl 21007; +_map ctrlMapAnimAdd [0,.25,getPos _currentUnit]; +ctrlMapAnimCommit _map; + +while {true} do { + sleep 0.1; + + _cameraSwap = false; + if (Side player != sideJoined || !dialog) exitWith {}; + + //--- Map click. + if (mouseButtonUp == 0) then { + mouseButtonUp = -1; + _near = _map PosScreenToWorld[mouseX,mouseY]; + _list = _near nearEntities [["Man","Car","Motorcycle","Ship","Tank","Air"],200]; + if (count _list > 0) then { + _objects = []; + {if (!(_x isKindOf "Man") && side _x != sideJoined) then {if (count (crew _x) == 0) then {_objects = _objects - [_x]}};if (side _x == sideJoined) then {_objects = _objects + [_x]}} forEach _list; + if (count _objects > 0) then { + _units = [_near,_objects] Call SortByDistance; + _currentUnit = (_units select 0) Call GetUnitVehicle; + _cameraSwap = true; + }; + }; + }; + + //--- Leader Selection. + if (MenuAction == 101) then { + MenuAction = -1; + _selected = leader (clientTeams select (lbCurSel 21002)); + _currentUnit = (_selected) Call GetUnitVehicle; + _n = 0; + _units = (Units (group _selected) - [_selected]) Call GetLiveUnits; + lbClear 21004; + {lbAdd[21004,Format["(%1) %2",GetText (configFile >> "CfgVehicles" >> (typeOf (vehicle _x)) >> "displayName"),name _x]];_n = _n + 1} forEach _units; + _cameraSwap = true; + }; + + //--- Leader commands AIs. + if (MenuAction == 102) then { + MenuAction = -1; + _currentUnit = (_units select (lbCurSel 21004)) Call GetUnitVehicle; + _cameraSwap = true; + }; + + //--- Camera Modes + if (MenuAction == 103) then { + MenuAction = -1; + _currentMode = (_cameraModes select (lbCurSel 21006)); + _cameraSwap = true; + }; + + if !(alive _currentUnit) then { + _currentUnit = (player) Call GetUnitVehicle; + _cameraSwap = true; + }; + + //--- Update the Camera. + if (_cameraSwap) then { + ctrlMapAnimClear _map; + _map ctrlMapAnimAdd [1,.25,getPos _currentUnit]; + ctrlMapAnimCommit _map; + _currentUnit switchCamera _currentMode; + }; +}; + +closeDialog 0; +((player) Call GetUnitVehicle) switchCamera _currentMode; \ No newline at end of file diff --git a/Client/GUI/GUI_UpdateCommanderVoteMenu.sqf b/Client/GUI/GUI_UpdateCommanderVoteMenu.sqf new file mode 100644 index 0000000..b710999 --- /dev/null +++ b/Client/GUI/GUI_UpdateCommanderVoteMenu.sqf @@ -0,0 +1,74 @@ + +private ["_exit","_name","_playerSlots","_refresh","_count","_reselect","_total","_selection","_selected","_selectedTeam", +"_lastVotes","_AI","_lastTeams","_lastTeam","_commanderTeam","_voteTime","_votes"]; +_voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText]; +if (_voteTime <= 0) exitWith {}; + +_name = ""; +_lastTeams = []; +_lastTeam = -2; + +_lastVotes = [sideJoined] Call GetCommanderVotes; + +while {true} do { + sleep 0.1; + + if (!(alive player) || Side player != sideJoined) exitWith {CloseDialog 0;_exit = true}; + if !(dialog) exitWith {}; + + _commanderTeam = [sideJoined] Call GetCommanderFromVotes; + if (IsNull _commanderTeam) then {_name = Localize "STR_WF_AI"} else {_name = name leader _commanderTeam}; + + _voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText]; + ctrlSetText [10007,Format ["(%1) %2: %3",_name,Localize "STR_WF_TimeLeft",_voteTime]]; + + if (_voteTime <= 0) exitWith {CloseDialog 0}; + + _refresh = false; + _playerSlots = []; + { + if !(isNil '_x') then {if (isPlayer (leader _x)) then {_playerSlots = _playerSlots + [_x]}}; + } forEach clientTeams; + + _count = 0; + _votes = [sideJoined] Call GetCommanderVotes; + + {if (_x != (_votes Select _count)) then {_refresh = true};_count = _count + 1} ForEach _lastVotes; + {if !(_x In _lastTeams) then {_refresh = true}} ForEach _playerSlots; + {if !(_x In _playerSlots) then {_refresh = true}} ForEach _lastTeams; + + if (_refresh) then { + + _reselect = false; + _selected = lbCurSel 10006; + _selectedTeam = lbValue[10006,_selected]; + _lastVotes = _votes; + + if (_selected != -1) then {_reselect = true}; + + lbClear 10006; + _AI = lbAdd[10006,Format["%1 [%2]",_votes select 0,Localize "STR_WF_AI"]]; + lbSetValue [10006,_AI,-1]; + + _count = 0; + _total = 1; + + { + if !(isNil '_x') then {if (_x In _playerSlots) then {_total = _total + 1;_selection = lbAdd[10006,Format ["%1 %2",_votes select _count+1,name (leader _x)]];lbSetValue [10006,_selection,_count]}};_count = _count + 1; + } forEach clientTeams; + _lastTeams = +_playerSlots; + + if (_reselect) then { + _selected = 0; + for [{_count = 0},{_count < _total},{_count = _count + 1}] do {if (lbValue[10006,_count] == _selectedTeam) then {_selected = _count}}; + lbSetCurSel[10006,_selected]; + }; + }; + + _selected = lbCurSel 10006; + if (_selected != -1) then { + _selectedTeam = lbValue[10006,_selected]; + if (_selectedTeam != _lastTeam) then {Call Compile Format["%1Team%2Vote = %3;publicVariable '%1Team%2Vote';",sideJoinedText,clientID,_selectedTeam]}; + _lastTeam = _selectedTeam; + }; +}; \ No newline at end of file diff --git a/Client/GUI/GUI_Upgrade.sqf b/Client/GUI/GUI_Upgrade.sqf new file mode 100644 index 0000000..8f5b4ba --- /dev/null +++ b/Client/GUI/GUI_Upgrade.sqf @@ -0,0 +1,198 @@ + +private ["_controls","_u","_curIDC","_level","_maxLevel","_dependencie","_condition","_val","_enabled","_dependent","_colorSupply","_hasFunds","_colorFunds","_canUpgrade","_tooltip_h","_tooltip_text_content","_name","_bpath","_time","_needed","_requiredSupply","_requiredFunds","_currentSupply","_currentFunds","_tooltip_w","_tooltip_x","_tooltip_y","_commander","_supply","_upgrades","_txt","_display","_tooltip","_tooltip_text","_upgr","_upgrlev","_upgrdep","_upgrcond"]; +disableSerialization; + +_display = _this select 0; +displayUpgrade = ""; + +MenuAction = -1; +mouseX = -1; +mouseY = -1; + +_requiredFunds = 0; +_requiredSupply = 0; + +_tooltip = _display DisplayCtrl 18998; +_tooltip_text = _display DisplayCtrl 18999; + +_controls = []; +_u = 18001; +_curIDC = _display DisplayCtrl _u; +while {!isNull _curIDC} do {_controls = _controls + [_curIDC];_u = _u + 1;_curIDC = _display DisplayCtrl _u}; + +_level = 0; +_val = 0; +_time = 0; +_name = ''; +_tooltip_text_content = ''; +_canUpgrade = false; +_dependent = false; +_isUpgrading = false; +_lastTimerUpdate = -5; +_upgr = 'WFBE_UPGRADELABELS' Call GetNamespace; +_upgrlev = 'WFBE_UPGRADELEVELS' Call GetNamespace; +_upgrdep = 'WFBE_UPGRADEDEPENDENCIES' Call GetNamespace; +_upgrcond = 'WFBE_UPGRADECONDITION' Call GetNamespace; + +while {alive player && dialog} do { + if (Side player != sideJoined) exitWith {closeDialog 0}; + if !(dialog) exitWith {}; + + _upgrades = (sideJoinedText) Call GetSideUpgrades; + + if (time - _lastTimerUpdate > 1) then {_lastTimerUpdate = time;_isUpgrading = Call Compile Format ["WFBE_%1_Upgrading",sideJoinedText]}; + + _u = 0; + { + _level = _upgrades select _u; + _maxLevel = _upgrlev select _u; + _dependencie = _upgrdep select _u; + _condition = _upgrcond select _u; + if (_level == _maxLevel) then {_x ctrlSetTextColor [0, 1, 0, 1]}; + if (!_condition) then {_x ctrlSetTextColor [1, 0, 0, 1]}; + if (count _dependencie > 0 && _level != _maxLevel && _condition) then { + if (_upgrades select (_dependencie select 0) < (_dependencie select 1)) then { + _x ctrlSetTextColor [1, 0, 0, 1]; + } else { + if (_level != _maxLevel) then { + _x ctrlSetTextColor [0.75,0.75,0.75,1]; + }; + }; + }; + _u = _u + 1; + } forEach _controls; + + //--- Tooltips. + if (displayUpgrade != "") then { + + switch (displayUpgrade) do { + case "infantry": {_val = 0}; + case "light": {_val = 1}; + case "heavy": {_val = 2}; + case "air": {_val = 3}; + case "parachutist": {_val = 4}; + case "uav": {_val = 5}; + case "supply": {_val = 6}; + case "ambuSpawn": {_val = 7}; + case "airlift": {_val = 8}; + case "flares": {_val = 9}; + case "artillery": {_val = 10}; + case "icbm": {_val = 11}; + case "fasttravel": {_val = 12}; + case "gear": {_val = 13}; + case "ammo": {_val = 14}; + case "easa": {_val = 15}; + case "paradrop": {_val = 16}; + case "shells": {_val = 17}; + }; + + ctrlSetFocus (_controls select _val); + + _dependencie = _upgrdep select _val; + _condition = _upgrcond select _val; + _maxLevel = _upgrlev select _val; + _name = _upgr select _val; + _level = _upgrades select _val; + + _enabled = true; + if (!_condition) then {_enabled = false}; + if (count _dependencie > 0 && _enabled) then { + if (_upgrades select (_dependencie select 0) < (_dependencie select 1)) then { + _dependent = true; + } else {_dependent = false}; + } else {_dependent = false}; + + _bpath = if (_level == _maxLevel) then {_level} else {_level + 1}; + _time = (Format["WFBE_UPGRADETIMESLEVEL%1",_bpath] Call GetNamespace) select _val; + _needed = (Format["WFBE_UPGRADEPRICESLEVEL%1",_bpath] Call GetNamespace) select _val; + _requiredSupply = _needed select 0; + _requiredFunds = _needed select 1; + + _currentSupply = (sideJoined) Call GetSideSupply; + _currentFunds = Call GetPlayerfunds; + + _colorSupply = "'#3366cc'"; + _colorFunds = "'#3366cc'"; + _hasFunds = true; + if !(paramMoneyOnly) then {if (_currentSupply < _requiredSupply) then {_colorSupply = "'#ff0033'";_hasFunds = false}}; + if (_currentFunds < _requiredFunds) then {_colorFunds = "'#ff0033'";_hasFunds = false}; + + if (!_isUpgrading && _level < _maxLevel && !_dependent && _enabled && _hasFunds) then {_canUpgrade = true} else {_canUpgrade = false}; + + _tooltip_w = 0.28; + _tooltip_h = 0.18; + _tooltip_x = if ((1 - mouseX) < _tooltip_w) then {mouseX - _tooltip_w - 0.02} else {mouseX + 0.02}; + _tooltip_y = if (mouseY > 0.5) then {mouseY - _tooltip_h - 0.02} else {mouseY + 0.02}; + + if (_level != _maxLevel) then { + _supplyCd = if !(paramMoneyOnly) then {Format [" %1
",Format [localize 'STR_WF_Require',"" + str(_requiredSupply) + '' + '/' + "" + str(_currentSupply) + ' S']]} else {""}; + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format [" %1
",Format [localize 'STR_WF_Level',"" + str(_level) + '' + "/" + str(_maxLevel) + '']] + + _supplyCd + + Format [" %1
",Format [localize 'STR_WF_Require',"" + str(_requiredFunds) + '' + '/' + "" + str(_currentFunds) + ' $']] + + Format [" %1
",Format [localize 'STR_WF_Require',"" + str(_time) + ' ' + localize 'STR_WF_Seconds']] + ); + + if (_isUpgrading) then { + _tooltip_h = 0.12; + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format [" %1
",localize 'STR_WF_Upgrade_Running'] + ); + }; + if (!_enabled) then { + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format [" %1
",localize 'STR_WF_Upgrade_Condition'] + ); + }; + if (_dependent && !_isUpgrading && _enabled) then { + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format [" %1
",Format[localize 'STR_WF_Upgrade_Dependent',_upgr select (_dependencie select 0),_dependencie select 1]] + ); + }; + } else { + _tooltip_h = 0.12; + _tooltip_text_content = parsetext ( + Format ["%1:
",_name] + + Format [" %1
",localize 'STR_WF_Upgrade_Maximum'] + ); + }; + + if ((ctrlPosition _tooltip select 0) == 0 || true) then {_tooltip ctrlSetPosition [_tooltip_x,_tooltip_y,_tooltip_w,_tooltip_h]}; + _tooltip ctrlCommit 0; + + _tooltip_text ctrlSetStructuredText _tooltip_text_content; + if ((ctrlPosition _tooltip_text select 0) == 0 || true) then {_tooltip_text ctrlSetPosition [_tooltip_x,_tooltip_y,_tooltip_w,_tooltip_h]}; + _tooltip_text ctrlCommit 0; + + } else { + if ((ctrlPosition _tooltip select 0) != 0) then {_tooltip ctrlSetPosition [0,0,0,0];_tooltip ctrlCommit 0}; + if ((ctrlPosition _tooltip_text select 0) != 0) then {_tooltip_text ctrlSetPosition [0,0,0,0];_tooltip_text ctrlCommit 0}; + }; + + _commander = false; + if (!isNull(commanderTeam)) then { + if (commanderTeam == group player) then {_commander = true}; + }; + + if (MenuAction == 1 && _canUpgrade && _commander) then { + MenuAction = -1; + -(_requiredFunds) Call ChangePlayerFunds; + if !(paramMoneyOnly) then {[sideJoined, -_requiredSupply] Call ChangeSideSupply}; + + WFBE_RequestUpgrade = ['SRVFNCREQUESTUPGRADE',[_time,_level,_val,_name,sideJoined]]; + publicVariable 'WFBE_RequestUpgrade'; + if (isHostedServer) then {['SRVFNCREQUESTUPGRADE',[_time,_level,_val,_name,sideJoined]] Spawn HandleSPVF}; + + Call Compile Format ["WFBE_%1_Upgrading = false;",sideJoinedText]; + hint Format [localize "STR_WF_Upgrade_Start",_name]; + } else {MenuAction = -1}; + + _txt = if (_isUpgrading) then {localize "STR_WF_Upgrade_Running_Info" + "..."} else {""}; + ctrlSetText[18802,_txt]; + + sleep 0.05; +}; \ No newline at end of file diff --git a/Client/Images/con_depot.paa b/Client/Images/con_depot.paa new file mode 100644 index 0000000..9051218 Binary files /dev/null and b/Client/Images/con_depot.paa differ diff --git a/Client/Images/con_task.paa b/Client/Images/con_task.paa new file mode 100644 index 0000000..7e03288 Binary files /dev/null and b/Client/Images/con_task.paa differ diff --git a/Client/Images/geariconall.paa b/Client/Images/geariconall.paa new file mode 100644 index 0000000..aab8913 Binary files /dev/null and b/Client/Images/geariconall.paa differ diff --git a/Client/Images/geariconmisc.paa b/Client/Images/geariconmisc.paa new file mode 100644 index 0000000..2620455 Binary files /dev/null and b/Client/Images/geariconmisc.paa differ diff --git a/Client/Images/geariconprimary.paa b/Client/Images/geariconprimary.paa new file mode 100644 index 0000000..df8d091 Binary files /dev/null and b/Client/Images/geariconprimary.paa differ diff --git a/Client/Images/geariconsecondary.paa b/Client/Images/geariconsecondary.paa new file mode 100644 index 0000000..729012d Binary files /dev/null and b/Client/Images/geariconsecondary.paa differ diff --git a/Client/Images/geariconsidearm.paa b/Client/Images/geariconsidearm.paa new file mode 100644 index 0000000..787ef18 Binary files /dev/null and b/Client/Images/geariconsidearm.paa differ diff --git a/Client/Images/gearicontemplate.paa b/Client/Images/gearicontemplate.paa new file mode 100644 index 0000000..b9411dc Binary files /dev/null and b/Client/Images/gearicontemplate.paa differ diff --git a/Client/Images/i_backpack.paa b/Client/Images/i_backpack.paa new file mode 100644 index 0000000..5acc105 Binary files /dev/null and b/Client/Images/i_backpack.paa differ diff --git a/Client/Images/i_clear.paa b/Client/Images/i_clear.paa new file mode 100644 index 0000000..59f2659 Binary files /dev/null and b/Client/Images/i_clear.paa differ diff --git a/Client/Images/i_commander.paa b/Client/Images/i_commander.paa new file mode 100644 index 0000000..3a28a79 Binary files /dev/null and b/Client/Images/i_commander.paa differ diff --git a/Client/Images/i_driver.paa b/Client/Images/i_driver.paa new file mode 100644 index 0000000..2481453 Binary files /dev/null and b/Client/Images/i_driver.paa differ diff --git a/Client/Images/i_extra.paa b/Client/Images/i_extra.paa new file mode 100644 index 0000000..de90746 Binary files /dev/null and b/Client/Images/i_extra.paa differ diff --git a/Client/Images/i_gunner.paa b/Client/Images/i_gunner.paa new file mode 100644 index 0000000..89e1d99 Binary files /dev/null and b/Client/Images/i_gunner.paa differ diff --git a/Client/Images/i_lock.paa b/Client/Images/i_lock.paa new file mode 100644 index 0000000..5ec5b9f Binary files /dev/null and b/Client/Images/i_lock.paa differ diff --git a/Client/Images/i_reload.paa b/Client/Images/i_reload.paa new file mode 100644 index 0000000..74aa384 Binary files /dev/null and b/Client/Images/i_reload.paa differ diff --git a/Client/Images/icon_wf_building_aa_radar.paa b/Client/Images/icon_wf_building_aa_radar.paa new file mode 100644 index 0000000..123d0ca Binary files /dev/null and b/Client/Images/icon_wf_building_aa_radar.paa differ diff --git a/Client/Images/icon_wf_building_air.paa b/Client/Images/icon_wf_building_air.paa new file mode 100644 index 0000000..cdf6012 Binary files /dev/null and b/Client/Images/icon_wf_building_air.paa differ diff --git a/Client/Images/icon_wf_building_am_radar.paa b/Client/Images/icon_wf_building_am_radar.paa new file mode 100644 index 0000000..58ee40e Binary files /dev/null and b/Client/Images/icon_wf_building_am_radar.paa differ diff --git a/Client/Images/icon_wf_building_barracks.paa b/Client/Images/icon_wf_building_barracks.paa new file mode 100644 index 0000000..b388115 Binary files /dev/null and b/Client/Images/icon_wf_building_barracks.paa differ diff --git a/Client/Images/icon_wf_building_cc.paa b/Client/Images/icon_wf_building_cc.paa new file mode 100644 index 0000000..47c60a0 Binary files /dev/null and b/Client/Images/icon_wf_building_cc.paa differ diff --git a/Client/Images/icon_wf_building_cc_ca.paa b/Client/Images/icon_wf_building_cc_ca.paa new file mode 100644 index 0000000..d65bb12 Binary files /dev/null and b/Client/Images/icon_wf_building_cc_ca.paa differ diff --git a/Client/Images/icon_wf_building_firstaid.paa b/Client/Images/icon_wf_building_firstaid.paa new file mode 100644 index 0000000..f007514 Binary files /dev/null and b/Client/Images/icon_wf_building_firstaid.paa differ diff --git a/Client/Images/icon_wf_building_gear.paa b/Client/Images/icon_wf_building_gear.paa new file mode 100644 index 0000000..37150a0 Binary files /dev/null and b/Client/Images/icon_wf_building_gear.paa differ diff --git a/Client/Images/icon_wf_building_hangar.paa b/Client/Images/icon_wf_building_hangar.paa new file mode 100644 index 0000000..73fbb3d Binary files /dev/null and b/Client/Images/icon_wf_building_hangar.paa differ diff --git a/Client/Images/icon_wf_building_hvs.paa b/Client/Images/icon_wf_building_hvs.paa new file mode 100644 index 0000000..b839e84 Binary files /dev/null and b/Client/Images/icon_wf_building_hvs.paa differ diff --git a/Client/Images/icon_wf_building_lvs.paa b/Client/Images/icon_wf_building_lvs.paa new file mode 100644 index 0000000..9fd7fc2 Binary files /dev/null and b/Client/Images/icon_wf_building_lvs.paa differ diff --git a/Client/Images/icon_wf_building_mhq.paa b/Client/Images/icon_wf_building_mhq.paa new file mode 100644 index 0000000..7e9250c Binary files /dev/null and b/Client/Images/icon_wf_building_mhq.paa differ diff --git a/Client/Images/icon_wf_building_repair.paa b/Client/Images/icon_wf_building_repair.paa new file mode 100644 index 0000000..03fc565 Binary files /dev/null and b/Client/Images/icon_wf_building_repair.paa differ diff --git a/Client/Images/icon_wf_support_artilery.paa b/Client/Images/icon_wf_support_artilery.paa new file mode 100644 index 0000000..56db6bc Binary files /dev/null and b/Client/Images/icon_wf_support_artilery.paa differ diff --git a/Client/Images/icon_wf_support_cas.paa b/Client/Images/icon_wf_support_cas.paa new file mode 100644 index 0000000..e507542 Binary files /dev/null and b/Client/Images/icon_wf_support_cas.paa differ diff --git a/Client/Images/icon_wf_support_fasttravel.paa b/Client/Images/icon_wf_support_fasttravel.paa new file mode 100644 index 0000000..22f2a69 Binary files /dev/null and b/Client/Images/icon_wf_support_fasttravel.paa differ diff --git a/Client/Images/icon_wf_support_mortar.paa b/Client/Images/icon_wf_support_mortar.paa new file mode 100644 index 0000000..ba9b7be Binary files /dev/null and b/Client/Images/icon_wf_support_mortar.paa differ diff --git a/Client/Images/icon_wf_support_supplydrop.paa b/Client/Images/icon_wf_support_supplydrop.paa new file mode 100644 index 0000000..4647da5 Binary files /dev/null and b/Client/Images/icon_wf_support_supplydrop.paa differ diff --git a/Client/Images/icon_wf_support_transport.paa b/Client/Images/icon_wf_support_transport.paa new file mode 100644 index 0000000..afe6160 Binary files /dev/null and b/Client/Images/icon_wf_support_transport.paa differ diff --git a/Client/Images/icon_wf_support_uav.paa b/Client/Images/icon_wf_support_uav.paa new file mode 100644 index 0000000..1fc27de Binary files /dev/null and b/Client/Images/icon_wf_support_uav.paa differ diff --git a/Client/Images/picturepapercar_ca.paa b/Client/Images/picturepapercar_ca.paa new file mode 100644 index 0000000..189bbcb Binary files /dev/null and b/Client/Images/picturepapercar_ca.paa differ diff --git a/Client/Images/tog_arty.paa b/Client/Images/tog_arty.paa new file mode 100644 index 0000000..f8aea49 Binary files /dev/null and b/Client/Images/tog_arty.paa differ diff --git a/Client/Images/ui_button_main_down.paa b/Client/Images/ui_button_main_down.paa new file mode 100644 index 0000000..d02a185 Binary files /dev/null and b/Client/Images/ui_button_main_down.paa differ diff --git a/Client/Images/ui_button_main_focus.paa b/Client/Images/ui_button_main_focus.paa new file mode 100644 index 0000000..afab785 Binary files /dev/null and b/Client/Images/ui_button_main_focus.paa differ diff --git a/Client/Images/ui_button_main_normal.paa b/Client/Images/ui_button_main_normal.paa new file mode 100644 index 0000000..c4969d3 Binary files /dev/null and b/Client/Images/ui_button_main_normal.paa differ diff --git a/Client/Images/ui_button_main_over.paa b/Client/Images/ui_button_main_over.paa new file mode 100644 index 0000000..db4f0e3 Binary files /dev/null and b/Client/Images/ui_button_main_over.paa differ diff --git a/Client/Images/wf_air.paa b/Client/Images/wf_air.paa new file mode 100644 index 0000000..ffbef9e Binary files /dev/null and b/Client/Images/wf_air.paa differ diff --git a/Client/Images/wf_amm.paa b/Client/Images/wf_amm.paa new file mode 100644 index 0000000..a143305 Binary files /dev/null and b/Client/Images/wf_amm.paa differ diff --git a/Client/Images/wf_art.paa b/Client/Images/wf_art.paa new file mode 100644 index 0000000..c07324a Binary files /dev/null and b/Client/Images/wf_art.paa differ diff --git a/Client/Images/wf_b.paa b/Client/Images/wf_b.paa new file mode 100644 index 0000000..d54fb85 Binary files /dev/null and b/Client/Images/wf_b.paa differ diff --git a/Client/Images/wf_eas.paa b/Client/Images/wf_eas.paa new file mode 100644 index 0000000..b31076c Binary files /dev/null and b/Client/Images/wf_eas.paa differ diff --git a/Client/Images/wf_fas.paa b/Client/Images/wf_fas.paa new file mode 100644 index 0000000..3438035 Binary files /dev/null and b/Client/Images/wf_fas.paa differ diff --git a/Client/Images/wf_fia.paa b/Client/Images/wf_fia.paa new file mode 100644 index 0000000..b3ebbcf Binary files /dev/null and b/Client/Images/wf_fia.paa differ diff --git a/Client/Images/wf_fla.paa b/Client/Images/wf_fla.paa new file mode 100644 index 0000000..79c548f Binary files /dev/null and b/Client/Images/wf_fla.paa differ diff --git a/Client/Images/wf_gea.PAA b/Client/Images/wf_gea.PAA new file mode 100644 index 0000000..3dd20eb Binary files /dev/null and b/Client/Images/wf_gea.PAA differ diff --git a/Client/Images/wf_hvf.paa b/Client/Images/wf_hvf.paa new file mode 100644 index 0000000..d67f728 Binary files /dev/null and b/Client/Images/wf_hvf.paa differ diff --git a/Client/Images/wf_lif.paa b/Client/Images/wf_lif.paa new file mode 100644 index 0000000..a149f7a Binary files /dev/null and b/Client/Images/wf_lif.paa differ diff --git a/Client/Images/wf_lvf.paa b/Client/Images/wf_lvf.paa new file mode 100644 index 0000000..799760d Binary files /dev/null and b/Client/Images/wf_lvf.paa differ diff --git a/Client/Images/wf_mib.paa b/Client/Images/wf_mib.paa new file mode 100644 index 0000000..03bc4b6 Binary files /dev/null and b/Client/Images/wf_mib.paa differ diff --git a/Client/Images/wf_par.paa b/Client/Images/wf_par.paa new file mode 100644 index 0000000..9b7941c Binary files /dev/null and b/Client/Images/wf_par.paa differ diff --git a/Client/Images/wf_pas.paa b/Client/Images/wf_pas.paa new file mode 100644 index 0000000..c650a57 Binary files /dev/null and b/Client/Images/wf_pas.paa differ diff --git a/Client/Images/wf_shl.paa b/Client/Images/wf_shl.paa new file mode 100644 index 0000000..57d33b6 Binary files /dev/null and b/Client/Images/wf_shl.paa differ diff --git a/Client/Images/wf_sup.paa b/Client/Images/wf_sup.paa new file mode 100644 index 0000000..3f09c7e Binary files /dev/null and b/Client/Images/wf_sup.paa differ diff --git a/Client/Images/wf_uav.paa b/Client/Images/wf_uav.paa new file mode 100644 index 0000000..c611dec Binary files /dev/null and b/Client/Images/wf_uav.paa differ diff --git a/Client/Init/Init_BaseStructure.sqf b/Client/Init/Init_BaseStructure.sqf new file mode 100644 index 0000000..a60bf50 --- /dev/null +++ b/Client/Init/Init_BaseStructure.sqf @@ -0,0 +1,34 @@ +waitUntil {commonInitComplete}; + +if (local player) then { + Private["_allies","_color","_hq","_marker","_structure","_text","_type","_side","_voteTime"]; + + _structure = _this Select 0; + _hq = _this select 1; + _side = _this select 2; + _allies = if (count _this > 3) then {_this select 3} else {""}; + + if (_side != side player) exitWith {}; + + sleep random(3); + + while {_voteTime = WF_Logic getVariable "eastCommanderVoteTime";IsNil "_voteTime"} do {sleep 1}; + + _marker = Format["BaseMarker%1",buildingMarker]; + buildingMarker = buildingMarker + 1; + createMarkerLocal [_marker,getPos _structure]; + _type = "mil_box"; + _color = "ColorBlue"; + if (_hq) then {_type = "Headquarters";_color = "ColorGreen"}; + if (_allies != "") then {_type = "mil_box";_color = "ColorGreen"}; + _marker setMarkerTypeLocal _type; + _text = ""; + if (!_hq && _allies == "") then {_text = [_structure] Call GetStructureMarkerLabel;_marker setMarkerSizeLocal [0.5,0.5]}; + if (_allies != "") then {_marker setMarkerSizeLocal [0.5,0.5];_text = _allies}; + if (_text != "") then {_marker setMarkerTextLocal _text}; + _marker setMarkerColorLocal _color; + + while {!isNull _structure && alive _structure} do {sleep 2}; + + deleteMarkerLocal _marker; +}; \ No newline at end of file diff --git a/Client/Init/Init_Blacklist.sqf b/Client/Init/Init_Blacklist.sqf new file mode 100644 index 0000000..8903c5a --- /dev/null +++ b/Client/Init/Init_Blacklist.sqf @@ -0,0 +1,15 @@ +Private ["_blackListID","_id"]; +_id = getPlayerUID (_this select 0); + +//--- Griefers ID. +_blackListID = [ +"4837314", +"12051782", +"7148678", +"4139392", +"4094594", +"2992070", +"823297" +]; + +if (_id in _blackListID) then {true} else {false}; \ No newline at end of file diff --git a/Client/Init/Init_Client.sqf b/Client/Init/Init_Client.sqf new file mode 100644 index 0000000..dfdce06 --- /dev/null +++ b/Client/Init/Init_Client.sqf @@ -0,0 +1,376 @@ +Private ['_HQRadio','_base','_buildings','_condition','_get','_idbl','_isDeployed','_oc','_voteTime','_weat']; + +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Init start at %3",diag_frameno,diag_tickTime,time]; + +sideJoined = side player; +sideJoinedText = str sideJoined; + +//--- Position the client on the temp spawn (Common is not yet init'd so we call is straigh away). +player setPos ([getMarkerPos Format["%1TempRespawnMarker",sideJoinedText],1,10] Call Compile preprocessFile "Common\Functions\Common_GetRandomPosition.sqf"); + +ARTY_HandleILLUM = Compile preprocessFile "Client\Module\Arty\ARTY_HandleILLUM.sqf"; +ARTY_HandleSADARM = Compile preprocessFile "Client\Module\Arty\ARTY_HandleSADARM.sqf"; +if (paramArty) then { + ARTY_Prep = Compile preprocessFile "Client\Module\Arty\ARTY_mobileMissionPrep.sqf"; + ARTY_Finish = Compile preprocessFile "Client\Module\Arty\ARTY_mobileMissionFinish.sqf"; + RequestFireMission = Compile preprocessFile "Client\Functions\Client_RequestFireMission.sqf" +}; +if (paramBoundaries) then { + BoundariesIsOnMap = Compile preprocessFile "Client\Functions\Client_IsOnMap.sqf"; + BoundariesHandleOnMap = Compile preprocessFile "Client\Functions\Client_HandleOnMap.sqf"; +}; +BuildUnit = Compile preprocessFile "Client\Functions\Client_BuildUnit.sqf"; +ChangePlayerFunds = Compile preprocessFile "Client\Functions\Client_ChangePlayerFunds.sqf"; +CommandChatMessage = Compile preprocessFile "Client\Functions\Client_CommandChatMessage.sqf"; +if (paramCounterMeasures) then { + CM_Countermeasures = Compile preprocessFile "Client\Module\CM\CM_Countermeasures.sqf"; + CM_Flares = Compile preprocessFile "Client\Module\CM\CM_Flares.sqf"; + CM_Spoofing = Compile preprocessFile "Client\Module\CM\CM_Spoofing.sqf"; +}; +DebugHint = Compile preprocessFile "Client\Functions\Client_DebugHint.sqf"; +DisplayInventory = Compile preprocessFile "Client\Functions\Client_DisplayInventory.sqf"; +EquipDefaultLoadout = Compile preprocessFile "Client\Functions\Client_EquipDefaultLoadout.sqf"; +FX = Compile preprocessFile "Client\Functions\Client_FX.sqf"; +GetIncome = Compile preprocessFile "Client\Functions\Client_GetIncome.sqf"; +GetMarkerColoration = Compile preprocessFile "Client\Functions\Client_GetMarkerColoration.sqf"; +GetPlayerFunds = Compile preprocessFile "Client\Functions\Client_GetPlayerFunds.sqf"; +GetRespawnAvailable = Compile preprocessFile "Client\Functions\Client_GetRespawnAvailable.sqf"; +GetStructureMarkerLabel = Compile preprocessFile "Client\Functions\Client_GetStructureMarkerLabel.sqf"; +GetTime = Compile preprocessFile "Client\Functions\Client_GetTime.sqf"; +GroupChatMessage = Compile preprocessFile "Client\Functions\Client_GroupChatMessage.sqf"; +HandleHQAction = Compile preprocessFile "Client\Functions\Client_HandleHQAction.sqf"; +HandlePVF = Compile preprocessFile "Client\Functions\Client_HandlePVF.sqf"; +MarkerAnim = Compile preprocessFile "Client\Functions\Client_MarkerAnim.sqf"; +OnRespawnHandler = Compile preprocessFile "Client\Functions\Client_OnRespawnHandler.sqf"; +PlayerKilled = Compile preprocessFile "Client\Client_Killed.sqf"; +PreRespawnHandler = Compile preprocessFile "Client\Functions\Client_PreRespawnHandler.sqf"; +ReplaceArray = Compile preprocessFile "Client\Functions\Client_ReplaceArray.sqf"; +ReplaceInventoryAmmo = Compile preprocessFile "Client\Functions\Client_ReplaceInventoryAmmo.sqf"; +if !(WF_A2_Vanilla) then { + RespawningBag = Compile preprocessFile "Client\Functions\Client_RespawnBag.sqf"; +} else { + RespawningBag = {}; +}; +SetControlFadeAnim = Compile preprocessFile "Client\Functions\Client_SetControlFadeAnim.sqf"; +SetControlFadeAnimStop = Compile preprocessFile "Client\Functions\Client_SetControlFadeAnimStop.sqf"; +SupportHeal = Compile preprocessFile "Client\Functions\Client_SupportHeal.sqf"; +SupportRearm = Compile preprocessFile "Client\Functions\Client_SupportRearm.sqf"; +SupportRefuel = Compile preprocessFile "Client\Functions\Client_SupportRefuel.sqf"; +SupportRepair = Compile preprocessFile "Client\Functions\Client_SupportRepair.sqf"; +TaskSystem = Compile preprocessFile "Client\Functions\Client_TaskSystem.sqf"; +TitleTextMessage = Compile preprocessFile "Client\Functions\Client_TitleTextMessage.sqf"; +UIAddItem = Compile preprocessFile "Client\Functions\Client_UIAddItem.sqf"; +UIAddMagazine = Compile preprocessFile "Client\Functions\Client_UIAddMagazine.sqf"; +UIChangeComboBuyUnits = Compile preprocessFile "Client\Functions\Client_UIChangeComboBuyUnits.sqf"; +UIFillListBuyUnits = Compile preprocessFile "Client\Functions\Client_UIFillListBuyUnits.sqf"; +UIFillListTeamOrders = Compile preprocessFile "Client\Functions\Client_UIFillListTeamOrders.sqf"; +UIFindLBValue = Compile preprocessFile "Client\Functions\Client_UIFindLBValue.sqf"; +UIGearFillList = Compile preprocessFile "Client\Functions\Client_UIGearFillList.sqf"; +UIGearFillTemplateList = Compile preprocessFile "Client\Functions\Client_UIGearFillTemplateList.sqf"; +if (paramICBM) then { + Nuke = Compile preprocessFile "Client\Module\Nuke\nuke.sqf"; + NukeIncomming = Compile preprocessFile "Client\Module\Nuke\nukeincoming.sqf"; +}; +//--- Namespace related (GUI). +BIS_FNC_GUIset = {UInamespace setVariable [_this select 0, _this select 1]}; +BIS_FNC_GUIget = {UInamespace getVariable (_this select 0)}; + +clientInitComplete = true; + +//--- Waiting for the common part to be executed. +waitUntil {commonInitComplete}; + +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Common is ready at %3. Executing Client Initialization...",diag_frameno,diag_tickTime,time]; + +if (('WFBE_ISIS' Call GetNamespace) != 0) then {ISIS_Effects = Compile preProcessFile "Client\Module\ISIS\ISIS_Clientfx.sqf"}; + +//--- Queue Protection. +['WFBE_C_QUEUE_BARRACKS',0,true] Call SetNamespace; +['WFBE_C_QUEUE_BARRACKS_MAX',10,true] Call SetNamespace; +['WFBE_C_QUEUE_LIGHT',0,true] Call SetNamespace; +['WFBE_C_QUEUE_LIGHT_MAX',3,true] Call SetNamespace; +['WFBE_C_QUEUE_HEAVY',0,true] Call SetNamespace; +['WFBE_C_QUEUE_HEAVY_MAX',3,true] Call SetNamespace; +['WFBE_C_QUEUE_AIRCRAFT',0,true] Call SetNamespace; +['WFBE_C_QUEUE_AIRCRAFT_MAX',2,true] Call SetNamespace; +['WFBE_C_QUEUE_AIRPORT',0,true] Call SetNamespace; +['WFBE_C_QUEUE_AIRPORT_MAX',2,true] Call SetNamespace; +['WFBE_C_QUEUE_DEPOT',0,true] Call SetNamespace; +['WFBE_C_QUEUE_DEPOT_MAX',3,true] Call SetNamespace; + +//--- Handle the Fast Time. +if (('WFBE_FASTTIMERATE' Call GetNamespace) > 0) then {[] ExecFSM "Client\FSM\fasttimecli.fsm"}; + +//--- Handle the weather. +_weat = 'WFBE_WEATHER' Call GetNamespace; +if (_weat == 3) then { + [] ExecFSM "Client\FSM\overcast.fsm"; +} else { + _oc = 0.05; + switch (_weat) do { + case 0: {_oc = 0}; + case 1: {_oc = 0.5}; + case 2: {_oc = 1}; + }; + 60 setOvercast _oc; +}; +if (paramVolumClouds) then {[] Exec "CA\Modules\clouds\data\scripts\bis_cloudsystem.sqs"}; + +_idbl = [player] Call Compile preprocessFile "Client\Init\Init_Blacklist.sqf"; +if (_idbl) exitWith {[] Spawn {Private["_txt"];_txt = "INFORMATION:\n\n You are currently blacklisted.";_txt Call DebugHint;sleep 5; disableUserInput true; sleep 60; disableUserInput false; failMission "END1"}}; + +//--- Global Client Variables. +sideID = sideJoined Call GetSideID; +clientID = player Call GetClientID; +clientIdentification = Format ["%1Slot%2",sideJoinedText,clientID]; +clientTeam = group player; +clientTeams = (Format['WFBE_%1TEAMS',sideJoinedText] Call GetNamespace); +playerType = typeOf player; +playerDead = false; +paramBoundariesRunning = false; + +commanderTeam = objNull; +buildingMarker = 0; +gearCost = 0; +currentTG = 25; +lastBuilt = []; +unitQueu = 0; +fireMissionTime = -1000; +artyRange = 15; +artyPos = [0,0,0]; +playerUAV = objNull; +comTask = objNull; +voted = false; +votePopUp = true; +manningDefense = true; +currentFX = 0; +lastParaCall = -1200; +lastSupplyCall = -1200; +canBuildWHQ = true; +WFBE_RespawnDefaultGear = false; +WFBE_EnablePreload = false; +WFBE_ForceUpdate = false; + +hqInRange = false; +barracksInRange = false; +gearInRange = false; +lightInRange = false; +heavyInRange = false; +aircraftInRange = false; +serviceInRange = false; +commandInRange = false; +depotInRange = false; +antiAirRadarInRange = false; +hangarInRange = false; + +enableTeamSwitch false; + +/* Airfields Init */ +if (isNil "Airfields") then {Airfields = []}; + +/* CIPHER Module - Sorting */ +ExecVM "Common\Module\CIPHER\CIPHER_Sort.sqf"; + +//--- Disable Artillery Computer. +if ((('WFBE_ARTILLERYCOMPUTER' Call GetNamespace) != 2) && !WF_A2_Vanilla) then {Call Compile "enableEngineArtillery false;"}; + +/* Exec SQF|FSM Misc stuff. */ +if (paramTrackPlayer) then {[] ExecFSM "Client\FSM\updateteamsmarkers.fsm"}; +[] ExecFSM "Client\FSM\updateactions.fsm"; +/* Don't pause the client initialization process. */ +[] Spawn { + waitUntil {townInit}; + /* Handle the capture GUI */ + diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Towns Capture FSM - [Done]",diag_frameno,diag_tickTime]; + [] ExecFSM "Client\FSM\updatecapture.fsm"; + /* Handle the map town markers */ + diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Towns Marker FSM - [Done]",diag_frameno,diag_tickTime]; + [] ExecFSM "Client\FSM\updatetownmarkers.fsm"; + waitUntil {!isNil Format["%1BaseStructures",sideJoinedText]}; + /* Handle the client actions */ + diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Available Action FSM - [Done]",diag_frameno,diag_tickTime]; + [] ExecFSM "Client\FSM\updateavailableactions.fsm"; + /* Resources Handler */ + if !(('WFBE_INCOMESYSTEM' Call GetNamespace) in [3,4]) then { + diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Ressources FSM - [Done]",diag_frameno,diag_tickTime]; + (sideJoined) ExecFSM "Client\FSM\resources_cli.fsm"; + }; +}; +[] Spawn { + Private ["_commanderTeam"]; + waitUntil{sleep 0.1;!isNil {(sideJoined) Call GetCommanderTeam}}; + /* Commander Handling */ + diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Commander Update FSM - [Done]",diag_frameno,diag_tickTime]; + [] ExecFSM "Client\FSM\updateclient.fsm"; +}; + +//--- Add the briefing (notes). +[] Call Compile preprocessFile "briefing.sqf"; + +//--- HQ Radio system. +waitUntil {!isNil Format ["BIS_WF_HQ%1",sideJoinedText]}; +_HQRadio = Call Compile Format ["BIS_WF_HQ%1",sideJoinedText]; +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Radio Announcer - [Done]",diag_frameno,diag_tickTime]; +waitUntil {!isNil Format ["BIS_WF_HQ%1_TI",sideJoinedText]}; +WFBE_V_HQTopicSide = Call Compile Format ["BIS_WF_HQ%1_TI",sideJoinedText]; +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Radio Announcer (Identity Synchronization) - [Done]",diag_frameno,diag_tickTime]; +_HQRadio setIdentity WFBE_V_HQTopicSide; +_HQRadio setRank "COLONEL"; +_HQRadio setGroupId ["HQ"]; +_HQRadio kbAddTopic [WFBE_V_HQTopicSide,"Client\kb\hq.bikb","Client\kb\hq.fsm",{call compile preprocessFileLineNumbers "Client\kb\hq.sqf"}]; +player kbAddTopic [WFBE_V_HQTopicSide,"Client\kb\hq.bikb","Client\kb\hq.fsm",{call compile preprocessFileLineNumbers "Client\kb\hq.sqf"}]; +sideHQ = _HQRadio; + +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Radio Announcers - [Done]",diag_frameno,diag_tickTime]; + +/* Wait for a valid signal (Teamswaping) with failover */ +if (isMultiplayer && paramKickTeamswappers && time > 7) then { + Private ["_get","_timelaps"]; + _get = true; + + sleep (random 0.1); + + WFBE_RequestJoin = ['SRVFNCREQUESTJOIN',[getPlayerUID(player),sideJoined,name player,vehicleVarName player]]; + publicVariable 'WFBE_RequestJoin'; + + _timelaps = 0; + while {true} do { + sleep 0.1; + _get = 'WFBE_P_CANJOIN' Call GetNamespace; + if !(isNil '_get') exitWith {diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Client %3 (side: %4) can join game -> %5",diag_frameno,diag_tickTime,name player,sideJoined,_get]}; + + _timelaps = _timelaps + 0.1; + if (_timelaps > 5) then { + _timelaps = 0; + diag_log Format["[WFBE (WARNING)][frameno:%1 | ticktime:%2] Init_Client: Client %3 (side: %4) Pending... no ACK answer from server were received, sending a new request...",diag_frameno,diag_tickTime,name player,sideJoined]; + WFBE_RequestJoin = ['SRVFNCREQUESTJOIN',[getPlayerUID(player),sideJoined,name player,vehicleVarName player]]; + publicVariable 'WFBE_RequestJoin'; + }; + }; + + if !(_get) exitWith { + diag_log Format["[WFBE (WARNING)][frameno:%1 | ticktime:%2] Init_Client: Client %3 (side: %4) has teamswapped and was sent back to the lobby...",diag_frameno,diag_tickTime,name player,sideJoined]; + (localize 'STR_WF_CHAT_Teamswap_Warnning') Call CommandChatMessage; + sleep 3; + failMission "END1"; + }; +}; + +/* Get the client starting location */ +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Getting the client spawn location - [In Progress]",diag_frameno,diag_tickTime]; +_base = objNull; +if (time < 30) then { + waitUntil {!isNil Format ["%1StartingLocation",sideJoinedText]}; + _base = Call Compile Format ["%1StartingLocation",sideJoinedText]; +} else { + waitUntil {!isNil Format ["%1MHQ",sideJoinedText]}; + _base = (sideJoinedText) Call GetSideHQ; + _buildings = (sideJoinedText) Call GetSideStructures; + + if (count _buildings > 0) then {_base = _buildings select 0}; +}; + +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Getting the client spawn location (%3) - [Done]",diag_frameno,diag_tickTime,typeOf _base]; + +/* Position the client at the previously defined location */ +player setPos ([getPos _base,20,30] Call GetRandomPosition); + +/* HQ Building Init. */ +waitUntil {!isNil Format ["%1MHQDeployed",sideJoinedText]}; +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: CoIn module for HQ - [Done]",diag_frameno,diag_tickTime]; +_isDeployed = (sideJoinedText) Call GetSideHQDeployed; +if (_isDeployed) then { + ['WFBE_AREAHQDEPLOYED' Call GetNamespace,true,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; +} else { + ['WFBE_AREAHQUNDEPLOYED' Call GetNamespace,false,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; +}; + +/* Options menu. */ +Options = player addAction ["" + (localize "STR_WF_Options") + "","Client\Action\Action_Menu.sqf", "", 1, false, true, "", "_target == player"]; + +/* Zeta Cargo Lifter. */ +[] Call Compile preprocessFile "Client\Module\ZetaCargo\Zeta_Init.sqf"; +/* Set Groups ID. */ +[] Call Compile preprocessFile "Client\Functions\Client_SetGroupsID.sqf"; + +sleep 1; + +//--- Play a tune. +_music = switch (true) do { + case WF_A2_Vanilla: {["Track11_Large_Scale_Assault","Track02_Insertion","Ambient07_Manhattan","Track10_Logistics","Track09_Movement_To_Contact","Track16_Valentine"]}; + case WF_A2_Arrowhead: {["EP1_Track10","EP1_Track12","EP1_Track14","EP1_Track15"]}; + case WF_A2_CombinedOps: {["EP1_Track10","EP1_Track15","Track11_Large_Scale_Assault","Track02_Insertion","Ambient07_Manhattan","Track10_Logistics","Track09_Movement_To_Contact","Track16_Valentine"]}; + default {[]}; +}; + +if (count _music > 0) then {playMusic (_music select floor(random(count _music)))}; + +/* Override player's Gear.*/ +player call EquipDefaultLoadout; +/* Default gear menu filler. */ +WF_Logic setVariable ['filler','primary']; + +/* Skill Module. */ +[] Call Compile preprocessFile "Client\Module\Skill\Skill_Init.sqf"; +(player) Call WFBE_SK_FNC_Apply; + +/* Vote System, define whether a vote is already running or not */ +_voteTime = 0; +waitUntil {sleep 0.1;_voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];!(isNil '_voteTime')}; +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Vote System Initialization - [Done]",diag_frameno,diag_tickTime]; +if (_voteTime > 0) then {createDialog "RscMenu_Voting"}; + +/* Debug System - Client */ +if (WF_Debug) then { + onMapSingleClick {vehicle player setpos _pos;(vehicle player) setVelocity [0,0,-0.1];}; //--- Teleport + //player addEventHandler ["HandleDamage", {false}]; + // player setCaptive true; + player addEventHandler ["HandleDamage", {false;if (player != (_this select 3)) then {(_this select 3) setDammage 1}}]; //--- God-Slayer mode. +}; + +/* ISIS Module */ +if (('WFBE_ISIS' Call GetNamespace) != 0) then {player addEventHandler['handleDamage',{_this Call ISIS_Wound}]}; + +/* Artillery UI */ +if (paramArtyUI) then {[] ExecVM "ca\modules\ARTY\data\scripts\init.sqf"}; + +/* EASA */ +if (paramEASA) then {[] Call Compile preProcessFile "Client\Module\EASA\EASA_Init.sqf"}; + +/* Key Binding */ +[] Call Compile preprocessFile "Client\Init\Init_Keybind.sqf"; + +/* JIP Handler */ +waitUntil {townInit}; +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Towns Initialization - [Done]",diag_frameno,diag_tickTime]; + +/* Conquest helper */ +if (('WFBE_TOWNCONQUESTMODE' Call GetNamespace) > 0) then {[] ExecFSM "Client\FSM\conquest_helper.fsm"}; + +sleep 3; +/* JIP System, initialize the camps and towns properly. */ +[] Spawn { + sleep 2; + diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: JIP Detected, Updating the markers - [Done]",diag_frameno,diag_tickTime]; + [] ExecVM "Client\Functions\Client_InitTownsAndCamps.sqf"; +}; + +/* Repair Truck CoIn Handling. */ +['WFBE_AREAREPAIRTRUCK' Call GetNamespace,false,RCoin,"REPAIR"] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; + +/* A new player come to reinforce the battlefield */ +[sideJoinedText,'UnitsCreated',1] Call UpdateStatistics; + +/* Towns Task System */ +["TownAddComplete"] Spawn TaskSystem; + +/* End Init */ +finishMissionInit; + +/* Client death handler. */ +Call Compile Format ["player addEventHandler ['Killed',{[_this select 0,_this select 1] Spawn PlayerKilled;[_this select 0,_this select 1,%1,false] Spawn UnitKilled}]",sideJoined]; + +/* Client Init Done - Remove the blackout */ +12452 cutText [(localize 'STR_WF_Loading')+"...","BLACK IN",5]; + +diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_Client: Init End at %3",diag_frameno,diag_tickTime,time]; \ No newline at end of file diff --git a/Client/Init/Init_Coin.sqf b/Client/Init/Init_Coin.sqf new file mode 100644 index 0000000..7bb4caf --- /dev/null +++ b/Client/Init/Init_Coin.sqf @@ -0,0 +1,91 @@ +Private ['_area','_coin','_coinCategories','_coinItemArray','_curId','_d','_defenseCategories','_defenseCosts','_defenseDescriptions','_defenses','_emptyStructures','_extra','_fix','_i','_indexCategory','_isHQdeployed','_structureCosts','_structureDescriptions','_structures','_updateDefenses','_updateStructures']; +_area = _this select 0; +_isHQdeployed = _this select 1; +_coin = _this select 2; +_extra = ""; +if (count _this > 3) then {_extra = _this select 3}; + +_coin setVariable ["BIS_COIN_areasize", _area]; +_coin setVariable ["BIS_COIN_fundsDescription",["$"]]; +if (_extra == "") then { + _coin setVariable ["BIS_COIN_funds",if !(paramMoneyOnly) then {[(sideJoined) Call GetSideSupply, Call GetPlayerFunds]} else {Call GetPlayerFunds}]; + _coin setVariable ["BIS_COIN_fundsDescription",if !(paramMoneyOnly) then {["S ","$ "]} else {["$ "]}]; +}; + +_defenses = []; +_defenseCosts = []; +_defenseDescriptions = []; +_defenseCategories = []; + +_structures = [(Format["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace) select 0]; +_structureCosts = [(Format["WFBE_%1STRUCTURECOSTS",sideJoinedText] Call GetNamespace) select 0]; +_structureDescriptions = [(Format["WFBE_%1STRUCTUREDESCRIPTIONS",sideJoinedText] Call GetNamespace) select 0]; + +_i = 0; + +_updateStructures = false; +_updateDefenses = false; +_emptyStructures = false; + +if (_isHQdeployed && _extra == "") then {_i = 1;_updateStructures = true; _updateDefenses = true}; +if (_extra == "REPAIR") then {_updateDefenses = true; _emptyStructures = true;_coin setVariable ["BIS_COIN_funds",Call GetPlayerFunds]}; + +if (_updateStructures) then { + _structures = Format["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace; + _structureCosts = Format["WFBE_%1STRUCTURECOSTS",sideJoinedText] Call GetNamespace; + _structureDescriptions = Format["WFBE_%1STRUCTUREDESCRIPTIONS",sideJoinedText] Call GetNamespace; +}; + +if (_updateDefenses) then { + _defenses = Format["WFBE_%1DEFENSENAMES",sideJoinedText] Call GetNamespace; + { + _d = _x Call GetNamespace; + if !(isNil '_d') then { + _defenseCosts = _defenseCosts + [(_d select QUERYUNITPRICE)]; + _defenseDescriptions = _defenseDescriptions + [(_d select QUERYUNITLABEL)]; + _defenseCategories = _defenseCategories + [(_d select QUERYUNITFACTORY)]; + }; + } forEach _defenses; +}; + +if (_emptyStructures) then { + _structures = []; + _structureCosts = []; + _structureDescriptions = []; +}; + +_indexCategory=0; +_coinCategories = []; +_coinItemArray = []; +if (count _structures > 0) then {_coinCategories = _coinCategories + [localize "strwfbase"];_indexCategory =_indexCategory +1;}; +if (count _defenses > 0) then {if (_extra == "REPAIR") then {_coinCategories = []};_coinCategories = _coinCategories + [localize "str_m04t37_0"] + [localize "STR_WF_Fortification"] + [localize "STR_WF_Strategic"] + [localize "STR_WF_Ammo"]}; + +if (_isHQdeployed && _i == 1 && _extra == "") then {_coinItemArray = _coinItemArray + [[_structures select 0,0,[0, _structureCosts select 0], (_structureDescriptions select 0) + " " + localize "strwfhqmobilizeme"]]}; +for [{_i=_i}, {_i 75) then { + //--- Retrieve an potential target list. + _targets = _barrel nearEntities [["Car","Motorcycle","Tank","Ship","StaticCannon"], 'WFBE_ARTILLERYAMMOSADARMRANGE' Call GetNamespace]; + if (count _targets > 0) then { + _targetToHit = _targets select floor(random(count _targets)); + sleep random(3); + _targetFound=1; + }; + }; + + sleep 0.2; + + (_pz < 10 or _targetFound==1); +}; + +// Deploy attack munition if a target was found. +if (_targetFound==1 && alive _barrel) then { + _deployPos = getPos _barrel; + _px = _deployPos select 0; + _py = _deployPos select 1; + _pz = _deployPos select 2; + + deleteVehicle _barrel; + deleteVehicle _parachute; + + // Create burst. + _burst = "ARTY_SADARM_BURST" createVehicleLocal [_px, _py, _pz + 5]; + _burst setPos [_px, _py, _pz + 5]; + + // Create projectile + _projectile = "ARTY_SADARM_PROJO" createVehicleLocal [_px, _py, _pz + 5]; + _projectile setPos [_px, _py, _pz + 5]; + + // Calculate direction + _xoff = (getPos _targetToHit select 0) - _px; + _yoff = (getPos _targetToHit select 1) - _py; + _zoff = - _pz; + _mag = sqrt(_xoff*_xoff + _yoff*_yoff + _zoff*_zoff); + _dir = [_xoff/_mag, _yoff/_mag, _zoff/_mag]; + _dx = _dir select 0; + _dy = _dir select 1; + _dz = _dir select 2; + _hmag = sqrt(_dx*_dx + _dy*_dy); + _zcomp = -_dz/_hmag; + _ux = _zcomp*_dx; + _uy = _zcomp*_dy; + _uz = _hmag; + + //--- Positionate the projectile. + _projectile setVectorDir _dir; + _projectile setVectorUp [_ux,_uy,_uz]; + _projectile setVelocity [(_dir select 0) * 300, (_dir select 1) * 300, (_dir select 2) * 300]; +}; + +//--- Delete the model. +deleteVehicle _barrel; +if !(isNull _parachute) then {deleteVehicle _parachute}; \ No newline at end of file diff --git a/Client/Module/Arty/ARTY_mobileMissionFinish.sqf b/Client/Module/Arty/ARTY_mobileMissionFinish.sqf new file mode 100644 index 0000000..9b560c4 --- /dev/null +++ b/Client/Module/Arty/ARTY_mobileMissionFinish.sqf @@ -0,0 +1,12 @@ +Private ["_lookPos","_vehicle"]; + +_vehicle = _this select 0; + +// Lower gun/missile racks. +_lookPos = [(getPos _vehicle select 0) + (sin (getDir _vehicle))*20, +(getPos _vehicle select 1) + (cos (getDir _vehicle))*20, + (getPos _vehicle select 2) - 5]; + +(driver _vehicle) enableAI "MOVE"; +(driver _vehicle) enableAI "TARGET"; +(gunner _vehicle) lookAt _lookPos; \ No newline at end of file diff --git a/Client/Module/Arty/ARTY_mobileMissionPrep.sqf b/Client/Module/Arty/ARTY_mobileMissionPrep.sqf new file mode 100644 index 0000000..9922b0d --- /dev/null +++ b/Client/Module/Arty/ARTY_mobileMissionPrep.sqf @@ -0,0 +1,10 @@ +Private ['_vehicle']; + +_vehicle = _this select 0; + +(driver _vehicle) action ["engineOff", _vehicle]; +(driver _vehicle) disableAI "MOVE"; +(driver _vehicle) disableAI "TARGET"; +waitUntil {speed _vehicle < 1}; + +sleep 3; diff --git a/Client/Module/CM/CM_Countermeasures.sqf b/Client/Module/CM/CM_Countermeasures.sqf new file mode 100644 index 0000000..795108b --- /dev/null +++ b/Client/Module/CM/CM_Countermeasures.sqf @@ -0,0 +1,22 @@ +Private ["_flarecount","_i","_isActive","_missile","_type","_vehicle"]; +_vehicle = _this select 0; +_missile = _this select 1; + +if (alive _vehicle && (getPos _vehicle) select 2 > 5) then { + _isActive = _vehicle getvariable "FlareActive"; + _type = getNumber (configFile >> "CfgAmmo" >> _missile >> "AirLock"); + if ((_type == 1) && (! _isActive)) then { + private ["_flarecount"]; + _vehicle setVariable ["FlareActive", true]; + if ((driver _vehicle) == player) then {_vehicle vehicleChat "WARNING: incomming missile!"}; + _flarecount = _vehicle getVariable "FlareCount"; + if (_flarecount > 0) then { + _this Spawn CM_Spoofing; + for [{_i=0}, {_i<8}, {_i=_i+1}] do { + [_vehicle] Call CM_Flares; + sleep 0.3; + }; + }; + _vehicle setVariable ["FlareActive", false]; + }; +}; \ No newline at end of file diff --git a/Client/Module/CM/CM_Flares.sqf b/Client/Module/CM/CM_Flares.sqf new file mode 100644 index 0000000..5d616d8 --- /dev/null +++ b/Client/Module/CM/CM_Flares.sqf @@ -0,0 +1,46 @@ +//--- ArmA 2 countermeasures, by Maddmatt. +Private ["_dirpos","_div","_emmiters","_flare","_flarecount","_flares","_flarevel","_i","_launchercount","_li","_muzzzlevel","_relpos","_sm","_sp","_vehicle","_vvel"]; +_vehicle = _this select 0; +_flares = []; +_emmiters = []; +_muzzzlevel = 25; +if (_vehicle isKindOf "Plane") then {_muzzzlevel = 150}; +_launchercount = 0; +while {([0,0,0] distance (_vehicle selectionPosition (format ["flare_launcher%1",_launchercount+1]))) != 0} do {_launchercount = _launchercount+1}; + +for "_i" from 1 to (_launchercount) do { + _flarecount = (_vehicle getVariable "FlareCount") - 1; + _vehicle setVariable ["FlareCount", _flarecount]; + _relpos = _vehicle modelToWorld (_vehicle selectionPosition format["flare_launcher%1",_i]); + _dirpos = _vehicle modelToWorld (_vehicle selectionPosition format["flare_launcher%1_dir",_i]); + _flare = "FlareCountermeasure" createVehicleLocal _relpos; + _dirpos = [(_dirpos select 0) - (_relpos select 0),(_dirpos select 1) - (_relpos select 1),(_dirpos select 2) - (_relpos select 2)]; + _div = (abs (_dirpos select 0)) + (abs (_dirpos select 1)) + (abs (_dirpos select 2)); + _flarevel = [(_dirpos select 0)/_div*_muzzzlevel,(_dirpos select 1)/_div*_muzzzlevel,(_dirpos select 2)/_div*_muzzzlevel]; + _vvel = velocity _vehicle; + + _flare setVelocity [(_flarevel select 0) + (_vvel select 0),(_flarevel select 1) + (_vvel select 1),(_flarevel select 2) + (_vvel select 2)]; + _flares = _flares + [_flare]; + + _sm = "#particlesource" createVehicleLocal getpos _flare; + _sm setParticleRandom [0.5, [0.3, 0.3, 0.3], [0.5, 0.5, 0.5], 0, 0.3, [0, 0, 0, 0], 0, 0,360]; + _sm setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal", 16, 12, 8,0],"", "Billboard", 1, 3, [0, 0, 0],[0,0,0], 1, 1, 0.80, 0.5, [1.3,4],[[0.9,0.9,0.9,0.6], [1,1,1,0.3], [1,1,1,0]],[1],0.1,0.1,"","",_flare]; + _sm setDropInterval 0.02; + + _sp = "#particlesource" createVehicleLocal getpos _flare; + _sp setParticleRandom [0.03, [0.3, 0.3, 0.3], [1, 1, 1], 0, 0.2, [0, 0, 0, 0], 0, 0,360]; + _sp setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal", 16, 13, 2,0],"", "Billboard", 1, 0.1, [0, 0, 0],[0,0,0], 1, 1, 0.80, 0.5, [1.5,0],[[1,1,1,-4], [1,1,1,-4], [1,1,1,-2],[1,1,1,0]],[1000],0.1,0.1,"","",_flare,360]; + _sp setDropInterval 0.001; + + _li = "#lightpoint" createVehicleLocal getpos _flare; + _li setLightBrightness 0.1; + _li setLightAmbient [0.8, 0.6, 0.2]; + _li setLightColor [1, 0.5, 0.2]; + _li lightAttachObject [_flare, [0,0,0]]; + _emmiters = _emmiters + [_sm,_sp,_li]; +}; + +(_emmiters + _flares) spawn { + sleep 4.5 + random 1; + {deletevehicle _x} forEach _this; +}; \ No newline at end of file diff --git a/Client/Module/CM/CM_Init.sqf b/Client/Module/CM/CM_Init.sqf new file mode 100644 index 0000000..d1a119b --- /dev/null +++ b/Client/Module/CM/CM_Init.sqf @@ -0,0 +1,9 @@ +Private ["_amount","_vehicle"]; +_vehicle = _this select 0; + +if (isNull _vehicle) exitWith {}; +waitUntil {commonInitComplete}; +sleep 2; +_amount = if (_vehicle isKindOf "Plane") then {'WFBE_COUNTERMEASUREPLANES' Call GetNamespace} else {'WFBE_COUNTERMEASURECHOPPERS' Call GetNamespace}; +_vehicle setVariable ["FlareCount", _amount]; +_vehicle setVariable ["FlareActive", false]; diff --git a/Client/Module/CM/CM_Spoofing.sqf b/Client/Module/CM/CM_Spoofing.sqf new file mode 100644 index 0000000..25bb764 --- /dev/null +++ b/Client/Module/CM/CM_Spoofing.sqf @@ -0,0 +1,18 @@ +Private ["_ammo","_chance","_enemy","_prob","_missile","_vehicle"]; +_vehicle = _this select 0; +_ammo = _this select 1; +_enemy = _this select 2; +_missile = objnull; + +if ((alive _vehicle) && (isEngineOn _vehicle)) then { + _missile = nearestObject [_enemy,_ammo]; + waitUntil {(_missile distance _vehicle) < ((speed _vehicle) * 1.5)}; + _prob = 25 + (random 75); + _chance = random 100; + if (_prob > _chance) then { + while {alive _missile} do { + _missile setDir ((getDir _missile) + ((random 20) - 10)); + sleep 0.1; + }; + }; +}; \ No newline at end of file diff --git a/Client/Module/CoIn/coin_interface.sqf b/Client/Module/CoIn/coin_interface.sqf new file mode 100644 index 0000000..d8fa437 --- /dev/null +++ b/Client/Module/CoIn/coin_interface.sqf @@ -0,0 +1,950 @@ + +private ["_tooFar","_nearLog","_startpos","_camera","_logicGrp","_logicASL","_nvgstate","_loaded","_localtime", +"_player","_preview","_get","_border","_itemcash","_itemcost","_a","_b","_funds","_itemclass_preview","_mhq", +"_structuresCosts","_supply","_distance","_direction","_npos","_helper","_array","_hqDeployed","_index","_gdir", +"_new","_color","_fundsRemaining","_isFlat","_colorGUI","_tooltip","_tooltipType","_pos","_dir","_colorGreen","_colorRed", +"_colorGray","_itemclass","_itemcategory","_itemFunds","_itemname","_fileIcon","_filePicture","_textHeader", +"_textPicture","_type","_text1","_status","_text2","_text3","_textHint","_textControls","_cashValues","_cashValuesOld", +"_cashValue","_cashDescription","_cashText","_cashLines","_categories","_categoriesMenu","_limit","_buildLimit","_buildings", +"_checks","_canAfford","_canAffordCount","_text","_arrayNames","_arrayNamesLong","_arrayEnable","_arrayParams", +"_find","_category","_cashValuesCount","_cashSize","_cashPos","_upgrades","_items","_canAffordCountOld", +"_params","_selected","_oldTooltip","_fundsDescription","_restart","_logic", +"_mode","_areasize","_limitH","_limitV","_limitHOld","_limitVOld","_oldMenu","_source", +"_bns","_greenList","_buildingsNames","_buildingsType","_createBorder","_createBorderScope","_maxGrad","_minDist"]; + +_logic = _this select 3; +_startPos = _this select 4; +_source = _this select 5; + +if !(alive _source) exitWith {}; + +//--- Area limits. +_root = "REPAIR"; +_hq = (sideJoined) Call GetSideHQ; +if (_source == _hq) then {_root = "HQ"}; + +_tooFar = false; +if (paramBaseArea) then { + if (_source == _hq) then { + if (count(WF_Logic getVariable Format ['%1Area',SideJoinedText]) >= ('WFBE_BASEAREAMAX' Call GetNamespace)) then { + _nearLog = [_startPos,WF_Logic getVariable Format ['%1Area',SideJoinedText]] Call SortByDistance; + _startpos = position (_nearLog select 0); + if (_source distance _startpos > ('WFBE_MHQBUILDINGRANGE' Call GetNamespace)) exitWith { + _tooFar = true; + }; + }; + }; +}; + +if (isNil 'WFBE_COIN_Root') then {WFBE_COIN_Root = ""}; +if (WFBE_COIN_Root != _root) then {lastBuilt = []}; +WFBE_COIN_Root = _root; + +if (_tooFar) exitWith {hint (localize 'STR_WF_INFO_BaseArea_Reached')};//--- Base area reached. + +//--- Call in the construction interface. +112200 cutrsc ["WFBE_ConstructionInterface","plain"]; //---added-MrNiceGuy +uiNamespace setVariable ["COIN_displayMain",finddisplay 46]; + +//--- Terminate of system is already running +if !(isNil {player getVariable "bis_coin_logic"}) exitWith {}; +player setVariable ["bis_coin_logic",_logic]; +bis_coin_player = player; + +_camera = BIS_CONTROL_CAM; +if (isNil "BIS_CONTROL_CAM") then { + _camera = "camconstruct" camCreate [position player select 0,position player select 1,15]; + _camera cameraEffect ["internal","back"]; + _camera camPrepareFov 0.900; + _camera camPrepareFocus [-1,-1]; + _camera camCommitPrepared 0; + cameraEffectEnableHUD true; + _camera setdir direction player; + [_camera,-30,0] call BIS_fnc_setPitchBank; + _camera camConstuctionSetParams ([_startPos] + (_logic getVariable "BIS_COIN_areasize")); +}; +BIS_CONTROL_CAM = _camera; +BIS_CONTROL_CAM_LMB = false; +BIS_CONTROL_CAM_RMB = false; +showCinemaBorder false; + +1122 cutrsc ["constructioninterface","plain"]; + +//--- Prevent uikey override for other mods. +WF_COIN_DEH1 = (uiNamespace getVariable "COIN_displayMain") displayAddEventHandler ["KeyDown", "if !(isNil 'BIS_CONTROL_CAM_Handler') then {BIS_temp = ['keydown',_this,commandingMenu] spawn BIS_CONTROL_CAM_Handler; BIS_temp = nil;}"]; +WF_COIN_DEH2 = (uiNamespace getVariable "COIN_displayMain") displayAddEventHandler ["KeyUp", "if !(isNil 'BIS_CONTROL_CAM_Handler') then {BIS_temp = ['keyup',_this] spawn BIS_CONTROL_CAM_Handler; BIS_temp = nil;}"]; +WF_COIN_DEH3 = (uiNamespace getVariable "COIN_displayMain") displayAddEventHandler ["MouseButtonDown", "if !(isNil 'BIS_CONTROL_CAM_Handler') then {BIS_temp = ['mousedown',_this,commandingMenu] spawn BIS_CONTROL_CAM_Handler; BIS_temp = nil; BIS_CONTROL_CAM_onMouseButtonDown = _this; if (_this select 1 == 1) then {BIS_CONTROL_CAM_RMB = true}; if (_this select 1 == 0) then {BIS_CONTROL_CAM_LMB = true};}"]; +WF_COIN_DEH4 = (uiNamespace getVariable "COIN_displayMain") displayAddEventHandler ["MouseButtonUp", "if !(isNil 'BIS_CONTROL_CAM_Handler') then {BIS_CONTROL_CAM_RMB = false; BIS_CONTROL_CAM_LMB = false;}"]; + +BIS_CONTROL_CAM_keys = []; + +if (isNil "BIS_CONTROL_CAM_ASL") then { + createCenter sideLogic; + _logicGrp = createGroup sidelogic; + _logicASL = _logicGrp createUnit ["Logic",position player,[],0,"none"]; + BIS_CONTROL_CAM_ASL = _logicASL; +}; + +_logic setVariable ["BIS_COIN_selected",objNull]; +_logic setVariable ["BIS_COIN_params",[]]; +_logic setVariable ["BIS_COIN_tooltip",""]; +_logic setVariable ["BIS_COIN_menu","#USER:BIS_Coin_categories_0"]; +_logic setVariable ["BIS_COIN_restart",true]; +_logic setVariable ["WF_RequestUpdate",false]; +_get = _logic getVariable 'WF_NVGPersistent'; +_nvgstate = true; +if (isNil '_get') then { + _nvgstate = if (daytime > 18.5 || daytime < 5.5) then {true} else {false}; + _logic setVariable ['WF_NVGPersistent',_nvgstate]; +} else { + _nvgstate = _logic getVariable 'WF_NVGPersistent'; +}; +camUseNVG _nvgstate; +_logic setVariable ["BIS_COIN_nvg",_nvgstate]; + +_bns = Format["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace; +_greenList = [WESTBAR,WESTLVF,WESTHEAVY,WESTAIR,EASTBAR,EASTLVF,EASTHEAVY,EASTAIR]; +//--- Building Limit Init. +_buildingsNames = _bns; +_buildingsNames = _buildingsNames - [_buildingsNames select 0]; +_buildingsType = Format["WFBE_%1STRUCTURES",sideJoinedText] Call GetNamespace; +_buildingsType = _buildingsType - [_buildingsType select 0]; + +//--- Open menu +_logic spawn { + +private ["_params","_logic"]; +_logic = _this; + waitUntil {!isNil {_this getVariable "BIS_COIN_fundsOld"}}; + while {!isNil "BIS_CONTROL_CAM"} do { + waitUntil { + _params = _logic getVariable "BIS_COIN_params"; + if (isNil "_params") then {_params = []}; + (commandingMenu == "" && count _params == 0 && !BIS_CONTROL_CAM_RMB) || isNil "BIS_CONTROL_CAM" + }; + if (isNil "BIS_CONTROL_CAM") exitWith {}; + showCommandingMenu "#USER:BIS_Coin_categories_0"; + sleep 0.01; + }; +}; + +//--- Border - temporary solution //TODO: move border if position of logic changes (eg. by placing hq) +_createBorder = { + + private ["_dir","_xpos","_ypos","_zpos","_a","_border","_logic","_startpos","_oldBorder","_center","_size","_width","_pi","_perimeter","_wallcount","_total"]; + _logic = _this select 0; + _startpos = _this select 1; + _oldBorder = missionNamespace getVariable "BIS_COIN_border"; + if (!isNil "_oldBorder") then { + {deleteVehicle _x} forEach _oldBorder; + }; + missionNamespace setVariable ["BIS_COIN_border",nil]; + + _border = []; + _center = _startpos; + _size = (_logic getVariable "BIS_COIN_areasize") select 0; + _width = 9.998; //200/126 + _width = 9.996; //150/96 + _width = 9.992; //100/64 + _width = 9.967; //50/32 + _width = 9.917; //30/20 + _width = 9.83; //20/14 + _width = 9.48; //10/8 + _width = 10 - (0.1/(_size * 0.2)); + _width = 10; + + _pi = 3.14159265358979323846; + _perimeter = (_size * _pi); + _perimeter = _perimeter + _width - (_perimeter % _width); + _size = (_perimeter / _pi); + _wallcount = _perimeter / _width * 2; + _total = _wallcount; + + for "_i" from 1 to _total do { + _dir = (360 / _total) * _i; + _xpos = (_center select 0) + (sin _dir) * _size; + _ypos = (_center select 1) + (cos _dir) * _size; + _zpos = (_center select 2); + + _a = "transparentwall" createVehicleLocal [_xpos,_ypos,_zpos]; + _a setposasl [_xpos,_ypos,0]; + _a setdir (_dir + 90); + _border = _border + [_a]; + }; + missionNamespace setVariable ["BIS_COIN_border",_border]; +}; +_createBorderScope = [_logic,_startpos] spawn _createBorder; + +//--- This block is pretty important +if !(isNil "BIS_CONTROL_CAM_Handler") exitWith {endLoadingScreen}; + +BIS_CONTROL_CAM_Handler = { + private ["_terminate","_key","_NVGstate","_currentCash","_price","_closest","_closestType","_get","_targeting","_near","_preview", + "_ctrl","_menu","_player","_border","_mode","_input", + "_logic","_keysCancel","_keysBanned","_keyNightVision"]; + _mode = _this select 0; + _input = _this select 1; + _logic = bis_coin_player getVariable "bis_coin_logic"; + _terminate = false; + + if (isNil "_logic") exitWith {}; + + _keysCancel = actionKeys "MenuBack"; + + _keysBanned = [1]; + _keyNightVision = actionKeys "NightVision"; + + //--- Mouse DOWN + if (_mode == "mousedown") then { + _key = _input select 1; + if (_key == 1 && 65665 in (actionkeys "MenuBack")) then {_terminate = true}; + }; + + //--- Key DOWN + if (_mode == "keydown") then { + + _key = _input select 1; + _ctrl = _input select 3; + if !(_key in (BIS_CONTROL_CAM_keys + _keysBanned)) then {BIS_CONTROL_CAM_keys = BIS_CONTROL_CAM_keys + [_key]}; + + //--- Terminate CoIn + if (_key in _keysCancel && isNil "BIS_Coin_noExit") then {_terminate = true}; + + //--- Start NVG + if (_key in _keyNightVision) then { + _NVGstate = !(_logic getVariable "BIS_COIN_nvg"); + _logic setVariable ["BIS_COIN_nvg",_NVGstate]; + _logic setVariable ['WF_NVGPersistent',_NVGstate]; + camUseNVG _NVGstate; + }; + + //--- Last Built Defense (Custom Action #1). + if ((_key in (actionKeys "User15")) && count lastBuilt > 0) then { + _deployed = true; + if (WFBE_COIN_Root == "HQ") then {_deployed = (sideJoinedText) Call GetSideHQDeployed}; + _currentCash = Call GetPlayerFunds; + if (_currentCash > (lastBuilt select 2) select 1 && _deployed) then { + showCommandingMenu ''; + _logic setVariable ["BIS_COIN_params",lastBuilt]; + }; + }; + + //--- Manning Defense (Custom Action #2). + if ((_key in (actionKeys "User16")) && (('WFBE_AIDEFENSE' Call GetNamespace) > 0)) then { + if (manningDefense) then {manningDefense = false} else {manningDefense = true}; + _status = if (manningDefense) then {localize "STR_WF_On"} else {localize "STR_WF_Off"}; + _logic setVariable ["WF_RequestUpdate",true]; + }; + + //--- Sell Defense. (Commander only) (Custom Action #3). + if ((_key in (actionKeys "User17")) && !isNull(commanderTeam)) then { + if(commanderTeam == clientTeam) then { + _preview = _logic getVariable "BIS_COIN_preview"; + if (isNil "_preview") then {//--- Proceed when there is no preview. + _targeting = screenToWorld [0.5,0.5]; + _near = nearestObjects [_targeting,Format["WFBE_%1DEFENSENAMES",sideJoinedText] Call GetNamespace,25]; + if (count _near > 0) then { + _closest = _near select 0; + _sold = _closest getVariable 'sold'; + _closestType = typeOf (_closest); + _get = _closestType Call GetNamespace; + if (!isNil '_get' && isNil '_sold') then { + _closest setVariable ['sold',true]; + _price = _get select QUERYUNITPRICE; + round(_price/2) Call ChangePlayerFunds; + deleteVehicle _closest; + }; + }; + }; + }; + }; + }; + //--- Key UP + if (_mode == "keyup") then { + _key = _input select 1; + if (_key in BIS_CONTROL_CAM_keys) then {BIS_CONTROL_CAM_keys = BIS_CONTROL_CAM_keys - [_key]}; + }; + + //--- Deselect or Close + if (_terminate) then { + _menu = _this select 2; + + //--- Close + if (isNil "BIS_Coin_noExit") then { + if (_menu == "#USER:BIS_Coin_categories_0") then { + BIS_CONTROL_CAM cameraEffect ["terminate","back"]; + camDestroy BIS_CONTROL_CAM; + BIS_CONTROL_CAM = nil; + } else { + _preview = _logic getVariable "BIS_COIN_preview"; + if !(isNil "_preview") then {deleteVehicle _preview}; + _logic setVariable ["BIS_COIN_preview",nil]; + _logic setVariable ["BIS_COIN_params",[]]; + _get = _logic getVariable 'WFBE_Helper'; + if !(isNil '_get') then { + deleteVehicle _get; + _logic setVariable ['WFBE_Helper',nil]; + }; + }; + }; + }; + + //--- Camera no longer exists - terminate and start cleanup + if (isNil "BIS_CONTROL_CAM" || player != bis_coin_player || !isNil "BIS_COIN_QUIT") exitWith { + if !(isNil "BIS_CONTROL_CAM") then {BIS_CONTROL_CAM cameraEffect ["terminate","back"];camDestroy BIS_CONTROL_CAM;}; + BIS_CONTROL_CAM = nil; + BIS_CONTROL_CAM_Handler = nil; + 1122 cuttext ["","plain"]; + _player = bis_coin_player; + _player setVariable ["bis_coin_logic",nil]; + bis_coin_player = objNull; + _preview = _logic getVariable "BIS_COIN_preview"; + if !(isNil "_preview") then {deleteVehicle _preview}; + _logic setVariable ["BIS_COIN_preview",nil]; + _get = _logic getVariable 'WFBE_Helper'; + if !(isNil '_get') then { + deleteVehicle _get; + _logic setVariable ['WFBE_Helper',nil]; + }; + _logic setVariable ["BIS_COIN_selected",nil]; + _logic setVariable ["BIS_COIN_params",nil]; + _logic setVariable ["BIS_COIN_lastdir",nil]; + _logic setVariable ["BIS_COIN_tooltip",nil]; + _logic setVariable ["BIS_COIN_fundsOld",nil]; + _logic setVariable ["BIS_COIN_restart",nil]; + _logic setVariable ["BIS_COIN_nvg",nil]; + _logic setVariable ["WF_RequestUpdate",nil]; + showCommandingMenu ""; + + //_display = finddisplay 46; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["KeyDown",WF_COIN_DEH1]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["KeyUp",WF_COIN_DEH2]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["MouseButtonDown",WF_COIN_DEH3]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["MouseButtonUp",WF_COIN_DEH4]; + + //--- Behold the placeholders + BIS_COIN_QUIT = nil; + _border = missionNamespace getVariable "BIS_COIN_border"; + {deleteVehicle _x} forEach _border; + missionNamespace setVariable ["BIS_COIN_border",nil]; + }; +}; + +waitUntil {scriptDone _createBorderScope}; +endLoadingScreen; + + +///*** LOOOP **** +_canAffordCount = 0; +_canAffordCountOld = 0; +_oldMenu = commandingMenu; +_limitHOld = -1; +_limitVOld = -1; +_loaded = false; +_localtime = time; + +_maxGrad = 'WFBE_COINMAXGRADIENT' Call GetNamespace; +_minDist = 'WFBE_COINMINDISTANCE' Call GetNamespace; + +while {!isNil "BIS_CONTROL_CAM"} do { + //if (isnull (uiNamespace getVariable 'BIS_CONTROL_CAM_DISPLAY') && !_loaded) then { + if (isnull (uiNamespace getVariable 'wfbe_title_coin') && !_loaded) then { //---TEST MrNiceGuy + cameraEffectEnableHUD true; + 1122 cutrsc ["constructioninterface","plain"]; + _loaded = true; + _logic setVariable ["BIS_COIN_restart",true]; + _localtime = time; + }; + if ((time - _localtime) >= 1 && _loaded) then {_loaded = false}; + _logic = bis_coin_player getVariable "bis_coin_logic"; + + _mode = "mousemoving"; + _camera = BIS_CONTROL_CAM; + + if (isNil "_logic") exitWith {}; + + //--- Player dies on construction mode or the source die. + if (!alive player || !alive _source) exitWith { + startLoadingScreen [localize "str_coin_exit" + " " + localize "str_coin_name","RscDisplayLoadMission"]; + + if !(isNil "BIS_CONTROL_CAM") then {BIS_CONTROL_CAM cameraEffect ["terminate","back"];camDestroy BIS_CONTROL_CAM;}; + BIS_CONTROL_CAM = nil; + BIS_CONTROL_CAM_Handler = nil; + 1122 cuttext ["","plain"]; + _player = bis_coin_player; + _player setVariable ["bis_coin_logic",nil]; + bis_coin_player = objNull; + _preview = _logic getVariable "BIS_COIN_preview"; + if !(isNil "_preview") then {deleteVehicle _preview}; + _logic setVariable ["BIS_COIN_preview",nil]; + _get = _logic getVariable 'WFBE_Helper'; + if !(isNil '_get') then { + deleteVehicle _get; + _logic setVariable ['WFBE_Helper',nil]; + }; + _logic setVariable ["BIS_COIN_selected",nil]; + _logic setVariable ["BIS_COIN_params",nil]; + _logic setVariable ["BIS_COIN_lastdir",nil]; + _logic setVariable ["BIS_COIN_tooltip",nil]; + _logic setVariable ["BIS_COIN_fundsOld",nil]; + _logic setVariable ["BIS_COIN_restart",nil]; + _logic setVariable ["BIS_COIN_nvg",nil]; + _logic setVariable ["WF_RequestUpdate",nil]; + showCommandingMenu ""; + + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["KeyDown",WF_COIN_DEH1]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["KeyUp",WF_COIN_DEH2]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["MouseButtonDown",WF_COIN_DEH3]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["MouseButtonUp",WF_COIN_DEH4]; + + //--- Behold the placeholders + BIS_COIN_QUIT = nil; + WF_COIN_DEH1 = nil; + WF_COIN_DEH2 = nil; + WF_COIN_DEH3 = nil; + WF_COIN_DEH4 = nil; + _border = missionNamespace getVariable "BIS_COIN_border"; + {deleteVehicle _x} forEach _border; + missionNamespace setVariable ["BIS_COIN_border",nil]; + + endLoadingScreen; + }; + + _areasize = (_logic getVariable "BIS_COIN_areasize"); + _limitH = _areasize select 0; + _limitV = _areasize select 1; + + if (_limitH != _limitHOld || _limitV != _limitVOld) then { + [_logic,_startpos] spawn _createBorder; + BIS_CONTROL_CAM camConstuctionSetParams ([_startPos] + (_logic getVariable "BIS_COIN_areasize")); + }; + _limitHOld = _limitH; + _limitVOld = _limitV; + + //--- Mouse moving or holding + if (_mode in ["mousemoving","mouseholding"]) then { + //--- Check pressed keys + _keys = BIS_CONTROL_CAM_keys; + _ctrl = (29 in _keys) || (157 in _keys); + _shift = (42 in _keys) || (54 in _keys); + _alt = (56 in _keys); + + //--- Construction or Selection + _params = _logic getVariable "BIS_COIN_params"; + _tooltip = "empty"; + _tooltipType = "empty"; + _selected = objNull; + if (count _params > 0) then { + //--- Basic colors + _colorGreen = "#(argb,8,8,3)color(0,1,0,0.3,ca)"; + _colorRed = "#(argb,8,8,3)color(1,0,0,0.3,ca)"; + _colorGray = "#(argb,8,8,3)color(1,1,1,0.1,ca)"; + _colorGray = "#(argb,8,8,3)color(0,0,0,0.25,ca)"; + _color = _colorGreen; + + //--- Class, Category, Cost, (preview class), (display name) + _itemclass = _params select 0; + _itemcategory = _params select 1; + _itemcost = _params select 2; + _itemcash = 0; + if (typename _itemcost == "ARRAY") then {_itemcash = _itemcost select 0; _itemcost = _itemcost select 1}; + _funds = _logic getVariable "BIS_COIN_funds"; + if (typename _funds == "ARRAY") then { + _a = (sideJoined) Call GetSideSupply; + _b = Call GetPlayerFunds; + _funds = [_a]+[_b]; + } else { + _funds = [Call GetPlayerFunds]; + }; + _itemFunds = _funds select _itemcash; + _itemname = if (count _params > 3) then {_params select 3} else {getText (configFile >> "CfgVehicles" >> _itemclass >> "displayName")}; + _itemclass_preview = getText (configFile >> "CfgVehicles" >> _itemclass >> "ghostpreview"); + if (_itemclass_preview == "") then {_itemclass_preview = _itemclass}; + + //--- Preview building + _preview = camtarget BIS_CONTROL_CAM; + _new = false; + if (typeof _preview != _itemclass_preview) then { + //--- No preview + deleteVehicle _preview; + if !(isNil {_logic getVariable "BIS_COIN_preview"}) then {deleteVehicle (_logic getVariable "BIS_COIN_preview")}; //--- Serialization hack + _get = _logic getVariable 'WFBE_Helper'; + if !(isNil '_get') then { + deleteVehicle _get; + _logic setVariable ['WFBE_Helper',nil]; + }; + _hqDeployed = (sideJoinedText) Call GetSideHQDeployed; + _index = _bns find _itemclass; + if (_index == 0 && _hqDeployed) exitWith { + _mhq = (sideJoinedText) Call GetSideHQ; + (_mhq) Spawn HandleHQAction; + + WFBE_RequestStructure = ['SRVFNCREQUESTSTRUCTURE',[sideJoined,_itemclass,[0,0,0],0]]; + publicVariable 'WFBE_RequestStructure'; + if (isHostedServer) then {['SRVFNCREQUESTSTRUCTURE',[sideJoined,_itemclass,[0,0,0],0]] Spawn HandleSPVF}; + + ['WFBE_AREAHQUNDEPLOYED' Call GetNamespace,false,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; + + _structuresCosts = Format["WFBE_%1STRUCTURECOSTS",sideJoinedText] Call GetNamespace; + if !(paramMoneyOnly) then { + [sideJoined,-(_structuresCosts select _index)] Call ChangeSideSupply; + } else { + -(_structuresCosts select _index) Call ChangePlayerFunds; + }; + + ////////////////////////////////////////////////// + startLoadingScreen [localize "str_coin_exit" + " " + localize "str_coin_name","RscDisplayLoadMission"]; + ////////////////////////////////////////////////// + + if !(isNil "BIS_CONTROL_CAM") then {BIS_CONTROL_CAM cameraEffect ["terminate","back"];camDestroy BIS_CONTROL_CAM;}; + BIS_CONTROL_CAM = nil; + BIS_CONTROL_CAM_Handler = nil; + 1122 cuttext ["","plain"]; + _player = bis_coin_player; + _player setVariable ["bis_coin_logic",nil]; + bis_coin_player = objNull; + _preview = _logic getVariable "BIS_COIN_preview"; + if !(isNil "_preview") then {deleteVehicle _preview}; + _logic setVariable ["BIS_COIN_preview",nil]; + _logic setVariable ["BIS_COIN_selected",nil]; + _logic setVariable ["BIS_COIN_params",nil]; + _logic setVariable ["BIS_COIN_lastdir",nil]; + _logic setVariable ["BIS_COIN_tooltip",nil]; + _logic setVariable ["BIS_COIN_fundsOld",nil]; + _logic setVariable ["BIS_COIN_restart",nil]; + _logic setVariable ["BIS_COIN_nvg",nil]; + _logic setVariable ["WF_RequestUpdate",nil]; + showCommandingMenu ""; + + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["KeyDown",WF_COIN_DEH1]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["KeyUp",WF_COIN_DEH2]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["MouseButtonDown",WF_COIN_DEH2]; + (uiNamespace getVariable "COIN_displayMain") displayRemoveEventHandler ["MouseButtonUp",WF_COIN_DEH3]; + + //--- Behold the placeholders + BIS_COIN_QUIT = nil; + WF_COIN_DEH1 = nil; + WF_COIN_DEH2 = nil; + WF_COIN_DEH3 = nil; + WF_COIN_DEH4 = nil; + _border = missionNamespace getVariable "BIS_COIN_border"; + {deleteVehicle _x} forEach _border; + missionNamespace setVariable ["BIS_COIN_border",nil]; + + [] Spawn { + + private ["_mhq","_start"]; + _start = time; + waitUntil {!((sideJoinedText) Call GetSideHQDeployed) || time - _start > 15}; + if (time - _start < 15) then { + sleep 2; + _mhq = (sideJoinedText) Call GetSideHQ; + if (alive _mhq) then { + _mhq addAction [localize "STR_WF_Unlock_MHQ","Client\Action\Action_ToggleLock.sqf", [], 95, false, true, '', 'alive _target && locked _target']; + _mhq addAction [localize "STR_WF_Lock_MHQ","Client\Action\Action_ToggleLock.sqf", [], 94, false, true, '', 'alive _target && !(locked _target)']; + }; + }; + }; + + endLoadingScreen; + }; + + _preview = _itemclass_preview createVehicleLocal (screenToWorld [0.5,0.5]); + _gdir = _logic getVariable 'BIS_COIN_lastdir'; + if !(isNil '_gdir') then {_preview setDir _gdir}; + BIS_CONTROL_CAM camSetTarget _preview; + BIS_CONTROL_CAM camCommit 0; + _logic setVariable ["BIS_COIN_preview",_preview]; + _new = true; + + //--- Preview Helper. + if (_itemclass in _greenList && _index != -1) then { + _distance = (Format ["WFBE_%1STRUCTUREDISTANCES",sideJoinedText] Call GetNamespace) select _index; + _direction = (Format ["WFBE_%1STRUCTUREDIRECTIONS",sideJoinedText] Call GetNamespace) select _index; + _npos = [getPos _preview,_distance,getDir _preview + _direction] Call GetPositionFrom; + _helper = "Sign_Danger" createVehicleLocal _npos; + _helper setPos _npos; + _helper setDir (_direction+65); + + _array = _preview worldToModel (getPos _helper); + _array set [2,0]; + _helper attachTo [_preview,_array]; + + _logic setVariable ['WFBE_Helper',_helper]; + }; + + _preview setObjectTexture [0,_colorGray]; + _preview setVariable ["BIS_COIN_color",_colorGray]; + + //--- Exception - preview not created + if (isnull _preview) then { + deleteVehicle _preview; + _logic setVariable ["BIS_COIN_preview",nil]; + _logic setVariable ["BIS_COIN_params",[]]; + _get = _logic getVariable 'WFBE_Helper'; + if !(isNil '_get') then { + deleteVehicle _get; + _logic setVariable ['WFBE_Helper',nil]; + }; + }; + + } else { + //--- Check zone + if ( + ([position _preview,_startPos] call BIS_fnc_distance2D) > _limitH + ) then { + _color = _colorGray + } else { + + //--- No money + _funds = 0; + call compile format ["_funds = %1;",_itemFunds]; + _fundsRemaining = _funds - _itemcost; + if (_fundsRemaining < 0) then {_color = _colorRed}; + + _skipFlat = false; + if !(paramDefenseCollide) then { + if !(_itemcategory == 0) then {_skipFlat = true}; + if (surfaceIsWater(position _preview)) then {_color = _colorRed}; + if (_color != _colorRed) then { + //--- Prevent Wall'in. + if (count((position _preview) nearEntities [['Man','Car','Motorcycle','Tank','Air','Ship'],10]) > 0) then {_color = _colorRed}; + }; + }; + + if (typeOf _preview == "Concrete_Wall_EP1") then {_skipFlat = true}; + + //--- Do not control the flatness with strategic & fortifications. + if (!_skipFlat) then { + _isFlat = (position _preview) isFlatEmpty [ + (sizeof typeof _preview) / _minDist, //--- Minimal distance from another object + 0, //--- If 0, just check position. If >0, select new one + _maxGrad, //--- Max gradient + (sizeof typeof _preview), //--- Gradient area + 0, //--- 0 for restricted water, 2 for required water, + false, //--- True if some water can be in 25m radius + _preview //--- Ignored object + ]; + + //--- Unable to Place due to the land. + if (count _isFlat == 0 || count (((position _preview) nearEntities 10) - [_preview]) > 0) then {_color = _colorRed}; + }; + }; + _preview setObjectTexture [0,_color]; + _preview setVariable ["BIS_COIN_color",_color]; + + _tooltip = _itemclass; + _tooltipType = "preview"; + + //--- Temporary solution + _colorGUI = [1,1,1,0.1]; + if (_color == _colorGreen) then {_colorGUI = [0.3,1,0.3,0.3]}; + if (_color == _colorRed) then {_colorGUI = [1,0.2,0.2,0.4]}; + + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112201) ctrlSetTextColor _colorGUI; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112201) ctrlCommit 0; + }; + + //--- Place + if (!_new && !isnull _preview && ((BIS_CONTROL_CAM_LMB && 65536 in (actionKeys "DefaultAction")) || {_x in (actionKeys "DefaultAction")} count BIS_CONTROL_CAM_keys > 0) && _color == _colorGreen) then { + _pos = position _preview; + _dir = direction _preview; + deleteVehicle _preview; + _logic setVariable ["BIS_COIN_preview",nil]; + _logic setVariable ["BIS_COIN_params",[]]; + _get = _logic getVariable 'WFBE_Helper'; + if !(isNil '_get') then { + deleteVehicle _get; + _logic setVariable ['WFBE_Helper',nil]; + }; + + //--- Remove funds + //call compile format ["%1 = %1 - _itemcost;",_itemFunds]; + + //--- Execute designer defined code + [_logic,_itemclass,_pos,_dir,_params] spawn { + + private ["_hqDeployed","_structures","_get","_logic","_itemclass","_pos","_dir","_par"]; + _logic = _this select 0; + _itemclass = _this select 1; + _pos = _this select 2; + _dir = _this select 3; + _par = _this select 4; + + //--- Define the last direction used. + _logic setVariable ["BIS_COIN_lastdir",_dir]; + + //--- On Purchase. + [_logic,_itemclass] call { + Private["_cash","_class","_costs","_index","_logic","_price"]; + _logic = _this select 0; + _class = _this select 1; + _structures = Format["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace; + _costs = Format["WFBE_%1STRUCTURECOSTS",sideJoinedText] Call GetNamespace; + + //--- Structures. + _index = _structures find _class; + if (_index != -1) then { + _price = _costs select _index; + if !(paramMoneyOnly) then { + [sideJoined, -_price] Call ChangeSideSupply; + } else { + -(_price) Call ChangePlayerFunds; + }; + if (_index == 0) then { + _hqDeployed = (sideJoinedText) Call GetSideHQDeployed; + if (_hqDeployed) then { + ['WFBE_AREAHQUNDEPLOYED' Call GetNamespace,false,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; + } else { + ['WFBE_AREAHQDEPLOYED' Call GetNamespace,true,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; + }; + _logic setVariable ["BIS_COIN_restart",true]; + } else { + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERBUILDSCORE' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERBUILDSCORE' Call GetNamespace)]] Spawn HandleSPVF}; + }; + }; + + //--- Defense. + _get = _class Call GetNamespace; + if !(isNil '_get') then { + _price = _get select QUERYUNITPRICE; + -(_price) Call ChangePlayerFunds; + }; + }; + + //--- Execute designer defined code On Construct + [_logic,_itemclass,_pos,_dir,_par] call { + private ["_class","_defenses","_deployed","_dir",'_find',"_logic","_par","_pos","_structures"]; + _logic = _this select 0; + _class = _this select 1; + _pos = _this select 2; + _dir = _this select 3; + _par = _this select 4; + _structures = Format["WFBE_%1STRUCTURENAMES",sideJoinedText] Call GetNamespace; + _defenses = Format["WFBE_%1DEFENSENAMES",sideJoinedText] Call GetNamespace; + + _find = _structures find _class; + if (_find != -1) then { + //--- Increment the buildings. + if ((_find - 1) > -1) then { + _current = Call Compile Format ['%1BuildingsCurrent',sideJoinedText]; + _current set [_find - 1, (_current select (_find-1)) + 1]; + Call Compile Format ['%1BuildingsCurrent = _current',sideJoinedText]; + publicVariable Format ['%1BuildingsCurrent',sideJoinedText]; + }; + + WFBE_RequestStructure = ['SRVFNCREQUESTSTRUCTURE',[sideJoined,_class,_pos,_dir]]; + publicVariable 'WFBE_RequestStructure'; + if (isHostedServer) then {['SRVFNCREQUESTSTRUCTURE',[sideJoined,_class,_pos,_dir]] Spawn HandleSPVF}; + }; + + if (_class in _defenses) then { + WFBE_RequestDefense = ['SRVFNCREQUESTDEFENSE',[sideJoined,_class,_pos,_dir,manningDefense]]; + publicVariable 'WFBE_RequestDefense'; + if (isHostedServer) then {['SRVFNCREQUESTDEFENSE',[sideJoined,_class,_pos,_dir,manningDefense]] Spawn HandleSPVF}; + lastBuilt = _par; + }; + }; + }; + + //--- Temporary solution + _colorGUI = [1,1,1,0.1]; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112201) ctrlSetTextColor _colorGUI; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112201) ctrlCommit 0; + }; + } else { + _colorGUI = [1,1,1,0.1]; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112201) ctrlSetTextColor _colorGUI; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112201) ctrlCommit 0; + }; + + _oldTooltip = _logic getVariable "BIS_COIN_tooltip"; + if ((_tooltipType + _tooltip) != _oldTooltip || commandingMenu != _oldMenu || _logic getVariable "WF_RequestUpdate") then { + _logic setVariable ["WF_RequestUpdate",false]; + + //--- Description + _type = _tooltip; + + //--- Header & preview picture + _textHeader = "
"; + _textPicture = "


"; + _fileIcon = getText (configFile >> "cfgvehicles" >> _type >> "icon"); + if (str(configFile >> "CfgVehicleIcons" >> _fileIcon) != "") then {_fileIcon = getText (configFile >> "CfgVehicleIcons" >> _fileIcon)}; + _filePicture = getText (configFile >> "cfgvehicles" >> _type >> "picture"); + if (str(configFile >> "CfgVehicleIcons" >> _filePicture) != "") then {_filePicture = getText (configFile >> "CfgVehicleIcons" >> _filePicture)}; + + if (_tooltipType != "empty") then { + _textHeader = format [" %1
", + getText (configFile >> "cfgvehicles" >> _type >> "displayname"), + if (isnull _selected) then {""} else {str round ((1 - damage _selected) * 100) + "%"} + ]; + _textPicture = format [" ",_filePicture]; + }; + + _text1 = if (count _params > 0) then {"" + localize "str_coin_rotate" + "" + call compile (keyname 29) + "
"} else {"
"}; + + _status = if (manningDefense) then {localize "STR_WF_On"} else {localize "STR_WF_Off"}; + _text2 = if (count _params > 0) then {"" + localize "str_coin_build" + "" + call compile (actionKeysNames ["DefaultAction",1]) + "
"} else {"" + localize "STR_WF_AutoDefense" + ":" + _status + "
"}; + + _text3 = if (commandingMenu != "#USER:BIS_Coin_categories_0") then { + //--- Back hint + if (isNil "BIS_Coin_noExit") then { + "" + localize "str_coin_back" + "" + call compile (actionKeysNames ["MenuBack",1]) + ""; + } else {""}; + } else { + //--- Exit hint + if (isNil "BIS_Coin_noExit") then { + "" + localize "str_coin_exit" + "" + call compile (actionKeysNames ["MenuBack",1]) + ""; + } else {""}; + }; + + //--- Compose text + _textHint = ( + _textPicture + + _textHeader + + "" + ); + + _textControls = ( + _text1 + + _text2 + + _text3 + + "" + ); + + //--- Set box + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112211) ctrlShow true; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112211) ctrlCommit 0; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112214) ctrlSetStructuredText (parseText _textHint); + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112214) ctrlShow true; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112214) ctrlCommit 0; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112215) ctrlSetStructuredText (parseText _textControls); + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112215) ctrlShow true; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112215) ctrlCommit 0; + }; + + //--- Amount of funds changed + _funds = _logic getVariable "BIS_COIN_funds"; + if (typename _funds == "ARRAY") then { + _a = (sideJoined) Call GetSideSupply; + _b = Call GetPlayerFunds; + _funds = [_a]+[_b]; + } else { + _funds = [Call GetPlayerFunds]; + }; + _fundsDescription = _logic getVariable "BIS_COIN_fundsDescription"; + _cashValues = []; + {_cashValues = _cashValues + [_x]} forEach _funds; + _cashValuesOld = _logic getVariable "BIS_COIN_fundsOld"; + if (isNil "_cashValuesOld") then {_cashValuesOld = []; _cashValuesOld set [count _cashValues - 1,-1]}; + _restart = _logic getVariable "BIS_COIN_restart"; + if (!([_cashValues,_cashValuesOld] call bis_fnc_arraycompare) || _restart) then { + _cashValuesCount = count _cashValues; + _cashSize = if (_cashValuesCount <= 1) then {2} else {2.8 / _cashValuesCount}; + _cashText = format ["",_cashSize]; + _cashLines = 0; + for "_i" from 0 to (count _funds - 1) do { + _cashValue = _cashValues select _i; + _cashDescription = if (count _fundsDescription > _i) then {_fundsDescription select _i} else {"?"}; + _cashText = _cashText + format ["%1 %2
",_cashDescription,round _cashValue]; + _cashLines = _cashLines + 0.05; + }; + _cashText = _cashText + "
"; + _cashPos = ctrlPosition ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112224); + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112224) ctrlSetStructuredText (parseText _cashText); + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112224) ctrlSetPosition [_cashPos select 0,_cashPos select 1,_cashPos select 2,(_cashPos select 3)/*0.1*/ + _cashLines]; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112224) ctrlShow true; + ((uiNamespace getVariable "wfbe_title_coin") displayCtrl 112224) ctrlCommit 0; + + //--- Categories menu + _categories = +(_logic getVariable "BIS_COIN_categories"); + _categoriesMenu = []; + //--- Ammo Upgrade. + _upgrades = (sideJoinedText) Call GetSideUpgrades; + if (_upgrades select 14 < 1) then {_categories = _categories - [localize 'STR_WF_Ammo']}; + + for "_i" from 0 to (count _categories - 1) do { + _categoriesMenu = _categoriesMenu + [_i]; + }; + + [["Categories",true],"BIS_Coin_categories",[_categoriesMenu,_categories],"#USER:BIS_Coin_%1_items_0","",""] call BIS_fnc_createmenu; + + //--- Items menu + _items = _logic getVariable "BIS_COIN_items"; + _canAffordCountOld = _canAffordCount; + _canAffordCount = 0; + for "_i" from 0 to (count _categories - 1) do { + _category = _categories select _i; + _arrayNames = []; + _arrayNamesLong = []; + _arrayEnable = []; + _arrayParams = []; + { + _itemclass = _x select 0; + _itemcategory = _x select 1; + if (typename _itemcategory == typename "") then {//--- Backward compatibility + _itemcategory = _categories find _itemcategory; + } else {100}; + + if (_itemcategory < count _categories) then { + _itemcost = _x select 2; + _itemcash = 0; + if (typename _itemcost == "ARRAY") then {_itemcash = _itemcost select 0; _itemcost = _itemcost select 1}; + _cashValue = _cashValues select _itemcash; + _cashDescription = if (count _fundsDescription > _itemcash) then {_fundsDescription select _itemcash} else {"?"}; + _itemname = if (count _x > 3) then {_x select 3} else {getText (configFile >> "CfgVehicles" >> _itemclass >> "displayName")}; + //--- Build Limit reached? + _buildLimit = false; + _find = _buildingsNames find _itemclass; + if (_find != -1) then { + _current = Call Compile Format ['%1BuildingsCurrent',sideJoinedText]; + _limit = (Format['WFBE_BUILDINGMAX%1',(_buildingsType select _find)]) Call GetNamespace; + if (isNil '_limit') then {_limit = 4}; //--- Default. + if ((_current select _find) >= _limit) then {_buildLimit = true}; + }; + if (_itemcategory == _i/*_category*/) then { + _canAfford = if (_cashValue - _itemcost >= 0 && !_buildLimit) then {1} else {0}; + _canAffordCount = _canAffordCount + _canAfford; + // _text = _itemname + " - " + _cashDescription + str _itemcost; + // _arrayNamesLong = _arrayNamesLong + [_text + " "]; + _text = parseText(Format ['%1 %2 %3',_itemname,_cashDescription,_itemcost] + " "); + _arrayNames = _arrayNames + [_text]; + _arrayNamesLong = _arrayNamesLong + [_text]; + _arrayEnable = _arrayEnable + [_canAfford]; + _arrayParams = _arrayParams + [[_logic getVariable "BIS_COIN_ID"] + [_x,_i]]; + }; + }; + } forEach _items; + + [[_category,true],format ["BIS_Coin_%1_items",_i],[_arrayNames,_arrayNamesLong,_arrayEnable],""," + BIS_CONTROL_CAM_LMB = false; + scopename 'main'; + _item = '%1'; + _id = %2; + _array = (call compile '%3') select _id; + _logic = call compile ('BIS_COIN_'+ str (_array select 0)); + + _params = _array select 1; + _logic setVariable ['BIS_COIN_params',_params]; + _logic setVariable ['BIS_COIN_menu',commandingMenu]; + showCommandingMenu ''; + + ",_arrayParams] call BIS_fnc_createmenu; + }; + + if (_canAffordCount != _canAffordCountOld) then {showCommandingMenu (commandingMenu)}; //<-- Open menu again to show disabled items + }; + _logic setVariable ["BIS_COIN_fundsOld",_cashValues]; + _logic setVariable ["BIS_COIN_tooltip",_tooltipType + _tooltip]; + + if (_restart) then { + _logic setVariable ["BIS_COIN_restart",false]; + }; + }; + _oldMenu = commandingMenu; + sleep 0.01; +}; +112200 cuttext ["","plain"]; //---added-MrNiceGuy +showCommandingMenu ''; diff --git a/Client/Module/EASA/EASA_Equip.sqf b/Client/Module/EASA/EASA_Equip.sqf new file mode 100644 index 0000000..8bed693 --- /dev/null +++ b/Client/Module/EASA/EASA_Equip.sqf @@ -0,0 +1,45 @@ +Private ['_data','_get','_i','_index','_j','_old','_override','_tar','_tindex','_type','_vehicle','_z']; +_vehicle = _this select 0; +_index = _this select 1; +_tindex = _index; +_override = if (count _this > 2) then {_this select 2} else {false}; + +if (typeName _vehicle != 'OBJECT') exitWith {diag_log Format['[WFBE (ERROR)][frameno:%2 | ticktime:%3] EASA_Equip: Invalid Parameter (_vehicle), expected object instead of %1',_vehicle,diag_frameno,diag_tickTime]}; + +_type = ('WFBE_EASA_Vehicles' Call GetNamespace) find (typeOf _vehicle); +if (_type != -1) then { + _get = _vehicle getVariable 'WFBE_EASA_Setup'; + //--- Vehicle Loadout check. + if (isNil '_get') then { + [_vehicle,('WFBE_EASA_Default' Call GetNamespace) select _type] Call EASA_RemoveLoadout; + } else { + //--- Override the index?. + _tindex = if (_override) then {_index} else {(_get select 1)}; + + //--- Grab the old loadout. + _old = (('WFBE_EASA_Loadouts' Call GetNamespace) select (_get select 0)) select (_get select 1); + _tar = []; + for [{_i = 2},{_i < count(_old)},{_i = _i + 1}] do { + _tar = _tar + [_old select _i]; + }; + _old = _tar; + + [_vehicle,('WFBE_EASA_Default' Call GetNamespace) select _type] Call EASA_RemoveLoadout; + [_vehicle,_old] Call EASA_RemoveLoadout; + }; + + _data = (('WFBE_EASA_Loadouts' Call GetNamespace) select _type) select _tindex; + + for [{_j = 2},{_j < count(_data)},{_j = _j + 1}] do { + _z = _data select _j; + for [{_i = count(_z)-1},{_i >= 0},{_i = _i - 1}] do { + if (_i > 0) then { + _vehicle addMagazine (_z select _i); + } else { + _vehicle addWeapon (_z select _i); + }; + }; + }; + + _vehicle setVariable ['WFBE_EASA_Setup',[_type,_tindex],true]; +}; \ No newline at end of file diff --git a/Client/Module/EASA/EASA_Init.sqf b/Client/Module/EASA/EASA_Init.sqf new file mode 100644 index 0000000..8e35a00 --- /dev/null +++ b/Client/Module/EASA/EASA_Init.sqf @@ -0,0 +1,378 @@ +Private ['_easaDefault','_easaLoadout','_easaVehi','_vehicle']; + +EASA_Equip = Compile preProcessFile 'Client\Module\EASA\EASA_Equip.sqf'; +EASA_RemoveLoadout = Compile preProcessFile 'Client\Module\EASA\EASA_RemoveLoadout.sqf'; + +_easaDefault = []; +_easaLoadout = []; +_easaVehi = []; + +/* [[Price], [Description], [Weapon, Ammos], [Weapon, Ammos]...] */ +_easaVehi = _easaVehi + ['Su25_TK_EP1']; +_easaDefault = _easaDefault + [[['AirBombLauncher','4Rnd_FAB_250'],['R73Launcher_2','2Rnd_R73']]]; +_easaLoadout = _easaLoadout + [ +if (WF_A2_Arrowhead) then { + [ + [[1200],['R-73 (6)'],['R73Launcher_2','2Rnd_R73','2Rnd_R73','2Rnd_R73']], + [[1400],['R-73 (4) | FAB-250 (2)'],['R73Launcher_2','2Rnd_R73','2Rnd_R73'],['AirBombLauncher','2Rnd_FAB_250']], + [[1600],['R-73 (2) | FAB-250 (4)'],['R73Launcher_2','2Rnd_R73'],['AirBombLauncher','4Rnd_FAB_250']], + [[1900],['FAB-250 (6)'],['AirBombLauncher','4Rnd_FAB_250','2Rnd_FAB_250']] + ] +} else { + [ + [[0],['KAB-500 KR (6)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR']], + [[0],['Kh-29 (6)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['Kh-29 (4) | KAB-500 L (2)'],['Ch29Launcher_Su34','4Rnd_Ch29'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['Kh-29 (4) | R-73 (2)'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['R-73 (6)'],['ACE_R73Launcher','ACE_6Rnd_R73']], + [[0],['R-73 (4) | KAB-500 KR (2)'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR']], + [[0],['KAB-500 KR (4) | Kh-29 (2)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29']], + [[0],['FAB-500 (4) | Kh-29 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29']], + [[0],['FAB-500 (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['FAB-500 (6)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62']], + [[0],['R-73 (2) | FAB-250 (4)'],['ACE_R73Launcher','ACE_2Rnd_R73'],['AirBombLauncher','4Rnd_FAB_250']], + [[0],['R-73 (2) | KAB-500 KR (4)'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR']] + ] +} +]; + +_easaVehi = _easaVehi + ['Su25_Ins']; +_easaDefault = _easaDefault + [[['AirBombLauncher','4Rnd_FAB_250'],['R73Launcher_2','2Rnd_R73']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['KAB-500 KR (6)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR']], + [[0],['Kh-29 (6)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['Kh-29 (4) | KAB-500 L (2)'],['Ch29Launcher_Su34','4Rnd_Ch29'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['Kh-29 (4) | R-73 (2)'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['R-73 (6)'],['ACE_R73Launcher','ACE_6Rnd_R73']], + [[0],['R-73 (4) | KAB-500 KR (2)'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR']], + [[0],['KAB-500 KR (4) | Kh-29 (2)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29']], + [[0],['FAB-500 (4) | Kh-29 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29']], + [[0],['FAB-500 (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['FAB-500 (6)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62']], + [[0],['R-73 (2) | FAB-250 (4)'],['ACE_R73Launcher','ACE_2Rnd_R73'],['AirBombLauncher','4Rnd_FAB_250']], + [[0],['R-73 (2) | KAB-500 KR (4)'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR']] + ] +]; + +_easaVehi = _easaVehi + ['Su39']; +_easaDefault = _easaDefault + [[['Ch29Launcher','4Rnd_Ch29'],['R73Launcher_2','2Rnd_R73']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['KAB-500 KR (6)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR']], + [[0],['Kh-29 (6)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['Kh-29 (4) | KAB-500 L (2)'],['Ch29Launcher_Su34','4Rnd_Ch29'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['Kh-29 (4) | R-73 (2)'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['R-73 (6)'],['ACE_R73Launcher','ACE_6Rnd_R73']], + [[0],['R-73 (4) | KAB-500 KR (2)'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR']], + [[0],['KAB-500 KR (4) | Kh-29 (2)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29']], + [[0],['FAB-500 (4) | Kh-29 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29']], + [[0],['FAB-500 (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['FAB-500 (6)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62']], + [[0],['R-73 (2) | FAB-250 (4)'],['ACE_R73Launcher','ACE_2Rnd_R73'],['AirBombLauncher','4Rnd_FAB_250']], + [[0],['R-73 (2) | KAB-500 KR (4)'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR']] + ] +]; + + +_easaVehi = _easaVehi + ['Su34']; +_easaDefault = _easaDefault + [[['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['KAB-500 KR (6) | KAB-500 L (6)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['KAB-500 L (6) | R-73 (4) | R-27 (2)'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27']], + [[0],['KAB-500 L (6) | KAB-500 KR (4) | R-73 (2)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['KAB-500 L (6) | Kh-29 (4) | R-73 (2)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['KAB-500 KR (4) | Kh-29 (4) | R-73 (4)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73']], + [[0],['KAB-500 KR (4) | R-73 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['R73Launcher_2','2Rnd_R73'],['R73Launcher','4Rnd_R73']], + [[0],['KAB-500 KR (4) | Kh-29 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['KAB-500 KR (2) | R-73 (8)'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['R73Launcher','4Rnd_R73','4Rnd_R73']], + [[0],['KAB-500 KR (2) | R-73 (4) | Ch-29 (6)'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['KAB-500 KR (4) | R-73 (2) | Ch-29 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['R-73 (8) | R-27 (4)'],['ACE_R73Launcher','ACE_6Rnd_R73','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_4Rnd_R27']], + [[0],['R-73 (6) | R-27 (6)'],['ACE_R73Launcher','ACE_6Rnd_R73'],['ACE_R27Launcher','ACE_6Rnd_R27']], + [[0],['Kh-29 (6) | R-73 (4) |KAB-500 KR (2)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR']], + [[0],['Kh-29 (6) | R-73 (4) | R-27(2)'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['Kh-29 (12)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29','ACE_6Rnd_Kh29']], + [[0],['R-27 (2) | R-73 (4) | KAB-500 KR (2) | KAB-500 L (2) | FAB-500 (2)'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_FAB500M62Launcher','ACE_2Rnd_FAB500M62'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['ACE_KAB500LLauncher','ACE_2Rnd_KAB500L']], + [[0],['FAB-500 (6) | KAB-500 L (6)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['FAB-500 (6) | R-73 (4) | R-27 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27']], + [[0],['FAB-500 (6) | KAB-500 KR (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR']], + [[0],['FAB-500 (6) | Kh-29 (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['FAB-500 (4) | Kh-29 (4) | R-73 (4)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73']], + [[0],['FAB-500 (4) | R-73 (6)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['R73Launcher_2','2Rnd_R73'],['R73Launcher','4Rnd_R73']], + [[0],['FAB-500 (4) | Kh-29 (6)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']] + ] +]; + +_easaVehi = _easaVehi + ['ACE_Su30']; +_easaDefault = _easaDefault + [[['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['KAB-500 KR (6) | KAB-500 L (6)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['KAB-500 L (6) | R-73 (4) | R-27 (2)'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27']], + [[0],['KAB-500 L (6) | KAB-500 KR (4) | R-73 (2)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['KAB-500 L (6) | Kh-29 (4) | R-73 (2)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['KAB-500 KR (4) | Kh-29 (4) | R-73 (4)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73']], + [[0],['KAB-500 KR (4) | R-73 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['R73Launcher_2','2Rnd_R73'],['R73Launcher','4Rnd_R73']], + [[0],['KAB-500 KR (4) | Kh-29 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['KAB-500 KR (2) | R-73 (8)'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['R73Launcher','4Rnd_R73','4Rnd_R73']], + [[0],['KAB-500 KR (2) | R-73 (4) | Ch-29 (6)'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['KAB-500 KR (4) | R-73 (2) | Ch-29 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['R-73 (8) | R-27 (4)'],['ACE_R73Launcher','ACE_6Rnd_R73','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_4Rnd_R27']], + [[0],['R-73 (6) | R-27 (6)'],['ACE_R73Launcher','ACE_6Rnd_R73'],['ACE_R27Launcher','ACE_6Rnd_R27']], + [[0],['Kh-29 (6) | R-73 (4) |KAB-500 KR (2)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR']], + [[0],['Kh-29 (6) | R-73 (4) | R-27(2)'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['Kh-29 (12)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29','ACE_6Rnd_Kh29']], + [[0],['R-27 (2) | R-73 (4) | KAB-500 KR (2) | KAB-500 L (2) | FAB-500 (2)'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_FAB500M62Launcher','ACE_2Rnd_FAB500M62'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['ACE_KAB500LLauncher','ACE_2Rnd_KAB500L']], + [[0],['FAB-500 (6) | KAB-500 L (6)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['FAB-500 (6) | R-73 (4) | R-27 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27']], + [[0],['FAB-500 (6) | KAB-500 KR (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR']], + [[0],['FAB-500 (6) | Kh-29 (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['FAB-500 (4) | Kh-29 (4) | R-73 (4)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73']], + [[0],['FAB-500 (4) | R-73 (6)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['R73Launcher_2','2Rnd_R73'],['R73Launcher','4Rnd_R73']], + [[0],['FAB-500 (4) | Kh-29 (6)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']] + ] +]; + +_easaVehi = _easaVehi + ['ACE_Su30_des']; +_easaDefault = _easaDefault + [[['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_FAB500M62Launcher','ACE_2Rnd_FAB500M62'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['ACE_KAB500LLauncher','ACE_2Rnd_KAB500L']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['KAB-500 KR (6) | KAB-500 L (6)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['KAB-500 L (6) | R-73 (4) | R-27 (2)'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27']], + [[0],['KAB-500 L (6) | KAB-500 KR (4) | R-73 (2)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['KAB-500 L (6) | Kh-29 (4) | R-73 (2)'],['ACE_KAB500KRLauncher','ACE_6Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['KAB-500 KR (4) | Kh-29 (4) | R-73 (4)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73']], + [[0],['KAB-500 KR (4) | R-73 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['R73Launcher_2','2Rnd_R73'],['R73Launcher','4Rnd_R73']], + [[0],['KAB-500 KR (4) | Kh-29 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['KAB-500 KR (2) | R-73 (8)'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['R73Launcher','4Rnd_R73','4Rnd_R73']], + [[0],['KAB-500 KR (2) | R-73 (4) | Ch-29 (6)'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['KAB-500 KR (4) | R-73 (2) | Ch-29 (6)'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['R-73 (8) | R-27 (4)'],['ACE_R73Launcher','ACE_6Rnd_R73','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_4Rnd_R27']], + [[0],['R-73 (6) | R-27 (6)'],['ACE_R73Launcher','ACE_6Rnd_R73'],['ACE_R27Launcher','ACE_6Rnd_R27']], + [[0],['Kh-29 (6) | R-73 (4) |KAB-500 KR (2)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR']], + [[0],['Kh-29 (6) | R-73 (4) | R-27(2)'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['Kh-29 (12)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29','ACE_6Rnd_Kh29']], + [[0],['R-27 (2) | R-73 (4) | KAB-500 KR (2) | KAB-500 L (2) | FAB-500 (2)'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_FAB500M62Launcher','ACE_2Rnd_FAB500M62'],['ACE_KAB500KRLauncher','ACE_2Rnd_KAB500KR'],['ACE_KAB500LLauncher','ACE_2Rnd_KAB500L']], + [[0],['FAB-500 (6) | KAB-500 L (6)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['FAB-500 (6) | R-73 (4) | R-27 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27']], + [[0],['FAB-500 (6) | KAB-500 KR (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_R73Launcher','ACE_2Rnd_R73'],['ACE_KAB500KRLauncher','ACE_4Rnd_KAB500KR']], + [[0],['FAB-500 (6) | Kh-29 (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_2Rnd_R73']], + [[0],['FAB-500 (4) | Kh-29 (4) | R-73 (4)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73']], + [[0],['FAB-500 (4) | R-73 (6)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['R73Launcher_2','2Rnd_R73'],['R73Launcher','4Rnd_R73']], + [[0],['FAB-500 (4) | Kh-29 (6)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']] + ] +]; + + + +_easaVehi = _easaVehi + ['ACE_Su27_CAS']; +_easaDefault = _easaDefault + [[['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['KAB-500 L (6)'],['ACE_KAB500LLauncher','ACE_6Rnd_KAB500L']], + [[0],['KAB-500 L (2) | R-73 (4)'],['ACE_KAB500LLauncher','ACE_2Rnd_KAB500L'],['ACE_R73Launcher','ACE_4Rnd_R73']], + [[0],['KAB-500 L (4) | Kh-29 (2)'],['ACE_KAB500LLauncher','ACE_4Rnd_KAB500L'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29']], + [[0],['R-73 (6)'],['ACE_R73Launcher','ACE_6Rnd_R73']], + [[0],['R-73 (4) | R-27 (2)'],['ACE_R73Launcher','ACE_4Rnd_R73'],['ACE_R27Launcher','ACE_2Rnd_R27']], + [[0],['Kh-29 (6)'],['ACE_Kh29Launcher','ACE_6Rnd_Kh29']], + [[0],['Kh-29 (4) | R-27(2)'],['ACE_R27Launcher','ACE_2Rnd_R27'],['ACE_Kh29Launcher','ACE_4Rnd_Kh29']], + [[0],['Kh-29 (2)| R-73 (4)'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29'],['ACE_R73Launcher','ACE_4Rnd_R73']], + [[0],['FAB-500 (6)'],['ACE_FAB500M62Launcher','ACE_6Rnd_FAB500M62']], + [[0],['FAB-500 (4) | Kh-29 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_Kh29Launcher','ACE_2Rnd_Kh29']], + [[0],['FAB-500 (4) | R-73 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['R73Launcher_2','2Rnd_R73']], + [[0],['FAB-500 (4) | R-27 (2)'],['ACE_FAB500M62Launcher','ACE_4Rnd_FAB500M62'],['ACE_R27Launcher','ACE_2Rnd_R27']] + ] +]; + + +_easaVehi = _easaVehi + ['Mi24_P']; +_easaDefault = _easaDefault + [[['HeliBombLauncher','2Rnd_FAB_250']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['FAB-250 (2)'],['HeliBombLauncher','2Rnd_FAB_250']], + [[0],['R-73 (2)'],['R73Launcher_2','2Rnd_R73']] + ] +]; + +_easaVehi = _easaVehi + ['Ka52']; +_easaDefault = _easaDefault + [[['VikhrLauncher','12Rnd_Vikhr_KA50']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['Vikhr (12)'],['VikhrLauncher','12Rnd_Vikhr_KA50']], + [[0],['R-73 (12)'],['ACE_R73Launcher','ACE_6Rnd_R73','ACE_6Rnd_R73']] + ] +]; + +_easaVehi = _easaVehi + ['Ka52Black']; +_easaDefault = _easaDefault + [[['VikhrLauncher','12Rnd_Vikhr_KA50']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['Vikhr (12)'],['VikhrLauncher','12Rnd_Vikhr_KA50']], + [[0],['R-73 (12)'],['ACE_R73Launcher','ACE_6Rnd_R73','ACE_6Rnd_R73']] + ] +]; + +_easaVehi = _easaVehi + ['F35B']; +_easaDefault = _easaDefault + [[['BombLauncherF35','2Rnd_GBU12'],['SidewinderLaucher_F35','2Rnd_Sidewinder_F35']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['GBU-12 (4)'],['BombLauncherA10','4Rnd_GBU12']], + [[0],['GBU-12 (2) | AIM-9L (2)'],['BombLauncherF35','2Rnd_GBU12'],['SidewinderLaucher_F35','2Rnd_Sidewinder_F35']], + [[0],['GBU-12 (2) | AGM-65 (2)'],['BombLauncherF35','2Rnd_GBU12'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['AGM-65 (4)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['AIM-9L (4)'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']] + ] +]; + +_easaVehi = _easaVehi + ['AV8B']; +_easaDefault = _easaDefault + [[['BombLauncher','6Rnd_GBU12_AV8B']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['Mk82 (6)'],['Mk82BombLauncher_6','6Rnd_Mk82']], + [[0],['GBU-12 (6)'],['BombLauncher','6Rnd_GBU12_AV8B']], + [[0],['GBU-12 (4) | AIM-9L (2)'],['BombLauncherA10','4Rnd_GBU12'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['GBU-12 (4) | AGM-65 (2)'],['BombLauncherA10','4Rnd_GBU12'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['GBU-12 (2) | AIM-9L (4)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']], + [[0],['GBU-12 (2) | AIM-9L (2) | AGM-65 (2)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['CBU-87 (6)'],['ACE_CBU87_Bomblauncher','ACE_6Rnd_CBU87']], + [[0],['CBU-87 (4) | AIM-9L (2)'],['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['CBU-87 (4) | AGM-65 (2)'],['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['CBU-87 (2) | AIM-9L (4)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']], + [[0],['CBU-87 (2) | AIM-9L (2) | AGM-65 (2)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['AIM-9L (6)'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['AGM-65 (6)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10']] + ] +]; + +_easaVehi = _easaVehi + ['AV8B2']; +_easaDefault = _easaDefault + [[['Mk82BombLauncher_6','6Rnd_Mk82'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['GBU-12 (8)'],['BombLauncherA10','4Rnd_GBU12','4Rnd_GBU12']], + [[0],['GBU-12 (6) | AGM-65 (2)'],['BombLauncher','6Rnd_GBU12_AV8B'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['GBU-12 (6) | AIM-9L (2)'],['BombLauncher','6Rnd_GBU12_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['GBU-12 (4) | AGM-65 (4)'],['BombLauncherA10','4Rnd_GBU12'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['GBU-12 (4) | AIM-9L (4)'],['BombLauncherA10','4Rnd_GBU12'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']], + [[0],['GBU-12 (4) | AIM-9L (2) | AGM-65 (2)'],['BombLauncherA10','4Rnd_GBU12'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['GBU-12 (2) | AIM-9L (4) | AGM-65 (2)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['GBU-12 (2) | AIM-9L (2) | AGM-65 (4)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['GBU-12 (2) | AIM-9L (6)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['GBU-12 (2) | AGM-65 (6)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['Mk82 (6) | AIM-9L (2)'],['Mk82BombLauncher_6','6Rnd_Mk82'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['Mk82 (6) | AGM-65 (2)'],['Mk82BombLauncher_6','6Rnd_Mk82'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['Mk82 (6) | GBU-12 (2)'],['Mk82BombLauncher_6','6Rnd_Mk82'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12']], + [[0],['AGM-65 (8)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['AGM-65 (4) | AIM-9L (4)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']], + [[0],['AGM-65 (6) | AIM-9L (2)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['CBU-87 (8)'],['ACE_CBU87_Bomblauncher','ACE_8Rnd_CBU87']], + [[0],['CBU-87 (6) | AGM-65 (2)'],['ACE_CBU87_Bomblauncher','ACE_6Rnd_CBU87'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['CBU-87 (6) | AIM-9L (2)'],['ACE_CBU87_Bomblauncher','ACE_6Rnd_CBU87'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['CBU-87 (4) | AGM-65 (4)'],['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['CBU-87 (4) | AIM-9L (4)'],['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']], + [[0],['CBU-87 (4) | AIM-9L (2) | AGM-65 (2)'],['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['CBU-87 (2) | AIM-9L (4) | AGM-65 (2)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['CBU-87 (2) | AIM-9L (2) | AGM-65 (4)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['CBU-87 (2) | AIM-9L (6)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['CBU-87 (2) | AGM-65 (6)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['AIM-9L (8)'],['SidewinderLaucher_AH64','8Rnd_Sidewinder_AH64']], + [[0],['AIM-9L (6) | AGM-65 (2)'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']] + ] +]; + +_easaVehi = _easaVehi + ['ACE_A10_CBU87']; +_easaDefault = _easaDefault + [[['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['MaverickLauncher','2Rnd_Maverick_A10'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']]]; +_easaLoadout = _easaLoadout + [ +if (WF_A2_Arrowhead) then { + [ + [[0],['GBU-12 (8)'],['BombLauncherA10','4Rnd_GBU12','4Rnd_GBU12']], + [[0],['GBU-12 (4) | AGM-65 (4)'],['BombLauncherA10','4Rnd_GBU12'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['GBU-12 (4) | AIM-9L (4)'],['BombLauncherA10','4Rnd_GBU12'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['GBU-12 (4) | AIM-9L (2) | AGM-65 (2)'],['BombLauncherA10','4Rnd_GBU12'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['AGM-65 (8)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['AGM-65 (4) | AIM-9L (4)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['AGM-65 (6) | AIM-9L (2)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['AGM-114 (8)'],['HellfireLauncher','8Rnd_Hellfire']], + [[0],['AIM-9L (8)'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['AIM-9L (6) | AGM-65 (2)'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']] + ] +} else { + [ + [[0],['GBU-12 (8)'],['BombLauncherA10','4Rnd_GBU12','4Rnd_GBU12']], + [[0],['GBU-12 (6) | AGM-65 (2)'],['BombLauncher','6Rnd_GBU12_AV8B'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['GBU-12 (6) | AIM-9L (2)'],['BombLauncher','6Rnd_GBU12_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['GBU-12 (4) | AGM-65 (4)'],['BombLauncherA10','4Rnd_GBU12'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['GBU-12 (4) | AIM-9L (4)'],['BombLauncherA10','4Rnd_GBU12'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']], + [[0],['GBU-12 (4) | AIM-9L (2) | AGM-65 (2)'],['BombLauncherA10','4Rnd_GBU12'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['GBU-12 (2) | AIM-9L (4) | AGM-65 (2)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['GBU-12 (2) | AIM-9L (2) | AGM-65 (4)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['GBU-12 (2) | AIM-9L (6)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['GBU-12 (2) | AGM-65 (6)'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['Mk82 (6) | AIM-9L (2)'],['Mk82BombLauncher_6','6Rnd_Mk82'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['Mk82 (6) | AGM-65 (2)'],['Mk82BombLauncher_6','6Rnd_Mk82'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['Mk82 (6) | GBU-12 (2)'],['Mk82BombLauncher_6','6Rnd_Mk82'],['ACE_BombLauncher','ACE_1Rnd_GBU12','ACE_1Rnd_GBU12']], + [[0],['AGM-65 (8)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['AGM-65 (4) | AIM-9L (4)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']], + [[0],['AGM-65 (6) | AIM-9L (2)'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['CBU-87 (4) | AIM-9L (2) | AGM-65 (2)'],['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['CBU-87 (8)'],['ACE_CBU87_Bomblauncher','ACE_8Rnd_CBU87']], + [[0],['CBU-87 (6) | AGM-65 (2)'],['ACE_CBU87_Bomblauncher','ACE_6Rnd_CBU87'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['CBU-87 (6) | AIM-9L (2)'],['ACE_CBU87_Bomblauncher','ACE_6Rnd_CBU87'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['CBU-87 (4) | AGM-65 (4)'],['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['CBU-87 (4) | AIM-9L (4)'],['ACE_CBU87_Bomblauncher','ACE_4Rnd_CBU87'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B']], + [[0],['CBU-87 (2) | AIM-9L (4) | AGM-65 (2)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['MaverickLauncher','2Rnd_Maverick_A10']], + [[0],['CBU-87 (2) | AIM-9L (2) | AGM-65 (4)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['CBU-87 (2) | AIM-9L (6)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z']], + [[0],['CBU-87 (2) | AGM-65 (6)'],['ACE_CBU87_Bomblauncher','ACE_2Rnd_CBU87'],['MaverickLauncher','2Rnd_Maverick_A10','2Rnd_Maverick_A10','2Rnd_Maverick_A10']], + [[0],['AIM-9L (8)'],['SidewinderLaucher_AH64','8Rnd_Sidewinder_AH64']], + [[0],['AIM-9L (6) | AGM-65 (2)'],['SidewinderLaucher','4Rnd_Sidewinder_AV8B'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z'],['MaverickLauncher','2Rnd_Maverick_A10']] + ] +} +]; + +_easaVehi = _easaVehi + ['AH64D_EP1']; +_easaDefault = _easaDefault + [[['HellfireLauncher','ACE_4Rnd_Hellfire'],['ACE_HellfireLauncher_Apache','ACE_4Rnd_Hellfire_L']]]; +_easaLoadout = _easaLoadout + [ +if (WF_A2_Arrowhead) then { + [ + [[0],['AGM-114 (8)'],['HellfireLauncher','8Rnd_Hellfire']], + [[0],['AIM-9L (8)'],['SidewinderLaucher_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z','2Rnd_Sidewinder_AH1Z']] + ] +} else { + [ + [[0],['AGM-114K (8)'],['ACE_HellfireLauncher','8Rnd_Hellfire']], + [[0],['AGM-114L (8)'],['ACE_HellfireLauncher_Apache','ACE_8Rnd_Hellfire_L']], + [[0],['AGM-114K (4) | AGM-114L (4)'],['HellfireLauncher','ACE_4Rnd_Hellfire'],['ACE_HellfireLauncher_Apache','ACE_4Rnd_Hellfire_L']], + [[0],['AIM-9L (8)'],['SidewinderLaucher_AH64','8Rnd_Sidewinder_AH64']] + ] +} +]; + +_easaVehi = _easaVehi + ['AH1Z']; +_easaDefault = _easaDefault + [[['ACE_HellfireLauncher','8Rnd_Hellfire']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['AGM-114K (8)'],['ACE_HellfireLauncher','8Rnd_Hellfire']], + [[0],['AGM-114L (8)'],['ACE_HellfireLauncher_Apache','ACE_8Rnd_Hellfire_L']], + [[0],['AGM-114K (4) | AGM-114L (4)'],['HellfireLauncher','ACE_4Rnd_Hellfire'],['ACE_HellfireLauncher_Apache','ACE_4Rnd_Hellfire_L']], + [[0],['AIM-9L (8)'],['SidewinderLaucher_AH64','8Rnd_Sidewinder_AH64']] + ] +]; + +_easaVehi = _easaVehi + ['ACE_AH1Z_AGM_AGM_W']; +_easaDefault = _easaDefault + [[['ACE_HellfireLauncher','ACE_16Rnd_Hellfire']]]; +_easaLoadout = _easaLoadout + [ + [ + [[0],['AGM-114K (16)'],['ACE_HellfireLauncher','ACE_16Rnd_Hellfire']], + [[0],['AGM-114L (16)'],['ACE_HellfireLauncher_Apache','ACE_16Rnd_Hellfire_L']], + [[0],['AGM-114K (8) | AGM-114L (8)'],['HellfireLauncher','ACE_8Rnd_Hellfire'],['ACE_HellfireLauncher_Apache','ACE_8Rnd_Hellfire_L']], + [[0],['AIM-9L (8) | AGM-114K (8)'],['SidewinderLaucher_AH64','8Rnd_Sidewinder_AH64'],['ACE_HellfireLauncher','ACE_8Rnd_Hellfire']], + [[0],['AIM-9L (8) | AGM-114L (8)'],['SidewinderLaucher_AH64','8Rnd_Sidewinder_AH64'],['ACE_HellfireLauncher_Apache','ACE_8Rnd_Hellfire_L']], + [[0],['AIM-9L (16)'],['SidewinderLaucher_AH64','8Rnd_Sidewinder_AH64','8Rnd_Sidewinder_AH64']] + ] +]; + +['WFBE_EASA_Vehicles',_easaVehi,true] Call SetNamespace; +['WFBE_EASA_Loadouts',_easaLoadout,true] Call SetNamespace; +['WFBE_EASA_Default',_easaDefault,true] Call SetNamespace; \ No newline at end of file diff --git a/Client/Module/EASA/EASA_RemoveLoadout.sqf b/Client/Module/EASA/EASA_RemoveLoadout.sqf new file mode 100644 index 0000000..53b37da --- /dev/null +++ b/Client/Module/EASA/EASA_RemoveLoadout.sqf @@ -0,0 +1,13 @@ +Private ['_i','_loadout','_vehicle']; +_vehicle = _this select 0; +_loadout = _this select 1; + +{ + for [{_i = count(_x)-1},{_i >= 0},{_i = _i - 1}] do { + if (_i > 0) then { + _vehicle removeMagazine (_x select _i); + } else { + _vehicle removeWeapon (_x select _i); + }; + }; +} forEach _loadout; \ No newline at end of file diff --git a/Client/Module/ISIS/ISIS_Action.sqf b/Client/Module/ISIS/ISIS_Action.sqf new file mode 100644 index 0000000..6d40ba5 --- /dev/null +++ b/Client/Module/ISIS/ISIS_Action.sqf @@ -0,0 +1 @@ +_this Spawn ISIS_Heal; \ No newline at end of file diff --git a/Client/Module/ISIS/ISIS_Clientfx.sqf b/Client/Module/ISIS/ISIS_Clientfx.sqf new file mode 100644 index 0000000..496747d --- /dev/null +++ b/Client/Module/ISIS/ISIS_Clientfx.sqf @@ -0,0 +1,63 @@ +Private ["_camera","_nu","_ran","_stunned","_unit"]; + +_unit = _this select 0; + +titleCut["","BLACK FADED",0]; +titleCut["","BLACK IN",2]; + +"dynamicBlur" ppEffectEnable true; +"dynamicBlur" ppEffectAdjust [1]; +"dynamicBlur" ppEffectCommit 0.1; + +"colorCorrections" ppEffectCommit 0.1; +"colorCorrections" ppEffectEnable true; +"colorCorrections" ppEffectAdjust [1, 1, 0, [0.1, 0.0, 0.0, 0.5], [0, 0.5, 0.5, 0.5], [0.199, 0.187, 0.114, 0.0]]; +"colorCorrections" ppEffectCommit 0.3; + +_camera = "camera" camCreate (getPos player); + +showCinemaBorder true; + +_camera camSetDir 0; +_camera camSetFov 0.200; +_camera cameraEffect["Internal","back"]; +_camera camSetTarget player; +_camera camSetRelPos [2,2,3]; +_camera camCommit 0; + +_nu = [_camera] Spawn { + private ["_camera","_rx","_ry","_rz","_shout","_shoutTrsl","_ran"]; + _camera = _this select 0; + _shout = ["ImHitE","ImBleedingE","SomebodyHelpMeE","GetMeACorpsmanNowE","CorpsmanE","TheyGotMeE","NeedHelpE","WoundedE"]; + _shoutTrsl = ["I'm hit!","I'm bleeding!","Somebody help me!","Get me a corpsman now!","Corpsman!","They got me!","Need help!","Wounded!"]; + while {true} do { + _rx = 1 + random 7; + _ry = 1 + random 7; + _rz = 1 + random 7; + + _camera camSetRelPos [_rx,_ry,_rz]; + _camera camCommit 10; + waitUntil{camCommitted _camera}; + if (random 100 < 20) then { + _ran = round(random((count _shout)-1)); + player kbTell [sideHQ, WFBE_V_HQTopicSide, "simple",["1","",(_shoutTrsl select _ran),[(_shout select _ran)]],true]; + }; + }; +}; + +while {true} do { + sleep 1; + _stunned = _unit getVariable "stunned"; + if (isNil '_stunned') exitWith {}; + if (!alive _unit || !(_unit getVariable "stunned")) exitWith {}; +}; + +terminate _nu; +showCinemaBorder false; + +if (!playerDead) then { + "dynamicBlur" ppEffectEnable false; + "colorCorrections" ppEffectEnable false; + _camera cameraEffect["TERMINATE","BACK"]; + camDestroy _camera; +}; \ No newline at end of file diff --git a/Client/Module/ISIS/ISIS_Heal.sqf b/Client/Module/ISIS/ISIS_Heal.sqf new file mode 100644 index 0000000..79d447c --- /dev/null +++ b/Client/Module/ISIS/ISIS_Heal.sqf @@ -0,0 +1,76 @@ +Private ['_anim','_anims','_canBePlaceAt','_dy','_dx','_fPos','_healer','_healTime','_injured','_near','_nearA','_nearB','_placeAtA','_posA','_posB','_posh','_posi','_relPosA','_relPosB','_success']; + +_injured = _this select 0; +_healer = _this select 1; + +_posA = [0.75,0.15,0]; +_posB = [-0.75,0.1,0]; + +_relPosA = _injured modelToWorld [((_injured worldToModel (getPos _injured)) select 0) +(0.75),((_injured worldToModel (getPos _injured)) select 1) + (0.15),0]; +_relPosB = _injured modelToWorld [((_injured worldToModel (getPos _injured)) select 0) -(0.75),((_injured worldToModel (getPos _injured)) select 1) + (0.1),0]; + +_placeAtA = objNull; +_near = ((getPos _injured) nearEntities ["Man",10]) - [_healer,_injured]; +_nearA = 0; +_nearB = 0; +if (count _near > 0) then { + { + _nearA = if (_x distance _relPosA < 1) then {1 + _nearA} else {0 + _nearA}; + _nearB = if (_x distance _relPosB < 1) then {1 + _nearB} else {0 + _nearB}; + } forEach _near; +}; + +if (_nearA > 0 && _nearB > 0) exitWith {}; + +_placeAtA = objNull; +if (_nearA == 0 && _nearB == 0) then { + _placeAtA = if (_healer distance _relPosA < _healer distance _relPosB) then {true} else {false}; +} else { + if (_nearA > 0 && _nearB == 0) then {_placeAtA = false} else {true}; + if (_nearB > 0 && _nearA == 0) then {_placeAtA = true} else {false}; +}; + +_fPos = if (_placeAtA) then {_posA} else {_posB}; + +_healer playAction "medicStartRightSide"; +_healer attachTo [_injured, _fPos]; +sleep 0.01; + +_posh = _healer modelToWorld [0,0,0]; +_posi = _injured modelToWorld [0,+0.08,0]; +_dy = (_posh select 1) - (_posi select 1); _dx = (_posh select 0) - (_posi select 0); +_healer setDir (270- (_dy atan2 _dx) - direction _injured); + +_healTime = time; +_anims = [ +"ainvpknlmstpsnonwrfldnon_medic", +"ainvpknlmstpsnonwrfldnon_medic0s", +"ainvpknlmstpsnonwrfldnon_medic0", +"ainvpknlmstpsnonwrfldnon_medic1", +"ainvpknlmstpsnonwrfldnon_medic2", +"ainvpknlmstpsnonwrfldnon_medic3", +"ainvpknlmstpsnonwrfldnon_medic4", +"ainvpknlmstpsnonwrfldnon_medic5", +"ainvpknlmstpsnonwrfldr_medic0s", +"ainvpknlmstpsnonwrfldr_medic0", +"ainvpknlmstpsnonwrfldr_medic1", +"ainvpknlmstpsnonwrfldr_medic2", +"ainvpknlmstpsnonwrfldr_medic3", +"ainvpknlmstpsnonwrfldr_medic4", +"ainvpknlmstpsnonwrfldr_medic5", +"amovppnemstpsraswrfldnon_amovpknlmstpsraswrfldnon", +"ainvpknlmstpsnonwrfldnon_ainvpknlmstpsnonwrfldnon_medic" +]; + +sleep 2; + +while {true} do { + sleep 0.5; + _anim = animationState _healer; + if !(_anim in _anims) exitWith {diag_log Format["%1",animationState _healer]}; + if (!alive _injured || !(_injured getVariable "stunned")) exitWith {_healer playActionNow "medicStop"}; + if (time - _healTime > 40) exitWith {_healer playActionNow "medicStop";_injured setVariable ["stunned",false,true]}; + if !(alive _healer) exitWith {}; +}; + +detach _healer; \ No newline at end of file diff --git a/Client/Module/ISIS/ISIS_Wound.sqf b/Client/Module/ISIS/ISIS_Wound.sqf new file mode 100644 index 0000000..3638718 --- /dev/null +++ b/Client/Module/ISIS/ISIS_Wound.sqf @@ -0,0 +1,62 @@ +Private ["_damage","_damages","_isStuned","_lastWound","_type","_unit"]; + +_unit = _this select 0; +_type = _this select 1; +_damages = _this select 2; + +if (vehicle _unit == _unit) then { + _isStuned = _unit getVariable "stunned"; + _lastWound = _unit getVariable "lastWound"; + if (isNil "_isStuned") then {_isStuned = false}; + if (isNil "_lastWound") then {_lastWound = round(time)}; + if (_isStuned) exitWith { + if (time - _lastWound > 3) then {_damages} else {false} + }; + + _unit setVariable ["lastWound",round time]; + _damage = true; + + switch (_type) do { + case "head_hit": { + if (_damages > 0.4 && _damages < 1) then { + if (random 100 > 40) then {_unit setVariable ['stunned',true,true];_isStuned = true}; + }; + if (_damages >= 1 && _damages < 5) then { + if (random 100 > 40) then {_unit setVariable ['stunned',true,true];_isStuned = true;_damage = false}; + }; + }; + case "body": { + if (_damages > 0.65 && _damages < 1) then { + if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true}; + }; + if (_damages >= 1 && _damages < 20) then { + if (random 100 > 40) then {_unit setVariable ['stunned',true,true];_isStuned = true;_damage = false}; + }; + }; + case "hands": { + if (_damages > 0.76 && _damages < 1) then { + if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true}; + }; + if (_damages >= 1 && _damages < 20) then { + if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true;_damage = false}; + }; + }; + case "legs": { + if (_damages > 0.68 && _damages < 1) then { + if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true}; + }; + if (_damages >= 1 && _damages < 20) then { + if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true;_damage = false}; + }; + }; + case "": { + _damage = false; + }; + }; + + if (_isStuned) then {[_unit] Spawn ISIS_Wounded}; + + if (_damage) then {_damages} else {false}; +} else { + _damages +}; \ No newline at end of file diff --git a/Client/Module/ISIS/ISIS_Wounded.sqf b/Client/Module/ISIS/ISIS_Wounded.sqf new file mode 100644 index 0000000..f474f68 --- /dev/null +++ b/Client/Module/ISIS/ISIS_Wounded.sqf @@ -0,0 +1,51 @@ +Private ["_han","_hasAction","_start","_state","_status","_unit"]; +_unit = _this select 0; +_start = time; +_state = ""; + +if (isPlayer _unit) then { + [_unit] Spawn ISIS_Effects; +}; + +_han = [nil, _unit, rPLAYACTION, "agonyStart"] call RE; +sleep 3; +_han = [nil, _unit, rPLAYACTION, "GestureNod"] call RE; + +//--- Add action to west or east units. +if (side _unit == west || side _unit == east) then { + _hasAction = _unit getVariable 'hasAction'; + if (isNil '_hasAction') then {_hasAction = false}; + if !(_hasAction) then { + WFBE_ISIS_AddAction = [(side _unit),'CLTFNCISIS_ADDACTION',_unit]; + publicVariable 'WFBE_ISIS_AddAction'; + if (isHostedServer || local player) then {[(side _unit),'CLTFNCISIS_ADDACTION',_unit] Spawn HandlePVF}; + }; +}; + +while {true} do { + sleep 0.7; + + _status = _unit getVariable "stunned"; + if (isNil '_status' || !(alive _unit)) exitWith {_unit removeAllEventHandlers "handleDamage"}; + if !(_status) exitWith { + _han = [nil, _unit, rPLAYACTION, "GestureNod"] call RE; + }; + + if ((time - _start > 15 || _state != animationState _unit)) then { + _start = time; + if (((animationState _unit) == "AinjPpneMstpSnonWnonDnon") || ((animationState _unit) == "AinjPpneMstpSnonWrflDnon")) then { + _han = [nil, _unit, rPLAYACTION, "GestureNod"] call RE; + _state = animationState _unit; + _han = [nil, _unit, rPLAYACTION, ("GestureSpasm"+ (str floor random 7))] call RE; + }; + if (((animationState _unit) == "AinjPpneMstpSnonWrflDnon_injuredHealed") || ((animationState _unit) == "AinjPpneMstpSnonWnonDnon_injuredHealed")) then { + _han = [nil, _unit, rPLAYACTION, "GestureNod"] call RE; + _state = animationState _unit; + _han = [nil, _unit, rPLAYACTION, ("GestureSpasm"+ (str floor random 7))] call RE; + }; + }; + + _unit setDamage (getDammage _unit + 0.002); +}; + +_han = [nil, _unit, rPLAYACTION, "agonyStop"] call RE; diff --git a/Client/Module/Nuke/damage.sqf b/Client/Module/Nuke/damage.sqf new file mode 100644 index 0000000..0b72bce --- /dev/null +++ b/Client/Module/Nuke/damage.sqf @@ -0,0 +1,30 @@ +//--- Nuke destruction. +Private ["_array","_blackListed","_bo","_destroy","_target","_z"]; + +private ["_destroy","_bo","_target","_array","_blackListed"]; +_target = _this select 0; +_array = _target nearObjects ["All", 700]; +_blackListed = WFDEPOT + WFCAMP + ["land_nav_pier_c","land_nav_pier_c2","land_nav_pier_c2_end","land_nav_pier_c_270","land_nav_pier_c_90","land_nav_pier_c_big","land_nav_pier_C_L","land_nav_pier_C_L10","land_nav_pier_C_L30","land_nav_pier_C_R","land_nav_pier_C_R10","land_nav_pier_C_R30","land_nav_pier_c_t15","land_nav_pier_c_t20","land_nav_pier_F_17","land_nav_pier_F_23","land_nav_pier_m","land_nav_pier_m_1","land_nav_pier_m_end","land_nav_pier_M_fuel","land_nav_pier_pneu","land_nav_pier_uvaz"]; +_destroy = _array; +{if ((typeOf _x) in _blackListed) then {_destroy = _destroy - [_x]}} forEach _array; +{_bo = "BO_GBU12_LGB" createVehicle [random 1000,random 1000,500];_bo setPos [getPos _x select 0, getPos _x select 1, getPos _x select 2]} forEach _destroy; + +[_target] Spawn { + Private ["_array","_dammageable","_dammages","_range","_target"]; + _target = _this select 0; + _dammageable = ["Man","Car","Motorcycle","Tank","Ship","Air","StaticWeapon"]; + _range = 800; + _dammages = 1; + for [{_z = 0},{_z < 4},{_z = _z + 1}] do { + _array = _target nearEntities [_dammageable, _range]; + { + _x setDammage (getDammage _x + _dammages); + {_x setDammage (getDammage _x + _dammages)} forEach crew _x; + } forEach _array; + _range = _range + 300; + _dammages = _dammages - 0.2; + sleep 3; + }; + //--- Radiations. + [_target] Spawn NukeRadiation; +}; \ No newline at end of file diff --git a/Client/Module/Nuke/nuke.sqf b/Client/Module/Nuke/nuke.sqf new file mode 100644 index 0000000..425272c --- /dev/null +++ b/Client/Module/Nuke/nuke.sqf @@ -0,0 +1,146 @@ +//--- Nuke blast. +Private ['_Cone','_light','_smoke','_smoke2','_target','_top','_top2','_top3','_top4','_top5','_Wave','_xHandle']; + +_target = _this select 0; +if (player distance _target < 4000) then { + "dynamicBlur" ppEffectEnable true; + "dynamicBlur" ppEffectAdjust [1]; + "dynamicBlur" ppEffectCommit 1; +}; + +_Cone = "#particlesource" createVehicleLocal getPos _target; +_Cone setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 10, [0, 0, 0], + [0, 0, 0], 0, 1.275, 1, 0, [40,80], [[0.25, 0.25, 0.25, 0], [0.25, 0.25, 0.25, 0.5], + [0.25, 0.25, 0.25, 0.5], [0.25, 0.25, 0.25, 0.05], [0.25, 0.25, 0.25, 0]], [0.25], 0.1, 1, "", "", _target]; +_Cone setParticleRandom [2, [1, 1, 30], [1, 1, 30], 0, 0, [0, 0, 0, 0.1], 0, 0]; +_Cone setParticleCircle [10, [-10, -10, 20]]; +_Cone setDropInterval 0.005; + +_top = "#particlesource" createVehicleLocal getPos _target; +_top setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 20, [0, 0, 0], + [0, 0, 80], 0, 1.7, 1, 0, [180,150,180], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _target]; +_top setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360]; +_top setDropInterval 0.001; + +_top2 = "#particlesource" createVehicleLocal getPos _target; +_top2 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 112, 0], "", "Billboard", 1, 20, [0, 0, 0], + [0, 0, 20], 0, 1.7, 1, 0, [80,80,100], [[1, 1, 1, 0.5],[1, 1, 1, 0]], [0.07], 1, 1, "", "", _target]; +_top2 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360]; +_top2 setDropInterval 0.002; + +_smoke = "#particlesource" createVehicleLocal getPos _target; +_smoke setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48, 1], "", "Billboard", 1, 25, [0, 0, 0], + [0, 0, 80], 0, 1.7, 1, 0, [40,50,60], + [[1, 1, 1, 0.2],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0]] + , [0.5, 0.1], 1, 1, "", "", _target]; +_smoke setParticleRandom [0, [10, 10, 15], [15, 15, 7], 0, 0, [0, 0, 0, 0], 0, 0, 360]; +_smoke setDropInterval 0.002; + +_Wave = "#particlesource" createVehicleLocal getPos _target; +_Wave setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 20, [0, 0, 0], + [0, 0, 0], 0, 1.5, 1, 0, [50, 100], [[0.1, 0.1, 0.1, 0.5], + [0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0.3], [1, 1, 1, 0]], [1,0.5], 0.1, 1, "", "", _target]; +_Wave setParticleRandom [2, [20, 20, 20], [5, 5, 0], 0, 0, [0, 0, 0, 0.1], 0, 0]; +_Wave setParticleCircle [50, [-80, -80, 2.5]]; +_Wave setDropInterval 0.0002; + +_light = "#lightpoint" createVehicleLocal [((getPos _target select 0)),(getPos _target select 1),((getPos _target select 2)+500)]; +_light setLightAmbient[1500, 1200, 1000]; +_light setLightColor[1500, 1200, 1000]; +_light setLightBrightness 100000.0; + +if (player distance _target < 4000) then { + "colorCorrections" ppEffectEnable true; + "colorCorrections" ppEffectAdjust [0.8, 15, 0, [0.5, 0.5, 0.5, 0], [0.0, 0.0, 0.6, 2],[0.3, 0.3, 0.3, 0.1]];"colorCorrections" ppEffectCommit 0.4; + + "dynamicBlur" ppEffectAdjust [0.5]; + "dynamicBlur" ppEffectCommit 3; + + sleep 0.1; + + _null = [] Spawn + { + Sleep 4; + "colorCorrections" ppEffectAdjust [1.0, 0.5, 0, [0.5, 0.5, 0.5, 0], [1.0, 1.0, 0.8, 0.4],[0.3, 0.3, 0.3, 0.1]]; + "colorCorrections" ppEffectCommit 7; + }; + + "dynamicBlur" ppEffectAdjust [2]; + "dynamicBlur" ppEffectCommit 1; + + "dynamicBlur" ppEffectAdjust [0.5]; + "dynamicBlur" ppEffectCommit 4; +}; +_light setLightBrightness 100000.0; + +sleep 3.5; + +_Wave setDropInterval 0.001; +deleteVehicle _top; +deleteVehicle _top2; +sleep 7; +_top3 = "#particlesource" createVehicleLocal getPos _target; +_top3 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 20, [0, 0, 500], + [0, 0, 65], 0, 1.7, 1, 0, [200,200,200], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _target]; +_top3 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360]; +_top3 setDropInterval 0.001; + +sleep 0.6; +deleteVehicle _top3; + +sleep 3; + +if (player distance _target < 4000) then { + "colorCorrections" ppEffectAdjust [1, 1, 0, [0.5, 0.5, 0.5, 0], [1.0, 1.0, 0.8, 0.4],[0.3, 0.3, 0.3, 0.1]];"colorCorrections" ppEffectCommit 1; "colorCorrections" ppEffectEnable TRUE; + "dynamicBlur" ppEffectAdjust [0]; + "dynamicBlur" ppEffectCommit 1; +}; + +_top4 = "#particlesource" createVehicleLocal getPos _target; +_top4 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 20, [0, 0, 800], + [0, 0, 55], 0, 1.7, 1, 0, [200,200,200], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _target]; +_top4 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360]; +_top4 setDropInterval 0.001; + +sleep 0.6; +deleteVehicle _light; +deleteVehicle _top4; +sleep 4; + +_top5 = "#particlesource" createVehicleLocal getPos _target; +_top5 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 3, 48, 0], "", "Billboard", 1, 20, [0, 0, 1000], + [0, 0, 20], 0, 1.7, 1, 0, [250,280,250], [[1, 1, 1, -10],[1, 1, 1, -7],[1, 1, 1, -4],[1, 1, 1, -0.5],[1, 1, 1, 0]], [0.05], 1, 1, "", "", _target]; +_top5 setParticleRandom [0, [75, 75, 15], [17, 17, 10], 0, 0, [0, 0, 0, 0], 0, 0, 360]; +_top5 setDropInterval 0.001; + +_Cone setDropInterval 0.01; +_Wave setDropInterval 0.001; + +_smoke setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48, 1], "", "Billboard", 1, 25, [0, 0, 0], + [0, 0, 80], 0, 1.7, 1, 0, [150,150,150], + [[1, 1, 1, 0.2],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0]] + , [0.5, 0.1], 1, 1, "", "", _target]; +_smoke setDropInterval 0.01; + +_smoke2 = "#particlesource" createVehicleLocal getPos _target; +_smoke2 setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48, 1], "", "Billboard", 1, 25, [0, 0, 900], + [0, 0, 25], 0, 1.7, 1, 0, [160,180,170], + [[1, 1, 1, 0.2],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0.3],[1, 1, 1, 0]] + , [0.5, 0.1], 1, 1, "", "", _target]; +_smoke2 setParticleRandom [0, [10, 10, 15], [15, 15, 7], 0, 0, [0, 0, 0, 0], 0, 0, 360]; +_smoke2 setDropInterval 0.01; + +sleep 5; +deleteVehicle _top5; +_Cone setDropInterval 0.02; +_Wave setDropInterval 0.01; + +sleep 5; +deleteVehicle _smoke2; +sleep 10; +deleteVehicle _Wave; +deleteVehicle _cone; +deleteVehicle _smoke; +sleep 20; +if (player distance _target < 4000) then {"colorCorrections" ppEffectEnable false}; +[currentFX] Spawn FX; \ No newline at end of file diff --git a/Client/Module/Nuke/nukeincoming.sqf b/Client/Module/Nuke/nukeincoming.sqf new file mode 100644 index 0000000..e2a92f9 --- /dev/null +++ b/Client/Module/Nuke/nukeincoming.sqf @@ -0,0 +1,59 @@ +//--- Nuke launching. +Private ['_cruise','_dropPosition','_dropPosX','_dropPosY','_dropPosZ','_misFlare','_nukeMarker','_path','_pathS','_planespawnpos','_target','_type']; +_target = _this select 0; +_nukeMarker = _this select 1; + +WFBE_LocalizeMessage = [nil,'CLTFNCLOCALIZEMESSAGE',['TacticalLaunch']]; +publicVariable 'WFBE_LocalizeMessage'; +if (isHostedServer || local player) then {[nil,'CLTFNCLOCALIZEMESSAGE',['TacticalLaunch']] Spawn HandlePVF}; + +sleep 300; + +_path = "\ca\air2\cruisemissile\"; //"; +_pathS = _path + "data\scripts\"; //"; + +_dropPosition = getpos _target; +_type = if (WF_A2_Vanilla || WF_A2_CombinedOps) then {'Chukar'} else {'Chukar_EP1'}; +_cruise = createVehicle [_type,_dropPosition,[], 0, "FLY"]; +_cruise setVectorDir [ 0.1,- 1,+ 0.5]; +_cruise setPos [(getPos _cruise select 0),(getPos _cruise select 1),570]; +_cruise setVelocity [0,2,0]; +_cruise flyInHeight 570; +_cruise setSpeedMode "FULL"; + +WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["ICBM",sideJoined,_target,_cruise,clientTeam]]; +publicVariable 'WFBE_RequestSpecial'; +if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["ICBM",sideJoined,_target,_cruise,clientTeam]] Spawn HandleSPVF}; + +sleep 1.5; + +WFBE_DisplayICBM = [sideJoined,'CLTFNCDISPLAYICBM',[_target,_cruise]]; +publicVariable 'WFBE_DisplayICBM'; +if (isHostedServer || local player) then {[sideJoined,'CLTFNCDISPLAYICBM',[_target,_cruise]] Spawn HandlePVF}; + +_misFlare = objNull; +if (WF_A2_Vanilla || WF_A2_CombinedOps) then { + _dropPosX = _dropPosition select 0; + _dropPosY = _dropPosition select 1; + _dropPosZ = _dropPosition select 2; + + _planespawnpos = [_dropPosX , _dropPosY , _dropPosZ + 600]; + + _misFlare = createVehicle ["cruiseMissileFlare1",_planespawnpos,[], 0, "NONE"]; + _misFlare inflame true; + _cruise setVariable ["cruisemissile_level", false]; + [_cruise, _misFlare] execVM (_pathS + "cruisemissileflare.sqf"); + _cruise setObjectTexture [0, _path + "data\exhaust_flame_ca"]; + [_cruise] execVM (_pathS + "exhaust1.sqf"); +}; + +sleep 7; + +waitUntil {!alive _cruise}; + +sleep 5; +if (WF_A2_Vanilla || WF_A2_CombinedOps) then {deleteVehicle _misFlare}; +deleteVehicle _cruise; + +sleep 50; +deleteMarkerLocal _nukeMarker; diff --git a/Client/Module/Nuke/radzone.sqf b/Client/Module/Nuke/radzone.sqf new file mode 100644 index 0000000..084b66f --- /dev/null +++ b/Client/Module/Nuke/radzone.sqf @@ -0,0 +1,20 @@ +//--- Radiation +Private ['_target','_z']; + + +private ["_target"]; +_target = _this select 0; +[_target] Spawn { + Private ["_array","_dammageable","_target"]; + _target = _this select 0; + _dammageable = ["Man","Car","Motorcycle","Tank","Ship","Air","StaticWeapon"]; + for [{_z = 0},{_z < 300},{_z = _z + 1}] do { + _array = _target nearEntities [_dammageable, 1000]; + { + _x setDammage (getDammage _x + 0.03); + {_x setDammage (getDammage _x + 0.05)} forEach crew _x; + } forEach _array; + sleep (3 + random 3); + }; + deleteVehicle _target; +}; \ No newline at end of file diff --git a/Client/Module/Skill/Actions/Officer_Undeploy_MASH.sqf b/Client/Module/Skill/Actions/Officer_Undeploy_MASH.sqf new file mode 100644 index 0000000..99b92e8 --- /dev/null +++ b/Client/Module/Skill/Actions/Officer_Undeploy_MASH.sqf @@ -0,0 +1,22 @@ +/* + Script: Officer Skill MASH Undeploy + Description: Undeploy the MASH +*/ + +Private ["_MASH"]; + +_MASH = _this select 0; + +_skip = false; +for '_z' from 0 to 3 do { + sleep 0.5; + player playMove "AinvPknlMstpSlayWrflDnon_medic"; + sleep 0.5; + waitUntil {animationState player == "ainvpknlmstpslaywrfldnon_amovpknlmstpsraswrfldnon" || !alive player || vehicle player != player}; + if (!alive player || vehicle player != player) exitWith {_skip = true}; +}; + +if (!_skip) then { + deleteVehicle _MASH; + WFBE_SK_V_LastUse_MASH = -2000; +}; \ No newline at end of file diff --git a/Client/Module/Skill/Skill_Apply.sqf b/Client/Module/Skill/Skill_Apply.sqf new file mode 100644 index 0000000..ddd8f20 --- /dev/null +++ b/Client/Module/Skill/Skill_Apply.sqf @@ -0,0 +1,66 @@ +/* + Script: Skill Application System by Benny. + Description: Skill Application. +*/ + +Private ["_unit"]; + +_unit = _this; + +switch (WFBE_SK_V_Type) do { + case 'Engineer': { + /* Repair Ability */ + _unit addAction [ + ("" + localize 'STR_WF_ACTION_Repair'+ ""), + (WFBE_SK_V_Root + 'Engineer' + '.sqf'), + [], + 80, + false, + true, + "", + "time - WFBE_SK_V_LastUse_Repair > WFBE_SK_V_Reload_Repair" + ]; + }; + case 'Officer': { + /* MASH Ability require that the MASH parameter is enabled */ + if (paramRespawnMASH) then { + /* MASH Ability */ + _unit addAction [ + ("" + localize 'STR_WF_ACTION_DeployMASH'+ ""), + (WFBE_SK_V_Root + 'Officer' + '.sqf'), + [], + 80, + false, + true, + "", + "time - WFBE_SK_V_LastUse_MASH > WFBE_SK_V_Reload_MASH" + ]; + }; + }; + case 'SpecOps': { + /* Lockpicking Ability */ + _unit addAction [ + ("" + localize 'STR_WF_ACTION_Lockpick'+ ""), + (WFBE_SK_V_Root + 'SpecOps' + '.sqf'), + [], + 80, + false, + true, + "", + "time - WFBE_SK_V_LastUse_Lockpick > WFBE_SK_V_Reload_Lockpick" + ]; + }; + case 'Spotter': { + /* Spotting Ability */ + _unit addAction [ + ("" + localize 'STR_WF_ACTION_Spot'+ ""), + (WFBE_SK_V_Root + 'Sniper' + '.sqf'), + [], + 80, + false, + true, + "", + "time - WFBE_SK_V_LastUse_Spot > WFBE_SK_V_Reload_Spot" + ]; + }; +}; \ No newline at end of file diff --git a/Client/Module/Skill/Skill_Engineer.sqf b/Client/Module/Skill/Skill_Engineer.sqf new file mode 100644 index 0000000..ec65cde --- /dev/null +++ b/Client/Module/Skill/Skill_Engineer.sqf @@ -0,0 +1,32 @@ +/* + Script: Engineer Skill System by Benny. + Description: Add special skills to the defined engineer. +*/ +Private ['_dammages','_skip','_sorted','_vehicle','_vehicles','_z']; + + +private ["_x","_skip","_dammages","_vehicles","_sorted","_vehicle"]; +_vehicles = player nearEntities [["Car","Motorcycle","Tank","Ship","Air","StaticWeapon"],5]; +if (count _vehicles < 1) exitWith {}; + +_sorted = [player,_vehicles] Call SortByDistance; +_vehicle = _sorted select 0; + +_dammages = getDammage _vehicle; +if (_dammages <= 0) exitWith {}; +WFBE_SK_V_LastUse_Repair = time; + +_skip = false; +for [{_z = 0},{_z < 5},{_z = _z + 1}] do { + sleep 0.5; + player playMove "AinvPknlMstpSlayWrflDnon_medic"; + sleep 0.5; + waitUntil {animationState player == "ainvpknlmstpslaywrfldnon_amovpknlmstpsraswrfldnon" || !alive player || vehicle player != player || !alive _vehicle || _vehicle distance player > 5}; + if (!alive player || vehicle player != player || !alive _vehicle || _vehicle distance player > 5) exitWith {_skip = true}; +}; + +if (!_skip) then { + _dammages = _dammages - 0.15; + if (_dammages < 0) then {_dammages = 0}; + _vehicle setDammage _dammages; +}; \ No newline at end of file diff --git a/Client/Module/Skill/Skill_Init.sqf b/Client/Module/Skill/Skill_Init.sqf new file mode 100644 index 0000000..6318bfe --- /dev/null +++ b/Client/Module/Skill/Skill_Init.sqf @@ -0,0 +1,41 @@ +/* + Script: Skill System by Benny. + Description: Skill Initialization. +*/ + +/* Skills Root */ +WFBE_SK_V_Root = 'Client\Module\Skill\Skill_'; + +/* Functions */ +WFBE_SK_FNC_Apply = Compile preprocessFile "Client\Module\Skill\Skill_Apply.sqf"; + +/* Define which classname belong to which skill group */ +WFBE_SK_V_Engineers = ['USMC_SoldierS_Engineer','MVD_Soldier_TL','US_Soldier_Engineer_EP1','TK_Soldier_Engineer_EP1','CDF_Soldier_Engineer','Ins_Soldier_Sapper']; +WFBE_SK_V_Officers = ['FR_Commander','RUS_Commander','US_Soldier_SL_EP1','TK_Soldier_SL_EP1','CDF_Soldier_Officer','Ins_Commander']; +WFBE_SK_V_Soldiers = ['FR_R','RUS_Soldier1','US_Delta_Force_EP1','TK_Special_Forces_EP1','CDF_Soldier','Ins_Soldier_1']; +WFBE_SK_V_SpecsOps = ['FR_TL','RUS_Soldier_TL','US_Delta_Force_TL_EP1','TK_Special_Forces_TL_EP1','CDF_Soldier_TL','Ins_Soldier_2']; +WFBE_SK_V_Spotters = ['USMC_SoldierS_Sniper','RU_Soldier_Sniper','US_Soldier_Sniper_EP1','TK_Soldier_Sniper_EP1','CDF_Soldier_Sniper','Ins_Soldier_Sniper']; + +/* Skills Variables */ +WFBE_SK_V_LastUse_Repair = -1200; +WFBE_SK_V_LastUse_MASH = -1200; +WFBE_SK_V_LastUse_Lockpick = -1200; +WFBE_SK_V_LastUse_Spot = -1200; + +/* Skills Timeout */ +WFBE_SK_V_Reload_Repair = 65; +WFBE_SK_V_Reload_MASH = 600; +WFBE_SK_V_Reload_Lockpick = 25; +WFBE_SK_V_Reload_Spot = 8; + +/* Find the player type */ +WFBE_SK_V_Type = ""; +if (playerType in WFBE_SK_V_Engineers) then {WFBE_SK_V_Type = "Engineer"}; +if (playerType in WFBE_SK_V_Officers) then {WFBE_SK_V_Type = "Officer"}; +if (playerType in WFBE_SK_V_Soldiers) then {WFBE_SK_V_Type = "Soldier"}; +if (playerType in WFBE_SK_V_SpecsOps) then {WFBE_SK_V_Type = "SpecOps"}; +if (playerType in WFBE_SK_V_Spotters) then {WFBE_SK_V_Type = "Spotter"}; + +/* Special one time init */ +/* The soldier can hire more units than the others leader */ +if (WFBE_SK_V_Type == 'Soldier') then {['WFBE_MAXGROUPSIZE',('WFBE_MAXGROUPSIZE' Call GetNameSpace) + ('WFBE_MAXGZBONUSSKILL' Call GetNamespace),true] Call SetNamespace}; \ No newline at end of file diff --git a/Client/Module/Skill/Skill_Officer.sqf b/Client/Module/Skill/Skill_Officer.sqf new file mode 100644 index 0000000..3048459 --- /dev/null +++ b/Client/Module/Skill/Skill_Officer.sqf @@ -0,0 +1,32 @@ +/* + Script: Officer Skill System by Benny. + Description: Add special skills to the defined officer. +*/ +Private ['_array','_exist','_skip','_tent','_toWorld','_type','_z']; + + +private ["_x","_skip","_array","_toWorld","_tent","_type","_exist"]; +_type = Format ["WFBE_%1FARP",sideJoinedText] Call GetNamespace; +_exist = WF_Logic getVariable Format ["%1MASH",sideJoinedText]; +if !(isNull _exist) then {deleteVehicle _exist}; + +WFBE_SK_V_LastUse_MASH = time; + +_skip = false; +for [{_z = 0},{_z < 7},{_z = _z + 1}] do { + sleep 0.5; + player playMove "AinvPknlMstpSlayWrflDnon_medic"; + sleep 0.5; + waitUntil {animationState player == "ainvpknlmstpslaywrfldnon_amovpknlmstpsraswrfldnon" || !alive player || vehicle player != player}; + if (!alive player || vehicle player != player) exitWith {_skip = true}; +}; + +if (!_skip) then { + _array = [((player worldToModel (getPos player)) select 0),((player worldToModel (getPos player)) select 1) + 10]; + _toWorld = player modelToWorld _array; + _tent = _type createVehicle _toWorld; + WF_Logic setVariable [Format["%1MASH",sideJoinedText],_tent,true]; + _tent addAction ["" + localize 'STR_WF_ACTION_UndeployMASH'+ "", "Client\Module\Skill\Actions\Officer_Undeploy_MASH.sqf", [], 75, false, true, "", "alive _target && time - WFBE_SK_V_LastUse_MASH > 240"]; +} else { + WF_Logic setVariable [Format["%1MASH",sideJoinedText],objNull,true]; +}; \ No newline at end of file diff --git a/Client/Module/Skill/Skill_Sniper.sqf b/Client/Module/Skill/Skill_Sniper.sqf new file mode 100644 index 0000000..19bbfb1 --- /dev/null +++ b/Client/Module/Skill/Skill_Sniper.sqf @@ -0,0 +1,31 @@ +/* + Script: Sniper Skill System by Benny. + Description: Add special skills to the defined sniper. +*/ +Private ['_binoculars','_markerName','_markertime','_screenPos']; + + +private ["_binoculars","_screenPos","_markerName","_markertime"]; +_binoculars = 'WFBE_BINOCULARS' Call GetNamespace; +if !((currentWeapon player) in _binoculars) exitWith {hint (localize "STR_WF_INFO_Spot_Info")}; + +if (isNil "markerID") then {markerID = 1}; +_screenPos = screenToWorld [0.5,0.5]; + +_markerName = Format ["Spot%1",markerID]; +createMarkerLocal [_markerName,_screenPos]; +_markertime = [daytime] call bis_fnc_timetostring; +_markerName setMarkerText Format ['SPOTTED: %1',_markertime]; +_markerName setMarkerTypeLocal "mil_destroy"; +_markerName setMarkerColorLocal "ColorRed"; +_markerName setMarkerSizeLocal [0.5,0.5]; +markerID = markerID + 1; + +WFBE_SK_V_LastUse_Spot = time; + +[_markerName] Spawn { + Private ["_marker"]; + _marker = _this select 0; + sleep 180; + deleteMarkerLocal _marker; +}; \ No newline at end of file diff --git a/Client/Module/Skill/Skill_SpecOps.sqf b/Client/Module/Skill/Skill_SpecOps.sqf new file mode 100644 index 0000000..4456815 --- /dev/null +++ b/Client/Module/Skill/Skill_SpecOps.sqf @@ -0,0 +1,52 @@ +/* + Script: Spec Ops Skill System by Benny. + Description: Add special skills to the defined spec ops unit. +*/ +Private ['_min','_ran','_skip','_sorted','_vehicle','_vehicles','_z']; + + +private ["_x","_skip","_min","_ran","_vehicles","_sorted","_vehicle"]; +_vehicles = player nearEntities [["Car","Motorcycle","Tank","Ship","Air"],5]; +if (count _vehicles < 1) exitWith {}; + +if (isNil "WFBE_SK_V_LockpickChance") then {WFBE_SK_V_LockpickChance = 0}; + +_sorted = [player,_vehicles] Call SortByDistance; +_vehicle = _sorted select 0; + +if (!locked _vehicle) exitWith {}; + +WFBE_SK_V_LastUse_Lockpick = time; + +_skip = false; +for [{_z = 0},{_z < 2},{_z = _z + 1}] do { + sleep 0.5; + player playMove "AinvPknlMstpSlayWrflDnon_medic"; + sleep 0.5; + waitUntil {animationState player == "ainvpknlmstpslaywrfldnon_amovpknlmstpsraswrfldnon" || !alive player || vehicle player != player || !alive _vehicle || _vehicle distance player > 5}; + if (!alive player || vehicle player != player || !alive _vehicle || _vehicle distance player > 5) exitWith {_skip = true}; +}; + +if (!locked _vehicle) exitWith {}; + +if (!_skip) then { + _min = 30; + switch (typeOf _vehicle) do { + case "Motorcycle": {_min = 40}; + case "Car": {_min = 30}; + case "Tank": {_min = 20}; + case "Ship": {_min = 25}; + case "Air": {_min = 15}; + }; + _ran = ((random 100)-WFBE_SK_V_LockpickChance); + if (_ran <= _min) then { + //--- Unlocked, gain experience. + if (WFBE_SK_V_LockpickChance > -51) then {WFBE_SK_V_LockpickChance = WFBE_SK_V_LockpickChance - 1}; + WFBE_RequestVehicleLock = ['SRVFNCREQUESTVEHICLELOCK',[_vehicle,false]]; + publicVariable 'WFBE_RequestVehicleLock'; + if (isHostedServer) then {['SRVFNCREQUESTVEHICLELOCK',[_vehicle,false]] Spawn HandleSPVF}; + hint (localize "STR_WF_INFO_Lockpick_Succeed"); + } else { + hint (localize "STR_WF_INFO_Lockpick_Failed"); + }; +}; diff --git a/Client/Module/UAV/uav.sqf b/Client/Module/UAV/uav.sqf new file mode 100644 index 0000000..840ffbe --- /dev/null +++ b/Client/Module/UAV/uav.sqf @@ -0,0 +1,136 @@ +Private ['_add','_buildings','_built','_checks','_closest','_cw','_d','_dir','_driver','_group','_gunner','_id','_lastWP','_lastWPpos','_logic','_logicMARTA','_pos','_radius','_sorted','_spawn','_step','_uav','_varname','_waypoints','_wp','_wpcount']; +_logic = UAVL; + +if (!isNull playerUAV) then {if (!alive playerUAV) then {playerUAV = objNull}}; +if (!isNull playerUAV) exitWith { + if (WF_A2_Vanilla) then { + ExecVM "Client\Module\UAV\uav_interface.sqf"; + } else { + ExecVM "Client\Module\UAV\uav_interface_oa.sqf"; + }; +}; + +//--- Logic ID +if (isnil "BIS_uavlastID") then {BIS_uav_lastID = -1}; +BIS_uav_lastID = BIS_uav_lastID + 1; +_id = BIS_uav_lastID; +_varname = ""; +call compile format ["BIS_uav_%1 = _logic; _logic setvehiclevarname 'BIS_uav_%1'; _varname = 'BIS_uav_%1'; publicvariable 'BIS_uav_%1'",BIS_uav_lastID]; +_logic setVariable ["ID",BIS_uav_lastID]; + +//--- First call +if (BIS_uav_lastID == 0) then { + //--- Execute MARTA + if (isnil "bis_marta_mainscope") then { + (group _logic) createunit ["MartaManager",position player,[],0,"none"]; + }; +}; + +_buildings = (sideJoinedText) Call GetSideStructures; +_checks = [sideJoined,Format ["WFBE_%1COMMANDCENTERTYPE",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories; +_closest = objNull; +if (count _checks > 0) then { + _sorted = [player,_checks] Call SortByDistance; + _closest = _sorted select 0; +}; + +if (isNull _closest) exitWith {}; + +_uav = createVehicle [Format ["WFBE_%1UAV",sideJoinedText] Call GetNamespace,getPos _closest, [], 0, "FLY"]; +playerUAV = _uav; +Call Compile Format ["_uav addEventHandler ['Killed',{[_this select 0,_this select 1,%1] Spawn UnitKilled}]",sideJoined]; +_uav SetVehicleInit Format["[this,%1] ExecVM 'Common\Common_InitUnit.sqf';",sideJoined]; +processInitCommands; + +//--- Remove weapons if air restriction is enabled. +if (('WFBE_RESTRICTIONADVAIR' Call GetNamespace) == 2) then {removeAllWeapons _uav}; + +_group = createGroup sideJoined; +_driver = [Format ["WFBE_%1SOLDIER",sideJoinedText] Call GetNamespace,_group,getPos _uav,sideJoined] Call CreateMan; +_driver MoveInDriver _uav; + +_built = 1; +//--- OPFOR Uav has no gunner slot. +if (sideJoined == west) then { + _gunner = [Format ["WFBE_%1SOLDIER",sideJoinedText] Call GetNamespace,_group,getPos _uav,sideJoined] Call CreateMan; + _gunner MoveInGunner _uav; + _built = _built + 1; +}; +[sideJoinedText,'UnitsCreated',_built] Call UpdateStatistics; +[sideJoinedText,'VehiclesCreated',1] Call UpdateStatistics; + +-12500 Call ChangePlayerFunds; + +WFBE_RequestSpecial = ['SRVFNCREQUESTSPECIAL',["uav",sideJoined,_uav,clientTeam]]; +publicVariable 'WFBE_RequestSpecial'; +if (isHostedServer) then {['SRVFNCREQUESTSPECIAL',["uav",sideJoined,_uav,clientTeam]] Spawn HandleSPVF}; + +sleep 0.02; + +if ((count units _uav) > 1) then {[driver _uav] join grpnull}; + +_radius = 1000; +_wpcount = 4; +_step = 360 / _wpcount; +_add = 0; +_cw = true; +_dir = 0; +if !(isNil "_lastWP") then {deletewaypoint _lastWP}; + +//--- No need to preprocess those. +if (WF_A2_Vanilla) then { + ExecVM "Client\Module\UAV\uav_interface.sqf"; +} else { + ExecVM "Client\Module\UAV\uav_interface_oa.sqf"; +}; +[_uav] ExecVM 'Client\Module\UAV\uav_spotter.sqf'; + +_spawn = [] spawn {}; //--- Empty spawn +while {alive _uav} do { + waituntil {waypointdescription [group _uav,currentwaypoint group _uav] != ' ' || !alive _uav}; + terminate _spawn; //--- Terminate spawn from previous loop + if (!(alive _uav)||isNull _uav) exitwith {}; + + _waypoints = waypoints _uav; + _lastWP = _waypoints select (count _waypoints - 1); + _lastWPpos = waypointposition _lastWP; + deletewaypoint _lastWP; + for "_d" from 0 to (360-_step) step _step do + { + _add = _d; + if !(_cw) then {_add = -_d}; + _pos = [_lastWPpos, _radius, _dir+_add] call bis_fnc_relPos; + _wp = (group _uav) addwaypoint [_pos,0]; + _wp setWaypointType "MOVE"; + _wp setwaypointdescription ' '; + _wp setwaypointcompletionradius (1000/_wpcount); + }; + + _spawn = [_uav,_add,_step,_lastWPpos,_radius,_dir] spawn { + Private ['_add','_currentWP','_dir','_lastWPpos','_pos','_radius','_step','_uav','_wp']; + scriptname "UAV Route planning"; + _uav = _this select 0; + _add = _this select 1; + _step = _this select 2; + _lastWPpos = _this select 3; + _radius = _this select 4; + _dir = _this select 5; + _currentWP = currentwaypoint group _uav; + while {alive _uav} do { + waituntil {_currentWP != currentwaypoint group _uav}; + sleep .01; + _add = _add + _step; + if !(_cw) then {_add = -_add}; + _pos = [_lastWPpos, _radius, _dir+_add] call bis_fnc_relPos; + _wp = (group _uav) addwaypoint [_pos,0]; + _wp setWaypointType "MOVE"; + _wp setwaypointdescription ' '; + _wp setwaypointcompletionradius (1000/_wpcount); + _currentWP = currentwaypoint group _uav; + }; + }; + + _wpcount = count waypoints _uav; + waituntil {waypointdescription [group _uav,currentwaypoint group _uav] == ' ' || _wpcount != count waypoints _uav || !alive _uav}; + if (!(alive _uav)||isNull _uav) exitwith {}; +}; diff --git a/Client/Module/UAV/uav_interface.sqf b/Client/Module/UAV/uav_interface.sqf new file mode 100644 index 0000000..873b026 --- /dev/null +++ b/Client/Module/UAV/uav_interface.sqf @@ -0,0 +1,304 @@ +Private ['_IGUI_update','_alt','_defaultTeamswitch','_defaultvalue','_displayEH_keydown','_displayEH_mousebuttondown','_displayEH_mousezchanged','_locked','_logic','_mapEH_mousebttondown','_newalt','_newspeed','_ppBlur','_ppColor','_ppGrain','_ppInversion','_speed','_uav']; +_defaultTeamswitch = teamswitchenabled; + +startLoadingScreen ["UAV","RscDisplayLoadMission"]; + +_uav = playerUAV; + +//--- UAV destroyed +if (isnull _uav) exitwith {endLoadingScreen;hintc format [localize "strwfbasestructuredestroyed",localize "str_uav_action"]}; + +//--- Switch view +gunner _uav removeweapon "nvgoggles"; +_uav switchcamera "internal"; +player remoteControl gunner _uav; +_locked = locked _uav; +_uav lock true; +_uav selectweapon (weapons _uav select 0); +enableteamswitch false; +titletext ["","black in"]; +BIS_UAV_TIME = 0; +BIS_UAV_PLANE = _uav; +_ppInversion = 0; + +//--- Disable HC +hcshowbar false; + +//--- Show MARTA icons +if (isnil "BIS_UAV_visible") then {BIS_UAV_visible = groupiconsvisible}; +setGroupIconsVisible [true,true]; +(group _uav) setvariable ["MARTA_waypoint",[true,[-1,-1,-1,-1]]]; + +//--- Postprocess effects +_ppColor = ppEffectCreate ["ColorCorrections", 1999]; +_ppColor ppEffectEnable true; +_ppColor ppEffectAdjust [1, 1, 0, [1, 1, 1, 0], [1, 1, 1, 0.0], [1, 1, 1, 1.0]]; +_ppColor ppEffectCommit 0; +_ppBlur = ppEffectCreate ["dynamicBlur", 505]; +_ppBlur ppEffectEnable true; +_ppBlur ppEffectAdjust [.5]; +_ppBlur ppEffectCommit 0; +_ppGrain = ppEffectCreate ["filmGrain", 2005]; +_ppGrain ppEffectEnable true; +_ppGrain ppEffectAdjust [0.02, 1, 1, 0, 1]; +_ppGrain ppEffectCommit 0; + +//--- RSC +1124 cutrsc ["RscUnitInfoUAV","plain"]; +waituntil {!isnil {uinamespace getvariable "BIS_UAV_DISPLAY"}}; +progressLoadingScreen 0.5; + +//--- Minimap update +((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl 112410) mapcenteroncamera true; + +//--- Default aperture +if (isnil {BIS_UAV_PLANE getvariable 'BIS_UAV_aperture'}) then { + _defaultvalue = if (daytime > 5 && daytime < 19) then {24} else {0.07}; + BIS_UAV_PLANE setvariable ['BIS_UAV_aperture',_defaultValue]; + setaperture _defaultvalue; +} else { + setaperture (BIS_UAV_PLANE getvariable 'BIS_UAV_aperture'); +}; + +//--- Default height +_newalt = BIS_UAV_PLANE getvariable 'BIS_UAV_height'; +if (isnil "_newalt") then { + _alt = position _uav select 2; + _newalt = (round (_alt / 50)) * 50; + if (_newalt < 100) then {_newalt = 100}; + _uav flyinheight _newalt; + _uav setvariable ['BIS_UAV_height',_newalt]; +}; +((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112413) ctrlsettext str (_newalt); +((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112413) ctrlcommit 0; + +//--- Default speed +_newspeed = BIS_UAV_PLANE getvariable 'BIS_UAV_speed'; +if (isnil "_newspeed") then { + _speed = speed _uav; + _newspeed = (round (_speed / 50)) * 50; + if (_newalt < 200) then {_newalt = 200}; + driver _uav forcespeed _newspeed;; + _uav setvariable ['BIS_UAV_speed',_newspeed]; +}; +((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112412) ctrlsettext str (_newspeed); +((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112412) ctrlcommit 0; + +BIS_UAV_GUIinit = { +private ["_control","_display","_controls","_controlHint"]; +scriptName "UAV\data\scripts\uav_interface.sqf: GUI Init"; + disableserialization; + Private ['_control','_controlHint','_controls','_display']; + _display = uinamespace getvariable "BIS_UAV_DISPLAY"; + _controls = [112401,112402,112403,112404]; + { + _control = _display displayctrl _x; + _control ctrlshow false; + _control ctrlcommit 0; + } foreach _controls; + _controlHint = _display displayctrl 112414; + _controlHint ctrlsettext ( + localize "str_coin_exit" + " " + localize "str_input_device_mouse_1" + "\n\n" + + localize "str_disp_opt_bright" + " " + localize "str_input_device_mouse_axis_z" + "\n" + + localize "str_arcmark_title1" + ": " + call compile actionkeysnames ["Binocular",2] + ); + _controlHint ctrlcommit 0; +}; +[] spawn BIS_UAV_GUIinit; + +_IGUI_update = [] spawn {scriptName "UAV\data\scripts\uav_interface.sqf: IGUI Update"; + Private ['_uav']; + _uav = BIS_UAV_PLANE; + while {cameraon == BIS_UAV_PLANE} do { + if (isnull (uinamespace getvariable "BIS_UAV_DISPLAY")) then {bis_uav_terminate = true; + ExecVM "ca\modules\uav\data\scripts\uav_interface.sqf"; + }; + if (visiblemap) then { + if (ctrlshown ((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl 112411)) then { + { + ((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl _x) ctrlshow false; + ((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl _x) ctrlcommit 0; + } foreach [112410,112411,112412,112413,112414]; + }; + } else { + if !(ctrlshown ((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl 112411)) then { + { + ((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl _x) ctrlshow true; + ((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl _x) ctrlcommit 0; + } foreach [112410,112411,112412,112413,112414]; + }; + }; + ((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl 112411) ctrlsettext str (round speed _uav); + ((uinamespace getvariable "BIS_UAV_DISPLAY") displayctrl 112411) ctrlcommit 0; + sleep 0.01; + }; +}; + +//--- Detect pressed keys (temporary solution) +_displayEH_keydown = (finddisplay 46) displayaddeventhandler ["keydown"," + Private ['_id','_key','_level','_marker','_markertime','_ppInversion','_uav','_worldpos']; + _key = _this select 1; + + comment '--- END'; + if (_key in (actionkeys 'menuback')) then {bis_uav_terminate = true}; + + comment '--- NVG'; + if (_key in (actionkeys 'NightVision')) then { + _uav = BIS_UAV_PLANE; + if (isnil {_uav getvariable 'BIS_UAV_pp_NVG'}) then { + _ppInversion = ppEffectCreate ['colorInversion', 2555]; + _ppInversion ppEffectEnable true; + _ppInversion ppEffectAdjust [1,1,1]; + _ppInversion ppEffectCommit 0; + _uav setvariable ['BIS_UAV_pp_NVG',_ppInversion]; + } else { + ppEffectDestroy (_uav getvariable 'BIS_UAV_pp_NVG'); + _uav setvariable ['BIS_UAV_pp_NVG',nil]; + }; + }; + + comment '--- MARKER'; + if (_key in (actionkeys 'binocular') && !visiblemap) then { + _id = 1; + while {markertype format ['_user_defined_UAV_MARKER_%1',_id] != ''} do { + _id = _id + 1; + }; + _worldpos = screentoworld [0.5,0.5]; + _marker = createmarker [format ['_user_defined_UAV_MARKER_%1',_id],_worldpos]; + _marker setmarkertype 'mil_destroy'; + _marker setmarkercolor 'colorred'; + _marker setmarkersize [0.5,0.5]; + _markertime = [daytime] call bis_fnc_timetostring; + _marker setmarkertext format ['UAV %1: %2',_id,_markertime]; + }; + + comment '--- UP'; + if (_key in (actionkeys 'HeliUp')) then { + _uav = BIS_UAV_PLANE; + _level = _uav getvariable 'BIS_UAV_height'; + _level = _level + 50; + if (_level > 1000) then {_level = 1000}; + _uav flyinheight _level; + _uav setvariable ['BIS_UAV_height',_level]; + ((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112413) ctrlsettext str (_level); + ((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112413) ctrlcommit 0; + }; + + comment '--- DOWN'; + if (_key in (actionkeys 'HeliDown')) then { + _uav = BIS_UAV_PLANE; + _level = _uav getvariable 'BIS_UAV_height'; + _level = _level - 50; + if (_level < 100) then {_level = 100}; + _uav flyinheight _level; + _uav setvariable ['BIS_UAV_height',_level]; + ((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112413) ctrlsettext str (_level); + ((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112413) ctrlcommit 0; + }; + + comment '--- FORWARD'; + if (_key in (actionkeys 'HeliForward')) then { + _uav = BIS_UAV_PLANE; + _level = _uav getvariable 'BIS_UAV_speed'; + _level = _level + 50; + if (_level > 500) then {_level = 500}; + if (_level < 200) then {_level = 200}; + driver _uav forcespeed (_level / 3.6); + _uav setvariable ['BIS_UAV_speed',_level]; + ((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112412) ctrlsettext str (_level); + ((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112412) ctrlcommit 0; + }; + + comment '--- BACK'; + if (_key in (actionkeys 'HeliBack')) then { + _uav = BIS_UAV_PLANE; + _level = _uav getvariable 'BIS_UAV_speed'; + _level = _level - 50; + if (_level > 500) then {_level = 500}; + if (_level < 200) then {_level = 200}; + driver _uav forcespeed (_level / 3.6); + _uav setvariable ['BIS_UAV_speed',_level]; + ((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112412) ctrlsettext str (_level); + ((uinamespace getvariable 'BIS_UAV_DISPLAY') displayctrl 112412) ctrlcommit 0; + }; +"]; + +//--- Detect pressed mouse buttons +_displayEH_mousebuttondown = (finddisplay 46) displayaddeventhandler ["mousebuttondown"," + disableserialization; + Private ['_button','_control','_controls','_display']; + _button = _this select 1; + if (_button == 007 && !visiblemap) then {comment 'DISABLED'; + _display = uinamespace getvariable 'BIS_UAV_DISPLAY'; + _controls = [112401,112402,112403,112404]; + { + _control = _display displayctrl _x; + _control ctrlshow !(ctrlshown _control); + _control ctrlcommit 0; + } foreach _controls; + }; + if (_button == 1 && !visiblemap && 65665 in (actionkeys 'menuback')) then {bis_uav_terminate = true}; +"]; + +//--- Detect mouse wheel rotation +_displayEH_mousezchanged = (finddisplay 46) displayaddeventhandler ["mousezchanged"," + Private ['_aperture','_oldAperture','_zChangeFinal','_zchange']; + _zchange = _this select 1; + _oldAperture = BIS_UAV_PLANE getvariable 'BIS_UAV_aperture'; + _zChangeFinal = _zChange / 2; + if (_oldAperture <= 1.0) then {_zChangeFinal = _zChange / 10}; + if (_oldAperture <= 0.1) then {_zChangeFinal = _zChange / 1000}; + _aperture = _oldAperture + _zchangeFinal; + if (_oldaperture > 1.0 && _aperture < 1.0) then {_aperture = 1.0}; + if (_oldaperture > 0.1 && _aperture < 0.1) then {_aperture = 0.1}; + if (_aperture < 0.001) then {_aperture = 0.001}; + BIS_UAV_PLANE setvariable ['BIS_UAV_aperture',_aperture]; + setaperture _aperture; +"]; + +_mapEH_mousebttondown = ((findDisplay 12) displayCtrl 51) ctrladdeventhandler ["mousebuttondown", " + Private ['_button','_uav','_worldpos','_wp']; + _button = _this select 1; + if (_button == 0) then { + _uav = BIS_UAV_PLANE; + + while {count (waypoints _uav) > 0} do {deletewaypoint ((waypoints _uav) select 0)}; + + _worldpos = (_this select 0) posscreentoworld [_this select 2,_this select 3]; + _wp = (group _uav) addwaypoint [_worldpos,0]; + _wp setWaypointType 'MOVE'; + (group _uav) setcurrentwaypoint _wp; + }; +"]; + +endLoadingScreen; + +//--- TERMINATE +waituntil {!isnil "bis_uav_terminate" || !alive _uav || !alive player}; +if (!alive _uav) then { + hintc format [localize "strwfbasestructuredestroyed",localize "str_uav_action"]; +}; +_uav lock _locked; +titletext ["","black in"]; +bis_uav_terminate = nil; +BIS_UAV_TIME = nil; +BIS_UAV_PLANE = nil; +objnull remoteControl gunner _uav; +player switchcamera "internal"; +enableteamswitch _defaultTeamswitch; + +setGroupIconsVisible BIS_UAV_visible; +BIS_UAV_visible = nil; +(group _uav) setvariable ["MARTA_waypoint",[false,[-1,-1,-1,-1]]]; + +setaperture -1; +ppEffectDestroy _ppColor; +ppEffectDestroy _ppBlur; +ppEffectDestroy (_uav getvariable 'BIS_UAV_pp_NVG'); //--- Color Invert Fix. +ppEffectDestroy _ppGrain; + +1124 cuttext ["","plain"]; +(finddisplay 46) displayremoveeventhandler ["keydown",_displayEH_keydown]; +(finddisplay 46) displayremoveeventhandler ["mousebuttondown",_displayEH_mousebuttondown]; +(finddisplay 46) displayremoveeventhandler ["mousezchanged",_displayEH_mousezchanged]; +((findDisplay 12) displayCtrl 51) ctrlremoveeventhandler ["mousebuttondown",_mapEH_mousebttondown]; \ No newline at end of file diff --git a/Client/Module/UAV/uav_interface_oa.sqf b/Client/Module/UAV/uav_interface_oa.sqf new file mode 100644 index 0000000..5c4e229 --- /dev/null +++ b/Client/Module/UAV/uav_interface_oa.sqf @@ -0,0 +1,162 @@ +Private ['_action_leave','_defaultTeamswitch','_displayEH_keydown','_displayEH_mousebuttondown','_locked','_logic','_mapEH_mousebttondown','_ppColor','_uav']; +_defaultTeamswitch = teamswitchenabled; + +startLoadingScreen ["UAV","RscDisplayLoadMission"]; + +_uav = playerUAV; + +//--- UAV destroyed +if (isnull _uav) exitwith {endLoadingScreen;hint format [localize "strwfbasestructuredestroyed",localize "str_uav_action"]}; + +//--- Switch view +gunner _uav removeweapon "nvgoggles"; +_uav switchcamera "internal"; +player remoteControl gunner _uav; +_locked = locked _uav; +_uav lock true; +_uav selectweapon (weapons _uav select 0); +enableteamswitch false; +titletext ["","black in"]; +BIS_UAV_TIME = 0; +BIS_UAV_PLANE = _uav; + +//--- Action! +_action_leave = _uav addaction [ + localize "STR_EP1_UAV_action_exit", + "ca\modules_e\uav\data\scripts\uav_actionCommit.sqf", + [0], + 1, + false, + true, + "PersonView", + "isnil 'BIS_UAV_noExit'" +]; + +//--- Disable HC +if (hcShownBar) then {hcshowbar false}; + +//--- Show MARTA icons +if (isnil "BIS_UAV_visible") then {BIS_UAV_visible = groupiconsvisible}; +setGroupIconsVisible [true,true]; +(group _uav) setvariable ["MARTA_waypoint",[true,[-1,-1,-1,-1]]]; + +//--- Prostprocess effects +//setaperture 24; +_ppColor = ppEffectCreate ["ColorCorrections", 1999]; +_ppColor ppEffectEnable true; +_ppColor ppEffectAdjust [1, 1, 0, [1, 1, 1, 0], [1, 1, 1, 0.0], [0.2, 0.2, 0.2, 0]]; +_ppColor ppEffectCommit 0; + + +//--- RSC +progressLoadingScreen 0.5; + +//--- Detect pressed keys (temporary solution) +BIS_UAV_HELI_keydown = { + Private ['_id','_key','_marker','_markertime','_newHeight','_uav','_worldpos']; + _key = _this select 1; + _uav = BIS_UAV_PLANE; + + //--- END + //if (_key in (actionkeys 'menuback') && isnil 'BIS_UAV_noExit') then {bis_uav_terminate = true}; + + //--- MARKER + if (_key in (actionkeys 'binocular') && !visiblemap) then { + _id = 1; + while {markertype format ['_user_defined_UAV_MARKER_%1',_id] != ''} do { + _id = _id + 1; + }; + _worldpos = screentoworld [0.5,0.5]; + _marker = createmarker [format ['_user_defined_UAV_MARKER_%1',_id],_worldpos]; + _marker setmarkertype 'mil_destroy'; + _marker setmarkercolor 'colorred'; + _marker setmarkersize [0.5,0.5]; + _markertime = [daytime] call bis_fnc_timetostring; + _marker setmarkertext format ['UAV %1: %2',_id,_markertime]; + }; + + //--- UP + if (_key in (actionkeys 'HeliUp')) then { + _newHeight = (position _uav select 2) + 50; + if (_newHeight > 1000) then {_newHeight = 1000}; + if (speed _uav < 1) then {_uav domove position _uav;}; + _uav land 'none'; + _uav flyinheight _newHeight; + }; + + //--- DOWN + if (_key in (actionkeys 'HeliDown')) then { + _newHeight = (position _uav select 2) - 50; + if (_newHeight < 100) then {_newHeight = 100}; + _uav land 'none'; + _uav flyinheight _newHeight; + }; +}; +_displayEH_keydown = (finddisplay 46) displayaddeventhandler ["keydown","Private['_sqf']; _sqf = _this spawn BIS_UAV_HELI_keydown"]; + +//--- Detect pressed mouse buttons +_displayEH_mousebuttondown = (finddisplay 46) displayaddeventhandler ["mousebuttondown"," + disableserialization; + Private ['_button','_control','_controls','_display']; + _button = _this select 1; + if (_button == 007 && !visiblemap) then {comment 'DISABLED'; + _display = uinamespace getvariable 'BIS_UAV_DISPLAY'; + _controls = [112401,112402,112403,112404]; + { + _control = _display displayctrl _x; + _control ctrlshow !(ctrlshown _control); + _control ctrlcommit 0; + } foreach _controls; + }; +"]; + + +//_display = findDisplay 12; +//_map = _display displayCtrl 51; +_mapEH_mousebttondown = ((findDisplay 12) displayCtrl 51) ctrladdeventhandler ["mousebuttondown", " + Private ['_button','_uav','_worldpos','_wp']; + _button = _this select 1; + if (_button == 0) then { + _uav = BIS_UAV_PLANE; + + while {count (waypoints _uav) > 0} do {deletewaypoint ((waypoints _uav) select 0)}; + + _worldpos = (_this select 0) posscreentoworld [_this select 2,_this select 3]; + _wp = (group _uav) addwaypoint [_worldpos,0]; + _wp setWaypointType 'MOVE'; + (group _uav) setcurrentwaypoint _wp; + }; +"]; + +////////////////////////////////////////////////// +endLoadingScreen; +////////////////////////////////////////////////// + + +//--- TERMINATE +waituntil {!isnil "bis_uav_terminate" || !alive _uav || !alive player}; +if (!alive _uav) then { + hint format [localize "strwfbasestructuredestroyed",localize "str_uav_action"]; +}; +_uav lock _locked; +titletext ["","black in"]; +bis_uav_terminate = nil; +BIS_UAV_TIME = nil; +BIS_UAV_PLANE = nil; +objnull remoteControl gunner _uav; +player switchcamera "internal"; +enableteamswitch _defaultTeamswitch; + +_uav removeaction _action_leave; + +setGroupIconsVisible BIS_UAV_visible; +BIS_UAV_visible = nil; +(group _uav) setvariable ["MARTA_waypoint",[false,[-1,-1,-1,-1]]]; + +ppEffectDestroy _ppColor; + +//1124 cuttext ["","plain"]; +(finddisplay 46) displayremoveeventhandler ["keydown",_displayEH_keydown]; +(finddisplay 46) displayremoveeventhandler ["mousebuttondown",_displayEH_mousebuttondown]; +//(finddisplay 46) displayremoveeventhandler ["mousezchanged",_displayEH_mousezchanged]; +((findDisplay 12) displayCtrl 51) ctrlremoveeventhandler ["mousebuttondown",_mapEH_mousebttondown]; \ No newline at end of file diff --git a/Client/Module/UAV/uav_spotter.sqf b/Client/Module/UAV/uav_spotter.sqf new file mode 100644 index 0000000..b1b0b17 --- /dev/null +++ b/Client/Module/UAV/uav_spotter.sqf @@ -0,0 +1,28 @@ +/* + Author: Benny + Name: uav_spotter.sqf + Parameters: + 0 - UAV + Description: + This file handle the UAV 'spotting' ability. If the UAV knows about an hostile unit, it'll reveal it's average location on the map. +*/ + +Private ['_delay','_range','_sensitivity','_uav']; +_uav = _this select 0; +_delay = 'WFBE_UAVSPOTTINGDELAY' Call GetNamespace; +_range = 'WFBE_UAVSPOTTINGRANGE' Call GetNamespace; +_sensitivity = 'WFBE_UAVSPOTTINGDETECTION' Call GetNamespace; + +while {true} do { + sleep _delay; + if (!alive _uav || isNull _uav) exitWith {}; + + { + if (_uav knowsAbout _x > _sensitivity && side _x != sideJoined && side _x != civilian) then { + sleep (0.05 + random 0.05); + WFBE_UAV_Reveal = [sideJoined,'CLTFNCUAV_REVEAL',[_uav,_x]]; + publicVariable 'WFBE_UAV_Reveal'; + if (isHostedServer) then {[sideJoined,'CLTFNCUAV_REVEAL',[_uav,_x]] Spawn HandlePVF}; + }; + } forEach (_uav nearEntities _range); +}; diff --git a/Client/Module/ZetaCargo/Zeta_Hook.sqf b/Client/Module/ZetaCargo/Zeta_Hook.sqf new file mode 100644 index 0000000..653ecaa --- /dev/null +++ b/Client/Module/ZetaCargo/Zeta_Hook.sqf @@ -0,0 +1,40 @@ +Private ["_action","_actionID","_caller","_index","_isAttached","_lifter","_position","_sorted","_type","_vehicle","_vehicles"]; + +_lifter = _this select 0; +_caller = _this select 1; +_actionID = _this select 2; + +if (_caller != driver _lifter) exitWith {}; +if ((typeOf _lifter) in Zeta_Special) then { + if (speed _lifter > 20) exitWith {}; +} else { + if ((speed _lifter > 20)||((getpos _lifter select 2)<2)) exitWith {}; +}; +//--- nearEntities handle living units. +_vehicles = _lifter nearEntities [Zeta_Types, 10]; +if (count _vehicles < 1) exitWith {}; + +_sorted = [_lifter,_vehicles] Call SortByDistance; +_vehicle = _sorted select 0; +_type = typeOf _lifter; +_position = Zeta_DefaultPos; +_index = Zeta_Special find _type; +if (_index != -1) then {_position = Zeta_SpecialPosition select _index}; + +if (count crew(_vehicle) > 0) exitWith {hint (localize 'STR_WF_INFO_Hook_Manned')}; + +_vehicle attachTo [_lifter,_position]; +_lifter setVariable ["Attached",true,false]; +_lifter removeAction _actionID; + +_action = _lifter addAction [localize "STR_WF_Lift_Detach","Client\Module\ZetaCargo\Zeta_Unhook.sqf"]; + +while {!gameOver} do { + sleep 2; + _isAttached = _lifter getVariable "Attached"; + if ((getDammage _lifter > 0.3)||!_isAttached||isNull (driver _lifter)) exitWith { + detach _vehicle; + _lifter removeAction _action; + if (alive _lifter) then {_lifter addAction [localize "STR_WF_Lift","Client\Module\ZetaCargo\Zeta_Hook.sqf"]}; + }; +}; \ No newline at end of file diff --git a/Client/Module/ZetaCargo/Zeta_Init.sqf b/Client/Module/ZetaCargo/Zeta_Init.sqf new file mode 100644 index 0000000..29dcac0 --- /dev/null +++ b/Client/Module/ZetaCargo/Zeta_Init.sqf @@ -0,0 +1,12 @@ +//--- Zeta Cargo by Benny. + +//--- Unit allowed to hook. +Zeta_Lifter = ["MH60S","MV22","C130J","Mi17_Ins","Mi17_medevac_RU","UH60M_EP1","UH60M_MEV_EP1","CH_47F_EP1","C130J_US_EP1","Mi17_TK_EP1","BAF_Merlin_HC3_D","CH_47F_BAF"]; +//--- Zeta Cargo can lift these types. +Zeta_Types = ["Car","Motorcycle","Tank","Ship"]; +//--- Zeta Cargo default Position. +Zeta_DefaultPos = [0,0,-4]; + +//--- Special vehicle with special position. +Zeta_Special = ["C130J","C130J_US_EP1"]; +Zeta_SpecialPosition = [[0,0,-2]]; \ No newline at end of file diff --git a/Client/Module/ZetaCargo/Zeta_Unhook.sqf b/Client/Module/ZetaCargo/Zeta_Unhook.sqf new file mode 100644 index 0000000..3e06b0f --- /dev/null +++ b/Client/Module/ZetaCargo/Zeta_Unhook.sqf @@ -0,0 +1,21 @@ +private ["_actionID","_caller","_lifter","_param","_vehicle"]; + +_lifter = _this select 0; +_caller = _this select 1; +_actionID = _this select 2; +_param = _this select 3; +_vehicle = _param select 0; + +_lifter setVariable ["Attached",false]; +detach _vehicle; +if ((typeOf _lifter) in Zeta_Special) then { + _vehicle setPos [(getPos _lifter select 0) - (15 * sin (getDir _vehicle)), (getPos _lifter select 1) - (15 * cos (getDir _vehicle)), getPos _lifter select 2]; +}; + +_vehicle setVelocity (velocity _lifter); + +_lifter removeAction _actionID; + +sleep 1; + +if ((getPos _vehicle) select 2 < 0) then {_vehicle setPos [(getPos _vehicle) select 0,(getPos _vehicle) select 1,0];_vehicle setVelocity [0,0,-0.1]}; \ No newline at end of file diff --git a/Client/PVFunctions/AllCampsCaptured.sqf b/Client/PVFunctions/AllCampsCaptured.sqf new file mode 100644 index 0000000..f11973e --- /dev/null +++ b/Client/PVFunctions/AllCampsCaptured.sqf @@ -0,0 +1,20 @@ +Private ["_alertOtherSide","_camp","_camps","_count","_marker","_sideID","_town"]; + +_town = _this Select 0; +_sideID = _this Select 1; +_alertOtherSide = _this Select 2; + +_camps = _town getVariable "camps"; + +for [{_count = count _camps - 1},{_count >= 0},{_count = _count - 1}] do { + _camp = _camps select _count; + _marker = Format["%1Camp%2",str _town,_camps find _camp]; + + if (sideID == _sideID) then { + _marker setMarkerColorLocal ("Friendly" Call GetMarkerColoration); + } else { + if (_alertOtherSide || getMarkerColor _marker == ("Friendly" Call GetMarkerColoration)) then { + _marker setMarkerColorLocal ("Enemy" Call GetMarkerColoration); + }; + }; +}; \ No newline at end of file diff --git a/Client/PVFunctions/AwardBounty.sqf b/Client/PVFunctions/AwardBounty.sqf new file mode 100644 index 0000000..6e80016 --- /dev/null +++ b/Client/PVFunctions/AwardBounty.sqf @@ -0,0 +1,19 @@ +Private["_assist","_bounty","_get","_name","_type"]; + +_type = _this select 0; +_assist = _this select 1; + +_get = _type Call GetNamespace; + +_name = _get select QUERYUNITLABEL; +_bounty = round((_get select QUERYUNITPRICE) * ('WFBE_BOUNTYMODIFIER' Call GetNamespace)); + +//--- Are we dealing with a kill assist or a full kill. +if (_assist) then { + _bounty = _bounty * ('WFBE_BOUNTYMODIFIERASSIST' Call GetNamespace); + Format[Localize "STR_WF_CHAT_Award_Bounty_Assist",_bounty,_name] Call GroupChatMessage; +} else { + Format[Localize "STR_WF_CHAT_Award_Bounty",_bounty,_name] Call GroupChatMessage; +}; + +_bounty Call ChangePlayerFunds; \ No newline at end of file diff --git a/Client/PVFunctions/CampCaptured.sqf b/Client/PVFunctions/CampCaptured.sqf new file mode 100644 index 0000000..0894a5e --- /dev/null +++ b/Client/PVFunctions/CampCaptured.sqf @@ -0,0 +1,42 @@ +Private ["_award","_camp","_camps","_index","_marker","_name","_captureSideID","_town","_townSideID","_units"]; + +_town = _this Select 0; +_captureSideID = _this Select 1; +_camp = _this Select 2; + +if !(clientInitComplete) exitWith {}; + +_camps = _town getVariable "camps"; +_name = _town getVariable "name"; +_townSideID = _town getVariable "sideID"; +_index = _camps find _camp; + +if (_index != -1) then { + _marker = Format["%1Camp%2",str _town,_index]; + if (sideID == _captureSideID) then { + _award = false; + if (Leader Group player == player) then { + _units = units group player; + {if (_x distance _camp < 5) then {_award = true}} forEach _units; + }; + + if (player Distance _camp < 5 || _award) then { + ('WFBE_CAMPCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURECAMP' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURECAMP' Call GetNamespace)]] Spawn HandleSPVF}; + Format[localize "STR_WF_CHAT_Camp_Captured_Bounty",_name,'WFBE_CAMPCAPTUREBOUNTY' Call GetNamespace] Call CommandChatMessage; + if (mysql) then { + WF_Logic setVariable ["WF_MYSQL_CLIENT",(WF_Logic getVariable "WF_MYSQL_CLIENT") + [Format ["MYSQLDATA§WFBE_Update§%1§%2§campcaptured§%3",getPlayerUID(player),name player,worldName]],true]; + }; + } else { + Format[localize "STR_WF_CHAT_Camp_Captured",_name] Call CommandChatMessage; + }; + _marker setMarkerColorLocal ("Friendly" Call GetMarkerColoration); + } else { + if (_townSideID == sideID || getMarkerColor _marker == ("Friendly" Call GetMarkerColoration)) then { + Format[localize "STRWFCAMPCAPTUREDBYENEMY",_name] Call CommandChatMessage; + _marker setMarkerColorLocal ("Enemy" Call GetMarkerColoration); + }; + }; +}; diff --git a/Client/PVFunctions/CanJoin.sqf b/Client/PVFunctions/CanJoin.sqf new file mode 100644 index 0000000..ad90ed8 --- /dev/null +++ b/Client/PVFunctions/CanJoin.sqf @@ -0,0 +1,7 @@ +Private ['_canjoin','_name']; +_name = _this select 0; +_canjoin = _this select 1; + +if (!_canjoin && vehicleVarName player != _name) then {_canjoin = true}; + +['WFBE_P_CANJOIN',_canjoin,true] Call SetNamespace; \ No newline at end of file diff --git a/Client/PVFunctions/ChangeScore.sqf b/Client/PVFunctions/ChangeScore.sqf new file mode 100644 index 0000000..583b4c1 --- /dev/null +++ b/Client/PVFunctions/ChangeScore.sqf @@ -0,0 +1,8 @@ +Private ["_newScore","_playerChanged","_oldScore"]; + +_playerChanged = _this select 0; +_newScore = _this select 1; + +_oldScore = score _playerChanged; +_playerChanged addScore -(_oldScore); +_playerChanged addScore _newScore; \ No newline at end of file diff --git a/Client/PVFunctions/CommanderVote.sqf b/Client/PVFunctions/CommanderVote.sqf new file mode 100644 index 0000000..30702ff --- /dev/null +++ b/Client/PVFunctions/CommanderVote.sqf @@ -0,0 +1,11 @@ +Private["_commanderTeam","_text"]; + +_commanderTeam = _this; + +_text = Localize "STR_WF_CHAT_AI_Commander"; +if (!IsNull _commanderTeam) then { + _text = Format[localize "STR_WF_CHAT_VoteForNewCommander",name (leader _commanderTeam)]; + if (group player == _commanderTeam) then {_text = localize "STR_WF_CHAT_PlayerCommander"}; +}; + +[_text] Call TitleTextMessage; \ No newline at end of file diff --git a/Client/PVFunctions/DisplayICBM.sqf b/Client/PVFunctions/DisplayICBM.sqf new file mode 100644 index 0000000..170c5a9 --- /dev/null +++ b/Client/PVFunctions/DisplayICBM.sqf @@ -0,0 +1,6 @@ +Private ["_cruise","_obj"]; + +_obj = _this select 0; +_cruise = _this select 1; +waitUntil {!alive _cruise || isNull _cruise}; +[_obj] Spawn Nuke; \ No newline at end of file diff --git a/Client/PVFunctions/EndGame.sqf b/Client/PVFunctions/EndGame.sqf new file mode 100644 index 0000000..890850e --- /dev/null +++ b/Client/PVFunctions/EndGame.sqf @@ -0,0 +1,9 @@ +Private["_blist","_side","_sideValue"]; + +_sideValue = _this select 0; +_blist = _this select 1; +gameOver = true; +_side = east; +if (_sideValue == WESTID) then {_side = west}; + +[_side,_blist] ExecVM "Client\Client_EndGame.sqf"; \ No newline at end of file diff --git a/Client/PVFunctions/ISIS_AddAction.sqf b/Client/PVFunctions/ISIS_AddAction.sqf new file mode 100644 index 0000000..26bd186 --- /dev/null +++ b/Client/PVFunctions/ISIS_AddAction.sqf @@ -0,0 +1,5 @@ +Private ["_unit"]; +_unit = _this; + +_unit setVariable ['hasAction',true]; +_unit addAction ["First Aid","Client\Module\ISIS\ISIS_Action.sqf", "", 2, false, true, "", "(_target getVariable 'stunned') && alive _target && _this != _target"]; \ No newline at end of file diff --git a/Client/PVFunctions/LocalizeMessage.sqf b/Client/PVFunctions/LocalizeMessage.sqf new file mode 100644 index 0000000..0dfbe80 --- /dev/null +++ b/Client/PVFunctions/LocalizeMessage.sqf @@ -0,0 +1,23 @@ +Private["_localize","_txt"]; + +_localize = _this select 0; + +_txt = ""; +switch (_localize) do { + case "BuildingTeamkill": {_txt = Format [Localize "STR_WF_CHAT_Teamkill_Building",_this select 1, _this select 2, _this select 3]}; + case "Teamswap": {_txt = Format [Localize "STR_WF_CHAT_Teamswap",_this select 1, _this select 2, _this select 3, _this select 4]}; + case "UpgradeComplete": {_txt = Format [Localize "STR_WF_CHAT_Upgrade_Complete_Message",('WFBE_UPGRADELABELS' Call GetNamespace) select (_this select 1), _this select 2]}; + case "CommanderDisconnected": {_txt = Localize "strwfcommanderdisconnected"}; + case "TacticalLaunch": {_txt = Localize "STR_WF_CHAT_ICBM_Launch"}; + case "Teamkill": {_txt = Format [Localize "STR_WF_CHAT_Teamkill",('WFBE_TEAMKILLPENALTY' Call GetNamespace)]; -('WFBE_TEAMKILLPENALTY' Call GetNamespace) Call ChangePlayerFunds}; + case "FundsTransfer": {_txt = Format [Localize "STR_WF_CHAT_FundsTransfer",_this select 1,_this select 2]}; + case "StructureSold": {_txt = Format [Localize "STR_WF_CHAT_Structure_Sold",([_this select 1,'displayName'] Call GetConfigInfo)]}; + case "StructureSell": {_txt = Format [Localize "STR_WF_CHAT_Structure_Sell",([_this select 1,'displayName'] Call GetConfigInfo),_this select 2]}; + case "SecondaryAward": {_txt = Format [Localize "STR_WF_CHAT_Secondary_Award",_this select 1, _this select 2];(_this select 2) Call ChangePlayerFunds}; +}; + +if (_localize != 'FundsTransfer') then { + _txt Call CommandChatMessage; +} else { + _txt Call GroupChatMessage; +}; \ No newline at end of file diff --git a/Client/PVFunctions/M_BASE_Attack.sqf b/Client/PVFunctions/M_BASE_Attack.sqf new file mode 100644 index 0000000..280505b --- /dev/null +++ b/Client/PVFunctions/M_BASE_Attack.sqf @@ -0,0 +1,85 @@ +Private ['_cpt','_exit','_groups','_id','_label','_marker','_markers','_properPos','_ranpos','_size','_target','_task','_tpos']; + +_size = _this select 0; +_label = _this select 1; +_id = _this select 2; +_target = _this select 3; +_groups = _this select 4; + +_marker = Format["%1%2",_label,_id]; +//--- Does the client already have the mission (jip handler, some client joining won't have it running)? +if (((getMarkerPos _marker) select 0) != 0 && ((getMarkerPos _marker) select 1) != 0) exitWith {}; + +_tpos = getPos _target; +_ranpos = [(_tpos select 0)-(random 50)+(random 50),(_tpos select 1)-(random 50)+(random 50)]; +_properPos = [(_ranpos select 0)-(_size / 2),(_ranpos select 1)-(_size / 2)]; + +//--- Inform the player about a new task. +taskHint [format [localize "str_taskNew" + "\n%1",localize 'STR_WF_M_BASE_Attack'], [1,1,1,1], "taskNew"]; + +//--- Task. +_task = player createSimpleTask [Format["TSK_M_%1%2",_label,_id]]; +_task setSimpleTaskDescription [localize 'STR_WF_M_BASE_Attack_Description', localize 'STR_WF_M_BASE_Attack', localize 'STR_WF_M_BASE_Attack']; +_task setSimpleTaskDestination _ranpos; + +//--- Marker part. +_markers = [_marker]; +createMarkerLocal [_marker, _ranpos]; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "BORDER"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["0%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _ranpos]; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "FDIAGONAL"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["00%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _properPos]; +_marker setMarkerColorLocal "ColorRedAlpha"; +_marker setMarkerTypeLocal "mil_marker"; +_marker setMarkerSizeLocal [0.5,0.5]; +_marker setMarkerTextLocal "Targetted Area"; + +//--- Wait for the unit to be spawned. +waitUntil { + sleep 1; + + _exit = false; + { + if (count (units _x) > 0) then {_exit = true}; + } forEach _groups; + + _exit +}; + +//--- Mission run while the enemies are here. +waitUntil { + sleep 1; + + _cpt = 0; + { + if !(isNil '_x') then { + _cpt = _cpt + (count ((units _x) Call GetLiveUnits)); + }; + } forEach _groups; + + _cpt == 0 +}; + +sleep 10; + +//--- Validate the mission for the player. +_task setTaskState 'Succeeded'; +taskHint [format [localize "str_taskAccomplished" + "\n%1",localize 'STR_WF_M_BASE_Attack'], [1,1,1,1], "taskDone"]; + +{_x setMarkerColorLocal "ColorGreenAlpha"} forEach _markers; + +sleep 30; + +//--- Remove the task & markers. +player removeSimpleTask _task; +{deleteMarkerLocal _x} forEach _markers; \ No newline at end of file diff --git a/Client/PVFunctions/M_PLAYERS_Attack_Air.sqf b/Client/PVFunctions/M_PLAYERS_Attack_Air.sqf new file mode 100644 index 0000000..6f14195 --- /dev/null +++ b/Client/PVFunctions/M_PLAYERS_Attack_Air.sqf @@ -0,0 +1,28 @@ +Private ['_get','_id','_label','_marker','_task']; + +_chopper = _this select 0; +_label = _this select 1; +_id = _this select 2; + +_get = Format["WFBE_TSK_M_%1%2",_label,_id] Call GetNamespace; +if !(isNil '_get') exitWith {}; + +taskHint [format [localize "str_taskNew" + "\n%1",localize 'STR_WF_M_PLAYERS_Attack_Air'], [1,1,1,1], "taskNew"]; + +_task = player createSimpleTask [Format["TSK_M_%1%2",_label,_id]]; +[Format["WFBE_TSK_M_%1%2",_label,_id],true,true] Call SetNamespace; +_task setSimpleTaskDescription [localize 'STR_WF_M_PLAYERS_Attack_Air_Description', localize 'STR_WF_M_PLAYERS_Attack_Air', localize 'STR_WF_M_PLAYERS_Attack_Air']; +_task setSimpleTaskTarget [_chopper, false]; + +//--- Wait for the result. +waitUntil {sleep 5; !alive _chopper}; + +_task setTaskState "Succeeded"; +taskHint [format [localize "str_taskAccomplished" + "\n%1",localize 'STR_WF_M_PLAYERS_Attack_Air'], [1,1,1,1], "taskDone"]; + +sleep 30; + +[Format["WFBE_TSK_M_%1%2",_label,_id],nil,true] Call SetNamespace; + +//--- Remove the task & markers. +player removeSimpleTask _task; \ No newline at end of file diff --git a/Client/PVFunctions/M_TOWN_Attack.sqf b/Client/PVFunctions/M_TOWN_Attack.sqf new file mode 100644 index 0000000..1f3dbd3 --- /dev/null +++ b/Client/PVFunctions/M_TOWN_Attack.sqf @@ -0,0 +1,84 @@ +Private ['_cpt','_exit','_groups','_id','_label','_marker','_markers','_properPos','_size','_task','_town','_townPos']; + +_size = _this select 0; +_label = _this select 1; +_id = _this select 2; +_town = _this select 3; +_groups = _this select 4; + +_marker = Format["%1%2",_label,_id]; +//--- Does the client already have the mission (jip handler, some client joining won't have it running)? +if (((getMarkerPos _marker) select 0) != 0 && ((getMarkerPos _marker) select 1) != 0) exitWith {}; + +_townPos = getPos _town; +_properPos = [(_townPos select 0)-(_size / 2),(_townPos select 1)-(_size / 2)]; + +//--- Inform the player about a new task. +taskHint [format [localize "str_taskNew" + "\n%1",Format[localize 'STR_WF_M_TOWN_Attack',_town getVariable "name"]], [1,1,1,1], "taskNew"]; + +//--- Task. +_task = player createSimpleTask [Format["TSK_M_%1%2",_label,_id]]; +_task setSimpleTaskDescription [Format[localize 'STR_WF_M_TOWN_Attack_Description',_town getVariable "name"], Format[localize 'STR_WF_M_TOWN_Attack',_town getVariable "name"], Format[localize 'STR_WF_M_TOWN_Attack',_town getVariable "name"]]; +_task setSimpleTaskDestination _properPos; + +//--- Marker part. +_markers = [_marker]; +createMarkerLocal [_marker, _townPos]; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "BORDER"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["0%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _townPos]; +_marker setMarkerColorLocal "ColorRed"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "FDIAGONAL"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["00%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _properPos]; +_marker setMarkerColorLocal "ColorRedAlpha"; +_marker setMarkerTypeLocal "mil_marker"; +_marker setMarkerSizeLocal [0.5,0.5]; +_marker setMarkerTextLocal "Targetted Area"; + +//--- Wait for the unit to be spawned. +waitUntil { + sleep 1; + + _exit = false; + { + if (count (units _x) > 0) then {_exit = true}; + } forEach _groups; + + _exit +}; + +//--- Mission run while the enemies are here. +waitUntil { + sleep 1; + + _cpt = 0; + { + if !(isNil '_x') then { + _cpt = _cpt + (count ((units _x) Call GetLiveUnits)); + }; + } forEach _groups; + + _cpt == 0 +}; + +sleep 10; + +//--- Validate the mission for the player. +_task setTaskState 'Succeeded'; +taskHint [format [localize "str_taskAccomplished" + "\n%1", Format[localize 'STR_WF_M_TOWN_Attack',_town getVariable "name"]], [1,1,1,1], "taskDone"]; + +{_x setMarkerColorLocal "ColorGreenAlpha"} forEach _markers; + +sleep 30; + +//--- Remove the task & markers. +player removeSimpleTask _task; +{deleteMarkerLocal _x} forEach _markers; \ No newline at end of file diff --git a/Client/PVFunctions/M_UAV_RetrieveModule.sqf b/Client/PVFunctions/M_UAV_RetrieveModule.sqf new file mode 100644 index 0000000..60f734f --- /dev/null +++ b/Client/PVFunctions/M_UAV_RetrieveModule.sqf @@ -0,0 +1,65 @@ +Private ['_id','_label','_marker','_markerRanPos','_markers','_randomPos','_searchArea','_sideWin','_size','_task','_taskState','_uav']; + +_size = _this select 0; +_label = _this select 1; +_id = _this select 2; +_uav = _this select 3; + +_marker = Format["%1%2",_label,_id]; +//--- Does the client already have the mission (jip handler, some client joining won't have it running)? +if (((getMarkerPos _marker) select 0) != 0 && ((getMarkerPos _marker) select 1) != 0) exitWith {}; + +taskHint [format [localize "str_taskNew" + "\n%1",localize 'STR_WF_M_UAV_RetrieveModule'], [1,1,1,1], "taskNew"]; + +_randomPos = getPos _uav; + +//--- Determine the marker random area. +_searchArea = (_size/1.5); +_markerRanPos = [(_randomPos select 0)+random(_searchArea)-random(_searchArea),(_randomPos select 1)+random(_searchArea)-random(_searchArea)]; + +_task = player createSimpleTask [Format["TSK_M_%1%2",_label,_id]]; +_task setSimpleTaskDescription [localize 'STR_WF_M_UAV_RetrieveModule_Description', localize 'STR_WF_M_UAV_RetrieveModule', localize 'STR_WF_M_UAV_RetrieveModule']; +_task setSimpleTaskDestination _markerRanPos; + +//--- Marker part. +_markers = [_marker]; +createMarkerLocal [_marker, _markerRanPos]; +_marker setMarkerColorLocal "ColorYellow"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "BORDER"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["0%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _markerRanPos]; +_marker setMarkerColorLocal "ColorYellow"; +_marker setMarkerShapeLocal "ELLIPSE"; +_marker setMarkerBrushLocal "FDIAGONAL"; +_marker setMarkerSizeLocal [_size,_size]; +_marker = Format["00%1%2",_label,_id]; +_markers = _markers + [_marker]; +createMarkerLocal [_marker, _markerRanPos]; +_marker setMarkerColorLocal "ColorYellow"; +_marker setMarkerTypeLocal "pickup"; +_marker setMarkerSizeLocal [0.5,0.5]; +_marker setMarkerTextLocal "UAV Crash Site"; + +//--- Wait for the result. +waitUntil {sleep 5; _sideWin = _uav getVariable 'side'; !(isNil '_sideWin')}; +_taskState = if (side player == (_uav getVariable 'side')) then {"Succeeded"} else {"Failed"}; + +//--- Wait for mission completion. +waitUntil {sleep 5; (isNull _uav)}; + +_task setTaskState _taskState; + +if (_taskState == 'Succeeded') then { + taskHint [format [localize "str_taskAccomplished" + "\n%1",localize 'STR_WF_M_UAV_RetrieveModule'], [1,1,1,1], "taskDone"]; +} else { + taskHint [format [localize "str_taskFailed" + "\n%1",localize 'STR_WF_M_UAV_RetrieveModule'], [1,1,1,1], "taskFailed"]; +}; + +sleep 30; + +//--- Remove the task & markers. +player removeSimpleTask _task; +{deleteMarkerLocal _x} forEach _markers; \ No newline at end of file diff --git a/Client/PVFunctions/Penalty.sqf b/Client/PVFunctions/Penalty.sqf new file mode 100644 index 0000000..2ae2291 --- /dev/null +++ b/Client/PVFunctions/Penalty.sqf @@ -0,0 +1,9 @@ +Private['_fee','_pfunds','_result']; + +_fee = 'WFBE_CIVILIANPENALTY' Call GetNamespace; +Format[Localize "STR_WF_CHAT_Penalty",_fee] Call GroupChatMessage; + +_pfunds = Call GetPlayerFunds; +_result = _pfunds - _fee; +if (_result < 0) then {_fee = _fee + _result}; +-(_fee) Call ChangePlayerFunds; \ No newline at end of file diff --git a/Client/PVFunctions/PerformAction.sqf b/Client/PVFunctions/PerformAction.sqf new file mode 100644 index 0000000..b57bfad --- /dev/null +++ b/Client/PVFunctions/PerformAction.sqf @@ -0,0 +1,10 @@ +Private ['_action','_from','_unit']; +_unit = _this select 0; +_action = _this select 1; +_from = _this select 2; + +_unit action [_action, _from]; + +switch (_action) do { + case "EJECT": {unassignVehicle _unit}; +}; diff --git a/Client/PVFunctions/SetHQStatus.sqf b/Client/PVFunctions/SetHQStatus.sqf new file mode 100644 index 0000000..8970dd8 --- /dev/null +++ b/Client/PVFunctions/SetHQStatus.sqf @@ -0,0 +1,5 @@ +if (_this) then { + ['WFBE_AREAHQDEPLOYED' Call GetNamespace,true,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; +} else { + ['WFBE_AREAHQUNDEPLOYED' Call GetNamespace,false,MCoin] Call Compile preprocessFile "Client\Init\Init_Coin.sqf"; +}; \ No newline at end of file diff --git a/Client/PVFunctions/SetTask.sqf b/Client/PVFunctions/SetTask.sqf new file mode 100644 index 0000000..fa33e86 --- /dev/null +++ b/Client/PVFunctions/SetTask.sqf @@ -0,0 +1,36 @@ +Private ["_task","_taskPos","_taskTime","_taskTimeLabel"]; + +_task = _this select 0; +_taskTime = _this select 1; +_taskTimeLabel = _this select 2; +_taskPos = _this select 3; + +if (!isNull(comTask)) then {player removeSimpleTask comTask}; +comTask = player createSimpleTask ["CommanderOrder"]; +comTask setSimpleTaskDescription [Format[localize "STR_WF_CHAT_TaskTO_Display",_task,_taskTimeLabel], _task, _task]; +comTask setSimpleTaskDestination _taskPos; +player setCurrentTask comTask; + +taskHint [format [localize "str_taskNew" + "\n%1",_task], [1,1,1,1], "taskNew"]; + +[comTask,_taskTime,_taskPos,_task] Spawn { + Private ["_duration","_pos","_succeed","_task","_timer","_type"]; + _task = _this select 0; + _duration = (_this select 1)*60; //--- Converts to seconds. + _pos = _this select 2; + _type = _this select 3; + + _timer = 0; + _succeed = false; + while {(taskDestination _task) select 0 == (_pos select 0) && !_succeed} do { + sleep 5; + if (player distance _pos < 250) then {_timer = _timer + 5}; + if (_timer > _duration) then {_succeed = true}; + }; + + if (_succeed) then { + taskHint [format [localize "str_taskAccomplished" + "\n%1",_type], [1,1,1,1], "taskDone"]; + _task setTaskState "Succeeded"; + player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderDone",["1","","HQ",["HQ"]],["2","","We are",["WeAre"]],["3","","ready for orders",["ReadyForOrders"]],["4","","over.",["Over1"]],true]; + }; +}; \ No newline at end of file diff --git a/Client/PVFunctions/SetVehicleLock.sqf b/Client/PVFunctions/SetVehicleLock.sqf new file mode 100644 index 0000000..880533d --- /dev/null +++ b/Client/PVFunctions/SetVehicleLock.sqf @@ -0,0 +1 @@ +(_this select 0) lock (_this select 1); \ No newline at end of file diff --git a/Client/PVFunctions/TownCaptured.sqf b/Client/PVFunctions/TownCaptured.sqf new file mode 100644 index 0000000..4254ea2 --- /dev/null +++ b/Client/PVFunctions/TownCaptured.sqf @@ -0,0 +1,98 @@ +Private ["_award","_bounty","_location","_locationName","_marker1","_mysqlUpdate","_name","_newScore","_objective","_ptask","_range","_sideName","_sideToValue","_sideValue","_task","_units"]; + +_location = _this Select 0; +_sideValue = _this Select 1; +_sideToValue = _this Select 2; +_name = str _location; +_mysqlUpdate = ""; + +if (_sideToValue != sideID || !clientInitComplete) exitWith {}; + +_task = _location getVariable 'taskLink'; +_ptask = currentTask player; +if (isNil '_task') then {_task = objNull}; +_locationName = _location getVariable "name"; + +_marker1 = Format["%1Depot",_name]; +_sideName = localize "STR_WF_Side_Resistance"; + +if (_sideValue == WESTID) then {_sideName = localize "STR_WF_PARAMETER_Side_West"}; +if (_sideValue == EASTID) then {_sideName = localize "STR_WF_PARAMETER_Side_East"}; +if (_sideValue == sideID) then {_marker1 setMarkerColorLocal ("Friendly" Call GetMarkerColoration)} else {_marker1 setMarkerColorLocal ("Enemy" Call GetMarkerColoration)}; +if (_sideValue == RESISTANCEID) then {_marker1 setMarkerColorLocal ("Resistance" Call GetMarkerColoration)}; + +if (time > 10) then {[Format[Localize "STR_WF_CHAT_Town_Captured",_locationName,_sideName]] Call TitleTextMessage}; + +if (_sideValue == sideID) then { + _award = false; + if ((leader group player) == player) then { + _units = units group player; + {if (vehicle _x distance _location < ('WFBE_TOWNCAPTURERANGE' Call GetNamespace)) then {_award = true}} forEach _units; + }; + + if (player distance _location < ('WFBE_TOWNCAPTURERANGE' Call GetNamespace) || _award) then { + if (_task == _ptask) then { + ["TownHintDone",_location] Spawn TaskSystem; + ('WFBE_TOWNMISSIONCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNMISSIONCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "towncaptured"; + } else { + ('WFBE_TOWNCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "towncaptured"; + }; + } else { + _range = (_location getVariable "range") * ('WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace); + if (player distance _location < _range) then { + if (_task == _ptask) then { + ["TownHintDone",_location] Spawn TaskSystem; + ('WFBE_TOWNMISSIONASSISTCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNMISSIONASSISTCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "townassist"; + } else { + ('WFBE_TOWNASSISTCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Assist",_locationName,('WFBE_TOWNASSISTCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "townassist"; + }; + }; + }; +}; + +if (mysql) then { + if (_mysqlUpdate != "") then { + WF_Logic setVariable ["WF_MYSQL_CLIENT",(WF_Logic getVariable "WF_MYSQL_CLIENT") + [Format ["MYSQLDATA?WFBE_Update?%1?%2?%3?%4",getPlayerUID(player),name player,_mysqlUpdate,worldName]],true]; + }; +}; + +if (!isNull commanderTeam && sideID == _sideValue) then { + if (commanderTeam == group player) then { + _bounty = (_location getVariable "startingSupplyValue") * ('WFBE_COMMANDERTOWNCAPTURECOEF' Call GetNamespace); + _bounty Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERTOWNCAPTURESCORE' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERTOWNCAPTURESCORE' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Commander_Bounty_Town",_bounty,_locationName] Call CommandChatMessage; + }; +}; + +/* Task Handling */ +["TownUpdate",_location] Spawn TaskSystem; +if (sideID == _sideValue) then { + if !(isNull _task) then { + if (_ptask == _task) then { + ["TownAssignClosest"] Spawn TaskSystem; + }; + }; +}; \ No newline at end of file diff --git a/Client/PVFunctions/TownCapturedPublic.sqf b/Client/PVFunctions/TownCapturedPublic.sqf new file mode 100644 index 0000000..4d9df03 --- /dev/null +++ b/Client/PVFunctions/TownCapturedPublic.sqf @@ -0,0 +1,96 @@ +Private ["_award","_bounty","_location","_locationName","_marker1","_mysqlUpdate","_name","_locations","_objective","_ptask","_range","_side","_sideName","_sideValue","_task","_units"]; + +_location = _this select 0; +_sideValue = _this select 1; + +if !(clientInitComplete) exitWith {}; + +_name = str _location; +_mysqlUpdate = ""; + +_task = _location getVariable 'taskLink'; +_ptask = currentTask player; +if (isNil '_task') then {_task = objNull}; +_locationName = _location getVariable "name"; + +_sideName = localize "STR_WF_PARAMETER_Side_East"; +if (_sideValue == WESTID) then {_sideName = localize "STR_WF_PARAMETER_Side_West"}; + +[Format[Localize "STR_WF_CHAT_Town_Captured",_locationName,_sideName]] Call TitleTextMessage; +_marker1 = Format["%1Depot",_name]; + +if (_sideValue == sideID) then {_marker1 setMarkerColorLocal ("Friendly" Call GetMarkerColoration)} else {_marker1 setMarkerColorLocal ("Enemy" Call GetMarkerColoration)}; + +if (_sideValue == sideID) then { + _award = false; + if ((Leader Group player) == player) then { + _units = Units Group player; + {if (vehicle _x distance _location < ('WFBE_TOWNCAPTURERANGE' Call GetNamespace)) then {_award = true};} ForEach _units; + }; + + if (player distance _location < ('WFBE_TOWNCAPTURERANGE' Call GetNamespace) || _award) then { + if (_task == _ptask) then { + ["TownHintDone",_location] Spawn TaskSystem; + ('WFBE_TOWNMISSIONCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNMISSIONCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "towncaptured"; + } else { + ('WFBE_TOWNCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCORECAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "towncaptured"; + }; + } else { + _range = (_location getVariable "range") * ('WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace); + if (player distance _location < _range) then { + if (_task == _ptask) then { + ["TownHintDone",_location] Spawn TaskSystem; + ('WFBE_TOWNMISSIONASSISTCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Full",_locationName,('WFBE_TOWNMISSIONASSISTCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "townassist"; + } else { + ('WFBE_TOWNASSISTCAPTUREBOUNTY' Call GetNamespace) Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_SCOREASSISTCAPTURETOWN' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Town_Bounty_Assist",_locationName,('WFBE_TOWNASSISTCAPTUREBOUNTY' Call GetNamespace)] Call CommandChatMessage; + _mysqlUpdate = "townassist"; + }; + }; + }; +}; + +if (mysql) then { + if (_mysqlUpdate != "") then { + WF_Logic setVariable ["WF_MYSQL_CLIENT",(WF_Logic getVariable "WF_MYSQL_CLIENT") + [Format ["MYSQLDATA?WFBE_Update?%1?%2?%3?%4",getPlayerUID(player),name player,_mysqlUpdate,worldName]],true]; + }; +}; + +if (!isNull commanderTeam && sideID == _sideValue) then { + if (commanderTeam == Group player) then { + _bounty = (_location getVariable "startingSupplyValue") * ('WFBE_COMMANDERTOWNCAPTURECOEF' Call GetNamespace); + _bounty Call ChangePlayerFunds; + WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERTOWNCAPTURESCORE' Call GetNamespace)]]; + publicVariable 'WFBE_RequestChangeScore'; + if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + ('WFBE_COMMANDERTOWNCAPTURESCORE' Call GetNamespace)]] Spawn HandleSPVF}; + Format[Localize "STR_WF_CHAT_Commander_Bounty_Town",_bounty,_locationName] Call CommandChatMessage; + }; +}; + +/* Task Handling */ +["TownUpdate",_location] Spawn TaskSystem; +if (sideID == _sideValue) then { + if !(isNull _task) then { + if (_ptask == _task) then { + ["TownAssignClosest"] Spawn TaskSystem; + }; + }; +}; \ No newline at end of file diff --git a/Client/PVFunctions/UAV_Reveal.sqf b/Client/PVFunctions/UAV_Reveal.sqf new file mode 100644 index 0000000..c2b1857 --- /dev/null +++ b/Client/PVFunctions/UAV_Reveal.sqf @@ -0,0 +1,27 @@ +/* + Author: Benny + Name: UAV_Reveal.sqf + Parameters: + 0 - UAV + 1 - Target + Description: + This file handle the client's UAV broadcast, a client send info to the others. +*/ + +Private ['_marker','_size','_target','_uav']; +_uav = _this select 0; +_target = _this select 1; + +if (typeName _uav != 'OBJECT' || typeName _target != 'OBJECT') exitWith {diag_log Format ["[WFBE (INFORMATION)][frameno:%3 | ticktime:%4] UAV_Reveal: An object is expected for both parameters given (UAV: %1 Target: %2).",_uav,_target,diag_frameno,diag_tickTime]}; + +_size = round((_uav distance _target) / 16); +_marker = Format["WFBE_UAV_SPOTTED_%1",unitMarker]; +unitMarker = unitMarker + 1; +createMarkerLocal [_marker,[(getPos _target select 0) - random(_size) + random(_size),(getPos _target select 1) - random(_size) + random(_size),0]]; +_marker setMarkerShapeLocal "Ellipse"; +_marker setMarkerColorLocal "ColorOrange"; +_marker setMarkerSizeLocal [_size,_size]; + +sleep (('WFBE_UAVSPOTTINGDELAY' Call GetNamespace)*3); + +deleteMarkerLocal _marker; \ No newline at end of file diff --git a/Client/PVFunctions/VoteForCommander.sqf b/Client/PVFunctions/VoteForCommander.sqf new file mode 100644 index 0000000..7bbb18e --- /dev/null +++ b/Client/PVFunctions/VoteForCommander.sqf @@ -0,0 +1,9 @@ + +private ["_voteTime"]; +if (votePopUp) then { + Private ["_voteTime"]; + _voteTime = 0; + waitUntil {_voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];!isNil "_voteTime"}; + if (_voteTime > 0 && !voted) then {CreateDialog "RscMenu_Voting"}; + if (voted) then {voted = false}; +}; \ No newline at end of file diff --git a/Client/kb/hq.bikb b/Client/kb/hq.bikb new file mode 100644 index 0000000..221bba8 --- /dev/null +++ b/Client/kb/hq.bikb @@ -0,0 +1,190 @@ +#define SENTENCE(NAME) \ + class NAME \ + { \ + text = $STR##NAME##; \ + speech[] = {%1,##NAME##,%2}; \ + class Arguments {class 1 {type = "simple";};class 2 {type = "simple";};}; \ + }; + +#define SENTENCE1(NAME) \ +class NAME \ +{ \ + text = $STR##NAME##; \ + speech[] = {##NAME##,%1,%2}; \ + class Arguments {class 1 {type = "simple";};class 2 {type = "simple";};}; \ +}; + + +#define SENTENCE_KEY(NAME,KEY) \ + class NAME \ + { \ + text = $##KEY##; \ + speech[] = {%1, ##NAME##, %2}; \ + class Arguments {class 1 {type = "simple";};class 2 {type = "simple";};}; \ + }; + + +class Sentences +{ + + class Test {text = "Test"; speech[] = {lopotev_present_in_hideout_1_R_1}; class Arguments {};}; + + + + class HQ {text = $STR_DN_WARFARE_HQ_BASE_UNFOLDED; speech[] = {HQ}; class Arguments {};}; + /* + + class 20MinutesLeft {text = "$20MinutesLeft"; speech[] = {20MinutesLeft}; class Arguments {};}; + class 5MinutesLeft {text = "$5MinutesLeft"; speech[] = {5MinutesLeft}; class Arguments {};}; + + + class Captured + { + text = $STRwftowncaptured; + speech[] = {%1, Captured}; + class Arguments {class 1 {type = "simple";};}; + }; + + */ + class CapturedNear + { + text = "%1 captured near %2"; + speech[] = {%1, CapturedNear, %2}; + class Arguments + { + class 1 {type = "simple";}; + class 2 {type = "simple";}; + }; + }; + class LostAt + { + text = "%1 lost at %2"; + speech[] = {%1, LostAt, %2}; + class Arguments {class 1 {type = "simple";};class 2 {type = "simple";};}; + }; + class OrderSent + { + text = "%1 %2, %3"; + speech[] = {%1 ,%2 ,%3}; + class Arguments { + class 1 {type = "simple";}; + class 2 {type = "simple";}; + class 3 {type = "simple";}; + class 4 {type = "simple";}; + }; + }; + class OrderSentAll + { + text = "%1, %2, %3"; + speech[] = {%1 ,%2 ,%3}; + class Arguments { + class 1 {type = "simple";}; + class 2 {type = "simple";}; + class 3 {type = "simple";}; + }; + }; + class OrderDone + { + text = "%1, %2 %3 %4"; + speech[] = {%1 ,%2 ,%3 ,%4}; + class Arguments { + class 1 {type = "simple";}; + class 2 {type = "simple";}; + class 3 {type = "simple";}; + }; + }; + class simple + { + text = "%1"; + speech[] = {%1}; + class Arguments { + class 1 {type = "simple";}; + }; + }; + class ExtractionTeam + { + text = "This is HQ, %1 is on the way, out."; + speech[] = {ThisIs, HQ, %1, Is, OnTheWay, Out}; + class Arguments { + class 1 {type = "simple";}; + }; + }; + class ExtractionTeamCancel + { + text = "This is HQ, Abort the op, %1 is in danger, out."; + speech[] = {ThisIs, HQ, aborttheop, %1, Is, In, DangerE, Out}; + class Arguments { + class 1 {type = "simple";}; + }; + }; + class MMissionFailed + { + text = "This is HQ, Mission Failure, carry on with your prior tasks, over."; + speech[] = {ThisIs, HQ, MissionFailure, CarryOnWithYourPriorTasksOver}; + class Arguments {}; + }; + class MMissionComplete + { + text = "This is HQ, %1"; + speech[] = {ThisIs, HQ, %1}; + class Arguments { + class 1 {type = "simple";}; + }; + }; + + SENTENCE(10MinutesLeft) + SENTENCE(20MinutesLeft) + SENTENCE(5MinutesLeft) + SENTENCE(Accomplished) + + SENTENCE_KEY(BaseUnderAtack,STRwfbaseunderattack) + SENTENCE(Cancelled) + SENTENCE(CanDoWereOnIt) + SENTENCE(Captured) + SENTENCE_KEY(HC_OrderReceived,"Order Received") + SENTENCE1(CiviliansUnderEnemyFireIn) + SENTENCE_KEY(Constructed,STRwfstructureconstructed) + SENTENCE(Deployed) + SENTENCE_KEY(Destroyed,STRwfbasestructuredestroyed) + SENTENCE(EnemyBaseLocated) + SENTENCE(EnemyForcesDetected) + SENTENCE(Failed) + SENTENCE1(HostilesDetectedNear) + SENTENCE1(Insufficient) + SENTENCE_KEY(IsUnderAttack,STRwftownunderattack) + + SENTENCE(Lost) + + SENTENCE(Mobilized) + SENTENCE(NegativeWeCannotDivert) + SENTENCE(NewIntelAvailable) + SENTENCE(NewMissionAvailable) + SENTENCE(NewSupportAvailable) + + SENTENCE_KEY(UnderAttack,STRisunderattack) + SENTENCE_KEY(VotingForNewCommander,STRwfvoteforcommanderinprogress) + + + //((( TESTING SENTENCES ONLY (normally used ONLY as parameters to other sentences) + SENTENCE(AntiAirRadar) + SENTENCE(ArtilleryBattery) + SENTENCE(ArtilleryRadar) + SENTENCE_KEY(Barracks,STRwfbarracks) + SENTENCE(Funds) + SENTENCE(Headquarters) + SENTENCE(HeavyVehicleSupply) + SENTENCE(Helipad) + SENTENCE(LightVehicleSupply) + SENTENCE(Mission) + SENTENCE(Resources) + SENTENCE(ServicePoint) + SENTENCE(Strongpoint) + //SENTENCE(Strongpoint_alt) + SENTENCE(Supplies) + SENTENCE(UAVTerminal) + //))) END of testing sentences +}; +class Arguments{}; +class Special{}; +startWithVocal[] = {hour}; +startWithConsonant[] = {europe, university}; \ No newline at end of file diff --git a/Client/kb/hq.fsm b/Client/kb/hq.fsm new file mode 100644 index 0000000..6e3c116 --- /dev/null +++ b/Client/kb/hq.fsm @@ -0,0 +1,110 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"React",0,250,-675.000000,-1800.000000,-575.000000,-1750.000000,0.000000,"React"}; +item1[] = {"",7,210,-625.645081,-1628.257446,-617.645203,-1620.257446,0.000000,""}; +item2[] = {"__",8,218,-775.000000,-1650.000000,-675.000000,-1600.000000,0.000000,"-"}; +item3[] = {"END",1,250,-775.000000,-1575.000000,-675.000000,-1525.000000,0.000000,"END"}; +item4[] = {"Come_on__come",4,218,-525.000000,-1525.000000,-225.000000,-1475.000000,1.000000,"Come on, come"}; +item5[] = {"___Nervous_anim",1,250,-175.000000,-1500.000000,125.000000,-1450.000000,0.000000,"< Nervous anim >" \n "No more!"}; +item6[] = {"___Interrupted_",4,218,-525.000000,-1650.000000,-225.000000,-1600.000000,1.000000,"< Interrupted >"}; +item7[] = {"Come_on__come",1,250,-175.000000,-1625.000000,125.000000,-1575.000000,0.000000,"Come on, come"}; +link0[] = {0,1}; +link1[] = {1,2}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {2,3}; +link5[] = {4,5}; +link6[] = {6,7}; +globals[] = {25.000000,1,0,1,16777215,640,480,2,361,6316128,1,-785.646118,299.399323,-517.653870,-1918.175049,681,879,1}; +window[] = {2,-1,-1,-1,-1,790,54,1076,54,3,701}; +*//*%FSM*/ +class FSM +{ + fsmName = "WF_HQ"; + class States + { + /*%FSM*/ + class React + { + name = "React"; + init = /*%FSM*/"if (isNil ""BIS_DEBUG_DIALOG"") then {} else" \n "{" \n " debugLog format[""DIALOG- FSM of %1 initiated by %2 sentenceId %3 sentence %4"",_this,_from, _sentenceId, localize (""STR_""+""_sentenceId"")];" \n "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Come_on__come + { + priority = 1.000000; + to="___Nervous_anim"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(_sentenceId in [""Cooper_ComeOnWithMe""]);"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class ___Interrupted_ + { + priority = 1.000000; + to="Come_on__come"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(_sentenceId in [""Interrupted""]);"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class __ + { + priority = 0.000000; + to="END"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class END + { + name = "END"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class ___Nervous_anim + { + name = "___Nervous_anim"; + init = /*%FSM*/"_this doWatch _from;" \n "DEBUGLOG ""CooperGalkinaScene.fsm: START-----------------------------------"";" \n "" \n "DEBUGLOG ""Galkina is NERVOUS and ESCAPING"";" \n "_t = time;" \n "[] spawn" \n "{" \n " _nic = [objNull, BIS_civWoman, rPLAYMOVENOW, ""Cwmn_GalkinaLiesNervousThenRun""] call RE;" \n " DEBUGLOG ""sceneGalkina.sqf: Animation: Cwmn_GalkinaLiesNervousThenRun"";" \n " _BIS_civWomanDone = BIS_civWoman addEventHandler [""AnimDone"", " \n " { " \n " //DEBUGLOG format[""%1 animdone: %2"", _this select 0, _this select 1];" \n " " \n " //BIS_civWoman enableAI ""ANIM"";" \n " //BIS_civWoman setSpeedMode ""FULL"";" \n " " \n " _nic = [objNull, BIS_civWoman, rPLAYMOVENOW, ""AmovPercMrunSnonWnonDf""] call RE;" \n " _womanDir = (getDir BIS_civWoman) - 180;" \n " BIS_civWoman setdir _womanDir;" \n " _GalkinaEscapePoints = [""BIS_civWomanPositionEnd2a"", ""BIS_civWomanPositionEnd2b"", ""BIS_civWomanPositionEnd2c""];" \n " _GalkinaSelectedPoint = _GalkinaEscapePoints select floor(random (count _GalkinaEscapePoints)); " \n " DEBUGLOG format[""grpCIVWoman.fsm: Galkina ESCAPING on random point: %1"",_GalkinaSelectedPoint];" \n " " \n " //CREATE END TRIGGER " \n " _trgGalkinaEnd2=createTrigger[""EmptyDetector"",getMarkerPos _GalkinaSelectedPoint];" \n " _trgGalkinaEnd2 setTriggerArea[5,5,0,false];" \n " _trgGalkinaEnd2 setTriggerActivation[""MEMBER"",""PRESENT"",true];" \n " _trgGalkinaEnd2 triggerAttachVehicle [BIS_civWoman];" \n " _trgGalkinaEnd2 setTriggerStatements" \n " [" \n " ""this"", " \n " ""DEBUGLOG """"grpCIVWoman.fsm: Galkina reached her end position"""";BIS_civWoman setUnitPos """"DOWN""""; ""," \n " """"" \n " ]; " \n " " \n " BIS_civWoman doMove getMarkerPos _GalkinaSelectedPoint;" \n " BIS_civWoman forceSpeed 15;" \n " BIS_civWoman removeEventHandler [""animDone"", 0];" \n " }" \n " ];" \n " sleep 7;" \n " _nic = [objNull, BIS_civWoman , rKBTELL, BIS_cooper, ""CooperGalkinaScene"", ""Galkina_NoNoMore""] call RE;" \n "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Come_on__come + { + name = "Come_on__come"; + init = /*%FSM*/"_nic = [objNull, _from , rKBTELL, _this, _topic, ""Cooper_ComeOnWithMe""] call RE;" \n "" \n "_this doWatch _from;" \n "DEBUGLOG ""CooperGalkinaScene.fsm: START-----------------------------------"";"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="React"; + finalStates[] = + { + "END", + "___Nervous_anim", + "Come_on__come" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/kb/hq.sqf b/Client/kb/hq.sqf new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/Client/kb/hq.sqf @@ -0,0 +1 @@ + -- cgit v1.3.1