Requires HTTP Wrappers. Probably need to update it. Basic functions.
PHP Code:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Threading;
/*
* Gaiaonline Automation Class
*
* Developed By (In Order of Effort):
* Chris (http://forum.logicalgamers.com/members/chris.html)
* Chad (http://forum.logicalgamers.com/members/chad.html)
*
*/
public class Gaiaonline
{
#region Declarings
public HTTPWrapper Wrapper = null;
private String Gaia_URL_Nor = "http://www.gaiaonline.com/";
private String Gaia_URL_Wap = "http://www.gaiaonline.com/wap/";
private String Gaia_URL_NorLogin = "auth/login/";
private String Gaia_URL_WapLogin = "login/";
private String Gaia_URL_NorMyGaia = "mygaia/";
private String Gaia_URL_NorFriend = "profile/friendlist.php";
private String Gaia_URL_NorPrivateMessages = "profile/privmsg.php";
private String Gaia_URL_NorAddFriend = "friends/add/";
private String GAIA_URL_NorStatus = "status/set/";
private String GAIA_URL_WapStatus = "index/changestatus/";
private String Gaia_URL_NorDaily = "dailycandy/";
private String Gaia_URL_NorGSI = "chat/gsi/index.php";
private String Gaia_URL_NorBank = "gaia/bank.php";
private String Gaia_URL_NorForum = "forum/";
private String Gaia_URL_Ajax = "inventory/ajax/all";
private String Gaia_URL_ArenaCosplay = "arena/gaia/cosplay-avatar/vote/";
private String Gaia_URL_Profile = "profile/";
private String Gaia_URL_NorGift = "gaia/giftgiving.php";
private String Gaia_URL_Gift = "gaia/giftgiving.php?item=";
private String Gaia_URL_Inventory = "inventory/";
private String Gaia_URL_Account = "account/";
private String Gaia_URL_Market = "marketplace/";
private String Gaia_URL_MarketDetail = "itemdetail/";
private String Gaia_URL_MarketStore = "mystore/";
public String Gaia_VALUE_GSISalt = "Go-Gaia-XD-72squared";
private int[] Gaia_VALUE_DailyChances = new int[] { 1, 2, 3, 4, 5, 8 };
private String Gaia_VALUE_Username;
private String Gaia_VALUE_Password;
private String strHTML;
private int Wait = 0;
public Boolean blnWaiting = false;
public int intWaiting = 60;
private Boolean Running = false;
private Random random = new Random();
public List<String> Blah = new List<String>();
private String[] Details = new String[5];
#endregion
#region Login
public Boolean Login(String Username, String Password)
{
return Login(Username, Password, 0);
}
public Boolean Login(String Username, String Password, int Method)
{
switch (Method)
{
case 0:
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorLogin, "username=" + Username + "&password=" + Password + "&token=" + Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorLogin), "token\" value=\"", "\""), Gaia_URL_Nor).IndexOf("gold_amt") > -1)
{
Gaia_VALUE_Username = Username;
Gaia_VALUE_Password = Password;
return true;
}
break;
case 1:
if (Wrapper.Post(Gaia_URL_Wap + Gaia_URL_WapLogin, "username=" + Username + "&password=" + Password, Gaia_URL_Wap).IndexOf("gold") > -1)
{
Gaia_VALUE_Username = Username;
Gaia_VALUE_Password = Password;
return true;
}
break;
case 2:
if (Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[108,[" + Username + ", " + md5(md5(Password) + Gaia_VALUE_GSISalt) + "]]]", Gaia_URL_Nor).IndexOf("true") == -1)
{
Gaia_VALUE_Username = Username;
Gaia_VALUE_Password = Password;
return true;
}
break;
default:
//Debug Here ;P
break;
}
return false;
}
#endregion
#region Status Update
public Boolean Update_Status(String Status, int Method)
{
switch (Method)
{
case 0:
if (Wrapper.Post(Gaia_URL_Nor + GAIA_URL_NorStatus, "nonce=" + Wrapper.Between(Wrapper.Get(Gaia_URL_NorMyGaia, Gaia_URL_Nor), "nonce\" value=\"", "\"") + "&status=" + Status + "&format=json", Gaia_URL_NorMyGaia).IndexOf("gold_amt") > -1)
{
return true;
}
break;
case 1:
if (Wrapper.Post(Gaia_URL_Wap + GAIA_URL_WapStatus, "newstatus=" + Status, Gaia_URL_Wap).IndexOf("Your Status has been updated") > -1)
{
return true;
}
break;
default:
//Debug Here ;P
break;
}
return false;
}
#endregion
#region Daily Chance
public List<String> Daily_Chances()
{
List<String> Rewards = new List<String>();
for (int i = 0; i < Gaia_VALUE_DailyChances.Length; i++)
{
Rewards.Add(Daily_Chance(Gaia_VALUE_DailyChances[i]));
}
return Rewards;
}
public String Daily_Chance(int ListID)
{
String Return;
if ((Return = Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorDaily + "?mode=nojs&list_id=" + ListID, "action=issue", Gaia_URL_Nor)).IndexOf("Your Reward Is...") > -1)
{
return Wrapper.Between(Return, "Your Reward Is...</h1>", "</b>").Trim().Replace("<b>", "");
}
return String.Empty;
}
#endregion
#region Friends
public Boolean Force_Add(int User_ID)
{
if (Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?&v=sushi&m=114%01accept%01" + User_ID + "%01" + Get_Session()).IndexOf("The selected request was accepted") > -1)
{
return true;
}
return false;
}
public Boolean Add_Request(int UserID)
{
return Add_Request("", UserID);
}
public Boolean Add_Request(String Message, int UserID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorAddFriend + UserID + "/", "message=" + Message + "&friend_id=" + UserID + "&nonce=" + Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorAddFriend + UserID + "/", Gaia_URL_Nor), "name=\"nonce\" value=\"", "\""), Gaia_URL_Nor + Gaia_URL_NorAddFriend + UserID + "/").IndexOf("Success!") > -1)
{
return true;
}
return false;
}
public Boolean Remove_Request(int UserID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorFriend + "/", "action=Remove Request&user_ids[]=" + UserID, Gaia_URL_Nor + Gaia_URL_NorFriend).IndexOf("Success") > -1)
{
return true;
}
return false;
}
public Boolean Resend_Request(int UserID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorFriend + "/", "action=Resend Request&user_ids[]=" + UserID, Gaia_URL_Nor + Gaia_URL_NorFriend).IndexOf("Success") > -1)
{
return true;
}
return false;
}
public Boolean Add_Ignored(int UserID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorFriend, "action=Add Ignored&user_ids[]=" + UserID, Gaia_URL_Nor + Gaia_URL_NorFriend).IndexOf("Success") > -1)
{
return true;
}
return false;
}
public Boolean Remove_Ignored(int UserID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorFriend, "action=Remove Ignored&user_ids[]=" + UserID, Gaia_URL_Nor + Gaia_URL_NorFriend).IndexOf("Success") > -1)
{
return true;
}
return false;
}
public Boolean Move_To_Top(int UserID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorFriend, "action=Move To Top&user_ids[]=" + UserID, Gaia_URL_Nor + Gaia_URL_NorFriend).IndexOf("Success") > -1)
{
return true;
}
return false;
}
public Boolean Remove_Friend(int UserID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorAddFriend + UserID + "/", "action=Remove Friend&user_ids[]=" + UserID, Gaia_URL_Nor + Gaia_URL_NorAddFriend + UserID + "/").IndexOf("Success") > -1)
{
return true;
}
return false;
}
#endregion
#region Trade
public Boolean Trading_Pass()
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorBank, "password=" + Gaia_VALUE_Password + "&mode=buytrade&nonce=" + Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorBank, Gaia_URL_Nor), "name=\"nonce\" value=\"", "\""), Gaia_URL_Nor).IndexOf("Thank you!") > -1)
{
return true;
}
return false;
}
public String Create_Trade()
{
String Return = Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorBank, "username=" + Gaia_VALUE_Username + "&mode=create", Gaia_URL_Nor);
if (Return.IndexOf("Select an Item to add it to the trade") > -1)
{
return Wrapper.Between(Return, "bank_trade_id\" value=\"", "\"");
}
return String.Empty;
}
public Boolean Can_Update_Trade(String Trade_ID)
{
String Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorBank + "?mode=view&trade_id=" + Trade_ID, Gaia_URL_Nor + Gaia_URL_NorBank);
String Left_Status = Wrapper.Between(Return, "left_avatar\" class=\"status_", "\"");
String Right_Status = Wrapper.Between(Return, "right_avatar\" class=\"status_", "\"");
String Rev = Wrapper.Between(Return, "bank_last_revision\" value=\"", "\"");
if (Left_Status == Right_Status && Left_Status == "new" && Rev == "0")
{
return true;
}
else if (Left_Status == Right_Status && Left_Status == "inquiry" && Rev == "2")
{
return true;
}
else if (Left_Status == "inquiry" && Left_Status == "new" && Rev == "1")
{
return true;
}
else if (Left_Status == "accept" && Left_Status == "inquiry" && Rev == "3")
{
return true;
}
else
{
Console.WriteLine(Left_Status + " - " + Rev);
}
return false;
}
public Boolean Update_Trade(String Trade_ID, String Subject, String Items, String Gold)
{
String Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorBank + "?mode=view&trade_id=" + Trade_ID, Gaia_URL_Nor + Gaia_URL_NorBank);
Return = Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorBank, "item_serial_list=" + Items + "&gold=" + Gold + "&mode=submit_trade&subject=" + Subject + "&trade_id=" + Trade_ID + "&last_revision=" + Wrapper.Between(Return, "bank_last_revision\" value=\"", "\"") + "&nonce=" + Wrapper.Between(Return, "bank_nonce\" value=\"", "\"") + "&password=" + Gaia_VALUE_Password, Gaia_URL_Nor);
if (Return.IndexOf("You have accepted the trade successfully.") > -1 && Return.IndexOf("Your trade has been completed.") > -1 && Return.IndexOf("You have offered a new trade.") > -1 && Return.IndexOf("You have offered a new trade.") > -1)
{
return true;
}
return false;
}
public Boolean Cancel_Trade(String Trade_ID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorBank, "mode=cancel_trade&trade_id=" + Trade_ID + "&nonce=" + Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorBank, Gaia_URL_Nor + Gaia_URL_NorBank), "name=\"nonce\" value=\"", "\"") + "&password=" + Gaia_VALUE_Password, Gaia_URL_Nor).IndexOf("Your trade has been cancelled successfully.") > -1)
{
return true;
}
return false;
}
#endregion
#region Private Messages
public Boolean Send_Private_Message(String Username, String Subject, String Message)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorPrivateMessages + "?mode=post", "username=" + Username + "&subject=" + Subject + "&message=" + Message + "&folder=inbox&selected_options=post&btn_send=true=&mode=post", "http://www.gaiaonline.com/").IndexOf("Your Private Message has been sent to:") > -1)
{
return true;
}
return false;
}
public Boolean New_Private_Message(String Username, String Subject, String Message, Boolean sendTXT, Boolean attachSig)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorPrivateMessages + "?mode=post", "username=" + Username + "&subject=" + Subject + "&message=" + Message + (sendTXT ? "&send_pm=on" : "") + (attachSig ? "&attach_sig=on" : "") + "&area_code=&pn1=&pn2=&selected_options=Post&btn_send=true&preview=&Post=&mode=Post&src=&folder=inbox&id=", Gaia_URL_Nor).IndexOf("Your Private Message has been sent to:") > -1)
{
return true;
}
return false;
}
public String Read_Private_Message(String PM_ID)
{
String Return;
if ((Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorPrivateMessages + "?mode=read&id=" + PM_ID, Gaia_URL_Nor)).IndexOf("From:") > -1)
{
return Wrapper.Between(Return, "Postbody\">", "</span>");
}
return String.Empty;
}
public Boolean Delete_Private_Message(String PM_ID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorPrivateMessages, "mark[]=" + PM_ID + "&sid=&deleteone=Delete Marked", Gaia_URL_Nor).IndexOf("Your Private Message has been sent to:") > -1)
{
return true;
}
return false;
}
public Boolean Save_Private_Message(String PM_ID)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorPrivateMessages, "mark[]=" + PM_ID + "&sid=&deleteone=Save Marked", Gaia_URL_Nor).IndexOf("The messages have been saved") > -1)
{
return true;
}
return false;
}
public List<String> Get_Private_Messages()
{
String Return;
if ((Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorPrivateMessages, Gaia_URL_Nor)).IndexOf("This mailbox is empty.") > -1)
{
return new List<String>();
}
return Wrapper.GetAll(Return, "name=\"mark[]\" value=\"", "\"");
}
#endregion
#region GSI
public String Get_Session_Hash()
{
String Return;
if ((Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[109,[]]]")).IndexOf("true") > -1)
{
return Wrapper.Between(Return, "true,\"", "\"");
}
return String.Empty;
}
public String Get_Session()
{
return Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[109,[]]]"), ",true,\"", "\"]]");
}
#endregion
#region Booty Grab
public Boolean Fish_Booty_Grab(String En_ID, String Fish_ID, int Min_Fish)
{
String Return;
if ((Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[6500,[1]],[6510,[\"" + En_ID + "\",0,1]],[6511,[\"" + En_ID + "\",1]],[6512,[\"" + En_ID + "\",1]]]")).IndexOf("\"game_info\":") > -1)
{
List<String> Fish = Wrapper.GetAll(Wrapper.Between(Return, "[6511", "}],["), ":{\"name", "},\"");
List<String> Fish_IDs = new List<String>();
for (int j = 0; j < Fish.Count; j++)
{
String ID = String.Empty;
if (Fish[j].IndexOf("\"in_env\":\"1\"") > -1 && (ID = Wrapper.Between(Fish[j], "\"item_id\":\"", "\"")) != String.Empty && IsInteger(ID) && ID.ToString() == Fish_ID)
{
Fish_IDs.Add(ID);
}
}
if (Fish_IDs.Count >= Min_Fish)
{
return true;
}
}
return false;
}
public List<String> Start_Booty_Grab(String En_ID, String Sess_ID)
{
String Return;
if ((Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[6500,[1]],[6510,[\"" + En_ID + "\",0,1]],[6511,[\"" + En_ID + "\",1]],[6512,[\"" + En_ID + "\",1]],[107,[\"" + Sess_ID + "\"]]]")).IndexOf("\"game_info\":") > -1)
{
List<String> Fish = Wrapper.GetAll(Wrapper.Between(Return, "[\"6511", "}],["), ":{\"name", "},\"");
int Game_Worth = 0;
for (int j = 0; j < Fish.Count; j++)
{
String Cap = String.Empty;
if (Fish[j].IndexOf("\"in_env\":\"1\"") > -1 && (Cap = Wrapper.Between(Fish[j], "\"cap\":\"", "\"")) != String.Empty && IsInteger(Cap))
{
Game_Worth += int.Parse(Cap);
}
}
// Return = Wrapper.Between(Return, "\"game_info\":", "}},");
return new List<String> { Game_Worth.ToString(), Wrapper.Between(Return, "\"instance_id\":\"", "\""), Wrapper.Between(Return, ",\"user_id\":\"", "\",") };
}
return null;
}
public Boolean Complete_Booty_Grab(String En_ID, String Sess_ID, String Game_Worth, String Game_ID, String User_ID)
{
Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[102,[\"" + User_ID + "\"]]]");
String Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[6552,[\"" + Sess_ID + "\",\"" + En_ID + "\",\"" + Game_ID + "\"]]]");
if (Wrapper.Between(Return, "allow_to_play\":", "}") == Convert.ToString(1))
{
Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[6550,[\"" + Sess_ID + "\",\"" + En_ID + "\",\"" + Game_ID + "\",\"[{\\\"type\\\":1,\\\"amount\\\":" + Game_Worth + "}]\"]]]");
Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[6551,[\"" + Sess_ID + "\",\"" + En_ID + "\",\"" + Game_ID + "\"]]]");
return true;
}
return false;
}
public List<String> Find_Tanks()
{
String strThread = Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorForum + "gaia-aquarium/f.393/"), "<a class=\"goto-new-posts\" href=\"", "\"");
String strThreadID = Wrapper.Between(strThread, "/t.", "_recent");
List<String> tanksFound = Remove_Doubles(Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorForum + "gaia-aquarium/t." + strThreadID), "userEnvironmentId=", "\""));
List<String> glowingTanks = new List<String>();
for (int i = 0; i < tanksFound.Count; i++)
{
String Return;
if ((Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?v=json&m=[[6500,[1]],[6510,[\"" + tanksFound[i] + "\",0,1]],[6511,[\"" + tanksFound[i] + "\",1]],[6512,[\"" + tanksFound[i] + "\",1]]]")).IndexOf("\"game_info\":") > -1)
{
glowingTanks.Add(tanksFound[i].ToString());
}
}
return glowingTanks;
}
#endregion
#region Profile
public String Get_Username()
{
return Wrapper.Between(Wrapper.Get(Gaia_URL_Nor), "font-weight:bold;color:#;\" class=\"0\">", "!</span>");
}
public Boolean Comment_Profile(int User_ID, String Comment)
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_Profile + "?mode=addcomment&u=" + User_ID, "comment=" + Comment + "&submit=Submit").IndexOf("Added comment successfully ") > -1)
{
return true;
}
return false;
}
#endregion
#region Forums
public Boolean Post_New_Thread(Int32 Forum, String Title, String Message)
{
String Return = Wrapper.Get("http://www.gaiaonline.com/forum/compose/topic/new/?f=" + Forum);
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorForum + "compose/topic/new/" + Forum + "/", "title=" + Title + "&message=" + Message + "&nonce=" + Wrapper.Between(Return, "nonce\" value=\"", "\"") + "&action_submit=submit").IndexOf("Your topic has been submitted") > -1)
{
return true;
}
return false;
}
public Boolean Post_In_Thread(int Thread_ID, String Message)
{
///<Detail Information>
///0 = Nonce
///1 = Captcha Challenge
///2 = BLAH
///</Detail Information>
if ((Details[2] = Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorForum + "compose/entry/new/" + Thread_ID, "message=" + Message + "&nonce=" + Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorForum + "compose/entry/new" + Thread_ID), "nonce\" value=\"", "\" />") + "&action_submit=submit")).IndexOf("Your post has been submitted") > -1)
{
return true;
}
return false;
}
public List<String> Find_Multi_Thread_IDs(int Forum)
{
List<String> IDs = Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorForum + "/f." + Forum, "http://www.gaiaonline.com/"), "<a class=\"goto-new-posts\" href=\"", "\"");
List<String> ID = new List<String>();
for (int i = 0; i < IDs.Count; i++)
{
ID.Add(Wrapper.Between(IDs[i], "/t.", "_recent"));
}
return ID;
}
public String Find_Single_Thread_ID(int Forum)
{
String Thread = Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorForum + "/f." + Forum, "http://www.gaiaonline.com/"), "<a class=\"goto-new-posts\" href=\"", "\"");
return Wrapper.Between(Thread, "/t.", "_recent");
}
public void Find_Threads(String Forum, int StartPages, int Pages, String Fish_ID, int Min_Fish, String Log_Location)
{
List<String> RThreads = new List<String>();
for (int Roam = StartPages; Roam < Pages; Roam++)
{
Console.WriteLine("Page: " + (Roam + 1));
List<String> Threads = Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorForum + "f." + Forum + "/?sequence=" + ((Roam * 40) + 1)), "goto-last-post\" href=\"/forum/gaia-aquarium/", "_recent");
for (int cThread = 0; cThread < Threads.Count; cThread++)
{
if (Threads[cThread] != "")
{
List<String> CurrentThreads = Remove_Doubles(Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorForum + Threads[cThread]), "userEnvironmentId=", "\""));
for (int i = 0; i < CurrentThreads.Count; i++)
{
if (!RThreads.Contains(CurrentThreads[i]))
{
if (Fish_Booty_Grab(CurrentThreads[i], Fish_ID, Min_Fish))
{
Console.WriteLine("Found tank: " + CurrentThreads[i]);
Wrapper.Get(Log_Location + CurrentThreads[i]);
RThreads.Add(CurrentThreads[i]);
}
}
}
Thread.Sleep(10000);
}
}
}
}
#endregion
#region Gifting
public Boolean Send_Gift(int item_id, int item_parm, string item_name, string to_user, string message, string Password, string anonymous)
{
//If you want to send gift as anonymous then
//when you input the string it has to be
//1. Else it needs to be null.
String ItemInfo = item_id + "s" + item_parm;
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorGift, "item=" + ItemInfo + "&n=" + Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_Gift + ItemInfo), "name=\"n\" value=\"", "\">") + "&giftbox=1672" + "&giftuser=" + to_user + "&giftmessage=" + message + "&giftanon=" + anonymous + "&mode=submit").IndexOf("Success!") > -1)
{
return true;
}
return false;
}
public List<String> Get_Gift_Parm()
{
return Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_Inventory + "view/special"), "<img rel=\"\" id=\"", ".");
}
public String Open_Gift(int item_parm)
{
String Return;
if ((Return = Wrapper.Get(Gaia_URL_Nor + Gaia_URL_Inventory + "use/" + item_parm + "?nonce=" + Wrapper.Between(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_Account), "nonce\" value=\"", "\" />"))).IndexOf("You got: ") > -1)
{
return Wrapper.Between(Return, "You got: ", "</h3>");
}
return String.Empty;
}
#endregion
#region Inventory
public Boolean Clear_Storage()
{
if (Wrapper.Post(Gaia_URL_Nor + Gaia_URL_NorGSI, "?&v=json&m=[[710,[\"in0,in1,in2,in3,st0,in4,in5,in6,in7,in8,in9,in10,in11,in12,in13,in14,in15,in16,in17,in18,in19,in20,in21,in22,in23,in24,in25,in26,in27,in28,in29,in30,in31,in32,in33,in34,in35,in36,in37,in38,in39,in40,in41,in42,in43,in44,in45,in46,in47,in48,in49,in50,in51,in52,in53,in54,in55,in56,in57,in58,in59,in60,in61,in62,in63,in64\",\"empty\",\"\",\"empty\",\"\",null]]]").IndexOf("true,true") > -1)
{
return true;
}
return false;
}
public List<String> Get_Storage()
{
return Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?&v=json&m=[[703,[\"" + Get_Session() + "\",1,1000]]]"), "n\":\"", "\",\"");
}
public Int32 Storage_Count()
{
return Get_Storage().Count;
}
public List<String> Grab_Inventory_Items()
{
return Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_Ajax), "title=\"", "\"");
}
public List<String> Grab_All_Items()
{
List<String> Items = Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_Ajax), "<img id=\"", "\"");
List<String> Names = Grab_Inventory_Items();
for (int i = 0; i < Items.Count; i++)
{
Items[i] += "." + Names[i];
}
return Items;
}
public int Inventory_Count()
{
return Grab_Inventory_Items().Count;
}
#endregion
#region Gold
public int Get_Gold()
{
String Return;
if ((Return = Wrapper.Get(Gaia_URL_Nor)).IndexOf("gold_amt") > -1)
{
return int.Parse(Wrapper.Between(Return, "gold_amt\">", "</span>").Replace(",", String.Empty));
}
return -1;
}
#endregion
#region Gold Loto
public Boolean Submit_Ticket(int num1, int num2, int num3, int num4, int num5)
{
if (Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorGSI + "?&v=json&m=[[6580,[\"" + Get_Session() + "\",\"{\"basic\":\"" + num1 + "," + num2 + "," + num3 + "," + num4 + "," + num5 + "\"}\"]]]").IndexOf("Ticket submitted for game ") > -1)
{
return true;
}
return false;
}
#endregion
#region Other
public List<String> Grab_Usernames(int Forum)
{
String ID = Find_Single_Thread_ID(Forum);
List<String> UserNames = Wrapper.GetAll(Wrapper.Get(Gaia_URL_Nor + Gaia_URL_NorForum + "/t." + ID + "/"), "color: #333333;\">", "</span>");
return UserNames = Remove_Doubles(UserNames);
}
public int TimeStamp()
{
return (int)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMinutes;
}
public void Refresh(String URL, int Times)
{
for (int i = 0; i < Times; i++)
{
strHTML = Wrapper.Get(URL);
}
}
public String md5(String Password)
{
return System.Text.RegularExpressions.Regex.Replace(BitConverter.ToString((new MD5CryptoServiceProvider()).ComputeHash(ASCIIEncoding.Default.GetBytes(Password))), "-", "").ToLower();
}
private Boolean IsInteger(string Input)
{
Regex objNotWholePattern = new Regex("[^0-9]");
return !objNotWholePattern.IsMatch(Input) && (Input != null);
}
public List<String> Remove_Doubles(List<String> Input)
{
List<String> Return = new List<String>();
for (int i = 0; i < Input.Count; i++)
{
if (!Return.Contains(Input[i]))
{
Return.Add(Input[i]);
}
}
return Return;
}
#endregion
}
Results 1 to 1 of 1
Thread: [C#] Gaiaonline Class
- 09 Dec. 2011 04:58am #1
[C#] Gaiaonline Class