235 lines
		
	
	
		
			9.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			235 lines
		
	
	
		
			9.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
//---------------------------------------------------------------------------
 | 
						||
 | 
						||
#ifndef TmainH
 | 
						||
#define TmainH
 | 
						||
//---------------------------------------------------------------------------
 | 
						||
#include <Classes.hpp>
 | 
						||
#include <Controls.hpp>
 | 
						||
#include <StdCtrls.hpp>
 | 
						||
#include <Forms.hpp>
 | 
						||
#include <ComCtrls.hpp>
 | 
						||
#include <ExtCtrls.hpp>
 | 
						||
#include <Grids.hpp>
 | 
						||
#include <ImgList.hpp>
 | 
						||
#include <ToolWin.hpp>
 | 
						||
#include <Buttons.hpp>
 | 
						||
#include "estructurasDeControl.h"
 | 
						||
#include <Dialogs.hpp>
 | 
						||
#include <Menus.hpp>
 | 
						||
//---------------------------------------------------------------------------
 | 
						||
#define lastRequest_getServer 0
 | 
						||
#define lastRequest_login 1
 | 
						||
#define lastRequest_messages 2
 | 
						||
#define lastRequest_overview 3
 | 
						||
#define lastRequest_flotten1 4
 | 
						||
#define lastRequest_flotten2 5
 | 
						||
#define lastRequest_flotten3 6
 | 
						||
#define lastRequest_flottenversand 7
 | 
						||
#define lastRequest_galaxy   8
 | 
						||
#define lastRequest_galaxyProbe 9
 | 
						||
#define lastRequest_galaxyProbeError 10
 | 
						||
//---------------------------------------------------------------------------
 | 
						||
