Exemplo n.º 1
0
 public void PlayerText(RealmTime time, PlayerTextPacket pkt)
 {
     if (pkt.Text[0] == '/')
     {
         string[] x = pkt.Text.Trim().Split(' ');
         if (x.Length > 1)
         {
             AnnounceText = pkt.Text.Substring(10);
         }
         ChatMessage = pkt.Text;
         string[] z = pkt.Text.Trim().Split('|');
         y = z.Skip(1).ToArray();
         ProcessCmd(x[0].Trim('/'), x.Skip(1).ToArray());
     }
     else
         Owner.BroadcastPacket(new TextPacket()
         {
             Name = Name,
             ObjectId = Id,
             Stars = Stars,
             BubbleTime = 5,
             Recipient = "",
             Text = pkt.Text,
             CleanText = pkt.Text
         }, null);
 }
Exemplo n.º 2
0
        public void PlayerText(RealmTime time, PlayerTextPacket pkt)
        {
            if (pkt.Text[0] == '/')
            {
                string[] x = pkt.Text.Trim().Split(' ');
                ProcessCmd(x[0].Trim('/'), x.Skip(1).ToArray());
                //CommandManager.Execute(this, time, pkt.Text); // Beta Processor
            }
            else
            {
                string txt = Encoding.ASCII.GetString(
                    Encoding.Convert(
                        Encoding.UTF8,
                        Encoding.GetEncoding(
                            Encoding.ASCII.EncodingName,
                            new EncoderReplacementFallback(string.Empty),
                            new DecoderExceptionFallback()
                            ),
                        Encoding.UTF8.GetBytes(pkt.Text)
                    )
                );
                if (txt != "")
                {
                    //Removing unwanted crashing characters from strings
                    string chatColor = "";
                    if (Client.Account.Rank > 3)
                        chatColor = "@";
                    else if (Client.Account.Rank == 3)
                        chatColor = "#";

                    foreach (var i in RealmManager.Worlds)
                    {
                        if (i.Key != 0)
                        {
                            i.Value.BroadcastPacket(new TextPacket()
                            {
                                Name = chatColor + Name,
                                ObjectId = Id,
                                Stars = Stars,
                                BubbleTime = 5,
                                Recipient = "",
                                Text = txt,
                                CleanText = txt
                            }, null);
                        }
                    }
                    foreach (var e in Owner.Enemies)
                    {
                        foreach (var b in e.Value.CondBehaviors)
                        {
                            if (b.Condition == BehaviorCondition.OnChat)
                            {
                                b.Behave(BehaviorCondition.OnChat, e.Value, time, null, pkt.Text);
                                b.Behave(BehaviorCondition.OnChat, e.Value, time, null, pkt.Text, this);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 public void PlayerText(RealmTime time, PlayerTextPacket pkt)
 {
     if (pkt.Text[0] == '/')
     {
         string[] x = pkt.Text.Trim().Split(' ');
         try
         {
             AnnounceText = pkt.Text.Substring(10);
             NewsText = pkt.Text.Substring(6).Split(';');
         }
         catch
         {
             Console.WriteLine("Error at line 24 of Player.Chat.cs");
         }
         ChatMessage = pkt.Text;
         string[] z = pkt.Text.Trim().Split('|');
         y = z.Skip(1).ToArray();
         ProcessCmd(x[0].Trim('/'), x.Skip(1).ToArray());
     }
     else
     {
         if (psr.Account.Admin == true)
             foreach (var i in RealmManager.Clients.Values)
                 i.SendPacket(new TextPacket()
                 {
                     Name = psr.Account.Name,
                     Stars = psr.Player.Stars,
                     BubbleTime = 5,
                     Text = pkt.Text,
                     Recipient = i.Account.Name
                 });
         else
         {
             Owner.BroadcastPacket(new TextPacket()
             {
                 Name = Name,
                 ObjectId = Id,
                 Stars = Stars,
                 BubbleTime = 5,
                 Recipient = "",
                 Text = pkt.Text,
                 CleanText = pkt.Text
             }, null);
         }
     }
 }
Exemplo n.º 4
0
 public void PlayerText(RealmTime time, PlayerTextPacket pkt)
 {
     if (pkt.Text[0] == '/')
     {
         string[] x = pkt.Text.Trim().Split(' ');
         ProcessCmd(x[0].Trim('/'), x.Skip(1).ToArray());
     }
     else
         Owner.BroadcastPacket(new TextPacket()
         {
             Name = Name,
             ObjectId = Id,
             Stars = Stars,
             BubbleTime = 5,
             Recipient = "",
             Text = pkt.Text,
             CleanText = pkt.Text
         }, null);
 }
Exemplo n.º 5
0
 public void PlayerText(RealmTime time, PlayerTextPacket pkt)
 {
     if (pkt.Text[0] == '/')
     {
         string[] x = pkt.Text.Trim().Split(' ');
         try
         {
             AnnounceText = pkt.Text.Substring(10);
             NewsText = pkt.Text.Substring(6).Split(';');
         }
         catch
         {
             Console.WriteLine("Error at line 24 of Player.Chat.cs");
         }
         ChatMessage = pkt.Text;
         string[] z = pkt.Text.Trim().Split('|');
         y = z.Skip(1).ToArray();
         ProcessCmd(x[0].Trim('/'), x.Skip(1).ToArray());
     }
     else
     {
         if (psr.Account.Admin == true)
         {
             Owner.BroadcastPacket(new TextPacket()
                 {
                     Name = "@" + psr.Account.Name,
                     Stars = psr.Player.Stars,
                     BubbleTime = 5,
                     Text = pkt.Text
                 }, null);
         }
         else
         {
             int role;
             using (Database db1 = new Database())
             {
                 role = db1.getRole(psr.Account);
             }
             if (role >= (int)Database.Roles.Donator)
             {
                 Owner.BroadcastPacket(new TextPacket()
                 {
                     Name = "#" + psr.Account.Name,
                     Stars = psr.Player.Stars,
                     BubbleTime = 5,
                     Text = pkt.Text
                 }, null);
             }
             else
             {
                 Owner.BroadcastPacket(new TextPacket()
                 {
                     Name = Name,
                     ObjectId = Id,
                     Stars = Stars,
                     BubbleTime = 5,
                     Recipient = "",
                     Text = pkt.Text,
                     CleanText = pkt.Text
                 }, null);
             }
         }
     }
 }