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)); }
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); } }
/// <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); } }
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)); }
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)); }
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); }
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)); }
public void CharLogout() { Connection.Send(W2Marshal.GetBytes(new MPacketSignal(0x215, 0))); }
public void DeleteCharacter(string name, int slotId, string password) { Connection.Send(W2Marshal.GetBytes(new MDeleteCharacterPacket(slotId, name, password))); }
public void CreateCharacter(string name, int slotId, int classId) { Connection.Send(W2Marshal.GetBytes(new MCreateCharacterPacket(name, slotId, classId))); }
public void EnterMob(int charIndex) { Connection.Send(W2Marshal.GetBytes(new MRequestMobLogin(charIndex))); }
public void SendPacket <T>(ClientPacket <T> packet) { Connection.Send(W2Marshal.GetBytes(packet)); }
public void UseTeleport(ushort clientId) { Connection.Send(W2Marshal.GetBytes(new MPacketSignal(0x290, clientId))); }
public void Reborn(ushort clientId) { Connection.Send(W2Marshal.GetBytes(new MPacketSignal(0x291, clientId))); }
public void SendMessage(ushort clientId, string message) { Connection.Send(W2Marshal.GetBytes(new MChatMessagePacket(clientId, message))); }