VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "richtx32.ocx"
Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "msinet.ocx"
Begin VB.Form frmBot 
   Caption         =   "MirageBot 7.0"
   ClientHeight    =   6015
   ClientLeft      =   60
   ClientTop       =   735
   ClientWidth     =   10965
   BeginProperty Font 
      Name            =   "Courier New"
      Size            =   9
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmBot.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   6015
   ScaleWidth      =   10965
   StartUpPosition =   2  'CenterScreen
   Begin InetCtlsObjects.Inet netVersion 
      Left            =   6000
      Top             =   1920
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
   End
   Begin VB.Timer tmrProfileVoid 
      Interval        =   30000
      Left            =   5640
      Top             =   4920
   End
   Begin MSComctlLib.ImageList imlSmiley 
      Left            =   6000
      Top             =   2520
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      UseMaskColor    =   0   'False
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   8
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":164A
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":186E
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":1AB2
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":1CFC
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":1F41
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":2189
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":23D1
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":261B
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList imlTab 
      Left            =   6000
      Top             =   3120
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   12
      ImageHeight     =   12
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   4
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":2863
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":2B6B
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":2E6B
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":317F
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Timer tmrView 
      Interval        =   500
      Left            =   6120
      Top             =   4920
   End
   Begin MSComctlLib.ImageList imlClassic 
      Left            =   6000
      Top             =   3720
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   28
      ImageHeight     =   14
      MaskColor       =   16711935
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   17
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":34C0
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":39AA
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":3E94
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":437E
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":4868
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":4D52
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":523C
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":5726
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":5C10
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":60FA
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":65E4
            Key             =   ""
         EndProperty
         BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":6ACE
            Key             =   ""
         EndProperty
         BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":6FB8
            Key             =   ""
         EndProperty
         BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":74A2
            Key             =   ""
         EndProperty
         BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":798C
            Key             =   ""
         EndProperty
         BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":7E76
            Key             =   ""
         EndProperty
         BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":8360
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList imlWarCraft 
      Left            =   6000
      Top             =   4320
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   55
      ImageHeight     =   38
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   17
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":8569
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":9662
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":A3BB
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":AE6D
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":BE10
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":C70A
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":D947
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":EB93
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":FD11
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":10E8F
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":12227
            Key             =   ""
         EndProperty
         BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":13527
            Key             =   ""
         EndProperty
         BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":1462F
            Key             =   ""
         EndProperty
         BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":15737
            Key             =   ""
         EndProperty
         BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":166FD
            Key             =   ""
         EndProperty
         BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":17362
            Key             =   ""
         EndProperty
         BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBot.frx":185F7
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.ComboBox cboSend 
      BackColor       =   &H00000000&
      ForeColor       =   &H00FFFFFF&
      Height          =   345
      Left            =   0
      TabIndex        =   0
      Top             =   5520
      Width           =   11415
   End
   Begin MSComctlLib.ListView lvUsers 
      Height          =   4815
      Index           =   0
      Left            =   6600
      TabIndex        =   2
      Top             =   720
      Width           =   4815
      _ExtentX        =   8493
      _ExtentY        =   8493
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      HideColumnHeaders=   -1  'True
      FullRowSelect   =   -1  'True
      _Version        =   393217
      SmallIcons      =   "imlWarCraft"
      ForeColor       =   16777215
      BackColor       =   0
      Appearance      =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Courier New"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   2
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "Username"
         Object.Width           =   6508
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Alignment       =   1
         SubItemIndex    =   1
         Text            =   "Ping"
         Object.Width           =   1411
      EndProperty
   End
   Begin RichTextLib.RichTextBox rtbChat 
      Height          =   3855
      Index           =   0
      Left            =   0
      TabIndex        =   1
      TabStop         =   0   'False
      Top             =   360
      Width           =   6615
      _ExtentX        =   11668
      _ExtentY        =   6800
      _Version        =   393217
      BackColor       =   0
      BorderStyle     =   0
      ReadOnly        =   -1  'True
      ScrollBars      =   2
      AutoVerbMenu    =   -1  'True
      OLEDragMode     =   0
      OLEDropMode     =   0
      TextRTF         =   $"frmBot.frx":196FF
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Courier New"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbsProfile 
      Height          =   345
      Left            =   0
      TabIndex        =   3
      Top             =   0
      Width           =   11415
      _ExtentX        =   20135
      _ExtentY        =   609
      Style           =   2
      ImageList       =   "imlTab"
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.PictureBox picTrack 
      BorderStyle     =   0  'None
      Height          =   375
      Left            =   0
      ScaleHeight     =   375
      ScaleWidth      =   11175
      TabIndex        =   5
      Top             =   5880
      Width           =   11175
      Begin VB.Label lblTrack 
         AutoSize        =   -1  'True
         Caption         =   "Current track..."
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   195
         Left            =   120
         TabIndex        =   6
         Top             =   40
         Width           =   1485
      End
   End
   Begin RichTextLib.RichTextBox rtbWhsp 
      Height          =   1335
      Index           =   0
      Left            =   0
      TabIndex        =   7
      TabStop         =   0   'False
      Top             =   4200
      Width           =   6615
      _ExtentX        =   11668
      _ExtentY        =   2355
      _Version        =   393217
      BackColor       =   0
      BorderStyle     =   0
      ReadOnly        =   -1  'True
      ScrollBars      =   2
      AutoVerbMenu    =   -1  'True
      OLEDragMode     =   0
      OLEDropMode     =   0
      TextRTF         =   $"frmBot.frx":1977F
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Courier New"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label lblChannel 
      Alignment       =   2  'Center
      Caption         =   "-- Offline --"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000C000&
      Height          =   375
      Left            =   6600
      TabIndex        =   4
      Top             =   360
      Width           =   4815
   End
   Begin MirageBot.BNCS Bot 
      Index           =   0
      Left            =   5400
      Top             =   120
      _extentx        =   1720
      _extenty        =   1720
   End
   Begin VB.Menu mnuTClick 
      Caption         =   "Tray"
      Visible         =   0   'False
      Begin VB.Menu mnuExit 
         Caption         =   "Exit"
      End
      Begin VB.Menu mnuShow 
         Caption         =   "Show"
      End
   End
   Begin VB.Menu mnuRClick 
      Caption         =   "RClick"
      Visible         =   0   'False
      Begin VB.Menu mnuCopy 
         Caption         =   "Copy"
      End
      Begin VB.Menu mnuDesignate 
         Caption         =   "Designate"
      End
      Begin VB.Menu mnuChatFocus 
         Caption         =   "Focus"
      End
      Begin VB.Menu mnuGroup 
         Caption         =   "Group"
         Begin VB.Menu mnuNoGroup 
            Caption         =   "None"
         End
         Begin VB.Menu mnuGroups 
            Caption         =   "-"
            Index           =   0
         End
      End
      Begin VB.Menu mnuIgnore 
         Caption         =   "Ignore"
      End
      Begin VB.Menu mnuInvite 
         Caption         =   "Invite"
      End
      Begin VB.Menu mnuNudge 
         Caption         =   "Nudge"
      End
      Begin VB.Menu mnuProfile 
         Caption         =   "Profile"
      End
      Begin VB.Menu mnuStats 
         Caption         =   "Stats"
      End
      Begin VB.Menu mnuTTT 
         Caption         =   "Tic-Tac-Toe"
      End
      Begin VB.Menu mnuUnignore 
         Caption         =   "Unignore"
      End
      Begin VB.Menu mnuWhisper 
         Caption         =   "Whisper"
      End
      Begin VB.Menu mnuWhois 
         Caption         =   "Whois"
      End
   End
   Begin VB.Menu mnuBot 
      Caption         =   "Bot"
      Begin VB.Menu mnuConnect 
         Caption         =   "Connect"
         Shortcut        =   {F2}
      End
      Begin VB.Menu mnuDisconnect 
         Caption         =   "Disconnect"
         Shortcut        =   {F3}
      End
      Begin VB.Menu mnuLine0 
         Caption         =   "-"
      End
      Begin VB.Menu mnuConfig 
         Caption         =   "Edit Configuration"
         Shortcut        =   {F1}
      End
      Begin VB.Menu mnuDatabase 
         Caption         =   "Edit Database"
      End
      Begin VB.Menu mnuGreet 
         Caption         =   "Edit Greet Settings"
      End
      Begin VB.Menu mnuIdle 
         Caption         =   "Edit Idle Settings"
      End
      Begin VB.Menu mnuLine07 
         Caption         =   "-"
      End
      Begin VB.Menu mnuChannels 
         Caption         =   "Channel List"
      End
      Begin VB.Menu mnuCharacterList 
         Caption         =   "Character List"
      End
      Begin VB.Menu mnuLine04 
         Caption         =   "-"
      End
      Begin VB.Menu mnuLoad 
         Caption         =   "L&oad Profile..."
         Shortcut        =   ^O
      End
      Begin VB.Menu mnuUnload 
         Caption         =   "&Unload Profile"
         Shortcut        =   ^U
      End
   End
   Begin VB.Menu mnuClan 
      Caption         =   "Clan"
      Begin VB.Menu mnuCreateClan 
         Caption         =   "Create Clan"
      End
   End
   Begin VB.Menu mnuInClan 
      Caption         =   "Clan"
      Begin VB.Menu mnuClanMembers 
         Caption         =   "&Manage Clan"
         Shortcut        =   ^M
      End
      Begin VB.Menu mnuInviteUser 
         Caption         =   "Invite User"
      End
   End
   Begin VB.Menu mnuDisplay 
      Caption         =   "Display"
      Begin VB.Menu mnuFilterSettings 
         Caption         =   "Edit Filters"
      End
      Begin VB.Menu mnuFonts 
         Caption         =   "Edit &Fonts"
         Shortcut        =   ^F
      End
      Begin VB.Menu mnuGroupEditor 
         Caption         =   "Edit &Groups"
         Shortcut        =   ^G
      End
      Begin VB.Menu mnuLine11 
         Caption         =   "-"
      End
      Begin VB.Menu mnuDisplayModes 
         Caption         =   "Display Modes"
         Begin VB.Menu mnuBestAppearance 
            Caption         =   "Best Appearance (Chat)"
         End
         Begin VB.Menu mnuBestPerformance 
            Caption         =   "Best Performance (Ops)"
         End
      End
      Begin VB.Menu mnuLine12 
         Caption         =   "-"
      End
      Begin VB.Menu mnuDeclineInvitations 
         Caption         =   "Decline Clan Invitations"
      End
      Begin VB.Menu mnuDisableNudges 
         Caption         =   "Disable Nudges"
      End
      Begin VB.Menu mnuDisableTicTacToe 
         Caption         =   "Disable Tic-Tac-Toe"
      End
      Begin VB.Menu mnuLine09 
         Caption         =   "-"
      End
      Begin VB.Menu mnuBeepOnName 
         Caption         =   "Enable Beep on Name"
      End
      Begin VB.Menu mnuColorParsing 
         Caption         =   "Enable Color Parsing"
      End
      Begin VB.Menu mnuDecensoring 
         Caption         =   "Enable Decensoring"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuEncryption 
         Caption         =   "Enable Encryption"
      End
      Begin VB.Menu mnuFilterFlood 
         Caption         =   "Enable Flood Filtering"
      End
      Begin VB.Menu mnuIdleColoring 
         Caption         =   "Enable Idle User Coloring"
      End
      Begin VB.Menu mnuShowJoinLeave 
         Caption         =   "Enable &Join/Leave Events"
         Shortcut        =   ^J
      End
      Begin VB.Menu mnuOfflineFriend 
         Caption         =   "Enable Offline Friend Filtering"
      End
      Begin VB.Menu mnuProfileMP3 
         Caption         =   "Enable Profile MP3"
      End
      Begin VB.Menu mnuSmileys 
         Caption         =   "Enable Smilies"
      End
      Begin VB.Menu mnuVoidView 
         Caption         =   "Enable Void View"
      End
      Begin VB.Menu mnuWarCraftIcons 
         Caption         =   "Enable WarCraft Icons"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuWhisperPanel 
         Caption         =   "Enable Whisper Panel"
      End
      Begin VB.Menu mnuWhisperWindows 
         Caption         =   "Enable Whisper Windows"
      End
   End
   Begin VB.Menu mnuMusic 
      Caption         =   "Music"
      Begin VB.Menu mnuMediaPlayer 
         Caption         =   "Media Player"
         Begin VB.Menu mnuMP 
            Caption         =   "None"
            Index           =   0
         End
         Begin VB.Menu mnuMP 
            Caption         =   "iTunes"
            Enabled         =   0   'False
            Index           =   1
         End
         Begin VB.Menu mnuMP 
            Caption         =   "Foobar"
            Index           =   2
         End
         Begin VB.Menu mnuMP 
            Caption         =   "Winamp"
            Index           =   3
         End
         Begin VB.Menu mnuMP 
            Caption         =   "Windows Media Player"
            Index           =   4
         End
      End
      Begin VB.Menu mnuLine06 
         Caption         =   "-"
      End
      Begin VB.Menu mnuBeginPlay 
         Caption         =   "Play"
      End
      Begin VB.Menu mnuPausePlay 
         Caption         =   "Pause"
      End
      Begin VB.Menu mnuStopPlay 
         Caption         =   "Stop"
      End
      Begin VB.Menu mnuLine05 
         Caption         =   "-"
      End
      Begin VB.Menu mnuNextTrack 
         Caption         =   "Next Track"
         Shortcut        =   {F11}
      End
      Begin VB.Menu mnuPreviousTrack 
         Caption         =   "Previous Track"
         Shortcut        =   {F12}
      End
   End
   Begin VB.Menu mnuWindow 
      Caption         =   "Window"
      Begin VB.Menu mnuClear 
         Caption         =   "Clea&r Window"
         Shortcut        =   ^R
      End
      Begin VB.Menu mnuTray 
         Caption         =   "Minimize to Tray"
      End
      Begin VB.Menu mnuOptimizeMemory 
         Caption         =   "Optimize Memory"
      End
      Begin VB.Menu mnuLine2 
         Caption         =   "-"
      End
      Begin VB.Menu mnuLock 
         Caption         =   "&Lock Buffers"
         Shortcut        =   ^L
      End
      Begin VB.Menu mnuLockControls 
         Caption         =   "Lock Controls"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "Help"
      Begin VB.Menu mnuAbout 
         Caption         =   "About"
      End
      Begin VB.Menu mnuLine10 
         Caption         =   "-"
      End
      Begin VB.Menu mnuChanges 
         Caption         =   "Changes"
      End
      Begin VB.Menu mnuCheckVersion 
         Caption         =   "Check Version"
      End
      Begin VB.Menu mnuCommands 
         Caption         =   "Commands"
      End
      Begin VB.Menu mnuReadMe 
         Caption         =   "ReadMe"
      End
   End
