Ejemplo n.º 1
0
        public virtual async Task OnConstruct()
        {
            if (_IsValid())
            {
                await SetGUID(new ObjectGUID(this.GetPrimaryKeyLong()));

                List <Task> tasks = new List <Task>();
                tasks.Add(SetFloat((int)EObjectFields.OBJECT_FIELD_SCALE_X, 1.0f));  //default scale

                if (State.UpdateFieldsMask == null)
                {
                    State.UpdateFieldsMask = new UpdateMask(State.UpdateFields.Length);
                }
                if (State.InRangeObjects == null)
                {
                    State.InRangeObjects = new List <ObjectGUID>();
                }
                if (State.SightBase == null)
                {
                    State.SightBase = new ObjectGUID(0);
                }

                var inrange = State.InRangeObjects.ToArray(); //copy so we don't get enumeration errors
                foreach (var guid in inrange)
                {
                    AddInRangeObjectImpl(guid, ObjectRetriever.GetObject(GrainFactory, guid));
                }
                await Task.WhenAll(tasks);
            }
        }
Ejemplo n.º 2
0
        public override async Task OnActivateAsync()
        {
            if (State.Objects == null)
                State.Objects = new List<ObjectGUID>();

            foreach (var guid in State.Objects)
            {
                var obj = ObjectRetriever.GetObject(GrainFactory, guid);
                _objectCache.Add(guid, obj);
            }

            await base.OnActivateAsync();
        }
Ejemplo n.º 3
0
        public async Task OnConstruct()
        {
            if (State.ObjectList == null)
            {
                State.ObjectList = new List <ObjectGUID>();
            }
            if (State.ActiveCells == null)
            {
                State.ActiveCells = new List <UInt64>();
            }
            if (State.CreatedCells == null)
            {
                State.CreatedCells = new List <UInt64>();
            }
            if (State.ActiveObjects == null)
            {
                State.ActiveObjects = new List <ObjectGUID>();
            }
            if (State.UpdatedObjects == null)
            {
                State.UpdatedObjects = new List <ObjectGUID>();
            }

            SetupUpdateTask();
            SetupSaveTask();

            List <Task> tasks = new List <Task>();


            foreach (var guid in State.ObjectList)
            {
                var obj = ObjectRetriever.GetObject(GrainFactory, guid);
                _objectCache.Add(guid, obj);
            }

            tasks.Add(LoadCreatureEntries());
            tasks.Add(InitMapCells());

            await Task.WhenAll(tasks);
        }
Ejemplo n.º 4
0
        public async Task AddInRangeObject(ObjectGUID guid, bool add_other = true)
        {
            var obj = ObjectRetriever.GetObject(GrainFactory, guid);

            await AddInRangeObject(guid, obj, add_other);
        }