Esempio n. 1
0
        /// <summary>
        /// Removes a WorkflowComponent and it's connections from the workflow
        /// </summary>
        /// <param name="component"></param>
        public void RemoveComponent(WorkflowComponent component)
        {
            Triggers.ForEach(trigger => trigger.ConnectedTo.Remove(component.Id));
            Actions.ForEach(action => action.ConnectedTo.Remove(component.Id));

            Components.Remove(component);
        }
Esempio n. 2
0
        /// <summary>
        /// Update the auras on each zone (which can be influenced by entities from the
        /// <see cref="Zone.PLAY"/> zone.
        /// </summary>
        public void AuraUpdate()
        {
            Enchants.ForEach(p => p.IsEnabled());
            Triggers.ForEach(p => p.IsEnabled());

            CurrentPlayer.Hero.Enchants.ForEach(p => p.IsEnabled());
            CurrentPlayer.Hero.Triggers.ForEach(p => p.IsEnabled());

            //CurrentPlayer.Hero.Weapon?.Enchants.ForEach(p => p.IsEnabled());
            //CurrentPlayer.Hero.Weapon?.Triggers.ForEach(p => p.IsEnabled());

            CurrentPlayer.BoardZone.Enchants.ForEach(p => p.IsEnabled());
            CurrentPlayer.BoardZone.Triggers.ForEach(p => p.IsEnabled());

            CurrentPlayer.GraveyardZone.Enchants.ForEach(p => p.IsEnabled());
            CurrentPlayer.GraveyardZone.Triggers.ForEach(p => p.IsEnabled());

            CurrentOpponent.Hero.Enchants.ForEach(p => p.IsEnabled());
            CurrentOpponent.Hero.Triggers.ForEach(p => p.IsEnabled());

            //CurrentOpponent.Hero.Weapon?.Enchants.ForEach(p => p.IsEnabled());
            //CurrentOpponent.Hero.Weapon?.Triggers.ForEach(p => p.IsEnabled());

            CurrentOpponent.BoardZone.Enchants.ForEach(p => p.IsEnabled());
            CurrentOpponent.BoardZone.Triggers.ForEach(p => p.IsEnabled());

            CurrentOpponent.GraveyardZone.Enchants.ForEach(p => p.IsEnabled());
            CurrentOpponent.GraveyardZone.Triggers.ForEach(p => p.IsEnabled());

            Characters.ForEach(p1 => p1.Enchants.ForEach(p2 => p2.IsEnabled()));
            Characters.ForEach(p1 => p1.Triggers.ForEach(p2 => p2.IsEnabled()));

            LazyRemoves.ToList().ForEach(p => p.Remove());
            LazyRemoves.Clear();
        }
Esempio n. 3
0
 public void Tick(float dtime)
 {
     if (I.Status == EngineStatus.LoadedWorld)
     {
         Triggers.ForEach(x => x.AcceptTrigger());
         UpdateFunctions.ForEach(f => f.Value.Call(f.Key, dtime));
     }
 }
Esempio n. 4
0
        public void Update()
        {
            if (!Enabled)
            {
                return;
            }

            lock ( Triggers )
            {
                Triggers.ForEach(t => t.Update());
            }
        }
        public override void Dispose(bool disposing)
        {
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                Ragdoll.Dispose();
                Holders.ForEach((Holder h) => h.Dispose());
                Triggers.ForEach((Trigger t) => t.Dispose());
            }

            base.Dispose(disposing);
        }
        public override void Write(CustomFileWriter writer)
        {
            using (writer.WriteBlock($"job({Name.DoubleQuote()})"))
            {
                if (VolumeSize != null)
                {
                    writer.WriteLine($"volumeSize = {VolumeSize}");
                    writer.WriteLine();
                }

                using (writer.WriteBlock("git"))
                {
                    writer.WriteLine("depth = UNLIMITED_DEPTH");

                    if (RefSpec != null)
                    {
                        using (writer.WriteBlock("refSpec"))
                        {
                            RefSpec.ForEach(x => writer.WriteLine($"+{x.DoubleQuote()}"));
                        }
                    }
                }

                writer.WriteLine();
                Container.Write(writer);

                if (Triggers.Any())
                {
                    writer.WriteLine();
                    using (writer.WriteBlock("startOn"))
                    {
                        Triggers.ForEach(x => x.Write(writer));
                    }
                }

                if (TimeoutInMinutes != null)
                {
                    writer.WriteLine();
                    using (writer.WriteBlock("failOn"))
                    {
                        writer.WriteLine($"timeOut {{ timeOutInMinutes = {TimeoutInMinutes} }}");
                    }
                }
            }
        }
