Esempio n. 1
0
        public static void CharacaterCreate(this LPlayer session, Packet ClientPacket)
        {
            if (!ClientPacket.ReadUInt32(out uint CHAR_TYPEID))
            {
                return;
            }
            if (!ClientPacket.ReadUInt16(out ushort HAIR_COLOR))
            {
                return;
            }

            try
            {
                WriteConsole.WriteLine($"[PLAYER_CREATE_CHARACTER]: {IFFEntry.GetIff.GetName(CHAR_TYPEID).ToUpper()}");
                if (string.IsNullOrEmpty(session.UserInfo.GetNickname) == false)
                {
                    session.LoginSucess();
                }
                else
                {
                    session.Disconnect();
                    return;
                }
            }
            catch
            {
                session.Disconnect();
            }
        }
 /// <summary>
 /// Envia o pacote de chave de autenficacao A
 /// </summary>
 /// <param name="session"></param>
 public static void AuthKeyLogin(this LPlayer session)
 {
     session.Response.WriteUInt16(0x0010);
     session.Response.WritePStr("7430F52");//chave de autenficacao
     session.SavePacket("AuthKeyLogin");
     session.SendResponse();
 }
 /// <summary>
 /// Envia o pacote de chave de autenficacao B
 /// </summary>
 /// <param name="session">Jogador</param>
 public static void AuthKeyGame(this LPlayer session)
 {
     session.Response.Write(new byte[] { 0x03, 0x00 });
     session.Response.WriteInt32(0);
     session.Response.WritePStr("5130B52");//chave de autenficacao
     session.SavePacket("AuthKeyGame");
     session.SendResponse();
 }
        public static void SelectServer(this LPlayer session, Packet packet)
        {
            if (!packet.ReadUInt32(out uint ServerID))
            {
            }

            session.AuthKeyGame();
        }
        public static void LoginSucess(this LPlayer session)
        {
            session.AuthKeyLogin();

            session.GameMacro();

            session.Login();

            session.GameServerList();
        }
Esempio n. 6
0
        public static bool LoginResult(this LPlayer session, Packet packet)
        {
            if (!packet.ReadPStr(out session.UserInfo.GetLogin))
            {
                return(false);
            }

            if (!packet.ReadPStr(out session.UserInfo.GetPass))
            {
                return(false);
            }

            Console.WriteLine($"Login packet: {session.UserInfo.GetLogin}:{session.UserInfo.GetPass}");
            var count = Directory.GetFiles(@"Packets", "*.*", SearchOption.TopDirectoryOnly).Count();

            if (count >= 7)
            {
                if (File.Exists("Packets\\Login.hex"))
                {
                    var reader = new PangyaBinaryReader(new MemoryStream(File.ReadAllBytes("Packets\\Login.hex")));
                    reader.Skip(3);
                    var GetLogin = reader.ReadPStr();
                    session.UserInfo.GetUID        = reader.ReadUInt32();
                    session.UserInfo.GetCapability = (byte)reader.ReadUInt32();
                    session.UserInfo.GetLevel      = (byte)reader.ReadUInt32();
                    reader.Skip(6);
                    var GetNickname = reader.ReadPStr();
                    if (string.IsNullOrEmpty(GetNickname))
                    {
                        session.Response.Write(new byte[] { 0x01, 0x00 });
                        session.Response.WriteByte((byte)0xD8);//Call Create NickName
                        session.Response.WriteInt32(0);
                        session.SavePacket("PlayerCallCreateNickName");
                        session.SendResponse();
                        return(false);
                    }
                    else
                    {
                        session.UserInfo.GetNickname = GetNickname;
                        return(true);
                    }
                }
            }

            if (string.IsNullOrEmpty(session.UserInfo.GetNickname))
            {
                session.Response.Write(new byte[] { 0x01, 0x00 });
                session.Response.WriteByte((byte)0xD8);//Call Create NickName
                session.Response.WriteInt32(0);
                session.SavePacket("PlayerCallCreateNickName");
                session.SendResponse();
                return(false);
            }
            return(true);
        }
    //Destroy the spriterenderer on pickup
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            player       = other.gameObject;
            playerScript = player.GetComponent <LPlayer>();

            StartCoroutine(TimerDisapear());
            pickupEffect();
        }
    }
 static void Login(this LPlayer session)
 {
     session.Response.Write(new byte[] { 0x01, 0x00 });
     session.Response.WriteByte((byte)0);//code for login sucess
     session.Response.WritePStr(session.UserInfo.GetLogin);
     session.Response.WriteUInt32(session.UserInfo.GetUID);
     session.Response.WriteUInt32(session.UserInfo.GetCapability); //Capacity
     session.Response.WriteUInt32(session.UserInfo.GetLevel);      // Level
     session.Response.WriteUInt32(10);
     session.Response.WriteUInt16(12);
     session.Response.WritePStr(session.UserInfo.GetNickname);
     session.SavePacket("Login");
     session.SendResponse();
 }
