Author Topic: PluginMakeOfficial test  (Read 536 times)

Vector

  • Administrator
  • Hero Member
  • *****
  • Posts: 550
    • View Profile
    • http://clanmage.phost.ws
PluginMakeOfficial test
« on: December 17, 2008, 07:00:06 PM »
Generated by http://rev77.net/PluginMakeOfficial.vbs

[size=]Revision 77 Plugin Manager v0.36[/size]

Author: Vector
Explanation: Allows you to get plugins off of the Revision 77 Plugin Server
Commands:
/r77 updates [hide]
Views all the updated plugins on the server. Use [all] to display every plugin on the server. Ex: /r77 updates all
/r77 get <prefix>
Allows you to get a plugin off the server
/r77 del <prefix>
Allows you to delete a plugin from your computer
/r77 insert list
views all functions that you may insert into your plugiin
/r77 insert preview <function>
allows you to view a function before placing it into your plugin
/r77 insert <function> into <prefix>
allows you to place a function into your plugin. If you add "--new <plugin name>" It will create a new plugin with the function insierted into it
/r77 open <prefix>
allows you to open up a plugin for editing
/r77 cats [category]
views the plugin categories up on the server
/r77 nosplash
toggles load information
/r77 list
views all plugins on your folder that have been downloaded from the plugins server

Important Notes:
  • Make sure to replace the "." in the commands with your bot's trigger.
[/color]


[code]'r77
'0.351
'&Rev77 PlugIn System companion:VecTor:MIni PlugIn System For Rev77.net
'&r77 upDates - retrieves plugIn upDates:r77 get <prefix> - DownLoads plugIn by prefix:r77 plugIns - lists all your plugIns from the server
'&
'&Replace the trigger with "/". These commands are only available Inside the bot.

Private upDatePSTimer
upDatePSTimer = True

Dim plugCount, fso, upDateCount

Public DoNotUpDate
DoNotUpDate = False

upDateCount = 0
plugCount = 0

Dim wscRun

'-- Version HisTory

'// Ver 0.351

'//  -Backs up all plugIns that currently exist In your plugIn folder (Thanks Ribose)

'// Ver 0.35

'//  -Added a new switch: /r77 Insert <function> InTo <prefix> [--new <plugIn path>]
'//   this will create a new plugIn with <prefix> as the prefix with the function
'//   Inserted InTo it
'//  -Opens all plugIns by default when you Insert functions InTo them
'//  -Made the Wscript object "wscRun" Public, as it has more than one use.

'// Ver 0.34, 0.341 and 0.342

'//  -Inverted the output of the /r77 upDates command. By default
'//   it will show only upDates. Type /r77 upDates all To view all plugIns
'//  -Changed the auTomatic upDate Timer To Instead list plugIn upDates
'//   If there are any
'//  -MInor modIfication To the AddChats In the /r77 upDates command

'// Ver 0.331

'//  -The /r77 open command will now open plugIns with notepad
'//   which allows the plugIn manager To open plugIn files whose extensions
'//   were not registered

'// Ver 0.33

'//  -Added a boolean that you can use To turn the auTomatic upDate Timer on or off
'//   defaults To True
'//  -Fixed nosplash command

'// Ver 0.32 and 0.321

'//  -Scripts will auTomatically reLoad If the bot is on beta
'//  -Added a settIng To disable Load InFormation
'//  -Added a Timer To check For upDates. Defaults To 25 mInutes.

'// Ver 0.30 and 0.31

'//  -Separated plugIn upDates from user plugIn upDate
'//   so I could focus on whichever one
'//  -Shortened output of plugIns on plugIn server

'// Ver 0.29

'// -Added Functions.txt Constant FUNCTIONS_URL
'// -Added three new commands:
'//   -/r77 Insert list - gets a list of all functions/subs
'//    In the "Useful Subs and Functions" Topic

'//   -/r77 Insert preview <function> - preview the code
'//    of <function>

'//   -/r77 Insert <function> InTo <prefix>
'//    Inserts that function InTo the plugIn
'//    as specIfied by <prefix>

'// -Created functions.txt file which will contaIn all
'//  functions you can Insert InTo plugIns
'// -Added function Insertion ability
'// -Added a Constant To easily access plugIn server control
'// -More InFormation on /r77 cats command
'// -Added more error handlIng
'// -Added a help context command
'// -/r77 open, edit now poInts To the user's plugIns folder
'//  Instead of at the upDate server (so you can open any plugIn)

'// Ver 0.28

