public static async void InitializeEmergency(string handle) { Player p = GetPlayerByHandle(handle); // checking for an existing emergency if (GetEmergencyCall(handle) != null) { SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You already have a 911 call!"); return; } if (GetCivilian(handle) != null) { Civilian civ = GetCivilian(handle); // finding the civ // checking how many active dispatchers there are if (Server.ConnectedDispatchers.Length == 0) { SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "It seems like there is no connected dispatchers at this moment!"); return; } EmergencyCall call; CurrentCalls.Add(call = new EmergencyCall(p.Identifiers["ip"], $"{civ.First} {civ.Last}")); // adding and creating the instance of the emergency SendMessage(p, "Dispatch911", new[] { 255, 0, 0 }, "Please wait for a dispatcher to respond"); // msging to wait for a dispatcher foreach (var peer in Server.ConnectedDispatchers) { await peer.RemoteCallbacks.Events["911alert"].Invoke(civ, call); // notifying the dispatchers of the 911 call } } else { SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You must set your name before start a 911 call"); } }
protected virtual void PortOnPortConnectionEstablished(object sender, ConnectionEstablishedEventArgs e) { var port1 = e.port1; var port2 = e.port2; if (port1 == null || port2 == null) { return; } ActivePorts.Remove(port1); EnabledPorts.Remove(port2); CallingPorts.Add(port1); CallingPorts.Add(port2); var call = new Call(port1.Number, port2.Number); call.Start(); CurrentCalls.Add(call); }
void CallManager_OnIncomingCall(ICall call) { CurrentCalls.Add(call); }