End
Attribute VB_Name = "frmBot"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private TT As New clsToolTip

'TO-DO:
'--------------------------------------------------
'botmail
'itunes
'url support
'alerts

'channel sweep and ipsweep
'lockdown
'minuteban
'client ban
'ping ban
'unban last (ubl)
'index ban
'banlist
'wildcard banning/kicking
'wildcard unbanning
'smart banning
'- check if bots are on same server, in same channel, both with ops then:
'  - check if either bot is banning a user (queue) that the other bot has already banned

'Using MirageBot as an ops, disable all features

Const SPLITTER_WIDTH = 40
Const MIN_LEFTPANE_WIDTH = 5000
Const MIN_RIGHTPANE_WIDTH = 3000
Private Dragging As Boolean, LeftPanePercent As Single

Public Function Title(Optional More As Boolean = True) As String
    Dim strTitle As String
    strTitle = "MirageBot " & App.Major & "." & App.Minor
    
    If Not More Then Title = strTitle: Exit Function
    
    Select Case Month(Date)
    Case 12
        Select Case Day(Date)
        Case 24
            strTitle = strTitle & " | Christmas Eve"
        Case 25
            strTitle = strTitle & " | Merry Christmas!"
        Case 26
            strTitle = strTitle & " | Kwanzaa Begins / Boxing Day!"
        Case 27
            strTitle = strTitle & " | Kwanzaa!"
        Case 31
            strTitle = strTitle & " | New Years Eve!"
        Case Else
            strTitle = strTitle & " | Seasons Greetings!"
        End Select
    Case 1
        Select Case Day(Date)
        Case 1
            strTitle = strTitle & " | Happy New Years!"
        Case 26
            strTitle = strTitle & " | Australia Day!"
        End Select
    Case 2
        Select Case Day(Date)
        Case 2
            strTitle = strTitle & " | Groundhog Day!"
        Case 14
            strTitle = strTitle & " | <3 Valentines Day! <3"
        End Select
    Case 3
        Select Case Day(Date)
        Case 17
            strTitle = strTitle & " | St. Patricks Day!"
        End Select
    Case 4
        Select Case Day(Date)
        Case 1
            'April Fools
            strTitle = "GookBot " & App.Major & "." & App.Minor & " | Doomsday!"
        Case 25
            strTitle = strTitle & " | Anzac Day!"
        End Select
    Case 5
        Select Case Day(Date)
        Case 1
            strTitle = strTitle & " | May Day!"
        End Select
    Case 7
        Select Case Day(Date)
        Case 1
            strTitle = strTitle & " | Canada Day!"
        Case 4
            strTitle = strTitle & " | Independance Day!"
        End Select
    Case 9
        Select Case Day(Date)
        Case 31
            strTitle = strTitle & " | Halloween!"
        End Select
    End Select
    
    Title = strTitle
End Function

Public Sub AddChat(Index As Integer, ParamArray Elements())
    On Error GoTo hErr:
    If mnuLock.Checked Then Exit Sub
    With rtbChat(Index)
        Dim SelStart As Double
        .SelStart = 2000000000
        If .SelStart > 1000000000 Then .text = vbNullString
        .SelFontName = ChatFont
        .SelFontSize = ChatFontSize
        .SelColor = vbGrayText
        .SelText = Format(Time, "hh:mm:ss ampm") & " | "
        .SelStart = 2000000000
        .SelHangingIndent = 1470
        SelStart = .SelStart
        Dim I As Integer
        For I = 0 To UBound(Elements) Step 2
            .SelColor = CLng(Elements(I))
            Dim text As String
            text = Elements(I + 1) & Left$(vbNewLine, -2 * CLng((I + 1) = UBound(Elements)))
            text = Replace$(text, "\rtf", "rtf")
            .SelText = text
            .SelStart = 2000000000
        Next I
        If mnuSmileys.Checked Then ReplaceSmilies rtbChat(Index), SelStart
        If mnuColorParsing.Checked Then ReplaceColours rtbChat(Index), SelStart
    End With
    Exit Sub
hErr:
    ErrorHandler "Main", "AddChat"
End Sub

Public Sub AddWhsp(Index As Integer, ParamArray Elements())
    On Error GoTo hErr:
    If mnuLock.Checked Then Exit Sub
    With rtbWhsp(Index)
        Dim SelStart As Double
        .SelStart = 2000000000
        If .SelStart > 1000000000 Then .text = vbNullString
        .SelFontName = ChatFont
        .SelFontSize = ChatFontSize
        .SelColor = vbGrayText
        .SelText = Format(Time, "hh:mm:ss ampm") & " | "
        .SelStart = 2000000000
        .SelHangingIndent = 1470
        SelStart = .SelStart
        Dim I As Integer
        For I = 0 To UBound(Elements) Step 2
            .SelColor = CLng(Elements(I))
            Dim text As String
            text = Elements(I + 1) & Left$(vbNewLine, -2 * CLng((I + 1) = UBound(Elements)))
            text = Replace$(text, "\rtf", "rtf")
            .SelText = text
            .SelStart = 2000000000
        Next I
        If mnuSmileys.Checked Then ReplaceSmilies rtbWhsp(Index), SelStart
        If mnuColorParsing.Checked Then ReplaceColours rtbWhsp(Index), SelStart
    End With
    Exit Sub
hErr:
    ErrorHandler "Main", "AddWhsp"
End Sub

Private Function ClientIconIndex(statstring As String, Flags As Long) As Integer
    Dim client As String * 4, Index As Integer
    client = StrReverse$(Left$(statstring, 4))
    Select Case client
        Case "WAR3": Index = 6
        Case "W3XP": Index = 7
        Case "DSHR": Index = 8
        Case "DRTL": Index = 9
        Case "D2DV": Index = 10
        Case "D2XP": Index = 11
        Case "SSHR": Index = 12
        Case "JSTR": Index = 13
        Case "STAR": Index = 14
        Case "SEXP": Index = 15
        Case "W2BN": Index = 16
        Case Else:   Index = 17
    End Select
    If (Flags And &H1) Then Index = 1
    If (Flags And &H8) Then Index = 2
    If (Flags And &H4) Then Index = 3
    If (Flags And &H20) Then Index = 4
    If (Flags And &H2) Then Index = 5
    ClientIconIndex = Index
End Function

Private Sub Bot_AddChat(Index As Integer, Color As Long, Message As String)
    AddChat Index, Color, Message
End Sub

Private Sub Bot_BnetConnected(Index As Integer)
    AddChat Index, vbGreen, "Connected to Battle.Net!"
    If (SelectedTab = BotToTabIndex(Index)) Then mnuConnect.Caption = "Reconnect"
End Sub

Private Sub Bot_BnetConnecting(Index As Integer)
    AddChat Index, vbYellow, "Connecting to Battle.Net..."
End Sub

Private Sub Bot_BnetDisconnect(Index As Integer)
    AddChat Index, vbRed, "Disconnected from Battle.Net!"
    lvUsers(Index).ListItems.Clear
    If (SelectedBot = Index) Then mnuConnect.Caption = "Connect": lblChannel.Caption = "-- Offline --"
End Sub

Private Sub Bot_BnetError(Index As Integer, Number As Integer, Description As String)
    lvUsers(Index).ListItems.Clear
    Select Case Number
        Case 10053: AddChat Index, vbRed, "An established connection was aborted by the software running on the Battle.Net server, possibly due to a data transmission timeout or protocol error. You may be IP-banned as a result!"
        Case 10054: AddChat Index, vbRed, "An existing connection was forcibly closed by Battle.Net!"
        Case 10055: AddChat Index, vbRed, "The server forcefully closed the existing connection, the server or your computer may have gone offline!"
        Case 10061: AddChat Index, vbRed, "No connection could be made because the Battle.Net server actively refused it. This usually results from trying to connect to a service that is inactive on the host!"
        Case 10065: AddChat Index, vbRed, "The server was unreachable!"
        Case Else:  AddChat Index, vbRed, Description
    End Select
    If (SelectedBot = Index) Then mnuConnect.Caption = "Connect": lblChannel.Caption = "-- Offline --"
End Sub

Private Sub Bot_BnlsConnected(Index As Integer)
    AddChat Index, vbGreen, "Connected to BNLS!"
End Sub

Private Sub Bot_BnlsConnecting(Index As Integer)
    AddChat Index, vbYellow, "Connecting to BNLS..."
End Sub

Private Sub Bot_BnlsError(Index As Integer, Number As Integer, Description As String)
    AddChat Index, vbRed, "BNLS Error #" & Number & ": " & Description
End Sub

Private Sub Bot_ChannelListing(Index As Integer, Channels() As String)
    Set Bot(Index).ChannelList = New Collection
    Dim I As Integer
    For I = 0 To UBound(Channels)
        If Len(Channels(I)) > 0 Then Bot(Index).ChannelList.Add Channels(I)
    Next I
    AddChat Index, vbGreen, "Received " & Bot(Index).ChannelList.Count & " channels!"
End Sub

Private Sub Bot_ChatBroadcast(Index As Integer, Username As String, Message As String)
    AddChat Index, vbCyan, "Broadcast from " & Username & ": " & Message
End Sub

Private Sub Bot_ChatEnterChannel(Index As Integer, Channel As String, Flags As Long)
    lvUsers(Index).ListItems.Clear
    AddChat Index, vbPaleBlue, "Joined Channel: " & "#" & Channel & " (" & LongToHex(Flags) & ")"
    lblChannel.Caption = "#" & Channel & " (0)"
    If (mnuVoidView.Checked) And (Channel = "The Void") Then
        Bot(Index).SendText "/unignore " & Bot(Index).GetAccount(Bot(Index).Self.Username)
    End If
End Sub

Private Sub Bot_ChatError(Index As Integer, Message As String)
    AddChat Index, vbRed, Message
End Sub

Private Sub Bot_ChatInformation(Index As Integer, Message As String)
    If Message Like "*, offline" And mnuOfflineFriend.Checked Then Exit Sub
    AddChat Index, vbYellow, Message
End Sub

Private Sub Bot_ChatMessageSent(Index As Integer, Message As String)
    If LenB(Message) = 0 Then Exit Sub
    If Left$(Message, 1) <> "/" Then
        If (Left$(Message, 1) = ENCRYPTION_CHAR) Then
            AddChat Index, vbGold, "«", vbPaleBlue, Bot(Index).Self.Username, vbGold, "» ", vbViolet, Decrypt(Mid$(Message, 2))
        Else
            AddChat Index, vbGold, "«", vbPaleBlue, Bot(Index).Self.Username, vbGold, "» ", vbWhite, Message
        End If
    End If
End Sub

Private Sub Bot_ChatUserEmote(Index As Integer, Username As String, Message As String, Ping As Long, Flags As Long)
    If (NowTickCount - Bot(Index).UserUptime(Username) < 600) And mnuFilterFlood.Checked Then Exit Sub
    If (IsUserFiltered(Username) Or IsMessageFiltered(Message)) Then Exit Sub
    If (InStrB(LCase$(Message), LCase$(Bot(Index).Self.Username)) > 0) And mnuBeepOnName.Checked Then TryBeep Index
    If (mnuDecensoring.Checked) Then Message = Decensor(Message)
    If Bot(Index).UserOperator(Username) Then
        AddChat Index, vbGold, "«", vbWhite, Suffix(Username) & " " & Message, vbGold, "»"
    Else
        AddChat Index, vbGold, "«", vbYellow, Suffix(Username) & " " & Message, vbGold, "»"
    End If
End Sub

