Example #1
0
        public void MergeTemplate(T_Generic Template)
        {
            if (Template.TemplateType == "WAVESPAWN")
            {
                throw new Exception("IncorrectTemplateTypeException");
            }

            // Template value merges iff:
            // 1. Template value != Node value
            // 2. Template value != default value
            // 3. Node value == default value

            if (this.Name != Template.Name && Template.Name != null && this.Name == null)
            {
                this.Name = Template.Name;
            }

            if (this.Attributes != Template.Attributes && Template.Attributes.Count > 0 && this.Attributes.Count == 0)
            {
                this.Attributes = Template.Attributes;
            }

            if (this.Class != Template.Class && Template.Class != null && this.Class == null)
            {
                this.Class = Template.Class;
            }

            if (this.ClassIcon != Template.ClassIcon && Template.ClassIcon != null && this.ClassIcon == null)
            {
                this.ClassIcon = Template.ClassIcon;
            }

            if (this.Health != Template.Health && Template.Health != 0 && this.Health == 0 && this.Health == 0)
            {
                this.Health = Template.Health;
            }

            if (this.Scale != Template.Scale && Template.Scale != 1.0f && this.Scale == 1.0f)
            {
                this.Scale = Template.Scale;
            }

            if (this.AutoJumpMin != Template.AutoJumpMin && Template.AutoJumpMin > 0 && this.AutoJumpMin == 0)
            {
                this.AutoJumpMin = Template.AutoJumpMin;
            }

            if (this.AutoJumpMax != Template.AutoJumpMax && Template.AutoJumpMax > 0 && this.AutoJumpMax == 0)
            {
                this.AutoJumpMax = Template.AutoJumpMax;
            }

            if (this.Skill != Template.Skill && Template.Skill != "Easy" && this.Skill == "Easy")
            {
                this.Skill = Template.Skill;
            }

            if (this.WeaponRestrictions != Template.WeaponRestrictions && Template.WeaponRestrictions != null && this.WeaponRestrictions == null)
            {
                this.WeaponRestrictions = Template.WeaponRestrictions;
            }

            if (this.BehaviorModifiers != Template.BehaviorModifiers && Template.BehaviorModifiers != null && this.BehaviorModifiers == null)
            {
                this.BehaviorModifiers = Template.BehaviorModifiers;
            }

            if (this.MaxVisionRange != Template.MaxVisionRange && Template.MaxVisionRange != 6000.0f && this.MaxVisionRange == 6000.0f)
            {
                this.MaxVisionRange = Template.MaxVisionRange;
            }

            if (this.Items != Template.Items && Template.Items.Count > 0 && this.Items.Count == 0)               // Combine inventories
            {
                foreach (string Item in Template.Items)
                {
                    this.Items.Add(Item);
                }
            }

            if (this.TeleportWheres != Template.TeleportWheres && Template.TeleportWheres.Count > 0 && this.TeleportWheres.Count == 0)
            {
                this.TeleportWheres = Template.TeleportWheres;
            }

            if (this.Tags != Template.Tags && Template.Tags.Count > 0 && this.Tags.Count == 0)
            {
                this.Tags = Template.Tags;
            }

            if (this.ItemAttributes != Template.ItemAttributes && Template.ItemAttributes.Count > 0 && this.ItemAttributes.Count == 0)
            {
                this.ItemAttributes = Template.ItemAttributes;
            }

            if (this.CharacterAttributes != Template.CharacterAttributes && Template.CharacterAttributes.Count > 0 && this.CharacterAttributes.Count == 0)
            {
                this.CharacterAttributes = Template.CharacterAttributes;
            }
        }