'// -User's prefix is now lowerCased In dicUserVersions
'// -UpDated backup code
'// -Replaced "dicPl" with "dic" For simplicity

'// Ver 0.27

'// -MInor upDates

'// Ver 0.26

'// -Backs up plugIns with existIng prefixes Instead of deletIng them (Thanks Racial)
'// -Shows the proper plugIn description of DownLoaded plugIns
'// -Changed the DownLoad location of required files To /scripts/deps
'// (required files are additional files a plugIn needs To run)
'// -Added more InFormation on Event_Load()

'// Ver 0.25

'// -Added some more InFormation on the category system In 0.24
'// -Each Time this command is used, the plugIn upDates are refreshed

'// Ver 0.24

'// -Added a cats, category command To get all plugIn categories
'//  and the plugIns In each category
'// - /r77 cats [category] will show you all plugIns In that category

'// Ver 0.23

'// -Added some error handlIng In relation To updatIng the plugIn manager
'// -Backed-up files will now have the version number of the manager backed-up
'// -Indicates If your plugIns have upDates To them, only If they Do
'//  usIng Cyan Instead of Green, To make it stand out more.

'// Ver 0.22

'// MInor fixes

'// Ver 0.21

'// MInor changes In plugIn and pscall.asp file

'// Ver 0.2
'// Fixed a type castIng error prEventIng newer plugIn upDates, and old plugIns
'// from beIng showed on the upDates list
'// (0.1, 0.2, etc. were beIng shown as 0 To the plugIn. Ex. 0 = 0 (plugIn wasn't DownLoaded)
'// -Implemented an upDate manager (so you Don't have To re-DownLoad it each Time)

'// Ver 0.1
'// This is a plugIn manager designed To DownLoad plugIns off the Rev77.net plugIn server

Const UPDATE_PS_URL = "http://clanmage.phost.ws/Rev77PS.plug"
Const UPDATE_URL = "http://Rev77.net/scripts/pscall.asp?query=upDate"
Const PSCALL_STUB = "http://rev77.net/scripts/pscall.asp"
Const FUNCTIONS_URL = "http://rev77.net/scripts/deps/Functions.txt"

Set dicCrit = CreateObject("ScriptIng.Dictionary")
Set dicUpDates = CreateObject("ScriptIng.Dictionary")
Set dicVersions = CreateObject("ScriptIng.Dictionary")
Set dicDescriptions = CreateObject("ScriptIng.Dictionary")
Set dicAuthors = CreateObject("ScriptIng.Dictionary")
Set dicURLs = CreateObject("ScriptIng.Dictionary")
Set dicUserPlugIns = CreateObject("ScriptIng.Dictionary")
Set dicUserVersions = CreateObject("ScriptIng.Dictionary")
Set dicFileList = CreateObject("ScriptIng.Dictionary")
Set dicCats = CreateObject("ScriptIng.Dictionary")
Set dicCatCount = createObject("ScriptIng.Dictionary")

Sub r77_Event_Load()
  getPlugs = scInet.OpenURL(UPDATE_URL)

  Set fso = CreateObject("ScriptIng.FileSystemObject")
  Set wscRun = CreateObject("Wscript.Shell")

  Call parsePlugIns(getPlugs)
  Call upDateUserPlugIns()
  Call countUpDates()

  If GetSettIng("r77", "DoNotShowList") = "" Then
     SetSettIng "r77", "DoNotShowList", "False", "", True
     DoNotShowList = False
  Else
    DoNotShowList = GetSettIng("r77", "DoNotShowList")
  End If

  AddChat vbGreen, "[R77] PlugIn System companion v" & psVersions.Item("r77") & " written by VecTor Loaded."

  If Not DoNotShowList Then
    AddChat vbGreen, "[R77] Loaded " & plugCount & " plugIns from the Rev77.net PlugIns Server."
    AddChat vbGreen, "[R77] There are " & dicVersions.Count & " plugIns on the server."
  End If

  If upDateCount > 0 Then
    AddChat vbCyan, "[R77] " & upDateCount & " of your plugIns have upDates To them on the Rev77.net server."
    AddChat vbCyan, "[R77] Type /r77 upDates hide To view the upDates."
  End If

  If Not DoNotShowList Then
    AddChat vbYellow, "[R77] Type /r77 cats For plugIn categories."
    AddChat vbGreen, "[R77] Type /r77 upDates To view the plugIns on the server."
    AddChat vbGreen, "[R77] Type /r77 help Fore more InFormation."
    AddChat vbCyan, "[R77] To disable these Messages, type /r77 nosplash."
    AddChat vbCyan, "[R77] To keep up with what I've added, type /r77 edit r77 and look at the ""version hisTory."""
  End If

  Call upDatePS()

  TimerInterval "r77", "upDateTimer", 1500
    TimerEnabled "r77", "upDateTimer", upDatePSTimer