Private Sub Bot_ChatUserHere(Index As Integer, Username As String, statstring As String, Ping As Long, Flags As Long)
    RemoveChatUser Index, Suffix(Username)
    If (Flags And &H1) Or (Flags And &H2) Then
        With lvUsers(Index).ListItems.Add(1, , Suffix(Username), , ClientIconIndex(statstring, Flags))
            .ListSubItems.Add , , Ping
            If GetGroupColor(Suffix(Username)) = -1 Then
                If (LCase$(Suffix(Username)) = LCase$(Bot(Index).Self.Username)) Then
                    .ForeColor = vbSkyBlue
                Else
                    .ForeColor = vbWhite
                End If
            Else
                .ForeColor = GetGroupColor(Suffix(Username))
            End If
        End With
    Else
        With lvUsers(Index).ListItems.Add(, , Suffix(Username), , ClientIconIndex(statstring, Flags))
            .ListSubItems.Add , , Ping
            If GetGroupColor(Suffix(Username)) = -1 Then
                If (LCase$(Suffix(Username)) = LCase$(Bot(Index).Self.Username)) Then
                    .ForeColor = vbSkyBlue
                Else
                    .ForeColor = vbWhite
                End If
            Else
                .ForeColor = GetGroupColor(Suffix(Username))
            End If
        End With
    End If
    If (SelectedBot = Index) Then lblChannel.Caption = "#" & Bot(Index).Self.Channel & " (" & lvUsers(Index).ListItems.Count & ")"
End Sub

Private Sub RemoveChatUser(Index As Integer, Username As String)
    Dim I As Integer
    For I = lvUsers(Index).ListItems.Count To 1 Step -1
        If LCase$(lvUsers(Index).ListItems(I).text) = LCase$(Username) Then
            lvUsers(Index).ListItems.Remove I
        End If
    Next I
End Sub

Private Sub Bot_ChatUserJoin(Index As Integer, Username As String, statstring As String, Ping As Long, Flags As Long)
    RemoveChatUser Index, Suffix(Username)
    If (Flags And &H1) Or (Flags And &H2) Then
        With lvUsers(Index).ListItems.Add(1, , Suffix(Username), , ClientIconIndex(statstring, Flags))
            .ListSubItems.Add , , Ping
            If GetGroupColor(Suffix(Username)) = -1 Then
                If (LCase$(Suffix(Username)) = LCase$(Bot(Index).Self.Username)) Then
                    .ForeColor = vbSkyBlue
                Else
                    .ForeColor = vbWhite
                End If
            Else
                .ForeColor = GetGroupColor(Suffix(Username))
            End If
        End With
    Else
        With lvUsers(Index).ListItems.Add(, , Suffix(Username), , ClientIconIndex(statstring, Flags))
            .ListSubItems.Add , , Ping
            If GetGroupColor(Suffix(Username)) = -1 Then
                If (LCase$(Suffix(Username)) = LCase$(Bot(Index).Self.Username)) Then
                    .ForeColor = vbSkyBlue
                Else
                    .ForeColor = vbWhite
                End If
            Else
                .ForeColor = GetGroupColor(Suffix(Username))
            End If
        End With
    End If
    If (SelectedBot = Index) Then lblChannel.Caption = "#" & Bot(Index).Self.Channel & " (" & lvUsers(Index).ListItems.Count & ")"

    'Filter...
    If (Bot(Index).JoinUser = Username) And (GetTickCount - Bot(Index).JoinTick < 700) And mnuFilterFlood.Checked Then Exit Sub
    Dim Stats As String, ss As New clsStatstring, client As String
    client = ss.GetClientName(Left$(statstring, 4))
    Stats = ss.GetClientStats(statstring)
    Debug.Print Stats
    Set ss = Nothing
    If (Bot(Index).Config.Greet And LenB(Bot(Index).Config.GreetMessage) > 0) Then
        Dim str As String
        str = Bot(Index).Config.GreetMessage
        str = Replace$(str, "%u", Username)
        str = Replace$(str, "%p", Ping)
        str = Replace$(str, "%c", Bot(Index).Self.Channel)
        str = Replace$(str, "%f", Flags)
        str = Replace$(str, "%v", frmBot.Title(False) & " by Chriso@USWest - www.BnetDev.net")
        str = Replace$(str, "%t", Time)
        str = Replace$(str, "%d", Date)
        str = Replace$(str, "%q", RandomQuote)
        str = Replace$(str, "%s", Stats)
        str = Replace$(str, "%*", DateTimeToLongString(ConvertTickCount(NowTickCount - Bot(Index).Self.Uptime)))
        str = Replace$(str, "%^", DateTimeToLongString(ConvertTickCount(NowTickCount)))
        str = Replace$(str, "%m", Media.Track)
        Bot(Index).SendText str
    End If
    If mnuShowJoinLeave.Checked Then AddChat Index, vbLime, Suffix(Username) & " (" & Ping & "ms, " & LongToHex(Flags) & ") entered using " & client & IIf(LenB(Stats) > 0, " (" & Stats & ")", "") & "!"
End Sub

Private Sub Bot_ChatUserLeave(Index As Integer, Username As String)
    Dim I As Integer
    For I = 1 To lvUsers(Index).ListItems.Count
        If (Suffix(lvUsers(Index).ListItems(I).text) = Suffix(Username)) Then
            lvUsers(Index).ListItems.Remove I
            Exit For
        End If
    Next I
    If (SelectedBot = Index) Then lblChannel.Caption = "#" & Bot(Index).Self.Channel & " (" & lvUsers(Index).ListItems.Count & ")"
    
    'Filter...
    If (NowTickCount - Bot(Index).UserUptime(Username) < 600) And mnuFilterFlood.Checked Then Exit Sub
    If (Bot(Index).Config.Farewell And LenB(Bot(Index).Config.FarewellMessage) > 0) Then
        Dim str As String
        str = Bot(Index).Config.FarewellMessage
        str = Replace$(str, "%u", Username)
        str = Replace$(str, "%c", Bot(Index).Self.Channel)
        str = Replace$(str, "%v", frmBot.Title(False) & " by Chriso@USWest - www.BnetDev.net")
        str = Replace$(str, "%t", Time)
        str = Replace$(str, "%d", Date)
        str = Replace$(str, "%q", RandomQuote)
        str = Replace$(str, "%*", DateTimeToLongString(ConvertTickCount(NowTickCount - Bot(Index).Self.Uptime)))
        str = Replace$(str, "%^", DateTimeToLongString(ConvertTickCount(NowTickCount)))
        str = Replace$(str, "%m", Media.Track)
        Bot(Index).SendText str
    End If
    If mnuShowJoinLeave.Checked Then AddChat Index, vbLime, Suffix(Username) & " left!"
End Sub

Private Sub Bot_ChatUserTalk(Index As Integer, Username As String, Message As String, Ping As Long, Flags As Long)
    Dim Encrypted As Boolean
    If (NowTickCount - Bot(Index).UserUptime(Username) < 600) And mnuFilterFlood.Checked Then Exit Sub
    If (IsUserFiltered(Username) Or IsMessageFiltered(Message)) Then Debug.Print "Filtered: " & Username & ": " & Message: Exit Sub
    If (InStrB(LCase$(Message), LCase$(Bot(Index).Self.Username)) > 0) And mnuBeepOnName.Checked Then TryBeep Index
    If (Left$(Message, 1) = ENCRYPTION_CHAR) Then Message = Decrypt(Mid$(Message, 2)): Encrypted = True
    If (mnuDecensoring.Checked) Then Message = Decensor(Message)
    If (Left$(Message, 1) = Bot(Index).Config.Trigger) Then Bot(Index).HandleCommand Username, Mid$(Message, 2)
    If Bot(Index).UserOperator(Username) Then
        AddChat Index, vbGold, "«", vbWhite, Suffix(Username), vbGold, "» ", IIf(Encrypted, vbViolet, vbWhite), Message
    Else
        AddChat Index, vbGold, "«", vbYellow, Suffix(Username), vbGold, "» ", IIf(Encrypted, vbViolet, vbWhite), Message
    End If
    Dim frm As Form
    If IsFocusActive(Username, frm) = True Then
        If frm.BotIndex = Index Then
            frm.AddText vbGold, "«", vbYellow, Suffix(Username), vbGold, "» ", IIf(Encrypted, vbViolet, vbWhite), Message
        End If
    End If
End Sub

Private Sub TryBeep(Index As Integer)
    On Error GoTo hErr
    Static BeepWarning As Boolean
    If (GetTickCount - Bot(Index).BeepTick > 60000) Then
        Bot(Index).BeepCount = 1
        Bot(Index).BeepTick = GetTickCount()
        BeepWarning = False
    Else
        Bot(Index).BeepCount = Bot(Index).BeepCount + 1
        If Bot(Index).BeepCount >= 10 Then
            If Not BeepWarning Then
                AddChat Index, vbRed, "Beep-on-name has been temporarily disabled. It appears that someone tried to exploit this feature, it will be re-enabled after a small grace period."
                BeepWarning = True
            End If
            Exit Sub
        End If
    End If
    Dim tmp As Long, cnt As Long
    tmp = GetTickCount
    cnt = 0
    Do Until cnt >= 3
        DoEvents
        Do Until GetTickCount - tmp > 200
            DoEvents
        Loop
        tmp = GetTickCount
        Beep
        cnt = cnt + 1
    Loop
    Exit Sub
hErr:
    ErrorHandler "Main", "TryBeep"
End Sub

Private Sub TryNudge(Index As Integer, Username As String)
    On Error GoTo hErr
    If mnuDisableNudges.Checked Then Exit Sub
    Static NudgeWarning As Boolean
    If (GetTickCount - Bot(Index).NudgeTick > 60000) Then
        Bot(Index).NudgeCount = 1
        Bot(Index).NudgeTick = GetTickCount()
        NudgeWarning = False
    Else
        Bot(Index).NudgeCount = Bot(Index).NudgeCount + 1
        If Bot(Index).NudgeCount >= 10 Then
            If Not NudgeWarning Then
                AddChat Index, vbRed, "Nudges have been temporarily disabled. It appears that someone tried to exploit this feature, it will be re-enabled after a small grace period."
                NudgeWarning = True
            End If
            Exit Sub
        End If
    End If
    FlashWindow
    PlaySound App.Path & "\notify.wav", SND_ASYNC
    AddChat Index, vbCyan, "Nudge received from " & Username
    Exit Sub
hErr:
    ErrorHandler "Main", "TryNudge"
End Sub

Private Sub Bot_ChatUserUpdate(Index As Integer, Username As String, Message As String, Ping As Long, Flags As Long)
    Dim UserIndex As Integer
    UserIndex = Bot(Index).UserIndex(Username)
    
    If (UserIndex = -1) Then
        With lvUsers(Index).ListItems.Add(, , Suffix(Username), , ClientIconIndex(Message, Flags))
            .ListSubItems.Add , , Ping
            If GetGroupColor(Suffix(Username)) = -1 Then
                .ForeColor = vbGrayText
            Else
                .ForeColor = GetGroupColor(Suffix(Username))
            End If
        End With
    Else
        Dim I As Integer, statstring As String
        statstring = Bot(Index).UserStatstring(Username)
        For I = 1 To lvUsers(Index).ListItems.Count
            If (Suffix(lvUsers(Index).ListItems(I).text) = Suffix(Username)) Then
                If (Bot(Index).UserOperator(Username) Or Bot(Index).UserRepresentative(Username)) Then
                    If (Flags And &H2) Or (Flags And &H1) Then
                        'User still ops or rep
                        lvUsers(Index).ListItems(I).SmallIcon = ClientIconIndex(statstring, Flags)
                    Else
                        'User lost ops or rep
                        lvUsers(Index).ListItems.Remove I
                        With lvUsers(Index).ListItems.Add(, , Suffix(Username), , ClientIconIndex(statstring, Flags))
                            .ListSubItems.Add , , Ping
                            If GetGroupColor(Suffix(Username)) = -1 Then
                                If Bot(Index).UserInvisible(Username) Then
                                    .ForeColor = vbGrayText
                                Else
                                    If (LCase$(Suffix(Username)) = LCase$(Bot(Index).Self.Username)) Then
                                        .ForeColor = vbSkyBlue
                                    Else
                                        .ForeColor = vbWhite
                                    End If
                                End If
                            Else
                                .ForeColor = GetGroupColor(Suffix(Username))
                            End If
                        End With
                        If (Bot(Index).UserOperator(Username)) Then
                            AddChat Index, vbCyan, Suffix(Username) & " lost operator status!"
                        Else
                            AddChat Index, vbCyan, Suffix(Username) & " lost representative status!"
                        End If
                    End If
                Else
                    If (Flags And &H2) Or (Flags And &H1) Then
                        'User gained ops or rep
                        lvUsers(Index).ListItems.Remove I
                        With lvUsers(Index).ListItems.Add(1, , Suffix(Username), , ClientIconIndex(statstring, Flags))
                            .ListSubItems.Add , , Ping
                            If GetGroupColor(Suffix(Username)) = -1 Then
                                If Bot(Index).UserInvisible(Username) Then
                                    .ForeColor = vbGrayText
                                Else
                                    If (LCase$(Suffix(Username)) = LCase$(Bot(Index).Self.Username)) Then
                                        .ForeColor = vbSkyBlue
                                    Else
                                        .ForeColor = vbWhite
                                    End If
                                End If
                            Else
                                .ForeColor = GetGroupColor(Suffix(Username))
                            End If
                        End With
                        If (Flags And &H2) Or (Flags And &H1) Then
                            AddChat Index, vbCyan, Suffix(Username) & " gained operator status!"
                        Else
                            AddChat Index, vbCyan, Suffix(Username) & " gained representative status!"
                        End If
                    Else
                        'User just updated
                        lvUsers(Index).ListItems(I).SmallIcon = ClientIconIndex(statstring, Flags)
                        If GetGroupColor(Suffix(Username)) = -1 Then
                            If Bot(Index).UserInvisible(Username) Then
                                lvUsers(Index).ListItems(I).ForeColor = vbGrayText
                            Else
                                If (LCase$(Suffix(Username)) = LCase$(Bot(Index).Self.Username)) Then
                                    lvUsers(Index).ListItems(I).ForeColor = vbSkyBlue
                                Else
                                    lvUsers(Index).ListItems(I).ForeColor = vbWhite
                                End If
                            End If
                        Else
                            lvUsers(Index).ListItems(I).ForeColor = GetGroupColor(Suffix(Username))
                        End If
                    End If
                End If
                Exit For
            End If
        Next I
    End If
    If (SelectedBot = Index) Then lblChannel.Caption = "#" & Bot(Index).Self.Channel & " (" & lvUsers(Index).ListItems.Count & ")"
