Esempio n. 1
0
        public SkillChallengeBuilderForm(Masterplan.Data.SkillChallenge sc)
        {
            this.InitializeComponent();
            Application.Idle += new EventHandler(this.Application_Idle);
            this.fChallenge   = sc.Copy() as Masterplan.Data.SkillChallenge;
            this.update_all();
            foreach (string skillName in Skills.GetSkillNames())
            {
                string       str  = Skills.GetKeyAbility(skillName).Substring(0, 3);
                string       str1 = str.Substring(0, 3);
                ListViewItem item = this.SkillSourceList.Items.Add(skillName);
                ListViewItem.ListViewSubItem grayText = item.SubItems.Add(str1);
                item.UseItemStyleForSubItems = false;
                grayText.ForeColor           = SystemColors.GrayText;
                item.Group = this.SkillSourceList.Groups[0];
            }
            foreach (string abilityName in Skills.GetAbilityNames())
            {
                string       str2         = abilityName.Substring(0, 3);
                ListViewItem listViewItem = this.SkillSourceList.Items.Add(abilityName);
                ListViewItem.ListViewSubItem listViewSubItem = listViewItem.SubItems.Add(str2);
                listViewItem.UseItemStyleForSubItems = false;
                listViewSubItem.ForeColor            = SystemColors.GrayText;
                listViewItem.Group = this.SkillSourceList.Groups[1];
            }
            ListViewItem item1 = this.SkillSourceList.Items.Add("(custom skill)");

            ListViewItem.ListViewSubItem grayText1 = item1.SubItems.Add("");
            item1.UseItemStyleForSubItems = false;
            grayText1.ForeColor           = SystemColors.GrayText;
            item1.Group = this.SkillSourceList.Groups[2];
        }
Esempio n. 2
0
        /// <summary>
        /// Finds the list of tactical maps which are used in this plot.
        /// </summary>
        /// <returns>Returns the list of IDs of maps.</returns>
        public List <Guid> FindTacticalMaps()
        {
            BinarySearchTree <Guid> bst = new BinarySearchTree <Guid>();

            foreach (PlotPoint pp in fPoints)
            {
                if (pp.Element != null)
                {
                    if (pp.Element is Encounter)
                    {
                        Encounter enc = pp.Element as Encounter;

                        if ((enc.MapID != Guid.Empty) && (enc.MapAreaID != Guid.Empty))
                        {
                            bst.Add(enc.MapID);
                        }
                    }

                    if (pp.Element is TrapElement)
                    {
                        TrapElement te = pp.Element as TrapElement;

                        if ((te.MapID != Guid.Empty) && (te.MapAreaID != Guid.Empty))
                        {
                            bst.Add(te.MapID);
                        }
                    }

                    if (pp.Element is SkillChallenge)
                    {
                        SkillChallenge sc = pp.Element as SkillChallenge;

                        if ((sc.MapID != Guid.Empty) && (sc.MapAreaID != Guid.Empty))
                        {
                            bst.Add(sc.MapID);
                        }
                    }

                    if (pp.Element is MapElement)
                    {
                        MapElement me = pp.Element as MapElement;

                        if (me.MapID != Guid.Empty)
                        {
                            bst.Add(me.MapID);
                        }
                    }
                }
            }

            List <Guid> list = bst.SortedList;

            list.Remove(Guid.Empty);

            return(list);
        }
