_f18 = _this select 0

?!(local _f18): exit

fzloaddialog = 1

_ok = createDialog "fz_f18e_loadout"
ctrlSetText [101, "\fz_f18\gui\f18f_loadout.jpg"]
;;hardpoint
_empt102 = lbAdd [102, "EMPTY"]
lbSetData [102, _empt102, "EMPTY"]
_4x120102 = lbAdd [102, "4xAIM-120C"]
lbSetData [102, _4x120102, "4xAIM-120C"]
_4x82102 = lbAdd [102, "4xMk82"]
lbSetData [102, _4x82102, "4xMk82"]
_4x83102 = lbAdd [102, "4xMk83"]
lbSetData [102, _4x83102, "4xMk83"]
_4x20102 = lbAdd [102, "4xMk20"]
lbSetData [102, _4x20102, "4xMk20"]
_2x84102 = lbAdd [102, "2xMk84"]
lbSetData [102, _2x84102, "2xMk84"]
_2xgbu10102 = lbAdd [102, "2xGBU-10"]
lbSetData [102, _2xgbu10102, "2xGBU-10"]
_2xagm65102 = lbAdd [102, "2xAGM-65E"]
lbSetData [102, _2xagm65102, "2xAGM-65E"]
_2x88102 = lbAdd [102, "2xAGM-88"]
lbSetData [102, _2x88102, "2xAGM-88"]
_4x330102 = lbAdd [102, "2x330GAL"]
lbSetData [102, _4x330102, "2x330GAL"]
_2xjsow102 = lbAdd [102, "2xAGM-154A"]
lbSetData [102, _2xjsow102, "2xAGM-154A"]
_4xcbu78102 = lbAdd [102, "4xCBU-78"]
lbSetData [102, _4xcbu78102, "4xCBU-78"]
_index = lbAdd [102, "4xGBU-12"]
lbSetData [102, _index, "4xGBU-12"]
_index = lbAdd [102, "4xGBU-16"]
lbSetData [102, _index, "4xGBU-16"]
;;hardpoint
_index = lbAdd [103, "EMPTY"]
lbSetData [103, _index, "EMPTY"]
_index = lbAdd [103, "4xAIM-120C"]
lbSetData [103, _index, "4xAIM-120C"]
_index = lbAdd [103, "2xAIM-7M"]
lbSetData [103, _index, "2xAIM-7M"]
_index = lbAdd [103, "4xMk82"]
lbSetData [103, _index, "4xMk82"]
_index = lbAdd [103, "4xMk83"]
lbSetData [103, _index, "4xMk83"]
_index = lbAdd [103, "4xMk20"]
lbSetData [103, _index, "4xMk20"]
_index = lbAdd [103, "2xMk84"]
lbSetData [103, _index, "2xMk84"]
_index = lbAdd [103, "2xGBU-10"]
lbSetData [103, _index, "2xGBU-10"]
_index = lbAdd [103, "2xAGM-65E"]
lbSetData [103, _index, "2xAGM-65E"]
_index = lbAdd [103, "2xAGM-88"]
lbSetData [103, _index, "2xAGM-88"]
_index = lbAdd [103, "2xAGM-154A"]
lbSetData [103, _index, "2xAGM-154A"]
_index = lbAdd [103, "4xCBU-78"]
lbSetData [103, _index, "4xCBU-78"]
_index = lbAdd [103, "2x330GAL"]
lbSetData [103, _index, "2x330GAL"]
_index = lbAdd [103, "4xGBU-12"]
lbSetData [103, _index, "4xGBU-12"]
_index = lbAdd [103, "4xGBU-16"]
lbSetData [103, _index, "4xGBU-16"]
;;hardpoint
_index = lbAdd [104, "EMPTY"]
lbSetData [104, _index, "EMPTY"]
_index = lbAdd [104, "2xMk82"]
lbSetData [104, _index, "2xMk82"]
_index = lbAdd [104, "2xMk20"]
lbSetData [104, _index, "2xMk20"]
_index = lbAdd [104, "2xMk83"]
lbSetData [104, _index, "2xMk83"]
_index = lbAdd [104, "2xAGM-65E"]
lbSetData [104, _index, "2xAGM-65E"]
_index = lbAdd [104, "2xAGM-88"]
lbSetData [104, _index, "2xAGM-88"]
_index = lbAdd [104, "2xCBU-78"]
lbSetData [104, _index, "2xCBU-78"]
_index = lbAdd [104, "2xGBU-12"]
lbSetData [104, _index, "2xGBU-12"]
_index = lbAdd [104, "2xGBU-16"]
lbSetData [104, _index, "2xGBU-16"]
;;hardpoint
_index = lbAdd [105, "EMPTY"]
lbSetData [105, _index, "EMPTY"]
_index = lbAdd [105, "2xAIM-9X"]
lbSetData [105, _index, "2xAIM-9X"]
_index = lbAdd [105, "2xAIM-9M"]
lbSetData [105, _index, "2xAIM-9M"]
;;hardpoint
_index = lbAdd [106, "EMPTY"]
lbSetData [106, _index, "EMPTY"]
_index = lbAdd [106, "1x330GAL"]
lbSetData [106, _index, "1x330GAL"]
_index = lbAdd [106, "1xD-704"]
lbSetData [106, _index, "1xD-704"]
;;hardpoint
_index = lbAdd [107, "EMPTY"]
lbSetData [107, _index, "EMPTY"]
_index = lbAdd [107, "1xAIM-120C"]
lbSetData [107, _index, "1xAIM-120C"]
_index = lbAdd [107, "1xAIM-7M"]
lbSetData [107, _index, "1xAIM-7M"]
;;hardpoint
_index1108 = lbAdd [108, "EMPTY"]
lbSetData [108, _index1108, "EMPTY"]
_index2108 = lbAdd [108, "1xAIM-120C"]
lbSetData [108, _index2108, "1xAIM-120C"]
_index3108 = lbAdd [108, "1xAIM-7M"]
lbSetData [108, _index3108, "1xAIM-7M"]
_index4108 = lbAdd [108, "1xATFLIR"]
lbSetData [108, _index4108, "1xATFLIR"]
;;end
lbSetCurSel [102, 0]
lbSetCurSel [103, 0]
lbSetCurSel [104, 0]
lbSetCurSel [105, 0]
lbSetCurSel [106, 0]
lbSetCurSel [107, 0]
lbSetCurSel [108, 0]

