Esempio n. 1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     HSMPServer.Create("foobar", 8192);
     HSMPServer.Get().StartListenerThread();
     m_window = new MainWindow(this);
     //notifyIcon1.Icon = new System.Drawing.Icon(@"C:\Users\mattg\Desktop\HSBot.ico", new System.Drawing.Size(128, 128));
 }
Esempio n. 2
0
        /* --- Instance Methods (Auxiliary) --- */
        private void OnMsgOptions(Message msg)
        {
            var             options = (MsgOptions)msg;
            MsgChooseOption response;

            if (options.Options.Count == 1)
            {
                response = new MsgChooseOption(0, 0, 0, -1);
            }
            else
            {
                var r = new Random();
                int i = 1 + (r.Next() % (options.Options.Count - 1));
                var o = options.Options[i];

                response          = new MsgChooseOption();
                response.Main     = i;
                response.Position = 0;
                response.Target   = o.Main.Targets == null ? 0 : o.Main.Targets[r.Next() % o.Main.Targets.Count];
                response.Sub      = -1;
                if (o.Subs != null && o.Subs.Count > 0)
                {
                    response.Sub = r.Next() % o.Subs.Count;
                    if (o.Subs[response.Sub].Targets != null && o.Subs[response.Sub].Targets.Count > 0)
                    {
                        response.Target = o.Subs[response.Sub].Targets[r.Next() % o.Subs[response.Sub].Targets.Count];
                    }
                }
            }

            HSMPServer.Get().Send(response);
        }
Esempio n. 3
0
 /* --- Instance Methods (Auxiliary) --- */
 protected override void OnClosed(EventArgs e)
 {
     HSMPServer.Get().Send(new MsgStatus(MsgStatus.State.DISCONNECTED, MsgStatus.User.CLIENT, "NORMAL"));
     HSMPServer.Get().StopListenerThread();
     HSMPServer.Get().Close();
     notifyIcon1.Visible = false;
 }
Esempio n. 4
0
        private void OnAgainstPlayerClicked(object sender, EventArgs e)
        {
            var msg = new MsgTaskSet();

            msg.TaskType   = HSClient.BotTask.Task.PLAY_TOURNAMENT;
            msg.TaskParams = new TaskParamPlayTournament(0, false);
            HSMPServer.Get().Send(msg);
        }
Esempio n. 5
0
 /* --- Constructors --- */
 public AccountInfoGroup(MainForm form)
 {
     m_form     = form;
     GoldLabel  = new AccountInfoGoldLabel(m_form);
     DustLabel  = new AccountInfoDustLabel(m_form);
     PacksLabel = new AccountInfoPacksLabel(m_form);
     RankLabel  = new AccountInfoRankLabel(m_form);
     HSMPServer.Get().RegisterUIListener(MsgAccountInfoResponse.ID, form, OnMsgAccountInfoResponse);
     HSMPServer.Get().RegisterUIListener(MsgCurrencyBalance.ID, form, OnMsgCurrencyBalance);
 }
Esempio n. 6
0
        /* --- Constructors --- */
        public MainWindow(MainForm form)
        {
            m_form         = form;
            m_menuStrip    = new MenuStrip(form);
            m_mainPanel    = new MainPanel(form);
            m_connectPanel = new ConnectPanel(form);
            HSMPServer.Get().RegisterUIListener(MsgStatus.ID, form, OnMsgStatus);
            HSMPServer.Get().RegisterListener(MsgDebug.ID, OnMsgDebug);
            HSMPServer.Get().RegisterListener(MsgDeckList.ID, OnMsgDeckList);

            m_bot = new BotHandler();
        }
Esempio n. 7
0
        private void OnMsgStatus(HSInfo.Message msg)
        {
            MsgStatus status = (MsgStatus)msg;

            switch (status.Status)
            {
            case MsgStatus.State.CONNECTED:
                HSMPServer.Get().Send(new MsgAccountInfoRequest());
                HSMPServer.Get().Send(new MsgStatus(MsgStatus.State.CONNECTED, MsgStatus.User.SERVER, "Success"));
                m_mainPanel.Show();
                m_connectPanel.Hide();
                m_form.lblConnecting.Hide();
                break;

            case MsgStatus.State.DISCONNECTED:
                m_mainPanel.Hide();
                m_connectPanel.Show();
                break;

            case MsgStatus.State.HANDSHAKE_FAILED:
                m_form.lblConnecting.Text = status.Message;
                break;
            }
        }
Esempio n. 8
0
 /* --- Constructors --- */
 public BotHandler()
 {
     m_simGameState = new SimGameState();
     HSMPServer.Get().RegisterListener(MsgOptions.ID, OnMsgOptions);
     HSMPServer.Get().RegisterListener(MsgPowerHistory.ID, OnMsgPowerHistory);
 }
Esempio n. 9
0
 public static void Register(HSMPServer s)
 {
 }
Esempio n. 10
0
 private void OnButtonDebug(object sender, EventArgs args)
 {
     HSMPServer.Get().SendDebugMessage("hi");
 }