Esempio n. 9
0
    public override void PlayerEffect(LPlayer player)
    {
        int adjusment;

        if (player.tilePlacedOnSelf)
        {
            adjusment = 0;
        }
        else
        {
            adjusment = 1;
        }

        player.Eject(propulsionAmount + adjusment + propulsionBoost, -player.direction);
    }
Esempio n. 10
0
        protected override Player OnConnectPlayer(TcpClient tcp, uint ConnectionID)
        {
            var player = new LPlayer(tcp)
            {
                Server = this, ConnectionID = ConnectionID
            };

            SendKey(player);

            var GetAdress = player.GetAdress;
            var GetPort   = player.GetPort;

            WriteConsole.WriteLine($"[NEW_PLAYER_CONNECT] => {GetAdress}:{GetPort}", ConsoleColor.Cyan);
            return(player);
        }
        //Disponivel = 0x00, //Nickname disponível
        //OcorreuUmErro = 0x01, //Ocorreu um erro ao verificar
        //Indisponivel = 0x03,
        //FormatoOuTamanhoInvalido = 0x04,
        //PointsInsuficientes = 0x05,
        //PalavasInapropriadas = 0x06,
        //DBError = 0x07,
        //MesmoNickNameSeraUsado = 0x09
        /// <summary>
        /// Reference: https://github.com/luismk/Py_Source_US/blob/master/Src/Py_Login/Py_Login/LPlayer.cs#L291
        /// </summary>
        /// <param name="session"></param>
        /// <param name="packet"></param>
        public static void ConfirmNickName(this LPlayer session, Packet packet)
        {
            Byte Code = 0;

            if (!packet.ReadPStr(out string Nickname))
            {
                return;
            }

            session.Response.Write(new byte[] { 0x0E, 0x00 });
            session.Response.WriteUInt32((uint)0);//Nickname disponivel
            session.Response.WritePStr(Nickname);
            session.SavePacket("PlayerConfirmNickName");
            session.SendResponse();
        }
        //Sucess = 0x00,
        //InvalidoIdPw = 0x01,
        //InvalidoId = 0x02,
        //UsuarioEmUso = 0x04,
        //Banido = 0x05,
        //InvalidoUsernameOuSenha = 0x06,
        //ContaSuspensa = 0x07,
        //Player13AnosOuMenos = 0x09,
        //SSNIncorreto = 0x0C,
        //UsuarioIncorreto = 0x0D,
        //OnlyUserAllowed = 0x0E,
        //ServerInMaintenance = 0x0F, //By LuisMk
        //NaoDisponivelNaSuaArea = 0x10, //By LuisMk
        //CreateNickName_US = 0xD8, //by LuisMK (usado no US)
        //CreateNickName = 0xD9, //by LuisMK (usado no TH)
        /// <summary>
        /// Reference: https://github.com/luismk/Py_Source_US/blob/master/Src/Py_Login/Py_Login/LPlayer.cs#L254
        /// </summary>
        /// <param name="session"></param>
        /// <param name="packet"></param>
        public static void SetNickName(this LPlayer session, Packet packet)
        {
            if (!packet.ReadPStr(out string Nickname))
            {
                return;
            }

            session.UserInfo.GetNickname = Nickname;

            var check = Nickname == session.UserInfo.GetNickname;

            session.Response.Write(new byte[] { 0x01, 0x00 });
            session.Response.WriteByte((byte)0xD9);//Caller ID for character creation
            session.Response.WriteInt32(0);
            session.SavePacket("PlayerCallCharacterCreate");
            session.SendResponse();
        }
Esempio n. 13
0
        /// <summary>
        /// Envia o macro(frases rapidas usadas no LobbyPlayer)
        /// </summary>
        /// <param name="session"></param>
        public static void GameMacro(this LPlayer session)
        {
            session.Response.Clear();//limpa a resposta anterior

            session.Response.Write(new byte[] { 0x06, 0x00 });
            session.Response.WriteStr("Pangya 1!", 64);
            session.Response.WriteStr("Pangya 2!", 64);
            session.Response.WriteStr("Pangya 3!", 64);
            session.Response.WriteStr("Pangya 4!", 64);
            session.Response.WriteStr("Pangya 5!", 64);
            session.Response.WriteStr("Pangya 6!", 64);
            session.Response.WriteStr("Pangya 7!", 64);
            session.Response.WriteStr("Pangya 8!", 64);
            session.Response.WriteStr("Pangya 9!", 64);
            session.SavePacket("PlayerMacro");
            session.SendResponse();
        }