End Sub

Private Sub Bot_ChatUserWhisper(Index As Integer, Username As String, Message As String, Ping As Long, Flags As Long)
    If Message = "[NUDGE]" Then
        AddChat Index, vbCyan, "Nudge sent to " & Username
    ElseIf Message = "$_reset" Or Message = "$_okreset" Or Message = "$_accept" Or Message = "$_begin" Or Message = "$_endgame" Or Left$(Message, 9) = "$_square#" Then
        'Do Nothing
        If mnuDisableTicTacToe.Checked Then Exit Sub
        If Message = "$_endgame" Then
            AddChat Index, vbSkyBlue, "Game of Tic-Tac-Toe with " & Bot(Index).GetAccount(Username) & " has finished!"
        ElseIf Message = "$_begin" Then
            AddChat Index, vbSkyBlue, "Requesting a game of Tic-Tac-Toe with " & Bot(Index).GetAccount(Username) & "..."
        ElseIf Message = "$_accept" Then
            AddChat Index, vbSkyBlue, "Started game of Tic-Tac-Toe with " & Bot(Index).GetAccount(Username) & "..."
        End If
    Else
        Dim Encrypted As Boolean
        If (Left$(Message, 1) = ENCRYPTION_CHAR) Then Message = Decrypt(Mid$(Message, 2)): Encrypted = True
        If Not mnuWhisperPanel.Checked Then AddChat Index, vbSkyBlue, "«To: ", vbCyan, Suffix(Username), vbSkyBlue, "» ", IIf(Encrypted, vbViolet, vbGrayText), Message
        AddWhsp Index, vbSkyBlue, "«To: ", vbCyan, Suffix(Username), vbSkyBlue, "» ", IIf(Encrypted, vbViolet, vbGrayText), Message
        
        If mnuWhisperWindows.Checked Then
            If WhisperWindowCount < 10 Then
                Dim frm As Form
                If IsWhisperActive(Username, frm) Then
                    frm.AddText vbGold, "«", vbPaleBlue, Suffix(Username), vbGold, "» ", IIf(Encrypted, vbViolet, vbWhite), Message
                Else
                    Dim F As New frmWhisper
                    F.WhisperedUser = Suffix(Username)
                    F.BotIndex = Index
                    F.Caption = F.WhisperedUser & " (whisper)"
                    F.cboSend.FontName = SendFont
                    F.cboSend.FontSize = SendFontSize
                    F.Show
                    F.AddText vbGold, "«", vbPaleBlue, Suffix(Username), vbGold, "» ", IIf(Encrypted, vbViolet, vbWhite), Message
                End If
            Else
                AddChat Index, vbRed, "Cannot open any more whisper windows, limit reached!"
            End If
        End If
    End If
End Sub

Private Sub Bot_ChatUserWhisperFrom(Index As Integer, Username As String, Message As String, Ping As Long, Flags As Long)
    Dim Encrypted As Boolean
    If (IsUserFiltered(Username) Or IsMessageFiltered(Message)) Then Exit Sub
    If (Left$(Message, 1) = ENCRYPTION_CHAR) Then Message = Decrypt(Mid$(Message, 2)): Encrypted = True
    If Message = "[NUDGE]" Then
        TryNudge Index, Username
    ElseIf Message = "$_reset" Or Message = "$_okreset" Or Message = "$_accept" Or Message = "$_begin" Or Message = "$_endgame" Or Left$(Message, 9) = "$_square#" Then
        If mnuDisableTicTacToe.Checked Then Exit Sub
        Dim F As Form
        For Each F In Forms
            If F.Name = "frmTicTacToe" Then
                If F.Player = Bot(Index).GetAccount(Username) Then
                    If Message = "$_reset" Then
                        If MsgBox(Username & " wants to reset the board, do you agree?", vbQuestion + vbYesNo, "Tic-Tac-Toe") = vbYes Then
                            F.Reset
                            Bot(Index).SendText "/w " & F.Player & " $_okreset"
                            Exit Sub
                        End If
                    End If
                    If Message = "$_okreset" Then
                        F.Reset
                        Exit Sub
                    End If
                    If Message = "$_endgame" Then
                        AddChat Index, vbSkyBlue, "Game of Tic-Tac-Toe with " & Bot(Index).GetAccount(Username) & " has finished!"
                        F.endgame
                        Exit Sub
                    End If
                    If Message = "$_begin" Then
                        AddChat Index, vbRed, "Cannot start another game of Tic-Tac-Toe with " & Username & " there is already one in progress!"
                        Exit Sub
                    End If
                    If Left$(Message, 9) = "$_square#" Then
                        If Val(Mid$(Message, 10, 1)) < 9 And Val(Mid$(Message, 10, 1)) > -1 Then
                            F.Clicked Val(Mid$(Message, 10, 1))
                        Else
                            AddChat Index, vbRed, "Someone is trying to exploit the Tic-Tac-Toe feature by spamming you with invalid square click events!"
                        End If
                        Exit Sub
                    End If
                End If
            End If
        Next
        
        If (GetTickCount - Bot(Index).LastTicTacToeRequest) > 2000 Then
            If Message = "$_begin" Then
                If MsgBox("Start a game of Tic-Tac-Toe with " & Username & "?", vbQuestion + vbYesNo, "Tic-Tac-Toe") = vbYes Then
                    Set F = New frmTicTacToe
                    F.Naut = True
                    F.YourGo = True
                    F.Player = Bot(Index).GetAccount(Username)
                    F.BotIndex = Index
                    F.Label1 = "Playing game with " & F.Player
                    F.Show
                    Bot(Index).SendText "/w " & F.Player & " $_accept"
                End If
            ElseIf Message = "$_accept" And Bot(Index).GetAccount(Username) = Bot(Index).GetAccount(Bot(Index).PendingTicTacToe) Then
                Set F = New frmTicTacToe
                F.Naut = False
                F.YourGo = False
                F.Player = Bot(Index).GetAccount(Username)
                F.BotIndex = Index
                F.Label1 = "Playing game with " & F.Player
                F.Show
            End If
        Else
            AddChat Index, vbRed, "Request to play Tic-Tac-Toe was automatically declined due to last request being too recent!"
        End If
        Bot(Index).LastTicTacToeRequest = GetTickCount()
    Else
        If Not mnuWhisperPanel.Checked Then AddChat Index, vbSkyBlue, "«From: ", vbCyan, Suffix(Username), vbSkyBlue, "» ", IIf(Encrypted, vbViolet, vbGrayText), Message
        AddWhsp Index, vbSkyBlue, "«From: ", vbCyan, Suffix(Username), vbSkyBlue, "» ", IIf(Encrypted, vbViolet, vbGrayText), Message
        
        If mnuWhisperWindows.Checked Then
            If WhisperWindowCount < 10 Then
                Dim frm As Form
                If IsWhisperActive(Username, frm) Then
                    frm.AddText vbGold, "«", vbYellow, Suffix(Username), vbGold, "» ", IIf(Encrypted, vbViolet, vbWhite), Message
                Else
                    Dim w As New frmWhisper
                    w.WhisperedUser = Suffix(Username)
                    w.BotIndex = Index
                    w.Caption = Suffix(Username) & " (whisper)"
                    w.cboSend.FontName = SendFont
                    w.cboSend.FontSize = SendFontSize
                    w.Show
                    w.AddText vbGold, "«", vbYellow, Suffix(Username), vbGold, "» ", IIf(Encrypted, vbViolet, vbWhite), Message
                End If
            Else
                AddChat Index, vbRed, "Cannot open any more whisper windows, limit reached!"
            End If
        End If
    End If
End Sub

Private Sub Bot_ClanCreationInvitation(Index As Integer, Name As String, Tag As String, Inviter As String, Count As Byte, Candidates() As String)
    If mnuDeclineInvitations.Checked Then
        Bot(Index).SendClanCreationInvitation False
        AddChat Index, vbRed, "Automatically declined clan creation invitation from " & Inviter & " (" & Name & ")"
    Else
        Dim F As New frmClanInviteMulti
        F.Counter = 40
        F.BotIndex = Index
        F.txtUsers.text = Join(Candidates, ", ")
        F.lblYouHave.Caption = "You have been invited to create " & Name & " (Clan " & Tag & ") by " & Inviter
        F.Show
    End If
End Sub

Private Sub Bot_ClanDisband(Index As Integer, Result As Byte)
    Select Case Result
    Case &H0
        AddChat Index, vbLime, "Successfully disbanded the clan!"
        Bot(Index).ClearClanMembers
    Case &H2
        AddChat Index, vbCrimson, "Cannot disband the clan, clan is not one week old yet!"
    Case &H7
        AddChat Index, vbCrimson, "You are not authorized to disband the clan!"
    Case Else
        AddChat Index, vbCrimson, "Clan cannot be disbanded!"
    End Select
End Sub

Private Sub Bot_ClanFindCandidates(Index As Integer, Cookie As Long, Result As Byte, Count As Byte, Candidates() As String)
    Select Case Result
    Case &H0
        If (Count = 0) Then
            AddChat Index, vbCrimson, "Could not find enough candidates!"
            Unload frmCreateClan
        Else
            frmCreateClan.fraInvite.Visible = True
            frmCreateClan.fraFind.Visible = False
            Dim I As Integer
            For I = 0 To UBound(Candidates)
                frmCreateClan.lstCandidates.AddItem Candidates(I)
            Next I
        End If
    Case &H1
        AddChat Index, vbCrimson, "Current clan tag is already taken!"
        Unload frmCreateClan
    Case &H2
        AddChat Index, vbCrimson, "Current cdkey is clanned!"
        Unload frmCreateClan
    Case &H8
        AddChat Index, vbCrimson, "You are currently in a clan!"
        Unload frmCreateClan
    Case &HA
        AddChat Index, vbCrimson, "Invalid clan tag!"
        Unload frmCreateClan
    Case Else
        AddChat Index, vbCrimson, "Unknown clan find candidates response: " & Result
    End Select
End Sub

Private Sub Bot_ClanInfo(Index As Integer, Rank As String, Tag As String)
    AddChat Index, vbGold, "You are a " & Rank & " in Clan " & Tag & "!"
End Sub

Private Sub Bot_ClanInvitation(Index As Integer, Result As Byte, User As String)
    Select Case Result
    Case &H0
        AddChat Index, vbLime, User & " accepted clan invitation!"
    Case &H4
        AddChat Index, vbCrimson, User & " declined clan invitation!"
    Case &H5
        AddChat Index, vbCrimson, "Failed to invite " & User & "!"
    Case &H9
        AddChat Index, vbCrimson, "Cannot invite " & User & ", the clan has reached maximum capacity!"
    Case Else
        AddChat Index, vbCrimson, "Unknown clan invitation response!"
    End Select
End Sub

Private Sub Bot_ClanInvitationResponse(Index As Integer, Name As String, Tag As String, Inviter As String)
    If mnuDeclineInvitations.Checked Then
        Bot(Index).SendClanInvitationResponse False
        AddChat Index, vbRed, "Automatically declined clan invitation from " & Inviter & " (" & Name & ")"
    Else
        Dim F As New frmClanInvite
        F.Counter = 40
        F.BotIndex = Index
        F.lblYouHave.Caption = "You have been invited to join " & Name & " (Clan " & Tag & ") by " & Inviter
        F.Show
    End If
End Sub

Private Sub Bot_ClanInviteMultiple(Index As Integer, Result As Byte, Candidates() As String)
    Select Case Result
    Case &H0
        AddChat Index, vbLime, "Clan successfully created!"
    Case &H4
        AddChat Index, vbCrimson, "The following candidates declined:"
        Dim I As Integer
        For I = 0 To UBound(Candidates())
            AddChat Index, vbCrimson, "- " & Candidates(I)
        Next I
    Case &H5
        AddChat Index, vbCrimson, "Clan invitation failed!"
    Case Else
        AddChat Index, vbCrimson, "Unknown clan invite multiple response: " & ByteToHex(Result) & "!"
    End Select
