public ScApiSession( ISessionConfig config, IEntitySource entitySource, IScCredentials credentials, IMediaLibrarySettings mediaSettings, ItemSource defaultSource = null) { if (null == config) { throw new ArgumentNullException("ScApiSession.config cannot be null"); } if (entitySource != null) { this.entitySource = entitySource.ShallowCopy(); } this.sessionConfig = config.SessionConfigShallowCopy(); this.requestMerger = new UserRequestMerger(this.sessionConfig, defaultSource, this.entitySource); if (null != credentials) { this.credentials = credentials.CredentialsShallowCopy(); } if (null != mediaSettings) { this.mediaSettings = mediaSettings.MediaSettingsShallowCopy(); } this.cookies = new CookieContainer(); this.handler = new HttpClientHandler(); this.handler.CookieContainer = cookies; this.httpClient = new HttpClient(this.handler); }
public IEntitySource FillEntitySourceGaps(IEntitySource userSource) { bool isNullSource = (null == this.defaultSource); bool isNullInput = (null == userSource); if (isNullSource && isNullInput) { return(null); } else if (isNullInput) { return(this.defaultSource.ShallowCopy()); } else if (isNullSource) { return(userSource.ShallowCopy()); } string entityNamespace = (null != userSource.EntityNamespace) ? userSource.EntityNamespace : this.defaultSource.EntityNamespace; string entityController = (null != userSource.EntityController) ? userSource.EntityController : this.defaultSource.EntityController; string entityId = (null != userSource.EntityId) ? userSource.EntityId : this.defaultSource.EntityId; string entityAction = (null != userSource.EntityAction) ? userSource.EntityAction : this.defaultSource.EntityAction; return(new EntitySource(entityNamespace, entityController, entityId, entityAction)); }
public override void OnSpawn(NPC npc, IEntitySource source) { base.OnSpawn(npc, source); npc.buffImmune[BuffID.OnFire] = true; npc.buffImmune[BuffID.OnFire3] = true; }
/// <summary> /// Creates an instance of the query executor aware of the entities queried. /// </summary> /// <param name="entityContext">Entity factory to be used when creating objects.</param> /// <param name="entitySource">Entity source.</param> /// <param name="store">Entity store</param> public EntityQueryExecutor(IEntityContext entityContext, IEntitySource entitySource, IEntityStore store) { _entityContext = entityContext; _entitySource = entitySource; _store = store; _queryOptimizer = new GenericQueryOptimizer(); }
public ReadEntityByIdParameters(string id, IEntitySource entitySource, IDictionary <string, string> parametersRawValuesByName, ISessionConfig sessionConfig) { this.EntityID = id; this.EntitySource = entitySource; this.SessionSettings = sessionConfig; this.ParametersRawValuesByName = parametersRawValuesByName; }
public EntityContext( IEntityContextFactory factory, IMappingsRepository mappings, IEntityStore entityStore, IEntitySource entitySource, IBaseUriSelectionPolicy baseUriSelector, IRdfTypeCache typeCache, IBlankNodeIdGenerator blankIdGenerator, IResultTransformerCatalog transformerCatalog, IEntityCaster caster, IDatasetChangesTracker changeTracker, ILogger log) : this( factory, mappings, entityStore, entitySource, baseUriSelector, typeCache, blankIdGenerator, transformerCatalog, caster, changeTracker, null, log) { }
public EntityContext( IEntityContextFactory factory, IMappingsRepository mappings, IEntityStore entityStore, IEntitySource entitySource, IBaseUriSelectionPolicy baseUriSelector, IRdfTypeCache typeCache, IBlankNodeIdGenerator blankIdGenerator, IResultTransformerCatalog transformerCatalog, IEntityCaster caster, IDatasetChangesTracker changeTracker, IResourceResolutionStrategy resourceResolutionStrategy, ILogger log) : this(changeTracker) { _factory = factory; _entityStore = entityStore; _entitySource = entitySource; _baseUriSelector = baseUriSelector; _mappings = mappings; _typeCache = typeCache; _blankIdGenerator = blankIdGenerator; _transformerCatalog = transformerCatalog; _caster = caster; _typedEntityMapping = _mappings.MappingFor <ITypedEntity>(); _typesPropertyMapping = _typedEntityMapping.PropertyFor("Types"); _resourceResolutionStrategy = resourceResolutionStrategy; _log = log; if (_baseUriSelector == null) { _log.Warning("No Base URI Selection Policy. It will not be possible to use relative URIs"); } }
public void TestMergerReturnsNullIfBothInputAndDefaultAreNull() { var merger = new EntitySourceMerger(null); IEntitySource result = merger.FillEntitySourceGaps(null); Assert.IsNull(result); }
internal DefaultEntityContext(IEntitySource entitySource, IMappingsRepository mappingsRepository, IChangeDetector changeDetector) { _entitySource = entitySource; Mappings = mappingsRepository; _changeDetector = changeDetector; _deletedEntities = new List <Iri>(); _entityCache = new ConcurrentDictionary <Iri, Entity>(); }
/// <summary> /// Initializes a new instance of the <see cref="ZyanEntityQueryHandler"/> class. /// </summary> /// <param name="entitySource">The entity source.</param> public ZyanEntityQueryHandler(IEntitySource entitySource) { if (entitySource == null) { throw new ArgumentNullException("entitySource"); } EntitySource = entitySource; }
public override void OnSpawn(NPC npc, IEntitySource source) { base.OnSpawn(npc, source); if (source is EntitySource_Parent parent && parent.Entity is NPC sourceNPC && sourceNPC.type == NPCID.Tim) { SpawnedByTim = true; } }
public EntitySourceMerger(IEntitySource defaultSource) { if (null == defaultSource) { return; } this.defaultSource = defaultSource.ShallowCopy(); }
/// <summary> /// Creates ZyanServerQueryHandler instance. /// </summary> /// <param name="source">IEntitySource instance</param> public ZyanServerQueryHandler(IEntitySource source) { if (source == null) { throw new ArgumentNullException("source"); } InnerHandler = new ServerQueryHandler(new ZyanEntityQueryHandler(source)); }
public override void OnSpawn(IEntitySource source) { SoundEngine.PlaySound(SoundID.ForceRoarPitched, Projectile.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(Projectile.InheritSource(Projectile), Projectile.Center, Vector2.Zero, ModContent.ProjectileType <GlowRing>(), 0, 0f, Main.myPlayer, -1, NPCID.EyeofCthulhu); } }
public override void OnSpawn(IEntitySource source) { if (source is EntitySource_Parent parent && parent.Entity is NPC sourceNPC) { npc = sourceNPC; offset = Projectile.Center - npc.Center; dir = sourceNPC.direction; } }
public override void OnSpawn(NPC npc, IEntitySource source) { base.OnSpawn(npc, source); if (source is EntitySource_Parent parent && parent.Entity is Projectile projectile && projectile.type == ProjectileID.SandnadoHostile) { selfdestruct = true; } }
public override void OnSpawn(IEntitySource source) { base.OnSpawn(source); if (source is EntitySource_Parent parent && parent.Entity is NPC sourceNPC) { body = sourceNPC; } }
public ScTestApiSession( ISessionConfig config, IEntitySource entitySource, IScCredentials credentials, IMediaLibrarySettings mediaSettings, ItemSource defaultSource = null) : base(config, entitySource, credentials, mediaSettings, defaultSource) { this.GetPublicKeyInvocationsCount = 0; }
public static int NewSummonProjectile(IEntitySource source, Vector2 spawn, Vector2 velocity, int type, int rawBaseDamage, float knockback, int owner = 255, float ai0 = 0, float ai1 = 1) { int p = Projectile.NewProjectile(source, spawn, velocity, type, rawBaseDamage, knockback, owner, ai0, ai1); if (p != Main.maxProjectiles) { Main.projectile[p].originalDamage = rawBaseDamage; } return(p); }
public IReadEntityByIdRequest FillReadEntityByIdGaps(IReadEntityByIdRequest userRequest) { IEntitySource newSource = this.EntitySourceMerger.FillEntitySourceGaps(userRequest.EntitySource); ISessionConfig mergedSessionConfig = this.SessionConfigMerger.FillSessionConfigGaps(userRequest.SessionSettings); ReadEntityByIdParameters newRequest = new ReadEntityByIdParameters(userRequest.EntityID, newSource, userRequest.ParametersRawValuesByName, mergedSessionConfig); return(newRequest); }
public ICreateEntityRequest FillCreateEntityGaps(ICreateEntityRequest userRequest) { IEntitySource newSource = this.EntitySourceMerger.FillEntitySourceGaps(userRequest.EntitySource); ISessionConfig mergedSessionConfig = this.SessionConfigMerger.FillSessionConfigGaps(userRequest.SessionSettings); ChangeEntitiesParameters newRequest = new ChangeEntitiesParameters(userRequest.EntityID, userRequest.FieldsRawValuesByName, userRequest.ParametersRawValuesByName, newSource, mergedSessionConfig); return(newRequest); }
public void TestMergerReturnsDefaultSourceCopyForNilInput() { IEntitySource source = new EntitySource("ns", "cnt", "id", "act"); var merger = new EntitySourceMerger(source); IEntitySource result = merger.FillEntitySourceGaps(null); Assert.AreNotSame(source, result); Assert.AreEqual(source, result); }
public IDeleteEntityRequest DeepCopyDeleteEntityRequest() { IEntitySource entitySource = null; if (null != this.EntitySource) { entitySource = this.EntitySource.ShallowCopy(); } return(new DeleteEntityParameters(this.EntityID, entitySource, this.ParametersRawValuesByName)); }
public static Projectile[] XWay(int num, IEntitySource spawnSource, Vector2 pos, int type, float speed, int damage, float knockback) { Projectile[] projs = new Projectile[num]; double spread = 2 * Math.PI / num; for (int i = 0; i < num; i++) { projs[i] = NewProjectileDirectSafe(spawnSource, pos, new Vector2(speed, speed).RotatedBy(spread * i), type, damage, knockback, Main.myPlayer); } return(projs); }
public async Task LoadAsync( ISystemService systems, IEntitySource <Actor> source, CancellationToken cancellationToken = default) { await ClearAsync(systems, cancellationToken); Actors.Load(source); await systems.InitAsync(cancellationToken); }
public override void OnSpawn(Projectile projectile, IEntitySource source) { if (source is not EntitySource_ItemUse_WithAmmo itemSource || !ClickerSystem.IsClickerItem(itemSource.Item)) { return; } projectile.DamageType = ModContent.GetInstance <ClickerDamage>(); projectile.penetrate = -1; //3 by default projectile.timeLeft = 190; //240 by default, this controls its behavior: 140 starts homing }
new public IUpdateEntityRequest DeepCopyUpdateEntityRequest() { IEntitySource entitySource = null; if (null != this.EntitySource) { entitySource = this.EntitySource.ShallowCopy(); } return(new UpdateEntityParameters(this.EntityID, this.FieldsRawValuesByName, this.ParametersRawValuesByName, entitySource)); }
public static bool OnSpawnEnchCanAffectProjectile(Projectile projectile, IEntitySource source) { return(projectile.friendly && projectile.damage > 0 && !projectile.hostile && !projectile.npcProj && !projectile.trap && projectile.DamageType != DamageClass.Default && !projectile.minion && !projectile.sentry && projectile.minionSlots <= 0); }
public override void OnSpawn(NPC npc, IEntitySource source) { if (!FargoSoulsWorld.EternityMode) { return; } foreach (EModeNPCBehaviour behaviour in EModeNpcBehaviours) { behaviour.OnSpawn(npc, source); } }
public override void OnSpawn(IEntitySource source) { npc = FargoSoulsUtil.NPCExists(Projectile.ai[1]); for (int i = 0; i < 50; i++) { int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.WoodFurniture, Scale: 3f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 3f; Main.dust[d].velocity += Projectile.velocity * Main.rand.NextFloat(9f); } }
public GameEntityPool(IEntitySource entitySource) { _entitySource = entitySource; }