Josh
07-13-2013, 03:19 AM
Public Function buy(ByVal oii As String)
strhtml = p("[Only registered and activated users can see links]", "purchase=1&oii=" & oii & "neopets=123", "[Only registered and activated users can see links]")
If InStr(strhtml, "Sorry, we just sold out of that.") Then
Return False
Else
oWatch.Stop()
Return True
End If
End Function
Private Sub frmattic_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs)
Application.Exit()
End Sub
Private Sub cmdstart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdstart.Click
runprogram = True
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub cmdstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdstop.Click
runprogram = False
End Sub
Private Sub cmdneo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdneo.Click
If String.IsNullOrEmpty(txtneop.Text) Or String.IsNullOrEmpty(txtneop.Text) Then
MsgBox("Username or Password empty")
Else
If neologin(txtneou.Text, txtneop.Text) = True Then
MsgBox("Logged into neo")
cmdstart.Enabled = True
Else
MsgBox("Failed to login")
End If
End If
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim counter As Integer, nst As String, delay As Integer, waits As Integer, oldhtml As String
counter = 0
Do While runprogram = True
oWatch.Reset()
strhtml = g("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")
If strhtml.Contains("Log In!") Then
neologin(txtneou.Text, txtneop.Text)
strhtml = g("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")
End If
oldhtml = strhtml
If InStr(strhtml, "Sorry, but you cannot buy any more items from this shop today!") Then
Setaddlist_ThreadSafe(logs, "Banned from shop")
runprogram = False
Else
SetLabelText_ThreadSafe(lblref, lblref.Text + 1)
If chkref.Checked = True Then
If lblref.Text >= Integer.Parse(txtref.Text.ToString) Then
Setaddlist_ThreadSafe(logs, "Reached refresh limit")
runprogram = False
End If
End If
If InStr(strhtml, " am NST") Then
nst = StrReverse(GetBetween(StrReverse(strhtml), StrReverse(" am NST"), ":"))
Else
nst = StrReverse(GetBetween(StrReverse(strhtml), StrReverse(" pm NST"), ":"))
End If
If Integer.Parse(nst.ToString) >= Integer.Parse(txtnst1.Text.ToString) And Integer.Parse(nst.ToString) <= Integer.Parse(txtnst2.Text.ToString) Then
lstitems = GetBetweenAll(strhtml, "Are you sure you wish to buy ", " at")
lstoii = GetBetweenAll(strhtml, "name='oii' value='", "'>")
oWatch.Start()
For x = 0 To lstitems.Count - 1
If lstbuy.Items.Contains(lstitems.Item(x)) Then
If (buy(lstoii.Item(x)) = True) Then
If chksave.Checked = True Then
System.IO.File.AppendAllText(Application.StartupPa th() & "\" & lstitems.Item(x) & " " & GetRandom(1000, 9999) & ".html", oldhtml)
End If
SetLabelText_ThreadSafe(lblsuccess, lblsuccess.Text + 1)
Setaddlist_ThreadSafe(logs, "Bought " & lstitems.Item(x) & " in " & oWatch.ElapsedMilliseconds.ToString & " ms")
If lblsuccess.Text >= Integer.Parse(txtstop.Text.ToString) Then
Setaddlist_ThreadSafe(logs, "Reached set item limit")
runprogram = False
End If
Exit For
Else
If chksave.Checked = True Then
System.IO.File.AppendAllText(Application.StartupPa th() & "\" & lstitems.Item(x) & " " & GetRandom(1000, 9999) & ".html", oldhtml)
End If
SetLabelText_ThreadSafe(lblfail, lblfail.Text + 1)
Setaddlist_ThreadSafe(logs, "Missed " & lstitems.Item(x))
End If
End If
Next
waits = GetRandom(txtwait1.Text, txtwait2.Text)
SetLabelText_ThreadSafe(lblstatus, "Waiting " & waits & " ms")
Setaddlist_ThreadSafe(logs, "1")
System.Threading.Thread.Sleep(waits)
Else
If nst > txtnst2.Text Then
delay = 60 - txtnst2.Text
delay = delay + txtnst1.Text
Else
delay = txtnst1.Text - nst
End If
SetLabelText_ThreadSafe(lblstatus, "Sleeping for " & delay & " seconds")
System.Threading.Thread.Sleep(delay * 1000)
End If
End If
Setaddlist_ThreadSafe(logs, "2")
Loop
BackgroundWorker1.CancelAsync()
SetLabelText_ThreadSafe(lblstatus, "Stopped")
End Sub
strhtml = p("[Only registered and activated users can see links]", "purchase=1&oii=" & oii & "neopets=123", "[Only registered and activated users can see links]")
If InStr(strhtml, "Sorry, we just sold out of that.") Then
Return False
Else
oWatch.Stop()
Return True
End If
End Function
Private Sub frmattic_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs)
Application.Exit()
End Sub
Private Sub cmdstart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdstart.Click
runprogram = True
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub cmdstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdstop.Click
runprogram = False
End Sub
Private Sub cmdneo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdneo.Click
If String.IsNullOrEmpty(txtneop.Text) Or String.IsNullOrEmpty(txtneop.Text) Then
MsgBox("Username or Password empty")
Else
If neologin(txtneou.Text, txtneop.Text) = True Then
MsgBox("Logged into neo")
cmdstart.Enabled = True
Else
MsgBox("Failed to login")
End If
End If
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim counter As Integer, nst As String, delay As Integer, waits As Integer, oldhtml As String
counter = 0
Do While runprogram = True
oWatch.Reset()
strhtml = g("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")
If strhtml.Contains("Log In!") Then
neologin(txtneou.Text, txtneop.Text)
strhtml = g("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")
End If
oldhtml = strhtml
If InStr(strhtml, "Sorry, but you cannot buy any more items from this shop today!") Then
Setaddlist_ThreadSafe(logs, "Banned from shop")
runprogram = False
Else
SetLabelText_ThreadSafe(lblref, lblref.Text + 1)
If chkref.Checked = True Then
If lblref.Text >= Integer.Parse(txtref.Text.ToString) Then
Setaddlist_ThreadSafe(logs, "Reached refresh limit")
runprogram = False
End If
End If
If InStr(strhtml, " am NST") Then
nst = StrReverse(GetBetween(StrReverse(strhtml), StrReverse(" am NST"), ":"))
Else
nst = StrReverse(GetBetween(StrReverse(strhtml), StrReverse(" pm NST"), ":"))
End If
If Integer.Parse(nst.ToString) >= Integer.Parse(txtnst1.Text.ToString) And Integer.Parse(nst.ToString) <= Integer.Parse(txtnst2.Text.ToString) Then
lstitems = GetBetweenAll(strhtml, "Are you sure you wish to buy ", " at")
lstoii = GetBetweenAll(strhtml, "name='oii' value='", "'>")
oWatch.Start()
For x = 0 To lstitems.Count - 1
If lstbuy.Items.Contains(lstitems.Item(x)) Then
If (buy(lstoii.Item(x)) = True) Then
If chksave.Checked = True Then
System.IO.File.AppendAllText(Application.StartupPa th() & "\" & lstitems.Item(x) & " " & GetRandom(1000, 9999) & ".html", oldhtml)
End If
SetLabelText_ThreadSafe(lblsuccess, lblsuccess.Text + 1)
Setaddlist_ThreadSafe(logs, "Bought " & lstitems.Item(x) & " in " & oWatch.ElapsedMilliseconds.ToString & " ms")
If lblsuccess.Text >= Integer.Parse(txtstop.Text.ToString) Then
Setaddlist_ThreadSafe(logs, "Reached set item limit")
runprogram = False
End If
Exit For
Else
If chksave.Checked = True Then
System.IO.File.AppendAllText(Application.StartupPa th() & "\" & lstitems.Item(x) & " " & GetRandom(1000, 9999) & ".html", oldhtml)
End If
SetLabelText_ThreadSafe(lblfail, lblfail.Text + 1)
Setaddlist_ThreadSafe(logs, "Missed " & lstitems.Item(x))
End If
End If
Next
waits = GetRandom(txtwait1.Text, txtwait2.Text)
SetLabelText_ThreadSafe(lblstatus, "Waiting " & waits & " ms")
Setaddlist_ThreadSafe(logs, "1")
System.Threading.Thread.Sleep(waits)
Else
If nst > txtnst2.Text Then
delay = 60 - txtnst2.Text
delay = delay + txtnst1.Text
Else
delay = txtnst1.Text - nst
End If
SetLabelText_ThreadSafe(lblstatus, "Sleeping for " & delay & " seconds")
System.Threading.Thread.Sleep(delay * 1000)
End If
End If
Setaddlist_ThreadSafe(logs, "2")
Loop
BackgroundWorker1.CancelAsync()
SetLabelText_ThreadSafe(lblstatus, "Stopped")
End Sub