#loop
?(fzloaddialog == 0): exit
~0.001
_cntxt = format ["%1",_f18 ammo "fz_f18_m61"]
_cntxt = _cntxt + " ROUNDS"
ctrlSetText [120, _cntxt]
_fltxt = (fuel vehicle _f18) * 100
_fltxt = format ["%1",_fltxt]
_fltxt = _fltxt + "% INT FUEL"
ctrlSetText [121, _fltxt]
_dmtxt = (getdammage _f18) * 100
_dmtxt = format ["%1",_dmtxt]
_dmtxt = _dmtxt + "% DAMAGE"
ctrlSetText [122, _dmtxt]
_selectedcntr = lbCurSel 106
_selectedwing1 = lbCurSel 102
_selectedwing2 = lbCurSel 103
_selectedwing3 = lbCurSel 104
_selectedfuse1 = lbCurSel 108
_selectedfuse2 = lbCurSel 107
_selectedwingtip = lbCurSel 105
hp1wep = _selectedwing1
hp2wep = _selectedwing2
hp3wep = _selectedwing3
rightfusewep = _selectedfuse2
leftfusewep = _selectedfuse1
?(hp1wep == 4 and hp2wep == 11): lbSetCurSel [102, 0]
?(hp1wep == 11 and hp2wep == 5): lbSetCurSel [103, 0]
?(_selectedcntr == 0): cntrtnk = 0
?(_selectedcntr == 1): cntrtnk = 1
?(_selectedwing1 == 9 and _selectedcntr != 2): cntrtnk = 3; lbSetCurSel [106, 1]
?(_selectedcntr == 0 and _selectedwing1 == 9): cntrtnk = 3; lbSetCurSel [106, 1]
?(_selectedwing1 != 9 and cntrtnk == 3 and _selectedcntr == 1): cntrtnk = 1
?(_selectedwing1 != 9 and cntrtnk == 3 and _selectedcntr == 0): cntrtnk = 0
?(_selectedcntr == 2): cntrtnk = 4; lbSetCurSel [102, 9]
?(_selectedcntr == 2 and _selectedwing1 == 9 and _selectedwing2 == 12): cntrtnk = 5
?(_selectedcntr == 1 and _selectedwing1 == 9 and _selectedwing2 == 12): cntrtnk = 6
?(_selectedcntr != 1 and _selectedwing1 != 9 and _selectedwing2 == 12): lbSetCurSel [102, 9]; lbSetCurSel [106, 1]
?(_selectedcntr == 0 and _selectedwing1 == 9 and _selectedwing2 == 12): lbSetCurSel [106, 1]
?(_selectedcntr == 1 and _selectedwing1 != 9 and _selectedwing2 == 12): lbSetCurSel [102, 9]
?(_selectedwing3 == 4 or _selectedwing3 == 7 or _selectedwing3 == 8): lbSetCurSel [108, 3]
?(_selectedwing2 == 7 or _selectedwing2 == 8 or _selectedwing2 == 13 or _selectedwing2 == 14): lbSetCurSel [108, 3]
?(_selectedwing1 == 6 or _selectedwing1 == 7 or _selectedwing1 == 12 or _selectedwing1 == 13): lbSetCurSel [108, 3]
?(_selectedwing1 == 12 and _selectedwing2 == 3): lbSetCurSel [103, 0]
?(_selectedwing1 == 2 and _selectedwing2 == 13): lbSetCurSel [102, 0]
?(_selectedwing1 == 13 and _selectedwing2 == 4): lbSetCurSel [103, 0]
?(_selectedwing1 == 3 and _selectedwing2 == 14): lbSetCurSel [102, 0]
?(_selectedfuse1 == 1): lbSetCurSel [107, 1]
?(_selectedfuse1 == 2): lbSetCurSel [107, 2]
?(_selectedwingtip == 0): wingtipwep = 0
?(_selectedwingtip == 1): wingtipwep = 1
?(_selectedwingtip == 2): wingtipwep = 2
goto "loop"