Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2016-12-11 22:43:20, last edited by Era (2016-12-11 22:47:14)

Era
Member
From: ::1
Joined: 2015-05-06
Posts: 884

Quicker flying in godmode

using System;
using System.Collections.Generic;
using PlayerIOClient;
using System.Threading;

namespace flygod
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			Dictionary<int,string> users = new Dictionary<int,string>();
			Console.Write("email: ");
			string username = Console.ReadLine();
			Console.Write("password: ");
			string password = Console.ReadLine();
			Console.Write("worldid: ");
			string worldid = Console.ReadLine();
			Client cli = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw",username,password,null);
			Connection con = cli.Multiplayer.CreateJoinRoom(worldid,"everybodyedits217",true,null,null);
			con.Send("init");
			con.OnMessage += (sender, m) => {
				if (m.Type == "init") {
					if (!m.GetBoolean(15)) { Console.WriteLine("not owner!"); Environment.Exit(10); }
					con.Send("init2");
				}
				if (m.Type == "add") {
					users.Add(m.GetInt(0),m.GetString(1));
				}
				if (m.Type == "god") {
					con.Send("say", (m.GetBoolean(1) ? "/geffect ":"/reffect ") +  users[m.GetInt(0)] + " 2");
					con.Send("say", (m.GetBoolean(1) ? "/geffect ":"/reffect ") +  users[m.GetInt(0)] + " 7");
				}
			};
			Thread.Sleep(-1);
		}
	}
}

if someone wants they can compile it, but since i dont have any filehosting service i wont be hosting a compiled version, have fun.

Bsd clause 2 license //forums.everybodyedits.com/img/smilies/smile (the part with provided as is is important in this case //forums.everybodyedits.com/img/smilies/tongue)

Offline

Wooted by: (3)

#2 2016-12-11 22:57:39, last edited by drunkbnu (2016-12-11 22:58:41)

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: Quicker flying in godmode

You didn't even dare on adding a system to hide the password.

For if you need it...

string pw= "";
ConsoleKeyInfo key;
do {
  key = Console.ReadKey (true);
  if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter) pw += key.KeyChar;
  else if (key.Key == ConsoleKey.Backspace && pw.Length > 0) pw = pw.Substring (pw.Length - 1);
} while (key.Key != ConsoleKey.Enter);

Offline

Wooted by: (2)

#3 2016-12-11 22:58:51

Era
Member
From: ::1
Joined: 2015-05-06
Posts: 884

Re: Quicker flying in godmode

i doub't that many people look over your schoulder while you type in your password //forums.everybodyedits.com/img/smilies/smile

Offline

Wooted by: (2)

#4 2016-12-12 02:16:04, last edited by Tomahawk (2016-12-12 22:21:20)

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,824

Re: Quicker flying in godmode

This could crash if a player goes into god before they're added to the dictionary. Use Dictionary.TryGetValue() or slap a try catch in there.

Also you're assuming a constant EE version of 217. Read the version from the DB or avoid the need by using JoinRoom().


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

#5 2016-12-12 07:34:45

Era
Member
From: ::1
Joined: 2015-05-06
Posts: 884

Re: Quicker flying in godmode

Tomahawk wrote:

Also you're assuming a constant EE version of 217.

intentional.

Offline

#6 2016-12-12 17:23:13

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,824

Re: Quicker flying in godmode

Era wrote:
Tomahawk wrote:

Also you're assuming a constant EE version of 217.

intentional.

K but then it'll crash messily for subsequent EE versions. If it's intentional, put in error checking so it doesn't just crash.


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

#7 2016-12-12 18:10:15

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: Quicker flying in godmode

Tomahawk wrote:
Era wrote:
Tomahawk wrote:

Also you're assuming a constant EE version of 217.

intentional.

K but then it'll crash messily for subsequent EE versions. If it's intentional, put in error checking so it doesn't just crash.

Do it yourself.

Offline

#8 2016-12-12 19:49:49, last edited by Tomahawk (2016-12-12 19:51:47)

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,824

Re: Quicker flying in godmode

HG wrote:

Do it yourself.

What a nubby attitude.

Code that's been posted for everyone to copy paste shouldn't crash. It's not my job to fix it.

Or is that why the license is included?

BSD 2-Clause License wrote:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

BSD 2-Clause License wrote:

... AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

#9 2016-12-12 20:01:33, last edited by drunkbnu (2016-12-12 20:01:48)

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: Quicker flying in godmode

Tomahawk wrote:
HG wrote:

Do it yourself.

What a nubby attitude.

Code that's been posted for everyone to copy paste shouldn't crash. It's not my job to fix it.

Or is that why the license is included?

BSD 2-Clause License wrote:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

BSD 2-Clause License wrote:

... AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

You answered it by yourself.

BSD 2-Clause License wrote:

THIS SOFTWARE IS PROVIDED ... "AS IS"

Offline

#10 2016-12-12 22:20:37, last edited by Tomahawk (2016-12-13 21:42:25)

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,824

Re: Quicker flying in godmode

HG wrote:

You answered it by yourself.

The point is that this forum section should only contain reliable code. Don't defend it.


My turn:

using System;
using System.Collections.Generic;
using PlayerIOClient;

