Beispiel #1
0
        public static Dictionary <int, List <ShipBonus> > LoadBonusMap(YamlNode node)
        {
            Dictionary <int, List <ShipBonus> > bonuses = new Dictionary <int, List <ShipBonus> >();
            YamlMappingNode typeMapping = (YamlMappingNode)node;

            foreach (var typeEntry in typeMapping.Children)
            {
                int typeID = Int32.Parse(typeEntry.Key.ToString());
                bonuses[typeID] = ShipBonus.LoadBonusList(typeEntry.Value);
            }
            return(bonuses);
        }
Beispiel #2
0
 public static void Save(ShipBonus bonus, BinaryWriter save)
 {
     bonus.Save(save);
 }
Beispiel #3
0
        public InvType(YamlNode key, YamlNode node)
        {
            typeID = Int32.Parse(key.ToString());
            YamlMappingNode mapping = (YamlMappingNode)node;

            foreach (var entry in mapping.Children)
            {
                string paramName = entry.Key.ToString();
                switch (paramName)
                {
                case "name":
                    name = YamlUtils.GetLanguageString(YamlUtils.GetLanguageStrings(entry.Value), UserData.language);
                    break;

                case "description":
                    description = YamlUtils.GetLanguageString(YamlUtils.GetLanguageStrings(entry.Value), UserData.language);
                    break;

                case "capacity":
                    capacity = Double.Parse(entry.Value.ToString());
                    break;

                case "groupID":
                    groupID = Int32.Parse(entry.Value.ToString());
                    break;

                case "factionID":
                    factionID = Int64.Parse(entry.Value.ToString());
                    break;

                case "published":
                    published = Boolean.Parse(entry.Value.ToString());
                    break;

                case "graphicID":
                    graphicID = Int32.Parse(entry.Value.ToString());
                    break;

                case "iconID":
                    iconID = Int32.Parse(entry.Value.ToString());
                    break;

                case "marketGroupID":
                    marketGroupID = Int32.Parse(entry.Value.ToString());
                    break;

                case "mass":
                    mass = Double.Parse(entry.Value.ToString());
                    break;

                case "volume":
                    volume = Double.Parse(entry.Value.ToString());
                    break;

                case "radius":
                    radius = Double.Parse(entry.Value.ToString());
                    break;

                case "portionSize":
                    portionSize = Int32.Parse(entry.Value.ToString());
                    break;

                case "raceID":
                    raceID = Int32.Parse(entry.Value.ToString());
                    break;

                case "soundID":
                    soundID = Int32.Parse(entry.Value.ToString());
                    break;

                case "sofMaterialSetID":
                    sofMaterialSetID = Int32.Parse(entry.Value.ToString());
                    break;

                case "basePrice":
                    basePrice = Double.Parse(entry.Value.ToString());
                    break;

                case "sofFactionName":
                    sofFactionName = entry.Value.ToString();
                    break;

                case "masteries":
                    masteries = YamlUtils.LoadIndexedIntList(entry.Value);
                    break;

                case "traits":
                    YamlMappingNode traitMap = (YamlMappingNode)entry.Value;
                    foreach (var trait in traitMap.Children)
                    {
                        string traitName = trait.Key.ToString();
                        switch (traitName)
                        {
                        case "roleBonuses":
                            roleBonuses = ShipBonus.LoadBonusList(trait.Value);
                            break;

                        case "types":
                            traitTypes = ShipBonus.LoadBonusMap(trait.Value);
                            break;

                        case "miscBonuses":
                            miscBonuses = ShipBonus.LoadBonusList(trait.Value);
                            break;

                        default:
                            System.Diagnostics.Debug.WriteLine("InvType unknown trait:" + trait.Key + " = " + trait.Value);
                            break;
                        }
                    }
                    break;

                default:
                    System.Diagnostics.Debug.WriteLine("InvType unknown value:" + entry.Key + " = " + entry.Value);
                    break;
                }
            }
            types[typeID] = this;
        }