Results 1 to 7 of 7

Thread: [C#] Kiss the Mortog AutoPlayer Source

  1. #1
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,720
    Userbars
    166
    Thanks
    5,906
    Thanked
    33,076/6,608
    DL/UL
    23/36
    Mentioned
    3,867 times
    Time Online
    563d 4h 55m
    Avg. Time Online
    3h 13m

    [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)

  3. #2

    Integra's Avatar
    Joined
    Nov 2013
    Posts
    213
    Userbars
    3
    Thanks
    53
    Thanked
    45/32
    DL/UL
    25/0
    Mentioned
    12 times
    Time Online
    4d 18h 34m
    Avg. Time Online
    1m
    Very well commented code for one my most hated games. Would love to see if someone can pull out the 2,000,000 max with it

  4. The Following User Says Thank You to Integra For This Useful Post:

    j03 (08-22-2014)

  5. #3
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,720
    Userbars
    166
    Thanks
    5,906
    Thanked
    33,076/6,608
    DL/UL
    23/36
    Mentioned
    3,867 times
    Time Online
    563d 4h 55m
    Avg. Time Online
    3h 13m
    Quote Originally Posted by Integra View Post
    Very well commented code for one my most hated games. Would love to see if someone can pull out the 2,000,000 max with it
    Well as you can see it picks a random Mortog each time. I think you have better luck with a pattern but I don't want tnt to catch on.

    Will have this released with Stealth Core tonight.
    (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.
    ------------------------


  6. The Following User Says Thank You to j03 For This Useful Post:

    Integra (08-22-2014)

  7. #4

    Integra's Avatar
    Joined
    Nov 2013
    Posts
    213
    Userbars
    3
    Thanks
    53
    Thanked
    45/32
    DL/UL
    25/0
    Mentioned
    12 times
    Time Online
    4d 18h 34m
    Avg. Time Online
    1m
    Quote Originally Posted by Infamous Joe View Post
    Well as you can see it picks a random Mortog each time. I think you have better luck with a pattern but I don't want tnt to catch on.

    Will have this released with Stealth Core tonight.
    Agreed on the patterns, but would they catch on if its a known pattern up to a certain point and then random i.e. first 4 Mortogs are always the same and then it goes for a random one?

  8. #5
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,720
    Userbars
    166
    Thanks
    5,906
    Thanked
    33,076/6,608
    DL/UL
    23/36
    Mentioned
    3,867 times
    Time Online
    563d 4h 55m
    Avg. Time Online
    3h 13m
    Quote Originally Posted by Integra View Post
    Agreed on the patterns, but would they catch on if its a known pattern up to a certain point and then random i.e. first 4 Mortogs are always the same and then it goes for a random one?
    That's a good idea. It would be easy to implement but I'm not sure of a pattern that always seems to work.
    (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.
    ------------------------


  9. The Following User Says Thank You to j03 For This Useful Post:

    Integra (08-23-2014)

  10. #6

    Joined
    Nov 2012
    Posts
    29
    Thanks
    4
    Thanked
    16/6
    DL/UL
    52/0
    Mentioned
    4 times
    Time Online
    2d 36m
    Avg. Time Online
    N/A
    I was actually just going to make one of these, except Visual Studio crashed and I lost my projects... Oh well. Thanks for the source.

  11. #7

    Integra's Avatar
    Joined
    Nov 2013
    Posts
    213
    Userbars
    3
    Thanks
    53
    Thanked
    45/32
    DL/UL
    25/0
    Mentioned
    12 times
    Time Online
    4d 18h 34m
    Avg. Time Online
    1m
    Quote Originally Posted by Infamous Joe View Post
    That's a good idea. It would be easy to implement but I'm not sure of a pattern that always seems to work.
    None always works, it is a gambling game remember I've had good experiences with 1-1-2-4 as the first 4.... but others have others, maybe let the user input their chosen first 4 and then if they're playing for NP and not an avatar, the program can randomise the picks after that? Can't see it being too hard to add in really. Mind you if you were to let them enter the first 4 might as well let them enter a 7 pattern as a third option as well to see if they can pick a pattern that will eventually win the game.
    Last edited by Integra; 08-23-2014 at 02:56 AM.

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
  •