public Player(
     string name,
     GenderNames gender,
     RaceNames race,
     MapPosition startLocation)
     : base(name, gender, race, startLocation)
 {
     _lives = 1;
 }
        public PathfinderTraitForm()
        {
            InitializeComponent();

            this.loadedModifierList = CharacterCreator.Helpers.FileIO.Load <BindingList <ModifierData> >(this.modifierLoadPath);

            this.traitList              = CharacterCreator.Helpers.FileIO.Load <BindingList <TraitData> >(this.savePath);
            this.traitBox.DataSource    = this.traitList;
            this.traitBox.DisplayMember = "TraitName";
            this.traitBox.ValueMember   = "TraitName";

            this.traitTypeBox.DataSource      = TraitType.GetValues(typeof(TraitType));
            this.traitRegionBox.DataSource    = RegionNames.GetValues(typeof(RegionNames));
            this.traitCampaignBox.DataSource  = CampaignNames.GetValues(typeof(CampaignNames));
            this.traitRaceBox.DataSource      = RaceNames.GetValues(typeof(RaceNames));
            this.traitReligionBox.DataSource  = ReligionNames.GetValues(typeof(ReligionNames));
            this.traitConditionBox.DataSource = ConditionalStates.GetValues(typeof(ConditionalStates));
        }