End Sub

Private Sub Bot_ClanMakeChieftain(Index As Integer, Result As Byte)
    Select Case Result
    Case &H0
        AddChat Index, vbLime, "Successfully changed chieftain!"
    Case &H2
        AddChat Index, vbCrimson, "Cannot change chieftain, clan is not one week old yet!"
    Case &H4
        AddChat Index, vbCrimson, "Chieftain change was declined!"
    Case &H5
        AddChat Index, vbCrimson, "Chieftain change failed!"
    Case &H7
        AddChat Index, vbCrimson, "You are not authorized to change the chieftain!"
    Case &H8
        AddChat Index, vbCrimson, "You are not allowed to change the chieftain!"
    Case Else
        AddChat Index, vbCrimson, "Chieftain cannot be changed, unknown response!"
    End Select
End Sub

Private Sub Bot_ClanQuitNotify(Index As Integer)
    AddChat Index, vbLime, "You have successfully quit the clan!"
End Sub

Private Sub Bot_ClanRankChange(Index As Integer, Result As Byte)
    Select Case Result
    Case &H0
        AddChat Index, vbGreen, "Successfully changed users rank!"
    Case &H1
        AddChat Index, vbRed, "Failed to change users rank!"
    Case &H2
        AddChat Index, vbRed, "Cannot change users rank yet, they haven't been in the clan a week!"
    Case &H7
        AddChat Index, vbRed, "You are not authorized to change that users rank, you need to be a Shaman or Chieftain!"
    Case &H8
        AddChat Index, vbRed, "You are not allowed to change that users rank, their rank is higher than yours!"
    Case Else
        AddChat Index, vbRed, "Cannot change users rank, unknown response!"
    End Select
End Sub

Private Sub Bot_ClanRemoveMember(Index As Integer, Result As Byte)
    Select Case Result
    Case &H0
        AddChat Index, vbLime, "Successfully removed member!"
    Case &H1
        AddChat Index, vbCrimson, "Member removal failed!"
    Case &H2
        AddChat Index, vbCrimson, "User cannot be removed until he is in the clan for a week or more!"
    Case &H7
        AddChat Index, vbCrimson, "You are not authorized to remove that member!"
    Case &H8
        AddChat Index, vbCrimson, "You are not allowed to remove that member!"
    Case Else
        AddChat Index, vbCrimson, "Member cannot be removed, unknown response!"
    End Select
End Sub

Private Sub Bot_RealmConnected(Index As Integer)
    AddChat Index, vbGreen, "Connected to realm!"
    Bot(Index).SendRealmStartup
End Sub

Private Sub Bot_RealmConnecting(Index As Integer)
    AddChat Index, vbYellow, "Connecting to realm..."
End Sub

Private Sub Bot_RealmDisconnect(Index As Integer)
    AddChat Index, vbRed, "Disconnected from realm!"
End Sub

Private Sub Bot_RealmError(Index As Integer, Number As Integer, Description As String)
    Select Case Number
        Case 10053: AddChat Index, vbRed, "An established connection was aborted by the software running on the realm, possibly due to a data transmission timeout or protocol error. You may be IP-banned as a result!"
        Case 10054: AddChat Index, vbRed, "An existing connection was forcibly closed by the realm!"
        Case 10055: AddChat Index, vbRed, "The realm forcefully closed the existing connection, the realm or your computer may have gone offline!"
        Case 10061: AddChat Index, vbRed, "No connection could be made because the realm actively refused it. This usually results from trying to connect to a service that is inactive on the host!"
        Case 10065: AddChat Index, vbRed, "The realm was unreachable!"
        Case Else:  AddChat Index, vbRed, "Realm Error #" & Number & ": " & Description
    End Select
End Sub

Private Sub Bot_RealmListing(Index As Integer, Count As Long, Realms() As String)
    AddChat Index, vbGrayText, "Available realms: " & Join(Realms, ", ")
End Sub

Private Sub cboSend_KeyDown(KeyCode As Integer, Shift As Integer)
    If Shift = 2 And KeyCode = 86 Then
        If (SelectedBot <> -1) Then
            Dim strText As String, Splt() As String, I As Integer
            strText = Clipboard.GetText
            If InStrB(strText, vbNewLine) > 0 Then
                Splt() = Split(strText, vbNewLine)
                For I = 0 To UBound(Splt())
                    If Left$(Splt(I), 2) = "//" Then
                        'Every bot sends it :)
                        Dim s As Integer
                        For s = 0 To Bot.UBound
                            If Not Bot(s) Is Nothing Then
                                If Bot(s).IsOnline Then
                                    Bot(s).SendText Mid$(Splt(I), 2)
                                End If
                            End If
                        Next s
                    Else
                        Bot(SelectedBot).SendText cboSend.text
                    End If
                    Bot(SelectedBot).SendText Splt(I)
                    cboSend.AddItem cboSend.text, 0
                    cboSend.text = vbNullString
                Next I
            End If
            cboSend_KeyUp KeyCode, Shift
        End If
    End If
End Sub

Private Sub cboSend_KeyPress(KeyAscii As Integer)
    If (KeyAscii = vbKeyReturn) Then
        If (SelectedBot <> -1) Then
            If Left$(cboSend.text, 2) = "//" Then
                'Every bot sends it :)
                Dim I As Integer
                For I = 0 To Bot.UBound
                    If Not Bot(I) Is Nothing Then
                        If Bot(I).IsOnline Then
                            Bot(I).SendText Mid$(cboSend.text, 2)
                        End If
                    End If
                Next I
            Else
                Bot(SelectedBot).SendText cboSend.text
            End If
            cboSend.AddItem cboSend.text, 0
            cboSend.text = vbNullString
            KeyAscii = 0
        Else
            MsgBox "Cannot send a message, please ensure that a profile is loaded!", vbExclamation
        End If
    End If
End Sub

Public Sub ChangeChatFont(ByRef FontName As String, ByRef FontSize As Byte, Optional Initial As Boolean = False)
    Dim I As Integer, intBot As Integer
    For I = 1 To tbsProfile.Tabs.Count
        intBot = TabToBotIndex(I)
        If intBot > -1 Then
            rtbChat(intBot).SelStart = 0
            rtbChat(intBot).SelLength = Len(rtbChat(intBot).text)
            rtbChat(intBot).SelFontName = FontName
            If FontSize > 0 Then rtbChat(intBot).SelFontSize = FontSize
            rtbChat(intBot).SelStart = Len(rtbChat(intBot).text)
            rtbChat(intBot).SelFontName = FontName
            If FontSize > 0 Then rtbChat(intBot).SelFontSize = FontSize
            rtbChat(intBot).SelBold = False
            rtbChat(intBot).SelItalic = False
            rtbChat(intBot).SelUnderline = False
            rtbChat(intBot).SelStrikeThru = False
            If Initial Then rtbChat(intBot).Font.Name = FontName: If FontSize > 0 Then rtbChat(intBot).Font.Size = FontSize
        End If
    Next I
    ChatFont = FontName
    ChatFontSize = FontSize
    WriteIni AppData & "Settings.ini", "Settings", "ChatFont", ChatFont
    WriteIni AppData & "Settings.ini", "Settings", "ChatFontSize", CStr(ChatFontSize)
End Sub

Public Sub ChangeSendFont(ByRef FontName As String, ByRef FontSize As Byte)
    cboSend.Font.Name = FontName
    If FontSize > 0 Then cboSend.Font.Size = FontSize
    SendFont = FontName
    SendFontSize = FontSize
    WriteIni AppData & "Settings.ini", "Settings", "SendFont", SendFont
    WriteIni AppData & "Settings.ini", "Settings", "SendFontSize", CStr(SendFontSize)
    Form_Resize
End Sub

Public Sub ChangeListFont(ByRef FontName As String, ByRef FontSize As Byte)
    Dim I As Integer, intBot As Integer
    For I = 1 To tbsProfile.Tabs.Count
        intBot = TabToBotIndex(I)
        If intBot > -1 Then
            lvUsers(intBot).Font.Name = FontName
            If FontSize > 0 Then lvUsers(intBot).Font.Size = FontSize
            lvUsers(intBot).Font.Bold = False
            lvUsers(intBot).Font.Italic = False
            lvUsers(intBot).Font.Strikethrough = False
            lvUsers(intBot).Font.Underline = False
        End If
    Next I
    ListFont = FontName
    ListFontSize = FontSize
    WriteIni AppData & "Settings.ini", "Settings", "ListFont", ListFont
    WriteIni AppData & "Settings.ini", "Settings", "ListFontSize", CStr(ListFontSize)
End Sub

Private Sub cboSend_KeyUp(KeyCode As Integer, Shift As Integer)
    If Shift = 2 And KeyCode = 86 Then
        On Error Resume Next
        If Len(Clipboard.GetText) > 0 Then
            If InStr(Clipboard.GetText, vbNewLine) > 0 Then
                cboSend.text = vbNullString
            End If
        End If
    End If
End Sub

Private Sub Form_Activate()
    If RunningTick = 0 Then RunningTick = NowTickCount()
End Sub

Private Sub Form_Load()
    If (kd_init() = 0) Then
        MsgBox "Cdkey decoder could not be initialized!", vbCritical
        Unload Me
        Exit Sub
    End If
    tbsProfile.Tabs.Clear
    If fso.FolderExists(App.Path & "\Binaries\") = False Then fso.CreateFolder (App.Path & "\Binaries\")
    If fso.FolderExists(App.Path & "\Binaries\Lockdown\") = False Then fso.CreateFolder (App.Path & "\Binaries\Lockdown\")
    If fso.FolderExists(App.Path & "\Binaries\STAR\") = False Then fso.CreateFolder (App.Path & "\Binaries\STAR\")
    If fso.FolderExists(App.Path & "\Binaries\W2BN\") = False Then fso.CreateFolder (App.Path & "\Binaries\W2BN\")
    If fso.FolderExists(App.Path & "\Binaries\D2DV\") = False Then fso.CreateFolder (App.Path & "\Binaries\D2DV\")
    If fso.FolderExists(App.Path & "\Binaries\D2XP\") = False Then fso.CreateFolder (App.Path & "\Binaries\D2XP\")
    If fso.FolderExists(App.Path & "\Binaries\WAR3\") = False Then fso.CreateFolder (App.Path & "\Binaries\WAR3\")

    LeftPanePercent = 0.65
    ReloadUserFilters
    ReloadMessageFilters
    LoadGroups
    DisplayGroups

    ListFont = ReadIni(AppData & "Settings.ini", "Settings", "ListFont")
    ListFontSize = Val(ReadIni(AppData & "Settings.ini", "Settings", "ListFontSize"))
    ChangeListFont ListFont, ListFontSize
    ChatFont = ReadIni(AppData & "Settings.ini", "Settings", "ChatFont")
    ChatFontSize = Val(ReadIni(AppData & "Settings.ini", "Settings", "ChatFontSize"))
    ChangeChatFont ChatFont, ChatFontSize, True
    SendFont = ReadIni(AppData & "Settings.ini", "Settings", "SendFont")
    SendFontSize = Val(ReadIni(AppData & "Settings.ini", "Settings", "SendFontSize"))
    ChangeSendFont SendFont, SendFontSize
    
    mnuLock.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "Lock")) = "Y")
    mnuDeclineInvitations.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "DeclineInvitations")) = "Y")
    mnuShowJoinLeave.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "JoinLeave")) = "Y")
    mnuBeepOnName.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "BeepOnName")) = "Y")
    mnuColorParsing.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "ColorParsing")) = "Y")
    mnuWarCraftIcons.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "WarCraftIcons")) = "Y")
    mnuDisableTicTacToe.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "DisableTicTacToe")) = "Y")
    mnuDisableNudges.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "DisableNudges")) = "Y")
    mnuIdleColoring.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "IdleColoring")) = "Y")
    mnuDecensoring.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "Decensoring")) = "Y")
    mnuEncryption.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "Encryption")) = "Y")
    mnuOfflineFriend.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "OfflineFriend")) = "Y")
    mnuFilterFlood.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "FilterFlood")) = "Y")
    mnuLockControls.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "LockControls")) = "Y")
    mnuProfileMP3.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "ProfileMP3")) = "Y")
    mnuSmileys.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "Smileys")) = "Y")
    mnuVoidView.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "VoidView")) = "Y")
    mnuWhisperPanel.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "WhisperPanel")) = "Y")
    mnuWhisperWindows.Checked = (UCase$(ReadIni(AppData & "Settings.ini", "Settings", "WhisperWindows")) = "Y")
    Select Case Val(ReadIni(AppData & "Settings.ini", "Settings", "MediaPlayer"))
    Case 1
        Media.MediaPlayer = iTunes
        mnuMP(1).Checked = True
    Case 2
        Media.MediaPlayer = Foobar
        mnuMP(2).Checked = True
    Case 3
        Media.MediaPlayer = Winamp
        mnuMP(3).Checked = True
    Case 4
        Media.MediaPlayer = WindowsMediaPlayer
        mnuMP(4).Checked = True
    Case Else
        Media.MediaPlayer = None
        mnuMP(0).Checked = True
    End Select
    If mnuWarCraftIcons.Checked Then lvUsers(0).SmallIcons = imlWarCraft Else lvUsers(0).SmallIcons = imlClassic
    If Media.MediaPlayer = iTunes And Media.Opened Then Load frmiTunes
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Not mnuLockControls.Checked And Y <= cboSend.Top Then Dragging = True: Me.MousePointer = MousePointerConstants.vbSizeWE
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Not Dragging Then Exit Sub
    LeftPanePercent = X / ScaleWidth
    If LeftPanePercent < 0 Then LeftPanePercent = 0
    If LeftPanePercent > 1 Then LeftPanePercent = 1
    Form_Resize
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Not mnuLockControls.Checked Then Dragging = False: Me.MousePointer = MousePointerConstants.vbDefault
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    On Error Resume Next
    If MsgBox("Are you sure you want to close MirageBot?", vbQuestion + vbYesNoCancel, "Close MirageBot?") = vbYes Then
        frmTray.TrayDelete
        Dim I As Integer, F As Form
        For I = 0 To Bot.UBound
            Bot(I).Disconnect
        Next
        ReDim Bot(0)
        For Each F In Forms
            If F.Name <> Me.Name Then Unload F
            Set F = Nothing
        Next
        Cancel = 0
    Else
        Cancel = 1
    End If
