/// <summary> /// Join a game /// </summary> /// <param name="name">Name of the game being joined</param> /// <param name="password">Password used to protect the game</param> public bool JoinGame(string name, string password) { Log.Information($"Joining game: {name} with {LoggedInUserName()}"); var packet = Mcp.JoinGame(name, password); if (packet == null) { return(false); } if (packet.Result != 0x00) { return(false); } Mcp.Disconnect(); Log.Debug($"Connecting to D2GS Server {packet.D2gsIp}"); try { D2gs.Connect(packet.D2gsIp); } catch { D2gs.Disconnect(); return(false); } if (!D2gs.GameLogon(packet.GameHash, packet.GameToken, _character)) { D2gs.Disconnect(); return(false); } Bncs.NotifyJoin(name, password); return(true); }
/// <summary> /// Leave current game /// </summary> public void LeaveGame() { Log.Information("Leaving game"); D2gs.LeaveGame(); Bncs.LeaveGame(); RealmLogon(); Mcp.CharLogon(_character); }
/// <summary> /// Join a game /// </summary> /// <param name="name">Name of the game being joined</param> /// <param name="password">Password used to protect the game</param> public void JoinGame(string name, string password) { Log.Information($"Joining game: {name}"); var packet = Mcp.JoinGame(name, password); Mcp.Disconnect(); Log.Debug($"Connecting to D2GS Server {packet.D2gsIp}"); D2gs.Connect(packet.D2gsIp); D2gs.GameLogon(packet.GameHash, packet.GameToken, _character); Bncs.NotifyJoin(name, password); }
public void Disconnect() { if (Bncs.IsConnected()) { Bncs.Disconnect(); } if (Mcp.IsConnected()) { Mcp.Disconnect(); } if (D2gs.IsConnected()) { D2gs.Disconnect(); } }
public void OnSentPacketEvent(byte type, Action <D2gsPacket> action) => D2gs.OnSentPacketEvent(type, action);
public void OnReceivedPacketEvent(byte type, Action <D2gsPacket> action) => D2gs.OnReceivedPacketEvent(type, action);
public void OnSentPacketEvent(OutGoingPacket type, Action <D2gsPacket> action) => D2gs.OnSentPacketEvent(type, action);
public void OnReceivedPacketEvent(InComingPacket type, Action <D2gsPacket> action) => D2gs.OnReceivedPacketEvent(type, action);