Welcome guys to my thread for the new DarkOrbit API by me and FlutterShy (for the autoit version)
Features:
Code:
GetResponse(ByVal sUrl As String, ByVal sPost As String) //WebRequest POST
GetResponse(ByVal sUrl As String) //WebRequest GET
StringBetween(ByRef content As String, ByRef strStart As String, ByRef strEnd As String, Optional ByRef startPos As Integer = 0) //Get a string between 2 strings
StringRegExp(ByVal content As String, ByVal regstring As String)
Login(ByVal username As String, ByVal password As String, ByVal server As String) //Easy Regular Expressions
GetBootys(ByVal content As String) //Get BootyKey count.
GetJackpot(ByVal content As String) //Get Jackpot count with €/$
GetMainInfos(ByVal content As String) //Get all infos of the user. Call it with Arrays. 0 = Name, 1 = Full servername, 2 = Premium Status (Yes/No), 3 = Level, 4 = Company, 5 = Map Location, 6 = Registered Date
GetUserInfos(ByVal content As String) //Get user infos of the user. Call it wht Arrays. 0 = User ID, 1 = Level, 2 = Honor, 3 = Experience
GetHangarInfos(ByVal content As String) //Get infos from hangar. Call it with Arrays. 0 = Actual HP, 1 = Max HP, 2 = Nano Hull, 3, Max Nano hull, 4 = repair voucher, 5 = jump voucher, 7 = Lasercount, 8 = Ammocount, 9 = rocketammocount, 16 = Flaxcount, 17 = iriscount, 14 = dmg/shd ratio, 52 = petname, 53 = petfuel, 54 = pet lvl, 55 = pet hp, 56 = pet fuel, 60 = pet shield/hp ratio
GetUID(ByVal content As String) //Get UserID of account
GetSID(ByVal content As String) //Get current SID
GetCredits(ByVal content As String) //Get current Credits
GetUri(ByVal content As String) //Get current Uridium
EncodeUsername(ByVal string0 As String) //Encode the username, to login with special chars
Code Example:
Code:
If Login("Requi", "isawesome", "de8") = True Then
Dim src As String = GetResponse("http://" & server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalStart")
GetCredits(src)
GetUri(src)
MsgBox(iCredits)
MsgBox(iUridium)
Else
MsgBox("Username is wrong!!!!!!!!")
End If
'<C> by Requi (Coding the API)'
'<C> by FlutterShy (Code in Auto(sh)it)'
'<C> by all e*pvp Users, for being our fans ♥'
Option Explicit On
Option Strict On
Imports System.Net
Imports System.IO
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.Runtime.InteropServices
Public Module DarkOrbitAPI
#Region "ToDo List"
'Importing Trapdoor.dll for more features'
'<DllImport("TrapDoor.dll")>'
'Public Function TrapiGetSize(ByVal sessionId As String, ByVal width As Integer, ByVal height As Integer) As Integer'
'End Function'
''
'Code more features'
#End Region
#Region "HTTP"
Public Function GetResponse(ByVal sUrl As String, ByVal sPost As String) As String
Try
Dim nRequest As HttpWebRequest = CType(WebRequest.Create(sUrl), HttpWebRequest)
nRequest.Method = "POST"
nRequest.CookieContainer = cookie
nRequest.ContentType = "application/x-www-form-urlencoded"
nRequest.Proxy = New WebProxy()
Dim nbyteArray() As Byte = Encoding.UTF8.GetBytes(sPost)
nRequest.ContentLength = nbyteArray.Length
Dim nDataStream As Stream = nRequest.GetRequestStream()
nDataStream.Write(nbyteArray, 0, nbyteArray.Length)
nDataStream.Close()
nRequest.KeepAlive = True
nRequest.AllowAutoRedirect = True
nRequest.PreAuthenticate = True
Dim nResponse As HttpWebResponse = CType(nRequest.GetResponse(), HttpWebResponse)
nDataStream = nResponse.GetResponseStream()
Dim nreader As New StreamReader(nDataStream)
Dim nServerResponse As String = nreader.ReadToEnd()
nreader.Close()
nDataStream.Close()
nResponse.Close()
Return nServerResponse
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
End Try
End Function
Public Function GetResponse(ByVal sUrl As String) As String
Static cookiecontainer As CookieContainer
Static cookiecoll As CookieCollection
Try
If (cookiecoll Is Nothing) Then
cookiecoll = New CookieCollection
End If
If (cookiecontainer Is Nothing) Then
cookiecontainer = New CookieContainer
End If
Dim req As HttpWebRequest = DirectCast(HttpWebRequest.Create(sUrl), HttpWebRequest)
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)"
req.Method = "GET"
req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
req.KeepAlive = True
req.CookieContainer = New CookieContainer()
req.CookieContainer = cookiecontainer
req.CookieContainer.Add(cookiecoll)
req.Proxy = New WebProxy()
Dim response As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)
Dim sr As StreamReader = New StreamReader(response.GetResponseStream())
Dim html As String = sr.ReadToEnd()
sr.Close()
response.Close()
Return html
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
End Try
End Function
Public Function StringBetween(ByRef content As String, ByRef strStart As String, ByRef strEnd As String, Optional ByRef startPos As Integer = 0) As String
Try
Dim iPos As Integer, iEnd As Integer, lenStart As Integer = strStart.Length
Dim strResult As String
strResult = String.Empty
iPos = content.IndexOf(strStart, startPos)
iEnd = content.IndexOf(strEnd, iPos + lenStart)
If iPos <> -1 AndAlso iEnd <> -1 Then
strResult = content.Substring(iPos + lenStart, iEnd - (iPos + lenStart))
End If
Return strResult
Catch
Return CStr(False)
End Try
End Function
Public Function StringRegExp(ByVal content As String, ByVal regstring As String) As String
Dim str4 As String = ""
Dim input As String = content
Dim match As Match = Regex.Match(input, regstring, RegexOptions.Multiline)
If (match.Groups.Count = 2) Then
str4 = match.Groups.Item(1).Value
End If
Return str4
End Function
#End Region
#Region "Variables"
Public server As String
Public iGreen As String
Public iRed As String
Public iBlue As String
Public BootyArray(3) As String
Public sJackpot As String
Public sMain As String
Public iInfo As String
Public sHangar As String
Public iUID As String
Public sSID As String
Public sCredits As String
Public sUridium As String
Public cookie As CookieContainer
#End Region
#Region "API"
Public Function Login(ByVal username As String, ByVal password As String, ByVal server As String) As Boolean
Dim sb As StringBuilder = New StringBuilder()
sb.Append("loginForm_default_username=")
sb.Append(EncodeUsername(username))
sb.Append("&loginForm_default_password=")
sb.Append(EncodeUsername(password))
sb.Append("&loginForm_default_login_submit=Login")
Dim sLogged As String = GetResponse("http://www.darkorbit.com/?locale=de&aid=0", sb.ToString)
If sLogged.Contains("serverSelection_ini ini_active") Then
GetResponse("http://" & server & ".darkorbit.bigpoint.com/GameAPI.php?" & StringBetween(sLogged, "http://" & server & ".darkorbit.bigpoint.com/GameAPI.php?", Chr(34) & " onclick=" & Chr(34) & "InstanceSelection.clickedIni(this);" & Chr(34) & ">"))
GetResponse("http://" & server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalDock")
Return True
End If
Return False
End Function
Public Function GetBootys(ByVal content As String) As String()
GetResponse("http://" & server & ".darkorbit.bigpoint.com/indexInternal.es?action=internalDock")
iGreen = StringRegExp(content, "<span title=" & Chr(34) & "(\d) ")
iRed = StringRegExp(content, "<span title=" & Chr(34) & "(\d) ")
iBlue = StringRegExp(content, "<span title=" & Chr(34) & "(\d) ")
BootyArray(0) = iGreen
BootyArray(1) = iRed
BootyArray(2) = iBlue
Return BootyArray
End Function
Public Function GetJackpot(ByVal content As String) As String
sJackpot = StringBetween(content, "<div>", "</div>")
Return sJackpot
End Function
Public Function GetMainInfos(ByVal content As String) As String
GetResponse("http://" & server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalStart")
sMain = StringBetween(content, "class=" & Chr(34) & "userInfo_right" & Chr(34) & ">", "</div><br")
Return sMain
End Function
Public Function GetUserInfos(ByVal content As String) As String
iInfo = StringBetween(content, "<span>", "</span>")
Return iInfo
End Function
Public Function GetHangarInfos(ByVal content As String) As String
GetResponse("http://" & server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalDock")
sHangar = StringBetween(content, "<td class=" & Chr(34) & "values" & Chr(34) & ">", "</td>")
Return sHangar
End Function
Public Function GetUID(ByVal content As String) As String
iUID = StringRegExp(content, "userKeyId : '(.*?)',")
Return iUID
End Function
Public Function GetSID(ByVal content As String) As String
sSID = StringRegExp(content, "var SID='dosid=(.*?)';")
Return sSID
End Function
Public Function GetCredits(ByVal content As String) As String
sCredits = StringBetween(content, "class=" & Chr(34) & "header_money" & Chr(34) & ">", "</div>")
sCredits = sCredits.Replace(" ", "")
Return sCredits
End Function
Public Function GetUri(ByVal content As String) As String
sUridium = StringBetween(content, ";" & Chr(34) & " >", "</a>")
sUridium = sUridium.Trim(CChar(">"))
sUridium = sUridium.Replace(" ", "")
Return sUridium
End Function
Public Function EncodeUsername(ByVal string0 As String) As String
Dim stringdata() As Byte = New UTF8Encoding().GetBytes(string0)
Dim temp As String = ""
For Each b As Byte In stringdata
temp += "%" + BitConverter.ToString(New Byte() {b})
Next
Return temp
End Function
#End Region
End Module
This function login into darkorbit mainpage with userinfo and the windows http client !
It will return the source code in html of the darkorbit webpage
In the header of every function are infos like how to use and how to or what theyre returning.
$soruce=_INetGetSource("http://"&$server&".darkorbit.bigpoint.com/indexInternal.es?action=internalDock&dosid="&$SID)
$array=_Get_Hangar_Infos($soruce)
$dronenumber=$array[16]+$array[17]+$array[18]+$array[19];nflax+niris+napis+nzeus
$numberarray=0;to check the new drone info in array[]
$arraydim=0;to add new array
For $i=1 to $dronenumber
$dronesArray[$arraydim]=$array[20+$numberarray]&" DMG "&$array[21+$numberarray]&" PNT "&$array[22+$numberarray]&$array[23+$numberarray]
$numberarray+=4
$arraydim+=1
Next
We will code the drones later, because we are too lazy for the math
Yes i know but the script that i post (AutoIT obviusly) work good and there's no problem with it if you want you can add it. I just want to help you and requi that sometimes helped me with suggestion on coding.