Esempio n. 3
0
        public List <Guid> FindTacticalMaps()
        {
            BinarySearchTree <Guid> binarySearchTree = new BinarySearchTree <Guid>();

            foreach (PlotPoint fPoint in this.fPoints)
            {
                if (fPoint.Element == null)
                {
                    continue;
                }
                if (fPoint.Element is Encounter)
                {
                    Encounter element = fPoint.Element as Encounter;
                    if (element.MapID != Guid.Empty && element.MapAreaID != Guid.Empty)
                    {
                        binarySearchTree.Add(element.MapID);
                    }
                }
                if (fPoint.Element is TrapElement)
                {
                    TrapElement trapElement = fPoint.Element as TrapElement;
                    if (trapElement.MapID != Guid.Empty && trapElement.MapAreaID != Guid.Empty)
                    {
                        binarySearchTree.Add(trapElement.MapID);
                    }
                }
                if (fPoint.Element is SkillChallenge)
                {
                    SkillChallenge skillChallenge = fPoint.Element as SkillChallenge;
                    if (skillChallenge.MapID != Guid.Empty && skillChallenge.MapAreaID != Guid.Empty)
                    {
                        binarySearchTree.Add(skillChallenge.MapID);
                    }
                }
                if (!(fPoint.Element is MapElement))
                {
                    continue;
                }
                MapElement mapElement = fPoint.Element as MapElement;
                if (mapElement.MapID == Guid.Empty)
                {
                    continue;
                }
                binarySearchTree.Add(mapElement.MapID);
            }
            List <Guid> sortedList = binarySearchTree.SortedList;

            sortedList.Remove(Guid.Empty);
            return(sortedList);
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the tactical map and map area associated with the point, if any.
        /// </summary>
        /// <param name="map">The map associated with the point.</param>
        /// <param name="map_area">The map area associated with the point.</param>
        public void GetTacticalMapArea(ref Map map, ref MapArea map_area)
        {
            Guid map_id      = Guid.Empty;
            Guid map_area_id = Guid.Empty;

            Encounter enc = fElement as Encounter;

            if (enc != null)
            {
                map_id      = enc.MapID;
                map_area_id = enc.MapAreaID;
            }

            SkillChallenge sc = fElement as SkillChallenge;

            if (sc != null)
            {
                map_id      = sc.MapID;
                map_area_id = sc.MapAreaID;
            }

            TrapElement te = fElement as TrapElement;

            if (te != null)
            {
                map_id      = te.MapID;
                map_area_id = te.MapAreaID;
            }

            MapElement me = fElement as MapElement;

            if (me != null)
            {
                map_id      = me.MapID;
                map_area_id = me.MapAreaID;
            }

            if ((map_id != Guid.Empty) && (map_area_id != Guid.Empty))
            {
                map = Session.Project.FindTacticalMap(map_id);
                if (map != null)
                {
                    map_area = map.FindArea(map_area_id);
                }
            }
        }
Esempio n. 5
0
        public void GetTacticalMapArea(ref Map map, ref MapArea map_area)
        {
            Guid      empty     = Guid.Empty;
            Guid      mapAreaID = Guid.Empty;
            Encounter encounter = this.fElement as Encounter;

            if (encounter != null)
            {
                empty     = encounter.MapID;
                mapAreaID = encounter.MapAreaID;
            }
            SkillChallenge skillChallenge = this.fElement as SkillChallenge;

            if (skillChallenge != null)
            {
                empty     = skillChallenge.MapID;
                mapAreaID = skillChallenge.MapAreaID;
            }
            TrapElement trapElement = this.fElement as TrapElement;

            if (trapElement != null)
            {
                empty     = trapElement.MapID;
                mapAreaID = trapElement.MapAreaID;
            }
            MapElement mapElement = this.fElement as MapElement;

            if (mapElement != null)
            {
                empty     = mapElement.MapID;
                mapAreaID = mapElement.MapAreaID;
            }
            if (empty != Guid.Empty && mapAreaID != Guid.Empty)
            {
                map = Session.Project.FindTacticalMap(empty);
                if (map != null)
                {
                    map_area = map.FindArea(mapAreaID);
                }
            }
        }
Esempio n. 6
0
        public IElement Copy()
        {
            SkillChallenge skillChallenge = new SkillChallenge()
            {
                ID         = this.fID,
                Name       = this.fName,
                Level      = this.fLevel,
                Complexity = this.fComplexity
            };

            foreach (SkillChallengeData fSkill in this.fSkills)
            {
                skillChallenge.Skills.Add(fSkill.Copy());
            }
            skillChallenge.Success   = this.fSuccess;
            skillChallenge.Failure   = this.fFailure;
            skillChallenge.Notes     = this.fNotes;
            skillChallenge.MapID     = this.fMapID;
            skillChallenge.MapAreaID = this.fMapAreaID;
            return(skillChallenge);
        }
Esempio n. 7
0
        /// <summary>
        /// Creates a copy of the challenge.
        /// </summary>
        /// <returns>Returns the copy.</returns>
        public IElement Copy()
        {
            SkillChallenge sc = new SkillChallenge();

            sc.ID         = fID;
            sc.Name       = fName;
            sc.Level      = fLevel;
            sc.Complexity = fComplexity;

            foreach (SkillChallengeData scd in fSkills)
            {
                sc.Skills.Add(scd.Copy());
            }

            sc.Success   = fSuccess;
            sc.Failure   = fFailure;
            sc.Notes     = fNotes;
            sc.MapID     = fMapID;
            sc.MapAreaID = fMapAreaID;

            return(sc);
        }
Esempio n. 8
0
        public SkillChallenge FindSkillChallenge(Guid sc_id)
        {
            SkillChallenge skillChallenge;

            List <SkillChallenge> .Enumerator enumerator = this.fSkillChallenges.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    SkillChallenge current = enumerator.Current;
                    if (current == null || !(current.ID == sc_id))
                    {
                        continue;
                    }
                    skillChallenge = current;
                    return(skillChallenge);
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
        }
Esempio n. 9
0
 public int GetXP()
 {
     return(SkillChallenge.GetXP(this.fLevel, this.fComplexity));
 }