public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var value = context.Reader.Read <float>(); context.Writer.Write(value); ((Player)context.Associate)?.SendChatMessage($"Switch Multiple: {value} -> {Behaviors.Count}"); var defaultValue = Behaviors.ToArray()[0].Value; if (value <= defaultValue) { value = defaultValue; } foreach (var(behavior, mark) in Behaviors.ToArray().Reverse()) { ((Player)context.Associate)?.SendChatMessage($"SWITCH: {behavior.Id} [{mark}]"); if (value < mark) { continue; } await behavior.ExecuteAsync(context, branchContext); break; } }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var handle = context.Reader.Read <uint>(); context.Writer.Write(handle); RegisterHandle(handle, context, branchContext); var state = true; if (Imagination > 0 || !IsEnemyFaction) { state = context.Reader.ReadBit(); context.Writer.WriteBit(false); } if (state) { await ActionTrue.ExecuteAsync(context, branchContext); } else { await ActionFalse.ExecuteAsync(context, branchContext); } }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var length = context.Reader.Read <uint>(); ((Player)context.Associate).SendChatMessage($"AREA LENGTH: {length}"); if (length > 10) { length = 10; } context.Writer.Write(length); var targets = new GameObject[length]; for (var i = 0; i < length; i++) { var id = context.Reader.Read <ulong>(); context.Writer.Write(id); context.Associate.Zone.TryGetGameObject((long)id, out var target); ((Player)context.Associate)?.SendChatMessage($"AREA: {id} -> {target}"); targets[i] = target; } foreach (var target in targets) { await Action.ExecuteAsync(context, new ExecutionBranchContext(target)); } }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); context.Reader.ReadBit(); context.Writer.WriteBit(false); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); branchContext.Duration = ActionDuration * 1000; await Action.ExecuteAsync(context, branchContext); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); foreach (var behavior in Behaviors) { await behavior.ExecuteAsync(context, branchContext); } }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var handle = context.Reader.Read <uint>(); ((Player)context.Associate)?.SendChatMessage($"ChargeUp: {handle}"); RegisterHandle(handle, context, branchContext); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var handle = context.Reader.Read <uint>(); context.Writer.Write(handle); RegisterHandle(handle, context, branchContext); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var chainIndex = context.Reader.Read <uint>(); context.Writer.Write(chainIndex); await Behaviors[chainIndex - 1].ExecuteAsync(context, branchContext); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); if (!branchContext.Target.TryGetComponent <Stats>(out var stats)) { return; } stats.Imagination = (uint)((int)stats.Imagination + Imagination); }
public override Task DismantleAsync(ExecutionContext context, ExecutionBranchContext branchContext) { if (!context.Associate.TryGetComponent <Stats>(out var stats)) { return(Task.CompletedTask); } stats.MaxHealth -= (uint)Life; stats.MaxArmor -= (uint)Armor; stats.MaxImagination -= (uint)Imagination; return(Task.CompletedTask); }
protected void RegisterHandle(uint handle, ExecutionContext context, ExecutionBranchContext branchContext) { context.BehaviorHandles[handle] = async(reader, writer) => { var newBranchContext = new ExecutionBranchContext(branchContext.Target) { Duration = branchContext.Duration }; context.Reader = reader; context.Writer = writer; await SyncAsync(context, newBranchContext); }; }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); ((Player)context.Associate)?.SendChatMessage($"STUN CASTER: {StunCaster}"); if (StunCaster == 1) { return; } context.Reader.ReadBit(); context.Writer.WriteBit(false); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var array = new[] { HitAction, HitActionEnemy, HitActionFaction }; if (array.All(b => b?.BehaviorId == 0)) { return; } var handle = context.Reader.Read <uint>(); context.Writer.Write(handle); RegisterHandle(handle, context, branchContext); }
public override async Task SyncAsync(ExecutionContext context, ExecutionBranchContext branchContext) { var actionId = context.Reader.Read <uint>(); context.Writer.Write(actionId); var action = await GetBehavior(actionId); var id = context.Reader.Read <ulong>(); context.Writer.Write(id); context.Associate.Zone.TryGetGameObject((long)id, out var target); var branch = new ExecutionBranchContext(target) { Duration = branchContext.Duration }; await action.ExecuteAsync(context, branch); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); if (branchContext.Target != context.Associate) { context.Reader.ReadBit(); context.Writer.WriteBit(false); } if (InterruptBlock == 0) { context.Reader.ReadBit(); context.Writer.WriteBit(false); } context.Reader.ReadBit(); context.Writer.WriteBit(false); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var target = context.Reader.ReadGameObject(context.Associate.Zone); context.Writer.Write <long>(target); ((Player)context.Associate)?.SendChatMessage($"{ProjectileCount} projectiles."); if (ProjectileCount == 0) { StartProjectile(context, target); } else { for (var i = 0; i < ProjectileCount; i++) { StartProjectile(context, target); } } }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); MovementType = (MovementType)context.Reader.Read <uint>(); context.Writer.Write((uint)MovementType); switch (MovementType) { case MovementType.Ground: await GroundBehavior.ExecuteAsync(context, branchContext); return; case MovementType.Jump: await JumpBehavior.ExecuteAsync(context, branchContext); return; case MovementType.Falling: await FallingBehavior.ExecuteAsync(context, branchContext); return; case MovementType.DoubleJump: await DoubleJumpBehavior.ExecuteAsync(context, branchContext); return; case MovementType.Jetpack: await JetpackBehavior.ExecuteAsync(context, branchContext); return; default: return; } }
public virtual async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { if (EffectId == 0) { EffectId = await GetParameter <int>("effectID"); if (EffectId == default) { EffectId = -1; } } if (EffectId == -1) { return; } var effectName = EffectIndex++.ToString(); context.Associate.Zone.ExcludingMessage(new PlayFXEffectMessage { Associate = branchContext.Target, Secondary = context.Associate, EffectId = EffectId, Name = effectName }, context.Associate as Player); var _ = Task.Run(async() => { await Task.Delay(branchContext.Duration > 0 ? branchContext.Duration : 1000); context.Associate.Zone.ExcludingMessage(new StopFXEffectMessage() { Associate = branchContext.Target, Name = effectName }, context.Associate as Player); }); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var obj = GameObject.Instantiate <AuthoredGameObject>( context.Associate.Zone, Lot, context.Associate.Transform.Position, context.Associate.Transform.Rotation ); obj.Author = context.Associate; Object.Start(obj); GameObject.Construct(obj); var _ = Task.Run(async() => { await Task.Delay(branchContext.Duration); Object.Destroy(obj); }); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); context.Reader.Align(); context.Writer.Align(); context.Reader.Read <ushort>(); context.Writer.Write <ushort>(0); context.Reader.ReadBit(); context.Reader.ReadBit(); context.Reader.ReadBit(); context.Writer.WriteBit(false); context.Writer.WriteBit(false); context.Writer.WriteBit(false); context.Reader.Read <uint>(); context.Writer.Write(0); var damage = context.Reader.Read <uint>(); context.Writer.Write(damage); ((Player)context.Associate)?.SendChatMessage($"{damage} -> {branchContext.Target}"); branchContext.Target.GetComponent <Stats>().Damage(damage, context.Associate); var success = context.Reader.ReadBit(); context.Writer.WriteBit(success); if (success) { await OnSuccess.ExecuteAsync(context, branchContext); } }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var quickBuild = GameObject.Instantiate( context.Associate.Zone, Lot, context.Associate.Transform.Position, context.Associate.Transform.Rotation ); quickBuild.Transform.Position = context.Associate.Transform.Position; Object.Start(quickBuild); GameObject.Construct(quickBuild); GameObject.Serialize(quickBuild); var _ = Task.Run(async() => { await Task.Delay(branchContext.Duration); Object.Destroy(quickBuild); }); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); var hit = context.Reader.ReadBit(); context.Writer.Write(hit); if (hit) // Hit { if (CheckEnvironment) { var checkEnvironment = context.Reader.ReadBit(); // Check environment context.Writer.WriteBit(checkEnvironment); } var targets = new GameObject[context.Reader.Read <uint>()]; context.Writer.Write((uint)targets.Length); for (var i = 0; i < targets.Length; i++) { var targetId = context.Reader.Read <long>(); context.Writer.Write(targetId); if (!context.Associate.Zone.TryGetGameObject(targetId, out var target)) { Logger.Error($"{context.Associate} sent invalid TacArc target: {targetId}"); continue; } targets[i] = target; } foreach (var target in targets) { ((Player)context.Associate)?.SendChatMessage($"ATTACKING: {target}"); var branch = new ExecutionBranchContext(target) { Duration = branchContext.Duration }; await ActionBehavior.ExecuteAsync(context, branch); } } else { if (Blocked) { var isBlocked = context.Reader.ReadBit(); context.Writer.WriteBit(isBlocked); if (isBlocked) // Is blocked { await BlockedBehavior.ExecuteAsync(context, branchContext); } else { await MissBehavior.ExecuteAsync(context, branchContext); } } else { await MissBehavior.ExecuteAsync(context, branchContext); } } }
public override async Task SyncAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await Action.ExecuteAsync(context, branchContext); }
public override Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { return(Task.CompletedTask); }
public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext) { await base.ExecuteAsync(context, branchContext); await Action.ExecuteAsync(context, new ExecutionBranchContext(context.Associate)); }
public virtual Task DismantleAsync(ExecutionContext context, ExecutionBranchContext branchContext) { return(Task.CompletedTask); }