Beispiel #1
0
        internal BaseObject(int oldId, string newRawcode, ObjectDatabaseBase?db = null)
        {
            OldId = oldId;
            NewId = newRawcode.FromRawcode();

            _db = db ?? ObjectDatabase.DefaultDatabase;
            _db.AddObject(this);
        }
Beispiel #2
0
        internal BaseObject(int oldId, int newId, ObjectDatabaseBase?db = null)
        {
            OldId = oldId;
            NewId = newId;

            _db = db ?? ObjectDatabase.DefaultDatabase;
            _db.AddObject(this);
        }
Beispiel #3
0
 internal static BaseObject ShallowCopy(BaseObject baseObject, ObjectDatabaseBase db)
 {
     return(baseObject switch
     {
         Unit => new Unit((UnitType)baseObject.OldId, baseObject.NewId, db),
         Item => new Item((ItemType)baseObject.OldId, baseObject.NewId, db),
         Destructable => new Destructable((DestructableType)baseObject.OldId, baseObject.NewId, db),
         Doodad => new Doodad((DoodadType)baseObject.OldId, baseObject.NewId, db),
         Ability => AbilityFactory.Create((AbilityType)baseObject.OldId, baseObject.NewId, db),
         Buff => new Buff((BuffType)baseObject.OldId, baseObject.NewId, db),
         Upgrade => new Upgrade((UpgradeType)baseObject.OldId, baseObject.NewId, db),
     });
Beispiel #4
0
        public Tech(ObjectDatabaseBase db, int key)
        {
            if (db is null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            try
            {
                db.ReserveTech(key);
            }
            catch (ArgumentException)
            {
                throw;
            }

            _db  = db;
            _key = key;
        }