Esempio n. 1
0
        private int GetRank()
        {
            WriteDiagnostics();
            int rank = -1;

            if (KeywordList.Contains("1") && KeywordList.Contains("best"))
            {
                rank = 0;
            }
            else if (KeywordList.Contains("1"))
            {
                rank = 1;
            }
            else if (KeywordList.Contains("2"))
            {
                rank = 2;
            }
            else if (KeywordList.Contains("3"))
            {
                rank = 3;
            }
            else
            {
                rank = 2;
            }

            return(rank);
        }
Esempio n. 2
0
 public void RemoveKeywords(ArrayList keywords)
 {
     foreach (string keyword in keywords)
     {
         if (KeywordList.Contains(keyword))
         {
             KeywordList.Remove(keyword);
         }
     }
 }
Esempio n. 3
0
 public void AddKeywords(ArrayList keywords)
 {
     foreach (string keyword in keywords)
     {
         if (!KeywordList.Contains(keyword))
         {
             KeywordList.Add(keyword);
         }
     }
     KeywordList.Sort();
 }
Esempio n. 4
0
        public static void UnicodeSpeechChat3(NetState state, PacketReader pvSrc)
        {
            Mobile from = state.Mobile;

            MessageType type = (MessageType)pvSrc.ReadByte();
            int         hue  = pvSrc.ReadInt16();

            pvSrc.ReadInt16(); // font
            string lang = pvSrc.ReadString(4);
            string text;

            bool isEncoded = (type & MessageType.Encoded) != 0;

            int[] keywords;

            if (isEncoded)
            {
                int value = pvSrc.ReadInt16();
                int count = (value & 0xFFF0) >> 4;
                int hold  = value & 0xF;

                if (count < 0 || count > 50)
                {
                    return;
                }

                KeywordList keyList = c_KeywordList;

                for (int i = 0; i < count; ++i)
                {
                    int speechID;

                    if ((i & 1) == 0)
                    {
                        hold   <<= 8;
                        hold    |= pvSrc.ReadByte();
                        speechID = hold;
                        hold     = 0;
                    }
                    else
                    {
                        value    = pvSrc.ReadInt16();
                        speechID = (value & 0xFFF0) >> 4;
                        hold     = value & 0xF;
                    }

                    if (!keyList.Contains(speechID))
                    {
                        keyList.Add(speechID);
                    }
                }

                text = pvSrc.ReadUTF8StringSafe();

                keywords = keyList.ToArray();
            }
            else
            {
                text = pvSrc.ReadUnicodeStringSafe();

                keywords = c_EmptyInts;
            }

            text = text.Trim();

            if (text.Length <= 0 || text.Length > 128)
            {
                return;
            }

            type &= ~MessageType.Encoded;

            if (!Enum.IsDefined(typeof(MessageType), type))
            {
                type = MessageType.Regular;
            }

            from.Language = lang;

            Channel c = Channel.GetByType(typeof(Guild));

            if (RUOVersion.GuildChat(type) && c != null)
            {
                if (c.CanChat(from, true))
                {
                    c.OnChat(from, text);
                }
            }
            else
            {
                from.DoSpeech(text, keywords, type, Utility.ClipDyedHue(hue));
            }
        }