public DefaultCreatureActorState([NotNull] IEntityDataFieldContainer entityData, [NotNull] NetworkEntityGuid entityGuid, [NotNull] CreatureInstanceModel instanceModel, [NotNull] CreatureTemplateModel templateModel, [NotNull] InterestCollection interest) : base(entityData, entityGuid, interest) { InstanceModel = instanceModel ?? throw new ArgumentNullException(nameof(instanceModel)); TemplateModel = templateModel ?? throw new ArgumentNullException(nameof(templateModel)); }
protected override void OnEventFired(object source, EntityCreationStartingEventArgs args) { //Only do creatures. if (args.EntityGuid.EntityType != EntityType.Creature) { return; } IEntityDataFieldContainer dataContainer = EntityDataMappable.RetrieveEntity(args.EntityGuid); CreatureTemplateModel template = CreatureTemplateMappable.RetrieveEntity(args.EntityGuid); //Initialize the creature display model ID. dataContainer.SetFieldValue(BaseObjectField.UNIT_FIELD_DISPLAYID, template.ModelId); }
private void CreateActor(WorldActorState state, CreateCreatureEntityActorMessage message) { //Create the actor and tell it to initialize. IActorRef actorRef = state.WorldActorFactory.ActorOf(Resolver.Create <DefaultCreatureEntityActor>(), message.EntityGuid.RawGuidValue.ToString()); //TODO: Move to factory. CreatureInstanceModel instanceModel = CreatureInstanceMappable.RetrieveEntity(message.EntityGuid); CreatureTemplateModel templateModel = CreatureTemplateMappable.RetrieveEntity(message.EntityGuid); DefaultCreatureEntityActor.InitializeActor(actorRef, new DefaultCreatureActorState(EntityDataMappable.RetrieveEntity(message.EntityGuid), message.EntityGuid, instanceModel, templateModel, InterestMappable.RetrieveEntity(message.EntityGuid))); ActorRefMappable.AddObject(message.EntityGuid, actorRef); if (Logger.IsInfoEnabled) { Logger.Info($"Created Creature Actor: {typeof(DefaultCreatureEntityActor)} for Entity: {message.EntityGuid}"); } }