Exemplo n.º 1
0
        public Boolean LoadChars()
        {
            if (db.IsConnected)
            {
                DatabaseDataContext data = new UOData.DatabaseDataContext();
                string query             = "SELECT player.id, mobile.name, mobile.model, mobile.direction, mobile.notoriety, mobile.x, mobile.y, mobile.z FROM mobile INNER JOIN player ON (mobile.id = player.mobile_id) WHERE mobile.account_id = " + AccountID + ";";
                var    players           = from pl in data.players where pl.account_id == AccountID select pl;

                foreach (var pl in players)
                {
                    var chars = from ch in data.mobiles where ch.id == pl.mobile_id select ch;
                    foreach (var ch in chars)
                    {
                        CharList.Add(new Character()
                        {
                            Uid       = ch.id,
                            Name      = ch.name,
                            CharModel = (short)ch.model,
                            Direction = (byte)ch.direction,
                            Notoriety = (short)ch.notoriety,
                            X         = (short)ch.x,
                            Y         = (short)ch.y,
                            Z         = (byte)ch.z,
                            Password  = m_Password
                        });
                    }
                }

                MySqlDataReader result = db.ExecuteQuery(query);

                if (result.HasRows)
                {
                    while (result.Read())
                    {
                        Character temp = new Character();
                        temp.Uid       = Int32.Parse(result.GetValue(0).ToString());
                        temp.Name      = result.GetValue(1).ToString();
                        temp.CharModel = Int16.Parse(result.GetValue(2).ToString());
                        temp.Direction = Byte.Parse(result.GetValue(3).ToString());
                        temp.Notoriety = short.Parse(result.GetValue(4).ToString());
                        temp.X         = Int16.Parse(result.GetValue(5).ToString());
                        temp.Y         = Int16.Parse(result.GetValue(6).ToString());
                        temp.Z         = Byte.Parse(result.GetValue(7).ToString());
                        temp.Password  = m_Password;
                        CharList.Add(temp);
                    }
                    return(true);
                }
            }
            return(false);

            CharList = new List <Character>();
            Character temp1 = new Character();

            temp1.Name     = "metal";
            temp1.Password = "******";
            CharList.Add(temp1);
            return(true);
        }