class Tmain : public TForm
 | 
						||
{
 | 
						||
__published:	// IDE-managed  Components
 | 
						||
        TRichEdit *statusBar;
 | 
						||
        TCoolBar *CoolBar1;
 | 
						||
        TToolBar *ToolBar1;
 | 
						||
        TToolButton *ToolButton2;
 | 
						||
        TToolButton *ToolButton3;
 | 
						||
        TToolButton *ToolButton4;
 | 
						||
        TImageList *imgToolbar1;
 | 
						||
        TToolButton *ToolButton5;
 | 
						||
        TPanel *panelSession;
 | 
						||
        TButton *btLogin;
 | 
						||
        TButton *btTest;
 | 
						||
        TButton *btDownloader;
 | 
						||
        TTimer *Timer1;
 | 
						||
        TLabel *nextUpdateCLOCK;
 | 
						||
        TSplitter *Splitter1;
 | 
						||
        TPageControl *PageControl1;
 | 
						||
        TTabSheet *TabSheet1;
 | 
						||
        TStringGrid *dgEventos;
 | 
						||
        TTabSheet *TabSheet2;
 | 
						||
        TPanel *Panel1;
 | 
						||
        TLabel *computaciones;
 | 
						||
        TLabel *Label1;
 | 
						||
        TCheckBox *activarColaAtaques;
 | 
						||
        TStringGrid *dgAtaques;
 | 
						||
        TPanel *Panel2;
 | 
						||
        TSpeedButton *btAutoReiniciarCola;
 | 
						||
        TSpeedButton *btEditarAtaqueOfensivo;
 | 
						||
        TSaveDialog *SaveDialog1;
 | 
						||
        TToolButton *ToolButton6;
 | 
						||
        TPopupMenu *sonidos;
 | 
						||
        TMenuItem *Sonidos1;
 | 
						||
        TMenuItem *sndCHK_ataque;
 | 
						||
        TMenuItem *sndCHK_sondeo;
 | 
						||
        TMenuItem *sndCHK_peligro;
 | 
						||
        TMenuItem *sndCHK_error;
 | 
						||
        TUpDown *setComputaciones;
 | 
						||
        TToolButton *ToolButton7;
 | 
						||
        TToolButton *ToolButton8;
 | 
						||
        TToolButton *ToolButton9;
 | 
						||
        TPopupMenu *alarmas;
 | 
						||
        TMenuItem *MenuItem1;
 | 
						||
        TMenuItem *chkSondeo5min;
 | 
						||
        TMenuItem *chkSondeo2min;
 | 
						||
        TMenuItem *chkAviso5min;
 | 
						||
        TMenuItem *MenuItem5;
 | 
						||
        TSpeedButton *SpeedButton1;
 | 
						||
        TMenuItem *sndCHK_network;
 | 
						||
        TTabSheet *TabSheet3;
 | 
						||
        TMemo *sondeoMasivo;
 | 
						||
        TPanel *Panel3;
 | 
						||
        TCheckBox *activarSondeo;
 | 
						||
        TComboBox *planetasOrigenSondeo;
 | 
						||
        TPanel *Panel4;
 | 
						||
        TEdit *PHPSESSID;
 | 
						||
        TLabel *Label2;
 | 
						||
        TEdit *session;
 | 
						||
        TLabel *Label3;
 | 
						||
        void __fastcall Button3Click(TObject *Sender);
 | 
						||
        void __fastcall ToolButton4Click(TObject *Sender);
 | 
						||
        void __fastcall btTestClick(TObject *Sender);
 | 
						||
        void __fastcall btDownloaderClick(TObject *Sender);
 | 
						||
        void __fastcall ToolButton2Click(TObject *Sender);
 | 
						||
        void __fastcall dgEventosDrawCell(TObject *Sender, int ACol,
 | 
						||
          int ARow, TRect &Rect, TGridDrawState State);
 | 
						||
        void __fastcall FormDestroy(TObject *Sender);
 | 
						||
        void __fastcall sessionKeyPress(TObject *Sender, char &Key);
 | 
						||
        void __fastcall ToolButton5Click(TObject *Sender);
 | 
						||
        void __fastcall cron(TObject *Sender);
 | 
						||
        void __fastcall btEditarAtaqueOfensivoClick(TObject *Sender);
 | 
						||
        void __fastcall dgAtaquesDrawCell(TObject *Sender, int ACol,
 | 
						||
          int ARow, TRect &Rect, TGridDrawState State);
 | 
						||
        void __fastcall btLoginClick(TObject *Sender);
 | 
						||
        void __fastcall setComputacionesClick(TObject *Sender, TUDBtnType Button);
 | 
						||
        void __fastcall ToolButton8Click(TObject *Sender);
 | 
						||
        void __fastcall ToolButton9Click(TObject *Sender);
 | 
						||
        void __fastcall SpeedButton1Click(TObject *Sender);
 | 
						||
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
 | 
						||
        void __fastcall PHPSESSIDKeyPress(TObject *Sender, char &Key);
 | 
						||
private:	// User declarations
 | 
						||
        /* Magnetic FORM */
 | 
						||
          HWND snapwin;
 | 
						||
          RECT work_area;
 | 
						||
          bool snapped;
 | 
						||
          bool winprocthing;
 | 
						||
          int thresh;
 | 
						||
          void __fastcall SettingChanged(TMessage &msg);
 | 
						||
          void __fastcall WMWindowPosChanging(TWMWindowPosChanging &msg);
 | 
						||
          void __fastcall UpdateWorkArea();
 | 
						||
        /*****************/
 | 
						||
 | 
						||
 | 
						||
        int currentState;
 | 
						||
        AnsiString oG_login,oG_password,oG_location,oG_lphu,oG_userAgent,oG_email;
 | 
						||
        AnsiString oG_host, oG_session, oG_SSID, oG_Cookie,oG_urlReadPass;
 | 
						||
        int oG_Universo, CFG_tiempoCritico, CFG_ocuparMaxComputaciones;
 | 
						||
        int computacionesOcupadas, numEventos;
 | 
						||
        bool CFG_verbose;
 | 
						||
        bool CFG_visionGeneralSoloLunas, CFG_ocultarActividadDespuesResetServer;
 | 
						||
 | 
						||
        int __fastcall cambioPassword(void);
 | 
						||
        int __fastcall recuperarPassword(void);
 | 
						||
 | 
						||
        void __fastcall runREADY(void);
 | 
						||
 | 
						||
 | 
						||
        void __fastcall oG_decode(AnsiString oG_lphu,AnsiString *oG_login,AnsiString *oG_password,AnsiString *oG_host,int *oG_Universo);
 | 
						||
        void __fastcall oG_encode(AnsiString *oG_lphu,AnsiString oG_login,AnsiString oG_password,AnsiString oG_host,int oG_Universo);
 | 
						||
 | 
						||
 | 
						||
        int __fastcall getGameServer(AnsiString *oG_Server, AnsiString *oG_v);
 | 
						||
        AnsiString __fastcall obtenerOGCookie(void);
 | 
						||
        int __fastcall iniciarSesion();
 | 
						||
        int __fastcall descargarMensajes();
 | 
						||
 | 
						||
        int __fastcall checkError(TMemoryStream *html);
 | 
						||
 | 
						||
        int __fastcall visionGeneral(void);
 | 
						||
        int __fastcall _visionGeneral(int idxPLANET);
 | 
						||
 | 
						||
        int __fastcall retirarNavesRecursos(PAtaques EAtaque, bool irAEscombros, int velocidadRec);
 | 
						||
        int __fastcall sondearAtacante(PAtaques EAtaque);
 | 
						||
        int __fastcall sondearPlaneta(int gO, int sO, int pO, int tO, int gD,int sD, int pD,int tD);
 | 
						||
        int __fastcall enviarSondaModoGalaxia(int g,int s, int p,int pt);
 | 
						||
 | 
						||
        void __fastcall regresarNaves(PAtaques EAtaque);
 | 
						||
 | 
						||
 | 
						||
        void __fastcall addEvent(int gO,int sO,int pO,int tO,char *nO,long ida,long start, int gD,int sD,int pD,int tD,char *nD,long vuelta,long stop,char mision);
 | 
						||
 | 
						||
        int __fastcall cargarGalaxia(int g,int s, int p);
 | 
						||
        bool __fastcall cambiarPlaneta(int g, int s, int p,int t);
 | 
						||
        int  __fastcall flota_obtenerFlota(int idPlaneta,TRecursos *RecursosDisp,Hangar *NavesAparcadas);
 | 
						||
        int  __fastcall flota_seleccionarFlota(Hangar *NavesAparcadas,TRecursos *RecursosDisp);
 | 
						||
        int  __fastcall flota_fijarObjetivo(int gO,int sO,int pO,int tipoO, TRecursos *RecursosDisp,Hangar *NavesAparcadas, int gD,int sD, int pD, int tipoD, int velocidad);
 | 
						||
        int  __fastcall flota_ejecutarMision(int gO,int sO,int pO,int tipoO, TRecursos *RecursosDisp,Hangar *NavesAparcadas, int gD,int sD, int pD, int tipoD, int velocidad, int mision, TRecursos *RecursosD,bool usarBUGS);
 | 
						||
        char * __fastcall extraerRecursos(char *html, TRecursos *RecursosDisp);
 | 
						||
        void  __fastcall maxResources(TRecursos *RecursosDisp,Hangar *Naves,TRecursos *maxRecursos);
 | 
						||
        char * __fastcall extraerNavesAparcadas(char *html,Hangar *NavesAparcadas);
 | 
						||
        char * __fastcall obtenerListaPlanetas(char *html);
 | 
						||
 | 
						||
        int  __fastcall numNaves(Hangar *Naves);
 | 
						||
        int __fastcall cmpNaves(Hangar *A, Hangar *B);
 | 
						||
        int __fastcall oG_mision(char m);
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
        int __fastcall siguienteAtaque(TAtaqueOfensivo *tropas);
 | 
						||
        bool __fastcall buscarRefugio(int idPlaneta,int *gD,int *sD,int *pD,int *tipoD);
 | 
						||
        char * __fastcall strRTrim(char *string);
 | 
						||
 | 
						||
 | 
						||
        AnsiString __fastcall digerirFlota(THangar *naves,int numNaves);
 | 
						||
 | 
						||
 | 
						||
        TList *MyEvents;
 | 
						||
        TList *MyPlanets;
 | 
						||
        TList *MyAttacks;
 | 
						||
 | 
						||
        TList *AtaquesOfensivos;
 | 
						||
 | 
						||
        int nextUpdateCLK, espacioEntreAtaques;
 | 
						||
        int auxCounter;
 | 
						||
        bool toFront;
 | 
						||
 | 
						||
public:		// User declarations
 | 
						||
        int lastRequest; // <20>ltima acci<63>n ejecutada
 | 
						||
 | 
						||
        bool CFG_ejecutarProgama;
 | 
						||
        AnsiString CFG_programSondeo;
 | 
						||
 | 
						||
        void __fastcall ejecutarProgramaAntiSondeo(PAtaques a);
 | 
						||
 | 
						||
 | 
						||
        bool __fastcall cargarAtaques(AnsiString filename);
 | 
						||
        void __fastcall fixParams(THangar *naves);
 | 
						||
 | 
						||
 | 
						||
        int errorCONEXION,errorCONEXION_nextTry;
 | 
						||
        long __fastcall toNumber(char *n);
 | 
						||
        void __fastcall cargarPlanetasEnVisorAtaques(void);
 | 
						||
 | 
						||
        void __fastcall cargarPlanetasEnColaSondeos(void);
 | 
						||
 | 
						||
        TRecursos RecursosDisp;
 | 
						||
 | 
						||
        __fastcall Tmain(TComponent* Owner);
 | 
						||
 | 
						||
/* Magnetic Form */
 | 
						||
BEGIN_MESSAGE_MAP
 | 
						||
  MESSAGE_HANDLER(WM_WINDOWPOSCHANGING,TWMWindowPosChanging,WMWindowPosChanging);
 | 
						||
  MESSAGE_HANDLER(WM_SETTINGCHANGE,TMessage,SettingChanged);
 | 
						||
END_MESSAGE_MAP(TForm);
 | 
						||
/****************/
 | 
						||
        
 | 
						||
};
 | 
						||
//---------------------------------------------------------------------------
 | 
						||
extern PACKAGE Tmain *main;
 | 
						||
//---------------------------------------------------------------------------
 | 
						||
#endif
 |