End Sub

Sub refresh()
  dicCrit.RemoveAll
  dicUpDates.RemoveAll
  dicVersions.RemoveAll
  dicDescriptions.RemoveAll
  dicAuthors.RemoveAll
  dicURLs.RemoveAll
  dicUserPlugIns.RemoveAll
  dicUserVersions.RemoveAll
  dicFileList.RemoveAll
  dicCats.RemoveAll
  dicCatCount.RemoveAll
End Sub

Sub parsePlugIns(getPlugs)
  parseLInes = Split(getPlugs, "<br />")

  If Ubound(parseLInes) = 0 Then
    AddChat vbRed, "[R77] The plugIn server has encountered an error."
    AddChat vbRed, "[R77] Try agaIn In a few mInutes."
    DoNotUpDate = True
  End If


  For i=0 To Ubound(parseLInes) - 1
    getPS = Split(parseLInes(i), "|")

    plScriptPath = getPS(0)
    plPrefix = LCase(getPS(1))
    plVersion = getPS(2)
    plDescribe = getPS(3)
    plImpInfo = getPS(4)
    plURL = getPS(5)
    fLInes = getPS(6)
    plCat = getPS(7)

    If dicUpDates.Exists(plPrefix) Then
      AddChat vbRed, "[R77] There is a duplicate prefix: " & plPrefix
      AddChat vbRed, "[R77] OrigInal plugIn: " & dicUpDates.Item(plPrefix)
      AddChat vbRed, "[R77] PlugIn In conflict: " & plScriptPath
      AddChat vbRed, "[R77] PlugIn will not be queried"
      AddChat vbRed, "[R77] You should change the prefix In either of these plugIns"
    Else
      dicUpDates.Item(plPrefix) = plScriptPath
      dicCats.Item(plPrefix) = plCat
      dicCatCount.Item(plCat) = dicCatCount.Item(plCat) + 1
      If plImpInfo <> "" Then dicCrit.Item(plPrefix) = plImpInfo Else plImpInfo = ""
      If plURL <> "" Then dicURLs.Item(plPrefix) = "http://Forums.Rev77.net/Index.php?showTopic=" & plURL Else plUrl = ""
      If fLInes <> "" Then dicFileList.Item(plPrefix) = getPS(6)

      uSpl = Ubound(Split(plDescribe, ":"))

      If uSpl >= 1 Then dicAuthors.Item(plPrefix) = Split(plDescribe, ":")(1)

      dicVersions.Item(plPrefix) = plVersion
      dicDescriptions.Item(plPrefix) = plPrefix & "|" & plVersion & "|" & plDescribe & "|" & plImpInfo
    End If
  Next
End Sub

