Results 1 to 7 of 7

Thread: [C#] Kiss the Mortog AutoPlayer Source

Threaded View

  1. #1
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,756
    Userbars
    176
    Thanks
    5,936
    Thanked
    33,185/6,626
    DL/UL
    23/36
    Mentioned
    3,871 times
    Time Online
    564d 11h 59m
    Avg. Time Online
    3h 12m

    [C#] Kiss the Mortog AutoPlayer Source

    I thought I would share this with the fellow programmers or those interested in seeing my code. I whipped this up the other day in about 20 minutes because I did not want to manually play the game. I will be adding it to the next Stealth Core update for all users to use.

    This will auto-play the game Kiss the Mortog on Neopets. This code is made public for learning purposes. If you copy and paste it into your program it will most likely NOT work. You'd need to change the HTTP client code and such.

    I think that we haven't really seen a public executable that auto-plays this game for quite some time because TNT has put in a bunch of security measures to stop bots from playing this game automatically. One of the main things is having a valid referrer. Check mine out and try to learn from it. Also, there are some things sent they also check that are sent with the requests (data).

    I think I commented my code well enough for a full understanding. If not, feel free to PM me or post with any questions. Have fun guys.

    Code:
            /// <summary>
            /// Auto-plays the game Kiss the Mortogs.
            /// </summary>
            public void KisstheMortogs()
            {
                string pageData; //Storing the response HTML to work with
                string gameHash; //Each game has a hash value that we need to send to the server
                int mCount = 2; // Mortog count
                int randomValue = 0; //Random security check
                bool stopGame = false; //If we ever need to break out of the game, but I don't use this
    
                try
                {
                    addToLog("Kiss the Mortog AP - Starting auto-player.");
    
                    while (!stopGame)
                    {
                        // Ignore this if statement, it's just to stop the task
                        if (ktmTime != null)
                        {
                            if (Functions.isExpired(ktmTime))
                            {
                                killTheThread("Kiss the Mortog AP task is now stopped.");
                                return;
                            }
                        }
    
                        this.Get("http://www.neopets.com/medieval/kissthemortog.phtml", "http://www.neopets.com/medieval/index.phtml");
                        pageData = this.ResponseBody;
    
                        gameHash = Functions.GetStringBetween(pageData, "ref_ck=", "'");
                        randomValue = Functions.Rand(300000, 900000);
                        do
                        {
                            this.Get("http://www.neopets.com/medieval/kissthemortog.phtml", "http://www.neopets.com/medieval/kissthemortog.phtml");
                            this.Get("http://www.neopets.com/medieval/process_kissthemortog.phtml?type=frogprince&num=" + Functions.Rand(1, mCount).ToString() + "&_ref_ck=" + gameHash, "http://www.neopets.com/medieval/kissthemortog.phtml");
                            this.Get("http://www.neopets.com/medieval/kissthemortog.phtml?type=end&num=" + (mCount - 1).ToString() + "&rnd=" + randomValue.ToString(), "http://www.neopets.com/medieval/kissthemortog.phtml");
                            pageData = this.ResponseBody;
    
                            //If the program sees we reached our goal (5900 prize), it will collect and stop
                            if (pageData.Contains("You have won <b>5,900 NP</b> so far..."))
                            {
                                addToLog("Kiss the Mortog AP - Reached prize! Collecting...");
                                this.Get("http://www.neopets.com/medieval/process_kissthemortog.phtml?type=collect&_ref_ck=" + gameHash + "&win=" + (mCount - 1).ToString(), "http://www.neopets.com/medieval/kissthemortog.phtml");
                                this.Get("http://www.neopets.com/medieval/kissthemortog.phtml?type=end&avnotice=0&rnd=" + randomValue.ToString());
                                addToLog("Kiss the Mortog AP - Collected prize. Task stopped.");
                                return;
                            }
    
                            // If the program sees a "collect winnings" button value, we know we can keep going
                            if (pageData.Contains("Collect Your Winning"))
                            {
                                addToLog("Kiss the Mortog AP - Won round #" + (mCount - 1).ToString() + ".");
                                this.Get("http://www.neopets.com/medieval/kissthemortog.phtml", "http://www.neopets.com/medieval/kissthemortog.phtml?type=end&num=" + (mCount - 1).ToString() + "&rnd=" + randomValue.ToString());
                                mCount++;
                            }
                            else //Otherwise, we lost the game and we reset our mortog count.
                            {
                                addToLog("Kiss the Mortog AP - Lost round #" + (mCount - 1).ToString() + ".");
                                this.Get("http://www.neopets.com/medieval/kissthemortog.phtml", "http://www.neopets.com/medieval/kissthemortog.phtml?type=end&num=" + (mCount - 1).ToString() + "&rnd=" + randomValue.ToString());
                                mCount = 2;
                            }
    
                            Thread.Sleep(Functions.Rand(800, 1000));
                        }
                        while (!pageData.Contains("'Leave this place'")); //The program knows to continue betting until we lose and the "leave place" button shows up
                    }
                }
                catch (SDHttpClientRequestException ex)
                {
                    addToLog(ex.ToString());
                }
            }
    (you need an account to see links)
    (you need an account to see links)(you need an account to see links)

    ------------------------
    [02/24/2013] Stealth CORE is made into the first standalone Neopets auto-player.
    ------------------------


  2. The Following 7 Users Say Thank You to j03 For This Useful Post:

    Accelerator (08-22-2014),Compulsiv (08-22-2014),GetJinxed (06-12-2016),Ghosts (08-22-2014),Integra (08-22-2014),Neal Caffrey (08-22-2014),npm (07-20-2015)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •