Public Class frmMain
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtSQL As System.Windows.Forms.TextBox
Friend WithEvents txtDB As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtUSR As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents txtPW As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents txtTMR As System.Windows.Forms.TextBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents btnTMR As System.Windows.Forms.Button
Friend WithEvents btnPW As System.Windows.Forms.Button
Friend WithEvents btnUSR As System.Windows.Forms.Button
Friend WithEvents btnDB As System.Windows.Forms.Button
Friend WithEvents btnSQL As System.Windows.Forms.Button
Friend WithEvents btnSandurrA As System.Windows.Forms.Button
Friend WithEvents lblStatus As System.Windows.Forms.Label
Friend WithEvents lblTMR As System.Windows.Forms.Label
Friend WithEvents Timer As System.Timers.Timer
Friend WithEvents btnTBL As System.Windows.Forms.Button
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents txtTBL As System.Windows.Forms.TextBox
Friend WithEvents btnStop As System.Windows.Forms.Button
Friend WithEvents lstErrorLog As System.Windows.Forms.ListBox
Friend WithEvents lstErrorLog2 As System.Windows.Forms.ListBox
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents txtPNum As System.Windows.Forms.TextBox
Friend WithEvents btnGold As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain))
Me.Label1 = New System.Windows.Forms.Label
Me.txtSQL = New System.Windows.Forms.TextBox
Me.txtDB = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.txtUSR = New System.Windows.Forms.TextBox
Me.Label3 = New System.Windows.Forms.Label
Me.txtPW = New System.Windows.Forms.TextBox
Me.Label4 = New System.Windows.Forms.Label
Me.txtTMR = New System.Windows.Forms.TextBox
Me.Label5 = New System.Windows.Forms.Label
Me.btnTMR = New System.Windows.Forms.Button
Me.btnPW = New System.Windows.Forms.Button
Me.btnUSR = New System.Windows.Forms.Button
Me.btnDB = New System.Windows.Forms.Button
Me.btnSQL = New System.Windows.Forms.Button
Me.btnSandurrA = New System.Windows.Forms.Button
Me.lblStatus = New System.Windows.Forms.Label
Me.lblTMR = New System.Windows.Forms.Label
Me.Timer = New System.Timers.Timer
Me.btnTBL = New System.Windows.Forms.Button
Me.txtTBL = New System.Windows.Forms.TextBox
Me.Label6 = New System.Windows.Forms.Label
Me.btnStop = New System.Windows.Forms.Button
Me.lstErrorLog = New System.Windows.Forms.ListBox
Me.lstErrorLog2 = New System.Windows.Forms.ListBox
Me.Label7 = New System.Windows.Forms.Label
Me.txtPNum = New System.Windows.Forms.TextBox
Me.btnGold = New System.Windows.Forms.Button
CType(Me.Timer, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "SQL"
'
'txtSQL
'
Me.txtSQL.Location = New System.Drawing.Point(64, 8)
Me.txtSQL.Name = "txtSQL"
Me.txtSQL.Size = New System.Drawing.Size(128, 20)
Me.txtSQL.TabIndex = 1
Me.txtSQL.Text = "127.0.0.1"
'
'txtDB
'
Me.txtDB.Location = New System.Drawing.Point(64, 32)
Me.txtDB.Name = "txtDB"
Me.txtDB.Size = New System.Drawing.Size(128, 20)
Me.txtDB.TabIndex = 3
Me.txtDB.Text = "SOD2DB"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(8, 32)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 16)
Me.Label2.TabIndex = 2
Me.Label2.Text = "DB"
'
'txtUSR
'
Me.txtUSR.Location = New System.Drawing.Point(64, 56)
Me.txtUSR.Name = "txtUSR"
Me.txtUSR.Size = New System.Drawing.Size(128, 20)
Me.txtUSR.TabIndex = 5
Me.txtUSR.Text = "sa"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 56)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 16)
Me.Label3.TabIndex = 4
Me.Label3.Text = "USR"
'
'txtPW
'
Me.txtPW.Location = New System.Drawing.Point(64, 80)
Me.txtPW.Name = "txtPW"
Me.txtPW.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtPW.Size = New System.Drawing.Size(128, 20)
Me.txtPW.TabIndex = 7
Me.txtPW.Text = ""
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(8, 80)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(56, 16)
Me.Label4.TabIndex = 6
Me.Label4.Text = "PW"
'
'txtTMR
'
Me.txtTMR.Location = New System.Drawing.Point(64, 104)
Me.txtTMR.Name = "txtTMR"
Me.txtTMR.Size = New System.Drawing.Size(128, 20)
Me.txtTMR.TabIndex = 9
Me.txtTMR.Text = "10"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(8, 104)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(56, 16)
Me.Label5.TabIndex = 8
Me.Label5.Text = "TMR"
'
'btnTMR
'
Me.btnTMR.Location = New System.Drawing.Point(200, 104)
Me.btnTMR.Name = "btnTMR"
Me.btnTMR.Size = New System.Drawing.Size(32, 16)
Me.btnTMR.TabIndex = 10
Me.btnTMR.Text = "set"
'
'btnPW
'
Me.btnPW.Location = New System.Drawing.Point(200, 80)
Me.btnPW.Name = "btnPW"
Me.btnPW.Size = New System.Drawing.Size(32, 16)
Me.btnPW.TabIndex = 11
Me.btnPW.Text = "set"
'
'btnUSR
'
Me.btnUSR.Location = New System.Drawing.Point(200, 56)
Me.btnUSR.Name = "btnUSR"
Me.btnUSR.Size = New System.Drawing.Size(32, 16)
Me.btnUSR.TabIndex = 12
Me.btnUSR.Text = "set"
'
'btnDB
'
Me.btnDB.Location = New System.Drawing.Point(200, 32)
Me.btnDB.Name = "btnDB"
Me.btnDB.Size = New System.Drawing.Size(32, 16)
Me.btnDB.TabIndex = 13
Me.btnDB.Text = "set"
'
'btnSQL
'
Me.btnSQL.Location = New System.Drawing.Point(200, 8)
Me.btnSQL.Name = "btnSQL"
Me.btnSQL.Size = New System.Drawing.Size(32, 16)
Me.btnSQL.TabIndex = 14
Me.btnSQL.Text = "set"
'
'btnSandurrA
'
Me.btnSandurrA.Enabled = False
Me.btnSandurrA.Location = New System.Drawing.Point(240, 32)
Me.btnSandurrA.Name = "btnSandurrA"
Me.btnSandurrA.Size = New System.Drawing.Size(368, 80)
Me.btnSandurrA.TabIndex = 16
Me.btnSandurrA.Text = "Activate"
'
'lblStatus
'
Me.lblStatus.Location = New System.Drawing.Point(8, 152)
Me.lblStatus.Name = "lblStatus"
Me.lblStatus.Size = New System.Drawing.Size(512, 16)
Me.lblStatus.TabIndex = 17
Me.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'lblTMR
'
Me.lblTMR.Location = New System.Drawing.Point(536, 152)
Me.lblTMR.Name = "lblTMR"
Me.lblTMR.Size = New System.Drawing.Size(72, 16)
Me.lblTMR.TabIndex = 18
Me.lblTMR.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Timer
'
Me.Timer.Interval = 60000
Me.Timer.SynchronizingObject = Me
'
'btnTBL
'
Me.btnTBL.Location = New System.Drawing.Point(200, 128)
Me.btnTBL.Name = "btnTBL"
Me.btnTBL.Size = New System.Drawing.Size(32, 16)
Me.btnTBL.TabIndex = 21
Me.btnTBL.Text = "set"
'
'txtTBL
'
Me.txtTBL.Location = New System.Drawing.Point(64, 128)
Me.txtTBL.Name = "txtTBL"
Me.txtTBL.Size = New System.Drawing.Size(128, 20)
Me.txtTBL.TabIndex = 20
Me.txtTBL.Text = "SOD2RecBySandurr"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(8, 128)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(56, 16)
Me.Label6.TabIndex = 19
Me.Label6.Text = "TBL"
'
'btnStop
'
Me.btnStop.Enabled = False
Me.btnStop.Location = New System.Drawing.Point(240, 120)
Me.btnStop.Name = "btnStop"
Me.btnStop.Size = New System.Drawing.Size(264, 24)
Me.btnStop.TabIndex = 22
Me.btnStop.Text = "Stop"
'
'lstErrorLog
'
Me.lstErrorLog.Location = New System.Drawing.Point(8, 168)
Me.lstErrorLog.Name = "lstErrorLog"
Me.lstErrorLog.Size = New System.Drawing.Size(288, 147)
Me.lstErrorLog.TabIndex = 23
'
'lstErrorLog2
'
Me.lstErrorLog2.Location = New System.Drawing.Point(304, 168)
Me.lstErrorLog2.Name = "lstErrorLog2"
Me.lstErrorLog2.Size = New System.Drawing.Size(304, 147)
Me.lstErrorLog2.TabIndex = 24
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(240, 8)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(312, 16)
Me.Label7.TabIndex = 25
Me.Label7.Text = "Minimum clan players needed to survive SoD to save points:"
'
'txtPNum
'
Me.txtPNum.Location = New System.Drawing.Point(560, 8)
Me.txtPNum.Name = "txtPNum"
Me.txtPNum.Size = New System.Drawing.Size(48, 20)
Me.txtPNum.TabIndex = 26
Me.txtPNum.Text = "2"
'
'btnGold
'
Me.btnGold.Location = New System.Drawing.Point(512, 120)
Me.btnGold.Name = "btnGold"
Me.btnGold.Size = New System.Drawing.Size(96, 24)
Me.btnGold.TabIndex = 27
'
'frmMain
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(618, 328)
Me.Controls.Add(Me.btnGold)
Me.Controls.Add(Me.txtPNum)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.lstErrorLog2)
Me.Controls.Add(Me.lstErrorLog)
Me.Controls.Add(Me.btnStop)
Me.Controls.Add(Me.btnTBL)
Me.Controls.Add(Me.txtTBL)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.lblTMR)
Me.Controls.Add(Me.lblStatus)
Me.Controls.Add(Me.btnSandurrA)
Me.Controls.Add(Me.btnSQL)
Me.Controls.Add(Me.btnDB)
Me.Controls.Add(Me.btnUSR)
Me.Controls.Add(Me.btnPW)
Me.Controls.Add(Me.btnTMR)
Me.Controls.Add(Me.txtTMR)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.txtPW)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.txtUSR)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.txtDB)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.txtSQL)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Name = "frmMain"
Me.Text = "Clan SoD Score System Manager (Made by Sandurr)"
CType(Me.Timer, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Dim strSQL As String
Dim strDB As String
Dim strUSR As String
Dim strPW As String
Dim strTMR As String
Dim strTBL As String
Dim strTXTPNUMOLD As String = "2"
Dim strErrorLog As String = ""
Dim strErrorLog2 As String = ""
Dim bReady As Boolean = False
Dim iReady As Integer = 0
Dim aReady(6) As Integer
Dim connectionString As String
Dim strQuery As String
Dim objConn, objReader, objCommand
Dim objConn2, objReader2, objCommand2
Dim objConn3, objReader3, objCommand3
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblStatus.Text = "Welcome... Made by Sandurr... Licensed to rPT"
lblTMR.Text = "0"
Dim i As Integer
For i = 1 To 6
aReady(i) = 0
Next i
End Sub
Private Sub btnSQL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSQL.Click
strSQL = txtSQL.Text
If aReady(1) = 0 Then
iReady += 1
If iReady >= 6 Then
bReady = True
btnSandurrA.Enabled = True
Else
btnSandurrA.Enabled = False
End If
aReady(1) = 1
End If
lblStatus.Text = "Set SQL"
End Sub
Private Sub btnDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDB.Click
strDB = txtDB.Text
If aReady(2) = 0 Then
iReady += 1
If iReady >= 6 Then
bReady = True
btnSandurrA.Enabled = True
Else
btnSandurrA.Enabled = False
End If
aReady(2) = 1
End If
lblStatus.Text = "Set DB"
End Sub
Private Sub btnUSR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUSR.Click
strUSR = txtUSR.Text
If aReady(3) = 0 Then
iReady += 1
If iReady >= 6 Then
bReady = True
btnSandurrA.Enabled = True
Else
btnSandurrA.Enabled = False
End If
aReady(3) = 1
End If
lblStatus.Text = "Set USR"
End Sub
Private Sub btnPW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPW.Click
strPW = txtPW.Text
If aReady(4) = 0 Then
iReady += 1
If iReady >= 6 Then
bReady = True
btnSandurrA.Enabled = True
Else
btnSandurrA.Enabled = False
End If
aReady(4) = 1
End If
lblStatus.Text = "Set PW"
End Sub
Private Sub btnTMR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTMR.Click
Dim strTMRt As String
strTMRt = txtTMR.Text
If IsNumeric(strTMRt) = True Then
If strTMRt > 0 Then
strTMR = (CInt(strTMRt) * 1000)
Timer.Interval = strTMR
Else
MsgBox("Must be higher than 0")
End If
Else
MsgBox("Must be a numeric")
End If
If aReady(5) = 0 Then
iReady += 1
If iReady >= 6 Then
bReady = True
btnSandurrA.Enabled = True
Else
btnSandurrA.Enabled = False
End If
aReady(5) = 1
End If
lblStatus.Text = "Set TMR"
End Sub
Private Sub btnTBL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTBL.Click
strTBL = txtTBL.Text
If aReady(6) = 0 Then
iReady += 1
If iReady >= 6 Then
bReady = True
btnSandurrA.Enabled = True
Else
btnSandurrA.Enabled = False
End If
aReady(6) = 1
End If
lblStatus.Text = "Set TBL"
End Sub
Private Sub btnSandurrA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSandurrA.Click
If iReady >= 6 And bReady = True Then
Timer.Enabled = True
btnSandurrA.Enabled = False
btnSQL.Enabled = False
btnDB.Enabled = False
btnUSR.Enabled = False
btnPW.Enabled = False
btnTMR.Enabled = False
btnTBL.Enabled = False
btnStop.Enabled = True
lstErrorLog.Items.Clear()
lstErrorLog2.Items.Clear()
connectionString = "server='" & strSQL & "'; user id='" & strUSR & "'; password='" & strPW & "'; database='" & strDB & "'"
objConn = New System.Data.SqlClient.SqlConnection(connectionString)
objConn3 = New System.Data.SqlClient.SqlConnection(connectionString)
connectionString = "server='" & strSQL & "'; user id='" & strUSR & "'; password='" & strPW & "'; database='ClanDB'"
objConn2 = New System.Data.SqlClient.SqlConnection(connectionString)
objConn.Open()
objConn2.Open()
objConn3.Open()
lblStatus.Text = "Activated"
End If
End Sub
Private Sub Timer_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer.Elapsed
If bReady = True Then
lblTMR.Text = CInt(CInt(lblTMR.Text) + 1)
'SoD Stuff
strQuery = "SELECT CharName, ServerTime, TotalPoint, SuccessUser FROM " & strTBL
objCommand = New System.Data.SqlClient.SqlCommand(strQuery, objConn)
objReader = objCommand.ExecuteReader()
Dim tCharName As String
Dim tCharName2 As String
Dim tTPoint As Integer
Dim tTime As Integer
Dim tSU As Integer
Dim tClanName As String
Dim tClanName2 As String
Dim tCurPoint As Integer
Dim tCPoint As Integer
Dim tPNum As Integer
While objReader.Read()
tPNum = 0
tCharName = objReader.Item(0)
tTime = objReader.Item(1)
tTPoint = objReader.Item(2)
tSU = objReader.Item(3)
If tTPoint > 0 Or tSU >= CInt(strTXTPNUMOLD) Then
tClanName = GetClan(tCharName)
If Not tClanName = "" Then
tPNum = 1
tCurPoint = GetClanPoint(tClanName)
strQuery = "SELECT CharName, Point FROM " & strTBL & " WHERE ServerTime='" & tTime & "' AND TotalPoint='" & tTPoint & "' AND SuccessUser='" & tSU & "'"
objCommand3 = New System.Data.SqlClient.SqlCommand(strQuery, objConn3)
objReader3 = objCommand3.ExecuteReader()
While objReader3.Read()
tCharName2 = objReader3.Item(0)
tCPoint = objReader3.Item(1)
If tCPoint > 0 Then
If Not tCharName2 = tCharName Then
tClanName2 = GetClan(tCharName2)
If tClanName2 = tClanName Then
tPNum = tPNum + 1
Else
tTPoint = tTPoint - tCPoint
End If
End If
End If
End While
objReader3.Close()
If tPNum >= CInt(strTXTPNUMOLD) And tTPoint > tCurPoint Then
lstErrorLog.Items.Add("SaveData: " & tClanName & "(tPNum:" & tPNum & " & tTPoint:" & tTPoint & ")")
ClanInsertClanScore(tClanName, tTPoint)
Else
lstErrorLog2.Items.Add("NoSaveData: " & tClanName & "(tPNum:" & tPNum & " & tTPoint:" & tTPoint & ")")
End If
End If
End If
End While
objReader.Close()
End If
End Sub
Private Sub ClanInsertClanScore(ByRef strClanName As String, ByRef iTotalPoint As Integer)
strQuery = "UPDATE CL SET Cpoint='" & iTotalPoint & "' WHERE ClanName='" & strClanName & "'"
objCommand2 = New System.Data.SqlClient.SqlCommand(strQuery, objConn2)
objReader2 = objCommand2.ExecuteReader()
objReader2.Close()
End Sub
Private Function GetClan(ByRef strCharName As String) As String
strQuery = "SELECT ClanName FROM UL WHERE ChName='" & strCharName & "'"
objCommand2 = New System.Data.SqlClient.SqlCommand(strQuery, objConn2)
objReader2 = objCommand2.ExecuteReader()
If objReader2.Read() Then
GetClan = objReader2.GetString(0)
Else
GetClan = ""
End If
objReader2.Close()
End Function
Private Function GetClanPoint(ByRef strClanName As String) As Integer
strQuery = "SELECT Cpoint FROM CL WHERE ClanName='" & strClanName & "'"
objCommand2 = New System.Data.SqlClient.SqlCommand(strQuery, objConn2)
objReader2 = objCommand2.ExecuteReader()
If objReader2.Read() Then
GetClanPoint = objReader2.GetInt32(0)
Else
GetClanPoint = ""
End If
objReader2.Close()
End Function
Private Sub frmMain_Closed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Closed
If iReady = 6 And btnSandurrA.Enabled = False And bReady = True Then
objConn.Close()
objConn2.Close()
objConn3.Close()
End If
End Sub
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
btnStop.Enabled = False
btnSandurrA.Enabled = True
Timer.Enabled = False
lblStatus.Text = "Stopped service..."
lblTMR.Text = "0"
Dim i As Integer
For i = 1 To 6
aReady(i) = 0
Next i
btnSQL.Enabled = True
btnDB.Enabled = True
btnUSR.Enabled = True
btnPW.Enabled = True
btnTMR.Enabled = True
btnTBL.Enabled = True
bReady = False
iReady = 0
End Sub
Private Sub txtPNum_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPNum.TextChanged
If IsNumeric(txtPNum) = False Then
txtPNum.Text = strTXTPNUMOLD
Else
strTXTPNUMOLD = txtPNum.Text
End If
End Sub
Private Sub btnGold_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGold.Click
If Timer.Enabled = False Then
Exit Sub
End If
Dim iCurGold As Long
Dim strNewGold As String
Dim iNewGold As Long
Dim strCSoD As String = GetSoDClan()
Dim strCurSoDGold As String = GetSoDClanMoney(strCSoD)
If IsNumeric(strCurSoDGold) = True Then
iCurGold = CInt(strCurSoDGold)
Else
iCurGold = 0
End If
PutGold:
strNewGold = InputBox("Currently the SoD Owning Clan (" & strCSoD & ") has " & iCurGold & " Clan Money." & vbNewLine & "How much Clan Money do you want to ADD?", "SoD Clan Money", "0")
If IsNumeric(strNewGold) = False Then
GoTo PutGOld
End If
iNewGold = CInt(strNewGold)
iNewGold = iCurGold + iNewGold
SetSoDClanMoney(strCSoD, iNewGold)
MsgBox("New Clan Money for " & strCSoD & " is " & iNewGold, MsgBoxStyle.OKOnly & MsgBoxStyle.Information, "New Clan Money")
End Sub
Private Sub SetSoDClanMoney(ByRef strClanName As String, ByRef iTotalPoint As Integer)
If Timer.Enabled = False Then
Exit Sub
End If
strQuery = "UPDATE CL SET ClanMoney='" & iTotalPoint & "' WHERE ClanName='" & strClanName & "'"
objCommand2 = New System.Data.SqlClient.SqlCommand(strQuery, objConn2)
objReader2 = objCommand2.ExecuteReader()
objReader2.Close()
End Sub
Private Function GetSoDClanMoney(ByRef strClanName As String) As String
If Timer.Enabled = False Then
Exit Function
End If
strQuery = "SELECT ClanMoney FROM CL WHERE ClanName='" & strClanName & "'"
objCommand2 = New System.Data.SqlClient.SqlCommand(strQuery, objConn2)
objReader2 = objCommand2.ExecuteReader()
If objReader2.Read() Then
GetSoDClanMoney = objReader2.Item(0)
End If
objReader2.Close()
End Function
Private Function GetSoDClan() As String
If Timer.Enabled = False Then
Exit Function
End If
strQuery = "SELECT ClanName FROM CL ORDER BY Cpoint DESC"
objCommand2 = New System.Data.SqlClient.SqlCommand(strQuery, objConn2)
objReader2 = objCommand2.ExecuteReader()
If objReader2.Read() Then
GetSoDClan = objReader2.Item(0)
End If
objReader2.Close()
End Function
End Class