VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmClanMembers 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Clan Members"
   ClientHeight    =   7215
   ClientLeft      =   150
   ClientTop       =   510
   ClientWidth     =   5055
   Icon            =   "frmClanMembers.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7215
   ScaleWidth      =   5055
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdDone 
      Caption         =   "Done"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4080
      TabIndex        =   5
      Top             =   6720
      Width           =   855
   End
   Begin VB.CommandButton cmdLeave 
      Caption         =   "&Leave"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1320
      TabIndex        =   4
      Top             =   6720
      Width           =   975
   End
   Begin VB.CommandButton cmdDisband 
      Caption         =   "&Disband"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   120
      TabIndex        =   3
      Top             =   6720
      Width           =   1095
   End
   Begin VB.TextBox txtMOTD 
      BackColor       =   &H00000000&
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   405
      Left            =   120
      TabIndex        =   2
      Top             =   6240
      Width           =   3615
   End
   Begin VB.CommandButton cmdSetMOTD 
      Caption         =   "&Set MOTD"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3840
      TabIndex        =   1
      Top             =   6240
      Width           =   1095
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   5400
      Top             =   4920
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   62
      ImageHeight     =   38
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   4
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmClanMembers.frx":164A
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmClanMembers.frx":1BC9
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmClanMembers.frx":2133
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmClanMembers.frx":26FC
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ListView lvUsers 
      Height          =   6015
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4815
      _ExtentX        =   8493
      _ExtentY        =   10610
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      HideColumnHeaders=   -1  'True
      FullRowSelect   =   -1  'True
      _Version        =   393217
      SmallIcons      =   "ImageList1"
      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           =   5097
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "Location"
         Object.Width           =   2822
      EndProperty
   End
   Begin VB.Menu mnuRClick 
      Caption         =   "RClick"
      Visible         =   0   'False
      Begin VB.Menu mnuDemote 
         Caption         =   "Demote"
      End
      Begin VB.Menu mnuPromote 
         Caption         =   "Promote"
      End
      Begin VB.Menu mnuMakeChieftain 
         Caption         =   "Make Chieftain"
      End
      Begin VB.Menu mnuLine00 
         Caption         =   "-"
      End
      Begin VB.Menu mnuRemove 
         Caption         =   "Remove"
      End
   End
End
Attribute VB_Name = "frmClanMembers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public Opened As Boolean
Public BotIndex As Integer
Private TT As New clsToolTip

Public Sub ClearMembers()
    lvUsers.ListItems.Clear
End Sub

Public Sub AddMember(ByRef cm As clsClanMember)
    If cm.Rank = 4 Then
        With lvUsers.ListItems.Add(1, , cm.Username, , IIf(cm.Rank = 0, 1, cm.Rank))
            .ListSubItems.Add , , cm.Location
            .ForeColor = IIf(cm.Online = 0, vbGrayText, vbWhite)
            .Tag = cm.Rank
        End With
    Else
        With lvUsers.ListItems.Add(, , cm.Username, , IIf(cm.Rank = 0, 1, cm.Rank))
            .ListSubItems.Add , , cm.Location
            .ForeColor = IIf(cm.Online = 0, vbGrayText, vbWhite)
            .Tag = cm.Rank
        End With
    End If
End Sub

Private Sub cmdDisband_Click()
    If frmBot.Bot(BotIndex).Self.ClanRank = CLANRANKENUM.Chieftain Then
        If MsgBox("Are you sure you want to KILL the clan?", vbCritical + vbYesNoCancel, "Disband Clan?!") = vbYes Then
            frmBot.Bot(BotIndex).SendClanDisband
            Unload Me
        End If
    Else
        MsgBox "You must be the chieftain of the clan in order to disband it!", vbExclamation, "Disband Clan"
    End If
End Sub

Private Sub cmdDone_Click()
    Unload Me
End Sub

Private Sub cmdLeave_Click()
    If MsgBox("Are you sure you want to LEAVE the clan?", vbCritical + vbYesNoCancel, "Leave Clan?!") = vbYes Then
        frmBot.Bot(BotIndex).SendClanLeave
        Unload Me
    End If
End Sub

Private Sub cmdSetMOTD_Click()
    If frmBot.Bot(BotIndex).Self.ClanRank = CLANRANKENUM.Chieftain Then
        frmBot.Bot(BotIndex).SendClanSetMOTD txtMOTD.text
    Else
        MsgBox "You must be the chieftain of the clan in order to change the clan message!", vbExclamation, "Set MOTD"
    End If
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Cancel = 0
    Opened = False
