示例#1
0
        public void SendCommand(ushort clientId, string command, string message)
        {
            var packet = new MWhisperMessagePacket(clientId);

            packet.Command = command;
            packet.Message = message;

            Connection.Send(W2Marshal.GetBytes(packet));
        }
示例#2
0
        public void SendToken(string password, int isChanging)
        {
            if (string.IsNullOrWhiteSpace(password))
            {
                throw new ArgumentNullException("Password cannot be null");
            }

            Connection.Send(W2Marshal.GetBytes(new MTokenPacket(password, isChanging)));
        }
        /// <summary>
        /// Send a given game packet to the player.
        /// </summary>
        public void SendPacket <T>(T packet) where T : struct, IGamePacket
        {
            if (m_Stream.CanWrite)
            {
                byte[] rawPacket = W2Marshal.GetBytes(packet);

                PacketSecurity.Encrypt(rawPacket, 0);

                m_Stream.Write(rawPacket, 0, rawPacket.Length);

                W2Log.Write(String.Format("Packet 0x{0:X} were sent to the player (Index: {1}).", packet.Header.Opcode, Index), ELogType.NETWORK);
            }
        }
示例#4
0
        /// <summary>
        /// Send a given game packet to the GameServer.
        /// </summary>
        public void SendPacket <T>(T packet) where T : struct, DBSRVPackets
        {
            if (m_Stream.CanWrite)
            {
                byte[] rawPacket = W2Marshal.GetBytes(packet);

                PacketSecurity.Encrypt(rawPacket, 0);

                m_Stream.Write(rawPacket, 0, rawPacket.Length);

                W2Log.Write(String.Format("O pacote 0x{0:X} foi enviado para o GameServer(Index:{1}).", packet.Header.PacketID, Index), ELogType.NETWORK);
            }
        }
示例#5
0
        public void Login(string userName, string password, int version)
        {
            if (string.IsNullOrWhiteSpace(userName))
            {
                throw new ArgumentNullException("Username cannot be null");
            }

            if (string.IsNullOrWhiteSpace(password))
            {
                throw new ArgumentNullException("Password cannot be null");
            }

            var packet = new MAccountLoginPacket(userName, password, version);

            Connection.Send(W2Marshal.GetBytes(packet));
        }
示例#6
0
        public void SingleAttack(ushort clientId, MPosition attackerPosition, MPosition targetPosition, MTarget target, short skilId)
        {
            var packet = new MSingleAttackPacket(clientId)
            {
                AttackCount      = AttackCount,
                AttackerPosition = attackerPosition,
                AttackerId       = clientId,

                Target         = target,
                TargetPosition = targetPosition,

                CurrentMp = -1,
                SkillId   = skilId,
                FlagLocal = 1,
                Motion    = 4,
            };

            Connection.Send(W2Marshal.GetBytes(packet));
        }
示例#7
0
        public static EResult TrySaveAccount(ref MAccountFile acc)
        {
            var err = EResult.NO_ERROR;

            try
            {
                byte[] accBytes = W2Marshal.GetBytes(acc);

                File.WriteAllBytes(String.Format("{0}/{1}/{2}.bin",
                                                 PersistencyBasics.DB_ROOT_PATH, acc.Info.LoginInfo.AccName.Substring(0, 1).ToUpper(),
                                                 acc.Info.LoginInfo.AccName), accBytes);
            }
            catch (DirectoryNotFoundException)
            {
                err = EResult.ACC_NOT_SAVED;
            }
            catch (Exception)
            {
                err = EResult.UNKNOWN;
            }

            return(err);
        }
示例#8
0
        public void Movement(ushort clientId, MPosition Current, MPosition Destiny, uint moveType, uint Speed)
        {
            var movement = new MMovePacket(clientId, Current, Destiny, moveType, Speed);

            Connection.Send(W2Marshal.GetBytes(movement));
        }
示例#9
0
 public void CharLogout()
 {
     Connection.Send(W2Marshal.GetBytes(new MPacketSignal(0x215, 0)));
 }
示例#10
0
 public void DeleteCharacter(string name, int slotId, string password)
 {
     Connection.Send(W2Marshal.GetBytes(new MDeleteCharacterPacket(slotId, name, password)));
 }
示例#11
0
 public void CreateCharacter(string name, int slotId, int classId)
 {
     Connection.Send(W2Marshal.GetBytes(new MCreateCharacterPacket(name, slotId, classId)));
 }
示例#12
0
 public void EnterMob(int charIndex)
 {
     Connection.Send(W2Marshal.GetBytes(new MRequestMobLogin(charIndex)));
 }
示例#13
0
 public void SendPacket <T>(ClientPacket <T> packet)
 {
     Connection.Send(W2Marshal.GetBytes(packet));
 }
示例#14
0
 public void UseTeleport(ushort clientId)
 {
     Connection.Send(W2Marshal.GetBytes(new MPacketSignal(0x290, clientId)));
 }
示例#15
0
 public void Reborn(ushort clientId)
 {
     Connection.Send(W2Marshal.GetBytes(new MPacketSignal(0x291, clientId)));
 }
示例#16
0
 public void SendMessage(ushort clientId, string message)
 {
     Connection.Send(W2Marshal.GetBytes(new MChatMessagePacket(clientId, message)));
 }