Пример #1
0
        /// <summary>
        ///     Gets a data reference by id.
        /// </summary>
        public static LogicData GetDataById(int globalId)
        {
            int tableIndex = GlobalID.GetClassID(globalId) - 1;

            if (tableIndex >= 0 && tableIndex <= 43 && LogicDataTables._dataTables[tableIndex] != null)
            {
                return(LogicDataTables._dataTables[tableIndex].GetItemById(globalId));
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        ///     Gets a item by id.
        /// </summary>
        public LogicData GetItemById(int globalId)
        {
            int instanceId = GlobalID.GetInstanceID(globalId);

            if (instanceId < 0 || instanceId >= this._items.Count)
            {
                Debugger.Warning("LogicDataTable::getItemById() - Instance id out of bounds! " + (instanceId + 1) + "/" + this._items.Count);
                return(null);
            }

            return(this._items[instanceId]);
        }
Пример #3
0
 /// <summary>
 ///     Gets the instance id.
 /// </summary>
 public int GetInstanceID()
 {
     return(GlobalID.GetInstanceID(this._globalId));
 }
Пример #4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="LogicData" />
 /// </summary>
 public LogicData(CSVRow row, LogicDataTable table)
 {
     this._row      = row;
     this._table    = table;
     this._globalId = GlobalID.CreateGlobalID(table.GetTableIndex() + 1, table.GetItemCount());
 }