Пример #1
0
    // Add a section of an ini file to game content
    // name is from the ini file and must start with the type
    // path is relative and is used for images or other paths in the content
    void AddContent(string name, Dictionary <string, string> content, string path, string packID)
    {
        // Is this a "TileSide" entry?
        if (name.IndexOf(TileSideData.type) == 0)
        {
            TileSideData d = new TileSideData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!tileSides.ContainsKey(name))
            {
                tileSides.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (tileSides[name].priority < d.priority)
            {
                tileSides.Remove(name);
                tileSides.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (tileSides[name].priority == d.priority)
            {
                tileSides[name].sets.Add(packID);
            }
        }

        // Is this a "Hero" entry?
        if (name.IndexOf(HeroData.type) == 0)
        {
            HeroData d = new HeroData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!heros.ContainsKey(name))
            {
                heros.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (heros[name].priority < d.priority)
            {
                heros.Remove(name);
                heros.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (heros[name].priority == d.priority)
            {
                heros[name].sets.Add(packID);
            }
        }

        // Is this a "Monster" entry?
        if (name.IndexOf(MonsterData.type) == 0)
        {
            MonsterData d = new MonsterData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // Ignore monster activations
            if (name.IndexOf(ActivationData.type) != 0)
            {
                // If we don't already have one then add this
                if (!monsters.ContainsKey(name))
                {
                    monsters.Add(name, d);
                    d.sets.Add(packID);
                }
                // If we do replace if this has higher priority
                else if (monsters[name].priority < d.priority)
                {
                    monsters.Remove(name);
                    monsters.Add(name, d);
                }
                // items of the same priority belong to multiple packs
                else if (monsters[name].priority == d.priority)
                {
                    monsters[name].sets.Add(packID);
                }
            }
        }
        // Is this a "Activation" entry?
        if (name.IndexOf(ActivationData.type) == 0)
        {
            ActivationData d = new ActivationData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!activations.ContainsKey(name))
            {
                activations.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (activations[name].priority < d.priority)
            {
                activations.Remove(name);
                activations.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (activations[name].priority == d.priority)
            {
                activations[name].sets.Add(packID);
            }
        }

        // Is this a "Token" entry?
        if (name.IndexOf(TokenData.type) == 0)
        {
            TokenData d = new TokenData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!tokens.ContainsKey(name))
            {
                tokens.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (tokens[name].priority < d.priority)
            {
                tokens.Remove(name);
                tokens.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (tokens[name].priority == d.priority)
            {
                tokens[name].sets.Add(packID);
            }
        }

        // Is this a "Peril" entry?
        if (name.IndexOf(PerilData.type) == 0)
        {
            PerilData d = new PerilData(name, content);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!perils.ContainsKey(name))
            {
                perils.Add(name, d);
            }
            // If we do replace if this has higher priority
            else if (perils[name].priority < d.priority)
            {
                perils.Remove(name);
                perils.Add(name, d);
            }
        }
    }
Пример #2
0
    // Add a section of an ini file to game content
    // name is from the ini file and must start with the type
    // path is relative and is used for images or other paths in the content
    void AddContent(string name, Dictionary <string, string> content, string path, string packID)
    {
        // Is this a "PackType" entry?
        if (name.IndexOf(PackTypeData.type) == 0)
        {
            PackTypeData d = new PackTypeData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!packTypes.ContainsKey(name))
            {
                packTypes.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (packTypes[name].priority < d.priority)
            {
                packTypes.Remove(name);
                packTypes.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (packTypes[name].priority == d.priority)
            {
                packTypes[name].sets.Add(packID);
            }
        }

        // Is this a "TileSide" entry?
        if (name.IndexOf(TileSideData.type) == 0)
        {
            TileSideData d = new TileSideData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!tileSides.ContainsKey(name))
            {
                tileSides.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (tileSides[name].priority < d.priority)
            {
                tileSides.Remove(name);
                tileSides.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (tileSides[name].priority == d.priority)
            {
                tileSides[name].sets.Add(packID);
            }
        }

        // Is this a "Hero" entry?
        if (name.IndexOf(HeroData.type) == 0)
        {
            HeroData d = new HeroData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!heroes.ContainsKey(name))
            {
                heroes.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (heroes[name].priority < d.priority)
            {
                heroes.Remove(name);
                heroes.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (heroes[name].priority == d.priority)
            {
                heroes[name].sets.Add(packID);
            }
        }

        // Is this a "Class" entry?
        if (name.IndexOf(ClassData.type) == 0)
        {
            ClassData d = new ClassData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!classes.ContainsKey(name))
            {
                classes.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (classes[name].priority < d.priority)
            {
                classes.Remove(name);
                classes.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (classes[name].priority == d.priority)
            {
                classes[name].sets.Add(packID);
            }
        }

        // Is this a "Skill" entry?
        if (name.IndexOf(SkillData.type) == 0)
        {
            SkillData d = new SkillData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!skills.ContainsKey(name))
            {
                skills.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (skills[name].priority < d.priority)
            {
                skills.Remove(name);
                skills.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (skills[name].priority == d.priority)
            {
                skills[name].sets.Add(packID);
            }
        }

        // Is this a "Item" entry?
        if (name.IndexOf(ItemData.type) == 0)
        {
            ItemData d = new ItemData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!items.ContainsKey(name))
            {
                items.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (items[name].priority < d.priority)
            {
                items.Remove(name);
                items.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (items[name].priority == d.priority)
            {
                items[name].sets.Add(packID);
            }
        }

        // Is this a "Monster" entry?
        if (name.IndexOf(MonsterData.type) == 0)
        {
            MonsterData d = new MonsterData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // Ignore monster activations
            if (name.IndexOf(ActivationData.type) != 0)
            {
                // If we don't already have one then add this
                if (!monsters.ContainsKey(name))
                {
                    monsters.Add(name, d);
                    d.sets.Add(packID);
                }
                // If we do replace if this has higher priority
                else if (monsters[name].priority < d.priority)
                {
                    monsters.Remove(name);
                    monsters.Add(name, d);
                }
                // items of the same priority belong to multiple packs
                else if (monsters[name].priority == d.priority)
                {
                    monsters[name].sets.Add(packID);
                }
            }
        }

        // Is this a "Activation" entry?
        if (name.IndexOf(ActivationData.type) == 0)
        {
            ActivationData d = new ActivationData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!activations.ContainsKey(name))
            {
                activations.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (activations[name].priority < d.priority)
            {
                activations.Remove(name);
                activations.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (activations[name].priority == d.priority)
            {
                activations[name].sets.Add(packID);
            }
        }

        // Is this a "Attack" entry?
        if (name.IndexOf(AttackData.type) == 0)
        {
            AttackData d = new AttackData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!investigatorAttacks.ContainsKey(name))
            {
                investigatorAttacks.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (investigatorAttacks[name].priority < d.priority)
            {
                investigatorAttacks.Remove(name);
                investigatorAttacks.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (investigatorAttacks[name].priority == d.priority)
            {
                investigatorAttacks[name].sets.Add(packID);
            }
        }

        // Is this a "Evade" entry?
        if (name.IndexOf(EvadeData.type) == 0)
        {
            EvadeData d = new EvadeData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!investigatorEvades.ContainsKey(name))
            {
                investigatorEvades.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (investigatorEvades[name].priority < d.priority)
            {
                investigatorEvades.Remove(name);
                investigatorEvades.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (investigatorEvades[name].priority == d.priority)
            {
                investigatorEvades[name].sets.Add(packID);
            }
        }

        // Is this a "Horror" entry?
        if (name.IndexOf(HorrorData.type) == 0)
        {
            HorrorData d = new HorrorData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!horrorChecks.ContainsKey(name))
            {
                horrorChecks.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (horrorChecks[name].priority < d.priority)
            {
                horrorChecks.Remove(name);
                horrorChecks.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (horrorChecks[name].priority == d.priority)
            {
                horrorChecks[name].sets.Add(packID);
            }
        }

        // Is this a "Token" entry?
        if (name.IndexOf(TokenData.type) == 0)
        {
            TokenData d = new TokenData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!tokens.ContainsKey(name))
            {
                tokens.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (tokens[name].priority < d.priority)
            {
                tokens.Remove(name);
                tokens.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (tokens[name].priority == d.priority)
            {
                tokens[name].sets.Add(packID);
            }
        }

        // Is this a "Peril" entry?
        if (name.IndexOf(PerilData.type) == 0)
        {
            PerilData d = new PerilData(name, content);
            // Ignore invalid entry
            if (d.sectionName.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!perils.ContainsKey(name))
            {
                perils.Add(name, d);
            }
            // If we do replace if this has higher priority
            else if (perils[name].priority < d.priority)
            {
                perils.Remove(name);
                perils.Add(name, d);
            }
        }

        // Is this a "Puzzle" entry?
        if (name.IndexOf(PuzzleData.type) == 0)
        {
            PuzzleData d = new PuzzleData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!puzzles.ContainsKey(name))
            {
                puzzles.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (puzzles[name].priority < d.priority)
            {
                puzzles.Remove(name);
                puzzles.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (puzzles[name].priority == d.priority)
            {
                puzzles[name].sets.Add(packID);
            }
        }

        // Is this a "Image" entry?
        if (name.IndexOf(ImageData.type) == 0)
        {
            ImageData d = new ImageData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!images.ContainsKey(name))
            {
                images.Add(name, d);
                d.sets.Add(packID);
            }
            // If we do replace if this has higher priority
            else if (images[name].priority < d.priority)
            {
                images.Remove(name);
                images.Add(name, d);
            }
            // items of the same priority belong to multiple packs
            else if (images[name].priority == d.priority)
            {
                images[name].sets.Add(packID);
            }
        }

        // Is this a "Audio" entry?
        if (name.IndexOf(AudioData.type) == 0)
        {
            AudioData d = new AudioData(name, content, path);
            // Ignore invalid entry
            if (d.name.Equals(""))
            {
                return;
            }
            // If we don't already have one then add this
            if (!audio.ContainsKey(name))
            {
                audio.Add(name, d);
            }
            // If we do replace if this has higher priority
            else if (audio[name].priority < d.priority)
            {
                audio.Remove(name);
                audio.Add(name, d);
            }
        }
    }
Пример #3
0
 public Peril(string name) : base(name)
 {
     // Event is pulled from content data not quest data
     cPeril = game.cd.Get <PerilData>(name);
     qEvent = cPeril;
 }
Пример #4
0
 public Peril(string name) : base(name)
 {
     // Event is pulled from content data not quest data
     qEvent = game.cd.perils[name] as QuestData.Event;
     cPeril = qEvent as PerilData;
 }
Пример #5
0
 public Peril(string name) : base(name)
 {
     qEvent = game.cd.perils[name] as QuestData.Event;
     cPeril = qEvent as PerilData;
 }