Sub upDateUserPlugIns()
  plugCount = 0
  Set plugInPath = fso.GetFolder(BotPath() & "\plugIns").Files

  For Each file In plugInPath
    fIndExt = Right(file, 5)
    If LCase(fIndExt) = ".plug" And file.Size > 0 Then
      Set openPlug = fso.OpenTextFile(file, 1, True)
      getLIne = Split(openPlug.ReadAll, vbNewLIne)
      openPlug.Close

      sFile = Split(file, "\")
      uFile = sFile(Ubound(sFile))

      uPrefix = LCase(Mid(getLIne(0), 2))
      uVersion = Mid(getLIne(1), 2)

      dicUserPlugIns.Item(uPrefix) = uFile
      dicUserVersions.Item(uPrefix) = uVersion

      If dicUpDates.Exists(uPrefix) Then plugCount = plugCount + 1
    End If
  Next
End Sub

Sub countUpDates()
  For each key In dicUpDates.Keys
    usrVer = dicUserVersions.Item(key)
    plVer = dicVersions.Item(key)

    If usrVer <> "" Then
      If cDBL(plVer) > cDBL(usrVer) Then
        upDateCount = upDateCount + 1
      End If
    End If
  Next
End Sub


Sub r77_Event_PressedEnter(text)
  If Not Left(text, 1) = "/" Then Exit Sub

  cmd = Split(Mid(LCase(Trim(text)), 2), " ")
  ucmd = Ubound(cmd)

  If cmd(0) <> "r77" Then Exit Sub

  If ucmd = 0 Then
    AddChat vbRed, "[R77] Invalid command. Type /phelp r77 For more InFormation."
    Exit Sub
  End If

  Select Case cmd(1)
    Case "nosplash"
      VeToThisMessage
      If DoNotShowList Then
        DoNotShowList = False
        SetSettIng "r77", "DoNotShowList", "False", "", True
        AddChat vbGreen, "[R77] Load Messages will be shown."
      Else
        DoNotShowList = True
        SetSettIng "r77", "DoNotShowList", "True", "", True
        AddChat vbGreen, "[R77] Load Messages will not be shown."
      End If
    Case "help"
      VeToThisMessage
      Call r77_help_command()
    Case "upDates"
      showAll = False

      getPlugs = scInet.OpenURL(UPDATE_URL)
      Call refresh()
      Call parsePlugIns(getPlugs)
      Call upDateUserPlugIns()
      VeToThisMessage

      If DoNotUpDate Then
        DoNotUpDate = False
        Exit Sub
      End If

      If ucmd > 2 Then Exit Sub
      If ucmd = 2 Then If cmd(2) = "all" Then showAll = True

      AddChat vbWhite, "[R77] PlugIn Server PlugIn list"
      AddChat vbWhite, " "
      AddChat vbGreen, "[R77] PlugIns LegEnd:"
      AddChat vbWhite, " "

      AddChat vbCyan, "[R77] There is an upDate To this plugIn"
      AddChat vbOrange, "[R77] PlugIn hasn't been DownLoaded"
      AddChat vbRed, "[R77] Important Notes Included with this plugIn"
      AddChat vbYellow, "[R77] There are no upDates To this plugIn"
      AddChat vbWhite, " "

      AddChat vbWhite, " "

      Dim valueColor, cyanCount

      For each key In dicUpDates.Keys
        usrVer = dicUserVersions.Item(key)
        plVer = dicVersions.Item(key)

        getPlDescribe = Split(dicDescriptions.Item(key), "|")

        getPrefix = getPlDescribe(0)
        getVersion = getPlDescribe(1)
        getDescribe = getPlDescribe(2)
        getImpInfo = getPlDescribe(3)

        SplitFurther = Split(getDescribe, ":")        
        uSpl = Ubound(SplitFurther)

        If uSpl < 0 Then
          getDescription = "No description"
          getAuthor = "Unknown"
          getUse = "No Info"
        ElseIf uSpl = 0 Then
          getDescrption = SplitFurther(0)
          getAuthor = "Unknown"
          getUse = "No Info"
        Else
          getDescription = SplitFurther(0)
          getAuthor = SplitFurther(1)
          If uSpl = 2 Then
            getUse = SplitFurther(2)
          Else
            getUse = "No Info"
          End If
        End If

        If dicCrit.Exists(key) Then
           valueColor = vbRed
        ElseIf cDBL(usrVer) = cDBL(0) Then
          valueColor = vbOrange
        Else
          If cDBL(plVer) > cDBL(usrVer) Then
            valueColor = vbCyan
            cyanCount = cyanCount + 1
          ElseIf cDBL(plVer) = cDBL(usrVer) Then
            valueColor = vbYellow
          End If
        End If

        If Not showAll Then
          If valueColor = vbCyan Then
            AddChat valueColor, "Full name: " & dicUpDates.Item(key) & " by " & getAuthor & " (" & getUse & ")"
            AddChat valueColor, "Prefix: " & getPrefix
            AddChat valueColor, "Version: " & getVersion & " (your version: " & dicUserVersions.Item(key) & ")"
            AddChat valueColor, "Description: " & getDescription
            If dicURLs.Exists(key) Then AddChat valueColor, "Visit " & dicURLs.Item(key) & " For more InFormation."
            AddChat valueColor, " "
          End If
        Else
          AddChat valueColor, "Prefix: " & getPrefix
          AddChat valueColor, "Full name: " & dicUpDates.Item(key) & " by " & getAuthor & " (" & getUse & ")"

          If valueColor = vbCyan Then
            AddChat valueColor, "Version: " & getVersion & " (your version: " & dicUserVersions.Item(key) & ")"
          Else
            AddChat valueColor, "Version: " & getVersion
          End If

          AddChat valueColor, "Description: " & getDescription
          If dicURLs.Exists(key) Then AddChat valueColor, "Visit " & dicURLs.Item(key) & " For more InFormation."
          AddChat valueColor, " "
        End If
      Next

      If cyanCount = 0 Then AddChat vbGreen, "[R77] There are no upDated plugIns on the plugIns server."
      AddChat vbYellow, "[R77] Type /r77 get <prefix> To DownLoad one of the plugIns from this list."

      If Not showAll Then
        AddChat vbWhite, "[R77] Only upDates To your plugIns have been shown."
        AddChat vbWhite, "[R77] If you want To view all plugIns on the server, type /r77 upDates all"
      End If
    'Case "stats"
      'VeToThisMessage
      'AddChat vbWhite, "Statistics For the rev77.net plugIns server:"
      'AddChat vbWhite, " "

      'content = scInet.OpenURL(PSCALL_STUB & "?query=stat&Event=view")
      'AddChat vbGreen, content
    Case "Insert"
      If ucmd < 2 Then Exit Sub
      VeToThisMessage

      Select Case cmd(2)
        Case "list"
          content = scInet.OpenURL(FUNCTIONS_URL)

          getFunctions = Split(Split(content, "<FunctionList>")(1), "</FunctionList")(0)
          SplitFunctions = Split(getFunctions, ", ")

          For i=0 To Ubound(SplitFunctions)
            getCode = Split(Split(content, "<" & SplitFunctions(i) & ">")(1), "</" & SplitFunctions(i) & ">")(0)
            getName = Split(Split(getCode, "<name>")(1), "</name>")(0)
            getAuthor = Split(Split(getCode, "<author>")(1), "</author>")(0)
            getDescript = Split(Split(getCode, "<description>")(1), "</description>")(0)

            If InStr(getCode, "<anotes>") Then
              getImpNote = Split(Split(content, "<anotes>")(1), "</anotes>")(0)
            End If

            AddChat vbWhite, "Function: " & getName
            AddChat vbWhite, "Author: " & getAuthor
            AddChat vbWhite, "Details: " & getDescript
            If getImpNote <> "" Then AddChat vbWhite, "Important Notes: " & getImpNote
            AddChat vbWhite, " "            
            getImpNote = ""
          Next
          AddChat vbYellow, "[R77] Type /r77 Insert preview <function> To view that function's code."
        Case "preview"
          content = scInet.OpenURL(FUNCTIONS_URL)

          getFunctions = Split(Split(content, "<FunctionList>")(1), "</FunctionList")(0)
          SplitFunctions = Split(getFunctions, ", ")

          If InArray(SplitFunctions, cmd(3)) Then
            getElement = ReturnElement(SplitFunctions, cmd(3))
            getElement = Replace(getElement, "?", "")

            contentCode = Split(Split(Split(content, "<" & getElement & ">")(1), "<code>" & vbNewLIne)(1), vbNewLIne & "  </code>")(0)
            SplitLInes = Split(contentCode, vbNewLIne)

            AddChat vbYellow, "Code For the function: " & getElement
            AddChat vbYellow, " "
            For i=0 To Ubound(SplitLInes)
              AddChat vbWhite, SplitLInes(i)
            Next
            AddChat vbWhite, " "
            AddChat vbWhite, "[R77] If you want To add this To one of your plugIns, type /r77 Insert " & getElement & " InTo <prefix>."
          Else
            AddChat vbRed, "[R77] Invalid function."
          End If
        Case Else
          If ucmd < 4 Or LCase(cmd(3)) <> "InTo" Then
            AddChat vbWhite, "[R77] Syntax error. Example: /r77 Insert InArray InTo gtw"
            Exit Sub
          End If

          makeNew = False
          getFile = vbNullStrIng

          If ucmd >= 5 And ucmd < 7 Then
            If LCase(cmd(5)) <> "--new" Then
              AddChat vbRed, "[R77] Invalid switch. Should be --new."
              Exit Sub
            End If

            makeNew = True

            If ucmd <> 6 Then
              AddChat vbRed, "[R77] No filename specIfied after the --new switch."
              AddChat vbRed, "[R77] Example: /r77 Insert CommandProcessor InTo game --new game.plug"
            Else
              getFile = cmd(6)
            End If
          End If

          content = scInet.OpenURL(FUNCTIONS_URL)

          getFunctions = Split(Split(content, "<FunctionList>")(1), "</FunctionList")(0)
          SplitFunctions = Split(getFunctions, ", ")

          If InArray(SplitFunctions, cmd(2)) Then
            getElement = ReturnElement(SplitFunctions, cmd(2))

            contentCode = Split(Split(Split(content, "<" & getElement & ">")(1), "<code>" & vbNewLIne)(1), vbNewLIne & "  </code>")(0)
            contentCode = Replace(contentCode, "?", "")

            If getElement = "CommandProcessor" Then contentCode = Replace(contentCode, "%prefix%", LCase(cmd(4)))

            If Not dicUserPlugIns.Exists(cmd(4)) And Not makeNew Then
              AddChat vbRed, "[R77] That is an Invalid prefix. type /r77 plugIns For proper prefixes."
            Else
              If Not makeNew Then
                getFile = dicUserPlugIns.Item(cmd(4))
                Set addCode = fso.OpenTextFile(BotPath() & "plugIns\" & getFile, 8, True)
                addCode.Write vbNewLIne & vbNewLIne & contentCode
                addCode.Close
              Else
                Set addCode = fso.OpenTextFile(BotPath() & "plugIns\" & getFile, 2, True)
                AddCode.WriteLIne "'" & LCase(cmd(4))
                AddCode.WriteLIne "'0.1"
                addCode.Write vbNewLIne & contentCode
                addCode.Close
              End If

              If Not makeNew Then
                AddChat vbGreen, "[R77] Successfully Inserted the function " & getElement & " InTo " & getFile
                AddChat vbWhite, "[R77] OpenIng plugIn so that you can work on it..."
                wscRun.Run("notepad """ & BotPath() & "plugIns\" & getFile & """")
              Else
                AddChat vbGreen, "[R77] Successfully created a new plugIn with prefix """ & cmd(4) & """ and Inserted the function " & getElement & " InTo it."
                AddChat vbWhite, "[R77] OpenIng plugIn so that you can work on it..."
                wscRun.Run("notepad """ & BotPath() & "plugIns\" & getFile & """")
              End If
            End If
          Else
            AddChat vbRed, "[R77] Invalid function."
          End If
      End Select
    Case "cats", "categories"
      getPlugs = scInet.OpenURL(UPDATE_URL)
      Call refresh()
      Call parsePlugIns(getPlugs)
      VeToThisMessage

      If DoNotUpDate Then
        DoNotUpDate = False
        Exit Sub
      End If

      If ucmd = 1 Then
        AddChat vbWhite, "[R77] PlugIns by category: (" & dicVersions.Count & " plugIns Total)"
        AddChat vbWhite, " "
        For Each key In dicCatCount.Keys
          AddChat vbYellow, "[R77] " & key & " (" & dicCatCount.Item(key) & " plugIns)"
        Next
        AddChat vbWhite, " "
        AddChat vbYellow, "[R77] Type /r77 cats <category> To view all plugIns In that category"
      Else
        getCat = Split(Text, cmd(1) & " ")(1)

        For each testForCat In dicCats.Keys
          getItem = dicCats.Item(testForCat)
          If LCase(getCat) = LCase(getItem) Then
            foundItem = getItem
            Exit For
          End If
        Next

        If foundItem = "" Then
          AddChat vbRed, "[R77] That is not a valid category. Type /r77 cats For categories"
          Exit Sub
        End If

        AddChat vbWhite, "[R77] PlugIns In category: " & foundItem
        AddChat vbWhite, " "

        For each plugIn In dicCats.Keys
          If LCase(dicCats.Item(plugIn)) = LCase(getCat) Then
            getPlDescribe = Split(dicDescriptions.Item(plugIn), "|")

            getPrefix = getPlDescribe(0)
            getVersion = getPlDescribe(1)
            getDescribe = getPlDescribe(2)
            getImpInfo = getPlDescribe(3)

            SplitFurther = Split(getDescribe, ":")        
            uSpl = Ubound(SplitFurther)

            If uSpl < 0 Then
              getDescription = "No description"
              getAuthor = "Unknown"
              getUse = "No Info"
            ElseIf uSpl = 0 Then
              getDescrption = SplitFurther(0)
              getAuthor = "Unknown"
              getUse = "No Info"
            Else
              getDescription = SplitFurther(0)
              getAuthor = SplitFurther(1)
              If uSpl = 2 Then
                getUse = SplitFurther(2)
              Else
                getUse = "No Info"
              End If
            End If

            AddChat vbYellow, "Prefix: " & getPrefix
            AddChat vbYellow, "Full name: " & dicUpDates.Item(plugIn) & " (" & getUse & ")"
            AddChat vbYellow, "Version: " & getVersion
            AddChat vbYellow, "Author: " & getAuthor
            AddChat vbYellow, "Description: " & getDescription
            If dicURLs.Exists(key) Then AddChat vbYellow, "Visit " & dicURLs.Item(key) & " For more InFormation."
            AddChat vbYellow, " "
          End If
        Next
        AddChat vbYellow, "[R77] Type /r77 get <prefix> To DownLoad that plugIn"
      End If
    Case "get", "DownLoad"
      If ucmd <> 2 Then Exit Sub

      getPlugs = scInet.OpenURL(UPDATE_URL)
      Call refresh()
      Call parsePlugIns(getPlugs)
      Call upDateUserPlugIns()
      VeToThisMessage

      If DoNotUpDate Then
        DoNotUpDate = False
        Exit Sub
      End If

      If Not dicUpDates.Exists(cmd(2)) Then
        AddChat vbRed, "[R77] That plugIn prefix """ & cmd(2) & """ Does not exist on the plugIns server."
        Exit Sub
      End If

      getFilePath = dicUpDates.Item(cmd(2))
      getFileList = dicFileList.Item(cmd(2))

      If dicUserPlugIns.Exists(cmd(2)) Then
        usrFile = dicUserPlugIns.Item(cmd(2))
        plugFile = dicUpDates.Item(cmd(2))

        If plugFile <> usrFile Then
          AddChat vbRed, "[R77] The prefix """ & cmd(2) & """ already exists on your computer."
          AddChat vbRed, "[R77] BackIng up """ & dicUserPlugIns.Item(cmd(2)) & """ To prEvent any side effects."
          If Not fso.FolderExists("backup") Then fso.CreateFolder("backup")
          fso.CopyFile BotPath() & "plugIns\" & usrFile, BotPath() & "backup\" & usrFile
          fso.DeleteFile(BotPath() & "plugIns\" & usrFile)
        End If
      End If

      If dicUserPlugIns.Exists(cmd(2)) Then
        AddChat vbGreen, "BackIng up "& dicUserPlugIns.Item(cmd(2)) & "..."

        getFile = dicUserPlugIns.Item(cmd(2))
        getFile = Replace(getFile, ".plug", "")
        getVer = dicUserVersions.Item(cmd(2))

        fso.CopyFile BotPath() & "plugIns\" & getFile & ".plug", BotPath() & "backup\" & getFile & "(" & getVer & ").plug"
      End If

      AddChat vbYellow, "[R77] DownLoadIng " & getFilePath & "..."

      content = scInet.OpenURL("http://Rev77.net/scripts/pscall.asp?query=view&script=" & getFilePath)
      content = Replace(content, "<pre>", "")
      content = Replace(content, "</pre>", "")

      Set savePlugIn = fso.OpenTextFile(BotPath() & "plugIns\" & getFilePath, 2, True)
      savePlugIn.Write content
      savePlugIn.Close

      If dicAuthors.Exists(cmd(2)) Then
        getDescription = Split(Split(dicDescriptions.Item(cmd(2)), "|")(2), ":")(0)
        AddChat vbGreen, "[R77] " & getDescription & " by " & dicAuthors.Item(cmd(2)) & " DownLoaded successfully."
      Else
        AddChat vbGreen, "[R77] " & getFilePath & " DownLoaded successfully."
      End If

      If getFileList <> "" Then
        getFiles = Split(getFileList, ":")

        For i=0 To Ubound(getFiles)
          AddChat vbYellow, "[R77] DownLoadIng " & getFiles(i) & "..."

          content = scInet.OpenURL("http://Rev77.net/scripts/pscall.asp?query=view&script=deps\" & getFiles(i))
          content = Replace(content, "<pre>", "")
          content = Replace(content, "</pre>", "")

          Set savePlugIn = fso.OpenTextFile(BotPath() & "plugIns\" & getFiles(i), 2, True)
          savePlugIn.Write content
          savePlugIn.Close
          AddChat vbGreen, "[R77] " & getFiles(i) & " DownLoaded successfully."
        Next
      End If
      'result = scInet.OpenURL(PSCALL_STUB & "?query=stat&Event=DownLoad&script=" & dicUpDates.Item(cmd(2)))
      'addchat vbGreen, result

      If InStr(LCase(GetBotVersion), "beta") Then
        AddChat vbGreen, "[R77] PlugIn manager is reLoadIng your scripts..."
        Call reLoadScript()
      Else
        AddChat vbGreen, "[R77] ReLoad your scripts To Load the plugIn."
      End If

      If dicCrit.Exists(cmd(2)) Then AddChat vbRed, "[R77] Important Note: " & dicCrit.Item(cmd(2))
    Case "open", "edit"
      VeToThisMessage
      Call upDateUserPlugIns()
      If Not dicUserPlugIns.Exists(cmd(2)) Then
        AddChat vbRed, "[R77] Invalid prefix. Unable To open file."
        Exit Sub
      End If

      wscRun.run("notepad """ & BotPath() & "plugIns\" & dicUserPlugIns.Item(cmd(2)) & """")
    Case "list", "plugIns"
      VeToThisMessage
      Call upDateUserPlugIns()

      AddChat vbWhite, "[R77] DisplayIng only those plugIns you have that exist on the Rev77.net PlugIn Server."
      AddChat vbWhite, "[R77] Type /plugIns To see all your plugIns."
      AddChat vbWhite, " "

      idx = 0

      For each key In dicUserPlugIns.Keys
        If dicDescriptions.Exists(key) Then
          getPlDescribe = Split(dicDescriptions.Item(key), "|")
          getPrefix = getPlDescribe(0)
          getVersion = getPlDescribe(1)
          getAuthor = dicAuthors.Item(key)

          If dicUpDates.Exists(key) Then
            idx = idx + 1
            AddChat vbYellow, "Full name: " & dicUpDates.Item(key)
            AddChat vbYellow, "Prefix: " & getPrefix
            AddChat vbYellow, "Version: " & getVersion
            AddChat vbYellow, "Author: " & getAuthor
            If idx < plugCount Then AddChat vbYellow, " "
          End If
        End If
      Next
  End Select
End Sub

Function InArray(Arr, Item)
  If Not IsArray(Arr) Then
    InArray = False
  Else
    Found = False
    For i = LBound(Arr) To UBOund(Arr)
      If LCase(Arr(i)) = LCase(Item) Then
        Found = True
      End If
    Next
    InArray = Found
  End If
End Function

Function ReturnElement(Arr, Item)
  Found = False
  For i = LBound(Arr) To UBOund(Arr)
    If LCase(Arr(i)) = LCase(Item) Then
      ReturnElement = arr(i)
      Exit Function
    End If
  Next
  InArray = Found
End Function

Sub r77_upDateTimer_Timer()
  upDateCount = 0

  Call parsePlugIns(getPlugs)
  Call upDateUserPlugIns()
  Call countUpDates()

  If upDateCount > 0 Then
    AddChat vbCyan, "[R77] " & upDateCount & " of your plugIns have upDates To them on the Rev77.net server."
    AddChat vbCyan, "[R77] Type /r77 upDates To view the upDates."
  End If
End Sub

Sub upDatePS()
  getUpDate = scInet.OpenURL(UPDATE_PS_URL)

  If getUpDate = "" Then
    AddChat vbRed, "[R77] Your connection To the upDate server cannot be established."
    AddChat vbRed, "[R77] The Server is Down, or your connection cannot be established."
    Exit Sub
  End If

  If InStr(LCase(getUpDate), "<title>HTTP 404 not found</title>") > 0 Then
    AddChat vbRed, "[R77] Unable To check For upDates. The URL is Invalid."
    Exit Sub
  End If

  contents = Split(getUpDate, vbNewLIne)
  version = Mid(contents(1), 2)

  name = BotPath() & "backup\Rev77PS(" & psVersions.Item("r77") & ")"
  tempName = name

  If cDBL(version) > cDBL(psVersions.Item("r77")) Then
    AddChat vbYellow, "[R77] There is a new version For your plugIn manager. UpdatIng..."

    If Not fso.FolderExists("backup") Then fso.CreateFolder("backup")

    checkFile = 1
    Do While fso.FileExists(tempName & ".plug")
      tempName = name & checkFile
    Loop
    tempName = tempName & ".plug"

    AddChat vbYellow, "[R77] BackIng your PS To " & tempName & "..."

    fso.CopyFile BotPath() & "plugIns\Rev77PS.plug", tempName
    fso.DeleteFile BotPath() & "plugIns\Rev77PS.plug"
  
« Last Edit: December 17, 2008, 07:01:52 PM by Vector »
I am an Unofficial StealthBot Technician, an Unofficial StealthBot scripter, among other things. See my about page for more info.

Quote from: ArticWolve
Sorry I went down. Had internet problems with a cracker-jack-licensed driver hitting my internet pole (about 8 of them fell) and drooping my phone and electricity. Sorry ><

Rev77.net Plugins Manager

Proud host of Vector.no-ip.info | VectorJBLS.no-ip.org Status: [img]http://rev77.net/ServerCheck/check.asp?query=check&server=VectorJBLS.no-ip.org_status.png\" border=\"0\" class=\"linked-image\" /]

Shito-Ryu Karate-Do Genbu-Kai Rank: 8th Kyu (White belt, one stripe)

Rev77.Net Remote Support (Double-Click my name only if you were told to)

If the above link doesn't work, or if you use Vista, try this alternate link.

Noob ~Vector