Login to TechLifeForum X
Board Index Go to Reboot.Pro
  • Account Login
  • Register
TechLifeForum
  • Home
  • Members
  • Awards
  • Rules
  • Help
  • Donate
  • Live IRC
TechLifeForum / General / Game, Music, & Other Electronics/Media Discussion v
« Previous 1 ... 4 5 6 7 8 ... 14 Next »
/ TORN - Online Text based RPG[Advanced Search]
« Previous 1 2 3 4
Reply to thread
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

TORN - Online Text based RPG

07-12-2012, 01:56 PM
Post: #31
///ViNcE Offline
Member
**
Posts: 110
Joined: Jul 2012
Reputation: 1
RE: TORN - Online Text based RPG
Dang haha, you guys still play the game because I might play???
Find
Reply
07-12-2012, 06:08 PM
Post: #32
KoBE Offline
¯\_(ツ)_/¯
*******
Administrators
Posts: 4,197
Joined: Jun 2011
Reputation: 47
RE: TORN - Online Text based RPG
Nope, I quit a couple of days ago. It got boring. :\

-> TechLifeForum on Facebook<- 
-> TechLifeForum on YouTube<-
-> TechLifeForum on Twitter<-

Tech.Reboot.Pro
WWW Find
Reply
07-12-2012, 07:45 PM
Post: #33
AceInfinity Offline
∞ IҊϜIɴITϵ ☭
*****
Microsoft MVP
Posts: 8,696
Joined: Jun 2011
Reputation: 61
RE: TORN - Online Text based RPG
Gets boring quick yeah lol, I don't know how people manage to get up to levels 50+ and still play.



Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer


Development Site: aceinfinity.net
WWW Find
Reply
07-12-2012, 08:04 PM
Post: #34
KoBE Offline
¯\_(ツ)_/¯
*******
Administrators
Posts: 4,197
Joined: Jun 2011
Reputation: 47
RE: TORN - Online Text based RPG
You got me.. I got up to 300mil or so and was like: um, I'm bored.

-> TechLifeForum on Facebook<- 
-> TechLifeForum on YouTube<-
-> TechLifeForum on Twitter<-

Tech.Reboot.Pro
WWW Find
Reply
07-12-2012, 08:08 PM (This post was last modified: 07-12-2012 08:12 PM by AceInfinity.)
Post: #35
AceInfinity Offline
∞ IҊϜIɴITϵ ☭
*****
Microsoft MVP
Posts: 8,696
Joined: Jun 2011
Reputation: 61
RE: TORN - Online Text based RPG
Hahaha, I even got bored writing the bot for it, because I don't even play this game, I was starting to wonder, "Why am I doing this", so that's the initial question that made me get to finishing my Disc Dash bot instead :)

Oh yeah, here's my Bot class in case anybody was interested, it's not close to finished yet, but it logs in, and logs data.

Code: (SELECT ALL CODE)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using TORNBotLogger;

namespace TORN
{
    public class TORN_Bot
    {
        #region Constructor
        public TORN_Bot(string User, string Pass, Logger logger)
        {
            TORN_User = User;
            TORN_Pass = Pass;
            botLogger = logger;
        }
        #endregion

        #region Main Variables/Properties
        private string TORN_User { get; set; }
        private string TORN_Pass { get; set; }

        private Logger botLogger;
        private CookieContainer tempCookies;

        private bool BotStarted { get; set; }
        /// <summary>
        /// Check if user is logged in...
        /// </summary>
        private bool IsUserLoggedIn
        {
            get { return TestLogin(); }
        }
        #endregion

        #region Main Bot Methods
        public void StartBot()
        {
            BotStarted = true;
            botLogger.Write("Bot starting up...");
            TryUserLogin();
        }

        public void StopBot()
        {
            BotStarted = false;
        }

        private void TryUserLogin()
        {
            string postData = "player=" + TORN_User + "&password=" + TORN_Pass + "&btnLogin=Login&bonus=&bonusemail=";
            tempCookies = new CookieContainer();
            byte[] byteData = new UTF8Encoding().GetBytes(postData);
            HttpWebRequest postReq = (HttpWebRequest)WebRequest.Create("http://www.torn.com/authenticate.php");

            postReq.Method = "POST";
            postReq.KeepAlive = true;
            postReq.CookieContainer = tempCookies;
            postReq.ContentType = "application/x-www-form-urlencoded";
            postReq.Referer = "http://www.torn.com/";
            postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)";
            postReq.ContentLength = byteData.Length;

            Stream reqStream = postReq.GetRequestStream();
            reqStream.Write(byteData, 0, byteData.Length);
            reqStream.Close();
            reqStream.Dispose();

            HttpWebResponse postResp = default(HttpWebResponse);
            postResp = (HttpWebResponse)postReq.GetResponse();

            using (StreamReader postStream = new StreamReader(postResp.GetResponseStream()))
            {
                string data = postStream.ReadToEnd();
                if (data.Contains(string.Format("You have logged on {0}!", TORN_User)) || data.Contains("Logout"))
                {
                    botLogger.Write("Status: Successful login! Welcome " + TORN_User + " [" + Regex.Match(data, TORN_User + @" \[(.*?)\]").Groups[1].Value + "]");
                    SendPOSTData();
                }
                else
                {
                    botLogger.Write("Status: Failed login, Please try again \r\nBot shutting down...\r\n");
                }
            }
        }

        private void SendPOSTData()
        {
            //Check for captcha and bypass if it see's one.
            //Send POST data to increase stats in Gym
            //WAIT... Then...

            if (IsUserLoggedIn)
                SendPOSTData();
            else
                TryUserLogin();
        }
        #endregion

        #region Sub Methods
        /// <summary>
        /// Test Login by sending request to main
        /// (Returned from IsUserLoggedIn property)
        /// </summary>
        /// <returns></returns>
        private bool TestLogin()
        {
            tempCookies = tempCookies ?? new CookieContainer();
            HttpWebRequest postReq = (HttpWebRequest)WebRequest.Create("http://www.torn.com/index.php");

            postReq.Method = "GET";
            postReq.KeepAlive = true;
            postReq.CookieContainer = tempCookies;
            postReq.ContentType = "application/x-www-form-urlencoded";
            postReq.Referer = "http://www.torn.com/";
            postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)";

            HttpWebResponse postResp = default(HttpWebResponse);
            postResp = (HttpWebResponse)postReq.GetResponse();

            using (StreamReader postStream = new StreamReader(postResp.GetResponseStream()))
            {
                string data = postStream.ReadToEnd();
                if (data.Contains("Logout"))
                    return true;
                else
                    return false;
            }
        }
        #endregion
    }
}

In my Form1.cs I had:
Code: (SELECT ALL CODE)
TORN_Bot TB;

/// <summary>
/// Start or stop bot action
/// </summary>
private void btnAction_Click(object sender, EventArgs e)
{
    TB = new TORN_Bot(textBox2.Text, textBox3.Text, new Logger(ref textBox1));
    TB.StartBot();
}

Logger was an output class I made to log the Bots status and current activity, I pass a textbox from the main form to use.



Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer


Development Site: aceinfinity.net
WWW Find
Reply
« Previous 1 2 3 4
Reply to thread


Possibly Related Threads...

Thread: Author Replies: Views: Last Post
  The Elder Scrolls online Adriana 4 136 02-05-2013 06:08 AM
Last Post: Adriana

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


Users browsing this thread
1 Guest(s)
Youtube Facebook Twitter Digg
Return to Top
All content © copyright TechLifeForum
Powered By MyBB, © 2002-2013 MyBB Group
Designed by ThemeFreak
Mobile Version