Exemplo n.º 2
0
        protected override bool ReadBody(ISourceStream source, CompoundTokenDetails details)
        {
            int      start        = source.PreviewPosition;
            bool     allowEscapes = details.IsSet((short)IdOptions.AllowsEscapes);
            CharList outputChars  = new CharList();

            while (!source.EOF())
            {
                char current = source.PreviewChar;
                if (Grammar.IsWhitespaceOrDelimiter(current))
                {
                    break;
                }
                if (allowEscapes && current == this.EscapeChar)
                {
                    current = ReadUnicodeEscape(source, details);
                    //We  need to back off the position. ReadUnicodeEscape sets the position to symbol right after escape digits.
                    //This is the char that we should process in next iteration, so we must backup one char, to pretend the escaped
                    // char is at position of last digit of escape sequence.
                    source.PreviewPosition--;
                    if (details.Error != null)
                    {
                        return(false);
                    }
                }
                //Check if current character is OK
                if (!CharOk(current, source.PreviewPosition == start))
                {
                    break;
                }
                //Check if we need to skip this char
#if NETSTANDARD
                UnicodeCategory currCat = CharUnicodeInfo.GetUnicodeCategory(current);
#else
                UnicodeCategory currCat = char.GetUnicodeCategory(current); //I know, it suxx, we do it twice, fix it later
#endif
                if (!this.CharsToRemoveCategories.Contains(currCat))
                {
                    outputChars.Add(current); //add it to output (identifier)
                }
                source.PreviewPosition++;
            }//while
            if (outputChars.Count == 0)
            {
                return(false);
            }
            //Convert collected chars to string
            details.Body = new string(outputChars.ToArray());
            if (!CheckCaseRestriction(details.Body))
            {
                return(false);
            }
            return(!string.IsNullOrEmpty(details.Body));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a new character to TCTData.Data.CharList and invokes CharacterAddedEvent
        /// </summary>
        /// <param name="character">Character to be added (if not existing)</param>
        public static void AddCharacter(Character character)
        {
            bool found = false;

            foreach (var cl in CharList)
            {
                if (cl.Name == character.Name)
                {
                    found         = true;
                    cl.Laurel     = character.Laurel;
                    cl.Level      = character.Level;
                    cl.CharClass  = character.CharClass;
                    cl.GuildId    = character.GuildId;
                    cl.LocationId = character.LocationId;
                    cl.LastOnline = character.LastOnline;
                    cl.AccountId  = character.AccountId;
                    cl.Position   = character.Position;

                    break;
                }
            }

            if (!found)
            {
                // add char to chList
                CharList.Add(character);

                // check for TC
                int tc = 1;
                if (AccountList.Find(a => a.Id == character.AccountId).TeraClub)
                {
                    tc = 2;
                }

                // initialize dungeons
                for (int j = 0; j < DungList.Count; j++)
                {
                    if (DungList[j].ShortName == "AH" || DungList[j].ShortName == "EA" || DungList[j].ShortName == "GL" || DungList[j].ShortName == "CA")
                    {
                        CharList.Last().Dungeons.Add(new CharDungeon(DungList[j].ShortName, DungList[j].MaxBaseRuns, 0));
                    }
                    else
                    {
                        CharList.Last().Dungeons.Add(new CharDungeon(DungList[j].ShortName, DungList[j].MaxBaseRuns * tc, 0));
                    }
                }

                // create and add strip to list

                CharacterAddedEvent.Invoke(CharList.Count - 1);

                //UI.MainWin.CreateStrip(CharList.Count - 1);
            }
        }
Exemplo n.º 4
0
        protected override bool ReadBody(ISourceStream source, ScanDetails details)
        {
            int      start        = source.Position;
            bool     allowEscapes = !details.IsSet(ScanFlags.DisableEscapes);
            CharList outputChars  = new CharList();

            while (!source.EOF())
            {
                char current = source.CurrentChar;
                if (_terminators.IndexOf(current) >= 0)
                {
                    break;
                }
                if (allowEscapes && current == this.EscapeChar)
                {
                    current = ReadUnicodeEscape(source, details);
                    //We  need to back off the position. ReadUnicodeEscape sets the position to symbol right after escape digits.
                    //This is the char that we should process in next iteration, so we must backup one char, to pretend the escaped
                    // char is at position of last digit of escape sequence.
                    source.Position--;
                    if (details.HasError())
                    {
                        return(false);
                    }
                }
                //Check if current character is OK
                if (!CharOk(current, source.Position == start))
                {
                    break;
                }
                //Check if we need to skip this char
                UnicodeCategory currCat = char.GetUnicodeCategory(current); //I know, it suxx, we do it twice, fix it later
                if (!this.CharsToRemoveCategories.Contains(currCat))
                {
                    outputChars.Add(current); //add it to output (identifier)
                }
                source.Position++;
            }//while
            if (outputChars.Count == 0)
            {
                return(false);
            }
            //Convert collected chars to string
            details.Body = new string(outputChars.ToArray());
            return(!string.IsNullOrEmpty(details.Body));
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            CharList <char> charList = new CharList <char>();

            charList.Add('m');
            charList.Add('g');
            charList.Add('s');
            charList.Add('@');
            charList.Add('$');
            charList.Add('3');
            charList.DeleteMoreThanA();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            IntList  list  = new IntList();
            CharList clist = new CharList();

            clist.Add('B');
            int i = 100;

            list.Add(i);
            string value     = list[0].ToString();  //使用泛型,编译出错,提示类型转换不对
            string charValue = clist[0].ToString(); //使用泛型,编译出错,提示类型转换不对

            Console.WriteLine("value {0} + charValue {1}", value, charValue);



            Console.ReadKey();
        }
Exemplo n.º 7
0
 //文字を追加
 protected virtual void AddCharData(CharData data)
 {
     CharList.Add(data);
     PoolList.Add(data);
     parsingInfo.ClearOnNextChar();
 }
Exemplo n.º 8
0
        //Constructor
        public HiraAlphabet()
        {
            CharList.Add(new JapChar("a", "あ", "a", "vowel"));
            CharList.Add(new JapChar("i", "い", "i", "vowel"));
            CharList.Add(new JapChar("u", "う", "u", "vowel"));
            CharList.Add(new JapChar("e", "え", "e", "vowel"));
            CharList.Add(new JapChar("o", "お", "o", "vowel"));

            CharList.Add(new JapChar("ka", "か", "a", "k"));
            CharList.Add(new JapChar("ki", "き", "i", "k"));
            CharList.Add(new JapChar("ku", "く", "u", "k"));
            CharList.Add(new JapChar("ke", "け", "e", "k"));
            CharList.Add(new JapChar("ko", "こ", "o", "k"));

            CharList.Add(new JapChar("ga", "が", "a", "g"));
            CharList.Add(new JapChar("gi", "ぎ", "i", "g"));
            CharList.Add(new JapChar("gu", "ぐ", "u", "g"));
            CharList.Add(new JapChar("ge", "げ", "e", "g"));
            CharList.Add(new JapChar("go", "ご", "o", "g"));

            CharList.Add(new JapChar("ta", "た", "a", "t"));
            CharList.Add(new JapChar("chi", "ち", "i", "t"));
            CharList.Add(new JapChar("tsu", "つ", "u", "t"));
            CharList.Add(new JapChar("te", "て", "e", "t"));
            CharList.Add(new JapChar("to", "と", "o", "t"));

            CharList.Add(new JapChar("da", "だ", "a", "d"));
            CharList.Add(new JapChar("ji", "ぢ", "i", "d"));
            CharList.Add(new JapChar("zu", "づ", "u", "d"));
            CharList.Add(new JapChar("de", "で", "e", "d"));
            CharList.Add(new JapChar("do", "ど", "o", "d"));

            CharList.Add(new JapChar("sa", "さ", "a", "s"));
            CharList.Add(new JapChar("shi", "し", "i", "s"));
            CharList.Add(new JapChar("su", "す", "u", "s"));
            CharList.Add(new JapChar("se", "せ", "e", "s"));
            CharList.Add(new JapChar("so", "そ", "o", "s"));

            CharList.Add(new JapChar("za", "ざ", "a", "z"));
            CharList.Add(new JapChar("ji", "じ", "i", "z"));
            CharList.Add(new JapChar("zu", "ず", "u", "z"));
            CharList.Add(new JapChar("ze", "ぜ", "e", "z"));
            CharList.Add(new JapChar("zo", "ぞ", "o", "z"));

            CharList.Add(new JapChar("na", "な", "a", "n"));
            CharList.Add(new JapChar("ni", "に", "i", "n"));
            CharList.Add(new JapChar("nu", "ぬ", "u", "n"));
            CharList.Add(new JapChar("ne", "ね", "e", "n"));
            CharList.Add(new JapChar("no", "の", "o", "n"));

            CharList.Add(new JapChar("ha", "は", "a", "h"));
            CharList.Add(new JapChar("hi", "ひ", "i", "h"));
            CharList.Add(new JapChar("fu", "ふ", "u", "h"));
            CharList.Add(new JapChar("he", "へ", "e", "h"));
            CharList.Add(new JapChar("ho", "ほ", "o", "h"));

            CharList.Add(new JapChar("ba", "ば", "a", "b"));
            CharList.Add(new JapChar("bi", "び", "i", "b"));
            CharList.Add(new JapChar("bu", "ぶ", "u", "b"));
            CharList.Add(new JapChar("be", "べ", "e", "b"));
            CharList.Add(new JapChar("bo", "ぼ", "o", "b"));

            CharList.Add(new JapChar("pa", "ぱ", "a", "p"));
            CharList.Add(new JapChar("pi", "ぴ", "i", "p"));
            CharList.Add(new JapChar("pu", "ぷ", "u", "p"));
            CharList.Add(new JapChar("pe", "ぺ", "e", "p"));
            CharList.Add(new JapChar("po", "ぽ", "o", "p"));

            CharList.Add(new JapChar("ma", "ま", "a", "m"));
            CharList.Add(new JapChar("mi", "み", "i", "m"));
            CharList.Add(new JapChar("mu", "む", "u", "m"));
            CharList.Add(new JapChar("me", "め", "e", "m"));
            CharList.Add(new JapChar("mo", "も", "o", "m"));

            CharList.Add(new JapChar("ya", "や", "a", "y"));
            CharList.Add(new JapChar("yu", "ゆ", "u", "y"));
            CharList.Add(new JapChar("yo", "よ", "o", "y"));

            CharList.Add(new JapChar("wa", "わ", "a", "w"));
            CharList.Add(new JapChar("n", "ん", "u", "w"));
            CharList.Add(new JapChar("wo", "を", "o", "w"));

            CharList.Add(new JapChar("ra", "ら", "a", "r"));
            CharList.Add(new JapChar("ri", "り", "i", "r"));
            CharList.Add(new JapChar("ru", "る", "u", "r"));
            CharList.Add(new JapChar("re", "れ", "e", "r"));
            CharList.Add(new JapChar("ro", "ろ", "o", "r"));
        }
Exemplo n.º 9
0
        //Constructor
        public KataAlphabet()
        {
            CharList.Add(new JapChar("a", "ア", "a", "vowel"));
            CharList.Add(new JapChar("i", "イ", "i", "vowel"));
            CharList.Add(new JapChar("u", "ウ", "u", "vowel"));
            CharList.Add(new JapChar("e", "エ", "e", "vowel"));
            CharList.Add(new JapChar("o", "オ", "o", "vowel"));

            CharList.Add(new JapChar("ka", "カ", "a", "k"));
            CharList.Add(new JapChar("ki", "キ", "i", "k"));
            CharList.Add(new JapChar("ku", "ク", "u", "k"));
            CharList.Add(new JapChar("ke", "ケ", "e", "k"));
            CharList.Add(new JapChar("ko", "コ", "o", "k"));

            CharList.Add(new JapChar("ga", "ガ", "a", "g"));
            CharList.Add(new JapChar("gi", "ギ", "i", "g"));
            CharList.Add(new JapChar("gu", "グ", "u", "g"));
            CharList.Add(new JapChar("ge", "ゲ", "e", "g"));
            CharList.Add(new JapChar("go", "ゴ", "o", "g"));

            CharList.Add(new JapChar("ta", "タ", "a", "t"));
            CharList.Add(new JapChar("chi", "チ", "i", "t"));
            CharList.Add(new JapChar("tsu", "ツ", "u", "t"));
            CharList.Add(new JapChar("te", "テ", "e", "t"));
            CharList.Add(new JapChar("to", "ト", "o", "t"));

            CharList.Add(new JapChar("da", "ダ", "a", "d"));
            CharList.Add(new JapChar("ji", "ヂ", "i", "d"));
            CharList.Add(new JapChar("zu", "ヅ", "u", "d"));
            CharList.Add(new JapChar("de", "デ", "e", "d"));
            CharList.Add(new JapChar("do", "ド", "o", "d"));

            CharList.Add(new JapChar("sa", "サ", "a", "s"));
            CharList.Add(new JapChar("shi", "シ", "i", "s"));
            CharList.Add(new JapChar("su", "ス", "u", "s"));
            CharList.Add(new JapChar("se", "セ", "e", "s"));
            CharList.Add(new JapChar("so", "ソ", "o", "s"));

            CharList.Add(new JapChar("za", "ザ", "a", "z"));
            CharList.Add(new JapChar("ji", "ジ", "i", "z"));
            CharList.Add(new JapChar("zu", "ズ", "u", "z"));
            CharList.Add(new JapChar("ze", "ゼ", "e", "z"));
            CharList.Add(new JapChar("zo", "ゾ", "o", "z"));

            CharList.Add(new JapChar("na", "ナ", "a", "n"));
            CharList.Add(new JapChar("ni", "ニ", "i", "n"));
            CharList.Add(new JapChar("nu", "ヌ", "u", "n"));
            CharList.Add(new JapChar("ne", "ネ", "e", "n"));
            CharList.Add(new JapChar("no", "ノ", "o", "n"));

            CharList.Add(new JapChar("ha", "ハ", "a", "h"));
            CharList.Add(new JapChar("hi", "ヒ", "i", "h"));
            CharList.Add(new JapChar("fu", "フ", "u", "h"));
            CharList.Add(new JapChar("he", "ヘ", "e", "h"));
            CharList.Add(new JapChar("ho", "ホ", "o", "h"));

            CharList.Add(new JapChar("ba", "バ", "a", "b"));
            CharList.Add(new JapChar("bi", "ビ", "i", "b"));
            CharList.Add(new JapChar("bu", "ブ", "u", "b"));
            CharList.Add(new JapChar("be", "ベ", "e", "b"));
            CharList.Add(new JapChar("bo", "ボ", "o", "b"));

            CharList.Add(new JapChar("pa", "パ", "a", "p"));
            CharList.Add(new JapChar("pi", "ピ", "i", "p"));
            CharList.Add(new JapChar("pu", "プ", "u", "p"));
            CharList.Add(new JapChar("pe", "ペ", "e", "p"));
            CharList.Add(new JapChar("po", "ポ", "o", "p"));

            CharList.Add(new JapChar("ma", "マ", "a", "m"));
            CharList.Add(new JapChar("mi", "ミ", "i", "m"));
            CharList.Add(new JapChar("mu", "ム", "u", "m"));
            CharList.Add(new JapChar("me", "メ", "e", "m"));
            CharList.Add(new JapChar("mo", "モ", "o", "m"));

            CharList.Add(new JapChar("ya", "ヤ", "a", "y"));
            CharList.Add(new JapChar("yu", "ユ", "u", "y"));
            CharList.Add(new JapChar("yo", "ヨ", "o", "y"));

            CharList.Add(new JapChar("wa", "ワ", "a", "w"));
            CharList.Add(new JapChar("n", "ン", "u", "w"));
            CharList.Add(new JapChar("wo", "ヲ", "o", "w"));

            CharList.Add(new JapChar("ra", "ラ", "a", "r"));
            CharList.Add(new JapChar("ri", "リ", "i", "r"));
            CharList.Add(new JapChar("ru", "ル", "u", "r"));
            CharList.Add(new JapChar("re", "レ", "e", "r"));
            CharList.Add(new JapChar("ro", "ロ", "o", "r"));
        }