Esempio n. 14
0
        protected override Player OnConnectPlayer(TcpClient tcp)
        {
            var player = new LPlayer(tcp)
            {
                Server       = this,
                ConnectionID = NextConnectionId
            };

            NextConnectionId += 1;

            SendKey(player);

            WriteConsole.WriteLine($"[PLAYER_CONNECT]: {player.GetAddress}:{player.GetPort} | KEY: {player.GetKey}", ConsoleColor.Green);

            Players.Add(player);
            UpdateServer();

            return(player);
        }
Esempio n. 15
0
 /// <summary>
 /// Lista dos Servidores Mensageiro Ativos !
 /// </summary>
 /// <param name="session">Jogador/Conexao</param>
 public static void MessangerServerList(this LPlayer session)
 {
     session.Response.Write(new byte[] { 0x09, 0x00 });
     session.Response.WriteByte((byte)1);//count servers
     //data
     session.Response.WriteStr("PangYa S6", 40);
     session.Response.WriteInt32(30303); //serverID
     session.Response.WriteInt32(2000);  //max user
     session.Response.WriteInt32(1);
     session.Response.WriteStr("127.0.0.1", 18);
     session.Response.WriteInt32(30303);      //port
     session.Response.WriteInt32(4096);
     session.Response.WriteUInt32(0);         // Angelic Number
     session.Response.WriteUInt16((ushort)0); //Flag event
     session.Response.WriteUInt16(0);
     session.Response.WriteInt32(0);
     session.Response.WriteUInt16(0);//Icon Server
     session.SendResponse();
 }
Esempio n. 16
0
 /// <summary>
 /// Lista dos Servidores Game Ativos !
 /// </summary>
 /// <param name="session">Jogador/Conexao</param>
 public static void GameServerList(this LPlayer session)
 {
     session.Response.Write(new byte[] { 0x02, 0x00 });
     session.Response.WriteByte((byte)1);//count servers
     //data for game server list
     session.Response.WriteStr("PangYa S6", 40);
     session.Response.WriteInt32(20201);         //serverID
     session.Response.WriteInt32(2000);          //max user
     session.Response.WriteInt32(1);             //players online
     session.Response.WriteStr("127.0.0.1", 18); //ip server
     session.Response.WriteInt32(20201);         //port
     session.Response.WriteInt32(2048);          //property
     session.Response.WriteUInt32(0);            // Angelic Number
     session.Response.WriteUInt16((ushort)0);    //Flag event
     session.Response.WriteUInt16(0);            //unknown
     session.Response.WriteInt32(100);           //pang rate?
     session.Response.WriteUInt16(0);            //Icon Server
     session.SavePacket("GameServerList");
     session.SendResponse();
 }
Esempio n. 17
0
    public override void PlayerEffect(LPlayer player)
    {
        Vector2 gridPosition = Grid.GetTilePosition(transform.position, Vector2.zero);
        Vector2 iPosition    = direction;
        Vector2 emptyPos     = Vector2.zero;
        int     nbrOfTiles   = 0;
        bool    hit          = true;

        int adjusment;

        if (player.tilePlacedOnSelf)
        {
            adjusment = 0;
        }
        else
        {
            adjusment = 1;
        }

        while (hit == true)
        {
            RaycastHit2D hitTile = Physics2D.Raycast(gridPosition + iPosition, direction, 0.45f, layerMask);
            nbrOfTiles++;
            Debug.Log("Nbr of pass (" + nbrOfTiles + ")");
            if (hitTile.collider != null)
            {
                iPosition += direction;
            }
            else
            {
                emptyPos = gridPosition + iPosition;
                hit      = false;
                break;
            }
        }

        player.Eject(nbrOfTiles + adjusment, direction, true);
    }
    public override void PlayerEffect(LPlayer player)
    {
        int adjusment;

        if (player.tilePlacedOnSelf)
        {
            adjusment = 0;
        }
        else
        {
            adjusment = 1;
        }

        RaycastHit2D hit = Physics2D.Raycast(transform.position, direction, 2, layerMask);

        if (hit)
        {
            Debug.Log("Correct");
            propulsionAmount = 1;
            adjusment--;
        }

        player.Eject(propulsionAmount + adjusment + propulsionBoost, direction);
    }
Esempio n. 19
0
 // Use this for initialization
 void Start()
 {
     player = GetComponent <LPlayer>();
 }
 public virtual void PlayerEffect(LPlayer player)
 {
 }