Esempio n. 7
0
        public string Hash(params GameTag[] ignore)
        {
            var str = new StringBuilder();

            str.Append("[Z:");
            str.Append($"{Type}");
            str.Append("][E:");
            List <IPlayable> list = GetAll;

            if (Type != Zone.PLAY)
            {
                list = list.OrderBy(p => p.Id).ToList();
                Array.Resize(ref ignore, ignore.Length + 1);
                ignore[ignore.Length - 1] = GameTag.ZONE_POSITION;
            }
            list.ForEach(p => str.Append(p.Hash(ignore)));
            str.Append($"][EN:{Enchants.Count}");
            Enchants.ForEach(p => str.Append(p.Hash));
            str.Append($"][TR:{Triggers.Count}");
            Triggers.ForEach(p => str.Append(p.Hash));
            str.Append("]");
            return(str.ToString());
        }
        public void Serialize(string path)
        {
            BinaryWriter Binary = new BinaryWriter(File.Open(path, FileMode.OpenOrCreate));

            Binary.Write((uint)(Interactable.Size * Interactables.Count + NPC.Size * NPCs.Count + Warp.Size * Warps.Count + Trigger.Size * Triggers.Count + 0x4));
            Binary.Write((byte)Interactables.Count);
            Binary.Write((byte)NPCs.Count);
            Binary.Write((byte)Warps.Count);
            Binary.Write((byte)Triggers.Count);

            // Because BinaryFormatter is "unsafe"...
            Interactables.ForEach(x => {
                Binary.Write(x.Script);
                Binary.Write(x.Condition);
                Binary.Write(x.Interactibility);
                Binary.Write(x.RailIndex);
                Binary.Write(x.X);
                Binary.Write(x.Y);
                Binary.Write(x.Z * 0x10);
            });

            NPCs.ForEach(x => {
                Binary.Write(x.ID);
                Binary.Write(x.ModelID);
                Binary.Write(x.MovementPermission);
                Binary.Write(x.Type);
                Binary.Write(x.SpawnFlag);
                Binary.Write(x.ScriptID);
                Binary.Write(x.FaceDirection);
                Binary.Write(x.SightRange);
                Binary.Write(x.Unknown);
                Binary.Write(x.Unknown2);
                Binary.Write(x.TraversalWidth);
                Binary.Write(x.TraversalHeight);
                Binary.Write(x.StartingX);
                Binary.Write(x.StartingY);
                Binary.Write(x.X);
                Binary.Write(x.Y);
                Binary.Write(x.Unknown3);
                Binary.Write(x.Z);
            });

            Warps.ForEach(x => {
                Binary.Write(x.TargetZone);
                Binary.Write(x.TargetWarp);
                Binary.Write(x.ContactDirection);
                Binary.Write(x.TransitionType);
                Binary.Write(x.CoordinateType);
                Binary.Write(x.X);
                Binary.Write(x.Z);
                Binary.Write(x.Y);
                Binary.Write(x.W);
                Binary.Write(x.H);
                Binary.Write(x.Rail);
            });

            Triggers.ForEach(x => {
                Binary.Write(x.Script);
                Binary.Write(x.ValueNeededForExecution);
                Binary.Write(x.Variable);
                Binary.Write(x.Unknown);
                Binary.Write(x.Unknown2);
                Binary.Write(x.X);
                Binary.Write(x.Y);
                Binary.Write(x.Z);
                Binary.Write(x.W);
                Binary.Write(x.H);
                Binary.Write(x.Unknown3);
            });

            int SectionOffset = 0;

            LevelScripts.ForEach(x => {
                Binary.Write(x.Unknown);
                Binary.Write(x.Unknown2);
                Binary.Write(x.Unknown3);
                SectionOffset += 0x6;
            });

            while (SectionOffset % 4 != 0)
            {
                Binary.Write((ushort)0x0);
                SectionOffset += 0x2;
            }

            LevelScripts.ForEach(x => {
                if (x.Data != null)
                {
                    Binary.Write(x.Data.Unknown);
                    Binary.Write(x.Data.Unknown2);
                    Binary.Write(x.Data.Unknown3);
                    SectionOffset += 0x6;
                }
            });

            while (SectionOffset % 4 != 0)
            {
                Binary.Write((ushort)0x0);
                SectionOffset += 0x2;
            }

            Binary.Close();
        }
Esempio n. 9
0
 protected Processor(ProcessorSettings settings)
 {
     Settings = settings;
     Triggers = Settings.TriggerSettings.Select(x => x.CreateInstance()).ToList();
     Triggers.ForEach(x => x.WriteLine += (sender, message) => OnWriteLine(message));
 }