namespace Fast_Godmode
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, string> users = new Dictionary<int, string>();
            string name;
            bool terminating = false;

            Console.Write("Enter email: ");
            string email = Console.ReadLine();

            Console.Write("Enter password: ");
            string password = Console.ReadLine();
            Console.SetCursorPosition(0, Console.CursorTop - 1);
            Console.WriteLine("Enter password: " + new string('*', password.Length));

            Console.Write("Enter room ID: ");
            string roomID = Console.ReadLine();

            PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", email, password, null, delegate (Client cli)
            {
                cli.Multiplayer.JoinRoom(roomID, null, delegate (Connection con)
                {
                    con.Send("init");
                    con.OnMessage += (object sender, Message m) =>
                    {
                        if (m.Type == "init")
                        {
                            if (!m.GetBoolean(15))
                            {
                                con.Disconnect();
                                Console.Write("\nThe connected bot must be the world owner.\n\nPress any key to exit...");
                                Console.ReadKey();
                                Environment.Exit(0);
                                terminating = true;
                            }
                            con.Send("init2");
                            Console.Write("\nConnected. Press q to exit.");
                        }
                        if (m.Type == "add") users.Add(m.GetInt(0), m.GetString(1));
                        if (m.Type == "left") users.Remove(m.GetInt(0));
                        if (m.Type == "god" && users.TryGetValue(m.GetInt(0), out name))
                        { con.Send("say", (m.GetBoolean(1) ? "/geffect " : "/reffect ") + name + " 2"); }
                    };
                }, delegate (PlayerIOError e)
                {
                    Console.Write("\nRoom connection error:\n\n{0}\n\nPress any key to exit...", e.Message);
                    terminating = true;
                });
            }, delegate (PlayerIOError e)
            {
                Console.Write("\nGame connection error:\n\n{0}\n\nPress any key to exit...", e.Message);
                terminating = true;
            });
            while (!terminating && Console.ReadKey(true).Key != ConsoleKey.Q) ;
        }
    }
}

Disclaimer: I take full responsibility (but not liability) for any bot crashes that occur. Tell me and I'll fix the code.


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

#11 2016-12-12 22:53:07, last edited by drunkbnu (2016-12-12 22:57:05)

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: Quicker flying in godmode

using System;
using static System.Threading.Thread;

namespace FG {
  class Program {
    static void Main (string[] a) {
      string[] p = new string[0];
      try {
        Connection con = PlayerIO.QuickConnect.SimpleConnect ("everybody-edits-su9rn58o40itdbnw69plyw",a[0],a[1],null).Multiplayer.JoinRoom (a[2], null);
        con.Send ("init");
        con.OnMessage += delegate (object sender, Message e) {
          switch (e.Type) {
          case "init":
            if (!e.GetBool (15)) Environment.Exit (5);
            con.Send ("init2");
            break;
          case "init2":
            Console.WriteLine ("Logged in.");
            break;
          case "add":
            if (e.GetInt (0) > p.Length) Array.Resize (ref p, e.GetInt (0) + 200);
            p[e.GetInt (0)] = e.GetString (1);
            break;
          case "god":
            con.Send ("say", (e.GetBool (1) ? "/geffect " : "/reffect ") + p[e.GetInt (0)] + " 2");
            break;
          }
        };
        con.OnDisconnect += delegate (object sender, string reason) {
          Console.WriteLine (reason);
          Environment.Exit (55);
        };
        Sleep (-1);
      } catch (Exception error) {
        Console.WriteLine (error.Message);
        Environment.Exit (1);
      }
    }
  }
}

NOTE: Line 33 will throw an error, yet it will build fine and you can use it normally. This is an IDE bug, as the class System.Threading.Thread is static and so you can use the functions of it without having to prefix Thread.

Offline

#12 2016-12-12 23:27:39

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: Quicker flying in godmode

@HG
You say the single-version connection is intended, yet don't state any reason why it'd be intended (then again, nobody asked).
Eitherway: If it's intended as a feature, you should do error handling of some sort, otherwise you'd make the program crash, without the users having any change of recovery or knowledge what happened (you made no claim anywhere that this was intended solely for version 217, or for any version really).
If it's not intended as a feature (for example to limit people from using this on other EE versions), then it's a bug (out of lazyness), since again, no error handling and it's not forward-compatible.

In short:
Just say that you were lazy and it was something you felt like could be useful.
Since you're not giving an actually executable (which you can upload in a hundred places), users probably won't use it, but programmers instead would take your idea (of the effect usage) and use that in their own bots.
In case you meant for it to be ripped by programmers, just tell them it's about the idea of the effect part, and that the connection part isn't something they should b**** about, as it's not the core intention of this post.

(nvm, in short wasn't that short)

Offline

Wooted by:

#13 2016-12-13 17:00:21, last edited by Era (2016-12-13 17:18:44)

Era
Member
From: ::1
Joined: 2015-05-06
Posts: 884

Re: Quicker flying in godmode

I claimed that it was intended since i wrote it //forums.everybodyedits.com/img/smilies/tongue,
this code is only intended for version 217 since the protocol changes to often, if some people use it for some other version that's not my problem.

besides, i don't really care if programmers use it or not, but tiny examples can be quite good for people starting to learn c# since most finished bots are way more complex then the tiny /working/ code i have put up there.

i also never claimed that this is a final or finished version, i will probably update it sometime.

edit: i do apreciate critizism on my code since i can learn from it, but please do not turn this into a flamethread or make some accusations that i intentionally post broken code, thank you.

edit2: i assumed that it was pretty clear from the code what it was intended for, a hardcoded version is obviously not ment for other versions, especially when it is easy to check for.

Offline

Era1481644821639326

Board footer

Powered by FluxBB

[ Started around 1711633879.2366 - Generated in 0.057 seconds, 12 queries executed - Memory usage: 1.57 MiB (Peak: 1.75 MiB) ]