End Sub

Private Sub lvUsers_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim info As LVHITTESTINFO, itemIndex As Long
    If lvUsers.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.hWnd, LVM_HITTEST, 0, info) + 1
    If Val(lvUsers.Tag) <> itemIndex Then
        lvUsers.Tag = itemIndex
        If itemIndex = 0 Or itemIndex > lvUsers.ListItems.Count Then
            TT.Destroy
        Else
            Dim User As String, Rank As CLANRANKENUM, Status As Integer, Location As String
            User = lvUsers.ListItems(itemIndex).text
            Rank = frmBot.Bot(BotIndex).ClanMemberRank(User)
            Status = frmBot.Bot(BotIndex).ClanMemberStatus(User)
            Location = frmBot.Bot(BotIndex).ClanMemberLocation(User)
            
            TT.ForeColor = vbBlack
            TT.BackColor = &HC0FFFF
            TT.DelayTime = 250
            TT.Icon = TTIconInfo
            TT.Title = User
            TT.TipText = "Rank: " & ClanRankToString(CByte(Rank))
            Select Case Status
            Case &H0
                TT.TipText = TT.TipText & vbNewLine & "Status: Offline"
            Case &H1
                TT.TipText = TT.TipText & vbNewLine & "Status: Online"
            Case &H2
                TT.TipText = TT.TipText & vbNewLine & "Status: In channel: " & Location
            Case &H3
                TT.TipText = TT.TipText & vbNewLine & "Status: In public game: " & Location
            Case &H5
                TT.TipText = TT.TipText & vbNewLine & "Status: In private game: " & Location
            End Select
            TT.TipText = TT.TipText & vbNullChar
            TT.VisibleTime = 7000
            TT.Create lvUsers.hWnd
        End If
    End If
End Sub

Private Sub lvUsers_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Then
        PopupMenu mnuRClick, , , , mnuDemote
    End If
End Sub

Private Sub mnuDemote_Click()
    If lvUsers.ListItems.Count > 0 Then
        Dim Rank As CLANRANKENUM, MyRank As CLANRANKENUM
        Rank = frmBot.Bot(BotIndex).ClanMemberRank(lvUsers.SelectedItem.text)
        MyRank = frmBot.Bot(BotIndex).Self.ClanRank
        If (MyRank = Chieftain Or MyRank = Shaman) Then
            If (Rank > Peon) Then
                frmBot.Bot(BotIndex).SendClanRankChange lvUsers.SelectedItem.text, Rank - 1
            Else
                MsgBox "Cannot change this users rank its too low!", vbExclamation
            End If
        Else
            MsgBox "Your rank is not high enough to change this users rank!", vbExclamation
        End If
    Else
        MsgBox "No members in clan or list not received yet!", vbExclamation
    End If
End Sub

Private Sub mnuMakeChieftain_Click()
    If lvUsers.ListItems.Count > 0 Then
        frmBot.Bot(BotIndex).SendClanMakeChieftain lvUsers.SelectedItem.text
    Else
        MsgBox "No members in clan or list not received yet!", vbExclamation
    End If
End Sub

Private Sub mnuPromote_Click()
    If lvUsers.ListItems.Count > 0 Then
        Dim Rank As CLANRANKENUM, MyRank As CLANRANKENUM
        Rank = frmBot.Bot(BotIndex).ClanMemberRank(lvUsers.SelectedItem.text)
        MyRank = frmBot.Bot(BotIndex).Self.ClanRank
        If (MyRank = Chieftain Or MyRank = Shaman) Then
            If (Rank < Shaman) Then
                frmBot.Bot(BotIndex).SendClanRankChange lvUsers.SelectedItem.text, Rank + 1
            Else
                MsgBox "Cannot change this users rank its too high!", vbExclamation
            End If
        Else
            MsgBox "Your rank is not high enough to change this users rank!", vbExclamation
        End If
    Else
        MsgBox "No members in clan or list not received yet!", vbExclamation
    End If
End Sub

Private Sub mnuRemove_Click()
    If lvUsers.ListItems.Count > 0 Then
        frmBot.Bot(BotIndex).SendClanRemoveMember lvUsers.SelectedItem.text
    Else
        MsgBox "No members in clan or list not received yet!", vbExclamation
    End If
End Sub