Example #2
0
        public void MergeTemplate(T_Generic Template)
        {
            if (Template.TemplateType == "TFBOT")
            {
                throw new Exception("IncorrectTemplateTypeException");
            }

            // Template value merges iff:
            // 1. Template value != Node value
            // 2. Template value != default value
            // 3. Node value == default value

            if (this.Name != Template.Name && Template.Name != null && this.Name == null)
            {
                this.Name = Template.Name;
            }

            if (this.TotalCurrency != Template.TotalCurrency && Template.TotalCurrency > 0 && this.TotalCurrency == 0)
            {
                this.TotalCurrency = Template.TotalCurrency;
            }

            if (this.TotalCount != Template.TotalCount && Template.TotalCount > 0 && this.TotalCount == 0)
            {
                this.TotalCount = Template.TotalCount;
            }

            if (this.Where != Template.Where && Template.Where.Count > 0 && this.Where.Count == 0)
            {
                this.Where = Template.Where;
            }

            if (this.MaxActive != Template.MaxActive && Template.MaxActive > 0 && this.MaxActive == 0)
            {
                this.MaxActive = Template.MaxActive;
            }

            if (this.SpawnCount != Template.SpawnCount && Template.SpawnCount > 0 && this.SpawnCount == 0)
            {
                this.SpawnCount = Template.SpawnCount;
            }

            if (this.Support != Template.Support && Template.Support && !this.Support)
            {
                this.Support = Template.Support;

                if (this.SupportLimited != Template.SupportLimited && Template.SupportLimited && !this.SupportLimited)
                {
                    this.SupportLimited = Template.SupportLimited;
                }
            }

            if (this.WaitForAllDead != Template.WaitForAllDead && Template.WaitForAllDead != null && this.WaitForAllDead == null)
            {
                this.WaitForAllDead = Template.WaitForAllDead;
            }

            if (this.WaitForAllSpawned != Template.WaitForAllSpawned && Template.WaitForAllSpawned != null && this.WaitForAllSpawned == null)
            {
                this.WaitForAllSpawned = Template.WaitForAllSpawned;
            }

            if (this.WaitBeforeStarting != Template.WaitBeforeStarting && Template.WaitBeforeStarting > 0 && this.WaitBeforeStarting == 0)
            {
                this.WaitBeforeStarting = Template.WaitBeforeStarting;
            }

            if (this.WaitBetweenSpawns != Template.WaitBetweenSpawns && Template.WaitBetweenSpawns > 0 && this.WaitBetweenSpawns == 0)
            {
                this.WaitBetweenSpawns = Template.WaitBetweenSpawns;
            }

            if (this.WaitBetweenSpawnsAfterDeath != Template.WaitBetweenSpawnsAfterDeath && Template.WaitBetweenSpawnsAfterDeath > 0 && this.WaitBetweenSpawnsAfterDeath == 0)
            {
                this.WaitBetweenSpawnsAfterDeath = Template.WaitBetweenSpawnsAfterDeath;
            }

            if (this.RandomSpawn != Template.RandomSpawn && Template.RandomSpawn && !this.RandomSpawn)
            {
                this.RandomSpawn = Template.RandomSpawn;
            }

            if (this.StartWaveWarningSound != Template.StartWaveWarningSound && Template.StartWaveWarningSound != null && this.StartWaveWarningSound == null)
            {
                this.StartWaveWarningSound = Template.StartWaveWarningSound;
            }

            if (this.StartWaveOutput != Template.StartWaveOutput && Template.StartWaveOutput != null && this.StartWaveOutput == null)
            {
                this.StartWaveOutput = Template.StartWaveOutput;
            }

            if (this.FirstSpawnWarningSound != Template.FirstSpawnWarningSound && Template.FirstSpawnWarningSound != null && this.FirstSpawnWarningSound == null)
            {
                this.FirstSpawnWarningSound = Template.FirstSpawnWarningSound;
            }

            if (this.FirstSpawnOutput != Template.FirstSpawnOutput && Template.FirstSpawnOutput != null && this.FirstSpawnOutput == null)
            {
                this.FirstSpawnOutput = Template.FirstSpawnOutput;
            }

            if (this.LastSpawnWarningSound != Template.LastSpawnWarningSound && Template.LastSpawnWarningSound != null && this.LastSpawnWarningSound == null)
            {
                this.LastSpawnWarningSound = Template.LastSpawnWarningSound;
            }

            if (this.LastSpawnOutput != Template.LastSpawnOutput && Template.LastSpawnOutput != null && this.LastSpawnOutput == null)
            {
                this.LastSpawnOutput = Template.LastSpawnOutput;
            }

            if (this.DoneWarningSound != Template.DoneWarningSound && Template.DoneWarningSound != null && this.DoneWarningSound == null)
            {
                this.DoneWarningSound = Template.DoneWarningSound;
            }

            if (this.DoneOutput != Template.DoneOutput && Template.DoneOutput != null && this.DoneOutput == null)
            {
                this.DoneOutput = Template.DoneOutput;
            }

            if (this.Spawner != Template.Spawner && Template.Spawner != null && this.Spawner == null)
            {
                this.Spawner = Template.Spawner;
            }
        }