End Sub

Public Sub Form_Resize()
    If (Me.WindowState = vbMinimized) Then Exit Sub
    If (Me.Width <= 11000) Then Me.Width = 11000
    If (Me.Height <= 7000) Then Me.Height = 7000
    
    Dim FrameWidth As Long, FrameHeight As Long
    FrameHeight = ((GetSystemMetrics(SM_CYFRAME) * Screen.TwipsPerPixelY) * 2) + (GetSystemMetrics(SM_CYCAPTION) * Screen.TwipsPerPixelY) + (GetSystemMetrics(SM_CYMENU) * Screen.TwipsPerPixelY)
    FrameWidth = ((GetSystemMetrics(SM_CXFRAME) * Screen.TwipsPerPixelX) * 2)
    
    If Media.MediaPlayer <> None Then
        picTrack.Top = Height - picTrack.Height - FrameHeight
        picTrack.Visible = True
    Else
        picTrack.Visible = False
    End If
    
    cboSend.Width = Width - FrameWidth
    If Media.MediaPlayer <> None Then
        cboSend.Top = picTrack.Top - cboSend.Height - 60
    Else
        cboSend.Top = Me.Height - cboSend.Height - FrameHeight
    End If
    
    Dim LeftWidth As Single
    Dim RightWidth As Single
    LeftWidth = (ScaleWidth - SPLITTER_WIDTH) * LeftPanePercent
    If LeftWidth < MIN_LEFTPANE_WIDTH Then
        LeftWidth = MIN_LEFTPANE_WIDTH
    End If

    RightWidth = (ScaleWidth - SPLITTER_WIDTH) - LeftWidth
    If RightWidth < MIN_RIGHTPANE_WIDTH Then
        RightWidth = MIN_RIGHTPANE_WIDTH
        LeftWidth = (ScaleWidth - SPLITTER_WIDTH - MIN_RIGHTPANE_WIDTH)
    End If

    Dim c As Control
    For Each c In Controls
        Select Case TypeName(c)
        Case "ListView"
            c.Width = RightWidth
            c.Left = Width - c.Width - FrameWidth
            c.Height = cboSend.Top - c.Top
            c.ColumnHeaders(1).Width = c.Width - c.ColumnHeaders(2).Width - 315
        Case "TabStrip"
            c.Width = Width - FrameWidth
        Case "RichTextBox"
            If c.Name = "rtbChat" Then
                If mnuWhisperPanel.Checked Then
                    c.Height = cboSend.Top - rtbWhsp(0).Height - c.Top
                    c.Width = LeftWidth
                Else
                    c.Height = cboSend.Top - c.Top
                    c.Width = LeftWidth
                End If
            End If
        End Select
    Next
    'Second wave of resizing
    For Each c In Controls
        Select Case TypeName(c)
        
        Case "RichTextBox"
            If c.Name = "rtbWhsp" Then
                c.Visible = mnuWhisperPanel.Checked
                If c.Visible Then
                    c.Left = rtbChat(0).Left
                    c.Top = rtbChat(0).Top + rtbChat(0).Height
                    c.Width = rtbChat(0).Width
                End If
            End If
        End Select
    Next
    lblChannel.Left = lvUsers(0).Left: lblChannel.Width = RightWidth
End Sub

Private Sub lvUsers_DblClick(Index As Integer)
    mnuWhisper_Click
End Sub

Private Sub lvUsers_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim info As LVHITTESTINFO, itemIndex As Long
    If lvUsers(Index).ListItems.Count = 0 Or ObjPtr(TT) = 0 Then Exit Sub
    info.Pt.X = X / Screen.TwipsPerPixelX
    info.Pt.Y = Y / Screen.TwipsPerPixelY
    itemIndex = SendMessage(lvUsers(Index).hWnd, LVM_HITTEST, 0, info) + 1
    If Val(lvUsers(Index).Tag) <> itemIndex Then
        lvUsers(Index).Tag = itemIndex
        If itemIndex = 0 Or itemIndex > lvUsers(Index).ListItems.Count Then
            TT.Destroy
        Else
            Dim ss As New clsStatstring, DT As DATETIME
            Dim User As String, Stats As String, Clan As String, Group As String
            User = lvUsers(Index).ListItems(itemIndex).text
            Stats = ss.GetClientStats(Bot(Index).UserStatstring(User))
            Clan = ss.GetClanName(Bot(Index).UserStatstring(User))
            DT = ConvertTickCount(NowTickCount - Bot(Index).UserUptime(User))
            Group = GetGroupName(User)
            If LenB(Group) > 0 Then Group = "Group: " & Group & vbNewLine
            If LenB(Clan) > 0 Then Clan = "Clan: " & Clan & vbNewLine
            TT.ForeColor = vbBlack
            TT.BackColor = &HC0FFFF
            TT.DelayTime = 250
            TT.Icon = TTIconInfo
            TT.Title = User & IIf(Bot(Index).UserInvisible(User), " (Invisible)", "")
            TT.TipText = Group & Clan & "Flags: " & LongToHex(Bot(Index).UserFlags(User)) & vbNewLine & _
                "Ping: " & Bot(Index).UserPing(User) & vbNewLine & _
                "Uptime: " & DateTimeToShortString(DT) & vbNewLine & _
                "Client: " & ss.GetClientName(Left$(Bot(Index).UserStatstring(User), 4)) & _
                IIf(LenB(Stats) > 0, vbNewLine & _
                    "Stats: " & Stats, vbNullString) & _
                vbNullChar
            TT.VisibleTime = 7000
            TT.Create lvUsers(Index).hWnd
        End If
    End If
End Sub

Private Sub lvUsers_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If lvUsers(Index).ListItems.Count > 0 Then
        If Button = vbRightButton Then
            DisplayGroups
            PopupMenu mnuRClick
        ElseIf Button = vbMiddleButton Then
            mnuProfile_Click
        End If
    End If
End Sub

Private Sub mnuAbout_Click()
    frmAbout.Show
End Sub

Private Sub mnuBeepOnName_Click()
    mnuBeepOnName.Checked = Not mnuBeepOnName.Checked
    WriteIni AppData & "Settings.ini", "Settings", "BeepOnName", YesNo(mnuBeepOnName.Checked)
End Sub

Private Sub mnuBeginPlay_Click()
    Media.BeginPlay
End Sub

Private Sub mnuBestAppearance_Click()
    mnuBeepOnName.Checked = True
    mnuColorParsing.Checked = True
    mnuDecensoring.Checked = True
    mnuIdleColoring.Checked = True
    mnuSmileys.Checked = True
    mnuVoidView.Checked = True
    mnuDisableTicTacToe.Checked = False
    mnuDisableNudges.Checked = False
End Sub

Private Sub mnuBestPerformance_Click()
    mnuBeepOnName.Checked = False
    mnuColorParsing.Checked = False
    mnuDecensoring.Checked = False
    mnuFilterFlood.Checked = True
    mnuIdleColoring.Checked = False
    mnuShowJoinLeave.Checked = False
    mnuProfileMP3.Checked = False
    mnuSmileys.Checked = False
    mnuVoidView.Checked = False
    mnuWhisperWindows.Checked = False
    mnuDisableTicTacToe.Checked = True
    mnuDisableNudges.Checked = True
End Sub

Private Sub mnuChanges_Click()
    On Error GoTo hErr:
    ShellExecute Me.hWnd, "OPEN", AppData & "Changes.txt", "", AppData & "Changes.txt", 5
    Exit Sub
hErr:
    MsgBox "Changes file is missing!", vbExclamation
End Sub

Private Sub mnuChannels_Click()
    If SelectedBot <> -1 Then
        frmChannels.lstChannels.Clear
        Dim I As Integer
        For I = 1 To Bot(SelectedBot).ChannelList.Count
            frmChannels.lstChannels.AddItem Bot(SelectedBot).ChannelList.Item(I)
        Next
        frmChannels.BotIndex = SelectedBot
        frmChannels.Show
    End If
End Sub

Private Sub mnuCharacterList_Click()
    If SelectedBot > -1 Then
        If Bot(SelectedBot).IsRealmOnline Then
            Bot(SelectedBot).SendRealmCharList2
        Else
            AddChat SelectedBot, vbRed, "Cannot view character list, client is not logged into a realm.  Please select the realm that you wish to connect to in the bot configuration then reconnect."
        End If
    Else
        MsgBox "Cannot show character list, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuChatFocus_Click()
    If SelectedBot > -1 Then
        If (lvUsers(SelectedBot).ListItems.Count > 0) Then
            Dim frm As Form
            If IsFocusActive(lvUsers(SelectedBot).SelectedItem.text, frm) = False Then
                Dim F As New frmChatFocus
                F.FocusedUser = Suffix(lvUsers(SelectedBot).SelectedItem.text)
                F.BotIndex = SelectedBot
                F.Caption = Suffix(lvUsers(SelectedBot).SelectedItem.text) & " (chat)"
                F.cboSend.FontName = SendFont
                F.cboSend.FontSize = SendFontSize
                F.Show
            Else
                AddChat vbRed, "That user is already being focused on!"
            End If
        End If
    End If
End Sub

Public Function IsFocusActive(Username As String, ByRef frm As Form) As Boolean
    Dim F As Form
    For Each F In Forms
        If F.Name = "frmChatFocus" Then
            If LCase$(Suffix(F.FocusedUser)) = LCase$(Suffix(Username)) Then
                Set frm = F
                IsFocusActive = True
                Exit Function
            End If
        End If
    Next F
End Function

Public Function IsWhisperActive(Username As String, ByRef frm As Form) As Boolean
    Dim F As Form
    For Each F In Forms
        If F.Name = "frmWhisper" Then
            If LCase$(Suffix(F.WhisperedUser)) = LCase$(Suffix(Username)) Then
                Set frm = F
                IsWhisperActive = True
                Exit Function
            End If
        End If
    Next F
End Function

Public Function WhisperWindowCount() As Long
    Dim F As Form, cnt As Long
    For Each F In Forms
        If F.Name = "frmWhisper" Then cnt = cnt + 1
    Next F
    WhisperWindowCount = cnt
End Function

Public Sub mnuCheckVersion_Click()
    On Error GoTo hErr:
    If SelectedBot = -1 Then MsgBox "Unknown error, no tab selected?", vbExclamation: Exit Sub
    Dim strVersion As String, strVer() As String
    strVersion = netVersion.OpenURL("http://www.bnetdev.net/mirage/version.txt")
    If InStrB(strVersion, ".") > 0 Then
        strVer = Split(strVersion, ".")
        If UBound(strVer) = 2 Then
            AddChat SelectedBot, vbGold, "Latest version: " & strVersion
            AddChat SelectedBot, vbGold, "Your version: " & App.Major & "." & App.Minor & "." & App.Revision
            If Val(strVer(2)) > App.Revision Then
                AddChat SelectedBot, vbSkyBlue, "There is a newer version of MirageBot available!"
                AddChat SelectedBot, vbSkyBlue, "Please download the update from: http://www.bnetdev.net/mirage/MB_Upgrade.exe"
            Else
                AddChat SelectedBot, vbLime, "MirageBot is up to date!"
            End If
        Else
            AddChat SelectedBot, vbCrimson, "Version format returned by website was invalid!"
        End If
    Else
        AddChat SelectedBot, vbCrimson, "Version format returned by website was invalid!"
    End If
    Exit Sub
hErr:
    netVersion.Cancel
    ErrorHandler "Main", "CheckVersion"
End Sub

Private Sub mnuColorParsing_Click()
    mnuColorParsing.Checked = Not mnuColorParsing.Checked
    WriteIni AppData & "Settings.ini", "Settings", "ColorParsing", YesNo(mnuColorParsing.Checked)
End Sub

Private Sub mnuCopy_Click()
    If SelectedBot > -1 Then
        If (lvUsers(SelectedBot).ListItems.Count > 0) Then
            Clipboard.SetText lvUsers(SelectedBot).SelectedItem.text
        End If
    End If
End Sub

