internal static IntPtr ClientConnection() { if (ClientConnectionFunction == null) { ClientConnectionFunction = Memory.Reader.RegisterDelegate <ClientConnectionDelegate>((IntPtr)0x005AB490); } return(ClientConnectionFunction()); }
void OnConnectedToServer() { Debug.Log("Connected to server"); ChangeClientState(ClientState.E_ClientConnected); if (m_ClientConnectedDelegate != null) { m_ClientConnectedDelegate(); m_ClientConnectedDelegate = null; } }
internal static IntPtr ClientConnection() { if (!ObjectManager.Instance.IsIngame) { return(IntPtr.Zero); } if (ClientConnectionFunction == null) { ClientConnectionFunction = Memory.Reader.RegisterDelegate <ClientConnectionDelegate>(funcs.ClientConnection); } return(MainThread.Instance.Invoke(() => ClientConnectionFunction())); }
public void ConnectToServer(string _ServerIpAddress, int _ConnectPort, ClientConnectionDelegate _ClientConnectedDelegate, ClientConnectionDelegate _ClientDisconnectedDelegate) { Debug.Log("Connecting to server " + _ServerIpAddress + ":" + _ConnectPort); System.Diagnostics.Debug.Assert(Network.peerType == NetworkPeerType.Disconnected); System.Diagnostics.Debug.Assert(CanConnectToServer()); m_ClientConnectedDelegate = _ClientConnectedDelegate; m_ClientDisconnectedDelegate = _ClientDisconnectedDelegate; ChangeClientState(ClientState.E_ClientPendingConnect); NetworkConnectionError connectionResult = Network.Connect(_ServerIpAddress, _ConnectPort); if (connectionResult != NetworkConnectionError.NoError) { Debug.Log("Connection failed:" + connectionResult); } }
public static Connection Connect(String host, int port, String mechanism, X509Certificate certificate, bool rejectUntrusted, Client client) { ClientConnectionDelegate connectionDelegate = new ClientConnectionDelegate(client, string.Empty, string.Empty, mechanism); ManualResetEvent negotiationComplete = new ManualResetEvent(true); connectionDelegate.SetCondition(negotiationComplete); connectionDelegate.VirtualHost = string.Empty; IIoTransport transport = new IoSSLTransport(host, port, certificate, rejectUntrusted, connectionDelegate); Connection _conn = transport.Connection; _conn.Send(new ProtocolHeader(1, 0, 10)); negotiationComplete.WaitOne(); if (connectionDelegate.Exception != null) { throw connectionDelegate.Exception; } connectionDelegate.SetCondition(null); return(_conn); }
public static void Initialize() { #region WowObject Functions _getObjectFunctionLocation = GeneralHelper.Memory.CreateFunction <GetObjectLocationDelegate>( Offsets.UncataloguedFunctions.CGObject__GetObjectLocation); #endregion #region ObjectManager Functions _enumVisibleObjects = GeneralHelper.Memory.CreateFunction <EnumVisibleObjectsDelegate>( Offsets.ObjectManagerOffsets.EnumVisibleObjects); _getActivePlayer = GeneralHelper.Memory.CreateFunction <GetActivePlayerObejctDeledate>( Offsets.ObjectManagerOffsets.GetActivePlayerObject); #endregion #region UncataloguedFunctions _setTarget = GeneralHelper.Memory.CreateFunction <SetUITargetDelegate>( Offsets.UncataloguedFunctions.CGGameUI__Target); _GetObjectIsOutdoors = GeneralHelper.Memory.CreateFunction <GetObjectIsOutdoorsDelegate>( Offsets.UncataloguedFunctions.CGObject__IsOutdoors); _TrackingStop = GeneralHelper.Memory.CreateFunction <TrackingStopDelegate>( Offsets.UncataloguedFunctions.CGUnit_C__TrackingStopInternal); _TrackingStart = GeneralHelper.Memory.CreateFunction <TrackingStartDelegate>( Offsets.UncataloguedFunctions.CGUnit_C__InitializeTrackingStateWrapper); _getSpellCooldown = GeneralHelper.Memory.CreateFunction <GetSpellCooldownDelegate>( Offsets.UncataloguedFunctions.CGUnit_C__InitializeTrackingStateWrapper); _unitReaction = GeneralHelper.Memory.CreateFunction <UnitReactionDelegate>( Offsets.UncataloguedFunctions.CGUnit_C__UnitReaction); _unitThreatInfo = GeneralHelper.Memory.CreateFunction <UnitThreatInfoDelegate>( Offsets.UncataloguedFunctions.CGUnit_C__CalculateThreat); _SetActiveMover = GeneralHelper.Memory.CreateFunction <SetActiveMover>( Offsets.UncataloguedFunctions.CGUnit_C__SetActiveMover); Packet_SendJam = GeneralHelper.Memory.CreateFunction <Packet_SendJamDelegate>(Offsets.Packet.SendJam); _ClientConnection = GeneralHelper.Memory.CreateFunction <ClientConnectionDelegate>(Offsets.Packet.ClientConection); #endregion #region Lua Functions _doString = GeneralHelper.Memory.CreateFunction <DoStringDelegate>( Offsets.LuaFunctions.ExecuteBuffer); _GetLocalizedText = GeneralHelper.Memory.CreateFunction <GetLocalizedTextDelegate>( Offsets.LuaFunctions.GetLocalizedText); #endregion }
void OnDisconnectedFromServer(NetworkDisconnection info) { Debug.Log("Server connection disconnected: " + info.ToString()); Debug.Log("Current network peer type is " + Network.peerType.ToString()); ChangeClientState(ClientState.E_ClientDisconnected); if (m_ClientDisconnectedDelegate != null) { m_ClientDisconnectedDelegate(); m_ClientDisconnectedDelegate = null; } }
void OnFailedToConnect(NetworkConnectionError error) { Debug.Log("Failed to connect to server: " + error); ChangeClientState(ClientState.E_ClientDisconnected); //@FIXME: what to do exactly about connected and disconnected delegates? m_ClientConnectedDelegate = null; if (m_ClientDisconnectedDelegate != null) { m_ClientDisconnectedDelegate(); m_ClientDisconnectedDelegate = null; } }