internal static Landblock GetNewEphemeralLandblock(uint landcell, Player owner, List <ACE.Entity.Models.Realm> realmTemplates)
        {
            EphemeralRealm ephemeralRealm;

            lock (realmsLock)
                ephemeralRealm = EphemeralRealm.Initialize(owner, realmTemplates);
            var iid       = LandblockManager.GetFreeInstanceID(true, ephemeralRealm.RulesetTemplate.Realm.Id, (ushort)(landcell >> 16));
            var longcell  = ((ulong)iid << 32) | landcell;
            var landblock = LandblockManager.GetLandblock(longcell, false, false, ephemeralRealm);

            log.Info($"GetNewEphemeralLandblock created for player {owner.Name}, realm ruleset {ephemeralRealm.RulesetTemplate.Realm.Id}, longcell {longcell}.");
            return(landblock);
        }
Esempio n. 2
0
        /// <summary>
        /// If the landblock is loaded, return a reference to the current House object
        /// else return a copy of the House biota from the latest info in the db
        ///
        /// <param name="callback">called when the slumlord inventory is fully loaded</param>
        public static void GetHouse(uint houseGuid, Action <House> callback)
        {
            var landblock = (ushort)((houseGuid >> 12) & 0xFFFF);

            var landblockId = new LandblockId((uint)(landblock << 16 | 0xFFFF));
            var isLoaded    = LandblockManager.IsLoaded(landblockId);

            if (!isLoaded)
            {
                // landblock is unloaded
                // return a copy of the House biota from the latest info in the db
                var houseBiota = House.Load(houseGuid);

                RegisterCallback(houseBiota, callback);

                return;
            }

            // landblock is loaded, return a reference to the current House object
            var loaded = LandblockManager.GetLandblock(landblockId, false);
            var house  = loaded.GetObject(new ObjectGuid(houseGuid)) as House;

            if (house != null && house.SlumLord != null)
            {
                if (!house.SlumLord.InventoryLoaded)
                {
                    RegisterCallback(house, callback);
                }
                else
                {
                    callback(house);
                }
            }
            else if (!loaded.CreateWorldObjectsCompleted)
            {
                var houseBiota = House.Load(houseGuid);

                RegisterCallback(houseBiota, callback);
            }
            else
            {
                log.Error($"[HOUSE] HouseManager.GetHouse({houseGuid:X8}): couldn't find house on loaded landblock");
            }
        }