Private Sub mnuCreateClan_Click()
    If (SelectedBot <> -1) Then
        frmCreateClan.BotIndex = SelectedBot
        frmCreateClan.Show
    Else
        MsgBox "Cannot show create clan, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuDatabase_Click()
    If SelectedBot = -1 Then Exit Sub
    frmDatabase.BotIndex = SelectedBot
    frmDatabase.ShowDB
    frmDatabase.Show
End Sub

Private Sub mnuDecensoring_Click()
    mnuDecensoring.Checked = Not mnuDecensoring.Checked
    WriteIni AppData & "Settings.ini", "Settings", "Decensoring", YesNo(mnuDecensoring.Checked)
End Sub

Private Sub mnuDeclineInvitations_Click()
    mnuDeclineInvitations.Checked = Not mnuDeclineInvitations.Checked
    WriteIni AppData & "Settings.ini", "Settings", "DeclineInvitations", YesNo(mnuDeclineInvitations.Checked)
End Sub

Private Sub mnuDesignate_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            Bot(SelectedBot).SendText "/designate " & Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text)
        Else
            MsgBox "Cannot designate, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot designate, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuDisableNudges_Click()
    mnuDisableNudges.Checked = Not mnuDisableNudges.Checked
    WriteIni AppData & "Settings.ini", "Settings", "DisableNudges", YesNo(mnuDisableNudges.Checked)
End Sub

Private Sub mnuSmileys_Click()
    mnuSmileys.Checked = Not mnuSmileys.Checked
    WriteIni AppData & "Settings.ini", "Settings", "Smileys", YesNo(mnuSmileys.Checked)
End Sub

Private Sub mnuEncryption_Click()
    mnuEncryption.Checked = Not mnuEncryption.Checked
    WriteIni AppData & "Settings.ini", "Settings", "Encryption", YesNo(mnuEncryption.Checked)
End Sub

Private Sub mnuExit_Click()
    Unload Me
End Sub

Private Sub mnuFilterFlood_Click()
    mnuFilterFlood.Checked = Not mnuFilterFlood.Checked
    WriteIni AppData & "Settings.ini", "Settings", "FilterFlood", YesNo(mnuFilterFlood.Checked)
End Sub

Private Sub mnuFilterSettings_Click()
    frmFilters.Show
End Sub

Private Sub mnuFonts_Click()
    frmChangeFont.Show
End Sub

Private Sub mnuGreet_Click()
    If (SelectedBot <> -1) Then
        frmGreeting.Show
        frmGreeting.BotIndex = SelectedBot
        frmGreeting.ProfileName = Bot(SelectedBot).Profile
        frmGreeting.ShowGreet
    Else
        MsgBox "Cannot show greeting, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuGroupEditor_Click()
    frmGroups.Show
End Sub

Private Sub mnuGroups_Click(Index As Integer)
    If (SelectedBot <> -1) Then
        If (GetGroupColor(lvUsers(SelectedBot).SelectedItem.text) <> -1) Then
            AddChat SelectedBot, vbRed, lvUsers(SelectedBot).SelectedItem.text & " already belongs to a group!"
        Else
            Dim I As Integer
            For I = 0 To UBound(Groups())
                If LCase$(Groups(I).Name) = LCase$(mnuGroups(Index).Caption) Then
                    Groups(I).AddMember lvUsers(SelectedBot).SelectedItem.text
                    Groups(I).SaveGroup
                    AddChat SelectedBot, vbGold, "Added member to group " & Groups(I).Name & "!"
                    RefreshChannel
                    Exit Sub
                End If
            Next I
        End If
    Else
        MsgBox "Cannot add user to group, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuIdle_Click()
    If (SelectedBot <> -1) Then
        Dim I As New frmIdle
        I.Show
        I.BotIndex = SelectedBot
        I.ProfileName = Bot(SelectedBot).Profile
        I.ShowIdle
    Else
        MsgBox "Cannot change idle settings, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuIdleColoring_Click()
    mnuIdleColoring.Checked = Not mnuIdleColoring.Checked
    WriteIni AppData & "Settings.ini", "Settings", "IdleColoring", YesNo(mnuIdleColoring.Checked)
End Sub

Private Sub mnuInviteUser_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            Bot(SelectedBot).SendText "/invite " & lvUsers(SelectedBot).SelectedItem.text
        Else
            MsgBox "Cannot invite user, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot invite user, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuLockControls_Click()
    mnuLockControls.Checked = Not mnuLockControls.Checked
    WriteIni AppData & "Settings.ini", "Settings", "LockControls", YesNo(mnuLockControls.Checked)
End Sub

Private Sub mnuMP_Click(Index As Integer)
    Dim I As Integer
    For I = 0 To 4
        mnuMP(I).Checked = False
    Next I
    mnuMP(Index).Checked = True
    Select Case Index
    Case 0: Media.MediaPlayer = None
    Case 1: Media.MediaPlayer = iTunes
    Case 2: Media.MediaPlayer = Foobar
    Case 3: Media.MediaPlayer = Winamp
    Case 4: Media.MediaPlayer = WindowsMediaPlayer
    End Select
    Form_Resize
    WriteIni AppData & "Settings.ini", "Settings", "MediaPlayer", Index & vbNullString
    tmrView_Timer
End Sub

Private Sub mnuNextTrack_Click()
    Media.NextTrack
End Sub

Private Sub mnuNoGroup_Click()
    If (SelectedBot <> -1) Then
        On Error GoTo hErr:
        Dim I As Integer, Removed As Boolean
        For I = 0 To UBound(Groups())
            If Groups(I).RemoveMember(lvUsers(SelectedBot).SelectedItem.text) Then Removed = True
        Next I
hErr:
        If Not Removed Then
            AddChat SelectedBot, vbRed, "User doesn't belong to any group!"
        Else
            AddChat SelectedBot, vbGold, "Removed user from all groups!"
        End If
        RefreshChannel
    Else
        MsgBox "Cannot clear group, invalid tab selected!", vbExclamation
    End If
End Sub


Private Sub mnuNudge_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            Bot(SelectedBot).SendText "/w " & Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text) & " [NUDGE]"
        Else
            MsgBox "Cannot send nudge, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot send nudge, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuClanMembers_Click()
    If (SelectedBot <> -1) Then
        If Bot(SelectedBot).Self.Clanned Then
            Bot(SelectedBot).ShowClanMembers
        Else
            MsgBox "You are not the member of a clan!", vbExclamation
        End If
    Else
        MsgBox "Cannot show clan members, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuClear_Click()
    If (SelectedBot <> -1) Then
        rtbChat(SelectedBot).text = vbNullString
        AddChat SelectedBot, vbGrayText, "Cleared window content!"
    Else
        MsgBox "Cannot clear window, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuCommands_Click()
    If (SelectedBot <> -1) Then
        AddChat SelectedBot, vbWhite, "Available internal commands:"
        AddChat SelectedBot, vbWhite, "COMMAND -- DESCRIPTION"
        AddChat SelectedBot, vbGrayText, "/cq or clearqueue -- clears queued messages"
        AddChat SelectedBot, vbGrayText, "/ver -- send the version of the bot"
        AddChat SelectedBot, vbGrayText, "/say or echo [text] -- send the text"
        AddChat SelectedBot, vbGrayText, "/mp3 -- send the current track"
        AddChat SelectedBot, vbGrayText, "/database or db -- display information about database"
        AddChat SelectedBot, vbGrayText, "/add [user] [attributes] -- add user to database with specified attributes"
        AddChat SelectedBot, vbGrayText, "/remove [user] -- remove user from the database"
        AddChat SelectedBot, vbGrayText, "/find [user] -- find user in the database"
        AddChat SelectedBot, vbGrayText, "/addquote -- add a quote to Quotes.txt"
        AddChat SelectedBot, vbGrayText, "/quote -- send a random quote from Quotes.txt"
        AddChat SelectedBot, vbGrayText, "/profile or p -- request a users profile and view it"
        AddChat SelectedBot, vbGrayText, "/echoprofile or ep -- request then send a users profile"
        AddChat SelectedBot, vbGrayText, "/self -- information about yourself"
        AddChat SelectedBot, vbGrayText, "/rejoin or rj -- rejoin the channel"
        AddChat SelectedBot, vbGrayText, "/home or h -- join the home channel"
        AddChat SelectedBot, vbGrayText, "/first -- join the product specific (first) channel"
        AddChat SelectedBot, vbGrayText, "/force [channel] -- forcefully join the specified channel"
        AddChat SelectedBot, vbGrayText, "/tictactoe [user] -- request a game of Tic-Tac-Toe with the user"
        AddChat SelectedBot, vbGrayText, "/nudge [user] -- nudge the specified user"
        AddChat SelectedBot, vbGrayText, "/giveop [user] -- designate the user and resign ops"
        AddChat SelectedBot, vbGrayText, "/invite [user] -- invite a user to join the clan"
        AddChat SelectedBot, vbGrayText, "/cpub -- send /clan public"
        AddChat SelectedBot, vbGrayText, "/cpriv -- send /clan private"
        AddChat SelectedBot, vbGrayText, "/decrypt or de [text] -- decrypt specified text"
        AddChat SelectedBot, vbGrayText, "/encrypt or en [text] -- encrypt specified text and send"
        AddChat SelectedBot, vbWhite, "NOTE: Double slashing will issue the command on ALL connected bots!"
        AddChat SelectedBot, vbWhite, vbNullString
        AddChat SelectedBot, vbWhite, "Available external commands:"
        AddChat SelectedBot, vbWhite, "[ATTRIBUTE] COMMAND -- DESCRIPTION"
        AddChat SelectedBot, vbGrayText, "[B] .cq or clearqueue -- clears queued messages"
        AddChat SelectedBot, vbGrayText, "[B] .ver -- send the version of the bot"
        AddChat SelectedBot, vbGrayText, "[B] .say or echo [text] -- send the text"
        AddChat SelectedBot, vbGrayText, "[B] .mp3 -- send the current track"
        AddChat SelectedBot, vbGrayText, "[B] .addquote -- add a quote to Quotes.txt"
        AddChat SelectedBot, vbGrayText, "[B] .nudge [user] -- nudge the specified user"
        AddChat SelectedBot, vbGrayText, "[B] .quote -- send a random quote from Quotes.txt"
        AddChat SelectedBot, vbGrayText, "[B] .profile or p -- request then send a users profile"
        AddChat SelectedBot, vbGrayText, "[B] .decrypt or de [text] -- decrypt specified text"
        AddChat SelectedBot, vbGrayText, "[B] .encrypt or en [text] -- encrypt specified text and send"
        AddChat SelectedBot, vbGrayText, "[C] .invite [user] -- invite a user to join the clan"
        AddChat SelectedBot, vbGrayText, "[C] .cpub -- send /clan public"
        AddChat SelectedBot, vbGrayText, "[C] .cpriv -- send /clan private"
        AddChat SelectedBot, vbGrayText, "[D] .add [user] [attributes] -- add user to database with specified attributes"
        AddChat SelectedBot, vbGrayText, "[D] .remove [user] -- remove user from the database"
        AddChat SelectedBot, vbGrayText, "[D] .find [user] -- find user in the database"
        AddChat SelectedBot, vbGrayText, "[J] .rejoin or rj -- rejoin the channel"
        AddChat SelectedBot, vbGrayText, "[J] .home or h -- join the home channel"
        AddChat SelectedBot, vbGrayText, "[J] .first -- join the product specific (first) channel"
        AddChat SelectedBot, vbGrayText, "[J] .force [channel] -- forcefully join the specified channel"
        AddChat SelectedBot, vbGrayText, "[M] .giveop [user] -- designate the user and resign ops"
        AddChat SelectedBot, vbGrayText, "[M] .ban [user] -- ban specified user"
        AddChat SelectedBot, vbGrayText, "[M] .kick [user] -- kick specified user"
        AddChat SelectedBot, vbGrayText, "[M] .ignore [user] -- ignore specified user"
        AddChat SelectedBot, vbGrayText, "[M] .unban [user] -- unban specified user"
        AddChat SelectedBot, vbGrayText, "[M] .unignore [user] -- unignore specified user"
    Else
        MsgBox "Invalid tab selected, cannot show commands!", vbExclamation
    End If
End Sub

Private Sub mnuConfig_Click()
    If (SelectedBot <> -1) Then
        frmConfigure.ProfileManager = False
        frmConfigure.Show
        frmConfigure.ShowProfile Bot(SelectedBot).Profile
    Else
        MsgBox "Please load or create a profile first!", vbExclamation
    End If
End Sub

Private Sub mnuConnect_Click()
    If (SelectedBot <> -1) Then Bot(SelectedBot).Connect Else MsgBox "Cannot connect, please ensure that a profile is loaded!", vbExclamation
End Sub

Private Sub mnuDisconnect_Click()
    If (SelectedBot <> -1) Then Bot(SelectedBot).Disconnect Else MsgBox "Cannot disconnect, please ensure that a profile is loaded!", vbExclamation
End Sub

