Пример #1
0
 public void ShowBotDetailsTab(SBot sbot)
 {
     try
     {
         foreach (var doc in tabbedViewMain.Documents)
         {
             if (doc.ControlName == "docBot" + sbot.CharName)
             {
                 tabbedViewMain.ActivateDocument(doc.Control);
                 return;
             }
         }
         this.Invoke(new MethodInvoker(() =>
         {
             DevExpress.XtraBars.Docking2010.Views.Tabbed.Document nDoc = new DevExpress.XtraBars.Docking2010.Views.Tabbed.Document(this.components);
             nDoc.Caption = sbot.CharName;
             nDoc.ControlName = "docBot" + sbot.CharName;
             nDoc.Tag = sbot;
         //nDoc.Image = global::SbotControl.Properties.Resources.usergroup_16x16;
         tabbedViewMain.Documents.Add(nDoc);
             tabbedViewMain.ActivateDocument(nDoc.Control);
         }));
     }
     catch (Exception ex)
     { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
 }
Пример #2
0
 private void UpdateBotList(SBot bot)
 {
     for (int i = 0; i < LVBots.Items.Count; i++)
     {
         ListViewItem lvi = LVBots.Items[i];
         if (bot.ID.ToString() == lvi.SubItems[2].Text)
         {
             lvi.Text = bot.CharName;
             if (bot.Visable)
                 lvi.SubItems[1].Text = "V";
             else
                 lvi.SubItems[1].Text = "H";
             switch (bot.Status)
             {
                 case SBot.StatusType.Disconnected:
                 case SBot.StatusType.Unknown:
                 case SBot.StatusType.Nothing:
                      lvi.StateImageIndex = 0;
                     break;
                 case SBot.StatusType.Try_to_login:
                     lvi.StateImageIndex = 1;
                     break;
                 case SBot.StatusType.Online:
                     lvi.StateImageIndex = 2;
                     break;
             }
             break;
         }
     }
 }
Пример #3
0
        private void FillBotsInfoUI(SBot bot)
        {
            lblCharName.Text = bot.CharName;
            lblSkill.Text = bot.SkillPoint.ToString();
            lblGold.Text = bot.Gold.ToString();
            lblExp.Text = "should change this to exp from bar";
            lblLvl.Text = bot.Level;
            lblItems.Text = bot.ItemDrops;
            lblDied.Text = bot.Died;
            lblLoop.Text = "Remove it";
            lblStatus.Text = bot.Status.ToString();
            lblExpPerHour.Text = bot.ExperiencePetHour;
            lblGoldPerHour.Text = bot.GoldPetHour.ToString();
            lblSkillPerHour.Text = bot.SPH;
            lblDCCount.Text = "Should Updated";
            lblTryConnectCount.Text = bot.TryConnectCount.ToString();

            pbCharHP.Minimum = bot.CharHPProgressBar[0];
            pbCharHP.Maximum = bot.CharHPProgressBar[1];
            pbCharHP.Value = bot.CharHPProgressBar[2];

            pbCharMP.Minimum = bot.CharMPProgressBar[0];
            pbCharMP.Maximum = bot.CharMPProgressBar[1];
            pbCharMP.Value = bot.CharMPProgressBar[2];

            pbCharExp.Minimum = bot.CharExpProgressBar[0];
            pbCharExp.Maximum = bot.CharExpProgressBar[1];
            pbCharExp.Value = bot.CharExpProgressBar[2];
        }
Пример #4
0
 void bot_StateChanged(SBot sender, SBot.StatusType e)
 {
     MethodInvoker action = delegate
     {
         if (LVBots.SelectedItems.Count == 0)
             return;
         if (sender.ID != Program.BM.Bots[LVBots.SelectedIndices[0]].ID)
             return;
         lblStatus.Text = e.ToString();
         UpdateBotList(sender);
     };
     this.Invoke(action);
 }
Пример #5
0
 void bot_LogAdded(SBot sender, string Log)
 {
     MethodInvoker action = delegate
     {
         if (LVBots.SelectedItems.Count == 0)
             return;
         if (sender.ID != Program.BM.Bots[LVBots.SelectedIndices[0]].ID)
             return;
         if (Log.Contains("Error - h2f - 3018"))
             return;
         lbBotLog.Items.Add(Log);
     };
     this.Invoke(action);
 }
Пример #6
0
 void bot_StateChanged(SBot sender, SBot.StatusType e)
 {
     try
     {
         if (!ManagerOnline)
         {
             if (e == SBot.StatusType.bot_Process_Terminated)
             {
                 sender.Stop();
                 RemoveBot(sender);
             }
             return;
         }
         Log.LogType logtyp = Log.LogType.Stander;
         Log.LogLevel loglvl = Log.LogLevel.Stander;
         switch (e)
         {
             case SBot.StatusType.Disconnected:
                 Manager.NotifyManager.ShowAlert(sender.CharName, "Diconnected ..!", Manager.NotifyManager.MSG_Type.Disconnect);
                 logtyp = Log.LogType.Info;
                 loglvl = Log.LogLevel.Debug;
                 break;
             case SBot.StatusType.Try_to_login:
                 logtyp = Log.LogType.Info;
                 loglvl = Log.LogLevel.Debug;
                 break;
             case SBot.StatusType.Online:
                 Manager.NotifyManager.ShowAlert(sender.CharName, "Online", Manager.NotifyManager.MSG_Type.Connect);
                 logtyp = Log.LogType.Info;
                 loglvl = Log.LogLevel.Debug;
                 break;
             case SBot.StatusType.bot_Process_Terminated:
                 logtyp = Log.LogType.Error;
                 loglvl = Log.LogLevel.Debug;
                 sender.Stop();
                 if (sender.BotAccount == null || !sender.BotAccount.Start)
                     RemoveBot(sender);
                 else
                     sender.Start();
                 break;
             case SBot.StatusType.Unknown:
                 logtyp = Log.LogType.Error;
                 loglvl = Log.LogLevel.Stander;
                 break;
         }
         if (sender.BotAccount == null)
             Program.Logger.AddLog(logtyp, loglvl, string.Format("[{0}]-{1}", sender.CharName, e.ToString()));
         else
             Program.Logger.AddLog(logtyp, loglvl, string.Format("[{0}]-{1}", sender.BotAccount.charName, e.ToString()));
         //Save Log
         Program.dbOperations.SaveToLog(Core.db.LogType.StatusLog, sender.CharName.ToString(), e.ToString());
     }
     catch (Exception ex)
     { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
 }
Пример #7
0
 private void Bot_LogAdded(SBot sender, string Log)
 {
     lock (BotLogs)
     {
         try
         {
             if (BotLogs.Count > BotLogsMaxSize)
                 BotLogs.Clear();
             BotLogs.Add(new Core.BotLogUnit(sender.CharName, DateTime.Now.ToShortDateString(), Log));
         }
         catch (Exception ex)
         { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
     }
     //Save Log
     Program.dbOperations.SaveToLog(Core.db.LogType.BotLog, sender.CharName, Log.Trim());
 }
Пример #8
0
 public void RemoveBot(SBot bot)
 {
     try
     {
         if (BotListChanged != null)
             BotListChanged(bot, ChangesType.Deleted);
         bot.StateChanged -= bot_StateChanged; bot.PropertyChanged -= bot_PropertyChanged;
         if (bot.BotAccount != null)
         {
             bot.BotAccount.bot = null;
             Program.Logger.AddLog(Log.LogType.Info, Log.LogLevel.Stander, string.Format("[{0}]- Closed", bot.BotAccount.charName));
         }
         else
             Program.Logger.AddLog(Log.LogType.Info, Log.LogLevel.Stander, string.Format("[{0}]- Closed", bot.CharName));
         lock (Bots)
             Bots.Remove(bot);
         bot.Dispose();
     }
     catch (Exception ex)
     { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
 }
Пример #9
0
 public static SBot CreateSbot(Process botProcess = null)
 {
     SBot bot = new SBot();
     bot._process = botProcess;
     return bot;
 }