public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null || !client.HasAuth()) { return; } var index = mc.Database.DeletePersona(client.User.ID, PERS); if (index == -1) { return; } var user = client.User; for (int i = index; i < 4; i++) { user.Personas[index] = (i == 4) ? null : user.Personas[index + 1]; } client.SendMessage(new DperOut() { NAME = user.Username, PERS = PERS }); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null || !client.HasAuth()) { return; } var index = mc.Database.AddPersona(client.User.ID, PERS); if (index < 0) { if (index == -2) { client.SendMessage(new CperDupl()); } else { client.SendMessage(new CperImst()); } return; } var user = client.User; user.Personas[index] = PERS; client.SendMessage(new CperOut() { NAME = user.Username, PERS = PERS }); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } var info = new DbAccount() { Username = NAME, Password = PASS, }; var created = mc.Database.CreateNew(info); if (created) { Console.WriteLine("Created new account: " + info.Username); client.SendMessage(new AcctOut() { NAME = NAME, PERSONAS = "", AGE = "24" }); } else { client.SendMessage(new AcctDupl()); } }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } //TODO: provide actual user info var user = client.User; if (user == null) { return; } var result = new UserOut() { MESG = user.Username, ADDR = user.IP, }; client.SendMessage(result); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null || !client.HasAuth()) { return; } var user = client.User; var mesg = new PlusMesg() { N = user.PersonaName, T = TEXT, }; //where is this message going var room = user.CurrentRoom; if (PRIV != null) { if (ATTR != null && ATTR.Length > 1 && ATTR[0] == 'N') { mesg.F = "EP" + ATTR.Substring(1); } mc.SendToPersona(PRIV, mesg); } else if (room != null) { room.Users.Broadcast(mesg); } }
public override void Process(AbstractEAServer context, EAClient client) { //TODO: get actual session key client.SendMessage(new SKeyOut()); client.SendMessage(new NewsOut()); client.SendMessage(new SKeyOut()); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } var user = client.User; if (user == null || user.SelectedPersona != -1) { return; } user.SelectPersona(PERS); if (user.SelectedPersona == -1) { return; //failed? } client.SendMessage(new PersOut() { NAME = user.Username, PERS = user.PersonaName }); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } var user = client.User; if (user == null) { return; } var info = user.GetInfo(); client.SendMessage(info); var OtherPlayer = mc.Users.GetUserByPersonaName(PERS); if (OtherPlayer == null) { client.SendMessage(new OnlnOut()); return; } if (OtherPlayer.PersonaName == user.PersonaName) { //There doesn't seem to be any error types or messages for searching for yourself. client.SendMessage(new OnlnOut() { N = user.PersonaName, }); return; } if (OtherPlayer.CurrentRoom != null) { client.SendMessage(new OnlnOut() { //Other player is online and are in a room. N = OtherPlayer.PersonaName, RM = OtherPlayer.CurrentRoom.Name, }); return; } else if (OtherPlayer.CurrentRoom == null) { client.SendMessage(new OnlnOut() { //Other player isn't in a room, but they are online in the main lobby. N = OtherPlayer.PersonaName, }); return; } }
public override void Process(AbstractEAServer context, EAClient client) { var response = new DirOut(); var rc = context as RedirectorServer; if (rc == null) { return; } response.ADDR = rc.RedirIP; response.PORT = rc.RedirPort; client.SendMessage(response); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } var user = client.User; if (user == null) { return; } user.Auxiliary = TEXT; client.SendMessage(this); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } var user = client.User; if (user == null) { return; } if (user.CurrentRoom != null) { user.CurrentRoom.Users.RemoveUser(user); user.CurrentRoom = null; } var room = mc.Rooms.GetRoomByName(NAME); if (room != null) { if (!room.Users.AddUser(user)) { client.SendMessage(new MoveFull()); return; } user.CurrentRoom = room; } else { client.SendMessage(new MoveOut() { NAME = "" }); } }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } var user = mc.Database.GetByName(NAME); if (user == null) { client.SendMessage(new AuthImst()); return; } Console.WriteLine("Logged in: " + user.Username); mc.TryLogin(user, client); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } var user = client.User; if (user == null) { return; } var Room = user.CurrentRoom; var info = user.GetInfo(); client.SendMessage(info); client.SendMessage(this); //client.SendMessage(new OnlnImst()); }
public override void Process(AbstractEAServer context, EAClient client) { client.SendMessage(new UatrOut()); }
public virtual void Process(AbstractEAServer context, EAClient client) { }
public override void Process(AbstractEAServer context, EAClient client) { client.Ping = (int)(new TimeSpan(DateTime.Now.Ticks - client.PingSendTick).TotalMilliseconds); }
public override void Process(AbstractEAServer context, EAClient client) { var mc = context as MatchmakerServer; if (mc == null) { return; } var user = client.User; if (user == null) { return; } var room = user.CurrentRoom; if (room == null) { return; } _From = user.PersonaName; _FromUser = user; lock (room.ChallengeMap) { room.RemoveChallenges(user); //remove any challenges we made before if (PERS == "*") { //we don't want to play with anyone anymore return; } //firstly, is someone wanting to play with us yet else if (room.ChallengeMap.ContainsKey(user.PersonaName)) { //and we want to play with them? var other = room.ChallengeMap[user.PersonaName]; if (PERS == other._From) { //start the session. var chals = new Chal[] { this, other }; var host = chals.FirstOrDefault(x => x.HOST == "1"); var users = chals.Select(x => x._FromUser); if (host == null) { return; //?? } if (room.AllInGame) { users = room.Users.GetAll(); Console.WriteLine("Starting an all play game session: " + string.Join(',', users.Select(x => x.PersonaName))); } else { Console.WriteLine("Starting a private game session between " + _From + " and " + this.PERS); } var sess = new PlusSes() { IDENT = "1", HOST = host._From, ROOM = room.Name, KIND = host.KIND, COUNT = users.Count().ToString(), OPID = users.Select(x => x.ID.ToString()).ToArray(), OPPO = users.Select(x => x.PersonaName).ToArray(), ADDR = users.Select(x => x.IP).ToArray(), SEED = (new Random()).Next().ToString(), SELF = user.PersonaName }; /* * Experimental stuff to try get bustin out to connect multiple users * didn't work unfortunately. * if (room.AllInGame) * { * //send a packet containing everyone to the host * sess.SELF = host._From; * var hostuser = host._FromUser; * hostuser.Connection?.SendMessage(sess); * * //send a packet containing only the host and self to everyone else * foreach (var userx in users) * { * if (userx == hostuser) continue; * sess.SELF = userx.PersonaName; * * var nusers = new List<User>() { hostuser, userx }; * * sess.COUNT = "2"; * sess.OPID = nusers.Select(x => x.ID.ToString()).ToArray(); * sess.OPPO = nusers.Select(x => x.PersonaName).ToArray(); * sess.ADDR = nusers.Select(x => x.IP).ToArray(); * * userx.Connection?.SendMessage(sess); * } * } * else * {*/ foreach (var userx in users) { sess.SELF = userx.PersonaName; userx.Connection?.SendMessage(sess); } //} return; } } //otherwise let's add this room.ChallengeMap[PERS] = this; } }
public override void Process(AbstractEAServer context, EAClient client) { //TODO: provide some actual statistics client.SendMessage(new SeleOut()); }
public override void Process(AbstractEAServer context, EAClient client) { client.Port = PORT; }