Private Sub mnuIgnore_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            Bot(SelectedBot).SendText "/ignore " & Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text)
        End If
    Else
        MsgBox "Cannot ignore user, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuInvite_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            If Bot(SelectedBot).Self.Clanned Then
                If Bot(SelectedBot).Self.ClanRank = CLANRANKENUM.Chieftain Then
                    If InStrB(lvUsers(SelectedBot).SelectedItem.text, "@") > 0 Then
                        MsgBox "Cannot invite user, they are not on a Warcraft III client!", vbExclamation
                    Else
                        Bot(SelectedBot).SendText "/invite " & lvUsers(SelectedBot).SelectedItem.text
                    End If
                Else
                    MsgBox "Cannot invite user, you must be the Chieftain of a clan!", vbExclamation
                End If
            Else
                MsgBox "Cannot invite user, you are not in a clan!", vbExclamation
            End If
        Else
            MsgBox "Cannot invite user, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot invite user, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuLoad_Click()
    frmProfileManagement.Show
End Sub

Private Sub mnuLock_Click()
    mnuLock.Checked = Not mnuLock.Checked
    WriteIni AppData & "Settings.ini", "Settings", "Lock", YesNo(mnuLock.Checked)
End Sub

Private Sub mnuOfflineFriend_Click()
    mnuOfflineFriend.Checked = Not mnuOfflineFriend.Checked
    WriteIni AppData & "Settings.ini", "Settings", "OfflineFriend", YesNo(mnuOfflineFriend.Checked)
End Sub

Private Sub mnuOptimizeMemory_Click()
    Dim ws As Integer
    ws = Me.WindowState
    Me.WindowState = vbMinimized
    Me.WindowState = ws
    AddChat SelectedBot, vbGrayText, "Optimized memory usage, more resources should be available!"
End Sub

Private Sub mnuPausePlay_Click()
    Media.PausePlay
End Sub

Private Sub mnuPreviousTrack_Click()
    Media.PreviousTrack
End Sub

Private Sub mnuProfile_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            Bot(SelectedBot).SendText "/profile " & lvUsers(SelectedBot).SelectedItem.text
        Else
            MsgBox "Cannot get profile, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot get profile, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuProfileMP3_Click()
    mnuProfileMP3.Checked = Not mnuProfileMP3.Checked
    WriteIni AppData & "Settings.ini", "Settings", "ProfileMP3", YesNo(mnuProfileMP3.Checked)
End Sub

Private Sub mnuReadMe_Click()
    On Error GoTo hErr:
    ShellExecute Me.hWnd, "OPEN", AppData & "ReadMe.html", "", AppData & "ReadMe.html", 5
    Exit Sub
hErr:
    MsgBox "ReadMe file is missing!", vbExclamation
End Sub


Public Sub mnuShow_Click()
    Me.WindowState = vbNormal
    Me.Show
    frmTray.TrayDelete
End Sub

Private Sub mnuShowJoinLeave_Click()
    mnuShowJoinLeave.Checked = Not mnuShowJoinLeave.Checked
    WriteIni AppData & "Settings.ini", "Settings", "JoinLeave", YesNo(mnuShowJoinLeave.Checked)
End Sub

Private Sub mnuStats_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            Bot(SelectedBot).SendText "/stats " & lvUsers(SelectedBot).SelectedItem.text
        Else
            MsgBox "Cannot get stats, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot get stats, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuStopPlay_Click()
    Media.StopPlay
End Sub

Private Sub mnuDisableTicTacToe_Click()
    mnuDisableTicTacToe.Checked = Not mnuDisableTicTacToe.Checked
    WriteIni AppData & "Settings.ini", "Settings", "DisableTicTacToe", YesNo(mnuDisableTicTacToe.Checked)
End Sub


Private Sub mnuTray_Click()
    frmTray.TrayAdd frmBot.Title
    Me.Hide
End Sub

Private Sub mnuTTT_Click()
    If mnuDisableTicTacToe.Checked Then Exit Sub
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            If Bot(SelectedBot).Self.Username <> lvUsers(SelectedBot).SelectedItem.text Then
                Bot(SelectedBot).SendText "/w " & Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text) & " $_begin"
                Bot(SelectedBot).PendingTicTacToe = Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text)
            Else
                MsgBox "Cannot start Tic-Tac-Toe game with yourself!", vbExclamation
            End If
        Else
            MsgBox "Cannot start Tic-Tac-Toe, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot start Tic-Tac-Toe, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuUnignore_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            Bot(SelectedBot).SendText "/unignore " & Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text)
        Else
            MsgBox "Cannot unignore user, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot unignore user, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuUnload_Click()
    If (tbsProfile.Tabs.Count > 1) Then
        UnloadProfile tbsProfile.SelectedItem.Index
    Else
        MsgBox "You must have atleast one profile loaded!", vbExclamation
    End If
End Sub

Private Sub mnuVoidView_Click()
    mnuVoidView.Checked = Not mnuVoidView.Checked
    WriteIni AppData & "Settings.ini", "Settings", "VoidView", YesNo(mnuVoidView.Checked)
End Sub

Private Sub mnuWarCraftIcons_Click()
    mnuWarCraftIcons.Checked = Not mnuWarCraftIcons.Checked
    WriteIni AppData & "Settings.ini", "Settings", "WarCraftIcons", YesNo(mnuWarCraftIcons.Checked)
    Dim c As Control
    For Each c In Controls
        If (TypeName(c) = "ListView") Then
            Debug.Print c.Name & " : " & c.Index
            If c.ListItems.Count > 0 Then
                c.ListItems(1).EnsureVisible
                If mnuWarCraftIcons.Checked Then
                    SendMessage c.hWnd, LVM_SETIMAGELIST, LVSIL_SMALL, ByVal imlWarCraft.hImageList
                Else
                    SendMessage c.hWnd, LVM_SETIMAGELIST, LVSIL_SMALL, ByVal imlClassic.hImageList
                End If
                c.ListItems(c.ListItems.Count).EnsureVisible
                c.ListItems(1).EnsureVisible
            Else
                If mnuWarCraftIcons.Checked Then
                    Set c.SmallIcons = imlWarCraft
                Else
                    Set c.SmallIcons = imlClassic
                End If
            End If
        End If
    Next c
End Sub

Private Sub mnuWhisper_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            If LenB(cboSend.text) > 0 Then
                Bot(SelectedBot).SendText "/w " & Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text) & " " & cboSend.text
            Else
                cboSend.SelText = "/w " & Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text) & " "
                cboSend.SetFocus
                cboSend.SelStart = Len(cboSend.text)
            End If
        Else
            MsgBox "Cannot whisper user, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot send Nudge, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub mnuWhisperPanel_Click()
    mnuWhisperPanel.Checked = Not mnuWhisperPanel.Checked
    WriteIni AppData & "Settings.ini", "Settings", "WhisperPanel", YesNo(mnuWhisperPanel.Checked)
    Form_Resize
End Sub

Private Sub mnuWhisperWindows_Click()
    mnuWhisperWindows.Checked = Not mnuWhisperWindows.Checked
    WriteIni AppData & "Settings.ini", "Settings", "WhisperWindows", YesNo(mnuWhisperWindows.Checked)
End Sub

Private Sub mnuWhois_Click()
    If (SelectedBot <> -1) Then
        If lvUsers(SelectedBot).ListItems.Count > 0 Then
            Bot(SelectedBot).SendText "/whois " & Bot(SelectedBot).GetAccount(lvUsers(SelectedBot).SelectedItem.text)
        Else
            MsgBox "Cannot send whois, error occurred?!", vbCritical
        End If
    Else
        MsgBox "Cannot send whois, invalid tab selected!", vbExclamation
    End If
End Sub

Private Sub tbsProfile_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Or Button = vbMiddleButton Then
        Dim I As Integer
        For I = 1 To tbsProfile.Tabs.Count
            Dim Left As Long, Width As Long
            Left = tbsProfile.Tabs(I).Left
            Width = tbsProfile.Tabs(I).Width
            If X >= Left And X <= Left + Width Then tbsProfile.Tabs(I).Selected = True
        Next I
    End If
    ViewProfile tbsProfile.SelectedItem.Index
    
    If Button = vbMiddleButton Then
        mnuUnload_Click
    ElseIf Button = vbRightButton Then
        PopupMenu mnuBot, , tbsProfile.SelectedItem.Left, tbsProfile.Top + tbsProfile.Height, mnuConnect
    End If
End Sub

Private Sub tmrProfileVoid_Timer()
    On Error GoTo hErr
    Dim I As Integer
    For I = 1 To tbsProfile.Tabs.Count
        Dim intBot As Integer
        intBot = TabToBotIndex(I)
        If (intBot <> -1) Then
            If (Bot(intBot).IsOnline) Then
                If (mnuVoidView.Checked) And (Bot(intBot).Self.Channel = "The Void") Then
                    Bot(intBot).SendText "/unignore " & Bot(intBot).GetAccount(Bot(intBot).Self.Username)
                End If
                If (mnuProfileMP3.Checked) Then
                    Dim keys(1, 1) As String
                    keys(0, 0) = "profile\location"
                    keys(0, 1) = "MirageBot v" & App.Major & "." & App.Minor & " by Chriso"
                    keys(1, 0) = "profile\description"
                    If Media.MediaPlayer = None Then
                        keys(1, 1) = "Website: www.bnetdev.net"
                    Else
                        keys(1, 1) = "Now Playing: " & Media.Track & vbNewLine & _
                             "Website: www.bnetdev.net"
                    End If
                    Bot(intBot).SendWriteUserData keys
                End If
            End If
        End If
    Next
    Exit Sub
hErr:
    ErrorHandler "MainForm", "ProfileTimer"
End Sub

Public Sub tmrView_Timer()
    On Error GoTo hErr
    Dim intBot As Integer, tmp As String
    intBot = SelectedBot
    If (intBot <> -1) Then
        If LenB(Bot(intBot).Self.Channel) > 0 And Bot(intBot).IsOnline Then
            tmp = Title & " - " & Bot(intBot).Self.Username & " in #" & Bot(intBot).Self.Channel & "!"
        Else
            tmp = Title & " - Disconnected"
        End If
    Else
        tmp = Title
    End If
    If Caption <> tmp Then Caption = tmp
    
    Dim b As BNCS, imlTab As Integer
    For Each b In Bot
        imlTab = BotToTabIndex(b.BotIndex)
        If (imlTab <> -1) Then
            If (b.IsOnline) Then
                If (b.IsActive) Then
                    If tbsProfile.Tabs(imlTab).Image <> 4 Then tbsProfile.Tabs(imlTab).Image = 4
                Else
                    If tbsProfile.Tabs(imlTab).Image <> 3 Then tbsProfile.Tabs(imlTab).Image = 3
                End If
                Dim o As Integer
                For o = 1 To lvUsers(b.BotIndex).ListItems.Count
                    With lvUsers(b.BotIndex).ListItems.Item(o)
                        If GetGroupColor(Suffix(.text)) = -1 Then
                            If (LCase$(Suffix(.text)) = LCase$(b.Self.Username)) Then
                                If .ForeColor <> vbSkyBlue Then .ForeColor = vbSkyBlue
                            Else
                                If mnuIdleColoring.Checked Then
                                    Dim talkTime As Double, joinTime As Double
                                    talkTime = b.UserTalked(lvUsers(b.BotIndex).ListItems.Item(o).text)
                                    If talkTime > 0 Then
                                        If ((NowTickCount - talkTime) >= 480000) Then
                                            If .ForeColor <> &HA0A0A0 Then .ForeColor = &HA0A0A0
                                        Else
                                            If .ForeColor <> vbWhite Then .ForeColor = vbWhite
                                        End If
                                    Else
                                        joinTime = b.UserUptime(lvUsers(b.BotIndex).ListItems.Item(o).text)
                                        If ((NowTickCount - joinTime) >= 480000) Then
                                            If .ForeColor <> &HA0A0A0 Then .ForeColor = &HA0A0A0
                                        Else
                                            If .ForeColor <> vbWhite Then .ForeColor = vbWhite
                                        End If
                                    End If
                                Else
                                    If .ForeColor <> vbWhite Then .ForeColor = vbWhite
                                End If
                            End If
                        Else
                            If .ForeColor <> GetGroupColor(Suffix(.text)) Then .ForeColor = GetGroupColor(Suffix(.text))
                        End If
                    End With
                Next
            Else
                If (b.IsConnected) Then
                    If tbsProfile.Tabs(imlTab).Image <> 2 Then tbsProfile.Tabs(imlTab).Image = 2
                Else
                    If tbsProfile.Tabs(imlTab).Image <> 1 Then tbsProfile.Tabs(imlTab).Image = 1
                End If
            End If
        End If
    Next
    If Media.Opened And Media.MediaPlayer = iTunes And frmiTunes.Opened = False Then
        Unload frmiTunes
        Load frmiTunes
    End If
    If Media.MediaPlayer <> None Then
        Dim mt As String
        mt = Media.Track
        If lblTrack <> mt Then lblTrack = mt
    End If
    mnuPausePlay.Enabled = (Media.MediaPlayer <> None)
    mnuBeginPlay.Enabled = mnuPausePlay.Enabled
    mnuNextTrack.Enabled = mnuPausePlay.Enabled
    mnuPreviousTrack.Enabled = mnuPausePlay.Enabled
    mnuStopPlay.Enabled = mnuPausePlay.Enabled
    Exit Sub
hErr:
    ErrorHandler "MainForm", "ViewTimer"
End Sub
