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

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

            _db = db ?? ObjectDatabase.DefaultDatabase;
            _db.AddObject(this);
        }
Example #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),
     });
Example #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;
        }