Ejemplo n.º 1
0
        public void CharacterListEvent(Client c, string[] command)
        {
            if(c.ClientID == null)
            {
                c.Send(new ErrorException(ClientError.NOT_AUTHED, "Auth first"));
                return;
            }

            c.Send("character-list-begin");
            var chars = c.ListCharacters();
            foreach(Character row in chars)
                c.Send("character", new string[]{row.ID.ToString(), row.Name});

            c.Send("character-list-end");
        }
Ejemplo n.º 2
0
        public void SetCharacterEvent(Client c, string[] command)
        {
            var chars = c.ListCharacters();
            int id = int.Parse(command[0]);
            foreach(Character ch in chars)
            {
                if(ch.ID == id)
                {
                    MapServerClient msc = this.GetMapServer(ch.LastMap);

                    if(msc == null)
                    {
                        c.Send(new ErrorException(ClientError.INTERNAL_ERROR, "Internal error"));
                        return;
                    }

                    Guid g = Guid.NewGuid();
                    this.Challenges.Add(g, ch);
                    c.Send("connect", new string[] { g.ToString(), msc.c.Address.ToString(), msc.c.Port.ToString() });
                    return;
                }
            }

            c.Send(new ErrorException(ClientError.UNKNOWN_CHARACTER, "Unknown character"));
        }