Example #1
0
        private QALevelRewardTable.RowData BinarySearchID(uint key, int min, int max)
        {
            QALevelRewardTable.RowData rowData = this.Table[min];
            if (rowData.ID == key)
            {
                return(rowData);
            }
            QALevelRewardTable.RowData rowData2 = this.Table[max];
            if (rowData2.ID == key)
            {
                return(rowData2);
            }
            if (max - min <= 1)
            {
                return(null);
            }
            int num = min + (max - min) / 2;

            QALevelRewardTable.RowData rowData3 = this.Table[num];
            if (rowData3.ID.CompareTo(key) > 0)
            {
                return(this.BinarySearchID(key, min, num));
            }
            if (rowData3.ID.CompareTo(key) < 0)
            {
                return(this.BinarySearchID(key, num, max));
            }
            return(rowData3);
        }
Example #2
0
 protected override bool OnLine(string[] Fields)
 {
     QALevelRewardTable.RowData rowData = new QALevelRewardTable.RowData();
     if (!base.Parse(Fields[this.ColMap[0]], ref rowData.ID))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[1]], ref rowData.QAType))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[2]], ref rowData.MinLevel))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[3]], ref rowData.MaxLevel))
     {
         return(false);
     }
     if (!base.Parse <uint>(Fields[this.ColMap[4]], ref rowData.Reward, CVSReader.uintParse, "2U"))
     {
         return(false);
     }
     if (!base.Parse <uint>(Fields[this.ColMap[5]], ref rowData.ExtraReward, CVSReader.uintParse, "2U"))
     {
         return(false);
     }
     this.AddRowID(rowData.ID, rowData, 0, this.Table.Count - 1);
     return(true);
 }
Example #3
0
 protected override void ReadLine(BinaryReader reader)
 {
     QALevelRewardTable.RowData rowData = new QALevelRewardTable.RowData();
     base.Read <uint>(reader, ref rowData.ID, CVSReader.uintParse);
     this.columnno = 0;
     base.Read <uint>(reader, ref rowData.QAType, CVSReader.uintParse);
     this.columnno = 1;
     base.Read <uint>(reader, ref rowData.MinLevel, CVSReader.uintParse);
     this.columnno = 2;
     base.Read <uint>(reader, ref rowData.MaxLevel, CVSReader.uintParse);
     this.columnno = 3;
     base.ReadSeqList <uint>(reader, ref rowData.Reward, CVSReader.uintParse);
     this.columnno = 4;
     base.ReadSeqList <uint>(reader, ref rowData.ExtraReward, CVSReader.uintParse);
     this.columnno = 5;
     this.AddRowID(rowData.ID, rowData, 0, this.Table.Count - 1);
     this.columnno = -1;
 }
Example #4
0
        private void AddRowID(uint key, QALevelRewardTable.RowData row, int min, int max)
        {
            if (this.Table.Count == 0)
            {
                this.Table.Add(row);
                return;
            }
            QALevelRewardTable.RowData rowData = this.Table[min];
            if (rowData.ID.CompareTo(key) > 0)
            {
                this.Table.Insert(min, row);
                return;
            }
            if (rowData.ID == key)
            {
                XSingleton <XDebug> .singleton.AddErrorLog2("Table: QALevelRewardTable duplicate id:{0}  lineno: {1}", new object[]
                {
                    key,
                    this.lineno
                });

                return;
            }
            QALevelRewardTable.RowData rowData2 = this.Table[max];
            if (rowData2.ID.CompareTo(key) < 0)
            {
                this.Table.Insert(max + 1, row);
                return;
            }
            if (rowData2.ID == key)
            {
                XSingleton <XDebug> .singleton.AddErrorLog2("Table: QALevelRewardTable duplicate id:{0}  lineno: {1}", new object[]
                {
                    key,
                    this.lineno
                });

                return;
            }
            if (max - min <= 1)
            {
                this.Table.Insert(min + 1, row);
                return;
            }
            int num = min + (max - min) / 2;

            QALevelRewardTable.RowData rowData3 = this.Table[num];
            if (rowData3.ID.CompareTo(key) > 0)
            {
                this.AddRowID(key, row, min, num);
                return;
            }
            if (rowData3.ID.CompareTo(key) < 0)
            {
                this.AddRowID(key, row, num, max);
                return;
            }
            XSingleton <XDebug> .singleton.AddErrorLog2("Table: QALevelRewardTable duplicate id:{0}  lineno: {1}", new object[]
            {
                key,
                this.lineno
            });
        }