示例#3
0
        /// <summary>
        /// Loads all data. Should be positioned on the start
        /// if the second data hunk.
        /// </summary>
        /// <param name="dataReader"></param>
        public ExecutableData(IDataReader dataReader)
        {
            // TODO: For now we search the offset of the filelist manually
            //       until we decode all of the data.
            dataReader.Position = (int)dataReader.FindString("0Map_data.amb", 0) - 184;

            // TODO ...
            FileList   = new FileList(dataReader);
            WorldNames = new WorldNames(dataReader);
            Messages   = new Messages(dataReader);
            if (dataReader.ReadDword() != 0)
            {
                throw new AmbermoonException(ExceptionScope.Data, "Invalid executable data.");
            }
            AutomapNames   = new AutomapNames(dataReader);
            OptionNames    = new OptionNames(dataReader);
            SongNames      = new SongNames(dataReader);
            SpellTypeNames = new SpellTypeNames(dataReader);
            SpellNames     = new SpellNames(dataReader);
            LanguageNames  = new LanguageNames(dataReader);
            ClassNames     = new ClassNames(dataReader);
            RaceNames      = new RaceNames(dataReader);
            AbilityNames   = new AbilityNames(dataReader);
            AttributeNames = new AttributeNames(dataReader);
            AbilityNames.AddShortNames(dataReader);
            AttributeNames.AddShortNames(dataReader);
            ItemTypeNames = new ItemTypeNames(dataReader);
            AilmentNames  = new AilmentNames(dataReader);
            UITexts       = new UITexts(dataReader);

            // TODO: There is a bunch of binary data (gfx maybe?)

            // TODO: Then finally the item data comes ...

            // TODO ...
        }
        private void FromXml_Version_1_56(XmlDocument xDoc)
        {
            XmlNodeList   xNodeList;
            HullRace      race;
            Vessel        vessel;
            BeamPort      bp;
            DronePort     dp;
            EnginePort    ep;
            ImpulsePoint  ip;
            ManeuverPoint mp;

            xNodeList = xDoc.GetElementsByTagName("hullRace");
            foreach (XmlNode node in xNodeList)
            {
                race = new HullRace();

                foreach (XmlAttribute att in node.Attributes)
                {
                    switch (att.Name)
                    {
                    case "ID":
                        race.ID = att.Value;
                        break;

                    case "name":
                        race.name = att.Value;
                        if (!RaceNames.Contains(race.name))
                        {
                            RaceNames.Add(race.name);
                        }
                        break;

                    case "keys":

                        foreach (string s in att.Value.Split(' '))
                        {
                            race.keys.Add(s);
                            if (!RaceKeys.Contains(s))
                            {
                                RaceKeys.Add(s);
                            }
                        }
                        break;
                    }
                }

                if (String.IsNullOrEmpty(race.ID))
                {
                    continue;
                }
                HullRaceList.Add(race.ID, race);
            }

            RaceNamesSortedByLength = RaceNames.ToList();
            RaceNamesSortedByLength.Sort(new Comparison <string>((string a, string b) =>
            {
                int diff = b.Split(' ').Length - a.Split(' ').Length;
                if (diff != 0)
                {
                    return(diff);
                }
                return(String.Compare(a, b));
            }
                                                                 ));

            xNodeList = xDoc.GetElementsByTagName("vessel");
            foreach (XmlNode node in xNodeList)
            {
                vessel = new Vessel();

                foreach (XmlAttribute att in node.Attributes)
                {
                    switch (att.Name)
                    {
                    case "uniqueID":
                        vessel.uniqueID = att.Value;
                        break;

                    case "side":
                        vessel.side = att.Value;
                        break;

                    case "classname":
                        vessel.classname = att.Value;
                        if (!VesselClassNames.Contains(vessel.classname))
                        {
                            VesselClassNames.Add(vessel.classname);
                        }
                        break;

                    case "broadType":
                        vessel.broadType = att.Value;
                        foreach (string broadType in vessel.broadType.Split(' '))
                        {
                            if (!VesselBroadTypes.Contains(broadType))
                            {
                                VesselBroadTypes.Add(broadType);
                            }
                        }
                        break;
                    }
                }

                if (String.IsNullOrEmpty(vessel.uniqueID))
                {
                    continue;
                }

                foreach (XmlNode subNode in node.ChildNodes)
                {
                    switch (subNode.Name)
                    {
                    case "art":
                        foreach (XmlAttribute att in node.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "meshfile":
                                vessel.meshfile = att.Value;
                                break;

                            case "diffuseFile":
                                vessel.diffuseFile = att.Value;
                                break;

                            case "glowFile":
                                vessel.glowFile = att.Value;
                                break;

                            case "specularFile":
                                vessel.specularFile = att.Value;
                                break;

                            case "scale":
                                vessel.scale = Helper.StringToDouble(att.Value);
                                break;

                            case "pushRadius":
                                vessel.pushRadius = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        break;

                    case "shields":
                        foreach (XmlAttribute att in node.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "front":
                                vessel.shields_front = Helper.StringToDouble(att.Value);
                                break;

                            case "back":
                                vessel.shields_back = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        break;

                    case "carrier":
                        foreach (XmlAttribute att in node.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "compliment":
                                vessel.carrier_compliment = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        break;

                    case "performance":
                        foreach (XmlAttribute att in node.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "turnrate":
                                vessel.preformance_turnrate = Helper.StringToDouble(att.Value);
                                break;

                            case "topspeed":
                                vessel.preformance_topspeed = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        break;

                    case "fleet_ai":
                        foreach (XmlAttribute att in node.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "commonality":
                                vessel.fleet_ai_commonality = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }

                        break;

                    case "beam_port":
                        bp = new BeamPort();
                        foreach (XmlAttribute att in subNode.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "x":
                                bp.x = Helper.StringToDouble(att.Value);
                                break;

                            case "y":
                                bp.y = Helper.StringToDouble(att.Value);
                                break;

                            case "z":
                                bp.z = Helper.StringToDouble(att.Value);
                                break;

                            case "range":
                                bp.range = Helper.StringToDouble(att.Value);
                                break;

                            case "damage":
                                bp.damage = Helper.StringToDouble(att.Value);
                                break;

                            case "cycletime":
                                bp.cycletime = Helper.StringToDouble(att.Value);
                                break;

                            case "arcwidth":
                                bp.arcwidth = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        vessel.beam_ports.Add(bp);
                        break;

                    case "drone_port":
                        dp = new DronePort();
                        foreach (XmlAttribute att in subNode.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "x":
                                dp.x = Helper.StringToDouble(att.Value);
                                break;

                            case "y":
                                dp.y = Helper.StringToDouble(att.Value);
                                break;

                            case "z":
                                dp.z = Helper.StringToDouble(att.Value);
                                break;

                            case "range":
                                dp.range = Helper.StringToDouble(att.Value);
                                break;

                            case "damage":
                                dp.damage = Helper.StringToDouble(att.Value);
                                break;

                            case "cycletime":
                                dp.cycletime = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        vessel.drone_ports.Add(dp);
                        break;

                    case "engine_port":
                        ep = new EnginePort();
                        foreach (XmlAttribute att in subNode.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "x":
                                ep.x = Helper.StringToDouble(att.Value);
                                break;

                            case "y":
                                ep.y = Helper.StringToDouble(att.Value);
                                break;

                            case "z":
                                ep.z = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        vessel.engine_ports.Add(ep);
                        break;

                    case "impulse_point":
                        ip = new ImpulsePoint();
                        foreach (XmlAttribute att in subNode.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "x":
                                ip.x = Helper.StringToDouble(att.Value);
                                break;

                            case "y":
                                ip.y = Helper.StringToDouble(att.Value);
                                break;

                            case "z":
                                ip.z = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        vessel.impulse_points.Add(ip);
                        break;

                    case "maneuver_point":
                        mp = new ManeuverPoint();
                        foreach (XmlAttribute att in subNode.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "x":
                                mp.x = Helper.StringToDouble(att.Value);
                                break;

                            case "y":
                                mp.y = Helper.StringToDouble(att.Value);
                                break;

                            case "z":
                                mp.z = Helper.StringToDouble(att.Value);
                                break;
                            }
                        }
                        vessel.maneuver_points.Add(mp);
                        break;
                    }
                }
                VesselList.Add(vessel.uniqueID, vessel);
            }

            VesselClassNamesSortedByLength = VesselClassNames.ToList();
            VesselClassNamesSortedByLength.Sort(new Comparison <string>((string a, string b) =>
            {
                int diff = b.Split(' ').Length - a.Split(' ').Length;
                if (diff != 0)
                {
                    return(diff);
                }
                return(String.Compare(a, b));
            }
                                                                        ));
        }