|
You last visited: Today at 08:49
Advertisement
DarkOrbit API Class by Requi and Fluttershy
Discussion on DarkOrbit API Class by Requi and Fluttershy within the DarkOrbit forum part of the Browsergames category.
08/05/2013, 01:57
|
#1
|
elite*gold: 3570
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
|
DarkOrbit API Class by Requi and Fluttershy
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
The code of the API:
Code:
'<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
The C# API:
Code:
//<C> by Requi (Coding the API)
//<C> by FlutterShy (Code in Auto(sh)it)
//<C> by all e*pvp Users, for being our fans <3
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
public static class 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
#endregion
#region "Variables"
public static string server;
public static string iGreen;
public static string iRed;
public static string iBlue;
public static string[] BootyArray = new string[3];
public static string sJackpot;
public static string sMain;
public static string iInfo;
public static string sHangar;
public static string iUID;
public static string sSID;
public static string sCredits;
public static string sUridium;
public static CookieContainer cookie;
#endregion
#region "HTTP"
public static string GetResponse(string sUrl, string sPost)
{
try
{
HttpWebRequest nRequest = (HttpWebRequest)WebRequest.Create(sUrl);
nRequest.Method = "POST";
nRequest.CookieContainer = cookie;
nRequest.ContentType = "application/x-www-form-urlencoded";
nRequest.Proxy = new WebProxy();
byte[] nbyteArray = Encoding.UTF8.GetBytes(sPost);
nRequest.ContentLength = nbyteArray.Length;
Stream nDataStream = nRequest.GetRequestStream();
nDataStream.Write(nbyteArray, 0, nbyteArray.Length);
nDataStream.Close();
nRequest.KeepAlive = true;
nRequest.AllowAutoRedirect = true;
nRequest.PreAuthenticate = true;
HttpWebResponse nResponse = (HttpWebResponse)nRequest.GetResponse();
nDataStream = nResponse.GetResponseStream();
StreamReader nreader = new StreamReader(nDataStream);
string nServerResponse = nreader.ReadToEnd();
nreader.Close();
nDataStream.Close();
nResponse.Close();
return nServerResponse;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return null;
}
}
static CookieContainer static_GetResponse_cookiecontainer;
static CookieCollection static_GetResponse_cookiecoll;
public static string GetResponse(string sUrl)
{
try
{
if ((static_GetResponse_cookiecoll == null))
{
static_GetResponse_cookiecoll = new CookieCollection();
}
if ((static_GetResponse_cookiecontainer == null))
{
static_GetResponse_cookiecontainer = new CookieContainer();
}
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(sUrl);
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 = static_GetResponse_cookiecontainer;
req.CookieContainer.Add(static_GetResponse_cookiecoll);
req.Proxy = new WebProxy();
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream());
string html = sr.ReadToEnd();
sr.Close();
response.Close();
return html;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return null;
}
}
public static string StringBetween(string content, string strStart, string strEnd)
{
try
{
int iPos = 0;
int startPos = 0;
int iEnd = 0;
int lenStart = strStart.Length;
string strResult = null;
strResult = string.Empty;
iPos = content.IndexOf(strStart, startPos);
iEnd = content.IndexOf(strEnd, iPos + lenStart);
if (iPos != -1 && iEnd != -1)
{
strResult = content.Substring(iPos + lenStart, iEnd - (iPos + lenStart));
}
return strResult;
}
catch
{
return Convert.ToString(false);
}
}
public static string StringRegExp(string content, string regstring)
{
string str4 = "";
string input = content;
Match match = Regex.Match(input, regstring, RegexOptions.Multiline);
if ((match.Groups.Count == 2))
{
str4 = match.Groups[1].Value;
}
return str4;
}
#endregion
#region "API"
public static bool Login(string username, string password, string server)
{
StringBuilder sb = 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");
string sLogged = GetResponse("http://www.darkorbit.com/?locale=de&aid=0", sb.ToString());
if (sLogged.Contains("serverSelection_ini ini_active"))
{
GetResponse("http://" + server + ".darkorbit.bigpoint.com/GameAPI.php?" + StringBetween(sLogged, "http://" + server + ".darkorbit.bigpoint.com/GameAPI.php?", ((char)34).ToString() + " onclick=" + ((char)34).ToString() + "InstanceSelection.clickedIni(this);" + ((char)34).ToString() + ">"));
GetResponse("http://" + server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalDock");
return true;
}
return false;
}
public static string[] GetBootys(string content)
{
GetResponse("http://" + server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalDock");
iGreen = StringRegExp(content, "<span title=" + ((char)34).ToString() + "(\\d) ");
iRed = StringRegExp(content, "<span title=" + ((char)34).ToString() + "(\\d) ");
iBlue = StringRegExp(content, "<span title=" + ((char)34).ToString() + "(\\d) ");
BootyArray[0] = iGreen;
BootyArray[1] = iRed;
BootyArray[2] = iBlue;
return BootyArray;
}
public static string GetJackpot(string content)
{
sJackpot = StringBetween(content, "<div>", "</div>");
return sJackpot;
}
public static string GetMainInfos(string content)
{
GetResponse("http://" + server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalStart");
sMain = StringBetween(content, "class=" + ((char)34).ToString() + "userInfo_right" + ((char)34).ToString() + ">", "</div><br");
return sMain;
}
public static string GetUserInfos(string content)
{
iInfo = StringBetween(content, "<span>", "</span>");
return iInfo;
}
public static string GetHangarInfos(string content)
{
GetResponse("http://" + server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalDock");
sHangar = StringBetween(content, "<td class=" + ((char)34).ToString() + "values" + ((char)34).ToString() + ">", "</td>");
return sHangar;
}
public static string GetUID(string content)
{
iUID = StringRegExp(content, "userKeyId : '(.*?)',");
return iUID;
}
public static string GetSID(string content)
{
sSID = StringRegExp(content, "var SID='dosid=(.*?)';");
return sSID;
}
public static string GetCredits(string content)
{
sCredits = StringBetween(content, "class=" + ((char)34).ToString() + "header_money" + ((char)34).ToString() + ">", "</div>");
sCredits = sCredits.Replace(" ", "");
return sCredits;
}
public static string GetUri(string content)
{
sUridium = StringBetween(content, ";" + ((char)34).ToString() + " >", "</a>");
sUridium = sUridium.Trim(Convert.ToChar(">"));
sUridium = sUridium.Replace(" ", "");
return sUridium;
}
public static string EncodeUsername(string string0)
{
byte[] stringdata = new UTF8Encoding().GetBytes(string0);
string temp = "";
foreach (byte b in stringdata)
{
temp += "%" + BitConverter.ToString(new byte[] { b });
}
return temp;
}
#endregion
}
Code:
if (DarkOrbitAPI.Login("Requi", "isawesome", "de8")) == true
{
string src = DarkOrbitAPI.GetResponse("http://" & server + ".darkorbit.bigpoint.com/indexInternal.es?action=internalStart");
DarkOrbitAPI.GetCredits(src);
DarkOrbitAPI.GetUri(src);
MessageBox.Show(iCredits);
MessageBox.Show(iUridium);
}
else
{
MessageBox.Show("Username is wrong!!!!!!!!");
}
Regards,
Requi
|
|
|
08/05/2013, 01:58
|
#2
|
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
|
I want to share a little collection of functions in AutoIt with our community !
You can use this only in AutoIt !
There are more than 11 funcs that you can use in your scripts!
Example :
Code:
_DO_Login("username","password","server shortcut")
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.
Login should be like this :
Code:
$htmlSource = _DO_Login("username","password","server shortcut")
$SID = _Get_SID($htmlSource)
$SID will be the Session ID so you dont need to make packets for each connect on a Darkorbit page.
Functions like :
Code:
_Trap_Login_Sid($sServer,$iSessionID)
are for those who are allowed to code with the trapdoor.dll so ignore it if you dont have it or you write an application to Ink!
I hope you like that little UDF and use it in your bot but dont forget credits to me or requi!
Here you can copy the Functions or download the .au3 at the bottom of this post
Code:
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Author: FlutterShy
Script Function:
Darkorbit Functions :
Read from Darkorbit Page Source
11 functions
#ce ----------------------------------------------------------------------------
#include-once
#include <string.au3>
#include <winhttp.au3>
; #FUNCTION# ====================================================================================================================
; Name ..........: _DO_Login
; Description ...: Login in darkorbit
; Syntax ........: _DO_Login($sUsername, $sPassword, $sServer)
; Parameters ....: $sUsername - A string value.
; $sPassword - A string value.
; $sServer - A string value.
; Return values .: Source code of Darkorbit Main page
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _DO_Login($sUsername,$sPassword,$sServer)
$cookie = Random(500,3000,1)
$mainPage = $sServer & ".darkorbit.bigpoint.com"
$LoginPacket = "loginForm_default_username=" & _SpecialChar($sUsername) & "&loginForm_default_password=" & _SpecialChar($sPassword) & "&loginForm_default_login_submit=Login"
$hopen = _winhttpopen("Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0")
$hconnect = _winhttpconnect($hopen, $mainPage)
$shtml = _winhttpsimplerequest($hconnect, "GET", "")
$shtml = _winhttpsimplerequest($hconnect, "POST", "?locale=de&aid="&$cookie&"&aip=", $mainPage, $LoginPacket)
$astring = _stringbetween($shtml, 'class="serverSelection_ini ini_active" target="http://' & $sServer, '" onclick="InstanceSelection.clickedIni(this);"')
$astring = "http://" & $sServer & $astring[0]
$shtml = _winhttpsimplerequest($hconnect, "GET", $astring, $mainPage)
$shtml = _winhttpsimplerequest($hconnect, "GET", "indexInternal.es?action=internalStart", $mainPage, "indexInternal.es?action=internalStart")
_WinHttpCloseHandle($hopen)
_WinHttpClosehandle($hconnect)
Return $shtml
EndFunc
Func _Trap_Login_Sid($sServer,$iSessionID)
$dllOpen = DllOpen("TrapDoor.dll")
$iTrapiID = trapi_session_start($dllOpen,@DesktopWidth, @DesktopHeight)
If $iTrapiID = 0 Then
MsgBox(0,"exit","Please Restart the bot"&@CRLF&"error code :"&$iTrapiID&@CRLF&@CRLF&"Possible failures :"&@CRLF&"-No Internet"&@CRLF&"-No Admin Rights"&@CRLF&"-Blocked from Firewall"&@CRLF&"-Blocked from Antivirus")
Exit
EndIf
$sSource = trapi_get($dllOpen,$iTrapiID, "http://www.darkorbit.de/", "")
$sSource = trapi_get($dllOpen,$iTrapiID, "http://"&$sServer&".darkorbit.bigpoint.com/indexInternal.es?dosid="&$iSessionID, "")
Return $sSource
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Trap_Login
; Description ...: Login by using trap .dll
; Syntax ........: _Trap_Login($sUsername, $sPassword, $sServer)
; Parameters ....: $sUsername - A string value.
; $sPassword - A string value.
; $sServer - A string value.
; Return values .: html code / source
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: Dont works right
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Trap_Login($sUsername,$sPassword,$sServer)
$icookie = Random(500,3000,1)
$dllOpen = DllOpen("TrapDoor.dll")
$iTrapiID = trapi_session_start($dllOpen,@DesktopWidth, @DesktopHeight)
If $iTrapiID = 0 Then
MsgBox(0,"exit","Please Restart the bot"&@CRLF&"error code :"&$iTrapiID&@CRLF&@CRLF&"Possible failures :"&@CRLF&"-No Internet"&@CRLF&"-No Admin Rights"&@CRLF&"-Blocked from Firewall"&@CRLF&"-Blocked from Antivirus")
Exit
EndIf
$sSource = trapi_get($dllOpen,$iTrapiID, "http://www.darkorbit.de/", "")
$sSource = trapi_get($dllOpen,$iTrapiID, "http://www.darkorbit.de/?locale=de&aid="&$icookie&"&aip=","loginForm_default_username=" &$sUsername& "&loginForm_default_password="&$sPassword& "&loginForm_default_login_submit=Login")
$sBetween = _StringBetween($sSource,'target=\"http://' & $sServer &'.darkorbit.bigpoint.com','\"')
;LMsgBox(0,"",$sBetween)
$sRes = "http://" &$sServer& ".darkorbit.bigpoint.com" & $sBetween[0]
$sSource = trapi_get($dllOpen,$iTrapiID,$sRes,"")
$sSource = trapi_get($dllOpen,$iTrapiID, "http://"&$sServer&".darkorbit.bigpoint.com/indexInternal.es?action=internalStart&acceptDailyLoginBonus=1", "")
$Minimap = trapi_get($dllOpen,$iTrapiID, "http://"&$sServer&".darkorbit.bigpoint.com/indexInternal.es?action=internalMapRevolution", "")
Return $sSource
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_Bootys
; Description ...: Gets the value of Booty keys from Hangar page
; Syntax ........: _Get_Bootys($sSource)
; Parameters ....: $sSource - The source from the DO hangar page
; Return values .: Array of [0] = Green Bootys , [1] = Red Bootys , [2] = Blue Bootys
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_Bootys($sSource)
$iGreen = _StringBetween($sSource,'<td class="values"><span title="',' Grüne Beute-Keys" style="color: #00FF00">0</span>')
$iRed = _StringBetween($sSource,'#00FF00">0</span> | <span title="',' Rote Beute-Keys" style="color: #FF0000">0</span>')
$iBlue = _StringBetween($sSource,'style="color: #FF0000">0</span> | <span title="',' Blaue Beute-Keys" style="color: #0055FF">0</span></td') ;' Blaue Beute-Keys" style="color: #0055FF">0</span></td'
Local $BootyArray[3]
$BootyArray[0] = $iGreen[0]
$BootyArray[1] = $iRed[0]
$BootyArray[2] = $iBlue[0]
Return $BootyArray
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_Jackpot
; Description ...: get the value of jackpot with € or $ ....
; Syntax ........: _Get_Jackpot($sSource)
; Parameters ....: $sSource - The Source of a Darkorbit page
; Return values .: String Jackpot money
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_Jackpot($sSource)
$fJackpot = _StringBetween($sSource,'<div>','</div>')
;[0] = jackpot with € , $ .....
Return $fJackpot
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_Main_Infos
; Description ...: Gets main infos from main page of darkorbit
; Syntax ........: _Get_Main_Infos($sSource)
; Parameters ....: $sSource - A string value.
; Return values .: Return all Main Infos :
; .....:array[0] = Name of User with big and small letters
; .....:array[1] = Full Server name as String (Global America 1)
; .....:array[3] = Premium Status (Yes or No) as String
; .....:array[4] = level of logged in User as String (1,2,3,...,17)
; .....:array[5] = Company of logged in User as string (VRU,EIC,MMO)
; .....:array[6] = Position of player on map (1-2,3-8,4-5...)
; .....:array[7] = registered since (2010.03.24)
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_Main_Infos($sSource)
$sMain = _StringBetween($sSource,'class="userInfo_right">',"</div><br")
Return $sMain
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_User_Infos
; Description ...: Get User infos from every page
; Syntax ........: _Get_User_Infos($sSource)
; Parameters ....: $sSource - The source of any darkorbit page
; Return values .: array
; .....: array[0] = User ID of current user
; .....: array[1] = level of current user
; .....: array[2] = Honor of current user
; .....: array[3] = xp/exp of current user
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_User_Infos($sSource)
$iHonor = _StringBetween($sSource,"<span>","</span>")
Return $iHonor
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_Hangar_Infos
; Description ...: Gets all infos from hangar page
; Syntax ........: _Get_Hangar_Infos($sSource)
; Parameters ....: $sSource - The source of the darkorbit hangar page
; Return values .: array
; .....:[0] = Hitpoints Ship (now)
; .....:[1] = Max Hitpoints Ship
; .....:[2] = Nano thing (extra hitpoints)
; .....:[3] = max nano (extra hitpoints)
; .....:[4] = repair free
; .....:[5] = jump free (for jump cpu)
; .....:[7] = laser count (15 lasers in ship)
; .....:[8] = laser ammo
; .....:[9] = rocket ammo
; .....:[16] = how many flax drones
; .....:[17] = how many iris drones
; .....:[14] = damage/shield ratio (i.e. 92/8
; .....:between [20] and [50] are drone infos
; .....:[52] = pet name
; .....:[53] = pet fuel
; .....:[54] = pet lvl
; .....:[55] = pet hitpoints
; .....:[56] = pet fuel
; .....:[60] = pet shield / hp ratio
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_Hangar_Infos($sSource)
$iHangar = _StringBetween($sSource,'<td class="values">','</td>')
Return $iHangar
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Calc_Hangar_Drones
; Description ...: DONT WORKS
; ===============================================================================================================================
Func _Calc_Hangar_Drones($sArray)
$i3 = -4
$i6 = -8
$i9 = -12
$i12 = -16
$i15 = -20
$i18 = -24
$i21 = -28
$i24 = -32
#cs
$i3 = -3
$i6 = -6
$i9 = -9
$i12 = -12
$i15 = -15
$i18 = -18
$i21 = -21
$i24 = -24
#ce
If $sArray[16] = "0" Then
If $sArray[17] = "8" Then
Return True
Else
If $sArray[17] = "7" Then
Return $i3
ElseIf $sArray[17] = "6" Then
Return $i6
ElseIf $sArray[17] = "5" Then
Return $i9
ElseIf $sArray[17] = "4" Then
Return $i12
ElseIf $sArray[17] = "3" Then
Return $i15
ElseIf $sArray[17] = "2" Then
Return $i18
ElseIf $sArray[17] = "1" Then
Return $i21
ElseIf $sArray[17] = "0" Then
Return $i24
EndIf
EndIf
Else
If $sArray[16] = "0" Then
Return $i24
EndIf
EndIf
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_UID
; Description ...: Gets User ID of current user with source
; Syntax ........: _Get_UID($sSource)
; Parameters ....: $sSource - Any darkorbot source
; Return values .: User ID
; Author ........: Requi's SID and UID getter
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_UID($sSource)
$iUID = StringRegExp($sSource, "userKeyId : '(.*?)',", 3)
Return $iUID[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_SID
; Description ...: Gets Session ID of Current user
; Syntax ........: _Get_SID($sSource)
; Parameters ....: $sSource - Any darkorbit page source
; Return values .: SessionID
; Author ........: Requi's SID and UID getter
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_SID($sSource)
$iSID = StringRegExp($sSource, "var SID='dosid=(.*?)';", 3)
Return $iSID[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_Credits
; Description ...: Gets credits of current user
; Syntax ........: _Get_Credits($sSource)
; Parameters ....: $sSource - Any dakorbit page source
; Return values .: Credits as string
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_Credits($sSource)
$CR = _StringBetween($sSource,'class="header_money">',"</div>")
$CR=StringReplace($CR[0]," ","")
Return $CR
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Get_Uri
; Description ...: Gets uridium of current user
; Syntax ........: _Get_Uri($sSource)
; Parameters ....: $sSource - Any Darkorbit page source
; Return values .: None
; Author ........: FlutterShy
; Modified ......: /
; Remarks .......: /
; Related .......: /
; Link ..........: [url]http://www.elitepvpers.com/forum/members/4721429--fluttershy-.html[/url]
; Example .......: No
; ===============================================================================================================================
Func _Get_Uri($sSource)
$URI = _StringBetween($sSource,';" >',"</a>")
$URI = StringTrimLeft($URI[0],StringInStr($URI[0],">"))
$URI=StringReplace($URI," ","")
Return $URI
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _SpecialChar
; Description ...: Decodes a string with special chars into a valid string for logins
; Syntax ........: _SpecialChar($string)
; Parameters ....: $string - any string
; Return values .: HTML code for a special char
; Author ........: Someone from AutoIt section EPVP
; Modified ......: FlutterShy
; Remarks .......: /
; Related .......: /
; Link ..........: /
; Example .......: No
; ===============================================================================================================================
Func _SpecialChar($string)
$decoded = ""
$temp = StringToBinary($string, 4)
$temp = StringTrimLeft($temp, 2)
For $i = 1 To StringLen($temp) Step 2
$decoded = $decoded & "%" & StringMid($temp, $i, 2)
Next
Return $decoded
EndFunc
Func trapi_set_size($trapDll,$sessionId, $width, $height)
$ret = DllCall($trapDll, "int", "trapi_set_size", "int", $width, "int", $height)
EndFunc
Func trapi_mouse_up($trapDll,$sessionId, $x, $y)
$ret = DllCall($trapDll, "int", "trapi_mouse_up", "int", $x, "int", $y)
EndFunc
Func trapi_mouse_down($trapDll,$sessionId, $x, $y)
$ret = DllCall($trapDll, "int", "trapi_mouse_down", "int", $x, "int", $y)
EndFunc
Func trapi_mouse_move($trapDll,$sessionId, $x, $y)
$ret = DllCall($trapDll, "int", "trapi_mouse_move", "int", $x, "int", $y)
EndFunc
Func trapi_dll_cleanup($trapDll)
$ret = DllCall($trapDll, "none", "trapi_dll_cleanup")
EndFunc
Func trapi_image_search($trapDll,$sessionId, $base64BMP, $variation, $repaint)
$ret = DllCall($trapDll, "str", "trapi_image_search", "int", $sessionId, "str", $base64BMP, "int", $variation, "BOOLEAN", $repaint)
Return $ret[0]
EndFunc
Func trapi_image_save($trapDll,$sessionId, $filePath)
$ret = DllCall($trapDll, "int", "trapi_image_save", "int", $sessionId, "str", $filePath)
Return $ret[0]
EndFunc
Func trapi_get($trapDll,$sessionId, $url, $postData)
$ret = DllCall($trapDll, "str", "trapi_get", "int", $sessionId, "str", $url, "str", $postData)
Return $ret[0]
EndFunc
Func trapi_session_start($trapDll,$w, $h)
$ret = DllCall($trapDll, "int", "trapi_session_start", "int", 700, "int", 500)
Return $ret[0]
EndFunc
Func trapi_session_end($trapDll,$sessionId)
$ret = DllCall($trapDll, "int", "trapi_session_end", "int", $sessionId)
Return $ret[0]
EndFunc
Download :
|
|
|
08/05/2013, 03:28
|
#3
|
elite*gold: 237
Join Date: Sep 2010
Posts: 1,152
Received Thanks: 4,910
|
Even tho its a source code download, you still need a VirusTotal.
-jD
|
|
|
08/05/2013, 06:50
|
#4
|
elite*gold: 3570
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
|
#updated first post
Fixxed Booty Keys now and improved code. You need to declare the server variable for the API yourself.
Just put this in your frm_Load() Sub:
Code:
server = server.Text //But only if your textbox for the server is called server!
The bootykeys are given in a array.
Call it on this way:
Code:
Green Booty Key = BootyArray(0)
Red Booty Key = BootyArray(1)
Blue Booty Key = BootyArray(2)
But don't forget to call the function at first, that the variable gets a value.
Regards,
Requi
|
|
|
08/05/2013, 10:07
|
#5
|
elite*gold: 0
Join Date: May 2012
Posts: 868
Received Thanks: 947
|
Good work on it Requi, haven't looked into the source code, but I love this line:
Quote:
|
'<C> by FlutterShy (Code in Auto(sh)it)'
|
Fair enough.
|
|
|
08/05/2013, 10:20
|
#6
|
elite*gold: 3570
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
|
Any suggestions for a feature?
|
|
|
08/05/2013, 10:29
|
#7
|
elite*gold: 428
Join Date: Dec 2011
Posts: 2,722
Received Thanks: 2,035
|
GG clicker?
EDIT:
in my bot I used this to check iris info
Code:
$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
|
|
|
08/05/2013, 10:33
|
#8
|
elite*gold: 3570
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
|
Quote:
Originally Posted by fuso98
GG clicker? 
|
What do you exactly want. It's a API. Not something what you use in your project and it works all without doing anything
|
|
|
08/05/2013, 10:37
|
#9
|
elite*gold: 428
Join Date: Dec 2011
Posts: 2,722
Received Thanks: 2,035
|
I edit my last post, see if it can be helpfull to your api
|
|
|
08/05/2013, 10:42
|
#10
|
elite*gold: 3570
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
|
Quote:
Originally Posted by Ðaѓkšidé†
Will someone explain to me:
Im not a coder at all so this to me is like 0.o 
Thnx anyways, i guess...
|
If you want to make a tool with more functions like reading out credits etc. you don't want to code everytime the same ****.
With this API, you have this function everywhere. Just include it to your project and use the function, which I posted at first post
Quote:
Originally Posted by fuso98
I edit my last post, see if it can be helpfull to your api 
|
We will code the drones later, because we are too lazy for the math
|
|
|
08/05/2013, 10:44
|
#11
|
elite*gold: 6
Join Date: Aug 2012
Posts: 537
Received Thanks: 215
|
Quote:
Originally Posted by Requi
If you want to make a tool with more functions like reading out credits etc. you don't want to code everytime the same ****.
With this API, you have this function everywhere. Just include it to your project and use the function, which I posted at first post
We will code the drones later, because we are too lazy for the math 
|
Oooh.
Makes sense lol
I need to learn me some AutoIT & C#, holy smokes ...
Thnx
|
|
|
08/05/2013, 10:47
|
#12
|
elite*gold: 428
Join Date: Dec 2011
Posts: 2,722
Received Thanks: 2,035
|
Quote:
Originally Posted by Requi
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.
|
|
|
08/05/2013, 10:55
|
#13
|
elite*gold: 1
Join Date: Jun 2012
Posts: 5,819
Received Thanks: 3,200
|
Quote:
Originally Posted by Requi
Any suggestions for a feature?
|
You can add the Methods from my multitool source.
|
|
|
08/05/2013, 10:58
|
#14
|
elite*gold: 3570
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
|
Quote:
Originally Posted by 'Heaven.
You can add the Methods from my multitool source.
|
I'll look at it, when I slept.
24hours without sleeping again.
|
|
|
08/05/2013, 13:54
|
#15
|
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
|
Quote:
Originally Posted by »jD«
Even tho its a source code download, you still need a VirusTotal.
-jD
|
lol why  its added later i dont have internet on my computer
Quote:
Originally Posted by chichi011
Good work on it Requi, haven't looked into the source code, but I love this line:
Fair enough.
|
Its because the base was coded from me in autoit to use it with the trapdoor.dll and im coding now in .Net so requi decided to import all
@Requi :
Should we do a whole .dll with all functions ? but nothink that works with client only on webpage!
|
|
|
All times are GMT +1. The time now is 08:49.
|
|