'////////////////////////////////////////////////////////////////////////
'// WHISPER CLAN SCRIPT FOR 9.4
'// WRITTEN BY: Chriso
'// This script will message all clan members a specified message.
'////////////////////////////////////////////////////////////////////////

'// Return Script Information
Sub Script(Name, Major, Minor, Build, Author, Commands, Description)
	Name = "Whisper Clan Script"
	Major = 1
	Minor = 0
	Build = 0
	Author = "Chriso"
	Commands = "wclan, wgrunt, winitiate, wpeon, wshaman"
	Description = "Whisper clan members a specified message"
End Sub

'// Called when the script is loaded for a particular bot
Sub Event_Load()
    CreateCommand "wclan", "WhisperClan", "Command_WClan", "", "message", "Message to send to all online clan members", 0, True
    CreateCommand "wshaman", "WhisperClan", "Command_WShaman", "", "message", "Message to send to all online shamans in the clan", 0, True
    CreateCommand "wgrunt", "WhisperClan", "Command_WGrunt", "", "message", "Message to send to all online grunts in the clan", 0, True
    CreateCommand "wpeon", "WhisperClan", "Command_WPeon", "", "message", "Message to send to all online peons in the clan", 0, True
    CreateCommand "winitiate", "WhisperClan", "Command_WInitiate", "winit", "message", "Message to send to all online initiates in the clan", 0, True
End Sub

'// Callback for "WClan" Command
Sub Command_WClan(CS)
    Dim Count, C, I, T
    Set C = Nothing
    Count = CS.Bot.Clan.Count
    For I = 0 To Count
        Set C = CS.Bot.Clan.GetByIndex(CInt(I))
        If Not C Is Nothing Then
            If C.Online = 1 Then 
                If LCase(C.Username) <> LCase(CS.Bot.Self.Username) Then
	            Send "/w " & C.Username & " " & CS.Message
                    T = T + 1
	        End If
            End If
        End If
    Next
    CS.Reply "Whispered " & T & " online members."
End Sub

'// Callback for "WShaman" Command
Sub Command_WShaman(CS)
    Dim Count, C, I, T
    Set C = Nothing
    Count = CS.Bot.Clan.Count
    For I = 0 To Count
        Set C = CS.Bot.Clan.GetByIndex(CInt(I))
        If Not C Is Nothing Then
            If C.Online = 1 And C.Rank = 3 Then 
                If LCase(C.Username) <> LCase(CS.Bot.Self.Username) Then
	            Send "/w " & C.Username & " " & CS.Message
                    T = T + 1
	        End If
            End If
        End If
    Next
    CS.Reply "Whispered " & T & " online shamans."
End Sub

'// Callback for "WGrunt" Command
Sub Command_WGrunt(CS)
    Dim Count, C, I, T
    Set C = Nothing
    Count = CS.Bot.Clan.Count
    For I = 0 To Count
        Set C = CS.Bot.Clan.GetByIndex(CInt(I))
        If Not C Is Nothing Then
            If C.Online = 1 And C.Rank = 2 Then 
                If LCase(C.Username) <> LCase(CS.Bot.Self.Username) Then
	            Send "/w " & C.Username & " " & CS.Message
                    T = T + 1
	        End If
            End If
        End If
    Next
    CS.Reply "Whispered " & T & " online grunts."
End Sub

'// Callback for "WPeon" Command
Sub Command_WPeon(CS)
    Dim Count, C, I, T
    Set C = Nothing
    Count = CS.Bot.Clan.Count
    For I = 0 To Count
        Set C = CS.Bot.Clan.GetByIndex(CInt(I))
        If Not C Is Nothing Then
            If C.Online = 1 And C.Rank = 1 Then 
                If LCase(C.Username) <> LCase(CS.Bot.Self.Username) Then
	            Send "/w " & C.Username & " " & CS.Message
                    T = T + 1
	        End If
            End If
        End If
    Next
    CS.Reply "Whispered " & T & " online peons."
End Sub

'// Callback for "WInitiate" Command
Sub Command_WInitiate(CS)
    Dim Count, C, I, T
    Set C = Nothing
    Count = CS.Bot.Clan.Count
    For I = 0 To Count
        Set C = CS.Bot.Clan.GetByIndex(CInt(I))
        If Not C Is Nothing Then
            If C.Online = 1 And C.Rank = 0 Then 
                If LCase(C.Username) <> LCase(CS.Bot.Self.Username) Then
	            Send "/w " & C.Username & " " & CS.Message
                    T = T + 1
	        End If
            End If
        End If
    Next
    CS.Reply "Whispered " & T & " online initiates."
End Sub