Private Sub BTN_Start_Click()
Dim SX As Double, SY As Double, SZ As Double, TX As Double, TY As Double, TZ As Double, ZX As Double, ZY As Double, ZZ As Double, SID As Long, TID As Long, ZID As Long, z As Long, Dist1 As Double, Dist2 As Double
If Me.BTN_Start_Label.Caption = "START TRADE ROUTE" Then
If Saving = False And Panel_Scout_BD.Visible = True Then
TR_ID = Worksheets("Data").Cells(115, 2).Value
If POS_StationID = Worksheets("TR_Route").Cells(TR_ID + 1, 1).Value Then
TLocked = True
TLocked_Star1 = Worksheets("Data").Cells(118, 2).Value
TLocked_Station1 = Worksheets("Data").Cells(116, 2).Value
TGood1 = Worksheets("Data").Cells(124, 2).Value
TGood1ID = Worksheets("Data").Cells(126, 2).Value
TLocked_Star2 = Worksheets("Data").Cells(121, 2).Value
TLocked_Station2 = Worksheets("Data").Cells(119, 2).Value
TGood2 = Worksheets("Data").Cells(125, 2).Value
TGood2ID = Worksheets("Data").Cells(127, 2).Value
TGood1B = ArData_Buy(TGood1ID + 2, TLocked_Station1 + 2)
TGood1S = ArData_Sell(TGood1ID + 2, TLocked_Station2 + 2)
TGood2B = ArData_Buy(TGood2ID + 2, TLocked_Station2 + 2)
TGood2S = ArData_Sell(TGood2ID + 2, TLocked_Station1 + 2)
If Menu_Mode = "CLASSIC" Then
If Main_Panel = "TOP" Then
Panel_Menu_top.TLocked_line1.Visible = True
Panel_Menu_top.TLocked_line2.Visible = True
Panel_Menu_top.BTN_Locked.Visible = True
Panel_Menu_top.POS_Eco.Caption = TGood1
Panel_Menu_top.POS_Good_Buy.Caption = "BUY: " & TGood1B & " CR."
Panel_Menu_top.POS_Good_Sell.Caption = "SELL: " & TGood1S & " CR."
Panel_Menu_top.DES_Eco.Caption = TGood2
Panel_Menu_top.DES_Good_Buy.Caption = "BUY: " & TGood2B & " CR."
Panel_Menu_top.DES_Good_Sell.Caption = "SELL: " & TGood2S & " CR."
Else
Panel_Menu_bottom.TLocked_line1.Visible = True
Panel_Menu_bottom.TLocked_line2.Visible = True
Panel_Menu_bottom.BTN_Locked.Visible = True
Panel_Menu_bottom.POS_Eco.Caption = TGood1
Panel_Menu_bottom.POS_Good_Buy.Caption = "BUY: " & TGood1B & " CR."
Panel_Menu_bottom.POS_Good_Sell.Caption = "SELL: " & TGood1S & " CR."
Panel_Menu_bottom.DES_Eco.Caption = TGood2
Panel_Menu_bottom.DES_Good_Buy.Caption = "BUY: " & TGood2B & " CR."
Panel_Menu_bottom.DES_Good_Sell.Caption = "SELL: " & TGood2S & " CR."
End If
Else
Panel_Displays.TLocked_line.Visible = True
Panel_Displays.BTN_Locked.Visible = True
Panel_Displays.POS_Eco.Caption = TGood1
Panel_Displays.POS_Good_Buy.Caption = "BUY: " & TGood1B & " CR."
Panel_Displays.POS_Good_Sell.Caption = "SELL: " & TGood1S & " CR."
Panel_Displays.DES_Eco.Caption = TGood2
Panel_Displays.DES_Good_Buy.Caption = "BUY: " & TGood2B & " CR."
Panel_Displays.DES_Good_Sell.Caption = "SELL: " & TGood2S & " CR."
End If
NoTarget = False
DES_Selected = True
DES_StarID = TLocked_Star2
DES_StationID = TLocked_Station2
Worksheets("Werte").Cells(12, 2).Value = TLocked_Star2
Worksheets("Werte").Cells(13, 2).Value = TLocked_Station2
Me.BTN_Start_Label.Caption = "STOP TRADE ROUTE"
DoEvents
End If
If POS_StationID = Worksheets("TR_Route").Cells(TR_ID + 1, 3).Value And TLocked = False Then
TLocked = True
TLocked_Star1 = Worksheets("Data").Cells(121, 2).Value
TLocked_Station1 = Worksheets("Data").Cells(119, 2).Value
TGood1 = Worksheets("Data").Cells(125, 2).Value
TGood1ID = Worksheets("Data").Cells(127, 2).Value
TLocked_Star2 = Worksheets("Data").Cells(118, 2).Value
TLocked_Station2 = Worksheets("Data").Cells(116, 2).Value
TGood2 = Worksheets("Data").Cells(124, 2).Value
TGood2ID = Worksheets("Data").Cells(126, 2).Value
TGood1B = ArData_Buy(TGood1ID + 2, TLocked_Station1 + 2)
TGood1S = ArData_Sell(TGood1ID + 2, TLocked_Station2 + 2)
TGood2B = ArData_Buy(TGood2ID + 2, TLocked_Station2 + 2)
TGood2S = ArData_Sell(TGood2ID + 2, TLocked_Station1 + 2)
If Menu_Mode = "CLASSIC" Then
If Main_Panel = "TOP" Then
Panel_Menu_top.TLocked_line1.Visible = True
Panel_Menu_top.TLocked_line2.Visible = True
Panel_Menu_top.BTN_Locked.Visible = True
Panel_Menu_top.POS_Eco.Caption = TGood1
Panel_Menu_top.POS_Good_Buy.Caption = "BUY: " & TGood1B & " CR."
Panel_Menu_top.POS_Good_Sell.Caption = "SELL: " & TGood1S & " CR."
Panel_Menu_top.DES_Eco.Caption = TGood2
Panel_Menu_top.DES_Good_Buy.Caption = "BUY: " & TGood2B & " CR."
Panel_Menu_top.DES_Good_Sell.Caption = "SELL: " & TGood2S & " CR."
Else
Panel_Menu_bottom.TLocked_line1.Visible = True
Panel_Menu_bottom.TLocked_line2.Visible = True
Panel_Menu_bottom.BTN_Locked.Visible = True
Panel_Menu_bottom.POS_Eco.Caption = TGood1
Panel_Menu_bottom.POS_Good_Buy.Caption = "BUY: " & TGood1B & " CR."
Panel_Menu_bottom.POS_Good_Sell.Caption = "SELL: " & TGood1S & " CR."
Panel_Menu_bottom.DES_Eco.Caption = TGood2
Panel_Menu_bottom.DES_Good_Buy.Caption = "BUY: " & TGood2B & " CR."
Panel_Menu_bottom.DES_Good_Sell.Caption = "SELL: " & TGood2S & " CR."
End If
Else
Panel_Displays.TLocked_line.Visible = True
Panel_Displays.BTN_Locked.Visible = True
Panel_Displays.POS_Eco.Caption = TGood1
Panel_Displays.POS_Good_Buy.Caption = "BUY: " & TGood1B & " CR."
Panel_Displays.POS_Good_Sell.Caption = "SELL: " & TGood1S & " CR."
Panel_Displays.DES_Eco.Caption = TGood2
Panel_Displays.DES_Good_Buy.Caption = "BUY: " & TGood2B & " CR."
Panel_Displays.DES_Good_Sell.Caption = "SELL: " & TGood2S & " CR."
End If
NoTarget = False
DES_Selected = True
DES_StarID = TLocked_Star2
DES_StationID = TLocked_Station2
Worksheets("Werte").Cells(12, 2).Value = TLocked_Star2
Worksheets("Werte").Cells(13, 2).Value = TLocked_Station2
Me.BTN_Start_Label.Caption = "STOP TRADE ROUTE"
DoEvents
End If
If TLocked = False Then
SID = Worksheets("Data").Cells(118, 2).Value
TID = ActualStarID
ZID = Worksheets("Data").Cells(121, 2).Value
SX = Ar_DBStars(SID, 3)
SY = Ar_DBStars(SID, 4)
SZ = Ar_DBStars(SID, 5)
TX = Ar_DBStars(TID, 3)
TY = Ar_DBStars(TID, 4)
TZ = Ar_DBStars(TID, 5)
ZX = Ar_DBStars(ZID, 3)
ZY = Ar_DBStars(ZID, 4)
ZZ = Ar_DBStars(ZID, 5)
Dist1 = Round(Sqr(WorksheetFunction.Power((SX - TX), 2) + WorksheetFunction.Power((SY - TY), 2) + WorksheetFunction.Power((SZ - TZ), 2)) + 0.000001, 2)
Dist2 = Round(Sqr(WorksheetFunction.Power((TX - ZX), 2) + WorksheetFunction.Power((TY - ZY), 2) + WorksheetFunction.Power((TZ - ZZ), 2)) + 0.000001, 2)
If Dist1 < Dist2 Then
TLocked_Star1 = Worksheets("Data").Cells(118, 2).Value
TLocked_Station1 = Worksheets("Data").Cells(116, 2).Value
TGood1 = Worksheets("Data").Cells(124, 2).Value
TGood1ID = Worksheets("Data").Cells(126, 2).Value
TLocked_Star2 = Worksheets("Data").Cells(121, 2).Value
TLocked_Station2 = Worksheets("Data").Cells(119, 2).Value
TGood2 = Worksheets("Data").Cells(125, 2).Value
TGood2ID = Worksheets("Data").Cells(127, 2).Value
TGood1B = ArData_Buy(TGood1ID + 2, TLocked_Station1 + 2)
TGood1S = ArData_Sell(TGood1ID + 2, TLocked_Station2 + 2)
TGood2B = ArData_Buy(TGood2ID + 2, TLocked_Station2 + 2)
TGood2S = ArData_Sell(TGood2ID + 2, TLocked_Station1 + 2)
Else
TLocked_Star1 = Worksheets("Data").Cells(121, 2).Value
TLocked_Station1 = Worksheets("Data").Cells(119, 2).Value
TGood1 = Worksheets("Data").Cells(125, 2).Value
TGood1ID = Worksheets("Data").Cells(127, 2).Value
TLocked_Star2 = Worksheets("Data").Cells(118, 2).Value
TLocked_Station2 = Worksheets("Data").Cells(116, 2).Value
TGood2 = Worksheets("Data").Cells(124, 2).Value
TGood2ID = Worksheets("Data").Cells(126, 2).Value
TGood1B = ArData_Buy(TGood1ID + 2, TLocked_Station1 + 2)
TGood1S = ArData_Sell(TGood1ID + 2, TLocked_Station2 + 2)
TGood2B = ArData_Buy(TGood2ID + 2, TLocked_Station2 + 2)
TGood2S = ArData_Sell(TGood2ID + 2, TLocked_Station1 + 2)
End If
NoTarget = False
DES_Selected = True
DES_StarID = TLocked_Star1
DES_StationID = TLocked_Station1
Worksheets("Werte").Cells(12, 2).Value = TLocked_Star1
Worksheets("Werte").Cells(13, 2).Value = TLocked_Station1
Me.BTN_Start_Label.Caption = "STOP TRADE ROUTE"
DoEvents
End If
Call DES_Commodities
Call Panel_Trade.DES_Display
Panel_Trade.CB_Route.ListIndex = Worksheets("Werte").Cells(53, 5).Value - 1
Call Destination_Panel
If Menu_Mode = "CLASSIC" Then
If Main_Panel = "TOP" Then
Panel_Menu_top.BTN_Trade_Layer.BackColor = TCE_Color
Panel_Menu_top.BTN_Trade_Label.ForeColor = 0
Panel_Menu_top.BTN_TradeScout_Layer.BackColor = 0
Panel_Menu_top.BTN_TradeScout.ForeColor = &HFFFFFF
Else
Panel_Menu_bottom.BTN_Trade_Layer.BackColor = TCE_Color
Panel_Menu_bottom.BTN_Trade_Label.ForeColor = 0
Panel_Menu_bottom.BTN_TradeScout_Layer.BackColor = 0
Panel_Menu_bottom.BTN_TradeScout.ForeColor = &HFFFFFF
End If
Else
Panel_Picto.BTN_Scout.BorderStyle = fmBorderStyleNone
Panel_Picto.BTN_Trade.BorderStyle = fmBorderStyleSingle
End If
Panel_Trade.DES_Label.Caption = "SELECTED DESTINATION"
Call Selected_Row(Worksheets("Data").Cells(115, 2).Value - Me.TR_Scrollbar.Value)
Me.TR_Scrollbar.Enabled = False
Panel_Trade.Show
DoEvents
Me.Hide
End If
Else
TLocked = False
TLocked_Star1 = 0
TLocked_Star2 = 0
TLocked_Station1 = 0
TLocked_Station2 = 0
TGood1 = ""
TGood2 = ""
TGood1ID = 0
TGood2ID = 0
TGood1B = 0
TGood1S = 0
DES_StarID = 0
DES_StationID = 0
DES_Selected = False
NoTarget = True
Me.BTN_Start_Label.Caption = "START TRADE ROUTE"
Call Selected_Row(0)
If Menu_Mode = "CLASSIC" Then
If Main_Panel = "TOP" Then
Panel_Menu_top.TLocked_line1.Visible = False
Panel_Menu_top.TLocked_line2.Visible = False
Panel_Menu_top.BTN_Locked.Visible = False
Panel_Menu_top.POS_Good_Buy.Caption = ""
Panel_Menu_top.POS_Good_Sell.Caption = ""
Panel_Menu_top.DES_Good_Buy.Caption = ""
Panel_Menu_top.DES_Good_Sell.Caption = ""
Else
Panel_Menu_bottom.TLocked_line1.Visible = False
Panel_Menu_bottom.TLocked_line2.Visible = False
Panel_Menu_bottom.BTN_Locked.Visible = False
Panel_Menu_bottom.POS_Good_Buy.Caption = ""
Panel_Menu_bottom.POS_Good_Sell.Caption = ""
Panel_Menu_bottom.DES_Good_Buy.Caption = ""
Panel_Menu_bottom.DES_Good_Sell.Caption = ""
End If
Else
Panel_Displays.TLocked_line.Visible = False
Panel_Displays.BTN_Locked.Visible = False
Panel_Displays.POS_Good_Buy.Caption = ""
Panel_Displays.POS_Good_Sell.Caption = ""
Panel_Displays.DES_Good_Buy.Caption = ""
Panel_Displays.DES_Good_Sell.Caption = ""
End If
Me.TR_Scrollbar.Enabled = True
Call Position_Panel
DES_Selected = False
NoTarget = True
If Auto_DES = True Then
Call Auto_Destination
Call DES_Commodities
Call Check_Size_DES
Call Panel_Trade.DES_Display
End If
Call Destination_Panel
End If
End Sub