Exemplo n.º 1
0
 static void Authenticate(Agent sender, string[] msg)
 {
     if (sender.Authenticated == false)
     {
         if (Database.Authenticate(msg[1], msg[2]))
         {
             Character c = Database.GetChar(msg[1]);
             Agent     a = VisitorBase.GetVisitors().Find(new Predicate <Agent>(x => x.Name == c.Name));
             if (a != null)
             {
                 Logger.LogIt(typeof(Lobby), "User " + sender.Name + " already on server");
                 sender.Send("000_1");
                 return;
             }
             sender.Authenticated = true;
             sender.Name          = c.Name;
             Logger.LogIt(typeof(Lobby), "User " + c.Name + " Authenticated");
             sender.Send("000_0_" + c.Name);
             return;
         }
         else
         {
             Logger.LogIt(typeof(Lobby), "User " + sender.Name + " Auth failed");
             sender.Send("000_1");
         }
     }
 }
Exemplo n.º 2
0
 public static void Comm(Agent sender, string[] msg)
 {
     foreach (var a in VisitorBase.GetVisitors())
     {
         a.Send("030_" + sender.Name + ": " + msg[1]);
     }
 }
Exemplo n.º 3
0
 static void DrawInfo()
 {
     Console.WriteLine("Visitors: " + VisitorBase.GetVisitors().Count);
     foreach (var v in VisitorBase.GetVisitors())
     {
         Console.WriteLine("Visitor: " + v.Name);
     }
 }
Exemplo n.º 4
0
 public static void SendInfo_SPs(Agent sender = null)
 {
     foreach (var sp in SpacePorts.Keys)
     {
         string tosend = CommandBuilder.Build(new string[] { "006", sp.ID.ToString(), sp.rocket.ID.ToString(), sp.rocket.PSGR == null ? "0" : "1" });
         if (sender != null)
         {
             sender.Send(tosend);
         }
         else
         {
             var authVisitors = VisitorBase.GetVisitors().FindAll(new Predicate <Agent>(x => x.Authenticated));
             authVisitors.ForEach(x => x.Send(tosend));
         }
     }
 }